@telefonica/mistica 14.25.0 → 14.26.1

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 (80) hide show
  1. package/css/mistica.css +1 -1
  2. package/dist/accordion.css-mistica.js +41 -0
  3. package/dist/accordion.css.d.ts +12 -0
  4. package/dist/accordion.css.ts.vanilla.css-mistica.js +11 -0
  5. package/dist/accordion.d.ts +47 -0
  6. package/dist/accordion.js +350 -0
  7. package/dist/boxed.d.ts +1 -0
  8. package/dist/boxed.js +17 -16
  9. package/dist/card.js +345 -345
  10. package/dist/carousel.js +58 -52
  11. package/dist/checkbox.css.d.ts +1 -1
  12. package/dist/checkbox.d.ts +3 -1
  13. package/dist/checkbox.js +23 -22
  14. package/dist/community/blocks.js +3 -2
  15. package/dist/form-context.d.ts +9 -9
  16. package/dist/generated/mistica-icons/icons-keywords.d.ts +4 -0
  17. package/dist/icons/icon-chevron.d.ts +1 -0
  18. package/dist/icons/icon-chevron.js +21 -18
  19. package/dist/index.d.ts +4 -2
  20. package/dist/index.js +30 -4
  21. package/dist/integer-field.d.ts +5 -1
  22. package/dist/integer-field.js +12 -11
  23. package/dist/list.d.ts +8 -0
  24. package/dist/list.js +3 -0
  25. package/dist/menu.css-mistica.js +30 -6
  26. package/dist/menu.css.d.ts +14 -2
  27. package/dist/menu.d.ts +25 -3
  28. package/dist/menu.js +264 -84
  29. package/dist/overlay.js +11 -52
  30. package/dist/overscroll-color-context.js +23 -11
  31. package/dist/package-version.js +1 -1
  32. package/dist/pin-field.css-mistica.js +37 -0
  33. package/dist/pin-field.css.d.ts +7 -0
  34. package/dist/pin-field.css.ts.vanilla.css-mistica.js +11 -0
  35. package/dist/pin-field.d.ts +25 -0
  36. package/dist/pin-field.js +269 -0
  37. package/dist/progress-bar.css-mistica.js +7 -4
  38. package/dist/progress-bar.css.d.ts +1 -0
  39. package/dist/progress-bar.d.ts +12 -3
  40. package/dist/progress-bar.js +109 -13
  41. package/dist/stepper.js +34 -27
  42. package/dist/tabs.js +4 -3
  43. package/dist/text-field-base.css.d.ts +2 -0
  44. package/dist/text-field-base.d.ts +1 -0
  45. package/dist/text-field-components.js +28 -26
  46. package/dist/text-field.d.ts +1 -0
  47. package/dist/theme.d.ts +3 -0
  48. package/dist/theme.js +24 -12
  49. package/dist/touchable.js +5 -4
  50. package/dist/video.js +8 -9
  51. package/dist-es/accordion.css-mistica.js +9 -0
  52. package/dist-es/accordion.css.ts.vanilla.css-mistica.js +2 -0
  53. package/dist-es/accordion.js +280 -0
  54. package/dist-es/boxed.js +25 -24
  55. package/dist-es/card.js +475 -475
  56. package/dist-es/carousel.js +95 -89
  57. package/dist-es/checkbox.js +42 -41
  58. package/dist-es/community/blocks.js +2 -1
  59. package/dist-es/icons/icon-chevron.js +25 -22
  60. package/dist-es/index.js +1768 -1766
  61. package/dist-es/integer-field.js +14 -13
  62. package/dist-es/list.js +9 -9
  63. package/dist-es/menu.css-mistica.js +10 -4
  64. package/dist-es/menu.js +262 -93
  65. package/dist-es/overlay.js +18 -20
  66. package/dist-es/overscroll-color-context.js +30 -18
  67. package/dist-es/package-version.js +1 -1
  68. package/dist-es/pin-field.css-mistica.js +5 -0
  69. package/dist-es/pin-field.css.ts.vanilla.css-mistica.js +2 -0
  70. package/dist-es/pin-field.js +217 -0
  71. package/dist-es/progress-bar.css-mistica.js +2 -2
  72. package/dist-es/progress-bar.js +67 -18
  73. package/dist-es/stepper.js +61 -54
  74. package/dist-es/style.css +1 -1
  75. package/dist-es/tabs.js +11 -10
  76. package/dist-es/text-field-components.js +38 -36
  77. package/dist-es/theme.js +24 -12
  78. package/dist-es/touchable.js +9 -8
  79. package/dist-es/video.js +16 -17
  80. package/package.json +1 -1
