@tristan2828/ui-foundation 4.109.0 → 4.111.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/conventions/docs/cell-patterns.md +32 -4
- package/conventions/docs/design-language.md +62 -39
- package/dist/components/app/entity-view-facts.d.ts +21 -0
- package/dist/components/app/entity-view-facts.js +5 -0
- package/dist/components/app/entity-view.js +4 -3
- package/dist/components/app/fact-list.d.ts +19 -0
- package/dist/components/app/fact-list.js +10 -0
- package/dist/components/app/filter-date.d.ts +24 -0
- package/dist/components/app/filter-date.js +45 -0
- package/dist/components/ui/tabs.js +8 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +3 -0
- package/dist/lib/date-filter.d.ts +36 -0
- package/dist/lib/date-filter.js +92 -0
- package/dist/lib/status-kinds.d.ts +6 -1
- package/dist/lib/status-kinds.js +8 -3
- package/package.json +1 -1
- package/styles/index.css +4 -0
- package/styles/theme.css +32 -0
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
- [24. A list's rows: hover, lines, rows per page](#24-a-lists-rows-hover-lines-rows-per-page) · lines 1811–1849
|
|
41
41
|
- [23. A Group menu, and a record read beside the list](#23-a-group-menu-and-a-record-read-beside-the-list) · lines 1851–1927
|
|
42
42
|
- [24. A stored colour beside its name](#24-a-stored-colour-beside-its-name) · lines 1929–1952
|
|
43
|
-
- [25. A list's tools: views, filters, columns, row actions, a phone's rows](#25-a-lists-tools-views-filters-columns-row-actions-a-phones-rows) · lines 1954–
|
|
44
|
-
- [The framed look, and sibling lists beside the title](#the-framed-look-and-sibling-lists-beside-the-title) · lines
|
|
45
|
-
- [26. A record's related list, capped](#26-a-records-related-list-capped) · lines
|
|
46
|
-
- [27. A repeat and its next time](#27-a-repeat-and-its-next-time) · lines
|
|
43
|
+
- [25. A list's tools: views, filters, columns, row actions, a phone's rows](#25-a-lists-tools-views-filters-columns-row-actions-a-phones-rows) · lines 1954–2157
|
|
44
|
+
- [The framed look, and sibling lists beside the title](#the-framed-look-and-sibling-lists-beside-the-title) · lines 2102–2157
|
|
45
|
+
- [26. A record's related list, capped](#26-a-records-related-list-capped) · lines 2159–2195
|
|
46
|
+
- [27. A repeat and its next time](#27-a-repeat-and-its-next-time) · lines 2197–2242
|
|
47
47
|
|
|
48
48
|
<!-- /index -->
|
|
49
49
|
|
|
@@ -2045,6 +2045,34 @@ const { filters, multiFilters, setFilter, setFilters, setMultiFilter, activeView
|
|
|
2045
2045
|
and every filter, primary ones too, is in Filters' bottom sheet, so pass
|
|
2046
2046
|
`primaryActive` (their chips) and an `onClearAll` that clears them all
|
|
2047
2047
|
in one `setFilters` call.
|
|
2048
|
+
- **A date filter** (4.110) is `FilterDate`: "Any due date" while off,
|
|
2049
|
+
"Due: Before today" on, with the presets Before today, Today and From
|
|
2050
|
+
today (`presets` picks which) and Between dates, a From and a To day
|
|
2051
|
+
beside it. Its value is one string in the URL (`before-today`,
|
|
2052
|
+
`from-today`, `2026-11-01..2026-11-30`, an end left out when open), a
|
|
2053
|
+
single-value filter like any other, so a view sets it in `filters` and
|
|
2054
|
+
the bar shows it: an "Overdue" view is `{ filters: { due: 'before-today' }
|
|
2055
|
+
}`, not a `rule`. The query reads it with `resolveDateFilter(value)`,
|
|
2056
|
+
inclusive plain days (`{ to: yesterday }`, `{ from: today }`), read
|
|
2057
|
+
against today when the list loads; its chip's words are
|
|
2058
|
+
`dateFilterText(value)`. A list filtered in the browser (or a mock) uses
|
|
2059
|
+
`dateFilterKeeps(value, day)`.
|
|
2060
|
+
|
|
2061
|
+
```tsx
|
|
2062
|
+
const VIEWS = {
|
|
2063
|
+
upcoming: { label: 'Upcoming', filters: { due: 'from-today' } },
|
|
2064
|
+
overdue: { label: 'Overdue', filters: { due: 'before-today' } },
|
|
2065
|
+
all: { label: 'All' },
|
|
2066
|
+
}
|
|
2067
|
+
const { filters, setFilter } = useTableUrlState(['search', 'due'], [], VIEWS)
|
|
2068
|
+
const due = dateFilterText(filters.due)
|
|
2069
|
+
// The query: resolveDateFilter(filters.due) → { from?, to? } → due_from / due_to.
|
|
2070
|
+
<FilterBar
|
|
2071
|
+
secondary={<FilterDate label="Due" value={filters.due} onValueChange={(value) => setFilter('due', value)} />}
|
|
2072
|
+
active={due ? [{ id: 'due', label: `Due: ${due}`, onRemove: () => setFilter('due', '') }] : []}
|
|
2073
|
+
onClear={() => setFilter('due', '')}
|
|
2074
|
+
/>
|
|
2075
|
+
```
|
|
2048
2076
|
- **The Columns menu** (L5) sits at the end of the toolbar: a tick for
|
|
2049
2077
|
every column but the first (the name) and the actions, remembered on
|
|
2050
2078
|
this device under `storageKey` as every column's id in order and the
|
|
@@ -7,37 +7,37 @@
|
|
|
7
7
|
- [Glow](#glow) · lines 161–180
|
|
8
8
|
- [Semantic tones](#semantic-tones) · lines 182–210
|
|
9
9
|
- [The three badge styles](#the-three-badge-styles) · lines 212–229
|
|
10
|
-
- [Status marks](#status-marks) · lines 231–
|
|
11
|
-
- [Mapping an enum to tones](#mapping-an-enum-to-tones) · lines
|
|
12
|
-
- [Glyphs and icons: 3:1](#glyphs-and-icons-31) · lines
|
|
13
|
-
- [Logos and brand marks](#logos-and-brand-marks) · lines
|
|
14
|
-
- [Categorical colour](#categorical-colour) · lines
|
|
15
|
-
- [Heat scale](#heat-scale) · lines
|
|
16
|
-
- [Depth ramps](#depth-ramps) · lines
|
|
17
|
-
- [A stored colour](#a-stored-colour) · lines
|
|
18
|
-
- [Shapes and sizes](#shapes-and-sizes) · lines
|
|
19
|
-
- [Typography](#typography) · lines
|
|
20
|
-
- [Words on screen: Title Case and sentence case](#words-on-screen-title-case-and-sentence-case) · lines
|
|
21
|
-
- [Written text (notes)](#written-text-notes) · lines
|
|
22
|
-
- [Density](#density) · lines
|
|
23
|
-
- [Rows on this device](#rows-on-this-device) · lines
|
|
24
|
-
- [Widget cards (hub pages)](#widget-cards-hub-pages) · lines
|
|
25
|
-
- [Module cards (a hub's places)](#module-cards-a-hubs-places) · lines
|
|
26
|
-
- [Notices](#notices) · lines
|
|
27
|
-
- [A value over time](#a-value-over-time) · lines
|
|
28
|
-
- [Several values over time](#several-values-over-time) · lines
|
|
29
|
-
- [A list as a board](#a-list-as-a-board) · lines
|
|
30
|
-
- [A list as cards](#a-list-as-cards) · lines
|
|
31
|
-
- [Key numbers on a record](#key-numbers-on-a-record) · lines
|
|
32
|
-
- [Parts of the page standards](#parts-of-the-page-standards) · lines
|
|
33
|
-
- [A few equal things](#a-few-equal-things) · lines
|
|
34
|
-
- [An overview page](#an-overview-page) · lines
|
|
35
|
-
- [A record's header and empty values](#a-records-header-and-empty-values) · lines
|
|
36
|
-
- [A record's tabs, mark and facts](#a-records-tabs-mark-and-facts) · lines
|
|
37
|
-
- [Picking at random](#picking-at-random) · lines
|
|
38
|
-
- [Filling in what's missing](#filling-in-whats-missing) · lines
|
|
39
|
-
- [Values edited in place: the presets' looks](#values-edited-in-place-the-presets-looks) · lines
|
|
40
|
-
- [The sidebar and the phone's bar](#the-sidebar-and-the-phones-bar) · lines
|
|
10
|
+
- [Status marks](#status-marks) · lines 231–276
|
|
11
|
+
- [Mapping an enum to tones](#mapping-an-enum-to-tones) · lines 278–307
|
|
12
|
+
- [Glyphs and icons: 3:1](#glyphs-and-icons-31) · lines 309–322
|
|
13
|
+
- [Logos and brand marks](#logos-and-brand-marks) · lines 324–368
|
|
14
|
+
- [Categorical colour](#categorical-colour) · lines 370–440
|
|
15
|
+
- [Heat scale](#heat-scale) · lines 442–503
|
|
16
|
+
- [Depth ramps](#depth-ramps) · lines 505–590
|
|
17
|
+
- [A stored colour](#a-stored-colour) · lines 592–640
|
|
18
|
+
- [Shapes and sizes](#shapes-and-sizes) · lines 642–663
|
|
19
|
+
- [Typography](#typography) · lines 665–836
|
|
20
|
+
- [Words on screen: Title Case and sentence case](#words-on-screen-title-case-and-sentence-case) · lines 699–732
|
|
21
|
+
- [Written text (notes)](#written-text-notes) · lines 734–836
|
|
22
|
+
- [Density](#density) · lines 838–931
|
|
23
|
+
- [Rows on this device](#rows-on-this-device) · lines 904–931
|
|
24
|
+
- [Widget cards (hub pages)](#widget-cards-hub-pages) · lines 933–1047
|
|
25
|
+
- [Module cards (a hub's places)](#module-cards-a-hubs-places) · lines 1049–1126
|
|
26
|
+
- [Notices](#notices) · lines 1128–1156
|
|
27
|
+
- [A value over time](#a-value-over-time) · lines 1158–1244
|
|
28
|
+
- [Several values over time](#several-values-over-time) · lines 1207–1244
|
|
29
|
+
- [A list as a board](#a-list-as-a-board) · lines 1246–1297
|
|
30
|
+
- [A list as cards](#a-list-as-cards) · lines 1299–1345
|
|
31
|
+
- [Key numbers on a record](#key-numbers-on-a-record) · lines 1347–1376
|
|
32
|
+
- [Parts of the page standards](#parts-of-the-page-standards) · lines 1378–1425
|
|
33
|
+
- [A few equal things](#a-few-equal-things) · lines 1427–1511
|
|
34
|
+
- [An overview page](#an-overview-page) · lines 1513–1576
|
|
35
|
+
- [A record's header and empty values](#a-records-header-and-empty-values) · lines 1577–1628
|
|
36
|
+
- [A record's tabs, mark and facts](#a-records-tabs-mark-and-facts) · lines 1630–1711
|
|
37
|
+
- [Picking at random](#picking-at-random) · lines 1713–1744
|
|
38
|
+
- [Filling in what's missing](#filling-in-whats-missing) · lines 1746–1813
|
|
39
|
+
- [Values edited in place: the presets' looks](#values-edited-in-place-the-presets-looks) · lines 1815–1840
|
|
40
|
+
- [The sidebar and the phone's bar](#the-sidebar-and-the-phones-bar) · lines 1842–1931
|
|
41
41
|
|
|
42
42
|
<!-- /index -->
|
|
43
43
|
|
|
@@ -241,8 +241,8 @@ shape without colour too, and the word stays, so nothing needs learning.
|
|
|
241
241
|
| `active` | in use or under way now | a ring with a dot | `success-text` |
|
|
242
242
|
| `planned` | not started yet: an idea, queued, ordered, scheduled | a dashed ring | `info-text` |
|
|
243
243
|
| `paused` | started, then held; expected back | a ring with bars | `warning-text` |
|
|
244
|
-
| `done` | finished as meant: closed, resolved, filed, bought | a ring with a tick |
|
|
245
|
-
| `ended` | stopped without finishing: dropped, retired, cancelled, past | a ring with a slash |
|
|
244
|
+
| `done` | finished as meant: closed, resolved, filed, bought | a ring with a tick | `status-done-text`: a teal |
|
|
245
|
+
| `ended` | stopped without finishing: dropped, retired, cancelled, past | a ring with a slash | `status-ended-text`: a soft rose |
|
|
246
246
|
| `attention` | overdue, failing or blocked: look now | a warning triangle | `destructive-text` |
|
|
247
247
|
|
|
248
248
|
```tsx
|
|
@@ -263,6 +263,12 @@ export const STATUS_KIND: Record<WidgetStatus, StatusKind> = {
|
|
|
263
263
|
- **The icons are one map** (`STATUS_KIND_ICONS`, `lib/status-kinds.ts`
|
|
264
264
|
in the package): changing one there changes it in every app. A screen
|
|
265
265
|
can pass `icon` for one place; don't.
|
|
266
|
+
- **Done and ended have colours of their own** (4.110): a teal for
|
|
267
|
+
finished, a hue away from `active`'s green, and a soft rose for no
|
|
268
|
+
longer going, a hue away from `attention`'s red. Neither is grey, so a
|
|
269
|
+
finished record never reads as a disabled one. They're text shades
|
|
270
|
+
(`--status-done-text`, `--status-ended-text`, in every palette and both
|
|
271
|
+
themes); nothing fills with them.
|
|
266
272
|
- **Measured:** every kind's word clears 4.5:1 and its icon 3:1 on the
|
|
267
273
|
page, a card and a table row, in both themes and every palette
|
|
268
274
|
(`app-statusmark--all-kinds`).
|
|
@@ -780,9 +786,13 @@ the `ring` focus ring. A table that fits gets no tab stop and no region.
|
|
|
780
786
|
|
|
781
787
|
**The theme colour as text** (4.105) is `--primary-text`
|
|
782
788
|
(`text-primary-text`): what's picked or open, in the primary's own colour
|
|
783
|
-
where that reads as small text. The open record tab's name
|
|
784
|
-
|
|
785
|
-
|
|
789
|
+
where that reads as small text. The open record tab's name, the open tab
|
|
790
|
+
of any line tab list (`TabsList variant="line"`, a page's sub-navigation
|
|
791
|
+
under a section heading, 4.110) and a picked `ChoiceButtons` option wear
|
|
792
|
+
it (each tab with a 3px `bg-primary` line and a `bg-primary/12` tint, the choice with
|
|
793
|
+
a `border-primary` and a `bg-primary/12` fill). The pill look
|
|
794
|
+
(`TabsList`'s default) keeps its open tab in `--foreground` on the page
|
|
795
|
+
colour. It's the
|
|
786
796
|
primary itself in the light and dark themes (near-black, near-white),
|
|
787
797
|
each dark palette's accent light (the accent fails 4.5:1 as small text on
|
|
788
798
|
some surfaces), and Palm LCD's ink. Never for a link (`--link`) or a
|
|
@@ -1639,9 +1649,13 @@ its short facts the last tab, Details. A mark goes left of the title.
|
|
|
1639
1649
|
- **Tabs** (`tab` on a section): a line tab list under the strip and any
|
|
1640
1650
|
sections with no tab, one tab per name in the order the sections first
|
|
1641
1651
|
give it. The look is the record standard's 3B (4.101): 44px tabs in
|
|
1642
|
-
16px semibold (14px under 48rem), the
|
|
1643
|
-
|
|
1644
|
-
|
|
1652
|
+
16px semibold (14px under 48rem), the others muted. The selected one is
|
|
1653
|
+
plainly marked (4.111): its name bold in the theme colour
|
|
1654
|
+
(`--primary-text`, 4.105), a 3px primary line under it and a primary
|
|
1655
|
+
tint behind it (`bg-primary/12`, as a picked choice); every tab is as
|
|
1656
|
+
wide as its bold name, so choosing one moves none. A page's own line
|
|
1657
|
+
tabs (`TabsList variant="line"`) are marked the same way, semibold
|
|
1658
|
+
over medium. The list's own
|
|
1645
1659
|
bottom border runs the column's width. A tab's count (`tabCounts`, by
|
|
1646
1660
|
name: the records it holds) sits beside its name in a small muted
|
|
1647
1661
|
pill; a tab with none shows no count. A list wider than the column
|
|
@@ -1666,6 +1680,15 @@ its short facts the last tab, Details. A mark goes left of the title.
|
|
|
1666
1680
|
18rem column beside its sections once the tab is 42rem wide, under
|
|
1667
1681
|
them below that. Short facts only, never free text: run-on text in a
|
|
1668
1682
|
narrow box is what the standard took away.
|
|
1683
|
+
- **Several items in one fact** (4.111): linked records, a few tasks,
|
|
1684
|
+
each item marked so a long title that wraps doesn't run into the next.
|
|
1685
|
+
A `list` fact (`{ label: 'Related', kind: 'list', items: [{ name, to,
|
|
1686
|
+
icon }] }`) draws them; an app's own box of several things uses the
|
|
1687
|
+
same `FactList` and `FactListItem`. Each item leads with its kind's
|
|
1688
|
+
icon (the record standard's 4I) when the app gives one, a neutral
|
|
1689
|
+
bullet otherwise, in the muted colour; a wrapped line starts after the
|
|
1690
|
+
mark (a hanging indent), and items have a little room between them.
|
|
1691
|
+
Never a bare stack of links.
|
|
1669
1692
|
- **The strip** (`KeyStats`) is as wide as its numbers (`width="content"`,
|
|
1670
1693
|
the default since 4.98), not the page's width.
|
|
1671
1694
|
- **A mark or avatar** (`leading`): left of the title, top-aligned,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { StatusKind } from '../../lib/status-kinds.js';
|
|
3
3
|
import type { EditInPlace } from './edit-in-place.js';
|
|
4
|
+
import type { IconComponent } from './icon-component.js';
|
|
4
5
|
/** What a fact holds: one of the short kinds a rail can draw. */
|
|
5
6
|
export type EntityViewFactValue =
|
|
6
7
|
/** A status, drawn as its StatusMark; `word` is the status's own ("As needed"). */
|
|
@@ -41,6 +42,26 @@ export type EntityViewFactValue =
|
|
|
41
42
|
name: string;
|
|
42
43
|
to: string;
|
|
43
44
|
short: true;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Several items (4.111): linked records, links out, or plain words, each
|
|
48
|
+
* marked by its kind's `icon` or a bullet (FactList), so long titles
|
|
49
|
+
* that wrap still read apart. An item with `to` links in the app, with
|
|
50
|
+
* `href` out of it (a new tab), with neither is its words. None is empty.
|
|
51
|
+
*/
|
|
52
|
+
| {
|
|
53
|
+
kind: 'list';
|
|
54
|
+
items: readonly EntityViewFactListItem[];
|
|
55
|
+
};
|
|
56
|
+
/** One item of a `list` fact. */
|
|
57
|
+
export type EntityViewFactListItem = {
|
|
58
|
+
name: string;
|
|
59
|
+
/** A record in the app (`/discussions/3`). */
|
|
60
|
+
to?: string;
|
|
61
|
+
/** A page out of the app, opening in a new tab. */
|
|
62
|
+
href?: string;
|
|
63
|
+
/** Its kind's icon (the record standard's 4I); a bullet without one. */
|
|
64
|
+
icon?: IconComponent;
|
|
44
65
|
};
|
|
45
66
|
export type EntityViewFact = EntityViewFactValue & {
|
|
46
67
|
label: string;
|
|
@@ -4,6 +4,7 @@ import { Link } from 'react-router';
|
|
|
4
4
|
import { ExternalLinkIcon } from 'lucide-react';
|
|
5
5
|
import { cn } from 'cn';
|
|
6
6
|
import { Badge } from '../ui/badge.js';
|
|
7
|
+
import { FactList, FactListItem } from './fact-list.js';
|
|
7
8
|
import { StatusMark } from './status-mark.js';
|
|
8
9
|
const LINK_CLASS = 'rounded-sm font-medium text-link underline-offset-4 outline-none hover:underline focus-visible:ring-3 focus-visible:ring-ring/50';
|
|
9
10
|
/** A fact as the view draws it: `null` when empty. */
|
|
@@ -25,6 +26,10 @@ export function factValue(fact) {
|
|
|
25
26
|
return fact.to ? (_jsx(Link, { to: fact.to, className: cn(LINK_CLASS, 'tabular-nums'), children: fact.count })) : (_jsx("span", { className: "tabular-nums", children: fact.count }));
|
|
26
27
|
case 'link':
|
|
27
28
|
return (_jsxs("a", { href: fact.href, target: "_blank", rel: "noreferrer", className: cn(LINK_CLASS, 'inline-flex max-w-full items-center gap-1'), children: [_jsx("span", { className: "truncate", children: fact.name }), _jsx(ExternalLinkIcon, { "aria-hidden": "true", className: "size-3.5 shrink-0" }), _jsx("span", { className: "sr-only", children: "(opens in a new tab)" })] }));
|
|
29
|
+
case 'list':
|
|
30
|
+
if (fact.items.length === 0)
|
|
31
|
+
return null;
|
|
32
|
+
return (_jsx(FactList, { children: fact.items.map((item, index) => (_jsx(FactListItem, { icon: item.icon, children: item.to ? (_jsx(Link, { to: item.to, className: LINK_CLASS, children: item.name })) : item.href ? (_jsxs("a", { href: item.href, target: "_blank", rel: "noreferrer", className: LINK_CLASS, children: [item.name, _jsx(ExternalLinkIcon, { "aria-hidden": "true", className: "ml-1 inline size-3.5 align-[-0.125em]" }), _jsx("span", { className: "sr-only", children: "(opens in a new tab)" })] })) : (item.name) }, `${index}:${item.name}`))) }));
|
|
28
33
|
case 'record':
|
|
29
34
|
return (_jsx(Link, { to: fact.to, title: fact.name, className: cn(LINK_CLASS, 'inline-block max-w-full truncate align-bottom'), children: fact.name }));
|
|
30
35
|
}
|
|
@@ -74,8 +74,9 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
74
74
|
// switch. With no `tab` on any section, nothing changes.
|
|
75
75
|
//
|
|
76
76
|
// The tab bar (4.101, record standard 3B): bigger underline tabs (16px
|
|
77
|
-
// semibold, 14px on a phone),
|
|
78
|
-
//
|
|
77
|
+
// semibold, 14px on a phone), the open one plainly marked (4.111): a 3px
|
|
78
|
+
// primary line, a primary tint behind it (ui/tabs' line look) and its name
|
|
79
|
+
// bold in the theme colour (`text-primary-text`, 4.105), each
|
|
79
80
|
// tab's count beside its name (`tabCounts`; none for zero). The bar sticks
|
|
80
81
|
// to the top of whatever scrolls (the page, or a record dialog's body) as
|
|
81
82
|
// the record scrolls under it, `tabsStickyTop` below the top, and once
|
|
@@ -337,7 +338,7 @@ function MainTabs({ tabs, label, railFields = 'beside', title, counts, stickyTop
|
|
|
337
338
|
// padding, so the bar sits at the body's own top edge there.
|
|
338
339
|
style: { top: stickyTop ?? 'var(--entity-view-sticky-top, 0px)' }, className: cn('sticky z-10 -mx-1 flex min-w-0 flex-col gap-1 bg-background px-1 pt-0 data-[stuck]:pt-2 data-[stuck]:shadow-[0_8px_12px_-10px_var(--color-foreground)]', aside !== undefined && FACTS_RAIL.barBeside), children: [stuck && title && (_jsx("p", { "data-slot": "entity-view-tab-bar-title", "aria-hidden": "true", className: "truncate type-label font-semibold text-foreground", children: title })), _jsx(TabsList, { variant: "line", activateOnFocus: true, "aria-label": label, className: "h-auto w-full max-w-full justify-start gap-0 overflow-x-auto overflow-y-hidden border-b border-border p-0 md:gap-1 [scrollbar-width:thin]", children: tabs.map((tab) => {
|
|
339
340
|
const count = countOf(tab);
|
|
340
|
-
return (_jsxs(TabsTrigger, { value: tab.slug, className: "h-11 flex-none gap-1.5 px-2.5 text-sm font-semibold text-muted-foreground group-data-horizontal/tabs:after:bottom-0 group-data-horizontal/tabs:after:h-[3px] after:bg-primary data-active:text-primary-text md:px-4 md:text-base dark:text-muted-foreground dark:data-active:text-primary-text", children: [tab.name, count > 0 && (_jsx("span", { "data-slot": "entity-view-tab-count", className: "rounded-full bg-muted px-1.5 text-xs leading-[1.0625rem] font-medium tabular-nums text-foreground", children: count }))] }, tab.slug));
|
|
341
|
+
return (_jsxs(TabsTrigger, { value: tab.slug, className: "h-11 flex-none gap-1.5 rounded-b-none px-2.5 text-sm font-semibold text-muted-foreground group-data-horizontal/tabs:after:bottom-0 group-data-horizontal/tabs:after:h-[3px] after:bg-primary data-active:font-bold! data-active:text-primary-text md:px-4 md:text-base dark:text-muted-foreground dark:data-active:text-primary-text", children: [_jsx("span", { "data-slot": "entity-view-tab-name", "data-text": tab.name, className: "inline-grid after:invisible after:col-start-1 after:row-start-1 after:h-0 after:font-bold after:content-[attr(data-text)]", children: _jsx("span", { className: "col-start-1 row-start-1", children: tab.name }) }), count > 0 && (_jsx("span", { "data-slot": "entity-view-tab-count", className: "rounded-full bg-muted px-1.5 text-xs leading-[1.0625rem] font-medium tabular-nums text-foreground", children: count }))] }, tab.slug));
|
|
341
342
|
}) })] }), aside === undefined ? (panels) : (_jsxs("div", { "data-slot": "entity-view-with-facts", className: FACTS_RAIL.columns, children: [panels, aside] }))] }));
|
|
342
343
|
}
|
|
343
344
|
// The `tabs` layout's sections (1A): the main column's untabbed sections,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { IconComponent } from './icon-component.js';
|
|
3
|
+
export type FactListProps = {
|
|
4
|
+
/** FactListItems. */
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
/** The list's name, when nothing beside it (a fact's label) says what it lists. */
|
|
7
|
+
'aria-label'?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
};
|
|
10
|
+
/** A list of items, each marked by its icon or a bullet, wrapped lines indented after the mark. */
|
|
11
|
+
export declare function FactList({ children, className, 'aria-label': ariaLabel }: FactListProps): import("react").JSX.Element;
|
|
12
|
+
export type FactListItemProps = {
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
/** The item's kind, drawn before it in the muted colour; a neutral bullet without one. */
|
|
15
|
+
icon?: IconComponent;
|
|
16
|
+
className?: string;
|
|
17
|
+
};
|
|
18
|
+
/** One item of a FactList: its mark, then what it holds, wrapping under itself. */
|
|
19
|
+
export declare function FactListItem({ children, icon: Icon, className }: FactListItemProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from 'cn';
|
|
3
|
+
/** A list of items, each marked by its icon or a bullet, wrapped lines indented after the mark. */
|
|
4
|
+
export function FactList({ children, className, 'aria-label': ariaLabel }) {
|
|
5
|
+
return (_jsx("ul", { "data-slot": "fact-list", "aria-label": ariaLabel, className: cn('flex min-w-0 flex-col gap-1.5', className), children: children }));
|
|
6
|
+
}
|
|
7
|
+
/** One item of a FactList: its mark, then what it holds, wrapping under itself. */
|
|
8
|
+
export function FactListItem({ children, icon: Icon, className }) {
|
|
9
|
+
return (_jsxs("li", { "data-slot": "fact-list-item", className: cn('flex min-w-0 items-start gap-2', className), children: [_jsx("span", { "data-slot": "fact-list-mark", "aria-hidden": "true", className: "flex h-[1lh] w-4 shrink-0 items-center justify-center text-muted-foreground", children: Icon ? _jsx(Icon, { "aria-hidden": "true", className: "size-3.5" }) : _jsx("span", { className: "size-1.5 rounded-full bg-current" }) }), _jsx("div", { className: "min-w-0 flex-1 break-words", children: children })] }));
|
|
10
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type DateFilterPreset } from '../../lib/date-filter.js';
|
|
2
|
+
export type FilterDateProps = {
|
|
3
|
+
/** What it filters ("Due"): the prefix of the value it shows ("Due: Before today"). */
|
|
4
|
+
label: string;
|
|
5
|
+
/** The filter's value (lib/date-filter.ts): a preset, a range (`'2026-11-01..2026-11-30'`), or '' for any. */
|
|
6
|
+
value: string;
|
|
7
|
+
onValueChange: (value: string) => void;
|
|
8
|
+
/** The presets it offers, in order: every one (Before today, Today, From today) unless set. */
|
|
9
|
+
presets?: readonly DateFilterPreset[];
|
|
10
|
+
/** Offer Between dates, a From and a To day: true unless set. */
|
|
11
|
+
range?: boolean;
|
|
12
|
+
/** What it says while off: "Any <label in lower case> date" unless set ("Any due date"). */
|
|
13
|
+
anyLabel?: string;
|
|
14
|
+
/** How a range's days are shown. Defaults to `{ dateStyle: 'medium' }`. */
|
|
15
|
+
format?: Intl.DateTimeFormatOptions;
|
|
16
|
+
locale?: string;
|
|
17
|
+
className?: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* A date filter that names itself: "Any due date" while off, "Due: Before
|
|
21
|
+
* today" with a preset, "Due: Nov 1 – Nov 30, 2026" with a range, whose
|
|
22
|
+
* From and To days show beside it.
|
|
23
|
+
*/
|
|
24
|
+
export declare function FilterDate({ label, value, onValueChange, presets, range, anyLabel, format, locale, className, }: FilterDateProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// A list's date filter (4.110), for FilterBar: a select that names itself
|
|
3
|
+
// like FilterSelect ("Any due date" while off, "Due: Before today" on),
|
|
4
|
+
// with the relative presets (lib/date-filter.ts) and Between dates, which
|
|
5
|
+
// shows a From and a To day beside it. Its value is one string, so it's a
|
|
6
|
+
// single-value filter in useTableUrlState and a saved view can set it
|
|
7
|
+
// (`filters: { due: 'before-today' }`); the query reads it with
|
|
8
|
+
// resolveDateFilter, and its chip's words are dateFilterText.
|
|
9
|
+
import { useState } from 'react';
|
|
10
|
+
import { cn } from 'cn';
|
|
11
|
+
import { Select, SelectContent, SelectItem, SelectSeparator, SelectTrigger, SelectValue } from '../ui/select.js';
|
|
12
|
+
import { DATE_FILTER_PRESETS, DATE_FILTER_PRESET_LABELS, dateFilterText, dateRangeValue, parseDateFilter, } from '../../lib/date-filter.js';
|
|
13
|
+
import { DateField } from './date-field.js';
|
|
14
|
+
// Base UI's Select needs a value for "any" that isn't empty.
|
|
15
|
+
const ANY = '__any__';
|
|
16
|
+
const RANGE = '__range__';
|
|
17
|
+
/**
|
|
18
|
+
* A date filter that names itself: "Any due date" while off, "Due: Before
|
|
19
|
+
* today" with a preset, "Due: Nov 1 – Nov 30, 2026" with a range, whose
|
|
20
|
+
* From and To days show beside it.
|
|
21
|
+
*/
|
|
22
|
+
export function FilterDate({ label, value, onValueChange, presets = DATE_FILTER_PRESETS, range = true, anyLabel, format, locale, className, }) {
|
|
23
|
+
const filter = parseDateFilter(value);
|
|
24
|
+
// Between dates picked, before either day is: the days show, the value stays ''.
|
|
25
|
+
const [ranging, setRanging] = useState(false);
|
|
26
|
+
const bounds = filter && 'range' in filter ? filter.range : null;
|
|
27
|
+
const showRange = range && (bounds !== null || (ranging && filter === null));
|
|
28
|
+
const any = anyLabel ?? `Any ${label.toLowerCase()} date`;
|
|
29
|
+
const picked = filter && 'preset' in filter ? filter.preset : showRange ? RANGE : ANY;
|
|
30
|
+
const shown = filter ? `${label}: ${dateFilterText(value, format, locale)}` : showRange ? `${label}: Between dates` : any;
|
|
31
|
+
const pick = (next) => {
|
|
32
|
+
if (next === RANGE) {
|
|
33
|
+
setRanging(true);
|
|
34
|
+
if (!bounds)
|
|
35
|
+
onValueChange('');
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
setRanging(false);
|
|
39
|
+
onValueChange(next === ANY ? '' : next);
|
|
40
|
+
};
|
|
41
|
+
const setEnd = (end, day) => {
|
|
42
|
+
onValueChange(dateRangeValue({ ...bounds, [end]: day || undefined }));
|
|
43
|
+
};
|
|
44
|
+
return (_jsxs("div", { "data-slot": "filter-date", className: cn('flex flex-wrap items-center gap-2', className), children: [_jsxs(Select, { value: picked, onValueChange: (next) => pick(next === null ? ANY : String(next)), children: [_jsx(SelectTrigger, { "aria-label": shown, "data-slot": "filter-date-select", "data-active": filter ? true : undefined, children: _jsx(SelectValue, { children: () => shown }) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: ANY, children: any }), presets.map((preset) => (_jsx(SelectItem, { value: preset, children: DATE_FILTER_PRESET_LABELS[preset] }, preset))), range && (_jsxs(_Fragment, { children: [_jsx(SelectSeparator, {}), _jsx(SelectItem, { value: RANGE, children: "Between dates" })] }))] })] }), showRange && (_jsxs("div", { "data-slot": "filter-date-range", className: "flex flex-wrap items-center gap-2", children: [_jsx(DateField, { value: bounds?.from ?? '', onChange: (day) => setEnd('from', day), "aria-label": `${label} From`, placeholder: "From", format: format, locale: locale, className: "w-40" }), _jsx(DateField, { value: bounds?.to ?? '', onChange: (day) => setEnd('to', day), "aria-label": `${label} To`, placeholder: "To", format: format, locale: locale, className: "w-40" })] }))] }));
|
|
45
|
+
}
|
|
@@ -20,7 +20,14 @@ function TabsList({ className, variant = "default", ...props }) {
|
|
|
20
20
|
return (_jsx(TabsPrimitive.List, { "data-slot": "tabs-list", "data-variant": variant, className: cn(tabsListVariants({ variant }), className), ...props }));
|
|
21
21
|
}
|
|
22
22
|
function TabsTrigger({ className, ...props }) {
|
|
23
|
-
return (_jsx(TabsPrimitive.Tab, { "data-slot": "tabs-trigger", className: cn("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/
|
|
23
|
+
return (_jsx(TabsPrimitive.Tab, { "data-slot": "tabs-trigger", className: cn("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/75 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", "group-data-[variant=line]/tabs-list:rounded-b-none group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-primary/12 dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-primary/12", "data-active:bg-background group-data-[variant=default]/tabs-list:data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:group-data-[variant=default]/tabs-list:data-active:text-foreground",
|
|
24
|
+
// The line look (a page's sub-navigation, a record's tabs): the open
|
|
25
|
+
// tab stands out (4.111): its name semibold in --primary-text (the
|
|
26
|
+
// primary where it's too faint for small text), a 3px primary line,
|
|
27
|
+
// and a primary tint behind it, as a picked ChoiceButtons option
|
|
28
|
+
// (bg-primary/12). A closed one is muted and medium weight. (A closed pill is the text
|
|
29
|
+
// at 75%: shadcn's 60% measured 3.45 on Palm LCD's raised surface.)
|
|
30
|
+
"group-data-[variant=line]/tabs-list:text-muted-foreground group-data-[variant=line]/tabs-list:hover:text-foreground group-data-[variant=line]/tabs-list:data-active:font-semibold", "group-data-[variant=line]/tabs-list:data-active:text-primary-text dark:group-data-[variant=line]/tabs-list:data-active:text-primary-text", "after:absolute after:bg-primary after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100 group-data-horizontal/tabs:group-data-[variant=line]/tabs-list:after:h-[3px] group-data-vertical/tabs:group-data-[variant=line]/tabs-list:after:w-[3px]", className), ...props }));
|
|
24
31
|
}
|
|
25
32
|
function TabsContent({ className, ...props }) {
|
|
26
33
|
return (_jsx(TabsPrimitive.Panel, { "data-slot": "tabs-content", className: cn("flex-1 text-sm outline-none", className), ...props }));
|
package/dist/index.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export { EmptyText, type EmptyTextProps } from './components/app/empty-value.js'
|
|
|
28
28
|
export { isEmptyValue } from './lib/empty-value.js';
|
|
29
29
|
export { IconAction, type IconActionProps } from './components/app/icon-action.js';
|
|
30
30
|
export { EntityView, type EntityViewEmptyFields, type EntityViewField, type EntityViewLayout, type EntityViewMobileOrder, type EntityViewPlacement, type EntityViewProps, type EntityViewRailFields, type EntityViewSection, } from './components/app/entity-view.js';
|
|
31
|
-
export { type EntityViewFact, type EntityViewFactValue } from './components/app/entity-view-facts.js';
|
|
31
|
+
export { type EntityViewFact, type EntityViewFactListItem, type EntityViewFactValue } from './components/app/entity-view-facts.js';
|
|
32
32
|
export { entityViewTabSlug } from './lib/entity-view-tab.js';
|
|
33
33
|
export { usePrinting } from './components/app/print-context.js';
|
|
34
34
|
export { RecordDialogRoute, RecordLink, type RecordDialogRouteProps, type RecordLinkProps, } from './components/app/record-dialog.js';
|
|
@@ -70,6 +70,9 @@ export { RouteErrorBoundary } from './components/app/route-error-boundary.js';
|
|
|
70
70
|
export { PillFilter, type PillFilterOption, type PillFilterProps } from './components/app/pill-filter.js';
|
|
71
71
|
export { SecondaryFilters, type ActiveFilter, type SecondaryFiltersProps } from './components/app/secondary-filters.js';
|
|
72
72
|
export { FilterBar, FilterSelect, type FilterBarProps, type FilterBarSearch, type FilterSelectOption, type FilterSelectProps, } from './components/app/filter-bar.js';
|
|
73
|
+
export { FilterDate, type FilterDateProps } from './components/app/filter-date.js';
|
|
74
|
+
export { FactList, FactListItem, type FactListItemProps, type FactListProps } from './components/app/fact-list.js';
|
|
75
|
+
export { DATE_FILTER_PRESETS, DATE_FILTER_PRESET_LABELS, dateFilterKeeps, dateFilterText, dateRangeValue, parseDateFilter, resolveDateFilter, type DateFilter, type DateFilterBounds, type DateFilterPreset, } from './lib/date-filter.js';
|
|
73
76
|
export { SessionStage, SessionView, sessionStageLit, sessionStageMain, sessionStageQuiet, type SessionStageProps, type SessionStageTone, type SessionViewProps, } from './components/app/session-view.js';
|
|
74
77
|
export { AllowReminders, type AllowRemindersProps } from './components/app/allow-reminders.js';
|
|
75
78
|
export { StageCircle, type StageCircleProps, type StageCircleStage, type StageCircleTone, } from './components/app/stage-circle.js';
|
package/dist/index.js
CHANGED
|
@@ -76,6 +76,9 @@ export { RouteErrorBoundary } from './components/app/route-error-boundary.js';
|
|
|
76
76
|
export { PillFilter } from './components/app/pill-filter.js';
|
|
77
77
|
export { SecondaryFilters } from './components/app/secondary-filters.js';
|
|
78
78
|
export { FilterBar, FilterSelect, } from './components/app/filter-bar.js';
|
|
79
|
+
export { FilterDate } from './components/app/filter-date.js';
|
|
80
|
+
export { FactList, FactListItem } from './components/app/fact-list.js';
|
|
81
|
+
export { DATE_FILTER_PRESETS, DATE_FILTER_PRESET_LABELS, dateFilterKeeps, dateFilterText, dateRangeValue, parseDateFilter, resolveDateFilter, } from './lib/date-filter.js';
|
|
79
82
|
export { SessionStage, SessionView, sessionStageLit, sessionStageMain, sessionStageQuiet, } from './components/app/session-view.js';
|
|
80
83
|
export { AllowReminders } from './components/app/allow-reminders.js';
|
|
81
84
|
export { StageCircle, } from './components/app/stage-circle.js';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type PlainDate } from './plain-date.js';
|
|
2
|
+
/** A relative date filter, read against today each time the list loads. */
|
|
3
|
+
export type DateFilterPreset = 'before-today' | 'today' | 'from-today';
|
|
4
|
+
/** Every preset, in the order FilterDate lists them. */
|
|
5
|
+
export declare const DATE_FILTER_PRESETS: readonly DateFilterPreset[];
|
|
6
|
+
/** Each preset's words, in the control and its chip ("Due: Before today"). */
|
|
7
|
+
export declare const DATE_FILTER_PRESET_LABELS: Record<DateFilterPreset, string>;
|
|
8
|
+
/** The days a date filter keeps, both ends included; an end left out is open. */
|
|
9
|
+
export type DateFilterBounds = {
|
|
10
|
+
from?: PlainDate;
|
|
11
|
+
to?: PlainDate;
|
|
12
|
+
};
|
|
13
|
+
/** What a date filter's value says: a preset, or a range of days. */
|
|
14
|
+
export type DateFilter = {
|
|
15
|
+
preset: DateFilterPreset;
|
|
16
|
+
} | {
|
|
17
|
+
range: DateFilterBounds;
|
|
18
|
+
};
|
|
19
|
+
/** Reads a date filter's value: a preset, a range, or null for '' and anything it can't read. */
|
|
20
|
+
export declare function parseDateFilter(value: string): DateFilter | null;
|
|
21
|
+
/** A range's value: `'2026-11-01..2026-11-30'`, either end left out when open, '' when both are. */
|
|
22
|
+
export declare function dateRangeValue({ from, to }: DateFilterBounds): string;
|
|
23
|
+
/**
|
|
24
|
+
* The days a date filter keeps, for the query: inclusive plain days, an
|
|
25
|
+
* end left out when open. `before-today` is `{ to: yesterday }`,
|
|
26
|
+
* `from-today` `{ from: today }`. Null for '' or a value it can't read:
|
|
27
|
+
* no filter. `today` is the browser's own unless given.
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveDateFilter(value: string, today?: PlainDate): DateFilterBounds | null;
|
|
30
|
+
/** Whether a plain day is one the filter keeps (a mock or a list filtered in the browser). */
|
|
31
|
+
export declare function dateFilterKeeps(value: string, day: PlainDate, today?: PlainDate): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* The words for a date filter's value: "Before today", "Nov 1 – Nov 30, 2026",
|
|
34
|
+
* "From Nov 1, 2026", "Until Nov 30, 2026", or '' for none.
|
|
35
|
+
*/
|
|
36
|
+
export declare function dateFilterText(value: string, format?: Intl.DateTimeFormatOptions, locale?: string): string;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// A list's date filter (4.110): FilterDate's value, as one string, so it
|
|
2
|
+
// lives in the URL like any single-value filter (useTableUrlState) and a
|
|
3
|
+
// saved view can set it (`filters: { due: 'before-today' }`). It's either
|
|
4
|
+
// a preset, read against today when the list loads, or a range of plain
|
|
5
|
+
// days, either end open:
|
|
6
|
+
//
|
|
7
|
+
// before-today every day before today
|
|
8
|
+
// today today alone
|
|
9
|
+
// from-today today and every day after
|
|
10
|
+
// 2026-11-01..2026-11-30 both days included
|
|
11
|
+
// 2026-11-01.. from that day on
|
|
12
|
+
// ..2026-11-30 up to that day
|
|
13
|
+
//
|
|
14
|
+
// '' is no filter. resolveDateFilter turns a value into the inclusive days
|
|
15
|
+
// the query sends; dateFilterText into the words its chip and control show.
|
|
16
|
+
import { formatPlainDate, localToPlainDate, plainDateToLocal } from './plain-date.js';
|
|
17
|
+
/** Every preset, in the order FilterDate lists them. */
|
|
18
|
+
export const DATE_FILTER_PRESETS = ['before-today', 'today', 'from-today'];
|
|
19
|
+
/** Each preset's words, in the control and its chip ("Due: Before today"). */
|
|
20
|
+
export const DATE_FILTER_PRESET_LABELS = {
|
|
21
|
+
'before-today': 'Before today',
|
|
22
|
+
today: 'Today',
|
|
23
|
+
'from-today': 'From today',
|
|
24
|
+
};
|
|
25
|
+
const RANGE_SEPARATOR = '..';
|
|
26
|
+
const isDay = (value) => value === '' || formatPlainDate(value) !== '';
|
|
27
|
+
const isPreset = (value) => DATE_FILTER_PRESETS.includes(value);
|
|
28
|
+
/** Reads a date filter's value: a preset, a range, or null for '' and anything it can't read. */
|
|
29
|
+
export function parseDateFilter(value) {
|
|
30
|
+
if (isPreset(value))
|
|
31
|
+
return { preset: value };
|
|
32
|
+
const at = value.indexOf(RANGE_SEPARATOR);
|
|
33
|
+
if (at === -1)
|
|
34
|
+
return null;
|
|
35
|
+
const from = value.slice(0, at);
|
|
36
|
+
const to = value.slice(at + RANGE_SEPARATOR.length);
|
|
37
|
+
if (!isDay(from) || !isDay(to) || (from === '' && to === ''))
|
|
38
|
+
return null;
|
|
39
|
+
return { range: { ...(from ? { from } : {}), ...(to ? { to } : {}) } };
|
|
40
|
+
}
|
|
41
|
+
/** A range's value: `'2026-11-01..2026-11-30'`, either end left out when open, '' when both are. */
|
|
42
|
+
export function dateRangeValue({ from = '', to = '' }) {
|
|
43
|
+
return from || to ? `${from}${RANGE_SEPARATOR}${to}` : '';
|
|
44
|
+
}
|
|
45
|
+
const shift = (day, days) => {
|
|
46
|
+
const local = plainDateToLocal(day);
|
|
47
|
+
local.setDate(local.getDate() + days);
|
|
48
|
+
return localToPlainDate(local);
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* The days a date filter keeps, for the query: inclusive plain days, an
|
|
52
|
+
* end left out when open. `before-today` is `{ to: yesterday }`,
|
|
53
|
+
* `from-today` `{ from: today }`. Null for '' or a value it can't read:
|
|
54
|
+
* no filter. `today` is the browser's own unless given.
|
|
55
|
+
*/
|
|
56
|
+
export function resolveDateFilter(value, today = localToPlainDate(new Date())) {
|
|
57
|
+
const filter = parseDateFilter(value);
|
|
58
|
+
if (!filter)
|
|
59
|
+
return null;
|
|
60
|
+
if ('range' in filter)
|
|
61
|
+
return filter.range;
|
|
62
|
+
if (filter.preset === 'before-today')
|
|
63
|
+
return { to: shift(today, -1) };
|
|
64
|
+
if (filter.preset === 'today')
|
|
65
|
+
return { from: today, to: today };
|
|
66
|
+
return { from: today };
|
|
67
|
+
}
|
|
68
|
+
/** Whether a plain day is one the filter keeps (a mock or a list filtered in the browser). */
|
|
69
|
+
export function dateFilterKeeps(value, day, today) {
|
|
70
|
+
const bounds = resolveDateFilter(value, today);
|
|
71
|
+
if (!bounds)
|
|
72
|
+
return true;
|
|
73
|
+
if (!day)
|
|
74
|
+
return false;
|
|
75
|
+
return (bounds.from === undefined || day >= bounds.from) && (bounds.to === undefined || day <= bounds.to);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The words for a date filter's value: "Before today", "Nov 1 – Nov 30, 2026",
|
|
79
|
+
* "From Nov 1, 2026", "Until Nov 30, 2026", or '' for none.
|
|
80
|
+
*/
|
|
81
|
+
export function dateFilterText(value, format = { dateStyle: 'medium' }, locale) {
|
|
82
|
+
const filter = parseDateFilter(value);
|
|
83
|
+
if (!filter)
|
|
84
|
+
return '';
|
|
85
|
+
if ('preset' in filter)
|
|
86
|
+
return DATE_FILTER_PRESET_LABELS[filter.preset];
|
|
87
|
+
const { from, to } = filter.range;
|
|
88
|
+
const day = (each) => formatPlainDate(each, format, locale);
|
|
89
|
+
if (from && to)
|
|
90
|
+
return `${day(from)} – ${day(to)}`;
|
|
91
|
+
return from ? `From ${day(from)}` : `Until ${day(to)}`;
|
|
92
|
+
}
|
|
@@ -6,5 +6,10 @@ export declare const STATUS_KINDS: readonly StatusKind[];
|
|
|
6
6
|
export declare const STATUS_KIND_ICONS: Record<StatusKind, IconComponent>;
|
|
7
7
|
/** Each kind's word, when the status has none of its own (a legend). */
|
|
8
8
|
export declare const STATUS_KIND_LABELS: Record<StatusKind, string>;
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Each kind's colour, for the icon and the word: *-text tokens only. Done
|
|
11
|
+
* is a teal and ended a soft rose (4.110, --status-done-text and
|
|
12
|
+
* --status-ended-text), so a finished or stopped record no longer reads as
|
|
13
|
+
* a grey, disabled one.
|
|
14
|
+
*/
|
|
10
15
|
export declare const STATUS_KIND_TONES: Record<StatusKind, string>;
|
package/dist/lib/status-kinds.js
CHANGED
|
@@ -22,12 +22,17 @@ export const STATUS_KIND_LABELS = {
|
|
|
22
22
|
ended: 'Ended',
|
|
23
23
|
attention: 'Needs Attention',
|
|
24
24
|
};
|
|
25
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Each kind's colour, for the icon and the word: *-text tokens only. Done
|
|
27
|
+
* is a teal and ended a soft rose (4.110, --status-done-text and
|
|
28
|
+
* --status-ended-text), so a finished or stopped record no longer reads as
|
|
29
|
+
* a grey, disabled one.
|
|
30
|
+
*/
|
|
26
31
|
export const STATUS_KIND_TONES = {
|
|
27
32
|
active: 'text-success-text',
|
|
28
33
|
planned: 'text-info-text',
|
|
29
34
|
paused: 'text-warning-text',
|
|
30
|
-
done: 'text-
|
|
31
|
-
ended: 'text-
|
|
35
|
+
done: 'text-status-done-text',
|
|
36
|
+
ended: 'text-status-ended-text',
|
|
32
37
|
attention: 'text-destructive-text',
|
|
33
38
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tristan2828/ui-foundation",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.111.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
|
@@ -59,6 +59,8 @@
|
|
|
59
59
|
--color-info: var(--info);
|
|
60
60
|
--color-info-foreground: var(--info-foreground);
|
|
61
61
|
--color-info-text: var(--info-text);
|
|
62
|
+
--color-status-done-text: var(--status-done-text);
|
|
63
|
+
--color-status-ended-text: var(--status-ended-text);
|
|
62
64
|
--color-link: var(--link);
|
|
63
65
|
--color-primary-text: var(--primary-text);
|
|
64
66
|
--color-card-header: var(--card-header);
|
|
@@ -492,6 +494,8 @@
|
|
|
492
494
|
--success-text: var(--green-800);
|
|
493
495
|
--warning-text: var(--amber-800);
|
|
494
496
|
--info-text: var(--blue-800);
|
|
497
|
+
--status-done-text: var(--teal-800);
|
|
498
|
+
--status-ended-text: var(--rose-700);
|
|
495
499
|
--link: var(--blue-700);
|
|
496
500
|
--primary-text: var(--gray-950);
|
|
497
501
|
--highlight-amber: oklch(0.9 0.1 75);
|
package/styles/theme.css
CHANGED
|
@@ -56,6 +56,15 @@
|
|
|
56
56
|
--blue-700: oklch(0.52 0.17 255); /* white on it: 5.59 */
|
|
57
57
|
--blue-800: oklch(0.45 0.15 255); /* on white: 7.54 */
|
|
58
58
|
--blue-400: oklch(0.75 0.12 255); /* on near-black: 8.90 */
|
|
59
|
+
/* The two status kinds that have stopped (4.110, StatusMark's done and
|
|
60
|
+
ended): text shades only, nothing fills with them. A teal for done,
|
|
61
|
+
a hue away from success's green, and a soft rose for ended, a hue
|
|
62
|
+
away from destructive's red. On white / gray-100 / gray-200, and on
|
|
63
|
+
near-black / gray-950 / gray-900: */
|
|
64
|
+
--teal-800: oklch(0.45 0.09 190); /* 6.93 / 6.36 / 5.50 */
|
|
65
|
+
--teal-400: oklch(0.78 0.11 190); /* 10.4 / 9.39 / 7.93 */
|
|
66
|
+
--rose-700: oklch(0.52 0.13 0); /* 5.91 / 5.42 / 4.69 */
|
|
67
|
+
--rose-400: oklch(0.76 0.11 5); /* 8.77 / 7.94 / 6.71 */
|
|
59
68
|
/*
|
|
60
69
|
* Categorical slots. For values that differ from each other but are not
|
|
61
70
|
* better or worse than each other — a genre, a team, a category. Tones
|
|
@@ -386,6 +395,11 @@
|
|
|
386
395
|
--palette-success: #66d69a;
|
|
387
396
|
--palette-warning: #e0b152;
|
|
388
397
|
--palette-danger: #df7a72;
|
|
398
|
+
/* Done (a teal) and ended (a soft rose), the stopped status kinds (4.110).
|
|
399
|
+
On bg / card / raised, the lowest palette: done 8.86 / 7.86 / 6.80,
|
|
400
|
+
ended 7.37 / 6.54 / 5.66. */
|
|
401
|
+
--palette-done: #56c6cf;
|
|
402
|
+
--palette-ended: #e88aa8;
|
|
389
403
|
|
|
390
404
|
/*
|
|
391
405
|
* Palm LCD, the one light palette (design-language.md "Palettes"): a
|
|
@@ -447,6 +461,8 @@
|
|
|
447
461
|
--palette-palm-lcd-warning: #4a3500;
|
|
448
462
|
--palette-palm-lcd-danger: #5c2c16;
|
|
449
463
|
--palette-palm-lcd-info: #203b5c;
|
|
464
|
+
--palette-palm-lcd-done: #14444a; /* 6.77 / 6.16 */
|
|
465
|
+
--palette-palm-lcd-ended: #5a2340; /* 7.57 / 6.89 */
|
|
450
466
|
--palette-palm-lcd-category-1: oklch(0.532 0.243 264); /* blue */
|
|
451
467
|
--palette-palm-lcd-category-2: oklch(0.299 0.101 38); /* orange */
|
|
452
468
|
--palette-palm-lcd-category-3: oklch(0.392 0.089 160); /* green */
|
|
@@ -642,6 +658,10 @@
|
|
|
642
658
|
--success-text: var(--green-800);
|
|
643
659
|
--warning-text: var(--amber-800);
|
|
644
660
|
--info-text: var(--blue-800);
|
|
661
|
+
/* The status kinds that have stopped (4.110): done and ended, for
|
|
662
|
+
StatusMark's icon and word (lib/status-kinds.ts). */
|
|
663
|
+
--status-done-text: var(--teal-800);
|
|
664
|
+
--status-ended-text: var(--rose-700);
|
|
645
665
|
/* A link in written text: coloured as well as underlined, so it reads
|
|
646
666
|
as a link at a glance (on white: 5.59). */
|
|
647
667
|
--link: var(--blue-700);
|
|
@@ -960,6 +980,8 @@
|
|
|
960
980
|
--success-text: var(--green-400);
|
|
961
981
|
--warning-text: var(--amber-400);
|
|
962
982
|
--info-text: var(--blue-400);
|
|
983
|
+
--status-done-text: var(--teal-400);
|
|
984
|
+
--status-ended-text: var(--rose-400);
|
|
963
985
|
--link: var(--blue-400); /* on near-black: 8.90 */
|
|
964
986
|
--primary-text: var(--primary); /* near-white on near-black */
|
|
965
987
|
/* Highlighted words: deep washes, --foreground on each measures 7 or more. */
|
|
@@ -1186,6 +1208,8 @@
|
|
|
1186
1208
|
--destructive-text: var(--palette-danger);
|
|
1187
1209
|
--success-text: var(--palette-success);
|
|
1188
1210
|
--warning-text: var(--palette-warning);
|
|
1211
|
+
--status-done-text: var(--palette-done);
|
|
1212
|
+
--status-ended-text: var(--palette-ended);
|
|
1189
1213
|
--link: var(--palette-indigo-cyan-accent-light);
|
|
1190
1214
|
--primary-text: var(--palette-indigo-cyan-accent-light);
|
|
1191
1215
|
--heading-bar: var(--palette-indigo-cyan-accent-light);
|
|
@@ -1228,6 +1252,8 @@
|
|
|
1228
1252
|
--destructive-text: var(--palette-danger);
|
|
1229
1253
|
--success-text: var(--palette-success);
|
|
1230
1254
|
--warning-text: var(--palette-warning);
|
|
1255
|
+
--status-done-text: var(--palette-done);
|
|
1256
|
+
--status-ended-text: var(--palette-ended);
|
|
1231
1257
|
--link: var(--palette-indigo-rose-accent-light);
|
|
1232
1258
|
--primary-text: var(--palette-indigo-rose-accent-light);
|
|
1233
1259
|
--heading-bar: var(--palette-indigo-rose-accent-light);
|
|
@@ -1270,6 +1296,8 @@
|
|
|
1270
1296
|
--destructive-text: var(--palette-danger);
|
|
1271
1297
|
--success-text: var(--palette-success);
|
|
1272
1298
|
--warning-text: var(--palette-warning);
|
|
1299
|
+
--status-done-text: var(--palette-done);
|
|
1300
|
+
--status-ended-text: var(--palette-ended);
|
|
1273
1301
|
--link: var(--palette-graphite-periwinkle-accent-light);
|
|
1274
1302
|
--primary-text: var(--palette-graphite-periwinkle-accent-light);
|
|
1275
1303
|
--heading-bar: var(--palette-graphite-periwinkle-accent-light);
|
|
@@ -1312,6 +1340,8 @@
|
|
|
1312
1340
|
--destructive-text: var(--palette-danger);
|
|
1313
1341
|
--success-text: var(--palette-success);
|
|
1314
1342
|
--warning-text: var(--palette-warning);
|
|
1343
|
+
--status-done-text: var(--palette-done);
|
|
1344
|
+
--status-ended-text: var(--palette-ended);
|
|
1315
1345
|
--link: var(--palette-violet-accent-light);
|
|
1316
1346
|
--primary-text: var(--palette-violet-accent-light);
|
|
1317
1347
|
--heading-bar: var(--palette-violet-accent-light);
|
|
@@ -1367,6 +1397,8 @@
|
|
|
1367
1397
|
--success-text: var(--palette-palm-lcd-success);
|
|
1368
1398
|
--warning-text: var(--palette-palm-lcd-warning);
|
|
1369
1399
|
--info-text: var(--palette-palm-lcd-info);
|
|
1400
|
+
--status-done-text: var(--palette-palm-lcd-done);
|
|
1401
|
+
--status-ended-text: var(--palette-palm-lcd-ended);
|
|
1370
1402
|
--link: var(--palette-palm-lcd-link);
|
|
1371
1403
|
--primary-text: var(--palette-palm-lcd-accent);
|
|
1372
1404
|
--heading-bar: var(--palette-palm-lcd-link);
|