@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.js CHANGED
@@ -284,6 +284,15 @@ function getFocusableElements(container) {
284
284
  function savePreviousFocus() {
285
285
  return document.activeElement instanceof HTMLElement ? document.activeElement : null;
286
286
  }
287
+ function focusInitial(domNode, initialFocusTestID) {
288
+ const named = initialFocusTestID === void 0 ? null : domNode.querySelector(`[data-testid="${initialFocusTestID}"]`);
289
+ if (named) {
290
+ named.focus();
291
+ return;
292
+ }
293
+ if (domNode.contains(document.activeElement)) return;
294
+ getFocusableElements(domNode)[0]?.focus();
295
+ }
287
296
  function handleKeyDown(domNode, event) {
288
297
  if (event.key !== "Tab") return;
289
298
  const focusable = getFocusableElements(domNode);
@@ -306,14 +315,15 @@ function handleKeyDown(domNode, event) {
306
315
  first.focus();
307
316
  }
308
317
  }
309
- function useFocusTrap(containerRef, enabled) {
318
+ function useFocusTrap(containerRef, enabled, initialFocusTestID) {
310
319
  const previousFocusRef = React10.useRef(null);
311
320
  React10.useEffect(() => {
312
321
  if (reactNative.Platform.OS !== "web" || !enabled) return;
313
322
  const domNode = containerRef.current;
314
323
  if (!domNode) return;
315
- previousFocusRef.current = savePreviousFocus();
316
- queueMicrotask(() => getFocusableElements(domNode)[0]?.focus());
324
+ const previous = savePreviousFocus();
325
+ previousFocusRef.current = previous !== null && domNode.contains(previous) ? null : previous;
326
+ queueMicrotask(() => focusInitial(domNode, initialFocusTestID));
317
327
  const listener = (e) => handleKeyDown(domNode, e);
318
328
  domNode.addEventListener("keydown", listener);
319
329
  return () => {
@@ -321,7 +331,7 @@ function useFocusTrap(containerRef, enabled) {
321
331
  previousFocusRef.current?.focus();
322
332
  previousFocusRef.current = null;
323
333
  };
324
- }, [containerRef, enabled]);
334
+ }, [containerRef, enabled, initialFocusTestID]);
325
335
  }
326
336
 
327
337
  // src/ModalDropdown/DropdownVariant.ts
@@ -376,12 +386,40 @@ function isAnchorHidden(rect, clip, minVisiblePx) {
376
386
  const visibleWidth = Math.min(rect.left + rect.width, clip.right) - Math.max(rect.left, clip.left);
377
387
  return visibleHeight < minVisiblePx || visibleWidth < minVisiblePx;
378
388
  }
389
+ var HEADING_FONT_SIZE = 12;
390
+ var HEADING_FONT_WEIGHT = "600";
391
+ var HEADING_PADDING_H = 16;
392
+ var HEADING_PADDING_TOP = 8;
393
+ var HEADING_PADDING_BOTTOM = 4;
394
+ var HEADING_LETTER_SPACING = 0.5;
395
+ var styles5 = reactNative.StyleSheet.create({
396
+ heading: {
397
+ fontSize: HEADING_FONT_SIZE,
398
+ fontWeight: HEADING_FONT_WEIGHT,
399
+ letterSpacing: HEADING_LETTER_SPACING,
400
+ paddingHorizontal: HEADING_PADDING_H,
401
+ paddingTop: HEADING_PADDING_TOP,
402
+ paddingBottom: HEADING_PADDING_BOTTOM
403
+ }
404
+ });
405
+ var MenuHeading = ({ testID, text }) => {
406
+ const { theme } = uiFeedback.useUi();
407
+ return /* @__PURE__ */ jsxRuntime.jsx(
408
+ reactNative.Text,
409
+ {
410
+ accessibilityRole: "header",
411
+ style: [styles5.heading, { color: theme.colors.textSecondary }],
412
+ testID: `${testID}-menu-heading`,
413
+ children: text
414
+ }
415
+ );
416
+ };
379
417
  var OPTION_BORDER_RADIUS = 4;
380
418
  var BODY_FONT_SIZE = 14;
381
419
  var SELECTED_FONT_WEIGHT = "600";
382
420
  var OPTION_PADDING_H = 16;
383
421
  var OPTION_PADDING_V = 12;
384
- var styles5 = reactNative.StyleSheet.create({
422
+ var styles6 = reactNative.StyleSheet.create({
385
423
  option: {
386
424
  paddingHorizontal: OPTION_PADDING_H,
387
425
  paddingVertical: OPTION_PADDING_V,
@@ -405,8 +443,8 @@ var OptionRow = ({
405
443
  onSelect();
406
444
  }, [onSelect]);
407
445
  const isActive = isSelected || isHighlighted;
408
- const rowStyle = [styles5.option, isActive ? { backgroundColor: colors.surfaceElevated } : null];
409
- const textStyle = [styles5.optionText, { color: colors.text }, isSelected ? styles5.selectedText : null];
446
+ const rowStyle = [styles6.option, isActive ? { backgroundColor: colors.surfaceElevated } : null];
447
+ const textStyle = [styles6.optionText, { color: colors.text }, isSelected ? styles6.selectedText : null];
410
448
  return /* @__PURE__ */ jsxRuntime.jsx(
411
449
  reactNative.TouchableOpacity,
412
450
  {
@@ -575,7 +613,7 @@ var IS_WEB2 = reactNative.Platform.OS === "web";
575
613
  var BORDER_RADIUS2 = 8;
576
614
  var BORDER_WIDTH3 = 1;
577
615
  var MENU_PADDING2 = 4;
578
- var styles6 = reactNative.StyleSheet.create({
616
+ var styles7 = reactNative.StyleSheet.create({
579
617
  /** Native (in-tree) popover — anchored absolutely just under the trigger. */
580
618
  popover: {
581
619
  position: "absolute",
@@ -610,6 +648,7 @@ var InlineMenu = ({
610
648
  isOpen,
611
649
  optionTestID,
612
650
  menuMinWidth = 0,
651
+ menuHeading,
613
652
  animatedStyle,
614
653
  onSelect,
615
654
  onClose
@@ -660,7 +699,7 @@ var InlineMenu = ({
660
699
  themed
661
700
  ];
662
701
  }
663
- return [styles6.popover, { minWidth: menuMinWidth }, themed];
702
+ return [styles7.popover, { minWidth: menuMinWidth }, themed];
664
703
  }, [colors.border, colors.surface, menuMinWidth, rect]);
665
704
  const menu = /* @__PURE__ */ jsxRuntime.jsx(
666
705
  reactNative.View,
@@ -668,25 +707,28 @@ var InlineMenu = ({
668
707
  ref: menuRef,
669
708
  accessibilityRole: "menu",
670
709
  "aria-hidden": !isOpen,
671
- "aria-label": accessibilityLabel,
710
+ "aria-label": menuHeading ?? accessibilityLabel,
672
711
  style: popoverStyle,
673
712
  testID: `${testID}-menu`,
674
- children: /* @__PURE__ */ jsxRuntime.jsx(
713
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
675
714
  reactNative.Animated.View,
676
715
  {
677
716
  pointerEvents: isOpen ? "auto" : "none",
678
- style: [styles6.animated, animatedStyle, isOpen ? null : styles6.inert],
679
- children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { style: styles6.scroll, keyboardShouldPersistTaps: "handled", children: options.map((option, index) => /* @__PURE__ */ jsxRuntime.jsx(
680
- OptionRow,
681
- {
682
- isHighlighted: index === highlightedIndex,
683
- isSelected: option.value === value,
684
- label: option.label,
685
- testID: optionTestID !== void 0 ? optionTestID(option.value) : `${testID}-option-${String(option.value)}`,
686
- onSelect: () => handleSelect(option.value)
687
- },
688
- String(option.value)
689
- )) })
717
+ style: [styles7.animated, animatedStyle, isOpen ? null : styles7.inert],
718
+ children: [
719
+ menuHeading !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(MenuHeading, { testID, text: menuHeading }) : null,
720
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { style: styles7.scroll, keyboardShouldPersistTaps: "handled", children: options.map((option, index) => /* @__PURE__ */ jsxRuntime.jsx(
721
+ OptionRow,
722
+ {
723
+ isHighlighted: index === highlightedIndex,
724
+ isSelected: option.value === value,
725
+ label: option.label,
726
+ testID: optionTestID !== void 0 ? optionTestID(option.value) : `${testID}-option-${String(option.value)}`,
727
+ onSelect: () => handleSelect(option.value)
728
+ },
729
+ String(option.value)
730
+ )) })
731
+ ]
690
732
  }
691
733
  )
692
734
  }
@@ -729,7 +771,7 @@ var CARET_OPEN_ROTATION = "180deg";
729
771
  var CARET_CLOSED_ROTATION = "0deg";
730
772
  var POPOVER_ENTER_SCALE = 0.96;
731
773
  var POPOVER_MOTION_MS = 120;
732
- var styles7 = reactNative.StyleSheet.create({
774
+ var styles8 = reactNative.StyleSheet.create({
733
775
  anchor: { position: "relative" },
734
776
  container: {
735
777
  borderWidth: BORDER_WIDTH4,
@@ -791,7 +833,8 @@ var ModalDropdown = ({
791
833
  optionTestID,
792
834
  menuMinWidth,
793
835
  showCaret = false,
794
- showHamburger = false
836
+ showHamburger = false,
837
+ menuHeading
795
838
  }) => {
796
839
  const { theme, t } = uiFeedback.useUi();
797
840
  const { colors } = theme;
@@ -839,19 +882,19 @@ var ModalDropdown = ({
839
882
  const isCaret = showCaret && !isHamburger;
840
883
  const containerStyle = React10.useMemo(
841
884
  () => renderTrigger !== void 0 ? void 0 : [
842
- styles7.container,
843
- isHamburger ? styles7.containerHamburger : isCaret ? styles7.containerMenu : null,
885
+ styles8.container,
886
+ isHamburger ? styles8.containerHamburger : isCaret ? styles8.containerMenu : null,
844
887
  { borderColor: colors.border, backgroundColor: colors.surface }
845
888
  ],
846
889
  [colors.border, colors.surface, renderTrigger, isHamburger, isCaret]
847
890
  );
848
891
  const hamburgerStyle = React10.useMemo(
849
- () => [styles7.hamburger, { color: colors.textSecondary }],
892
+ () => [styles8.hamburger, { color: colors.textSecondary }],
850
893
  [colors.textSecondary]
851
894
  );
852
895
  const caretStyle = React10.useMemo(
853
896
  () => [
854
- styles7.caret,
897
+ styles8.caret,
855
898
  { color: colors.textSecondary, transform: [{ rotate: isOpen ? CARET_OPEN_ROTATION : CARET_CLOSED_ROTATION }] }
856
899
  ],
857
900
  [colors.textSecondary, isOpen]
@@ -861,11 +904,11 @@ var ModalDropdown = ({
861
904
  [optionTestID, testID]
862
905
  );
863
906
  const anchorStyle = React10.useMemo(
864
- () => [styles7.anchor, buildAnchorStackStyle(isMenu && isOpen)],
907
+ () => [styles8.anchor, buildAnchorStackStyle(isMenu && isOpen)],
865
908
  [isMenu, isOpen]
866
909
  );
867
910
  const modalContentStyle = React10.useMemo(
868
- () => [styles7.modalContent, { backgroundColor: colors.surface }],
911
+ () => [styles8.modalContent, { backgroundColor: colors.surface }],
869
912
  [colors.surface]
870
913
  );
871
914
  const renderModalOption = React10.useCallback(
@@ -885,11 +928,11 @@ var ModalDropdown = ({
885
928
  /* @__PURE__ */ jsxRuntime.jsxs(reactNative.TouchableOpacity, { ...a11yProps, style: containerStyle, onPress: handleToggle, children: [
886
929
  renderTrigger !== void 0 ? renderTrigger({ label: selectedLabel, isOpen }) : isHamburger ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
887
930
  /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: hamburgerStyle, children: HAMBURGER_GLYPH }),
888
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [styles7.selectedText, styles7.selectedTextMenu, { color: colors.text }], children: selectedLabel })
931
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [styles8.selectedText, styles8.selectedTextMenu, { color: colors.text }], children: selectedLabel })
889
932
  ] }) : isCaret ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
890
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [styles7.selectedText, styles7.selectedTextMenu, { color: colors.text }], children: selectedLabel }),
933
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [styles8.selectedText, styles8.selectedTextMenu, { color: colors.text }], children: selectedLabel }),
891
934
  /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: caretStyle, children: CARET_GLYPH })
892
- ] }) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles7.selectedText, { color: colors.text }], children: selectedLabel }),
935
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles8.selectedText, { color: colors.text }], children: selectedLabel }),
893
936
  hintNode
894
937
  ] }),
895
938
  isMenu && menuAnim.mounted ? /* @__PURE__ */ jsxRuntime.jsx(
@@ -899,6 +942,7 @@ var ModalDropdown = ({
899
942
  animatedStyle: menuAnim.style,
900
943
  containerRef: anchorRef,
901
944
  isOpen,
945
+ menuHeading,
902
946
  menuMinWidth,
903
947
  optionTestID: optionTestIDFor,
904
948
  options,
@@ -908,7 +952,7 @@ var ModalDropdown = ({
908
952
  onSelect: handleSelect
909
953
  }
910
954
  ) : null,
911
- !isMenu ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, visible: modalAnim.mounted, onRequestClose: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles7.modalOverlay, children: [
955
+ !isMenu ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, visible: modalAnim.mounted, onRequestClose: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles8.modalOverlay, children: [
912
956
  /* @__PURE__ */ jsxRuntime.jsx(
913
957
  reactNative.TouchableOpacity,
914
958
  {
@@ -927,10 +971,18 @@ var ModalDropdown = ({
927
971
  {
928
972
  ref: dialogRef,
929
973
  accessibilityViewIsModal: true,
930
- "aria-label": accessibilityLabel,
974
+ "aria-label": menuHeading ?? accessibilityLabel,
931
975
  role: "dialog",
932
976
  style: [modalContentStyle, modalAnim.style],
933
- children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.FlatList, { data: [...options], keyExtractor, renderItem: renderModalOption })
977
+ children: /* @__PURE__ */ jsxRuntime.jsx(
978
+ reactNative.FlatList,
979
+ {
980
+ data: [...options],
981
+ keyExtractor,
982
+ ListHeaderComponent: menuHeading !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(MenuHeading, { testID, text: menuHeading }) : null,
983
+ renderItem: renderModalOption
984
+ }
985
+ )
934
986
  }
935
987
  )
936
988
  ] }) }) : null
@@ -993,7 +1045,7 @@ var ROW_PAD_V = 8;
993
1045
  var PANEL_PAD_TOP = 16;
994
1046
  var BORDER_WIDTH5 = 1;
995
1047
  var TEXT_ON_PRIMARY = "#ffffff";
996
- var styles8 = reactNative.StyleSheet.create({
1048
+ var styles9 = reactNative.StyleSheet.create({
997
1049
  root: {
998
1050
  width: "100%"
999
1051
  },
@@ -1047,7 +1099,7 @@ var WideTabStrip = ({
1047
1099
  textSecondary,
1048
1100
  surfaceElevated,
1049
1101
  stripStyle
1050
- }) => /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles8.stripOuter, { borderBottomColor: borderColor }], children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityRole: "tablist", "aria-label": accessibilityLabel, style: [styles8.strip, stripStyle], children: tabs.map((tab) => {
1102
+ }) => /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles9.stripOuter, { borderBottomColor: borderColor }], children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityRole: "tablist", "aria-label": accessibilityLabel, style: [styles9.strip, stripStyle], children: tabs.map((tab) => {
1051
1103
  const selected = tab.key === activeKey;
1052
1104
  const textColor = selected ? TEXT_ON_PRIMARY : textSecondary;
1053
1105
  const pillColor = selected ? primaryColor : surfaceElevated;
@@ -1061,10 +1113,10 @@ var WideTabStrip = ({
1061
1113
  accessibilityLabel: tab.accessibilityLabel ?? tab.label,
1062
1114
  accessibilityHint: tab.accessibilityHint,
1063
1115
  onPress: () => onChange(tab.key),
1064
- style: [styles8.pill, { backgroundColor: pillColor }],
1116
+ style: [styles9.pill, { backgroundColor: pillColor }],
1065
1117
  testID: tab.testID,
1066
1118
  ...ariaTabProps(selected, panelId, tabId),
1067
- children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles8.pillText, { color: textColor }], children: tab.label })
1119
+ children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles9.pillText, { color: textColor }], children: tab.label })
1068
1120
  },
1069
1121
  tab.key
1070
1122
  );
@@ -1089,7 +1141,7 @@ var Tabs = ({
1089
1141
  const activePanelId = `${idPrefix}-panel-${activeKey}`;
1090
1142
  const activeTabId = `${idPrefix}-tab-${activeKey}`;
1091
1143
  const panelAria = { "aria-labelledby": activeTabId, id: activePanelId };
1092
- return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles8.root, style], testID, children: [
1144
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles9.root, style], testID, children: [
1093
1145
  collapsed ? /* @__PURE__ */ jsxRuntime.jsx(
1094
1146
  TabsMenu,
1095
1147
  {
@@ -1116,7 +1168,7 @@ var Tabs = ({
1116
1168
  onChange
1117
1169
  }
1118
1170
  ),
1119
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityRole: "none", style: [styles8.panel, panelStyle], ...panelAria, children })
1171
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityRole: "none", style: [styles9.panel, panelStyle], ...panelAria, children })
1120
1172
  ] });
