@tristan2828/ui-foundation 4.137.2 → 4.139.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.
@@ -1116,7 +1116,7 @@ A record uses the parts it has, in this order:
1116
1116
  - **Facts beside their labels** (`railFields`, `beside` by default), so the short facts read as a list of pairs rather than a column
1117
1117
  of labels; keep labels to a word or two.
1118
1118
  - **The facts rail**: `factsRail` on the
1119
- view puts the record's short facts in a 300px column beside the
1119
+ view puts the record's short facts in a narrow column beside the
1120
1120
  record's body where the view has room (60rem: a laptop's page, a record
1121
1121
  dialog), so the page doesn't end 900px in. The strip stays above it at
1122
1122
  full width, and the rail starts level with the first content under the
@@ -19,31 +19,31 @@
19
19
  - [Typography](#typography) · lines 603–773
20
20
  - [Words on screen: Title Case and sentence case](#words-on-screen-title-case-and-sentence-case) · lines 637–669
21
21
  - [Written text (notes)](#written-text-notes) · lines 671–773
22
- - [Density](#density) · lines 775–886
23
- - [Rows on this device](#rows-on-this-device) · lines 833–860
24
- - [Page width (a record on a wide screen)](#page-width-a-record-on-a-wide-screen) · lines 862–886
25
- - [Widget cards (hub pages)](#widget-cards-hub-pages) · lines 888–998
26
- - [Module cards (a hub's places)](#module-cards-a-hubs-places) · lines 1000–1072
27
- - [Notices](#notices) · lines 1074–1101
28
- - [A value over time](#a-value-over-time) · lines 1103–1233
29
- - [Several values over time](#several-values-over-time) · lines 1152–1190
30
- - [Parts of a whole over time](#parts-of-a-whole-over-time) · lines 1192–1233
31
- - [A list as a board](#a-list-as-a-board) · lines 1235–1345
32
- - [Order, groups and the header](#order-groups-and-the-header) · lines 1288–1345
33
- - [A list as cards](#a-list-as-cards) · lines 1347–1394
34
- - [Images full screen](#images-full-screen) · lines 1396–1442
35
- - [Key numbers on a record](#key-numbers-on-a-record) · lines 1444–1480
36
- - [Parts of the page standards](#parts-of-the-page-standards) · lines 1482–1518
37
- - [A few equal things](#a-few-equal-things) · lines 1520–1635
38
- - [An overview page](#an-overview-page) · lines 1637–1702
39
- - [A record's header and empty values](#a-records-header-and-empty-values) · lines 1704–1767
40
- - [A record's tabs, mark and facts](#a-records-tabs-mark-and-facts) · lines 1769–1856
41
- - [Picking at random](#picking-at-random) · lines 1858–1889
42
- - [Filling in what's missing](#filling-in-whats-missing) · lines 1891–1958
43
- - [Values edited in place: the presets' looks](#values-edited-in-place-the-presets-looks) · lines 1960–1979
44
- - [A quick add line](#a-quick-add-line) · lines 1981–2009
45
- - [A month calendar](#a-month-calendar) · lines 2011–2035
46
- - [The sidebar and the phone's bar](#the-sidebar-and-the-phones-bar) · lines 2037–2089
22
+ - [Density](#density) · lines 775–896
23
+ - [Rows on this device](#rows-on-this-device) · lines 842–869
24
+ - [Page width (a record on a wide screen)](#page-width-a-record-on-a-wide-screen) · lines 871–896
25
+ - [Widget cards (hub pages)](#widget-cards-hub-pages) · lines 898–1008
26
+ - [Module cards (a hub's places)](#module-cards-a-hubs-places) · lines 1010–1082
27
+ - [Notices](#notices) · lines 1084–1111
28
+ - [A value over time](#a-value-over-time) · lines 1113–1243
29
+ - [Several values over time](#several-values-over-time) · lines 1162–1200
30
+ - [Parts of a whole over time](#parts-of-a-whole-over-time) · lines 1202–1243
31
+ - [A list as a board](#a-list-as-a-board) · lines 1245–1355
32
+ - [Order, groups and the header](#order-groups-and-the-header) · lines 1298–1355
33
+ - [A list as cards](#a-list-as-cards) · lines 1357–1404
34
+ - [Images full screen](#images-full-screen) · lines 1406–1452
35
+ - [Key numbers on a record](#key-numbers-on-a-record) · lines 1454–1490
36
+ - [Parts of the page standards](#parts-of-the-page-standards) · lines 1492–1528
37
+ - [A few equal things](#a-few-equal-things) · lines 1530–1645
38
+ - [An overview page](#an-overview-page) · lines 1647–1712
39
+ - [A record's header and empty values](#a-records-header-and-empty-values) · lines 1714–1777
40
+ - [A record's tabs, mark and facts](#a-records-tabs-mark-and-facts) · lines 1779–1866
41
+ - [Picking at random](#picking-at-random) · lines 1868–1899
42
+ - [Filling in what's missing](#filling-in-whats-missing) · lines 1901–1968
43
+ - [Values edited in place: the presets' looks](#values-edited-in-place-the-presets-looks) · lines 1970–1989
44
+ - [A quick add line](#a-quick-add-line) · lines 1991–2019
45
+ - [A month calendar](#a-month-calendar) · lines 2021–2051
46
+ - [The sidebar and the phone's bar](#the-sidebar-and-the-phones-bar) · lines 2053–2105
47
47
 
48
48
  <!-- /index -->
49
49
 
@@ -774,7 +774,7 @@ pulls the eye from every other column (cell patterns 16 and 20).
774
774
 
775
775
  ## Density
776
776
 
777
- Four densities, set with `data-density` on **any ancestor** (a wrapper
777
+ Five densities, set with `data-density` on **any ancestor** (a wrapper
778
778
  `<div>`, a route's layout, or `<html>` for the whole app). It is a token
779
779
  set, not a `DataTable` prop:
780
780
 
@@ -790,16 +790,18 @@ set, not a `DataTable` prop:
790
790
  | `compact` | a hub's cards (`WidgetCard`, `WidgetList` rows, `ModuleCard`); table rows stay the default's | 4px | 32px | a dense hub |
791
791
  | `comfortable` | table rows only | 12px | 48px | short tables, or rows people read rather than scan |
792
792
  | `large` | **everything**: type, spacing, control heights, icons, the sidebar, table rows | 12px | 56px | a screen read from a distance: a TV used as the desktop monitor, with a mouse and keyboard |
793
+ | `extra-large` | **everything**, a step past `large` | 13px | 63px | the same screen read from further back, such as a couch |
793
794
 
794
795
  - `compact` and `comfortable` change padding only. Text keeps
795
796
  `type-body`, so compact never drops below a readable size.
796
- - **Forms are compact at every density but `large`**: inside a
797
+ - **Forms are compact at every density but the two large ones**: inside a
797
798
  `FieldGroup` (every `EntityForm`, `FormDialog` and `FormSection`) the
798
799
  inputs, selects, combobox boxes and default buttons are 32px, the
799
800
  compact table's row, with 14px between fields; under 48rem or on a
800
801
  touch screen 40px, for the finger. They read `--control-height`, which
801
- `FieldGroup` and the forms' bars set from `--spacing`, so `large` grows
802
- them as it grows everything. Outside a form a control keeps its 36px.
802
+ `FieldGroup` and the forms' bars set from `--spacing`, so `large` and
803
+ `extra-large` grow them as they grow everything. Outside a form a control
804
+ keeps its 36px.
803
805
  - On a hub, `compact` takes a `WidgetCard`'s padding from 16px to 12px,
804
806
  a `WidgetList` row from 36px to 32px (6px around its line) and a
805
807
  `ModuleCard`'s band and body by 4px each. On a phone a compact row is
@@ -810,20 +812,27 @@ set, not a `DataTable` prop:
810
812
  Breakpoints and `max-w-*` containers stay where they are, which is
811
813
  what browser zoom can't do (zoom narrows the viewport in CSS pixels, so
812
814
  a wide screen can fall into the phone layout).
813
- - For `large`, set it on **`<html>`**. Menus, selects, dialogs and
814
- tooltips are portaled to `<body>`, so a wrapper `<div>` doesn't reach
815
+ - `extra-large` is `large` about a ninth bigger again: body text 18 → 20px,
816
+ captions 15 → 17px, spacing 5 → 5.6px (controls 45px tall, icons 22px, the
817
+ sidebar 358px), and every other size in proportion. It sets every token
818
+ `large` sets, so whatever follows `large` follows it. It also widens a
819
+ record's facts rail to 336px (`--facts-rail-width`; 300px at every other
820
+ density), so a label still sits beside its value.
821
+ - For `large` and `extra-large`, set it on **`<html>`**. Menus, selects,
822
+ dialogs and tooltips are portaled to `<body>`, so a wrapper `<div>` doesn't reach
815
823
  them. `compact` and `comfortable` only touch tables and hub cards, so a
816
824
  wrapper is fine.
817
825
  - Pick **one density per screen**. Two tables at different densities side
818
826
  by side look like a mistake.
819
- - Size things the way the package does and `large` reaches them for free:
827
+ - Size things the way the package does and `large` and `extra-large` reach
828
+ them for free:
820
829
  Tailwind's spacing and size utilities (`h-8`, `size-4`, `gap-2`, `w-64`)
821
830
  and `text-*`/`type-*`. A fixed `h-[18px]`, `w-[240px]` or
822
- `text-[13px]` stays its size at `large`; write it as a step of the scale
831
+ `text-[13px]` stays its size at both; write it as a step of the scale
823
832
  (`h-[--spacing(4.5)]`) instead.
824
833
  - Under the hood, the table primitive's cells read `--table-cell-px`,
825
- `--table-cell-py` and `--table-head-height`. `large` also redefines
826
- Tailwind's own scale (`--spacing`, `--text-*`, `--radius`), the `--type-*`
834
+ `--table-cell-py` and `--table-head-height`. `large` and `extra-large` also
835
+ redefine Tailwind's own scale (`--spacing`, `--text-*`, `--radius`), the `--type-*`
827
836
  roles and `--control-text-sm` (the small Button and Toggle). The
828
837
  selectors are in `styles/theme.css`. A composite reaches `compact` with
829
838
  the `density-compact:` variant (`styles/index.css`: any ancestor with
@@ -862,10 +871,11 @@ toggle in an app without a palette).
862
871
  ### Page width (a record on a wide screen)
863
872
 
864
873
  A record page (`EntityView`) keeps a reading width: its column is at most
865
- `max-w-4xl`, and with a facts rail the page is that plus the 300px rail.
874
+ `max-w-4xl`, and with a facts rail the page is that plus the 300px rail (336px
875
+ at `extra-large` density).
866
876
  On a TV the right of the page is then empty. `data-width="wide"` on
867
877
  `<html>` lifts the cap: the column fills the page and the rail
868
- stays 300px, moving right with it.
878
+ keeps its width, moving right with it.
869
879
 
870
880
  ```ts
871
881
  // The app's own Page Width setting, kept per browser, applied before first paint.
@@ -2021,6 +2031,12 @@ package's `MonthCalendar`. Not a date picker, which is
2021
2031
  ("All day" without one), its `detail` and a link (`to`). The app's own
2022
2032
  actions for that day sit beside its heading (`dayActions`, an Add
2023
2033
  button); what picking a day does beyond that is the app's (`onSelect`).
2034
+ - **How an item opens its record** is `opens`, DataTable's kinds
2035
+ (add-an-entity.md "How a list opens a record"). Left out (`page`), a
2036
+ link goes to the record's page. `dialog` (or `dialog-only`) opens it in
2037
+ a dialog over the month, Open Full Page and all: the calendar's route is
2038
+ a `RecordDialogRoute` with the calendar as its `list` and the records
2039
+ as its children, as any list's is.
2024
2040
  - **Tones** are the semantic ones plus `neutral` (design-language
2025
2041
  "Semantic tones"): pick one per kind of thing (an event `info`, a visit
2026
2042
  `success`), not per item, and say in the list's `detail` what it is.
@@ -49,7 +49,8 @@ function TileCount({ count }) {
49
49
  }
50
50
  // A bar item's icon, with its count as a badge on its corner: the
51
51
  // primary's fill, ringed in the bar's background so it stands off the
52
- // icon. Sized in em, so it grows with the type at large density.
52
+ // icon. Sized in em, so it grows with the type at large and
53
+ // extra-large density.
53
54
  function BarIcon({ icon: Icon, count }) {
54
55
  const text = navCountText(count);
55
56
  return (_jsxs("span", { className: "relative inline-flex", children: [_jsx(Icon, { "aria-hidden": "true" }), text !== undefined && (_jsx("span", { "aria-hidden": "true", "data-slot": "bottom-bar-count", className: "absolute -top-1.5 left-[calc(100%-0.5rem)] inline-flex h-[1.5em] min-w-[1.5em] items-center justify-center rounded-full bg-primary px-[0.35em] type-caption leading-none font-medium text-primary-foreground tabular-nums ring-2 ring-background", children: text }))] }));
@@ -291,7 +291,7 @@ const STICKY_RULE_CLASS = 'shadow-[inset_0_-1px_0_0_var(--border)]';
291
291
  const STICKY_HEAD_CELL_CLASS = `sticky top-(--data-table-pin-top) z-30 bg-background ${STICKY_RULE_CLASS}`;
292
292
  const STICKY_GROUP_HEADING_CLASS = `sticky top-[calc(var(--data-table-pin-top)+var(--data-table-head-height))] z-20 pt-2 ${STICKY_RULE_CLASS}`;
293
293
  // What focus scrolls to clears the stuck header and heading (3rem covers a
294
- // heading's height, large density included).
294
+ // heading's height, the large densities included).
295
295
  const STICKY_FOCUS_CLASS = '[&_tbody_*]:scroll-mt-[calc(var(--data-table-pin-top)+var(--data-table-head-height)+--spacing(12))]';
296
296
  // A grouping's heading (`groupings`) is a button that folds its rows: the
297
297
  // label, then the count, a chevron that turns when folded.
@@ -224,7 +224,7 @@ export type EntityViewProps = {
224
224
  * The facts rail (record standard A1), in the `tabs` layout:
225
225
  * where the view has room (60rem beside it: a laptop's page, a record
226
226
  * dialog), the sections of short facts (`facts`, placed `rail`, no
227
- * `tab`) go in a 300px column beside the record's body, and leave
227
+ * `tab`) go in a column (300px, `--facts-rail-width`) beside the record's body, and leave
228
228
  * Details. The strip stays above, full width; the rail starts level with
229
229
  * the first content under it (the open tab's first section, or the first
230
230
  * card when cards come before the tabs). A Details tab left with
@@ -203,19 +203,20 @@ const RAIL_LAYOUT = {
203
203
  sticky: '@4xl/view:data-[fits]:sticky @4xl/view:data-[fits]:top-6',
204
204
  };
205
205
  // The facts rail (A1): the record's column at its usual reading width
206
- // (max-w-4xl) and a 300px rail beside it. The strip stays above both, at
206
+ // (max-w-4xl) and a 300px rail beside it (`--facts-rail-width`, 336px at extra-large
207
+ // density). The strip stays above both, at
207
208
  // full width; the rail starts level with the first content under it: the
208
209
  // first section of the open tab (beside the tab's content, never its bar),
209
210
  // or the first card when the record's first content isn't the tabs.
210
211
  const FACTS_RAIL = {
211
212
  // Page width wide (data-width="wide" on <html>): no cap, the column fills the page.
212
- page: 'max-w-[calc(var(--container-4xl)+var(--spacing)*6+300px)] page-wide:max-w-none',
213
- columns: 'grid grid-cols-[minmax(0,1fr)_300px] items-start gap-6',
213
+ page: 'max-w-[calc(var(--container-4xl)+var(--spacing)*6+var(--facts-rail-width))] page-wide:max-w-none',
214
+ columns: 'grid grid-cols-[minmax(0,1fr)_var(--facts-rail-width)] items-start gap-6',
214
215
  main: 'flex min-w-0 flex-col gap-6',
215
216
  rail: 'col-start-2 row-start-1 flex min-w-0 flex-col gap-6',
216
- // The tab bar over the column only: the rail's 300px and the gap (the
217
+ // The tab bar over the column only: the rail's width and the gap (the
217
218
  // bar's own -mx-1 bleed kept on its left).
218
- barBeside: 'mr-[calc(300px+var(--spacing)*5)]',
219
+ barBeside: 'mr-[calc(var(--facts-rail-width)+var(--spacing)*5)]',
219
220
  };
220
221
  /** A section of short facts placed `rail` with no tab: the facts rail's, where it's drawn. */
221
222
  function isRailFacts(section) {
@@ -13,7 +13,7 @@ export type MonthCalendarItem = {
13
13
  time?: string | null;
14
14
  /** Its dot and mark (design-language.md "Semantic tones"). Defaults to `info`. */
15
15
  tone?: MonthCalendarTone;
16
- /** Where its row in the day's list goes. */
16
+ /** Where its row in the day's list goes (how, `opens`). */
17
17
  to?: To;
18
18
  /** A word after the time in the day's list ("Visit"). */
19
19
  detail?: string;
@@ -33,6 +33,14 @@ export type MonthCalendarProps = {
33
33
  onMonthChange?: (month: string) => void;
34
34
  /** The app's actions for the picked day, beside its heading (an Add button). */
35
35
  dayActions?: (day: PlainDate) => ReactNode;
36
+ /**
37
+ * How an item's link opens its record, DataTable's `opens` kinds
38
+ * (add-an-entity.md "How a list opens a record"): `dialog` and
39
+ * `dialog-only` open it over the calendar (the calendar's route a
40
+ * `RecordDialogRoute`, the record one of its children); `page`, the
41
+ * default, goes to its page.
42
+ */
43
+ opens?: 'dialog' | 'dialog-only' | 'page';
36
44
  /** The first day of the week. Defaults to Monday. */
37
45
  weekStart?: 'MO' | 'SU';
38
46
  isLoading?: boolean;
@@ -43,4 +51,4 @@ export type MonthCalendarProps = {
43
51
  locale?: string;
44
52
  className?: string;
45
53
  };
46
- export declare function MonthCalendar({ label, items, today, selected, onSelect, month, onMonthChange, dayActions, weekStart, isLoading, error, onRetry, emptyText, locale, className, }: MonthCalendarProps): import("react").JSX.Element;
54
+ export declare function MonthCalendar({ label, items, today, selected, onSelect, month, onMonthChange, dayActions, opens, weekStart, isLoading, error, onRetry, emptyText, locale, className, }: MonthCalendarProps): import("react").JSX.Element;
@@ -12,17 +12,23 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
12
12
  // past the month's edge turns the page. Every day is a plain day
13
13
  // (`'YYYY-MM-DD'`), never an instant, so no zone shifts one.
14
14
  //
15
+ // How an item's link opens its record is `opens`, DataTable's words: a
16
+ // dialog over the calendar (`dialog`, `dialog-only`: the link carries
17
+ // RecordDialogRoute's state, as a RecordLink does) or its page (`page`,
18
+ // the default).
19
+ //
15
20
  // Four states: loading (the month's frame with placeholders), error
16
21
  // (ErrorState in place of the days, the arrows still there), empty
17
22
  // ("Nothing this month" over the days) and success.
18
- import { useEffect, useMemo, useRef, useState } from 'react';
23
+ import { useContext, useEffect, useMemo, useRef, useState } from 'react';
19
24
  import { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';
20
- import { Link } from 'react-router';
25
+ import { Link, UNSAFE_LocationContext as LocationContext } from 'react-router';
21
26
  import { cn } from 'cn';
22
27
  import { Button } from '../ui/button.js';
23
28
  import { Skeleton } from '../ui/skeleton.js';
24
29
  import { formatPlainDate, localToPlainDate } from '../../lib/plain-date.js';
25
30
  import { ErrorState } from './error-state.js';
31
+ import { recordDialogState } from './record-dialog-context.js';
26
32
  const TONE_DOT = {
27
33
  neutral: 'bg-muted-foreground',
28
34
  info: 'bg-info',
@@ -61,11 +67,15 @@ function weekdayIndex(day) {
61
67
  return (new Date(Date.UTC(year, month - 1, date)).getUTCDay() + 6) % 7;
62
68
  }
63
69
  const byTime = (a, b) => (a.time ?? '').localeCompare(b.time ?? '');
64
- export function MonthCalendar({ label, items = [], today, selected, onSelect, month, onMonthChange, dayActions, weekStart = 'MO', isLoading, error, onRetry, emptyText = 'Nothing this month', locale, className, }) {
70
+ export function MonthCalendar({ label, items = [], today, selected, onSelect, month, onMonthChange, dayActions, opens = 'page', weekStart = 'MO', isLoading, error, onRetry, emptyText = 'Nothing this month', locale, className, }) {
65
71
  const [ownSelected, setOwnSelected] = useState(selected ?? today);
66
72
  const picked = selected ?? ownSelected;
67
73
  const [ownMonth, setOwnMonth] = useState(month ?? monthOf(picked));
68
74
  const shown = month ?? ownMonth;
75
+ // Read through the router's context, not useLocation, so a calendar
76
+ // with no links outside a router still renders (as DataTable does).
77
+ const routerLocation = useContext(LocationContext);
78
+ const linkState = opens !== 'page' && routerLocation ? recordDialogState(routerLocation.location) : undefined;
69
79
  const gridRef = useRef(null);
70
80
  const focusAfter = useRef(false);
71
81
  const byDay = useMemo(() => {
@@ -155,6 +165,6 @@ export function MonthCalendar({ label, items = [], today, selected, onSelect, mo
155
165
  }) }, row))) })] }), _jsxs("div", { role: "group", "aria-label": `${dayLabel(picked)}${picked === today ? ', today' : ''}`, "data-slot": "month-calendar-day", className: "flex flex-col gap-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsxs("h3", { className: cn('mr-auto text-sm font-semibold', picked === today ? 'text-link' : 'text-foreground'), children: [dayLabel(picked), picked === today && ' · Today'] }), dayActions?.(picked)] }), isLoading ? (_jsxs("div", { className: "flex flex-col gap-2 py-1", children: [_jsx(Skeleton, { className: "h-4 w-2/3" }), _jsx(Skeleton, { className: "h-4 w-1/2" })] })) : pickedItems.length === 0 ? (_jsx("p", { className: "border-t border-border py-1.5 text-sm text-muted-foreground", children: "Nothing that day." })) : (_jsx("ul", { className: "flex flex-col", children: pickedItems.map((item) => {
156
166
  const when = [item.time ? clock(item.time, locale) : 'All day', item.detail].filter(Boolean).join(' · ');
157
167
  const body = (_jsxs(_Fragment, { children: [_jsx("span", { className: cn('size-2 shrink-0 rounded-full', TONE_DOT[item.tone ?? 'info']), "aria-hidden": "true" }), _jsx("span", { className: "min-w-0 flex-1 truncate", children: item.title }), _jsx("span", { className: "shrink-0 text-xs text-muted-foreground", children: when })] }));
158
- return (_jsx("li", { className: "border-t border-border", children: item.to ? (_jsx(Link, { to: item.to, className: "flex min-h-10 items-center gap-2 py-1.5 text-sm text-foreground outline-none hover:underline focus-visible:ring-3 focus-visible:ring-ring/50", children: body })) : (_jsx("div", { className: "flex min-h-10 items-center gap-2 py-1.5 text-sm text-foreground", children: body })) }, item.id));
168
+ return (_jsx("li", { className: "border-t border-border", children: item.to ? (_jsx(Link, { to: item.to, state: linkState, className: "flex min-h-10 items-center gap-2 py-1.5 text-sm text-foreground outline-none hover:underline focus-visible:ring-3 focus-visible:ring-ring/50", children: body })) : (_jsx("div", { className: "flex min-h-10 items-center gap-2 py-1.5 text-sm text-foreground", children: body })) }, item.id));
159
169
  }) }))] })] }))] }));
160
170
  }
@@ -15,9 +15,9 @@ import { PanelLeftIcon } from "lucide-react";
15
15
  const SIDEBAR_COOKIE_NAME = "sidebar_state";
16
16
  const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
17
17
  // This repo's patch: the widths are steps of Tailwind's spacing scale, not
18
- // rem literals (upstream's 16rem, 18rem, 3rem), so data-density="large"
19
- // widens the sidebar with everything in it and the icon rail still fits
20
- // its buttons (styles/theme.css). Diff against upstream before taking a
18
+ // rem literals (upstream's 16rem, 18rem, 3rem), so data-density="large" (and
19
+ // "extra-large") widens the sidebar with everything in it and the icon rail
20
+ // still fits its buttons (styles/theme.css). Diff against upstream before taking a
21
21
  // new version of this file.
22
22
  const SIDEBAR_WIDTH = "calc(var(--spacing) * 64)";
23
23
  const SIDEBAR_WIDTH_MOBILE = "calc(var(--spacing) * 72)";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tristan2828/ui-foundation",
3
- "version": "4.137.2",
3
+ "version": "4.139.0",
4
4
  "description": "Shared UI foundation for contract-first, database-backed React apps: shadcn primitives, DataTable/EntityForm composites, auth, the gateway error seam, design tokens, lint rules and the AI playbook.",
5
5
  "license": "MIT",
6
6
  "repository": {
package/styles/index.css CHANGED
@@ -30,8 +30,8 @@
30
30
 
31
31
  /* Page width: data-width="wide" on <html> (an app's own setting,
32
32
  kept per browser as Text Size's data-density is) lifts a record page's
33
- reading cap, so its column fills a wide screen; the facts rail stays
34
- 300px. A record in a dialog keeps the dialog's size. `page-wide:max-w-none`. */
33
+ reading cap, so its column fills a wide screen; the facts rail keeps
34
+ its width. A record in a dialog keeps the dialog's size. `page-wide:max-w-none`. */
35
35
  @custom-variant page-wide (&:where([data-width="wide"] *):not(:where([role="dialog"] *, [role="alertdialog"] *)));
36
36
 
37
37
  @theme inline {
@@ -641,7 +641,8 @@
641
641
  --control-height (Input, SelectTrigger, InputGroup, the combobox's chips
642
642
  box and a default Button), 32px, or 40px under 48rem or on a touch
643
643
  screen, for the finger. Anywhere else they keep their 36px. Each is a
644
- calc of --spacing, resolved here, so the large density grows it. */
644
+ calc of --spacing, resolved here, so the large and extra-large densities
645
+ grow it. */
645
646
  [data-slot="field-group"],
646
647
  [data-slot="entity-form-bar"],
647
648
  [data-slot="form-dialog-bar"] {
package/styles/theme.css CHANGED
@@ -616,9 +616,13 @@
616
616
 
617
617
  /* The small size of Button and Toggle (and the calendar's weekdays):
618
618
  between text-xs and text-sm, so it has a token of its own for the
619
- large density to scale. */
619
+ large and extra-large densities to scale. */
620
620
  --control-text-sm: 0.8rem;
621
621
 
622
+ /* A record's facts rail (EntityView): a fixed width, wide enough for a
623
+ label beside its value. Only extra-large widens it. */
624
+ --facts-rail-width: 300px;
625
+
622
626
  /* Layer 2 — semantic (light) */
623
627
  --background: var(--white);
624
628
  --foreground: var(--black);
@@ -908,7 +912,7 @@
908
912
  * built from --spacing on :root would keep :root's value under here.
909
913
  *
910
914
  * Popups (menus, selects, dialogs, tooltips) are portaled to <body>, so
911
- * they only grow when data-density="large" is on <html>.
915
+ * they only grow when data-density="large" (or "extra-large") is on <html>.
912
916
  */
913
917
  [data-density="large"] {
914
918
  --spacing: 0.3125rem; /* 4px → 5px: h-8 is 40px, size-4 is 20px */
@@ -941,6 +945,52 @@
941
945
  --table-cell-px: 0.75rem;
942
946
  --table-cell-py: 0.75rem;
943
947
  --table-head-height: 3.5rem;
948
+
949
+ --facts-rail-width: 300px; /* the default's: its rows still fit side by side */
950
+ }
951
+
952
+ /*
953
+ * Extra large: the step after large, for a screen read from further back
954
+ * (a couch). It sets every token large sets, the same way and for the same
955
+ * reasons; tests/density.test.ts fails if one is set in only one of them.
956
+ * Body text is 20px where large's is 18px, captions 17px where they're
957
+ * 15px, spacing 5.6px where it's 5px. Every other size is large's scaled by
958
+ * the nearest of those (text and its leading by body's 10/9, caption-sized
959
+ * text by captions' 17/15, boxes by spacing's 1.12), to the nearest pixel.
960
+ */
961
+ [data-density="extra-large"] {
962
+ --spacing: 0.35rem; /* large's 5px → 5.6px: h-8 is 44.8px, size-4 is 22.4px */
963
+ --text-xs: 1.0625rem; /* 15 → 17px */
964
+ --text-sm: 1.25rem; /* 18 → 20px: most UI text */
965
+ --text-base: 1.375rem; /* 20 → 22px */
966
+ --text-lg: 1.5rem; /* 22 → 24px */
967
+ --text-xl: 1.75rem; /* 25 → 28px */
968
+ --text-2xl: 2.0625rem; /* 30 → 33px */
969
+ --control-text-sm: 1.125rem; /* 16 → 18px */
970
+ --radius: 0.75rem; /* 11 → 12px */
971
+
972
+ --type-page-title-size: 2.4375rem; /* 35 → 39px */
973
+ --type-section-title-size: 1.375rem;
974
+ --type-section-title-leading: 2.0625rem;
975
+ --type-body-size: 1.25rem;
976
+ --type-label-size: 1.25rem;
977
+ --type-label-leading: 1.8125rem;
978
+ --type-caption-size: 1.0625rem;
979
+ --type-caption-leading: 1.4375rem;
980
+ --type-numeric-size: 1.9375rem;
981
+ --type-numeric-leading: 2.5rem;
982
+ --type-heading-1-size: 2.4375rem;
983
+ --type-heading-1-leading: 3.125rem;
984
+ --type-heading-2-size: 1.75rem;
985
+ --type-heading-2-leading: 2.375rem;
986
+ --type-heading-3-size: 1.0625rem;
987
+ --type-heading-3-leading: 1.75rem;
988
+
989
+ --table-cell-px: 0.8125rem;
990
+ --table-cell-py: 0.8125rem;
991
+ --table-head-height: 3.9375rem;
992
+
993
+ --facts-rail-width: 336px; /* 300px, so a label still fits beside its value */
944
994
  }
945
995
 
946
996
  .dark {