@m4l/components 9.3.23 → 9.3.25-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 (57) hide show
  1. package/components/CommonActions/components/ActionFormCancel/ActionFormCancel.js +10 -7
  2. package/components/CommonActions/components/ActionFormCancel/types.d.ts +8 -0
  3. package/components/DataGrid/formatters/ColumnIconFormatter/index.d.ts +1 -0
  4. package/components/DataGrid/index.d.ts +1 -1
  5. package/components/DataGrid/types.d.ts +2 -0
  6. package/components/DynamicFilter/helpers/formatToInitialFilters.js +3 -3
  7. package/components/DynamicFilter/subcomponents/FieldTypes/BooleanFilter/helpers.js +11 -3
  8. package/components/DynamicFilter/subcomponents/FieldTypes/DateTimeFilter/helpers.js +16 -4
  9. package/components/DynamicFilter/subcomponents/FieldTypes/NumberFilter/helpers.js +11 -8
  10. package/components/DynamicFilter/subcomponents/FieldTypes/SelectAsyncFilter/helpers.js +21 -8
  11. package/components/DynamicFilter/subcomponents/FieldTypes/SelectFilter/helpers.js +18 -8
  12. package/components/DynamicFilter/subcomponents/FieldTypes/StringFilter/helpers.js +5 -3
  13. package/components/Label/Label.js +1 -1
  14. package/components/PaperForm/PaperForm.js +1 -1
  15. package/components/PaperForm/components/Header.js +9 -7
  16. package/components/PaperForm/styles.js +9 -4
  17. package/components/PaperForm/types.d.ts +3 -2
  18. package/components/Stepper/Stepper.styles.js +1 -0
  19. package/components/Stepper/dictionary.js +0 -1
  20. package/components/Stepper/subcomponents/StepArea/hooks/useStepArea.d.ts +13 -0
  21. package/components/Stepper/subcomponents/StepArea/hooks/useStepArea.js +111 -0
  22. package/components/Stepper/subcomponents/StepArea/hooks/useVisibileSteps.d.ts +8 -0
  23. package/components/Stepper/subcomponents/StepArea/hooks/useVisibileSteps.js +79 -0
  24. package/components/Stepper/subcomponents/StepArea/index.js +7 -115
  25. package/components/Stepper/subcomponents/StepperButtons/StepperCancelButton/index.d.ts +2 -2
  26. package/components/Stepper/subcomponents/StepperButtons/StepperCancelButton/index.js +3 -53
  27. package/components/Stepper/subcomponents/StepperButtons/StepperNextButton/index.js +3 -2
  28. package/components/Stepper/subcomponents/StepperButtons/StepperPrevButton/index.js +3 -2
  29. package/components/Stepper/subcomponents/StepperButtons/StepperSubmitButton/index.js +24 -5
  30. package/components/Stepper/subcomponents/StepperContent/subcomponents/Step/hooks/useIsStepVisible.d.ts +8 -0
  31. package/components/Stepper/subcomponents/StepperContent/subcomponents/Step/hooks/useIsStepVisible.js +93 -0
  32. package/components/Stepper/subcomponents/StepperContent/subcomponents/Step/index.js +2 -51
  33. package/components/Stepper/types.d.ts +4 -0
  34. package/components/ToastContainer/ToastContainer.js +1 -0
  35. package/components/ToastContainer/constants.d.ts +1 -1
  36. package/components/ToastContainer/constants.js +1 -1
  37. package/components/WindowBase/contexts/WindowToolsMFContext/WindowToolsMFContext.js +47 -3
  38. package/components/WindowBase/contexts/WindowToolsMFContext/types.d.ts +1 -1
  39. package/components/WindowBase/subcomponents/Component/index.d.ts +12 -1
  40. package/components/WindowBase/subcomponents/Component/index.js +56 -2
  41. package/components/WindowBase/subcomponents/Component/types.d.ts +1 -0
  42. package/components/WindowBase/types.d.ts +1 -1
  43. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/Window.js +1 -0
  44. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useWindow.js +1 -1
  45. package/components/areas/contexts/AreasContext/store.js +7 -3
  46. package/components/areas/contexts/AreasContext/types.d.ts +1 -1
  47. package/components/hook-form/RHFormContext/index.d.ts +1 -1
  48. package/components/mui_extended/CircularProgress/types.d.ts +1 -1
  49. package/components/popups/components/PopupsProvider/contexts/PopupsContext/store.js +5 -1
  50. package/components/popups/components/PopupsProvider/contexts/PopupsContext/types.d.ts +1 -1
  51. package/components/popups/components/PopupsProvider/hooks/usePopups.d.ts +2 -4
  52. package/components/popups/components/PopupsProvider/hooks/usePopups.js +19 -7
  53. package/components/popups/components/PopupsViewer/PopupsViewer.js +1 -1
  54. package/components/popups/components/PopupsViewer/PopupsViewer.styles.js +1 -1
  55. package/components/popups/components/PopupsViewer/subcomponents/Popup/Popup.js +32 -21
  56. package/index.js +60 -58
  57. package/package.json +1 -1
