@tristan2828/ui-foundation 4.137.1 → 4.138.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/docs/cell-patterns.md +1 -1
- package/conventions/docs/design-language.md +8 -2
- 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.d.ts +10 -2
- package/dist/components/app/month-calendar.js +15 -5
- 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
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
- [Filling in what's missing](#filling-in-whats-missing) · lines 1891–1958
|
|
43
43
|
- [Values edited in place: the presets' looks](#values-edited-in-place-the-presets-looks) · lines 1960–1979
|
|
44
44
|
- [A quick add line](#a-quick-add-line) · lines 1981–2009
|
|
45
|
-
- [A month calendar](#a-month-calendar) · lines 2011–
|
|
46
|
-
- [The sidebar and the phone's bar](#the-sidebar-and-the-phones-bar) · lines
|
|
45
|
+
- [A month calendar](#a-month-calendar) · lines 2011–2041
|
|
46
|
+
- [The sidebar and the phone's bar](#the-sidebar-and-the-phones-bar) · lines 2043–2095
|
|
47
47
|
|
|
48
48
|
<!-- /index -->
|
|
49
49
|
|
|
@@ -2021,6 +2021,12 @@ package's `MonthCalendar`. Not a date picker, which is
|
|
|
2021
2021
|
("All day" without one), its `detail` and a link (`to`). The app's own
|
|
2022
2022
|
actions for that day sit beside its heading (`dayActions`, an Add
|
|
2023
2023
|
button); what picking a day does beyond that is the app's (`onSelect`).
|
|
2024
|
+
- **How an item opens its record** is `opens`, DataTable's kinds
|
|
2025
|
+
(add-an-entity.md "How a list opens a record"). Left out (`page`), a
|
|
2026
|
+
link goes to the record's page. `dialog` (or `dialog-only`) opens it in
|
|
2027
|
+
a dialog over the month, Open Full Page and all: the calendar's route is
|
|
2028
|
+
a `RecordDialogRoute` with the calendar as its `list` and the records
|
|
2029
|
+
as its children, as any list's is.
|
|
2024
2030
|
- **Tones** are the semantic ones plus `neutral` (design-language
|
|
2025
2031
|
"Semantic tones"): pick one per kind of thing (an event `info`, a visit
|
|
2026
2032
|
`success`), not per item, and say in the list's `detail` what it is.
|
|
@@ -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
|
|
@@ -13,7 +13,7 @@ export type MonthCalendarItem = {
|
|
|
13
13
|
time?: string | null;
|
|
14
14
|
/** Its dot and mark (design-language.md "Semantic tones"). Defaults to `info`. */
|
|
15
15
|
tone?: MonthCalendarTone;
|
|
16
|
-
/** Where its row in the day's list goes. */
|
|
16
|
+
/** Where its row in the day's list goes (how, `opens`). */
|
|
17
17
|
to?: To;
|
|
18
18
|
/** A word after the time in the day's list ("Visit"). */
|
|
19
19
|
detail?: string;
|
|
@@ -33,6 +33,14 @@ export type MonthCalendarProps = {
|
|
|
33
33
|
onMonthChange?: (month: string) => void;
|
|
34
34
|
/** The app's actions for the picked day, beside its heading (an Add button). */
|
|
35
35
|
dayActions?: (day: PlainDate) => ReactNode;
|
|
36
|
+
/**
|
|
37
|
+
* How an item's link opens its record, DataTable's `opens` kinds
|
|
38
|
+
* (add-an-entity.md "How a list opens a record"): `dialog` and
|
|
39
|
+
* `dialog-only` open it over the calendar (the calendar's route a
|
|
40
|
+
* `RecordDialogRoute`, the record one of its children); `page`, the
|
|
41
|
+
* default, goes to its page.
|
|
42
|
+
*/
|
|
43
|
+
opens?: 'dialog' | 'dialog-only' | 'page';
|
|
36
44
|
/** The first day of the week. Defaults to Monday. */
|
|
37
45
|
weekStart?: 'MO' | 'SU';
|
|
38
46
|
isLoading?: boolean;
|
|
@@ -43,4 +51,4 @@ export type MonthCalendarProps = {
|
|
|
43
51
|
locale?: string;
|
|
44
52
|
className?: string;
|
|
45
53
|
};
|
|
46
|
-
export declare function MonthCalendar({ label, items, today, selected, onSelect, month, onMonthChange, dayActions, weekStart, isLoading, error, onRetry, emptyText, locale, className, }: MonthCalendarProps): import("react").JSX.Element;
|
|
54
|
+
export declare function MonthCalendar({ label, items, today, selected, onSelect, month, onMonthChange, dayActions, opens, weekStart, isLoading, error, onRetry, emptyText, locale, className, }: MonthCalendarProps): import("react").JSX.Element;
|
|
@@ -12,17 +12,23 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
12
12
|
// past the month's edge turns the page. Every day is a plain day
|
|
13
13
|
// (`'YYYY-MM-DD'`), never an instant, so no zone shifts one.
|
|
14
14
|
//
|
|
15
|
+
// How an item's link opens its record is `opens`, DataTable's words: a
|
|
16
|
+
// dialog over the calendar (`dialog`, `dialog-only`: the link carries
|
|
17
|
+
// RecordDialogRoute's state, as a RecordLink does) or its page (`page`,
|
|
18
|
+
// the default).
|
|
19
|
+
//
|
|
15
20
|
// Four states: loading (the month's frame with placeholders), error
|
|
16
21
|
// (ErrorState in place of the days, the arrows still there), empty
|
|
17
22
|
// ("Nothing this month" over the days) and success.
|
|
18
|
-
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
23
|
+
import { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
19
24
|
import { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';
|
|
20
|
-
import { Link } from 'react-router';
|
|
25
|
+
import { Link, UNSAFE_LocationContext as LocationContext } from 'react-router';
|
|
21
26
|
import { cn } from 'cn';
|
|
22
27
|
import { Button } from '../ui/button.js';
|
|
23
28
|
import { Skeleton } from '../ui/skeleton.js';
|
|
24
29
|
import { formatPlainDate, localToPlainDate } from '../../lib/plain-date.js';
|
|
25
30
|
import { ErrorState } from './error-state.js';
|
|
31
|
+
import { recordDialogState } from './record-dialog-context.js';
|
|
26
32
|
const TONE_DOT = {
|
|
27
33
|
neutral: 'bg-muted-foreground',
|
|
28
34
|
info: 'bg-info',
|
|
@@ -61,11 +67,15 @@ function weekdayIndex(day) {
|
|
|
61
67
|
return (new Date(Date.UTC(year, month - 1, date)).getUTCDay() + 6) % 7;
|
|
62
68
|
}
|
|
63
69
|
const byTime = (a, b) => (a.time ?? '').localeCompare(b.time ?? '');
|
|
64
|
-
export function MonthCalendar({ label, items = [], today, selected, onSelect, month, onMonthChange, dayActions, weekStart = 'MO', isLoading, error, onRetry, emptyText = 'Nothing this month', locale, className, }) {
|
|
70
|
+
export function MonthCalendar({ label, items = [], today, selected, onSelect, month, onMonthChange, dayActions, opens = 'page', weekStart = 'MO', isLoading, error, onRetry, emptyText = 'Nothing this month', locale, className, }) {
|
|
65
71
|
const [ownSelected, setOwnSelected] = useState(selected ?? today);
|
|
66
72
|
const picked = selected ?? ownSelected;
|
|
67
73
|
const [ownMonth, setOwnMonth] = useState(month ?? monthOf(picked));
|
|
68
74
|
const shown = month ?? ownMonth;
|
|
75
|
+
// Read through the router's context, not useLocation, so a calendar
|
|
76
|
+
// with no links outside a router still renders (as DataTable does).
|
|
77
|
+
const routerLocation = useContext(LocationContext);
|
|
78
|
+
const linkState = opens !== 'page' && routerLocation ? recordDialogState(routerLocation.location) : undefined;
|
|
69
79
|
const gridRef = useRef(null);
|
|
70
80
|
const focusAfter = useRef(false);
|
|
71
81
|
const byDay = useMemo(() => {
|
|
@@ -144,7 +154,7 @@ export function MonthCalendar({ label, items = [], today, selected, onSelect, mo
|
|
|
144
154
|
}
|
|
145
155
|
const dayLabel = (day) => formatPlainDate(day, { weekday: 'long', month: 'long', day: 'numeric' }, locale);
|
|
146
156
|
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
|
|
157
|
+
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
158
|
if (!day)
|
|
149
159
|
return _jsx("td", { className: "border-r border-b border-border bg-muted/20" }, column);
|
|
150
160
|
const list = byDay.get(day) ?? [];
|
|
@@ -155,6 +165,6 @@ export function MonthCalendar({ label, items = [], today, selected, onSelect, mo
|
|
|
155
165
|
}) }, row))) })] }), _jsxs("div", { role: "group", "aria-label": `${dayLabel(picked)}${picked === today ? ', today' : ''}`, "data-slot": "month-calendar-day", className: "flex flex-col gap-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsxs("h3", { className: cn('mr-auto text-sm font-semibold', picked === today ? 'text-link' : 'text-foreground'), children: [dayLabel(picked), picked === today && ' · Today'] }), dayActions?.(picked)] }), isLoading ? (_jsxs("div", { className: "flex flex-col gap-2 py-1", children: [_jsx(Skeleton, { className: "h-4 w-2/3" }), _jsx(Skeleton, { className: "h-4 w-1/2" })] })) : pickedItems.length === 0 ? (_jsx("p", { className: "border-t border-border py-1.5 text-sm text-muted-foreground", children: "Nothing that day." })) : (_jsx("ul", { className: "flex flex-col", children: pickedItems.map((item) => {
|
|
156
166
|
const when = [item.time ? clock(item.time, locale) : 'All day', item.detail].filter(Boolean).join(' · ');
|
|
157
167
|
const body = (_jsxs(_Fragment, { children: [_jsx("span", { className: cn('size-2 shrink-0 rounded-full', TONE_DOT[item.tone ?? 'info']), "aria-hidden": "true" }), _jsx("span", { className: "min-w-0 flex-1 truncate", children: item.title }), _jsx("span", { className: "shrink-0 text-xs text-muted-foreground", children: when })] }));
|
|
158
|
-
return (_jsx("li", { className: "border-t border-border", children: item.to ? (_jsx(Link, { to: item.to, className: "flex min-h-10 items-center gap-2 py-1.5 text-sm text-foreground outline-none hover:underline focus-visible:ring-3 focus-visible:ring-ring/50", children: body })) : (_jsx("div", { className: "flex min-h-10 items-center gap-2 py-1.5 text-sm text-foreground", children: body })) }, item.id));
|
|
168
|
+
return (_jsx("li", { className: "border-t border-border", children: item.to ? (_jsx(Link, { to: item.to, state: linkState, className: "flex min-h-10 items-center gap-2 py-1.5 text-sm text-foreground outline-none hover:underline focus-visible:ring-3 focus-visible:ring-ring/50", children: body })) : (_jsx("div", { className: "flex min-h-10 items-center gap-2 py-1.5 text-sm text-foreground", children: body })) }, item.id));
|
|
159
169
|
}) }))] })] }))] }));
|
|
160
170
|
}
|
|
@@ -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.
|
|
3
|
+
"version": "4.138.0",
|
|
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": {
|