@bigpixelrocket/uiok 0.2.1 → 0.2.3

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 (64) hide show
  1. package/CHANGELOG.md +51 -1
  2. package/dist/button/TextLink.d.ts +27 -0
  3. package/dist/button/TextLink.js +15 -0
  4. package/dist/button/button.css +48 -0
  5. package/dist/button/index.d.ts +2 -1
  6. package/dist/button/index.js +2 -1
  7. package/dist/charts/Line.logic.d.ts +15 -1
  8. package/dist/charts/Line.logic.js +37 -4
  9. package/dist/charts/LineChart.d.ts +42 -2
  10. package/dist/charts/LineChart.js +41 -9
  11. package/dist/charts/Scatter.logic.js +7 -2
  12. package/dist/charts/charts.css +35 -5
  13. package/dist/charts/index.d.ts +1 -1
  14. package/dist/dialog/ConfirmDialog.d.ts +7 -1
  15. package/dist/dialog/ConfirmDialog.js +9 -4
  16. package/dist/dialog/DialogLists.d.ts +8 -1
  17. package/dist/dialog/DialogLists.js +3 -2
  18. package/dist/field/field.css +110 -2
  19. package/dist/filter/filter.css +16 -0
  20. package/dist/grid/DataGrid.d.ts +10 -2
  21. package/dist/grid/DataGrid.js +47 -13
  22. package/dist/grid/DataGrid.logic.d.ts +16 -0
  23. package/dist/grid/DataGrid.logic.js +28 -0
  24. package/dist/grid/grid.css +128 -4
  25. package/dist/index.d.ts +1 -0
  26. package/dist/index.js +1 -0
  27. package/dist/labels/UiokLabels.d.ts +3 -0
  28. package/dist/labels/UiokLabels.js +3 -1
  29. package/dist/labels/index.d.ts +1 -0
  30. package/dist/labels/index.js +1 -0
  31. package/dist/labels/keys.js +2 -0
  32. package/dist/labels/paneTabs.d.ts +27 -0
  33. package/dist/labels/paneTabs.js +10 -0
  34. package/dist/labels/selectAll.d.ts +4 -1
  35. package/dist/labels/selectAll.js +1 -1
  36. package/dist/legend/KeyLegendStrip.d.ts +9 -1
  37. package/dist/legend/KeyLegendStrip.js +119 -5
  38. package/dist/legend/legend.css +52 -0
  39. package/dist/listing/Listing.d.ts +23 -5
  40. package/dist/listing/Listing.js +11 -8
  41. package/dist/listing/listing.css +106 -3
  42. package/dist/pane/PaneActions.d.ts +3 -1
  43. package/dist/pane/PaneActions.js +6 -5
  44. package/dist/pane/PaneTabs.d.ts +92 -0
  45. package/dist/pane/PaneTabs.js +326 -0
  46. package/dist/pane/PaneTabs.logic.d.ts +97 -0
  47. package/dist/pane/PaneTabs.logic.js +158 -0
  48. package/dist/pane/index.d.ts +5 -1
  49. package/dist/pane/index.js +5 -1
  50. package/dist/pane/panetabs.css +408 -0
  51. package/dist/pane/useTabDrag.d.ts +49 -0
  52. package/dist/pane/useTabDrag.js +306 -0
  53. package/dist/segmented/SegmentedChoice.d.ts +8 -1
  54. package/dist/segmented/SegmentedChoice.js +7 -4
  55. package/dist/styles.css +8 -0
  56. package/dist/surface/GroupSwatch.d.ts +22 -0
  57. package/dist/surface/GroupSwatch.js +15 -0
  58. package/dist/surface/Tag.d.ts +26 -0
  59. package/dist/surface/Tag.js +12 -0
  60. package/dist/surface/index.d.ts +7 -0
  61. package/dist/surface/index.js +7 -0
  62. package/dist/surface/surface.css +116 -1
  63. package/dist/themes/tokens.js +13 -1
  64. package/package.json +1 -1
@@ -6,6 +6,7 @@ import { type LegendLabels } from './legend.js';
6
6
  import { type ListingLabels } from './listing.js';
7
7
  import { type PagerLabels } from './pager.js';
8
8
  import { type PaletteLabels } from './palette.js';
9
+ import { type PaneTabsLabels } from './paneTabs.js';
9
10
  import { type SelectAllLabels } from './selectAll.js';
10
11
  import { type TerminalLabels } from './terminal.js';
11
12
  /**
@@ -36,6 +37,8 @@ export interface UiokLabels {
36
37
  readonly selectAll: SelectAllLabels;
37
38
  /** A terminal's menu, its failure line, and its input's fallback name (`@bigpixelrocket/uiok/terminal`). */