@@ -10,17 +10,18 @@ import { D as DICTIONARY } from "../../dictionary.js";
10
10
  import { W as WindowConfirm } from "../../../WindowConfirm/WindowConfirm.js";
11
11
  import { B as ButtonRootStyled } from "./slots/ActionFormCancelSlots.js";
12
12
  function ActionFormCancel(props) {
13
- const { className } = props;
13
+ const { className, onClose, linkToCloseWindow } = props;
14
14
  const { getLabel } = useModuleDictionary();
15
15
  const { openModal } = useModal();
16
- const { close: closeWindow, setFnQueryClose: setQueryClose } = useWindowToolsMF();
16
+ const { close, setFnQueryClose } = useWindowToolsMF();
17
17
  const { control } = useFormContext();
18
18
  const { isDirty } = useFormState({
19
19
  control
20
20
  });
21
21
  const onConfirmQuit = useCallback(() => {
22
- closeWindow();
23
- }, []);
22
+ close(false);
23
+ onClose?.();
24
+ }, [close, onClose]);
24
25
  const onClickCancel = useCallback(() => {
25
26
  if (isDirty) {
26
27
  openModal({
@@ -38,10 +39,12 @@ function ActionFormCancel(props) {
38
39
  } else {
39
40
  onConfirmQuit();
40
41
  }
41
- }, [getLabel, isDirty, openModal]);
42
+ }, [isDirty, openModal, getLabel, onConfirmQuit]);
42
43
  useEffect(() => {
43
- setQueryClose(onClickCancel);
44
- }, []);
44
+ if (linkToCloseWindow) {
45
+ setFnQueryClose(onClickCancel);
46
+ }
47
+ }, [onClickCancel, setFnQueryClose, linkToCloseWindow]);
45
48
  return /* @__PURE__ */ jsx(
46
49
  ButtonRootStyled,
47
50
  {
@@ -10,6 +10,14 @@ export interface ActionFormCancelProps extends ButtonProps {
10
10
  size?: Extract<Sizes, 'small' | 'medium'>;
11
11
  dictionaryId?: string;
12
12
  className?: string;
13
+ /**
14
+ * Cuando efectivamente se cierrar la ventana se ejecuta esta función.
15
+ */
16
+ onClose?: () => void;
17
+ /**
18
+ * Vicular la funcion de cierre de consulta con la funcion de cierre de la ventana.
19
+ */
20
+ linkToCloseWindow: boolean;
13
21
  }
14
22
  export interface ActionFormCancelOwnerState {
15
23
  size?: Extract<Sizes, 'small' | 'medium'>;
@@ -1,2 +1,3 @@
1
1
  export { ColumnIconFormatter } from './formatter';
2
2
  export type { ColumnIconFormatterProps } from './types';
3
+ export { useColumnIcon } from './useColumnIcon';
@@ -1,7 +1,7 @@
1
1
  export { DataGrid } from './DataGrid';
2
2
  export * from './formatters';
3
3
  export type { Column, RenderEditCellProps, RenderCellProps } from 'react-data-grid';
4
- export type { RowKey, ChangeUserColumn } from './types';
4
+ export type { RowKey, ChangeUserColumn, RowActionsGetter, RowKeyGetter } from './types';
5
5
  export { getDataGridComponentsDictionary } from './dictionary';
6
6
  export { TextEditor, NumberEditor } from './subcomponents/editors/TextEditor';
7
7
  export { getDataGridRowsFromSet } from './utils/getDataGridRowsFromSet';
@@ -112,6 +112,8 @@ export interface FilterSettings {
112
112
  filtersApplied: FilterApplied[];
113
113
  onChange: (event: FilterChangeEvent) => void;
114
114
  }
115
+ export type RowActionsGetter<TRow> = (row: TRow) => MenuAction[];
116
+ export type RowKeyGetter<TRow, TKey extends RowKey = RowKey> = (row: TRow) => TKey;
115
117
  /**--------------------Termina tipado de filtros-------------------------------------------- */
116
118
  export interface GridProps<TRow, TSummaryRow, TKey extends RowKey = RowKey> extends Omit<NativeDataGridProps<TRow, TSummaryRow>, 'rowKeyGetter' | 'rows' | 'columns' | 'onRowsChange' | 'selectedRows' | 'onSelectedRowsChange' | 'renderers'> {
117
119
  id: string;
@@ -30,9 +30,9 @@ function formatToInitialFilters(appliedFilters) {
30
30
  return {
31
31
  name: af.field.name,
32
32
  operator: af.operator,
33
- ...operand1 ? { operand1 } : {},
34
- ...operand2 ? { operand2 } : {},
35
- ...operandArray ? { operandArray } : {}
33
+ ...operand1 !== void 0 ? { operand1 } : {},
34
+ ...operand2 !== void 0 ? { operand2 } : {},
35
+ ...operandArray !== void 0 ? { operandArray } : {}
36
36
  };
37
37
  });
38
38
  }
@@ -11,12 +11,16 @@ class BooleanFilterHelpers {
11
11
  */
12
12
  getDefaultFilter(field, fixed) {
13
13
  const defaultOperand1 = field.defaultOperand1;
14
+ let isSet = false;
15
+ if (defaultOperand1 !== void 0 && typeof defaultOperand1 === "boolean") {
16
+ isSet = true;
17
+ }
14
18
  const defaultFilter = {
15
19
  id: 0,
16
20
  fieldType: "boolean",
17
21
  field,
18
22
  fixed,
19
- isSet: true,
23
+ isSet,
20
24
  operator: "e",
21
25
  operand1: true
22
26
  };
@@ -45,7 +49,9 @@ class BooleanFilterHelpers {
45
49
  const operator = filterValueBoolean ? filterValueBoolean.operator : field.defaultOperator ?? "e";
46
50
  const formValueOperand1 = filterValueBoolean ? {
47
51
  value: filterValueBoolean.operand1,
48
- label: getLabel(`${DYNAMIC_FILTER_DICTIONARY_ID}.operand_${filterValueBoolean.operand1}`)
52
+ label: getLabel(
53
+ `${DYNAMIC_FILTER_DICTIONARY_ID}.operand_${filterValueBoolean.operand1}`
54
+ )
49
55
  } : null;
50
56
  return {
51
57
  fieldType: "boolean",
@@ -63,7 +69,9 @@ class BooleanFilterHelpers {
63
69
  const labelOperands = filter.operand1 ? getLabel(DICCTIONARY.operand_true) : getLabel(DICCTIONARY.operand_false);
64
70
  return {
65
71
  labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
66
- labelOperator: getLabel(`${DYNAMIC_FILTER_DICTIONARY_ID}.operator_${filter.operator}`),
72
+ labelOperator: getLabel(
73
+ `${DYNAMIC_FILTER_DICTIONARY_ID}.operator_${filter.operator}`
74
+ ),
67
75
  labelOperands
68
76
  };
69
77
  }
@@ -18,12 +18,16 @@ class DateTimeFilterHelpers {
18
18
  defaultEndDate.setHours(23, 59, 59, 999);
19
19
  const defaultOperand1 = field.defaultOperand1 && field.defaultOperand1 instanceof Date ? field.defaultOperand1 : defaultStartDate;
20
20
  const defaultOperand2 = field.defaultOperand2 && field.defaultOperand2 instanceof Date ? field.defaultOperand2 : defaultEndDate;
21
+ let isSet = false;
22
+ if (defaultOperand1 !== void 0) {
23
+ isSet = true;
24
+ }
21
25
  return {
22
26
  id: 0,
23
27
  fieldType: "datetime",
24
28
  field,
25
29
  fixed,
26
- isSet: true,
30
+ isSet,
27
31
  operator: "b",
28
32
  operand1: defaultOperand1,
29
33
  operand2: defaultOperand2
@@ -83,13 +87,21 @@ class DateTimeFilterHelpers {
83
87
  labelOperands = filter.operand1 && filter.operand2 ? `${dateFormatter.formatDate(
84
88
  filter.operand1,
85
89
  dateFormatter.datetimeFormat
86
- )} - ${dateFormatter.formatDate(filter.operand2, dateFormatter.datetimeFormat)}` : "";
90
+ )} - ${dateFormatter.formatDate(
91
+ filter.operand2,
92
+ dateFormatter.datetimeFormat
93
+ )}` : "";
87
94
  } else {
88
- labelOperands = filter.operand1 ? dateFormatter.formatDate(filter.operand1, dateFormatter.datetimeFormat) : "";
95
+ labelOperands = filter.operand1 ? dateFormatter.formatDate(
96
+ filter.operand1,
97
+ dateFormatter.datetimeFormat
98
+ ) : "";
89
99
  }
90
100
  return {
91
101
  labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
92
- labelOperator: getLabel(`${DYNAMIC_FILTER_DICTIONARY_ID}.operator_${filter.operator}`),
102
+ labelOperator: getLabel(
103
+ `${DYNAMIC_FILTER_DICTIONARY_ID}.operator_${filter.operator}`
104
+ ),
93
105
  labelOperands
94
106
  };
95
107
  }
@@ -15,12 +15,10 @@ class NumberFilterHelpers {
15
15
  const defaultOperand1 = field.defaultOperand1 ?? null;
16
16
  const defaultOperand2 = field.defaultOperand2 ?? null;
17
17
  let isSet = false;
18
- if (fixed) {
19
- if (["b"].includes(dOperator)) {
20
- isSet = defaultOperand1 !== null && defaultOperand2 !== null ? true : false;
21
- } else {
22
- isSet = defaultOperand1 !== null ? true : false;
23
- }
18
+ if (["b"].includes(dOperator)) {
19
+ isSet = defaultOperand1 !== null && defaultOperand2 !== null ? true : false;
20
+ } else {
21
+ isSet = defaultOperand1 !== null ? true : false;
24
22
  }
25
23
  return {
26
24
  id: 0,
@@ -85,7 +83,9 @@ class NumberFilterHelpers {
85
83
  }
86
84
  return {
87
85
  labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
88
- labelOperator: getLabel(`${DYNAMIC_FILTER_DICTIONARY_ID}.operator_${filter.operator}`),
86
+ labelOperator: getLabel(
87
+ `${DYNAMIC_FILTER_DICTIONARY_ID}.operator_${filter.operator}`
88
+ ),
89
89
  labelOperands
90
90
  };
91
91
  }
@@ -100,7 +100,10 @@ class NumberFilterHelpers {
100
100
  ),
101
101
  formValueOperand2: Yup.mixed().when(["formValueOperator.id"], {
102
102
  is: "b",
103
- then: Yup.number().typeError(getLabel(DICCTIONARY.error_operand_mustbe_number)).min(Yup.ref("formValueOperand1"), getLabel(DICCTIONARY.error_less_than_start))
103
+ then: Yup.number().typeError(getLabel(DICCTIONARY.error_operand_mustbe_number)).min(
104
+ Yup.ref("formValueOperand1"),
105
+ getLabel(DICCTIONARY.error_less_than_start)
106
+ )
104
107
  })
105
108
  });
106
109
  }
@@ -27,13 +27,16 @@ class SelectAsyncFilterHelpers {
27
27
  let operandsArray = [];
28
28
  if (isMultiple) {
29
29
  dOperator = field.defaultOperator ?? "in";
30
- isSet = fixed ? defaultOperandsArray !== null && defaultOperandsArray.length > 0 ? true : false : false;
30
+ isSet = defaultOperandsArray !== null && defaultOperandsArray.length > 0;
31
31
  if (field.defaultOperandsArray !== void 0 && Array.isArray(field.defaultOperandsArray)) {
32
- operandsArray = filterValidOperandsArraySelectAsync(field.defaultOperandsArray, field);
32
+ operandsArray = filterValidOperandsArraySelectAsync(
33
+ field.defaultOperandsArray,
34
+ field
35
+ );
33
36
  }
34
37
  } else {
35
38
  dOperator = field.defaultOperator ?? "e";
36
- isSet = fixed ? defaultOperand1 ? true : false : false;
39
+ isSet = defaultOperand1 ? true : false;
37
40
  }
38
41
  const defaultCommonFilter = {
39
42
  id: 0,
@@ -122,15 +125,21 @@ class SelectAsyncFilterHelpers {
122
125
  let labelOperands = "";
123
126
  if (isMultiple) {
124
127
  labelOperands = operandsArray?.reduce?.((label, operand) => {
125
- const textLabel = field.selectAsyncOptions?.getOptionLabel?.(operand) || "";
128
+ const textLabel = field.selectAsyncOptions?.getOptionLabel?.(
129
+ operand
130
+ ) || "";
126
131
  return label ? `${label} | ${textLabel}` : textLabel;
127
132
  }, "")?.toString() || "?";
128
133
  } else {
129
- labelOperands = (field.selectAsyncOptions?.getOptionLabel?.(filter.operand1) ?? "?") + "";
134
+ labelOperands = (field.selectAsyncOptions?.getOptionLabel?.(
135
+ filter.operand1
136
+ ) ?? "?") + "";
130
137
  }
131
138
  return {
132
139
  labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
133
- labelOperator: getLabel(`${DYNAMIC_FILTER_DICTIONARY_ID}.operator_${filter.operator}`),
140
+ labelOperator: getLabel(
141
+ `${DYNAMIC_FILTER_DICTIONARY_ID}.operator_${filter.operator}`
142
+ ),
134
143
  labelOperands
135
144
  };
136
145
  }
@@ -163,7 +172,9 @@ class SelectAsyncFilterHelpers {
163
172
  return false;
164
173
  }
165
174
  if (isMultiple) {
166
- if (SELECT_ASYNC_OPERATORS_MULTIPLE.findIndex((f) => f === filter.operator) === -1) {
175
+ if (SELECT_ASYNC_OPERATORS_MULTIPLE.findIndex(
176
+ (f) => f === filter.operator
177
+ ) === -1) {
167
178
  return false;
168
179
  }
169
180
  if (!filter.operandsArray || typeof filter.operandsArray !== "object") {
@@ -180,7 +191,9 @@ class SelectAsyncFilterHelpers {
180
191
  return false;
181
192
  }
182
193
  } else {
183
- if (SELECT_ASYNC_OPERATORS_SINGLE.findIndex((f) => f === filter.operator) === -1) {
194
+ if (SELECT_ASYNC_OPERATORS_SINGLE.findIndex(
195
+ (f) => f === filter.operator
196
+ ) === -1) {
184
197
  return false;
185
198
  }
186
199
  if (!filter.operand1 || typeof filter.operand1 !== "object") {
@@ -26,13 +26,15 @@ class SelectFilterHelpers {
26
26
  let operandsArray = [];
27
27
  if (isMultiple) {
28
28
  dOperator = field.defaultOperator ?? "in";
29
- isSet = fixed ? defaultOperandsArray !== null && defaultOperandsArray.length > 0 ? true : false : false;
29
+ isSet = defaultOperandsArray !== null && defaultOperandsArray.length > 0;
30
30
  if (field.defaultOperandsArray !== void 0 && Array.isArray(field.defaultOperandsArray)) {
31
- operandsArray = filterValidOperandsArraySelect(field.defaultOperandsArray);
31
+ operandsArray = filterValidOperandsArraySelect(
32
+ field.defaultOperandsArray
33
+ );
32
34
  }
33
35
  } else {
34
36
  dOperator = field.defaultOperator ?? "e";
35
- isSet = fixed ? defaultOperand1 !== null ? true : false : false;
37
+ isSet = defaultOperand1 !== null;
36
38
  }
37
39
  const defaultCommonFilter = {
38
40
  id: 0,
@@ -123,7 +125,9 @@ class SelectFilterHelpers {
123
125
  let labelOperands = "";
124
126
  if (isMultiple) {
125
127
  labelOperands = operandsArray?.reduce?.((label, operand) => {
126
- const textLabel = field.selectOptions?.options.find((option) => option.id === operand)?.label || "";
128
+ const textLabel = field.selectOptions?.options.find(
129
+ (option) => option.id === operand
130
+ )?.label || "";
127
131
  return label ? `${label} | ${textLabel}` : textLabel;
128
132
  }, "")?.toString() || "?";
129
133
  } else {
@@ -131,7 +135,9 @@ class SelectFilterHelpers {
131
135
  }
132
136
  return {
133
137
  labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
134
- labelOperator: getLabel(`${DYNAMIC_FILTER_DICTIONARY_ID}.operator_${filter.operator}`),
138
+ labelOperator: getLabel(
139
+ `${DYNAMIC_FILTER_DICTIONARY_ID}.operator_${filter.operator}`
140
+ ),
135
141
  labelOperands
136
142
  };
137
143
  }
@@ -147,9 +153,13 @@ class SelectFilterHelpers {
147
153
  }),
148
154
  formValueOperand1: Yup.mixed().when(["multiple"], {
149
155
  is: false,
150
- then: Yup.mixed().test("is-string-or-number", getLabel(DICCTIONARY.error_operand_required), (value) => {
151
- return typeof value === "string" || typeof value === "number";
152
- }).required(getLabel(DICCTIONARY.error_operand_required))
156
+ then: Yup.mixed().test(
157
+ "is-string-or-number",
158
+ getLabel(DICCTIONARY.error_operand_required),
159
+ (value) => {
160
+ return typeof value === "string" || typeof value === "number";
161
+ }
162
+ ).required(getLabel(DICCTIONARY.error_operand_required))
153
163
  })
154
164
  });
155
165
  }
@@ -12,8 +12,8 @@ class StringFilterHelpers {
12
12
  getDefaultFilter(field, fixed) {
13
13
  const defaultOperand1 = field.defaultOperand1;
14
14
  let isSet = false;
15
- if (fixed) {
16
- isSet = defaultOperand1 !== null ? true : false;
15
+ if (defaultOperand1 !== null && typeof defaultOperand1 === "string") {
16
+ isSet = true;
17
17
  }
18
18
  const defaultFilter = {
19
19
  id: 0,
@@ -64,7 +64,9 @@ class StringFilterHelpers {
64
64
  const labelOperands = filter.operand1 !== void 0 ? filter.operand1 + "" : "";
65
65
  return {
66
66
  labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
67
- labelOperator: getLabel(`${DYNAMIC_FILTER_DICTIONARY_ID}.operator_${filter.operator}`),
67
+ labelOperator: getLabel(
68
+ `${DYNAMIC_FILTER_DICTIONARY_ID}.operator_${filter.operator}`
69
+ ),
68
70
  labelOperands
69
71
  };
70
72
  }
@@ -9,7 +9,7 @@ const Label = (props) => {
9
9
  const { host_static_assets, environment_assets } = useEnvironment();
10
10
  const isSkeleton = useModuleSkeleton();
11
11
  const { currentSize } = useComponentSize(size);
12
- const hasHelperIcon = typeof helperMessage === "string" ? true : false;
12
+ const hasHelperIcon = typeof helperMessage === "string" && helperMessage.length > 0 ? true : false;
13
13
  const adjustedSize = currentSize === "small" || currentSize === "medium" ? currentSize : "medium";
14
14
  const ownerState = {
15
15
  disabled,
@@ -45,7 +45,7 @@ function PaperForm(props) {
45
45
  ownerState: { ...ownerState },
46
46
  ...process.env.NODE_ENV !== "production" ? { "data-testid": dataTestId } : {},
47
47
  children: [
48
- variant !== "text" && /* @__PURE__ */ jsx(Header, { urlIcon, title, color, size }),
48
+ variant !== "onlyContainer" && /* @__PURE__ */ jsx(Header, { urlIcon, title, color, size, variant }),
49
49
  /* @__PURE__ */ jsx(ContentStyled, { ownerState: { ...ownerState }, children: renderChildren(children) })
50
50
  ]
51
51
  }
@@ -1,17 +1,19 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { H as HeaderStyled, I as IconStyled, T as TitleStyled } from "../slots/PaperFormSlots.js";
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import { I as IconStyled, T as TitleStyled, H as HeaderStyled } from "../slots/PaperFormSlots.js";
3
+ import { useMemo } from "react";
3
4
  const Header = (props) => {
4
- const { urlIcon, title, size, dataTestId, color } = props;
5
+ const { urlIcon, title, size, dataTestId, color, variant } = props;
5
6
  const ownerState = {
6
- color
7
+ color,
8
+ variant
7
9
  };
8
- const renderContentHeader = () => {
10
+ const contentHeader = useMemo(() => {
9
11
  return /* @__PURE__ */ jsxs(Fragment, { children: [
10
12
  urlIcon ? /* @__PURE__ */ jsx(IconStyled, { src: urlIcon, size }) : null,
11
13
  /* @__PURE__ */ jsx(TitleStyled, { variant: "bodyDens", size, children: title })
12
14
  ] });
13
- };
14
- return /* @__PURE__ */ jsx(HeaderStyled, { role: "heading", ownerState, ...process.env.NODE_ENV !== "production" ? { "data-testid": dataTestId } : {}, children: renderContentHeader() });
15
+ }, [urlIcon, title, size]);
16
+ return /* @__PURE__ */ jsx(HeaderStyled, { role: "heading", ownerState, ...process.env.NODE_ENV !== "production" ? { "data-testid": dataTestId } : {}, children: contentHeader });
15
17
  };
16
18
  export {
17
19
  Header as H
@@ -8,11 +8,14 @@ const paperFormStyles = {
8
8
  */
9
9
  paperFormRoot: ({ theme, ownerState }) => ({
10
10
  background: theme.vars.palette.background.default,
11
- ...ownerState?.paperFormVariant !== "text" && {
11
+ ...ownerState?.paperFormVariant === "standard" && {
12
12
  borderRadius: theme.size.borderRadius.r1,
13
13
  border: `${theme.size.borderStroke.container}`,
14
14
  borderColor: theme.vars.palette.border.default
15
15
  },
16
+ // ...(ownerState?.paperFormVariant === 'text' && {
17
+ // borderRadius: theme.size.borderRadius.r1,
18
+ // }),
16
19
  width: "100%",
17
20
  overflow: "auto",
18
21
  ...ownerState?.height === "full" && {
@@ -41,8 +44,10 @@ const paperFormStyles = {
41
44
  gap: theme.vars.size.baseSpacings.sp1,
42
45
  overflow: "hidden",
43
46
  padding: `${theme.vars.size.baseSpacings.sp1} ${theme.vars.size.baseSpacings.sp2}`,
44
- borderRadius: `${theme.vars.size.borderRadius.r1} ${theme.vars.size.borderRadius.r1} 0 0`,
45
- background: theme.vars.palette[ownerState?.color ?? "default"].hoverOpacity,
47
+ ...ownerState?.paperFormVariant === "standard" && {
48
+ borderRadius: `${theme.vars.size.borderRadius.r1} ${theme.vars.size.borderRadius.r1} 0 0`,
49
+ background: theme.vars.palette[ownerState?.color ?? "default"].hoverOpacity
50
+ },
46
51
  alignSelf: "stretch",
47
52
  ...getSizeStyles(
48
53
  theme,
@@ -90,7 +95,7 @@ const paperFormStyles = {
90
95
  justifyContent: ownerState?.isForm ? "flex-start" : "center",
91
96
  gap: ownerState?.isForm ? theme.vars.size.baseSpacings.sp3 : theme.vars.size.baseSpacings.sp0,
92
97
  flexWrap: ownerState?.isForm ? "wrap" : "nowrap",
93
- padding: ownerState?.paperFormVariant === "text" ? "0px" : theme.vars.size.baseSpacings.sp3,
98
+ padding: ownerState?.paperFormVariant === "onlyContainer" ? "0px" : theme.vars.size.baseSpacings.sp3,
94
99
  background: theme.vars.palette.background.default,
95
100
  flex: 1,
96
101
  overflow: "auto"
@@ -9,11 +9,12 @@ export interface PaperFormProps {
9
9
  urlIcon?: string;
10
10
  title: string;
11
11
  children?: ReactNode | PropertyValueProps[];
12
- variant?: 'standard' | 'text';
12
+ variant?: 'standard' | 'text' | 'onlyContainer';
13
13
  color?: Extract<ComponentPalletColor, 'default'>;
14
14
  size?: Extract<Sizes, 'small' | 'medium'>;
15
15
  isForm?: boolean;
16
16
  dataTestId?: string;
17
+ border?: boolean;
17
18
  height?: 'auto' | 'full';
18
19
  }
19
20
  /**
@@ -25,7 +26,7 @@ export interface PaperFormProps {
25
26
  interface CommonsProps {
26
27
  paperFormVariant?: PaperFormProps['variant'];
27
28
  }
28
- export type HeaderProps = Omit<PaperFormProps, 'children' | 'isForm' | 'variant'> & CommonsProps;
29
+ export type HeaderProps = Omit<PaperFormProps, 'children' | 'isForm'> & CommonsProps;
29
30
  export type PaperFormOwnerState = Pick<PaperFormProps, 'isForm' | 'color' | 'size' | 'height'> & CommonsProps;
30
31
  /**
31
32
  * ***********************************
@@ -56,6 +56,7 @@ const stepperStyles = {
56
56
  display: "flex",
57
57
  flexDirection: "column",
58
58
  gap: theme.vars.size.baseSpacings.sp6,
59
+ overflowY: "auto",
59
60
  ...ownerState?.orientation === "vertical" || theme.generalSettings.isMobile ? {
60
61
  borderTop: "1px solid",
61
62
  paddingTop: theme.vars.size.baseSpacings.sp8
@@ -5,7 +5,6 @@ function getStepperComponentsDictionary() {
5
5
  const DICTIONARY = {
6
6
  LABEL_PREV_BUTTON: `${STEPPER_DICTIONARY_ID}.label_prev_button`,
7
7
  LABEL_NEXT_BUTTON: `${STEPPER_DICTIONARY_ID}.label_next_button`,
8
- LABEL_CANCEL_BUTTON: `${STEPPER_DICTIONARY_ID}.label_cancel_button`,
9
8
  LABEL_SUBMIT_BUTTON: `${STEPPER_DICTIONARY_ID}.label_submit_button`
10
9
  };
11
10
  export {
@@ -0,0 +1,13 @@
1
+ import { Step } from '../../../types';
2
+ /**
3
+ * useStepArea hook is responsible for managing the step area of the stepper
4
+ */
5
+ export declare function useStepArea(props: {
6
+ visibleSteps: Step[];
7
+ }): {
8
+ visibleTitle: boolean | undefined;
9
+ orientation: import('../../../types').Orientation | undefined;
10
+ handleStepClick: (targetIndex: number) => Promise<void>;
11
+ steps: Step[];
12
+ currentStep: number;
13
+ };
@@ -0,0 +1,111 @@
1
+ import { useCallback, useMemo } from "react";
2
+ import { useFormContext } from "react-hook-form";
3
+ import { u as useStepper } from "../../../hooks/useStepper/index.js";
4
+ import { u as useDynamicValidation } from "../../../hooks/useDynamicValidation/index.js";
5
+ import { d as deepShallow } from "../../../../../utils/deepShallow.js";
6
+ function useStepArea(props) {
7
+ const { visibleSteps } = props;
8
+ const { trigger, clearErrors } = useFormContext();
9
+ const {
10
+ activateFieldsValidation,
11
+ startExternalValidation,
12
+ endExternalValidation
13
+ } = useDynamicValidation();
14
+ const {
15
+ currentStep,
16
+ steps,
17
+ visibleTitle,
18
+ setCurrentStep,
19
+ orientation,
20
+ setStepValidationStatus,
21
+ stepValidationStatus
22
+ } = useStepper(
23
+ (state) => ({
24
+ currentStep: state.currentStep,
25
+ steps: state.steps,
26
+ visibleTitle: state.visibleTitle,
27
+ setCurrentStep: state.actions.setCurrentStep,
28
+ indicatorType: state.indicatorType,
29
+ orientation: state.orientation,
30
+ setStepValidationStatus: state.actions.setStepValidationStatus,
31
+ stepValidationStatus: state.stepValidationStatus
32
+ }),
33
+ deepShallow
34
+ );
35
+ const handleStepClick = useCallback(async (targetIndex) => {
36
+ const currentIndex = visibleSteps.findIndex(
37
+ (step) => step.key === steps[currentStep].key
38
+ );
39
+ if (targetIndex === currentIndex) {
40
+ return;
41
+ }
42
+ const isNavigatingForward = targetIndex > currentIndex;
43
+ const targetOriginalIndex = steps.findIndex(
44
+ (s) => s.key === visibleSteps[targetIndex].key
45
+ );
46
+ if (!isNavigatingForward) {
47
+ setCurrentStep(targetOriginalIndex);
48
+ return;
49
+ }
50
+ const isSkippingSteps = targetIndex > currentIndex + 1;
51
+ if (isSkippingSteps) {
52
+ for (let i = currentIndex; i < targetIndex; i++) {
53
+ const step = visibleSteps[i];
54
+ const stepOriginalIndex = steps.findIndex((s) => s.key === step.key);
55
+ startExternalValidation();
56
+ const isValid = await trigger(step.validationFields);
57
+ endExternalValidation();
58
+ if (!isValid) {
59
+ setCurrentStep(stepOriginalIndex);
60
+ setStepValidationStatus(stepOriginalIndex, false);
61
+ activateFieldsValidation(step.validationFields || []);
62
+ return;
63
+ }
64
+ setStepValidationStatus(stepOriginalIndex, true);
65
+ }
66
+ } else {
67
+ const currentStepData = visibleSteps[currentIndex];
68
+ const currentStepOriginalIndex = steps.findIndex(
69
+ (s) => s.key === currentStepData.key
70
+ );
71
+ startExternalValidation();
72
+ const isCurrentValid = await trigger(currentStepData.validationFields);
73
+ endExternalValidation();
74
+ if (!isCurrentValid) {
75
+ setStepValidationStatus(currentStepOriginalIndex, false);
76
+ activateFieldsValidation(currentStepData.validationFields || []);
77
+ return;
78
+ }
79
+ setStepValidationStatus(currentStepOriginalIndex, true);
80
+ }
81
+ setCurrentStep(targetOriginalIndex);
82
+ if (isNavigatingForward) {
83
+ const currentStepData = visibleSteps[currentIndex];
84
+ const currentStepOriginalIndex = steps.findIndex(
85
+ (s) => s.key === currentStepData.key
86
+ );
87
+ const isCurrentStepValid = stepValidationStatus[currentStepOriginalIndex] !== false;
88
+ if (isCurrentStepValid) {
89
+ const targetStep = visibleSteps[targetIndex];
90
+ const targetStepFields = targetStep.validationFields || [];
91
+ if (targetStepFields.length > 0) {
92
+ clearErrors(targetStepFields);
93
+ setTimeout(() => {
94
+ clearErrors(targetStepFields);
95
+ setStepValidationStatus(targetOriginalIndex, true);
96
+ }, 100);
97
+ }
98
+ }
99
+ }
100
+ }, [visibleSteps, steps, setCurrentStep, currentStep, startExternalValidation, trigger, endExternalValidation, setStepValidationStatus, activateFieldsValidation, stepValidationStatus, clearErrors]);
101
+ return useMemo(() => ({
102
+ visibleTitle,
103
+ orientation,
104
+ handleStepClick,
105
+ steps,
106
+ currentStep
107
+ }), [visibleTitle, orientation, handleStepClick, steps, currentStep]);
108
+ }
109
+ export {
110
+ useStepArea as u
111
+ };
@@ -0,0 +1,8 @@
1
+ import { Step as StepType } from '../../../types';
2
+ /**
3
+ * useVisibileSteps hook is responsible for calculating the visible steps based on the form values and the visibility data
4
+ * Optimizado con useSyncExternalStore para evitar re-renders innecesarios
5
+ */
6
+ export declare function useVisibileSteps(): {
7
+ visibleSteps: StepType[];
8
+ };