@telefonica/mistica 14.23.1 → 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/css/mistica.css +1 -1
- package/dist/package-version.js +1 -1
- package/dist/sheet-root.d.ts +1 -1
- package/dist/sheet-root.js +84 -78
- package/dist/sheet.d.ts +5 -5
- package/dist/sheet.js +101 -90
- package/dist-es/package-version.js +1 -1
- package/dist-es/sheet-root.js +87 -81
- package/dist-es/sheet.js +136 -125
- package/dist-es/style.css +1 -1
- package/package.json +1 -1
package/dist/sheet-root.js
CHANGED
|
@@ -10,13 +10,13 @@ function _export(target, all) {
|
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
12
|
SheetRoot: function() {
|
|
13
|
-
return
|
|
13
|
+
return M;
|
|
14
14
|
},
|
|
15
15
|
default: function() {
|
|
16
|
-
return
|
|
16
|
+
return F;
|
|
17
17
|
},
|
|
18
18
|
showSheet: function() {
|
|
19
|
-
return
|
|
19
|
+
return B;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
const _jsxruntime = require("react/jsx-runtime");
|
|
@@ -150,40 +150,44 @@ function _object_spread_props(target, source) {
|
|
|
150
150
|
return target;
|
|
151
151
|
}
|
|
152
152
|
let p = null, n = null, l = null;
|
|
153
|
-
const
|
|
154
|
-
|
|
153
|
+
const d = (r)=>Array.isArray(r) ? r.length ? r.join(`
|
|
154
|
+
|
|
155
|
+
`) : void 0 : r, L = (param)=>{
|
|
156
|
+
let { title: r , subtitle: c , description: e , selectedId: s , items: t } = param;
|
|
155
157
|
return l({
|
|
156
|
-
title:
|
|
158
|
+
title: r,
|
|
157
159
|
subtitle: c,
|
|
158
|
-
|
|
160
|
+
// TODO: add multiline support to native sheet
|
|
161
|
+
description: d(e),
|
|
159
162
|
content: [
|
|
160
163
|
{
|
|
161
164
|
type: "LIST",
|
|
162
165
|
id: "list-0",
|
|
163
166
|
listType: "SINGLE_SELECTION",
|
|
164
167
|
autoSubmit: !0,
|
|
165
|
-
selectedIds: typeof
|
|
166
|
-
|
|
168
|
+
selectedIds: typeof s == "string" ? [
|
|
169
|
+
s
|
|
167
170
|
] : [],
|
|
168
171
|
items: t
|
|
169
172
|
}
|
|
170
173
|
]
|
|
171
174
|
}).then((param)=>{
|
|
172
|
-
let { action:
|
|
173
|
-
return
|
|
174
|
-
action:
|
|
175
|
-
selectedId:
|
|
175
|
+
let { action: o , result: a } = param;
|
|
176
|
+
return o === "SUBMIT" ? {
|
|
177
|
+
action: o,
|
|
178
|
+
selectedId: a[0].selectedIds[0]
|
|
176
179
|
} : {
|
|
177
|
-
action:
|
|
180
|
+
action: o,
|
|
178
181
|
selectedId: null
|
|
179
182
|
};
|
|
180
183
|
});
|
|
181
|
-
},
|
|
182
|
-
let { title:
|
|
184
|
+
}, k = (param)=>{
|
|
185
|
+
let { title: r , subtitle: c , description: e , items: s } = param;
|
|
183
186
|
return l({
|
|
184
|
-
title:
|
|
187
|
+
title: r,
|
|
185
188
|
subtitle: c,
|
|
186
|
-
|
|
189
|
+
// TODO: add multiline support to native sheet
|
|
190
|
+
description: d(e),
|
|
187
191
|
content: [
|
|
188
192
|
{
|
|
189
193
|
type: "LIST",
|
|
@@ -191,26 +195,27 @@ const m = (param)=>{
|
|
|
191
195
|
listType: "ACTIONS",
|
|
192
196
|
autoSubmit: !0,
|
|
193
197
|
selectedIds: [],
|
|
194
|
-
items:
|
|
198
|
+
items: s
|
|
195
199
|
}
|
|
196
200
|
]
|
|
197
201
|
}).then((param)=>{
|
|
198
|
-
let { action: t , result:
|
|
202
|
+
let { action: t , result: o } = param;
|
|
199
203
|
return t === "SUBMIT" ? {
|
|
200
204
|
action: t,
|
|
201
|
-
selectedId:
|
|
205
|
+
selectedId: o[0].selectedIds[0]
|
|
202
206
|
} : {
|
|
203
207
|
action: t,
|
|
204
208
|
selectedId: null
|
|
205
209
|
};
|
|
206
210
|
});
|
|
207
|
-
},
|
|
211
|
+
}, b = function() {
|
|
208
212
|
var _ref = _async_to_generator(function*(param) {
|
|
209
|
-
let { title:
|
|
213
|
+
let { title: r , subtitle: c , description: e , items: s } = param;
|
|
210
214
|
yield l({
|
|
211
|
-
title:
|
|
215
|
+
title: r,
|
|
212
216
|
subtitle: c,
|
|
213
|
-
|
|
217
|
+
// TODO: add multiline support to native sheet
|
|
218
|
+
description: d(e),
|
|
214
219
|
content: [
|
|
215
220
|
{
|
|
216
221
|
type: "LIST",
|
|
@@ -218,37 +223,38 @@ const m = (param)=>{
|
|
|
218
223
|
listType: "INFORMATIVE",
|
|
219
224
|
autoSubmit: !1,
|
|
220
225
|
selectedIds: [],
|
|
221
|
-
items:
|
|
226
|
+
items: s
|
|
222
227
|
}
|
|
223
228
|
]
|
|
224
229
|
});
|
|
225
230
|
});
|
|
226
|
-
return function
|
|
231
|
+
return function b(_) {
|
|
227
232
|
return _ref.apply(this, arguments);
|
|
228
233
|
};
|
|
229
|
-
}(),
|
|
234
|
+
}(), C = function() {
|
|
230
235
|
var _ref = _async_to_generator(function*(param) {
|
|
231
|
-
let { title:
|
|
236
|
+
let { title: r , subtitle: c , description: e , button: s , secondaryButton: t , link: o } = param;
|
|
232
237
|
return l({
|
|
233
|
-
title:
|
|
238
|
+
title: r,
|
|
234
239
|
subtitle: c,
|
|
235
|
-
|
|
240
|
+
// TODO: add multiline support to native sheet
|
|
241
|
+
description: d(e),
|
|
236
242
|
content: [
|
|
237
243
|
{
|
|
238
244
|
type: "BOTTOM_ACTIONS",
|
|
239
245
|
id: "bottom-actions-0",
|
|
240
|
-
button:
|
|
246
|
+
button: s,
|
|
241
247
|
secondaryButton: t,
|
|
242
|
-
link:
|
|
248
|
+
link: o
|
|
243
249
|
}
|
|
244
250
|
]
|
|
245
251
|
}).then((param)=>{
|
|
246
|
-
let { action:
|
|
247
|
-
if (
|
|
248
|
-
const
|
|
252
|
+
let { action: a , result: i } = param;
|
|
253
|
+
if (a === "SUBMIT") {
|
|
254
|
+
const f = i.find((param)=>{
|
|
249
255
|
let { id: T } = param;
|
|
250
256
|
return T === "bottom-actions-0";
|
|
251
|
-
}), I =
|
|
257
|
+
}), I = f == null ? void 0 : f.selectedIds[0];
|
|
252
258
|
if (I === "PRIMARY" || I === "SECONDARY" || I === "LINK") return {
|
|
253
259
|
action: I
|
|
254
260
|
};
|
|
@@ -258,63 +264,63 @@ const m = (param)=>{
|
|
|
258
264
|
};
|
|
259
265
|
});
|
|
260
266
|
});
|
|
261
|
-
return function
|
|
267
|
+
return function C(_) {
|
|
262
268
|
return _ref.apply(this, arguments);
|
|
263
269
|
};
|
|
264
270
|
}();
|
|
265
|
-
let
|
|
266
|
-
const
|
|
271
|
+
let h = !1;
|
|
272
|
+
const B = (r)=>{
|
|
267
273
|
const c = ()=>{
|
|
268
274
|
if (!p) return Promise.reject(new Error("Tried to show a Sheet but the SheetRoot component was not mounted"));
|
|
269
|
-
if (
|
|
270
|
-
|
|
271
|
-
const e = new Promise((
|
|
272
|
-
n =
|
|
275
|
+
if (h) return Promise.reject(new Error("Tried to show a Sheet but there is already one open"));
|
|
276
|
+
h = !0, p(r);
|
|
277
|
+
const e = new Promise((s)=>{
|
|
278
|
+
n = s;
|
|
273
279
|
});
|
|
274
280
|
return e.finally(()=>{
|
|
275
|
-
|
|
281
|
+
h = !1;
|
|
276
282
|
}), e;
|
|
277
283
|
};
|
|
278
284
|
if (l) {
|
|
279
285
|
let e;
|
|
280
|
-
const { type:
|
|
281
|
-
switch(
|
|
286
|
+
const { type: s , props: t } = r;
|
|
287
|
+
switch(s){
|
|
282
288
|
case "INFO":
|
|
283
|
-
e =
|
|
289
|
+
e = b(t);
|
|
284
290
|
break;
|
|
285
291
|
case "ACTIONS_LIST":
|
|
286
|
-
e =
|
|
292
|
+
e = k(t);
|
|
287
293
|
break;
|
|
288
294
|
case "RADIO_LIST":
|
|
289
|
-
e =
|
|
295
|
+
e = L(t);
|
|
290
296
|
break;
|
|
291
297
|
case "ACTIONS":
|
|
292
|
-
e =
|
|
298
|
+
e = C(t);
|
|
293
299
|
break;
|
|
294
300
|
default:
|
|
295
|
-
const
|
|
296
|
-
throw new Error(`Unknown sheet type: ${
|
|
301
|
+
const o = s;
|
|
302
|
+
throw new Error(`Unknown sheet type: ${o}`);
|
|
297
303
|
}
|
|
298
|
-
return e.catch((
|
|
299
|
-
if (
|
|
300
|
-
throw
|
|
304
|
+
return e.catch((o)=>{
|
|
305
|
+
if (o.code === "400") return c();
|
|
306
|
+
throw o;
|
|
301
307
|
});
|
|
302
308
|
} else return c();
|
|
303
|
-
},
|
|
304
|
-
const { isDarkMode: c } = (0, _hooks.useTheme)(), [e,
|
|
309
|
+
}, M = (r)=>{
|
|
310
|
+
const { isDarkMode: c } = (0, _hooks.useTheme)(), [e, s] = _react.useState(null), t = _react.useRef(null);
|
|
305
311
|
if (_react.useEffect(()=>{
|
|
306
|
-
if (
|
|
312
|
+
if (r.nativeImplementation) return l = r.nativeImplementation, ()=>{
|
|
307
313
|
l = null;
|
|
308
314
|
};
|
|
309
315
|
}, [
|
|
310
|
-
|
|
311
|
-
]), _react.useEffect(()=>(p = (
|
|
312
|
-
t.current = null,
|
|
316
|
+
r.nativeImplementation
|
|
317
|
+
]), _react.useEffect(()=>(p = (i)=>{
|
|
318
|
+
t.current = null, s(i);
|
|
313
319
|
}, ()=>{
|
|
314
320
|
p = null;
|
|
315
321
|
}), []), !e) return null;
|
|
316
|
-
const
|
|
317
|
-
switch(
|
|
322
|
+
const o = ()=>{
|
|
323
|
+
switch(s(null), e.type){
|
|
318
324
|
case "INFO":
|
|
319
325
|
n == null || n(void 0);
|
|
320
326
|
break;
|
|
@@ -344,38 +350,38 @@ const _ = (s)=>{
|
|
|
344
350
|
default:
|
|
345
351
|
throw new Error(`Unknown sheet type: ${e.type}`);
|
|
346
352
|
}
|
|
347
|
-
},
|
|
348
|
-
t.current =
|
|
353
|
+
}, a = (i)=>{
|
|
354
|
+
t.current = i;
|
|
349
355
|
};
|
|
350
356
|
switch(e.type){
|
|
351
357
|
case "INFO":
|
|
352
358
|
return /* @__PURE__ */ (0, _jsxruntime.jsx)(_sheet.InfoSheet, _object_spread_props(_object_spread({}, e.props), {
|
|
353
|
-
onClose:
|
|
359
|
+
onClose: o
|
|
354
360
|
}));
|
|
355
361
|
case "ACTIONS_LIST":
|
|
356
362
|
return /* @__PURE__ */ (0, _jsxruntime.jsx)(_sheet.ActionsListSheet, _object_spread_props(_object_spread({}, e.props), {
|
|
357
|
-
onClose:
|
|
358
|
-
onSelect:
|
|
363
|
+
onClose: o,
|
|
364
|
+
onSelect: a
|
|
359
365
|
}));
|
|
360
366
|
case "RADIO_LIST":
|
|
361
367
|
return /* @__PURE__ */ (0, _jsxruntime.jsx)(_sheet.RadioListSheet, _object_spread_props(_object_spread({}, e.props), {
|
|
362
|
-
items: e.props.items.map((
|
|
363
|
-
asset:
|
|
368
|
+
items: e.props.items.map((i)=>_object_spread_props(_object_spread({}, i), {
|
|
369
|
+
asset: i.icon && /* @__PURE__ */ (0, _jsxruntime.jsx)(_image.default, {
|
|
364
370
|
circular: !0,
|
|
365
|
-
src: c &&
|
|
366
|
-
width:
|
|
371
|
+
src: c && i.icon.urlDark ? i.icon.urlDark : i.icon.url,
|
|
372
|
+
width: i.icon.size === "small" ? 24 : 40
|
|
367
373
|
})
|
|
368
374
|
})),
|
|
369
|
-
onClose:
|
|
370
|
-
onSelect:
|
|
375
|
+
onClose: o,
|
|
376
|
+
onSelect: a
|
|
371
377
|
}));
|
|
372
378
|
case "ACTIONS":
|
|
373
379
|
return /* @__PURE__ */ (0, _jsxruntime.jsx)(_sheet.ActionsSheet, _object_spread_props(_object_spread({}, e.props), {
|
|
374
380
|
buttonLink: e.props.link,
|
|
375
|
-
onClose:
|
|
376
|
-
onPressButton:
|
|
381
|
+
onClose: o,
|
|
382
|
+
onPressButton: a
|
|
377
383
|
}));
|
|
378
384
|
default:
|
|
379
385
|
throw new Error(`Unknown sheet type: ${e.type}`);
|
|
380
386
|
}
|
|
381
|
-
},
|
|
387
|
+
}, F = M;
|
package/dist/sheet.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ declare const Sheet: React.ForwardRefExoticComponent<SheetProps & React.RefAttri
|
|
|
14
14
|
type SheetBodyProps = {
|
|
15
15
|
title?: string;
|
|
16
16
|
subtitle?: string;
|
|
17
|
-
description?: string
|
|
17
|
+
description?: string | Array<string>;
|
|
18
18
|
button?: RendersNullableElement<typeof ButtonPrimary>;
|
|
19
19
|
secondaryButton?: RendersNullableElement<typeof ButtonSecondary>;
|
|
20
20
|
link?: RendersNullableElement<typeof ButtonLink>;
|
|
@@ -25,7 +25,7 @@ export declare const SheetBody: ({ title, subtitle, description, modalTitleId, b
|
|
|
25
25
|
type RadioListSheetProps = {
|
|
26
26
|
title?: string;
|
|
27
27
|
subtitle?: string;
|
|
28
|
-
description?: string
|
|
28
|
+
description?: string | Array<string>;
|
|
29
29
|
items: Array<{
|
|
30
30
|
id: string;
|
|
31
31
|
title?: string;
|
|
@@ -44,7 +44,7 @@ export declare const RadioListSheet: React.ForwardRefExoticComponent<RadioListSh
|
|
|
44
44
|
type ActionsListSheetProps = {
|
|
45
45
|
title?: string;
|
|
46
46
|
subtitle?: string;
|
|
47
|
-
description?: string
|
|
47
|
+
description?: string | Array<string>;
|
|
48
48
|
items: Array<{
|
|
49
49
|
id: string;
|
|
50
50
|
title: string;
|
|
@@ -64,7 +64,7 @@ export declare const ActionsListSheet: React.ForwardRefExoticComponent<ActionsLi
|
|
|
64
64
|
type InfoSheetProps = {
|
|
65
65
|
title?: string;
|
|
66
66
|
subtitle?: string;
|
|
67
|
-
description?: string
|
|
67
|
+
description?: string | Array<string>;
|
|
68
68
|
items: Array<{
|
|
69
69
|
id?: string;
|
|
70
70
|
title: string;
|
|
@@ -93,7 +93,7 @@ type ButtonProps = {
|
|
|
93
93
|
type ActionsSheetProps = {
|
|
94
94
|
title?: string;
|
|
95
95
|
subtitle?: string;
|
|
96
|
-
description?: string
|
|
96
|
+
description?: string | Array<string>;
|
|
97
97
|
button: ButtonProps;
|
|
98
98
|
secondaryButton?: ButtonProps;
|
|
99
99
|
buttonLink?: ButtonProps & {
|