1121
1173
  };
1122
1174
  var PROMPT_PADDING = 20;
@@ -1131,7 +1183,7 @@ var DISMISS_FONT_SIZE = 13;
1131
1183
  var TITLE_MARGIN_BOTTOM = 8;
1132
1184
  var MESSAGE_MARGIN_BOTTOM = 16;
1133
1185
  var CTA_MARGIN_BOTTOM = 8;
1134
- var styles9 = reactNative.StyleSheet.create({
1186
+ var styles10 = reactNative.StyleSheet.create({
1135
1187
  container: {
1136
1188
  padding: PROMPT_PADDING,
1137
1189
  borderRadius: PROMPT_BORDER_RADIUS,
@@ -1166,21 +1218,21 @@ var UpgradePrompt = ({
1166
1218
  return /* @__PURE__ */ jsxRuntime.jsxs(
1167
1219
  reactNative.View,
1168
1220
  {
1169
- style: [styles9.container, { borderColor: primary, backgroundColor: colors.surface }],
1221
+ style: [styles10.container, { borderColor: primary, backgroundColor: colors.surface }],
1170
1222
  testID: LAYOUT_TEST_IDS.upgradePrompt,
1171
1223
  children: [
1172
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles9.title, { color: colors.text }], children: t(LAYOUT_I18N.upgradePromptTitle) }),
1173
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles9.message, { color: colors.textSecondary }], children: t(LAYOUT_I18N.upgradePromptMessage, requiredTier, currentTier) }),
1224
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles10.title, { color: colors.text }], children: t(LAYOUT_I18N.upgradePromptTitle) }),
1225
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles10.message, { color: colors.textSecondary }], children: t(LAYOUT_I18N.upgradePromptMessage, requiredTier, currentTier) }),
1174
1226
  /* @__PURE__ */ jsxRuntime.jsx(
1175
1227
  reactNative.TouchableOpacity,
1176
1228
  {
1177
1229
  accessibilityHint: t(LAYOUT_I18N.upgradePromptCtaHint),
1178
1230
  accessibilityLabel: t(LAYOUT_I18N.upgradePromptCta),
1179
1231
  accessibilityRole: "button",
1180
- style: [styles9.cta, { backgroundColor: primary }],
1232
+ style: [styles10.cta, { backgroundColor: primary }],
1181
1233
  testID: LAYOUT_TEST_IDS.upgradePromptCta,
1182
1234
  onPress: handleUpgradePress,
1183
- children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles9.ctaText, { color: colors.surface }], children: t(LAYOUT_I18N.upgradePromptCta) })
1235
+ children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles10.ctaText, { color: colors.surface }], children: t(LAYOUT_I18N.upgradePromptCta) })
1184
1236
  }
