@tristan2828/ui-foundation 4.137.1 → 4.137.2
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/docs/cell-patterns.md +1 -1
- package/dist/components/app/app-shell-bottom-bar.js +1 -1
- package/dist/components/app/color-field.js +1 -1
- package/dist/components/app/emoji-field.js +1 -1
- package/dist/components/app/image-viewer.js +1 -1
- package/dist/components/app/list-header.d.ts +1 -1
- package/dist/components/app/list-header.js +2 -2
- package/dist/components/app/month-calendar.js +1 -1
- package/dist/components/app/rich-text-editor.d.ts +1 -1
- package/dist/components/app/rich-text-floating-toolbar.js +1 -1
- package/dist/components/app/rich-text-tools-bar.js +1 -1
- package/package.json +1 -1
|
@@ -1185,7 +1185,7 @@ const price = editInPlace({
|
|
|
1185
1185
|
saved by it), and on a touch screen or under 768px it carries Indent
|
|
1186
1186
|
and Outdent for list items, where there is no Tab. A field with only the
|
|
1187
1187
|
floating toolbar (`inline` notes, and notes on a form) gets the same
|
|
1188
|
-
two in a small "Editor
|
|
1188
|
+
two in a small "Editor Tools" strip over its corner while it has focus,
|
|
1189
1189
|
with the Image button too when the editor has `upload`. On a touch screen the
|
|
1190
1190
|
toolbar is instead one row pinned to the top of the keyboard while the
|
|
1191
1191
|
field has focus (Aa for every format, in the keyboard's place; the list
|
|
@@ -109,7 +109,7 @@ export function BottomBar({ items, nav, activeTo, navLook = 'list', }) {
|
|
|
109
109
|
const tiles = openItem !== undefined && bottomBarTiles(openItem, section, navLook);
|
|
110
110
|
// The current entry's pages show under the tiles when the section's own look is tiles.
|
|
111
111
|
const withPages = (section?.look ?? navLook) === 'tiles';
|
|
112
|
-
return (_jsxs(_Fragment, { children: [_jsx("nav", { "aria-label": "Bottom
|
|
112
|
+
return (_jsxs(_Fragment, { children: [_jsx("nav", { "aria-label": "Bottom Bar", "data-slot": "app-shell-bottom-bar", className: "fixed inset-x-0 bottom-0 z-20 border-t border-border bg-background pb-[env(safe-area-inset-bottom)] md:hidden", children: _jsx("ul", { className: "flex h-16 items-stretch gap-1 px-2 py-1.5", children: shown.map((item, index) => {
|
|
113
113
|
const isCurrent = index === current;
|
|
114
114
|
const { count, countLabel } = bottomBarCount(item, nav);
|
|
115
115
|
if ('to' in item) {
|
|
@@ -72,7 +72,7 @@ export function ColorField({ id, value, onChange, onBlur, colors = COLOR_CHOICES
|
|
|
72
72
|
if (!event.currentTarget.contains(event.relatedTarget))
|
|
73
73
|
onBlur?.();
|
|
74
74
|
};
|
|
75
|
-
return (_jsx("div", { "data-slot": "color-field", className: cn('min-w-0', className), onBlur: leave, children: _jsxs(RadioGroup, { id: id, value: picked, onValueChange: choose, disabled: disabled, "aria-invalid": invalid || undefined, className: cn('grid grid-cols-[repeat(auto-fill,minmax(7.5rem,1fr))] gap-1 rounded-md', invalid && 'ring-3 ring-destructive/20 dark:ring-destructive/40'), ...aria, children: [colors.map((choice, at) => (_jsxs("label", { "data-slot": "color-field-choice", className: CHOICE, children: [_jsx(RadioGroupItem, { value: String(at), "aria-invalid": invalid || undefined }), _jsx(ColorSwatch, { color: choice.color, label: choice.name })] }, `${choice.name}-${at}`))), _jsxs("div", { "data-slot": "color-field-custom", className: "col-span-full flex min-w-0 flex-wrap items-center gap-2", children: [_jsxs("label", { className: cn(CHOICE, 'w-fit'), onClick: openPicker, children: [_jsx(RadioGroupItem, { value: CUSTOM, "aria-invalid": invalid || undefined }), "Custom"] }), _jsx("input", { ref: picker, type: "color", "data-slot": "color-field-picker", "aria-label": "Custom
|
|
75
|
+
return (_jsx("div", { "data-slot": "color-field", className: cn('min-w-0', className), onBlur: leave, children: _jsxs(RadioGroup, { id: id, value: picked, onValueChange: choose, disabled: disabled, "aria-invalid": invalid || undefined, className: cn('grid grid-cols-[repeat(auto-fill,minmax(7.5rem,1fr))] gap-1 rounded-md', invalid && 'ring-3 ring-destructive/20 dark:ring-destructive/40'), ...aria, children: [colors.map((choice, at) => (_jsxs("label", { "data-slot": "color-field-choice", className: CHOICE, children: [_jsx(RadioGroupItem, { value: String(at), "aria-invalid": invalid || undefined }), _jsx(ColorSwatch, { color: choice.color, label: choice.name })] }, `${choice.name}-${at}`))), _jsxs("div", { "data-slot": "color-field-custom", className: "col-span-full flex min-w-0 flex-wrap items-center gap-2", children: [_jsxs("label", { className: cn(CHOICE, 'w-fit'), onClick: openPicker, children: [_jsx(RadioGroupItem, { value: CUSTOM, "aria-invalid": invalid || undefined }), "Custom"] }), _jsx("input", { ref: picker, type: "color", "data-slot": "color-field-picker", "aria-label": "Custom Colour", value: pickerHex(value), disabled: disabled, onChange: (event) => {
|
|
76
76
|
const color = storedColor(event.target.value);
|
|
77
77
|
if (!color)
|
|
78
78
|
return;
|
|
@@ -26,5 +26,5 @@ export function EmojiField({ id, value, onChange, placeholder = 'Pick an emoji',
|
|
|
26
26
|
onChange(next);
|
|
27
27
|
changeOpen(false);
|
|
28
28
|
};
|
|
29
|
-
return (_jsxs(Popover, { open: open, onOpenChange: changeOpen, children: [_jsx(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', !value && 'text-muted-foreground', className), ...aria }), children: value ? (_jsx("span", { className: "text-base leading-none", children: value })) : (_jsxs(_Fragment, { children: [_jsx(SmilePlus, { "aria-hidden": "true", className: "size-4" }), placeholder] })) }), _jsxs(PopoverContent, { className: "w-72 gap-2 p-2", align: "start", "data-slot": "emoji-field-popup", "aria-label": "Emoji", children: [_jsx(Input, { type: "search", autoComplete: "off", "aria-label": "Search
|
|
29
|
+
return (_jsxs(Popover, { open: open, onOpenChange: changeOpen, children: [_jsx(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', !value && 'text-muted-foreground', className), ...aria }), children: value ? (_jsx("span", { className: "text-base leading-none", children: value })) : (_jsxs(_Fragment, { children: [_jsx(SmilePlus, { "aria-hidden": "true", className: "size-4" }), placeholder] })) }), _jsxs(PopoverContent, { className: "w-72 gap-2 p-2", align: "start", "data-slot": "emoji-field-popup", "aria-label": "Emoji", children: [_jsx(Input, { type: "search", autoComplete: "off", "aria-label": "Search Emoji", placeholder: "Search", value: query, onChange: (event) => setQuery(event.target.value) }), _jsx("div", { className: "max-h-64 overflow-y-auto", children: groups.length === 0 ? (_jsxs("p", { className: "p-2 text-sm text-muted-foreground", children: ["No emoji match \"", query.trim(), "\"."] })) : (groups.map((group) => (_jsxs("section", { "aria-label": group.label, className: "mb-2 last:mb-0", children: [_jsx("h3", { className: "px-1 py-1 text-xs font-medium text-muted-foreground", children: group.label }), _jsx("div", { className: "grid grid-cols-7 gap-0.5", children: group.emojis.map((entry) => (_jsx("button", { type: "button", "aria-label": entry.name, title: entry.name, "aria-pressed": entry.emoji === value, onClick: () => pick(entry.emoji), className: "flex size-8 items-center justify-center rounded-md text-xl leading-none outline-none hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50 aria-pressed:bg-accent", children: entry.emoji }, entry.emoji))) })] }, group.label)))) }), clearable && value && (_jsx("div", { className: "border-t border-border pt-2", children: _jsx(Button, { type: "button", variant: "ghost", size: "sm", className: "w-full", onClick: () => pick(''), children: "Clear" }) }))] })] }));
|
|
30
30
|
}
|
|
@@ -118,7 +118,7 @@ function ViewerImage({ image }) {
|
|
|
118
118
|
if (element?.complete)
|
|
119
119
|
setState(element.naturalWidth > 0 ? 'loaded' : 'failed');
|
|
120
120
|
}, []);
|
|
121
|
-
return (_jsxs("div", { className: "absolute inset-x-4 inset-y-2 md:inset-x-20 md:inset-y-4", "data-state": state, children: [state !== 'failed' && (_jsx("img", { ref: seeIfDone, src: image.src, alt: image.alt, decoding: "async", draggable: false, onLoad: () => setState('loaded'), onError: () => setState('failed'), className: cn('size-full object-contain transition-opacity duration-150', state === 'loading' && 'opacity-0') }, attempt)), state === 'loading' && (_jsx("div", { "data-slot": "image-viewer-loading", className: "absolute inset-0 flex items-center justify-center", children: _jsx(Spinner, { className: "size-8 text-muted-foreground", "aria-label": "Loading
|
|
121
|
+
return (_jsxs("div", { className: "absolute inset-x-4 inset-y-2 md:inset-x-20 md:inset-y-4", "data-state": state, children: [state !== 'failed' && (_jsx("img", { ref: seeIfDone, src: image.src, alt: image.alt, decoding: "async", draggable: false, onLoad: () => setState('loaded'), onError: () => setState('failed'), className: cn('size-full object-contain transition-opacity duration-150', state === 'loading' && 'opacity-0') }, attempt)), state === 'loading' && (_jsx("div", { "data-slot": "image-viewer-loading", className: "absolute inset-0 flex items-center justify-center", children: _jsx(Spinner, { className: "size-8 text-muted-foreground", "aria-label": "Loading Image" }) })), state === 'failed' && (_jsxs("div", { "data-slot": "image-viewer-error", role: "alert", className: "absolute inset-0 flex flex-col items-center justify-center gap-3 p-4 text-center", children: [_jsx(ImageOffIcon, { "aria-hidden": true, className: "size-10 text-muted-foreground" }), _jsx("p", { className: "type-body text-foreground", children: "This image couldn\u2019t be loaded." }), _jsx("p", { className: "max-w-prose type-caption text-muted-foreground", children: image.alt }), _jsx(Button, { variant: "outline", onClick: () => {
|
|
122
122
|
setAttempt((n) => n + 1);
|
|
123
123
|
setState('loading');
|
|
124
124
|
}, children: "Try Again" })] }))] }));
|
|
@@ -72,7 +72,7 @@ export type ListHeaderProps = {
|
|
|
72
72
|
/** The page's other actions (Export, Import), in ⋯ after the folded links. */
|
|
73
73
|
more?: readonly ListHeaderAction[];
|
|
74
74
|
/**
|
|
75
|
-
* Soft-deleted records, for a list that has them: "Show
|
|
75
|
+
* Soft-deleted records, for a list that has them: "Show Deleted" in ⋯,
|
|
76
76
|
* and the notice while it is on. `noun` completes "Showing deleted
|
|
77
77
|
* <noun>" (default "records").
|
|
78
78
|
*/
|
|
@@ -4,7 +4,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
4
4
|
// The related screens (Board, Change log) stay out as buttons while
|
|
5
5
|
// there's one; two or more fold into the menu with the page's other
|
|
6
6
|
// extras, so the row is the same on a list with no siblings and one with
|
|
7
|
-
// four. "Show
|
|
7
|
+
// four. "Show Deleted" is the menu's last item, and while it's on a notice
|
|
8
8
|
// says so with "Back to the list", so the ⋯ menu and the notice are one
|
|
9
9
|
// component and a list can't show deleted records without saying so.
|
|
10
10
|
//
|
|
@@ -16,7 +16,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
16
16
|
// one thing seen three ways (Exercises / Targets / Weak spots): links in a
|
|
17
17
|
// segmented row, the one on marked as the current page. They're the
|
|
18
18
|
// page's own peers, so they aren't in ⋯, which keeps only what's left
|
|
19
|
-
// (Show
|
|
19
|
+
// (Show Deleted). On a phone the switch takes its own line under the
|
|
20
20
|
// title and scrolls sideways if it must.
|
|
21
21
|
//
|
|
22
22
|
// `secondaryAction` is one more button, beside New and before it, for a
|
|
@@ -144,7 +144,7 @@ export function MonthCalendar({ label, items = [], today, selected, onSelect, mo
|
|
|
144
144
|
}
|
|
145
145
|
const dayLabel = (day) => formatPlainDate(day, { weekday: 'long', month: 'long', day: 'numeric' }, locale);
|
|
146
146
|
const pickedItems = byDay.get(picked) ?? [];
|
|
147
|
-
return (_jsxs("div", { "data-slot": "month-calendar", className: cn('flex min-w-0 flex-col gap-3', className), children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("h2", { className: "mr-auto type-body font-semibold text-foreground", "aria-live": "polite", children: monthName }), _jsx(Button, { variant: "outline", size: "icon-sm", "aria-label": "Previous
|
|
147
|
+
return (_jsxs("div", { "data-slot": "month-calendar", className: cn('flex min-w-0 flex-col gap-3', className), children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("h2", { className: "mr-auto type-body font-semibold text-foreground", "aria-live": "polite", children: monthName }), _jsx(Button, { variant: "outline", size: "icon-sm", "aria-label": "Previous Month", onClick: () => showMonth(shiftMonth(shown, -1)), children: _jsx(ChevronLeftIcon, { "aria-hidden": "true" }) }), _jsx(Button, { variant: "outline", size: "sm", onClick: () => pick(today), children: "Today" }), _jsx(Button, { variant: "outline", size: "icon-sm", "aria-label": "Next Month", onClick: () => showMonth(shiftMonth(shown, 1)), children: _jsx(ChevronRightIcon, { "aria-hidden": "true" }) })] }), error ? (_jsx(ErrorState, { error: error, onRetry: onRetry })) : (_jsxs(_Fragment, { children: [!isLoading && !monthHasItems && (_jsx("p", { "data-slot": "month-calendar-empty", className: "text-sm text-muted-foreground", children: emptyText })), _jsxs("table", { ref: gridRef, role: "grid", "aria-label": `${label}, ${monthName}`, "aria-busy": isLoading || undefined, className: "w-full table-fixed border-separate border-spacing-0 overflow-hidden rounded-md border-t border-l border-border", children: [_jsx("thead", { children: _jsx("tr", { children: weekdayNames.map((name) => (_jsxs("th", { scope: "col", abbr: name.long, className: "border-r border-b border-border bg-muted/40 px-1 py-1 text-left text-xs font-medium text-muted-foreground uppercase max-md:text-center", children: [_jsx("span", { className: "sr-only", children: name.long }), _jsx("span", { className: "max-md:hidden", "aria-hidden": "true", children: name.short }), _jsx("span", { className: "md:hidden", "aria-hidden": "true", children: name.narrow })] }, name.long))) }) }), _jsx("tbody", { children: weeks.map((week, row) => (_jsx("tr", { children: week.map((day, column) => {
|
|
148
148
|
if (!day)
|
|
149
149
|
return _jsx("td", { className: "border-r border-b border-border bg-muted/20" }, column);
|
|
150
150
|
const list = byDay.get(day) ?? [];
|
|
@@ -59,7 +59,7 @@ export type RichTextEditorProps = {
|
|
|
59
59
|
/**
|
|
60
60
|
* Images uploaded into the text: pasted, dropped, or picked with an
|
|
61
61
|
* Image button (on the fixed toolbar; with `toolbar="floating"`, on the
|
|
62
|
-
* "Editor
|
|
62
|
+
* "Editor Tools" strip shown while the field has focus; on a phone, in
|
|
63
63
|
* the row pinned to the keyboard) or the slash menu's Image ("/image"). Each file goes
|
|
64
64
|
* through this (the app's own storage: the package knows no endpoint) and goes in as
|
|
65
65
|
* ``, from the result's `url`, else its `thumbUrl`. A
|
|
@@ -85,7 +85,7 @@ export function RichTextFloatingToolbar({ view, state, field, controls, onFormat
|
|
|
85
85
|
ref(element);
|
|
86
86
|
else if (ref)
|
|
87
87
|
ref.current = element;
|
|
88
|
-
}, role: "toolbar", "aria-label": "Format
|
|
88
|
+
}, role: "toolbar", "aria-label": "Format Selection", "aria-controls": controls, "data-slot": "rich-text-floating-toolbar", "data-side": placement?.side, style: placement ? { top: placement.top, left: placement.left } : undefined, className: cn('absolute z-50 flex items-center gap-0.5 rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10', 'animate-in fade-in-0 zoom-in-95 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2',
|
|
89
89
|
// Measured before it's seen, so it never shows in the wrong place.
|
|
90
90
|
!placement && 'invisible'), onKeyDown: onKeyDown, onBlur: onBlur, children: _jsx(FormatButtons, { formats: "selection", state: state, readOnly: false, onFormat: onFormat, onPage: onPage }) }));
|
|
91
91
|
}
|
|
@@ -11,7 +11,7 @@ export function RichTextToolsBar({ state, readOnly, fullScreen, controls, onForm
|
|
|
11
11
|
onReturn();
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
|
-
return (_jsx("div", { ref: ref, role: "toolbar", "aria-label": "Editor
|
|
14
|
+
return (_jsx("div", { ref: ref, role: "toolbar", "aria-label": "Editor Tools", "aria-controls": controls, "data-slot": "rich-text-tools-bar", className: cn('absolute right-0 z-40 flex items-center gap-0.5 rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10',
|
|
15
15
|
// Above the field, or inside its corner once it fills the window.
|
|
16
16
|
fullScreen ? 'top-2 right-2' : 'bottom-full mb-1'), onKeyDown: onKeyDown, onBlur: onBlur, children: _jsx(FormatButtons, { formats: "tools", state: state, readOnly: readOnly, onFormat: onFormat, onImage: onImage, onFullScreen: onFullScreen, fullScreen: fullScreen }) }));
|
|
17
17
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tristan2828/ui-foundation",
|
|
3
|
-
"version": "4.137.
|
|
3
|
+
"version": "4.137.2",
|
|
4
4
|
"description": "Shared UI foundation for contract-first, database-backed React apps: shadcn primitives, DataTable/EntityForm composites, auth, the gateway error seam, design tokens, lint rules and the AI playbook.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|