38
39
  readonly terminal: TerminalLabels;
40
+ /** A pane's tab strip: New Tab, close and picked names, and the folded tabs' count and menu (`PaneTabs`). */
41
+ readonly paneTabs: PaneTabsLabels;
39
42
  }
40
43
  /** The English labels every component falls back to without a `UiokProvider`. */
41
44
  export declare const DEFAULT_LABELS: UiokLabels;
@@ -14,6 +14,7 @@ import { DEFAULT_LEGEND_LABELS } from './legend.js';
14
14
  import { DEFAULT_LISTING_LABELS } from './listing.js';
15
15
  import { DEFAULT_PAGER_LABELS } from './pager.js';
16
16
  import { DEFAULT_PALETTE_LABELS } from './palette.js';
17
+ import { DEFAULT_PANE_TABS_LABELS } from './paneTabs.js';
17
18
  import { DEFAULT_SELECT_ALL_LABELS } from './selectAll.js';
18
19
  import { DEFAULT_TERMINAL_LABELS } from './terminal.js';
19
20
  /** The English labels every component falls back to without a `UiokProvider`. */
@@ -27,5 +28,6 @@ export const DEFAULT_LABELS = {
27
28
  pager: DEFAULT_PAGER_LABELS,
28
29
  palette: DEFAULT_PALETTE_LABELS,
29
30
  selectAll: DEFAULT_SELECT_ALL_LABELS,
30
- terminal: DEFAULT_TERMINAL_LABELS
31
+ terminal: DEFAULT_TERMINAL_LABELS,
32
+ paneTabs: DEFAULT_PANE_TABS_LABELS
31
33
  };
@@ -7,6 +7,7 @@ export { DEFAULT_LEGEND_LABELS, type LegendLabels } from './legend.js';
7
7
  export { DEFAULT_LISTING_LABELS, type ListingLabels, type SortDirection } from './listing.js';
8
8
  export { DEFAULT_PAGER_LABELS, type PagerLabels, type PagerStep } from './pager.js';
9
9
  export { DEFAULT_PALETTE_LABELS, type PaletteLabels } from './palette.js';
10
+ export { DEFAULT_PANE_TABS_LABELS, type PaneTabsLabels } from './paneTabs.js';
10
11
  export { DEFAULT_SELECT_ALL_LABELS, type SelectAllLabels } from './selectAll.js';
11
12
  export { DEFAULT_TERMINAL_LABELS, type TerminalLabels } from './terminal.js';
12
13
  export { DEFAULT_LABELS, type UiokLabels } from './UiokLabels.js';
@@ -7,6 +7,7 @@ export { DEFAULT_LEGEND_LABELS } from './legend.js';
7
7
  export { DEFAULT_LISTING_LABELS } from './listing.js';
8
8
  export { DEFAULT_PAGER_LABELS } from './pager.js';
9
9
  export { DEFAULT_PALETTE_LABELS } from './palette.js';
10
+ export { DEFAULT_PANE_TABS_LABELS } from './paneTabs.js';
10
11
  export { DEFAULT_SELECT_ALL_LABELS } from './selectAll.js';
11
12
  export { DEFAULT_TERMINAL_LABELS } from './terminal.js';
12
13
  export { DEFAULT_LABELS } from './UiokLabels.js';
