@telefonica/mistica 14.22.1 → 14.22.2
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/button.css-mistica.js +28 -31
- package/dist/button.css.d.ts +1 -3
- package/dist/button.js +71 -63
- package/dist/package-version.js +1 -1
- package/dist-es/button.css-mistica.js +8 -8
- package/dist-es/button.js +104 -96
- package/dist-es/package-version.js +1 -1
- package/dist-es/style.css +1 -1
- package/package.json +1 -1
package/dist-es/button.js
CHANGED
|
@@ -77,24 +77,24 @@ function _object_without_properties_loose(source, excluded) {
|
|
|
77
77
|
}
|
|
78
78
|
return target;
|
|
79
79
|
}
|
|
80
|
-
import { jsx as t, jsxs as C, Fragment as
|
|
80
|
+
import { jsx as t, jsxs as C, Fragment as G } from "react/jsx-runtime";
|
|
81
81
|
import * as o from "react";
|
|
82
|
-
import
|
|
83
|
-
import
|
|
82
|
+
import k from "classnames";
|
|
83
|
+
import M from "./spinner.js";
|
|
84
84
|
import { BaseTouchable as y } from "./touchable.js";
|
|
85
|
-
import { useIsInverseVariant as
|
|
86
|
-
import { useForm as
|
|
87
|
-
import { pxToRem as
|
|
88
|
-
import { Text as
|
|
89
|
-
import
|
|
85
|
+
import { useIsInverseVariant as A } from "./theme-variant-context.js";
|
|
86
|
+
import { useForm as T } from "./form-context.js";
|
|
87
|
+
import { pxToRem as B } from "./utils/css.js";
|
|
88
|
+
import { Text as X, Text3 as Z, Text2 as W } from "./text.js";
|
|
89
|
+
import K from "./box.js";
|
|
90
90
|
import { getTextFromChildren as P } from "./utils/common.js";
|
|
91
|
-
import { useTrackingConfig as
|
|
92
|
-
import { useTheme as
|
|
93
|
-
import { flattenChildren as
|
|
94
|
-
import { inverseVariants as $, variants as
|
|
95
|
-
const
|
|
96
|
-
let { content: e , defaultIconSize:
|
|
97
|
-
const c =
|
|
91
|
+
import { useTrackingConfig as j, eventNames as O, eventCategories as D, eventActions as H } from "./utils/analytics.js";
|
|
92
|
+
import { useTheme as V } from "./hooks.js";
|
|
93
|
+
import { flattenChildren as Y } from "./skins/utils.js";
|
|
94
|
+
import { inverseVariants as $, variants as q, small as J, isLoading as F, textContent as Q, link as U, inverseLink as p, PADDING_X_LINK as R, PADDING_Y_LINK as x, textContentLink as ee, SMALL_SPINNER_SIZE as te, SPINNER_SIZE as ne, ICON_MARGIN_PX as E, CHEVRON_MARGIN_LEFT_LINK as re, loadingFiller as ie, X_SMALL_PADDING_PX as oe, X_PADDING_PX as ae, loadingContent as se, SMALL_ICON_SIZE as ce, ICON_SIZE as le } from "./button.css-mistica.js";
|
|
95
|
+
const N = (param)=>{
|
|
96
|
+
let { content: e , defaultIconSize: i , renderText: n } = param;
|
|
97
|
+
const c = Y(e), f = c.length, d = [];
|
|
98
98
|
let l = [];
|
|
99
99
|
const g = ()=>{
|
|
100
100
|
d.push(/* @__PURE__ */ t(o.Fragment, {
|
|
@@ -106,7 +106,7 @@ const w = (param)=>{
|
|
|
106
106
|
if (/*#__PURE__*/ o.isValidElement(u)) {
|
|
107
107
|
l.length && g();
|
|
108
108
|
var _u_props_size;
|
|
109
|
-
const v = (_u_props_size = u.props.size) !== null && _u_props_size !== void 0 ? _u_props_size :
|
|
109
|
+
const v = (_u_props_size = u.props.size) !== null && _u_props_size !== void 0 ? _u_props_size : i;
|
|
110
110
|
d.push(/* @__PURE__ */ t("div", {
|
|
111
111
|
style: {
|
|
112
112
|
display: "flex",
|
|
@@ -115,12 +115,12 @@ const w = (param)=>{
|
|
|
115
115
|
marginRight: s ? 0 : E
|
|
116
116
|
},
|
|
117
117
|
children: /*#__PURE__*/ o.cloneElement(u, {
|
|
118
|
-
size:
|
|
118
|
+
size: B(v)
|
|
119
119
|
})
|
|
120
120
|
}, d.length));
|
|
121
121
|
} else l.push(u), s && g();
|
|
122
122
|
}), d;
|
|
123
|
-
},
|
|
123
|
+
}, de = ()=>/* @__PURE__ */ t("svg", {
|
|
124
124
|
width: "0.5em",
|
|
125
125
|
height: "1.25em",
|
|
126
126
|
viewBox: "0 0 8 20",
|
|
@@ -128,10 +128,10 @@ const w = (param)=>{
|
|
|
128
128
|
d: "M6.32595 11.0107L3.03801 7.7086L3.03292 7.70375L3.032 7.70291L3.02931 7.70047L3.02848 7.69974L3.02248 7.69436C2.88533 7.57121 2.71386 7.53733 2.56343 7.55395C2.41648 7.57018 2.27272 7.63567 2.16886 7.73711C2.06893 7.83185 2.01209 7.97816 2.00175 8.11707C1.99083 8.26377 2.02925 8.43959 2.16869 8.57393L5.24446 11.5515L2.15859 14.512L2.15375 14.5171L2.1529 14.518L2.15046 14.5207L2.14974 14.5215L2.14435 14.5275C2.02121 14.6647 1.98733 14.8361 2.00394 14.9866C2.02017 15.1335 2.08567 15.2773 2.18711 15.3811C2.28184 15.4811 2.42816 15.5379 2.56706 15.5483C2.71377 15.5592 2.88958 15.5208 3.02392 15.3813L6.32595 12.0922C6.6246 11.7936 6.6246 11.3094 6.32595 11.0107Z",
|
|
129
129
|
fill: "currentColor"
|
|
130
130
|
})
|
|
131
|
-
}),
|
|
132
|
-
let { showSpinner: e , children:
|
|
133
|
-
const s = n ?
|
|
134
|
-
return /* @__PURE__ */ C(
|
|
131
|
+
}), z = (param)=>{
|
|
132
|
+
let { showSpinner: e , children: i , small: n , loadingText: c , shouldRenderSpinner: f , setShouldRenderSpinner: d , renderText: l , textContentStyle: g , StartIcon: u , EndIcon: m , withChevron: a } = param;
|
|
133
|
+
const s = n ? ce : le, r = B(n ? te : ne);
|
|
134
|
+
return /* @__PURE__ */ C(G, {
|
|
135
135
|
children: [
|
|
136
136
|
/* @__PURE__ */ C("div", {
|
|
137
137
|
"aria-hidden": e ? !0 : void 0,
|
|
@@ -148,8 +148,8 @@ const w = (param)=>{
|
|
|
148
148
|
color: "currentColor"
|
|
149
149
|
})
|
|
150
150
|
}),
|
|
151
|
-
|
|
152
|
-
content:
|
|
151
|
+
N({
|
|
152
|
+
content: i,
|
|
153
153
|
defaultIconSize: s,
|
|
154
154
|
renderText: l
|
|
155
155
|
}),
|
|
@@ -170,18 +170,18 @@ const w = (param)=>{
|
|
|
170
170
|
alignItems: "center",
|
|
171
171
|
marginLeft: re
|
|
172
172
|
},
|
|
173
|
-
children: /* @__PURE__ */ t(
|
|
173
|
+
children: /* @__PURE__ */ t(de, {})
|
|
174
174
|
})
|
|
175
175
|
]
|
|
176
176
|
}),
|
|
177
177
|
/* @__PURE__ */ t("div", {
|
|
178
|
-
className:
|
|
178
|
+
className: ie,
|
|
179
179
|
"aria-hidden": !0,
|
|
180
180
|
style: c ? {
|
|
181
|
-
paddingLeft:
|
|
182
|
-
paddingRight: E + 2 * (n ?
|
|
181
|
+
paddingLeft: r,
|
|
182
|
+
paddingRight: E + 2 * (n ? oe : ae)
|
|
183
183
|
} : void 0,
|
|
184
|
-
children:
|
|
184
|
+
children: N({
|
|
185
185
|
content: c,
|
|
186
186
|
defaultIconSize: s,
|
|
187
187
|
renderText: l
|
|
@@ -189,26 +189,26 @@ const w = (param)=>{
|
|
|
189
189
|
}),
|
|
190
190
|
/* @__PURE__ */ C("div", {
|
|
191
191
|
"aria-hidden": e ? void 0 : !0,
|
|
192
|
-
className:
|
|
192
|
+
className: se,
|
|
193
193
|
onTransitionEnd: ()=>{
|
|
194
194
|
e !== f && d(e);
|
|
195
195
|
},
|
|
196
196
|
children: [
|
|
197
|
-
f ? /* @__PURE__ */ t(
|
|
197
|
+
f ? /* @__PURE__ */ t(M, {
|
|
198
198
|
rolePresentation: !!c,
|
|
199
199
|
color: "currentcolor",
|
|
200
200
|
delay: "0s",
|
|
201
|
-
size:
|
|
201
|
+
size: r
|
|
202
202
|
}) : /* @__PURE__ */ t("div", {
|
|
203
203
|
style: {
|
|
204
204
|
display: "inline-block",
|
|
205
|
-
width:
|
|
206
|
-
height:
|
|
205
|
+
width: r,
|
|
206
|
+
height: r
|
|
207
207
|
}
|
|
208
208
|
}),
|
|
209
|
-
c ? /* @__PURE__ */ t(
|
|
209
|
+
c ? /* @__PURE__ */ t(K, {
|
|
210
210
|
paddingLeft: 8,
|
|
211
|
-
children:
|
|
211
|
+
children: N({
|
|
212
212
|
content: c,
|
|
213
213
|
defaultIconSize: s,
|
|
214
214
|
renderText: l
|
|
@@ -218,43 +218,43 @@ const w = (param)=>{
|
|
|
218
218
|
})
|
|
219
219
|
]
|
|
220
220
|
});
|
|
221
|
-
},
|
|
222
|
-
const { textPresets: n } =
|
|
221
|
+
}, _ = /*#__PURE__*/ o.forwardRef((e, i)=>{
|
|
222
|
+
const { textPresets: n } = V(), { eventFormat: c } = j(), { formStatus: f , formId: d } = T(), l = A(), { loadingText: g } = e, u = !!e.submit, m = f === "sending", [a, s] = o.useState(!1), r = e.showSpinner || m && u || a, [v, L] = o.useState(!!r);
|
|
223
223
|
o.useEffect(()=>{
|
|
224
|
-
|
|
224
|
+
r && !v && L(!0);
|
|
225
225
|
}, [
|
|
226
|
-
|
|
226
|
+
r,
|
|
227
227
|
v,
|
|
228
228
|
f
|
|
229
229
|
]);
|
|
230
230
|
var _e_trackingEvent;
|
|
231
231
|
const S = ()=>c === "google-analytics-4" ? {
|
|
232
|
-
name:
|
|
232
|
+
name: O.userInteraction,
|
|
233
233
|
component_type: `${e.type}_button`,
|
|
234
234
|
component_copy: P(e.children)
|
|
235
235
|
} : {
|
|
236
|
-
category:
|
|
236
|
+
category: D.userInteraction,
|
|
237
237
|
action: `${e.type}_button_tapped`,
|
|
238
238
|
label: P(e.children)
|
|
239
|
-
},
|
|
239
|
+
}, b = (I)=>e.small ? /* @__PURE__ */ t(X, {
|
|
240
240
|
size: 14,
|
|
241
241
|
lineHeight: 20,
|
|
242
242
|
weight: n.button.weight,
|
|
243
243
|
truncate: 1,
|
|
244
244
|
color: "inherit",
|
|
245
245
|
as: "div",
|
|
246
|
-
children:
|
|
247
|
-
}) : /* @__PURE__ */ t(
|
|
246
|
+
children: I
|
|
247
|
+
}) : /* @__PURE__ */ t(Z, {
|
|
248
248
|
weight: n.button.weight,
|
|
249
249
|
truncate: 1,
|
|
250
250
|
color: "inherit",
|
|
251
251
|
as: "div",
|
|
252
|
-
children:
|
|
252
|
+
children: I
|
|
253
253
|
}), h = {
|
|
254
|
-
ref:
|
|
255
|
-
className:
|
|
256
|
-
[
|
|
257
|
-
[
|
|
254
|
+
ref: i,
|
|
255
|
+
className: k(l ? $[e.type] : q[e.type], e.className, {
|
|
256
|
+
[J]: e.small,
|
|
257
|
+
[F]: r
|
|
258
258
|
}),
|
|
259
259
|
style: _object_spread({
|
|
260
260
|
cursor: e.fake ? "pointer" : void 0
|
|
@@ -264,19 +264,19 @@ const w = (param)=>{
|
|
|
264
264
|
"aria-controls": e["aria-controls"],
|
|
265
265
|
"aria-expanded": e["aria-expanded"],
|
|
266
266
|
tabIndex: e.tabIndex,
|
|
267
|
-
children:
|
|
268
|
-
showSpinner:
|
|
267
|
+
children: z({
|
|
268
|
+
showSpinner: r,
|
|
269
269
|
shouldRenderSpinner: v,
|
|
270
270
|
setShouldRenderSpinner: L,
|
|
271
271
|
children: e.children,
|
|
272
272
|
loadingText: g,
|
|
273
273
|
small: e.small,
|
|
274
|
-
renderText:
|
|
275
|
-
textContentStyle:
|
|
274
|
+
renderText: b,
|
|
275
|
+
textContentStyle: Q,
|
|
276
276
|
StartIcon: e.StartIcon,
|
|
277
277
|
EndIcon: e.EndIcon
|
|
278
278
|
}),
|
|
279
|
-
disabled: e.disabled ||
|
|
279
|
+
disabled: e.disabled || r || m,
|
|
280
280
|
role: "button"
|
|
281
281
|
};
|
|
282
282
|
if (process.env.NODE_ENV !== "production" && (e.to === "" || e.href === "")) throw Error("to or href props are empty strings");
|
|
@@ -292,9 +292,9 @@ const w = (param)=>{
|
|
|
292
292
|
onPress: ()=>{}
|
|
293
293
|
}, h));
|
|
294
294
|
if (e.onPress) return /* @__PURE__ */ t(y, _object_spread_props(_object_spread({}, h), {
|
|
295
|
-
onPress: (
|
|
296
|
-
const
|
|
297
|
-
|
|
295
|
+
onPress: (I)=>{
|
|
296
|
+
const w = e.onPress(I);
|
|
297
|
+
w && (s(!0), w.finally(()=>s(!1)));
|
|
298
298
|
}
|
|
299
299
|
}));
|
|
300
300
|
if (e.to || e.to === "") return /* @__PURE__ */ t(y, _object_spread_props(_object_spread({}, h), {
|
|
@@ -308,51 +308,59 @@ const w = (param)=>{
|
|
|
308
308
|
}));
|
|
309
309
|
if (process.env.NODE_ENV !== "production") throw Error("Bad button props");
|
|
310
310
|
return null;
|
|
311
|
-
}), Ne = /*#__PURE__*/ o.forwardRef((e,
|
|
311
|
+
}), Ne = /*#__PURE__*/ o.forwardRef((e, i)=>{
|
|
312
312
|
var _e_withChevron;
|
|
313
|
-
const { formStatus: n } =
|
|
313
|
+
const { formStatus: n } = T(), c = A(), { analytics: f , textPresets: d } = V(), { loadingText: l } = e, g = n === "sending", [u, m] = o.useState(!1), a = e.showSpinner || u, s = (_e_withChevron = e.withChevron) !== null && _e_withChevron !== void 0 ? _e_withChevron : !!e.href || !!e.to, [r, v] = o.useState(!!a);
|
|
314
314
|
o.useEffect(()=>{
|
|
315
|
-
a && !
|
|
315
|
+
a && !r && v(!0);
|
|
316
316
|
}, [
|
|
317
317
|
a,
|
|
318
|
-
|
|
318
|
+
r,
|
|
319
319
|
n
|
|
320
320
|
]);
|
|
321
321
|
var _e_trackingEvent;
|
|
322
322
|
const L = ()=>f.eventFormat === "google-analytics-4" ? {
|
|
323
|
-
name:
|
|
323
|
+
name: O.userInteraction,
|
|
324
324
|
component_type: "link",
|
|
325
325
|
component_copy: P(e.children)
|
|
326
326
|
} : {
|
|
327
|
-
category:
|
|
328
|
-
action:
|
|
327
|
+
category: D.userInteraction,
|
|
328
|
+
action: H.linkTapped,
|
|
329
329
|
label: P(e.children)
|
|
330
|
-
}, S = (h)=>/* @__PURE__ */ t(
|
|
330
|
+
}, S = (h)=>/* @__PURE__ */ t(W, {
|
|
331
331
|
weight: d.button.weight,
|
|
332
332
|
truncate: 1,
|
|
333
333
|
color: "inherit",
|
|
334
334
|
children: h
|
|
335
|
-
}),
|
|
336
|
-
className:
|
|
337
|
-
[
|
|
338
|
-
[
|
|
339
|
-
[p]: !!e.bleedRight,
|
|
340
|
-
[ee]: !!e.bleedY,
|
|
341
|
-
[V]: a
|
|
335
|
+
}), b = {
|
|
336
|
+
className: k(U, {
|
|
337
|
+
[p]: c,
|
|
338
|
+
[F]: a
|
|
342
339
|
}),
|
|
340
|
+
/**
|
|
341
|
+
* Setting bleed classes with style to override the margin:0 set by the Touchable component.
|
|
342
|
+
* If we set it using className, it may not work depending on the order in which the styles are applied.
|
|
343
|
+
*/ style: _object_spread({}, e.bleedLeft || e.aligned ? {
|
|
344
|
+
marginLeft: -R
|
|
345
|
+
} : void 0, e.bleedRight ? {
|
|
346
|
+
marginRight: -R
|
|
347
|
+
} : void 0, e.bleedY ? {
|
|
348
|
+
marginTop: -x,
|
|
349
|
+
marginBottom: -x
|
|
350
|
+
} : void 0),
|
|
343
351
|
trackingEvent: (_e_trackingEvent = e.trackingEvent) !== null && _e_trackingEvent !== void 0 ? _e_trackingEvent : e.trackEvent ? L() : void 0,
|
|
344
352
|
dataAttributes: _object_spread({
|
|
345
353
|
"component-name": "ButtonLink"
|
|
346
354
|
}, e.dataAttributes),
|
|
347
|
-
children:
|
|
355
|
+
children: z({
|
|
348
356
|
showSpinner: a,
|
|
349
|
-
shouldRenderSpinner:
|
|
357
|
+
shouldRenderSpinner: r,
|
|
350
358
|
setShouldRenderSpinner: v,
|
|
351
359
|
children: e.children,
|
|
352
360
|
loadingText: l,
|
|
353
361
|
small: !0,
|
|
354
362
|
renderText: S,
|
|
355
|
-
textContentStyle:
|
|
363
|
+
textContentStyle: ee,
|
|
356
364
|
StartIcon: e.StartIcon,
|
|
357
365
|
EndIcon: e.EndIcon,
|
|
358
366
|
withChevron: s
|
|
@@ -361,62 +369,62 @@ const w = (param)=>{
|
|
|
361
369
|
};
|
|
362
370
|
if (process.env.NODE_ENV !== "production" && (e.to === "" || e.href === "")) throw Error("to or href props are empty strings");
|
|
363
371
|
if (e.onPress) return /* @__PURE__ */ t(y, _object_spread_props(_object_spread({
|
|
364
|
-
ref:
|
|
365
|
-
},
|
|
372
|
+
ref: i
|
|
373
|
+
}, b), {
|
|
366
374
|
onPress: (h)=>{
|
|
367
|
-
const
|
|
368
|
-
|
|
375
|
+
const I = e.onPress(h);
|
|
376
|
+
I && (m(!0), I.finally(()=>m(!1)));
|
|
369
377
|
}
|
|
370
378
|
}));
|
|
371
379
|
if (e.to || e.to === "") return /* @__PURE__ */ t(y, _object_spread_props(_object_spread({
|
|
372
|
-
ref:
|
|
373
|
-
},
|
|
380
|
+
ref: i
|
|
381
|
+
}, b), {
|
|
374
382
|
to: e.to,
|
|
375
383
|
fullPageOnWebView: e.fullPageOnWebView
|
|
376
384
|
}));
|
|
377
385
|
if (e.href || e.href === "") return /* @__PURE__ */ t(y, _object_spread_props(_object_spread({
|
|
378
|
-
ref:
|
|
379
|
-
},
|
|
386
|
+
ref: i
|
|
387
|
+
}, b), {
|
|
380
388
|
href: e.href,
|
|
381
389
|
newTab: e.newTab
|
|
382
390
|
}));
|
|
383
391
|
if (process.env.NODE_ENV !== "production") throw Error("Bad button props");
|
|
384
392
|
return null;
|
|
385
393
|
}), _e = /*#__PURE__*/ o.forwardRef((_param, n)=>/* @__PURE__ */ {
|
|
386
|
-
var { dataAttributes: e } = _param,
|
|
394
|
+
var { dataAttributes: e } = _param, i = _object_without_properties(_param, [
|
|
387
395
|
"dataAttributes"
|
|
388
396
|
]);
|
|
389
|
-
return t(
|
|
397
|
+
return t(_, _object_spread_props(_object_spread({
|
|
390
398
|
dataAttributes: _object_spread({
|
|
391
399
|
"component-name": "ButtonPrimary"
|
|
392
400
|
}, e)
|
|
393
|
-
},
|
|
401
|
+
}, i), {
|
|
394
402
|
ref: n,
|
|
395
403
|
type: "primary"
|
|
396
404
|
}));
|
|
397
|
-
}),
|
|
398
|
-
var { dataAttributes: e } = _param,
|
|
405
|
+
}), we = /*#__PURE__*/ o.forwardRef((_param, n)=>/* @__PURE__ */ {
|
|
406
|
+
var { dataAttributes: e } = _param, i = _object_without_properties(_param, [
|
|
399
407
|
"dataAttributes"
|
|
400
408
|
]);
|
|
401
|
-
return t(
|
|
409
|
+
return t(_, _object_spread_props(_object_spread({
|
|
402
410
|
dataAttributes: _object_spread({
|
|
403
411
|
"component-name": "ButtonSecondary"
|
|
404
412
|
}, e)
|
|
405
|
-
},
|
|
413
|
+
}, i), {
|
|
406
414
|
ref: n,
|
|
407
415
|
type: "secondary"
|
|
408
416
|
}));
|
|
409
|
-
}),
|
|
410
|
-
var { dataAttributes: e } = _param,
|
|
417
|
+
}), Re = /*#__PURE__*/ o.forwardRef((_param, n)=>/* @__PURE__ */ {
|
|
418
|
+
var { dataAttributes: e } = _param, i = _object_without_properties(_param, [
|
|
411
419
|
"dataAttributes"
|
|
412
420
|
]);
|
|
413
|
-
return t(
|
|
421
|
+
return t(_, _object_spread_props(_object_spread({
|
|
414
422
|
dataAttributes: _object_spread({
|
|
415
423
|
"component-name": "ButtonDanger"
|
|
416
424
|
}, e)
|
|
417
|
-
},
|
|
425
|
+
}, i), {
|
|
418
426
|
ref: n,
|
|
419
427
|
type: "danger"
|
|
420
428
|
}));
|
|
421
429
|
});
|
|
422
|
-
export {
|
|
430
|
+
export { Re as ButtonDanger, Ne as ButtonLink, _e as ButtonPrimary, we as ButtonSecondary };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const o = "14.22.
|
|
1
|
+
const o = "14.22.2";
|
|
2
2
|
export { o as PACKAGE_VERSION };
|