@telefonica/mistica 14.25.0 → 14.26.1

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 (80) hide show
  1. package/css/mistica.css +1 -1
  2. package/dist/accordion.css-mistica.js +41 -0
  3. package/dist/accordion.css.d.ts +12 -0
  4. package/dist/accordion.css.ts.vanilla.css-mistica.js +11 -0
  5. package/dist/accordion.d.ts +47 -0
  6. package/dist/accordion.js +350 -0
  7. package/dist/boxed.d.ts +1 -0
  8. package/dist/boxed.js +17 -16
  9. package/dist/card.js +345 -345
  10. package/dist/carousel.js +58 -52
  11. package/dist/checkbox.css.d.ts +1 -1
  12. package/dist/checkbox.d.ts +3 -1
  13. package/dist/checkbox.js +23 -22
  14. package/dist/community/blocks.js +3 -2
  15. package/dist/form-context.d.ts +9 -9
  16. package/dist/generated/mistica-icons/icons-keywords.d.ts +4 -0
  17. package/dist/icons/icon-chevron.d.ts +1 -0
  18. package/dist/icons/icon-chevron.js +21 -18
  19. package/dist/index.d.ts +4 -2
  20. package/dist/index.js +30 -4
  21. package/dist/integer-field.d.ts +5 -1
  22. package/dist/integer-field.js +12 -11
  23. package/dist/list.d.ts +8 -0
  24. package/dist/list.js +3 -0
  25. package/dist/menu.css-mistica.js +30 -6
  26. package/dist/menu.css.d.ts +14 -2
  27. package/dist/menu.d.ts +25 -3
  28. package/dist/menu.js +264 -84
  29. package/dist/overlay.js +11 -52
  30. package/dist/overscroll-color-context.js +23 -11
  31. package/dist/package-version.js +1 -1
  32. package/dist/pin-field.css-mistica.js +37 -0
  33. package/dist/pin-field.css.d.ts +7 -0
  34. package/dist/pin-field.css.ts.vanilla.css-mistica.js +11 -0
  35. package/dist/pin-field.d.ts +25 -0
  36. package/dist/pin-field.js +269 -0
  37. package/dist/progress-bar.css-mistica.js +7 -4
  38. package/dist/progress-bar.css.d.ts +1 -0
  39. package/dist/progress-bar.d.ts +12 -3
  40. package/dist/progress-bar.js +109 -13
  41. package/dist/stepper.js +34 -27
  42. package/dist/tabs.js +4 -3
  43. package/dist/text-field-base.css.d.ts +2 -0
  44. package/dist/text-field-base.d.ts +1 -0
  45. package/dist/text-field-components.js +28 -26
  46. package/dist/text-field.d.ts +1 -0
  47. package/dist/theme.d.ts +3 -0
  48. package/dist/theme.js +24 -12
  49. package/dist/touchable.js +5 -4
  50. package/dist/video.js +8 -9
  51. package/dist-es/accordion.css-mistica.js +9 -0
  52. package/dist-es/accordion.css.ts.vanilla.css-mistica.js +2 -0
  53. package/dist-es/accordion.js +280 -0
  54. package/dist-es/boxed.js +25 -24
  55. package/dist-es/card.js +475 -475
  56. package/dist-es/carousel.js +95 -89
  57. package/dist-es/checkbox.js +42 -41
  58. package/dist-es/community/blocks.js +2 -1
  59. package/dist-es/icons/icon-chevron.js +25 -22
  60. package/dist-es/index.js +1768 -1766
  61. package/dist-es/integer-field.js +14 -13
  62. package/dist-es/list.js +9 -9
  63. package/dist-es/menu.css-mistica.js +10 -4
  64. package/dist-es/menu.js +262 -93
  65. package/dist-es/overlay.js +18 -20
  66. package/dist-es/overscroll-color-context.js +30 -18
  67. package/dist-es/package-version.js +1 -1
  68. package/dist-es/pin-field.css-mistica.js +5 -0
  69. package/dist-es/pin-field.css.ts.vanilla.css-mistica.js +2 -0
  70. package/dist-es/pin-field.js +217 -0
  71. package/dist-es/progress-bar.css-mistica.js +2 -2
  72. package/dist-es/progress-bar.js +67 -18
  73. package/dist-es/stepper.js +61 -54
  74. package/dist-es/style.css +1 -1
  75. package/dist-es/tabs.js +11 -10
  76. package/dist-es/text-field-components.js +38 -36
  77. package/dist-es/theme.js +24 -12
  78. package/dist-es/touchable.js +9 -8
  79. package/dist-es/video.js +16 -17
  80. package/package.json +1 -1
