@sincpro/web-ui 2.3.0 → 2.4.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.
Files changed (38) hide show
  1. package/README.md +49 -5
  2. package/dist/components/guide/Guide.d.ts +33 -0
  3. package/dist/components/guide/Guide.js +288 -0
  4. package/dist/components/guide/GuideSpot.d.ts +14 -0
  5. package/dist/components/guide/GuideSpot.js +13 -0
  6. package/dist/components/guide/index.d.ts +4 -0
  7. package/dist/components/guide/index.js +6 -0
  8. package/dist/components/guide/place.d.ts +44 -0
  9. package/dist/components/guide/place.js +69 -0
  10. package/dist/components/guide/target.d.ts +41 -0
  11. package/dist/components/guide/target.js +55 -0
  12. package/dist/components/index.d.ts +1 -0
  13. package/dist/components/index.js +1 -0
  14. package/dist/components/listing/Listing.js +7 -5
  15. package/dist/components/listing/Row.js +8 -7
  16. package/dist/components/navigation/NavigationTree.js +1 -1
  17. package/dist/components/record/DirtyActions.d.ts +9 -7
  18. package/dist/components/record/DirtyActions.js +14 -9
  19. package/dist/components/record/ThumbBar.js +2 -1
  20. package/dist/components/shell/SearchEntry.d.ts +29 -0
  21. package/dist/components/shell/SearchEntry.js +34 -0
  22. package/dist/components/shell/Sidebar.d.ts +5 -1
  23. package/dist/components/shell/Sidebar.js +4 -3
  24. package/dist/components/shell/TopBar.d.ts +5 -1
  25. package/dist/components/shell/TopBar.js +3 -2
  26. package/dist/components/shell/index.d.ts +1 -0
  27. package/dist/components/shell/index.js +3 -0
  28. package/dist/foundations/copy.d.ts +19 -2
  29. package/dist/foundations/copy.es.js +10 -0
  30. package/dist/foundations/copy.js +10 -0
  31. package/dist/foundations/index.d.ts +1 -0
  32. package/dist/foundations/index.js +2 -0
  33. package/dist/foundations/shortcut.d.ts +18 -0
  34. package/dist/foundations/shortcut.js +20 -0
  35. package/dist/primitives/value/Metric.d.ts +5 -1
  36. package/dist/primitives/value/Metric.js +5 -3
  37. package/dist/tokens.css +39 -20
  38. package/package.json +1 -1
@@ -10,6 +10,7 @@ export * from "./flow/index.js";
10
10
  export * from "./form/index.js";
11
11
  export * from "./frame/index.js";
12
12
  export * from "./gantt/index.js";
13
+ export * from "./guide/index.js";
13
14
  export * from "./lines/index.js";
14
15
  export * from "./listing/index.js";
15
16
  export * from "./navigation/index.js";
@@ -42,11 +42,13 @@ import { createPortal } from "react-dom";
42
42
  * ── The row lays itself out; nobody tells it how ────────────────────
43
43
  *
44
44
  * WHICH presentation is the consumer's call. How a row arranges itself inside
45
- * the one that was chosen is nobody's: there is no width at which a row «turns
46
- * narrow», and no breakpoint written anywhere. Every zone asks for what it
47
- * needs —the name `--container-name`, the tags `--container-tags`, the
48
- * metadata what it says— and the line does what a line does: what does not fit
49
- * wraps, and the name keeps the first one.
45
+ * the one that was chosen is the row's, and it is the same for every row: the
46
+ * name, its metadata under it, the tags after the text (`--container-row-text`
47
+ * wide at most). The one thing the width changes — the tags leaving the name's
48
+ * line for one of their own — is a container query on the row's box
49
+ * (`--container-row-split`), so it is decided by the LIST's width, never by
50
+ * how long one row's metadata happens to be. Deciding it per row by wrapping
51
+ * put one meta beside its name and the next one under it, in the same list.
50
52
  *
51
53
  * **That is why it holds up with a checkbox, an icon, actions, no tags, or a
52
54
  * metadata three times longer.** None of that is declared anywhere: they all
