@tristan2828/ui-foundation 4.110.0 → 4.112.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/add-an-entity.md +17 -13
- package/conventions/docs/design-language.md +22 -9
- package/dist/components/app/entity-view-facts.d.ts +21 -0
- package/dist/components/app/entity-view-facts.js +5 -0
- package/dist/components/app/entity-view.js +29 -11
- package/dist/components/app/fact-list.d.ts +19 -0
- package/dist/components/app/fact-list.js +10 -0
- package/dist/components/app/field-rows.d.ts +1 -0
- package/dist/components/app/field-rows.js +5 -0
- package/dist/components/ui/tabs.js +6 -5
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -15,18 +15,18 @@
|
|
|
15
15
|
- Step 8: Add Playwright specs for all three screens · lines 755–832
|
|
16
16
|
- Step 9: Register the nav entry and route names · lines 833–847
|
|
17
17
|
- Step 10: `npm run verify`. · lines 848–850
|
|
18
|
-
- [How a list opens a record](#how-a-list-opens-a-record) · lines 852–
|
|
19
|
-
- [The record view](#the-record-view) · lines 1005–
|
|
20
|
-
- [Forms](#forms) · lines
|
|
21
|
-
- [Dialogs](#dialogs) · lines
|
|
22
|
-
- [Toasts and feedback](#toasts-and-feedback) · lines
|
|
23
|
-
- [What not to copy](#what-not-to-copy) · lines
|
|
24
|
-
- [After a commit, in the backend](#after-a-commit-in-the-backend) · lines
|
|
25
|
-
- [Deleting](#deleting) · lines
|
|
26
|
-
- [Fields only a script writes](#fields-only-a-script-writes) · lines
|
|
27
|
-
- [Searching one part of the app](#searching-one-part-of-the-app) · lines
|
|
28
|
-
- [What a chat is told about an entity](#what-a-chat-is-told-about-an-entity) · lines
|
|
29
|
-
- [Behind a sign-in proxy](#behind-a-sign-in-proxy) · lines
|
|
18
|
+
- [How a list opens a record](#how-a-list-opens-a-record) · lines 852–1261
|
|
19
|
+
- [The record view](#the-record-view) · lines 1005–1106
|
|
20
|
+
- [Forms](#forms) · lines 1108–1178
|
|
21
|
+
- [Dialogs](#dialogs) · lines 1180–1211
|
|
22
|
+
- [Toasts and feedback](#toasts-and-feedback) · lines 1213–1261
|
|
23
|
+
- [What not to copy](#what-not-to-copy) · lines 1263–1295
|
|
24
|
+
- [After a commit, in the backend](#after-a-commit-in-the-backend) · lines 1297–1314
|
|
25
|
+
- [Deleting](#deleting) · lines 1316–1347
|
|
26
|
+
- [Fields only a script writes](#fields-only-a-script-writes) · lines 1349–1370
|
|
27
|
+
- [Searching one part of the app](#searching-one-part-of-the-app) · lines 1372–1381
|
|
28
|
+
- [What a chat is told about an entity](#what-a-chat-is-told-about-an-entity) · lines 1384–1426
|
|
29
|
+
- [Behind a sign-in proxy](#behind-a-sign-in-proxy) · lines 1428–1464
|
|
30
30
|
|
|
31
31
|
<!-- /index -->
|
|
32
32
|
|
|
@@ -1051,7 +1051,11 @@ A record uses the parts it has, in this order:
|
|
|
1051
1051
|
dialog), so the page doesn't end 900px in. The strip stays above it at
|
|
1052
1052
|
full width, and the rail starts level with the first content under the
|
|
1053
1053
|
strip: the open tab's first section (beside the tab's content, not its
|
|
1054
|
-
bar), or the first card when cards come before the tabs (4.108).
|
|
1054
|
+
bar), or the first card when cards come before the tabs (4.108). Beside
|
|
1055
|
+
the rail the record's cards fill the column up to it, as wide as the
|
|
1056
|
+
tab bar (Details too, which elsewhere keeps a 42rem reading width), and
|
|
1057
|
+
their rows keep a compact 10rem label so the values get the rest
|
|
1058
|
+
(4.112). Only short values go in it,
|
|
1055
1059
|
and the API holds to that: a rail section is `facts`, not `fields`,
|
|
1056
1060
|
each fact one of a few kinds, never free markup:
|
|
1057
1061
|
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
- [A few equal things](#a-few-equal-things) · lines 1427–1511
|
|
34
34
|
- [An overview page](#an-overview-page) · lines 1513–1576
|
|
35
35
|
- [A record's header and empty values](#a-records-header-and-empty-values) · lines 1577–1628
|
|
36
|
-
- [A record's tabs, mark and facts](#a-records-tabs-mark-and-facts) · lines 1630–
|
|
37
|
-
- [Picking at random](#picking-at-random) · lines
|
|
38
|
-
- [Filling in what's missing](#filling-in-whats-missing) · lines
|
|
39
|
-
- [Values edited in place: the presets' looks](#values-edited-in-place-the-presets-looks) · lines
|
|
40
|
-
- [The sidebar and the phone's bar](#the-sidebar-and-the-phones-bar) · lines
|
|
36
|
+
- [A record's tabs, mark and facts](#a-records-tabs-mark-and-facts) · lines 1630–1711
|
|
37
|
+
- [Picking at random](#picking-at-random) · lines 1713–1744
|
|
38
|
+
- [Filling in what's missing](#filling-in-whats-missing) · lines 1746–1813
|
|
39
|
+
- [Values edited in place: the presets' looks](#values-edited-in-place-the-presets-looks) · lines 1815–1840
|
|
40
|
+
- [The sidebar and the phone's bar](#the-sidebar-and-the-phones-bar) · lines 1842–1931
|
|
41
41
|
|
|
42
42
|
<!-- /index -->
|
|
43
43
|
|
|
@@ -789,7 +789,7 @@ the `ring` focus ring. A table that fits gets no tab stop and no region.
|
|
|
789
789
|
where that reads as small text. The open record tab's name, the open tab
|
|
790
790
|
of any line tab list (`TabsList variant="line"`, a page's sub-navigation
|
|
791
791
|
under a section heading, 4.110) and a picked `ChoiceButtons` option wear
|
|
792
|
-
it (each tab with a `bg-primary` line
|
|
792
|
+
it (each tab with a 3px `bg-primary` line and a `bg-primary/12` tint, the choice with
|
|
793
793
|
a `border-primary` and a `bg-primary/12` fill). The pill look
|
|
794
794
|
(`TabsList`'s default) keeps its open tab in `--foreground` on the page
|
|
795
795
|
colour. It's the
|
|
@@ -1649,9 +1649,13 @@ its short facts the last tab, Details. A mark goes left of the title.
|
|
|
1649
1649
|
- **Tabs** (`tab` on a section): a line tab list under the strip and any
|
|
1650
1650
|
sections with no tab, one tab per name in the order the sections first
|
|
1651
1651
|
give it. The look is the record standard's 3B (4.101): 44px tabs in
|
|
1652
|
-
16px semibold (14px under 48rem), the
|
|
1653
|
-
|
|
1654
|
-
|
|
1652
|
+
16px semibold (14px under 48rem), the others muted. The selected one is
|
|
1653
|
+
plainly marked (4.111): its name bold in the theme colour
|
|
1654
|
+
(`--primary-text`, 4.105), a 3px primary line under it and a primary
|
|
1655
|
+
tint behind it (`bg-primary/12`, as a picked choice); every tab is as
|
|
1656
|
+
wide as its bold name, so choosing one moves none. A page's own line
|
|
1657
|
+
tabs (`TabsList variant="line"`) are marked the same way, semibold
|
|
1658
|
+
over medium. The list's own
|
|
1655
1659
|
bottom border runs the column's width. A tab's count (`tabCounts`, by
|
|
1656
1660
|
name: the records it holds) sits beside its name in a small muted
|
|
1657
1661
|
pill; a tab with none shows no count. A list wider than the column
|
|
@@ -1676,6 +1680,15 @@ its short facts the last tab, Details. A mark goes left of the title.
|
|
|
1676
1680
|
18rem column beside its sections once the tab is 42rem wide, under
|
|
1677
1681
|
them below that. Short facts only, never free text: run-on text in a
|
|
1678
1682
|
narrow box is what the standard took away.
|
|
1683
|
+
- **Several items in one fact** (4.111): linked records, a few tasks,
|
|
1684
|
+
each item marked so a long title that wraps doesn't run into the next.
|
|
1685
|
+
A `list` fact (`{ label: 'Related', kind: 'list', items: [{ name, to,
|
|
1686
|
+
icon }] }`) draws them; an app's own box of several things uses the
|
|
1687
|
+
same `FactList` and `FactListItem`. Each item leads with its kind's
|
|
1688
|
+
icon (the record standard's 4I) when the app gives one, a neutral
|
|
1689
|
+
bullet otherwise, in the muted colour; a wrapped line starts after the
|
|
1690
|
+
mark (a hanging indent), and items have a little room between them.
|
|
1691
|
+
Never a bare stack of links.
|
|
1679
1692
|
- **The strip** (`KeyStats`) is as wide as its numbers (`width="content"`,
|
|
1680
1693
|
the default since 4.98), not the page's width.
|
|
1681
1694
|
- **A mark or avatar** (`leading`): left of the title, top-aligned,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { StatusKind } from '../../lib/status-kinds.js';
|
|
3
3
|
import type { EditInPlace } from './edit-in-place.js';
|
|
4
|
+
import type { IconComponent } from './icon-component.js';
|
|
4
5
|
/** What a fact holds: one of the short kinds a rail can draw. */
|
|
5
6
|
export type EntityViewFactValue =
|
|
6
7
|
/** A status, drawn as its StatusMark; `word` is the status's own ("As needed"). */
|
|
@@ -41,6 +42,26 @@ export type EntityViewFactValue =
|
|
|
41
42
|
name: string;
|
|
42
43
|
to: string;
|
|
43
44
|
short: true;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Several items (4.111): linked records, links out, or plain words, each
|
|
48
|
+
* marked by its kind's `icon` or a bullet (FactList), so long titles
|
|
49
|
+
* that wrap still read apart. An item with `to` links in the app, with
|
|
50
|
+
* `href` out of it (a new tab), with neither is its words. None is empty.
|
|
51
|
+
*/
|
|
52
|
+
| {
|
|
53
|
+
kind: 'list';
|
|
54
|
+
items: readonly EntityViewFactListItem[];
|
|
55
|
+
};
|
|
56
|
+
/** One item of a `list` fact. */
|
|
57
|
+
export type EntityViewFactListItem = {
|
|
58
|
+
name: string;
|
|
59
|
+
/** A record in the app (`/discussions/3`). */
|
|
60
|
+
to?: string;
|
|
61
|
+
/** A page out of the app, opening in a new tab. */
|
|
62
|
+
href?: string;
|
|
63
|
+
/** Its kind's icon (the record standard's 4I); a bullet without one. */
|
|
64
|
+
icon?: IconComponent;
|
|
44
65
|
};
|
|
45
66
|
export type EntityViewFact = EntityViewFactValue & {
|
|
46
67
|
label: string;
|
|
@@ -4,6 +4,7 @@ import { Link } from 'react-router';
|
|
|
4
4
|
import { ExternalLinkIcon } from 'lucide-react';
|
|
5
5
|
import { cn } from 'cn';
|
|
6
6
|
import { Badge } from '../ui/badge.js';
|
|
7
|
+
import { FactList, FactListItem } from './fact-list.js';
|
|
7
8
|
import { StatusMark } from './status-mark.js';
|
|
8
9
|
const LINK_CLASS = 'rounded-sm font-medium text-link underline-offset-4 outline-none hover:underline focus-visible:ring-3 focus-visible:ring-ring/50';
|
|
9
10
|
/** A fact as the view draws it: `null` when empty. */
|
|
@@ -25,6 +26,10 @@ export function factValue(fact) {
|
|
|
25
26
|
return fact.to ? (_jsx(Link, { to: fact.to, className: cn(LINK_CLASS, 'tabular-nums'), children: fact.count })) : (_jsx("span", { className: "tabular-nums", children: fact.count }));
|
|
26
27
|
case 'link':
|
|
27
28
|
return (_jsxs("a", { href: fact.href, target: "_blank", rel: "noreferrer", className: cn(LINK_CLASS, 'inline-flex max-w-full items-center gap-1'), children: [_jsx("span", { className: "truncate", children: fact.name }), _jsx(ExternalLinkIcon, { "aria-hidden": "true", className: "size-3.5 shrink-0" }), _jsx("span", { className: "sr-only", children: "(opens in a new tab)" })] }));
|
|
29
|
+
case 'list':
|
|
30
|
+
if (fact.items.length === 0)
|
|
31
|
+
return null;
|
|
32
|
+
return (_jsx(FactList, { children: fact.items.map((item, index) => (_jsx(FactListItem, { icon: item.icon, children: item.to ? (_jsx(Link, { to: item.to, className: LINK_CLASS, children: item.name })) : item.href ? (_jsxs("a", { href: item.href, target: "_blank", rel: "noreferrer", className: LINK_CLASS, children: [item.name, _jsx(ExternalLinkIcon, { "aria-hidden": "true", className: "ml-1 inline size-3.5 align-[-0.125em]" }), _jsx("span", { className: "sr-only", children: "(opens in a new tab)" })] })) : (item.name) }, `${index}:${item.name}`))) }));
|
|
28
33
|
case 'record':
|
|
29
34
|
return (_jsx(Link, { to: fact.to, title: fact.name, className: cn(LINK_CLASS, 'inline-block max-w-full truncate align-bottom'), children: fact.name }));
|
|
30
35
|
}
|
|
@@ -74,8 +74,9 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
74
74
|
// switch. With no `tab` on any section, nothing changes.
|
|
75
75
|
//
|
|
76
76
|
// The tab bar (4.101, record standard 3B): bigger underline tabs (16px
|
|
77
|
-
// semibold, 14px on a phone),
|
|
78
|
-
//
|
|
77
|
+
// semibold, 14px on a phone), the open one plainly marked (4.111): a 3px
|
|
78
|
+
// primary line, a primary tint behind it (ui/tabs' line look) and its name
|
|
79
|
+
// bold in the theme colour (`text-primary-text`, 4.105), each
|
|
79
80
|
// tab's count beside its name (`tabCounts`; none for zero). The bar sticks
|
|
80
81
|
// to the top of whatever scrolls (the page, or a record dialog's body) as
|
|
81
82
|
// the record scrolls under it, `tabsStickyTop` below the top, and once
|
|
@@ -122,6 +123,10 @@ import { factsAsFields, useWideParent } from './entity-view-facts.js';
|
|
|
122
123
|
// The view's empty text and whether fields cards fold their empty ones,
|
|
123
124
|
// for every section without threading them through each layout.
|
|
124
125
|
const EmptyContext = createContext({ text: EMPTY_DASH, fold: false });
|
|
126
|
+
// Whether the facts rail is drawn (4.112): the record's column then fills
|
|
127
|
+
// the room up to the rail (Details' reading-width cap off), and its fields
|
|
128
|
+
// rows keep a compact label (`FIELD_ROW.wide`) so the values get the rest.
|
|
129
|
+
const BesideFactsRailContext = createContext(false);
|
|
125
130
|
// The record's trail (#R2): the crumbs above it, then its own title
|
|
126
131
|
// once it has loaded; the list's crumb is the last until then.
|
|
127
132
|
function recordTrail(back, title) {
|
|
@@ -158,10 +163,20 @@ function FieldList({ fields, place }) {
|
|
|
158
163
|
const shown = emptyCount === 0 || open ? fields : fields.filter((field) => !isEmptyValue(fieldValue(field)));
|
|
159
164
|
return (_jsxs("div", { className: "flex flex-col gap-3", children: [shown.length > 0 && (_jsx("dl", { id: listId, className: "@container/fields flex flex-col divide-y divide-border", children: shown.map((field) => (_jsx(FieldRow, { field: field, place: place }, field.label))) })), emptyCount > 0 && (_jsxs("button", { type: "button", "data-slot": "entity-view-empty-toggle", "aria-expanded": open, "aria-controls": shown.length > 0 ? listId : undefined, onClick: () => setOpen((was) => !was), className: "inline-flex w-fit items-center gap-1 rounded-sm type-label text-muted-foreground underline underline-offset-3 outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 pointer-coarse:min-h-11", children: [open ? 'Hide Empty' : `${emptyCount} Empty`, _jsx(ChevronDownIcon, { "aria-hidden": "true", className: cn('size-3.5 transition-transform', open && 'rotate-180') })] }))] }));
|
|
160
165
|
}
|
|
161
|
-
function ViewSection({ section, inRail = false, railFields = 'beside', bare, factsRail = false, }) {
|
|
166
|
+
function ViewSection({ section, inRail = false, railFields = 'beside', bare, factsRail = false, side = false, }) {
|
|
162
167
|
const headingId = useId();
|
|
163
168
|
const empty = useContext(EmptyContext);
|
|
164
|
-
const
|
|
169
|
+
const besideFactsRail = useContext(BesideFactsRailContext);
|
|
170
|
+
const place = factsRail
|
|
171
|
+
? 'facts'
|
|
172
|
+
: besideFactsRail && !side && bare === undefined
|
|
173
|
+
? 'wide'
|
|
174
|
+
: !inRail
|
|
175
|
+
? 'page'
|
|
176
|
+
: railFields === 'beside'
|
|
177
|
+
? 'railBeside'
|
|
178
|
+
: 'rail';
|
|
179
|
+
const body = 'fields' in section || 'facts' in section ? (_jsx(FieldList, { fields: 'fields' in section ? section.fields : factsAsFields(section.facts), place: place })) : section.edit?.kind === 'list' ? (_jsxs("div", { className: "flex min-w-0 flex-col gap-2 type-body break-words text-foreground", children: [!isEmptyValue(section.content) && section.content, _jsx(EditableList, { label: section.title, edit: section.edit, emptyLabel: section.emptyLabel ?? empty.text })] })) : (_jsx("div", { className: "min-w-0 type-body break-words text-foreground", children: section.edit ? (_jsx(EditableValue, { label: section.title, edit: section.edit, children: _jsx(OrEmpty, { value: section.content, emptyLabel: section.emptyLabel }) })) : (_jsx(OrEmpty, { value: section.content, emptyLabel: section.emptyLabel })) }));
|
|
165
180
|
if (bare) {
|
|
166
181
|
return (_jsxs("section", { "aria-labelledby": headingId, "data-slot": "entity-view-bare-section", className: "flex flex-col gap-2", children: [_jsx("h2", { id: headingId, className: bare === 'hidden' ? 'sr-only' : 'type-label text-muted-foreground', children: section.title }), body] }));
|
|
167
182
|
}
|
|
@@ -274,14 +289,17 @@ const TAB_SIDE = {
|
|
|
274
289
|
side: 'flex min-w-0 flex-col gap-6',
|
|
275
290
|
};
|
|
276
291
|
function TabBody({ tab, railFields }) {
|
|
292
|
+
const besideFactsRail = useContext(BesideFactsRailContext);
|
|
277
293
|
if (tab.details) {
|
|
278
|
-
// The facts on their own: a reading width, never the whole page.
|
|
279
|
-
|
|
294
|
+
// The facts on their own: a reading width, never the whole page. Beside
|
|
295
|
+
// the facts rail the column is already that (the page's own cap), so
|
|
296
|
+
// they fill it up to the rail, level with the tab bar (4.112).
|
|
297
|
+
return (_jsx("div", { "data-slot": "entity-view-details", className: cn('flex w-full min-w-0 flex-col gap-6', !besideFactsRail && 'max-w-2xl'), children: tab.sections.map((section) => (_jsx(ViewSection, { section: section, inRail: true, railFields: railFields }, section.title))) }));
|
|
280
298
|
}
|
|
281
299
|
const main = tab.sections.map((section) => _jsx(ViewSection, { section: section }, section.title));
|
|
282
300
|
if (tab.side.length === 0)
|
|
283
301
|
return main;
|
|
284
|
-
return (_jsxs("div", { className: TAB_SIDE.columns, children: [_jsx("div", { className: TAB_SIDE.main, children: main }), _jsx("aside", { "aria-label": `${tab.name} Facts`, "data-slot": "entity-view-tab-side", className: TAB_SIDE.side, children: tab.side.map((section) => (_jsx(ViewSection, { section: section, inRail: true, railFields: railFields }, section.title))) })] }));
|
|
302
|
+
return (_jsxs("div", { className: TAB_SIDE.columns, children: [_jsx("div", { className: TAB_SIDE.main, children: main }), _jsx("aside", { "aria-label": `${tab.name} Facts`, "data-slot": "entity-view-tab-side", className: TAB_SIDE.side, children: tab.side.map((section) => (_jsx(ViewSection, { section: section, inRail: true, railFields: railFields, side: true }, section.title))) })] }));
|
|
285
303
|
}
|
|
286
304
|
// The tab list, under the sections with no tab, and every tab's sections
|
|
287
305
|
// (hidden but mounted unless selected). The selected tab is the address's,
|
|
@@ -337,7 +355,7 @@ function MainTabs({ tabs, label, railFields = 'beside', title, counts, stickyTop
|
|
|
337
355
|
// padding, so the bar sits at the body's own top edge there.
|
|
338
356
|
style: { top: stickyTop ?? 'var(--entity-view-sticky-top, 0px)' }, className: cn('sticky z-10 -mx-1 flex min-w-0 flex-col gap-1 bg-background px-1 pt-0 data-[stuck]:pt-2 data-[stuck]:shadow-[0_8px_12px_-10px_var(--color-foreground)]', aside !== undefined && FACTS_RAIL.barBeside), children: [stuck && title && (_jsx("p", { "data-slot": "entity-view-tab-bar-title", "aria-hidden": "true", className: "truncate type-label font-semibold text-foreground", children: title })), _jsx(TabsList, { variant: "line", activateOnFocus: true, "aria-label": label, className: "h-auto w-full max-w-full justify-start gap-0 overflow-x-auto overflow-y-hidden border-b border-border p-0 md:gap-1 [scrollbar-width:thin]", children: tabs.map((tab) => {
|
|
339
357
|
const count = countOf(tab);
|
|
340
|
-
return (_jsxs(TabsTrigger, { value: tab.slug, className: "h-11 flex-none gap-1.5 px-2.5 text-sm font-semibold text-muted-foreground group-data-horizontal/tabs:after:bottom-0 group-data-horizontal/tabs:after:h-[3px] after:bg-primary data-active:text-primary-text md:px-4 md:text-base dark:text-muted-foreground dark:data-active:text-primary-text", children: [tab.name, count > 0 && (_jsx("span", { "data-slot": "entity-view-tab-count", className: "rounded-full bg-muted px-1.5 text-xs leading-[1.0625rem] font-medium tabular-nums text-foreground", children: count }))] }, tab.slug));
|
|
358
|
+
return (_jsxs(TabsTrigger, { value: tab.slug, className: "h-11 flex-none gap-1.5 rounded-b-none px-2.5 text-sm font-semibold text-muted-foreground group-data-horizontal/tabs:after:bottom-0 group-data-horizontal/tabs:after:h-[3px] after:bg-primary data-active:font-bold! data-active:text-primary-text md:px-4 md:text-base dark:text-muted-foreground dark:data-active:text-primary-text", children: [_jsx("span", { "data-slot": "entity-view-tab-name", "data-text": tab.name, className: "inline-grid after:invisible after:col-start-1 after:row-start-1 after:h-0 after:font-bold after:content-[attr(data-text)]", children: _jsx("span", { className: "col-start-1 row-start-1", children: tab.name }) }), count > 0 && (_jsx("span", { "data-slot": "entity-view-tab-count", className: "rounded-full bg-muted px-1.5 text-xs leading-[1.0625rem] font-medium tabular-nums text-foreground", children: count }))] }, tab.slug));
|
|
341
359
|
}) })] }), aside === undefined ? (panels) : (_jsxs("div", { "data-slot": "entity-view-with-facts", className: FACTS_RAIL.columns, children: [panels, aside] }))] }));
|
|
342
360
|
}
|
|
343
361
|
// The `tabs` layout's sections (1A): the main column's untabbed sections,
|
|
@@ -440,7 +458,7 @@ export function EntityView({ title, documentTitle, titleEdit, leading, subtitle,
|
|
|
440
458
|
.filter((section) => !tabbed(section))
|
|
441
459
|
.map((section) => (_jsx(ViewSection, { section: section }, section.title))), tabList] }));
|
|
442
460
|
}
|
|
443
|
-
return (_jsx(EditInPlaceContext.Provider, { value: store, children: _jsx(EmptyContext.Provider, { value: { text: emptyText, fold: emptyFields === 'fold' }, children: _jsxs("div", { ref: setRoot, className: layout === 'rail' && !card
|
|
444
|
-
|
|
445
|
-
|
|
461
|
+
return (_jsx(EditInPlaceContext.Provider, { value: store, children: _jsx(EmptyContext.Provider, { value: { text: emptyText, fold: emptyFields === 'fold' }, children: _jsx(BesideFactsRailContext.Provider, { value: railFacts.length > 0, children: _jsxs("div", { ref: setRoot, className: layout === 'rail' && !card
|
|
462
|
+
? RAIL_LAYOUT.page
|
|
463
|
+
: cn('flex flex-col', railFacts.length > 0 ? FACTS_RAIL.page : 'max-w-4xl', card ? 'gap-4' : 'gap-6'), "data-facts-rail": railFacts.length > 0 ? '' : undefined, "data-state": "success", "data-layout": layout, "data-look": card ? 'card' : undefined, children: [editing && _jsx(LeaveGuard, { store: store }), !dialog && !trail && _jsx(BackLink, { back: back }), !dialog && trail && !inShell && _jsx(PageTrail, { crumbs: trail }), _jsxs("header", { className: card ? 'flex items-start justify-between gap-3' : 'flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between', children: [_jsxs("div", { className: cn('flex min-w-0 flex-1 items-start gap-3', !card && 'sm:min-w-64 sm:gap-4'), children: [leading && (_jsx("div", { "data-slot": "entity-view-leading", className: "flex shrink-0 items-center", children: leading })), _jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: [_jsxs("div", { "data-slot": "entity-view-title-line", className: "flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2", children: [_jsx("h1", { id: dialog?.titleId, className: cn('min-w-0 max-w-full break-words text-foreground', card ? 'type-section-title' : 'type-page-title'), children: titleEdit ? (_jsx(EditableField, { label: titleEdit.label, edit: titleEdit, layout: "inline", keepPencilRoom: true, children: title })) : (title) }), badges && (_jsx("div", { "data-slot": "entity-view-badges", className: "flex flex-wrap items-center gap-1.5", children: badges }))] }), subtitle && (_jsx("div", { "data-slot": "entity-view-subtitle", className: "type-body break-words text-muted-foreground", children: subtitle }))] })] }), card ? (_jsxs("div", { "data-slot": "entity-view-card-controls", className: "flex shrink-0 items-center gap-1", children: [printButton, actions, dialog?.controls] })) : ((actions || printButton) && (_jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-2 sm:justify-end", children: [printButton, actions] })))] }), _jsx("div", { role: "status", "data-slot": "entity-view-notice", className: "empty:hidden", children: notice }), strip && (!card || cardStrip) && _jsx("div", { "data-slot": "entity-view-strip", children: strip }), body, footer && (_jsx("footer", { "data-slot": "entity-view-footer", className: "type-caption text-muted-foreground", children: footer }))] }) }) }) }));
|
|
446
464
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { IconComponent } from './icon-component.js';
|
|
3
|
+
export type FactListProps = {
|
|
4
|
+
/** FactListItems. */
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
/** The list's name, when nothing beside it (a fact's label) says what it lists. */
|
|
7
|
+
'aria-label'?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
};
|
|
10
|
+
/** A list of items, each marked by its icon or a bullet, wrapped lines indented after the mark. */
|
|
11
|
+
export declare function FactList({ children, className, 'aria-label': ariaLabel }: FactListProps): import("react").JSX.Element;
|
|
12
|
+
export type FactListItemProps = {
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
/** The item's kind, drawn before it in the muted colour; a neutral bullet without one. */
|
|
15
|
+
icon?: IconComponent;
|
|
16
|
+
className?: string;
|
|
17
|
+
};
|
|
18
|
+
/** One item of a FactList: its mark, then what it holds, wrapping under itself. */
|
|
19
|
+
export declare function FactListItem({ children, icon: Icon, className }: FactListItemProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from 'cn';
|
|
3
|
+
/** A list of items, each marked by its icon or a bullet, wrapped lines indented after the mark. */
|
|
4
|
+
export function FactList({ children, className, 'aria-label': ariaLabel }) {
|
|
5
|
+
return (_jsx("ul", { "data-slot": "fact-list", "aria-label": ariaLabel, className: cn('flex min-w-0 flex-col gap-1.5', className), children: children }));
|
|
6
|
+
}
|
|
7
|
+
/** One item of a FactList: its mark, then what it holds, wrapping under itself. */
|
|
8
|
+
export function FactListItem({ children, icon: Icon, className }) {
|
|
9
|
+
return (_jsxs("li", { "data-slot": "fact-list-item", className: cn('flex min-w-0 items-start gap-2', className), children: [_jsx("span", { "data-slot": "fact-list-mark", "aria-hidden": "true", className: "flex h-[1lh] w-4 shrink-0 items-center justify-center text-muted-foreground", children: Icon ? _jsx(Icon, { "aria-hidden": "true", className: "size-3.5" }) : _jsx("span", { className: "size-1.5 rounded-full bg-current" }) }), _jsx("div", { className: "min-w-0 flex-1 break-words", children: children })] }));
|
|
10
|
+
}
|
|
@@ -21,6 +21,11 @@ export const FIELD_ROW = {
|
|
|
21
21
|
// The facts rail (4.106, A1): a 300px card, so side by side from a
|
|
22
22
|
// 16rem list, the label column a little narrower again.
|
|
23
23
|
facts: '@3xs/fields:grid @3xs/fields:grid-cols-[--spacing(24)_minmax(0,1fr)] @3xs/fields:items-baseline @3xs/fields:gap-3 @3xs/fields:py-2.5',
|
|
24
|
+
// Beside the facts rail (4.112): the cards fill the column up to the
|
|
25
|
+
// rail, so the label keeps a compact 10rem and the value takes the rest
|
|
26
|
+
// (a 12rem label, a third of a 36rem card, wrapped most values onto two
|
|
27
|
+
// lines). Stacked below `sm` or a 24rem list, as on the page.
|
|
28
|
+
wide: 'sm:@sm/fields:grid sm:@sm/fields:grid-cols-[--spacing(40)_minmax(0,1fr)] sm:@sm/fields:items-baseline sm:@sm/fields:gap-6',
|
|
24
29
|
};
|
|
25
30
|
/** A row's own spacing, before its place's grid. */
|
|
26
31
|
export const FIELD_ROW_BASE = 'flex flex-col gap-1 py-3 first:pt-0 last:pb-0';
|
|
@@ -20,13 +20,14 @@ function TabsList({ className, variant = "default", ...props }) {
|
|
|
20
20
|
return (_jsx(TabsPrimitive.List, { "data-slot": "tabs-list", "data-variant": variant, className: cn(tabsListVariants({ variant }), className), ...props }));
|
|
21
21
|
}
|
|
22
22
|
function TabsTrigger({ className, ...props }) {
|
|
23
|
-
return (_jsx(TabsPrimitive.Tab, { "data-slot": "tabs-trigger", className: cn("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/75 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", "group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-
|
|
23
|
+
return (_jsx(TabsPrimitive.Tab, { "data-slot": "tabs-trigger", className: cn("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/75 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", "group-data-[variant=line]/tabs-list:rounded-b-none group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-primary/12 dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-primary/12", "data-active:bg-background group-data-[variant=default]/tabs-list:data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:group-data-[variant=default]/tabs-list:data-active:text-foreground",
|
|
24
24
|
// The line look (a page's sub-navigation, a record's tabs): the open
|
|
25
|
-
// tab
|
|
26
|
-
//
|
|
27
|
-
//
|
|
25
|
+
// tab stands out (4.111): its name semibold in --primary-text (the
|
|
26
|
+
// primary where it's too faint for small text), a 3px primary line,
|
|
27
|
+
// and a primary tint behind it, as a picked ChoiceButtons option
|
|
28
|
+
// (bg-primary/12). A closed one is muted and medium weight. (A closed pill is the text
|
|
28
29
|
// at 75%: shadcn's 60% measured 3.45 on Palm LCD's raised surface.)
|
|
29
|
-
"group-data-[variant=line]/tabs-list:text-muted-foreground group-data-[variant=line]/tabs-list:hover:text-foreground", "group-data-[variant=line]/tabs-list:data-active:text-primary-text dark:group-data-[variant=line]/tabs-list:data-active:text-primary-text", "after:absolute after:bg-primary after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100", className), ...props }));
|
|
30
|
+
"group-data-[variant=line]/tabs-list:text-muted-foreground group-data-[variant=line]/tabs-list:hover:text-foreground group-data-[variant=line]/tabs-list:data-active:font-semibold", "group-data-[variant=line]/tabs-list:data-active:text-primary-text dark:group-data-[variant=line]/tabs-list:data-active:text-primary-text", "after:absolute after:bg-primary after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100 group-data-horizontal/tabs:group-data-[variant=line]/tabs-list:after:h-[3px] group-data-vertical/tabs:group-data-[variant=line]/tabs-list:after:w-[3px]", className), ...props }));
|
|
30
31
|
}
|
|
31
32
|
function TabsContent({ className, ...props }) {
|
|
32
33
|
return (_jsx(TabsPrimitive.Panel, { "data-slot": "tabs-content", className: cn("flex-1 text-sm outline-none", className), ...props }));
|
package/dist/index.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export { EmptyText, type EmptyTextProps } from './components/app/empty-value.js'
|
|
|
28
28
|
export { isEmptyValue } from './lib/empty-value.js';
|
|
29
29
|
export { IconAction, type IconActionProps } from './components/app/icon-action.js';
|
|
30
30
|
export { EntityView, type EntityViewEmptyFields, type EntityViewField, type EntityViewLayout, type EntityViewMobileOrder, type EntityViewPlacement, type EntityViewProps, type EntityViewRailFields, type EntityViewSection, } from './components/app/entity-view.js';
|
|
31
|
-
export { type EntityViewFact, type EntityViewFactValue } from './components/app/entity-view-facts.js';
|
|
31
|
+
export { type EntityViewFact, type EntityViewFactListItem, type EntityViewFactValue } from './components/app/entity-view-facts.js';
|
|
32
32
|
export { entityViewTabSlug } from './lib/entity-view-tab.js';
|
|
33
33
|
export { usePrinting } from './components/app/print-context.js';
|
|
34
34
|
export { RecordDialogRoute, RecordLink, type RecordDialogRouteProps, type RecordLinkProps, } from './components/app/record-dialog.js';
|
|
@@ -71,6 +71,7 @@ export { PillFilter, type PillFilterOption, type PillFilterProps } from './compo
|
|
|
71
71
|
export { SecondaryFilters, type ActiveFilter, type SecondaryFiltersProps } from './components/app/secondary-filters.js';
|
|
72
72
|
export { FilterBar, FilterSelect, type FilterBarProps, type FilterBarSearch, type FilterSelectOption, type FilterSelectProps, } from './components/app/filter-bar.js';
|
|
73
73
|
export { FilterDate, type FilterDateProps } from './components/app/filter-date.js';
|
|
74
|
+
export { FactList, FactListItem, type FactListItemProps, type FactListProps } from './components/app/fact-list.js';
|
|
74
75
|
export { DATE_FILTER_PRESETS, DATE_FILTER_PRESET_LABELS, dateFilterKeeps, dateFilterText, dateRangeValue, parseDateFilter, resolveDateFilter, type DateFilter, type DateFilterBounds, type DateFilterPreset, } from './lib/date-filter.js';
|
|
75
76
|
export { SessionStage, SessionView, sessionStageLit, sessionStageMain, sessionStageQuiet, type SessionStageProps, type SessionStageTone, type SessionViewProps, } from './components/app/session-view.js';
|
|
76
77
|
export { AllowReminders, type AllowRemindersProps } from './components/app/allow-reminders.js';
|
package/dist/index.js
CHANGED
|
@@ -77,6 +77,7 @@ export { PillFilter } from './components/app/pill-filter.js';
|
|
|
77
77
|
export { SecondaryFilters } from './components/app/secondary-filters.js';
|
|
78
78
|
export { FilterBar, FilterSelect, } from './components/app/filter-bar.js';
|
|
79
79
|
export { FilterDate } from './components/app/filter-date.js';
|
|
80
|
+
export { FactList, FactListItem } from './components/app/fact-list.js';
|
|
80
81
|
export { DATE_FILTER_PRESETS, DATE_FILTER_PRESET_LABELS, dateFilterKeeps, dateFilterText, dateRangeValue, parseDateFilter, resolveDateFilter, } from './lib/date-filter.js';
|
|
81
82
|
export { SessionStage, SessionView, sessionStageLit, sessionStageMain, sessionStageQuiet, } from './components/app/session-view.js';
|
|
82
83
|
export { AllowReminders } from './components/app/allow-reminders.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tristan2828/ui-foundation",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.112.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": {
|