@columenlabs/lumen-ui 0.1.49 → 0.1.50

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.
@@ -24,7 +24,8 @@ export interface LumenDrawerProps {
24
24
  * edge, 320px to 60% by default. The sheet spans the screen so the resizable group has room; only
25
25
  * the handle and the drawer take the pointer, so a click beside it falls through to the overlay
26
26
  * and closes it (`!` beats the inline pointer-events Radix sets on a modal's content). Its body
27
- * holds DrawerSections; its footer is always there (actions on the right, Close by default).
27
+ * holds DrawerSections; its footer sits at the bottom (actions on the right, Close by default; on a
28
+ * phone it shows only when there are actions, as the sheet's X closes it).
28
29
  */
29
30
  export declare function LumenDrawer({ open, onClose, title, description, children, footer, footerStart, defaultSize, minSize, maxSize, }: LumenDrawerProps): import("react").JSX.Element;
30
31
  export {};
@@ -11,18 +11,19 @@ import { Sheet, SheetClose, SheetContent, SheetDescription, SheetHeader, SheetTi
11
11
  * edge, 320px to 60% by default. The sheet spans the screen so the resizable group has room; only
12
12
  * the handle and the drawer take the pointer, so a click beside it falls through to the overlay
13
13
  * and closes it (`!` beats the inline pointer-events Radix sets on a modal's content). Its body
14
- * holds DrawerSections; its footer is always there (actions on the right, Close by default).
14
+ * holds DrawerSections; its footer sits at the bottom (actions on the right, Close by default; on a
15
+ * phone it shows only when there are actions, as the sheet's X closes it).
15
16
  */
16
17
  export function LumenDrawer({ open, onClose, title, description, children, footer, footerStart, defaultSize = '32%', minSize = '320px', maxSize = '60%', }) {
17
18
  const isMobile = useIsMobile();
18
19
  const head = (_jsxs("div", { className: "flex min-w-0 flex-col gap-0.5", children: [_jsx(SheetTitle, { className: "truncate", children: title }), _jsx(SheetDescription, { className: description ? 'truncate text-muted-foreground text-xs' : 'sr-only', children: description ?? 'Details' })] }));
19
20
  const body = _jsx("div", { className: "flex flex-col px-4 pb-4", children: children });
20
- // Every drawer has a footer, styled like a dialog's: the body scrolls above
21
- // it and always ends on a clear edge. Without actions of its own it offers Close.
22
- // On a phone the drawer is a full screen and the footer a bar under the header, so the
23
- // keyboard never covers its actions (Dialog does the same).
24
- const foot = (_jsxs("footer", { "data-slot": "drawer-footer", className: "flex shrink-0 items-center gap-2 border-t bg-muted/50 px-4 py-2.5 max-md:order-first max-md:border-t-0 max-md:border-b", children: [footerStart && (_jsx("div", { className: "min-w-0 flex-1 truncate text-muted-foreground text-xs", children: footerStart })), _jsx("div", { className: "ml-auto flex items-center gap-2", children: footer ?? (_jsx(SheetClose, { asChild: true, children: _jsx(Button, { type: "button", size: "sm", variant: "outline", children: "Close" }) })) })] }));
25
- return (_jsx(Sheet, { open: open, onOpenChange: (o) => !o && onClose(), modal: isMobile, children: isMobile ? (_jsxs(SheetContent, { side: "bottom", className: "max-h-[85svh] gap-0 overflow-hidden", children: [_jsx(SheetHeader, { className: "order-first shrink-0 border-b", children: head }), _jsx("div", { className: "end-fade min-h-0 flex-1 overflow-y-auto pt-2", children: body }), foot] })) : (_jsx(SheetContent, { side: "right", showCloseButton: false,
21
+ // Every drawer ends on a footer, styled like a dialog's: the body scrolls above it and always
22
+ // ends on a clear edge. Without actions of its own it offers Close, except on a phone, where the
23
+ // sheet's X already closes it and a second Close only took room.
24
+ const plain = !footer && !footerStart;
25
+ const foot = (_jsxs("footer", { "data-slot": "drawer-footer", className: "flex shrink-0 items-center gap-2 border-t bg-muted/50 px-4 py-2.5", children: [footerStart && (_jsx("div", { className: "min-w-0 flex-1 truncate text-muted-foreground text-xs", children: footerStart })), _jsx("div", { className: "ml-auto flex items-center gap-2", children: footer ?? (_jsx(SheetClose, { asChild: true, children: _jsx(Button, { type: "button", size: "sm", variant: "outline", children: "Close" }) })) })] }));
26
+ return (_jsx(Sheet, { open: open, onOpenChange: (o) => !o && onClose(), modal: isMobile, children: isMobile ? (_jsxs(SheetContent, { side: "bottom", className: "max-h-[85svh] gap-0 overflow-hidden", children: [_jsx(SheetHeader, { className: "order-first shrink-0 border-b", children: head }), _jsx("div", { className: "min-h-0 flex-1 overflow-y-auto pt-2", children: body }), !plain && foot] })) : (_jsx(SheetContent, { side: "right", showCloseButton: false,
26
27
  // The resize handle's grab zone is wider than the handle, so a drag can start on the
27
28
  // overlay; the panels library marks that pointerdown handled, and then it doesn't close.
28
29
  onPointerDownOutside: (e) => e.detail.originalEvent.defaultPrevented && e.preventDefault(), className: "pointer-events-none! gap-0 border-0 bg-transparent shadow-none data-[side=right]:left-0 data-[side=right]:w-auto data-[side=right]:border-l-0 data-[side=right]:sm:max-w-none", children: _jsxs(ResizablePanelGroup, { orientation: "horizontal", children: [_jsx(ResizablePanel, { minSize: "40%" }), _jsx(ResizableHandle, { withHandle: true, className: "pointer-events-auto" }), _jsx(ResizablePanel, { defaultSize: defaultSize, minSize: minSize, maxSize: maxSize, "data-slot": "lumen-drawer", className: "pointer-events-auto bg-popover shadow-lg", children: _jsxs("section", { className: "flex h-full flex-col overflow-hidden", children: [_jsxs("header", { className: "flex shrink-0 items-center gap-2 border-b px-4 py-3", children: [head, _jsx(SheetClose, { asChild: true, children: _jsx(IconButton, { icon: XIcon, label: "Close", className: "ml-auto" }) })] }), _jsx("div", { className: "min-h-0 flex-1 overflow-y-auto pt-2", children: body }), foot] }) })] }) })) }));
package/dist/nav.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type ComponentType, type ReactNode } from 'react';
1
+ import type { ComponentType, ReactNode } from 'react';
2
2
  import { type AssistantPageType } from './assistant-screen.js';
3
3
  /** A nav icon: a lucide icon, or a view's emoji drawn at icon size. */
4
4
  export type NavIcon = ComponentType<{
package/dist/nav.js CHANGED
@@ -6,7 +6,6 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
6
6
  // the name, a click folds it, the fold is remembered in the browser, and `+` never folds.
7
7
  import { Link, useRouterState } from '@tanstack/react-router';
8
8
  import { ChevronRightIcon, PlusIcon, Trash2Icon } from 'lucide-react';
9
- import { useState } from 'react';
10
9
  import { useAssistantPages } from './assistant-screen.js';
11
10
  import { LumenConfirm } from './confirm.js';
12
11
  import { useFolded } from './fold.js';
@@ -67,8 +66,7 @@ function SectionRow({ item, activeId, onRemove, removeLabel, }) {
67
66
  const isActive = activeId === item.id;
68
67
  // The open item shows no trash icon.
69
68
  const remove = item.fixed || isActive ? undefined : onRemove;
70
- const [open, setOpen] = useState(Boolean(item.defaultOpen || subActive || isActive));
71
- const row = (_jsxs(_Fragment, { children: [_jsx(SidebarMenuButton, { asChild: true, tooltip: item.title, isActive: isActive, children: _jsxs(Link, { to: item.to, onClick: subs.length ? () => setOpen((o) => (isActive ? !o : true)) : undefined, children: [_jsx(item.icon, {}), _jsx("span", { children: item.title })] }) }), item.badge !== undefined && item.badge !== null && (_jsx(SidebarMenuBadge, { className: cn(SECTION_BADGE,
69
+ const row = (_jsxs(_Fragment, { children: [_jsx(SidebarMenuButton, { asChild: true, tooltip: item.title, isActive: isActive, children: _jsxs(Link, { to: item.to, children: [_jsx(item.icon, {}), _jsx("span", { children: item.title })] }) }), item.badge !== undefined && item.badge !== null && (_jsx(SidebarMenuBadge, { className: cn(SECTION_BADGE,
72
70
  // The remove icon shows on hover from md up, and always below it: make room there.
73
71
  remove &&
74
72
  'max-md:right-7 md:group-focus-within/menu-item:opacity-0 md:group-hover/menu-item:opacity-0'), children: item.badge })), remove && (_jsx(LumenConfirm, { title: `${removeLabel(item)}?`, action: "Remove", onConfirm: () => remove(item), children: _jsx(SidebarMenuAction, { showOnHover: true, "aria-label": removeLabel(item), title: removeLabel(item),
@@ -76,7 +74,7 @@ function SectionRow({ item, activeId, onRemove, removeLabel, }) {
76
74
  className: "text-muted-foreground peer-hover/menu-button:text-muted-foreground hover:bg-transparent hover:text-destructive", children: _jsx(Trash2Icon, {}) }) }))] }));
77
75
  if (!subs.length)
78
76
  return _jsx(SidebarMenuItem, { children: row });
79
- return (_jsx(Collapsible, { asChild: true, open: open, onOpenChange: setOpen, className: "group/collapsible", children: _jsxs(SidebarMenuItem, { children: [row, _jsx(CollapsibleTrigger, { asChild: true, children: _jsx(SidebarMenuAction, { "aria-label": `Show or hide ${item.title}`, className: "right-auto left-1.5 bg-sidebar opacity-0 group-hover/menu-item:opacity-100 focus-visible:opacity-100 peer-data-[active=true]/menu-button:bg-sidebar-accent [&>svg]:transition-transform data-[state=open]:[&>svg]:rotate-90", children: _jsx(ChevronRightIcon, {}) }) }), _jsx(CollapsibleContent, { children: _jsx(SidebarMenuSub, { className: "mr-0 pr-0", children: subs.map((sub) => {
77
+ return (_jsx(Collapsible, { asChild: true, defaultOpen: item.defaultOpen || subActive || isActive, className: "group/collapsible", children: _jsxs(SidebarMenuItem, { children: [row, _jsx(CollapsibleTrigger, { asChild: true, children: _jsx(SidebarMenuAction, { "aria-label": `Show or hide ${item.title}`, className: "right-auto left-1.5 bg-sidebar opacity-0 group-hover/menu-item:opacity-100 focus-visible:opacity-100 peer-data-[active=true]/menu-button:bg-sidebar-accent [&>svg]:transition-transform data-[state=open]:[&>svg]:rotate-90", children: _jsx(ChevronRightIcon, {}) }) }), _jsx(CollapsibleContent, { children: _jsx(SidebarMenuSub, { className: "mr-0 pr-0", children: subs.map((sub) => {
80
78
  const hasBadge = sub.badge !== undefined && sub.badge !== null;
81
79
  return (_jsxs(SidebarMenuSubItem, { children: [_jsx(SidebarMenuSubButton, { asChild: true, isActive: activeId === `${item.id}/${sub.id}`, className: cn(hasBadge && 'pr-8'), children: _jsxs(Link, { to: sub.to, title: sub.title, children: [sub.icon ? (_jsx("span", { "aria-hidden": true, className: "flex shrink-0 [&>svg]:size-4", style: { color: sub.color }, children: _jsx(sub.icon, {}) })) : (sub.color && (_jsx("span", { "aria-hidden": true, className: "mx-1 size-2 shrink-0 rounded-full", style: { background: sub.color } }))), _jsx("span", { children: sub.title })] }) }), hasBadge && (_jsx("span", { className: cn('pointer-events-none absolute top-1 right-1 flex h-5 min-w-5 items-center justify-center px-1 text-xs text-muted-foreground', typeof sub.badge === 'number' && 'num'), children: sub.badge }))] }, sub.id));
82
80
  }) }) })] }) }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@columenlabs/lumen-ui",
3
- "version": "0.1.49",
3
+ "version": "0.1.50",
4
4
  "description": "Lumen: shared React components (frame, views, widgets, charts, drawers).",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -41,7 +41,7 @@
41
41
  "@codemirror/lang-javascript": "6.2.5",
42
42
  "@codemirror/lang-json": "6.0.2",
43
43
  "@codemirror/lang-sql": "6.10.0",
44
- "@columenlabs/lumen-ui-types": "0.1.49",
44
+ "@columenlabs/lumen-ui-types": "0.1.50",
45
45
  "@dnd-kit/core": "6.3.1",
46
46
  "@dnd-kit/sortable": "10.0.0",
47
47
  "@dnd-kit/utilities": "3.2.2",