@telefonica/mistica 14.24.1 → 14.25.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/index.d.ts +1 -0
- package/dist/index.js +4 -0
- package/dist/package-version.js +1 -1
- 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/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/utils/locale.d.ts +1 -1
- package/dist-es/index.js +1715 -1714
- package/dist-es/package-version.js +1 -1
- 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/style.css +1 -1
- package/dist-es/tooltip.css-mistica.js +3 -3
- package/dist-es/tooltip.js +65 -64
- package/package.json +1 -1
package/dist-es/tooltip.js
CHANGED
|
@@ -77,22 +77,22 @@ function _object_without_properties_loose(source, excluded) {
|
|
|
77
77
|
}
|
|
78
78
|
return target;
|
|
79
79
|
}
|
|
80
|
-
import { jsxs as P, Fragment as
|
|
80
|
+
import { jsxs as P, Fragment as et, jsx as w } from "react/jsx-runtime";
|
|
81
81
|
import * as o from "react";
|
|
82
82
|
import E from "classnames";
|
|
83
|
-
import { CSSTransition as
|
|
84
|
-
import { useTheme as
|
|
85
|
-
import { Portal as
|
|
86
|
-
import
|
|
83
|
+
import { CSSTransition as rt } from "react-transition-group";
|
|
84
|
+
import { useTheme as nt, useScreenSize as ot, useAriaId as it } from "./hooks.js";
|
|
85
|
+
import { Portal as at } from "./portal.js";
|
|
86
|
+
import ct from "./overlay.js";
|
|
87
87
|
import { Text2 as I } from "./text.js";
|
|
88
|
-
import { TAB as
|
|
89
|
-
import
|
|
90
|
-
import { vars as s, wrapper as
|
|
91
|
-
import { assignInlineVars as
|
|
92
|
-
import { getPrefixedDataAttributes as
|
|
93
|
-
import { isClientSide as
|
|
94
|
-
const
|
|
95
|
-
var { children: r , extra: N , description: S , target: k , title: Y , targetLabel: L , delay: V = !0 , dataAttributes: j , targetStyle: K , unstable_offsetX: f } = _param,
|
|
88
|
+
import { TAB as st } from "./utils/key-codes.js";
|
|
89
|
+
import ut from "./stack.js";
|
|
90
|
+
import { vars as s, wrapper as lt, enter as dt, enterActive as ft, enterDone as ht, exit as wt, exitActive as mt, container as pt, textAlign as gt, textCenter as xt, arrowWrapper as Tt, arrow as vt, fadeInTopKeyframes as bt, fadeInBottomKeyframes as At, fadeInXKeyframes as Pt, arrowTop as St, arrowBottom as Yt, arrowLeft as Ct, arrowRight as Ot } from "./tooltip.css-mistica.js";
|
|
91
|
+
import { assignInlineVars as Rt } from "@vanilla-extract/dynamic";
|
|
92
|
+
import { getPrefixedDataAttributes as yt } from "./utils/dom.js";
|
|
93
|
+
import { isClientSide as Dt, isServerSide as Wt } from "./utils/environment.js";
|
|
94
|
+
const $t = "bottom", Bt = "top", Et = 12, m = 4 + Et, It = 500, v = 12, Mt = 500, M = ()=>{}, Nt = (r)=>r === "bottom" ? `translateY(${v}px)` : r === "top" ? `translateY(calc(-100% - ${v}px))` : r === "right" ? `translateX(${v}px) translateY(-50%)` : r === "left" ? `translateX(-${v}px) translateY(-50%)` : `translateY(-${v}px)`, kt = (r)=>r === "top" ? "translateY(-100%)" : r === "bottom" ? "translateY(0)" : "translateY(-50%)", Lt = (r)=>r === "bottom" ? "translateY(0)" : r === "top" ? "translateY(-100%)" : r === "right" || r === "left" ? "translateX(0px) translateY(-50%)" : "translateY(0px)", Vt = (r)=>r === "top" ? bt : r === "bottom" ? At : Pt, jt = (r)=>r ? "1" : "0.2", Kt = (r)=>r === "top" ? `2px 2px 4px 0 rgba(0, 0, 0, ${s.shadowAlpha})` : r === "right" ? `0 0 4px 0 rgba(0, 0, 0, ${s.shadowAlpha})` : r === "left" ? `0 0 4px 0 rgba(0, 0, 0, ${s.shadowAlpha})` : r === "bottom" ? `-1px -1px 4px 0 rgba(0, 0, 0, ${s.shadowAlpha})` : "", zt = (_param)=>{
|
|
95
|
+
var { children: r , extra: N , description: S , target: k , title: Y , targetLabel: L , delay: V = !0 , dataAttributes: j , targetStyle: K , unstable_offsetX: f , textCenter: z } = _param, y = _object_without_properties(_param, [
|
|
96
96
|
"children",
|
|
97
97
|
"extra",
|
|
98
98
|
"description",
|
|
@@ -102,16 +102,17 @@ const Dt = "bottom", Wt = "top", $t = 12, m = 4 + $t, Bt = 500, v = 12, Et = 500
|
|
|
102
102
|
"delay",
|
|
103
103
|
"dataAttributes",
|
|
104
104
|
"targetStyle",
|
|
105
|
-
"unstable_offsetX"
|
|
105
|
+
"unstable_offsetX",
|
|
106
|
+
"textCenter"
|
|
106
107
|
]);
|
|
107
|
-
const { isDarkMode:
|
|
108
|
+
const { isDarkMode: F } = nt(), [a, C] = o.useState(!1), { isTabletOrSmaller: H } = ot(), D = it(), h = o.useRef(!1), c = o.useRef(null), g = o.useRef(null), O = o.useRef(null), x = o.useRef(null), t = o.useRef({
|
|
108
109
|
top: 0,
|
|
109
110
|
right: 0,
|
|
110
111
|
left: 0,
|
|
111
112
|
bottom: 0,
|
|
112
113
|
width: 0,
|
|
113
114
|
height: 0
|
|
114
|
-
}), [
|
|
115
|
+
}), [X, q] = o.useState({}), G = (n)=>H ? n || Bt : n || $t, [e, J] = o.useState(void 0), i = ((n)=>{
|
|
115
116
|
if (!e) return n;
|
|
116
117
|
const u = (d)=>{
|
|
117
118
|
const p = t.current.top > e.height;
|
|
@@ -123,28 +124,28 @@ const Dt = "bottom", Wt = "top", $t = 12, m = 4 + $t, Bt = 500, v = 12, Et = 500
|
|
|
123
124
|
left: t.current.left < e.width ? t.current.right + e.width > window.innerWidth ? t.current.top < e.height ? "bottom" : "top" : "right" : n,
|
|
124
125
|
bottom: t.current.bottom + e.height > window.innerHeight ? l("top") : l(n)
|
|
125
126
|
})[n];
|
|
126
|
-
})(
|
|
127
|
-
a &&
|
|
127
|
+
})(G(y.position)), R = Dt() ? window.matchMedia("(pointer: coarse)").matches : !1, W = ()=>{
|
|
128
|
+
a && C(!1);
|
|
128
129
|
};
|
|
129
130
|
o.useEffect(()=>(window.addEventListener("resize", W), ()=>{
|
|
130
131
|
window.removeEventListener("resize", W);
|
|
131
132
|
}));
|
|
132
133
|
const $ = ()=>{
|
|
133
|
-
|
|
134
|
+
C(!1);
|
|
134
135
|
}, T = ()=>{
|
|
135
|
-
|
|
136
|
-
},
|
|
136
|
+
O.current && (t.current = O.current.getBoundingClientRect(), C(!a));
|
|
137
|
+
}, Q = ()=>{
|
|
137
138
|
a || T();
|
|
138
|
-
}, Q = (n)=>{
|
|
139
|
-
n.keyCode === ct && $();
|
|
140
139
|
}, U = (n)=>{
|
|
140
|
+
n.keyCode === st && $();
|
|
141
|
+
}, Z = (n)=>{
|
|
141
142
|
if (!e) return {};
|
|
142
143
|
const u = e.width > t.current.width && t.current.left + t.current.width / 2 < e.width / 2 + 16 ? t.current.width / 2 : "50%";
|
|
143
144
|
return n === "bottom" || n === "top" ? {
|
|
144
145
|
left: u
|
|
145
146
|
} : {};
|
|
146
147
|
}, B = o.useCallback((n, u)=>{
|
|
147
|
-
if (
|
|
148
|
+
if (Wt() || !e) return {};
|
|
148
149
|
const l = e.width > t.current.width && t.current.left + t.current.width / 2 < e.width / 2 + 16 ? Math.round(e.width / 2 - t.current.width / 2) : 0, A = f || (u ? window.pageXOffset + t.current.left + t.current.width / 2 - u / 2 : window.pageXOffset + t.current.left + l + t.current.width / 2 - e.width / 2), d = t.current.left < e.width ? A : u ? t.current.left - u - m : t.current.left - e.width - m, p = t.current.left < e.width ? t.current.top < e.height ? window.pageYOffset + t.current.bottom + m : window.pageYOffset + t.current.top - m : f || window.pageYOffset + t.current.top + t.current.height / 2;
|
|
149
150
|
return ({
|
|
150
151
|
right: {
|
|
@@ -167,42 +168,42 @@ const Dt = "bottom", Wt = "top", $t = 12, m = 4 + $t, Bt = 500, v = 12, Et = 500
|
|
|
167
168
|
}, [
|
|
168
169
|
f,
|
|
169
170
|
e
|
|
170
|
-
]), b = (()=>
|
|
171
|
-
top:
|
|
172
|
-
bottom:
|
|
173
|
-
left:
|
|
174
|
-
right:
|
|
175
|
-
},
|
|
176
|
-
[s.enterTransform]:
|
|
177
|
-
[s.exitTransform]:
|
|
178
|
-
[s.enterActiveAnimationName]:
|
|
179
|
-
[s.enterDoneTransform]:
|
|
180
|
-
[s.shadowAlpha]:
|
|
181
|
-
[s.arrowBoxShadow]:
|
|
171
|
+
]), b = (()=>y.width)(), _ = {
|
|
172
|
+
top: St,
|
|
173
|
+
bottom: Yt,
|
|
174
|
+
left: Ct,
|
|
175
|
+
right: Ot
|
|
176
|
+
}, tt = i && Rt({
|
|
177
|
+
[s.enterTransform]: Nt(i),
|
|
178
|
+
[s.exitTransform]: Lt(i),
|
|
179
|
+
[s.enterActiveAnimationName]: Vt(i),
|
|
180
|
+
[s.enterDoneTransform]: kt(i),
|
|
181
|
+
[s.shadowAlpha]: jt(F),
|
|
182
|
+
[s.arrowBoxShadow]: Kt(i)
|
|
182
183
|
});
|
|
183
184
|
return o.useEffect(()=>{
|
|
184
|
-
i && x.current && a &&
|
|
185
|
+
i && x.current && a && q(B(i, b || 0));
|
|
185
186
|
}, [
|
|
186
187
|
a,
|
|
187
188
|
B,
|
|
188
189
|
i,
|
|
189
190
|
b
|
|
190
191
|
]), o.useEffect(()=>{
|
|
191
|
-
x.current && (x.current.getBoundingClientRect(), a &&
|
|
192
|
+
x.current && (x.current.getBoundingClientRect(), a && J(x.current.getBoundingClientRect()));
|
|
192
193
|
}, [
|
|
193
194
|
a
|
|
194
|
-
]), /* @__PURE__ */ P(
|
|
195
|
+
]), /* @__PURE__ */ P(et, {
|
|
195
196
|
children: [
|
|
196
197
|
/* @__PURE__ */ w("div", {
|
|
197
|
-
ref:
|
|
198
|
+
ref: O,
|
|
198
199
|
style: K,
|
|
199
|
-
className:
|
|
200
|
+
className: lt,
|
|
200
201
|
onPointerOver: ()=>{
|
|
201
202
|
c.current && (clearTimeout(c.current), c.current = null), !h.current && (h.current = !0, V ? g.current = setTimeout(()=>{
|
|
202
203
|
g.current = null, T();
|
|
203
|
-
},
|
|
204
|
+
}, Mt) : T());
|
|
204
205
|
},
|
|
205
|
-
onPointerLeave:
|
|
206
|
+
onPointerLeave: R ? M : ()=>{
|
|
206
207
|
if (g.current) {
|
|
207
208
|
clearTimeout(g.current), g.current = null, h.current = !1;
|
|
208
209
|
return;
|
|
@@ -211,8 +212,8 @@ const Dt = "bottom", Wt = "top", $t = 12, m = 4 + $t, Bt = 500, v = 12, Et = 500
|
|
|
211
212
|
h.current && (c.current = null, h.current = !1, T());
|
|
212
213
|
}, 100);
|
|
213
214
|
},
|
|
214
|
-
onFocus:
|
|
215
|
-
onKeyDown:
|
|
215
|
+
onFocus: Q,
|
|
216
|
+
onKeyDown: U,
|
|
216
217
|
"touch-action": "auto",
|
|
217
218
|
role: "button",
|
|
218
219
|
tabIndex: 0,
|
|
@@ -221,48 +222,48 @@ const Dt = "bottom", Wt = "top", $t = 12, m = 4 + $t, Bt = 500, v = 12, Et = 500
|
|
|
221
222
|
"aria-label": L,
|
|
222
223
|
children: k
|
|
223
224
|
}),
|
|
224
|
-
/* @__PURE__ */ P(
|
|
225
|
+
/* @__PURE__ */ P(at, {
|
|
225
226
|
children: [
|
|
226
|
-
a &&
|
|
227
|
+
a && R && /* @__PURE__ */ w(ct, {
|
|
227
228
|
onPress: $
|
|
228
229
|
}),
|
|
229
|
-
/* @__PURE__ */ w(
|
|
230
|
+
/* @__PURE__ */ w(rt, {
|
|
230
231
|
in: a,
|
|
231
|
-
timeout:
|
|
232
|
+
timeout: It,
|
|
232
233
|
classNames: {
|
|
233
|
-
enter:
|
|
234
|
-
enterActive:
|
|
235
|
-
enterDone:
|
|
236
|
-
exit:
|
|
237
|
-
exitActive:
|
|
234
|
+
enter: dt,
|
|
235
|
+
enterActive: ft,
|
|
236
|
+
enterDone: ht,
|
|
237
|
+
exit: wt,
|
|
238
|
+
exitActive: mt
|
|
238
239
|
},
|
|
239
240
|
unmountOnExit: !0,
|
|
240
241
|
children: /* @__PURE__ */ P("div", _object_spread_props(_object_spread({
|
|
241
242
|
ref: x
|
|
242
|
-
},
|
|
243
|
+
}, yt(j, "Tooltip")), {
|
|
243
244
|
role: "tooltip",
|
|
244
245
|
id: D,
|
|
245
|
-
className: E(
|
|
246
|
+
className: E(pt, gt, z ? xt : ""),
|
|
246
247
|
style: _object_spread({
|
|
247
248
|
width: b
|
|
248
|
-
},
|
|
249
|
+
}, X, tt),
|
|
249
250
|
onPointerOver: ()=>{
|
|
250
251
|
c.current && (clearTimeout(c.current), c.current = null);
|
|
251
252
|
},
|
|
252
|
-
onPointerLeave:
|
|
253
|
+
onPointerLeave: R ? M : ()=>{
|
|
253
254
|
c.current = setTimeout(()=>{
|
|
254
255
|
h.current && (c.current = null, h.current = !1, T());
|
|
255
256
|
}, 100);
|
|
256
257
|
},
|
|
257
258
|
children: [
|
|
258
259
|
/* @__PURE__ */ w("div", {
|
|
259
|
-
style:
|
|
260
|
-
className: E(
|
|
260
|
+
style: Z(i),
|
|
261
|
+
className: E(Tt, _[i]),
|
|
261
262
|
children: /* @__PURE__ */ w("div", {
|
|
262
|
-
className:
|
|
263
|
+
className: vt
|
|
263
264
|
})
|
|
264
265
|
}),
|
|
265
|
-
(Y || S) && /* @__PURE__ */ P(
|
|
266
|
+
(Y || S) && /* @__PURE__ */ P(ut, {
|
|
266
267
|
space: 4,
|
|
267
268
|
children: [
|
|
268
269
|
Y && /* @__PURE__ */ w(I, {
|
|
@@ -283,5 +284,5 @@ const Dt = "bottom", Wt = "top", $t = 12, m = 4 + $t, Bt = 500, v = 12, Et = 500
|
|
|
283
284
|
})
|
|
284
285
|
]
|
|
285
286
|
});
|
|
286
|
-
},
|
|
287
|
-
export {
|
|
287
|
+
}, ae = zt;
|
|
288
|
+
export { ae as default };
|