@telefonica/mistica 14.1.0 → 14.3.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.
@@ -1,2 +1,2 @@
1
- const o = "14.1.0";
1
+ const o = "14.3.0";
2
2
  export { o as PACKAGE_VERSION };
package/dist-es/select.js CHANGED
@@ -50,26 +50,26 @@ function _objectSpreadProps(target, source) {
50
50
  }
51
51
  return target;
52
52
  }
53
- import * as r from "react";
54
- import oe from "classnames";
55
- import { useForm as Ce } from "./form-context.js";
56
- import { useAriaId as Ne, useTheme as Ae } from "./hooks.js";
57
- import { TAB as Re, ESC as be, ENTER as re, SPACE as se, UP as ve, DOWN as ke } from "./utils/key-codes.js";
58
- import { FieldContainer as _e, HelperText as Ve, Label as De } from "./text-field-components.js";
53
+ import * as s from "react";
54
+ import se from "classnames";
55
+ import { useForm as ve } from "./form-context.js";
56
+ import { useAriaId as Ae, useTheme as Re } from "./hooks.js";
57
+ import { TAB as be, ESC as _e, ENTER as oe, SPACE as re, UP as ke, DOWN as Ve } from "./utils/key-codes.js";
58
+ import { FieldContainer as De, HelperText as Me, Label as He } from "./text-field-components.js";
59
59
  import ie from "./generated/mistica-icons/icon-chevron-down-regular.js";
60
- import { TextFieldBaseAutosuggest as Me } from "./text-field-base.js";
61
- import He from "./overlay.js";
62
- import { isAndroid as Fe, isIos as Pe } from "./utils/platform.js";
60
+ import { TextFieldBaseAutosuggest as Fe } from "./text-field-base.js";
61
+ import Pe from "./overlay.js";
62
+ import { isAndroid as Ge, isIos as Ze } from "./utils/platform.js";
63
63
  import { cancelEvent as m } from "./utils/dom.js";