@@ -12,6 +12,7 @@ export const DEFAULT_KEY_LABELS = {
12
12
  ArrowLeft: 'Left',
13
13
  ArrowRight: 'Right',
14
14
  Backspace: 'Backspace',
15
+ Delete: 'Delete',
15
16
  Enter: 'Return',
16
17
  Escape: 'Escape',
17
18
  Tab: 'Tab',
@@ -40,6 +41,7 @@ export const DEFAULT_KEY_LABELS = {
40
41
  ArrowLeft: '←',
41
42
  ArrowRight: '→',
42
43
  Backspace: '⌫',
44
+ Delete: '⌦',
43
45
  Enter: '↩',
44
46
  Escape: '⎋',
45
47
  Tab: '⇥',
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The words a pane's tab strip repeats whatever its tabs hold: New Tab, a
3
+ * tab's close control and picked state, the pinned and unsaved marks, and
4
+ * the folded tabs' count and menu. A tab's name and tooltip are its own.
5
+ */
6
+ export interface PaneTabsLabels {
7
+ /** The New Tab button's accessible name and tooltip: "New Tab". */
8
+ readonly newTab: string;
9
+ /** A tab's close control, given the tab's name: "Close orders". */
10
+ readonly close: (name: string) => string;
11
+ /** A tab picked beside the one in front, given its name: "orders, picked". */
12
+ readonly picked: (name: string) => string;
13
+ /** What a pinned tab's description adds: "Pinned". */
14
+ readonly pinned: string;
15
+ /** What a tab holding changes not saved adds, its mark's meaning: "Changes not saved". */
16
+ readonly notSaved: string;
17
+ /**
18
+ * The folded tabs' count, its tooltip and description, given how many
19
+ * tabs folded and how many of them hold changes not saved:
20
+ * "6 tabs folded here, 1 with changes not saved".
21
+ */
22
+ readonly folded: (count: number, dirty: number) => string;
23
+ /** The heading of the folded tabs' menu, and the count's accessible name: "Folded here". */
24
+ readonly foldedHeading: string;
25
+ }
26
+ /** English tab strip words: the `paneTabs` group `UiokProvider` starts from. */
27
+ export declare const DEFAULT_PANE_TABS_LABELS: PaneTabsLabels;
@@ -0,0 +1,10 @@
1
+ /** English tab strip words: the `paneTabs` group `UiokProvider` starts from. */
2
+ export const DEFAULT_PANE_TABS_LABELS = {
3
+ newTab: 'New Tab',
4
+ close: (name) => `Close ${name}`,
5
+ picked: (name) => `${name}, picked`,
6
+ pinned: 'Pinned',
7
+ notSaved: 'Changes not saved',
8
+ folded: (count, dirty) => `${count.toLocaleString('en-US')} ${count === 1 ? 'tab' : 'tabs'} folded here${dirty > 0 ? `, ${dirty.toLocaleString('en-US')} with changes not saved` : ''}`,
9
+ foldedHeading: 'Folded here'
10
+ };
@@ -6,7 +6,10 @@
6
6
  export interface SelectAllLabels {
7
7
  /** The checkbox that checks or clears every row: "Check all". */
8
8
  readonly checkAll: string;
9
- /** How many rows are checked, said before the bulk actions as a status line says it: "3 of 8 selected". */
9
+ /**
10
+ * How many rows are checked, said before the bulk actions as a status line
11
+ * says it: "3 of 8 selected", "1,000 of 20,000 selected".
12
+ */
10
13
  readonly selected: (checked: number, total: number) => string;
11
14
  /** The bar's accessible name when the caller gives none: "With selected". */
12
15
  readonly label: string;
@@ -1,6 +1,6 @@
1
1
  /** English select-all words: the `selectAll` group `UiokProvider` starts from. */
2
2
  export const DEFAULT_SELECT_ALL_LABELS = {
3
3
  checkAll: 'Check all',
4
- selected: (checked, total) => `${checked} of ${total} selected`,
4
+ selected: (checked, total) => `${checked.toLocaleString('en-US')} of ${total.toLocaleString('en-US')} selected`,
5
5
  label: 'With selected'
6
6
  };
@@ -20,6 +20,14 @@ export interface KeyLegendStripProps {
20
20
  * Without it no verbs fold, and each keeps a place of its own.
21
21
  */
22
22
  readonly pairLabel?: (pair: LegendPair) => string;
23
+ /**
24
+ * What the strip does with places that do not fit. `'drop'`, the default,
25
+ * leaves them off, so the strip ends on its last whole place. `'more'`
26
+ * folds them into a "+N" chip at the strip's end, its room kept whether or
27
+ * not anything folds, whose list names each folded verb with its whole
28
+ * chord and runs the one chosen.
29
+ */
30
+ readonly overflow?: 'drop' | 'more';
23
31
  }
24
32
  /**
25
33
  * A key legend strip along a window's bottom edge: a dock of fn and the four
@@ -33,4 +41,4 @@ export interface KeyLegendStripProps {
33
41
  * them. Its own name, its verb group's name, and a paired cap's name come
34
42
  * from `UiokLabels.legend`, chords in words from `UiokLabels.keys`.
35
43
  */
36
- export declare function KeyLegendStrip({ verbs, pairLabel }: KeyLegendStripProps): ReactElement;
44
+ export declare function KeyLegendStrip({ verbs, pairLabel, overflow }: KeyLegendStripProps): ReactElement;
@@ -1,11 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ArrowBigUp, ChevronUp, Command, Option } from 'lucide-react';
3
- import { useEffect, useState } from 'react';
3
+ import { useEffect, useLayoutEffect, useRef, useState } from 'react';
4
4
  import { chordGlyphs, chordSpoken } from '../keyboard/KeyChord.logic.js';
5
5
  import { KeyChord } from '../keychord/KeyChord.js';
6
6
  import { useLabels } from '../labels/UiokProvider.js';
7
7
  import { tooltip } from '../tooltip/Tooltip.logic.js';
8
- import { legendUnits } from './KeyLegend.logic.js';
8
+ import { legendUnits, moreLabel, moreListAction } from './KeyLegend.logic.js';
9
9
  /** The dock's keys, as they sit at the keyboard's left edge: Shift on its row, then Control, Option, Command. */
10
10
  const DOCK = [
11
11
  { mod: 'shift', Icon: ArrowBigUp },
@@ -55,6 +55,33 @@ function useHeldModifiers() {
55
55
  const keepFocus = (event) => event.preventDefault();
56
56
  /** For a strip given no pair labels: no verb is read as one of a pair, so no label is asked for. */
57
57
  const UNPAIRED = { pairLabel: (pair) => pair, pairOf: () => undefined };
58
+ /**
59
+ * How many places at the tail of `row` wrapped onto the line the strip
60
+ * never shows: every child whose top sits below the first child's. Read
61
+ * again whenever the row changes size or its places change.
62
+ */
63
+ function useWrappedCount(row, places) {
64
+ const [count, setCount] = useState(0);
65
+ useLayoutEffect(() => {
66
+ if (row === null) {
67
+ return undefined;
68
+ }
69
+ const read = () => {
70
+ const children = [...row.children];
71
+ const top = children[0]?.offsetTop ?? 0;
72
+ const wrapped = children.filter((child) => child.offsetTop > top).length;
73
+ setCount((current) => (current === wrapped ? current : wrapped));
74
+ };
75
+ read();
76
+ if (typeof ResizeObserver === 'undefined') {
77
+ return undefined;
78
+ }
79
+ const observer = new ResizeObserver(read);
80
+ observer.observe(row);
81
+ return () => observer.disconnect();
82
+ }, [row, places]);
83
+ return count;
84
+ }
58
85
  /**
59
86
  * A key legend strip along a window's bottom edge: a dock of fn and the four
60
87
  * modifiers at the left, lit while held, then the verbs the keyboard offers
@@ -67,16 +94,103 @@ const UNPAIRED = { pairLabel: (pair) => pair, pairOf: () => undefined };
67
94
  * them. Its own name, its verb group's name, and a paired cap's name come
68
95
  * from `UiokLabels.legend`, chords in words from `UiokLabels.keys`.
69
96
  */
70
- export function KeyLegendStrip({ verbs, pairLabel }) {
97
+ export function KeyLegendStrip({ verbs, pairLabel, overflow = 'drop' }) {
71
98
  const { keys, legend } = useLabels();
72
99
  const held = useHeldModifiers();
73
100
  const units = legendUnits(verbs, pairLabel === undefined ? UNPAIRED : { pairLabel });
101
+ const [row, setRow] = useState(null);
102
+ const placesKey = units
103
+ .map((unit) => unit.label + chordGlyphs(unit.entries[0].chord, keys))
104
+ .join('\n');
105
+ const wrapped = useWrappedCount(overflow === 'more' ? row : null, placesKey);
106
+ const folded = overflow === 'more' && wrapped > 0 ? units.slice(units.length - wrapped) : [];
107
+ const foldedVerbs = folded.flatMap((unit) => unit.entries);
74
108
  const place = (unit) => {
75
109
  const [first, second] = unit.entries;
76
110
  if (second === undefined) {
77
- return (_jsxs("button", { onClick: first.run, onMouseDown: keepFocus, tabIndex: -1, type: "button", children: [_jsx(KeyChord, { chord: first.chord }), " ", first.label] }, first.label + chordGlyphs(first.chord, keys)));
111
+ return (_jsxs("button", { onClick: first.run, onMouseDown: keepFocus, tabIndex: -1, type: "button", ...tooltip(first.label, first.chord), children: [_jsx(KeyChord, { chord: first.chord }), " ", first.label] }, first.label + chordGlyphs(first.chord, keys)));
78
112
  }
79
113
  return (_jsxs("span", { className: "keylegend-pair", children: [unit.entries.map((entry) => (_jsx("button", { "aria-label": legend.capName(chordSpoken(entry.chord, keys), entry.label), className: "keylegend-cap", onClick: entry.run, onMouseDown: keepFocus, tabIndex: -1, type: "button", ...tooltip(entry.label, entry.chord), children: _jsx(KeyChord, { chord: entry.chord }) }, entry.chord.key))), _jsx("span", { "aria-hidden": true, className: "keylegend-pair-label", children: unit.label })] }, unit.label + chordGlyphs(first.chord, keys)));
80
114
  };
81
- return (_jsxs("footer", { "aria-label": legend.label, className: "keylegend", "data-fn": "false", "data-layer": "none", children: [_jsxs("span", { "aria-hidden": true, className: "keylegend-dock", children: [_jsx("span", { className: "keylegend-key keylegend-dock-fn", children: "fn" }), DOCK.map(({ mod, Icon }) => (_jsx("span", { className: held.has(mod) ? 'keylegend-key held' : 'keylegend-key', children: _jsx(Icon, { className: "key-icon" }) }, mod)))] }), _jsx("span", { className: "keylegend-row", children: _jsx("span", { "aria-label": legend.verbs, className: "keylegend-verbs", role: "group", children: units.map(place) }) })] }));
115
+ return (_jsxs("footer", { "aria-label": legend.label, className: "keylegend", "data-fn": "false", "data-layer": "none", children: [_jsxs("span", { "aria-hidden": true, className: "keylegend-dock", children: [_jsx("span", { className: "keylegend-key keylegend-dock-fn", children: "fn" }), DOCK.map(({ mod, Icon }) => (_jsx("span", { className: held.has(mod) ? 'keylegend-key held' : 'keylegend-key', children: _jsx(Icon, { className: "key-icon" }) }, mod)))] }), _jsxs("span", { className: "keylegend-row", children: [_jsx("span", { "aria-label": legend.verbs, className: "keylegend-verbs", ref: setRow, role: "group", children: units.map(place) }), overflow === 'more' ? (_jsx(LegendMore, { keys: keys, legend: legend, verbs: foldedVerbs })) : null] })] }));
116
+ }
117
+ /**
118
+ * The "+N" chip at a folding strip's end and its list above it. The chip
119
+ * keeps its room while nothing is folded (hidden, so the strip never jumps
120
+ * when the first place folds). Its list is a compact menu: the keys of
121
+ * `moreListAction`, a click or Return runs the verb and closes the list, and
122
+ * the focus goes back to where it was before the list opened, as a verb
123
+ * button's press keeps it, so the keyboard stays on what it was driving.
124
+ */
125
+ function LegendMore({ verbs, keys, legend }) {
126
+ const [open, setOpen] = useState(false);
127
+ const [cursor, setCursor] = useState(0);
128
+ const chip = useRef(null);
129
+ const list = useRef(null);
130
+ const returnRef = useRef(null);
131
+ const label = moreLabel(verbs.length, legend);
132
+ const shown = verbs.length > 0;
133
+ useEffect(() => {
134
+ if (!shown) {
135
+ setOpen(false);
136
+ }
137
+ }, [shown]);
138
+ useEffect(() => {
139
+ if (open) {
140
+ list.current?.focus();
141
+ }
142
+ }, [open]);
143
+ useEffect(() => {
144
+ if (!open) {
145
+ return undefined;
146
+ }
147
+ const away = (event) => {
148
+ const target = event.target;
149
+ if (target !== null && !list.current?.contains(target) && !chip.current?.contains(target)) {
150
+ setOpen(false);
151
+ }
152
+ };
153
+ document.addEventListener('pointerdown', away);
154
+ return () => document.removeEventListener('pointerdown', away);
155
+ }, [open]);
156
+ const close = () => {
157
+ const back = returnRef.current;
158
+ returnRef.current = null;
159
+ setOpen(false);
160
+ if (back instanceof HTMLElement && back.isConnected) {
161
+ back.focus({ preventScroll: true });
162
+ }
163
+ };
164
+ const run = (verb) => {
165
+ close();
166
+ verb?.run();
167
+ };
168
+ const onKeyDown = (event) => {
169
+ const action = moreListAction(event.nativeEvent, cursor, verbs.length);
170
+ if (action === null) {
171
+ return;
172
+ }
173
+ event.preventDefault();
174
+ event.stopPropagation();
175
+ if (action.kind === 'close') {
176
+ close();
177
+ }
178
+ else if (action.kind === 'cursor') {
179
+ setCursor(action.row);
180
+ }
181
+ else {
182
+ run(verbs[action.row]);
183
+ }
184
+ };
185
+ return (_jsxs("span", { className: "keylegend-more-place", children: [_jsx("button", { "aria-expanded": open, "aria-haspopup": "menu", "aria-label": label.spoken, "aria-hidden": shown ? undefined : true, className: "keylegend-more quiet-control", "data-empty": shown ? undefined : 'true', disabled: !shown, onClick: () => {
186
+ if (open) {
187
+ close();
188
+ return;
189
+ }
190
+ returnRef.current = document.activeElement;
191
+ setCursor(0);
192
+ setOpen(true);
193
+ },
194
+ // A press must not take the focus from what the keyboard was driving.
195
+ onMouseDown: keepFocus, ref: chip, tabIndex: -1, type: "button", ...tooltip(label.spoken), children: label.text }), open && shown ? (_jsx("div", { "aria-label": label.spoken, className: "folder-menu folder-menu-compact keylegend-more-list", "data-overlay": true, onKeyDown: onKeyDown, ref: list, role: "menu", tabIndex: -1, children: verbs.map((verb, index) => (_jsxs("button", { "aria-label": `${chordSpoken(verb.chord, keys)} ${verb.label}`, className: index === cursor ? 'folder-menu-option cursor' : 'folder-menu-option', onClick: () => run(verb), onMouseDown: keepFocus, onPointerEnter: () => setCursor(index), role: "menuitem", tabIndex: -1, type: "button", children: [_jsx("span", { "aria-hidden": true, className: "row-icon" }), _jsx("span", { className: "row-name", children: verb.label }), _jsx(KeyChord, { chord: verb.chord })] }, verb.label + chordGlyphs(verb.chord, keys)))) })) : null] }));
82
196
  }
@@ -171,3 +171,55 @@
171
171
  background: var(--accent-wash);
172
172
  color: var(--accent-text);
173
173
  }
174
+
175
+ /* The overflow chip (overflow="more"): the places that wrapped off the
176
+ line, counted ("+3") at the strip's end. It keeps its room while nothing
177
+ is folded, so the first place to fold never moves the others; then it is
178
+ hidden and out of reach. Its list is the compact menu, opened above it
179
+ and ending at its right edge. Hover and press come from .quiet-control. */
180
+ .keylegend-more-place {
181
+ position: relative;
182
+ flex: none;
183
+ margin-left: var(--space-2);
184
+ }
185
+
186
+ .keylegend-more {
187
+ display: inline-flex;
188
+ align-items: center;
189
+ justify-content: center;
190
+ min-width: var(--control-height);
191
+ height: var(--control-height-sm);
192
+ padding: 0 var(--space-3);
193
+ background: none;
194
+ border: none;
195
+ border-radius: var(--radius-sm);
196
+ color: var(--text-dim);
197
+ font: inherit;
198
+ font-size: var(--font-size-small);
199
+ font-variant-numeric: tabular-nums;
200
+ white-space: nowrap;
201
+ cursor: default;
202
+ }
203
+
204
+ .keylegend-more[data-empty] {
205
+ visibility: hidden;
206
+ }
207
+
208
+ /* Two classes, so it wins over the menu sheet's own place (.folder-menu
209
+ opens below and from the left), which loads after this one. */
210
+ .keylegend-more-place > .keylegend-more-list {
211
+ top: auto;
212
+ bottom: calc(100% + var(--space-2));
213
+ left: auto;
214
+ right: 0;
215
+ width: max-content;
216
+ min-width: 200px;
217
+ }
218
+
219
+ /* Right to left, the chip ends the strip on the left: the list ends there
220
+ too. :dir() follows the nearest direction, so an LTR footer inside an RTL
221
+ page keeps the left-to-right place. */
222
+ .keylegend-more-place > .keylegend-more-list:dir(rtl) {
223
+ left: 0;
224
+ right: auto;
225
+ }
@@ -45,6 +45,12 @@ export interface ListingColumn {
45
45
  readonly control?: ReactNode;
46
46
  /** The label sorts the listing by its column. */
47
47
  readonly sort?: ColumnSort;
48
+ /**
49
+ * What the label's column holds, beyond its label (a unit, how a value is
50
+ * measured): the label's tooltip and accessible description, sortable or
51
+ * not.
52
+ */
53
+ readonly tip?: string;
48
54
  }
49
55
  /** Props for {@link Strip}. */
50
56
  export interface StripProps {
@@ -143,6 +149,12 @@ export interface RowProps {
143
149
  readonly className?: string;
144
150
  /** Opens the row's item on a click anywhere but its controls. */
145
151
  readonly onOpen?: () => void;
152
+ /**
153
+ * How deep the row stands in a tree or a plan: its name is indented by one
154
+ * icon column a level (`--row-level`); 0, or none, is no indent. The
155
+ * expansion and its keys stay the host's.
156
+ */
157
+ readonly level?: number;
146
158
  /** Its controls stay in the Tab order. */
147
159
  readonly tabbable?: boolean;
148
160
  /** The row itself takes the focus: in the Tab order while it is the cursor row. */
@@ -165,7 +177,7 @@ export interface RowProps {
165
177
  * is a stop of its own: the cursor row in the Tab order (or, while no row
166
178
  * is, the one marked `entry`), the others reached by the keys that move it.
167
179
  */
168
- export declare function Row({ rowKey, mark, name, nameClass, className, onOpen, tabbable, focusable, entry, children }: RowProps): ReactElement;
180
+ export declare function Row({ rowKey, mark, name, nameClass, className, onOpen, level, tabbable, focusable, entry, children }: RowProps): ReactElement;
169
181
  /** Props for {@link Cell}. */
170
182
  export interface CellProps {
171
183
  /** Right-aligned, for numbers. */
@@ -177,8 +189,11 @@ export interface CellProps {
177
189
  }
178
190
  /** A cell of a row after its name, in the listing's metadata look (`.row-meta`). */
179
191
  export declare function Cell({ align, className, tip, children }: CellProps): ReactElement;
180
- /** The tone of a state: ready, a warning, a failure, a transition under way, or quiet. */
181
- export type StateTone = 'ready' | 'warning' | 'danger' | 'busy' | 'muted';
192
+ /**
193
+ * The tone of a state: ready, a warning, a failure, a transition under way,
194
+ * quiet, or a note (`info`: an Info or Note line, in the accent).
195
+ */
196
+ export type StateTone = 'ready' | 'warning' | 'danger' | 'busy' | 'muted' | 'info';
182
197
  /** Props for {@link StateMark}. */
183
198
  export interface StateMarkProps {
184
199
  readonly tone: StateTone;
@@ -186,6 +201,8 @@ export interface StateMarkProps {
186
201
  readonly word: string;
187
202
  /** A transition under way: a spinner in place of the dot. */
188
203
  readonly busy?: boolean;
204
+ /** What the state means, beyond its word: the mark's tooltip and accessible description. */
205
+ readonly tip?: string;
189
206
  }
190
207
  /**
191
208
  * A state as a State column says it: a mark in the state's tone and its word
@@ -194,9 +211,10 @@ export interface StateMarkProps {
194
211
  * without its hue. Inside a row the word takes the tone too, so a failure
195
212
  * reads red and a stopped line dim. A word wider than its column ends in an
196
213
  * ellipsis and carries itself whole as its tooltip, which a word shown
197
- * whole does not open.
214
+ * whole does not open; a `tip` says what the state means instead, as the
215
+ * whole mark's tooltip and description.
198
216
  */
199
- export declare function StateMark({ tone, word, busy }: StateMarkProps): ReactElement;
217
+ export declare function StateMark({ tone, word, busy, tip }: StateMarkProps): ReactElement;
200
218
  /** Props for {@link PathCell}. */
201
219
  export interface PathCellProps {
202
220
  /** The whole path, slash-separated ("/opt/homebrew/var/mysql"). */
@@ -44,10 +44,10 @@ export const linksColumn = (look, icons, words, extraPx = 0) => look === 'icons'
44
44
  * arrow of the way it sorts beside the label (before it over numbers, so
45
45
  * the label keeps the edge they line up on).
46
46
  */
47
- function SortLabel({ label, sort, align }) {
47
+ function SortLabel({ label, sort, align, tip }) {
48
48
  const { sortBy } = useLabels().listing;
49
49
  const mark = sort.direction === null ? null : sort.direction === 'asc' ? (_jsx(ChevronUp, { "aria-hidden": true, size: ICON_SM })) : (_jsx(ChevronDown, { "aria-hidden": true, size: ICON_SM }));
50
- return (_jsxs("button", { "aria-label": sortBy(label, sort.direction), className: sort.direction === null ? 'pane-sort sortable' : 'pane-sort sortable active', onClick: sort.onSort, type: "button", children: [align === 'right' && mark, _jsx("span", { className: "pane-sort-label", ...cutTooltip(label), children: label }), align !== 'right' && mark] }));
50
+ return (_jsxs("button", { "aria-label": sortBy(label, sort.direction), className: sort.direction === null ? 'pane-sort sortable' : 'pane-sort sortable active', onClick: sort.onSort, type: "button", ...describedTooltip(tip), children: [align === 'right' && mark, _jsx("span", { className: "pane-sort-label", ...(tip === undefined ? cutTooltip(label) : {}), children: label }), align !== 'right' && mark] }));
51
51
  }
52
52
  /** The `aria-sort` of a sorting column's header. */
53
53
  const ariaSort = (sort) => sort?.direction === 'asc' ? 'ascending' : sort?.direction === 'desc' ? 'descending' : undefined;
@@ -72,7 +72,9 @@ export function Strip({ title, columns = [], table = false, heading = false, cla
72
72
  .join(' '), "aria-sort": table ? ariaSort(entry.sort) : undefined, role: table ? 'columnheader' : undefined, children: [entry.control, entry.hidden === true
73
73
  ? table && _jsx("span", { className: "visually-hidden", children: entry.label })
74
74
  : entry.control === undefined &&
75
- (entry.sort === undefined ? (_jsx("span", { className: "pane-sort", children: _jsx("span", { className: "pane-sort-label", ...cutTooltip(entry.label), children: entry.label }) })) : (_jsx(SortLabel, { align: entry.align, label: entry.label, sort: entry.sort })))] }, entry.label)))] }));
75
+ (entry.sort === undefined ? (_jsx("span", { className: "pane-sort", children: _jsx("span", { className: "pane-sort-label", ...(entry.tip === undefined
76
+ ? cutTooltip(entry.label)
77
+ : describedTooltip(entry.tip)), children: entry.label }) })) : (_jsx(SortLabel, { align: entry.align, label: entry.label, sort: entry.sort, tip: entry.tip })))] }, entry.label)))] }));
76
78
  }
