@burtson-labs/ui 0.9.0 → 0.10.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.
@@ -0,0 +1,72 @@
1
+ import { cn } from "../lib/utils.js";
2
+ import "react";
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
+ //#region src/components/mobile-nav.tsx
5
+ /**
6
+ * The phone's bottom tab bar: icon over a visible label, 44px+ targets, and
7
+ * room for the home indicator (safe-area insets). Destinations come from the
8
+ * app; don't pad it with empty sections.
9
+ */
10
+ function MobileNav({ items, value, onValueChange, position = "static", className, "aria-label": ariaLabel = "Primary", ...props }) {
11
+ return /* @__PURE__ */ jsx("nav", {
12
+ "data-slot": "mobile-nav",
13
+ "aria-label": ariaLabel,
14
+ className: cn("border-t bg-surface/95 pr-[env(safe-area-inset-right)] pb-[env(safe-area-inset-bottom)] pl-[env(safe-area-inset-left)] backdrop-blur supports-[backdrop-filter]:bg-surface/80", position === "fixed" && "fixed inset-x-0 bottom-0 z-40", className),
15
+ ...props,
16
+ children: /* @__PURE__ */ jsx("ul", {
17
+ className: "mx-auto flex max-w-lg",
18
+ children: items.map((item) => {
19
+ const active = item.id === value;
20
+ const count = typeof item.badge === "number" && item.badge > 0 ? item.badge : void 0;
21
+ const dot = item.badge === true;
22
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [
23
+ /* @__PURE__ */ jsxs("span", {
24
+ className: "relative [&_svg]:size-5",
25
+ "aria-hidden": true,
26
+ children: [item.icon, (count !== void 0 || dot) && /* @__PURE__ */ jsx("span", {
27
+ className: cn("absolute -top-1 left-3 grid place-items-center rounded-full bg-destructive text-[10px] leading-none font-semibold text-destructive-foreground ring-2 ring-surface tabular-nums", count !== void 0 ? "h-4 min-w-4 px-1" : "size-2"),
28
+ children: count !== void 0 ? count > 99 ? "99+" : count : null
29
+ })]
30
+ }),
31
+ /* @__PURE__ */ jsx("span", {
32
+ className: "max-w-full truncate",
33
+ children: item.label
34
+ }),
35
+ count !== void 0 && /* @__PURE__ */ jsxs("span", {
36
+ className: "sr-only",
37
+ children: [
38
+ ", ",
39
+ count,
40
+ " new"
41
+ ]
42
+ }),
43
+ dot && /* @__PURE__ */ jsx("span", {
44
+ className: "sr-only",
45
+ children: ", new"
46
+ })
47
+ ] });
48
+ const classes = cn("flex min-h-14 w-full min-w-11 flex-col items-center justify-center gap-1 px-1 py-1.5 text-[11px] font-medium text-muted-foreground outline-none transition-colors select-none [-webkit-tap-highlight-color:transparent] hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/25 focus-visible:ring-inset", active && "text-brand hover:text-brand");
49
+ return /* @__PURE__ */ jsx("li", {
50
+ className: "min-w-0 flex-1",
51
+ children: item.href ? /* @__PURE__ */ jsx("a", {
52
+ href: item.href,
53
+ "aria-current": active ? "page" : void 0,
54
+ onClick: (e) => onValueChange?.(item.id, e),
55
+ className: classes,
56
+ children: content
57
+ }) : /* @__PURE__ */ jsx("button", {
58
+ type: "button",
59
+ "aria-current": active ? "page" : void 0,
60
+ onClick: (e) => onValueChange?.(item.id, e),
61
+ className: classes,
62
+ children: content
63
+ })
64
+ }, item.id);
65
+ })
66
+ })
67
+ });
68
+ }
69
+ //#endregion
70
+ export { MobileNav };
71
+
72
+ //# sourceMappingURL=mobile-nav.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mobile-nav.js","names":["_Fragment"],"sources":["../../src/components/mobile-nav.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { cn } from '../lib/utils';\n\nexport interface MobileNavItem {\n id: string;\n label: string;\n /** An icon element, e.g. <MessageSquare />; sized to 20px. */\n icon: React.ReactNode;\n /** Renders a link; leave out for a button that only calls onValueChange. */\n href?: string;\n /** A count, or true for a dot. */\n badge?: number | boolean;\n}\n\nexport interface MobileNavProps extends Omit<React.ComponentProps<'nav'>, 'onChange'> {\n /** Three to five destinations the app defines. */\n items: MobileNavItem[];\n /** The current destination's id. */\n value: string;\n /**\n * Called on every press. For a link, call `event.preventDefault()` and\n * route yourself to keep a single-page app from reloading.\n */\n onValueChange?: (id: string, event: React.MouseEvent<HTMLElement>) => void;\n /** `fixed` pins it to the bottom of the viewport. */\n position?: 'fixed' | 'static';\n 'aria-label'?: string;\n}\n\n/**\n * The phone's bottom tab bar: icon over a visible label, 44px+ targets, and\n * room for the home indicator (safe-area insets). Destinations come from the\n * app; don't pad it with empty sections.\n */\nfunction MobileNav({\n items,\n value,\n onValueChange,\n position = 'static',\n className,\n 'aria-label': ariaLabel = 'Primary',\n ...props\n}: MobileNavProps) {\n return (\n <nav\n data-slot=\"mobile-nav\"\n aria-label={ariaLabel}\n className={cn(\n 'border-t bg-surface/95 pr-[env(safe-area-inset-right)] pb-[env(safe-area-inset-bottom)] pl-[env(safe-area-inset-left)] backdrop-blur supports-[backdrop-filter]:bg-surface/80',\n position === 'fixed' && 'fixed inset-x-0 bottom-0 z-40',\n className,\n )}\n {...props}\n >\n <ul className=\"mx-auto flex max-w-lg\">\n {items.map((item) => {\n const active = item.id === value;\n const count = typeof item.badge === 'number' && item.badge > 0 ? item.badge : undefined;\n const dot = item.badge === true;\n const content = (\n <>\n <span className=\"relative [&_svg]:size-5\" aria-hidden>\n {item.icon}\n {(count !== undefined || dot) && (\n <span\n className={cn(\n 'absolute -top-1 left-3 grid place-items-center rounded-full bg-destructive text-[10px] leading-none font-semibold text-destructive-foreground ring-2 ring-surface tabular-nums',\n count !== undefined ? 'h-4 min-w-4 px-1' : 'size-2',\n )}\n >\n {count !== undefined ? (count > 99 ? '99+' : count) : null}\n </span>\n )}\n </span>\n <span className=\"max-w-full truncate\">{item.label}</span>\n {count !== undefined && <span className=\"sr-only\">, {count} new</span>}\n {dot && <span className=\"sr-only\">, new</span>}\n </>\n );\n const classes = cn(\n 'flex min-h-14 w-full min-w-11 flex-col items-center justify-center gap-1 px-1 py-1.5 text-[11px] font-medium text-muted-foreground outline-none transition-colors select-none [-webkit-tap-highlight-color:transparent] hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/25 focus-visible:ring-inset',\n active && 'text-brand hover:text-brand',\n );\n return (\n <li key={item.id} className=\"min-w-0 flex-1\">\n {item.href ? (\n <a\n href={item.href}\n aria-current={active ? 'page' : undefined}\n onClick={(e) => onValueChange?.(item.id, e)}\n className={classes}\n >\n {content}\n </a>\n ) : (\n <button\n type=\"button\"\n aria-current={active ? 'page' : undefined}\n onClick={(e) => onValueChange?.(item.id, e)}\n className={classes}\n >\n {content}\n </button>\n )}\n </li>\n );\n })}\n </ul>\n </nav>\n );\n}\n\nexport { MobileNav };\n"],"mappings":";;;;;;;;;AAmCA,SAAS,UAAU,EACjB,OACA,OACA,eACA,WAAW,UACX,WACA,cAAc,YAAY,WAC1B,GAAG,SACc;CACjB,OACE,oBAAC,OAAD;EACE,aAAU;EACV,cAAY;EACZ,WAAW,GACT,iLACA,aAAa,WAAW,iCACxB,SACF;EACA,GAAI;EAEJ,UAAA,oBAAC,MAAD;GAAI,WAAU;GACX,UAAA,MAAM,KAAK,SAAS;IACnB,MAAM,SAAS,KAAK,OAAO;IAC3B,MAAM,QAAQ,OAAO,KAAK,UAAU,YAAY,KAAK,QAAQ,IAAI,KAAK,QAAQ,KAAA;IAC9E,MAAM,MAAM,KAAK,UAAU;IAC3B,MAAM,UACJ,qBAAAA,UAAA,EAAA,UAAA;KACE,qBAAC,QAAD;MAAM,WAAU;MAA0B,eAAA;MAA1C,UAAA,CACG,KAAK,OACJ,UAAU,KAAA,KAAa,QACvB,oBAAC,QAAD;OACE,WAAW,GACT,kLACA,UAAU,KAAA,IAAY,qBAAqB,QAC7C;OAEC,UAAA,UAAU,KAAA,IAAa,QAAQ,KAAK,QAAQ,QAAS;MAClD,CAAA,CAEJ;;KACN,oBAAC,QAAD;MAAM,WAAU;MAAuB,UAAA,KAAK;KAAY,CAAA;KACvD,UAAU,KAAA,KAAa,qBAAC,QAAD;MAAM,WAAU;MAAhB,UAAA;OAA0B;OAAG;OAAM;MAAU;;KACpE,OAAO,oBAAC,QAAD;MAAM,WAAU;MAAU,UAAA;KAAW,CAAA;IAC7C,EAAA,CAAA;IAEJ,MAAM,UAAU,GACd,8TACA,UAAU,6BACZ;IACA,OACE,oBAAC,MAAD;KAAkB,WAAU;KACzB,UAAA,KAAK,OACJ,oBAAC,KAAD;MACE,MAAM,KAAK;MACX,gBAAc,SAAS,SAAS,KAAA;MAChC,UAAU,MAAM,gBAAgB,KAAK,IAAI,CAAC;MAC1C,WAAW;MAEV,UAAA;KACA,CAAA,IAEH,oBAAC,UAAD;MACE,MAAK;MACL,gBAAc,SAAS,SAAS,KAAA;MAChC,UAAU,MAAM,gBAAgB,KAAK,IAAI,CAAC;MAC1C,WAAW;MAEV,UAAA;KACK,CAAA;IAER,GApBK,KAAK,EAoBV;GAER,CAAC;EACC,CAAA;CACD,CAAA;AAET"}
@@ -6,11 +6,17 @@ declare function SheetClose(props: React.ComponentProps<typeof SheetPrimitive.Cl
6
6
  declare const sideClasses: {
7
7
  readonly right: "inset-y-0 right-0 h-full w-3/4 border-l [--bl-sheet-x:100%] sm:max-w-sm";
8
8
  readonly left: "inset-y-0 left-0 h-full w-3/4 border-r [--bl-sheet-x:-100%] sm:max-w-sm";
9
- readonly top: "inset-x-0 top-0 max-h-[85dvh] rounded-b-xl border-b [--bl-sheet-x:0] [--bl-sheet-y:-100%]";
10
- readonly bottom: "inset-x-0 bottom-0 max-h-[85dvh] rounded-t-xl border-t [--bl-sheet-x:0] [--bl-sheet-y:100%]";
9
+ readonly top: "inset-x-0 top-0 max-h-[85dvh] rounded-b-xl border-b pt-[env(safe-area-inset-top)] [--bl-sheet-x:0] [--bl-sheet-y:-100%]";
10
+ readonly bottom: "inset-x-0 bottom-0 max-h-[85dvh] rounded-t-xl border-t pb-[env(safe-area-inset-bottom)] [--bl-sheet-x:0] [--bl-sheet-y:100%]";
11
11
  };
12
- declare function SheetContent({ className, children, side, ...props }: React.ComponentProps<typeof SheetPrimitive.Content> & {
12
+ declare function SheetContent({ className, children, side, handle, ...props }: React.ComponentProps<typeof SheetPrimitive.Content> & {
13
13
  side?: keyof typeof sideClasses;
14
+ /**
15
+ * A grab bar at the top edge, the cue that this is a drawer. Visual only:
16
+ * it does not drag; close with the button, Escape or the overlay. On by
17
+ * default for bottom sheets.
18
+ */
19
+ handle?: boolean;
14
20
  }): React.JSX.Element;
15
21
  declare function SheetHeader({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
16
22
  declare function SheetFooter({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
@@ -25,10 +25,10 @@ function SheetClose(props) {
25
25
  var sideClasses = {
26
26
  right: "inset-y-0 right-0 h-full w-3/4 border-l [--bl-sheet-x:100%] sm:max-w-sm",
27
27
  left: "inset-y-0 left-0 h-full w-3/4 border-r [--bl-sheet-x:-100%] sm:max-w-sm",
28
- top: "inset-x-0 top-0 max-h-[85dvh] rounded-b-xl border-b [--bl-sheet-x:0] [--bl-sheet-y:-100%]",
29
- bottom: "inset-x-0 bottom-0 max-h-[85dvh] rounded-t-xl border-t [--bl-sheet-x:0] [--bl-sheet-y:100%]"
28
+ top: "inset-x-0 top-0 max-h-[85dvh] rounded-b-xl border-b pt-[env(safe-area-inset-top)] [--bl-sheet-x:0] [--bl-sheet-y:-100%]",
29
+ bottom: "inset-x-0 bottom-0 max-h-[85dvh] rounded-t-xl border-t pb-[env(safe-area-inset-bottom)] [--bl-sheet-x:0] [--bl-sheet-y:100%]"
30
30
  };
31
- function SheetContent({ className, children, side = "right", ...props }) {
31
+ function SheetContent({ className, children, side = "right", handle = side === "bottom", ...props }) {
32
32
  return /* @__PURE__ */ jsxs(Dialog.Portal, { children: [/* @__PURE__ */ jsx(Dialog.Overlay, {
33
33
  "data-slot": "sheet-overlay",
34
34
  className: "fixed inset-0 z-50 bg-black/55 backdrop-blur-[3px] data-[state=closed]:animate-fade-out data-[state=open]:animate-fade-in"
@@ -36,13 +36,21 @@ function SheetContent({ className, children, side = "right", ...props }) {
36
36
  "data-slot": "sheet-content",
37
37
  className: cn("fixed z-50 max-h-dvh overflow-y-auto overscroll-contain flex flex-col gap-4 border-border-strong bg-surface-raised text-foreground shadow-[0_24px_80px_rgb(0_0_0_/_0.28)] outline-none data-[state=closed]:animate-sheet-out data-[state=open]:animate-sheet-in", sideClasses[side], className),
38
38
  ...props,
39
- children: [children, /* @__PURE__ */ jsxs(Dialog.Close, {
40
- className: "absolute top-3.5 right-3.5 grid size-8 place-items-center rounded-md text-muted-foreground transition-colors outline-none hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/20 [&_svg]:size-4",
41
- children: [/* @__PURE__ */ jsx(X, { "aria-hidden": true }), /* @__PURE__ */ jsx("span", {
42
- className: "sr-only",
43
- children: "Close"
44
- })]
45
- })]
39
+ children: [
40
+ handle && /* @__PURE__ */ jsx("div", {
41
+ "data-slot": "sheet-handle",
42
+ "aria-hidden": true,
43
+ className: "mx-auto mt-2 -mb-2 h-1 w-10 shrink-0 rounded-full bg-border-strong"
44
+ }),
45
+ children,
46
+ /* @__PURE__ */ jsxs(Dialog.Close, {
47
+ className: cn("absolute right-3 grid size-8 place-items-center rounded-md text-muted-foreground transition-colors outline-none hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/20 pointer-coarse:size-11 [&_svg]:size-4 pointer-coarse:[&_svg]:size-5", side === "top" ? "top-[calc(env(safe-area-inset-top)+0.75rem)]" : "top-3"),
48
+ children: [/* @__PURE__ */ jsx(X, { "aria-hidden": true }), /* @__PURE__ */ jsx("span", {
49
+ className: "sr-only",
50
+ children: "Close"
51
+ })]
52
+ })
53
+ ]
46
54
  })] });
47
55
  }
48
56
  function SheetHeader({ className, ...props }) {
@@ -1 +1 @@
1
- {"version":3,"file":"sheet.js","names":["SheetPrimitive"],"sources":["../../src/components/sheet.tsx"],"sourcesContent":["import X from '@burtson-labs/icons/react/x';\nimport { Dialog as SheetPrimitive } from 'radix-ui';\nimport * as React from 'react';\n\nimport { cn } from '../lib/utils';\n\nfunction Sheet(props: React.ComponentProps<typeof SheetPrimitive.Root>) {\n return <SheetPrimitive.Root data-slot=\"sheet\" {...props} />;\n}\n\nfunction SheetTrigger(props: React.ComponentProps<typeof SheetPrimitive.Trigger>) {\n return <SheetPrimitive.Trigger data-slot=\"sheet-trigger\" {...props} />;\n}\n\nfunction SheetClose(props: React.ComponentProps<typeof SheetPrimitive.Close>) {\n return <SheetPrimitive.Close data-slot=\"sheet-close\" {...props} />;\n}\n\nconst sideClasses = {\n right: 'inset-y-0 right-0 h-full w-3/4 border-l [--bl-sheet-x:100%] sm:max-w-sm',\n left: 'inset-y-0 left-0 h-full w-3/4 border-r [--bl-sheet-x:-100%] sm:max-w-sm',\n // Top and bottom sheets are the mobile drawers.\n top: 'inset-x-0 top-0 max-h-[85dvh] rounded-b-xl border-b [--bl-sheet-x:0] [--bl-sheet-y:-100%]',\n bottom:\n 'inset-x-0 bottom-0 max-h-[85dvh] rounded-t-xl border-t [--bl-sheet-x:0] [--bl-sheet-y:100%]',\n} as const;\n\nfunction SheetContent({\n className,\n children,\n side = 'right',\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Content> & { side?: keyof typeof sideClasses }) {\n return (\n <SheetPrimitive.Portal>\n <SheetPrimitive.Overlay\n data-slot=\"sheet-overlay\"\n className=\"fixed inset-0 z-50 bg-black/55 backdrop-blur-[3px] data-[state=closed]:animate-fade-out data-[state=open]:animate-fade-in\"\n />\n <SheetPrimitive.Content\n data-slot=\"sheet-content\"\n className={cn(\n 'fixed z-50 max-h-dvh overflow-y-auto overscroll-contain flex flex-col gap-4 border-border-strong bg-surface-raised text-foreground shadow-[0_24px_80px_rgb(0_0_0_/_0.28)] outline-none data-[state=closed]:animate-sheet-out data-[state=open]:animate-sheet-in',\n sideClasses[side],\n className,\n )}\n {...props}\n >\n {children}\n <SheetPrimitive.Close className=\"absolute top-3.5 right-3.5 grid size-8 place-items-center rounded-md text-muted-foreground transition-colors outline-none hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/20 [&_svg]:size-4\">\n <X aria-hidden />\n <span className=\"sr-only\">Close</span>\n </SheetPrimitive.Close>\n </SheetPrimitive.Content>\n </SheetPrimitive.Portal>\n );\n}\n\nfunction SheetHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"sheet-header\"\n className={cn('flex flex-col gap-1.5 p-4', className)}\n {...props}\n />\n );\n}\n\nfunction SheetFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"sheet-footer\"\n className={cn('mt-auto flex flex-col gap-2 p-4', className)}\n {...props}\n />\n );\n}\n\nfunction SheetTitle({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Title>) {\n return (\n <SheetPrimitive.Title\n data-slot=\"sheet-title\"\n className={cn('text-base font-semibold tracking-[-0.02em] text-foreground', className)}\n {...props}\n />\n );\n}\n\nfunction SheetDescription({\n className,\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Description>) {\n return (\n <SheetPrimitive.Description\n data-slot=\"sheet-description\"\n className={cn('text-sm text-muted-foreground', className)}\n {...props}\n />\n );\n}\n\nexport {\n Sheet,\n SheetClose,\n SheetContent,\n SheetDescription,\n SheetFooter,\n SheetHeader,\n SheetTitle,\n SheetTrigger,\n};\n"],"mappings":";;;;;;AAMA,SAAS,MAAM,OAAyD;CACtE,OAAO,oBAACA,OAAe,MAAhB;EAAqB,aAAU;EAAQ,GAAI;CAAQ,CAAA;AAC5D;AAEA,SAAS,aAAa,OAA4D;CAChF,OAAO,oBAACA,OAAe,SAAhB;EAAwB,aAAU;EAAgB,GAAI;CAAQ,CAAA;AACvE;AAEA,SAAS,WAAW,OAA0D;CAC5E,OAAO,oBAACA,OAAe,OAAhB;EAAsB,aAAU;EAAc,GAAI;CAAQ,CAAA;AACnE;AAEA,IAAM,cAAc;CAClB,OAAO;CACP,MAAM;CAEN,KAAK;CACL,QACE;AACJ;AAEA,SAAS,aAAa,EACpB,WACA,UACA,OAAO,SACP,GAAG,SACyF;CAC5F,OACE,qBAACA,OAAe,QAAhB,EAAA,UAAA,CACE,oBAACA,OAAe,SAAhB;EACE,aAAU;EACV,WAAU;CACX,CAAA,GACD,qBAACA,OAAe,SAAhB;EACE,aAAU;EACV,WAAW,GACT,mQACA,YAAY,OACZ,SACF;EACA,GAAI;EAPN,UAAA,CASG,UACD,qBAACA,OAAe,OAAhB;GAAsB,WAAU;GAAhC,UAAA,CACE,oBAAC,GAAD,EAAG,eAAA,KAAa,CAAA,GAChB,oBAAC,QAAD;IAAM,WAAU;IAAU,UAAA;GAAW,CAAA,CACjB;EACA,CAAA,CAAA;CACH,CAAA,CAAA,EAAA,CAAA;AAE3B;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,SAAsC;CACzE,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GAAG,6BAA6B,SAAS;EACpD,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,SAAsC;CACzE,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GAAG,mCAAmC,SAAS;EAC1D,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,WAAW,EAAE,WAAW,GAAG,SAA4D;CAC9F,OACE,oBAACA,OAAe,OAAhB;EACE,aAAU;EACV,WAAW,GAAG,8DAA8D,SAAS;EACrF,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,iBAAiB,EACxB,WACA,GAAG,SACuD;CAC1D,OACE,oBAACA,OAAe,aAAhB;EACE,aAAU;EACV,WAAW,GAAG,iCAAiC,SAAS;EACxD,GAAI;CACL,CAAA;AAEL"}
1
+ {"version":3,"file":"sheet.js","names":["SheetPrimitive"],"sources":["../../src/components/sheet.tsx"],"sourcesContent":["import X from '@burtson-labs/icons/react/x';\nimport { Dialog as SheetPrimitive } from 'radix-ui';\nimport * as React from 'react';\n\nimport { cn } from '../lib/utils';\n\nfunction Sheet(props: React.ComponentProps<typeof SheetPrimitive.Root>) {\n return <SheetPrimitive.Root data-slot=\"sheet\" {...props} />;\n}\n\nfunction SheetTrigger(props: React.ComponentProps<typeof SheetPrimitive.Trigger>) {\n return <SheetPrimitive.Trigger data-slot=\"sheet-trigger\" {...props} />;\n}\n\nfunction SheetClose(props: React.ComponentProps<typeof SheetPrimitive.Close>) {\n return <SheetPrimitive.Close data-slot=\"sheet-close\" {...props} />;\n}\n\nconst sideClasses = {\n right: 'inset-y-0 right-0 h-full w-3/4 border-l [--bl-sheet-x:100%] sm:max-w-sm',\n left: 'inset-y-0 left-0 h-full w-3/4 border-r [--bl-sheet-x:-100%] sm:max-w-sm',\n // Top and bottom sheets are the mobile drawers. Each keeps clear of the\n // notch or home indicator on its edge (safe-area insets).\n top: 'inset-x-0 top-0 max-h-[85dvh] rounded-b-xl border-b pt-[env(safe-area-inset-top)] [--bl-sheet-x:0] [--bl-sheet-y:-100%]',\n bottom:\n 'inset-x-0 bottom-0 max-h-[85dvh] rounded-t-xl border-t pb-[env(safe-area-inset-bottom)] [--bl-sheet-x:0] [--bl-sheet-y:100%]',\n} as const;\n\nfunction SheetContent({\n className,\n children,\n side = 'right',\n handle = side === 'bottom',\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Content> & {\n side?: keyof typeof sideClasses;\n /**\n * A grab bar at the top edge, the cue that this is a drawer. Visual only:\n * it does not drag; close with the button, Escape or the overlay. On by\n * default for bottom sheets.\n */\n handle?: boolean;\n}) {\n return (\n <SheetPrimitive.Portal>\n <SheetPrimitive.Overlay\n data-slot=\"sheet-overlay\"\n className=\"fixed inset-0 z-50 bg-black/55 backdrop-blur-[3px] data-[state=closed]:animate-fade-out data-[state=open]:animate-fade-in\"\n />\n <SheetPrimitive.Content\n data-slot=\"sheet-content\"\n className={cn(\n 'fixed z-50 max-h-dvh overflow-y-auto overscroll-contain flex flex-col gap-4 border-border-strong bg-surface-raised text-foreground shadow-[0_24px_80px_rgb(0_0_0_/_0.28)] outline-none data-[state=closed]:animate-sheet-out data-[state=open]:animate-sheet-in',\n sideClasses[side],\n className,\n )}\n {...props}\n >\n {handle && (\n <div\n data-slot=\"sheet-handle\"\n aria-hidden\n className=\"mx-auto mt-2 -mb-2 h-1 w-10 shrink-0 rounded-full bg-border-strong\"\n />\n )}\n {children}\n {/* 44px on touch screens, 32px with a mouse. */}\n <SheetPrimitive.Close\n className={cn(\n 'absolute right-3 grid size-8 place-items-center rounded-md text-muted-foreground transition-colors outline-none hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/20 pointer-coarse:size-11 [&_svg]:size-4 pointer-coarse:[&_svg]:size-5',\n side === 'top' ? 'top-[calc(env(safe-area-inset-top)+0.75rem)]' : 'top-3',\n )}\n >\n <X aria-hidden />\n <span className=\"sr-only\">Close</span>\n </SheetPrimitive.Close>\n </SheetPrimitive.Content>\n </SheetPrimitive.Portal>\n );\n}\n\nfunction SheetHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"sheet-header\"\n className={cn('flex flex-col gap-1.5 p-4', className)}\n {...props}\n />\n );\n}\n\nfunction SheetFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"sheet-footer\"\n className={cn('mt-auto flex flex-col gap-2 p-4', className)}\n {...props}\n />\n );\n}\n\nfunction SheetTitle({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Title>) {\n return (\n <SheetPrimitive.Title\n data-slot=\"sheet-title\"\n className={cn('text-base font-semibold tracking-[-0.02em] text-foreground', className)}\n {...props}\n />\n );\n}\n\nfunction SheetDescription({\n className,\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Description>) {\n return (\n <SheetPrimitive.Description\n data-slot=\"sheet-description\"\n className={cn('text-sm text-muted-foreground', className)}\n {...props}\n />\n );\n}\n\nexport {\n Sheet,\n SheetClose,\n SheetContent,\n SheetDescription,\n SheetFooter,\n SheetHeader,\n SheetTitle,\n SheetTrigger,\n};\n"],"mappings":";;;;;;AAMA,SAAS,MAAM,OAAyD;CACtE,OAAO,oBAACA,O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AC9F,OACE,oBAACA,OAAe,OAAhB;EACE,aAAU;EACV,WAAW,GAAG,8DAA8D,SAAS;EACrF,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,iBAAiB,EACxB,WACA,GAAG,SACuD;CAC1D,OACE,oBAACA,OAAe,aAAhB;EACE,aAAU;EACV,WAAW,GAAG,iCAAiC,SAAS;EACxD,GAAI;CACL,CAAA;AAEL"}
@@ -0,0 +1,31 @@
1
+ import * as React from 'react';
2
+ import { PopoverTrigger } from './popover';
3
+ /** Where an answer came from. The app supplies provenance; this only shows it. */
4
+ export interface Source {
5
+ id: string;
6
+ title: string;
7
+ /** Only http(s) links are rendered as links. */
8
+ url?: string;
9
+ /** The passage the answer relied on. */
10
+ snippet?: string;
11
+ /** Short location, e.g. "page 4" or "Updated 2 days ago". */
12
+ meta?: string;
13
+ icon?: React.ReactNode;
14
+ }
15
+ /** An http(s) URL, or undefined for anything else (javascript:, data:, relative). */
16
+ export declare function safeSourceHref(url: string | undefined): string | undefined;
17
+ export interface SourceCitationProps extends Omit<React.ComponentProps<typeof PopoverTrigger>, 'children'> {
18
+ /** 1-based number shown in the text; matches the SourceList entry. */
19
+ index: number;
20
+ source: Source;
21
+ }
22
+ /** An inline [n] marker in an answer; opens the source it points to. */
23
+ declare function SourceCitation({ index, source, className, ...props }: SourceCitationProps): React.JSX.Element;
24
+ export interface SourceListProps extends React.ComponentProps<'section'> {
25
+ sources: Source[];
26
+ /** Heading; also the list's accessible name. */
27
+ label?: string;
28
+ }
29
+ /** Numbered sources under an answer, in citation order. */
30
+ declare function SourceList({ sources, label, className, ...props }: SourceListProps): React.JSX.Element | null;
31
+ export { SourceCitation, SourceList };
@@ -0,0 +1,119 @@
1
+ import { cn } from "../lib/utils.js";
2
+ import { Popover, PopoverContent, PopoverTrigger } from "./popover.js";
3
+ import * as React from "react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import FileText from "@burtson-labs/icons/react/file-text";
6
+ import ExternalLink from "@burtson-labs/icons/react/external-link";
7
+ //#region src/components/source.tsx
8
+ /** An http(s) URL, or undefined for anything else (javascript:, data:, relative). */
9
+ function safeSourceHref(url) {
10
+ if (!url) return void 0;
11
+ try {
12
+ const parsed = new URL(url);
13
+ return parsed.protocol === "https:" || parsed.protocol === "http:" ? parsed.href : void 0;
14
+ } catch {
15
+ return;
16
+ }
17
+ }
18
+ function hostOf(href) {
19
+ if (!href) return void 0;
20
+ try {
21
+ return new URL(href).hostname.replace(/^www\./, "");
22
+ } catch {
23
+ return;
24
+ }
25
+ }
26
+ function SourceBody({ source, index }) {
27
+ const href = safeSourceHref(source.url);
28
+ const location = [hostOf(href), source.meta].filter(Boolean).join(" · ");
29
+ return /* @__PURE__ */ jsxs("div", {
30
+ className: "grid min-w-0 gap-1",
31
+ children: [
32
+ /* @__PURE__ */ jsxs("div", {
33
+ className: "flex min-w-0 items-start gap-2",
34
+ children: [
35
+ index !== void 0 && /* @__PURE__ */ jsx("span", {
36
+ className: "mt-px grid h-5 min-w-5 shrink-0 place-items-center rounded-sm border bg-surface-muted px-1 font-mono text-[11px] font-semibold text-muted-foreground tabular-nums",
37
+ children: index
38
+ }),
39
+ /* @__PURE__ */ jsx("span", {
40
+ className: "mt-0.5 shrink-0 text-muted-foreground [&_svg]:size-4",
41
+ children: source.icon ?? /* @__PURE__ */ jsx(FileText, { "aria-hidden": true })
42
+ }),
43
+ href ? /* @__PURE__ */ jsxs("a", {
44
+ href,
45
+ target: "_blank",
46
+ rel: "noopener noreferrer",
47
+ className: "min-w-0 font-medium text-foreground underline-offset-2 outline-none hover:underline focus-visible:underline",
48
+ children: [/* @__PURE__ */ jsx("span", {
49
+ className: "line-clamp-2",
50
+ children: source.title
51
+ }), /* @__PURE__ */ jsx("span", {
52
+ className: "sr-only",
53
+ children: " (opens in a new tab)"
54
+ })]
55
+ }) : /* @__PURE__ */ jsx("span", {
56
+ className: "line-clamp-2 min-w-0 font-medium text-foreground",
57
+ children: source.title
58
+ }),
59
+ href && /* @__PURE__ */ jsx(ExternalLink, {
60
+ className: "mt-1 size-3 shrink-0 text-muted-foreground",
61
+ "aria-hidden": true
62
+ })
63
+ ]
64
+ }),
65
+ location && /* @__PURE__ */ jsx("p", {
66
+ className: "truncate text-xs text-muted-foreground",
67
+ children: location
68
+ }),
69
+ source.snippet && /* @__PURE__ */ jsx("blockquote", {
70
+ className: "line-clamp-3 border-l-2 pl-2 text-xs leading-5 text-muted-foreground",
71
+ children: source.snippet
72
+ })
73
+ ]
74
+ });
75
+ }
76
+ /** An inline [n] marker in an answer; opens the source it points to. */
77
+ function SourceCitation({ index, source, className, ...props }) {
78
+ return /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsx(PopoverTrigger, {
79
+ "data-slot": "source-citation",
80
+ "aria-label": `Source ${index}: ${source.title}`,
81
+ className: cn("mx-0.5 inline-grid h-4 min-w-4 translate-y-[-0.1em] place-items-center rounded-xs border bg-surface-muted px-1 align-baseline font-mono text-[10px] leading-none font-semibold text-muted-foreground tabular-nums transition-colors outline-none hover:border-brand/40 hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/20 data-[state=open]:border-brand data-[state=open]:text-foreground", className),
82
+ ...props,
83
+ children: index
84
+ }), /* @__PURE__ */ jsx(PopoverContent, {
85
+ side: "top",
86
+ align: "start",
87
+ className: "w-80 p-3 text-sm",
88
+ children: /* @__PURE__ */ jsx(SourceBody, { source })
89
+ })] });
90
+ }
91
+ /** Numbered sources under an answer, in citation order. */
92
+ function SourceList({ sources, label = "Sources", className, ...props }) {
93
+ const headingId = React.useId();
94
+ if (sources.length === 0) return null;
95
+ return /* @__PURE__ */ jsxs("section", {
96
+ "data-slot": "source-list",
97
+ "aria-labelledby": headingId,
98
+ className: cn("grid gap-2", className),
99
+ ...props,
100
+ children: [/* @__PURE__ */ jsx("h3", {
101
+ id: headingId,
102
+ className: "text-[11px] font-semibold tracking-[0.06em] text-muted-foreground uppercase",
103
+ children: label
104
+ }), /* @__PURE__ */ jsx("ol", {
105
+ className: "grid gap-1.5 sm:grid-cols-2",
106
+ children: sources.map((source, i) => /* @__PURE__ */ jsx("li", {
107
+ className: "min-w-0 rounded-md border bg-surface p-2.5 text-sm transition-colors hover:border-border-strong",
108
+ children: /* @__PURE__ */ jsx(SourceBody, {
109
+ source,
110
+ index: i + 1
111
+ })
112
+ }, source.id))
113
+ })]
114
+ });
115
+ }
116
+ //#endregion
117
+ export { SourceCitation, SourceList, safeSourceHref };
118
+
119
+ //# sourceMappingURL=source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source.js","names":[],"sources":["../../src/components/source.tsx"],"sourcesContent":["import ExternalLink from '@burtson-labs/icons/react/external-link';\nimport FileText from '@burtson-labs/icons/react/file-text';\nimport * as React from 'react';\n\nimport { cn } from '../lib/utils';\n\nimport { Popover, PopoverContent, PopoverTrigger } from './popover';\n\n/** Where an answer came from. The app supplies provenance; this only shows it. */\nexport interface Source {\n id: string;\n title: string;\n /** Only http(s) links are rendered as links. */\n url?: string;\n /** The passage the answer relied on. */\n snippet?: string;\n /** Short location, e.g. \"page 4\" or \"Updated 2 days ago\". */\n meta?: string;\n icon?: React.ReactNode;\n}\n\n/** An http(s) URL, or undefined for anything else (javascript:, data:, relative). */\nexport function safeSourceHref(url: string | undefined): string | undefined {\n if (!url) return undefined;\n try {\n const parsed = new URL(url);\n return parsed.protocol === 'https:' || parsed.protocol === 'http:' ? parsed.href : undefined;\n } catch {\n return undefined;\n }\n}\n\nfunction hostOf(href: string | undefined): string | undefined {\n if (!href) return undefined;\n try {\n return new URL(href).hostname.replace(/^www\\./, '');\n } catch {\n return undefined;\n }\n}\n\nfunction SourceBody({ source, index }: { source: Source; index?: number }) {\n const href = safeSourceHref(source.url);\n const host = hostOf(href);\n const location = [host, source.meta].filter(Boolean).join(' · ');\n return (\n <div className=\"grid min-w-0 gap-1\">\n <div className=\"flex min-w-0 items-start gap-2\">\n {index !== undefined && (\n <span className=\"mt-px grid h-5 min-w-5 shrink-0 place-items-center rounded-sm border bg-surface-muted px-1 font-mono text-[11px] font-semibold text-muted-foreground tabular-nums\">\n {index}\n </span>\n )}\n <span className=\"mt-0.5 shrink-0 text-muted-foreground [&_svg]:size-4\">\n {source.icon ?? <FileText aria-hidden />}\n </span>\n {href ? (\n <a\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"min-w-0 font-medium text-foreground underline-offset-2 outline-none hover:underline focus-visible:underline\"\n >\n <span className=\"line-clamp-2\">{source.title}</span>\n <span className=\"sr-only\"> (opens in a new tab)</span>\n </a>\n ) : (\n <span className=\"line-clamp-2 min-w-0 font-medium text-foreground\">{source.title}</span>\n )}\n {href && (\n <ExternalLink className=\"mt-1 size-3 shrink-0 text-muted-foreground\" aria-hidden />\n )}\n </div>\n {location && <p className=\"truncate text-xs text-muted-foreground\">{location}</p>}\n {source.snippet && (\n <blockquote className=\"line-clamp-3 border-l-2 pl-2 text-xs leading-5 text-muted-foreground\">\n {source.snippet}\n </blockquote>\n )}\n </div>\n );\n}\n\nexport interface SourceCitationProps extends Omit<\n React.ComponentProps<typeof PopoverTrigger>,\n 'children'\n> {\n /** 1-based number shown in the text; matches the SourceList entry. */\n index: number;\n source: Source;\n}\n\n/** An inline [n] marker in an answer; opens the source it points to. */\nfunction SourceCitation({ index, source, className, ...props }: SourceCitationProps) {\n return (\n <Popover>\n <PopoverTrigger\n data-slot=\"source-citation\"\n aria-label={`Source ${index}: ${source.title}`}\n className={cn(\n 'mx-0.5 inline-grid h-4 min-w-4 translate-y-[-0.1em] place-items-center rounded-xs border bg-surface-muted px-1 align-baseline font-mono text-[10px] leading-none font-semibold text-muted-foreground tabular-nums transition-colors outline-none hover:border-brand/40 hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/20 data-[state=open]:border-brand data-[state=open]:text-foreground',\n className,\n )}\n {...props}\n >\n {index}\n </PopoverTrigger>\n <PopoverContent side=\"top\" align=\"start\" className=\"w-80 p-3 text-sm\">\n <SourceBody source={source} />\n </PopoverContent>\n </Popover>\n );\n}\n\nexport interface SourceListProps extends React.ComponentProps<'section'> {\n sources: Source[];\n /** Heading; also the list's accessible name. */\n label?: string;\n}\n\n/** Numbered sources under an answer, in citation order. */\nfunction SourceList({ sources, label = 'Sources', className, ...props }: SourceListProps) {\n const headingId = React.useId();\n if (sources.length === 0) return null;\n return (\n <section\n data-slot=\"source-list\"\n aria-labelledby={headingId}\n className={cn('grid gap-2', className)}\n {...props}\n >\n <h3\n id={headingId}\n className=\"text-[11px] font-semibold tracking-[0.06em] text-muted-foreground uppercase\"\n >\n {label}\n </h3>\n <ol className=\"grid gap-1.5 sm:grid-cols-2\">\n {sources.map((source, i) => (\n <li\n key={source.id}\n className=\"min-w-0 rounded-md border bg-surface p-2.5 text-sm transition-colors hover:border-border-strong\"\n >\n <SourceBody source={source} index={i + 1} />\n </li>\n ))}\n </ol>\n </section>\n );\n}\n\nexport { SourceCitation, SourceList };\n"],"mappings":";;;;;;;;AAsBA,SAAgB,eAAe,KAA6C;CAC1E,IAAI,CAAC,KAAK,OAAO,KAAA;CACjB,IAAI;EACF,MAAM,SAAS,IAAI,IAAI,GAAG;EAC1B,OAAO,OAAO,aAAa,YAAY,OAAO,aAAa,UAAU,OAAO,OAAO,KAAA;CACrF,QAAQ;EACN;CACF;AACF;AAEA,SAAS,OAAO,MAA8C;CAC5D,IAAI,CAAC,MAAM,OAAO,KAAA;CAClB,IAAI;EACF,OAAO,IAAI,IAAI,IAAI,CAAC,CAAC,SAAS,QAAQ,UAAU,EAAE;CACpD,QAAQ;EACN;CACF;AACF;AAEA,SAAS,WAAW,EAAE,QAAQ,SAA6C;CACzE,MAAM,OAAO,eAAe,OAAO,GAAG;CAEtC,MAAM,WAAW,CADJ,OAAO,IACF,GAAM,OAAO,IAAI,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,KAAK;CAC/D,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACE,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA;KACG,U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AI;EAJN,UAAA,CAME,oBAAC,MAAD;GACE,IAAI;GACJ,WAAU;GAET,UAAA;EACC,CAAA,GACJ,oBAAC,MAAD;GAAI,WAAU;GACX,UAAA,QAAQ,KAAK,QAAQ,MACpB,oBAAC,MAAD;IAEE,WAAU;IAEV,UAAA,oBAAC,YAAD;KAAoB;KAAQ,OAAO,IAAI;IAAI,CAAA;GACzC,GAJG,OAAO,EAIV,CACL;EACC,CAAA,CACG;;AAEb"}
@@ -14,6 +14,8 @@ export interface TreeNode {
14
14
  disabled?: boolean;
15
15
  /** Trailing detail, such as a git status letter or a count. */
16
16
  meta?: React.ReactNode;
17
+ /** Extra classes on the row, for app states such as an ignored file or a highlight. */
18
+ className?: string;
17
19
  }
18
20
  export interface TreeViewProps extends Omit<React.ComponentProps<'div'>, 'children' | 'onSelect' | 'aria-label'> {
19
21
  nodes: TreeNode[];
@@ -29,6 +31,19 @@ export interface TreeViewProps extends Omit<React.ComponentProps<'div'>, 'childr
29
31
  selectionFollowsFocus?: boolean;
30
32
  /** Enter or double-click: open the file, run the item. */
31
33
  onAction?: (id: string) => void;
34
+ /**
35
+ * A plain click on a row without children also runs `onAction`, the way a
36
+ * file explorer opens a file on one click. Default off.
37
+ */
38
+ actionOnClick?: boolean;
39
+ /**
40
+ * A plain click on an expandable row toggles it. Defaults to on for single
41
+ * selection; turn it on for a multi-select explorer, where Shift and Ctrl/⌘
42
+ * clicks still only select.
43
+ */
44
+ expandOnClick?: boolean;
45
+ /** Draw a line per ancestor level while the pointer is over the tree. */
46
+ indentGuides?: boolean;
32
47
  /** Called once when a node with `hasChildren` and no children expands. */
33
48
  onLoadChildren?: (id: string) => void;
34
49
  /** Replace the label, e.g. with a rename input. Keys typed in an input never move focus. */
@@ -57,5 +72,5 @@ export declare function flattenTree(nodes: TreeNode[], expanded: ReadonlySet<str
57
72
  * render flat (role="treeitem" with aria-level), one tab stop for the tree,
58
73
  * arrows to move, Right/Left to open and close, Home/End, typeahead.
59
74
  */
60
- declare function TreeView({ nodes, expanded, onExpandedChange, selected, onSelectedChange, selectionMode, selectionFollowsFocus, onAction, onLoadChildren, renderLabel, density, empty, onRowContextMenu, className, ...props }: TreeViewProps): React.JSX.Element;
75
+ declare function TreeView({ nodes, expanded, onExpandedChange, selected, onSelectedChange, selectionMode, selectionFollowsFocus, onAction, actionOnClick, expandOnClick, indentGuides, onLoadChildren, renderLabel, density, empty, onRowContextMenu, className, ...props }: TreeViewProps): React.JSX.Element;
61
76
  export { TreeView };
@@ -34,7 +34,7 @@ var isTypingTarget = (target) => target instanceof HTMLElement && (target.isCont
34
34
  * render flat (role="treeitem" with aria-level), one tab stop for the tree,
35
35
  * arrows to move, Right/Left to open and close, Home/End, typeahead.
36
36
  */
37
- function TreeView({ nodes, expanded, onExpandedChange, selected, onSelectedChange, selectionMode = "single", selectionFollowsFocus = false, onAction, onLoadChildren, renderLabel, density = "default", empty, onRowContextMenu, className, ...props }) {
37
+ function TreeView({ nodes, expanded, onExpandedChange, selected, onSelectedChange, selectionMode = "single", selectionFollowsFocus = false, onAction, actionOnClick = false, expandOnClick, indentGuides = false, onLoadChildren, renderLabel, density = "default", empty, onRowContextMenu, className, ...props }) {
38
38
  const expandedSet = React.useMemo(() => new Set(expanded), [expanded]);
39
39
  const selectedSet = React.useMemo(() => new Set(selected), [selected]);
40
40
  const rows = React.useMemo(() => flattenTree(nodes, expandedSet), [nodes, expandedSet]);
@@ -220,18 +220,26 @@ function TreeView({ nodes, expanded, onExpandedChange, selected, onSelectedChang
220
220
  tabIndex: node.id === tabStopId ? 0 : -1,
221
221
  "data-state": isSelected ? "selected" : void 0,
222
222
  style: { paddingInlineStart: `${(row.level - 1) * 12 + 4}px` },
223
- className: cn("flex h-7 shrink-0 cursor-default items-center gap-1 rounded-sm pe-2 outline-none group-data-[density=compact]/tree:h-6", "hover:bg-muted/70 data-[state=selected]:bg-brand-soft/70 data-[state=selected]:text-foreground", "focus-visible:shadow-[inset_0_0_0_1px_var(--ring)] aria-disabled:opacity-50"),
223
+ className: cn("relative flex h-7 shrink-0 cursor-default items-center gap-1 rounded-sm pe-2 outline-none group-data-[density=compact]/tree:h-6", "hover:bg-muted/70 data-[state=selected]:bg-brand-soft/70 data-[state=selected]:text-foreground", "focus-visible:shadow-[inset_0_0_0_1px_var(--ring)] aria-disabled:opacity-50", node.className),
224
224
  onFocus: () => setFocusedId(node.id),
225
225
  onClick: (event) => {
226
226
  if (isTypingTarget(event.target)) return;
227
227
  select(node.id, event.shiftKey ? "range" : event.metaKey || event.ctrlKey ? "toggle" : "replace");
228
- if (!event.shiftKey && !event.metaKey && !event.ctrlKey && row.expandable && selectionMode === "single") setExpanded(row, !row.expanded);
228
+ const plain = !event.shiftKey && !event.metaKey && !event.ctrlKey;
229
+ if (plain && row.expandable && (expandOnClick ?? selectionMode === "single")) setExpanded(row, !row.expanded);
230
+ if (plain && !row.expandable && actionOnClick && !node.disabled) onAction?.(node.id);
229
231
  },
230
232
  onDoubleClick: (event) => {
231
233
  if (!isTypingTarget(event.target) && !node.disabled) onAction?.(node.id);
232
234
  },
233
235
  onContextMenu: onRowContextMenu ? (event) => onRowContextMenu(node.id, event) : void 0,
234
236
  children: [
237
+ indentGuides && Array.from({ length: row.level - 1 }, (_, level) => /* @__PURE__ */ jsx("span", {
238
+ "aria-hidden": true,
239
+ "data-slot": "tree-guide",
240
+ style: { insetInlineStart: `${level * 12 + 12}px` },
241
+ className: "pointer-events-none absolute inset-y-0 w-px bg-border opacity-0 transition-opacity group-hover/tree:opacity-100"
242
+ }, level)),
235
243
  /* @__PURE__ */ jsx("span", {
236
244
  "aria-hidden": true,
237
245
  className: "flex size-4 shrink-0 items-center justify-center text-muted-foreground",
@@ -1 +1 @@
1
- {"version":3,"file":"tree-view.js","names":[],"sources":["../../src/components/tree-view.tsx"],"sourcesContent":["import ChevronRight from '@burtson-labs/icons/react/chevron-right';\nimport * as React from 'react';\n\nimport { cn } from '../lib/utils';\n\nimport { Spinner } from './spinner';\n\nexport interface TreeNode {\n /** Stable identity. Keep it across renders (a path, a database id). */\n id: string;\n /** Plain text: the accessible name and the typeahead key. */\n label: string;\n icon?: React.ReactNode;\n /** Undefined: a leaf, unless `hasChildren` says the children load later. */\n children?: TreeNode[];\n /** Expandable before its children are known; expanding calls onLoadChildren. */\n hasChildren?: boolean;\n /** Children are being fetched; shows a loading row while expanded. */\n loading?: boolean;\n disabled?: boolean;\n /** Trailing detail, such as a git status letter or a count. */\n meta?: React.ReactNode;\n}\n\nexport interface TreeViewProps extends Omit<\n React.ComponentProps<'div'>,\n 'children' | 'onSelect' | 'aria-label'\n> {\n nodes: TreeNode[];\n /** Required: what the tree holds, e.g. \"Files\". */\n 'aria-label': string;\n expanded: string[];\n onExpandedChange: (ids: string[]) => void;\n selected: string[];\n onSelectedChange: (ids: string[]) => void;\n /** `multiple`: Shift extends a range, Ctrl/⌘ toggles, Space toggles. */\n selectionMode?: 'single' | 'multiple';\n /** Move selection with focus on arrow keys (a file explorer); default off. */\n selectionFollowsFocus?: boolean;\n /** Enter or double-click: open the file, run the item. */\n onAction?: (id: string) => void;\n /** Called once when a node with `hasChildren` and no children expands. */\n onLoadChildren?: (id: string) => void;\n /** Replace the label, e.g. with a rename input. Keys typed in an input never move focus. */\n renderLabel?: (node: TreeNode) => React.ReactNode;\n /** `compact` 24px rows for desktop explorers, `default` 28px. */\n density?: 'compact' | 'default';\n /** Shown when `nodes` is empty. */\n empty?: React.ReactNode;\n /** Right-click or the context-menu key on a row. */\n onRowContextMenu?: (id: string, event: React.MouseEvent | React.KeyboardEvent) => void;\n}\n\ninterface Row {\n node: TreeNode;\n level: number;\n parentId: string | null;\n setSize: number;\n posInSet: number;\n expandable: boolean;\n expanded: boolean;\n}\n\nconst isExpandable = (n: TreeNode) => (n.children?.length ?? 0) > 0 || Boolean(n.hasChildren);\n\n/** The rows a person can see, in order, with the ARIA position data for each. */\nexport function flattenTree(nodes: TreeNode[], expanded: ReadonlySet<string>): Row[] {\n const rows: Row[] = [];\n const walk = (list: TreeNode[], level: number, parentId: string | null) => {\n list.forEach((node, i) => {\n const expandable = isExpandable(node);\n const open = expandable && expanded.has(node.id);\n rows.push({\n node,\n level,\n parentId,\n setSize: list.length,\n posInSet: i + 1,\n expandable,\n expanded: open,\n });\n if (open && node.children) walk(node.children, level + 1, node.id);\n });\n };\n walk(nodes, 1, null);\n return rows;\n}\n\nconst isTypingTarget = (target: EventTarget | null) =>\n target instanceof HTMLElement &&\n (target.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(target.tagName));\n\n/**\n * A file-explorer style tree. Everything is controlled: the app owns which\n * nodes are expanded and selected, and file operations are callbacks. Rows\n * render flat (role=\"treeitem\" with aria-level), one tab stop for the tree,\n * arrows to move, Right/Left to open and close, Home/End, typeahead.\n */\nfunction TreeView({\n nodes,\n expanded,\n onExpandedChange,\n selected,\n onSelectedChange,\n selectionMode = 'single',\n selectionFollowsFocus = false,\n onAction,\n onLoadChildren,\n renderLabel,\n density = 'default',\n empty,\n onRowContextMenu,\n className,\n ...props\n}: TreeViewProps) {\n const expandedSet = React.useMemo(() => new Set(expanded), [expanded]);\n const selectedSet = React.useMemo(() => new Set(selected), [selected]);\n const rows = React.useMemo(() => flattenTree(nodes, expandedSet), [nodes, expandedSet]);\n const index = React.useMemo(() => new Map(rows.map((r, i) => [r.node.id, i])), [rows]);\n\n const [focusedId, setFocusedId] = React.useState<string | null>(null);\n const anchorId = React.useRef<string | null>(null);\n const rowRefs = React.useRef(new Map<string, HTMLDivElement>());\n const treeRef = React.useRef<HTMLDivElement>(null);\n const hadFocus = React.useRef(false);\n const lastIds = React.useRef<string[]>([]);\n const lastParents = React.useRef(new Map<string, string | null>());\n const typeahead = React.useRef({ text: '', at: 0 });\n\n // The tab stop: the focused row if it is still visible, else the first\n // selected visible row, else the first row.\n const tabStopId =\n (focusedId && index.has(focusedId) ? focusedId : null) ??\n rows.find((r) => selectedSet.has(r.node.id))?.node.id ??\n rows[0]?.node.id ??\n null;\n\n const focusRow = React.useCallback((id: string) => {\n setFocusedId(id);\n rowRefs.current.get(id)?.focus();\n rowRefs.current.get(id)?.scrollIntoView?.({ block: 'nearest' });\n }, []);\n\n // Focus recovery: when the focused row disappears (deleted, or a parent\n // collapsed), move to its nearest visible ancestor, else the row now at its\n // old position. Only takes DOM focus if the tree had it.\n React.useLayoutEffect(() => {\n if (focusedId && !index.has(focusedId)) {\n let next: string | null = null;\n let parent = lastParents.current.get(focusedId) ?? null;\n while (parent && !index.has(parent)) parent = lastParents.current.get(parent) ?? null;\n const was = Math.max(0, lastIds.current.indexOf(focusedId));\n next = parent ?? rows[Math.min(was, rows.length - 1)]?.node.id ?? null;\n setFocusedId(next);\n const active = document.activeElement;\n if (next && hadFocus.current && (!active || active === document.body))\n rowRefs.current.get(next)?.focus();\n }\n lastIds.current = rows.map((r) => r.node.id);\n lastParents.current = new Map(rows.map((r) => [r.node.id, r.parentId]));\n }, [rows, index, focusedId]);\n\n const setExpanded = (row: Row, open: boolean) => {\n if (!row.expandable || row.expanded === open) return;\n const id = row.node.id;\n onExpandedChange(open ? [...expanded, id] : expanded.filter((e) => e !== id));\n if (open && !row.node.children && row.node.hasChildren) onLoadChildren?.(id);\n };\n\n const selectRange = (toId: string) => {\n const from = index.get(anchorId.current ?? toId) ?? 0;\n const to = index.get(toId) ?? 0;\n const [a, b] = from < to ? [from, to] : [to, from];\n onSelectedChange(\n rows\n .slice(a, b + 1)\n .filter((r) => !r.node.disabled)\n .map((r) => r.node.id),\n );\n };\n\n const select = (id: string, mode: 'replace' | 'toggle' | 'range') => {\n if (rows[index.get(id) ?? -1]?.node.disabled) return;\n if (selectionMode === 'single' || mode === 'replace') {\n anchorId.current = id;\n onSelectedChange([id]);\n } else if (mode === 'toggle') {\n anchorId.current = id;\n onSelectedChange(selectedSet.has(id) ? selected.filter((s) => s !== id) : [...selected, id]);\n } else selectRange(id);\n };\n\n const moveTo = (i: number, extend: boolean) => {\n const row = rows[Math.max(0, Math.min(rows.length - 1, i))];\n if (!row) return;\n focusRow(row.node.id);\n if (selectionMode === 'multiple' && extend) selectRange(row.node.id);\n else if (selectionFollowsFocus && !row.node.disabled) select(row.node.id, 'replace');\n };\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n props.onKeyDown?.(event);\n if (event.defaultPrevented || isTypingTarget(event.target)) return;\n const id = tabStopId;\n if (!id) return;\n const i = index.get(id) ?? 0;\n const row = rows[i];\n if (!row) return;\n const mod = event.metaKey || event.ctrlKey;\n let handled = true;\n switch (event.key) {\n case 'ArrowDown':\n moveTo(i + 1, event.shiftKey);\n break;\n case 'ArrowUp':\n moveTo(i - 1, event.shiftKey);\n break;\n case 'Home':\n moveTo(0, event.shiftKey);\n break;\n case 'End':\n moveTo(rows.length - 1, event.shiftKey);\n break;\n case 'ArrowRight':\n if (row.expandable && !row.expanded) setExpanded(row, true);\n else if (row.expanded && rows[i + 1]?.parentId === row.node.id)\n moveTo(i + 1, event.shiftKey);\n break;\n case 'ArrowLeft':\n if (row.expanded) setExpanded(row, false);\n else if (row.parentId) moveTo(index.get(row.parentId) ?? i, event.shiftKey);\n break;\n case 'Enter':\n if (row.node.disabled) break;\n select(row.node.id, 'replace');\n onAction?.(row.node.id);\n break;\n case ' ':\n select(\n row.node.id,\n selectionMode === 'multiple' ? (event.shiftKey ? 'range' : 'toggle') : 'replace',\n );\n break;\n case 'a':\n if (mod && selectionMode === 'multiple') {\n onSelectedChange(rows.filter((r) => !r.node.disabled).map((r) => r.node.id));\n } else handled = false;\n break;\n case 'ContextMenu':\n onRowContextMenu?.(row.node.id, event);\n break;\n default:\n handled = false;\n }\n if (!handled && event.key.length === 1 && !mod && !event.altKey) {\n // Typeahead: jump to the next row whose label starts with what was typed.\n const now = event.timeStamp;\n const t = typeahead.current;\n t.text = now - t.at > 600 ? event.key : t.text + event.key;\n t.at = now;\n const query = t.text.toLowerCase();\n const start = t.text.length === 1 ? i + 1 : i;\n for (let k = 0; k < rows.length; k++) {\n const r = rows[(start + k) % rows.length];\n if (r && r.node.label.toLowerCase().startsWith(query)) {\n moveTo(index.get(r.node.id) ?? 0, false);\n break;\n }\n }\n handled = true;\n }\n if (handled) {\n event.preventDefault();\n event.stopPropagation();\n }\n };\n\n if (rows.length === 0 && empty) {\n return (\n <div data-slot=\"tree-view\" data-empty className={cn('text-[13px]', className)} {...props}>\n {empty}\n </div>\n );\n }\n\n return (\n <div\n ref={treeRef}\n role=\"tree\"\n tabIndex={-1}\n data-slot=\"tree-view\"\n data-density={density}\n aria-multiselectable={selectionMode === 'multiple' || undefined}\n className={cn('group/tree flex flex-col py-1 text-[13px] select-none', className)}\n {...props}\n onKeyDown={onKeyDown}\n onFocus={(event) => {\n hadFocus.current = true;\n // Focus landing on the tree itself (a click on empty space) goes to the tab stop.\n if (event.target === event.currentTarget && tabStopId)\n rowRefs.current.get(tabStopId)?.focus();\n props.onFocus?.(event);\n }}\n onBlur={(event) => {\n if (!treeRef.current?.contains(event.relatedTarget)) hadFocus.current = false;\n props.onBlur?.(event);\n }}\n >\n {rows.map((row) => {\n const { node } = row;\n const isSelected = selectedSet.has(node.id);\n return (\n <React.Fragment key={node.id}>\n {/* Keys are handled once on the tree, for whichever row has focus. */}\n {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events */}\n <div\n ref={(el) => {\n if (el) rowRefs.current.set(node.id, el);\n else rowRefs.current.delete(node.id);\n }}\n role=\"treeitem\"\n data-slot=\"tree-item\"\n data-id={node.id}\n aria-level={row.level}\n aria-setsize={row.setSize}\n aria-posinset={row.posInSet}\n aria-expanded={row.expandable ? row.expanded : undefined}\n aria-selected={isSelected}\n aria-disabled={node.disabled || undefined}\n aria-busy={(row.expanded && node.loading) || undefined}\n aria-label={node.label}\n tabIndex={node.id === tabStopId ? 0 : -1}\n data-state={isSelected ? 'selected' : undefined}\n style={{ paddingInlineStart: `${(row.level - 1) * 12 + 4}px` }}\n className={cn(\n 'flex h-7 shrink-0 cursor-default items-center gap-1 rounded-sm pe-2 outline-none group-data-[density=compact]/tree:h-6',\n 'hover:bg-muted/70 data-[state=selected]:bg-brand-soft/70 data-[state=selected]:text-foreground',\n 'focus-visible:shadow-[inset_0_0_0_1px_var(--ring)] aria-disabled:opacity-50',\n )}\n onFocus={() => setFocusedId(node.id)}\n onClick={(event) => {\n if (isTypingTarget(event.target)) return;\n select(\n node.id,\n event.shiftKey ? 'range' : event.metaKey || event.ctrlKey ? 'toggle' : 'replace',\n );\n if (\n !event.shiftKey &&\n !event.metaKey &&\n !event.ctrlKey &&\n row.expandable &&\n selectionMode === 'single'\n )\n setExpanded(row, !row.expanded);\n }}\n onDoubleClick={(event) => {\n if (!isTypingTarget(event.target) && !node.disabled) onAction?.(node.id);\n }}\n onContextMenu={\n onRowContextMenu ? (event) => onRowContextMenu(node.id, event) : undefined\n }\n >\n {/* A pointer shortcut only: Right and Left expand and collapse from the keyboard. */}\n <span\n aria-hidden\n className=\"flex size-4 shrink-0 items-center justify-center text-muted-foreground\"\n onClick={(event) => {\n if (!row.expandable) return;\n event.stopPropagation();\n setExpanded(row, !row.expanded);\n }}\n >\n {row.expandable && (\n <ChevronRight\n className={cn(\n 'size-3.5 motion-safe:transition-transform',\n row.expanded && 'rotate-90',\n )}\n />\n )}\n </span>\n {node.icon && (\n <span aria-hidden className=\"flex shrink-0 text-muted-foreground [&_svg]:size-4\">\n {node.icon}\n </span>\n )}\n <span className=\"min-w-0 flex-1 truncate\">\n {renderLabel ? renderLabel(node) : node.label}\n </span>\n {node.meta && (\n <span className=\"shrink-0 text-xs text-muted-foreground\">{node.meta}</span>\n )}\n </div>\n {row.expanded && node.loading && !node.children?.length && (\n <div\n role=\"presentation\"\n data-slot=\"tree-loading\"\n style={{ paddingInlineStart: `${row.level * 12 + 8}px` }}\n className=\"flex h-7 items-center gap-2 text-muted-foreground group-data-[density=compact]/tree:h-6\"\n >\n <Spinner className=\"size-3.5\" label={`Loading ${node.label}`} />\n <span aria-hidden>Loading…</span>\n </div>\n )}\n </React.Fragment>\n );\n })}\n </div>\n );\n}\n\nexport { Tree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IACA,gBAAgB,UAAU;KACxB,IAAI,CAAC,eAAe,MAAM,MAAM,KAAK,CAAC,KAAK,UAAU,WAAW,KAAK,EAAE;IACzE;IACA,eACE,oBAAoB,UAAU,iBAAiB,KAAK,IAAI,KAAK,IAAI,KAAA;IA5CrE,UAAA;KAgDE,oBAAC,QAAD;MACE,eAAA;MACA,WAAU;MACV,UAAU,UAAU;OAClB,IAAI,CAAC,IAAI,YAAY;OACrB,MAAM,gBAAgB;OACtB,YAAY,KAAK,CAAC,IAAI,QAAQ;MAChC;MAEC,UAAA,IAAI,cACH,oBAAC,cAAD,EACE,WAAW,GACT,6CACA,IAAI,YAAY,WAClB,EACD,CAAA;KAEC,CAAA;KACL,KAAK,QACJ,oBAAC,QAAD;MAAM,eAAA;MAAY,WAAU;MACzB,UAAA,KAAK;KACF,CAAA;KAER,oBAAC,QAAD;MAAM,WAAU;MACb,UAAA,cAAc,YAAY,IAAI,IAAI,KAAK;KACpC,CAAA;KACL,KAAK,QACJ,oBAAC,QAAD;MAAM,WAAU;MAA0C,UAAA,KAAK;KAAW,CAAA;IAEzE;GACJ,CAAA,GAAA,IAAI,YAAY,KAAK,WAAW,CAAC,KAAK,UAAU,UAC/C,qBAAC,OAAD;IACE,MAAK;IACL,aAAU;IACV,OAAO,EAAE,oBAAoB,GAAG,IAAI,QAAQ,KAAK,EAAE,IAAI;IACvD,WAAU;IAJZ,UAAA,CAME,oBAAC,SAAD;KAAS,WAAU;KAAW,OAAO,WAAW,KAAK;IAAU,CAAA,GAC/D,oBAAC,QAAD;KAAM,eAAA;KAAY,UAAA;IAAc,CAAA,CAC7B;GAEO,CAAA,CAAA,EAAA,GA5FK,KAAK,EA4FV;EAEpB,CAAC;CACE,CAAA;AAET"}
1
+ {"version":3,"file":"tree-view.js","names":[],"sources":["../../src/components/tree-view.tsx"],"sourcesContent":["import ChevronRight from '@burtson-labs/icons/react/chevron-right';\nimport * as React from 'react';\n\nimport { cn } from '../lib/utils';\n\nimport { Spinner } from './spinner';\n\nexport interface TreeNode {\n /** Stable identity. Keep it across renders (a path, a database id). */\n id: string;\n /** Plain text: the accessible name and the typeahead key. */\n label: string;\n icon?: React.ReactNode;\n /** Undefined: a leaf, unless `hasChildren` says the children load later. */\n children?: TreeNode[];\n /** Expandable before its children are known; expanding calls onLoadChildren. */\n hasChildren?: boolean;\n /** Children are being fetched; shows a loading row while expanded. */\n loading?: boolean;\n disabled?: boolean;\n /** Trailing detail, such as a git status letter or a count. */\n meta?: React.ReactNode;\n /** Extra classes on the row, for app states such as an ignored file or a highlight. */\n className?: string;\n}\n\nexport interface TreeViewProps extends Omit<\n React.ComponentProps<'div'>,\n 'children' | 'onSelect' | 'aria-label'\n> {\n nodes: TreeNode[];\n /** Required: what the tree holds, e.g. \"Files\". */\n 'aria-label': string;\n expanded: string[];\n onExpandedChange: (ids: string[]) => void;\n selected: string[];\n onSelectedChange: (ids: string[]) => void;\n /** `multiple`: Shift extends a range, Ctrl/⌘ toggles, Space toggles. */\n selectionMode?: 'single' | 'multiple';\n /** Move selection with focus on arrow keys (a file explorer); default off. */\n selectionFollowsFocus?: boolean;\n /** Enter or double-click: open the file, run the item. */\n onAction?: (id: string) => void;\n /**\n * A plain click on a row without children also runs `onAction`, the way a\n * file explorer opens a file on one click. Default off.\n */\n actionOnClick?: boolean;\n /**\n * A plain click on an expandable row toggles it. Defaults to on for single\n * selection; turn it on for a multi-select explorer, where Shift and Ctrl/⌘\n * clicks still only select.\n */\n expandOnClick?: boolean;\n /** Draw a line per ancestor level while the pointer is over the tree. */\n indentGuides?: boolean;\n /** Called once when a node with `hasChildren` and no children expands. */\n onLoadChildren?: (id: string) => void;\n /** Replace the label, e.g. with a rename input. Keys typed in an input never move focus. */\n renderLabel?: (node: TreeNode) => React.ReactNode;\n /** `compact` 24px rows for desktop explorers, `default` 28px. */\n density?: 'compact' | 'default';\n /** Shown when `nodes` is empty. */\n empty?: React.ReactNode;\n /** Right-click or the context-menu key on a row. */\n onRowContextMenu?: (id: string, event: React.MouseEvent | React.KeyboardEvent) => void;\n}\n\ninterface Row {\n node: TreeNode;\n level: number;\n parentId: string | null;\n setSize: number;\n posInSet: number;\n expandable: boolean;\n expanded: boolean;\n}\n\nconst isExpandable = (n: TreeNode) => (n.children?.length ?? 0) > 0 || Boolean(n.hasChildren);\n\n/** The rows a person can see, in order, with the ARIA position data for each. */\nexport function flattenTree(nodes: TreeNode[], expanded: ReadonlySet<string>): Row[] {\n const rows: Row[] = [];\n const walk = (list: TreeNode[], level: number, parentId: string | null) => {\n list.forEach((node, i) => {\n const expandable = isExpandable(node);\n const open = expandable && expanded.has(node.id);\n rows.push({\n node,\n level,\n parentId,\n setSize: list.length,\n posInSet: i + 1,\n expandable,\n expanded: open,\n });\n if (open && node.children) walk(node.children, level + 1, node.id);\n });\n };\n walk(nodes, 1, null);\n return rows;\n}\n\nconst isTypingTarget = (target: EventTarget | null) =>\n target instanceof HTMLElement &&\n (target.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(target.tagName));\n\n/**\n * A file-explorer style tree. Everything is controlled: the app owns which\n * nodes are expanded and selected, and file operations are callbacks. Rows\n * render flat (role=\"treeitem\" with aria-level), one tab stop for the tree,\n * arrows to move, Right/Left to open and close, Home/End, typeahead.\n */\nfunction TreeView({\n nodes,\n expanded,\n onExpandedChange,\n selected,\n onSelectedChange,\n selectionMode = 'single',\n selectionFollowsFocus = false,\n onAction,\n actionOnClick = false,\n expandOnClick,\n indentGuides = false,\n onLoadChildren,\n renderLabel,\n density = 'default',\n empty,\n onRowContextMenu,\n className,\n ...props\n}: TreeViewProps) {\n const expandedSet = React.useMemo(() => new Set(expanded), [expanded]);\n const selectedSet = React.useMemo(() => new Set(selected), [selected]);\n const rows = React.useMemo(() => flattenTree(nodes, expandedSet), [nodes, expandedSet]);\n const index = React.useMemo(() => new Map(rows.map((r, i) => [r.node.id, i])), [rows]);\n\n const [focusedId, setFocusedId] = React.useState<string | null>(null);\n const anchorId = React.useRef<string | null>(null);\n const rowRefs = React.useRef(new Map<string, HTMLDivElement>());\n const treeRef = React.useRef<HTMLDivElement>(null);\n const hadFocus = React.useRef(false);\n const lastIds = React.useRef<string[]>([]);\n const lastParents = React.useRef(new Map<string, string | null>());\n const typeahead = React.useRef({ text: '', at: 0 });\n\n // The tab stop: the focused row if it is still visible, else the first\n // selected visible row, else the first row.\n const tabStopId =\n (focusedId && index.has(focusedId) ? focusedId : null) ??\n rows.find((r) => selectedSet.has(r.node.id))?.node.id ??\n rows[0]?.node.id ??\n null;\n\n const focusRow = React.useCallback((id: string) => {\n setFocusedId(id);\n rowRefs.current.get(id)?.focus();\n rowRefs.current.get(id)?.scrollIntoView?.({ block: 'nearest' });\n }, []);\n\n // Focus recovery: when the focused row disappears (deleted, or a parent\n // collapsed), move to its nearest visible ancestor, else the row now at its\n // old position. Only takes DOM focus if the tree had it.\n React.useLayoutEffect(() => {\n if (focusedId && !index.has(focusedId)) {\n let next: string | null = null;\n let parent = lastParents.current.get(focusedId) ?? null;\n while (parent && !index.has(parent)) parent = lastParents.current.get(parent) ?? null;\n const was = Math.max(0, lastIds.current.indexOf(focusedId));\n next = parent ?? rows[Math.min(was, rows.length - 1)]?.node.id ?? null;\n setFocusedId(next);\n const active = document.activeElement;\n if (next && hadFocus.current && (!active || active === document.body))\n rowRefs.current.get(next)?.focus();\n }\n lastIds.current = rows.map((r) => r.node.id);\n lastParents.current = new Map(rows.map((r) => [r.node.id, r.parentId]));\n }, [rows, index, focusedId]);\n\n const setExpanded = (row: Row, open: boolean) => {\n if (!row.expandable || row.expanded === open) return;\n const id = row.node.id;\n onExpandedChange(open ? [...expanded, id] : expanded.filter((e) => e !== id));\n if (open && !row.node.children && row.node.hasChildren) onLoadChildren?.(id);\n };\n\n const selectRange = (toId: string) => {\n const from = index.get(anchorId.current ?? toId) ?? 0;\n const to = index.get(toId) ?? 0;\n const [a, b] = from < to ? [from, to] : [to, from];\n onSelectedChange(\n rows\n .slice(a, b + 1)\n .filter((r) => !r.node.disabled)\n .map((r) => r.node.id),\n );\n };\n\n const select = (id: string, mode: 'replace' | 'toggle' | 'range') => {\n if (rows[index.get(id) ?? -1]?.node.disabled) return;\n if (selectionMode === 'single' || mode === 'replace') {\n anchorId.current = id;\n onSelectedChange([id]);\n } else if (mode === 'toggle') {\n anchorId.current = id;\n onSelectedChange(selectedSet.has(id) ? selected.filter((s) => s !== id) : [...selected, id]);\n } else selectRange(id);\n };\n\n const moveTo = (i: number, extend: boolean) => {\n const row = rows[Math.max(0, Math.min(rows.length - 1, i))];\n if (!row) return;\n focusRow(row.node.id);\n if (selectionMode === 'multiple' && extend) selectRange(row.node.id);\n else if (selectionFollowsFocus && !row.node.disabled) select(row.node.id, 'replace');\n };\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n props.onKeyDown?.(event);\n if (event.defaultPrevented || isTypingTarget(event.target)) return;\n const id = tabStopId;\n if (!id) return;\n const i = index.get(id) ?? 0;\n const row = rows[i];\n if (!row) return;\n const mod = event.metaKey || event.ctrlKey;\n let handled = true;\n switch (event.key) {\n case 'ArrowDown':\n moveTo(i + 1, event.shiftKey);\n break;\n case 'ArrowUp':\n moveTo(i - 1, event.shiftKey);\n break;\n case 'Home':\n moveTo(0, event.shiftKey);\n break;\n case 'End':\n moveTo(rows.length - 1, event.shiftKey);\n break;\n case 'ArrowRight':\n if (row.expandable && !row.expanded) setExpanded(row, true);\n else if (row.expanded && rows[i + 1]?.parentId === row.node.id)\n moveTo(i + 1, event.shiftKey);\n break;\n case 'ArrowLeft':\n if (row.expanded) setExpanded(row, false);\n else if (row.parentId) moveTo(index.get(row.parentId) ?? i, event.shiftKey);\n break;\n case 'Enter':\n if (row.node.disabled) break;\n select(row.node.id, 'replace');\n onAction?.(row.node.id);\n break;\n case ' ':\n select(\n row.node.id,\n selectionMode === 'multiple' ? (event.shiftKey ? 'range' : 'toggle') : 'replace',\n );\n break;\n case 'a':\n if (mod && selectionMode === 'multiple') {\n onSelectedChange(rows.filter((r) => !r.node.disabled).map((r) => r.node.id));\n } else handled = false;\n break;\n case 'ContextMenu':\n onRowContextMenu?.(row.node.id, event);\n break;\n default:\n handled = false;\n }\n if (!handled && event.key.length === 1 && !mod && !event.altKey) {\n // Typeahead: jump to the next row whose label starts with what was typed.\n const now = event.timeStamp;\n const t = typeahead.current;\n t.text = now - t.at > 600 ? event.key : t.text + event.key;\n t.at = now;\n const query = t.text.toLowerCase();\n const start = t.text.length === 1 ? i + 1 : i;\n for (let k = 0; k < rows.length; k++) {\n const r = rows[(start + k) % rows.length];\n if (r && r.node.label.toLowerCase().startsWith(query)) {\n moveTo(index.get(r.node.id) ?? 0, false);\n break;\n }\n }\n handled = true;\n }\n if (handled) {\n event.preventDefault();\n event.stopPropagation();\n }\n };\n\n if (rows.length === 0 && empty) {\n return (\n <div data-slot=\"tree-view\" data-empty className={cn('text-[13px]', className)} {...props}>\n {empty}\n </div>\n );\n }\n\n return (\n <div\n ref={treeRef}\n role=\"tree\"\n tabIndex={-1}\n data-slot=\"tree-view\"\n data-density={density}\n aria-multiselectable={selectionMode === 'multiple' || undefined}\n className={cn('group/tree flex flex-col py-1 text-[13px] select-none', className)}\n {...props}\n onKeyDown={onKeyDown}\n onFocus={(event) => {\n hadFocus.current = true;\n // Focus landing on the tree itself (a click on empty space) goes to the tab stop.\n if (event.target === event.currentTarget && tabStopId)\n rowRefs.current.get(tabStopId)?.focus();\n props.onFocus?.(event);\n }}\n onBlur={(event) => {\n if (!treeRef.current?.contains(event.relatedTarget)) hadFocus.current = false;\n props.onBlur?.(event);\n }}\n >\n {rows.map((row) => {\n const { node } = row;\n const isSelected = selectedSet.has(node.id);\n return (\n <React.Fragment key={node.id}>\n {/* Keys are handled once on the tree, for whichever row has focus. */}\n {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events */}\n <div\n ref={(el) => {\n if (el) rowRefs.current.set(node.id, el);\n else rowRefs.current.delete(node.id);\n }}\n role=\"treeitem\"\n data-slot=\"tree-item\"\n data-id={node.id}\n aria-level={row.level}\n aria-setsize={row.setSize}\n aria-posinset={row.posInSet}\n aria-expanded={row.expandable ? row.expanded : undefined}\n aria-selected={isSelected}\n aria-disabled={node.disabled || undefined}\n aria-busy={(row.expanded && node.loading) || undefined}\n aria-label={node.label}\n tabIndex={node.id === tabStopId ? 0 : -1}\n data-state={isSelected ? 'selected' : undefined}\n style={{ paddingInlineStart: `${(row.level - 1) * 12 + 4}px` }}\n className={cn(\n 'relative flex h-7 shrink-0 cursor-default items-center gap-1 rounded-sm pe-2 outline-none group-data-[density=compact]/tree:h-6',\n 'hover:bg-muted/70 data-[state=selected]:bg-brand-soft/70 data-[state=selected]:text-foreground',\n 'focus-visible:shadow-[inset_0_0_0_1px_var(--ring)] aria-disabled:opacity-50',\n node.className,\n )}\n onFocus={() => setFocusedId(node.id)}\n onClick={(event) => {\n if (isTypingTarget(event.target)) return;\n select(\n node.id,\n event.shiftKey ? 'range' : event.metaKey || event.ctrlKey ? 'toggle' : 'replace',\n );\n const plain = !event.shiftKey && !event.metaKey && !event.ctrlKey;\n if (plain && row.expandable && (expandOnClick ?? selectionMode === 'single'))\n setExpanded(row, !row.expanded);\n if (plain && !row.expandable && actionOnClick && !node.disabled)\n onAction?.(node.id);\n }}\n onDoubleClick={(event) => {\n if (!isTypingTarget(event.target) && !node.disabled) onAction?.(node.id);\n }}\n onContextMenu={\n onRowContextMenu ? (event) => onRowContextMenu(node.id, event) : undefined\n }\n >\n {indentGuides &&\n Array.from({ length: row.level - 1 }, (_, level) => (\n <span\n key={level}\n aria-hidden\n data-slot=\"tree-guide\"\n style={{ insetInlineStart: `${level * 12 + 12}px` }}\n className=\"pointer-events-none absolute inset-y-0 w-px bg-border opacity-0 transition-opacity group-hover/tree:opacity-100\"\n />\n ))}\n {/* A pointer shortcut only: Right and Left expand and collapse from the keyboard. */}\n <span\n aria-hidden\n className=\"flex size-4 shrink-0 items-center justify-center text-muted-foreground\"\n onClick={(event) => {\n if (!row.expandable) return;\n event.stopPropagation();\n setExpanded(row, !row.expanded);\n }}\n >\n {row.expandable && (\n <ChevronRight\n className={cn(\n 'size-3.5 motion-safe:transition-transform',\n row.expanded && 'rotate-90',\n )}\n />\n )}\n </span>\n {node.icon && (\n <span aria-hidden className=\"flex shrink-0 text-muted-foreground [&_svg]:size-4\">\n {node.icon}\n </span>\n )}\n <span className=\"min-w-0 flex-1 truncate\">\n {renderLabel ? renderLabel(node) : node.label}\n </span>\n {node.meta && (\n <span className=\"shrink-0 text-xs text-muted-foreground\">{node.meta}</span>\n )}\n </div>\n {row.expanded && node.loading && !node.children?.length && (\n <div\n role=\"presentation\"\n data-slot=\"tree-loading\"\n style={{ paddingInlineStart: `${row.level * 12 + 8}px` }}\n className=\"flex h-7 items-center gap-2 text-muted-foreground group-data-[density=compact]/tree:h-6\"\n >\n <Spinner className=\"size-3.5\" label={`Loading ${node.label}`} />\n <span aria-hidden>Loading…</span>\n </div>\n )}\n </React.Fragment>\n );\n })}\n </div>\n );\n}\n\nexport { TreeView };\n"],"mappings":";;;;;;AA8EA,IAAM,gBAAgB,OAAiB,EAAE,UAAU,UAAU,KAAK,KAAK,QAAQ,EAAE,WAAW;;AAG5F,SAAgB,YAAY,OAAmB,UAAsC;CACnF,MAAM,OAAc,CAAC;CACrB,MAAM,QAAQ,MAAkB,OAAe,aAA4B;EACzE,KAAK,SAAS,MAAM,MAAM;GACxB,MAAM,aAAa,aAAa,IAAI;GACpC,MAAM,OAAO,cAAc,SAAS,IAAI,KAAK,EAAE;GAC/C,KAAK,KAAK;IACR;IACA;IACA;IACA,SAAS,KAAK;IACd,UAAU,IAAI;IACd;IACA,UAAU;GACZ,CAAC;GACD,IAAI,QAAQ,KAAK,UAAU,KAAK,KAAK,UAAU,QAAQ,GAAG,KAAK,EAAE;EACnE,CAAC;CACH;CACA,KAAK,OAAO,GAAG,IAAI;CACnB,OAAO;AACT;AAEA,IAAM,kBAAkB,WACtB,kBAAkB,gBACjB,OAAO,qBAAqB,4BAA4B,KAAK,OAAO,OAAO;;;;;;;AAQ9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M,gBAAgB;OACtB,YAAY,KAAK,CAAC,IAAI,QAAQ;MAChC;MAEC,UAAA,IAAI,cACH,oBAAC,cAAD,EACE,WAAW,GACT,6CACA,IAAI,YAAY,WAClB,EACD,CAAA;KAEC,CAAA;KACL,KAAK,QACJ,oBAAC,QAAD;MAAM,eAAA;MAAY,WAAU;MACzB,UAAA,KAAK;KACF,CAAA;KAER,oBAAC,QAAD;MAAM,WAAU;MACb,UAAA,cAAc,YAAY,IAAI,IAAI,KAAK;KACpC,CAAA;KACL,KAAK,QACJ,oBAAC,QAAD;MAAM,WAAU;MAA0C,UAAA,KAAK;KAAW,CAAA;IAEzE;GACJ,CAAA,GAAA,IAAI,YAAY,KAAK,WAAW,CAAC,KAAK,UAAU,UAC/C,qBAAC,OAAD;IACE,MAAK;IACL,aAAU;IACV,OAAO,EAAE,oBAAoB,GAAG,IAAI,QAAQ,KAAK,EAAE,IAAI;IACvD,WAAU;IAJZ,UAAA,CAME,oBAAC,SAAD;KAAS,WAAU;KAAW,OAAO,WAAW,KAAK;IAAU,CAAA,GAC/D,oBAAC,QAAD;KAAM,eAAA;KAAY,UAAA;IAAc,CAAA,CAC7B;GAEO,CAAA,CAAA,EAAA,GApGK,KAAK,EAoGV;EAEpB,CAAC;CACE,CAAA;AAET"}
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export * from './components/accordion';
5
5
  export * from './components/alert';
6
6
  export * from './components/alert-dialog';
7
7
  export * from './components/app-shell';
8
+ export * from './components/attachment';
8
9
  export * from './components/avatar';
9
10
  export * from './components/badge';
10
11
  export * from './components/breadcrumb';
@@ -15,9 +16,11 @@ export * from './components/collapsible';
15
16
  export * from './components/combobox';
16
17
  export * from './components/command';
17
18
  export * from './components/composer';
19
+ export * from './components/connection-status';
18
20
  export * from './components/context-menu';
19
21
  export * from './components/conversation';
20
22
  export * from './components/copy-button';
23
+ export * from './components/data-table';
21
24
  export * from './components/dialog';
22
25
  export * from './components/dropdown-menu';
23
26
  export * from './components/editor-tabs';
@@ -30,6 +33,7 @@ export * from './components/label';
30
33
  export * from './components/markdown';
31
34
  export * from './components/menubar';
32
35
  export * from './components/message';
36
+ export * from './components/mobile-nav';
33
37
  export * from './components/navigation-menu';
34
38
  export * from './components/onboarding-checklist';
35
39
  export * from './components/page-header';
@@ -46,6 +50,7 @@ export * from './components/separator';
46
50
  export * from './components/sheet';
47
51
  export * from './components/skeleton';
48
52
  export * from './components/slider';
53
+ export * from './components/source';
49
54
  export * from './components/spinner';
50
55
  export * from './components/stat-card';
51
56
  export * from './components/status';