@telefonica/mistica 14.1.0 → 14.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.
package/dist/select.js CHANGED
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "default", {
6
6
  enumerable: true,
7
- get: ()=>ut
7
+ get: ()=>ft
8
8
  });
9
9
  const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
10
10
  const _classnames = /*#__PURE__*/ _interopRequireDefault(require("classnames"));
@@ -117,11 +117,11 @@ function _objectSpreadProps(target, source) {
117
117
  }
118
118
  return target;
119
119
  }
120
- const ut = (param)=>{
121
- 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;
120
+ const ft = (param)=>{
121
+ 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;
122
122
  var ee, te, ne;
123
- const g = _react.useRef(null), f = _react.useRef(null), T = _react.useRef(null), I = _react.useRef(null), N = _react.useRef(/* @__PURE__ */ new Map()), [c, pe] = _react.useState(), [F, j] = _react.useState(!1), [z, K] = _react.useState(!1), [U, y] = _react.useState(!1), [u, P] = _react.useState({}), [x, G] = _react.useState(), Z = _react.useRef(null), W = (0, _hooksJs.useAriaId)(le), { rawValues: me , setRawValue: B , setValue: L , formStatus: he , formErrors: X , setFormError: ge , register: $ } = (0, _formContextJs.useForm)(), { platformOverrides: J } = (0, _hooksJs.useTheme)(), Te = fe || process.env.NODE_ENV === "test" || (0, _platformJs.isAndroid)(J) || (0, _platformJs.isIos)(J), E = ue || he === "sending", A = de || !!X[i], Q = X[i] || ae, o = _ != null ? _ : me[i], R = (e)=>{
124
- V == null || V(e), ge({
123
+ const g = _react.useRef(null), f = _react.useRef(null), S = _react.useRef(null), T = _react.useRef(null), N = _react.useRef(/* @__PURE__ */ new Map()), [pe, me] = _react.useState(!0), [c, he] = _react.useState(), [F, j] = _react.useState(!1), [z, K] = _react.useState(!1), [U, y] = _react.useState(!1), [u, P] = _react.useState({}), [I, G] = _react.useState(), Z = _react.useRef(null), W = (0, _hooksJs.useAriaId)(le), { rawValues: ge , setRawValue: B , setValue: L , formStatus: Se , formErrors: X , setFormError: Te , register: $ } = (0, _formContextJs.useForm)(), { platformOverrides: J } = (0, _hooksJs.useTheme)(), Ie = fe || process.env.NODE_ENV === "test" && !process.env.SSR_TEST || (0, _platformJs.isAndroid)(J) || (0, _platformJs.isIos)(J), E = ue || Se === "sending", v = de || !!X[i], Q = X[i] || ae, o = k != null ? k : ge[i], A = (e)=>{
124
+ V == null || V(e), Te({
125
125
  name: i,
126
126
  error: ""
127
127
  }), B({
@@ -131,19 +131,19 @@ const ut = (param)=>{
131
131
  name: i,
132
132
  value: e
133
133
  });
134
- }, S = (e)=>{
134
+ }, x = (e)=>{
135
135
  if (e) {
136
- if (T != null && T.current) {
137
- const { top: s , width: w , left: O , height: b } = T.current.getBoundingClientRect(), p = s + b, v = Math.min(d.length, 8) * 48 + 16;
138
- if (p + v + 12 > window.innerHeight) {
139
- const Oe = window.innerHeight - p;
140
- if (s > Oe) {
141
- const ye = s - v;
136
+ if (S != null && S.current) {
137
+ const { top: r , width: w , left: O , height: R } = S.current.getBoundingClientRect(), p = r + R, b = Math.min(d.length, 8) * 48 + 16;
138
+ if (p + b + 12 > window.innerHeight) {
139
+ const Ce = window.innerHeight - p;
140
+ if (r > Ce) {
141
+ const Ne = r - b;
142
142
  P({
143
143
  minWidth: w,
144
144
  left: O,
145
- top: Math.max(ye, 12),
146
- maxHeight: Math.min(s - 12, v),
145
+ top: Math.max(Ne, 12),
146
+ maxHeight: Math.min(r - 12, b),
147
147
  transformOrigin: "center bottom"
148
148
  });
149
149
  } else P({
@@ -157,29 +157,29 @@ const ut = (param)=>{
157
157
  minWidth: w,
158
158
  top: p,
159
159
  left: O,
160
- maxHeight: v,
160
+ maxHeight: b,
161
161
  transformOrigin: "center top"
162
162
  });
163
163
  }
164
164
  j(!0), requestAnimationFrame(()=>{
165
- Z.current && I.current && "scrollTop" in I.current && (I.current.scrollTop = Z.current), K(!0);
165
+ Z.current && T.current && "scrollTop" in T.current && (T.current.scrollTop = Z.current), K(!0);
166
166
  }), G(c != null ? c : o);
167
167
  } else K(!1), j(!1), G(void 0);
168
168
  }, Y = (e)=>{
169
169
  var t;
170
- Z.current = (t = I.current) == null ? void 0 : t.scrollTop, S(!1), R && typeof e == "string" && R(e), typeof o > "u" && pe(e);
171
- }, Ie = (e)=>{
170
+ Z.current = (t = T.current) == null ? void 0 : t.scrollTop, x(!1), A && typeof e == "string" && A(e), typeof o > "u" && he(e);
171
+ }, Ee = (e)=>{
172
172
  var n;
173
- const t = (n = I.current) == null ? void 0 : n.getBoundingClientRect();
173
+ const t = (n = T.current) == null ? void 0 : n.getBoundingClientRect();
174
174
  if (t && e && N.current.has(e)) {
175
- const l = N.current.get(e), s = l == null ? void 0 : l.getBoundingClientRect();
176
- if (s && s.top + s.height / 2 >= t.top + t.height) {
175
+ const l = N.current.get(e), r = l == null ? void 0 : l.getBoundingClientRect();
176
+ if (r && r.top + r.height / 2 >= t.top + t.height) {
177
177
  l == null || l.scrollIntoView();
178
178
  return;
179
179
  }
180
- s && s.top + s.height / 2 <= t.top && (l == null || l.scrollIntoView(!1));
180
+ r && r.top + r.height / 2 <= t.top && (l == null || l.scrollIntoView(!1));
181
181
  }
182
- }, xe = f.current, Ee = g.current;
182
+ }, xe = f.current, we = g.current;
183
183
  _react.useEffect(()=>{
184
184
  B({
185
185
  name: i,
@@ -207,27 +207,27 @@ const ut = (param)=>{
207
207
  f,
208
208
  g,
209
209
  xe,
210
- Ee
210
+ we
211
211
  ]), _react.useEffect(()=>{
212
212
  const e = (n)=>{
213
213
  var w, O;
214
- const s = {
214
+ const r = {
215
215
  [_keyCodesJs.UP]: -1,
216
216
  [_keyCodesJs.DOWN]: 1
217
217
  }[n.keyCode];
218
- if (s) {
218
+ if (r) {
219
219
  (0, _domJs.cancelEvent)(n);
220
- const b = (O = (w = d[d.findIndex((param)=>{
220
+ const R = (O = (w = d[d.findIndex((param)=>{
221
221
  let { value: p } = param;
222
- return p === x;
223
- }) + s]) == null ? void 0 : w.value) != null ? O : x;
224
- G(b), Ie(b);
222
+ return p === I;
223
+ }) + r]) == null ? void 0 : w.value) != null ? O : I;
224
+ G(R), Ee(R);
225
225
  }
226
226
  }, t = (n)=>{
227
- F && (n.keyCode === _keyCodesJs.TAB && (0, _domJs.cancelEvent)(n), n.keyCode === _keyCodesJs.ESC && S(!1), (n.keyCode === _keyCodesJs.ENTER || n.keyCode === _keyCodesJs.SPACE) && ((0, _domJs.cancelEvent)(n), d.findIndex((param)=>{
227
+ F && (n.keyCode === _keyCodesJs.TAB && (0, _domJs.cancelEvent)(n), n.keyCode === _keyCodesJs.ESC && x(!1), (n.keyCode === _keyCodesJs.ENTER || n.keyCode === _keyCodesJs.SPACE) && ((0, _domJs.cancelEvent)(n), d.findIndex((param)=>{
228
228
  let { value: l } = param;
229
- return l === x;
230
- }) !== -1 && x !== c && Y(x), S(!1))), z && e(n);
229
+ return l === I;
230
+ }) !== -1 && I !== c && Y(I), x(!1))), z && e(n);
231
231
  };
232
232
  return document.addEventListener("keydown", t, !1), ()=>{
233
233
  document.removeEventListener("keydown", t, !1);
@@ -236,35 +236,37 @@ const ut = (param)=>{
236
236
  q && f.current && f.current.focus();
237
237
  }, [
238
238
  q
239
- ]);
240
- const Se = (e)=>{
239
+ ]), _react.useEffect(()=>{
240
+ me(!1);
241
+ }, []);
242
+ const Oe = (e)=>{
241
243
  var t;
242
244
  return e ? (t = d.find((param)=>{
243
245
  let { value: n } = param;
244
246
  return n === e;
245
247
  })) == null ? void 0 : t.text : "";
246
- }, we = {
248
+ }, ye = {
247
249
  tabIndex: 0,
248
250
  onFocus: ()=>y(!0),
249
251
  onBlur: ()=>y(!1),
250
252
  onClick: ()=>{
251
- S(!0), y(!0);
253
+ x(!0), y(!0);
252
254
  },
253
255
  onKeyDown: (e)=>{
254
- !F && (e.keyCode === _keyCodesJs.SPACE || e.keyCode === _keyCodesJs.ENTER) && ((0, _domJs.cancelEvent)(e), S(!0));
256
+ !F && (e.keyCode === _keyCodesJs.SPACE || e.keyCode === _keyCodesJs.ENTER) && ((0, _domJs.cancelEvent)(e), x(!0));
255
257
  }
256
258
  };
257
- return Te ? /* @__PURE__ */ (0, _jsxRuntimeJs.jsxs)(_textFieldComponentsJs.FieldContainer, {
259
+ return Ie || pe ? /* @__PURE__ */ (0, _jsxRuntimeJs.jsxs)(_textFieldComponentsJs.FieldContainer, {
258
260
  disabled: E,
259
261
  helperText: /* @__PURE__ */ (0, _jsxRuntimeJs.jsx)(_textFieldComponentsJs.HelperText, {
260
- error: A,
262
+ error: v,
261
263
  leftText: Q
262
264
  }),
263
- fieldRef: T,
265
+ fieldRef: S,
264
266
  fullWidth: D,
265
267
  children: [
266
268
  h && /* @__PURE__ */ (0, _jsxRuntimeJs.jsx)(_textFieldComponentsJs.Label, {
267
- error: A,
269
+ error: v,
268
270
  forId: W,
269
271
  inputState: U ? "focused" : ((te = o != null ? o : c) != null ? te : (ee = g.current) == null ? void 0 : ee.value) ? "filled" : "default",
270
272
  optional: M,
@@ -273,12 +275,12 @@ const ut = (param)=>{
273
275
  /* @__PURE__ */ (0, _jsxRuntimeJs.jsxs)("select", {
274
276
  className: _selectCssMisticaJs.selectVariants[E ? "disabled" : "default"],
275
277
  id: W,
276
- "aria-invalid": !!A,
278
+ "aria-invalid": !!v,
277
279
  value: o,
278
280
  required: !M,
279
281
  disabled: E,
280
282
  onChange: (e)=>{
281
- R && R(e.target.value);
283
+ A && A(e.target.value);
282
284
  },
283
285
  onFocus: ()=>y(!0),
284
286
  onBlur: (e)=>{
@@ -331,7 +333,7 @@ const ut = (param)=>{
331
333
  role: "button",
332
334
  "aria-haspopup": "listbox",
333
335
  ref: f
334
- }, !E && we), {
336
+ }, !E && ye), {
335
337
  children: [
336
338
  /* @__PURE__ */ (0, _jsxRuntimeJs.jsx)(_textFieldBaseJs.TextFieldBaseAutosuggest, {
337
339
  style: {
@@ -350,22 +352,22 @@ const ut = (param)=>{
350
352
  required: !M,
351
353
  disabled: E,
352
354
  id: W,
353
- error: A,
355
+ error: v,
354
356
  inputRef: g,
355
- fieldRef: T
357
+ fieldRef: S
356
358
  }),
357
359
  /* @__PURE__ */ (0, _jsxRuntimeJs.jsx)("div", {
358
360
  className: _selectCssMisticaJs.selectTextVariants[E ? "disabled" : "default"],
359
361
  style: {
360
362
  top: h ? 27 : 17
361
363
  },
362
- children: Se(o != null ? o : c)
364
+ children: Oe(o != null ? o : c)
363
365
  })
364
366
  ]
365
367
  })),
366
368
  F && /* @__PURE__ */ (0, _jsxRuntimeJs.jsx)(_overlayJs.default, {
367
369
  onPress: (e)=>{
368
- S(!1), (0, _domJs.cancelEvent)(e);
370
+ x(!1), (0, _domJs.cancelEvent)(e);
369
371
  },
370
372
  disableScroll: !0,
371
373
  children: /* @__PURE__ */ (0, _jsxRuntimeJs.jsx)("ul", {
@@ -379,7 +381,7 @@ const ut = (param)=>{
379
381
  onPointerDown: _domJs.cancelEvent,
380
382
  className: (0, _classnames.default)(_selectCssMisticaJs.optionsContainer, z ? _selectCssMisticaJs.optionsAnimationsVariants.show : _selectCssMisticaJs.optionsAnimationsVariants.hide),
381
383
  role: "listbox",
382
- ref: I,
384
+ ref: T,
383
385
  children: d.map((param)=>/* @__PURE__ */ {
384
386
  let { value: e , text: t } = param;
385
387
  return (0, _jsxRuntimeJs.jsx)("li", {
@@ -387,7 +389,7 @@ const ut = (param)=>{
387
389
  "aria-selected": e === (c != null ? c : o),
388
390
  "data-value": e,
389
391
  className: (0, _classnames.default)(_selectCssMisticaJs.menuItem, {
390
- [_selectCssMisticaJs.menuItemSelected]: e === x || e === (c != null ? c : o)
392
+ [_selectCssMisticaJs.menuItemSelected]: e === I || e === (c != null ? c : o)
391
393
  }),
392
394
  onPointerDown: _domJs.cancelEvent,
393
395
  onClick: ()=>Y(e),
@@ -41,7 +41,7 @@ export declare const palette: {
41
41
  readonly movistarProminentBlueLight50: "#85939C";
42
42
  readonly movistarProminentBlueLight70: "#546874";
43
43
  readonly darkModeBlack: "#061824";
44
- readonly darkModeGrey: "#092130";
44
+ readonly darkModeGrey: "#081F2E";
45
45
  readonly darkModeGrey2: "#EAEBEE";
46
46
  readonly darkModeGrey3: "#CED4D7";
47
47
  readonly darkModeGrey4: "#85939C";
@@ -56,7 +56,7 @@ const e = {
56
56
  movistarProminentBlueLight50: "#85939C",
57
57
  movistarProminentBlueLight70: "#546874",
58
58
  darkModeBlack: "#061824",
59
- darkModeGrey: "#092130",
59
+ darkModeGrey: "#081F2E",
60
60
  darkModeGrey2: "#EAEBEE",
61
61
  darkModeGrey3: "#CED4D7",
62
62
  darkModeGrey4: "#85939C",
@@ -167,12 +167,12 @@ const e = {
167
167
  backgroundBrand: e.darkModeBlack,
168
168
  backgroundBrandSecondary: e.darkModeBlack,
169
169
  backgroundOverlay: (0, _colorJs.applyAlpha)(e.darkModeGrey, 0.8),
170
- backgroundSkeleton: e.darkModeGrey6,
171
- backgroundSkeletonInverse: e.darkModeGrey6,
170
+ backgroundSkeleton: e.movistarBlueDark,
171
+ backgroundSkeletonInverse: e.movistarBlueDark,
172
172
  navigationBarBackground: e.darkModeBlack,
173
173
  backgroundAlternative: e.darkModeGrey,
174
174
  backgroundFeedbackBottom: e.darkModeBlack,
175
- skeletonWave: e.darkModeGrey5,
175
+ skeletonWave: e.darkModeGrey6,
176
176
  borderHigh: e.darkModeGrey4,
177
177
  borderLow: e.darkModeBlack,
178
178
  border: e.darkModeGrey,
@@ -214,7 +214,7 @@ const e = {
214
214
  inverse: e.darkModeGrey2,
215
215
  neutralHigh: e.darkModeGrey2,
216
216
  neutralMedium: e.darkModeGrey5,
217
- neutralLow: e.darkModeGrey6,
217
+ neutralLow: e.movistarBlueDark,
218
218
  textPrimary: e.darkModeGrey2,
219
219
  textPrimaryInverse: e.darkModeGrey2,
220
220
  textSecondary: e.darkModeGrey4,
@@ -225,11 +225,11 @@ const e = {
225
225
  textNavigationSearchBarText: e.darkModeGrey2,
226
226
  textAppBar: e.darkModeGrey5,
227
227
  textAppBarSelected: e.darkModeGrey2,
228
- successLow: e.grey6,
229
- warningLow: e.grey6,
230
- errorLow: e.grey6,
231
- promoLow: e.grey6,
232
- brandLow: e.grey6,
228
+ successLow: e.movistarBlueDark,
229
+ warningLow: e.movistarBlueDark,
230
+ errorLow: e.movistarBlueDark,
231
+ promoLow: e.movistarBlueDark,
232
+ brandLow: e.movistarBlueDark,
233
233
  successHigh: e.movistarGreen40,
234
234
  warningHigh: e.egg40,
235
235
  errorHigh: e.pepper40,
@@ -10,10 +10,10 @@ function _export(target, all) {
10
10
  }
11
11
  _export(exports, {
12
12
  getAnimateDrawLineProps: ()=>p,
13
- getAnimateFadeInProps: ()=>f,
14
- getAnimateHopInProps: ()=>u,
15
- getAnimateSweepInProps: ()=>y,
16
- mergeProperties: ()=>k
13
+ getAnimateFadeInProps: ()=>d,
14
+ getAnimateHopInProps: ()=>f,
15
+ getAnimateSweepInProps: ()=>u,
16
+ mergeProperties: ()=>y
17
17
  });
18
18
  const _platformJs = require("./platform.js");
19
19
  const _jsxRuntimeJs = require("../_virtual/jsx-runtime.js");
@@ -69,7 +69,7 @@ function _objectSpreadProps(target, source) {
69
69
  }
70
70
  return target;
71
71
  }
72
- const a = (e)=>!(0, _platformJs.isOldChrome)(e) && !(0, _platformJs.isRunningAcceptanceTest)(e) && typeof window < "u", p = (e, t, i)=>a(i) ? {
72
+ const i = (e)=>!(0, _platformJs.isRunningAcceptanceTest)(e), p = (e, t, a)=>i(a) ? {
73
73
  strokeDasharray: e.replace("-", ""),
74
74
  strokeDashoffset: e,
75
75
  children: /* @__PURE__ */ (0, _jsxRuntimeJs.jsx)("animate", {
@@ -84,7 +84,7 @@ const a = (e)=>!(0, _platformJs.isOldChrome)(e) && !(0, _platformJs.isRunningAcc
84
84
  calcMode: "spline",
85
85
  keySplines: "0.75 0 0.25 1"
86
86
  })
87
- } : null, f = (e, t)=>a(t) ? {
87
+ } : null, d = (e, t)=>i(t) ? {
88
88
  opacity: 0,
89
89
  children: /* @__PURE__ */ (0, _jsxRuntimeJs.jsx)("animate", {
90
90
  attributeName: "opacity",
@@ -98,7 +98,7 @@ const a = (e)=>!(0, _platformJs.isOldChrome)(e) && !(0, _platformJs.isRunningAcc
98
98
  calcMode: "spline",
99
99
  keySplines: "0.75 0 0.25 1"
100
100
  })
101
- } : null, u = (e, t)=>a(t) ? {
101
+ } : null, f = (e, t)=>i(t) ? {
102
102
  children: /* @__PURE__ */ (0, _jsxRuntimeJs.jsxs)(_jsxRuntimeJs.Fragment, {
103
103
  children: [
104
104
  /* @__PURE__ */ (0, _jsxRuntimeJs.jsx)("animate", {
@@ -125,7 +125,7 @@ const a = (e)=>!(0, _platformJs.isOldChrome)(e) && !(0, _platformJs.isRunningAcc
125
125
  })
126
126
  ]
127
127
  })
128
- } : null, y = (e, t)=>a(t) ? {
128
+ } : null, u = (e, t)=>i(t) ? {
129
129
  opacity: 0,
130
130
  children: /* @__PURE__ */ (0, _jsxRuntimeJs.jsxs)(_jsxRuntimeJs.Fragment, {
131
131
  children: [
@@ -180,7 +180,7 @@ const a = (e)=>!(0, _platformJs.isOldChrome)(e) && !(0, _platformJs.isRunningAcc
180
180
  })
181
181
  ]
182
182
  })
183
- } : null, m = (param, t)=>/* @__PURE__ */ {
183
+ } : null, o = (param, t)=>/* @__PURE__ */ {
184
184
  let { children: e } = param;
185
185
  return (0, _jsxRuntimeJs.jsxs)(_jsxRuntimeJs.Fragment, {
186
186
  children: [
@@ -188,12 +188,12 @@ const a = (e)=>!(0, _platformJs.isOldChrome)(e) && !(0, _platformJs.isRunningAcc
188
188
  t
189
189
  ]
190
190
  });
191
- }, k = function() {
191
+ }, y = function() {
192
192
  for(var _len = arguments.length, e = new Array(_len), _key = 0; _key < _len; _key++){
193
193
  e[_key] = arguments[_key];
194
194
  }
195
- return e.reduce((t, i)=>_objectSpreadProps(_objectSpread({}, t, i || {}), {
196
- children: m(t, i ? i.children : null)
195
+ return e.reduce((t, a)=>_objectSpreadProps(_objectSpread({}, t, a || {}), {
196
+ children: o(t, a ? a.children : null)
197
197
  }), {
198
198
  children: null
199
199
  });
@@ -12,6 +12,5 @@ export declare const isIos: (platformOverrides: Theme['platformOverrides']) => b
12
12
  export declare const isSafari: () => boolean;
13
13
  export declare const isFirefox: (platformOverrides?: Theme['platformOverrides']) => boolean;
14
14
  export declare const isChrome: (platformOverrides: Theme['platformOverrides']) => boolean;
15
- export declare const isOldChrome: (platformOverrides: Theme['platformOverrides']) => boolean;
16
15
  export declare const getIosVersion: (platformOverrides: Theme['platformOverrides']) => string;
17
16
  export declare const getPlatform: (platformOverrides?: Theme['platformOverrides']) => 'ios' | 'android' | 'desktop';
@@ -9,15 +9,14 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- getPlatform: ()=>h,
12
+ getPlatform: ()=>A,
13
13
  isAndroid: ()=>s,
14
- isChrome: ()=>g,
15
- isFirefox: ()=>p,
14
+ isChrome: ()=>l,
15
+ isFirefox: ()=>g,
16
16
  isInsideNovumNativeApp: ()=>c,
17
17
  isIos: ()=>a,
18
- isOldChrome: ()=>A,
19
- isRunningAcceptanceTest: ()=>m,
20
- isSafari: ()=>l
18
+ isRunningAcceptanceTest: ()=>f,
19
+ isSafari: ()=>p
21
20
  });
22
21
  const _webviewBridge = require("@tef-novum/webview-bridge");
23
22
  const t = function() {
@@ -27,13 +26,10 @@ const t = function() {
27
26
  }, c = function() {
28
27
  let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
29
28
  return typeof e.insideNovumNativeApp < "u" ? e.insideNovumNativeApp : (0, _webviewBridge.isWebViewBridgeAvailable)();
30
- }, m = function() {
29
+ }, f = function() {
31
30
  let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
32
- return t(e).includes("acceptance-test");
33
- }, r = Boolean(typeof self < "u" && self.MSStream), s = (e)=>t(e).toLowerCase().includes("android") && !r, a = (e)=>!!(/iPad|iPhone|iPod/.test(t(e)) && !r || c(e) && !s(e)), l = ()=>navigator.vendor.includes("Apple"), p = (e)=>!!t(e).match(/Firefox\/([0-9]+)\./), g = (e)=>!!t(e).match(/Chrom(e|ium)\/([0-9]+)\./), d = 44, A = (e)=>{
34
- const n = t(e).match(/Chrome\/(\d+)/);
35
- return !n || !n[1] ? !1 : Number(n[1]) < d;
36
- }, h = function() {
31
+ return t(e).includes("acceptance-test") && !process.env.SSR_TEST;
32
+ }, r = Boolean(typeof self < "u" && self.MSStream), s = (e)=>t(e).toLowerCase().includes("android") && !r, a = (e)=>!!(/iPad|iPhone|iPod/.test(t(e)) && !r || c(e) && !s(e)), p = ()=>navigator.vendor.includes("Apple"), g = (e)=>!!t(e).match(/Firefox\/([0-9]+)\./), l = (e)=>!!t(e).match(/Chrom(e|ium)\/([0-9]+)\./), A = function() {
37
33
  let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
38
34
  const n = e.platform;
39
35
  return n || (a(e) ? "ios" : s(e) ? "android" : "desktop");
package/dist-es/dialog.js CHANGED
@@ -99,13 +99,13 @@ import U from "./button-layout.js";
99
99
  import { Text5 as q, Text4 as P, Text3 as G } from "./text.js";
100
100
  import { ESC as J } from "./utils/key-codes.js";
101
101
  import E from "./box.js";
102
- import { isOldChrome as Q, isRunningAcceptanceTest as X } from "./utils/platform.js";
103
- import { useSetModalState as Y } from "./modal-context-provider.js";
104
- import Z from "./stack.js";
105
- import { wrapper as $, modalOpacityLayer as ee, closedOpactityLayer as te, modalContent as oe, closedModalContent as ne, modalCloseButtonContainer as ae, variants as ie, iconContainer as le, dialogContent as se, dialogActions as ce } from "./dialog.css-mistica.js";
102
+ import { isRunningAcceptanceTest as Q } from "./utils/platform.js";
103
+ import { useSetModalState as X } from "./modal-context-provider.js";
104
+ import Y from "./stack.js";
105
+ import { wrapper as Z, modalOpacityLayer as $, closedOpactityLayer as ee, modalContent as te, closedModalContent as oe, modalCloseButtonContainer as ne, variants as ae, iconContainer as ie, dialogContent as le, dialogActions as se } from "./dialog.css-mistica.js";
106
106
  import { vars as R } from "./skins/skin-contract.css-mistica.js";
107
- import { jsx as o, jsxs as b, Fragment as re } from "./_virtual/jsx-runtime.js";
108
- const A = (e)=>!Q(e) && process.env.NODE_ENV !== "test" && !X(e), de = (e)=>{
107
+ import { jsx as o, jsxs as b, Fragment as ce } from "./_virtual/jsx-runtime.js";
108
+ const A = (e)=>process.env.NODE_ENV !== "test" && !Q(e), re = (e)=>{
109
109
  const { texts: n } = D(), { className: t , title: a , message: c , icon: l , extra: i , cancelText: r = n.dialogCancelButton , acceptText: d = n.dialogAcceptButton , onCancel: u , onAccept: C , showCancel: p = !1 , destructive: h = !1 } = e, x = !!e.forceWeb, m = {
110
110
  onPress: C || (()=>{}),
111
111
  dataAttributes: {
@@ -114,12 +114,12 @@ const A = (e)=>!Q(e) && process.env.NODE_ENV !== "test" && !X(e), de = (e)=>{
114
114
  children: d
115
115
  };
116
116
  return /* @__PURE__ */ b("div", {
117
- className: T(ie[x ? "dialog" : "default"], t),
117
+ className: T(ae[x ? "dialog" : "default"], t),
118
118
  children: [
119
119
  l && /* @__PURE__ */ o(E, {
120
120
  paddingBottom: 24,
121
121
  children: /* @__PURE__ */ o("div", {
122
- className: le,
122
+ className: ie,
123
123
  children: /*#__PURE__*/ s.cloneElement(l, {
124
124
  size: "100%"
125
125
  })
@@ -145,8 +145,8 @@ const A = (e)=>!Q(e) && process.env.NODE_ENV !== "test" && !X(e), de = (e)=>{
145
145
  })
146
146
  }),
147
147
  /* @__PURE__ */ o("div", {
148
- className: se,
149
- children: /* @__PURE__ */ b(Z, {
148
+ className: le,
149
+ children: /* @__PURE__ */ b(Y, {
150
150
  space: 16,
151
151
  children: [
152
152
  /* @__PURE__ */ o(G, {
@@ -159,7 +159,7 @@ const A = (e)=>!Q(e) && process.env.NODE_ENV !== "test" && !X(e), de = (e)=>{
159
159
  })
160
160
  }),
161
161
  /* @__PURE__ */ o("div", {
162
- className: ce,
162
+ className: se,
163
163
  children: /* @__PURE__ */ b(U, {
164
164
  link: e.forceWeb ? e.link : void 0,
165
165
  children: [
@@ -181,7 +181,7 @@ const A = (e)=>!Q(e) && process.env.NODE_ENV !== "test" && !X(e), de = (e)=>{
181
181
  })
182
182
  ]
183
183
  });
184
- }, ue = (param)=>{
184
+ }, de = (param)=>{
185
185
  let { showCancel: e , message: n , title: t , acceptText: a , cancelText: c , onAccept: l , onCancel: i } = param;
186
186
  return e ? K({
187
187
  message: n,
@@ -193,11 +193,11 @@ const A = (e)=>!Q(e) && process.env.NODE_ENV !== "test" && !X(e), de = (e)=>{
193
193
  title: t,
194
194
  buttonText: a
195
195
  }).then(l);
196
- }, he = (param)=>{
196
+ }, ue = (param)=>{
197
197
  let { renderNative: e , onAccept: n , onCancel: t , acceptText: a , cancelText: c , showCancel: l , message: i , title: r } = param;
198
198
  const d = s.useRef(n).current, u = s.useRef(t).current;
199
199
  s.useEffect(()=>{
200
- e && ue({
200
+ e && de({
201
201
  acceptText: a,
202
202
  cancelText: c,
203
203
  showCancel: l,
@@ -216,7 +216,7 @@ const A = (e)=>!Q(e) && process.env.NODE_ENV !== "test" && !X(e), de = (e)=>{
216
216
  r,
217
217
  e
218
218
  ]);
219
- }, me = (e)=>(he({
219
+ }, he = (e)=>(ue({
220
220
  renderNative: !0,
221
221
  acceptText: e.acceptText || e.dialogAcceptButton,
222
222
  cancelText: e.cancelText || e.dialogCancelButton,
@@ -225,7 +225,7 @@ const A = (e)=>!Q(e) && process.env.NODE_ENV !== "test" && !X(e), de = (e)=>{
225
225
  title: e.title,
226
226
  onAccept: e.onAccept,
227
227
  onCancel: e.onCancel
228
- }), null), fe = (e)=>{
228
+ }), null), me = (e)=>{
229
229
  var N;
230
230
  const { platformOverrides: n } = D(), t = s.useContext(z), a = s.useRef(process.env.NODE_ENV === "test");
231
231
  if (!t) throw Error("To use @telefonica/mistica components you must instantiate <ThemeContextProvider> as their parent.");
@@ -267,7 +267,7 @@ const A = (e)=>!Q(e) && process.env.NODE_ENV !== "test" && !X(e), de = (e)=>{
267
267
  c,
268
268
  n
269
269
  ]);
270
- const k = Y();
270
+ const k = X();
271
271
  return s.useEffect(()=>(k({
272
272
  isModalOpen: !0
273
273
  }), ()=>{
@@ -276,17 +276,17 @@ const A = (e)=>!Q(e) && process.env.NODE_ENV !== "test" && !X(e), de = (e)=>{
276
276
  });
277
277
  }), [
278
278
  k
279
- ]), c ? /* @__PURE__ */ o(me, _objectSpreadProps(_objectSpread({}, e), {
279
+ ]), c ? /* @__PURE__ */ o(he, _objectSpreadProps(_objectSpread({}, e), {
280
280
  dialogAcceptButton: t.texts.dialogAcceptButton,
281
281
  dialogCancelButton: t.texts.dialogCancelButton
282
282
  })) : /* @__PURE__ */ o(I, {
283
283
  children: /* @__PURE__ */ o("div", {
284
- className: $,
284
+ className: Z,
285
285
  children: /* @__PURE__ */ o(H, {
286
286
  children: /* @__PURE__ */ o("div", {
287
287
  onClick: x,
288
- className: T(ee, {
289
- [te]: i
288
+ className: T($, {
289
+ [ee]: i
290
290
  }),
291
291
  role: "dialog",
292
292
  "data-component-name": "Dialog",
@@ -297,12 +297,12 @@ const A = (e)=>!Q(e) && process.env.NODE_ENV !== "test" && !X(e), de = (e)=>{
297
297
  onAnimationEnd: ()=>{
298
298
  a.current = !0, B();
299
299
  },
300
- className: T(oe, {
301
- [ne]: i
300
+ className: T(te, {
301
+ [oe]: i
302
302
  }),
303
303
  children: [
304
304
  e.showClose && /* @__PURE__ */ o("div", {
305
- className: ae,
305
+ className: ne,
306
306
  children: /* @__PURE__ */ o(V, {
307
307
  onPress: h,
308
308
  "aria-label": (N = t.texts.modalClose) != null ? N : t.texts.closeButtonLabel,
@@ -311,7 +311,7 @@ const A = (e)=>!Q(e) && process.env.NODE_ENV !== "test" && !X(e), de = (e)=>{
311
311
  })
312
312
  })
313
313
  }),
314
- /* @__PURE__ */ o(de, _objectSpreadProps(_objectSpread({}, u), {
314
+ /* @__PURE__ */ o(re, _objectSpreadProps(_objectSpread({}, u), {
315
315
  onCancel: p,
316
316
  onAccept: C
317
317
  }))
@@ -324,7 +324,7 @@ const A = (e)=>!Q(e) && process.env.NODE_ENV !== "test" && !X(e), de = (e)=>{
324
324
  });
325
325
  };
326
326
  let v = null, w = 0;
327
- class Me extends s.Component {
327
+ class We extends s.Component {
328
328
  componentDidMount() {
329
329
  w++, w === 1 && (v = this, window.addEventListener("popstate", this.handleBack));
330
330
  }
@@ -359,14 +359,14 @@ class Me extends s.Component {
359
359
  "onCancel",
360
360
  "onAccept"
361
361
  ]);
362
- c = /* @__PURE__ */ o(fe, _objectSpread({
362
+ c = /* @__PURE__ */ o(me, _objectSpread({
363
363
  onCancel: this.createCancelHandler(l),
364
364
  onAccept: this.createAcceptHandler(i),
365
365
  isClosing: t,
366
366
  onCloseTransitionEnd: t ? this.handleCloseFinished : void 0
367
367
  }, r));
368
368
  }
369
- return /* @__PURE__ */ b(re, {
369
+ return /* @__PURE__ */ b(ce, {
370
370
  children: [
371
371
  this.props.children,
372
372
  c
@@ -405,17 +405,17 @@ const y = (param)=>{
405
405
  forceWeb: t
406
406
  }, a));
407
407
  };
408
- }, Oe = y({
408
+ }, Me = y({
409
409
  showCancel: !1,
410
410
  forceWeb: !1,
411
411
  showClose: !1
412
- }), Ie = y({
412
+ }), Oe = y({
413
413
  showCancel: !0,
414
414
  forceWeb: !1,
415
415
  showClose: !1
416
- }), He = y({
416
+ }), Ie = y({
417
417
  showCancel: !1,
418
418
  forceWeb: !0,
419
419
  showClose: !0
420
420
  });
421
- export { Oe as alert, Ie as confirm, Me as default, He as dialog };
421
+ export { Me as alert, Oe as confirm, We as default, Ie as dialog };