@invana/ui 0.0.23 → 0.0.24
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.cjs +510 -95
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +273 -12
- package/dist/index.d.ts +273 -12
- package/dist/index.js +509 -96
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1568,7 +1568,8 @@ interface NavMenuItem {
|
|
|
1568
1568
|
* is set), a `<button>` (when `onClick` is set), or a static `<div>`.
|
|
1569
1569
|
*/
|
|
1570
1570
|
interface NavItemConfig {
|
|
1571
|
-
/** Optional unique key for React rendering
|
|
1571
|
+
/** Optional unique key for React rendering, and the item's identity for
|
|
1572
|
+
* `activeKey`. Falls back to `name`. */
|
|
1572
1573
|
key?: string;
|
|
1573
1574
|
/** Display name shown in tooltip */
|
|
1574
1575
|
name: string;
|
|
@@ -1584,22 +1585,44 @@ interface NavItemConfig {
|
|
|
1584
1585
|
activeClass?: string;
|
|
1585
1586
|
/** CSS classes for the icon */
|
|
1586
1587
|
iconClassName?: string;
|
|
1588
|
+
/** Classes for the label span alone — a truncation cap, usually
|
|
1589
|
+
* (`max-w-[16ch] truncate`). */
|
|
1590
|
+
labelClassName?: string;
|
|
1587
1591
|
/** Stroke width for the icon (default: 2) */
|
|
1588
1592
|
iconStroke?: number;
|
|
1589
1593
|
/** Tooltip position */
|
|
1590
|
-
tooltipSide?:
|
|
1594
|
+
tooltipSide?: "top" | "right" | "bottom" | "left";
|
|
1591
1595
|
/** Show a separator line after this item */
|
|
1592
1596
|
showSeperator?: boolean;
|
|
1593
1597
|
/** Lucide icon component. Optional — items may be label-only (e.g. status-bar text). */
|
|
1594
1598
|
icon?: React__default.ElementType | LucideIcon;
|
|
1595
1599
|
/** Custom tooltip content (overrides name) */
|
|
1596
1600
|
tooltip?: React__default.ReactNode;
|
|
1601
|
+
/** Greys the item out and drops every interaction on it. */
|
|
1602
|
+
disabled?: boolean;
|
|
1603
|
+
/**
|
|
1604
|
+
* Inline style passthrough — for a per-item value the theme cannot express,
|
|
1605
|
+
* such as a colour carried by the data (a page's own accent). Everything
|
|
1606
|
+
* static belongs in `className`.
|
|
1607
|
+
*/
|
|
1608
|
+
style?: React__default.CSSProperties;
|
|
1597
1609
|
/**
|
|
1598
1610
|
* Rows of a dropdown opened by this item. With `menuItems` the item is a
|
|
1599
1611
|
* menu trigger — it needs no `onClick`, and stays highlighted while its menu
|
|
1600
1612
|
* is open. Ignored when `href` is set.
|
|
1601
1613
|
*/
|
|
1602
1614
|
menuItems?: NavMenuItem[];
|
|
1615
|
+
/**
|
|
1616
|
+
* Where `menuItems` hangs off.
|
|
1617
|
+
*
|
|
1618
|
+
* `'item'` (the default) — the whole item is the trigger. Clicking anywhere
|
|
1619
|
+
* on it opens the menu.
|
|
1620
|
+
*
|
|
1621
|
+
* `'caret'` — a chevron button *inside* the item: the body still selects,
|
|
1622
|
+
* and only the caret opens the menu. That is what a page tab needs, and it
|
|
1623
|
+
* is why a tab strip could not be built on nav items before.
|
|
1624
|
+
*/
|
|
1625
|
+
menuTrigger?: "item" | "caret";
|
|
1603
1626
|
/**
|
|
1604
1627
|
* A count pinned to the item's top-right — unread reviews, waiting questions.
|
|
1605
1628
|
*
|
|
@@ -1613,19 +1636,107 @@ interface NavItemConfig {
|
|
|
1613
1636
|
*/
|
|
1614
1637
|
badge?: React__default.ReactNode;
|
|
1615
1638
|
}
|
|
1639
|
+
/**
|
|
1640
|
+
* The visual treatments a strip of nav items can wear.
|
|
1641
|
+
*
|
|
1642
|
+
* One table, because the kit draws all three and used to draw two of them by
|
|
1643
|
+
* hand in separate components. `nav` is what nav items have always looked
|
|
1644
|
+
* like; `underline` and `folder` are the two tab strips — a panel's views and
|
|
1645
|
+
* a workbook's pages — lifted out of `TabbedPanel` and
|
|
1646
|
+
* `CanvasPagesViewPanel` unchanged, so migrating those renders identically.
|
|
1647
|
+
*/
|
|
1648
|
+
declare const VARIANT: {
|
|
1649
|
+
/** The capsule: a filled, ringed chip. Toolbars, rails, header actions. */
|
|
1650
|
+
readonly nav: {
|
|
1651
|
+
readonly item: "rounded-control ring-1 ring-transparent";
|
|
1652
|
+
readonly hover: "hover:bg-primary/10 hover:text-primary hover:ring-primary/25";
|
|
1653
|
+
readonly open: "data-[state=open]:bg-primary/15 data-[state=open]:text-primary data-[state=open]:ring-primary/25";
|
|
1654
|
+
readonly active: "bg-primary/15 text-primary ring-primary/25";
|
|
1655
|
+
readonly strip: "";
|
|
1656
|
+
};
|
|
1657
|
+
/** The panel tab: accented fill with a rule under it, merging into the body. */
|
|
1658
|
+
readonly underline: {
|
|
1659
|
+
readonly item: "h-full rounded-none px-3 py-2";
|
|
1660
|
+
readonly hover: "hover:text-foreground";
|
|
1661
|
+
readonly open: "data-[state=open]:text-foreground";
|
|
1662
|
+
readonly active: "bg-primary/10 text-primary border-b-2 border-primary mb-[-1px]";
|
|
1663
|
+
readonly strip: "items-stretch";
|
|
1664
|
+
};
|
|
1665
|
+
/**
|
|
1666
|
+
* The workbook tab: boxed on top / left / right with an *open bottom*, so it
|
|
1667
|
+
* punches through the strip's own rule — the classic folder-tab notch.
|
|
1668
|
+
*/
|
|
1669
|
+
readonly folder: {
|
|
1670
|
+
readonly item: "h-full rounded-none px-3 py-2 gap-1.5";
|
|
1671
|
+
readonly hover: "hover:text-foreground";
|
|
1672
|
+
readonly open: "data-[state=open]:text-foreground";
|
|
1673
|
+
readonly active: "mb-[-1px] rounded-t-md border border-b-0 border-primary text-primary";
|
|
1674
|
+
readonly strip: "items-stretch";
|
|
1675
|
+
};
|
|
1676
|
+
};
|
|
1677
|
+
type NavItemsVariant = keyof typeof VARIANT;
|
|
1616
1678
|
interface NavItemsProps {
|
|
1617
1679
|
items: NavItemConfig[];
|
|
1618
1680
|
/** Layout orientation — drives default icon size, padding, tooltip side and separator. */
|
|
1619
|
-
orientation?:
|
|
1681
|
+
orientation?: "horizontal" | "vertical";
|
|
1620
1682
|
/** Default tooltip side when an item doesn't specify one. */
|
|
1621
|
-
tooltipSide?:
|
|
1683
|
+
tooltipSide?: "top" | "right" | "bottom" | "left";
|
|
1622
1684
|
/** Default icon classes when an item doesn't specify `iconClassName`. */
|
|
1623
1685
|
iconClassName?: string;
|
|
1686
|
+
/** Visual treatment — see {@link VARIANT}. Defaults to `nav`. */
|
|
1687
|
+
variant?: NavItemsVariant;
|
|
1688
|
+
/**
|
|
1689
|
+
* The selected item's key (`item.key ?? item.name`).
|
|
1690
|
+
*
|
|
1691
|
+
* Passing it makes the strip **controlled**: the internal highlight is
|
|
1692
|
+
* bypassed entirely and the caller owns which item is lit. Omit it and the
|
|
1693
|
+
* strip keeps its own state exactly as it always has.
|
|
1694
|
+
*/
|
|
1695
|
+
activeKey?: string;
|
|
1696
|
+
/** Fires with the item's key whenever selection changes, controlled or not. */
|
|
1697
|
+
onActiveChange?: (key: string) => void;
|
|
1698
|
+
/**
|
|
1699
|
+
* `'tabs'` announces the strip as a tab list and gives it tab keyboard
|
|
1700
|
+
* behaviour: `role="tablist"` on the container, `role="tab"` +
|
|
1701
|
+
* `aria-selected` per item, ONE tab stop for the whole strip (roving
|
|
1702
|
+
* tabindex), and ← → ↑ ↓ Home End moving between items with selection
|
|
1703
|
+
* following focus — the same model Radix's tabs use.
|
|
1704
|
+
*
|
|
1705
|
+
* `'none'` (the default) leaves items as the plain buttons and links they
|
|
1706
|
+
* have always been.
|
|
1707
|
+
*/
|
|
1708
|
+
selectionMode?: "none" | "tabs";
|
|
1709
|
+
/** Item key → the `id` of the panel it controls, for `aria-controls`. */
|
|
1710
|
+
panelId?: (key: string) => string;
|
|
1711
|
+
/**
|
|
1712
|
+
* Fold the items that do not fit into a `…` dropdown at the end of the strip.
|
|
1713
|
+
*
|
|
1714
|
+
* **Off by default.** A strip only becomes responsive because its owner asked
|
|
1715
|
+
* it to — a toolbar that would rather scroll, or one whose items must all
|
|
1716
|
+
* stay visible, is unaffected by this existing.
|
|
1717
|
+
*
|
|
1718
|
+
* Requires the strip to have a bounded width to measure against: put
|
|
1719
|
+
* `min-w-0` on it (or on its flex parent) or it will report that everything
|
|
1720
|
+
* fits, forever. Ignored on a vertical strip, which grows downward.
|
|
1721
|
+
*/
|
|
1722
|
+
overflow?: boolean;
|
|
1723
|
+
/** Accessible name and tooltip for the overflow trigger. */
|
|
1724
|
+
overflowLabel?: string;
|
|
1725
|
+
/** Classes for the strip container. Only rendered when the strip needs one —
|
|
1726
|
+
* see the note on the return value in {@link NavItems}. */
|
|
1727
|
+
className?: string;
|
|
1624
1728
|
}
|
|
1625
1729
|
/**
|
|
1626
1730
|
* NavItems - Shared renderer for navigation items. Renders href / onClick /
|
|
1627
1731
|
* static items with identical styling so all three share the same padding,
|
|
1628
1732
|
* primary hover + active highlight, and icon size.
|
|
1733
|
+
*
|
|
1734
|
+
* **What it returns.** With neither `selectionMode` nor `overflow` set it
|
|
1735
|
+
* returns a bare fragment, exactly as it always has, and the caller's own
|
|
1736
|
+
* wrapper lays the items out — every existing consumer is untouched. Ask for
|
|
1737
|
+
* either and it renders its own container, because both need one: a tab list
|
|
1738
|
+
* needs an element to carry `role="tablist"` and the keyboard handler, and
|
|
1739
|
+
* overflow needs an element whose width is the budget.
|
|
1629
1740
|
*/
|
|
1630
1741
|
declare const NavItems: React__default.FC<NavItemsProps>;
|
|
1631
1742
|
interface NavSection {
|
|
@@ -1634,7 +1745,7 @@ interface NavSection {
|
|
|
1634
1745
|
}
|
|
1635
1746
|
interface BaseNavProps {
|
|
1636
1747
|
className?: string;
|
|
1637
|
-
orientation:
|
|
1748
|
+
orientation: "horizontal" | "vertical";
|
|
1638
1749
|
sections: {
|
|
1639
1750
|
start?: NavSection;
|
|
1640
1751
|
center?: NavSection;
|
|
@@ -1669,7 +1780,12 @@ declare const NavBase: React__default.FC<BaseNavProps>;
|
|
|
1669
1780
|
* ```
|
|
1670
1781
|
*/
|
|
1671
1782
|
type NavHorizontalItem = NavItemConfig;
|
|
1672
|
-
|
|
1783
|
+
/**
|
|
1784
|
+
* Everything `NavItems` takes except the orientation, which this component
|
|
1785
|
+
* fixes. Forwarding the whole surface is what lets a header opt into
|
|
1786
|
+
* `overflow`, `variant` or tab semantics without reaching past the wrapper.
|
|
1787
|
+
*/
|
|
1788
|
+
interface NavHorizontalItemsProps extends Omit<NavItemsProps, 'orientation' | 'items'> {
|
|
1673
1789
|
items: NavHorizontalItem[];
|
|
1674
1790
|
}
|
|
1675
1791
|
declare const NavHorizontalItems: React__default.FC<NavHorizontalItemsProps>;
|
|
@@ -1750,7 +1866,13 @@ declare const NavHorizontal: React__default.FC<NavHorizontalProps>;
|
|
|
1750
1866
|
* ```
|
|
1751
1867
|
*/
|
|
1752
1868
|
type NavVerticalItem = NavItemConfig;
|
|
1753
|
-
|
|
1869
|
+
/**
|
|
1870
|
+
* Everything `NavItems` takes except the orientation, which this component
|
|
1871
|
+
* fixes — so a rail can opt into `variant`, controlled selection or tab
|
|
1872
|
+
* semantics without reaching past the wrapper. (`overflow` is ignored on a
|
|
1873
|
+
* vertical strip: it grows downward, where there is always room.)
|
|
1874
|
+
*/
|
|
1875
|
+
interface NavVerticalItemsProps extends Omit<NavItemsProps, 'orientation' | 'items'> {
|
|
1754
1876
|
items: NavVerticalItem[];
|
|
1755
1877
|
}
|
|
1756
1878
|
declare const NavVerticalItems: React__default.FC<NavVerticalItemsProps>;
|
|
@@ -2240,6 +2362,11 @@ interface TabConfig {
|
|
|
2240
2362
|
value: string;
|
|
2241
2363
|
/** Label text or custom React node to display in the tab */
|
|
2242
2364
|
label: string | React__default.ReactNode;
|
|
2365
|
+
/**
|
|
2366
|
+
* Plain-text name for the tab's tooltip and its accessible name. Only needed
|
|
2367
|
+
* when `label` is a node rather than a string — the value is used otherwise.
|
|
2368
|
+
*/
|
|
2369
|
+
name?: string;
|
|
2243
2370
|
/** Optional icon component to show before the label */
|
|
2244
2371
|
icon?: React__default.ElementType;
|
|
2245
2372
|
/** Content to display when this tab is active */
|
|
@@ -2272,6 +2399,31 @@ interface TabbedPanelProps {
|
|
|
2272
2399
|
* ```
|
|
2273
2400
|
*/
|
|
2274
2401
|
headerActions?: NavHorizontalItem[];
|
|
2402
|
+
/**
|
|
2403
|
+
* Fold the tabs that do not fit the header into a `…` dropdown at the end of
|
|
2404
|
+
* the strip, instead of letting the strip set the panel's minimum width.
|
|
2405
|
+
*
|
|
2406
|
+
* **Off by default**, so an existing panel renders exactly as it did. Turn it
|
|
2407
|
+
* on for a panel whose width the user controls — a resizable inspector, a
|
|
2408
|
+
* side panel — or any strip carrying more than a handful of tabs. The active
|
|
2409
|
+
* tab never folds, and arrowing onto a folded one brings it back.
|
|
2410
|
+
*
|
|
2411
|
+
* ```tsx
|
|
2412
|
+
* <TabbedPanel overflow tabs={nineOfThem} />
|
|
2413
|
+
* ```
|
|
2414
|
+
*/
|
|
2415
|
+
overflow?: boolean;
|
|
2416
|
+
/** Accessible name for the overflow trigger. */
|
|
2417
|
+
overflowLabel?: string;
|
|
2418
|
+
/**
|
|
2419
|
+
* Keep every tab's content mounted and hide the inactive ones, instead of
|
|
2420
|
+
* mounting only the active tab.
|
|
2421
|
+
*
|
|
2422
|
+
* Off by default. Turn it on when a panel's tabs hold state worth keeping —
|
|
2423
|
+
* a scroll position, a half-typed edit, a live canvas — and pay for it in
|
|
2424
|
+
* the work every hidden tab keeps doing.
|
|
2425
|
+
*/
|
|
2426
|
+
keepMounted?: boolean;
|
|
2275
2427
|
/** Additional CSS classes for the container */
|
|
2276
2428
|
className?: string;
|
|
2277
2429
|
/** Additional CSS classes for the header */
|
|
@@ -2283,7 +2435,18 @@ interface TabbedPanelProps {
|
|
|
2283
2435
|
/** Optional footer content */
|
|
2284
2436
|
footerContent?: React__default.ReactNode;
|
|
2285
2437
|
}
|
|
2286
|
-
|
|
2438
|
+
/**
|
|
2439
|
+
* TabbedPanel — a panel whose views sit behind one 30px tab strip.
|
|
2440
|
+
*
|
|
2441
|
+
* The strip is a `NavItems` tab list (`variant="underline"`), not a Radix
|
|
2442
|
+
* `Tabs`: the same component draws this kit's nav rails and its workbook tabs,
|
|
2443
|
+
* so tab keyboard behaviour, the `…` overflow and the three visual treatments
|
|
2444
|
+
* are written once. Switching content here is a plain `active === value`,
|
|
2445
|
+
* which is what makes `keepMounted` possible — Radix unmounts an inactive
|
|
2446
|
+
* `TabsContent`, and a panel that tears its canvas down on every tab switch is
|
|
2447
|
+
* not a panel anyone wants.
|
|
2448
|
+
*/
|
|
2449
|
+
declare function TabbedPanel({ tabs, defaultTab, activeTab, onTabChange, headerActions, overflow, overflowLabel, keepMounted, className, headerClassName, bodyClassName, footerClassName, footerContent, }: TabbedPanelProps): React__default.JSX.Element;
|
|
2287
2450
|
|
|
2288
2451
|
interface TemplateOption {
|
|
2289
2452
|
/** The projection template — `table-compact@3`. */
|
|
@@ -2359,6 +2522,18 @@ interface TerminalProps extends React$1.HTMLAttributes<HTMLDivElement> {
|
|
|
2359
2522
|
declare const Terminal: React$1.ForwardRefExoticComponent<TerminalProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
2360
2523
|
declare const TerminalLine: React$1.ForwardRefExoticComponent<TerminalLineProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
2361
2524
|
|
|
2525
|
+
/**
|
|
2526
|
+
* How the list arranges one entry.
|
|
2527
|
+
*
|
|
2528
|
+
* `columns` — `when` is a fixed left column, entries divided by a rule. The
|
|
2529
|
+
* dense-log shape: `when` is short and uniform (`Fri 08:00`) and a reader
|
|
2530
|
+
* scanning for "what changed on Friday" reads down one edge. Needs the width.
|
|
2531
|
+
*
|
|
2532
|
+
* `rail` — `when` sits above the title and a line threads the markers. For a
|
|
2533
|
+
* narrow card or sidebar, where a 72px column would eat a third of the width
|
|
2534
|
+
* and titles wrap anyway; the rail supplies the alignment the column was.
|
|
2535
|
+
*/
|
|
2536
|
+
type TimelineVariant = "columns" | "rail";
|
|
2362
2537
|
interface TimelineEntryProps extends Omit<React$1.HTMLAttributes<HTMLLIElement>, "title"> {
|
|
2363
2538
|
/** When — `Fri 5 Sep`, `09:47`, `Sun`. */
|
|
2364
2539
|
when: React$1.ReactNode;
|
|
@@ -2369,6 +2544,11 @@ interface TimelineEntryProps extends Omit<React$1.HTMLAttributes<HTMLLIElement>,
|
|
|
2369
2544
|
children?: React$1.ReactNode;
|
|
2370
2545
|
}
|
|
2371
2546
|
interface TimelineListProps extends React$1.HTMLAttributes<HTMLOListElement> {
|
|
2547
|
+
/** @default "columns" */
|
|
2548
|
+
variant?: TimelineVariant;
|
|
2549
|
+
children?: React$1.ReactNode;
|
|
2550
|
+
}
|
|
2551
|
+
interface TimelineFooterProps extends React$1.HTMLAttributes<HTMLLIElement> {
|
|
2372
2552
|
children?: React$1.ReactNode;
|
|
2373
2553
|
}
|
|
2374
2554
|
/**
|
|
@@ -2377,12 +2557,21 @@ interface TimelineListProps extends React$1.HTMLAttributes<HTMLOListElement> {
|
|
|
2377
2557
|
* A task's history, a session's past rounds, a schedule's firings. An `<ol>`
|
|
2378
2558
|
* because the order carries meaning — these are events in sequence, not a set.
|
|
2379
2559
|
*
|
|
2380
|
-
*
|
|
2381
|
-
* for
|
|
2382
|
-
* prose.
|
|
2560
|
+
* Both variants take the same entries; only the arrangement differs. See
|
|
2561
|
+
* `TimelineVariant` for which one a surface wants.
|
|
2383
2562
|
*/
|
|
2384
2563
|
declare const TimelineList: React$1.ForwardRefExoticComponent<TimelineListProps & React$1.RefAttributes<HTMLOListElement>>;
|
|
2385
2564
|
declare const TimelineEntry: React$1.ForwardRefExoticComponent<TimelineEntryProps & React$1.RefAttributes<HTMLLIElement>>;
|
|
2565
|
+
/**
|
|
2566
|
+
* What to do next, at the end of the rail — `View changelog →`, `See all runs`.
|
|
2567
|
+
*
|
|
2568
|
+
* The rail runs into it, which is what says the list continues rather than
|
|
2569
|
+
* stops. `role="presentation"` because a footer is not one of the events: it
|
|
2570
|
+
* drops the `<li>` from the list's count while its content stays readable.
|
|
2571
|
+
*
|
|
2572
|
+
* `columns` has no rail to run on, so the footer is a plain last row there.
|
|
2573
|
+
*/
|
|
2574
|
+
declare const TimelineFooter: React$1.ForwardRefExoticComponent<TimelineFooterProps & React$1.RefAttributes<HTMLLIElement>>;
|
|
2386
2575
|
|
|
2387
2576
|
declare const Toolbar: React__default.FC;
|
|
2388
2577
|
|
|
@@ -2598,4 +2787,76 @@ declare const Typography: {
|
|
|
2598
2787
|
Pre: React$1.ForwardRefExoticComponent<TypographyPreProps & React$1.RefAttributes<HTMLPreElement>>;
|
|
2599
2788
|
};
|
|
2600
2789
|
|
|
2601
|
-
|
|
2790
|
+
interface UseOverflowItemsOptions {
|
|
2791
|
+
/** How many items the strip renders. */
|
|
2792
|
+
count: number;
|
|
2793
|
+
/**
|
|
2794
|
+
* Off when false: nothing is measured, nothing folds, and the hook costs a
|
|
2795
|
+
* consumer nothing but a ref it can ignore. This is what keeps `overflow` an
|
|
2796
|
+
* opt-in on every component that wires the hook up.
|
|
2797
|
+
*/
|
|
2798
|
+
enabled?: boolean;
|
|
2799
|
+
/**
|
|
2800
|
+
* An index that must never fold — the selected tab. A strip whose active
|
|
2801
|
+
* item has folded reads as having no selection at all, and arrowing onto a
|
|
2802
|
+
* folded tab is what brings it back (the new active index is pinned, so the
|
|
2803
|
+
* next fit keeps it).
|
|
2804
|
+
*/
|
|
2805
|
+
pinnedIndex?: number;
|
|
2806
|
+
/**
|
|
2807
|
+
* Width to keep free for the overflow trigger, in px. Only charged when
|
|
2808
|
+
* something actually folds — see `fit`.
|
|
2809
|
+
*/
|
|
2810
|
+
reserve?: number;
|
|
2811
|
+
}
|
|
2812
|
+
interface UseOverflowItemsResult {
|
|
2813
|
+
/** Attach to the element whose width is the budget. */
|
|
2814
|
+
containerRef: React$1.RefCallback<HTMLElement>;
|
|
2815
|
+
/** Attach to item `index`. Stable per index, so items don't re-attach. */
|
|
2816
|
+
itemRef: (index: number) => React$1.RefCallback<HTMLElement>;
|
|
2817
|
+
/** Indices that do not fit, ascending. Identity is stable while unchanged. */
|
|
2818
|
+
hiddenIndices: readonly number[];
|
|
2819
|
+
/** `true` when item `index` should not be rendered on the strip. */
|
|
2820
|
+
isHidden: (index: number) => boolean;
|
|
2821
|
+
}
|
|
2822
|
+
/**
|
|
2823
|
+
* Measure a horizontal strip and report which of its items do not fit.
|
|
2824
|
+
*
|
|
2825
|
+
* The hook owns **only the arithmetic**. It renders nothing, knows nothing
|
|
2826
|
+
* about tabs, nav items or menus, and takes no opinion on what a consumer does
|
|
2827
|
+
* with the overflow — `NavItems` folds it into a `…` dropdown, but a
|
|
2828
|
+
* breadcrumb could collapse it to an ellipsis and a toolbar could drop it
|
|
2829
|
+
* entirely. That is the whole reason it is a hook and not a prop on one
|
|
2830
|
+
* component: the three strips in this kit render through three different
|
|
2831
|
+
* components and share no markup.
|
|
2832
|
+
*
|
|
2833
|
+
* **How it measures.** An item that has been folded has no box to measure, so
|
|
2834
|
+
* the hook caches each item's natural width the last time it was on the strip
|
|
2835
|
+
* and plans with that. The first render therefore lays every item out — that
|
|
2836
|
+
* pass is what fills the cache — and the fold is applied in a layout effect,
|
|
2837
|
+
* before the browser paints, so there is no flash of an overflowing strip.
|
|
2838
|
+
*
|
|
2839
|
+
* **How it avoids looping.** Folding changes the DOM, which fires the observers
|
|
2840
|
+
* again; the result only reaches React when the index list actually differs,
|
|
2841
|
+
* and widths are cached only from items that are currently laid out (a
|
|
2842
|
+
* `display:none` item reports `0`, which would otherwise poison the cache).
|
|
2843
|
+
*
|
|
2844
|
+
* @example
|
|
2845
|
+
* ```tsx
|
|
2846
|
+
* const { containerRef, itemRef, hiddenIndices, isHidden } = useOverflowItems({
|
|
2847
|
+
* count: items.length,
|
|
2848
|
+
* enabled: overflow,
|
|
2849
|
+
* pinnedIndex: items.findIndex((i) => i.key === activeKey),
|
|
2850
|
+
* });
|
|
2851
|
+
*
|
|
2852
|
+
* <div ref={containerRef} className="flex min-w-0 flex-1 items-center gap-1">
|
|
2853
|
+
* {items.map((item, i) =>
|
|
2854
|
+
* isHidden(i) ? null : <button key={item.key} ref={itemRef(i)}>{item.label}</button>
|
|
2855
|
+
* )}
|
|
2856
|
+
* {hiddenIndices.length > 0 && <OverflowMenu items={hiddenIndices.map((i) => items[i])} />}
|
|
2857
|
+
* </div>
|
|
2858
|
+
* ```
|
|
2859
|
+
*/
|
|
2860
|
+
declare function useOverflowItems({ count, enabled, pinnedIndex, reserve, }: UseOverflowItemsOptions): UseOverflowItemsResult;
|
|
2861
|
+
|
|
2862
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AgentChip, type AgentChipProps, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AppStatusBar, type AppStatusBarProps, Avatar, AvatarFallback, AvatarImage, Badge, type BadgeProps, BarChartH, type BarChartHProps, BarChartV, type BarChartVProps, type BarDatum, type BaseNavProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, type ButtonProps, ButtonWithTooltip, type ButtonWithTooltipProps, CannotAnswerCard, type CannotAnswerCardProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CardWithHeader, Carousel, type CarouselApi, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, ChatSession, ChatSessionActivityRow, type ChatSessionActivityRowProps, type ChatSessionActivityStatus, ChatSessionActivitySubLine, type ChatSessionActivitySubLineProps, ChatSessionComposer, type ChatSessionComposerProps, ChatSessionContextChip, type ChatSessionContextChipProps, ChatSessionDisclosure, type ChatSessionDisclosureProps, ChatSessionMessage, type ChatSessionMessageAction, ChatSessionMessageOptions, type ChatSessionMessageOptionsProps, type ChatSessionMessageProps, type ChatSessionMessageRole, type ChatSessionMessageStatus, ChatSessionProgressLine, type ChatSessionProgressLineProps, ChatSessionPromptRow, type ChatSessionPromptRowProps, type ChatSessionProps, ChatSessionStatusBar, type ChatSessionStatusBarProps, ChatSessionTaskGroup, type ChatSessionTaskGroupProps, ChatSessionTaskRow, type ChatSessionTaskRowProps, type ChatSessionTaskStatus, CitationList, type CitationListProps, CitationMarker, CitationRow, type CitationRowProps, ClarifyCard, type ClarifyCardProps, type ClarifyOption, type ColumnDatum, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextBar, type ContextBarProps, DiagnosisCard, type DiagnosisCardProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DiffList, type DiffListProps, type DiffOp, DiffRow, type DiffRowProps, DivergingBar, type DivergingBarProps, type DivergingDatum, DotRating, type DotRatingProps, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmissionCard, type EmissionCardProps, EmissionHeader, type EmissionHeaderProps, type EmissionKind, EmptyState, EmptyStateLock, type EmptyStateLockProps, type EmptyStateProps, ErrorBoundary, FilterBar, type FilterBarProps, FilterChip, type FilterChipProps, type HeatCell, type HeatState, HeatStrip, type HeatStripProps, HoverCard, HoverCardContent, HoverCardTrigger, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Kbd, KbdGroup, Legend, LegendItem, type LegendItemProps, type LegendProps, type LegendSwatchKind, MenuItem, type MenuItemProps, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, MetricGrid, type MetricGridProps, MetricTile, type MetricTileProps, NavBase, NavHorizontal, type NavHorizontalItem, NavHorizontalItems, type NavHorizontalItemsProps, type NavHorizontalProps, type NavItemConfig, NavItems, type NavItemsProps, type NavItemsVariant, type NavMenuItem, type NavSection, NavVertical, type NavVerticalItem, NavVerticalItems, type NavVerticalItemsProps, type NavVerticalProps, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NestedMenu, type NestedMenuProps, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PanelContent, type PanelContentProps, PanelStack, type PanelStackProps, type PanelStackSection, Popover, PopoverContent, PopoverTrigger, Progress, PropertyList, type PropertyListProps, PropertyRow, type PropertyRowProps, ProposalCard, type ProposalCardProps, RatingControl, type RatingControlProps, RepairNote, type RepairNoteProps, ResizableHandle, ResizablePanel, ResizablePanelGroup, RetryNote, type RetryNoteProps, RichSelect, type RichSelectOption, type RichSelectProps, ScrollArea, ScrollBar, SearchInput, type SearchInputProps, type SearchInputSize, SectionHeader, type SectionHeaderProps, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Sparkline, type SparklineProps, Spinner, StatusDot, type StatusDotProps, type TabConfig, TabbedPanel, type TabbedPanelProps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, type TemplateOption, TemplatePicker, type TemplatePickerProps, Terminal, TerminalLine, type TerminalLineKind, type TerminalLineProps, type TerminalProps, TimelineEntry, type TimelineEntryProps, TimelineFooter, type TimelineFooterProps, TimelineList, type TimelineListProps, type TimelineVariant, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Toolbar, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Tour, type TourController, type TourProps, type TourReference, type TourStep, TreeItem, TreeView, type TreeViewProps, Typography, TypographyBlockquote, type TypographyBlockquoteProps, TypographyH1, type TypographyH1Props, TypographyH2, type TypographyH2Props, TypographyH3, type TypographyH3Props, TypographyH4, type TypographyH4Props, TypographyH5, type TypographyH5Props, TypographyH6, type TypographyH6Props, TypographyInlineCode, type TypographyInlineCodeProps, TypographyLarge, type TypographyLargeProps, TypographyLead, type TypographyLeadProps, TypographyList, type TypographyListProps, TypographyMuted, type TypographyMutedProps, TypographyP, type TypographyPProps, TypographyPre, type TypographyPreProps, TypographySmall, type TypographySmallProps, UnderDevelopment, type UnderDevelopmentProps, type UseOverflowItemsOptions, type UseOverflowItemsResult, type UseTourOptions, type Verdict, agentChipVariants, badgeVariants, buttonGroupVariants, buttonVariants, chatSessionGutterClass, cn, navigationMenuTriggerStyle, statusDotVariants, toggleVariants, useOverflowItems, useSidebar, useTour };
|