@telefonica/mistica 14.24.1 → 14.26.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.
- 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 +5 -2
- package/dist/index.js +34 -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/skins/telefonica.js +2 -2
- package/dist/skins/vivo-new.js +1 -1
- package/dist/slider.css-mistica.js +42 -0
- package/dist/slider.css.d.ts +9 -0
- package/dist/slider.css.ts.vanilla.css-mistica.js +11 -0
- package/dist/slider.d.ts +14 -0
- package/dist/slider.js +170 -0
- package/dist/stepper.js +34 -27
- 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/tooltip.css-mistica.js +10 -7
- package/dist/tooltip.css.d.ts +1 -0
- package/dist/tooltip.d.ts +2 -1
- package/dist/tooltip.js +37 -36
- package/dist/touchable.js +5 -4
- package/dist/utils/locale.d.ts +1 -1
- 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 -1765
- 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/skins/telefonica.js +2 -2
- package/dist-es/skins/vivo-new.js +1 -1
- package/dist-es/slider.css-mistica.js +10 -0
- package/dist-es/slider.css.ts.vanilla.css-mistica.js +2 -0
- package/dist-es/slider.js +117 -0
- package/dist-es/stepper.js +61 -54
- package/dist-es/style.css +1 -1
- package/dist-es/text-field-components.js +38 -36
- package/dist-es/theme.js +24 -12
- package/dist-es/tooltip.css-mistica.js +3 -3
- package/dist-es/tooltip.js +65 -64
- 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.0";
|
|
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 };
|
|
@@ -128,7 +128,7 @@ const e = {
|
|
|
128
128
|
warningLow: e.ambar10,
|
|
129
129
|
errorLow: e.coral10,
|
|
130
130
|
promoLow: e.orchid10,
|
|
131
|
-
brandLow: e.
|
|
131
|
+
brandLow: e.telefonicaBlue10,
|
|
132
132
|
successHigh: e.turquoise70,
|
|
133
133
|
warningHigh: e.ambar70,
|
|
134
134
|
errorHigh: e.coral70,
|
|
@@ -262,7 +262,7 @@ const e = {
|
|
|
262
262
|
input: "0px",
|
|
263
263
|
legacyDisplay: "0px",
|
|
264
264
|
popup: "0px",
|
|
265
|
-
sheet: "
|
|
265
|
+
sheet: "0px"
|
|
266
266
|
},
|
|
267
267
|
textPresets: {
|
|
268
268
|
cardTitle: {
|
|
@@ -147,7 +147,7 @@ const e = {
|
|
|
147
147
|
},
|
|
148
148
|
darkModeColors: {
|
|
149
149
|
background: e.darkModeBlack,
|
|
150
|
-
backgroundAlternative: e.
|
|
150
|
+
backgroundAlternative: e.darkModeBlack,
|
|
151
151
|
backgroundBrand: e.darkModeBlack,
|
|
152
152
|
backgroundBrandSecondary: e.darkModeBlack,
|
|
153
153
|
backgroundContainer: e.darkModeGrey,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import "./sprinkles.css.ts.vanilla.css-mistica.js";
|
|
2
|
+
import "./slider.css.ts.vanilla.css-mistica.js";
|
|
3
|
+
var v = "_1j1wlhk1 _1y2v1nfb6 _1y2v1nfbs", r = "_1j1wlhkf _1y2v1nfb1 _1y2v1nfe3 _1y2v1nf45", l = "_1y2v1nfb6 _1y2v1nfb0 _1y2v1nfbt", f = "_1j1wlhk9 _1j1wlhk6 _1y2v1nfe3 _1y2v1nf44", a = {
|
|
4
|
+
ios: "_1j1wlhkc _1j1wlhkb _1y2v1nfb1",
|
|
5
|
+
default: "_1j1wlhkd _1j1wlhkb _1y2v1nfb1"
|
|
6
|
+
}, e = {
|
|
7
|
+
ios: "_1j1wlhk7 _1j1wlhk6 _1y2v1nfe3 _1y2v1nf44",
|
|
8
|
+
default: "_1j1wlhk8 _1j1wlhk6 _1y2v1nfe3 _1y2v1nf44"
|
|
9
|
+
}, y = "_1j1wlhk2";
|
|
10
|
+
export { v as container, r as progress, l as rangeSlider, f as sliderDisabled, a as sliderThumbVariant, e as sliderVariant, y as targetContainer };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { jsx as c, jsxs as z } from "react/jsx-runtime";
|
|
2
|
+
import * as r from "react";
|
|
3
|
+
import { useTheme as B, useScreenSize as L } from "./hooks.js";
|
|
4
|
+
import { sliderDisabled as W, container as X, targetContainer as _, rangeSlider as q, sliderVariant as F, sliderThumbVariant as G, progress as H } from "./slider.css-mistica.js";
|
|
5
|
+
import V from "classnames";
|
|
6
|
+
import J from "./tooltip.js";
|
|
7
|
+
const K = (param)=>{
|
|
8
|
+
let { disabled: u , steps: t = 1 , max: a = 100 , min: l = 0 , value: o , onChange: d , getStepArrayIndex: f , "arial-label": A , tooltip: $ } = param;
|
|
9
|
+
const { isIos: w } = B(), { isTabletOrSmaller: k } = L(), [i, g] = r.useState(l), [m, C] = r.useState(l), [b, M] = r.useState(a), [N, O] = r.useState(1), h = r.useRef(null), P = r.useMemo(()=>u ? "0.5" : "1", [
|
|
10
|
+
u
|
|
11
|
+
]), j = 0, p = "50%", v = r.useMemo(()=>u && W, [
|
|
12
|
+
u
|
|
13
|
+
]), y = r.useCallback(function() {
|
|
14
|
+
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1;
|
|
15
|
+
if (!h.current) return;
|
|
16
|
+
const s = h.current.getBoundingClientRect(), n = Number(Math.abs(i - m) * 100 / (b - m)), S = 0.2 + (window.innerWidth - s.right) / 100 + (s.left - 0) / 100, x = e ? s.left - 10 - n * S : 10 - n * 0.2;
|
|
17
|
+
return `calc(${n}% + (${x}px))`;
|
|
18
|
+
}, [
|
|
19
|
+
i,
|
|
20
|
+
m,
|
|
21
|
+
b
|
|
22
|
+
]), T = r.useCallback((e)=>{
|
|
23
|
+
let s = e;
|
|
24
|
+
return Array.isArray(t) && (s = t.reduce((n, S)=>Math.abs(S - e) < Math.abs(n - e) ? S : n)), s;
|
|
25
|
+
}, [
|
|
26
|
+
t
|
|
27
|
+
]), D = r.useCallback(()=>{
|
|
28
|
+
Array.isArray(t) && t.sort((e, s)=>e - s);
|
|
29
|
+
}, [
|
|
30
|
+
t
|
|
31
|
+
]), E = (e)=>{
|
|
32
|
+
g(e);
|
|
33
|
+
};
|
|
34
|
+
r.useEffect(()=>{
|
|
35
|
+
d == null || d(i), f == null || f(i);
|
|
36
|
+
}, [
|
|
37
|
+
d,
|
|
38
|
+
f,
|
|
39
|
+
i
|
|
40
|
+
]), r.useEffect(()=>{
|
|
41
|
+
if (Array.isArray(t)) {
|
|
42
|
+
M(t.length - 1);
|
|
43
|
+
let e = 0;
|
|
44
|
+
o !== void 0 && (e = t.indexOf(T(o))), g(e);
|
|
45
|
+
} else {
|
|
46
|
+
C(l), M(a);
|
|
47
|
+
let e = l;
|
|
48
|
+
o !== void 0 && (l > o || o > a) && (e = a < o ? a : l), g(e), O(t);
|
|
49
|
+
}
|
|
50
|
+
}, [
|
|
51
|
+
t,
|
|
52
|
+
a,
|
|
53
|
+
l,
|
|
54
|
+
T,
|
|
55
|
+
o,
|
|
56
|
+
N,
|
|
57
|
+
D
|
|
58
|
+
]);
|
|
59
|
+
const R = ()=>/* @__PURE__ */ c("div", {
|
|
60
|
+
className: _,
|
|
61
|
+
children: /* @__PURE__ */ z("div", {
|
|
62
|
+
ref: h,
|
|
63
|
+
style: {
|
|
64
|
+
opacity: P,
|
|
65
|
+
paddingTop: j
|
|
66
|
+
},
|
|
67
|
+
className: q,
|
|
68
|
+
children: [
|
|
69
|
+
/* @__PURE__ */ c("input", {
|
|
70
|
+
disabled: u,
|
|
71
|
+
style: {
|
|
72
|
+
top: p
|
|
73
|
+
},
|
|
74
|
+
className: V(F[w ? "ios" : "default"], v),
|
|
75
|
+
"aria-label": "Slider",
|
|
76
|
+
type: "range",
|
|
77
|
+
min: m,
|
|
78
|
+
max: b,
|
|
79
|
+
value: i,
|
|
80
|
+
step: N,
|
|
81
|
+
onChange: (e)=>E(+e.target.value)
|
|
82
|
+
}),
|
|
83
|
+
/* @__PURE__ */ c("div", {
|
|
84
|
+
style: {
|
|
85
|
+
left: y(),
|
|
86
|
+
top: p
|
|
87
|
+
},
|
|
88
|
+
className: V(G[w ? "ios" : "default"])
|
|
89
|
+
}),
|
|
90
|
+
/* @__PURE__ */ c("div", {
|
|
91
|
+
className: H,
|
|
92
|
+
style: {
|
|
93
|
+
width: y(),
|
|
94
|
+
top: p
|
|
95
|
+
}
|
|
96
|
+
})
|
|
97
|
+
]
|
|
98
|
+
})
|
|
99
|
+
});
|
|
100
|
+
return /* @__PURE__ */ c("section", {
|
|
101
|
+
className: X,
|
|
102
|
+
"aria-label": A,
|
|
103
|
+
children: $ ? /* @__PURE__ */ c(J, {
|
|
104
|
+
description: Array.isArray(t) ? t[i].toString() : i.toString(),
|
|
105
|
+
width: k ? 42 : 45,
|
|
106
|
+
targetLabel: "",
|
|
107
|
+
textCenter: !0,
|
|
108
|
+
unstable_offsetX: y(!0),
|
|
109
|
+
targetStyle: {
|
|
110
|
+
width: "100%"
|
|
111
|
+
},
|
|
112
|
+
position: "top",
|
|
113
|
+
target: R()
|
|
114
|
+
}) : R()
|
|
115
|
+
});
|
|
116
|
+
}, ee = K;
|
|
117
|
+
export { ee as default };
|