@@ -1,23 +1,23 @@
1
- import { jsx as o, Fragment as e, jsxs as m } from "react/jsx-runtime";
2
- import { useIsInverseVariant as d } from "./theme-variant-context.js";
3
- import { useTheme as t, useScreenSize as u } from "./hooks.js";
1
+ import { jsx as e, Fragment as n, jsxs as d } from "react/jsx-runtime";
2
+ import { useThemeVariant as m } from "./theme-variant-context.js";
3
+ import { useTheme as s, useScreenSize as u } from "./hooks.js";
4
4
  import v from "./nestable-context.js";
5
- import { isInsideNovumNativeApp as p, getPlatform as f } from "./utils/platform.js";
6
- import { vars as s } from "./skins/skin-contract.css-mistica.js";
7
- const { Provider: g , Getter: h , useSetValue: b } = v(""), l = (r)=>f(r) === "ios", T = (param)=>{
5
+ import { isInsideNovumNativeApp as f, getPlatform as h } from "./utils/platform.js";
6
+ import { vars as t } from "./skins/skin-contract.css-mistica.js";
7
+ const { Provider: p , Getter: g , useSetValue: b } = v(""), l = (r)=>h(r) === "ios", P = (param)=>{
8
8
  let { children: r } = param;
9
- const { platformOverrides: n } = t(), { isTabletOrSmaller: i } = u(), a = t();
10
- return l(n) ? /* @__PURE__ */ o(g, {
11
- children: /* @__PURE__ */ o(h, {
12
- children: (c)=>/* @__PURE__ */ m(e, {
9
+ const { platformOverrides: o } = s(), { isTabletOrSmaller: a } = u(), i = s();
10
+ return l(o) ? /* @__PURE__ */ e(p, {
11
+ children: /* @__PURE__ */ e(g, {
12
+ children: (c)=>/* @__PURE__ */ d(n, {
13
13
  children: [
14
- i ? /* @__PURE__ */ o("div", {
14
+ a ? /* @__PURE__ */ e("div", {
15
15
  style: {
16
16
  position: "absolute",
17
17
  zIndex: 1,
18
- background: c || s.colors.background,
18
+ background: c || t.colors.background,
19
19
  width: "100%",
20
- height: 500 + (p(n) ? 0 : a.dimensions.headerMobileHeight || 0),
20
+ height: 500 + (f(o) ? 0 : i.dimensions.headerMobileHeight || 0),
21
21
  left: 0,
22
22
  marginTop: -500,
23
23
  transform: "translate3d(0,0,0)"
@@ -27,11 +27,23 @@ const { Provider: g , Getter: h , useSetValue: b } = v(""), l = (r)=>f(r) === "
27
27
  ]
28
28
  })
29
29
  })
30
- }) : /* @__PURE__ */ o(e, {
30
+ }) : /* @__PURE__ */ e(n, {
31
31
  children: r
32
32
  });
33
+ }, C = (r)=>{
34
+ switch(r){
35
+ case "default":
36
+ return t.colors.background;
37
+ case "alternative":
38
+ return t.colors.backgroundAlternative;
39
+ case "inverse":
40
+ return t.colors.backgroundBrand;
41
+ default:
42
+ const o = r;
43
+ throw new Error(`Invalid variant: ${o}`);
44
+ }
33
45
  }, O = ()=>{
34
- const r = d();
35
- return b(r ? s.colors.navigationBarBackground : s.colors.background), null;
36
- }, C = ()=>l(t().platformOverrides) ? /* @__PURE__ */ o(O, {}) : /* @__PURE__ */ o(e, {}), V = C;
37
- export { T as OverscrollColorProvider, V as default };
46
+ const r = m();
47
+ return b(C(r)), null;
48
+ }, k = ()=>l(s().platformOverrides) ? /* @__PURE__ */ e(O, {}) : /* @__PURE__ */ e(n, {}), j = k;
49
+ export { P as OverscrollColorProvider, j as default };
@@ -1,2 +1,2 @@
1
- const o = "14.25.0";
1
+ const o = "14.26.1";
2
2
  export { o as PACKAGE_VERSION };
@@ -0,0 +1,5 @@
1
+ import "./sprinkles.css.ts.vanilla.css-mistica.js";
2
+ import "./text-field-base.css.ts.vanilla.css-mistica.js";
3
+ import "./pin-field.css.ts.vanilla.css-mistica.js";
4
+ var f = "_3pc6ro0", y = "_1y2v1nfe6 _1y2v1nfdn _1y2v1nfb6 _1y2v1nfdw _1y2v1nfb0 _1y2v1nfc5 _1y2v1nfcl _1y2v1nf31", r = "_3pc6ro2 _1y2v1nfe6 _1y2v1nfdn _1y2v1nfb6 _1y2v1nfdw _1y2v1nfb0 _1y2v1nfc5 _1y2v1nfcl _1y2v1nf31", d = "_3pc6ro4", o = "_3pc6ro7", p = "_1y2v1nf2x", a = "_1y2v1nfe6 _1y2v1nfdn _1y2v1nfb6 _1y2v1nfdw _1y2v1nfb0 _1y2v1nfc5 _1y2v1nfcl _1y2v1nf4m";
5
+ export { f as disabled, y as field, r as focusedField, d as input, o as passwordDot, p as passwordInput, a as readOnlyField };
@@ -0,0 +1,2 @@
1
+ const s = "";
2
+ export { s as default };
@@ -0,0 +1,217 @@
1
+ function _define_property(obj, key, value) {
2
+ if (key in obj) {
3
+ Object.defineProperty(obj, key, {
4
+ value: value,
5
+ enumerable: true,
6
+ configurable: true,
7
+ writable: true
8
+ });
9
+ } else {
10
+ obj[key] = value;
11
+ }
12
+ return obj;
13
+ }
14
+ function _object_spread(target) {
15
+ for(var i = 1; i < arguments.length; i++){
16
+ var source = arguments[i] != null ? arguments[i] : {};
17
+ var ownKeys = Object.keys(source);
18
+ if (typeof Object.getOwnPropertySymbols === "function") {
19
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
20
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
21
+ }));
22
+ }
23
+ ownKeys.forEach(function(key) {
24
+ _define_property(target, key, source[key]);
25
+ });
26
+ }
27
+ return target;
28
+ }
29
+ import { jsxs as V, jsx as i } from "react/jsx-runtime";
30
+ import D from "classnames";
31
+ import * as m from "react";
32
+ import E from "./inline.js";
33
+ import { input as L, inputWithoutLabel as W } from "./text-field-base.css-mistica.js";
34
+ import { disabled as $, readOnlyField as j, focusedField as B, field as H, input as O, passwordInput as q, passwordDot as K } from "./pin-field.css-mistica.js";
35
+ import { useAriaId as M, useTheme as _ } from "./hooks.js";
36
+ import z from "./screen-reader-only.js";
37
+ import { IntegerInput as G } from "./integer-field.js";
38
+ import { useFieldProps as J } from "./form-context.js";
39
+ import { createChangeEvent as Q } from "./utils/dom.js";
40
+ import { HelperText as U } from "./text-field-components.js";
41
+ import { flushSync as X } from "react-dom";
42
+ let P = !1;
43
+ const Y = (param)=>{
44
+ let { length: a = 6 , hideCode: c = !1 , readSms: d , disabled: h , readOnly: y , value: w , defaultValue: b , onChange: n , inputRef: R } = param;
45
+ var _ref;
46
+ const { texts: T } = _(), [k, A] = m.useState((_ref = b == null ? void 0 : b.slice(0, a)) !== null && _ref !== void 0 ? _ref : ""), [F, v] = m.useState(void 0), l = m.useRef(Array.from({
47
+ length: a
48
+ }, ()=>null)).current, f = typeof w < "u", r = f ? w : k, u = m.useCallback((s)=>{
49
+ if (s === r) return;
50
+ f || A(s);
51
+ const e = l[0];
52
+ e && (n == null || n(Q(_object_spread({}, e), s)));
53
+ }, [
54
+ r,
55
+ l,
56
+ f,
57
+ n
58
+ ]);
59
+ m.useEffect(()=>{
60
+ u(r.slice(0, a));
61
+ }, [
62
+ a,
63
+ r,
64
+ u
65
+ ]), m.useEffect(()=>{
66
+ if (d && "OTPCredential" in window && !P) {
67
+ P = !0;
68
+ const s = new AbortController();
69
+ return navigator.credentials.get({
70
+ // @ts-expect-error: otp is not in the types yet
71
+ otp: {
72
+ transport: [
73
+ "sms"
74
+ ]
75
+ },
76
+ signal: s.signal
77
+ }).then((e)=>{
78
+ if (e) {
79
+ const t = e.code.slice(0, a);
80
+ u(t);
81
+ }
82
+ }).catch(()=>{}).finally(()=>{
83
+ P = !1;
84
+ }), ()=>{
85
+ P = !1, s.abort();
86
+ };
87
+ }
88
+ }, [
89
+ u,
90
+ a,
91
+ d
92
+ ]);
93
+ const N = (s)=>(e)=>{
94
+ var C;
95
+ const t = e.target.value;
96
+ if (t === "") return;
97
+ const o = r[s];
98
+ let p = t;
99
+ !o || o === t ? p = t : o === t[0] ? p = t.slice(1) : o === t[t.length - 1] && (p = t.slice(0, -1));
100
+ let I = s, g = r;
101
+ if (p.length >= 2) {
102
+ const S = p.slice(0, a - s);
103
+ g = r.slice(0, s) + S, I = Math.min(s + S.length, a - 1);
104
+ } else g = r.slice(0, s) + p + r.slice(s + 1), I = s + 1;
105
+ g !== r && (X(()=>{
106
+ u(g);
107
+ }), I !== s && I <= a - 1 && ((C = l[I]) == null || C.focus()));
108
+ };
109
+ var _r_e;
110
+ return /* @__PURE__ */ i(E, {
111
+ space: 8,
112
+ children: Array.from({
113
+ length: a
114
+ }).map((s, e)=>/* @__PURE__ */ V("div", {
115
+ className: y ? j : e === F ? B : H,
116
+ children: [
117
+ /* @__PURE__ */ i(G, {
118
+ "aria-label": T.pinFieldInputLabel.replace("1$s", String(e + 1)).replace("2$s", String(a)),
119
+ type: c ? "password" : "text",
120
+ tabIndex: e > r.length ? -1 : void 0,
121
+ required: !0,
122
+ onFocus: ()=>{
123
+ var o;
124
+ const t = r.length === a ? -1 : r.length;
125
+ t >= 0 && t < e ? (o = l[t]) == null || o.focus() : v(e);
126
+ },
127
+ onBlur: ()=>{
128
+ v(void 0);
129
+ },
130
+ inputRef: (t)=>{
131
+ l[e] = t, e === 0 && R(t);
132
+ },
133
+ className: D(L, W, O, {
134
+ [q]: c
135
+ }),
136
+ disabled: h,
137
+ readOnly: y,
138
+ autoComplete: d ? "one-time-code" : void 0,
139
+ value: (_r_e = r[e]) !== null && _r_e !== void 0 ? _r_e : "",
140
+ onChange: N(e),
141
+ onKeyDown: (t)=>{
142
+ switch(t.key){
143
+ case "Backspace":
144
+ case "Delete":
145
+ if (t.currentTarget.value && u(r.slice(0, e) + r.slice(e + 1)), e > 0 && e >= r.length - 1) {
146
+ const o = l[e - 1];
147
+ o == null || o.focus();
148
+ }
149
+ break;
150
+ case "ArrowLeft":
151
+ if (e > 0) {
152
+ const o = l[e - 1];
153
+ o && o.focus();
154
+ }
155
+ break;
156
+ case "ArrowRight":
157
+ if (e < a - 1) {
158
+ const o = l[e + 1];
159
+ o && o.focus();
160
+ }
161
+ break;
162
+ }
163
+ }
164
+ }),
165
+ c && r[e] && /* @__PURE__ */ i("div", {
166
+ "aria-hidden": !0,
167
+ className: K,
168
+ children: "•"
169
+ })
170
+ ]
171
+ }, e))
172
+ });
173
+ }, Z = (param)=>{
174
+ let { length: a = 6 , hideCode: c = !1 , readSms: d = !c , // by default, don't read sms if the code is hidden (password input type)
175
+ disabled: h , readOnly: y , name: w , value: b , defaultValue: n , helperText: R , error: T , onChangeValue: k , onChange: A , "aria-label": F , "aria-labelledby": v } = param;
176
+ const l = J({
177
+ name: w,
178
+ value: b,
179
+ defaultValue: n,
180
+ processValue: (r)=>r,
181
+ helperText: R,
182
+ optional: !1,
183
+ error: T,
184
+ disabled: h,
185
+ onChangeValue: k,
186
+ onChange: A
187
+ }), f = M();
188
+ return /* @__PURE__ */ V("div", {
189
+ role: "group",
190
+ "aria-labelledby": v !== null && v !== void 0 ? v : f,
191
+ className: h ? $ : void 0,
192
+ children: [
193
+ F && !v && /* @__PURE__ */ i(z, {
194
+ children: /* @__PURE__ */ i("div", {
195
+ id: f,
196
+ children: F
197
+ })
198
+ }),
199
+ /* @__PURE__ */ i(Y, {
200
+ inputRef: l.inputRef,
201
+ length: a,
202
+ hideCode: c,
203
+ readSms: d,
204
+ value: l.value,
205
+ defaultValue: l.defaultValue,
206
+ disabled: l.disabled,
207
+ onChange: l.onChange,
208
+ readOnly: y
209
+ }),
210
+ /* @__PURE__ */ i(U, {
211
+ error: l.error,
212
+ leftText: l.helperText
213
+ })
214
+ ]
215
+ });
216
+ }, pe = Z;
217
+ export { pe as default };
@@ -1,4 +1,4 @@
1
1
  import "./sprinkles.css.ts.vanilla.css-mistica.js";
2
2
  import "./progress-bar.css.ts.vanilla.css-mistica.js";
3
- var a = "_1y2v1nfca _1y2v1nfe3", n = "_1y2v1nfe3 _1y2v1nfcd _1y2v1nf44", y = "j0y7r95", e = "j0y7r94";
4
- export { a as bar, n as barBackground, y as inverse, e as normal };
3
+ var v = "_1y2v1nfca _1y2v1nfe3", n = "_1y2v1nfe3 _1y2v1nfcd _1y2v1nf44", e = "j0y7r95", y = "j0y7r94", o = "j0y7r96";
4
+ export { v as bar, n as barBackground, e as inverse, y as normal, o as progressBarSteppedContainer };
@@ -50,30 +50,79 @@ function _object_spread_props(target, source) {
50
50
  }
51
51
  return target;
52
52
  }
53
- import { jsx as o } from "react/jsx-runtime";
54
- import { useTheme as c } from "./hooks.js";
55
- import { vars as d } from "./skins/skin-contract.css-mistica.js";
56
- import { barBackground as b, bar as f, inverse as u, normal as v } from "./progress-bar.css-mistica.js";
57
- import { getPrefixedDataAttributes as g } from "./utils/dom.js";
58
- import p from "classnames";
59
- const x = (param)=>{
60
- let { progressPercent: a , color: e , "aria-label": l , "aria-labelledby": r , dataAttributes: s , reverse: t = !1 } = param;
61
- const { texts: i } = c(), m = i.loading, n = r ? void 0 : l || m;
62
- return /* @__PURE__ */ o("div", _object_spread_props(_object_spread({}, g(s, "ProgressBar")), {
63
- className: b,
53
+ import { jsx as t } from "react/jsx-runtime";
54
+ import * as b from "react";
55
+ import { useTheme as f } from "./hooks.js";
56
+ import { vars as h } from "./skins/skin-contract.css-mistica.js";
57
+ import { barBackground as B, bar as S, inverse as $, normal as x, progressBarSteppedContainer as N } from "./progress-bar.css-mistica.js";
58
+ import { getPrefixedDataAttributes as C } from "./utils/dom.js";
59
+ import k from "classnames";
60
+ import P from "./inline.js";
61
+ const E = (param)=>{
62
+ let { progressPercent: r , color: o , "aria-label": d , "aria-labelledby": l , dataAttributes: i , reverse: n = !1 } = param;
63
+ const { texts: c } = f(), a = Math.max(0, Math.min(100, r)), s = l ? void 0 : (()=>`${d || c.loading}, ${a}% ${c.progressBarCompletedLabel}`)();
64
+ return /* @__PURE__ */ t("div", _object_spread_props(_object_spread({}, C(i, "ProgressBar")), {
65
+ className: B,
64
66
  role: "progressbar",
65
67
  "aria-valuenow": a,
66
68
  "aria-valuemin": 0,
67
69
  "aria-valuemax": 100,
68
- "aria-label": n,
69
- "aria-labelledby": r,
70
- children: /* @__PURE__ */ o("div", {
71
- className: p(f, t ? u : v),
70
+ "aria-label": s,
71
+ "aria-labelledby": l,
72
+ children: /* @__PURE__ */ t("div", {
73
+ className: k(S, n ? $ : x),
72
74
  style: {
73
75
  maxWidth: `${a}%`,
74
- backgroundColor: e !== null && e !== void 0 ? e : d.colors.controlActivated
76
+ backgroundColor: o !== null && o !== void 0 ? o : h.colors.controlActivated
75
77
  }
76
78
  })
77
79
  }));
78
- }, N = x;
79
- export { N as default };
80
+ }, R = (param)=>{
81
+ let { steps: r , currentStep: o = 0 , color: d , dataAttributes: l , "aria-label": i , "aria-labelledby": n } = param;
82
+ const { texts: c } = f(), [a, p] = b.useState(Math.ceil(o)), [s, y] = b.useState(!1);
83
+ b.useEffect(()=>{
84
+ const e = Math.ceil(o);
85
+ a !== e && (y(e < a), p(e));
86
+ }, [
87
+ o,
88
+ r,
89
+ a
90
+ ]);
91
+ const A = n ? void 0 : (()=>{
92
+ const e = c.progressBarStepLabel.replace("1$s", String(a)).replace("2$s", String(r));
93
+ return i ? `${i}, ${e.toLowerCase()}` : e;
94
+ })();
95
+ return /* @__PURE__ */ t("div", _object_spread_props(_object_spread({}, C(l, "ProgressBarStepped")), {
96
+ role: "progressbar",
97
+ "aria-valuenow": a,
98
+ "aria-valuemin": 0,
99
+ "aria-valuemax": r,
100
+ "aria-label": A,
101
+ "aria-labelledby": n,
102
+ className: N,
103
+ children: /* @__PURE__ */ t(P, {
104
+ space: 8,
105
+ fullWidth: !0,
106
+ children: Array.from({
107
+ length: r
108
+ }, (e, m)=>{
109
+ const g = m === a, u = m < a, v = m === a - 1;
110
+ return /* @__PURE__ */ t("div", {
111
+ className: B,
112
+ "aria-hidden": "true",
113
+ children: (u || g) && /* @__PURE__ */ t("div", {
114
+ className: k(S, {
115
+ [x]: v && !s,
116
+ [$]: g && s
117
+ }),
118
+ style: {
119
+ backgroundColor: d !== null && d !== void 0 ? d : h.colors.controlActivated,
120
+ maxWidth: u || v && !s ? "100%" : "0"
121
+ }
122
+ })
123
+ }, m);
124
+ })
125
+ })
126
+ }));
127
+ };
128
+ export { E as ProgressBar, R as ProgressBarStepped };
@@ -50,88 +50,95 @@ function _object_spread_props(target, source) {
50
50
  }
51
51
  return target;
52
52
  }
53
- import { jsx as e, jsxs as d } from "react/jsx-runtime";
54
- import * as h from "react";
55
- import c from "classnames";
56
- import { Text1 as R, Text2 as x } from "./text.js";
57
- import { useTheme as C, useScreenSize as F, useElementDimensions as P } from "./hooks.js";
58
- import T from "./icons/icon-success.js";
59
- import { stepper as k, vars as w, step as D, stepIconNumber as u, iconAnimation as j, number as z, currentNumber as B, textContainer as H, bar as $, barFilled as E, barFilledAnimation as L, barFilledReverseAnimation as M } from "./stepper.css-mistica.js";
60
- import { pxToRem as O } from "./utils/css.js";
61
- import { assignInlineVars as V } from "@vanilla-extract/dynamic";
62
- import { vars as s } from "./skins/skin-contract.css-mistica.js";
63
- import { getPrefixedDataAttributes as q } from "./utils/dom.js";
64
- const G = (param)=>{
65
- let { steps: n , currentIndex: t , "aria-label": v , dataAttributes: f } = param;
66
- const { textPresets: g } = C(), { isDesktopOrBigger: b } = F(), { height: N , ref: S } = P(), A = N, l = h.useRef(t), i = l.current > t;
67
- return t !== l.current && (l.current = t), /* @__PURE__ */ e("div", _object_spread_props(_object_spread({
68
- className: k,
69
- style: V({
70
- [w.stepperMinHeight]: O(40 + A)
53
+ import { jsx as e, jsxs as h } from "react/jsx-runtime";
54
+ import * as l from "react";
55
+ import d from "classnames";
56
+ import { Text1 as w, Text2 as C } from "./text.js";
57
+ import { useTheme as F, useScreenSize as P, useElementDimensions as T } from "./hooks.js";
58
+ import B from "./icons/icon-success.js";
59
+ import { stepper as D, vars as I, step as M, stepIconNumber as u, iconAnimation as R, number as $, currentNumber as j, textContainer as z, bar as E, barFilled as H, barFilledAnimation as L, barFilledReverseAnimation as O } from "./stepper.css-mistica.js";
60
+ import { pxToRem as V } from "./utils/css.js";
61
+ import { assignInlineVars as q } from "@vanilla-extract/dynamic";
62
+ import { vars as o } from "./skins/skin-contract.css-mistica.js";
63
+ import { getPrefixedDataAttributes as G } from "./utils/dom.js";
64
+ const J = (param)=>{
65
+ let { steps: n , currentIndex: m , "aria-label": f , dataAttributes: v } = param;
66
+ const { textPresets: g } = F(), { isDesktopOrBigger: S } = P(), { height: b , ref: N } = T(), x = b, [a, A] = l.useState(Math.ceil(m)), [s, y] = l.useState(!1);
67
+ return l.useEffect(()=>{
68
+ const i = Math.ceil(m);
69
+ a !== i && (y(i < a), A(i));
70
+ }, [
71
+ m,
72
+ n,
73
+ a
74
+ ]), /* @__PURE__ */ e("div", _object_spread_props(_object_spread({
75
+ className: D,
76
+ style: q({
77
+ [I.stepperMinHeight]: V(40 + x)
71
78
  })
72
- }, q(f, "Stepper")), {
73
- children: n.map((p, a)=>{
74
- const r = a === t, y = a === n.length - 1, o = a < t, m = a === t - 1;
75
- return /* @__PURE__ */ d(h.Fragment, {
79
+ }, G(v, "Stepper")), {
80
+ children: n.map((i, t)=>{
81
+ const r = t === a, k = t === n.length - 1, c = t < a, p = t === a - 1;
82
+ return /* @__PURE__ */ h(l.Fragment, {
76
83
  children: [
77
- /* @__PURE__ */ d("div", {
78
- className: D,
84
+ /* @__PURE__ */ h("div", {
85
+ className: M,
79
86
  role: "progressbar",
80
- "aria-valuenow": r ? a + 1 : void 0,
87
+ "aria-valuenow": r ? t + 1 : void 0,
81
88
  "aria-valuemin": 1,
82
89
  "aria-valuemax": n.length,
83
- "aria-valuetext": p,
84
- "aria-label": v,
90
+ "aria-valuetext": i,
91
+ "aria-label": f,
85
92
  children: [
86
- o ? /* @__PURE__ */ e("div", {
87
- className: c(u, {
88
- [j]: m && !i
93
+ c ? /* @__PURE__ */ e("div", {
94
+ className: d(u, {
95
+ [R]: p && !s
89
96
  }),
90
97
  "aria-hidden": "true",
91
- children: /* @__PURE__ */ e(T, {
92
- color: s.colors.controlActivated,
98
+ children: /* @__PURE__ */ e(B, {
99
+ color: o.colors.controlActivated,
93
100
  size: "100%",
94
- skipAnimation: !m || i
101
+ skipAnimation: !p || s
95
102
  })
96
103
  }) : /* @__PURE__ */ e("div", {
97
- className: c(u, z, {
98
- [B]: r || r
104
+ className: d(u, $, {
105
+ [j]: r || r
99
106
  }),
100
- children: /* @__PURE__ */ e(R, {
107
+ children: /* @__PURE__ */ e(w, {
101
108
  as: "span",
102
109
  weight: g.indicator.weight,
103
- color: r ? s.colors.textPrimaryInverse : s.colors.textSecondary,
110
+ color: r ? o.colors.textPrimaryInverse : o.colors.textSecondary,
104
111
  "aria-hidden": "true",
105
- children: a + 1
112
+ children: t + 1
106
113
  })
107
114
  }),
108
- b && /* @__PURE__ */ e("div", {
109
- className: H,
110
- ref: S,
115
+ S && /* @__PURE__ */ e("div", {
116
+ className: z,
117
+ ref: N,
111
118
  "aria-hidden": "true",
112
- children: /* @__PURE__ */ e(x, {
119
+ children: /* @__PURE__ */ e(C, {
113
120
  as: "span",
114
121
  regular: !0,
115
- color: o || r ? s.colors.textPrimary : s.colors.textSecondary,
116
- children: p
122
+ color: c || r ? o.colors.textPrimary : o.colors.textSecondary,
123
+ children: i
117
124
  })
118
125
  })
119
126
  ]
120
127
  }),
121
- !y && /* @__PURE__ */ e("div", {
122
- className: $,
128
+ !k && /* @__PURE__ */ e("div", {
129
+ className: E,
123
130
  "aria-hidden": "true",
124
- children: (o || r) && /* @__PURE__ */ e("div", {
125
- className: c({
126
- [E]: i && r || o,
127
- [L]: m && !i,
128
- [M]: r && i
131
+ children: (c || r) && /* @__PURE__ */ e("div", {
132
+ className: d({
133
+ [H]: s && r || c,
134
+ [L]: p && !s,
135
+ [O]: r && s
129
136
  })
130
137
  })
131
138
  })
132
139
  ]
133
- }, a);
140
+ }, t);
134
141
  })
135
142
  }));
136
- }, ee = G;
137
- export { ee as default };
143
+ }, te = J;
144
+ export { te as default };