@telefonica/mistica 15.7.0 → 15.9.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 (39) hide show
  1. package/css/mistica.css +1 -1
  2. package/dist/accordion.d.ts +4 -6
  3. package/dist/accordion.js +99 -92
  4. package/dist/community/blocks.js +1 -0
  5. package/dist/empty-state.js +7 -6
  6. package/dist/icon-button.d.ts +17 -16
  7. package/dist/icon-button.js +51 -49
  8. package/dist/icons/icon-chevron.css-mistica.js +25 -0
  9. package/dist/icons/icon-chevron.css.d.ts +5 -0
  10. package/dist/icons/icon-chevron.css.ts.vanilla.css-mistica.js +11 -0
  11. package/dist/icons/icon-chevron.js +27 -20
  12. package/dist/image.js +13 -12
  13. package/dist/list.css-mistica.js +11 -11
  14. package/dist/list.css.d.ts +1 -3
  15. package/dist/list.d.ts +8 -16
  16. package/dist/list.js +275 -383
  17. package/dist/package-version.js +1 -1
  18. package/dist/progress-bar.d.ts +2 -0
  19. package/dist/progress-bar.js +44 -35
  20. package/dist/stacking-group.js +7 -7
  21. package/dist/text-field-components.js +4 -4
  22. package/dist/utils/aspect-ratio-support.js +18 -18
  23. package/dist-es/accordion.js +131 -121
  24. package/dist-es/community/blocks.js +1 -0
  25. package/dist-es/empty-state.js +9 -8
  26. package/dist-es/icon-button.js +64 -62
  27. package/dist-es/icons/icon-chevron.css-mistica.js +5 -0
  28. package/dist-es/icons/icon-chevron.css.ts.vanilla.css-mistica.js +2 -0
  29. package/dist-es/icons/icon-chevron.js +26 -24
  30. package/dist-es/image.js +19 -18
  31. package/dist-es/list.css-mistica.js +2 -2
  32. package/dist-es/list.js +321 -429
  33. package/dist-es/package-version.js +1 -1
  34. package/dist-es/progress-bar.js +54 -45
  35. package/dist-es/stacking-group.js +14 -14
  36. package/dist-es/style.css +1 -1
  37. package/dist-es/text-field-components.js +11 -11
  38. package/dist-es/utils/aspect-ratio-support.js +22 -22
  39. package/package.json +1 -1
@@ -8,4 +8,4 @@ Object.defineProperty(exports, "PACKAGE_VERSION", {
8
8
  return o;
9
9
  }
10
10
  });
11
- const o = "15.7.0";
11
+ const o = "15.9.0";
@@ -6,6 +6,7 @@ type ProgressBarProps = {
6
6
  children?: void;
7
7
  'aria-label'?: string;
8
8
  'aria-labelledby'?: string;
9
+ 'aria-hidden'?: React.HTMLAttributes<HTMLDivElement>['aria-hidden'];
9
10
  dataAttributes?: DataAttributes;
10
11
  reverse?: boolean;
11
12
  };
@@ -17,6 +18,7 @@ type ProgressBarSteppedProps = {
17
18
  dataAttributes?: DataAttributes;
18
19
  'aria-label'?: string;
19
20
  'aria-labelledby'?: string;
21
+ 'aria-hidden'?: React.HTMLAttributes<HTMLDivElement>['aria-hidden'];
20
22
  };
21
23
  export declare const ProgressBarStepped: React.FC<ProgressBarSteppedProps>;
22
24
  export {};
@@ -11,10 +11,10 @@ function _export(target, all) {
11
11
  }
12
12
  _export(exports, {
13
13
  ProgressBar: function() {
14
- return E;
14
+ return R;
15
15
  },
16
16
  ProgressBarStepped: function() {
17
- return R;
17
+ return T;
18
18
  }
19
19
  });
20
20
  const _jsxruntime = require("react/jsx-runtime");
@@ -123,69 +123,78 @@ function _object_spread_props(target, source) {
123
123
  }
124
124
  return target;
125
125
  }
