@tristan2828/ui-foundation 4.96.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.
Files changed (66) hide show
  1. package/conventions/AGENTS.md +1 -1
  2. package/conventions/docs/add-an-entity.md +92 -64
  3. package/conventions/docs/cell-patterns.md +64 -54
  4. package/conventions/docs/design-language.md +168 -76
  5. package/conventions/docs/entity-plan-template.md +15 -21
  6. package/conventions/docs/reminders.md +2 -2
  7. package/conventions/docs/timed-screens.md +1 -1
  8. package/dist/components/app/action-error.js +1 -1
  9. package/dist/components/app/allow-reminders.js +1 -1
  10. package/dist/components/app/app-shell.js +4 -4
  11. package/dist/components/app/board.js +1 -1
  12. package/dist/components/app/choice-buttons.js +6 -1
  13. package/dist/components/app/data-table-tools.js +2 -2
  14. package/dist/components/app/data-table.js +4 -4
  15. package/dist/components/app/date-field.js +1 -1
  16. package/dist/components/app/emoji-field-data.js +7 -7
  17. package/dist/components/app/entity-form.js +1 -1
  18. package/dist/components/app/entity-view.d.ts +29 -11
  19. package/dist/components/app/entity-view.js +106 -29
  20. package/dist/components/app/error-state.js +1 -1
  21. package/dist/components/app/field-rows.js +6 -3
  22. package/dist/components/app/fill-in-queue.js +2 -2
  23. package/dist/components/app/filter-bar.js +1 -1
  24. package/dist/components/app/form-dialog.js +1 -1
  25. package/dist/components/app/form-section.d.ts +1 -1
  26. package/dist/components/app/image-field.js +3 -2
  27. package/dist/components/app/key-stats.d.ts +3 -1
  28. package/dist/components/app/key-stats.js +2 -2
  29. package/dist/components/app/list-header.js +2 -2
  30. package/dist/components/app/milkdown-editor.js +4 -4
  31. package/dist/components/app/month-day-field.js +3 -3
  32. package/dist/components/app/multi-pick.js +1 -1
  33. package/dist/components/app/needs-you.js +1 -1
  34. package/dist/components/app/notes-outline.js +1 -1
  35. package/dist/components/app/password-input.js +1 -1
  36. package/dist/components/app/record-dialog-context.d.ts +9 -0
  37. package/dist/components/app/record-dialog.d.ts +8 -1
  38. package/dist/components/app/record-dialog.js +19 -3
  39. package/dist/components/app/rich-text-format-items.js +6 -6
  40. package/dist/components/app/rich-text-highlight-menu.js +1 -1
  41. package/dist/components/app/rich-text-table-grips.js +16 -16
  42. package/dist/components/app/rich-text-toolbar.js +2 -2
  43. package/dist/components/app/rich-text-widgets.js +2 -2
  44. package/dist/components/app/secondary-filters.js +2 -2
  45. package/dist/components/app/session-view.js +1 -1
  46. package/dist/components/app/status-mark.d.ts +17 -0
  47. package/dist/components/app/status-mark.js +12 -0
  48. package/dist/components/app/timeline.js +1 -1
  49. package/dist/components/app/widget-layout-sheet.js +1 -1
  50. package/dist/components/ui/combobox.js +1 -1
  51. package/dist/components/ui/dialog.js +1 -1
  52. package/dist/components/ui/field.d.ts +3 -2
  53. package/dist/components/ui/field.js +13 -2
  54. package/dist/index.d.ts +3 -0
  55. package/dist/index.js +3 -0
  56. package/dist/lib/field-rows.d.ts +3 -1
  57. package/dist/lib/field-rows.js +24 -6
  58. package/dist/lib/group-by-day.js +2 -2
  59. package/dist/lib/status-kinds.d.ts +10 -0
  60. package/dist/lib/status-kinds.js +33 -0
  61. package/dist/lib/title-case.d.ts +13 -0
  62. package/dist/lib/title-case.js +66 -0
  63. package/dist/routes/login.js +4 -4
  64. package/dist/routes/register.js +1 -1
  65. package/package.json +1 -1
  66. package/styles/index.css +9 -0
