@telefonica/mistica 15.9.0 → 15.11.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/boxed.css-mistica.js +35 -2
- package/dist/boxed.css.d.ts +29 -0
- package/dist/boxed.d.ts +6 -4
- package/dist/boxed.js +30 -24
- package/dist/button-group.css-mistica.js +14 -5
- package/dist/button-group.css.d.ts +3 -0
- package/dist/button-group.d.ts +2 -1
- package/dist/button-group.js +29 -16
- package/dist/button-layout.css-mistica.js +7 -7
- package/dist/button-layout.css.d.ts +1 -1
- package/dist/button-layout.js +9 -9
- package/dist/button.d.ts +4 -24
- package/dist/button.js +6 -4
- package/dist/card.d.ts +8 -1
- package/dist/card.js +567 -501
- package/dist/carousel.css-mistica.js +19 -16
- package/dist/carousel.css.d.ts +1 -0
- package/dist/carousel.js +41 -39
- package/dist/chip.js +37 -44
- package/dist/circle.d.ts +11 -4
- package/dist/circle.js +10 -11
- package/dist/community/advanced-data-card.css-mistica.js +24 -21
- package/dist/community/advanced-data-card.css.d.ts +1 -0
- package/dist/community/advanced-data-card.d.ts +1 -0
- package/dist/community/advanced-data-card.js +20 -17
- package/dist/counter.js +26 -22
- package/dist/cover-hero-media.d.ts +12 -0
- package/dist/cover-hero-media.js +44 -0
- package/dist/cover-hero.css-mistica.js +56 -0
- package/dist/cover-hero.css.d.ts +14 -0
- package/dist/cover-hero.css.ts.vanilla.css-mistica.js +11 -0
- package/dist/cover-hero.d.ts +38 -0
- package/dist/cover-hero.js +296 -0
- package/dist/empty-state.js +6 -6
- package/dist/grid-layout.css-mistica.js +11 -8
- package/dist/grid-layout.css.d.ts +1 -0
- package/dist/grid-layout.d.ts +12 -22
- package/dist/grid-layout.js +63 -49
- package/dist/header.js +18 -18
- package/dist/highlighted-card.d.ts +1 -0
- package/dist/highlighted-card.js +22 -18
- package/dist/icon-button.d.ts +7 -6
- package/dist/image.js +69 -48
- package/dist/index.d.ts +4 -1
- package/dist/index.js +15 -0
- package/dist/list.d.ts +1 -0
- package/dist/navigation-bar.d.ts +1 -1
- package/dist/navigation-bar.js +1 -1
- package/dist/package-version.js +1 -1
- package/dist/select.js +16 -12
- package/dist/skins/movistar.d.ts +13 -0
- package/dist/skins/movistar.js +112 -99
- package/dist/spinner.js +19 -18
- package/dist/table.css-mistica.js +58 -0
- package/dist/table.css.d.ts +13 -0
- package/dist/table.css.ts.vanilla.css-mistica.js +11 -0
- package/dist/table.d.ts +39 -0
- package/dist/table.js +269 -0
- package/dist/text.d.ts +1 -1
- package/dist/theme.d.ts +20 -0
- package/dist/theme.js +80 -20
- package/dist/timer.css-mistica.js +39 -0
- package/dist/timer.css.d.ts +8 -0
- package/dist/timer.css.ts.vanilla.css-mistica.js +11 -0
- package/dist/timer.d.ts +27 -0
- package/dist/timer.js +370 -0
- package/dist/tooltip.js +13 -13
- package/dist/touchable.d.ts +2 -0
- package/dist/touchable.js +35 -31
- package/dist/utils/helpers.js +32 -32
- package/dist-es/boxed.css-mistica.js +29 -2
- package/dist-es/boxed.js +37 -31
- package/dist-es/button-group.css-mistica.js +2 -2
- package/dist-es/button-group.js +37 -24
- package/dist-es/button-layout.css-mistica.js +2 -2
- package/dist-es/button-layout.js +16 -16
- package/dist-es/button.js +24 -22
- package/dist-es/card.js +681 -618
- package/dist-es/carousel.css-mistica.js +7 -7
- package/dist-es/carousel.js +75 -73
- package/dist-es/chip.js +57 -64
- package/dist-es/circle.js +15 -16
- package/dist-es/community/advanced-data-card.css-mistica.js +4 -4
- package/dist-es/community/advanced-data-card.js +59 -56
- package/dist-es/counter.js +62 -58
- package/dist-es/cover-hero-media.js +30 -0
- package/dist-es/cover-hero.css-mistica.js +9 -0
- package/dist-es/cover-hero.css.ts.vanilla.css-mistica.js +2 -0
- package/dist-es/cover-hero.js +241 -0
- package/dist-es/empty-state.js +13 -13
- package/dist-es/grid-layout.css-mistica.js +3 -3
- package/dist-es/grid-layout.js +80 -66
- package/dist-es/header.js +37 -37
- package/dist-es/highlighted-card.js +35 -31
- package/dist-es/image.js +88 -67
- package/dist-es/index.js +1817 -1814
- package/dist-es/navigation-bar.js +1 -1
- package/dist-es/package-version.js +1 -1
- package/dist-es/select.js +23 -18
- package/dist-es/skins/movistar.js +112 -99
- package/dist-es/spinner.js +38 -37
- package/dist-es/style.css +1 -1
- package/dist-es/table.css-mistica.js +14 -0
- package/dist-es/table.css.ts.vanilla.css-mistica.js +2 -0
- package/dist-es/table.js +214 -0
- package/dist-es/theme.js +77 -17
- package/dist-es/timer.css-mistica.js +4 -0
- package/dist-es/timer.css.ts.vanilla.css-mistica.js +2 -0
- package/dist-es/timer.js +307 -0
- package/dist-es/tooltip.js +16 -16
- package/dist-es/touchable.js +47 -43
- package/dist-es/utils/helpers.js +31 -31
- package/package.json +1 -1
package/dist-es/timer.js
ADDED
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
function _define_property(obj, key, value) {
|
|
3
|
+
if (key in obj) {
|
|
4
|
+
Object.defineProperty(obj, key, {
|
|
5
|
+
value: value,
|
|
6
|
+
enumerable: true,
|
|
7
|
+
configurable: true,
|
|
8
|
+
writable: true
|
|
9
|
+
});
|
|
10
|
+
} else {
|
|
11
|
+
obj[key] = value;
|
|
12
|
+
}
|
|
13
|
+
return obj;
|
|
14
|
+
}
|
|
15
|
+
function _object_spread(target) {
|
|
16
|
+
for(var i = 1; i < arguments.length; i++){
|
|
17
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
18
|
+
var ownKeys = Object.keys(source);
|
|
19
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
20
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
21
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
ownKeys.forEach(function(key) {
|
|
25
|
+
_define_property(target, key, source[key]);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return target;
|
|
29
|
+
}
|
|
30
|
+
function ownKeys(object, enumerableOnly) {
|
|
31
|
+
var keys = Object.keys(object);
|
|
32
|
+
if (Object.getOwnPropertySymbols) {
|
|
33
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
34
|
+
if (enumerableOnly) {
|
|
35
|
+
symbols = symbols.filter(function(sym) {
|
|
36
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
keys.push.apply(keys, symbols);
|
|
40
|
+
}
|
|
41
|
+
return keys;
|
|
42
|
+
}
|
|
43
|
+
function _object_spread_props(target, source) {
|
|
44
|
+
source = source != null ? source : {};
|
|
45
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
46
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
47
|
+
} else {
|
|
48
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
49
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return target;
|
|
53
|
+
}
|
|
54
|
+
import { jsxs as M, jsx as c } from "react/jsx-runtime";
|
|
55
|
+
import H from "classnames";
|
|
56
|
+
import * as N from "react";
|
|
57
|
+
import B from "./box.js";
|
|
58
|
+
import { useTheme as C, useAriaId as x, useIsomorphicLayoutEffect as z } from "./hooks.js";
|
|
59
|
+
import G from "./inline.js";
|
|
60
|
+
import F from "./screen-reader-only.js";
|
|
61
|
+
import { Text2 as J, Text6 as K } from "./text.js";
|
|
62
|
+
import { useThemeVariant as Q, ThemeVariant as X } from "./theme-variant-context.js";
|
|
63
|
+
import { inlineText as O, timerWrapper as Z, shortLabelText as P, boxedTimerValueContainer as U, boxedTimerValueContainerInverse as ee, timerDisplayValue as te, boxedTimerDisplayValue as ne, unitContainer as j } from "./timer.css-mistica.js";
|
|
64
|
+
import { getPrefixedDataAttributes as w } from "./utils/dom.js";
|
|
65
|
+
import { isEqual as re } from "./utils/helpers.js";
|
|
66
|
+
import { isRunningAcceptanceTest as W } from "./utils/platform.js";
|
|
67
|
+
const V = 24, $ = 60, T = 60, _ = 1e3, Y = T * _, k = $ * Y, se = V * k, R = (n, s, a, u)=>{
|
|
68
|
+
s = u === "none" && s === "days" ? "hours" : s, a = u === "none" && a === "days" ? "hours" : a;
|
|
69
|
+
const i = [
|
|
70
|
+
"seconds",
|
|
71
|
+
"minutes",
|
|
72
|
+
"hours",
|
|
73
|
+
"days"
|
|
74
|
+
], d = i.indexOf(s), g = Math.max(i.indexOf(a), d), e = i.indexOf(n);
|
|
75
|
+
return d <= e && e <= g;
|
|
76
|
+
}, E = (n, s, a, u)=>[
|
|
77
|
+
{
|
|
78
|
+
unit: "days",
|
|
79
|
+
value: n.days
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
unit: "hours",
|
|
83
|
+
value: n.hours
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
unit: "minutes",
|
|
87
|
+
value: n.minutes
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
unit: "seconds",
|
|
91
|
+
value: n.seconds
|
|
92
|
+
}
|
|
93
|
+
].filter((i)=>R(i.unit, s, a, u)), A = (n)=>W() ? 0 : Math.max(0, (typeof n == "object" ? n : new Date(n)).valueOf() - Date.now()), q = (param)=>{
|
|
94
|
+
let { endTimestamp: n, labelType: s, minTimeUnit: a, maxTimeUnit: u, onProgress: i } = param;
|
|
95
|
+
const [d, g] = N.useState(A(n));
|
|
96
|
+
z(()=>{
|
|
97
|
+
let v;
|
|
98
|
+
const D = ()=>{
|
|
99
|
+
const I = A(n);
|
|
100
|
+
g(I), I || clearInterval(v);
|
|
101
|
+
};
|
|
102
|
+
if (!W()) return D(), v = setInterval(D, _), ()=>clearInterval(v);
|
|
103
|
+
}, [
|
|
104
|
+
n
|
|
105
|
+
]);
|
|
106
|
+
const e = R("days", a, u, s), S = R("hours", a, u, s), l = R("minutes", a, u, s), m = e ? "days" : S ? "hours" : l ? "minutes" : "seconds", y = Math.floor(d / k) % 24, p = Math.floor(d / Y) % 60, f = Math.floor(d / _) % 60, h = Math.floor(d / se), L = m === "hours" ? y + h * V : y, t = m === "minutes" ? p + $ * (h * V + L) : p, r = m === "seconds" ? f + T * (h * V * $ + L * $ + t) : f, [o, b] = N.useState(E({
|
|
107
|
+
days: h,
|
|
108
|
+
hours: L,
|
|
109
|
+
minutes: t,
|
|
110
|
+
seconds: r
|
|
111
|
+
}, a, u, s));
|
|
112
|
+
return N.useEffect(()=>{
|
|
113
|
+
const v = E({
|
|
114
|
+
days: h,
|
|
115
|
+
hours: L,
|
|
116
|
+
minutes: t,
|
|
117
|
+
seconds: r
|
|
118
|
+
}, a, u, s);
|
|
119
|
+
if (!re(v, o)) {
|
|
120
|
+
b(v);
|
|
121
|
+
const D = {};
|
|
122
|
+
v.forEach((I)=>D[I.unit] = I.value), i == null || i(D);
|
|
123
|
+
}
|
|
124
|
+
}, [
|
|
125
|
+
h,
|
|
126
|
+
L,
|
|
127
|
+
t,
|
|
128
|
+
r,
|
|
129
|
+
s,
|
|
130
|
+
a,
|
|
131
|
+
u,
|
|
132
|
+
o,
|
|
133
|
+
i
|
|
134
|
+
]), o;
|
|
135
|
+
}, fe = (param)=>{
|
|
136
|
+
let { endTimestamp: n, labelType: s = "none", minTimeUnit: a, maxTimeUnit: u, onProgress: i, dataAttributes: d, "aria-label": g } = param;
|
|
137
|
+
const { texts: e } = C(), S = x(), l = q({
|
|
138
|
+
endTimestamp: n,
|
|
139
|
+
labelType: s,
|
|
140
|
+
minTimeUnit: a,
|
|
141
|
+
maxTimeUnit: u,
|
|
142
|
+
onProgress: i
|
|
143
|
+
}), m = {
|
|
144
|
+
days: e.timerDaysShortLabel,
|
|
145
|
+
hours: e.timerHoursShortLabel,
|
|
146
|
+
minutes: e.timerMinutesShortLabel,
|
|
147
|
+
seconds: e.timerSecondsShortLabel
|
|
148
|
+
}, y = {
|
|
149
|
+
days: e.timerDayLongLabel,
|
|
150
|
+
hours: e.timerHourLongLabel,
|
|
151
|
+
minutes: e.timerMinuteLongLabel,
|
|
152
|
+
seconds: e.timerSecondLongLabel
|
|
153
|
+
}, p = {
|
|
154
|
+
days: e.timerDaysLongLabel,
|
|
155
|
+
hours: e.timerHoursLongLabel,
|
|
156
|
+
minutes: e.timerMinutesLongLabel,
|
|
157
|
+
seconds: e.timerSecondsLongLabel
|
|
158
|
+
}, f = (t)=>{
|
|
159
|
+
const r = Math.max(String(t).length, s === "long" ? 1 : 2);
|
|
160
|
+
return /* @__PURE__ */ c("span", {
|
|
161
|
+
className: j,
|
|
162
|
+
style: {
|
|
163
|
+
minWidth: `${r}ch`
|
|
164
|
+
},
|
|
165
|
+
children: String(t).padStart(r, "0")
|
|
166
|
+
});
|
|
167
|
+
}, h = ()=>{
|
|
168
|
+
switch(s){
|
|
169
|
+
case "none":
|
|
170
|
+
return l.map((t, r)=>/* @__PURE__ */ M(N.Fragment, {
|
|
171
|
+
children: [
|
|
172
|
+
r > 0 && ":",
|
|
173
|
+
f(t.value)
|
|
174
|
+
]
|
|
175
|
+
}, r));
|
|
176
|
+
case "short":
|
|
177
|
+
return l.map((t, r)=>/* @__PURE__ */ M(N.Fragment, {
|
|
178
|
+
children: [
|
|
179
|
+
r > 0 && " ",
|
|
180
|
+
/* @__PURE__ */ M("span", {
|
|
181
|
+
className: P,
|
|
182
|
+
children: [
|
|
183
|
+
f(t.value),
|
|
184
|
+
` ${m[t.unit]}`
|
|
185
|
+
]
|
|
186
|
+
})
|
|
187
|
+
]
|
|
188
|
+
}, r));
|
|
189
|
+
case "long":
|
|
190
|
+
default:
|
|
191
|
+
return l.map((t, r)=>/* @__PURE__ */ M(N.Fragment, {
|
|
192
|
+
children: [
|
|
193
|
+
r > 0 && " ",
|
|
194
|
+
f(t.value),
|
|
195
|
+
` ${t.value === 1 ? y[t.unit] : p[t.unit]}`,
|
|
196
|
+
r === l.length - 2 && ` ${e.timerAnd}`,
|
|
197
|
+
r < l.length - 2 && ","
|
|
198
|
+
]
|
|
199
|
+
}, r));
|
|
200
|
+
}
|
|
201
|
+
}, L = l.map((t, r)=>`${t.value} ${t.value === 1 ? y[t.unit] : p[t.unit]}${r === l.length - 1 ? "" : r === l.length - 2 ? ` ${e.timerAnd} ` : ", "}`).join("");
|
|
202
|
+
return /* @__PURE__ */ M("span", _object_spread_props(_object_spread({
|
|
203
|
+
role: "timer",
|
|
204
|
+
"aria-labelledby": S,
|
|
205
|
+
className: O,
|
|
206
|
+
style: {
|
|
207
|
+
// try to keep the timer in the same line without wrapping only when label is not long
|
|
208
|
+
display: s !== "long" ? "inline-block" : void 0
|
|
209
|
+
}
|
|
210
|
+
}, w(d, "TextTimer")), {
|
|
211
|
+
children: [
|
|
212
|
+
/* @__PURE__ */ c(F, {
|
|
213
|
+
children: /* @__PURE__ */ c("span", {
|
|
214
|
+
id: S,
|
|
215
|
+
children: g ? `${g}. ${L}` : L
|
|
216
|
+
})
|
|
217
|
+
}),
|
|
218
|
+
/* @__PURE__ */ c("span", {
|
|
219
|
+
"aria-hidden": !0,
|
|
220
|
+
className: O,
|
|
221
|
+
children: h()
|
|
222
|
+
})
|
|
223
|
+
]
|
|
224
|
+
}));
|
|
225
|
+
}, Se = (param)=>{
|
|
226
|
+
let { boxed: n, endTimestamp: s, minTimeUnit: a, maxTimeUnit: u, onProgress: i, dataAttributes: d, "aria-label": g } = param;
|
|
227
|
+
const { texts: e } = C(), S = x(), l = Q(), m = q({
|
|
228
|
+
endTimestamp: s,
|
|
229
|
+
minTimeUnit: a,
|
|
230
|
+
maxTimeUnit: u,
|
|
231
|
+
onProgress: i
|
|
232
|
+
}), y = {
|
|
233
|
+
days: e.timerDayLongLabel,
|
|
234
|
+
hours: e.timerHourLongLabel,
|
|
235
|
+
minutes: e.timerDisplayMinutesLabel,
|
|
236
|
+
seconds: e.timerDisplaySecondsLabel
|
|
237
|
+
}, p = {
|
|
238
|
+
days: e.timerDaysLongLabel,
|
|
239
|
+
hours: e.timerHoursLongLabel,
|
|
240
|
+
minutes: e.timerDisplayMinutesLabel,
|
|
241
|
+
seconds: e.timerDisplaySecondsLabel
|
|
242
|
+
}, f = {
|
|
243
|
+
days: e.timerDayLongLabel,
|
|
244
|
+
hours: e.timerHourLongLabel,
|
|
245
|
+
minutes: e.timerMinuteLongLabel,
|
|
246
|
+
seconds: e.timerSecondLongLabel
|
|
247
|
+
}, h = {
|
|
248
|
+
days: e.timerDaysLongLabel,
|
|
249
|
+
hours: e.timerHoursLongLabel,
|
|
250
|
+
minutes: e.timerMinutesLongLabel,
|
|
251
|
+
seconds: e.timerSecondsLongLabel
|
|
252
|
+
}, L = (o)=>{
|
|
253
|
+
const b = Math.max(String(o).length, 2);
|
|
254
|
+
return /* @__PURE__ */ c(K, {
|
|
255
|
+
children: /* @__PURE__ */ c("div", {
|
|
256
|
+
className: j,
|
|
257
|
+
style: {
|
|
258
|
+
minWidth: `${b}ch`
|
|
259
|
+
},
|
|
260
|
+
children: String(o).padStart(b, "0")
|
|
261
|
+
})
|
|
262
|
+
});
|
|
263
|
+
}, t = m.map((o, b)=>`${o.value} ${o.value === 1 ? f[o.unit] : h[o.unit]}${b === m.length - 1 ? "" : b === m.length - 2 ? ` ${e.timerAnd} ` : ", "}`).join(""), r = ()=>m.map((o, b)=>/* @__PURE__ */ c(B, {
|
|
264
|
+
className: H({
|
|
265
|
+
[U]: l === "default" && n,
|
|
266
|
+
[ee]: l !== "default" && n
|
|
267
|
+
}),
|
|
268
|
+
children: /* @__PURE__ */ c(X, {
|
|
269
|
+
variant: n ? "default" : l,
|
|
270
|
+
children: /* @__PURE__ */ M("div", {
|
|
271
|
+
className: H(te, {
|
|
272
|
+
[ne]: n
|
|
273
|
+
}),
|
|
274
|
+
children: [
|
|
275
|
+
L(o.value),
|
|
276
|
+
/* @__PURE__ */ c(J, {
|
|
277
|
+
regular: !0,
|
|
278
|
+
children: o.value === 1 ? y[o.unit] : p[o.unit]
|
|
279
|
+
})
|
|
280
|
+
]
|
|
281
|
+
})
|
|
282
|
+
})
|
|
283
|
+
}, b));
|
|
284
|
+
return /* @__PURE__ */ M("div", _object_spread_props(_object_spread({
|
|
285
|
+
role: "timer",
|
|
286
|
+
"aria-labelledby": S,
|
|
287
|
+
className: Z
|
|
288
|
+
}, w(d, "Timer")), {
|
|
289
|
+
children: [
|
|
290
|
+
/* @__PURE__ */ c(F, {
|
|
291
|
+
children: /* @__PURE__ */ c("span", {
|
|
292
|
+
id: S,
|
|
293
|
+
children: g ? `${g}. ${t}` : t
|
|
294
|
+
})
|
|
295
|
+
}),
|
|
296
|
+
/* @__PURE__ */ c("div", {
|
|
297
|
+
"aria-hidden": !0,
|
|
298
|
+
children: /* @__PURE__ */ c(G, {
|
|
299
|
+
space: n ? 8 : 16,
|
|
300
|
+
wrap: !0,
|
|
301
|
+
children: r()
|
|
302
|
+
})
|
|
303
|
+
})
|
|
304
|
+
]
|
|
305
|
+
}));
|
|
306
|
+
};
|
|
307
|
+
export { fe as TextTimer, Se as Timer };
|
package/dist-es/tooltip.js
CHANGED
|
@@ -83,7 +83,7 @@ import * as i from "react";
|
|
|
83
83
|
import { useTheme as Tt, useAriaId as gt, useBoundingRect as it, useWindowSize as vt } from "./hooks.js";
|
|
84
84
|
import { Portal as xt } from "./portal.js";
|
|
85
85
|
import { Transition as bt } from "react-transition-group";
|
|
86
|
-
import { content as Mt, CONTENT_MIN_WIDTH as Et, container as St, tooltipTransitionClasses as
|
|
86
|
+
import { content as Mt, CONTENT_MIN_WIDTH as Et, container as St, tooltipTransitionClasses as wt, tooltip as It, contentContainer as Ot, tooltipCenter as Rt, closeButtonIcon as _t, arrowContainer as Nt, arrow as Ct } from "./tooltip.css-mistica.js";
|
|
87
87
|
import yt from "./stack.js";
|
|
88
88
|
import { Text2 as nt } from "./text.js";
|
|
89
89
|
import { getCssVarValue as kt } from "./utils/dom.js";
|
|
@@ -96,21 +96,21 @@ import { useIsInverseVariant as Ft, ThemeVariant as Dt } from "./theme-variant-c
|
|
|
96
96
|
import { combineRefs as Bt } from "./utils/common.js";
|
|
97
97
|
import { useTooltipState as Wt, useSetTooltipState as Vt } from "./tooltip-context-provider.js";
|
|
98
98
|
import { isRunningAcceptanceTest as Ht } from "./utils/platform.js";
|
|
99
|
-
import {
|
|
99
|
+
import { IconButton as Xt } from "./icon-button.js";
|
|
100
100
|
import zt from "./generated/mistica-icons/icon-close-regular.js";
|
|
101
101
|
import Pt from "./box.js";
|
|
102
102
|
const lt = (t)=>({
|
|
103
103
|
border: `1px solid ${t ? tt.colors.backgroundContainer : tt.colors.border}`
|
|
104
|
-
}), ct = 496, Yt = 300, Gt = 500, Kt = 100, p = 20,
|
|
104
|
+
}), ct = 496, Yt = 300, Gt = 500, Kt = 100, p = 20, w = 6, N = w + p / 2 + 1, Ut = (t)=>{
|
|
105
105
|
switch(t){
|
|
106
106
|
case "left":
|
|
107
|
-
return `translateX(-${
|
|
107
|
+
return `translateX(-${w}px)`;
|
|
108
108
|
case "right":
|
|
109
|
-
return `translateX(${
|
|
109
|
+
return `translateX(${w}px)`;
|
|
110
110
|
case "top":
|
|
111
|
-
return `translateY(-${
|
|
111
|
+
return `translateY(-${w}px)`;
|
|
112
112
|
case "bottom":
|
|
113
|
-
return `translateY(${
|
|
113
|
+
return `translateY(${w}px)`;
|
|
114
114
|
default:
|
|
115
115
|
return "";
|
|
116
116
|
}
|
|
@@ -122,7 +122,7 @@ const lt = (t)=>({
|
|
|
122
122
|
};
|
|
123
123
|
}, ft = (t, h, v, d, m)=>{
|
|
124
124
|
if (!t || !h) return;
|
|
125
|
-
const { top: x, bottom:
|
|
125
|
+
const { top: x, bottom: I, left: B, right: W } = t, o = d - I, O = m - W, R = x, a = B, { width: X, height: V } = pt(h), _ = X + N, T = V + N, b = _ <= Math.max(a, O), M = T <= Math.max(o, R);
|
|
126
126
|
if (!(!M && !b)) switch(v){
|
|
127
127
|
case "left":
|
|
128
128
|
return b ? _ <= a ? "left" : "right" : o > R ? "bottom" : "top";
|
|
@@ -136,7 +136,7 @@ const lt = (t)=>({
|
|
|
136
136
|
return;
|
|
137
137
|
}
|
|
138
138
|
}, jt = (param)=>{
|
|
139
|
-
let { content: t, target: h, width: v, position: d = "top", dataAttributes: m, delay: x = !0, centerContent:
|
|
139
|
+
let { content: t, target: h, width: v, position: d = "top", dataAttributes: m, delay: x = !0, centerContent: I, open: B, onClose: W, hasPointerInteractionOnly: o = !1, trackingEvent: O } = param;
|
|
140
140
|
const { texts: R } = Tt(), a = gt(), { openTooltipId: X } = Wt(), { openTooltip: V, closeTooltip: _ } = Vt(), [T, b] = i.useState(), [M, z] = i.useState(), P = i.useRef(null), Y = i.useRef(null), [C, dt] = i.useState(null), u = $t(), G = x ? Gt : 0, [et, K] = i.useState(!1), [U, y] = i.useState(!1), j = B !== void 0, [ot, q] = i.useState(!1), E = j ? B : a === X, Z = Ft(), f = it(P, E), H = it(Y, E, !0), l = vt(), S = i.useCallback(()=>{
|
|
141
141
|
q(!1), K(!1), y(!1);
|
|
142
142
|
}, []);
|
|
@@ -169,7 +169,7 @@ const lt = (t)=>({
|
|
|
169
169
|
case "bottom":
|
|
170
170
|
r = {
|
|
171
171
|
left: Math.max(0, Math.min(rt, (c + k - $) / 2)),
|
|
172
|
-
top: A -
|
|
172
|
+
top: A - w,
|
|
173
173
|
padding: `${N}px 0px 0px 0px`
|
|
174
174
|
}, e = {
|
|
175
175
|
left: Math.max(g, Math.min(l.width - g - p, (c + k - p) / 2)),
|
|
@@ -192,7 +192,7 @@ const lt = (t)=>({
|
|
|
192
192
|
case "right":
|
|
193
193
|
default:
|
|
194
194
|
r = {
|
|
195
|
-
left: k -
|
|
195
|
+
left: k - w,
|
|
196
196
|
top: Math.max(0, Math.min(st, (L + A - F) / 2)),
|
|
197
197
|
padding: `0px 0px 0px ${N}px`
|
|
198
198
|
}, e = {
|
|
@@ -251,7 +251,7 @@ const lt = (t)=>({
|
|
|
251
251
|
_,
|
|
252
252
|
j
|
|
253
253
|
]);
|
|
254
|
-
const mt = ft(f, C, d, l.height, l.width), ut =
|
|
254
|
+
const mt = ft(f, C, d, l.height, l.width), ut = I !== void 0 ? I : (H == null ? void 0 : H.width) === Et;
|
|
255
255
|
return /* @__PURE__ */ D(ht, {
|
|
256
256
|
children: [
|
|
257
257
|
/* @__PURE__ */ n("div", {
|
|
@@ -311,7 +311,7 @@ const lt = (t)=>({
|
|
|
311
311
|
style: _object_spread_props(_object_spread({
|
|
312
312
|
pointerEvents: s === "entered" ? "auto" : "none",
|
|
313
313
|
transform: Ut(mt)
|
|
314
|
-
}, T,
|
|
314
|
+
}, T, wt[s]), {
|
|
315
315
|
transition: s === "entering" ? `opacity .1s linear ${G}ms,transform .3s cubic-bezier(0.215,0.61,0.335,1) ${G}ms` : "opacity .1s linear"
|
|
316
316
|
}),
|
|
317
317
|
ref: Bt(dt, Y),
|
|
@@ -322,7 +322,7 @@ const lt = (t)=>({
|
|
|
322
322
|
!u && !o && K(!1);
|
|
323
323
|
},
|
|
324
324
|
children: /* @__PURE__ */ D("div", {
|
|
325
|
-
className:
|
|
325
|
+
className: It,
|
|
326
326
|
style: _object_spread_props(_object_spread({
|
|
327
327
|
width: v
|
|
328
328
|
}, lt(Z)), {
|
|
@@ -369,7 +369,7 @@ const lt = (t)=>({
|
|
|
369
369
|
]
|
|
370
370
|
});
|
|
371
371
|
}, qt = (_param)=>{
|
|
372
|
-
var { centerContent: t, extra: h, children: v, dataAttributes: d, title: m, description: x } = _param,
|
|
372
|
+
var { centerContent: t, extra: h, children: v, dataAttributes: d, title: m, description: x } = _param, I = _object_without_properties(_param, [
|
|
373
373
|
"centerContent",
|
|
374
374
|
"extra",
|
|
375
375
|
"children",
|
|
@@ -401,6 +401,6 @@ const lt = (t)=>({
|
|
|
401
401
|
dataAttributes: _object_spread({
|
|
402
402
|
"component-name": "Tooltip"
|
|
403
403
|
}, d)
|
|
404
|
-
},
|
|
404
|
+
}, I));
|
|
405
405
|
}, ge = qt;
|
|
406
406
|
export { jt as BaseTooltip, ge as default };
|
package/dist-es/touchable.js
CHANGED
|
@@ -78,19 +78,19 @@ function _object_without_properties_loose(source, excluded) {
|
|
|
78
78
|
}
|
|
79
79
|
return target;
|
|
80
80
|
}
|
|
81
|
-
import { jsxs as
|
|
81
|
+
import { jsxs as E, jsx as n } from "react/jsx-runtime";
|
|
82
82
|
import * as c from "react";
|
|
83
83
|
import m from "classnames";
|
|
84
|
-
import
|
|
85
|
-
import { notTouchable as
|
|
86
|
-
import { useTheme as
|
|
87
|
-
import { isInsideNovumNativeApp as
|
|
88
|
-
import { ENTER as
|
|
89
|
-
import { getPrefixedDataAttributes as
|
|
90
|
-
import { redirect as
|
|
91
|
-
const
|
|
84
|
+
import O from "./screen-reader-only.js";
|
|
85
|
+
import { notTouchable as _, touchable as j, base as B, marginReset as V } from "./touchable.css-mistica.js";
|
|
86
|
+
import { useTheme as L } from "./hooks.js";
|
|
87
|
+
import { isInsideNovumNativeApp as $ } from "./utils/platform.js";
|
|
88
|
+
import { ENTER as q, SPACE as z } from "./utils/keys.js";
|
|
89
|
+
import { getPrefixedDataAttributes as F } from "./utils/dom.js";
|
|
90
|
+
import { redirect as G } from "./utils/browser.js";
|
|
91
|
+
const R = /*#__PURE__*/ c.forwardRef((e, t)=>{
|
|
92
92
|
var P;
|
|
93
|
-
const { texts: o, analytics: C, platformOverrides:
|
|
93
|
+
const { texts: o, analytics: C, platformOverrides: x, Link: I, useHrefDecorator: D } = L(), A = D(), u = c.useRef(!1);
|
|
94
94
|
let l = [];
|
|
95
95
|
e.trackingEvent && (Array.isArray(e.trackingEvent) ? l = e.trackingEvent : l = [
|
|
96
96
|
e.trackingEvent
|
|
@@ -109,39 +109,47 @@ const E = /*#__PURE__*/ c.forwardRef((e, t)=>{
|
|
|
109
109
|
"aria-selected": e["aria-selected"],
|
|
110
110
|
"aria-live": e["aria-live"],
|
|
111
111
|
tabIndex: e.tabIndex
|
|
112
|
-
},
|
|
112
|
+
}, F(e.dataAttributes, "Touchable")), s = e.type ? e.type : "button", r = !!e.newTab, H = (P = e.href) == null ? void 0 : P.startsWith("#"), h = !r && !!e.href && !!e.loadOnTop, b = (a)=>{
|
|
113
113
|
e.stopPropagation && a.stopPropagation();
|
|
114
114
|
}, g = (a)=>{
|
|
115
115
|
e.onPress && e.onPress(a);
|
|
116
116
|
}, y = ()=>{
|
|
117
117
|
var _e_to_pathname;
|
|
118
|
-
return e.href ?
|
|
118
|
+
return e.href ? A(e.href) : e.to && e.fullPageOnWebView ? typeof e.to == "string" ? e.to : (_e_to_pathname = e.to.pathname) !== null && _e_to_pathname !== void 0 ? _e_to_pathname : "" : "";
|
|
119
119
|
}, k = ()=>Promise.all(l.map((a)=>C.logEvent(a))), v = (a)=>{
|
|
120
120
|
u.current || (u.current = !0, k().finally(()=>{
|
|
121
121
|
u.current = !1, a();
|
|
122
122
|
}));
|
|
123
|
-
},
|
|
123
|
+
}, K = (a)=>{
|
|
124
124
|
if (b(a), !l.length) {
|
|
125
125
|
g(a);
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
128
|
v(()=>g(a));
|
|
129
|
-
},
|
|
130
|
-
var
|
|
129
|
+
}, S = (a)=>{
|
|
130
|
+
var w;
|
|
131
131
|
b(a);
|
|
132
132
|
const f = !!(e.href && e.onNavigate);
|
|
133
|
-
!l.length && !f || (a.preventDefault(), Promise.resolve(f ? (
|
|
134
|
-
v(()=>
|
|
133
|
+
!l.length && !f || (a.preventDefault(), Promise.resolve(f ? (w = e.onNavigate) == null ? void 0 : w.call(e) : void 0).finally(()=>{
|
|
134
|
+
v(()=>G(y(), r, h));
|
|
135
135
|
}));
|
|
136
|
-
},
|
|
136
|
+
}, W = (a)=>{
|
|
137
137
|
b(a), e.to && e.onNavigate && e.onNavigate(), k();
|
|
138
138
|
}, N = (a)=>{
|
|
139
|
-
(a.key ===
|
|
140
|
-
}
|
|
141
|
-
|
|
139
|
+
(a.key === q || a.key === z) && (a.preventDefault(), a.currentTarget.click());
|
|
140
|
+
}, T = ()=>r ? /* @__PURE__ */ n(O, {
|
|
141
|
+
children: /* @__PURE__ */ n("span", {
|
|
142
|
+
children: o.linkOpensInNewTab
|
|
143
|
+
})
|
|
144
|
+
}) : H ? /* @__PURE__ */ n(O, {
|
|
145
|
+
children: /* @__PURE__ */ n("span", {
|
|
146
|
+
children: o.linkOpensInCurrentPage
|
|
147
|
+
})
|
|
148
|
+
}) : null;
|
|
149
|
+
if (e.href || e.to && e.fullPageOnWebView && $(x)) return /* @__PURE__ */ E("a", _object_spread_props(_object_spread({}, i), {
|
|
142
150
|
"aria-label": e["aria-label"],
|
|
143
151
|
"aria-labelledby": e["aria-labelledby"],
|
|
144
|
-
onClick:
|
|
152
|
+
onClick: S,
|
|
145
153
|
onKeyDown: N,
|
|
146
154
|
href: e.disabled ? void 0 : y(),
|
|
147
155
|
target: (()=>{
|
|
@@ -152,26 +160,22 @@ const E = /*#__PURE__*/ c.forwardRef((e, t)=>{
|
|
|
152
160
|
ref: t,
|
|
153
161
|
children: [
|
|
154
162
|
d,
|
|
155
|
-
|
|
156
|
-
children: /* @__PURE__ */ n("span", {
|
|
157
|
-
children: o.linkOpensInNewTab
|
|
158
|
-
})
|
|
159
|
-
}) : D ? /* @__PURE__ */ n(w, {
|
|
160
|
-
children: /* @__PURE__ */ n("span", {
|
|
161
|
-
children: o.linkOpensInCurrentPage
|
|
162
|
-
})
|
|
163
|
-
}) : null
|
|
163
|
+
T()
|
|
164
164
|
]
|
|
165
165
|
}));
|
|
166
|
-
if (e.to) return /* @__PURE__ */
|
|
166
|
+
if (e.to) return /* @__PURE__ */ E(I, _object_spread_props(_object_spread({}, i), {
|
|
167
|
+
target: e.newTab ? "_blank" : void 0,
|
|
167
168
|
"aria-label": e["aria-label"],
|
|
168
169
|
"aria-labelledby": e["aria-labelledby"],
|
|
169
170
|
innerRef: t,
|
|
170
171
|
to: e.disabled ? "" : e.to,
|
|
171
172
|
replace: e.replace,
|
|
172
|
-
onClick:
|
|
173
|
+
onClick: W,
|
|
173
174
|
onKeyDown: N,
|
|
174
|
-
children:
|
|
175
|
+
children: [
|
|
176
|
+
d,
|
|
177
|
+
T()
|
|
178
|
+
]
|
|
175
179
|
}));
|
|
176
180
|
if (e.onPress) {
|
|
177
181
|
var _e_as, _i_role;
|
|
@@ -187,27 +191,27 @@ const E = /*#__PURE__*/ c.forwardRef((e, t)=>{
|
|
|
187
191
|
"aria-labelledby": e["aria-labelledby"],
|
|
188
192
|
type: s,
|
|
189
193
|
ref: t,
|
|
190
|
-
onClick:
|
|
194
|
+
onClick: K,
|
|
191
195
|
children: d
|
|
192
196
|
}));
|
|
193
197
|
}
|
|
194
198
|
return /* @__PURE__ */ n("div", _object_spread_props(_object_spread({}, i), {
|
|
195
199
|
ref: t,
|
|
196
|
-
className: m(i.className,
|
|
200
|
+
className: m(i.className, _),
|
|
197
201
|
children: d
|
|
198
202
|
}));
|
|
199
|
-
}),
|
|
200
|
-
className: m(
|
|
203
|
+
}), J = /*#__PURE__*/ c.forwardRef((e, t)=>/* @__PURE__ */ n(R, _object_spread_props(_object_spread({}, e), {
|
|
204
|
+
className: m(j, e.className),
|
|
201
205
|
ref: t
|
|
202
|
-
}))),
|
|
206
|
+
}))), te = /*#__PURE__*/ c.forwardRef((_param, o)=>{
|
|
203
207
|
var { resetMargin: e = !0 } = _param, t = _object_without_properties(_param, [
|
|
204
208
|
"resetMargin"
|
|
205
209
|
]);
|
|
206
|
-
return /* @__PURE__ */ n(
|
|
207
|
-
className: m(
|
|
210
|
+
return /* @__PURE__ */ n(R, _object_spread_props(_object_spread({}, t), {
|
|
211
|
+
className: m(B, t.className, {
|
|
208
212
|
[V]: e
|
|
209
213
|
}),
|
|
210
214
|
ref: o
|
|
211
215
|
}));
|
|
212
|
-
}),
|
|
213
|
-
export {
|
|
216
|
+
}), ne = J;
|
|
217
|
+
export { te as BaseTouchable, ne as default };
|
package/dist-es/utils/helpers.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
const
|
|
2
|
-
let
|
|
3
|
-
var
|
|
4
|
-
const a =
|
|
5
|
-
let o, d = 0, s = -1, f,
|
|
6
|
-
const
|
|
7
|
-
const u =
|
|
8
|
-
return s < 0 || u >=
|
|
9
|
-
},
|
|
10
|
-
const u =
|
|
1
|
+
const W = function(e, t) {
|
|
2
|
+
let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
3
|
+
var _i_leading, _i_trailing;
|
|
4
|
+
const a = t, c = (_i_leading = i.leading) !== null && _i_leading !== void 0 ? _i_leading : !1, y = (_i_trailing = i.trailing) !== null && _i_trailing !== void 0 ? _i_trailing : !0, l = i.maxWait !== void 0 ? Math.max(i.maxWait, a) : void 0;
|
|
5
|
+
let o, d = 0, s = -1, f, r;
|
|
6
|
+
const g = (n)=>(d = n, o && (f = e(...o)), o = void 0, f), T = (n)=>{
|
|
7
|
+
const u = n - s, m = n - d;
|
|
8
|
+
return s < 0 || u >= t || u < 0 || l !== void 0 && m >= l;
|
|
9
|
+
}, x = (n)=>{
|
|
10
|
+
const u = n - s, m = n - d, h = t - u;
|
|
11
11
|
return l !== void 0 ? Math.min(h, l - m) : h;
|
|
12
|
-
}, k = (
|
|
13
|
-
const
|
|
14
|
-
if (T(
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
for(var _len = arguments.length,
|
|
18
|
-
|
|
12
|
+
}, k = (n)=>(r = void 0, y && o ? g(n) : (o = void 0, f)), v = ()=>{
|
|
13
|
+
const n = Date.now();
|
|
14
|
+
if (T(n)) return k(n);
|
|
15
|
+
r = setTimeout(v, x(n));
|
|
16
|
+
}, I = (n)=>(d = n, r = setTimeout(v, a), c ? g(n) : f), A = function() {
|
|
17
|
+
for(var _len = arguments.length, n = new Array(_len), _key = 0; _key < _len; _key++){
|
|
18
|
+
n[_key] = arguments[_key];
|
|
19
19
|
}
|
|
20
20
|
const u = Date.now(), m = T(u);
|
|
21
|
-
if (o =
|
|
22
|
-
if (
|
|
23
|
-
if (l !== void 0) return
|
|
21
|
+
if (o = n, s = u, m) {
|
|
22
|
+
if (r === void 0) return I(s);
|
|
23
|
+
if (l !== void 0) return r = setTimeout(v, a), g(s);
|
|
24
24
|
}
|
|
25
|
-
return
|
|
25
|
+
return r === void 0 && (r = setTimeout(v, a)), f;
|
|
26
26
|
};
|
|
27
27
|
return A.cancel = ()=>{
|
|
28
|
-
|
|
29
|
-
}, A.flush = ()=>
|
|
30
|
-
}, D = (e)=>e === null ? !0 : !(typeof e == "object" || typeof e == "function"),
|
|
31
|
-
if (e ===
|
|
32
|
-
if (D(e) || D(
|
|
33
|
-
if (Array.isArray(e) || Array.isArray(
|
|
34
|
-
if (e instanceof Date ||
|
|
35
|
-
const
|
|
36
|
-
return
|
|
28
|
+
r !== void 0 && (clearTimeout(r), r = void 0), d = 0, s = -1, o = void 0;
|
|
29
|
+
}, A.flush = ()=>r === void 0 ? f : k(Date.now()), A;
|
|
30
|
+
}, D = (e)=>e === null ? !0 : !(typeof e == "object" || typeof e == "function"), p = (e, t)=>{
|
|
31
|
+
if (e === t || typeof e == "number" && typeof t == "number" && isNaN(e) && isNaN(t)) return !0;
|
|
32
|
+
if (D(e) || D(t) || typeof e != typeof t || typeof e == "function") return !1;
|
|
33
|
+
if (Array.isArray(e) || Array.isArray(t)) return Array.isArray(e) && Array.isArray(t) ? e.length === t.length && e.every((c, y)=>p(c, t[y])) : !1;
|
|
34
|
+
if (e instanceof Date || t instanceof Date) return e instanceof Date && t instanceof Date ? e.getTime() === t.getTime() : !1;
|
|
35
|
+
const i = Object.keys(e), a = Object.keys(t);
|
|
36
|
+
return i.length === a.length ? i.every((c)=>p(e[c], t[c])) : !1;
|
|
37
37
|
};
|
|
38
|
-
export {
|
|
38
|
+
export { W as debounce, p as isEqual };
|