@telefonica/mistica 16.1.0 → 16.2.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 (148) hide show
  1. package/css/mistica.css +1 -1
  2. package/dist/accordion.css-mistica.js +12 -9
  3. package/dist/accordion.css.d.ts +1 -0
  4. package/dist/accordion.js +36 -39
  5. package/dist/align.css-mistica.js +12 -0
  6. package/dist/align.css.d.ts +1 -0
  7. package/dist/align.css.ts.vanilla.css-mistica.js +11 -0
  8. package/dist/align.d.ts +12 -0
  9. package/dist/align.js +79 -0
  10. package/dist/box.css-mistica.js +41 -0
  11. package/dist/box.css.d.ts +23 -0
  12. package/dist/box.css.ts.vanilla.css-mistica.js +11 -0
  13. package/dist/box.d.ts +4 -0
  14. package/dist/box.js +39 -31
  15. package/dist/boxed.css-mistica.js +10 -5
  16. package/dist/boxed.css.d.ts +3 -0
  17. package/dist/boxed.js +20 -24
  18. package/dist/callout.css-mistica.js +12 -4
  19. package/dist/callout.css.d.ts +1 -0
  20. package/dist/callout.js +14 -22
  21. package/dist/card.css-mistica.js +26 -23
  22. package/dist/card.css.d.ts +1 -0
  23. package/dist/card.js +17 -23
  24. package/dist/community/advanced-data-card.css-mistica.js +32 -23
  25. package/dist/community/advanced-data-card.css.d.ts +3 -0
  26. package/dist/community/advanced-data-card.js +46 -55
  27. package/dist/empty-state.css-mistica.js +11 -8
  28. package/dist/empty-state.css.d.ts +1 -0
  29. package/dist/empty-state.js +10 -13
  30. package/dist/form.css-mistica.js +12 -0
  31. package/dist/form.css.d.ts +1 -0
  32. package/dist/form.js +8 -10
  33. package/dist/grid.css-mistica.js +143 -126
  34. package/dist/grid.css.d.ts +13 -0
  35. package/dist/grid.js +35 -38
  36. package/dist/hero.css-mistica.js +14 -8
  37. package/dist/hero.css.d.ts +2 -0
  38. package/dist/hero.js +17 -25
  39. package/dist/image.js +23 -25
  40. package/dist/index.d.ts +1 -0
  41. package/dist/index.js +4 -0
  42. package/dist/inline.js +10 -11
  43. package/dist/list.css-mistica.js +12 -9
  44. package/dist/list.css.d.ts +1 -0
  45. package/dist/list.js +43 -46
  46. package/dist/loading-screen.js +16 -16
  47. package/dist/logo-blau.d.ts +1 -1
  48. package/dist/logo-blau.js +10 -10
  49. package/dist/logo-common.d.ts +1 -0
  50. package/dist/logo-movistar.d.ts +1 -1
  51. package/dist/logo-movistar.js +4 -4
  52. package/dist/logo-o2-new.d.ts +1 -1
  53. package/dist/logo-o2-new.js +5 -5
  54. package/dist/logo-o2.d.ts +1 -1
  55. package/dist/logo-o2.js +5 -5
  56. package/dist/logo-telefonica.d.ts +1 -1
  57. package/dist/logo-telefonica.js +4 -4
  58. package/dist/logo-tu.d.ts +1 -1
  59. package/dist/logo-tu.js +5 -5
  60. package/dist/logo-vivo.d.ts +1 -1
  61. package/dist/logo-vivo.js +7 -7
  62. package/dist/logo.d.ts +9 -8
  63. package/dist/logo.js +125 -102
  64. package/dist/navigation-bar.css-mistica.js +23 -20
  65. package/dist/navigation-bar.css.d.ts +1 -0
  66. package/dist/navigation-bar.js +30 -37
  67. package/dist/package-version.js +1 -1
  68. package/dist/phone-number-field.d.ts +1 -4
  69. package/dist/phone-number-field.js +52 -82
  70. package/dist/popover.d.ts +1 -0
  71. package/dist/popover.js +9 -10
  72. package/dist/sheet-common.css-mistica.js +5 -5
  73. package/dist/skeleton-base.js +10 -12
  74. package/dist/skeletons.css-mistica.js +11 -5
  75. package/dist/skeletons.css.d.ts +1 -0
  76. package/dist/snackbar.css-mistica.js +20 -14
  77. package/dist/snackbar.css.d.ts +3 -1
  78. package/dist/snackbar.js +65 -75
  79. package/dist/tag.css-mistica.js +15 -4
  80. package/dist/tag.css.d.ts +2 -0
  81. package/dist/tag.js +20 -24
  82. package/dist/text-field-base.d.ts +1 -1
  83. package/dist/text-field-components.css-mistica.js +16 -10
  84. package/dist/text-field-components.css.d.ts +1 -0
  85. package/dist/text-field-components.js +32 -35
  86. package/dist/timer.js +42 -43
  87. package/dist/tooltip.d.ts +3 -1
  88. package/dist/tooltip.js +106 -106
  89. package/dist/touchable.js +47 -42
  90. package/dist-es/accordion.css-mistica.js +3 -3
  91. package/dist-es/accordion.js +58 -61
  92. package/dist-es/align.css-mistica.js +3 -0
  93. package/dist-es/align.css.ts.vanilla.css-mistica.js +2 -0
  94. package/dist-es/align.js +70 -0
  95. package/dist-es/box.css-mistica.js +24 -0
  96. package/dist-es/box.css.ts.vanilla.css-mistica.js +2 -0
  97. package/dist-es/box.js +43 -35
  98. package/dist-es/boxed.css-mistica.js +5 -3
  99. package/dist-es/boxed.js +28 -32
  100. package/dist-es/callout.css-mistica.js +7 -2
  101. package/dist-es/callout.js +44 -52
  102. package/dist-es/card.css-mistica.js +4 -4
  103. package/dist-es/card.js +11 -17
  104. package/dist-es/community/advanced-data-card.css-mistica.js +7 -7
  105. package/dist-es/community/advanced-data-card.js +90 -99
  106. package/dist-es/empty-state.css-mistica.js +3 -3
  107. package/dist-es/empty-state.js +19 -22
  108. package/dist-es/form.css-mistica.js +3 -0
  109. package/dist-es/form.js +12 -14
  110. package/dist-es/grid.css-mistica.js +123 -112
  111. package/dist-es/grid.js +38 -41
  112. package/dist-es/hero.css-mistica.js +2 -2
  113. package/dist-es/hero.js +36 -44
  114. package/dist-es/image.js +28 -30
  115. package/dist-es/index.js +1844 -1843
  116. package/dist-es/inline.js +19 -20
  117. package/dist-es/list.css-mistica.js +2 -2
  118. package/dist-es/list.js +75 -78
  119. package/dist-es/loading-screen.js +30 -30
  120. package/dist-es/logo-blau.js +11 -11
  121. package/dist-es/logo-movistar.js +5 -5
  122. package/dist-es/logo-o2-new.js +8 -8
  123. package/dist-es/logo-o2.js +8 -8
  124. package/dist-es/logo-telefonica.js +4 -4
  125. package/dist-es/logo-tu.js +8 -8
  126. package/dist-es/logo-vivo.js +16 -16
  127. package/dist-es/logo.js +132 -109
  128. package/dist-es/navigation-bar.css-mistica.js +11 -11
  129. package/dist-es/navigation-bar.js +80 -87
  130. package/dist-es/package-version.js +1 -1
  131. package/dist-es/phone-number-field.js +59 -89
  132. package/dist-es/popover.js +17 -18
  133. package/dist-es/sheet-common.css-mistica.js +2 -2
  134. package/dist-es/skeleton-base.js +15 -17
  135. package/dist-es/skeletons.css-mistica.js +5 -2
  136. package/dist-es/snackbar.css-mistica.js +4 -4
  137. package/dist-es/snackbar.js +93 -103
  138. package/dist-es/style.css +1 -1
  139. package/dist-es/tag.css-mistica.js +2 -2
  140. package/dist-es/tag.js +34 -38
  141. package/dist-es/text-field-components.css-mistica.js +5 -2
  142. package/dist-es/text-field-components.js +48 -51
  143. package/dist-es/timer.js +80 -81
  144. package/dist-es/tooltip.js +148 -148
  145. package/dist-es/touchable.js +55 -50
  146. package/package.json +1 -1
  147. package/dist/sprinkles.css-mistica.js +0 -2494
  148. package/dist-es/sprinkles.css-mistica.js +0 -2485
