@dloizides/ui-layout 1.21.0 → 1.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/README.md +35 -0
- package/dist/index.d.mts +113 -1
- package/dist/index.d.ts +113 -1
- package/dist/index.js +296 -92
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +235 -33
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -2
package/dist/index.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React10 = require('react');
|
|
4
4
|
var reactNative = require('react-native');
|
|
5
5
|
var uiFeedback = require('@dloizides/ui-feedback');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var a11y = require('@dloizides/a11y');
|
|
8
8
|
var reactDom = require('react-dom');
|
|
9
9
|
var uiIcons = require('@dloizides/ui-icons');
|
|
10
|
+
var uiButtons = require('@dloizides/ui-buttons');
|
|
10
11
|
var rnWebHooks = require('@dloizides/rn-web-hooks');
|
|
11
12
|
|
|
12
13
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
14
|
|
|
14
|
-
var
|
|
15
|
+
var React10__default = /*#__PURE__*/_interopDefault(React10);
|
|
15
16
|
|
|
16
17
|
// src/Section/Section.tsx
|
|
17
18
|
var styles = reactNative.StyleSheet.create({
|
|
@@ -23,7 +24,7 @@ var styles = reactNative.StyleSheet.create({
|
|
|
23
24
|
});
|
|
24
25
|
var Section = ({ children, style }) => {
|
|
25
26
|
const { theme } = uiFeedback.useUi();
|
|
26
|
-
const containerStyle =
|
|
27
|
+
const containerStyle = React10__default.default.useMemo(
|
|
27
28
|
() => [styles.card, { borderColor: theme.colors.border, backgroundColor: theme.colors.surface }, style],
|
|
28
29
|
[theme.colors.border, theme.colors.surface, style]
|
|
29
30
|
);
|
|
@@ -39,6 +40,10 @@ var LAYOUT_TEST_IDS = {
|
|
|
39
40
|
upgradePromptDismiss: "upgrade-prompt-dismiss",
|
|
40
41
|
modalShell: "template-modal",
|
|
41
42
|
modalShellClose: "cancel-button",
|
|
43
|
+
/** Default base testID for the centered `Modal`; ✕ is `modal-close`, backdrop `modal-backdrop`. */
|
|
44
|
+
modal: "modal",
|
|
45
|
+
/** Default base testID for `ConfirmDialog`; Confirm/Cancel are `confirm-dialog-{confirm,cancel}`. */
|
|
46
|
+
confirmDialog: "confirm-dialog",
|
|
42
47
|
accordion: "accordion"
|
|
43
48
|
};
|
|
44
49
|
var DEFAULT_BILLING_ROUTE = "/settings/billing";
|
|
@@ -67,6 +72,14 @@ var LAYOUT_I18N = {
|
|
|
67
72
|
close: "quizTemplates.cancel",
|
|
68
73
|
/** `ModalShell`: heading fallback when no title is supplied. */
|
|
69
74
|
closeHeading: "close",
|
|
75
|
+
/** `Modal`: accessible name + web tooltip of the top-right ✕ close button. */
|
|
76
|
+
dialogClose: "common.close",
|
|
77
|
+
/** `ConfirmDialog`: default Confirm button label (overridable via `confirmLabel`) + its hint. */
|
|
78
|
+
confirm: "common.confirm",
|
|
79
|
+
confirmHint: "common.confirmHint",
|
|
80
|
+
/** `ConfirmDialog`: default Cancel button label (overridable via `cancelLabel`) + its hint. */
|
|
81
|
+
cancel: "common.cancel",
|
|
82
|
+
cancelHint: "common.cancelHint",
|
|
70
83
|
upgradePromptTitle: "settings.billing.upgradePrompt.title",
|
|
71
84
|
/** Body copy, parameterised: "…requires {{p1}}, you are on {{p2}}." */
|
|
72
85
|
upgradePromptMessage: "settings.billing.upgradePrompt.message",
|
|
@@ -102,7 +115,7 @@ var Heading = ({
|
|
|
102
115
|
testID
|
|
103
116
|
}) => {
|
|
104
117
|
const { theme } = uiFeedback.useUi();
|
|
105
|
-
const headingStyle =
|
|
118
|
+
const headingStyle = React10__default.default.useMemo(
|
|
106
119
|
() => [styles2.heading, { color: theme.colors.text }, style],
|
|
107
120
|
[theme.colors.text, style]
|
|
108
121
|
);
|
|
@@ -142,8 +155,8 @@ var StatusBadge = ({
|
|
|
142
155
|
accessibilityHint
|
|
143
156
|
}) => {
|
|
144
157
|
const { t } = uiFeedback.useUi();
|
|
145
|
-
const dynamicBadge =
|
|
146
|
-
const dynamicText =
|
|
158
|
+
const dynamicBadge = React10.useMemo(() => ({ backgroundColor }), [backgroundColor]);
|
|
159
|
+
const dynamicText = React10.useMemo(() => ({ color }), [color]);
|
|
147
160
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
148
161
|
reactNative.View,
|
|
149
162
|
{
|
|
@@ -280,8 +293,8 @@ function handleKeyDown(domNode, event) {
|
|
|
280
293
|
}
|
|
281
294
|
}
|
|
282
295
|
function useFocusTrap(containerRef, enabled) {
|
|
283
|
-
const previousFocusRef =
|
|
284
|
-
|
|
296
|
+
const previousFocusRef = React10.useRef(null);
|
|
297
|
+
React10.useEffect(() => {
|
|
285
298
|
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
286
299
|
const domNode = containerRef.current;
|
|
287
300
|
if (!domNode) return;
|
|
@@ -366,7 +379,7 @@ var OptionRow = ({
|
|
|
366
379
|
}) => {
|
|
367
380
|
const { theme, t } = uiFeedback.useUi();
|
|
368
381
|
const { colors } = theme;
|
|
369
|
-
const handlePress =
|
|
382
|
+
const handlePress = React10.useCallback(() => {
|
|
370
383
|
onSelect();
|
|
371
384
|
}, [onSelect]);
|
|
372
385
|
const isActive = isSelected || isHighlighted;
|
|
@@ -435,8 +448,8 @@ function observeLayout(node, onChange) {
|
|
|
435
448
|
return observer;
|
|
436
449
|
}
|
|
437
450
|
function useAnchorTracking(containerRef, onOutOfView) {
|
|
438
|
-
const [rect, setRect] =
|
|
439
|
-
|
|
451
|
+
const [rect, setRect] = React10.useState(() => readAnchorRect(containerRef));
|
|
452
|
+
React10.useLayoutEffect(() => {
|
|
440
453
|
if (!IS_WEB) return void 0;
|
|
441
454
|
let frame = null;
|
|
442
455
|
let isDisposed = false;
|
|
@@ -515,7 +528,7 @@ function buildKeyHandler(params) {
|
|
|
515
528
|
}
|
|
516
529
|
function useMenuKeyboard(params) {
|
|
517
530
|
const { containerRef, menuRef, enabled, onClose } = params;
|
|
518
|
-
|
|
531
|
+
React10.useEffect(() => {
|
|
519
532
|
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
520
533
|
const onKeyDown = buildKeyHandler(params);
|
|
521
534
|
const onMouseDown = (event) => {
|
|
@@ -566,21 +579,21 @@ var InlineMenu = ({
|
|
|
566
579
|
}) => {
|
|
567
580
|
const { theme } = uiFeedback.useUi();
|
|
568
581
|
const { colors } = theme;
|
|
569
|
-
const menuRef =
|
|
582
|
+
const menuRef = React10.useRef(null);
|
|
570
583
|
const rect = useAnchorTracking(containerRef, onClose);
|
|
571
|
-
const selectedIndex =
|
|
584
|
+
const selectedIndex = React10.useMemo(
|
|
572
585
|
() => Math.max(0, options.findIndex((opt) => opt.value === value)),
|
|
573
586
|
[options, value]
|
|
574
587
|
);
|
|
575
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
576
|
-
const selectAt =
|
|
588
|
+
const [highlightedIndex, setHighlightedIndex] = React10.useState(() => selectedIndex);
|
|
589
|
+
const selectAt = React10.useCallback(
|
|
577
590
|
(index) => {
|
|
578
591
|
const option = options[index];
|
|
579
592
|
if (option !== void 0) onSelect(option.value);
|
|
580
593
|
},
|
|
581
594
|
[options, onSelect]
|
|
582
595
|
);
|
|
583
|
-
const selectHighlighted =
|
|
596
|
+
const selectHighlighted = React10.useCallback(
|
|
584
597
|
() => {
|
|
585
598
|
selectAt(highlightedIndex);
|
|
586
599
|
},
|
|
@@ -595,7 +608,7 @@ var InlineMenu = ({
|
|
|
595
608
|
onSelectHighlighted: selectHighlighted,
|
|
596
609
|
onClose
|
|
597
610
|
});
|
|
598
|
-
const popoverStyle =
|
|
611
|
+
const popoverStyle = React10.useMemo(() => {
|
|
599
612
|
const themed = { borderColor: colors.border, backgroundColor: colors.surface };
|
|
600
613
|
if (IS_WEB2)
|
|
601
614
|
return [
|
|
@@ -718,7 +731,7 @@ var ModalDropdown = ({
|
|
|
718
731
|
const { colors } = theme;
|
|
719
732
|
const resolvedVariant = useResolvedDropdownVariant(variant);
|
|
720
733
|
const isMenu = resolvedVariant === "menu" /* Menu */;
|
|
721
|
-
const [isOpen, setIsOpen] =
|
|
734
|
+
const [isOpen, setIsOpen] = React10.useState(false);
|
|
722
735
|
const { a11yProps, hintNode } = a11y.useA11y({
|
|
723
736
|
label: accessibilityLabel,
|
|
724
737
|
hint: accessibilityHint,
|
|
@@ -726,20 +739,20 @@ var ModalDropdown = ({
|
|
|
726
739
|
state: { expanded: isOpen },
|
|
727
740
|
testID
|
|
728
741
|
});
|
|
729
|
-
const anchorRef =
|
|
730
|
-
const dialogRef =
|
|
742
|
+
const anchorRef = React10.useRef(null);
|
|
743
|
+
const dialogRef = React10.useRef(null);
|
|
731
744
|
useFocusTrap(dialogRef, isOpen && !isMenu);
|
|
732
|
-
const selectedLabel =
|
|
745
|
+
const selectedLabel = React10.useMemo(() => {
|
|
733
746
|
const found = options.find((opt) => opt.value === value);
|
|
734
747
|
return found?.label ?? t(LAYOUT_I18N.selectPlaceholder);
|
|
735
748
|
}, [options, value, t]);
|
|
736
|
-
const handleToggle =
|
|
749
|
+
const handleToggle = React10.useCallback(() => {
|
|
737
750
|
setIsOpen((prev) => !prev);
|
|
738
751
|
}, []);
|
|
739
|
-
const handleClose =
|
|
752
|
+
const handleClose = React10.useCallback(() => {
|
|
740
753
|
setIsOpen(false);
|
|
741
754
|
}, []);
|
|
742
|
-
const handleSelect =
|
|
755
|
+
const handleSelect = React10.useCallback(
|
|
743
756
|
(optionValue) => {
|
|
744
757
|
onChange(optionValue);
|
|
745
758
|
setIsOpen(false);
|
|
@@ -748,7 +761,7 @@ var ModalDropdown = ({
|
|
|
748
761
|
);
|
|
749
762
|
const isHamburger = showHamburger;
|
|
750
763
|
const isCaret = showCaret && !isHamburger;
|
|
751
|
-
const containerStyle =
|
|
764
|
+
const containerStyle = React10.useMemo(
|
|
752
765
|
() => renderTrigger !== void 0 ? void 0 : [
|
|
753
766
|
styles7.container,
|
|
754
767
|
isHamburger ? styles7.containerHamburger : isCaret ? styles7.containerMenu : null,
|
|
@@ -756,30 +769,30 @@ var ModalDropdown = ({
|
|
|
756
769
|
],
|
|
757
770
|
[colors.border, colors.surface, renderTrigger, isHamburger, isCaret]
|
|
758
771
|
);
|
|
759
|
-
const hamburgerStyle =
|
|
772
|
+
const hamburgerStyle = React10.useMemo(
|
|
760
773
|
() => [styles7.hamburger, { color: colors.textSecondary }],
|
|
761
774
|
[colors.textSecondary]
|
|
762
775
|
);
|
|
763
|
-
const caretStyle =
|
|
776
|
+
const caretStyle = React10.useMemo(
|
|
764
777
|
() => [
|
|
765
778
|
styles7.caret,
|
|
766
779
|
{ color: colors.textSecondary, transform: [{ rotate: isOpen ? CARET_OPEN_ROTATION : CARET_CLOSED_ROTATION }] }
|
|
767
780
|
],
|
|
768
781
|
[colors.textSecondary, isOpen]
|
|
769
782
|
);
|
|
770
|
-
const optionTestIDFor =
|
|
783
|
+
const optionTestIDFor = React10.useCallback(
|
|
771
784
|
(optionValue) => optionTestID !== void 0 ? optionTestID(optionValue) : `${testID}-option-${String(optionValue)}`,
|
|
772
785
|
[optionTestID, testID]
|
|
773
786
|
);
|
|
774
|
-
const anchorStyle =
|
|
787
|
+
const anchorStyle = React10.useMemo(
|
|
775
788
|
() => [styles7.anchor, buildAnchorStackStyle(isMenu && isOpen)],
|
|
776
789
|
[isMenu, isOpen]
|
|
777
790
|
);
|
|
778
|
-
const modalContentStyle =
|
|
791
|
+
const modalContentStyle = React10.useMemo(
|
|
779
792
|
() => [styles7.modalContent, { backgroundColor: colors.surface }],
|
|
780
793
|
[colors.surface]
|
|
781
794
|
);
|
|
782
|
-
const renderModalOption =
|
|
795
|
+
const renderModalOption = React10.useCallback(
|
|
783
796
|
({ item }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
784
797
|
OptionRow,
|
|
785
798
|
{
|
|
@@ -791,7 +804,7 @@ var ModalDropdown = ({
|
|
|
791
804
|
),
|
|
792
805
|
[handleSelect, optionTestIDFor, value]
|
|
793
806
|
);
|
|
794
|
-
const keyExtractor =
|
|
807
|
+
const keyExtractor = React10.useCallback((item) => String(item.value), []);
|
|
795
808
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { ref: anchorRef, style: anchorStyle, children: [
|
|
796
809
|
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.TouchableOpacity, { ...a11yProps, style: containerStyle, onPress: handleToggle, children: [
|
|
797
810
|
renderTrigger !== void 0 ? renderTrigger({ label: selectedLabel, isOpen }) : isHamburger ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -855,11 +868,11 @@ var TabsMenu = ({
|
|
|
855
868
|
collapsedTrigger = "caret" /* Caret */
|
|
856
869
|
}) => {
|
|
857
870
|
const { t } = uiFeedback.useUi();
|
|
858
|
-
const options =
|
|
871
|
+
const options = React10.useMemo(
|
|
859
872
|
() => tabs.map((tab) => ({ label: tab.label, value: tab.key })),
|
|
860
873
|
[tabs]
|
|
861
874
|
);
|
|
862
|
-
const optionTestID =
|
|
875
|
+
const optionTestID = React10.useCallback(
|
|
863
876
|
(key) => {
|
|
864
877
|
const found = tabs.find((tab) => tab.key === key);
|
|
865
878
|
return found?.testID ?? `${idPrefix}-tab-${key}`;
|
|
@@ -1128,7 +1141,7 @@ var ModalShell = ({
|
|
|
1128
1141
|
showClose = true
|
|
1129
1142
|
}) => {
|
|
1130
1143
|
const { theme, t } = uiFeedback.useUi();
|
|
1131
|
-
const containerStyle =
|
|
1144
|
+
const containerStyle = React10__default.default.useMemo(
|
|
1132
1145
|
() => [styles10.container, { backgroundColor: theme.colors.background }, contentStyle],
|
|
1133
1146
|
[theme.colors.background, contentStyle]
|
|
1134
1147
|
);
|
|
@@ -1171,9 +1184,198 @@ var ModalShell = ({
|
|
|
1171
1184
|
}
|
|
1172
1185
|
);
|
|
1173
1186
|
};
|
|
1174
|
-
|
|
1187
|
+
function useEscapeKey(enabled, onClose) {
|
|
1188
|
+
React10.useEffect(() => {
|
|
1189
|
+
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
1190
|
+
const onKeyDown = (event) => {
|
|
1191
|
+
if (event.key === "Escape") onClose();
|
|
1192
|
+
};
|
|
1193
|
+
document.addEventListener("keydown", onKeyDown);
|
|
1194
|
+
return () => {
|
|
1195
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
1196
|
+
};
|
|
1197
|
+
}, [enabled, onClose]);
|
|
1198
|
+
}
|
|
1199
|
+
function useScrollLock(enabled) {
|
|
1200
|
+
React10.useEffect(() => {
|
|
1201
|
+
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
1202
|
+
const { body } = document;
|
|
1203
|
+
const previousOverflow = body.style.overflow;
|
|
1204
|
+
body.style.overflow = "hidden";
|
|
1205
|
+
return () => {
|
|
1206
|
+
body.style.overflow = previousOverflow;
|
|
1207
|
+
};
|
|
1208
|
+
}, [enabled]);
|
|
1209
|
+
}
|
|
1210
|
+
var OVERLAY_PADDING = 16;
|
|
1211
|
+
var DIALOG_RADIUS = 12;
|
|
1212
|
+
var DIALOG_PADDING = 16;
|
|
1213
|
+
var HEADER_GAP = 12;
|
|
1214
|
+
var FOOTER_MARGIN = 16;
|
|
1215
|
+
var HEADER_MARGIN = 12;
|
|
1216
|
+
var DIALOG_MAX_HEIGHT = "90%";
|
|
1217
|
+
var SIZE_MAX_WIDTH = { sm: 360, md: 480, lg: 640 };
|
|
1218
|
+
var styles11 = reactNative.StyleSheet.create({
|
|
1219
|
+
overlay: {
|
|
1220
|
+
flex: 1,
|
|
1221
|
+
justifyContent: "center",
|
|
1222
|
+
alignItems: "center",
|
|
1223
|
+
padding: OVERLAY_PADDING,
|
|
1224
|
+
backgroundColor: uiFeedback.MODAL_OVERLAY_COLOR
|
|
1225
|
+
},
|
|
1226
|
+
dialog: {
|
|
1227
|
+
width: "100%",
|
|
1228
|
+
borderRadius: DIALOG_RADIUS,
|
|
1229
|
+
padding: DIALOG_PADDING,
|
|
1230
|
+
maxHeight: DIALOG_MAX_HEIGHT
|
|
1231
|
+
},
|
|
1232
|
+
headerRow: {
|
|
1233
|
+
flexDirection: "row",
|
|
1234
|
+
alignItems: "flex-start",
|
|
1235
|
+
justifyContent: "space-between",
|
|
1236
|
+
columnGap: HEADER_GAP,
|
|
1237
|
+
marginBottom: HEADER_MARGIN
|
|
1238
|
+
},
|
|
1239
|
+
// Occupies the header's leading space so the ✕ pins to the trailing edge even without a title.
|
|
1240
|
+
titleWrap: { flex: 1 },
|
|
1241
|
+
footer: { marginTop: FOOTER_MARGIN }
|
|
1242
|
+
});
|
|
1243
|
+
var Modal3 = ({
|
|
1244
|
+
visible,
|
|
1245
|
+
onClose,
|
|
1246
|
+
title,
|
|
1247
|
+
children,
|
|
1248
|
+
footer,
|
|
1249
|
+
size = "md",
|
|
1250
|
+
showClose = true,
|
|
1251
|
+
testID = LAYOUT_TEST_IDS.modal,
|
|
1252
|
+
accessibilityLabel
|
|
1253
|
+
}) => {
|
|
1254
|
+
const { theme, t } = uiFeedback.useUi();
|
|
1255
|
+
const dialogRef = React10.useRef(null);
|
|
1256
|
+
useFocusTrap(dialogRef, visible);
|
|
1257
|
+
useEscapeKey(visible, onClose);
|
|
1258
|
+
useScrollLock(visible);
|
|
1259
|
+
const accessibleName = accessibilityLabel ?? title ?? t(LAYOUT_I18N.dialog);
|
|
1260
|
+
const closeLabel = t(LAYOUT_I18N.dialogClose);
|
|
1261
|
+
const dialogStyle = React10.useMemo(
|
|
1262
|
+
() => [styles11.dialog, { backgroundColor: theme.colors.surface, maxWidth: SIZE_MAX_WIDTH[size] }],
|
|
1263
|
+
[theme.colors.surface, size]
|
|
1264
|
+
);
|
|
1265
|
+
const hasHeader = title !== void 0 || showClose;
|
|
1266
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, animationType: "fade", visible, onRequestClose: onClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles11.overlay, children: [
|
|
1267
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1268
|
+
reactNative.TouchableOpacity,
|
|
1269
|
+
{
|
|
1270
|
+
accessible: true,
|
|
1271
|
+
accessibilityHint: t(LAYOUT_I18N.dismissDropdownHint),
|
|
1272
|
+
accessibilityLabel: t(LAYOUT_I18N.dismissDropdown),
|
|
1273
|
+
accessibilityRole: "button",
|
|
1274
|
+
activeOpacity: 1,
|
|
1275
|
+
style: reactNative.StyleSheet.absoluteFill,
|
|
1276
|
+
testID: `${testID}-backdrop`,
|
|
1277
|
+
onPress: onClose
|
|
1278
|
+
}
|
|
1279
|
+
),
|
|
1280
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1281
|
+
reactNative.View,
|
|
1282
|
+
{
|
|
1283
|
+
ref: dialogRef,
|
|
1284
|
+
accessibilityViewIsModal: true,
|
|
1285
|
+
"aria-label": accessibleName,
|
|
1286
|
+
role: "dialog",
|
|
1287
|
+
style: dialogStyle,
|
|
1288
|
+
testID,
|
|
1289
|
+
children: [
|
|
1290
|
+
hasHeader ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles11.headerRow, children: [
|
|
1291
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles11.titleWrap, children: title !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(Heading, { children: title }) : null }),
|
|
1292
|
+
showClose ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1293
|
+
uiButtons.IconButton,
|
|
1294
|
+
{
|
|
1295
|
+
accessibilityHint: t(LAYOUT_I18N.closeDialogHint),
|
|
1296
|
+
accessibilityLabel: closeLabel,
|
|
1297
|
+
appearance: "ghost",
|
|
1298
|
+
renderIcon: (color, iconSize) => /* @__PURE__ */ jsxRuntime.jsx(uiIcons.SvgIcon, { color, name: "close", size: iconSize }),
|
|
1299
|
+
size: "md",
|
|
1300
|
+
testID: `${testID}-close`,
|
|
1301
|
+
tooltip: closeLabel,
|
|
1302
|
+
variant: "ghost",
|
|
1303
|
+
onPress: onClose
|
|
1304
|
+
}
|
|
1305
|
+
) : null
|
|
1306
|
+
] }) : null,
|
|
1307
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { children }),
|
|
1308
|
+
footer !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles11.footer, children: footer }) : null
|
|
1309
|
+
]
|
|
1310
|
+
}
|
|
1311
|
+
)
|
|
1312
|
+
] }) });
|
|
1313
|
+
};
|
|
1314
|
+
var MESSAGE_FONT_SIZE2 = 14;
|
|
1315
|
+
var MESSAGE_LINE_HEIGHT = 20;
|
|
1316
|
+
var BUTTON_GAP = 12;
|
|
1317
|
+
var styles12 = reactNative.StyleSheet.create({
|
|
1318
|
+
message: { fontSize: MESSAGE_FONT_SIZE2, lineHeight: MESSAGE_LINE_HEIGHT },
|
|
1319
|
+
footer: { flexDirection: "row", justifyContent: "flex-end", columnGap: BUTTON_GAP }
|
|
1320
|
+
});
|
|
1321
|
+
var ConfirmDialog = ({
|
|
1322
|
+
visible,
|
|
1323
|
+
title,
|
|
1324
|
+
message,
|
|
1325
|
+
confirmLabel,
|
|
1326
|
+
cancelLabel,
|
|
1327
|
+
destructive = false,
|
|
1328
|
+
onConfirm,
|
|
1329
|
+
onCancel,
|
|
1330
|
+
busy = false,
|
|
1331
|
+
testID = LAYOUT_TEST_IDS.confirmDialog
|
|
1332
|
+
}) => {
|
|
1333
|
+
const { theme, t } = uiFeedback.useUi();
|
|
1334
|
+
const resolvedConfirm = confirmLabel ?? t(LAYOUT_I18N.confirm);
|
|
1335
|
+
const resolvedCancel = cancelLabel ?? t(LAYOUT_I18N.cancel);
|
|
1336
|
+
const footer = /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles12.footer, children: [
|
|
1337
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1338
|
+
uiButtons.Button,
|
|
1339
|
+
{
|
|
1340
|
+
accessibilityHint: t(LAYOUT_I18N.cancelHint),
|
|
1341
|
+
accessibilityLabel: resolvedCancel,
|
|
1342
|
+
disabled: busy,
|
|
1343
|
+
label: resolvedCancel,
|
|
1344
|
+
testID: `${testID}-cancel`,
|
|
1345
|
+
variant: "secondary",
|
|
1346
|
+
onPress: onCancel
|
|
1347
|
+
}
|
|
1348
|
+
),
|
|
1349
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1350
|
+
uiButtons.Button,
|
|
1351
|
+
{
|
|
1352
|
+
accessibilityHint: t(LAYOUT_I18N.confirmHint),
|
|
1353
|
+
accessibilityLabel: resolvedConfirm,
|
|
1354
|
+
label: resolvedConfirm,
|
|
1355
|
+
loading: busy,
|
|
1356
|
+
testID: `${testID}-confirm`,
|
|
1357
|
+
variant: destructive ? "danger" : "primary",
|
|
1358
|
+
onPress: onConfirm
|
|
1359
|
+
}
|
|
1360
|
+
)
|
|
1361
|
+
] });
|
|
1362
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1363
|
+
Modal3,
|
|
1364
|
+
{
|
|
1365
|
+
footer,
|
|
1366
|
+
showClose: false,
|
|
1367
|
+
size: "sm",
|
|
1368
|
+
testID,
|
|
1369
|
+
title,
|
|
1370
|
+
visible,
|
|
1371
|
+
onClose: onCancel,
|
|
1372
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles12.message, { color: theme.colors.text }], testID: `${testID}-message`, children: message })
|
|
1373
|
+
}
|
|
1374
|
+
);
|
|
1375
|
+
};
|
|
1376
|
+
var AccordionContext = React10.createContext(null);
|
|
1175
1377
|
function useAccordionContext() {
|
|
1176
|
-
const value =
|
|
1378
|
+
const value = React10.useContext(AccordionContext);
|
|
1177
1379
|
if (value === null) {
|
|
1178
1380
|
throw new Error("AccordionItem must be rendered inside an <Accordion>.");
|
|
1179
1381
|
}
|
|
@@ -1200,14 +1402,14 @@ function animateNextLayout() {
|
|
|
1200
1402
|
}
|
|
1201
1403
|
}
|
|
1202
1404
|
var BOXED_GAP = 12;
|
|
1203
|
-
var
|
|
1405
|
+
var styles13 = reactNative.StyleSheet.create({
|
|
1204
1406
|
container: { alignSelf: "stretch" },
|
|
1205
1407
|
boxed: { gap: BOXED_GAP }
|
|
1206
1408
|
});
|
|
1207
1409
|
function computeInitialOpen(children, defaultOpenIds, allowMultiple) {
|
|
1208
1410
|
const ids = new Set(defaultOpenIds ?? []);
|
|
1209
|
-
|
|
1210
|
-
if (!
|
|
1411
|
+
React10__default.default.Children.forEach(children, (child) => {
|
|
1412
|
+
if (!React10__default.default.isValidElement(child)) return;
|
|
1211
1413
|
const props = child.props;
|
|
1212
1414
|
if (props.defaultOpen === true && typeof props.id === "string") {
|
|
1213
1415
|
ids.add(props.id);
|
|
@@ -1230,14 +1432,14 @@ var Accordion = ({
|
|
|
1230
1432
|
style
|
|
1231
1433
|
}) => {
|
|
1232
1434
|
const isControlled = openIds !== void 0;
|
|
1233
|
-
const [internalOpen, setInternalOpen] =
|
|
1435
|
+
const [internalOpen, setInternalOpen] = React10.useState(
|
|
1234
1436
|
() => computeInitialOpen(children, defaultOpenIds, allowMultiple)
|
|
1235
1437
|
);
|
|
1236
|
-
const openSet =
|
|
1438
|
+
const openSet = React10.useMemo(
|
|
1237
1439
|
() => isControlled ? new Set(openIds) : internalOpen,
|
|
1238
1440
|
[isControlled, openIds, internalOpen]
|
|
1239
1441
|
);
|
|
1240
|
-
const toggle =
|
|
1442
|
+
const toggle = React10.useCallback(
|
|
1241
1443
|
(id) => {
|
|
1242
1444
|
animateNextLayout();
|
|
1243
1445
|
const next = new Set(openSet);
|
|
@@ -1253,12 +1455,12 @@ var Accordion = ({
|
|
|
1253
1455
|
},
|
|
1254
1456
|
[allowMultiple, isControlled, onOpenChange, openSet]
|
|
1255
1457
|
);
|
|
1256
|
-
const contextValue =
|
|
1458
|
+
const contextValue = React10.useMemo(
|
|
1257
1459
|
() => ({ openIds: openSet, toggle, allowMultiple, variant }),
|
|
1258
1460
|
[openSet, toggle, allowMultiple, variant]
|
|
1259
1461
|
);
|
|
1260
|
-
const containerStyle =
|
|
1261
|
-
const base = variant === "boxed" ? [
|
|
1462
|
+
const containerStyle = React10.useMemo(() => {
|
|
1463
|
+
const base = variant === "boxed" ? [styles13.container, styles13.boxed] : [styles13.container];
|
|
1262
1464
|
if (style === void 0) return base;
|
|
1263
1465
|
return [...base, ...Array.isArray(style) ? style : [style]];
|
|
1264
1466
|
}, [style, variant]);
|
|
@@ -1268,7 +1470,7 @@ var HEADER_PADDING_H = 16;
|
|
|
1268
1470
|
var HEADER_PADDING_V = 12;
|
|
1269
1471
|
var BODY_PADDING_H = 16;
|
|
1270
1472
|
var BODY_PADDING_V = 12;
|
|
1271
|
-
var
|
|
1473
|
+
var HEADER_GAP2 = 8;
|
|
1272
1474
|
var TITLE_FONT_SIZE2 = 15;
|
|
1273
1475
|
var TITLE_FONT_WEIGHT = "600";
|
|
1274
1476
|
var CHEVRON_SIZE = 18;
|
|
@@ -1290,7 +1492,7 @@ var BOX_TITLE_FONT_SIZE = 14;
|
|
|
1290
1492
|
var BOX_MARKER_FONT_SIZE = 13;
|
|
1291
1493
|
var BOX_MARKER_GAP = 6;
|
|
1292
1494
|
var BOX_MARKER = "\u25B8";
|
|
1293
|
-
var
|
|
1495
|
+
var styles14 = reactNative.StyleSheet.create({
|
|
1294
1496
|
item: { borderTopWidth: reactNative.StyleSheet.hairlineWidth },
|
|
1295
1497
|
boxItem: { borderWidth: 1, borderRadius: BOX_BORDER_RADIUS, paddingHorizontal: BOX_PADDING_H },
|
|
1296
1498
|
header: {
|
|
@@ -1303,10 +1505,10 @@ var styles12 = reactNative.StyleSheet.create({
|
|
|
1303
1505
|
boxHeader: { paddingHorizontal: 0, paddingVertical: BOX_HEADER_PADDING_V },
|
|
1304
1506
|
headerLeft: { flexShrink: 1, flexGrow: 1 },
|
|
1305
1507
|
headerLeftRow: { flexDirection: "row", alignItems: "center" },
|
|
1306
|
-
headerRight: { flexDirection: "row", alignItems: "center", marginLeft:
|
|
1508
|
+
headerRight: { flexDirection: "row", alignItems: "center", marginLeft: HEADER_GAP2 },
|
|
1307
1509
|
title: { fontSize: TITLE_FONT_SIZE2, fontWeight: TITLE_FONT_WEIGHT },
|
|
1308
1510
|
boxTitle: { fontSize: BOX_TITLE_FONT_SIZE, fontWeight: TITLE_FONT_WEIGHT },
|
|
1309
|
-
chevron: { marginLeft:
|
|
1511
|
+
chevron: { marginLeft: HEADER_GAP2 },
|
|
1310
1512
|
marker: { marginRight: BOX_MARKER_GAP },
|
|
1311
1513
|
markerText: { fontSize: BOX_MARKER_FONT_SIZE, fontWeight: TITLE_FONT_WEIGHT },
|
|
1312
1514
|
body: { paddingHorizontal: BODY_PADDING_H, paddingBottom: BODY_PADDING_V },
|
|
@@ -1334,9 +1536,9 @@ var AccordionItem = ({
|
|
|
1334
1536
|
const headerTestID = testID ?? `accordion-item-${id}`;
|
|
1335
1537
|
const bodyTestID = `${headerTestID}-body`;
|
|
1336
1538
|
const chevronTestID = `${headerTestID}-chevron`;
|
|
1337
|
-
const [rotation] =
|
|
1539
|
+
const [rotation] = React10.useState(() => new reactNative.Animated.Value(expanded ? ROTATE_EXPANDED : ROTATE_COLLAPSED));
|
|
1338
1540
|
const reducedMotion = rnWebHooks.useReducedMotion();
|
|
1339
|
-
|
|
1541
|
+
React10.useEffect(() => {
|
|
1340
1542
|
reactNative.Animated.timing(rotation, {
|
|
1341
1543
|
toValue: expanded ? ROTATE_EXPANDED : ROTATE_COLLAPSED,
|
|
1342
1544
|
duration: reducedMotion ? INSTANT_DURATION_MS : ROTATE_DURATION_MS,
|
|
@@ -1348,10 +1550,10 @@ var AccordionItem = ({
|
|
|
1348
1550
|
inputRange: [ROTATE_COLLAPSED, ROTATE_EXPANDED],
|
|
1349
1551
|
outputRange: [COLLAPSED_DEG, boxed ? BOXED_EXPANDED_DEG : PLAIN_EXPANDED_DEG]
|
|
1350
1552
|
});
|
|
1351
|
-
const handlePress =
|
|
1553
|
+
const handlePress = React10.useCallback(() => {
|
|
1352
1554
|
if (!disabled) toggle(id);
|
|
1353
1555
|
}, [disabled, id, toggle]);
|
|
1354
|
-
const handleKeyDown2 =
|
|
1556
|
+
const handleKeyDown2 = React10.useCallback(
|
|
1355
1557
|
(event) => {
|
|
1356
1558
|
if (disabled) return;
|
|
1357
1559
|
const key = event.key ?? "";
|
|
@@ -1363,20 +1565,20 @@ var AccordionItem = ({
|
|
|
1363
1565
|
[disabled, id, toggle]
|
|
1364
1566
|
);
|
|
1365
1567
|
const keyboardProps = reactNative.Platform.OS === "web" ? { onKeyDown: handleKeyDown2 } : {};
|
|
1366
|
-
const itemStyle =
|
|
1367
|
-
() => boxed ? [
|
|
1568
|
+
const itemStyle = React10.useMemo(
|
|
1569
|
+
() => boxed ? [styles14.boxItem, { borderColor: colors.border }] : [styles14.item, { borderTopColor: colors.border }],
|
|
1368
1570
|
[boxed, colors.border]
|
|
1369
1571
|
);
|
|
1370
|
-
const headerStyle =
|
|
1572
|
+
const headerStyle = React10.useMemo(
|
|
1371
1573
|
() => [
|
|
1372
|
-
|
|
1373
|
-
...boxed ? [
|
|
1574
|
+
styles14.header,
|
|
1575
|
+
...boxed ? [styles14.boxHeader] : [],
|
|
1374
1576
|
{ opacity: disabled ? DISABLED_OPACITY : FULL_OPACITY }
|
|
1375
1577
|
],
|
|
1376
1578
|
[boxed, disabled]
|
|
1377
1579
|
);
|
|
1378
1580
|
const resolvedLabel = accessibilityLabel ?? (typeof title === "string" ? title : void 0);
|
|
1379
|
-
const titleNode = typeof title === "string" ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [boxed ?
|
|
1581
|
+
const titleNode = typeof title === "string" ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [boxed ? styles14.boxTitle : styles14.title, { color: boxed ? colors.textSecondary : colors.text }], children: title }) : title;
|
|
1380
1582
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: itemStyle, children: [
|
|
1381
1583
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1382
1584
|
reactNative.Pressable,
|
|
@@ -1393,7 +1595,7 @@ var AccordionItem = ({
|
|
|
1393
1595
|
onPress: handlePress,
|
|
1394
1596
|
...keyboardProps,
|
|
1395
1597
|
children: [
|
|
1396
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [
|
|
1598
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles14.headerLeft, boxed ? styles14.headerLeftRow : null], children: [
|
|
1397
1599
|
boxed ? (
|
|
1398
1600
|
// Decorative — the open/closed state is already conveyed by aria-expanded on the header.
|
|
1399
1601
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1402,15 +1604,15 @@ var AccordionItem = ({
|
|
|
1402
1604
|
accessibilityElementsHidden: true,
|
|
1403
1605
|
"aria-hidden": true,
|
|
1404
1606
|
importantForAccessibility: "no-hide-descendants",
|
|
1405
|
-
style: [
|
|
1607
|
+
style: [styles14.marker, { transform: [{ rotate }] }],
|
|
1406
1608
|
testID: chevronTestID,
|
|
1407
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1609
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles14.markerText, { color: colors.textSecondary }], children: BOX_MARKER })
|
|
1408
1610
|
}
|
|
1409
1611
|
)
|
|
1410
1612
|
) : null,
|
|
1411
1613
|
titleNode
|
|
1412
1614
|
] }),
|
|
1413
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
1615
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles14.headerRight, children: [
|
|
1414
1616
|
right,
|
|
1415
1617
|
boxed ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1416
1618
|
reactNative.Animated.View,
|
|
@@ -1418,7 +1620,7 @@ var AccordionItem = ({
|
|
|
1418
1620
|
accessibilityElementsHidden: true,
|
|
1419
1621
|
"aria-hidden": true,
|
|
1420
1622
|
importantForAccessibility: "no-hide-descendants",
|
|
1421
|
-
style: [
|
|
1623
|
+
style: [styles14.chevron, { transform: [{ rotate }] }],
|
|
1422
1624
|
children: /* @__PURE__ */ jsxRuntime.jsx(uiIcons.SvgIcon, { color: colors.textSecondary, name: "chevronDown", size: CHEVRON_SIZE, testID: chevronTestID })
|
|
1423
1625
|
}
|
|
1424
1626
|
)
|
|
@@ -1432,7 +1634,7 @@ var AccordionItem = ({
|
|
|
1432
1634
|
accessibilityLabel: resolvedLabel,
|
|
1433
1635
|
nativeID: bodyTestID,
|
|
1434
1636
|
role: ROLE_REGION,
|
|
1435
|
-
style: boxed ?
|
|
1637
|
+
style: boxed ? styles14.boxBody : styles14.body,
|
|
1436
1638
|
testID: bodyTestID,
|
|
1437
1639
|
children
|
|
1438
1640
|
}
|
|
@@ -1470,14 +1672,14 @@ function measureParentInnerWidth(node) {
|
|
|
1470
1672
|
return Math.max(UNMEASURED, parent.clientWidth - padding);
|
|
1471
1673
|
}
|
|
1472
1674
|
function useAvailableWidth() {
|
|
1473
|
-
const [width, setWidth] =
|
|
1474
|
-
const nodeRef =
|
|
1475
|
-
const measureRef =
|
|
1675
|
+
const [width, setWidth] = React10.useState(UNMEASURED);
|
|
1676
|
+
const nodeRef = React10.useRef(null);
|
|
1677
|
+
const measureRef = React10.useCallback((node) => {
|
|
1476
1678
|
if (!IS_WEB3) return;
|
|
1477
1679
|
nodeRef.current = node;
|
|
1478
1680
|
if (nodeRef.current !== null) setWidth(measureParentInnerWidth(nodeRef.current));
|
|
1479
1681
|
}, []);
|
|
1480
|
-
|
|
1682
|
+
React10.useEffect(() => {
|
|
1481
1683
|
if (!IS_WEB3) return void 0;
|
|
1482
1684
|
const remeasure = () => {
|
|
1483
1685
|
const node = nodeRef.current;
|
|
@@ -1486,7 +1688,7 @@ function useAvailableWidth() {
|
|
|
1486
1688
|
window.addEventListener("resize", remeasure);
|
|
1487
1689
|
return () => window.removeEventListener("resize", remeasure);
|
|
1488
1690
|
}, []);
|
|
1489
|
-
const onLayout =
|
|
1691
|
+
const onLayout = React10.useCallback((event) => {
|
|
1490
1692
|
if (IS_WEB3) return;
|
|
1491
1693
|
setWidth(event.nativeEvent.layout.width);
|
|
1492
1694
|
}, []);
|
|
@@ -1495,7 +1697,7 @@ function useAvailableWidth() {
|
|
|
1495
1697
|
var AVG_CHAR_WIDTH_RATIO = 0.58;
|
|
1496
1698
|
var DEFAULT_FONT_SIZE2 = 13;
|
|
1497
1699
|
var UNMEASURED2 = 0;
|
|
1498
|
-
var
|
|
1700
|
+
var styles15 = reactNative.StyleSheet.create({
|
|
1499
1701
|
base: { fontSize: DEFAULT_FONT_SIZE2 },
|
|
1500
1702
|
/** `minWidth: 0` lets the text shrink inside a flex row instead of forcing the row wider. */
|
|
1501
1703
|
fill: { flexShrink: 1, minWidth: 0 }
|
|
@@ -1515,8 +1717,8 @@ var TruncatedText = ({
|
|
|
1515
1717
|
accessibilityHint
|
|
1516
1718
|
}) => {
|
|
1517
1719
|
const { width, measureRef, onLayout } = useAvailableWidth();
|
|
1518
|
-
const hostRef =
|
|
1519
|
-
const attachRef =
|
|
1720
|
+
const hostRef = React10.useRef(null);
|
|
1721
|
+
const attachRef = React10.useCallback(
|
|
1520
1722
|
(node) => {
|
|
1521
1723
|
hostRef.current = node;
|
|
1522
1724
|
measureRef(node);
|
|
@@ -1525,12 +1727,12 @@ var TruncatedText = ({
|
|
|
1525
1727
|
},
|
|
1526
1728
|
[value, measureRef]
|
|
1527
1729
|
);
|
|
1528
|
-
const flatStyle =
|
|
1529
|
-
() => reactNative.StyleSheet.flatten([
|
|
1730
|
+
const flatStyle = React10.useMemo(
|
|
1731
|
+
() => reactNative.StyleSheet.flatten([styles15.base, style]),
|
|
1530
1732
|
[style]
|
|
1531
1733
|
);
|
|
1532
1734
|
const fontSize = flatStyle.fontSize ?? DEFAULT_FONT_SIZE2;
|
|
1533
|
-
const display =
|
|
1735
|
+
const display = React10.useMemo(() => {
|
|
1534
1736
|
const source = isUrl ? formatUrlForDisplay(value) : value;
|
|
1535
1737
|
const budget = charBudget(width, fontSize);
|
|
1536
1738
|
return budget === UNMEASURED2 ? source : truncateMiddle(source, budget);
|
|
@@ -1541,7 +1743,7 @@ var TruncatedText = ({
|
|
|
1541
1743
|
ref: attachRef,
|
|
1542
1744
|
onLayout,
|
|
1543
1745
|
numberOfLines: 1,
|
|
1544
|
-
style: [
|
|
1746
|
+
style: [styles15.base, styles15.fill, style],
|
|
1545
1747
|
testID,
|
|
1546
1748
|
accessibilityRole: onPress !== void 0 || href !== void 0 ? "link" : "text",
|
|
1547
1749
|
accessibilityLabel,
|
|
@@ -1612,17 +1814,17 @@ async function copyText(value, writer) {
|
|
|
1612
1814
|
// src/CopyableId/useCopyToClipboard.ts
|
|
1613
1815
|
var COPY_FEEDBACK_MS = 2e3;
|
|
1614
1816
|
function useCopyToClipboard(value, writer) {
|
|
1615
|
-
const [status, setStatus] =
|
|
1616
|
-
const timerRef =
|
|
1617
|
-
const mountedRef =
|
|
1618
|
-
|
|
1817
|
+
const [status, setStatus] = React10.useState("idle" /* Idle */);
|
|
1818
|
+
const timerRef = React10.useRef(null);
|
|
1819
|
+
const mountedRef = React10.useRef(true);
|
|
1820
|
+
React10.useEffect(() => {
|
|
1619
1821
|
mountedRef.current = true;
|
|
1620
1822
|
return () => {
|
|
1621
1823
|
mountedRef.current = false;
|
|
1622
1824
|
if (timerRef.current !== null) clearTimeout(timerRef.current);
|
|
1623
1825
|
};
|
|
1624
1826
|
}, []);
|
|
1625
|
-
const copy =
|
|
1827
|
+
const copy = React10.useCallback(() => {
|
|
1626
1828
|
void (async () => {
|
|
1627
1829
|
const ok = await copyText(value, writer);
|
|
1628
1830
|
if (!mountedRef.current) return;
|
|
@@ -1644,7 +1846,7 @@ var LABEL_LETTER_SPACING = 0.4;
|
|
|
1644
1846
|
var ACTION_PADDING_H = 6;
|
|
1645
1847
|
var ACTION_PADDING_V = 2;
|
|
1646
1848
|
var ACTION_RADIUS = 6;
|
|
1647
|
-
var
|
|
1849
|
+
var styles16 = reactNative.StyleSheet.create({
|
|
1648
1850
|
cell: { gap: CELL_GAP },
|
|
1649
1851
|
label: {
|
|
1650
1852
|
fontSize: LABEL_FONT_SIZE,
|
|
@@ -1680,7 +1882,7 @@ var styles14 = reactNative.StyleSheet.create({
|
|
|
1680
1882
|
var TONE_STEP = "500";
|
|
1681
1883
|
function useActionState(status) {
|
|
1682
1884
|
const { theme } = uiFeedback.useUi();
|
|
1683
|
-
return
|
|
1885
|
+
return React10.useMemo(() => {
|
|
1684
1886
|
const primary = theme.palette.primary[TONE_STEP];
|
|
1685
1887
|
if (status === "copied" /* Copied */) {
|
|
1686
1888
|
return { key: LAYOUT_I18N.copied, color: theme.semantic.success?.[TONE_STEP] ?? primary };
|
|
@@ -1703,14 +1905,14 @@ var CopyableId = ({
|
|
|
1703
1905
|
const { colors } = theme;
|
|
1704
1906
|
const { status, copy } = useCopyToClipboard(value, writer);
|
|
1705
1907
|
const action = useActionState(status);
|
|
1706
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [
|
|
1707
|
-
label !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1708
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
1709
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style:
|
|
1908
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles16.cell, style], testID, children: [
|
|
1909
|
+
label !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles16.label, { color: colors.textSecondary }], children: label }),
|
|
1910
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles16.row, children: [
|
|
1911
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles16.valueWrap, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1710
1912
|
TruncatedText,
|
|
1711
1913
|
{
|
|
1712
1914
|
value,
|
|
1713
|
-
style: [
|
|
1915
|
+
style: [styles16.value, { color: colors.text }],
|
|
1714
1916
|
testID: `${testID}-value`,
|
|
1715
1917
|
accessibilityLabel: accessibilityLabel ?? value,
|
|
1716
1918
|
accessibilityHint: t(LAYOUT_I18N.copyableIdHint)
|
|
@@ -1724,7 +1926,7 @@ var CopyableId = ({
|
|
|
1724
1926
|
accessibilityLabel: t(action.key),
|
|
1725
1927
|
accessibilityHint: t(LAYOUT_I18N.copyHint),
|
|
1726
1928
|
testID: `${testID}-copy`,
|
|
1727
|
-
style: [
|
|
1929
|
+
style: [styles16.action, { color: action.color }],
|
|
1728
1930
|
children: t(action.key)
|
|
1729
1931
|
}
|
|
1730
1932
|
)
|
|
@@ -1735,6 +1937,7 @@ var CopyableId = ({
|
|
|
1735
1937
|
exports.Accordion = Accordion;
|
|
1736
1938
|
exports.AccordionItem = AccordionItem;
|
|
1737
1939
|
exports.COPY_FEEDBACK_MS = COPY_FEEDBACK_MS;
|
|
1940
|
+
exports.ConfirmDialog = ConfirmDialog;
|
|
1738
1941
|
exports.CopyStatus = CopyStatus;
|
|
1739
1942
|
exports.CopyableId = CopyableId;
|
|
1740
1943
|
exports.DEFAULT_BILLING_ROUTE = DEFAULT_BILLING_ROUTE;
|
|
@@ -1743,6 +1946,7 @@ exports.ELLIPSIS = ELLIPSIS;
|
|
|
1743
1946
|
exports.Heading = Heading;
|
|
1744
1947
|
exports.LAYOUT_I18N = LAYOUT_I18N;
|
|
1745
1948
|
exports.LAYOUT_TEST_IDS = LAYOUT_TEST_IDS;
|
|
1949
|
+
exports.Modal = Modal3;
|
|
1746
1950
|
exports.ModalDropdown = ModalDropdown;
|
|
1747
1951
|
exports.ModalShell = ModalShell;
|
|
1748
1952
|
exports.Section = Section;
|