77
79
  /** The plainer look a row link takes when the one it has makes its listing scroll sideways. */
78
80
  const PLAINER_LOOK = {
@@ -211,7 +213,7 @@ export const RowCursorContext = createContext({
211
213
  * is a stop of its own: the cursor row in the Tab order (or, while no row
212
214
  * is, the one marked `entry`), the others reached by the keys that move it.
213
215
  */
214
- export function Row({ rowKey, mark, name, nameClass, className, onOpen, tabbable = false, focusable = false, entry = false, children }) {
216
+ export function Row({ rowKey, mark, name, nameClass, className, onOpen, level = 0, tabbable = false, focusable = false, entry = false, children }) {
215
217
  const cursor = useContext(RowCursorContext);
216
218
  const current = useSyncExternalStore(cursor.subscribe, () => cursor.current() === rowKey);
217
219
  useLayoutEffect(() => {
@@ -224,7 +226,7 @@ export function Row({ rowKey, mark, name, nameClass, className, onOpen, tabbable
224
226
  onPointerMove: () => {
225
227
  if (!current)
226
228
  cursor.point(rowKey);
227
- }, role: "row", tabIndex: focusable ? (current || entry ? 0 : -1) : undefined, children: [_jsx("span", { "aria-hidden": true, className: "row-icon", children: mark }), _jsx("span", { className: nameClass === undefined ? 'row-name' : `row-name ${nameClass}`, role: "cell", ...(typeof name === 'string' ? cutTooltip(name) : {}), children: name }), children] }) }) }));
229
+ }, role: "row", style: level > 0 ? { '--row-level': level } : undefined, tabIndex: focusable ? (current || entry ? 0 : -1) : undefined, children: [_jsx("span", { "aria-hidden": true, className: "row-icon", children: mark }), _jsx("span", { className: nameClass === undefined ? 'row-name' : `row-name ${nameClass}`, role: "cell", ...(typeof name === 'string' ? cutTooltip(name) : {}), children: name }), children] }) }) }));
228
230
  }
