@dloizides/ui-layout 1.51.0 → 1.52.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
@@ -3683,46 +3683,81 @@ function useEdgeFade() {
3683
3683
  }
3684
3684
  var UNDERLINE = 3;
3685
3685
  var PAD_H4 = 12;
3686
+ var CHIP_PAD_H = 16;
3686
3687
  var GAP6 = 6;
3687
3688
  var FONT_SIZE4 = 14;
3688
3689
  var COUNT_FONT = 12;
3689
3690
  var COUNT_MIN = 22;
3690
3691
  var COUNT_PAD = 6;
3691
3692
  var PILL = 999;
3692
- var DEFAULT_UNDERLINE_STEP = "700";
3693
- var SCROLL_THROTTLE_MS = 16;
3694
3693
  var styles40 = StyleSheet.create({
3694
+ chip: { alignItems: "center", borderRadius: PILL, borderWidth: 1, flexDirection: "row", gap: GAP6, justifyContent: "center", minHeight: MIN_TARGET_PX, minWidth: MIN_TARGET_PX, paddingHorizontal: CHIP_PAD_H },
3695
+ chipCount: { fontSize: FONT_SIZE4, fontWeight: "700" },
3695
3696
  count: { borderRadius: PILL, fontSize: COUNT_FONT, fontWeight: "700", minWidth: COUNT_MIN, paddingHorizontal: COUNT_PAD, textAlign: "center" },
3696
3697
  label: { fontSize: FONT_SIZE4, fontWeight: "600" },
3697
- strip: { borderBottomWidth: 1, position: "relative", width: "100%" },
3698
3698
  tab: { alignItems: "center", borderBottomWidth: UNDERLINE, flexDirection: "row", gap: GAP6, justifyContent: "center", minHeight: MIN_TARGET_PX, minWidth: MIN_TARGET_PX, paddingHorizontal: PAD_H4 }
3699
3699
  });
