@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,75 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { cva } from "class-variance-authority";
5
+ import { InfoHint } from "@brdgapp/ui/components/info-hint";
6
+ import { cn } from "@brdgapp/ui/lib/utils";
7
+ // A frosted-glass card: the box most of Bridge sits in. Started from shadcn's card, then rebuilt on
8
+ // Bridge's glass after a survey of all 12 app repos (2026-11-03): over 1,500 hand-made or shadcn cards.
9
+ //
10
+ // Decisions:
11
+ // - Glass only (`liquid-glass`), picked by Aman. Corners and padding by size: `lg` 16px / 24px for big
12
+ // cards, `md` 12px / 20px for tiles, `sm` 12px / 16px for list items (app-cc's inbox, raise's pipeline).
13
+ // - `bare`: the same content with no glass, for a card that sits in another card or pane as a
14
+ // divider-separated row. From Bridge OS activity-feed-item.tsx (`bare`) and app-cc's compact list.
15
+ // - Clickable cards, two jobs: `href` goes to a page (perks, directories, bridge-jobs); `onSelect` picks
16
+ // the card, usually to open it in a pane (app-cc inbox, app-intercom, raise pipeline, Bridge OS feed).
17
+ // Built the way app-portfolio does it: an invisible link or button covers the card and gets the click
18
+ // and keyboard focus; the content lets clicks through, except its own links, buttons and fields, which
19
+ // work as usual. So no screen writes stopPropagation (the apps do, over 300 times).
20
+ // - Hover by job (Aman): links rise 2px with a soft shadow (Elevation); selectable cards tint, since a
21
+ // list of rising cards jumps about.
22
+ // - `selected`: a blue border and a light blue tint, what app-cc, app-intercom and app-portfolio already
23
+ // use; announced with aria-current.
24
+ // - No colored edge bars or strips (Aman): status goes in a Tag in the header, word and color together.
25
+ // - The glass and states live in globals.css (`[data-slot=card]` rules), because the glass rule outranks
26
+ // Tailwind's background, border and shadow classes.
27
+ const cardVariants = cva("relative block text-[var(--text-body)]", {
28
+ variants: {
29
+ size: {
30
+ lg: "rounded-2xl [--card-pad:24px]",
31
+ md: "rounded-xl [--card-pad:20px]",
32
+ sm: "rounded-xl [--card-pad:16px]",
33
+ },
34
+ },
35
+ defaultVariants: { size: "lg" },
36
+ });
37
+ const CardContext = React.createContext(null);
38
+ function Card({ size, flush = false, bare = false, href, linkAs: LinkComponent = "a", onSelect, selected = false, disabled = false, label, className, children, }) {
39
+ const titleId = React.useId();
40
+ const clickable = href ? "link" : onSelect ? "select" : undefined;
41
+ const nameProps = label ? { "aria-label": label } : { "aria-labelledby": titleId };
42
+ let cover = null;
43
+ if (clickable === "link" && !disabled) {
44
+ cover = _jsx(LinkComponent, { "data-card-cover": "", href: href, "aria-current": selected ? "page" : undefined, ...nameProps });
45
+ }
46
+ else if (clickable) {
47
+ cover = (_jsx("button", { type: "button", "data-card-cover": "", disabled: disabled, onClick: onSelect, "aria-current": selected ? "true" : undefined, ...nameProps }));
48
+ }
49
+ return (_jsx(CardContext.Provider, { value: { titleId }, children: _jsxs("section", { "data-slot": "card", "data-clickable": clickable, "data-selected": selected ? "" : undefined, "data-disabled": disabled ? "" : undefined, "data-bare": bare ? "" : undefined, className: cn(cardVariants({ size }), bare ? "-mx-3 rounded-lg px-3 py-3.5 [--card-inset:0px]" : "liquid-glass", !bare && (flush ? "[--card-inset:0px]" : "p-[var(--card-pad)] [--card-inset:var(--card-pad)]"), clickable === "link" && !disabled && "transition-[translate,box-shadow] duration-150 ease-out hover:-translate-y-0.5 motion-reduce:transition-none motion-reduce:hover:translate-y-0", clickable && !disabled && "cursor-pointer", disabled && "opacity-60", className), children: [cover, children] }) }));
50
+ }
51
+ // The icon square's color. Blue by default; Bridge OS also tints squares green, amber and purple by topic
52
+ // (outcome value in green, alumni in honey…). The same names as Tag's colors.
53
+ const ICON_COLOR = {
54
+ blue: "bg-[var(--primary)]/8 text-[var(--primary)]",
55
+ green: "bg-[var(--success)]/8 text-[var(--success-text)]",
56
+ amber: "bg-[var(--warning)]/10 text-[var(--warning-text)]",
57
+ purple: "bg-[var(--purple)]/8 text-[var(--purple)]",
58
+ };
59
+ function CardHeader({ title, icon, iconColor = "blue", hint, leading, description, meta, action, strip = false, as: Heading = "h2", compact = false }) {
60
+ const ctx = React.useContext(CardContext);
61
+ return (_jsxs("header", { "data-slot": "card-header", className: cn("flex gap-3", description ? "items-start" : "items-center", strip
62
+ ? "-mx-[var(--card-inset)] -mt-[var(--card-inset)] mb-[var(--card-inset)] items-center border-b border-[var(--border-divider)] bg-[var(--surface-secondary)]/50 px-[var(--card-pad)] py-3.5"
63
+ : "mb-4 last:mb-0"), children: [icon ? (_jsx("span", { "aria-hidden": "true", className: cn("flex size-9 shrink-0 items-center justify-center rounded-lg [&_svg]:size-[18px]", ICON_COLOR[iconColor]), children: icon })) : leading ? (_jsx("span", { className: "flex shrink-0", children: leading })) : null, _jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-1.5", children: [_jsx(Heading, { id: ctx?.titleId, "data-slot": "card-title", className: cn("truncate font-bold tracking-tight text-[var(--text-primary)]", strip || compact ? "text-14" : "text-16"), children: title }), hint ? _jsx(InfoHint, { text: hint }) : null] }), description ? (_jsx("p", { "data-slot": "card-description", className: "mt-0.5 text-13 leading-[1.625] text-[var(--text-muted)]", children: description })) : null] }), meta ? (_jsx("div", { "data-slot": "card-meta", className: "flex shrink-0 items-center gap-2 text-12 leading-[1.625] tabular-nums text-[var(--text-muted)]", children: meta })) : null, action ? (_jsx("div", { "data-slot": "card-action", className: "shrink-0", children: action })) : null] }));
64
+ }
65
+ /** A picture across the top of the card, edge to edge. Put it first. */
66
+ function CardMedia({ src, alt, height = 128 }) {
67
+ return (
68
+ // eslint-disable-next-line @next/next/no-img-element -- package component; apps pass any image URL
69
+ _jsx("img", { "data-slot": "card-media", src: src, alt: alt, style: { height }, className: "-mx-[var(--card-inset)] -mt-[var(--card-inset)] mb-[var(--card-pad)] block w-[calc(100%+2*var(--card-inset))] max-w-none object-cover" }));
70
+ }
71
+ /** A row of buttons under a line, at the bottom of the card. */
72
+ function CardFooter({ children, className }) {
73
+ return (_jsx("footer", { "data-slot": "card-footer", className: cn("mt-5 flex items-center justify-end gap-2 border-t border-[var(--border-divider)] pt-4", className), children: children }));
74
+ }
75
+ export { Card, CardFooter, CardHeader, CardMedia, cardVariants };
@@ -0,0 +1,22 @@
1
+ import * as React from "react";
2
+ import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox";
3
+ import { CheckboxGroup as CheckboxGroupPrimitive } from "@base-ui/react/checkbox-group";
4
+ type CheckboxProps = Omit<CheckboxPrimitive.Root.Props, "className" | "render"> & {
5
+ /** Text beside the box. Clicking it ticks the box. Without it, give the box an `aria-label`. */
6
+ label?: React.ReactNode;
7
+ /** A line of help under the label. */
8
+ description?: React.ReactNode;
9
+ /** Layout only: `mt-1`. */
10
+ className?: string;
11
+ };
12
+ declare function Checkbox({ label, description, className, disabled, ...props }: CheckboxProps): React.JSX.Element;
13
+ type CheckboxGroupProps = Omit<CheckboxGroupPrimitive.Props, "className" | "render"> & {
14
+ /** What the options are about: "Show on each person". Read by screen readers as the group's name. */
15
+ label: React.ReactNode;
16
+ /** Layout only. */
17
+ className?: string;
18
+ };
19
+ /** A list of options, each a Checkbox with a `value` and a `label`. The group holds the ticked values. */
20
+ declare function CheckboxGroup({ label, className, children, ...props }: CheckboxGroupProps): React.JSX.Element;
21
+ export { Checkbox, CheckboxGroup };
22
+ export type { CheckboxGroupProps, CheckboxProps };
@@ -0,0 +1,35 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox";
5
+ import { CheckboxGroup as CheckboxGroupPrimitive } from "@base-ui/react/checkbox-group";
6
+ import { Check, Minus } from "lucide-react";
7
+ import { cn } from "@brdgapp/ui/lib/utils";
8
+ // A box people tick: choosing rows, turning on one option in a form, or picking several from a list.
9
+ // Started from shadcn's Base UI checkbox, then put on Bridge's look.
10
+ //
11
+ // Decisions (2026-11-03, after checking all 12 app repos: about 120 checkboxes, most in raise and
12
+ // app-directories):
13
+ // - 16px box, 4px corners: the shadcn size every app but Bridge OS uses. Bridge OS's 14px boxes are the
14
+ // ones the Selection pattern flags as too small to hit.
15
+ // - The empty box's outline is --text-muted, not a border token: --border-default is 1.2:1 on white, and a
16
+ // control's outline needs 3:1. Ticked and part-ticked fill with --primary-solid, like Switch.
17
+ // - Every box has a 28px hit area (Bridge's smallest target), reaching past it invisibly.
18
+ // - "Part-ticked" (`indeterminate`) for a "Select all" box when only some rows are chosen, as the
19
+ // Selection pattern asks. app-cc draws this by hand in 12 places.
20
+ // - `label` and `description` for the one-option-in-a-form case ("I currently work here"), and
21
+ // CheckboxGroup for a list of options (app-directories' column options, raise's view settings).
22
+ const boxClasses = cn("relative inline-flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-[var(--text-muted)] bg-[var(--surface-primary)] text-white", "transition-colors duration-150 ease-out outline-none", "after:absolute after:-inset-1.5 after:content-['']", "hover:border-[var(--text-secondary)]", "focus-visible:ring-2 focus-visible:ring-[var(--primary)] focus-visible:ring-offset-1 focus-visible:ring-offset-[var(--surface-primary)]", "data-[checked]:border-[var(--primary-solid)] data-[checked]:bg-[var(--primary-solid)]", "data-[indeterminate]:border-[var(--primary-solid)] data-[indeterminate]:bg-[var(--primary-solid)]", "data-[checked]:hover:border-[var(--primary-solid-hover)] data-[checked]:hover:bg-[var(--primary-solid-hover)]", "data-[indeterminate]:hover:border-[var(--primary-solid-hover)] data-[indeterminate]:hover:bg-[var(--primary-solid-hover)]", "aria-invalid:border-[var(--error)]", "data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50");
23
+ function Checkbox({ label, description, className, disabled, ...props }) {
24
+ const descriptionId = React.useId();
25
+ const box = (_jsx(CheckboxPrimitive.Root, { "data-slot": "checkbox", disabled: disabled, "aria-describedby": description ? descriptionId : undefined, className: cn(boxClasses, !label && className, label && "mt-0.5"), ...props, children: _jsx(CheckboxPrimitive.Indicator, { "data-slot": "checkbox-indicator", keepMounted: true, className: "flex data-[unchecked]:hidden", render: (indicatorProps, state) => (_jsx("span", { ...indicatorProps, children: state.indeterminate ? _jsx(Minus, { className: "size-3", strokeWidth: 3 }) : _jsx(Check, { className: "size-3", strokeWidth: 3 }) })) }) }));
26
+ if (!label)
27
+ return box;
28
+ return (_jsxs("label", { "data-slot": "checkbox-label", className: cn("flex w-fit items-start gap-2.5", disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer", className), children: [box, _jsxs("span", { className: "flex flex-col gap-0.5", children: [_jsx("span", { className: "text-14 text-[var(--text-primary)]", children: label }), description ? (_jsx("span", { id: descriptionId, className: "text-12 text-[var(--text-muted)]", children: description })) : null] })] }));
29
+ }
30
+ /** A list of options, each a Checkbox with a `value` and a `label`. The group holds the ticked values. */
31
+ function CheckboxGroup({ label, className, children, ...props }) {
32
+ const labelId = React.useId();
33
+ return (_jsxs(CheckboxGroupPrimitive, { "data-slot": "checkbox-group", "aria-labelledby": labelId, className: cn("flex flex-col gap-3", className), ...props, children: [_jsx("span", { id: labelId, className: "text-14 leading-[1.625] font-medium text-[var(--text-primary)]", children: label }), children] }));
34
+ }
35
+ export { Checkbox, CheckboxGroup };
@@ -0,0 +1,29 @@
1
+ import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible";
2
+ import { type VariantProps } from "class-variance-authority";
3
+ import type { ReactNode } from "react";
4
+ declare const triggerVariants: (props?: ({
5
+ variant?: "section" | "inline" | null | undefined;
6
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
+ type CollapsibleProps = Omit<CollapsiblePrimitive.Root.Props, "className" | "render"> & {
8
+ /** Layout only. */
9
+ className?: string;
10
+ };
11
+ /** Holds whether it's open. Put a CollapsibleTrigger and a CollapsibleContent inside. */
12
+ declare function Collapsible({ className, ...props }: CollapsibleProps): import("react").JSX.Element;
13
+ type CollapsibleTriggerProps = Omit<CollapsiblePrimitive.Trigger.Props, "className" | "render" | "children"> & VariantProps<typeof triggerVariants> & {
14
+ /** The words on the trigger: "Advanced", "History on this list". */
15
+ children: ReactNode;
16
+ /** `section` only: a number shown before the arrow, like how many items are inside. */
17
+ count?: number;
18
+ /** Layout only. */
19
+ className?: string;
20
+ };
21
+ declare function CollapsibleTrigger({ variant, count, className, children, ...props }: CollapsibleTriggerProps): import("react").JSX.Element;
22
+ type CollapsibleContentProps = Omit<CollapsiblePrimitive.Panel.Props, "className" | "render"> & {
23
+ /** Layout only: `pt-3`, `pl-5`. */
24
+ className?: string;
25
+ };
26
+ /** What opens. Slides open and shut; content inside keeps its own spacing. */
27
+ declare function CollapsibleContent({ className, children, ...props }: CollapsibleContentProps): import("react").JSX.Element;
28
+ export { Collapsible, CollapsibleContent, CollapsibleTrigger, triggerVariants as collapsibleTriggerVariants };
29
+ export type { CollapsibleContentProps, CollapsibleProps, CollapsibleTriggerProps };
@@ -0,0 +1,39 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible";
4
+ import { cva } from "class-variance-authority";
5
+ import { ChevronDown, ChevronRight } from "lucide-react";
6
+ import { formatCount } from "@brdgapp/ui/lib/format";
7
+ import { cn } from "@brdgapp/ui/lib/utils";
8
+ // A section people open and close: "Advanced", "History on this list". Started from shadcn's Base UI
9
+ // collapsible, then given Bridge's two looks.
10
+ //
11
+ // Decisions (2026-11-03, after checking all 12 app repos: about 40 hand-made open/close sections):
12
+ // - `section`: title on the left, a down arrow on the right that flips up when open. 28 files, among them
13
+ // Bridge OS's "Advanced" in the account drawer and app-perks' Disclosure.
14
+ // - `inline`: a small right arrow before the words, turning down when open. 13 files, among them raise's
15
+ // "History on this list" and app-portfolio's expandable rows.
16
+ // - Opens by sliding, 200ms, so what's below moves smoothly instead of jumping. Base UI measures the
17
+ // height. Off with reduced motion.
18
+ const triggerVariants = cva("group/collapsible-trigger inline-flex items-center rounded text-left outline-none transition-colors duration-150 ease-out focus-visible:ring-2 focus-visible:ring-[var(--primary)] disabled:cursor-not-allowed disabled:opacity-50", {
19
+ variants: {
20
+ variant: {
21
+ section: "-mx-1 w-[calc(100%+0.5rem)] justify-between gap-3 px-1 py-1 text-13 leading-[1.625] font-bold text-[var(--text-primary)]",
22
+ inline: "-mx-1 gap-1 px-1 text-13 leading-[1.625] font-medium text-[var(--text-secondary)] hover:text-[var(--text-primary)]",
23
+ },
24
+ },
25
+ defaultVariants: { variant: "section" },
26
+ });
27
+ /** Holds whether it's open. Put a CollapsibleTrigger and a CollapsibleContent inside. */
28
+ function Collapsible({ className, ...props }) {
29
+ return _jsx(CollapsiblePrimitive.Root, { "data-slot": "collapsible", className: className, ...props });
30
+ }
31
+ function CollapsibleTrigger({ variant = "section", count, className, children, ...props }) {
32
+ const arrow = "size-4 shrink-0 text-[var(--text-muted)] transition-transform duration-200 ease-out motion-reduce:transition-none";
33
+ return (_jsx(CollapsiblePrimitive.Trigger, { "data-slot": "collapsible-trigger", "data-variant": variant, className: cn(triggerVariants({ variant }), className), ...props, children: variant === "inline" ? (_jsxs(_Fragment, { children: [_jsx(ChevronRight, { "aria-hidden": "true", className: cn(arrow, "group-hover/collapsible-trigger:text-[var(--text-primary)] group-data-[panel-open]/collapsible-trigger:rotate-90") }), children] })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: "min-w-0 flex-1", children: children }), count !== undefined ? (_jsx("span", { className: "text-12 leading-[1.625] font-medium tabular-nums text-[var(--text-muted)]", children: formatCount(count) })) : null, _jsx(ChevronDown, { "aria-hidden": "true", className: cn(arrow, "group-hover/collapsible-trigger:text-[var(--text-primary)] group-data-[panel-open]/collapsible-trigger:rotate-180") })] })) }));
34
+ }
35
+ /** What opens. Slides open and shut; content inside keeps its own spacing. */
36
+ function CollapsibleContent({ className, children, ...props }) {
37
+ return (_jsx(CollapsiblePrimitive.Panel, { "data-slot": "collapsible-content", className: cn("h-[var(--collapsible-panel-height)] overflow-hidden transition-[height] duration-200 ease-out motion-reduce:transition-none", "data-[starting-style]:h-0 data-[ending-style]:h-0"), ...props, children: _jsx("div", { className: className, children: children }) }));
38
+ }
39
+ export { Collapsible, CollapsibleContent, CollapsibleTrigger, triggerVariants as collapsibleTriggerVariants };
@@ -0,0 +1,16 @@
1
+ import { type LucideIcon } from "lucide-react";
2
+ import { type FilterPillOption } from "@brdgapp/ui/components/filter-pill";
3
+ import { type ElementProps } from "@brdgapp/ui/lib/utils";
4
+ type ColumnFilterMenuProps<T extends string> = ElementProps<HTMLButtonElement> & {
5
+ /** The column's icon component. Optional: leave it out for a header with only a name. */
6
+ icon?: LucideIcon;
7
+ label: string;
8
+ /** Explains the column. Hidden while the menu is open. */
9
+ tooltip?: string;
10
+ value: T;
11
+ options: FilterPillOption<T>[];
12
+ onChange: (value: T) => void;
13
+ };
14
+ declare function ColumnFilterMenu<T extends string>({ icon: Icon, label, tooltip, value, options, onChange, ...rest }: ColumnFilterMenuProps<T>): import("react").JSX.Element;
15
+ export { ColumnFilterMenu };
16
+ export type { ColumnFilterMenuProps };
@@ -0,0 +1,31 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useState } from "react";
4
+ import { Menu } from "@base-ui/react/menu";
5
+ import { ChevronDown } from "lucide-react";
6
+ import { FilterMenuPopup, FilterSheet } from "@brdgapp/ui/components/filter-pill";
7
+ import { useIsMobile } from "@brdgapp/ui/hooks/use-is-mobile";
8
+ import { Tip } from "@brdgapp/ui/components/info-hint";
9
+ import { columnHeaderButton } from "@brdgapp/ui/components/column-sort-button";
10
+ import { cn } from "@brdgapp/ui/lib/utils";
11
+ function ColumnFilterMenu({ icon: Icon, label, tooltip, value, options, onChange, ...rest }) {
12
+ const [open, setOpen] = useState(false);
13
+ const mobile = useIsMobile();
14
+ const active = options.length > 0 && value !== options[0]?.value;
15
+ const activeLabel = options.find((o) => o.value === value)?.label;
16
+ const name = `Filter by ${label.toLowerCase()}${active && activeLabel ? `: ${activeLabel}` : ""}`;
17
+ const triggerClass = cn(columnHeaderButton, active ? "text-[var(--primary)]" : "text-[var(--text-secondary)]");
18
+ const inner = (_jsxs(_Fragment, { children: [Icon ? _jsx(Icon, { "aria-hidden": "true", className: cn("size-3.5", active ? "text-[var(--primary)]" : "text-[var(--text-muted)]") }) : null, label, active ? _jsx("span", { "aria-hidden": "true", className: "size-1.5 rounded-full bg-[var(--primary)]" }) : null, _jsx(ChevronDown, { "aria-hidden": "true", className: cn("size-3.5 text-[var(--text-muted)] transition-transform", open && "rotate-180") })] }));
19
+ // Phones: a bottom sheet instead of a menu. No tooltip: touch has no hover.
20
+ if (mobile) {
21
+ return (_jsxs(_Fragment, { children: [_jsx("button", { ...rest, type: "button", "data-slot": "column-filter-menu", "aria-haspopup": "dialog", "aria-label": name, className: triggerClass, onClick: (e) => {
22
+ // A header often sits in a clickable row; keep the click here.
23
+ e.stopPropagation();
24
+ setOpen(true);
25
+ }, children: inner }), _jsx(FilterSheet, { open: open, onClose: () => setOpen(false), title: label, value: value, options: options, onChange: onChange })] }));
26
+ }
27
+ return (_jsxs(Menu.Root, { open: open, onOpenChange: setOpen, children: [_jsx(Tip, { text: tooltip, disabled: open, children: _jsx(Menu.Trigger, { ...rest, "data-slot": "column-filter-menu", "aria-label": name,
28
+ // A header often sits in a clickable row; keep the click here.
29
+ onClick: (e) => e.stopPropagation(), className: triggerClass, children: inner }) }), _jsx(FilterMenuPopup, { value: value, options: options, onChange: onChange, width: 220, align: "start" })] }));
30
+ }
31
+ export { ColumnFilterMenu };
@@ -0,0 +1,24 @@
1
+ import { type LucideIcon } from "lucide-react";
2
+ import { type ElementProps } from "@brdgapp/ui/lib/utils";
3
+ /**
4
+ * The one look for a button in a column header: sort and filter. Icon, name, then a small sign of what
5
+ * it does (⇅, ⌄); the whole thing tints on hover. 24px tall.
6
+ */
7
+ declare const columnHeaderButton = "-mx-1.5 inline-flex items-center gap-1.5 rounded px-1.5 py-[3px] text-12 leading-normal font-bold whitespace-nowrap outline-none transition-colors hover:bg-[var(--surface-tertiary)] focus-visible:ring-2 focus-visible:ring-[var(--primary)]";
8
+ type ColumnSortButtonProps = ElementProps<HTMLButtonElement> & {
9
+ /** The column's icon component. Optional: leave it out for a header with only a name. */
10
+ icon?: LucideIcon;
11
+ label: string;
12
+ tooltip?: string;
13
+ /** This column's sort, or null when another column is the sort. */
14
+ direction: "asc" | "desc" | null;
15
+ /** Words for each direction, read by screen readers: { asc: "lowest first", desc: "highest first" }. */
16
+ describe?: {
17
+ asc: string;
18
+ desc: string;
19
+ };
20
+ onClick: () => void;
21
+ };
22
+ declare function ColumnSortButton({ icon: Icon, label, tooltip, direction, describe, onClick, ...rest }: ColumnSortButtonProps): import("react").JSX.Element;
23
+ export { ColumnSortButton, columnHeaderButton };
24
+ export type { ColumnSortButtonProps };
@@ -0,0 +1,24 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Button as ButtonPrimitive } from "@base-ui/react/button";
4
+ import { ArrowDown, ArrowUp, ArrowUpDown } from "lucide-react";
5
+ import { Tip } from "@brdgapp/ui/components/info-hint";
6
+ import { cn } from "@brdgapp/ui/lib/utils";
7
+ // A table column header that sorts: icon + label + an arrow (faint ⇅ when this column isn't the sort,
8
+ // a blue ↓ or ↑ when it is). Ported from Bridge OS src/components/ui/column-sort-button.tsx with the
9
+ // same API, then rebuilt on Base UI Button like Button. It only shows the state; the owner of the rows decides what a click does.
10
+ // 2026-11-05: `icon` is optional (the apps' sortable headers have none; Bridge OS's all do), and DataTable
11
+ // columns take `sort` so the header cell tells screen readers which column is sorted (aria-sort).
12
+ /**
13
+ * The one look for a button in a column header: sort and filter. Icon, name, then a small sign of what
14
+ * it does (⇅, ⌄); the whole thing tints on hover. 24px tall.
15
+ */
16
+ const columnHeaderButton = "-mx-1.5 inline-flex items-center gap-1.5 rounded px-1.5 py-[3px] text-12 leading-normal font-bold whitespace-nowrap outline-none transition-colors hover:bg-[var(--surface-tertiary)] focus-visible:ring-2 focus-visible:ring-[var(--primary)]";
17
+ function ColumnSortButton({ icon: Icon, label, tooltip, direction, describe, onClick, ...rest }) {
18
+ const state = direction && describe ? `, sorted ${describe[direction]}` : "";
19
+ return (_jsx(Tip, { text: tooltip, children: _jsxs(ButtonPrimitive, { ...rest, "data-slot": "column-sort-button", onClick: (e) => {
20
+ e.stopPropagation();
21
+ onClick();
22
+ }, "aria-label": `Sort by ${label.toLowerCase()}${state}`, className: cn(columnHeaderButton, direction ? "text-[var(--text-primary)]" : "text-[var(--text-secondary)]"), children: [Icon ? _jsx(Icon, { "aria-hidden": "true", className: "size-3.5 text-[var(--text-muted)]" }) : null, label, direction === "desc" ? (_jsx(ArrowDown, { "aria-hidden": "true", className: "size-3 shrink-0 text-[var(--primary)]" })) : direction === "asc" ? (_jsx(ArrowUp, { "aria-hidden": "true", className: "size-3 shrink-0 text-[var(--primary)]" })) : (_jsx(ArrowUpDown, { "aria-hidden": "true", className: "size-3 shrink-0 opacity-40" }))] }) }));
23
+ }
24
+ export { ColumnSortButton, columnHeaderButton };
@@ -0,0 +1,28 @@
1
+ import type * as React from "react";
2
+ type ConfirmDialogProps = {
3
+ open: boolean;
4
+ onClose: () => void;
5
+ /** A question naming the thing: "Stop sharing with Leah Okonkwo?" */
6
+ title: string;
7
+ /** What happens, in a sentence or two. Can emphasise a name. */
8
+ body: React.ReactNode;
9
+ /** The action, naming the object: "Stop sharing". Never "OK" or "Yes". */
10
+ confirmLabel: string;
11
+ confirmIcon?: React.ReactNode;
12
+ /** The other button. "Cancel" unless a clearer phrase fits: "Keep editing" on a discard. */
13
+ cancelLabel?: string;
14
+ /**
15
+ * For a permanent delete of something big (a firm, a workspace): the person types this exact text,
16
+ * usually its name, before the confirm button works.
17
+ */
18
+ requireText?: string;
19
+ /** Red confirm button and a warning icon, for things that can't be undone. */
20
+ destructive?: boolean;
21
+ /** The action is running: the confirm button spins, and the dialog can't be dismissed. Not needed when `onConfirm` returns a promise. */
22
+ busy?: boolean;
23
+ /** Do the action. Return a promise and the dialog spins until it settles; throw to keep the dialog open. */
24
+ onConfirm: () => void | Promise<unknown>;
25
+ };
26
+ declare function ConfirmDialog({ open, onClose, title, body, confirmLabel, confirmIcon, cancelLabel, requireText, destructive, busy, onConfirm, }: ConfirmDialogProps): React.JSX.Element;
27
+ export { ConfirmDialog };
28
+ export type { ConfirmDialogProps };
@@ -0,0 +1,52 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useId, useRef, useState } from "react";
4
+ import { AlertDialog } from "@base-ui/react/alert-dialog";
5
+ import { TriangleAlert } from "lucide-react";
6
+ import { cn } from "@brdgapp/ui/lib/utils";
7
+ import { Button } from "@brdgapp/ui/components/button";
8
+ import { Input } from "@brdgapp/ui/components/input";
9
+ function ConfirmDialog({ open, onClose, title, body, confirmLabel, confirmIcon, cancelLabel = "Cancel", requireText, destructive = false, busy = false, onConfirm, }) {
10
+ const [pending, setPending] = useState(false);
11
+ const [typed, setTyped] = useState("");
12
+ const inputRef = useRef(null);
13
+ const inputId = useId();
14
+ const working = busy || pending;
15
+ const matches = !requireText || typed.trim() === requireText;
16
+ async function confirm() {
17
+ if (working || !matches)
18
+ return;
19
+ setPending(true);
20
+ try {
21
+ await onConfirm();
22
+ onClose();
23
+ }
24
+ catch {
25
+ // The action failed: stay open so the person can try again. The app says what went wrong (a toast).
26
+ }
27
+ finally {
28
+ setPending(false);
29
+ }
30
+ }
31
+ return (_jsx(AlertDialog.Root, { open: open, onOpenChange: (next) => {
32
+ // Escape and Cancel close it — but never mid-request: hiding the dialog then would hide the
33
+ // outcome, and the person can't tell whether the thing happened.
34
+ if (!next && !working)
35
+ onClose();
36
+ },
37
+ // Every opening starts with an empty box: clear it once the dialog has finished closing.
38
+ onOpenChangeComplete: (isOpen) => {
39
+ if (!isOpen)
40
+ setTyped("");
41
+ }, children: _jsxs(AlertDialog.Portal, { children: [_jsx(AlertDialog.Backdrop, { className: "fixed inset-0 z-[90] bg-black/40 backdrop-blur-sm transition-opacity duration-300 ease-out data-[ending-style]:duration-200 data-[starting-style]:opacity-0 data-[ending-style]:opacity-0" }), _jsxs(AlertDialog.Popup, { "data-slot": "confirm-dialog",
42
+ // With a box to type in, focus starts there; otherwise on Cancel, the safe choice.
43
+ initialFocus: requireText ? inputRef : true, className: cn("fixed z-[90] border border-[var(--border-default)] bg-[var(--surface-elevated)] p-6 shadow-[var(--shadow-dialog)] outline-none",
44
+ // Computer: a small box in the middle.
45
+ "md:top-1/2 md:left-1/2 md:w-[88vw] md:max-w-sm md:-translate-x-1/2 md:-translate-y-1/2 md:rounded-2xl", "md:transition-[opacity,scale] md:duration-300 md:ease-out md:data-[ending-style]:duration-200 md:data-[starting-style]:scale-95 md:data-[starting-style]:opacity-0 md:data-[ending-style]:opacity-0",
46
+ // Phone: slides up from the bottom, like iOS's action sheet, with the buttons under the thumb.
47
+ "max-md:inset-x-0 max-md:bottom-0 max-md:rounded-t-2xl max-md:border-x-0 max-md:border-b-0 max-md:pb-[max(24px,env(safe-area-inset-bottom))]", "max-md:transition-transform max-md:duration-300 max-md:ease-out max-md:data-[ending-style]:duration-200 max-md:data-[starting-style]:translate-y-full max-md:data-[ending-style]:translate-y-full motion-reduce:transition-none"), children: [destructive ? (_jsx("span", { "aria-hidden": "true", className: "mb-4 flex size-10 items-center justify-center rounded-full bg-[var(--error-bg)] text-[var(--danger-text)]", children: _jsx(TriangleAlert, { className: "size-5" }) })) : null, _jsx(AlertDialog.Title, { className: "text-18 font-bold tracking-tight text-[var(--text-primary)]", children: title }), _jsx(AlertDialog.Description, { render: _jsx("div", {}), className: "mt-2 text-13 leading-relaxed text-[var(--text-body)]", children: body }), requireText ? (_jsxs("form", { className: "mt-4 flex flex-col gap-1.5", onSubmit: (e) => {
48
+ e.preventDefault();
49
+ void confirm();
50
+ }, children: [_jsxs("label", { htmlFor: inputId, className: "text-13 leading-relaxed text-[var(--text-secondary)]", children: ["Type ", _jsx("span", { className: "font-semibold text-[var(--text-primary)]", children: requireText }), " to confirm"] }), _jsx(Input, { ref: inputRef, id: inputId, value: typed, onChange: (e) => setTyped(e.target.value), disabled: working, autoComplete: "off", autoCapitalize: "off", spellCheck: false })] })) : null, _jsxs("div", { className: "mt-5 flex gap-2 max-md:mt-6 max-md:flex-col-reverse", children: [_jsx(AlertDialog.Close, { disabled: working, render: _jsx(Button, { variant: "secondary", size: "md", fullWidth: true, children: cancelLabel }) }), _jsx(Button, { variant: destructive ? "destructive" : "primary", size: "md", fullWidth: true, loading: working, disabled: !matches, icon: confirmIcon, onClick: () => void confirm(), children: confirmLabel })] })] })] }) }));
51
+ }
52
+ export { ConfirmDialog };
@@ -0,0 +1,17 @@
1
+ import { type ElementProps } from "@brdgapp/ui/lib/utils";
2
+ type CopyFieldProps = ElementProps<HTMLButtonElement> & {
3
+ value: string;
4
+ kind: "email" | "phone";
5
+ /** `row`: a full-width contact row with a Copy hint on hover. `inline`: a compact meta item. */
6
+ variant?: "row" | "inline";
7
+ /** Inline only: the stronger body colour, for a prominent identity line. */
8
+ strong?: boolean;
9
+ /** Inline only: text size. */
10
+ size?: 12 | 14;
11
+ /** Inline only: show the mail / phone icon. */
12
+ showIcon?: boolean;
13
+ className?: string;
14
+ };
15
+ declare function CopyField({ value, kind, variant, strong, size, showIcon, className, ...rest }: CopyFieldProps): import("react").JSX.Element;
16
+ export { CopyField };
17
+ export type { CopyFieldProps };
@@ -0,0 +1,38 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useState } from "react";
4
+ import { Button as ButtonPrimitive } from "@base-ui/react/button";
5
+ import { Check, Copy, Mail, Phone } from "lucide-react";
6
+ import { cn } from "@brdgapp/ui/lib/utils";
7
+ function CopyField({ value, kind, variant = "row", strong = false, size = 12, showIcon = true, className, ...rest }) {
8
+ const [copied, setCopied] = useState(false);
9
+ useEffect(() => {
10
+ if (!copied)
11
+ return;
12
+ const timer = setTimeout(() => setCopied(false), 1500);
13
+ return () => clearTimeout(timer);
14
+ }, [copied]);
15
+ async function copy() {
16
+ try {
17
+ await navigator.clipboard.writeText(value);
18
+ setCopied(true);
19
+ }
20
+ catch {
21
+ // Clipboard blocked (permissions or an insecure page): nothing to undo.
22
+ }
23
+ }
24
+ const Icon = kind === "email" ? Mail : Phone;
25
+ const label = `Copy ${kind === "email" ? "email" : "phone number"}`;
26
+ const announcement = (_jsx("span", { className: "sr-only", "aria-live": "polite", children: copied ? "Copied" : "" }));
27
+ if (variant === "inline") {
28
+ return (_jsxs(ButtonPrimitive, { ...rest, "data-slot": "copy-field", onClick: copy, "aria-label": `${label}: ${value}`, className: cn(
29
+ // An outline with a 2px gap, so the ring clears the text without moving it (as on HoverCard).
30
+ "inline-flex min-w-0 items-center gap-1.5 rounded-sm outline-none transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-solid focus-visible:outline-[var(--primary)]", size === 14 ? "text-14 leading-[1.625]" : "text-12 leading-[1.625]", strong
31
+ ? "text-[var(--text-body)] hover:text-[var(--text-primary)]"
32
+ : "text-[var(--text-muted)] hover:text-[var(--text-secondary)]", className), children: [copied ? (_jsx(Check, { "aria-hidden": "true", className: "size-3.5 shrink-0 text-[var(--success)]" })) : showIcon ? (_jsx(Icon, { "aria-hidden": "true", className: "size-3.5 shrink-0" })) : null, _jsx("span", { className: "truncate", children: copied ? "Copied" : value }), announcement] }));
33
+ }
34
+ return (_jsxs(ButtonPrimitive, { ...rest, "data-slot": "copy-field", onClick: copy, "aria-label": `${label}: ${value}`, className: cn("group flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left outline-none transition-colors", "hover:bg-[var(--surface-secondary)] focus-visible:ring-2 focus-visible:ring-[var(--primary)]", className), children: [_jsx(Icon, { "aria-hidden": "true", className: "size-4 shrink-0 text-[var(--text-disabled)]" }), _jsx("span", { className: "min-w-0 flex-1 truncate text-13 leading-[1.625] text-[var(--text-body)] group-hover:text-[var(--text-primary)]", children: value }), _jsxs("span", { "aria-hidden": "true", className: cn("inline-flex shrink-0 items-center gap-1 text-12 leading-[1.625] font-semibold transition-opacity", copied
35
+ ? "text-[var(--success-text)] opacity-100"
36
+ : "text-[var(--text-muted)] [@media(hover:hover)]:opacity-0 group-hover:opacity-100 group-focus-visible:opacity-100"), children: [copied ? _jsx(Check, { className: "size-3.5" }) : _jsx(Copy, { className: "size-3.5" }), copied ? "Copied" : "Copy"] }), announcement] }));
37
+ }
38
+ export { CopyField };
@@ -0,0 +1,44 @@
1
+ import type * as React from "react";
2
+ import { type IllustrationName } from "@brdgapp/ui/components/illustration";
3
+ type DataStatus = "loading" | "error" | "success";
4
+ type EmptyContent = {
5
+ /** A bare Lucide icon, shown in a soft circle. Use `illustration` instead where a drawing fits. */
6
+ icon?: React.ReactNode;
7
+ /** One of Bridge's drawings, in place of the icon: "people", "intros", "search"… */
8
+ illustration?: IllustrationName;
9
+ /** "sm" (80px) inside a card or side panel; "md" (120px, the default) for a page's main region. */
10
+ illustrationSize?: "sm" | "md";
11
+ /** Say what would be here, not just that it's empty: "No intros yet". */
12
+ title: string;
13
+ /** What the person gets once there's data, or how to get some. */
14
+ description?: string;
15
+ /** One action, usually a primary Button. */
16
+ action?: React.ReactNode;
17
+ };
18
+ type DataStateProps<T> = {
19
+ status: DataStatus;
20
+ data: T | undefined;
21
+ /**
22
+ * The loading body. Make it the same size and shape as the loaded content (rows, cells, tiles), so
23
+ * nothing moves when the data arrives.
24
+ */
25
+ skeleton: React.ReactNode;
26
+ /** Decides whether loaded data counts as empty. Defaults to: an empty array, null or undefined. */
27
+ isEmpty?: (data: T) => boolean;
28
+ empty: EmptyContent;
29
+ /** What failed to load, finishing "Couldn't load …": "introductions", "this profile". */
30
+ errorSubject: string;
31
+ /** Load again. When given, the error shows a Retry action. */
32
+ onRetry?: () => void;
33
+ /** The loaded body. Only called with data that isn't empty. */
34
+ children: (data: T) => React.ReactNode;
35
+ className?: string;
36
+ };
37
+ /**
38
+ * The one way a data region shows loading, empty and error. It goes INSIDE the card or section: the
39
+ * frame (title, icon, hint) always renders, and only this body changes. A region never disappears
40
+ * because its data is missing, and loading never takes over the whole page.
41
+ */
42
+ declare function DataState<T>({ status, data, skeleton, isEmpty, empty, errorSubject, onRetry, children, className, }: DataStateProps<T>): React.JSX.Element;
43
+ export { DataState };
44
+ export type { DataStateProps, DataStatus, EmptyContent };
@@ -0,0 +1,25 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { AlertCircle } from "lucide-react";
4
+ import { Button } from "@brdgapp/ui/components/button";
5
+ import { Illustration } from "@brdgapp/ui/components/illustration";
6
+ import { cn } from "@brdgapp/ui/lib/utils";
7
+ function defaultIsEmpty(data) {
8
+ return data == null || (Array.isArray(data) && data.length === 0);
9
+ }
10
+ /**
11
+ * The one way a data region shows loading, empty and error. It goes INSIDE the card or section: the
12
+ * frame (title, icon, hint) always renders, and only this body changes. A region never disappears
13
+ * because its data is missing, and loading never takes over the whole page.
14
+ */
15
+ function DataState({ status, data, skeleton, isEmpty = defaultIsEmpty, empty, errorSubject, onRetry, children, className, }) {
16
+ const state = status !== "success" ? status : data === undefined || isEmpty(data) ? "empty" : "ready";
17
+ return (_jsxs("div", { "data-slot": "data-state", "data-state": state, "aria-busy": state === "loading" || undefined, "aria-live": "polite", className: cn("min-w-0", className), children: [state === "loading" ? skeleton : null, state === "error" ? _jsx(DataStateError, { subject: errorSubject, onRetry: onRetry }) : null, state === "empty" ? _jsx(DataStateEmpty, { ...empty }) : null, state === "ready" ? children(data) : null] }));
18
+ }
19
+ function DataStateEmpty({ icon, illustration, illustrationSize = "md", title, description, action }) {
20
+ return (_jsxs("div", { "data-slot": "data-state-empty", className: "flex flex-col items-center gap-4 px-6 py-10 text-center", children: [illustration ? (_jsx(Illustration, { name: illustration, size: illustrationSize })) : icon ? (_jsx("span", { "aria-hidden": "true", className: "flex size-12 items-center justify-center rounded-full bg-[var(--surface-secondary)] text-[var(--text-disabled)] [&_svg]:size-6", children: icon })) : null, _jsxs("div", { children: [_jsx("p", { className: "text-16 font-bold tracking-tight text-[var(--text-primary)]", children: title }), description ? (_jsx("p", { className: "mx-auto mt-1 max-w-xs text-13 leading-relaxed text-[var(--text-body)]", children: description })) : null] }), action] }));
21
+ }
22
+ function DataStateError({ subject, onRetry }) {
23
+ return (_jsxs("div", { "data-slot": "data-state-error", role: "alert", className: "flex flex-col items-center gap-3 px-6 py-10 text-center", children: [_jsx("span", { "aria-hidden": "true", className: "flex size-12 items-center justify-center rounded-full bg-[var(--error-bg)] text-[var(--danger-text)] [&_svg]:size-6", children: _jsx(AlertCircle, {}) }), _jsxs("p", { className: "text-16 font-bold tracking-tight text-[var(--text-primary)]", children: ["Couldn\u2019t load ", subject] }), onRetry ? (_jsx(Button, { variant: "link", size: "sm", onClick: onRetry, children: "Try again" })) : (_jsx("p", { className: "text-13 leading-[1.625] text-[var(--text-body)]", children: "Try again shortly." }))] }));
24
+ }
25
+ export { DataState };