@m4l/components 9.67.2 → 9.68.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.
@@ -7,6 +7,9 @@ export declare function useStepArea(props: {
7
7
  }): {
8
8
  visibleTitle: boolean | undefined;
9
9
  orientation: import('../../../types').Orientation | undefined;
10
+ indicatorType: import('../../../types').IndicatorType | undefined;
11
+ size: import('@m4l/styles').Sizes | undefined;
12
+ stepValidationStatus: Record<number, boolean>;
10
13
  handleStepClick: (targetIndex: number) => Promise<void>;
11
14
  steps: Step[];
12
15
  currentStep: number;
@@ -1 +1 @@
1
- {"version":3,"file":"useStepArea.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/components/src/components/Stepper/subcomponents/StepArea/hooks/useStepArea.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,IAAI,EAAG,MAAM,gBAAgB,CAAC;AAEvC;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE;IAAE,YAAY,EAAE,IAAI,EAAE,CAAA;CAAE;;;mCAuCA,MAAM;;;EA6HhE"}
1
+ {"version":3,"file":"useStepArea.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/components/src/components/Stepper/subcomponents/StepArea/hooks/useStepArea.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,IAAI,EAAG,MAAM,gBAAgB,CAAC;AAEvC;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE;IAAE,YAAY,EAAE,IAAI,EAAE,CAAA;CAAE;;;;;;mCA0CA,MAAM;;;EA8HhE"}
@@ -1,90 +1,95 @@
1
- import { useCallback as w, useMemo as E } from "react";
2
- import { useFormContext as O } from "react-hook-form";
3
- import { useStepper as h } from "../../../hooks/useStepper/index.js";
4
- import { useDynamicValidation as D } from "../../../hooks/useDynamicValidation/index.js";
1
+ import { useCallback as z, useMemo as D } from "react";
2
+ import { useFormContext as A } from "react-hook-form";
3
+ import { useStepper as M } from "../../../hooks/useStepper/index.js";
4
+ import { useDynamicValidation as N } from "../../../hooks/useDynamicValidation/index.js";
5
5
  import { focusFirstErrorField as b } from "../../../helpers/focusFirstErrorField/index.js";
6
- import { deepShallow as A } from "../../../../../utils/deepShallow.js";
7
- function H(I) {
8
- const { visibleSteps: r } = I, { trigger: u, clearErrors: S, setFocus: f, getFieldState: m } = O(), {
9
- activateFieldsValidation: F,
10
- startExternalValidation: k,
11
- endExternalValidation: y
12
- } = D(), {
13
- currentStep: p,
6
+ import { deepShallow as j } from "../../../../../utils/deepShallow.js";
7
+ function Q(I) {
8
+ const { visibleSteps: r } = I, { trigger: c, clearErrors: u, setFocus: S, getFieldState: f } = A(), {
9
+ activateFieldsValidation: m,
10
+ startExternalValidation: y,
11
+ endExternalValidation: F
12
+ } = N(), {
13
+ currentStep: l,
14
14
  steps: n,
15
15
  visibleTitle: v,
16
- setCurrentStep: c,
17
- orientation: g,
16
+ setCurrentStep: d,
17
+ indicatorType: g,
18
+ size: x,
19
+ orientation: C,
18
20
  setStepValidationStatus: s,
19
- stepValidationStatus: x
20
- } = h(
21
+ stepValidationStatus: p
22
+ } = M(
21
23
  (t) => ({
22
24
  currentStep: t.currentStep,
23
25
  steps: t.steps,
24
26
  visibleTitle: t.visibleTitle,
25
27
  setCurrentStep: t.actions.setCurrentStep,
26
28
  indicatorType: t.indicatorType,
29
+ size: t.size,
27
30
  orientation: t.orientation,
28
31
  setStepValidationStatus: t.actions.setStepValidationStatus,
29
32
  stepValidationStatus: t.stepValidationStatus
30
33
  }),
31
- A
32
- ), C = w(async (t) => {
34
+ j
35
+ ), T = z(async (t) => {
33
36
  const a = r.findIndex(
34
- (e) => e.key === n[p].key
37
+ (i) => i.key === n[l].key
35
38
  );
36
39
  if (t === a)
37
40
  return;
38
- const T = t > a, V = n.findIndex(
39
- (e) => e.key === r[t].key
41
+ const w = t > a, k = n.findIndex(
42
+ (i) => i.key === r[t].key
40
43
  );
41
- if (!T) {
42
- c(V);
44
+ if (!w) {
45
+ d(k);
43
46
  return;
44
47
  }
45
48
  if (t > a + 1)
46
- for (let e = a; e < t; e++) {
47
- const i = r[e], o = n.findIndex((d) => d.key === i.key);
48
- k();
49
- const l = await u(i.validationFields);
50
- if (y(), !l) {
51
- c(o), s(o, !1), F(i.validationFields || []), b(i.validationFields || [], m, f);
49
+ for (let i = a; i < t; i++) {
50
+ const e = r[i], o = n.findIndex((h) => h.key === e.key);
51
+ y();
52
+ const V = await c(e.validationFields);
53
+ if (F(), !V) {
54
+ d(o), s(o, !1), m(e.validationFields || []), b(e.validationFields || [], f, S);
52
55
  return;
53
56
  }
54
57
  s(o, !0);
55
58
  }
56
59
  else {
57
- const e = r[a], i = n.findIndex(
58
- (l) => l.key === e.key
60
+ const i = r[a], e = n.findIndex(
61
+ (V) => V.key === i.key
59
62
  );
60
- k();
61
- const o = await u(e.validationFields);
62
- if (y(), !o) {
63
- s(i, !1), F(e.validationFields || []), b(e.validationFields || [], m, f);
63
+ y();
64
+ const o = await c(i.validationFields);
65
+ if (F(), !o) {
66
+ s(e, !1), m(i.validationFields || []), b(i.validationFields || [], f, S);
64
67
  return;
65
68
  }
66
- s(i, !0);
69
+ s(e, !0);
67
70
  }
68
- if (c(V), T) {
69
- const e = r[a], i = n.findIndex(
70
- (l) => l.key === e.key
71
- );
72
- if (x[i] !== !1) {
73
- const d = r[t].validationFields || [];
74
- d.length > 0 && (S(d), setTimeout(() => {
75
- S(d), s(V, !0);
76
- }, 100));
77
- }
71
+ d(k);
72
+ const E = r[a], O = n.findIndex(
73
+ (i) => i.key === E.key
74
+ );
75
+ if (p[O] !== !1) {
76
+ const e = r[t].validationFields || [];
77
+ e.length > 0 && (u(e), setTimeout(() => {
78
+ u(e), s(k, !0);
79
+ }, 100));
78
80
  }
79
- }, [r, n, c, p, k, u, y, s, F, x, S, m, f]);
80
- return E(() => ({
81
+ }, [r, n, d, l, y, c, F, s, m, p, u, f, S]);
82
+ return D(() => ({
81
83
  visibleTitle: v,
82
- orientation: g,
83
- handleStepClick: C,
84
+ orientation: C,
85
+ indicatorType: g,
86
+ size: x,
87
+ stepValidationStatus: p,
88
+ handleStepClick: T,
84
89
  steps: n,
85
- currentStep: p
86
- }), [v, g, C, n, p]);
90
+ currentStep: l
91
+ }), [v, C, g, x, p, T, n, l]);
87
92
  }
88
93
  export {
89
- H as useStepArea
94
+ Q as useStepArea
90
95
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/Stepper/subcomponents/StepArea/index.tsx"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,wBAAgB,QAAQ,qDA8DvB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/Stepper/subcomponents/StepArea/index.tsx"],"names":[],"mappings":"AAcA;;;;GAIG;AACH,wBAAgB,QAAQ,qDAgFvB"}
@@ -1,59 +1,66 @@
1
- import { jsx as r, jsxs as m } from "@emotion/react/jsx-runtime";
2
- import { StepAreaStyled as y, StepStyled as b, StepNameStyled as f, StepNameTextStyled as h } from "../../slots/StepperSlot.js";
3
- import { Indicator as u } from "./subcomponents/Inidicator/index.js";
4
- import { useStepArea as x } from "./hooks/useStepArea.js";
5
- import { useVisibileSteps as k } from "./hooks/useVisibileSteps.js";
6
- function j() {
7
- const { visibleSteps: t } = k(), { handleStepClick: a, visibleTitle: s, orientation: S, steps: d, currentStep: n } = x({ visibleSteps: t }), o = {
8
- visibleTitle: s,
9
- orientation: S,
10
- totalSteps: t.length
1
+ import { jsx as n, jsxs as x } from "@emotion/react/jsx-runtime";
2
+ import { StepAreaStyled as w, StepStyled as z, StepNameStyled as T, StepNameTextStyled as V } from "../../slots/StepperSlot.js";
3
+ import { Indicator as A } from "./subcomponents/Inidicator/index.js";
4
+ import { useIsMobile as I } from "@m4l/graphics";
5
+ import { useStepArea as N } from "./hooks/useStepArea.js";
6
+ import { useVisibileSteps as j } from "./hooks/useVisibileSteps.js";
7
+ import { useComponentSize as D } from "../../../../hooks/useComponentSize/index.js";
8
+ function G() {
9
+ const p = I(), { visibleSteps: o } = j(), { handleStepClick: c, visibleTitle: l, orientation: r, steps: d, currentStep: t, indicatorType: m, size: u, stepValidationStatus: y } = N({ visibleSteps: o }), { currentSize: b } = D(u), f = r === "vertical" && !p, k = r !== "vertical" && !p, a = {
10
+ visibleTitle: l,
11
+ orientation: r,
12
+ totalSteps: o.length,
13
+ // Let the step styles know the real indicator size (it changes with the marker type and the error state).
14
+ indicatorType: m,
15
+ size: b,
16
+ stepValidationStatus: y
11
17
  };
12
- return /* @__PURE__ */ r(y, { ownerState: o, children: d.map((i, l) => {
13
- const e = t.findIndex((c) => c.key === i.key), p = e !== -1;
14
- return /* @__PURE__ */ m(
15
- b,
18
+ return /* @__PURE__ */ n(w, { ownerState: a, children: d.map((s, e) => {
19
+ const i = o.findIndex((C) => C.key === s.key), S = i !== -1, h = t > e, v = p ? "bodyStandard" : f && t === e || k && h ? "microStandard" : "microSlim";
20
+ return /* @__PURE__ */ x(
21
+ z,
16
22
  {
17
23
  role: "button",
18
- onClick: () => p ? a(e) : void 0,
24
+ onClick: () => S ? c(i) : void 0,
19
25
  ownerState: {
20
- ...o,
21
- currentStep: n,
22
- step: e,
26
+ ...a,
27
+ currentStep: t,
28
+ step: i,
23
29
  // Usa el índice en la secuencia visible
24
- isStepVisible: p
30
+ originalStepIndex: e,
31
+ isStepVisible: S
25
32
  },
26
- "data-testid": `stepper-step-${i.key}`,
33
+ "data-testid": `stepper-step-${s.key}`,
27
34
  children: [
28
- s && /* @__PURE__ */ r(
29
- f,
35
+ l && /* @__PURE__ */ n(
36
+ T,
30
37
  {
31
- variant: "bodyStandard",
38
+ variant: v,
32
39
  ownerState: {
33
- ...o,
34
- currentStep: n,
35
- step: e,
36
- originalStepIndex: l,
37
- isStepVisible: p
40
+ ...a,
41
+ currentStep: t,
42
+ step: i,
43
+ originalStepIndex: e,
44
+ isStepVisible: S
38
45
  },
39
- children: /* @__PURE__ */ r(h, { ownerState: { orientation: S }, children: i.title })
46
+ children: /* @__PURE__ */ n(V, { ownerState: { orientation: r }, children: s.title })
40
47
  }
41
48
  ),
42
- /* @__PURE__ */ r(
43
- u,
49
+ /* @__PURE__ */ n(
50
+ A,
44
51
  {
45
- currentStep: n,
46
- step: e,
47
- totalSteps: t.length,
48
- originalStepIndex: l
52
+ currentStep: t,
53
+ step: i,
54
+ totalSteps: o.length,
55
+ originalStepIndex: e
49
56
  }
50
57
  )
51
58
  ]
52
59
  },
53
- i.key
60
+ s.key
54
61
  );
55
62
  }) });
56
63
  }
57
64
  export {
58
- j as StepArea
65
+ G as StepArea
59
66
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/Stepper/subcomponents/StepArea/subcomponents/Inidicator/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AASnD;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,oDAwG9C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/Stepper/subcomponents/StepArea/subcomponents/Inidicator/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AASnD;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,oDAuI9C"}
@@ -1,77 +1,94 @@
1
- import { jsx as i } from "@emotion/react/jsx-runtime";
2
- import { useMemo as y } from "react";
3
- import { IndicatorStyled as h, TextNumberStyled as I } from "../../../../slots/StepperSlot.js";
4
- import { useStepper as V } from "../../../../hooks/useStepper/index.js";
5
- import { Icon as d } from "@m4l/base";
1
+ import { jsx as o } from "@emotion/react/jsx-runtime";
2
+ import { useMemo as h } from "react";
3
+ import { IndicatorStyled as w, TextNumberStyled as M } from "../../../../slots/StepperSlot.js";
4
+ import { useStepper as B } from "../../../../hooks/useStepper/index.js";
5
+ import { Icon as u, Tooltip as O } from "@m4l/base";
6
6
  import { pathIcons as r } from "../../../../icons.js";
7
- import { useIsMobile as C } from "@m4l/graphics";
8
- import { shallow as M } from "zustand/shallow";
9
- import { useComponentSize as w } from "../../../../../../hooks/useComponentSize/index.js";
10
- function G(z) {
11
- const { step: n, currentStep: e, totalSteps: v, originalStepIndex: t } = z, { orientation: x, size: T, indicatorType: a, stepValidationStatus: s } = V(
12
- (o) => ({
13
- orientation: o.orientation,
14
- size: o.size,
15
- indicatorType: o.indicatorType,
16
- stepValidationStatus: o.stepValidationStatus
7
+ import { useIsMobile as j } from "@m4l/graphics";
8
+ import { shallow as k } from "zustand/shallow";
9
+ import { useComponentSize as E } from "../../../../../../hooks/useComponentSize/index.js";
10
+ function Q(v) {
11
+ const { step: l, currentStep: i, totalSteps: x, originalStepIndex: t } = v, {
12
+ orientation: z,
13
+ size: I,
14
+ indicatorType: n,
15
+ stepValidationStatus: a,
16
+ steps: V,
17
+ visibleTitle: S
18
+ } = B(
19
+ (e) => ({
20
+ orientation: e.orientation,
21
+ size: e.size,
22
+ indicatorType: e.indicatorType,
23
+ stepValidationStatus: e.stepValidationStatus,
24
+ steps: e.steps,
25
+ visibleTitle: e.visibleTitle
17
26
  }),
18
- M
19
- ), { currentSize: b } = w(T), l = C(), m = y(() => l ? "dot" : a, [l, a]), { isCompleted: p, isValidStep: c, hasBeenValidated: u } = y(() => {
20
- const o = e > t, f = s[t];
27
+ k
28
+ ), { currentSize: C } = E(I), s = j(), c = h(() => s ? "dot" : n, [s, n]), { isCompleted: T, isValidStep: d, hasBeenValidated: f } = h(() => {
29
+ const e = i > t, y = a[t];
21
30
  return {
22
- isCompleted: o,
23
- isValidStep: f === !0,
24
- hasBeenValidated: f !== void 0
31
+ isCompleted: e,
32
+ isValidStep: y === !0,
33
+ hasBeenValidated: y !== void 0
25
34
  };
26
- }, [e, t, s]), S = {
27
- size: b,
28
- currentStep: e,
29
- step: n,
30
- totalSteps: v,
31
- orientation: x,
32
- indicatorType: a,
33
- stepValidationStatus: s,
35
+ }, [i, t, a]), p = {
36
+ size: C,
37
+ currentStep: i,
38
+ step: l,
39
+ totalSteps: x,
40
+ orientation: z,
41
+ indicatorType: n,
42
+ visibleTitle: S,
43
+ stepValidationStatus: a,
34
44
  originalStepIndex: t,
35
- isCompleted: p,
36
- isCurrent: e === t,
37
- isValidStep: c,
38
- hasBeenValidated: u
39
- };
40
- return /* @__PURE__ */ i(h, { ownerState: S, children: u && !c ? (
45
+ isCompleted: T,
46
+ isCurrent: i === t,
47
+ isValidStep: d,
48
+ hasBeenValidated: f
49
+ }, m = V[t]?.title, g = !S && !s && typeof m == "string" && m.length > 0, b = /* @__PURE__ */ o(w, { ownerState: p, children: f && !d ? (
41
50
  // Mostrar error solo si ha sido validado y es inválido
42
- /* @__PURE__ */ i(
43
- d,
51
+ /* @__PURE__ */ o(
52
+ u,
44
53
  {
45
54
  src: r.circleError,
46
55
  size: "small",
47
56
  color: "error.contrastText"
48
57
  }
49
58
  )
50
- ) : p && c ? (
59
+ ) : T && d ? (
51
60
  // Mostrar completado solo si está completado Y es válido
52
- /* @__PURE__ */ i(
53
- d,
61
+ /* @__PURE__ */ o(
62
+ u,
54
63
  {
55
- src: m === "number" ? r.circleCheck : r.dotOutline,
64
+ src: c === "number" ? r.circleCheck : r.dotOutline,
56
65
  size: "small",
57
66
  color: "primary.semanticText"
58
67
  }
59
68
  )
60
69
  ) : (
61
70
  // Mostrar estado normal (número o dot) para pasos no validados o actuales
62
- /* @__PURE__ */ i(I, { variant: "bodyStandard", ownerState: S, children: m === "number" ? (
63
- // Solo mostrar número si el step es visible (step >= 0)
64
- n >= 0 ? n + 1 : ""
65
- ) : /* @__PURE__ */ i(
66
- d,
71
+ /* @__PURE__ */ o(
72
+ M,
67
73
  {
68
- src: e === t ? r.dotSelected : r.dotOutline,
69
- size: "small",
70
- color: e === t ? "primary.semanticText" : "text.disabled"
74
+ variant: c === "number" ? p.isCurrent ? "microStandard" : "microSlim" : "bodyStandard",
75
+ ownerState: p,
76
+ children: c === "number" ? (
77
+ // Solo mostrar número si el step es visible (step >= 0)
78
+ l >= 0 ? l + 1 : ""
79
+ ) : /* @__PURE__ */ o(
80
+ u,
81
+ {
82
+ src: i === t ? r.dotSelected : r.dotOutline,
83
+ size: "small",
84
+ color: n === "dot" && !s ? i === t ? "primary.enabled" : "text.secondary" : i === t ? "primary.semanticText" : "text.disabled"
85
+ }
86
+ )
71
87
  }
72
- ) })
88
+ )
73
89
  ) });
90
+ return g ? /* @__PURE__ */ o(O, { title: m, children: b }) : b;
74
91
  }
75
92
  export {
76
- G as Indicator
93
+ Q as Indicator
77
94
  };
@@ -1,6 +1,6 @@
1
1
  import { jsx as t } from "@emotion/react/jsx-runtime";
2
- import { DICTIONARY as p } from "../../../dictionary.js";
3
- import { useModuleDictionary as c } from "@m4l/core";
2
+ import { DICTIONARY as c } from "../../../dictionary.js";
3
+ import { useModuleDictionary as p } from "@m4l/core";
4
4
  import { useIsMobile as u } from "@m4l/graphics";
5
5
  import { pathIcons as l } from "../../../icons.js";
6
6
  import { useFormContext as b } from "react-hook-form";
@@ -8,13 +8,13 @@ import { IconButton as f } from "../../../../extended/mui/IconButton/IconButton.
8
8
  import { CircularProgress as d } from "../../../../extended/mui/CircularProgress/CircularProgress.js";
9
9
  import { LoadingButton as I } from "../../../../extended/mui/LoadingButton/LoadingButton.js";
10
10
  function x(i) {
11
- const { label: e, forceIsMobile: o, ...m } = i, { getLabel: n } = c(), s = u(), a = o !== void 0 ? o : s, { formState: { isSubmitting: r } } = b();
11
+ const { label: e, forceIsMobile: o, ...m } = i, { getLabel: n } = p(), s = u(), a = o !== void 0 ? o : s, { formState: { isSubmitting: r } } = b();
12
12
  return a ? /* @__PURE__ */ t(
13
13
  f,
14
14
  {
15
15
  type: "submit",
16
16
  icon: r ? /* @__PURE__ */ t(d, { color: "default" }) : l.circleCheck,
17
- "data-testid": "stepper-prev-button",
17
+ "data-testid": "stepper-submit-button",
18
18
  variant: "contained",
19
19
  color: "primary"
20
20
  }
@@ -22,7 +22,7 @@ function x(i) {
22
22
  I,
23
23
  {
24
24
  type: "submit",
25
- label: e || n(p.LABEL_SUBMIT_BUTTON),
25
+ label: e || n(c.LABEL_SUBMIT_BUTTON),
26
26
  variant: "contained",
27
27
  color: "primary",
28
28
  "data-testid": "stepper-submit-button",
@@ -1 +1 @@
1
- {"version":3,"file":"WindowBase.styles.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/WindowBase/WindowBase.styles.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAU3C;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,gBA+kB9B,CAAC"}
1
+ {"version":3,"file":"WindowBase.styles.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/WindowBase/WindowBase.styles.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAU3C;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,gBAolB9B,CAAC"}