@tristan2828/ui-foundation 4.95.0 → 4.97.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 (59) hide show
  1. package/conventions/AGENTS.md +1 -1
  2. package/conventions/docs/add-an-entity.md +46 -25
  3. package/conventions/docs/cell-patterns.md +61 -57
  4. package/conventions/docs/design-language.md +91 -42
  5. package/conventions/docs/reminders.md +2 -2
  6. package/conventions/docs/timed-screens.md +1 -1
  7. package/dist/components/app/action-error.js +1 -1
  8. package/dist/components/app/allow-reminders.js +1 -1
  9. package/dist/components/app/app-shell.js +4 -4
  10. package/dist/components/app/board.js +1 -1
  11. package/dist/components/app/choice-buttons.js +6 -1
  12. package/dist/components/app/data-table-tools.js +2 -2
  13. package/dist/components/app/data-table.js +4 -4
  14. package/dist/components/app/date-field.js +1 -1
  15. package/dist/components/app/delete-action.d.ts +16 -3
  16. package/dist/components/app/delete-action.js +21 -4
  17. package/dist/components/app/emoji-field-data.js +7 -7
  18. package/dist/components/app/empty-value.d.ts +10 -3
  19. package/dist/components/app/empty-value.js +3 -8
  20. package/dist/components/app/entity-form.js +1 -1
  21. package/dist/components/app/entity-view.js +5 -5
  22. package/dist/components/app/error-state.js +1 -1
  23. package/dist/components/app/field-rows.js +6 -3
  24. package/dist/components/app/fill-in-queue.js +2 -2
  25. package/dist/components/app/filter-bar.js +1 -1
  26. package/dist/components/app/form-dialog.js +1 -1
  27. package/dist/components/app/form-section.d.ts +1 -1
  28. package/dist/components/app/image-field.js +3 -2
  29. package/dist/components/app/list-header.js +2 -2
  30. package/dist/components/app/milkdown-editor.js +4 -4
  31. package/dist/components/app/module-card.js +2 -1
  32. package/dist/components/app/month-day-field.js +3 -3
  33. package/dist/components/app/multi-pick.js +1 -1
  34. package/dist/components/app/needs-you.js +1 -1
  35. package/dist/components/app/notes-outline.js +1 -1
  36. package/dist/components/app/overview-page.js +2 -1
  37. package/dist/components/app/password-input.js +1 -1
  38. package/dist/components/app/record-dialog.js +1 -1
  39. package/dist/components/app/rich-text-format-items.js +6 -6
  40. package/dist/components/app/rich-text-highlight-menu.js +1 -1
  41. package/dist/components/app/rich-text-table-grips.js +16 -16
  42. package/dist/components/app/rich-text-toolbar.js +2 -2
  43. package/dist/components/app/rich-text-widgets.js +2 -2
  44. package/dist/components/app/secondary-filters.js +2 -2
  45. package/dist/components/app/session-view.js +1 -1
  46. package/dist/components/app/timeline.js +1 -1
  47. package/dist/components/app/value-list.js +2 -1
  48. package/dist/components/app/widget-card.js +2 -1
  49. package/dist/components/app/widget-layout-sheet.js +1 -1
  50. package/dist/components/ui/combobox.js +1 -1
  51. package/dist/components/ui/dialog.js +1 -1
  52. package/dist/index.d.ts +4 -1
  53. package/dist/index.js +5 -0
  54. package/dist/lib/group-by-day.js +2 -2
  55. package/dist/lib/title-case.d.ts +13 -0
  56. package/dist/lib/title-case.js +66 -0
  57. package/dist/routes/login.js +4 -4
  58. package/dist/routes/register.js +1 -1
  59. package/package.json +1 -1
@@ -57,7 +57,7 @@ const primary = useRef<HTMLButtonElement>(null)
57
57
 
58
58
  - **The title is required.** It names the dialog for screen readers and
59
59
  heads the view. The header also holds Close and, with
60
- `fullscreenControl`, a "Full screen" toggle.
60
+ `fullscreenControl`, a "Full Screen" toggle.
61
61
  - **Real fullscreen** asks the browser to take the whole screen too
62
62
  (hiding its own bars). Where the browser can't (iOS Safari on a phone),
63
63
  the control isn't shown. The view already covers the page. Closing the
@@ -11,5 +11,5 @@ import { Button } from '../ui/button.js';
11
11
  import { Spinner } from '../ui/spinner.js';
12
12
  import { Notice } from './notice.js';
13
13
  export function ActionError({ action, title, className }) {
14
- return (_jsx("div", { role: "status", "data-slot": "action-error", className: cn('empty:hidden', className), children: action.error && (_jsx(Notice, { tone: "destructive", title: title, action: _jsxs(Button, { type: "button", size: "sm", variant: "outline", disabled: action.pending, onClick: () => void action.retry(), children: [action.pending && _jsx(Spinner, { className: "size-4" }), "Try again"] }), children: action.error })) }));
14
+ return (_jsx("div", { role: "status", "data-slot": "action-error", className: cn('empty:hidden', className), children: action.error && (_jsx(Notice, { tone: "destructive", title: title, action: _jsxs(Button, { type: "button", size: "sm", variant: "outline", disabled: action.pending, onClick: () => void action.retry(), children: [action.pending && _jsx(Spinner, { className: "size-4" }), "Try Again"] }), children: action.error })) }));
15
15
  }
@@ -7,5 +7,5 @@ import { Notice } from './notice.js';
7
7
  const DEFAULT_DESCRIPTION = 'Get a notification on this device at the times you set, even when the app is closed. Your browser will ask first.';
8
8
  export function AllowReminders({ push, description = DEFAULT_DESCRIPTION, className }) {
9
9
  const { status, pending, error } = push;
10
- return (_jsxs("div", { "data-slot": "allow-reminders", className: cn('flex flex-col gap-3', className), "aria-busy": status === undefined || pending, children: [status === undefined && _jsx(Skeleton, { className: "h-9 w-full max-w-md" }), status === 'off' && (_jsxs(_Fragment, { children: [_jsx("p", { className: "text-sm text-foreground", children: description }), _jsx("div", { children: _jsxs(Button, { onClick: push.enable, disabled: pending, children: [_jsx(BellIcon, { "aria-hidden": "true" }), pending ? 'Turning on…' : 'Allow reminders'] }) })] })), status === 'on' && (_jsx(Notice, { tone: "success", icon: BellIcon, action: _jsxs(Button, { size: "sm", variant: "outline", onClick: push.disable, disabled: pending, children: [_jsx(BellOffIcon, { "aria-hidden": "true" }), pending ? 'Turning off…' : 'Turn off'] }), children: "Reminders are on for this device." })), status === 'needs-install' && (_jsx(Notice, { title: "Add the app to your Home Screen first", children: "On iPhone and iPad, reminders work in the app from the Home Screen. Tap Share, then Add to Home Screen, open the app from there and allow reminders." })), status === 'blocked' && (_jsx(Notice, { tone: "warning", title: "Notifications are blocked", icon: BellOffIcon, children: "This browser was told not to show this app\u2019s notifications. Allow them in the site\u2019s settings (the icon beside the address), then reload." })), status === 'unsupported' && (_jsx("p", { className: "text-sm text-muted-foreground", children: "This browser can\u2019t show reminders." })), status === 'mock' && (_jsx("p", { className: "text-sm text-muted-foreground", children: "Reminders need the real backend: with mock data nothing can send them." })), error && (_jsx("p", { role: "alert", className: "text-sm text-destructive-text", children: error }))] }));
10
+ return (_jsxs("div", { "data-slot": "allow-reminders", className: cn('flex flex-col gap-3', className), "aria-busy": status === undefined || pending, children: [status === undefined && _jsx(Skeleton, { className: "h-9 w-full max-w-md" }), status === 'off' && (_jsxs(_Fragment, { children: [_jsx("p", { className: "text-sm text-foreground", children: description }), _jsx("div", { children: _jsxs(Button, { onClick: push.enable, disabled: pending, children: [_jsx(BellIcon, { "aria-hidden": "true" }), pending ? 'Turning on…' : 'Allow Reminders'] }) })] })), status === 'on' && (_jsx(Notice, { tone: "success", icon: BellIcon, action: _jsxs(Button, { size: "sm", variant: "outline", onClick: push.disable, disabled: pending, children: [_jsx(BellOffIcon, { "aria-hidden": "true" }), pending ? 'Turning off…' : 'Turn Off'] }), children: "Reminders are on for this device." })), status === 'needs-install' && (_jsx(Notice, { title: "Add the app to your Home Screen first", children: "On iPhone and iPad, reminders work in the app from the Home Screen. Tap Share, then Add to Home Screen, open the app from there and allow reminders." })), status === 'blocked' && (_jsx(Notice, { tone: "warning", title: "Notifications are blocked", icon: BellOffIcon, children: "This browser was told not to show this app\u2019s notifications. Allow them in the site\u2019s settings (the icon beside the address), then reload." })), status === 'unsupported' && (_jsx("p", { className: "text-sm text-muted-foreground", children: "This browser can\u2019t show reminders." })), status === 'mock' && (_jsx("p", { className: "text-sm text-muted-foreground", children: "Reminders need the real backend: with mock data nothing can send them." })), error && (_jsx("p", { role: "alert", className: "text-sm text-destructive-text", children: error }))] }));
11
11
  }
