@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.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React10, { createContext, useMemo, useRef, useEffect, useState, useCallback, useContext, useLayoutEffect } from 'react';
|
|
2
2
|
import { StyleSheet, Platform, View, Text, Pressable, TouchableOpacity, Modal, FlatList, ScrollView, Animated, Easing, useWindowDimensions, LayoutAnimation, UIManager } from 'react-native';
|
|
3
3
|
import { MODAL_OVERLAY_COLOR, useUi } from '@dloizides/ui-feedback';
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
import { useA11y } from '@dloizides/a11y';
|
|
6
6
|
import { createPortal } from 'react-dom';
|
|
7
7
|
import { SvgIcon } from '@dloizides/ui-icons';
|
|
8
|
+
import { IconButton, Button } from '@dloizides/ui-buttons';
|
|
8
9
|
import { useReducedMotion, prefersReducedMotion } from '@dloizides/rn-web-hooks';
|
|
9
10
|
|
|
10
11
|
// src/Section/Section.tsx
|
|
@@ -17,7 +18,7 @@ var styles = StyleSheet.create({
|
|
|
17
18
|
});
|
|
18
19
|
var Section = ({ children, style }) => {
|
|
19
20
|
const { theme } = useUi();
|
|
20
|
-
const containerStyle =
|
|
21
|
+
const containerStyle = React10.useMemo(
|
|
21
22
|
() => [styles.card, { borderColor: theme.colors.border, backgroundColor: theme.colors.surface }, style],
|
|
22
23
|
[theme.colors.border, theme.colors.surface, style]
|
|
23
24
|
);
|
|
@@ -33,6 +34,10 @@ var LAYOUT_TEST_IDS = {
|
|
|
33
34
|
upgradePromptDismiss: "upgrade-prompt-dismiss",
|
|
34
35
|
modalShell: "template-modal",
|
|
35
36
|
modalShellClose: "cancel-button",
|
|
37
|
+
/** Default base testID for the centered `Modal`; ✕ is `modal-close`, backdrop `modal-backdrop`. */
|
|
38
|
+
modal: "modal",
|
|
39
|
+
/** Default base testID for `ConfirmDialog`; Confirm/Cancel are `confirm-dialog-{confirm,cancel}`. */
|
|
40
|
+
confirmDialog: "confirm-dialog",
|
|
36
41
|
accordion: "accordion"
|
|
37
42
|
};
|
|
38
43
|
var DEFAULT_BILLING_ROUTE = "/settings/billing";
|
|
@@ -61,6 +66,14 @@ var LAYOUT_I18N = {
|
|
|
61
66
|
close: "quizTemplates.cancel",
|
|
62
67
|
/** `ModalShell`: heading fallback when no title is supplied. */
|
|
63
68
|
closeHeading: "close",
|
|
69
|
+
/** `Modal`: accessible name + web tooltip of the top-right ✕ close button. */
|
|
70
|
+
dialogClose: "common.close",
|
|
71
|
+
/** `ConfirmDialog`: default Confirm button label (overridable via `confirmLabel`) + its hint. */
|
|
72
|
+
confirm: "common.confirm",
|
|
73
|
+
confirmHint: "common.confirmHint",
|
|
74
|
+
/** `ConfirmDialog`: default Cancel button label (overridable via `cancelLabel`) + its hint. */
|
|
75
|
+
cancel: "common.cancel",
|
|
76
|
+
cancelHint: "common.cancelHint",
|
|
64
77
|
upgradePromptTitle: "settings.billing.upgradePrompt.title",
|
|
65
78
|
/** Body copy, parameterised: "…requires {{p1}}, you are on {{p2}}." */
|
|
66
79
|
upgradePromptMessage: "settings.billing.upgradePrompt.message",
|
|
@@ -96,7 +109,7 @@ var Heading = ({
|
|
|
96
109
|
testID
|
|
97
110
|
}) => {
|
|
98
111
|
const { theme } = useUi();
|
|
99
|
-
const headingStyle =
|
|
112
|
+
const headingStyle = React10.useMemo(
|
|
100
113
|
() => [styles2.heading, { color: theme.colors.text }, style],
|
|
101
114
|
[theme.colors.text, style]
|
|
102
115
|
);
|
|
@@ -1122,7 +1135,7 @@ var ModalShell = ({
|
|
|
1122
1135
|
showClose = true
|
|
1123
1136
|
}) => {
|
|
1124
1137
|
const { theme, t } = useUi();
|
|
1125
|
-
const containerStyle =
|
|
1138
|
+
const containerStyle = React10.useMemo(
|
|
1126
1139
|
() => [styles10.container, { backgroundColor: theme.colors.background }, contentStyle],
|
|
1127
1140
|
[theme.colors.background, contentStyle]
|
|
1128
1141
|
);
|
|
@@ -1165,6 +1178,195 @@ var ModalShell = ({
|
|
|
1165
1178
|
}
|
|
1166
1179
|
);
|
|
1167
1180
|
};
|
|
1181
|
+
function useEscapeKey(enabled, onClose) {
|
|
1182
|
+
useEffect(() => {
|
|
1183
|
+
if (Platform.OS !== "web" || !enabled) return;
|
|
1184
|
+
const onKeyDown = (event) => {
|
|
1185
|
+
if (event.key === "Escape") onClose();
|
|
1186
|
+
};
|
|
1187
|
+
document.addEventListener("keydown", onKeyDown);
|
|
1188
|
+
return () => {
|
|
1189
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
1190
|
+
};
|
|
1191
|
+
}, [enabled, onClose]);
|
|
1192
|
+
}
|
|
1193
|
+
function useScrollLock(enabled) {
|
|
1194
|
+
useEffect(() => {
|
|
1195
|
+
if (Platform.OS !== "web" || !enabled) return;
|
|
1196
|
+
const { body } = document;
|
|
1197
|
+
const previousOverflow = body.style.overflow;
|
|
1198
|
+
body.style.overflow = "hidden";
|
|
1199
|
+
return () => {
|
|
1200
|
+
body.style.overflow = previousOverflow;
|
|
1201
|
+
};
|
|
1202
|
+
}, [enabled]);
|
|
1203
|
+
}
|
|
1204
|
+
var OVERLAY_PADDING = 16;
|
|
1205
|
+
var DIALOG_RADIUS = 12;
|
|
1206
|
+
var DIALOG_PADDING = 16;
|
|
1207
|
+
var HEADER_GAP = 12;
|
|
1208
|
+
var FOOTER_MARGIN = 16;
|
|
1209
|
+
var HEADER_MARGIN = 12;
|
|
1210
|
+
var DIALOG_MAX_HEIGHT = "90%";
|
|
1211
|
+
var SIZE_MAX_WIDTH = { sm: 360, md: 480, lg: 640 };
|
|
1212
|
+
var styles11 = StyleSheet.create({
|
|
1213
|
+
overlay: {
|
|
1214
|
+
flex: 1,
|
|
1215
|
+
justifyContent: "center",
|
|
1216
|
+
alignItems: "center",
|
|
1217
|
+
padding: OVERLAY_PADDING,
|
|
1218
|
+
backgroundColor: MODAL_OVERLAY_COLOR
|
|
1219
|
+
},
|
|
1220
|
+
dialog: {
|
|
1221
|
+
width: "100%",
|
|
1222
|
+
borderRadius: DIALOG_RADIUS,
|
|
1223
|
+
padding: DIALOG_PADDING,
|
|
1224
|
+
maxHeight: DIALOG_MAX_HEIGHT
|
|
1225
|
+
},
|
|
1226
|
+
headerRow: {
|
|
1227
|
+
flexDirection: "row",
|
|
1228
|
+
alignItems: "flex-start",
|
|
1229
|
+
justifyContent: "space-between",
|
|
1230
|
+
columnGap: HEADER_GAP,
|
|
1231
|
+
marginBottom: HEADER_MARGIN
|
|
1232
|
+
},
|
|
1233
|
+
// Occupies the header's leading space so the ✕ pins to the trailing edge even without a title.
|
|
1234
|
+
titleWrap: { flex: 1 },
|
|
1235
|
+
footer: { marginTop: FOOTER_MARGIN }
|
|
1236
|
+
});
|
|
1237
|
+
var Modal3 = ({
|
|
1238
|
+
visible,
|
|
1239
|
+
onClose,
|
|
1240
|
+
title,
|
|
1241
|
+
children,
|
|
1242
|
+
footer,
|
|
1243
|
+
size = "md",
|
|
1244
|
+
showClose = true,
|
|
1245
|
+
testID = LAYOUT_TEST_IDS.modal,
|
|
1246
|
+
accessibilityLabel
|
|
1247
|
+
}) => {
|
|
1248
|
+
const { theme, t } = useUi();
|
|
1249
|
+
const dialogRef = useRef(null);
|
|
1250
|
+
useFocusTrap(dialogRef, visible);
|
|
1251
|
+
useEscapeKey(visible, onClose);
|
|
1252
|
+
useScrollLock(visible);
|
|
1253
|
+
const accessibleName = accessibilityLabel ?? title ?? t(LAYOUT_I18N.dialog);
|
|
1254
|
+
const closeLabel = t(LAYOUT_I18N.dialogClose);
|
|
1255
|
+
const dialogStyle = useMemo(
|
|
1256
|
+
() => [styles11.dialog, { backgroundColor: theme.colors.surface, maxWidth: SIZE_MAX_WIDTH[size] }],
|
|
1257
|
+
[theme.colors.surface, size]
|
|
1258
|
+
);
|
|
1259
|
+
const hasHeader = title !== void 0 || showClose;
|
|
1260
|
+
return /* @__PURE__ */ jsx(Modal, { transparent: true, animationType: "fade", visible, onRequestClose: onClose, children: /* @__PURE__ */ jsxs(View, { style: styles11.overlay, children: [
|
|
1261
|
+
/* @__PURE__ */ jsx(
|
|
1262
|
+
TouchableOpacity,
|
|
1263
|
+
{
|
|
1264
|
+
accessible: true,
|
|
1265
|
+
accessibilityHint: t(LAYOUT_I18N.dismissDropdownHint),
|
|
1266
|
+
accessibilityLabel: t(LAYOUT_I18N.dismissDropdown),
|
|
1267
|
+
accessibilityRole: "button",
|
|
1268
|
+
activeOpacity: 1,
|
|
1269
|
+
style: StyleSheet.absoluteFill,
|
|
1270
|
+
testID: `${testID}-backdrop`,
|
|
1271
|
+
onPress: onClose
|
|
1272
|
+
}
|
|
1273
|
+
),
|
|
1274
|
+
/* @__PURE__ */ jsxs(
|
|
1275
|
+
View,
|
|
1276
|
+
{
|
|
1277
|
+
ref: dialogRef,
|
|
1278
|
+
accessibilityViewIsModal: true,
|
|
1279
|
+
"aria-label": accessibleName,
|
|
1280
|
+
role: "dialog",
|
|
1281
|
+
style: dialogStyle,
|
|
1282
|
+
testID,
|
|
1283
|
+
children: [
|
|
1284
|
+
hasHeader ? /* @__PURE__ */ jsxs(View, { style: styles11.headerRow, children: [
|
|
1285
|
+
/* @__PURE__ */ jsx(View, { style: styles11.titleWrap, children: title !== void 0 ? /* @__PURE__ */ jsx(Heading, { children: title }) : null }),
|
|
1286
|
+
showClose ? /* @__PURE__ */ jsx(
|
|
1287
|
+
IconButton,
|
|
1288
|
+
{
|
|
1289
|
+
accessibilityHint: t(LAYOUT_I18N.closeDialogHint),
|
|
1290
|
+
accessibilityLabel: closeLabel,
|
|
1291
|
+
appearance: "ghost",
|
|
1292
|
+
renderIcon: (color, iconSize) => /* @__PURE__ */ jsx(SvgIcon, { color, name: "close", size: iconSize }),
|
|
1293
|
+
size: "md",
|
|
1294
|
+
testID: `${testID}-close`,
|
|
1295
|
+
tooltip: closeLabel,
|
|
1296
|
+
variant: "ghost",
|
|
1297
|
+
onPress: onClose
|
|
1298
|
+
}
|
|
1299
|
+
) : null
|
|
1300
|
+
] }) : null,
|
|
1301
|
+
/* @__PURE__ */ jsx(ScrollView, { children }),
|
|
1302
|
+
footer !== void 0 ? /* @__PURE__ */ jsx(View, { style: styles11.footer, children: footer }) : null
|
|
1303
|
+
]
|
|
1304
|
+
}
|
|
1305
|
+
)
|
|
1306
|
+
] }) });
|
|
1307
|
+
};
|
|
1308
|
+
var MESSAGE_FONT_SIZE2 = 14;
|
|
1309
|
+
var MESSAGE_LINE_HEIGHT = 20;
|
|
1310
|
+
var BUTTON_GAP = 12;
|
|
1311
|
+
var styles12 = StyleSheet.create({
|
|
1312
|
+
message: { fontSize: MESSAGE_FONT_SIZE2, lineHeight: MESSAGE_LINE_HEIGHT },
|
|
1313
|
+
footer: { flexDirection: "row", justifyContent: "flex-end", columnGap: BUTTON_GAP }
|
|
1314
|
+
});
|
|
1315
|
+
var ConfirmDialog = ({
|
|
1316
|
+
visible,
|
|
1317
|
+
title,
|
|
1318
|
+
message,
|
|
1319
|
+
confirmLabel,
|
|
1320
|
+
cancelLabel,
|
|
1321
|
+
destructive = false,
|
|
1322
|
+
onConfirm,
|
|
1323
|
+
onCancel,
|
|
1324
|
+
busy = false,
|
|
1325
|
+
testID = LAYOUT_TEST_IDS.confirmDialog
|
|
1326
|
+
}) => {
|
|
1327
|
+
const { theme, t } = useUi();
|
|
1328
|
+
const resolvedConfirm = confirmLabel ?? t(LAYOUT_I18N.confirm);
|
|
1329
|
+
const resolvedCancel = cancelLabel ?? t(LAYOUT_I18N.cancel);
|
|
1330
|
+
const footer = /* @__PURE__ */ jsxs(View, { style: styles12.footer, children: [
|
|
1331
|
+
/* @__PURE__ */ jsx(
|
|
1332
|
+
Button,
|
|
1333
|
+
{
|
|
1334
|
+
accessibilityHint: t(LAYOUT_I18N.cancelHint),
|
|
1335
|
+
accessibilityLabel: resolvedCancel,
|
|
1336
|
+
disabled: busy,
|
|
1337
|
+
label: resolvedCancel,
|
|
1338
|
+
testID: `${testID}-cancel`,
|
|
1339
|
+
variant: "secondary",
|
|
1340
|
+
onPress: onCancel
|
|
1341
|
+
}
|
|
1342
|
+
),
|
|
1343
|
+
/* @__PURE__ */ jsx(
|
|
1344
|
+
Button,
|
|
1345
|
+
{
|
|
1346
|
+
accessibilityHint: t(LAYOUT_I18N.confirmHint),
|
|
1347
|
+
accessibilityLabel: resolvedConfirm,
|
|
1348
|
+
label: resolvedConfirm,
|
|
1349
|
+
loading: busy,
|
|
1350
|
+
testID: `${testID}-confirm`,
|
|
1351
|
+
variant: destructive ? "danger" : "primary",
|
|
1352
|
+
onPress: onConfirm
|
|
1353
|
+
}
|
|
1354
|
+
)
|
|
1355
|
+
] });
|
|
1356
|
+
return /* @__PURE__ */ jsx(
|
|
1357
|
+
Modal3,
|
|
1358
|
+
{
|
|
1359
|
+
footer,
|
|
1360
|
+
showClose: false,
|
|
1361
|
+
size: "sm",
|
|
1362
|
+
testID,
|
|
1363
|
+
title,
|
|
1364
|
+
visible,
|
|
1365
|
+
onClose: onCancel,
|
|
1366
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles12.message, { color: theme.colors.text }], testID: `${testID}-message`, children: message })
|
|
1367
|
+
}
|
|
1368
|
+
);
|
|
1369
|
+
};
|
|
1168
1370
|
var AccordionContext = createContext(null);
|
|
1169
1371
|
function useAccordionContext() {
|
|
1170
1372
|
const value = useContext(AccordionContext);
|
|
@@ -1194,14 +1396,14 @@ function animateNextLayout() {
|
|
|
1194
1396
|
}
|
|
1195
1397
|
}
|
|
1196
1398
|
var BOXED_GAP = 12;
|
|
1197
|
-
var
|
|
1399
|
+
var styles13 = StyleSheet.create({
|
|
1198
1400
|
container: { alignSelf: "stretch" },
|
|
1199
1401
|
boxed: { gap: BOXED_GAP }
|
|
1200
1402
|
});
|
|
1201
1403
|
function computeInitialOpen(children, defaultOpenIds, allowMultiple) {
|
|
1202
1404
|
const ids = new Set(defaultOpenIds ?? []);
|
|
1203
|
-
|
|
1204
|
-
if (!
|
|
1405
|
+
React10.Children.forEach(children, (child) => {
|
|
1406
|
+
if (!React10.isValidElement(child)) return;
|
|
1205
1407
|
const props = child.props;
|
|
1206
1408
|
if (props.defaultOpen === true && typeof props.id === "string") {
|
|
1207
1409
|
ids.add(props.id);
|
|
@@ -1252,7 +1454,7 @@ var Accordion = ({
|
|
|
1252
1454
|
[openSet, toggle, allowMultiple, variant]
|
|
1253
1455
|
);
|
|
1254
1456
|
const containerStyle = useMemo(() => {
|
|
1255
|
-
const base = variant === "boxed" ? [
|
|
1457
|
+
const base = variant === "boxed" ? [styles13.container, styles13.boxed] : [styles13.container];
|
|
1256
1458
|
if (style === void 0) return base;
|
|
1257
1459
|
return [...base, ...Array.isArray(style) ? style : [style]];
|
|
1258
1460
|
}, [style, variant]);
|
|
@@ -1262,7 +1464,7 @@ var HEADER_PADDING_H = 16;
|
|
|
1262
1464
|
var HEADER_PADDING_V = 12;
|
|
1263
1465
|
var BODY_PADDING_H = 16;
|
|
1264
1466
|
var BODY_PADDING_V = 12;
|
|
1265
|
-
var
|
|
1467
|
+
var HEADER_GAP2 = 8;
|
|
1266
1468
|
var TITLE_FONT_SIZE2 = 15;
|
|
1267
1469
|
var TITLE_FONT_WEIGHT = "600";
|
|
1268
1470
|
var CHEVRON_SIZE = 18;
|
|
@@ -1284,7 +1486,7 @@ var BOX_TITLE_FONT_SIZE = 14;
|
|
|
1284
1486
|
var BOX_MARKER_FONT_SIZE = 13;
|
|
1285
1487
|
var BOX_MARKER_GAP = 6;
|
|
1286
1488
|
var BOX_MARKER = "\u25B8";
|
|
1287
|
-
var
|
|
1489
|
+
var styles14 = StyleSheet.create({
|
|
1288
1490
|
item: { borderTopWidth: StyleSheet.hairlineWidth },
|
|
1289
1491
|
boxItem: { borderWidth: 1, borderRadius: BOX_BORDER_RADIUS, paddingHorizontal: BOX_PADDING_H },
|
|
1290
1492
|
header: {
|
|
@@ -1297,10 +1499,10 @@ var styles12 = StyleSheet.create({
|
|
|
1297
1499
|
boxHeader: { paddingHorizontal: 0, paddingVertical: BOX_HEADER_PADDING_V },
|
|
1298
1500
|
headerLeft: { flexShrink: 1, flexGrow: 1 },
|
|
1299
1501
|
headerLeftRow: { flexDirection: "row", alignItems: "center" },
|
|
1300
|
-
headerRight: { flexDirection: "row", alignItems: "center", marginLeft:
|
|
1502
|
+
headerRight: { flexDirection: "row", alignItems: "center", marginLeft: HEADER_GAP2 },
|
|
1301
1503
|
title: { fontSize: TITLE_FONT_SIZE2, fontWeight: TITLE_FONT_WEIGHT },
|
|
1302
1504
|
boxTitle: { fontSize: BOX_TITLE_FONT_SIZE, fontWeight: TITLE_FONT_WEIGHT },
|
|
1303
|
-
chevron: { marginLeft:
|
|
1505
|
+
chevron: { marginLeft: HEADER_GAP2 },
|
|
1304
1506
|
marker: { marginRight: BOX_MARKER_GAP },
|
|
1305
1507
|
markerText: { fontSize: BOX_MARKER_FONT_SIZE, fontWeight: TITLE_FONT_WEIGHT },
|
|
1306
1508
|
body: { paddingHorizontal: BODY_PADDING_H, paddingBottom: BODY_PADDING_V },
|
|
@@ -1358,19 +1560,19 @@ var AccordionItem = ({
|
|
|
1358
1560
|
);
|
|
1359
1561
|
const keyboardProps = Platform.OS === "web" ? { onKeyDown: handleKeyDown2 } : {};
|
|
1360
1562
|
const itemStyle = useMemo(
|
|
1361
|
-
() => boxed ? [
|
|
1563
|
+
() => boxed ? [styles14.boxItem, { borderColor: colors.border }] : [styles14.item, { borderTopColor: colors.border }],
|
|
1362
1564
|
[boxed, colors.border]
|
|
1363
1565
|
);
|
|
1364
1566
|
const headerStyle = useMemo(
|
|
1365
1567
|
() => [
|
|
1366
|
-
|
|
1367
|
-
...boxed ? [
|
|
1568
|
+
styles14.header,
|
|
1569
|
+
...boxed ? [styles14.boxHeader] : [],
|
|
1368
1570
|
{ opacity: disabled ? DISABLED_OPACITY : FULL_OPACITY }
|
|
1369
1571
|
],
|
|
1370
1572
|
[boxed, disabled]
|
|
1371
1573
|
);
|
|
1372
1574
|
const resolvedLabel = accessibilityLabel ?? (typeof title === "string" ? title : void 0);
|
|
1373
|
-
const titleNode = typeof title === "string" ? /* @__PURE__ */ jsx(Text, { style: [boxed ?
|
|
1575
|
+
const titleNode = typeof title === "string" ? /* @__PURE__ */ jsx(Text, { style: [boxed ? styles14.boxTitle : styles14.title, { color: boxed ? colors.textSecondary : colors.text }], children: title }) : title;
|
|
1374
1576
|
return /* @__PURE__ */ jsxs(View, { style: itemStyle, children: [
|
|
1375
1577
|
/* @__PURE__ */ jsxs(
|
|
1376
1578
|
Pressable,
|
|
@@ -1387,7 +1589,7 @@ var AccordionItem = ({
|
|
|
1387
1589
|
onPress: handlePress,
|
|
1388
1590
|
...keyboardProps,
|
|
1389
1591
|
children: [
|
|
1390
|
-
/* @__PURE__ */ jsxs(View, { style: [
|
|
1592
|
+
/* @__PURE__ */ jsxs(View, { style: [styles14.headerLeft, boxed ? styles14.headerLeftRow : null], children: [
|
|
1391
1593
|
boxed ? (
|
|
1392
1594
|
// Decorative — the open/closed state is already conveyed by aria-expanded on the header.
|
|
1393
1595
|
/* @__PURE__ */ jsx(
|
|
@@ -1396,15 +1598,15 @@ var AccordionItem = ({
|
|
|
1396
1598
|
accessibilityElementsHidden: true,
|
|
1397
1599
|
"aria-hidden": true,
|
|
1398
1600
|
importantForAccessibility: "no-hide-descendants",
|
|
1399
|
-
style: [
|
|
1601
|
+
style: [styles14.marker, { transform: [{ rotate }] }],
|
|
1400
1602
|
testID: chevronTestID,
|
|
1401
|
-
children: /* @__PURE__ */ jsx(Text, { style: [
|
|
1603
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles14.markerText, { color: colors.textSecondary }], children: BOX_MARKER })
|
|
1402
1604
|
}
|
|
1403
1605
|
)
|
|
1404
1606
|
) : null,
|
|
1405
1607
|
titleNode
|
|
1406
1608
|
] }),
|
|
1407
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
1609
|
+
/* @__PURE__ */ jsxs(View, { style: styles14.headerRight, children: [
|
|
1408
1610
|
right,
|
|
1409
1611
|
boxed ? null : /* @__PURE__ */ jsx(
|
|
1410
1612
|
Animated.View,
|
|
@@ -1412,7 +1614,7 @@ var AccordionItem = ({
|
|
|
1412
1614
|
accessibilityElementsHidden: true,
|
|
1413
1615
|
"aria-hidden": true,
|
|
1414
1616
|
importantForAccessibility: "no-hide-descendants",
|
|
1415
|
-
style: [
|
|
1617
|
+
style: [styles14.chevron, { transform: [{ rotate }] }],
|
|
1416
1618
|
children: /* @__PURE__ */ jsx(SvgIcon, { color: colors.textSecondary, name: "chevronDown", size: CHEVRON_SIZE, testID: chevronTestID })
|
|
1417
1619
|
}
|
|
1418
1620
|
)
|
|
@@ -1426,7 +1628,7 @@ var AccordionItem = ({
|
|
|
1426
1628
|
accessibilityLabel: resolvedLabel,
|
|
1427
1629
|
nativeID: bodyTestID,
|
|
1428
1630
|
role: ROLE_REGION,
|
|
1429
|
-
style: boxed ?
|
|
1631
|
+
style: boxed ? styles14.boxBody : styles14.body,
|
|
1430
1632
|
testID: bodyTestID,
|
|
1431
1633
|
children
|
|
1432
1634
|
}
|
|
@@ -1489,7 +1691,7 @@ function useAvailableWidth() {
|
|
|
1489
1691
|
var AVG_CHAR_WIDTH_RATIO = 0.58;
|
|
1490
1692
|
var DEFAULT_FONT_SIZE2 = 13;
|
|
1491
1693
|
var UNMEASURED2 = 0;
|
|
1492
|
-
var
|
|
1694
|
+
var styles15 = StyleSheet.create({
|
|
1493
1695
|
base: { fontSize: DEFAULT_FONT_SIZE2 },
|
|
1494
1696
|
/** `minWidth: 0` lets the text shrink inside a flex row instead of forcing the row wider. */
|
|
1495
1697
|
fill: { flexShrink: 1, minWidth: 0 }
|
|
@@ -1520,7 +1722,7 @@ var TruncatedText = ({
|
|
|
1520
1722
|
[value, measureRef]
|
|
1521
1723
|
);
|
|
1522
1724
|
const flatStyle = useMemo(
|
|
1523
|
-
() => StyleSheet.flatten([
|
|
1725
|
+
() => StyleSheet.flatten([styles15.base, style]),
|
|
1524
1726
|
[style]
|
|
1525
1727
|
);
|
|
1526
1728
|
const fontSize = flatStyle.fontSize ?? DEFAULT_FONT_SIZE2;
|
|
@@ -1535,7 +1737,7 @@ var TruncatedText = ({
|
|
|
1535
1737
|
ref: attachRef,
|
|
1536
1738
|
onLayout,
|
|
1537
1739
|
numberOfLines: 1,
|
|
1538
|
-
style: [
|
|
1740
|
+
style: [styles15.base, styles15.fill, style],
|
|
1539
1741
|
testID,
|
|
1540
1742
|
accessibilityRole: onPress !== void 0 || href !== void 0 ? "link" : "text",
|
|
1541
1743
|
accessibilityLabel,
|
|
@@ -1638,7 +1840,7 @@ var LABEL_LETTER_SPACING = 0.4;
|
|
|
1638
1840
|
var ACTION_PADDING_H = 6;
|
|
1639
1841
|
var ACTION_PADDING_V = 2;
|
|
1640
1842
|
var ACTION_RADIUS = 6;
|
|
1641
|
-
var
|
|
1843
|
+
var styles16 = StyleSheet.create({
|
|
1642
1844
|
cell: { gap: CELL_GAP },
|
|
1643
1845
|
label: {
|
|
1644
1846
|
fontSize: LABEL_FONT_SIZE,
|
|
@@ -1697,14 +1899,14 @@ var CopyableId = ({
|
|
|
1697
1899
|
const { colors } = theme;
|
|
1698
1900
|
const { status, copy } = useCopyToClipboard(value, writer);
|
|
1699
1901
|
const action = useActionState(status);
|
|
1700
|
-
return /* @__PURE__ */ jsxs(View, { style: [
|
|
1701
|
-
label !== void 0 && /* @__PURE__ */ jsx(Text, { style: [
|
|
1702
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
1703
|
-
/* @__PURE__ */ jsx(View, { style:
|
|
1902
|
+
return /* @__PURE__ */ jsxs(View, { style: [styles16.cell, style], testID, children: [
|
|
1903
|
+
label !== void 0 && /* @__PURE__ */ jsx(Text, { style: [styles16.label, { color: colors.textSecondary }], children: label }),
|
|
1904
|
+
/* @__PURE__ */ jsxs(View, { style: styles16.row, children: [
|
|
1905
|
+
/* @__PURE__ */ jsx(View, { style: styles16.valueWrap, children: /* @__PURE__ */ jsx(
|
|
1704
1906
|
TruncatedText,
|
|
1705
1907
|
{
|
|
1706
1908
|
value,
|
|
1707
|
-
style: [
|
|
1909
|
+
style: [styles16.value, { color: colors.text }],
|
|
1708
1910
|
testID: `${testID}-value`,
|
|
1709
1911
|
accessibilityLabel: accessibilityLabel ?? value,
|
|
1710
1912
|
accessibilityHint: t(LAYOUT_I18N.copyableIdHint)
|
|
@@ -1718,7 +1920,7 @@ var CopyableId = ({
|
|
|
1718
1920
|
accessibilityLabel: t(action.key),
|
|
1719
1921
|
accessibilityHint: t(LAYOUT_I18N.copyHint),
|
|
1720
1922
|
testID: `${testID}-copy`,
|
|
1721
|
-
style: [
|
|
1923
|
+
style: [styles16.action, { color: action.color }],
|
|
1722
1924
|
children: t(action.key)
|
|
1723
1925
|
}
|
|
1724
1926
|
)
|
|
@@ -1726,6 +1928,6 @@ var CopyableId = ({
|
|
|
1726
1928
|
] });
|
|
1727
1929
|
};
|
|
1728
1930
|
|
|
1729
|
-
export { Accordion, AccordionItem, COPY_FEEDBACK_MS, CopyStatus, CopyableId, DEFAULT_BILLING_ROUTE, DropdownVariant, ELLIPSIS, Heading, LAYOUT_I18N, LAYOUT_TEST_IDS, ModalDropdown, ModalShell, Section, SegmentedControl, StatusBadge, Tabs, TabsCollapsedTrigger, TruncatedText, UpgradePrompt, copyText, formatUrlForDisplay, truncateMiddle, useCopyToClipboard, useFocusTrap };
|
|
1931
|
+
export { Accordion, AccordionItem, COPY_FEEDBACK_MS, ConfirmDialog, CopyStatus, CopyableId, DEFAULT_BILLING_ROUTE, DropdownVariant, ELLIPSIS, Heading, LAYOUT_I18N, LAYOUT_TEST_IDS, Modal3 as Modal, ModalDropdown, ModalShell, Section, SegmentedControl, StatusBadge, Tabs, TabsCollapsedTrigger, TruncatedText, UpgradePrompt, copyText, formatUrlForDisplay, truncateMiddle, useCopyToClipboard, useFocusTrap };
|
|
1730
1932
|
//# sourceMappingURL=index.mjs.map
|
|
1731
1933
|
//# sourceMappingURL=index.mjs.map
|