@telefonica/mistica 14.23.0 → 14.24.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-es/header.js CHANGED
@@ -91,7 +91,7 @@ import { hideOnTabletOrSmaller as R, hideOnDesktop as j, breadcrumbs as G } from
91
91
  import { getPrefixedDataAttributes as I } from "./utils/dom.js";
92
92
  import { Title2 as O, Title3 as P } from "./title.js";
93
93
  const $ = (param)=>{
94
- let { pretitle: t , title: o , description: e , dataAttributes: d , small: m = !1 , preamount: s , amount: p , button: n , subtitle: i , isErrorAmount: h , secondaryButton: b } = param;
94
+ let { pretitle: t , title: e , description: o , dataAttributes: d , small: m = !1 , preamount: s , amount: p , button: n , subtitle: i , isErrorAmount: h , secondaryButton: b } = param;
95
95
  const H = S(), g = (f, v)=>{
96
96
  if (typeof f == "string") return /* @__PURE__ */ r(x, _object_spread_props(_object_spread({
97
97
  regular: !0
@@ -114,7 +114,7 @@ const $ = (param)=>{
114
114
  },
115
115
  dataAttributes: d,
116
116
  children: [
117
- (o || t || e) && /* @__PURE__ */ r(u, {
117
+ (e || t || o) && /* @__PURE__ */ r(u, {
118
118
  paddingRight: 16,
119
119
  children: /* @__PURE__ */ l(a, {
120
120
  space: 8,
@@ -122,21 +122,21 @@ const $ = (param)=>{
122
122
  t && g(t, {
123
123
  color: c.colors.textPrimary
124
124
  }),
125
- m ? /* @__PURE__ */ r(O, {
125
+ e && (m ? /* @__PURE__ */ r(O, {
126
126
  as: "h2",
127
- children: o
127
+ children: e
128
128
  }) : /* @__PURE__ */ r(P, {
129
129
  as: "h2",
130
- children: o
131
- }),
132
- e && (m ? /* @__PURE__ */ r(B, {
130
+ children: e
131
+ })),
132
+ o && (m ? /* @__PURE__ */ r(B, {
133
133
  regular: !0,
134
134
  color: c.colors.textSecondary,
135
- children: e
135
+ children: o
136
136
  }) : /* @__PURE__ */ r(x, {
137
137
  regular: !0,
138
138
  color: c.colors.textSecondary,
139
- children: e
139
+ children: o
140
140
  }))
141
141
  ]
142
142
  })
@@ -166,7 +166,7 @@ const $ = (param)=>{
166
166
  ]
167
167
  });
168
168
  }, E = (param)=>/* @__PURE__ */ {
169
- let { title: t , description: o , button: e } = param;
169
+ let { title: t , description: e , button: o } = param;
170
170
  return l(a, {
171
171
  space: 32,
172
172
  children: [
@@ -181,23 +181,23 @@ const $ = (param)=>{
181
181
  "aria-level": 1,
182
182
  children: t
183
183
  }),
184
- o && /* @__PURE__ */ r(M, {
185
- children: o
184
+ e && /* @__PURE__ */ r(M, {
185
+ children: e
186
186
  })
187
187
  ]
188
188
  }),
189
- e
189
+ o
190
190
  ]
191
191
  });
192
192
  }, Y = (param)=>{
193
- let { isInverse: t = !0 , breadcrumbs: o , header: e , extra: d , sideBySideExtraOnDesktop: m = !1 , dataAttributes: s , bleed: p = !1 , noPaddingY: n = !1 } = param;
193
+ let { isInverse: t = !0 , breadcrumbs: e , header: o , extra: d , sideBySideExtraOnDesktop: m = !1 , dataAttributes: s , bleed: p = !1 , noPaddingY: n = !1 } = param;
194
194
  const i = p && t && d, h = /* @__PURE__ */ l("div", {
195
195
  children: [
196
- o && /* @__PURE__ */ r("div", {
196
+ e && /* @__PURE__ */ r("div", {
197
197
  className: G,
198
- children: o
198
+ children: e
199
199
  }),
200
- e
200
+ o
201
201
  ]
202
202
  });
203
203
  return /* @__PURE__ */ l("div", _object_spread_props(_object_spread({}, I(_object_spread({
@@ -210,8 +210,8 @@ const $ = (param)=>{
210
210
  /* @__PURE__ */ r(T, {}),
211
211
  /* @__PURE__ */ r(u, {
212
212
  paddingTop: n ? 0 : {
213
- mobile: e ? 32 : 0,
214
- desktop: o ? 16 : 48
213
+ mobile: o ? 32 : 0,
214
+ desktop: e ? 16 : 48
215
215
  },
216
216
  paddingBottom: {
217
217
  mobile: n && !i ? 0 : 24,
@@ -224,14 +224,14 @@ const $ = (param)=>{
224
224
  className: i ? R : "",
225
225
  children: /* @__PURE__ */ r(u, {
226
226
  paddingTop: {
227
- mobile: e ? 24 : 0,
227
+ mobile: o ? 24 : 0,
228
228
  desktop: 0
229
229
  },
230
230
  children: d
231
231
  })
232
232
  })
233
233
  }) : /* @__PURE__ */ l(a, {
234
- space: e ? {
234
+ space: o ? {
235
235
  mobile: 24,
236
236
  desktop: 32
237
237
  } : 0,
@@ -251,12 +251,12 @@ const $ = (param)=>{
251
251
  ]
252
252
  }));
253
253
  }, rr = (param)=>/* @__PURE__ */ {
254
- let { isInverse: t = !0 , children: o , dataAttributes: e } = param;
254
+ let { isInverse: t = !0 , children: e , dataAttributes: o } = param;
255
255
  return l(k, {
256
256
  isInverse: t,
257
257
  dataAttributes: _object_spread({
258
258
  "component-name": "MainSectionHeaderLayout"
259
- }, e),
259
+ }, o),
260
260
  children: [
261
261
  /* @__PURE__ */ r(T, {}),
262
262
  /* @__PURE__ */ r(y, {
@@ -270,7 +270,7 @@ const $ = (param)=>{
270
270
  mobile: 24,
271
271
  desktop: 48
272
272
  },
273
- children: o
273
+ children: e
274
274
  }),
275
275
  right: null
276
276
  })
@@ -41,16 +41,16 @@ const d = (param)=>{
41
41
  /* @__PURE__ */ e("circle", _object_spread({
42
42
  cx: "32",
43
43
  cy: "32",
44
- r: "25",
44
+ r: "31",
45
45
  stroke: `url(#${t})`
46
- }, c("25", r))),
46
+ }, c("31", r))),
47
47
  /* @__PURE__ */ e("polyline", _object_spread({
48
48
  fill: "none",
49
49
  stroke: "white",
50
50
  strokeWidth: "1.5",
51
51
  strokeLinecap: "round",
52
52
  strokeLinejoin: "round",
53
- points: "25.75,32.75 29.69,37.5 38.25,26.5"
53
+ points: "24,32.75 30,39 40.5,24.5"
54
54
  }, l("44", "0.4s", r, "0.5 0 0.83 0.83"))),
55
55
  /* @__PURE__ */ e("defs", {
56
56
  children: /* @__PURE__ */ s("linearGradient", {
@@ -1,2 +1,2 @@
1
- const o = "14.23.0";
1
+ const o = "14.24.0";
2
2
  export { o as PACKAGE_VERSION };
@@ -81,44 +81,48 @@ function _object_spread_props(target, source) {
81
81
  }
82
82
  import { jsx as u } from "react/jsx-runtime";
83
83
  import * as S from "react";
84
- import { ActionsSheet as h, RadioListSheet as w, ActionsListSheet as N, InfoSheet as y } from "./sheet.js";
84
+ import { ActionsSheet as w, RadioListSheet as y, ActionsListSheet as N, InfoSheet as A } from "./sheet.js";
85
85
  import O from "./image.js";
86
- import { useTheme as A } from "./hooks.js";
86
+ import { useTheme as m } from "./hooks.js";
87
87
  let p = null, n = null, l = null;
88
- const m = (param)=>{
89
- let { title: s , subtitle: c , description: e , selectedId: o , items: t } = param;
88
+ const d = (r)=>Array.isArray(r) ? r.length ? r.join(`
89
+
90
+ `) : void 0 : r, L = (param)=>{
91
+ let { title: r , subtitle: c , description: e , selectedId: s , items: t } = param;
90
92
  return l({
91
- title: s,
93
+ title: r,
92
94
  subtitle: c,
93
- description: e,
95
+ // TODO: add multiline support to native sheet
96
+ description: d(e),
94
97
  content: [
95
98
  {
96
99
  type: "LIST",
97
100
  id: "list-0",
98
101
  listType: "SINGLE_SELECTION",
99
102
  autoSubmit: !0,
100
- selectedIds: typeof o == "string" ? [
101
- o
103
+ selectedIds: typeof s == "string" ? [
104
+ s
102
105
  ] : [],
103
106
  items: t
104
107
  }
105
108
  ]
106
109
  }).then((param)=>{
107
- let { action: r , result: i } = param;
108
- return r === "SUBMIT" ? {
109
- action: r,
110
- selectedId: i[0].selectedIds[0]
110
+ let { action: o , result: a } = param;
111
+ return o === "SUBMIT" ? {
112
+ action: o,
113
+ selectedId: a[0].selectedIds[0]
111
114
  } : {
112
- action: r,
115
+ action: o,
113
116
  selectedId: null
114
117
  };
115
118
  });
116
- }, L = (param)=>{
117
- let { title: s , subtitle: c , description: e , items: o } = param;
119
+ }, k = (param)=>{
120
+ let { title: r , subtitle: c , description: e , items: s } = param;
118
121
  return l({
119
- title: s,
122
+ title: r,
120
123
  subtitle: c,
121
- description: e,
124
+ // TODO: add multiline support to native sheet
125
+ description: d(e),
122
126
  content: [
123
127
  {
124
128
  type: "LIST",
@@ -126,26 +130,27 @@ const m = (param)=>{
126
130
  listType: "ACTIONS",
127
131
  autoSubmit: !0,
128
132
  selectedIds: [],
129
- items: o
133
+ items: s
130
134
  }
131
135
  ]
132
136
  }).then((param)=>{
133
- let { action: t , result: r } = param;
137
+ let { action: t , result: o } = param;
134
138
  return t === "SUBMIT" ? {
135
139
  action: t,
136
- selectedId: r[0].selectedIds[0]
140
+ selectedId: o[0].selectedIds[0]
137
141
  } : {
138
142
  action: t,
139
143
  selectedId: null
140
144
  };
141
145
  });
142
- }, k = function() {
146
+ }, b = function() {
143
147
  var _ref = _async_to_generator(function*(param) {
144
- let { title: s , subtitle: c , description: e , items: o } = param;
148
+ let { title: r , subtitle: c , description: e , items: s } = param;
145
149
  yield l({
146
- title: s,
150
+ title: r,
147
151
  subtitle: c,
148
- description: e,
152
+ // TODO: add multiline support to native sheet
153
+ description: d(e),
149
154
  content: [
150
155
  {
151
156
  type: "LIST",
@@ -153,37 +158,38 @@ const m = (param)=>{
153
158
  listType: "INFORMATIVE",
154
159
  autoSubmit: !1,
155
160
  selectedIds: [],
156
- items: o
161
+ items: s
157
162
  }
158
163
  ]
159
164
  });
160
165
  });
161
- return function k(_) {
166
+ return function b(_) {
162
167
  return _ref.apply(this, arguments);
163
168
  };
164
- }(), b = function() {
169
+ }(), C = function() {
165
170
  var _ref = _async_to_generator(function*(param) {
166
- let { title: s , subtitle: c , description: e , button: o , secondaryButton: t , link: r } = param;
171
+ let { title: r , subtitle: c , description: e , button: s , secondaryButton: t , link: o } = param;
167
172
  return l({
168
- title: s,
173
+ title: r,
169
174
  subtitle: c,
170
- description: e,
175
+ // TODO: add multiline support to native sheet
176
+ description: d(e),
171
177
  content: [
172
178
  {
173
179
  type: "BOTTOM_ACTIONS",
174
180
  id: "bottom-actions-0",
175
- button: o,
181
+ button: s,
176
182
  secondaryButton: t,
177
- link: r
183
+ link: o
178
184
  }
179
185
  ]
180
186
  }).then((param)=>{
181
- let { action: i , result: a } = param;
182
- if (i === "SUBMIT") {
183
- const d = a.find((param)=>{
187
+ let { action: a , result: i } = param;
188
+ if (a === "SUBMIT") {
189
+ const f = i.find((param)=>{
184
190
  let { id: T } = param;
185
191
  return T === "bottom-actions-0";
186
- }), I = d == null ? void 0 : d.selectedIds[0];
192
+ }), I = f == null ? void 0 : f.selectedIds[0];
187
193
  if (I === "PRIMARY" || I === "SECONDARY" || I === "LINK") return {
188
194
  action: I
189
195
  };
@@ -193,63 +199,63 @@ const m = (param)=>{
193
199
  };
194
200
  });
195
201
  });
196
- return function b(_) {
202
+ return function C(_) {
197
203
  return _ref.apply(this, arguments);
198
204
  };
199
205
  }();
200
- let f = !1;
201
- const _ = (s)=>{
206
+ let h = !1;
207
+ const B = (r)=>{
202
208
  const c = ()=>{
203
209
  if (!p) return Promise.reject(new Error("Tried to show a Sheet but the SheetRoot component was not mounted"));
204
- if (f) return Promise.reject(new Error("Tried to show a Sheet but there is already one open"));
205
- f = !0, p(s);
206
- const e = new Promise((o)=>{
207
- n = o;
210
+ if (h) return Promise.reject(new Error("Tried to show a Sheet but there is already one open"));
211
+ h = !0, p(r);
212
+ const e = new Promise((s)=>{
213
+ n = s;
208
214
  });
209
215
  return e.finally(()=>{
210
- f = !1;
216
+ h = !1;
211
217
  }), e;
212
218
  };
213
219
  if (l) {
214
220
  let e;
215
- const { type: o , props: t } = s;
216
- switch(o){
221
+ const { type: s , props: t } = r;
222
+ switch(s){
217
223
  case "INFO":
218
- e = k(t);
224
+ e = b(t);
219
225
  break;
220
226
  case "ACTIONS_LIST":
221
- e = L(t);
227
+ e = k(t);
222
228
  break;
223
229
  case "RADIO_LIST":
224
- e = m(t);
230
+ e = L(t);
225
231
  break;
226
232
  case "ACTIONS":
227
- e = b(t);
233
+ e = C(t);
228
234
  break;
229
235
  default:
230
- const r = o;
231
- throw new Error(`Unknown sheet type: ${r}`);
236
+ const o = s;
237
+ throw new Error(`Unknown sheet type: ${o}`);
232
238
  }
233
- return e.catch((r)=>{
234
- if (r.code === "400") return c();
235
- throw r;
239
+ return e.catch((o)=>{
240
+ if (o.code === "400") return c();
241
+ throw o;
236
242
  });
237
243
  } else return c();
238
- }, C = (s)=>{
239
- const { isDarkMode: c } = A(), [e, o] = S.useState(null), t = S.useRef(null);
244
+ }, M = (r)=>{
245
+ const { isDarkMode: c } = m(), [e, s] = S.useState(null), t = S.useRef(null);
240
246
  if (S.useEffect(()=>{
241
- if (s.nativeImplementation) return l = s.nativeImplementation, ()=>{
247
+ if (r.nativeImplementation) return l = r.nativeImplementation, ()=>{
242
248
  l = null;
243
249
  };
244
250
  }, [
245
- s.nativeImplementation
246
- ]), S.useEffect(()=>(p = (a)=>{
247
- t.current = null, o(a);
251
+ r.nativeImplementation
252
+ ]), S.useEffect(()=>(p = (i)=>{
253
+ t.current = null, s(i);
248
254
  }, ()=>{
249
255
  p = null;
250
256
  }), []), !e) return null;
251
- const r = ()=>{
252
- switch(o(null), e.type){
257
+ const o = ()=>{
258
+ switch(s(null), e.type){
253
259
  case "INFO":
254
260
  n == null || n(void 0);
255
261
  break;
@@ -279,39 +285,39 @@ const _ = (s)=>{
279
285
  default:
280
286
  throw new Error(`Unknown sheet type: ${e.type}`);
281
287
  }
282
- }, i = (a)=>{
283
- t.current = a;
288
+ }, a = (i)=>{
289
+ t.current = i;
284
290
  };
285
291
  switch(e.type){
286
292
  case "INFO":
287
- return /* @__PURE__ */ u(y, _object_spread_props(_object_spread({}, e.props), {
288
- onClose: r
293
+ return /* @__PURE__ */ u(A, _object_spread_props(_object_spread({}, e.props), {
294
+ onClose: o
289
295
  }));
290
296
  case "ACTIONS_LIST":
291
297
  return /* @__PURE__ */ u(N, _object_spread_props(_object_spread({}, e.props), {
292
- onClose: r,
293
- onSelect: i
298
+ onClose: o,
299
+ onSelect: a
294
300
  }));
295
301
  case "RADIO_LIST":
296
- return /* @__PURE__ */ u(w, _object_spread_props(_object_spread({}, e.props), {
297
- items: e.props.items.map((a)=>_object_spread_props(_object_spread({}, a), {
298
- asset: a.icon && /* @__PURE__ */ u(O, {
302
+ return /* @__PURE__ */ u(y, _object_spread_props(_object_spread({}, e.props), {
303
+ items: e.props.items.map((i)=>_object_spread_props(_object_spread({}, i), {
304
+ asset: i.icon && /* @__PURE__ */ u(O, {
299
305
  circular: !0,
300
- src: c && a.icon.urlDark ? a.icon.urlDark : a.icon.url,
301
- width: a.icon.size === "small" ? 24 : 40
306
+ src: c && i.icon.urlDark ? i.icon.urlDark : i.icon.url,
307
+ width: i.icon.size === "small" ? 24 : 40
302
308
  })
303
309
  })),
304
- onClose: r,
305
- onSelect: i
310
+ onClose: o,
311
+ onSelect: a
306
312
  }));
307
313
  case "ACTIONS":
308
- return /* @__PURE__ */ u(h, _object_spread_props(_object_spread({}, e.props), {
314
+ return /* @__PURE__ */ u(w, _object_spread_props(_object_spread({}, e.props), {
309
315
  buttonLink: e.props.link,
310
- onClose: r,
311
- onPressButton: i
316
+ onClose: o,
317
+ onPressButton: a
312
318
  }));
313
319
  default:
314
320
  throw new Error(`Unknown sheet type: ${e.type}`);
315
321
  }
316
- }, B = C;
317
- export { C as SheetRoot, B as default, _ as showSheet };
322
+ }, F = M;
323
+ export { M as SheetRoot, F as default, B as showSheet };