@tristan2828/ui-foundation 4.96.0 → 4.98.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 +92 -64
- package/conventions/docs/cell-patterns.md +64 -54
- package/conventions/docs/design-language.md +168 -76
- package/conventions/docs/entity-plan-template.md +15 -21
- 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.d.ts +29 -11
- package/dist/components/app/entity-view.js +106 -29
- 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/key-stats.d.ts +3 -1
- package/dist/components/app/key-stats.js +2 -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-context.d.ts +9 -0
- package/dist/components/app/record-dialog.d.ts +8 -1
- package/dist/components/app/record-dialog.js +19 -3
- 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/status-mark.d.ts +17 -0
- package/dist/components/app/status-mark.js +12 -0
- 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/components/ui/field.d.ts +3 -2
- package/dist/components/ui/field.js +13 -2
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/lib/field-rows.d.ts +3 -1
- package/dist/lib/field-rows.js +24 -6
- package/dist/lib/group-by-day.js +2 -2
- package/dist/lib/status-kinds.d.ts +10 -0
- package/dist/lib/status-kinds.js +33 -0
- 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
- package/styles/index.css +9 -0
|
@@ -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." })] }));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
1
2
|
import { type Location } from 'react-router';
|
|
2
3
|
/**
|
|
3
4
|
* Where a record dialog was opened from: the list's address, and how many
|
|
@@ -29,6 +30,14 @@ export type RecordDialogContextValue = {
|
|
|
29
30
|
titleId: string;
|
|
30
31
|
/** Closes the dialog: back to the list, as Back does. */
|
|
31
32
|
close: () => void;
|
|
33
|
+
/**
|
|
34
|
+
* `card`: a small card dialog (RecordDialogRoute `look="card"`, 8A).
|
|
35
|
+
* EntityView draws the record's title smaller, its sections as plain
|
|
36
|
+
* rows with no cards, and `controls` on the title's line.
|
|
37
|
+
*/
|
|
38
|
+
look?: 'record' | 'card';
|
|
39
|
+
/** The card dialog's own controls (Open full page, Close), for EntityView's title line. */
|
|
40
|
+
controls?: ReactNode;
|
|
32
41
|
};
|
|
33
42
|
export declare const RecordDialogContext: import("react").Context<RecordDialogContextValue | null>;
|
|
34
43
|
/**
|
|
@@ -10,6 +10,13 @@ export type RecordDialogRouteProps = {
|
|
|
10
10
|
label: string;
|
|
11
11
|
/** Extra classes on the dialog's popup. It's 1,120px (`size="record"`) by default. */
|
|
12
12
|
className?: string;
|
|
13
|
+
/**
|
|
14
|
+
* `record` (the default): 1,120px, a bar with Open full page and Close
|
|
15
|
+
* above the record. `card`: a small 420px card for a tiny record (a few
|
|
16
|
+
* fields, no notes), a bottom sheet on a phone, its controls on the
|
|
17
|
+
* title's line and its facts as plain rows.
|
|
18
|
+
*/
|
|
19
|
+
look?: 'record' | 'card';
|
|
13
20
|
/**
|
|
14
21
|
* False: the record has no full page, only this dialog (DataTable's
|
|
15
22
|
* `opens` kind `dialog-only`). No Open full page, and its address opened
|
|
@@ -34,7 +41,7 @@ export type RecordDialogRouteProps = {
|
|
|
34
41
|
*/
|
|
35
42
|
newPath?: string;
|
|
36
43
|
};
|
|
37
|
-
export declare function RecordDialogRoute({ list, label, className, fullPage, listPath: listAt, newPath: newAt, }: RecordDialogRouteProps): import("react").JSX.Element | null;
|
|
44
|
+
export declare function RecordDialogRoute({ list, label, className, look, fullPage, listPath: listAt, newPath: newAt, }: RecordDialogRouteProps): import("react").JSX.Element | null;
|
|
38
45
|
export type RecordLinkProps = Omit<ComponentProps<typeof Link>, 'state'>;
|
|
39
46
|
/**
|
|
40
47
|
* A link to a record that opens it over the current list (a board's card,
|
|
@@ -63,6 +63,13 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
63
63
|
// an EntityView with `layout="rail"` keeps its rail beside the main
|
|
64
64
|
// column, as on its page; a narrower screen stacks them.
|
|
65
65
|
//
|
|
66
|
+
// A tiny record (4.98, record standard 8A: a few fields and no notes)
|
|
67
|
+
// opens as a small card instead, `look="card"`: a 420px dialog (a bottom
|
|
68
|
+
// sheet on a phone, DialogContent `size="confirm"`) with no bar. The
|
|
69
|
+
// record's title, its actions (Delete as an icon), Open full page (an
|
|
70
|
+
// icon, when it has a page) and Close share one line, and its facts are
|
|
71
|
+
// plain rows under it, with no cards.
|
|
72
|
+
//
|
|
66
73
|
// Inside, the record's route renders as it always does. EntityView sees
|
|
67
74
|
// the dialog (useRecordDialog): its heading names the dialog, its back link
|
|
68
75
|
// gives way to the dialog's own bar, and not found's way out closes the
|
|
@@ -77,7 +84,7 @@ import { escapePassedThrough } from './escape-passthrough.js';
|
|
|
77
84
|
import { backgroundOf, NewRecordDialogContext, recordDialogState, RecordDialogContext, } from './record-dialog-context.js';
|
|
78
85
|
// Two paths are the same address, give or take a trailing slash.
|
|
79
86
|
const samePath = (a, b) => a.replace(/\/+$/, '') === b.replace(/\/+$/, '');
|
|
80
|
-
export function RecordDialogRoute({ list, label, className, fullPage = true, listPath: listAt, newPath: newAt, }) {
|
|
87
|
+
export function RecordDialogRoute({ list, label, className, look = 'record', fullPage = true, listPath: listAt, newPath: newAt, }) {
|
|
81
88
|
const location = useLocation();
|
|
82
89
|
const navigationType = useNavigationType();
|
|
83
90
|
const navigate = useNavigate();
|
|
@@ -119,7 +126,16 @@ export function RecordDialogRoute({ list, label, className, fullPage = true, lis
|
|
|
119
126
|
else
|
|
120
127
|
void navigate(-depth);
|
|
121
128
|
}, [navigate, location.key, depth, pathname, search, hash]);
|
|
122
|
-
const
|
|
129
|
+
const card = look === 'card';
|
|
130
|
+
// The card's controls sit on the record's title line (EntityView), so
|
|
131
|
+
// they're built here, where the address and the dialog are.
|
|
132
|
+
const { pathname: atPath, search: atSearch, hash: atHash } = location;
|
|
133
|
+
const dialog = useMemo(() => ({
|
|
134
|
+
titleId,
|
|
135
|
+
close,
|
|
136
|
+
look,
|
|
137
|
+
controls: card ? (_jsxs(_Fragment, { children: [fullPage && (_jsx(Link, { to: { pathname: atPath, search: atSearch, hash: atHash }, replace: true, "aria-label": "Open Full Page", title: "Open Full Page", className: buttonVariants({ variant: 'ghost', size: 'icon-sm' }), children: _jsx(Maximize2Icon, { "aria-hidden": "true" }) })), _jsxs(DialogClose, { render: _jsx(Button, { variant: "ghost", size: "icon-sm" }), children: [_jsx(XIcon, { "aria-hidden": "true" }), _jsx("span", { className: "sr-only", children: "Close" })] })] })) : undefined,
|
|
138
|
+
}), [titleId, close, look, card, fullPage, atPath, atSearch, atHash]);
|
|
123
139
|
// After the save: the new record over the same list, in this entry.
|
|
124
140
|
const created = useMemo(() => ({
|
|
125
141
|
close,
|
|
@@ -145,7 +161,7 @@ export function RecordDialogRoute({ list, label, className, fullPage = true, lis
|
|
|
145
161
|
return;
|
|
146
162
|
}
|
|
147
163
|
close();
|
|
148
|
-
}, children: _jsxs(DialogContent, { showCloseButton: false, "aria-labelledby": titleId, "aria-label": label, "data-slot": "record-dialog", size:
|
|
164
|
+
}, children: _jsxs(DialogContent, { showCloseButton: false, "aria-labelledby": titleId, "aria-label": label, "data-slot": "record-dialog", size: card ? 'confirm' : 'record', "data-look": look, className: cn('gap-0 overflow-hidden p-0 data-closed:hidden', card && 'flex max-h-[calc(100dvh-2rem)] flex-col', className), children: [!card && (_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: cn('min-h-0 overflow-y-auto', card ? 'p-4 pb-[calc(1rem+env(safe-area-inset-bottom))] md:p-5' : 'p-4 sm:p-6'), children: _jsx(RecordDialogContext.Provider, { value: dialog, children: open && outlet }) })] }) })] }));
|
|
149
165
|
}
|
|
150
166
|
/**
|
|
151
167
|
* 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
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { type StatusKind } from '../../lib/status-kinds.js';
|
|
3
|
+
import type { IconComponent } from './icon-component.js';
|
|
4
|
+
export type StatusMarkProps = {
|
|
5
|
+
kind: StatusKind;
|
|
6
|
+
/** The status's own word ("As needed"). Defaults to the kind's (STATUS_KIND_LABELS). */
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
/** This place's own icon, in place of the kind's. */
|
|
9
|
+
icon?: IconComponent;
|
|
10
|
+
className?: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* A status as its kind's icon and colour with its word: a `<span>`, so it
|
|
14
|
+
* goes wherever a badge did (a cell, EntityView's `badges`, an
|
|
15
|
+
* OptionSelect's `render`). The icon is decorative; the word says it.
|
|
16
|
+
*/
|
|
17
|
+
export declare function StatusMark({ kind, children, icon, className }: StatusMarkProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from 'cn';
|
|
3
|
+
import { STATUS_KIND_ICONS, STATUS_KIND_LABELS, STATUS_KIND_TONES, } from '../../lib/status-kinds.js';
|
|
4
|
+
/**
|
|
5
|
+
* A status as its kind's icon and colour with its word: a `<span>`, so it
|
|
6
|
+
* goes wherever a badge did (a cell, EntityView's `badges`, an
|
|
7
|
+
* OptionSelect's `render`). The icon is decorative; the word says it.
|
|
8
|
+
*/
|
|
9
|
+
export function StatusMark({ kind, children, icon, className }) {
|
|
10
|
+
const Icon = icon ?? STATUS_KIND_ICONS[kind];
|
|
11
|
+
return (_jsxs("span", { "data-slot": "status-mark", "data-kind": kind, className: cn('inline-flex min-w-0 items-center gap-1.5 type-label whitespace-nowrap', STATUS_KIND_TONES[kind], className), children: [_jsx(Icon, { "aria-hidden": "true", className: "size-3.5 shrink-0" }), _jsx("span", { className: "min-w-0 truncate", children: children ?? STATUS_KIND_LABELS[kind] })] }));
|
|
12
|
+
}
|
|
@@ -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
|
}
|
|
@@ -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, };
|
|
@@ -21,8 +21,9 @@ declare function Field({ className, orientation, size, solo, kind, ...props }: R
|
|
|
21
21
|
solo?: boolean;
|
|
22
22
|
/**
|
|
23
23
|
* A date or a number: two of a kind stay side by side on a phone.
|
|
24
|
-
*
|
|
25
|
-
*
|
|
24
|
+
* `choice`: two to a row, side by side on a phone while both fit.
|
|
25
|
+
* Found by itself for a date or number `<input>`, DateField (which
|
|
26
|
+
* marks itself, 4.88) and ChoiceButtons; say it for a control of your own.
|
|
26
27
|
*/
|
|
27
28
|
kind?: FieldKind;
|
|
28
29
|
}): import("react").JSX.Element;
|
|
@@ -11,7 +11,9 @@ import { fieldRows } from "../../lib/field-rows.js";
|
|
|
11
11
|
// (`<Field size="s" | "m" | "l">`) share a row, up to three, each as
|
|
12
12
|
// wide as its size; `<Field solo>` keeps a short one alone
|
|
13
13
|
// (lib/field-rows.ts has the rule). Below 48rem each takes its own row
|
|
14
|
-
// but two dates or two numbers.
|
|
14
|
+
// but two dates or two numbers. A choice (a Field holding ChoiceButtons,
|
|
15
|
+
// 4.98) shares a row only with another choice, and two choices stay side
|
|
16
|
+
// by side on a phone while both fit. The rows are worked out from the DOM, so
|
|
15
17
|
// a Field inside the app's own component still counts.
|
|
16
18
|
// - Compact: 14px between fields and 32px controls (40px under 48rem or
|
|
17
19
|
// on a touch screen), from `--control-height`, which FieldGroup sets
|
|
@@ -30,10 +32,14 @@ function FieldLegend({ className, variant = "legend", ...props }) {
|
|
|
30
32
|
// DateField marks its own box (`data-kind="date"`, 4.88).
|
|
31
33
|
const DATE_CONTROL = "input[type=date], [data-kind=date]";
|
|
32
34
|
const NUMBER_CONTROL = "input[type=number], input[inputmode=numeric], input[inputmode=decimal]";
|
|
35
|
+
// A row of choice buttons (ChoiceButtons, 4.98): two to a row (9C).
|
|
36
|
+
const CHOICE_CONTROL = "[data-slot=choice-buttons]";
|
|
33
37
|
function kindOf(field) {
|
|
34
38
|
const said = field.dataset.kind;
|
|
35
|
-
if (said === "date" || said === "number")
|
|
39
|
+
if (said === "date" || said === "number" || said === "choice")
|
|
36
40
|
return said;
|
|
41
|
+
if (field.querySelector(CHOICE_CONTROL))
|
|
42
|
+
return "choice";
|
|
37
43
|
if (field.querySelector(DATE_CONTROL))
|
|
38
44
|
return "date";
|
|
39
45
|
if (field.querySelector(NUMBER_CONTROL))
|
|
@@ -60,6 +66,7 @@ function layOut(group) {
|
|
|
60
66
|
child.style.removeProperty("--field-gaps");
|
|
61
67
|
delete child.dataset.fieldRow;
|
|
62
68
|
delete child.dataset.phonePair;
|
|
69
|
+
delete child.dataset.phoneFit;
|
|
63
70
|
return;
|
|
64
71
|
}
|
|
65
72
|
child.style.setProperty("--field-share", String(place.share));
|
|
@@ -69,6 +76,10 @@ function layOut(group) {
|
|
|
69
76
|
child.dataset.phonePair = "";
|
|
70
77
|
else
|
|
71
78
|
delete child.dataset.phonePair;
|
|
79
|
+
if (place.phoneFit)
|
|
80
|
+
child.dataset.phoneFit = "";
|
|
81
|
+
else
|
|
82
|
+
delete child.dataset.phoneFit;
|
|
72
83
|
});
|
|
73
84
|
}
|
|
74
85
|
function FieldGroup({ className, ref, ...props }) {
|
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 { StatusMark, type StatusMarkProps } from './components/app/status-mark.js';
|
|
26
|
+
export { STATUS_KINDS, STATUS_KIND_ICONS, STATUS_KIND_LABELS, STATUS_KIND_TONES, type StatusKind, } from './lib/status-kinds.js';
|
|
25
27
|
export { EmptyText, type EmptyTextProps } from './components/app/empty-value.js';
|
|
26
28
|
export { isEmptyValue } from './lib/empty-value.js';
|
|
27
29
|
export { IconAction, type IconActionProps } from './components/app/icon-action.js';
|
|
@@ -41,6 +43,7 @@ export { useOffline } from './lib/connection.js';
|
|
|
41
43
|
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';
|
|
42
44
|
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';
|
|
43
45
|
export { linkHost, linkHref, linkRule } from './lib/link-href.js';
|
|
46
|
+
export { TITLE_CASE_SMALL_WORDS, titleCase } from './lib/title-case.js';
|
|
44
47
|
export { DataEnvironmentBanner } from './components/app/data-environment-banner.js';
|
|
45
48
|
export { EditableValue, type EditableValueProps } from './components/app/editable-value.js';
|
|
46
49
|
export { editRowClass, onEditRowClick, SAVED_FOR_MS } from './components/app/edit-row.js';
|
package/dist/index.js
CHANGED
|
@@ -26,6 +26,8 @@ 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
|
+
export { StatusMark } from './components/app/status-mark.js';
|
|
30
|
+
export { STATUS_KINDS, STATUS_KIND_ICONS, STATUS_KIND_LABELS, STATUS_KIND_TONES, } from './lib/status-kinds.js';
|
|
29
31
|
// The record's empty value (4.96): a muted dash read as "Not set", for an
|
|
30
32
|
// app's own strips, summary lines and cells.
|
|
31
33
|
export { EmptyText } from './components/app/empty-value.js';
|
|
@@ -49,6 +51,7 @@ export { useOffline } from './lib/connection.js';
|
|
|
49
51
|
export { editInPlace, } from './components/app/edit-in-place.js';
|
|
50
52
|
export { inPlace, } from './components/app/edit-in-place-presets.js';
|
|
51
53
|
export { linkHost, linkHref, linkRule } from './lib/link-href.js';
|
|
54
|
+
export { TITLE_CASE_SMALL_WORDS, titleCase } from './lib/title-case.js';
|
|
52
55
|
export { DataEnvironmentBanner } from './components/app/data-environment-banner.js';
|
|
53
56
|
export { EditableValue } from './components/app/editable-value.js';
|
|
54
57
|
export { editRowClass, onEditRowClick, SAVED_FOR_MS } from './components/app/edit-row.js';
|
package/dist/lib/field-rows.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type FieldSize = 's' | 'm' | 'l' | 'full';
|
|
2
|
-
export type FieldKind = 'date' | 'number';
|
|
2
|
+
export type FieldKind = 'date' | 'number' | 'choice';
|
|
3
3
|
export type FieldRowItem = {
|
|
4
4
|
size: FieldSize;
|
|
5
5
|
solo?: boolean;
|
|
@@ -12,6 +12,8 @@ export type FieldRowPlace = {
|
|
|
12
12
|
gaps: number;
|
|
13
13
|
/** Stays beside its partner on a phone: two dates or two numbers. */
|
|
14
14
|
phonePair: boolean;
|
|
15
|
+
/** Beside its partner on a phone while both fit, else a row of its own: two choices. */
|
|
16
|
+
phoneFit: boolean;
|
|
15
17
|
};
|
|
16
18
|
/** The most fields one row holds. */
|
|
17
19
|
export declare const FIELDS_PER_ROW = 3;
|