@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
@@ -1,181 +1,6 @@
1
- import { GetLabelType } from '@m4l/core';
2
1
  import { WritableDraft } from 'immer/dist/internal';
3
- import { SortField, SortFieldApplied, SortToEditApply, InitialSortApplied, OwnerState } from '../types';
2
+ import { DynamicSortStateWithActions, InitialStoreProps } from './type';
4
3
  export type OpenFor = 'add' | 'edit';
5
- export interface PopoverSortDataBase {
6
- /**
7
- * "openFor" motivo de apertura del popup
8
- */
9
- openFor: OpenFor;
10
- /**
11
- * "fnAnchorEl" Anchor para ubicar el popup y se pone como función debido a que Immer no soporta un draft de Element
12
- */
13
- fnAnchorEl: () => Element;
14
- }
15
- export interface PopoverSortDataAdd extends PopoverSortDataBase {
16
- openFor: 'add';
17
- /**
18
- * "field" Campo por el cual se va a filtrar
19
- */
20
- field: SortField;
21
- }
22
- export interface PopoverSortDataEdit extends PopoverSortDataBase {
23
- openFor: 'edit';
24
- /**
25
- * "filter" sort que se va a editar
26
- */
27
- sort: SortFieldApplied;
28
- }
29
- /**
30
- *
31
- * Tipo usado para cuado se va agregar o modificar un sort
32
- */
33
- export type PopoverSortData = PopoverSortDataAdd | PopoverSortDataEdit;
34
- /**
35
- * Estados que se actulizan por fuera del store, a través de hooks
36
- */
37
- export type ExternalOwnerState = Pick<OwnerState, 'isMobile' | 'isSkeleton'>;
38
- /**
39
- * Interface que define el estado del componente
40
- */
41
- export interface DynamicSortState {
42
- /**
43
- * "fields" Campos por los que se puede filtrar
44
- */
45
- fields: Array<SortField>;
46
- /**
47
- * "ownerState" estado a nivel de clases del componente
48
- */
49
- ownerState: OwnerState;
50
- /**
51
- * "automatic" Configura si el sort se ejecuta automaticamente cuando se agrega o se modifica un sort
52
- */
53
- automatic: boolean;
54
- /**
55
- * Funcion que retorna el elemento (InputSort) desde donde se desprende el listado de campos
56
- * Si no está definida, el menú de campos no se muestra
57
- * @returns
58
- */
59
- fnAnchorEl?: () => Element;
60
- /**
61
- * "inputData" texto en el InputSort
62
- */
63
- inputData: string;
64
- /**
65
- * Campos disponibles para filtrar
66
- */
67
- availableFields: Array<SortField>;
68
- /**
69
- * "applyedFilters" sorts aplicados actualmente
70
- */
71
- appliedSorts: Array<SortFieldApplied>;
72
- /**
73
- * "countOnChangeSortsApplyed" Cantidad de veces que el sort se ha aplicado, sirve para suscribirse y aplicar el sort.
74
- * Esto se debe hacer porque no se puede lanzar un handler que modifica valores, durante una renderización.
75
- */
76
- countOnChangeSortsApplyed: number;
77
- /** popoverFilterData: para emerger el popuup de modificación campos */
78
- popoverSortData?: PopoverSortData;
79
- getLabel: GetLabelType;
80
- /**
81
- * dataTestId:
82
- * Esta propiedad sirve para generar identificadores únicos.
83
- */
84
- dataTestId: string;
85
- }
86
- export interface DynamicSortStateWithActions extends DynamicSortState {
87
- actions: {
88
- /**
89
- * inicializa el estado del componente con los sorts que provienen desde afuera
90
- * @param initialSortApplyed sorts iniciales
91
- */
92
- init: (initialSortApplyed: Array<InitialSortApplied>) => void;
93
- /**
94
- * Objetiene el Campo dado el nombre
95
- * @param name
96
- * @returns Field o undefined si no se encuentra
97
- */
98
- getFieldByName: (name: string) => SortField;
99
- /**
100
- * remueve un sort si existe, y dispara el trigger de onChangeSorts
101
- * @param id //identificador unico de un sort
102
- */
103
- removeSort: (id: number) => void;
104
- /**
105
- *
106
- * @param anchorEl Elemento de donde va emerger el popup
107
- * @param field Campo por el cual se va filtrar
108
- * @returns
109
- */
110
- showPopoverSortForAdd: (anchorEl: Element, field: SortField) => void;
111
- /**
112
- * Muestra la ventan de edición de un sort aplicado
113
- * @param anchorEl Anchor de elemento desde donde debe emerger
114
- * @param sortToEdit sort a editar
115
- * @returns
116
- */
117
- showPopoverSortForEdit: (anchorEl: Element, sortToEdit: SortFieldApplied) => void;
118
- /**
119
- * Oculta la ventana de edición
120
- * @param stayInEditon determina si continua en edicióin
121
- */
122
- hidePopoverSort: (stayInEditon: boolean) => void;
123
- /**
124
- * Limpia todos los sorts aplicados menos los fixed
125
- */
126
- clearSorts: VoidFunction;
127
- /**
128
- * llama al fireOnChangeSorts proporcionado en los props del componente
129
- */
130
- fireOnChangeSorts: VoidFunction;
131
- /**
132
- * Función encargada de encontrar un Id par un nuevo sort
133
- * @returns Id de sort
134
- */
135
- getNewId: () => number;
136
- /**
137
- * Agrega un sort setedo y correcto a los sorts aplicados (applyedFilters)
138
- * @param newSort Sort a agregar
139
- * @returns
140
- */
141
- addSort: (newSort: SortFieldApplied) => void;
142
- /**
143
- * Modifica un sort que se encuentra en applyedFilters
144
- * @param sortToEdit sort a editar
145
- * @returns
146
- */
147
- updateSort: (sortToEdit: SortToEditApply) => void;
148
- /**
149
- * Modifica el texto que se visuliza en el InputSort
150
- * @param text texto en el input
151
- * @returns
152
- */
153
- setInputData: (inputData: string) => void;
154
- /**
155
- * Modifica el estado de edición del componente
156
- * @param newInEdition Estado de edición
157
- * @returns
158
- */
159
- setInEdition: (newInEdition: boolean) => void;
160
- /**
161
- * Modifica los estados que se actualizan externamente al Store
162
- * @param newIsMobile
163
- * @returns
164
- */
165
- setExternalState: (newExternalState: ExternalOwnerState) => void;
166
- /**
167
- * Establece la función de apertura del menuu de campos
168
- * @param anchorEl
169
- * @returns
170
- */
171
- openPopoverMenuFields: (anchorEl: Element) => void;
172
- /**
173
- * Limpia la función de apertura del menu de campos (por el valor anchorEl = undefined)
174
- */
175
- closePopoverMenuFields: (newInEdition?: boolean) => void;
176
- };
177
- }
178
- type InitialStoreProps = Pick<DynamicSortState, 'automatic' | 'fields' | 'getLabel' | 'ownerState' | 'dataTestId'>;
179
4
  /**
180
5
  * Crea el store de zustand para el componente DynamicSort
181
6
  * @param initProps Variables iniciales que necesita store para poder inicializarlo
@@ -191,4 +16,3 @@ export declare const createAreaStore: (initProps: InitialStoreProps) => Omit<Omi
191
16
  } | undefined): void;
192
17
  };
193
18
  export type DynamicSortStore = ReturnType<typeof createAreaStore>;
194
- export {};
@@ -66,7 +66,7 @@ const createAreaStore = (initProps) => {
66
66
  });
67
67
  },
68
68
  /**
69
- * TODO: Documentar
69
+ * Funcion para obtener un Field a través del nombre
70
70
  */
