@tristan2828/ui-foundation 4.97.0 → 4.98.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 +66 -50
- package/conventions/docs/cell-patterns.md +41 -34
- package/conventions/docs/design-language.md +124 -68
- package/conventions/docs/entity-plan-template.md +15 -21
- package/dist/components/app/entity-view.d.ts +29 -11
- package/dist/components/app/entity-view.js +103 -26
- package/dist/components/app/key-stats.d.ts +3 -1
- package/dist/components/app/key-stats.js +2 -2
- package/dist/components/app/record-dialog-context.d.ts +9 -0
- package/dist/components/app/record-dialog.d.ts +8 -1
- package/dist/components/app/record-dialog.js +19 -3
- package/dist/components/app/status-mark.d.ts +17 -0
- package/dist/components/app/status-mark.js +12 -0
- package/dist/components/ui/field.d.ts +3 -2
- package/dist/components/ui/field.js +13 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/lib/field-rows.d.ts +3 -1
- package/dist/lib/field-rows.js +24 -6
- package/dist/lib/status-kinds.d.ts +10 -0
- package/dist/lib/status-kinds.js +33 -0
- package/package.json +1 -1
- package/styles/index.css +9 -0
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
## Index
|
|
5
5
|
|
|
6
6
|
- [The reference files](#the-reference-files) · lines 44–66
|
|
7
|
-
- [Before anything: the entity plan](#before-anything-the-entity-plan) · lines 68–
|
|
7
|
+
- [Before anything: the entity plan](#before-anything-the-entity-plan) · lines 68–847
|
|
8
8
|
- Step 1: Add `<Entity>` to `openapi.yaml` · lines 110–117
|
|
9
9
|
- Step 2: `npm run gen:api` · lines 118–119
|
|
10
10
|
- Step 3: Add gateway tests in `tests/gateway/<entity>.test.ts`, derived from the spec · lines 120–131
|
|
@@ -12,20 +12,20 @@
|
|
|
12
12
|
- Step 5: Add a gateway module in `src/api/gateway/<entity>.ts` · lines 142–146
|
|
13
13
|
- Step 6: Copy the reference files, one for one, not just the two screens · lines 147–735
|
|
14
14
|
- Step 7: Register routes · lines 736–751
|
|
15
|
-
- Step 8: Add Playwright specs for all three screens · lines 752–
|
|
16
|
-
- Step 9: Register the nav entry and route names · lines
|
|
17
|
-
- Step 10: `npm run verify`. · lines
|
|
18
|
-
- [How a list opens a record](#how-a-list-opens-a-record) · lines
|
|
19
|
-
- [The record view](#the-record-view) · lines
|
|
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
|
|
15
|
+
- Step 8: Add Playwright specs for all three screens · lines 752–829
|
|
16
|
+
- Step 9: Register the nav entry and route names · lines 830–844
|
|
17
|
+
- Step 10: `npm run verify`. · lines 845–847
|
|
18
|
+
- [How a list opens a record](#how-a-list-opens-a-record) · lines 849–1206
|
|
19
|
+
- [The record view](#the-record-view) · lines 1002–1063
|
|
20
|
+
- [Forms](#forms) · lines 1065–1123
|
|
21
|
+
- [Dialogs](#dialogs) · lines 1125–1156
|
|
22
|
+
- [Toasts and feedback](#toasts-and-feedback) · lines 1158–1206
|
|
23
|
+
- [What not to copy](#what-not-to-copy) · lines 1208–1234
|
|
24
|
+
- [After a commit, in the backend](#after-a-commit-in-the-backend) · lines 1236–1253
|
|
25
|
+
- [Deleting](#deleting) · lines 1255–1286
|
|
26
|
+
- [Fields only a script writes](#fields-only-a-script-writes) · lines 1288–1309
|
|
27
|
+
- [Searching one part of the app](#searching-one-part-of-the-app) · lines 1311–1320
|
|
28
|
+
- [What a chat is told about an entity](#what-a-chat-is-told-about-an-entity) · lines 1323–1365
|
|
29
29
|
|
|
30
30
|
<!-- /index -->
|
|
31
31
|
|
|
@@ -476,18 +476,18 @@ is a filled-in example while the Widgets demo is still here).
|
|
|
476
476
|
section that holds one long text or one sub-record list is a block
|
|
477
477
|
(`content`) with no label of its own, since a label would only repeat
|
|
478
478
|
the heading.
|
|
479
|
-
- **Layout
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
`sections` by the window's width yourself.
|
|
479
|
+
- **Layout** (the record standard, 4.98: no right rail). Pass no
|
|
480
|
+
`layout`: the default, `tabs`, is every record's shape. Give the
|
|
481
|
+
section of short facts (the plan's Placement `details`) `placement:
|
|
482
|
+
'rail'`: on a record with tabs it's the last tab, Details, and on
|
|
483
|
+
one without, it stays in the column in its place, its labels beside
|
|
484
|
+
their values. Widget's view has no tabs, so its Details comes first
|
|
485
|
+
in the one column. A few short facts that explain one tab (a dose
|
|
486
|
+
beside the notes) can sit in a small box beside that tab's
|
|
487
|
+
sections, under them on a phone: `placement: 'rail'` with that
|
|
488
|
+
`tab`. Short facts only, never free text. Never `layout="rail"` in a
|
|
489
|
+
new view; it's kept for apps not yet moved (consuming.md "4.98").
|
|
490
|
+
Never re-order `sections` by the window's width yourself.
|
|
491
491
|
- **A subtitle** (`subtitle`), only when the plan names a line that
|
|
492
492
|
says what the record is for (a goal, a one-line summary): under the
|
|
493
493
|
title in muted body type. When the plan marks it editable, wrap it
|
|
@@ -495,8 +495,8 @@ is a filled-in example while the Widgets demo is still here).
|
|
|
495
495
|
- **Key numbers** (`strip`), only when the plan names a few figures
|
|
496
496
|
read before anything else (done of total, time left, the next
|
|
497
497
|
date): `<KeyStats stats={[{ label, value, hint? }]} />`, under the
|
|
498
|
-
header
|
|
499
|
-
the
|
|
498
|
+
header, as wide as its numbers (4.98), so on a phone it comes before
|
|
499
|
+
the sections. Three to five; more belong in a section.
|
|
500
500
|
- **A notice** (`notice`), only when the plan names a state that
|
|
501
501
|
decides what you do with the record (held, overdue, archived and
|
|
502
502
|
read-only): a `<Notice tone=…>` saying what it means and what to do,
|
|
@@ -790,11 +790,10 @@ is a filled-in example while the Widgets demo is still here).
|
|
|
790
790
|
a heading, a list, a table, a link and raw HTML, and asserts the HTML
|
|
791
791
|
shows as text. Add the view's spec to `playwright.config.ts`'s
|
|
792
792
|
`mobile-chrome` `testMatch`, with a test that at phone width each
|
|
793
|
-
label sits above its value and nothing scrolls sideways. With
|
|
794
|
-
`
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
`e2e/widget-view.spec.ts`).
|
|
793
|
+
label sits above its value and nothing scrolls sideways. With a
|
|
794
|
+
section placed `details`, that test checks its labels sit beside
|
|
795
|
+
their values, and another on a wide screen that there's no rail (copy
|
|
796
|
+
`wide screens: …` in `e2e/widget-view.spec.ts`).
|
|
798
797
|
States forced via a first-load init script (loading, load-time error)
|
|
799
798
|
need `page.addInitScript` before navigation; states forced after the
|
|
800
799
|
page is already up (a mutation's error response) can use a
|
|
@@ -1012,30 +1011,40 @@ A record uses the parts it has, in this order:
|
|
|
1012
1011
|
- **Header**: the title, edited in place (`titleEdit`); under it a
|
|
1013
1012
|
one-line summary field, edited in place (`subtitle`: a goal, a
|
|
1014
1013
|
description); beside it the status as a quick action (a picker saved
|
|
1015
|
-
at once)
|
|
1014
|
+
at once), drawn as its `StatusMark` (4.98: icon, colour and word), and
|
|
1015
|
+
other status-like fields as badges, edited in place. A
|
|
1016
1016
|
record with a face or a mark of its own (a person's avatar, a
|
|
1017
1017
|
service's logo, a cover) puts it left of all that (`leading`, 4.76).
|
|
1018
1018
|
`actions` holds the record's own commands in words (Run, New visit),
|
|
1019
1019
|
then Delete (soft, with Undo) as an `IconAction`, never Edit. Print
|
|
1020
1020
|
notes is an icon of EntityView's own.
|
|
1021
1021
|
- **Strip**: the record's key numbers and ratings (`strip`, a
|
|
1022
|
-
`KeyStats
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1022
|
+
`KeyStats`, as wide as its numbers since 4.98), each edited in place
|
|
1023
|
+
where it's shown.
|
|
1024
|
+
- **Sections** (4.98, no right rail): one column. The label/value facts
|
|
1025
|
+
are placed `rail`, which makes them the last tab, Details, on a record
|
|
1026
|
+
with tabs, and keeps them in the column on one without; the long text
|
|
1027
|
+
(notes, a body) is folded by its toggle headings (`foldKey`;
|
|
1026
1028
|
`## Safety {toggle="true"}`, the only headings that fold) with an
|
|
1027
|
-
Outline for a long one and Print Notes (`print`).
|
|
1028
|
-
|
|
1029
|
-
|
|
1029
|
+
Outline for a long one and Print Notes (`print`). A small box of short
|
|
1030
|
+
facts may sit beside the one tab it explains (placed `rail` with that
|
|
1031
|
+
`tab`), never free text. Every value edited in place (`edit`), a
|
|
1032
|
+
sub-item list included (`editInPlace({ kind: 'list' })`).
|
|
1030
1033
|
- **Tabs** (4.76), for a main column with **three or more groups of
|
|
1031
1034
|
long content** (the steps, where it's used, the reasoning): a `tab` on
|
|
1032
1035
|
each main section groups them under a tab list, the selected one in
|
|
1033
1036
|
`?tab=`. Fewer groups stay one scroll, folded by headings. A record's
|
|
1034
1037
|
Notes stay outside the tabs, above them, unless they are one tab's
|
|
1035
|
-
content; the
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1038
|
+
content; the strip never goes in a tab, and the facts are a tab of
|
|
1039
|
+
their own (Details, `detailsTab` to name it otherwise).
|
|
1040
|
+
- **Facts beside their labels** (`railFields`, `beside` by default since
|
|
1041
|
+
4.81), so the short facts read as a list of pairs rather than a column
|
|
1042
|
+
of labels; keep labels to a word or two.
|
|
1043
|
+
- **A tiny record** (4.98: a few fields and no notes, like a lookup's
|
|
1044
|
+
row) opens as a small card: `RecordDialogRoute look="card"`, usually
|
|
1045
|
+
with `fullPage={false}`. A 420px dialog (a sheet on a phone), its
|
|
1046
|
+
title, Delete, Open full page and Close on one line, its facts as
|
|
1047
|
+
plain rows.
|
|
1039
1048
|
- **Empty fields folded** (`emptyFields="fold"`, 4.81): each card shows
|
|
1040
1049
|
what's known, then "N empty" opens the rest, still edited in place.
|
|
1041
1050
|
- **A few equal things** (a plan's phases, a price at each store, a
|
|
@@ -1068,7 +1077,10 @@ shape (4.85):
|
|
|
1068
1077
|
takes one short partner (Series and Number). `<Field solo>` keeps a
|
|
1069
1078
|
short one alone where a pairing would read wrong. Under 48rem every
|
|
1070
1079
|
field takes its own row but two dates or two numbers (`DateField` says
|
|
1071
|
-
so itself; a date picker of your own with `kind="date"`).
|
|
1080
|
+
so itself; a date picker of your own with `kind="date"`). A choice
|
|
1081
|
+
(`ChoiceButtons`, found by itself, 4.98) shares a row only with another
|
|
1082
|
+
choice, two to a row; on a phone two stay side by side while both
|
|
1083
|
+
groups fit, and go one per row when they don't. Never a hand-made
|
|
1072
1084
|
`sm:grid-cols-2` row.
|
|
1073
1085
|
- **Order:** required first, the status next, long text last.
|
|
1074
1086
|
- **Required:** `<FieldLabel required>` (an asterisk, and `aria-required`
|
|
@@ -1082,8 +1094,9 @@ shape (4.85):
|
|
|
1082
1094
|
example that looks like a value.
|
|
1083
1095
|
- **Messages say what to do**, in the app's voice: "Give it a title",
|
|
1084
1096
|
"Enter a full address, starting https://", never "Title is required".
|
|
1085
|
-
- **A status** is an `OptionSelect` with the same `render` (its
|
|
1086
|
-
its cell and the record: `inPlace.select`'s
|
|
1097
|
+
- **A status** is an `OptionSelect` with the same `render` (its
|
|
1098
|
+
`StatusMark`, 4.98) as its cell and the record: `inPlace.select`'s
|
|
1099
|
+
`{ value, label }` options.
|
|
1087
1100
|
- **The controls** (4.88): a choice of two to four short options is
|
|
1088
1101
|
`ChoiceButtons` (`inPlace.choice` in place), five or more an
|
|
1089
1102
|
`OptionSelect`. A date is `DateField`, typed ("3/14", "Mar 14",
|
|
@@ -1117,7 +1130,10 @@ Every dialog is one of three widths, `DialogContent`'s `size` (4.82):
|
|
|
1117
1130
|
| --- | --- | --- | --- |
|
|
1118
1131
|
| `confirm` | 420px | a sheet from the bottom, the buttons full width, the action above Cancel | a question with two answers: a delete, "Discard your changes?" |
|
|
1119
1132
|
| `form` | 640px | the whole screen, the title and buttons pinned | a small form (`FormDialog`, which is this size) |
|
|
1120
|
-
| `record` | 1,120px | full width,
|
|
1133
|
+
| `record` | 1,120px | full width, with a 1rem margin round it | a record over its list (`RecordDialogRoute`, which is this size) |
|
|
1134
|
+
|
|
1135
|
+
A tiny record (a few fields, no notes) opens in the `confirm` width
|
|
1136
|
+
instead, as a small card: `RecordDialogRoute look="card"` (4.98).
|
|
1121
1137
|
|
|
1122
1138
|
- **A dialog's title and buttons are Title Case** ("New Book", "Keep
|
|
1123
1139
|
Editing"); a question or a message in it is a sentence ("Discard your
|
|
@@ -9,40 +9,40 @@
|
|
|
9
9
|
- [3. Icon in a badge](#3-icon-in-a-badge) · lines 179–192
|
|
10
10
|
- [4. Icon only, label in a tooltip](#4-icon-only-label-in-a-tooltip) · lines 194–271
|
|
11
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 219–271
|
|
12
|
-
- [5. Enum → tone-mapped badge](#5-enum--tone-mapped-badge) · lines 273–
|
|
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
|
-
- [24. A list's rows: hover, lines, rows per page](#24-a-lists-rows-hover-lines-rows-per-page) · lines
|
|
41
|
-
- [23. A Group menu, and a record read beside the list](#23-a-group-menu-and-a-record-read-beside-the-list) · lines
|
|
42
|
-
- [24. A stored colour beside its name](#24-a-stored-colour-beside-its-name) · lines
|
|
43
|
-
- [25. A list's tools: views, filters, columns, row actions, a phone's rows](#25-a-lists-tools-views-filters-columns-row-actions-a-phones-rows) · lines
|
|
44
|
-
- [26. A record's related list, capped](#26-a-records-related-list-capped) · lines
|
|
45
|
-
- [27. A repeat and its next time](#27-a-repeat-and-its-next-time) · lines
|
|
12
|
+
- [5. Enum → tone-mapped badge](#5-enum--tone-mapped-badge) · lines 273–293
|
|
13
|
+
- [6. Multi-value enum, clustered](#6-multi-value-enum-clustered) · lines 295–307
|
|
14
|
+
- [7. Link as an outline button](#7-link-as-an-outline-button) · lines 309–330
|
|
15
|
+
- [8. Date, relative](#8-date-relative) · lines 332–369
|
|
16
|
+
- [9. Ordinal scale (bounded integer)](#9-ordinal-scale-bounded-integer) · lines 371–419
|
|
17
|
+
- [Two variants the package draws: a step bar and a star](#two-variants-the-package-draws-a-step-bar-and-a-star) · lines 389–419
|
|
18
|
+
- [10. Summary in the cell, detail in a popover](#10-summary-in-the-cell-detail-in-a-popover) · lines 421–471
|
|
19
|
+
- [A second example: what a row depends on](#a-second-example-what-a-row-depends-on) · lines 439–471
|
|
20
|
+
- [11. Number or currency — Unproven](#11-number-or-currency--unproven) · lines 473–513
|
|
21
|
+
- [12. Boolean](#12-boolean) · lines 515–545
|
|
22
|
+
- [13. Progress bar — Unproven](#13-progress-bar--unproven) · lines 547–583
|
|
23
|
+
- [The compact form: `ProgressRing`](#the-compact-form-progressring) · lines 567–583
|
|
24
|
+
- [14. Avatar and name — Unproven](#14-avatar-and-name--unproven) · lines 585–602
|
|
25
|
+
- [15. Yes/no you flip in the row](#15-yesno-you-flip-in-the-row) · lines 604–713
|
|
26
|
+
- [A variant: a pressed icon inside another value's cell](#a-variant-a-pressed-icon-inside-another-values-cell) · lines 630–713
|
|
27
|
+
- [16. Title linking to the record's view](#16-title-linking-to-the-records-view) · lines 715–750
|
|
28
|
+
- [17. Quick action on the view](#17-quick-action-on-the-view) · lines 752–825
|
|
29
|
+
- [18. Editable value](#18-editable-value) · lines 827–1505
|
|
30
|
+
- [Presets: one line per field](#presets-one-line-per-field) · lines 1137–1205
|
|
31
|
+
- [Several fields edited as one](#several-fields-edited-as-one) · lines 1207–1243
|
|
32
|
+
- [A link and its label](#a-link-and-its-label) · lines 1245–1269
|
|
33
|
+
- [A list of sub-items](#a-list-of-sub-items) · lines 1271–1404
|
|
34
|
+
- [In a table's rows](#in-a-tables-rows) · lines 1406–1491
|
|
35
|
+
- [A table of a few short columns: `width="content"`](#a-table-of-a-few-short-columns-widthcontent) · lines 1493–1505
|
|
36
|
+
- [19. Stage circle for an ordered status](#19-stage-circle-for-an-ordered-status) · lines 1507–1573
|
|
37
|
+
- [20. Count linking to the related records](#20-count-linking-to-the-related-records) · lines 1575–1639
|
|
38
|
+
- [21. Rows grouped under headings, and a pill filter](#21-rows-grouped-under-headings-and-a-pill-filter) · lines 1641–1739
|
|
39
|
+
- [22. A highlighted row, and rows that are done](#22-a-highlighted-row-and-rows-that-are-done) · lines 1741–1770
|
|
40
|
+
- [24. A list's rows: hover, lines, rows per page](#24-a-lists-rows-hover-lines-rows-per-page) · lines 1772–1810
|
|
41
|
+
- [23. A Group menu, and a record read beside the list](#23-a-group-menu-and-a-record-read-beside-the-list) · lines 1812–1888
|
|
42
|
+
- [24. A stored colour beside its name](#24-a-stored-colour-beside-its-name) · lines 1890–1913
|
|
43
|
+
- [25. A list's tools: views, filters, columns, row actions, a phone's rows](#25-a-lists-tools-views-filters-columns-row-actions-a-phones-rows) · lines 1915–2001
|
|
44
|
+
- [26. A record's related list, capped](#26-a-records-related-list-capped) · lines 2003–2039
|
|
45
|
+
- [27. A repeat and its next time](#27-a-repeat-and-its-next-time) · lines 2041–2086
|
|
46
46
|
|
|
47
47
|
<!-- /index -->
|
|
48
48
|
|
|
@@ -276,6 +276,13 @@ A many-valued enum that collapses to good / neutral / bad. **The grouping
|
|
|
276
276
|
is the decision, not the style** — see
|
|
277
277
|
[`design-language.md`](design-language.md#mapping-an-enum-to-tones).
|
|
278
278
|
|
|
279
|
+
**A record's status** is not this pattern since 4.98: it's a
|
|
280
|
+
`StatusMark` (an icon, a colour and the word, one of six kinds; see
|
|
281
|
+
[`design-language.md` "Status marks"](design-language.md#status-marks)),
|
|
282
|
+
`<StatusMark kind={STATUS_KIND[status]}>{STATUS_LABELS[status]}</StatusMark>`
|
|
283
|
+
in the cell. A tone badge stays for the other status-like values (a
|
|
284
|
+
computed progress, a source's health).
|
|
285
|
+
|
|
279
286
|
An **ordered** status (a lifecycle every record moves through toward
|
|
280
287
|
*done*) reads better as a stage circle beside the word (pattern 19);
|
|
281
288
|
the tone badge stays right for a status with no order, or one whose end
|
|
@@ -3,40 +3,41 @@
|
|
|
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
|
-
- [
|
|
11
|
-
- [
|
|
12
|
-
- [
|
|
13
|
-
- [
|
|
14
|
-
- [
|
|
15
|
-
- [
|
|
16
|
-
- [
|
|
17
|
-
- [
|
|
18
|
-
- [
|
|
19
|
-
|
|
20
|
-
- [
|
|
21
|
-
- [
|
|
22
|
-
|
|
23
|
-
- [
|
|
24
|
-
- [
|
|
25
|
-
- [
|
|
26
|
-
- [
|
|
27
|
-
|
|
28
|
-
- [
|
|
29
|
-
- [A list as
|
|
30
|
-
- [
|
|
31
|
-
- [
|
|
32
|
-
- [
|
|
33
|
-
- [
|
|
34
|
-
- [
|
|
35
|
-
- [A record's
|
|
36
|
-
- [
|
|
37
|
-
- [
|
|
38
|
-
- [
|
|
39
|
-
- [
|
|
6
|
+
- [Palettes](#palettes) · lines 50–157
|
|
7
|
+
- [Glow](#glow) · lines 159–178
|
|
8
|
+
- [Semantic tones](#semantic-tones) · lines 180–208
|
|
9
|
+
- [The three badge styles](#the-three-badge-styles) · lines 210–227
|
|
10
|
+
- [Status marks](#status-marks) · lines 229–268
|
|
11
|
+
- [Mapping an enum to tones](#mapping-an-enum-to-tones) · lines 270–299
|
|
12
|
+
- [Glyphs and icons: 3:1](#glyphs-and-icons-31) · lines 301–314
|
|
13
|
+
- [Logos and brand marks](#logos-and-brand-marks) · lines 316–360
|
|
14
|
+
- [Categorical colour](#categorical-colour) · lines 362–432
|
|
15
|
+
- [Heat scale](#heat-scale) · lines 434–495
|
|
16
|
+
- [Depth ramps](#depth-ramps) · lines 497–582
|
|
17
|
+
- [A stored colour](#a-stored-colour) · lines 584–632
|
|
18
|
+
- [Shapes and sizes](#shapes-and-sizes) · lines 634–655
|
|
19
|
+
- [Typography](#typography) · lines 657–814
|
|
20
|
+
- [Words on screen: Title Case and sentence case](#words-on-screen-title-case-and-sentence-case) · lines 691–724
|
|
21
|
+
- [Written text (notes)](#written-text-notes) · lines 726–814
|
|
22
|
+
- [Density](#density) · lines 816–909
|
|
23
|
+
- [Rows on this device](#rows-on-this-device) · lines 882–909
|
|
24
|
+
- [Widget cards (hub pages)](#widget-cards-hub-pages) · lines 911–1025
|
|
25
|
+
- [Module cards (a hub's places)](#module-cards-a-hubs-places) · lines 1027–1104
|
|
26
|
+
- [Notices](#notices) · lines 1106–1134
|
|
27
|
+
- [A value over time](#a-value-over-time) · lines 1136–1222
|
|
28
|
+
- [Several values over time](#several-values-over-time) · lines 1185–1222
|
|
29
|
+
- [A list as a board](#a-list-as-a-board) · lines 1224–1275
|
|
30
|
+
- [A list as cards](#a-list-as-cards) · lines 1277–1323
|
|
31
|
+
- [Key numbers on a record](#key-numbers-on-a-record) · lines 1325–1354
|
|
32
|
+
- [Parts of the page standards](#parts-of-the-page-standards) · lines 1356–1399
|
|
33
|
+
- [A few equal things](#a-few-equal-things) · lines 1401–1485
|
|
34
|
+
- [An overview page](#an-overview-page) · lines 1487–1550
|
|
35
|
+
- [A record's header and empty values](#a-records-header-and-empty-values) · lines 1551–1602
|
|
36
|
+
- [A record's tabs, mark and facts](#a-records-tabs-mark-and-facts) · lines 1604–1663
|
|
37
|
+
- [Picking at random](#picking-at-random) · lines 1665–1696
|
|
38
|
+
- [Filling in what's missing](#filling-in-whats-missing) · lines 1698–1765
|
|
39
|
+
- [Values edited in place: the presets' looks](#values-edited-in-place-the-presets-looks) · lines 1767–1792
|
|
40
|
+
- [The sidebar and the phone's bar](#the-sidebar-and-the-phones-bar) · lines 1794–1867
|
|
40
41
|
|
|
41
42
|
<!-- /index -->
|
|
42
43
|
|
|
@@ -225,6 +226,47 @@ themes. **A new tone or style is not done until it appears in that story.**
|
|
|
225
226
|
Pick **one style per table** and vary only the tone. Mixing styles across
|
|
226
227
|
columns makes the difference look meaningful when it isn't.
|
|
227
228
|
|
|
229
|
+
## Status marks
|
|
230
|
+
|
|
231
|
+
A record's status (4.98, the record standard's 5B) is a `StatusMark`: an
|
|
232
|
+
icon, a colour and the status's own word, the same in its cell, the
|
|
233
|
+
record's header and the select's options. Every status sorts into one of
|
|
234
|
+
six kinds; the kind decides the icon and the colour, so it reads by
|
|
235
|
+
shape without colour too, and the word stays, so nothing needs learning.
|
|
236
|
+
|
|
237
|
+
| Kind | Means | Icon | Colour |
|
|
238
|
+
|---|---|---|---|
|
|
239
|
+
| `active` | in use or under way now | a ring with a dot | `success-text` |
|
|
240
|
+
| `planned` | not started yet: an idea, queued, ordered, scheduled | a dashed ring | `info-text` |
|
|
241
|
+
| `paused` | started, then held; expected back | a ring with bars | `warning-text` |
|
|
242
|
+
| `done` | finished as meant: closed, resolved, filed, bought | a ring with a tick | muted foreground |
|
|
243
|
+
| `ended` | stopped without finishing: dropped, retired, cancelled, past | a ring with a slash | muted foreground |
|
|
244
|
+
| `attention` | overdue, failing or blocked: look now | a warning triangle | `destructive-text` |
|
|
245
|
+
|
|
246
|
+
```tsx
|
|
247
|
+
// widget-format.ts: the enum sorted by what each value means.
|
|
248
|
+
export const STATUS_KIND: Record<WidgetStatus, StatusKind> = {
|
|
249
|
+
draft: 'planned',
|
|
250
|
+
active: 'active',
|
|
251
|
+
archived: 'ended',
|
|
252
|
+
}
|
|
253
|
+
// The cell, the header and the select's render:
|
|
254
|
+
<StatusMark kind={STATUS_KIND[status]}>{WIDGET_STATUS_LABELS[status]}</StatusMark>
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
- **Sort by meaning, not by word.** "As needed" is `active`, "On hold"
|
|
258
|
+
`paused`, "Idea" and "Up next" `planned`, "Retired" `ended`.
|
|
259
|
+
`attention` is for a state that wants a look now, often worked out
|
|
260
|
+
rather than stored (a review date past due).
|
|
261
|
+
- **The icons are one map** (`STATUS_KIND_ICONS`, `lib/status-kinds.ts`
|
|
262
|
+
in the package): changing one there changes it in every app. A screen
|
|
263
|
+
can pass `icon` for one place; don't.
|
|
264
|
+
- **Measured:** every kind's word clears 4.5:1 and its icon 3:1 on the
|
|
265
|
+
page, a card and a table row, in both themes and every palette
|
|
266
|
+
(`app-statusmark--all-kinds`).
|
|
267
|
+
- Badges stay for everything else status-like (a computed progress, a
|
|
268
|
+
tag): the tone rules below.
|
|
269
|
+
|
|
228
270
|
## Mapping an enum to tones
|
|
229
271
|
|
|
230
272
|
The decision is the **grouping**, not the style. Before choosing how it
|
|
@@ -233,10 +275,10 @@ neither — including the ones that look distinct as text but should share a
|
|
|
233
275
|
tone.
|
|
234
276
|
|
|
235
277
|
```tsx
|
|
236
|
-
const
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
278
|
+
const CHECKLIST_STATE_BADGE_VARIANT: Record<WidgetChecklistState, 'outline' | 'outline-success' | 'secondary'> = {
|
|
279
|
+
none: 'secondary',
|
|
280
|
+
open: 'outline',
|
|
281
|
+
complete: 'outline-success',
|
|
240
282
|
}
|
|
241
283
|
```
|
|
242
284
|
|
|
@@ -246,8 +288,8 @@ gains a value with no tone, rather than falling back silently.
|
|
|
246
288
|
Two rules that keep this honest:
|
|
247
289
|
|
|
248
290
|
- **Most values are neutral.** If more than about a third of an enum is
|
|
249
|
-
coloured, the colour has stopped meaning anything. Widget's
|
|
250
|
-
|
|
291
|
+
coloured, the colour has stopped meaning anything. Widget's progress
|
|
292
|
+
only colours `complete`; an empty or unfinished list isn't a problem.
|
|
251
293
|
- **Never let colour be the only signal.** A colourblind reader, a
|
|
252
294
|
greyscale screenshot and a printed page all lose it. The label text
|
|
253
295
|
usually carries the meaning already; where a cell is a glyph rather than
|
|
@@ -1559,39 +1601,48 @@ data on each its own.
|
|
|
1559
1601
|
alone. A value set elsewhere moves its field into the card at once.
|
|
1560
1602
|
The fold is per card and isn't remembered.
|
|
1561
1603
|
|
|
1562
|
-
## A record's tabs, mark and
|
|
1604
|
+
## A record's tabs, mark and facts
|
|
1563
1605
|
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1606
|
+
The record standard (4.98): no right rail. A record is one column, its
|
|
1607
|
+
long content grouped under tabs where it has three or more groups, and
|
|
1608
|
+
its short facts the last tab, Details. A mark goes left of the title.
|
|
1567
1609
|
|
|
1568
1610
|
```tsx
|
|
1569
1611
|
<EntityView
|
|
1570
|
-
layout="rail"
|
|
1571
|
-
mobileOrder="main-first"
|
|
1572
1612
|
leading={<img src={photo} alt="" className="size-12 rounded-full object-cover" />}
|
|
1613
|
+
strip={<KeyStats stats={stats} />}
|
|
1573
1614
|
sections={[
|
|
1574
|
-
{ title: 'Summary', placement: 'rail', fields },
|
|
1575
|
-
{ title: 'Notes', content: <Markdown>{notes}</Markdown> },
|
|
1576
|
-
{ title: '
|
|
1577
|
-
{ title: '
|
|
1578
|
-
{ title: 'Why this order', tab: 'Reasoning', content: reasoning },
|
|
1615
|
+
{ title: 'Summary', placement: 'rail', fields }, // the Details tab
|
|
1616
|
+
{ title: 'Notes', tab: 'Notes', content: <Markdown>{notes}</Markdown> },
|
|
1617
|
+
{ title: 'Packing', tab: 'Notes', placement: 'rail', fields: packing }, // beside Notes
|
|
1618
|
+
{ title: 'Changes', tab: 'Changes', content: changes },
|
|
1579
1619
|
]}
|
|
1580
1620
|
… />
|
|
1581
1621
|
```
|
|
1582
1622
|
|
|
1583
|
-
- **Tabs** (`tab` on a
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1623
|
+
- **Tabs** (`tab` on a section): a line tab list under the strip and any
|
|
1624
|
+
sections with no tab, one tab per name in the order the sections first
|
|
1625
|
+
give it. The selected tab has foreground text and a 2px underline, the
|
|
1626
|
+
others muted text; the list's own bottom border runs the column's
|
|
1627
|
+
width. On a phone each tab is 44px tall, and a list wider than the
|
|
1628
|
+
column scrolls sideways on its own, never the page. Arrow keys move
|
|
1629
|
+
between tabs and select (Home, End), and Tab goes on into the panel.
|
|
1630
|
+
The address holds the selected tab (`?tab=used-in`,
|
|
1631
|
+
`entityViewTabSlug`), replaced rather than pushed, so Back leaves the
|
|
1632
|
+
record, not the tab. Every tab's sections stay mounted, so a value open
|
|
1633
|
+
in place survives a switch. Short tab names, one or two words; no
|
|
1634
|
+
counts or icons in them yet.
|
|
1635
|
+
- **The facts** (`placement: 'rail'` with no `tab`): the last tab,
|
|
1636
|
+
Details (`detailsTab` names it otherwise), their cards no wider than
|
|
1637
|
+
42rem, labels beside values. A record with no other tab keeps them in
|
|
1638
|
+
the column, in their place.
|
|
1639
|
+
- **A box beside a tab** (`placement: 'rail'` with a `tab`): a few short
|
|
1640
|
+
facts that explain that tab's content (a dose beside the notes), in a
|
|
1641
|
+
18rem column beside its sections once the tab is 42rem wide, under
|
|
1642
|
+
them below that. Short facts only, never free text: run-on text in a
|
|
1643
|
+
narrow box is what the standard took away.
|
|
1644
|
+
- **The strip** (`KeyStats`) is as wide as its numbers (`width="content"`,
|
|
1645
|
+
the default since 4.98), not the page's width.
|
|
1595
1646
|
- **A mark or avatar** (`leading`): left of the title, top-aligned,
|
|
1596
1647
|
with the title, subtitle and badges beside it at every width. 40 to
|
|
1597
1648
|
64px (`size-10` to `size-16`): an avatar round (`rounded-full`), a
|
|
@@ -1599,12 +1650,17 @@ since 4.81.
|
|
|
1599
1650
|
the title names the record (`alt=""`, `aria-hidden`); initials in
|
|
1600
1651
|
foreground on `bg-muted`, an icon in muted foreground on the card
|
|
1601
1652
|
with its border. "Logos and brand marks" above holds for a logo here.
|
|
1602
|
-
- **
|
|
1603
|
-
`stacked` puts each label above its value): the label in a 6 to
|
|
1653
|
+
- **Facts beside their labels** (`railFields`, `beside` by default since
|
|
1654
|
+
4.81; `stacked` puts each label above its value): the label in a 6 to
|
|
1604
1655
|
7rem column left of its value, baseline-aligned, rows a little tighter
|
|
1605
|
-
than stacked
|
|
1606
|
-
than ~350px)
|
|
1607
|
-
|
|
1656
|
+
than stacked, stacked again where the list is under 18rem (a phone
|
|
1657
|
+
narrower than ~350px).
|
|
1658
|
+
- **A tiny record** (a few fields, no notes): `RecordDialogRoute
|
|
1659
|
+
look="card"`, a 420px card dialog (a sheet on a phone) with its title,
|
|
1660
|
+
Delete, Open full page and Close on one line and the facts as plain
|
|
1661
|
+
rows, no cards.
|
|
1662
|
+
- **The rail layout** (`layout="rail"`) is the shape before 4.98, kept
|
|
1663
|
+
for apps not yet moved; a new record never uses it.
|
|
1608
1664
|
|
|
1609
1665
|
## Picking at random
|
|
1610
1666
|
|
|
@@ -161,29 +161,23 @@ does, except the quick actions, if any.
|
|
|
161
161
|
|
|
162
162
|
- Title: the field that names a record, shown as the page heading and
|
|
163
163
|
linked from the table: `title`.
|
|
164
|
-
- Badges beside the title: a few status-like fields
|
|
165
|
-
`priority`.
|
|
166
|
-
- Layout (optional; delete for one column): `rail` for a record with long
|
|
167
|
-
content (notes written as Markdown, long lists). The page takes the
|
|
168
|
-
screen's whole width, the short sections (a summary, label/value fields,
|
|
169
|
-
a few links) sit in a narrow column on the right that stays in view, and
|
|
170
|
-
the long ones fill the main column beside it. On a phone: one column,
|
|
171
|
-
the rail's sections first. Without this line, every section is in one
|
|
172
|
-
column, as wide as a long read.
|
|
173
|
-
|
|
174
|
-
Layout: rail
|
|
175
|
-
|
|
164
|
+
- Badges beside the title: a few status-like fields: `status` (its
|
|
165
|
+
StatusMark), `priority`.
|
|
176
166
|
- Sections, in order. Each lists its fields in the order they show. A
|
|
177
167
|
section holding a single long text or a single sub-records list shows
|
|
178
|
-
it under the section's heading, with no label of its own.
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
|
168
|
+
it under the section's heading, with no label of its own. Placement
|
|
169
|
+
(the record standard, 4.98: no right rail): `details` for the short
|
|
170
|
+
label/value facts, which are the record's last tab, Details, when it
|
|
171
|
+
has tabs (Tab), and stay in the column, labels beside values, when it
|
|
172
|
+
has none; `main` for everything else. A `details` section with a Tab is
|
|
173
|
+
a small box beside that tab's sections: short facts only, never free
|
|
174
|
+
text. Delete the Tab column when nothing goes under a tab.
|
|
175
|
+
|
|
176
|
+
| Section | Fields | Placement | Tab |
|
|
177
|
+
|---|---|---|---|
|
|
178
|
+
| Details | dueDate, project, tags | details | |
|
|
179
|
+
| Checklist | checklist | main | |
|
|
180
|
+
| Notes | notes | main | |
|
|
187
181
|
|
|
188
182
|
- "Not set" labels: what an empty optional field reads as on the view
|
|
189
183
|
(`dueDate`: No due date; `checklist`: No items). A field not listed here
|