@m4l/components 9.3.43 → 9.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@types/export.d.ts +2 -2
- package/@types/types.d.ts +18 -10
- package/components/CheckableList/CheckableList.d.ts +20 -0
- package/components/CheckableList/CheckableList.js +225 -0
- package/components/CheckableList/CheckableList.styles.d.ts +2 -0
- package/components/CheckableList/CheckableList.styles.js +247 -0
- package/components/CheckableList/constants.d.ts +5 -0
- package/components/CheckableList/constants.js +17 -0
- package/components/CheckableList/dictionary.d.ts +14 -0
- package/components/CheckableList/dictionary.js +14 -0
- package/components/CheckableList/hooks/index.d.ts +6 -0
- package/components/CheckableList/hooks/useCheckableListHandlers.d.ts +21 -0
- package/components/CheckableList/hooks/useCheckableListHandlers.js +66 -0
- package/components/CheckableList/hooks/useCheckableListItems.d.ts +19 -0
- package/components/CheckableList/hooks/useCheckableListItems.js +79 -0
- package/components/CheckableList/hooks/useCheckableListRender.d.ts +52 -0
- package/components/CheckableList/hooks/useCheckableListRender.js +223 -0
- package/components/CheckableList/hooks/useCheckableListSelection.d.ts +19 -0
- package/components/CheckableList/hooks/useCheckableListSelection.js +69 -0
- package/components/CheckableList/hooks/useCheckableListState.d.ts +17 -0
- package/components/CheckableList/hooks/useCheckableListState.js +59 -0
- package/components/CheckableList/hooks/useCheckableListVirtualization.d.ts +14 -0
- package/components/CheckableList/hooks/useCheckableListVirtualization.js +42 -0
- package/components/CheckableList/icons.d.ts +5 -0
- package/components/CheckableList/icons.js +8 -0
- package/components/CheckableList/index.d.ts +3 -0
- package/components/CheckableList/index.js +1 -0
- package/components/CheckableList/slots/index.d.ts +2 -0
- package/components/CheckableList/slots/index.js +1 -0
- package/components/CheckableList/slots/slots.d.ts +26 -0
- package/components/CheckableList/slots/slots.js +30 -0
- package/components/CheckableList/slots/styled.d.ts +72 -0
- package/components/CheckableList/slots/styled.js +130 -0
- package/components/CheckableList/types.d.ts +277 -0
- package/components/CommonActions/components/ActionFormCancel/ActionFormCancel.js +1 -1
- package/components/DataGrid/Datagrid.styles.js +8 -8
- package/components/DataGrid/subcomponents/CheckboxCellAdapter/index.js +2 -2
- package/components/DataGrid/subcomponents/Table/subcomponents/RadioFormatter.d.ts +6 -0
- package/components/DataGrid/subcomponents/Table/subcomponents/RadioFormatter.js +12 -0
- package/components/DataGrid/subcomponents/Table/subcomponents/RadioSelectColumn.js +2 -2
- package/components/DynamicFilter/store/DynamicFilterContext.js +11 -0
- package/components/DynamicFilter/store/DynamicFilterStore.js +9 -0
- package/components/DynamicFilter/subcomponents/DynamicFilterBase/useDynamicFilterBase.d.ts +1 -1
- package/components/DynamicFilter/types.d.ts +4 -0
- package/components/DynamicSort/store/DynamicSortStore.js +6 -0
- package/components/DynamicSort/subcomponents/DynamicSortBase/useDynamicSortBase.d.ts +1 -1
- package/components/DynamicSort/types.d.ts +4 -0
- package/components/MFIsolationApp/slots/MFIsolationAppSlots.d.ts +2 -2
- package/components/ObjectLogs/slots/ObjectLogsSlots.d.ts +1 -1
- package/components/Stepper/Stepper.styles.js +13 -8
- package/components/WindowBase/hooks/useDynamicMFParameters/index.d.ts +4 -4
- package/components/areas/contexts/AreasContext/store.js +2 -2
- package/components/commercial/SectionCommercial/styles.d.ts +1 -1
- package/components/hook-form/RHFCheckableList/RHFCheckableList.d.ts +7 -0
- package/components/hook-form/RHFCheckableList/RHFCheckableList.js +91 -0
- package/components/hook-form/RHFCheckableList/RHFCheckableList.styles.d.ts +2 -0
- package/components/hook-form/RHFCheckableList/RHFCheckableList.styles.js +30 -0
- package/components/hook-form/RHFCheckableList/constants.d.ts +8 -0
- package/components/hook-form/RHFCheckableList/constants.js +11 -0
- package/components/hook-form/RHFCheckableList/index.d.ts +2 -0
- package/components/hook-form/RHFCheckableList/index.js +1 -0
- package/components/hook-form/RHFCheckableList/slots/RHFCheckableListEnum.d.ts +6 -0
- package/components/hook-form/RHFCheckableList/slots/RHFCheckableListEnum.js +10 -0
- package/components/hook-form/RHFCheckableList/slots/RHFCheckableListSlots.d.ts +20 -0
- package/components/hook-form/RHFCheckableList/slots/RHFCheckableListSlots.js +29 -0
- package/components/hook-form/RHFCheckableList/slots/index.d.ts +2 -0
- package/components/hook-form/RHFCheckableList/types.d.ts +60 -0
- package/components/hook-form/RHFColorPicker/hooks/useColorPicker/useColorPicker.d.ts +1 -1
- package/components/hook-form/RHFPeriod/subcomponents/Period/Period.js +3 -4
- package/components/hook-form/RHFRadioGroup/RHFRadioGroup.d.ts +3 -3
- package/components/hook-form/RHFRadioGroup/RHFRadioGroup.js +66 -24
- package/components/hook-form/RHFRadioGroup/RHFRadioGroup.styles.d.ts +5 -0
- package/components/hook-form/RHFRadioGroup/RHFRadioGroup.styles.js +29 -0
- package/components/hook-form/RHFRadioGroup/constants.d.ts +5 -0
- package/components/hook-form/RHFRadioGroup/constants.js +8 -0
- package/components/hook-form/RHFRadioGroup/formatters/OptionIconLabelFormatter/index.d.ts +2 -2
- package/components/hook-form/RHFRadioGroup/slots/slots.d.ts +5 -0
- package/components/hook-form/RHFRadioGroup/slots/slots.js +9 -0
- package/components/hook-form/RHFRadioGroup/slots/styled.d.ts +9 -0
- package/components/hook-form/RHFRadioGroup/slots/styled.js +20 -0
- package/components/hook-form/RHFRadioGroup/types.d.ts +55 -11
- package/components/hook-form/RHFUpload/RHFUploadImage/subcomponents/UploadImage/UploadImage.js +1 -1
- package/components/hook-form/index.d.ts +1 -0
- package/components/index.d.ts +1 -0
- package/components/mui_extended/CheckBox/CheckBox.js +2 -0
- package/components/mui_extended/Radio/Radio.d.ts +20 -0
- package/components/mui_extended/{RadioButton/RadioButton.js → Radio/Radio.js} +27 -26
- package/components/mui_extended/Radio/Radio.styles.d.ts +2 -0
- package/components/mui_extended/{RadioButton/RadioButton.styles.js → Radio/Radio.styles.js} +17 -42
- package/components/mui_extended/Radio/constants.d.ts +2 -0
- package/components/mui_extended/Radio/constants.js +8 -0
- package/components/mui_extended/Radio/index.d.ts +1 -0
- package/components/mui_extended/Radio/index.js +1 -0
- package/components/mui_extended/Radio/slots/slots.d.ts +6 -0
- package/components/mui_extended/Radio/slots/slots.js +10 -0
- package/components/mui_extended/{RadioButton/slots/RadioButtonSlots.d.ts → Radio/slots/styled.d.ts} +6 -12
- package/components/mui_extended/Radio/slots/styled.js +28 -0
- package/components/mui_extended/Radio/types.d.ts +53 -0
- package/components/mui_extended/Stack/Stack.d.ts +1 -1
- package/components/mui_extended/Stack/Stack.js +5 -2
- package/components/mui_extended/index.d.ts +1 -1
- package/hooks/useDynamicFilterAndSort/slots/DynamicFilterAndSortEnum.d.ts +2 -1
- package/hooks/useDynamicFilterAndSort/slots/DynamicFilterAndSortEnum.js +1 -0
- package/hooks/useDynamicFilterAndSort/slots/DynamicFilterAndSortSlots.d.ts +6 -3
- package/hooks/useDynamicFilterAndSort/slots/DynamicFilterAndSortSlots.js +6 -0
- package/hooks/useDynamicFilterAndSort/styles.js +23 -0
- package/hooks/useDynamicFilterAndSort/types.d.ts +2 -0
- package/hooks/useDynamicFilterAndSort/useDynamicFilterAndSort.js +27 -21
- package/index.js +145 -139
- package/package.json +1 -1
- package/components/DataGrid/subcomponents/Table/subcomponents/RadioButtonFormatter.d.ts +0 -6
- package/components/DataGrid/subcomponents/Table/subcomponents/RadioButtonFormatter.js +0 -12
- package/components/hook-form/RHFRadioGroup/formatters/OptionIconLabelFormatter/index.js +0 -16
- package/components/mui_extended/RadioButton/RadioButton.d.ts +0 -24
- package/components/mui_extended/RadioButton/RadioButton.styles.d.ts +0 -2
- package/components/mui_extended/RadioButton/constants.d.ts +0 -1
- package/components/mui_extended/RadioButton/constants.js +0 -4
- package/components/mui_extended/RadioButton/index.d.ts +0 -1
- package/components/mui_extended/RadioButton/slots/RadioButtonEnum.d.ts +0 -8
- package/components/mui_extended/RadioButton/slots/RadioButtonEnum.js +0 -12
- package/components/mui_extended/RadioButton/slots/RadioButtonSlots.js +0 -39
- package/components/mui_extended/RadioButton/types.d.ts +0 -50
- /package/components/{mui_extended/RadioButton → CheckableList/hooks}/index.js +0 -0
- /package/components/DataGrid/tests/table/subcomponents/{RadioButtonFormatter.test.d.ts → RadioFormatter.test.d.ts} +0 -0
- /package/components/mui_extended/{RadioButton → Radio}/icons.d.ts +0 -0
- /package/components/mui_extended/{RadioButton → Radio}/icons.js +0 -0
- /package/components/mui_extended/{RadioButton/tests/RadioButton.test.d.ts → Radio/tests/Radio.test.d.ts} +0 -0
package/@types/export.d.ts
CHANGED
|
@@ -55,8 +55,8 @@ declare module '@mui/material/styles' {
|
|
|
55
55
|
M4LCheckBox?: {
|
|
56
56
|
styleOverrides?: ComponentsOverrides<Theme>['M4LCheckBox'];
|
|
57
57
|
};
|
|
58
|
-
|
|
59
|
-
styleOverrides?: ComponentsOverrides<Theme>['
|
|
58
|
+
M4LRadio?: {
|
|
59
|
+
styleOverrides?: ComponentsOverrides<Theme>['M4LRadio'];
|
|
60
60
|
};
|
|
61
61
|
M4LDataGrid?: {
|
|
62
62
|
styleOverrides?: ComponentsOverrides<Theme>['M4LDataGrid'];
|
package/@types/types.d.ts
CHANGED
|
@@ -77,9 +77,9 @@ import {
|
|
|
77
77
|
CheckBoxSlotsType,
|
|
78
78
|
} from '../components/mui_extended/CheckBox/types';
|
|
79
79
|
import {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
} from '../components/mui_extended/
|
|
80
|
+
RadioOwnerState,
|
|
81
|
+
RadioSlotsType,
|
|
82
|
+
} from '../components/mui_extended/Radio/types';
|
|
83
83
|
import {
|
|
84
84
|
RHFNumberInputOwnerState,
|
|
85
85
|
RHFNumberInputSlotsType,
|
|
@@ -324,6 +324,7 @@ import {
|
|
|
324
324
|
IconsFormatterOwnerState,
|
|
325
325
|
IconsFormatterSlotsType,
|
|
326
326
|
} from '../components/formatters/IconsFormatter/types';
|
|
327
|
+
import { CheckableListOwnerState, CheckableListSlotsType } from '../components/CheckableList/types';
|
|
327
328
|
import { RHFDatePickerOwnerState, RHFDatePickerSlotsType } from '../components/hook-form/RHFDatePicker/types';
|
|
328
329
|
import { DatePickerOwnerState, DatePickerSlotsType } from '../components/mui_extended/DatePicker/types';
|
|
329
330
|
import {
|
|
@@ -354,7 +355,7 @@ declare module '@mui/material/styles' {
|
|
|
354
355
|
M4LSelect: SelectSlotsType;
|
|
355
356
|
M4LTypography: TypographySlotsType;
|
|
356
357
|
M4LCheckBox: CheckBoxSlotsType;
|
|
357
|
-
|
|
358
|
+
M4LRadio: RadioSlotsType;
|
|
358
359
|
M4LRHFNumberInput: RHFNumberInputSlotsType;
|
|
359
360
|
M4LTab: TabSlotsType;
|
|
360
361
|
M4LButton: ButtonSlotsType;
|
|
@@ -426,6 +427,7 @@ declare module '@mui/material/styles' {
|
|
|
426
427
|
M4LMFIsolationApp: MFIsolationAppSlotsType;
|
|
427
428
|
M4LTagsFormatter: TagsFormatterSlotsType;
|
|
428
429
|
M4LIconsFormatter: IconsFormatterSlotsType;
|
|
430
|
+
M4LCheckableList: CheckableListSlotsType;
|
|
429
431
|
M4LRHFDatePicker: RHFDatePickerSlotsType;
|
|
430
432
|
M4LDatePicker: DatePickerSlotsType;
|
|
431
433
|
M4LImageFormatter: ImageFormatterSlotsType;
|
|
@@ -452,7 +454,7 @@ declare module '@mui/material/styles' {
|
|
|
452
454
|
M4LSelect: Partial<SelectOwnerState>;
|
|
453
455
|
M4LTypography: Partial<TypographyOwnerState>;
|
|
454
456
|
M4LCheckBox: Partial<CheckBoxOwnerState>;
|
|
455
|
-
|
|
457
|
+
M4LRadio: Partial<RadioOwnerState>;
|
|
456
458
|
M4LRHFNumberInput: Partial<RHFNumberInputOwnerState>;
|
|
457
459
|
M4LTab: Partial<TabOwnerState>;
|
|
458
460
|
M4LButton: Partial<ButtonOwnerState>;
|
|
@@ -523,6 +525,7 @@ declare module '@mui/material/styles' {
|
|
|
523
525
|
M4LMFIsolationApp: Partial<MFIsolationAppOwnerState>;
|
|
524
526
|
M4LTagsFormatter: Partial<TagsFormatterOwnerState>;
|
|
525
527
|
M4LIconsFormatter: Partial<IconsFormatterOwnerState>;
|
|
528
|
+
M4LCheckableList: Partial<CheckableListOwnerState>;
|
|
526
529
|
M4LDatePicker: Partial<DatePickerOwnerState>;
|
|
527
530
|
M4LRHFDatePicker: Partial<RHFDatePickerOwnerState>;
|
|
528
531
|
M4LImageFormatter: Partial<ImageFormatterOwnerState>;
|
|
@@ -648,10 +651,10 @@ declare module '@mui/material/styles' {
|
|
|
648
651
|
styleOverrides?: ComponentsOverrides<Theme>['M4LCheckBox'];
|
|
649
652
|
variants?: ComponentsVariants['M4LCheckBox'];
|
|
650
653
|
};
|
|
651
|
-
|
|
652
|
-
defaultProps?: ComponentsPropsList['
|
|
653
|
-
styleOverrides?: ComponentsOverrides<Theme>['
|
|
654
|
-
variants?: ComponentsVariants['
|
|
654
|
+
M4LRadio?: {
|
|
655
|
+
defaultProps?: ComponentsPropsList['M4LRadio'];
|
|
656
|
+
styleOverrides?: ComponentsOverrides<Theme>['M4LRadio'];
|
|
657
|
+
variants?: ComponentsVariants['M4LRadio'];
|
|
655
658
|
};
|
|
656
659
|
M4LActionCancel?: {
|
|
657
660
|
defaultProps?: ComponentsPropsList['M4LActionCancel'];
|
|
@@ -993,6 +996,10 @@ declare module '@mui/material/styles' {
|
|
|
993
996
|
styleOverrides?: ComponentsOverrides<Theme>['M4LIconsFormatter'];
|
|
994
997
|
variants?: ComponentsVariants['M4LIconsFormatter'];
|
|
995
998
|
};
|
|
999
|
+
M4LCheckableList?: {
|
|
1000
|
+
defaultProps?: ComponentsPropsList['M4LCheckableList'];
|
|
1001
|
+
styleOverrides?: ComponentsOverrides<Theme>['M4LCheckableList'];
|
|
1002
|
+
variants?: ComponentsVariants['M4LCheckableList'];
|
|
996
1003
|
M4LRHFDatePicker?: {
|
|
997
1004
|
defaultProps?: ComponentsPropsList['M4LRHFDatePicker'];
|
|
998
1005
|
styleOverrides?: ComponentsOverrides<Theme>['M4LRHFDatePicker'];
|
|
@@ -1008,5 +1015,6 @@ declare module '@mui/material/styles' {
|
|
|
1008
1015
|
styleOverrides?: ComponentsOverrides<Theme>['M4LImageFormatter'];
|
|
1009
1016
|
variants?: ComponentsVariants['M4LImageFormatter'];
|
|
1010
1017
|
};
|
|
1011
|
-
}
|
|
1018
|
+
};
|
|
1012
1019
|
}
|
|
1020
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CheckableListProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Componente CheckableList
|
|
4
|
+
*
|
|
5
|
+
* Componente que renderiza una lista de items chequeables que opcionalmente puede ser agrupada.
|
|
6
|
+
* Utiliza virtualización para manejar grandes cantidades de items de manera eficiente.
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* <CheckableList
|
|
10
|
+
* items={[
|
|
11
|
+
* { id: 1, label: 'Item 1' },
|
|
12
|
+
* { id: 2, label: 'Item 2' },
|
|
13
|
+
* ]}
|
|
14
|
+
* value={[1]}
|
|
15
|
+
* onChange={(ids) => console.log(ids)}
|
|
16
|
+
* width="100%"
|
|
17
|
+
* />
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare const CheckableList: (props: CheckableListProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from "react";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { C as CHECKABLE_LIST_CLASSES } from "./constants.js";
|
|
5
|
+
import { useModuleDictionary } from "@m4l/core";
|
|
6
|
+
import { D as DICCTIONARY } from "./dictionary.js";
|
|
7
|
+
import { u as useSizeContainer } from "../../hooks/useSizeContainer/index.js";
|
|
8
|
+
import { u as useStateRef } from "../../hooks/useStateRef/index.js";
|
|
9
|
+
import { u as useCheckableListState } from "./hooks/useCheckableListState.js";
|
|
10
|
+
import { u as useCheckableListItems } from "./hooks/useCheckableListItems.js";
|
|
11
|
+
import { u as useCheckableListSelection } from "./hooks/useCheckableListSelection.js";
|
|
12
|
+
import { u as useCheckableListHandlers } from "./hooks/useCheckableListHandlers.js";
|
|
13
|
+
import { u as useCheckableListVirtualization } from "./hooks/useCheckableListVirtualization.js";
|
|
14
|
+
import { u as useCheckableListRender } from "./hooks/useCheckableListRender.js";
|
|
15
|
+
import { R as RootStyled, L as LoadingContainerStyled, S as SearchContainerStyled, a as SearchInputStyled, b as SelectAllContainerStyled, c as SelectAllCheckboxStyled, C as ChipCountTypografyStyled, d as ListContainerStyled, V as VirtualizedListStyled, E as EmptyMessageWrapperStyled } from "./slots/styled.js";
|
|
16
|
+
import { S as Skeleton } from "../mui_extended/Skeleton/Skeleton.js";
|
|
17
|
+
import { I as ImageText } from "../ImageText/ImageText.js";
|
|
18
|
+
import { I as Icon } from "../Icon/Icon.js";
|
|
19
|
+
const CheckableList = (props) => {
|
|
20
|
+
const {
|
|
21
|
+
value = [],
|
|
22
|
+
onChange,
|
|
23
|
+
items = [],
|
|
24
|
+
groups,
|
|
25
|
+
multiple = true,
|
|
26
|
+
selectAll = false,
|
|
27
|
+
groupable = true,
|
|
28
|
+
expandAllGroups = true,
|
|
29
|
+
searchable = false,
|
|
30
|
+
filterFn,
|
|
31
|
+
size = "medium",
|
|
32
|
+
variant = "standard",
|
|
33
|
+
width = "100%",
|
|
34
|
+
checkboxSize = "medium",
|
|
35
|
+
showCheckboxOnGroup = true,
|
|
36
|
+
indeterminateBehavior = "indicate-some",
|
|
37
|
+
className,
|
|
38
|
+
"data-testid": dataTestId,
|
|
39
|
+
ariaLabel,
|
|
40
|
+
ariaLabelledBy,
|
|
41
|
+
renderItem,
|
|
42
|
+
renderGroup,
|
|
43
|
+
loading = false,
|
|
44
|
+
disabled = false,
|
|
45
|
+
itemRowHeight,
|
|
46
|
+
groupRowHeight
|
|
47
|
+
} = props;
|
|
48
|
+
const listRef = useRef(null);
|
|
49
|
+
const [containerElement, setContainerElement] = useStateRef(null);
|
|
50
|
+
const containerSize = useSizeContainer(containerElement, {
|
|
51
|
+
// excludePadding: true,
|
|
52
|
+
});
|
|
53
|
+
const { getLabel } = useModuleDictionary();
|
|
54
|
+
const refHeight = useRef(containerSize?.containerHeight ?? 0);
|
|
55
|
+
if (refHeight.current !== containerSize?.containerHeight) {
|
|
56
|
+
if (containerSize?.containerHeight !== 0) {
|
|
57
|
+
refHeight.current = containerSize?.containerHeight;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const {
|
|
61
|
+
searchQuery,
|
|
62
|
+
setSearchQuery,
|
|
63
|
+
expandedGroups,
|
|
64
|
+
itemHeights,
|
|
65
|
+
handleGroupExpandToggle
|
|
66
|
+
} = useCheckableListState({
|
|
67
|
+
groups,
|
|
68
|
+
expandAllGroups
|
|
69
|
+
});
|
|
70
|
+
const {
|
|
71
|
+
isGrouped,
|
|
72
|
+
normalizedItems,
|
|
73
|
+
filteredItems,
|
|
74
|
+
filteredGroups,
|
|
75
|
+
virtualizedItems
|
|
76
|
+
} = useCheckableListItems({
|
|
77
|
+
items,
|
|
78
|
+
groups,
|
|
79
|
+
searchQuery,
|
|
80
|
+
filterFn,
|
|
81
|
+
expandedGroups
|
|
82
|
+
});
|
|
83
|
+
const {
|
|
84
|
+
getGroupItems,
|
|
85
|
+
isItemSelected,
|
|
86
|
+
isGroupFullySelected,
|
|
87
|
+
isGroupPartiallySelected,
|
|
88
|
+
areAllItemsSelected,
|
|
89
|
+
areSomeItemsSelected
|
|
90
|
+
} = useCheckableListSelection({
|
|
91
|
+
value,
|
|
92
|
+
normalizedItems,
|
|
93
|
+
groups,
|
|
94
|
+
isGrouped
|
|
95
|
+
});
|
|
96
|
+
const { handleItemToggle, handleGroupToggle, handleSelectAllToggle } = useCheckableListHandlers({
|
|
97
|
+
value,
|
|
98
|
+
onChange,
|
|
99
|
+
multiple,
|
|
100
|
+
disabled,
|
|
101
|
+
normalizedItems,
|
|
102
|
+
getGroupItems,
|
|
103
|
+
isGroupFullySelected,
|
|
104
|
+
isItemSelected,
|
|
105
|
+
areAllItemsSelected
|
|
106
|
+
});
|
|
107
|
+
const { getItemSize } = useCheckableListVirtualization({
|
|
108
|
+
virtualizedItems,
|
|
109
|
+
itemHeights,
|
|
110
|
+
defaultItemRowHeight: itemRowHeight,
|
|
111
|
+
defaultGroupRowHeight: groupRowHeight
|
|
112
|
+
});
|
|
113
|
+
const { renderVirtualizedItem, urlIconSearch, urlIconNoResults } = useCheckableListRender({
|
|
114
|
+
isItemSelected,
|
|
115
|
+
disabled,
|
|
116
|
+
size,
|
|
117
|
+
variant,
|
|
118
|
+
checkboxSize,
|
|
119
|
+
handleItemToggle,
|
|
120
|
+
renderItem,
|
|
121
|
+
expandedGroups,
|
|
122
|
+
isGroupFullySelected,
|
|
123
|
+
isGroupPartiallySelected,
|
|
124
|
+
getGroupItems,
|
|
125
|
+
indeterminateBehavior,
|
|
126
|
+
renderGroup,
|
|
127
|
+
groupable,
|
|
128
|
+
showCheckboxOnGroup,
|
|
129
|
+
handleGroupExpandToggle,
|
|
130
|
+
handleGroupToggle
|
|
131
|
+
});
|
|
132
|
+
const ownerState = {
|
|
133
|
+
size,
|
|
134
|
+
variant,
|
|
135
|
+
disabled,
|
|
136
|
+
grouped: isGrouped,
|
|
137
|
+
hasSelected: value.length > 0
|
|
138
|
+
};
|
|
139
|
+
if (loading) {
|
|
140
|
+
return /* @__PURE__ */ jsx(
|
|
141
|
+
RootStyled,
|
|
142
|
+
{
|
|
143
|
+
ownerState,
|
|
144
|
+
className: clsx(className, CHECKABLE_LIST_CLASSES.root),
|
|
145
|
+
"data-testid": dataTestId,
|
|
146
|
+
"aria-label": ariaLabel,
|
|
147
|
+
"aria-labelledby": ariaLabelledBy,
|
|
148
|
+
children: /* @__PURE__ */ jsx(LoadingContainerStyled, { ownerState, children: /* @__PURE__ */ jsx(Skeleton, { variant: "rectangular", width: "100%", height: 200 }) })
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
const hasItems = isGrouped ? filteredGroups.length > 0 : filteredItems.length > 0;
|
|
153
|
+
return /* @__PURE__ */ jsxs(
|
|
154
|
+
RootStyled,
|
|
155
|
+
{
|
|
156
|
+
ownerState,
|
|
157
|
+
className: clsx(className, CHECKABLE_LIST_CLASSES.root),
|
|
158
|
+
"data-testid": dataTestId,
|
|
159
|
+
"aria-label": ariaLabel,
|
|
160
|
+
"aria-labelledby": ariaLabelledBy,
|
|
161
|
+
children: [
|
|
162
|
+
searchable && /* @__PURE__ */ jsx(SearchContainerStyled, { ownerState, children: /* @__PURE__ */ jsx(
|
|
163
|
+
SearchInputStyled,
|
|
164
|
+
{
|
|
165
|
+
ownerState,
|
|
166
|
+
value: searchQuery,
|
|
167
|
+
onChange: (e) => setSearchQuery(e.target.value),
|
|
168
|
+
placeholder: getLabel(DICCTIONARY.label_search_placeholder),
|
|
169
|
+
size,
|
|
170
|
+
variant: "contained",
|
|
171
|
+
InputProps: {
|
|
172
|
+
startAdornment: /* @__PURE__ */ jsx(Icon, { src: urlIconSearch })
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
) }),
|
|
176
|
+
selectAll && hasItems && /* @__PURE__ */ jsxs(SelectAllContainerStyled, { ownerState, children: [
|
|
177
|
+
/* @__PURE__ */ jsx(
|
|
178
|
+
SelectAllCheckboxStyled,
|
|
179
|
+
{
|
|
180
|
+
checked: areAllItemsSelected,
|
|
181
|
+
indeterminate: areSomeItemsSelected && !areAllItemsSelected,
|
|
182
|
+
disabled,
|
|
183
|
+
size: checkboxSize,
|
|
184
|
+
onChange: handleSelectAllToggle,
|
|
185
|
+
inlineText: getLabel(DICCTIONARY.label_select_all)
|
|
186
|
+
}
|
|
187
|
+
),
|
|
188
|
+
/* @__PURE__ */ jsx(
|
|
189
|
+
ChipCountTypografyStyled,
|
|
190
|
+
{
|
|
191
|
+
ownerState,
|
|
192
|
+
variant: "body",
|
|
193
|
+
size,
|
|
194
|
+
color: "text.disabled",
|
|
195
|
+
children: value.length
|
|
196
|
+
}
|
|
197
|
+
)
|
|
198
|
+
] }),
|
|
199
|
+
/* @__PURE__ */ jsx(ListContainerStyled, { ref: setContainerElement, ownerState: { ...ownerState }, children: hasItems ? refHeight.current > 0 ? /* @__PURE__ */ jsx(
|
|
200
|
+
VirtualizedListStyled,
|
|
201
|
+
{
|
|
202
|
+
ref: listRef,
|
|
203
|
+
height: refHeight.current,
|
|
204
|
+
width,
|
|
205
|
+
itemCount: virtualizedItems.length,
|
|
206
|
+
itemSize: getItemSize,
|
|
207
|
+
itemData: virtualizedItems,
|
|
208
|
+
layout: "vertical",
|
|
209
|
+
children: renderVirtualizedItem
|
|
210
|
+
}
|
|
211
|
+
) : null : /* @__PURE__ */ jsx(EmptyMessageWrapperStyled, { ownerState, children: /* @__PURE__ */ jsx(
|
|
212
|
+
ImageText,
|
|
213
|
+
{
|
|
214
|
+
title: getLabel(DICCTIONARY.label_no_results),
|
|
215
|
+
message: getLabel(DICCTIONARY.label_no_results_description),
|
|
216
|
+
imageUrl: urlIconNoResults
|
|
217
|
+
}
|
|
218
|
+
) }) })
|
|
219
|
+
]
|
|
220
|
+
}
|
|
221
|
+
);
|
|
222
|
+
};
|
|
223
|
+
export {
|
|
224
|
+
CheckableList as C
|
|
225
|
+
};
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { getContrastTextColor } from "@m4l/graphics";
|
|
2
|
+
import { g as getSizeStyles } from "../../utils/getSizeStyles/getSizeStyles.js";
|
|
3
|
+
const checkableListStyles = {
|
|
4
|
+
/**
|
|
5
|
+
* Root: Estilos del contenedor principal del componente.
|
|
6
|
+
*/
|
|
7
|
+
root: ({ theme, ownerState }) => ({
|
|
8
|
+
width: "100%",
|
|
9
|
+
// height: '100%',
|
|
10
|
+
flexGrow: 1,
|
|
11
|
+
overflow: "hidden",
|
|
12
|
+
display: "flex",
|
|
13
|
+
flexDirection: "column",
|
|
14
|
+
gap: theme.vars.size.baseSpacings.sp2,
|
|
15
|
+
...ownerState?.disabled && {
|
|
16
|
+
opacity: 0.6,
|
|
17
|
+
pointerEvents: "none"
|
|
18
|
+
}
|
|
19
|
+
}),
|
|
20
|
+
/**
|
|
21
|
+
* searchContainer: Estilos del contenedor de búsqueda.
|
|
22
|
+
*/
|
|
23
|
+
searchContainer: ({ theme }) => ({
|
|
24
|
+
width: "100%",
|
|
25
|
+
padding: theme.vars.size.baseSpacings.sp1
|
|
26
|
+
}),
|
|
27
|
+
/**
|
|
28
|
+
* searchInput: Estilos del input de búsqueda.
|
|
29
|
+
*/
|
|
30
|
+
searchInput: ({ theme, ownerState }) => ({
|
|
31
|
+
width: "100%",
|
|
32
|
+
...getSizeStyles(theme, ownerState?.size || "medium", "container", (size) => ({
|
|
33
|
+
height: size,
|
|
34
|
+
minHeight: size
|
|
35
|
+
}))
|
|
36
|
+
}),
|
|
37
|
+
/**
|
|
38
|
+
* selectAllContainer: Estilos del contenedor de "Seleccionar todo".
|
|
39
|
+
*/
|
|
40
|
+
selectAllContainer: ({ theme }) => ({
|
|
41
|
+
display: "flex",
|
|
42
|
+
alignItems: "center",
|
|
43
|
+
padding: theme.vars.size.baseSpacings.sp1,
|
|
44
|
+
paddingLeft: theme.vars.size.baseSpacings.sp2,
|
|
45
|
+
borderBottom: `1px solid ${theme.vars.palette.border.secondary}`
|
|
46
|
+
}),
|
|
47
|
+
/**
|
|
48
|
+
* selectAllCheckbox: Estilos del checkbox de "Seleccionar todo".
|
|
49
|
+
*/
|
|
50
|
+
selectAllCheckbox: ({ theme }) => ({
|
|
51
|
+
"&&& .MuiTypography-root": {
|
|
52
|
+
color: theme.vars.palette.text.secondary
|
|
53
|
+
}
|
|
54
|
+
}),
|
|
55
|
+
/**
|
|
56
|
+
* listContainer: Estilos del contenedor de la lista.
|
|
57
|
+
*/
|
|
58
|
+
listContainer: ({ theme, ownerState }) => ({
|
|
59
|
+
flex: 1,
|
|
60
|
+
overflow: "hidden",
|
|
61
|
+
display: "flex",
|
|
62
|
+
flexDirection: "column",
|
|
63
|
+
flexGrow: 1,
|
|
64
|
+
// border: `1px solid ${theme.vars.palette.border.secondary}`,
|
|
65
|
+
// borderRadius: theme.vars.size.borderRadius.r2,
|
|
66
|
+
backgroundColor: theme.vars.palette.background.default,
|
|
67
|
+
...ownerState?.maxHeight && {
|
|
68
|
+
maxHeight: typeof ownerState.maxHeight === "number" ? `${ownerState.maxHeight}px` : ownerState.maxHeight
|
|
69
|
+
}
|
|
70
|
+
}),
|
|
71
|
+
/**
|
|
72
|
+
* virtualizedList: Estilos de la lista virtualizada.
|
|
73
|
+
*/
|
|
74
|
+
virtualizedList: () => ({
|
|
75
|
+
width: "100%",
|
|
76
|
+
height: "100%"
|
|
77
|
+
}),
|
|
78
|
+
/**
|
|
79
|
+
* itemWrapper: Estilos del contenedor de cada item.
|
|
80
|
+
*/
|
|
81
|
+
itemWrapper: ({ theme, ownerState }) => ({
|
|
82
|
+
display: "flex",
|
|
83
|
+
alignItems: "center",
|
|
84
|
+
height: "100%",
|
|
85
|
+
backgroundColor: ownerState?.selected ? theme.vars.palette.primary.opacity : "transparent",
|
|
86
|
+
// borderBottom: `1px solid ${theme.vars.palette.border.secondary}`,
|
|
87
|
+
gap: theme.vars.size.baseSpacings["sp2-5"],
|
|
88
|
+
padding: theme.vars.size.baseSpacings["sp1-5"],
|
|
89
|
+
paddingLeft: theme.vars.size.baseSpacings.sp2,
|
|
90
|
+
paddingRight: theme.vars.size.baseSpacings["sp2-5"],
|
|
91
|
+
cursor: "pointer",
|
|
92
|
+
transition: "background-color 0.1s",
|
|
93
|
+
"&:hover": {
|
|
94
|
+
backgroundColor: theme.vars.palette.action.hover
|
|
95
|
+
}
|
|
96
|
+
}),
|
|
97
|
+
/**
|
|
98
|
+
* itemCheckbox: Estilos del checkbox del item.
|
|
99
|
+
*/
|
|
100
|
+
itemCheckbox: ({ theme, ownerState }) => ({
|
|
101
|
+
flexShrink: 0,
|
|
102
|
+
...getSizeStyles(theme, ownerState?.size || "medium", "action", (size) => ({
|
|
103
|
+
width: size,
|
|
104
|
+
height: size
|
|
105
|
+
}))
|
|
106
|
+
}),
|
|
107
|
+
/**
|
|
108
|
+
* itemLabel: Estilos del label del item.
|
|
109
|
+
*/
|
|
110
|
+
itemLabel: () => ({}),
|
|
111
|
+
/**
|
|
112
|
+
* itemDescription: Estilos de la descripción del item.
|
|
113
|
+
*/
|
|
114
|
+
itemDescription: () => ({}),
|
|
115
|
+
/**
|
|
116
|
+
* itemContentWrapper: Estilos del contenedor de contenido del item.
|
|
117
|
+
*/
|
|
118
|
+
itemContentWrapper: ({ theme }) => ({
|
|
119
|
+
flex: 1,
|
|
120
|
+
display: "flex",
|
|
121
|
+
flexDirection: "column",
|
|
122
|
+
gap: theme.vars.size.baseSpacings["sp0-5"]
|
|
123
|
+
}),
|
|
124
|
+
/**
|
|
125
|
+
* itemIcon: Estilos del icono del item.
|
|
126
|
+
*/
|
|
127
|
+
itemIcon: ({ theme }) => ({
|
|
128
|
+
display: "flex",
|
|
129
|
+
alignItems: "center",
|
|
130
|
+
justifyContent: "center",
|
|
131
|
+
flexShrink: 0,
|
|
132
|
+
...getSizeStyles(theme, "medium", "action", (size) => ({
|
|
133
|
+
width: size,
|
|
134
|
+
height: size
|
|
135
|
+
}))
|
|
136
|
+
}),
|
|
137
|
+
/**
|
|
138
|
+
* groupWrapper: Estilos del contenedor del grupo.
|
|
139
|
+
*/
|
|
140
|
+
groupWrapper: ({ theme, ownerState }) => ({
|
|
141
|
+
display: "flex",
|
|
142
|
+
flexDirection: "column",
|
|
143
|
+
backgroundColor: ownerState?.selected ? theme.vars.palette.primary.opacity : "transparent",
|
|
144
|
+
borderBottom: `1px solid ${theme.vars.palette.border.secondary}`,
|
|
145
|
+
"&:last-child": {
|
|
146
|
+
borderBottom: "none"
|
|
147
|
+
}
|
|
148
|
+
}),
|
|
149
|
+
/**
|
|
150
|
+
* groupHeader: Estilos del header del grupo.
|
|
151
|
+
*/
|
|
152
|
+
groupHeader: ({ theme }) => ({
|
|
153
|
+
display: "flex",
|
|
154
|
+
alignItems: "center",
|
|
155
|
+
height: "100%",
|
|
156
|
+
gap: theme.vars.size.baseSpacings.sp1,
|
|
157
|
+
padding: theme.vars.size.baseSpacings["sp1-5"],
|
|
158
|
+
paddingLeft: theme.vars.size.baseSpacings.sp2,
|
|
159
|
+
// backgroundColor: theme.vars.palette.background.paper,
|
|
160
|
+
cursor: "pointer"
|
|
161
|
+
}),
|
|
162
|
+
/**
|
|
163
|
+
* groupCheckbox: Estilos del checkbox del grupo.
|
|
164
|
+
*/
|
|
165
|
+
groupCheckbox: () => ({}),
|
|
166
|
+
/**
|
|
167
|
+
* groupLabelTagWrapper: Estilos del contenedor del label del grupo.
|
|
168
|
+
*/
|
|
169
|
+
groupLabelCountWrapper: ({ theme }) => ({
|
|
170
|
+
display: "flex",
|
|
171
|
+
alignItems: "center",
|
|
172
|
+
justifyContent: "space-between",
|
|
173
|
+
gap: theme.vars.size.baseSpacings.sp1
|
|
174
|
+
}),
|
|
175
|
+
/**
|
|
176
|
+
* groupLabel: Estilos del label del grupo.
|
|
177
|
+
*/
|
|
178
|
+
groupLabel: ({ theme }) => ({
|
|
179
|
+
flex: 1,
|
|
180
|
+
// fontWeight: 600,
|
|
181
|
+
color: theme.vars.palette.text.primary
|
|
182
|
+
}),
|
|
183
|
+
/**
|
|
184
|
+
* chipCount: Estilos del contador del grupo.
|
|
185
|
+
*/
|
|
186
|
+
chipCount: ({ theme, ownerState }) => ({
|
|
187
|
+
"&&& ": {
|
|
188
|
+
borderRadius: theme.vars.size.borderRadius["r1-5"],
|
|
189
|
+
paddingLeft: theme.vars.size.baseSpacings["sp1"],
|
|
190
|
+
paddingRight: theme.vars.size.baseSpacings["sp1"],
|
|
191
|
+
backgroundColor: ownerState?.color ?? theme.vars.palette.background.surface,
|
|
192
|
+
color: ownerState?.color ? getContrastTextColor(ownerState?.color) : theme.vars.palette.text.secondary
|
|
193
|
+
}
|
|
194
|
+
}),
|
|
195
|
+
/**
|
|
196
|
+
* groupIcon: Estilos del icono del grupo.
|
|
197
|
+
*/
|
|
198
|
+
groupIcon: ({ theme }) => ({
|
|
199
|
+
display: "flex",
|
|
200
|
+
alignItems: "center",
|
|
201
|
+
justifyContent: "center",
|
|
202
|
+
flexShrink: 0,
|
|
203
|
+
...getSizeStyles(theme, "medium", "action", (size) => ({
|
|
204
|
+
width: size,
|
|
205
|
+
height: size
|
|
206
|
+
}))
|
|
207
|
+
}),
|
|
208
|
+
/**
|
|
209
|
+
* groupToggleButton: Estilos del botón para expandir/colapsar grupo.
|
|
210
|
+
*/
|
|
211
|
+
groupToggleButton: ({ theme, ownerState }) => ({
|
|
212
|
+
flexShrink: 0,
|
|
213
|
+
...getSizeStyles(theme, ownerState?.size || "medium", "action", (size) => ({
|
|
214
|
+
width: size,
|
|
215
|
+
height: size
|
|
216
|
+
}))
|
|
217
|
+
}),
|
|
218
|
+
/**
|
|
219
|
+
* groupItems: Estilos del contenedor de items del grupo.
|
|
220
|
+
*/
|
|
221
|
+
groupItems: () => ({
|
|
222
|
+
display: "flex",
|
|
223
|
+
flexDirection: "column",
|
|
224
|
+
overflow: "hidden"
|
|
225
|
+
}),
|
|
226
|
+
/**
|
|
227
|
+
* emptyMessage: Estilos del mensaje cuando no hay items.
|
|
228
|
+
*/
|
|
229
|
+
emptyMessageWrapper: () => ({
|
|
230
|
+
display: "flex",
|
|
231
|
+
flexDirection: "column",
|
|
232
|
+
alignItems: "center",
|
|
233
|
+
justifyContent: "center"
|
|
234
|
+
}),
|
|
235
|
+
/**
|
|
236
|
+
* loadingContainer: Estilos del contenedor de carga.
|
|
237
|
+
*/
|
|
238
|
+
loadingContainer: ({ theme }) => ({
|
|
239
|
+
display: "flex",
|
|
240
|
+
alignItems: "center",
|
|
241
|
+
justifyContent: "center",
|
|
242
|
+
padding: theme.vars.size.baseSpacings.sp3
|
|
243
|
+
})
|
|
244
|
+
};
|
|
245
|
+
export {
|
|
246
|
+
checkableListStyles as c
|
|
247
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const CHECKABLE_LIST_KEY_COMPONENT = "M4LCheckableList";
|
|
2
|
+
export declare const CHECKABLE_LIST_CLASSES: Record<"root" | "searchContainer" | "searchInput" | "selectAllContainer" | "selectAllCheckbox" | "listContainer" | "virtualizedList" | "itemWrapper" | "itemCheckbox" | "itemContentWrapper" | "itemLabel" | "itemDescription" | "itemIcon" | "groupWrapper" | "groupHeader" | "groupCheckbox" | "groupLabelCountWrapper" | "groupLabel" | "chipCount" | "groupIcon" | "groupToggleButton" | "groupItems" | "emptyMessageWrapper" | "loadingContainer", string>;
|
|
3
|
+
export declare const CHECKABLE_LIST_DEFAULT_ITEM_ROW_HEIGHT = 36;
|
|
4
|
+
export declare const CHECKABLE_LIST_DEFAULT_ITEM_ROW_HEIGHT_WITH_DESCRIPTION = 46;
|
|
5
|
+
export declare const CHECKABLE_LIST_DEFAULT_GROUP_ROW_HEIGHT = 36;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { g as getComponentClasses } from "../../utils/getComponentSlotRoot.js";
|
|
2
|
+
import { C as CheckableListSlots } from "./slots/slots.js";
|
|
3
|
+
const CHECKABLE_LIST_KEY_COMPONENT = "M4LCheckableList";
|
|
4
|
+
const CHECKABLE_LIST_CLASSES = getComponentClasses(
|
|
5
|
+
CHECKABLE_LIST_KEY_COMPONENT,
|
|
6
|
+
CheckableListSlots
|
|
7
|
+
);
|
|
8
|
+
const CHECKABLE_LIST_DEFAULT_ITEM_ROW_HEIGHT = 36;
|
|
9
|
+
const CHECKABLE_LIST_DEFAULT_ITEM_ROW_HEIGHT_WITH_DESCRIPTION = 46;
|
|
10
|
+
const CHECKABLE_LIST_DEFAULT_GROUP_ROW_HEIGHT = 36;
|
|
11
|
+
export {
|
|
12
|
+
CHECKABLE_LIST_CLASSES as C,
|
|
13
|
+
CHECKABLE_LIST_DEFAULT_ITEM_ROW_HEIGHT as a,
|
|
14
|
+
CHECKABLE_LIST_DEFAULT_GROUP_ROW_HEIGHT as b,
|
|
15
|
+
CHECKABLE_LIST_DEFAULT_ITEM_ROW_HEIGHT_WITH_DESCRIPTION as c,
|
|
16
|
+
CHECKABLE_LIST_KEY_COMPONENT as d
|
|
17
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const CHECKABLE_LIST_DICTIONARY_ID = "checkable_list";
|
|
2
|
+
/**
|
|
3
|
+
* getCheckableListComponentsDictionary: Devuelve un array con los ids de los componentes que
|
|
4
|
+
* componente CheckableList.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getCheckableListComponentsDictionary(): string[];
|
|
7
|
+
export declare const DICCTIONARY: {
|
|
8
|
+
readonly label_search_placeholder: "checkable_list.label_search_placeholder";
|
|
9
|
+
readonly label_no_results: "checkable_list.label_no_results";
|
|
10
|
+
readonly label_no_results_description: "checkable_list.label_no_results_description";
|
|
11
|
+
readonly label_group_title: "checkable_list.label_group_title";
|
|
12
|
+
readonly label_select_all: "checkable_list.label_select_all";
|
|
13
|
+
};
|
|
14
|
+
export type TypeDictionary = typeof DICCTIONARY;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const CHECKABLE_LIST_DICTIONARY_ID = "checkable_list";
|
|
2
|
+
function getCheckableListComponentsDictionary() {
|
|
3
|
+
return [CHECKABLE_LIST_DICTIONARY_ID];
|
|
4
|
+
}
|
|
5
|
+
const DICCTIONARY = {
|
|
6
|
+
label_search_placeholder: `${CHECKABLE_LIST_DICTIONARY_ID}.label_search_placeholder`,
|
|
7
|
+
label_no_results: `${CHECKABLE_LIST_DICTIONARY_ID}.label_no_results`,
|
|
8
|
+
label_no_results_description: `${CHECKABLE_LIST_DICTIONARY_ID}.label_no_results_description`,
|
|
9
|
+
label_select_all: `${CHECKABLE_LIST_DICTIONARY_ID}.label_select_all`
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
DICCTIONARY as D,
|
|
13
|
+
getCheckableListComponentsDictionary as g
|
|
14
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { useCheckableListState } from './useCheckableListState';
|
|
2
|
+
export { useCheckableListItems } from './useCheckableListItems';
|
|
3
|
+
export { useCheckableListSelection } from './useCheckableListSelection';
|
|
4
|
+
export { useCheckableListHandlers } from './useCheckableListHandlers';
|
|
5
|
+
export { useCheckableListVirtualization } from './useCheckableListVirtualization';
|
|
6
|
+
export { useCheckableListRender } from './useCheckableListRender';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CheckableListGroup, CheckableListItem } from '../types';
|
|
2
|
+
interface UseCheckableListHandlersProps {
|
|
3
|
+
value: (string | number)[];
|
|
4
|
+
onChange?: (selectedIds: (string | number)[]) => void;
|
|
5
|
+
multiple?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
normalizedItems: CheckableListItem[];
|
|
8
|
+
getGroupItems: (group: CheckableListGroup) => CheckableListItem[];
|
|
9
|
+
isGroupFullySelected: (group: CheckableListGroup) => boolean;
|
|
10
|
+
isItemSelected: (itemId: string | number) => boolean;
|
|
11
|
+
areAllItemsSelected: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Hook para manejar los event handlers del componente CheckableList
|
|
15
|
+
*/
|
|
16
|
+
export declare const useCheckableListHandlers: ({ value, onChange, multiple, disabled, normalizedItems, getGroupItems, isGroupFullySelected, isItemSelected, areAllItemsSelected, }: UseCheckableListHandlersProps) => {
|
|
17
|
+
handleItemToggle: (itemId: string | number) => void;
|
|
18
|
+
handleGroupToggle: (group: CheckableListGroup) => void;
|
|
19
|
+
handleSelectAllToggle: () => void;
|
|
20
|
+
};
|
|
21
|
+
export {};
|