@@ -69,10 +69,10 @@ function PaletteSwatch({ name }) {
69
69
  function LookMenu({ palette }) {
70
70
  const { setPalette } = usePalette();
71
71
  const { rows, picker: pickRows, setRows } = useRows();
72
- return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { render: _jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": palette ? `Palette: ${PALETTE_LABELS[palette]}` : `Rows: ${ROWS_LABELS[rows]}` }), children: palette ? _jsx(PaletteIcon, {}) : _jsx(Rows3Icon, {}) }), _jsxs(DropdownMenuContent, { align: "end", className: "w-60", children: [palette && (_jsxs(DropdownMenuGroup, { children: [_jsx(DropdownMenuLabel, { children: "Palette on this device" }), _jsx(DropdownMenuRadioGroup, { value: palette, onValueChange: (next) => {
72
+ return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { render: _jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": palette ? `Palette: ${PALETTE_LABELS[palette]}` : `Rows: ${ROWS_LABELS[rows]}` }), children: palette ? _jsx(PaletteIcon, {}) : _jsx(Rows3Icon, {}) }), _jsxs(DropdownMenuContent, { align: "end", className: "w-60", children: [palette && (_jsxs(DropdownMenuGroup, { children: [_jsx(DropdownMenuLabel, { children: "Palette on This Device" }), _jsx(DropdownMenuRadioGroup, { value: palette, onValueChange: (next) => {
73
73
  if (isPaletteName(next))
74
74
  setPalette(next);
75
- }, children: PALETTES.map((name) => (_jsxs(DropdownMenuRadioItem, { value: name, children: [_jsx(PaletteSwatch, { name: name }), PALETTE_LABELS[name]] }, name))) })] })), palette && pickRows && _jsx(DropdownMenuSeparator, {}), pickRows && (_jsxs(DropdownMenuGroup, { children: [_jsx(DropdownMenuLabel, { children: "Rows on this device" }), _jsx(DropdownMenuRadioGroup, { value: rows, onValueChange: (next) => {
75
+ }, children: PALETTES.map((name) => (_jsxs(DropdownMenuRadioItem, { value: name, children: [_jsx(PaletteSwatch, { name: name }), PALETTE_LABELS[name]] }, name))) })] })), palette && pickRows && _jsx(DropdownMenuSeparator, {}), pickRows && (_jsxs(DropdownMenuGroup, { children: [_jsx(DropdownMenuLabel, { children: "Rows on This Device" }), _jsx(DropdownMenuRadioGroup, { value: rows, onValueChange: (next) => {
76
76
  if (isRowsName(next))
77
77
  setRows(next);
78
78
  }, children: ROWS.map((name) => (_jsx(DropdownMenuRadioItem, { value: name, children: ROWS_LABELS[name] }, name))) })] }))] })] }));