71
71
  getFieldByName: (name) => {
72
72
  const field = get().fields.find((f) => {
@@ -215,6 +215,15 @@ const createAreaStore = (initProps) => {
215
215
  state.fnAnchorEl = void 0;
216
216
  state.ownerState.inEdition = newInEdition || false;
217
217
  });
218
+ },
219
+ /**
220
+ * actualiza el tamaño del componente
221
+ */
222
+ setSize: (newSize) => {
223
+ set((state) => {
224
+ state.size = newSize;
225
+ state.ownerState.size = newSize;
226
+ });
218
227
  }
219
228
  }
220
229
  })),
@@ -0,0 +1,186 @@
1
+ import { GetLabelType } from '@m4l/core';
2
+ import { Sizes } from '@m4l/styles';
3
+ import { SortField, SortFieldApplied, SortToEditApply, InitialSortApplied, OwnerState } from '../types';
4
+ export type OpenFor = 'add' | 'edit';
5
+ export interface PopoverSortDataBase {
6
+ /**
7
+ * "openFor" motivo de apertura del popup
8
+ */
9
+ openFor: OpenFor;
10
+ /**
11
+ * "fnAnchorEl" Anchor para ubicar el popup y se pone como función debido a que Immer no soporta un draft de Element
12
+ */
13
+ fnAnchorEl: () => Element;
14
+ }
15
+ export interface PopoverSortDataAdd extends PopoverSortDataBase {
16
+ openFor: 'add';
17
+ /**
18
+ * "field" Campo por el cual se va a filtrar
19
+ */
20
+ field: SortField;
21
+ }
22
+ export interface PopoverSortDataEdit extends PopoverSortDataBase {
23
+ openFor: 'edit';
24
+ /**
25
+ * "filter" sort que se va a editar
26
+ */
27
+ sort: SortFieldApplied;
28
+ }
29
+ /**
30
+ *
31
+ * Tipo usado para cuado se va agregar o modificar un sort
32
+ */
33
+ export type PopoverSortData = PopoverSortDataAdd | PopoverSortDataEdit;
34
+ /**
35
+ * Estados que se actulizan por fuera del store, a través de hooks
36
+ */
37
+ export type ExternalOwnerState = Pick<OwnerState, 'isMobile' | 'isSkeleton'>;
38
+ /**
39
+ * Interface que define el estado del componente
40
+ */
41
+ export interface DynamicSortState {
42
+ /**
43
+ * "fields" Campos por los que se puede filtrar
44
+ */
45
+ fields: Array<SortField>;
46
+ /**
47
+ * "ownerState" estado a nivel de clases del componente
48
+ */
49
+ ownerState: OwnerState;
50
+ /**
51
+ * "automatic" Configura si el sort se ejecuta automaticamente cuando se agrega o se modifica un sort
52
+ */
53
+ automatic: boolean;
54
+ /**
55
+ * Funcion que retorna el elemento (InputSort) desde donde se desprende el listado de campos
56
+ * Si no está definida, el menú de campos no se muestra
57
+ * @returns
58
+ */
59
+ fnAnchorEl?: () => Element;
60
+ /**
61
+ * "inputData" texto en el InputSort
62
+ */
63
+ inputData: string;
64
+ /**
65
+ * Campos disponibles para filtrar
66
+ */
67
+ availableFields: Array<SortField>;
68
+ /**
69
+ * "applyedFilters" sorts aplicados actualmente
70
+ */
71
+ appliedSorts: Array<SortFieldApplied>;
72
+ /**
73
+ * "countOnChangeSortsApplyed" Cantidad de veces que el sort se ha aplicado, sirve para suscribirse y aplicar el sort.
74
+ * Esto se debe hacer porque no se puede lanzar un handler que modifica valores, durante una renderización.
75
+ */
76
+ countOnChangeSortsApplyed: number;
77
+ /** popoverFilterData: para emerger el popuup de modificación campos */
78
+ popoverSortData?: PopoverSortData;
79
+ getLabel: GetLabelType;
80
+ /**
81
+ * dataTestId:
82
+ * Esta propiedad sirve para generar identificadores únicos.
83
+ */
84
+ dataTestId: string;
85
+ /**
86
+ * size: tamaño del componente
87
+ */
88
+ size: Extract<Sizes, 'small' | 'medium'>;
89
+ }
90
+ export interface DynamicSortStateWithActions extends DynamicSortState {
91
+ actions: {
92
+ /**
93
+ * inicializa el estado del componente con los sorts que provienen desde afuera
94
+ * @param initialSortApplyed sorts iniciales
95
+ */
96
+ init: (initialSortApplyed: Array<InitialSortApplied>) => void;
97
+ /**
98
+ * Objetiene el Campo dado el nombre
99
+ * @param name
100
+ * @returns Field o undefined si no se encuentra
101
+ */
102
+ getFieldByName: (name: string) => SortField;
103
+ /**
104
+ * remueve un sort si existe, y dispara el trigger de onChangeSorts
105
+ * @param id //identificador unico de un sort
106
+ */
107
+ removeSort: (id: number) => void;
108
+ /**
109
+ *
110
+ * @param anchorEl Elemento de donde va emerger el popup
111
+ * @param field Campo por el cual se va filtrar
112
+ * @returns
113
+ */
114
+ showPopoverSortForAdd: (anchorEl: Element, field: SortField) => void;
115
+ /**
116
+ * Muestra la ventan de edición de un sort aplicado
117
+ * @param anchorEl Anchor de elemento desde donde debe emerger
118
+ * @param sortToEdit sort a editar
119
+ * @returns
120
+ */
121
+ showPopoverSortForEdit: (anchorEl: Element, sortToEdit: SortFieldApplied) => void;
122
+ /**
123
+ * Oculta la ventana de edición
124
+ * @param stayInEditon determina si continua en edicióin
125
+ */
126
+ hidePopoverSort: (stayInEditon: boolean) => void;
127
+ /**
128
+ * Limpia todos los sorts aplicados menos los fixed
129
+ */
130
+ clearSorts: VoidFunction;
131
+ /**
132
+ * llama al fireOnChangeSorts proporcionado en los props del componente
133
+ */
134
+ fireOnChangeSorts: VoidFunction;
135
+ /**
136
+ * Función encargada de encontrar un Id par un nuevo sort
137
+ * @returns Id de sort
138
+ */
139
+ getNewId: () => number;
140
+ /**
141
+ * Agrega un sort setedo y correcto a los sorts aplicados (applyedFilters)
142
+ * @param newSort Sort a agregar
143
+ * @returns
144
+ */
145
+ addSort: (newSort: SortFieldApplied) => void;
146
+ /**
147
+ * Modifica un sort que se encuentra en applyedFilters
148
+ * @param sortToEdit sort a editar
149
+ * @returns
150
+ */
151
+ updateSort: (sortToEdit: SortToEditApply) => void;
152
+ /**
153
+ * Modifica el texto que se visuliza en el InputSort
154
+ * @param text texto en el input
155
+ * @returns
156
+ */
157
+ setInputData: (inputData: string) => void;
158
+ /**
159
+ * Modifica el estado de edición del componente
160
+ * @param newInEdition Estado de edición
161
+ * @returns
162
+ */
163
+ setInEdition: (newInEdition: boolean) => void;
164
+ /**
165
+ * Modifica los estados que se actualizan externamente al Store
166
+ * @param newIsMobile
167
+ * @returns
168
+ */
169
+ setExternalState: (newExternalState: ExternalOwnerState) => void;
170
+ /**
171
+ * Establece la función de apertura del menuu de campos
172
+ * @param anchorEl
173
+ * @returns
174
+ */
175
+ openPopoverMenuFields: (anchorEl: Element) => void;
176
+ /**
177
+ * Limpia la función de apertura del menu de campos (por el valor anchorEl = undefined)
178
+ */
179
+ closePopoverMenuFields: (newInEdition?: boolean) => void;
180
+ /**
181
+ * actualiza el tamaño del componente
182
+ */
183
+ setSize: (size: Extract<Sizes, 'small' | 'medium'>) => void;
184
+ };
185
+ }
186
+ export type InitialStoreProps = Pick<DynamicSortState, 'automatic' | 'fields' | 'getLabel' | 'ownerState' | 'dataTestId' | 'size'>;
@@ -1,5 +1,5 @@
1
- import { DynamicSortStateWithActions } from './DynamicSortStore';
1
+ import { DynamicSortStateWithActions } from './type';
2
2
  /**
3
- * TODO: Documentar
3
+ * Hook que permite acceder al store de DynamicSort
4
4
  */
