@telefonica/mistica 16.0.0 → 16.1.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.
- package/README.md +11 -9
- package/css/mistica.css +1 -1
- package/dist/box.d.ts +1 -0
- package/dist/box.js +12 -12
- package/dist/card.d.ts +14 -2
- package/dist/card.js +210 -206
- package/dist/credit-card-expiration-field.d.ts +1 -1
- package/dist/credit-card-expiration-field.js +53 -52
- package/dist/credit-card-number-field.d.ts +1 -1
- package/dist/credit-card-number-field.js +47 -45
- package/dist/cvv-field.d.ts +1 -1
- package/dist/cvv-field.js +38 -37
- package/dist/date-field.d.ts +1 -1
- package/dist/date-field.js +15 -13
- package/dist/date-time-field.d.ts +1 -1
- package/dist/date-time-field.js +13 -11
- package/dist/decimal-field.d.ts +1 -1
- package/dist/decimal-field.js +39 -38
- package/dist/email-field.d.ts +1 -1
- package/dist/email-field.js +21 -19
- package/dist/form-context.d.ts +7 -2
- package/dist/form-context.js +69 -62
- package/dist/form.d.ts +2 -1
- package/dist/form.js +94 -80
- package/dist/iban-field.d.ts +1 -1
- package/dist/iban-field.js +32 -30
- package/dist/index.d.ts +12 -3
- package/dist/index.js +19 -8
- package/dist/inline.d.ts +2 -1
- package/dist/inline.js +16 -15
- package/dist/integer-field.d.ts +1 -1
- package/dist/integer-field.js +30 -30
- package/dist/month-field.d.ts +1 -1
- package/dist/month-field.js +15 -13
- package/dist/package-version.js +1 -1
- package/dist/password-field.d.ts +1 -1
- package/dist/password-field.js +24 -22
- package/dist/phone-number-field.d.ts +1 -1
- package/dist/phone-number-field.js +42 -40
- package/dist/pin-field.js +21 -20
- package/dist/radio-button.d.ts +1 -0
- package/dist/radio-button.js +42 -41
- package/dist/rating.css-mistica.js +44 -0
- package/dist/rating.css.d.ts +11 -0
- package/dist/rating.css.ts.vanilla.css-mistica.js +11 -0
- package/dist/rating.d.ts +37 -0
- package/dist/rating.js +320 -0
- package/dist/search-field.d.ts +1 -0
- package/dist/search-field.js +18 -16
- package/dist/select.js +36 -33
- package/dist/sheet-action-row.css-mistica.js +13 -0
- package/dist/sheet-action-row.css.d.ts +1 -0
- package/dist/sheet-actions-list.d.ts +26 -0
- package/dist/sheet-actions-list.js +147 -0
- package/dist/sheet-actions.d.ts +23 -0
- package/dist/sheet-actions.js +175 -0
- package/dist/{sheet.css-mistica.js → sheet-common.css-mistica.js} +15 -21
- package/dist/{sheet.css.d.ts → sheet-common.css.d.ts} +0 -2
- package/dist/sheet-common.css.ts.vanilla.css-mistica.js +11 -0
- package/dist/sheet-common.d.ts +24 -0
- package/dist/sheet-common.js +429 -0
- package/dist/sheet-info.css-mistica.js +12 -0
- package/dist/sheet-info.css.d.ts +1 -0
- package/dist/sheet-info.d.ts +28 -0
- package/dist/sheet-info.js +156 -0
- package/dist/sheet-native.d.ts +2 -0
- package/dist/sheet-native.js +173 -0
- package/dist/sheet-radio-list.d.ts +22 -0
- package/dist/sheet-radio-list.js +143 -0
- package/dist/sheet-root.d.ts +4 -85
- package/dist/sheet-root.js +48 -322
- package/dist/sheet-types.d.ts +88 -0
- package/dist/sheet-web.d.ts +8 -0
- package/dist/sheet-web.js +183 -0
- package/dist/slider.js +40 -39
- package/dist/switch-component.js +18 -17
- package/dist/text-field-base.d.ts +2 -0
- package/dist/text-field-base.js +74 -66
- package/dist/text-field-components.css-mistica.js +14 -14
- package/dist/text-field-components.css.d.ts +2 -2
- package/dist/text-field-components.js +49 -39
- package/dist/text-field.d.ts +1 -0
- package/dist/text-field.js +24 -22
- package/dist/text-tokens.d.ts +14 -0
- package/dist/text-tokens.js +145 -89
- package/dist/theme-context-provider.js +6 -5
- package/dist/theme.d.ts +2 -0
- package/dist/utils/credit-card.d.ts +2 -2
- package/dist/utils/credit-card.js +1 -1
- package/dist/vivinho-loading-animation/in-lottie.json.js +544 -612
- package/dist/vivinho-loading-animation/out-lottie.json.js +828 -896
- package/dist/vivinho-loading-animation/pulse-lottie.json.js +798 -866
- package/dist/vivinho-loading-animation/wave-lottie.json.js +4303 -4409
- package/dist-es/box.js +18 -18
- package/dist-es/card.js +305 -301
- package/dist-es/credit-card-expiration-field.js +57 -56
- package/dist-es/credit-card-number-field.js +74 -72
- package/dist-es/cvv-field.js +82 -81
- package/dist-es/date-field.js +29 -27
- package/dist-es/date-time-field.js +29 -27
- package/dist-es/decimal-field.js +46 -45
- package/dist-es/email-field.js +26 -24
- package/dist-es/form-context.js +70 -63
- package/dist-es/form.js +102 -88
- package/dist-es/iban-field.js +35 -33
- package/dist-es/index.js +1822 -1817
- package/dist-es/inline.js +26 -25
- package/dist-es/integer-field.js +31 -31
- package/dist-es/month-field.js +28 -26
- package/dist-es/package-version.js +1 -1
- package/dist-es/password-field.js +37 -35
- package/dist-es/phone-number-field.js +51 -49
- package/dist-es/pin-field.js +32 -31
- package/dist-es/radio-button.js +42 -41
- package/dist-es/rating.css-mistica.js +6 -0
- package/dist-es/rating.css.ts.vanilla.css-mistica.js +2 -0
- package/dist-es/rating.js +257 -0
- package/dist-es/search-field.js +33 -31
- package/dist-es/select.js +49 -46
- package/dist-es/sheet-action-row.css-mistica.js +4 -0
- package/dist-es/sheet-actions-list.js +92 -0
- package/dist-es/sheet-actions.js +125 -0
- package/dist-es/sheet-common.css-mistica.js +4 -0
- package/dist-es/sheet-common.css.ts.vanilla.css-mistica.js +2 -0
- package/dist-es/sheet-common.js +366 -0
- package/dist-es/sheet-info.css-mistica.js +3 -0
- package/dist-es/sheet-info.js +101 -0
- package/dist-es/sheet-native.js +164 -0
- package/dist-es/sheet-radio-list.js +88 -0
- package/dist-es/sheet-root.js +50 -319
- package/dist-es/sheet-web.js +128 -0
- package/dist-es/slider.js +49 -48
- package/dist-es/style.css +1 -1
- package/dist-es/switch-component.js +27 -26
- package/dist-es/text-field-base.js +108 -100
- package/dist-es/text-field-components.css-mistica.js +2 -2
- package/dist-es/text-field-components.js +70 -60
- package/dist-es/text-field.js +33 -31
- package/dist-es/text-tokens.js +80 -45
- package/dist-es/theme-context-provider.js +20 -19
- package/dist-es/utils/credit-card.js +1 -1
- package/dist-es/vivinho-loading-animation/in-lottie.json.js +534 -599
- package/dist-es/vivinho-loading-animation/out-lottie.json.js +821 -886
- package/dist-es/vivinho-loading-animation/pulse-lottie.json.js +790 -855
- package/dist-es/vivinho-loading-animation/wave-lottie.json.js +4297 -4400
- package/package.json +4 -3
- package/dist/sheet.d.ts +0 -107
- package/dist/sheet.js +0 -642
- package/dist-es/sheet.css-mistica.js +0 -4
- package/dist-es/sheet.js +0 -567
- /package/dist/{sheet.css.ts.vanilla.css-mistica.js → sheet-action-row.css.ts.vanilla.css-mistica.js} +0 -0
- /package/dist-es/{sheet.css.ts.vanilla.css-mistica.js → sheet-action-row.css.ts.vanilla.css-mistica.js} +0 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
function _define_property(obj, key, value) {
|
|
3
|
+
if (key in obj) {
|
|
4
|
+
Object.defineProperty(obj, key, {
|
|
5
|
+
value: value,
|
|
6
|
+
enumerable: true,
|
|
7
|
+
configurable: true,
|
|
8
|
+
writable: true
|
|
9
|
+
});
|
|
10
|
+
} else {
|
|
11
|
+
obj[key] = value;
|
|
12
|
+
}
|
|
13
|
+
return obj;
|
|
14
|
+
}
|
|
15
|
+
function _object_spread(target) {
|
|
16
|
+
for(var i = 1; i < arguments.length; i++){
|
|
17
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
18
|
+
var ownKeys = Object.keys(source);
|
|
19
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
20
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
21
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
ownKeys.forEach(function(key) {
|
|
25
|
+
_define_property(target, key, source[key]);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return target;
|
|
29
|
+
}
|
|
30
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
31
|
+
import * as s from "react";
|
|
32
|
+
import w, { SheetBody as y } from "./sheet-common.js";
|
|
33
|
+
import { useScreenSize as C, useTheme as I } from "./hooks.js";
|
|
34
|
+
import v from "./negative-box.js";
|
|
35
|
+
import { ButtonPrimary as P } from "./button.js";
|
|
36
|
+
import { RadioGroup as j } from "./radio-button.js";
|
|
37
|
+
import { RowList as k, Row as z } from "./list.js";
|
|
38
|
+
import { sheetConfirmButton as A } from "./text-tokens.js";
|
|
39
|
+
const D = /*#__PURE__*/ s.forwardRef((param, l)=>{
|
|
40
|
+
let { title: f, subtitle: h, description: p, items: u, selectedId: c, onClose: R, onSelect: r, button: i, dataAttributes: B } = param;
|
|
41
|
+
const [o, x] = s.useState(c), a = s.useRef(!1), { isDesktopOrBigger: m } = C(), { texts: g, t: L } = I();
|
|
42
|
+
return /* @__PURE__ */ t(w, {
|
|
43
|
+
onClose: R,
|
|
44
|
+
ref: l,
|
|
45
|
+
dataAttributes: _object_spread({
|
|
46
|
+
"component-name": "RadioListSheet"
|
|
47
|
+
}, B),
|
|
48
|
+
children: (param)=>{
|
|
49
|
+
let { closeModal: d, modalTitleId: n } = param;
|
|
50
|
+
return /* @__PURE__ */ t(y, {
|
|
51
|
+
title: f,
|
|
52
|
+
subtitle: h,
|
|
53
|
+
description: p,
|
|
54
|
+
modalTitleId: n,
|
|
55
|
+
button: m ? /* @__PURE__ */ t(P, {
|
|
56
|
+
onPress: ()=>{
|
|
57
|
+
a.current && (r == null || r(o || "")), d();
|
|
58
|
+
},
|
|
59
|
+
children: (i == null ? void 0 : i.text) || g.sheetConfirmButton || L(A)
|
|
60
|
+
}) : void 0,
|
|
61
|
+
children: /* @__PURE__ */ t(v, {
|
|
62
|
+
children: /* @__PURE__ */ t(j, {
|
|
63
|
+
"aria-labelledby": n,
|
|
64
|
+
name: "sheetselection",
|
|
65
|
+
value: o,
|
|
66
|
+
onChange: (e)=>{
|
|
67
|
+
x(e), a.current = !0, !m && (r == null || r(e), setTimeout(()=>{
|
|
68
|
+
d();
|
|
69
|
+
}, 200));
|
|
70
|
+
},
|
|
71
|
+
children: /* @__PURE__ */ t(k, {
|
|
72
|
+
children: u.map((e)=>/* @__PURE__ */ {
|
|
73
|
+
var _e_title;
|
|
74
|
+
return t(z, {
|
|
75
|
+
title: (_e_title = e.title) !== null && _e_title !== void 0 ? _e_title : "",
|
|
76
|
+
description: e.description,
|
|
77
|
+
asset: e.asset,
|
|
78
|
+
radioValue: e.id
|
|
79
|
+
}, e.id);
|
|
80
|
+
})
|
|
81
|
+
})
|
|
82
|
+
})
|
|
83
|
+
})
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}), q = D;
|
|
88
|
+
export { q as default };
|
package/dist-es/sheet-root.js
CHANGED
|
@@ -1,324 +1,55 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return function() {
|
|
18
|
-
var self = this, args = arguments;
|
|
19
|
-
return new Promise(function(resolve, reject) {
|
|
20
|
-
var gen = fn.apply(self, args);
|
|
21
|
-
function _next(value) {
|
|
22
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
23
|
-
}
|
|
24
|
-
function _throw(err) {
|
|
25
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
26
|
-
}
|
|
27
|
-
_next(undefined);
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
function _define_property(obj, key, value) {
|
|
32
|
-
if (key in obj) {
|
|
33
|
-
Object.defineProperty(obj, key, {
|
|
34
|
-
value: value,
|
|
35
|
-
enumerable: true,
|
|
36
|
-
configurable: true,
|
|
37
|
-
writable: true
|
|
38
|
-
});
|
|
39
|
-
} else {
|
|
40
|
-
obj[key] = value;
|
|
41
|
-
}
|
|
42
|
-
return obj;
|
|
43
|
-
}
|
|
44
|
-
function _object_spread(target) {
|
|
45
|
-
for(var i = 1; i < arguments.length; i++){
|
|
46
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
47
|
-
var ownKeys = Object.keys(source);
|
|
48
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
49
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
50
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
51
|
-
}));
|
|
52
|
-
}
|
|
53
|
-
ownKeys.forEach(function(key) {
|
|
54
|
-
_define_property(target, key, source[key]);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
return target;
|
|
58
|
-
}
|
|
59
|
-
function ownKeys(object, enumerableOnly) {
|
|
60
|
-
var keys = Object.keys(object);
|
|
61
|
-
if (Object.getOwnPropertySymbols) {
|
|
62
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
63
|
-
if (enumerableOnly) {
|
|
64
|
-
symbols = symbols.filter(function(sym) {
|
|
65
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
keys.push.apply(keys, symbols);
|
|
69
|
-
}
|
|
70
|
-
return keys;
|
|
71
|
-
}
|
|
72
|
-
function _object_spread_props(target, source) {
|
|
73
|
-
source = source != null ? source : {};
|
|
74
|
-
if (Object.getOwnPropertyDescriptors) {
|
|
75
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
76
|
-
} else {
|
|
77
|
-
ownKeys(Object(source)).forEach(function(key) {
|
|
78
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
return target;
|
|
82
|
-
}
|
|
83
|
-
import { jsx as u } from "react/jsx-runtime";
|
|
84
|
-
import * as S from "react";
|
|
85
|
-
import { ActionsSheet as w, RadioListSheet as y, ActionsListSheet as N, InfoSheet as A } from "./sheet.js";
|
|
86
|
-
import O from "./image.js";
|
|
87
|
-
import { useTheme as m } from "./hooks.js";
|
|
88
|
-
let p = null, n = null, l = null;
|
|
89
|
-
const d = (r)=>Array.isArray(r) ? r.length ? r.join(`
|
|
90
|
-
|
|
91
|
-
`) : void 0 : r, L = (param)=>{
|
|
92
|
-
let { title: r, subtitle: c, description: e, selectedId: s, items: t } = param;
|
|
93
|
-
return l({
|
|
94
|
-
title: r,
|
|
95
|
-
subtitle: c,
|
|
96
|
-
// TODO: add multiline support to native sheet
|
|
97
|
-
description: d(e),
|
|
98
|
-
content: [
|
|
99
|
-
{
|
|
100
|
-
type: "LIST",
|
|
101
|
-
id: "list-0",
|
|
102
|
-
listType: "SINGLE_SELECTION",
|
|
103
|
-
autoSubmit: !0,
|
|
104
|
-
selectedIds: typeof s == "string" ? [
|
|
105
|
-
s
|
|
106
|
-
] : [],
|
|
107
|
-
items: t
|
|
108
|
-
}
|
|
109
|
-
]
|
|
110
|
-
}).then((param)=>{
|
|
111
|
-
let { action: o, result: a } = param;
|
|
112
|
-
return o === "SUBMIT" ? {
|
|
113
|
-
action: o,
|
|
114
|
-
selectedId: a[0].selectedIds[0]
|
|
115
|
-
} : {
|
|
116
|
-
action: o,
|
|
117
|
-
selectedId: null
|
|
118
|
-
};
|
|
119
|
-
});
|
|
120
|
-
}, k = (param)=>{
|
|
121
|
-
let { title: r, subtitle: c, description: e, items: s } = param;
|
|
122
|
-
return l({
|
|
123
|
-
title: r,
|
|
124
|
-
subtitle: c,
|
|
125
|
-
// TODO: add multiline support to native sheet
|
|
126
|
-
description: d(e),
|
|
127
|
-
content: [
|
|
128
|
-
{
|
|
129
|
-
type: "LIST",
|
|
130
|
-
id: "list-0",
|
|
131
|
-
listType: "ACTIONS",
|
|
132
|
-
autoSubmit: !0,
|
|
133
|
-
selectedIds: [],
|
|
134
|
-
items: s
|
|
135
|
-
}
|
|
136
|
-
]
|
|
137
|
-
}).then((param)=>{
|
|
138
|
-
let { action: t, result: o } = param;
|
|
139
|
-
return t === "SUBMIT" ? {
|
|
140
|
-
action: t,
|
|
141
|
-
selectedId: o[0].selectedIds[0]
|
|
142
|
-
} : {
|
|
143
|
-
action: t,
|
|
144
|
-
selectedId: null
|
|
145
|
-
};
|
|
146
|
-
});
|
|
147
|
-
}, b = function() {
|
|
148
|
-
var _ref = _async_to_generator(function*(param) {
|
|
149
|
-
let { title: r, subtitle: c, description: e, items: s } = param;
|
|
150
|
-
yield l({
|
|
151
|
-
title: r,
|
|
152
|
-
subtitle: c,
|
|
153
|
-
// TODO: add multiline support to native sheet
|
|
154
|
-
description: d(e),
|
|
155
|
-
content: [
|
|
156
|
-
{
|
|
157
|
-
type: "LIST",
|
|
158
|
-
id: "list-0",
|
|
159
|
-
listType: "INFORMATIVE",
|
|
160
|
-
autoSubmit: !1,
|
|
161
|
-
selectedIds: [],
|
|
162
|
-
items: s
|
|
163
|
-
}
|
|
164
|
-
]
|
|
165
|
-
});
|
|
166
|
-
});
|
|
167
|
-
return function b(_) {
|
|
168
|
-
return _ref.apply(this, arguments);
|
|
169
|
-
};
|
|
170
|
-
}(), C = function() {
|
|
171
|
-
var _ref = _async_to_generator(function*(param) {
|
|
172
|
-
let { title: r, subtitle: c, description: e, button: s, secondaryButton: t, link: o } = param;
|
|
173
|
-
return l({
|
|
174
|
-
title: r,
|
|
175
|
-
subtitle: c,
|
|
176
|
-
// TODO: add multiline support to native sheet
|
|
177
|
-
description: d(e),
|
|
178
|
-
content: [
|
|
179
|
-
{
|
|
180
|
-
type: "BOTTOM_ACTIONS",
|
|
181
|
-
id: "bottom-actions-0",
|
|
182
|
-
button: s,
|
|
183
|
-
secondaryButton: t,
|
|
184
|
-
link: o
|
|
185
|
-
}
|
|
186
|
-
]
|
|
187
|
-
}).then((param)=>{
|
|
188
|
-
let { action: a, result: i } = param;
|
|
189
|
-
if (a === "SUBMIT") {
|
|
190
|
-
const f = i.find((param)=>{
|
|
191
|
-
let { id: T } = param;
|
|
192
|
-
return T === "bottom-actions-0";
|
|
193
|
-
}), I = f == null ? void 0 : f.selectedIds[0];
|
|
194
|
-
if (I === "PRIMARY" || I === "SECONDARY" || I === "LINK") return {
|
|
195
|
-
action: I
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
return {
|
|
199
|
-
action: "DISMISS"
|
|
200
|
-
};
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
return function C(_) {
|
|
204
|
-
return _ref.apply(this, arguments);
|
|
205
|
-
};
|
|
206
|
-
}();
|
|
207
|
-
let h = !1;
|
|
208
|
-
const B = (r)=>{
|
|
209
|
-
const c = ()=>{
|
|
210
|
-
if (!p) return Promise.reject(new Error("Tried to show a Sheet but the SheetRoot component was not mounted"));
|
|
211
|
-
if (h) return Promise.reject(new Error("Tried to show a Sheet but there is already one open"));
|
|
212
|
-
h = !0, p(r);
|
|
213
|
-
const e = new Promise((s)=>{
|
|
214
|
-
n = s;
|
|
215
|
-
});
|
|
216
|
-
return e.finally(()=>{
|
|
217
|
-
h = !1;
|
|
218
|
-
}), e;
|
|
2
|
+
import { jsxs as m, Fragment as c, jsx as a } from "react/jsx-runtime";
|
|
3
|
+
import * as r from "react";
|
|
4
|
+
const h = /*#__PURE__*/ r.lazy(()=>import(/* webpackChunkName: "sheet-web" */ "./sheet-web.js"));
|
|
5
|
+
let i = null, s = null, l = null, u = !1;
|
|
6
|
+
const p = (t)=>{
|
|
7
|
+
const o = ()=>{
|
|
8
|
+
if (!s) return Promise.reject(new Error("Tried to show a Sheet but the SheetRoot component was not mounted"));
|
|
9
|
+
if (u) return Promise.reject(new Error("Tried to show a Sheet but there is already one open"));
|
|
10
|
+
u = !0, s(t);
|
|
11
|
+
const n = new Promise((e)=>{
|
|
12
|
+
l = e;
|
|
13
|
+
});
|
|
14
|
+
return n.finally(()=>{
|
|
15
|
+
u = !1;
|
|
16
|
+
}), n;
|
|
219
17
|
};
|
|
220
|
-
if (
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
break;
|
|
236
|
-
default:
|
|
237
|
-
const o = s;
|
|
238
|
-
throw new Error(`Unknown sheet type: ${o}`);
|
|
239
|
-
}
|
|
240
|
-
return e.catch((o)=>{
|
|
241
|
-
if (o.code === "400") return c();
|
|
242
|
-
throw o;
|
|
243
|
-
});
|
|
244
|
-
} else return c();
|
|
245
|
-
}, M = (r)=>{
|
|
246
|
-
const { isDarkMode: c } = m(), [e, s] = S.useState(null), t = S.useRef(null);
|
|
247
|
-
if (S.useEffect(()=>{
|
|
248
|
-
if (r.nativeImplementation) return l = r.nativeImplementation, ()=>{
|
|
249
|
-
l = null;
|
|
18
|
+
if (i) {
|
|
19
|
+
const n = i;
|
|
20
|
+
return import(/* webpackChunkName: "sheet-native" */ "./sheet-native.js").then((param)=>{
|
|
21
|
+
let { showNativeSheet: e } = param;
|
|
22
|
+
return e(n, t);
|
|
23
|
+
}).catch((e)=>{
|
|
24
|
+
if (e.code === "400") return o();
|
|
25
|
+
throw e;
|
|
26
|
+
});
|
|
27
|
+
} else return o();
|
|
28
|
+
}, f = (t)=>{
|
|
29
|
+
const [o, n] = r.useState(null);
|
|
30
|
+
return r.useEffect(()=>{
|
|
31
|
+
if (t.nativeImplementation) return i = t.nativeImplementation, ()=>{
|
|
32
|
+
i = null;
|
|
250
33
|
};
|
|
251
34
|
}, [
|
|
252
|
-
|
|
253
|
-
]),
|
|
254
|
-
|
|
35
|
+
t.nativeImplementation
|
|
36
|
+
]), r.useEffect(()=>(s = (e)=>{
|
|
37
|
+
n(e);
|
|
255
38
|
}, ()=>{
|
|
256
|
-
|
|
257
|
-
}), []),
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
})
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
action: "SUBMIT",
|
|
274
|
-
selectedId: t.current
|
|
275
|
-
}) : n == null || n({
|
|
276
|
-
action: "DISMISS"
|
|
277
|
-
});
|
|
278
|
-
break;
|
|
279
|
-
case "ACTIONS":
|
|
280
|
-
t.current === "PRIMARY" || t.current === "SECONDARY" || t.current === "LINK" ? n == null || n({
|
|
281
|
-
action: t.current
|
|
282
|
-
}) : n == null || n({
|
|
283
|
-
action: "DISMISS"
|
|
284
|
-
});
|
|
285
|
-
break;
|
|
286
|
-
default:
|
|
287
|
-
throw new Error(`Unknown sheet type: ${e.type}`);
|
|
288
|
-
}
|
|
289
|
-
}, a = (i)=>{
|
|
290
|
-
t.current = i;
|
|
291
|
-
};
|
|
292
|
-
switch(e.type){
|
|
293
|
-
case "INFO":
|
|
294
|
-
return /* @__PURE__ */ u(A, _object_spread_props(_object_spread({}, e.props), {
|
|
295
|
-
onClose: o
|
|
296
|
-
}));
|
|
297
|
-
case "ACTIONS_LIST":
|
|
298
|
-
return /* @__PURE__ */ u(N, _object_spread_props(_object_spread({}, e.props), {
|
|
299
|
-
onClose: o,
|
|
300
|
-
onSelect: a
|
|
301
|
-
}));
|
|
302
|
-
case "RADIO_LIST":
|
|
303
|
-
return /* @__PURE__ */ u(y, _object_spread_props(_object_spread({}, e.props), {
|
|
304
|
-
items: e.props.items.map((i)=>_object_spread_props(_object_spread({}, i), {
|
|
305
|
-
asset: i.icon && /* @__PURE__ */ u(O, {
|
|
306
|
-
circular: !0,
|
|
307
|
-
src: c && i.icon.urlDark ? i.icon.urlDark : i.icon.url,
|
|
308
|
-
width: i.icon.size === "small" ? 24 : 40
|
|
309
|
-
})
|
|
310
|
-
})),
|
|
311
|
-
onClose: o,
|
|
312
|
-
onSelect: a
|
|
313
|
-
}));
|
|
314
|
-
case "ACTIONS":
|
|
315
|
-
return /* @__PURE__ */ u(w, _object_spread_props(_object_spread({}, e.props), {
|
|
316
|
-
buttonLink: e.props.link,
|
|
317
|
-
onClose: o,
|
|
318
|
-
onPressButton: a
|
|
319
|
-
}));
|
|
320
|
-
default:
|
|
321
|
-
throw new Error(`Unknown sheet type: ${e.type}`);
|
|
322
|
-
}
|
|
323
|
-
}, F = M;
|
|
324
|
-
export { M as SheetRoot, F as default, B as showSheet };
|
|
39
|
+
s = null;
|
|
40
|
+
}), []), /* @__PURE__ */ m(c, {
|
|
41
|
+
children: [
|
|
42
|
+
t.children,
|
|
43
|
+
o && /* @__PURE__ */ a(r.Suspense, {
|
|
44
|
+
fallback: null,
|
|
45
|
+
children: /* @__PURE__ */ a(h, {
|
|
46
|
+
sheetProps: o,
|
|
47
|
+
onResolve: (e)=>{
|
|
48
|
+
n(null), l == null || l(e);
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
})
|
|
52
|
+
]
|
|
53
|
+
});
|
|
54
|
+
}, d = f;
|
|
55
|
+
export { f as SheetRoot, d as default, p as showSheet };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
function _define_property(obj, key, value) {
|
|
3
|
+
if (key in obj) {
|
|
4
|
+
Object.defineProperty(obj, key, {
|
|
5
|
+
value: value,
|
|
6
|
+
enumerable: true,
|
|
7
|
+
configurable: true,
|
|
8
|
+
writable: true
|
|
9
|
+
});
|
|
10
|
+
} else {
|
|
11
|
+
obj[key] = value;
|
|
12
|
+
}
|
|
13
|
+
return obj;
|
|
14
|
+
}
|
|
15
|
+
function _object_spread(target) {
|
|
16
|
+
for(var i = 1; i < arguments.length; i++){
|
|
17
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
18
|
+
var ownKeys = Object.keys(source);
|
|
19
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
20
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
21
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
ownKeys.forEach(function(key) {
|
|
25
|
+
_define_property(target, key, source[key]);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return target;
|
|
29
|
+
}
|
|
30
|
+
function ownKeys(object, enumerableOnly) {
|
|
31
|
+
var keys = Object.keys(object);
|
|
32
|
+
if (Object.getOwnPropertySymbols) {
|
|
33
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
34
|
+
if (enumerableOnly) {
|
|
35
|
+
symbols = symbols.filter(function(sym) {
|
|
36
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
keys.push.apply(keys, symbols);
|
|
40
|
+
}
|
|
41
|
+
return keys;
|
|
42
|
+
}
|
|
43
|
+
function _object_spread_props(target, source) {
|
|
44
|
+
source = source != null ? source : {};
|
|
45
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
46
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
47
|
+
} else {
|
|
48
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
49
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return target;
|
|
53
|
+
}
|
|
54
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
55
|
+
import * as o from "react";
|
|
56
|
+
import { useTheme as l } from "./hooks.js";
|
|
57
|
+
import u from "./image.js";
|
|
58
|
+
const S = /*#__PURE__*/ o.lazy(()=>import(/* webpackChunkName: "sheet-actions" */ "./sheet-actions.js")), I = /*#__PURE__*/ o.lazy(()=>import(/* webpackChunkName: "sheet-info" */ "./sheet-info.js")), p = /*#__PURE__*/ o.lazy(()=>import(/* webpackChunkName: "sheet-action-list" */ "./sheet-actions-list.js")), d = /*#__PURE__*/ o.lazy(()=>import(/* webpackChunkName: "sheet-radio-list" */ "./sheet-radio-list.js")), w = (param)=>{
|
|
59
|
+
let { sheetProps: t, onResolve: e } = param;
|
|
60
|
+
const { isDarkMode: s } = l(), r = o.useRef(null), i = (n)=>{
|
|
61
|
+
r.current = n;
|
|
62
|
+
}, a = ()=>{
|
|
63
|
+
if (!e) throw new Error("onResolve handler is not set");
|
|
64
|
+
switch(t.type){
|
|
65
|
+
case "INFO":
|
|
66
|
+
e(void 0);
|
|
67
|
+
break;
|
|
68
|
+
case "ACTIONS_LIST":
|
|
69
|
+
r.current ? e({
|
|
70
|
+
action: "SUBMIT",
|
|
71
|
+
selectedId: r.current
|
|
72
|
+
}) : e({
|
|
73
|
+
action: "DISMISS"
|
|
74
|
+
});
|
|
75
|
+
break;
|
|
76
|
+
case "RADIO_LIST":
|
|
77
|
+
r.current ? e({
|
|
78
|
+
action: "SUBMIT",
|
|
79
|
+
selectedId: r.current
|
|
80
|
+
}) : e({
|
|
81
|
+
action: "DISMISS"
|
|
82
|
+
});
|
|
83
|
+
break;
|
|
84
|
+
case "ACTIONS":
|
|
85
|
+
r.current === "PRIMARY" || r.current === "SECONDARY" || r.current === "LINK" ? e({
|
|
86
|
+
action: r.current
|
|
87
|
+
}) : e({
|
|
88
|
+
action: "DISMISS"
|
|
89
|
+
});
|
|
90
|
+
break;
|
|
91
|
+
default:
|
|
92
|
+
throw new Error(`Unknown sheet type: ${t.type}`);
|
|
93
|
+
}
|
|
94
|
+
r.current = null;
|
|
95
|
+
};
|
|
96
|
+
switch(t.type){
|
|
97
|
+
case "INFO":
|
|
98
|
+
return /* @__PURE__ */ c(I, _object_spread_props(_object_spread({}, t.props), {
|
|
99
|
+
onClose: a
|
|
100
|
+
}));
|
|
101
|
+
case "ACTIONS_LIST":
|
|
102
|
+
return /* @__PURE__ */ c(p, _object_spread_props(_object_spread({}, t.props), {
|
|
103
|
+
onClose: a,
|
|
104
|
+
onSelect: i
|
|
105
|
+
}));
|
|
106
|
+
case "RADIO_LIST":
|
|
107
|
+
return /* @__PURE__ */ c(d, _object_spread_props(_object_spread({}, t.props), {
|
|
108
|
+
items: t.props.items.map((n)=>_object_spread_props(_object_spread({}, n), {
|
|
109
|
+
asset: n.icon && /* @__PURE__ */ c(u, {
|
|
110
|
+
circular: !0,
|
|
111
|
+
src: s && n.icon.urlDark ? n.icon.urlDark : n.icon.url,
|
|
112
|
+
width: n.icon.size === "small" ? 24 : 40
|
|
113
|
+
})
|
|
114
|
+
})),
|
|
115
|
+
onClose: a,
|
|
116
|
+
onSelect: i
|
|
117
|
+
}));
|
|
118
|
+
case "ACTIONS":
|
|
119
|
+
return /* @__PURE__ */ c(S, _object_spread_props(_object_spread({}, t.props), {
|
|
120
|
+
buttonLink: t.props.link,
|
|
121
|
+
onClose: a,
|
|
122
|
+
onPressButton: i
|
|
123
|
+
}));
|
|
124
|
+
default:
|
|
125
|
+
throw new Error(`Unknown sheet type: ${t.type}`);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
export { w as default };
|