@dloizides/ui-layout 1.28.5 → 1.30.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/dist/index.mjs CHANGED
@@ -278,6 +278,15 @@ function getFocusableElements(container) {
278
278
  function savePreviousFocus() {
279
279
  return document.activeElement instanceof HTMLElement ? document.activeElement : null;
280
280
  }
281
+ function focusInitial(domNode, initialFocusTestID) {
282
+ const named = initialFocusTestID === void 0 ? null : domNode.querySelector(`[data-testid="${initialFocusTestID}"]`);
283
+ if (named) {
284
+ named.focus();
285
+ return;
286
+ }
287
+ if (domNode.contains(document.activeElement)) return;
288
+ getFocusableElements(domNode)[0]?.focus();
289
+ }
281
290
  function handleKeyDown(domNode, event) {
282
291
  if (event.key !== "Tab") return;
283
292
  const focusable = getFocusableElements(domNode);
@@ -300,14 +309,15 @@ function handleKeyDown(domNode, event) {
300
309
  first.focus();
301
310
  }
302
311
  }
303
- function useFocusTrap(containerRef, enabled) {
312
+ function useFocusTrap(containerRef, enabled, initialFocusTestID) {
304
313
  const previousFocusRef = useRef(null);
305
314
  useEffect(() => {
306
315
  if (Platform.OS !== "web" || !enabled) return;
307
316
  const domNode = containerRef.current;
308
317
  if (!domNode) return;
309
- previousFocusRef.current = savePreviousFocus();
310
- queueMicrotask(() => getFocusableElements(domNode)[0]?.focus());
318
+ const previous = savePreviousFocus();
319
+ previousFocusRef.current = previous !== null && domNode.contains(previous) ? null : previous;
320
+ queueMicrotask(() => focusInitial(domNode, initialFocusTestID));
311
321
  const listener = (e) => handleKeyDown(domNode, e);
312
322
  domNode.addEventListener("keydown", listener);
313
323
  return () => {
@@ -315,7 +325,7 @@ function useFocusTrap(containerRef, enabled) {
315
325
  previousFocusRef.current?.focus();
316
326
  previousFocusRef.current = null;
317
327
  };
318
- }, [containerRef, enabled]);
328
+ }, [containerRef, enabled, initialFocusTestID]);
319
329
  }
320
330
 
321
331
  // src/ModalDropdown/DropdownVariant.ts
@@ -370,12 +380,40 @@ function isAnchorHidden(rect, clip, minVisiblePx) {
370
380
  const visibleWidth = Math.min(rect.left + rect.width, clip.right) - Math.max(rect.left, clip.left);
371
381
  return visibleHeight < minVisiblePx || visibleWidth < minVisiblePx;
372
382
  }
383
+ var HEADING_FONT_SIZE = 12;
384
+ var HEADING_FONT_WEIGHT = "600";
385
+ var HEADING_PADDING_H = 16;
386
+ var HEADING_PADDING_TOP = 8;
387
+ var HEADING_PADDING_BOTTOM = 4;
388
+ var HEADING_LETTER_SPACING = 0.5;
389
+ var styles5 = StyleSheet.create({
390
+ heading: {
391
+ fontSize: HEADING_FONT_SIZE,
392
+ fontWeight: HEADING_FONT_WEIGHT,
393
+ letterSpacing: HEADING_LETTER_SPACING,
394
+ paddingHorizontal: HEADING_PADDING_H,
395
+ paddingTop: HEADING_PADDING_TOP,
396
+ paddingBottom: HEADING_PADDING_BOTTOM
397
+ }
398
+ });
399
+ var MenuHeading = ({ testID, text }) => {
400
+ const { theme } = useUi();
401
+ return /* @__PURE__ */ jsx(
402
+ Text,
403
+ {
404
+ accessibilityRole: "header",
405
+ style: [styles5.heading, { color: theme.colors.textSecondary }],
406
+ testID: `${testID}-menu-heading`,
407
+ children: text
408
+ }
409
+ );
410
+ };
373
411
  var OPTION_BORDER_RADIUS = 4;
374
412
  var BODY_FONT_SIZE = 14;
375
413
  var SELECTED_FONT_WEIGHT = "600";
376
414
  var OPTION_PADDING_H = 16;
377
415
  var OPTION_PADDING_V = 12;
378
- var styles5 = StyleSheet.create({
416
+ var styles6 = StyleSheet.create({
379
417
  option: {
380
418
  paddingHorizontal: OPTION_PADDING_H,
381
419
  paddingVertical: OPTION_PADDING_V,
@@ -399,8 +437,8 @@ var OptionRow = ({
399
437
  onSelect();
400
438
  }, [onSelect]);
401
439
  const isActive = isSelected || isHighlighted;
402
- const rowStyle = [styles5.option, isActive ? { backgroundColor: colors.surfaceElevated } : null];
403
- const textStyle = [styles5.optionText, { color: colors.text }, isSelected ? styles5.selectedText : null];
440
+ const rowStyle = [styles6.option, isActive ? { backgroundColor: colors.surfaceElevated } : null];
441
+ const textStyle = [styles6.optionText, { color: colors.text }, isSelected ? styles6.selectedText : null];
404
442
  return /* @__PURE__ */ jsx(
405
443
  TouchableOpacity,
406
444
  {
@@ -569,7 +607,7 @@ var IS_WEB2 = Platform.OS === "web";
569
607
  var BORDER_RADIUS2 = 8;
570
608
  var BORDER_WIDTH3 = 1;
571
609
  var MENU_PADDING2 = 4;
572
- var styles6 = StyleSheet.create({
610
+ var styles7 = StyleSheet.create({
573
611
  /** Native (in-tree) popover — anchored absolutely just under the trigger. */
574
612
  popover: {
575
613
  position: "absolute",
@@ -604,6 +642,7 @@ var InlineMenu = ({
604
642
  isOpen,
605
643
  optionTestID,
606
644
  menuMinWidth = 0,
645
+ menuHeading,
607
646
  animatedStyle,
608
647
  onSelect,
609
648
  onClose
@@ -654,7 +693,7 @@ var InlineMenu = ({
654
693
  themed
655
694
  ];
656
695
  }
657
- return [styles6.popover, { minWidth: menuMinWidth }, themed];
696
+ return [styles7.popover, { minWidth: menuMinWidth }, themed];
658
697
  }, [colors.border, colors.surface, menuMinWidth, rect]);
659
698
  const menu = /* @__PURE__ */ jsx(
660
699
  View,
@@ -662,25 +701,28 @@ var InlineMenu = ({
662
701
  ref: menuRef,
663
702
  accessibilityRole: "menu",
664
703
  "aria-hidden": !isOpen,
665
- "aria-label": accessibilityLabel,
704
+ "aria-label": menuHeading ?? accessibilityLabel,
666
705
  style: popoverStyle,
667
706
  testID: `${testID}-menu`,
668
- children: /* @__PURE__ */ jsx(
707
+ children: /* @__PURE__ */ jsxs(
669
708
  Animated.View,
670
709
  {
671
710
  pointerEvents: isOpen ? "auto" : "none",
672
- style: [styles6.animated, animatedStyle, isOpen ? null : styles6.inert],
673
- children: /* @__PURE__ */ jsx(ScrollView, { style: styles6.scroll, keyboardShouldPersistTaps: "handled", children: options.map((option, index) => /* @__PURE__ */ jsx(
674
- OptionRow,
675
- {
676
- isHighlighted: index === highlightedIndex,
677
- isSelected: option.value === value,
678
- label: option.label,
679
- testID: optionTestID !== void 0 ? optionTestID(option.value) : `${testID}-option-${String(option.value)}`,
680
- onSelect: () => handleSelect(option.value)
681
- },
682
- String(option.value)
683
- )) })
711
+ style: [styles7.animated, animatedStyle, isOpen ? null : styles7.inert],
712
+ children: [
713
+ menuHeading !== void 0 ? /* @__PURE__ */ jsx(MenuHeading, { testID, text: menuHeading }) : null,
714
+ /* @__PURE__ */ jsx(ScrollView, { style: styles7.scroll, keyboardShouldPersistTaps: "handled", children: options.map((option, index) => /* @__PURE__ */ jsx(
715
+ OptionRow,
716
+ {
717
+ isHighlighted: index === highlightedIndex,
718
+ isSelected: option.value === value,
719
+ label: option.label,
720
+ testID: optionTestID !== void 0 ? optionTestID(option.value) : `${testID}-option-${String(option.value)}`,
721
+ onSelect: () => handleSelect(option.value)
722
+ },
723
+ String(option.value)
724
+ )) })
725
+ ]
684
726
  }
685
727
  )
686
728
  }
@@ -723,7 +765,7 @@ var CARET_OPEN_ROTATION = "180deg";
723
765
  var CARET_CLOSED_ROTATION = "0deg";
724
766
  var POPOVER_ENTER_SCALE = 0.96;
725
767
  var POPOVER_MOTION_MS = 120;
726
- var styles7 = StyleSheet.create({
768
+ var styles8 = StyleSheet.create({
727
769
  anchor: { position: "relative" },
728
770
  container: {
729
771
  borderWidth: BORDER_WIDTH4,
@@ -785,7 +827,8 @@ var ModalDropdown = ({
785
827
  optionTestID,
786
828
  menuMinWidth,
787
829
  showCaret = false,
788
- showHamburger = false
830
+ showHamburger = false,
831
+ menuHeading
789
832
  }) => {
790
833
  const { theme, t } = useUi();
791
834
  const { colors } = theme;
@@ -833,19 +876,19 @@ var ModalDropdown = ({
833
876
  const isCaret = showCaret && !isHamburger;
834
877
  const containerStyle = useMemo(
835
878
  () => renderTrigger !== void 0 ? void 0 : [
836
- styles7.container,
837
- isHamburger ? styles7.containerHamburger : isCaret ? styles7.containerMenu : null,
879
+ styles8.container,
880
+ isHamburger ? styles8.containerHamburger : isCaret ? styles8.containerMenu : null,
838
881
  { borderColor: colors.border, backgroundColor: colors.surface }
839
882
  ],
840
883
  [colors.border, colors.surface, renderTrigger, isHamburger, isCaret]
841
884
  );
842
885
  const hamburgerStyle = useMemo(
843
- () => [styles7.hamburger, { color: colors.textSecondary }],
886
+ () => [styles8.hamburger, { color: colors.textSecondary }],
844
887
  [colors.textSecondary]
845
888
  );
846
889
  const caretStyle = useMemo(
847
890
  () => [
848
- styles7.caret,
891
+ styles8.caret,
849
892
  { color: colors.textSecondary, transform: [{ rotate: isOpen ? CARET_OPEN_ROTATION : CARET_CLOSED_ROTATION }] }
850
893
  ],
851
894
  [colors.textSecondary, isOpen]
@@ -855,11 +898,11 @@ var ModalDropdown = ({
855
898
  [optionTestID, testID]
856
899
  );
857
900
  const anchorStyle = useMemo(
858
- () => [styles7.anchor, buildAnchorStackStyle(isMenu && isOpen)],
901
+ () => [styles8.anchor, buildAnchorStackStyle(isMenu && isOpen)],
859
902
  [isMenu, isOpen]
860
903
  );
861
904
  const modalContentStyle = useMemo(
862
- () => [styles7.modalContent, { backgroundColor: colors.surface }],
905
+ () => [styles8.modalContent, { backgroundColor: colors.surface }],
863
906
  [colors.surface]
864
907
  );
865
908
  const renderModalOption = useCallback(
@@ -879,11 +922,11 @@ var ModalDropdown = ({
879
922
  /* @__PURE__ */ jsxs(TouchableOpacity, { ...a11yProps, style: containerStyle, onPress: handleToggle, children: [
880
923
  renderTrigger !== void 0 ? renderTrigger({ label: selectedLabel, isOpen }) : isHamburger ? /* @__PURE__ */ jsxs(Fragment, { children: [
881
924
  /* @__PURE__ */ jsx(Text, { style: hamburgerStyle, children: HAMBURGER_GLYPH }),
882
- /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [styles7.selectedText, styles7.selectedTextMenu, { color: colors.text }], children: selectedLabel })
925
+ /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [styles8.selectedText, styles8.selectedTextMenu, { color: colors.text }], children: selectedLabel })
883
926
  ] }) : isCaret ? /* @__PURE__ */ jsxs(Fragment, { children: [
884
- /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [styles7.selectedText, styles7.selectedTextMenu, { color: colors.text }], children: selectedLabel }),
927
+ /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [styles8.selectedText, styles8.selectedTextMenu, { color: colors.text }], children: selectedLabel }),
885
928
  /* @__PURE__ */ jsx(Text, { style: caretStyle, children: CARET_GLYPH })
886
- ] }) : /* @__PURE__ */ jsx(Text, { style: [styles7.selectedText, { color: colors.text }], children: selectedLabel }),
929
+ ] }) : /* @__PURE__ */ jsx(Text, { style: [styles8.selectedText, { color: colors.text }], children: selectedLabel }),
887
930
  hintNode
888
931
  ] }),
889
932
  isMenu && menuAnim.mounted ? /* @__PURE__ */ jsx(
@@ -893,6 +936,7 @@ var ModalDropdown = ({
893
936
  animatedStyle: menuAnim.style,
894
937
  containerRef: anchorRef,
895
938
  isOpen,
939
+ menuHeading,
896
940
  menuMinWidth,
897
941
  optionTestID: optionTestIDFor,
898
942
  options,
@@ -902,7 +946,7 @@ var ModalDropdown = ({
902
946
  onSelect: handleSelect
903
947
  }
904
948
  ) : null,
905
- !isMenu ? /* @__PURE__ */ jsx(Modal, { transparent: true, visible: modalAnim.mounted, onRequestClose: handleClose, children: /* @__PURE__ */ jsxs(View, { style: styles7.modalOverlay, children: [
949
+ !isMenu ? /* @__PURE__ */ jsx(Modal, { transparent: true, visible: modalAnim.mounted, onRequestClose: handleClose, children: /* @__PURE__ */ jsxs(View, { style: styles8.modalOverlay, children: [
906
950
  /* @__PURE__ */ jsx(
907
951
  TouchableOpacity,
908
952
  {
@@ -921,10 +965,18 @@ var ModalDropdown = ({
921
965
  {
922
966
  ref: dialogRef,
923
967
  accessibilityViewIsModal: true,
924
- "aria-label": accessibilityLabel,
968
+ "aria-label": menuHeading ?? accessibilityLabel,
925
969
  role: "dialog",
926
970
  style: [modalContentStyle, modalAnim.style],
927
- children: /* @__PURE__ */ jsx(FlatList, { data: [...options], keyExtractor, renderItem: renderModalOption })
971
+ children: /* @__PURE__ */ jsx(
972
+ FlatList,
973
+ {
974
+ data: [...options],
975
+ keyExtractor,
976
+ ListHeaderComponent: menuHeading !== void 0 ? /* @__PURE__ */ jsx(MenuHeading, { testID, text: menuHeading }) : null,
977
+ renderItem: renderModalOption
978
+ }
979
+ )
928
980
  }
929
981
  )
930
982
  ] }) }) : null
@@ -987,7 +1039,7 @@ var ROW_PAD_V = 8;
987
1039
  var PANEL_PAD_TOP = 16;
988
1040
  var BORDER_WIDTH5 = 1;
989
1041
  var TEXT_ON_PRIMARY = "#ffffff";
990
- var styles8 = StyleSheet.create({
1042
+ var styles9 = StyleSheet.create({
991
1043
  root: {
992
1044
  width: "100%"
993
1045
  },
@@ -1041,7 +1093,7 @@ var WideTabStrip = ({
1041
1093
  textSecondary,
1042
1094
  surfaceElevated,
1043
1095
  stripStyle
1044
- }) => /* @__PURE__ */ jsx(View, { style: [styles8.stripOuter, { borderBottomColor: borderColor }], children: /* @__PURE__ */ jsx(ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, children: /* @__PURE__ */ jsx(View, { accessibilityRole: "tablist", "aria-label": accessibilityLabel, style: [styles8.strip, stripStyle], children: tabs.map((tab) => {
1096
+ }) => /* @__PURE__ */ jsx(View, { style: [styles9.stripOuter, { borderBottomColor: borderColor }], children: /* @__PURE__ */ jsx(ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, children: /* @__PURE__ */ jsx(View, { accessibilityRole: "tablist", "aria-label": accessibilityLabel, style: [styles9.strip, stripStyle], children: tabs.map((tab) => {
1045
1097
  const selected = tab.key === activeKey;
1046
1098
  const textColor = selected ? TEXT_ON_PRIMARY : textSecondary;
1047
1099
  const pillColor = selected ? primaryColor : surfaceElevated;
@@ -1055,10 +1107,10 @@ var WideTabStrip = ({
1055
1107
  accessibilityLabel: tab.accessibilityLabel ?? tab.label,
1056
1108
  accessibilityHint: tab.accessibilityHint,
1057
1109
  onPress: () => onChange(tab.key),
1058
- style: [styles8.pill, { backgroundColor: pillColor }],
1110
+ style: [styles9.pill, { backgroundColor: pillColor }],
1059
1111
  testID: tab.testID,
1060
1112
  ...ariaTabProps(selected, panelId, tabId),
1061
- children: /* @__PURE__ */ jsx(Text, { style: [styles8.pillText, { color: textColor }], children: tab.label })
1113
+ children: /* @__PURE__ */ jsx(Text, { style: [styles9.pillText, { color: textColor }], children: tab.label })
1062
1114
  },
1063
1115
  tab.key
1064
1116
  );
@@ -1083,7 +1135,7 @@ var Tabs = ({
1083
1135
  const activePanelId = `${idPrefix}-panel-${activeKey}`;
1084
1136
  const activeTabId = `${idPrefix}-tab-${activeKey}`;
1085
1137
  const panelAria = { "aria-labelledby": activeTabId, id: activePanelId };
1086
- return /* @__PURE__ */ jsxs(View, { style: [styles8.root, style], testID, children: [
1138
+ return /* @__PURE__ */ jsxs(View, { style: [styles9.root, style], testID, children: [
1087
1139
  collapsed ? /* @__PURE__ */ jsx(
1088
1140
  TabsMenu,
1089
1141
  {
@@ -1110,7 +1162,7 @@ var Tabs = ({
1110
1162
  onChange
1111
1163
  }
1112
1164
  ),
1113
- /* @__PURE__ */ jsx(View, { accessibilityRole: "none", style: [styles8.panel, panelStyle], ...panelAria, children })
1165
+ /* @__PURE__ */ jsx(View, { accessibilityRole: "none", style: [styles9.panel, panelStyle], ...panelAria, children })
1114
1166
  ] });
1115
1167
  };
1116
1168
  var PROMPT_PADDING = 20;
@@ -1125,7 +1177,7 @@ var DISMISS_FONT_SIZE = 13;
1125
1177
  var TITLE_MARGIN_BOTTOM = 8;
1126
1178
  var MESSAGE_MARGIN_BOTTOM = 16;
1127
1179
  var CTA_MARGIN_BOTTOM = 8;
1128
- var styles9 = StyleSheet.create({
1180
+ var styles10 = StyleSheet.create({
1129
1181
  container: {
1130
1182
  padding: PROMPT_PADDING,
1131
1183
  borderRadius: PROMPT_BORDER_RADIUS,
@@ -1160,21 +1212,21 @@ var UpgradePrompt = ({
1160
1212
  return /* @__PURE__ */ jsxs(
1161
1213
  View,
1162
1214
  {
1163
- style: [styles9.container, { borderColor: primary, backgroundColor: colors.surface }],
1215
+ style: [styles10.container, { borderColor: primary, backgroundColor: colors.surface }],
1164
1216
  testID: LAYOUT_TEST_IDS.upgradePrompt,
1165
1217
  children: [
1166
- /* @__PURE__ */ jsx(Text, { style: [styles9.title, { color: colors.text }], children: t(LAYOUT_I18N.upgradePromptTitle) }),
1167
- /* @__PURE__ */ jsx(Text, { style: [styles9.message, { color: colors.textSecondary }], children: t(LAYOUT_I18N.upgradePromptMessage, requiredTier, currentTier) }),
1218
+ /* @__PURE__ */ jsx(Text, { style: [styles10.title, { color: colors.text }], children: t(LAYOUT_I18N.upgradePromptTitle) }),
1219
+ /* @__PURE__ */ jsx(Text, { style: [styles10.message, { color: colors.textSecondary }], children: t(LAYOUT_I18N.upgradePromptMessage, requiredTier, currentTier) }),
1168
1220
  /* @__PURE__ */ jsx(
1169
1221
  TouchableOpacity,
1170
1222
  {
1171
1223
  accessibilityHint: t(LAYOUT_I18N.upgradePromptCtaHint),
1172
1224
  accessibilityLabel: t(LAYOUT_I18N.upgradePromptCta),
1173
1225
  accessibilityRole: "button",
1174
- style: [styles9.cta, { backgroundColor: primary }],
1226
+ style: [styles10.cta, { backgroundColor: primary }],
1175
1227
  testID: LAYOUT_TEST_IDS.upgradePromptCta,
1176
1228
  onPress: handleUpgradePress,
1177
- children: /* @__PURE__ */ jsx(Text, { style: [styles9.ctaText, { color: colors.surface }], children: t(LAYOUT_I18N.upgradePromptCta) })
1229
+ children: /* @__PURE__ */ jsx(Text, { style: [styles10.ctaText, { color: colors.surface }], children: t(LAYOUT_I18N.upgradePromptCta) })
1178
1230
  }
1179
1231
  ),
1180
1232
  onDismiss ? /* @__PURE__ */ jsx(
@@ -1183,10 +1235,10 @@ var UpgradePrompt = ({
1183
1235
  accessibilityHint: t(LAYOUT_I18N.upgradePromptDismissHint),
1184
1236
  accessibilityLabel: t(LAYOUT_I18N.upgradePromptDismiss),
1185
1237
  accessibilityRole: "button",
1186
- style: styles9.dismiss,
1238
+ style: styles10.dismiss,
1187
1239
  testID: LAYOUT_TEST_IDS.upgradePromptDismiss,
1188
1240
  onPress: onDismiss,
1189
- children: /* @__PURE__ */ jsx(Text, { style: [styles9.dismissText, { color: colors.textSecondary }], children: t(LAYOUT_I18N.upgradePromptDismiss) })
1241
+ children: /* @__PURE__ */ jsx(Text, { style: [styles10.dismissText, { color: colors.textSecondary }], children: t(LAYOUT_I18N.upgradePromptDismiss) })
1190
1242
  }
1191
1243
  ) : null
1192
1244
  ]
@@ -1195,7 +1247,7 @@ var UpgradePrompt = ({
1195
1247
  };
1196
1248
  var CLOSE_ICON_SIZE = 18;
1197
1249
  var PANEL_ENTER_SCALE = 0.96;
1198
- var styles10 = StyleSheet.create({
1250
+ var styles11 = StyleSheet.create({
1199
1251
  animatedFill: { flex: 1 },
1200
1252
  container: {
1201
1253
  flex: 1,
@@ -1222,7 +1274,7 @@ var ModalShell = ({
1222
1274
  const { theme, t } = useUi();
1223
1275
  const { style: sheetStyle, mounted } = useEnterExit({ visible, fromScale: PANEL_ENTER_SCALE });
1224
1276
  const containerStyle = React10.useMemo(
1225
- () => [styles10.container, { backgroundColor: theme.colors.background }, contentStyle],
1277
+ () => [styles11.container, { backgroundColor: theme.colors.background }, contentStyle],
1226
1278
  [theme.colors.background, contentStyle]
1227
1279
  );
1228
1280
  const closeA11yLabel = t(LAYOUT_I18N.close);
@@ -1234,7 +1286,7 @@ var ModalShell = ({
1234
1286
  testID: LAYOUT_TEST_IDS.modalShell,
1235
1287
  visible: mounted,
1236
1288
  onRequestClose: onCancel,
1237
- children: /* @__PURE__ */ jsx(Animated.View, { style: [styles10.animatedFill, sheetStyle], children: /* @__PURE__ */ jsxs(
1289
+ children: /* @__PURE__ */ jsx(Animated.View, { style: [styles11.animatedFill, sheetStyle], children: /* @__PURE__ */ jsxs(
1238
1290
  ScrollView,
1239
1291
  {
1240
1292
  accessibilityViewIsModal: true,
@@ -1242,7 +1294,7 @@ var ModalShell = ({
1242
1294
  role: "dialog",
1243
1295
  style: containerStyle,
1244
1296
  children: [
1245
- /* @__PURE__ */ jsxs(View, { style: styles10.headerRow, children: [
1297
+ /* @__PURE__ */ jsxs(View, { style: styles11.headerRow, children: [
1246
1298
  /* @__PURE__ */ jsx(Heading, { children: title ?? t(LAYOUT_I18N.closeHeading) }),
1247
1299
  showClose ? /* @__PURE__ */ jsx(
1248
1300
  TouchableOpacity,
@@ -1250,7 +1302,7 @@ var ModalShell = ({
1250
1302
  accessibilityHint: t(LAYOUT_I18N.closeDialogHint),
1251
1303
  accessibilityLabel: closeA11yLabel,
1252
1304
  accessibilityRole: "button",
1253
- style: styles10.closeButton,
1305
+ style: styles11.closeButton,
1254
1306
  testID: LAYOUT_TEST_IDS.modalShellClose,
1255
1307
  onPress: onCancel,
1256
1308
  children: /* @__PURE__ */ jsx(SvgIcon, { color: theme.colors.textSecondary, name: "close", size: CLOSE_ICON_SIZE })
@@ -1296,7 +1348,7 @@ var HEADER_MARGIN = 12;
1296
1348
  var DIALOG_MAX_HEIGHT = "90%";
1297
1349
  var PANEL_ENTER_SCALE2 = 0.96;
1298
1350
  var SIZE_MAX_WIDTH = { sm: 360, md: 480, lg: 640 };
1299
- var styles11 = StyleSheet.create({
1351
+ var styles12 = StyleSheet.create({
1300
1352
  overlay: {
1301
1353
  flex: 1,
1302
1354
  justifyContent: "center",
@@ -1334,28 +1386,29 @@ var Modal3 = ({
1334
1386
  size = "md",
1335
1387
  showClose = true,
1336
1388
  testID = LAYOUT_TEST_IDS.modal,
1337
- accessibilityLabel
1389
+ accessibilityLabel,
1390
+ initialFocusTestID
1338
1391
  }) => {
1339
1392
  const { theme, t } = useUi();
1340
1393
  const dialogRef = useRef(null);
1341
1394
  const backdrop = useEnterExit({ visible });
1342
1395
  const panel = useEnterExit({ visible, fromScale: PANEL_ENTER_SCALE2 });
1343
1396
  const mounted = panel.mounted || backdrop.mounted;
1344
- useFocusTrap(dialogRef, visible);
1397
+ useFocusTrap(dialogRef, visible, initialFocusTestID);
1345
1398
  useEscapeKey(visible, onClose);
1346
1399
  useScrollLock(visible);
1347
1400
  const accessibleName = accessibilityLabel ?? title ?? t(LAYOUT_I18N.dialog);
1348
1401
  const closeLabel = t(LAYOUT_I18N.dialogClose);
1349
1402
  const dialogStyle = useMemo(
1350
- () => [styles11.dialog, { backgroundColor: theme.colors.surface, maxWidth: SIZE_MAX_WIDTH[size] }],
1403
+ () => [styles12.dialog, { backgroundColor: theme.colors.surface, maxWidth: SIZE_MAX_WIDTH[size] }],
1351
1404
  [theme.colors.surface, size]
1352
1405
  );
1353
1406
  const hasHeader = title !== void 0 || showClose;
1354
- return /* @__PURE__ */ jsx(Modal, { transparent: true, visible: mounted, onRequestClose: onClose, children: /* @__PURE__ */ jsxs(View, { style: styles11.overlay, children: [
1407
+ return /* @__PURE__ */ jsx(Modal, { transparent: true, visible: mounted, onRequestClose: onClose, children: /* @__PURE__ */ jsxs(View, { style: styles12.overlay, children: [
1355
1408
  /* @__PURE__ */ jsx(
1356
1409
  Animated.View,
1357
1410
  {
1358
- style: [StyleSheet.absoluteFill, styles11.scrim, { opacity: backdrop.style.opacity }]
1411
+ style: [StyleSheet.absoluteFill, styles12.scrim, { opacity: backdrop.style.opacity }]
1359
1412
  }
1360
1413
  ),
1361
1414
  /* @__PURE__ */ jsx(
@@ -1381,8 +1434,8 @@ var Modal3 = ({
1381
1434
  style: [dialogStyle, panel.style],
1382
1435
  testID,
1383
1436
  children: [
1384
- hasHeader ? /* @__PURE__ */ jsxs(View, { style: styles11.headerRow, children: [
1385
- /* @__PURE__ */ jsx(View, { style: styles11.titleWrap, children: title !== void 0 ? /* @__PURE__ */ jsx(Heading, { children: title }) : null }),
1437
+ hasHeader ? /* @__PURE__ */ jsxs(View, { style: styles12.headerRow, children: [
1438
+ /* @__PURE__ */ jsx(View, { style: styles12.titleWrap, children: title !== void 0 ? /* @__PURE__ */ jsx(Heading, { children: title }) : null }),
1386
1439
  showClose ? /* @__PURE__ */ jsx(
1387
1440
  IconButton,
1388
1441
  {
@@ -1399,7 +1452,7 @@ var Modal3 = ({
1399
1452
  ) : null
1400
1453
  ] }) : null,
1401
1454
  /* @__PURE__ */ jsx(ScrollView, { children }),
1402
- footer !== void 0 ? /* @__PURE__ */ jsx(View, { style: styles11.footer, children: footer }) : null
1455
+ footer !== void 0 ? /* @__PURE__ */ jsx(View, { style: styles12.footer, children: footer }) : null
1403
1456
  ]
1404
1457
  }
1405
1458
  )
@@ -1408,7 +1461,7 @@ var Modal3 = ({
1408
1461
  var MESSAGE_FONT_SIZE2 = 14;
1409
1462
  var MESSAGE_LINE_HEIGHT = 20;
1410
1463
  var BUTTON_GAP = 12;
1411
- var styles12 = StyleSheet.create({
1464
+ var styles13 = StyleSheet.create({
1412
1465
  message: { fontSize: MESSAGE_FONT_SIZE2, lineHeight: MESSAGE_LINE_HEIGHT },
1413
1466
  footer: { flexDirection: "row", justifyContent: "flex-end", columnGap: BUTTON_GAP }
1414
1467
  });
@@ -1427,7 +1480,7 @@ var ConfirmDialog = ({
1427
1480
  const { theme, t } = useUi();
1428
1481
  const resolvedConfirm = confirmLabel ?? t(LAYOUT_I18N.confirm);
1429
1482
  const resolvedCancel = cancelLabel ?? t(LAYOUT_I18N.cancel);
1430
- const footer = /* @__PURE__ */ jsxs(View, { style: styles12.footer, children: [
1483
+ const footer = /* @__PURE__ */ jsxs(View, { style: styles13.footer, children: [
1431
1484
  /* @__PURE__ */ jsx(
1432
1485
  Button,
1433
1486
  {
@@ -1463,7 +1516,7 @@ var ConfirmDialog = ({
1463
1516
  title,
1464
1517
  visible,
1465
1518
  onClose: onCancel,
1466
- children: /* @__PURE__ */ jsx(Text, { style: [styles12.message, { color: theme.colors.text }], testID: `${testID}-message`, children: message })
1519
+ children: /* @__PURE__ */ jsx(Text, { style: [styles13.message, { color: theme.colors.text }], testID: `${testID}-message`, children: message })
1467
1520
  }
1468
1521
  );
1469
1522
  };
@@ -1476,7 +1529,7 @@ function useAccordionContext() {
1476
1529
  return value;
1477
1530
  }
1478
1531
  var BOXED_GAP = 12;
1479
- var styles13 = StyleSheet.create({
1532
+ var styles14 = StyleSheet.create({
1480
1533
  container: { alignSelf: "stretch" },
1481
1534
  boxed: { gap: BOXED_GAP }
1482
1535
  });
@@ -1533,7 +1586,7 @@ var Accordion = ({
1533
1586
  [openSet, toggle, allowMultiple, variant]
1534
1587
  );
1535
1588
  const containerStyle = useMemo(() => {
1536
- const base = variant === "boxed" ? [styles13.container, styles13.boxed] : [styles13.container];
1589
+ const base = variant === "boxed" ? [styles14.container, styles14.boxed] : [styles14.container];
1537
1590
  if (style === void 0) return base;
1538
1591
  return [...base, ...Array.isArray(style) ? style : [style]];
1539
1592
  }, [style, variant]);
@@ -1565,7 +1618,7 @@ var BOX_TITLE_FONT_SIZE = 14;
1565
1618
  var BOX_MARKER_FONT_SIZE = 13;
1566
1619
  var BOX_MARKER_GAP = 6;
1567
1620
  var BOX_MARKER = "\u25B8";
1568
- var styles14 = StyleSheet.create({
1621
+ var styles15 = StyleSheet.create({
1569
1622
  item: { borderTopWidth: StyleSheet.hairlineWidth },
1570
1623
  boxItem: { borderWidth: 1, borderRadius: BOX_BORDER_RADIUS, paddingHorizontal: BOX_PADDING_H },
1571
1624
  header: {
@@ -1641,19 +1694,19 @@ var AccordionItem = ({
1641
1694
  );
1642
1695
  const keyboardProps = Platform.OS === "web" ? { onKeyDown: handleKeyDown2 } : {};
1643
1696
  const itemStyle = useMemo(
1644
- () => boxed ? [styles14.boxItem, { borderColor: colors.border }] : [styles14.item, { borderTopColor: colors.border }],
1697
+ () => boxed ? [styles15.boxItem, { borderColor: colors.border }] : [styles15.item, { borderTopColor: colors.border }],
1645
1698
  [boxed, colors.border]
1646
1699
  );
1647
1700
  const headerStyle = useMemo(
1648
1701
  () => [
1649
- styles14.header,
1650
- ...boxed ? [styles14.boxHeader] : [],
1702
+ styles15.header,
1703
+ ...boxed ? [styles15.boxHeader] : [],
1651
1704
  { opacity: disabled ? DISABLED_OPACITY : FULL_OPACITY }
1652
1705
  ],
1653
1706
  [boxed, disabled]
1654
1707
  );
1655
1708
  const resolvedLabel = accessibilityLabel ?? (typeof title === "string" ? title : void 0);
1656
- const titleNode = typeof title === "string" ? /* @__PURE__ */ jsx(Text, { style: [boxed ? styles14.boxTitle : styles14.title, { color: boxed ? colors.textSecondary : colors.text }], children: title }) : title;
1709
+ const titleNode = typeof title === "string" ? /* @__PURE__ */ jsx(Text, { style: [boxed ? styles15.boxTitle : styles15.title, { color: boxed ? colors.textSecondary : colors.text }], children: title }) : title;
1657
1710
  return /* @__PURE__ */ jsxs(View, { style: itemStyle, children: [
1658
1711
  /* @__PURE__ */ jsxs(
1659
1712
  Pressable,
@@ -1670,7 +1723,7 @@ var AccordionItem = ({
1670
1723
  onPress: handlePress,
1671
1724
  ...keyboardProps,
1672
1725
  children: [
1673
- /* @__PURE__ */ jsxs(View, { style: [styles14.headerLeft, boxed ? styles14.headerLeftRow : null], children: [
1726
+ /* @__PURE__ */ jsxs(View, { style: [styles15.headerLeft, boxed ? styles15.headerLeftRow : null], children: [
1674
1727
  boxed ? (
1675
1728
  // Decorative — the open/closed state is already conveyed by aria-expanded on the header.
1676
1729
  /* @__PURE__ */ jsx(
@@ -1679,15 +1732,15 @@ var AccordionItem = ({
1679
1732
  accessibilityElementsHidden: true,
1680
1733
  "aria-hidden": true,
1681
1734
  importantForAccessibility: "no-hide-descendants",
1682
- style: [styles14.marker, { transform: [{ rotate }] }],
1735
+ style: [styles15.marker, { transform: [{ rotate }] }],
1683
1736
  testID: chevronTestID,
1684
- children: /* @__PURE__ */ jsx(Text, { style: [styles14.markerText, { color: colors.textSecondary }], children: BOX_MARKER })
1737
+ children: /* @__PURE__ */ jsx(Text, { style: [styles15.markerText, { color: colors.textSecondary }], children: BOX_MARKER })
1685
1738
  }
1686
1739
  )
1687
1740
  ) : null,
1688
1741
  titleNode
1689
1742
  ] }),
1690
- /* @__PURE__ */ jsxs(View, { style: styles14.headerRight, children: [
1743
+ /* @__PURE__ */ jsxs(View, { style: styles15.headerRight, children: [
1691
1744
  right,
1692
1745
  boxed ? null : /* @__PURE__ */ jsx(
1693
1746
  Animated.View,
@@ -1695,7 +1748,7 @@ var AccordionItem = ({
1695
1748
  accessibilityElementsHidden: true,
1696
1749
  "aria-hidden": true,
1697
1750
  importantForAccessibility: "no-hide-descendants",
1698
- style: [styles14.chevron, { transform: [{ rotate }] }],
1751
+ style: [styles15.chevron, { transform: [{ rotate }] }],
1699
1752
  children: /* @__PURE__ */ jsx(SvgIcon, { color: colors.textSecondary, name: "chevronDown", size: CHEVRON_SIZE, testID: chevronTestID })
1700
1753
  }
1701
1754
  )
@@ -1709,7 +1762,7 @@ var AccordionItem = ({
1709
1762
  accessibilityLabel: resolvedLabel,
1710
1763
  nativeID: bodyTestID,
1711
1764
  role: ROLE_REGION,
1712
- style: boxed ? styles14.boxBody : styles14.body,
1765
+ style: boxed ? styles15.boxBody : styles15.body,
1713
1766
  testID: bodyTestID,
1714
1767
  children
1715
1768
  }
@@ -1772,7 +1825,7 @@ function useAvailableWidth() {
1772
1825
  var AVG_CHAR_WIDTH_RATIO = 0.58;
1773
1826
  var DEFAULT_FONT_SIZE2 = 13;
1774
1827
  var UNMEASURED2 = 0;
1775
- var styles15 = StyleSheet.create({
1828
+ var styles16 = StyleSheet.create({
1776
1829
  base: { fontSize: DEFAULT_FONT_SIZE2 },
1777
1830
  /** `minWidth: 0` lets the text shrink inside a flex row instead of forcing the row wider. */
1778
1831
  fill: { flexShrink: 1, minWidth: 0 }
@@ -1803,7 +1856,7 @@ var TruncatedText = ({
1803
1856
  [value, measureRef]
1804
1857
  );
1805
1858
  const flatStyle = useMemo(
1806
- () => StyleSheet.flatten([styles15.base, style]),
1859
+ () => StyleSheet.flatten([styles16.base, style]),
1807
1860
  [style]
1808
1861
  );
1809
1862
  const fontSize = flatStyle.fontSize ?? DEFAULT_FONT_SIZE2;
@@ -1818,7 +1871,7 @@ var TruncatedText = ({
1818
1871
  ref: attachRef,
1819
1872
  onLayout,
1820
1873
  numberOfLines: 1,
1821
- style: [styles15.base, styles15.fill, style],
1874
+ style: [styles16.base, styles16.fill, style],
1822
1875
  testID,
1823
1876
  accessibilityRole: onPress !== void 0 || href !== void 0 ? "link" : "text",
1824
1877
  accessibilityLabel,
@@ -1921,7 +1974,7 @@ var LABEL_LETTER_SPACING = 0.4;
1921
1974
  var ACTION_PADDING_H = 6;
1922
1975
  var ACTION_PADDING_V = 2;
1923
1976
  var ACTION_RADIUS = 6;
1924
- var styles16 = StyleSheet.create({
1977
+ var styles17 = StyleSheet.create({
1925
1978
  cell: { gap: CELL_GAP },
1926
1979
  label: {
1927
1980
  fontSize: LABEL_FONT_SIZE,
@@ -1986,14 +2039,14 @@ var CopyableId = ({
1986
2039
  const { colors } = theme;
1987
2040
  const { status, copy } = useCopyToClipboard(value, writer);
1988
2041
  const action = useActionState(status);
1989
- return /* @__PURE__ */ jsxs(View, { style: [styles16.cell, style], testID, children: [
1990
- label !== void 0 && /* @__PURE__ */ jsx(Text, { style: [styles16.label, { color: colors.textSecondary }], children: label }),
1991
- /* @__PURE__ */ jsxs(View, { style: styles16.row, children: [
1992
- /* @__PURE__ */ jsx(View, { style: styles16.valueWrap, children: /* @__PURE__ */ jsx(
2042
+ return /* @__PURE__ */ jsxs(View, { style: [styles17.cell, style], testID, children: [
2043
+ label !== void 0 && /* @__PURE__ */ jsx(Text, { style: [styles17.label, { color: colors.textSecondary }], children: label }),
2044
+ /* @__PURE__ */ jsxs(View, { style: styles17.row, children: [
2045
+ /* @__PURE__ */ jsx(View, { style: styles17.valueWrap, children: /* @__PURE__ */ jsx(
1993
2046
  TruncatedText,
1994
2047
  {
1995
2048
  value,
1996
- style: [styles16.value, { color: colors.text }],
2049
+ style: [styles17.value, { color: colors.text }],
1997
2050
  testID: `${testID}-value`,
1998
2051
  accessibilityLabel: accessibilityLabel ?? value,
1999
2052
  accessibilityHint: t(LAYOUT_I18N.copyableIdHint)
@@ -2007,7 +2060,7 @@ var CopyableId = ({
2007
2060
  accessibilityLabel: t(action.key),
2008
2061
  accessibilityHint: t(LAYOUT_I18N.copyHint),
2009
2062
  testID: `${testID}-copy`,
2010
- style: [styles16.action, { color: action.color }],
2063
+ style: [styles17.action, { color: action.color }],
2011
2064
  children: t(action.key)
2012
2065
  }
2013
2066
  )
@@ -2062,7 +2115,7 @@ var FOOTER_PADDING_V = 6;
2062
2115
  var FOOTER_PADDING_H = 12;
2063
2116
  var FOOTER_FONT_SIZE = 11;
2064
2117
  var FOOTER_OPACITY = 0.75;
2065
- var styles17 = StyleSheet.create({
2118
+ var styles18 = StyleSheet.create({
2066
2119
  footer: {
2067
2120
  paddingVertical: FOOTER_PADDING_V,
2068
2121
  paddingHorizontal: FOOTER_PADDING_H,
@@ -2088,7 +2141,7 @@ var BuildInfoFooter = ({
2088
2141
  const commit = apiCommit ?? fetchedCommit;
2089
2142
  const label = formatBuildInfo(buildVersion, commit);
2090
2143
  const textStyle = useMemo(
2091
- () => [styles17.text, { color: theme.colors.textSecondary }],
2144
+ () => [styles18.text, { color: theme.colors.textSecondary }],
2092
2145
  [theme.colors.textSecondary]
2093
2146
  );
2094
2147
  return /* @__PURE__ */ jsx(
@@ -2096,7 +2149,7 @@ var BuildInfoFooter = ({
2096
2149
  {
2097
2150
  accessibilityLabel: accessibilityLabel ?? label,
2098
2151
  accessibilityHint: accessibilityHint ?? t(LAYOUT_I18N.buildInfoHint),
2099
- style: [styles17.footer, style],
2152
+ style: [styles18.footer, style],
2100
2153
  testID,
2101
2154
  children: /* @__PURE__ */ jsx(Text, { style: textStyle, children: label })
2102
2155
  }