package/dist-es/tag.js CHANGED
@@ -51,22 +51,21 @@ function _object_spread_props(target, source) {
51
51
  }
52
52
  return target;
53
53
  }
54
- import { jsxs as c, jsx as r } from "react/jsx-runtime";
54
+ import { jsxs as s, jsx as r } from "react/jsx-runtime";
55
55
  import g from "./box.js";
56
- import { Text as x } from "./text.js";
57
- import { useThemeVariant as T, ThemeVariant as h } from "./theme-variant-context.js";
58
- import { pxToRem as v } from "./utils/css.js";
59
- import { getPrefixedDataAttributes as k } from "./utils/dom.js";
60
- import { tag as B } from "./tag.css-mistica.js";
61
- import { sprinkles as a } from "./sprinkles.css-mistica.js";
62
- import { vars as b } from "./skins/skin-contract.css-mistica.js";
63
- import w from "classnames";
64
- import { useTheme as A } from "./hooks.js";
65
- import P from "./badge.js";
66
- const { colors: t } = b, V = (param)=>{
67
- let { Icon: e, children: i, dataAttributes: m, type: l = "promo", badge: n } = param;
68
- const { textPresets: d } = A(), p = T(), o = n === !0 ? void 0 : n || 0;
69
- if (!i) return null;
56
+ import { Text as f } from "./text.js";
57
+ import { useThemeVariant as T, ThemeVariant as x } from "./theme-variant-context.js";
58
+ import { pxToRem as h } from "./utils/css.js";
59
+ import { getPrefixedDataAttributes as v } from "./utils/dom.js";
60
+ import { tag as k, icon as B, badge as b } from "./tag.css-mistica.js";
61
+ import { vars as w } from "./skins/skin-contract.css-mistica.js";
62
+ import A from "classnames";
63
+ import { useTheme as P } from "./hooks.js";
64
+ import V from "./badge.js";
65
+ const { colors: t } = w, C = (param)=>{
66
+ let { Icon: e, children: o, dataAttributes: c, type: m = "promo", badge: i } = param;
67
+ const { textPresets: d } = P(), l = T(), a = i === !0 ? void 0 : i || 0;
68
+ if (!o) return null;
70
69
  const u = {
71
70
  // [textColor, backgroundColor]
72
71
  promo: [
@@ -80,7 +79,7 @@ const { colors: t } = b, V = (param)=>{
80
79
  inactive: [
81
80
  t.tagTextInactive,
82
81
  // TODO: remove logic for alternative variant (https://jira.tid.es/browse/WEB-1803)
83
- p === "alternative" ? t.neutralLowAlternative : t.tagBackgroundInactive
82
+ l === "alternative" ? t.neutralLowAlternative : t.tagBackgroundInactive
84
83
  ],
85
84
  success: [
86
85
  t.tagTextSuccess,
@@ -94,47 +93,44 @@ const { colors: t } = b, V = (param)=>{
94
93
  t.tagTextError,
95
94
  t.tagBackgroundError
96
95
  ]
97
- }, [s, f] = u[l];
98
- return /* @__PURE__ */ c("span", _object_spread_props(_object_spread({}, k(m, "Tag")), {
99
- className: w(B, a({
96
+ }, [n, p] = u[m];
97
+ return /* @__PURE__ */ s("span", _object_spread_props(_object_spread({}, v(c, "Tag")), {
98
+ className: A(k),
99
+ style: {
100
100
  paddingLeft: e ? 8 : 12,
101
- paddingRight: o !== 0 ? 8 : 12,
102
- background: f
103
- })),
101
+ paddingRight: a !== 0 ? 8 : 12,
102
+ background: p
103
+ },
104
104
  children: [
105
105
  e && /* @__PURE__ */ r(g, {
106
106
  paddingRight: 4,
107
107
  children: /* @__PURE__ */ r(e, {
108
- color: s,
109
- size: v(16),
110
- className: a({
111
- display: "block"
112
- })
108
+ color: n,
109
+ size: h(16),
110
+ className: B
113
111
  })
114
112
  }),
115
- /* @__PURE__ */ c(h, {
113
+ /* @__PURE__ */ s(x, {
116
114
  isInverse: !1,
117
115
  children: [
118
- /* @__PURE__ */ r(x, {
119
- color: s,
116
+ /* @__PURE__ */ r(f, {
117
+ color: n,
120
118
  size: 14,
121
119
  lineHeight: 20,
122
120
  weight: d.indicator.weight,
123
121
  truncate: !0,
124
- children: i
122
+ children: o
125
123
  }),
126
- o !== 0 && /* @__PURE__ */ r(g, {
124
+ a !== 0 && /* @__PURE__ */ r(g, {
127
125
  paddingLeft: 4,
128
- className: a({
129
- display: "inline-flex"
130
- }),
131
- children: /* @__PURE__ */ r(P, {
132
- value: o
126
+ className: b,
127
+ children: /* @__PURE__ */ r(V, {
128
+ value: a
133
129
  })
134
130
  })
135
131
  ]
136
132
  })
137
133
  ]
138
134
  }));
139
- }, I = V;
135
+ }, I = C;
140
136
  export { I as default };
@@ -2,5 +2,8 @@ import "./sprinkles.css.ts.vanilla.css-mistica.js";
2
2
  import "./icon-button.css.ts.vanilla.css-mistica.js";
3
3
  import "./text-field-base.css.ts.vanilla.css-mistica.js";
4
4
  import "./text-field-components.css.ts.vanilla.css-mistica.js";
5
- var a = 328, f = 0.78, e = 0.75, y = "_15k6ur97", k = "_1y2v1nfkl _1y2v1nfk1 _1y2v1nfhk _1y2v1nfka _1y2v1nfhe", i = "_15k6ur96 _1y2v1nfhk _1y2v1nfhq", l = "_1y2v1nfi7", h = "_1y2v1nfa7 _1y2v1nfbj _1y2v1nfhk", t = "_1y2v1nfi5 _1y2v1nf7j", o = "_15k6ur91 _1y2v1nfhf _1y2v1nfhk _1y2v1nfhp", p = "_15k6ur93 _1y2v1nfkl _1y2v1nfi3", u = "_15k6ur9e _1y2v1nfhk", L = "_15k6ur99 _1y2v1nfi7", d = "_15k6ur94", E = "_15k6ur9g";
6
- export { a as DEFAULT_WIDTH, f as LABEL_SCALE_DESKTOP, e as LABEL_SCALE_MOBILE, y as disabled, k as field, i as fieldContainer, l as fullWidth, h as helperContainer, t as helperText, o as labelContainer, p as labelText, u as leftHelperText, L as normalWidth, d as shrinked, E as warnIcon };
5
+ var a = 328, f = 0.78, e = 0.75, y = {
6
+ default: "_1y2v1nf3q",
7
+ readOnly: "_1y2v1nf5k"
8
+ }, k = "_15k6ur97", l = "_1y2v1nfkl _1y2v1nfk1 _1y2v1nfhk _1y2v1nfka _1y2v1nfhe", i = "_15k6ur96 _1y2v1nfhk _1y2v1nfhq", t = "_1y2v1nfi7", h = "_1y2v1nfa7 _1y2v1nfbj _1y2v1nfhk", o = "_1y2v1nfi5 _1y2v1nf7j", u = "_15k6ur91 _1y2v1nfhf _1y2v1nfhk _1y2v1nfhp", d = "_15k6ur93 _1y2v1nfkl _1y2v1nfi3", p = "_15k6ur9e _1y2v1nfhk", L = "_15k6ur99 _1y2v1nfi7", E = "_15k6ur94", T = "_15k6ur9g";
9
+ export { a as DEFAULT_WIDTH, f as LABEL_SCALE_DESKTOP, e as LABEL_SCALE_MOBILE, y as background, k as disabled, l as field, i as fieldContainer, t as fullWidth, h as helperContainer, o as helperText, u as labelContainer, d as labelText, p as leftHelperText, L as normalWidth, E as shrinked, T as warnIcon };
@@ -51,81 +51,80 @@ function _object_spread_props(target, source) {
51
51
  }
52
52
  return target;
53
53
  }
54
- import { jsxs as c, jsx as o, Fragment as C } from "react/jsx-runtime";
54
+ import { jsxs as c, jsx as r, Fragment as C } from "react/jsx-runtime";
55
55
  import * as g from "react";
56
56
  import m from "classnames";
57
57
  import { useIsInverseOrMediaVariant as I } from "./theme-variant-context.js";
58
58
  import { useTheme as S } from "./hooks.js";
59
59
  import { Text1 as x } from "./text.js";
60
- import { labelContainer as T, shrinked as k, labelText as E, helperText as b, leftHelperText as F, warnIcon as L, fieldContainer as O, fullWidth as W, normalWidth as w, disabled as A, field as P, helperContainer as j } from "./text-field-components.css-mistica.js";
61
- import { sprinkles as v } from "./sprinkles.css-mistica.js";
62
- import { vars as r } from "./skins/skin-contract.css-mistica.js";
60
+ import { labelContainer as T, shrinked as E, labelText as F, helperText as v, leftHelperText as O, warnIcon as k, fieldContainer as W, fullWidth as A, normalWidth as L, disabled as P, field as j, background as b, helperContainer as w } from "./text-field-components.css-mistica.js";
61
+ import { vars as t } from "./skins/skin-contract.css-mistica.js";
63
62
  import { getPrefixedDataAttributes as D } from "./utils/dom.js";
64
63
  import { formFieldOptionalLabelSuffix as H } from "./text-tokens.js";
65
64
  import R from "./generated/mistica-icons/icon-warning-regular.js";
66
- const X = (param)=>{
67
- let { shrinkLabel: t, forId: l, inputState: e, error: s, children: i, style: n, optional: a } = param;
68
- const f = t || e === "focused" || e === "filled", [u, p] = g.useState("initial"), { texts: d, t: N } = S();
65
+ const U = (param)=>{
66
+ let { shrinkLabel: o, forId: l, inputState: e, error: s, children: i, style: a, optional: n } = param;
67
+ const f = o || e === "focused" || e === "filled", [u, h] = g.useState("initial"), { texts: d, t: y } = S();
69
68
  g.useEffect(()=>{
70
- const y = setTimeout(()=>{
71
- process.env.NODE_ENV !== "test" && p("transform 150ms, width 150ms");
69
+ const N = setTimeout(()=>{
70
+ process.env.NODE_ENV !== "test" && h("transform 150ms, width 150ms");
72
71
  });
73
72
  return ()=>{
74
- clearTimeout(y);
73
+ clearTimeout(N);
75
74
  };
76
75
  }, []);
77
- let h = r.colors.textSecondary;
78
- return s && e !== "default" ? h = r.colors.textError : e === "focused" && (h = r.colors.textActivated), /* @__PURE__ */ c("label", {
76
+ let p = t.colors.textSecondary;
77
+ return s && e !== "default" ? p = t.colors.textError : e === "focused" && (p = t.colors.textActivated), /* @__PURE__ */ c("label", {
79
78
  className: m(T, {
80
- [k]: f
81
- }, v({
82
- color: h
83
- })),
79
+ [E]: f
80
+ }),
84
81
  htmlFor: l,
85
- style: _object_spread_props(_object_spread({}, n), {
82
+ style: _object_spread_props(_object_spread({
83
+ color: p
84
+ }, a), {
86
85
  transition: u
87
86
  }),
88
87
  children: [
89
- /* @__PURE__ */ o("span", {
90
- className: E,
88
+ /* @__PURE__ */ r("span", {
89
+ className: F,
91
90
  children: i
92
91
  }),
93
- a ? /* @__PURE__ */ c("span", {
92
+ n ? /* @__PURE__ */ c("span", {
94
93
  children: [
95
94
  "\xa0(",
96
- d.formFieldOptionalLabelSuffix || N(H),
95
+ d.formFieldOptionalLabelSuffix || y(H),
97
96
  ")"
98
97
  ]
99
98
  }) : null
100
99
  ]
101
100
  });
102
- }, Y = (param)=>{
103
- let { leftText: t, rightText: l, error: e, id: s } = param;
104
- const i = I(), n = i ? r.colors.textPrimaryInverse : e ? r.colors.textError : r.colors.textSecondary, a = i ? r.colors.textPrimaryInverse : r.colors.textSecondary;
101
+ }, X = (param)=>{
102
+ let { leftText: o, rightText: l, error: e, id: s } = param;
103
+ const i = I(), a = i ? t.colors.textPrimaryInverse : e ? t.colors.textError : t.colors.textSecondary, n = i ? t.colors.textPrimaryInverse : t.colors.textSecondary;
105
104
  return /* @__PURE__ */ c(C, {
106
105
  children: [
107
- t && /* @__PURE__ */ c("p", {
108
- className: m(b, F),
106
+ o && /* @__PURE__ */ c("p", {
107
+ className: m(v, O),
109
108
  children: [
110
- e && /* @__PURE__ */ o(x, {
109
+ e && /* @__PURE__ */ r(x, {
111
110
  regular: !0,
112
- children: /* @__PURE__ */ o(R, {
113
- color: n,
114
- className: L
111
+ children: /* @__PURE__ */ r(R, {
112
+ color: a,
113
+ className: k
115
114
  })
116
115
  }),
117
- /* @__PURE__ */ o(x, {
118
- color: n,
116
+ /* @__PURE__ */ r(x, {
117
+ color: a,
119
118
  regular: !0,
120
119
  id: s,
121
- children: t
120
+ children: o
122
121
  })
123
122
  ]
124
123
  }),
125
- l && /* @__PURE__ */ o("div", {
126
- className: m(b),
127
- children: /* @__PURE__ */ o(x, {
128
- color: a,
124
+ l && /* @__PURE__ */ r("div", {
125
+ className: m(v),
126
+ children: /* @__PURE__ */ r(x, {
127
+ color: n,
129
128
  regular: !0,
130
129
  as: "p",
131
130
  textAlign: "right",
@@ -134,31 +133,29 @@ const X = (param)=>{
134
133
  })
135
134
  ]
136
135
  });
137
- }, Z = (param)=>{
138
- let { multiline: t, disabled: l, children: e, helperText: s, className: i, fieldRef: n, fullWidth: a, readOnly: f, dataAttributes: u } = param;
136
+ }, Y = (param)=>{
137
+ let { multiline: o, disabled: l, children: e, helperText: s, className: i, fieldRef: a, fullWidth: n, readOnly: f, dataAttributes: u } = param;
139
138
  return(// eslint-disable-next-line jsx-a11y/no-static-element-interactions
140
139
  /* @__PURE__ */ c("div", _object_spread_props(_object_spread({
141
- className: m(O, a ? W : w, {
142
- [A]: l
140
+ className: m(W, n ? A : L, {
141
+ [P]: l
143
142
  }),
144
- onClick: (p)=>{
143
+ onClick: (h)=>{
145
144
  var d;
146
- (d = p.currentTarget.querySelector(t ? "textarea" : "input")) == null || d.focus();
145
+ (d = h.currentTarget.querySelector(o ? "textarea" : "input")) == null || d.focus();
147
146
  }
148
147
  }, D(u)), {
149
148
  children: [
150
- /* @__PURE__ */ o("div", {
151
- className: m(P, v({
152
- background: f ? r.colors.neutralLow : r.colors.backgroundContainer
153
- }), i),
154
- ref: n,
149
+ /* @__PURE__ */ r("div", {
150
+ className: m(j, f ? b.readOnly : b.default, i),
151
+ ref: a,
155
152
  children: e
156
153
  }),
157
- s && /* @__PURE__ */ o("div", {
158
- className: j,
154
+ s && /* @__PURE__ */ r("div", {
155
+ className: w,
159
156
  children: s
160
157
  })
161
158
  ]
162
159
  })));
163
160
  };
164
- export { Z as FieldContainer, Y as HelperText, X as Label };
161
+ export { Y as FieldContainer, X as HelperText, U as Label };
package/dist-es/timer.js CHANGED
@@ -52,20 +52,19 @@ function _object_spread_props(target, source) {
52
52
  return target;
53
53
  }
54
54
  import { jsxs as v, jsx as m } from "react/jsx-runtime";
55
- import x from "classnames";
56
- import * as y from "react";
57
- import ee from "./box.js";
58
- import { useTheme as k, useIsomorphicLayoutEffect as te } from "./hooks.js";
59
- import re from "./inline.js";
55
+ import F from "classnames";
56
+ import * as f from "react";
57
+ import { useTheme as k, useIsomorphicLayoutEffect as ee } from "./hooks.js";
58
+ import te from "./inline.js";
60
59
  import q from "./screen-reader-only.js";
61
- import { Text2 as ne, Text6 as se } from "./text.js";
62
- import { useThemeVariant as ae, ThemeVariant as oe } from "./theme-variant-context.js";
63
- import { inlineText as F, timerWrapper as ie, shortLabelText as le, boxedTimerValueContainer as ue, timerDisplayValue as ce, boxedTimerDisplayValue as de, unitContainer as B } from "./timer.css-mistica.js";
64
- import { getPrefixedDataAttributes as T } from "./utils/dom.js";
65
- import { isEqual as me } from "./utils/helpers.js";
66
- import { isRunningAcceptanceTest as z } from "./utils/platform.js";
67
- import { timerDaysShortLabel as he, timerHoursShortLabel as Le, timerMinutesShortLabel as be, timerSecondsShortLabel as ge, timerDayLongLabel as R, timerHourLongLabel as _, timerMinuteLongLabel as G, timerSecondLongLabel as J, timerDaysLongLabel as O, timerHoursLongLabel as E, timerMinutesLongLabel as K, timerSecondsLongLabel as Q, timerAnd as A, timerDisplayMinutesLabel as j, timerDisplaySecondsLabel as w } from "./text-tokens.js";
68
- const $ = 24, V = 60, X = 60, C = 1e3, Z = X * C, P = V * Z, Se = $ * P, H = (s, a, o, i)=>{
60
+ import { Text2 as ne, Text6 as re } from "./text.js";
61
+ import { useThemeVariant as se, ThemeVariant as ae } from "./theme-variant-context.js";
62
+ import { inlineText as j, timerWrapper as oe, shortLabelText as ie, boxedTimerValueContainer as le, timerDisplayValue as ue, boxedTimerDisplayValue as ce, unitContainer as T } from "./timer.css-mistica.js";
63
+ import { getPrefixedDataAttributes as z } from "./utils/dom.js";
64
+ import { isEqual as de } from "./utils/helpers.js";
65
+ import { isRunningAcceptanceTest as B } from "./utils/platform.js";
66
+ import { timerDaysShortLabel as me, timerHoursShortLabel as he, timerMinutesShortLabel as Le, timerSecondsShortLabel as be, timerDayLongLabel as R, timerHourLongLabel as _, timerMinuteLongLabel as G, timerSecondLongLabel as J, timerDaysLongLabel as O, timerHoursLongLabel as E, timerMinutesLongLabel as K, timerSecondsLongLabel as Q, timerAnd as A, timerDisplayMinutesLabel as x, timerDisplaySecondsLabel as w } from "./text-tokens.js";
67
+ const $ = 24, V = 60, X = 60, C = 1e3, Z = X * C, P = V * Z, ge = $ * P, H = (s, a, o, i)=>{
69
68
  a = i === "none" && a === "days" ? "hours" : a, o = i === "none" && o === "days" ? "hours" : o;
70
69
  const c = [
71
70
  "seconds",
@@ -91,33 +90,33 @@ const $ = 24, V = 60, X = 60, C = 1e3, Z = X * C, P = V * Z, Se = $ * P, H = (s,
91
90
  unit: "seconds",
92
91
  value: s.seconds
93
92
  }
94
- ].filter((c)=>H(c.unit, a, o, i)), Y = (s)=>z() ? 0 : Math.max(0, (typeof s == "object" ? s : new Date(s)).valueOf() - Date.now()), U = (param)=>{
93
+ ].filter((c)=>H(c.unit, a, o, i)), Y = (s)=>B() ? 0 : Math.max(0, (typeof s == "object" ? s : new Date(s)).valueOf() - Date.now()), U = (param)=>{
95
94
  let { endTimestamp: s, labelType: a, minTimeUnit: o, maxTimeUnit: i, onProgress: c } = param;
96
- const [L, b] = y.useState(Y(s));
97
- te(()=>{
95
+ const [L, b] = f.useState(Y(s));
96
+ ee(()=>{
98
97
  let u;
99
98
  const N = ()=>{
100
99
  const I = Y(s);
101
100
  b(I), I || clearInterval(u);
102
101
  };
103
- if (!z()) return N(), u = setInterval(N, C), ()=>clearInterval(u);
102
+ if (!B()) return N(), u = setInterval(N, C), ()=>clearInterval(u);
104
103
  }, [
105
104
  s
106
105
  ]);
107
- const e = H("days", o, i, a), t = H("hours", o, i, a), p = H("minutes", o, i, a), l = e ? "days" : t ? "hours" : p ? "minutes" : "seconds", g = Math.floor(L / P) % 24, M = Math.floor(L / Z) % 60, D = Math.floor(L / C) % 60, h = Math.floor(L / Se), S = l === "hours" ? g + h * $ : g, f = l === "minutes" ? M + V * (h * $ + S) : M, r = l === "seconds" ? D + X * (h * $ * V + S * V + f) : D, [n, d] = y.useState(W({
106
+ const e = H("days", o, i, a), t = H("hours", o, i, a), p = H("minutes", o, i, a), l = e ? "days" : t ? "hours" : p ? "minutes" : "seconds", g = Math.floor(L / P) % 24, M = Math.floor(L / Z) % 60, D = Math.floor(L / C) % 60, h = Math.floor(L / ge), S = l === "hours" ? g + h * $ : g, y = l === "minutes" ? M + V * (h * $ + S) : M, n = l === "seconds" ? D + X * (h * $ * V + S * V + y) : D, [r, d] = f.useState(W({
108
107
  days: h,
109
108
  hours: S,
110
- minutes: f,
111
- seconds: r
109
+ minutes: y,
110
+ seconds: n
112
111
  }, o, i, a));
113
- return y.useEffect(()=>{
112
+ return f.useEffect(()=>{
114
113
  const u = W({
115
114
  days: h,
116
115
  hours: S,
117
- minutes: f,
118
- seconds: r
116
+ minutes: y,
117
+ seconds: n
119
118
  }, o, i, a);
120
- if (!me(u, n)) {
119
+ if (!de(u, r)) {
121
120
  d(u);
122
121
  const N = {};
123
122
  u.forEach((I)=>N[I.unit] = I.value), c == null || c(N);
@@ -125,27 +124,27 @@ const $ = 24, V = 60, X = 60, C = 1e3, Z = X * C, P = V * Z, Se = $ * P, H = (s,
125
124
  }, [
126
125
  h,
127
126
  S,
128
- f,
129
- r,
127
+ y,
128
+ n,
130
129
  a,
131
130
  o,
132
131
  i,
133
- n,
132
+ r,
134
133
  c
135
- ]), n;
136
- }, Oe = (param)=>{
134
+ ]), r;
135
+ }, Re = (param)=>{
137
136
  let { endTimestamp: s, labelType: a = "none", minTimeUnit: o, maxTimeUnit: i, onProgress: c, dataAttributes: L, "aria-label": b } = param;
138
- const { texts: e, t } = k(), p = y.useId(), l = U({
137
+ const { texts: e, t } = k(), p = f.useId(), l = U({
139
138
  endTimestamp: s,
140
139
  labelType: a,
141
140
  minTimeUnit: o,
142
141
  maxTimeUnit: i,
143
142
  onProgress: c
144
143
  }), g = {
145
- days: e.timerDaysShortLabel || t(he),
146
- hours: e.timerHoursShortLabel || t(Le),
147
- minutes: e.timerMinutesShortLabel || t(be),
148
- seconds: e.timerSecondsShortLabel || t(ge)
144
+ days: e.timerDaysShortLabel || t(me),
145
+ hours: e.timerHoursShortLabel || t(he),
146
+ minutes: e.timerMinutesShortLabel || t(Le),
147
+ seconds: e.timerSecondsShortLabel || t(be)
149
148
  }, M = {
150
149
  days: e.timerDayLongLabel || t(R),
151
150
  hours: e.timerHourLongLabel || t(_),
@@ -156,76 +155,76 @@ const $ = 24, V = 60, X = 60, C = 1e3, Z = X * C, P = V * Z, Se = $ * P, H = (s,
156
155
  hours: e.timerHoursLongLabel || t(E),
157
156
  minutes: e.timerMinutesLongLabel || t(K),
158
157
  seconds: e.timerSecondsLongLabel || t(Q)
159
- }, h = (r)=>{
160
- const n = Math.max(String(r).length, a === "long" ? 1 : 2);
158
+ }, h = (n)=>{
159
+ const r = Math.max(String(n).length, a === "long" ? 1 : 2);
161
160
  return /* @__PURE__ */ m("span", {
162
- className: B,
161
+ className: T,
163
162
  style: {
164
- minWidth: `${n}ch`
163
+ minWidth: `${r}ch`
165
164
  },
166
- children: String(r).padStart(n, "0")
165
+ children: String(n).padStart(r, "0")
167
166
  });
168
167
  }, S = ()=>{
169
168
  switch(a){
170
169
  case "none":
171
- return l.map((r, n)=>/* @__PURE__ */ v(y.Fragment, {
170
+ return l.map((n, r)=>/* @__PURE__ */ v(f.Fragment, {
172
171
  children: [
173
- n > 0 && ":",
174
- h(r.value)
172
+ r > 0 && ":",
173
+ h(n.value)
175
174
  ]
176
- }, n));
175
+ }, r));
177
176
  case "short":
178
- return l.map((r, n)=>/* @__PURE__ */ v(y.Fragment, {
177
+ return l.map((n, r)=>/* @__PURE__ */ v(f.Fragment, {
179
178
  children: [
180
- n > 0 && " ",
179
+ r > 0 && " ",
181
180
  /* @__PURE__ */ v("span", {
182
- className: le,
181
+ className: ie,
183
182
  children: [
184
- h(r.value),
185
- ` ${g[r.unit]}`
183
+ h(n.value),
184
+ ` ${g[n.unit]}`
186
185
  ]
187
186
  })
188
187
  ]
189
- }, n));
188
+ }, r));
190
189
  case "long":
191
190
  default:
192
- return l.map((r, n)=>/* @__PURE__ */ v(y.Fragment, {
191
+ return l.map((n, r)=>/* @__PURE__ */ v(f.Fragment, {
193
192
  children: [
194
- n > 0 && " ",
195
- h(r.value),
196
- ` ${r.value === 1 ? M[r.unit] : D[r.unit]}`,
197
- n === l.length - 2 && ` ${e.timerAnd || t(A)}`,
198
- n < l.length - 2 && ","
193
+ r > 0 && " ",
194
+ h(n.value),
195
+ ` ${n.value === 1 ? M[n.unit] : D[n.unit]}`,
196
+ r === l.length - 2 && ` ${e.timerAnd || t(A)}`,
197
+ r < l.length - 2 && ","
199
198
  ]
200
- }, n));
199
+ }, r));
201
200
  }
202
- }, f = l.map((r, n)=>`${r.value} ${r.value === 1 ? M[r.unit] : D[r.unit]}${n === l.length - 1 ? "" : n === l.length - 2 ? ` ${e.timerAnd || t(A)} ` : ", "}`).join("");
201
+ }, y = l.map((n, r)=>`${n.value} ${n.value === 1 ? M[n.unit] : D[n.unit]}${r === l.length - 1 ? "" : r === l.length - 2 ? ` ${e.timerAnd || t(A)} ` : ", "}`).join("");
203
202
  return /* @__PURE__ */ v("span", _object_spread_props(_object_spread({
204
203
  role: "timer",
205
204
  "aria-labelledby": p,
206
- className: F,
205
+ className: j,
207
206
  style: {
208
207
  // try to keep the timer in the same line without wrapping only when label is not long
209
208
  display: a !== "long" ? "inline-block" : void 0
210
209
  }
211
- }, T(L, "TextTimer")), {
210
+ }, z(L, "TextTimer")), {
212
211
  children: [
213
212
  /* @__PURE__ */ m(q, {
214
213
  children: /* @__PURE__ */ m("span", {
215
214
  id: p,
216
- children: b ? `${b}. ${f}` : f
215
+ children: b ? `${b}. ${y}` : y
217
216
  })
218
217
  }),
219
218
  /* @__PURE__ */ m("span", {
220
219
  "aria-hidden": !0,
221
- className: F,
220
+ className: j,
222
221
  children: S()
223
222
  })
224
223
  ]
225
224
  }));
226
- }, Ee = (param)=>{
225
+ }, _e = (param)=>{
227
226
  let { boxed: s, endTimestamp: a, minTimeUnit: o, maxTimeUnit: i, onProgress: c, dataAttributes: L, "aria-label": b } = param;
228
- const { texts: e, t } = k(), p = y.useId(), l = ae(), g = U({
227
+ const { texts: e, t } = k(), p = f.useId(), l = se(), g = U({
229
228
  endTimestamp: a,
230
229
  minTimeUnit: o,
231
230
  maxTimeUnit: i,
@@ -233,12 +232,12 @@ const $ = 24, V = 60, X = 60, C = 1e3, Z = X * C, P = V * Z, Se = $ * P, H = (s,
233
232
  }), M = {
234
233
  days: e.timerDayLongLabel || t(R),
235
234
  hours: e.timerHourLongLabel || t(_),
236
- minutes: e.timerDisplayMinutesLabel || t(j),
235
+ minutes: e.timerDisplayMinutesLabel || t(x),
237
236
  seconds: e.timerDisplaySecondsLabel || t(w)
238
237
  }, D = {
239
238
  days: e.timerDaysLongLabel || t(O),
240
239
  hours: e.timerHoursLongLabel || t(E),
241
- minutes: e.timerDisplayMinutesLabel || t(j),
240
+ minutes: e.timerDisplayMinutesLabel || t(x),
242
241
  seconds: e.timerDisplaySecondsLabel || t(w)
243
242
  }, h = {
244
243
  days: e.timerDayLongLabel || t(R),
@@ -250,29 +249,29 @@ const $ = 24, V = 60, X = 60, C = 1e3, Z = X * C, P = V * Z, Se = $ * P, H = (s,
250
249
  hours: e.timerHoursLongLabel || t(E),
251
250
  minutes: e.timerMinutesLongLabel || t(K),
252
251
  seconds: e.timerSecondsLongLabel || t(Q)
253
- }, f = (d)=>{
252
+ }, y = (d)=>{
254
253
  const u = Math.max(String(d).length, 2);
255
- return /* @__PURE__ */ m(se, {
254
+ return /* @__PURE__ */ m(re, {
256
255
  children: /* @__PURE__ */ m("div", {
257
- className: B,
256
+ className: T,
258
257
  style: {
259
258
  minWidth: `${u}ch`
260
259
  },
261
260
  children: String(d).padStart(u, "0")
262
261
  })
263
262
  });
264
- }, r = g.map((d, u)=>`${d.value} ${d.value === 1 ? h[d.unit] : S[d.unit]}${u === g.length - 1 ? "" : u === g.length - 2 ? ` ${e.timerAnd || t(A)} ` : ", "}`).join(""), n = ()=>g.map((d, u)=>/* @__PURE__ */ m(ee, {
265
- className: x({
266
- [ue[l]]: s
263
+ }, n = g.map((d, u)=>`${d.value} ${d.value === 1 ? h[d.unit] : S[d.unit]}${u === g.length - 1 ? "" : u === g.length - 2 ? ` ${e.timerAnd || t(A)} ` : ", "}`).join(""), r = ()=>g.map((d, u)=>/* @__PURE__ */ m("div", {
264
+ className: F({
265
+ [le[l]]: s
267
266
  }),
268
- children: /* @__PURE__ */ m(oe, {
267
+ children: /* @__PURE__ */ m(ae, {
269
268
  variant: s ? "default" : l,
270
269
  children: /* @__PURE__ */ v("div", {
271
- className: x(ce, {
272
- [de]: s
270
+ className: F(ue, {
271
+ [ce]: s
273
272
  }),
274
273
  children: [
275
- f(d.value),
274
+ y(d.value),
276
275
  /* @__PURE__ */ m(ne, {
277
276
  regular: !0,
278
277
  children: d.value === 1 ? M[d.unit] : D[d.unit]
@@ -284,24 +283,24 @@ const $ = 24, V = 60, X = 60, C = 1e3, Z = X * C, P = V * Z, Se = $ * P, H = (s,
284
283
  return /* @__PURE__ */ v("div", _object_spread_props(_object_spread({
285
284
  role: "timer",
286
285
  "aria-labelledby": p,
287
- className: ie
288
- }, T(L, "Timer")), {
286
+ className: oe
287
+ }, z(L, "Timer")), {
289
288
  children: [
290
289
  /* @__PURE__ */ m(q, {
291
290
  children: /* @__PURE__ */ m("span", {
292
291
  id: p,
293
- children: b ? `${b}. ${r}` : r
292
+ children: b ? `${b}. ${n}` : n
294
293
  })
295
294
  }),
296
295
  /* @__PURE__ */ m("div", {
297
296
  "aria-hidden": !0,
298
- children: /* @__PURE__ */ m(re, {
297
+ children: /* @__PURE__ */ m(te, {
299
298
  space: s ? 8 : 16,
300
299
  wrap: !0,
301
- children: n()
300
+ children: r()
302
301
  })
303
302
  })
304
303
  ]
305
304
  }));
306
305
  };
307
- export { Oe as TextTimer, Ee as Timer };
306
+ export { Re as TextTimer, _e as Timer };