@m4l/components 9.3.43 → 9.4.0-JA-20251207-Beta.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.
Files changed (127) hide show
  1. package/@types/export.d.ts +2 -2
  2. package/@types/types.d.ts +18 -10
  3. package/components/CheckableList/CheckableList.d.ts +20 -0
  4. package/components/CheckableList/CheckableList.js +225 -0
  5. package/components/CheckableList/CheckableList.styles.d.ts +2 -0
  6. package/components/CheckableList/CheckableList.styles.js +247 -0
  7. package/components/CheckableList/constants.d.ts +5 -0
  8. package/components/CheckableList/constants.js +17 -0
  9. package/components/CheckableList/dictionary.d.ts +14 -0
  10. package/components/CheckableList/dictionary.js +14 -0
  11. package/components/CheckableList/hooks/index.d.ts +6 -0
  12. package/components/CheckableList/hooks/useCheckableListHandlers.d.ts +21 -0
  13. package/components/CheckableList/hooks/useCheckableListHandlers.js +66 -0
  14. package/components/CheckableList/hooks/useCheckableListItems.d.ts +19 -0
  15. package/components/CheckableList/hooks/useCheckableListItems.js +79 -0
  16. package/components/CheckableList/hooks/useCheckableListRender.d.ts +52 -0
  17. package/components/CheckableList/hooks/useCheckableListRender.js +223 -0
  18. package/components/CheckableList/hooks/useCheckableListSelection.d.ts +19 -0
  19. package/components/CheckableList/hooks/useCheckableListSelection.js +69 -0
  20. package/components/CheckableList/hooks/useCheckableListState.d.ts +17 -0
  21. package/components/CheckableList/hooks/useCheckableListState.js +59 -0
  22. package/components/CheckableList/hooks/useCheckableListVirtualization.d.ts +14 -0
  23. package/components/CheckableList/hooks/useCheckableListVirtualization.js +42 -0
  24. package/components/CheckableList/icons.d.ts +5 -0
  25. package/components/CheckableList/icons.js +8 -0
  26. package/components/CheckableList/index.d.ts +3 -0
  27. package/components/CheckableList/index.js +1 -0
  28. package/components/CheckableList/slots/index.d.ts +2 -0
  29. package/components/CheckableList/slots/index.js +1 -0
  30. package/components/CheckableList/slots/slots.d.ts +26 -0
  31. package/components/CheckableList/slots/slots.js +30 -0
  32. package/components/CheckableList/slots/styled.d.ts +72 -0
  33. package/components/CheckableList/slots/styled.js +130 -0
  34. package/components/CheckableList/types.d.ts +277 -0
  35. package/components/CommonActions/components/ActionFormCancel/ActionFormCancel.js +1 -1
  36. package/components/DataGrid/Datagrid.styles.js +8 -8
  37. package/components/DataGrid/subcomponents/CheckboxCellAdapter/index.js +2 -2
  38. package/components/DataGrid/subcomponents/Table/subcomponents/RadioFormatter.d.ts +6 -0
  39. package/components/DataGrid/subcomponents/Table/subcomponents/RadioFormatter.js +12 -0
  40. package/components/DataGrid/subcomponents/Table/subcomponents/RadioSelectColumn.js +2 -2
  41. package/components/DynamicFilter/store/DynamicFilterContext.js +11 -0
  42. package/components/DynamicFilter/store/DynamicFilterStore.js +9 -0
  43. package/components/DynamicFilter/subcomponents/DynamicFilterBase/useDynamicFilterBase.d.ts +1 -1
  44. package/components/DynamicFilter/types.d.ts +4 -0
  45. package/components/DynamicSort/store/DynamicSortStore.js +6 -0
  46. package/components/DynamicSort/subcomponents/DynamicSortBase/useDynamicSortBase.d.ts +1 -1
  47. package/components/DynamicSort/types.d.ts +4 -0
  48. package/components/MFIsolationApp/slots/MFIsolationAppSlots.d.ts +2 -2
  49. package/components/ObjectLogs/slots/ObjectLogsSlots.d.ts +1 -1
  50. package/components/Stepper/Stepper.styles.js +13 -8
  51. package/components/WindowBase/hooks/useDynamicMFParameters/index.d.ts +4 -4
  52. package/components/areas/contexts/AreasContext/store.js +2 -2
  53. package/components/commercial/SectionCommercial/styles.d.ts +1 -1
  54. package/components/hook-form/RHFCheckableList/RHFCheckableList.d.ts +7 -0
  55. package/components/hook-form/RHFCheckableList/RHFCheckableList.js +91 -0
  56. package/components/hook-form/RHFCheckableList/RHFCheckableList.styles.d.ts +2 -0
  57. package/components/hook-form/RHFCheckableList/RHFCheckableList.styles.js +30 -0
  58. package/components/hook-form/RHFCheckableList/constants.d.ts +8 -0
  59. package/components/hook-form/RHFCheckableList/constants.js +11 -0
  60. package/components/hook-form/RHFCheckableList/index.d.ts +2 -0
  61. package/components/hook-form/RHFCheckableList/index.js +1 -0
  62. package/components/hook-form/RHFCheckableList/slots/RHFCheckableListEnum.d.ts +6 -0
  63. package/components/hook-form/RHFCheckableList/slots/RHFCheckableListEnum.js +10 -0
  64. package/components/hook-form/RHFCheckableList/slots/RHFCheckableListSlots.d.ts +20 -0
  65. package/components/hook-form/RHFCheckableList/slots/RHFCheckableListSlots.js +29 -0
  66. package/components/hook-form/RHFCheckableList/slots/index.d.ts +2 -0
  67. package/components/hook-form/RHFCheckableList/types.d.ts +60 -0
  68. package/components/hook-form/RHFColorPicker/hooks/useColorPicker/useColorPicker.d.ts +1 -1
  69. package/components/hook-form/RHFPeriod/subcomponents/Period/Period.js +3 -4
  70. package/components/hook-form/RHFRadioGroup/RHFRadioGroup.d.ts +3 -3
  71. package/components/hook-form/RHFRadioGroup/RHFRadioGroup.js +66 -24
  72. package/components/hook-form/RHFRadioGroup/RHFRadioGroup.styles.d.ts +5 -0
  73. package/components/hook-form/RHFRadioGroup/RHFRadioGroup.styles.js +29 -0
  74. package/components/hook-form/RHFRadioGroup/constants.d.ts +5 -0
  75. package/components/hook-form/RHFRadioGroup/constants.js +8 -0
  76. package/components/hook-form/RHFRadioGroup/formatters/OptionIconLabelFormatter/index.d.ts +2 -2
  77. package/components/hook-form/RHFRadioGroup/slots/slots.d.ts +5 -0
  78. package/components/hook-form/RHFRadioGroup/slots/slots.js +9 -0
  79. package/components/hook-form/RHFRadioGroup/slots/styled.d.ts +9 -0
  80. package/components/hook-form/RHFRadioGroup/slots/styled.js +20 -0
  81. package/components/hook-form/RHFRadioGroup/types.d.ts +55 -11
  82. package/components/hook-form/RHFUpload/RHFUploadImage/subcomponents/UploadImage/UploadImage.js +1 -1
  83. package/components/hook-form/index.d.ts +1 -0
  84. package/components/index.d.ts +1 -0
  85. package/components/mui_extended/CheckBox/CheckBox.js +2 -0
  86. package/components/mui_extended/Radio/Radio.d.ts +20 -0
  87. package/components/mui_extended/{RadioButton/RadioButton.js → Radio/Radio.js} +27 -26
  88. package/components/mui_extended/Radio/Radio.styles.d.ts +2 -0
  89. package/components/mui_extended/{RadioButton/RadioButton.styles.js → Radio/Radio.styles.js} +17 -42
  90. package/components/mui_extended/Radio/constants.d.ts +2 -0
  91. package/components/mui_extended/Radio/constants.js +8 -0
  92. package/components/mui_extended/Radio/index.d.ts +1 -0
  93. package/components/mui_extended/Radio/index.js +1 -0
  94. package/components/mui_extended/Radio/slots/slots.d.ts +6 -0
  95. package/components/mui_extended/Radio/slots/slots.js +10 -0
  96. package/components/mui_extended/{RadioButton/slots/RadioButtonSlots.d.ts → Radio/slots/styled.d.ts} +6 -12
  97. package/components/mui_extended/Radio/slots/styled.js +28 -0
  98. package/components/mui_extended/Radio/types.d.ts +53 -0
  99. package/components/mui_extended/Stack/Stack.d.ts +1 -1
  100. package/components/mui_extended/Stack/Stack.js +5 -2
  101. package/components/mui_extended/index.d.ts +1 -1
  102. package/hooks/useDynamicFilterAndSort/slots/DynamicFilterAndSortEnum.d.ts +2 -1
  103. package/hooks/useDynamicFilterAndSort/slots/DynamicFilterAndSortEnum.js +1 -0
  104. package/hooks/useDynamicFilterAndSort/slots/DynamicFilterAndSortSlots.d.ts +6 -3
  105. package/hooks/useDynamicFilterAndSort/slots/DynamicFilterAndSortSlots.js +6 -0
  106. package/hooks/useDynamicFilterAndSort/styles.js +23 -0
  107. package/hooks/useDynamicFilterAndSort/types.d.ts +2 -0
  108. package/hooks/useDynamicFilterAndSort/useDynamicFilterAndSort.js +27 -21
  109. package/index.js +145 -139
  110. package/package.json +1 -1
  111. package/components/DataGrid/subcomponents/Table/subcomponents/RadioButtonFormatter.d.ts +0 -6
  112. package/components/DataGrid/subcomponents/Table/subcomponents/RadioButtonFormatter.js +0 -12
  113. package/components/hook-form/RHFRadioGroup/formatters/OptionIconLabelFormatter/index.js +0 -16
  114. package/components/mui_extended/RadioButton/RadioButton.d.ts +0 -24
  115. package/components/mui_extended/RadioButton/RadioButton.styles.d.ts +0 -2
  116. package/components/mui_extended/RadioButton/constants.d.ts +0 -1
  117. package/components/mui_extended/RadioButton/constants.js +0 -4
  118. package/components/mui_extended/RadioButton/index.d.ts +0 -1
  119. package/components/mui_extended/RadioButton/slots/RadioButtonEnum.d.ts +0 -8
  120. package/components/mui_extended/RadioButton/slots/RadioButtonEnum.js +0 -12
  121. package/components/mui_extended/RadioButton/slots/RadioButtonSlots.js +0 -39
  122. package/components/mui_extended/RadioButton/types.d.ts +0 -50
  123. /package/components/{mui_extended/RadioButton → CheckableList/hooks}/index.js +0 -0
  124. /package/components/DataGrid/tests/table/subcomponents/{RadioButtonFormatter.test.d.ts → RadioFormatter.test.d.ts} +0 -0
  125. /package/components/mui_extended/{RadioButton → Radio}/icons.d.ts +0 -0
  126. /package/components/mui_extended/{RadioButton → Radio}/icons.js +0 -0
  127. /package/components/mui_extended/{RadioButton/tests/RadioButton.test.d.ts → Radio/tests/Radio.test.d.ts} +0 -0
