@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.
- package/css/mistica.css +1 -1
- package/dist/accordion.css-mistica.js +41 -0
- package/dist/accordion.css.d.ts +12 -0
- package/dist/accordion.css.ts.vanilla.css-mistica.js +11 -0
- package/dist/accordion.d.ts +47 -0
- package/dist/accordion.js +350 -0
- package/dist/boxed.d.ts +1 -0
- package/dist/boxed.js +17 -16
- package/dist/card.js +345 -345
- package/dist/carousel.js +58 -52
- package/dist/checkbox.css.d.ts +1 -1
- package/dist/checkbox.d.ts +3 -1
- package/dist/checkbox.js +23 -22
- package/dist/community/blocks.js +3 -2
- package/dist/form-context.d.ts +9 -9
- package/dist/generated/mistica-icons/icons-keywords.d.ts +4 -0
- package/dist/icons/icon-chevron.d.ts +1 -0
- package/dist/icons/icon-chevron.js +21 -18
- package/dist/index.d.ts +4 -2
- package/dist/index.js +30 -4
- package/dist/integer-field.d.ts +5 -1
- package/dist/integer-field.js +12 -11
- package/dist/list.d.ts +8 -0
- package/dist/list.js +3 -0
- package/dist/menu.css-mistica.js +30 -6
- package/dist/menu.css.d.ts +14 -2
- package/dist/menu.d.ts +25 -3
- package/dist/menu.js +264 -84
- package/dist/overlay.js +11 -52
- package/dist/overscroll-color-context.js +23 -11
- package/dist/package-version.js +1 -1
- package/dist/pin-field.css-mistica.js +37 -0
- package/dist/pin-field.css.d.ts +7 -0
- package/dist/pin-field.css.ts.vanilla.css-mistica.js +11 -0
- package/dist/pin-field.d.ts +25 -0
- package/dist/pin-field.js +269 -0
- package/dist/progress-bar.css-mistica.js +7 -4
- package/dist/progress-bar.css.d.ts +1 -0
- package/dist/progress-bar.d.ts +12 -3
- package/dist/progress-bar.js +109 -13
- package/dist/stepper.js +34 -27
- package/dist/tabs.js +4 -3
- package/dist/text-field-base.css.d.ts +2 -0
- package/dist/text-field-base.d.ts +1 -0
- package/dist/text-field-components.js +28 -26
- package/dist/text-field.d.ts +1 -0
- package/dist/theme.d.ts +3 -0
- package/dist/theme.js +24 -12
- package/dist/touchable.js +5 -4
- package/dist/video.js +8 -9
- package/dist-es/accordion.css-mistica.js +9 -0
- package/dist-es/accordion.css.ts.vanilla.css-mistica.js +2 -0
- package/dist-es/accordion.js +280 -0
- package/dist-es/boxed.js +25 -24
- package/dist-es/card.js +475 -475
- package/dist-es/carousel.js +95 -89
- package/dist-es/checkbox.js +42 -41
- package/dist-es/community/blocks.js +2 -1
- package/dist-es/icons/icon-chevron.js +25 -22
- package/dist-es/index.js +1768 -1766
- package/dist-es/integer-field.js +14 -13
- package/dist-es/list.js +9 -9
- package/dist-es/menu.css-mistica.js +10 -4
- package/dist-es/menu.js +262 -93
- package/dist-es/overlay.js +18 -20
- package/dist-es/overscroll-color-context.js +30 -18
- package/dist-es/package-version.js +1 -1
- package/dist-es/pin-field.css-mistica.js +5 -0
- package/dist-es/pin-field.css.ts.vanilla.css-mistica.js +2 -0
- package/dist-es/pin-field.js +217 -0
- package/dist-es/progress-bar.css-mistica.js +2 -2
- package/dist-es/progress-bar.js +67 -18
- package/dist-es/stepper.js +61 -54
- package/dist-es/style.css +1 -1
- package/dist-es/tabs.js +11 -10
- package/dist-es/text-field-components.js +38 -36
- package/dist-es/theme.js +24 -12
- package/dist-es/touchable.js +9 -8
- package/dist-es/video.js +16 -17
- package/package.json +1 -1
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import { useTheme as
|
|
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
|
|
6
|
-
import { vars as
|
|
7
|
-
const { Provider:
|
|
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:
|
|
10
|
-
return l(
|
|
11
|
-
children: /* @__PURE__ */
|
|
12
|
-
children: (c)=>/* @__PURE__ */
|
|
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
|
-
|
|
14
|
+
a ? /* @__PURE__ */ e("div", {
|
|
15
15
|
style: {
|
|
16
16
|
position: "absolute",
|
|
17
17
|
zIndex: 1,
|
|
18
|
-
background: c ||
|
|
18
|
+
background: c || t.colors.background,
|
|
19
19
|
width: "100%",
|
|
20
|
-
height: 500 + (
|
|
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__ */
|
|
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 =
|
|
35
|
-
return b(r
|
|
36
|
-
},
|
|
37
|
-
export {
|
|
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.
|
|
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,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
|
|
4
|
-
export {
|
|
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 };
|
package/dist-es/progress-bar.js
CHANGED
|
@@ -50,30 +50,79 @@ function _object_spread_props(target, source) {
|
|
|
50
50
|
}
|
|
51
51
|
return target;
|
|
52
52
|
}
|
|
53
|
-
import { jsx as
|
|
54
|
-
import
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
58
|
-
import
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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":
|
|
69
|
-
"aria-labelledby":
|
|
70
|
-
children: /* @__PURE__ */
|
|
71
|
-
className:
|
|
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:
|
|
76
|
+
backgroundColor: o !== null && o !== void 0 ? o : h.colors.controlActivated
|
|
75
77
|
}
|
|
76
78
|
})
|
|
77
79
|
}));
|
|
78
|
-
},
|
|
79
|
-
|
|
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 };
|
package/dist-es/stepper.js
CHANGED
|
@@ -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
|
|
54
|
-
import * as
|
|
55
|
-
import
|
|
56
|
-
import { Text1 as
|
|
57
|
-
import { useTheme as
|
|
58
|
-
import
|
|
59
|
-
import { stepper as
|
|
60
|
-
import { pxToRem as
|
|
61
|
-
import { assignInlineVars as
|
|
62
|
-
import { vars as
|
|
63
|
-
import { getPrefixedDataAttributes as
|
|
64
|
-
const
|
|
65
|
-
let { steps: n , currentIndex:
|
|
66
|
-
const { textPresets: g } =
|
|
67
|
-
return
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
},
|
|
73
|
-
children: n.map((
|
|
74
|
-
const r =
|
|
75
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
78
|
-
className:
|
|
84
|
+
/* @__PURE__ */ h("div", {
|
|
85
|
+
className: M,
|
|
79
86
|
role: "progressbar",
|
|
80
|
-
"aria-valuenow": r ?
|
|
87
|
+
"aria-valuenow": r ? t + 1 : void 0,
|
|
81
88
|
"aria-valuemin": 1,
|
|
82
89
|
"aria-valuemax": n.length,
|
|
83
|
-
"aria-valuetext":
|
|
84
|
-
"aria-label":
|
|
90
|
+
"aria-valuetext": i,
|
|
91
|
+
"aria-label": f,
|
|
85
92
|
children: [
|
|
86
|
-
|
|
87
|
-
className:
|
|
88
|
-
[
|
|
93
|
+
c ? /* @__PURE__ */ e("div", {
|
|
94
|
+
className: d(u, {
|
|
95
|
+
[R]: p && !s
|
|
89
96
|
}),
|
|
90
97
|
"aria-hidden": "true",
|
|
91
|
-
children: /* @__PURE__ */ e(
|
|
92
|
-
color:
|
|
98
|
+
children: /* @__PURE__ */ e(B, {
|
|
99
|
+
color: o.colors.controlActivated,
|
|
93
100
|
size: "100%",
|
|
94
|
-
skipAnimation: !
|
|
101
|
+
skipAnimation: !p || s
|
|
95
102
|
})
|
|
96
103
|
}) : /* @__PURE__ */ e("div", {
|
|
97
|
-
className:
|
|
98
|
-
[
|
|
104
|
+
className: d(u, $, {
|
|
105
|
+
[j]: r || r
|
|
99
106
|
}),
|
|
100
|
-
children: /* @__PURE__ */ e(
|
|
107
|
+
children: /* @__PURE__ */ e(w, {
|
|
101
108
|
as: "span",
|
|
102
109
|
weight: g.indicator.weight,
|
|
103
|
-
color: r ?
|
|
110
|
+
color: r ? o.colors.textPrimaryInverse : o.colors.textSecondary,
|
|
104
111
|
"aria-hidden": "true",
|
|
105
|
-
children:
|
|
112
|
+
children: t + 1
|
|
106
113
|
})
|
|
107
114
|
}),
|
|
108
|
-
|
|
109
|
-
className:
|
|
110
|
-
ref:
|
|
115
|
+
S && /* @__PURE__ */ e("div", {
|
|
116
|
+
className: z,
|
|
117
|
+
ref: N,
|
|
111
118
|
"aria-hidden": "true",
|
|
112
|
-
children: /* @__PURE__ */ e(
|
|
119
|
+
children: /* @__PURE__ */ e(C, {
|
|
113
120
|
as: "span",
|
|
114
121
|
regular: !0,
|
|
115
|
-
color:
|
|
116
|
-
children:
|
|
122
|
+
color: c || r ? o.colors.textPrimary : o.colors.textSecondary,
|
|
123
|
+
children: i
|
|
117
124
|
})
|
|
118
125
|
})
|
|
119
126
|
]
|
|
120
127
|
}),
|
|
121
|
-
!
|
|
122
|
-
className:
|
|
128
|
+
!k && /* @__PURE__ */ e("div", {
|
|
129
|
+
className: E,
|
|
123
130
|
"aria-hidden": "true",
|
|
124
|
-
children: (
|
|
125
|
-
className:
|
|
126
|
-
[
|
|
127
|
-
[L]:
|
|
128
|
-
[
|
|
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
|
-
},
|
|
140
|
+
}, t);
|
|
134
141
|
})
|
|
135
142
|
}));
|
|
136
|
-
},
|
|
137
|
-
export {
|
|
143
|
+
}, te = J;
|
|
144
|
+
export { te as default };
|