@telefonica/mistica 14.26.0 → 14.27.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/button.d.ts +7 -1
- package/dist/button.js +78 -72
- package/dist/menu.js +41 -41
- package/dist/package-version.js +1 -1
- package/dist/tabs.js +4 -3
- package/dist/touchable.d.ts +1 -0
- package/dist/touchable.js +8 -7
- package/dist-es/button.js +103 -97
- package/dist-es/menu.js +64 -64
- package/dist-es/package-version.js +1 -1
- package/dist-es/style.css +1 -1
- package/dist-es/tabs.js +11 -10
- package/dist-es/touchable.js +19 -18
- package/package.json +1 -1
package/dist/button.js
CHANGED
|
@@ -10,7 +10,7 @@ function _export(target, all) {
|
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
12
|
ButtonDanger: function() {
|
|
13
|
-
return
|
|
13
|
+
return xe;
|
|
14
14
|
},
|
|
15
15
|
ButtonLink: function() {
|
|
16
16
|
return Ne;
|
|
@@ -161,32 +161,32 @@ function _object_without_properties_loose(source, excluded) {
|
|
|
161
161
|
return target;
|
|
162
162
|
}
|
|
163
163
|
const N = (param)=>{
|
|
164
|
-
let { content: e , defaultIconSize:
|
|
165
|
-
const
|
|
166
|
-
let
|
|
164
|
+
let { content: e , defaultIconSize: r , renderText: n } = param;
|
|
165
|
+
const l = (0, _utils.flattenChildren)(e), f = l.length, d = [];
|
|
166
|
+
let c = [];
|
|
167
167
|
const g = ()=>{
|
|
168
168
|
d.push(/* @__PURE__ */ (0, _jsxruntime.jsx)(_react.Fragment, {
|
|
169
|
-
children: n(
|
|
170
|
-
}, d.length)),
|
|
169
|
+
children: n(c)
|
|
170
|
+
}, d.length)), c = [];
|
|
171
171
|
};
|
|
172
|
-
return
|
|
173
|
-
const
|
|
172
|
+
return l.forEach((u, m)=>{
|
|
173
|
+
const o = m === 0, s = m === f - 1;
|
|
174
174
|
if (/*#__PURE__*/ _react.isValidElement(u)) {
|
|
175
|
-
|
|
175
|
+
c.length && g();
|
|
176
176
|
var _u_props_size;
|
|
177
|
-
const v = (_u_props_size = u.props.size) !== null && _u_props_size !== void 0 ? _u_props_size :
|
|
177
|
+
const v = (_u_props_size = u.props.size) !== null && _u_props_size !== void 0 ? _u_props_size : r;
|
|
178
178
|
d.push(/* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
|
|
179
179
|
style: {
|
|
180
180
|
display: "flex",
|
|
181
181
|
alignItems: "center",
|
|
182
|
-
marginLeft:
|
|
182
|
+
marginLeft: o ? 0 : _buttoncssmistica.ICON_MARGIN_PX,
|
|
183
183
|
marginRight: s ? 0 : _buttoncssmistica.ICON_MARGIN_PX
|
|
184
184
|
},
|
|
185
185
|
children: /*#__PURE__*/ _react.cloneElement(u, {
|
|
186
186
|
size: (0, _css.pxToRem)(v)
|
|
187
187
|
})
|
|
188
188
|
}, d.length));
|
|
189
|
-
} else
|
|
189
|
+
} else c.push(u), s && g();
|
|
190
190
|
}), d;
|
|
191
191
|
}, de = ()=>/* @__PURE__ */ (0, _jsxruntime.jsx)("svg", {
|
|
192
192
|
width: "0.5em",
|
|
@@ -197,8 +197,8 @@ const N = (param)=>{
|
|
|
197
197
|
fill: "currentColor"
|
|
198
198
|
})
|
|
199
199
|
}), z = (param)=>{
|
|
200
|
-
let { showSpinner: e , children:
|
|
201
|
-
const s = n ? _buttoncssmistica.SMALL_ICON_SIZE : _buttoncssmistica.ICON_SIZE,
|
|
200
|
+
let { showSpinner: e , children: r , small: n , loadingText: l , shouldRenderSpinner: f , setShouldRenderSpinner: d , renderText: c , textContentStyle: g , StartIcon: u , EndIcon: m , withChevron: o } = param;
|
|
201
|
+
const s = n ? _buttoncssmistica.SMALL_ICON_SIZE : _buttoncssmistica.ICON_SIZE, i = (0, _css.pxToRem)(n ? _buttoncssmistica.SMALL_SPINNER_SIZE : _buttoncssmistica.SPINNER_SIZE);
|
|
202
202
|
return /* @__PURE__ */ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
203
203
|
children: [
|
|
204
204
|
/* @__PURE__ */ (0, _jsxruntime.jsxs)("div", {
|
|
@@ -217,11 +217,11 @@ const N = (param)=>{
|
|
|
217
217
|
})
|
|
218
218
|
}),
|
|
219
219
|
N({
|
|
220
|
-
content:
|
|
220
|
+
content: r,
|
|
221
221
|
defaultIconSize: s,
|
|
222
|
-
renderText:
|
|
222
|
+
renderText: c
|
|
223
223
|
}),
|
|
224
|
-
m && !
|
|
224
|
+
m && !o && /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
|
|
225
225
|
style: {
|
|
226
226
|
display: "flex",
|
|
227
227
|
alignItems: "center",
|
|
@@ -232,7 +232,7 @@ const N = (param)=>{
|
|
|
232
232
|
color: "currentColor"
|
|
233
233
|
})
|
|
234
234
|
}),
|
|
235
|
-
|
|
235
|
+
o && /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
|
|
236
236
|
style: {
|
|
237
237
|
display: "flex",
|
|
238
238
|
alignItems: "center",
|
|
@@ -245,14 +245,14 @@ const N = (param)=>{
|
|
|
245
245
|
/* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
|
|
246
246
|
className: _buttoncssmistica.loadingFiller,
|
|
247
247
|
"aria-hidden": !0,
|
|
248
|
-
style:
|
|
249
|
-
paddingLeft:
|
|
248
|
+
style: l ? {
|
|
249
|
+
paddingLeft: i,
|
|
250
250
|
paddingRight: _buttoncssmistica.ICON_MARGIN_PX + 2 * (n ? _buttoncssmistica.X_SMALL_PADDING_PX : _buttoncssmistica.X_PADDING_PX)
|
|
251
251
|
} : void 0,
|
|
252
252
|
children: N({
|
|
253
|
-
content:
|
|
253
|
+
content: l,
|
|
254
254
|
defaultIconSize: s,
|
|
255
|
-
renderText:
|
|
255
|
+
renderText: c
|
|
256
256
|
})
|
|
257
257
|
}),
|
|
258
258
|
/* @__PURE__ */ (0, _jsxruntime.jsxs)("div", {
|
|
@@ -263,40 +263,40 @@ const N = (param)=>{
|
|
|
263
263
|
},
|
|
264
264
|
children: [
|
|
265
265
|
f ? /* @__PURE__ */ (0, _jsxruntime.jsx)(_spinner.default, {
|
|
266
|
-
rolePresentation: !!
|
|
266
|
+
rolePresentation: !!l,
|
|
267
267
|
color: "currentcolor",
|
|
268
268
|
delay: "0s",
|
|
269
|
-
size:
|
|
269
|
+
size: i
|
|
270
270
|
}) : /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
|
|
271
271
|
style: {
|
|
272
272
|
display: "inline-block",
|
|
273
|
-
width:
|
|
274
|
-
height:
|
|
273
|
+
width: i,
|
|
274
|
+
height: i
|
|
275
275
|
}
|
|
276
276
|
}),
|
|
277
|
-
|
|
277
|
+
l ? /* @__PURE__ */ (0, _jsxruntime.jsx)(_box.default, {
|
|
278
278
|
paddingLeft: 8,
|
|
279
279
|
children: N({
|
|
280
|
-
content:
|
|
280
|
+
content: l,
|
|
281
281
|
defaultIconSize: s,
|
|
282
|
-
renderText:
|
|
282
|
+
renderText: c
|
|
283
283
|
})
|
|
284
284
|
}) : null
|
|
285
285
|
]
|
|
286
286
|
})
|
|
287
287
|
]
|
|
288
288
|
});
|
|
289
|
-
}, _ = /*#__PURE__*/ _react.forwardRef((e,
|
|
290
|
-
const { textPresets: n } = (0, _hooks.useTheme)(), { eventFormat:
|
|
289
|
+
}, _ = /*#__PURE__*/ _react.forwardRef((e, r)=>{
|
|
290
|
+
const { textPresets: n } = (0, _hooks.useTheme)(), { eventFormat: l } = (0, _analytics.useTrackingConfig)(), { formStatus: f , formId: d } = (0, _formcontext.useForm)(), c = (0, _themevariantcontext.useIsInverseVariant)(), { loadingText: g } = e, u = !!e.submit, m = f === "sending", [o, s] = _react.useState(!1), i = e.showSpinner || m && u || o, [v, L] = _react.useState(!!i);
|
|
291
291
|
_react.useEffect(()=>{
|
|
292
|
-
|
|
292
|
+
i && !v && L(!0);
|
|
293
293
|
}, [
|
|
294
|
-
|
|
294
|
+
i,
|
|
295
295
|
v,
|
|
296
296
|
f
|
|
297
297
|
]);
|
|
298
298
|
var _e_trackingEvent;
|
|
299
|
-
const S = ()=>
|
|
299
|
+
const S = ()=>l === "google-analytics-4" ? {
|
|
300
300
|
name: _analytics.eventNames.userInteraction,
|
|
301
301
|
component_type: `${e.type}_button`,
|
|
302
302
|
component_copy: (0, _common.getTextFromChildren)(e.children)
|
|
@@ -304,47 +304,49 @@ const N = (param)=>{
|
|
|
304
304
|
category: _analytics.eventCategories.userInteraction,
|
|
305
305
|
action: `${e.type}_button_tapped`,
|
|
306
306
|
label: (0, _common.getTextFromChildren)(e.children)
|
|
307
|
-
},
|
|
307
|
+
}, I = (y)=>e.small ? /* @__PURE__ */ (0, _jsxruntime.jsx)(_text.Text, {
|
|
308
308
|
size: 14,
|
|
309
309
|
lineHeight: 20,
|
|
310
310
|
weight: n.button.weight,
|
|
311
311
|
truncate: 1,
|
|
312
312
|
color: "inherit",
|
|
313
313
|
as: "div",
|
|
314
|
-
children:
|
|
314
|
+
children: y
|
|
315
315
|
}) : /* @__PURE__ */ (0, _jsxruntime.jsx)(_text.Text3, {
|
|
316
316
|
weight: n.button.weight,
|
|
317
317
|
truncate: 1,
|
|
318
318
|
color: "inherit",
|
|
319
319
|
as: "div",
|
|
320
|
-
children:
|
|
320
|
+
children: y
|
|
321
321
|
}), h = {
|
|
322
|
-
ref:
|
|
323
|
-
className: (0, _classnames.default)(
|
|
322
|
+
ref: r,
|
|
323
|
+
className: (0, _classnames.default)(c ? _buttoncssmistica.inverseVariants[e.type] : _buttoncssmistica.variants[e.type], e.className, {
|
|
324
324
|
[_buttoncssmistica.small]: e.small,
|
|
325
|
-
[_buttoncssmistica.isLoading]:
|
|
325
|
+
[_buttoncssmistica.isLoading]: i
|
|
326
326
|
}),
|
|
327
327
|
style: _object_spread({
|
|
328
328
|
cursor: e.fake ? "pointer" : void 0
|
|
329
329
|
}, e.style),
|
|
330
330
|
trackingEvent: (_e_trackingEvent = e.trackingEvent) !== null && _e_trackingEvent !== void 0 ? _e_trackingEvent : e.trackEvent ? S() : void 0,
|
|
331
331
|
dataAttributes: e.dataAttributes,
|
|
332
|
+
"aria-label": e["aria-label"],
|
|
332
333
|
"aria-controls": e["aria-controls"],
|
|
333
334
|
"aria-expanded": e["aria-expanded"],
|
|
335
|
+
"aria-haspopup": e["aria-haspopup"],
|
|
334
336
|
tabIndex: e.tabIndex,
|
|
335
337
|
children: z({
|
|
336
|
-
showSpinner:
|
|
338
|
+
showSpinner: i,
|
|
337
339
|
shouldRenderSpinner: v,
|
|
338
340
|
setShouldRenderSpinner: L,
|
|
339
341
|
children: e.children,
|
|
340
342
|
loadingText: g,
|
|
341
343
|
small: e.small,
|
|
342
|
-
renderText:
|
|
344
|
+
renderText: I,
|
|
343
345
|
textContentStyle: _buttoncssmistica.textContent,
|
|
344
346
|
StartIcon: e.StartIcon,
|
|
345
347
|
EndIcon: e.EndIcon
|
|
346
348
|
}),
|
|
347
|
-
disabled: e.disabled ||
|
|
349
|
+
disabled: e.disabled || i || m,
|
|
348
350
|
role: "button"
|
|
349
351
|
};
|
|
350
352
|
if (process.env.NODE_ENV !== "production" && (e.to === "" || e.href === "")) throw Error("to or href props are empty strings");
|
|
@@ -360,8 +362,8 @@ const N = (param)=>{
|
|
|
360
362
|
onPress: ()=>{}
|
|
361
363
|
}, h));
|
|
362
364
|
if (e.onPress) return /* @__PURE__ */ (0, _jsxruntime.jsx)(_touchable.BaseTouchable, _object_spread_props(_object_spread({}, h), {
|
|
363
|
-
onPress: (
|
|
364
|
-
const w = e.onPress(
|
|
365
|
+
onPress: (y)=>{
|
|
366
|
+
const w = e.onPress(y);
|
|
365
367
|
w && (s(!0), w.finally(()=>s(!1)));
|
|
366
368
|
}
|
|
367
369
|
}));
|
|
@@ -376,14 +378,14 @@ const N = (param)=>{
|
|
|
376
378
|
}));
|
|
377
379
|
if (process.env.NODE_ENV !== "production") throw Error("Bad button props");
|
|
378
380
|
return null;
|
|
379
|
-
}), Ne = /*#__PURE__*/ _react.forwardRef((e,
|
|
381
|
+
}), Ne = /*#__PURE__*/ _react.forwardRef((e, r)=>{
|
|
380
382
|
var _e_withChevron;
|
|
381
|
-
const { formStatus: n } = (0, _formcontext.useForm)(),
|
|
383
|
+
const { formStatus: n } = (0, _formcontext.useForm)(), l = (0, _themevariantcontext.useIsInverseVariant)(), { analytics: f , textPresets: d } = (0, _hooks.useTheme)(), { loadingText: c } = e, g = n === "sending", [u, m] = _react.useState(!1), o = e.showSpinner || u, s = (_e_withChevron = e.withChevron) !== null && _e_withChevron !== void 0 ? _e_withChevron : !!e.href || !!e.to, [i, v] = _react.useState(!!o);
|
|
382
384
|
_react.useEffect(()=>{
|
|
383
|
-
|
|
385
|
+
o && !i && v(!0);
|
|
384
386
|
}, [
|
|
385
|
-
|
|
386
|
-
|
|
387
|
+
o,
|
|
388
|
+
i,
|
|
387
389
|
n
|
|
388
390
|
]);
|
|
389
391
|
var _e_trackingEvent;
|
|
@@ -400,10 +402,10 @@ const N = (param)=>{
|
|
|
400
402
|
truncate: 1,
|
|
401
403
|
color: "inherit",
|
|
402
404
|
children: h
|
|
403
|
-
}),
|
|
405
|
+
}), I = {
|
|
404
406
|
className: (0, _classnames.default)(_buttoncssmistica.link, {
|
|
405
|
-
[_buttoncssmistica.inverseLink]:
|
|
406
|
-
[_buttoncssmistica.isLoading]:
|
|
407
|
+
[_buttoncssmistica.inverseLink]: l,
|
|
408
|
+
[_buttoncssmistica.isLoading]: o
|
|
407
409
|
}),
|
|
408
410
|
/**
|
|
409
411
|
* Setting bleed classes with style to override the margin:0 set by the Touchable component.
|
|
@@ -420,12 +422,16 @@ const N = (param)=>{
|
|
|
420
422
|
dataAttributes: _object_spread({
|
|
421
423
|
"component-name": "ButtonLink"
|
|
422
424
|
}, e.dataAttributes),
|
|
425
|
+
"aria-label": e["aria-label"],
|
|
426
|
+
"aria-controls": e["aria-controls"],
|
|
427
|
+
"aria-expanded": e["aria-expanded"],
|
|
428
|
+
"aria-haspopup": e["aria-haspopup"],
|
|
423
429
|
children: z({
|
|
424
|
-
showSpinner:
|
|
425
|
-
shouldRenderSpinner:
|
|
430
|
+
showSpinner: o,
|
|
431
|
+
shouldRenderSpinner: i,
|
|
426
432
|
setShouldRenderSpinner: v,
|
|
427
433
|
children: e.children,
|
|
428
|
-
loadingText:
|
|
434
|
+
loadingText: c,
|
|
429
435
|
small: !0,
|
|
430
436
|
renderText: S,
|
|
431
437
|
textContentStyle: _buttoncssmistica.textContentLink,
|
|
@@ -433,64 +439,64 @@ const N = (param)=>{
|
|
|
433
439
|
EndIcon: e.EndIcon,
|
|
434
440
|
withChevron: s
|
|
435
441
|
}),
|
|
436
|
-
disabled: e.disabled ||
|
|
442
|
+
disabled: e.disabled || o || g
|
|
437
443
|
};
|
|
438
444
|
if (process.env.NODE_ENV !== "production" && (e.to === "" || e.href === "")) throw Error("to or href props are empty strings");
|
|
439
445
|
if (e.onPress) return /* @__PURE__ */ (0, _jsxruntime.jsx)(_touchable.BaseTouchable, _object_spread_props(_object_spread({
|
|
440
|
-
ref:
|
|
441
|
-
},
|
|
446
|
+
ref: r
|
|
447
|
+
}, I), {
|
|
442
448
|
onPress: (h)=>{
|
|
443
|
-
const
|
|
444
|
-
|
|
449
|
+
const y = e.onPress(h);
|
|
450
|
+
y && (m(!0), y.finally(()=>m(!1)));
|
|
445
451
|
}
|
|
446
452
|
}));
|
|
447
453
|
if (e.to || e.to === "") return /* @__PURE__ */ (0, _jsxruntime.jsx)(_touchable.BaseTouchable, _object_spread_props(_object_spread({
|
|
448
|
-
ref:
|
|
449
|
-
},
|
|
454
|
+
ref: r
|
|
455
|
+
}, I), {
|
|
450
456
|
to: e.to,
|
|
451
457
|
fullPageOnWebView: e.fullPageOnWebView
|
|
452
458
|
}));
|
|
453
459
|
if (e.href || e.href === "") return /* @__PURE__ */ (0, _jsxruntime.jsx)(_touchable.BaseTouchable, _object_spread_props(_object_spread({
|
|
454
|
-
ref:
|
|
455
|
-
},
|
|
460
|
+
ref: r
|
|
461
|
+
}, I), {
|
|
456
462
|
href: e.href,
|
|
457
463
|
newTab: e.newTab
|
|
458
464
|
}));
|
|
459
465
|
if (process.env.NODE_ENV !== "production") throw Error("Bad button props");
|
|
460
466
|
return null;
|
|
461
467
|
}), _e = /*#__PURE__*/ _react.forwardRef((_param, n)=>/* @__PURE__ */ {
|
|
462
|
-
var { dataAttributes: e } = _param,
|
|
468
|
+
var { dataAttributes: e } = _param, r = _object_without_properties(_param, [
|
|
463
469
|
"dataAttributes"
|
|
464
470
|
]);
|
|
465
471
|
return (0, _jsxruntime.jsx)(_, _object_spread_props(_object_spread({
|
|
466
472
|
dataAttributes: _object_spread({
|
|
467
473
|
"component-name": "ButtonPrimary"
|
|
468
474
|
}, e)
|
|
469
|
-
},
|
|
475
|
+
}, r), {
|
|
470
476
|
ref: n,
|
|
471
477
|
type: "primary"
|
|
472
478
|
}));
|
|
473
479
|
}), we = /*#__PURE__*/ _react.forwardRef((_param, n)=>/* @__PURE__ */ {
|
|
474
|
-
var { dataAttributes: e } = _param,
|
|
480
|
+
var { dataAttributes: e } = _param, r = _object_without_properties(_param, [
|
|
475
481
|
"dataAttributes"
|
|
476
482
|
]);
|
|
477
483
|
return (0, _jsxruntime.jsx)(_, _object_spread_props(_object_spread({
|
|
478
484
|
dataAttributes: _object_spread({
|
|
479
485
|
"component-name": "ButtonSecondary"
|
|
480
486
|
}, e)
|
|
481
|
-
},
|
|
487
|
+
}, r), {
|
|
482
488
|
ref: n,
|
|
483
489
|
type: "secondary"
|
|
484
490
|
}));
|
|
485
|
-
}),
|
|
486
|
-
var { dataAttributes: e } = _param,
|
|
491
|
+
}), xe = /*#__PURE__*/ _react.forwardRef((_param, n)=>/* @__PURE__ */ {
|
|
492
|
+
var { dataAttributes: e } = _param, r = _object_without_properties(_param, [
|
|
487
493
|
"dataAttributes"
|
|
488
494
|
]);
|
|
489
495
|
return (0, _jsxruntime.jsx)(_, _object_spread_props(_object_spread({
|
|
490
496
|
dataAttributes: _object_spread({
|
|
491
497
|
"component-name": "ButtonDanger"
|
|
492
498
|
}, e)
|
|
493
|
-
},
|
|
499
|
+
}, r), {
|
|
494
500
|
ref: n,
|
|
495
501
|
type: "danger"
|
|
496
502
|
}));
|
package/dist/menu.js
CHANGED
|
@@ -144,15 +144,15 @@ const Ee = 120, Q = /*#__PURE__*/ _react.createContext({
|
|
|
144
144
|
const f = D(r).indexOf(d);
|
|
145
145
|
return f < 0 ? null : f;
|
|
146
146
|
}, je = (param)=>{
|
|
147
|
-
let { label: r , Icon: d , destructive: f , disabled:
|
|
148
|
-
const { focusedItem:
|
|
147
|
+
let { label: r , Icon: d , destructive: f , disabled: u , onPress: E , controlType: s , checked: p } = param;
|
|
148
|
+
const { focusedItem: n , setFocusedItem: v , closeMenu: i , isMenuOpen: k } = ke(), c = _react.useRef(null), h = f ? _skincontractcssmistica.vars.colors.textLinkDanger : _skincontractcssmistica.vars.colors.neutralHigh, x = c == null ? void 0 : c.current, M = (x == null ? void 0 : x.closest("[role=menu]")) || null, m = Ne(M, x), l = ()=>s === "checkbox" ? /* @__PURE__ */ (0, _jsxruntime.jsx)(_checkbox.default, {
|
|
149
149
|
ref: c,
|
|
150
150
|
name: r,
|
|
151
151
|
checked: p,
|
|
152
152
|
onChange: ()=>{
|
|
153
|
-
k &&
|
|
153
|
+
k && m !== null && (E(m), i());
|
|
154
154
|
},
|
|
155
|
-
disabled:
|
|
155
|
+
disabled: u,
|
|
156
156
|
role: "menuitemcheckbox",
|
|
157
157
|
render: (param)=>/* @__PURE__ */ {
|
|
158
158
|
let { controlElement: N } = param;
|
|
@@ -191,9 +191,9 @@ const Ee = 120, Q = /*#__PURE__*/ _react.createContext({
|
|
|
191
191
|
}) : /* @__PURE__ */ (0, _jsxruntime.jsx)(_touchable.default, {
|
|
192
192
|
ref: c,
|
|
193
193
|
onPress: ()=>{
|
|
194
|
-
k &&
|
|
194
|
+
k && m !== null && (E(m), i());
|
|
195
195
|
},
|
|
196
|
-
disabled:
|
|
196
|
+
disabled: u,
|
|
197
197
|
role: "menuitem",
|
|
198
198
|
children: /* @__PURE__ */ (0, _jsxruntime.jsx)(_box.default, {
|
|
199
199
|
paddingX: 8,
|
|
@@ -219,11 +219,11 @@ const Ee = 120, Q = /*#__PURE__*/ _react.createContext({
|
|
|
219
219
|
});
|
|
220
220
|
return /* @__PURE__ */ (0, _jsxruntime.jsx)("div", {
|
|
221
221
|
className: (0, _classnames.default)(_menucssmistica.menuItem, {
|
|
222
|
-
[_menucssmistica.menuItemEnabled]: !
|
|
223
|
-
[_menucssmistica.menuItemDisabled]:
|
|
224
|
-
[_menucssmistica.menuItemHovered]: !
|
|
222
|
+
[_menucssmistica.menuItemEnabled]: !u,
|
|
223
|
+
[_menucssmistica.menuItemDisabled]: u,
|
|
224
|
+
[_menucssmistica.menuItemHovered]: !u && m !== null && n === m
|
|
225
225
|
}),
|
|
226
|
-
onMouseMove: ()=>v(
|
|
226
|
+
onMouseMove: ()=>v(u ? null : m),
|
|
227
227
|
onMouseLeave: ()=>v(null),
|
|
228
228
|
children: l()
|
|
229
229
|
});
|
|
@@ -240,45 +240,45 @@ const Ee = 120, Q = /*#__PURE__*/ _react.createContext({
|
|
|
240
240
|
]
|
|
241
241
|
}) : /* @__PURE__ */ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {});
|
|
242
242
|
}, V = 12, J = 8, qe = (param)=>{
|
|
243
|
-
let { renderTarget: r , renderMenu: d , width: f , position:
|
|
244
|
-
const [
|
|
243
|
+
let { renderTarget: r , renderMenu: d , width: f , position: u = "left" , dataAttributes: E } = param;
|
|
244
|
+
const [s, p] = _react.useState(!1), [n, v] = _react.useState(null), [i, k] = _react.useState(null), [c, h] = _react.useState(null), [x, M] = _react.useState(!1), m = _react.useRef(null), [l, N] = _react.useState(null), R = (0, _hooks.useWindowSize)();
|
|
245
245
|
_react.useEffect(()=>{
|
|
246
|
-
const a =
|
|
247
|
-
if (!i || !a || !
|
|
248
|
-
const { top: t , right: O , left: g , bottom:
|
|
246
|
+
const a = n == null ? void 0 : n.getBoundingClientRect();
|
|
247
|
+
if (!i || !a || !s) return;
|
|
248
|
+
const { top: t , right: O , left: g , bottom: A } = a, T = i.scrollHeight, I = u === "left" ? g : void 0, F = u === "right" ? R.width - O : void 0, L = t - J, $ = A + J, H = R.height - $ - V, P = L - V, B = H > T, z = P > T, te = B || !z && H > P;
|
|
249
249
|
N(te ? {
|
|
250
|
-
left:
|
|
251
|
-
right:
|
|
250
|
+
left: I,
|
|
251
|
+
right: F,
|
|
252
252
|
top: `${$}px`,
|
|
253
253
|
bottom: "auto",
|
|
254
254
|
maxHeight: B ? void 0 : H,
|
|
255
255
|
transformOrigin: "center top"
|
|
256
256
|
} : {
|
|
257
|
-
left:
|
|
258
|
-
right:
|
|
257
|
+
left: I,
|
|
258
|
+
right: F,
|
|
259
259
|
top: "auto",
|
|
260
260
|
bottom: `${R.height - L}px`,
|
|
261
261
|
maxHeight: z ? void 0 : P,
|
|
262
262
|
transformOrigin: "center bottom"
|
|
263
263
|
});
|
|
264
264
|
}, [
|
|
265
|
-
|
|
266
|
-
o,
|
|
267
|
-
i,
|
|
265
|
+
u,
|
|
268
266
|
s,
|
|
267
|
+
i,
|
|
268
|
+
n,
|
|
269
269
|
f,
|
|
270
270
|
R
|
|
271
271
|
]);
|
|
272
272
|
const Z = _react.useMemo(()=>({
|
|
273
273
|
ref: v,
|
|
274
274
|
onPress: ()=>{
|
|
275
|
-
p(!
|
|
275
|
+
p(!s);
|
|
276
276
|
}
|
|
277
277
|
}), [
|
|
278
278
|
v,
|
|
279
|
-
|
|
279
|
+
s
|
|
280
280
|
]), ee = {
|
|
281
|
-
ref: (0, _common.combineRefs)(k,
|
|
281
|
+
ref: (0, _common.combineRefs)(k, m),
|
|
282
282
|
className: _menucssmistica.menuContainer,
|
|
283
283
|
close: ()=>p(!1)
|
|
284
284
|
}, w = _react.useCallback(()=>{
|
|
@@ -291,24 +291,24 @@ const Ee = 120, Q = /*#__PURE__*/ _react.createContext({
|
|
|
291
291
|
const t = D(i);
|
|
292
292
|
a && t.reverse();
|
|
293
293
|
const O = c === null ? -1 : a ? t.length - 1 - c : c;
|
|
294
|
-
let g = t.findIndex((
|
|
295
|
-
g === -1 && (g = t.findIndex((
|
|
296
|
-
const
|
|
297
|
-
h(
|
|
294
|
+
let g = t.findIndex((I, F)=>!I.getAttribute("aria-disabled") && F > O);
|
|
295
|
+
g === -1 && (g = t.findIndex((I)=>!I.getAttribute("aria-disabled")));
|
|
296
|
+
const A = a && g !== -1 ? t.length - 1 - g : g;
|
|
297
|
+
h(A < 0 ? null : A), (T = t[g]) == null || T.focus();
|
|
298
298
|
}, [
|
|
299
299
|
c,
|
|
300
300
|
i
|
|
301
301
|
]);
|
|
302
302
|
return _react.useEffect(()=>{
|
|
303
|
-
|
|
303
|
+
s ? x && i && (w(), M(!1)) : h(null);
|
|
304
304
|
}, [
|
|
305
|
-
|
|
305
|
+
s,
|
|
306
306
|
w,
|
|
307
307
|
x,
|
|
308
308
|
i
|
|
309
309
|
]), _react.useEffect(()=>{
|
|
310
310
|
const a = (t)=>{
|
|
311
|
-
if (
|
|
311
|
+
if (s) switch(t.keyCode){
|
|
312
312
|
case _keycodes.RIGHT:
|
|
313
313
|
case _keycodes.DOWN:
|
|
314
314
|
(0, _dom.cancelEvent)(t), _();
|
|
@@ -334,7 +334,7 @@ const Ee = 120, Q = /*#__PURE__*/ _react.createContext({
|
|
|
334
334
|
M(!0);
|
|
335
335
|
break;
|
|
336
336
|
case _keycodes.DOWN:
|
|
337
|
-
|
|
337
|
+
n === document.activeElement && (M(!0), p(!0));
|
|
338
338
|
break;
|
|
339
339
|
}
|
|
340
340
|
};
|
|
@@ -342,24 +342,24 @@ const Ee = 120, Q = /*#__PURE__*/ _react.createContext({
|
|
|
342
342
|
document.removeEventListener("keydown", a, !1);
|
|
343
343
|
};
|
|
344
344
|
}), _react.useEffect(()=>{
|
|
345
|
-
|
|
345
|
+
n == null || n.setAttribute("aria-haspopup", "menu"), n == null || n.setAttribute("aria-expanded", String(s));
|
|
346
346
|
}, [
|
|
347
|
-
|
|
348
|
-
|
|
347
|
+
n,
|
|
348
|
+
s
|
|
349
349
|
]), /* @__PURE__ */ (0, _jsxruntime.jsxs)("div", _object_spread_props(_object_spread({}, (0, _dom.getPrefixedDataAttributes)(E, "Menu")), {
|
|
350
350
|
children: [
|
|
351
351
|
r(_object_spread_props(_object_spread({}, Z), {
|
|
352
|
-
isMenuOpen:
|
|
352
|
+
isMenuOpen: s
|
|
353
353
|
})),
|
|
354
354
|
/* @__PURE__ */ (0, _jsxruntime.jsx)(_portal.Portal, {
|
|
355
355
|
children: /* @__PURE__ */ (0, _jsxruntime.jsx)(_reacttransitiongroup.CSSTransition, {
|
|
356
|
-
in:
|
|
357
|
-
nodeRef:
|
|
356
|
+
in: s,
|
|
357
|
+
nodeRef: m,
|
|
358
358
|
timeout: Ee,
|
|
359
359
|
classNames: _menucssmistica.menuTransitionClasses,
|
|
360
360
|
mountOnEnter: !0,
|
|
361
361
|
unmountOnExit: !0,
|
|
362
|
-
onExit: ()=>
|
|
362
|
+
onExit: ()=>n == null ? void 0 : n.focus(),
|
|
363
363
|
children: /* @__PURE__ */ (0, _jsxruntime.jsx)(_overlay.default, {
|
|
364
364
|
onPress: (a)=>{
|
|
365
365
|
(0, _dom.cancelEvent)(a), p(!1);
|
|
@@ -382,7 +382,7 @@ const Ee = 120, Q = /*#__PURE__*/ _react.createContext({
|
|
|
382
382
|
role: "menu",
|
|
383
383
|
children: /* @__PURE__ */ (0, _jsxruntime.jsx)(Q.Provider, {
|
|
384
384
|
value: {
|
|
385
|
-
isMenuOpen:
|
|
385
|
+
isMenuOpen: s,
|
|
386
386
|
focusedItem: c,
|
|
387
387
|
setFocusedItem: h,
|
|
388
388
|
closeMenu: ()=>p(!1)
|
package/dist/package-version.js
CHANGED
package/dist/tabs.js
CHANGED
|
@@ -115,7 +115,7 @@ function _object_spread_props(target, source) {
|
|
|
115
115
|
}
|
|
116
116
|
return target;
|
|
117
117
|
}
|
|
118
|
-
const
|
|
118
|
+
const f = (0, _platform.isRunningAcceptanceTest)() ? 0 : 300, q = (i)=>{
|
|
119
119
|
switch(i){
|
|
120
120
|
case 1:
|
|
121
121
|
case 2:
|
|
@@ -129,10 +129,10 @@ const d = (0, _platform.isRunningAcceptanceTest)() ? 0 : 300, q = (i)=>{
|
|
|
129
129
|
const { textPresets: r } = (0, _hooks.useTheme)(), l = (0, _hooks.useAriaId)(), { ref: A } = (0, _hooks.useElementDimensions)(), b = _react.useRef(null), h = _react.useRef(null), [p, L] = _react.useState(!1), N = (o, c)=>{
|
|
130
130
|
const s = document.querySelector(`[id='${l}'] [data-tabindex="${o}"]`), n = document.querySelector(`[id='${l}'] [data-tabindex="${c}"]`), e = b.current, a = h.current;
|
|
131
131
|
s && n && e && a && (L(!0), e.style.display = "block", e.style.width = `${s.offsetWidth}px`, e.style.transform = `translate(${s.offsetLeft - a.scrollLeft}px, 0)`, Promise.resolve().then(()=>{
|
|
132
|
-
e.style.transition = `transform ${
|
|
132
|
+
e.style.transition = `transform ${f}ms, width ${f}ms`, e.style.width = `${n.offsetWidth}px`, e.style.transform = `translate(${n.offsetLeft - a.scrollLeft}px, 0)`;
|
|
133
133
|
}), setTimeout(()=>{
|
|
134
134
|
e.style.transition = "", e.style.display = "none", L(!1);
|
|
135
|
-
},
|
|
135
|
+
}, f));
|
|
136
136
|
};
|
|
137
137
|
return /* @__PURE__ */ (0, _jsxruntime.jsx)("div", _object_spread_props(_object_spread({
|
|
138
138
|
id: l,
|
|
@@ -175,6 +175,7 @@ const d = (0, _platform.isRunningAcceptanceTest)() ? 0 : 300, q = (i)=>{
|
|
|
175
175
|
children: s
|
|
176
176
|
}),
|
|
177
177
|
/* @__PURE__ */ (0, _jsxruntime.jsx)(_text.Text, {
|
|
178
|
+
as: "div",
|
|
178
179
|
desktopSize: r.tabsLabel.size.desktop,
|
|
179
180
|
mobileSize: r.tabsLabel.size.mobile,
|
|
180
181
|
desktopLineHeight: r.tabsLabel.lineHeight.desktop,
|
package/dist/touchable.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ interface CommonProps {
|
|
|
14
14
|
'aria-checked'?: 'true' | 'false' | boolean;
|
|
15
15
|
'aria-controls'?: string;
|
|
16
16
|
'aria-expanded'?: 'true' | 'false' | boolean;
|
|
17
|
+
'aria-haspopup'?: 'true' | 'false' | 'menu' | 'dialog' | boolean;
|
|
17
18
|
'aria-hidden'?: 'true' | 'false' | boolean;
|
|
18
19
|
'aria-selected'?: 'true' | 'false' | boolean;
|
|
19
20
|
'aria-labelledby'?: string;
|
package/dist/touchable.js
CHANGED
|
@@ -126,8 +126,8 @@ const L = function(e) {
|
|
|
126
126
|
t ? window.open(e, "_blank") : d ? window.open(e, "_top") : document.location.href = e;
|
|
127
127
|
}, T = /*#__PURE__*/ _react.forwardRef((e, t)=>{
|
|
128
128
|
const { texts: d , analytics: v , platformOverrides: N , Link: P , useHrefDecorator: E } = (0, _hooks.useTheme)(), C = E(), f = _react.useRef(!1);
|
|
129
|
-
let
|
|
130
|
-
e.trackingEvent && (Array.isArray(e.trackingEvent) ?
|
|
129
|
+
let l = [];
|
|
130
|
+
e.trackingEvent && (Array.isArray(e.trackingEvent) ? l = e.trackingEvent : l = [
|
|
131
131
|
e.trackingEvent
|
|
132
132
|
]);
|
|
133
133
|
var _e_to_pathname;
|
|
@@ -140,28 +140,29 @@ const L = function(e) {
|
|
|
140
140
|
"aria-disabled": e.disabled ? !0 : void 0,
|
|
141
141
|
"aria-controls": e["aria-controls"],
|
|
142
142
|
"aria-expanded": e["aria-expanded"],
|
|
143
|
+
"aria-haspopup": e["aria-haspopup"],
|
|
143
144
|
"aria-hidden": e["aria-hidden"],
|
|
144
145
|
"aria-selected": e["aria-selected"],
|
|
145
146
|
"aria-live": e["aria-live"],
|
|
146
147
|
tabIndex: e.tabIndex
|
|
147
|
-
}, (0, _dom.getPrefixedDataAttributes)(e.dataAttributes, "Touchable")), u = e.type ? e.type : "button", r = !!e.href && !!e.newTab, m = !r && !!e.href && !!e.loadOnTop,
|
|
148
|
+
}, (0, _dom.getPrefixedDataAttributes)(e.dataAttributes, "Touchable")), u = e.type ? e.type : "button", r = !!e.href && !!e.newTab, m = !r && !!e.href && !!e.loadOnTop, s = (a)=>{
|
|
148
149
|
e.stopPropagation && a.stopPropagation();
|
|
149
150
|
}, h = (a)=>{
|
|
150
151
|
e.onPress && e.onPress(a);
|
|
151
|
-
}, k = ()=>e.href ? C(e.href) : e.to && e.fullPageOnWebView ? typeof e.to == "string" ? e.to : (_e_to_pathname = e.to.pathname) !== null && _e_to_pathname !== void 0 ? _e_to_pathname : "" : "", y = ()=>Promise.all(
|
|
152
|
+
}, k = ()=>e.href ? C(e.href) : e.to && e.fullPageOnWebView ? typeof e.to == "string" ? e.to : (_e_to_pathname = e.to.pathname) !== null && _e_to_pathname !== void 0 ? _e_to_pathname : "" : "", y = ()=>Promise.all(l.map((a)=>v.logEvent(a))), g = (a)=>{
|
|
152
153
|
f.current || (f.current = !0, y().finally(()=>{
|
|
153
154
|
f.current = !1, a();
|
|
154
155
|
}));
|
|
155
156
|
}, x = (a)=>{
|
|
156
|
-
if (
|
|
157
|
+
if (s(a), !l.length) {
|
|
157
158
|
h(a);
|
|
158
159
|
return;
|
|
159
160
|
}
|
|
160
161
|
g(()=>h(a));
|
|
161
162
|
}, R = (a)=>{
|
|
162
|
-
|
|
163
|
+
s(a), l.length && (a.preventDefault(), g(()=>L(k(), r, m)));
|
|
163
164
|
}, D = (a)=>{
|
|
164
|
-
|
|
165
|
+
s(a), y();
|
|
165
166
|
}, w = (a)=>{
|
|
166
167
|
(a.keyCode === _keycodes.ENTER || a.keyCode === _keycodes.SPACE) && (a.preventDefault(), a.currentTarget.click());
|
|
167
168
|
};
|