@@ -68,12 +68,13 @@ export function Row({ icon: Icon, avatar, name, onOpen, onPeek, click = "peek",
68
68
  just the same by clicking anywhere on the row, not only on the
69
69
  name. With the preview turned off (`PeekLayer.tsx`) this is today the
70
70
  case for everyone: a click on the row opens, plain and simple. */
71
- onClick: click === "open" ? (onOpen ?? onPeek) : (onPeek ?? onOpen), role: "presentation", children: [onSelectedChange === undefined ? null : (_jsx("input", { type: "checkbox", checked: selected ?? false, "aria-label": fillCopy(copy.selection.named, { name }), onChange: (e) => onSelectedChange(e.target.checked), onClick: (e) => e.stopPropagation(), className: "size-3.5 shrink-0 cursor-pointer accent-primary" })), avatar !== undefined ? (_jsx(Avatar, { name: avatar.name, size: "sm", ...(avatar.src === undefined ? {} : { src: avatar.src }) })) : Icon === undefined ? null : (_jsx(Icon, { className: "size-(--size-icon-md) shrink-0 text-muted", strokeWidth: 1.75, "aria-hidden": true })), _jsxs("div", { className: `flex min-w-0 shrink grow basis-(--container-name) flex-wrap items-center gap-y-0 ${byDensity(d, "gap-x-3", "gap-x-2")}`, children: [_jsx("span", { className: "min-w-0 grow basis-(--container-name)", children: _jsx(RecordLink, { ...((onOpen ?? onPeek) === undefined ? {} : { onClick: (onOpen ?? onPeek) }), title: name, children: name }) }), meta === undefined ? null : (
72
- /* Wrapped or not, the metadata is still there —it is what saves
73
- having to open a set to know whether it is a thousand rows or a
74
- million— and it truncates instead of wrapping into itself: three
75
- lines per row in a 480 px drawer means three rows fit on screen. */
76
- _jsx("span", { className: "min-w-0 truncate text-micro tabular-nums text-muted", children: meta })), tags === undefined ? null : (_jsx("span", { className: "ms-auto flex min-w-fit shrink basis-(--container-tags) items-center justify-end gap-1.5", children: tags }))] }), _jsx("span", { className: "flex shrink-0 items-center gap-1 opacity-0 transition-opacity duration-(--duration-instant) group-hover/row:opacity-100 focus-within:opacity-100 pointer-coarse:opacity-100", children: _jsx(Trail, { name: name, openAs: openAs, ...(actions === undefined ? {} : { actions }), copy: copyAs, ...(onPeek === undefined || !openers ? {} : { onPeek }), ...(onOpen === undefined || !openers ? {} : { onOpen }), ...(more === undefined ? {} : { more }), ...(onMoreSelect === undefined ? {} : { onMoreSelect }) }) })] }) }));
71
+ onClick: click === "open" ? (onOpen ?? onPeek) : (onPeek ?? onOpen), role: "presentation", children: [onSelectedChange === undefined ? null : (_jsx("input", { type: "checkbox", checked: selected ?? false, "aria-label": fillCopy(copy.selection.named, { name }), onChange: (e) => onSelectedChange(e.target.checked), onClick: (e) => e.stopPropagation(), className: "size-3.5 shrink-0 cursor-pointer accent-primary" })), avatar !== undefined ? (_jsx(Avatar, { name: avatar.name, size: "sm", ...(avatar.src === undefined ? {} : { src: avatar.src }) })) : Icon === undefined ? null : (_jsx(Icon, { className: "size-(--size-icon-md) shrink-0 text-muted", strokeWidth: 1.75, "aria-hidden": true })), _jsx("div", { className: "@container/row min-w-0 grow", children: _jsxs("div", { className: `flex min-w-0 items-center gap-y-1 @max-row-split/row:flex-wrap ${byDensity(d, "gap-x-3", "gap-x-2")}`, children: [_jsxs("span", { "data-slot": "row-text", className: "flex min-w-0 shrink grow basis-(--container-name) flex-col @row-split/row:max-w-(--container-row-text)", children: [_jsx(RecordLink, { ...((onOpen ?? onPeek) === undefined
72
+ ? {}
73
+ : { onClick: (onOpen ?? onPeek) }), title: name, children: name }), meta === undefined ? null : (
74
+ /* It truncates instead of wrapping into itself: three lines per row in a
75
+ 480 px drawer means three rows fit on screen. In mono figures: under the
76
+ name, row after row, the dates and amounts line up. */
77
+ _jsx("span", { className: "min-w-0 truncate text-micro tabular-nums text-muted", children: meta }))] }), tags === undefined ? null : (_jsx("span", { "data-slot": "row-tags", className: "flex min-w-fit shrink-0 basis-(--container-tags) flex-wrap items-center gap-1.5 @max-row-split/row:basis-full", children: tags }))] }) }), _jsx("span", { className: "flex shrink-0 items-center gap-1 opacity-0 transition-opacity duration-(--duration-instant) group-hover/row:opacity-100 focus-within:opacity-100 pointer-coarse:opacity-100", children: _jsx(Trail, { name: name, openAs: openAs, ...(actions === undefined ? {} : { actions }), copy: copyAs, ...(onPeek === undefined || !openers ? {} : { onPeek }), ...(onOpen === undefined || !openers ? {} : { onOpen }), ...(more === undefined ? {} : { more }), ...(onMoreSelect === undefined ? {} : { onMoreSelect }) }) })] }) }));
77
78
  if (children === undefined)
78
79
  return row;
79
80
  /* What the resource produced, hanging below. The indent reaches up to where
@@ -110,7 +111,7 @@ export function RowHeader({ name, meta, tags, withSelection = false, withIcon =
110
111
  return (_jsxs("div", { "data-slot": "row-header",
111
112
  /* It sticks below the list's bar, like the table's header
112
113
  and the sheet's. See `system/sticky.tsx`. */
113
- className: `sticky z-10 flex min-w-0 items-center border-b border-line-strong bg-ground ${byDensity(d, "gap-3 px-3 py-2", "gap-2 px-2.5 py-1.5")}`, style: stickyTop, role: "presentation", children: [!withSelection ? null : _jsx("span", { className: "size-3.5 shrink-0", "aria-hidden": true }), withAvatar ? (_jsx("span", { className: "size-5 shrink-0", "aria-hidden": true })) : !withIcon ? null : (_jsx("span", { className: "size-(--size-icon-md) shrink-0", "aria-hidden": true })), _jsxs("div", { className: `flex min-w-0 shrink grow basis-(--container-name) flex-wrap items-center gap-y-0 ${byDensity(d, "gap-x-3", "gap-x-2")}`, children: [_jsx("span", { className: `min-w-0 grow basis-(--container-name) ${rotulo}`, children: name }), meta === undefined ? null : _jsx("span", { className: `min-w-0 ${rotulo}`, children: meta }), tags === undefined ? null : (_jsx("span", { className: "ms-auto flex min-w-fit shrink basis-(--container-tags) items-center justify-end", children: _jsx("span", { className: rotulo, children: tags }) }))] }), trail !== undefined ? (_jsx("span", { inert: true, "aria-hidden": true, className: "invisible flex shrink-0 items-center gap-1", children: _jsx(Trail, { name: "", openAs: "", ...(trail.actions === undefined ? {} : { actions: trail.actions }), ...(trail.copy === false ? { copy: false } : {}), ...(trail.peek === true ? { onPeek: () => { } } : {}), ...(trail.open === true ? { onOpen: () => { } } : {}) }) })) : !withActions ? null : (_jsx("span", { className: "size-(--size-control-sm) shrink-0", "aria-hidden": true }))] }));
114
+ className: `sticky z-10 flex min-w-0 items-center border-b border-line-strong bg-ground ${byDensity(d, "gap-3 px-3 py-2", "gap-2 px-2.5 py-1.5")}`, style: stickyTop, role: "presentation", children: [!withSelection ? null : _jsx("span", { className: "size-3.5 shrink-0", "aria-hidden": true }), withAvatar ? (_jsx("span", { className: "size-5 shrink-0", "aria-hidden": true })) : !withIcon ? null : (_jsx("span", { className: "size-(--size-icon-md) shrink-0", "aria-hidden": true })), _jsx("div", { className: "@container/row min-w-0 grow", children: _jsxs("div", { className: `flex min-w-0 items-center gap-y-1 @max-row-split/row:flex-wrap ${byDensity(d, "gap-x-3", "gap-x-2")}`, children: [_jsxs("span", { className: "flex min-w-0 shrink grow basis-(--container-name) flex-col @row-split/row:max-w-(--container-row-text)", children: [_jsx("span", { className: rotulo, children: name }), meta === undefined ? null : _jsx("span", { className: rotulo, children: meta })] }), tags === undefined ? null : (_jsx("span", { className: "flex min-w-fit shrink-0 basis-(--container-tags) items-center @max-row-split/row:basis-full", children: _jsx("span", { className: rotulo, children: tags }) }))] }) }), trail !== undefined ? (_jsx("span", { inert: true, "aria-hidden": true, className: "invisible flex shrink-0 items-center gap-1", children: _jsx(Trail, { name: "", openAs: "", ...(trail.actions === undefined ? {} : { actions: trail.actions }), ...(trail.copy === false ? { copy: false } : {}), ...(trail.peek === true ? { onPeek: () => { } } : {}), ...(trail.open === true ? { onOpen: () => { } } : {}) }) })) : !withActions ? null : (_jsx("span", { className: "size-(--size-control-sm) shrink-0", "aria-hidden": true }))] }));
114
115
  }
