chore: added disabled prop to multiple select components (#4724)

* chore: added disabled prop to mutliple select group hoc

* style: fix empty space
This commit is contained in:
Aaryan Khandelwal 2024-06-07 13:59:57 +05:30 committed by GitHub
parent cdb932ab67
commit 1c849103f9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 62 additions and 18 deletions

View file

@ -18,6 +18,8 @@ export const MultipleSelectEntityAction: React.FC<Props> = (props) => {
// derived values
const isSelected = selectionHelpers.getIsEntitySelected(id);
if (selectionHelpers.isSelectionDisabled) return null;
return (
<Checkbox
className={cn("!outline-none size-3.5", className)}

View file

@ -17,6 +17,8 @@ export const MultipleSelectGroupAction: React.FC<Props> = (props) => {
// derived values
const groupSelectionStatus = selectionHelpers.isGroupSelected(groupID);
if (selectionHelpers.isSelectionDisabled) return null;
return (
<Checkbox
className={cn("size-3.5 !outline-none", className)}

View file

@ -5,14 +5,16 @@ import { TSelectionHelper, useMultipleSelect } from "@/hooks/use-multiple-select
type Props = {
children: (helpers: TSelectionHelper) => React.ReactNode;
containerRef: React.MutableRefObject<HTMLElement | null>;
disabled?: boolean;
entities: Record<string, string[]>; // { groupID: entityIds[] }
};
export const MultipleSelectGroup: React.FC<Props> = observer((props) => {
const { children, containerRef, entities } = props;
const { children, containerRef, disabled = false, entities } = props;
const helpers = useMultipleSelect({
containerRef,
disabled,
entities,
});