@telefonica/mistica 14.32.0 → 14.33.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/tabs.js CHANGED
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  Object.defineProperty(exports, "default", {
6
6
  enumerable: true,
7
7
  get: function() {
8
- return Y;
8
+ return ie;
9
9
  }
10
10
  });
11
11
  const _jsxruntime = require("react/jsx-runtime");
@@ -19,6 +19,8 @@ const _platform = require("./utils/platform.js");
19
19
  const _dom = require("./utils/dom.js");
20
20
  const _tabscssmistica = require("./tabs.css-mistica.js");
21
21
  const _inline = /*#__PURE__*/ _interop_require_default(require("./inline.js"));
22
+ const _themevariantcontext = require("./theme-variant-context.js");
23
+ const _skincontractcssmistica = require("./skins/skin-contract.css-mistica.js");
22
24
  function _interop_require_default(obj) {
23
25
  return obj && obj.__esModule ? obj : {
24
26
  default: obj
@@ -115,8 +117,8 @@ function _object_spread_props(target, source) {
115
117
  }
116
118
  return target;
117
119
  }
118
- const f = (0, _platform.isRunningAcceptanceTest)() ? 0 : 300, q = (i)=>{
119
- switch(i){
120
+ const u = (0, _platform.isRunningAcceptanceTest)() ? 0 : 300, F = (o)=>{
121
+ switch(o){
120
122
  case 1:
121
123
  case 2:
122
124
  case 3:
@@ -124,21 +126,21 @@ const f = (0, _platform.isRunningAcceptanceTest)() ? 0 : 300, q = (i)=>{
124
126
  default:
125
127
  return "default";
126
128
  }
127
- }, C = (param)=>{
128
- let { selectedIndex: i , onChange: y , tabs: u , dataAttributes: T } = param;
129
- const { textPresets: r } = (0, _hooks.useTheme)(), l = (0, _hooks.useAriaId)(), { ref: A } = (0, _hooks.useElementDimensions)(), b = _react.useRef(null), h = _react.useRef(null), [p, L] = _react.useState(!1), N = (o, c)=>{
130
- const s = document.querySelector(`[id='${l}'] [data-tabindex="${o}"]`), n = document.querySelector(`[id='${l}'] [data-tabindex="${c}"]`), e = b.current, a = h.current;
131
- s && n && e && a && (L(!0), e.style.display = "block", e.style.width = `${s.offsetWidth}px`, e.style.transform = `translate(${s.offsetLeft - a.scrollLeft}px, 0)`, Promise.resolve().then(()=>{
132
- e.style.transition = `transform ${f}ms, width ${f}ms`, e.style.width = `${n.offsetWidth}px`, e.style.transform = `translate(${n.offsetLeft - a.scrollLeft}px, 0)`;
129
+ }, U = (param)=>{
130
+ let { selectedIndex: o , onChange: I , tabs: b , dataAttributes: T } = param;
131
+ const { textPresets: n } = (0, _hooks.useTheme)(), m = (0, _hooks.useAriaId)(), { ref: N } = (0, _hooks.useElementDimensions)(), h = _react.useRef(null), p = _react.useRef(null), [v, g] = _react.useState(!1), r = (0, _themevariantcontext.useIsInverseVariant)(), S = (c, d)=>{
132
+ const s = document.querySelector(`[id='${m}'] [data-tabindex="${c}"]`), l = document.querySelector(`[id='${m}'] [data-tabindex="${d}"]`), e = h.current, a = p.current;
133
+ s && l && e && a && (g(!0), e.style.display = "block", e.style.width = `${s.offsetWidth}px`, e.style.transform = `translate(${s.offsetLeft - a.scrollLeft}px, 0)`, Promise.resolve().then(()=>{
134
+ e.style.transition = `transform ${u}ms, width ${u}ms`, e.style.width = `${l.offsetWidth}px`, e.style.transform = `translate(${l.offsetLeft - a.scrollLeft}px, 0)`;
133
135
  }), setTimeout(()=>{
134
- e.style.transition = "", e.style.display = "none", L(!1);
135
- }, f));
136
+ e.style.transition = "", e.style.display = "none", g(!1);
137
+ }, u));
136
138
  };
137
139
  return /* @__PURE__ */ (0, _jsxruntime.jsx)("div", _object_spread_props(_object_spread({
138
- id: l,
140
+ id: m,
139
141
  role: "tablist",
140
- ref: A,
141
- className: _tabscssmistica.outerBorder
142
+ ref: N,
143
+ className: r ? _tabscssmistica.outerBorderInverse : _tabscssmistica.outerBorder
142
144
  }, (0, _dom.getPrefixedDataAttributes)(T, "Tabs")), {
143
145
  children: /* @__PURE__ */ (0, _jsxruntime.jsx)(_responsivelayout.default, {
144
146
  fullWidth: !0,
@@ -146,28 +148,28 @@ const f = (0, _platform.isRunningAcceptanceTest)() ? 0 : 300, q = (i)=>{
146
148
  className: _tabscssmistica.outer,
147
149
  children: [
148
150
  /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
149
- ref: h,
151
+ ref: p,
150
152
  className: _tabscssmistica.inner,
151
153
  children: /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
152
154
  className: _tabscssmistica.tabsContainer,
153
- children: u.map((param, e)=>{
154
- let { text: o , trackingEvent: c , icon: s , "aria-controls": n } = param;
155
- const a = e === i;
155
+ children: b.map((param, e)=>{
156
+ let { text: c , trackingEvent: d , icon: s , "aria-controls": l } = param;
157
+ const a = e === o;
156
158
  return /* @__PURE__ */ (0, _jsxruntime.jsx)(_touchable.BaseTouchable, {
157
159
  dataAttributes: {
158
160
  "component-name": "Tab",
159
161
  tabindex: e
160
162
  },
161
- className: (0, _classnames.default)(_tabscssmistica.tabVariants[q(u.length)], a ? p ? _tabscssmistica.tabSelectionVariants.selectedAnimating : _tabscssmistica.tabSelectionVariants.selected : _tabscssmistica.tabSelectionVariants.noSelected),
163
+ className: (0, _classnames.default)(_tabscssmistica.tabVariants[F(b.length)], a ? v ? r ? _tabscssmistica.tabSelectionVariants.selectedAnimatingInverse : _tabscssmistica.tabSelectionVariants.selectedAnimating : r ? _tabscssmistica.tabSelectionVariants.selectedInverse : _tabscssmistica.tabSelectionVariants.selected : r ? _tabscssmistica.tabSelectionVariants.noSelectedInverse : _tabscssmistica.tabSelectionVariants.noSelected, r ? _tabscssmistica.tabHover.inverse : _tabscssmistica.tabHover.default),
162
164
  onPress: ()=>{
163
- !p && i !== e && (y(e), N(i, e));
165
+ !v && o !== e && (I(e), S(o, e));
164
166
  },
165
- trackingEvent: c,
167
+ trackingEvent: d,
166
168
  role: "tab",
167
- "aria-controls": n,
169
+ "aria-controls": l,
168
170
  "aria-selected": a ? "true" : "false",
169
171
  children: /* @__PURE__ */ (0, _jsxruntime.jsxs)(_inline.default, {
170
- space: s && o ? 8 : 0,
172
+ space: s && c ? 8 : 0,
171
173
  alignItems: "center",
172
174
  children: [
173
175
  s && /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
@@ -176,16 +178,16 @@ const f = (0, _platform.isRunningAcceptanceTest)() ? 0 : 300, q = (i)=>{
176
178
  }),
177
179
  /* @__PURE__ */ (0, _jsxruntime.jsx)(_text.Text, {
178
180
  as: "div",
179
- desktopSize: r.tabsLabel.size.desktop,
180
- mobileSize: r.tabsLabel.size.mobile,
181
- desktopLineHeight: r.tabsLabel.lineHeight.desktop,
182
- mobileLineHeight: r.tabsLabel.lineHeight.mobile,
183
- weight: r.tabsLabel.weight,
181
+ desktopSize: n.tabsLabel.size.desktop,
182
+ mobileSize: n.tabsLabel.size.mobile,
183
+ desktopLineHeight: n.tabsLabel.lineHeight.desktop,
184
+ mobileLineHeight: n.tabsLabel.lineHeight.mobile,
185
+ weight: n.tabsLabel.weight,
184
186
  color: "inherit",
185
187
  wordBreak: !1,
186
188
  textAlign: "center",
187
189
  hyphens: "auto",
188
- children: o
190
+ children: c
189
191
  })
190
192
  ]
191
193
  })
@@ -194,11 +196,14 @@ const f = (0, _platform.isRunningAcceptanceTest)() ? 0 : 300, q = (i)=>{
194
196
  })
195
197
  }),
196
198
  /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
197
- ref: b,
198
- className: _tabscssmistica.animatedLine
199
+ ref: h,
200
+ className: _tabscssmistica.animatedLine,
201
+ style: {
202
+ background: r ? _skincontractcssmistica.vars.colors.controlActivatedInverse : _skincontractcssmistica.vars.colors.controlActivated
203
+ }
199
204
  })
200
205
  ]
201
206
  })
202
207
  })
203
208
  }));
204
- }, Y = C;
209
+ }, ie = U;
@@ -13,7 +13,7 @@ _export(exports, {
13
13
  return W;
14
14
  },
15
15
  TextFieldBaseAutosuggest: function() {
16
- return Ge;
16
+ return De;
17
17
  }
18
18
  });
19
19
  const _jsxruntime = require("react/jsx-runtime");
@@ -151,8 +151,8 @@ function _object_without_properties_loose(source, excluded) {
151
151
  }
152
152
  return target;
153
153
  }
154
- const W = /*#__PURE__*/ _react.forwardRef((_param, M)=>{
155
- var { error: c , helperText: T , label: n , inputProps: m , inputRef: y , defaultValue: o , value: t , onFocus: u , onBlur: S , inputComponent: h , prefix: g , startIcon: e , endIcon: a , endIconOverlay: L , shrinkLabel: z , multiline: x = !1 , focus: C , fieldRef: D , maxLength: p , id: G , autoComplete: H , fullWidth: K } = _param, r = _object_without_properties(_param, [
154
+ const W = /*#__PURE__*/ _react.forwardRef((_param, H)=>{
155
+ var { error: c , helperText: T , label: n , inputProps: m , inputRef: y , defaultValue: o , value: t , onFocus: u , onBlur: S , inputComponent: g , prefix: h , startIcon: e , endIcon: a , endIconOverlay: L , shrinkLabel: B , multiline: x = !1 , focus: C , fieldRef: j , maxLength: p , id: z , autoComplete: D , fullWidth: G } = _param, r = _object_without_properties(_param, [
156
156
  "error",
157
157
  "helperText",
158
158
  "label",
@@ -177,11 +177,11 @@ const W = /*#__PURE__*/ _react.forwardRef((_param, M)=>{
177
177
  "fullWidth"
178
178
  ]);
179
179
  var _ref;
180
- const F = (0, _hooks.useAriaId)(G), [f, d] = _react.useState(o != null && o.length || t != null && t.length ? "filled" : "default"), { isTabletOrSmaller: J } = (0, _hooks.useScreenSize)(), [Q, N] = _react.useState((_ref = o == null ? void 0 : o.length) !== null && _ref !== void 0 ? _ref : 0), E = !!n || !r.required, U = (0, _hooks.useTheme)(), w = z || (r.type === "date" || r.type === "datetime-local" || r.type === "month") && !r.required, [X, Y] = _react.useState("baseline");
180
+ const N = (0, _hooks.useAriaId)(z), [f, d] = _react.useState(o != null && o.length || t != null && t.length ? "filled" : "default"), { isTabletOrSmaller: K } = (0, _hooks.useScreenSize)(), [M, O] = _react.useState((_ref = o == null ? void 0 : o.length) !== null && _ref !== void 0 ? _ref : 0), E = !!n || !r.required, w = B || (r.type === "date" || r.type === "datetime-local" || r.type === "month") && !r.required, [J, Q] = _react.useState("baseline");
181
181
  (0, _hooks.useIsomorphicLayoutEffect)(()=>{
182
- (0, _platform.isSafari)() && Y("initial");
182
+ (0, _platform.isSafari)() && Q("initial");
183
183
  }, []), _react.useEffect(()=>{
184
- f !== "focused" && t != null && t.length && (N(t.length), d("filled")), C && d("focused"), C === !1 && !(t != null && t.length) && d("default"), C === !1 && t != null && t.length && d("filled");
184
+ f !== "focused" && t != null && t.length && (O(t.length), d("filled")), C && d("focused"), C === !1 && !(t != null && t.length) && d("default"), C === !1 && t != null && t.length && d("filled");
185
185
  }, [
186
186
  f,
187
187
  t,
@@ -191,64 +191,64 @@ const W = /*#__PURE__*/ _react.forwardRef((_param, M)=>{
191
191
  }, [
192
192
  r.autoFocus
193
193
  ]);
194
- const Z = x ? "textarea" : "input", $ = h ? {
194
+ const U = x ? "textarea" : "input", X = g ? {
195
195
  inputRef: y
196
196
  } : {
197
- ref: (0, _common.combineRefs)(M, y)
197
+ ref: (0, _common.combineRefs)(H, y)
198
198
  }, b = _object_spread(_object_spread_props(_object_spread({}, r), {
199
199
  maxLength: p,
200
- autoComplete: H
201
- }), m), P = w || f === "focused" || f === "filled", v = P ? J ? _textfieldcomponentscssmistica.LABEL_SCALE_MOBILE : _textfieldcomponentscssmistica.LABEL_SCALE_DESKTOP : 1, V = {
200
+ autoComplete: D
201
+ }), m), P = w || f === "focused" || f === "filled", Y = P ? K ? _textfieldcomponentscssmistica.LABEL_SCALE_MOBILE : _textfieldcomponentscssmistica.LABEL_SCALE_DESKTOP : 1, Z = {
202
202
  left: e ? 48 : _textfieldcomponentscssmistica.LABEL_LEFT_POSITION,
203
203
  // shrinking means applying a scale transformation, so width will be proportionally reduced.
204
204
  // Let's keep the original width.
205
- width: `calc(((100% - ${_textfieldcomponentscssmistica.LABEL_LEFT_POSITION + (e ? 48 : _textfieldcomponentscssmistica.LABEL_LEFT_POSITION)}px)) / ${v})`,
205
+ width: `calc(((100% - ${_textfieldcomponentscssmistica.LABEL_LEFT_POSITION + (e ? 48 : _textfieldcomponentscssmistica.LABEL_LEFT_POSITION)}px)) / ${Y})`,
206
206
  paddingRight: a && !P ? 36 : 0
207
207
  }, k = (0, _sprinklescssmistica.sprinkles)({
208
208
  paddingRight: a ? 0 : 16,
209
- paddingLeft: g ? 0 : e ? 48 : 12
210
- }), ee = r.type === "password" && !(0, _platform.isRunningAcceptanceTest)(U.platformOverrides) ? "Lucida Grande, Arial, sans-serif" : "inherit";
209
+ paddingLeft: h ? 0 : e ? 48 : 12
210
+ }), $ = r.type === "password" ? "Lucida Grande, Arial, sans-serif" : "inherit";
211
211
  return /* @__PURE__ */ (0, _jsxruntime.jsxs)(_textfieldcomponents.FieldContainer, {
212
212
  disabled: r.disabled,
213
213
  helperText: /* @__PURE__ */ (0, _jsxruntime.jsx)(_textfieldcomponents.HelperText, {
214
214
  error: c,
215
215
  leftText: T,
216
- rightText: x && p ? `${Q}/${p}` : void 0
216
+ rightText: x && p ? `${M}/${p}` : void 0
217
217
  }),
218
218
  multiline: x,
219
- fullWidth: K,
220
- fieldRef: D,
219
+ fullWidth: G,
220
+ fieldRef: j,
221
221
  readOnly: r.readOnly,
222
222
  children: [
223
223
  e && /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
224
224
  className: _textfieldbasecssmistica.startIcon,
225
225
  children: e
226
226
  }),
227
- g && /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
227
+ h && /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
228
228
  className: (0, _classnames.default)(_textfieldbasecssmistica.prefix, E ? _textfieldbasecssmistica.prefixWithLabel : _textfieldbasecssmistica.prefixWithoutLabel),
229
229
  style: {
230
230
  opacity: f === "default" ? 0 : 1,
231
- alignSelf: X
231
+ alignSelf: J
232
232
  },
233
233
  children: /* @__PURE__ */ (0, _jsxruntime.jsx)(_text.Text3, {
234
234
  color: _skincontractcssmistica.vars.colors.textSecondary,
235
235
  regular: !0,
236
236
  wordBreak: !1,
237
- children: g
237
+ children: h
238
238
  })
239
239
  }),
240
240
  /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
241
241
  className: _textfieldbasecssmistica.fullWidth,
242
242
  style: {
243
- alignSelf: g ? "baseline" : "initial"
243
+ alignSelf: h ? "baseline" : "initial"
244
244
  },
245
245
  children: /* @__PURE__ */ (0, _jsxruntime.jsx)(_text.Text3, {
246
246
  as: "div",
247
247
  regular: !0,
248
- children: /*#__PURE__*/ _react.createElement(h || Z, _object_spread(_object_spread_props(_object_spread({}, $, b), {
249
- id: F,
248
+ children: /*#__PURE__*/ _react.createElement(g || U, _object_spread(_object_spread_props(_object_spread({}, X, b), {
249
+ id: N,
250
250
  style: _object_spread_props(_object_spread({}, b.style), {
251
- fontFamily: ee
251
+ fontFamily: $
252
252
  }),
253
253
  className: x ? (0, _classnames.default)(_textfieldbasecssmistica.textArea, E ? _textfieldbasecssmistica.textAreaWithLabel : _textfieldbasecssmistica.textAreaWithoutLabel, k) : (0, _classnames.default)(_textfieldbasecssmistica.input, E ? _textfieldbasecssmistica.inputWithLabel : _textfieldbasecssmistica.inputWithoutLabel, k, {
254
254
  [_textfieldbasecssmistica.inputFirefoxStyles]: (0, _platform.isFirefox)()
@@ -261,7 +261,7 @@ const W = /*#__PURE__*/ _react.forwardRef((_param, M)=>{
261
261
  },
262
262
  onChange: (l)=>{
263
263
  var _;
264
- p === void 0 || l.target.value.length <= p ? (N(l.target.value.length), l.target.value.length > 0 && f !== "focused" && d("filled"), (_ = b.onChange) == null || _.call(b, l)) : (l.stopPropagation(), l.preventDefault());
264
+ p === void 0 || l.target.value.length <= p ? (O(l.target.value.length), l.target.value.length > 0 && f !== "focused" && d("filled"), (_ = b.onChange) == null || _.call(b, l)) : (l.stopPropagation(), l.preventDefault());
265
265
  },
266
266
  defaultValue: o,
267
267
  value: t
@@ -271,9 +271,9 @@ const W = /*#__PURE__*/ _react.forwardRef((_param, M)=>{
271
271
  })
272
272
  }),
273
273
  n && /* @__PURE__ */ (0, _jsxruntime.jsx)(_textfieldcomponents.Label, {
274
- style: V,
274
+ style: Z,
275
275
  error: c,
276
- forId: F,
276
+ forId: N,
277
277
  inputState: f,
278
278
  shrinkLabel: w,
279
279
  optional: !r.required,
@@ -286,24 +286,24 @@ const W = /*#__PURE__*/ _react.forwardRef((_param, M)=>{
286
286
  L
287
287
  ]
288
288
  });
289
- }), Oe = /*#__PURE__*/ _react.lazy(()=>Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require(/* webpackChunkName: "react-autosuggest" */ "react-autosuggest")))), Ge = /*#__PURE__*/ _react.forwardRef((_param, m)=>{
289
+ }), Ie = /*#__PURE__*/ _react.lazy(()=>Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require(/* webpackChunkName: "react-autosuggest" */ "react-autosuggest")))), De = /*#__PURE__*/ _react.forwardRef((_param, m)=>{
290
290
  var { getSuggestions: c , id: T } = _param, n = _object_without_properties(_param, [
291
291
  "getSuggestions",
292
292
  "id"
293
293
  ]);
294
- const [y, o] = _react.useState([]), t = _react.useRef(null), { platformOverrides: u , texts: S } = (0, _hooks.useTheme)(), h = (0, _hooks.useAriaId)(T), g = (0, _hooks.useAriaId)();
294
+ const [y, o] = _react.useState([]), t = _react.useRef(null), { platformOverrides: u , texts: S } = (0, _hooks.useTheme)(), g = (0, _hooks.useAriaId)(T), h = (0, _hooks.useAriaId)();
295
295
  if (c && (n.value === void 0 || n.defaultValue !== void 0)) throw Error("Fields with suggestions must be used in controlled mode");
296
296
  return c ? /* @__PURE__ */ (0, _jsxruntime.jsx)(_react.Suspense, {
297
297
  fallback: /* @__PURE__ */ (0, _jsxruntime.jsx)(W, _object_spread_props(_object_spread({}, n), {
298
298
  label: (0, _platform.isRunningAcceptanceTest)(u) ? "" : n.label,
299
299
  autoComplete: "off",
300
300
  ref: m,
301
- id: h
301
+ id: g
302
302
  })),
303
- children: /* @__PURE__ */ (0, _jsxruntime.jsx)(Oe, {
304
- id: g,
303
+ children: /* @__PURE__ */ (0, _jsxruntime.jsx)(Ie, {
304
+ id: h,
305
305
  inputProps: _object_spread_props(_object_spread({}, n), {
306
- id: h,
306
+ id: g,
307
307
  autoComplete: "off",
308
308
  // @ts-expect-error Autosuggest expects slightly different types
309
309
  onChange: (e, param)=>{
@@ -349,7 +349,7 @@ const W = /*#__PURE__*/ _react.forwardRef((_param, M)=>{
349
349
  }))
350
350
  })
351
351
  }) : /* @__PURE__ */ (0, _jsxruntime.jsx)(W, _object_spread_props(_object_spread({}, n), {
352
- id: h,
352
+ id: g,
353
353
  ref: m
354
354
  }));
355
355
  });