115
116
  /**
116
117
  * The header of a group inside a list.
@@ -98,7 +98,7 @@ export function NavigationTree({ items, current, onNavigate, defaultExpanded = [
98
98
  paddingInlineStart: `calc(var(--spacing) * 4 + var(--size-icon-md) + var(--spacing-indent) * ${level - 2})`,
99
99
  }
100
100
  : undefined;
101
- return (_jsxs(AriaNavigationTreeItem, { "data-ui": "navigation.item", id: item.id, textValue: item.label, ...(module ? {} : { href: item.id }), className: ({ isCurrent, isFocusVisible }) => row({ surface, isCurrent, isFocusVisible }), children: [_jsx(NavigationTreeItemContent, { children: ({ isCurrent, isCurrentAncestor, isExpanded }) => (_jsxs(_Fragment, { children: [isCurrent ? _jsx("span", { "aria-hidden": true, className: MARKER[surface] }) : null, _jsxs(Link, { className: link({ isModule: module }), style: indent, children: [Icon === undefined ? null : (_jsx(Icon, { className: `size-(--size-icon-md) shrink-0 ${isCurrent || (isCurrentAncestor && !isExpanded)
101
+ return (_jsxs(AriaNavigationTreeItem, { "data-ui": "navigation.item", "data-key": item.id, id: item.id, textValue: item.label, ...(module ? {} : { href: item.id }), className: ({ isCurrent, isFocusVisible }) => row({ surface, isCurrent, isFocusVisible }), children: [_jsx(NavigationTreeItemContent, { children: ({ isCurrent, isCurrentAncestor, isExpanded }) => (_jsxs(_Fragment, { children: [isCurrent ? _jsx("span", { "aria-hidden": true, className: MARKER[surface] }) : null, _jsxs(Link, { className: link({ isModule: module }), style: indent, children: [Icon === undefined ? null : (_jsx(Icon, { className: `size-(--size-icon-md) shrink-0 ${isCurrent || (isCurrentAncestor && !isExpanded)
102
102
  ? HERE[surface].here
103
103
  : HERE[surface].rest}`, strokeWidth: 2, "aria-hidden": true })), _jsx("span", { className: `min-w-0 flex-1 truncate ${isCurrentAncestor && !isExpanded ? HERE[surface].here : ""}`, children: item.label }), item.count === undefined ? null : (_jsx(Count, { value: item.count, current: isCurrent }))] }), module ? (_jsx(AriaButton, { slot: "chevron", className: ({ isFocusVisible }) => chevronButton({ surface, isFocusVisible }), children: _jsx(ChevronRight, { className: `size-(--size-icon-sm) transition-transform duration-(--duration-quick) ease-(--ease-out) ${isExpanded ? "rotate-90" : ""}`, strokeWidth: 2, "aria-hidden": true }) })) : null] })) }), children.map((child) => render(child, level + 1))] }, item.id));
104
104
  };
@@ -8,11 +8,11 @@ export interface DirtyState {
8
8
  * regla». */
9
9
  label?: string;
10
10
  /** Why it CANNOT be saved yet. Present = the button is off and the reason is written
11
- * where the «unsaved» mark was — a button that is off with no reason is a wall, and a
12
- * reason in a `title` reaches neither the keyboard nor a finger. */
11
+ * beside it — a button that is off with no reason is a wall, and a reason in a `title`
12
+ * reaches neither the keyboard nor a finger. It is the only mark the rail draws. */
13
13
  blocked?: string;
14
- /** How many fields changed: «2 cambios sin guardar» instead of a bare «sin guardar». The
15
- * fields themselves are marked by their `Field changed`. */
14
+ /** How many fields changed. Not drawn: it describes the Save button, «Guardar — 2 cambios
15
+ * sin guardar», for whoever cannot see the fields' own `Field changed` marks. */
16
16
  changes?: number;
17
17
  }
18
18
  /** Save and discard, in the rail and in place of the action buttons.
@@ -21,9 +21,11 @@ export interface DirtyState {
21
21
  * the same rule as `FormActions`, and here it matters more: the rail is where
22
22
  * the hand is after editing.
23
23
  *
24
- * The «sin guardar» warning is text and not just a color: whoever is leaving
25
- * the screen has to be able to read what is going on, not deduce it from a
26
- * dot. */
24
+ * There is no «sin guardar» mark. The two buttons only exist while something changed, and
25
+ * each changed field already says so (`Field changed`): a third signal repeating the other
26
+ * two was noise beside the one action that matters. The only thing written here is what
27
+ * the buttons cannot say — WHY it cannot be saved yet (`blocked`). The count of changes
28
+ * still reaches a screen reader, as the Save button's description. */
27
29
  export declare function DirtyActions({ onSave, onDiscard, saving, label, blocked, changes, }: DirtyState): import("react").JSX.Element;
