@tristan2828/ui-foundation 5.2.0 → 6.1.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.
@@ -3,52 +3,52 @@
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 61–151
7
- - [Glow](#glow) · lines 153–172
8
- - [Semantic tones](#semantic-tones) · lines 174–202
9
- - [The three badge styles](#the-three-badge-styles) · lines 204–221
10
- - [Status marks](#status-marks) · lines 223–266
11
- - [Mapping an enum to tones](#mapping-an-enum-to-tones) · lines 268–297
12
- - [Glyphs and icons: 3:1](#glyphs-and-icons-31) · lines 299–310
13
- - [Logos and brand marks](#logos-and-brand-marks) · lines 312–352
14
- - [Emoji](#emoji) · lines 354–394
15
- - [Categorical colour](#categorical-colour) · lines 396–461
16
- - [Heat scale](#heat-scale) · lines 463–515
17
- - [Depth ramps](#depth-ramps) · lines 517–584
18
- - [A stored colour](#a-stored-colour) · lines 586–633
19
- - [Shapes and sizes](#shapes-and-sizes) · lines 635–656
20
- - [Typography](#typography) · lines 658–828
21
- - [Words on screen: Title Case and sentence case](#words-on-screen-title-case-and-sentence-case) · lines 692–724
22
- - [Written text (notes)](#written-text-notes) · lines 726–828
23
- - [Density](#density) · lines 830–959
24
- - [Rows on this device](#rows-on-this-device) · lines 903–931
25
- - [Page width (a record on a wide screen)](#page-width-a-record-on-a-wide-screen) · lines 933–959
26
- - [Widget cards (hub pages)](#widget-cards-hub-pages) · lines 961–1078
27
- - [Module cards (a hub's places)](#module-cards-a-hubs-places) · lines 1080–1152
28
- - [Notices](#notices) · lines 1154–1181
29
- - [A value over time](#a-value-over-time) · lines 1183–1313
30
- - [Several values over time](#several-values-over-time) · lines 1232–1270
31
- - [Parts of a whole over time](#parts-of-a-whole-over-time) · lines 1272–1313
32
- - [A list as a board](#a-list-as-a-board) · lines 1315–1425
33
- - [Order, groups and the header](#order-groups-and-the-header) · lines 1368–1425
34
- - [A list as cards](#a-list-as-cards) · lines 1427–1474
35
- - [Images full screen](#images-full-screen) · lines 1476–1522
36
- - [Key numbers on a record](#key-numbers-on-a-record) · lines 1524–1560
37
- - [Parts of the page standards](#parts-of-the-page-standards) · lines 1562–1598
38
- - [A few equal things](#a-few-equal-things) · lines 1600–1715
39
- - [An overview page](#an-overview-page) · lines 1717–1782
40
- - [A record's header and empty values](#a-records-header-and-empty-values) · lines 1784–1847
41
- - [A record's tabs, mark and facts](#a-records-tabs-mark-and-facts) · lines 1849–1936
42
- - [Picking at random](#picking-at-random) · lines 1938–1969
43
- - [Filling in what's missing](#filling-in-whats-missing) · lines 1971–2038
44
- - [Values edited in place: the presets' looks](#values-edited-in-place-the-presets-looks) · lines 2040–2059
45
- - [A quick add line](#a-quick-add-line) · lines 2061–2089
46
- - [A date field's quick picks](#a-date-fields-quick-picks) · lines 2091–2115
47
- - [A few choices, then the month](#a-few-choices-then-the-month) · lines 2117–2143
48
- - [A month calendar](#a-month-calendar) · lines 2145–2177
49
- - [A settings page](#a-settings-page) · lines 2179–2236
50
- - [The sidebar and the phone's bar](#the-sidebar-and-the-phones-bar) · lines 2238–2297
51
- - [A bare shell](#a-bare-shell) · lines 2299–2333
6
+ - [Palettes](#palettes) · lines 61–153
7
+ - [Glow](#glow) · lines 155–174
8
+ - [Semantic tones](#semantic-tones) · lines 176–204
9
+ - [The three badge styles](#the-three-badge-styles) · lines 206–223
10
+ - [Status marks](#status-marks) · lines 225–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–312
13
+ - [Logos and brand marks](#logos-and-brand-marks) · lines 314–354
14
+ - [Emoji](#emoji) · lines 356–396
15
+ - [Categorical colour](#categorical-colour) · lines 398–463
16
+ - [Heat scale](#heat-scale) · lines 465–517
17
+ - [Depth ramps](#depth-ramps) · lines 519–586
18
+ - [A stored colour](#a-stored-colour) · lines 588–635
19
+ - [Shapes and sizes](#shapes-and-sizes) · lines 637–658
20
+ - [Typography](#typography) · lines 660–830
21
+ - [Words on screen: Title Case and sentence case](#words-on-screen-title-case-and-sentence-case) · lines 694–726
22
+ - [Written text (notes)](#written-text-notes) · lines 728–830
23
+ - [Density](#density) · lines 832–961
24
+ - [Rows on this device](#rows-on-this-device) · lines 905–933
25
+ - [Page width (a record on a wide screen)](#page-width-a-record-on-a-wide-screen) · lines 935–961
26
+ - [Widget cards (hub pages)](#widget-cards-hub-pages) · lines 963–1080
27
+ - [Module cards (a hub's places)](#module-cards-a-hubs-places) · lines 1082–1154
28
+ - [Notices](#notices) · lines 1156–1183
29
+ - [A value over time](#a-value-over-time) · lines 1185–1315
30
+ - [Several values over time](#several-values-over-time) · lines 1234–1272
31
+ - [Parts of a whole over time](#parts-of-a-whole-over-time) · lines 1274–1315
32
+ - [A list as a board](#a-list-as-a-board) · lines 1317–1427
33
+ - [Order, groups and the header](#order-groups-and-the-header) · lines 1370–1427
34
+ - [A list as cards](#a-list-as-cards) · lines 1429–1476
35
+ - [Images full screen](#images-full-screen) · lines 1478–1524
36
+ - [Key numbers on a record](#key-numbers-on-a-record) · lines 1526–1562
37
+ - [Parts of the page standards](#parts-of-the-page-standards) · lines 1564–1600
38
+ - [A few equal things](#a-few-equal-things) · lines 1602–1717
39
+ - [An overview page](#an-overview-page) · lines 1719–1784
40
+ - [A record's header and empty values](#a-records-header-and-empty-values) · lines 1786–1849
41
+ - [A record's tabs, mark and facts](#a-records-tabs-mark-and-facts) · lines 1851–1938
42
+ - [Picking at random](#picking-at-random) · lines 1940–1971
43
+ - [Filling in what's missing](#filling-in-whats-missing) · lines 1973–2040
44
+ - [Values edited in place: the presets' looks](#values-edited-in-place-the-presets-looks) · lines 2042–2061
45
+ - [A quick add line](#a-quick-add-line) · lines 2063–2091
46
+ - [A date field's quick picks](#a-date-fields-quick-picks) · lines 2093–2117
47
+ - [A few choices, then the month](#a-few-choices-then-the-month) · lines 2119–2145
48
+ - [A month calendar](#a-month-calendar) · lines 2147–2180
49
+ - [A settings page](#a-settings-page) · lines 2182–2239
50
+ - [The sidebar and the phone's bar](#the-sidebar-and-the-phones-bar) · lines 2241–2300
51
+ - [A bare shell](#a-bare-shell) · lines 2302–2336
52
52
 
53
53
  <!-- /index -->
54
54
 
@@ -70,11 +70,13 @@ second colour):
70
70
  |---|---|---|---|
71
71
  | Graphite and Periwinkle | `graphite-periwinkle` | periwinkle | lilac |
72
72
  | Graphite and Amber | `graphite-amber` | amber | orange |
73
- | Graphite and Sky | `graphite-sky` | sky blue | periwinkle blue |
73
+ | Graphite and Silver | `graphite-silver` | silver grey | mid grey |
74
74
  | Graphite and Green | `graphite-green` | green | olive |
75
75
 
76
- Amber, Sky and Green have Periwinkle's lightness and strength, at their
77
- own hue, so each reads as loud as the others.
76
+ Amber and Green have Periwinkle's lightness and strength, at their own
77
+ hue, so each reads as loud as the others. Silver is the neutral one: it
78
+ leaves colour to the app's own content (coloured module icons, say), and
79
+ it is the template's palette, the look every new app starts with.
78
80
 
79
81
  And one light one, which an app opts into by name (`LIGHT_PALETTES`):
80
82
 
@@ -2154,7 +2156,8 @@ package's `MonthCalendar`. Not a date picker, which is
2154
2156
  - **An item's `emoji`** is drawn before its title, in the cell and the
2155
2157
  day's list (Noto's picture, `size-3.5`, decorative).
2156
2158
  - **The picked day's list is under the month**, every item with its time
2157
- ("All day" without one), its `detail` and a link (`to`). The app's own
2159
+ ("All day" without one; with an `endTime`, the span, "6:30–8:00 PM"),
2160
+ its `detail` and a link (`to`). The app's own
2158
2161
  actions for that day sit beside its heading (`dayActions`, an Add
2159
2162
  button); what picking a day does beyond that is the app's (`onSelect`).
2160
2163
  - **How an item opens its record** is `opens`, DataTable's kinds
@@ -17,6 +17,11 @@ export type MonthCalendarItem = {
17
17
  emoji?: string | null;
18
18
  /** `'HH:MM'`, or none for all day. */
19
19
  time?: string | null;
20
+ /**
21
+ * `'HH:MM'` it ends, the same day: the day's list then shows both
22
+ * ("6:30–8:00 PM"). Ignored without a `time`.
23
+ */
24
+ endTime?: string | null;
20
25
  /** Its dot and mark (design-language.md "Semantic tones"). Defaults to `info`. */
21
26
  tone?: MonthCalendarTone;
22
27
  /** Where its row in the day's list goes (how, `opens`). */
@@ -62,6 +62,24 @@ function clock(time, locale) {
62
62
  const [hour, minute] = time.split(':').map(Number);
63
63
  return new Intl.DateTimeFormat(locale, { hour: 'numeric', minute: '2-digit', timeZone: 'UTC' }).format(Date.UTC(2001, 0, 1, hour, minute));
64
64
  }
65
+ /**
66
+ * A start and its end in one phrase: "6:30–8:00 PM", "11:00 AM–1:00 PM". The
67
+ * start drops its AM or PM when the end says the same one, in a locale
68
+ * that writes it after the time; elsewhere both keep theirs.
69
+ */
70
+ function clockSpan(start, end, locale) {
71
+ const format = new Intl.DateTimeFormat(locale, { hour: 'numeric', minute: '2-digit', timeZone: 'UTC' });
72
+ const parts = (time) => {
73
+ const [hour, minute] = time.split(':').map(Number);
74
+ return format.formatToParts(Date.UTC(2001, 0, 1, hour, minute));
75
+ };
76
+ const from = parts(start);
77
+ const to = parts(end);
78
+ const period = (list) => list.find((part) => part.type === 'dayPeriod')?.value;
79
+ const shared = from.at(-1)?.type === 'dayPeriod' && period(from) === period(to);
80
+ const text = (list) => list.map((part) => part.value).join('');
81
+ return `${shared ? text(from.slice(0, -1)).trimEnd() : text(from)}–${text(to)}`;
82
+ }
65
83
  /** Monday 0 … Sunday 6. */
66
84
  function weekdayIndex(day) {
67
85
  const [year, month, date] = parts(day);
@@ -164,7 +182,8 @@ export function MonthCalendar({ label, items = [], today, selected, onSelect, mo
164
182
  const count = list.length;
165
183
  return (_jsxs("td", { "data-day": day, "aria-selected": isPicked, "aria-current": isToday ? 'date' : undefined, tabIndex: day === stop ? 0 : -1, onClick: () => pick(day), onKeyDown: (event) => onKeyDown(event, day), className: cn('h-11 cursor-pointer border-r border-b border-border bg-card p-1 align-top outline-none md:h-20', 'hover:bg-muted/40 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset', isPicked && 'shadow-[inset_0_0_0_2px_var(--color-ring)]'), children: [_jsxs("span", { className: "sr-only", children: [`${dayLabel(day)}${isToday ? ', today' : ''}, ${count === 0 ? 'nothing' : count === 1 ? '1 item' : `${count} items`}`, count > 0 && `: ${list.map((item) => item.title).join(', ')}`] }), _jsxs("div", { className: "flex flex-col max-md:items-center", "aria-hidden": "true", children: [_jsx("span", { className: cn('w-fit rounded px-1 text-xs tabular-nums', isToday ? 'bg-primary font-semibold text-primary-foreground' : 'text-muted-foreground'), children: Number(day.slice(8)) }), isLoading ? (_jsx(Skeleton, { className: "mt-1 h-3 w-3/4 max-md:hidden" })) : (_jsxs(_Fragment, { children: [_jsxs("ul", { className: "mt-0.5 flex min-w-0 flex-col gap-0.5 max-md:hidden", children: [list.slice(0, 2).map((item) => (_jsxs("li", { className: "flex min-w-0 items-center gap-1 text-xs text-foreground", children: [_jsx("span", { className: cn('size-1.5 shrink-0 rounded-full', TONE_DOT[item.tone ?? 'info']) }), item.emoji && _jsx(Emoji, { emoji: item.emoji, className: "size-3.5" }), _jsx("span", { className: "truncate", children: item.title })] }, item.id))), count > 2 && _jsxs("li", { className: "pl-2.5 text-xs text-muted-foreground", children: ["+", count - 2, " more"] })] }), count > 0 && (_jsx("span", { className: "mt-1 flex justify-center gap-0.5 md:hidden", children: list.slice(0, 4).map((item) => (_jsx("span", { className: cn('size-1.5 rounded-full', TONE_DOT[item.tone ?? 'info']) }, item.id))) }))] }))] })] }, day));
166
184
  }) }, 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) => {
167
- const when = [item.time ? clock(item.time, locale) : 'All day', item.detail].filter(Boolean).join(' · ');
185
+ const time = !item.time ? 'All day' : item.endTime ? clockSpan(item.time, item.endTime, locale) : clock(item.time, locale);
186
+ const when = [time, item.detail].filter(Boolean).join(' · ');
168
187
  const body = (_jsxs(_Fragment, { children: [_jsx("span", { className: cn('size-2 shrink-0 rounded-full', TONE_DOT[item.tone ?? 'info']), "aria-hidden": "true" }), item.emoji && _jsx(Emoji, { emoji: item.emoji, className: "size-3.5" }), _jsx("span", { className: "min-w-0 flex-1 truncate", children: item.title }), _jsx("span", { className: "shrink-0 text-xs text-muted-foreground", children: when })] }));
169
188
  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));
170
189
  }) }))] })] }))] }));
@@ -1,5 +1,5 @@
1
1
  import { type DeviceChoiceStore, type StorageLike } from './device-choice.js';
2
- export declare const PALETTES: readonly ["graphite-periwinkle", "graphite-amber", "graphite-sky", "graphite-green"];
2
+ export declare const PALETTES: readonly ["graphite-periwinkle", "graphite-amber", "graphite-silver", "graphite-green"];
3
3
  export type PaletteName = (typeof PALETTES)[number];
4
4
  /** Each palette's name as a person reads it, in the picker's order. */
5
5
  export declare const PALETTE_LABELS: Record<PaletteName, string>;
@@ -12,12 +12,12 @@
12
12
  // it is never in the picker, and it has no glow. Its block is
13
13
  // `[data-palette="<name>"]` on top of :root.
14
14
  import { browserStorage, createDeviceChoiceStore, otherTabsSubscriber } from './device-choice.js';
15
- export const PALETTES = ['graphite-periwinkle', 'graphite-amber', 'graphite-sky', 'graphite-green'];
15
+ export const PALETTES = ['graphite-periwinkle', 'graphite-amber', 'graphite-silver', 'graphite-green'];
16
16
  /** Each palette's name as a person reads it, in the picker's order. */
17
17
  export const PALETTE_LABELS = {
18
18
  'graphite-periwinkle': 'Graphite and Periwinkle',
19
19
  'graphite-amber': 'Graphite and Amber',
20
- 'graphite-sky': 'Graphite and Sky',
20
+ 'graphite-silver': 'Graphite and Silver',
21
21
  'graphite-green': 'Graphite and Green',
22
22
  };
23
23
  /** Where a device's chosen palette is kept. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tristan2828/ui-foundation",
3
- "version": "5.2.0",
3
+ "version": "6.1.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/theme.css CHANGED
@@ -317,16 +317,18 @@
317
317
  * strong-border on bg 2.89: under 3:1, kept as designed (axe does
318
318
  * not check borders)
319
319
  *
320
- * Each main colour, listed Periwinkle / Amber / Sky / Green:
321
- * accent on bg 4.87 / 4.99 / 5.25 / 5.54, on card 4.32 / 4.43 /
322
- * 4.66 / 4.92: never small text; the ring and fills only
323
- * on-accent on accent 5.28 / 5.43 / 5.68 / 5.97
324
- * accent-light on bg 10.4 / 10.4 / 10.6 / 10.9, on card 9.19 / 9.23 /
325
- * 9.44 / 9.65, on raised 7.95 at the least: links
320
+ * Each main colour, listed Periwinkle / Amber / Silver / Green:
321
+ * accent on bg 4.87 / 4.99 / 10.8 / 5.54, on card 4.32 / 4.43 /
322
+ * 9.61 / 4.92: never small text; the ring and fills only
323
+ * on-accent on accent 5.28 / 5.43 / 10.8 / 5.97
324
+ * accent-light on bg 10.4 / 10.4 / 16.4 / 10.9, on card 9.19 / 9.23 /
325
+ * 14.6 / 9.65, on raised 7.95 at the least: links
326
326
  * accent-deep a chart's third series, never text
327
- * second on card 5.08 / 5.07 / 5.24 / 5.50
328
- * Amber, Sky and Green are Periwinkle's lightness and strength in
329
- * OKLCH, at their own hue.
327
+ * second on card 5.08 / 5.07 / 5.31 / 5.50
328
+ * Amber and Green are Periwinkle's lightness and strength in OKLCH, at
329
+ * their own hue. Silver is the neutral one, no hue: its links and
330
+ * picked states are near-white, so they need a cue besides colour
331
+ * (#466), and its chart series are greys (#467).
330
332
  */
331
333
  --palette-graphite-background: #171717;
332
334
  --palette-graphite-panel: #222222;
@@ -348,11 +350,11 @@
348
350
  --palette-graphite-amber-on-accent: #160a00;
349
351
  --palette-graphite-amber-second: #e86d40;
350
352
 
351
- --palette-graphite-sky-accent: #0093d7;
352
- --palette-graphite-sky-accent-light: #97cef5;
353
- --palette-graphite-sky-accent-deep: #006697;
354
- --palette-graphite-sky-on-accent: #000f1b;
355
- --palette-graphite-sky-second: #7b8bfa;
353
+ --palette-graphite-silver-accent: #c9c9c9;
354
+ --palette-graphite-silver-accent-light: #f5f5f5;
355
+ --palette-graphite-silver-accent-deep: #737373;
356
+ --palette-graphite-silver-on-accent: #171717;
357
+ --palette-graphite-silver-second: #959595;
356
358
 
357
359
  --palette-graphite-green-accent: #06a54c;
358
360
  --palette-graphite-green-accent-light: #a2d6ab;
@@ -1280,12 +1282,12 @@
1280
1282
  --palette-main-second: var(--palette-graphite-amber-second);
1281
1283
  }
1282
1284
 
1283
- .dark[data-palette="graphite-sky"] {
1284
- --palette-main-accent: var(--palette-graphite-sky-accent);
1285
- --palette-main-accent-light: var(--palette-graphite-sky-accent-light);
1286
- --palette-main-accent-deep: var(--palette-graphite-sky-accent-deep);
1287
- --palette-main-on-accent: var(--palette-graphite-sky-on-accent);
1288
- --palette-main-second: var(--palette-graphite-sky-second);
1285
+ .dark[data-palette="graphite-silver"] {
1286
+ --palette-main-accent: var(--palette-graphite-silver-accent);
1287
+ --palette-main-accent-light: var(--palette-graphite-silver-accent-light);
1288
+ --palette-main-accent-deep: var(--palette-graphite-silver-accent-deep);
1289
+ --palette-main-on-accent: var(--palette-graphite-silver-on-accent);
1290
+ --palette-main-second: var(--palette-graphite-silver-second);
1289
1291
  }
1290
1292
 
1291
1293
  .dark[data-palette="graphite-green"] {
package/vite/index.d.ts CHANGED
@@ -36,7 +36,7 @@ export type PwaOptions = {
36
36
  * below default to its accent, its text on the accent and its background
37
37
  * instead of the light theme's.
38
38
  */
39
- palette?: 'graphite-periwinkle' | 'graphite-amber' | 'graphite-sky' | 'graphite-green' | 'palm-lcd'
39
+ palette?: 'graphite-periwinkle' | 'graphite-amber' | 'graphite-silver' | 'graphite-green' | 'palm-lcd'
40
40
  /** `#rrggbb`. Defaults to the package's `--primary` token (or the palette's accent). */
41
41
  themeColor?: string
42
42
  /** The letter's colour on the SVG icon, `#rrggbb`. Defaults to `--primary-foreground`. */