@@ -1,11 +1,11 @@
1
- import { DynamicMFState } from '../../contexts/DynamicMFParmsContext/store';
1
+ import { DynamicMFStateWithActions } from '../../contexts/DynamicMFParmsContext/store';
2
2
  /**
3
3
  * TODO: Documentar
4
4
  */
5
- export declare const useDynamicMFParameters: () => Omit<import('zustand').StoreApi<import('../../contexts/DynamicMFParmsContext/store').DynamicMFStateWithActions>, "setState"> & {
6
- setState(nextStateOrUpdater: import('../../contexts/DynamicMFParmsContext/store').DynamicMFStateWithActions | Partial<import('../../contexts/DynamicMFParmsContext/store').DynamicMFStateWithActions> | ((state: import('immer/dist/internal').WritableDraft<import('../../contexts/DynamicMFParmsContext/store').DynamicMFStateWithActions>) => void), shouldReplace?: boolean | undefined): void;
5
+ export declare const useDynamicMFParameters: () => Omit<import('zustand').StoreApi<DynamicMFStateWithActions>, "setState"> & {
6
+ setState(nextStateOrUpdater: DynamicMFStateWithActions | Partial<DynamicMFStateWithActions> | ((state: import('immer/dist/internal').WritableDraft<DynamicMFStateWithActions>) => void), shouldReplace?: boolean | undefined): void;
7
7
  };
8
8
  /**
9
9
  * TODO: Documentar
10
10
  */
11
- export declare function useDynamicMFParametersStore<T>(selector: (state: DynamicMFState) => T, equalityFn?: (left: T, right: T) => boolean): T;
11
+ export declare function useDynamicMFParametersStore<T>(selector: (state: DynamicMFStateWithActions) => T, equalityFn?: (left: T, right: T) => boolean): T;
@@ -441,8 +441,8 @@ const createAreasStore = (initProps, storeDevtoolsEnabled = false) => {
441
441
  bounds: {
442
442
  left: MARGIN_GRIDLAYOUT,
443
443
  top: MARGIN_GRIDLAYOUT,
444
- right: -MARGIN_GRIDLAYOUT,
445
- bottom: -MARGIN_GRIDLAYOUT
444
+ right: -10,
445
+ bottom: -10
446
446
  }
447
447
  });
