@bigpixelrocket/uiok 0.1.4 → 0.2.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 (146) hide show
  1. package/CHANGELOG.md +88 -1
  2. package/README.md +1 -1
  3. package/dist/activity/ActivityBar.d.ts +21 -8
  4. package/dist/activity/ActivityBar.js +15 -5
  5. package/dist/activity/activity.css +53 -6
  6. package/dist/button/Button.d.ts +10 -6
  7. package/dist/button/Button.js +6 -1
  8. package/dist/button/button.css +201 -33
  9. package/dist/charts/Line.logic.d.ts +6 -0
  10. package/dist/charts/Line.logic.js +9 -0
  11. package/dist/charts/LineChart.js +11 -4
  12. package/dist/charts/Pie.logic.d.ts +89 -1
  13. package/dist/charts/Pie.logic.js +272 -2
  14. package/dist/charts/PieChart.d.ts +2 -1
  15. package/dist/charts/PieChart.js +12 -5
  16. package/dist/charts/PieFill.d.ts +15 -0
  17. package/dist/charts/PieFill.js +33 -0
  18. package/dist/charts/ResultChart.d.ts +2 -2
  19. package/dist/charts/ResultChart.js +173 -47
  20. package/dist/charts/ResultChart.logic.d.ts +60 -4
  21. package/dist/charts/ResultChart.logic.js +105 -6
  22. package/dist/charts/Scatter.logic.d.ts +18 -4
  23. package/dist/charts/Scatter.logic.js +98 -22
  24. package/dist/charts/ScatterChart.js +19 -5
  25. package/dist/charts/charts.css +233 -116
  26. package/dist/charts/seriesColour.d.ts +2 -0
  27. package/dist/charts/seriesColour.js +1 -1
  28. package/dist/datetime/DateTimePicker.d.ts +12 -2
  29. package/dist/datetime/DateTimePicker.js +61 -16
  30. package/dist/datetime/DateTimePicker.logic.d.ts +29 -0
  31. package/dist/datetime/DateTimePicker.logic.js +25 -0
  32. package/dist/datetime/datetime.css +89 -49
  33. package/dist/dialog/ConfirmDialog.d.ts +69 -20
  34. package/dist/dialog/ConfirmDialog.js +39 -12
  35. package/dist/dialog/DialogLayer.d.ts +25 -0
  36. package/dist/dialog/DialogLayer.js +24 -0
  37. package/dist/dialog/DialogLegend.d.ts +2 -1
  38. package/dist/dialog/DialogLegend.js +10 -5
  39. package/dist/dialog/DialogLegend.logic.d.ts +15 -3
  40. package/dist/dialog/DialogLegend.logic.js +8 -4
  41. package/dist/dialog/DialogLists.d.ts +157 -0
  42. package/dist/dialog/DialogLists.js +137 -0
  43. package/dist/dialog/ModalDialog.d.ts +20 -15
  44. package/dist/dialog/ModalDialog.js +22 -7
  45. package/dist/dialog/dialog.css +570 -127
  46. package/dist/dialog/index.d.ts +7 -1
  47. package/dist/dialog/index.js +7 -1
  48. package/dist/field/Check.d.ts +15 -0
  49. package/dist/field/Check.js +23 -0
  50. package/dist/field/field.css +812 -0
  51. package/dist/field/index.d.ts +10 -0
  52. package/dist/field/index.js +10 -0
  53. package/dist/field/labelHelp.d.ts +33 -0
  54. package/dist/field/labelHelp.js +22 -0
  55. package/dist/filter/FilterIcon.js +2 -1
  56. package/dist/filter/filter.css +72 -20
  57. package/dist/grid/DataGrid.d.ts +8 -1
  58. package/dist/grid/DataGrid.js +115 -40
  59. package/dist/grid/DataGrid.logic.d.ts +15 -3
  60. package/dist/grid/DataGrid.logic.js +18 -5
  61. package/dist/grid/grid.css +481 -56
  62. package/dist/icon/Spinner.d.ts +16 -0
  63. package/dist/icon/Spinner.js +13 -0
  64. package/dist/icon/index.d.ts +5 -0
  65. package/dist/icon/index.js +5 -0
  66. package/dist/icon/sizes.d.ts +19 -0
  67. package/dist/icon/sizes.js +19 -0
  68. package/dist/index.d.ts +2 -0
  69. package/dist/index.js +2 -0
  70. package/dist/keychord/KeyChord.d.ts +12 -1
  71. package/dist/keychord/KeyChord.js +2 -2
  72. package/dist/keychord/index.d.ts +1 -1
  73. package/dist/keychord/keychord.css +87 -9
  74. package/dist/labels/dialog.d.ts +12 -1
  75. package/dist/labels/dialog.js +3 -1
  76. package/dist/labels/selectAll.d.ts +4 -4
  77. package/dist/labels/selectAll.js +1 -1
  78. package/dist/legend/KeyLegendStrip.js +1 -1
  79. package/dist/legend/legend.css +82 -57
  80. package/dist/listing/Listing.d.ts +17 -10
  81. package/dist/listing/Listing.js +33 -26
  82. package/dist/listing/listing.css +1665 -237
  83. package/dist/menu/menu.css +227 -67
  84. package/dist/menu/useBellBeat.js +2 -2
  85. package/dist/namecut/NameCut.d.ts +3 -1
  86. package/dist/namecut/NameCut.js +152 -5
  87. package/dist/namecut/NameCut.logic.d.ts +5 -3
  88. package/dist/namecut/NameCut.logic.js +20 -5
  89. package/dist/namecut/namecut.css +27 -7
  90. package/dist/pager/Pager.d.ts +12 -4
  91. package/dist/pager/Pager.js +21 -7
  92. package/dist/pager/pager.css +41 -30
  93. package/dist/palette/Palette.js +2 -1
  94. package/dist/palette/palette.css +121 -60
  95. package/dist/pane/PaneActions.d.ts +56 -14
  96. package/dist/pane/PaneActions.js +64 -16
  97. package/dist/pane/PaneFrame.d.ts +37 -5
  98. package/dist/pane/PaneFrame.js +246 -11
  99. package/dist/pane/index.d.ts +4 -2
  100. package/dist/pane/index.js +4 -2
  101. package/dist/pane/toolWords.d.ts +14 -0
  102. package/dist/pane/toolWords.js +26 -0
  103. package/dist/pane/useToolbarFit.d.ts +25 -0
  104. package/dist/pane/useToolbarFit.js +95 -0
  105. package/dist/run/RunHeader.d.ts +5 -3
  106. package/dist/run/RunHeader.js +11 -8
  107. package/dist/run/run.css +64 -79
  108. package/dist/segmented/SegmentedChoice.d.ts +18 -2
  109. package/dist/segmented/SegmentedChoice.js +18 -7
  110. package/dist/segmented/segmented.css +62 -22
  111. package/dist/selectall/SelectAllBar.d.ts +4 -3
  112. package/dist/selectall/SelectAllBar.js +4 -3
  113. package/dist/selectall/selectall.css +17 -12
  114. package/dist/shell/shell.css +1073 -0
  115. package/dist/styles.css +620 -22
  116. package/dist/surface/surface.css +154 -0
  117. package/dist/tabs/PageTabs.d.ts +10 -5
  118. package/dist/tabs/PageTabs.js +126 -37
  119. package/dist/tabs/tabs.css +131 -51
  120. package/dist/terminal/Terminal.js +3 -1
  121. package/dist/terminal/Terminal.logic.d.ts +5 -4
  122. package/dist/terminal/Terminal.logic.js +9 -4
  123. package/dist/terminal/TerminalMenu.d.ts +4 -1
  124. package/dist/terminal/TerminalMenu.js +12 -5
  125. package/dist/terminal/ghostty/contrast.logic.d.ts +45 -0
  126. package/dist/terminal/ghostty/contrast.logic.js +130 -0
  127. package/dist/terminal/ghostty/core.d.ts +6 -0
  128. package/dist/terminal/ghostty/renderer.d.ts +9 -2
  129. package/dist/terminal/ghostty/renderer.js +91 -14
  130. package/dist/terminal/ghostty/surface.d.ts +8 -0
  131. package/dist/terminal/ghostty/surface.js +27 -1
  132. package/dist/terminal/terminal.css +87 -61
  133. package/dist/text/text.css +16 -7
  134. package/dist/themes/catalog.js +4 -3
  135. package/dist/themes/themes.generated.css +1307 -264
  136. package/dist/themes/tokens.d.ts +69 -14
  137. package/dist/themes/tokens.js +920 -97
  138. package/dist/tokens.css +239 -0
  139. package/dist/tooltip/Tooltip.d.ts +6 -0
  140. package/dist/tooltip/Tooltip.js +48 -6
  141. package/dist/tooltip/Tooltip.logic.d.ts +89 -12
  142. package/dist/tooltip/Tooltip.logic.js +142 -20
  143. package/dist/tooltip/index.d.ts +1 -1
  144. package/dist/tooltip/index.js +1 -1
  145. package/dist/tooltip/tooltip.css +39 -9
  146. package/package.json +3 -3
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The word step a path bar and a fitted toolbar share: when their quiet
3
+ * actions say their verbs with their glyphs alone, each one without a
4
+ * tooltip of its own takes its word (`data-word`) as one, marked
5
+ * `data-word-tip` so the next fit can take back exactly what it gave.
6
+ * Internal to the pane area; not part of the package's surface.
7
+ */
8
+ /** Takes back every word tooltip a fit gave under `root`. */
9
+ export function clearWordTips(root) {
10
+ for (const act of root.querySelectorAll('[data-word-tip]')) {
11
+ delete act.dataset.wordTip;
12
+ delete act.dataset.tooltip;
13
+ }
14
+ }
15
+ /**
16
+ * Gives each action whose word the fit hides that word as its tooltip,
17
+ * leaving an action that has a tooltip of its own (a `tip`) as it is.
18
+ */
19
+ export function giveWordTips(acts) {
20
+ for (const act of acts) {
21
+ if (act.hasAttribute('data-tooltip') || act.dataset.word === undefined)
22
+ continue;
23
+ act.dataset.wordTip = '';
24
+ act.dataset.tooltip = act.dataset.word;
25
+ }
26
+ }
@@ -0,0 +1,25 @@
1
+ import { type RefCallback } from 'react';
2
+ /**
3
+ * Fits a toolbar's tools to its one line: every tool shows its glyph and
4
+ * word while they fit; when they do not, every tool steps to its glyph
5
+ * alone (`data-tight` on the bar), its word becoming its tooltip, except a
6
+ * tool marked `keepWord`; when even that does not fit, those step too
7
+ * (`data-tight="all"`). Measured with the words shown, so the words come
8
+ * back as soon as the room does.
9
+ */
10
+ export declare function fitToolbar(bar: HTMLElement): void;
11
+ /**
12
+ * Makes a toolbar of quiet actions fit its one line, as a path bar's tools
13
+ * do: put the ref it returns on the toolbar (`role="toolbar"`, one line,
14
+ * as wide as the room it has rather than as its content). While every
15
+ * tool's glyph and word fit beside the bar's other items, they show; when
16
+ * they do not, the bar's `QuietAction`s step to their glyphs alone, each
17
+ * word moving to the tool's tooltip and staying its accessible name, and
18
+ * they step back when the room returns. A tool never cuts its word and
19
+ * never leaves the bar. The bar's other items (a field, a pager, a check,
20
+ * a button) keep their full size and count toward the room. A tool whose
21
+ * command is consequential can keep its word until last (`keepWord`). The
22
+ * bar refits whenever it or one of its items resizes, its items change,
23
+ * or the document's fonts load.
24
+ */
25
+ export declare function useToolbarFit<T extends HTMLElement = HTMLDivElement>(): RefCallback<T>;
@@ -0,0 +1,95 @@
1
+ import { useCallback } from 'react';
2
+ import { clearWordTips, giveWordTips } from './toolWords.js';
3
+ /** A tool the fit may step to its glyph: a `QuietAction` drawn with its word. */
4
+ const WORDED = '.pane-act:not(.wordless)';
5
+ /**
6
+ * Whether the bar's items, every one at its full size, run past its box.
7
+ * Items a host lets shrink (a search field, a label that cuts) are held at
8
+ * their full size while the bar measures, so they count toward the room
9
+ * rather than giving it up to the tools' words.
10
+ */
11
+ function overflows(bar) {
12
+ const items = [...bar.children];
13
+ const held = items.map((item) => item.style.flexShrink);
14
+ for (const item of items)
15
+ item.style.flexShrink = '0';
16
+ const over = bar.scrollWidth > bar.clientWidth;
17
+ items.forEach((item, index) => {
18
+ item.style.flexShrink = held[index] ?? '';
19
+ });
20
+ return over;
21
+ }
22
+ /**
23
+ * Fits a toolbar's tools to its one line: every tool shows its glyph and
24
+ * word while they fit; when they do not, every tool steps to its glyph
25
+ * alone (`data-tight` on the bar), its word becoming its tooltip, except a
26
+ * tool marked `keepWord`; when even that does not fit, those step too
27
+ * (`data-tight="all"`). Measured with the words shown, so the words come
28
+ * back as soon as the room does.
29
+ */
30
+ export function fitToolbar(bar) {
31
+ delete bar.dataset.tight;
32
+ clearWordTips(bar);
33
+ const tools = [...bar.querySelectorAll(WORDED)];
34
+ if (tools.length === 0 || !overflows(bar))
35
+ return;
36
+ const kept = tools.filter((tool) => tool.hasAttribute('data-keep-word'));
37
+ bar.dataset.tight = '';
38
+ giveWordTips(tools.filter((tool) => !kept.includes(tool)));
39
+ if (kept.length === 0 || !overflows(bar))
40
+ return;
41
+ bar.dataset.tight = 'all';
42
+ giveWordTips(kept);
43
+ }
44
+ /**
45
+ * Makes a toolbar of quiet actions fit its one line, as a path bar's tools
46
+ * do: put the ref it returns on the toolbar (`role="toolbar"`, one line,
47
+ * as wide as the room it has rather than as its content). While every
48
+ * tool's glyph and word fit beside the bar's other items, they show; when
49
+ * they do not, the bar's `QuietAction`s step to their glyphs alone, each
50
+ * word moving to the tool's tooltip and staying its accessible name, and
51
+ * they step back when the room returns. A tool never cuts its word and
52
+ * never leaves the bar. The bar's other items (a field, a pager, a check,
53
+ * a button) keep their full size and count toward the room. A tool whose
54
+ * command is consequential can keep its word until last (`keepWord`). The
55
+ * bar refits whenever it or one of its items resizes, its items change,
56
+ * or the document's fonts load.
57
+ */
58
+ export function useToolbarFit() {
59
+ return useCallback((bar) => {
60
+ if (bar === null)
61
+ return;
62
+ bar.dataset.toolFit = '';
63
+ let live = true;
64
+ const fit = () => {
65
+ if (live)
66
+ fitToolbar(bar);
67
+ };
68
+ const sizes = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(fit);
69
+ const watch = () => {
70
+ if (sizes === null)
71
+ return;
72
+ sizes.disconnect();
73
+ sizes.observe(bar, { box: 'border-box' });
74
+ for (const item of bar.children)
75
+ sizes.observe(item, { box: 'border-box' });
76
+ };
77
+ // A tool that appears, goes, or changes its word changes the room.
78
+ const items = typeof MutationObserver === 'undefined'
79
+ ? null
80
+ : new MutationObserver(() => {
81
+ watch();
82
+ fit();
83
+ });
84
+ items?.observe(bar, { childList: true, subtree: true, characterData: true });
85
+ watch();
86
+ fit();
87
+ void document.fonts?.ready.then(fit);
88
+ return () => {
89
+ live = false;
90
+ sizes?.disconnect();
91
+ items?.disconnect();
92
+ delete bar.dataset.toolFit;
93
+ };
94
+ }, []);
95
+ }
@@ -43,8 +43,10 @@ export interface RunHeaderProps {
43
43
  * The sentence (and a failure's reason) is a status region, or an alert
44
44
  * once the run failed, so each change of state is announced once; the
45
45
  * figure sits outside it, so a ticking clock is never read out, and so does
46
- * a sentence that ticks too, given an `announcement` to say instead. Styled
47
- * by the `.run-header` rules in `@bigpixelrocket/uiok/styles.css`; the type family is the
48
- * surrounding dialog's own, like the frame around it.
46
+ * a sentence that ticks too, given an `announcement` to say instead. A
47
+ * sentence cut short by a narrow view is its own tooltip. Styled by the
48
+ * `.run-header` rules in `@bigpixelrocket/uiok/styles.css`, which set its
49
+ * type: sentences in the interface font, the figure in monospace. Format an
50
+ * elapsed-time figure with `runClock`.
49
51
  */
50
52
  export declare function RunHeader({ state, headline, announcement, figure, reason, bar, facts }: RunHeaderProps): ReactElement;
@@ -1,10 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { CircleCheck, CirclePause, CircleSlash, CircleX, Hourglass, LoaderCircle } from 'lucide-react';
2
+ import { CircleCheck, CirclePause, CircleSlash, CircleX, Hourglass } from 'lucide-react';
3
3
  import { ActivityBar } from '../activity/ActivityBar.js';
4
- /** Each run state's glyph; the running one spins unless motion is reduced. */
4
+ import { ICON_LG, Spinner } from '../icon/index.js';
5
+ import { cutTooltip } from '../tooltip/Tooltip.logic.js';
6
+ /** Each still state's glyph; a running header draws the shared Spinner. */
5
7
  const STATE_ICONS = {
6
8
  waiting: Hourglass,
7
- running: LoaderCircle,
8
9
  paused: CirclePause,
9
10
  done: CircleCheck,
10
11
  failed: CircleX,
@@ -19,13 +20,15 @@ const STATE_ICONS = {
19
20
  * The sentence (and a failure's reason) is a status region, or an alert
20
21
  * once the run failed, so each change of state is announced once; the
21
22
  * figure sits outside it, so a ticking clock is never read out, and so does
22
- * a sentence that ticks too, given an `announcement` to say instead. Styled
23
- * by the `.run-header` rules in `@bigpixelrocket/uiok/styles.css`; the type family is the
24
- * surrounding dialog's own, like the frame around it.
23
+ * a sentence that ticks too, given an `announcement` to say instead. A
24
+ * sentence cut short by a narrow view is its own tooltip. Styled by the
25
+ * `.run-header` rules in `@bigpixelrocket/uiok/styles.css`, which set its
26
+ * type: sentences in the interface font, the figure in monospace. Format an
27
+ * elapsed-time figure with `runClock`.
25
28
  */
26
29
  export function RunHeader({ state, headline, announcement, figure = null, reason = null, bar, facts = [] }) {
27
- const Icon = STATE_ICONS[state];
30
+ const Icon = state === 'running' ? null : STATE_ICONS[state];
28
31
  const failed = state === 'failed';
29
32
  const role = failed ? 'alert' : 'status';
30
- return (_jsxs("div", { className: "run-header", "data-state": state, children: [_jsxs("div", { className: "run-header-top", children: [_jsx(Icon, { "aria-hidden": true, className: "run-header-glyph" }), _jsxs("div", { className: "run-header-said", children: [announcement !== undefined && _jsx("span", { className: "run-header-headline", children: headline }), _jsxs("div", { role: role, children: [announcement === undefined ? (_jsx("span", { className: "run-header-headline", children: headline })) : (_jsx("span", { className: "visually-hidden", children: announcement })), reason !== null && reason !== '' && _jsx("p", { className: "run-header-reason", children: reason })] }, role)] }), figure !== null && _jsx("span", { className: "run-header-figure", children: figure })] }), bar && (_jsx(ActivityBar, { className: "run-header-bar", fillClassName: "run-header-fill", fraction: bar.fraction, label: bar.label, moving: state === 'running' })), facts.length > 0 && (_jsx("div", { className: bar ? 'run-header-facts' : 'run-header-facts indented', children: facts.map((fact, index) => (_jsx("span", { className: "run-header-fact", children: fact }, index))) }))] }));
33
+ return (_jsxs("div", { className: "run-header", "data-state": state, children: [_jsxs("div", { className: "run-header-top", children: [Icon === null ? (_jsx(Spinner, { className: "run-header-glyph", size: ICON_LG })) : (_jsx(Icon, { "aria-hidden": true, className: "run-header-glyph" })), _jsxs("div", { className: "run-header-said", children: [announcement !== undefined && (_jsx("span", { className: "run-header-headline", ...cutTooltip(headline), children: headline })), _jsxs("div", { role: role, children: [announcement === undefined ? (_jsx("span", { className: "run-header-headline", ...cutTooltip(headline), children: headline })) : (_jsx("span", { className: "visually-hidden", children: announcement })), reason !== null && reason !== '' && _jsx("p", { className: "run-header-reason", children: reason })] }, role)] }), figure !== null && _jsx("span", { className: "run-header-figure", children: figure })] }), bar && (_jsx(ActivityBar, { className: "run-header-bar", fillClassName: "run-header-fill", fraction: bar.fraction, label: bar.label, moving: state === 'running' })), facts.length > 0 && (_jsx("div", { className: bar ? 'run-header-facts' : 'run-header-facts indented', children: facts.map((fact, index) => (_jsx("span", { className: "run-header-fact", children: fact }, index))) }))] }));
31
34
  }
package/dist/run/run.css CHANGED
@@ -1,14 +1,17 @@
1
1
  /* ---- Progress header (RunHeader) ----
2
2
 
3
3
  The header a view watching work in progress opens with: the state's
4
- glyph and sentence, the big figure at the right edge, the optional bar,
5
- and the facts. It keeps the surrounding dialog's type family, like the
6
- frame; sizes, weights, and colours are its own. */
4
+ glyph and sentence, the figure at the right edge, the optional bar, and
5
+ the facts. It carries its own type: the sentences in the interface font,
6
+ the figure (a clock or a percentage) in monospace. The reason, the
7
+ figure, and the facts are content a user may copy (an error, a duration);
8
+ the rest is chrome. */
7
9
  .run-header {
10
+ font-family: var(--font-ui);
8
11
  display: flex;
9
12
  flex: none;
10
13
  flex-direction: column;
11
- gap: 6px;
14
+ gap: var(--space-3);
12
15
  min-width: 0;
13
16
  }
14
17
 
@@ -16,40 +19,32 @@
16
19
  display: grid;
17
20
  grid-template-columns: auto minmax(0, 1fr) auto;
18
21
  align-items: start;
19
- column-gap: 8px;
22
+ column-gap: var(--space-4);
20
23
  }
21
24
 
22
- /* 18px on the headline's 20px line. */
25
+ /* A large icon centred on the headline's line. */
23
26
  .run-header-glyph {
24
- width: 18px;
25
- height: 18px;
26
- margin-top: 1px;
27
- stroke-width: 2;
27
+ width: var(--icon-lg);
28
+ height: var(--icon-lg);
29
+ margin-top: calc((var(--line-height-body) - var(--icon-lg)) / 2);
28
30
  color: var(--text-dim);
29
31
  }
30
32
 
31
- /* The running glyph turns in the accent; it stands still under reduced
32
- motion (below), where the clock and the counts say the run is working. */
33
+ /* The running glyph is the shared Spinner, in the accent; it stands still
34
+ under reduced motion, where the clock and the counts say the run is
35
+ working. */
33
36
  .run-header[data-state='running'] .run-header-glyph {
34
37
  color: var(--accent);
35
- animation: run-header-spin 1s linear infinite;
36
38
  }
37
39
 
38
- @keyframes run-header-spin {
39
- to {
40
- transform: rotate(360deg);
41
- }
42
- }
43
-
44
- /* The done sentence keeps the plain text colour: a light theme's green can
45
- miss 4.5:1 as text on the dialog surface, so only the glyph (and the bar)
46
- carries it. The red meets 4.5:1 in every theme. */
40
+ /* Every sentence keeps the plain text colour: only the glyph and the bar
41
+ carry the state's tone (green when done, the danger mark when failed),
42
+ as a desktop status line says a failure with its glyph, not red words. */
47
43
  .run-header[data-state='done'] .run-header-glyph {
48
44
  color: var(--success);
49
45
  }
50
46
 
51
- .run-header[data-state='failed'] .run-header-glyph,
52
- .run-header[data-state='failed'] .run-header-headline {
47
+ .run-header[data-state='failed'] .run-header-glyph {
53
48
  color: var(--danger);
54
49
  }
55
50
 
@@ -61,30 +56,38 @@
61
56
  display: block;
62
57
  overflow: hidden;
63
58
  color: var(--text);
64
- font-size: 14px;
65
- font-weight: 600;
66
- line-height: 20px;
59
+ font-size: var(--font-size-heading);
60
+ font-weight: var(--font-weight-strong);
61
+ line-height: var(--line-height-body);
67
62
  text-overflow: ellipsis;
68
63
  white-space: nowrap;
69
64
  }
70
65
 
71
66
  .run-header-reason {
72
- margin: 4px 0 0;
73
- color: var(--text);
74
- font-size: 12px;
75
- line-height: 1.5;
67
+ margin: var(--space-2) 0 0;
68
+ -webkit-user-select: text;
69
+ user-select: text;
70
+ color: var(--text-dim);
71
+ font-size: var(--font-size-small);
72
+ line-height: var(--line-height-prose);
76
73
  overflow-wrap: anywhere;
77
74
  }
78
75
 
79
76
  /* The figure reads live while the run goes on and dims once it is history
80
- (or before it starts). */
77
+ (or before it starts), in weight as well as colour, since some themes
78
+ have barely a step between the text and dim text colours. It is set at
79
+ the headline's size, strong and monospace: a read-out in a pane header,
80
+ not display type. */
81
81
  .run-header-figure {
82
82
  color: var(--text);
83
- font-size: 18px;
83
+ font-family: var(--font-mono);
84
+ font-size: var(--font-size-heading);
84
85
  font-variant-numeric: tabular-nums;
85
- font-weight: 600;
86
- line-height: 20px;
86
+ font-weight: var(--font-weight-strong);
87
+ line-height: var(--line-height-body);
87
88
  white-space: nowrap;
89
+ -webkit-user-select: text;
90
+ user-select: text;
88
91
  }
89
92
 
90
93
  .run-header:is(
@@ -95,66 +98,58 @@
95
98
  )
96
99
  .run-header-figure {
97
100
  color: var(--text-dim);
101
+ font-weight: var(--font-weight-regular);
98
102
  }
99
103
 
100
- .run-header-bar {
101
- height: 8px;
102
- border-radius: 4px;
103
- background: var(--cursor-bg);
104
- overflow: hidden;
105
- }
106
-
107
- .run-header-fill {
108
- height: 100%;
109
- border-radius: 4px;
104
+ /* The bar's trough and fill are ActivityBar's own (.activity-bar,
105
+ .activity-fill), and so is its idle look: a bar that is not moving fills
106
+ and stripes in the quiet idle mark, so a halted run (paused, stopped)
107
+ never outweighs a working one. The header colours a fill only where its
108
+ state says more: the accent while it waits its turn, the danger mark
109
+ when failed, and the success mark when done. Stripes keep their own
110
+ colours (a background here would paint over them). */
111
+ .run-header[data-state='waiting'] .run-header-bar:not(.indeterminate) .run-header-fill {
110
112
  background: var(--accent);
111
- transition: width 0.1s linear;
112
113
  }
113
114
 
114
- /* A bar that stopped short (paused, failed, or stopped) dims: it no longer
115
- moves. Stripes dim through their own colour (below), which this fill
116
- colour would otherwise paint over. */
117
- .run-header:is([data-state='paused'], [data-state='failed'], [data-state='stopped'])
118
- .run-header-bar:not(.indeterminate)
119
- .run-header-fill {
120
- background: var(--text-dim);
115
+ .run-header[data-state='failed'] .run-header-bar:not(.indeterminate) .run-header-fill {
116
+ background: var(--danger);
121
117
  }
122
118
 
123
- /* The stripes of a run that stopped short stand still and dim, through the
124
- hooks the activity stripes read. */
125
- .run-header:is([data-state='paused'], [data-state='failed'], [data-state='stopped'])
126
- .indeterminate
127
- > .activity-stripes {
128
- --stripe-ink: var(--text-dim);
129
- --stripe-ground: 16%;
119
+ .run-header[data-state='done'] .run-header-bar:not(.indeterminate) .run-header-fill {
120
+ background: var(--success);
130
121
  }
131
122
 
132
- .run-header[data-state='done'] .run-header-fill {
133
- background: var(--success);
123
+ /* A failed run's stripes stand still in the danger mark, as its fill would. */
124
+ .run-header[data-state='failed'] .indeterminate > .activity-stripes {
125
+ --stripe-ink: var(--danger);
134
126
  }
135
127
 
136
128
  .run-header-facts {
129
+ -webkit-user-select: text;
130
+ user-select: text;
137
131
  display: flex;
138
132
  align-items: center;
139
- gap: 8px;
133
+ gap: var(--space-4);
140
134
  min-width: 0;
141
135
  overflow: hidden;
142
136
  color: var(--text-dim);
143
- font-size: 12px;
137
+ font-size: var(--font-size-small);
144
138
  font-variant-numeric: tabular-nums;
145
- line-height: 18px;
139
+ line-height: var(--line-height-prose);
146
140
  white-space: nowrap;
147
141
  }
148
142
 
149
143
  /* Under a bar the facts sit closer to it than the bar sits to the
150
144
  sentence: they describe the bar. */
151
145
  .run-header-bar + .run-header-facts {
152
- margin-top: -2px;
146
+ margin-top: calc(-1 * var(--space-1));
153
147
  }
154
148
 
155
- /* Without a bar the facts line up under the sentence, past the glyph. */
149
+ /* Without a bar the facts line up under the sentence, past the glyph and
150
+ the column gap. */
156
151
  .run-header-facts.indented {
157
- padding-left: 26px;
152
+ padding-left: calc(var(--icon-lg) + var(--space-4));
158
153
  }
159
154
 
160
155
  .run-header-fact {
@@ -170,7 +165,7 @@
170
165
 
171
166
  .run-header-fact + .run-header-fact::before {
172
167
  content: '·';
173
- margin-right: 8px;
168
+ margin-right: var(--space-4);
174
169
  color: var(--row-meta-text);
175
170
  }
176
171
 
@@ -178,13 +173,3 @@
178
173
  color: var(--text);
179
174
  font-family: var(--font-mono);
180
175
  }
181
-
182
- @media (prefers-reduced-motion: reduce) {
183
- .run-header[data-state='running'] .run-header-glyph {
184
- animation: none;
185
- }
186
-
187
- .run-header-fill {
188
- transition: none;
189
- }
190
- }
@@ -11,12 +11,28 @@ export interface SegmentedChoiceProps<T extends string | number | null> {
11
11
  readonly onChange: (value: T) => void;
12
12
  /** What a segment shows for a choice: its words, an icon, or both. */
13
13
  readonly render: (choice: T) => ReactNode;
14
+ /**
15
+ * Choices that cannot be chosen now: drawn faded where they stand, so the
16
+ * control keeps its shape, and passed over by a click and the arrow keys.
17
+ * None unless given; the chosen one should not be among them.
18
+ */
19
+ readonly disabledChoices?: readonly T[];
20
+ /**
21
+ * What the choice does, as the group's accessible description: the
22
+ * `control` half of `labelHelp(help)` spread on the group, whose `label`
23
+ * half is the tooltip on the element `labelId` names. A screen reader
24
+ * hears it when the group takes focus.
25
+ */
26
+ readonly 'aria-description'?: string;
14
27
  }
15
28
  /**
16
29
  * One choice of several, drawn as a segmented control and announced as a
17
30
  * radio group: one Tab stop (the checked segment), and the arrow keys move
18
- * the choice, wrapping at the ends, with the focus following it. Its look is
31
+ * the choice, wrapping at the ends and passing over a disabled choice, with
32
+ * the focus following it. Help that explains the choice is the label's
33
+ * tooltip and the group's description (`aria-description`, from
34
+ * `labelHelp`), as a field's is. Its look is
19
35
  * its own (`.segmented-choice` in `@bigpixelrocket/uiok/styles.css`), so it draws the same
20
36
  * in a dialog and on a page.
21
37
  */
22
- export declare function SegmentedChoice<T extends string | number | null>({ labelId, choices, value, onChange, render }: SegmentedChoiceProps<T>): ReactElement;
38
+ export declare function SegmentedChoice<T extends string | number | null>({ labelId, choices, value, onChange, render, disabledChoices, 'aria-description': description }: SegmentedChoiceProps<T>): ReactElement;
@@ -3,26 +3,37 @@ import { useRef } from 'react';
3
3
  /**
4
4
  * One choice of several, drawn as a segmented control and announced as a
5
5
  * radio group: one Tab stop (the checked segment), and the arrow keys move
6
- * the choice, wrapping at the ends, with the focus following it. Its look is
6
+ * the choice, wrapping at the ends and passing over a disabled choice, with
7
+ * the focus following it. Help that explains the choice is the label's
8
+ * tooltip and the group's description (`aria-description`, from
9
+ * `labelHelp`), as a field's is. Its look is
7
10
  * its own (`.segmented-choice` in `@bigpixelrocket/uiok/styles.css`), so it draws the same
8
11
  * in a dialog and on a page.
9
12
  */
10
- export function SegmentedChoice({ labelId, choices, value, onChange, render }) {
13
+ export function SegmentedChoice({ labelId, choices, value, onChange, render, disabledChoices = [], 'aria-description': description }) {
11
14
  const group = useRef(null);
12
15
  const step = (event, delta) => {
13
16
  event.preventDefault();
14
- const index = (choices.indexOf(value) + delta + choices.length) % choices.length;
15
- onChange(choices[index]);
16
- group.current?.querySelectorAll('[role="radio"]')[index]?.focus();
17
+ const from = choices.indexOf(value);
18
+ // The next choice that can be chosen, at most one lap round.
19
+ for (let moved = 1; moved < choices.length; moved += 1) {
20
+ const index = (from + delta * moved + choices.length * moved) % choices.length;
21
+ const choice = choices[index];
22
+ if (!disabledChoices.includes(choice)) {
23
+ onChange(choice);
24
+ group.current?.querySelectorAll('[role="radio"]')[index]?.focus();
25
+ return;
26
+ }
27
+ }
17
28
  };
18
- return (_jsx("div", { "aria-labelledby": labelId, className: "segmented-choice", onKeyDown: (event) => {
29
+ return (_jsx("div", { "aria-description": description, "aria-labelledby": labelId, className: "segmented-choice", onKeyDown: (event) => {
19
30
  if (event.key === 'ArrowRight' || event.key === 'ArrowDown') {
20
31
  step(event, 1);
21
32
  }
22
33
  else if (event.key === 'ArrowLeft' || event.key === 'ArrowUp') {
23
34
  step(event, -1);
24
35
  }
25
- }, ref: group, role: "radiogroup", children: choices.map((choice) => (_jsx("button", { "aria-checked": choice === value, className: "segmented-choice-option", onClick: () => {
36
+ }, ref: group, role: "radiogroup", children: choices.map((choice) => (_jsx("button", { "aria-checked": choice === value, className: "segmented-choice-option", disabled: disabledChoices.includes(choice), onClick: () => {
26
37
  // The chosen segment again changes nothing, so it reads nothing.
27
38
  if (choice !== value) {
28
39
  onChange(choice);
@@ -1,49 +1,89 @@
1
1
  /* ---- Segmented choice (SegmentedChoice) ----
2
2
 
3
- One choice of several: a tinted track with the chosen segment raised, each
4
- segment as wide as its words. It carries its whole look, so it draws the
5
- same in a dialog and on a page. */
3
+ One choice of several: a trough (--control-track, ringed in
4
+ --control-border like every control outline) with the chosen segment
5
+ raised, each segment as wide as its words. It carries its whole look, so
6
+ it draws the same in a dialog and on a page. Its outer height is a control
7
+ height, small by default, so it lines up with small buttons and fields; a
8
+ form of regular controls sets --segmented-height to var(--control-height),
9
+ and a dense row sets var(--control-height-xs). The height is a minimum: a
10
+ host that lets the choices wrap gets a taller trough, not overflow. The
11
+ track pads by its ring plus 2px, so 2px of trough shows on every side of
12
+ the chosen segment, the same as between two segments; each segment is the
13
+ track less that inset on both sides, its corner concentric with the
14
+ track's. Hover and press come from the base sheet's
15
+ track recipe (a wash, no ring); the chosen segment's raised look outweighs
16
+ them. Every segment has one weight, chosen or not,
17
+ so a change of choice never moves a label. A segment is a flex box: an
18
+ icon (12px, whatever its caller passed) and its words share one centre
19
+ line and the Button's icon-to-label gap. Its side padding is
20
+ --segmented-inset, which a narrow host shortens instead of restating the
21
+ padding. A segment that cannot be chosen now fades like every disabled
22
+ control and takes no hover or press. */
6
23
  .segmented-choice {
7
24
  box-sizing: border-box;
8
25
  display: inline-flex;
9
26
  flex: none;
10
- gap: 2px;
27
+ gap: var(--space-1);
28
+ min-height: var(--segmented-height, var(--control-height-sm));
11
29
  margin: 0;
12
- padding: 2px;
13
- border-radius: 7px;
14
- background: color-mix(in srgb, var(--text) 7%, transparent);
30
+ padding: calc(var(--space-1) + var(--line));
31
+ border-radius: var(--radius-md);
32
+ background: var(--control-track);
33
+ box-shadow: inset 0 0 0 var(--line) var(--control-border);
15
34
  }
16
35
 
17
36
  .segmented-choice-option {
18
37
  box-sizing: border-box;
38
+ display: inline-flex;
19
39
  flex: none;
20
- height: 22px;
21
- padding: 0 12px;
40
+ align-items: center;
41
+ justify-content: center;
42
+ gap: var(--space-3);
43
+ height: calc(
44
+ var(--segmented-height, var(--control-height-sm)) - 2 * (var(--space-1) + var(--line))
45
+ );
46
+ margin: 0;
47
+ padding: 0 var(--segmented-inset, var(--space-6));
22
48
  border: none;
23
- border-radius: 5px;
49
+ border-radius: calc(var(--radius-md) - var(--space-1) - var(--line));
24
50
  background: transparent;
25
- color: var(--text-dim);
51
+ color: var(--text-on-surface);
26
52
  font-family: var(--font-ui);
27
- font-size: 11.5px;
53
+ font-size: var(--font-size-small);
54
+ font-weight: var(--font-weight-medium);
55
+ line-height: 1;
28
56
  white-space: nowrap;
29
- cursor: pointer;
57
+ cursor: default;
30
58
  }
31
59
 
32
- .segmented-choice-option:hover:enabled:not([aria-disabled='true']) {
33
- color: var(--text);
60
+ .segmented-choice-option > svg {
61
+ flex: none;
62
+ width: var(--icon-sm);
63
+ height: var(--icon-sm);
34
64
  }
35
65
 
36
- .segmented-choice-option[aria-checked='true'] {
66
+ /* The chosen segment is raised: its ring (--control-border-strong, 3:1 on
67
+ the trough) drawn inside it, so two pixels of trough separate it from the
68
+ track's own ring as from the next segment; the glass edge on the row just under that ring
69
+ (the ring, listed first, covers the edge's top row); the raised shadow
70
+ below. A host that draws the row as toggle buttons (a menu whose arrow
71
+ keys step the choices) marks the chosen one aria-pressed="true" and gets
72
+ the same raised look, held under a press as the radio's is, ahead of the
73
+ base sheet's look for an on toggle. */
74
+ .segmented-choice-option[aria-checked='true'],
75
+ .segmented-choice-option[aria-pressed='true'],
76
+ .segmented-choice-option[aria-pressed='true']:active {
37
77
  background: linear-gradient(var(--hover-wash), transparent), var(--surface);
38
78
  box-shadow:
39
- inset 0 1px 0 var(--glass-edge),
40
- 0 0 0 0.5px var(--border-strong),
41
- var(--shadow-segment);
79
+ inset 0 0 0 var(--line) var(--control-border-strong),
80
+ inset 0 calc(2 * var(--line)) 0 var(--glass-edge),
81
+ var(--shadow-raised);
42
82
  color: var(--text);
43
- font-weight: 600;
44
83
  }
45
84
 
46
85
  .segmented-choice-option:focus-visible {
47
- outline: 2px solid var(--accent);
48
- outline-offset: -2px;
86
+ /* The track clips nothing, but an outside ring would cross the segment
87
+ beside it: the ring sits inside the segment. */
88
+ outline-offset: var(--focus-offset-inset);
49
89
  }
@@ -9,14 +9,15 @@ export interface SelectAllBarProps {
9
9
  readonly checked: number;
10
10
  /** Checks every offered row (true), or clears them all (false). */
11
11
  readonly onCheckAll: (on: boolean) => void;
12
- /** The bulk actions after "With selected:". */
12
+ /** The bulk actions after the count of checked rows. */
13
13
  readonly children: ReactNode;
14
14
  }
15
15
  /**
16
16
  * The select-all footer of a list whose rows have checkboxes: Check all,
17
17
  * which checks or clears every row the list offers (its filter's
18
- * survivors, never a row it disables), then "With selected:" and the
19
- * list's bulk actions. The checkbox is ticked when every row is, ticked
18
+ * survivors, never a row it disables), then how many rows are checked
19
+ * ("3 of 8 selected", as a status line says it) and the list's bulk
20
+ * actions. The checkbox is ticked when every row is, ticked
20
21
  * and mixed when some are, and clear when none are, and follows each row's
21
22
  * change. A list with no row to check draws it disabled. Its words come
22
23
  * from the `selectAll` labels; pair it with `checkedAfterClick` for the