@@ -80,7 +80,7 @@ function LookMenu({ palette }) {
80
80
  function ThemeToggle() {
81
81
  const { resolvedTheme, setTheme } = useTheme();
82
82
  const isDark = resolvedTheme === 'dark';
83
- return (_jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": "Toggle dark mode", onClick: () => setTheme(isDark ? 'light' : 'dark'), children: isDark ? _jsx(SunIcon, {}) : _jsx(MoonIcon, {}) }));
83
+ return (_jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": "Toggle Dark Mode", onClick: () => setTheme(isDark ? 'light' : 'dark'), children: isDark ? _jsx(SunIcon, {}) : _jsx(MoonIcon, {}) }));
84
84
  }
85
85
  // Hidden on the icon rail, like the user's name beside it.
86
86
  function VersionEntry({ version }) {
@@ -230,7 +230,7 @@ export function AppShell({ title, logo: Logo, nav, sidebarExtra, defaultSidebarO
230
230
  const trail = ownTrail ?? navTrail(nav, location.pathname);
231
231
  const groups = navGroups(nav);
232
232
  const renderGroup = (group, groupIndex) => group.collapsible && group.label !== undefined ? (_jsx(CollapsibleNavGroup, { group: { ...group, label: group.label }, activeTo: activeTo }, `${group.placement ?? 'top'}:${groupIndex}:${group.label}`)) : (_jsxs(SidebarGroup, { children: [group.label !== undefined && _jsx(SidebarGroupLabel, { children: group.label }), _jsx(SidebarGroupContent, { children: _jsx(NavMenu, { items: group.items, activeTo: activeTo }) })] }, `${group.placement ?? 'top'}:${groupIndex}:${group.label ?? ''}`));
233
- return (_jsxs(TooltipProvider, { children: [reporter && _jsx(ReportRoutePattern, { reporter: reporter }), _jsxs(SidebarProvider, { defaultOpen: storedSidebarOpen(defaultSidebarOpen), children: [_jsx(CloseMobileSidebarOnNavigate, {}), _jsx("nav", { "aria-label": "Primary", children: _jsxs(Sidebar, { collapsible: "icon", children: [_jsx(SidebarHeader, { children: _jsxs("div", { className: "flex items-center gap-2 px-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:px-0", children: [Logo && (_jsx(Logo, { "aria-hidden": "true", className: "size-5 shrink-0 text-sidebar-foreground group-data-[collapsible=icon]:size-4" })), _jsx("span", { className: "truncate text-sm font-semibold text-sidebar-foreground group-data-[collapsible=icon]:hidden", children: title })] }) }), _jsxs(SidebarContent, { children: [groups.filter((group) => !group.placement).map(renderGroup), sidebarExtra, groups.some((group) => group.placement) && (_jsx("div", { "data-slot": "nav-foot", className: "mt-auto flex flex-col", children: groups.filter((group) => group.placement).map(renderGroup) }))] }), _jsxs(SidebarFooter, { children: [version && _jsx(VersionEntry, { version: version }), _jsxs("div", { className: "flex items-center justify-between gap-2 px-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:px-0", children: [_jsx("span", { className: "truncate type-caption text-sidebar-foreground/70 group-data-[collapsible=icon]:hidden", children: user.name }), _jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": "Log out", onClick: () => {
233
+ return (_jsxs(TooltipProvider, { children: [reporter && _jsx(ReportRoutePattern, { reporter: reporter }), _jsxs(SidebarProvider, { defaultOpen: storedSidebarOpen(defaultSidebarOpen), children: [_jsx(CloseMobileSidebarOnNavigate, {}), _jsx("nav", { "aria-label": "Primary", children: _jsxs(Sidebar, { collapsible: "icon", children: [_jsx(SidebarHeader, { children: _jsxs("div", { className: "flex items-center gap-2 px-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:px-0", children: [Logo && (_jsx(Logo, { "aria-hidden": "true", className: "size-5 shrink-0 text-sidebar-foreground group-data-[collapsible=icon]:size-4" })), _jsx("span", { className: "truncate text-sm font-semibold text-sidebar-foreground group-data-[collapsible=icon]:hidden", children: title })] }) }), _jsxs(SidebarContent, { children: [groups.filter((group) => !group.placement).map(renderGroup), sidebarExtra, groups.some((group) => group.placement) && (_jsx("div", { "data-slot": "nav-foot", className: "mt-auto flex flex-col", children: groups.filter((group) => group.placement).map(renderGroup) }))] }), _jsxs(SidebarFooter, { children: [version && _jsx(VersionEntry, { version: version }), _jsxs("div", { className: "flex items-center justify-between gap-2 px-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:px-0", children: [_jsx("span", { className: "truncate type-caption text-sidebar-foreground/70 group-data-[collapsible=icon]:hidden", children: user.name }), _jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": "Log Out", onClick: () => {
234
234
  setIsLoggingOut(true);
235
235
  // The records opened lately are this person's: the
236
236
  // next to sign in on this device doesn't see them.
@@ -127,5 +127,5 @@ function BoardColumnView({ column, count, headingLevel, onDrop, children, }) {
127
127
  }, children: [_jsxs(Heading, { id: headingId, className: "flex items-center gap-2 px-1 pt-0.5 type-label", children: [column.label, _jsx("span", { className: "font-normal tabular-nums text-muted-foreground", children: count })] }), children] }));
128
128
  }
129
129
  function MoveMenu({ id, name, value, targets, onMove, }) {
130
- return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { render: _jsx(Button, { variant: "ghost", size: "icon-xs", "aria-label": `Move ${name}`, title: "Move to\u2026", "data-board-move": id }), children: _jsx(ArrowRightLeftIcon, { "aria-hidden": "true" }) }), _jsx(DropdownMenuContent, { align: "end", className: "w-44", children: _jsxs(DropdownMenuGroup, { children: [_jsx(DropdownMenuLabel, { children: "Move to" }), _jsx(DropdownMenuRadioGroup, { value: value, onValueChange: (next) => onMove(next), children: targets.map((target) => (_jsx(DropdownMenuRadioItem, { value: target.value, closeOnClick: true, children: target.label }, target.value))) })] }) })] }));
130
+ return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { render: _jsx(Button, { variant: "ghost", size: "icon-xs", "aria-label": `Move ${name}`, title: "Move To\u2026", "data-board-move": id }), children: _jsx(ArrowRightLeftIcon, { "aria-hidden": "true" }) }), _jsx(DropdownMenuContent, { align: "end", className: "w-44", children: _jsxs(DropdownMenuGroup, { children: [_jsx(DropdownMenuLabel, { children: "Move To" }), _jsx(DropdownMenuRadioGroup, { value: value, onValueChange: (next) => onMove(next), children: targets.map((target) => (_jsx(DropdownMenuRadioItem, { value: target.value, closeOnClick: true, children: target.label }, target.value))) })] }) })] }));
131
131
  }
@@ -13,5 +13,10 @@ export function ChoiceButtons({ id, options, value, onValueChange, render, clear
13
13
  const option = options[Number(key)];
14
14
  if (option && option.value !== value)
15
15
  onValueChange(option.value);
16
- }, disabled: disabled, "aria-invalid": invalid || undefined, className: cn('max-w-full flex-wrap rounded-md aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40', className), ...aria, children: options.map((option, index) => (_jsx(ToggleGroupItem, { value: String(index), className: cn('h-(--control-height,--spacing(8)) px-3 font-normal text-muted-foreground aria-pressed:font-medium aria-pressed:text-foreground', invalid && 'border-destructive'), children: render ? render(option.value, option.label) : option.label }, String(option.value)))) }));
16
+ }, disabled: disabled, "aria-invalid": invalid || undefined, className: cn('max-w-full min-w-0 flex-wrap gap-y-1 rounded-md pl-px aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40', className), ...aria, children: options.map((option, index) => (_jsx(ToggleGroupItem, { value: String(index), className: cn(
17
+ // Every button has its left border (`!`: the joined group drops it
18
+ // after the first) and overlaps the one before by it, so a button
19
+ // that wraps to a new line starts with an edge; `pl-px` on the
20
+ // group keeps that edge inside the box.
21
+ '-ml-px border-l! h-(--control-height,--spacing(8)) max-w-full px-3 font-normal text-muted-foreground aria-pressed:font-medium aria-pressed:text-foreground', invalid && 'border-destructive'), children: render ? render(option.value, option.label) : option.label }, String(option.value)))) }));
17
22
  }
@@ -16,7 +16,7 @@ export function ViewPills({ views, value, onValueChange, label, }) {
16
16
  }
17
17
  export function ColumnsMenu({ columns, visible, fixed, pick, onPickChange, setByView, label = 'Columns', }) {
18
18
  const ids = [...fixed, ...columns.map((column) => column.id)];
19
- return (_jsxs(DropdownMenu, { children: [_jsxs(DropdownMenuTrigger, { render: _jsx(Button, { variant: "outline", size: "sm", "data-slot": "data-table-columns-menu" }), children: [_jsx(Columns3Icon, { "aria-hidden": "true" }), label] }), _jsxs(DropdownMenuContent, { align: "end", className: "w-52", children: [_jsxs(DropdownMenuGroup, { children: [_jsx(DropdownMenuLabel, { children: setByView ? 'Set by this view' : 'Show columns' }), columns.map((column) => (_jsx(DropdownMenuCheckboxItem, { checked: visible.includes(column.id), disabled: setByView, onCheckedChange: (checked) => onPickChange(togglePick(ids, visible, column.id, checked, pick)), children: column.label }, column.id)))] }), pick && !setByView ? (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuItem, { onClick: () => onPickChange(null), children: "Reset to the list's columns" })] })) : null] })] }));
19
+ return (_jsxs(DropdownMenu, { children: [_jsxs(DropdownMenuTrigger, { render: _jsx(Button, { variant: "outline", size: "sm", "data-slot": "data-table-columns-menu" }), children: [_jsx(Columns3Icon, { "aria-hidden": "true" }), label] }), _jsxs(DropdownMenuContent, { align: "end", className: "w-52", children: [_jsxs(DropdownMenuGroup, { children: [_jsx(DropdownMenuLabel, { children: setByView ? 'Set by This View' : 'Show Columns' }), columns.map((column) => (_jsx(DropdownMenuCheckboxItem, { checked: visible.includes(column.id), disabled: setByView, onCheckedChange: (checked) => onPickChange(togglePick(ids, visible, column.id, checked, pick)), children: column.label }, column.id)))] }), pick && !setByView ? (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuItem, { onClick: () => onPickChange(null), children: "Reset to the List's Columns" })] })) : null] })] }));
20
20
  }
21
21
  export function RowActions({ actions, rowLabel }) {
22
22
  if (actions.length === 0)
@@ -55,5 +55,5 @@ export function ViewAllLink({ viewAll, total, navigator }) {
55
55
  return;
56
56
  event.preventDefault();
57
57
  void navigator.push(viewAll.to);
58
- }, children: viewAll.label ?? `View all ${total}` }));
58
+ }, children: viewAll.label ?? `View All ${total}` }));
59
59
  }
@@ -97,14 +97,14 @@ function LayoutSwitch({ options, value, onValueChange, }) {
97
97
  const NO_GROUPING = '__none__';
98
98
  function GroupMenu({ groupings, value, onValueChange, }) {
99
99
  const current = groupings.find((grouping) => grouping.id === value);
100
- return (_jsxs(DropdownMenu, { children: [_jsxs(DropdownMenuTrigger, { render: _jsx(Button, { variant: "outline", size: "sm", "data-slot": "data-table-group-menu" }), children: [_jsx(ListTreeIcon, { "aria-hidden": "true" }), current ? `Group: ${current.label}` : 'Group'] }), _jsx(DropdownMenuContent, { align: "end", className: "w-48", children: _jsxs(DropdownMenuGroup, { children: [_jsx(DropdownMenuLabel, { children: "Group by" }), _jsxs(DropdownMenuRadioGroup, { value: current?.id ?? NO_GROUPING, onValueChange: (next) => onValueChange(next === NO_GROUPING ? '' : String(next)), children: [_jsx(DropdownMenuRadioItem, { value: NO_GROUPING, closeOnClick: true, children: "None" }), groupings.map((grouping) => (_jsx(DropdownMenuRadioItem, { value: grouping.id, closeOnClick: true, children: grouping.label }, grouping.id)))] })] }) })] }));
100
+ return (_jsxs(DropdownMenu, { children: [_jsxs(DropdownMenuTrigger, { render: _jsx(Button, { variant: "outline", size: "sm", "data-slot": "data-table-group-menu" }), children: [_jsx(ListTreeIcon, { "aria-hidden": "true" }), current ? `Group: ${current.label}` : 'Group'] }), _jsx(DropdownMenuContent, { align: "end", className: "w-48", children: _jsxs(DropdownMenuGroup, { children: [_jsx(DropdownMenuLabel, { children: "Group By" }), _jsxs(DropdownMenuRadioGroup, { value: current?.id ?? NO_GROUPING, onValueChange: (next) => onValueChange(next === NO_GROUPING ? '' : String(next)), children: [_jsx(DropdownMenuRadioItem, { value: NO_GROUPING, closeOnClick: true, children: "None" }), groupings.map((grouping) => (_jsx(DropdownMenuRadioItem, { value: grouping.id, closeOnClick: true, children: grouping.label }, grouping.id)))] })] }) })] }));
101
101
  }
102
102
  // The rows-per-page menu in the pagination bar (`pageSizes`): a radio list
103
103
  // that closes on a pick. The button says the size in words of its own
104
104
  // ("50 rows", as the list page standard drew it), and the menu says
105
105
  // what it is.
106
106
  function PageSizeMenu({ pageSizes, value, onValueChange, }) {
107
- return (_jsxs(DropdownMenu, { children: [_jsxs(DropdownMenuTrigger, { render: _jsx(Button, { variant: "outline", size: "sm", "data-slot": "data-table-page-size", "aria-label": `${value} rows per page` }), children: [value, " rows", _jsx(ChevronDownIcon, { "aria-hidden": "true" })] }), _jsx(DropdownMenuContent, { align: "end", className: "w-40", children: _jsxs(DropdownMenuGroup, { children: [_jsx(DropdownMenuLabel, { children: "Rows per page" }), _jsx(DropdownMenuRadioGroup, { value: String(value), onValueChange: (next) => onValueChange(Number(next)), children: pageSizes.map((size) => (_jsx(DropdownMenuRadioItem, { value: String(size), closeOnClick: true, children: size }, size))) })] }) })] }));
107
+ return (_jsxs(DropdownMenu, { children: [_jsxs(DropdownMenuTrigger, { render: _jsx(Button, { variant: "outline", size: "sm", "data-slot": "data-table-page-size", "aria-label": `${value} rows per page` }), children: [value, " rows", _jsx(ChevronDownIcon, { "aria-hidden": "true" })] }), _jsx(DropdownMenuContent, { align: "end", className: "w-40", children: _jsxs(DropdownMenuGroup, { children: [_jsx(DropdownMenuLabel, { children: "Rows per Page" }), _jsx(DropdownMenuRadioGroup, { value: String(value), onValueChange: (next) => onValueChange(Number(next)), children: pageSizes.map((size) => (_jsx(DropdownMenuRadioItem, { value: String(size), closeOnClick: true, children: size }, size))) })] }) })] }));
108
108
  }
109
109
  // A cell's text cut to one line (`meta.clip`). Only when it is cut does it
110
110
  // take a tab stop and a tooltip with the whole text, on hover and on focus;
@@ -711,7 +711,7 @@ export function DataTable({ columns, data, total, page, pageSize, onPageChange,
711
711
  const view = views?.[id];
712
712
  if (view)
713
713
  onViewChange?.(view, id);
714
- } })) : null, layouts?.length || groupings?.length || showColumnsMenu ? (_jsxs("div", { className: "flex flex-wrap items-end gap-x-4 gap-y-2", children: [_jsx("div", { className: "min-w-0 flex-1 basis-72", children: toolbar }), showColumnsMenu ? (_jsx(ColumnsMenu, { label: columnsMenu?.label, columns: menuColumns, visible: shownColumns ?? leafIds, fixed: fixedColumns, pick: columnsPick, onPickChange: setColumnsPick, setByView: viewColumns !== undefined })) : null, groupings?.length ? (_jsxs("div", { className: "flex items-center gap-2", children: [activeGrouping && (_jsx(Button, { variant: "ghost", size: "sm", "data-slot": "data-table-fold-all", disabled: !runs?.length, onClick: foldAll, children: allFolded ? 'Unfold all' : 'Fold all' })), _jsx(GroupMenu, { groupings: groupings, value: activeGrouping?.id ?? '', onValueChange: setGrouping })] })) : null, layouts?.length ? (_jsx(LayoutSwitch, { options: [
714
+ } })) : null, layouts?.length || groupings?.length || showColumnsMenu ? (_jsxs("div", { className: "flex flex-wrap items-end gap-x-4 gap-y-2", children: [_jsx("div", { className: "min-w-0 flex-1 basis-72", children: toolbar }), showColumnsMenu ? (_jsx(ColumnsMenu, { label: columnsMenu?.label, columns: menuColumns, visible: shownColumns ?? leafIds, fixed: fixedColumns, pick: columnsPick, onPickChange: setColumnsPick, setByView: viewColumns !== undefined })) : null, groupings?.length ? (_jsxs("div", { className: "flex items-center gap-2", children: [activeGrouping && (_jsx(Button, { variant: "ghost", size: "sm", "data-slot": "data-table-fold-all", disabled: !runs?.length, onClick: foldAll, children: allFolded ? 'Unfold All' : 'Fold All' })), _jsx(GroupMenu, { groupings: groupings, value: activeGrouping?.id ?? '', onValueChange: setGrouping })] })) : null, layouts?.length ? (_jsx(LayoutSwitch, { options: [
715
715
  { id: 'table', label: tableLayout?.label ?? 'Table', icon: tableLayout?.icon ?? TableIcon },
716
716
  ...layouts,
717
717
  ], value: currentLayout, onValueChange: setLayout })) : null] })) : (toolbar), _jsx("div", { ref: body, "data-slot": "data-table-body", className: cn('flex flex-col gap-4', fitsColumns && CONTENT_WIDTH_CLASS), style: fitsColumns && !isSuccessView && lastWidth !== null
@@ -767,7 +767,7 @@ export function DataTable({ columns, data, total, page, pageSize, onPageChange,
767
767
  })) : (_jsx(TableBody, { className: cn(!striped && UNSTRIPED_BODY_CLASS), children: rows.map((row) => renderRow(row)) })), totals && (_jsx(TableFooter, { className: TOTALS_FOOTER_CLASS, children: _jsx(TableRow, { "data-slot": "table-totals", className: "hover:bg-transparent", children: visibleLeafColumns.map((column, index) => {
768
768
  const className = cn(pinFirstColumn && index === 0 && PINNED_TOTALS_LABEL_CLASS, pinLast && index === visibleColumnCount - 1 && PINNED_LAST_COLUMN_CLASS, alignClass(column.columnDef.meta?.align));
769
769
  return index === 0 ? (_jsx(TableHead, { scope: "row", className: cn(TOTALS_LABEL_CLASS, className), children: pinFirstColumn ? (_jsx("div", { className: PINNED_FIRST_CONTENT_CLASS, children: totals.label })) : (totals.label) }, column.id)) : (_jsx(TableCell, { className: className, children: totals.cells?.[column.id] }, column.id));
770
- }) }) }))] })), pinFirstColumn && isOverflowing && !cardLayout && !showPhoneRows && (_jsx("div", { ref: barRef, "aria-hidden": "true", tabIndex: -1, "data-slot": "bottom-scrollbar", className: "sticky bottom-0 z-20 h-4 overflow-x-auto border-t border-border bg-background", children: _jsx("div", { style: { width: scrollWidth, height: 1 } }) })), viewAll && limit !== undefined && viewAllTotal > rows.length ? (_jsx(ViewAllLink, { viewAll: viewAll, total: viewAllTotal, navigator: navigation?.navigator })) : null, limit === undefined && (_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-x-4 gap-y-2", "data-slot": "data-table-pagination", children: [_jsxs("p", { className: "type-body text-muted-foreground", children: [total === 0 ? 0 : (page - 1) * pageSize + 1, '–', Math.min(page * pageSize, total), " of ", total] }), _jsxs("div", { className: "flex items-center gap-2", children: [pageSizes && pageSizes.length > 1 && onPageSizeChange ? (_jsx(PageSizeMenu, { pageSizes: pageSizes, value: pageSize, onValueChange: onPageSizeChange })) : null, _jsx(Button, { variant: "outline", size: "icon-sm", "aria-label": "Previous page", disabled: page <= 1, onClick: () => onPageChange(page - 1), children: _jsx(ChevronLeftIcon, {}) }), _jsxs("span", { className: "type-body text-muted-foreground", children: ["Page ", page, " of ", pageCount] }), _jsx(Button, { variant: "outline", size: "icon-sm", "aria-label": "Next page", disabled: page >= pageCount, onClick: () => onPageChange(page + 1), children: _jsx(ChevronRightIcon, {}) })] })] }))] })) })] }));
770
+ }) }) }))] })), pinFirstColumn && isOverflowing && !cardLayout && !showPhoneRows && (_jsx("div", { ref: barRef, "aria-hidden": "true", tabIndex: -1, "data-slot": "bottom-scrollbar", className: "sticky bottom-0 z-20 h-4 overflow-x-auto border-t border-border bg-background", children: _jsx("div", { style: { width: scrollWidth, height: 1 } }) })), viewAll && limit !== undefined && viewAllTotal > rows.length ? (_jsx(ViewAllLink, { viewAll: viewAll, total: viewAllTotal, navigator: navigation?.navigator })) : null, limit === undefined && (_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-x-4 gap-y-2", "data-slot": "data-table-pagination", children: [_jsxs("p", { className: "type-body text-muted-foreground", children: [total === 0 ? 0 : (page - 1) * pageSize + 1, '–', Math.min(page * pageSize, total), " of ", total] }), _jsxs("div", { className: "flex items-center gap-2", children: [pageSizes && pageSizes.length > 1 && onPageSizeChange ? (_jsx(PageSizeMenu, { pageSizes: pageSizes, value: pageSize, onValueChange: onPageSizeChange })) : null, _jsx(Button, { variant: "outline", size: "icon-sm", "aria-label": "Previous Page", disabled: page <= 1, onClick: () => onPageChange(page - 1), children: _jsx(ChevronLeftIcon, {}) }), _jsxs("span", { className: "type-body text-muted-foreground", children: ["Page ", page, " of ", pageCount] }), _jsx(Button, { variant: "outline", size: "icon-sm", "aria-label": "Next Page", disabled: page >= pageCount, onClick: () => onPageChange(page + 1), children: _jsx(ChevronRightIcon, {}) })] })] }))] })) })] }));
771
771
  return (_jsx(EditInPlaceContext.Provider, { value: store, children: _jsxs(RowActionsContext.Provider, { value: rowActions, children: [editing && _jsx(LeaveGuard, { store: store }), width === 'content' ? _jsx("div", { className: "@container/data-table", children: content }) : content, detailPanel && (_jsx(Sheet, { open: Boolean(selectedRow) && !isWide && isSuccessView && !cardLayout, onOpenChange: (open) => {
772
772
  if (!open)
773
773
  setSelection(null);
@@ -100,7 +100,7 @@ function TypedDate({ id, value, onChange, onPick, onProblem, placeholder, cleara
100
100
  };
101
101
  const selected = plainDateToLocal(given);
102
102
  const showProblem = told && problem !== null;
103
- return (_jsxs("div", { "data-slot": "date-field", "data-kind": "date", className: cn('flex w-full min-w-0 flex-col gap-1.5', className), children: [_jsxs(InputGroup, { ref: group, children: [_jsx(InputGroupInput, { ref: box, id: id, value: text, onChange: (event) => type(event.target.value), onBlur: settle, onKeyDown: onKeyDown, placeholder: placeholder ?? plainDateExamples(locale), readOnly: readOnly, autoComplete: "off", "aria-invalid": invalid || showProblem || undefined, "aria-describedby": [showProblem ? messageId : null, describedBy].filter(Boolean).join(' ') || undefined, ...aria }), _jsx(InputGroupAddon, { align: "inline-end", children: _jsxs(Popover, { open: open, onOpenChange: changeOpen, modal: modal, children: [_jsx(PopoverTrigger, { render: _jsx(InputGroupButton, { type: "button", size: "icon-xs", variant: "ghost", disabled: readOnly, "aria-label": "Open calendar" }), children: _jsx(CalendarIcon, { "aria-hidden": "true" }) }), _jsxs(PopoverContent, { ref: popup, anchor: group, align: "start", className: "w-auto p-0", "data-slot": "date-field-calendar",
103
+ return (_jsxs("div", { "data-slot": "date-field", "data-kind": "date", className: cn('flex w-full min-w-0 flex-col gap-1.5', className), children: [_jsxs(InputGroup, { ref: group, children: [_jsx(InputGroupInput, { ref: box, id: id, value: text, onChange: (event) => type(event.target.value), onBlur: settle, onKeyDown: onKeyDown, placeholder: placeholder ?? plainDateExamples(locale), readOnly: readOnly, autoComplete: "off", "aria-invalid": invalid || showProblem || undefined, "aria-describedby": [showProblem ? messageId : null, describedBy].filter(Boolean).join(' ') || undefined, ...aria }), _jsx(InputGroupAddon, { align: "inline-end", children: _jsxs(Popover, { open: open, onOpenChange: changeOpen, modal: modal, children: [_jsx(PopoverTrigger, { render: _jsx(InputGroupButton, { type: "button", size: "icon-xs", variant: "ghost", disabled: readOnly, "aria-label": "Open Calendar" }), children: _jsx(CalendarIcon, { "aria-hidden": "true" }) }), _jsxs(PopoverContent, { ref: popup, anchor: group, align: "start", className: "w-auto p-0", "data-slot": "date-field-calendar",
104
104
  // The day the keyboard starts from (the chosen one, else today).
105
105
  initialFocus: () => popup.current?.querySelector('button[data-day][tabindex="0"]') ?? true,
106
106
  // Back to the box, where typing goes on.
@@ -1,12 +1,23 @@
1
1
  import { type ReactElement, type ReactNode } from 'react';
2
2
  export type DeleteKind = 'soft' | 'hard';
3
+ /** The one field a confirm can ask (4.96): an optional reason, in a textarea. */
4
+ export type DeleteReason = {
5
+ /** The field's label: "Why" unless set ("Why remove it?"). */
6
+ label?: string;
7
+ /** A line under the box, in muted type ("Kept with its history."). */
8
+ hint?: ReactNode;
9
+ placeholder?: string;
10
+ };
3
11
  export type DeleteActionProps = {
4
12
  /** What's deleted, as the page names it: "The Long Walk". */
5
13
  name: string;
6
14
  /** `soft`: it goes to Deleted and Restore brings it back. `hard`: it's gone. */
7
15
  kind: DeleteKind;
8
- /** Deletes it. A rejection keeps the dialog open with the reason. */
9
- onDelete: () => Promise<unknown>;
16
+ /**
17
+ * Deletes it. A rejection keeps the dialog open with the reason. With
18
+ * `reason`, it's given what was typed, trimmed ('' for nothing).
19
+ */
20
+ onDelete: (reason: string) => Promise<unknown>;
10
21
  /** A soft delete's Undo: restores it. Without it the toast has no Undo. */
11
22
  onRestore?: () => Promise<unknown>;
12
23
  /** After it's deleted and the toast is up: leave the record's page, say. */
@@ -17,6 +28,8 @@ export type DeleteActionProps = {
17
28
  verbDone?: string;
18
29
  /** Another sentence under the question than `kind`'s. */
19
30
  description?: ReactNode;
31
+ /** Ask a reason: one optional field between the sentence and the buttons, passed to `onDelete`. */
32
+ reason?: DeleteReason;
20
33
  /** `"icon"` (the default), `"button"` (the verb in words), an element to open it, or `null` for none. */
21
34
  trigger?: 'icon' | 'button' | ReactElement | null;
22
35
  /** The icon trigger's size: `default` (36px, a header) or `sm` (32px, a row). */
@@ -25,4 +38,4 @@ export type DeleteActionProps = {
25
38
  open?: boolean;
26
39
  onOpenChange?: (open: boolean) => void;
27
40
  };
28
- export declare function DeleteAction({ name, kind, onDelete, onRestore, onDeleted, verb, verbDone, description, trigger, size, open: openProp, onOpenChange, }: DeleteActionProps): import("react").JSX.Element;
41
+ export declare function DeleteAction({ name, kind, onDelete, onRestore, onDeleted, verb, verbDone, description, reason, trigger, size, open: openProp, onOpenChange, }: DeleteActionProps): import("react").JSX.Element;
@@ -14,16 +14,24 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  // - `verb` covers the other ways something leaves a list: `verb="Retire"`
15
15
  // asks "Retire <name>?" on a "Retire" button and says "Retired <name>".
16
16
  //
17
+ // - `reason` (4.96) puts one field between the sentence and the buttons, a
18
+ // "Why" box, optional: what's typed (trimmed, '' for nothing) is
19
+ // `onDelete`'s argument, and Try again sends it again. While something's
20
+ // typed, closing asks "Discard your changes?" first (the dialog
21
+ // standard's `dirty`). Width, words and the buttons stay as they are.
22
+ //
17
23
  // The trigger is an icon (IconAction's Trash2) unless `trigger` says
18
24
  // otherwise: `"button"` for a "Delete" button in words, an element of the
19
25
  // caller's, or `null` for none, opened with `open`/`onOpenChange` (a row's
20
26
  // menu item).
21
- import { useState } from 'react';
27
+ import { useId, useState } from 'react';
22
28
  import { Trash2Icon } from 'lucide-react';
23
29
  import { useAction } from '../../hooks/use-action.js';
24
30
  import { Button } from '../ui/button.js';
25
31
  import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from '../ui/dialog.js';
32
+ import { Field, FieldDescription, FieldLabel } from '../ui/field.js';
26
33
  import { Spinner } from '../ui/spinner.js';
34
+ import { Textarea } from '../ui/textarea.js';
27
35
  import { ActionError } from './action-error.js';
28
36
  import { IconAction } from './icon-action.js';
29
37
  import { notify, pastTense } from './notify.js';
@@ -31,7 +39,7 @@ const SAYS = {
31
39
  soft: 'It goes to Deleted, and Restore brings it back.',
32
40
  hard: 'This can’t be undone.',
33
41
  };
34
- export function DeleteAction({ name, kind, onDelete, onRestore, onDeleted, verb = 'Delete', verbDone, description, trigger = 'icon', size = 'default', open: openProp, onOpenChange, }) {
42
+ export function DeleteAction({ name, kind, onDelete, onRestore, onDeleted, verb = 'Delete', verbDone, description, reason, trigger = 'icon', size = 'default', open: openProp, onOpenChange, }) {
35
43
  const [openState, setOpenState] = useState(false);
36
44
  const open = openProp ?? openState;
37
45
  const setOpen = (next) => {
@@ -41,8 +49,17 @@ export function DeleteAction({ name, kind, onDelete, onRestore, onDeleted, verb
41
49
  };
42
50
  const done = verbDone ?? pastTense(verb);
43
51
  const remove = useAction(onDelete, { failed: `Couldn't ${verb.toLowerCase()} ${name}` });
52
+ const reasonId = useId();
53
+ const [typed, setTyped] = useState('');
54
+ // A closed confirm starts empty next time, however it was closed.
55
+ const [wasOpen, setWasOpen] = useState(open);
56
+ if (wasOpen !== open) {
57
+ setWasOpen(open);
58
+ if (!open)
59
+ setTyped('');
60
+ }
44
61
  const confirm = async () => {
45
- const outcome = await remove.run();
62
+ const outcome = await remove.run(reason ? typed.trim() : '');
46
63
  if (!outcome.ok)
47
64
  return;
48
65
  // Whether or not this is still on screen: a row's delete is gone with
@@ -57,5 +74,5 @@ export function DeleteAction({ name, kind, onDelete, onRestore, onDeleted, verb
57
74
  if (!next)
58
75
  remove.reset();
59
76
  setOpen(next);
60
- }, children: [trigger === 'icon' && (_jsx(DialogTrigger, { render: _jsx(IconAction, { icon: Trash2Icon, label: verb, tone: "destructive", size: size }) })), trigger === 'button' && (_jsx(DialogTrigger, { render: _jsx(Button, { variant: "outline", size: size === 'sm' ? 'sm' : 'default' }), children: verb })), trigger && typeof trigger === 'object' && _jsx(DialogTrigger, { render: trigger }), _jsxs(DialogContent, { size: "confirm", "data-slot": "delete-action", "data-kind": kind, children: [_jsxs(DialogHeader, { children: [_jsxs(DialogTitle, { children: [verb, " ", name, "?"] }), _jsx(DialogDescription, { children: description ?? SAYS[kind] })] }), _jsx(ActionError, { action: { ...remove, retry: confirm } }), _jsxs(DialogFooter, { children: [_jsx(DialogClose, { render: _jsx(Button, { variant: "outline", disabled: remove.pending }), children: "Cancel" }), _jsxs(Button, { variant: "destructive", disabled: remove.pending, onClick: () => void confirm(), children: [remove.pending && _jsx(Spinner, { className: "size-4" }), verb] })] })] })] }));
77
+ }, children: [trigger === 'icon' && (_jsx(DialogTrigger, { render: _jsx(IconAction, { icon: Trash2Icon, label: verb, tone: "destructive", size: size }) })), trigger === 'button' && (_jsx(DialogTrigger, { render: _jsx(Button, { variant: "outline", size: size === 'sm' ? 'sm' : 'default' }), children: verb })), trigger && typeof trigger === 'object' && _jsx(DialogTrigger, { render: trigger }), _jsxs(DialogContent, { size: "confirm", dirty: reason !== undefined && typed.trim() !== '' && !remove.pending, "data-slot": "delete-action", "data-kind": kind, children: [_jsxs(DialogHeader, { children: [_jsxs(DialogTitle, { children: [verb, " ", name, "?"] }), _jsx(DialogDescription, { children: description ?? SAYS[kind] })] }), reason && (_jsxs(Field, { "data-slot": "delete-action-reason", children: [_jsx(FieldLabel, { htmlFor: reasonId, children: reason.label ?? 'Why' }), _jsx(Textarea, { id: reasonId, value: typed, placeholder: reason.placeholder, disabled: remove.pending, onChange: (event) => setTyped(event.target.value) }), reason.hint && _jsx(FieldDescription, { children: reason.hint })] })), _jsx(ActionError, { action: { ...remove, retry: confirm } }), _jsxs(DialogFooter, { children: [_jsx(DialogClose, { render: _jsx(Button, { variant: "outline", disabled: remove.pending }), children: "Cancel" }), _jsxs(Button, { variant: "destructive", disabled: remove.pending, onClick: () => void confirm(), children: [remove.pending && _jsx(Spinner, { className: "size-4" }), verb] })] })] })] }));
61
78
  }
@@ -1,6 +1,6 @@
1
1
  export const EMOJI_GROUPS = [
2
2
  {
3
- label: 'Morning and sleep',
3
+ label: 'Morning and Sleep',
4
4
  emojis: [
5
5
  { emoji: '☀️', name: 'Sun', keywords: 'morning day bright' },
6
6
  { emoji: '🌅', name: 'Sunrise', keywords: 'morning dawn' },
@@ -13,7 +13,7 @@ export const EMOJI_GROUPS = [
13
13
  ],
14
14
  },
15
15
  {
16
- label: 'Body and health',
16
+ label: 'Body and Health',
17
17
  emojis: [
18
18
  { emoji: '🧘', name: 'Person in lotus position', keywords: 'yoga meditate breathe calm' },
19
19
  { emoji: '🏃', name: 'Person running', keywords: 'run exercise workout cardio' },
@@ -45,7 +45,7 @@ export const EMOJI_GROUPS = [
45
45
  ],
46
46
  },
47
47
  {
48
- label: 'Food and drink',
48
+ label: 'Food and Drink',
49
49
  emojis: [
50
50
  { emoji: '🍳', name: 'Cooking', keywords: 'breakfast egg pan' },
51
51
  { emoji: '🥣', name: 'Bowl with spoon', keywords: 'cereal oatmeal breakfast' },
@@ -61,7 +61,7 @@ export const EMOJI_GROUPS = [
61
61
  ],
62
62
  },
63
63
  {
64
- label: 'Home and chores',
64
+ label: 'Home and Chores',
65
65
  emojis: [
66
66
  { emoji: '🏠', name: 'House', keywords: 'home' },
67
67
  { emoji: '🧹', name: 'Broom', keywords: 'sweep clean chores' },
@@ -80,7 +80,7 @@ export const EMOJI_GROUPS = [
80
80
  ],
81
81
  },
82
82
  {
83
- label: 'Work and learning',
83
+ label: 'Work and Learning',
84
84
  emojis: [
85
85
  { emoji: '💻', name: 'Laptop', keywords: 'computer work code' },
86
86
  { emoji: '📧', name: 'Email', keywords: 'mail inbox' },
@@ -99,7 +99,7 @@ export const EMOJI_GROUPS = [
99
99
  ],
100
100
  },
101
101
  {
102
- label: 'Play and music',
102
+ label: 'Play and Music',
103
103
  emojis: [
104
104
  { emoji: '🎵', name: 'Musical note', keywords: 'music song' },
105
105
  { emoji: '🎧', name: 'Headphones', keywords: 'music podcast listen' },
@@ -114,7 +114,7 @@ export const EMOJI_GROUPS = [
114
114
  ],
115
115
  },
116
116
  {
117
- label: 'Outside and travel',
117
+ label: 'Outside and Travel',
118
118
  emojis: [
119
119
  { emoji: '🚶', name: 'Person walking', keywords: 'walk steps' },
120
120
  { emoji: '🥾', name: 'Hiking boot', keywords: 'hike trail' },
@@ -1,5 +1,12 @@
1
- /** The empty text in the muted tone; the dash is read as "Not set". */
2
- export declare function EmptyText({ text, className }: {
1
+ import type { ComponentProps } from 'react';
2
+ /** Any other span attribute (`data-state`, `id`) passes through to the span. */
3
+ export type EmptyTextProps = Omit<ComponentProps<'span'>, 'children'> & {
4
+ /** What shows: the dash unless set. Words ("No budget yet") read as they are. */
3
5
  text?: string;
6
+ /** What a screen reader says for the dash: "Not set" unless set ("No reason given"). */
7
+ label?: string;
8
+ /** Replaces the muted text tone's class (keep a muted tone: `type-body text-muted-foreground`). */
4
9
  className?: string;
5
- }): import("react").JSX.Element;
10
+ };
11
+ /** The empty text in the muted tone; the dash is read as `label`, "Not set" by default. */
12
+ export declare function EmptyText({ text, label, className, ...props }: EmptyTextProps): import("react").JSX.Element;
@@ -1,11 +1,6 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- // What an empty value reads as on a record (form standard 22.2, #F17): a
3
- // dash in the muted text tone, everywhere, with "Not set" as what a screen
4
- // reader says for it. Words given instead ("No budget yet") read as they
5
- // are. EntityView, its strip (KeyStats) and the inPlace presets' fields all
6
- // show it.
7
2
  import { EMPTY_DASH } from '../../lib/empty-value.js';
8
- /** The empty text in the muted tone; the dash is read as "Not set". */
9
- export function EmptyText({ text = EMPTY_DASH, className }) {
10
- return (_jsx("span", { "data-slot": "empty-value", className: className ?? 'text-muted-foreground', children: text === EMPTY_DASH ? (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": "true", children: EMPTY_DASH }), _jsx("span", { className: "sr-only", children: "Not set" })] })) : (text) }));
3
+ /** The empty text in the muted tone; the dash is read as `label`, "Not set" by default. */
4
+ export function EmptyText({ text = EMPTY_DASH, label = 'Not set', className, ...props }) {
5
+ return (_jsx("span", { "data-slot": "empty-value", ...props, className: className ?? 'text-muted-foreground', children: text === EMPTY_DASH ? (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": "true", children: EMPTY_DASH }), _jsx("span", { className: "sr-only", children: label })] })) : (text) }));
11
6
  }
@@ -121,7 +121,7 @@ export function EntityForm({ title, onSubmit, isSubmitting, submitError, onRetry
121
121
  }
122
122
  onCancel();
123
123
  };
124
- return (_jsxs("form", { ref: form, onSubmit: submit, noValidate: true, "data-slot": "entity-form", className: "flex max-w-xl flex-col gap-6", children: [_jsx("h1", { className: "type-page-title text-foreground", children: title }), _jsx(FieldGroup, { children: children }), _jsxs("div", { ref: bar, "data-slot": "entity-form-bar", className: "sticky z-10 -mt-3 flex flex-col gap-3 border-t border-border bg-background pt-3", children: [_jsx("div", { role: "status", className: "empty:hidden", children: submitError && (_jsx(Notice, { tone: "destructive", action: _jsx(Button, { type: "button", size: "sm", variant: "outline", disabled: isSubmitting, onClick: () => (onRetry ? onRetry() : form.current?.requestSubmit()), children: "Try again" }), children: submitError.message })) }), _jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [danger, _jsx("p", { role: "status", "data-slot": "entity-form-to-fix", className: "mr-auto type-label text-destructive-text empty:hidden", children: toFix > 0 ? `${toFix} to fix` : '' }), _jsxs("div", { className: "ml-auto flex gap-2 max-md:w-full max-md:[&>*]:flex-1", children: [_jsx(Button, { type: "button", variant: "outline", onClick: cancel, disabled: isSubmitting, children: "Cancel" }), _jsxs(Button, { type: "submit", disabled: isSubmitting, children: [isSubmitting && _jsx(Spinner, { className: "size-4" }), submitLabel] })] })] })] }), dirty !== undefined && _jsx(FormLeaveGuard, { dirty: dirty, letThrough: () => leaving.current || submitting.current }), _jsx(DiscardChangesDialog, { open: askingCancel, onKeepEditing: () => setAskingCancel(false), onDiscard: () => {
124
+ return (_jsxs("form", { ref: form, onSubmit: submit, noValidate: true, "data-slot": "entity-form", className: "flex max-w-xl flex-col gap-6", children: [_jsx("h1", { className: "type-page-title text-foreground", children: title }), _jsx(FieldGroup, { children: children }), _jsxs("div", { ref: bar, "data-slot": "entity-form-bar", className: "sticky z-10 -mt-3 flex flex-col gap-3 border-t border-border bg-background pt-3", children: [_jsx("div", { role: "status", className: "empty:hidden", children: submitError && (_jsx(Notice, { tone: "destructive", action: _jsx(Button, { type: "button", size: "sm", variant: "outline", disabled: isSubmitting, onClick: () => (onRetry ? onRetry() : form.current?.requestSubmit()), children: "Try Again" }), children: submitError.message })) }), _jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [danger, _jsx("p", { role: "status", "data-slot": "entity-form-to-fix", className: "mr-auto type-label text-destructive-text empty:hidden", children: toFix > 0 ? `${toFix} to fix` : '' }), _jsxs("div", { className: "ml-auto flex gap-2 max-md:w-full max-md:[&>*]:flex-1", children: [_jsx(Button, { type: "button", variant: "outline", onClick: cancel, disabled: isSubmitting, children: "Cancel" }), _jsxs(Button, { type: "submit", disabled: isSubmitting, children: [isSubmitting && _jsx(Spinner, { className: "size-4" }), submitLabel] })] })] })] }), dirty !== undefined && _jsx(FormLeaveGuard, { dirty: dirty, letThrough: () => leaving.current || submitting.current }), _jsx(DiscardChangesDialog, { open: askingCancel, onKeepEditing: () => setAskingCancel(false), onDiscard: () => {
125
125
  setAskingCancel(false);
126
126
  leaving.current = true;
127
127
  onCancel();
@@ -132,18 +132,18 @@ function FieldRow({ field, place }) {
132
132
  // places (the card's order kept) and then reads "Hide empty". Whether a
133
133
  // field is empty is read on every render, so one filled elsewhere joins
134
134
  // the card at once.
135
- function FieldList({ fields, inRail, place }) {
135
+ function FieldList({ fields, place }) {
136
136
  const empty = useContext(EmptyContext);
137
137
  const [open, setOpen] = useState(false);
138
138
  const listId = useId();
139
139
  const emptyCount = empty.fold ? fields.filter((field) => isEmptyValue(fieldValue(field))).length : 0;
140
140
  const shown = emptyCount === 0 || open ? fields : fields.filter((field) => !isEmptyValue(fieldValue(field)));
141
- return (_jsxs("div", { className: "flex flex-col gap-3", children: [shown.length > 0 && (_jsx("dl", { id: listId, className: cn('flex flex-col divide-y divide-border', inRail && '@container/fields'), children: shown.map((field) => (_jsx(FieldRow, { field: field, place: place }, field.label))) })), emptyCount > 0 && (_jsxs("button", { type: "button", "data-slot": "entity-view-empty-toggle", "aria-expanded": open, "aria-controls": shown.length > 0 ? listId : undefined, onClick: () => setOpen((was) => !was), className: "inline-flex w-fit items-center gap-1 rounded-sm type-label text-muted-foreground underline underline-offset-3 outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 pointer-coarse:min-h-11", children: [open ? 'Hide empty' : `${emptyCount} empty`, _jsx(ChevronDownIcon, { "aria-hidden": "true", className: cn('size-3.5 transition-transform', open && 'rotate-180') })] }))] }));
141
+ return (_jsxs("div", { className: "flex flex-col gap-3", children: [shown.length > 0 && (_jsx("dl", { id: listId, className: "@container/fields flex flex-col divide-y divide-border", children: shown.map((field) => (_jsx(FieldRow, { field: field, place: place }, field.label))) })), emptyCount > 0 && (_jsxs("button", { type: "button", "data-slot": "entity-view-empty-toggle", "aria-expanded": open, "aria-controls": shown.length > 0 ? listId : undefined, onClick: () => setOpen((was) => !was), className: "inline-flex w-fit items-center gap-1 rounded-sm type-label text-muted-foreground underline underline-offset-3 outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 pointer-coarse:min-h-11", children: [open ? 'Hide Empty' : `${emptyCount} Empty`, _jsx(ChevronDownIcon, { "aria-hidden": "true", className: cn('size-3.5 transition-transform', open && 'rotate-180') })] }))] }));
142
142
  }
143
143
  function ViewSection({ section, inRail = false, railFields = 'beside', }) {
144
144
  const headingId = useId();
145
145
  const empty = useContext(EmptyContext);
146
- return (_jsx("section", { "aria-labelledby": headingId, children: _jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx("h2", { id: headingId, className: "type-section-title text-foreground", children: section.title }) }), _jsx(CardContent, { children: 'fields' in section ? (_jsx(FieldList, { fields: section.fields, inRail: inRail, place: !inRail ? 'page' : railFields === 'beside' ? 'railBeside' : 'rail' })) : section.edit?.kind === 'list' ? (_jsxs("div", { className: "flex min-w-0 flex-col gap-2 type-body break-words text-foreground", children: [!isEmptyValue(section.content) && section.content, _jsx(EditableList, { label: section.title, edit: section.edit, emptyLabel: section.emptyLabel ?? empty.text })] })) : (_jsx("div", { className: "min-w-0 type-body break-words text-foreground", children: section.edit ? (_jsx(EditableValue, { label: section.title, edit: section.edit, children: _jsx(OrEmpty, { value: section.content, emptyLabel: section.emptyLabel }) })) : (_jsx(OrEmpty, { value: section.content, emptyLabel: section.emptyLabel })) })) })] }) }));
146
+ return (_jsx("section", { "aria-labelledby": headingId, children: _jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx("h2", { id: headingId, className: "type-section-title text-foreground", children: section.title }) }), _jsx(CardContent, { children: 'fields' in section ? (_jsx(FieldList, { fields: section.fields, place: !inRail ? 'page' : railFields === 'beside' ? 'railBeside' : 'rail' })) : section.edit?.kind === 'list' ? (_jsxs("div", { className: "flex min-w-0 flex-col gap-2 type-body break-words text-foreground", children: [!isEmptyValue(section.content) && section.content, _jsx(EditableList, { label: section.title, edit: section.edit, emptyLabel: section.emptyLabel ?? empty.text })] })) : (_jsx("div", { className: "min-w-0 type-body break-words text-foreground", children: section.edit ? (_jsx(EditableValue, { label: section.title, edit: section.edit, children: _jsx(OrEmpty, { value: section.content, emptyLabel: section.emptyLabel }) })) : (_jsx(OrEmpty, { value: section.content, emptyLabel: section.emptyLabel })) })) })] }) }));
147
147
  }
148
148
  // The rail layout's columns. The view is a container, so the switch to
149
149
  // two columns follows the width the page actually has (the sidebar open
@@ -240,7 +240,7 @@ function MainTabs({ tabs, label }) {
240
240
  };
241
241
  return (_jsxs(Tabs, { value: selected, onValueChange: (value) => select(String(value)), "data-slot": "entity-view-tabs", className: "min-w-0 gap-6", children: [_jsx(TabsList, { variant: "line", activateOnFocus: true, "aria-label": label, className: "h-auto w-full max-w-full justify-start gap-1 overflow-x-auto overflow-y-hidden border-b border-border p-0 [scrollbar-width:thin]", children: tabs.map((tab) => (_jsx(TabsTrigger, { value: tab.slug, className: "h-9 flex-none px-3 text-muted-foreground group-data-horizontal/tabs:after:bottom-0 pointer-coarse:h-11 dark:text-muted-foreground", children: tab.name }, tab.slug))) }), tabs.map((tab) => (_jsx(TabsContent, { value: tab.slug, keepMounted: true, className: "flex min-w-0 flex-col gap-6 [font-size:inherit]", children: tab.sections.map((section) => (_jsx(ViewSection, { section: section }, section.title))) }, tab.slug)))] }));
242
242
  }
243
- export function EntityView({ title, documentTitle, titleEdit, leading, subtitle, badges, actions, notice, strip, sections, footer, layout = 'column', mobileOrder = 'rail-first', railLabel, railFields = 'beside', emptyFields = 'show', emptyText = EMPTY_DASH, printLabel = 'Print notes', printLook = 'icon', isLoading, error, onRetry, back, }) {
243
+ export function EntityView({ title, documentTitle, titleEdit, leading, subtitle, badges, actions, notice, strip, sections, footer, layout = 'column', mobileOrder = 'rail-first', railLabel, railFields = 'beside', emptyFields = 'show', emptyText = EMPTY_DASH, printLabel = 'Print Notes', printLook = 'icon', isLoading, error, onRetry, back, }) {
244
244
  // Editing in place: one store per view, and the leave-page prompt only
245
245
  // while a field is open (or one is always editable).
246
246
  const [store] = useState(() => new EditInPlaceStore());
@@ -256,7 +256,7 @@ export function EntityView({ title, documentTitle, titleEdit, leading, subtitle,
256
256
  if (error?.kind === 'notfound') {
257
257
  // A record that doesn't exist and one that belongs to another user are
258
258
  // the same plain 404, so this never says which. Retrying can't help.
259
- return (_jsxs(Empty, { "data-state": "notfound", children: [_jsxs(EmptyHeader, { children: [_jsx(EmptyMedia, { variant: "icon", children: _jsx(SearchXIcon, {}) }), _jsx(EmptyTitle, { children: "Not found" }), _jsx(EmptyDescription, { children: error.message })] }), _jsx(EmptyContent, { children: dialog ? (_jsxs(Button, { size: "sm", variant: "outline", onClick: dialog.close, children: ["Back to ", back.label] })) : (_jsxs(Button, { size: "sm", variant: "outline", nativeButton: false, render: _jsx(Link, { to: back.to }), children: ["Back to ", back.label] })) })] }));
259
+ return (_jsxs(Empty, { "data-state": "notfound", children: [_jsxs(EmptyHeader, { children: [_jsx(EmptyMedia, { variant: "icon", children: _jsx(SearchXIcon, {}) }), _jsx(EmptyTitle, { children: "Not found" }), _jsx(EmptyDescription, { children: error.message })] }), _jsx(EmptyContent, { children: dialog ? (_jsxs(Button, { size: "sm", variant: "outline", onClick: dialog.close, children: ["Back To ", back.label] })) : (_jsxs(Button, { size: "sm", variant: "outline", nativeButton: false, render: _jsx(Link, { to: back.to }), children: ["Back To ", back.label] })) })] }));
260
260
  }
261
261
  if (error)
262
262
  return _jsx(ErrorState, { error: error, onRetry: onRetry });
@@ -23,5 +23,5 @@ const TITLE_BY_KIND = {
23
23
  };
24
24
  export function ErrorState({ error, onRetry, size = 'default', className, }) {
25
25
  const compact = size === 'compact';
26
- return (_jsxs(Empty, { className: cn(compact && 'gap-3 p-4', className), "data-state": "error", "data-size": size, children: [_jsxs(EmptyHeader, { className: cn(compact && 'gap-1'), children: [compact ? (_jsxs(EmptyTitle, { className: "flex items-center gap-1.5", children: [_jsx(AlertCircleIcon, { "aria-hidden": "true", className: "size-4 shrink-0 text-destructive-text" }), TITLE_BY_KIND[error.kind]] })) : (_jsxs(_Fragment, { children: [_jsx(EmptyMedia, { variant: "icon", children: _jsx(AlertCircleIcon, { className: "text-destructive" }) }), _jsx(EmptyTitle, { children: TITLE_BY_KIND[error.kind] })] })), _jsx(EmptyDescription, { children: error.message })] }), onRetry && (_jsx(EmptyContent, { children: _jsx(Button, { size: "sm", variant: "outline", onClick: onRetry, children: "Try again" }) }))] }));
26
+ return (_jsxs(Empty, { className: cn(compact && 'gap-3 p-4', className), "data-state": "error", "data-size": size, children: [_jsxs(EmptyHeader, { className: cn(compact && 'gap-1'), children: [compact ? (_jsxs(EmptyTitle, { className: "flex items-center gap-1.5", children: [_jsx(AlertCircleIcon, { "aria-hidden": "true", className: "size-4 shrink-0 text-destructive-text" }), TITLE_BY_KIND[error.kind]] })) : (_jsxs(_Fragment, { children: [_jsx(EmptyMedia, { variant: "icon", children: _jsx(AlertCircleIcon, { className: "text-destructive" }) }), _jsx(EmptyTitle, { children: TITLE_BY_KIND[error.kind] })] })), _jsx(EmptyDescription, { children: error.message })] }), onRetry && (_jsx(EmptyContent, { children: _jsx(Button, { size: "sm", variant: "outline", onClick: onRetry, children: "Try Again" }) }))] }));
27
27
  }
@@ -2,8 +2,11 @@
2
2
  // EqualItems (record standard R10), so a fact reads the same wherever a
3
3
  // record shows it.
4
4
  //
5
- // Label beside value from `sm` up; below it (a phone) the label sits
6
- // above its value, so nothing is squeezed into a narrow second column. In
5
+ // Label beside value from `sm` up, once the list itself is 24rem wide;
6
+ // below either (a phone, or a narrow box on a wide screen: a panel, a
7
+ // dialog's column) the label sits above its value, so nothing is squeezed
8
+ // into a narrow second column (4.97: a value column squeezed to nothing
9
+ // cut off an editor's controls, ChoiceButtons' among them). In
7
10
  // the rail the list's own width decides instead (a container query on the
8
11
  // <dl>): label above value in the narrow rail, beside it once the rail's
9
12
  // sections stack full width under the header.
@@ -12,7 +15,7 @@
12
15
  // inside), with a narrower label column, and stacked below that. Each
13
16
  // container query needs an `@container/fields` on the <dl>.
14
17
  export const FIELD_ROW = {
15
- page: 'sm:grid sm:grid-cols-[minmax(--spacing(32),--spacing(48))_1fr] sm:gap-6',
18
+ page: 'sm:@sm/fields:grid sm:@sm/fields:grid-cols-[minmax(--spacing(32),--spacing(48))_minmax(0,1fr)] sm:@sm/fields:gap-6',
16
19
  rail: '@lg/fields:grid @lg/fields:grid-cols-[minmax(--spacing(32),--spacing(48))_1fr] @lg/fields:gap-6',
17
20
  railBeside: '@2xs/fields:grid @2xs/fields:grid-cols-[minmax(--spacing(24),--spacing(28))_minmax(0,1fr)] @2xs/fields:items-baseline @2xs/fields:gap-4 @2xs/fields:py-2.5 @lg/fields:grid-cols-[minmax(--spacing(32),--spacing(48))_1fr] @lg/fields:gap-6',
18
21
  };
@@ -73,7 +73,7 @@ function ownsEnter(element) {
73
73
  return true;
74
74
  return (element.closest('button, a[href], summary, [role=button], [role=link], [role=combobox], [role=listbox], [role=option], [role=menu], [role=menuitem], [role=menuitemradio], [role=menuitemcheckbox], [role=switch], [role=checkbox], [role=radio], [role=tab]') !== null);
75
75
  }
76
- export function FillInQueue({ items, getKey, renderItem, onSave, canSave = true, onSkip, progress, groups, getGroup, saveLabel = 'Save and next', skipLabel = 'Skip', loading = false, error, onRetry, empty = 'Nothing left to fill in', index: indexProp, onIndexChange, className, }) {
76
+ export function FillInQueue({ items, getKey, renderItem, onSave, canSave = true, onSkip, progress, groups, getGroup, saveLabel = 'Save and Next', skipLabel = 'Skip', loading = false, error, onRetry, empty = 'Nothing left to fill in', index: indexProp, onIndexChange, className, }) {
77
77
  const keys = items.map(getKey);
78
78
  const [held, setHeld] = useState(() => ({
79
79
  key: indexProp !== undefined ? (keys[indexProp] ?? null) : null,
@@ -189,7 +189,7 @@ export function FillInQueue({ items, getKey, renderItem, onSave, canSave = true,
189
189
  const counted = groups?.filter((group) => group.progress !== undefined) ?? [];
190
190
  const progressBar = (progress || counted.length > 1) && (_jsxs("div", { className: "flex flex-col gap-1.5", children: [progress && _jsx(ProgressLine, { progress: progress }), counted.length > 1 && (_jsx("ul", { className: "flex flex-wrap gap-x-4 gap-y-1 type-caption text-muted-foreground tabular-nums", "data-slot": "fill-in-queue-groups", children: counted.map((group) => (_jsxs("li", { children: [group.label, " ", group.progress?.done, " of ", group.progress?.total] }, group.id))) }))] }));
191
191
  if (error !== undefined && error !== null && error !== false) {
192
- return (_jsx("div", { "data-slot": "fill-in-queue", "data-state": "error", className: className, children: isAppError(error) ? (_jsx(ErrorState, { error: error, onRetry: onRetry })) : (_jsxs(Empty, { "data-state": "error", children: [_jsxs(EmptyHeader, { children: [_jsx(EmptyTitle, { children: "Something went wrong" }), _jsx(EmptyDescription, { children: error })] }), onRetry && (_jsx(Button, { size: "sm", variant: "outline", onClick: onRetry, children: "Try again" }))] })) }));
192
+ return (_jsx("div", { "data-slot": "fill-in-queue", "data-state": "error", className: className, children: isAppError(error) ? (_jsx(ErrorState, { error: error, onRetry: onRetry })) : (_jsxs(Empty, { "data-state": "error", children: [_jsxs(EmptyHeader, { children: [_jsx(EmptyTitle, { children: "Something went wrong" }), _jsx(EmptyDescription, { children: error })] }), onRetry && (_jsx(Button, { size: "sm", variant: "outline", onClick: onRetry, children: "Try Again" }))] })) }));
193
193
  }
194
194
  if (loading) {
195
195
  return (_jsxs("div", { "data-slot": "fill-in-queue", "data-state": "loading", "aria-busy": "true", className: cn('flex flex-col gap-6', className), children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Skeleton, { className: "h-2 w-full" }), _jsx(Skeleton, { className: "h-4 w-40" })] }), _jsxs("div", { className: "mx-auto flex w-full max-w-[40rem] flex-col gap-4", children: [_jsx(Skeleton, { className: "h-6 w-2/3" }), _jsx(Skeleton, { className: "h-4 w-1/2" }), _jsx(Skeleton, { className: "h-9 w-full" }), _jsx(Skeleton, { className: "h-9 w-full" })] })] }));
@@ -21,7 +21,7 @@ const ANY = '__any__';
21
21
  * "Status: Active" with a value, so the toolbar needs no captions.
22
22
  */
23
23
  export function FilterSelect({ label, options, value, onValueChange, anyLabel, className }) {
24
- const any = anyLabel ?? `Any ${label.toLowerCase()}`;
24
+ const any = anyLabel ?? `Any ${label}`;
25
25
  const picked = options.find((option) => option.value === value);
26
26
  const shown = picked ? `${label}: ${picked.label}` : any;
27
27
  return (_jsxs(Select, { value: picked ? picked.value : ANY, onValueChange: (next) => onValueChange(next === ANY || next === null ? '' : String(next)), children: [_jsx(SelectTrigger, { "aria-label": shown, "data-slot": "filter-select", "data-active": picked ? true : undefined, className: className, children: _jsx(SelectValue, { children: () => shown }) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: ANY, children: any }), options.map((option) => (_jsx(SelectItem, { value: option.value, children: option.label }, option.value)))] })] }));
@@ -50,5 +50,5 @@ export function FormDialog({ title, description, open, onOpenChange, onSubmit, i
50
50
  leaving.current = true;
51
51
  route?.close();
52
52
  }
53
- }, children: [_jsxs(DialogContent, { size: "form", dirty: dirty, "data-slot": "form-dialog", className: cn('gap-0 p-0', className), children: [_jsxs("div", { "data-slot": "form-dialog-header", className: "flex flex-col gap-1 px-4 pt-4 pb-2 pr-12 md:px-6 md:pt-5 md:pr-14", children: [_jsx(DialogTitle, { className: "type-section-title", children: title }), description && _jsx(DialogDescription, { children: description })] }), _jsxs("form", { ref: form, id: formId, onSubmit: onSubmit, noValidate: true, className: "flex min-h-0 flex-1 flex-col", children: [_jsx("div", { "data-slot": "form-dialog-body", className: "min-h-0 flex-1 overflow-y-auto px-4 py-4 md:px-6", children: _jsx(FieldGroup, { children: children }) }), _jsxs("div", { "data-slot": "form-dialog-bar", className: "flex flex-col gap-3 border-t px-4 py-3 pb-[calc(0.75rem+env(safe-area-inset-bottom))] md:px-6 md:pb-3", children: [_jsx("div", { role: "status", className: "empty:hidden", children: submitError && (_jsx(Notice, { tone: "destructive", action: _jsx(Button, { type: "button", size: "sm", variant: "outline", disabled: isSubmitting, onClick: () => (onRetry ? onRetry() : form.current?.requestSubmit()), children: "Try again" }), children: submitError.message })) }), _jsxs("div", { className: "flex justify-end gap-2 max-md:[&>*]:h-10 max-md:[&>*]:flex-1", children: [_jsx(DialogClose, { render: _jsx(Button, { type: "button", variant: "outline", disabled: isSubmitting }), children: "Cancel" }), _jsxs(Button, { type: "submit", disabled: isSubmitting, children: [isSubmitting && _jsx(Spinner, { className: "size-4" }), submitLabel] })] })] })] })] }), route && open === undefined && (_jsx(FormLeaveGuard, { dirty: dirty, letThrough: () => leaving.current || submitting.current }))] }));
53
+ }, children: [_jsxs(DialogContent, { size: "form", dirty: dirty, "data-slot": "form-dialog", className: cn('gap-0 p-0', className), children: [_jsxs("div", { "data-slot": "form-dialog-header", className: "flex flex-col gap-1 px-4 pt-4 pb-2 pr-12 md:px-6 md:pt-5 md:pr-14", children: [_jsx(DialogTitle, { className: "type-section-title", children: title }), description && _jsx(DialogDescription, { children: description })] }), _jsxs("form", { ref: form, id: formId, onSubmit: onSubmit, noValidate: true, className: "flex min-h-0 flex-1 flex-col", children: [_jsx("div", { "data-slot": "form-dialog-body", className: "min-h-0 flex-1 overflow-y-auto px-4 py-4 md:px-6", children: _jsx(FieldGroup, { children: children }) }), _jsxs("div", { "data-slot": "form-dialog-bar", className: "flex flex-col gap-3 border-t px-4 py-3 pb-[calc(0.75rem+env(safe-area-inset-bottom))] md:px-6 md:pb-3", children: [_jsx("div", { role: "status", className: "empty:hidden", children: submitError && (_jsx(Notice, { tone: "destructive", action: _jsx(Button, { type: "button", size: "sm", variant: "outline", disabled: isSubmitting, onClick: () => (onRetry ? onRetry() : form.current?.requestSubmit()), children: "Try Again" }), children: submitError.message })) }), _jsxs("div", { className: "flex justify-end gap-2 max-md:[&>*]:h-10 max-md:[&>*]:flex-1", children: [_jsx(DialogClose, { render: _jsx(Button, { type: "button", variant: "outline", disabled: isSubmitting }), children: "Cancel" }), _jsxs(Button, { type: "submit", disabled: isSubmitting, children: [isSubmitting && _jsx(Spinner, { className: "size-4" }), submitLabel] })] })] })] })] }), route && open === undefined && (_jsx(FormLeaveGuard, { dirty: dirty, letThrough: () => leaving.current || submitting.current }))] }));
54
54
  }
@@ -1,6 +1,6 @@
1
1
  import { type ReactNode } from 'react';
2
2
  export type FormSectionProps = {
3
- /** What the group is ("Reading", "Details"): sentence case, a word or two. */
3
+ /** What the group is ("Reading", "Details"): Title Case, a word or two (design-language.md "Words on screen"). */
4
4
  title: string;
5
5
  /** The group's fields. */
6
6
  children: ReactNode;