448
448
  }
@@ -1 +1 @@
1
- export declare const SectionCommercialRoot: import('@emotion/styled').StyledComponent<import('../../mui_extended/Stack').StackProps & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme>, {}, {}>;
1
+ export declare const SectionCommercialRoot: import('@emotion/styled').StyledComponent<Omit<import('../../mui_extended/Stack').StackProps, "ref"> & import('react').RefAttributes<HTMLDivElement> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme>, {}, {}>;
@@ -0,0 +1,7 @@
1
+ import { RHFCheckableListProps } from './types';
2
+ /**
3
+ * RHFCheckableList is a custom checkable list component integrated with React Hook Form.
4
+ * It renders a list of checkable items that can optionally be grouped, with optional label,
5
+ * helper text, and error message.
6
+ */
7
+ export declare const RHFCheckableList: (props: RHFCheckableListProps) => JSX.Element;
@@ -0,0 +1,91 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import clsx from "clsx";
3
+ import { useFormContext, Controller } from "react-hook-form";
4
+ import { useId } from "react";
5
+ import { a as getPropDataTestId } from "../../../test/getNameDataTestId.js";
6
+ import { R as RHF_CHECKABLE_LIST_COMPONENT_KEY, a as RHF_CHECKABLE_LIST_CLASSES } from "./constants.js";
7
+ import { R as RHFCheckableListEnum } from "./slots/RHFCheckableListEnum.js";
8
+ import { R as RootStyled, L as LabelStyled, C as CheckableListStyled, H as HelperErrorStyled } from "./slots/RHFCheckableListSlots.js";
9
+ import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
10
+ const RHFCheckableList = (props) => {
11
+ const {
12
+ id,
13
+ name,
14
+ items,
15
+ groups,
16
+ label,
17
+ labelSkeletonWidth,
18
+ helperErrorSkeletonWidth,
19
+ helperMessage,
20
+ mandatory,
21
+ mandatoryMessage,
22
+ disabled,
23
+ size = "medium",
24
+ className,
25
+ dataTestId,
26
+ width = "100%",
27
+ ...other
28
+ } = props;
29
+ const reactId = useId();
30
+ const htmlForId = id || reactId;
31
+ const { currentSize } = useComponentSize(size);
32
+ const { control } = useFormContext();
33
+ return /* @__PURE__ */ jsx(RootStyled, { className: clsx(RHF_CHECKABLE_LIST_CLASSES.root, className), children: /* @__PURE__ */ jsx(
34
+ Controller,
35
+ {
36
+ name,
37
+ control,
38
+ render: ({ field: { value, onChange }, fieldState: { error } }) => {
39
+ const onChangeLocal = (selectedIds) => {
40
+ onChange(selectedIds || []);
41
+ };
42
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
43
+ label && /* @__PURE__ */ jsx(
44
+ LabelStyled,
45
+ {
46
+ id: `${htmlForId}-label`,
47
+ htmlFor: htmlForId,
48
+ label,
49
+ mandatory,
50
+ mandatoryMessage,
51
+ helperMessage,
52
+ size: currentSize,
53
+ skeletonWidth: labelSkeletonWidth,
54
+ error: Boolean(error),
55
+ disabled
56
+ }
57
+ ),
58
+ /* @__PURE__ */ jsx(
59
+ CheckableListStyled,
60
+ {
61
+ items,
62
+ groups,
63
+ value: value || [],
64
+ onChange: onChangeLocal,
65
+ disabled,
66
+ size: currentSize,
67
+ width,
68
+ ...getPropDataTestId(
69
+ RHF_CHECKABLE_LIST_COMPONENT_KEY,
70
+ RHFCheckableListEnum.checkableList,
71
+ dataTestId
72
+ ),
73
+ ...other
74
+ }
75
+ ),
76
+ error?.message && /* @__PURE__ */ jsx(
77
+ HelperErrorStyled,
78
+ {
79
+ size: currentSize,
80
+ message: error.message,
81
+ skeletonWidth: helperErrorSkeletonWidth
82
+ }
83
+ )
84
+ ] });
85
+ }
86
+ }
87
+ ) });
88
+ };
89
+ export {
90
+ RHFCheckableList as R
91
+ };
@@ -0,0 +1,2 @@
1
+ import { RHFCheckableListStyles } from './types';
2
+ export declare const rhfCheckableListStyles: RHFCheckableListStyles;
@@ -0,0 +1,30 @@
1
+ const rhfCheckableListStyles = {
2
+ /**
3
+ * Root: Estilos del contenedor principal del componente.
4
+ */
5
+ root: () => ({
6
+ width: "100%",
7
+ display: "flex",
8
+ flexDirection: "column",
9
+ position: "relative",
10
+ height: "100%",
11
+ gap: 8
12
+ }),
13
+ /**
14
+ * label: Estilos del label del componente.
15
+ */
16
+ label: () => ({}),
17
+ /**
18
+ * checkableList: Estilos de la lista chequeable del componente.
19
+ */
20
+ checkableList: () => ({
21
+ width: "100%"
22
+ }),
23
+ /**
24
+ * helperError: Estilos del mensaje de error del componente.
25
+ */
26
+ helperError: () => ({})
27
+ };
28
+ export {
29
+ rhfCheckableListStyles as r
30
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Key del componente RHFCheckableList usado para identificar el componente en el registro de componentes.
3
+ */
4
+ export declare const RHF_CHECKABLE_LIST_COMPONENT_KEY = "RHFCheckableList";
5
+ /**
6
+ * Clases CSS generadas dinámicamente para el componente RHFCheckableList.
7
+ */
8
+ export declare const RHF_CHECKABLE_LIST_CLASSES: Record<"label" | "root" | "checkableList" | "helperError", string>;
@@ -0,0 +1,11 @@
1
+ import { g as getComponentClasses } from "../../../utils/getComponentSlotRoot.js";
2
+ import { R as RHFCheckableListEnum } from "./slots/RHFCheckableListEnum.js";
3
+ const RHF_CHECKABLE_LIST_COMPONENT_KEY = "RHFCheckableList";
4
+ const RHF_CHECKABLE_LIST_CLASSES = getComponentClasses(
5
+ RHF_CHECKABLE_LIST_COMPONENT_KEY,
6
+ RHFCheckableListEnum
7
+ );
8
+ export {
9
+ RHF_CHECKABLE_LIST_COMPONENT_KEY as R,
10
+ RHF_CHECKABLE_LIST_CLASSES as a
11
+ };
@@ -0,0 +1,2 @@
1
+ export { RHFCheckableList } from './RHFCheckableList';
2
+ export type { RHFCheckableListProps } from './types';
@@ -0,0 +1,6 @@
1
+ export declare enum RHFCheckableListEnum {
2
+ root = "root",
3
+ label = "label",
4
+ checkableList = "checkableList",
5
+ helperError = "helperError"
6
+ }
@@ -0,0 +1,10 @@
1
+ var RHFCheckableListEnum = /* @__PURE__ */ ((RHFCheckableListEnum2) => {
2
+ RHFCheckableListEnum2["root"] = "root";
3
+ RHFCheckableListEnum2["label"] = "label";
4
+ RHFCheckableListEnum2["checkableList"] = "checkableList";
5
+ RHFCheckableListEnum2["helperError"] = "helperError";
6
+ return RHFCheckableListEnum2;
7
+ })(RHFCheckableListEnum || {});
8
+ export {
9
+ RHFCheckableListEnum as R
10
+ };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Elemento div de react construido a través de styled,
3
+ * sirve para agrupar el contenido del componente `RHFCheckableList`
4
+ */
5
+ export declare const RootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown>, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
6
+ /**
7
+ * Elemento Label construido a través de styled,
8
+ * sirve para mostrar el label del componente `RHFCheckableList`
9
+ */
10
+ export declare const LabelStyled: import('@emotion/styled').StyledComponent<Pick<import('../../../Label').LabelProps, keyof import('../../../Label').LabelProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown>, {}, {}>;
11
+ /**
12
+ * Elemento CheckableList construido a través de styled,
13
+ * sirve para mostrar la lista chequeable del componente `RHFCheckableList`
14
+ */
15
+ export declare const CheckableListStyled: import('@emotion/styled').StyledComponent<Pick<import('../../../CheckableList').CheckableListProps, keyof import('../../../CheckableList').CheckableListProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown>, {}, {}>;
16
+ /**
17
+ * Elemento HelperError construido a través de styled,
18
+ * sirve para mostrar el mensaje de error del componente `RHFCheckableList`
19
+ */
20
+ export declare const HelperErrorStyled: import('@emotion/styled').StyledComponent<Pick<import('../../../HelperError').HelperErrorProps & import('react').RefAttributes<HTMLLabelElement>, keyof import('../../../HelperError').HelperErrorProps | keyof import('react').RefAttributes<HTMLLabelElement>> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown>, {}, {}>;
@@ -0,0 +1,29 @@
1
+ import { styled } from "@mui/material";
2
+ import { R as RHF_CHECKABLE_LIST_COMPONENT_KEY } from "../constants.js";
3
+ import { R as RHFCheckableListEnum } from "./RHFCheckableListEnum.js";
4
+ import { r as rhfCheckableListStyles } from "../RHFCheckableList.styles.js";
5
+ import { L as Label } from "../../../Label/Label.js";
6
+ import { C as CheckableList } from "../../../CheckableList/CheckableList.js";
7
+ import { H as HelperError } from "../../../HelperError/HelperError.js";
8
+ const RootStyled = styled("div", {
9
+ name: RHF_CHECKABLE_LIST_COMPONENT_KEY,
10
+ slot: RHFCheckableListEnum.root
11
+ })(rhfCheckableListStyles?.root);
12
+ const LabelStyled = styled(Label, {
13
+ name: RHF_CHECKABLE_LIST_COMPONENT_KEY,
14
+ slot: RHFCheckableListEnum.label
15
+ })(rhfCheckableListStyles?.label);
16
+ const CheckableListStyled = styled(CheckableList, {
17
+ name: RHF_CHECKABLE_LIST_COMPONENT_KEY,
18
+ slot: RHFCheckableListEnum.checkableList
19
+ })(rhfCheckableListStyles?.checkableList);
20
+ const HelperErrorStyled = styled(HelperError, {
21
+ name: RHF_CHECKABLE_LIST_COMPONENT_KEY,
22
+ slot: RHFCheckableListEnum.helperError
23
+ })(rhfCheckableListStyles?.helperError);
24
+ export {
25
+ CheckableListStyled as C,
26
+ HelperErrorStyled as H,
27
+ LabelStyled as L,
28
+ RootStyled as R
29
+ };
@@ -0,0 +1,2 @@
1
+ export * from './RHFCheckableListEnum';
2
+ export * from './RHFCheckableListSlots';
@@ -0,0 +1,60 @@
1
+ import { HelperErrorProps } from '../../HelperError';
2
+ import { LabelProps } from '../../Label/types';
3
+ import { CheckableListProps } from '../../CheckableList/types';
4
+ import { Sizes } from '@m4l/styles';
5
+ import { M4LOverridesStyleRules } from '../../../@types/augmentations';
6
+ import { RHFCheckableListEnum } from './slots/RHFCheckableListEnum';
7
+ import { RHF_CHECKABLE_LIST_COMPONENT_KEY } from './constants';
8
+ import { Theme } from '@mui/material';
9
+ /**
10
+ * Props para el componente RHFCheckableList, incluye las propiedades especiales del CheckableList, Label,
11
+ * así como las propiedades requeridas por react hook form.
12
+ */
13
+ export interface RHFCheckableListProps extends Omit<CheckableListProps, 'value' | 'onChange' | 'data-testid' | 'className'>, Omit<LabelProps, 'dataTestId' | 'error' | 'children' | 'className' | 'disabled' | 'size' | 'skeletonWidth'> {
14
+ /**
15
+ * Identificador para el manejo de campos en react hook form.
16
+ */
17
+ name: string;
18
+ /**
19
+ * Tamaño del componente
20
+ */
21
+ size?: Extract<Sizes, 'small' | 'medium'>;
22
+ /**
23
+ * Propiedad que deshabilita la interacción del componente.
24
+ */
25
+ disabled?: boolean;
26
+ /**
27
+ * Nombre de clase CSS personalizada que se aplicará al componente.
28
+ */
29
+ className?: string;
30
+ /**
31
+ * Propiedad usada para facilitar la identificación del componente en las pruebas.
32
+ */
33
+ dataTestId?: string;
34
+ /**
35
+ * Medida de anchura para el esqueleto del label
36
+ */
37
+ labelSkeletonWidth?: LabelProps['skeletonWidth'];
38
+ /**
39
+ * Medida de anchura para el esqueleto del helperError
40
+ */
41
+ helperErrorSkeletonWidth?: HelperErrorProps['skeletonWidth'];
42
+ }
43
+ /**
44
+ * Define el estado del componente `RHFCheckableList`.
45
+ */
46
+ export interface RHFCheckableListOwnerState {
47
+ }
48
+ /**
49
+ * Define las claves del objeto `RHFCheckableListSlotsType`, que se utilizan para
50
+ * hacer referencia a los diferentes slots disponibles para estilizar el componente
51
+ * `RHFCheckableList`.
52
+ */
53
+ export type RHFCheckableListSlotsType = keyof typeof RHFCheckableListEnum;
54
+ /**
55
+ * Define los estilos del componente `RHFCheckableListStyles`. Permite la personalización parcial
56
+ * de las reglas de estilo mediante `OverridesStyleRules`.
57
+ *
58
+ * Puede ser parcial o estar indefinido.
59
+ */
60
+ export type RHFCheckableListStyles = M4LOverridesStyleRules<RHFCheckableListEnum, typeof RHF_CHECKABLE_LIST_COMPONENT_KEY, Theme>;
@@ -28,7 +28,7 @@ export declare const useColorPicker: (props: UseColorPickerProps) => {
28
28
  anchorEl: HTMLElement | null;
29
29
  tempColor: string | undefined;
30
30
  iconButtonOwnerState: {
31
- size: "small" | "medium";
31
+ size: import('@m4l/styles').Sizes;
32
32
  disabled: boolean | undefined;
33
33
  value: string;
34
34
  error: boolean;
@@ -90,16 +90,15 @@ const Period = (props) => {
90
90
  onTotalChange(newPeriodTime.id, singleValue);
91
91
  }
92
92
  };
93
- const normalizedSize = currentSize === "large" ? "medium" : currentSize;
94
93
  const ownerState = {
95
- size: normalizedSize,
94
+ size: currentSize,
96
95
  disabled
97
96
  };
98
97
  return /* @__PURE__ */ jsxs(PeriodRootStyled, { ownerState, children: [
99
98
  /* @__PURE__ */ jsx(
100
99
  Icon,
101
100
  {
102
- size: normalizedSize,
101
+ size: currentSize,
103
102
  src: `${host_static_assets}/${environment_assets}/frontend/components/period/assets/icons/clock.svg`,
104
103
  disabled
105
104
  }
@@ -107,7 +106,7 @@ const Period = (props) => {
107
106
  /* @__PURE__ */ jsx(
108
107
  SelectStyled,
109
108
  {
110
- size: normalizedSize,
109
+ size: currentSize,
111
110
  value: options[selPeriodTime].id,
112
111
  options,
113
112
  onChange: (autcValue) => {
@@ -1,6 +1,6 @@
1
- import { RadioGroupProps, RadioProps } from '@mui/material';
2
1
  import { RHFRadioGroupProps } from './types';
3
2
  /**
4
- * TODO: Documentar
3
+ * RHFRadioGroup: Componente que permite seleccionar una opción de un grupo de opciones.
4
+ * Por defecto usa el componente Radio de M4L basado en MUI, pero se puede pasar un componente personalizado.
5
5
  */
6
- export declare function RHFRadioGroup<TOption extends RadioProps>({ name, options, getOptionLabel, getOptionValue, getOptionIconUrl, renderOptionLabel, ControlLabel, ...other }: RHFRadioGroupProps<TOption> & RadioGroupProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function RHFRadioGroup<TOption>({ id, name, options, getOptionLabel, getOptionValue, label, mandatory, mandatoryMessage, helperMessage, size, dataTestId, labelSkeletonWidth, helperErrorSkeletonWidth, disabled, className, ControlOption, ...other }: RHFRadioGroupProps<TOption>): import("react/jsx-runtime").JSX.Element;
@@ -1,41 +1,83 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { useFormContext, Controller } from "react-hook-form";
3
- import { RadioGroup, FormControlLabel, Radio } from "@mui/material";
4
- import { O as OptionIconLabelFormatter } from "./formatters/OptionIconLabelFormatter/index.js";
3
+ import { R as Radio } from "../../mui_extended/Radio/Radio.js";
4
+ import { R as RootStyled, a as RadioGroupStyled } from "./slots/styled.js";
5
+ import { useId } from "react";
6
+ import { R as RHFRADIO_GROUP_KEY_COMPONENT, a as RHFRADIO_GROUP_CLASSES } from "./constants.js";
7
+ import clsx from "clsx";
8
+ import { a as getPropDataTestId } from "../../../test/getNameDataTestId.js";
9
+ import { R as RHFRadioGroupSlots } from "./slots/slots.js";
10
+ import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
11
+ import { L as Label } from "../../Label/Label.js";
5
12
  import { H as HelperError } from "../../HelperError/HelperError.js";
6
13
  function RHFRadioGroup({
14
+ id,
7
15
  name,
8
16
  options,
9
17
  getOptionLabel,
10
18
  getOptionValue,
11
- getOptionIconUrl,
12
- renderOptionLabel = OptionIconLabelFormatter,
13
- ControlLabel = Radio,
19
+ label,
20
+ mandatory,
21
+ mandatoryMessage,
22
+ helperMessage,
23
+ size,
24
+ dataTestId,
25
+ labelSkeletonWidth,
26
+ helperErrorSkeletonWidth,
27
+ disabled,
28
+ className,
29
+ ControlOption = Radio,
14
30
  ...other
15
31
  }) {
16
- const { control } = useFormContext();
17
- return /* @__PURE__ */ jsx(
32
+ const reactId = useId();
33
+ const htmlForId = id || reactId;
34
+ const { currentSize } = useComponentSize(size);
35
+ const { control: formControl } = useFormContext();
36
+ return /* @__PURE__ */ jsx(RootStyled, { className: clsx(RHFRADIO_GROUP_CLASSES.root, className), children: /* @__PURE__ */ jsx(
18
37
  Controller,
19
38
  {
20
39
  name,
21
- control,
22
- render: ({ field, fieldState: { error } }) => /* @__PURE__ */ jsxs("div", { children: [
23
- /* @__PURE__ */ jsx(RadioGroup, { ...field, row: true, ...other, children: options.map((option) => {
24
- return /* @__PURE__ */ jsx(
25
- FormControlLabel,
40
+ control: formControl,
41
+ render: ({ field: { onChange, value }, fieldState: { error } }) => {
42
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
43
+ label && /* @__PURE__ */ jsx(
44
+ Label,
26
45
  {
27
- defaultValue: field.value,
28
- value: getOptionValue(option),
29
- control: /* @__PURE__ */ jsx(ControlLabel, { ...option }),
30
- label: renderOptionLabel(option, getOptionLabel, getOptionIconUrl)
31
- },
32
- getOptionValue(option)
33
- );
34
- }) }),
35
- error && /* @__PURE__ */ jsx(HelperError, { message: error.message || "" })
36
- ] })
46
+ id: `${htmlForId}-label`,
47
+ htmlFor: htmlForId,
48
+ label,
49
+ mandatory,
50
+ mandatoryMessage,
51
+ helperMessage,
52
+ size: currentSize,
53
+ skeletonWidth: labelSkeletonWidth,
54
+ error: Boolean(error),
55
+ disabled
56
+ }
57
+ ),
58
+ /* @__PURE__ */ jsx(
59
+ RadioGroupStyled,
60
+ {
61
+ onChange,
62
+ value,
63
+ ...other,
64
+ ...getPropDataTestId(
65
+ RHFRADIO_GROUP_KEY_COMPONENT,
66
+ RHFRadioGroupSlots.radioGroup,
67
+ dataTestId
68
+ ),
69
+ children: options.map((option) => {
70
+ const optionValue = getOptionValue(option);
71
+ const optionLabel = getOptionLabel(option);
72
+ return /* @__PURE__ */ jsx(ControlOption, { checked: value === optionValue, onChange, value: optionValue, inlineText: optionLabel }, optionValue);
73
+ })
74
+ }
75
+ ),
76
+ error && /* @__PURE__ */ jsx(HelperError, { message: error.message || "" })
77
+ ] });
78
+ }
37
79
  }
38
- );
80
+ ) });
39
81
  }
40
82
  export {
41
83
  RHFRadioGroup as R
@@ -0,0 +1,5 @@
1
+ import { RHFRadioGroupStyles } from './types';
2
+ /**
3
+ * Estilos para el componente `RHFColorPicker`. Define los estilos de cada parte del componente, como el root, label, color, popover, sketch picker, y las acciones.
4
+ */
5
+ export declare const rhfRadioGroupStyles: RHFRadioGroupStyles;
@@ -0,0 +1,29 @@
1
+ const rhfRadioGroupStyles = {
2
+ /**
3
+ * Estilos para el elemento raíz del `RHFColorPicker`.
4
+ * Aplica un layout de columna con un espacio entre los elementos basado en el tamaño de espaciado definido en el tema.
5
+ */
6
+ root: ({ theme }) => ({
7
+ display: "flex",
8
+ flexDirection: "column",
9
+ height: "fit-content",
10
+ overflow: "hidden",
11
+ gap: theme.vars.size.baseSpacings["sp0-5"],
12
+ width: "100%"
13
+ }),
14
+ /**
15
+ * Estilos para el elemento `RadioGroup`.
16
+ */
17
+ radioGroup: () => ({}),
18
+ /**
19
+ * Estilos para el elemento `OptionWrapper`.
20
+ */
21
+ optionWrapper: ({ theme }) => ({
22
+ display: "flex",
23
+ flexDirection: "row",
24
+ gap: theme.vars.size.baseSpacings["sp0-5"]
25
+ })
26
+ };
27
+ export {
28
+ rhfRadioGroupStyles as r
29
+ };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Nombre de clase que se usa para dar identidad a los slots del componente.
3
+ */
4
+ export declare const RHFRADIO_GROUP_KEY_COMPONENT = "M4LRHFRadioGroup";
5
+ export declare const RHFRADIO_GROUP_CLASSES: Record<"radioGroup" | "root" | "optionWrapper", string>;
@@ -0,0 +1,8 @@
1
+ import { R as RHFRadioGroupSlots } from "./slots/slots.js";
2
+ import { g as getComponentClasses } from "../../../utils/getComponentSlotRoot.js";
3
+ const RHFRADIO_GROUP_KEY_COMPONENT = "M4LRHFRadioGroup";
4
+ const RHFRADIO_GROUP_CLASSES = getComponentClasses(RHFRADIO_GROUP_KEY_COMPONENT, RHFRadioGroupSlots);
5
+ export {
6
+ RHFRADIO_GROUP_KEY_COMPONENT as R,
7
+ RHFRADIO_GROUP_CLASSES as a
8
+ };
@@ -1,5 +1,5 @@
1
- import { GetOptionStringType } from '../../types';
1
+ import { GetOptionLabelType } from '../../types';
2
2
  /**
3
3
  * TODO: Documentar
4
4
  */
5
- export declare function OptionIconLabelFormatter<T>(option: T, getOptionLabel: GetOptionStringType<T>, getOptionIconUrl: GetOptionStringType<T>): import("react/jsx-runtime").JSX.Element;
5
+ export declare function OptionIconLabelFormatter<T>(option: T, getOptionLabel: GetOptionLabelType<T>, getOptionIconUrl: GetOptionLabelType<T>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ export declare enum RHFRadioGroupSlots {
2
+ root = "root",
3
+ radioGroup = "radioGroup",
4
+ optionWrapper = "optionWrapper"
5
+ }
@@ -0,0 +1,9 @@
1
+ var RHFRadioGroupSlots = /* @__PURE__ */ ((RHFRadioGroupSlots2) => {
2
+ RHFRadioGroupSlots2["root"] = "root";
3
+ RHFRadioGroupSlots2["radioGroup"] = "radioGroup";
4
+ RHFRadioGroupSlots2["optionWrapper"] = "optionWrapper";
5
+ return RHFRadioGroupSlots2;
6
+ })(RHFRadioGroupSlots || {});
7
+ export {
8
+ RHFRadioGroupSlots as R
9
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Componente que es un envoltorio `div` que representa el contenedor raíz del `RHFColorPicker`.
3
+ */
4
+ export declare const RootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown>, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
5
+ /**
6
+ * Componente que es un envoltorio `div` que representa el contenedor raíz del `RHFColorPicker`.
7
+ */
8
+ export declare const RadioGroupStyled: import('@emotion/styled').StyledComponent<Pick<import('@mui/material').RadioGroupProps, keyof import('@mui/material').RadioGroupProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown>, {}, {}>;
9
+ export declare const OptionWrapperStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown>, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
@@ -0,0 +1,20 @@
1
+ import { styled, RadioGroup } from "@mui/material";
2
+ import { R as RHFRADIO_GROUP_KEY_COMPONENT } from "../constants.js";
3
+ import { r as rhfRadioGroupStyles } from "../RHFRadioGroup.styles.js";
4
+ import { R as RHFRadioGroupSlots } from "./slots.js";
5
+ const RootStyled = styled("div", {
6
+ name: RHFRADIO_GROUP_KEY_COMPONENT,
7
+ slot: RHFRadioGroupSlots.root
8
+ })(rhfRadioGroupStyles?.root);
9
+ const RadioGroupStyled = styled(RadioGroup, {
10
+ name: RHFRADIO_GROUP_KEY_COMPONENT,
11
+ slot: RHFRadioGroupSlots.radioGroup
12
+ })(rhfRadioGroupStyles?.radioGroup);
13
+ styled("div", {
14
+ name: RHFRADIO_GROUP_KEY_COMPONENT,
15
+ slot: RHFRadioGroupSlots.optionWrapper
16
+ })(rhfRadioGroupStyles?.optionWrapper);
17
+ export {
18
+ RootStyled as R,
19
+ RadioGroupStyled as a
20
+ };