@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.
Files changed (114) hide show
  1. package/css/mistica.css +1 -1
  2. package/dist/boxed.css-mistica.js +35 -2
  3. package/dist/boxed.css.d.ts +29 -0
  4. package/dist/boxed.d.ts +6 -4
  5. package/dist/boxed.js +30 -24
  6. package/dist/button-group.css-mistica.js +14 -5
  7. package/dist/button-group.css.d.ts +3 -0
  8. package/dist/button-group.d.ts +2 -1
  9. package/dist/button-group.js +29 -16
  10. package/dist/button-layout.css-mistica.js +7 -7
  11. package/dist/button-layout.css.d.ts +1 -1
  12. package/dist/button-layout.js +9 -9
  13. package/dist/button.d.ts +4 -24
  14. package/dist/button.js +6 -4
  15. package/dist/card.d.ts +8 -1
  16. package/dist/card.js +567 -501
  17. package/dist/carousel.css-mistica.js +19 -16
  18. package/dist/carousel.css.d.ts +1 -0
  19. package/dist/carousel.js +41 -39
  20. package/dist/chip.js +37 -44
  21. package/dist/circle.d.ts +11 -4
  22. package/dist/circle.js +10 -11
  23. package/dist/community/advanced-data-card.css-mistica.js +24 -21
  24. package/dist/community/advanced-data-card.css.d.ts +1 -0
  25. package/dist/community/advanced-data-card.d.ts +1 -0
  26. package/dist/community/advanced-data-card.js +20 -17
  27. package/dist/counter.js +26 -22
  28. package/dist/cover-hero-media.d.ts +12 -0
  29. package/dist/cover-hero-media.js +44 -0
  30. package/dist/cover-hero.css-mistica.js +56 -0
  31. package/dist/cover-hero.css.d.ts +14 -0
  32. package/dist/cover-hero.css.ts.vanilla.css-mistica.js +11 -0
  33. package/dist/cover-hero.d.ts +38 -0
  34. package/dist/cover-hero.js +296 -0
  35. package/dist/empty-state.js +6 -6
  36. package/dist/grid-layout.css-mistica.js +11 -8
  37. package/dist/grid-layout.css.d.ts +1 -0
  38. package/dist/grid-layout.d.ts +12 -22
  39. package/dist/grid-layout.js +63 -49
  40. package/dist/header.js +18 -18
  41. package/dist/highlighted-card.d.ts +1 -0
  42. package/dist/highlighted-card.js +22 -18
  43. package/dist/icon-button.d.ts +7 -6
  44. package/dist/image.js +69 -48
  45. package/dist/index.d.ts +4 -1
  46. package/dist/index.js +15 -0
  47. package/dist/list.d.ts +1 -0
  48. package/dist/navigation-bar.d.ts +1 -1
  49. package/dist/navigation-bar.js +1 -1
  50. package/dist/package-version.js +1 -1
  51. package/dist/select.js +16 -12
  52. package/dist/skins/movistar.d.ts +13 -0
  53. package/dist/skins/movistar.js +112 -99
  54. package/dist/spinner.js +19 -18
  55. package/dist/table.css-mistica.js +58 -0
  56. package/dist/table.css.d.ts +13 -0
  57. package/dist/table.css.ts.vanilla.css-mistica.js +11 -0
  58. package/dist/table.d.ts +39 -0
  59. package/dist/table.js +269 -0
  60. package/dist/text.d.ts +1 -1
  61. package/dist/theme.d.ts +20 -0
  62. package/dist/theme.js +80 -20
  63. package/dist/timer.css-mistica.js +39 -0
  64. package/dist/timer.css.d.ts +8 -0
  65. package/dist/timer.css.ts.vanilla.css-mistica.js +11 -0
  66. package/dist/timer.d.ts +27 -0
  67. package/dist/timer.js +370 -0
  68. package/dist/tooltip.js +13 -13
  69. package/dist/touchable.d.ts +2 -0
  70. package/dist/touchable.js +35 -31
  71. package/dist/utils/helpers.js +32 -32
  72. package/dist-es/boxed.css-mistica.js +29 -2
  73. package/dist-es/boxed.js +37 -31
  74. package/dist-es/button-group.css-mistica.js +2 -2
  75. package/dist-es/button-group.js +37 -24
  76. package/dist-es/button-layout.css-mistica.js +2 -2
  77. package/dist-es/button-layout.js +16 -16
  78. package/dist-es/button.js +24 -22
  79. package/dist-es/card.js +681 -618
  80. package/dist-es/carousel.css-mistica.js +7 -7
  81. package/dist-es/carousel.js +75 -73
  82. package/dist-es/chip.js +57 -64
  83. package/dist-es/circle.js +15 -16
  84. package/dist-es/community/advanced-data-card.css-mistica.js +4 -4
  85. package/dist-es/community/advanced-data-card.js +59 -56
  86. package/dist-es/counter.js +62 -58
  87. package/dist-es/cover-hero-media.js +30 -0
  88. package/dist-es/cover-hero.css-mistica.js +9 -0
  89. package/dist-es/cover-hero.css.ts.vanilla.css-mistica.js +2 -0
  90. package/dist-es/cover-hero.js +241 -0
  91. package/dist-es/empty-state.js +13 -13
  92. package/dist-es/grid-layout.css-mistica.js +3 -3
  93. package/dist-es/grid-layout.js +80 -66
  94. package/dist-es/header.js +37 -37
  95. package/dist-es/highlighted-card.js +35 -31
  96. package/dist-es/image.js +88 -67
  97. package/dist-es/index.js +1817 -1814
  98. package/dist-es/navigation-bar.js +1 -1
  99. package/dist-es/package-version.js +1 -1
  100. package/dist-es/select.js +23 -18
  101. package/dist-es/skins/movistar.js +112 -99
  102. package/dist-es/spinner.js +38 -37
  103. package/dist-es/style.css +1 -1
  104. package/dist-es/table.css-mistica.js +14 -0
  105. package/dist-es/table.css.ts.vanilla.css-mistica.js +2 -0
  106. package/dist-es/table.js +214 -0
  107. package/dist-es/theme.js +77 -17
  108. package/dist-es/timer.css-mistica.js +4 -0
  109. package/dist-es/timer.css.ts.vanilla.css-mistica.js +2 -0
  110. package/dist-es/timer.js +307 -0
  111. package/dist-es/tooltip.js +16 -16
  112. package/dist-es/touchable.js +47 -43
  113. package/dist-es/utils/helpers.js +31 -31
  114. package/package.json +1 -1