1185
1237
  ),
1186
1238
  onDismiss ? /* @__PURE__ */ jsxRuntime.jsx(
@@ -1189,10 +1241,10 @@ var UpgradePrompt = ({
1189
1241
  accessibilityHint: t(LAYOUT_I18N.upgradePromptDismissHint),
1190
1242
  accessibilityLabel: t(LAYOUT_I18N.upgradePromptDismiss),
1191
1243
  accessibilityRole: "button",
1192
- style: styles9.dismiss,
1244
+ style: styles10.dismiss,
1193
1245
  testID: LAYOUT_TEST_IDS.upgradePromptDismiss,
1194
1246
  onPress: onDismiss,
1195
- children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles9.dismissText, { color: colors.textSecondary }], children: t(LAYOUT_I18N.upgradePromptDismiss) })
1247
+ children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles10.dismissText, { color: colors.textSecondary }], children: t(LAYOUT_I18N.upgradePromptDismiss) })
1196
1248
  }
1197
1249
  ) : null
1198
1250
  ]
@@ -1201,7 +1253,7 @@ var UpgradePrompt = ({
1201
1253
  };
1202
1254
  var CLOSE_ICON_SIZE = 18;
1203
1255
  var PANEL_ENTER_SCALE = 0.96;
1204
- var styles10 = reactNative.StyleSheet.create({
1256
+ var styles11 = reactNative.StyleSheet.create({
1205
1257
  animatedFill: { flex: 1 },
1206
1258
  container: {
1207
1259
  flex: 1,
@@ -1228,7 +1280,7 @@ var ModalShell = ({
1228
1280
  const { theme, t } = uiFeedback.useUi();
1229
1281
  const { style: sheetStyle, mounted } = uiMotion.useEnterExit({ visible, fromScale: PANEL_ENTER_SCALE });
1230
1282
  const containerStyle = React10__default.default.useMemo(
1231
- () => [styles10.container, { backgroundColor: theme.colors.background }, contentStyle],
1283
+ () => [styles11.container, { backgroundColor: theme.colors.background }, contentStyle],
1232
1284
  [theme.colors.background, contentStyle]
1233
1285
  );
1234
1286
  const closeA11yLabel = t(LAYOUT_I18N.close);
@@ -1240,7 +1292,7 @@ var ModalShell = ({
1240
1292
  testID: LAYOUT_TEST_IDS.modalShell,
1241
1293
  visible: mounted,
1242
1294
  onRequestClose: onCancel,
1243
- children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Animated.View, { style: [styles10.animatedFill, sheetStyle], children: /* @__PURE__ */ jsxRuntime.jsxs(
1295
+ children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Animated.View, { style: [styles11.animatedFill, sheetStyle], children: /* @__PURE__ */ jsxRuntime.jsxs(
1244
1296
  reactNative.ScrollView,
1245
1297
  {
1246
1298
  accessibilityViewIsModal: true,
@@ -1248,7 +1300,7 @@ var ModalShell = ({
1248
1300
  role: "dialog",
1249
1301
  style: containerStyle,
1250
1302
  children: [
1251
- /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles10.headerRow, children: [
1303
+ /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles11.headerRow, children: [
1252
1304
  /* @__PURE__ */ jsxRuntime.jsx(Heading, { children: title ?? t(LAYOUT_I18N.closeHeading) }),
1253
1305
  showClose ? /* @__PURE__ */ jsxRuntime.jsx(
1254
1306
  reactNative.TouchableOpacity,
@@ -1256,7 +1308,7 @@ var ModalShell = ({
1256
1308
  accessibilityHint: t(LAYOUT_I18N.closeDialogHint),
1257
1309
  accessibilityLabel: closeA11yLabel,
1258
1310
  accessibilityRole: "button",
1259
- style: styles10.closeButton,
1311
+ style: styles11.closeButton,
1260
1312
  testID: LAYOUT_TEST_IDS.modalShellClose,
1261
1313
  onPress: onCancel,
1262
1314
  children: /* @__PURE__ */ jsxRuntime.jsx(uiIcons.SvgIcon, { color: theme.colors.textSecondary, name: "close", size: CLOSE_ICON_SIZE })
@@ -1302,7 +1354,7 @@ var HEADER_MARGIN = 12;
1302
1354
  var DIALOG_MAX_HEIGHT = "90%";
1303
1355
  var PANEL_ENTER_SCALE2 = 0.96;
1304
1356
  var SIZE_MAX_WIDTH = { sm: 360, md: 480, lg: 640 };
1305
- var styles11 = reactNative.StyleSheet.create({
1357
+ var styles12 = reactNative.StyleSheet.create({
1306
1358
  overlay: {
1307
1359
  flex: 1,
1308
1360
  justifyContent: "center",
@@ -1340,28 +1392,29 @@ var Modal3 = ({
1340
1392
  size = "md",
1341
1393
  showClose = true,
1342
1394
  testID = LAYOUT_TEST_IDS.modal,
1343
- accessibilityLabel
1395
+ accessibilityLabel,
1396
+ initialFocusTestID
1344
1397
  }) => {
1345
1398
  const { theme, t } = uiFeedback.useUi();
1346
1399
  const dialogRef = React10.useRef(null);
1347
1400
  const backdrop = uiMotion.useEnterExit({ visible });
1348
1401
  const panel = uiMotion.useEnterExit({ visible, fromScale: PANEL_ENTER_SCALE2 });
1349
1402
  const mounted = panel.mounted || backdrop.mounted;
1350
- useFocusTrap(dialogRef, visible);
1403
+ useFocusTrap(dialogRef, visible, initialFocusTestID);
1351
1404
  useEscapeKey(visible, onClose);
1352
1405
  useScrollLock(visible);
1353
1406
  const accessibleName = accessibilityLabel ?? title ?? t(LAYOUT_I18N.dialog);
1354
1407
  const closeLabel = t(LAYOUT_I18N.dialogClose);
1355
1408
  const dialogStyle = React10.useMemo(
1356
- () => [styles11.dialog, { backgroundColor: theme.colors.surface, maxWidth: SIZE_MAX_WIDTH[size] }],
1409
+ () => [styles12.dialog, { backgroundColor: theme.colors.surface, maxWidth: SIZE_MAX_WIDTH[size] }],
1357
1410
  [theme.colors.surface, size]
1358
1411
  );
1359
1412
  const hasHeader = title !== void 0 || showClose;
1360
- return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, visible: mounted, onRequestClose: onClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles11.overlay, children: [
1413
+ return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, visible: mounted, onRequestClose: onClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles12.overlay, children: [
1361
1414
  /* @__PURE__ */ jsxRuntime.jsx(
1362
1415
  reactNative.Animated.View,
1363
1416
  {
1364
- style: [reactNative.StyleSheet.absoluteFill, styles11.scrim, { opacity: backdrop.style.opacity }]
1417
+ style: [reactNative.StyleSheet.absoluteFill, styles12.scrim, { opacity: backdrop.style.opacity }]
1365
1418
  }
1366
1419
  ),
1367
1420
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -1387,8 +1440,8 @@ var Modal3 = ({
1387
1440
  style: [dialogStyle, panel.style],
1388
1441
  testID,
1389
1442
  children: [
1390
- hasHeader ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles11.headerRow, children: [
1391
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles11.titleWrap, children: title !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(Heading, { children: title }) : null }),
1443
+ hasHeader ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles12.headerRow, children: [
1444
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles12.titleWrap, children: title !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(Heading, { children: title }) : null }),
1392
1445
  showClose ? /* @__PURE__ */ jsxRuntime.jsx(
1393
1446
  uiButtons.IconButton,
1394
1447
  {
@@ -1405,7 +1458,7 @@ var Modal3 = ({
1405
1458
  ) : null
1406
1459
  ] }) : null,
1407
1460
  /* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { children }),
1408
- footer !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles11.footer, children: footer }) : null
1461
+ footer !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles12.footer, children: footer }) : null
1409
1462
  ]
1410
1463
  }
1411
1464
  )
@@ -1414,7 +1467,7 @@ var Modal3 = ({
1414
1467
  var MESSAGE_FONT_SIZE2 = 14;
1415
1468
  var MESSAGE_LINE_HEIGHT = 20;
1416
1469
  var BUTTON_GAP = 12;
1417
- var styles12 = reactNative.StyleSheet.create({
1470
+ var styles13 = reactNative.StyleSheet.create({
1418
1471
  message: { fontSize: MESSAGE_FONT_SIZE2, lineHeight: MESSAGE_LINE_HEIGHT },
1419
1472
  footer: { flexDirection: "row", justifyContent: "flex-end", columnGap: BUTTON_GAP }
1420
1473
  });
@@ -1433,7 +1486,7 @@ var ConfirmDialog = ({
1433
1486
  const { theme, t } = uiFeedback.useUi();
1434
1487
  const resolvedConfirm = confirmLabel ?? t(LAYOUT_I18N.confirm);
1435
1488
  const resolvedCancel = cancelLabel ?? t(LAYOUT_I18N.cancel);
1436
- const footer = /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles12.footer, children: [
1489
+ const footer = /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles13.footer, children: [
1437
1490
  /* @__PURE__ */ jsxRuntime.jsx(
1438
1491
  uiButtons.Button,
1439
1492
  {
@@ -1469,7 +1522,7 @@ var ConfirmDialog = ({
1469
1522
  title,
1470
1523
  visible,
1471
1524
  onClose: onCancel,
1472
- children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles12.message, { color: theme.colors.text }], testID: `${testID}-message`, children: message })
1525
+ children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles13.message, { color: theme.colors.text }], testID: `${testID}-message`, children: message })
1473
1526
  }
1474
1527
  );
1475
1528
  };
@@ -1482,7 +1535,7 @@ function useAccordionContext() {
1482
1535
  return value;
1483
1536
  }
1484
1537
  var BOXED_GAP = 12;
1485
- var styles13 = reactNative.StyleSheet.create({
1538
+ var styles14 = reactNative.StyleSheet.create({
1486
1539
  container: { alignSelf: "stretch" },
1487
1540
  boxed: { gap: BOXED_GAP }
1488
1541
  });
@@ -1539,7 +1592,7 @@ var Accordion = ({
1539
1592
  [openSet, toggle, allowMultiple, variant]
1540
1593
  );
1541
1594
  const containerStyle = React10.useMemo(() => {
1542
- const base = variant === "boxed" ? [styles13.container, styles13.boxed] : [styles13.container];
1595
+ const base = variant === "boxed" ? [styles14.container, styles14.boxed] : [styles14.container];
1543
1596
  if (style === void 0) return base;
1544
1597
  return [...base, ...Array.isArray(style) ? style : [style]];
1545
1598
  }, [style, variant]);
@@ -1571,7 +1624,7 @@ var BOX_TITLE_FONT_SIZE = 14;
1571
1624
  var BOX_MARKER_FONT_SIZE = 13;
1572
1625
  var BOX_MARKER_GAP = 6;
1573
1626
  var BOX_MARKER = "\u25B8";
1574
- var styles14 = reactNative.StyleSheet.create({
1627
+ var styles15 = reactNative.StyleSheet.create({
1575
1628
  item: { borderTopWidth: reactNative.StyleSheet.hairlineWidth },
1576
1629
  boxItem: { borderWidth: 1, borderRadius: BOX_BORDER_RADIUS, paddingHorizontal: BOX_PADDING_H },
1577
1630
  header: {
@@ -1647,19 +1700,19 @@ var AccordionItem = ({
1647
1700
  );
1648
1701
  const keyboardProps = reactNative.Platform.OS === "web" ? { onKeyDown: handleKeyDown2 } : {};
1649
1702
  const itemStyle = React10.useMemo(
1650
- () => boxed ? [styles14.boxItem, { borderColor: colors.border }] : [styles14.item, { borderTopColor: colors.border }],
1703
+ () => boxed ? [styles15.boxItem, { borderColor: colors.border }] : [styles15.item, { borderTopColor: colors.border }],
1651
1704
  [boxed, colors.border]
1652
1705
  );
1653
1706
  const headerStyle = React10.useMemo(
1654
1707
  () => [
1655
- styles14.header,
1656
- ...boxed ? [styles14.boxHeader] : [],
1708
+ styles15.header,
1709
+ ...boxed ? [styles15.boxHeader] : [],
1657
1710
  { opacity: disabled ? DISABLED_OPACITY : FULL_OPACITY }
1658
1711
  ],
1659
1712
  [boxed, disabled]
1660
1713
  );
1661
1714
  const resolvedLabel = accessibilityLabel ?? (typeof title === "string" ? title : void 0);
1662
- 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;
1715
+ const titleNode = typeof title === "string" ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [boxed ? styles15.boxTitle : styles15.title, { color: boxed ? colors.textSecondary : colors.text }], children: title }) : title;
1663
1716
  return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: itemStyle, children: [
1664
1717
  /* @__PURE__ */ jsxRuntime.jsxs(
1665
1718
  reactNative.Pressable,
@@ -1676,7 +1729,7 @@ var AccordionItem = ({
1676
1729
  onPress: handlePress,
1677
1730
  ...keyboardProps,
1678
1731
  children: [
1679
- /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles14.headerLeft, boxed ? styles14.headerLeftRow : null], children: [
1732
+ /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles15.headerLeft, boxed ? styles15.headerLeftRow : null], children: [
1680
1733
  boxed ? (
1681
1734
  // Decorative — the open/closed state is already conveyed by aria-expanded on the header.
1682
1735
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -1685,15 +1738,15 @@ var AccordionItem = ({
1685
1738
  accessibilityElementsHidden: true,
1686
1739
  "aria-hidden": true,
1687
1740
  importantForAccessibility: "no-hide-descendants",
1688
- style: [styles14.marker, { transform: [{ rotate }] }],
1741
+ style: [styles15.marker, { transform: [{ rotate }] }],
1689
1742
  testID: chevronTestID,
1690
- children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles14.markerText, { color: colors.textSecondary }], children: BOX_MARKER })
1743
+ children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles15.markerText, { color: colors.textSecondary }], children: BOX_MARKER })
1691
1744
  }
1692
1745
  )
1693
1746
  ) : null,
1694
1747
  titleNode
1695
1748
  ] }),
1696
- /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles14.headerRight, children: [
1749
+ /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles15.headerRight, children: [
1697
1750
  right,
1698
1751
  boxed ? null : /* @__PURE__ */ jsxRuntime.jsx(
1699
1752
  reactNative.Animated.View,
@@ -1701,7 +1754,7 @@ var AccordionItem = ({
1701
1754
  accessibilityElementsHidden: true,
1702
1755
  "aria-hidden": true,
1703
1756
  importantForAccessibility: "no-hide-descendants",
1704
- style: [styles14.chevron, { transform: [{ rotate }] }],
1757
+ style: [styles15.chevron, { transform: [{ rotate }] }],
1705
1758
  children: /* @__PURE__ */ jsxRuntime.jsx(uiIcons.SvgIcon, { color: colors.textSecondary, name: "chevronDown", size: CHEVRON_SIZE, testID: chevronTestID })
1706
1759
  }
1707
1760
  )
@@ -1715,7 +1768,7 @@ var AccordionItem = ({
1715
1768
  accessibilityLabel: resolvedLabel,
1716
1769
  nativeID: bodyTestID,
1717
1770
  role: ROLE_REGION,
1718
- style: boxed ? styles14.boxBody : styles14.body,
1771
+ style: boxed ? styles15.boxBody : styles15.body,
1719
1772
  testID: bodyTestID,
1720
1773
  children
1721
1774
  }
@@ -1778,7 +1831,7 @@ function useAvailableWidth() {
1778
1831
  var AVG_CHAR_WIDTH_RATIO = 0.58;
1779
1832
  var DEFAULT_FONT_SIZE2 = 13;
1780
1833
  var UNMEASURED2 = 0;
1781
- var styles15 = reactNative.StyleSheet.create({
1834
+ var styles16 = reactNative.StyleSheet.create({
1782
1835
  base: { fontSize: DEFAULT_FONT_SIZE2 },
1783
1836
  /** `minWidth: 0` lets the text shrink inside a flex row instead of forcing the row wider. */
1784
1837
  fill: { flexShrink: 1, minWidth: 0 }
@@ -1809,7 +1862,7 @@ var TruncatedText = ({
1809
1862
  [value, measureRef]
1810
1863
  );
1811
1864
  const flatStyle = React10.useMemo(
1812
- () => reactNative.StyleSheet.flatten([styles15.base, style]),
1865
+ () => reactNative.StyleSheet.flatten([styles16.base, style]),
1813
1866
  [style]
1814
1867
  );
1815
1868
  const fontSize = flatStyle.fontSize ?? DEFAULT_FONT_SIZE2;
@@ -1824,7 +1877,7 @@ var TruncatedText = ({
1824
1877
  ref: attachRef,
1825
1878
  onLayout,
1826
1879
  numberOfLines: 1,
1827
- style: [styles15.base, styles15.fill, style],
1880
+ style: [styles16.base, styles16.fill, style],
1828
1881
  testID,
1829
1882
  accessibilityRole: onPress !== void 0 || href !== void 0 ? "link" : "text",
1830
1883
  accessibilityLabel,
@@ -1927,7 +1980,7 @@ var LABEL_LETTER_SPACING = 0.4;
1927
1980
  var ACTION_PADDING_H = 6;
1928
1981
  var ACTION_PADDING_V = 2;
1929
1982
  var ACTION_RADIUS = 6;
1930
- var styles16 = reactNative.StyleSheet.create({
1983
+ var styles17 = reactNative.StyleSheet.create({
1931
1984
  cell: { gap: CELL_GAP },
1932
1985
  label: {
1933
1986
  fontSize: LABEL_FONT_SIZE,
@@ -1992,14 +2045,14 @@ var CopyableId = ({
1992
2045
  const { colors } = theme;
1993
2046
  const { status, copy } = useCopyToClipboard(value, writer);
1994
2047
  const action = useActionState(status);
1995
- return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles16.cell, style], testID, children: [
1996
- label !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles16.label, { color: colors.textSecondary }], children: label }),
1997
- /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles16.row, children: [
1998
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles16.valueWrap, children: /* @__PURE__ */ jsxRuntime.jsx(
2048
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles17.cell, style], testID, children: [
2049
+ label !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles17.label, { color: colors.textSecondary }], children: label }),
2050
+ /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles17.row, children: [
2051
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles17.valueWrap, children: /* @__PURE__ */ jsxRuntime.jsx(
1999
2052
  TruncatedText,
2000
2053
  {
2001
2054
  value,
2002
- style: [styles16.value, { color: colors.text }],
2055
+ style: [styles17.value, { color: colors.text }],
2003
2056
  testID: `${testID}-value`,
2004
2057
  accessibilityLabel: accessibilityLabel ?? value,
2005
2058
  accessibilityHint: t(LAYOUT_I18N.copyableIdHint)
@@ -2013,7 +2066,7 @@ var CopyableId = ({
2013
2066
  accessibilityLabel: t(action.key),
2014
2067
  accessibilityHint: t(LAYOUT_I18N.copyHint),
2015
2068
  testID: `${testID}-copy`,
2016
- style: [styles16.action, { color: action.color }],
2069
+ style: [styles17.action, { color: action.color }],
2017
2070
  children: t(action.key)
2018
2071
  }
2019
2072
  )
@@ -2068,7 +2121,7 @@ var FOOTER_PADDING_V = 6;
2068
2121
  var FOOTER_PADDING_H = 12;
2069
2122
  var FOOTER_FONT_SIZE = 11;
2070
2123
  var FOOTER_OPACITY = 0.75;
2071
- var styles17 = reactNative.StyleSheet.create({
2124
+ var styles18 = reactNative.StyleSheet.create({
2072
2125
  footer: {
2073
2126
  paddingVertical: FOOTER_PADDING_V,
2074
2127
  paddingHorizontal: FOOTER_PADDING_H,
@@ -2094,7 +2147,7 @@ var BuildInfoFooter = ({
2094
2147
  const commit = apiCommit ?? fetchedCommit;
2095
2148
  const label = formatBuildInfo(buildVersion, commit);
2096
2149
  const textStyle = React10.useMemo(
2097
- () => [styles17.text, { color: theme.colors.textSecondary }],
2150
+ () => [styles18.text, { color: theme.colors.textSecondary }],
2098
2151
  [theme.colors.textSecondary]
2099
2152
  );
2100
2153
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -2102,7 +2155,7 @@ var BuildInfoFooter = ({
2102
2155
  {
2103
2156
  accessibilityLabel: accessibilityLabel ?? label,
2104
2157
  accessibilityHint: accessibilityHint ?? t(LAYOUT_I18N.buildInfoHint),
2105
- style: [styles17.footer, style],
2158
+ style: [styles18.footer, style],
2106
2159
  testID,
2107
2160
  children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: textStyle, children: label })
2108
2161
  }