28
30
  /**
29
31
  * Whether the record has JUST been saved: `dirty` went from saving straight to gone.
@@ -11,21 +11,26 @@ import { useEffect, useId, useRef, useState } from "react";
11
11
  * the same rule as `FormActions`, and here it matters more: the rail is where
12
12
  * the hand is after editing.
13
13
  *
14
- * The «sin guardar» warning is text and not just a color: whoever is leaving
15
- * the screen has to be able to read what is going on, not deduce it from a
16
- * dot. */
14
+ * There is no «sin guardar» mark. The two buttons only exist while something changed, and
15
+ * each changed field already says so (`Field changed`): a third signal repeating the other
16
+ * two was noise beside the one action that matters. The only thing written here is what
17
+ * the buttons cannot say — WHY it cannot be saved yet (`blocked`). The count of changes
18
+ * still reaches a screen reader, as the Save button's description. */
17
19
  export function DirtyActions({ onSave, onDiscard, saving = false, label, blocked, changes, }) {
18
20
  const copy = useUiCopy();
19
21
  const blockedId = useId();
22
+ const changesId = useId();
20
23
  /* It follows the rail it sits on instead of assuming the dark one: on a light rail the
21
24
  chrome palette was white text on white. */
22
25
  const surface = useSurface();
23
- return (_jsxs(_Fragment, { children: [_jsx("span", { ...(blocked === undefined ? {} : { id: blockedId }), className: `inline-flex h-(--size-control-md) min-w-0 shrink items-center gap-1.5 truncate rounded-control px-2.5 text-meta font-medium ${bySurface(surface, "bg-warn/12 text-warn", "bg-chrome-warn/15 text-chrome-warn")}`, children: blocked ??
24
- (changes === undefined || changes === 0
25
- ? copy.record.unsaved
26
- : fillCopy(changes === 1 ? copy.record.unsavedOne : copy.record.unsavedMany, {
27
- count: changes.toLocaleString(copy.locale),
28
- })) }), _jsx(Button, { surface: surface, onClick: onDiscard, disabled: saving, icon: Undo2, children: copy.record.discard }), _jsx(Button, { role: "primary", surface: surface, onClick: onSave, busy: saving, disabled: blocked !== undefined, icon: Save, ...(blocked === undefined ? {} : { "aria-describedby": blockedId }), children: saving ? copy.record.saving : (label ?? copy.record.save) })] }));
26
+ const counted = changes !== undefined && changes > 0;
27
+ const describedBy = [
28
+ ...(blocked === undefined ? [] : [blockedId]),
29
+ ...(counted ? [changesId] : []),
30
+ ].join(" ");
31
+ return (_jsxs(_Fragment, { children: [blocked === undefined ? null : (_jsx("span", { id: blockedId, "data-ui": "dirty.blocked", className: `inline-flex h-(--size-control-md) min-w-0 shrink items-center gap-1.5 truncate rounded-control px-2.5 text-meta font-medium ${bySurface(surface, "bg-warn/12 text-warn", "bg-chrome-warn/15 text-chrome-warn")}`, children: blocked })), counted ? (_jsx("span", { id: changesId, hidden: true, children: fillCopy(changes === 1 ? copy.record.unsavedOne : copy.record.unsavedMany, {
32
+ count: changes.toLocaleString(copy.locale),
33
+ }) })) : null, _jsx(Button, { surface: surface, onClick: onDiscard, disabled: saving, icon: Undo2, children: copy.record.discard }), _jsx(Button, { role: "primary", surface: surface, onClick: onSave, busy: saving, disabled: blocked !== undefined, icon: Save, ...(describedBy === "" ? {} : { "aria-describedby": describedBy }), children: saving ? copy.record.saving : (label ?? copy.record.save) })] }));
29
34
  }
30
35
  /** The one action a view leads with: the element written with `role="primary"` — the
31
36
  * same prop that paints it gold and that `make smoke` counts, so there is no second way to
@@ -25,7 +25,8 @@ import { cloneElement, isValidElement } from "react";
25
25
  *
26
26
  * What goes in it is decided, not composed:
27
27
  *
28
- * 1. With `dirty`, the bar holds «sin guardar», Discard and Save — the same
28
+ * 1. With `dirty`, the bar holds Discard and Save — and why it cannot be saved yet, when
29
+ * it cannot (`blocked`) — the same
29
30
  * precedence the rail already has: while there are unsaved changes the
30
31
  * only things that can be done are confirm or throw them away.
31
32
  * 2. Otherwise, the action written with `role="primary"` and NOTHING else.
@@ -0,0 +1,29 @@
1
+ import type { Surface } from "../../foundations/types.js";
2
+ /**
3
+ * THE WAY INTO THE PALETTE, drawn — «Buscar… ⌘K».
4
+ *
5
+ * Context: a command palette that only opens with a key is a feature nobody finds. quipu's
6
+ * people asked for «a global search» while ⌘K already opened one. This is the visible door: it
7
+ * reads like a search field, it says the shortcut so the next time the hand goes to the
8
+ * keyboard, and pressing it calls `onSearch` — the application opens its palette there.
9
+ *
10
+ * It does NOT listen for the shortcut. The palette does (composer's ⌘K); a second listener here
11
+ * would open it twice, or open it in an application whose palette uses another key.
12
+ *
13
+ * Inside the phone drawer it closes the drawer first: the palette opens over the page, not
14
+ * over a drawer about to cover it.
15
+ */
16
+ export type SearchEntryProps = {
17
+ onSearch: () => void;
18
+ /** What it says. «Buscar…» by default; «Buscar socios…» when the palette searches one thing. */
19
+ label?: string;
20
+ /** The key the palette listens for together with ⌘ / Ctrl: `K` by default. `false` draws no
21
+ * shortcut — the palette has none, or it is not a ⌘ one. */
22
+ shortcut?: string | false;
23
+ /** `row` fills its column (the sidebar). `bar` sizes to its words, and on a phone folds to
24
+ * the magnifier alone (a bar on top). */
25
+ layout?: "row" | "bar";
26
+ /** By default the surface it sits on. */
27
+ surface?: Surface;
28
+ };
29
+ export declare function SearchEntry({ onSearch, label, shortcut, layout, surface, }: SearchEntryProps): import("react").JSX.Element;
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useSidebarDrawer } from "./sidebarDrawer.js";
4
+ import { useUiCopy } from "../../foundations/copy.js";
5
+ import { modShortcut, useKeyboardPlatform } from "../../foundations/shortcut.js";
6
+ import { useSurface } from "../../foundations/surface.js";
7
+ import { Search } from "lucide-react";
8
+ const SKIN = {
9
+ canvas: {
10
+ box: "border-ui-control-border bg-ui-control text-muted hover:border-line-strong hover:text-ink focus-visible:outline-primary",
11
+ keys: "border-line text-muted",
12
+ },
13
+ chrome: {
14
+ box: "border-chrome-ink/15 bg-chrome-ink/6 text-chrome-muted hover:bg-chrome-ink/10 hover:text-chrome-ink focus-visible:outline-chrome-link",
15
+ keys: "border-chrome-ink/20 text-chrome-muted",
16
+ },
17
+ };
18
+ export function SearchEntry({ onSearch, label, shortcut = "K", layout = "row", surface, }) {
19
+ const copy = useUiCopy();
20
+ const sup = useSurface(surface);
21
+ const drawer = useSidebarDrawer();
22
+ const platform = useKeyboardPlatform();
23
+ const skin = SKIN[sup];
24
+ const keys = shortcut === false || platform === null ? null : modShortcut(shortcut, platform);
25
+ const bar = layout === "bar";
26
+ return (_jsxs("button", { type: "button", onClick: () => {
27
+ if (drawer?.isOpen === true)
28
+ drawer.close();
29
+ onSearch();
30
+ }, ...(keys === null ? {} : { "aria-keyshortcuts": keys.aria }), className: `flex h-(--size-control-sm) min-w-0 cursor-pointer items-center gap-2 rounded-ui-control border px-2 text-meta transition-colors duration-(--duration-instant) focus-visible:outline-2 focus-visible:outline-offset-2 ${bar ? "shrink-0 max-sm:w-(--size-control-sm) max-sm:justify-center" : "w-full"} ${skin.box}`, "data-ui": "search-entry", "data-surface": sup, children: [_jsx(Search, { className: "size-(--size-icon-md) shrink-0", strokeWidth: 2, "aria-hidden": true }), _jsx("span", { className: `min-w-0 flex-1 truncate text-left ${bar ? "max-sm:sr-only" : ""}`, children: label ?? copy.shell.search }), keys === null ? null : (
31
+ /* Seen, not heard: `aria-keyshortcuts` already tells a screen reader, and «⌘K» read
32
+ aloud is noise after the name. Not drawn for a finger: a phone has no ⌘. */
33
+ _jsx("kbd", { "aria-hidden": true, className: `shrink-0 rounded-control border px-1.5 font-mono text-micro pointer-coarse:hidden ${bar ? "max-sm:hidden" : ""} ${skin.keys}`, "data-ui": "search-entry.keys", children: keys.label }))] }));
34
+ }
@@ -1,4 +1,5 @@
1
1
  import { type BrandLogo } from "./brandMark.js";