229
231
  /** A cell of a row after its name, in the listing's metadata look (`.row-meta`). */
230
232
  export function Cell({ align, className, tip, children }) {
@@ -239,10 +241,11 @@ export function Cell({ align, className, tip, children }) {
239
241
  * without its hue. Inside a row the word takes the tone too, so a failure
240
242
  * reads red and a stopped line dim. A word wider than its column ends in an
241
243
  * ellipsis and carries itself whole as its tooltip, which a word shown
242
- * whole does not open.
244
+ * whole does not open; a `tip` says what the state means instead, as the
245
+ * whole mark's tooltip and description.
243
246
  */
244
- export function StateMark({ tone, word, busy = false }) {
245
- return (_jsxs("span", { className: `pane-state pane-tone-${tone}`, children: [busy ? (_jsx(Spinner, { className: "pane-state-busy" })) : (_jsx("span", { "aria-hidden": true, className: "pane-state-dot" })), _jsx("span", { className: "pane-state-word", ...cutTooltip(word), children: word })] }));
247
+ export function StateMark({ tone, word, busy = false, tip }) {
248
+ return (_jsxs("span", { className: `pane-state pane-tone-${tone}`, ...describedTooltip(tip), children: [busy ? (_jsx(Spinner, { className: "pane-state-busy" })) : (_jsx("span", { "aria-hidden": true, className: "pane-state-dot" })), _jsx("span", { className: "pane-state-word", ...(tip === undefined ? cutTooltip(word) : {}), children: word })] }));
246
249
  }
247
250
  /**
248
251
  * A path cell: its folders in the row-meta tone, the head giving way first