@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/css/mistica.css +1 -1
- package/dist/header.js +24 -24
- package/dist/icons/icon-success-vivo-new.js +3 -3
- 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/snackbar.js +64 -61
- package/dist-es/header.js +24 -24
- package/dist-es/icons/icon-success-vivo-new.js +3 -3
- 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/snackbar.js +70 -67
- package/dist-es/style.css +1 -1
- package/package.json +1 -1
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:
|
|
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
|
-
(
|
|
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:
|
|
127
|
+
children: e
|
|
128
128
|
}) : /* @__PURE__ */ r(P, {
|
|
129
129
|
as: "h2",
|
|
130
|
-
children:
|
|
131
|
-
}),
|
|
132
|
-
|
|
130
|
+
children: e
|
|
131
|
+
})),
|
|
132
|
+
o && (m ? /* @__PURE__ */ r(B, {
|
|
133
133
|
regular: !0,
|
|
134
134
|
color: c.colors.textSecondary,
|
|
135
|
-
children:
|
|
135
|
+
children: o
|
|
136
136
|
}) : /* @__PURE__ */ r(x, {
|
|
137
137
|
regular: !0,
|
|
138
138
|
color: c.colors.textSecondary,
|
|
139
|
-
children:
|
|
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:
|
|
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
|
-
|
|
185
|
-
children:
|
|
184
|
+
e && /* @__PURE__ */ r(M, {
|
|
185
|
+
children: e
|
|
186
186
|
})
|
|
187
187
|
]
|
|
188
188
|
}),
|
|
189
|
-
|
|
189
|
+
o
|
|
190
190
|
]
|
|
191
191
|
});
|
|
192
192
|
}, Y = (param)=>{
|
|
193
|
-
let { isInverse: t = !0 , breadcrumbs:
|
|
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
|
-
|
|
196
|
+
e && /* @__PURE__ */ r("div", {
|
|
197
197
|
className: G,
|
|
198
|
-
children:
|
|
198
|
+
children: e
|
|
199
199
|
}),
|
|
200
|
-
|
|
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:
|
|
214
|
-
desktop:
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
-
},
|
|
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:
|
|
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: "
|
|
44
|
+
r: "31",
|
|
45
45
|
stroke: `url(#${t})`
|
|
46
|
-
}, c("
|
|
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: "
|
|
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.
|
|
1
|
+
const o = "14.24.0";
|
|
2
2
|
export { o as PACKAGE_VERSION };
|
package/dist-es/sheet-root.js
CHANGED
|
@@ -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
|
|
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
|
|
86
|
+
import { useTheme as m } from "./hooks.js";
|
|
87
87
|
let p = null, n = null, l = null;
|
|
88
|
-
const
|
|
89
|
-
|
|
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:
|
|
93
|
+
title: r,
|
|
92
94
|
subtitle: c,
|
|
93
|
-
|
|
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
|
|
101
|
-
|
|
103
|
+
selectedIds: typeof s == "string" ? [
|
|
104
|
+
s
|
|
102
105
|
] : [],
|
|
103
106
|
items: t
|
|
104
107
|
}
|
|
105
108
|
]
|
|
106
109
|
}).then((param)=>{
|
|
107
|
-
let { action:
|
|
108
|
-
return
|
|
109
|
-
action:
|
|
110
|
-
selectedId:
|
|
110
|
+
let { action: o , result: a } = param;
|
|
111
|
+
return o === "SUBMIT" ? {
|
|
112
|
+
action: o,
|
|
113
|
+
selectedId: a[0].selectedIds[0]
|
|
111
114
|
} : {
|
|
112
|
-
action:
|
|
115
|
+
action: o,
|
|
113
116
|
selectedId: null
|
|
114
117
|
};
|
|
115
118
|
});
|
|
116
|
-
},
|
|
117
|
-
let { title:
|
|
119
|
+
}, k = (param)=>{
|
|
120
|
+
let { title: r , subtitle: c , description: e , items: s } = param;
|
|
118
121
|
return l({
|
|
119
|
-
title:
|
|
122
|
+
title: r,
|
|
120
123
|
subtitle: c,
|
|
121
|
-
|
|
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:
|
|
133
|
+
items: s
|
|
130
134
|
}
|
|
131
135
|
]
|
|
132
136
|
}).then((param)=>{
|
|
133
|
-
let { action: t , result:
|
|
137
|
+
let { action: t , result: o } = param;
|
|
134
138
|
return t === "SUBMIT" ? {
|
|
135
139
|
action: t,
|
|
136
|
-
selectedId:
|
|
140
|
+
selectedId: o[0].selectedIds[0]
|
|
137
141
|
} : {
|
|
138
142
|
action: t,
|
|
139
143
|
selectedId: null
|
|
140
144
|
};
|
|
141
145
|
});
|
|
142
|
-
},
|
|
146
|
+
}, b = function() {
|
|
143
147
|
var _ref = _async_to_generator(function*(param) {
|
|
144
|
-
let { title:
|
|
148
|
+
let { title: r , subtitle: c , description: e , items: s } = param;
|
|
145
149
|
yield l({
|
|
146
|
-
title:
|
|
150
|
+
title: r,
|
|
147
151
|
subtitle: c,
|
|
148
|
-
|
|
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:
|
|
161
|
+
items: s
|
|
157
162
|
}
|
|
158
163
|
]
|
|
159
164
|
});
|
|
160
165
|
});
|
|
161
|
-
return function
|
|
166
|
+
return function b(_) {
|
|
162
167
|
return _ref.apply(this, arguments);
|
|
163
168
|
};
|
|
164
|
-
}(),
|
|
169
|
+
}(), C = function() {
|
|
165
170
|
var _ref = _async_to_generator(function*(param) {
|
|
166
|
-
let { title:
|
|
171
|
+
let { title: r , subtitle: c , description: e , button: s , secondaryButton: t , link: o } = param;
|
|
167
172
|
return l({
|
|
168
|
-
title:
|
|
173
|
+
title: r,
|
|
169
174
|
subtitle: c,
|
|
170
|
-
|
|
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:
|
|
181
|
+
button: s,
|
|
176
182
|
secondaryButton: t,
|
|
177
|
-
link:
|
|
183
|
+
link: o
|
|
178
184
|
}
|
|
179
185
|
]
|
|
180
186
|
}).then((param)=>{
|
|
181
|
-
let { action:
|
|
182
|
-
if (
|
|
183
|
-
const
|
|
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 =
|
|
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
|
|
202
|
+
return function C(_) {
|
|
197
203
|
return _ref.apply(this, arguments);
|
|
198
204
|
};
|
|
199
205
|
}();
|
|
200
|
-
let
|
|
201
|
-
const
|
|
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 (
|
|
205
|
-
|
|
206
|
-
const e = new Promise((
|
|
207
|
-
n =
|
|
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
|
-
|
|
216
|
+
h = !1;
|
|
211
217
|
}), e;
|
|
212
218
|
};
|
|
213
219
|
if (l) {
|
|
214
220
|
let e;
|
|
215
|
-
const { type:
|
|
216
|
-
switch(
|
|
221
|
+
const { type: s , props: t } = r;
|
|
222
|
+
switch(s){
|
|
217
223
|
case "INFO":
|
|
218
|
-
e =
|
|
224
|
+
e = b(t);
|
|
219
225
|
break;
|
|
220
226
|
case "ACTIONS_LIST":
|
|
221
|
-
e =
|
|
227
|
+
e = k(t);
|
|
222
228
|
break;
|
|
223
229
|
case "RADIO_LIST":
|
|
224
|
-
e =
|
|
230
|
+
e = L(t);
|
|
225
231
|
break;
|
|
226
232
|
case "ACTIONS":
|
|
227
|
-
e =
|
|
233
|
+
e = C(t);
|
|
228
234
|
break;
|
|
229
235
|
default:
|
|
230
|
-
const
|
|
231
|
-
throw new Error(`Unknown sheet type: ${
|
|
236
|
+
const o = s;
|
|
237
|
+
throw new Error(`Unknown sheet type: ${o}`);
|
|
232
238
|
}
|
|
233
|
-
return e.catch((
|
|
234
|
-
if (
|
|
235
|
-
throw
|
|
239
|
+
return e.catch((o)=>{
|
|
240
|
+
if (o.code === "400") return c();
|
|
241
|
+
throw o;
|
|
236
242
|
});
|
|
237
243
|
} else return c();
|
|
238
|
-
},
|
|
239
|
-
const { isDarkMode: c } =
|
|
244
|
+
}, M = (r)=>{
|
|
245
|
+
const { isDarkMode: c } = m(), [e, s] = S.useState(null), t = S.useRef(null);
|
|
240
246
|
if (S.useEffect(()=>{
|
|
241
|
-
if (
|
|
247
|
+
if (r.nativeImplementation) return l = r.nativeImplementation, ()=>{
|
|
242
248
|
l = null;
|
|
243
249
|
};
|
|
244
250
|
}, [
|
|
245
|
-
|
|
246
|
-
]), S.useEffect(()=>(p = (
|
|
247
|
-
t.current = null,
|
|
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
|
|
252
|
-
switch(
|
|
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
|
-
},
|
|
283
|
-
t.current =
|
|
288
|
+
}, a = (i)=>{
|
|
289
|
+
t.current = i;
|
|
284
290
|
};
|
|
285
291
|
switch(e.type){
|
|
286
292
|
case "INFO":
|
|
287
|
-
return /* @__PURE__ */ u(
|
|
288
|
-
onClose:
|
|
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:
|
|
293
|
-
onSelect:
|
|
298
|
+
onClose: o,
|
|
299
|
+
onSelect: a
|
|
294
300
|
}));
|
|
295
301
|
case "RADIO_LIST":
|
|
296
|
-
return /* @__PURE__ */ u(
|
|
297
|
-
items: e.props.items.map((
|
|
298
|
-
asset:
|
|
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 &&
|
|
301
|
-
width:
|
|
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:
|
|
305
|
-
onSelect:
|
|
310
|
+
onClose: o,
|
|
311
|
+
onSelect: a
|
|
306
312
|
}));
|
|
307
313
|
case "ACTIONS":
|
|
308
|
-
return /* @__PURE__ */ u(
|
|
314
|
+
return /* @__PURE__ */ u(w, _object_spread_props(_object_spread({}, e.props), {
|
|
309
315
|
buttonLink: e.props.link,
|
|
310
|
-
onClose:
|
|
311
|
-
onPressButton:
|
|
316
|
+
onClose: o,
|
|
317
|
+
onPressButton: a
|
|
312
318
|
}));
|
|
313
319
|
default:
|
|
314
320
|
throw new Error(`Unknown sheet type: ${e.type}`);
|
|
315
321
|
}
|
|
316
|
-
},
|
|
317
|
-
export {
|
|
322
|
+
}, F = M;
|
|
323
|
+
export { M as SheetRoot, F as default, B as showSheet };
|