@dloizides/ui-layout 1.36.1 → 1.38.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/CHANGELOG.md +7 -0
- package/dist/index.d.mts +34 -2
- package/dist/index.d.ts +34 -2
- package/dist/index.js +463 -383
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +384 -308
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React12 = require('react');
|
|
4
4
|
var reactNative = require('react-native');
|
|
5
5
|
var uiFeedback = require('@dloizides/ui-feedback');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
-
var
|
|
7
|
+
var uiButtons = require('@dloizides/ui-buttons');
|
|
8
|
+
var uiIcons = require('@dloizides/ui-icons');
|
|
8
9
|
var uiMotion = require('@dloizides/ui-motion');
|
|
10
|
+
var a11y = require('@dloizides/a11y');
|
|
9
11
|
var reactDom = require('react-dom');
|
|
10
12
|
var designTokens = require('@dloizides/design-tokens');
|
|
11
|
-
var uiIcons = require('@dloizides/ui-icons');
|
|
12
|
-
var uiButtons = require('@dloizides/ui-buttons');
|
|
13
13
|
var rnWebHooks = require('@dloizides/rn-web-hooks');
|
|
14
14
|
|
|
15
15
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var React12__default = /*#__PURE__*/_interopDefault(React12);
|
|
18
18
|
|
|
19
19
|
// src/Section/Section.tsx
|
|
20
20
|
|
|
@@ -44,7 +44,7 @@ var Section = ({
|
|
|
44
44
|
const { theme } = uiFeedback.useUi();
|
|
45
45
|
const isCard = variant === "card" /* Card */;
|
|
46
46
|
const fill = isCard ? theme.colors.background : theme.colors.surface;
|
|
47
|
-
const containerStyle =
|
|
47
|
+
const containerStyle = React12__default.default.useMemo(
|
|
48
48
|
() => [styles.card, isCard ? styles.raised : null, { borderColor: theme.colors.border, backgroundColor: fill }, style],
|
|
49
49
|
[theme.colors.border, fill, isCard, style]
|
|
50
50
|
);
|
|
@@ -97,6 +97,7 @@ var LAYOUT_TEST_IDS = {
|
|
|
97
97
|
headingText: "heading-text",
|
|
98
98
|
statusLabel: "status-label",
|
|
99
99
|
stickyPreview: "sticky-preview",
|
|
100
|
+
pageFrame: "page-frame",
|
|
100
101
|
upgradePrompt: "upgrade-prompt",
|
|
101
102
|
upgradePromptCta: "upgrade-prompt-cta",
|
|
102
103
|
upgradePromptDismiss: "upgrade-prompt-dismiss",
|
|
@@ -138,6 +139,9 @@ var LAYOUT_I18N = {
|
|
|
138
139
|
closeHeading: "close",
|
|
139
140
|
/** `Modal`: accessible name + web tooltip of the top-right ✕ close button. */
|
|
140
141
|
dialogClose: "common.close",
|
|
142
|
+
/** `PageFrame` (`enlargeable`): accessible name + hint of the preview that opens the full-size page. */
|
|
143
|
+
pageEnlarge: "common.pageEnlarge",
|
|
144
|
+
pageEnlargeHint: "common.pageEnlargeHint",
|
|
141
145
|
/** `ConfirmDialog`: default Confirm button label (overridable via `confirmLabel`) + its hint. */
|
|
142
146
|
confirm: "common.confirm",
|
|
143
147
|
confirmHint: "common.confirmHint",
|
|
@@ -208,7 +212,7 @@ var Heading = ({
|
|
|
208
212
|
testID
|
|
209
213
|
}) => {
|
|
210
214
|
const { theme } = uiFeedback.useUi();
|
|
211
|
-
const headingStyle =
|
|
215
|
+
const headingStyle = React12__default.default.useMemo(
|
|
212
216
|
() => [styles3.heading, { color: theme.colors.text }, style],
|
|
213
217
|
[theme.colors.text, style]
|
|
214
218
|
);
|
|
@@ -263,9 +267,9 @@ var StatusBadge = ({
|
|
|
263
267
|
accessibilityHint
|
|
264
268
|
}) => {
|
|
265
269
|
const { t } = uiFeedback.useUi();
|
|
266
|
-
const dynamicBadge =
|
|
267
|
-
const dashedColor =
|
|
268
|
-
const dynamicText =
|
|
270
|
+
const dynamicBadge = React12.useMemo(() => ({ backgroundColor }), [backgroundColor]);
|
|
271
|
+
const dashedColor = React12.useMemo(() => ({ borderColor: color }), [color]);
|
|
272
|
+
const dynamicText = React12.useMemo(() => ({ color }), [color]);
|
|
269
273
|
const hasIcon = icon !== void 0 && icon !== null;
|
|
270
274
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
271
275
|
reactNative.View,
|
|
@@ -285,9 +289,9 @@ function isPastStickyLine(sentinelTop, isIntersecting, topOffset) {
|
|
|
285
289
|
return !isIntersecting && sentinelTop < topOffset;
|
|
286
290
|
}
|
|
287
291
|
function useStuckSentinel(topOffset) {
|
|
288
|
-
const sentinelRef =
|
|
289
|
-
const [isStuck, setIsStuck] =
|
|
290
|
-
|
|
292
|
+
const sentinelRef = React12.useRef(null);
|
|
293
|
+
const [isStuck, setIsStuck] = React12.useState(false);
|
|
294
|
+
React12.useEffect(() => {
|
|
291
295
|
const node = sentinelRef.current;
|
|
292
296
|
if (node === null || typeof IntersectionObserver === "undefined") return void 0;
|
|
293
297
|
const observer = new IntersectionObserver(
|
|
@@ -308,9 +312,9 @@ function isKeyboardOpen(visibleHeight, tallestHeight) {
|
|
|
308
312
|
return visibleHeight < tallestHeight * KEYBOARD_HEIGHT_RATIO;
|
|
309
313
|
}
|
|
310
314
|
function useVisibleViewport() {
|
|
311
|
-
const [state, setState] =
|
|
312
|
-
const tallest =
|
|
313
|
-
|
|
315
|
+
const [state, setState] = React12.useState(INITIAL);
|
|
316
|
+
const tallest = React12.useRef({ width: 0, height: 0 });
|
|
317
|
+
React12.useEffect(() => {
|
|
314
318
|
const viewport = typeof window === "undefined" ? void 0 : window.visualViewport;
|
|
315
319
|
if (viewport === void 0 || viewport === null) return void 0;
|
|
316
320
|
const read = () => {
|
|
@@ -353,7 +357,7 @@ var StickyPreview = ({
|
|
|
353
357
|
const { offsetTop, keyboardOpen } = useVisibleViewport();
|
|
354
358
|
const { sentinelRef, isStuck } = useStuckSentinel(topOffset);
|
|
355
359
|
const isCompact = forceCompact || isStuck || keyboardOpen;
|
|
356
|
-
const pinned =
|
|
360
|
+
const pinned = React12.useMemo(() => {
|
|
357
361
|
const web = { position: "sticky", top: topOffset + offsetTop, zIndex: STICKY_Z_INDEX };
|
|
358
362
|
return reactNative.Platform.OS === WEB_PLATFORM ? web : {};
|
|
359
363
|
}, [offsetTop, topOffset]);
|
|
@@ -376,6 +380,283 @@ var StickyPreview = ({
|
|
|
376
380
|
)
|
|
377
381
|
] });
|
|
378
382
|
};
|
|
383
|
+
function useEscapeKey(enabled, onClose) {
|
|
384
|
+
React12.useEffect(() => {
|
|
385
|
+
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
386
|
+
const onKeyDown = (event) => {
|
|
387
|
+
if (event.key === "Escape") onClose();
|
|
388
|
+
};
|
|
389
|
+
document.addEventListener("keydown", onKeyDown);
|
|
390
|
+
return () => {
|
|
391
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
392
|
+
};
|
|
393
|
+
}, [enabled, onClose]);
|
|
394
|
+
}
|
|
395
|
+
var FOCUSABLE_SELECTOR = [
|
|
396
|
+
"a[href]",
|
|
397
|
+
"button:not([disabled])",
|
|
398
|
+
"input:not([disabled])",
|
|
399
|
+
"select:not([disabled])",
|
|
400
|
+
"textarea:not([disabled])",
|
|
401
|
+
'[tabindex]:not([tabindex="-1"])'
|
|
402
|
+
].join(", ");
|
|
403
|
+
function getFocusableElements(container) {
|
|
404
|
+
return Array.from(container.querySelectorAll(FOCUSABLE_SELECTOR));
|
|
405
|
+
}
|
|
406
|
+
function savePreviousFocus() {
|
|
407
|
+
return document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
408
|
+
}
|
|
409
|
+
function focusInitial(domNode, initialFocusTestID) {
|
|
410
|
+
const named = initialFocusTestID === void 0 ? null : domNode.querySelector(`[data-testid="${initialFocusTestID}"]`);
|
|
411
|
+
if (named) {
|
|
412
|
+
named.focus();
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
if (domNode.contains(document.activeElement)) return;
|
|
416
|
+
getFocusableElements(domNode)[0]?.focus();
|
|
417
|
+
}
|
|
418
|
+
function handleKeyDown(domNode, event) {
|
|
419
|
+
if (event.key !== "Tab") return;
|
|
420
|
+
const focusable = getFocusableElements(domNode);
|
|
421
|
+
if (focusable.length === 0) {
|
|
422
|
+
event.preventDefault();
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
const first = focusable[0];
|
|
426
|
+
const last = focusable[focusable.length - 1];
|
|
427
|
+
if (!first || !last) {
|
|
428
|
+
event.preventDefault();
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
const active = document.activeElement;
|
|
432
|
+
if (event.shiftKey && active === first) {
|
|
433
|
+
event.preventDefault();
|
|
434
|
+
last.focus();
|
|
435
|
+
} else if (!event.shiftKey && active === last) {
|
|
436
|
+
event.preventDefault();
|
|
437
|
+
first.focus();
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
function useFocusTrap(containerRef, enabled, initialFocusTestID) {
|
|
441
|
+
const previousFocusRef = React12.useRef(null);
|
|
442
|
+
React12.useEffect(() => {
|
|
443
|
+
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
444
|
+
const domNode = containerRef.current;
|
|
445
|
+
if (!domNode) return;
|
|
446
|
+
const previous = savePreviousFocus();
|
|
447
|
+
previousFocusRef.current = previous !== null && domNode.contains(previous) ? null : previous;
|
|
448
|
+
queueMicrotask(() => focusInitial(domNode, initialFocusTestID));
|
|
449
|
+
const listener = (e) => handleKeyDown(domNode, e);
|
|
450
|
+
domNode.addEventListener("keydown", listener);
|
|
451
|
+
return () => {
|
|
452
|
+
domNode.removeEventListener("keydown", listener);
|
|
453
|
+
previousFocusRef.current?.focus();
|
|
454
|
+
previousFocusRef.current = null;
|
|
455
|
+
};
|
|
456
|
+
}, [containerRef, enabled, initialFocusTestID]);
|
|
457
|
+
}
|
|
458
|
+
function useScrollLock(enabled) {
|
|
459
|
+
React12.useEffect(() => {
|
|
460
|
+
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
461
|
+
const { body } = document;
|
|
462
|
+
const previousOverflow = body.style.overflow;
|
|
463
|
+
body.style.overflow = "hidden";
|
|
464
|
+
return () => {
|
|
465
|
+
body.style.overflow = previousOverflow;
|
|
466
|
+
};
|
|
467
|
+
}, [enabled]);
|
|
468
|
+
}
|
|
469
|
+
var OVERLAY_PADDING = 16;
|
|
470
|
+
var DIALOG_RADIUS = 12;
|
|
471
|
+
var DIALOG_PADDING = 16;
|
|
472
|
+
var HEADER_GAP = 12;
|
|
473
|
+
var FOOTER_MARGIN = 16;
|
|
474
|
+
var HEADER_MARGIN = 12;
|
|
475
|
+
var DIALOG_MAX_HEIGHT = "90%";
|
|
476
|
+
var PANEL_ENTER_SCALE = 0.96;
|
|
477
|
+
var SIZE_MAX_WIDTH = { sm: 360, md: 480, lg: 640, xl: 880 };
|
|
478
|
+
var styles6 = reactNative.StyleSheet.create({
|
|
479
|
+
overlay: {
|
|
480
|
+
flex: 1,
|
|
481
|
+
justifyContent: "center",
|
|
482
|
+
alignItems: "center",
|
|
483
|
+
padding: OVERLAY_PADDING
|
|
484
|
+
},
|
|
485
|
+
// The scrim is its OWN animated layer (behind the tap-catcher and the panel) so its opacity
|
|
486
|
+
// can fade independently of the panel's fade+scale. `animationType` is a native-only no-op on
|
|
487
|
+
// react-native-web, which is why the fade is driven by `Animated` instead. `pointerEvents` lives
|
|
488
|
+
// in style (not the deprecated prop) so taps fall through to the sibling tap-catcher below.
|
|
489
|
+
scrim: { backgroundColor: uiFeedback.MODAL_OVERLAY_COLOR, pointerEvents: "none" },
|
|
490
|
+
dialog: {
|
|
491
|
+
width: "100%",
|
|
492
|
+
borderRadius: DIALOG_RADIUS,
|
|
493
|
+
padding: DIALOG_PADDING,
|
|
494
|
+
maxHeight: DIALOG_MAX_HEIGHT
|
|
495
|
+
},
|
|
496
|
+
headerRow: {
|
|
497
|
+
flexDirection: "row",
|
|
498
|
+
alignItems: "flex-start",
|
|
499
|
+
justifyContent: "space-between",
|
|
500
|
+
columnGap: HEADER_GAP,
|
|
501
|
+
marginBottom: HEADER_MARGIN
|
|
502
|
+
},
|
|
503
|
+
// Occupies the header's leading space so the ✕ pins to the trailing edge even without a title.
|
|
504
|
+
titleWrap: { flex: 1 },
|
|
505
|
+
footer: { marginTop: FOOTER_MARGIN }
|
|
506
|
+
});
|
|
507
|
+
var Modal = ({
|
|
508
|
+
visible,
|
|
509
|
+
onClose,
|
|
510
|
+
title,
|
|
511
|
+
children,
|
|
512
|
+
footer,
|
|
513
|
+
size = "md",
|
|
514
|
+
showClose = true,
|
|
515
|
+
testID = LAYOUT_TEST_IDS.modal,
|
|
516
|
+
accessibilityLabel,
|
|
517
|
+
initialFocusTestID
|
|
518
|
+
}) => {
|
|
519
|
+
const { theme, t } = uiFeedback.useUi();
|
|
520
|
+
const dialogRef = React12.useRef(null);
|
|
521
|
+
const backdrop = uiMotion.useEnterExit({ visible });
|
|
522
|
+
const panel = uiMotion.useEnterExit({ visible, fromScale: PANEL_ENTER_SCALE });
|
|
523
|
+
const mounted = panel.mounted || backdrop.mounted;
|
|
524
|
+
useFocusTrap(dialogRef, visible, initialFocusTestID);
|
|
525
|
+
useEscapeKey(visible, onClose);
|
|
526
|
+
useScrollLock(visible);
|
|
527
|
+
const accessibleName = accessibilityLabel ?? title ?? t(LAYOUT_I18N.dialog);
|
|
528
|
+
const closeLabel = t(LAYOUT_I18N.dialogClose);
|
|
529
|
+
const dialogStyle = React12.useMemo(
|
|
530
|
+
() => [styles6.dialog, { backgroundColor: theme.colors.surface, maxWidth: SIZE_MAX_WIDTH[size] }],
|
|
531
|
+
[theme.colors.surface, size]
|
|
532
|
+
);
|
|
533
|
+
const hasHeader = title !== void 0 || showClose;
|
|
534
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, visible: mounted, onRequestClose: onClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles6.overlay, children: [
|
|
535
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
536
|
+
reactNative.Animated.View,
|
|
537
|
+
{
|
|
538
|
+
style: [reactNative.StyleSheet.absoluteFill, styles6.scrim, { opacity: backdrop.style.opacity }]
|
|
539
|
+
}
|
|
540
|
+
),
|
|
541
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
542
|
+
reactNative.TouchableOpacity,
|
|
543
|
+
{
|
|
544
|
+
accessible: true,
|
|
545
|
+
accessibilityHint: t(LAYOUT_I18N.dismissDropdownHint),
|
|
546
|
+
accessibilityLabel: t(LAYOUT_I18N.dismissDropdown),
|
|
547
|
+
accessibilityRole: "button",
|
|
548
|
+
activeOpacity: 1,
|
|
549
|
+
style: reactNative.StyleSheet.absoluteFill,
|
|
550
|
+
testID: `${testID}-backdrop`,
|
|
551
|
+
onPress: onClose
|
|
552
|
+
}
|
|
553
|
+
),
|
|
554
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
555
|
+
reactNative.Animated.View,
|
|
556
|
+
{
|
|
557
|
+
ref: dialogRef,
|
|
558
|
+
accessibilityViewIsModal: true,
|
|
559
|
+
"aria-label": accessibleName,
|
|
560
|
+
role: "dialog",
|
|
561
|
+
style: [dialogStyle, panel.style],
|
|
562
|
+
testID,
|
|
563
|
+
children: [
|
|
564
|
+
hasHeader ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles6.headerRow, children: [
|
|
565
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles6.titleWrap, children: title !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(Heading, { children: title }) : null }),
|
|
566
|
+
showClose ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
567
|
+
uiButtons.IconButton,
|
|
568
|
+
{
|
|
569
|
+
accessibilityHint: t(LAYOUT_I18N.closeDialogHint),
|
|
570
|
+
accessibilityLabel: closeLabel,
|
|
571
|
+
appearance: "ghost",
|
|
572
|
+
renderIcon: (color, iconSize) => /* @__PURE__ */ jsxRuntime.jsx(uiIcons.SvgIcon, { color, name: "close", size: iconSize }),
|
|
573
|
+
size: "md",
|
|
574
|
+
testID: `${testID}-close`,
|
|
575
|
+
tooltip: closeLabel,
|
|
576
|
+
variant: "ghost",
|
|
577
|
+
onPress: onClose
|
|
578
|
+
}
|
|
579
|
+
) : null
|
|
580
|
+
] }) : null,
|
|
581
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { children }),
|
|
582
|
+
footer !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles6.footer, children: footer }) : null
|
|
583
|
+
]
|
|
584
|
+
}
|
|
585
|
+
)
|
|
586
|
+
] }) });
|
|
587
|
+
};
|
|
588
|
+
var PageOverlay = ({ children, pageSize, visible, onClose, testID }) => {
|
|
589
|
+
const { t } = uiFeedback.useUi();
|
|
590
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Modal, { accessibilityLabel: t(LAYOUT_I18N.pageEnlarge), size: "xl", testID, visible, onClose, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { horizontal: true, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: { width: pageSize.width, height: pageSize.height }, testID: `${testID}-page`, children }) }) });
|
|
591
|
+
};
|
|
592
|
+
|
|
593
|
+
// src/PageFrame/utils/pageScale.ts
|
|
594
|
+
var HALF = 2;
|
|
595
|
+
var A4_PAGE = { width: 794, height: 1123 };
|
|
596
|
+
var pageScale = (containerWidth, pageWidth) => {
|
|
597
|
+
if (containerWidth <= 0 || pageWidth <= 0) return 1;
|
|
598
|
+
return Math.min(1, containerWidth / pageWidth);
|
|
599
|
+
};
|
|
600
|
+
var scaledFrame = (containerWidth, page) => {
|
|
601
|
+
const scale = pageScale(containerWidth, page.width);
|
|
602
|
+
return {
|
|
603
|
+
scale,
|
|
604
|
+
height: page.height * scale,
|
|
605
|
+
offsetX: (scale - 1) * page.width / HALF,
|
|
606
|
+
offsetY: (scale - 1) * page.height / HALF
|
|
607
|
+
};
|
|
608
|
+
};
|
|
609
|
+
var styles7 = reactNative.StyleSheet.create({
|
|
610
|
+
outer: { width: "100%", overflow: "hidden" },
|
|
611
|
+
page: { position: "absolute", top: 0, left: 0 },
|
|
612
|
+
trigger: { width: "100%", cursor: "pointer" }
|
|
613
|
+
});
|
|
614
|
+
var PageFrame = ({
|
|
615
|
+
children,
|
|
616
|
+
pageSize = A4_PAGE,
|
|
617
|
+
testID = LAYOUT_TEST_IDS.pageFrame,
|
|
618
|
+
enlargeable = false
|
|
619
|
+
}) => {
|
|
620
|
+
const { t } = uiFeedback.useUi();
|
|
621
|
+
const [containerWidth, setContainerWidth] = React12.useState(0);
|
|
622
|
+
const [enlarged, setEnlarged] = React12.useState(false);
|
|
623
|
+
const onLayout = React12.useCallback((event) => {
|
|
624
|
+
setContainerWidth(event.nativeEvent.layout.width);
|
|
625
|
+
}, []);
|
|
626
|
+
const open = React12.useCallback(() => setEnlarged(true), []);
|
|
627
|
+
const close = React12.useCallback(() => setEnlarged(false), []);
|
|
628
|
+
const frame = scaledFrame(containerWidth, pageSize);
|
|
629
|
+
const preview = /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles7.outer, { height: frame.height }], testID, onLayout, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
630
|
+
reactNative.View,
|
|
631
|
+
{
|
|
632
|
+
style: [
|
|
633
|
+
styles7.page,
|
|
634
|
+
{
|
|
635
|
+
width: pageSize.width,
|
|
636
|
+
height: pageSize.height,
|
|
637
|
+
transform: [{ translateX: frame.offsetX }, { translateY: frame.offsetY }, { scale: frame.scale }]
|
|
638
|
+
}
|
|
639
|
+
],
|
|
640
|
+
children
|
|
641
|
+
}
|
|
642
|
+
) });
|
|
643
|
+
if (!enlargeable) return preview;
|
|
644
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
645
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
646
|
+
reactNative.Pressable,
|
|
647
|
+
{
|
|
648
|
+
accessibilityHint: t(LAYOUT_I18N.pageEnlargeHint),
|
|
649
|
+
accessibilityLabel: t(LAYOUT_I18N.pageEnlarge),
|
|
650
|
+
accessibilityRole: "button",
|
|
651
|
+
style: styles7.trigger,
|
|
652
|
+
testID: `${testID}-enlarge`,
|
|
653
|
+
onPress: open,
|
|
654
|
+
children: preview
|
|
655
|
+
}
|
|
656
|
+
),
|
|
657
|
+
/* @__PURE__ */ jsxRuntime.jsx(PageOverlay, { pageSize, testID: `${testID}-overlay`, visible: enlarged, onClose: close, children })
|
|
658
|
+
] });
|
|
659
|
+
};
|
|
379
660
|
var TRACK_PADDING = 3;
|
|
380
661
|
var TRACK_RADIUS = 999;
|
|
381
662
|
var SEGMENT_RADIUS = 999;
|
|
@@ -387,7 +668,7 @@ var BORDER_WIDTH = 1;
|
|
|
387
668
|
var SEGMENT_BOX_SHADOW = "0px 1px 3px rgba(20, 30, 50, 0.1)";
|
|
388
669
|
var SHADOW_ELEVATION = 2;
|
|
389
670
|
var TRANSPARENT = "transparent";
|
|
390
|
-
var
|
|
671
|
+
var styles8 = reactNative.StyleSheet.create({
|
|
391
672
|
track: {
|
|
392
673
|
flexDirection: "row",
|
|
393
674
|
alignSelf: "flex-start",
|
|
@@ -432,7 +713,7 @@ function SegmentedControl({
|
|
|
432
713
|
{
|
|
433
714
|
accessibilityRole: "tablist",
|
|
434
715
|
"aria-label": accessibilityLabel,
|
|
435
|
-
style: [
|
|
716
|
+
style: [styles8.track, { backgroundColor: colors.background, borderColor: colors.border }, style],
|
|
436
717
|
testID,
|
|
437
718
|
children: options.map((opt) => {
|
|
438
719
|
const selected = opt.value === value;
|
|
@@ -445,13 +726,13 @@ function SegmentedControl({
|
|
|
445
726
|
accessibilityHint: opt.accessibilityHint,
|
|
446
727
|
onPress: () => onChange(opt.value),
|
|
447
728
|
style: [
|
|
448
|
-
|
|
449
|
-
selected ?
|
|
729
|
+
styles8.segment,
|
|
730
|
+
selected ? styles8.segmentSelected : null,
|
|
450
731
|
{ backgroundColor: selected ? colors.surface : TRANSPARENT }
|
|
451
732
|
],
|
|
452
733
|
testID: opt.testID,
|
|
453
734
|
...ariaSelectedProps(selected),
|
|
454
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
735
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles8.label, { color: selected ? colors.text : colors.textSecondary }], children: opt.label })
|
|
455
736
|
},
|
|
456
737
|
opt.value
|
|
457
738
|
);
|
|
@@ -466,69 +747,6 @@ var TabsCollapsedTrigger = /* @__PURE__ */ ((TabsCollapsedTrigger2) => {
|
|
|
466
747
|
TabsCollapsedTrigger2["Hamburger"] = "hamburger";
|
|
467
748
|
return TabsCollapsedTrigger2;
|
|
468
749
|
})(TabsCollapsedTrigger || {});
|
|
469
|
-
var FOCUSABLE_SELECTOR = [
|
|
470
|
-
"a[href]",
|
|
471
|
-
"button:not([disabled])",
|
|
472
|
-
"input:not([disabled])",
|
|
473
|
-
"select:not([disabled])",
|
|
474
|
-
"textarea:not([disabled])",
|
|
475
|
-
'[tabindex]:not([tabindex="-1"])'
|
|
476
|
-
].join(", ");
|
|
477
|
-
function getFocusableElements(container) {
|
|
478
|
-
return Array.from(container.querySelectorAll(FOCUSABLE_SELECTOR));
|
|
479
|
-
}
|
|
480
|
-
function savePreviousFocus() {
|
|
481
|
-
return document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
482
|
-
}
|
|
483
|
-
function focusInitial(domNode, initialFocusTestID) {
|
|
484
|
-
const named = initialFocusTestID === void 0 ? null : domNode.querySelector(`[data-testid="${initialFocusTestID}"]`);
|
|
485
|
-
if (named) {
|
|
486
|
-
named.focus();
|
|
487
|
-
return;
|
|
488
|
-
}
|
|
489
|
-
if (domNode.contains(document.activeElement)) return;
|
|
490
|
-
getFocusableElements(domNode)[0]?.focus();
|
|
491
|
-
}
|
|
492
|
-
function handleKeyDown(domNode, event) {
|
|
493
|
-
if (event.key !== "Tab") return;
|
|
494
|
-
const focusable = getFocusableElements(domNode);
|
|
495
|
-
if (focusable.length === 0) {
|
|
496
|
-
event.preventDefault();
|
|
497
|
-
return;
|
|
498
|
-
}
|
|
499
|
-
const first = focusable[0];
|
|
500
|
-
const last = focusable[focusable.length - 1];
|
|
501
|
-
if (!first || !last) {
|
|
502
|
-
event.preventDefault();
|
|
503
|
-
return;
|
|
504
|
-
}
|
|
505
|
-
const active = document.activeElement;
|
|
506
|
-
if (event.shiftKey && active === first) {
|
|
507
|
-
event.preventDefault();
|
|
508
|
-
last.focus();
|
|
509
|
-
} else if (!event.shiftKey && active === last) {
|
|
510
|
-
event.preventDefault();
|
|
511
|
-
first.focus();
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
function useFocusTrap(containerRef, enabled, initialFocusTestID) {
|
|
515
|
-
const previousFocusRef = React11.useRef(null);
|
|
516
|
-
React11.useEffect(() => {
|
|
517
|
-
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
518
|
-
const domNode = containerRef.current;
|
|
519
|
-
if (!domNode) return;
|
|
520
|
-
const previous = savePreviousFocus();
|
|
521
|
-
previousFocusRef.current = previous !== null && domNode.contains(previous) ? null : previous;
|
|
522
|
-
queueMicrotask(() => focusInitial(domNode, initialFocusTestID));
|
|
523
|
-
const listener = (e) => handleKeyDown(domNode, e);
|
|
524
|
-
domNode.addEventListener("keydown", listener);
|
|
525
|
-
return () => {
|
|
526
|
-
domNode.removeEventListener("keydown", listener);
|
|
527
|
-
previousFocusRef.current?.focus();
|
|
528
|
-
previousFocusRef.current = null;
|
|
529
|
-
};
|
|
530
|
-
}, [containerRef, enabled, initialFocusTestID]);
|
|
531
|
-
}
|
|
532
750
|
|
|
533
751
|
// src/ModalDropdown/DropdownVariant.ts
|
|
534
752
|
var DropdownVariant = /* @__PURE__ */ ((DropdownVariant2) => {
|
|
@@ -588,7 +806,7 @@ var HEADING_PADDING_H = 16;
|
|
|
588
806
|
var HEADING_PADDING_TOP = 8;
|
|
589
807
|
var HEADING_PADDING_BOTTOM = 4;
|
|
590
808
|
var HEADING_LETTER_SPACING = 0.5;
|
|
591
|
-
var
|
|
809
|
+
var styles9 = reactNative.StyleSheet.create({
|
|
592
810
|
heading: {
|
|
593
811
|
fontSize: HEADING_FONT_SIZE,
|
|
594
812
|
fontWeight: HEADING_FONT_WEIGHT,
|
|
@@ -604,7 +822,7 @@ var MenuHeading = ({ testID, text }) => {
|
|
|
604
822
|
reactNative.Text,
|
|
605
823
|
{
|
|
606
824
|
accessibilityRole: "header",
|
|
607
|
-
style: [
|
|
825
|
+
style: [styles9.heading, { color: theme.colors.textSecondary }],
|
|
608
826
|
testID: `${testID}-menu-heading`,
|
|
609
827
|
children: text
|
|
610
828
|
}
|
|
@@ -625,7 +843,7 @@ var OPTION_PADDING_V = 12;
|
|
|
625
843
|
var ACCENT_BAR_WIDTH = 3;
|
|
626
844
|
var CHECK_GAP = 8;
|
|
627
845
|
var CHECK_GLYPH = "\u2713";
|
|
628
|
-
var
|
|
846
|
+
var styles10 = reactNative.StyleSheet.create({
|
|
629
847
|
option: {
|
|
630
848
|
paddingHorizontal: OPTION_PADDING_H,
|
|
631
849
|
paddingVertical: OPTION_PADDING_V,
|
|
@@ -657,23 +875,23 @@ var OptionRow = ({
|
|
|
657
875
|
}) => {
|
|
658
876
|
const { theme, t } = uiFeedback.useUi();
|
|
659
877
|
const { colors } = theme;
|
|
660
|
-
const handlePress =
|
|
878
|
+
const handlePress = React12.useCallback(() => {
|
|
661
879
|
onSelect();
|
|
662
880
|
}, [onSelect]);
|
|
663
881
|
const accentColor = theme.palette.primary["500"];
|
|
664
882
|
const isMarked = selectedMarker === "accent-check" /* AccentCheck */;
|
|
665
883
|
const isActive = isSelected || isHighlighted;
|
|
666
884
|
const rowStyle = [
|
|
667
|
-
|
|
668
|
-
isMarked ?
|
|
885
|
+
styles10.option,
|
|
886
|
+
isMarked ? styles10.markedRow : null,
|
|
669
887
|
isActive ? { backgroundColor: colors.surfaceElevated } : null,
|
|
670
888
|
isMarked && isSelected ? { borderLeftColor: accentColor } : null
|
|
671
889
|
];
|
|
672
890
|
const textStyle = [
|
|
673
|
-
|
|
891
|
+
styles10.optionText,
|
|
674
892
|
{ color: colors.text },
|
|
675
|
-
isSelected ?
|
|
676
|
-
isMarked ?
|
|
893
|
+
isSelected ? styles10.selectedText : null,
|
|
894
|
+
isMarked ? styles10.markedText : null
|
|
677
895
|
];
|
|
678
896
|
const selectionProps = asMenuItem ? { "aria-current": isSelected ? "true" : void 0 } : { "aria-selected": isSelected };
|
|
679
897
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -689,7 +907,7 @@ var OptionRow = ({
|
|
|
689
907
|
onPress: handlePress,
|
|
690
908
|
children: [
|
|
691
909
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: textStyle, children: label }),
|
|
692
|
-
isMarked && isSelected ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { "aria-hidden": true, testID: `${testID}-check`, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
910
|
+
isMarked && isSelected ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { "aria-hidden": true, testID: `${testID}-check`, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles10.selectedText, { color: accentColor }], children: CHECK_GLYPH }) }) : null
|
|
693
911
|
]
|
|
694
912
|
}
|
|
695
913
|
);
|
|
@@ -746,8 +964,8 @@ function isSameRect(a, b) {
|
|
|
746
964
|
return a.top === b.top && a.left === b.left && a.width === b.width && a.bottom === b.bottom;
|
|
747
965
|
}
|
|
748
966
|
function useAnchorTracking(containerRef, onOutOfView) {
|
|
749
|
-
const [rect, setRect] =
|
|
750
|
-
|
|
967
|
+
const [rect, setRect] = React12.useState(() => readAnchorRect(containerRef));
|
|
968
|
+
React12.useLayoutEffect(() => {
|
|
751
969
|
if (!IS_WEB) return void 0;
|
|
752
970
|
let frame = null;
|
|
753
971
|
let isDisposed = false;
|
|
@@ -826,7 +1044,7 @@ function buildKeyHandler(params) {
|
|
|
826
1044
|
}
|
|
827
1045
|
function useMenuKeyboard(params) {
|
|
828
1046
|
const { containerRef, menuRef, enabled, onClose } = params;
|
|
829
|
-
|
|
1047
|
+
React12.useEffect(() => {
|
|
830
1048
|
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
831
1049
|
const onKeyDown = buildKeyHandler(params);
|
|
832
1050
|
const onMouseDown = (event) => {
|
|
@@ -847,7 +1065,7 @@ var IS_WEB2 = reactNative.Platform.OS === "web";
|
|
|
847
1065
|
var BORDER_RADIUS2 = 8;
|
|
848
1066
|
var BORDER_WIDTH3 = 1;
|
|
849
1067
|
var MENU_PADDING2 = 4;
|
|
850
|
-
var
|
|
1068
|
+
var styles11 = reactNative.StyleSheet.create({
|
|
851
1069
|
/** Native (in-tree) popover — anchored absolutely just under the trigger. */
|
|
852
1070
|
popover: {
|
|
853
1071
|
position: "absolute",
|
|
@@ -890,27 +1108,27 @@ var InlineMenu = ({
|
|
|
890
1108
|
}) => {
|
|
891
1109
|
const { theme } = uiFeedback.useUi();
|
|
892
1110
|
const { colors } = theme;
|
|
893
|
-
const menuRef =
|
|
1111
|
+
const menuRef = React12.useRef(null);
|
|
894
1112
|
const rect = useAnchorTracking(containerRef, onClose);
|
|
895
|
-
const selectedIndex =
|
|
1113
|
+
const selectedIndex = React12.useMemo(
|
|
896
1114
|
() => Math.max(0, options.findIndex((opt) => opt.value === value)),
|
|
897
1115
|
[options, value]
|
|
898
1116
|
);
|
|
899
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
900
|
-
const handleSelect =
|
|
1117
|
+
const [highlightedIndex, setHighlightedIndex] = React12.useState(() => selectedIndex);
|
|
1118
|
+
const handleSelect = React12.useCallback(
|
|
901
1119
|
(optionValue) => {
|
|
902
1120
|
if (isOpen) onSelect(optionValue);
|
|
903
1121
|
},
|
|
904
1122
|
[isOpen, onSelect]
|
|
905
1123
|
);
|
|
906
|
-
const selectAt =
|
|
1124
|
+
const selectAt = React12.useCallback(
|
|
907
1125
|
(index) => {
|
|
908
1126
|
const option = options[index];
|
|
909
1127
|
if (option !== void 0) handleSelect(option.value);
|
|
910
1128
|
},
|
|
911
1129
|
[options, handleSelect]
|
|
912
1130
|
);
|
|
913
|
-
const selectHighlighted =
|
|
1131
|
+
const selectHighlighted = React12.useCallback(
|
|
914
1132
|
() => {
|
|
915
1133
|
selectAt(highlightedIndex);
|
|
916
1134
|
},
|
|
@@ -925,7 +1143,7 @@ var InlineMenu = ({
|
|
|
925
1143
|
onSelectHighlighted: selectHighlighted,
|
|
926
1144
|
onClose
|
|
927
1145
|
});
|
|
928
|
-
const popoverStyle =
|
|
1146
|
+
const popoverStyle = React12.useMemo(() => {
|
|
929
1147
|
const themed = { borderColor: colors.border, backgroundColor: colors.surface };
|
|
930
1148
|
if (IS_WEB2) {
|
|
931
1149
|
const viewportWidth = typeof window !== "undefined" ? window.innerWidth : 0;
|
|
@@ -934,7 +1152,7 @@ var InlineMenu = ({
|
|
|
934
1152
|
themed
|
|
935
1153
|
];
|
|
936
1154
|
}
|
|
937
|
-
return [
|
|
1155
|
+
return [styles11.popover, { minWidth: menuMinWidth }, themed];
|
|
938
1156
|
}, [colors.border, colors.surface, menuMinWidth, rect]);
|
|
939
1157
|
const menu = /* @__PURE__ */ jsxRuntime.jsx(
|
|
940
1158
|
reactNative.View,
|
|
@@ -949,10 +1167,10 @@ var InlineMenu = ({
|
|
|
949
1167
|
reactNative.Animated.View,
|
|
950
1168
|
{
|
|
951
1169
|
pointerEvents: isOpen ? "auto" : "none",
|
|
952
|
-
style: [
|
|
1170
|
+
style: [styles11.animated, animatedStyle, isOpen ? null : styles11.inert],
|
|
953
1171
|
children: [
|
|
954
1172
|
menuHeading !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(MenuHeading, { testID, text: menuHeading }) : null,
|
|
955
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { style:
|
|
1173
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { style: styles11.scroll, keyboardShouldPersistTaps: "handled", children: options.map((option, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
956
1174
|
OptionRow,
|
|
957
1175
|
{
|
|
958
1176
|
asMenuItem: true,
|
|
@@ -1000,7 +1218,7 @@ var CARET_OPEN_ROTATION = "180deg";
|
|
|
1000
1218
|
var CARET_CLOSED_ROTATION = "0deg";
|
|
1001
1219
|
var POPOVER_ENTER_SCALE = 0.96;
|
|
1002
1220
|
var POPOVER_MOTION_MS = 120;
|
|
1003
|
-
var
|
|
1221
|
+
var styles12 = reactNative.StyleSheet.create({
|
|
1004
1222
|
anchor: { position: "relative" },
|
|
1005
1223
|
container: {
|
|
1006
1224
|
borderWidth: BORDER_WIDTH4,
|
|
@@ -1070,7 +1288,7 @@ var ModalDropdown = ({
|
|
|
1070
1288
|
const { colors } = theme;
|
|
1071
1289
|
const resolvedVariant = useResolvedDropdownVariant(variant);
|
|
1072
1290
|
const isMenu = resolvedVariant === "menu" /* Menu */;
|
|
1073
|
-
const [isOpen, setIsOpen] =
|
|
1291
|
+
const [isOpen, setIsOpen] = React12.useState(false);
|
|
1074
1292
|
const { a11yProps, hintNode } = a11y.useA11y({
|
|
1075
1293
|
label: accessibilityLabel,
|
|
1076
1294
|
hint: accessibilityHint,
|
|
@@ -1078,10 +1296,10 @@ var ModalDropdown = ({
|
|
|
1078
1296
|
state: { expanded: isOpen },
|
|
1079
1297
|
testID
|
|
1080
1298
|
});
|
|
1081
|
-
const anchorRef =
|
|
1082
|
-
const triggerRef =
|
|
1299
|
+
const anchorRef = React12.useRef(null);
|
|
1300
|
+
const triggerRef = React12.useRef(null);
|
|
1083
1301
|
const popupProps = { "aria-haspopup": isMenu ? "menu" : "dialog" };
|
|
1084
|
-
const dialogRef =
|
|
1302
|
+
const dialogRef = React12.useRef(null);
|
|
1085
1303
|
useFocusTrap(dialogRef, isOpen && !isMenu);
|
|
1086
1304
|
const menuAnim = uiMotion.useEnterExit({
|
|
1087
1305
|
visible: isMenu && isOpen,
|
|
@@ -1093,17 +1311,17 @@ var ModalDropdown = ({
|
|
|
1093
1311
|
fromScale: POPOVER_ENTER_SCALE,
|
|
1094
1312
|
duration: POPOVER_MOTION_MS
|
|
1095
1313
|
});
|
|
1096
|
-
const selectedLabel =
|
|
1314
|
+
const selectedLabel = React12.useMemo(() => {
|
|
1097
1315
|
const found = options.find((opt) => opt.value === value);
|
|
1098
1316
|
return found?.label ?? t(LAYOUT_I18N.selectPlaceholder);
|
|
1099
1317
|
}, [options, value, t]);
|
|
1100
|
-
const handleToggle =
|
|
1318
|
+
const handleToggle = React12.useCallback(() => {
|
|
1101
1319
|
setIsOpen((prev) => !prev);
|
|
1102
1320
|
}, []);
|
|
1103
|
-
const handleClose =
|
|
1321
|
+
const handleClose = React12.useCallback(() => {
|
|
1104
1322
|
setIsOpen(false);
|
|
1105
1323
|
}, []);
|
|
1106
|
-
const handleSelect =
|
|
1324
|
+
const handleSelect = React12.useCallback(
|
|
1107
1325
|
(optionValue) => {
|
|
1108
1326
|
onChange(optionValue);
|
|
1109
1327
|
setIsOpen(false);
|
|
@@ -1113,38 +1331,38 @@ var ModalDropdown = ({
|
|
|
1113
1331
|
);
|
|
1114
1332
|
const isHamburger = showHamburger;
|
|
1115
1333
|
const isCaret = showCaret && !isHamburger;
|
|
1116
|
-
const containerStyle =
|
|
1334
|
+
const containerStyle = React12.useMemo(
|
|
1117
1335
|
() => renderTrigger !== void 0 ? void 0 : [
|
|
1118
|
-
|
|
1119
|
-
isHamburger ?
|
|
1336
|
+
styles12.container,
|
|
1337
|
+
isHamburger ? styles12.containerHamburger : isCaret ? styles12.containerMenu : null,
|
|
1120
1338
|
{ borderColor: colors.border, backgroundColor: colors.surface }
|
|
1121
1339
|
],
|
|
1122
1340
|
[colors.border, colors.surface, renderTrigger, isHamburger, isCaret]
|
|
1123
1341
|
);
|
|
1124
|
-
const hamburgerStyle =
|
|
1125
|
-
() => [
|
|
1342
|
+
const hamburgerStyle = React12.useMemo(
|
|
1343
|
+
() => [styles12.hamburger, { color: colors.textSecondary }],
|
|
1126
1344
|
[colors.textSecondary]
|
|
1127
1345
|
);
|
|
1128
|
-
const caretStyle =
|
|
1346
|
+
const caretStyle = React12.useMemo(
|
|
1129
1347
|
() => [
|
|
1130
|
-
|
|
1348
|
+
styles12.caret,
|
|
1131
1349
|
{ color: colors.textSecondary, transform: [{ rotate: isOpen ? CARET_OPEN_ROTATION : CARET_CLOSED_ROTATION }] }
|
|
1132
1350
|
],
|
|
1133
1351
|
[colors.textSecondary, isOpen]
|
|
1134
1352
|
);
|
|
1135
|
-
const optionTestIDFor =
|
|
1353
|
+
const optionTestIDFor = React12.useCallback(
|
|
1136
1354
|
(optionValue) => optionTestID !== void 0 ? optionTestID(optionValue) : `${testID}-option-${String(optionValue)}`,
|
|
1137
1355
|
[optionTestID, testID]
|
|
1138
1356
|
);
|
|
1139
|
-
const anchorStyle =
|
|
1140
|
-
() => [
|
|
1357
|
+
const anchorStyle = React12.useMemo(
|
|
1358
|
+
() => [styles12.anchor, buildAnchorStackStyle(isMenu && isOpen)],
|
|
1141
1359
|
[isMenu, isOpen]
|
|
1142
1360
|
);
|
|
1143
|
-
const modalContentStyle =
|
|
1144
|
-
() => [
|
|
1361
|
+
const modalContentStyle = React12.useMemo(
|
|
1362
|
+
() => [styles12.modalContent, { backgroundColor: colors.surface }],
|
|
1145
1363
|
[colors.surface]
|
|
1146
1364
|
);
|
|
1147
|
-
const renderModalOption =
|
|
1365
|
+
const renderModalOption = React12.useCallback(
|
|
1148
1366
|
({ item }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1149
1367
|
OptionRow,
|
|
1150
1368
|
{
|
|
@@ -1157,16 +1375,16 @@ var ModalDropdown = ({
|
|
|
1157
1375
|
),
|
|
1158
1376
|
[handleSelect, optionTestIDFor, selectedMarker, value]
|
|
1159
1377
|
);
|
|
1160
|
-
const keyExtractor =
|
|
1378
|
+
const keyExtractor = React12.useCallback((item) => String(item.value), []);
|
|
1161
1379
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { ref: anchorRef, style: anchorStyle, children: [
|
|
1162
1380
|
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.TouchableOpacity, { ...a11yProps, ...popupProps, ref: triggerRef, style: containerStyle, onPress: handleToggle, children: [
|
|
1163
1381
|
renderTrigger !== void 0 ? renderTrigger({ label: selectedLabel, isOpen }) : isHamburger ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1164
1382
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: hamburgerStyle, children: HAMBURGER_GLYPH }),
|
|
1165
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [
|
|
1383
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [styles12.selectedText, styles12.selectedTextMenu, { color: colors.text }], children: selectedLabel })
|
|
1166
1384
|
] }) : isCaret ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1167
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [
|
|
1385
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [styles12.selectedText, styles12.selectedTextMenu, { color: colors.text }], children: selectedLabel }),
|
|
1168
1386
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: caretStyle, children: CARET_GLYPH })
|
|
1169
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1387
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles12.selectedText, { color: colors.text }], children: selectedLabel }),
|
|
1170
1388
|
hintNode
|
|
1171
1389
|
] }),
|
|
1172
1390
|
isMenu && menuAnim.mounted ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1187,7 +1405,7 @@ var ModalDropdown = ({
|
|
|
1187
1405
|
onSelect: handleSelect
|
|
1188
1406
|
}
|
|
1189
1407
|
) : null,
|
|
1190
|
-
!isMenu ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, visible: modalAnim.mounted, onRequestClose: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
1408
|
+
!isMenu ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, visible: modalAnim.mounted, onRequestClose: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles12.modalOverlay, children: [
|
|
1191
1409
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1192
1410
|
reactNative.TouchableOpacity,
|
|
1193
1411
|
{
|
|
@@ -1233,11 +1451,11 @@ var TabsMenu = ({
|
|
|
1233
1451
|
collapsedTrigger = "caret" /* Caret */
|
|
1234
1452
|
}) => {
|
|
1235
1453
|
const { t } = uiFeedback.useUi();
|
|
1236
|
-
const options =
|
|
1454
|
+
const options = React12.useMemo(
|
|
1237
1455
|
() => tabs.map((tab) => ({ label: tab.label, value: tab.key })),
|
|
1238
1456
|
[tabs]
|
|
1239
1457
|
);
|
|
1240
|
-
const optionTestID =
|
|
1458
|
+
const optionTestID = React12.useCallback(
|
|
1241
1459
|
(key) => {
|
|
1242
1460
|
const found = tabs.find((tab) => tab.key === key);
|
|
1243
1461
|
return found?.testID ?? `${idPrefix}-tab-${key}`;
|
|
@@ -1280,7 +1498,7 @@ var ROW_PAD_V = 8;
|
|
|
1280
1498
|
var PANEL_PAD_TOP = 16;
|
|
1281
1499
|
var BORDER_WIDTH5 = 1;
|
|
1282
1500
|
var TEXT_ON_PRIMARY = "#ffffff";
|
|
1283
|
-
var
|
|
1501
|
+
var styles13 = reactNative.StyleSheet.create({
|
|
1284
1502
|
root: {
|
|
1285
1503
|
width: "100%"
|
|
1286
1504
|
},
|
|
@@ -1334,7 +1552,7 @@ var WideTabStrip = ({
|
|
|
1334
1552
|
textSecondary,
|
|
1335
1553
|
surfaceElevated,
|
|
1336
1554
|
stripStyle
|
|
1337
|
-
}) => /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [
|
|
1555
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles13.stripOuter, { borderBottomColor: borderColor }], children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityRole: "tablist", "aria-label": accessibilityLabel, style: [styles13.strip, stripStyle], children: tabs.map((tab) => {
|
|
1338
1556
|
const selected = tab.key === activeKey;
|
|
1339
1557
|
const textColor = selected ? TEXT_ON_PRIMARY : textSecondary;
|
|
1340
1558
|
const pillColor = selected ? primaryColor : surfaceElevated;
|
|
@@ -1348,10 +1566,10 @@ var WideTabStrip = ({
|
|
|
1348
1566
|
accessibilityLabel: tab.accessibilityLabel ?? tab.label,
|
|
1349
1567
|
accessibilityHint: tab.accessibilityHint,
|
|
1350
1568
|
onPress: () => onChange(tab.key),
|
|
1351
|
-
style: [
|
|
1569
|
+
style: [styles13.pill, { backgroundColor: pillColor }],
|
|
1352
1570
|
testID: tab.testID,
|
|
1353
1571
|
...ariaTabProps(selected, panelId, tabId),
|
|
1354
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1572
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles13.pillText, { color: textColor }], children: tab.label })
|
|
1355
1573
|
},
|
|
1356
1574
|
tab.key
|
|
1357
1575
|
);
|
|
@@ -1376,7 +1594,7 @@ var Tabs = ({
|
|
|
1376
1594
|
const activePanelId = `${idPrefix}-panel-${activeKey}`;
|
|
1377
1595
|
const activeTabId = `${idPrefix}-tab-${activeKey}`;
|
|
1378
1596
|
const panelAria = { "aria-labelledby": activeTabId, id: activePanelId };
|
|
1379
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [
|
|
1597
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles13.root, style], testID, children: [
|
|
1380
1598
|
collapsed ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1381
1599
|
TabsMenu,
|
|
1382
1600
|
{
|
|
@@ -1403,7 +1621,7 @@ var Tabs = ({
|
|
|
1403
1621
|
onChange
|
|
1404
1622
|
}
|
|
1405
1623
|
),
|
|
1406
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityRole: "none", style: [
|
|
1624
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityRole: "none", style: [styles13.panel, panelStyle], ...panelAria, children })
|
|
1407
1625
|
] });
|
|
1408
1626
|
};
|
|
1409
1627
|
var PROMPT_PADDING = 20;
|
|
@@ -1418,7 +1636,7 @@ var DISMISS_FONT_SIZE = 13;
|
|
|
1418
1636
|
var TITLE_MARGIN_BOTTOM = 8;
|
|
1419
1637
|
var MESSAGE_MARGIN_BOTTOM = 16;
|
|
1420
1638
|
var CTA_MARGIN_BOTTOM = 8;
|
|
1421
|
-
var
|
|
1639
|
+
var styles14 = reactNative.StyleSheet.create({
|
|
1422
1640
|
container: {
|
|
1423
1641
|
padding: PROMPT_PADDING,
|
|
1424
1642
|
borderRadius: PROMPT_BORDER_RADIUS,
|
|
@@ -1453,21 +1671,21 @@ var UpgradePrompt = ({
|
|
|
1453
1671
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1454
1672
|
reactNative.View,
|
|
1455
1673
|
{
|
|
1456
|
-
style: [
|
|
1674
|
+
style: [styles14.container, { borderColor: primary, backgroundColor: colors.surface }],
|
|
1457
1675
|
testID: LAYOUT_TEST_IDS.upgradePrompt,
|
|
1458
1676
|
children: [
|
|
1459
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1460
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1677
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles14.title, { color: colors.text }], children: t(LAYOUT_I18N.upgradePromptTitle) }),
|
|
1678
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles14.message, { color: colors.textSecondary }], children: t(LAYOUT_I18N.upgradePromptMessage, requiredTier, currentTier) }),
|
|
1461
1679
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1462
1680
|
reactNative.TouchableOpacity,
|
|
1463
1681
|
{
|
|
1464
1682
|
accessibilityHint: t(LAYOUT_I18N.upgradePromptCtaHint),
|
|
1465
1683
|
accessibilityLabel: t(LAYOUT_I18N.upgradePromptCta),
|
|
1466
1684
|
accessibilityRole: "button",
|
|
1467
|
-
style: [
|
|
1685
|
+
style: [styles14.cta, { backgroundColor: primary }],
|
|
1468
1686
|
testID: LAYOUT_TEST_IDS.upgradePromptCta,
|
|
1469
1687
|
onPress: handleUpgradePress,
|
|
1470
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1688
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles14.ctaText, { color: colors.surface }], children: t(LAYOUT_I18N.upgradePromptCta) })
|
|
1471
1689
|
}
|
|
1472
1690
|
),
|
|
1473
1691
|
onDismiss ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1476,10 +1694,10 @@ var UpgradePrompt = ({
|
|
|
1476
1694
|
accessibilityHint: t(LAYOUT_I18N.upgradePromptDismissHint),
|
|
1477
1695
|
accessibilityLabel: t(LAYOUT_I18N.upgradePromptDismiss),
|
|
1478
1696
|
accessibilityRole: "button",
|
|
1479
|
-
style:
|
|
1697
|
+
style: styles14.dismiss,
|
|
1480
1698
|
testID: LAYOUT_TEST_IDS.upgradePromptDismiss,
|
|
1481
1699
|
onPress: onDismiss,
|
|
1482
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1700
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles14.dismissText, { color: colors.textSecondary }], children: t(LAYOUT_I18N.upgradePromptDismiss) })
|
|
1483
1701
|
}
|
|
1484
1702
|
) : null
|
|
1485
1703
|
]
|
|
@@ -1487,8 +1705,8 @@ var UpgradePrompt = ({
|
|
|
1487
1705
|
);
|
|
1488
1706
|
};
|
|
1489
1707
|
var CLOSE_ICON_SIZE = 18;
|
|
1490
|
-
var
|
|
1491
|
-
var
|
|
1708
|
+
var PANEL_ENTER_SCALE2 = 0.96;
|
|
1709
|
+
var styles15 = reactNative.StyleSheet.create({
|
|
1492
1710
|
animatedFill: { flex: 1 },
|
|
1493
1711
|
container: {
|
|
1494
1712
|
flex: 1,
|
|
@@ -1513,9 +1731,9 @@ var ModalShell = ({
|
|
|
1513
1731
|
showClose = true
|
|
1514
1732
|
}) => {
|
|
1515
1733
|
const { theme, t } = uiFeedback.useUi();
|
|
1516
|
-
const { style: sheetStyle, mounted } = uiMotion.useEnterExit({ visible, fromScale:
|
|
1517
|
-
const containerStyle =
|
|
1518
|
-
() => [
|
|
1734
|
+
const { style: sheetStyle, mounted } = uiMotion.useEnterExit({ visible, fromScale: PANEL_ENTER_SCALE2 });
|
|
1735
|
+
const containerStyle = React12__default.default.useMemo(
|
|
1736
|
+
() => [styles15.container, { backgroundColor: theme.colors.background }, contentStyle],
|
|
1519
1737
|
[theme.colors.background, contentStyle]
|
|
1520
1738
|
);
|
|
1521
1739
|
const closeA11yLabel = t(LAYOUT_I18N.close);
|
|
@@ -1527,7 +1745,7 @@ var ModalShell = ({
|
|
|
1527
1745
|
testID: LAYOUT_TEST_IDS.modalShell,
|
|
1528
1746
|
visible: mounted,
|
|
1529
1747
|
onRequestClose: onCancel,
|
|
1530
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Animated.View, { style: [
|
|
1748
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Animated.View, { style: [styles15.animatedFill, sheetStyle], children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1531
1749
|
reactNative.ScrollView,
|
|
1532
1750
|
{
|
|
1533
1751
|
accessibilityViewIsModal: true,
|
|
@@ -1535,7 +1753,7 @@ var ModalShell = ({
|
|
|
1535
1753
|
role: "dialog",
|
|
1536
1754
|
style: containerStyle,
|
|
1537
1755
|
children: [
|
|
1538
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
1756
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles15.headerRow, children: [
|
|
1539
1757
|
/* @__PURE__ */ jsxRuntime.jsx(Heading, { children: title ?? t(LAYOUT_I18N.closeHeading) }),
|
|
1540
1758
|
showClose ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1541
1759
|
reactNative.TouchableOpacity,
|
|
@@ -1543,7 +1761,7 @@ var ModalShell = ({
|
|
|
1543
1761
|
accessibilityHint: t(LAYOUT_I18N.closeDialogHint),
|
|
1544
1762
|
accessibilityLabel: closeA11yLabel,
|
|
1545
1763
|
accessibilityRole: "button",
|
|
1546
|
-
style:
|
|
1764
|
+
style: styles15.closeButton,
|
|
1547
1765
|
testID: LAYOUT_TEST_IDS.modalShellClose,
|
|
1548
1766
|
onPress: onCancel,
|
|
1549
1767
|
children: /* @__PURE__ */ jsxRuntime.jsx(uiIcons.SvgIcon, { color: theme.colors.textSecondary, name: "close", size: CLOSE_ICON_SIZE })
|
|
@@ -1557,152 +1775,10 @@ var ModalShell = ({
|
|
|
1557
1775
|
}
|
|
1558
1776
|
);
|
|
1559
1777
|
};
|
|
1560
|
-
function useEscapeKey(enabled, onClose) {
|
|
1561
|
-
React11.useEffect(() => {
|
|
1562
|
-
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
1563
|
-
const onKeyDown = (event) => {
|
|
1564
|
-
if (event.key === "Escape") onClose();
|
|
1565
|
-
};
|
|
1566
|
-
document.addEventListener("keydown", onKeyDown);
|
|
1567
|
-
return () => {
|
|
1568
|
-
document.removeEventListener("keydown", onKeyDown);
|
|
1569
|
-
};
|
|
1570
|
-
}, [enabled, onClose]);
|
|
1571
|
-
}
|
|
1572
|
-
function useScrollLock(enabled) {
|
|
1573
|
-
React11.useEffect(() => {
|
|
1574
|
-
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
1575
|
-
const { body } = document;
|
|
1576
|
-
const previousOverflow = body.style.overflow;
|
|
1577
|
-
body.style.overflow = "hidden";
|
|
1578
|
-
return () => {
|
|
1579
|
-
body.style.overflow = previousOverflow;
|
|
1580
|
-
};
|
|
1581
|
-
}, [enabled]);
|
|
1582
|
-
}
|
|
1583
|
-
var OVERLAY_PADDING = 16;
|
|
1584
|
-
var DIALOG_RADIUS = 12;
|
|
1585
|
-
var DIALOG_PADDING = 16;
|
|
1586
|
-
var HEADER_GAP = 12;
|
|
1587
|
-
var FOOTER_MARGIN = 16;
|
|
1588
|
-
var HEADER_MARGIN = 12;
|
|
1589
|
-
var DIALOG_MAX_HEIGHT = "90%";
|
|
1590
|
-
var PANEL_ENTER_SCALE2 = 0.96;
|
|
1591
|
-
var SIZE_MAX_WIDTH = { sm: 360, md: 480, lg: 640 };
|
|
1592
|
-
var styles14 = reactNative.StyleSheet.create({
|
|
1593
|
-
overlay: {
|
|
1594
|
-
flex: 1,
|
|
1595
|
-
justifyContent: "center",
|
|
1596
|
-
alignItems: "center",
|
|
1597
|
-
padding: OVERLAY_PADDING
|
|
1598
|
-
},
|
|
1599
|
-
// The scrim is its OWN animated layer (behind the tap-catcher and the panel) so its opacity
|
|
1600
|
-
// can fade independently of the panel's fade+scale. `animationType` is a native-only no-op on
|
|
1601
|
-
// react-native-web, which is why the fade is driven by `Animated` instead. `pointerEvents` lives
|
|
1602
|
-
// in style (not the deprecated prop) so taps fall through to the sibling tap-catcher below.
|
|
1603
|
-
scrim: { backgroundColor: uiFeedback.MODAL_OVERLAY_COLOR, pointerEvents: "none" },
|
|
1604
|
-
dialog: {
|
|
1605
|
-
width: "100%",
|
|
1606
|
-
borderRadius: DIALOG_RADIUS,
|
|
1607
|
-
padding: DIALOG_PADDING,
|
|
1608
|
-
maxHeight: DIALOG_MAX_HEIGHT
|
|
1609
|
-
},
|
|
1610
|
-
headerRow: {
|
|
1611
|
-
flexDirection: "row",
|
|
1612
|
-
alignItems: "flex-start",
|
|
1613
|
-
justifyContent: "space-between",
|
|
1614
|
-
columnGap: HEADER_GAP,
|
|
1615
|
-
marginBottom: HEADER_MARGIN
|
|
1616
|
-
},
|
|
1617
|
-
// Occupies the header's leading space so the ✕ pins to the trailing edge even without a title.
|
|
1618
|
-
titleWrap: { flex: 1 },
|
|
1619
|
-
footer: { marginTop: FOOTER_MARGIN }
|
|
1620
|
-
});
|
|
1621
|
-
var Modal3 = ({
|
|
1622
|
-
visible,
|
|
1623
|
-
onClose,
|
|
1624
|
-
title,
|
|
1625
|
-
children,
|
|
1626
|
-
footer,
|
|
1627
|
-
size = "md",
|
|
1628
|
-
showClose = true,
|
|
1629
|
-
testID = LAYOUT_TEST_IDS.modal,
|
|
1630
|
-
accessibilityLabel,
|
|
1631
|
-
initialFocusTestID
|
|
1632
|
-
}) => {
|
|
1633
|
-
const { theme, t } = uiFeedback.useUi();
|
|
1634
|
-
const dialogRef = React11.useRef(null);
|
|
1635
|
-
const backdrop = uiMotion.useEnterExit({ visible });
|
|
1636
|
-
const panel = uiMotion.useEnterExit({ visible, fromScale: PANEL_ENTER_SCALE2 });
|
|
1637
|
-
const mounted = panel.mounted || backdrop.mounted;
|
|
1638
|
-
useFocusTrap(dialogRef, visible, initialFocusTestID);
|
|
1639
|
-
useEscapeKey(visible, onClose);
|
|
1640
|
-
useScrollLock(visible);
|
|
1641
|
-
const accessibleName = accessibilityLabel ?? title ?? t(LAYOUT_I18N.dialog);
|
|
1642
|
-
const closeLabel = t(LAYOUT_I18N.dialogClose);
|
|
1643
|
-
const dialogStyle = React11.useMemo(
|
|
1644
|
-
() => [styles14.dialog, { backgroundColor: theme.colors.surface, maxWidth: SIZE_MAX_WIDTH[size] }],
|
|
1645
|
-
[theme.colors.surface, size]
|
|
1646
|
-
);
|
|
1647
|
-
const hasHeader = title !== void 0 || showClose;
|
|
1648
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, visible: mounted, onRequestClose: onClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles14.overlay, children: [
|
|
1649
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1650
|
-
reactNative.Animated.View,
|
|
1651
|
-
{
|
|
1652
|
-
style: [reactNative.StyleSheet.absoluteFill, styles14.scrim, { opacity: backdrop.style.opacity }]
|
|
1653
|
-
}
|
|
1654
|
-
),
|
|
1655
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1656
|
-
reactNative.TouchableOpacity,
|
|
1657
|
-
{
|
|
1658
|
-
accessible: true,
|
|
1659
|
-
accessibilityHint: t(LAYOUT_I18N.dismissDropdownHint),
|
|
1660
|
-
accessibilityLabel: t(LAYOUT_I18N.dismissDropdown),
|
|
1661
|
-
accessibilityRole: "button",
|
|
1662
|
-
activeOpacity: 1,
|
|
1663
|
-
style: reactNative.StyleSheet.absoluteFill,
|
|
1664
|
-
testID: `${testID}-backdrop`,
|
|
1665
|
-
onPress: onClose
|
|
1666
|
-
}
|
|
1667
|
-
),
|
|
1668
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1669
|
-
reactNative.Animated.View,
|
|
1670
|
-
{
|
|
1671
|
-
ref: dialogRef,
|
|
1672
|
-
accessibilityViewIsModal: true,
|
|
1673
|
-
"aria-label": accessibleName,
|
|
1674
|
-
role: "dialog",
|
|
1675
|
-
style: [dialogStyle, panel.style],
|
|
1676
|
-
testID,
|
|
1677
|
-
children: [
|
|
1678
|
-
hasHeader ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles14.headerRow, children: [
|
|
1679
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles14.titleWrap, children: title !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(Heading, { children: title }) : null }),
|
|
1680
|
-
showClose ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1681
|
-
uiButtons.IconButton,
|
|
1682
|
-
{
|
|
1683
|
-
accessibilityHint: t(LAYOUT_I18N.closeDialogHint),
|
|
1684
|
-
accessibilityLabel: closeLabel,
|
|
1685
|
-
appearance: "ghost",
|
|
1686
|
-
renderIcon: (color, iconSize) => /* @__PURE__ */ jsxRuntime.jsx(uiIcons.SvgIcon, { color, name: "close", size: iconSize }),
|
|
1687
|
-
size: "md",
|
|
1688
|
-
testID: `${testID}-close`,
|
|
1689
|
-
tooltip: closeLabel,
|
|
1690
|
-
variant: "ghost",
|
|
1691
|
-
onPress: onClose
|
|
1692
|
-
}
|
|
1693
|
-
) : null
|
|
1694
|
-
] }) : null,
|
|
1695
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { children }),
|
|
1696
|
-
footer !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles14.footer, children: footer }) : null
|
|
1697
|
-
]
|
|
1698
|
-
}
|
|
1699
|
-
)
|
|
1700
|
-
] }) });
|
|
1701
|
-
};
|
|
1702
1778
|
var MESSAGE_FONT_SIZE2 = 14;
|
|
1703
1779
|
var MESSAGE_LINE_HEIGHT = 20;
|
|
1704
1780
|
var BUTTON_GAP = 12;
|
|
1705
|
-
var
|
|
1781
|
+
var styles16 = reactNative.StyleSheet.create({
|
|
1706
1782
|
message: { fontSize: MESSAGE_FONT_SIZE2, lineHeight: MESSAGE_LINE_HEIGHT },
|
|
1707
1783
|
footer: { flexDirection: "row", justifyContent: "flex-end", columnGap: BUTTON_GAP }
|
|
1708
1784
|
});
|
|
@@ -1721,7 +1797,7 @@ var ConfirmDialog = ({
|
|
|
1721
1797
|
const { theme, t } = uiFeedback.useUi();
|
|
1722
1798
|
const resolvedConfirm = confirmLabel ?? t(LAYOUT_I18N.confirm);
|
|
1723
1799
|
const resolvedCancel = cancelLabel ?? t(LAYOUT_I18N.cancel);
|
|
1724
|
-
const footer = /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
1800
|
+
const footer = /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles16.footer, children: [
|
|
1725
1801
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1726
1802
|
uiButtons.Button,
|
|
1727
1803
|
{
|
|
@@ -1748,7 +1824,7 @@ var ConfirmDialog = ({
|
|
|
1748
1824
|
)
|
|
1749
1825
|
] });
|
|
1750
1826
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1751
|
-
|
|
1827
|
+
Modal,
|
|
1752
1828
|
{
|
|
1753
1829
|
footer,
|
|
1754
1830
|
showClose: false,
|
|
@@ -1757,27 +1833,27 @@ var ConfirmDialog = ({
|
|
|
1757
1833
|
title,
|
|
1758
1834
|
visible,
|
|
1759
1835
|
onClose: onCancel,
|
|
1760
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1836
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles16.message, { color: theme.colors.text }], testID: `${testID}-message`, children: message })
|
|
1761
1837
|
}
|
|
1762
1838
|
);
|
|
1763
1839
|
};
|
|
1764
|
-
var AccordionContext =
|
|
1840
|
+
var AccordionContext = React12.createContext(null);
|
|
1765
1841
|
function useAccordionContext() {
|
|
1766
|
-
const value =
|
|
1842
|
+
const value = React12.useContext(AccordionContext);
|
|
1767
1843
|
if (value === null) {
|
|
1768
1844
|
throw new Error("AccordionItem must be rendered inside an <Accordion>.");
|
|
1769
1845
|
}
|
|
1770
1846
|
return value;
|
|
1771
1847
|
}
|
|
1772
1848
|
var BOXED_GAP = 12;
|
|
1773
|
-
var
|
|
1849
|
+
var styles17 = reactNative.StyleSheet.create({
|
|
1774
1850
|
container: { alignSelf: "stretch" },
|
|
1775
1851
|
boxed: { gap: BOXED_GAP }
|
|
1776
1852
|
});
|
|
1777
1853
|
function computeInitialOpen(children, defaultOpenIds, allowMultiple) {
|
|
1778
1854
|
const ids = new Set(defaultOpenIds ?? []);
|
|
1779
|
-
|
|
1780
|
-
if (!
|
|
1855
|
+
React12__default.default.Children.forEach(children, (child) => {
|
|
1856
|
+
if (!React12__default.default.isValidElement(child)) return;
|
|
1781
1857
|
const props = child.props;
|
|
1782
1858
|
if (props.defaultOpen === true && typeof props.id === "string") {
|
|
1783
1859
|
ids.add(props.id);
|
|
@@ -1800,14 +1876,14 @@ var Accordion = ({
|
|
|
1800
1876
|
style
|
|
1801
1877
|
}) => {
|
|
1802
1878
|
const isControlled = openIds !== void 0;
|
|
1803
|
-
const [internalOpen, setInternalOpen] =
|
|
1879
|
+
const [internalOpen, setInternalOpen] = React12.useState(
|
|
1804
1880
|
() => computeInitialOpen(children, defaultOpenIds, allowMultiple)
|
|
1805
1881
|
);
|
|
1806
|
-
const openSet =
|
|
1882
|
+
const openSet = React12.useMemo(
|
|
1807
1883
|
() => isControlled ? new Set(openIds) : internalOpen,
|
|
1808
1884
|
[isControlled, openIds, internalOpen]
|
|
1809
1885
|
);
|
|
1810
|
-
const toggle =
|
|
1886
|
+
const toggle = React12.useCallback(
|
|
1811
1887
|
(id) => {
|
|
1812
1888
|
const next = new Set(openSet);
|
|
1813
1889
|
const willOpen = !next.has(id);
|
|
@@ -1822,12 +1898,12 @@ var Accordion = ({
|
|
|
1822
1898
|
},
|
|
1823
1899
|
[allowMultiple, isControlled, onOpenChange, openSet]
|
|
1824
1900
|
);
|
|
1825
|
-
const contextValue =
|
|
1901
|
+
const contextValue = React12.useMemo(
|
|
1826
1902
|
() => ({ openIds: openSet, toggle, allowMultiple, variant }),
|
|
1827
1903
|
[openSet, toggle, allowMultiple, variant]
|
|
1828
1904
|
);
|
|
1829
|
-
const containerStyle =
|
|
1830
|
-
const base = variant === "boxed" ? [
|
|
1905
|
+
const containerStyle = React12.useMemo(() => {
|
|
1906
|
+
const base = variant === "boxed" ? [styles17.container, styles17.boxed] : [styles17.container];
|
|
1831
1907
|
if (style === void 0) return base;
|
|
1832
1908
|
return [...base, ...Array.isArray(style) ? style : [style]];
|
|
1833
1909
|
}, [style, variant]);
|
|
@@ -1859,7 +1935,7 @@ var BOX_TITLE_FONT_SIZE = 14;
|
|
|
1859
1935
|
var BOX_MARKER_FONT_SIZE = 13;
|
|
1860
1936
|
var BOX_MARKER_GAP = 6;
|
|
1861
1937
|
var BOX_MARKER = "\u25B8";
|
|
1862
|
-
var
|
|
1938
|
+
var styles18 = reactNative.StyleSheet.create({
|
|
1863
1939
|
item: { borderTopWidth: reactNative.StyleSheet.hairlineWidth },
|
|
1864
1940
|
boxItem: { borderWidth: 1, borderRadius: BOX_BORDER_RADIUS, paddingHorizontal: BOX_PADDING_H },
|
|
1865
1941
|
header: {
|
|
@@ -1905,9 +1981,9 @@ var AccordionItem = ({
|
|
|
1905
1981
|
const headerTestID = testID ?? `accordion-item-${id}`;
|
|
1906
1982
|
const bodyTestID = `${headerTestID}-body`;
|
|
1907
1983
|
const chevronTestID = `${headerTestID}-chevron`;
|
|
1908
|
-
const [rotation] =
|
|
1984
|
+
const [rotation] = React12.useState(() => new reactNative.Animated.Value(expanded ? ROTATE_EXPANDED : ROTATE_COLLAPSED));
|
|
1909
1985
|
const reducedMotion = rnWebHooks.useReducedMotion();
|
|
1910
|
-
|
|
1986
|
+
React12.useEffect(() => {
|
|
1911
1987
|
reactNative.Animated.timing(rotation, {
|
|
1912
1988
|
toValue: expanded ? ROTATE_EXPANDED : ROTATE_COLLAPSED,
|
|
1913
1989
|
duration: reducedMotion ? INSTANT_DURATION_MS : ROTATE_DURATION_MS,
|
|
@@ -1919,10 +1995,10 @@ var AccordionItem = ({
|
|
|
1919
1995
|
inputRange: [ROTATE_COLLAPSED, ROTATE_EXPANDED],
|
|
1920
1996
|
outputRange: [COLLAPSED_DEG, boxed ? BOXED_EXPANDED_DEG : PLAIN_EXPANDED_DEG]
|
|
1921
1997
|
});
|
|
1922
|
-
const handlePress =
|
|
1998
|
+
const handlePress = React12.useCallback(() => {
|
|
1923
1999
|
if (!disabled) toggle(id);
|
|
1924
2000
|
}, [disabled, id, toggle]);
|
|
1925
|
-
const handleKeyDown2 =
|
|
2001
|
+
const handleKeyDown2 = React12.useCallback(
|
|
1926
2002
|
(event) => {
|
|
1927
2003
|
if (disabled) return;
|
|
1928
2004
|
const key = event.key ?? "";
|
|
@@ -1934,20 +2010,20 @@ var AccordionItem = ({
|
|
|
1934
2010
|
[disabled, id, toggle]
|
|
1935
2011
|
);
|
|
1936
2012
|
const keyboardProps = reactNative.Platform.OS === "web" ? { onKeyDown: handleKeyDown2 } : {};
|
|
1937
|
-
const itemStyle =
|
|
1938
|
-
() => boxed ? [
|
|
2013
|
+
const itemStyle = React12.useMemo(
|
|
2014
|
+
() => boxed ? [styles18.boxItem, { borderColor: colors.border }] : [styles18.item, { borderTopColor: colors.border }],
|
|
1939
2015
|
[boxed, colors.border]
|
|
1940
2016
|
);
|
|
1941
|
-
const headerStyle =
|
|
2017
|
+
const headerStyle = React12.useMemo(
|
|
1942
2018
|
() => [
|
|
1943
|
-
|
|
1944
|
-
...boxed ? [
|
|
2019
|
+
styles18.header,
|
|
2020
|
+
...boxed ? [styles18.boxHeader] : [],
|
|
1945
2021
|
{ opacity: disabled ? DISABLED_OPACITY : FULL_OPACITY }
|
|
1946
2022
|
],
|
|
1947
2023
|
[boxed, disabled]
|
|
1948
2024
|
);
|
|
1949
2025
|
const resolvedLabel = accessibilityLabel ?? (typeof title === "string" ? title : void 0);
|
|
1950
|
-
const titleNode = typeof title === "string" ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [boxed ?
|
|
2026
|
+
const titleNode = typeof title === "string" ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [boxed ? styles18.boxTitle : styles18.title, { color: boxed ? colors.textSecondary : colors.text }], children: title }) : title;
|
|
1951
2027
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: itemStyle, children: [
|
|
1952
2028
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1953
2029
|
reactNative.Pressable,
|
|
@@ -1964,7 +2040,7 @@ var AccordionItem = ({
|
|
|
1964
2040
|
onPress: handlePress,
|
|
1965
2041
|
...keyboardProps,
|
|
1966
2042
|
children: [
|
|
1967
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [
|
|
2043
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles18.headerLeft, boxed ? styles18.headerLeftRow : null], children: [
|
|
1968
2044
|
boxed ? (
|
|
1969
2045
|
// Decorative — the open/closed state is already conveyed by aria-expanded on the header.
|
|
1970
2046
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1973,15 +2049,15 @@ var AccordionItem = ({
|
|
|
1973
2049
|
accessibilityElementsHidden: true,
|
|
1974
2050
|
"aria-hidden": true,
|
|
1975
2051
|
importantForAccessibility: "no-hide-descendants",
|
|
1976
|
-
style: [
|
|
2052
|
+
style: [styles18.marker, { transform: [{ rotate }] }],
|
|
1977
2053
|
testID: chevronTestID,
|
|
1978
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
2054
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles18.markerText, { color: colors.textSecondary }], children: BOX_MARKER })
|
|
1979
2055
|
}
|
|
1980
2056
|
)
|
|
1981
2057
|
) : null,
|
|
1982
2058
|
titleNode
|
|
1983
2059
|
] }),
|
|
1984
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
2060
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles18.headerRight, children: [
|
|
1985
2061
|
right,
|
|
1986
2062
|
boxed ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1987
2063
|
reactNative.Animated.View,
|
|
@@ -1989,7 +2065,7 @@ var AccordionItem = ({
|
|
|
1989
2065
|
accessibilityElementsHidden: true,
|
|
1990
2066
|
"aria-hidden": true,
|
|
1991
2067
|
importantForAccessibility: "no-hide-descendants",
|
|
1992
|
-
style: [
|
|
2068
|
+
style: [styles18.chevron, { transform: [{ rotate }] }],
|
|
1993
2069
|
children: /* @__PURE__ */ jsxRuntime.jsx(uiIcons.SvgIcon, { color: colors.textSecondary, name: "chevronDown", size: CHEVRON_SIZE, testID: chevronTestID })
|
|
1994
2070
|
}
|
|
1995
2071
|
)
|
|
@@ -2003,7 +2079,7 @@ var AccordionItem = ({
|
|
|
2003
2079
|
accessibilityLabel: resolvedLabel,
|
|
2004
2080
|
nativeID: bodyTestID,
|
|
2005
2081
|
role: ROLE_REGION,
|
|
2006
|
-
style: boxed ?
|
|
2082
|
+
style: boxed ? styles18.boxBody : styles18.body,
|
|
2007
2083
|
testID: bodyTestID,
|
|
2008
2084
|
children
|
|
2009
2085
|
}
|
|
@@ -2041,14 +2117,14 @@ function measureParentInnerWidth(node) {
|
|
|
2041
2117
|
return Math.max(UNMEASURED, parent.clientWidth - padding);
|
|
2042
2118
|
}
|
|
2043
2119
|
function useAvailableWidth() {
|
|
2044
|
-
const [width, setWidth] =
|
|
2045
|
-
const nodeRef =
|
|
2046
|
-
const measureRef =
|
|
2120
|
+
const [width, setWidth] = React12.useState(UNMEASURED);
|
|
2121
|
+
const nodeRef = React12.useRef(null);
|
|
2122
|
+
const measureRef = React12.useCallback((node) => {
|
|
2047
2123
|
if (!IS_WEB3) return;
|
|
2048
2124
|
nodeRef.current = node;
|
|
2049
2125
|
if (nodeRef.current !== null) setWidth(measureParentInnerWidth(nodeRef.current));
|
|
2050
2126
|
}, []);
|
|
2051
|
-
|
|
2127
|
+
React12.useEffect(() => {
|
|
2052
2128
|
if (!IS_WEB3) return void 0;
|
|
2053
2129
|
const remeasure = () => {
|
|
2054
2130
|
const node = nodeRef.current;
|
|
@@ -2057,7 +2133,7 @@ function useAvailableWidth() {
|
|
|
2057
2133
|
window.addEventListener("resize", remeasure);
|
|
2058
2134
|
return () => window.removeEventListener("resize", remeasure);
|
|
2059
2135
|
}, []);
|
|
2060
|
-
const onLayout =
|
|
2136
|
+
const onLayout = React12.useCallback((event) => {
|
|
2061
2137
|
if (IS_WEB3) return;
|
|
2062
2138
|
setWidth(event.nativeEvent.layout.width);
|
|
2063
2139
|
}, []);
|
|
@@ -2066,7 +2142,7 @@ function useAvailableWidth() {
|
|
|
2066
2142
|
var AVG_CHAR_WIDTH_RATIO = 0.58;
|
|
2067
2143
|
var DEFAULT_FONT_SIZE2 = 13;
|
|
2068
2144
|
var UNMEASURED2 = 0;
|
|
2069
|
-
var
|
|
2145
|
+
var styles19 = reactNative.StyleSheet.create({
|
|
2070
2146
|
base: { fontSize: DEFAULT_FONT_SIZE2 },
|
|
2071
2147
|
/** `minWidth: 0` lets the text shrink inside a flex row instead of forcing the row wider. */
|
|
2072
2148
|
fill: { flexShrink: 1, minWidth: 0 }
|
|
@@ -2086,8 +2162,8 @@ var TruncatedText = ({
|
|
|
2086
2162
|
accessibilityHint
|
|
2087
2163
|
}) => {
|
|
2088
2164
|
const { width, measureRef, onLayout } = useAvailableWidth();
|
|
2089
|
-
const hostRef =
|
|
2090
|
-
const attachRef =
|
|
2165
|
+
const hostRef = React12.useRef(null);
|
|
2166
|
+
const attachRef = React12.useCallback(
|
|
2091
2167
|
(node) => {
|
|
2092
2168
|
hostRef.current = node;
|
|
2093
2169
|
measureRef(node);
|
|
@@ -2096,12 +2172,12 @@ var TruncatedText = ({
|
|
|
2096
2172
|
},
|
|
2097
2173
|
[value, measureRef]
|
|
2098
2174
|
);
|
|
2099
|
-
const flatStyle =
|
|
2100
|
-
() => reactNative.StyleSheet.flatten([
|
|
2175
|
+
const flatStyle = React12.useMemo(
|
|
2176
|
+
() => reactNative.StyleSheet.flatten([styles19.base, style]),
|
|
2101
2177
|
[style]
|
|
2102
2178
|
);
|
|
2103
2179
|
const fontSize = flatStyle.fontSize ?? DEFAULT_FONT_SIZE2;
|
|
2104
|
-
const display =
|
|
2180
|
+
const display = React12.useMemo(() => {
|
|
2105
2181
|
const source = isUrl ? formatUrlForDisplay(value) : value;
|
|
2106
2182
|
const budget = charBudget(width, fontSize);
|
|
2107
2183
|
return budget === UNMEASURED2 ? source : truncateMiddle(source, budget);
|
|
@@ -2112,7 +2188,7 @@ var TruncatedText = ({
|
|
|
2112
2188
|
ref: attachRef,
|
|
2113
2189
|
onLayout,
|
|
2114
2190
|
numberOfLines: 1,
|
|
2115
|
-
style: [
|
|
2191
|
+
style: [styles19.base, styles19.fill, style],
|
|
2116
2192
|
testID,
|
|
2117
2193
|
accessibilityRole: onPress !== void 0 || href !== void 0 ? "link" : "text",
|
|
2118
2194
|
accessibilityLabel,
|
|
@@ -2183,17 +2259,17 @@ async function copyText(value, writer) {
|
|
|
2183
2259
|
// src/CopyableId/useCopyToClipboard.ts
|
|
2184
2260
|
var COPY_FEEDBACK_MS = 2e3;
|
|
2185
2261
|
function useCopyToClipboard(value, writer) {
|
|
2186
|
-
const [status, setStatus] =
|
|
2187
|
-
const timerRef =
|
|
2188
|
-
const mountedRef =
|
|
2189
|
-
|
|
2262
|
+
const [status, setStatus] = React12.useState("idle" /* Idle */);
|
|
2263
|
+
const timerRef = React12.useRef(null);
|
|
2264
|
+
const mountedRef = React12.useRef(true);
|
|
2265
|
+
React12.useEffect(() => {
|
|
2190
2266
|
mountedRef.current = true;
|
|
2191
2267
|
return () => {
|
|
2192
2268
|
mountedRef.current = false;
|
|
2193
2269
|
if (timerRef.current !== null) clearTimeout(timerRef.current);
|
|
2194
2270
|
};
|
|
2195
2271
|
}, []);
|
|
2196
|
-
const copy =
|
|
2272
|
+
const copy = React12.useCallback(() => {
|
|
2197
2273
|
void (async () => {
|
|
2198
2274
|
const ok = await copyText(value, writer);
|
|
2199
2275
|
if (!mountedRef.current) return;
|
|
@@ -2215,7 +2291,7 @@ var LABEL_LETTER_SPACING = 0.4;
|
|
|
2215
2291
|
var ACTION_PADDING_H = 6;
|
|
2216
2292
|
var ACTION_PADDING_V = 2;
|
|
2217
2293
|
var ACTION_RADIUS = 6;
|
|
2218
|
-
var
|
|
2294
|
+
var styles20 = reactNative.StyleSheet.create({
|
|
2219
2295
|
cell: { gap: CELL_GAP },
|
|
2220
2296
|
label: {
|
|
2221
2297
|
fontSize: LABEL_FONT_SIZE,
|
|
@@ -2257,7 +2333,7 @@ var styles19 = reactNative.StyleSheet.create({
|
|
|
2257
2333
|
var TONE_STEP = "500";
|
|
2258
2334
|
function useActionState(status) {
|
|
2259
2335
|
const { theme } = uiFeedback.useUi();
|
|
2260
|
-
return
|
|
2336
|
+
return React12.useMemo(() => {
|
|
2261
2337
|
const primary = theme.palette.primary[TONE_STEP];
|
|
2262
2338
|
if (status === "copied" /* Copied */) {
|
|
2263
2339
|
return { key: LAYOUT_I18N.copied, color: theme.semantic.success?.[TONE_STEP] ?? primary };
|
|
@@ -2280,14 +2356,14 @@ var CopyableId = ({
|
|
|
2280
2356
|
const { colors } = theme;
|
|
2281
2357
|
const { status, copy } = useCopyToClipboard(value, writer);
|
|
2282
2358
|
const action = useActionState(status);
|
|
2283
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [
|
|
2284
|
-
label !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
2285
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
2286
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style:
|
|
2359
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles20.cell, style], testID, children: [
|
|
2360
|
+
label !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles20.label, { color: colors.textSecondary }], children: label }),
|
|
2361
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles20.row, children: [
|
|
2362
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles20.valueWrap, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2287
2363
|
TruncatedText,
|
|
2288
2364
|
{
|
|
2289
2365
|
value,
|
|
2290
|
-
style: [
|
|
2366
|
+
style: [styles20.value, { color: colors.text }],
|
|
2291
2367
|
testID: `${testID}-value`,
|
|
2292
2368
|
accessibilityLabel: accessibilityLabel ?? value,
|
|
2293
2369
|
accessibilityHint: t(LAYOUT_I18N.copyableIdHint)
|
|
@@ -2301,7 +2377,7 @@ var CopyableId = ({
|
|
|
2301
2377
|
accessibilityLabel: t(action.key),
|
|
2302
2378
|
accessibilityHint: t(LAYOUT_I18N.copyHint),
|
|
2303
2379
|
testID: `${testID}-copy`,
|
|
2304
|
-
style: [
|
|
2380
|
+
style: [styles20.action, { color: action.color }],
|
|
2305
2381
|
children: t(action.key)
|
|
2306
2382
|
}
|
|
2307
2383
|
)
|
|
@@ -2326,15 +2402,15 @@ function formatBuildInfo(buildVersion, apiCommit) {
|
|
|
2326
2402
|
return `${base}${API_COMMIT_SEPARATOR}${shortenCommit(commit)}`;
|
|
2327
2403
|
}
|
|
2328
2404
|
function useApiCommit(apiBaseUrl, fetchImpl) {
|
|
2329
|
-
const [commit, setCommit] =
|
|
2330
|
-
const mountedRef =
|
|
2331
|
-
|
|
2405
|
+
const [commit, setCommit] = React12.useState(void 0);
|
|
2406
|
+
const mountedRef = React12.useRef(true);
|
|
2407
|
+
React12.useEffect(() => {
|
|
2332
2408
|
mountedRef.current = true;
|
|
2333
2409
|
return () => {
|
|
2334
2410
|
mountedRef.current = false;
|
|
2335
2411
|
};
|
|
2336
2412
|
}, []);
|
|
2337
|
-
|
|
2413
|
+
React12.useEffect(() => {
|
|
2338
2414
|
if (apiBaseUrl === void 0 || apiBaseUrl === "") return;
|
|
2339
2415
|
const doFetch = fetchImpl ?? (typeof fetch !== "undefined" ? fetch : void 0);
|
|
2340
2416
|
if (doFetch === void 0) return;
|
|
@@ -2356,7 +2432,7 @@ var FOOTER_PADDING_V = 6;
|
|
|
2356
2432
|
var FOOTER_PADDING_H = 12;
|
|
2357
2433
|
var FOOTER_FONT_SIZE = 11;
|
|
2358
2434
|
var FOOTER_OPACITY = 0.75;
|
|
2359
|
-
var
|
|
2435
|
+
var styles21 = reactNative.StyleSheet.create({
|
|
2360
2436
|
footer: {
|
|
2361
2437
|
paddingVertical: FOOTER_PADDING_V,
|
|
2362
2438
|
paddingHorizontal: FOOTER_PADDING_H,
|
|
@@ -2381,8 +2457,8 @@ var BuildInfoFooter = ({
|
|
|
2381
2457
|
const fetchedCommit = useApiCommit(apiCommit === void 0 ? apiBaseUrl : void 0, fetchImpl);
|
|
2382
2458
|
const commit = apiCommit ?? fetchedCommit;
|
|
2383
2459
|
const label = formatBuildInfo(buildVersion, commit);
|
|
2384
|
-
const textStyle =
|
|
2385
|
-
() => [
|
|
2460
|
+
const textStyle = React12.useMemo(
|
|
2461
|
+
() => [styles21.text, { color: theme.colors.textSecondary }],
|
|
2386
2462
|
[theme.colors.textSecondary]
|
|
2387
2463
|
);
|
|
2388
2464
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2390,7 +2466,7 @@ var BuildInfoFooter = ({
|
|
|
2390
2466
|
{
|
|
2391
2467
|
accessibilityLabel: accessibilityLabel ?? label,
|
|
2392
2468
|
accessibilityHint: accessibilityHint ?? t(LAYOUT_I18N.buildInfoHint),
|
|
2393
|
-
style: [
|
|
2469
|
+
style: [styles21.footer, style],
|
|
2394
2470
|
testID,
|
|
2395
2471
|
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: textStyle, children: label })
|
|
2396
2472
|
}
|
|
@@ -2401,7 +2477,7 @@ var BORDER = 2;
|
|
|
2401
2477
|
var GLYPH_SIZE = 14;
|
|
2402
2478
|
var GLYPH_LINE = 16;
|
|
2403
2479
|
var TICK = "\u2713";
|
|
2404
|
-
var
|
|
2480
|
+
var styles22 = reactNative.StyleSheet.create({
|
|
2405
2481
|
circle: {
|
|
2406
2482
|
width: SIZE,
|
|
2407
2483
|
height: SIZE,
|
|
@@ -2418,14 +2494,14 @@ var CheckMark = ({ filled, accent, ring, glyphColor, testID }) => /* @__PURE__ *
|
|
|
2418
2494
|
"aria-hidden": true,
|
|
2419
2495
|
accessibilityElementsHidden: true,
|
|
2420
2496
|
importantForAccessibility: "no-hide-descendants",
|
|
2421
|
-
style: [
|
|
2497
|
+
style: [styles22.circle, { borderColor: filled ? accent : ring, backgroundColor: filled ? accent : void 0 }],
|
|
2422
2498
|
testID,
|
|
2423
|
-
children: filled ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
2499
|
+
children: filled ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles22.glyph, { color: glyphColor }], children: TICK }) : null
|
|
2424
2500
|
}
|
|
2425
2501
|
);
|
|
2426
|
-
var ListRowToneContext =
|
|
2502
|
+
var ListRowToneContext = React12.createContext(null);
|
|
2427
2503
|
function useListRowTone() {
|
|
2428
|
-
return
|
|
2504
|
+
return React12.useContext(ListRowToneContext);
|
|
2429
2505
|
}
|
|
2430
2506
|
function useRowPalette() {
|
|
2431
2507
|
const { colors, palette, semantic } = uiFeedback.useUi().theme;
|
|
@@ -2543,7 +2619,7 @@ var PAD_V = 12;
|
|
|
2543
2619
|
var GAP = 4;
|
|
2544
2620
|
var MARK_GAP = 12;
|
|
2545
2621
|
var LINE_GAP = 8;
|
|
2546
|
-
var
|
|
2622
|
+
var styles23 = reactNative.StyleSheet.create({
|
|
2547
2623
|
row: {
|
|
2548
2624
|
flexDirection: "row",
|
|
2549
2625
|
alignItems: "center",
|
|
@@ -2567,7 +2643,7 @@ function focusTarget(event) {
|
|
|
2567
2643
|
}
|
|
2568
2644
|
function slot(node, color, strong) {
|
|
2569
2645
|
if (typeof node !== "string") return node;
|
|
2570
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
2646
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles23.shrink, strong ? styles23.strong : null, { color }], children: node });
|
|
2571
2647
|
}
|
|
2572
2648
|
var ListRow = ({
|
|
2573
2649
|
title,
|
|
@@ -2584,9 +2660,9 @@ var ListRow = ({
|
|
|
2584
2660
|
}) => {
|
|
2585
2661
|
const palette = useRowPalette();
|
|
2586
2662
|
const { colors } = uiFeedback.useUi().theme;
|
|
2587
|
-
const [focused, setFocused] =
|
|
2663
|
+
const [focused, setFocused] = React12.useState(false);
|
|
2588
2664
|
const rest = resolveRowLook(selectedStyle, { selected, hovered: false, pressed: false, focused }, palette);
|
|
2589
|
-
const tone =
|
|
2665
|
+
const tone = React12.useMemo(() => ({ textColor: rest.textColor, inverse: rest.inverse }), [rest.textColor, rest.inverse]);
|
|
2590
2666
|
const checkTestId = testID === void 0 ? void 0 : `${testID}-check`;
|
|
2591
2667
|
return /* @__PURE__ */ jsxRuntime.jsxs(ListRowToneContext.Provider, { value: tone, children: [
|
|
2592
2668
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -2599,7 +2675,7 @@ var ListRow = ({
|
|
|
2599
2675
|
style: (state) => {
|
|
2600
2676
|
const { pressed, hovered } = state;
|
|
2601
2677
|
const look = resolveRowLook(selectedStyle, { selected, pressed, focused, hovered: hovered === true }, palette);
|
|
2602
|
-
return [
|
|
2678
|
+
return [styles23.row, { borderTopColor: colors.border }, look.container];
|
|
2603
2679
|
},
|
|
2604
2680
|
testID,
|
|
2605
2681
|
onBlur: () => {
|
|
@@ -2612,14 +2688,14 @@ var ListRow = ({
|
|
|
2612
2688
|
...pressedProps(selected),
|
|
2613
2689
|
children: [
|
|
2614
2690
|
rest.showCheck ? /* @__PURE__ */ jsxRuntime.jsx(CheckMark, { accent: palette.accent, filled: rest.checkFilled, glyphColor: palette.background, ring: palette.border, testID: checkTestId }) : null,
|
|
2615
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
2616
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
2691
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles23.body, children: [
|
|
2692
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles23.line, children: [
|
|
2617
2693
|
slot(title, rest.titleColor, true),
|
|
2618
2694
|
slot(trailing, rest.textColor, true)
|
|
2619
2695
|
] }),
|
|
2620
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
2621
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style:
|
|
2622
|
-
badges === void 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style:
|
|
2696
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles23.line, children: [
|
|
2697
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles23.shrink, children: slot(meta, rest.textColor, false) }),
|
|
2698
|
+
badges === void 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles23.badges, children: badges })
|
|
2623
2699
|
] })
|
|
2624
2700
|
] })
|
|
2625
2701
|
]
|
|
@@ -2629,6 +2705,7 @@ var ListRow = ({
|
|
|
2629
2705
|
] });
|
|
2630
2706
|
};
|
|
2631
2707
|
|
|
2708
|
+
exports.A4_PAGE = A4_PAGE;
|
|
2632
2709
|
exports.API_COMMIT_SEPARATOR = API_COMMIT_SEPARATOR;
|
|
2633
2710
|
exports.Accordion = Accordion;
|
|
2634
2711
|
exports.AccordionItem = AccordionItem;
|
|
@@ -2648,9 +2725,10 @@ exports.LAYOUT_I18N = LAYOUT_I18N;
|
|
|
2648
2725
|
exports.LAYOUT_TEST_IDS = LAYOUT_TEST_IDS;
|
|
2649
2726
|
exports.ListRow = ListRow;
|
|
2650
2727
|
exports.MIN_TARGET_PX = MIN_TARGET_PX;
|
|
2651
|
-
exports.Modal =
|
|
2728
|
+
exports.Modal = Modal;
|
|
2652
2729
|
exports.ModalDropdown = ModalDropdown;
|
|
2653
2730
|
exports.ModalShell = ModalShell;
|
|
2731
|
+
exports.PageFrame = PageFrame;
|
|
2654
2732
|
exports.RowSelectedStyle = RowSelectedStyle;
|
|
2655
2733
|
exports.ScreenColumn = ScreenColumn;
|
|
2656
2734
|
exports.Section = Section;
|
|
@@ -2670,7 +2748,9 @@ exports.formatBuildInfo = formatBuildInfo;
|
|
|
2670
2748
|
exports.formatUrlForDisplay = formatUrlForDisplay;
|
|
2671
2749
|
exports.isKeyboardOpen = isKeyboardOpen;
|
|
2672
2750
|
exports.isWideWebViewport = isWideWebViewport;
|
|
2751
|
+
exports.pageScale = pageScale;
|
|
2673
2752
|
exports.resolveRowLook = resolveRowLook;
|
|
2753
|
+
exports.scaledFrame = scaledFrame;
|
|
2674
2754
|
exports.shortenCommit = shortenCommit;
|
|
2675
2755
|
exports.trimTrailingSlash = trimTrailingSlash;
|
|
2676
2756
|
exports.truncateMiddle = truncateMiddle;
|