@brdgapp/ui 0.1.2 → 1.1.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.
Files changed (123) hide show
  1. package/CHANGELOG.md +141 -0
  2. package/README.md +37 -201
  3. package/components/action-menu.d.ts +72 -0
  4. package/components/action-menu.js +57 -0
  5. package/components/avatar.d.ts +50 -0
  6. package/components/avatar.js +93 -0
  7. package/components/badge.d.ts +12 -0
  8. package/components/badge.js +24 -0
  9. package/components/bottom-sheet.d.ts +34 -0
  10. package/components/bottom-sheet.js +96 -0
  11. package/components/brand-mark.d.ts +20 -0
  12. package/components/brand-mark.js +44 -0
  13. package/components/button-group.d.ts +25 -0
  14. package/components/button-group.js +53 -0
  15. package/components/button.d.ts +33 -0
  16. package/components/button.js +84 -0
  17. package/components/card.d.ts +78 -0
  18. package/components/card.js +75 -0
  19. package/components/checkbox.d.ts +22 -0
  20. package/components/checkbox.js +35 -0
  21. package/components/collapsible.d.ts +29 -0
  22. package/components/collapsible.js +39 -0
  23. package/components/column-filter-menu.d.ts +16 -0
  24. package/components/column-filter-menu.js +31 -0
  25. package/components/column-sort-button.d.ts +24 -0
  26. package/components/column-sort-button.js +24 -0
  27. package/components/confirm-dialog.d.ts +28 -0
  28. package/components/confirm-dialog.js +52 -0
  29. package/components/copy-field.d.ts +17 -0
  30. package/components/copy-field.js +38 -0
  31. package/components/data-state.d.ts +44 -0
  32. package/components/data-state.js +25 -0
  33. package/components/data-table.d.ts +114 -0
  34. package/components/data-table.js +133 -0
  35. package/components/dialog.d.ts +43 -0
  36. package/components/dialog.js +34 -0
  37. package/components/drawer.d.ts +31 -0
  38. package/components/drawer.js +34 -0
  39. package/components/expandable-bio.d.ts +8 -0
  40. package/components/expandable-bio.js +27 -0
  41. package/components/field.d.ts +29 -0
  42. package/components/field.js +27 -0
  43. package/components/filter-chip.d.ts +11 -0
  44. package/components/filter-chip.js +11 -0
  45. package/components/filter-pill.d.ts +34 -0
  46. package/components/filter-pill.js +35 -0
  47. package/components/hover-card.d.ts +21 -0
  48. package/components/hover-card.js +22 -0
  49. package/components/icon-button.d.ts +16 -0
  50. package/components/icon-button.js +37 -0
  51. package/components/illustration.d.ts +33 -0
  52. package/components/illustration.js +70 -0
  53. package/components/info-hint.d.ts +36 -0
  54. package/components/info-hint.js +57 -0
  55. package/components/input.d.ts +9 -0
  56. package/components/input.js +15 -0
  57. package/components/network-graph.d.ts +48 -0
  58. package/components/network-graph.js +37 -0
  59. package/components/page-banner.d.ts +20 -0
  60. package/components/page-banner.js +35 -0
  61. package/components/scene.d.ts +14 -0
  62. package/components/scene.js +7 -0
  63. package/components/search-input.d.ts +8 -0
  64. package/components/search-input.js +35 -0
  65. package/components/segmented-control.d.ts +18 -0
  66. package/components/segmented-control.js +18 -0
  67. package/components/skeleton.d.ts +12 -0
  68. package/components/skeleton.js +23 -0
  69. package/components/skip-link.d.ts +8 -0
  70. package/components/skip-link.js +9 -0
  71. package/components/stat-box.d.ts +41 -0
  72. package/components/stat-box.js +46 -0
  73. package/components/switch.d.ts +13 -0
  74. package/components/switch.js +12 -0
  75. package/components/tabs.d.ts +6 -0
  76. package/components/tabs.js +33 -0
  77. package/components/tag-input.d.ts +17 -0
  78. package/components/tag-input.js +59 -0
  79. package/components/tag.d.ts +27 -0
  80. package/components/tag.js +37 -0
  81. package/components/textarea.d.ts +12 -0
  82. package/components/textarea.js +78 -0
  83. package/components/theme-switch.d.ts +6 -0
  84. package/components/theme-switch.js +16 -0
  85. package/components/toast.d.ts +29 -0
  86. package/components/toast.js +49 -0
  87. package/hooks/use-is-mobile.d.ts +2 -0
  88. package/hooks/use-is-mobile.js +16 -0
  89. package/hooks/use-mock-query.d.ts +23 -0
  90. package/hooks/use-mock-query.js +36 -0
  91. package/hooks/use-theme.d.ts +11 -0
  92. package/hooks/use-theme.js +34 -0
  93. package/lib/demo-controls.d.ts +24 -0
  94. package/lib/demo-controls.js +24 -0
  95. package/lib/format.d.ts +17 -0
  96. package/lib/format.js +55 -0
  97. package/lib/layout.d.ts +19 -0
  98. package/lib/layout.js +24 -0
  99. package/lib/motion.d.ts +16 -0
  100. package/lib/motion.js +18 -0
  101. package/lib/theme.d.ts +21 -0
  102. package/lib/theme.js +63 -0
  103. package/lib/utils.d.ts +22 -0
  104. package/lib/utils.js +27 -0
  105. package/package.json +32 -16
  106. package/styles/globals.css +618 -0
  107. package/src/index.ts +0 -18
  108. package/src/network-people-helper/README.md +0 -130
  109. package/src/network-people-helper/api.ts +0 -174
  110. package/src/network-people-helper/contact-avatar.tsx +0 -63
  111. package/src/network-people-helper/domain.ts +0 -14
  112. package/src/network-people-helper/icons.tsx +0 -130
  113. package/src/network-people-helper/index.ts +0 -6
  114. package/src/network-people-helper/network-people-helper.tsx +0 -397
  115. package/src/network-people-helper/network-people-nudge.tsx +0 -98
  116. package/src/network-people-helper/open-helper.ts +0 -22
  117. package/src/network-people-helper/person-menu.tsx +0 -211
  118. package/src/network-people-helper/styles.css +0 -848
  119. package/src/network-people-helper/types.ts +0 -23
  120. package/src/network-people-helper/use-network-people-list.ts +0 -122
  121. package/src/network-people-helper/use-network-preview.ts +0 -43
  122. package/src/provider.tsx +0 -59
  123. package/src/styles.css +0 -1
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cva } from "class-variance-authority";
3
+ import { cn } from "@brdgapp/ui/lib/utils";
4
+ // A grey placeholder shaped like content that hasn't loaded yet. Started from shadcn's skeleton, then put
5
+ // on Bridge's token: Bridge OS draws about 170 of these by hand (`bg-[var(--surface-tertiary)]
6
+ // animate-pulse`), in three shapes: text lines (4px corners), avatars (circles) and whole blocks.
7
+ // One grey for every placeholder, Skeleton, ButtonSkeleton, StatBoxSkeleton and DataTableSkeleton
8
+ // alike: `--skeleton` (Bridge OS's #F2F3F5; lighter than the surfaces in dark mode). Picked by Aman 2026-11-04.
9
+ // Hidden from screen readers: the region that's loading says so (DataState sets that up).
10
+ const skeletonVariants = cva("block animate-pulse bg-[var(--skeleton)]", {
11
+ variants: {
12
+ shape: {
13
+ line: "h-3 rounded-[4px]",
14
+ circle: "rounded-full",
15
+ block: "rounded-xl",
16
+ },
17
+ },
18
+ defaultVariants: { shape: "line" },
19
+ });
20
+ function Skeleton({ shape, className }) {
21
+ return _jsx("span", { "data-slot": "skeleton", "aria-hidden": "true", className: cn(skeletonVariants({ shape }), className) });
22
+ }
23
+ export { Skeleton, skeletonVariants };
@@ -0,0 +1,8 @@
1
+ type SkipLinkProps = {
2
+ /** The id of the page's <main>. It needs `tabIndex={-1}` so focus can land on it. */
3
+ href?: string;
4
+ className?: string;
5
+ };
6
+ /** "Skip to content". Put it first inside <body>, before the top bar. */
7
+ declare function SkipLink({ href, className }: SkipLinkProps): import("react").JSX.Element;
8
+ export { SkipLink };
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from "@brdgapp/ui/lib/utils";
3
+ /** "Skip to content". Put it first inside <body>, before the top bar. */
4
+ function SkipLink({ href = "#main", className }) {
5
+ return (_jsx("a", { "data-slot": "skip-link", href: href, className: cn("fixed top-3 left-3 z-[100] rounded-full bg-[var(--primary-solid)] px-4 py-2 text-14 font-semibold text-white shadow-[var(--shadow-menu)]",
6
+ // An outline with a see-through gap, so it reads over glass, grey and dark top bars alike.
7
+ "outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-solid focus-visible:outline-[var(--primary)]", className), children: "Skip to content" }));
8
+ }
9
+ export { SkipLink };
@@ -0,0 +1,41 @@
1
+ import * as React from "react";
2
+ import { type LucideIcon } from "lucide-react";
3
+ type StatBoxChange = {
4
+ /** The change as a share: 0.12 is up 12%, -0.05 is down 5%. */
5
+ value: number;
6
+ /** The period it's compared with, in words: "last month", "last week". */
7
+ since: string;
8
+ /** For numbers where less is better, like days to reply: down shows green. */
9
+ downIsGood?: boolean;
10
+ };
11
+ type StatBoxProps = {
12
+ label: string;
13
+ value: number;
14
+ /** A muted third line: "72%", "rated great". */
15
+ sub?: string;
16
+ /** How the number moved: an arrow and the change, green or red, then "vs last month". */
17
+ change?: StatBoxChange;
18
+ /** A small icon beside the label, from Lucide. */
19
+ icon?: LucideIcon;
20
+ /** A ready-made value ("$12.5K", from `formatMoney`) instead of the formatted count. */
21
+ display?: string;
22
+ /** Explains what the number counts. */
23
+ info?: string;
24
+ /** Makes the box a link into the full list. With your router's link, use `render` too. */
25
+ href?: string;
26
+ /** Your router's link element, e.g. `render={<Link href="/outcomes/intros" />}`. */
27
+ render?: React.ReactElement;
28
+ className?: string;
29
+ };
30
+ declare function StatBox({ label, value, sub, change, icon: Icon, display, info, href, render, className }: StatBoxProps): React.JSX.Element;
31
+ /**
32
+ * Same size and shape as StatBox, for loading. Pass `sub` and `change` when the real box has those lines,
33
+ * so the row doesn't jump when the numbers arrive.
34
+ */
35
+ declare function StatBoxSkeleton({ sub, change, className }: {
36
+ sub?: boolean;
37
+ change?: boolean;
38
+ className?: string;
39
+ }): React.JSX.Element;
40
+ export { StatBox, StatBoxSkeleton };
41
+ export type { StatBoxChange, StatBoxProps };
@@ -0,0 +1,46 @@
1
+ "use client";
2
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { mergeProps } from "@base-ui/react/merge-props";
5
+ import { useRender } from "@base-ui/react/use-render";
6
+ import { ArrowDown, ArrowUp, ChevronRight } from "lucide-react";
7
+ import { InfoHint } from "@brdgapp/ui/components/info-hint";
8
+ import { formatCount, formatPercent } from "@brdgapp/ui/lib/format";
9
+ import { cn } from "@brdgapp/ui/lib/utils";
10
+ function ChangeLine({ change }) {
11
+ const pct = formatPercent(Math.abs(change.value) * 100);
12
+ if (change.value === 0) {
13
+ return _jsxs("span", { className: "mt-0.5 block text-11 leading-normal text-[var(--text-muted)]", children: ["No change vs ", change.since] });
14
+ }
15
+ const up = change.value > 0;
16
+ const good = up !== Boolean(change.downIsGood);
17
+ const Arrow = up ? ArrowUp : ArrowDown;
18
+ return (_jsxs("span", { "data-slot": "stat-box-change", className: "mt-0.5 flex items-center gap-1 text-11 leading-normal text-[var(--text-muted)]", children: [_jsxs("span", { className: cn("inline-flex items-center gap-0.5 font-semibold", good ? "text-[var(--success-text)]" : "text-[var(--danger-text)]"), children: [_jsx(Arrow, { "aria-hidden": "true", className: "size-3", strokeWidth: 2.5 }), _jsx("span", { className: "sr-only", children: up ? "Up" : "Down" }), pct] }), "vs ", change.since] }));
19
+ }
20
+ function StatBox({ label, value, sub, change, icon: Icon, display, info, href, render, className }) {
21
+ const clickable = Boolean(href || render);
22
+ const valueId = React.useId();
23
+ const labelId = React.useId();
24
+ // The cover link sits over the whole box and is named by its number and label. Everything else is
25
+ // drawn under it; the ⓘ sits above it, so it still works.
26
+ const cover = useRender({
27
+ render: render ?? _jsx("a", { href: href }),
28
+ enabled: clickable,
29
+ props: mergeProps({
30
+ "data-slot": "stat-box-link",
31
+ "aria-labelledby": `${valueId} ${labelId}`,
32
+ className: "absolute inset-0 rounded-xl outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-solid focus-visible:outline-[var(--primary)]",
33
+ }, {}),
34
+ });
35
+ return (_jsxs("div", { "data-slot": "stat-box", className: cn("group relative block rounded-xl bg-[var(--surface-secondary)] px-4 py-3", clickable && "transition-colors has-[[data-slot=stat-box-link]:hover]:bg-[var(--surface-tertiary)]", className), children: [cover, _jsxs("span", { className: "flex items-start justify-between gap-2", children: [_jsx("span", { id: valueId, "data-slot": "stat-box-value", className: cn("text-22 leading-none font-bold tabular-nums text-[var(--text-primary)]", clickable && "transition-colors group-has-[[data-slot=stat-box-link]:hover]:text-[var(--primary)]"), children: display ?? formatCount(value) }), clickable ? (_jsx(ChevronRight, { "aria-hidden": "true", className: "mt-0.5 size-3.5 shrink-0 text-[var(--text-disabled)] transition-colors group-has-[[data-slot=stat-box-link]:hover]:text-[var(--primary)]" })) : null] }), _jsxs("span", { className: "mt-1.5 flex items-center gap-1 text-12 leading-normal font-semibold text-[var(--text-body)]", children: [Icon ? _jsx(Icon, { "aria-hidden": "true", className: "size-3.5 shrink-0 text-[var(--text-muted)]" }) : null, _jsx("span", { id: labelId, children: label }), info ? (_jsx("span", { className: "relative z-10 inline-flex", children: _jsx(InfoHint, { text: info }) })) : null] }), change ? _jsx(ChangeLine, { change: change }) : null, sub ? _jsx("span", { className: "mt-0.5 block text-11 leading-normal text-[var(--text-muted)]", children: sub }) : null] }));
36
+ }
37
+ /**
38
+ * Same size and shape as StatBox, for loading. Pass `sub` and `change` when the real box has those lines,
39
+ * so the row doesn't jump when the numbers arrive.
40
+ */
41
+ function StatBoxSkeleton({ sub = false, change = false, className }) {
42
+ const bar = "animate-pulse rounded bg-[var(--skeleton)] motion-reduce:animate-none";
43
+ // Each bar sits in a line as tall as the real one: 22px number, 18px label, 16.5px for the small lines.
44
+ return (_jsxs("div", { "data-slot": "stat-box-skeleton", "aria-hidden": "true", className: cn("rounded-xl bg-[var(--surface-secondary)] px-4 py-3", className), children: [_jsx("div", { className: cn(bar, "h-[22px] w-10") }), _jsx("div", { className: "mt-1.5 flex h-[18px] items-center", children: _jsx("div", { className: cn(bar, "h-3 w-16") }) }), change ? (_jsx("div", { className: "mt-0.5 flex h-[16.5px] items-center", children: _jsx("div", { className: cn(bar, "h-2.5 w-20") }) })) : null, sub ? (_jsx("div", { className: "mt-0.5 flex h-[16.5px] items-center", children: _jsx("div", { className: cn(bar, "h-2.5 w-8") }) })) : null] }));
45
+ }
46
+ export { StatBox, StatBoxSkeleton };
@@ -0,0 +1,13 @@
1
+ type SwitchProps = {
2
+ checked: boolean;
3
+ onChange: (checked: boolean) => void;
4
+ disabled?: boolean;
5
+ /** A name is required: either `aria-label`, or `aria-labelledby` pointing at the visible label. */
6
+ "aria-label"?: string;
7
+ "aria-labelledby"?: string;
8
+ id?: string;
9
+ className?: string;
10
+ };
11
+ declare function Switch({ checked, onChange, disabled, className, ...props }: SwitchProps): import("react").JSX.Element;
12
+ export { Switch };
13
+ export type { SwitchProps };
@@ -0,0 +1,12 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Switch as SwitchPrimitive } from "@base-ui/react/switch";
4
+ import { cn } from "@brdgapp/ui/lib/utils";
5
+ function Switch({ checked, onChange, disabled = false, className, ...props }) {
6
+ return (_jsx(SwitchPrimitive.Root, { "data-slot": "switch", checked: checked, onCheckedChange: (next) => onChange(next), disabled: disabled, className: cn(
7
+ // Off is mid-grey, not pale: the track's edge has to reach 3:1 against the page (4.8:1 on white). 2026-11-04.
8
+ "relative inline-flex h-5 w-9 shrink-0 items-center rounded-full bg-[var(--text-muted)] transition-colors duration-200 outline-none",
9
+ // Hover steps darker in light and in dark, so the white thumb always stands out from the track.
10
+ "hover:bg-[var(--text-secondary)] dark:hover:bg-[var(--text-disabled)] data-[checked]:hover:bg-[var(--primary-solid-hover)]", "focus-visible:ring-2 focus-visible:ring-[var(--primary)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--surface-primary)]", "data-[checked]:bg-[var(--primary-solid)]", "data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className), ...props, children: _jsx(SwitchPrimitive.Thumb, { "data-slot": "switch-thumb", className: "inline-block size-4 translate-x-[2px] rounded-full bg-white shadow-[0_1px_2px_rgba(0,0,0,0.3)] transition-transform duration-200 data-[checked]:translate-x-[18px]" }) }));
11
+ }
12
+ export { Switch };
@@ -0,0 +1,6 @@
1
+ import { Tabs as TabsPrimitive } from "@base-ui/react/tabs";
2
+ declare function Tabs({ className, ...props }: TabsPrimitive.Root.Props): import("react").JSX.Element;
3
+ declare function TabList({ className, ...props }: TabsPrimitive.List.Props): import("react").JSX.Element;
4
+ declare function Tab({ className, ...props }: TabsPrimitive.Tab.Props): import("react").JSX.Element;
5
+ declare function TabPanel({ className, ...props }: TabsPrimitive.Panel.Props): import("react").JSX.Element;
6
+ export { Tabs, TabList, Tab, TabPanel };
@@ -0,0 +1,33 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Tabs as TabsPrimitive } from "@base-ui/react/tabs";
4
+ import { cn } from "@brdgapp/ui/lib/utils";
5
+ // Underline tabs from the Arch Design System. Look ported from Bridge OS src/components/ui/tabs.tsx;
6
+ // behaviour now comes from Base UI Tabs (arrow keys move between tabs, correct tab / tabpanel roles).
7
+ // API change from Bridge OS: the group owns the selected value (`<Tabs value onValueChange>`) and each
8
+ // `<Tab>` has a `value`, instead of each tab taking `active`.
9
+ function Tabs({ className, ...props }) {
10
+ return _jsx(TabsPrimitive.Root, { "data-slot": "tabs", className: cn("min-w-0", className), ...props });
11
+ }
12
+ // The baseline is an inset shadow, not a border, so the active tab's 2px underline can cover it without
13
+ // sticking out of the row. (A border plus a -1px tab margin got clipped by the row's sideways scrolling.)
14
+ // 4px of padding each side (cancelled by -mx-1) leaves room for the tabs' focus ring at the row's ends.
15
+ // When the page draws its own baseline, pass `shadow-none -mb-px` so the row sits on that line instead.
16
+ function TabList({ className, ...props }) {
17
+ return (_jsx(TabsPrimitive.List, { "data-slot": "tab-list", className: cn("-mx-1 flex items-center gap-6 overflow-x-auto px-1 shadow-[inset_0_-1px_0_var(--border-default)] scrollbar-none", className), ...props }));
18
+ }
19
+ function Tab({ className, ...props }) {
20
+ return (_jsx(TabsPrimitive.Tab, { "data-slot": "tab", className: cn("relative -mx-1 shrink-0 rounded-t border-b-2 border-transparent px-1 pt-1 pb-3 max-md:min-h-11 text-14 leading-[1.625] font-bold tracking-[0.4px] whitespace-nowrap",
21
+ // Hover darkens an unselected tab a clear step; a selected tab stays dark.
22
+ "text-[var(--text-muted)] transition-colors duration-150 outline-none not-data-[active]:hover:text-[var(--text-secondary)]",
23
+ // The ring sits inside the tab: the row scrolls sideways, which clips anything outside it. 4px of room each
24
+ // side (px-1, cancelled by -mx-1) keeps it off the letters without moving the tabs.
25
+ "focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--primary)]", "data-[active]:border-[var(--text-primary)] data-[active]:text-[var(--text-primary)]",
26
+ // Base UI marks a disabled tab with data-disabled (it stays focusable), not the disabled attribute.
27
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className), ...props }));
28
+ }
29
+ // A panel takes focus when it has nothing focusable inside, so it shows the same ring as everything else.
30
+ function TabPanel({ className, ...props }) {
31
+ return _jsx(TabsPrimitive.Panel, { "data-slot": "tab-panel", className: cn("rounded-lg outline-none focus-visible:ring-2 focus-visible:ring-[var(--primary)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--surface-primary)]", className), ...props });
32
+ }
33
+ export { Tabs, TabList, Tab, TabPanel };
@@ -0,0 +1,17 @@
1
+ import type * as React from "react";
2
+ import { type ElementProps } from "@brdgapp/ui/lib/utils";
3
+ type TagInputProps = ElementProps<HTMLDivElement> & {
4
+ value: string[];
5
+ onChange: (next: string[]) => void;
6
+ placeholder?: string;
7
+ /** Required unless a visible <label> points at the field. */
8
+ ariaLabel?: string;
9
+ /** Chip colour: `primary` (blue tint) or `muted` (grey). */
10
+ variant?: "primary" | "muted";
11
+ /** Can't be changed: dimmed, no remove buttons. */
12
+ disabled?: boolean;
13
+ className?: string;
14
+ };
15
+ declare function TagInput({ value, onChange, placeholder, ariaLabel, variant, disabled, className, ...rest }: TagInputProps): React.JSX.Element;
16
+ export { TagInput };
17
+ export type { TagInputProps };
@@ -0,0 +1,59 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useRef, useState } from "react";
4
+ import { Button as ButtonPrimitive } from "@base-ui/react/button";
5
+ import { Input as InputPrimitive } from "@base-ui/react/input";
6
+ import { X } from "lucide-react";
7
+ import { cn } from "@brdgapp/ui/lib/utils";
8
+ function TagInput({ value, onChange, placeholder, ariaLabel, variant = "primary", disabled = false, className, ...rest }) {
9
+ const [draft, setDraft] = useState("");
10
+ const inputRef = useRef(null);
11
+ /** Adds each entry that isn't already there (ignoring case), then clears the text box. */
12
+ function addAll(entries) {
13
+ const next = [...value];
14
+ for (const raw of entries) {
15
+ const v = raw.trim();
16
+ if (v && !next.some((t) => t.toLowerCase() === v.toLowerCase()))
17
+ next.push(v);
18
+ }
19
+ if (next.length !== value.length)
20
+ onChange(next);
21
+ setDraft("");
22
+ }
23
+ function add(raw) {
24
+ addAll([raw]);
25
+ }
26
+ // A pasted list ("Climate, Health" or one per line) becomes one chip per entry.
27
+ function onPaste(e) {
28
+ const text = e.clipboardData.getData("text");
29
+ if (!/[,\n]/.test(text))
30
+ return;
31
+ e.preventDefault();
32
+ addAll((draft + text).split(/[,\n]/));
33
+ }
34
+ function removeAt(index) {
35
+ onChange(value.filter((_, i) => i !== index));
36
+ inputRef.current?.focus();
37
+ }
38
+ function onKeyDown(e) {
39
+ if (e.key === "Enter" || e.key === ",") {
40
+ e.preventDefault();
41
+ add(draft);
42
+ }
43
+ else if (e.key === "Backspace" && draft === "" && value.length > 0) {
44
+ e.preventDefault();
45
+ removeAt(value.length - 1);
46
+ }
47
+ }
48
+ return (
49
+ // Clicking anywhere in the box focuses the text field (a mouse convenience; the field is reachable by Tab).
50
+ _jsxs("div", { ...rest, "data-slot": "tag-input", onClick: () => inputRef.current?.focus(), "data-disabled": disabled || undefined, className: cn("flex min-h-11 md:min-h-10 w-full cursor-text flex-wrap items-center gap-1.5 rounded-lg border border-[var(--border-field)] bg-[var(--surface-primary)] px-2 py-1.5", "transition-all duration-150 hover:border-[var(--text-muted)] focus-within:border-[var(--primary)] focus-within:ring-2 focus-within:ring-[var(--primary)]/20",
51
+ // Inside an invalid Field, Base UI marks the text box; the whole field turns red, as Input does.
52
+ "has-[[data-invalid]]:border-[var(--error)] has-[[data-invalid]]:hover:border-[var(--error)] has-[[data-invalid]]:focus-within:ring-[var(--error)]/20",
53
+ // Disabled by the prop, or by a disabled Field around it.
54
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50 has-[input:disabled]:pointer-events-none has-[input:disabled]:opacity-50", className), children: [value.map((tag, i) => (_jsxs("span", { "data-slot": "tag-input-chip", className: cn("inline-flex items-center gap-0.5 rounded-full py-0.5 pr-0.5 pl-2.5 text-11 leading-normal font-semibold", disabled && "pr-2.5", variant === "primary" ? "bg-[var(--primary)]/[0.08] text-[var(--primary)]" : "bg-[var(--surface-secondary)] text-[var(--text-body)]"), children: [tag, disabled ? null : (_jsx(ButtonPrimitive, { "aria-label": `Remove ${tag}`, onClick: (e) => {
55
+ e.stopPropagation();
56
+ removeAt(i);
57
+ }, className: "inline-flex size-5 items-center justify-center rounded-full opacity-60 outline-none transition-opacity hover:opacity-100 focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-[var(--primary)]", children: _jsx(X, { "aria-hidden": "true", className: "size-3" }) }))] }, `${tag}-${i}`))), _jsx(InputPrimitive, { ref: inputRef, "data-slot": "tag-input-field", type: "text", value: draft, "aria-label": ariaLabel, onChange: (e) => setDraft(e.target.value), onKeyDown: onKeyDown, onPaste: onPaste, disabled: disabled, onBlur: () => add(draft), placeholder: value.length === 0 ? placeholder : "", className: "min-w-[80px] flex-1 border-0 bg-transparent px-1.5 py-0.5 text-16 md:text-14 text-[var(--text-primary)] outline-none placeholder:text-[var(--text-muted)]" })] }));
58
+ }
59
+ export { TagInput };
@@ -0,0 +1,27 @@
1
+ import type * as React from "react";
2
+ import { type VariantProps } from "class-variance-authority";
3
+ import { type ElementProps } from "@brdgapp/ui/lib/utils";
4
+ declare const tagVariants: (props?: ({
5
+ color?: "blue" | "green" | "purple" | "grey" | "red" | "yellow" | null | undefined;
6
+ size?: "sm" | "md" | null | undefined;
7
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
+ type TagProps = VariantProps<typeof tagVariants> & ElementProps & {
9
+ /** A bare Lucide icon before the label; sized for you. */
10
+ icon?: React.ReactNode;
11
+ /** Something after the label, such as a chevron on a tag that opens a menu. */
12
+ trailing?: React.ReactNode;
13
+ /** Makes the tag a button with hover and press states. A tag that does nothing stays a plain label. */
14
+ onClick?: () => void;
15
+ className?: string;
16
+ /**
17
+ * @deprecated Use `Tip` for an explanation instead: a native title tooltip is slow, unstyled and missing on
18
+ * touch. Kept so apps can move onto the package without changing behaviour; removed in 2.0.
19
+ */
20
+ title?: string;
21
+ children: React.ReactNode;
22
+ };
23
+ type TagColor = NonNullable<VariantProps<typeof tagVariants>["color"]>;
24
+ type TagSize = NonNullable<VariantProps<typeof tagVariants>["size"]>;
25
+ declare function Tag({ color, size, icon, trailing, onClick, className, title, children, ...rest }: TagProps): React.JSX.Element;
26
+ export { Tag, tagVariants };
27
+ export type { TagProps, TagColor, TagSize };
@@ -0,0 +1,37 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Button as ButtonPrimitive } from "@base-ui/react/button";
4
+ import { cva } from "class-variance-authority";
5
+ import { cn } from "@brdgapp/ui/lib/utils";
6
+ // The soft "Color label" from the Arch Design System. Ported from Bridge OS src/components/ui/tag.tsx
7
+ // (components.md → Tag / Badge / RatingPill). Rounded 4px, never a pill. Every colour is a token family,
8
+ // so it follows dark mode.
9
+ const tagVariants = cva("inline-flex items-center gap-1 rounded-[4px] border font-semibold tracking-[0.4px] align-middle [&_svg]:shrink-0", {
10
+ variants: {
11
+ color: {
12
+ grey: "border-[var(--border-default)] bg-[var(--surface-secondary)] text-[var(--text-secondary)]",
13
+ blue: "border-[var(--info-border)] bg-[var(--info-bg)] text-[var(--info)]",
14
+ green: "border-[var(--success-border)] bg-[var(--success-bg)] text-[var(--success-text)]",
15
+ yellow: "border-[var(--warning-border)] bg-[var(--warning-bg)] text-[var(--warning-text)]",
16
+ red: "border-[var(--error-border)] bg-[var(--error-bg)] text-[var(--error-text)]",
17
+ purple: "border-[var(--purple-border)] bg-[var(--purple-bg)] text-[var(--purple)]",
18
+ },
19
+ // Named sizes with the line height tags have always had (1.625), so they stay 25.5px (sm) and 33px (md)
20
+ // tall, as in Bridge OS (decision 2026-11-04).
21
+ size: {
22
+ sm: "px-2 py-0.5 text-12 leading-[1.625] [&_svg]:size-3.5",
23
+ md: "px-2.5 py-1 text-14 leading-[1.625] [&_svg]:size-4",
24
+ },
25
+ },
26
+ defaultVariants: { color: "grey", size: "sm" },
27
+ });
28
+ function Tag({ color, size, icon, trailing, onClick, className, title, children, ...rest }) {
29
+ const classes = cn(tagVariants({ color, size }), onClick &&
30
+ "cursor-pointer transition-[filter,opacity] hover:brightness-[0.97] active:opacity-60 outline-none focus-visible:ring-2 focus-visible:ring-[var(--primary)]", className);
31
+ const inner = (_jsxs(_Fragment, { children: [icon ? (_jsx("span", { "data-slot": "tag-icon", "aria-hidden": "true", className: "inline-flex shrink-0 items-center", children: icon })) : null, _jsx("span", { "data-slot": "tag-label", className: "truncate", children: children }), trailing ? (_jsx("span", { "data-slot": "tag-trailing", className: "inline-flex shrink-0 items-center", children: trailing })) : null] }));
32
+ if (onClick) {
33
+ return (_jsx(ButtonPrimitive, { ...rest, "data-slot": "tag", onClick: onClick, title: title, className: classes, children: inner }));
34
+ }
35
+ return (_jsx("span", { ...rest, "data-slot": "tag", title: title, className: classes, children: inner }));
36
+ }
37
+ export { Tag, tagVariants };
@@ -0,0 +1,12 @@
1
+ import * as React from "react";
2
+ type TextareaProps = Omit<React.ComponentProps<"textarea">, "className" | "style"> & {
3
+ /** Lines tall when empty. */
4
+ rows?: number;
5
+ /** Lines it grows to before scrolling. Set equal to `rows` for a fixed height. */
6
+ maxRows?: number;
7
+ /** Layout only: `max-w-md`. */
8
+ className?: string;
9
+ };
10
+ declare function Textarea({ rows, maxRows, maxLength, className, value, defaultValue, onChange, ref, ...props }: TextareaProps): React.JSX.Element;
11
+ export { Textarea };
12
+ export type { TextareaProps };
@@ -0,0 +1,78 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { Field as FieldPrimitive } from "@base-ui/react/field";
5
+ import { cn } from "@brdgapp/ui/lib/utils";
6
+ // A multi-line text field: notes, bios, intro messages. Started from shadcn's textarea, then put on
7
+ // Bridge's look and built on Base UI Field.Control, so inside a Field the label, help text and error are
8
+ // tied to it like Input.
9
+ //
10
+ // Decisions (2026-11-03, after checking all 12 app repos: 91 files with a textarea):
11
+ // - Same box as Input: white, 14px text (16px on phones: iOS zooms into smaller fields), 8px corners, the same hover, focus and error borders.
12
+ // - Starts 3 lines tall (apps use 2 to 4), grows with the text up to 10 lines, then scrolls inside. Grown
13
+ // by hand in 15 files across 7 apps (app-cc's useAutoResizeTextarea, chat, together…). No drag handle:
14
+ // 43 places turned it off. Grows with JavaScript, since CSS `field-sizing` isn't in every browser yet.
15
+ // - With `maxLength`, a "120/500" count under the box, turning red near the limit, as in Bridge OS's
16
+ // network-entry-modal.tsx. Hand-made in 15 files across 6 apps.
17
+ const LINE = 20; // a 20px line (leading-5), at 14px and at 16px on phones
18
+ const PAD_Y = 10; // py-2.5
19
+ const BORDER = 1;
20
+ const textareaClasses = cn("block w-full min-w-0 resize-none rounded-lg border border-[var(--border-field)] bg-[var(--surface-primary)] px-3.5 py-2.5", "text-16 leading-5 md:text-14 md:leading-5 text-[var(--text-primary)] placeholder:text-[var(--text-muted)]", "transition-colors duration-150 ease-out outline-none", "hover:border-[var(--text-muted)]", "focus-visible:border-[var(--primary)] focus-visible:ring-2 focus-visible:ring-[var(--primary)]/20", "aria-invalid:border-[var(--error)] aria-invalid:hover:border-[var(--error)] aria-invalid:focus-visible:border-[var(--error)] aria-invalid:focus-visible:ring-[var(--error)]/20", "data-[invalid]:border-[var(--error)] data-[invalid]:hover:border-[var(--error)] data-[invalid]:focus-visible:border-[var(--error)] data-[invalid]:focus-visible:ring-[var(--error)]/20", "disabled:cursor-not-allowed disabled:opacity-50");
21
+ /** How close to the limit the count turns red: the last 10%, at most 50 characters. */
22
+ function nearLimit(length, max) {
23
+ return max - length <= Math.min(50, Math.ceil(max * 0.1));
24
+ }
25
+ function Textarea({ rows = 3, maxRows = 10, maxLength, className, value, defaultValue, onChange, ref, ...props }) {
26
+ const inner = React.useRef(null);
27
+ const [typed, setTyped] = React.useState(() => String(defaultValue ?? "").length);
28
+ const length = value !== undefined ? String(value).length : typed;
29
+ const countId = React.useId();
30
+ const minHeight = rows * LINE + PAD_Y * 2 + BORDER * 2;
31
+ const maxHeight = Math.max(rows, maxRows) * LINE + PAD_Y * 2 + BORDER * 2;
32
+ const fit = React.useCallback(() => {
33
+ const el = inner.current;
34
+ if (!el)
35
+ return;
36
+ el.style.height = "auto";
37
+ const needed = el.scrollHeight + BORDER * 2;
38
+ el.style.height = `${Math.min(Math.max(needed, minHeight), maxHeight)}px`;
39
+ el.style.overflowY = needed > maxHeight ? "auto" : "hidden";
40
+ }, [minHeight, maxHeight]);
41
+ // Fit on first paint, whenever a controlled value changes, and when the box changes width.
42
+ React.useLayoutEffect(fit, [fit, value]);
43
+ React.useEffect(() => {
44
+ const el = inner.current;
45
+ if (!el || typeof ResizeObserver === "undefined")
46
+ return;
47
+ let width = el.offsetWidth;
48
+ const observer = new ResizeObserver(() => {
49
+ if (el.offsetWidth !== width) {
50
+ width = el.offsetWidth;
51
+ fit();
52
+ }
53
+ });
54
+ observer.observe(el);
55
+ return () => observer.disconnect();
56
+ }, [fit]);
57
+ const setRefs = (el, controlRef) => {
58
+ inner.current = el;
59
+ for (const r of [ref, controlRef]) {
60
+ if (typeof r === "function")
61
+ r(el);
62
+ else if (r)
63
+ r.current = el;
64
+ }
65
+ };
66
+ const remaining = maxLength !== undefined ? maxLength - length : null;
67
+ const warn = maxLength !== undefined && nearLimit(length, maxLength);
68
+ return (_jsxs("div", { "data-slot": "textarea-wrapper", className: cn("flex w-full flex-col gap-1", className), children: [_jsx(FieldPrimitive.Control, { render: (controlProps) => {
69
+ const { ref: controlRef, onChange: controlOnChange, ...rest } = controlProps;
70
+ return (_jsx("textarea", { ...rest, ...props, "data-slot": "textarea", ref: (el) => setRefs(el, controlRef), rows: rows, maxLength: maxLength, value: value, defaultValue: defaultValue, "aria-describedby": [rest["aria-describedby"], props["aria-describedby"], maxLength !== undefined ? countId : null].filter(Boolean).join(" ") || undefined, className: textareaClasses, style: { minHeight, maxHeight }, onChange: (e) => {
71
+ controlOnChange?.(e);
72
+ onChange?.(e);
73
+ setTyped(e.target.value.length);
74
+ fit();
75
+ } }));
76
+ } }), maxLength !== undefined ? (_jsxs("p", { id: countId, "data-slot": "textarea-count", className: cn("self-end text-12 leading-[1.625] tabular-nums", warn ? "text-[var(--danger-text)]" : "text-[var(--text-muted)]"), children: [_jsxs("span", { "aria-hidden": "true", children: [length, "/", maxLength] }), _jsx("span", { className: "sr-only", children: `${remaining} of ${maxLength} characters left` })] })) : null, maxLength !== undefined ? (_jsx("span", { className: "sr-only", "aria-live": "polite", children: warn ? (remaining === 0 ? "Character limit reached" : `${remaining} characters left`) : "" })) : null] }));
77
+ }
78
+ export { Textarea };
@@ -0,0 +1,6 @@
1
+ import type * as React from "react";
2
+ /** Light, Dark or System, for the Appearance row in Settings. The choice applies in every Bridge app. */
3
+ declare function ThemeSwitch({ className }: {
4
+ className?: string;
5
+ }): React.JSX.Element;
6
+ export { ThemeSwitch };
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Monitor, Moon, Sun } from "lucide-react";
4
+ import { SegmentedControl } from "@brdgapp/ui/components/segmented-control";
5
+ import { useTheme } from "@brdgapp/ui/hooks/use-theme";
6
+ const OPTIONS = [
7
+ { value: "light", label: _jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx(Sun, { "aria-hidden": "true" }), "Light"] }) },
8
+ { value: "dark", label: _jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx(Moon, { "aria-hidden": "true" }), "Dark"] }) },
9
+ { value: "system", label: _jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx(Monitor, { "aria-hidden": "true" }), "System"] }) },
10
+ ];
11
+ /** Light, Dark or System, for the Appearance row in Settings. The choice applies in every Bridge app. */
12
+ function ThemeSwitch({ className }) {
13
+ const { theme, setTheme } = useTheme();
14
+ return _jsx(SegmentedControl, { "aria-label": "Appearance", options: OPTIONS, value: theme, onChange: setTheme, className: className });
15
+ }
16
+ export { ThemeSwitch };
@@ -0,0 +1,29 @@
1
+ type ToastVariant = "success" | "error";
2
+ type ToastOptions = {
3
+ /** A second, smaller line with detail the message can't hold: "12 couldn't be matched to a known firm". */
4
+ description?: string;
5
+ };
6
+ declare const toast: {
7
+ /** A past-tense confirmation: "Intro sent". */
8
+ success: (message: string, options?: ToastOptions) => string;
9
+ /** Something that failed out of sight: "Couldn't copy the link". Stays 6 seconds. Errors people must fix stay on the page. */
10
+ error: (message: string, options?: ToastOptions) => string;
11
+ /** Hide one toast, or all of them. */
12
+ close: (id?: string) => void;
13
+ };
14
+ /** Mount once in the app's root layout. Toasts last 3 seconds (errors 6); at most 3 show at once. */
15
+ declare function Toaster({ timeout }: {
16
+ timeout?: number;
17
+ }): import("react").JSX.Element;
18
+ type ToastProps = {
19
+ open: boolean;
20
+ message: string;
21
+ variant?: ToastVariant;
22
+ };
23
+ /**
24
+ * @deprecated Use `<Toaster />` and `toast.success()`. Kept for Bridge OS screens that own their timer;
25
+ * removed in 2.0.
26
+ */
27
+ declare function Toast({ open, message, variant }: ToastProps): import("react").JSX.Element;
28
+ export { Toast, Toaster, toast };
29
+ export type { ToastOptions, ToastProps, ToastVariant };
@@ -0,0 +1,49 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useState } from "react";
4
+ import { Toast as ToastPrimitive } from "@base-ui/react/toast";
5
+ import { AlertCircle, Check } from "lucide-react";
6
+ import { cn } from "@brdgapp/ui/lib/utils";
7
+ /** The app-wide toast queue. Needs one `<Toaster />` mounted. */
8
+ const manager = ToastPrimitive.createToastManager();
9
+ /** Errors stay twice as long as the default 3 seconds: they are longer and matter more. */
10
+ const ERROR_TIMEOUT = 6000;
11
+ const toast = {
12
+ /** A past-tense confirmation: "Intro sent". */
13
+ success: (message, options) => manager.add({ title: message, description: options?.description, type: "success" }),
14
+ /** Something that failed out of sight: "Couldn't copy the link". Stays 6 seconds. Errors people must fix stay on the page. */
15
+ error: (message, options) => manager.add({ title: message, description: options?.description, type: "error", priority: "high", timeout: ERROR_TIMEOUT }),
16
+ /** Hide one toast, or all of them. */
17
+ close: (id) => manager.close(id),
18
+ };
19
+ const VIEWPORT = "fixed inset-x-0 top-[72px] z-[100] flex flex-col items-center gap-2 px-4 outline-none pointer-events-none";
20
+ function ToastList() {
21
+ const { toasts } = ToastPrimitive.useToastManager();
22
+ return toasts.map((t) => {
23
+ const Icon = t.type === "error" ? AlertCircle : Check;
24
+ const twoLines = Boolean(t.description);
25
+ return (_jsxs(ToastPrimitive.Root, { toast: t, swipeDirection: "up", "data-slot": "toast", className: cn("pointer-events-auto inline-flex gap-2 border border-[var(--border-default)] bg-[var(--surface-elevated)] pr-4 pl-3 shadow-[var(--shadow-menu)]",
26
+ // One line is a pill; with a second line it becomes a rounded box, the icon level with the first line.
27
+ twoLines ? "max-w-sm items-start rounded-xl py-2.5" : "items-center rounded-full py-2", "transition-[opacity,translate] duration-200 ease-out data-[ending-style]:duration-150 data-[starting-style]:-translate-y-2 data-[starting-style]:opacity-0 data-[ending-style]:opacity-0"), children: [_jsx("span", { className: "flex h-[1.21875rem] shrink-0 items-center", children: _jsx(Icon, { "aria-hidden": "true", className: cn("size-4", t.type === "error" ? "text-[var(--danger-text)]" : "text-[var(--success)]") }) }), _jsxs("span", { className: "min-w-0", children: [_jsx(ToastPrimitive.Title, { render: _jsx("p", {}), className: "text-13 leading-normal font-semibold text-[var(--text-primary)]" }), twoLines ? _jsx(ToastPrimitive.Description, { render: _jsx("p", {}), className: "text-12 leading-normal text-[var(--text-muted)]" }) : null] })] }, t.id));
28
+ });
29
+ }
30
+ /** Mount once in the app's root layout. Toasts last 3 seconds (errors 6); at most 3 show at once. */
31
+ function Toaster({ timeout = 3000 }) {
32
+ return (_jsx(ToastPrimitive.Provider, { toastManager: manager, timeout: timeout, limit: 3, children: _jsx(ToastPrimitive.Portal, { children: _jsx(ToastPrimitive.Viewport, { "data-slot": "toaster", className: VIEWPORT, children: _jsx(ToastList, {}) }) }) }));
33
+ }
34
+ /**
35
+ * @deprecated Use `<Toaster />` and `toast.success()`. Kept for Bridge OS screens that own their timer;
36
+ * removed in 2.0.
37
+ */
38
+ function Toast({ open, message, variant = "success" }) {
39
+ // Its own small queue, so it works without a Toaster. Never times out: `open` decides.
40
+ const [own] = useState(() => ToastPrimitive.createToastManager());
41
+ useEffect(() => {
42
+ if (!open)
43
+ return;
44
+ const id = own.add({ title: message, type: variant, timeout: 0 });
45
+ return () => own.close(id);
46
+ }, [open, message, variant, own]);
47
+ return (_jsx(ToastPrimitive.Provider, { toastManager: own, children: _jsx(ToastPrimitive.Portal, { children: _jsx(ToastPrimitive.Viewport, { className: VIEWPORT, children: _jsx(ToastList, {}) }) }) }));
48
+ }
49
+ export { Toast, Toaster, toast };
@@ -0,0 +1,2 @@
1
+ declare function useIsMobile(): boolean;
2
+ export { useIsMobile };
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import { useSyncExternalStore } from "react";
3
+ // True below 768px (Tailwind's `md`), the line where Bridge switches to its phone shapes: one pane at a time,
4
+ // bottom sheets instead of menus. Use it only when the structure changes; for looks, use `md:` classes,
5
+ // which also work in the server render. Returns false on the server and in the first client render, then
6
+ // the real answer, and updates when the window crosses the line (a tablet turned sideways).
7
+ const QUERY = "(max-width: 767px)";
8
+ function subscribe(onChange) {
9
+ const list = window.matchMedia(QUERY);
10
+ list.addEventListener("change", onChange);
11
+ return () => list.removeEventListener("change", onChange);
12
+ }
13
+ function useIsMobile() {
14
+ return useSyncExternalStore(subscribe, () => window.matchMedia(QUERY).matches, () => false);
15
+ }
16
+ export { useIsMobile };
@@ -0,0 +1,23 @@
1
+ type MockQueryStatus = "loading" | "error" | "success";
2
+ type MockQueryResult<T> = {
3
+ status: MockQueryStatus;
4
+ data: T | undefined;
5
+ error: Error | undefined;
6
+ /** Load again, for example from a Retry button. */
7
+ retry: () => void;
8
+ };
9
+ type MockQueryOptions = {
10
+ /** Overrides the global demo delay for this query. */
11
+ latency?: number;
12
+ /** Forces this query to fail, whatever the global setting says. */
13
+ fail?: boolean;
14
+ };
15
+ /**
16
+ * Fake data loading for handbook demos, so every loading, empty and error state can be shown live.
17
+ * Follows the global demo controls (delay, failure, replay). Demo-only — product code uses real data.
18
+ *
19
+ * const { status, data, retry } = useMockQuery("intros-table", () => SAMPLE_INTROS);
20
+ */
21
+ declare function useMockQuery<T>(key: string, getData: () => T, options?: MockQueryOptions): MockQueryResult<T>;
22
+ export { useMockQuery };
23
+ export type { MockQueryResult, MockQueryStatus, MockQueryOptions };