@telefonica/mistica 16.0.0 → 16.1.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 (152) hide show
  1. package/README.md +11 -9
  2. package/css/mistica.css +1 -1
  3. package/dist/box.d.ts +1 -0
  4. package/dist/box.js +12 -12
  5. package/dist/card.d.ts +14 -2
  6. package/dist/card.js +210 -206
  7. package/dist/credit-card-expiration-field.d.ts +1 -1
  8. package/dist/credit-card-expiration-field.js +53 -52
  9. package/dist/credit-card-number-field.d.ts +1 -1
  10. package/dist/credit-card-number-field.js +47 -45
  11. package/dist/cvv-field.d.ts +1 -1
  12. package/dist/cvv-field.js +38 -37
  13. package/dist/date-field.d.ts +1 -1
  14. package/dist/date-field.js +15 -13
  15. package/dist/date-time-field.d.ts +1 -1
  16. package/dist/date-time-field.js +13 -11
  17. package/dist/decimal-field.d.ts +1 -1
  18. package/dist/decimal-field.js +39 -38
  19. package/dist/email-field.d.ts +1 -1
  20. package/dist/email-field.js +21 -19
  21. package/dist/form-context.d.ts +7 -2
  22. package/dist/form-context.js +69 -62
  23. package/dist/form.d.ts +2 -1
  24. package/dist/form.js +94 -80
  25. package/dist/iban-field.d.ts +1 -1
  26. package/dist/iban-field.js +32 -30
  27. package/dist/index.d.ts +12 -3
  28. package/dist/index.js +19 -8
  29. package/dist/inline.d.ts +2 -1
  30. package/dist/inline.js +16 -15
  31. package/dist/integer-field.d.ts +1 -1
  32. package/dist/integer-field.js +30 -30
  33. package/dist/month-field.d.ts +1 -1
  34. package/dist/month-field.js +15 -13
  35. package/dist/package-version.js +1 -1
  36. package/dist/password-field.d.ts +1 -1
  37. package/dist/password-field.js +24 -22
  38. package/dist/phone-number-field.d.ts +4 -1
  39. package/dist/phone-number-field.js +84 -52
  40. package/dist/pin-field.js +21 -20
  41. package/dist/radio-button.d.ts +1 -0
  42. package/dist/radio-button.js +42 -41
  43. package/dist/rating.css-mistica.js +44 -0
  44. package/dist/rating.css.d.ts +11 -0
  45. package/dist/rating.css.ts.vanilla.css-mistica.js +11 -0
  46. package/dist/rating.d.ts +37 -0
  47. package/dist/rating.js +320 -0
  48. package/dist/search-field.d.ts +1 -0
  49. package/dist/search-field.js +18 -16
  50. package/dist/select.js +36 -33
  51. package/dist/sheet-action-row.css-mistica.js +13 -0
  52. package/dist/sheet-action-row.css.d.ts +1 -0
  53. package/dist/sheet-actions-list.d.ts +26 -0
  54. package/dist/sheet-actions-list.js +147 -0
  55. package/dist/sheet-actions.d.ts +23 -0
  56. package/dist/sheet-actions.js +175 -0
  57. package/dist/{sheet.css-mistica.js → sheet-common.css-mistica.js} +15 -21
  58. package/dist/{sheet.css.d.ts → sheet-common.css.d.ts} +0 -2
  59. package/dist/sheet-common.css.ts.vanilla.css-mistica.js +11 -0
  60. package/dist/sheet-common.d.ts +24 -0
  61. package/dist/sheet-common.js +429 -0
  62. package/dist/sheet-info.css-mistica.js +12 -0
  63. package/dist/sheet-info.css.d.ts +1 -0
  64. package/dist/sheet-info.d.ts +28 -0
  65. package/dist/sheet-info.js +156 -0
  66. package/dist/sheet-native.d.ts +2 -0
  67. package/dist/sheet-native.js +173 -0
  68. package/dist/sheet-radio-list.d.ts +22 -0
  69. package/dist/sheet-radio-list.js +143 -0
  70. package/dist/sheet-root.d.ts +4 -85
  71. package/dist/sheet-root.js +48 -322
  72. package/dist/sheet-types.d.ts +88 -0
  73. package/dist/sheet-web.d.ts +8 -0
  74. package/dist/sheet-web.js +183 -0
  75. package/dist/slider.js +40 -39
  76. package/dist/switch-component.js +18 -17
  77. package/dist/text-field-base.d.ts +3 -1
  78. package/dist/text-field-base.js +74 -66
  79. package/dist/text-field-components.css-mistica.js +14 -14
  80. package/dist/text-field-components.css.d.ts +2 -2
  81. package/dist/text-field-components.js +49 -39
  82. package/dist/text-field.d.ts +1 -0
  83. package/dist/text-field.js +24 -22
  84. package/dist/text-tokens.d.ts +14 -0
  85. package/dist/text-tokens.js +145 -89
  86. package/dist/theme-context-provider.js +6 -5
  87. package/dist/theme.d.ts +2 -0
  88. package/dist/utils/credit-card.d.ts +2 -2
  89. package/dist/utils/credit-card.js +1 -1
  90. package/dist/vivinho-loading-animation/in-lottie.json.js +544 -612
  91. package/dist/vivinho-loading-animation/out-lottie.json.js +828 -896
  92. package/dist/vivinho-loading-animation/pulse-lottie.json.js +798 -866
  93. package/dist/vivinho-loading-animation/wave-lottie.json.js +4303 -4409
  94. package/dist-es/box.js +18 -18
  95. package/dist-es/card.js +305 -301
  96. package/dist-es/credit-card-expiration-field.js +57 -56
  97. package/dist-es/credit-card-number-field.js +74 -72
  98. package/dist-es/cvv-field.js +82 -81
  99. package/dist-es/date-field.js +29 -27
  100. package/dist-es/date-time-field.js +29 -27
  101. package/dist-es/decimal-field.js +46 -45
  102. package/dist-es/email-field.js +26 -24
  103. package/dist-es/form-context.js +70 -63
  104. package/dist-es/form.js +102 -88
  105. package/dist-es/iban-field.js +35 -33
  106. package/dist-es/index.js +1822 -1817
  107. package/dist-es/inline.js +26 -25
  108. package/dist-es/integer-field.js +31 -31
  109. package/dist-es/month-field.js +28 -26
  110. package/dist-es/package-version.js +1 -1
  111. package/dist-es/password-field.js +37 -35
  112. package/dist-es/phone-number-field.js +92 -60
  113. package/dist-es/pin-field.js +32 -31
  114. package/dist-es/radio-button.js +42 -41
  115. package/dist-es/rating.css-mistica.js +6 -0
  116. package/dist-es/rating.css.ts.vanilla.css-mistica.js +2 -0
  117. package/dist-es/rating.js +257 -0
  118. package/dist-es/search-field.js +33 -31
  119. package/dist-es/select.js +49 -46
  120. package/dist-es/sheet-action-row.css-mistica.js +4 -0
  121. package/dist-es/sheet-actions-list.js +92 -0
  122. package/dist-es/sheet-actions.js +125 -0
  123. package/dist-es/sheet-common.css-mistica.js +4 -0
  124. package/dist-es/sheet-common.css.ts.vanilla.css-mistica.js +2 -0
  125. package/dist-es/sheet-common.js +366 -0
  126. package/dist-es/sheet-info.css-mistica.js +3 -0
  127. package/dist-es/sheet-info.js +101 -0
  128. package/dist-es/sheet-native.js +164 -0
  129. package/dist-es/sheet-radio-list.js +88 -0
  130. package/dist-es/sheet-root.js +50 -319
  131. package/dist-es/sheet-web.js +128 -0
  132. package/dist-es/slider.js +49 -48
  133. package/dist-es/style.css +1 -1
  134. package/dist-es/switch-component.js +27 -26
  135. package/dist-es/text-field-base.js +108 -100
  136. package/dist-es/text-field-components.css-mistica.js +2 -2
  137. package/dist-es/text-field-components.js +70 -60
  138. package/dist-es/text-field.js +33 -31
  139. package/dist-es/text-tokens.js +80 -45
  140. package/dist-es/theme-context-provider.js +20 -19
  141. package/dist-es/utils/credit-card.js +1 -1
  142. package/dist-es/vivinho-loading-animation/in-lottie.json.js +534 -599
  143. package/dist-es/vivinho-loading-animation/out-lottie.json.js +821 -886
  144. package/dist-es/vivinho-loading-animation/pulse-lottie.json.js +790 -855
  145. package/dist-es/vivinho-loading-animation/wave-lottie.json.js +4297 -4400
  146. package/package.json +4 -3
  147. package/dist/sheet.d.ts +0 -107
  148. package/dist/sheet.js +0 -642
  149. package/dist-es/sheet.css-mistica.js +0 -4
  150. package/dist-es/sheet.js +0 -567
  151. /package/dist/{sheet.css.ts.vanilla.css-mistica.js → sheet-action-row.css.ts.vanilla.css-mistica.js} +0 -0
  152. /package/dist-es/{sheet.css.ts.vanilla.css-mistica.js → sheet-action-row.css.ts.vanilla.css-mistica.js} +0 -0
