@dloizides/ui-layout 1.57.0 → 1.59.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
@@ -3531,12 +3531,23 @@ var DayBadgeFill = /* @__PURE__ */ ((DayBadgeFill2) => {
3531
3531
  DayBadgeFill2["Tint"] = "tint";
3532
3532
  return DayBadgeFill2;
3533
3533
  })(DayBadgeFill || {});
3534
+
3535
+ // src/DayCard/DayCardLayout.ts
3536
+ var DayCardLayout = /* @__PURE__ */ ((DayCardLayout2) => {
3537
+ DayCardLayout2["Grouped"] = "grouped";
3538
+ DayCardLayout2["Separate"] = "separate";
3539
+ return DayCardLayout2;
3540
+ })(DayCardLayout || {});
3534
3541
  var PILL_RADIUS2 = 999;
3535
3542
  var BADGE_ICON_SIZE = 12;
3543
+ var ITEM_RADIUS = 12;
3544
+ var ITEM_GAP = 8;
3536
3545
  var styles32 = StyleSheet.create({
3537
3546
  body: { borderRadius: 8, borderWidth: 1, overflow: "hidden" },
3538
3547
  count: { borderRadius: PILL_RADIUS2, borderWidth: 1, fontSize: 12, fontWeight: "700", paddingHorizontal: 8 },
3539
3548
  head: { alignItems: "center", flexDirection: "row", flexWrap: "wrap", gap: 8 },
3549
+ item: { borderRadius: ITEM_RADIUS, borderWidth: 1, overflow: "hidden" },
3550
+ items: { gap: ITEM_GAP },
3540
3551
  label: { fontSize: 13, fontWeight: "600" },
3541
3552
  stack: { gap: 6 }
3542
3553
  });
@@ -3549,12 +3560,14 @@ var DayCard = ({
3549
3560
  badgeTone = "warning" /* Warning */,
3550
3561
  badgeFill = "solid" /* Solid */,
3551
3562
  badgeIcon,
3563
+ layout = "grouped" /* Grouped */,
3552
3564
  testID,
3553
3565
  children
3554
3566
  }) => {
3555
3567
  const { theme } = useUi();
3556
3568
  const { colors } = theme;
3557
3569
  const tint = badgeFill === "tint" /* Tint */ ? resolveTintColors(theme, badgeTone) : void 0;
3570
+ const surface = { backgroundColor: colors.surface, borderColor: colors.border };
3558
3571
  const iconInk = tint?.color ?? colors.textSecondary;
3559
3572
  const icon = badgeIcon === void 0 ? void 0 : /* @__PURE__ */ jsx(SvgIcon, { color: iconInk, name: badgeIcon, size: BADGE_ICON_SIZE });
3560
3573
  return /* @__PURE__ */ jsxs(View, { style: styles32.stack, testID, children: [
@@ -3563,7 +3576,7 @@ var DayCard = ({
3563
3576
  /* @__PURE__ */ jsx(StatusBadge, { backgroundColor: tint?.backgroundColor, color: tint?.color, icon, label: badge, testID: testID === void 0 ? void 0 : `${testID}-badge`, tone: badgeTone }),
3564
3577
  /* @__PURE__ */ jsx(Text, { style: [styles32.count, { borderColor: colors.border, color: colors.textSecondary }], children: String(count) })
3565
3578
  ] }),
3566
- /* @__PURE__ */ jsx(View, { style: [styles32.body, { backgroundColor: colors.surface, borderColor: colors.border }], children })
3579
+ layout === "separate" /* Separate */ ? /* @__PURE__ */ jsx(View, { style: styles32.items, children: React16.Children.toArray(children).map((child, index) => /* @__PURE__ */ jsx(View, { style: [styles32.item, surface], testID: testID === void 0 ? void 0 : `${testID}-item-${String(index)}`, children: child }, index)) }) : /* @__PURE__ */ jsx(View, { style: [styles32.body, surface], children })
3567
3580
  ] });
3568
3581
  };