@@ -3,39 +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 48–155
7
- - [Glow](#glow) · lines 157–176
8
- - [Semantic tones](#semantic-tones) · lines 178–206
9
- - [The three badge styles](#the-three-badge-styles) · lines 208–225
10
- - [Mapping an enum to tones](#mapping-an-enum-to-tones) · lines 227–256
11
- - [Glyphs and icons: 3:1](#glyphs-and-icons-31) · lines 258–271
12
- - [Logos and brand marks](#logos-and-brand-marks) · lines 273–317
13
- - [Categorical colour](#categorical-colour) · lines 319–389
14
- - [Heat scale](#heat-scale) · lines 391–452
15
- - [Depth ramps](#depth-ramps) · lines 454–539
16
- - [A stored colour](#a-stored-colour) · lines 541–589
17
- - [Shapes and sizes](#shapes-and-sizes) · lines 591–612
18
- - [Typography](#typography) · lines 614–736
19
- - [Written text (notes)](#written-text-notes) · lines 648–736
20
- - [Density](#density) · lines 738–831
21
- - [Rows on this device](#rows-on-this-device) · lines 804–831
22
- - [Widget cards (hub pages)](#widget-cards-hub-pages) · lines 833–947
23
- - [Module cards (a hub's places)](#module-cards-a-hubs-places) · lines 949–1026
24
- - [Notices](#notices) · lines 1028–1056
25
- - [A value over time](#a-value-over-time) · lines 1058–1144
26
- - [Several values over time](#several-values-over-time) · lines 1107–1144
27
- - [A list as a board](#a-list-as-a-board) · lines 1146–1197
28
- - [A list as cards](#a-list-as-cards) · lines 1199–1245
29
- - [Key numbers on a record](#key-numbers-on-a-record) · lines 1247–1276
30
- - [Parts of the page standards](#parts-of-the-page-standards) · lines 1278–1321
31
- - [A few equal things](#a-few-equal-things) · lines 1323–1407
32
- - [An overview page](#an-overview-page) · lines 1409–1472
33
- - [A record's header and empty values](#a-records-header-and-empty-values) · lines 1473–1524
34
- - [A record's tabs, mark and rail](#a-records-tabs-mark-and-rail) · lines 1526–1571
35
- - [Picking at random](#picking-at-random) · lines 1573–1604
36
- - [Filling in what's missing](#filling-in-whats-missing) · lines 1606–1673
37
- - [Values edited in place: the presets' looks](#values-edited-in-place-the-presets-looks) · lines 1675–1700
38
- - [The sidebar and the phone's bar](#the-sidebar-and-the-phones-bar) · lines 1702–1775
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
39
41
 
40
42
  <!-- /index -->
41
43
 
@@ -224,6 +226,47 @@ themes. **A new tone or style is not done until it appears in that story.**
224
226
  Pick **one style per table** and vary only the tone. Mixing styles across
225
227
  columns makes the difference look meaningful when it isn't.
226
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
+
227
270
  ## Mapping an enum to tones
228
271
 
229
272
  The decision is the **grouping**, not the style. Before choosing how it
@@ -232,10 +275,10 @@ neither — including the ones that look distinct as text but should share a
232
275
  tone.
233
276
 
234
277
  ```tsx
235
- const STATUS_BADGE_VARIANT: Record<WidgetStatus, 'outline' | 'outline-success' | 'secondary'> = {
236
- draft: 'outline',
237
- active: 'outline-success',
238
- archived: 'secondary',
278
+ const CHECKLIST_STATE_BADGE_VARIANT: Record<WidgetChecklistState, 'outline' | 'outline-success' | 'secondary'> = {
279
+ none: 'secondary',
280
+ open: 'outline',
281
+ complete: 'outline-success',
239
282
  }
240
283
  ```
241
284
 
@@ -245,8 +288,8 @@ gains a value with no tone, rather than falling back silently.
245
288
  Two rules that keep this honest:
246
289
 
247
290
  - **Most values are neutral.** If more than about a third of an enum is
248
- coloured, the colour has stopped meaning anything. Widget's `archived` is
249
- an end state, not a failure — it stays grey.
291
+ coloured, the colour has stopped meaning anything. Widget's progress
292
+ only colours `complete`; an empty or unfinished list isn't a problem.
250
293
  - **Never let colour be the only signal.** A colourblind reader, a
251
294
  greyscale screenshot and a printed page all lose it. The label text
252
295
  usually carries the meaning already; where a cell is a glyph rather than
@@ -645,6 +688,41 @@ height and weight together, from tokens in the package's `styles/theme.css`:
645
688
  - A shadcn primitive keeps its own sizes (`CardTitle`, `Button`). Don't put
646
689
  a role on one: its built-in size classes would then compete with the role.
647
690
 
691
+ ### Words on screen: Title Case and sentence case
692
+
693
+ Two cases, chosen by what the words are (4.97; before it, everything was
694
+ sentence case):
695
+
696
+ - **Title Case names a thing you can see or press:** page, dialog, sheet,
697
+ form, card and section titles; buttons and links that act like
698
+ buttons; menu items and menu labels; tabs and pills; column headers;
699
+ field labels; a group's heading in a list ("Earlier This Week"); and a
700
+ control's accessible name (`aria-label="Next Page"`, an icon button's
701
+ tooltip). "Show Deleted", "Try Again", "Rows per Page", "View All 12",
702
+ "Back to the List", "Save and Next", "Move To".
703
+ - **Sentence case is anything said to the person:** messages, help text
704
+ (`FieldDescription`), toasts, placeholders, a form's error ("Give it a
705
+ title"), an empty or error state's words, even its heading line
706
+ ("Nothing here yet", "Something went wrong", "Couldn't load"), a
707
+ notice's title, a question ("Discard your changes?"), and a sentence
708
+ read to a screen reader (a live announcement, "Moved Fix the latch to
709
+ Done"). A value the app shows is written as its data is (a status
710
+ label, a rule's phrase "Every weekday", "Not set").
711
+ - **The small words stay lowercase** unless first or last, or first
712
+ after a colon: a, an, the, and, but, or, nor, as, at, by, for, in, of,
713
+ on, per, to, with (`TITLE_CASE_SMALL_WORDS`). Every other word,
714
+ however short, is capitalised ("Turn Into Page", "Show All", "Is",
715
+ "It"), and so is each part of a hyphenated word ("Follow-Up"). A word
716
+ that is part of a verb ("Sign In", "Log Out", "Turn Off") is
717
+ capitalised even where it is a small word elsewhere.
718
+ - **A label written in the code is written in Title Case**; a label built
719
+ from a value goes through `titleCase()` (`` `Add ${titleCase(noun)}` ``).
720
+ `titleCase` leaves a word that already holds a capital as written, so
721
+ names and acronyms survive ("Open in GitHub").
722
+ - **The words around a name keep the name's own case:** `Back to
723
+ ${list}` gets the list's title as it is, `Actions for ${row}` the row's
724
+ name.
725
+
648
726
  ### Written text (notes)
649
727
 
650
728
  A one-line value written as Markdown (a cell, a card's line) is
@@ -1291,14 +1369,14 @@ into a table, a record or an overview.
1291
1369
  `count`, `newAction` alone beside it, and one ⋯ menu for the rest. One
1292
1370
  related link in `links` stays a button; two or more fold into ⋯ with
1293
1371
  `more` (the page's own actions). `deleted={{ shown, onShownChange }}` adds
1294
- "Show deleted" as the menu's last item and, while it's on, an info
1295
- `Notice` with "Back to the list" in a `role="status"` region that is
1372
+ "Show Deleted" as the menu's last item and, while it's on, an info
1373
+ `Notice` with "Back to the List" in a `role="status"` region that is
1296
1374
  always there. It holds no state: the app keeps `shown`.
1297
1375
  - **`Timeline`: a record's dated history.** `items` newest first
1298
1376
  (`{ id, date, dateTime?, kind?, body, edit? }`): dates in a tabular
1299
1377
  column on the left, a dot and a thin line, the entry on the right with
1300
1378
  its `kind` as a muted line under it and `edit` (the entry's own
1301
- control) at its end. The first `initial` (5) show, then "Show all N";
1379
+ control) at its end. The first `initial` (5) show, then "Show All N";
1302
1380
  under 24rem of its own width the date moves above its entry. Empty
1303
1381
  reads `emptyText` ("Nothing yet").
1304
1382
  - **`NeedsYou`: what waits on the user.** `items={[{ text, to, tone? }]}`:
@@ -1491,13 +1569,13 @@ data on each its own.
1491
1569
  too long for both pushes them to the next line, starting under it.
1492
1570
  `subtitle` is the line below, in muted body type.
1493
1571
  - **Actions**: the record's own commands in words (New visit, Mark
1494
- done), then the universal ones as `IconAction`s: Print notes
1572
+ done), then the universal ones as `IconAction`s: Print Notes
1495
1573
  (`printer`, EntityView's own) and Delete (`trash-2`, the destructive
1496
1574
  tone). Each is a square outline button at the header's 36px with its
1497
1575
  words as both its tooltip and its accessible name. Icon alone is for
1498
- the universal actions only (Delete, Print notes, Copy link, Pin, Open
1499
- site, Restore, Open full page, Close, More); everything else keeps its
1500
- word. `printLook="words"` keeps Print notes as a button with its words.
1576
+ the universal actions only (Delete, Print Notes, Copy link, Pin, Open
1577
+ site, Restore, Open Full Page, Close, More); everything else keeps its
1578
+ word. `printLook="words"` keeps Print Notes as a button with its words.
1501
1579
  - **An empty value** reads as a dash (`emptyText`, default `'—'`), in the
1502
1580
  muted text tone, read by a screen reader as "Not set": the same on
1503
1581
  every field, the presets' included. A field's own `emptyLabel` still
@@ -1518,44 +1596,53 @@ data on each its own.
1518
1596
  - **Folded empties** (`emptyFields="fold"`): each fields card lists its
1519
1597
  filled fields, then a muted, underlined "N empty" with a down chevron
1520
1598
  under them opens the rest in their places, each still edited in place,
1521
- and reads "Hide empty" (the chevron up) while open. A card with
1599
+ and reads "Hide Empty" (the chevron up) while open. A card with
1522
1600
  nothing empty has no toggle; one with nothing filled has the toggle
1523
1601
  alone. A value set elsewhere moves its field into the card at once.
1524
1602
  The fold is per card and isn't remembered.
1525
1603
 
1526
- ## A record's tabs, mark and rail
1604
+ ## A record's tabs, mark and facts
1527
1605
 
1528
- Three settings on `EntityView` (4.76): tabs and a mark, each for a
1529
- record that needs it, and rail fields beside their labels, the default
1530
- since 4.81.
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.
1531
1609
 
1532
1610
  ```tsx
1533
1611
  <EntityView
1534
- layout="rail"
1535
- mobileOrder="main-first"
1536
1612
  leading={<img src={photo} alt="" className="size-12 rounded-full object-cover" />}
1613
+ strip={<KeyStats stats={stats} />}
1537
1614
  sections={[
1538
- { title: 'Summary', placement: 'rail', fields },
1539
- { title: 'Notes', content: <Markdown>{notes}</Markdown> },
1540
- { title: 'Steps', tab: 'Steps', content: steps },
1541
- { title: 'Where it applies', tab: 'Used in', content: uses },
1542
- { 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 },
1543
1619
  ]}
1544
1620
  … />
1545
1621
  ```
1546
1622
 
1547
- - **Tabs** (`tab` on a main section): a line tab list at the top of
1548
- the main column, under the strip and any sections with no tab, one
1549
- tab per name in the order the sections first give it. The selected
1550
- tab has foreground text and a 2px underline, the others muted text;
1551
- the list's own bottom border runs the column's width. On a phone each
1552
- tab is 44px tall, and a list wider than the column scrolls sideways on
1553
- its own, never the page. Arrow keys move between tabs and select
1554
- (Home, End), and Tab goes on into the panel. The address holds the
1555
- selected tab (`?tab=used-in`, `entityViewTabSlug`), replaced rather
1556
- than pushed, so Back leaves the record, not the tab. Every tab's
1557
- sections stay mounted, so a value open in place survives a switch.
1558
- Short tab names, one or two words; no counts or icons in them yet.
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.
1559
1646
  - **A mark or avatar** (`leading`): left of the title, top-aligned,
1560
1647
  with the title, subtitle and badges beside it at every width. 40 to
1561
1648
  64px (`size-10` to `size-16`): an avatar round (`rounded-full`), a
@@ -1563,12 +1650,17 @@ since 4.81.
1563
1650
  the title names the record (`alt=""`, `aria-hidden`); initials in
1564
1651
  foreground on `bg-muted`, an icon in muted foreground on the card
1565
1652
  with its border. "Logos and brand marks" above holds for a logo here.
1566
- - **Rail fields beside** (`railFields`, `beside` by default since 4.81;
1567
- `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
1568
1655
  7rem column left of its value, baseline-aligned, rows a little tighter
1569
- than stacked. Where the rail's list is under 18rem (a phone narrower
1570
- than ~350px) it stacks as before, and once the rail stacks full width
1571
- the label column widens to the page's.
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.
1572
1664
 
1573
1665
  ## Picking at random
1574
1666
 
@@ -1648,7 +1740,7 @@ size"); the list stays where a record is edited one field at a time.
1648
1740
  clicked again to clear) for a short choice, any input for the rest.
1649
1741
  A guess is a `suggestion`: drawn dashed in the info tone and said
1650
1742
  under the row, never picked for the person.
1651
- - **Quick from the keyboard:** Enter is Save and next (not in a
1743
+ - **Quick from the keyboard:** Enter is Save and Next (not in a
1652
1744
  textarea), and the one row marked `shortcut` takes the number keys.
1653
1745
  After a move the focus is on the new record.
1654
1746
  - A refused save keeps the record and says why under the buttons, not
@@ -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, as badges: `status`,
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. With
179
- `Layout: rail`, Placement says which column each goes in (`rail` or
180
- `main`); otherwise delete the column.
181
-
182
- | Section | Fields | Placement |
183
- |---|---|---|
184
- | Details | dueDate, project, tags | rail |
185
- | Checklist | checklist | main |
186
- | Notes | notes | main |
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
@@ -39,8 +39,8 @@ const push = usePushPermission()
39
39
 
40
40
  | `status` | Means | Shows |
41
41
  |---|---|---|
42
- | `off` | Can be turned on | The description and "Allow reminders" |
43
- | `on` | This device gets them | "Reminders are on for this device", and "Turn off" |
42
+ | `off` | Can be turned on | The description and "Allow Reminders" |
43
+ | `on` | This device gets them | "Reminders are on for this device", and "Turn Off" |
44
44
  | `needs-install` | iPhone or iPad in a browser tab | How to add the app to the Home Screen |
45
45
  | `blocked` | The person said no | Where to allow it again |
46
46
  | `unsupported` | No push in this browser | That it can't |
@@ -57,7 +57,7 @@ const primary = useRef<HTMLButtonElement>(null)
57
57
 
58
58
  - **The title is required.** It names the dialog for screen readers and
59
59
  heads the view. The header also holds Close and, with
60
- `fullscreenControl`, a "Full screen" toggle.
60
+ `fullscreenControl`, a "Full Screen" toggle.
61
61
  - **Real fullscreen** asks the browser to take the whole screen too
62
62
  (hiding its own bars). Where the browser can't (iOS Safari on a phone),
63
63
  the control isn't shown. The view already covers the page. Closing the
@@ -11,5 +11,5 @@ import { Button } from '../ui/button.js';
11
11
  import { Spinner } from '../ui/spinner.js';
12
12
  import { Notice } from './notice.js';
13
13
  export function ActionError({ action, title, className }) {
14
- return (_jsx("div", { role: "status", "data-slot": "action-error", className: cn('empty:hidden', className), children: action.error && (_jsx(Notice, { tone: "destructive", title: title, action: _jsxs(Button, { type: "button", size: "sm", variant: "outline", disabled: action.pending, onClick: () => void action.retry(), children: [action.pending && _jsx(Spinner, { className: "size-4" }), "Try again"] }), children: action.error })) }));
14
+ return (_jsx("div", { role: "status", "data-slot": "action-error", className: cn('empty:hidden', className), children: action.error && (_jsx(Notice, { tone: "destructive", title: title, action: _jsxs(Button, { type: "button", size: "sm", variant: "outline", disabled: action.pending, onClick: () => void action.retry(), children: [action.pending && _jsx(Spinner, { className: "size-4" }), "Try Again"] }), children: action.error })) }));
15
15
  }
@@ -7,5 +7,5 @@ import { Notice } from './notice.js';
7
7
  const DEFAULT_DESCRIPTION = 'Get a notification on this device at the times you set, even when the app is closed. Your browser will ask first.';
8
8
  export function AllowReminders({ push, description = DEFAULT_DESCRIPTION, className }) {
9
9
  const { status, pending, error } = push;
10
- return (_jsxs("div", { "data-slot": "allow-reminders", className: cn('flex flex-col gap-3', className), "aria-busy": status === undefined || pending, children: [status === undefined && _jsx(Skeleton, { className: "h-9 w-full max-w-md" }), status === 'off' && (_jsxs(_Fragment, { children: [_jsx("p", { className: "text-sm text-foreground", children: description }), _jsx("div", { children: _jsxs(Button, { onClick: push.enable, disabled: pending, children: [_jsx(BellIcon, { "aria-hidden": "true" }), pending ? 'Turning on…' : 'Allow reminders'] }) })] })), status === 'on' && (_jsx(Notice, { tone: "success", icon: BellIcon, action: _jsxs(Button, { size: "sm", variant: "outline", onClick: push.disable, disabled: pending, children: [_jsx(BellOffIcon, { "aria-hidden": "true" }), pending ? 'Turning off…' : 'Turn off'] }), children: "Reminders are on for this device." })), status === 'needs-install' && (_jsx(Notice, { title: "Add the app to your Home Screen first", children: "On iPhone and iPad, reminders work in the app from the Home Screen. Tap Share, then Add to Home Screen, open the app from there and allow reminders." })), status === 'blocked' && (_jsx(Notice, { tone: "warning", title: "Notifications are blocked", icon: BellOffIcon, children: "This browser was told not to show this app\u2019s notifications. Allow them in the site\u2019s settings (the icon beside the address), then reload." })), status === 'unsupported' && (_jsx("p", { className: "text-sm text-muted-foreground", children: "This browser can\u2019t show reminders." })), status === 'mock' && (_jsx("p", { className: "text-sm text-muted-foreground", children: "Reminders need the real backend: with mock data nothing can send them." })), error && (_jsx("p", { role: "alert", className: "text-sm text-destructive-text", children: error }))] }));
10
+ return (_jsxs("div", { "data-slot": "allow-reminders", className: cn('flex flex-col gap-3', className), "aria-busy": status === undefined || pending, children: [status === undefined && _jsx(Skeleton, { className: "h-9 w-full max-w-md" }), status === 'off' && (_jsxs(_Fragment, { children: [_jsx("p", { className: "text-sm text-foreground", children: description }), _jsx("div", { children: _jsxs(Button, { onClick: push.enable, disabled: pending, children: [_jsx(BellIcon, { "aria-hidden": "true" }), pending ? 'Turning on…' : 'Allow Reminders'] }) })] })), status === 'on' && (_jsx(Notice, { tone: "success", icon: BellIcon, action: _jsxs(Button, { size: "sm", variant: "outline", onClick: push.disable, disabled: pending, children: [_jsx(BellOffIcon, { "aria-hidden": "true" }), pending ? 'Turning off…' : 'Turn Off'] }), children: "Reminders are on for this device." })), status === 'needs-install' && (_jsx(Notice, { title: "Add the app to your Home Screen first", children: "On iPhone and iPad, reminders work in the app from the Home Screen. Tap Share, then Add to Home Screen, open the app from there and allow reminders." })), status === 'blocked' && (_jsx(Notice, { tone: "warning", title: "Notifications are blocked", icon: BellOffIcon, children: "This browser was told not to show this app\u2019s notifications. Allow them in the site\u2019s settings (the icon beside the address), then reload." })), status === 'unsupported' && (_jsx("p", { className: "text-sm text-muted-foreground", children: "This browser can\u2019t show reminders." })), status === 'mock' && (_jsx("p", { className: "text-sm text-muted-foreground", children: "Reminders need the real backend: with mock data nothing can send them." })), error && (_jsx("p", { role: "alert", className: "text-sm text-destructive-text", children: error }))] }));
11
11
  }
@@ -69,10 +69,10 @@ function PaletteSwatch({ name }) {
69
69
  function LookMenu({ palette }) {
70
70
  const { setPalette } = usePalette();
71
71
  const { rows, picker: pickRows, setRows } = useRows();
72
- return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { render: _jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": palette ? `Palette: ${PALETTE_LABELS[palette]}` : `Rows: ${ROWS_LABELS[rows]}` }), children: palette ? _jsx(PaletteIcon, {}) : _jsx(Rows3Icon, {}) }), _jsxs(DropdownMenuContent, { align: "end", className: "w-60", children: [palette && (_jsxs(DropdownMenuGroup, { children: [_jsx(DropdownMenuLabel, { children: "Palette on this device" }), _jsx(DropdownMenuRadioGroup, { value: palette, onValueChange: (next) => {
72
+ return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { render: _jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": palette ? `Palette: ${PALETTE_LABELS[palette]}` : `Rows: ${ROWS_LABELS[rows]}` }), children: palette ? _jsx(PaletteIcon, {}) : _jsx(Rows3Icon, {}) }), _jsxs(DropdownMenuContent, { align: "end", className: "w-60", children: [palette && (_jsxs(DropdownMenuGroup, { children: [_jsx(DropdownMenuLabel, { children: "Palette on This Device" }), _jsx(DropdownMenuRadioGroup, { value: palette, onValueChange: (next) => {
73
73
  if (isPaletteName(next))
74
74
  setPalette(next);
75
- }, children: PALETTES.map((name) => (_jsxs(DropdownMenuRadioItem, { value: name, children: [_jsx(PaletteSwatch, { name: name }), PALETTE_LABELS[name]] }, name))) })] })), palette && pickRows && _jsx(DropdownMenuSeparator, {}), pickRows && (_jsxs(DropdownMenuGroup, { children: [_jsx(DropdownMenuLabel, { children: "Rows on this device" }), _jsx(DropdownMenuRadioGroup, { value: rows, onValueChange: (next) => {
75
+ }, children: PALETTES.map((name) => (_jsxs(DropdownMenuRadioItem, { value: name, children: [_jsx(PaletteSwatch, { name: name }), PALETTE_LABELS[name]] }, name))) })] })), palette && pickRows && _jsx(DropdownMenuSeparator, {}), pickRows && (_jsxs(DropdownMenuGroup, { children: [_jsx(DropdownMenuLabel, { children: "Rows on This Device" }), _jsx(DropdownMenuRadioGroup, { value: rows, onValueChange: (next) => {
76
76
  if (isRowsName(next))
77
77
  setRows(next);
78
78
  }, children: ROWS.map((name) => (_jsx(DropdownMenuRadioItem, { value: name, children: ROWS_LABELS[name] }, name))) })] }))] })] }));
@@ -80,7 +80,7 @@ function LookMenu({ palette }) {
80
80
  function ThemeToggle() {
81
81
  const { resolvedTheme, setTheme } = useTheme();
82
82
  const isDark = resolvedTheme === 'dark';
83
- return (_jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": "Toggle dark mode", onClick: () => setTheme(isDark ? 'light' : 'dark'), children: isDark ? _jsx(SunIcon, {}) : _jsx(MoonIcon, {}) }));
83
+ return (_jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": "Toggle Dark Mode", onClick: () => setTheme(isDark ? 'light' : 'dark'), children: isDark ? _jsx(SunIcon, {}) : _jsx(MoonIcon, {}) }));
84
84
  }
85
85
  // Hidden on the icon rail, like the user's name beside it.
86
86
  function VersionEntry({ version }) {
@@ -230,7 +230,7 @@ export function AppShell({ title, logo: Logo, nav, sidebarExtra, defaultSidebarO
230
230
  const trail = ownTrail ?? navTrail(nav, location.pathname);
231
231
  const groups = navGroups(nav);
232
232
  const renderGroup = (group, groupIndex) => group.collapsible && group.label !== undefined ? (_jsx(CollapsibleNavGroup, { group: { ...group, label: group.label }, activeTo: activeTo }, `${group.placement ?? 'top'}:${groupIndex}:${group.label}`)) : (_jsxs(SidebarGroup, { children: [group.label !== undefined && _jsx(SidebarGroupLabel, { children: group.label }), _jsx(SidebarGroupContent, { children: _jsx(NavMenu, { items: group.items, activeTo: activeTo }) })] }, `${group.placement ?? 'top'}:${groupIndex}:${group.label ?? ''}`));
233
- return (_jsxs(TooltipProvider, { children: [reporter && _jsx(ReportRoutePattern, { reporter: reporter }), _jsxs(SidebarProvider, { defaultOpen: storedSidebarOpen(defaultSidebarOpen), children: [_jsx(CloseMobileSidebarOnNavigate, {}), _jsx("nav", { "aria-label": "Primary", children: _jsxs(Sidebar, { collapsible: "icon", children: [_jsx(SidebarHeader, { children: _jsxs("div", { className: "flex items-center gap-2 px-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:px-0", children: [Logo && (_jsx(Logo, { "aria-hidden": "true", className: "size-5 shrink-0 text-sidebar-foreground group-data-[collapsible=icon]:size-4" })), _jsx("span", { className: "truncate text-sm font-semibold text-sidebar-foreground group-data-[collapsible=icon]:hidden", children: title })] }) }), _jsxs(SidebarContent, { children: [groups.filter((group) => !group.placement).map(renderGroup), sidebarExtra, groups.some((group) => group.placement) && (_jsx("div", { "data-slot": "nav-foot", className: "mt-auto flex flex-col", children: groups.filter((group) => group.placement).map(renderGroup) }))] }), _jsxs(SidebarFooter, { children: [version && _jsx(VersionEntry, { version: version }), _jsxs("div", { className: "flex items-center justify-between gap-2 px-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:px-0", children: [_jsx("span", { className: "truncate type-caption text-sidebar-foreground/70 group-data-[collapsible=icon]:hidden", children: user.name }), _jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": "Log out", onClick: () => {
233
+ return (_jsxs(TooltipProvider, { children: [reporter && _jsx(ReportRoutePattern, { reporter: reporter }), _jsxs(SidebarProvider, { defaultOpen: storedSidebarOpen(defaultSidebarOpen), children: [_jsx(CloseMobileSidebarOnNavigate, {}), _jsx("nav", { "aria-label": "Primary", children: _jsxs(Sidebar, { collapsible: "icon", children: [_jsx(SidebarHeader, { children: _jsxs("div", { className: "flex items-center gap-2 px-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:px-0", children: [Logo && (_jsx(Logo, { "aria-hidden": "true", className: "size-5 shrink-0 text-sidebar-foreground group-data-[collapsible=icon]:size-4" })), _jsx("span", { className: "truncate text-sm font-semibold text-sidebar-foreground group-data-[collapsible=icon]:hidden", children: title })] }) }), _jsxs(SidebarContent, { children: [groups.filter((group) => !group.placement).map(renderGroup), sidebarExtra, groups.some((group) => group.placement) && (_jsx("div", { "data-slot": "nav-foot", className: "mt-auto flex flex-col", children: groups.filter((group) => group.placement).map(renderGroup) }))] }), _jsxs(SidebarFooter, { children: [version && _jsx(VersionEntry, { version: version }), _jsxs("div", { className: "flex items-center justify-between gap-2 px-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:px-0", children: [_jsx("span", { className: "truncate type-caption text-sidebar-foreground/70 group-data-[collapsible=icon]:hidden", children: user.name }), _jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": "Log Out", onClick: () => {
234
234
  setIsLoggingOut(true);
235
235
  // The records opened lately are this person's: the
236
236
  // next to sign in on this device doesn't see them.
@@ -127,5 +127,5 @@ function BoardColumnView({ column, count, headingLevel, onDrop, children, }) {
127
127
  }, children: [_jsxs(Heading, { id: headingId, className: "flex items-center gap-2 px-1 pt-0.5 type-label", children: [column.label, _jsx("span", { className: "font-normal tabular-nums text-muted-foreground", children: count })] }), children] }));
128
128
  }
129
129
  function MoveMenu({ id, name, value, targets, onMove, }) {
130
- return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { render: _jsx(Button, { variant: "ghost", size: "icon-xs", "aria-label": `Move ${name}`, title: "Move to\u2026", "data-board-move": id }), children: _jsx(ArrowRightLeftIcon, { "aria-hidden": "true" }) }), _jsx(DropdownMenuContent, { align: "end", className: "w-44", children: _jsxs(DropdownMenuGroup, { children: [_jsx(DropdownMenuLabel, { children: "Move to" }), _jsx(DropdownMenuRadioGroup, { value: value, onValueChange: (next) => onMove(next), children: targets.map((target) => (_jsx(DropdownMenuRadioItem, { value: target.value, closeOnClick: true, children: target.label }, target.value))) })] }) })] }));
130
+ return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { render: _jsx(Button, { variant: "ghost", size: "icon-xs", "aria-label": `Move ${name}`, title: "Move To\u2026", "data-board-move": id }), children: _jsx(ArrowRightLeftIcon, { "aria-hidden": "true" }) }), _jsx(DropdownMenuContent, { align: "end", className: "w-44", children: _jsxs(DropdownMenuGroup, { children: [_jsx(DropdownMenuLabel, { children: "Move To" }), _jsx(DropdownMenuRadioGroup, { value: value, onValueChange: (next) => onMove(next), children: targets.map((target) => (_jsx(DropdownMenuRadioItem, { value: target.value, closeOnClick: true, children: target.label }, target.value))) })] }) })] }));
131
131
  }
@@ -13,5 +13,10 @@ export function ChoiceButtons({ id, options, value, onValueChange, render, clear
13
13
  const option = options[Number(key)];
14
14
  if (option && option.value !== value)
15
15
  onValueChange(option.value);
16
- }, disabled: disabled, "aria-invalid": invalid || undefined, className: cn('max-w-full flex-wrap rounded-md aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40', className), ...aria, children: options.map((option, index) => (_jsx(ToggleGroupItem, { value: String(index), className: cn('h-(--control-height,--spacing(8)) px-3 font-normal text-muted-foreground aria-pressed:font-medium aria-pressed:text-foreground', invalid && 'border-destructive'), children: render ? render(option.value, option.label) : option.label }, String(option.value)))) }));
16
+ }, disabled: disabled, "aria-invalid": invalid || undefined, className: cn('max-w-full min-w-0 flex-wrap gap-y-1 rounded-md pl-px aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40', className), ...aria, children: options.map((option, index) => (_jsx(ToggleGroupItem, { value: String(index), className: cn(
17
+ // Every button has its left border (`!`: the joined group drops it
18
+ // after the first) and overlaps the one before by it, so a button
19
+ // that wraps to a new line starts with an edge; `pl-px` on the
20
+ // group keeps that edge inside the box.
21
+ '-ml-px border-l! h-(--control-height,--spacing(8)) max-w-full px-3 font-normal text-muted-foreground aria-pressed:font-medium aria-pressed:text-foreground', invalid && 'border-destructive'), children: render ? render(option.value, option.label) : option.label }, String(option.value)))) }));
17
22
  }
@@ -16,7 +16,7 @@ export function ViewPills({ views, value, onValueChange, label, }) {
16
16
  }
17
17
  export function ColumnsMenu({ columns, visible, fixed, pick, onPickChange, setByView, label = 'Columns', }) {
18
18
  const ids = [...fixed, ...columns.map((column) => column.id)];
19
- return (_jsxs(DropdownMenu, { children: [_jsxs(DropdownMenuTrigger, { render: _jsx(Button, { variant: "outline", size: "sm", "data-slot": "data-table-columns-menu" }), children: [_jsx(Columns3Icon, { "aria-hidden": "true" }), label] }), _jsxs(DropdownMenuContent, { align: "end", className: "w-52", children: [_jsxs(DropdownMenuGroup, { children: [_jsx(DropdownMenuLabel, { children: setByView ? 'Set by this view' : 'Show columns' }), columns.map((column) => (_jsx(DropdownMenuCheckboxItem, { checked: visible.includes(column.id), disabled: setByView, onCheckedChange: (checked) => onPickChange(togglePick(ids, visible, column.id, checked, pick)), children: column.label }, column.id)))] }), pick && !setByView ? (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuItem, { onClick: () => onPickChange(null), children: "Reset to the list's columns" })] })) : null] })] }));
19
+ return (_jsxs(DropdownMenu, { children: [_jsxs(DropdownMenuTrigger, { render: _jsx(Button, { variant: "outline", size: "sm", "data-slot": "data-table-columns-menu" }), children: [_jsx(Columns3Icon, { "aria-hidden": "true" }), label] }), _jsxs(DropdownMenuContent, { align: "end", className: "w-52", children: [_jsxs(DropdownMenuGroup, { children: [_jsx(DropdownMenuLabel, { children: setByView ? 'Set by This View' : 'Show Columns' }), columns.map((column) => (_jsx(DropdownMenuCheckboxItem, { checked: visible.includes(column.id), disabled: setByView, onCheckedChange: (checked) => onPickChange(togglePick(ids, visible, column.id, checked, pick)), children: column.label }, column.id)))] }), pick && !setByView ? (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuItem, { onClick: () => onPickChange(null), children: "Reset to the List's Columns" })] })) : null] })] }));
20
20
  }
21
21
  export function RowActions({ actions, rowLabel }) {
22
22
  if (actions.length === 0)
@@ -55,5 +55,5 @@ export function ViewAllLink({ viewAll, total, navigator }) {
55
55
  return;
56
56
  event.preventDefault();
57
57
  void navigator.push(viewAll.to);
58
- }, children: viewAll.label ?? `View all ${total}` }));
58
+ }, children: viewAll.label ?? `View All ${total}` }));
59
59
  }
@@ -97,14 +97,14 @@ function LayoutSwitch({ options, value, onValueChange, }) {
97
97
  const NO_GROUPING = '__none__';
98
98
  function GroupMenu({ groupings, value, onValueChange, }) {
99
99
  const current = groupings.find((grouping) => grouping.id === value);
100
- return (_jsxs(DropdownMenu, { children: [_jsxs(DropdownMenuTrigger, { render: _jsx(Button, { variant: "outline", size: "sm", "data-slot": "data-table-group-menu" }), children: [_jsx(ListTreeIcon, { "aria-hidden": "true" }), current ? `Group: ${current.label}` : 'Group'] }), _jsx(DropdownMenuContent, { align: "end", className: "w-48", children: _jsxs(DropdownMenuGroup, { children: [_jsx(DropdownMenuLabel, { children: "Group by" }), _jsxs(DropdownMenuRadioGroup, { value: current?.id ?? NO_GROUPING, onValueChange: (next) => onValueChange(next === NO_GROUPING ? '' : String(next)), children: [_jsx(DropdownMenuRadioItem, { value: NO_GROUPING, closeOnClick: true, children: "None" }), groupings.map((grouping) => (_jsx(DropdownMenuRadioItem, { value: grouping.id, closeOnClick: true, children: grouping.label }, grouping.id)))] })] }) })] }));
100
+ return (_jsxs(DropdownMenu, { children: [_jsxs(DropdownMenuTrigger, { render: _jsx(Button, { variant: "outline", size: "sm", "data-slot": "data-table-group-menu" }), children: [_jsx(ListTreeIcon, { "aria-hidden": "true" }), current ? `Group: ${current.label}` : 'Group'] }), _jsx(DropdownMenuContent, { align: "end", className: "w-48", children: _jsxs(DropdownMenuGroup, { children: [_jsx(DropdownMenuLabel, { children: "Group By" }), _jsxs(DropdownMenuRadioGroup, { value: current?.id ?? NO_GROUPING, onValueChange: (next) => onValueChange(next === NO_GROUPING ? '' : String(next)), children: [_jsx(DropdownMenuRadioItem, { value: NO_GROUPING, closeOnClick: true, children: "None" }), groupings.map((grouping) => (_jsx(DropdownMenuRadioItem, { value: grouping.id, closeOnClick: true, children: grouping.label }, grouping.id)))] })] }) })] }));
101
101
  }
102
102
  // The rows-per-page menu in the pagination bar (`pageSizes`): a radio list
103
103
  // that closes on a pick. The button says the size in words of its own
104
104
  // ("50 rows", as the list page standard drew it), and the menu says
105
105
  // what it is.
106
106
  function PageSizeMenu({ pageSizes, value, onValueChange, }) {
107
- return (_jsxs(DropdownMenu, { children: [_jsxs(DropdownMenuTrigger, { render: _jsx(Button, { variant: "outline", size: "sm", "data-slot": "data-table-page-size", "aria-label": `${value} rows per page` }), children: [value, " rows", _jsx(ChevronDownIcon, { "aria-hidden": "true" })] }), _jsx(DropdownMenuContent, { align: "end", className: "w-40", children: _jsxs(DropdownMenuGroup, { children: [_jsx(DropdownMenuLabel, { children: "Rows per page" }), _jsx(DropdownMenuRadioGroup, { value: String(value), onValueChange: (next) => onValueChange(Number(next)), children: pageSizes.map((size) => (_jsx(DropdownMenuRadioItem, { value: String(size), closeOnClick: true, children: size }, size))) })] }) })] }));
107
+ return (_jsxs(DropdownMenu, { children: [_jsxs(DropdownMenuTrigger, { render: _jsx(Button, { variant: "outline", size: "sm", "data-slot": "data-table-page-size", "aria-label": `${value} rows per page` }), children: [value, " rows", _jsx(ChevronDownIcon, { "aria-hidden": "true" })] }), _jsx(DropdownMenuContent, { align: "end", className: "w-40", children: _jsxs(DropdownMenuGroup, { children: [_jsx(DropdownMenuLabel, { children: "Rows per Page" }), _jsx(DropdownMenuRadioGroup, { value: String(value), onValueChange: (next) => onValueChange(Number(next)), children: pageSizes.map((size) => (_jsx(DropdownMenuRadioItem, { value: String(size), closeOnClick: true, children: size }, size))) })] }) })] }));
108
108
  }
109
109
  // A cell's text cut to one line (`meta.clip`). Only when it is cut does it
110
110
  // take a tab stop and a tooltip with the whole text, on hover and on focus;
@@ -711,7 +711,7 @@ export function DataTable({ columns, data, total, page, pageSize, onPageChange,
711
711
  const view = views?.[id];
712
712
  if (view)
713
713
  onViewChange?.(view, id);
714
- } })) : null, layouts?.length || groupings?.length || showColumnsMenu ? (_jsxs("div", { className: "flex flex-wrap items-end gap-x-4 gap-y-2", children: [_jsx("div", { className: "min-w-0 flex-1 basis-72", children: toolbar }), showColumnsMenu ? (_jsx(ColumnsMenu, { label: columnsMenu?.label, columns: menuColumns, visible: shownColumns ?? leafIds, fixed: fixedColumns, pick: columnsPick, onPickChange: setColumnsPick, setByView: viewColumns !== undefined })) : null, groupings?.length ? (_jsxs("div", { className: "flex items-center gap-2", children: [activeGrouping && (_jsx(Button, { variant: "ghost", size: "sm", "data-slot": "data-table-fold-all", disabled: !runs?.length, onClick: foldAll, children: allFolded ? 'Unfold all' : 'Fold all' })), _jsx(GroupMenu, { groupings: groupings, value: activeGrouping?.id ?? '', onValueChange: setGrouping })] })) : null, layouts?.length ? (_jsx(LayoutSwitch, { options: [
714
+ } })) : null, layouts?.length || groupings?.length || showColumnsMenu ? (_jsxs("div", { className: "flex flex-wrap items-end gap-x-4 gap-y-2", children: [_jsx("div", { className: "min-w-0 flex-1 basis-72", children: toolbar }), showColumnsMenu ? (_jsx(ColumnsMenu, { label: columnsMenu?.label, columns: menuColumns, visible: shownColumns ?? leafIds, fixed: fixedColumns, pick: columnsPick, onPickChange: setColumnsPick, setByView: viewColumns !== undefined })) : null, groupings?.length ? (_jsxs("div", { className: "flex items-center gap-2", children: [activeGrouping && (_jsx(Button, { variant: "ghost", size: "sm", "data-slot": "data-table-fold-all", disabled: !runs?.length, onClick: foldAll, children: allFolded ? 'Unfold All' : 'Fold All' })), _jsx(GroupMenu, { groupings: groupings, value: activeGrouping?.id ?? '', onValueChange: setGrouping })] })) : null, layouts?.length ? (_jsx(LayoutSwitch, { options: [
715
715
  { id: 'table', label: tableLayout?.label ?? 'Table', icon: tableLayout?.icon ?? TableIcon },
716
716
  ...layouts,
717
717
  ], value: currentLayout, onValueChange: setLayout })) : null] })) : (toolbar), _jsx("div", { ref: body, "data-slot": "data-table-body", className: cn('flex flex-col gap-4', fitsColumns && CONTENT_WIDTH_CLASS), style: fitsColumns && !isSuccessView && lastWidth !== null
@@ -767,7 +767,7 @@ export function DataTable({ columns, data, total, page, pageSize, onPageChange,
767
767
  })) : (_jsx(TableBody, { className: cn(!striped && UNSTRIPED_BODY_CLASS), children: rows.map((row) => renderRow(row)) })), totals && (_jsx(TableFooter, { className: TOTALS_FOOTER_CLASS, children: _jsx(TableRow, { "data-slot": "table-totals", className: "hover:bg-transparent", children: visibleLeafColumns.map((column, index) => {
768
768
  const className = cn(pinFirstColumn && index === 0 && PINNED_TOTALS_LABEL_CLASS, pinLast && index === visibleColumnCount - 1 && PINNED_LAST_COLUMN_CLASS, alignClass(column.columnDef.meta?.align));
769
769
  return index === 0 ? (_jsx(TableHead, { scope: "row", className: cn(TOTALS_LABEL_CLASS, className), children: pinFirstColumn ? (_jsx("div", { className: PINNED_FIRST_CONTENT_CLASS, children: totals.label })) : (totals.label) }, column.id)) : (_jsx(TableCell, { className: className, children: totals.cells?.[column.id] }, column.id));
770
- }) }) }))] })), pinFirstColumn && isOverflowing && !cardLayout && !showPhoneRows && (_jsx("div", { ref: barRef, "aria-hidden": "true", tabIndex: -1, "data-slot": "bottom-scrollbar", className: "sticky bottom-0 z-20 h-4 overflow-x-auto border-t border-border bg-background", children: _jsx("div", { style: { width: scrollWidth, height: 1 } }) })), viewAll && limit !== undefined && viewAllTotal > rows.length ? (_jsx(ViewAllLink, { viewAll: viewAll, total: viewAllTotal, navigator: navigation?.navigator })) : null, limit === undefined && (_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-x-4 gap-y-2", "data-slot": "data-table-pagination", children: [_jsxs("p", { className: "type-body text-muted-foreground", children: [total === 0 ? 0 : (page - 1) * pageSize + 1, '–', Math.min(page * pageSize, total), " of ", total] }), _jsxs("div", { className: "flex items-center gap-2", children: [pageSizes && pageSizes.length > 1 && onPageSizeChange ? (_jsx(PageSizeMenu, { pageSizes: pageSizes, value: pageSize, onValueChange: onPageSizeChange })) : null, _jsx(Button, { variant: "outline", size: "icon-sm", "aria-label": "Previous page", disabled: page <= 1, onClick: () => onPageChange(page - 1), children: _jsx(ChevronLeftIcon, {}) }), _jsxs("span", { className: "type-body text-muted-foreground", children: ["Page ", page, " of ", pageCount] }), _jsx(Button, { variant: "outline", size: "icon-sm", "aria-label": "Next page", disabled: page >= pageCount, onClick: () => onPageChange(page + 1), children: _jsx(ChevronRightIcon, {}) })] })] }))] })) })] }));
770
+ }) }) }))] })), pinFirstColumn && isOverflowing && !cardLayout && !showPhoneRows && (_jsx("div", { ref: barRef, "aria-hidden": "true", tabIndex: -1, "data-slot": "bottom-scrollbar", className: "sticky bottom-0 z-20 h-4 overflow-x-auto border-t border-border bg-background", children: _jsx("div", { style: { width: scrollWidth, height: 1 } }) })), viewAll && limit !== undefined && viewAllTotal > rows.length ? (_jsx(ViewAllLink, { viewAll: viewAll, total: viewAllTotal, navigator: navigation?.navigator })) : null, limit === undefined && (_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-x-4 gap-y-2", "data-slot": "data-table-pagination", children: [_jsxs("p", { className: "type-body text-muted-foreground", children: [total === 0 ? 0 : (page - 1) * pageSize + 1, '–', Math.min(page * pageSize, total), " of ", total] }), _jsxs("div", { className: "flex items-center gap-2", children: [pageSizes && pageSizes.length > 1 && onPageSizeChange ? (_jsx(PageSizeMenu, { pageSizes: pageSizes, value: pageSize, onValueChange: onPageSizeChange })) : null, _jsx(Button, { variant: "outline", size: "icon-sm", "aria-label": "Previous Page", disabled: page <= 1, onClick: () => onPageChange(page - 1), children: _jsx(ChevronLeftIcon, {}) }), _jsxs("span", { className: "type-body text-muted-foreground", children: ["Page ", page, " of ", pageCount] }), _jsx(Button, { variant: "outline", size: "icon-sm", "aria-label": "Next Page", disabled: page >= pageCount, onClick: () => onPageChange(page + 1), children: _jsx(ChevronRightIcon, {}) })] })] }))] })) })] }));
771
771
  return (_jsx(EditInPlaceContext.Provider, { value: store, children: _jsxs(RowActionsContext.Provider, { value: rowActions, children: [editing && _jsx(LeaveGuard, { store: store }), width === 'content' ? _jsx("div", { className: "@container/data-table", children: content }) : content, detailPanel && (_jsx(Sheet, { open: Boolean(selectedRow) && !isWide && isSuccessView && !cardLayout, onOpenChange: (open) => {
772
772
  if (!open)
773
773
  setSelection(null);
@@ -100,7 +100,7 @@ function TypedDate({ id, value, onChange, onPick, onProblem, placeholder, cleara
100
100
  };
101
101
  const selected = plainDateToLocal(given);
102
102
  const showProblem = told && problem !== null;
103
- return (_jsxs("div", { "data-slot": "date-field", "data-kind": "date", className: cn('flex w-full min-w-0 flex-col gap-1.5', className), children: [_jsxs(InputGroup, { ref: group, children: [_jsx(InputGroupInput, { ref: box, id: id, value: text, onChange: (event) => type(event.target.value), onBlur: settle, onKeyDown: onKeyDown, placeholder: placeholder ?? plainDateExamples(locale), readOnly: readOnly, autoComplete: "off", "aria-invalid": invalid || showProblem || undefined, "aria-describedby": [showProblem ? messageId : null, describedBy].filter(Boolean).join(' ') || undefined, ...aria }), _jsx(InputGroupAddon, { align: "inline-end", children: _jsxs(Popover, { open: open, onOpenChange: changeOpen, modal: modal, children: [_jsx(PopoverTrigger, { render: _jsx(InputGroupButton, { type: "button", size: "icon-xs", variant: "ghost", disabled: readOnly, "aria-label": "Open calendar" }), children: _jsx(CalendarIcon, { "aria-hidden": "true" }) }), _jsxs(PopoverContent, { ref: popup, anchor: group, align: "start", className: "w-auto p-0", "data-slot": "date-field-calendar",
103
+ return (_jsxs("div", { "data-slot": "date-field", "data-kind": "date", className: cn('flex w-full min-w-0 flex-col gap-1.5', className), children: [_jsxs(InputGroup, { ref: group, children: [_jsx(InputGroupInput, { ref: box, id: id, value: text, onChange: (event) => type(event.target.value), onBlur: settle, onKeyDown: onKeyDown, placeholder: placeholder ?? plainDateExamples(locale), readOnly: readOnly, autoComplete: "off", "aria-invalid": invalid || showProblem || undefined, "aria-describedby": [showProblem ? messageId : null, describedBy].filter(Boolean).join(' ') || undefined, ...aria }), _jsx(InputGroupAddon, { align: "inline-end", children: _jsxs(Popover, { open: open, onOpenChange: changeOpen, modal: modal, children: [_jsx(PopoverTrigger, { render: _jsx(InputGroupButton, { type: "button", size: "icon-xs", variant: "ghost", disabled: readOnly, "aria-label": "Open Calendar" }), children: _jsx(CalendarIcon, { "aria-hidden": "true" }) }), _jsxs(PopoverContent, { ref: popup, anchor: group, align: "start", className: "w-auto p-0", "data-slot": "date-field-calendar",
104
104
  // The day the keyboard starts from (the chosen one, else today).
105
105
  initialFocus: () => popup.current?.querySelector('button[data-day][tabindex="0"]') ?? true,
106
106
  // Back to the box, where typing goes on.