@tristan2828/ui-foundation 4.82.0 → 4.84.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/README.md +1 -1
- package/conventions/docs/add-an-entity.md +4 -4
- package/conventions/docs/cell-patterns.md +111 -50
- package/conventions/docs/design-language.md +75 -30
- package/conventions/docs/entity-plan-template.md +3 -3
- package/dist/components/app/data-table.d.ts +36 -8
- package/dist/components/app/data-table.js +142 -90
- package/dist/components/app/freshness.d.ts +14 -0
- package/dist/components/app/freshness.js +25 -0
- package/dist/components/app/list-header.d.ts +44 -0
- package/dist/components/app/list-header.js +27 -0
- package/dist/components/app/needs-you.d.ts +19 -0
- package/dist/components/app/needs-you.js +30 -0
- package/dist/components/app/part-empty.d.ts +20 -0
- package/dist/components/app/part-empty.js +17 -0
- package/dist/components/app/timeline.d.ts +25 -0
- package/dist/components/app/timeline.js +31 -0
- package/dist/components/app/value-list.d.ts +14 -0
- package/dist/components/app/value-list.js +13 -0
- package/dist/components/app/widget-card.d.ts +9 -1
- package/dist/components/app/widget-card.js +3 -2
- package/dist/hooks/use-table-url-state.d.ts +19 -1
- package/dist/hooks/use-table-url-state.js +31 -3
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/dist/lib/freshness.d.ts +6 -0
- package/dist/lib/freshness.js +37 -0
- package/package.json +1 -1
- package/styles/theme.css +6 -0
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ than installing this by hand:
|
|
|
18
18
|
|
|
19
19
|
| Import | What |
|
|
20
20
|
|---|---|
|
|
21
|
-
| `@tristan2828/ui-foundation` | `AppShell`, `DataTable`, `EntityView` (with `EditableValue`, `editInPlace`, printing its notes and `usePrinting`, `KeyStats`, `IconAction`), `EntityForm`, `Markdown` (with `countTasks`, `toggleTaskAt`), `RichTextEditor`, `ErrorState`, `MultiChoice`, `MultiReference`, `ListEditor`, `PasswordInput`, `RouteErrorBoundary`, `FoundationProviders`, `DataEnvironmentBanner`, `LoginRoute`, `RegisterRoute`, `useAuth`, `useTableUrlState`, `useRecordUpdate`, `useDebouncedValue`, `createQueryClient`, `cn`; types `Page`, `AppError`, `QuerySpec`. For timed screens (`docs/foundation/timed-screens.md`): `SessionView`, `useSessionClock`, `useWakeLock`, `useMuted`, `usePrefersReducedMotion`, and the audio cues `unlockAudio`, `chime`, `sequence`, `cancelCues`, `onCuesRecovered`, `cuesInSync`, `keepAudioAlive`, `say`, `hush`, `vibrate`, `canVibrate`. For reminders (`docs/foundation/reminders.md`): `AllowReminders`, `usePushPermission`. For a record opened in a dialog over its list (`docs/foundation/add-an-entity.md`): `RecordDialogRoute`, `RecordLink`, `useOpenRecord`, `useRecordDialog`, `recordDialogState`, and for a new record over it `useNewRecordDialog`. A small form in a dialog: `FormDialog`. From `/ui/dialog`, `DialogContent` takes `size` and `dirty`, and `DiscardChangesDialog` is the "Discard your changes?" prompt |
|
|
21
|
+
| `@tristan2828/ui-foundation` | `AppShell`, `DataTable`, `EntityView` (with `EditableValue`, `editInPlace`, printing its notes and `usePrinting`, `KeyStats`, `IconAction`), `EntityForm`, `Markdown` (with `countTasks`, `toggleTaskAt`), `RichTextEditor`, `ErrorState`, `MultiChoice`, `MultiReference`, `ListEditor`, `PasswordInput`, `RouteErrorBoundary`, `FoundationProviders`, `DataEnvironmentBanner`, `LoginRoute`, `RegisterRoute`, `useAuth`, `useTableUrlState`, `useRecordUpdate`, `useDebouncedValue`, `createQueryClient`, `cn`; types `Page`, `AppError`, `QuerySpec`. For timed screens (`docs/foundation/timed-screens.md`): `SessionView`, `useSessionClock`, `useWakeLock`, `useMuted`, `usePrefersReducedMotion`, and the audio cues `unlockAudio`, `chime`, `sequence`, `cancelCues`, `onCuesRecovered`, `cuesInSync`, `keepAudioAlive`, `say`, `hush`, `vibrate`, `canVibrate`. For the page standards (`docs/foundation/design-language.md` "Parts of the page standards"): `ValueList`, `ListHeader`, `Timeline`, `NeedsYou`, `Freshness`, `PartEmpty`. For reminders (`docs/foundation/reminders.md`): `AllowReminders`, `usePushPermission`. For a record opened in a dialog over its list (`docs/foundation/add-an-entity.md`): `RecordDialogRoute`, `RecordLink`, `useOpenRecord`, `useRecordDialog`, `recordDialogState`, and for a new record over it `useNewRecordDialog`. A small form in a dialog: `FormDialog`. From `/ui/dialog`, `DialogContent` takes `size` and `dirty`, and `DiscardChangesDialog` is the "Discard your changes?" prompt |
|
|
22
22
|
| `@tristan2828/ui-foundation/ui/<name>` | shadcn primitives: badge, button, calendar, card, checkbox, combobox, dialog, empty, field, input, input-group, label, popover, select, separator, sheet, sidebar, skeleton, sonner, spinner, switch, table, textarea, tooltip |
|
|
23
23
|
| `@tristan2828/ui-foundation/gateway` | `safeFetch`, `toAppError`, `networkError` — for an app's `src/api/gateway/` only |
|
|
24
24
|
| `@tristan2828/ui-foundation/mocks` | MSW: `authHandlers`, `environmentHandlers`, `resetMockAuth`, `getMockCurrentUser`, `MOCK_USER`, `exposeMswForE2E` |
|
|
@@ -98,8 +98,8 @@ is a filled-in example while the Widgets demo is still here).
|
|
|
98
98
|
cell pattern 18, "In a table's rows": each field's cell an
|
|
99
99
|
`EditableValue` over the shared control from `<entity>-fields.tsx` and
|
|
100
100
|
`useEdit<Entity>Field`, `InlineCreate` in the toolbar for create, a
|
|
101
|
-
delete row action with its confirm dialog, and `width="
|
|
102
|
-
plan's List screen says so. There's no reference file in the template
|
|
101
|
+
delete row action with its confirm dialog, and `width="full"` only if
|
|
102
|
+
the plan's List screen says so. There's no reference file in the template
|
|
103
103
|
for this shape; the pattern's code is the reference. Its specs: each
|
|
104
104
|
cell kind saves, a refusal stays in its cell, one cell at a time, the
|
|
105
105
|
leave prompt, create (Enter, a blank name, a taken one), delete, and
|
|
@@ -1034,8 +1034,8 @@ Every dialog is one of three widths, `DialogContent`'s `size` (4.82):
|
|
|
1034
1034
|
the in-place a11y block unless the plan has an `Edit in place` line,
|
|
1035
1035
|
and then only for the fields it names.
|
|
1036
1036
|
|
|
1037
|
-
- `width="
|
|
1038
|
-
`Width:
|
|
1037
|
+
- `width="full"` on `DataTable` unless the plan's List screen says
|
|
1038
|
+
`Width: full` (`content`, the default, is right for almost every list).
|
|
1039
1039
|
- The saved-views row in `widgets-table.tsx` (`VIEWS`, the "Saved views"
|
|
1040
1040
|
button group and `visibleColumns`) unless the plan's List screen lists
|
|
1041
1041
|
saved views. When it does, copy it: `useTableUrlState`'s third argument
|
|
@@ -3,42 +3,43 @@
|
|
|
3
3
|
<!-- index: written by `npm run docs:index` in the package from the headings below; never edit it by hand -->
|
|
4
4
|
## Index
|
|
5
5
|
|
|
6
|
-
- [The rules that apply to every cell](#the-rules-that-apply-to-every-cell) · lines
|
|
7
|
-
- [1. Plain text](#1-plain-text) · lines
|
|
8
|
-
- [2. Icon + label](#2-icon--label) · lines
|
|
9
|
-
- [3. Icon in a badge](#3-icon-in-a-badge) · lines
|
|
10
|
-
- [4. Icon only, label in a tooltip](#4-icon-only-label-in-a-tooltip) · lines
|
|
11
|
-
- [Several values: the icons side by side, every name in one tooltip](#several-values-the-icons-side-by-side-every-name-in-one-tooltip) · lines
|
|
12
|
-
- [5. Enum → tone-mapped badge](#5-enum--tone-mapped-badge) · lines
|
|
13
|
-
- [6. Multi-value enum, clustered](#6-multi-value-enum-clustered) · lines
|
|
14
|
-
- [7. Link as an outline button](#7-link-as-an-outline-button) · lines
|
|
15
|
-
- [8. Date, relative](#8-date-relative) · lines
|
|
16
|
-
- [9. Ordinal scale (bounded integer)](#9-ordinal-scale-bounded-integer) · lines
|
|
17
|
-
- [Two variants the package draws: a step bar and a star](#two-variants-the-package-draws-a-step-bar-and-a-star) · lines
|
|
18
|
-
- [10. Summary in the cell, detail in a popover](#10-summary-in-the-cell-detail-in-a-popover) · lines
|
|
19
|
-
- [A second example: what a row depends on](#a-second-example-what-a-row-depends-on) · lines
|
|
20
|
-
- [11. Number or currency — Unproven](#11-number-or-currency--unproven) · lines
|
|
21
|
-
- [12. Boolean](#12-boolean) · lines
|
|
22
|
-
- [13. Progress bar — Unproven](#13-progress-bar--unproven) · lines
|
|
23
|
-
- [The compact form: `ProgressRing`](#the-compact-form-progressring) · lines
|
|
24
|
-
- [14. Avatar and name — Unproven](#14-avatar-and-name--unproven) · lines
|
|
25
|
-
- [15. Yes/no you flip in the row](#15-yesno-you-flip-in-the-row) · lines
|
|
26
|
-
- [A variant: a pressed icon inside another value's cell](#a-variant-a-pressed-icon-inside-another-values-cell) · lines
|
|
27
|
-
- [16. Title linking to the record's view](#16-title-linking-to-the-records-view) · lines
|
|
28
|
-
- [17. Quick action on the view](#17-quick-action-on-the-view) · lines
|
|
29
|
-
- [18. Editable value](#18-editable-value) · lines
|
|
30
|
-
- [Presets: one line per field](#presets-one-line-per-field) · lines
|
|
31
|
-
- [Several fields edited as one](#several-fields-edited-as-one) · lines
|
|
32
|
-
- [A link and its label](#a-link-and-its-label) · lines
|
|
33
|
-
- [A list of sub-items](#a-list-of-sub-items) · lines
|
|
34
|
-
- [In a table's rows](#in-a-tables-rows) · lines
|
|
35
|
-
- [A table of a few short columns: `width="content"`](#a-table-of-a-few-short-columns-widthcontent) · lines
|
|
36
|
-
- [19. Stage circle for an ordered status](#19-stage-circle-for-an-ordered-status) · lines
|
|
37
|
-
- [20. Count linking to the related records](#20-count-linking-to-the-related-records) · lines
|
|
38
|
-
- [21. Rows grouped under headings, and a pill filter](#21-rows-grouped-under-headings-and-a-pill-filter) · lines
|
|
39
|
-
- [22. A highlighted row, and rows that are done](#22-a-highlighted-row-and-rows-that-are-done) · lines
|
|
40
|
-
- [
|
|
41
|
-
- [
|
|
6
|
+
- [The rules that apply to every cell](#the-rules-that-apply-to-every-cell) · lines 71–90
|
|
7
|
+
- [1. Plain text](#1-plain-text) · lines 92–145
|
|
8
|
+
- [2. Icon + label](#2-icon--label) · lines 147–170
|
|
9
|
+
- [3. Icon in a badge](#3-icon-in-a-badge) · lines 172–185
|
|
10
|
+
- [4. Icon only, label in a tooltip](#4-icon-only-label-in-a-tooltip) · lines 187–264
|
|
11
|
+
- [Several values: the icons side by side, every name in one tooltip](#several-values-the-icons-side-by-side-every-name-in-one-tooltip) · lines 212–264
|
|
12
|
+
- [5. Enum → tone-mapped badge](#5-enum--tone-mapped-badge) · lines 266–279
|
|
13
|
+
- [6. Multi-value enum, clustered](#6-multi-value-enum-clustered) · lines 281–293
|
|
14
|
+
- [7. Link as an outline button](#7-link-as-an-outline-button) · lines 295–316
|
|
15
|
+
- [8. Date, relative](#8-date-relative) · lines 318–355
|
|
16
|
+
- [9. Ordinal scale (bounded integer)](#9-ordinal-scale-bounded-integer) · lines 357–405
|
|
17
|
+
- [Two variants the package draws: a step bar and a star](#two-variants-the-package-draws-a-step-bar-and-a-star) · lines 375–405
|
|
18
|
+
- [10. Summary in the cell, detail in a popover](#10-summary-in-the-cell-detail-in-a-popover) · lines 407–457
|
|
19
|
+
- [A second example: what a row depends on](#a-second-example-what-a-row-depends-on) · lines 425–457
|
|
20
|
+
- [11. Number or currency — Unproven](#11-number-or-currency--unproven) · lines 459–499
|
|
21
|
+
- [12. Boolean](#12-boolean) · lines 501–531
|
|
22
|
+
- [13. Progress bar — Unproven](#13-progress-bar--unproven) · lines 533–569
|
|
23
|
+
- [The compact form: `ProgressRing`](#the-compact-form-progressring) · lines 553–569
|
|
24
|
+
- [14. Avatar and name — Unproven](#14-avatar-and-name--unproven) · lines 571–588
|
|
25
|
+
- [15. Yes/no you flip in the row](#15-yesno-you-flip-in-the-row) · lines 590–699
|
|
26
|
+
- [A variant: a pressed icon inside another value's cell](#a-variant-a-pressed-icon-inside-another-values-cell) · lines 616–699
|
|
27
|
+
- [16. Title linking to the record's view](#16-title-linking-to-the-records-view) · lines 701–736
|
|
28
|
+
- [17. Quick action on the view](#17-quick-action-on-the-view) · lines 738–811
|
|
29
|
+
- [18. Editable value](#18-editable-value) · lines 813–1456
|
|
30
|
+
- [Presets: one line per field](#presets-one-line-per-field) · lines 1098–1156
|
|
31
|
+
- [Several fields edited as one](#several-fields-edited-as-one) · lines 1158–1194
|
|
32
|
+
- [A link and its label](#a-link-and-its-label) · lines 1196–1220
|
|
33
|
+
- [A list of sub-items](#a-list-of-sub-items) · lines 1222–1355
|
|
34
|
+
- [In a table's rows](#in-a-tables-rows) · lines 1357–1442
|
|
35
|
+
- [A table of a few short columns: `width="content"`](#a-table-of-a-few-short-columns-widthcontent) · lines 1444–1456
|
|
36
|
+
- [19. Stage circle for an ordered status](#19-stage-circle-for-an-ordered-status) · lines 1458–1524
|
|
37
|
+
- [20. Count linking to the related records](#20-count-linking-to-the-related-records) · lines 1526–1590
|
|
38
|
+
- [21. Rows grouped under headings, and a pill filter](#21-rows-grouped-under-headings-and-a-pill-filter) · lines 1592–1690
|
|
39
|
+
- [22. A highlighted row, and rows that are done](#22-a-highlighted-row-and-rows-that-are-done) · lines 1692–1721
|
|
40
|
+
- [24. A list's rows: hover, lines, rows per page](#24-a-lists-rows-hover-lines-rows-per-page) · lines 1723–1761
|
|
41
|
+
- [23. A Group menu, and a record read beside the list](#23-a-group-menu-and-a-record-read-beside-the-list) · lines 1763–1839
|
|
42
|
+
- [24. A stored colour beside its name](#24-a-stored-colour-beside-its-name) · lines 1841–1864
|
|
42
43
|
|
|
43
44
|
<!-- /index -->
|
|
44
45
|
|
|
@@ -126,6 +127,23 @@ cell, a card's line or a caption with `<Markdown inline>`, not the block
|
|
|
126
127
|
- It's for one line. Long text is notes, the block `<Markdown>` on the
|
|
127
128
|
record's view.
|
|
128
129
|
|
|
130
|
+
**Long text in a list's column: `meta.clip`.** A column whose values run
|
|
131
|
+
long (a description, a note, a path) is cut to one line, so one long value
|
|
132
|
+
can't make the whole table thousands of pixels wide:
|
|
133
|
+
|
|
134
|
+
```tsx
|
|
135
|
+
{ id: 'notes', header: 'Notes', meta: { clip: true }, cell: ({ row }) => row.original.notes }
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
- One line, cut at `meta.maxWidth` (`'24rem'` unless set, and never over
|
|
139
|
+
60% of the table's area, so a phone keeps room for the name) with an
|
|
140
|
+
ellipsis.
|
|
141
|
+
- The whole text shows in a tooltip on hover and on focus: a cell that's
|
|
142
|
+
actually cut takes a tab stop, one that fits takes none. A screen reader
|
|
143
|
+
reads the whole text either way, and the record shows it too.
|
|
144
|
+
- `meta.maxWidth` alone caps the column and lets its text wrap, for a
|
|
145
|
+
value worth reading whole in the row.
|
|
146
|
+
|
|
129
147
|
## 2. Icon + label
|
|
130
148
|
|
|
131
149
|
A single-value enum where a glyph speeds up scanning but the word still
|
|
@@ -1376,7 +1394,7 @@ column and no edit route.
|
|
|
1376
1394
|
(`schema`), and a refusal (a taken name's 422) shows under the box.
|
|
1377
1395
|
- **Delete** stays a row action: a trash button in a pinned last column
|
|
1378
1396
|
(`pinLastColumn`), with its confirm dialog.
|
|
1379
|
-
- **
|
|
1397
|
+
- **Width:** the default, `width="content"` (below), keeps the row's cells
|
|
1380
1398
|
and its delete together on a wide screen.
|
|
1381
1399
|
|
|
1382
1400
|
```tsx
|
|
@@ -1425,15 +1443,17 @@ entity yet.
|
|
|
1425
1443
|
|
|
1426
1444
|
### A table of a few short columns: `width="content"`
|
|
1427
1445
|
|
|
1428
|
-
On a wide screen a table of
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1446
|
+
On a wide screen a table of a few short columns (a name, a colour, a
|
|
1447
|
+
count, its delete) spread across the page puts the row's actions far
|
|
1448
|
+
from its name. `width="content"`, the default since 4.83 (it was an
|
|
1449
|
+
opt-in from 80rem), sizes the table and its pagination to its columns at
|
|
1450
|
+
every width, never under 36rem (or the whole width, when that's less),
|
|
1451
|
+
with empty space at the right; the toolbar keeps the whole width, so its
|
|
1452
|
+
controls sit in the same place on every list. A table wider than its
|
|
1453
|
+
area scrolls sideways inside it. While it's loading, empty or failed
|
|
1454
|
+
after a load, it keeps the width it last had, so paging and filtering
|
|
1455
|
+
don't move it; only the first load can. `width="full"` takes the whole
|
|
1456
|
+
width, the look before 4.83; a card layout always does.
|
|
1437
1457
|
|
|
1438
1458
|
## 19. Stage circle for an ordered status
|
|
1439
1459
|
|
|
@@ -1678,10 +1698,11 @@ current one. `DataTable`'s `highlightRow` returns true for it.
|
|
|
1678
1698
|
<DataTable highlightRow={(book) => book.id === nextUpId} … />
|
|
1679
1699
|
```
|
|
1680
1700
|
|
|
1681
|
-
- **A wash of info on every cell**, over
|
|
1682
|
-
columns' opaque backgrounds (`--table-highlight`, pre-mixed onto
|
|
1683
|
-
page), and a bar in `info-text` at the row's start, so it reads
|
|
1684
|
-
colour too.
|
|
1701
|
+
- **A wash of info on every cell**, over a stripe (`striped`) and the
|
|
1702
|
+
pinned columns' opaque backgrounds (`--table-highlight`, pre-mixed onto
|
|
1703
|
+
the page), and a bar in `info-text` at the row's start, so it reads
|
|
1704
|
+
without colour too. The pointer's hover (pattern 24) leaves it as it
|
|
1705
|
+
is, so "next up" never reads as the hovered row. Still **say why in the row** (a "Next up" word or badge):
|
|
1685
1706
|
the wash says "look here", not what it is.
|
|
1686
1707
|
- **Muted text inside it is darkened for you.** `muted-foreground`
|
|
1687
1708
|
measures 4.09:1 on the wash, under 4.5:1, and no lighter wash fixes it
|
|
@@ -1699,6 +1720,46 @@ current one. `DataTable`'s `highlightRow` returns true for it.
|
|
|
1699
1720
|
the token check in both themes; `e2e/data-table.spec.ts` checks every
|
|
1700
1721
|
cell wears the wash.
|
|
1701
1722
|
|
|
1723
|
+
## 24. A list's rows: hover, lines, rows per page
|
|
1724
|
+
|
|
1725
|
+
What every `DataTable` does by default since 4.83 (the list page
|
|
1726
|
+
standard), and the two choices it leaves an app.
|
|
1727
|
+
|
|
1728
|
+
- **The row under the pointer** lights whole: every cell, pinned ones
|
|
1729
|
+
included, in `--table-hover` (the muted fill, solid), with a 3px bar in
|
|
1730
|
+
`--primary` on its first cell. Muted text inside it takes the darker
|
|
1731
|
+
grey a highlighted row's does (4.34:1 would be under 4.5 in light). A
|
|
1732
|
+
row that opens a record (`opens` with a dialog, a page or the panel, or
|
|
1733
|
+
`onRowClick`) takes the hand cursor; a row edited in place
|
|
1734
|
+
(`opens={{ kind: 'rows' }}`) gets the same highlight and keeps the
|
|
1735
|
+
arrow. A highlighted row (pattern 22) and the panel's picked row keep
|
|
1736
|
+
their own look.
|
|
1737
|
+
- **No zebra stripes:** rows are told apart by the line under each.
|
|
1738
|
+
`striped` brings the stripes back for an app that wants them. Tables in
|
|
1739
|
+
notes keep theirs (4.67.1).
|
|
1740
|
+
- **Rows per page:** a menu in the pagination bar, from
|
|
1741
|
+
`useTableUrlState`, which keeps the pick in the URL (`?size=`) and on
|
|
1742
|
+
this device:
|
|
1743
|
+
|
|
1744
|
+
```tsx
|
|
1745
|
+
const { page, setPage, pageSize, pageSizes, setPageSize } = useTableUrlState(FILTERS, MULTI, VIEWS, {
|
|
1746
|
+
pageSizeStorageKey: 'my-app:recipes:page-size', // defaults: pageSizes [25, 50, 100], defaultPageSize 50
|
|
1747
|
+
})
|
|
1748
|
+
const query = useRecipes({ page, pageSize, ... })
|
|
1749
|
+
<DataTable page={page} pageSize={pageSize} onPageChange={setPage}
|
|
1750
|
+
pageSizes={pageSizes} onPageSizeChange={setPageSize} … />
|
|
1751
|
+
```
|
|
1752
|
+
|
|
1753
|
+
A pick returns to page 1. A size in the URL or storage that isn't one
|
|
1754
|
+
of `pageSizes` is ignored, so `?size=100000` can't ask the server for
|
|
1755
|
+
everything. Without `pageSizes` and `onPageSizeChange` the bar has no
|
|
1756
|
+
menu, as before.
|
|
1757
|
+
- The fixtures' `app/DataTable` ListLook, ListLookInRows and
|
|
1758
|
+
ListLookStriped stories hold all of it (with a `meta.clip` Notes
|
|
1759
|
+
column, pattern 1), under axe and the token check in both themes;
|
|
1760
|
+
`e2e/data-table.spec.ts` "list look" checks the hover on every cell,
|
|
1761
|
+
the cursors, the stripes, the tooltip, the widths and the menu.
|
|
1762
|
+
|
|
1702
1763
|
## 23. A Group menu, and a record read beside the list
|
|
1703
1764
|
|
|
1704
1765
|
A working list (tasks, chores, a backlog) is read two ways besides its
|
|
@@ -3,36 +3,37 @@
|
|
|
3
3
|
<!-- index: written by `npm run docs:index` in the package from the headings below; never edit it by hand -->
|
|
4
4
|
## Index
|
|
5
5
|
|
|
6
|
-
- [Palettes](#palettes) · lines
|
|
7
|
-
- [Glow](#glow) · lines
|
|
8
|
-
- [Semantic tones](#semantic-tones) · lines
|
|
9
|
-
- [The three badge styles](#the-three-badge-styles) · lines
|
|
10
|
-
- [Mapping an enum to tones](#mapping-an-enum-to-tones) · lines
|
|
11
|
-
- [Glyphs and icons: 3:1](#glyphs-and-icons-31) · lines
|
|
12
|
-
- [Logos and brand marks](#logos-and-brand-marks) · lines
|
|
13
|
-
- [Categorical colour](#categorical-colour) · lines
|
|
14
|
-
- [Heat scale](#heat-scale) · lines
|
|
15
|
-
- [Depth ramps](#depth-ramps) · lines
|
|
16
|
-
- [A stored colour](#a-stored-colour) · lines
|
|
17
|
-
- [Shapes and sizes](#shapes-and-sizes) · lines
|
|
18
|
-
- [Typography](#typography) · lines
|
|
19
|
-
- [Written text (notes)](#written-text-notes) · lines
|
|
20
|
-
- [Density](#density) · lines
|
|
21
|
-
- [Rows on this device](#rows-on-this-device) · lines
|
|
22
|
-
- [Widget cards (hub pages)](#widget-cards-hub-pages) · lines
|
|
23
|
-
- [Module cards (a hub's places)](#module-cards-a-hubs-places) · lines
|
|
24
|
-
- [Notices](#notices) · lines
|
|
25
|
-
- [A value over time](#a-value-over-time) · lines
|
|
26
|
-
- [Several values over time](#several-values-over-time) · lines
|
|
27
|
-
- [A list as a board](#a-list-as-a-board) · lines
|
|
28
|
-
- [A list as cards](#a-list-as-cards) · lines
|
|
29
|
-
- [Key numbers on a record](#key-numbers-on-a-record) · lines
|
|
30
|
-
- [
|
|
31
|
-
- [A record's
|
|
32
|
-
- [
|
|
33
|
-
- [
|
|
34
|
-
- [
|
|
35
|
-
- [
|
|
6
|
+
- [Palettes](#palettes) · lines 46–113
|
|
7
|
+
- [Glow](#glow) · lines 115–133
|
|
8
|
+
- [Semantic tones](#semantic-tones) · lines 135–163
|
|
9
|
+
- [The three badge styles](#the-three-badge-styles) · lines 165–182
|
|
10
|
+
- [Mapping an enum to tones](#mapping-an-enum-to-tones) · lines 184–213
|
|
11
|
+
- [Glyphs and icons: 3:1](#glyphs-and-icons-31) · lines 215–228
|
|
12
|
+
- [Logos and brand marks](#logos-and-brand-marks) · lines 230–274
|
|
13
|
+
- [Categorical colour](#categorical-colour) · lines 276–346
|
|
14
|
+
- [Heat scale](#heat-scale) · lines 348–409
|
|
15
|
+
- [Depth ramps](#depth-ramps) · lines 411–489
|
|
16
|
+
- [A stored colour](#a-stored-colour) · lines 491–539
|
|
17
|
+
- [Shapes and sizes](#shapes-and-sizes) · lines 541–562
|
|
18
|
+
- [Typography](#typography) · lines 564–684
|
|
19
|
+
- [Written text (notes)](#written-text-notes) · lines 598–684
|
|
20
|
+
- [Density](#density) · lines 686–772
|
|
21
|
+
- [Rows on this device](#rows-on-this-device) · lines 745–772
|
|
22
|
+
- [Widget cards (hub pages)](#widget-cards-hub-pages) · lines 774–888
|
|
23
|
+
- [Module cards (a hub's places)](#module-cards-a-hubs-places) · lines 890–967
|
|
24
|
+
- [Notices](#notices) · lines 969–997
|
|
25
|
+
- [A value over time](#a-value-over-time) · lines 999–1085
|
|
26
|
+
- [Several values over time](#several-values-over-time) · lines 1048–1085
|
|
27
|
+
- [A list as a board](#a-list-as-a-board) · lines 1087–1138
|
|
28
|
+
- [A list as cards](#a-list-as-cards) · lines 1140–1186
|
|
29
|
+
- [Key numbers on a record](#key-numbers-on-a-record) · lines 1188–1217
|
|
30
|
+
- [Parts of the page standards](#parts-of-the-page-standards) · lines 1219–1262
|
|
31
|
+
- [A record's header and empty values](#a-records-header-and-empty-values) · lines 1263–1301
|
|
32
|
+
- [A record's tabs, mark and rail](#a-records-tabs-mark-and-rail) · lines 1303–1348
|
|
33
|
+
- [Picking at random](#picking-at-random) · lines 1350–1381
|
|
34
|
+
- [Filling in what's missing](#filling-in-whats-missing) · lines 1383–1450
|
|
35
|
+
- [Values edited in place: the presets' looks](#values-edited-in-place-the-presets-looks) · lines 1452–1477
|
|
36
|
+
- [The sidebar and the phone's bar](#the-sidebar-and-the-phones-bar) · lines 1479–1525
|
|
36
37
|
|
|
37
38
|
<!-- /index -->
|
|
38
39
|
|
|
@@ -1215,6 +1216,50 @@ row under the header, across the page at every width.
|
|
|
1215
1216
|
- **`subtitle`** is the line under the title: what the record is for,
|
|
1216
1217
|
in muted body type, editable in place like any value.
|
|
1217
1218
|
|
|
1219
|
+
## Parts of the page standards
|
|
1220
|
+
|
|
1221
|
+
Six small parts the list, record and overview standards share. Each is
|
|
1222
|
+
generic and standalone: an app (or a later foundation release) wires it
|
|
1223
|
+
into a table, a record or an overview.
|
|
1224
|
+
|
|
1225
|
+
- **`ValueList`: several values in a cell.** `<ValueList items={[{ label }]} max={2} />`
|
|
1226
|
+
shows two values on one line and the rest as `+N`, every folded value in
|
|
1227
|
+
its tooltip (the `+N` is a button, so a keyboard and a tap reach it). A
|
|
1228
|
+
value is a chip by default, or the app's own `node` (an icon, a
|
|
1229
|
+
`ColorSwatch`) with its `label` as the plain text. An empty cell is a
|
|
1230
|
+
muted dash that reads "None".
|
|
1231
|
+
- **`ListHeader`: a list's header.** The title (the page's h1) with its
|
|
1232
|
+
`count`, `newAction` alone beside it, and one ⋯ menu for the rest. One
|
|
1233
|
+
related link in `links` stays a button; two or more fold into ⋯ with
|
|
1234
|
+
`more` (the page's own actions). `deleted={{ shown, onShownChange }}` adds
|
|
1235
|
+
"Show deleted" as the menu's last item and, while it's on, an info
|
|
1236
|
+
`Notice` with "Back to the list" in a `role="status"` region that is
|
|
1237
|
+
always there. It holds no state: the app keeps `shown`.
|
|
1238
|
+
- **`Timeline`: a record's dated history.** `items` newest first
|
|
1239
|
+
(`{ id, date, dateTime?, kind?, body, edit? }`): dates in a tabular
|
|
1240
|
+
column on the left, a dot and a thin line, the entry on the right with
|
|
1241
|
+
its `kind` as a muted line under it and `edit` (the entry's own
|
|
1242
|
+
control) at its end. The first `initial` (5) show, then "Show all N";
|
|
1243
|
+
under 24rem of its own width the date moves above its entry. Empty
|
|
1244
|
+
reads `emptyText` ("Nothing yet").
|
|
1245
|
+
- **`NeedsYou`: what waits on the user.** `items={[{ text, to, tone? }]}`:
|
|
1246
|
+
one region at the top of an overview, a warning wash with the `*-text`
|
|
1247
|
+
icon, each line a link; `tone: 'destructive'` for an overdue one.
|
|
1248
|
+
Nothing renders for an empty list.
|
|
1249
|
+
- **`Freshness`: how old a number is.** `<Freshness label="Balances entered"
|
|
1250
|
+
at="2026-08-02" staleAfter="2026-11-02" />` reads "Balances entered Aug
|
|
1251
|
+
2" in caption type and the muted tone, and once `staleAfter` has passed
|
|
1252
|
+
the warning tone with a warning icon and ", out of date" for a screen
|
|
1253
|
+
reader. The app owns the rule (entered plus 90 days); this only compares.
|
|
1254
|
+
A plain `'YYYY-MM-DD'` day is never shifted by the time zone.
|
|
1255
|
+
- **`PartEmpty` and `WidgetCard`'s `empty`: a part with nothing yet.**
|
|
1256
|
+
`empty={{ text?, action }}` draws "Nothing here yet" and one outline
|
|
1257
|
+
button (a link `to`, or `onClick`) in place of the card's plain
|
|
1258
|
+
`emptyMessage` line, the foundation's `Empty` at card size.
|
|
1259
|
+
|
|
1260
|
+
Every one is measured with axe and the glyph check in both themes
|
|
1261
|
+
(fixtures `app/ValueList`, `ListHeader`, `Timeline`, `NeedsYou`,
|
|
1262
|
+
`Freshness`, `PartEmpty`).
|
|
1218
1263
|
## A record's header and empty values
|
|
1219
1264
|
|
|
1220
1265
|
The record page standard (4.81): the same header on every record, the
|
|
@@ -143,9 +143,9 @@ per list; delete the section if there are none.
|
|
|
143
143
|
| All tasks | none | dueDate asc | |
|
|
144
144
|
| Bugs | kind = bug | dueDate asc | title, severity, assignee, dueDate |
|
|
145
145
|
|
|
146
|
-
- Width (optional): `
|
|
147
|
-
|
|
148
|
-
|
|
146
|
+
- Width (optional): `full` for a table that should take the whole page.
|
|
147
|
+
Leave it out for the default, as wide as the columns need (cell pattern
|
|
148
|
+
18, "`width="content"`").
|
|
149
149
|
- Anything else the table must show or do:
|
|
150
150
|
|
|
151
151
|
## View screen
|
|
@@ -12,6 +12,18 @@ export type SortingState = {
|
|
|
12
12
|
declare module '@tanstack/table-core' {
|
|
13
13
|
interface ColumnMeta<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> {
|
|
14
14
|
align?: 'center' | 'right';
|
|
15
|
+
/**
|
|
16
|
+
* Long text on one line (DataTable): cut at `maxWidth` with an ellipsis,
|
|
17
|
+
* the whole text in a tooltip on hover and on focus (a cut cell takes a
|
|
18
|
+
* tab stop, so the keyboard reaches it too). Screen readers read it whole.
|
|
19
|
+
*/
|
|
20
|
+
clip?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The widest the column's content gets, as a CSS length: `'24rem'`
|
|
23
|
+
* unless set, with `clip` (and never over 60% of the table's area, for
|
|
24
|
+
* a phone). Without `clip`, the content wraps at it.
|
|
25
|
+
*/
|
|
26
|
+
maxWidth?: string;
|
|
15
27
|
}
|
|
16
28
|
}
|
|
17
29
|
export type DataTableProps<TData extends Record<string, unknown>> = {
|
|
@@ -22,6 +34,14 @@ export type DataTableProps<TData extends Record<string, unknown>> = {
|
|
|
22
34
|
page: number;
|
|
23
35
|
pageSize: number;
|
|
24
36
|
onPageChange: (page: number) => void;
|
|
37
|
+
/**
|
|
38
|
+
* The rows-per-page choices (`[25, 50, 100]`), drawn as a menu in the
|
|
39
|
+
* pagination bar with `onPageSizeChange`: useTableUrlState's `pageSizes`,
|
|
40
|
+
* `pageSize` and `setPageSize`, which keep the pick in the URL and on this
|
|
41
|
+
* device (`pageSizeStorageKey`). Left out, the bar has no menu.
|
|
42
|
+
*/
|
|
43
|
+
pageSizes?: readonly number[];
|
|
44
|
+
onPageSizeChange?: (pageSize: number) => void;
|
|
25
45
|
sorting: SortingState;
|
|
26
46
|
onSortingChange: (sorting: SortingState) => void;
|
|
27
47
|
isLoading: boolean;
|
|
@@ -65,15 +85,23 @@ export type DataTableProps<TData extends Record<string, unknown>> = {
|
|
|
65
85
|
*/
|
|
66
86
|
visibleColumns?: readonly string[];
|
|
67
87
|
/**
|
|
68
|
-
* `
|
|
69
|
-
* the
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
88
|
+
* `content` (the default, 4.83): the table and its pagination are as wide
|
|
89
|
+
* as the columns need, at least 36rem (or the whole width, when that's
|
|
90
|
+
* less), with empty space at the right, so a name stays close to its
|
|
91
|
+
* values at any screen size; wider than the area, the table scrolls
|
|
92
|
+
* sideways in it. The toolbar keeps the whole width, so its controls
|
|
93
|
+
* don't move between lists. While loading, empty or failed after a
|
|
94
|
+
* load, it keeps the width it last had, so paging and filtering don't
|
|
95
|
+
* move it (only the first load can). `full`: the table takes the whole
|
|
96
|
+
* width too (the default before 4.83). A card layout takes the whole
|
|
97
|
+
* width either way.
|
|
75
98
|
*/
|
|
76
99
|
width?: DataTableWidth;
|
|
100
|
+
/**
|
|
101
|
+
* Zebra stripes on the body rows (every other row tinted), as before
|
|
102
|
+
* 4.83. Off by default: rows are told apart by the line under each.
|
|
103
|
+
*/
|
|
104
|
+
striped?: boolean;
|
|
77
105
|
/**
|
|
78
106
|
* Rows under headings: each row's group (`byDay(field)` for a feed or a
|
|
79
107
|
* log). Rows keep the server's order, and a heading row spanning every
|
|
@@ -294,4 +322,4 @@ export type DataTableTotals = {
|
|
|
294
322
|
*/
|
|
295
323
|
cells?: Partial<Record<string, ReactNode>>;
|
|
296
324
|
};
|
|
297
|
-
export declare function DataTable<TData extends Record<string, unknown>>({ columns, data, total, page, pageSize, onPageChange, sorting, onSortingChange, isLoading, error, onRetry, emptyTitle, emptyDescription, emptyAction, toolbar, getRowId, pinFirstColumn, pinLastColumn, enableSortingRemoval, visibleColumns, width, groupBy, groupSummary, stickyGroupHeadings, stickyTop, header: showHeader, highlightRow, totals, layouts, layout: layoutProp, onLayoutChange, tableLayout, groupings, grouping: groupingProp, onGroupingChange, opens, detailPanel, onRowClick: onRowClickProp, detailRow, onDetailRowChange, detailLabel, }: DataTableProps<TData>): import("react").JSX.Element;
|
|
325
|
+
export declare function DataTable<TData extends Record<string, unknown>>({ columns, data, total, page, pageSize, onPageChange, pageSizes, onPageSizeChange, sorting, onSortingChange, isLoading, error, onRetry, emptyTitle, emptyDescription, emptyAction, toolbar, getRowId, pinFirstColumn, pinLastColumn, enableSortingRemoval, visibleColumns, width, striped, groupBy, groupSummary, stickyGroupHeadings, stickyTop, header: showHeader, highlightRow, totals, layouts, layout: layoutProp, onLayoutChange, tableLayout, groupings, grouping: groupingProp, onGroupingChange, opens, detailPanel, onRowClick: onRowClickProp, detailRow, onDetailRowChange, detailLabel, }: DataTableProps<TData>): import("react").JSX.Element;
|