@dloizides/ui-layout 1.17.0 → 1.19.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
@@ -1,5 +1,5 @@
1
- import React8, { createContext, useMemo, useRef, useEffect, useState, useCallback, useContext, useLayoutEffect } from 'react';
2
- import { StyleSheet, Platform, View, Text, Pressable, ScrollView, TouchableOpacity, Modal, FlatList, Animated, Easing, useWindowDimensions, LayoutAnimation, UIManager } from 'react-native';
1
+ import React9, { createContext, useMemo, useRef, useEffect, useState, useCallback, useContext, useLayoutEffect } from 'react';
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 } from 'react/jsx-runtime';
5
5
  import { useA11y } from '@dloizides/a11y';
@@ -17,7 +17,7 @@ var styles = StyleSheet.create({
17
17
  });
18
18
  var Section = ({ children, style }) => {
19
19
  const { theme } = useUi();
20
- const containerStyle = React8.useMemo(
20
+ const containerStyle = React9.useMemo(
21
21
  () => [styles.card, { borderColor: theme.colors.border, backgroundColor: theme.colors.surface }, style],
22
22
  [theme.colors.border, theme.colors.surface, style]
23
23
  );
@@ -39,6 +39,11 @@ var DEFAULT_BILLING_ROUTE = "/settings/billing";
39
39
  var LAYOUT_I18N = {
40
40
  /** Placeholder shown by `ModalDropdown` when no option matches the current value. */
41
41
  selectPlaceholder: "common.selectPlaceholder",
42
+ /**
43
+ * Accessible hint on the collapsed (mobile) `Tabs` menu trigger — the button
44
+ * that shows the active section and opens the vertical list of sections.
45
+ */
46
+ tabsMenuHint: "common.tabsMenuHint",
42
47
  /** Accessible name + hint of the modal-variant dropdown's dismiss backdrop. */
43
48
  dismissDropdown: "common.dismissDropdown",
44
49
  dismissDropdownHint: "common.dismissDropdownHint",
@@ -91,7 +96,7 @@ var Heading = ({
91
96
  testID
92
97
  }) => {
93
98
  const { theme } = useUi();
94
- const headingStyle = React8.useMemo(
99
+ const headingStyle = React9.useMemo(
95
100
  () => [styles2.heading, { color: theme.colors.text }, style],
96
101
  [theme.colors.text, style]
97
102
  );
@@ -225,177 +230,6 @@ function SegmentedControl({
225
230
  }
226
231
  );
227
232
  }
228
- var PILL_RADIUS = 999;
229
- var PILL_PAD_H = 16;
230
- var PILL_PAD_V = 8;
231
- var PILL_MIN_HEIGHT = 40;
232
- var PILL_FONT = 14;
233
- var PILL_WEIGHT = "600";
234
- var ROW_GAP = 8;
235
- var COLUMN_GAP = 8;
236
- var ROW_PAD_V = 8;
237
- var PANEL_PAD_TOP = 16;
238
- var BORDER_WIDTH2 = 1;
239
- var TEXT_ON_PRIMARY = "#ffffff";
240
- var styles5 = StyleSheet.create({
241
- root: {
242
- width: "100%"
243
- },
244
- strip: {
245
- flexDirection: "row",
246
- flexWrap: "wrap",
247
- alignItems: "center",
248
- columnGap: COLUMN_GAP,
249
- rowGap: ROW_GAP,
250
- paddingVertical: ROW_PAD_V,
251
- borderBottomWidth: BORDER_WIDTH2
252
- },
253
- pill: {
254
- paddingHorizontal: PILL_PAD_H,
255
- paddingVertical: PILL_PAD_V,
256
- borderRadius: PILL_RADIUS,
257
- minHeight: PILL_MIN_HEIGHT,
258
- flexDirection: "row",
259
- alignItems: "center",
260
- justifyContent: "center"
261
- },
262
- pillText: {
263
- fontSize: PILL_FONT,
264
- fontWeight: PILL_WEIGHT,
265
- textAlign: "center"
266
- },
267
- panel: {
268
- paddingTop: PANEL_PAD_TOP
269
- }
270
- });
271
- function ariaTabProps(selected, panelId, tabId) {
272
- return { "aria-selected": selected, "aria-controls": panelId, id: tabId };
273
- }
274
- var Tabs = ({
275
- tabs,
276
- activeKey,
277
- onChange,
278
- accessibilityLabel,
279
- children,
280
- idPrefix = "tabs",
281
- style,
282
- stripStyle,
283
- panelStyle,
284
- testID
285
- }) => {
286
- const { theme } = useUi();
287
- const { colors } = theme;
288
- const primaryColor = theme.palette.primary["500"];
289
- const activePanelId = `${idPrefix}-panel-${activeKey}`;
290
- const activeTabId = `${idPrefix}-tab-${activeKey}`;
291
- const panelAria = { "aria-labelledby": activeTabId, id: activePanelId };
292
- return /* @__PURE__ */ jsxs(View, { style: [styles5.root, style], testID, children: [
293
- /* @__PURE__ */ jsx(ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, children: /* @__PURE__ */ jsx(
294
- View,
295
- {
296
- accessibilityRole: "tablist",
297
- "aria-label": accessibilityLabel,
298
- style: [styles5.strip, { borderBottomColor: colors.border }, stripStyle],
299
- children: tabs.map((tab) => {
300
- const selected = tab.key === activeKey;
301
- const textColor = selected ? TEXT_ON_PRIMARY : colors.textSecondary;
302
- const pillColor = selected ? primaryColor : colors.surfaceElevated;
303
- const tabId = `${idPrefix}-tab-${tab.key}`;
304
- const panelId = `${idPrefix}-panel-${tab.key}`;
305
- return /* @__PURE__ */ jsx(
306
- Pressable,
307
- {
308
- accessibilityRole: "tab",
309
- accessibilityState: { selected },
310
- accessibilityLabel: tab.accessibilityLabel ?? tab.label,
311
- accessibilityHint: tab.accessibilityHint,
312
- onPress: () => onChange(tab.key),
313
- style: [styles5.pill, { backgroundColor: pillColor }],
314
- testID: tab.testID,
315
- ...ariaTabProps(selected, panelId, tabId),
316
- children: /* @__PURE__ */ jsx(Text, { style: [styles5.pillText, { color: textColor }], children: tab.label })
317
- },
318
- tab.key
319
- );
320
- })
321
- }
322
- ) }),
323
- /* @__PURE__ */ jsx(View, { accessibilityRole: "none", style: [styles5.panel, panelStyle], ...panelAria, children })
324
- ] });
325
- };
326
- var PROMPT_PADDING = 20;
327
- var PROMPT_BORDER_RADIUS = 12;
328
- var PROMPT_BORDER_WIDTH = 1;
329
- var TITLE_FONT_SIZE = 16;
330
- var MESSAGE_FONT_SIZE = 14;
331
- var BUTTON_PADDING_V = 12;
332
- var BUTTON_BORDER_RADIUS = 8;
333
- var BUTTON_FONT_SIZE = 14;
334
- var DISMISS_FONT_SIZE = 13;
335
- var TITLE_MARGIN_BOTTOM = 8;
336
- var MESSAGE_MARGIN_BOTTOM = 16;
337
- var CTA_MARGIN_BOTTOM = 8;
338
- var styles6 = StyleSheet.create({
339
- container: {
340
- padding: PROMPT_PADDING,
341
- borderRadius: PROMPT_BORDER_RADIUS,
342
- borderWidth: PROMPT_BORDER_WIDTH
343
- },
344
- title: { fontSize: TITLE_FONT_SIZE, fontWeight: "700", marginBottom: TITLE_MARGIN_BOTTOM },
345
- message: { fontSize: MESSAGE_FONT_SIZE, marginBottom: MESSAGE_MARGIN_BOTTOM },
346
- cta: { paddingVertical: BUTTON_PADDING_V, borderRadius: BUTTON_BORDER_RADIUS, alignItems: "center", marginBottom: CTA_MARGIN_BOTTOM },
347
- ctaText: { fontSize: BUTTON_FONT_SIZE, fontWeight: "700" },
348
- dismiss: { alignItems: "center", paddingVertical: BUTTON_PADDING_V },
349
- dismissText: { fontSize: DISMISS_FONT_SIZE }
350
- });
351
- var UpgradePrompt = ({
352
- requiredTier,
353
- currentTier,
354
- onDismiss,
355
- billingRoute = DEFAULT_BILLING_ROUTE
356
- }) => {
357
- const { theme, t, navigate } = useUi();
358
- const colors = theme.colors;
359
- const primary = theme.palette.primary["500"];
360
- function handleUpgradePress() {
361
- if (typeof navigate === "function") navigate(billingRoute);
362
- }
363
- return /* @__PURE__ */ jsxs(
364
- View,
365
- {
366
- style: [styles6.container, { borderColor: primary, backgroundColor: colors.surface }],
367
- testID: LAYOUT_TEST_IDS.upgradePrompt,
368
- children: [
369
- /* @__PURE__ */ jsx(Text, { style: [styles6.title, { color: colors.text }], children: t(LAYOUT_I18N.upgradePromptTitle) }),
370
- /* @__PURE__ */ jsx(Text, { style: [styles6.message, { color: colors.textSecondary }], children: t(LAYOUT_I18N.upgradePromptMessage, requiredTier, currentTier) }),
371
- /* @__PURE__ */ jsx(
372
- TouchableOpacity,
373
- {
374
- accessibilityHint: t(LAYOUT_I18N.upgradePromptCtaHint),
375
- accessibilityLabel: t(LAYOUT_I18N.upgradePromptCta),
376
- accessibilityRole: "button",
377
- style: [styles6.cta, { backgroundColor: primary }],
378
- testID: LAYOUT_TEST_IDS.upgradePromptCta,
379
- onPress: handleUpgradePress,
380
- children: /* @__PURE__ */ jsx(Text, { style: [styles6.ctaText, { color: colors.surface }], children: t(LAYOUT_I18N.upgradePromptCta) })
381
- }
382
- ),
383
- onDismiss ? /* @__PURE__ */ jsx(
384
- TouchableOpacity,
385
- {
386
- accessibilityHint: t(LAYOUT_I18N.upgradePromptDismissHint),
387
- accessibilityLabel: t(LAYOUT_I18N.upgradePromptDismiss),
388
- accessibilityRole: "button",
389
- style: styles6.dismiss,
390
- testID: LAYOUT_TEST_IDS.upgradePromptDismiss,
391
- onPress: onDismiss,
392
- children: /* @__PURE__ */ jsx(Text, { style: [styles6.dismissText, { color: colors.textSecondary }], children: t(LAYOUT_I18N.upgradePromptDismiss) })
393
- }
394
- ) : null
395
- ]
396
- }
397
- );
398
- };
399
233
  var FOCUSABLE_SELECTOR = [
400
234
  "a[href]",
401
235
  "button:not([disabled])",
@@ -464,7 +298,7 @@ var MENU_ELEVATION = 8;
464
298
  var MENU_TOP_GAP = 4;
465
299
  var MENU_MAX_HEIGHT = 300;
466
300
  var BORDER_RADIUS = 8;
467
- var BORDER_WIDTH3 = 1;
301
+ var BORDER_WIDTH2 = 1;
468
302
  var MENU_PADDING = 4;
469
303
  var MENU_BOX_SHADOW = "0px 2px 8px rgba(0, 0, 0, 0.15)";
470
304
  function buildPortalPopoverStyle(rect, minWidth = 0) {
@@ -476,7 +310,7 @@ function buildPortalPopoverStyle(rect, minWidth = 0) {
476
310
  left: rect.left,
477
311
  width: Math.max(rect.width, minWidth),
478
312
  zIndex: MENU_Z_INDEX,
479
- borderWidth: BORDER_WIDTH3,
313
+ borderWidth: BORDER_WIDTH2,
480
314
  borderRadius: BORDER_RADIUS,
481
315
  padding: MENU_PADDING,
482
316
  maxHeight: MENU_MAX_HEIGHT,
@@ -501,7 +335,7 @@ var BODY_FONT_SIZE = 14;
501
335
  var SELECTED_FONT_WEIGHT = "600";
502
336
  var OPTION_PADDING_H = 16;
503
337
  var OPTION_PADDING_V = 12;
504
- var styles7 = StyleSheet.create({
338
+ var styles5 = StyleSheet.create({
505
339
  option: {
506
340
  paddingHorizontal: OPTION_PADDING_H,
507
341
  paddingVertical: OPTION_PADDING_V,
@@ -523,8 +357,8 @@ var OptionRow = ({
523
357
  onSelect();
524
358
  }, [onSelect]);
525
359
  const isActive = isSelected || isHighlighted;
526
- const rowStyle = [styles7.option, isActive ? { backgroundColor: colors.surfaceElevated } : null];
527
- const textStyle = [styles7.optionText, { color: colors.text }, isSelected ? styles7.selectedText : null];
360
+ const rowStyle = [styles5.option, isActive ? { backgroundColor: colors.surfaceElevated } : null];
361
+ const textStyle = [styles5.optionText, { color: colors.text }, isSelected ? styles5.selectedText : null];
528
362
  return /* @__PURE__ */ jsx(
529
363
  TouchableOpacity,
530
364
  {
@@ -687,9 +521,9 @@ function useMenuKeyboard(params) {
687
521
  }
688
522
  var IS_WEB2 = Platform.OS === "web";
689
523
  var BORDER_RADIUS2 = 8;
690
- var BORDER_WIDTH4 = 1;
524
+ var BORDER_WIDTH3 = 1;
691
525
  var MENU_PADDING2 = 4;
692
- var styles8 = StyleSheet.create({
526
+ var styles6 = StyleSheet.create({
693
527
  /** Native (in-tree) popover — anchored absolutely just under the trigger. */
694
528
  popover: {
695
529
  position: "absolute",
@@ -698,7 +532,7 @@ var styles8 = StyleSheet.create({
698
532
  right: 0,
699
533
  marginTop: MENU_TOP_GAP,
700
534
  zIndex: MENU_Z_INDEX,
701
- borderWidth: BORDER_WIDTH4,
535
+ borderWidth: BORDER_WIDTH3,
702
536
  borderRadius: BORDER_RADIUS2,
703
537
  padding: MENU_PADDING2,
704
538
  maxHeight: MENU_MAX_HEIGHT,
@@ -755,7 +589,7 @@ var InlineMenu = ({
755
589
  buildPortalPopoverStyle(rect ?? { left: 0, width: 0, bottom: 0 }, menuMinWidth),
756
590
  themed
757
591
  ];
758
- return [styles8.popover, { minWidth: menuMinWidth }, themed];
592
+ return [styles6.popover, { minWidth: menuMinWidth }, themed];
759
593
  }, [colors.border, colors.surface, menuMinWidth, rect]);
760
594
  const menu = /* @__PURE__ */ jsx(
761
595
  View,
@@ -793,17 +627,17 @@ function useResolvedDropdownVariant(explicit) {
793
627
  return resolveDropdownVariant(explicit, width, Platform.OS);
794
628
  }
795
629
  var BORDER_RADIUS3 = 8;
796
- var BORDER_WIDTH5 = 1;
630
+ var BORDER_WIDTH4 = 1;
797
631
  var BODY_FONT_SIZE2 = 14;
798
632
  var MODAL_PADDING = 8;
799
633
  var MODAL_MIN_WIDTH = 200;
800
634
  var MODAL_MAX_HEIGHT = 300;
801
635
  var CONTAINER_PADDING_H = 12;
802
636
  var CONTAINER_PADDING_V = 10;
803
- var styles9 = StyleSheet.create({
637
+ var styles7 = StyleSheet.create({
804
638
  anchor: { position: "relative" },
805
639
  container: {
806
- borderWidth: BORDER_WIDTH5,
640
+ borderWidth: BORDER_WIDTH4,
807
641
  borderRadius: BORDER_RADIUS3,
808
642
  paddingHorizontal: CONTAINER_PADDING_H,
809
643
  paddingVertical: CONTAINER_PADDING_V
@@ -867,7 +701,7 @@ var ModalDropdown = ({
867
701
  [onChange]
868
702
  );
869
703
  const containerStyle = useMemo(
870
- () => renderTrigger !== void 0 ? void 0 : [styles9.container, { borderColor: colors.border, backgroundColor: colors.surface }],
704
+ () => renderTrigger !== void 0 ? void 0 : [styles7.container, { borderColor: colors.border, backgroundColor: colors.surface }],
871
705
  [colors.border, colors.surface, renderTrigger]
872
706
  );
873
707
  const optionTestIDFor = useCallback(
@@ -875,11 +709,11 @@ var ModalDropdown = ({
875
709
  [optionTestID, testID]
876
710
  );
877
711
  const anchorStyle = useMemo(
878
- () => [styles9.anchor, buildAnchorStackStyle(isMenu && isOpen)],
712
+ () => [styles7.anchor, buildAnchorStackStyle(isMenu && isOpen)],
879
713
  [isMenu, isOpen]
880
714
  );
881
715
  const modalContentStyle = useMemo(
882
- () => [styles9.modalContent, { backgroundColor: colors.surface }],
716
+ () => [styles7.modalContent, { backgroundColor: colors.surface }],
883
717
  [colors.surface]
884
718
  );
885
719
  const renderModalOption = useCallback(
@@ -897,7 +731,7 @@ var ModalDropdown = ({
897
731
  const keyExtractor = useCallback((item) => String(item.value), []);
898
732
  return /* @__PURE__ */ jsxs(View, { ref: anchorRef, style: anchorStyle, children: [
899
733
  /* @__PURE__ */ jsxs(TouchableOpacity, { ...a11yProps, style: containerStyle, onPress: handleToggle, children: [
900
- renderTrigger !== void 0 ? renderTrigger({ label: selectedLabel, isOpen }) : /* @__PURE__ */ jsx(Text, { style: [styles9.selectedText, { color: colors.text }], children: selectedLabel }),
734
+ renderTrigger !== void 0 ? renderTrigger({ label: selectedLabel, isOpen }) : /* @__PURE__ */ jsx(Text, { style: [styles7.selectedText, { color: colors.text }], children: selectedLabel }),
901
735
  hintNode
902
736
  ] }),
903
737
  isMenu && isOpen ? /* @__PURE__ */ jsx(
@@ -914,7 +748,7 @@ var ModalDropdown = ({
914
748
  onSelect: handleSelect
915
749
  }
916
750
  ) : null,
917
- !isMenu ? /* @__PURE__ */ jsx(Modal, { transparent: true, animationType: "fade", visible: isOpen, onRequestClose: handleClose, children: /* @__PURE__ */ jsxs(View, { style: styles9.modalOverlay, children: [
751
+ !isMenu ? /* @__PURE__ */ jsx(Modal, { transparent: true, animationType: "fade", visible: isOpen, onRequestClose: handleClose, children: /* @__PURE__ */ jsxs(View, { style: styles7.modalOverlay, children: [
918
752
  /* @__PURE__ */ jsx(
919
753
  TouchableOpacity,
920
754
  {
@@ -942,6 +776,258 @@ var ModalDropdown = ({
942
776
  ] }) }) : null
943
777
  ] });
944
778
  };
779
+ var TabsMenu = ({
780
+ tabs,
781
+ activeKey,
782
+ onChange,
783
+ accessibilityLabel,
784
+ idPrefix,
785
+ testID
786
+ }) => {
787
+ const { t } = useUi();
788
+ const options = useMemo(
789
+ () => tabs.map((tab) => ({ label: tab.label, value: tab.key })),
790
+ [tabs]
791
+ );
792
+ const optionTestID = useCallback(
793
+ (key) => {
794
+ const found = tabs.find((tab) => tab.key === key);
795
+ return found?.testID ?? `${idPrefix}-tab-${key}`;
796
+ },
797
+ [tabs, idPrefix]
798
+ );
799
+ return /* @__PURE__ */ jsx(
800
+ ModalDropdown,
801
+ {
802
+ accessibilityHint: t(LAYOUT_I18N.tabsMenuHint),
803
+ accessibilityLabel,
804
+ optionTestID,
805
+ options,
806
+ testID,
807
+ value: activeKey,
808
+ onChange
809
+ }
810
+ );
811
+ };
812
+ var TABS_COLLAPSE_BREAKPOINT = MENU_BREAKPOINT;
813
+ var WEB_PLATFORM2 = "web";
814
+ function shouldCollapseTabs(width, platformOS, breakpoint) {
815
+ const isWideWeb = platformOS === WEB_PLATFORM2 && width >= breakpoint;
816
+ return !isWideWeb;
817
+ }
818
+ function useTabsCollapsed(breakpoint) {
819
+ const { width } = useWindowDimensions();
820
+ return shouldCollapseTabs(width, Platform.OS, breakpoint);
821
+ }
822
+ var PILL_RADIUS = 999;
823
+ var PILL_PAD_H = 16;
824
+ var PILL_PAD_V = 8;
825
+ var PILL_MIN_HEIGHT = 40;
826
+ var PILL_FONT = 14;
827
+ var PILL_WEIGHT = "600";
828
+ var ROW_GAP = 8;
829
+ var COLUMN_GAP = 8;
830
+ var ROW_PAD_V = 8;
831
+ var PANEL_PAD_TOP = 16;
832
+ var BORDER_WIDTH5 = 1;
833
+ var TEXT_ON_PRIMARY = "#ffffff";
834
+ var styles8 = StyleSheet.create({
835
+ root: {
836
+ width: "100%"
837
+ },
838
+ // The full-width rule under the row lives here (not on the strip) so it spans the
839
+ // whole width even when the tabs are narrower than the viewport (desktop) and is
840
+ // not clipped to the scroll content width.
841
+ stripOuter: {
842
+ width: "100%",
843
+ borderBottomWidth: BORDER_WIDTH5
844
+ },
845
+ strip: {
846
+ flexDirection: "row",
847
+ flexWrap: "nowrap",
848
+ alignItems: "center",
849
+ columnGap: COLUMN_GAP,
850
+ rowGap: ROW_GAP,
851
+ paddingVertical: ROW_PAD_V
852
+ },
853
+ pill: {
854
+ // Keep each pill at its natural size so the row scrolls instead of squashing
855
+ // the tabs when they don't all fit.
856
+ flexShrink: 0,
857
+ paddingHorizontal: PILL_PAD_H,
858
+ paddingVertical: PILL_PAD_V,
859
+ borderRadius: PILL_RADIUS,
860
+ minHeight: PILL_MIN_HEIGHT,
861
+ flexDirection: "row",
862
+ alignItems: "center",
863
+ justifyContent: "center"
864
+ },
865
+ pillText: {
866
+ fontSize: PILL_FONT,
867
+ fontWeight: PILL_WEIGHT,
868
+ textAlign: "center"
869
+ },
870
+ panel: {
871
+ paddingTop: PANEL_PAD_TOP
872
+ }
873
+ });
874
+ function ariaTabProps(selected, panelId, tabId) {
875
+ return { "aria-selected": selected, "aria-controls": panelId, id: tabId };
876
+ }
877
+ var WideTabStrip = ({
878
+ tabs,
879
+ activeKey,
880
+ onChange,
881
+ accessibilityLabel,
882
+ idPrefix,
883
+ borderColor,
884
+ primaryColor,
885
+ textSecondary,
886
+ surfaceElevated,
887
+ stripStyle
888
+ }) => /* @__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) => {
889
+ const selected = tab.key === activeKey;
890
+ const textColor = selected ? TEXT_ON_PRIMARY : textSecondary;
891
+ const pillColor = selected ? primaryColor : surfaceElevated;
892
+ const tabId = `${idPrefix}-tab-${tab.key}`;
893
+ const panelId = `${idPrefix}-panel-${tab.key}`;
894
+ return /* @__PURE__ */ jsx(
895
+ Pressable,
896
+ {
897
+ accessibilityRole: "tab",
898
+ accessibilityState: { selected },
899
+ accessibilityLabel: tab.accessibilityLabel ?? tab.label,
900
+ accessibilityHint: tab.accessibilityHint,
901
+ onPress: () => onChange(tab.key),
902
+ style: [styles8.pill, { backgroundColor: pillColor }],
903
+ testID: tab.testID,
904
+ ...ariaTabProps(selected, panelId, tabId),
905
+ children: /* @__PURE__ */ jsx(Text, { style: [styles8.pillText, { color: textColor }], children: tab.label })
906
+ },
907
+ tab.key
908
+ );
909
+ }) }) }) });
910
+ var Tabs = ({
911
+ tabs,
912
+ activeKey,
913
+ onChange,
914
+ accessibilityLabel,
915
+ children,
916
+ idPrefix = "tabs",
917
+ collapseBelow = TABS_COLLAPSE_BREAKPOINT,
918
+ style,
919
+ stripStyle,
920
+ panelStyle,
921
+ testID
922
+ }) => {
923
+ const { theme } = useUi();
924
+ const { colors } = theme;
925
+ const collapsed = useTabsCollapsed(collapseBelow);
926
+ const activePanelId = `${idPrefix}-panel-${activeKey}`;
927
+ const activeTabId = `${idPrefix}-tab-${activeKey}`;
928
+ const panelAria = { "aria-labelledby": activeTabId, id: activePanelId };
929
+ return /* @__PURE__ */ jsxs(View, { style: [styles8.root, style], testID, children: [
930
+ collapsed ? /* @__PURE__ */ jsx(
931
+ TabsMenu,
932
+ {
933
+ accessibilityLabel,
934
+ activeKey,
935
+ idPrefix,
936
+ tabs,
937
+ testID: `${idPrefix}-menu`,
938
+ onChange
939
+ }
940
+ ) : /* @__PURE__ */ jsx(
941
+ WideTabStrip,
942
+ {
943
+ accessibilityLabel,
944
+ activeKey,
945
+ borderColor: colors.border,
946
+ idPrefix,
947
+ primaryColor: theme.palette.primary["500"],
948
+ stripStyle,
949
+ surfaceElevated: colors.surfaceElevated,
950
+ tabs,
951
+ textSecondary: colors.textSecondary,
952
+ onChange
953
+ }
954
+ ),
955
+ /* @__PURE__ */ jsx(View, { accessibilityRole: "none", style: [styles8.panel, panelStyle], ...panelAria, children })
956
+ ] });
957
+ };
958
+ var PROMPT_PADDING = 20;
959
+ var PROMPT_BORDER_RADIUS = 12;
960
+ var PROMPT_BORDER_WIDTH = 1;
961
+ var TITLE_FONT_SIZE = 16;
962
+ var MESSAGE_FONT_SIZE = 14;
963
+ var BUTTON_PADDING_V = 12;
964
+ var BUTTON_BORDER_RADIUS = 8;
965
+ var BUTTON_FONT_SIZE = 14;
966
+ var DISMISS_FONT_SIZE = 13;
967
+ var TITLE_MARGIN_BOTTOM = 8;
968
+ var MESSAGE_MARGIN_BOTTOM = 16;
969
+ var CTA_MARGIN_BOTTOM = 8;
970
+ var styles9 = StyleSheet.create({
971
+ container: {
972
+ padding: PROMPT_PADDING,
973
+ borderRadius: PROMPT_BORDER_RADIUS,
974
+ borderWidth: PROMPT_BORDER_WIDTH
975
+ },
976
+ title: { fontSize: TITLE_FONT_SIZE, fontWeight: "700", marginBottom: TITLE_MARGIN_BOTTOM },
977
+ message: { fontSize: MESSAGE_FONT_SIZE, marginBottom: MESSAGE_MARGIN_BOTTOM },
978
+ cta: { paddingVertical: BUTTON_PADDING_V, borderRadius: BUTTON_BORDER_RADIUS, alignItems: "center", marginBottom: CTA_MARGIN_BOTTOM },
979
+ ctaText: { fontSize: BUTTON_FONT_SIZE, fontWeight: "700" },
980
+ dismiss: { alignItems: "center", paddingVertical: BUTTON_PADDING_V },
981
+ dismissText: { fontSize: DISMISS_FONT_SIZE }
982
+ });
983
+ var UpgradePrompt = ({
984
+ requiredTier,
985
+ currentTier,
986
+ onDismiss,
987
+ billingRoute = DEFAULT_BILLING_ROUTE
988
+ }) => {
989
+ const { theme, t, navigate } = useUi();
990
+ const colors = theme.colors;
991
+ const primary = theme.palette.primary["500"];
992
+ function handleUpgradePress() {
993
+ if (typeof navigate === "function") navigate(billingRoute);
994
+ }
995
+ return /* @__PURE__ */ jsxs(
996
+ View,
997
+ {
998
+ style: [styles9.container, { borderColor: primary, backgroundColor: colors.surface }],
999
+ testID: LAYOUT_TEST_IDS.upgradePrompt,
1000
+ children: [
1001
+ /* @__PURE__ */ jsx(Text, { style: [styles9.title, { color: colors.text }], children: t(LAYOUT_I18N.upgradePromptTitle) }),
1002
+ /* @__PURE__ */ jsx(Text, { style: [styles9.message, { color: colors.textSecondary }], children: t(LAYOUT_I18N.upgradePromptMessage, requiredTier, currentTier) }),
1003
+ /* @__PURE__ */ jsx(
1004
+ TouchableOpacity,
1005
+ {
1006
+ accessibilityHint: t(LAYOUT_I18N.upgradePromptCtaHint),
1007
+ accessibilityLabel: t(LAYOUT_I18N.upgradePromptCta),
1008
+ accessibilityRole: "button",
1009
+ style: [styles9.cta, { backgroundColor: primary }],
1010
+ testID: LAYOUT_TEST_IDS.upgradePromptCta,
1011
+ onPress: handleUpgradePress,
1012
+ children: /* @__PURE__ */ jsx(Text, { style: [styles9.ctaText, { color: colors.surface }], children: t(LAYOUT_I18N.upgradePromptCta) })
1013
+ }
1014
+ ),
1015
+ onDismiss ? /* @__PURE__ */ jsx(
1016
+ TouchableOpacity,
1017
+ {
1018
+ accessibilityHint: t(LAYOUT_I18N.upgradePromptDismissHint),
1019
+ accessibilityLabel: t(LAYOUT_I18N.upgradePromptDismiss),
1020
+ accessibilityRole: "button",
1021
+ style: styles9.dismiss,
1022
+ testID: LAYOUT_TEST_IDS.upgradePromptDismiss,
1023
+ onPress: onDismiss,
1024
+ children: /* @__PURE__ */ jsx(Text, { style: [styles9.dismissText, { color: colors.textSecondary }], children: t(LAYOUT_I18N.upgradePromptDismiss) })
1025
+ }
1026
+ ) : null
1027
+ ]
1028
+ }
1029
+ );
1030
+ };
945
1031
  var CLOSE_ICON_SIZE = 18;
946
1032
  var styles10 = StyleSheet.create({
947
1033
  container: {
@@ -967,7 +1053,7 @@ var ModalShell = ({
967
1053
  showClose = true
968
1054
  }) => {
969
1055
  const { theme, t } = useUi();
970
- const containerStyle = React8.useMemo(
1056
+ const containerStyle = React9.useMemo(
971
1057
  () => [styles10.container, { backgroundColor: theme.colors.background }, contentStyle],
972
1058
  [theme.colors.background, contentStyle]
973
1059
  );
@@ -1045,8 +1131,8 @@ var styles11 = StyleSheet.create({
1045
1131
  });
1046
1132
  function computeInitialOpen(children, defaultOpenIds, allowMultiple) {
1047
1133
  const ids = new Set(defaultOpenIds ?? []);
1048
- React8.Children.forEach(children, (child) => {
1049
- if (!React8.isValidElement(child)) return;
1134
+ React9.Children.forEach(children, (child) => {
1135
+ if (!React9.isValidElement(child)) return;
1050
1136
  const props = child.props;
1051
1137
  if (props.defaultOpen === true && typeof props.id === "string") {
1052
1138
  ids.add(props.id);