126
- const E = (param)=>{
127
- let { progressPercent: r, color: o, "aria-label": d, "aria-labelledby": l, dataAttributes: i, reverse: n = !1 } = param;
128
- const { texts: c } = (0, _hooks.useTheme)(), a = Math.max(0, Math.min(100, r)), s = l ? void 0 : (()=>`${d || c.loading}, ${a}% ${c.progressBarCompletedLabel}`)();
129
- return /* @__PURE__ */ (0, _jsxruntime.jsx)("div", _object_spread_props(_object_spread({}, (0, _dom.getPrefixedDataAttributes)(i, "ProgressBar")), {
130
- className: _progressbarcssmistica.barBackground,
126
+ const R = (param)=>{
127
+ let { progressPercent: e, color: s, "aria-label": p, "aria-labelledby": n, "aria-hidden": t, dataAttributes: c, reverse: l = !1 } = param;
128
+ const { texts: m } = (0, _hooks.useTheme)(), a = Math.max(0, Math.min(100, e)), i = t && t !== "false" ? {
129
+ "aria-hidden": t
130
+ } : {
131
131
  role: "progressbar",
132
132
  "aria-valuenow": a,
133
133
  "aria-valuemin": 0,
134
134
  "aria-valuemax": 100,
135
- "aria-label": s,
136
- "aria-labelledby": l,
135
+ "aria-label": n ? void 0 : (()=>`${p || m.loading}, ${a}% ${m.progressBarCompletedLabel}`)(),
136
+ "aria-labelledby": n
137
+ };
138
+ return /* @__PURE__ */ (0, _jsxruntime.jsx)("div", _object_spread_props(_object_spread(_object_spread_props(_object_spread({}, (0, _dom.getPrefixedDataAttributes)(c, "ProgressBar")), {
139
+ className: _progressbarcssmistica.barBackground
140
+ }), i), {
137
141
  children: /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
138
- className: (0, _classnames.default)(_progressbarcssmistica.bar, n ? _progressbarcssmistica.inverse : _progressbarcssmistica.normal),
142
+ className: (0, _classnames.default)(_progressbarcssmistica.bar, l ? _progressbarcssmistica.inverse : _progressbarcssmistica.normal),
139
143
  style: {
140
144
  maxWidth: `${a}%`,
141
- backgroundColor: o !== null && o !== void 0 ? o : _skincontractcssmistica.vars.colors.controlActivated
145
+ backgroundColor: s !== null && s !== void 0 ? s : _skincontractcssmistica.vars.colors.controlActivated
142
146
  }
143
147
  })
144
148
  }));
145
- }, R = (param)=>{
146
- let { steps: r, currentStep: o = 0, color: d, dataAttributes: l, "aria-label": i, "aria-labelledby": n } = param;
147
- const { texts: c } = (0, _hooks.useTheme)(), [a, p] = _react.useState(Math.ceil(o)), [s, y] = _react.useState(!1);
149
+ }, T = (param)=>{
150
+ let { steps: e, currentStep: s = 0, color: p, dataAttributes: n, "aria-label": t, "aria-labelledby": c, "aria-hidden": l } = param;
151
+ const { texts: m } = (0, _hooks.useTheme)(), [a, g] = _react.useState(Math.ceil(s)), [i, k] = _react.useState(!1);
148
152
  _react.useEffect(()=>{
149
- const e = Math.ceil(o);
150
- a !== e && (y(e < a), p(e));
153
+ const r = Math.ceil(s);
154
+ a !== r && (k(r < a), g(r));
151
155
  }, [
152
- o,
153
- r,
156
+ s,
157
+ e,
154
158
  a
155
159
  ]);
156
- const A = n ? void 0 : (()=>{
157
- const e = c.progressBarStepLabel.replace("1$s", String(a)).replace("2$s", String(r));
158
- return i ? `${i}, ${e.toLowerCase()}` : e;
159
- })();
160
- return /* @__PURE__ */ (0, _jsxruntime.jsx)("div", _object_spread_props(_object_spread({}, (0, _dom.getPrefixedDataAttributes)(l, "ProgressBarStepped")), {
160
+ const A = l && l !== "false" ? {
161
+ "aria-hidden": l
162
+ } : {
161
163
  role: "progressbar",
162
164
  "aria-valuenow": a,
163
165
  "aria-valuemin": 0,
164
- "aria-valuemax": r,
165
- "aria-label": A,
166
- "aria-labelledby": n,
166
+ "aria-valuemax": e,
167
+ "aria-label": c ? void 0 : (()=>{
168
+ const r = m.progressBarStepLabel.replace("1$s", String(a)).replace("2$s", String(e));
169
+ return t ? `${t}, ${r.toLowerCase()}` : r;
170
+ })(),
171
+ "aria-labelledby": c
172
+ };
173
+ return /* @__PURE__ */ (0, _jsxruntime.jsx)("div", _object_spread_props(_object_spread(_object_spread_props(_object_spread({}, (0, _dom.getPrefixedDataAttributes)(n, "ProgressBarStepped")), {
174
+ role: "progressbar"
175
+ }), A), {
167
176
  className: _progressbarcssmistica.progressBarSteppedContainer,
168
177
  children: /* @__PURE__ */ (0, _jsxruntime.jsx)(_inline.default, {
169
178
  space: 8,
170
179
  fullWidth: !0,
171
180
  children: Array.from({
172
- length: r
173
- }, (e, m)=>{
174
- const g = m === a, u = m < a, v = m === a - 1;
181
+ length: e
182
+ }, (r, d)=>{
183
+ const u = d === a, h = d < a, f = d === a - 1;
175
184
  return /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
176
185
  className: _progressbarcssmistica.barBackground,
177
186
  "aria-hidden": "true",
178
- children: (u || g) && /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
187
+ children: (h || u) && /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
179
188
  className: (0, _classnames.default)(_progressbarcssmistica.bar, {
180
- [_progressbarcssmistica.normal]: v && !s,
181
- [_progressbarcssmistica.inverse]: g && s
189
+ [_progressbarcssmistica.normal]: f && !i,
190
+ [_progressbarcssmistica.inverse]: u && i
182
191
  }),
183
192
  style: {
184
- backgroundColor: d !== null && d !== void 0 ? d : _skincontractcssmistica.vars.colors.controlActivated,
185
- maxWidth: u || v && !s ? "100%" : "0"
193
+ backgroundColor: p !== null && p !== void 0 ? p : _skincontractcssmistica.vars.colors.controlActivated,
194
+ maxWidth: h || f && !i ? "100%" : "0"
186
195
  }
187
196
  })
188
- }, m);
197
+ }, d);
189
198
  })
190
199
  })
191
200
  }));
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  Object.defineProperty(exports, "default", {
7
7
  enumerable: true,
8
8
  get: function() {
9
- return G;
9
+ return B;
10
10
  }
11
11
  });