package/dist-es/slider.js CHANGED
@@ -54,9 +54,9 @@ function _object_without_properties_loose(source, excluded) {
54
54
  }
55
55
  return target;
56
56
  }
57
- import { jsx as b, jsxs as te } from "react/jsx-runtime";
57
+ import { jsx as g, jsxs as te } from "react/jsx-runtime";
58
58
  import * as s from "react";
59
- import { iosThumb as oe, defaultThumb as re, thumbHover as ne, thumbActive as ae, container as ce, disabled as se, track as ie, thumbContainer as le, input as ue } from "./slider.css-mistica.js";
59
+ import { iosThumb as oe, defaultThumb as ne, thumbHover as re, thumbActive as ae, container as ce, disabled as se, track as ie, thumbContainer as le, input as ue } from "./slider.css-mistica.js";
60
60
  import { vars as Y } from "./skins/skin-contract.css-mistica.js";
61
61
  import { isTouchableDevice as fe } from "./utils/environment.js";
62
62
  import j from "classnames";
@@ -66,24 +66,24 @@ import he from "./tooltip.js";
66
66
  import be from "./box.js";
67
67
  import { useControlProps as ge } from "./form-context.js";
68
68
  import { combineRefs as ve } from "./utils/common.js";
69
- const Re = 48, me = 20, Ce = 28, Ve = (n, t, o)=>t >= o ? 0 : (n - t) / (o - t), I = (n, t, o, a, g)=>{
69
+ const Re = 48, me = 20, Ce = 28, Ve = (r, t, o)=>t >= o ? 0 : (r - t) / (o - t), I = (r, t, o, a, h)=>{
70
70
  const v = (i)=>{
71
71
  if (i === void 0) return t;
72
- const B = n ? t + (o - t) * i : i;
72
+ const B = r ? t + (o - t) * i : i;
73
73
  return Math.max(t, Math.min(o, B));
74
74
  };
75
75
  if (t >= o) return t;
76
- const h = v(g), P = t + Math.floor((h - t) / a) * a, R = t + Math.ceil((h - t) / a) * a;
77
- return R <= o && R - h <= h - P ? R : P;
78
- }, w = (n, t, o)=>{
76
+ const b = v(h), P = t + Math.floor((b - t) / a) * a, R = t + Math.ceil((b - t) / a) * a;
77
+ return R <= o && R - b <= b - P ? R : P;
78
+ }, w = (r, t, o)=>{
79
79
  if (!o) return t;
80
- if (t === void 0) return n;
80
+ if (t === void 0) return r;
81
81
  let a = 0;
82
- return o.forEach((g, v)=>{
83
- o && Math.abs(g - t) <= Math.abs(o[a] - t) && (a = v);
82
+ return o.forEach((h, v)=>{
83
+ o && Math.abs(h - t) <= Math.abs(o[a] - t) && (a = v);
84
84
  }), a;
85
85
  }, Pe = /*#__PURE__*/ s.forwardRef((_param, B)=>{
86
- var { values: n, step: t = 1, min: o = 0, max: a = 100, "aria-label": g, "aria-labelledby": v, id: h, dataAttributes: P, tooltip: R } = _param, i = _object_without_properties(_param, [
86
+ var { values: r, step: t = 1, min: o = 0, max: a = 100, "aria-label": h, "aria-labelledby": v, id: b, dataAttributes: P, tooltip: R } = _param, i = _object_without_properties(_param, [
87
87
  "values",
88
88
  "step",
89
89
  "min",
@@ -94,21 +94,22 @@ const Re = 48, me = 20, Ce = 28, Ve = (n, t, o)=>t >= o ? 0 : (n - t) / (o - t),
94
94
  "dataAttributes",
95
95
  "tooltip"
96
96
  ]);
97
- n && (n.length === 0 ? n = void 0 : a = n.length - 1), t = t | 0, t = t <= 0 ? 1 : t;
97
+ r && (r.length === 0 ? r = void 0 : a = r.length - 1), t = t | 0, t = t <= 0 ? 1 : t;
98
98
  const { defaultValue: Z, value: D, onChange: H, focusableRef: x, disabled: U, name: z } = ge({
99
99
  name: i.name,
100
- value: i.value !== void 0 ? I(!1, o, a, t, w(o, i.value, n)) : void 0,
101
- defaultValue: i.defaultValue !== void 0 ? I(!1, o, a, t, w(o, i.defaultValue, n)) : void 0,
100
+ label: h,
101
+ value: i.value !== void 0 ? I(!1, o, a, t, w(o, i.value, r)) : void 0,
102
+ defaultValue: i.defaultValue !== void 0 ? I(!1, o, a, t, w(o, i.defaultValue, r)) : void 0,
102
103
  onChange: i.onChangeValue,
103
104
  disabled: i.disabled
104
- }), [q, G] = s.useState(D !== null && D !== void 0 ? D : I(!1, o, a, t, w(o, Z, n))), u = D !== null && D !== void 0 ? D : q, $ = s.useRef(u), T = s.useCallback((e, r)=>{
105
- const c = I(r, o, a, t, e);
106
- $.current !== c && (H(n ? n[c] : c), G(c), $.current = c);
105
+ }), [q, G] = s.useState(D !== null && D !== void 0 ? D : I(!1, o, a, t, w(o, Z, r))), u = D !== null && D !== void 0 ? D : q, $ = s.useRef(u), T = s.useCallback((e, n)=>{
106
+ const c = I(n, o, a, t, e);
107
+ $.current !== c && (H(r ? r[c] : c), G(c), $.current = c);
107
108
  }, [
108
109
  o,
109
110
  a,
110
111
  t,
111
- n,
112
+ r,
112
113
  H
113
114
  ]);
114
115
  s.useEffect(()=>{
@@ -116,30 +117,30 @@ const Re = 48, me = 20, Ce = 28, Ve = (n, t, o)=>t >= o ? 0 : (n - t) / (o - t),
116
117
  }, [
117
118
  T
118
119
  ]);
119
- const _ = s.useRef(null), m = s.useRef(null), N = s.useRef(null), J = s.useRef(null), [p, E] = s.useState(!1), [y, F] = s.useState(!1), [K, L] = s.useState(!1), { isIos: S } = de(), A = (e, r, c)=>{
120
+ const _ = s.useRef(null), m = s.useRef(null), N = s.useRef(null), J = s.useRef(null), [p, E] = s.useState(!1), [y, F] = s.useState(!1), [K, O] = s.useState(!1), { isIos: S } = de(), A = (e, n, c)=>{
120
121
  const d = e == null ? void 0 : e.getBoundingClientRect();
121
- return !!d && d.left <= r && r <= d.right && d.top <= c && c <= d.bottom;
122
+ return !!d && d.left <= n && n <= d.right && d.top <= c && c <= d.bottom;
122
123
  }, l = fe(), C = S ? Ce : me, f = l ? Re : C, M = (e)=>{
123
- const r = _.current;
124
- if (r) {
125
- const c = r.getBoundingClientRect().left + C / 2, d = r.getBoundingClientRect().right - C / 2;
124
+ const n = _.current;
125
+ if (n) {
126
+ const c = n.getBoundingClientRect().left + C / 2, d = n.getBoundingClientRect().right - C / 2;
126
127
  T((e - c) / (d - c), !0);
127
128
  }
128
129
  }, Q = (e)=>{
129
130
  V(e), M(e.clientX);
130
131
  }, W = (e)=>{
131
- const r = m.current;
132
- r && (r.onpointermove = Q, r.setPointerCapture(e.pointerId));
132
+ const n = m.current;
133
+ n && (n.onpointermove = Q, n.setPointerCapture(e.pointerId));
133
134
  }, ee = (e)=>{
134
- const r = m.current;
135
- r && (r.onpointermove = null, r.releasePointerCapture(e.pointerId));
136
- }, k = `calc(${Ve(u, o, a)} * (100% - ${C}px) - ${(f - C) / 2}px)`, O = `calc(${k} + ${f / 2}px)`, X = /* @__PURE__ */ b("div", {
137
- className: j(S ? oe : re, {
138
- [ne]: !S && y && !p,
135
+ const n = m.current;
136
+ n && (n.onpointermove = null, n.releasePointerCapture(e.pointerId));
137
+ }, k = `calc(${Ve(u, o, a)} * (100% - ${C}px) - ${(f - C) / 2}px)`, X = `calc(${k} + ${f / 2}px)`, L = /* @__PURE__ */ g("div", {
138
+ className: j(S ? oe : ne, {
139
+ [re]: !S && y && !p,
139
140
  [ae]: !S && p
140
141
  })
141
142
  });
142
- return /* @__PURE__ */ b(be, {
143
+ return /* @__PURE__ */ g(be, {
143
144
  paddingY: 8,
144
145
  dataAttributes: _object_spread({
145
146
  "component-name": "Slider"
@@ -153,16 +154,16 @@ const Re = 48, me = 20, Ce = 28, Ve = (n, t, o)=>t >= o ? 0 : (n - t) / (o - t),
153
154
  },
154
155
  ref: N,
155
156
  onPointerDown: (e)=>{
156
- const r = e.clientX, c = e.clientY;
157
- !l && A(N.current, r, c) ? (A(m.current, r, c) || M(r), E(!0), W(e)) : V(e);
157
+ const n = e.clientX, c = e.clientY;
158
+ !l && A(N.current, n, c) ? (A(m.current, n, c) || M(n), E(!0), W(e)) : V(e);
158
159
  },
159
160
  onPointerUp: (e)=>{
160
161
  l || (E(!1), ee(e));
161
162
  },
162
163
  onTouchStart: (e)=>{
163
164
  if (V(e), l) {
164
- const r = e.nativeEvent.touches[0].clientX, c = e.nativeEvent.touches[0].clientY;
165
- A(m.current, r, c) || M(r), E(!0);
165
+ const n = e.nativeEvent.touches[0].clientX, c = e.nativeEvent.touches[0].clientY;
166
+ A(m.current, n, c) || M(n), E(!0);
166
167
  }
167
168
  },
168
169
  onTouchEnd: (e)=>{
@@ -172,14 +173,14 @@ const Re = 48, me = 20, Ce = 28, Ve = (n, t, o)=>t >= o ? 0 : (n - t) / (o - t),
172
173
  V(e), l && M(e.nativeEvent.touches[0].clientX);
173
174
  },
174
175
  children: [
175
- /* @__PURE__ */ b("div", {
176
+ /* @__PURE__ */ g("div", {
176
177
  className: ie,
177
178
  ref: _,
178
179
  style: {
179
- background: `linear-gradient(to right, ${Y.colors.controlActivated} ${O}, ${Y.colors.barTrack} ${O}`
180
+ background: `linear-gradient(to right, ${Y.colors.controlActivated} ${X}, ${Y.colors.barTrack} ${X}`
180
181
  }
181
182
  }),
182
- /* @__PURE__ */ b("div", {
183
+ /* @__PURE__ */ g("div", {
183
184
  className: le,
184
185
  ref: m,
185
186
  style: {
@@ -194,25 +195,25 @@ const Re = 48, me = 20, Ce = 28, Ve = (n, t, o)=>t >= o ? 0 : (n - t) / (o - t),
194
195
  onPointerLeave: ()=>{
195
196
  l || F(!1);
196
197
  },
197
- children: R ? /* @__PURE__ */ b(he, {
198
- target: X,
198
+ children: R ? /* @__PURE__ */ g(he, {
199
+ target: L,
199
200
  open: p || K || y ? !0 : void 0,
200
- description: String(n ? n[u] : u),
201
+ description: String(r ? r[u] : u),
201
202
  centerContent: !0,
202
203
  delay: !1
203
- }) : X
204
+ }) : L
204
205
  }),
205
- /* @__PURE__ */ b("input", {
206
+ /* @__PURE__ */ g("input", {
206
207
  type: "range",
207
208
  min: o,
208
209
  max: a,
209
210
  ref: ve(B, J, x),
210
211
  step: t,
211
- "aria-label": g,
212
+ "aria-label": h,
212
213
  "aria-labelledby": v,
213
- id: h,
214
+ id: b,
214
215
  className: ue,
215
- "aria-valuetext": String(n ? n[u] : u),
216
+ "aria-valuetext": String(r ? r[u] : u),
216
217
  style: {
217
218
  left: k,
218
219
  width: f,
@@ -223,10 +224,10 @@ const Re = 48, me = 20, Ce = 28, Ve = (n, t, o)=>t >= o ? 0 : (n - t) / (o - t),
223
224
  disabled: U,
224
225
  onChange: (e)=>T(+e.target.value, !1),
225
226
  onFocus: ()=>{
226
- L(!0);
227
+ O(!0);
227
228
  },
228
229
  onBlur: ()=>{
229
- L(!1);
230
+ O(!1);
230
231
  }
231
232
  })
232
233
  ]