@dloizides/ui-layout 1.38.1 → 1.39.1
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 +13 -0
- package/dist/index.d.mts +16 -2
- package/dist/index.d.ts +16 -2
- package/dist/index.js +219 -135
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +131 -48
- 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 React13 = 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 React13__default = /*#__PURE__*/_interopDefault(React13);
|
|
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 = React13__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
|
);
|
|
@@ -105,6 +105,7 @@ var LAYOUT_TEST_IDS = {
|
|
|
105
105
|
modalShellClose: "cancel-button",
|
|
106
106
|
/** Default base testID for the centered `Modal`; ✕ is `modal-close`, backdrop `modal-backdrop`. */
|
|
107
107
|
modal: "modal",
|
|
108
|
+
sideSheet: "side-sheet",
|
|
108
109
|
/** Default base testID for `ConfirmDialog`; Confirm/Cancel are `confirm-dialog-{confirm,cancel}`. */
|
|
109
110
|
confirmDialog: "confirm-dialog",
|
|
110
111
|
accordion: "accordion",
|
|
@@ -212,7 +213,7 @@ var Heading = ({
|
|
|
212
213
|
testID
|
|
213
214
|
}) => {
|
|
214
215
|
const { theme } = uiFeedback.useUi();
|
|
215
|
-
const headingStyle =
|
|
216
|
+
const headingStyle = React13__default.default.useMemo(
|
|
216
217
|
() => [styles3.heading, { color: theme.colors.text }, style],
|
|
217
218
|
[theme.colors.text, style]
|
|
218
219
|
);
|
|
@@ -267,9 +268,9 @@ var StatusBadge = ({
|
|
|
267
268
|
accessibilityHint
|
|
268
269
|
}) => {
|
|
269
270
|
const { t } = uiFeedback.useUi();
|
|
270
|
-
const dynamicBadge =
|
|
271
|
-
const dashedColor =
|
|
272
|
-
const dynamicText =
|
|
271
|
+
const dynamicBadge = React13.useMemo(() => ({ backgroundColor }), [backgroundColor]);
|
|
272
|
+
const dashedColor = React13.useMemo(() => ({ borderColor: color }), [color]);
|
|
273
|
+
const dynamicText = React13.useMemo(() => ({ color }), [color]);
|
|
273
274
|
const hasIcon = icon !== void 0 && icon !== null;
|
|
274
275
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
275
276
|
reactNative.View,
|
|
@@ -289,9 +290,9 @@ function isPastStickyLine(sentinelTop, isIntersecting, topOffset) {
|
|
|
289
290
|
return !isIntersecting && sentinelTop < topOffset;
|
|
290
291
|
}
|
|
291
292
|
function useStuckSentinel(topOffset) {
|
|
292
|
-
const sentinelRef =
|
|
293
|
-
const [isStuck, setIsStuck] =
|
|
294
|
-
|
|
293
|
+
const sentinelRef = React13.useRef(null);
|
|
294
|
+
const [isStuck, setIsStuck] = React13.useState(false);
|
|
295
|
+
React13.useEffect(() => {
|
|
295
296
|
const node = sentinelRef.current;
|
|
296
297
|
if (node === null || typeof IntersectionObserver === "undefined") return void 0;
|
|
297
298
|
const observer = new IntersectionObserver(
|
|
@@ -312,9 +313,9 @@ function isKeyboardOpen(visibleHeight, tallestHeight) {
|
|
|
312
313
|
return visibleHeight < tallestHeight * KEYBOARD_HEIGHT_RATIO;
|
|
313
314
|
}
|
|
314
315
|
function useVisibleViewport() {
|
|
315
|
-
const [state, setState] =
|
|
316
|
-
const tallest =
|
|
317
|
-
|
|
316
|
+
const [state, setState] = React13.useState(INITIAL);
|
|
317
|
+
const tallest = React13.useRef({ width: 0, height: 0 });
|
|
318
|
+
React13.useEffect(() => {
|
|
318
319
|
const viewport = typeof window === "undefined" ? void 0 : window.visualViewport;
|
|
319
320
|
if (viewport === void 0 || viewport === null) return void 0;
|
|
320
321
|
const read = () => {
|
|
@@ -357,7 +358,7 @@ var StickyPreview = ({
|
|
|
357
358
|
const { offsetTop, keyboardOpen } = useVisibleViewport();
|
|
358
359
|
const { sentinelRef, isStuck } = useStuckSentinel(topOffset);
|
|
359
360
|
const isCompact = forceCompact || isStuck || keyboardOpen;
|
|
360
|
-
const pinned =
|
|
361
|
+
const pinned = React13.useMemo(() => {
|
|
361
362
|
const web = { position: "sticky", top: topOffset + offsetTop, zIndex: STICKY_Z_INDEX };
|
|
362
363
|
return reactNative.Platform.OS === WEB_PLATFORM ? web : {};
|
|
363
364
|
}, [offsetTop, topOffset]);
|
|
@@ -381,7 +382,7 @@ var StickyPreview = ({
|
|
|
381
382
|
] });
|
|
382
383
|
};
|
|
383
384
|
function useEscapeKey(enabled, onClose) {
|
|
384
|
-
|
|
385
|
+
React13.useEffect(() => {
|
|
385
386
|
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
386
387
|
const onKeyDown = (event) => {
|
|
387
388
|
if (event.key === "Escape") onClose();
|
|
@@ -438,8 +439,8 @@ function handleKeyDown(domNode, event) {
|
|
|
438
439
|
}
|
|
439
440
|
}
|
|
440
441
|
function useFocusTrap(containerRef, enabled, initialFocusTestID) {
|
|
441
|
-
const previousFocusRef =
|
|
442
|
-
|
|
442
|
+
const previousFocusRef = React13.useRef(null);
|
|
443
|
+
React13.useEffect(() => {
|
|
443
444
|
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
444
445
|
const domNode = containerRef.current;
|
|
445
446
|
if (!domNode) return;
|
|
@@ -456,7 +457,7 @@ function useFocusTrap(containerRef, enabled, initialFocusTestID) {
|
|
|
456
457
|
}, [containerRef, enabled, initialFocusTestID]);
|
|
457
458
|
}
|
|
458
459
|
function useScrollLock(enabled) {
|
|
459
|
-
|
|
460
|
+
React13.useEffect(() => {
|
|
460
461
|
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
461
462
|
const { body } = document;
|
|
462
463
|
const previousOverflow = body.style.overflow;
|
|
@@ -517,7 +518,7 @@ var Modal = ({
|
|
|
517
518
|
initialFocusTestID
|
|
518
519
|
}) => {
|
|
519
520
|
const { theme, t } = uiFeedback.useUi();
|
|
520
|
-
const dialogRef =
|
|
521
|
+
const dialogRef = React13.useRef(null);
|
|
521
522
|
const backdrop = uiMotion.useEnterExit({ visible });
|
|
522
523
|
const panel = uiMotion.useEnterExit({ visible, fromScale: PANEL_ENTER_SCALE });
|
|
523
524
|
const mounted = panel.mounted || backdrop.mounted;
|
|
@@ -526,7 +527,7 @@ var Modal = ({
|
|
|
526
527
|
useScrollLock(visible);
|
|
527
528
|
const accessibleName = accessibilityLabel ?? title ?? t(LAYOUT_I18N.dialog);
|
|
528
529
|
const closeLabel = t(LAYOUT_I18N.dialogClose);
|
|
529
|
-
const dialogStyle =
|
|
530
|
+
const dialogStyle = React13.useMemo(
|
|
530
531
|
() => [styles6.dialog, { backgroundColor: theme.colors.surface, maxWidth: SIZE_MAX_WIDTH[size] }],
|
|
531
532
|
[theme.colors.surface, size]
|
|
532
533
|
);
|
|
@@ -626,13 +627,13 @@ var PageFrame = ({
|
|
|
626
627
|
enlargeable = false
|
|
627
628
|
}) => {
|
|
628
629
|
const { t } = uiFeedback.useUi();
|
|
629
|
-
const [containerWidth, setContainerWidth] =
|
|
630
|
-
const [enlarged, setEnlarged] =
|
|
631
|
-
const onLayout =
|
|
630
|
+
const [containerWidth, setContainerWidth] = React13.useState(0);
|
|
631
|
+
const [enlarged, setEnlarged] = React13.useState(false);
|
|
632
|
+
const onLayout = React13.useCallback((event) => {
|
|
632
633
|
setContainerWidth(event.nativeEvent.layout.width);
|
|
633
634
|
}, []);
|
|
634
|
-
const open =
|
|
635
|
-
const close =
|
|
635
|
+
const open = React13.useCallback(() => setEnlarged(true), []);
|
|
636
|
+
const close = React13.useCallback(() => setEnlarged(false), []);
|
|
636
637
|
const frame = scaledFrame(containerWidth, pageSize);
|
|
637
638
|
const preview = /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles7.outer, { height: frame.height }], testID, onLayout, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
638
639
|
reactNative.View,
|
|
@@ -773,6 +774,11 @@ var MENU_PADDING = 4;
|
|
|
773
774
|
var MENU_SCROLL_MAX_HEIGHT = MENU_MAX_HEIGHT - (BORDER_WIDTH2 + MENU_PADDING) * 2;
|
|
774
775
|
var MENU_BOX_SHADOW = "0px 2px 8px rgba(0, 0, 0, 0.15)";
|
|
775
776
|
var MENU_VIEWPORT_MARGIN = 8;
|
|
777
|
+
var COMPACT_TRIGGER_MENU_MIN_WIDTH = 160;
|
|
778
|
+
function resolveMenuMinWidth(menuMinWidth, hasCustomTrigger) {
|
|
779
|
+
if (menuMinWidth !== void 0) return menuMinWidth;
|
|
780
|
+
return hasCustomTrigger ? COMPACT_TRIGGER_MENU_MIN_WIDTH : void 0;
|
|
781
|
+
}
|
|
776
782
|
function buildPortalPopoverStyle(rect, minWidth = 0, viewportWidth = 0) {
|
|
777
783
|
const width = Math.max(rect.width, minWidth);
|
|
778
784
|
let left = rect.left;
|
|
@@ -883,7 +889,7 @@ var OptionRow = ({
|
|
|
883
889
|
}) => {
|
|
884
890
|
const { theme, t } = uiFeedback.useUi();
|
|
885
891
|
const { colors } = theme;
|
|
886
|
-
const handlePress =
|
|
892
|
+
const handlePress = React13.useCallback(() => {
|
|
887
893
|
onSelect();
|
|
888
894
|
}, [onSelect]);
|
|
889
895
|
const accentColor = theme.palette.primary["500"];
|
|
@@ -972,8 +978,8 @@ function isSameRect(a, b) {
|
|
|
972
978
|
return a.top === b.top && a.left === b.left && a.width === b.width && a.bottom === b.bottom;
|
|
973
979
|
}
|
|
974
980
|
function useAnchorTracking(containerRef, onOutOfView) {
|
|
975
|
-
const [rect, setRect] =
|
|
976
|
-
|
|
981
|
+
const [rect, setRect] = React13.useState(() => readAnchorRect(containerRef));
|
|
982
|
+
React13.useLayoutEffect(() => {
|
|
977
983
|
if (!IS_WEB) return void 0;
|
|
978
984
|
let frame = null;
|
|
979
985
|
let isDisposed = false;
|
|
@@ -1052,7 +1058,7 @@ function buildKeyHandler(params) {
|
|
|
1052
1058
|
}
|
|
1053
1059
|
function useMenuKeyboard(params) {
|
|
1054
1060
|
const { containerRef, menuRef, enabled, onClose } = params;
|
|
1055
|
-
|
|
1061
|
+
React13.useEffect(() => {
|
|
1056
1062
|
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
1057
1063
|
const onKeyDown = buildKeyHandler(params);
|
|
1058
1064
|
const onMouseDown = (event) => {
|
|
@@ -1116,27 +1122,27 @@ var InlineMenu = ({
|
|
|
1116
1122
|
}) => {
|
|
1117
1123
|
const { theme } = uiFeedback.useUi();
|
|
1118
1124
|
const { colors } = theme;
|
|
1119
|
-
const menuRef =
|
|
1125
|
+
const menuRef = React13.useRef(null);
|
|
1120
1126
|
const rect = useAnchorTracking(containerRef, onClose);
|
|
1121
|
-
const selectedIndex =
|
|
1127
|
+
const selectedIndex = React13.useMemo(
|
|
1122
1128
|
() => Math.max(0, options.findIndex((opt) => opt.value === value)),
|
|
1123
1129
|
[options, value]
|
|
1124
1130
|
);
|
|
1125
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
1126
|
-
const handleSelect =
|
|
1131
|
+
const [highlightedIndex, setHighlightedIndex] = React13.useState(() => selectedIndex);
|
|
1132
|
+
const handleSelect = React13.useCallback(
|
|
1127
1133
|
(optionValue) => {
|
|
1128
1134
|
if (isOpen) onSelect(optionValue);
|
|
1129
1135
|
},
|
|
1130
1136
|
[isOpen, onSelect]
|
|
1131
1137
|
);
|
|
1132
|
-
const selectAt =
|
|
1138
|
+
const selectAt = React13.useCallback(
|
|
1133
1139
|
(index) => {
|
|
1134
1140
|
const option = options[index];
|
|
1135
1141
|
if (option !== void 0) handleSelect(option.value);
|
|
1136
1142
|
},
|
|
1137
1143
|
[options, handleSelect]
|
|
1138
1144
|
);
|
|
1139
|
-
const selectHighlighted =
|
|
1145
|
+
const selectHighlighted = React13.useCallback(
|
|
1140
1146
|
() => {
|
|
1141
1147
|
selectAt(highlightedIndex);
|
|
1142
1148
|
},
|
|
@@ -1151,7 +1157,7 @@ var InlineMenu = ({
|
|
|
1151
1157
|
onSelectHighlighted: selectHighlighted,
|
|
1152
1158
|
onClose
|
|
1153
1159
|
});
|
|
1154
|
-
const popoverStyle =
|
|
1160
|
+
const popoverStyle = React13.useMemo(() => {
|
|
1155
1161
|
const themed = { borderColor: colors.border, backgroundColor: colors.surface };
|
|
1156
1162
|
if (IS_WEB2) {
|
|
1157
1163
|
const viewportWidth = typeof window !== "undefined" ? window.innerWidth : 0;
|
|
@@ -1296,7 +1302,7 @@ var ModalDropdown = ({
|
|
|
1296
1302
|
const { colors } = theme;
|
|
1297
1303
|
const resolvedVariant = useResolvedDropdownVariant(variant);
|
|
1298
1304
|
const isMenu = resolvedVariant === "menu" /* Menu */;
|
|
1299
|
-
const [isOpen, setIsOpen] =
|
|
1305
|
+
const [isOpen, setIsOpen] = React13.useState(false);
|
|
1300
1306
|
const { a11yProps, hintNode } = a11y.useA11y({
|
|
1301
1307
|
label: accessibilityLabel,
|
|
1302
1308
|
hint: accessibilityHint,
|
|
@@ -1304,10 +1310,10 @@ var ModalDropdown = ({
|
|
|
1304
1310
|
state: { expanded: isOpen },
|
|
1305
1311
|
testID
|
|
1306
1312
|
});
|
|
1307
|
-
const anchorRef =
|
|
1308
|
-
const triggerRef =
|
|
1313
|
+
const anchorRef = React13.useRef(null);
|
|
1314
|
+
const triggerRef = React13.useRef(null);
|
|
1309
1315
|
const popupProps = { "aria-haspopup": isMenu ? "menu" : "dialog" };
|
|
1310
|
-
const dialogRef =
|
|
1316
|
+
const dialogRef = React13.useRef(null);
|
|
1311
1317
|
useFocusTrap(dialogRef, isOpen && !isMenu);
|
|
1312
1318
|
const menuAnim = uiMotion.useEnterExit({
|
|
1313
1319
|
visible: isMenu && isOpen,
|
|
@@ -1319,17 +1325,17 @@ var ModalDropdown = ({
|
|
|
1319
1325
|
fromScale: POPOVER_ENTER_SCALE,
|
|
1320
1326
|
duration: POPOVER_MOTION_MS
|
|
1321
1327
|
});
|
|
1322
|
-
const selectedLabel =
|
|
1328
|
+
const selectedLabel = React13.useMemo(() => {
|
|
1323
1329
|
const found = options.find((opt) => opt.value === value);
|
|
1324
1330
|
return found?.label ?? t(LAYOUT_I18N.selectPlaceholder);
|
|
1325
1331
|
}, [options, value, t]);
|
|
1326
|
-
const handleToggle =
|
|
1332
|
+
const handleToggle = React13.useCallback(() => {
|
|
1327
1333
|
setIsOpen((prev) => !prev);
|
|
1328
1334
|
}, []);
|
|
1329
|
-
const handleClose =
|
|
1335
|
+
const handleClose = React13.useCallback(() => {
|
|
1330
1336
|
setIsOpen(false);
|
|
1331
1337
|
}, []);
|
|
1332
|
-
const handleSelect =
|
|
1338
|
+
const handleSelect = React13.useCallback(
|
|
1333
1339
|
(optionValue) => {
|
|
1334
1340
|
onChange(optionValue);
|
|
1335
1341
|
setIsOpen(false);
|
|
@@ -1339,7 +1345,7 @@ var ModalDropdown = ({
|
|
|
1339
1345
|
);
|
|
1340
1346
|
const isHamburger = showHamburger;
|
|
1341
1347
|
const isCaret = showCaret && !isHamburger;
|
|
1342
|
-
const containerStyle =
|
|
1348
|
+
const containerStyle = React13.useMemo(
|
|
1343
1349
|
() => renderTrigger !== void 0 ? void 0 : [
|
|
1344
1350
|
styles12.container,
|
|
1345
1351
|
isHamburger ? styles12.containerHamburger : isCaret ? styles12.containerMenu : null,
|
|
@@ -1347,30 +1353,30 @@ var ModalDropdown = ({
|
|
|
1347
1353
|
],
|
|
1348
1354
|
[colors.border, colors.surface, renderTrigger, isHamburger, isCaret]
|
|
1349
1355
|
);
|
|
1350
|
-
const hamburgerStyle =
|
|
1356
|
+
const hamburgerStyle = React13.useMemo(
|
|
1351
1357
|
() => [styles12.hamburger, { color: colors.textSecondary }],
|
|
1352
1358
|
[colors.textSecondary]
|
|
1353
1359
|
);
|
|
1354
|
-
const caretStyle =
|
|
1360
|
+
const caretStyle = React13.useMemo(
|
|
1355
1361
|
() => [
|
|
1356
1362
|
styles12.caret,
|
|
1357
1363
|
{ color: colors.textSecondary, transform: [{ rotate: isOpen ? CARET_OPEN_ROTATION : CARET_CLOSED_ROTATION }] }
|
|
1358
1364
|
],
|
|
1359
1365
|
[colors.textSecondary, isOpen]
|
|
1360
1366
|
);
|
|
1361
|
-
const optionTestIDFor =
|
|
1367
|
+
const optionTestIDFor = React13.useCallback(
|
|
1362
1368
|
(optionValue) => optionTestID !== void 0 ? optionTestID(optionValue) : `${testID}-option-${String(optionValue)}`,
|
|
1363
1369
|
[optionTestID, testID]
|
|
1364
1370
|
);
|
|
1365
|
-
const anchorStyle =
|
|
1371
|
+
const anchorStyle = React13.useMemo(
|
|
1366
1372
|
() => [styles12.anchor, buildAnchorStackStyle(isMenu && isOpen)],
|
|
1367
1373
|
[isMenu, isOpen]
|
|
1368
1374
|
);
|
|
1369
|
-
const modalContentStyle =
|
|
1375
|
+
const modalContentStyle = React13.useMemo(
|
|
1370
1376
|
() => [styles12.modalContent, { backgroundColor: colors.surface }],
|
|
1371
1377
|
[colors.surface]
|
|
1372
1378
|
);
|
|
1373
|
-
const renderModalOption =
|
|
1379
|
+
const renderModalOption = React13.useCallback(
|
|
1374
1380
|
({ item }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1375
1381
|
OptionRow,
|
|
1376
1382
|
{
|
|
@@ -1383,7 +1389,7 @@ var ModalDropdown = ({
|
|
|
1383
1389
|
),
|
|
1384
1390
|
[handleSelect, optionTestIDFor, selectedMarker, value]
|
|
1385
1391
|
);
|
|
1386
|
-
const keyExtractor =
|
|
1392
|
+
const keyExtractor = React13.useCallback((item) => String(item.value), []);
|
|
1387
1393
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { ref: anchorRef, style: anchorStyle, children: [
|
|
1388
1394
|
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.TouchableOpacity, { ...a11yProps, ...popupProps, ref: triggerRef, style: containerStyle, onPress: handleToggle, children: [
|
|
1389
1395
|
renderTrigger !== void 0 ? renderTrigger({ label: selectedLabel, isOpen }) : isHamburger ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -1403,7 +1409,7 @@ var ModalDropdown = ({
|
|
|
1403
1409
|
containerRef: anchorRef,
|
|
1404
1410
|
isOpen,
|
|
1405
1411
|
menuHeading,
|
|
1406
|
-
menuMinWidth,
|
|
1412
|
+
menuMinWidth: resolveMenuMinWidth(menuMinWidth, renderTrigger !== void 0),
|
|
1407
1413
|
optionTestID: optionTestIDFor,
|
|
1408
1414
|
options,
|
|
1409
1415
|
selectedMarker,
|
|
@@ -1459,11 +1465,11 @@ var TabsMenu = ({
|
|
|
1459
1465
|
collapsedTrigger = "caret" /* Caret */
|
|
1460
1466
|
}) => {
|
|
1461
1467
|
const { t } = uiFeedback.useUi();
|
|
1462
|
-
const options =
|
|
1468
|
+
const options = React13.useMemo(
|
|
1463
1469
|
() => tabs.map((tab) => ({ label: tab.label, value: tab.key })),
|
|
1464
1470
|
[tabs]
|
|
1465
1471
|
);
|
|
1466
|
-
const optionTestID =
|
|
1472
|
+
const optionTestID = React13.useCallback(
|
|
1467
1473
|
(key) => {
|
|
1468
1474
|
const found = tabs.find((tab) => tab.key === key);
|
|
1469
1475
|
return found?.testID ?? `${idPrefix}-tab-${key}`;
|
|
@@ -1740,7 +1746,7 @@ var ModalShell = ({
|
|
|
1740
1746
|
}) => {
|
|
1741
1747
|
const { theme, t } = uiFeedback.useUi();
|
|
1742
1748
|
const { style: sheetStyle, mounted } = uiMotion.useEnterExit({ visible, fromScale: PANEL_ENTER_SCALE2 });
|
|
1743
|
-
const containerStyle =
|
|
1749
|
+
const containerStyle = React13__default.default.useMemo(
|
|
1744
1750
|
() => [styles15.container, { backgroundColor: theme.colors.background }, contentStyle],
|
|
1745
1751
|
[theme.colors.background, contentStyle]
|
|
1746
1752
|
);
|
|
@@ -1783,10 +1789,87 @@ var ModalShell = ({
|
|
|
1783
1789
|
}
|
|
1784
1790
|
);
|
|
1785
1791
|
};
|
|
1792
|
+
var SHEET_WIDTH = 560;
|
|
1793
|
+
var PHONE_CORNER = 16;
|
|
1794
|
+
var PHONE_ENTER_OFFSET = 24;
|
|
1795
|
+
var styles16 = reactNative.StyleSheet.create({
|
|
1796
|
+
root: { flex: 1 },
|
|
1797
|
+
scrim: { backgroundColor: uiFeedback.MODAL_OVERLAY_COLOR, pointerEvents: "none" },
|
|
1798
|
+
sheet: { position: "absolute", bottom: 0, overflow: "hidden" },
|
|
1799
|
+
wide: { top: 0, right: 0, width: SHEET_WIDTH, maxWidth: "100%", borderLeftWidth: 1 },
|
|
1800
|
+
phone: {
|
|
1801
|
+
top: MIN_TARGET_PX,
|
|
1802
|
+
left: 0,
|
|
1803
|
+
right: 0,
|
|
1804
|
+
borderTopLeftRadius: PHONE_CORNER,
|
|
1805
|
+
borderTopRightRadius: PHONE_CORNER
|
|
1806
|
+
},
|
|
1807
|
+
title: { paddingHorizontal: 16, paddingTop: 16 },
|
|
1808
|
+
scroll: { flex: 1 },
|
|
1809
|
+
content: { padding: 16, gap: 12 },
|
|
1810
|
+
bar: { flexDirection: "row", justifyContent: "flex-end", gap: 8, padding: 16, borderTopWidth: 1 }
|
|
1811
|
+
});
|
|
1812
|
+
var SideSheet = ({
|
|
1813
|
+
visible,
|
|
1814
|
+
onClose,
|
|
1815
|
+
title,
|
|
1816
|
+
children,
|
|
1817
|
+
footer,
|
|
1818
|
+
testID = LAYOUT_TEST_IDS.sideSheet,
|
|
1819
|
+
accessibilityLabel,
|
|
1820
|
+
initialFocusTestID
|
|
1821
|
+
}) => {
|
|
1822
|
+
const { theme, t } = uiFeedback.useUi();
|
|
1823
|
+
const isWide = useIsWideViewport();
|
|
1824
|
+
const sheetRef = React13.useRef(null);
|
|
1825
|
+
const backdrop = uiMotion.useEnterExit({ visible });
|
|
1826
|
+
const panel = uiMotion.useEnterExit({ visible, translateY: isWide ? 0 : PHONE_ENTER_OFFSET });
|
|
1827
|
+
const edges = { borderColor: theme.colors.border };
|
|
1828
|
+
useFocusTrap(sheetRef, visible && panel.mounted, initialFocusTestID);
|
|
1829
|
+
useEscapeKey(visible, onClose);
|
|
1830
|
+
useScrollLock(visible);
|
|
1831
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, visible: panel.mounted || backdrop.mounted, onRequestClose: onClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles16.root, children: [
|
|
1832
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Animated.View, { style: [reactNative.StyleSheet.absoluteFill, styles16.scrim, { opacity: backdrop.style.opacity }] }),
|
|
1833
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1834
|
+
reactNative.Pressable,
|
|
1835
|
+
{
|
|
1836
|
+
accessibilityHint: t(LAYOUT_I18N.closeDialogHint),
|
|
1837
|
+
accessibilityLabel: t(LAYOUT_I18N.dialogClose),
|
|
1838
|
+
accessibilityRole: "button",
|
|
1839
|
+
style: reactNative.StyleSheet.absoluteFill,
|
|
1840
|
+
testID: `${testID}-scrim`,
|
|
1841
|
+
onPress: onClose
|
|
1842
|
+
}
|
|
1843
|
+
),
|
|
1844
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1845
|
+
reactNative.Animated.View,
|
|
1846
|
+
{
|
|
1847
|
+
ref: sheetRef,
|
|
1848
|
+
accessibilityViewIsModal: true,
|
|
1849
|
+
"aria-modal": true,
|
|
1850
|
+
"aria-label": accessibilityLabel ?? title,
|
|
1851
|
+
role: "dialog",
|
|
1852
|
+
style: [
|
|
1853
|
+
styles16.sheet,
|
|
1854
|
+
isWide ? styles16.wide : styles16.phone,
|
|
1855
|
+
edges,
|
|
1856
|
+
{ backgroundColor: theme.colors.surface },
|
|
1857
|
+
panel.style
|
|
1858
|
+
],
|
|
1859
|
+
testID,
|
|
1860
|
+
children: [
|
|
1861
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles16.title, children: /* @__PURE__ */ jsxRuntime.jsx(AppText, { kind: "title" /* Title */, children: title }) }),
|
|
1862
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { contentContainerStyle: styles16.content, style: styles16.scroll, children }),
|
|
1863
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles16.bar, edges], children: footer })
|
|
1864
|
+
]
|
|
1865
|
+
}
|
|
1866
|
+
)
|
|
1867
|
+
] }) });
|
|
1868
|
+
};
|
|
1786
1869
|
var MESSAGE_FONT_SIZE2 = 14;
|
|
1787
1870
|
var MESSAGE_LINE_HEIGHT = 20;
|
|
1788
1871
|
var BUTTON_GAP = 12;
|
|
1789
|
-
var
|
|
1872
|
+
var styles17 = reactNative.StyleSheet.create({
|
|
1790
1873
|
message: { fontSize: MESSAGE_FONT_SIZE2, lineHeight: MESSAGE_LINE_HEIGHT },
|
|
1791
1874
|
footer: { flexDirection: "row", justifyContent: "flex-end", columnGap: BUTTON_GAP }
|
|
1792
1875
|
});
|
|
@@ -1805,7 +1888,7 @@ var ConfirmDialog = ({
|
|
|
1805
1888
|
const { theme, t } = uiFeedback.useUi();
|
|
1806
1889
|
const resolvedConfirm = confirmLabel ?? t(LAYOUT_I18N.confirm);
|
|
1807
1890
|
const resolvedCancel = cancelLabel ?? t(LAYOUT_I18N.cancel);
|
|
1808
|
-
const footer = /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
1891
|
+
const footer = /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles17.footer, children: [
|
|
1809
1892
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1810
1893
|
uiButtons.Button,
|
|
1811
1894
|
{
|
|
@@ -1841,27 +1924,27 @@ var ConfirmDialog = ({
|
|
|
1841
1924
|
title,
|
|
1842
1925
|
visible,
|
|
1843
1926
|
onClose: onCancel,
|
|
1844
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1927
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles17.message, { color: theme.colors.text }], testID: `${testID}-message`, children: message })
|
|
1845
1928
|
}
|
|
1846
1929
|
);
|
|
1847
1930
|
};
|
|
1848
|
-
var AccordionContext =
|
|
1931
|
+
var AccordionContext = React13.createContext(null);
|
|
1849
1932
|
function useAccordionContext() {
|
|
1850
|
-
const value =
|
|
1933
|
+
const value = React13.useContext(AccordionContext);
|
|
1851
1934
|
if (value === null) {
|
|
1852
1935
|
throw new Error("AccordionItem must be rendered inside an <Accordion>.");
|
|
1853
1936
|
}
|
|
1854
1937
|
return value;
|
|
1855
1938
|
}
|
|
1856
1939
|
var BOXED_GAP = 12;
|
|
1857
|
-
var
|
|
1940
|
+
var styles18 = reactNative.StyleSheet.create({
|
|
1858
1941
|
container: { alignSelf: "stretch" },
|
|
1859
1942
|
boxed: { gap: BOXED_GAP }
|
|
1860
1943
|
});
|
|
1861
1944
|
function computeInitialOpen(children, defaultOpenIds, allowMultiple) {
|
|
1862
1945
|
const ids = new Set(defaultOpenIds ?? []);
|
|
1863
|
-
|
|
1864
|
-
if (!
|
|
1946
|
+
React13__default.default.Children.forEach(children, (child) => {
|
|
1947
|
+
if (!React13__default.default.isValidElement(child)) return;
|
|
1865
1948
|
const props = child.props;
|
|
1866
1949
|
if (props.defaultOpen === true && typeof props.id === "string") {
|
|
1867
1950
|
ids.add(props.id);
|
|
@@ -1884,14 +1967,14 @@ var Accordion = ({
|
|
|
1884
1967
|
style
|
|
1885
1968
|
}) => {
|
|
1886
1969
|
const isControlled = openIds !== void 0;
|
|
1887
|
-
const [internalOpen, setInternalOpen] =
|
|
1970
|
+
const [internalOpen, setInternalOpen] = React13.useState(
|
|
1888
1971
|
() => computeInitialOpen(children, defaultOpenIds, allowMultiple)
|
|
1889
1972
|
);
|
|
1890
|
-
const openSet =
|
|
1973
|
+
const openSet = React13.useMemo(
|
|
1891
1974
|
() => isControlled ? new Set(openIds) : internalOpen,
|
|
1892
1975
|
[isControlled, openIds, internalOpen]
|
|
1893
1976
|
);
|
|
1894
|
-
const toggle =
|
|
1977
|
+
const toggle = React13.useCallback(
|
|
1895
1978
|
(id) => {
|
|
1896
1979
|
const next = new Set(openSet);
|
|
1897
1980
|
const willOpen = !next.has(id);
|
|
@@ -1906,12 +1989,12 @@ var Accordion = ({
|
|
|
1906
1989
|
},
|
|
1907
1990
|
[allowMultiple, isControlled, onOpenChange, openSet]
|
|
1908
1991
|
);
|
|
1909
|
-
const contextValue =
|
|
1992
|
+
const contextValue = React13.useMemo(
|
|
1910
1993
|
() => ({ openIds: openSet, toggle, allowMultiple, variant }),
|
|
1911
1994
|
[openSet, toggle, allowMultiple, variant]
|
|
1912
1995
|
);
|
|
1913
|
-
const containerStyle =
|
|
1914
|
-
const base = variant === "boxed" ? [
|
|
1996
|
+
const containerStyle = React13.useMemo(() => {
|
|
1997
|
+
const base = variant === "boxed" ? [styles18.container, styles18.boxed] : [styles18.container];
|
|
1915
1998
|
if (style === void 0) return base;
|
|
1916
1999
|
return [...base, ...Array.isArray(style) ? style : [style]];
|
|
1917
2000
|
}, [style, variant]);
|
|
@@ -1943,7 +2026,7 @@ var BOX_TITLE_FONT_SIZE = 14;
|
|
|
1943
2026
|
var BOX_MARKER_FONT_SIZE = 13;
|
|
1944
2027
|
var BOX_MARKER_GAP = 6;
|
|
1945
2028
|
var BOX_MARKER = "\u25B8";
|
|
1946
|
-
var
|
|
2029
|
+
var styles19 = reactNative.StyleSheet.create({
|
|
1947
2030
|
item: { borderTopWidth: reactNative.StyleSheet.hairlineWidth },
|
|
1948
2031
|
boxItem: { borderWidth: 1, borderRadius: BOX_BORDER_RADIUS, paddingHorizontal: BOX_PADDING_H },
|
|
1949
2032
|
header: {
|
|
@@ -1989,9 +2072,9 @@ var AccordionItem = ({
|
|
|
1989
2072
|
const headerTestID = testID ?? `accordion-item-${id}`;
|
|
1990
2073
|
const bodyTestID = `${headerTestID}-body`;
|
|
1991
2074
|
const chevronTestID = `${headerTestID}-chevron`;
|
|
1992
|
-
const [rotation] =
|
|
2075
|
+
const [rotation] = React13.useState(() => new reactNative.Animated.Value(expanded ? ROTATE_EXPANDED : ROTATE_COLLAPSED));
|
|
1993
2076
|
const reducedMotion = rnWebHooks.useReducedMotion();
|
|
1994
|
-
|
|
2077
|
+
React13.useEffect(() => {
|
|
1995
2078
|
reactNative.Animated.timing(rotation, {
|
|
1996
2079
|
toValue: expanded ? ROTATE_EXPANDED : ROTATE_COLLAPSED,
|
|
1997
2080
|
duration: reducedMotion ? INSTANT_DURATION_MS : ROTATE_DURATION_MS,
|
|
@@ -2003,10 +2086,10 @@ var AccordionItem = ({
|
|
|
2003
2086
|
inputRange: [ROTATE_COLLAPSED, ROTATE_EXPANDED],
|
|
2004
2087
|
outputRange: [COLLAPSED_DEG, boxed ? BOXED_EXPANDED_DEG : PLAIN_EXPANDED_DEG]
|
|
2005
2088
|
});
|
|
2006
|
-
const handlePress =
|
|
2089
|
+
const handlePress = React13.useCallback(() => {
|
|
2007
2090
|
if (!disabled) toggle(id);
|
|
2008
2091
|
}, [disabled, id, toggle]);
|
|
2009
|
-
const handleKeyDown2 =
|
|
2092
|
+
const handleKeyDown2 = React13.useCallback(
|
|
2010
2093
|
(event) => {
|
|
2011
2094
|
if (disabled) return;
|
|
2012
2095
|
const key = event.key ?? "";
|
|
@@ -2018,20 +2101,20 @@ var AccordionItem = ({
|
|
|
2018
2101
|
[disabled, id, toggle]
|
|
2019
2102
|
);
|
|
2020
2103
|
const keyboardProps = reactNative.Platform.OS === "web" ? { onKeyDown: handleKeyDown2 } : {};
|
|
2021
|
-
const itemStyle =
|
|
2022
|
-
() => boxed ? [
|
|
2104
|
+
const itemStyle = React13.useMemo(
|
|
2105
|
+
() => boxed ? [styles19.boxItem, { borderColor: colors.border }] : [styles19.item, { borderTopColor: colors.border }],
|
|
2023
2106
|
[boxed, colors.border]
|
|
2024
2107
|
);
|
|
2025
|
-
const headerStyle =
|
|
2108
|
+
const headerStyle = React13.useMemo(
|
|
2026
2109
|
() => [
|
|
2027
|
-
|
|
2028
|
-
...boxed ? [
|
|
2110
|
+
styles19.header,
|
|
2111
|
+
...boxed ? [styles19.boxHeader] : [],
|
|
2029
2112
|
{ opacity: disabled ? DISABLED_OPACITY : FULL_OPACITY }
|
|
2030
2113
|
],
|
|
2031
2114
|
[boxed, disabled]
|
|
2032
2115
|
);
|
|
2033
2116
|
const resolvedLabel = accessibilityLabel ?? (typeof title === "string" ? title : void 0);
|
|
2034
|
-
const titleNode = typeof title === "string" ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [boxed ?
|
|
2117
|
+
const titleNode = typeof title === "string" ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [boxed ? styles19.boxTitle : styles19.title, { color: boxed ? colors.textSecondary : colors.text }], children: title }) : title;
|
|
2035
2118
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: itemStyle, children: [
|
|
2036
2119
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2037
2120
|
reactNative.Pressable,
|
|
@@ -2048,7 +2131,7 @@ var AccordionItem = ({
|
|
|
2048
2131
|
onPress: handlePress,
|
|
2049
2132
|
...keyboardProps,
|
|
2050
2133
|
children: [
|
|
2051
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [
|
|
2134
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles19.headerLeft, boxed ? styles19.headerLeftRow : null], children: [
|
|
2052
2135
|
boxed ? (
|
|
2053
2136
|
// Decorative — the open/closed state is already conveyed by aria-expanded on the header.
|
|
2054
2137
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2057,15 +2140,15 @@ var AccordionItem = ({
|
|
|
2057
2140
|
accessibilityElementsHidden: true,
|
|
2058
2141
|
"aria-hidden": true,
|
|
2059
2142
|
importantForAccessibility: "no-hide-descendants",
|
|
2060
|
-
style: [
|
|
2143
|
+
style: [styles19.marker, { transform: [{ rotate }] }],
|
|
2061
2144
|
testID: chevronTestID,
|
|
2062
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
2145
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles19.markerText, { color: colors.textSecondary }], children: BOX_MARKER })
|
|
2063
2146
|
}
|
|
2064
2147
|
)
|
|
2065
2148
|
) : null,
|
|
2066
2149
|
titleNode
|
|
2067
2150
|
] }),
|
|
2068
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
2151
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles19.headerRight, children: [
|
|
2069
2152
|
right,
|
|
2070
2153
|
boxed ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2071
2154
|
reactNative.Animated.View,
|
|
@@ -2073,7 +2156,7 @@ var AccordionItem = ({
|
|
|
2073
2156
|
accessibilityElementsHidden: true,
|
|
2074
2157
|
"aria-hidden": true,
|
|
2075
2158
|
importantForAccessibility: "no-hide-descendants",
|
|
2076
|
-
style: [
|
|
2159
|
+
style: [styles19.chevron, { transform: [{ rotate }] }],
|
|
2077
2160
|
children: /* @__PURE__ */ jsxRuntime.jsx(uiIcons.SvgIcon, { color: colors.textSecondary, name: "chevronDown", size: CHEVRON_SIZE, testID: chevronTestID })
|
|
2078
2161
|
}
|
|
2079
2162
|
)
|
|
@@ -2087,7 +2170,7 @@ var AccordionItem = ({
|
|
|
2087
2170
|
accessibilityLabel: resolvedLabel,
|
|
2088
2171
|
nativeID: bodyTestID,
|
|
2089
2172
|
role: ROLE_REGION,
|
|
2090
|
-
style: boxed ?
|
|
2173
|
+
style: boxed ? styles19.boxBody : styles19.body,
|
|
2091
2174
|
testID: bodyTestID,
|
|
2092
2175
|
children
|
|
2093
2176
|
}
|
|
@@ -2125,14 +2208,14 @@ function measureParentInnerWidth(node) {
|
|
|
2125
2208
|
return Math.max(UNMEASURED, parent.clientWidth - padding);
|
|
2126
2209
|
}
|
|
2127
2210
|
function useAvailableWidth() {
|
|
2128
|
-
const [width, setWidth] =
|
|
2129
|
-
const nodeRef =
|
|
2130
|
-
const measureRef =
|
|
2211
|
+
const [width, setWidth] = React13.useState(UNMEASURED);
|
|
2212
|
+
const nodeRef = React13.useRef(null);
|
|
2213
|
+
const measureRef = React13.useCallback((node) => {
|
|
2131
2214
|
if (!IS_WEB3) return;
|
|
2132
2215
|
nodeRef.current = node;
|
|
2133
2216
|
if (nodeRef.current !== null) setWidth(measureParentInnerWidth(nodeRef.current));
|
|
2134
2217
|
}, []);
|
|
2135
|
-
|
|
2218
|
+
React13.useEffect(() => {
|
|
2136
2219
|
if (!IS_WEB3) return void 0;
|
|
2137
2220
|
const remeasure = () => {
|
|
2138
2221
|
const node = nodeRef.current;
|
|
@@ -2141,7 +2224,7 @@ function useAvailableWidth() {
|
|
|
2141
2224
|
window.addEventListener("resize", remeasure);
|
|
2142
2225
|
return () => window.removeEventListener("resize", remeasure);
|
|
2143
2226
|
}, []);
|
|
2144
|
-
const onLayout =
|
|
2227
|
+
const onLayout = React13.useCallback((event) => {
|
|
2145
2228
|
if (IS_WEB3) return;
|
|
2146
2229
|
setWidth(event.nativeEvent.layout.width);
|
|
2147
2230
|
}, []);
|
|
@@ -2150,7 +2233,7 @@ function useAvailableWidth() {
|
|
|
2150
2233
|
var AVG_CHAR_WIDTH_RATIO = 0.58;
|
|
2151
2234
|
var DEFAULT_FONT_SIZE2 = 13;
|
|
2152
2235
|
var UNMEASURED2 = 0;
|
|
2153
|
-
var
|
|
2236
|
+
var styles20 = reactNative.StyleSheet.create({
|
|
2154
2237
|
base: { fontSize: DEFAULT_FONT_SIZE2 },
|
|
2155
2238
|
/** `minWidth: 0` lets the text shrink inside a flex row instead of forcing the row wider. */
|
|
2156
2239
|
fill: { flexShrink: 1, minWidth: 0 }
|
|
@@ -2170,8 +2253,8 @@ var TruncatedText = ({
|
|
|
2170
2253
|
accessibilityHint
|
|
2171
2254
|
}) => {
|
|
2172
2255
|
const { width, measureRef, onLayout } = useAvailableWidth();
|
|
2173
|
-
const hostRef =
|
|
2174
|
-
const attachRef =
|
|
2256
|
+
const hostRef = React13.useRef(null);
|
|
2257
|
+
const attachRef = React13.useCallback(
|
|
2175
2258
|
(node) => {
|
|
2176
2259
|
hostRef.current = node;
|
|
2177
2260
|
measureRef(node);
|
|
@@ -2180,12 +2263,12 @@ var TruncatedText = ({
|
|
|
2180
2263
|
},
|
|
2181
2264
|
[value, measureRef]
|
|
2182
2265
|
);
|
|
2183
|
-
const flatStyle =
|
|
2184
|
-
() => reactNative.StyleSheet.flatten([
|
|
2266
|
+
const flatStyle = React13.useMemo(
|
|
2267
|
+
() => reactNative.StyleSheet.flatten([styles20.base, style]),
|
|
2185
2268
|
[style]
|
|
2186
2269
|
);
|
|
2187
2270
|
const fontSize = flatStyle.fontSize ?? DEFAULT_FONT_SIZE2;
|
|
2188
|
-
const display =
|
|
2271
|
+
const display = React13.useMemo(() => {
|
|
2189
2272
|
const source = isUrl ? formatUrlForDisplay(value) : value;
|
|
2190
2273
|
const budget = charBudget(width, fontSize);
|
|
2191
2274
|
return budget === UNMEASURED2 ? source : truncateMiddle(source, budget);
|
|
@@ -2196,7 +2279,7 @@ var TruncatedText = ({
|
|
|
2196
2279
|
ref: attachRef,
|
|
2197
2280
|
onLayout,
|
|
2198
2281
|
numberOfLines: 1,
|
|
2199
|
-
style: [
|
|
2282
|
+
style: [styles20.base, styles20.fill, style],
|
|
2200
2283
|
testID,
|
|
2201
2284
|
accessibilityRole: onPress !== void 0 || href !== void 0 ? "link" : "text",
|
|
2202
2285
|
accessibilityLabel,
|
|
@@ -2267,17 +2350,17 @@ async function copyText(value, writer) {
|
|
|
2267
2350
|
// src/CopyableId/useCopyToClipboard.ts
|
|
2268
2351
|
var COPY_FEEDBACK_MS = 2e3;
|
|
2269
2352
|
function useCopyToClipboard(value, writer) {
|
|
2270
|
-
const [status, setStatus] =
|
|
2271
|
-
const timerRef =
|
|
2272
|
-
const mountedRef =
|
|
2273
|
-
|
|
2353
|
+
const [status, setStatus] = React13.useState("idle" /* Idle */);
|
|
2354
|
+
const timerRef = React13.useRef(null);
|
|
2355
|
+
const mountedRef = React13.useRef(true);
|
|
2356
|
+
React13.useEffect(() => {
|
|
2274
2357
|
mountedRef.current = true;
|
|
2275
2358
|
return () => {
|
|
2276
2359
|
mountedRef.current = false;
|
|
2277
2360
|
if (timerRef.current !== null) clearTimeout(timerRef.current);
|
|
2278
2361
|
};
|
|
2279
2362
|
}, []);
|
|
2280
|
-
const copy =
|
|
2363
|
+
const copy = React13.useCallback(() => {
|
|
2281
2364
|
void (async () => {
|
|
2282
2365
|
const ok = await copyText(value, writer);
|
|
2283
2366
|
if (!mountedRef.current) return;
|
|
@@ -2299,7 +2382,7 @@ var LABEL_LETTER_SPACING = 0.4;
|
|
|
2299
2382
|
var ACTION_PADDING_H = 6;
|
|
2300
2383
|
var ACTION_PADDING_V = 2;
|
|
2301
2384
|
var ACTION_RADIUS = 6;
|
|
2302
|
-
var
|
|
2385
|
+
var styles21 = reactNative.StyleSheet.create({
|
|
2303
2386
|
cell: { gap: CELL_GAP },
|
|
2304
2387
|
label: {
|
|
2305
2388
|
fontSize: LABEL_FONT_SIZE,
|
|
@@ -2341,7 +2424,7 @@ var styles20 = reactNative.StyleSheet.create({
|
|
|
2341
2424
|
var TONE_STEP = "500";
|
|
2342
2425
|
function useActionState(status) {
|
|
2343
2426
|
const { theme } = uiFeedback.useUi();
|
|
2344
|
-
return
|
|
2427
|
+
return React13.useMemo(() => {
|
|
2345
2428
|
const primary = theme.palette.primary[TONE_STEP];
|
|
2346
2429
|
if (status === "copied" /* Copied */) {
|
|
2347
2430
|
return { key: LAYOUT_I18N.copied, color: theme.semantic.success?.[TONE_STEP] ?? primary };
|
|
@@ -2364,14 +2447,14 @@ var CopyableId = ({
|
|
|
2364
2447
|
const { colors } = theme;
|
|
2365
2448
|
const { status, copy } = useCopyToClipboard(value, writer);
|
|
2366
2449
|
const action = useActionState(status);
|
|
2367
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [
|
|
2368
|
-
label !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
2369
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
2370
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style:
|
|
2450
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles21.cell, style], testID, children: [
|
|
2451
|
+
label !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles21.label, { color: colors.textSecondary }], children: label }),
|
|
2452
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles21.row, children: [
|
|
2453
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles21.valueWrap, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2371
2454
|
TruncatedText,
|
|
2372
2455
|
{
|
|
2373
2456
|
value,
|
|
2374
|
-
style: [
|
|
2457
|
+
style: [styles21.value, { color: colors.text }],
|
|
2375
2458
|
testID: `${testID}-value`,
|
|
2376
2459
|
accessibilityLabel: accessibilityLabel ?? value,
|
|
2377
2460
|
accessibilityHint: t(LAYOUT_I18N.copyableIdHint)
|
|
@@ -2385,7 +2468,7 @@ var CopyableId = ({
|
|
|
2385
2468
|
accessibilityLabel: t(action.key),
|
|
2386
2469
|
accessibilityHint: t(LAYOUT_I18N.copyHint),
|
|
2387
2470
|
testID: `${testID}-copy`,
|
|
2388
|
-
style: [
|
|
2471
|
+
style: [styles21.action, { color: action.color }],
|
|
2389
2472
|
children: t(action.key)
|
|
2390
2473
|
}
|
|
2391
2474
|
)
|
|
@@ -2410,15 +2493,15 @@ function formatBuildInfo(buildVersion, apiCommit) {
|
|
|
2410
2493
|
return `${base}${API_COMMIT_SEPARATOR}${shortenCommit(commit)}`;
|
|
2411
2494
|
}
|
|
2412
2495
|
function useApiCommit(apiBaseUrl, fetchImpl) {
|
|
2413
|
-
const [commit, setCommit] =
|
|
2414
|
-
const mountedRef =
|
|
2415
|
-
|
|
2496
|
+
const [commit, setCommit] = React13.useState(void 0);
|
|
2497
|
+
const mountedRef = React13.useRef(true);
|
|
2498
|
+
React13.useEffect(() => {
|
|
2416
2499
|
mountedRef.current = true;
|
|
2417
2500
|
return () => {
|
|
2418
2501
|
mountedRef.current = false;
|
|
2419
2502
|
};
|
|
2420
2503
|
}, []);
|
|
2421
|
-
|
|
2504
|
+
React13.useEffect(() => {
|
|
2422
2505
|
if (apiBaseUrl === void 0 || apiBaseUrl === "") return;
|
|
2423
2506
|
const doFetch = fetchImpl ?? (typeof fetch !== "undefined" ? fetch : void 0);
|
|
2424
2507
|
if (doFetch === void 0) return;
|
|
@@ -2440,7 +2523,7 @@ var FOOTER_PADDING_V = 6;
|
|
|
2440
2523
|
var FOOTER_PADDING_H = 12;
|
|
2441
2524
|
var FOOTER_FONT_SIZE = 11;
|
|
2442
2525
|
var FOOTER_OPACITY = 0.75;
|
|
2443
|
-
var
|
|
2526
|
+
var styles22 = reactNative.StyleSheet.create({
|
|
2444
2527
|
footer: {
|
|
2445
2528
|
paddingVertical: FOOTER_PADDING_V,
|
|
2446
2529
|
paddingHorizontal: FOOTER_PADDING_H,
|
|
@@ -2465,8 +2548,8 @@ var BuildInfoFooter = ({
|
|
|
2465
2548
|
const fetchedCommit = useApiCommit(apiCommit === void 0 ? apiBaseUrl : void 0, fetchImpl);
|
|
2466
2549
|
const commit = apiCommit ?? fetchedCommit;
|
|
2467
2550
|
const label = formatBuildInfo(buildVersion, commit);
|
|
2468
|
-
const textStyle =
|
|
2469
|
-
() => [
|
|
2551
|
+
const textStyle = React13.useMemo(
|
|
2552
|
+
() => [styles22.text, { color: theme.colors.textSecondary }],
|
|
2470
2553
|
[theme.colors.textSecondary]
|
|
2471
2554
|
);
|
|
2472
2555
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2474,7 +2557,7 @@ var BuildInfoFooter = ({
|
|
|
2474
2557
|
{
|
|
2475
2558
|
accessibilityLabel: accessibilityLabel ?? label,
|
|
2476
2559
|
accessibilityHint: accessibilityHint ?? t(LAYOUT_I18N.buildInfoHint),
|
|
2477
|
-
style: [
|
|
2560
|
+
style: [styles22.footer, style],
|
|
2478
2561
|
testID,
|
|
2479
2562
|
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: textStyle, children: label })
|
|
2480
2563
|
}
|
|
@@ -2485,7 +2568,7 @@ var BORDER = 2;
|
|
|
2485
2568
|
var GLYPH_SIZE = 14;
|
|
2486
2569
|
var GLYPH_LINE = 16;
|
|
2487
2570
|
var TICK = "\u2713";
|
|
2488
|
-
var
|
|
2571
|
+
var styles23 = reactNative.StyleSheet.create({
|
|
2489
2572
|
circle: {
|
|
2490
2573
|
width: SIZE,
|
|
2491
2574
|
height: SIZE,
|
|
@@ -2502,14 +2585,14 @@ var CheckMark = ({ filled, accent, ring, glyphColor, testID }) => /* @__PURE__ *
|
|
|
2502
2585
|
"aria-hidden": true,
|
|
2503
2586
|
accessibilityElementsHidden: true,
|
|
2504
2587
|
importantForAccessibility: "no-hide-descendants",
|
|
2505
|
-
style: [
|
|
2588
|
+
style: [styles23.circle, { borderColor: filled ? accent : ring, backgroundColor: filled ? accent : void 0 }],
|
|
2506
2589
|
testID,
|
|
2507
|
-
children: filled ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
2590
|
+
children: filled ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles23.glyph, { color: glyphColor }], children: TICK }) : null
|
|
2508
2591
|
}
|
|
2509
2592
|
);
|
|
2510
|
-
var ListRowToneContext =
|
|
2593
|
+
var ListRowToneContext = React13.createContext(null);
|
|
2511
2594
|
function useListRowTone() {
|
|
2512
|
-
return
|
|
2595
|
+
return React13.useContext(ListRowToneContext);
|
|
2513
2596
|
}
|
|
2514
2597
|
function useRowPalette() {
|
|
2515
2598
|
const { colors, palette, semantic } = uiFeedback.useUi().theme;
|
|
@@ -2627,7 +2710,7 @@ var PAD_V = 12;
|
|
|
2627
2710
|
var GAP = 4;
|
|
2628
2711
|
var MARK_GAP = 12;
|
|
2629
2712
|
var LINE_GAP = 8;
|
|
2630
|
-
var
|
|
2713
|
+
var styles24 = reactNative.StyleSheet.create({
|
|
2631
2714
|
row: {
|
|
2632
2715
|
flexDirection: "row",
|
|
2633
2716
|
alignItems: "center",
|
|
@@ -2651,7 +2734,7 @@ function focusTarget(event) {
|
|
|
2651
2734
|
}
|
|
2652
2735
|
function slot(node, color, strong) {
|
|
2653
2736
|
if (typeof node !== "string") return node;
|
|
2654
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
2737
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles24.shrink, strong ? styles24.strong : null, { color }], children: node });
|
|
2655
2738
|
}
|
|
2656
2739
|
var ListRow = ({
|
|
2657
2740
|
title,
|
|
@@ -2668,9 +2751,9 @@ var ListRow = ({
|
|
|
2668
2751
|
}) => {
|
|
2669
2752
|
const palette = useRowPalette();
|
|
2670
2753
|
const { colors } = uiFeedback.useUi().theme;
|
|
2671
|
-
const [focused, setFocused] =
|
|
2754
|
+
const [focused, setFocused] = React13.useState(false);
|
|
2672
2755
|
const rest = resolveRowLook(selectedStyle, { selected, hovered: false, pressed: false, focused }, palette);
|
|
2673
|
-
const tone =
|
|
2756
|
+
const tone = React13.useMemo(() => ({ textColor: rest.textColor, inverse: rest.inverse }), [rest.textColor, rest.inverse]);
|
|
2674
2757
|
const checkTestId = testID === void 0 ? void 0 : `${testID}-check`;
|
|
2675
2758
|
return /* @__PURE__ */ jsxRuntime.jsxs(ListRowToneContext.Provider, { value: tone, children: [
|
|
2676
2759
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -2683,7 +2766,7 @@ var ListRow = ({
|
|
|
2683
2766
|
style: (state) => {
|
|
2684
2767
|
const { pressed, hovered } = state;
|
|
2685
2768
|
const look = resolveRowLook(selectedStyle, { selected, pressed, focused, hovered: hovered === true }, palette);
|
|
2686
|
-
return [
|
|
2769
|
+
return [styles24.row, { borderTopColor: colors.border }, look.container];
|
|
2687
2770
|
},
|
|
2688
2771
|
testID,
|
|
2689
2772
|
onBlur: () => {
|
|
@@ -2696,14 +2779,14 @@ var ListRow = ({
|
|
|
2696
2779
|
...pressedProps(selected),
|
|
2697
2780
|
children: [
|
|
2698
2781
|
rest.showCheck ? /* @__PURE__ */ jsxRuntime.jsx(CheckMark, { accent: palette.accent, filled: rest.checkFilled, glyphColor: palette.background, ring: palette.border, testID: checkTestId }) : null,
|
|
2699
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
2700
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
2782
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles24.body, children: [
|
|
2783
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles24.line, children: [
|
|
2701
2784
|
slot(title, rest.titleColor, true),
|
|
2702
2785
|
slot(trailing, rest.textColor, true)
|
|
2703
2786
|
] }),
|
|
2704
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
2705
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style:
|
|
2706
|
-
badges === void 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style:
|
|
2787
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles24.line, children: [
|
|
2788
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles24.shrink, children: slot(meta, rest.textColor, false) }),
|
|
2789
|
+
badges === void 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles24.badges, children: badges })
|
|
2707
2790
|
] })
|
|
2708
2791
|
] })
|
|
2709
2792
|
]
|
|
@@ -2743,6 +2826,7 @@ exports.Section = Section;
|
|
|
2743
2826
|
exports.SectionVariant = SectionVariant;
|
|
2744
2827
|
exports.SegmentedControl = SegmentedControl;
|
|
2745
2828
|
exports.SelectedMarker = SelectedMarker;
|
|
2829
|
+
exports.SideSheet = SideSheet;
|
|
2746
2830
|
exports.StatusBadge = StatusBadge;
|
|
2747
2831
|
exports.StickyPreview = StickyPreview;
|
|
2748
2832
|
exports.TYPE_SCALE_BREAKPOINT = TYPE_SCALE_BREAKPOINT;
|