12
12
  const _jsxruntime = require("react/jsx-runtime");
@@ -65,8 +65,8 @@ function _interop_require_wildcard(obj, nodeInterop) {
65
65
  return newObj;
66
66
  }
67
67
  const C = (param)=>{
68
- let { moreItemsStyle: e, stacked: n = !0, maxItems: o = 1 / 0, children: t } = param;
69
- const c = (0, _themevariantcontext.useIsInverseVariant)(), i = _react.Children.count(t), m = i - o + 1, p = n ? -8 : 8, a = e.size, d = e.type === "circle" ? "50%" : _skincontractcssmistica.vars.borderRadii.mediaSmall;
68
+ let { moreItemsStyle: s, stacked: t = !0, maxItems: o = 1 / 0, children: n } = param;
69
+ const c = (0, _themevariantcontext.useIsInverseVariant)(), i = _react.Children.count(n), m = i - o + 1, p = t ? -8 : 8, a = s.size, d = s.type === "circle" ? "50%" : _skincontractcssmistica.vars.borderRadii.mediaSmall;
70
70
  return /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
71
71
  style: (0, _css.applyCssVars)({
72
72
  [_imagecssmistica.vars.mediaBorderRadius]: d
@@ -74,7 +74,7 @@ const C = (param)=>{
74
74
  children: /* @__PURE__ */ (0, _jsxruntime.jsxs)(_inline.default, {
75
75
  space: p,
76
76
  children: [
77
- _react.Children.toArray(t).slice(0, i > o ? o - 1 : o),
77
+ _react.Children.toArray(n).slice(0, i > o ? o - 1 : o),
78
78
  i > o && /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
79
79
  className: _stackinggroupcssmistica.moreItems,
80
80
  style: {
@@ -82,15 +82,15 @@ const C = (param)=>{
82
82
  height: a,
83
83
  borderRadius: d,
84
84
  backgroundColor: c ? _skincontractcssmistica.vars.colors.brandHigh : _skincontractcssmistica.vars.colors.brandLow,
85
- border: n ? `1px solid ${_skincontractcssmistica.vars.colors.borderLow}` : "none"
85
+ border: t ? `1px solid ${_skincontractcssmistica.vars.colors.borderLow}` : "none"
86
86
  },
87
87
  children: /* @__PURE__ */ (0, _jsxruntime.jsx)(_text.Text4, {
88
88
  regular: !0,
89
- color: c ? _skincontractcssmistica.vars.colors.textPrimaryInverse : _skincontractcssmistica.vars.colors.brand,
89
+ color: c ? _skincontractcssmistica.vars.colors.textPrimaryInverse : _skincontractcssmistica.vars.colors.textBrand,
90
90
  children: "+" + m
91
91
  })
92
92
  })
93
93
  ]
94
94
  })
95
95
  });
96
- }, G = C;
96
+ }, B = C;
@@ -139,12 +139,12 @@ const J = (param)=>{
139
139
  clearTimeout(g);
140
140
  };