package/dist/timer.js ADDED
@@ -0,0 +1,370 @@
1
+ "use client";
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ function _export(target, all) {
7
+ for(var name in all)Object.defineProperty(target, name, {
8
+ enumerable: true,
9
+ get: all[name]
10
+ });
11
+ }
12
+ _export(exports, {
13
+ TextTimer: function() {
14
+ return fe;
15
+ },
16
+ Timer: function() {
17
+ return Se;
18
+ }
19
+ });
20
+ const _jsxruntime = require("react/jsx-runtime");
21
+ const _classnames = /*#__PURE__*/ _interop_require_default(require("classnames"));
22
+ const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
23
+ const _box = /*#__PURE__*/ _interop_require_default(require("./box.js"));
24
+ const _hooks = require("./hooks.js");
25
+ const _inline = /*#__PURE__*/ _interop_require_default(require("./inline.js"));
26
+ const _screenreaderonly = /*#__PURE__*/ _interop_require_default(require("./screen-reader-only.js"));
27
+ const _text = require("./text.js");
28
+ const _themevariantcontext = require("./theme-variant-context.js");
29
+ const _timercssmistica = require("./timer.css-mistica.js");
30
+ const _dom = require("./utils/dom.js");
31
+ const _helpers = require("./utils/helpers.js");
32
+ const _platform = require("./utils/platform.js");
33
+ function _interop_require_default(obj) {
34
+ return obj && obj.__esModule ? obj : {
35
+ default: obj
36
+ };
37
+ }
38
+ function _getRequireWildcardCache(nodeInterop) {
39
+ if (typeof WeakMap !== "function") return null;
40
+ var cacheBabelInterop = new WeakMap();
41
+ var cacheNodeInterop = new WeakMap();
42
+ return (_getRequireWildcardCache = function(nodeInterop) {
43
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
44
+ })(nodeInterop);
45
+ }
46
+ function _interop_require_wildcard(obj, nodeInterop) {
47
+ if (!nodeInterop && obj && obj.__esModule) {
48
+ return obj;
49
+ }
50
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
51
+ return {
52
+ default: obj
53
+ };
54
+ }
55
+ var cache = _getRequireWildcardCache(nodeInterop);
56
+ if (cache && cache.has(obj)) {
57
+ return cache.get(obj);
58
+ }
59
+ var newObj = {
60
+ __proto__: null
61
+ };
62
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
63
+ for(var key in obj){
64
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
65
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
66
+ if (desc && (desc.get || desc.set)) {
67
+ Object.defineProperty(newObj, key, desc);
68
+ } else {
69
+ newObj[key] = obj[key];
70
+ }
71
+ }
72
+ }
73
+ newObj.default = obj;
74
+ if (cache) {
75
+ cache.set(obj, newObj);
76
+ }
77
+ return newObj;
78
+ }
79
+ function _define_property(obj, key, value) {
80
+ if (key in obj) {
81
+ Object.defineProperty(obj, key, {
82
+ value: value,
83
+ enumerable: true,
84
+ configurable: true,
85
+ writable: true
86
+ });
87
+ } else {
88
+ obj[key] = value;
89
+ }
90
+ return obj;
91
+ }
92
+ function _object_spread(target) {
93
+ for(var i = 1; i < arguments.length; i++){
94
+ var source = arguments[i] != null ? arguments[i] : {};
95
+ var ownKeys = Object.keys(source);
96
+ if (typeof Object.getOwnPropertySymbols === "function") {
97
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
98
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
99
+ }));
100
+ }
101
+ ownKeys.forEach(function(key) {
102
+ _define_property(target, key, source[key]);
103
+ });
104
+ }
105
+ return target;
106
+ }
107
+ function ownKeys(object, enumerableOnly) {
108
+ var keys = Object.keys(object);
109
+ if (Object.getOwnPropertySymbols) {
110
+ var symbols = Object.getOwnPropertySymbols(object);
111
+ if (enumerableOnly) {
112
+ symbols = symbols.filter(function(sym) {
113
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
114
+ });
115
+ }
116
+ keys.push.apply(keys, symbols);
117
+ }
118
+ return keys;
119
+ }
120
+ function _object_spread_props(target, source) {
121
+ source = source != null ? source : {};
122
+ if (Object.getOwnPropertyDescriptors) {
123
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
124
+ } else {
125
+ ownKeys(Object(source)).forEach(function(key) {
126
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
127
+ });
128
+ }
129
+ return target;
130
+ }
131
+ const V = 24, $ = 60, T = 60, _ = 1e3, Y = T * _, k = $ * Y, se = V * k, R = (n, s, a, u)=>{
132
+ s = u === "none" && s === "days" ? "hours" : s, a = u === "none" && a === "days" ? "hours" : a;
133
+ const i = [
134
+ "seconds",
135
+ "minutes",
136
+ "hours",
137
+ "days"
138
+ ], d = i.indexOf(s), g = Math.max(i.indexOf(a), d), e = i.indexOf(n);
139
+ return d <= e && e <= g;
140
+ }, E = (n, s, a, u)=>[
141
+ {
142
+ unit: "days",
143
+ value: n.days
144
+ },
145
+ {
146
+ unit: "hours",
147
+ value: n.hours
148
+ },
149
+ {
150
+ unit: "minutes",
151
+ value: n.minutes
152
+ },
153
+ {
154
+ unit: "seconds",
155
+ value: n.seconds
156
+ }
157
+ ].filter((i)=>R(i.unit, s, a, u)), A = (n)=>(0, _platform.isRunningAcceptanceTest)() ? 0 : Math.max(0, (typeof n == "object" ? n : new Date(n)).valueOf() - Date.now()), q = (param)=>{
158
+ let { endTimestamp: n, labelType: s, minTimeUnit: a, maxTimeUnit: u, onProgress: i } = param;
159
+ const [d, g] = _react.useState(A(n));
160
+ (0, _hooks.useIsomorphicLayoutEffect)(()=>{
161
+ let v;
162
+ const D = ()=>{
163
+ const I = A(n);
164
+ g(I), I || clearInterval(v);
165
+ };
166
+ if (!(0, _platform.isRunningAcceptanceTest)()) return D(), v = setInterval(D, _), ()=>clearInterval(v);
167
+ }, [
168
+ n
169
+ ]);
170
+ 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] = _react.useState(E({
171
+ days: h,
172
+ hours: L,
173
+ minutes: t,
174
+ seconds: r
175
+ }, a, u, s));
176
+ return _react.useEffect(()=>{
177
+ const v = E({
178
+ days: h,
179
+ hours: L,
180
+ minutes: t,
181
+ seconds: r
182
+ }, a, u, s);
183
+ if (!(0, _helpers.isEqual)(v, o)) {
184
+ b(v);
185
+ const D = {};
186
+ v.forEach((I)=>D[I.unit] = I.value), i == null || i(D);
187
+ }
188
+ }, [
189
+ h,
190
+ L,
191
+ t,
192
+ r,
193
+ s,
194
+ a,
195
+ u,
196
+ o,
197
+ i
198
+ ]), o;
199
+ }, fe = (param)=>{
200
+ let { endTimestamp: n, labelType: s = "none", minTimeUnit: a, maxTimeUnit: u, onProgress: i, dataAttributes: d, "aria-label": g } = param;
201
+ const { texts: e } = (0, _hooks.useTheme)(), S = (0, _hooks.useAriaId)(), l = q({
202
+ endTimestamp: n,
203
+ labelType: s,
204
+ minTimeUnit: a,
205
+ maxTimeUnit: u,
206
+ onProgress: i
207
+ }), m = {
208
+ days: e.timerDaysShortLabel,
209
+ hours: e.timerHoursShortLabel,
210
+ minutes: e.timerMinutesShortLabel,
211
+ seconds: e.timerSecondsShortLabel
212
+ }, y = {
213
+ days: e.timerDayLongLabel,
214
+ hours: e.timerHourLongLabel,
215
+ minutes: e.timerMinuteLongLabel,
216
+ seconds: e.timerSecondLongLabel
217
+ }, p = {
218
+ days: e.timerDaysLongLabel,
219
+ hours: e.timerHoursLongLabel,
220
+ minutes: e.timerMinutesLongLabel,
221
+ seconds: e.timerSecondsLongLabel
222
+ }, f = (t)=>{
223
+ const r = Math.max(String(t).length, s === "long" ? 1 : 2);
224
+ return /* @__PURE__ */ (0, _jsxruntime.jsx)("span", {
225
+ className: _timercssmistica.unitContainer,
226
+ style: {
227
+ minWidth: `${r}ch`
228
+ },
229
+ children: String(t).padStart(r, "0")
230
+ });
231
+ }, h = ()=>{
232
+ switch(s){
233
+ case "none":
234
+ return l.map((t, r)=>/* @__PURE__ */ (0, _jsxruntime.jsxs)(_react.Fragment, {
235
+ children: [
236
+ r > 0 && ":",
237
+ f(t.value)
238
+ ]
239
+ }, r));
240
+ case "short":
241
+ return l.map((t, r)=>/* @__PURE__ */ (0, _jsxruntime.jsxs)(_react.Fragment, {
242
+ children: [
243
+ r > 0 && " ",
244
+ /* @__PURE__ */ (0, _jsxruntime.jsxs)("span", {
245
+ className: _timercssmistica.shortLabelText,
246
+ children: [
247
+ f(t.value),
248
+ ` ${m[t.unit]}`
249
+ ]
250
+ })
251
+ ]
252
+ }, r));
253
+ case "long":
254
+ default:
255
+ return l.map((t, r)=>/* @__PURE__ */ (0, _jsxruntime.jsxs)(_react.Fragment, {
256
+ children: [
257
+ r > 0 && " ",
258
+ f(t.value),
259
+ ` ${t.value === 1 ? y[t.unit] : p[t.unit]}`,
260
+ r === l.length - 2 && ` ${e.timerAnd}`,
261
+ r < l.length - 2 && ","
262
+ ]
263
+ }, r));
264
+ }
265
+ }, 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("");
266
+ return /* @__PURE__ */ (0, _jsxruntime.jsxs)("span", _object_spread_props(_object_spread({
267
+ role: "timer",
268
+ "aria-labelledby": S,
269
+ className: _timercssmistica.inlineText,
270
+ style: {
271
+ // try to keep the timer in the same line without wrapping only when label is not long
272
+ display: s !== "long" ? "inline-block" : void 0
273
+ }
274
+ }, (0, _dom.getPrefixedDataAttributes)(d, "TextTimer")), {
275
+ children: [
276
+ /* @__PURE__ */ (0, _jsxruntime.jsx)(_screenreaderonly.default, {
277
+ children: /* @__PURE__ */ (0, _jsxruntime.jsx)("span", {
278
+ id: S,
279
+ children: g ? `${g}. ${L}` : L
280
+ })
281
+ }),
282
+ /* @__PURE__ */ (0, _jsxruntime.jsx)("span", {
283
+ "aria-hidden": !0,
284
+ className: _timercssmistica.inlineText,
285
+ children: h()
286
+ })
287
+ ]
288
+ }));
289
+ }, Se = (param)=>{
290
+ let { boxed: n, endTimestamp: s, minTimeUnit: a, maxTimeUnit: u, onProgress: i, dataAttributes: d, "aria-label": g } = param;
291
+ const { texts: e } = (0, _hooks.useTheme)(), S = (0, _hooks.useAriaId)(), l = (0, _themevariantcontext.useThemeVariant)(), m = q({
292
+ endTimestamp: s,
293
+ minTimeUnit: a,
294
+ maxTimeUnit: u,
295
+ onProgress: i
296
+ }), y = {
297
+ days: e.timerDayLongLabel,
298
+ hours: e.timerHourLongLabel,
299
+ minutes: e.timerDisplayMinutesLabel,
300
+ seconds: e.timerDisplaySecondsLabel
301
+ }, p = {
302
+ days: e.timerDaysLongLabel,
303
+ hours: e.timerHoursLongLabel,
304
+ minutes: e.timerDisplayMinutesLabel,
305
+ seconds: e.timerDisplaySecondsLabel
306
+ }, f = {
307
+ days: e.timerDayLongLabel,
308
+ hours: e.timerHourLongLabel,
309
+ minutes: e.timerMinuteLongLabel,
310
+ seconds: e.timerSecondLongLabel
311
+ }, h = {
312
+ days: e.timerDaysLongLabel,
313
+ hours: e.timerHoursLongLabel,
314
+ minutes: e.timerMinutesLongLabel,
315
+ seconds: e.timerSecondsLongLabel
316
+ }, L = (o)=>{
317
+ const b = Math.max(String(o).length, 2);
318
+ return /* @__PURE__ */ (0, _jsxruntime.jsx)(_text.Text6, {
319
+ children: /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
320
+ className: _timercssmistica.unitContainer,
321
+ style: {
322
+ minWidth: `${b}ch`
323
+ },
324
+ children: String(o).padStart(b, "0")
325
+ })
326
+ });
327
+ }, 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__ */ (0, _jsxruntime.jsx)(_box.default, {
328
+ className: (0, _classnames.default)({
329
+ [_timercssmistica.boxedTimerValueContainer]: l === "default" && n,
330
+ [_timercssmistica.boxedTimerValueContainerInverse]: l !== "default" && n
331
+ }),
332
+ children: /* @__PURE__ */ (0, _jsxruntime.jsx)(_themevariantcontext.ThemeVariant, {
333
+ variant: n ? "default" : l,
334
+ children: /* @__PURE__ */ (0, _jsxruntime.jsxs)("div", {
335
+ className: (0, _classnames.default)(_timercssmistica.timerDisplayValue, {
336
+ [_timercssmistica.boxedTimerDisplayValue]: n
337
+ }),
338
+ children: [
339
+ L(o.value),
340
+ /* @__PURE__ */ (0, _jsxruntime.jsx)(_text.Text2, {
341
+ regular: !0,
342
+ children: o.value === 1 ? y[o.unit] : p[o.unit]
343
+ })
344
+ ]
345
+ })
346
+ })
347
+ }, b));
348
+ return /* @__PURE__ */ (0, _jsxruntime.jsxs)("div", _object_spread_props(_object_spread({
349
+ role: "timer",
350
+ "aria-labelledby": S,
351
+ className: _timercssmistica.timerWrapper
352
+ }, (0, _dom.getPrefixedDataAttributes)(d, "Timer")), {
353
+ children: [
354
+ /* @__PURE__ */ (0, _jsxruntime.jsx)(_screenreaderonly.default, {
355
+ children: /* @__PURE__ */ (0, _jsxruntime.jsx)("span", {
356
+ id: S,
357
+ children: g ? `${g}. ${t}` : t
358
+ })
359
+ }),
360
+ /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
361
+ "aria-hidden": !0,
362
+ children: /* @__PURE__ */ (0, _jsxruntime.jsx)(_inline.default, {
363
+ space: n ? 8 : 16,
364
+ wrap: !0,
365
+ children: r()
366
+ })
367
+ })
368
+ ]
369
+ }));
370
+ };
package/dist/tooltip.js CHANGED
@@ -165,16 +165,16 @@ function _object_without_properties_loose(source, excluded) {
165
165
  }