64
- import { Text3 as Ge } from "./text.js";
65
- import { selectVariants as Ze, arrowDown as We, selectContainerVariants as Be, selectTextVariants as Le, vars as C, optionsContainer as $e, optionsAnimationsVariants as ce, menuItem as qe, menuItemSelected as je } from "./select.css-mistica.js";
66
- import { assignInlineVars as ze } from "@vanilla-extract/dynamic";
67
- import { jsxs as k, jsx as a, Fragment as Ke } from "./_virtual/jsx-runtime.js";
68
- const ut = (param)=>{
69
- let { id: le , label: h , helperText: ae , value: _ , onChangeValue: V , name: i , fullWidth: D , options: d , optional: M , disabled: ue , error: de , onBlur: H , autoFocus: q = !1 , native: fe } = param;
64
+ import { Text3 as We } from "./text.js";
65
+ import { selectVariants as Be, arrowDown as Le, selectContainerVariants as $e, selectTextVariants as qe, vars as C, optionsContainer as je, optionsAnimationsVariants as ce, menuItem as ze, menuItemSelected as Ke } from "./select.css-mistica.js";
66
+ import { assignInlineVars as Ue } from "@vanilla-extract/dynamic";
67
+ import { jsxs as _, jsx as a, Fragment as Xe } from "./_virtual/jsx-runtime.js";
68
+ const ft = (param)=>{
69
+ let { id: le , label: h , helperText: ae , value: k , onChangeValue: V , name: i , fullWidth: D , options: d , optional: M , disabled: ue , error: de , onBlur: H , autoFocus: q = !1 , native: fe } = param;
70
70
  var ee, te, ne;
71
- const g = r.useRef(null), f = r.useRef(null), T = r.useRef(null), I = r.useRef(null), N = r.useRef(/* @__PURE__ */ new Map()), [c, pe] = r.useState(), [F, j] = r.useState(!1), [z, K] = r.useState(!1), [U, y] = r.useState(!1), [u, P] = r.useState({}), [x, G] = r.useState(), Z = r.useRef(null), W = Ne(le), { rawValues: me , setRawValue: B , setValue: L , formStatus: he , formErrors: X , setFormError: ge , register: $ } = Ce(), { platformOverrides: J } = Ae(), Te = fe || process.env.NODE_ENV === "test" || Fe(J) || Pe(J), E = ue || he === "sending", A = de || !!X[i], Q = X[i] || ae, o = _ != null ? _ : me[i], R = (e)=>{
72
- V == null || V(e), ge({
71
+ const g = s.useRef(null), f = s.useRef(null), S = s.useRef(null), T = s.useRef(null), N = s.useRef(/* @__PURE__ */ new Map()), [pe, me] = s.useState(!0), [c, he] = s.useState(), [F, j] = s.useState(!1), [z, K] = s.useState(!1), [U, y] = s.useState(!1), [u, P] = s.useState({}), [I, G] = s.useState(), Z = s.useRef(null), W = Ae(le), { rawValues: ge , setRawValue: B , setValue: L , formStatus: Se , formErrors: X , setFormError: Te , register: $ } = ve(), { platformOverrides: J } = Re(), Ie = fe || process.env.NODE_ENV === "test" && !process.env.SSR_TEST || Ge(J) || Ze(J), E = ue || Se === "sending", v = de || !!X[i], Q = X[i] || ae, o = k != null ? k : ge[i], A = (e)=>{
72
+ V == null || V(e), Te({
73
73
  name: i,
74
74
  error: ""
75
75
  }), B({
@@ -79,19 +79,19 @@ const ut = (param)=>{
79
79
  name: i,
80
80
  value: e
81
81
  });
82
- }, S = (e)=>{
82
+ }, x = (e)=>{
83
83
  if (e) {
84
- if (T != null && T.current) {
85
- const { top: s , width: w , left: O , height: b } = T.current.getBoundingClientRect(), p = s + b, v = Math.min(d.length, 8) * 48 + 16;
86
- if (p + v + 12 > window.innerHeight) {
87
- const Oe = window.innerHeight - p;
88
- if (s > Oe) {
89
- const ye = s - v;
84
+ if (S != null && S.current) {
85
+ const { top: r , width: w , left: O , height: R } = S.current.getBoundingClientRect(), p = r + R, b = Math.min(d.length, 8) * 48 + 16;
86
+ if (p + b + 12 > window.innerHeight) {
87
+ const Ce = window.innerHeight - p;
88
+ if (r > Ce) {
89
+ const Ne = r - b;
90
90
  P({
91
91
  minWidth: w,
92
92
  left: O,
93
- top: Math.max(ye, 12),
94
- maxHeight: Math.min(s - 12, v),
93
+ top: Math.max(Ne, 12),
94
+ maxHeight: Math.min(r - 12, b),
95
95
  transformOrigin: "center bottom"
96
96
  });
97
97
  } else P({
@@ -105,30 +105,30 @@ const ut = (param)=>{
105
105
  minWidth: w,
106
106
  top: p,
107
107
  left: O,
108
- maxHeight: v,
108
+ maxHeight: b,
109
109
  transformOrigin: "center top"
110
110
  });
111
111
  }
112
112
  j(!0), requestAnimationFrame(()=>{
113
- Z.current && I.current && "scrollTop" in I.current && (I.current.scrollTop = Z.current), K(!0);
113
+ Z.current && T.current && "scrollTop" in T.current && (T.current.scrollTop = Z.current), K(!0);
114
114
  }), G(c != null ? c : o);
115
115
  } else K(!1), j(!1), G(void 0);
116
116
  }, Y = (e)=>{
117
117
  var t;
118
- Z.current = (t = I.current) == null ? void 0 : t.scrollTop, S(!1), R && typeof e == "string" && R(e), typeof o > "u" && pe(e);
119
- }, Ie = (e)=>{
118
+ Z.current = (t = T.current) == null ? void 0 : t.scrollTop, x(!1), A && typeof e == "string" && A(e), typeof o > "u" && he(e);
119
+ }, Ee = (e)=>{
120
120
  var n;
121
- const t = (n = I.current) == null ? void 0 : n.getBoundingClientRect();
121
+ const t = (n = T.current) == null ? void 0 : n.getBoundingClientRect();
122
122
  if (t && e && N.current.has(e)) {
123
- const l = N.current.get(e), s = l == null ? void 0 : l.getBoundingClientRect();
124
- if (s && s.top + s.height / 2 >= t.top + t.height) {
123
+ const l = N.current.get(e), r = l == null ? void 0 : l.getBoundingClientRect();
124
+ if (r && r.top + r.height / 2 >= t.top + t.height) {
125
125
  l == null || l.scrollIntoView();
126
126
  return;
127
127
  }
128
- s && s.top + s.height / 2 <= t.top && (l == null || l.scrollIntoView(!1));
128
+ r && r.top + r.height / 2 <= t.top && (l == null || l.scrollIntoView(!1));
129
129
  }
130
- }, xe = f.current, Ee = g.current;
131
- r.useEffect(()=>{
130
+ }, xe = f.current, we = g.current;
131
+ s.useEffect(()=>{
132
132
  B({
133
133
  name: i,
134
134
  value: o
@@ -141,7 +141,7 @@ const ut = (param)=>{
141
141
  B,
142
142
  L,
143
143
  o
144
- ]), r.useEffect(()=>($(i, {
144
+ ]), s.useEffect(()=>($(i, {
145
145
  input: g.current,
146
146
  focusableElement: f.current
147
147
  }), ()=>{
@@ -155,78 +155,80 @@ const ut = (param)=>{
155
155
  f,
156
156
  g,
157
157
  xe,
158
- Ee
159
- ]), r.useEffect(()=>{
158
+ we
159
+ ]), s.useEffect(()=>{
160
160
  const e = (n)=>{
161
161
  var w, O;
162
- const s = {
163
- [ve]: -1,
164
- [ke]: 1
162
+ const r = {
163
+ [ke]: -1,
164
+ [Ve]: 1
165
165
  }[n.keyCode];
166
- if (s) {
166
+ if (r) {
167
167
  m(n);
168
- const b = (O = (w = d[d.findIndex((param)=>{
168
+ const R = (O = (w = d[d.findIndex((param)=>{
169
169
  let { value: p } = param;
170
- return p === x;
171
- }) + s]) == null ? void 0 : w.value) != null ? O : x;
172
- G(b), Ie(b);
170
+ return p === I;
171
+ }) + r]) == null ? void 0 : w.value) != null ? O : I;
172
+ G(R), Ee(R);
173
173
  }
174
174
  }, t = (n)=>{
175
- F && (n.keyCode === Re && m(n), n.keyCode === be && S(!1), (n.keyCode === re || n.keyCode === se) && (m(n), d.findIndex((param)=>{
175
+ F && (n.keyCode === be && m(n), n.keyCode === _e && x(!1), (n.keyCode === oe || n.keyCode === re) && (m(n), d.findIndex((param)=>{
176
176
  let { value: l } = param;
177
- return l === x;
178
- }) !== -1 && x !== c && Y(x), S(!1))), z && e(n);
177
+ return l === I;
178
+ }) !== -1 && I !== c && Y(I), x(!1))), z && e(n);
179
179
  };
180
180
  return document.addEventListener("keydown", t, !1), ()=>{
181
181
  document.removeEventListener("keydown", t, !1);
182
182
  };
183
- }), r.useEffect(()=>{
183
+ }), s.useEffect(()=>{
184
184
  q && f.current && f.current.focus();
185
185
  }, [
186
186
  q
187
- ]);
188
- const Se = (e)=>{
187
+ ]), s.useEffect(()=>{
188
+ me(!1);
189
+ }, []);
190
+ const Oe = (e)=>{
189
191
  var t;
190
192
  return e ? (t = d.find((param)=>{
191
193
  let { value: n } = param;
192
194
  return n === e;
193
195
  })) == null ? void 0 : t.text : "";
194
- }, we = {
196
+ }, ye = {
195
197
  tabIndex: 0,
196
198
  onFocus: ()=>y(!0),
197
199
  onBlur: ()=>y(!1),
198
200
  onClick: ()=>{
199
- S(!0), y(!0);
201
+ x(!0), y(!0);
200
202
  },
201
203
  onKeyDown: (e)=>{
202
- !F && (e.keyCode === se || e.keyCode === re) && (m(e), S(!0));
204
+ !F && (e.keyCode === re || e.keyCode === oe) && (m(e), x(!0));
203
205
  }
204
206
  };
205
- return Te ? /* @__PURE__ */ k(_e, {
207
+ return Ie || pe ? /* @__PURE__ */ _(De, {
206
208
  disabled: E,
207
- helperText: /* @__PURE__ */ a(Ve, {
208
- error: A,
209
+ helperText: /* @__PURE__ */ a(Me, {
210
+ error: v,
209
211
  leftText: Q
210
212
  }),
211
- fieldRef: T,
213
+ fieldRef: S,
212
214
  fullWidth: D,
213
215
  children: [
214
- h && /* @__PURE__ */ a(De, {
215
- error: A,
216
+ h && /* @__PURE__ */ a(He, {
217
+ error: v,
216
218
  forId: W,
217
219
  inputState: U ? "focused" : ((te = o != null ? o : c) != null ? te : (ee = g.current) == null ? void 0 : ee.value) ? "filled" : "default",
218
220
  optional: M,
219
221
  children: h
220
222
  }),
221
- /* @__PURE__ */ k("select", {
222
- className: Ze[E ? "disabled" : "default"],
223
+ /* @__PURE__ */ _("select", {
224
+ className: Be[E ? "disabled" : "default"],
223
225
  id: W,
224
- "aria-invalid": !!A,
226
+ "aria-invalid": !!v,
225
227
  value: o,
226
228
  required: !M,
227
229
  disabled: E,
228
230
  onChange: (e)=>{
229
- R && R(e.target.value);
231
+ A && A(e.target.value);
230
232
  },
231
233
  onFocus: ()=>y(!0),
232
234
  onBlur: (e)=>{
@@ -265,23 +267,23 @@ const ut = (param)=>{
265
267
  ]
266
268
  }),
267
269
  /* @__PURE__ */ a("div", {
268
- className: We,
270
+ className: Le,
269
271
  "aria-hidden": !0,
270
272
  children: /* @__PURE__ */ a(ie, {
271
273
  size: 20
272
274
  })
273
275
  })
274
276
  ]
275
- }) : /* @__PURE__ */ k(Ke, {
277
+ }) : /* @__PURE__ */ _(Xe, {
276
278
  children: [
277
- /* @__PURE__ */ k("div", _objectSpreadProps(_objectSpread({
278
- className: Be[D ? "fullWidth" : "default"],
279
+ /* @__PURE__ */ _("div", _objectSpreadProps(_objectSpread({
280
+ className: $e[D ? "fullWidth" : "default"],
279
281
  role: "button",
280
282
  "aria-haspopup": "listbox",
281
283
  ref: f
282
- }, !E && we), {
284
+ }, !E && ye), {
283
285
  children: [
284
- /* @__PURE__ */ a(Me, {
286
+ /* @__PURE__ */ a(Fe, {
285
287
  style: {
286
288
  visibility: "hidden"
287
289
  },
@@ -298,26 +300,26 @@ const ut = (param)=>{
298
300
  required: !M,
299
301
  disabled: E,
300
302
  id: W,
301
- error: A,
303
+ error: v,
302
304
  inputRef: g,
303
- fieldRef: T
305
+ fieldRef: S
304
306
  }),
305
307
  /* @__PURE__ */ a("div", {
306
- className: Le[E ? "disabled" : "default"],
308
+ className: qe[E ? "disabled" : "default"],
307
309
  style: {
308
310
  top: h ? 27 : 17
309
311
  },
310
- children: Se(o != null ? o : c)
312
+ children: Oe(o != null ? o : c)
311
313
  })
312
314
  ]
313
315
  })),
314
- F && /* @__PURE__ */ a(He, {
316
+ F && /* @__PURE__ */ a(Pe, {
315
317
  onPress: (e)=>{
316
- S(!1), m(e);
318
+ x(!1), m(e);
317
319
  },
318
320
  disableScroll: !0,
319
321
  children: /* @__PURE__ */ a("ul", {
320
- style: ze({
322
+ style: Ue({
321
323
  [C.top]: u.top ? `${u.top}px` : "",
322
324
  [C.left]: u.left ? `${u.left}px` : "",
323
325
  [C.maxHeight]: u.maxHeight ? `${u.maxHeight}px` : "",
@@ -325,24 +327,24 @@ const ut = (param)=>{
325
327
  [C.transformOrigin]: (ne = u.transformOrigin) != null ? ne : ""
326
328
  }),
327
329
  onPointerDown: m,
328
- className: oe($e, z ? ce.show : ce.hide),
330
+ className: se(je, z ? ce.show : ce.hide),
329
331
  role: "listbox",
330
- ref: I,
332
+ ref: T,
331
333
  children: d.map((param)=>/* @__PURE__ */ {
332
334
  let { value: e , text: t } = param;
333
335
  return a("li", {
334
336
  role: "option",
335
337
  "aria-selected": e === (c != null ? c : o),
336
338
  "data-value": e,
337
- className: oe(qe, {
338
- [je]: e === x || e === (c != null ? c : o)
339
+ className: se(ze, {
340
+ [Ke]: e === I || e === (c != null ? c : o)
339
341
  }),
340
342
  onPointerDown: m,
341
343
  onClick: ()=>Y(e),
342
344
  ref: (n)=>{
343
345
  n ? N.current.set(e, n) : N.current.delete(e);
344
346
  },
345
- children: /* @__PURE__ */ a(Ge, {
347
+ children: /* @__PURE__ */ a(We, {
346
348
  regular: !0,
347
349
  children: t
348
350
  })
@@ -353,4 +355,4 @@ const ut = (param)=>{
353
355
  ]
354
356
  });
355
357
  };
356
- export { ut as default };
358
+ export { ft as default };
@@ -42,7 +42,7 @@ const e = {
42
42
  movistarProminentBlueLight50: "#85939C",
43
43
  movistarProminentBlueLight70: "#546874",
44
44
  darkModeBlack: "#061824",
45
- darkModeGrey: "#092130",
45
+ darkModeGrey: "#081F2E",
46
46
  darkModeGrey2: "#EAEBEE",
47
47
  darkModeGrey3: "#CED4D7",
48
48
  darkModeGrey4: "#85939C",
@@ -153,12 +153,12 @@ const e = {
153
153
  backgroundBrand: e.darkModeBlack,
154
154
  backgroundBrandSecondary: e.darkModeBlack,
155
155
  backgroundOverlay: r(e.darkModeGrey, 0.8),
156
- backgroundSkeleton: e.darkModeGrey6,
157
- backgroundSkeletonInverse: e.darkModeGrey6,
156
+ backgroundSkeleton: e.movistarBlueDark,
157
+ backgroundSkeletonInverse: e.movistarBlueDark,
158
158
  navigationBarBackground: e.darkModeBlack,
159
159
  backgroundAlternative: e.darkModeGrey,
160
160
  backgroundFeedbackBottom: e.darkModeBlack,
161
- skeletonWave: e.darkModeGrey5,
161
+ skeletonWave: e.darkModeGrey6,
162
162
  borderHigh: e.darkModeGrey4,
163
163
  borderLow: e.darkModeBlack,
164
164
  border: e.darkModeGrey,
@@ -200,7 +200,7 @@ const e = {
200
200
  inverse: e.darkModeGrey2,
201
201
  neutralHigh: e.darkModeGrey2,
202
202
  neutralMedium: e.darkModeGrey5,
203
- neutralLow: e.darkModeGrey6,
203
+ neutralLow: e.movistarBlueDark,
204
204
  textPrimary: e.darkModeGrey2,
205
205
  textPrimaryInverse: e.darkModeGrey2,
206
206
  textSecondary: e.darkModeGrey4,
@@ -211,11 +211,11 @@ const e = {
211
211
  textNavigationSearchBarText: e.darkModeGrey2,
212
212
  textAppBar: e.darkModeGrey5,
213
213
  textAppBarSelected: e.darkModeGrey2,
214
- successLow: e.grey6,
215
- warningLow: e.grey6,
216
- errorLow: e.grey6,
217
- promoLow: e.grey6,
218
- brandLow: e.grey6,
214
+ successLow: e.movistarBlueDark,
215
+ warningLow: e.movistarBlueDark,
216
+ errorLow: e.movistarBlueDark,
217
+ promoLow: e.movistarBlueDark,
218
+ brandLow: e.movistarBlueDark,
219
219
  successHigh: e.movistarGreen40,
220
220
  warningHigh: e.egg40,
221
221
  errorHigh: e.pepper40,