@dloizides/ui-layout 1.47.0 → 1.49.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
@@ -1711,6 +1711,7 @@ var TabsMenu = ({
1711
1711
  activeKey,
1712
1712
  onChange,
1713
1713
  accessibilityLabel,
1714
+ accessibilityHint,
1714
1715
  idPrefix,
1715
1716
  testID,
1716
1717
  collapsedTrigger = "caret" /* Caret */
@@ -1731,7 +1732,7 @@ var TabsMenu = ({
1731
1732
  return /* @__PURE__ */ jsx(
1732
1733
  ModalDropdown,
1733
1734
  {
1734
- accessibilityHint: t(LAYOUT_I18N.tabsMenuHint),
1735
+ accessibilityHint: accessibilityHint ?? t(LAYOUT_I18N.tabsMenuHint),
1735
1736
  accessibilityLabel,
1736
1737
  optionTestID,
1737
1738
  options,
@@ -1811,13 +1812,14 @@ var WideTabStrip = ({
1811
1812
  activeKey,
1812
1813
  onChange,
1813
1814
  accessibilityLabel,
1815
+ accessibilityHint,
1814
1816
  idPrefix,
1815
1817
  borderColor,
1816
1818
  primaryColor,
1817
1819
  textSecondary,
1818
1820
  surfaceElevated,
1819
1821
  stripStyle
1820
- }) => /* @__PURE__ */ jsx(View, { style: [styles15.stripOuter, { borderBottomColor: borderColor }], children: /* @__PURE__ */ jsx(ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, children: /* @__PURE__ */ jsx(View, { accessibilityRole: "tablist", "aria-label": accessibilityLabel, style: [styles15.strip, stripStyle], children: tabs.map((tab) => {
1822
+ }) => /* @__PURE__ */ jsx(View, { style: [styles15.stripOuter, { borderBottomColor: borderColor }], children: /* @__PURE__ */ jsx(ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, children: /* @__PURE__ */ jsx(View, { accessibilityHint, accessibilityRole: "tablist", "aria-label": accessibilityLabel, style: [styles15.strip, stripStyle], children: tabs.map((tab) => {
1821
1823
  const selected = tab.key === activeKey;
1822
1824
  const textColor = selected ? TEXT_ON_PRIMARY : textSecondary;
1823
1825
  const pillColor = selected ? primaryColor : surfaceElevated;
@@ -1844,6 +1846,7 @@ var Tabs = ({
1844
1846
  activeKey,
1845
1847
  onChange,
1846
1848
  accessibilityLabel,
1849
+ accessibilityHint,
1847
1850
  children,
1848
1851
  idPrefix = "tabs",
1849
1852
  collapseBelow = TABS_COLLAPSE_BREAKPOINT,
@@ -1863,6 +1866,7 @@ var Tabs = ({
1863
1866
  collapsed ? /* @__PURE__ */ jsx(
1864
1867
  TabsMenu,
1865
1868
  {
1869
+ accessibilityHint,
1866
1870
  accessibilityLabel,
1867
1871
  activeKey,
1868
1872
  collapsedTrigger,
@@ -1874,6 +1878,7 @@ var Tabs = ({
1874
1878
  ) : /* @__PURE__ */ jsx(
1875
1879
  WideTabStrip,
1876
1880
  {
1881
+ accessibilityHint,
1877
1882
  accessibilityLabel,
1878
1883
  activeKey,
1879
1884
  borderColor: colors.border,
@@ -3475,6 +3480,188 @@ var Timeline = ({ entries, accessibilityLabel, accessibilityHint, testID }) => {
3475
3480
  )) });
3476
3481
  };
3477
3482
 
3478
- export { A4_PAGE, API_COMMIT_SEPARATOR, Accordion, AccordionItem, AppText, BUILD_INFO_PREFIX, BadgeTone, BottomSheet, BuildInfoFooter, COPY_FEEDBACK_MS, ChipOverflow, ConfirmDialog, ConfirmDialogFocus, CopyStatus, CopyableId, CountBadge, DEFAULT_BILLING_ROUTE, DayCard, DropdownVariant, ELLIPSIS, FigureStrip, FormDialog, HEADER_STACK_BREAKPOINT, Heading, LAYOUT_COLLAPSE_BREAKPOINT, LAYOUT_I18N, LAYOUT_TEST_IDS, ListRow, MIN_TARGET_PX, MODAL_FOOTER_STACK_BELOW, Modal, ModalDropdown, ModalShell, PageFrame, 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, TruncatedText, UpgradePrompt, copyText, figureCell, formatBuildInfo, formatCount, formatUrlForDisplay, isKeyboardOpen, isModalFooterStacked, isSplitSideBySide, isWideWebViewport, pageScale, resolveActiveKey, resolveRowLook, resolveToneColors, scaledFrame, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap, useIsWideViewport, useListRowTone, useVisibleViewport };
3483
+ // src/RecordHeader/recordHeaderLayout.ts
3484
+ function isRecordHeaderCompact(width, breakpoint = LAYOUT_COLLAPSE_BREAKPOINT) {
3485
+ return width < breakpoint;
3486
+ }
3487
+ var GAP2 = 8;
3488
+ var WIDE_GAP = 16;
3489
+ var styles35 = StyleSheet.create({
3490
+ actions: { alignItems: "center", flexDirection: "row", flexWrap: "wrap", gap: GAP2, justifyContent: "flex-end" },
3491
+ compactActions: { alignItems: "center", flexDirection: "row", flexWrap: "wrap", gap: GAP2 },
3492
+ identity: { flex: 1, gap: GAP2, minWidth: 0 },
3493
+ root: { gap: GAP2 },
3494
+ top: { alignItems: "flex-start", flexDirection: "row", gap: WIDE_GAP }
3495
+ });
3496
+ var RecordHeader = ({ breadcrumb, title, meta, actions, collapseBelow, testID }) => {
3497
+ const compact = isRecordHeaderCompact(useWindowDimensions().width, collapseBelow);
3498
+ const actionRow = actions === void 0 ? null : /* @__PURE__ */ jsx(View, { style: compact ? styles35.compactActions : styles35.actions, children: actions });
3499
+ return /* @__PURE__ */ jsx(View, { style: styles35.root, testID, children: /* @__PURE__ */ jsxs(View, { style: compact ? styles35.root : styles35.top, children: [
3500
+ /* @__PURE__ */ jsxs(View, { style: styles35.identity, children: [
3501
+ breadcrumb,
3502
+ title,
3503
+ meta
3504
+ ] }),
3505
+ actionRow
3506
+ ] }) });
3507
+ };
3508
+ var FONT_SIZE = 13;
3509
+ var GAP3 = 6;
3510
+ var SEPARATOR = "\u203A";
3511
+ var BACK = "\u2039";
3512
+ var styles36 = StyleSheet.create({
3513
+ link: { justifyContent: "center", minHeight: MIN_TARGET_PX },
3514
+ row: { alignItems: "center", flexDirection: "row", flexWrap: "wrap", gap: GAP3 },
3515
+ text: { fontSize: FONT_SIZE, fontWeight: "500" }
3516
+ });
3517
+ var Breadcrumb = ({ items, accessibilityLabel, testID }) => {
3518
+ const { theme } = useUi();
3519
+ const muted = { color: theme.colors.textSecondary };
3520
+ return /* @__PURE__ */ jsxs(View, { "aria-label": accessibilityLabel, style: styles36.row, testID, children: [
3521
+ /* @__PURE__ */ jsx(Text, { "aria-hidden": true, style: [styles36.text, muted], children: BACK }),
3522
+ items.map((item, index) => /* @__PURE__ */ jsxs(React16.Fragment, { children: [
3523
+ index > 0 ? /* @__PURE__ */ jsx(Text, { "aria-hidden": true, style: [styles36.text, muted], children: SEPARATOR }) : null,
3524
+ item.onPress === void 0 ? /* @__PURE__ */ jsx(Text, { style: [styles36.text, muted], testID: item.testID, children: item.label }) : /* @__PURE__ */ jsx(Pressable, { accessibilityHint: item.accessibilityHint, accessibilityLabel: item.label, accessibilityRole: "link", style: styles36.link, testID: item.testID, onPress: item.onPress, children: /* @__PURE__ */ jsx(Text, { style: [styles36.text, { color: theme.colors.text }], children: item.label }) })
3525
+ ] }, item.key))
3526
+ ] });
3527
+ };
3528
+ var RADIUS = 8;
3529
+ var PAD_H2 = 12;
3530
+ var GAP4 = 6;
3531
+ var FONT_SIZE2 = 13;
3532
+ var DISABLED_OPACITY2 = 0.55;
3533
+ var styles37 = StyleSheet.create({
3534
+ base: { alignItems: "center", borderRadius: RADIUS, borderWidth: 1, flexDirection: "row", gap: GAP4, justifyContent: "center", minHeight: MIN_TARGET_PX, minWidth: MIN_TARGET_PX, paddingHorizontal: PAD_H2 },
3535
+ disabled: { borderStyle: "dashed", opacity: DISABLED_OPACITY2 },
3536
+ text: { fontSize: FONT_SIZE2, fontWeight: "600" }
3537
+ });
3538
+ function hasTitle(node) {
3539
+ return typeof node === "object" && node !== null && "setAttribute" in node;
3540
+ }
3541
+ var RecordActionButton = ({ label, hint, testID, icon, onPress, iconOnly = false, disabledReason }) => {
3542
+ const { theme } = useUi();
3543
+ const ref = useRef(null);
3544
+ const disabled = onPress === void 0;
3545
+ const title = disabled ? disabledReason : void 0;
3546
+ useEffect(() => {
3547
+ const node = ref.current;
3548
+ if (Platform.OS === "web" && title !== void 0 && hasTitle(node)) node.setAttribute("title", title);
3549
+ }, [title]);
3550
+ const showLabel = !iconOnly || icon === void 0;
3551
+ return /* @__PURE__ */ jsxs(
3552
+ Pressable,
3553
+ {
3554
+ ref,
3555
+ accessibilityHint: title ?? hint,
3556
+ accessibilityLabel: label,
3557
+ accessibilityRole: "button",
3558
+ accessibilityState: { disabled },
3559
+ disabled,
3560
+ style: [styles37.base, { backgroundColor: theme.colors.surfaceElevated, borderColor: theme.colors.border }, disabled && styles37.disabled],
3561
+ testID,
3562
+ onPress,
3563
+ children: [
3564
+ icon === void 0 ? null : /* @__PURE__ */ jsx(View, { "aria-hidden": true, children: icon }),
3565
+ showLabel ? /* @__PURE__ */ jsx(Text, { style: [styles37.text, { color: theme.colors.text }], children: label }) : null
3566
+ ]
3567
+ }
3568
+ );
3569
+ };
3570
+ var RADIUS2 = 6;
3571
+ var PAD_H3 = 10;
3572
+ var GAP5 = 6;
3573
+ var FONT_SIZE3 = 12;
3574
+ var COPY_GLYPH = "\u29C9";
3575
+ var COPIED_GLYPH = "\u2713";
3576
+ var MONO = Platform.select({ web: "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace", default: "monospace" });
3577
+ var styles38 = StyleSheet.create({
3578
+ chip: { alignItems: "center", alignSelf: "flex-start", borderRadius: RADIUS2, borderWidth: 1, flexDirection: "row", gap: GAP5, maxWidth: "100%", minHeight: MIN_TARGET_PX, paddingHorizontal: PAD_H3 },
3579
+ text: { flexShrink: 1, fontFamily: MONO, fontSize: FONT_SIZE3 }
3580
+ });
3581
+ var IdChip = ({ label, value, testID, accessibilityLabel, accessibilityHint, display, valueTestID, writer }) => {
3582
+ const { theme } = useUi();
3583
+ const { status, copy } = useCopyToClipboard(value, writer);
3584
+ const ink = { color: theme.colors.text };
3585
+ return /* @__PURE__ */ jsxs(
3586
+ Pressable,
3587
+ {
3588
+ accessibilityHint,
3589
+ accessibilityLabel,
3590
+ accessibilityRole: "button",
3591
+ style: [styles38.chip, { backgroundColor: theme.colors.surfaceElevated, borderColor: theme.colors.border }],
3592
+ testID,
3593
+ onPress: copy,
3594
+ children: [
3595
+ /* @__PURE__ */ jsx(Text, { style: [styles38.text, { color: theme.colors.textSecondary }], children: label }),
3596
+ /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [styles38.text, ink], testID: valueTestID, children: display ?? value }),
3597
+ /* @__PURE__ */ jsx(Text, { "aria-hidden": true, style: [styles38.text, ink], testID: `${testID}-glyph`, children: status === "copied" /* Copied */ ? COPIED_GLYPH : COPY_GLYPH })
3598
+ ]
3599
+ }
3600
+ );
3601
+ };
3602
+ var UNDERLINE = 3;
3603
+ var PAD_H4 = 12;
3604
+ var GAP6 = 6;
3605
+ var FONT_SIZE4 = 14;
3606
+ var COUNT_FONT = 12;
3607
+ var COUNT_MIN = 22;
3608
+ var COUNT_PAD = 6;
3609
+ var PILL = 999;
3610
+ var DEFAULT_UNDERLINE_STEP = "700";
3611
+ var styles39 = StyleSheet.create({
3612
+ count: { borderRadius: PILL, fontSize: COUNT_FONT, fontWeight: "700", minWidth: COUNT_MIN, paddingHorizontal: COUNT_PAD, textAlign: "center" },
3613
+ label: { fontSize: FONT_SIZE4, fontWeight: "600" },
3614
+ strip: { borderBottomWidth: 1, width: "100%" },
3615
+ tab: { alignItems: "center", borderBottomWidth: UNDERLINE, flexDirection: "row", gap: GAP6, justifyContent: "center", minHeight: MIN_TARGET_PX, minWidth: MIN_TARGET_PX, paddingHorizontal: PAD_H4 }
3616
+ });
3617
+ var UnderlineTabs = ({ tabs, activeKey, onChange, accessibilityLabel, underlineColor, testID }) => {
3618
+ const { theme } = useUi();
3619
+ const underline = underlineColor ?? theme.palette.primary[DEFAULT_UNDERLINE_STEP];
3620
+ return /* @__PURE__ */ jsx(View, { style: [styles39.strip, { borderBottomColor: theme.colors.border }], testID, children: /* @__PURE__ */ jsx(ScrollView, { horizontal: true, accessibilityRole: "tablist", "aria-label": accessibilityLabel, showsHorizontalScrollIndicator: false, children: tabs.map((tab) => {
3621
+ const selected = tab.key === activeKey;
3622
+ return /* @__PURE__ */ jsxs(
3623
+ Pressable,
3624
+ {
3625
+ accessibilityHint: tab.accessibilityHint,
3626
+ accessibilityLabel: tab.label,
3627
+ accessibilityRole: "tab",
3628
+ accessibilityState: { selected },
3629
+ "aria-selected": selected,
3630
+ style: [styles39.tab, { borderBottomColor: selected ? underline : "transparent" }],
3631
+ testID: tab.testID,
3632
+ onPress: () => onChange(tab.key),
3633
+ children: [
3634
+ /* @__PURE__ */ jsx(Text, { style: [styles39.label, { color: selected ? theme.colors.text : theme.colors.textSecondary }], children: tab.label }),
3635
+ tab.count === void 0 ? null : /* @__PURE__ */ jsx(Text, { style: [styles39.count, { backgroundColor: theme.colors.border, color: theme.colors.text }], children: String(tab.count) })
3636
+ ]
3637
+ },
3638
+ tab.key
3639
+ );
3640
+ }) }) });
3641
+ };
3642
+ var RADIUS3 = 12;
3643
+ var PAD = 16;
3644
+ var GAP7 = 8;
3645
+ var TITLE_FONT = 15;
3646
+ var styles40 = StyleSheet.create({
3647
+ card: { borderRadius: RADIUS3, borderWidth: 1, gap: GAP7, minWidth: 0, padding: PAD },
3648
+ footer: { borderRadius: GAP7, borderWidth: 1, gap: GAP7, padding: PAD / 2 + GAP7 / 2 },
3649
+ head: { alignItems: "center", flexDirection: "row", gap: GAP7 },
3650
+ title: { flex: 1, fontSize: TITLE_FONT, fontWeight: "700" }
3651
+ });
3652
+ var WidgetCard = ({ title, children, icon, headerRight, footer, testID }) => {
3653
+ const { theme } = useUi();
3654
+ return /* @__PURE__ */ jsxs(View, { style: [styles40.card, { backgroundColor: theme.colors.surfaceElevated, borderColor: theme.colors.border }], testID, children: [
3655
+ /* @__PURE__ */ jsxs(View, { style: styles40.head, children: [
3656
+ icon === void 0 ? null : /* @__PURE__ */ jsx(View, { "aria-hidden": true, children: icon }),
3657
+ /* @__PURE__ */ jsx(Text, { accessibilityRole: "header", style: [styles40.title, { color: theme.colors.text }], children: title }),
3658
+ headerRight
3659
+ ] }),
3660
+ children,
3661
+ footer === void 0 ? null : /* @__PURE__ */ jsx(View, { style: [styles40.footer, { backgroundColor: theme.colors.background, borderColor: theme.colors.border }], children: footer })
3662
+ ] });
3663
+ };
3664
+
3665
+ export { A4_PAGE, API_COMMIT_SEPARATOR, Accordion, AccordionItem, AppText, BUILD_INFO_PREFIX, BadgeTone, BottomSheet, Breadcrumb, BuildInfoFooter, COPY_FEEDBACK_MS, ChipOverflow, ConfirmDialog, ConfirmDialogFocus, CopyStatus, CopyableId, CountBadge, DEFAULT_BILLING_ROUTE, DayCard, DropdownVariant, ELLIPSIS, FigureStrip, FormDialog, HEADER_STACK_BREAKPOINT, Heading, IdChip, LAYOUT_COLLAPSE_BREAKPOINT, LAYOUT_I18N, LAYOUT_TEST_IDS, 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, TruncatedText, UnderlineTabs, UpgradePrompt, WidgetCard, copyText, figureCell, formatBuildInfo, formatCount, formatUrlForDisplay, isKeyboardOpen, isModalFooterStacked, isRecordHeaderCompact, isSplitSideBySide, isWideWebViewport, pageScale, resolveActiveKey, resolveRowLook, resolveToneColors, scaledFrame, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap, useIsWideViewport, useListRowTone, useVisibleViewport };
3479
3666
  //# sourceMappingURL=index.mjs.map
3480
3667
  //# sourceMappingURL=index.mjs.map