5
5
  export declare function useDynamicSortStore<T>(selector: (state: DynamicSortStateWithActions) => T, equalityFn?: (left: T, right: T) => boolean): T;
@@ -1,6 +1,6 @@
1
1
  import { SortFieldApplied } from '../../types';
2
2
  /**
3
- * TODO: Documentar
3
+ * AppliedSortChip es un componente que muestra un chip con el campo y el tipo de ordenamiento aplicado.
4
4
  */
5
5
  declare function AppliedSortChip(props: SortFieldApplied): import("react/jsx-runtime").JSX.Element;
6
6
  export default AppliedSortChip;
@@ -1,26 +1,24 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { u as useDynamicSortBase } from "../DynamicSortBase/useDynamicSortBase.js";
2
3
  import { u as useAppliedSortChip } from "./useAppliedSortChip.js";
3
- import { A as AppliedSortChipStyled, a as AppliedSortChipIconStyled, b as AppliedSortChipInfoStyled, c as AppliedSortChipInfoFieldNameStyled, d as AppliedSortChipInfoOperatorStyled, e as AppliedSortChipRemoveButtonStyled } from "../../slots/DynamicSortSlots.js";
4
+ import { A as AppliedSortChipStyled } from "../../slots/DynamicSortSlots.js";
4
5
  function AppliedSortChip(props) {
5
6
  const { fixed } = props;
6
- const { onEditSort, onDelete, iconFieldUrl, removeIconUrl, labels } = useAppliedSortChip(props);
7
- return /* @__PURE__ */ jsxs(AppliedSortChipStyled, { ownerState: {}, children: [
8
- iconFieldUrl && /* @__PURE__ */ jsx(AppliedSortChipIconStyled, { onClick: onEditSort, src: iconFieldUrl, ownerState: {} }),
9
- /* @__PURE__ */ jsxs(AppliedSortChipInfoStyled, { onClick: onEditSort, ownerState: {}, children: [
10
- /* @__PURE__ */ jsx(AppliedSortChipInfoFieldNameStyled, { ownerState: {}, children: labels.labelField }),
11
- /* @__PURE__ */ jsx(AppliedSortChipInfoOperatorStyled, { ownerState: {}, children: labels.labelOperator })
12
- ] }),
13
- !fixed && /* @__PURE__ */ jsx(
14
- AppliedSortChipRemoveButtonStyled,
15
- {
16
- src: removeIconUrl,
17
- size: "small",
18
- dictionaryTooltipId: "dynamic_sort.tooltip_clear_sort",
19
- onClick: onDelete,
20
- ownerState: {}
21
- }
22
- )
23
- ] });
7
+ const { onEditSort, onDelete, iconFieldUrl, labels, iconSort } = useAppliedSortChip(props);
8
+ const { size } = useDynamicSortBase();
9
+ return /* @__PURE__ */ jsx(
10
+ AppliedSortChipStyled,
11
+ {
12
+ variant: "containedOpacity",
13
+ ownerState: {},
14
+ onClick: onEditSort,
15
+ startIcon: iconFieldUrl,
16
+ label: labels.labelField,
17
+ endIcon: iconSort,
18
+ size,
19
+ onDeleted: fixed ? void 0 : onDelete
20
+ }
21
+ );
24
22
  }
