@dloizides/ui-layout 1.36.0 → 1.37.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 +27 -1
- package/dist/index.d.ts +27 -1
- package/dist/index.js +253 -186
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +167 -104
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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');
|
|
@@ -14,7 +14,7 @@ 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",
|
|
@@ -208,7 +209,7 @@ var Heading = ({
|
|
|
208
209
|
testID
|
|
209
210
|
}) => {
|
|
210
211
|
const { theme } = uiFeedback.useUi();
|
|
211
|
-
const headingStyle =
|
|
212
|
+
const headingStyle = React12__default.default.useMemo(
|
|
212
213
|
() => [styles3.heading, { color: theme.colors.text }, style],
|
|
213
214
|
[theme.colors.text, style]
|
|
214
215
|
);
|
|
@@ -263,9 +264,9 @@ var StatusBadge = ({
|
|
|
263
264
|
accessibilityHint
|
|
264
265
|
}) => {
|
|
265
266
|
const { t } = uiFeedback.useUi();
|
|
266
|
-
const dynamicBadge =
|
|
267
|
-
const dashedColor =
|
|
268
|
-
const dynamicText =
|
|
267
|
+
const dynamicBadge = React12.useMemo(() => ({ backgroundColor }), [backgroundColor]);
|
|
268
|
+
const dashedColor = React12.useMemo(() => ({ borderColor: color }), [color]);
|
|
269
|
+
const dynamicText = React12.useMemo(() => ({ color }), [color]);
|
|
269
270
|
const hasIcon = icon !== void 0 && icon !== null;
|
|
270
271
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
271
272
|
reactNative.View,
|
|
@@ -285,9 +286,9 @@ function isPastStickyLine(sentinelTop, isIntersecting, topOffset) {
|
|
|
285
286
|
return !isIntersecting && sentinelTop < topOffset;
|
|
286
287
|
}
|
|
287
288
|
function useStuckSentinel(topOffset) {
|
|
288
|
-
const sentinelRef =
|
|
289
|
-
const [isStuck, setIsStuck] =
|
|
290
|
-
|
|
289
|
+
const sentinelRef = React12.useRef(null);
|
|
290
|
+
const [isStuck, setIsStuck] = React12.useState(false);
|
|
291
|
+
React12.useEffect(() => {
|
|
291
292
|
const node = sentinelRef.current;
|
|
292
293
|
if (node === null || typeof IntersectionObserver === "undefined") return void 0;
|
|
293
294
|
const observer = new IntersectionObserver(
|
|
@@ -308,9 +309,9 @@ function isKeyboardOpen(visibleHeight, tallestHeight) {
|
|
|
308
309
|
return visibleHeight < tallestHeight * KEYBOARD_HEIGHT_RATIO;
|
|
309
310
|
}
|
|
310
311
|
function useVisibleViewport() {
|
|
311
|
-
const [state, setState] =
|
|
312
|
-
const tallest =
|
|
313
|
-
|
|
312
|
+
const [state, setState] = React12.useState(INITIAL);
|
|
313
|
+
const tallest = React12.useRef({ width: 0, height: 0 });
|
|
314
|
+
React12.useEffect(() => {
|
|
314
315
|
const viewport = typeof window === "undefined" ? void 0 : window.visualViewport;
|
|
315
316
|
if (viewport === void 0 || viewport === null) return void 0;
|
|
316
317
|
const read = () => {
|
|
@@ -353,7 +354,7 @@ var StickyPreview = ({
|
|
|
353
354
|
const { offsetTop, keyboardOpen } = useVisibleViewport();
|
|
354
355
|
const { sentinelRef, isStuck } = useStuckSentinel(topOffset);
|
|
355
356
|
const isCompact = forceCompact || isStuck || keyboardOpen;
|
|
356
|
-
const pinned =
|
|
357
|
+
const pinned = React12.useMemo(() => {
|
|
357
358
|
const web = { position: "sticky", top: topOffset + offsetTop, zIndex: STICKY_Z_INDEX };
|
|
358
359
|
return reactNative.Platform.OS === WEB_PLATFORM ? web : {};
|
|
359
360
|
}, [offsetTop, topOffset]);
|
|
@@ -376,6 +377,52 @@ var StickyPreview = ({
|
|
|
376
377
|
)
|
|
377
378
|
] });
|
|
378
379
|
};
|
|
380
|
+
|
|
381
|
+
// src/PageFrame/utils/pageScale.ts
|
|
382
|
+
var HALF = 2;
|
|
383
|
+
var A4_PAGE = { width: 794, height: 1123 };
|
|
384
|
+
var pageScale = (containerWidth, pageWidth) => {
|
|
385
|
+
if (containerWidth <= 0 || pageWidth <= 0) return 1;
|
|
386
|
+
return Math.min(1, containerWidth / pageWidth);
|
|
387
|
+
};
|
|
388
|
+
var scaledFrame = (containerWidth, page) => {
|
|
389
|
+
const scale = pageScale(containerWidth, page.width);
|
|
390
|
+
return {
|
|
391
|
+
scale,
|
|
392
|
+
height: page.height * scale,
|
|
393
|
+
offsetX: (scale - 1) * page.width / HALF,
|
|
394
|
+
offsetY: (scale - 1) * page.height / HALF
|
|
395
|
+
};
|
|
396
|
+
};
|
|
397
|
+
var styles6 = reactNative.StyleSheet.create({
|
|
398
|
+
outer: { width: "100%", overflow: "hidden" },
|
|
399
|
+
page: { position: "absolute", top: 0, left: 0 }
|
|
400
|
+
});
|
|
401
|
+
var PageFrame = ({
|
|
402
|
+
children,
|
|
403
|
+
pageSize = A4_PAGE,
|
|
404
|
+
testID = LAYOUT_TEST_IDS.pageFrame
|
|
405
|
+
}) => {
|
|
406
|
+
const [containerWidth, setContainerWidth] = React12.useState(0);
|
|
407
|
+
const onLayout = React12.useCallback((event) => {
|
|
408
|
+
setContainerWidth(event.nativeEvent.layout.width);
|
|
409
|
+
}, []);
|
|
410
|
+
const frame = scaledFrame(containerWidth, pageSize);
|
|
411
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles6.outer, { height: frame.height }], testID, onLayout, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
412
|
+
reactNative.View,
|
|
413
|
+
{
|
|
414
|
+
style: [
|
|
415
|
+
styles6.page,
|
|
416
|
+
{
|
|
417
|
+
width: pageSize.width,
|
|
418
|
+
height: pageSize.height,
|
|
419
|
+
transform: [{ translateX: frame.offsetX }, { translateY: frame.offsetY }, { scale: frame.scale }]
|
|
420
|
+
}
|
|
421
|
+
],
|
|
422
|
+
children
|
|
423
|
+
}
|
|
424
|
+
) });
|
|
425
|
+
};
|
|
379
426
|
var TRACK_PADDING = 3;
|
|
380
427
|
var TRACK_RADIUS = 999;
|
|
381
428
|
var SEGMENT_RADIUS = 999;
|
|
@@ -387,7 +434,7 @@ var BORDER_WIDTH = 1;
|
|
|
387
434
|
var SEGMENT_BOX_SHADOW = "0px 1px 3px rgba(20, 30, 50, 0.1)";
|
|
388
435
|
var SHADOW_ELEVATION = 2;
|
|
389
436
|
var TRANSPARENT = "transparent";
|
|
390
|
-
var
|
|
437
|
+
var styles7 = reactNative.StyleSheet.create({
|
|
391
438
|
track: {
|
|
392
439
|
flexDirection: "row",
|
|
393
440
|
alignSelf: "flex-start",
|
|
@@ -432,7 +479,7 @@ function SegmentedControl({
|
|
|
432
479
|
{
|
|
433
480
|
accessibilityRole: "tablist",
|
|
434
481
|
"aria-label": accessibilityLabel,
|
|
435
|
-
style: [
|
|
482
|
+
style: [styles7.track, { backgroundColor: colors.background, borderColor: colors.border }, style],
|
|
436
483
|
testID,
|
|
437
484
|
children: options.map((opt) => {
|
|
438
485
|
const selected = opt.value === value;
|
|
@@ -445,13 +492,13 @@ function SegmentedControl({
|
|
|
445
492
|
accessibilityHint: opt.accessibilityHint,
|
|
446
493
|
onPress: () => onChange(opt.value),
|
|
447
494
|
style: [
|
|
448
|
-
|
|
449
|
-
selected ?
|
|
495
|
+
styles7.segment,
|
|
496
|
+
selected ? styles7.segmentSelected : null,
|
|
450
497
|
{ backgroundColor: selected ? colors.surface : TRANSPARENT }
|
|
451
498
|
],
|
|
452
499
|
testID: opt.testID,
|
|
453
500
|
...ariaSelectedProps(selected),
|
|
454
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
501
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles7.label, { color: selected ? colors.text : colors.textSecondary }], children: opt.label })
|
|
455
502
|
},
|
|
456
503
|
opt.value
|
|
457
504
|
);
|
|
@@ -512,8 +559,8 @@ function handleKeyDown(domNode, event) {
|
|
|
512
559
|
}
|
|
513
560
|
}
|
|
514
561
|
function useFocusTrap(containerRef, enabled, initialFocusTestID) {
|
|
515
|
-
const previousFocusRef =
|
|
516
|
-
|
|
562
|
+
const previousFocusRef = React12.useRef(null);
|
|
563
|
+
React12.useEffect(() => {
|
|
517
564
|
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
518
565
|
const domNode = containerRef.current;
|
|
519
566
|
if (!domNode) return;
|
|
@@ -588,7 +635,7 @@ var HEADING_PADDING_H = 16;
|
|
|
588
635
|
var HEADING_PADDING_TOP = 8;
|
|
589
636
|
var HEADING_PADDING_BOTTOM = 4;
|
|
590
637
|
var HEADING_LETTER_SPACING = 0.5;
|
|
591
|
-
var
|
|
638
|
+
var styles8 = reactNative.StyleSheet.create({
|
|
592
639
|
heading: {
|
|
593
640
|
fontSize: HEADING_FONT_SIZE,
|
|
594
641
|
fontWeight: HEADING_FONT_WEIGHT,
|
|
@@ -604,7 +651,7 @@ var MenuHeading = ({ testID, text }) => {
|
|
|
604
651
|
reactNative.Text,
|
|
605
652
|
{
|
|
606
653
|
accessibilityRole: "header",
|
|
607
|
-
style: [
|
|
654
|
+
style: [styles8.heading, { color: theme.colors.textSecondary }],
|
|
608
655
|
testID: `${testID}-menu-heading`,
|
|
609
656
|
children: text
|
|
610
657
|
}
|
|
@@ -625,7 +672,7 @@ var OPTION_PADDING_V = 12;
|
|
|
625
672
|
var ACCENT_BAR_WIDTH = 3;
|
|
626
673
|
var CHECK_GAP = 8;
|
|
627
674
|
var CHECK_GLYPH = "\u2713";
|
|
628
|
-
var
|
|
675
|
+
var styles9 = reactNative.StyleSheet.create({
|
|
629
676
|
option: {
|
|
630
677
|
paddingHorizontal: OPTION_PADDING_H,
|
|
631
678
|
paddingVertical: OPTION_PADDING_V,
|
|
@@ -657,23 +704,23 @@ var OptionRow = ({
|
|
|
657
704
|
}) => {
|
|
658
705
|
const { theme, t } = uiFeedback.useUi();
|
|
659
706
|
const { colors } = theme;
|
|
660
|
-
const handlePress =
|
|
707
|
+
const handlePress = React12.useCallback(() => {
|
|
661
708
|
onSelect();
|
|
662
709
|
}, [onSelect]);
|
|
663
710
|
const accentColor = theme.palette.primary["500"];
|
|
664
711
|
const isMarked = selectedMarker === "accent-check" /* AccentCheck */;
|
|
665
712
|
const isActive = isSelected || isHighlighted;
|
|
666
713
|
const rowStyle = [
|
|
667
|
-
|
|
668
|
-
isMarked ?
|
|
714
|
+
styles9.option,
|
|
715
|
+
isMarked ? styles9.markedRow : null,
|
|
669
716
|
isActive ? { backgroundColor: colors.surfaceElevated } : null,
|
|
670
717
|
isMarked && isSelected ? { borderLeftColor: accentColor } : null
|
|
671
718
|
];
|
|
672
719
|
const textStyle = [
|
|
673
|
-
|
|
720
|
+
styles9.optionText,
|
|
674
721
|
{ color: colors.text },
|
|
675
|
-
isSelected ?
|
|
676
|
-
isMarked ?
|
|
722
|
+
isSelected ? styles9.selectedText : null,
|
|
723
|
+
isMarked ? styles9.markedText : null
|
|
677
724
|
];
|
|
678
725
|
const selectionProps = asMenuItem ? { "aria-current": isSelected ? "true" : void 0 } : { "aria-selected": isSelected };
|
|
679
726
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -689,7 +736,7 @@ var OptionRow = ({
|
|
|
689
736
|
onPress: handlePress,
|
|
690
737
|
children: [
|
|
691
738
|
/* @__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: [
|
|
739
|
+
isMarked && isSelected ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { "aria-hidden": true, testID: `${testID}-check`, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles9.selectedText, { color: accentColor }], children: CHECK_GLYPH }) }) : null
|
|
693
740
|
]
|
|
694
741
|
}
|
|
695
742
|
);
|
|
@@ -746,8 +793,8 @@ function isSameRect(a, b) {
|
|
|
746
793
|
return a.top === b.top && a.left === b.left && a.width === b.width && a.bottom === b.bottom;
|
|
747
794
|
}
|
|
748
795
|
function useAnchorTracking(containerRef, onOutOfView) {
|
|
749
|
-
const [rect, setRect] =
|
|
750
|
-
|
|
796
|
+
const [rect, setRect] = React12.useState(() => readAnchorRect(containerRef));
|
|
797
|
+
React12.useLayoutEffect(() => {
|
|
751
798
|
if (!IS_WEB) return void 0;
|
|
752
799
|
let frame = null;
|
|
753
800
|
let isDisposed = false;
|
|
@@ -826,7 +873,7 @@ function buildKeyHandler(params) {
|
|
|
826
873
|
}
|
|
827
874
|
function useMenuKeyboard(params) {
|
|
828
875
|
const { containerRef, menuRef, enabled, onClose } = params;
|
|
829
|
-
|
|
876
|
+
React12.useEffect(() => {
|
|
830
877
|
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
831
878
|
const onKeyDown = buildKeyHandler(params);
|
|
832
879
|
const onMouseDown = (event) => {
|
|
@@ -847,7 +894,7 @@ var IS_WEB2 = reactNative.Platform.OS === "web";
|
|
|
847
894
|
var BORDER_RADIUS2 = 8;
|
|
848
895
|
var BORDER_WIDTH3 = 1;
|
|
849
896
|
var MENU_PADDING2 = 4;
|
|
850
|
-
var
|
|
897
|
+
var styles10 = reactNative.StyleSheet.create({
|
|
851
898
|
/** Native (in-tree) popover — anchored absolutely just under the trigger. */
|
|
852
899
|
popover: {
|
|
853
900
|
position: "absolute",
|
|
@@ -890,27 +937,27 @@ var InlineMenu = ({
|
|
|
890
937
|
}) => {
|
|
891
938
|
const { theme } = uiFeedback.useUi();
|
|
892
939
|
const { colors } = theme;
|
|
893
|
-
const menuRef =
|
|
940
|
+
const menuRef = React12.useRef(null);
|
|
894
941
|
const rect = useAnchorTracking(containerRef, onClose);
|
|
895
|
-
const selectedIndex =
|
|
942
|
+
const selectedIndex = React12.useMemo(
|
|
896
943
|
() => Math.max(0, options.findIndex((opt) => opt.value === value)),
|
|
897
944
|
[options, value]
|
|
898
945
|
);
|
|
899
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
900
|
-
const handleSelect =
|
|
946
|
+
const [highlightedIndex, setHighlightedIndex] = React12.useState(() => selectedIndex);
|
|
947
|
+
const handleSelect = React12.useCallback(
|
|
901
948
|
(optionValue) => {
|
|
902
949
|
if (isOpen) onSelect(optionValue);
|
|
903
950
|
},
|
|
904
951
|
[isOpen, onSelect]
|
|
905
952
|
);
|
|
906
|
-
const selectAt =
|
|
953
|
+
const selectAt = React12.useCallback(
|
|
907
954
|
(index) => {
|
|
908
955
|
const option = options[index];
|
|
909
956
|
if (option !== void 0) handleSelect(option.value);
|
|
910
957
|
},
|
|
911
958
|
[options, handleSelect]
|
|
912
959
|
);
|
|
913
|
-
const selectHighlighted =
|
|
960
|
+
const selectHighlighted = React12.useCallback(
|
|
914
961
|
() => {
|
|
915
962
|
selectAt(highlightedIndex);
|
|
916
963
|
},
|
|
@@ -925,7 +972,7 @@ var InlineMenu = ({
|
|
|
925
972
|
onSelectHighlighted: selectHighlighted,
|
|
926
973
|
onClose
|
|
927
974
|
});
|
|
928
|
-
const popoverStyle =
|
|
975
|
+
const popoverStyle = React12.useMemo(() => {
|
|
929
976
|
const themed = { borderColor: colors.border, backgroundColor: colors.surface };
|
|
930
977
|
if (IS_WEB2) {
|
|
931
978
|
const viewportWidth = typeof window !== "undefined" ? window.innerWidth : 0;
|
|
@@ -934,7 +981,7 @@ var InlineMenu = ({
|
|
|
934
981
|
themed
|
|
935
982
|
];
|
|
936
983
|
}
|
|
937
|
-
return [
|
|
984
|
+
return [styles10.popover, { minWidth: menuMinWidth }, themed];
|
|
938
985
|
}, [colors.border, colors.surface, menuMinWidth, rect]);
|
|
939
986
|
const menu = /* @__PURE__ */ jsxRuntime.jsx(
|
|
940
987
|
reactNative.View,
|
|
@@ -949,10 +996,10 @@ var InlineMenu = ({
|
|
|
949
996
|
reactNative.Animated.View,
|
|
950
997
|
{
|
|
951
998
|
pointerEvents: isOpen ? "auto" : "none",
|
|
952
|
-
style: [
|
|
999
|
+
style: [styles10.animated, animatedStyle, isOpen ? null : styles10.inert],
|
|
953
1000
|
children: [
|
|
954
1001
|
menuHeading !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(MenuHeading, { testID, text: menuHeading }) : null,
|
|
955
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { style:
|
|
1002
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { style: styles10.scroll, keyboardShouldPersistTaps: "handled", children: options.map((option, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
956
1003
|
OptionRow,
|
|
957
1004
|
{
|
|
958
1005
|
asMenuItem: true,
|
|
@@ -1000,7 +1047,7 @@ var CARET_OPEN_ROTATION = "180deg";
|
|
|
1000
1047
|
var CARET_CLOSED_ROTATION = "0deg";
|
|
1001
1048
|
var POPOVER_ENTER_SCALE = 0.96;
|
|
1002
1049
|
var POPOVER_MOTION_MS = 120;
|
|
1003
|
-
var
|
|
1050
|
+
var styles11 = reactNative.StyleSheet.create({
|
|
1004
1051
|
anchor: { position: "relative" },
|
|
1005
1052
|
container: {
|
|
1006
1053
|
borderWidth: BORDER_WIDTH4,
|
|
@@ -1070,7 +1117,7 @@ var ModalDropdown = ({
|
|
|
1070
1117
|
const { colors } = theme;
|
|
1071
1118
|
const resolvedVariant = useResolvedDropdownVariant(variant);
|
|
1072
1119
|
const isMenu = resolvedVariant === "menu" /* Menu */;
|
|
1073
|
-
const [isOpen, setIsOpen] =
|
|
1120
|
+
const [isOpen, setIsOpen] = React12.useState(false);
|
|
1074
1121
|
const { a11yProps, hintNode } = a11y.useA11y({
|
|
1075
1122
|
label: accessibilityLabel,
|
|
1076
1123
|
hint: accessibilityHint,
|
|
@@ -1078,10 +1125,10 @@ var ModalDropdown = ({
|
|
|
1078
1125
|
state: { expanded: isOpen },
|
|
1079
1126
|
testID
|
|
1080
1127
|
});
|
|
1081
|
-
const anchorRef =
|
|
1082
|
-
const triggerRef =
|
|
1128
|
+
const anchorRef = React12.useRef(null);
|
|
1129
|
+
const triggerRef = React12.useRef(null);
|
|
1083
1130
|
const popupProps = { "aria-haspopup": isMenu ? "menu" : "dialog" };
|
|
1084
|
-
const dialogRef =
|
|
1131
|
+
const dialogRef = React12.useRef(null);
|
|
1085
1132
|
useFocusTrap(dialogRef, isOpen && !isMenu);
|
|
1086
1133
|
const menuAnim = uiMotion.useEnterExit({
|
|
1087
1134
|
visible: isMenu && isOpen,
|
|
@@ -1093,17 +1140,17 @@ var ModalDropdown = ({
|
|
|
1093
1140
|
fromScale: POPOVER_ENTER_SCALE,
|
|
1094
1141
|
duration: POPOVER_MOTION_MS
|
|
1095
1142
|
});
|
|
1096
|
-
const selectedLabel =
|
|
1143
|
+
const selectedLabel = React12.useMemo(() => {
|
|
1097
1144
|
const found = options.find((opt) => opt.value === value);
|
|
1098
1145
|
return found?.label ?? t(LAYOUT_I18N.selectPlaceholder);
|
|
1099
1146
|
}, [options, value, t]);
|
|
1100
|
-
const handleToggle =
|
|
1147
|
+
const handleToggle = React12.useCallback(() => {
|
|
1101
1148
|
setIsOpen((prev) => !prev);
|
|
1102
1149
|
}, []);
|
|
1103
|
-
const handleClose =
|
|
1150
|
+
const handleClose = React12.useCallback(() => {
|
|
1104
1151
|
setIsOpen(false);
|
|
1105
1152
|
}, []);
|
|
1106
|
-
const handleSelect =
|
|
1153
|
+
const handleSelect = React12.useCallback(
|
|
1107
1154
|
(optionValue) => {
|
|
1108
1155
|
onChange(optionValue);
|
|
1109
1156
|
setIsOpen(false);
|
|
@@ -1113,38 +1160,38 @@ var ModalDropdown = ({
|
|
|
1113
1160
|
);
|
|
1114
1161
|
const isHamburger = showHamburger;
|
|
1115
1162
|
const isCaret = showCaret && !isHamburger;
|
|
1116
|
-
const containerStyle =
|
|
1163
|
+
const containerStyle = React12.useMemo(
|
|
1117
1164
|
() => renderTrigger !== void 0 ? void 0 : [
|
|
1118
|
-
|
|
1119
|
-
isHamburger ?
|
|
1165
|
+
styles11.container,
|
|
1166
|
+
isHamburger ? styles11.containerHamburger : isCaret ? styles11.containerMenu : null,
|
|
1120
1167
|
{ borderColor: colors.border, backgroundColor: colors.surface }
|
|
1121
1168
|
],
|
|
1122
1169
|
[colors.border, colors.surface, renderTrigger, isHamburger, isCaret]
|
|
1123
1170
|
);
|
|
1124
|
-
const hamburgerStyle =
|
|
1125
|
-
() => [
|
|
1171
|
+
const hamburgerStyle = React12.useMemo(
|
|
1172
|
+
() => [styles11.hamburger, { color: colors.textSecondary }],
|
|
1126
1173
|
[colors.textSecondary]
|
|
1127
1174
|
);
|
|
1128
|
-
const caretStyle =
|
|
1175
|
+
const caretStyle = React12.useMemo(
|
|
1129
1176
|
() => [
|
|
1130
|
-
|
|
1177
|
+
styles11.caret,
|
|
1131
1178
|
{ color: colors.textSecondary, transform: [{ rotate: isOpen ? CARET_OPEN_ROTATION : CARET_CLOSED_ROTATION }] }
|
|
1132
1179
|
],
|
|
1133
1180
|
[colors.textSecondary, isOpen]
|
|
1134
1181
|
);
|
|
1135
|
-
const optionTestIDFor =
|
|
1182
|
+
const optionTestIDFor = React12.useCallback(
|
|
1136
1183
|
(optionValue) => optionTestID !== void 0 ? optionTestID(optionValue) : `${testID}-option-${String(optionValue)}`,
|
|
1137
1184
|
[optionTestID, testID]
|
|
1138
1185
|
);
|
|
1139
|
-
const anchorStyle =
|
|
1140
|
-
() => [
|
|
1186
|
+
const anchorStyle = React12.useMemo(
|
|
1187
|
+
() => [styles11.anchor, buildAnchorStackStyle(isMenu && isOpen)],
|
|
1141
1188
|
[isMenu, isOpen]
|
|
1142
1189
|
);
|
|
1143
|
-
const modalContentStyle =
|
|
1144
|
-
() => [
|
|
1190
|
+
const modalContentStyle = React12.useMemo(
|
|
1191
|
+
() => [styles11.modalContent, { backgroundColor: colors.surface }],
|
|
1145
1192
|
[colors.surface]
|
|
1146
1193
|
);
|
|
1147
|
-
const renderModalOption =
|
|
1194
|
+
const renderModalOption = React12.useCallback(
|
|
1148
1195
|
({ item }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1149
1196
|
OptionRow,
|
|
1150
1197
|
{
|
|
@@ -1157,16 +1204,16 @@ var ModalDropdown = ({
|
|
|
1157
1204
|
),
|
|
1158
1205
|
[handleSelect, optionTestIDFor, selectedMarker, value]
|
|
1159
1206
|
);
|
|
1160
|
-
const keyExtractor =
|
|
1207
|
+
const keyExtractor = React12.useCallback((item) => String(item.value), []);
|
|
1161
1208
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { ref: anchorRef, style: anchorStyle, children: [
|
|
1162
1209
|
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.TouchableOpacity, { ...a11yProps, ...popupProps, ref: triggerRef, style: containerStyle, onPress: handleToggle, children: [
|
|
1163
1210
|
renderTrigger !== void 0 ? renderTrigger({ label: selectedLabel, isOpen }) : isHamburger ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1164
1211
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: hamburgerStyle, children: HAMBURGER_GLYPH }),
|
|
1165
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [
|
|
1212
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [styles11.selectedText, styles11.selectedTextMenu, { color: colors.text }], children: selectedLabel })
|
|
1166
1213
|
] }) : isCaret ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1167
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [
|
|
1214
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [styles11.selectedText, styles11.selectedTextMenu, { color: colors.text }], children: selectedLabel }),
|
|
1168
1215
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: caretStyle, children: CARET_GLYPH })
|
|
1169
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1216
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles11.selectedText, { color: colors.text }], children: selectedLabel }),
|
|
1170
1217
|
hintNode
|
|
1171
1218
|
] }),
|
|
1172
1219
|
isMenu && menuAnim.mounted ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1187,7 +1234,7 @@ var ModalDropdown = ({
|
|
|
1187
1234
|
onSelect: handleSelect
|
|
1188
1235
|
}
|
|
1189
1236
|
) : null,
|
|
1190
|
-
!isMenu ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, visible: modalAnim.mounted, onRequestClose: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
1237
|
+
!isMenu ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, visible: modalAnim.mounted, onRequestClose: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles11.modalOverlay, children: [
|
|
1191
1238
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1192
1239
|
reactNative.TouchableOpacity,
|
|
1193
1240
|
{
|
|
@@ -1233,11 +1280,11 @@ var TabsMenu = ({
|
|
|
1233
1280
|
collapsedTrigger = "caret" /* Caret */
|
|
1234
1281
|
}) => {
|
|
1235
1282
|
const { t } = uiFeedback.useUi();
|
|
1236
|
-
const options =
|
|
1283
|
+
const options = React12.useMemo(
|
|
1237
1284
|
() => tabs.map((tab) => ({ label: tab.label, value: tab.key })),
|
|
1238
1285
|
[tabs]
|
|
1239
1286
|
);
|
|
1240
|
-
const optionTestID =
|
|
1287
|
+
const optionTestID = React12.useCallback(
|
|
1241
1288
|
(key) => {
|
|
1242
1289
|
const found = tabs.find((tab) => tab.key === key);
|
|
1243
1290
|
return found?.testID ?? `${idPrefix}-tab-${key}`;
|
|
@@ -1280,7 +1327,7 @@ var ROW_PAD_V = 8;
|
|
|
1280
1327
|
var PANEL_PAD_TOP = 16;
|
|
1281
1328
|
var BORDER_WIDTH5 = 1;
|
|
1282
1329
|
var TEXT_ON_PRIMARY = "#ffffff";
|
|
1283
|
-
var
|
|
1330
|
+
var styles12 = reactNative.StyleSheet.create({
|
|
1284
1331
|
root: {
|
|
1285
1332
|
width: "100%"
|
|
1286
1333
|
},
|
|
@@ -1334,7 +1381,7 @@ var WideTabStrip = ({
|
|
|
1334
1381
|
textSecondary,
|
|
1335
1382
|
surfaceElevated,
|
|
1336
1383
|
stripStyle
|
|
1337
|
-
}) => /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [
|
|
1384
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles12.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: [styles12.strip, stripStyle], children: tabs.map((tab) => {
|
|
1338
1385
|
const selected = tab.key === activeKey;
|
|
1339
1386
|
const textColor = selected ? TEXT_ON_PRIMARY : textSecondary;
|
|
1340
1387
|
const pillColor = selected ? primaryColor : surfaceElevated;
|
|
@@ -1348,10 +1395,10 @@ var WideTabStrip = ({
|
|
|
1348
1395
|
accessibilityLabel: tab.accessibilityLabel ?? tab.label,
|
|
1349
1396
|
accessibilityHint: tab.accessibilityHint,
|
|
1350
1397
|
onPress: () => onChange(tab.key),
|
|
1351
|
-
style: [
|
|
1398
|
+
style: [styles12.pill, { backgroundColor: pillColor }],
|
|
1352
1399
|
testID: tab.testID,
|
|
1353
1400
|
...ariaTabProps(selected, panelId, tabId),
|
|
1354
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1401
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles12.pillText, { color: textColor }], children: tab.label })
|
|
1355
1402
|
},
|
|
1356
1403
|
tab.key
|
|
1357
1404
|
);
|
|
@@ -1376,7 +1423,7 @@ var Tabs = ({
|
|
|
1376
1423
|
const activePanelId = `${idPrefix}-panel-${activeKey}`;
|
|
1377
1424
|
const activeTabId = `${idPrefix}-tab-${activeKey}`;
|
|
1378
1425
|
const panelAria = { "aria-labelledby": activeTabId, id: activePanelId };
|
|
1379
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [
|
|
1426
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles12.root, style], testID, children: [
|
|
1380
1427
|
collapsed ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1381
1428
|
TabsMenu,
|
|
1382
1429
|
{
|
|
@@ -1403,7 +1450,7 @@ var Tabs = ({
|
|
|
1403
1450
|
onChange
|
|
1404
1451
|
}
|
|
1405
1452
|
),
|
|
1406
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityRole: "none", style: [
|
|
1453
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityRole: "none", style: [styles12.panel, panelStyle], ...panelAria, children })
|
|
1407
1454
|
] });
|
|
1408
1455
|
};
|
|
1409
1456
|
var PROMPT_PADDING = 20;
|
|
@@ -1418,7 +1465,7 @@ var DISMISS_FONT_SIZE = 13;
|
|
|
1418
1465
|
var TITLE_MARGIN_BOTTOM = 8;
|
|
1419
1466
|
var MESSAGE_MARGIN_BOTTOM = 16;
|
|
1420
1467
|
var CTA_MARGIN_BOTTOM = 8;
|
|
1421
|
-
var
|
|
1468
|
+
var styles13 = reactNative.StyleSheet.create({
|
|
1422
1469
|
container: {
|
|
1423
1470
|
padding: PROMPT_PADDING,
|
|
1424
1471
|
borderRadius: PROMPT_BORDER_RADIUS,
|
|
@@ -1453,21 +1500,21 @@ var UpgradePrompt = ({
|
|
|
1453
1500
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1454
1501
|
reactNative.View,
|
|
1455
1502
|
{
|
|
1456
|
-
style: [
|
|
1503
|
+
style: [styles13.container, { borderColor: primary, backgroundColor: colors.surface }],
|
|
1457
1504
|
testID: LAYOUT_TEST_IDS.upgradePrompt,
|
|
1458
1505
|
children: [
|
|
1459
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1460
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1506
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles13.title, { color: colors.text }], children: t(LAYOUT_I18N.upgradePromptTitle) }),
|
|
1507
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles13.message, { color: colors.textSecondary }], children: t(LAYOUT_I18N.upgradePromptMessage, requiredTier, currentTier) }),
|
|
1461
1508
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1462
1509
|
reactNative.TouchableOpacity,
|
|
1463
1510
|
{
|
|
1464
1511
|
accessibilityHint: t(LAYOUT_I18N.upgradePromptCtaHint),
|
|
1465
1512
|
accessibilityLabel: t(LAYOUT_I18N.upgradePromptCta),
|
|
1466
1513
|
accessibilityRole: "button",
|
|
1467
|
-
style: [
|
|
1514
|
+
style: [styles13.cta, { backgroundColor: primary }],
|
|
1468
1515
|
testID: LAYOUT_TEST_IDS.upgradePromptCta,
|
|
1469
1516
|
onPress: handleUpgradePress,
|
|
1470
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1517
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles13.ctaText, { color: colors.surface }], children: t(LAYOUT_I18N.upgradePromptCta) })
|
|
1471
1518
|
}
|
|
1472
1519
|
),
|
|
1473
1520
|
onDismiss ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1476,10 +1523,10 @@ var UpgradePrompt = ({
|
|
|
1476
1523
|
accessibilityHint: t(LAYOUT_I18N.upgradePromptDismissHint),
|
|
1477
1524
|
accessibilityLabel: t(LAYOUT_I18N.upgradePromptDismiss),
|
|
1478
1525
|
accessibilityRole: "button",
|
|
1479
|
-
style:
|
|
1526
|
+
style: styles13.dismiss,
|
|
1480
1527
|
testID: LAYOUT_TEST_IDS.upgradePromptDismiss,
|
|
1481
1528
|
onPress: onDismiss,
|
|
1482
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1529
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles13.dismissText, { color: colors.textSecondary }], children: t(LAYOUT_I18N.upgradePromptDismiss) })
|
|
1483
1530
|
}
|
|
1484
1531
|
) : null
|
|
1485
1532
|
]
|
|
@@ -1488,7 +1535,7 @@ var UpgradePrompt = ({
|
|
|
1488
1535
|
};
|
|
1489
1536
|
var CLOSE_ICON_SIZE = 18;
|
|
1490
1537
|
var PANEL_ENTER_SCALE = 0.96;
|
|
1491
|
-
var
|
|
1538
|
+
var styles14 = reactNative.StyleSheet.create({
|
|
1492
1539
|
animatedFill: { flex: 1 },
|
|
1493
1540
|
container: {
|
|
1494
1541
|
flex: 1,
|
|
@@ -1514,8 +1561,8 @@ var ModalShell = ({
|
|
|
1514
1561
|
}) => {
|
|
1515
1562
|
const { theme, t } = uiFeedback.useUi();
|
|
1516
1563
|
const { style: sheetStyle, mounted } = uiMotion.useEnterExit({ visible, fromScale: PANEL_ENTER_SCALE });
|
|
1517
|
-
const containerStyle =
|
|
1518
|
-
() => [
|
|
1564
|
+
const containerStyle = React12__default.default.useMemo(
|
|
1565
|
+
() => [styles14.container, { backgroundColor: theme.colors.background }, contentStyle],
|
|
1519
1566
|
[theme.colors.background, contentStyle]
|
|
1520
1567
|
);
|
|
1521
1568
|
const closeA11yLabel = t(LAYOUT_I18N.close);
|
|
@@ -1527,7 +1574,7 @@ var ModalShell = ({
|
|
|
1527
1574
|
testID: LAYOUT_TEST_IDS.modalShell,
|
|
1528
1575
|
visible: mounted,
|
|
1529
1576
|
onRequestClose: onCancel,
|
|
1530
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Animated.View, { style: [
|
|
1577
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Animated.View, { style: [styles14.animatedFill, sheetStyle], children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1531
1578
|
reactNative.ScrollView,
|
|
1532
1579
|
{
|
|
1533
1580
|
accessibilityViewIsModal: true,
|
|
@@ -1535,7 +1582,7 @@ var ModalShell = ({
|
|
|
1535
1582
|
role: "dialog",
|
|
1536
1583
|
style: containerStyle,
|
|
1537
1584
|
children: [
|
|
1538
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
1585
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles14.headerRow, children: [
|
|
1539
1586
|
/* @__PURE__ */ jsxRuntime.jsx(Heading, { children: title ?? t(LAYOUT_I18N.closeHeading) }),
|
|
1540
1587
|
showClose ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1541
1588
|
reactNative.TouchableOpacity,
|
|
@@ -1543,7 +1590,7 @@ var ModalShell = ({
|
|
|
1543
1590
|
accessibilityHint: t(LAYOUT_I18N.closeDialogHint),
|
|
1544
1591
|
accessibilityLabel: closeA11yLabel,
|
|
1545
1592
|
accessibilityRole: "button",
|
|
1546
|
-
style:
|
|
1593
|
+
style: styles14.closeButton,
|
|
1547
1594
|
testID: LAYOUT_TEST_IDS.modalShellClose,
|
|
1548
1595
|
onPress: onCancel,
|
|
1549
1596
|
children: /* @__PURE__ */ jsxRuntime.jsx(uiIcons.SvgIcon, { color: theme.colors.textSecondary, name: "close", size: CLOSE_ICON_SIZE })
|
|
@@ -1558,7 +1605,7 @@ var ModalShell = ({
|
|
|
1558
1605
|
);
|
|
1559
1606
|
};
|
|
1560
1607
|
function useEscapeKey(enabled, onClose) {
|
|
1561
|
-
|
|
1608
|
+
React12.useEffect(() => {
|
|
1562
1609
|
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
1563
1610
|
const onKeyDown = (event) => {
|
|
1564
1611
|
if (event.key === "Escape") onClose();
|
|
@@ -1570,7 +1617,7 @@ function useEscapeKey(enabled, onClose) {
|
|
|
1570
1617
|
}, [enabled, onClose]);
|
|
1571
1618
|
}
|
|
1572
1619
|
function useScrollLock(enabled) {
|
|
1573
|
-
|
|
1620
|
+
React12.useEffect(() => {
|
|
1574
1621
|
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
1575
1622
|
const { body } = document;
|
|
1576
1623
|
const previousOverflow = body.style.overflow;
|
|
@@ -1589,7 +1636,7 @@ var HEADER_MARGIN = 12;
|
|
|
1589
1636
|
var DIALOG_MAX_HEIGHT = "90%";
|
|
1590
1637
|
var PANEL_ENTER_SCALE2 = 0.96;
|
|
1591
1638
|
var SIZE_MAX_WIDTH = { sm: 360, md: 480, lg: 640 };
|
|
1592
|
-
var
|
|
1639
|
+
var styles15 = reactNative.StyleSheet.create({
|
|
1593
1640
|
overlay: {
|
|
1594
1641
|
flex: 1,
|
|
1595
1642
|
justifyContent: "center",
|
|
@@ -1631,7 +1678,7 @@ var Modal3 = ({
|
|
|
1631
1678
|
initialFocusTestID
|
|
1632
1679
|
}) => {
|
|
1633
1680
|
const { theme, t } = uiFeedback.useUi();
|
|
1634
|
-
const dialogRef =
|
|
1681
|
+
const dialogRef = React12.useRef(null);
|
|
1635
1682
|
const backdrop = uiMotion.useEnterExit({ visible });
|
|
1636
1683
|
const panel = uiMotion.useEnterExit({ visible, fromScale: PANEL_ENTER_SCALE2 });
|
|
1637
1684
|
const mounted = panel.mounted || backdrop.mounted;
|
|
@@ -1640,16 +1687,16 @@ var Modal3 = ({
|
|
|
1640
1687
|
useScrollLock(visible);
|
|
1641
1688
|
const accessibleName = accessibilityLabel ?? title ?? t(LAYOUT_I18N.dialog);
|
|
1642
1689
|
const closeLabel = t(LAYOUT_I18N.dialogClose);
|
|
1643
|
-
const dialogStyle =
|
|
1644
|
-
() => [
|
|
1690
|
+
const dialogStyle = React12.useMemo(
|
|
1691
|
+
() => [styles15.dialog, { backgroundColor: theme.colors.surface, maxWidth: SIZE_MAX_WIDTH[size] }],
|
|
1645
1692
|
[theme.colors.surface, size]
|
|
1646
1693
|
);
|
|
1647
1694
|
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:
|
|
1695
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, visible: mounted, onRequestClose: onClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles15.overlay, children: [
|
|
1649
1696
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1650
1697
|
reactNative.Animated.View,
|
|
1651
1698
|
{
|
|
1652
|
-
style: [reactNative.StyleSheet.absoluteFill,
|
|
1699
|
+
style: [reactNative.StyleSheet.absoluteFill, styles15.scrim, { opacity: backdrop.style.opacity }]
|
|
1653
1700
|
}
|
|
1654
1701
|
),
|
|
1655
1702
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1675,8 +1722,8 @@ var Modal3 = ({
|
|
|
1675
1722
|
style: [dialogStyle, panel.style],
|
|
1676
1723
|
testID,
|
|
1677
1724
|
children: [
|
|
1678
|
-
hasHeader ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
1679
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style:
|
|
1725
|
+
hasHeader ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles15.headerRow, children: [
|
|
1726
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles15.titleWrap, children: title !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(Heading, { children: title }) : null }),
|
|
1680
1727
|
showClose ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1681
1728
|
uiButtons.IconButton,
|
|
1682
1729
|
{
|
|
@@ -1693,7 +1740,7 @@ var Modal3 = ({
|
|
|
1693
1740
|
) : null
|
|
1694
1741
|
] }) : null,
|
|
1695
1742
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { children }),
|
|
1696
|
-
footer !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style:
|
|
1743
|
+
footer !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles15.footer, children: footer }) : null
|
|
1697
1744
|
]
|
|
1698
1745
|
}
|
|
1699
1746
|
)
|
|
@@ -1702,7 +1749,7 @@ var Modal3 = ({
|
|
|
1702
1749
|
var MESSAGE_FONT_SIZE2 = 14;
|
|
1703
1750
|
var MESSAGE_LINE_HEIGHT = 20;
|
|
1704
1751
|
var BUTTON_GAP = 12;
|
|
1705
|
-
var
|
|
1752
|
+
var styles16 = reactNative.StyleSheet.create({
|
|
1706
1753
|
message: { fontSize: MESSAGE_FONT_SIZE2, lineHeight: MESSAGE_LINE_HEIGHT },
|
|
1707
1754
|
footer: { flexDirection: "row", justifyContent: "flex-end", columnGap: BUTTON_GAP }
|
|
1708
1755
|
});
|
|
@@ -1721,7 +1768,7 @@ var ConfirmDialog = ({
|
|
|
1721
1768
|
const { theme, t } = uiFeedback.useUi();
|
|
1722
1769
|
const resolvedConfirm = confirmLabel ?? t(LAYOUT_I18N.confirm);
|
|
1723
1770
|
const resolvedCancel = cancelLabel ?? t(LAYOUT_I18N.cancel);
|
|
1724
|
-
const footer = /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
1771
|
+
const footer = /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles16.footer, children: [
|
|
1725
1772
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1726
1773
|
uiButtons.Button,
|
|
1727
1774
|
{
|
|
@@ -1757,27 +1804,27 @@ var ConfirmDialog = ({
|
|
|
1757
1804
|
title,
|
|
1758
1805
|
visible,
|
|
1759
1806
|
onClose: onCancel,
|
|
1760
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1807
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles16.message, { color: theme.colors.text }], testID: `${testID}-message`, children: message })
|
|
1761
1808
|
}
|
|
1762
1809
|
);
|
|
1763
1810
|
};
|
|
1764
|
-
var AccordionContext =
|
|
1811
|
+
var AccordionContext = React12.createContext(null);
|
|
1765
1812
|
function useAccordionContext() {
|
|
1766
|
-
const value =
|
|
1813
|
+
const value = React12.useContext(AccordionContext);
|
|
1767
1814
|
if (value === null) {
|
|
1768
1815
|
throw new Error("AccordionItem must be rendered inside an <Accordion>.");
|
|
1769
1816
|
}
|
|
1770
1817
|
return value;
|
|
1771
1818
|
}
|
|
1772
1819
|
var BOXED_GAP = 12;
|
|
1773
|
-
var
|
|
1820
|
+
var styles17 = reactNative.StyleSheet.create({
|
|
1774
1821
|
container: { alignSelf: "stretch" },
|
|
1775
1822
|
boxed: { gap: BOXED_GAP }
|
|
1776
1823
|
});
|
|
1777
1824
|
function computeInitialOpen(children, defaultOpenIds, allowMultiple) {
|
|
1778
1825
|
const ids = new Set(defaultOpenIds ?? []);
|
|
1779
|
-
|
|
1780
|
-
if (!
|
|
1826
|
+
React12__default.default.Children.forEach(children, (child) => {
|
|
1827
|
+
if (!React12__default.default.isValidElement(child)) return;
|
|
1781
1828
|
const props = child.props;
|
|
1782
1829
|
if (props.defaultOpen === true && typeof props.id === "string") {
|
|
1783
1830
|
ids.add(props.id);
|
|
@@ -1800,14 +1847,14 @@ var Accordion = ({
|
|
|
1800
1847
|
style
|
|
1801
1848
|
}) => {
|
|
1802
1849
|
const isControlled = openIds !== void 0;
|
|
1803
|
-
const [internalOpen, setInternalOpen] =
|
|
1850
|
+
const [internalOpen, setInternalOpen] = React12.useState(
|
|
1804
1851
|
() => computeInitialOpen(children, defaultOpenIds, allowMultiple)
|
|
1805
1852
|
);
|
|
1806
|
-
const openSet =
|
|
1853
|
+
const openSet = React12.useMemo(
|
|
1807
1854
|
() => isControlled ? new Set(openIds) : internalOpen,
|
|
1808
1855
|
[isControlled, openIds, internalOpen]
|
|
1809
1856
|
);
|
|
1810
|
-
const toggle =
|
|
1857
|
+
const toggle = React12.useCallback(
|
|
1811
1858
|
(id) => {
|
|
1812
1859
|
const next = new Set(openSet);
|
|
1813
1860
|
const willOpen = !next.has(id);
|
|
@@ -1822,12 +1869,12 @@ var Accordion = ({
|
|
|
1822
1869
|
},
|
|
1823
1870
|
[allowMultiple, isControlled, onOpenChange, openSet]
|
|
1824
1871
|
);
|
|
1825
|
-
const contextValue =
|
|
1872
|
+
const contextValue = React12.useMemo(
|
|
1826
1873
|
() => ({ openIds: openSet, toggle, allowMultiple, variant }),
|
|
1827
1874
|
[openSet, toggle, allowMultiple, variant]
|
|
1828
1875
|
);
|
|
1829
|
-
const containerStyle =
|
|
1830
|
-
const base = variant === "boxed" ? [
|
|
1876
|
+
const containerStyle = React12.useMemo(() => {
|
|
1877
|
+
const base = variant === "boxed" ? [styles17.container, styles17.boxed] : [styles17.container];
|
|
1831
1878
|
if (style === void 0) return base;
|
|
1832
1879
|
return [...base, ...Array.isArray(style) ? style : [style]];
|
|
1833
1880
|
}, [style, variant]);
|
|
@@ -1859,7 +1906,7 @@ var BOX_TITLE_FONT_SIZE = 14;
|
|
|
1859
1906
|
var BOX_MARKER_FONT_SIZE = 13;
|
|
1860
1907
|
var BOX_MARKER_GAP = 6;
|
|
1861
1908
|
var BOX_MARKER = "\u25B8";
|
|
1862
|
-
var
|
|
1909
|
+
var styles18 = reactNative.StyleSheet.create({
|
|
1863
1910
|
item: { borderTopWidth: reactNative.StyleSheet.hairlineWidth },
|
|
1864
1911
|
boxItem: { borderWidth: 1, borderRadius: BOX_BORDER_RADIUS, paddingHorizontal: BOX_PADDING_H },
|
|
1865
1912
|
header: {
|
|
@@ -1905,9 +1952,9 @@ var AccordionItem = ({
|
|
|
1905
1952
|
const headerTestID = testID ?? `accordion-item-${id}`;
|
|
1906
1953
|
const bodyTestID = `${headerTestID}-body`;
|
|
1907
1954
|
const chevronTestID = `${headerTestID}-chevron`;
|
|
1908
|
-
const [rotation] =
|
|
1955
|
+
const [rotation] = React12.useState(() => new reactNative.Animated.Value(expanded ? ROTATE_EXPANDED : ROTATE_COLLAPSED));
|
|
1909
1956
|
const reducedMotion = rnWebHooks.useReducedMotion();
|
|
1910
|
-
|
|
1957
|
+
React12.useEffect(() => {
|
|
1911
1958
|
reactNative.Animated.timing(rotation, {
|
|
1912
1959
|
toValue: expanded ? ROTATE_EXPANDED : ROTATE_COLLAPSED,
|
|
1913
1960
|
duration: reducedMotion ? INSTANT_DURATION_MS : ROTATE_DURATION_MS,
|
|
@@ -1919,10 +1966,10 @@ var AccordionItem = ({
|
|
|
1919
1966
|
inputRange: [ROTATE_COLLAPSED, ROTATE_EXPANDED],
|
|
1920
1967
|
outputRange: [COLLAPSED_DEG, boxed ? BOXED_EXPANDED_DEG : PLAIN_EXPANDED_DEG]
|
|
1921
1968
|
});
|
|
1922
|
-
const handlePress =
|
|
1969
|
+
const handlePress = React12.useCallback(() => {
|
|
1923
1970
|
if (!disabled) toggle(id);
|
|
1924
1971
|
}, [disabled, id, toggle]);
|
|
1925
|
-
const handleKeyDown2 =
|
|
1972
|
+
const handleKeyDown2 = React12.useCallback(
|
|
1926
1973
|
(event) => {
|
|
1927
1974
|
if (disabled) return;
|
|
1928
1975
|
const key = event.key ?? "";
|
|
@@ -1934,20 +1981,20 @@ var AccordionItem = ({
|
|
|
1934
1981
|
[disabled, id, toggle]
|
|
1935
1982
|
);
|
|
1936
1983
|
const keyboardProps = reactNative.Platform.OS === "web" ? { onKeyDown: handleKeyDown2 } : {};
|
|
1937
|
-
const itemStyle =
|
|
1938
|
-
() => boxed ? [
|
|
1984
|
+
const itemStyle = React12.useMemo(
|
|
1985
|
+
() => boxed ? [styles18.boxItem, { borderColor: colors.border }] : [styles18.item, { borderTopColor: colors.border }],
|
|
1939
1986
|
[boxed, colors.border]
|
|
1940
1987
|
);
|
|
1941
|
-
const headerStyle =
|
|
1988
|
+
const headerStyle = React12.useMemo(
|
|
1942
1989
|
() => [
|
|
1943
|
-
|
|
1944
|
-
...boxed ? [
|
|
1990
|
+
styles18.header,
|
|
1991
|
+
...boxed ? [styles18.boxHeader] : [],
|
|
1945
1992
|
{ opacity: disabled ? DISABLED_OPACITY : FULL_OPACITY }
|
|
1946
1993
|
],
|
|
1947
1994
|
[boxed, disabled]
|
|
1948
1995
|
);
|
|
1949
1996
|
const resolvedLabel = accessibilityLabel ?? (typeof title === "string" ? title : void 0);
|
|
1950
|
-
const titleNode = typeof title === "string" ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [boxed ?
|
|
1997
|
+
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
1998
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: itemStyle, children: [
|
|
1952
1999
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1953
2000
|
reactNative.Pressable,
|
|
@@ -1964,7 +2011,7 @@ var AccordionItem = ({
|
|
|
1964
2011
|
onPress: handlePress,
|
|
1965
2012
|
...keyboardProps,
|
|
1966
2013
|
children: [
|
|
1967
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [
|
|
2014
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles18.headerLeft, boxed ? styles18.headerLeftRow : null], children: [
|
|
1968
2015
|
boxed ? (
|
|
1969
2016
|
// Decorative — the open/closed state is already conveyed by aria-expanded on the header.
|
|
1970
2017
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1973,15 +2020,15 @@ var AccordionItem = ({
|
|
|
1973
2020
|
accessibilityElementsHidden: true,
|
|
1974
2021
|
"aria-hidden": true,
|
|
1975
2022
|
importantForAccessibility: "no-hide-descendants",
|
|
1976
|
-
style: [
|
|
2023
|
+
style: [styles18.marker, { transform: [{ rotate }] }],
|
|
1977
2024
|
testID: chevronTestID,
|
|
1978
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
2025
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles18.markerText, { color: colors.textSecondary }], children: BOX_MARKER })
|
|
1979
2026
|
}
|
|
1980
2027
|
)
|
|
1981
2028
|
) : null,
|
|
1982
2029
|
titleNode
|
|
1983
2030
|
] }),
|
|
1984
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
2031
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles18.headerRight, children: [
|
|
1985
2032
|
right,
|
|
1986
2033
|
boxed ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1987
2034
|
reactNative.Animated.View,
|
|
@@ -1989,7 +2036,7 @@ var AccordionItem = ({
|
|
|
1989
2036
|
accessibilityElementsHidden: true,
|
|
1990
2037
|
"aria-hidden": true,
|
|
1991
2038
|
importantForAccessibility: "no-hide-descendants",
|
|
1992
|
-
style: [
|
|
2039
|
+
style: [styles18.chevron, { transform: [{ rotate }] }],
|
|
1993
2040
|
children: /* @__PURE__ */ jsxRuntime.jsx(uiIcons.SvgIcon, { color: colors.textSecondary, name: "chevronDown", size: CHEVRON_SIZE, testID: chevronTestID })
|
|
1994
2041
|
}
|
|
1995
2042
|
)
|
|
@@ -2003,7 +2050,7 @@ var AccordionItem = ({
|
|
|
2003
2050
|
accessibilityLabel: resolvedLabel,
|
|
2004
2051
|
nativeID: bodyTestID,
|
|
2005
2052
|
role: ROLE_REGION,
|
|
2006
|
-
style: boxed ?
|
|
2053
|
+
style: boxed ? styles18.boxBody : styles18.body,
|
|
2007
2054
|
testID: bodyTestID,
|
|
2008
2055
|
children
|
|
2009
2056
|
}
|
|
@@ -2041,14 +2088,14 @@ function measureParentInnerWidth(node) {
|
|
|
2041
2088
|
return Math.max(UNMEASURED, parent.clientWidth - padding);
|
|
2042
2089
|
}
|
|
2043
2090
|
function useAvailableWidth() {
|
|
2044
|
-
const [width, setWidth] =
|
|
2045
|
-
const nodeRef =
|
|
2046
|
-
const measureRef =
|
|
2091
|
+
const [width, setWidth] = React12.useState(UNMEASURED);
|
|
2092
|
+
const nodeRef = React12.useRef(null);
|
|
2093
|
+
const measureRef = React12.useCallback((node) => {
|
|
2047
2094
|
if (!IS_WEB3) return;
|
|
2048
2095
|
nodeRef.current = node;
|
|
2049
2096
|
if (nodeRef.current !== null) setWidth(measureParentInnerWidth(nodeRef.current));
|
|
2050
2097
|
}, []);
|
|
2051
|
-
|
|
2098
|
+
React12.useEffect(() => {
|
|
2052
2099
|
if (!IS_WEB3) return void 0;
|
|
2053
2100
|
const remeasure = () => {
|
|
2054
2101
|
const node = nodeRef.current;
|
|
@@ -2057,7 +2104,7 @@ function useAvailableWidth() {
|
|
|
2057
2104
|
window.addEventListener("resize", remeasure);
|
|
2058
2105
|
return () => window.removeEventListener("resize", remeasure);
|
|
2059
2106
|
}, []);
|
|
2060
|
-
const onLayout =
|
|
2107
|
+
const onLayout = React12.useCallback((event) => {
|
|
2061
2108
|
if (IS_WEB3) return;
|
|
2062
2109
|
setWidth(event.nativeEvent.layout.width);
|
|
2063
2110
|
}, []);
|
|
@@ -2066,7 +2113,7 @@ function useAvailableWidth() {
|
|
|
2066
2113
|
var AVG_CHAR_WIDTH_RATIO = 0.58;
|
|
2067
2114
|
var DEFAULT_FONT_SIZE2 = 13;
|
|
2068
2115
|
var UNMEASURED2 = 0;
|
|
2069
|
-
var
|
|
2116
|
+
var styles19 = reactNative.StyleSheet.create({
|
|
2070
2117
|
base: { fontSize: DEFAULT_FONT_SIZE2 },
|
|
2071
2118
|
/** `minWidth: 0` lets the text shrink inside a flex row instead of forcing the row wider. */
|
|
2072
2119
|
fill: { flexShrink: 1, minWidth: 0 }
|
|
@@ -2086,8 +2133,8 @@ var TruncatedText = ({
|
|
|
2086
2133
|
accessibilityHint
|
|
2087
2134
|
}) => {
|
|
2088
2135
|
const { width, measureRef, onLayout } = useAvailableWidth();
|
|
2089
|
-
const hostRef =
|
|
2090
|
-
const attachRef =
|
|
2136
|
+
const hostRef = React12.useRef(null);
|
|
2137
|
+
const attachRef = React12.useCallback(
|
|
2091
2138
|
(node) => {
|
|
2092
2139
|
hostRef.current = node;
|
|
2093
2140
|
measureRef(node);
|
|
@@ -2096,12 +2143,12 @@ var TruncatedText = ({
|
|
|
2096
2143
|
},
|
|
2097
2144
|
[value, measureRef]
|
|
2098
2145
|
);
|
|
2099
|
-
const flatStyle =
|
|
2100
|
-
() => reactNative.StyleSheet.flatten([
|
|
2146
|
+
const flatStyle = React12.useMemo(
|
|
2147
|
+
() => reactNative.StyleSheet.flatten([styles19.base, style]),
|
|
2101
2148
|
[style]
|
|
2102
2149
|
);
|
|
2103
2150
|
const fontSize = flatStyle.fontSize ?? DEFAULT_FONT_SIZE2;
|
|
2104
|
-
const display =
|
|
2151
|
+
const display = React12.useMemo(() => {
|
|
2105
2152
|
const source = isUrl ? formatUrlForDisplay(value) : value;
|
|
2106
2153
|
const budget = charBudget(width, fontSize);
|
|
2107
2154
|
return budget === UNMEASURED2 ? source : truncateMiddle(source, budget);
|
|
@@ -2112,7 +2159,7 @@ var TruncatedText = ({
|
|
|
2112
2159
|
ref: attachRef,
|
|
2113
2160
|
onLayout,
|
|
2114
2161
|
numberOfLines: 1,
|
|
2115
|
-
style: [
|
|
2162
|
+
style: [styles19.base, styles19.fill, style],
|
|
2116
2163
|
testID,
|
|
2117
2164
|
accessibilityRole: onPress !== void 0 || href !== void 0 ? "link" : "text",
|
|
2118
2165
|
accessibilityLabel,
|
|
@@ -2183,17 +2230,17 @@ async function copyText(value, writer) {
|
|
|
2183
2230
|
// src/CopyableId/useCopyToClipboard.ts
|
|
2184
2231
|
var COPY_FEEDBACK_MS = 2e3;
|
|
2185
2232
|
function useCopyToClipboard(value, writer) {
|
|
2186
|
-
const [status, setStatus] =
|
|
2187
|
-
const timerRef =
|
|
2188
|
-
const mountedRef =
|
|
2189
|
-
|
|
2233
|
+
const [status, setStatus] = React12.useState("idle" /* Idle */);
|
|
2234
|
+
const timerRef = React12.useRef(null);
|
|
2235
|
+
const mountedRef = React12.useRef(true);
|
|
2236
|
+
React12.useEffect(() => {
|
|
2190
2237
|
mountedRef.current = true;
|
|
2191
2238
|
return () => {
|
|
2192
2239
|
mountedRef.current = false;
|
|
2193
2240
|
if (timerRef.current !== null) clearTimeout(timerRef.current);
|
|
2194
2241
|
};
|
|
2195
2242
|
}, []);
|
|
2196
|
-
const copy =
|
|
2243
|
+
const copy = React12.useCallback(() => {
|
|
2197
2244
|
void (async () => {
|
|
2198
2245
|
const ok = await copyText(value, writer);
|
|
2199
2246
|
if (!mountedRef.current) return;
|
|
@@ -2215,7 +2262,7 @@ var LABEL_LETTER_SPACING = 0.4;
|
|
|
2215
2262
|
var ACTION_PADDING_H = 6;
|
|
2216
2263
|
var ACTION_PADDING_V = 2;
|
|
2217
2264
|
var ACTION_RADIUS = 6;
|
|
2218
|
-
var
|
|
2265
|
+
var styles20 = reactNative.StyleSheet.create({
|
|
2219
2266
|
cell: { gap: CELL_GAP },
|
|
2220
2267
|
label: {
|
|
2221
2268
|
fontSize: LABEL_FONT_SIZE,
|
|
@@ -2257,7 +2304,7 @@ var styles19 = reactNative.StyleSheet.create({
|
|
|
2257
2304
|
var TONE_STEP = "500";
|
|
2258
2305
|
function useActionState(status) {
|
|
2259
2306
|
const { theme } = uiFeedback.useUi();
|
|
2260
|
-
return
|
|
2307
|
+
return React12.useMemo(() => {
|
|
2261
2308
|
const primary = theme.palette.primary[TONE_STEP];
|
|
2262
2309
|
if (status === "copied" /* Copied */) {
|
|
2263
2310
|
return { key: LAYOUT_I18N.copied, color: theme.semantic.success?.[TONE_STEP] ?? primary };
|
|
@@ -2280,14 +2327,14 @@ var CopyableId = ({
|
|
|
2280
2327
|
const { colors } = theme;
|
|
2281
2328
|
const { status, copy } = useCopyToClipboard(value, writer);
|
|
2282
2329
|
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:
|
|
2330
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles20.cell, style], testID, children: [
|
|
2331
|
+
label !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles20.label, { color: colors.textSecondary }], children: label }),
|
|
2332
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles20.row, children: [
|
|
2333
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles20.valueWrap, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2287
2334
|
TruncatedText,
|
|
2288
2335
|
{
|
|
2289
2336
|
value,
|
|
2290
|
-
style: [
|
|
2337
|
+
style: [styles20.value, { color: colors.text }],
|
|
2291
2338
|
testID: `${testID}-value`,
|
|
2292
2339
|
accessibilityLabel: accessibilityLabel ?? value,
|
|
2293
2340
|
accessibilityHint: t(LAYOUT_I18N.copyableIdHint)
|
|
@@ -2301,7 +2348,7 @@ var CopyableId = ({
|
|
|
2301
2348
|
accessibilityLabel: t(action.key),
|
|
2302
2349
|
accessibilityHint: t(LAYOUT_I18N.copyHint),
|
|
2303
2350
|
testID: `${testID}-copy`,
|
|
2304
|
-
style: [
|
|
2351
|
+
style: [styles20.action, { color: action.color }],
|
|
2305
2352
|
children: t(action.key)
|
|
2306
2353
|
}
|
|
2307
2354
|
)
|
|
@@ -2326,15 +2373,15 @@ function formatBuildInfo(buildVersion, apiCommit) {
|
|
|
2326
2373
|
return `${base}${API_COMMIT_SEPARATOR}${shortenCommit(commit)}`;
|
|
2327
2374
|
}
|
|
2328
2375
|
function useApiCommit(apiBaseUrl, fetchImpl) {
|
|
2329
|
-
const [commit, setCommit] =
|
|
2330
|
-
const mountedRef =
|
|
2331
|
-
|
|
2376
|
+
const [commit, setCommit] = React12.useState(void 0);
|
|
2377
|
+
const mountedRef = React12.useRef(true);
|
|
2378
|
+
React12.useEffect(() => {
|
|
2332
2379
|
mountedRef.current = true;
|
|
2333
2380
|
return () => {
|
|
2334
2381
|
mountedRef.current = false;
|
|
2335
2382
|
};
|
|
2336
2383
|
}, []);
|
|
2337
|
-
|
|
2384
|
+
React12.useEffect(() => {
|
|
2338
2385
|
if (apiBaseUrl === void 0 || apiBaseUrl === "") return;
|
|
2339
2386
|
const doFetch = fetchImpl ?? (typeof fetch !== "undefined" ? fetch : void 0);
|
|
2340
2387
|
if (doFetch === void 0) return;
|
|
@@ -2356,7 +2403,7 @@ var FOOTER_PADDING_V = 6;
|
|
|
2356
2403
|
var FOOTER_PADDING_H = 12;
|
|
2357
2404
|
var FOOTER_FONT_SIZE = 11;
|
|
2358
2405
|
var FOOTER_OPACITY = 0.75;
|
|
2359
|
-
var
|
|
2406
|
+
var styles21 = reactNative.StyleSheet.create({
|
|
2360
2407
|
footer: {
|
|
2361
2408
|
paddingVertical: FOOTER_PADDING_V,
|
|
2362
2409
|
paddingHorizontal: FOOTER_PADDING_H,
|
|
@@ -2381,8 +2428,8 @@ var BuildInfoFooter = ({
|
|
|
2381
2428
|
const fetchedCommit = useApiCommit(apiCommit === void 0 ? apiBaseUrl : void 0, fetchImpl);
|
|
2382
2429
|
const commit = apiCommit ?? fetchedCommit;
|
|
2383
2430
|
const label = formatBuildInfo(buildVersion, commit);
|
|
2384
|
-
const textStyle =
|
|
2385
|
-
() => [
|
|
2431
|
+
const textStyle = React12.useMemo(
|
|
2432
|
+
() => [styles21.text, { color: theme.colors.textSecondary }],
|
|
2386
2433
|
[theme.colors.textSecondary]
|
|
2387
2434
|
);
|
|
2388
2435
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2390,7 +2437,7 @@ var BuildInfoFooter = ({
|
|
|
2390
2437
|
{
|
|
2391
2438
|
accessibilityLabel: accessibilityLabel ?? label,
|
|
2392
2439
|
accessibilityHint: accessibilityHint ?? t(LAYOUT_I18N.buildInfoHint),
|
|
2393
|
-
style: [
|
|
2440
|
+
style: [styles21.footer, style],
|
|
2394
2441
|
testID,
|
|
2395
2442
|
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: textStyle, children: label })
|
|
2396
2443
|
}
|
|
@@ -2401,7 +2448,7 @@ var BORDER = 2;
|
|
|
2401
2448
|
var GLYPH_SIZE = 14;
|
|
2402
2449
|
var GLYPH_LINE = 16;
|
|
2403
2450
|
var TICK = "\u2713";
|
|
2404
|
-
var
|
|
2451
|
+
var styles22 = reactNative.StyleSheet.create({
|
|
2405
2452
|
circle: {
|
|
2406
2453
|
width: SIZE,
|
|
2407
2454
|
height: SIZE,
|
|
@@ -2418,14 +2465,14 @@ var CheckMark = ({ filled, accent, ring, glyphColor, testID }) => /* @__PURE__ *
|
|
|
2418
2465
|
"aria-hidden": true,
|
|
2419
2466
|
accessibilityElementsHidden: true,
|
|
2420
2467
|
importantForAccessibility: "no-hide-descendants",
|
|
2421
|
-
style: [
|
|
2468
|
+
style: [styles22.circle, { borderColor: filled ? accent : ring, backgroundColor: filled ? accent : void 0 }],
|
|
2422
2469
|
testID,
|
|
2423
|
-
children: filled ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
2470
|
+
children: filled ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles22.glyph, { color: glyphColor }], children: TICK }) : null
|
|
2424
2471
|
}
|
|
2425
2472
|
);
|
|
2426
|
-
var ListRowToneContext =
|
|
2473
|
+
var ListRowToneContext = React12.createContext(null);
|
|
2427
2474
|
function useListRowTone() {
|
|
2428
|
-
return
|
|
2475
|
+
return React12.useContext(ListRowToneContext);
|
|
2429
2476
|
}
|
|
2430
2477
|
function useRowPalette() {
|
|
2431
2478
|
const { colors, palette, semantic } = uiFeedback.useUi().theme;
|
|
@@ -2455,6 +2502,19 @@ var RowSelectedStyle = /* @__PURE__ */ ((RowSelectedStyle2) => {
|
|
|
2455
2502
|
return RowSelectedStyle2;
|
|
2456
2503
|
})(RowSelectedStyle || {});
|
|
2457
2504
|
|
|
2505
|
+
// src/ListRow/utils/focusVisible.ts
|
|
2506
|
+
function canMatch(target) {
|
|
2507
|
+
return typeof target === "object" && target !== null && typeof target.matches === "function";
|
|
2508
|
+
}
|
|
2509
|
+
function isFocusVisible(target) {
|
|
2510
|
+
if (!canMatch(target)) return true;
|
|
2511
|
+
try {
|
|
2512
|
+
return target.matches(":focus-visible");
|
|
2513
|
+
} catch {
|
|
2514
|
+
return true;
|
|
2515
|
+
}
|
|
2516
|
+
}
|
|
2517
|
+
|
|
2458
2518
|
// src/ListRow/utils/rowLook.ts
|
|
2459
2519
|
var BAR_WIDTH = 4;
|
|
2460
2520
|
var OUTLINE_WIDTH = 2;
|
|
@@ -2530,7 +2590,7 @@ var PAD_V = 12;
|
|
|
2530
2590
|
var GAP = 4;
|
|
2531
2591
|
var MARK_GAP = 12;
|
|
2532
2592
|
var LINE_GAP = 8;
|
|
2533
|
-
var
|
|
2593
|
+
var styles23 = reactNative.StyleSheet.create({
|
|
2534
2594
|
row: {
|
|
2535
2595
|
flexDirection: "row",
|
|
2536
2596
|
alignItems: "center",
|
|
@@ -2549,9 +2609,12 @@ var styles22 = reactNative.StyleSheet.create({
|
|
|
2549
2609
|
function pressedProps(selected) {
|
|
2550
2610
|
return { "aria-pressed": selected };
|
|
2551
2611
|
}
|
|
2612
|
+
function focusTarget(event) {
|
|
2613
|
+
return event?.nativeEvent?.target;
|
|
2614
|
+
}
|
|
2552
2615
|
function slot(node, color, strong) {
|
|
2553
2616
|
if (typeof node !== "string") return node;
|
|
2554
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
2617
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles23.shrink, strong ? styles23.strong : null, { color }], children: node });
|
|
2555
2618
|
}
|
|
2556
2619
|
var ListRow = ({
|
|
2557
2620
|
title,
|
|
@@ -2568,9 +2631,9 @@ var ListRow = ({
|
|
|
2568
2631
|
}) => {
|
|
2569
2632
|
const palette = useRowPalette();
|
|
2570
2633
|
const { colors } = uiFeedback.useUi().theme;
|
|
2571
|
-
const [focused, setFocused] =
|
|
2634
|
+
const [focused, setFocused] = React12.useState(false);
|
|
2572
2635
|
const rest = resolveRowLook(selectedStyle, { selected, hovered: false, pressed: false, focused }, palette);
|
|
2573
|
-
const tone =
|
|
2636
|
+
const tone = React12.useMemo(() => ({ textColor: rest.textColor, inverse: rest.inverse }), [rest.textColor, rest.inverse]);
|
|
2574
2637
|
const checkTestId = testID === void 0 ? void 0 : `${testID}-check`;
|
|
2575
2638
|
return /* @__PURE__ */ jsxRuntime.jsxs(ListRowToneContext.Provider, { value: tone, children: [
|
|
2576
2639
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -2583,27 +2646,27 @@ var ListRow = ({
|
|
|
2583
2646
|
style: (state) => {
|
|
2584
2647
|
const { pressed, hovered } = state;
|
|
2585
2648
|
const look = resolveRowLook(selectedStyle, { selected, pressed, focused, hovered: hovered === true }, palette);
|
|
2586
|
-
return [
|
|
2649
|
+
return [styles23.row, { borderTopColor: colors.border }, look.container];
|
|
2587
2650
|
},
|
|
2588
2651
|
testID,
|
|
2589
2652
|
onBlur: () => {
|
|
2590
2653
|
setFocused(false);
|
|
2591
2654
|
},
|
|
2592
|
-
onFocus: () => {
|
|
2593
|
-
setFocused(
|
|
2655
|
+
onFocus: (event) => {
|
|
2656
|
+
setFocused(isFocusVisible(focusTarget(event)));
|
|
2594
2657
|
},
|
|
2595
2658
|
onPress,
|
|
2596
2659
|
...pressedProps(selected),
|
|
2597
2660
|
children: [
|
|
2598
2661
|
rest.showCheck ? /* @__PURE__ */ jsxRuntime.jsx(CheckMark, { accent: palette.accent, filled: rest.checkFilled, glyphColor: palette.background, ring: palette.border, testID: checkTestId }) : null,
|
|
2599
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
2600
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
2662
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles23.body, children: [
|
|
2663
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles23.line, children: [
|
|
2601
2664
|
slot(title, rest.titleColor, true),
|
|
2602
2665
|
slot(trailing, rest.textColor, true)
|
|
2603
2666
|
] }),
|
|
2604
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
2605
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style:
|
|
2606
|
-
badges === void 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style:
|
|
2667
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles23.line, children: [
|
|
2668
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles23.shrink, children: slot(meta, rest.textColor, false) }),
|
|
2669
|
+
badges === void 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles23.badges, children: badges })
|
|
2607
2670
|
] })
|
|
2608
2671
|
] })
|
|
2609
2672
|
]
|
|
@@ -2613,6 +2676,7 @@ var ListRow = ({
|
|
|
2613
2676
|
] });
|
|
2614
2677
|
};
|
|
2615
2678
|
|
|
2679
|
+
exports.A4_PAGE = A4_PAGE;
|
|
2616
2680
|
exports.API_COMMIT_SEPARATOR = API_COMMIT_SEPARATOR;
|
|
2617
2681
|
exports.Accordion = Accordion;
|
|
2618
2682
|
exports.AccordionItem = AccordionItem;
|
|
@@ -2635,6 +2699,7 @@ exports.MIN_TARGET_PX = MIN_TARGET_PX;
|
|
|
2635
2699
|
exports.Modal = Modal3;
|
|
2636
2700
|
exports.ModalDropdown = ModalDropdown;
|
|
2637
2701
|
exports.ModalShell = ModalShell;
|
|
2702
|
+
exports.PageFrame = PageFrame;
|
|
2638
2703
|
exports.RowSelectedStyle = RowSelectedStyle;
|
|
2639
2704
|
exports.ScreenColumn = ScreenColumn;
|
|
2640
2705
|
exports.Section = Section;
|
|
@@ -2654,7 +2719,9 @@ exports.formatBuildInfo = formatBuildInfo;
|
|
|
2654
2719
|
exports.formatUrlForDisplay = formatUrlForDisplay;
|
|
2655
2720
|
exports.isKeyboardOpen = isKeyboardOpen;
|
|
2656
2721
|
exports.isWideWebViewport = isWideWebViewport;
|
|
2722
|
+
exports.pageScale = pageScale;
|
|
2657
2723
|
exports.resolveRowLook = resolveRowLook;
|
|
2724
|
+
exports.scaledFrame = scaledFrame;
|
|
2658
2725
|
exports.shortenCommit = shortenCommit;
|
|
2659
2726
|
exports.trimTrailingSlash = trimTrailingSlash;
|
|
2660
2727
|
exports.truncateMiddle = truncateMiddle;
|