2
+ import { type SearchEntryProps } from "./SearchEntry.js";
2
3
  import type { Surface } from "../../foundations/types.js";
3
4
  import type { LucideIcon } from "lucide-react";
4
5
  import type { ReactNode } from "react";
@@ -25,6 +26,9 @@ export type SidebarProps = {
25
26
  detail?: string;
26
27
  avatar?: string;
27
28
  };
29
+ /** «Buscar… ⌘K» under the product and the user: the application's palette, made visible.
30
+ * `onSearch` opens it; the palette keeps listening for its own key. */
31
+ search?: Omit<SearchEntryProps, "layout" | "surface">;
28
32
  /** The navigation: a `NavigationTree`. It scrolls; the top and the bottom stay. */
29
33
  children: ReactNode;
30
34
  /** The account, pinned to the bottom: change the password, view the site, sign out. */
@@ -36,4 +40,4 @@ export type SidebarProps = {
36
40
  /** `chrome` wears the brand's colour. By default the frame's `sidebarSurface`. */
37
41
  surface?: Surface;
38
42
  };
39
- export declare function Sidebar({ brand, user, children, actions, onAction, footer, surface, }: SidebarProps): import("react").JSX.Element;
43
+ export declare function Sidebar({ brand, user, search, children, actions, onAction, footer, surface, }: SidebarProps): import("react").JSX.Element;
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { BrandMark } from "./brandMark.js";
4
+ import { SearchEntry, } from "./SearchEntry.js";
4
5
  import { useSidebarDrawer } from "./sidebarDrawer.js";
5
6
  import { useUiCopy } from "../../foundations/copy.js";
6
7
  import { SurfaceProvider, useSurface } from "../../foundations/surface.js";
@@ -47,11 +48,11 @@ function Action({ action, skin, onAction, }) {
47
48
  drawer?.close();
48
49
  }, children: content }));
49
50
  }
