@tristan2828/ui-foundation 4.112.0 → 4.113.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.
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
- [Picking at random](#picking-at-random) · lines 1713–1744
|
|
38
38
|
- [Filling in what's missing](#filling-in-whats-missing) · lines 1746–1813
|
|
39
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–
|
|
40
|
+
- [The sidebar and the phone's bar](#the-sidebar-and-the-phones-bar) · lines 1842–1938
|
|
41
41
|
|
|
42
42
|
<!-- /index -->
|
|
43
43
|
|
|
@@ -1874,8 +1874,15 @@ const bottomBar: BottomBarItem[] = [
|
|
|
1874
1874
|
- **Counts** (`count`, `countLabel`): a plain number at the entry's end
|
|
1875
1875
|
in the muted text tone, never a coloured badge; on the icon rail a dot
|
|
1876
1876
|
in `--primary` on the icon. Only on entries that ask you to act
|
|
1877
|
-
(unread, to fill in, new); 0 shows nothing
|
|
1878
|
-
|
|
1877
|
+
(unread, to fill in, new); 0 shows nothing, nor does a count still
|
|
1878
|
+
loading, and past 99 it reads "99+". `countLabel` is what the number
|
|
1879
|
+
counts, read after the entry's name ("News 24 unread"). On a phone
|
|
1880
|
+
(4.113) the bottom bar has no room at an item's end, so its count is
|
|
1881
|
+
a small `--primary` badge on the item's icon, ringed in the bar's
|
|
1882
|
+
background: a page's own count, or a section's sum of its entries'
|
|
1883
|
+
(with their `countLabel` when they share one). The sheet's tiles carry
|
|
1884
|
+
theirs in the corner and its list links at their end, as the sidebar
|
|
1885
|
+
does. Each is read after its name ("News, 7 new").
|
|
1879
1886
|
- **A section at the foot** (`placement: 'bottom'`): under every other
|
|
1880
1887
|
section and `sidebarExtra`, pushed to the sidebar's foot when there's
|
|
1881
1888
|
room; for tools rather than modules.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
// AppShell's bottom bar on a phone (#240): Home and a few of the nav's
|
|
3
3
|
// sections in thumb reach, where the sidebar is a sheet behind the
|
|
4
4
|
// header's menu button. An item is a link, or a nav section by its label,
|
|
@@ -7,16 +7,20 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
7
7
|
// `sheet: 'tiles'` a grid of the entries as tiles, icon over label, like
|
|
8
8
|
// a phone's home screen. The sheet closes on navigation, as the
|
|
9
9
|
// sidebar's does. The item holding the current page is marked
|
|
10
|
-
// (`aria-current`).
|
|
10
|
+
// (`aria-current`). An entry's `count` shows on the phone as it does in
|
|
11
|
+
// the sidebar: a badge on a bar item's icon (a page's own, or the sum of a
|
|
12
|
+
// section's), in a tile's corner, at a sheet link's end; nothing at 0 or
|
|
13
|
+
// while loading, "99+" past 99, and read after the label ("News, 7 new").
|
|
14
|
+
// Shown below the md breakpoint only (the sidebar's own
|
|
11
15
|
// mobile breakpoint); the shell pads its content by the bar's height and
|
|
12
16
|
// the phone's safe area, so a page's last row clears it.
|
|
13
17
|
import { useId, useState } from 'react';
|
|
14
18
|
import { Link, useLocation } from 'react-router';
|
|
15
|
-
import { bottomBarCurrent, bottomBarSection, bottomBarTiles, childItems, childRuns, childrenOpen, isNavItemGroup, } from './app-shell-nav.js';
|
|
19
|
+
import { bottomBarCount, bottomBarCurrent, bottomBarSection, bottomBarTiles, childItems, childRuns, childrenOpen, isNavItemGroup, navCountSpoken, navCountText, } from './app-shell-nav.js';
|
|
16
20
|
import { Sheet, SheetContent, SheetHeader, SheetTitle } from '../ui/sheet.js';
|
|
17
21
|
const ITEM_CLASS = 'flex min-w-0 flex-1 flex-col items-center justify-center gap-0.5 rounded-md px-1 type-caption text-muted-foreground ' +
|
|
18
22
|
'outline-none focus-visible:ring-3 focus-visible:ring-ring/50 aria-[current]:text-foreground aria-[current]:font-medium ' +
|
|
19
|
-
'[
|
|
23
|
+
'[&_svg]:size-5 [&_svg]:shrink-0';
|
|
20
24
|
const SHEET_LINK_CLASS = 'flex min-h-11 items-center gap-3 rounded-md px-3 type-body text-foreground outline-none ' +
|
|
21
25
|
'hover:bg-accent focus-visible:ring-3 focus-visible:ring-ring/50 aria-[current=page]:bg-accent aria-[current=page]:font-medium ' +
|
|
22
26
|
'[&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-muted-foreground';
|
|
@@ -25,13 +29,39 @@ const SHEET_LINK_CLASS = 'flex min-h-11 items-center gap-3 rounded-md px-3 type-
|
|
|
25
29
|
* plus the bar (4rem and its 1px border) and the phone's safe area.
|
|
26
30
|
*/
|
|
27
31
|
export const BOTTOM_BAR_PADDING = 'max-md:pb-[calc(--spacing(22)+1px+env(safe-area-inset-bottom))]';
|
|
32
|
+
// A link's label, and with a count its name: "News, 7 new". The name is
|
|
33
|
+
// one hidden text, the drawn label and count aria-hidden, so it reads
|
|
34
|
+
// exactly that (a hidden span beside the label would add a space before
|
|
35
|
+
// the comma).
|
|
36
|
+
function CountedLabel({ label, count, countLabel, className, }) {
|
|
37
|
+
const spoken = navCountSpoken(count, countLabel);
|
|
38
|
+
if (spoken === undefined)
|
|
39
|
+
return _jsx("span", { className: className, children: label });
|
|
40
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": "true", className: className, children: label }), _jsx("span", { className: "sr-only", children: `${label}, ${spoken}` })] }));
|
|
41
|
+
}
|
|
42
|
+
// A tile's count in its corner, as the sidebar's tiles have it.
|
|
43
|
+
// Its link's name reads it (CountedLabel).
|
|
44
|
+
function TileCount({ count }) {
|
|
45
|
+
const text = navCountText(count);
|
|
46
|
+
if (text === undefined)
|
|
47
|
+
return null;
|
|
48
|
+
return (_jsx("span", { "aria-hidden": "true", "data-slot": "nav-count", className: "absolute top-1 right-1.5 type-caption leading-none text-foreground tabular-nums", children: text }));
|
|
49
|
+
}
|
|
50
|
+
// A bar item's icon, with its count as a badge on its corner: the
|
|
51
|
+
// primary's fill, ringed in the bar's background so it stands off the
|
|
52
|
+
// icon. Sized in em, so it grows with the type at large density.
|
|
53
|
+
function BarIcon({ icon: Icon, count }) {
|
|
54
|
+
const text = navCountText(count);
|
|
55
|
+
return (_jsxs("span", { className: "relative inline-flex", children: [_jsx(Icon, { "aria-hidden": "true" }), text !== undefined && (_jsx("span", { "aria-hidden": "true", "data-slot": "bottom-bar-count", className: "absolute -top-1.5 left-[calc(100%-0.5rem)] inline-flex h-[1.5em] min-w-[1.5em] items-center justify-center rounded-full bg-primary px-[0.35em] type-caption leading-none font-medium text-primary-foreground tabular-nums ring-2 ring-background", children: text }))] }));
|
|
56
|
+
}
|
|
28
57
|
// A tile: the entry's icon over its label, a finger's target at least.
|
|
29
|
-
const TILE_CLASS = 'flex min-h-11 min-w-0 flex-col items-center justify-center gap-1 rounded-lg border border-border bg-background px-1.5 py-2.5 ' +
|
|
58
|
+
const TILE_CLASS = 'relative flex min-h-11 min-w-0 flex-col items-center justify-center gap-1 rounded-lg border border-border bg-background px-1.5 py-2.5 ' +
|
|
30
59
|
'text-center type-caption text-foreground outline-none hover:bg-accent focus-visible:ring-3 focus-visible:ring-ring/50 ' +
|
|
31
60
|
'aria-[current]:border-primary aria-[current]:font-medium [&>svg]:size-5 [&>svg]:shrink-0 [&>svg]:text-link';
|
|
32
61
|
function SheetLink({ item, activeTo }) {
|
|
33
|
-
const { to, label, icon: Icon, children } = item;
|
|
34
|
-
|
|
62
|
+
const { to, label, icon: Icon, children, count, countLabel } = item;
|
|
63
|
+
const text = navCountText(count);
|
|
64
|
+
return (_jsxs("li", { children: [_jsxs(Link, { to: to, "aria-current": to === activeTo ? 'page' : undefined, className: SHEET_LINK_CLASS, children: [_jsx(Icon, {}), _jsx(CountedLabel, { label: label, count: count, countLabel: countLabel, className: "truncate" }), text !== undefined && (_jsx("span", { "aria-hidden": "true", "data-slot": "nav-count", className: "ml-auto shrink-0 type-caption text-muted-foreground tabular-nums", children: text }))] }), children && children.length > 0 && (_jsx("div", { className: "ml-5 border-l border-border pl-2", children: _jsx(SheetChildren, { items: children, activeTo: activeTo }) }))] }));
|
|
35
65
|
}
|
|
36
66
|
function SheetGroup({ label, items, activeTo }) {
|
|
37
67
|
const headingId = useId();
|
|
@@ -42,7 +72,7 @@ function SheetChildren({ items, activeTo }) {
|
|
|
42
72
|
}
|
|
43
73
|
// A page tile, under a tiles section's tiles: smaller, four to a row,
|
|
44
74
|
// still a finger's target.
|
|
45
|
-
const PAGE_TILE_CLASS = 'flex min-h-11 min-w-0 flex-1 flex-col items-center justify-center gap-0.5 rounded-md px-1 py-1.5 text-center type-caption ' +
|
|
75
|
+
const PAGE_TILE_CLASS = 'relative flex min-h-11 min-w-0 flex-1 flex-col items-center justify-center gap-0.5 rounded-md px-1 py-1.5 text-center type-caption ' +
|
|
46
76
|
'text-foreground outline-none hover:bg-accent focus-visible:ring-3 focus-visible:ring-ring/50 ' +
|
|
47
77
|
'aria-[current=page]:bg-accent aria-[current=page]:font-medium [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-muted-foreground';
|
|
48
78
|
// The current entry's pages under a tiles section's tiles (#6C): a
|
|
@@ -50,7 +80,7 @@ const PAGE_TILE_CLASS = 'flex min-h-11 min-w-0 flex-1 flex-col items-center just
|
|
|
50
80
|
// own with its list still named by it.
|
|
51
81
|
function SheetPageTiles({ items, activeTo }) {
|
|
52
82
|
const open = items.filter((item) => childrenOpen(item, activeTo));
|
|
53
|
-
return open.map((item) => (_jsx("div", { role: "group", "aria-label": `${item.label} pages`, "data-slot": "app-shell-sheet-pages", className: "flex flex-col", children: childRuns(item).map((run, runIndex) => (_jsxs("div", { className: "flex flex-col", children: [_jsx("div", { role: "separator", className: "my-2 h-px bg-border" }), _jsx("ul", { "aria-label": run.label, className: "grid grid-cols-4 gap-1.5", children: run.items.map(({ to, label, icon: Icon }) => (_jsx("li", { className: "flex min-w-0", children: _jsxs(Link, { to: to, "aria-current": to === activeTo ? 'page' : undefined, className: PAGE_TILE_CLASS, children: [_jsx(Icon, { "aria-hidden": "true" }), _jsx(
|
|
83
|
+
return open.map((item) => (_jsx("div", { role: "group", "aria-label": `${item.label} pages`, "data-slot": "app-shell-sheet-pages", className: "flex flex-col", children: childRuns(item).map((run, runIndex) => (_jsxs("div", { className: "flex flex-col", children: [_jsx("div", { role: "separator", className: "my-2 h-px bg-border" }), _jsx("ul", { "aria-label": run.label, className: "grid grid-cols-4 gap-1.5", children: run.items.map(({ to, label, icon: Icon, count, countLabel }) => (_jsx("li", { className: "flex min-w-0", children: _jsxs(Link, { to: to, "aria-current": to === activeTo ? 'page' : undefined, className: PAGE_TILE_CLASS, children: [_jsx(Icon, { "aria-hidden": "true" }), _jsx(CountedLabel, { label: label, count: count, countLabel: countLabel, className: "max-w-full break-words" }), _jsx(TileCount, { count: count })] }) }, to))) })] }, run.label ?? `run:${runIndex}`))) }, item.to)));
|
|
54
84
|
}
|
|
55
85
|
// The tiles (#N8): one per entry. Its pages are left to the module itself,
|
|
56
86
|
// unless the section's look is tiles (#6C): then the current entry's are
|
|
@@ -58,10 +88,10 @@ function SheetPageTiles({ items, activeTo }) {
|
|
|
58
88
|
// its pages, is marked.
|
|
59
89
|
function SheetTiles({ items, activeTo, withPages, }) {
|
|
60
90
|
return (_jsxs(_Fragment, { children: [_jsx("ul", { "data-slot": "app-shell-sheet-tiles", className: "grid grid-cols-3 gap-2", children: items.map((item) => {
|
|
61
|
-
const { to, label, icon: Icon } = item;
|
|
91
|
+
const { to, label, icon: Icon, count, countLabel } = item;
|
|
62
92
|
// "page" on the module's own page, "true" on one of its pages.
|
|
63
93
|
const current = to === activeTo ? 'page' : childItems(item).some((child) => child.to === activeTo) ? 'true' : undefined;
|
|
64
|
-
return (_jsx("li", { className: "flex min-w-0", children: _jsxs(Link, { to: to, "aria-current": current, className: `${TILE_CLASS} flex-1`, children: [_jsx(Icon, { "aria-hidden": "true" }), _jsx(
|
|
94
|
+
return (_jsx("li", { className: "flex min-w-0", children: _jsxs(Link, { to: to, "aria-current": current, className: `${TILE_CLASS} flex-1`, children: [_jsx(Icon, { "aria-hidden": "true" }), _jsx(CountedLabel, { label: label, count: count, countLabel: countLabel, className: "max-w-full break-words" }), _jsx(TileCount, { count: count })] }) }, to));
|
|
65
95
|
}) }), withPages && _jsx(SheetPageTiles, { items: items, activeTo: activeTo })] }));
|
|
66
96
|
}
|
|
67
97
|
export function BottomBar({ items, nav, activeTo, navLook = 'list', }) {
|
|
@@ -80,12 +110,12 @@ export function BottomBar({ items, nav, activeTo, navLook = 'list', }) {
|
|
|
80
110
|
// The current entry's pages show under the tiles when the section's own look is tiles.
|
|
81
111
|
const withPages = (section?.look ?? navLook) === 'tiles';
|
|
82
112
|
return (_jsxs(_Fragment, { children: [_jsx("nav", { "aria-label": "Bottom bar", "data-slot": "app-shell-bottom-bar", className: "fixed inset-x-0 bottom-0 z-20 border-t border-border bg-background pb-[env(safe-area-inset-bottom)] md:hidden", children: _jsx("ul", { className: "flex h-16 items-stretch gap-1 px-2 py-1.5", children: shown.map((item, index) => {
|
|
83
|
-
const Icon = item.icon;
|
|
84
113
|
const isCurrent = index === current;
|
|
114
|
+
const { count, countLabel } = bottomBarCount(item, nav);
|
|
85
115
|
if ('to' in item) {
|
|
86
|
-
return (_jsx("li", { className: "flex min-w-0 flex-1", children: _jsxs(Link, { to: item.to, "aria-current": isCurrent ? 'page' : undefined, className: ITEM_CLASS, children: [_jsx(
|
|
116
|
+
return (_jsx("li", { className: "flex min-w-0 flex-1", children: _jsxs(Link, { to: item.to, "aria-current": isCurrent ? 'page' : undefined, className: ITEM_CLASS, children: [_jsx(BarIcon, { icon: item.icon, count: count }), _jsx(CountedLabel, { label: item.label, count: count, countLabel: countLabel, className: "max-w-full truncate" })] }) }, `to:${item.to}`));
|
|
87
117
|
}
|
|
88
118
|
const label = item.label ?? item.group;
|
|
89
|
-
return (_jsx("li", { className: "flex min-w-0 flex-1", children: _jsxs("button", { type: "button", "aria-haspopup": "dialog", "aria-expanded": openGroup === item.group, "aria-current": isCurrent ? 'true' : undefined, onClick: () => setOpenGroup(item.group), className: ITEM_CLASS, children: [_jsx(
|
|
119
|
+
return (_jsx("li", { className: "flex min-w-0 flex-1", children: _jsxs("button", { type: "button", "aria-haspopup": "dialog", "aria-expanded": openGroup === item.group, "aria-current": isCurrent ? 'true' : undefined, onClick: () => setOpenGroup(item.group), className: ITEM_CLASS, children: [_jsx(BarIcon, { icon: item.icon, count: count }), _jsx(CountedLabel, { label: label, count: count, countLabel: countLabel, className: "max-w-full truncate" })] }) }, `group:${item.group}`));
|
|
90
120
|
}) }) }), _jsx(Sheet, { open: section !== undefined, onOpenChange: (open) => !open && setOpenGroup(null), children: _jsx(SheetContent, { side: "bottom", className: "max-h-[80dvh] gap-2 pb-[calc(--spacing(4)+env(safe-area-inset-bottom))] md:hidden", children: section && (_jsxs(_Fragment, { children: [_jsx(SheetHeader, { className: "pb-0", children: _jsx(SheetTitle, { children: section.label }) }), _jsx("nav", { "aria-label": section.label, className: "overflow-y-auto px-2", children: tiles ? (_jsx(SheetTiles, { items: section.items, activeTo: activeTo, withPages: withPages })) : (_jsx(SheetChildren, { items: section.items, activeTo: activeTo })) })] })) }) })] }));
|
|
91
121
|
}
|
|
@@ -220,3 +220,23 @@ export declare function bottomBarSection(nav: readonly NavEntry[], label: string
|
|
|
220
220
|
* the page's own link, or else the section it's in, children included.
|
|
221
221
|
*/
|
|
222
222
|
export declare function bottomBarCurrent(items: readonly BottomBarItem[], nav: readonly NavEntry[], activeTo: string | undefined): number | undefined;
|
|
223
|
+
/**
|
|
224
|
+
* A count as drawn: nothing at 0, below it or while it's loading (no
|
|
225
|
+
* count yet), and "99+" past 99, so a badge keeps its size.
|
|
226
|
+
*/
|
|
227
|
+
export declare function navCountText(count: number | undefined): string | undefined;
|
|
228
|
+
/**
|
|
229
|
+
* A count as read, after its entry's label: "7 new" with its
|
|
230
|
+
* `countLabel`, the number alone without. The real number, past 99 too.
|
|
231
|
+
* Nothing where nothing is drawn.
|
|
232
|
+
*/
|
|
233
|
+
export declare function navCountSpoken(count: number | undefined, countLabel?: string): string | undefined;
|
|
234
|
+
/**
|
|
235
|
+
* A bottom bar item's count: a page's, from its nav entry, or a
|
|
236
|
+
* section's, the sum of its entries' and their pages'. A section's
|
|
237
|
+
* `countLabel` is its entries' when they share one, and none otherwise.
|
|
238
|
+
*/
|
|
239
|
+
export declare function bottomBarCount(item: BottomBarItem, nav: readonly NavEntry[]): {
|
|
240
|
+
count?: number;
|
|
241
|
+
countLabel?: string;
|
|
242
|
+
};
|
|
@@ -215,3 +215,41 @@ export function bottomBarCurrent(items, nav, activeTo) {
|
|
|
215
215
|
const group = items.findIndex((item) => 'group' in item && withChildren(bottomBarSection(nav, item.group)?.items ?? []).some((entry) => entry.to === activeTo));
|
|
216
216
|
return group === -1 ? undefined : group;
|
|
217
217
|
}
|
|
218
|
+
/**
|
|
219
|
+
* A count as drawn: nothing at 0, below it or while it's loading (no
|
|
220
|
+
* count yet), and "99+" past 99, so a badge keeps its size.
|
|
221
|
+
*/
|
|
222
|
+
export function navCountText(count) {
|
|
223
|
+
if (count === undefined || !Number.isFinite(count) || count <= 0)
|
|
224
|
+
return undefined;
|
|
225
|
+
return count > 99 ? '99+' : String(Math.floor(count));
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* A count as read, after its entry's label: "7 new" with its
|
|
229
|
+
* `countLabel`, the number alone without. The real number, past 99 too.
|
|
230
|
+
* Nothing where nothing is drawn.
|
|
231
|
+
*/
|
|
232
|
+
export function navCountSpoken(count, countLabel) {
|
|
233
|
+
if (navCountText(count) === undefined)
|
|
234
|
+
return undefined;
|
|
235
|
+
const n = Math.floor(count);
|
|
236
|
+
return countLabel ? `${n} ${countLabel}` : String(n);
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* A bottom bar item's count: a page's, from its nav entry, or a
|
|
240
|
+
* section's, the sum of its entries' and their pages'. A section's
|
|
241
|
+
* `countLabel` is its entries' when they share one, and none otherwise.
|
|
242
|
+
*/
|
|
243
|
+
export function bottomBarCount(item, nav) {
|
|
244
|
+
if ('to' in item) {
|
|
245
|
+
const entry = navItems(nav).find((other) => other.to === item.to);
|
|
246
|
+
return entry ? { count: entry.count, countLabel: entry.countLabel } : {};
|
|
247
|
+
}
|
|
248
|
+
const counted = withChildren(bottomBarSection(nav, item.group)?.items ?? []).filter((entry) => navCountText(entry.count) !== undefined);
|
|
249
|
+
if (!counted.length)
|
|
250
|
+
return {};
|
|
251
|
+
const count = counted.reduce((sum, entry) => sum + Math.floor(entry.count), 0);
|
|
252
|
+
const labels = new Set(counted.map((entry) => entry.countLabel));
|
|
253
|
+
const [only] = labels;
|
|
254
|
+
return { count, countLabel: labels.size === 1 ? only : undefined };
|
|
255
|
+
}
|
|
@@ -5,7 +5,7 @@ import { useCallback, useEffect, useId, useMemo, useState } from 'react';
|
|
|
5
5
|
import { Link, Navigate, Outlet, useLocation } from 'react-router';
|
|
6
6
|
import { useAuth } from '../../auth/use-auth.js';
|
|
7
7
|
import { BottomBar, BOTTOM_BAR_PADDING } from './app-shell-bottom-bar.js';
|
|
8
|
-
import { activeNavTo, childItems, childRuns, childrenOpen, isNavItemGroup, navGroups, navPageLabel, navTooltip, navTrail, trailBackTarget, withChildren, } from './app-shell-nav.js';
|
|
8
|
+
import { activeNavTo, childItems, childRuns, childrenOpen, isNavItemGroup, navCountSpoken, navCountText, navGroups, navPageLabel, navTooltip, navTrail, trailBackTarget, withChildren, } from './app-shell-nav.js';
|
|
9
9
|
import { versionHref, versionLabel } from './app-shell-version.js';
|
|
10
10
|
import { ErrorState } from './error-state.js';
|
|
11
11
|
import { PageTrail } from './page-trail.js';
|
|
@@ -98,9 +98,10 @@ const ACTIVE_MARK = 'data-active:shadow-[inset_3px_0_0_0_var(--primary)]';
|
|
|
98
98
|
// An entry's count (#N3): a plain number at its end in the muted tone,
|
|
99
99
|
// read with what it counts; on the icon rail, a dot on the icon.
|
|
100
100
|
function NavCount({ count, countLabel }) {
|
|
101
|
-
|
|
101
|
+
const text = navCountText(count);
|
|
102
|
+
if (text === undefined)
|
|
102
103
|
return null;
|
|
103
|
-
return (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": "true", "data-slot": "nav-count", className: "ml-auto shrink-0 type-caption text-muted-foreground tabular-nums group-data-[collapsible=icon]:hidden", children:
|
|
104
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": "true", "data-slot": "nav-count", className: "ml-auto shrink-0 type-caption text-muted-foreground tabular-nums group-data-[collapsible=icon]:hidden", children: text }), _jsx("span", { className: "sr-only", children: navCountSpoken(count, countLabel) }), _jsx("span", { "aria-hidden": "true", "data-slot": "nav-count-dot", className: "pointer-events-none absolute top-1 right-1 hidden size-1.5 rounded-full bg-primary group-data-[collapsible=icon]:block" })] }));
|
|
104
105
|
}
|
|
105
106
|
function NavSubLink({ item, activeTo }) {
|
|
106
107
|
const { to, label, icon: Icon, count, countLabel } = item;
|
|
@@ -144,7 +145,7 @@ function NavTile({ item, activeTo }) {
|
|
|
144
145
|
const { to, label, icon: Icon, count, countLabel } = item;
|
|
145
146
|
// "page" on the entry's own page, "true" on one of its pages.
|
|
146
147
|
const current = to === activeTo ? 'page' : childItems(item).some((child) => child.to === activeTo) ? 'true' : undefined;
|
|
147
|
-
return (_jsx("li", { className: "flex min-w-0", children: _jsxs(Link, { to: to, "aria-current": current, "data-slot": "nav-tile", "data-active": current ? '' : undefined, className: NAV_TILE_CLASS, children: [_jsx(Icon, { "aria-hidden": "true" }), _jsx("span", { className: "max-w-full break-words", children: label }), count ? (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": "true", "data-slot": "nav-count", className: "absolute top-1 right-1.5 type-caption leading-none text-sidebar-foreground tabular-nums", children: count }), _jsx("span", { className: "sr-only", children:
|
|
148
|
+
return (_jsx("li", { className: "flex min-w-0", children: _jsxs(Link, { to: to, "aria-current": current, "data-slot": "nav-tile", "data-active": current ? '' : undefined, className: NAV_TILE_CLASS, children: [_jsx(Icon, { "aria-hidden": "true" }), _jsx("span", { className: "max-w-full break-words", children: label }), navCountText(count) !== undefined ? (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": "true", "data-slot": "nav-count", className: "absolute top-1 right-1.5 type-caption leading-none text-sidebar-foreground tabular-nums", children: navCountText(count) }), _jsx("span", { className: "sr-only", children: navCountSpoken(count, countLabel) })] })) : null] }) }));
|
|
148
149
|
}
|
|
149
150
|
// A group in the tiles look (#6C): its entries as a three-column grid,
|
|
150
151
|
// its label for screen readers only (the grid is a list named by it), and
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tristan2828/ui-foundation",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.113.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": {
|