@tristan2828/ui-foundation 4.109.0 → 4.110.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 +46 -36
- 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 +7 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -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–1698
|
|
37
|
+
- [Picking at random](#picking-at-random) · lines 1700–1731
|
|
38
|
+
- [Filling in what's missing](#filling-in-whats-missing) · lines 1733–1800
|
|
39
|
+
- [Values edited in place: the presets' looks](#values-edited-in-place-the-presets-looks) · lines 1802–1827
|
|
40
|
+
- [The sidebar and the phone's bar](#the-sidebar-and-the-phones-bar) · lines 1829–1918
|
|
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 `bg-primary` line, 3px on a record's, 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
|
|
@@ -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,13 @@ 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:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent", "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's name and its line in the theme colour (4.110), the name in
|
|
26
|
+
// --primary-text where the primary is too faint for small text. A
|
|
27
|
+
// closed one is muted, as a record's are. (A closed pill is the text
|
|
28
|
+
// at 75%: shadcn's 60% measured 3.45 on Palm LCD's raised surface.)
|
|
29
|
+
"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: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", className), ...props }));
|
|
24
30
|
}
|
|
25
31
|
function TabsContent({ className, ...props }) {
|
|
26
32
|
return (_jsx(TabsPrimitive.Panel, { "data-slot": "tabs-content", className: cn("flex-1 text-sm outline-none", className), ...props }));
|
package/dist/index.d.ts
CHANGED
|
@@ -70,6 +70,8 @@ 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 { DATE_FILTER_PRESETS, DATE_FILTER_PRESET_LABELS, dateFilterKeeps, dateFilterText, dateRangeValue, parseDateFilter, resolveDateFilter, type DateFilter, type DateFilterBounds, type DateFilterPreset, } from './lib/date-filter.js';
|
|
73
75
|
export { SessionStage, SessionView, sessionStageLit, sessionStageMain, sessionStageQuiet, type SessionStageProps, type SessionStageTone, type SessionViewProps, } from './components/app/session-view.js';
|
|
74
76
|
export { AllowReminders, type AllowRemindersProps } from './components/app/allow-reminders.js';
|
|
75
77
|
export { StageCircle, type StageCircleProps, type StageCircleStage, type StageCircleTone, } from './components/app/stage-circle.js';
|
package/dist/index.js
CHANGED
|
@@ -76,6 +76,8 @@ 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 { DATE_FILTER_PRESETS, DATE_FILTER_PRESET_LABELS, dateFilterKeeps, dateFilterText, dateRangeValue, parseDateFilter, resolveDateFilter, } from './lib/date-filter.js';
|
|
79
81
|
export { SessionStage, SessionView, sessionStageLit, sessionStageMain, sessionStageQuiet, } from './components/app/session-view.js';
|
|
80
82
|
export { AllowReminders } from './components/app/allow-reminders.js';
|
|
81
83
|
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.110.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);
|