@tristan2828/ui-foundation 4.146.0 → 4.147.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/design-language.md +30 -25
- package/dist/components/app/date-choices.js +1 -1
- package/dist/components/app/widget-card.d.ts +8 -1
- package/dist/components/app/widget-card.js +7 -2
- package/dist/components/ui/calendar.d.ts +1 -1
- package/dist/components/ui/calendar.js +22 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -23,31 +23,31 @@
|
|
|
23
23
|
- [Density](#density) · lines 822–951
|
|
24
24
|
- [Rows on this device](#rows-on-this-device) · lines 895–923
|
|
25
25
|
- [Page width (a record on a wide screen)](#page-width-a-record-on-a-wide-screen) · lines 925–951
|
|
26
|
-
- [Widget cards (hub pages)](#widget-cards-hub-pages) · lines 953–
|
|
27
|
-
- [Module cards (a hub's places)](#module-cards-a-hubs-places) · lines
|
|
28
|
-
- [Notices](#notices) · lines
|
|
29
|
-
- [A value over time](#a-value-over-time) · lines
|
|
30
|
-
- [Several values over time](#several-values-over-time) · lines
|
|
31
|
-
- [Parts of a whole over time](#parts-of-a-whole-over-time) · lines
|
|
32
|
-
- [A list as a board](#a-list-as-a-board) · lines
|
|
33
|
-
- [Order, groups and the header](#order-groups-and-the-header) · lines
|
|
34
|
-
- [A list as cards](#a-list-as-cards) · lines
|
|
35
|
-
- [Images full screen](#images-full-screen) · lines
|
|
36
|
-
- [Key numbers on a record](#key-numbers-on-a-record) · lines
|
|
37
|
-
- [Parts of the page standards](#parts-of-the-page-standards) · lines
|
|
38
|
-
- [A few equal things](#a-few-equal-things) · lines
|
|
39
|
-
- [An overview page](#an-overview-page) · lines
|
|
40
|
-
- [A record's header and empty values](#a-records-header-and-empty-values) · lines
|
|
41
|
-
- [A record's tabs, mark and facts](#a-records-tabs-mark-and-facts) · lines
|
|
42
|
-
- [Picking at random](#picking-at-random) · lines
|
|
43
|
-
- [Filling in what's missing](#filling-in-whats-missing) · lines
|
|
44
|
-
- [Values edited in place: the presets' looks](#values-edited-in-place-the-presets-looks) · lines
|
|
45
|
-
- [A quick add line](#a-quick-add-line) · lines
|
|
46
|
-
- [A date field's quick picks](#a-date-fields-quick-picks) · lines
|
|
47
|
-
- [A few choices, then the month](#a-few-choices-then-the-month) · lines
|
|
48
|
-
- [A month calendar](#a-month-calendar) · lines
|
|
49
|
-
- [A settings page](#a-settings-page) · lines
|
|
50
|
-
- [The sidebar and the phone's bar](#the-sidebar-and-the-phones-bar) · lines
|
|
26
|
+
- [Widget cards (hub pages)](#widget-cards-hub-pages) · lines 953–1070
|
|
27
|
+
- [Module cards (a hub's places)](#module-cards-a-hubs-places) · lines 1072–1144
|
|
28
|
+
- [Notices](#notices) · lines 1146–1173
|
|
29
|
+
- [A value over time](#a-value-over-time) · lines 1175–1305
|
|
30
|
+
- [Several values over time](#several-values-over-time) · lines 1224–1262
|
|
31
|
+
- [Parts of a whole over time](#parts-of-a-whole-over-time) · lines 1264–1305
|
|
32
|
+
- [A list as a board](#a-list-as-a-board) · lines 1307–1417
|
|
33
|
+
- [Order, groups and the header](#order-groups-and-the-header) · lines 1360–1417
|
|
34
|
+
- [A list as cards](#a-list-as-cards) · lines 1419–1466
|
|
35
|
+
- [Images full screen](#images-full-screen) · lines 1468–1514
|
|
36
|
+
- [Key numbers on a record](#key-numbers-on-a-record) · lines 1516–1552
|
|
37
|
+
- [Parts of the page standards](#parts-of-the-page-standards) · lines 1554–1590
|
|
38
|
+
- [A few equal things](#a-few-equal-things) · lines 1592–1707
|
|
39
|
+
- [An overview page](#an-overview-page) · lines 1709–1774
|
|
40
|
+
- [A record's header and empty values](#a-records-header-and-empty-values) · lines 1776–1839
|
|
41
|
+
- [A record's tabs, mark and facts](#a-records-tabs-mark-and-facts) · lines 1841–1928
|
|
42
|
+
- [Picking at random](#picking-at-random) · lines 1930–1961
|
|
43
|
+
- [Filling in what's missing](#filling-in-whats-missing) · lines 1963–2030
|
|
44
|
+
- [Values edited in place: the presets' looks](#values-edited-in-place-the-presets-looks) · lines 2032–2051
|
|
45
|
+
- [A quick add line](#a-quick-add-line) · lines 2053–2081
|
|
46
|
+
- [A date field's quick picks](#a-date-fields-quick-picks) · lines 2083–2107
|
|
47
|
+
- [A few choices, then the month](#a-few-choices-then-the-month) · lines 2109–2135
|
|
48
|
+
- [A month calendar](#a-month-calendar) · lines 2137–2169
|
|
49
|
+
- [A settings page](#a-settings-page) · lines 2171–2228
|
|
50
|
+
- [The sidebar and the phone's bar](#the-sidebar-and-the-phones-bar) · lines 2230–2289
|
|
51
51
|
|
|
52
52
|
<!-- /index -->
|
|
53
53
|
|
|
@@ -997,6 +997,11 @@ const { data, isLoading, error, refetch } = useReadyTasksQuery() // one page of
|
|
|
997
997
|
<service>' }}` opens it in a new tab, with the external-link mark and
|
|
998
998
|
"(opens in a new tab)" for a screen reader. Set `skeletonRows` to the number it usually holds, so the card
|
|
999
999
|
keeps its height when the data arrives.
|
|
1000
|
+
- **A row's words:** its text is one line, cut. A small muted `note`
|
|
1001
|
+
("2 h ago", "holds 2") sits beside it, at the row's end; a `line`
|
|
1002
|
+
("Every day · 4 steps", 4.147) sits under it, wraps rather than cuts,
|
|
1003
|
+
and the row keeps room under it. Neither is part of the link's name.
|
|
1004
|
+
Don't reach into the row's spans through `className` to move a note.
|
|
1000
1005
|
- **Each widget owns its four states.** Loading is a skeleton of rows,
|
|
1001
1006
|
empty is one quiet line the app writes ("Nothing waiting", not "No
|
|
1002
1007
|
data"), and **an error stays inside the card**: the compact
|
|
@@ -49,7 +49,7 @@ export function DateChoiceRows({ label, showLabel = true, choices, slot = 'date-
|
|
|
49
49
|
if (choices.length === 0)
|
|
50
50
|
return null;
|
|
51
51
|
const shown = label && showLabel;
|
|
52
|
-
return (_jsxs("div", { role: "group", "aria-label": shown ? undefined : label, "aria-labelledby": shown ? headingId : undefined, "data-slot": slot, className: "flex flex-col gap-0.5 border-b border-border p-2", children: [shown && (_jsx("div", { id: headingId, className: "px-3 py-1 text-xs font-medium text-muted-foreground", children: label })), choices.map((choice) => (_jsxs(Button, { type: "button", variant: "ghost", size: "sm", "data-slot": "date-choice", disabled: choice.disabled, className: "w-full justify-between gap-4 font-normal", "aria-label": choice.value ? `${choice.label}, ${choice.value}` : choice.label, onClick: choice.onSelect, children: [_jsx("span", { children: choice.label }), choice.value && _jsx("span", { className: "text-muted-foreground tabular-nums", children: choice.value })] }, choice.label)))] }));
|
|
52
|
+
return (_jsxs("div", { role: "group", "aria-label": shown ? undefined : label, "aria-labelledby": shown ? headingId : undefined, "data-slot": slot, className: "flex flex-col gap-0.5 border-b border-border p-2", children: [shown && (_jsx("div", { id: headingId, className: "px-3 py-1 text-xs font-medium text-muted-foreground", children: label })), choices.map((choice) => (_jsxs(Button, { type: "button", variant: "ghost", size: "sm", "data-slot": "date-choice", disabled: choice.disabled, className: "w-full justify-between gap-4 font-normal", "aria-label": choice.value ? `${choice.label}, ${choice.value}` : choice.label, onClick: choice.onSelect, children: [_jsx("span", { children: choice.label }), choice.value && ' ', choice.value && _jsx("span", { className: "text-muted-foreground tabular-nums", children: choice.value })] }, choice.label)))] }));
|
|
53
53
|
}
|
|
54
54
|
// Calendar's `weekStartsOn` by code. Left out, it's Calendar's own default (Monday).
|
|
55
55
|
const WEEK_STARTS_ON = { SU: 0, MO: 1, TU: 2, WE: 3, TH: 4, FR: 5, SA: 6 };
|
|
@@ -120,6 +120,13 @@ export interface WidgetListItemProps {
|
|
|
120
120
|
lead?: ReactNode;
|
|
121
121
|
/** A small muted note after the text: "2 h ago", "holds 2". */
|
|
122
122
|
note?: ReactNode;
|
|
123
|
+
/**
|
|
124
|
+
* A muted line under the text: what the row is about in a few words
|
|
125
|
+
* ("Every day · 4 steps"). Unlike the text it isn't cut: on a narrow row
|
|
126
|
+
* it wraps, and the row grows to hold it. Outside the link, so it isn't
|
|
127
|
+
* part of the row's name.
|
|
128
|
+
*/
|
|
129
|
+
line?: ReactNode;
|
|
123
130
|
/**
|
|
124
131
|
* What ends the row: a badge, or a control. A control needs a name: pass
|
|
125
132
|
* a function, and put the id it gets in the control's `aria-labelledby`,
|
|
@@ -128,4 +135,4 @@ export interface WidgetListItemProps {
|
|
|
128
135
|
trailing?: ReactNode | ((rowTextId: string) => ReactNode);
|
|
129
136
|
className?: string;
|
|
130
137
|
}
|
|
131
|
-
export declare function WidgetListItem({ children, to, href, lead, note, trailing, className }: WidgetListItemProps): import("react").JSX.Element;
|
|
138
|
+
export declare function WidgetListItem({ children, to, href, lead, note, line, trailing, className }: WidgetListItemProps): import("react").JSX.Element;
|
|
@@ -142,15 +142,20 @@ function WidgetListSkeleton({ rows }) {
|
|
|
142
142
|
export function WidgetList({ children, className }) {
|
|
143
143
|
return (_jsx("ul", { "data-slot": "widget-list", className: cn('flex flex-col divide-y divide-border', className), children: children }));
|
|
144
144
|
}
|
|
145
|
+
// A row with a line under its text keeps room under the line at every
|
|
146
|
+
// density, so a wrapped line doesn't sit against the divider (a compact
|
|
147
|
+
// phone row has no padding of its own: its link's is the target).
|
|
148
|
+
const ROW_WITH_LINE_CLASS = 'density-compact:py-1.5 max-sm:density-compact:pb-2';
|
|
145
149
|
const ROW_LINK_CLASS = 'min-w-0 truncate rounded-sm font-medium text-foreground underline-offset-4 outline-none ' +
|
|
146
150
|
'hover:underline focus-visible:underline focus-visible:ring-3 focus-visible:ring-ring/50 ' +
|
|
147
151
|
'max-sm:density-compact:py-3';
|
|
148
|
-
export function WidgetListItem({ children, to, href, lead, note, trailing, className }) {
|
|
152
|
+
export function WidgetListItem({ children, to, href, lead, note, line, trailing, className }) {
|
|
149
153
|
const textId = useId();
|
|
150
154
|
const hasLead = lead !== undefined && lead !== null && lead !== false;
|
|
151
155
|
// With a lead the text is its own cut span after it, both on one line.
|
|
152
156
|
const words = hasLead ? (_jsxs(_Fragment, { children: [_jsx("span", { "data-slot": "widget-list-item-lead", "aria-hidden": "true", className: "inline-flex shrink-0", children: lead }), _jsx("span", { className: "min-w-0 truncate", children: children })] })) : (children);
|
|
153
157
|
const leadRow = hasLead && 'flex items-center gap-1.5';
|
|
154
158
|
const text = to !== undefined ? (_jsx(Link, { id: textId, to: to, title: children, className: cn(ROW_LINK_CLASS, leadRow), children: words })) : href !== undefined ? (_jsxs("a", { id: textId, href: href, target: "_blank", rel: "noreferrer", title: children, className: cn(ROW_LINK_CLASS, 'flex items-center gap-1', hasLead && 'gap-1.5'), children: [hasLead ? words : _jsx("span", { className: "truncate", children: children }), _jsx(ExternalLinkIcon, { "aria-hidden": "true", className: "size-3 shrink-0 text-muted-foreground" }), _jsx("span", { className: "sr-only", children: " (opens in a new tab)" })] })) : (_jsx("span", { id: textId, title: children, className: cn('min-w-0 truncate text-foreground', leadRow), children: words }));
|
|
155
|
-
|
|
159
|
+
const hasLine = line !== undefined && line !== null && line !== false;
|
|
160
|
+
return (_jsxs("li", { "data-slot": "widget-list-item", className: cn(ROW_CLASS, 'type-body', hasLine && ROW_WITH_LINE_CLASS, className), children: [hasLine ? (_jsxs("span", { "data-slot": "widget-list-item-text", className: "flex min-w-0 flex-col gap-0.5", children: [text, _jsx("span", { "data-slot": "widget-list-item-line", className: "type-caption text-muted-foreground", children: line })] })) : (text), (note !== undefined || trailing !== undefined) && (_jsxs("span", { className: "ml-auto flex shrink-0 items-center gap-3", children: [note !== undefined && _jsx("span", { className: "type-caption tabular-nums text-muted-foreground", children: note }), typeof trailing === 'function' ? trailing(textId) : trailing] }))] }));
|
|
156
161
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { DayPicker, type DayButton, type Locale } from "react-day-picker";
|
|
3
3
|
import { Button } from "./button.js";
|
|
4
|
-
declare function Calendar({ className, classNames, showOutsideDays, captionLayout, buttonVariant, weekStartsOn, locale, formatters, components, ...props }: React.ComponentProps<typeof DayPicker> & {
|
|
4
|
+
declare function Calendar({ className, classNames, showOutsideDays, captionLayout, buttonVariant, weekStartsOn, locale, formatters, components, labels, ...props }: React.ComponentProps<typeof DayPicker> & {
|
|
5
5
|
buttonVariant?: React.ComponentProps<typeof Button>["variant"];
|
|
6
6
|
}): React.JSX.Element;
|
|
7
7
|
declare function CalendarDayButton({ className, day, modifiers, locale, ...props }: React.ComponentProps<typeof DayButton> & {
|
|
@@ -9,11 +9,14 @@ function Calendar({ className, classNames, showOutsideDays = true, captionLayout
|
|
|
9
9
|
// Patched (ui-foundation): upstream leaves this to react-day-picker, which
|
|
10
10
|
// starts weeks on Sunday. Monday unless the caller says, the default of
|
|
11
11
|
// MonthCalendar, RecurrenceField and byDay; a `locale` doesn't change it.
|
|
12
|
-
weekStartsOn = 1, locale, formatters, components, ...props }) {
|
|
12
|
+
weekStartsOn = 1, locale, formatters, components, labels, ...props }) {
|
|
13
13
|
const defaultClassNames = getDefaultClassNames();
|
|
14
14
|
return (_jsx(DayPicker, { showOutsideDays: showOutsideDays, className: cn("group/calendar bg-background p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent", String.raw `rtl:**:[.rdp-button\_next>svg]:rotate-180`, String.raw `rtl:**:[.rdp-button\_previous>svg]:rotate-180`, className), captionLayout: captionLayout, weekStartsOn: weekStartsOn, locale: locale, formatters: {
|
|
15
15
|
formatMonthDropdown: (date) => date.toLocaleString(locale?.code, { month: "short" }),
|
|
16
16
|
...formatters,
|
|
17
|
+
}, labels: {
|
|
18
|
+
labelDayButton: (date, modifiers) => dayButtonLabel(date, modifiers, locale?.code),
|
|
19
|
+
...labels,
|
|
17
20
|
}, classNames: {
|
|
18
21
|
root: cn("w-fit", defaultClassNames.root),
|
|
19
22
|
months: cn("relative flex flex-col gap-4 md:flex-row", defaultClassNames.months),
|
|
@@ -65,6 +68,24 @@ weekStartsOn = 1, locale, formatters, components, ...props }) {
|
|
|
65
68
|
...components,
|
|
66
69
|
}, ...props }));
|
|
67
70
|
}
|
|
71
|
+
// Patched (ui-foundation): react-day-picker names a day "Monday, September
|
|
72
|
+
// 14th, 2026" (date-fns' PPPP), and axe's label-content-name-mismatch doesn't
|
|
73
|
+
// find the "14" the button shows in "14th". The locale's own long date
|
|
74
|
+
// ("Monday, September 14, 2026"), with react-day-picker's "Today, " and
|
|
75
|
+
// ", selected" kept, so the shown number is a word of the name.
|
|
76
|
+
function dayButtonLabel(date, modifiers, localeCode) {
|
|
77
|
+
let label = date.toLocaleDateString(localeCode ?? "en-US", {
|
|
78
|
+
weekday: "long",
|
|
79
|
+
month: "long",
|
|
80
|
+
day: "numeric",
|
|
81
|
+
year: "numeric",
|
|
82
|
+
});
|
|
83
|
+
if (modifiers.today)
|
|
84
|
+
label = `Today, ${label}`;
|
|
85
|
+
if (modifiers.selected)
|
|
86
|
+
label = `${label}, selected`;
|
|
87
|
+
return label;
|
|
88
|
+
}
|
|
68
89
|
function CalendarDayButton({ className, day, modifiers, locale, ...props }) {
|
|
69
90
|
const defaultClassNames = getDefaultClassNames();
|
|
70
91
|
const ref = React.useRef(null);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { AppShell, type AppShellProps, type AppShellSearch, type RecentRecord, type SearchRecord, type AppShellVersion, type BottomBarItem, type NavEntry, type NavItem, type NavLook, type NavSection, } from './components/app/app-shell.js';
|
|
2
|
+
export { navItems, navPathname } from './components/app/app-shell-nav.js';
|
|
2
3
|
export type { IconComponent } from './components/app/icon-component.js';
|
|
3
4
|
export { Board, type BoardColumn, type BoardGroup, type BoardMoveTarget, type BoardPlace, type BoardProps } from './components/app/board.js';
|
|
4
5
|
export { SpinWheel, type SpinWheelProps } from './components/app/spin-wheel.js';
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// points (`/gateway`, `/mocks`, `/testing`) so each stays behind its boundary.
|
|
5
5
|
// Composites
|
|
6
6
|
export { AppShell, } from './components/app/app-shell.js';
|
|
7
|
+
export { navItems, navPathname } from './components/app/app-shell-nav.js';
|
|
7
8
|
export { Board } from './components/app/board.js';
|
|
8
9
|
export { SpinWheel } from './components/app/spin-wheel.js';
|
|
9
10
|
export { pickSpinWheelIndex } from './components/app/spin-wheel-pick.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tristan2828/ui-foundation",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.147.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": {
|