@telefonica/mistica 14.32.1 → 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;