@dloizides/ui-layout 1.61.0 → 1.63.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.d.mts CHANGED
@@ -93,6 +93,15 @@ interface ScreenColumnProps {
93
93
  }
94
94
  declare const ScreenColumn: ({ children, narrow }: ScreenColumnProps) => React.ReactElement;
95
95
 
96
+ /**
97
+ * StatusBadge box: `Regular` is the default 10x4 px pill with a 12 px radius; `Compact` is the
98
+ * table-cell chip (8x1 px padding, fully round, 17 px line), sized to sit inside a 34 px compact row.
99
+ */
100
+ declare const enum BadgeSize {
101
+ Regular = "regular",
102
+ Compact = "compact"
103
+ }
104
+
96
105
  declare const enum BadgeTone {
97
106
  Neutral = "neutral",
98
107
  Info = "info",
@@ -113,11 +122,13 @@ interface StatusBadgeProps {
113
122
  backgroundColor?: string;
114
123
  icon?: React.ReactNode;
115
124
  dashed?: boolean;
125
+ /** `BadgeSize.Compact` is the chip for a compact table cell. Default regular. */
126
+ size?: BadgeSize;
116
127
  testID?: string;
117
128
  accessibilityLabel?: string;
118
129
  accessibilityHint?: string;
119
130
  }
120
- declare const StatusBadge: ({ label, tone, color: rawColor, backgroundColor: rawBackground, icon, dashed, testID, accessibilityLabel, accessibilityHint, }: StatusBadgeProps) => React.ReactElement;
131
+ declare const StatusBadge: ({ label, tone, color: rawColor, backgroundColor: rawBackground, icon, dashed, size, testID, accessibilityLabel, accessibilityHint, }: StatusBadgeProps) => React.ReactElement;
121
132
 
122
133
  interface ToneColors {
123
134
  color: string;
@@ -1229,6 +1240,16 @@ declare enum SectionDensity {
1229
1240
  Dense = "dense"
1230
1241
  }
1231
1242
 
1243
+ interface StickyIndexConfig {
1244
+ scrollSpy?: boolean;
1245
+ activationRatio?: number;
1246
+ clickLockMs?: number;
1247
+ }
1248
+ declare const SPY_ACTIVATION_RATIO = 0.3;
1249
+ declare const SPY_CLICK_LOCK_MS = 900;
1250
+ /** Index of the last section whose top is at or above the activation line, else the first. */
1251
+ declare function pickActiveIndex(tops: ReadonlyArray<number>, line: number): number;
1252
+
1232
1253
  interface SectionIndexEntry {
1233
1254
  key: string;
1234
1255
  title: string;
@@ -1248,7 +1269,7 @@ interface SectionIndexLayoutProps {
1248
1269
  collapsedKey?: string;
1249
1270
  breakpoint?: number | SectionFold;
1250
1271
  density?: SectionDensity;
1251
- stickyIndex?: boolean;
1272
+ stickyIndex?: boolean | StickyIndexConfig;
1252
1273
  chipOverflow?: ChipOverflow;
1253
1274
  indexWidth?: number;
1254
1275
  activeColor?: string;
@@ -1288,6 +1309,18 @@ declare const SectionChips: ({ sections, activeKey, groupLabel, itemHint, overfl
1288
1309
  declare const SECTION_INDEX_BREAKPOINT = 1024;
1289
1310
  declare function resolveActiveKey(sections: ReadonlyArray<SectionIndexEntry>, wanted: string | undefined): string;
1290
1311
 
1312
+ interface ScrollSpyOptions {
1313
+ anchorIds: ReadonlyArray<string>;
1314
+ enabled: boolean;
1315
+ activationRatio: number;
1316
+ onActive: (index: number) => void;
1317
+ }
1318
+ interface ScrollSpyControl {
1319
+ pause: (ms: number) => void;
1320
+ }
1321
+ /** Reports the section crossing the activation line on web; a no-op on native, where presses drive the index. */
1322
+ declare function useScrollSpy({ anchorIds, enabled, activationRatio, onActive }: ScrollSpyOptions): ScrollSpyControl;
1323
+
1291
1324
  /** How the DayCard age badge is filled: a solid tone fill or a light tint with tone-coloured ink. */
1292
1325
  declare const enum DayBadgeFill {
1293
1326
  Solid = "solid",
@@ -1575,4 +1608,4 @@ interface ListDetailVisibility {
1575
1608
  /** Wide shows both panes; narrow shows one, the detail only when asked for and present. */
1576
1609
  declare function resolveListDetailPanes(wide: boolean, narrowPane: ListDetailPane, hasDetail: boolean): ListDetailVisibility;
1577
1610
 
1578
- export { A4_PAGE, API_COMMIT_SEPARATOR, Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionVariant, AppText, type AppTextProps, BUILD_INFO_PREFIX, BadgeTone, BottomSheet, type BottomSheetProps, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, BuildInfoFooter, type BuildInfoFooterProps, COPY_FEEDBACK_MS, ChipOverflow, ConfirmDialog, ConfirmDialogFocus, type ConfirmDialogProps, CopyControl, CopyRowEmphasis, CopyStatus, type CopyToClipboard, type CopyValueLabels, CopyValueRow, type CopyValueRowProps, CopyableId, type CopyableIdProps, CountBadge, type CountBadgeProps, DEFAULT_BILLING_ROUTE, DayBadgeFill, DayCard, DayCardLayout, type DayCardProps, type DropdownOption, type DropdownTriggerState, DropdownVariant, ELLIPSIS, FigureStrip, type FigureStripProps, FormDialog, type FormDialogProps, HEADER_STACK_BREAKPOINT, Heading, type HeadingLevel, type HeadingProps, IdChip, type IdChipProps, LAYOUT_COLLAPSE_BREAKPOINT, LAYOUT_I18N, LAYOUT_TEST_IDS, ListDetailLayout, type ListDetailLayoutProps, ListDetailPane, type ListDetailVisibility, ListRow, type ListRowProps, type ListRowTone, MIN_TARGET_PX, MODAL_FOOTER_STACK_BELOW, Modal, ModalDropdown, type ModalDropdownProps, type ModalProps, ModalShell, type ModalShellProps, type ModalSize, PageFrame, type PageFrameProps, PageHead, type PageHeadProps, type PageSize, RecordActionButton, type RecordActionButtonProps, RecordHeader, type RecordHeaderProps, type RowLook, type RowPalette, RowSelectedStyle, type RowSelection, type RowSelectionKeys, type RowState, SECTION_INDEX_BREAKPOINT, SECTION_INDEX_WIDTH, type ScaledFrame, ScreenColumn, type ScreenColumnProps, Section, SectionChips, type SectionChipsProps, SectionDensity, type SectionFold, SectionIndex, type SectionIndexEntry, SectionIndexLayout, type SectionIndexLayoutProps, type SectionIndexProps, type SectionPadding, type SectionProps, SectionVariant, SegmentedControl, type SegmentedControlProps, type SegmentedOption, SegmentedVariant, SelectedMarker, SideSheet, type SideSheetProps, SplitLayout, SplitPanes, type SplitPanesProps, StatusBadge, type StatusBadgeProps, StickyActionBar, type StickyActionBarProps, StickyPreview, type StickyPreviewProps, TYPE_SCALE_BREAKPOINT, type TabDescriptor, Tabs, TabsCollapsedTrigger, type TabsProps, TabsVariant, TextKind, Timeline, type TimelineEntry, type TimelineProps, ToggleSection, type ToggleSectionProps, type ToneColors, type TotalsItem, TotalsStrip, type TotalsStripProps, TotalsTone, TransferSlip, type TransferSlipProps, TruncatedText, type TruncatedTextProps, type UnderlineTab, UnderlineTabs, type UnderlineTabsProps, UpgradePrompt, type UpgradePromptProps, type VersionResponse, type VisibleViewport, WidgetCard, type WidgetCardProps, 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 };
1611
+ export { A4_PAGE, API_COMMIT_SEPARATOR, Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionVariant, AppText, type AppTextProps, BUILD_INFO_PREFIX, BadgeSize, BadgeTone, BottomSheet, type BottomSheetProps, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, BuildInfoFooter, type BuildInfoFooterProps, COPY_FEEDBACK_MS, ChipOverflow, ConfirmDialog, ConfirmDialogFocus, type ConfirmDialogProps, CopyControl, CopyRowEmphasis, CopyStatus, type CopyToClipboard, type CopyValueLabels, CopyValueRow, type CopyValueRowProps, CopyableId, type CopyableIdProps, CountBadge, type CountBadgeProps, DEFAULT_BILLING_ROUTE, DayBadgeFill, DayCard, DayCardLayout, type DayCardProps, type DropdownOption, type DropdownTriggerState, DropdownVariant, ELLIPSIS, FigureStrip, type FigureStripProps, FormDialog, type FormDialogProps, HEADER_STACK_BREAKPOINT, Heading, type HeadingLevel, type HeadingProps, IdChip, type IdChipProps, LAYOUT_COLLAPSE_BREAKPOINT, LAYOUT_I18N, LAYOUT_TEST_IDS, ListDetailLayout, type ListDetailLayoutProps, ListDetailPane, type ListDetailVisibility, ListRow, type ListRowProps, type ListRowTone, MIN_TARGET_PX, MODAL_FOOTER_STACK_BELOW, Modal, ModalDropdown, type ModalDropdownProps, type ModalProps, ModalShell, type ModalShellProps, type ModalSize, PageFrame, type PageFrameProps, PageHead, type PageHeadProps, type PageSize, RecordActionButton, type RecordActionButtonProps, RecordHeader, type RecordHeaderProps, type RowLook, type RowPalette, RowSelectedStyle, type RowSelection, type RowSelectionKeys, type RowState, SECTION_INDEX_BREAKPOINT, SECTION_INDEX_WIDTH, SPY_ACTIVATION_RATIO, SPY_CLICK_LOCK_MS, type ScaledFrame, ScreenColumn, type ScreenColumnProps, type ScrollSpyControl, type ScrollSpyOptions, Section, SectionChips, type SectionChipsProps, SectionDensity, type SectionFold, SectionIndex, type SectionIndexEntry, SectionIndexLayout, type SectionIndexLayoutProps, type SectionIndexProps, type SectionPadding, type SectionProps, SectionVariant, SegmentedControl, type SegmentedControlProps, type SegmentedOption, SegmentedVariant, SelectedMarker, SideSheet, type SideSheetProps, SplitLayout, SplitPanes, type SplitPanesProps, StatusBadge, type StatusBadgeProps, StickyActionBar, type StickyActionBarProps, type StickyIndexConfig, StickyPreview, type StickyPreviewProps, TYPE_SCALE_BREAKPOINT, type TabDescriptor, Tabs, TabsCollapsedTrigger, type TabsProps, TabsVariant, TextKind, Timeline, type TimelineEntry, type TimelineProps, ToggleSection, type ToggleSectionProps, type ToneColors, type TotalsItem, TotalsStrip, type TotalsStripProps, TotalsTone, TransferSlip, type TransferSlipProps, TruncatedText, type TruncatedTextProps, type UnderlineTab, UnderlineTabs, type UnderlineTabsProps, UpgradePrompt, type UpgradePromptProps, type VersionResponse, type VisibleViewport, WidgetCard, type WidgetCardProps, copyActionLabel, copyText, figureCell, formatBuildInfo, formatCount, formatUrlForDisplay, isKeyboardOpen, isModalFooterStacked, isRecordHeaderCompact, isSplitSideBySide, isWideWebViewport, pageScale, pickActiveIndex, resolveActiveKey, resolveListDetailPanes, resolveRowLook, resolveTintColors, resolveToneColors, rowSelection, scaledFrame, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap, useIsWideViewport, useListRowTone, useScrollSpy, useVisibleViewport };
package/dist/index.d.ts CHANGED
@@ -93,6 +93,15 @@ interface ScreenColumnProps {
93
93
  }
94
94
  declare const ScreenColumn: ({ children, narrow }: ScreenColumnProps) => React.ReactElement;
95
95
 
96
+ /**
97
+ * StatusBadge box: `Regular` is the default 10x4 px pill with a 12 px radius; `Compact` is the
98
+ * table-cell chip (8x1 px padding, fully round, 17 px line), sized to sit inside a 34 px compact row.
99
+ */
100
+ declare const enum BadgeSize {
101
+ Regular = "regular",
102
+ Compact = "compact"
103
+ }
104
+
96
105
  declare const enum BadgeTone {
97
106
  Neutral = "neutral",
98
107
  Info = "info",
@@ -113,11 +122,13 @@ interface StatusBadgeProps {
113
122
  backgroundColor?: string;
114
123
  icon?: React.ReactNode;
115
124
  dashed?: boolean;
125
+ /** `BadgeSize.Compact` is the chip for a compact table cell. Default regular. */
126
+ size?: BadgeSize;
116
127
  testID?: string;
117
128
  accessibilityLabel?: string;
118
129
  accessibilityHint?: string;
119
130
  }
120
- declare const StatusBadge: ({ label, tone, color: rawColor, backgroundColor: rawBackground, icon, dashed, testID, accessibilityLabel, accessibilityHint, }: StatusBadgeProps) => React.ReactElement;
131
+ declare const StatusBadge: ({ label, tone, color: rawColor, backgroundColor: rawBackground, icon, dashed, size, testID, accessibilityLabel, accessibilityHint, }: StatusBadgeProps) => React.ReactElement;
121
132
 
122
133
  interface ToneColors {
123
134
  color: string;
@@ -1229,6 +1240,16 @@ declare enum SectionDensity {
1229
1240
  Dense = "dense"
1230
1241
  }
1231
1242
 
1243
+ interface StickyIndexConfig {
1244
+ scrollSpy?: boolean;
1245
+ activationRatio?: number;
1246
+ clickLockMs?: number;
1247
+ }
1248
+ declare const SPY_ACTIVATION_RATIO = 0.3;
1249
+ declare const SPY_CLICK_LOCK_MS = 900;
1250
+ /** Index of the last section whose top is at or above the activation line, else the first. */
1251
+ declare function pickActiveIndex(tops: ReadonlyArray<number>, line: number): number;
1252
+
1232
1253
  interface SectionIndexEntry {
1233
1254
  key: string;
1234
1255
  title: string;
@@ -1248,7 +1269,7 @@ interface SectionIndexLayoutProps {
1248
1269
  collapsedKey?: string;
1249
1270
  breakpoint?: number | SectionFold;
1250
1271
  density?: SectionDensity;
1251
- stickyIndex?: boolean;
1272
+ stickyIndex?: boolean | StickyIndexConfig;
1252
1273
  chipOverflow?: ChipOverflow;
1253
1274
  indexWidth?: number;
1254
1275
  activeColor?: string;
@@ -1288,6 +1309,18 @@ declare const SectionChips: ({ sections, activeKey, groupLabel, itemHint, overfl
1288
1309
  declare const SECTION_INDEX_BREAKPOINT = 1024;
1289
1310
  declare function resolveActiveKey(sections: ReadonlyArray<SectionIndexEntry>, wanted: string | undefined): string;
1290
1311
 
1312
+ interface ScrollSpyOptions {
1313
+ anchorIds: ReadonlyArray<string>;
1314
+ enabled: boolean;
1315
+ activationRatio: number;
1316
+ onActive: (index: number) => void;
1317
+ }
1318
+ interface ScrollSpyControl {
1319
+ pause: (ms: number) => void;
1320
+ }
1321
+ /** Reports the section crossing the activation line on web; a no-op on native, where presses drive the index. */
1322
+ declare function useScrollSpy({ anchorIds, enabled, activationRatio, onActive }: ScrollSpyOptions): ScrollSpyControl;
1323
+
1291
1324
  /** How the DayCard age badge is filled: a solid tone fill or a light tint with tone-coloured ink. */
1292
1325
  declare const enum DayBadgeFill {
1293
1326
  Solid = "solid",
@@ -1575,4 +1608,4 @@ interface ListDetailVisibility {
1575
1608
  /** Wide shows both panes; narrow shows one, the detail only when asked for and present. */
1576
1609
  declare function resolveListDetailPanes(wide: boolean, narrowPane: ListDetailPane, hasDetail: boolean): ListDetailVisibility;
1577
1610
 
1578
- export { A4_PAGE, API_COMMIT_SEPARATOR, Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionVariant, AppText, type AppTextProps, BUILD_INFO_PREFIX, BadgeTone, BottomSheet, type BottomSheetProps, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, BuildInfoFooter, type BuildInfoFooterProps, COPY_FEEDBACK_MS, ChipOverflow, ConfirmDialog, ConfirmDialogFocus, type ConfirmDialogProps, CopyControl, CopyRowEmphasis, CopyStatus, type CopyToClipboard, type CopyValueLabels, CopyValueRow, type CopyValueRowProps, CopyableId, type CopyableIdProps, CountBadge, type CountBadgeProps, DEFAULT_BILLING_ROUTE, DayBadgeFill, DayCard, DayCardLayout, type DayCardProps, type DropdownOption, type DropdownTriggerState, DropdownVariant, ELLIPSIS, FigureStrip, type FigureStripProps, FormDialog, type FormDialogProps, HEADER_STACK_BREAKPOINT, Heading, type HeadingLevel, type HeadingProps, IdChip, type IdChipProps, LAYOUT_COLLAPSE_BREAKPOINT, LAYOUT_I18N, LAYOUT_TEST_IDS, ListDetailLayout, type ListDetailLayoutProps, ListDetailPane, type ListDetailVisibility, ListRow, type ListRowProps, type ListRowTone, MIN_TARGET_PX, MODAL_FOOTER_STACK_BELOW, Modal, ModalDropdown, type ModalDropdownProps, type ModalProps, ModalShell, type ModalShellProps, type ModalSize, PageFrame, type PageFrameProps, PageHead, type PageHeadProps, type PageSize, RecordActionButton, type RecordActionButtonProps, RecordHeader, type RecordHeaderProps, type RowLook, type RowPalette, RowSelectedStyle, type RowSelection, type RowSelectionKeys, type RowState, SECTION_INDEX_BREAKPOINT, SECTION_INDEX_WIDTH, type ScaledFrame, ScreenColumn, type ScreenColumnProps, Section, SectionChips, type SectionChipsProps, SectionDensity, type SectionFold, SectionIndex, type SectionIndexEntry, SectionIndexLayout, type SectionIndexLayoutProps, type SectionIndexProps, type SectionPadding, type SectionProps, SectionVariant, SegmentedControl, type SegmentedControlProps, type SegmentedOption, SegmentedVariant, SelectedMarker, SideSheet, type SideSheetProps, SplitLayout, SplitPanes, type SplitPanesProps, StatusBadge, type StatusBadgeProps, StickyActionBar, type StickyActionBarProps, StickyPreview, type StickyPreviewProps, TYPE_SCALE_BREAKPOINT, type TabDescriptor, Tabs, TabsCollapsedTrigger, type TabsProps, TabsVariant, TextKind, Timeline, type TimelineEntry, type TimelineProps, ToggleSection, type ToggleSectionProps, type ToneColors, type TotalsItem, TotalsStrip, type TotalsStripProps, TotalsTone, TransferSlip, type TransferSlipProps, TruncatedText, type TruncatedTextProps, type UnderlineTab, UnderlineTabs, type UnderlineTabsProps, UpgradePrompt, type UpgradePromptProps, type VersionResponse, type VisibleViewport, WidgetCard, type WidgetCardProps, 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 };
1611
+ export { A4_PAGE, API_COMMIT_SEPARATOR, Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionVariant, AppText, type AppTextProps, BUILD_INFO_PREFIX, BadgeSize, BadgeTone, BottomSheet, type BottomSheetProps, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, BuildInfoFooter, type BuildInfoFooterProps, COPY_FEEDBACK_MS, ChipOverflow, ConfirmDialog, ConfirmDialogFocus, type ConfirmDialogProps, CopyControl, CopyRowEmphasis, CopyStatus, type CopyToClipboard, type CopyValueLabels, CopyValueRow, type CopyValueRowProps, CopyableId, type CopyableIdProps, CountBadge, type CountBadgeProps, DEFAULT_BILLING_ROUTE, DayBadgeFill, DayCard, DayCardLayout, type DayCardProps, type DropdownOption, type DropdownTriggerState, DropdownVariant, ELLIPSIS, FigureStrip, type FigureStripProps, FormDialog, type FormDialogProps, HEADER_STACK_BREAKPOINT, Heading, type HeadingLevel, type HeadingProps, IdChip, type IdChipProps, LAYOUT_COLLAPSE_BREAKPOINT, LAYOUT_I18N, LAYOUT_TEST_IDS, ListDetailLayout, type ListDetailLayoutProps, ListDetailPane, type ListDetailVisibility, ListRow, type ListRowProps, type ListRowTone, MIN_TARGET_PX, MODAL_FOOTER_STACK_BELOW, Modal, ModalDropdown, type ModalDropdownProps, type ModalProps, ModalShell, type ModalShellProps, type ModalSize, PageFrame, type PageFrameProps, PageHead, type PageHeadProps, type PageSize, RecordActionButton, type RecordActionButtonProps, RecordHeader, type RecordHeaderProps, type RowLook, type RowPalette, RowSelectedStyle, type RowSelection, type RowSelectionKeys, type RowState, SECTION_INDEX_BREAKPOINT, SECTION_INDEX_WIDTH, SPY_ACTIVATION_RATIO, SPY_CLICK_LOCK_MS, type ScaledFrame, ScreenColumn, type ScreenColumnProps, type ScrollSpyControl, type ScrollSpyOptions, Section, SectionChips, type SectionChipsProps, SectionDensity, type SectionFold, SectionIndex, type SectionIndexEntry, SectionIndexLayout, type SectionIndexLayoutProps, type SectionIndexProps, type SectionPadding, type SectionProps, SectionVariant, SegmentedControl, type SegmentedControlProps, type SegmentedOption, SegmentedVariant, SelectedMarker, SideSheet, type SideSheetProps, SplitLayout, SplitPanes, type SplitPanesProps, StatusBadge, type StatusBadgeProps, StickyActionBar, type StickyActionBarProps, type StickyIndexConfig, StickyPreview, type StickyPreviewProps, TYPE_SCALE_BREAKPOINT, type TabDescriptor, Tabs, TabsCollapsedTrigger, type TabsProps, TabsVariant, TextKind, Timeline, type TimelineEntry, type TimelineProps, ToggleSection, type ToggleSectionProps, type ToneColors, type TotalsItem, TotalsStrip, type TotalsStripProps, TotalsTone, TransferSlip, type TransferSlipProps, TruncatedText, type TruncatedTextProps, type UnderlineTab, UnderlineTabs, type UnderlineTabsProps, UpgradePrompt, type UpgradePromptProps, type VersionResponse, type VisibleViewport, WidgetCard, type WidgetCardProps, copyActionLabel, copyText, figureCell, formatBuildInfo, formatCount, formatUrlForDisplay, isKeyboardOpen, isModalFooterStacked, isRecordHeaderCompact, isSplitSideBySide, isWideWebViewport, pageScale, pickActiveIndex, resolveActiveKey, resolveListDetailPanes, resolveRowLook, resolveTintColors, resolveToneColors, rowSelection, scaledFrame, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap, useIsWideViewport, useListRowTone, useScrollSpy, useVisibleViewport };
package/dist/index.js CHANGED
@@ -264,6 +264,13 @@ var ScreenColumn = ({ children, narrow = false }) => {
264
264
  return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles3.outer, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles3.column, isWide ? styles3.desktop : styles3.mobile, narrow ? styles3.narrow : styles3.wide], children }) });
265
265
  };
266
266
 
267
+ // src/StatusBadge/BadgeSize.ts
268
+ var BadgeSize = /* @__PURE__ */ ((BadgeSize2) => {
269
+ BadgeSize2["Regular"] = "regular";
270
+ BadgeSize2["Compact"] = "compact";
271
+ return BadgeSize2;
272
+ })(BadgeSize || {});
273
+
267
274
  // src/StatusBadge/BadgeTone.ts
268
275
  var BadgeTone = /* @__PURE__ */ ((BadgeTone2) => {
269
276
  BadgeTone2["Neutral"] = "neutral";
@@ -347,6 +354,10 @@ var DEFAULT_PADDING_V = 4;
347
354
  var DEFAULT_BORDER_RADIUS = 12;
348
355
  var DEFAULT_FONT_SIZE = 12;
349
356
  var ICON_GAP = 4;
357
+ var COMPACT_PADDING_H = 8;
358
+ var COMPACT_PADDING_V = 1;
359
+ var COMPACT_RADIUS = 999;
360
+ var COMPACT_LINE_HEIGHT = 17;
350
361
  var styles4 = reactNative.StyleSheet.create({
351
362
  badge: {
352
363
  paddingHorizontal: DEFAULT_PADDING_H,
@@ -365,6 +376,14 @@ var styles4 = reactNative.StyleSheet.create({
365
376
  borderWidth: 1,
366
377
  borderStyle: "dashed"
367
378
  },
379
+ badgeCompact: {
380
+ paddingHorizontal: COMPACT_PADDING_H,
381
+ paddingVertical: COMPACT_PADDING_V,
382
+ borderRadius: COMPACT_RADIUS
383
+ },
384
+ textCompact: {
385
+ lineHeight: COMPACT_LINE_HEIGHT
386
+ },
368
387
  text: {
369
388
  fontSize: DEFAULT_FONT_SIZE,
370
389
  fontWeight: "600",
@@ -378,6 +397,7 @@ var StatusBadge = ({
378
397
  backgroundColor: rawBackground,
379
398
  icon,
380
399
  dashed = false,
400
+ size = "regular" /* Regular */,
381
401
  testID = LAYOUT_TEST_IDS.statusLabel,
382
402
  accessibilityLabel,
383
403
  accessibilityHint
@@ -393,16 +413,17 @@ var StatusBadge = ({
393
413
  const dashedColor = React16.useMemo(() => ({ borderColor: color }), [color]);
394
414
  const dynamicText = React16.useMemo(() => ({ color }), [color]);
395
415
  const hasIcon = icon !== void 0 && icon !== null;
416
+ const compact = size === "compact" /* Compact */;
396
417
  return /* @__PURE__ */ jsxRuntime.jsxs(
397
418
  reactNative.View,
398
419
  {
399
420
  accessibilityHint: accessibilityHint ?? t(LAYOUT_I18N.statusBadgeHint),
400
421
  accessibilityLabel: accessibilityLabel ?? label,
401
- style: [styles4.badge, hasIcon && styles4.badgeWithIcon, dynamicBadge, dashed && styles4.badgeDashed, dashed && dashedColor],
422
+ style: [styles4.badge, compact && styles4.badgeCompact, hasIcon && styles4.badgeWithIcon, dynamicBadge, dashed && styles4.badgeDashed, dashed && dashedColor],
402
423
  testID,
403
424
  children: [
404
425
  hasIcon ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { "aria-hidden": true, children: icon }) : null,
405
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles4.text, dynamicText], children: label })
426
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles4.text, compact && styles4.textCompact, dynamicText], children: label })
406
427
  ]
407
428
  }
408
429
  );
@@ -3429,6 +3450,39 @@ var SectionDensity = /* @__PURE__ */ ((SectionDensity2) => {
3429
3450
  SectionDensity2["Dense"] = "dense";
3430
3451
  return SectionDensity2;
3431
3452
  })(SectionDensity || {});
3453
+ var INDICATOR_MS = 180;
3454
+ var slide = (value, toValue) => reactNative.Animated.timing(value, { toValue, duration: INDICATOR_MS, easing: reactNative.Easing.out(reactNative.Easing.cubic), useNativeDriver: false });
3455
+ function useSlidingIndicator(activeIndex) {
3456
+ const reduced = rnWebHooks.useReducedMotion();
3457
+ const [rows, setRows] = React16.useState([]);
3458
+ const top = React16.useRef(new reactNative.Animated.Value(0)).current;
3459
+ const height = React16.useRef(new reactNative.Animated.Value(0)).current;
3460
+ const placed = React16.useRef(false);
3461
+ const targetY = rows[activeIndex]?.y;
3462
+ const targetHeight = rows[activeIndex]?.height;
3463
+ React16.useEffect(() => {
3464
+ if (targetY === void 0 || targetHeight === void 0) return;
3465
+ if (reduced || !placed.current) {
3466
+ top.setValue(targetY);
3467
+ height.setValue(targetHeight);
3468
+ placed.current = true;
3469
+ return;
3470
+ }
3471
+ reactNative.Animated.parallel([slide(top, targetY), slide(height, targetHeight)]).start();
3472
+ }, [targetY, targetHeight, reduced, top, height]);
3473
+ const onRowLayout = React16.useCallback(
3474
+ (index) => (event) => {
3475
+ const { y, height: rowHeight } = event.nativeEvent.layout;
3476
+ setRows((prev) => {
3477
+ const next = [...prev];
3478
+ next[index] = { y, height: rowHeight };
3479
+ return next;
3480
+ });
3481
+ },
3482
+ []
3483
+ );
3484
+ return { measured: targetY !== void 0, top, height, onRowLayout };
3485
+ }
3432
3486
  var SECTION_INDEX_WIDTH = 200;
3433
3487
  var ACTIVE_BAR = 3;
3434
3488
  var TRANSPARENT3 = "transparent";
@@ -3444,7 +3498,8 @@ var styles30 = reactNative.StyleSheet.create({
3444
3498
  denseHeading: { fontSize: 11, fontWeight: "600", letterSpacing: 0.66, lineHeight: 16, paddingBottom: 6 },
3445
3499
  denseItem: { minHeight: DENSE_TARGET_PX, paddingVertical: 6, paddingLeft: 7, paddingRight: 10, borderRadius: 7 },
3446
3500
  denseLabel: { fontSize: 13, lineHeight: DENSE_LINE },
3447
- denseLabelActive: { fontWeight: "600" }
3501
+ denseLabelActive: { fontWeight: "600" },
3502
+ indicator: { position: "absolute", left: 0, width: ACTIVE_BAR, borderRadius: ACTIVE_BAR }
3448
3503
  });
3449
3504
  function ariaCurrent(active) {
3450
3505
  return active ? { "aria-current": "location" } : {};
@@ -3453,9 +3508,12 @@ var SectionIndex = ({ sections, activeKey, heading, itemHint, onSelect, testID,
3453
3508
  const { theme } = uiFeedback.useUi();
3454
3509
  const { colors } = theme;
3455
3510
  const bar = activeColor ?? colors.text;
3511
+ const indicator = useSlidingIndicator(sections.findIndex((entry) => entry.key === activeKey));
3512
+ const staticBar = indicator.measured ? TRANSPARENT3 : bar;
3456
3513
  return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { role: "navigation", accessibilityLabel: heading, style: [styles30.root, dense && styles30.denseRoot, { width }], testID: `${testID}-index`, children: [
3514
+ indicator.measured ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Animated.View, { pointerEvents: "none", style: [styles30.indicator, { backgroundColor: bar, top: indicator.top, height: indicator.height }], testID: `${testID}-index-indicator` }) : null,
3457
3515
  /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles30.heading, dense && styles30.denseHeading, { color: colors.textSecondary }], children: heading }),
3458
- sections.map((entry) => {
3516
+ sections.map((entry, index) => {
3459
3517
  const active = entry.key === activeKey;
3460
3518
  return /* @__PURE__ */ jsxRuntime.jsx(
3461
3519
  reactNative.Pressable,
@@ -3464,8 +3522,9 @@ var SectionIndex = ({ sections, activeKey, heading, itemHint, onSelect, testID,
3464
3522
  accessibilityRole: "link",
3465
3523
  accessibilityLabel: entry.title,
3466
3524
  accessibilityHint: itemHint,
3467
- style: [styles30.item, dense && styles30.denseItem, { borderLeftColor: active ? bar : TRANSPARENT3, backgroundColor: active ? colors.surface : TRANSPARENT3 }],
3525
+ style: [styles30.item, dense && styles30.denseItem, { borderLeftColor: active ? staticBar : TRANSPARENT3, backgroundColor: active ? colors.surface : TRANSPARENT3 }],
3468
3526
  testID: `${testID}-index-${entry.key}`,
3527
+ onLayout: indicator.onRowLayout(index),
3469
3528
  onPress: () => onSelect(entry.key),
3470
3529
  children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles30.label, active && styles30.labelActive, dense && styles30.denseLabel, dense && active && styles30.denseLabelActive, { color: active ? colors.text : colors.textSecondary }], children: entry.title })
3471
3530
  },
@@ -3475,6 +3534,27 @@ var SectionIndex = ({ sections, activeKey, heading, itemHint, onSelect, testID,
3475
3534
  ] });
3476
3535
  };
3477
3536
 
3537
+ // src/SectionIndexLayout/scrollSpy.ts
3538
+ var SPY_ACTIVATION_RATIO = 0.3;
3539
+ var SPY_CLICK_LOCK_MS = 900;
3540
+ var PERCENT2 = 100;
3541
+ function resolveSticky(value) {
3542
+ if (value === void 0 || value === false) return { sticky: false, spy: false, activationRatio: SPY_ACTIVATION_RATIO, clickLockMs: SPY_CLICK_LOCK_MS };
3543
+ const config = value === true ? {} : value;
3544
+ return {
3545
+ sticky: true,
3546
+ spy: config.scrollSpy ?? true,
3547
+ activationRatio: config.activationRatio ?? SPY_ACTIVATION_RATIO,
3548
+ clickLockMs: config.clickLockMs ?? SPY_CLICK_LOCK_MS
3549
+ };
3550
+ }
3551
+ function pickActiveIndex(tops, line) {
3552
+ return tops.reduce((picked, top, index) => top <= line ? index : picked, 0);
3553
+ }
3554
+ function spyRootMargin(activationRatio) {
3555
+ return `0px 0px -${Math.round((1 - activationRatio) * PERCENT2)}% 0px`;
3556
+ }
3557
+
3478
3558
  // src/SectionIndexLayout/sectionKeys.ts
3479
3559
  var SECTION_INDEX_BREAKPOINT = 1024;
3480
3560
  function resolveActiveKey(sections, wanted) {
@@ -3490,6 +3570,70 @@ function scrollToSection(anchorId) {
3490
3570
  const target = document.getElementById(anchorId);
3491
3571
  target?.scrollIntoView?.({ behavior: "smooth", block: "start" });
3492
3572
  }
3573
+ var UNPRIMED = -2;
3574
+ var STALE = -1;
3575
+ var ID_SEPARATOR = "\n";
3576
+ function canObserve() {
3577
+ return typeof document !== "undefined" && typeof window !== "undefined" && typeof IntersectionObserver !== "undefined";
3578
+ }
3579
+ function findAnchors(ids) {
3580
+ return ids.flatMap((id, index) => {
3581
+ const element = document.getElementById(id);
3582
+ return element === null ? [] : [{ index, element }];
3583
+ });
3584
+ }
3585
+ function useScrollSpy({ anchorIds, enabled, activationRatio, onActive }) {
3586
+ const onActiveRef = React16.useRef(onActive);
3587
+ onActiveRef.current = onActive;
3588
+ const pausedUntil = React16.useRef(0);
3589
+ const last = React16.useRef(UNPRIMED);
3590
+ const idsKey = anchorIds.join(ID_SEPARATOR);
3591
+ React16.useEffect(() => {
3592
+ if (!enabled || !canObserve()) return void 0;
3593
+ const anchors = findAnchors(idsKey.split(ID_SEPARATOR));
3594
+ if (anchors.length < 2) return void 0;
3595
+ last.current = UNPRIMED;
3596
+ const evaluate = () => {
3597
+ if (Date.now() < pausedUntil.current) return;
3598
+ const picked = pickActiveIndex(anchors.map((anchor) => anchor.element.getBoundingClientRect().top), window.innerHeight * activationRatio);
3599
+ const index = anchors[picked]?.index ?? 0;
3600
+ const primed = last.current !== UNPRIMED;
3601
+ if (index === last.current) return;
3602
+ last.current = index;
3603
+ if (primed || index > 0) onActiveRef.current(index);
3604
+ };
3605
+ const observer = new IntersectionObserver(evaluate, { rootMargin: spyRootMargin(activationRatio), threshold: 0 });
3606
+ anchors.forEach((anchor) => observer.observe(anchor.element));
3607
+ return () => observer.disconnect();
3608
+ }, [enabled, activationRatio, idsKey]);
3609
+ const pause = React16.useCallback((ms) => {
3610
+ pausedUntil.current = Date.now() + ms;
3611
+ last.current = STALE;
3612
+ }, []);
3613
+ return React16.useMemo(() => ({ pause }), [pause]);
3614
+ }
3615
+
3616
+ // src/SectionIndexLayout/useSectionSelection.ts
3617
+ function useSectionSelection({ sections, testID, preferredKey, spyEnabled, sticky }) {
3618
+ const [current, setCurrent] = React16.useState(void 0);
3619
+ const spy = useScrollSpy({
3620
+ anchorIds: sections.map((entry) => sectionAnchorId(testID, entry.key)),
3621
+ enabled: spyEnabled && sticky.spy,
3622
+ activationRatio: sticky.activationRatio,
3623
+ onActive: (index) => setCurrent(sections[index]?.key)
3624
+ });
3625
+ const { pause } = spy;
3626
+ const { clickLockMs } = sticky;
3627
+ const select = React16.useCallback(
3628
+ (key) => {
3629
+ setCurrent(key);
3630
+ pause(clickLockMs);
3631
+ scrollToSection(sectionAnchorId(testID, key));
3632
+ },
3633
+ [pause, clickLockMs, testID]
3634
+ );
3635
+ return { activeKey: resolveActiveKey(sections, current ?? preferredKey), pick: setCurrent, select };
3636
+ }
3493
3637
  var COMFORTABLE_GAP = 12;
3494
3638
  var DENSE_GAP = 8;
3495
3639
  var DENSE_WIDE_GAP = 16;
@@ -3520,8 +3664,9 @@ var SectionIndexLayout = ({
3520
3664
  const fold = toFold(breakpoint);
3521
3665
  const wide = useIsWideViewport(fold.wide);
3522
3666
  const stacked = useIsWideViewport(fold.stackFrom);
3523
- const [picked, setPicked] = React16.useState(void 0);
3524
- const activeKey = resolveActiveKey(sections, picked ?? (wide ? initialKey : collapsedKey ?? initialKey));
3667
+ const sticky = resolveSticky(stickyIndex);
3668
+ const preferredKey = wide ? initialKey : collapsedKey ?? initialKey;
3669
+ const { activeKey, pick, select } = useSectionSelection({ sections, testID, preferredKey, spyEnabled: wide && sections.length > 1, sticky });
3525
3670
  const dense = density === "dense" /* Dense */;
3526
3671
  const gap = { gap: dense ? DENSE_GAP : COMFORTABLE_GAP };
3527
3672
  if (sections.length < 2) return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { testID, children: sections[0]?.content });
@@ -3540,19 +3685,15 @@ var SectionIndexLayout = ({
3540
3685
  overflow: chipOverflow,
3541
3686
  sections,
3542
3687
  testID,
3543
- onSelect: setPicked
3688
+ onSelect: pick
3544
3689
  }
3545
3690
  ),
3546
3691
  /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { nativeID: sectionAnchorId(testID, activeKey), testID: sectionAnchorId(testID, activeKey), children: active?.content })
3547
3692
  ] });
3548
3693
  }
3549
- const select = (key) => {
3550
- setPicked(key);
3551
- scrollToSection(sectionAnchorId(testID, key));
3552
- };
3553
- const sticky = stickyIndex && reactNative.Platform.OS === "web" ? WEB_STICKY : null;
3694
+ const stickyStyle = sticky.sticky && reactNative.Platform.OS === "web" ? WEB_STICKY : null;
3554
3695
  return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles31.wide, dense && { gap: DENSE_WIDE_GAP }], testID, children: [
3555
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: sticky, children: /* @__PURE__ */ jsxRuntime.jsx(SectionIndex, { activeColor, activeKey, dense, heading: indexHeading, itemHint, sections, testID, width: indexWidth, onSelect: select }) }),
3696
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: stickyStyle, children: /* @__PURE__ */ jsxRuntime.jsx(SectionIndex, { activeColor, activeKey, dense, heading: indexHeading, itemHint, sections, testID, width: indexWidth, onSelect: select }) }),
3556
3697
  /* @__PURE__ */ jsxRuntime.jsx(SectionColumn, { sections, style: reactNative.StyleSheet.flatten([styles31.column, gap]), testID })
3557
3698
  ] });
3558
3699
  };
@@ -4176,6 +4317,7 @@ exports.Accordion = Accordion;
4176
4317
  exports.AccordionItem = AccordionItem;
4177
4318
  exports.AppText = AppText;
4178
4319
  exports.BUILD_INFO_PREFIX = BUILD_INFO_PREFIX;
4320
+ exports.BadgeSize = BadgeSize;
4179
4321
  exports.BadgeTone = BadgeTone;
4180
4322
  exports.BottomSheet = BottomSheet;
4181
4323
  exports.Breadcrumb = Breadcrumb;
@@ -4219,6 +4361,8 @@ exports.RecordHeader = RecordHeader;
4219
4361
  exports.RowSelectedStyle = RowSelectedStyle;
4220
4362
  exports.SECTION_INDEX_BREAKPOINT = SECTION_INDEX_BREAKPOINT;
4221
4363
  exports.SECTION_INDEX_WIDTH = SECTION_INDEX_WIDTH;
4364
+ exports.SPY_ACTIVATION_RATIO = SPY_ACTIVATION_RATIO;
4365
+ exports.SPY_CLICK_LOCK_MS = SPY_CLICK_LOCK_MS;
4222
4366
  exports.ScreenColumn = ScreenColumn;
4223
4367
  exports.Section = Section;
4224
4368
  exports.SectionChips = SectionChips;
@@ -4261,6 +4405,7 @@ exports.isRecordHeaderCompact = isRecordHeaderCompact;
4261
4405
  exports.isSplitSideBySide = isSplitSideBySide;
4262
4406
  exports.isWideWebViewport = isWideWebViewport;
4263
4407
  exports.pageScale = pageScale;
4408
+ exports.pickActiveIndex = pickActiveIndex;
4264
4409
  exports.resolveActiveKey = resolveActiveKey;
4265
4410
  exports.resolveListDetailPanes = resolveListDetailPanes;
4266
4411
  exports.resolveRowLook = resolveRowLook;
@@ -4276,6 +4421,7 @@ exports.useCopyToClipboard = useCopyToClipboard;
4276
4421
  exports.useFocusTrap = useFocusTrap;
4277
4422
  exports.useIsWideViewport = useIsWideViewport;
4278
4423
  exports.useListRowTone = useListRowTone;
4424
+ exports.useScrollSpy = useScrollSpy;
4279
4425
  exports.useVisibleViewport = useVisibleViewport;
4280
4426
  //# sourceMappingURL=index.js.map
4281
4427
  //# sourceMappingURL=index.js.map