50
- export function Sidebar({ brand, user, children, actions, onAction, footer, surface, }) {
51
+ export function Sidebar({ brand, user, search, children, actions, onAction, footer, surface, }) {
51
52
  const copy = useUiCopy();
52
53
  const sup = useSurface(surface);
53
54
  const skin = SKIN[sup];
54
- const head = brand !== undefined || user !== undefined;
55
+ const head = brand !== undefined || user !== undefined || search !== undefined;
55
56
  const foot = (actions !== undefined && actions.length > 0) || footer !== undefined;
56
- return (_jsx(SurfaceProvider, { value: sup, children: _jsxs("div", { "data-ui": "sidebar", "data-surface": sup, className: `flex h-full min-h-0 min-w-0 flex-col ${skin.root}`, children: [head ? (_jsxs("div", { className: `shrink-0 border-b pb-2 ${skin.line}`, children: [brand === undefined ? null : _jsx(Brand, { brand: brand, skin: skin }), user === undefined ? null : _jsx(User, { user: user, skin: skin })] })) : null, _jsx("div", { "data-ui": "sidebar.nav", className: "min-h-0 flex-1 overflow-y-auto overscroll-contain", children: children }), foot ? (_jsxs("div", { "data-ui": "sidebar.account", className: `flex shrink-0 flex-col gap-2 border-t p-2 ${skin.line}`, children: [actions === undefined || actions.length === 0 ? null : (_jsx("ul", { "aria-label": copy.shell.account, className: "flex flex-col gap-px", children: actions.map((action) => (_jsx("li", { children: _jsx(Action, { action: action, skin: skin, ...(onAction === undefined ? {} : { onAction }) }) }, action.id))) })), footer] })) : null] }) }));
57
+ return (_jsx(SurfaceProvider, { value: sup, children: _jsxs("div", { "data-ui": "sidebar", "data-surface": sup, className: `flex h-full min-h-0 min-w-0 flex-col ${skin.root}`, children: [head ? (_jsxs("div", { className: `shrink-0 border-b pb-2 ${skin.line}`, children: [brand === undefined ? null : _jsx(Brand, { brand: brand, skin: skin }), user === undefined ? null : _jsx(User, { user: user, skin: skin }), search === undefined ? null : (_jsx("div", { "data-ui": "sidebar.search", className: "px-2 pt-2", children: _jsx(SearchEntry, { ...search }) }))] })) : null, _jsx("div", { "data-ui": "sidebar.nav", className: "min-h-0 flex-1 overflow-y-auto overscroll-contain", children: children }), foot ? (_jsxs("div", { "data-ui": "sidebar.account", className: `flex shrink-0 flex-col gap-2 border-t p-2 ${skin.line}`, children: [actions === undefined || actions.length === 0 ? null : (_jsx("ul", { "aria-label": copy.shell.account, className: "flex flex-col gap-px", children: actions.map((action) => (_jsx("li", { children: _jsx(Action, { action: action, skin: skin, ...(onAction === undefined ? {} : { onAction }) }) }, action.id))) })), footer] })) : null] }) }));
57
58
  }
@@ -1,4 +1,5 @@
1
1
  import { type BrandLogo } from "./brandMark.js";
2
+ import { type SearchEntryProps } from "./SearchEntry.js";
2
3
  import { type MenuGroup } from "../../primitives/menu/Menu.js";
3
4
  import { type LucideIcon } from "lucide-react";
4
5
  import { type ReactNode } from "react";
@@ -18,7 +19,7 @@ export interface TopMenu {
18
19
  /** `columns` lays its sections side by side: a big module menu, seen whole. */
19
20
  layout?: "list" | "columns";
20
21
  }
21
- export declare function TopBar({ app, apps, currentApp, onAppSelect, menus, currentMenu, onMenuSelect, systray, user, onUserSelect, userGroups, }: {
22
+ export declare function TopBar({ app, apps, currentApp, onAppSelect, menus, currentMenu, onMenuSelect, search, systray, user, onUserSelect, userGroups, }: {
22
23
  /** The product's name, when there is ONE product. It is drawn like the
23
24
  * current app of the switcher —same icon, same weight— but without the
24
25
  * switcher: nothing to switch to. */
@@ -39,6 +40,9 @@ export declare function TopBar({ app, apps, currentApp, onAppSelect, menus, curr
39
40
  * I» is answered without opening any of them. */
40
41
  currentMenu?: string;
41
42
  onMenuSelect?: (menuId: string, optionId: string) => void;
43
+ /** «Buscar… ⌘K» before the tray: the application's palette, made visible. On a phone it
44
+ * folds to the magnifier. `onSearch` opens the palette; the palette keeps its own key. */
45
+ search?: Omit<SearchEntryProps, "layout" | "surface">;
42
46
  /** What happened while I was not looking: activity, alerts. Icons with a count. */
43
47
  systray?: ReactNode;
44
48
  user?: {
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { BrandMark } from "./brandMark.js";
4
+ import { SearchEntry, } from "./SearchEntry.js";
4
5
  import { SidebarToggle } from "./sidebarDrawer.js";
5
6
  import { useUiCopy } from "../../foundations/copy.js";
6
7
  import { SurfaceProvider } from "../../foundations/surface.js";
@@ -9,11 +10,11 @@ import { Count, countText } from "../../primitives/tag/Count.js";
9
10
  import { Avatar } from "../../primitives/value/Person.js";
10
11
  import { Grid3x3 } from "lucide-react";
11
12
  import { useMemo, useState } from "react";
12
- export function TopBar({ app, apps, currentApp, onAppSelect, menus, currentMenu, onMenuSelect, systray, user, onUserSelect, userGroups, }) {
13
+ export function TopBar({ app, apps, currentApp, onAppSelect, menus, currentMenu, onMenuSelect, search, systray, user, onUserSelect, userGroups, }) {
13
14
  const copy = useUiCopy();
14
15
  const actual = apps?.find((a) => a.id === currentApp);
15
16
  const brand = app ?? actual;
16
- return (_jsx(SurfaceProvider, { value: "chrome", children: _jsxs("header", { "data-ui": "topbar", className: "flex h-(--size-appbar) min-w-0 items-center gap-1 border-b border-chrome-edge bg-chrome px-2", children: [_jsx(SidebarToggle, {}), apps === undefined || apps.length === 0 ? null : (_jsx(AppSwitcher, { apps: apps, current: currentApp, ...(onAppSelect === undefined ? {} : { onSelect: onAppSelect }) })), brand === undefined ? null : (_jsxs("span", { "data-ui": "topbar.brand", className: "flex shrink-0 items-center gap-2 pr-2 pl-1", children: ["logo" in brand && brand.logo !== undefined ? (_jsx(BrandMark, { logo: brand.logo, className: "size-(--size-control-sm) shrink-0" })) : brand.icon === undefined ? null : (_jsx(brand.icon, { className: "size-(--size-icon-md) text-chrome-link", strokeWidth: 2, "aria-hidden": true })), _jsx("span", { className: "text-lead font-medium text-chrome-ink", children: brand.label })] })), menus === undefined ? null : (_jsx("nav", { "data-ui": "topbar.menus", className: "scroll-quiet flex min-w-0 items-center gap-0.5", "aria-label": copy.shell.menus, children: menus.map((m) => (_jsx(Menu, { label: m.label, groups: m.groups, surface: "chrome", variant: "text", chevron: false, current: m.id === currentMenu, ...(m.layout === undefined ? {} : { layout: m.layout }), ...(m.count === undefined ? {} : { count: m.count }), onSelect: (id) => onMenuSelect?.(m.id, id) }, m.id))) })), _jsxs("div", { "data-ui": "topbar.actions", className: "ml-auto flex shrink-0 items-center gap-1 pl-2", children: [systray, user === undefined ? null : (_jsx(UserMenu, { name: user.name, ...(user.detail === undefined ? {} : { detail: user.detail }), groups: userGroups ?? [], ...(onUserSelect === undefined ? {} : { onSelect: onUserSelect }) }))] })] }) }));
17
+ return (_jsx(SurfaceProvider, { value: "chrome", children: _jsxs("header", { "data-ui": "topbar", className: "flex h-(--size-appbar) min-w-0 items-center gap-1 border-b border-chrome-edge bg-chrome px-2", children: [_jsx(SidebarToggle, {}), apps === undefined || apps.length === 0 ? null : (_jsx(AppSwitcher, { apps: apps, current: currentApp, ...(onAppSelect === undefined ? {} : { onSelect: onAppSelect }) })), brand === undefined ? null : (_jsxs("span", { "data-ui": "topbar.brand", className: "flex shrink-0 items-center gap-2 pr-2 pl-1", children: ["logo" in brand && brand.logo !== undefined ? (_jsx(BrandMark, { logo: brand.logo, className: "size-(--size-control-sm) shrink-0" })) : brand.icon === undefined ? null : (_jsx(brand.icon, { className: "size-(--size-icon-md) text-chrome-link", strokeWidth: 2, "aria-hidden": true })), _jsx("span", { className: "text-lead font-medium text-chrome-ink", children: brand.label })] })), menus === undefined ? null : (_jsx("nav", { "data-ui": "topbar.menus", className: "scroll-quiet flex min-w-0 items-center gap-0.5", "aria-label": copy.shell.menus, children: menus.map((m) => (_jsx(Menu, { label: m.label, groups: m.groups, surface: "chrome", variant: "text", chevron: false, current: m.id === currentMenu, ...(m.layout === undefined ? {} : { layout: m.layout }), ...(m.count === undefined ? {} : { count: m.count }), onSelect: (id) => onMenuSelect?.(m.id, id) }, m.id))) })), _jsxs("div", { "data-ui": "topbar.actions", className: "ml-auto flex shrink-0 items-center gap-1 pl-2", children: [search === undefined ? null : _jsx(SearchEntry, { ...search, layout: "bar" }), systray, user === undefined ? null : (_jsx(UserMenu, { name: user.name, ...(user.detail === undefined ? {} : { detail: user.detail }), groups: userGroups ?? [], ...(onUserSelect === undefined ? {} : { onSelect: onUserSelect }) }))] })] }) }));
17
18
  }
18
19
  /** The app switcher: a grid, not a list.
19
20
  *
@@ -1,6 +1,7 @@
1
1
  export { AppFrame } from "./AppFrame.js";
2
2
  export { type BrandLogo } from "./brandMark.js";
3
3
  export { Sidebar, type SidebarAction, type SidebarProps, } from "./Sidebar.js";
4
+ export { SearchEntry, type SearchEntryProps, } from "./SearchEntry.js";
4
5
  export { type SidebarDrawer, SidebarToggle, useSidebarDrawer, } from "./sidebarDrawer.js";
5
6
  export { type AppEntry, SystrayButton, TopBar, type TopMenu, } from "./TopBar.js";
6
7
  export { Pane, Panes } from "./Panes.js";
@@ -4,6 +4,9 @@ export { AppFrame } from "./AppFrame.js";
4
4
  export {} from "./brandMark.js";
5
5
  /* The whole chrome in one column, for a back office with no bar on top. */
6
6
  export { Sidebar, } from "./Sidebar.js";
7
+ /* The way into the application's palette, drawn: «Buscar… ⌘K». The sidebar and the bar draw
8
+ it from their `search`; on its own, for any other place. */
9
+ export { SearchEntry, } from "./SearchEntry.js";
7
10
  /* The sidebar's phone drawer, for a bar an application writes itself. */
8
11
  export { SidebarToggle, useSidebarDrawer, } from "./sidebarDrawer.js";
9
12
  export { SystrayButton, TopBar, } from "./TopBar.js";
@@ -68,9 +68,10 @@ export type UiCopy = {
68
68
  location: string;
69
69
  status: string;
70
70
  faces: string;
71
- /** The mark of a record with changes that are not saved yet. */
71
+ /** @deprecated Not drawn since 2.4: the Save and Discard buttons already say it. Kept so
72
+ * a copy table written for an earlier version still type-checks. */
72
73
  unsaved: string;
73
- /** The same mark when the record says how many fields changed. */
74
+ /** How many fields changed — the Save button's description, for a screen reader. */
74
75
  unsavedOne: string;
75
76
  unsavedMany: string;
76
77
  save: string;
@@ -108,6 +109,22 @@ export type UiCopy = {
108
109
  openNavigation: string;
109
110
  /** The drawer's name: what a screen reader hears when it opens. */
110
111
  navigation: string;
112
+ /** The way into the application's palette, in the sidebar or the bar. */
113
+ search: string;
114
+ };
115
+ /** A guided tour (`Guide`). */
116
+ guide: {
117
+ /** The tour's name when the application gives none. */
118
+ label: string;
119
+ /** «2 de 5»: `{current}` and `{total}`. */
120
+ progress: string;
121
+ /** What a screen reader hears on each step: `{progress}` and `{title}`. */
122
+ step: string;
123
+ next: string;
124
+ back: string;
125
+ skip: string;
126
+ /** The last step's button, in place of «next». */
127
+ finish: string;
111
128
  };
112
129
  field: {
113
130
  drop: string;
@@ -99,6 +99,16 @@ export const SPANISH_COPY = {
99
99
  openAsPanel: "Abrir como panel",
100
100
  openNavigation: "Abrir la navegación",
101
101
  navigation: "Navegación",
102
+ search: "Buscar…",
103
+ },
104
+ guide: {
105
+ label: "Recorrido",
106
+ progress: "{current} de {total}",
107
+ step: "{progress}: {title}",
108
+ next: "Siguiente",
109
+ back: "Atrás",
110
+ skip: "Saltar el recorrido",
111
+ finish: "Terminar",
102
112
  },
103
113
  field: {
104
114
  drop: "Soltá un archivo acá, o elegí uno.",
@@ -75,6 +75,16 @@ export const ENGLISH_COPY = {
75
75
  openAsPanel: "Open as panel",
76
76
  openNavigation: "Open the navigation",
77
77
  navigation: "Navigation",
78
+ search: "Search…",
79
+ },
80
+ guide: {
81
+ label: "Guided tour",
82
+ progress: "{current} of {total}",
83
+ step: "{progress}: {title}",
84
+ next: "Next",
85
+ back: "Back",
86
+ skip: "Skip the tour",
87
+ finish: "Done",
78
88
  },
79
89
  field: {
80
90
  drop: "Drop a file here, or choose one.",
@@ -2,6 +2,7 @@ export { type CopyCatalog, type CopyOverride, createCopy, mergeCopyOver, } from
2
2
  export { currentCopy, currentCopyLocale, ENGLISH_COPY, fillCopy, installCopy, mergeCopy, type UiCopy, type UiCopyOverride, UiCopyProvider, useUiCopy, } from "./copy.js";
3
3
  export { byDensity, type Density, DensityProvider, useDensity, } from "./density.js";
4
4
  export { controlName, FieldBoundary, type FieldIds, type FormMode, FormModeProvider, useFieldIds, useFormMode, } from "./form.js";
5
+ export { type KeyboardPlatform, type ModShortcut, modShortcut, useKeyboardPlatform, } from "./shortcut.js";
5
6
  export { bySurface, SurfaceProvider, useSurface } from "./surface.js";
6
7
  export { applyTheme, isTheme, type ResolvedTheme, resolveTheme, type Theme, THEME_ATTRIBUTE, ThemeProvider, type ThemeProviderProps, THEMES, useTheme, } from "./theme.js";
7
8
  export type { OpenTarget, Size, Surface, Tone } from "./types.js";
@@ -6,6 +6,8 @@ export { byDensity, DensityProvider, useDensity, } from "./density.js";
6
6
  /* A CONTROL'S CONTRACT — the ids its `Field` gives it and whether it is viewed or written. The
7
7
  package's controls and the application's speak it alike. */
8
8
  export { controlName, FieldBoundary, FormModeProvider, useFieldIds, useFormMode, } from "./form.js";
9
+ /* A SHORTCUT, drawn the way the person's keyboard says it: «⌘K» on a Mac, «Ctrl K» elsewhere. */
10
+ export { modShortcut, useKeyboardPlatform, } from "./shortcut.js";
9
11
  /* THE THEME — light, dark or the operating system's. The palettes live in `tokens.css`; this
10
12
  only writes `data-theme`. */
11
13
  export { bySurface, SurfaceProvider, useSurface } from "./surface.js";
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Context: a shortcut is drawn the way the person's keyboard says it — «⌘K» on a Mac, «Ctrl K»
3
+ * everywhere else. A «Ctrl K» on a Mac is a shortcut that does not work, and people stop
4
+ * reading the others. Only the browser knows the platform: on the server and while hydrating
5
+ * it is `null`, and the shortcut appears right after instead of being drawn wrong and
6
+ * corrected in front of the person.
7
+ */
8
+ export type KeyboardPlatform = "apple" | "other";
9
+ /** The keyboard the page is being used with; `null` on the server and while hydrating. */
10
+ export declare function useKeyboardPlatform(): KeyboardPlatform | null;
11
+ export type ModShortcut = {
12
+ /** What is drawn: «⌘K», «Ctrl K». */
13
+ label: string;
14
+ /** For `aria-keyshortcuts`: «Meta+K», «Control+K». */
15
+ aria: string;
16
+ };
17
+ /** The platform's command key with `key`: ⌘ on a Mac, Ctrl elsewhere. */
18
+ export declare function modShortcut(key: string, platform: KeyboardPlatform): ModShortcut;
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ import { useSyncExternalStore } from "react";
3
+ function readPlatform() {
4
+ const nav = navigator;
5
+ /* `userAgentData` where there is one (Chromium); `platform` is deprecated but it is the
6
+ only answer Safari and Firefox give. */
7
+ const name = nav.userAgentData?.platform ?? nav.platform;
8
+ return /mac|iphone|ipad|ipod/i.test(name) ? "apple" : "other";
9
+ }
10
+ const unchanging = () => () => { };
11
+ /** The keyboard the page is being used with; `null` on the server and while hydrating. */
12
+ export function useKeyboardPlatform() {
13
+ return useSyncExternalStore(unchanging, readPlatform, () => null);
14
+ }
15
+ /** The platform's command key with `key`: ⌘ on a Mac, Ctrl elsewhere. */
16
+ export function modShortcut(key, platform) {
17
+ return platform === "apple"
18
+ ? { label: `⌘${key}`, aria: `Meta+${key}` }
19
+ : { label: `Ctrl ${key}`, aria: `Control+${key}` };
20
+ }
@@ -29,6 +29,10 @@ export type MetricProps = {
29
29
  * zero. */
30
30
  value?: number | string;
31
31
  label: string;
32
+ /** A second reading of the same count, already formatted, under the label: «6 · Bs
33
+ * 1.000,00» is how many AND how much. Muted and small — the figure on top is still the
34
+ * one compared across the row. */
35
+ detail?: string;
32
36
  /** The figure is being read. The label stays and the box keeps its size, so a row of
33
37
  * metrics does not jump when the numbers land one at a time. */
34
38
  loading?: boolean;
@@ -50,7 +54,7 @@ export type MetricProps = {
50
54
  better?: "up" | "down";
51
55
  };
52
56
  };
53
- export declare function Metric({ value, label, tone, icon: Icon, onClick, active, change, loading, }: MetricProps): import("react").JSX.Element;
57
+ export declare function Metric({ value, label, detail, tone, icon: Icon, onClick, active, change, loading, }: MetricProps): import("react").JSX.Element;
54
58
  /** The row of metrics. It wraps if they don't fit; it doesn't scroll: a hidden
55
59
  * metric is a filter nobody finds. */
56
60
  export declare function Metrics({ children }: {
@@ -14,7 +14,7 @@ const TONE = {
14
14
  ink and the tone is only visible when the card is lit up. */
15
15
  accent: { background: "bg-accent/20", text: "text-ink", edge: "border-accent/50" },
16
16
  };
17
- export function Metric({ value, label, tone = "neutral", icon: Icon, onClick, active = false, change, loading = false, }) {
17
+ export function Metric({ value, label, detail, tone = "neutral", icon: Icon, onClick, active = false, change, loading = false, }) {
18
18
  const copy = useUiCopy();
19
19
  const sup = useSurface();
20
20
  const t = TONE[tone];
@@ -40,9 +40,11 @@ export function Metric({ value, label, tone = "neutral", icon: Icon, onClick, ac
40
40
  const content = (_jsxs(_Fragment, { children: [_jsxs("span", { className: `flex items-center gap-1.5 text-title font-semibold tabular-nums ${t.text}`, children: [Icon === undefined ? null : (_jsx(Icon, { className: "size-(--size-icon-md)", strokeWidth: 2, "aria-hidden": true })), loading ? (
41
41
  /* A bar one line of the figure tall (`h-lh`), so the box is the size it will
42
42
  be. It appears late, like every skeleton: a fast read never shows it. */
43
- _jsx("span", { "aria-hidden": true, className: `inline-block h-lh w-16 animate-reveal-late rounded-control ${bySurface(sup, "bg-ink/8", "bg-chrome-ink/12")}` })) : (figure)] }), _jsx("span", { className: `text-micro ${bySurface(sup, "text-muted", "text-chrome-muted")}`, children: label }), change === undefined || loading ? null : (_jsx(Change, { change: change, format: percent.format }))] }));
43
+ _jsx("span", { "aria-hidden": true, className: `inline-block h-lh w-16 animate-reveal-late rounded-control ${bySurface(sup, "bg-ink/8", "bg-chrome-ink/12")}` })) : (figure)] }), _jsx("span", { className: `text-micro ${bySurface(sup, "text-muted", "text-chrome-muted")}`, children: label }), detail === undefined || loading ? null : (_jsx("span", { "data-ui": "metric.detail", className: `text-micro tabular-nums ${bySurface(sup, "text-muted", "text-chrome-muted")}`, children: detail })), change === undefined || loading ? null : (_jsx(Change, { change: change, format: percent.format }))] }));
44
44
  if (onClick === undefined) {
45
- return (_jsx("div", { "data-ui": "metric", className: box, "aria-label": loading ? `${label}: ${copy.failed.loading}` : `${figure} ${label}`, ...(loading ? { "aria-busy": true } : {}), children: content }));
45
+ return (_jsx("div", { "data-ui": "metric", className: box, "aria-label": loading
46
+ ? `${label}: ${copy.failed.loading}`
47
+ : `${figure} ${label}${detail === undefined ? "" : `, ${detail}`}`, ...(loading ? { "aria-busy": true } : {}), children: content }));
46
48
  }
47
49
  return (_jsxs("button", { type: "button", onClick: onClick, "aria-pressed": active, ...(loading ? { "aria-busy": true } : {}), "data-ui": "metric", className: box, children: [content, loading ? _jsx("span", { className: "sr-only", children: copy.failed.loading }) : null] }));
48
50
  }