@m4l/components 9.1.130 → 9.1.132

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 (77) hide show
  1. package/components/Chip/Chip.js +21 -21
  2. package/components/Chip/ChipStyles.js +22 -50
  3. package/components/Chip/slots/ChipSlots.js +2 -2
  4. package/components/Chip/types.d.ts +3 -3
  5. package/components/DynamicSort/DynamicSort.d.ts +4 -1
  6. package/components/DynamicSort/DynamicSort.styles.js +88 -126
  7. package/components/DynamicSort/constants.d.ts +0 -1
  8. package/components/DynamicSort/constants.js +0 -1
  9. package/components/DynamicSort/icons.d.ts +2 -0
  10. package/components/DynamicSort/icons.js +6 -0
  11. package/components/DynamicSort/slots/DynamicSortSlots.d.ts +23 -43
  12. package/components/DynamicSort/slots/DynamicSortSlots.js +30 -57
  13. package/components/DynamicSort/slots/SlotsEnum.d.ts +2 -9
  14. package/components/DynamicSort/slots/SlotsEnum.js +1 -8
  15. package/components/DynamicSort/store/DynamicSortContext.d.ts +3 -3
  16. package/components/DynamicSort/store/DynamicSortContext.js +10 -4
  17. package/components/DynamicSort/store/DynamicSortStore.d.ts +1 -177
  18. package/components/DynamicSort/store/DynamicSortStore.js +10 -1
  19. package/components/DynamicSort/store/type.d.ts +186 -0
  20. package/components/DynamicSort/store/useDynamicSortStore.d.ts +2 -2
  21. package/components/DynamicSort/subcomponents/AppliedSortChip/AppliedSortChip.d.ts +1 -1
  22. package/components/DynamicSort/subcomponents/AppliedSortChip/AppliedSortChip.js +18 -20
  23. package/components/DynamicSort/subcomponents/AppliedSortChip/useAppliedSortChip.d.ts +2 -2
  24. package/components/DynamicSort/subcomponents/AppliedSortChip/useAppliedSortChip.js +4 -4
  25. package/components/DynamicSort/subcomponents/AppliedSorts/AppliedSorts.d.ts +1 -1
  26. package/components/DynamicSort/subcomponents/AppliedSorts/AppliedSorts.js +14 -2
  27. package/components/DynamicSort/subcomponents/AppliedSorts/useAppliedSorts.d.ts +1 -1
  28. package/components/DynamicSort/subcomponents/DynamicSortBase/DynamicSortBase.d.ts +1 -1
  29. package/components/DynamicSort/subcomponents/DynamicSortBase/DynamicSortBase.js +4 -3
  30. package/components/DynamicSort/subcomponents/DynamicSortBase/useDynamicSortBase.d.ts +2 -1
  31. package/components/DynamicSort/subcomponents/DynamicSortBase/useDynamicSortBase.js +2 -1
  32. package/components/DynamicSort/subcomponents/FieldTypes/DataTypeComponent.d.ts +1 -1
  33. package/components/DynamicSort/subcomponents/FieldTypes/StringSort/helpers.d.ts +8 -8
  34. package/components/DynamicSort/subcomponents/FieldTypes/StringSort/helpers.js +11 -14
  35. package/components/DynamicSort/subcomponents/FieldTypes/StringSort/index.js +16 -12
  36. package/components/DynamicSort/subcomponents/FieldTypes/fieldFactory.d.ts +1 -1
  37. package/components/DynamicSort/subcomponents/InputSort/InputSort.d.ts +1 -1
  38. package/components/DynamicSort/subcomponents/InputSort/InputSort.js +8 -10
  39. package/components/DynamicSort/subcomponents/PopoverMenuFields/PopoverMenuFields.js +9 -8
  40. package/components/DynamicSort/subcomponents/PopoverSort/PopoverSort.js +8 -6
  41. package/components/DynamicSort/subcomponents/SortActions/SortActions.js +8 -9
  42. package/components/DynamicSort/tests/DynamicSort.test.d.ts +1 -0
  43. package/components/DynamicSort/types.d.ts +9 -2
  44. package/components/Icon/Icon.js +13 -7
  45. package/components/Icon/Icon.styles.js +23 -20
  46. package/components/Icon/types.d.ts +9 -6
  47. package/components/Label/Label.styles.js +1 -1
  48. package/components/NumberInput/NumberInput.styles.js +1 -1
  49. package/components/PaperForm/styles.js +1 -1
  50. package/components/SideBar/subcomponents/ContentGroups/subcomponents/ContainerMenuItemsMain/styles.js +1 -1
  51. package/components/areas/components/AreasAdmin/AreasAdmin.styles.js +1 -1
  52. package/components/extended/React-Spinners/PropagateLoaderSpinner/PropagateLoaderSpinner.styles.js +1 -1
  53. package/components/hook-form/RHFTextFieldPassword/RHFTextFieldPassword.styles.js +1 -1
  54. package/components/mui_extended/Autocomplete/Autocomplete.styles.js +1 -1
  55. package/components/mui_extended/CheckBox/CheckBox.styles.js +1 -1
  56. package/components/mui_extended/DateTimePicker/DateTimePicker.styles.js +1 -1
  57. package/components/mui_extended/IconButton/IconButton.d.ts +2 -1
  58. package/components/mui_extended/IconButton/IconButton.js +18 -20
  59. package/components/mui_extended/IconButton/IconButton.styles.js +118 -162
  60. package/components/mui_extended/IconButton/types.d.ts +3 -4
  61. package/components/mui_extended/MenuDivider/MenuDivider.styles.js +1 -1
  62. package/components/mui_extended/MenuItem/MenuItem.js +27 -20
  63. package/components/mui_extended/MenuItem/MenuItem.styles.js +1 -1
  64. package/components/mui_extended/MenuItem/slots/MenuItemSlots.js +6 -6
  65. package/components/mui_extended/NavLink/NavLink.styles.js +1 -1
  66. package/components/mui_extended/Select/Select.styles.js +1 -3
  67. package/components/mui_extended/TextField/TextField.styles.js +1 -1
  68. package/components/mui_extended/Typography/typography.styles.js +1 -2
  69. package/index.js +7 -7
  70. package/package.json +1 -1
  71. package/utils/getSizeStyles/getSizeStyles.d.ts +1 -2
  72. package/utils/getSizeStyles/getSizeStyles.js +4 -4
  73. package/components/DynamicSort/DynamicSort.stories.d.ts +0 -21
  74. package/components/DynamicSort/subcomponents/InputSort/InputSortSkeleton.d.ts +0 -5
  75. package/components/DynamicSort/subcomponents/InputSort/InputSortSkeleton.js +0 -19
  76. package/components/DynamicSort/subcomponents/SortActions/SortActionsSkeleton.d.ts +0 -5
  77. package/components/DynamicSort/subcomponents/SortActions/SortActionsSkeleton.js +0 -12