166
166
  const lt = (t)=>({
167
167
  border: `1px solid ${t ? _skincontractcssmistica.vars.colors.backgroundContainer : _skincontractcssmistica.vars.colors.border}`
168
- }), ct = 496, Yt = 300, Gt = 500, Kt = 100, p = 20, I = 6, N = I + p / 2 + 1, Ut = (t)=>{
168
+ }), ct = 496, Yt = 300, Gt = 500, Kt = 100, p = 20, w = 6, N = w + p / 2 + 1, Ut = (t)=>{
169
169
  switch(t){
170
170
  case "left":
171
- return `translateX(-${I}px)`;
171
+ return `translateX(-${w}px)`;
172
172
  case "right":
173
- return `translateX(${I}px)`;
173
+ return `translateX(${w}px)`;
174
174
  case "top":
175
- return `translateY(-${I}px)`;
175
+ return `translateY(-${w}px)`;
176
176
  case "bottom":
177
- return `translateY(${I}px)`;
177
+ return `translateY(${w}px)`;
178
178
  default:
179
179
  return "";
180
180
  }
@@ -186,7 +186,7 @@ const lt = (t)=>({
186
186
  };
187
187
  }, ft = (t, h, v, d, m)=>{
188
188
  if (!t || !h) return;
189
- const { top: x, bottom: w, left: B, right: W } = t, o = d - w, 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);
189
+ 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);
190
190
  if (!(!M && !b)) switch(v){
191
191
  case "left":
192
192
  return b ? _ <= a ? "left" : "right" : o > R ? "bottom" : "top";
@@ -200,7 +200,7 @@ const lt = (t)=>({
200
200
  return;
201
201
  }
202
202
  }, jt = (param)=>{
203
- let { content: t, target: h, width: v, position: d = "top", dataAttributes: m, delay: x = !0, centerContent: w, open: B, onClose: W, hasPointerInteractionOnly: o = !1, trackingEvent: O } = param;
203
+ 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;
204
204
  const { texts: R } = (0, _hooks.useTheme)(), a = (0, _hooks.useAriaId)(), { openTooltipId: X } = (0, _tooltipcontextprovider.useTooltipState)(), { openTooltip: V, closeTooltip: _ } = (0, _tooltipcontextprovider.useSetTooltipState)(), [T, b] = _react.useState(), [M, z] = _react.useState(), P = _react.useRef(null), Y = _react.useRef(null), [C, dt] = _react.useState(null), u = (0, _environment.isTouchableDevice)(), G = x ? Gt : 0, [et, K] = _react.useState(!1), [U, y] = _react.useState(!1), j = B !== void 0, [ot, q] = _react.useState(!1), E = j ? B : a === X, Z = (0, _themevariantcontext.useIsInverseVariant)(), f = (0, _hooks.useBoundingRect)(P, E), H = (0, _hooks.useBoundingRect)(Y, E, !0), l = (0, _hooks.useWindowSize)(), S = _react.useCallback(()=>{
205
205
  q(!1), K(!1), y(!1);
206
206
  }, []);
@@ -233,7 +233,7 @@ const lt = (t)=>({
233
233
  case "bottom":
234
234
  r = {
235
235
  left: Math.max(0, Math.min(rt, (c + k - $) / 2)),
236
- top: A - I,
236
+ top: A - w,
237
237
  padding: `${N}px 0px 0px 0px`
238
238
  }, e = {
239
239
  left: Math.max(g, Math.min(l.width - g - p, (c + k - p) / 2)),
@@ -256,7 +256,7 @@ const lt = (t)=>({
256
256
  case "right":
257
257
  default:
258
258
  r = {
259
- left: k - I,
259
+ left: k - w,
260
260
  top: Math.max(0, Math.min(st, (L + A - F) / 2)),
261
261
  padding: `0px 0px 0px ${N}px`
262
262
  }, e = {
@@ -315,7 +315,7 @@ const lt = (t)=>({
315
315
  _,
316
316
  j
317
317
  ]);
318
- const mt = ft(f, C, d, l.height, l.width), ut = w !== void 0 ? w : (H == null ? void 0 : H.width) === _tooltipcssmistica.CONTENT_MIN_WIDTH;
318
+ const mt = ft(f, C, d, l.height, l.width), ut = I !== void 0 ? I : (H == null ? void 0 : H.width) === _tooltipcssmistica.CONTENT_MIN_WIDTH;
319
319
  return /* @__PURE__ */ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
320
320
  children: [
321
321
  /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
@@ -403,7 +403,7 @@ const lt = (t)=>({
403
403
  t,
404
404
  W && /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
405
405
  className: _tooltipcssmistica.closeButtonIcon,
406
- children: /* @__PURE__ */ (0, _jsxruntime.jsx)(_iconbutton.InternalIconButton, {
406
+ children: /* @__PURE__ */ (0, _jsxruntime.jsx)(_iconbutton.IconButton, {
407
407
  onPress: ()=>{
408
408
  y(!1), W();
409
409
  },
@@ -433,7 +433,7 @@ const lt = (t)=>({
433
433
  ]
434
434
  });
435
435
  }, qt = (_param)=>{
436
- var { centerContent: t, extra: h, children: v, dataAttributes: d, title: m, description: x } = _param, w = _object_without_properties(_param, [
436
+ var { centerContent: t, extra: h, children: v, dataAttributes: d, title: m, description: x } = _param, I = _object_without_properties(_param, [
437
437
  "centerContent",
438
438
  "extra",
439
439
  "children",
@@ -465,5 +465,5 @@ const lt = (t)=>({
465
465
  dataAttributes: _object_spread({
466
466
  "component-name": "Tooltip"
467
467
  }, d)
468
- }, w));
468
+ }, I));
469
469
  }, ge = qt;
@@ -38,6 +38,8 @@ type HrefProps = {
38
38
  };
39
39
  type ToProps = {
40
40
  to: string | Location;
41
+ newTab?: boolean;
42
+ /** @deprecated set the newTab */
41
43
  fullPageOnWebView?: boolean;
42
44
  replace?: boolean;
43
45
  onNavigate?: () => void | Promise<void>;
package/dist/touchable.js CHANGED
@@ -11,10 +11,10 @@ function _export(target, all) {
11
11
  }
12
12
  _export(exports, {
13
13
  BaseTouchable: function() {
14
- return ae;
14
+ return te;
15
15
  },
16
16
  default: function() {
17
- return te;
17
+ return ne;
18
18
  }
19
19
  });
20
20
  const _jsxruntime = require("react/jsx-runtime");
@@ -152,9 +152,9 @@ function _object_without_properties_loose(source, excluded) {
152
152
  }
153
153
  return target;
154
154
  }
155
- const E = /*#__PURE__*/ _react.forwardRef((e, t)=>{
155
+ const R = /*#__PURE__*/ _react.forwardRef((e, t)=>{
156
156
  var P;
157
- const { texts: o, analytics: C, platformOverrides: O, Link: R, useHrefDecorator: x } = (0, _hooks.useTheme)(), I = x(), u = _react.useRef(!1);
157
+ const { texts: o, analytics: C, platformOverrides: x, Link: I, useHrefDecorator: D } = (0, _hooks.useTheme)(), A = D(), u = _react.useRef(!1);
158
158
  let l = [];
159
159
  e.trackingEvent && (Array.isArray(e.trackingEvent) ? l = e.trackingEvent : l = [
160
160
  e.trackingEvent
@@ -173,39 +173,47 @@ const E = /*#__PURE__*/ _react.forwardRef((e, t)=>{
173
173
  "aria-selected": e["aria-selected"],
174
174
  "aria-live": e["aria-live"],
175
175
  tabIndex: e.tabIndex
176
- }, (0, _dom.getPrefixedDataAttributes)(e.dataAttributes, "Touchable")), s = e.type ? e.type : "button", r = !!e.href && !!e.newTab, D = (P = e.href) == null ? void 0 : P.startsWith("#"), h = !r && !!e.href && !!e.loadOnTop, b = (a)=>{
176
+ }, (0, _dom.getPrefixedDataAttributes)(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)=>{
177
177
  e.stopPropagation && a.stopPropagation();
178
178
  }, g = (a)=>{
179
179
  e.onPress && e.onPress(a);
180
180
  }, y = ()=>{
181
181
  var _e_to_pathname;
182
- return e.href ? I(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 : "" : "";
182
+ 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 : "" : "";
183
183
  }, k = ()=>Promise.all(l.map((a)=>C.logEvent(a))), v = (a)=>{
184
184
  u.current || (u.current = !0, k().finally(()=>{
185
185
  u.current = !1, a();
186
186
  }));
187
- }, A = (a)=>{
187
+ }, K = (a)=>{
188
188
  if (b(a), !l.length) {
189
189
  g(a);
190
190
  return;
191
191
  }
192
192
  v(()=>g(a));
193
- }, H = (a)=>{
194
- var T;
193
+ }, S = (a)=>{
194
+ var w;
195
195
  b(a);
196
196
  const f = !!(e.href && e.onNavigate);
197
- !l.length && !f || (a.preventDefault(), Promise.resolve(f ? (T = e.onNavigate) == null ? void 0 : T.call(e) : void 0).finally(()=>{
197
+ !l.length && !f || (a.preventDefault(), Promise.resolve(f ? (w = e.onNavigate) == null ? void 0 : w.call(e) : void 0).finally(()=>{
198
198
  v(()=>(0, _browser.redirect)(y(), r, h));
199
199
  }));
200
- }, K = (a)=>{
200
+ }, W = (a)=>{
201
201
  b(a), e.to && e.onNavigate && e.onNavigate(), k();
202
202
  }, N = (a)=>{
203
203
  (a.key === _keys.ENTER || a.key === _keys.SPACE) && (a.preventDefault(), a.currentTarget.click());
204
- };
205
- if (e.href || e.to && e.fullPageOnWebView && (0, _platform.isInsideNovumNativeApp)(O)) return /* @__PURE__ */ (0, _jsxruntime.jsxs)("a", _object_spread_props(_object_spread({}, i), {
204
+ }, T = ()=>r ? /* @__PURE__ */ (0, _jsxruntime.jsx)(_screenreaderonly.default, {
205
+ children: /* @__PURE__ */ (0, _jsxruntime.jsx)("span", {
206
+ children: o.linkOpensInNewTab
207
+ })
208
+ }) : H ? /* @__PURE__ */ (0, _jsxruntime.jsx)(_screenreaderonly.default, {
209
+ children: /* @__PURE__ */ (0, _jsxruntime.jsx)("span", {
210
+ children: o.linkOpensInCurrentPage
211
+ })
212
+ }) : null;
213
+ if (e.href || e.to && e.fullPageOnWebView && (0, _platform.isInsideNovumNativeApp)(x)) return /* @__PURE__ */ (0, _jsxruntime.jsxs)("a", _object_spread_props(_object_spread({}, i), {
206
214
  "aria-label": e["aria-label"],
207
215
  "aria-labelledby": e["aria-labelledby"],
208
- onClick: H,
216
+ onClick: S,
209
217
  onKeyDown: N,
210
218
  href: e.disabled ? void 0 : y(),
211
219
  target: (()=>{
@@ -216,26 +224,22 @@ const E = /*#__PURE__*/ _react.forwardRef((e, t)=>{
216
224
  ref: t,
217
225
  children: [
218
226
  d,
219
- r ? /* @__PURE__ */ (0, _jsxruntime.jsx)(_screenreaderonly.default, {
220
- children: /* @__PURE__ */ (0, _jsxruntime.jsx)("span", {
221
- children: o.linkOpensInNewTab
222
- })
223
- }) : D ? /* @__PURE__ */ (0, _jsxruntime.jsx)(_screenreaderonly.default, {
224
- children: /* @__PURE__ */ (0, _jsxruntime.jsx)("span", {
225
- children: o.linkOpensInCurrentPage
226
- })
227
- }) : null
227
+ T()
228
228
  ]
229
229
  }));
230
- if (e.to) return /* @__PURE__ */ (0, _jsxruntime.jsx)(R, _object_spread_props(_object_spread({}, i), {
230
+ if (e.to) return /* @__PURE__ */ (0, _jsxruntime.jsxs)(I, _object_spread_props(_object_spread({}, i), {
231
+ target: e.newTab ? "_blank" : void 0,
231
232
  "aria-label": e["aria-label"],
232
233
  "aria-labelledby": e["aria-labelledby"],
233
234
  innerRef: t,
234
235
  to: e.disabled ? "" : e.to,
235
236
  replace: e.replace,
236
- onClick: K,
237
+ onClick: W,
237
238
  onKeyDown: N,
238
- children: d
239
+ children: [
240
+ d,
241
+ T()
242
+ ]
239
243
  }));
240
244
  if (e.onPress) {
241
245
  var _e_as, _i_role;
@@ -251,7 +255,7 @@ const E = /*#__PURE__*/ _react.forwardRef((e, t)=>{
251
255
  "aria-labelledby": e["aria-labelledby"],
252
256
  type: s,
253
257
  ref: t,
254
- onClick: A,
258
+ onClick: K,
255
259
  children: d
256
260
  }));
257
261
  }
@@ -260,17 +264,17 @@ const E = /*#__PURE__*/ _react.forwardRef((e, t)=>{
260
264
  className: (0, _classnames.default)(i.className, _touchablecssmistica.notTouchable),
261
265
  children: d
262
266
  }));
263
- }), G = /*#__PURE__*/ _react.forwardRef((e, t)=>/* @__PURE__ */ (0, _jsxruntime.jsx)(E, _object_spread_props(_object_spread({}, e), {
267
+ }), J = /*#__PURE__*/ _react.forwardRef((e, t)=>/* @__PURE__ */ (0, _jsxruntime.jsx)(R, _object_spread_props(_object_spread({}, e), {
264
268
  className: (0, _classnames.default)(_touchablecssmistica.touchable, e.className),
265
269
  ref: t
266
- }))), ae = /*#__PURE__*/ _react.forwardRef((_param, o)=>{
270
+ }))), te = /*#__PURE__*/ _react.forwardRef((_param, o)=>{
267
271
  var { resetMargin: e = !0 } = _param, t = _object_without_properties(_param, [
268
272
  "resetMargin"
269
273
  ]);
270
- return /* @__PURE__ */ (0, _jsxruntime.jsx)(E, _object_spread_props(_object_spread({}, t), {
274
+ return /* @__PURE__ */ (0, _jsxruntime.jsx)(R, _object_spread_props(_object_spread({}, t), {
271
275
  className: (0, _classnames.default)(_touchablecssmistica.base, t.className, {
272
276
  [_touchablecssmistica.marginReset]: e
273
277
  }),
274
278
  ref: o
275
279
  }));
276
- }), te = G;
280
+ }), ne = J;