@@ -0,0 +1,350 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ Accordion: function() {
13
+ return io;
14
+ },
15
+ AccordionItem: function() {
16
+ return co;
17
+ },
18
+ BoxedAccordion: function() {
19
+ return ao;
20
+ },
21
+ BoxedAccordionItem: function() {
22
+ return so;
23
+ },
24
+ useAccordionContext: function() {
25
+ return z;
26
+ }
27
+ });
28
+ const _jsxruntime = require("react/jsx-runtime");
29
+ const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
30
+ const _list = require("./list.js");
31
+ const _iconchevron = /*#__PURE__*/ _interop_require_default(require("./icons/icon-chevron.js"));
32
+ const _box = /*#__PURE__*/ _interop_require_default(require("./box.js"));
33
+ const _accordioncssmistica = require("./accordion.css-mistica.js");
34
+ const _stack = /*#__PURE__*/ _interop_require_default(require("./stack.js"));
35
+ const _touchable = require("./touchable.js");
36
+ const _classnames = /*#__PURE__*/ _interop_require_default(require("classnames"));
37
+ const _skincontractcssmistica = require("./skins/skin-contract.css-mistica.js");
38
+ const _dom = require("./utils/dom.js");
39
+ const _divider = /*#__PURE__*/ _interop_require_default(require("./divider.js"));
40
+ const _boxed = require("./boxed.js");
41
+ const _themevariantcontext = require("./theme-variant-context.js");
42
+ const _hooks = require("./hooks.js");
43
+ const _reacttransitiongroup = require("react-transition-group");
44
+ function _interop_require_default(obj) {
45
+ return obj && obj.__esModule ? obj : {
46
+ default: obj
47
+ };
48
+ }
49
+ function _getRequireWildcardCache(nodeInterop) {
50
+ if (typeof WeakMap !== "function") return null;
51
+ var cacheBabelInterop = new WeakMap();
52
+ var cacheNodeInterop = new WeakMap();
53
+ return (_getRequireWildcardCache = function(nodeInterop) {
54
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
55
+ })(nodeInterop);
56
+ }
57
+ function _interop_require_wildcard(obj, nodeInterop) {
58
+ if (!nodeInterop && obj && obj.__esModule) {
59
+ return obj;
60
+ }
61
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
62
+ return {
63
+ default: obj
64
+ };
65
+ }
66
+ var cache = _getRequireWildcardCache(nodeInterop);
67
+ if (cache && cache.has(obj)) {
68
+ return cache.get(obj);
69
+ }
70
+ var newObj = {};
71
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
72
+ for(var key in obj){
73
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
74
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
75
+ if (desc && (desc.get || desc.set)) {
76
+ Object.defineProperty(newObj, key, desc);
77
+ } else {
78
+ newObj[key] = obj[key];
79
+ }
80
+ }
81
+ }
82
+ newObj.default = obj;
83
+ if (cache) {
84
+ cache.set(obj, newObj);
85
+ }
86
+ return newObj;
87
+ }
88
+ function _define_property(obj, key, value) {
89
+ if (key in obj) {
90
+ Object.defineProperty(obj, key, {
91
+ value: value,
92
+ enumerable: true,
93
+ configurable: true,
94
+ writable: true
95
+ });
96
+ } else {
97
+ obj[key] = value;
98
+ }
99
+ return obj;
100
+ }
101
+ function _object_spread(target) {
102
+ for(var i = 1; i < arguments.length; i++){
103
+ var source = arguments[i] != null ? arguments[i] : {};
104
+ var ownKeys = Object.keys(source);
105
+ if (typeof Object.getOwnPropertySymbols === "function") {
106
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
107
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
108
+ }));
109
+ }
110
+ ownKeys.forEach(function(key) {
111
+ _define_property(target, key, source[key]);
112
+ });
113
+ }
114
+ return target;
115
+ }
116
+ function ownKeys(object, enumerableOnly) {
117
+ var keys = Object.keys(object);
118
+ if (Object.getOwnPropertySymbols) {
119
+ var symbols = Object.getOwnPropertySymbols(object);
120
+ if (enumerableOnly) {
121
+ symbols = symbols.filter(function(sym) {
122
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
123
+ });
124
+ }
125
+ keys.push.apply(keys, symbols);
126
+ }
127
+ return keys;
128
+ }
129
+ function _object_spread_props(target, source) {
130
+ source = source != null ? source : {};
131
+ if (Object.getOwnPropertyDescriptors) {
132
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
133
+ } else {
134
+ ownKeys(Object(source)).forEach(function(key) {
135
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
136
+ });
137
+ }
138
+ return target;
139
+ }
140
+ function _object_without_properties(source, excluded) {
141
+ if (source == null) return {};
142
+ var target = _object_without_properties_loose(source, excluded);
143
+ var key, i;
144
+ if (Object.getOwnPropertySymbols) {
145
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
146
+ for(i = 0; i < sourceSymbolKeys.length; i++){
147
+ key = sourceSymbolKeys[i];
148
+ if (excluded.indexOf(key) >= 0) continue;
149
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
150
+ target[key] = source[key];
151
+ }
152
+ }
153
+ return target;
154
+ }
155
+ function _object_without_properties_loose(source, excluded) {
156
+ if (source == null) return {};
157
+ var target = {};
158
+ var sourceKeys = Object.keys(source);
159
+ var key, i;
160
+ for(i = 0; i < sourceKeys.length; i++){
161
+ key = sourceKeys[i];
162
+ if (excluded.indexOf(key) >= 0) continue;
163
+ target[key] = source[key];
164
+ }
165
+ return target;
166
+ }
167
+ const q = 400, x = /*#__PURE__*/ _react.createContext({
168
+ index: [],
169
+ toogle: ()=>{}
170
+ }), z = ()=>_react.useContext(x), B = (param)=>{
171
+ let { value: o , defaultValue: r , onChange: n , singleOpen: d } = param;
172
+ const m = o !== void 0, a = (e)=>e === void 0 ? [] : typeof e == "number" ? [
173
+ e
174
+ ] : e, [i, l] = _react.useState(a(r));
175
+ _react.useEffect(()=>l(a(r)), [
176
+ r
177
+ ]), _react.useEffect(()=>{
178
+ i.length > 1 && d && (i.splice(1), l([
179
+ ...i
180
+ ]));
181
+ }, [
182
+ d,
183
+ i
184
+ ]);
185
+ const p = (e, s)=>{
186
+ if (!s) return [
187
+ e
188
+ ];
189
+ const u = s.indexOf(e);
190
+ return u === -1 ? d ? s = [
191
+ e
192
+ ] : s.push(e) : s.splice(u, 1), [
193
+ ...s
194
+ ];
195
+ }, f = (e)=>{
196
+ if (m || l(p(e, i)), n) {
197
+ const s = (m ? a(o) : i).includes(e);
198
+ n(e, !s);
199
+ }
200
+ };
201
+ return m ? [
202
+ a(o),
203
+ f
204
+ ] : [
205
+ i,
206
+ f
207
+ ];
208
+ }, F = (o)=>{
209
+ const r = o == null ? void 0 : o.closest("[data-accordion]");
210
+ if (r) return Array.from(r.querySelectorAll("[data-accordion-item]")).filter((n)=>n.closest("[data-accordion]") === r).findIndex((n)=>n === o);
211
+ }, R = /*#__PURE__*/ _react.forwardRef((_param, m)=>{
212
+ var { content: o , dataAttributes: r , trackingEvent: n } = _param, d = _object_without_properties(_param, [
213
+ "content",
214
+ "dataAttributes",
215
+ "trackingEvent"
216
+ ]);
217
+ const a = _react.useRef(null), i = _react.useRef(null), { index: l , toogle: p } = z(), f = (0, _themevariantcontext.useIsInverseVariant)(), e = (0, _hooks.useAriaId)(), s = (0, _hooks.useAriaId)(), [u, b] = _react.useState(), I = u !== void 0 && (l == null ? void 0 : l.includes(u));
218
+ return _react.useEffect(()=>{
219
+ b(F(i.current));
220
+ }, []), /* @__PURE__ */ (0, _jsxruntime.jsxs)("div", _object_spread_props(_object_spread({
221
+ ref: i
222
+ }, (0, _dom.getPrefixedDataAttributes)(_object_spread_props(_object_spread({}, r), {
223
+ "accordion-item": !0
224
+ }))), {
225
+ children: [
226
+ /* @__PURE__ */ (0, _jsxruntime.jsx)(_touchable.BaseTouchable, {
227
+ ref: m,
228
+ className: (0, _classnames.default)(_accordioncssmistica.itemContent, f ? _accordioncssmistica.touchableBackgroundInverse : _accordioncssmistica.touchableBackground),
229
+ onPress: ()=>{
230
+ u !== void 0 && p(u);
231
+ },
232
+ trackingEvent: n,
233
+ "aria-expanded": I,
234
+ "aria-controls": s,
235
+ children: /* @__PURE__ */ (0, _jsxruntime.jsx)(_box.default, {
236
+ paddingX: 16,
237
+ children: /* @__PURE__ */ (0, _jsxruntime.jsx)(_list.Content, _object_spread_props(_object_spread({
238
+ labelId: e,
239
+ type: "custom"
240
+ }, d), {
241
+ right: /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
242
+ className: _accordioncssmistica.chevronContainer,
243
+ children: /* @__PURE__ */ (0, _jsxruntime.jsx)(_iconchevron.default, {
244
+ size: 24,
245
+ transitionDuration: 400,
246
+ direction: I ? "up" : "down",
247
+ color: f ? _skincontractcssmistica.vars.colors.inverse : I ? _skincontractcssmistica.vars.colors.neutralHigh : _skincontractcssmistica.vars.colors.neutralMedium
248
+ })
249
+ })
250
+ }))
251
+ })
252
+ }),
253
+ /* @__PURE__ */ (0, _jsxruntime.jsx)(_reacttransitiongroup.CSSTransition, {
254
+ in: I,
255
+ timeout: q,
256
+ nodeRef: a,
257
+ classNames: _accordioncssmistica.panelTransitionClasses,
258
+ mountOnEnter: !0,
259
+ unmountOnExit: !0,
260
+ children: /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
261
+ className: _accordioncssmistica.panelContainer,
262
+ ref: a,
263
+ children: /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
264
+ className: _accordioncssmistica.panel,
265
+ role: "region",
266
+ "aria-labelledby": e,
267
+ id: s,
268
+ children: /* @__PURE__ */ (0, _jsxruntime.jsx)(_box.default, {
269
+ paddingX: 16,
270
+ paddingBottom: 16,
271
+ children: o
272
+ })
273
+ })
274
+ })
275
+ })
276
+ ]
277
+ }));
278
+ }), co = /*#__PURE__*/ _react.forwardRef((_param, n)=>/* @__PURE__ */ {
279
+ var { dataAttributes: o } = _param, r = _object_without_properties(_param, [
280
+ "dataAttributes"
281
+ ]);
282
+ return (0, _jsxruntime.jsx)(R, _object_spread_props(_object_spread({}, r), {
283
+ ref: n,
284
+ dataAttributes: _object_spread({
285
+ "component-name": "AccordionItem"
286
+ }, o)
287
+ }));
288
+ }), io = (param)=>{
289
+ let { children: o , dataAttributes: r , noLastDivider: n , index: d , defaultIndex: m , onChange: a , singleOpen: i } = param;
290
+ const [l, p] = B({
291
+ value: d,
292
+ defaultValue: m,
293
+ onChange: a,
294
+ singleOpen: i
295
+ }), f = _react.Children.count(o) - 1, e = !n;
296
+ return /* @__PURE__ */ (0, _jsxruntime.jsx)(x.Provider, {
297
+ value: {
298
+ index: l,
299
+ toogle: p
300
+ },
301
+ children: /* @__PURE__ */ (0, _jsxruntime.jsx)("div", _object_spread_props(_object_spread({}, (0, _dom.getPrefixedDataAttributes)(_object_spread_props(_object_spread({}, r), {
302
+ accordion: !0
303
+ }), "Accordion")), {
304
+ children: _react.Children.toArray(o).filter(Boolean).map((s, u)=>/* @__PURE__ */ (0, _jsxruntime.jsxs)(_react.Fragment, {
305
+ children: [
306
+ s,
307
+ (u < f || e) && /* @__PURE__ */ (0, _jsxruntime.jsx)(_box.default, {
308
+ paddingX: 16,
309
+ children: /* @__PURE__ */ (0, _jsxruntime.jsx)(_divider.default, {})
310
+ })
311
+ ]
312
+ }, u))
313
+ }))
314
+ });
315
+ }, so = /*#__PURE__*/ _react.forwardRef((_param, d)=>/* @__PURE__ */ {
316
+ var { dataAttributes: o , isInverse: r } = _param, n = _object_without_properties(_param, [
317
+ "dataAttributes",
318
+ "isInverse"
319
+ ]);
320
+ return (0, _jsxruntime.jsx)(_boxed.Boxed, {
321
+ isInverse: r,
322
+ ref: d,
323
+ dataAttributes: _object_spread({
324
+ "component-name": "BoxedAccordionItem"
325
+ }, o),
326
+ children: /* @__PURE__ */ (0, _jsxruntime.jsx)(R, _object_spread({}, n))
327
+ });
328
+ }), ao = (param)=>{
329
+ let { children: o , dataAttributes: r , index: n , defaultIndex: d , onChange: m , singleOpen: a } = param;
330
+ const [i, l] = B({
331
+ value: n,
332
+ defaultValue: d,
333
+ onChange: m,
334
+ singleOpen: a
335
+ });
336
+ return /* @__PURE__ */ (0, _jsxruntime.jsx)(x.Provider, {
337
+ value: {
338
+ index: i,
339
+ toogle: l
340
+ },
341
+ children: /* @__PURE__ */ (0, _jsxruntime.jsx)(_stack.default, {
342
+ space: 16,
343
+ dataAttributes: _object_spread({
344
+ "component-name": "BoxedAccordion",
345
+ accordion: !0
346
+ }, r),
347
+ children: o
348
+ })
349
+ });
350
+ };
package/dist/boxed.d.ts CHANGED
@@ -9,6 +9,7 @@ type Props = {
9
9
  /** "data-" prefix is automatically added. For example, use "testid" instead of "data-testid" */
10
10
  dataAttributes?: DataAttributes;
11
11
  'aria-label'?: string;
12
+ 'aria-labelledby'?: string;
12
13
  width?: number | string;
13
14
  height?: number | string;
14
15
  minHeight?: number | string;
package/dist/boxed.js CHANGED
@@ -10,7 +10,7 @@ function _export(target, all) {
10
10
  }
11
11
  _export(exports, {
12
12
  Boxed: function() {
13
- return z;
13
+ return A;
14
14
  },
15
15
  InternalBoxed: function() {
16
16
  return w;
@@ -120,33 +120,34 @@ function _object_spread_props(target, source) {
120
120
  }
121
121
  return target;
122
122
  }
123
- const h = (o, r)=>o || r ? (0, _sprinklescssmistica.sprinkles)({
123
+ const h = (e, r)=>e || r ? (0, _sprinklescssmistica.sprinkles)({
124
124
  border: "none"
125
- }) : _boxedcssmistica.boxBorder, w = /*#__PURE__*/ _react.forwardRef((param, x)=>{
126
- let { children: o , isInverse: r = !1 , className: d , role: m , dataAttributes: f , "aria-label": l , width: c , height: b , minHeight: p , borderRadius: u = _skincontractcssmistica.vars.borderRadii.container , background: a } = param;
125
+ }) : _boxedcssmistica.boxBorder, w = /*#__PURE__*/ _react.forwardRef((param, v)=>{
126
+ let { children: e , isInverse: r = !1 , className: l , role: d , dataAttributes: m , "aria-label": b , "aria-labelledby": f , width: c , height: p , minHeight: u , borderRadius: x = _skincontractcssmistica.vars.borderRadii.container , background: t } = param;
127
127
  const n = (0, _themevariantcontext.useIsInverseVariant)();
128
128
  return /* @__PURE__ */ (0, _jsxruntime.jsx)("div", _object_spread_props(_object_spread({
129
- ref: x,
129
+ ref: v,
130
130
  style: {
131
131
  width: c,
132
- height: b,
133
- minHeight: p,
132
+ height: p,
133
+ minHeight: u,
134
134
  boxSizing: "border-box",
135
- background: a
135
+ background: t
136
136
  },
137
- className: (0, _classnames.default)(d, h(n, r), (0, _sprinklescssmistica.sprinkles)({
138
- borderRadius: u,
137
+ className: (0, _classnames.default)(l, h(n, r), (0, _sprinklescssmistica.sprinkles)({
138
+ borderRadius: x,
139
139
  overflow: "hidden",
140
- background: (a !== null && a !== void 0 ? a : r) ? n ? _skincontractcssmistica.vars.colors.backgroundContainerBrandOverInverse : _skincontractcssmistica.vars.colors.backgroundContainerBrand : _skincontractcssmistica.vars.colors.backgroundContainer
140
+ background: (t !== null && t !== void 0 ? t : r) ? n ? _skincontractcssmistica.vars.colors.backgroundContainerBrandOverInverse : _skincontractcssmistica.vars.colors.backgroundContainerBrand : _skincontractcssmistica.vars.colors.backgroundContainer
141
141
  })),
142
- role: m,
143
- "aria-label": l
144
- }, (0, _dom.getPrefixedDataAttributes)(f)), {
142
+ role: d,
143
+ "aria-label": b,
144
+ "aria-labelledby": f
145
+ }, (0, _dom.getPrefixedDataAttributes)(m)), {
145
146
  children: /* @__PURE__ */ (0, _jsxruntime.jsx)(_themevariantcontext.ThemeVariant, {
146
147
  isInverse: r,
147
- children: o
148
+ children: e
148
149
  })
149
150
  }));
150
- }), z = /*#__PURE__*/ _react.forwardRef((o, r)=>/* @__PURE__ */ (0, _jsxruntime.jsx)(w, _object_spread_props(_object_spread({}, o), {
151
+ }), A = /*#__PURE__*/ _react.forwardRef((e, r)=>/* @__PURE__ */ (0, _jsxruntime.jsx)(w, _object_spread_props(_object_spread({}, e), {
151
152
  ref: r
152
153
  })));