@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.
- package/conventions/AGENTS.md +1 -1
- package/conventions/docs/add-an-entity.md +46 -25
- package/conventions/docs/cell-patterns.md +61 -57
- package/conventions/docs/design-language.md +91 -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/delete-action.d.ts +16 -3
- package/dist/components/app/delete-action.js +21 -4
- package/dist/components/app/emoji-field-data.js +7 -7
- package/dist/components/app/empty-value.d.ts +10 -3
- package/dist/components/app/empty-value.js +3 -8
- 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/module-card.js +2 -1
- 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/overview-page.js +2 -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/value-list.js +2 -1
- package/dist/components/app/widget-card.js +2 -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 +4 -1
- package/dist/index.js +5 -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
|
@@ -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
|
}
|
|
@@ -39,6 +39,7 @@ import { cn } from 'cn';
|
|
|
39
39
|
import { Button } from '../ui/button.js';
|
|
40
40
|
import { Card } from '../ui/card.js';
|
|
41
41
|
import { Skeleton } from '../ui/skeleton.js';
|
|
42
|
+
import { EmptyText } from './empty-value.js';
|
|
42
43
|
// Whole class names per slot, so Tailwind generates them.
|
|
43
44
|
const ICON_CLASS = {
|
|
44
45
|
1: 'text-category-1',
|
|
@@ -94,7 +95,7 @@ function ChipValue({ state, value }) {
|
|
|
94
95
|
if (state === 'loading')
|
|
95
96
|
return (_jsxs(_Fragment, { children: [_jsx(Skeleton, { className: "h-4 w-4" }), _jsx("span", { className: "sr-only", children: "Loading" })] }));
|
|
96
97
|
if (state === 'error')
|
|
97
|
-
return (
|
|
98
|
+
return (_jsx(EmptyText, { label: "Couldn't load" }));
|
|
98
99
|
if (value === undefined)
|
|
99
100
|
return null;
|
|
100
101
|
return (_jsx("span", { "data-slot": "module-card-chip-value", className: "font-semibold tabular-nums", children: value }));
|
|
@@ -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
|
}) })] }));
|
|
@@ -27,6 +27,7 @@ import { Freshness } from './freshness.js';
|
|
|
27
27
|
import { NeedsYou } from './needs-you.js';
|
|
28
28
|
import { WidgetCard, WidgetCardGroup } from './widget-card.js';
|
|
29
29
|
import { Skeleton } from '../ui/skeleton.js';
|
|
30
|
+
import { EmptyText } from './empty-value.js';
|
|
30
31
|
const WIDE_QUERY = '(min-width: 48rem)';
|
|
31
32
|
const canMatchMedia = () => typeof window !== 'undefined' && typeof window.matchMedia === 'function';
|
|
32
33
|
function subscribeWide(listener) {
|
|
@@ -59,5 +60,5 @@ function PartCard({ part }) {
|
|
|
59
60
|
function OverviewTile({ id, part, open, controls, onToggle, }) {
|
|
60
61
|
const { icon: Icon } = part;
|
|
61
62
|
const state = part.error ? 'error' : part.isLoading ? 'loading' : part.empty ? 'empty' : 'success';
|
|
62
|
-
return (_jsxs("button", { type: "button", id: id, "data-slot": "overview-tile", "data-state": state, "aria-expanded": open, "aria-controls": controls, onClick: onToggle, className: cn('glow-edge flex w-full min-w-0 flex-col items-start gap-0.5 rounded-lg bg-card px-3 py-2.5 text-left text-card-foreground', 'shadow-(--card-shadow) ring-1 ring-border outline-none hover:bg-muted', 'focus-visible:ring-3 focus-visible:ring-ring/50 aria-expanded:ring-2 aria-expanded:ring-primary'), children: [_jsxs("span", { className: "flex min-w-0 max-w-full items-center gap-1.5 type-label text-muted-foreground", children: [Icon && _jsx(Icon, { "aria-hidden": "true", className: "size-4 shrink-0 text-link" }), _jsx("span", { className: "truncate", children: part.title })] }), state === 'loading' ? (_jsxs(_Fragment, { children: [_jsx(Skeleton, { "data-state": "loading", className: "my-1 h-6 w-16" }), _jsx("span", { className: "sr-only", children: "Loading" })] })) : state === 'error' ? (
|
|
63
|
+
return (_jsxs("button", { type: "button", id: id, "data-slot": "overview-tile", "data-state": state, "aria-expanded": open, "aria-controls": controls, onClick: onToggle, className: cn('glow-edge flex w-full min-w-0 flex-col items-start gap-0.5 rounded-lg bg-card px-3 py-2.5 text-left text-card-foreground', 'shadow-(--card-shadow) ring-1 ring-border outline-none hover:bg-muted', 'focus-visible:ring-3 focus-visible:ring-ring/50 aria-expanded:ring-2 aria-expanded:ring-primary'), children: [_jsxs("span", { className: "flex min-w-0 max-w-full items-center gap-1.5 type-label text-muted-foreground", children: [Icon && _jsx(Icon, { "aria-hidden": "true", className: "size-4 shrink-0 text-link" }), _jsx("span", { className: "truncate", children: part.title })] }), state === 'loading' ? (_jsxs(_Fragment, { children: [_jsx(Skeleton, { "data-state": "loading", className: "my-1 h-6 w-16" }), _jsx("span", { className: "sr-only", children: "Loading" })] })) : state === 'error' ? (_jsx(EmptyText, { "data-state": "error", label: "Couldn't load", className: "type-numeric text-muted-foreground" })) : state === 'empty' ? (_jsx("span", { "data-state": "empty", className: "py-0.5 type-body text-muted-foreground", children: "Nothing yet" })) : (part.value !== undefined && (_jsx("span", { "data-slot": "overview-tile-value", className: "max-w-full truncate type-numeric text-foreground", children: part.value }))), state === 'success' && part.freshness && _jsx(Freshness, { ...part.freshness })] }));
|
|
63
64
|
}
|
|
@@ -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,
|
|
@@ -23,19 +23,19 @@ export const FORMAT_GROUPS = [
|
|
|
23
23
|
{ id: 'heading1', label: 'Heading 1', icon: Heading1Icon, keys: 'Block+1' },
|
|
24
24
|
{ id: 'heading2', label: 'Heading 2', icon: Heading2Icon, keys: 'Block+2' },
|
|
25
25
|
{ id: 'heading3', label: 'Heading 3', icon: Heading3Icon, keys: 'Block+3' },
|
|
26
|
-
{ id: 'toggleHeading', label: 'Toggle
|
|
26
|
+
{ id: 'toggleHeading', label: 'Toggle Heading', icon: ListCollapseIcon, hint: 'folds what is under it; or type >## ' },
|
|
27
27
|
],
|
|
28
28
|
[
|
|
29
|
-
{ id: 'tasks', label: 'Task
|
|
30
|
-
{ id: 'bullets', label: 'Bulleted
|
|
31
|
-
{ id: 'numbers', label: 'Numbered
|
|
29
|
+
{ id: 'tasks', label: 'Task List', icon: ListChecksIcon, keys: 'Block+4', hint: 'tick an item: Mod+Shift+Enter' },
|
|
30
|
+
{ id: 'bullets', label: 'Bulleted List', icon: ListIcon, keys: 'Block+5' },
|
|
31
|
+
{ id: 'numbers', label: 'Numbered List', icon: ListOrderedIcon, keys: 'Block+6' },
|
|
32
32
|
{ id: 'outdent', label: 'Outdent', icon: IndentDecreaseIcon, hint: 'a list item, one level out', action: true, touch: true },
|
|
33
33
|
{ id: 'indent', label: 'Indent', icon: IndentIncreaseIcon, hint: 'a list item, one level in', action: true, touch: true },
|
|
34
34
|
],
|
|
35
35
|
[
|
|
36
36
|
{ id: 'quote', label: 'Quote', icon: TextQuoteIcon, keys: 'Mod+Shift+B' },
|
|
37
37
|
{ id: 'callout', label: 'Callout', icon: CALLOUT_LOOK.note.icon },
|
|
38
|
-
{ id: 'codeBlock', label: 'Code
|
|
38
|
+
{ id: 'codeBlock', label: 'Code Block', icon: SquareCodeIcon, keys: 'Block+8' },
|
|
39
39
|
{ id: 'divider', label: 'Divider', icon: MinusIcon, hint: 'or type ---' },
|
|
40
40
|
],
|
|
41
41
|
[{ id: 'table', label: 'Table', icon: TableIcon, hint: 'its grips edit it', action: true }],
|
|
@@ -50,7 +50,7 @@ export const FORMAT_ITEMS = new Map(FORMAT_GROUPS.flat().map((item) => [item.id,
|
|
|
50
50
|
*/
|
|
51
51
|
export const TOGGLE_HEADING_VARIANTS = [1, 2, 3].map((level) => ({
|
|
52
52
|
id: `toggleHeading${level}`,
|
|
53
|
-
label: `Toggle
|
|
53
|
+
label: `Toggle Heading ${level}`,
|
|
54
54
|
icon: [Heading1Icon, Heading2Icon, Heading3Icon][level - 1],
|
|
55
55
|
hint: `or type >${'#'.repeat(level)} `,
|
|
56
56
|
}));
|
|
@@ -39,5 +39,5 @@ export function RichTextHighlightMenu({ state, readOnly, tabIndex, onFocus, onKe
|
|
|
39
39
|
onMouseDown: (event) => event.preventDefault(), onFocus: onFocus, onKeyDown: onKeyDown, children: [_jsx(HighlighterIcon, { "aria-hidden": "true" }), _jsx(ChevronDownIcon, { "aria-hidden": "true", className: "size-3" })] }), _jsxs(DropdownMenuContent, { className: "w-44", "data-rich-text-menu": "", finalFocus: finalFocus, children: [_jsx(DropdownMenuRadioGroup, { value: current, onValueChange: (value) => {
|
|
40
40
|
if (HIGHLIGHT_COLORS.includes(value))
|
|
41
41
|
run(`highlight-${value}`);
|
|
42
|
-
}, children: HIGHLIGHT_COLORS.map((color) => (_jsxs(DropdownMenuRadioItem, { value: color, closeOnClick: true, children: [_jsx("span", { "aria-hidden": "true", className: `size-4 shrink-0 rounded-sm border border-foreground/30 ${SWATCH[color]}` }), color[0].toUpperCase() + color.slice(1)] }, color))) }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { disabled: current === null, onClick: () => run('highlight-off'), children: [_jsx(RemoveFormattingIcon, { "aria-hidden": "true" }), "Remove
|
|
42
|
+
}, children: HIGHLIGHT_COLORS.map((color) => (_jsxs(DropdownMenuRadioItem, { value: color, closeOnClick: true, children: [_jsx("span", { "aria-hidden": "true", className: `size-4 shrink-0 rounded-sm border border-foreground/30 ${SWATCH[color]}` }), color[0].toUpperCase() + color.slice(1)] }, color))) }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { disabled: current === null, onClick: () => run('highlight-off'), children: [_jsx(RemoveFormattingIcon, { "aria-hidden": "true" }), "Remove Highlight"] })] })] }));
|
|
43
43
|
}
|
|
@@ -40,22 +40,22 @@ const SWATCH = {
|
|
|
40
40
|
red: 'bg-highlight-red',
|
|
41
41
|
};
|
|
42
42
|
const ROW_ITEMS = [
|
|
43
|
-
{ action: 'rowAbove', label: 'Insert
|
|
44
|
-
{ action: 'rowBelow', label: 'Insert
|
|
45
|
-
{ action: 'moveRowUp', label: 'Move
|
|
46
|
-
{ action: 'moveRowDown', label: 'Move
|
|
47
|
-
{ action: 'deleteRow', label: 'Delete
|
|
43
|
+
{ action: 'rowAbove', label: 'Insert Row Above', icon: BetweenHorizontalStartIcon },
|
|
44
|
+
{ action: 'rowBelow', label: 'Insert Row Below', icon: BetweenHorizontalEndIcon },
|
|
45
|
+
{ action: 'moveRowUp', label: 'Move Row Up', icon: ArrowUpIcon },
|
|
46
|
+
{ action: 'moveRowDown', label: 'Move Row Down', icon: ArrowDownIcon },
|
|
47
|
+
{ action: 'deleteRow', label: 'Delete Row', icon: Trash2Icon },
|
|
48
48
|
];
|
|
49
49
|
const COLUMN_ITEMS = [
|
|
50
|
-
{ action: 'columnLeft', label: 'Insert
|
|
51
|
-
{ action: 'columnRight', label: 'Insert
|
|
52
|
-
{ action: 'moveColumnLeft', label: 'Move
|
|
53
|
-
{ action: 'moveColumnRight', label: 'Move
|
|
54
|
-
{ action: 'deleteColumn', label: 'Delete
|
|
50
|
+
{ action: 'columnLeft', label: 'Insert Column Left', icon: BetweenVerticalStartIcon },
|
|
51
|
+
{ action: 'columnRight', label: 'Insert Column Right', icon: BetweenVerticalEndIcon },
|
|
52
|
+
{ action: 'moveColumnLeft', label: 'Move Column Left', icon: ArrowLeftIcon },
|
|
53
|
+
{ action: 'moveColumnRight', label: 'Move Column Right', icon: ArrowRightIcon },
|
|
54
|
+
{ action: 'deleteColumn', label: 'Delete Column', icon: Trash2Icon },
|
|
55
55
|
];
|
|
56
56
|
const SORT_ITEMS = [
|
|
57
|
-
{ action: 'sortAscending', label: 'Sort
|
|
58
|
-
{ action: 'sortDescending', label: 'Sort
|
|
57
|
+
{ action: 'sortAscending', label: 'Sort Ascending', icon: ArrowDownAZIcon },
|
|
58
|
+
{ action: 'sortDescending', label: 'Sort Descending', icon: ArrowUpZAIcon },
|
|
59
59
|
];
|
|
60
60
|
const ALIGNMENTS = [
|
|
61
61
|
{ value: 'left', action: 'alignLeft', label: 'Left', icon: AlignLeftIcon },
|
|
@@ -309,7 +309,7 @@ export function TableGrips({ view, state, getPos, frame, box, table, readOnly, f
|
|
|
309
309
|
// A cell says its colour; a row's or a column's cells may differ.
|
|
310
310
|
, {
|
|
311
311
|
// A cell says its colour; a row's or a column's cells may differ.
|
|
312
|
-
value: scope === 'cell' ? (current ?? '') : null, onValueChange: (value) => color(scope, HIGHLIGHT_COLORS.includes(value) ? value : null), children: [HIGHLIGHT_COLORS.map((one) => (_jsxs(DropdownMenuRadioItem, { value: one, closeOnClick: true, children: [_jsx("span", { "aria-hidden": "true", className: cn('size-4 shrink-0 rounded-sm border border-foreground/30', SWATCH[one]) }), one[0].toUpperCase() + one.slice(1)] }, one))), _jsxs(DropdownMenuRadioItem, { value: "", closeOnClick: true, children: [_jsx("span", { "aria-hidden": "true", className: "size-4 shrink-0 rounded-sm border border-foreground/30" }), "No
|
|
312
|
+
value: scope === 'cell' ? (current ?? '') : null, onValueChange: (value) => color(scope, HIGHLIGHT_COLORS.includes(value) ? value : null), children: [HIGHLIGHT_COLORS.map((one) => (_jsxs(DropdownMenuRadioItem, { value: one, closeOnClick: true, children: [_jsx("span", { "aria-hidden": "true", className: cn('size-4 shrink-0 rounded-sm border border-foreground/30', SWATCH[one]) }), one[0].toUpperCase() + one.slice(1)] }, one))), _jsxs(DropdownMenuRadioItem, { value: "", closeOnClick: true, children: [_jsx("span", { "aria-hidden": "true", className: "size-4 shrink-0 rounded-sm border border-foreground/30" }), "No Colour"] })] })] }));
|
|
313
313
|
};
|
|
314
314
|
const setWidth = there ? columnWidthAt(there) : null;
|
|
315
315
|
const anyWidth = there ? tableHasWidths(there) : false;
|
|
@@ -318,13 +318,13 @@ export function TableGrips({ view, state, getPos, frame, box, table, readOnly, f
|
|
|
318
318
|
const width = clampColumnWidth(shownWidth(column) + by);
|
|
319
319
|
later(() => onWidth(column, width));
|
|
320
320
|
};
|
|
321
|
-
const columnItems = (withColor, label) => (_jsxs(_Fragment, { children: [_jsxs(DropdownMenuGroup, { children: [label && _jsx(DropdownMenuLabel, { children: label }), items(COLUMN_ITEMS)] }), _jsx(DropdownMenuSeparator, {}), !phone && menuCell && (_jsxs(_Fragment, { children: [_jsxs(DropdownMenuGroup, { children: [_jsxs(DropdownMenuLabel, { children: ["Width: ", setWidth === null ? 'fit to content' : `${setWidth} px`] }), _jsxs(DropdownMenuItem, { disabled: shownWidth(menuCell.column) <= MIN_COLUMN_WIDTH, onClick: () => resize(menuCell.column, -WIDTH_STEP), children: [_jsx(ChevronsRightLeftIcon, { "aria-hidden": "true" }), "Narrower"] }), _jsxs(DropdownMenuItem, { disabled: shownWidth(menuCell.column) >= MAX_COLUMN_WIDTH, onClick: () => resize(menuCell.column, WIDTH_STEP), children: [_jsx(ChevronsLeftRightIcon, { "aria-hidden": "true" }), "Wider"] }), _jsxs(DropdownMenuItem, { disabled: setWidth === null, onClick: () => later(() => onWidth(menuCell.column, null)), children: [_jsx(MoveHorizontalIcon, { "aria-hidden": "true" }), "Fit to
|
|
321
|
+
const columnItems = (withColor, label) => (_jsxs(_Fragment, { children: [_jsxs(DropdownMenuGroup, { children: [label && _jsx(DropdownMenuLabel, { children: label }), items(COLUMN_ITEMS)] }), _jsx(DropdownMenuSeparator, {}), !phone && menuCell && (_jsxs(_Fragment, { children: [_jsxs(DropdownMenuGroup, { children: [_jsxs(DropdownMenuLabel, { children: ["Width: ", setWidth === null ? 'fit to content' : `${setWidth} px`] }), _jsxs(DropdownMenuItem, { disabled: shownWidth(menuCell.column) <= MIN_COLUMN_WIDTH, onClick: () => resize(menuCell.column, -WIDTH_STEP), children: [_jsx(ChevronsRightLeftIcon, { "aria-hidden": "true" }), "Narrower"] }), _jsxs(DropdownMenuItem, { disabled: shownWidth(menuCell.column) >= MAX_COLUMN_WIDTH, onClick: () => resize(menuCell.column, WIDTH_STEP), children: [_jsx(ChevronsLeftRightIcon, { "aria-hidden": "true" }), "Wider"] }), _jsxs(DropdownMenuItem, { disabled: setWidth === null, onClick: () => later(() => onWidth(menuCell.column, null)), children: [_jsx(MoveHorizontalIcon, { "aria-hidden": "true" }), "Fit to Content"] }), _jsxs(DropdownMenuItem, { disabled: !anyWidth, onClick: () => later(() => onWidth(menuCell.column, 'all')), children: [_jsx(Columns3Icon, { "aria-hidden": "true" }), "Fit All Columns"] })] }), _jsx(DropdownMenuSeparator, {})] })), _jsxs(DropdownMenuGroup, { children: [_jsx(DropdownMenuLabel, { children: "Align Column" }), _jsx(DropdownMenuRadioGroup, { value: there ? columnAlignment(there) : 'left', onValueChange: (value) => {
|
|
322
322
|
const one = ALIGNMENTS.find((alignment) => alignment.value === value);
|
|
323
323
|
if (one)
|
|
324
324
|
run(one.action);
|
|
325
|
-
}, children: ALIGNMENTS.map(({ value, label, icon: Icon }) => (_jsxs(DropdownMenuRadioItem, { value: value, closeOnClick: true, children: [_jsx(Icon, { "aria-hidden": "true" }), label] }, value))) })] }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuGroup, { children: items(SORT_ITEMS) }), menuCell?.column === 0 && (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuCheckboxItem, { checked: there ? headerColumnOn(there) : false, disabled: !enabled('headerColumn'), onCheckedChange: () => run('headerColumn'), closeOnClick: true, children: [_jsx(PanelLeftIcon, { "aria-hidden": "true" }), "Header
|
|
325
|
+
}, children: ALIGNMENTS.map(({ value, label, icon: Icon }) => (_jsxs(DropdownMenuRadioItem, { value: value, closeOnClick: true, children: [_jsx(Icon, { "aria-hidden": "true" }), label] }, value))) })] }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuGroup, { children: items(SORT_ITEMS) }), menuCell?.column === 0 && (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuCheckboxItem, { checked: there ? headerColumnOn(there) : false, disabled: !enabled('headerColumn'), onCheckedChange: () => run('headerColumn'), closeOnClick: true, children: [_jsx(PanelLeftIcon, { "aria-hidden": "true" }), "Header Column"] })] })), withColor && there && tableColorEnabled(there, 'column') && (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), colorGroup('column', 'Colour Column')] })), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { onClick: () => run('deleteTable'), children: [_jsx(Trash2Icon, { "aria-hidden": "true" }), "Delete Table"] })] }));
|
|
326
326
|
const rowColor = there && tableColorEnabled(there, 'row');
|
|
327
327
|
const finalFocus = () => text() ?? true;
|
|
328
328
|
const grip = 'pointer-events-auto absolute flex items-center justify-center rounded-sm border border-border bg-muted text-muted-foreground shadow-xs outline-none hover:bg-primary hover:text-primary-foreground data-popup-open:bg-primary data-popup-open:text-primary-foreground';
|
|
329
|
-
return (_jsxs(_Fragment, { children: [!phone && (_jsxs("div", { ref: edgeHandle, hidden: true, "aria-hidden": "true", "data-slot": "rich-text-table-column-edge", className: "pointer-events-auto absolute z-10 flex w-3 -translate-x-1/2 cursor-col-resize touch-none justify-center", onPointerDown: startDrag, onDoubleClick: () => edge !== null && onWidth(edge, null), children: [_jsx("span", { className: "h-full w-0.5 bg-primary" }), drag && (_jsx("span", { "data-slot": "rich-text-table-column-size", className: "absolute bottom-full mb-1 rounded-sm bg-primary px-1.5 font-mono text-xs whitespace-nowrap text-primary-foreground tabular-nums", children: drag.label }))] })), _jsxs(DropdownMenu, { open: open === 'column' || open === 'cell', onOpenChange: openMenu('column'), children: [_jsx(DropdownMenuTrigger, { tabIndex: -1, "aria-label": menuCell ? `Column: ${columnName(menuCell.column)}` : 'Column', ref: columnGrip, "data-slot": "rich-text-table-column-grip", className: cn(grip, 'h-3.5 w-6 -translate-x-1/2 -translate-y-1/2'), children: _jsx(GripHorizontalIcon, { "aria-hidden": "true", className: "size-3" }) }), _jsx(DropdownMenuContent, { className: "w-56", "data-rich-text-menu": "", finalFocus: finalFocus, children: open === 'cell' ? (_jsxs(_Fragment, { children: [menuCell && menuCell.row > 0 && (_jsxs(_Fragment, { children: [colorGroup('cell', 'Cell
|
|
329
|
+
return (_jsxs(_Fragment, { children: [!phone && (_jsxs("div", { ref: edgeHandle, hidden: true, "aria-hidden": "true", "data-slot": "rich-text-table-column-edge", className: "pointer-events-auto absolute z-10 flex w-3 -translate-x-1/2 cursor-col-resize touch-none justify-center", onPointerDown: startDrag, onDoubleClick: () => edge !== null && onWidth(edge, null), children: [_jsx("span", { className: "h-full w-0.5 bg-primary" }), drag && (_jsx("span", { "data-slot": "rich-text-table-column-size", className: "absolute bottom-full mb-1 rounded-sm bg-primary px-1.5 font-mono text-xs whitespace-nowrap text-primary-foreground tabular-nums", children: drag.label }))] })), _jsxs(DropdownMenu, { open: open === 'column' || open === 'cell', onOpenChange: openMenu('column'), children: [_jsx(DropdownMenuTrigger, { tabIndex: -1, "aria-label": menuCell ? `Column: ${columnName(menuCell.column)}` : 'Column', ref: columnGrip, "data-slot": "rich-text-table-column-grip", className: cn(grip, 'h-3.5 w-6 -translate-x-1/2 -translate-y-1/2'), children: _jsx(GripHorizontalIcon, { "aria-hidden": "true", className: "size-3" }) }), _jsx(DropdownMenuContent, { className: "w-56", "data-rich-text-menu": "", finalFocus: finalFocus, children: open === 'cell' ? (_jsxs(_Fragment, { children: [menuCell && menuCell.row > 0 && (_jsxs(_Fragment, { children: [colorGroup('cell', 'Cell Colour'), _jsx(DropdownMenuSeparator, {})] })), _jsxs(DropdownMenuGroup, { children: [_jsx(DropdownMenuLabel, { children: "Row" }), items(ROW_ITEMS)] }), _jsx(DropdownMenuSeparator, {}), columnItems(false, menuCell ? `Column: ${columnName(menuCell.column)}` : 'Column')] })) : (columnItems(true)) })] }), _jsxs(DropdownMenu, { open: open === 'row', onOpenChange: openMenu('row'), children: [_jsx(DropdownMenuTrigger, { tabIndex: -1, "aria-label": menuCell ? (menuCell.row === 0 ? 'Header Row' : `Row ${menuCell.row}`) : 'Row', ref: rowGrip, "data-slot": "rich-text-table-row-grip", className: cn(grip, 'h-6 w-3.5 -translate-x-1/2 -translate-y-1/2'), children: _jsx(GripVerticalIcon, { "aria-hidden": "true", className: "size-3" }) }), _jsxs(DropdownMenuContent, { className: "w-56", "data-rich-text-menu": "", finalFocus: finalFocus, children: [_jsx(DropdownMenuGroup, { children: items(ROW_ITEMS) }), rowColor && (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), colorGroup('row', 'Colour Row')] }))] })] })] }));
|
|
330
330
|
}
|
|
@@ -109,11 +109,11 @@ export function FormatButtons({ formats, state, readOnly, onFormat, onPage, onIm
|
|
|
109
109
|
onMouseDown: (event) => event.preventDefault(), onFocus: () => setCurrent(index), onKeyDown: onKeyDown, onPressedChange: () => onFormat(item.id) }), children: _jsx(Icon, {}) }), _jsx(TooltipContent, { children: tip })] }, item.id));
|
|
110
110
|
})] }, groupIndex))), onPage && (_jsxs(_Fragment, { children: [_jsx(Separator, { orientation: "vertical", className: "mx-1 h-5 self-center" }), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { render: _jsx(Button, { ref: (element) => {
|
|
111
111
|
buttons.current[pageIndex] = element;
|
|
112
|
-
}, variant: "ghost", size: "icon-sm", "aria-label": "Turn
|
|
112
|
+
}, variant: "ghost", size: "icon-sm", "aria-label": "Turn Into Page", disabled: readOnly, tabIndex: pageIndex === current ? 0 : -1, onMouseDown: (event) => event.preventDefault(), onFocus: () => setCurrent(pageIndex), onKeyDown: onKeyDown, onClick: onPage }), children: _jsx(FileTextIcon, {}) }), _jsx(TooltipContent, { children: "Turn Into Page \u00B7 a new page named for the words, linked here" })] })] })), onImage && (_jsxs(_Fragment, { children: [_jsx(Separator, { orientation: "vertical", className: "mx-1 h-5 self-center" }), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { render: _jsx(Button, { ref: (element) => {
|
|
113
113
|
buttons.current[imageIndex] = element;
|
|
114
114
|
}, variant: "ghost", size: "icon-sm", "aria-label": "Image", disabled: readOnly, tabIndex: imageIndex === current ? 0 : -1, onMouseDown: (event) => event.preventDefault(), onFocus: () => setCurrent(imageIndex), onKeyDown: onKeyDown, onClick: onImage }), children: _jsx(ImageIcon, {}) }), _jsx(TooltipContent, { children: "Image \u00B7 or paste or drop one" })] })] })), onFullScreen && (_jsxs(_Fragment, { children: [_jsx(Separator, { orientation: "vertical", className: "mx-1 h-5 self-center" }), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { render: _jsx(Toggle, { ref: (element) => {
|
|
115
115
|
buttons.current[fullScreenIndex] = element;
|
|
116
|
-
}, size: "icon-sm", "aria-label": "Full
|
|
116
|
+
}, size: "icon-sm", "aria-label": "Full Screen", pressed: fullScreen, tabIndex: fullScreenIndex === current ? 0 : -1, className: "aria-pressed:bg-muted aria-pressed:text-foreground", onMouseDown: (event) => event.preventDefault(), onFocus: () => setCurrent(fullScreenIndex), onKeyDown: onKeyDown, onPressedChange: onFullScreen }), children: fullScreen ? _jsx(Minimize2Icon, {}) : _jsx(Maximize2Icon, {}) }), _jsx(TooltipContent, { children: fullScreen ? 'Leave Full Screen · Esc' : 'Full Screen' })] })] }))] }));
|
|
117
117
|
}
|
|
118
118
|
export function RichTextToolbar({ state, readOnly, controls, onFormat, onImage, onFullScreen, fullScreen, text, ref }) {
|
|
119
119
|
return (_jsx("div", { ref: ref, role: "toolbar", "aria-label": "Formatting", "aria-controls": controls, "data-slot": "rich-text-toolbar", className: "flex flex-wrap items-center gap-0.5 border-b border-input px-1 py-1", children: _jsx(FormatButtons, { formats: "all", state: state, readOnly: readOnly, onFormat: onFormat, onImage: onImage, onFullScreen: onFullScreen, fullScreen: fullScreen, text: text }) }));
|
|
@@ -23,12 +23,12 @@ export function CalloutKindMenu({ kind, readOnly, onPick, onRemove, text }) {
|
|
|
23
23
|
return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { tabIndex: -1, disabled: readOnly, "aria-label": `${look.label} callout: change its kind`, "data-slot": "rich-text-callout-kind", className: "flex size-5 items-center justify-center rounded-md outline-none hover:bg-foreground/10 focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none", children: _jsx(Icon, { "aria-hidden": "true", className: cn('size-4', look.tint) }) }), _jsxs(DropdownMenuContent, { className: "w-44", finalFocus: () => text() ?? true, children: [_jsx(DropdownMenuRadioGroup, { value: kind, onValueChange: (value) => onPick(value), children: CALLOUT_KINDS.map((one) => {
|
|
24
24
|
const OneIcon = CALLOUT_LOOK[one].icon;
|
|
25
25
|
return (_jsxs(DropdownMenuRadioItem, { value: one, closeOnClick: true, children: [_jsx(OneIcon, { "aria-hidden": "true", className: CALLOUT_LOOK[one].tint }), CALLOUT_LOOK[one].label] }, one));
|
|
26
|
-
}) }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuItem, { onClick: onRemove, children: "Remove
|
|
26
|
+
}) }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuItem, { onClick: onRemove, children: "Remove Callout" })] })] }));
|
|
27
27
|
}
|
|
28
28
|
export function TableBar({ side, active, readOnly, onAdd }) {
|
|
29
29
|
if (readOnly)
|
|
30
30
|
return null;
|
|
31
|
-
return (_jsx("button", { type: "button", tabIndex: -1, "aria-label": side === 'row' ? 'Add a
|
|
31
|
+
return (_jsx("button", { type: "button", tabIndex: -1, "aria-label": side === 'row' ? 'Add a Row' : 'Add a Column', "data-slot": `rich-text-table-add-${side}`, className: cn('flex flex-1 items-center justify-center rounded-md text-muted-foreground transition-opacity hover:bg-muted hover:text-foreground', 'opacity-0 group-hover/table:opacity-100', active && 'opacity-100'),
|
|
32
32
|
// A press keeps focus in the text: the caret moves into the new cell.
|
|
33
33
|
onMouseDown: (event) => event.preventDefault(), onClick: onAdd, children: _jsx(PlusIcon, { "aria-hidden": "true", className: "size-3.5" }) }));
|
|
34
34
|
}
|
|
@@ -28,6 +28,6 @@ export function SecondaryFilters({ children, active, onClear, label = 'Filters',
|
|
|
28
28
|
const [open, setOpen] = useState(false);
|
|
29
29
|
const count = active.length;
|
|
30
30
|
const trigger = (_jsxs(Button, { variant: "outline", children: [_jsx(SlidersHorizontalIcon, { "aria-hidden": "true" }), _jsxs("span", { children: [label, count > 0 && _jsx("span", { className: "text-[0px]", children: "," })] }), count > 0 && (_jsxs(_Fragment, { children: [_jsx("span", { className: "rounded-full bg-primary px-1.5 type-caption text-primary-foreground tabular-nums", children: count }), _jsx("span", { className: "sr-only", children: " active" })] }))] }));
|
|
31
|
-
const footer = (_jsxs("div", { className: "flex justify-end gap-2", children: [_jsx(Button, { variant: "ghost", size: "sm", disabled: count === 0, onClick: onClear, children: "Clear
|
|
32
|
-
return (_jsxs("div", { "data-slot": "secondary-filters", className: cn('flex flex-wrap items-center gap-2', className), children: [isMobile ? (_jsxs(Sheet, { open: open, onOpenChange: setOpen, children: [_jsx(SheetTrigger, { render: trigger }), _jsxs(SheetContent, { side: "bottom", className: "max-h-[85svh] overflow-y-auto", children: [_jsx(SheetHeader, { children: _jsx(SheetTitle, { children: label }) }), _jsx("div", { className: "flex flex-col gap-3 px-4 [&>*]:w-full", children: children }), _jsx(SheetFooter, { children: footer })] })] })) : (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { render: trigger }), _jsxs(PopoverContent, { align: "start", className: "w-auto min-w-64 gap-3 p-3", children: [_jsx(PopoverTitle, { children: label }), _jsx("div", { className: "flex flex-col gap-3", children: children }), footer] })] })), active.map((filter) => (_jsxs("span", { "data-slot": "secondary-filter-chip", className: "inline-flex h-7 items-center gap-0.5 rounded-md bg-muted pr-0.5 pl-2 type-caption text-foreground", children: [filter.label, _jsx(Button, { variant: "ghost", size: "icon-xs", "aria-label": `Remove filter: ${filter.label}`, onClick: filter.onRemove, children: _jsx(XIcon, { "aria-hidden": "true" }) })] }, filter.id))), count > 1 && (_jsx(Button, { variant: "ghost", size: "sm", onClick: onClear, children: "Clear
|
|
31
|
+
const footer = (_jsxs("div", { className: "flex justify-end gap-2", children: [_jsx(Button, { variant: "ghost", size: "sm", disabled: count === 0, onClick: onClear, children: "Clear Filters" }), _jsx(Button, { size: "sm", onClick: () => setOpen(false), children: "Done" })] }));
|
|
32
|
+
return (_jsxs("div", { "data-slot": "secondary-filters", className: cn('flex flex-wrap items-center gap-2', className), children: [isMobile ? (_jsxs(Sheet, { open: open, onOpenChange: setOpen, children: [_jsx(SheetTrigger, { render: trigger }), _jsxs(SheetContent, { side: "bottom", className: "max-h-[85svh] overflow-y-auto", children: [_jsx(SheetHeader, { children: _jsx(SheetTitle, { children: label }) }), _jsx("div", { className: "flex flex-col gap-3 px-4 [&>*]:w-full", children: children }), _jsx(SheetFooter, { children: footer })] })] })) : (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { render: trigger }), _jsxs(PopoverContent, { align: "start", className: "w-auto min-w-64 gap-3 p-3", children: [_jsx(PopoverTitle, { children: label }), _jsx("div", { className: "flex flex-col gap-3", children: children }), footer] })] })), active.map((filter) => (_jsxs("span", { "data-slot": "secondary-filter-chip", className: "inline-flex h-7 items-center gap-0.5 rounded-md bg-muted pr-0.5 pl-2 type-caption text-foreground", children: [filter.label, _jsx(Button, { variant: "ghost", size: "icon-xs", "aria-label": `Remove filter: ${filter.label}`, onClick: filter.onRemove, children: _jsx(XIcon, { "aria-hidden": "true" }) })] }, filter.id))), count > 1 && (_jsx(Button, { variant: "ghost", size: "sm", onClick: onClear, children: "Clear Filters" }))] }));
|
|
33
33
|
}
|
|
@@ -26,7 +26,7 @@ export function SessionView({ open, onOpenChange, title, children, keepAwake = f
|
|
|
26
26
|
// theme.css's .dark block remaps the tokens for this subtree only.
|
|
27
27
|
dark && 'dark scheme-dark',
|
|
28
28
|
// The insets are 0 unless the page's viewport meta has viewport-fit=cover.
|
|
29
|
-
'pt-[env(safe-area-inset-top)] pr-[env(safe-area-inset-right)] pb-[env(safe-area-inset-bottom)] pl-[env(safe-area-inset-left)]', 'duration-150 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0'), children: [_jsxs("header", { className: "flex items-center gap-1 px-4 py-2", children: [_jsx(DialogTitle, { className: "min-w-0 flex-1 truncate type-section-title", children: title }), fullscreenControl && fullscreen.supported && (_jsx(Button, { variant: "ghost", size: "icon", "aria-label": "Full
|
|
29
|
+
'pt-[env(safe-area-inset-top)] pr-[env(safe-area-inset-right)] pb-[env(safe-area-inset-bottom)] pl-[env(safe-area-inset-left)]', 'duration-150 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0'), children: [_jsxs("header", { className: "flex items-center gap-1 px-4 py-2", children: [_jsx(DialogTitle, { className: "min-w-0 flex-1 truncate type-section-title", children: title }), fullscreenControl && fullscreen.supported && (_jsx(Button, { variant: "ghost", size: "icon", "aria-label": "Full Screen", "aria-pressed": fullscreen.active, onClick: fullscreen.toggle, children: fullscreen.active ? _jsx(Minimize2Icon, {}) : _jsx(Maximize2Icon, {}) })), _jsx(DialogClose, { render: _jsx(Button, { variant: "ghost", size: "icon", "aria-label": "Close" }), children: _jsx(XIcon, {}) })] }), _jsx("div", { className: cn('flex min-h-0 flex-1 flex-col overflow-auto px-4 pb-4', className), children: children })] }) }) }));
|
|
30
30
|
}
|
|
31
31
|
// The whole page in the browser's fullscreen (not the view's own element:
|
|
32
32
|
// popups inside the view portal to <body>, and would vanish outside a
|
|
@@ -27,5 +27,5 @@ export function Timeline({ items, initial = 5, label, emptyText = 'Nothing yet',
|
|
|
27
27
|
const limit = Math.max(1, initial);
|
|
28
28
|
const folds = items.length > limit;
|
|
29
29
|
const shown = folds && !all ? items.slice(0, limit) : items;
|
|
30
|
-
return (_jsxs("div", { "data-slot": "timeline", className: cn('@container flex min-w-0 flex-col gap-2', className), children: [_jsx("ol", { id: listId, "aria-label": label, className: "flex flex-col", children: shown.map((item, index) => (_jsxs("li", { "data-slot": "timeline-item", className: "grid grid-cols-[5.5rem_1rem_minmax(0,1fr)] gap-x-2 @max-[24rem]:grid-cols-[1rem_minmax(0,1fr)]", children: [_jsx("div", { className: "col-start-1 row-start-1 pt-px text-right type-caption tabular-nums text-muted-foreground @max-[24rem]:col-start-2 @max-[24rem]:text-left", children: item.dateTime ? _jsx("time", { dateTime: item.dateTime, children: item.date }) : item.date }), _jsxs("div", { "aria-hidden": "true", className: "col-start-2 row-start-1 flex flex-col items-center @max-[24rem]:col-start-1 @max-[24rem]:row-span-2", children: [_jsx("span", { className: "mt-1.5 size-2 shrink-0 rounded-full bg-primary" }), index < shown.length - 1 && _jsx("span", { className: "w-px flex-1 bg-border" })] }), _jsxs("div", { className: "col-start-3 row-start-1 flex min-w-0 items-start gap-2 pb-3 @max-[24rem]:col-start-2 @max-[24rem]:row-start-2", children: [_jsxs("div", { className: "min-w-0 flex-1 type-body text-foreground", children: [_jsx("div", { className: "break-words", children: item.body }), item.kind && _jsx("div", { className: "type-caption text-muted-foreground", children: item.kind })] }), item.edit && _jsx("div", { className: "shrink-0", children: item.edit })] })] }, item.id))) }), folds && (_jsx(Button, { variant: "link", size: "sm", "aria-expanded": all, "aria-controls": listId, onClick: () => setAll(!all), className: "self-start", children: all ? 'Show
|
|
30
|
+
return (_jsxs("div", { "data-slot": "timeline", className: cn('@container flex min-w-0 flex-col gap-2', className), children: [_jsx("ol", { id: listId, "aria-label": label, className: "flex flex-col", children: shown.map((item, index) => (_jsxs("li", { "data-slot": "timeline-item", className: "grid grid-cols-[5.5rem_1rem_minmax(0,1fr)] gap-x-2 @max-[24rem]:grid-cols-[1rem_minmax(0,1fr)]", children: [_jsx("div", { className: "col-start-1 row-start-1 pt-px text-right type-caption tabular-nums text-muted-foreground @max-[24rem]:col-start-2 @max-[24rem]:text-left", children: item.dateTime ? _jsx("time", { dateTime: item.dateTime, children: item.date }) : item.date }), _jsxs("div", { "aria-hidden": "true", className: "col-start-2 row-start-1 flex flex-col items-center @max-[24rem]:col-start-1 @max-[24rem]:row-span-2", children: [_jsx("span", { className: "mt-1.5 size-2 shrink-0 rounded-full bg-primary" }), index < shown.length - 1 && _jsx("span", { className: "w-px flex-1 bg-border" })] }), _jsxs("div", { className: "col-start-3 row-start-1 flex min-w-0 items-start gap-2 pb-3 @max-[24rem]:col-start-2 @max-[24rem]:row-start-2", children: [_jsxs("div", { className: "min-w-0 flex-1 type-body text-foreground", children: [_jsx("div", { className: "break-words", children: item.body }), item.kind && _jsx("div", { className: "type-caption text-muted-foreground", children: item.kind })] }), item.edit && _jsx("div", { className: "shrink-0", children: item.edit })] })] }, item.id))) }), folds && (_jsx(Button, { variant: "link", size: "sm", "aria-expanded": all, "aria-controls": listId, onClick: () => setAll(!all), className: "self-start", children: all ? 'Show Fewer' : `Show All ${items.length}` }))] }));
|
|
31
31
|
}
|
|
@@ -2,9 +2,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { cn } from 'cn';
|
|
3
3
|
import { Badge } from '../ui/badge.js';
|
|
4
4
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../ui/tooltip.js';
|
|
5
|
+
import { EmptyText } from './empty-value.js';
|
|
5
6
|
export function ValueList({ items, max = 2, className }) {
|
|
6
7
|
if (items.length === 0) {
|
|
7
|
-
return (
|
|
8
|
+
return (_jsx(EmptyText, { "data-slot": "value-list", "data-state": "empty", label: "None", className: cn('text-muted-foreground', className) }));
|
|
8
9
|
}
|
|
9
10
|
const shown = items.slice(0, Math.max(0, max));
|
|
10
11
|
const folded = items.slice(shown.length);
|
|
@@ -75,6 +75,7 @@ import { Card, CardContent, CardHeader } from '../ui/card.js';
|
|
|
75
75
|
import { Skeleton } from '../ui/skeleton.js';
|
|
76
76
|
import { useIsMobile } from '../../hooks/use-mobile.js';
|
|
77
77
|
import { useRememberedFlag } from '../../hooks/use-remembered-flag.js';
|
|
78
|
+
import { EmptyText } from './empty-value.js';
|
|
78
79
|
const HEADER_LINK_CLASS = 'shrink-0 rounded-sm type-label text-foreground underline underline-offset-4 outline-none ' +
|
|
79
80
|
'hover:decoration-2 focus-visible:ring-3 focus-visible:ring-ring/50';
|
|
80
81
|
export function WidgetCard({ id, title, icon: Icon, to, value, line, freshness, headingLevel = 2, link, isLoading, error, onRetry, isEmpty, emptyMessage, empty, skeletonRows = 3, collapsible = false, defaultCollapsed = false, storageKey, summary: ownSummary, emptySummary, children, className, }) {
|
|
@@ -115,7 +116,7 @@ function WidgetCardSummary({ state, summary, emptySummary, }) {
|
|
|
115
116
|
return (_jsxs(_Fragment, { children: [_jsx(Skeleton, { "data-state": "loading", className: "h-4 w-8" }), _jsx("span", { className: "sr-only", children: "Loading" })] }));
|
|
116
117
|
}
|
|
117
118
|
if (state === 'error') {
|
|
118
|
-
return (
|
|
119
|
+
return (_jsx(EmptyText, { "data-state": "error", label: "Couldn't load", className: "type-label text-muted-foreground" }));
|
|
119
120
|
}
|
|
120
121
|
if (state === 'empty') {
|
|
121
122
|
return emptySummary === undefined ? null : (_jsx("span", { "data-state": "empty", className: "type-label text-muted-foreground", children: emptySummary }));
|
|
@@ -19,7 +19,7 @@ import { cn } from 'cn';
|
|
|
19
19
|
import { Button } from '../ui/button.js';
|
|
20
20
|
import { Sheet, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, } from '../ui/sheet.js';
|
|
21
21
|
import { Switch } from '../ui/switch.js';
|
|
22
|
-
export function WidgetLayoutSheet({ layout, titles, title = 'Customize
|
|
22
|
+
export function WidgetLayoutSheet({ layout, titles, title = 'Customize This Page', description = 'Order the cards, and hide the ones you don’t need.', triggerLabel = 'Customize', open, defaultOpen, onOpenChange, trigger = true, side = 'right', className, }) {
|
|
23
23
|
const listRef = useRef(null);
|
|
24
24
|
const [moved, setMoved] = useState(null);
|
|
25
25
|
const [announcement, setAnnouncement] = useState('');
|
|
@@ -11,7 +11,7 @@ function ComboboxValue({ ...props }) {
|
|
|
11
11
|
return _jsx(ComboboxPrimitive.Value, { "data-slot": "combobox-value", ...props });
|
|
12
12
|
}
|
|
13
13
|
function ComboboxTrigger({ className, children, ...props }) {
|
|
14
|
-
return (_jsxs(ComboboxPrimitive.Trigger, { "data-slot": "combobox-trigger", "aria-label": "Show
|
|
14
|
+
return (_jsxs(ComboboxPrimitive.Trigger, { "data-slot": "combobox-trigger", "aria-label": "Show Options", className: cn("[&_svg:not([class*='size-'])]:size-4", className), ...props, children: [children, _jsx(ChevronDownIcon, { className: "pointer-events-none size-4 text-muted-foreground" })] }));
|
|
15
15
|
}
|
|
16
16
|
function ComboboxClear({ className, ...props }) {
|
|
17
17
|
return (_jsx(ComboboxPrimitive.Clear, { "data-slot": "combobox-clear", "aria-label": "Clear", render: _jsx(InputGroupButton, { variant: "ghost", size: "icon-xs" }), className: cn(className), ...props, children: _jsx(XIcon, { className: "pointer-events-none" }) }));
|
|
@@ -89,6 +89,6 @@ function DiscardChangesDialog({ open, onKeepEditing, onDiscard, description = "W
|
|
|
89
89
|
return (_jsx(DialogGuardContext.Provider, { value: null, children: _jsx(DialogPrimitive.Root, { open: open, onOpenChange: (next) => {
|
|
90
90
|
if (!next)
|
|
91
91
|
onKeepEditing();
|
|
92
|
-
}, children: _jsxs(DialogContent, { size: "confirm", showCloseButton: false, "data-discard-changes": "", ...props, children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Discard your changes?" }), _jsx(DialogDescription, { children: description })] }), _jsxs(DialogFooter, { children: [_jsx(DialogClose, { render: _jsx(Button, { variant: "outline" }), children: "Keep
|
|
92
|
+
}, children: _jsxs(DialogContent, { size: "confirm", showCloseButton: false, "data-discard-changes": "", ...props, children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Discard your changes?" }), _jsx(DialogDescription, { children: description })] }), _jsxs(DialogFooter, { children: [_jsx(DialogClose, { render: _jsx(Button, { variant: "outline" }), children: "Keep Editing" }), _jsx(Button, { variant: "destructive", onClick: onDiscard, children: "Discard" })] })] }) }) }));
|
|
93
93
|
}
|
|
94
94
|
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DiscardChangesDialog, };
|
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ export { ChoiceButtons, type ChoiceButtonsOption, type ChoiceButtonsProps } from
|
|
|
22
22
|
export { ReferenceCombobox, type ReferenceComboboxProps, type ReferenceRecord } from './components/app/reference-combobox.js';
|
|
23
23
|
export { fieldRows, type FieldKind, type FieldRowItem, type FieldRowPlace, type FieldSize } from './lib/field-rows.js';
|
|
24
24
|
export { KeyStats, type KeyStat, type KeyStatsProps } from './components/app/key-stats.js';
|
|
25
|
+
export { EmptyText, type EmptyTextProps } from './components/app/empty-value.js';
|
|
26
|
+
export { isEmptyValue } from './lib/empty-value.js';
|
|
25
27
|
export { IconAction, type IconActionProps } from './components/app/icon-action.js';
|
|
26
28
|
export { EntityView, type EntityViewEmptyFields, type EntityViewField, type EntityViewLayout, type EntityViewMobileOrder, type EntityViewPlacement, type EntityViewProps, type EntityViewRailFields, type EntityViewSection, } from './components/app/entity-view.js';
|
|
27
29
|
export { entityViewTabSlug } from './lib/entity-view-tab.js';
|
|
@@ -29,7 +31,7 @@ export { usePrinting } from './components/app/print-context.js';
|
|
|
29
31
|
export { RecordDialogRoute, RecordLink, type RecordDialogRouteProps, type RecordLinkProps, } from './components/app/record-dialog.js';
|
|
30
32
|
export { recordDialogState, useNewRecordDialog, useOpenRecord, useRecordDialog, type NewRecordDialogContextValue, type RecordDialogBackground, type RecordDialogContextValue, type RecordDialogState, } from './components/app/record-dialog-context.js';
|
|
31
33
|
export { FormDialog, type FormDialogProps } from './components/app/form-dialog.js';
|
|
32
|
-
export { DeleteAction, type DeleteActionProps, type DeleteKind } from './components/app/delete-action.js';
|
|
34
|
+
export { DeleteAction, type DeleteActionProps, type DeleteKind, type DeleteReason } from './components/app/delete-action.js';
|
|
33
35
|
export { notify, doneMessage, pastTense, type NotifyDoneOptions } from './components/app/notify.js';
|
|
34
36
|
export { useAction, type ActionOutcome, type ActionState, type UseActionOptions } from './hooks/use-action.js';
|
|
35
37
|
export { ActionError, type ActionErrorProps } from './components/app/action-error.js';
|
|
@@ -39,6 +41,7 @@ export { useOffline } from './lib/connection.js';
|
|
|
39
41
|
export { editInPlace, type EditControlProps, type EditInPlace, type EditInPlaceList, type EditInPlaceListOptions, type EditInPlaceOptions, type EditKind, type EditListAddProps, type EditListItemProps, } from './components/app/edit-in-place.js';
|
|
40
42
|
export { inPlace, type InPlaceDateConfig, type InPlaceFieldsOptions, type InPlaceLinkConfig, type InPlaceLinkValue, type InPlaceMoneyConfig, type InPlaceMonthDayConfig, type InPlaceNumberConfig, type InPlaceOption, type InPlacePart, type InPlaceRecord, type InPlaceRecurrenceConfig, type InPlaceReferenceConfig, type InPlaceSaved, type InPlaceSelectConfig, type InPlaceTextConfig, } from './components/app/edit-in-place-presets.js';
|
|
41
43
|
export { linkHost, linkHref, linkRule } from './lib/link-href.js';
|
|
44
|
+
export { TITLE_CASE_SMALL_WORDS, titleCase } from './lib/title-case.js';
|
|
42
45
|
export { DataEnvironmentBanner } from './components/app/data-environment-banner.js';
|
|
43
46
|
export { EditableValue, type EditableValueProps } from './components/app/editable-value.js';
|
|
44
47
|
export { editRowClass, onEditRowClick, SAVED_FOR_MS } from './components/app/edit-row.js';
|
package/dist/index.js
CHANGED
|
@@ -26,6 +26,10 @@ export { ChoiceButtons } from './components/app/choice-buttons.js';
|
|
|
26
26
|
export { ReferenceCombobox } from './components/app/reference-combobox.js';
|
|
27
27
|
export { fieldRows } from './lib/field-rows.js';
|
|
28
28
|
export { KeyStats } from './components/app/key-stats.js';
|
|
29
|
+
// The record's empty value (4.96): a muted dash read as "Not set", for an
|
|
30
|
+
// app's own strips, summary lines and cells.
|
|
31
|
+
export { EmptyText } from './components/app/empty-value.js';
|
|
32
|
+
export { isEmptyValue } from './lib/empty-value.js';
|
|
29
33
|
export { IconAction } from './components/app/icon-action.js';
|
|
30
34
|
export { EntityView, } from './components/app/entity-view.js';
|
|
31
35
|
export { entityViewTabSlug } from './lib/entity-view-tab.js';
|
|
@@ -45,6 +49,7 @@ export { useOffline } from './lib/connection.js';
|
|
|
45
49
|
export { editInPlace, } from './components/app/edit-in-place.js';
|
|
46
50
|
export { inPlace, } from './components/app/edit-in-place-presets.js';
|
|
47
51
|
export { linkHost, linkHref, linkRule } from './lib/link-href.js';
|
|
52
|
+
export { TITLE_CASE_SMALL_WORDS, titleCase } from './lib/title-case.js';
|
|
48
53
|
export { DataEnvironmentBanner } from './components/app/data-environment-banner.js';
|
|
49
54
|
export { EditableValue } from './components/app/editable-value.js';
|
|
50
55
|
export { editRowClass, onEditRowClick, SAVED_FOR_MS } from './components/app/edit-row.js';
|