@dloizides/ui-layout 1.21.0 → 1.22.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 +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 +302 -93
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +242 -35
- 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
|
-
import { useA11y } from '@dloizides/a11y';
|
|
5
|
+
import { MIN_TOUCH_TARGET_PX, 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
|
);
|
|
@@ -655,7 +668,12 @@ var styles7 = StyleSheet.create({
|
|
|
655
668
|
borderWidth: BORDER_WIDTH4,
|
|
656
669
|
borderRadius: BORDER_RADIUS3,
|
|
657
670
|
paddingHorizontal: CONTAINER_PADDING_H,
|
|
658
|
-
paddingVertical: CONTAINER_PADDING_V
|
|
671
|
+
paddingVertical: CONTAINER_PADDING_V,
|
|
672
|
+
// Match the shared control height used by @dloizides/ui-forms inputs (same MIN_TOUCH_TARGET_PX
|
|
673
|
+
// floor from @dloizides/a11y), so a select trigger and a text/typeahead field sitting side by
|
|
674
|
+
// side in a filter bar are exactly the same height. Centre the label within that floor.
|
|
675
|
+
minHeight: MIN_TOUCH_TARGET_PX,
|
|
676
|
+
justifyContent: "center"
|
|
659
677
|
},
|
|
660
678
|
// Caret variant: a row with the label leading and the caret pinned to the trailing edge, at a
|
|
661
679
|
// phone-friendly minimum height. Only applied when `showCaret` is set, so field dropdowns are
|
|
@@ -1122,7 +1140,7 @@ var ModalShell = ({
|
|
|
1122
1140
|
showClose = true
|
|
1123
1141
|
}) => {
|
|
1124
1142
|
const { theme, t } = useUi();
|
|
1125
|
-
const containerStyle =
|
|
1143
|
+
const containerStyle = React10.useMemo(
|
|
1126
1144
|
() => [styles10.container, { backgroundColor: theme.colors.background }, contentStyle],
|
|
1127
1145
|
[theme.colors.background, contentStyle]
|
|
1128
1146
|
);
|
|
@@ -1165,6 +1183,195 @@ var ModalShell = ({
|
|
|
1165
1183
|
}
|
|
1166
1184
|
);
|
|
1167
1185
|
};
|
|
1186
|
+
function useEscapeKey(enabled, onClose) {
|
|
1187
|
+
useEffect(() => {
|
|
1188
|
+
if (Platform.OS !== "web" || !enabled) return;
|
|
1189
|
+
const onKeyDown = (event) => {
|
|
1190
|
+
if (event.key === "Escape") onClose();
|
|
1191
|
+
};
|
|
1192
|
+
document.addEventListener("keydown", onKeyDown);
|
|
1193
|
+
return () => {
|
|
1194
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
1195
|
+
};
|
|
1196
|
+
}, [enabled, onClose]);
|
|
1197
|
+
}
|
|
1198
|
+
function useScrollLock(enabled) {
|
|
1199
|
+
useEffect(() => {
|
|
1200
|
+
if (Platform.OS !== "web" || !enabled) return;
|
|
1201
|
+
const { body } = document;
|
|
1202
|
+
const previousOverflow = body.style.overflow;
|
|
1203
|
+
body.style.overflow = "hidden";
|
|
1204
|
+
return () => {
|
|
1205
|
+
body.style.overflow = previousOverflow;
|
|
1206
|
+
};
|
|
1207
|
+
}, [enabled]);
|
|
1208
|
+
}
|
|
1209
|
+
var OVERLAY_PADDING = 16;
|
|
1210
|
+
var DIALOG_RADIUS = 12;
|
|
1211
|
+
var DIALOG_PADDING = 16;
|
|
1212
|
+
var HEADER_GAP = 12;
|
|
1213
|
+
var FOOTER_MARGIN = 16;
|
|
1214
|
+
var HEADER_MARGIN = 12;
|
|
1215
|
+
var DIALOG_MAX_HEIGHT = "90%";
|
|
1216
|
+
var SIZE_MAX_WIDTH = { sm: 360, md: 480, lg: 640 };
|
|
1217
|
+
var styles11 = StyleSheet.create({
|
|
1218
|
+
overlay: {
|
|
1219
|
+
flex: 1,
|
|
1220
|
+
justifyContent: "center",
|
|
1221
|
+
alignItems: "center",
|
|
1222
|
+
padding: OVERLAY_PADDING,
|
|
1223
|
+
backgroundColor: MODAL_OVERLAY_COLOR
|
|
1224
|
+
},
|
|
1225
|
+
dialog: {
|
|
1226
|
+
width: "100%",
|
|
1227
|
+
borderRadius: DIALOG_RADIUS,
|
|
1228
|
+
padding: DIALOG_PADDING,
|
|
1229
|
+
maxHeight: DIALOG_MAX_HEIGHT
|
|
1230
|
+
},
|
|
1231
|
+
headerRow: {
|
|
1232
|
+
flexDirection: "row",
|
|
1233
|
+
alignItems: "flex-start",
|
|
1234
|
+
justifyContent: "space-between",
|
|
1235
|
+
columnGap: HEADER_GAP,
|
|
1236
|
+
marginBottom: HEADER_MARGIN
|
|
1237
|
+
},
|
|
1238
|
+
// Occupies the header's leading space so the ✕ pins to the trailing edge even without a title.
|
|
1239
|
+
titleWrap: { flex: 1 },
|
|
1240
|
+
footer: { marginTop: FOOTER_MARGIN }
|
|
1241
|
+
});
|
|
1242
|
+
var Modal3 = ({
|
|
1243
|
+
visible,
|
|
1244
|
+
onClose,
|
|
1245
|
+
title,
|
|
1246
|
+
children,
|
|
1247
|
+
footer,
|
|
1248
|
+
size = "md",
|
|
1249
|
+
showClose = true,
|
|
1250
|
+
testID = LAYOUT_TEST_IDS.modal,
|
|
1251
|
+
accessibilityLabel
|
|
1252
|
+
}) => {
|
|
1253
|
+
const { theme, t } = useUi();
|
|
1254
|
+
const dialogRef = useRef(null);
|
|
1255
|
+
useFocusTrap(dialogRef, visible);
|
|
1256
|
+
useEscapeKey(visible, onClose);
|
|
1257
|
+
useScrollLock(visible);
|
|
1258
|
+
const accessibleName = accessibilityLabel ?? title ?? t(LAYOUT_I18N.dialog);
|
|
1259
|
+
const closeLabel = t(LAYOUT_I18N.dialogClose);
|
|
1260
|
+
const dialogStyle = useMemo(
|
|
1261
|
+
() => [styles11.dialog, { backgroundColor: theme.colors.surface, maxWidth: SIZE_MAX_WIDTH[size] }],
|
|
1262
|
+
[theme.colors.surface, size]
|
|
1263
|
+
);
|
|
1264
|
+
const hasHeader = title !== void 0 || showClose;
|
|
1265
|
+
return /* @__PURE__ */ jsx(Modal, { transparent: true, animationType: "fade", visible, onRequestClose: onClose, children: /* @__PURE__ */ jsxs(View, { style: styles11.overlay, children: [
|
|
1266
|
+
/* @__PURE__ */ jsx(
|
|
1267
|
+
TouchableOpacity,
|
|
1268
|
+
{
|
|
1269
|
+
accessible: true,
|
|
1270
|
+
accessibilityHint: t(LAYOUT_I18N.dismissDropdownHint),
|
|
1271
|
+
accessibilityLabel: t(LAYOUT_I18N.dismissDropdown),
|
|
1272
|
+
accessibilityRole: "button",
|
|
1273
|
+
activeOpacity: 1,
|
|
1274
|
+
style: StyleSheet.absoluteFill,
|
|
1275
|
+
testID: `${testID}-backdrop`,
|
|
1276
|
+
onPress: onClose
|
|
1277
|
+
}
|
|
1278
|
+
),
|
|
1279
|
+
/* @__PURE__ */ jsxs(
|
|
1280
|
+
View,
|
|
1281
|
+
{
|
|
1282
|
+
ref: dialogRef,
|
|
1283
|
+
accessibilityViewIsModal: true,
|
|
1284
|
+
"aria-label": accessibleName,
|
|
1285
|
+
role: "dialog",
|
|
1286
|
+
style: dialogStyle,
|
|
1287
|
+
testID,
|
|
1288
|
+
children: [
|
|
1289
|
+
hasHeader ? /* @__PURE__ */ jsxs(View, { style: styles11.headerRow, children: [
|
|
1290
|
+
/* @__PURE__ */ jsx(View, { style: styles11.titleWrap, children: title !== void 0 ? /* @__PURE__ */ jsx(Heading, { children: title }) : null }),
|
|
1291
|
+
showClose ? /* @__PURE__ */ jsx(
|
|
1292
|
+
IconButton,
|
|
1293
|
+
{
|
|
1294
|
+
accessibilityHint: t(LAYOUT_I18N.closeDialogHint),
|
|
1295
|
+
accessibilityLabel: closeLabel,
|
|
1296
|
+
appearance: "ghost",
|
|
1297
|
+
renderIcon: (color, iconSize) => /* @__PURE__ */ jsx(SvgIcon, { color, name: "close", size: iconSize }),
|
|
1298
|
+
size: "md",
|
|
1299
|
+
testID: `${testID}-close`,
|
|
1300
|
+
tooltip: closeLabel,
|
|
1301
|
+
variant: "ghost",
|
|
1302
|
+
onPress: onClose
|
|
1303
|
+
}
|
|
1304
|
+
) : null
|
|
1305
|
+
] }) : null,
|
|
1306
|
+
/* @__PURE__ */ jsx(ScrollView, { children }),
|
|
1307
|
+
footer !== void 0 ? /* @__PURE__ */ jsx(View, { style: styles11.footer, children: footer }) : null
|
|
1308
|
+
]
|
|
1309
|
+
}
|
|
1310
|
+
)
|
|
1311
|
+
] }) });
|
|
1312
|
+
};
|
|
1313
|
+
var MESSAGE_FONT_SIZE2 = 14;
|
|
1314
|
+
var MESSAGE_LINE_HEIGHT = 20;
|
|
1315
|
+
var BUTTON_GAP = 12;
|
|
1316
|
+
var styles12 = StyleSheet.create({
|
|
1317
|
+
message: { fontSize: MESSAGE_FONT_SIZE2, lineHeight: MESSAGE_LINE_HEIGHT },
|
|
1318
|
+
footer: { flexDirection: "row", justifyContent: "flex-end", columnGap: BUTTON_GAP }
|
|
1319
|
+
});
|
|
1320
|
+
var ConfirmDialog = ({
|
|
1321
|
+
visible,
|
|
1322
|
+
title,
|
|
1323
|
+
message,
|
|
1324
|
+
confirmLabel,
|
|
1325
|
+
cancelLabel,
|
|
1326
|
+
destructive = false,
|
|
1327
|
+
onConfirm,
|
|
1328
|
+
onCancel,
|
|
1329
|
+
busy = false,
|
|
1330
|
+
testID = LAYOUT_TEST_IDS.confirmDialog
|
|
1331
|
+
}) => {
|
|
1332
|
+
const { theme, t } = useUi();
|
|
1333
|
+
const resolvedConfirm = confirmLabel ?? t(LAYOUT_I18N.confirm);
|
|
1334
|
+
const resolvedCancel = cancelLabel ?? t(LAYOUT_I18N.cancel);
|
|
1335
|
+
const footer = /* @__PURE__ */ jsxs(View, { style: styles12.footer, children: [
|
|
1336
|
+
/* @__PURE__ */ jsx(
|
|
1337
|
+
Button,
|
|
1338
|
+
{
|
|
1339
|
+
accessibilityHint: t(LAYOUT_I18N.cancelHint),
|
|
1340
|
+
accessibilityLabel: resolvedCancel,
|
|
1341
|
+
disabled: busy,
|
|
1342
|
+
label: resolvedCancel,
|
|
1343
|
+
testID: `${testID}-cancel`,
|
|
1344
|
+
variant: "secondary",
|
|
1345
|
+
onPress: onCancel
|
|
1346
|
+
}
|
|
1347
|
+
),
|
|
1348
|
+
/* @__PURE__ */ jsx(
|
|
1349
|
+
Button,
|
|
1350
|
+
{
|
|
1351
|
+
accessibilityHint: t(LAYOUT_I18N.confirmHint),
|
|
1352
|
+
accessibilityLabel: resolvedConfirm,
|
|
1353
|
+
label: resolvedConfirm,
|
|
1354
|
+
loading: busy,
|
|
1355
|
+
testID: `${testID}-confirm`,
|
|
1356
|
+
variant: destructive ? "danger" : "primary",
|
|
1357
|
+
onPress: onConfirm
|
|
1358
|
+
}
|
|
1359
|
+
)
|
|
1360
|
+
] });
|
|
1361
|
+
return /* @__PURE__ */ jsx(
|
|
1362
|
+
Modal3,
|
|
1363
|
+
{
|
|
1364
|
+
footer,
|
|
1365
|
+
showClose: false,
|
|
1366
|
+
size: "sm",
|
|
1367
|
+
testID,
|
|
1368
|
+
title,
|
|
1369
|
+
visible,
|
|
1370
|
+
onClose: onCancel,
|
|
1371
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles12.message, { color: theme.colors.text }], testID: `${testID}-message`, children: message })
|
|
1372
|
+
}
|
|
1373
|
+
);
|
|
1374
|
+
};
|
|
1168
1375
|
var AccordionContext = createContext(null);
|
|
1169
1376
|
function useAccordionContext() {
|
|
1170
1377
|
const value = useContext(AccordionContext);
|
|
@@ -1194,14 +1401,14 @@ function animateNextLayout() {
|
|
|
1194
1401
|
}
|
|
1195
1402
|
}
|
|
1196
1403
|
var BOXED_GAP = 12;
|
|
1197
|
-
var
|
|
1404
|
+
var styles13 = StyleSheet.create({
|
|
1198
1405
|
container: { alignSelf: "stretch" },
|
|
1199
1406
|
boxed: { gap: BOXED_GAP }
|
|
1200
1407
|
});
|
|
1201
1408
|
function computeInitialOpen(children, defaultOpenIds, allowMultiple) {
|
|
1202
1409
|
const ids = new Set(defaultOpenIds ?? []);
|
|
1203
|
-
|
|
1204
|
-
if (!
|
|
1410
|
+
React10.Children.forEach(children, (child) => {
|
|
1411
|
+
if (!React10.isValidElement(child)) return;
|
|
1205
1412
|
const props = child.props;
|
|
1206
1413
|
if (props.defaultOpen === true && typeof props.id === "string") {
|
|
1207
1414
|
ids.add(props.id);
|
|
@@ -1252,7 +1459,7 @@ var Accordion = ({
|
|
|
1252
1459
|
[openSet, toggle, allowMultiple, variant]
|
|
1253
1460
|
);
|
|
1254
1461
|
const containerStyle = useMemo(() => {
|
|
1255
|
-
const base = variant === "boxed" ? [
|
|
1462
|
+
const base = variant === "boxed" ? [styles13.container, styles13.boxed] : [styles13.container];
|
|
1256
1463
|
if (style === void 0) return base;
|
|
1257
1464
|
return [...base, ...Array.isArray(style) ? style : [style]];
|
|
1258
1465
|
}, [style, variant]);
|
|
@@ -1262,7 +1469,7 @@ var HEADER_PADDING_H = 16;
|
|
|
1262
1469
|
var HEADER_PADDING_V = 12;
|
|
1263
1470
|
var BODY_PADDING_H = 16;
|
|
1264
1471
|
var BODY_PADDING_V = 12;
|
|
1265
|
-
var
|
|
1472
|
+
var HEADER_GAP2 = 8;
|
|
1266
1473
|
var TITLE_FONT_SIZE2 = 15;
|
|
1267
1474
|
var TITLE_FONT_WEIGHT = "600";
|
|
1268
1475
|
var CHEVRON_SIZE = 18;
|
|
@@ -1284,7 +1491,7 @@ var BOX_TITLE_FONT_SIZE = 14;
|
|
|
1284
1491
|
var BOX_MARKER_FONT_SIZE = 13;
|
|
1285
1492
|
var BOX_MARKER_GAP = 6;
|
|
1286
1493
|
var BOX_MARKER = "\u25B8";
|
|
1287
|
-
var
|
|
1494
|
+
var styles14 = StyleSheet.create({
|
|
1288
1495
|
item: { borderTopWidth: StyleSheet.hairlineWidth },
|
|
1289
1496
|
boxItem: { borderWidth: 1, borderRadius: BOX_BORDER_RADIUS, paddingHorizontal: BOX_PADDING_H },
|
|
1290
1497
|
header: {
|
|
@@ -1297,10 +1504,10 @@ var styles12 = StyleSheet.create({
|
|
|
1297
1504
|
boxHeader: { paddingHorizontal: 0, paddingVertical: BOX_HEADER_PADDING_V },
|
|
1298
1505
|
headerLeft: { flexShrink: 1, flexGrow: 1 },
|
|
1299
1506
|
headerLeftRow: { flexDirection: "row", alignItems: "center" },
|
|
1300
|
-
headerRight: { flexDirection: "row", alignItems: "center", marginLeft:
|
|
1507
|
+
headerRight: { flexDirection: "row", alignItems: "center", marginLeft: HEADER_GAP2 },
|
|
1301
1508
|
title: { fontSize: TITLE_FONT_SIZE2, fontWeight: TITLE_FONT_WEIGHT },
|
|
1302
1509
|
boxTitle: { fontSize: BOX_TITLE_FONT_SIZE, fontWeight: TITLE_FONT_WEIGHT },
|
|
1303
|
-
chevron: { marginLeft:
|
|
1510
|
+
chevron: { marginLeft: HEADER_GAP2 },
|
|
1304
1511
|
marker: { marginRight: BOX_MARKER_GAP },
|
|
1305
1512
|
markerText: { fontSize: BOX_MARKER_FONT_SIZE, fontWeight: TITLE_FONT_WEIGHT },
|
|
1306
1513
|
body: { paddingHorizontal: BODY_PADDING_H, paddingBottom: BODY_PADDING_V },
|
|
@@ -1358,19 +1565,19 @@ var AccordionItem = ({
|
|
|
1358
1565
|
);
|
|
1359
1566
|
const keyboardProps = Platform.OS === "web" ? { onKeyDown: handleKeyDown2 } : {};
|
|
1360
1567
|
const itemStyle = useMemo(
|
|
1361
|
-
() => boxed ? [
|
|
1568
|
+
() => boxed ? [styles14.boxItem, { borderColor: colors.border }] : [styles14.item, { borderTopColor: colors.border }],
|
|
1362
1569
|
[boxed, colors.border]
|
|
1363
1570
|
);
|
|
1364
1571
|
const headerStyle = useMemo(
|
|
1365
1572
|
() => [
|
|
1366
|
-
|
|
1367
|
-
...boxed ? [
|
|
1573
|
+
styles14.header,
|
|
1574
|
+
...boxed ? [styles14.boxHeader] : [],
|
|
1368
1575
|
{ opacity: disabled ? DISABLED_OPACITY : FULL_OPACITY }
|
|
1369
1576
|
],
|
|
1370
1577
|
[boxed, disabled]
|
|
1371
1578
|
);
|
|
1372
1579
|
const resolvedLabel = accessibilityLabel ?? (typeof title === "string" ? title : void 0);
|
|
1373
|
-
const titleNode = typeof title === "string" ? /* @__PURE__ */ jsx(Text, { style: [boxed ?
|
|
1580
|
+
const titleNode = typeof title === "string" ? /* @__PURE__ */ jsx(Text, { style: [boxed ? styles14.boxTitle : styles14.title, { color: boxed ? colors.textSecondary : colors.text }], children: title }) : title;
|
|
1374
1581
|
return /* @__PURE__ */ jsxs(View, { style: itemStyle, children: [
|
|
1375
1582
|
/* @__PURE__ */ jsxs(
|
|
1376
1583
|
Pressable,
|
|
@@ -1387,7 +1594,7 @@ var AccordionItem = ({
|
|
|
1387
1594
|
onPress: handlePress,
|
|
1388
1595
|
...keyboardProps,
|
|
1389
1596
|
children: [
|
|
1390
|
-
/* @__PURE__ */ jsxs(View, { style: [
|
|
1597
|
+
/* @__PURE__ */ jsxs(View, { style: [styles14.headerLeft, boxed ? styles14.headerLeftRow : null], children: [
|
|
1391
1598
|
boxed ? (
|
|
1392
1599
|
// Decorative — the open/closed state is already conveyed by aria-expanded on the header.
|
|
1393
1600
|
/* @__PURE__ */ jsx(
|
|
@@ -1396,15 +1603,15 @@ var AccordionItem = ({
|
|
|
1396
1603
|
accessibilityElementsHidden: true,
|
|
1397
1604
|
"aria-hidden": true,
|
|
1398
1605
|
importantForAccessibility: "no-hide-descendants",
|
|
1399
|
-
style: [
|
|
1606
|
+
style: [styles14.marker, { transform: [{ rotate }] }],
|
|
1400
1607
|
testID: chevronTestID,
|
|
1401
|
-
children: /* @__PURE__ */ jsx(Text, { style: [
|
|
1608
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles14.markerText, { color: colors.textSecondary }], children: BOX_MARKER })
|
|
1402
1609
|
}
|
|
1403
1610
|
)
|
|
1404
1611
|
) : null,
|
|
1405
1612
|
titleNode
|
|
1406
1613
|
] }),
|
|
1407
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
1614
|
+
/* @__PURE__ */ jsxs(View, { style: styles14.headerRight, children: [
|
|
1408
1615
|
right,
|
|
1409
1616
|
boxed ? null : /* @__PURE__ */ jsx(
|
|
1410
1617
|
Animated.View,
|
|
@@ -1412,7 +1619,7 @@ var AccordionItem = ({
|
|
|
1412
1619
|
accessibilityElementsHidden: true,
|
|
1413
1620
|
"aria-hidden": true,
|
|
1414
1621
|
importantForAccessibility: "no-hide-descendants",
|
|
1415
|
-
style: [
|
|
1622
|
+
style: [styles14.chevron, { transform: [{ rotate }] }],
|
|
1416
1623
|
children: /* @__PURE__ */ jsx(SvgIcon, { color: colors.textSecondary, name: "chevronDown", size: CHEVRON_SIZE, testID: chevronTestID })
|
|
1417
1624
|
}
|
|
1418
1625
|
)
|
|
@@ -1426,7 +1633,7 @@ var AccordionItem = ({
|
|
|
1426
1633
|
accessibilityLabel: resolvedLabel,
|
|
1427
1634
|
nativeID: bodyTestID,
|
|
1428
1635
|
role: ROLE_REGION,
|
|
1429
|
-
style: boxed ?
|
|
1636
|
+
style: boxed ? styles14.boxBody : styles14.body,
|
|
1430
1637
|
testID: bodyTestID,
|
|
1431
1638
|
children
|
|
1432
1639
|
}
|
|
@@ -1489,7 +1696,7 @@ function useAvailableWidth() {
|
|
|
1489
1696
|
var AVG_CHAR_WIDTH_RATIO = 0.58;
|
|
1490
1697
|
var DEFAULT_FONT_SIZE2 = 13;
|
|
1491
1698
|
var UNMEASURED2 = 0;
|
|
1492
|
-
var
|
|
1699
|
+
var styles15 = StyleSheet.create({
|
|
1493
1700
|
base: { fontSize: DEFAULT_FONT_SIZE2 },
|
|
1494
1701
|
/** `minWidth: 0` lets the text shrink inside a flex row instead of forcing the row wider. */
|
|
1495
1702
|
fill: { flexShrink: 1, minWidth: 0 }
|
|
@@ -1520,7 +1727,7 @@ var TruncatedText = ({
|
|
|
1520
1727
|
[value, measureRef]
|
|
1521
1728
|
);
|
|
1522
1729
|
const flatStyle = useMemo(
|
|
1523
|
-
() => StyleSheet.flatten([
|
|
1730
|
+
() => StyleSheet.flatten([styles15.base, style]),
|
|
1524
1731
|
[style]
|
|
1525
1732
|
);
|
|
1526
1733
|
const fontSize = flatStyle.fontSize ?? DEFAULT_FONT_SIZE2;
|
|
@@ -1535,7 +1742,7 @@ var TruncatedText = ({
|
|
|
1535
1742
|
ref: attachRef,
|
|
1536
1743
|
onLayout,
|
|
1537
1744
|
numberOfLines: 1,
|
|
1538
|
-
style: [
|
|
1745
|
+
style: [styles15.base, styles15.fill, style],
|
|
1539
1746
|
testID,
|
|
1540
1747
|
accessibilityRole: onPress !== void 0 || href !== void 0 ? "link" : "text",
|
|
1541
1748
|
accessibilityLabel,
|
|
@@ -1638,7 +1845,7 @@ var LABEL_LETTER_SPACING = 0.4;
|
|
|
1638
1845
|
var ACTION_PADDING_H = 6;
|
|
1639
1846
|
var ACTION_PADDING_V = 2;
|
|
1640
1847
|
var ACTION_RADIUS = 6;
|
|
1641
|
-
var
|
|
1848
|
+
var styles16 = StyleSheet.create({
|
|
1642
1849
|
cell: { gap: CELL_GAP },
|
|
1643
1850
|
label: {
|
|
1644
1851
|
fontSize: LABEL_FONT_SIZE,
|
|
@@ -1697,14 +1904,14 @@ var CopyableId = ({
|
|
|
1697
1904
|
const { colors } = theme;
|
|
1698
1905
|
const { status, copy } = useCopyToClipboard(value, writer);
|
|
1699
1906
|
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:
|
|
1907
|
+
return /* @__PURE__ */ jsxs(View, { style: [styles16.cell, style], testID, children: [
|
|
1908
|
+
label !== void 0 && /* @__PURE__ */ jsx(Text, { style: [styles16.label, { color: colors.textSecondary }], children: label }),
|
|
1909
|
+
/* @__PURE__ */ jsxs(View, { style: styles16.row, children: [
|
|
1910
|
+
/* @__PURE__ */ jsx(View, { style: styles16.valueWrap, children: /* @__PURE__ */ jsx(
|
|
1704
1911
|
TruncatedText,
|
|
1705
1912
|
{
|
|
1706
1913
|
value,
|
|
1707
|
-
style: [
|
|
1914
|
+
style: [styles16.value, { color: colors.text }],
|
|
1708
1915
|
testID: `${testID}-value`,
|
|
1709
1916
|
accessibilityLabel: accessibilityLabel ?? value,
|
|
1710
1917
|
accessibilityHint: t(LAYOUT_I18N.copyableIdHint)
|
|
@@ -1718,7 +1925,7 @@ var CopyableId = ({
|
|
|
1718
1925
|
accessibilityLabel: t(action.key),
|
|
1719
1926
|
accessibilityHint: t(LAYOUT_I18N.copyHint),
|
|
1720
1927
|
testID: `${testID}-copy`,
|
|
1721
|
-
style: [
|
|
1928
|
+
style: [styles16.action, { color: action.color }],
|
|
1722
1929
|
children: t(action.key)
|
|
1723
1930
|
}
|
|
1724
1931
|
)
|
|
@@ -1726,6 +1933,6 @@ var CopyableId = ({
|
|
|
1726
1933
|
] });
|
|
1727
1934
|
};
|
|
1728
1935
|
|
|
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 };
|
|
1936
|
+
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
1937
|
//# sourceMappingURL=index.mjs.map
|
|
1731
1938
|
//# sourceMappingURL=index.mjs.map
|