@@ -7,7 +7,7 @@ class StringSortHelpers {
7
7
  return StringSort;
8
8
  }
9
9
  /**
10
- * TODO: Documentar
10
+ * getDefaulSort obtiene el valor por defecto de un campo de tipo string
11
11
  */
12
12
  getDefaultSort(field, fixed) {
13
13
  const defaultOperator = field.defaultOperator;
@@ -25,31 +25,28 @@ class StringSortHelpers {
25
25
  return defaultSort;
26
26
  }
27
27
  /**
28
- * TODO: Documentar
28
+ * getSortFromFormValue obtiene el valor de un campo de tipo string
29
29
  */
30
30
  getSortFromFormValue(formSortValue) {
31
- const operator = formSortValue.formValueOperator.operator;
31
+ const operator = formSortValue.formValueOperator;
32
32
  return {
33
33
  fieldType: "string",
34
34
  operator
35
35
  };
36
36
  }
37
37
  /**
38
- * TODO: Documentar
38
+ * getFormValue obtiene el valor de un campo de tipo string
39
39
  */
40
- getFormValue(field, getLabel, sortValue) {
40
+ getFormValue(field, _getLabel, sortValue) {
41
41
  const sortValueOperator = sortValue ? sortValue : void 0;
42
42
  const operator = sortValueOperator ? sortValueOperator.operator : field.defaultOperator ?? "asc";
43
43
  return {
44
44
  fieldType: "string",
45
- formValueOperator: {
46
- operator,
47
- name: getLabel(getDynamicSortDictionary(`operator_${operator}`))
48
- }
45
+ formValueOperator: operator
49
46
  };
50
47
  }
51
48
  /**
52
- * TODO: Documentar
49
+ * getLabels obtiene las etiquetas de un campo de tipo string
53
50
  */
54
51
  getLabels(Sort, getLabel, _formatters, _field) {
55
52
  const labelOperator = Sort.operator ? getLabel(getDynamicSortDictionary(`operator_${Sort.operator}`)) : "";
@@ -59,21 +56,21 @@ class StringSortHelpers {
59
56
  };
60
57
  }
61
58
  /**
62
- * TODO: Documentar
59
+ * getSchema obtiene el esquema de un campo de tipo string
63
60
  */
64
61
  getSchema(getLabel) {
65
62
  return Yup.object({
66
- formValueOperator: Yup.object().nullable().required(getLabel(`dynamic_Sort.error_operator_required`))
63
+ formValueOperator: Yup.string().required(getLabel(`dynamic_Sort.error_operator_required`))
67
64
  });
68
65
  }
69
66
  /**
70
- * TODO: Documentar
67
+ * verifySort verifica si un campo de tipo string es válido
71
68
  */
72
69
  verifySort(Sort, _field) {
73
70
  if (typeof Sort.operator !== "string") {
74
71
  return false;
75
72
  }
76
- if (SORT_OPERATORS.findIndex((f) => f === Sort.name) === -1) {
73
+ if (SORT_OPERATORS.findIndex((f) => f === Sort.operator) === -1) {
77
74
  return false;
78
75
  }
79
76
  return typeof Sort.operator === "string";
@@ -1,32 +1,36 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { useMemo } from "react";
3
- import { useModuleDictionary } from "@m4l/core";
3
+ import { useModuleDictionary, useEnvironment } from "@m4l/core";
4
+ import { a as ascending, d as descending } from "../../../icons.js";
4
5
  import { g as getDynamicSortDictionary, D as DICCTIONARY } from "../../../dictionary.js";
5
- import { R as RHFAutocomplete } from "../../../../hook-form/RHFAutocomplete/RHFAutocomplete.js";
6
+ import { u as useDynamicSortBase } from "../../DynamicSortBase/useDynamicSortBase.js";
7
+ import { R as RHFSelect } from "../../../../hook-form/RHFSelect/RHFSelect.js";
8
+ import { I as Icon } from "../../../../Icon/Icon.js";
6
9
  function StringSort() {
7
10
  const { getLabel } = useModuleDictionary();
11
+ const { host_static_assets, environment_assets } = useEnvironment();
12
+ const { size } = useDynamicSortBase();
8
13
  const optionsYesNo = useMemo(
9
14
  () => [
10
15
  {
11
- operator: "asc",
12
- name: getLabel(getDynamicSortDictionary(`label_ascending`))
16
+ id: "asc",
17
+ label: getLabel(getDynamicSortDictionary(`label_ascending`)),
18
+ startAdornment: /* @__PURE__ */ jsx(Icon, { src: `${host_static_assets}/${environment_assets}/${ascending}` })
13
19
  },
14
20
  {
15
- operator: "desc",
16
- name: getLabel(getDynamicSortDictionary(`label_descending`))
21
+ id: "desc",
22
+ label: getLabel(getDynamicSortDictionary(`label_descending`)),
23
+ startAdornment: /* @__PURE__ */ jsx(Icon, { src: `${host_static_assets}/${environment_assets}/${descending}` })
17
24
  }
18
25
  ],
19
- [getLabel]
26
+ [getLabel, host_static_assets, environment_assets]
20
27
  );
21
28
  return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
22
- RHFAutocomplete,
29
+ RHFSelect,
23
30
  {
31
+ size,
24
32
  name: "formValueOperator",
25
- type: "text",
26
- autoComplete: "off",
27
33
  options: optionsYesNo,
28
- getOptionLabel: (option) => option.name,
29
- isOptionEqualToValue: (option, value) => option.operator === value.operator,
30
34
  label: getLabel(getDynamicSortDictionary(DICCTIONARY.input_placeholder))
31
35
  }
32
36
  ) });
@@ -1,6 +1,6 @@
1
1
  import { FieldType } from '../../types';
2
2
  import { StringSortHelpers } from './StringSort/helpers';
3
3
  /**
4
- * TODO: Documentar
4
+ * Factory que retorna el helper correspondiente al tipo de campo
5
5
  */
6
6
  export declare function fieldFactory(type: FieldType): StringSortHelpers;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * TODO: Documentar
2
+ * Componente encargado de mostrar el input de búsqueda y el menú de campos para ordenar
3
3
  */
4
4
  declare const InputSort: () => import("react/jsx-runtime").JSX.Element;
5
5
  export default InputSort;
@@ -1,7 +1,7 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { u as useInputSort } from "./useInputSort.js";
3
- import { I as InputFilterSkeleton } from "./InputSortSkeleton.js";
4
- import { h as InputSortStyled, i as InputSortIconStyled, j as InputSortInputStyled } from "../../slots/DynamicSortSlots.js";
3
+ import { u as useDynamicSortBase } from "../DynamicSortBase/useDynamicSortBase.js";
4
+ import { c as InputSortStyled, d as InputSortIconStyled, e as InputSortInputSkeletonStyled, f as InputSortInputStyled } from "../../slots/DynamicSortSlots.js";
5
5
  import { P as PopoverMenuFields } from "../PopoverMenuFields/PopoverMenuFields.js";
6
6
  const InputSort = () => {
7
7
  const {
@@ -13,18 +13,16 @@ const InputSort = () => {
13
13
  sortFields,
14
14
  selectedFieldIndex
15
15
  } = useInputSort();
16
- if (isSkeleton) {
17
- return /* @__PURE__ */ jsx(InputSortStyled, { ownerState: {}, children: /* @__PURE__ */ jsx(InputFilterSkeleton, {}) });
18
- }
19
- return /* @__PURE__ */ jsxs(InputSortStyled, { ownerState: {}, children: [
20
- /* @__PURE__ */ jsx(InputSortIconStyled, { src: iconUrl, ownerState: {} }),
21
- /* @__PURE__ */ jsx(
16
+ const { ownerState, size } = useDynamicSortBase();
17
+ return /* @__PURE__ */ jsxs(InputSortStyled, { ownerState: { ...ownerState }, children: [
18
+ /* @__PURE__ */ jsx(InputSortIconStyled, { src: iconUrl, size, ownerState: { ...ownerState } }),
19
+ isSkeleton ? /* @__PURE__ */ jsx(InputSortInputSkeletonStyled, { ownerState: { ...ownerState }, variant: "rounded" }) : /* @__PURE__ */ jsx(
22
20
  InputSortInputStyled,
23
21
  {
24
22
  type: "text",
25
23
  value: inputData,
26
24
  placeholder: inputPlaceHolder,
27
- ownerState: {},
25
+ ownerState: { ...ownerState },
28
26
  ...inputHandlersProps
29
27
  }
30
28
  ),
@@ -1,9 +1,11 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { jsx } from "react/jsx-runtime";
2
2
  import { u as usePopoverMenuFields } from "./usePopoverMenuFields.js";
3
- import { P as PopoverMenuStyled, k as PopoverMenuItemStyled, l as PopoverMenuItemIconStyled, m as PopoverMenuItemLabelStyled } from "../../slots/DynamicSortSlots.js";
3
+ import { u as useDynamicSortBase } from "../DynamicSortBase/useDynamicSortBase.js";
4
+ import { P as PopoverMenuStyled, g as PopoverMenuItemStyled, h as PopoverMenuItemIconStyled } from "../../slots/DynamicSortSlots.js";
4
5
  function PopoverMenuFields(props) {
5
6
  const { fields, selectFieldIndex } = props;
6
7
  const { fnAnchorEl, handleOpenPopUpClickItem, handleClosePopover, getItemLabel } = usePopoverMenuFields();
8
+ const { size } = useDynamicSortBase();
7
9
  return /* @__PURE__ */ jsx(
8
10
  PopoverMenuStyled,
9
11
  {
@@ -16,17 +18,16 @@ function PopoverMenuFields(props) {
16
18
  onClose: handleClosePopover,
17
19
  anchorEl: fnAnchorEl?.(),
18
20
  ownerState: {},
19
- children: Boolean(fnAnchorEl) && fields.map((field, index) => /* @__PURE__ */ jsxs(
21
+ children: Boolean(fnAnchorEl) && fields.map((field, index) => /* @__PURE__ */ jsx(
20
22
  PopoverMenuItemStyled,
21
23
  {
24
+ startIcon: /* @__PURE__ */ jsx(PopoverMenuItemIconStyled, { size, src: field.urlIcon, ownerState: {} }),
25
+ label: getItemLabel(field),
22
26
  dense: true,
27
+ size,
23
28
  selected: index === selectFieldIndex,
24
29
  onClick: (event) => handleOpenPopUpClickItem(event, field),
25
- ownerState: {},
26
- children: [
27
- /* @__PURE__ */ jsx(PopoverMenuItemIconStyled, { src: field.urlIcon, ownerState: {} }),
28
- /* @__PURE__ */ jsx(PopoverMenuItemLabelStyled, { ownerState: {}, children: getItemLabel(field) })
29
- ]
30
+ ownerState: {}
30
31
  },
31
32
  `menu_action_${getItemLabel(field)}`
32
33
  ))
@@ -1,7 +1,8 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { u as usePopoverSort } from "./usePopoverSort.js";
2
+ import { u as useDynamicSortBase } from "../DynamicSortBase/useDynamicSortBase.js";
3
3
  import { D as DataTypeComponent } from "../FieldTypes/DataTypeComponent.js";
4
- import { n as PopoverStyled, o as PopoverHeaderStyled, p as PopoverHeaderIconStyled, q as PopoverHeaderTitleStyled, r as PopoverContainerFieldsStyled, s as PopoverHeaderActionsStyled } from "../../slots/DynamicSortSlots.js";
4
+ import { u as usePopoverSort } from "./usePopoverSort.js";
5
+ import { i as PopoverStyled, j as PopoverHeaderStyled, k as PopoverHeaderIconStyled, l as PopoverHeaderTitleStyled, m as PopoverContainerFieldsStyled, n as PopoverHeaderActionsStyled } from "../../slots/DynamicSortSlots.js";
5
6
  import { R as RHFormProvider } from "../../../hook-form/RHFormContext/index.js";
6
7
  import { A as ActionCancel } from "../../../CommonActions/components/ActionCancel/ActionCancel.js";
7
8
  import { A as ActionIntro } from "../../../CommonActions/components/ActionIntro/ActionIntro.js";
@@ -20,6 +21,7 @@ function PopoverSort() {
20
21
  statusLoad,
21
22
  canRender
22
23
  } = usePopoverSort();
24
+ const { size } = useDynamicSortBase();
23
25
  if (!canRender) {
24
26
  return null;
25
27
  }
@@ -45,13 +47,13 @@ function PopoverSort() {
45
47
  statusLoad,
46
48
  children: [
47
49
  /* @__PURE__ */ jsxs(PopoverHeaderStyled, { ownerState: {}, children: [
48
- field.urlIcon && /* @__PURE__ */ jsx(PopoverHeaderIconStyled, { src: field.urlIcon, ownerState: {} }),
49
- /* @__PURE__ */ jsx(PopoverHeaderTitleStyled, { variant: "paragraphDens", ownerState: {}, children: labelField })
50
+ field.urlIcon && /* @__PURE__ */ jsx(PopoverHeaderIconStyled, { src: field.urlIcon, size, ownerState: {} }),
51
+ /* @__PURE__ */ jsx(PopoverHeaderTitleStyled, { variant: "paragraphDens", size, ownerState: {}, children: labelField })
50
52
  ] }),
51
53
  /* @__PURE__ */ jsx(PopoverContainerFieldsStyled, { ownerState: {}, children: /* @__PURE__ */ jsx(DataTypeComponent, { formSort, statusLoad }) }),
52
54
  /* @__PURE__ */ jsxs(PopoverHeaderActionsStyled, { ownerState: {}, children: [
53
- /* @__PURE__ */ jsx(ActionCancel, { onClick: onClose, skeletonWidth: "68px" }),
54
- /* @__PURE__ */ jsx(ActionIntro, { skeletonWidth: "64px" })
55
+ /* @__PURE__ */ jsx(ActionCancel, { size, onClick: onClose, skeletonWidth: "68px" }),
56
+ /* @__PURE__ */ jsx(ActionIntro, { size, skeletonWidth: "64px" })
55
57
  ] })
56
58
  ]
57
59
  }
@@ -1,11 +1,10 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { u as useSortActions } from "./useSortActions.js";
3
- import { S as SortActionsSkeleton } from "./SortActionsSkeleton.js";
4
3
  import { g as getDynamicSortDictionary, D as DICCTIONARY } from "../../dictionary.js";
5
- import { t as ActionsStyled, u as ActionsClearButtonStyled, v as ActionsSubmitButtonStyled } from "../../slots/DynamicSortSlots.js";
4
+ import { u as useDynamicSortBase } from "../DynamicSortBase/useDynamicSortBase.js";
5
+ import { o as ActionsStyled, p as ActionsClearButtonStyled, q as ActionsSubmitButtonStyled } from "../../slots/DynamicSortSlots.js";
6
6
  function SortActions() {
7
7
  const {
8
- isSkeleton,
9
8
  sortIconUrl,
10
9
  clearIconUrl,
11
10
  canShowRemoveAction,
@@ -14,14 +13,13 @@ function SortActions() {
14
13
  sortButtonDictionaryTooltip,
15
14
  ownerState
16
15
  } = useSortActions();
17
- if (isSkeleton) {
18
- return /* @__PURE__ */ jsx(ActionsStyled, { ownerState: {}, children: /* @__PURE__ */ jsx(SortActionsSkeleton, {}) });
19
- }
16
+ const { size } = useDynamicSortBase();
20
17
  return /* @__PURE__ */ jsxs(ActionsStyled, { ownerState: {}, children: [
21
18
  canShowRemoveAction && /* @__PURE__ */ jsx(
22
19
  ActionsClearButtonStyled,
23
20
  {
24
- src: clearIconUrl,
21
+ size,
22
+ icon: clearIconUrl,
25
23
  onClick: onClickClearSorts,
26
24
  dictionaryTooltipId: getDynamicSortDictionary(DICCTIONARY.tooltip_clear_sort),
27
25
  ownerState: {}
@@ -30,7 +28,8 @@ function SortActions() {
30
28
  /* @__PURE__ */ jsx(
31
29
  ActionsSubmitButtonStyled,
32
30
  {
33
- src: sortIconUrl,
31
+ size,
32
+ icon: sortIconUrl,
34
33
  "aria-label": "settings",
35
34
  dictionaryTooltipId: sortButtonDictionaryTooltip,
36
35
  onClick: onClickSort,
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,6 @@
1
1
  import { Theme } from '@mui/material/styles';
2
2
  import { OverridesStyleRules } from '@mui/material/styles/overrides';
3
+ import { Sizes } from '@m4l/styles';
3
4
  import { Maybe } from '@m4l/core';
4
5
  import { DYNAMIC_SORT_KEY_COMPONENT } from './constants';
5
6
  import { DynamicSortSlots } from './slots';
@@ -85,11 +86,11 @@ export type FormOperand = FormOperandString;
85
86
  */
86
87
  export interface FormSortValueBase {
87
88
  fieldType: FieldType;
88
- formValueOperator: FormOperator;
89
+ formValueOperator: StringOperator;
89
90
  }
90
91
  export interface FormSortValueString extends FormSortValueBase {
91
92
  fieldType: 'string';
92
- formValueOperator: FormOperator<StringOperator>;
93
+ formValueOperator: StringOperator;
93
94
  }
94
95
  /**
95
96
  * Valor de un filtro sobrecargado para cada tipo de dato
@@ -129,6 +130,8 @@ export interface DynamicSortProps {
129
130
  onChangeSorts?: OnChangeSorts;
130
131
  /** Key único para necesario para las pruebas del componente. */
131
132
  dataTestId?: string;
133
+ /** Propiedad para las variantes de tamaño */
134
+ size?: Extract<Sizes, 'small' | 'medium'>;
132
135
  }
133
136
  /**
134
137
  * Interface que define la variables que se van a usar en clases del componente
@@ -158,6 +161,10 @@ export interface OwnerState {
158
161
  * "isEmpty" Define si existen sorts aplicados
159
162
  */
160
163
  isEmpty: boolean;
164
+ /**
165
+ * Propiedad para las variantes de tamaño
166
+ */
167
+ size?: Extract<Sizes, 'small' | 'medium'>;
161
168
  }
162
169
  export interface DynamicSortOwnerState extends DynamicSortProps, OwnerState {
163
170
  }
@@ -17,16 +17,21 @@ const Icon = (props) => {
17
17
  className,
18
18
  placement = "bottom",
19
19
  instaceDataTestId,
20
- disabled
20
+ disabled,
21
+ selected,
22
+ enabledSelected
21
23
  } = props;
22
24
  const { currentSize } = useComponentSize(size);
25
+ const adjustedSize = currentSize === "small" || currentSize === "medium" ? currentSize : "medium";
23
26
  const isSkeleton = useModuleSkeleton();
24
27
  const ownerState = {
25
- iconSize: currentSize,
26
- iconColor: color,
27
- iconSrc: src,
28
- iconDisabled: disabled,
29
- iconRotationAngle: rotationAngle,
28
+ size: adjustedSize,
29
+ color,
30
+ src,
31
+ disabled,
32
+ rotationAngle,
33
+ selected,
34
+ enabledSelected,
30
35
  isSkeleton
31
36
  };
32
37
  const classKey = getComponentClasses(ICON_KEY_COMPONENT, IconSlots);
@@ -38,6 +43,7 @@ const Icon = (props) => {
38
43
  title: tooltipContent,
39
44
  ownerState: { ...ownerState },
40
45
  placement,
46
+ size: adjustedSize,
41
47
  ...getPropDataTestId(ICON_PREFIX, IconSlots.tooltip, instaceDataTestId),
42
48
  children: /* @__PURE__ */ jsx(
43
49
  RootStyled,
@@ -74,7 +80,7 @@ const Icon = (props) => {
74
80
  )
75
81
  }
76
82
  ),
77
- isSkeleton && /* @__PURE__ */ jsx(IconSkeletonStyled, { className: classKey.iconSkeleton, role: "icon-skeleton", variant: "rectangular", ownerState: { ...ownerState } })
83
+ isSkeleton && /* @__PURE__ */ jsx(IconSkeletonStyled, { className: classKey.iconSkeleton, role: "icon-skeleton", size: adjustedSize, variant: "rectangular", ownerState: { ...ownerState } })
78
84
  ] });
79
85
  };
80
86
  export {
@@ -14,7 +14,7 @@ const iconStyles = {
14
14
  alignItems: "center",
15
15
  width: "fit-content",
16
16
  transition: "transform 0.5s ease-in-out",
17
- ...ownerState.iconSize === "medium" && {
17
+ ...ownerState.size === "medium" && {
18
18
  ...theme.generalSettings.isMobile ? {
19
19
  width: theme.vars.size.mobile.medium.base,
20
20
  height: theme.vars.size.mobile.medium.base
@@ -23,7 +23,7 @@ const iconStyles = {
23
23
  height: theme.vars.size.desktop.medium.base
24
24
  }
25
25
  },
26
- ...ownerState.iconSize === "small" && {
26
+ ...ownerState.size === "small" && {
27
27
  ...theme.generalSettings.isMobile ? {
28
28
  width: theme.vars.size.mobile.small.base,
29
29
  height: theme.vars.size.mobile.small.base
@@ -40,22 +40,25 @@ const iconStyles = {
40
40
  * del ícono basada en el ángulo de rotación proporcionado, y el color de fondo que
41
41
  * se ajusta de acuerdo con el estado de deshabilitación o no del ícono.
42
42
  */
43
- icon: ({ theme, ownerState }) => ({
44
- maskPosition: "center",
45
- maskRepeat: "no-repeat",
46
- maskSize: "cover",
47
- WebkitMaskRepeat: "no-repeat",
48
- mask: `url(${ownerState.iconSrc})`,
49
- WebkitMask: `url(${ownerState.iconSrc})`,
50
- WebkitMaskSize: "cover",
51
- ...ownerState.iconRotationAngle && {
52
- transform: `rotate(${ownerState.iconRotationAngle}deg)`
53
- },
54
- backgroundColor: !ownerState.iconDisabled ? getPropertyByString(theme.vars.palette, String(ownerState.iconColor) || "text.primary") : theme.vars.palette.text.disabled,
55
- width: "inherit",
56
- height: "inherit",
57
- variants: []
58
- }),
43
+ icon: ({ theme, ownerState }) => {
44
+ const backgroundColor = ownerState.disabled ? theme.vars.palette.text.disabled : ownerState.selected && ownerState.enabledSelected ? `${theme.vars.palette.primary.selected} !important` : getPropertyByString(theme.vars.palette, String(ownerState.color), "text.primary");
45
+ return {
46
+ maskPosition: "center",
47
+ maskRepeat: "no-repeat",
48
+ maskSize: "cover",
49
+ WebkitMaskRepeat: "no-repeat",
50
+ mask: `url(${ownerState.src})`,
51
+ WebkitMask: `url(${ownerState.src})`,
52
+ WebkitMaskSize: "cover",
53
+ ...ownerState.rotationAngle && {
54
+ transform: `rotate(${ownerState.rotationAngle}deg)`
55
+ },
56
+ backgroundColor,
57
+ width: "inherit",
58
+ height: "inherit",
59
+ variants: []
60
+ };
61
+ },
59
62
  /**
60
63
  * Slot iconSkeleton: Define los estilos para el esqueleto del ícono.
61
64
  * Se utiliza cuando el ícono aún no está completamente cargado, proporcionando
@@ -65,7 +68,7 @@ const iconStyles = {
65
68
  iconSkeleton: ({ theme, ownerState }) => ({
66
69
  "&.M4lclassCssSpecificity": {
67
70
  borderRadius: theme.size.borderRadius.r1,
68
- ...ownerState.iconSize === "medium" && {
71
+ ...ownerState.size === "medium" && {
69
72
  ...theme.generalSettings.isMobile ? {
70
73
  width: theme.vars.size.mobile.medium.base,
71
74
  height: theme.vars.size.mobile.medium.base
@@ -74,7 +77,7 @@ const iconStyles = {
74
77
  height: theme.vars.size.desktop.medium.base
75
78
  }
76
79
  },
77
- ...ownerState.iconSize === "small" && {
80
+ ...ownerState.size === "small" && {
78
81
  ...theme.generalSettings.isMobile ? {
79
82
  width: theme.vars.size.mobile.small.base,
80
83
  height: theme.vars.size.mobile.small.base
@@ -43,16 +43,19 @@ export interface IconProps extends Pick<TooltipProps, 'placement'> {
43
43
  * Valor que en caso de ser verdadero debe de pintar el svg con color text disabled.
44
44
  */
45
45
  disabled?: boolean;
46
+ /**
47
+ * Valor que define si el icono debe de estar seleccionado pero depende de la propiedad enableSelected.
48
+ */
49
+ selected?: boolean;
50
+ /**
51
+ * Valor que define si el icono debe de estar seleccionado pero depende de la propiedad selected.
52
+ */
53
+ enabledSelected?: boolean;
46
54
  }
47
55
  /**
48
56
  * Define las las propiedades usadas para estilizar el componente desde el css.
49
57
  */
50
- export interface IconOwnerState {
51
- iconSize: Sizes;
52
- iconRotationAngle?: number;
53
- iconColor: IconColors;
54
- iconDisabled?: boolean;
55
- iconSrc: string;
58
+ export interface IconOwnerState extends Pick<IconProps, 'selected' | 'enabledSelected' | 'size' | 'rotationAngle' | 'color' | 'disabled' | 'src'> {
56
59
  isSkeleton: boolean;
57
60
  }
58
61
  export type IconSlotsType = keyof typeof IconSlots;
@@ -1,5 +1,5 @@
1
1
  import { g as getTypographyStyles } from "../../utils/getTypographyStyles.js";
2
- import { g as getHeightSizeStyles } from "../../utils/getSizeStyles/getSizeStyles.js";
2
+ import { a as getHeightSizeStyles } from "../../utils/getSizeStyles/getSizeStyles.js";
3
3
  const labelStyles = {
4
4
  /**
5
5
  * Estilos para el contenedor raíz del Label 🏷️
@@ -1,5 +1,5 @@
1
1
  import { g as getTypographyStyles } from "../../utils/getTypographyStyles.js";
2
- import { g as getHeightSizeStyles } from "../../utils/getSizeStyles/getSizeStyles.js";
2
+ import { a as getHeightSizeStyles } from "../../utils/getSizeStyles/getSizeStyles.js";
3
3
  const numberInputStyles = {
4
4
  /**
5
5
  * Estilos aplicados al contenedor principal (root).
@@ -1,4 +1,4 @@
1
- import { g as getHeightSizeStyles } from "../../utils/getSizeStyles/getSizeStyles.js";
1
+ import { a as getHeightSizeStyles } from "../../utils/getSizeStyles/getSizeStyles.js";
2
2
  const paperFormStyles = {
3
3
  /**
4
4
  *************************************************************
@@ -1,4 +1,4 @@
1
- import { g as getHeightSizeStyles } from "../../../../../../utils/getSizeStyles/getSizeStyles.js";
1
+ import { a as getHeightSizeStyles } from "../../../../../../utils/getSizeStyles/getSizeStyles.js";
2
2
  import { a as ITEM_IN_TREE_ACTIVE, I as ITEM_ACTIVE } from "../../../../constants.js";
3
3
  const containerMenuItemsMainStyles = {
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { g as getHeightSizeStyles } from "../../../../utils/getSizeStyles/getSizeStyles.js";
1
+ import { a as getHeightSizeStyles } from "../../../../utils/getSizeStyles/getSizeStyles.js";
2
2
  const areasAdminStyles = {
3
3
  /**
4
4
  * Root areas admin Styles
@@ -1,4 +1,4 @@
1
- import { g as getHeightSizeStyles } from "../../../../utils/getSizeStyles/getSizeStyles.js";
1
+ import { a as getHeightSizeStyles } from "../../../../utils/getSizeStyles/getSizeStyles.js";
2
2
  const propagateLoaderSpinnerStyles = {
3
3
  /**
4
4
  * Estilos del componente raíz del contenedor de la ventana.
@@ -1,4 +1,4 @@
1
- import { g as getHeightSizeStyles } from "../../../utils/getSizeStyles/getSizeStyles.js";
1
+ import { a as getHeightSizeStyles } from "../../../utils/getSizeStyles/getSizeStyles.js";
2
2
  const rhfTextFieldPasswordStyles = {
3
3
  /**
4
4
  * Elemento Root
@@ -1,4 +1,4 @@
1
- import { g as getHeightSizeStyles } from "../../../utils/getSizeStyles/getSizeStyles.js";
1
+ import { a as getHeightSizeStyles } from "../../../utils/getSizeStyles/getSizeStyles.js";
2
2
  const autocompleteSyles = {
3
3
  /**
4
4
  * Styles for the root component.
@@ -1,4 +1,4 @@
1
- import { g as getHeightSizeStyles } from "../../../utils/getSizeStyles/getSizeStyles.js";
1
+ import { a as getHeightSizeStyles } from "../../../utils/getSizeStyles/getSizeStyles.js";
2
2
  const checkBoxStyles = {
3
3
  /**
4
4
  * Estilos generales para el checkbox 🟦
@@ -1,5 +1,5 @@
1
1
  import { g as getTypographyStyles } from "../../../utils/getTypographyStyles.js";
2
- import { g as getHeightSizeStyles } from "../../../utils/getSizeStyles/getSizeStyles.js";
2
+ import { a as getHeightSizeStyles } from "../../../utils/getSizeStyles/getSizeStyles.js";
3
3
  const dateTimePickerStyles = {
4
4
  /**
5
5
  * Estilos para el root cuando esta en Desktop 💻
@@ -1,7 +1,8 @@
1
+ import { default as React } from 'react';
1
2
  import { IconButtonProps } from './types';
2
3
  /**
3
4
  *Los Icon button son habitualmente ubicados en barras de aplicaciones y barras de herramientas. Además, resulta adecuado emplear iconos en botones de alternancia que posibilitan la selección o deselección de una única opción, como añadir o eliminar una estrella a un elemento.
4
5
  * @param props
5
6
  * @returns
6
7
  */
7
- export declare const IconButton: import('react').ForwardRefExoticComponent<Omit<IconButtonProps, "ref"> & import('react').RefAttributes<HTMLButtonElement>>;
8
+ export declare const IconButton: React.ForwardRefExoticComponent<Omit<IconButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
@@ -1,7 +1,6 @@
1
1
  import { jsx, Fragment } from "react/jsx-runtime";
2
- import { forwardRef, useMemo } from "react";
3
- import { useModuleSkeleton, getPropertyByString } from "@m4l/core";
4
- import { useTheme } from "@mui/material";
2
+ import React, { forwardRef, useMemo, cloneElement } from "react";
3
+ import { useModuleSkeleton } from "@m4l/core";
5
4
  import { a as getComponentSlotRoot } from "../../../utils/getComponentSlotRoot.js";
6
5
  import { e as evalIconColor } from "./helpers/evalIconColor.js";
7
6
  import { I as ICON_BUTTON_KEY_COMPONENT } from "./constants.js";
@@ -31,33 +30,24 @@ const IconButton = forwardRef((props, ref) => {
31
30
  const classRoot = getComponentSlotRoot(ICON_BUTTON_KEY_COMPONENT);
32
31
  const { currentSize } = useComponentSize(size);
33
32
  const adjustedSize = currentSize === "small" || currentSize === "medium" ? currentSize : "medium";
34
- const theme = useTheme();
35
33
  const isSkeleton = useModuleSkeleton();
36
- const paletteColor = getPropertyByString(
37
- theme.vars.palette,
38
- disabled ? "default" : componentPaletteColor,
39
- theme.vars.palette.default
40
- );
41
- const OwnerState = {
34
+ const OwnerState = useMemo(() => ({
42
35
  variant,
43
36
  size: adjustedSize,
44
37
  disabled,
45
- paletteColor,
46
38
  componentPaletteColor,
47
39
  selected,
48
40
  isSkeleton
49
- };
41
+ }), [variant, adjustedSize, disabled, componentPaletteColor, selected, isSkeleton]);
50
42
  const iconColor = useMemo(
51
43
  () => evalIconColor(componentPaletteColor, variant),
52
44
  [componentPaletteColor, variant]
53
45
  );
54
- const renderIcon = (arg) => {
55
- if (!arg) {
56
- return arg;
46
+ const renderIcon = useMemo(() => (arg) => {
47
+ if (!arg || typeof arg === "boolean" || typeof arg === "number") {
48
+ return null;
57
49
  }
58
- if (typeof arg !== "string") {
59
- return arg;
60
- } else {
50
+ if (typeof arg === "string") {
61
51
  return /* @__PURE__ */ jsx(
62
52
  Icon,
63
53
  {
@@ -65,11 +55,19 @@ const IconButton = forwardRef((props, ref) => {
65
55
  size: adjustedSize,
66
56
  color: iconColor,
67
57
  disabled,
68
- rotationAngle
58
+ rotationAngle,
59
+ selected,
60
+ enabledSelected: true
69
61
  }
70
62
  );
71
63
  }
72
- };
64
+ if (React.isValidElement(arg)) {
65
+ return cloneElement(arg, {
66
+ selected: variant !== "contained" ? selected : false
67
+ });
68
+ }
69
+ return null;
70
+ }, [adjustedSize, disabled, iconColor, rotationAngle, selected, variant]);
73
71
  if (isSkeleton) {
74
72
  return /* @__PURE__ */ jsx(SkeletonStyled, { ownerState: { ...OwnerState } });
75
73
  }