@dloizides/ui-layout 1.18.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,186 +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
- // The full-width rule under the row lives here (not on the strip) so it spans the
245
- // whole width even when the tabs are narrower than the viewport (desktop) and is
246
- // not clipped to the scroll content width.
247
- stripOuter: {
248
- width: "100%",
249
- borderBottomWidth: BORDER_WIDTH2
250
- },
251
- strip: {
252
- flexDirection: "row",
253
- flexWrap: "nowrap",
254
- alignItems: "center",
255
- columnGap: COLUMN_GAP,
256
- rowGap: ROW_GAP,
257
- paddingVertical: ROW_PAD_V
258
- },
259
- pill: {
260
- // Keep each pill at its natural size so the row scrolls instead of squashing
261
- // the tabs when they don't all fit.
262
- flexShrink: 0,
263
- paddingHorizontal: PILL_PAD_H,
264
- paddingVertical: PILL_PAD_V,
265
- borderRadius: PILL_RADIUS,
266
- minHeight: PILL_MIN_HEIGHT,
267
- flexDirection: "row",
268
- alignItems: "center",
269
- justifyContent: "center"
270
- },
271
- pillText: {
272
- fontSize: PILL_FONT,
273
- fontWeight: PILL_WEIGHT,
274
- textAlign: "center"
275
- },
276
- panel: {
277
- paddingTop: PANEL_PAD_TOP
278
- }
279
- });
280
- function ariaTabProps(selected, panelId, tabId) {
281
- return { "aria-selected": selected, "aria-controls": panelId, id: tabId };
282
- }
283
- var Tabs = ({
284
- tabs,
285
- activeKey,
286
- onChange,
287
- accessibilityLabel,
288
- children,
289
- idPrefix = "tabs",
290
- style,
291
- stripStyle,
292
- panelStyle,
293
- testID
294
- }) => {
295
- const { theme } = useUi();
296
- const { colors } = theme;
297
- const primaryColor = theme.palette.primary["500"];
298
- const activePanelId = `${idPrefix}-panel-${activeKey}`;
299
- const activeTabId = `${idPrefix}-tab-${activeKey}`;
300
- const panelAria = { "aria-labelledby": activeTabId, id: activePanelId };
301
- return /* @__PURE__ */ jsxs(View, { style: [styles5.root, style], testID, children: [
302
- /* @__PURE__ */ jsx(View, { style: [styles5.stripOuter, { borderBottomColor: colors.border }], children: /* @__PURE__ */ jsx(ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, children: /* @__PURE__ */ jsx(
303
- View,
304
- {
305
- accessibilityRole: "tablist",
306
- "aria-label": accessibilityLabel,
307
- style: [styles5.strip, stripStyle],
308
- children: tabs.map((tab) => {
309
- const selected = tab.key === activeKey;
310
- const textColor = selected ? TEXT_ON_PRIMARY : colors.textSecondary;
311
- const pillColor = selected ? primaryColor : colors.surfaceElevated;
312
- const tabId = `${idPrefix}-tab-${tab.key}`;
313
- const panelId = `${idPrefix}-panel-${tab.key}`;
314
- return /* @__PURE__ */ jsx(
315
- Pressable,
316
- {
317
- accessibilityRole: "tab",
318
- accessibilityState: { selected },
319
- accessibilityLabel: tab.accessibilityLabel ?? tab.label,
320
- accessibilityHint: tab.accessibilityHint,
321
- onPress: () => onChange(tab.key),
322
- style: [styles5.pill, { backgroundColor: pillColor }],
323
- testID: tab.testID,
324
- ...ariaTabProps(selected, panelId, tabId),
325
- children: /* @__PURE__ */ jsx(Text, { style: [styles5.pillText, { color: textColor }], children: tab.label })
326
- },
327
- tab.key
328
- );
329
- })
330
- }
331
- ) }) }),
332
- /* @__PURE__ */ jsx(View, { accessibilityRole: "none", style: [styles5.panel, panelStyle], ...panelAria, children })
333
- ] });
334
- };
335
- var PROMPT_PADDING = 20;
336
- var PROMPT_BORDER_RADIUS = 12;
337
- var PROMPT_BORDER_WIDTH = 1;
338
- var TITLE_FONT_SIZE = 16;
339
- var MESSAGE_FONT_SIZE = 14;
340
- var BUTTON_PADDING_V = 12;
341
- var BUTTON_BORDER_RADIUS = 8;
342
- var BUTTON_FONT_SIZE = 14;
343
- var DISMISS_FONT_SIZE = 13;
344
- var TITLE_MARGIN_BOTTOM = 8;
345
- var MESSAGE_MARGIN_BOTTOM = 16;
346
- var CTA_MARGIN_BOTTOM = 8;
347
- var styles6 = StyleSheet.create({
348
- container: {
349
- padding: PROMPT_PADDING,
350
- borderRadius: PROMPT_BORDER_RADIUS,
351
- borderWidth: PROMPT_BORDER_WIDTH
352
- },
353
- title: { fontSize: TITLE_FONT_SIZE, fontWeight: "700", marginBottom: TITLE_MARGIN_BOTTOM },
354
- message: { fontSize: MESSAGE_FONT_SIZE, marginBottom: MESSAGE_MARGIN_BOTTOM },
355
- cta: { paddingVertical: BUTTON_PADDING_V, borderRadius: BUTTON_BORDER_RADIUS, alignItems: "center", marginBottom: CTA_MARGIN_BOTTOM },
356
- ctaText: { fontSize: BUTTON_FONT_SIZE, fontWeight: "700" },
357
- dismiss: { alignItems: "center", paddingVertical: BUTTON_PADDING_V },
358
- dismissText: { fontSize: DISMISS_FONT_SIZE }
359
- });
360
- var UpgradePrompt = ({
361
- requiredTier,
362
- currentTier,
363
- onDismiss,
364
- billingRoute = DEFAULT_BILLING_ROUTE
365
- }) => {
366
- const { theme, t, navigate } = useUi();
367
- const colors = theme.colors;
368
- const primary = theme.palette.primary["500"];
369
- function handleUpgradePress() {
370
- if (typeof navigate === "function") navigate(billingRoute);
371
- }
372
- return /* @__PURE__ */ jsxs(
373
- View,
374
- {
375
- style: [styles6.container, { borderColor: primary, backgroundColor: colors.surface }],
376
- testID: LAYOUT_TEST_IDS.upgradePrompt,
377
- children: [
378
- /* @__PURE__ */ jsx(Text, { style: [styles6.title, { color: colors.text }], children: t(LAYOUT_I18N.upgradePromptTitle) }),
379
- /* @__PURE__ */ jsx(Text, { style: [styles6.message, { color: colors.textSecondary }], children: t(LAYOUT_I18N.upgradePromptMessage, requiredTier, currentTier) }),
380
- /* @__PURE__ */ jsx(
381
- TouchableOpacity,
382
- {
383
- accessibilityHint: t(LAYOUT_I18N.upgradePromptCtaHint),
384
- accessibilityLabel: t(LAYOUT_I18N.upgradePromptCta),
385
- accessibilityRole: "button",
386
- style: [styles6.cta, { backgroundColor: primary }],
387
- testID: LAYOUT_TEST_IDS.upgradePromptCta,
388
- onPress: handleUpgradePress,
389
- children: /* @__PURE__ */ jsx(Text, { style: [styles6.ctaText, { color: colors.surface }], children: t(LAYOUT_I18N.upgradePromptCta) })
390
- }
391
- ),
392
- onDismiss ? /* @__PURE__ */ jsx(
393
- TouchableOpacity,
394
- {
395
- accessibilityHint: t(LAYOUT_I18N.upgradePromptDismissHint),
396
- accessibilityLabel: t(LAYOUT_I18N.upgradePromptDismiss),
397
- accessibilityRole: "button",
398
- style: styles6.dismiss,
399
- testID: LAYOUT_TEST_IDS.upgradePromptDismiss,
400
- onPress: onDismiss,
401
- children: /* @__PURE__ */ jsx(Text, { style: [styles6.dismissText, { color: colors.textSecondary }], children: t(LAYOUT_I18N.upgradePromptDismiss) })
402
- }
403
- ) : null
404
- ]
405
- }
406
- );
407
- };
408
233
  var FOCUSABLE_SELECTOR = [
409
234
  "a[href]",
410
235
  "button:not([disabled])",
@@ -473,7 +298,7 @@ var MENU_ELEVATION = 8;
473
298
  var MENU_TOP_GAP = 4;
474
299
  var MENU_MAX_HEIGHT = 300;
475
300
  var BORDER_RADIUS = 8;
476
- var BORDER_WIDTH3 = 1;
301
+ var BORDER_WIDTH2 = 1;
477
302
  var MENU_PADDING = 4;
478
303
  var MENU_BOX_SHADOW = "0px 2px 8px rgba(0, 0, 0, 0.15)";
479
304
  function buildPortalPopoverStyle(rect, minWidth = 0) {
@@ -485,7 +310,7 @@ function buildPortalPopoverStyle(rect, minWidth = 0) {
485
310
  left: rect.left,
486
311
  width: Math.max(rect.width, minWidth),
487
312
  zIndex: MENU_Z_INDEX,
488
- borderWidth: BORDER_WIDTH3,
313
+ borderWidth: BORDER_WIDTH2,
489
314
  borderRadius: BORDER_RADIUS,
490
315
  padding: MENU_PADDING,
491
316
  maxHeight: MENU_MAX_HEIGHT,
@@ -510,7 +335,7 @@ var BODY_FONT_SIZE = 14;
510
335
  var SELECTED_FONT_WEIGHT = "600";
511
336
  var OPTION_PADDING_H = 16;
512
337
  var OPTION_PADDING_V = 12;
513
- var styles7 = StyleSheet.create({
338
+ var styles5 = StyleSheet.create({
514
339
  option: {
515
340
  paddingHorizontal: OPTION_PADDING_H,
516
341
  paddingVertical: OPTION_PADDING_V,
@@ -532,8 +357,8 @@ var OptionRow = ({
532
357
  onSelect();
533
358
  }, [onSelect]);
534
359
  const isActive = isSelected || isHighlighted;
535
- const rowStyle = [styles7.option, isActive ? { backgroundColor: colors.surfaceElevated } : null];
536
- 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];
537
362
  return /* @__PURE__ */ jsx(
538
363
  TouchableOpacity,
539
364
  {
@@ -696,9 +521,9 @@ function useMenuKeyboard(params) {
696
521
  }
697
522
  var IS_WEB2 = Platform.OS === "web";
698
523
  var BORDER_RADIUS2 = 8;
699
- var BORDER_WIDTH4 = 1;
524
+ var BORDER_WIDTH3 = 1;
700
525
  var MENU_PADDING2 = 4;
701
- var styles8 = StyleSheet.create({
526
+ var styles6 = StyleSheet.create({
702
527
  /** Native (in-tree) popover — anchored absolutely just under the trigger. */
703
528
  popover: {
704
529
  position: "absolute",
@@ -707,7 +532,7 @@ var styles8 = StyleSheet.create({
707
532
  right: 0,
708
533
  marginTop: MENU_TOP_GAP,
709
534
  zIndex: MENU_Z_INDEX,
710
- borderWidth: BORDER_WIDTH4,
535
+ borderWidth: BORDER_WIDTH3,
711
536
  borderRadius: BORDER_RADIUS2,
712
537
  padding: MENU_PADDING2,
713
538
  maxHeight: MENU_MAX_HEIGHT,
@@ -764,7 +589,7 @@ var InlineMenu = ({
764
589
  buildPortalPopoverStyle(rect ?? { left: 0, width: 0, bottom: 0 }, menuMinWidth),
765
590
  themed
766
591
  ];
767
- return [styles8.popover, { minWidth: menuMinWidth }, themed];
592
+ return [styles6.popover, { minWidth: menuMinWidth }, themed];
768
593
  }, [colors.border, colors.surface, menuMinWidth, rect]);
769
594
  const menu = /* @__PURE__ */ jsx(
770
595
  View,
@@ -802,17 +627,17 @@ function useResolvedDropdownVariant(explicit) {
802
627
  return resolveDropdownVariant(explicit, width, Platform.OS);
803
628
  }
804
629
  var BORDER_RADIUS3 = 8;
805
- var BORDER_WIDTH5 = 1;
630
+ var BORDER_WIDTH4 = 1;
806
631
  var BODY_FONT_SIZE2 = 14;
807
632
  var MODAL_PADDING = 8;
808
633
  var MODAL_MIN_WIDTH = 200;
809
634
  var MODAL_MAX_HEIGHT = 300;
810
635
  var CONTAINER_PADDING_H = 12;
811
636
  var CONTAINER_PADDING_V = 10;
812
- var styles9 = StyleSheet.create({
637
+ var styles7 = StyleSheet.create({
813
638
  anchor: { position: "relative" },
814
639
  container: {
815
- borderWidth: BORDER_WIDTH5,
640
+ borderWidth: BORDER_WIDTH4,
816
641
  borderRadius: BORDER_RADIUS3,
817
642
  paddingHorizontal: CONTAINER_PADDING_H,
818
643
  paddingVertical: CONTAINER_PADDING_V
@@ -876,7 +701,7 @@ var ModalDropdown = ({
876
701
  [onChange]
877
702
  );
878
703
  const containerStyle = useMemo(
879
- () => 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 }],
880
705
  [colors.border, colors.surface, renderTrigger]
881
706
  );
882
707
  const optionTestIDFor = useCallback(
@@ -884,11 +709,11 @@ var ModalDropdown = ({
884
709
  [optionTestID, testID]
885
710
  );
886
711
  const anchorStyle = useMemo(
887
- () => [styles9.anchor, buildAnchorStackStyle(isMenu && isOpen)],
712
+ () => [styles7.anchor, buildAnchorStackStyle(isMenu && isOpen)],
888
713
  [isMenu, isOpen]
889
714
  );
890
715
  const modalContentStyle = useMemo(
891
- () => [styles9.modalContent, { backgroundColor: colors.surface }],
716
+ () => [styles7.modalContent, { backgroundColor: colors.surface }],
892
717
  [colors.surface]
893
718
  );
894
719
  const renderModalOption = useCallback(
@@ -906,7 +731,7 @@ var ModalDropdown = ({
906
731
  const keyExtractor = useCallback((item) => String(item.value), []);
907
732
  return /* @__PURE__ */ jsxs(View, { ref: anchorRef, style: anchorStyle, children: [
908
733
  /* @__PURE__ */ jsxs(TouchableOpacity, { ...a11yProps, style: containerStyle, onPress: handleToggle, children: [
909
- 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 }),
910
735
  hintNode
911
736
  ] }),
912
737
  isMenu && isOpen ? /* @__PURE__ */ jsx(
@@ -923,7 +748,7 @@ var ModalDropdown = ({
923
748
  onSelect: handleSelect
924
749
  }
925
750
  ) : null,
926
- !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: [
927
752
  /* @__PURE__ */ jsx(
928
753
  TouchableOpacity,
929
754
  {
@@ -951,6 +776,258 @@ var ModalDropdown = ({
951
776
  ] }) }) : null
952
777
  ] });
953
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
+ };
954
1031
  var CLOSE_ICON_SIZE = 18;
955
1032
  var styles10 = StyleSheet.create({
956
1033
  container: {
@@ -976,7 +1053,7 @@ var ModalShell = ({
976
1053
  showClose = true
977
1054
  }) => {
978
1055
  const { theme, t } = useUi();
979
- const containerStyle = React8.useMemo(
1056
+ const containerStyle = React9.useMemo(
980
1057
  () => [styles10.container, { backgroundColor: theme.colors.background }, contentStyle],
981
1058
  [theme.colors.background, contentStyle]
982
1059
  );
@@ -1054,8 +1131,8 @@ var styles11 = StyleSheet.create({
1054
1131
  });
1055
1132
  function computeInitialOpen(children, defaultOpenIds, allowMultiple) {
1056
1133
  const ids = new Set(defaultOpenIds ?? []);
1057
- React8.Children.forEach(children, (child) => {
1058
- if (!React8.isValidElement(child)) return;
1134
+ React9.Children.forEach(children, (child) => {
1135
+ if (!React9.isValidElement(child)) return;
1059
1136
  const props = child.props;
1060
1137
  if (props.defaultOpen === true && typeof props.id === "string") {
1061
1138
  ids.add(props.id);