141
141
  }, []);
142
- let p = _skincontractcssmistica.vars.colors.textSecondary;
143
- return l && r !== "default" ? p = _skincontractcssmistica.vars.colors.error : r === "focused" && (p = _skincontractcssmistica.vars.colors.textActivated), /* @__PURE__ */ (0, _jsxruntime.jsxs)("label", {
142
+ let x = _skincontractcssmistica.vars.colors.textSecondary;
143
+ return l && r !== "default" ? x = _skincontractcssmistica.vars.colors.textError : r === "focused" && (x = _skincontractcssmistica.vars.colors.textActivated), /* @__PURE__ */ (0, _jsxruntime.jsxs)("label", {
144
144
  className: (0, _classnames.default)(_textfieldcomponentscssmistica.labelContainer, {
145
145
  [_textfieldcomponentscssmistica.shrinked]: f
146
146
  }, (0, _sprinklescssmistica.sprinkles)({
147
- color: p
147
+ color: x
148
148
  })),
149
149
  htmlFor: s,
150
150
  style: _object_spread_props(_object_spread({}, n), {
@@ -166,7 +166,7 @@ const J = (param)=>{
166
166
  });
167
167
  }, K = (param)=>{
168
168
  let { leftText: o, rightText: s, error: r, id: l } = param;
169
- const i = (0, _themevariantcontext.useIsInverseVariant)(), n = i ? _skincontractcssmistica.vars.colors.textPrimaryInverse : r ? _skincontractcssmistica.vars.colors.error : _skincontractcssmistica.vars.colors.textSecondary, a = i ? _skincontractcssmistica.vars.colors.textPrimaryInverse : _skincontractcssmistica.vars.colors.textSecondary;
169
+ const i = (0, _themevariantcontext.useIsInverseVariant)(), n = i ? _skincontractcssmistica.vars.colors.textPrimaryInverse : r ? _skincontractcssmistica.vars.colors.textError : _skincontractcssmistica.vars.colors.textSecondary, a = i ? _skincontractcssmistica.vars.colors.textPrimaryInverse : _skincontractcssmistica.vars.colors.textSecondary;
170
170
  return /* @__PURE__ */ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
171
171
  children: [
172
172
  o && /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
@@ -11,13 +11,13 @@ function _export(target, all) {
11
11
  }
12
12
  _export(exports, {
13
13
  AspectRatioContainer: function() {
14
- return W;
14
+ return $;
15
15
  },
16
16
  AspectRatioSupportProvider: function() {
17
- return x;
17
+ return W;
18
18
  },
19
19
  useSupportsAspectRatio: function() {
20
- return N;
20
+ return b;
21
21
  }
22
22
  });
23
23
  const _jsxruntime = require("react/jsx-runtime");
@@ -124,7 +124,7 @@ function _object_spread_props(target, source) {
124
124
  }
125
125
  return target;
126
126
  }
127
- const u = /*#__PURE__*/ _react.createContext(!0), x = (param)=>{
127
+ const u = /*#__PURE__*/ _react.createContext(!0), W = (param)=>{
128
128
  let { children: t } = param;
129
129
  const [o, s] = _react.useState(!0);
130
130
  return (0, _hooks.useIsomorphicLayoutEffect)(()=>{
@@ -137,33 +137,33 @@ const u = /*#__PURE__*/ _react.createContext(!0), x = (param)=>{
137
137
  value: o,
138
138
  children: t
139
139
  });
140
- }, N = ()=>_react.useContext(u), W = (t)=>{
141
- const o = N(), s = typeof t.width != "number" && typeof t.height != "number" && t.aspectRatio !== 0, e = s ? t.aspectRatio : void 0;
142
- let i = t.width, a = t.height;
140
+ }, b = ()=>_react.useContext(u), $ = (t)=>{
141
+ const o = !!t.forceNonCssAspectRatio, s = b() && !o, h = typeof t.width != "number" && typeof t.height != "number" && t.aspectRatio !== 0, a = h ? t.aspectRatio : void 0;
142
+ let e = t.width, i = t.height;
143
143
  var _t_aspectRatio, _t_aspectRatio1;
144
- t.width !== void 0 && t.height !== void 0 ? (i = t.width, a = t.height) : typeof t.width == "number" ? a = t.aspectRatio !== 0 ? t.width / ((_t_aspectRatio = t.aspectRatio) !== null && _t_aspectRatio !== void 0 ? _t_aspectRatio : 1) : void 0 : typeof t.height == "number" ? i = t.aspectRatio !== 0 ? t.height * ((_t_aspectRatio1 = t.aspectRatio) !== null && _t_aspectRatio1 !== void 0 ? _t_aspectRatio1 : 1) : void 0 : i = t.width || "100%";
145
- var _t_as;
146
- const c = s && !o, r = /*#__PURE__*/ _react.createElement((_t_as = t.as) !== null && _t_as !== void 0 ? _t_as : "div", _object_spread({
144
+ t.width !== void 0 && t.height !== void 0 ? (e = t.width, i = t.height) : typeof t.width == "number" ? i = t.aspectRatio !== 0 ? t.width / ((_t_aspectRatio = t.aspectRatio) !== null && _t_aspectRatio !== void 0 ? _t_aspectRatio : 1) : void 0 : typeof t.height == "number" ? e = t.aspectRatio !== 0 ? t.height * ((_t_aspectRatio1 = t.aspectRatio) !== null && _t_aspectRatio1 !== void 0 ? _t_aspectRatio1 : 1) : void 0 : t.height ? i = t.height : e = t.width || "100%";
145
+ var _t_as, _ref, _ref1;
146
+ const c = h && !s, r = /*#__PURE__*/ _react.createElement((_t_as = t.as) !== null && _t_as !== void 0 ? _t_as : "div", _object_spread({
147
147
  className: (0, _classnames.default)(t.className, _aspectratiosupportcssmistica.container, {
148
148
  [_aspectratiosupportcssmistica.containerWithWrapper]: c
149
149
  }),
150
150
  style: _object_spread({}, c ? _object_spread_props(_object_spread({}, t.style), {
151
- position: e ? "absolute" : "static",
151
+ position: a ? "absolute" : "static",
152
152
  width: "100%"
153
153
  }) : _object_spread_props(_object_spread({}, t.style), {
154
- width: isNaN(Number(i)) ? i : Number(i),
155
- height: isNaN(Number(a)) ? a : Number(a)
154
+ width: (_ref = isNaN(Number(e)) ? e : Number(e)) !== null && _ref !== void 0 ? _ref : "fit-content",
155
+ height: (_ref1 = isNaN(Number(i)) ? i : Number(i)) !== null && _ref1 !== void 0 ? _ref1 : "fit-content"
156
156
  }), (0, _css.applyCssVars)({
157
- [_aspectratiosupportcssmistica.vars.aspectRatio]: e ? String(e) : "unset"
157
+ [_aspectratiosupportcssmistica.vars.aspectRatio]: a ? String(a) : "unset"
158
158
  }))
159
159
  }, !c && t.dataAttributes), t.children);
160
160
  if (c) {
161
- const d = (()=>e ? t.width && typeof t.width == "string" && t.width.endsWith("%") ? `${Number(t.width.replace("%", "")) / e}%` : `${100 / e}%` : 0)();
161
+ const f = (()=>a ? t.width && typeof t.width == "string" && t.width.endsWith("%") ? `${parseFloat(t.width) / a}%` : `${100 / a}%` : 0)();
162
162
  return /* @__PURE__ */ (0, _jsxruntime.jsx)("div", _object_spread_props(_object_spread({
163
163
  style: {
164
- width: i,
165
- height: a,
166
- paddingTop: d
164
+ width: e,
165
+ height: i,
166
+ paddingTop: f
167
167
  },
168
168
  className: _aspectratiosupportcssmistica.wrapper
169
169
  }, t.dataAttributes), {