3700
- var UnderlineTabs = ({ tabs, activeKey, onChange, accessibilityLabel, accessibilityHint, underlineColor, fadeColor, testID }) => {
3700
+ var TabPressable = ({ tab, selected, onChange, style, children }) => /* @__PURE__ */ jsx(
3701
+ Pressable,
3702
+ {
3703
+ accessibilityHint: tab.accessibilityHint,
3704
+ accessibilityLabel: tab.label,
3705
+ accessibilityRole: "tab",
3706
+ accessibilityState: { selected },
3707
+ "aria-selected": selected,
3708
+ style,
3709
+ testID: tab.testID,
3710
+ onPress: () => onChange(tab.key),
3711
+ children
3712
+ }
3713
+ );
3714
+ var UnderlineTabItem = ({ underline, ...item }) => {
3715
+ const { theme } = useUi();
3716
+ return /* @__PURE__ */ jsxs(TabPressable, { ...item, style: [styles40.tab, { borderBottomColor: item.selected ? underline : "transparent" }], children: [
3717
+ /* @__PURE__ */ jsx(Text, { style: [styles40.label, { color: item.selected ? theme.colors.text : theme.colors.textSecondary }], children: item.tab.label }),
3718
+ item.tab.count === void 0 ? null : /* @__PURE__ */ jsx(Text, { style: [styles40.count, { backgroundColor: theme.colors.border, color: theme.colors.text }], children: String(item.tab.count) })
3719
+ ] });
3720
+ };
3721
+ var ChipTabItem = (item) => {
3722
+ const { theme } = useUi();
3723
+ const fill = item.selected ? theme.colors.text : "transparent";
3724
+ const ink = item.selected ? theme.colors.background : theme.colors.text;
3725
+ return /* @__PURE__ */ jsxs(TabPressable, { ...item, style: [styles40.chip, { backgroundColor: fill, borderColor: item.selected ? theme.colors.text : theme.colors.border }], children: [
3726
+ /* @__PURE__ */ jsx(Text, { style: [styles40.label, { color: ink }], children: item.tab.label }),
3727
+ item.tab.count === void 0 ? null : /* @__PURE__ */ jsx(Text, { style: [styles40.chipCount, { color: ink }], children: String(item.tab.count) })
3728
+ ] });
3729
+ };
3730
+
3731
+ // src/Tabs/TabsVariant.ts
3732
+ var TabsVariant = /* @__PURE__ */ ((TabsVariant2) => {
3733
+ TabsVariant2["Underline"] = "underline";
3734
+ TabsVariant2["Chips"] = "chips";
3735
+ return TabsVariant2;
3736
+ })(TabsVariant || {});
3737
+ var DEFAULT_UNDERLINE_STEP = "700";
3738
+ var SCROLL_THROTTLE_MS = 16;
3739
+ var CHIP_GAP = 8;
3740
+ var CHIP_PAD_V = 4;
3741
+ var styles41 = StyleSheet.create({
3742
+ chipRow: { alignItems: "center", flexDirection: "row", gap: CHIP_GAP, paddingVertical: CHIP_PAD_V },
3743
+ chipWrap: { flexWrap: "wrap" },
3744
+ strip: { position: "relative", width: "100%" }
3745
+ });
3746
+ var UnderlineTabs = ({ tabs, activeKey, onChange, accessibilityLabel, accessibilityHint, underlineColor, fadeColor, testID, variant = "underline" /* Underline */, chipOverflow = "scroll" /* Scroll */ }) => {
3701
3747
  const { theme } = useUi();
3702
3748
  const underline = underlineColor ?? theme.palette.primary[DEFAULT_UNDERLINE_STEP];
3703
3749
  const fade = useEdgeFade();
3704
- return /* @__PURE__ */ jsxs(View, { style: [styles40.strip, { borderBottomColor: theme.colors.border }], testID, children: [
3705
- /* @__PURE__ */ jsx(ScrollView, { horizontal: true, accessibilityHint, accessibilityRole: "tablist", "aria-label": accessibilityLabel, scrollEventThrottle: SCROLL_THROTTLE_MS, showsHorizontalScrollIndicator: false, onContentSizeChange: fade.onContentSizeChange, onLayout: fade.onLayout, onScroll: fade.onScroll, children: tabs.map((tab) => {
3706
- const selected = tab.key === activeKey;
3707
- return /* @__PURE__ */ jsxs(
3708
- Pressable,
3709
- {
3710
- accessibilityHint: tab.accessibilityHint,
3711
- accessibilityLabel: tab.label,
3712
- accessibilityRole: "tab",
3713
- accessibilityState: { selected },
3714
- "aria-selected": selected,
3715
- style: [styles40.tab, { borderBottomColor: selected ? underline : "transparent" }],
3716
- testID: tab.testID,
3717
- onPress: () => onChange(tab.key),
3718
- children: [
3719
- /* @__PURE__ */ jsx(Text, { style: [styles40.label, { color: selected ? theme.colors.text : theme.colors.textSecondary }], children: tab.label }),
3720
- tab.count === void 0 ? null : /* @__PURE__ */ jsx(Text, { style: [styles40.count, { backgroundColor: theme.colors.border, color: theme.colors.text }], children: String(tab.count) })
3721
- ]
3722
- },
3723
- tab.key
3724
- );
3725
- }) }),
3750
+ const chips = variant === "chips" /* Chips */;
3751
+ const items = tabs.map((tab) => {
3752
+ const item = { tab, selected: tab.key === activeKey, onChange };
3753
+ return chips ? /* @__PURE__ */ jsx(ChipTabItem, { ...item }, tab.key) : /* @__PURE__ */ jsx(UnderlineTabItem, { ...item, underline }, tab.key);
3754
+ });
3755
+ const stripStyle = chips ? styles41.strip : [styles41.strip, { borderBottomColor: theme.colors.border, borderBottomWidth: 1 }];
3756
+ if (chips && chipOverflow === "wrap" /* Wrap */) {
3757
+ return /* @__PURE__ */ jsx(View, { accessibilityHint, accessibilityRole: "tablist", "aria-label": accessibilityLabel, style: [styles41.chipRow, styles41.chipWrap], testID, children: items });
3758
+ }
3759
+ return /* @__PURE__ */ jsxs(View, { style: stripStyle, testID, children: [
3760
+ /* @__PURE__ */ jsx(ScrollView, { horizontal: true, accessibilityHint, accessibilityRole: "tablist", "aria-label": accessibilityLabel, contentContainerStyle: chips ? styles41.chipRow : void 0, scrollEventThrottle: SCROLL_THROTTLE_MS, showsHorizontalScrollIndicator: false, onContentSizeChange: fade.onContentSizeChange, onLayout: fade.onLayout, onScroll: fade.onScroll, children: items }),
3726
3761
  fade.visible ? /* @__PURE__ */ jsx(EdgeFadeStrip, { color: fadeColor ?? theme.colors.background }) : null
3727
3762
  ] });
3728
3763
  };
@@ -3730,7 +3765,7 @@ var RADIUS3 = 12;
3730
3765
  var PAD = 16;
3731
3766
  var GAP7 = 8;
3732
3767
  var TITLE_FONT = 15;
3733
- var styles41 = StyleSheet.create({
3768
+ var styles42 = StyleSheet.create({
3734
3769
  card: { borderRadius: RADIUS3, borderWidth: 1, gap: GAP7, minWidth: 0, padding: PAD },
3735
3770
  footer: { alignItems: "flex-start", flexDirection: "row", flexWrap: "wrap", gap: GAP7 },
3736
3771
  head: { alignItems: "center", flexDirection: "row", gap: GAP7 },
@@ -3738,14 +3773,14 @@ var styles41 = StyleSheet.create({
3738
3773
  });
3739
3774
  var WidgetCard = ({ title, children, icon, headerRight, footer, testID }) => {
3740
3775
  const { theme } = useUi();
3741
- return /* @__PURE__ */ jsxs(View, { style: [styles41.card, { backgroundColor: theme.colors.surfaceElevated, borderColor: theme.colors.border }], testID, children: [
3742
- /* @__PURE__ */ jsxs(View, { style: styles41.head, children: [
3776
+ return /* @__PURE__ */ jsxs(View, { style: [styles42.card, { backgroundColor: theme.colors.surfaceElevated, borderColor: theme.colors.border }], testID, children: [
3777
+ /* @__PURE__ */ jsxs(View, { style: styles42.head, children: [
3743
3778
  icon === void 0 ? null : /* @__PURE__ */ jsx(View, { "aria-hidden": true, children: icon }),
3744
- /* @__PURE__ */ jsx(Text, { accessibilityRole: "header", style: [styles41.title, { color: theme.colors.text }], children: title }),
3779
+ /* @__PURE__ */ jsx(Text, { accessibilityRole: "header", style: [styles42.title, { color: theme.colors.text }], children: title }),
3745
3780
  headerRight
3746
3781
  ] }),
3747
3782
  children,
3748
- footer === void 0 ? null : /* @__PURE__ */ jsx(View, { style: styles41.footer, children: footer })
3783
+ footer === void 0 ? null : /* @__PURE__ */ jsx(View, { style: styles42.footer, children: footer })
3749
3784
  ] });
3750
3785
  };
3751
3786
  var LEAD_LABEL_SIZE = 14;
@@ -3757,7 +3792,7 @@ var GAP8 = 12;
3757
3792
  var LEAD_GAP = 4;
3758
3793
  var LEAD_BORDER = 1.5;
3759
3794
  var ACCENT_STEP = "500";
3760
- var styles42 = StyleSheet.create({
3795
+ var styles43 = StyleSheet.create({
3761
3796
  slip: { gap: GAP8, width: "100%" },
3762
3797
  lead: { padding: LEAD_PAD, borderRadius: LEAD_RADIUS, borderWidth: LEAD_BORDER, gap: LEAD_GAP },
3763
3798
  leadLabel: { fontSize: LEAD_LABEL_SIZE },
@@ -3769,13 +3804,13 @@ var TransferSlip = ({ leadLabel, amount, recipient, children, footer, testID })
3769
3804
  const { theme } = useUi();
3770
3805
  const { colors } = theme;
3771
3806
  const accent = theme.palette.primary[ACCENT_STEP];
3772
- return /* @__PURE__ */ jsxs(View, { style: styles42.slip, testID, children: [
3773
- /* @__PURE__ */ jsxs(View, { style: [styles42.lead, { borderColor: accent, backgroundColor: colors.surface }], testID: `${testID}-lead`, children: [
3774
- /* @__PURE__ */ jsx(Text, { style: [styles42.leadLabel, { color: colors.textSecondary }], children: leadLabel }),
3775
- /* @__PURE__ */ jsx(Text, { style: [styles42.amount, { color: colors.text }], testID: `${testID}-amount`, children: amount }),
3776
- recipient !== void 0 && /* @__PURE__ */ jsx(Text, { style: [styles42.recipient, { color: colors.text }], children: recipient })
3807
+ return /* @__PURE__ */ jsxs(View, { style: styles43.slip, testID, children: [
3808
+ /* @__PURE__ */ jsxs(View, { style: [styles43.lead, { borderColor: accent, backgroundColor: colors.surface }], testID: `${testID}-lead`, children: [
3809
+ /* @__PURE__ */ jsx(Text, { style: [styles43.leadLabel, { color: colors.textSecondary }], children: leadLabel }),
3810
+ /* @__PURE__ */ jsx(Text, { style: [styles43.amount, { color: colors.text }], testID: `${testID}-amount`, children: amount }),
3811
+ recipient !== void 0 && /* @__PURE__ */ jsx(Text, { style: [styles43.recipient, { color: colors.text }], children: recipient })
3777
3812
  ] }),
3778
- /* @__PURE__ */ jsx(View, { style: styles42.rows, children }),
3813
+ /* @__PURE__ */ jsx(View, { style: styles43.rows, children }),
3779
3814
  footer
3780
3815
  ] });
3781
3816
  };
@@ -3801,7 +3836,7 @@ var STACK_GAP = 8;
3801
3836
  var ROW_PAD = 10;
3802
3837
  var TEXT_GAP = 2;
3803
3838
  var MONO_SPACING = 1;
3804
- var styles43 = StyleSheet.create({
3839
+ var styles44 = StyleSheet.create({
3805
3840
  inline: { flexDirection: "row", alignItems: "center", gap: ROW_GAP3, paddingVertical: ROW_PAD, borderTopWidth: StyleSheet.hairlineWidth },
3806
3841
  prominent: { gap: STACK_GAP, paddingVertical: ROW_PAD },
3807
3842
  text: { flex: 1, minWidth: 0, gap: TEXT_GAP },
@@ -3824,10 +3859,10 @@ var CopyValueRow = ({
3824
3859
  const { status, copy } = useCopyToClipboard(copyValue ?? value, writer);
3825
3860
  const action = copyActionLabel(status, labels);
3826
3861
  const prominent = emphasis === "prominent" /* Prominent */;
3827
- const valueStyle = prominent || monospace ? styles43.big : styles43.value;
3828
- return /* @__PURE__ */ jsxs(View, { style: prominent ? styles43.prominent : [styles43.inline, { borderTopColor: colors.border }], testID, children: [
3829
- /* @__PURE__ */ jsxs(View, { style: styles43.text, children: [
3830
- /* @__PURE__ */ jsx(Text, { style: [styles43.label, { color: colors.textSecondary }], children: label }),
3862
+ const valueStyle = prominent || monospace ? styles44.big : styles44.value;
3863
+ return /* @__PURE__ */ jsxs(View, { style: prominent ? styles44.prominent : [styles44.inline, { borderTopColor: colors.border }], testID, children: [
3864
+ /* @__PURE__ */ jsxs(View, { style: styles44.text, children: [
3865
+ /* @__PURE__ */ jsx(Text, { style: [styles44.label, { color: colors.textSecondary }], children: label }),
3831
3866
  /* @__PURE__ */ jsx(Text, { selectable: true, style: [valueStyle, { color: colors.text }], testID: `${testID}-value`, children: value })
3832
3867
  ] }),
3833
3868
  /* @__PURE__ */ jsx(
@@ -3859,7 +3894,7 @@ var TILE_PAD = 12;
3859
3894
  var TILE_RADIUS = 10;
3860
3895
  var TILE_GAP = 2;
3861
3896
  var ALERT_STEP = "500";
3862
- var styles44 = StyleSheet.create({
3897
+ var styles45 = StyleSheet.create({
3863
3898
  tile: { padding: TILE_PAD, borderRadius: TILE_RADIUS, borderWidth: StyleSheet.hairlineWidth, gap: TILE_GAP },
3864
3899
  label: { fontSize: LABEL_SIZE2, fontWeight: "600" },
3865
3900
  value: { fontSize: VALUE_SIZE2, fontWeight: "700" },
@@ -3873,19 +3908,19 @@ var TotalsStrip = ({ items, breakpoint = LAYOUT_COLLAPSE_BREAKPOINT, testID }) =
3873
3908
  return /* @__PURE__ */ jsx(FigureStrip, { testID, children: items.map((item) => /* @__PURE__ */ jsxs(
3874
3909
  View,
3875
3910
  {
3876
- style: [styles44.tile, figureCell(wide), { borderColor: colors.border, backgroundColor: colors.surfaceElevated }],
3911
+ style: [styles45.tile, figureCell(wide), { borderColor: colors.border, backgroundColor: colors.surfaceElevated }],
3877
3912
  testID: `${testID}-${item.key}`,
3878
3913
  children: [
3879
- /* @__PURE__ */ jsx(Text, { style: [styles44.label, { color: colors.textSecondary }], children: item.label }),
3914
+ /* @__PURE__ */ jsx(Text, { style: [styles45.label, { color: colors.textSecondary }], children: item.label }),
3880
3915
  /* @__PURE__ */ jsx(
3881
3916
  Text,
3882
3917
  {
3883
- style: [styles44.value, { color: item.tone === "alert" /* Alert */ ? theme.semantic.error[ALERT_STEP] : colors.text }],
3918
+ style: [styles45.value, { color: item.tone === "alert" /* Alert */ ? theme.semantic.error[ALERT_STEP] : colors.text }],
3884
3919
  testID: `${testID}-${item.key}-value`,
3885
3920
  children: item.value
3886
3921
  }
3887
3922
  ),
3888
- item.caption !== void 0 && /* @__PURE__ */ jsx(Text, { style: [styles44.caption, { color: colors.textSecondary }], children: item.caption })
3923
+ item.caption !== void 0 && /* @__PURE__ */ jsx(Text, { style: [styles45.caption, { color: colors.textSecondary }], children: item.caption })
3889
3924
  ]
3890
3925
  },
3891
3926
  item.key
@@ -3924,6 +3959,6 @@ var ListDetailLayout = ({
3924
3959
  return /* @__PURE__ */ jsx(SplitPanes, { end: null, layout: "stack" /* Stack */, start: panes.detail ? detail : list, testID });
3925
3960
  };
3926
3961
 
3927
- export { A4_PAGE, API_COMMIT_SEPARATOR, Accordion, AccordionItem, AppText, BUILD_INFO_PREFIX, BadgeTone, BottomSheet, Breadcrumb, BuildInfoFooter, COPY_FEEDBACK_MS, ChipOverflow, ConfirmDialog, ConfirmDialogFocus, CopyRowEmphasis, CopyStatus, CopyValueRow, CopyableId, CountBadge, DEFAULT_BILLING_ROUTE, DayCard, DropdownVariant, ELLIPSIS, FigureStrip, FormDialog, HEADER_STACK_BREAKPOINT, Heading, IdChip, LAYOUT_COLLAPSE_BREAKPOINT, LAYOUT_I18N, LAYOUT_TEST_IDS, ListDetailLayout, ListDetailPane, ListRow, MIN_TARGET_PX, MODAL_FOOTER_STACK_BELOW, Modal, ModalDropdown, ModalShell, PageFrame, RecordActionButton, RecordHeader, RowSelectedStyle, SECTION_INDEX_BREAKPOINT, ScreenColumn, Section, SectionChips, SectionDensity, SectionIndex, SectionIndexLayout, SectionVariant, SegmentedControl, SelectedMarker, SideSheet, SplitLayout, SplitPanes, StatusBadge, StickyPreview, TYPE_SCALE_BREAKPOINT, Tabs, TabsCollapsedTrigger, TextKind, Timeline, ToggleSection, TotalsStrip, TotalsTone, TransferSlip, TruncatedText, UnderlineTabs, UpgradePrompt, WidgetCard, copyActionLabel, copyText, figureCell, formatBuildInfo, formatCount, formatUrlForDisplay, isKeyboardOpen, isModalFooterStacked, isRecordHeaderCompact, isSplitSideBySide, isWideWebViewport, pageScale, resolveActiveKey, resolveListDetailPanes, resolveRowLook, resolveToneColors, rowSelection, scaledFrame, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap, useIsWideViewport, useListRowTone, useVisibleViewport };
3962
+ export { A4_PAGE, API_COMMIT_SEPARATOR, Accordion, AccordionItem, AppText, BUILD_INFO_PREFIX, BadgeTone, BottomSheet, Breadcrumb, BuildInfoFooter, COPY_FEEDBACK_MS, ChipOverflow, ConfirmDialog, ConfirmDialogFocus, CopyRowEmphasis, CopyStatus, CopyValueRow, CopyableId, CountBadge, DEFAULT_BILLING_ROUTE, DayCard, DropdownVariant, ELLIPSIS, FigureStrip, FormDialog, HEADER_STACK_BREAKPOINT, Heading, IdChip, LAYOUT_COLLAPSE_BREAKPOINT, LAYOUT_I18N, LAYOUT_TEST_IDS, ListDetailLayout, ListDetailPane, ListRow, MIN_TARGET_PX, MODAL_FOOTER_STACK_BELOW, Modal, ModalDropdown, ModalShell, PageFrame, RecordActionButton, RecordHeader, RowSelectedStyle, SECTION_INDEX_BREAKPOINT, ScreenColumn, Section, SectionChips, SectionDensity, SectionIndex, SectionIndexLayout, SectionVariant, SegmentedControl, SelectedMarker, SideSheet, SplitLayout, SplitPanes, StatusBadge, StickyPreview, TYPE_SCALE_BREAKPOINT, Tabs, TabsCollapsedTrigger, TabsVariant, TextKind, Timeline, ToggleSection, TotalsStrip, TotalsTone, TransferSlip, TruncatedText, UnderlineTabs, UpgradePrompt, WidgetCard, copyActionLabel, copyText, figureCell, formatBuildInfo, formatCount, formatUrlForDisplay, isKeyboardOpen, isModalFooterStacked, isRecordHeaderCompact, isSplitSideBySide, isWideWebViewport, pageScale, resolveActiveKey, resolveListDetailPanes, resolveRowLook, resolveToneColors, rowSelection, scaledFrame, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap, useIsWideViewport, useListRowTone, useVisibleViewport };
3928
3963
  //# sourceMappingURL=index.mjs.map
3929
3964
  //# sourceMappingURL=index.mjs.map