3569
3582
  var styles33 = StyleSheet.create({
@@ -3623,21 +3636,29 @@ var StickyActionBar = ({
3623
3636
  var TITLE_BASIS = 280;
3624
3637
  var styles36 = StyleSheet.create({
3625
3638
  row: { flexDirection: "row", flexWrap: "wrap", alignItems: "flex-start", justifyContent: "space-between", gap: 12 },
3639
+ rowCompact: { gap: 10 },
3626
3640
  text: { gap: 4, flexGrow: 1, flexShrink: 1, flexBasis: TITLE_BASIS, minWidth: 0 },
3641
+ textCompact: { gap: 2 },
3627
3642
  title: { fontSize: 24, fontWeight: "800" },
3643
+ titleCompact: { fontSize: 22, lineHeight: 26, fontWeight: "700" },
3644
+ subtitle: { fontSize: 14, lineHeight: 20 },
3645
+ subtitleCompact: { fontSize: 12, lineHeight: 16 },
3628
3646
  actions: { flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 8, maxWidth: "100%" }
3629
3647
  });
3630
3648
  function hasContent(node) {
3631
3649
  return node !== void 0 && node !== null && node !== false;
3632
3650
  }
3633
- var PageHead = ({ title, subtitle, actions, initialFocus = false, testID = LAYOUT_TEST_IDS.pageHead }) => {
3651
+ var PageHead = ({ title, subtitle, actions, initialFocus = false, compact, testID = LAYOUT_TEST_IDS.pageHead }) => {
3634
3652
  const { colors } = useUi().theme;
3653
+ const { width } = useWindowDimensions();
3654
+ const isCompact = compact ?? width < LAYOUT_COLLAPSE_BREAKPOINT;
3635
3655
  const titleRef = useInitialFocus();
3636
3656
  const focusProps = initialFocus ? { ref: titleRef, ...INITIAL_FOCUS_PROPS } : {};
3637
- return /* @__PURE__ */ jsxs(View, { style: styles36.row, testID, children: [
3638
- /* @__PURE__ */ jsxs(View, { style: styles36.text, children: [
3639
- /* @__PURE__ */ jsx(Text, { ...focusProps, accessibilityRole: "header", style: [styles36.title, { color: colors.text }], testID: `${testID}-title`, children: title }),
3640
- subtitle
3657
+ const subtitleNode = typeof subtitle === "string" ? /* @__PURE__ */ jsx(Text, { style: [isCompact ? styles36.subtitleCompact : styles36.subtitle, { color: colors.textSecondary }], testID: `${testID}-subtitle`, children: subtitle }) : subtitle;
3658
+ return /* @__PURE__ */ jsxs(View, { style: [styles36.row, isCompact ? styles36.rowCompact : null], testID, children: [
3659
+ /* @__PURE__ */ jsxs(View, { style: [styles36.text, isCompact ? styles36.textCompact : null], children: [
3660
+ /* @__PURE__ */ jsx(Text, { ...focusProps, accessibilityRole: "header", style: [isCompact ? styles36.titleCompact : styles36.title, { color: colors.text }], testID: `${testID}-title`, children: title }),
3661
+ subtitleNode
3641
3662
  ] }),
3642
3663
  hasContent(actions) ? /* @__PURE__ */ jsx(View, { style: styles36.actions, testID: `${testID}-actions`, children: actions }) : null
3643
3664
  ] });
@@ -3847,19 +3868,21 @@ var TabPressable = ({ tab, selected, onChange, style, children }) => /* @__PURE_
3847
3868
  children
3848
3869
  }
3849
3870
  );
3850
- var UnderlineTabItem = ({ underline, ...item }) => {
3871
+ var UnderlineTabItem = ({ underline, activeText, ...item }) => {
3851
3872
  const { theme } = useUi();
3873
+ const selectedInk = activeText ?? theme.colors.text;
3852
3874
  return /* @__PURE__ */ jsxs(TabPressable, { ...item, style: [styles43.tab, { borderBottomColor: item.selected ? underline : "transparent" }], children: [
3853
3875
  item.tab.icon ?? null,
3854
- /* @__PURE__ */ jsx(Text, { style: [styles43.label, { color: item.selected ? theme.colors.text : theme.colors.textSecondary }], children: item.tab.label }),
3876
+ /* @__PURE__ */ jsx(Text, { style: [styles43.label, { color: item.selected ? selectedInk : theme.colors.textSecondary }], children: item.tab.label }),
3855
3877
  item.tab.count === void 0 ? null : /* @__PURE__ */ jsx(Text, { style: [styles43.count, { backgroundColor: theme.colors.border, color: theme.colors.text }], children: String(item.tab.count) })
3856
3878
  ] });
3857
3879
  };
3858
- var ChipTabItem = (item) => {
3880
+ var ChipTabItem = ({ activeFill, activeText, ...item }) => {
3859
3881
  const { theme } = useUi();
3860
- const fill = item.selected ? theme.colors.text : "transparent";
3861
- const ink = item.selected ? theme.colors.background : theme.colors.text;
3862
- return /* @__PURE__ */ jsxs(TabPressable, { ...item, style: [styles43.chip, { backgroundColor: fill, borderColor: item.selected ? theme.colors.text : theme.colors.border }], children: [
3882
+ const selectedFill = activeFill ?? theme.colors.text;
3883
+ const fill = item.selected ? selectedFill : "transparent";
3884
+ const ink = item.selected ? activeText ?? theme.colors.background : theme.colors.text;
3885
+ return /* @__PURE__ */ jsxs(TabPressable, { ...item, style: [styles43.chip, { backgroundColor: fill, borderColor: item.selected ? selectedFill : theme.colors.border }], children: [
3863
3886
  /* @__PURE__ */ jsx(Text, { style: [styles43.label, { color: ink }], children: item.tab.label }),
3864
3887
  item.tab.count === void 0 ? null : /* @__PURE__ */ jsx(Text, { style: [styles43.chipCount, { color: ink }], children: String(item.tab.count) })
3865
3888
  ] });
@@ -3880,14 +3903,14 @@ var styles44 = StyleSheet.create({
3880
3903
  chipWrap: { flexWrap: "wrap" },
3881
3904
  strip: { position: "relative", width: "100%" }
3882
3905
  });
3883
- var UnderlineTabs = ({ tabs, activeKey, onChange, accessibilityLabel, accessibilityHint, underlineColor, fadeColor, testID, variant = "underline" /* Underline */, chipOverflow = "scroll" /* Scroll */ }) => {
3906
+ var UnderlineTabs = ({ tabs, activeKey, onChange, accessibilityLabel, accessibilityHint, underlineColor, fadeColor, testID, variant = "underline" /* Underline */, chipOverflow = "scroll" /* Scroll */, activeFillColor, activeTextColor }) => {
3884
3907
  const { theme } = useUi();
3885
3908
  const underline = underlineColor ?? theme.palette.primary[DEFAULT_UNDERLINE_STEP];
3886
3909
  const fade = useEdgeFade();
3887
3910
  const chips = variant === "chips" /* Chips */;
3888
3911
  const items = tabs.map((tab) => {
3889
- const item = { tab, selected: tab.key === activeKey, onChange };
3890
- return chips ? /* @__PURE__ */ jsx(ChipTabItem, { ...item }, tab.key) : /* @__PURE__ */ jsx(UnderlineTabItem, { ...item, underline }, tab.key);
3912
+ const item = { tab, selected: tab.key === activeKey, onChange, activeText: activeTextColor };
3913
+ return chips ? /* @__PURE__ */ jsx(ChipTabItem, { ...item, activeFill: activeFillColor }, tab.key) : /* @__PURE__ */ jsx(UnderlineTabItem, { ...item, underline }, tab.key);
3891
3914
  });
3892
3915
  const stripStyle = chips ? styles44.strip : [styles44.strip, { borderBottomColor: theme.colors.border, borderBottomWidth: 1 }];
3893
3916
  if (chips && chipOverflow === "wrap" /* Wrap */) {
@@ -4115,6 +4138,6 @@ var ListDetailLayout = ({
4115
4138
  return /* @__PURE__ */ jsx(SplitPanes, { end: null, layout: "stack" /* Stack */, start: panes.detail ? detail : list, testID });
4116
4139
  };
4117
4140
 
4118
- export { A4_PAGE, API_COMMIT_SEPARATOR, Accordion, AccordionItem, AppText, BUILD_INFO_PREFIX, BadgeTone, BottomSheet, Breadcrumb, BuildInfoFooter, COPY_FEEDBACK_MS, ChipOverflow, ConfirmDialog, ConfirmDialogFocus, CopyControl, CopyRowEmphasis, CopyStatus, CopyValueRow, CopyableId, CountBadge, DEFAULT_BILLING_ROUTE, DayBadgeFill, 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, PageHead, RecordActionButton, RecordHeader, RowSelectedStyle, SECTION_INDEX_BREAKPOINT, SECTION_INDEX_WIDTH, ScreenColumn, Section, SectionChips, SectionDensity, SectionIndex, SectionIndexLayout, SectionVariant, SegmentedControl, SegmentedVariant, SelectedMarker, SideSheet, SplitLayout, SplitPanes, StatusBadge, StickyActionBar, 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, resolveTintColors, resolveToneColors, rowSelection, scaledFrame, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap, useIsWideViewport, useListRowTone, useVisibleViewport };
4141
+ export { A4_PAGE, API_COMMIT_SEPARATOR, Accordion, AccordionItem, AppText, BUILD_INFO_PREFIX, BadgeTone, BottomSheet, Breadcrumb, BuildInfoFooter, COPY_FEEDBACK_MS, ChipOverflow, ConfirmDialog, ConfirmDialogFocus, CopyControl, CopyRowEmphasis, CopyStatus, CopyValueRow, CopyableId, CountBadge, DEFAULT_BILLING_ROUTE, DayBadgeFill, DayCard, DayCardLayout, 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, PageHead, RecordActionButton, RecordHeader, RowSelectedStyle, SECTION_INDEX_BREAKPOINT, SECTION_INDEX_WIDTH, ScreenColumn, Section, SectionChips, SectionDensity, SectionIndex, SectionIndexLayout, SectionVariant, SegmentedControl, SegmentedVariant, SelectedMarker, SideSheet, SplitLayout, SplitPanes, StatusBadge, StickyActionBar, 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, resolveTintColors, resolveToneColors, rowSelection, scaledFrame, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap, useIsWideViewport, useListRowTone, useVisibleViewport };
4119
4142
  //# sourceMappingURL=index.mjs.map
4120
4143
  //# sourceMappingURL=index.mjs.map