25
23
  export {
26
24
  AppliedSortChip as A
@@ -1,13 +1,13 @@
1
1
  import { MouseEvent } from 'react';
2
2
  import { SortFieldApplied } from '../../types';
3
3
  /**
4
- * TODO: Documentar
4
+ * Hook que permite obtener los datos necesarios para mostrar un chip de sort aplicado
5
5
  */
6
6
  declare function useAppliedSortChip(sort: SortFieldApplied): {
7
7
  onDelete: () => void;
8
8
  onEditSort: (event: MouseEvent<HTMLButtonElement>) => void;
9
- removeIconUrl: string;
10
9
  iconFieldUrl: string;
11
10
  labels: import('../../types').DataTypeFilerLabels;
11
+ iconSort: string;
12
12
  };
13
13
  export default useAppliedSortChip;
@@ -2,8 +2,8 @@ import { useMemo } from "react";
2
2
  import { useEnvironment, useModuleDictionary } from "@m4l/core";
3
3
  import { useFormatter } from "@m4l/graphics";
4
4
  import { u as useDynamicSortStore } from "../../store/useDynamicSortStore.js";
5
+ import { a as ascending, d as descending } from "../../icons.js";
5
6
  import { f as fieldFactory } from "../FieldTypes/fieldFactory.js";
6
- import { A as ASSETS_URL, a as ASSETS } from "../../constants.js";
7
7
  function useAppliedSortChip(sort) {
8
8
  const { host_static_assets, environment_assets } = useEnvironment();
9
9
  const { getLabel } = useModuleDictionary();
@@ -11,7 +11,7 @@ function useAppliedSortChip(sort) {
11
11
  const { hidePopoverSort, removeSort, showPopoverSortForEdit } = useDynamicSortStore(
12
12
  (state) => state.actions
13
13
  );
14
- const removeIconUrl = `${host_static_assets}/${environment_assets}/${ASSETS_URL}/${ASSETS.close}`;
14
+ const iconSort = sort.operator === "asc" ? `${host_static_assets}/${environment_assets}/${ascending}` : `${host_static_assets}/${environment_assets}/${descending}`;
15
15
  const labels = useMemo(() => {
16
16
  return fieldFactory(sort.field.type).getLabels(sort, getLabel, formatters, sort.field);
17
17
  }, [sort, getLabel]);
@@ -27,9 +27,9 @@ function useAppliedSortChip(sort) {
27
27
  return {
28
28
  onDelete,
29
29
  onEditSort,
30
- removeIconUrl,
31
30
  iconFieldUrl: sort.field?.urlIcon,
32
- labels
31
+ labels,
32
+ iconSort
33
33
  };
34
34
  }
35
35
  export {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * TODO: Documentar
2
+ * AppliedSorts component es un componente que muestra los chips de los sorts aplicados
3
3
  * @author Diego Betancur - automatic
4
4
  * @createdAt 2025-02-10 11:27:50 - automatic
5
5
  * @updatedAt 2025-02-10 11:27:50 - automatic
@@ -1,14 +1,26 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { S as ScrollBar } from "../../../ScrollBar/ScrollBar.js";
3
+ import { u as useDynamicSortBase } from "../DynamicSortBase/useDynamicSortBase.js";
4
+ import { g as getPropDataTestId } from "../../../../test/getNameDataTestId.js";
5
+ import { D as DYNAMIC_SORT_KEY_COMPONENT } from "../../constants.js";
6
+ import { D as DynamicSortSlots } from "../../slots/SlotsEnum.js";
3
7
  import { u as useAppliedSorts } from "./useAppliedSorts.js";
4
- import { f as AppliedSortsStyled, g as AppliedSortInnerContainerStyled } from "../../slots/DynamicSortSlots.js";
8
+ import { a as AppliedSortsStyled, b as AppliedSortInnerContainerStyled } from "../../slots/DynamicSortSlots.js";
5
9
  import { A as AppliedSortChip } from "../AppliedSortChip/AppliedSortChip.js";
6
10
  function AppliedSorts() {
7
11
  const { appliedSortsSorted, isSkeleton } = useAppliedSorts();
12
+ const { dataTestId, ownerState } = useDynamicSortBase();
8
13
  if (isSkeleton) {
9
14
  return /* @__PURE__ */ jsx(AppliedSortsStyled, { ownerState: {} });
10
15
  }
11
- return /* @__PURE__ */ jsx(AppliedSortsStyled, { ownerState: {}, children: /* @__PURE__ */ jsx(ScrollBar, { children: /* @__PURE__ */ jsx(AppliedSortInnerContainerStyled, { ownerState: {}, children: appliedSortsSorted?.map((sort) => /* @__PURE__ */ jsx(AppliedSortChip, { ...sort }, sort.id)) }) }) });
16
+ return /* @__PURE__ */ jsx(
17
+ AppliedSortsStyled,
18
+ {
19
+ ...getPropDataTestId(DYNAMIC_SORT_KEY_COMPONENT, DynamicSortSlots.appliedSorts, dataTestId),
20
+ ownerState: { ...ownerState },
21
+ children: /* @__PURE__ */ jsx(ScrollBar, { autoHide: true, children: /* @__PURE__ */ jsx(AppliedSortInnerContainerStyled, { ownerState: {}, children: appliedSortsSorted?.map((sort) => /* @__PURE__ */ jsx(AppliedSortChip, { ...sort }, sort.id)) }) })
22
+ }
23
+ );
12
24
  }
13
25
  export {
14
26
  AppliedSorts as A
@@ -1,5 +1,5 @@
1
1
  /**
2
- * TODO: Documentar
2
+ * Hook que permite obtener los datos necesarios para mostrar los sorts aplicados
3
3
  */
4
4
  declare function useAppliedSorts(): {
5
5
  appliedSortsSorted: import('../..').SortFieldApply[];
@@ -1,5 +1,5 @@
1
1
  /**
2
- * TODO: Documentar
2
+ * DynamicSortBase es un componente base que contiene los subcomponentes InputSort, AppliedSorts, SortActions y PopoverSort.
3
3
  */
4
4
  declare function DynamicSortBase(): import("react/jsx-runtime").JSX.Element;
5
5
  export default DynamicSortBase;
@@ -1,6 +1,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { u as useDynamicSortBase } from "./useDynamicSortBase.js";
3
2
  import { g as getPropDataTestId } from "../../../../test/getNameDataTestId.js";
3
+ import { D as DYNAMIC_SORT_KEY_COMPONENT } from "../../constants.js";
4
+ import { u as useDynamicSortBase } from "./useDynamicSortBase.js";
4
5
  import { R as RootStyled, I as InnerContainerStyled } from "../../slots/DynamicSortSlots.js";
5
6
  import { D as DynamicSortSlots } from "../../slots/SlotsEnum.js";
6
7
  import { I as InputSort } from "../InputSort/InputSort.js";
@@ -13,12 +14,12 @@ function DynamicSortBase() {
13
14
  RootStyled,
14
15
  {
15
16
  ownerState: { ...ownerState },
16
- ...getPropDataTestId(dataTestId, DynamicSortSlots.root),
17
+ ...getPropDataTestId(DYNAMIC_SORT_KEY_COMPONENT, DynamicSortSlots.root, dataTestId),
17
18
  children: /* @__PURE__ */ jsxs(
18
19
  InnerContainerStyled,
19
20
  {
20
21
  ownerState: { ...ownerState },
21
- ...getPropDataTestId(dataTestId, DynamicSortSlots.innerContainer),
22
+ ...getPropDataTestId(DYNAMIC_SORT_KEY_COMPONENT, DynamicSortSlots.innerContainer, dataTestId),
22
23
  children: [
23
24
  /* @__PURE__ */ jsx(InputSort, {}),
24
25
  /* @__PURE__ */ jsx(AppliedSorts, {}),
@@ -1,7 +1,8 @@
1
1
  /**
2
- * TODO: Documentar
2
+ * Hook que permite obtener los datos necesarios para mostrar los sorts aplicados
3
3
  */
4
4
  export default function useDynamicSortBase(): {
5
5
  ownerState: import('../../types').OwnerState;
6
6
  dataTestId: string;
7
+ size: "small" | "medium";
7
8
  };
@@ -2,7 +2,8 @@ import { u as useDynamicSortStore } from "../../store/useDynamicSortStore.js";
2
2
  function useDynamicSortBase() {
3
3
  const ownerState = useDynamicSortStore((state) => state.ownerState);
4
4
  const dataTestId = useDynamicSortStore((state) => state.dataTestId);
5
- return { ownerState, dataTestId };
5
+ const size = useDynamicSortStore((state) => state.size);
6
+ return { ownerState, dataTestId, size };
6
7
  }
7
8
  export {
8
9
  useDynamicSortBase as u
@@ -1,7 +1,7 @@
1
1
  import { FormSortFieldApplied } from '../../types';
2
2
  import { FormStatusLoad } from '../../../../contexts';
3
3
  /**
4
- * TODO: Documentar
4
+ * Componente que renderiza el tipo de dato seleccionado
5
5
  */
6
6
  declare function DataTypeComponent(props: {
7
7
  formSort: FormSortFieldApplied;
@@ -4,32 +4,32 @@ import { IFieldType, YupSchema } from '../FieldTypeInterface';
4
4
  import { DataTypeFilerLabels, SortField, SortFieldApplied, SortValue, FormSortValueString, InitialSortApplied } from '../../../types';
5
5
  import { StringSort } from './index';
6
6
  /**
7
- * TODO: Documentar
7
+ * Clase que implementa los métodos necesarios para el tipo de campo string
8
8
  */
9
9
  export declare class StringSortHelpers implements IFieldType<FormSortValueString> {
10
10
  getComponent(): typeof StringSort;
11
11
  /**
12
- * TODO: Documentar
12
+ * getDefaulSort obtiene el valor por defecto de un campo de tipo string
13
13
  */
14
14
  getDefaultSort(field: SortField, fixed: boolean): SortFieldApplied;
15
15
  /**
16
- * TODO: Documentar
16
+ * getSortFromFormValue obtiene el valor de un campo de tipo string
17
17
  */
18
18
  getSortFromFormValue(formSortValue: FormSortValueString): SortValue;
19
19
  /**
20
- * TODO: Documentar
20
+ * getFormValue obtiene el valor de un campo de tipo string
21
21
  */
22
- getFormValue(field: SortField, getLabel: GetLabelType, sortValue?: SortValue): FormSortValueString;
22
+ getFormValue(field: SortField, _getLabel: GetLabelType, sortValue?: SortValue): FormSortValueString;
23
23
  /**
24
- * TODO: Documentar
24
+ * getLabels obtiene las etiquetas de un campo de tipo string
25
25
  */
26
26
  getLabels(Sort: SortFieldApplied, getLabel: GetLabelType, _formatters: Formatters, _field: SortField): DataTypeFilerLabels;
27
27
  /**
28
- * TODO: Documentar
28
+ * getSchema obtiene el esquema de un campo de tipo string
29
29
  */
30
30
  getSchema(getLabel: GetLabelType): YupSchema;
31
31
  /**
32
- * TODO: Documentar
32
+ * verifySort verifica si un campo de tipo string es válido
33
33
  */
34
34
  verifySort(Sort: InitialSortApplied, _field?: SortField): boolean;
35
35
  }