@tristan2828/ui-foundation 4.96.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.
- package/conventions/AGENTS.md +1 -1
- package/conventions/docs/add-an-entity.md +38 -26
- package/conventions/docs/cell-patterns.md +57 -54
- package/conventions/docs/design-language.md +78 -42
- package/conventions/docs/reminders.md +2 -2
- package/conventions/docs/timed-screens.md +1 -1
- package/dist/components/app/action-error.js +1 -1
- package/dist/components/app/allow-reminders.js +1 -1
- package/dist/components/app/app-shell.js +4 -4
- package/dist/components/app/board.js +1 -1
- package/dist/components/app/choice-buttons.js +6 -1
- package/dist/components/app/data-table-tools.js +2 -2
- package/dist/components/app/data-table.js +4 -4
- package/dist/components/app/date-field.js +1 -1
- package/dist/components/app/emoji-field-data.js +7 -7
- package/dist/components/app/entity-form.js +1 -1
- package/dist/components/app/entity-view.js +5 -5
- package/dist/components/app/error-state.js +1 -1
- package/dist/components/app/field-rows.js +6 -3
- package/dist/components/app/fill-in-queue.js +2 -2
- package/dist/components/app/filter-bar.js +1 -1
- package/dist/components/app/form-dialog.js +1 -1
- package/dist/components/app/form-section.d.ts +1 -1
- package/dist/components/app/image-field.js +3 -2
- package/dist/components/app/list-header.js +2 -2
- package/dist/components/app/milkdown-editor.js +4 -4
- package/dist/components/app/month-day-field.js +3 -3
- package/dist/components/app/multi-pick.js +1 -1
- package/dist/components/app/needs-you.js +1 -1
- package/dist/components/app/notes-outline.js +1 -1
- package/dist/components/app/password-input.js +1 -1
- package/dist/components/app/record-dialog.js +1 -1
- package/dist/components/app/rich-text-format-items.js +6 -6
- package/dist/components/app/rich-text-highlight-menu.js +1 -1
- package/dist/components/app/rich-text-table-grips.js +16 -16
- package/dist/components/app/rich-text-toolbar.js +2 -2
- package/dist/components/app/rich-text-widgets.js +2 -2
- package/dist/components/app/secondary-filters.js +2 -2
- package/dist/components/app/session-view.js +1 -1
- package/dist/components/app/timeline.js +1 -1
- package/dist/components/app/widget-layout-sheet.js +1 -1
- package/dist/components/ui/combobox.js +1 -1
- package/dist/components/ui/dialog.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/lib/group-by-day.js +2 -2
- package/dist/lib/title-case.d.ts +13 -0
- package/dist/lib/title-case.js +66 -0
- package/dist/routes/login.js +4 -4
- package/dist/routes/register.js +1 -1
- package/package.json +1 -1
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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(
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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,6 +1,6 @@
|
|
|
1
1
|
export const EMOJI_GROUPS = [
|
|
2
2
|
{
|
|
3
|
-
label: 'Morning and
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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' },
|
|
@@ -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
|
|
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,
|
|
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:
|
|
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,
|
|
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
|
|
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
|
|
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
|
|
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
|
|
6
|
-
//
|
|
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))
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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"):
|
|
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;
|
|
@@ -18,6 +18,7 @@ import { cn } from 'cn';
|
|
|
18
18
|
import { Button } from '../ui/button.js';
|
|
19
19
|
import { Spinner } from '../ui/spinner.js';
|
|
20
20
|
import { acceptAttribute, DEFAULT_IMAGE_TYPES, imageRefusal, uploadFailure } from '../../lib/image-file.js';
|
|
21
|
+
import { titleCase } from '../../lib/title-case.js';
|
|
21
22
|
export function ImageField({ id, value, thumbUrl, onChange, upload, accept = DEFAULT_IMAGE_TYPES, maxSize, noun = 'photo', alt, invalid = false, readOnly = false, onBusyChange, className, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, }) {
|
|
22
23
|
const ids = useId();
|
|
23
24
|
const errorId = `${ids}-error`;
|
|
@@ -91,10 +92,10 @@ export function ImageField({ id, value, thumbUrl, onChange, upload, accept = DEF
|
|
|
91
92
|
input.current?.click();
|
|
92
93
|
};
|
|
93
94
|
const describedBy = [ariaDescribedBy, problem ? errorId : undefined].filter(Boolean).join(' ') || undefined;
|
|
94
|
-
const mainLabel = busy ? `Uploading ${noun}…` : value !== null ? `Replace ${noun}` : `Add ${noun}`;
|
|
95
|
+
const mainLabel = busy ? `Uploading ${noun}…` : value !== null ? `Replace ${titleCase(noun)}` : `Add ${titleCase(noun)}`;
|
|
95
96
|
return (_jsxs("div", { "data-slot": "image-field", role: "group", "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-busy": busy || undefined, className: cn('flex flex-col gap-2', className), children: [_jsxs("div", { className: "flex items-center gap-3", children: [value !== null ? (_jsxs("div", { className: "relative size-24 shrink-0 overflow-hidden rounded-lg border border-border bg-muted", children: [shown ? (_jsx("img", { src: shown, alt: alt ?? `Current ${noun}`, className: "size-full object-cover", onError: () => setBroken(shown) })) : (_jsx("div", { role: "img", "aria-label": alt ?? `Current ${noun}`, className: "flex size-full items-center justify-center text-muted-foreground", children: _jsx(ImageIcon, { "aria-hidden": "true", className: "size-6" }) })), busy && (_jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-background/70", children: _jsx(Spinner, { "aria-hidden": "true", className: "size-5 text-foreground" }) }))] })) : (_jsx("div", { "aria-hidden": "true", onClick: open, className: cn('flex size-24 shrink-0 items-center justify-center rounded-lg border-2 border-dashed border-input text-muted-foreground', !busy && !readOnly && 'cursor-pointer hover:bg-muted'), children: busy ? _jsx(Spinner, { className: "size-5" }) : _jsx(ImagePlusIcon, { className: "size-6" }) })), _jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsxs(Button, { ref: main, id: id, type: "button", variant: "outline", size: "sm", "aria-label": mainLabel, "aria-describedby": describedBy, "aria-invalid": invalid || undefined, disabled: busy || readOnly,
|
|
96
97
|
// Keeps focus through an upload, so it's where it was after.
|
|
97
|
-
focusableWhenDisabled: true, onClick: open, children: [busy ? (_jsx(Spinner, { "aria-hidden": "true" })) : value !== null ? (_jsx(RefreshCwIcon, { "aria-hidden": "true" })) : (_jsx(ImagePlusIcon, { "aria-hidden": "true" })), busy ? 'Uploading…' : value !== null ? 'Replace' : `Add ${noun}`] }), value !== null && (_jsxs(Button, { type: "button", variant: "ghost", size: "sm", "aria-label": `Remove ${noun}`, disabled: busy || readOnly, onClick: remove, children: [_jsx(XIcon, { "aria-hidden": "true" }), "Remove"] }))] })] }), problem && (_jsx("p", { id: errorId, role: "alert", "data-slot": "image-field-error", className: "type-caption text-destructive-text", children: problem })), _jsx("span", { role: "status", className: "sr-only", children: status }), _jsx("input", { ref: input, type: "file", accept: acceptAttribute(accept), hidden: true, tabIndex: -1, onChange: (event) => {
|
|
98
|
+
focusableWhenDisabled: true, onClick: open, children: [busy ? (_jsx(Spinner, { "aria-hidden": "true" })) : value !== null ? (_jsx(RefreshCwIcon, { "aria-hidden": "true" })) : (_jsx(ImagePlusIcon, { "aria-hidden": "true" })), busy ? 'Uploading…' : value !== null ? 'Replace' : `Add ${titleCase(noun)}`] }), value !== null && (_jsxs(Button, { type: "button", variant: "ghost", size: "sm", "aria-label": `Remove ${noun}`, disabled: busy || readOnly, onClick: remove, children: [_jsx(XIcon, { "aria-hidden": "true" }), "Remove"] }))] })] }), problem && (_jsx("p", { id: errorId, role: "alert", "data-slot": "image-field-error", className: "type-caption text-destructive-text", children: problem })), _jsx("span", { role: "status", className: "sr-only", children: status }), _jsx("input", { ref: input, type: "file", accept: acceptAttribute(accept), hidden: true, tabIndex: -1, onChange: (event) => {
|
|
98
99
|
const file = event.target.files?.[0];
|
|
99
100
|
// Cleared, so picking the same file again still counts.
|
|
100
101
|
event.target.value = '';
|
|
@@ -22,6 +22,6 @@ export function ListHeader({ title, count, links = [], newAction, more = [], del
|
|
|
22
22
|
const outLink = links.length === 1 ? links[0] : undefined;
|
|
23
23
|
const menuLinks = links.length > 1 ? links : [];
|
|
24
24
|
const hasMenu = menuLinks.length > 0 || more.length > 0 || deleted !== undefined;
|
|
25
|
-
return (_jsxs("div", { "data-slot": "list-header", className: cn('flex flex-col', className), children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-x-4 gap-y-2", children: [_jsxs("h1", { className: "flex items-baseline gap-2 type-page-title text-foreground", children: [title, count !== undefined && (_jsxs("span", { className: "type-body font-normal tabular-nums text-muted-foreground", children: [_jsx("span", { className: "sr-only", children: ", " }), count] }))] }), _jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [outLink && (_jsxs(Button, { size: "sm", variant: "outline", nativeButton: false, render: _jsx(Link, { to: outLink.to }), children: [outLink.icon && _jsx(outLink.icon, { "aria-hidden": "true" }), outLink.label] })), hasMenu && (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { render: _jsx(Button, { size: "icon-sm", variant: "outline", "aria-label": `More for ${title}`, "data-slot": "list-header-more" }), children: _jsx(EllipsisIcon, { "aria-hidden": "true" }) }), _jsxs(DropdownMenuContent, { align: "end", children: [menuLinks.map((link) => (_jsxs(DropdownMenuItem, { render: _jsx(Link, { to: link.to }), children: [link.icon && _jsx(link.icon, { "aria-hidden": "true" }), link.label] }, link.label))), more.map((action) => (_jsxs(DropdownMenuItem, { onClick: action.onSelect, children: [action.icon && _jsx(action.icon, { "aria-hidden": "true" }), action.label] }, action.label))), deleted && (menuLinks.length > 0 || more.length > 0) && _jsx(DropdownMenuSeparator, {}), deleted && (_jsxs(DropdownMenuCheckboxItem, { closeOnClick: true, checked: deleted.shown, onCheckedChange: deleted.onShownChange, children: [_jsx(Trash2Icon, { "aria-hidden": "true" }), "Show
|
|
26
|
-
(newAction.to !== undefined ? (_jsxs(Button, { size: "sm", nativeButton: false, render: _jsx(Link, { to: newAction.to }), children: [_jsx(PlusIcon, { "aria-hidden": "true" }), newAction.label] })) : (_jsxs(Button, { size: "sm", onClick: newAction.onClick, children: [_jsx(PlusIcon, { "aria-hidden": "true" }), newAction.label] })))] })] }), _jsx("div", { role: "status", "data-slot": "list-header-notice", className: "not-empty:mt-3", children: deleted?.shown && (_jsxs(Notice, { tone: "info", icon: Trash2Icon, action: _jsx(Button, { size: "sm", variant: "outline", onClick: () => deleted.onShownChange(false), children: "Back to the
|
|
25
|
+
return (_jsxs("div", { "data-slot": "list-header", className: cn('flex flex-col', className), children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-x-4 gap-y-2", children: [_jsxs("h1", { className: "flex items-baseline gap-2 type-page-title text-foreground", children: [title, count !== undefined && (_jsxs("span", { className: "type-body font-normal tabular-nums text-muted-foreground", children: [_jsx("span", { className: "sr-only", children: ", " }), count] }))] }), _jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [outLink && (_jsxs(Button, { size: "sm", variant: "outline", nativeButton: false, render: _jsx(Link, { to: outLink.to }), children: [outLink.icon && _jsx(outLink.icon, { "aria-hidden": "true" }), outLink.label] })), hasMenu && (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { render: _jsx(Button, { size: "icon-sm", variant: "outline", "aria-label": `More for ${title}`, "data-slot": "list-header-more" }), children: _jsx(EllipsisIcon, { "aria-hidden": "true" }) }), _jsxs(DropdownMenuContent, { align: "end", children: [menuLinks.map((link) => (_jsxs(DropdownMenuItem, { render: _jsx(Link, { to: link.to }), children: [link.icon && _jsx(link.icon, { "aria-hidden": "true" }), link.label] }, link.label))), more.map((action) => (_jsxs(DropdownMenuItem, { onClick: action.onSelect, children: [action.icon && _jsx(action.icon, { "aria-hidden": "true" }), action.label] }, action.label))), deleted && (menuLinks.length > 0 || more.length > 0) && _jsx(DropdownMenuSeparator, {}), deleted && (_jsxs(DropdownMenuCheckboxItem, { closeOnClick: true, checked: deleted.shown, onCheckedChange: deleted.onShownChange, children: [_jsx(Trash2Icon, { "aria-hidden": "true" }), "Show Deleted"] }))] })] })), newAction &&
|
|
26
|
+
(newAction.to !== undefined ? (_jsxs(Button, { size: "sm", nativeButton: false, render: _jsx(Link, { to: newAction.to }), children: [_jsx(PlusIcon, { "aria-hidden": "true" }), newAction.label] })) : (_jsxs(Button, { size: "sm", onClick: newAction.onClick, children: [_jsx(PlusIcon, { "aria-hidden": "true" }), newAction.label] })))] })] }), _jsx("div", { role: "status", "data-slot": "list-header-notice", className: "not-empty:mt-3", children: deleted?.shown && (_jsxs(Notice, { tone: "info", icon: Trash2Icon, action: _jsx(Button, { size: "sm", variant: "outline", onClick: () => deleted.onShownChange(false), children: "Back to the List" }), children: ["Showing deleted ", deleted.noun ?? 'records', "."] })) })] }));
|
|
27
27
|
}
|
|
@@ -1324,10 +1324,10 @@ function LinkForm({ box, onApply }) {
|
|
|
1324
1324
|
apply();
|
|
1325
1325
|
}
|
|
1326
1326
|
};
|
|
1327
|
-
return (_jsxs(PopoverContent, { anchor: box.anchor, align: "start", "aria-label": box.href ? 'Edit
|
|
1327
|
+
return (_jsxs(PopoverContent, { anchor: box.anchor, align: "start", "aria-label": box.href ? 'Edit Link' : 'Add Link', initialFocus: inputRef, finalFocus: false, className: "w-80", onKeyDown: onKeyDown, children: [_jsxs(Field, { "data-invalid": error ? true : undefined, children: [_jsx(FieldLabel, { htmlFor: inputId, children: "Link Address" }), _jsx(Input, { ref: inputRef, id: inputId, value: typed, placeholder: "https://", autoComplete: "off", "aria-invalid": error ? true : undefined, "aria-describedby": error ? errorId : undefined, onChange: (event) => {
|
|
1328
1328
|
setTyped(event.target.value);
|
|
1329
1329
|
setError(null);
|
|
1330
|
-
} }), error && _jsx(FieldError, { id: errorId, children: error })] }), _jsxs("div", { className: "flex gap-2", children: [_jsx(Button, { size: "sm", onClick: apply, children: "Apply" }), box.href && (_jsx(Button, { size: "sm", variant: "outline", onClick: () => onApply(''), children: "Remove
|
|
1330
|
+
} }), error && _jsx(FieldError, { id: errorId, children: error })] }), _jsxs("div", { className: "flex gap-2", children: [_jsx(Button, { size: "sm", onClick: apply, children: "Apply" }), box.href && (_jsx(Button, { size: "sm", variant: "outline", onClick: () => onApply(''), children: "Remove Link" }))] })] }));
|
|
1331
1331
|
}
|
|
1332
1332
|
// The new page's title box: the title (the selected words to start with),
|
|
1333
1333
|
// and Create page. While the app makes the page it waits, its controls
|
|
@@ -1362,8 +1362,8 @@ function PageForm({ box, busy, onCreate }) {
|
|
|
1362
1362
|
create();
|
|
1363
1363
|
}
|
|
1364
1364
|
};
|
|
1365
|
-
return (_jsxs(PopoverContent, { anchor: box.anchor, align: "start", "aria-label": "New
|
|
1365
|
+
return (_jsxs(PopoverContent, { anchor: box.anchor, align: "start", "aria-label": "New Page", initialFocus: inputRef, finalFocus: false, className: "w-80", "data-rich-text-menu": "", "data-slot": "page-form", onKeyDown: onKeyDown, children: [_jsxs(Field, { "data-invalid": error ? true : undefined, children: [_jsx(FieldLabel, { htmlFor: inputId, children: "Page Title" }), _jsx(Input, { ref: inputRef, id: inputId, value: typed, autoComplete: "off", readOnly: busy, "aria-invalid": error ? true : undefined, "aria-describedby": error ? errorId : undefined, onChange: (event) => {
|
|
1366
1366
|
setTyped(event.target.value);
|
|
1367
1367
|
setError(null);
|
|
1368
|
-
} }), error && _jsx(FieldError, { id: errorId, children: error })] }), _jsx("div", { className: "flex gap-2", children: _jsx(Button, { size: "sm", onClick: create, disabled: busy, children: busy ? 'Creating…' : 'Create
|
|
1368
|
+
} }), error && _jsx(FieldError, { id: errorId, children: error })] }), _jsx("div", { className: "flex gap-2", children: _jsx(Button, { size: "sm", onClick: create, disabled: busy, children: busy ? 'Creating…' : 'Create Page' }) })] }));
|
|
1369
1369
|
}
|
|
@@ -62,7 +62,7 @@ export function MonthDayField({ id, value, onChange, placeholder = 'Pick a day',
|
|
|
62
62
|
onChange(next);
|
|
63
63
|
changeOpen(false);
|
|
64
64
|
};
|
|
65
|
-
return (_jsxs(Popover, { open: open, onOpenChange: changeOpen, modal: modal, children: [_jsxs(PopoverTrigger, { render: _jsx(Button, { id: id, type: "button", variant: "outline", "aria-invalid": invalid || undefined, "aria-readonly": readOnly || undefined, className: cn('w-full justify-start font-normal', !shown && 'text-muted-foreground', className), ...aria }), children: [_jsx(CalendarIcon, { "aria-hidden": "true", className: "size-4" }), shown || placeholder] }), _jsxs(PopoverContent, { ref: popup, className: "w-auto p-0", "data-slot": "month-day-field-picker", "aria-label": "Month and
|
|
65
|
+
return (_jsxs(Popover, { open: open, onOpenChange: changeOpen, modal: modal, children: [_jsxs(PopoverTrigger, { render: _jsx(Button, { id: id, type: "button", variant: "outline", "aria-invalid": invalid || undefined, "aria-readonly": readOnly || undefined, className: cn('w-full justify-start font-normal', !shown && 'text-muted-foreground', className), ...aria }), children: [_jsx(CalendarIcon, { "aria-hidden": "true", className: "size-4" }), shown || placeholder] }), _jsxs(PopoverContent, { ref: popup, className: "w-auto p-0", "data-slot": "month-day-field-picker", "aria-label": "Month and Day",
|
|
66
66
|
// The button the keyboard starts from (the chosen day, else this
|
|
67
67
|
// month): the one the grid makes tabbable. The popup would
|
|
68
68
|
// otherwise take focus itself.
|
|
@@ -122,11 +122,11 @@ function Picker({ selected, locale, onPick }) {
|
|
|
122
122
|
}, children: [_jsx("span", { "aria-hidden": "true", children: monthName(each, 'short', locale) }), _jsx("span", { className: "sr-only", children: monthName(each, 'long', locale) })] }, each));
|
|
123
123
|
}) })] }));
|
|
124
124
|
}
|
|
125
|
-
return (_jsxs("div", { className: "p-3", children: [_jsxs("div", { className: "mb-2 flex items-center justify-between gap-1", children: [_jsx(Button, { type: "button", variant: "ghost", size: "icon", "aria-label": "Previous
|
|
125
|
+
return (_jsxs("div", { className: "p-3", children: [_jsxs("div", { className: "mb-2 flex items-center justify-between gap-1", children: [_jsx(Button, { type: "button", variant: "ghost", size: "icon", "aria-label": "Previous Month", onClick: () => showMonth(nextMonth(month, -1), active), children: _jsx(ChevronLeftIcon, { "aria-hidden": "true" }) }), _jsx(Button, { type: "button", variant: "ghost", className: "font-medium", "aria-label": `${name}, pick another month`, onClick: () => {
|
|
126
126
|
setStep('month');
|
|
127
127
|
setActive(month);
|
|
128
128
|
focusWanted.current = true;
|
|
129
|
-
}, children: name }), _jsx(Button, { type: "button", variant: "ghost", size: "icon", "aria-label": "Next
|
|
129
|
+
}, children: name }), _jsx(Button, { type: "button", variant: "ghost", size: "icon", "aria-label": "Next Month", onClick: () => showMonth(nextMonth(month, 1), active), children: _jsx(ChevronRightIcon, { "aria-hidden": "true" }) })] }), _jsx("div", { ref: grid, role: "group", "aria-label": name, className: "grid grid-cols-7 gap-1", onKeyDown: onGridKeyDown, children: Array.from({ length: days }, (_, index) => {
|
|
130
130
|
const day = index + 1;
|
|
131
131
|
const chosen = selected?.month === month && selected.day === day;
|
|
132
132
|
return (_jsx(Button, { type: "button", variant: chosen ? 'default' : 'ghost', size: "icon", className: "font-normal tabular-nums", "data-cell": day, tabIndex: day === active ? 0 : -1, "aria-label": formatMonthDay(toMonthDay(month, day), { month: 'long', day: 'numeric' }, locale), "aria-pressed": chosen, onClick: () => onPick(month, day), children: day }, day));
|
|
@@ -128,7 +128,7 @@ export function MultiPick({ options, value, onValueChange, onPick, 'aria-label':
|
|
|
128
128
|
const picked = isPicked(option.id);
|
|
129
129
|
const saving = (pending.get(option.id)?.inFlight ?? 0) > 0;
|
|
130
130
|
return (_jsxs(ToggleGroupItem, { value: String(option.id), onPressedChange: (next) => toggle(option, next), "aria-busy": saving || undefined, "aria-describedby": refused.has(option.id) ? errorId(option.id) : undefined, title: option.label, className: "max-w-full min-w-0", children: [option.icon && (_jsx("span", { "aria-hidden": "true", className: "inline-flex shrink-0", children: option.icon })), _jsx("span", { className: "min-w-0 truncate", children: option.label }), _jsx("span", { "aria-hidden": "true", className: "inline-flex size-3.5 shrink-0 items-center justify-center", children: saving ? (_jsx(Spinner, { className: "size-3.5 text-muted-foreground" })) : (picked && _jsx(CheckIcon, { className: "size-3.5" })) })] }, option.id));
|
|
131
|
-
}) })), !loading && capped && hidden > 0 && (_jsxs(Button, { type: "button", variant: "link", size: "sm", className: "h-auto w-fit p-0", "aria-label": `Show
|
|
131
|
+
}) })), !loading && capped && hidden > 0 && (_jsxs(Button, { type: "button", variant: "link", size: "sm", className: "h-auto w-fit p-0", "aria-label": `Show All ${options.length} ${label}`, onClick: () => setShowAll(true), children: ["Show All ", options.length] })), refused.size > 0 && (_jsx(FieldError, { className: "type-caption flex flex-col gap-0.5", children: [...refused].map(([option, reason]) => (_jsx("span", { id: errorId(option), children: reason }, String(option)))) }))] }));
|
|
132
132
|
}
|
|
133
133
|
function without(map, key) {
|
|
134
134
|
if (!map.has(key))
|
|
@@ -18,7 +18,7 @@ const LINE = {
|
|
|
18
18
|
warning: { icon: 'text-warning-text', Icon: TriangleAlertIcon },
|
|
19
19
|
destructive: { icon: 'text-destructive-text', Icon: CircleAlertIcon },
|
|
20
20
|
};
|
|
21
|
-
export function NeedsYou({ items, title = 'Needs
|
|
21
|
+
export function NeedsYou({ items, title = 'Needs You', headingLevel = 2, className }) {
|
|
22
22
|
const headingId = useId();
|
|
23
23
|
if (items.length === 0)
|
|
24
24
|
return null;
|
|
@@ -54,7 +54,7 @@ export function NotesOutline({ markdown, foldKey, depth = 2, minHeadings = 2, 'a
|
|
|
54
54
|
button.focus({ preventScroll: true });
|
|
55
55
|
});
|
|
56
56
|
};
|
|
57
|
-
return (_jsxs("nav", { "aria-label": ariaLabel, "data-slot": "notes-outline", className: cn('flex min-w-0 flex-col gap-2', className), children: [foldable.size > 0 && (_jsxs("div", { className: "flex flex-wrap gap-1", children: [_jsx(Button, { size: "xs", variant: "outline", disabled: allFolded, onClick: () => setFolded(foldable), children: "Fold
|
|
57
|
+
return (_jsxs("nav", { "aria-label": ariaLabel, "data-slot": "notes-outline", className: cn('flex min-w-0 flex-col gap-2', className), children: [foldable.size > 0 && (_jsxs("div", { className: "flex flex-wrap gap-1", children: [_jsx(Button, { size: "xs", variant: "outline", disabled: allFolded, onClick: () => setFolded(foldable), children: "Fold All" }), _jsx(Button, { size: "xs", variant: "outline", disabled: !anyFolded, onClick: () => setFolded(new Set()), children: "Open All" })] })), _jsx("ul", { className: "flex flex-col", children: listed.map((heading) => {
|
|
58
58
|
const isFolded = heading.foldable && folded.has(heading.id);
|
|
59
59
|
return (_jsx("li", { children: _jsxs("button", { type: "button", onClick: () => jump(heading.id), className: cn('flex w-full min-w-0 items-center gap-1 rounded-md py-1 pr-2 text-left type-body text-foreground outline-none hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50', INDENT[Math.min(heading.level - top, INDENT.length - 1)], heading.level > top && 'text-muted-foreground hover:text-foreground'), children: [_jsx("span", { className: "min-w-0 flex-1 truncate", children: heading.text || 'Untitled section' }), isFolded && (_jsxs(_Fragment, { children: [_jsx(ChevronRightIcon, { "aria-hidden": "true", className: "size-3.5 shrink-0 text-muted-foreground" }), _jsx("span", { className: "sr-only", children: " (folded)" })] }))] }) }, heading.id));
|
|
60
60
|
}) })] }));
|
|
@@ -23,7 +23,7 @@ export function PasswordInput({ id, autoComplete, 'aria-invalid': ariaInvalid, .
|
|
|
23
23
|
// reader hears what the button will *do*, not what it is.
|
|
24
24
|
const Icon = isVisible ? EyeOffIcon : EyeIcon;
|
|
25
25
|
const describedById = useId();
|
|
26
|
-
return (_jsxs(InputGroup, { children: [_jsx(InputGroupInput, { id: id, type: isVisible ? 'text' : 'password', autoComplete: autoComplete, "aria-invalid": ariaInvalid, "aria-describedby": describedById, ...props }), _jsx(InputGroupAddon, { align: "inline-end", children: _jsx(InputGroupButton, { type: "button", "aria-label": isVisible ? 'Hide
|
|
26
|
+
return (_jsxs(InputGroup, { children: [_jsx(InputGroupInput, { id: id, type: isVisible ? 'text' : 'password', autoComplete: autoComplete, "aria-invalid": ariaInvalid, "aria-describedby": describedById, ...props }), _jsx(InputGroupAddon, { align: "inline-end", children: _jsx(InputGroupButton, { type: "button", "aria-label": isVisible ? 'Hide Password' : 'Show Password',
|
|
27
27
|
// aria-pressed would also be defensible; the changing label is
|
|
28
28
|
// clearer, and announcing both is redundant.
|
|
29
29
|
onClick: () => setIsVisible((shown) => !shown), children: _jsx(Icon, {}) }) }), _jsx("span", { id: describedById, className: "sr-only", children: "Password is hidden. Use the show password button to reveal it." })] }));
|
|
@@ -145,7 +145,7 @@ export function RecordDialogRoute({ list, label, className, fullPage = true, lis
|
|
|
145
145
|
return;
|
|
146
146
|
}
|
|
147
147
|
close();
|
|
148
|
-
}, children: _jsxs(DialogContent, { showCloseButton: false, "aria-labelledby": titleId, "aria-label": label, "data-slot": "record-dialog", size: "record", className: cn('gap-0 overflow-hidden p-0 data-closed:hidden', className), children: [_jsxs("div", { className: cn('flex items-center gap-2 border-b px-2 py-2', fullPage ? 'justify-between' : 'justify-end'), children: [fullPage && (_jsxs(Link, { to: { pathname: location.pathname, search: location.search, hash: location.hash }, replace: true, className: buttonVariants({ variant: 'ghost', size: 'sm' }), children: [_jsx(Maximize2Icon, { "aria-hidden": "true" }), "Open
|
|
148
|
+
}, children: _jsxs(DialogContent, { showCloseButton: false, "aria-labelledby": titleId, "aria-label": label, "data-slot": "record-dialog", size: "record", className: cn('gap-0 overflow-hidden p-0 data-closed:hidden', className), children: [_jsxs("div", { className: cn('flex items-center gap-2 border-b px-2 py-2', fullPage ? 'justify-between' : 'justify-end'), children: [fullPage && (_jsxs(Link, { to: { pathname: location.pathname, search: location.search, hash: location.hash }, replace: true, className: buttonVariants({ variant: 'ghost', size: 'sm' }), children: [_jsx(Maximize2Icon, { "aria-hidden": "true" }), "Open Full Page"] })), _jsxs(DialogClose, { render: _jsx(Button, { variant: "ghost", size: "icon-sm" }), children: [_jsx(XIcon, { "aria-hidden": "true" }), _jsx("span", { className: "sr-only", children: "Close" })] })] }), _jsx("div", { "data-slot": "record-dialog-body", className: "min-h-0 overflow-y-auto p-4 sm:p-6", children: _jsx(RecordDialogContext.Provider, { value: dialog, children: open && outlet }) })] }) })] }));
|
|
149
149
|
}
|
|
150
150
|
/**
|
|
151
151
|
* A link to a record that opens it over the current list (a board's card,
|