@dloizides/ui-layout 1.38.2 → 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 +7 -0
- package/dist/index.d.mts +15 -1
- package/dist/index.d.ts +15 -1
- package/dist/index.js +213 -134
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +125 -47
- 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,
|
|
@@ -888,7 +889,7 @@ var OptionRow = ({
|
|
|
888
889
|
}) => {
|
|
889
890
|
const { theme, t } = uiFeedback.useUi();
|
|
890
891
|
const { colors } = theme;
|
|
891
|
-
const handlePress =
|
|
892
|
+
const handlePress = React13.useCallback(() => {
|
|
892
893
|
onSelect();
|
|
893
894
|
}, [onSelect]);
|
|
894
895
|
const accentColor = theme.palette.primary["500"];
|
|
@@ -977,8 +978,8 @@ function isSameRect(a, b) {
|
|
|
977
978
|
return a.top === b.top && a.left === b.left && a.width === b.width && a.bottom === b.bottom;
|
|
978
979
|
}
|
|
979
980
|
function useAnchorTracking(containerRef, onOutOfView) {
|
|
980
|
-
const [rect, setRect] =
|
|
981
|
-
|
|
981
|
+
const [rect, setRect] = React13.useState(() => readAnchorRect(containerRef));
|
|
982
|
+
React13.useLayoutEffect(() => {
|
|
982
983
|
if (!IS_WEB) return void 0;
|
|
983
984
|
let frame = null;
|
|
984
985
|
let isDisposed = false;
|
|
@@ -1057,7 +1058,7 @@ function buildKeyHandler(params) {
|
|
|
1057
1058
|
}
|
|
1058
1059
|
function useMenuKeyboard(params) {
|
|
1059
1060
|
const { containerRef, menuRef, enabled, onClose } = params;
|
|
1060
|
-
|
|
1061
|
+
React13.useEffect(() => {
|
|
1061
1062
|
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
1062
1063
|
const onKeyDown = buildKeyHandler(params);
|
|
1063
1064
|
const onMouseDown = (event) => {
|
|
@@ -1121,27 +1122,27 @@ var InlineMenu = ({
|
|
|
1121
1122
|
}) => {
|
|
1122
1123
|
const { theme } = uiFeedback.useUi();
|
|
1123
1124
|
const { colors } = theme;
|
|
1124
|
-
const menuRef =
|
|
1125
|
+
const menuRef = React13.useRef(null);
|
|
1125
1126
|
const rect = useAnchorTracking(containerRef, onClose);
|
|
1126
|
-
const selectedIndex =
|
|
1127
|
+
const selectedIndex = React13.useMemo(
|
|
1127
1128
|
() => Math.max(0, options.findIndex((opt) => opt.value === value)),
|
|
1128
1129
|
[options, value]
|
|
1129
1130
|
);
|
|
1130
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
1131
|
-
const handleSelect =
|
|
1131
|
+
const [highlightedIndex, setHighlightedIndex] = React13.useState(() => selectedIndex);
|
|
1132
|
+
const handleSelect = React13.useCallback(
|
|
1132
1133
|
(optionValue) => {
|
|
1133
1134
|
if (isOpen) onSelect(optionValue);
|
|
1134
1135
|
},
|
|
1135
1136
|
[isOpen, onSelect]
|
|
1136
1137
|
);
|
|
1137
|
-
const selectAt =
|
|
1138
|
+
const selectAt = React13.useCallback(
|
|
1138
1139
|
(index) => {
|
|
1139
1140
|
const option = options[index];
|
|
1140
1141
|
if (option !== void 0) handleSelect(option.value);
|
|
1141
1142
|
},
|
|
1142
1143
|
[options, handleSelect]
|
|
1143
1144
|
);
|
|
1144
|
-
const selectHighlighted =
|
|
1145
|
+
const selectHighlighted = React13.useCallback(
|
|
1145
1146
|
() => {
|
|
1146
1147
|
selectAt(highlightedIndex);
|
|
1147
1148
|
},
|
|
@@ -1156,7 +1157,7 @@ var InlineMenu = ({
|
|
|
1156
1157
|
onSelectHighlighted: selectHighlighted,
|
|
1157
1158
|
onClose
|
|
1158
1159
|
});
|
|
1159
|
-
const popoverStyle =
|
|
1160
|
+
const popoverStyle = React13.useMemo(() => {
|
|
1160
1161
|
const themed = { borderColor: colors.border, backgroundColor: colors.surface };
|
|
1161
1162
|
if (IS_WEB2) {
|
|
1162
1163
|
const viewportWidth = typeof window !== "undefined" ? window.innerWidth : 0;
|
|
@@ -1301,7 +1302,7 @@ var ModalDropdown = ({
|
|
|
1301
1302
|
const { colors } = theme;
|
|
1302
1303
|
const resolvedVariant = useResolvedDropdownVariant(variant);
|
|
1303
1304
|
const isMenu = resolvedVariant === "menu" /* Menu */;
|
|
1304
|
-
const [isOpen, setIsOpen] =
|
|
1305
|
+
const [isOpen, setIsOpen] = React13.useState(false);
|
|
1305
1306
|
const { a11yProps, hintNode } = a11y.useA11y({
|
|
1306
1307
|
label: accessibilityLabel,
|
|
1307
1308
|
hint: accessibilityHint,
|
|
@@ -1309,10 +1310,10 @@ var ModalDropdown = ({
|
|
|
1309
1310
|
state: { expanded: isOpen },
|
|
1310
1311
|
testID
|
|
1311
1312
|
});
|
|
1312
|
-
const anchorRef =
|
|
1313
|
-
const triggerRef =
|
|
1313
|
+
const anchorRef = React13.useRef(null);
|
|
1314
|
+
const triggerRef = React13.useRef(null);
|
|
1314
1315
|
const popupProps = { "aria-haspopup": isMenu ? "menu" : "dialog" };
|
|
1315
|
-
const dialogRef =
|
|
1316
|
+
const dialogRef = React13.useRef(null);
|
|
1316
1317
|
useFocusTrap(dialogRef, isOpen && !isMenu);
|
|
1317
1318
|
const menuAnim = uiMotion.useEnterExit({
|
|
1318
1319
|
visible: isMenu && isOpen,
|
|
@@ -1324,17 +1325,17 @@ var ModalDropdown = ({
|
|
|
1324
1325
|
fromScale: POPOVER_ENTER_SCALE,
|
|
1325
1326
|
duration: POPOVER_MOTION_MS
|
|
1326
1327
|
});
|
|
1327
|
-
const selectedLabel =
|
|
1328
|
+
const selectedLabel = React13.useMemo(() => {
|
|
1328
1329
|
const found = options.find((opt) => opt.value === value);
|
|
1329
1330
|
return found?.label ?? t(LAYOUT_I18N.selectPlaceholder);
|
|
1330
1331
|
}, [options, value, t]);
|
|
1331
|
-
const handleToggle =
|
|
1332
|
+
const handleToggle = React13.useCallback(() => {
|
|
1332
1333
|
setIsOpen((prev) => !prev);
|
|
1333
1334
|
}, []);
|
|
1334
|
-
const handleClose =
|
|
1335
|
+
const handleClose = React13.useCallback(() => {
|
|
1335
1336
|
setIsOpen(false);
|
|
1336
1337
|
}, []);
|
|
1337
|
-
const handleSelect =
|
|
1338
|
+
const handleSelect = React13.useCallback(
|
|
1338
1339
|
(optionValue) => {
|
|
1339
1340
|
onChange(optionValue);
|
|
1340
1341
|
setIsOpen(false);
|
|
@@ -1344,7 +1345,7 @@ var ModalDropdown = ({
|
|
|
1344
1345
|
);
|
|
1345
1346
|
const isHamburger = showHamburger;
|
|
1346
1347
|
const isCaret = showCaret && !isHamburger;
|
|
1347
|
-
const containerStyle =
|
|
1348
|
+
const containerStyle = React13.useMemo(
|
|
1348
1349
|
() => renderTrigger !== void 0 ? void 0 : [
|
|
1349
1350
|
styles12.container,
|
|
1350
1351
|
isHamburger ? styles12.containerHamburger : isCaret ? styles12.containerMenu : null,
|
|
@@ -1352,30 +1353,30 @@ var ModalDropdown = ({
|
|
|
1352
1353
|
],
|
|
1353
1354
|
[colors.border, colors.surface, renderTrigger, isHamburger, isCaret]
|
|
1354
1355
|
);
|
|
1355
|
-
const hamburgerStyle =
|
|
1356
|
+
const hamburgerStyle = React13.useMemo(
|
|
1356
1357
|
() => [styles12.hamburger, { color: colors.textSecondary }],
|
|
1357
1358
|
[colors.textSecondary]
|
|
1358
1359
|
);
|
|
1359
|
-
const caretStyle =
|
|
1360
|
+
const caretStyle = React13.useMemo(
|
|
1360
1361
|
() => [
|
|
1361
1362
|
styles12.caret,
|
|
1362
1363
|
{ color: colors.textSecondary, transform: [{ rotate: isOpen ? CARET_OPEN_ROTATION : CARET_CLOSED_ROTATION }] }
|
|
1363
1364
|
],
|
|
1364
1365
|
[colors.textSecondary, isOpen]
|
|
1365
1366
|
);
|
|
1366
|
-
const optionTestIDFor =
|
|
1367
|
+
const optionTestIDFor = React13.useCallback(
|
|
1367
1368
|
(optionValue) => optionTestID !== void 0 ? optionTestID(optionValue) : `${testID}-option-${String(optionValue)}`,
|
|
1368
1369
|
[optionTestID, testID]
|
|
1369
1370
|
);
|
|
1370
|
-
const anchorStyle =
|
|
1371
|
+
const anchorStyle = React13.useMemo(
|
|
1371
1372
|
() => [styles12.anchor, buildAnchorStackStyle(isMenu && isOpen)],
|
|
1372
1373
|
[isMenu, isOpen]
|
|
1373
1374
|
);
|
|
1374
|
-
const modalContentStyle =
|
|
1375
|
+
const modalContentStyle = React13.useMemo(
|
|
1375
1376
|
() => [styles12.modalContent, { backgroundColor: colors.surface }],
|
|
1376
1377
|
[colors.surface]
|
|
1377
1378
|
);
|
|
1378
|
-
const renderModalOption =
|
|
1379
|
+
const renderModalOption = React13.useCallback(
|
|
1379
1380
|
({ item }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1380
1381
|
OptionRow,
|
|
1381
1382
|
{
|
|
@@ -1388,7 +1389,7 @@ var ModalDropdown = ({
|
|
|
1388
1389
|
),
|
|
1389
1390
|
[handleSelect, optionTestIDFor, selectedMarker, value]
|
|
1390
1391
|
);
|
|
1391
|
-
const keyExtractor =
|
|
1392
|
+
const keyExtractor = React13.useCallback((item) => String(item.value), []);
|
|
1392
1393
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { ref: anchorRef, style: anchorStyle, children: [
|
|
1393
1394
|
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.TouchableOpacity, { ...a11yProps, ...popupProps, ref: triggerRef, style: containerStyle, onPress: handleToggle, children: [
|
|
1394
1395
|
renderTrigger !== void 0 ? renderTrigger({ label: selectedLabel, isOpen }) : isHamburger ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -1464,11 +1465,11 @@ var TabsMenu = ({
|
|
|
1464
1465
|
collapsedTrigger = "caret" /* Caret */
|
|
1465
1466
|
}) => {
|
|
1466
1467
|
const { t } = uiFeedback.useUi();
|
|
1467
|
-
const options =
|
|
1468
|
+
const options = React13.useMemo(
|
|
1468
1469
|
() => tabs.map((tab) => ({ label: tab.label, value: tab.key })),
|
|
1469
1470
|
[tabs]
|
|
1470
1471
|
);
|
|
1471
|
-
const optionTestID =
|
|
1472
|
+
const optionTestID = React13.useCallback(
|
|
1472
1473
|
(key) => {
|
|
1473
1474
|
const found = tabs.find((tab) => tab.key === key);
|
|
1474
1475
|
return found?.testID ?? `${idPrefix}-tab-${key}`;
|
|
@@ -1745,7 +1746,7 @@ var ModalShell = ({
|
|
|
1745
1746
|
}) => {
|
|
1746
1747
|
const { theme, t } = uiFeedback.useUi();
|
|
1747
1748
|
const { style: sheetStyle, mounted } = uiMotion.useEnterExit({ visible, fromScale: PANEL_ENTER_SCALE2 });
|
|
1748
|
-
const containerStyle =
|
|
1749
|
+
const containerStyle = React13__default.default.useMemo(
|
|
1749
1750
|
() => [styles15.container, { backgroundColor: theme.colors.background }, contentStyle],
|
|
1750
1751
|
[theme.colors.background, contentStyle]
|
|
1751
1752
|
);
|
|
@@ -1788,10 +1789,87 @@ var ModalShell = ({
|
|
|
1788
1789
|
}
|
|
1789
1790
|
);
|
|
1790
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
|
+
};
|
|
1791
1869
|
var MESSAGE_FONT_SIZE2 = 14;
|
|
1792
1870
|
var MESSAGE_LINE_HEIGHT = 20;
|
|
1793
1871
|
var BUTTON_GAP = 12;
|
|
1794
|
-
var
|
|
1872
|
+
var styles17 = reactNative.StyleSheet.create({
|
|
1795
1873
|
message: { fontSize: MESSAGE_FONT_SIZE2, lineHeight: MESSAGE_LINE_HEIGHT },
|
|
1796
1874
|
footer: { flexDirection: "row", justifyContent: "flex-end", columnGap: BUTTON_GAP }
|
|
1797
1875
|
});
|
|
@@ -1810,7 +1888,7 @@ var ConfirmDialog = ({
|
|
|
1810
1888
|
const { theme, t } = uiFeedback.useUi();
|
|
1811
1889
|
const resolvedConfirm = confirmLabel ?? t(LAYOUT_I18N.confirm);
|
|
1812
1890
|
const resolvedCancel = cancelLabel ?? t(LAYOUT_I18N.cancel);
|
|
1813
|
-
const footer = /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
1891
|
+
const footer = /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles17.footer, children: [
|
|
1814
1892
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1815
1893
|
uiButtons.Button,
|
|
1816
1894
|
{
|
|
@@ -1846,27 +1924,27 @@ var ConfirmDialog = ({
|
|
|
1846
1924
|
title,
|
|
1847
1925
|
visible,
|
|
1848
1926
|
onClose: onCancel,
|
|
1849
|
-
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 })
|
|
1850
1928
|
}
|
|
1851
1929
|
);
|
|
1852
1930
|
};
|
|
1853
|
-
var AccordionContext =
|
|
1931
|
+
var AccordionContext = React13.createContext(null);
|
|
1854
1932
|
function useAccordionContext() {
|
|
1855
|
-
const value =
|
|
1933
|
+
const value = React13.useContext(AccordionContext);
|
|
1856
1934
|
if (value === null) {
|
|
1857
1935
|
throw new Error("AccordionItem must be rendered inside an <Accordion>.");
|
|
1858
1936
|
}
|
|
1859
1937
|
return value;
|
|
1860
1938
|
}
|
|
1861
1939
|
var BOXED_GAP = 12;
|
|
1862
|
-
var
|
|
1940
|
+
var styles18 = reactNative.StyleSheet.create({
|
|
1863
1941
|
container: { alignSelf: "stretch" },
|
|
1864
1942
|
boxed: { gap: BOXED_GAP }
|
|
1865
1943
|
});
|
|
1866
1944
|
function computeInitialOpen(children, defaultOpenIds, allowMultiple) {
|
|
1867
1945
|
const ids = new Set(defaultOpenIds ?? []);
|
|
1868
|
-
|
|
1869
|
-
if (!
|
|
1946
|
+
React13__default.default.Children.forEach(children, (child) => {
|
|
1947
|
+
if (!React13__default.default.isValidElement(child)) return;
|
|
1870
1948
|
const props = child.props;
|
|
1871
1949
|
if (props.defaultOpen === true && typeof props.id === "string") {
|
|
1872
1950
|
ids.add(props.id);
|
|
@@ -1889,14 +1967,14 @@ var Accordion = ({
|
|
|
1889
1967
|
style
|
|
1890
1968
|
}) => {
|
|
1891
1969
|
const isControlled = openIds !== void 0;
|
|
1892
|
-
const [internalOpen, setInternalOpen] =
|
|
1970
|
+
const [internalOpen, setInternalOpen] = React13.useState(
|
|
1893
1971
|
() => computeInitialOpen(children, defaultOpenIds, allowMultiple)
|
|
1894
1972
|
);
|
|
1895
|
-
const openSet =
|
|
1973
|
+
const openSet = React13.useMemo(
|
|
1896
1974
|
() => isControlled ? new Set(openIds) : internalOpen,
|
|
1897
1975
|
[isControlled, openIds, internalOpen]
|
|
1898
1976
|
);
|
|
1899
|
-
const toggle =
|
|
1977
|
+
const toggle = React13.useCallback(
|
|
1900
1978
|
(id) => {
|
|
1901
1979
|
const next = new Set(openSet);
|
|
1902
1980
|
const willOpen = !next.has(id);
|
|
@@ -1911,12 +1989,12 @@ var Accordion = ({
|
|
|
1911
1989
|
},
|
|
1912
1990
|
[allowMultiple, isControlled, onOpenChange, openSet]
|
|
1913
1991
|
);
|
|
1914
|
-
const contextValue =
|
|
1992
|
+
const contextValue = React13.useMemo(
|
|
1915
1993
|
() => ({ openIds: openSet, toggle, allowMultiple, variant }),
|
|
1916
1994
|
[openSet, toggle, allowMultiple, variant]
|
|
1917
1995
|
);
|
|
1918
|
-
const containerStyle =
|
|
1919
|
-
const base = variant === "boxed" ? [
|
|
1996
|
+
const containerStyle = React13.useMemo(() => {
|
|
1997
|
+
const base = variant === "boxed" ? [styles18.container, styles18.boxed] : [styles18.container];
|
|
1920
1998
|
if (style === void 0) return base;
|
|
1921
1999
|
return [...base, ...Array.isArray(style) ? style : [style]];
|
|
1922
2000
|
}, [style, variant]);
|
|
@@ -1948,7 +2026,7 @@ var BOX_TITLE_FONT_SIZE = 14;
|
|
|
1948
2026
|
var BOX_MARKER_FONT_SIZE = 13;
|
|
1949
2027
|
var BOX_MARKER_GAP = 6;
|
|
1950
2028
|
var BOX_MARKER = "\u25B8";
|
|
1951
|
-
var
|
|
2029
|
+
var styles19 = reactNative.StyleSheet.create({
|
|
1952
2030
|
item: { borderTopWidth: reactNative.StyleSheet.hairlineWidth },
|
|
1953
2031
|
boxItem: { borderWidth: 1, borderRadius: BOX_BORDER_RADIUS, paddingHorizontal: BOX_PADDING_H },
|
|
1954
2032
|
header: {
|
|
@@ -1994,9 +2072,9 @@ var AccordionItem = ({
|
|
|
1994
2072
|
const headerTestID = testID ?? `accordion-item-${id}`;
|
|
1995
2073
|
const bodyTestID = `${headerTestID}-body`;
|
|
1996
2074
|
const chevronTestID = `${headerTestID}-chevron`;
|
|
1997
|
-
const [rotation] =
|
|
2075
|
+
const [rotation] = React13.useState(() => new reactNative.Animated.Value(expanded ? ROTATE_EXPANDED : ROTATE_COLLAPSED));
|
|
1998
2076
|
const reducedMotion = rnWebHooks.useReducedMotion();
|
|
1999
|
-
|
|
2077
|
+
React13.useEffect(() => {
|
|
2000
2078
|
reactNative.Animated.timing(rotation, {
|
|
2001
2079
|
toValue: expanded ? ROTATE_EXPANDED : ROTATE_COLLAPSED,
|
|
2002
2080
|
duration: reducedMotion ? INSTANT_DURATION_MS : ROTATE_DURATION_MS,
|
|
@@ -2008,10 +2086,10 @@ var AccordionItem = ({
|
|
|
2008
2086
|
inputRange: [ROTATE_COLLAPSED, ROTATE_EXPANDED],
|
|
2009
2087
|
outputRange: [COLLAPSED_DEG, boxed ? BOXED_EXPANDED_DEG : PLAIN_EXPANDED_DEG]
|
|
2010
2088
|
});
|
|
2011
|
-
const handlePress =
|
|
2089
|
+
const handlePress = React13.useCallback(() => {
|
|
2012
2090
|
if (!disabled) toggle(id);
|
|
2013
2091
|
}, [disabled, id, toggle]);
|
|
2014
|
-
const handleKeyDown2 =
|
|
2092
|
+
const handleKeyDown2 = React13.useCallback(
|
|
2015
2093
|
(event) => {
|
|
2016
2094
|
if (disabled) return;
|
|
2017
2095
|
const key = event.key ?? "";
|
|
@@ -2023,20 +2101,20 @@ var AccordionItem = ({
|
|
|
2023
2101
|
[disabled, id, toggle]
|
|
2024
2102
|
);
|
|
2025
2103
|
const keyboardProps = reactNative.Platform.OS === "web" ? { onKeyDown: handleKeyDown2 } : {};
|
|
2026
|
-
const itemStyle =
|
|
2027
|
-
() => boxed ? [
|
|
2104
|
+
const itemStyle = React13.useMemo(
|
|
2105
|
+
() => boxed ? [styles19.boxItem, { borderColor: colors.border }] : [styles19.item, { borderTopColor: colors.border }],
|
|
2028
2106
|
[boxed, colors.border]
|
|
2029
2107
|
);
|
|
2030
|
-
const headerStyle =
|
|
2108
|
+
const headerStyle = React13.useMemo(
|
|
2031
2109
|
() => [
|
|
2032
|
-
|
|
2033
|
-
...boxed ? [
|
|
2110
|
+
styles19.header,
|
|
2111
|
+
...boxed ? [styles19.boxHeader] : [],
|
|
2034
2112
|
{ opacity: disabled ? DISABLED_OPACITY : FULL_OPACITY }
|
|
2035
2113
|
],
|
|
2036
2114
|
[boxed, disabled]
|
|
2037
2115
|
);
|
|
2038
2116
|
const resolvedLabel = accessibilityLabel ?? (typeof title === "string" ? title : void 0);
|
|
2039
|
-
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;
|
|
2040
2118
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: itemStyle, children: [
|
|
2041
2119
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2042
2120
|
reactNative.Pressable,
|
|
@@ -2053,7 +2131,7 @@ var AccordionItem = ({
|
|
|
2053
2131
|
onPress: handlePress,
|
|
2054
2132
|
...keyboardProps,
|
|
2055
2133
|
children: [
|
|
2056
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [
|
|
2134
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles19.headerLeft, boxed ? styles19.headerLeftRow : null], children: [
|
|
2057
2135
|
boxed ? (
|
|
2058
2136
|
// Decorative — the open/closed state is already conveyed by aria-expanded on the header.
|
|
2059
2137
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2062,15 +2140,15 @@ var AccordionItem = ({
|
|
|
2062
2140
|
accessibilityElementsHidden: true,
|
|
2063
2141
|
"aria-hidden": true,
|
|
2064
2142
|
importantForAccessibility: "no-hide-descendants",
|
|
2065
|
-
style: [
|
|
2143
|
+
style: [styles19.marker, { transform: [{ rotate }] }],
|
|
2066
2144
|
testID: chevronTestID,
|
|
2067
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
2145
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles19.markerText, { color: colors.textSecondary }], children: BOX_MARKER })
|
|
2068
2146
|
}
|
|
2069
2147
|
)
|
|
2070
2148
|
) : null,
|
|
2071
2149
|
titleNode
|
|
2072
2150
|
] }),
|
|
2073
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
2151
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles19.headerRight, children: [
|
|
2074
2152
|
right,
|
|
2075
2153
|
boxed ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2076
2154
|
reactNative.Animated.View,
|
|
@@ -2078,7 +2156,7 @@ var AccordionItem = ({
|
|
|
2078
2156
|
accessibilityElementsHidden: true,
|
|
2079
2157
|
"aria-hidden": true,
|
|
2080
2158
|
importantForAccessibility: "no-hide-descendants",
|
|
2081
|
-
style: [
|
|
2159
|
+
style: [styles19.chevron, { transform: [{ rotate }] }],
|
|
2082
2160
|
children: /* @__PURE__ */ jsxRuntime.jsx(uiIcons.SvgIcon, { color: colors.textSecondary, name: "chevronDown", size: CHEVRON_SIZE, testID: chevronTestID })
|
|
2083
2161
|
}
|
|
2084
2162
|
)
|
|
@@ -2092,7 +2170,7 @@ var AccordionItem = ({
|
|
|
2092
2170
|
accessibilityLabel: resolvedLabel,
|
|
2093
2171
|
nativeID: bodyTestID,
|
|
2094
2172
|
role: ROLE_REGION,
|
|
2095
|
-
style: boxed ?
|
|
2173
|
+
style: boxed ? styles19.boxBody : styles19.body,
|
|
2096
2174
|
testID: bodyTestID,
|
|
2097
2175
|
children
|
|
2098
2176
|
}
|
|
@@ -2130,14 +2208,14 @@ function measureParentInnerWidth(node) {
|
|
|
2130
2208
|
return Math.max(UNMEASURED, parent.clientWidth - padding);
|
|
2131
2209
|
}
|
|
2132
2210
|
function useAvailableWidth() {
|
|
2133
|
-
const [width, setWidth] =
|
|
2134
|
-
const nodeRef =
|
|
2135
|
-
const measureRef =
|
|
2211
|
+
const [width, setWidth] = React13.useState(UNMEASURED);
|
|
2212
|
+
const nodeRef = React13.useRef(null);
|
|
2213
|
+
const measureRef = React13.useCallback((node) => {
|
|
2136
2214
|
if (!IS_WEB3) return;
|
|
2137
2215
|
nodeRef.current = node;
|
|
2138
2216
|
if (nodeRef.current !== null) setWidth(measureParentInnerWidth(nodeRef.current));
|
|
2139
2217
|
}, []);
|
|
2140
|
-
|
|
2218
|
+
React13.useEffect(() => {
|
|
2141
2219
|
if (!IS_WEB3) return void 0;
|
|
2142
2220
|
const remeasure = () => {
|
|
2143
2221
|
const node = nodeRef.current;
|
|
@@ -2146,7 +2224,7 @@ function useAvailableWidth() {
|
|
|
2146
2224
|
window.addEventListener("resize", remeasure);
|
|
2147
2225
|
return () => window.removeEventListener("resize", remeasure);
|
|
2148
2226
|
}, []);
|
|
2149
|
-
const onLayout =
|
|
2227
|
+
const onLayout = React13.useCallback((event) => {
|
|
2150
2228
|
if (IS_WEB3) return;
|
|
2151
2229
|
setWidth(event.nativeEvent.layout.width);
|
|
2152
2230
|
}, []);
|
|
@@ -2155,7 +2233,7 @@ function useAvailableWidth() {
|
|
|
2155
2233
|
var AVG_CHAR_WIDTH_RATIO = 0.58;
|
|
2156
2234
|
var DEFAULT_FONT_SIZE2 = 13;
|
|
2157
2235
|
var UNMEASURED2 = 0;
|
|
2158
|
-
var
|
|
2236
|
+
var styles20 = reactNative.StyleSheet.create({
|
|
2159
2237
|
base: { fontSize: DEFAULT_FONT_SIZE2 },
|
|
2160
2238
|
/** `minWidth: 0` lets the text shrink inside a flex row instead of forcing the row wider. */
|
|
2161
2239
|
fill: { flexShrink: 1, minWidth: 0 }
|
|
@@ -2175,8 +2253,8 @@ var TruncatedText = ({
|
|
|
2175
2253
|
accessibilityHint
|
|
2176
2254
|
}) => {
|
|
2177
2255
|
const { width, measureRef, onLayout } = useAvailableWidth();
|
|
2178
|
-
const hostRef =
|
|
2179
|
-
const attachRef =
|
|
2256
|
+
const hostRef = React13.useRef(null);
|
|
2257
|
+
const attachRef = React13.useCallback(
|
|
2180
2258
|
(node) => {
|
|
2181
2259
|
hostRef.current = node;
|
|
2182
2260
|
measureRef(node);
|
|
@@ -2185,12 +2263,12 @@ var TruncatedText = ({
|
|
|
2185
2263
|
},
|
|
2186
2264
|
[value, measureRef]
|
|
2187
2265
|
);
|
|
2188
|
-
const flatStyle =
|
|
2189
|
-
() => reactNative.StyleSheet.flatten([
|
|
2266
|
+
const flatStyle = React13.useMemo(
|
|
2267
|
+
() => reactNative.StyleSheet.flatten([styles20.base, style]),
|
|
2190
2268
|
[style]
|
|
2191
2269
|
);
|
|
2192
2270
|
const fontSize = flatStyle.fontSize ?? DEFAULT_FONT_SIZE2;
|
|
2193
|
-
const display =
|
|
2271
|
+
const display = React13.useMemo(() => {
|
|
2194
2272
|
const source = isUrl ? formatUrlForDisplay(value) : value;
|
|
2195
2273
|
const budget = charBudget(width, fontSize);
|
|
2196
2274
|
return budget === UNMEASURED2 ? source : truncateMiddle(source, budget);
|
|
@@ -2201,7 +2279,7 @@ var TruncatedText = ({
|
|
|
2201
2279
|
ref: attachRef,
|
|
2202
2280
|
onLayout,
|
|
2203
2281
|
numberOfLines: 1,
|
|
2204
|
-
style: [
|
|
2282
|
+
style: [styles20.base, styles20.fill, style],
|
|
2205
2283
|
testID,
|
|
2206
2284
|
accessibilityRole: onPress !== void 0 || href !== void 0 ? "link" : "text",
|
|
2207
2285
|
accessibilityLabel,
|
|
@@ -2272,17 +2350,17 @@ async function copyText(value, writer) {
|
|
|
2272
2350
|
// src/CopyableId/useCopyToClipboard.ts
|
|
2273
2351
|
var COPY_FEEDBACK_MS = 2e3;
|
|
2274
2352
|
function useCopyToClipboard(value, writer) {
|
|
2275
|
-
const [status, setStatus] =
|
|
2276
|
-
const timerRef =
|
|
2277
|
-
const mountedRef =
|
|
2278
|
-
|
|
2353
|
+
const [status, setStatus] = React13.useState("idle" /* Idle */);
|
|
2354
|
+
const timerRef = React13.useRef(null);
|
|
2355
|
+
const mountedRef = React13.useRef(true);
|
|
2356
|
+
React13.useEffect(() => {
|
|
2279
2357
|
mountedRef.current = true;
|
|
2280
2358
|
return () => {
|
|
2281
2359
|
mountedRef.current = false;
|
|
2282
2360
|
if (timerRef.current !== null) clearTimeout(timerRef.current);
|
|
2283
2361
|
};
|
|
2284
2362
|
}, []);
|
|
2285
|
-
const copy =
|
|
2363
|
+
const copy = React13.useCallback(() => {
|
|
2286
2364
|
void (async () => {
|
|
2287
2365
|
const ok = await copyText(value, writer);
|
|
2288
2366
|
if (!mountedRef.current) return;
|
|
@@ -2304,7 +2382,7 @@ var LABEL_LETTER_SPACING = 0.4;
|
|
|
2304
2382
|
var ACTION_PADDING_H = 6;
|
|
2305
2383
|
var ACTION_PADDING_V = 2;
|
|
2306
2384
|
var ACTION_RADIUS = 6;
|
|
2307
|
-
var
|
|
2385
|
+
var styles21 = reactNative.StyleSheet.create({
|
|
2308
2386
|
cell: { gap: CELL_GAP },
|
|
2309
2387
|
label: {
|
|
2310
2388
|
fontSize: LABEL_FONT_SIZE,
|
|
@@ -2346,7 +2424,7 @@ var styles20 = reactNative.StyleSheet.create({
|
|
|
2346
2424
|
var TONE_STEP = "500";
|
|
2347
2425
|
function useActionState(status) {
|
|
2348
2426
|
const { theme } = uiFeedback.useUi();
|
|
2349
|
-
return
|
|
2427
|
+
return React13.useMemo(() => {
|
|
2350
2428
|
const primary = theme.palette.primary[TONE_STEP];
|
|
2351
2429
|
if (status === "copied" /* Copied */) {
|
|
2352
2430
|
return { key: LAYOUT_I18N.copied, color: theme.semantic.success?.[TONE_STEP] ?? primary };
|
|
@@ -2369,14 +2447,14 @@ var CopyableId = ({
|
|
|
2369
2447
|
const { colors } = theme;
|
|
2370
2448
|
const { status, copy } = useCopyToClipboard(value, writer);
|
|
2371
2449
|
const action = useActionState(status);
|
|
2372
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [
|
|
2373
|
-
label !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
2374
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
2375
|
-
/* @__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(
|
|
2376
2454
|
TruncatedText,
|
|
2377
2455
|
{
|
|
2378
2456
|
value,
|
|
2379
|
-
style: [
|
|
2457
|
+
style: [styles21.value, { color: colors.text }],
|
|
2380
2458
|
testID: `${testID}-value`,
|
|
2381
2459
|
accessibilityLabel: accessibilityLabel ?? value,
|
|
2382
2460
|
accessibilityHint: t(LAYOUT_I18N.copyableIdHint)
|
|
@@ -2390,7 +2468,7 @@ var CopyableId = ({
|
|
|
2390
2468
|
accessibilityLabel: t(action.key),
|
|
2391
2469
|
accessibilityHint: t(LAYOUT_I18N.copyHint),
|
|
2392
2470
|
testID: `${testID}-copy`,
|
|
2393
|
-
style: [
|
|
2471
|
+
style: [styles21.action, { color: action.color }],
|
|
2394
2472
|
children: t(action.key)
|
|
2395
2473
|
}
|
|
2396
2474
|
)
|
|
@@ -2415,15 +2493,15 @@ function formatBuildInfo(buildVersion, apiCommit) {
|
|
|
2415
2493
|
return `${base}${API_COMMIT_SEPARATOR}${shortenCommit(commit)}`;
|
|
2416
2494
|
}
|
|
2417
2495
|
function useApiCommit(apiBaseUrl, fetchImpl) {
|
|
2418
|
-
const [commit, setCommit] =
|
|
2419
|
-
const mountedRef =
|
|
2420
|
-
|
|
2496
|
+
const [commit, setCommit] = React13.useState(void 0);
|
|
2497
|
+
const mountedRef = React13.useRef(true);
|
|
2498
|
+
React13.useEffect(() => {
|
|
2421
2499
|
mountedRef.current = true;
|
|
2422
2500
|
return () => {
|
|
2423
2501
|
mountedRef.current = false;
|
|
2424
2502
|
};
|
|
2425
2503
|
}, []);
|
|
2426
|
-
|
|
2504
|
+
React13.useEffect(() => {
|
|
2427
2505
|
if (apiBaseUrl === void 0 || apiBaseUrl === "") return;
|
|
2428
2506
|
const doFetch = fetchImpl ?? (typeof fetch !== "undefined" ? fetch : void 0);
|
|
2429
2507
|
if (doFetch === void 0) return;
|
|
@@ -2445,7 +2523,7 @@ var FOOTER_PADDING_V = 6;
|
|
|
2445
2523
|
var FOOTER_PADDING_H = 12;
|
|
2446
2524
|
var FOOTER_FONT_SIZE = 11;
|
|
2447
2525
|
var FOOTER_OPACITY = 0.75;
|
|
2448
|
-
var
|
|
2526
|
+
var styles22 = reactNative.StyleSheet.create({
|
|
2449
2527
|
footer: {
|
|
2450
2528
|
paddingVertical: FOOTER_PADDING_V,
|
|
2451
2529
|
paddingHorizontal: FOOTER_PADDING_H,
|
|
@@ -2470,8 +2548,8 @@ var BuildInfoFooter = ({
|
|
|
2470
2548
|
const fetchedCommit = useApiCommit(apiCommit === void 0 ? apiBaseUrl : void 0, fetchImpl);
|
|
2471
2549
|
const commit = apiCommit ?? fetchedCommit;
|
|
2472
2550
|
const label = formatBuildInfo(buildVersion, commit);
|
|
2473
|
-
const textStyle =
|
|
2474
|
-
() => [
|
|
2551
|
+
const textStyle = React13.useMemo(
|
|
2552
|
+
() => [styles22.text, { color: theme.colors.textSecondary }],
|
|
2475
2553
|
[theme.colors.textSecondary]
|
|
2476
2554
|
);
|
|
2477
2555
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2479,7 +2557,7 @@ var BuildInfoFooter = ({
|
|
|
2479
2557
|
{
|
|
2480
2558
|
accessibilityLabel: accessibilityLabel ?? label,
|
|
2481
2559
|
accessibilityHint: accessibilityHint ?? t(LAYOUT_I18N.buildInfoHint),
|
|
2482
|
-
style: [
|
|
2560
|
+
style: [styles22.footer, style],
|
|
2483
2561
|
testID,
|
|
2484
2562
|
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: textStyle, children: label })
|
|
2485
2563
|
}
|
|
@@ -2490,7 +2568,7 @@ var BORDER = 2;
|
|
|
2490
2568
|
var GLYPH_SIZE = 14;
|
|
2491
2569
|
var GLYPH_LINE = 16;
|
|
2492
2570
|
var TICK = "\u2713";
|
|
2493
|
-
var
|
|
2571
|
+
var styles23 = reactNative.StyleSheet.create({
|
|
2494
2572
|
circle: {
|
|
2495
2573
|
width: SIZE,
|
|
2496
2574
|
height: SIZE,
|
|
@@ -2507,14 +2585,14 @@ var CheckMark = ({ filled, accent, ring, glyphColor, testID }) => /* @__PURE__ *
|
|
|
2507
2585
|
"aria-hidden": true,
|
|
2508
2586
|
accessibilityElementsHidden: true,
|
|
2509
2587
|
importantForAccessibility: "no-hide-descendants",
|
|
2510
|
-
style: [
|
|
2588
|
+
style: [styles23.circle, { borderColor: filled ? accent : ring, backgroundColor: filled ? accent : void 0 }],
|
|
2511
2589
|
testID,
|
|
2512
|
-
children: filled ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
2590
|
+
children: filled ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles23.glyph, { color: glyphColor }], children: TICK }) : null
|
|
2513
2591
|
}
|
|
2514
2592
|
);
|
|
2515
|
-
var ListRowToneContext =
|
|
2593
|
+
var ListRowToneContext = React13.createContext(null);
|
|
2516
2594
|
function useListRowTone() {
|
|
2517
|
-
return
|
|
2595
|
+
return React13.useContext(ListRowToneContext);
|
|
2518
2596
|
}
|
|
2519
2597
|
function useRowPalette() {
|
|
2520
2598
|
const { colors, palette, semantic } = uiFeedback.useUi().theme;
|
|
@@ -2632,7 +2710,7 @@ var PAD_V = 12;
|
|
|
2632
2710
|
var GAP = 4;
|
|
2633
2711
|
var MARK_GAP = 12;
|
|
2634
2712
|
var LINE_GAP = 8;
|
|
2635
|
-
var
|
|
2713
|
+
var styles24 = reactNative.StyleSheet.create({
|
|
2636
2714
|
row: {
|
|
2637
2715
|
flexDirection: "row",
|
|
2638
2716
|
alignItems: "center",
|
|
@@ -2656,7 +2734,7 @@ function focusTarget(event) {
|
|
|
2656
2734
|
}
|
|
2657
2735
|
function slot(node, color, strong) {
|
|
2658
2736
|
if (typeof node !== "string") return node;
|
|
2659
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
2737
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles24.shrink, strong ? styles24.strong : null, { color }], children: node });
|
|
2660
2738
|
}
|
|
2661
2739
|
var ListRow = ({
|
|
2662
2740
|
title,
|
|
@@ -2673,9 +2751,9 @@ var ListRow = ({
|
|
|
2673
2751
|
}) => {
|
|
2674
2752
|
const palette = useRowPalette();
|
|
2675
2753
|
const { colors } = uiFeedback.useUi().theme;
|
|
2676
|
-
const [focused, setFocused] =
|
|
2754
|
+
const [focused, setFocused] = React13.useState(false);
|
|
2677
2755
|
const rest = resolveRowLook(selectedStyle, { selected, hovered: false, pressed: false, focused }, palette);
|
|
2678
|
-
const tone =
|
|
2756
|
+
const tone = React13.useMemo(() => ({ textColor: rest.textColor, inverse: rest.inverse }), [rest.textColor, rest.inverse]);
|
|
2679
2757
|
const checkTestId = testID === void 0 ? void 0 : `${testID}-check`;
|
|
2680
2758
|
return /* @__PURE__ */ jsxRuntime.jsxs(ListRowToneContext.Provider, { value: tone, children: [
|
|
2681
2759
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -2688,7 +2766,7 @@ var ListRow = ({
|
|
|
2688
2766
|
style: (state) => {
|
|
2689
2767
|
const { pressed, hovered } = state;
|
|
2690
2768
|
const look = resolveRowLook(selectedStyle, { selected, pressed, focused, hovered: hovered === true }, palette);
|
|
2691
|
-
return [
|
|
2769
|
+
return [styles24.row, { borderTopColor: colors.border }, look.container];
|
|
2692
2770
|
},
|
|
2693
2771
|
testID,
|
|
2694
2772
|
onBlur: () => {
|
|
@@ -2701,14 +2779,14 @@ var ListRow = ({
|
|
|
2701
2779
|
...pressedProps(selected),
|
|
2702
2780
|
children: [
|
|
2703
2781
|
rest.showCheck ? /* @__PURE__ */ jsxRuntime.jsx(CheckMark, { accent: palette.accent, filled: rest.checkFilled, glyphColor: palette.background, ring: palette.border, testID: checkTestId }) : null,
|
|
2704
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
2705
|
-
/* @__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: [
|
|
2706
2784
|
slot(title, rest.titleColor, true),
|
|
2707
2785
|
slot(trailing, rest.textColor, true)
|
|
2708
2786
|
] }),
|
|
2709
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
2710
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style:
|
|
2711
|
-
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 })
|
|
2712
2790
|
] })
|
|
2713
2791
|
] })
|
|
2714
2792
|
]
|
|
@@ -2748,6 +2826,7 @@ exports.Section = Section;
|
|
|
2748
2826
|
exports.SectionVariant = SectionVariant;
|
|
2749
2827
|
exports.SegmentedControl = SegmentedControl;
|
|
2750
2828
|
exports.SelectedMarker = SelectedMarker;
|
|
2829
|
+
exports.SideSheet = SideSheet;
|
|
2751
2830
|
exports.StatusBadge = StatusBadge;
|
|
2752
2831
|
exports.StickyPreview = StickyPreview;
|
|
2753
2832
|
exports.TYPE_SCALE_BREAKPOINT = TYPE_SCALE_BREAKPOINT;
|