@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.
- package/CHANGELOG.md +88 -1
- package/README.md +1 -1
- package/dist/activity/ActivityBar.d.ts +21 -8
- package/dist/activity/ActivityBar.js +15 -5
- package/dist/activity/activity.css +53 -6
- package/dist/button/Button.d.ts +10 -6
- package/dist/button/Button.js +6 -1
- package/dist/button/button.css +201 -33
- package/dist/charts/Line.logic.d.ts +6 -0
- package/dist/charts/Line.logic.js +9 -0
- package/dist/charts/LineChart.js +11 -4
- package/dist/charts/Pie.logic.d.ts +89 -1
- package/dist/charts/Pie.logic.js +272 -2
- package/dist/charts/PieChart.d.ts +2 -1
- package/dist/charts/PieChart.js +12 -5
- package/dist/charts/PieFill.d.ts +15 -0
- package/dist/charts/PieFill.js +33 -0
- package/dist/charts/ResultChart.d.ts +2 -2
- package/dist/charts/ResultChart.js +173 -47
- package/dist/charts/ResultChart.logic.d.ts +60 -4
- package/dist/charts/ResultChart.logic.js +105 -6
- package/dist/charts/Scatter.logic.d.ts +18 -4
- package/dist/charts/Scatter.logic.js +98 -22
- package/dist/charts/ScatterChart.js +19 -5
- package/dist/charts/charts.css +233 -116
- package/dist/charts/seriesColour.d.ts +2 -0
- package/dist/charts/seriesColour.js +1 -1
- package/dist/datetime/DateTimePicker.d.ts +12 -2
- package/dist/datetime/DateTimePicker.js +61 -16
- package/dist/datetime/DateTimePicker.logic.d.ts +29 -0
- package/dist/datetime/DateTimePicker.logic.js +25 -0
- package/dist/datetime/datetime.css +89 -49
- package/dist/dialog/ConfirmDialog.d.ts +69 -20
- package/dist/dialog/ConfirmDialog.js +39 -12
- package/dist/dialog/DialogLayer.d.ts +25 -0
- package/dist/dialog/DialogLayer.js +24 -0
- package/dist/dialog/DialogLegend.d.ts +2 -1
- package/dist/dialog/DialogLegend.js +10 -5
- package/dist/dialog/DialogLegend.logic.d.ts +15 -3
- package/dist/dialog/DialogLegend.logic.js +8 -4
- package/dist/dialog/DialogLists.d.ts +157 -0
- package/dist/dialog/DialogLists.js +137 -0
- package/dist/dialog/ModalDialog.d.ts +20 -15
- package/dist/dialog/ModalDialog.js +22 -7
- package/dist/dialog/dialog.css +570 -127
- package/dist/dialog/index.d.ts +7 -1
- package/dist/dialog/index.js +7 -1
- package/dist/field/Check.d.ts +15 -0
- package/dist/field/Check.js +23 -0
- package/dist/field/field.css +812 -0
- package/dist/field/index.d.ts +10 -0
- package/dist/field/index.js +10 -0
- package/dist/field/labelHelp.d.ts +33 -0
- package/dist/field/labelHelp.js +22 -0
- package/dist/filter/FilterIcon.js +2 -1
- package/dist/filter/filter.css +72 -20
- package/dist/grid/DataGrid.d.ts +8 -1
- package/dist/grid/DataGrid.js +115 -40
- package/dist/grid/DataGrid.logic.d.ts +15 -3
- package/dist/grid/DataGrid.logic.js +18 -5
- package/dist/grid/grid.css +481 -56
- package/dist/icon/Spinner.d.ts +16 -0
- package/dist/icon/Spinner.js +13 -0
- package/dist/icon/index.d.ts +5 -0
- package/dist/icon/index.js +5 -0
- package/dist/icon/sizes.d.ts +19 -0
- package/dist/icon/sizes.js +19 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/keychord/KeyChord.d.ts +12 -1
- package/dist/keychord/KeyChord.js +2 -2
- package/dist/keychord/index.d.ts +1 -1
- package/dist/keychord/keychord.css +87 -9
- package/dist/labels/dialog.d.ts +12 -1
- package/dist/labels/dialog.js +3 -1
- package/dist/labels/selectAll.d.ts +4 -4
- package/dist/labels/selectAll.js +1 -1
- package/dist/legend/KeyLegendStrip.js +1 -1
- package/dist/legend/legend.css +82 -57
- package/dist/listing/Listing.d.ts +17 -10
- package/dist/listing/Listing.js +33 -26
- package/dist/listing/listing.css +1665 -237
- package/dist/menu/menu.css +227 -67
- package/dist/menu/useBellBeat.js +2 -2
- package/dist/namecut/NameCut.d.ts +3 -1
- package/dist/namecut/NameCut.js +152 -5
- package/dist/namecut/NameCut.logic.d.ts +5 -3
- package/dist/namecut/NameCut.logic.js +20 -5
- package/dist/namecut/namecut.css +27 -7
- package/dist/pager/Pager.d.ts +12 -4
- package/dist/pager/Pager.js +21 -7
- package/dist/pager/pager.css +41 -30
- package/dist/palette/Palette.js +2 -1
- package/dist/palette/palette.css +121 -60
- package/dist/pane/PaneActions.d.ts +56 -14
- package/dist/pane/PaneActions.js +64 -16
- package/dist/pane/PaneFrame.d.ts +37 -5
- package/dist/pane/PaneFrame.js +246 -11
- package/dist/pane/index.d.ts +4 -2
- package/dist/pane/index.js +4 -2
- package/dist/pane/toolWords.d.ts +14 -0
- package/dist/pane/toolWords.js +26 -0
- package/dist/pane/useToolbarFit.d.ts +25 -0
- package/dist/pane/useToolbarFit.js +95 -0
- package/dist/run/RunHeader.d.ts +5 -3
- package/dist/run/RunHeader.js +11 -8
- package/dist/run/run.css +64 -79
- package/dist/segmented/SegmentedChoice.d.ts +18 -2
- package/dist/segmented/SegmentedChoice.js +18 -7
- package/dist/segmented/segmented.css +62 -22
- package/dist/selectall/SelectAllBar.d.ts +4 -3
- package/dist/selectall/SelectAllBar.js +4 -3
- package/dist/selectall/selectall.css +17 -12
- package/dist/shell/shell.css +1073 -0
- package/dist/styles.css +620 -22
- package/dist/surface/surface.css +154 -0
- package/dist/tabs/PageTabs.d.ts +10 -5
- package/dist/tabs/PageTabs.js +126 -37
- package/dist/tabs/tabs.css +131 -51
- package/dist/terminal/Terminal.js +3 -1
- package/dist/terminal/Terminal.logic.d.ts +5 -4
- package/dist/terminal/Terminal.logic.js +9 -4
- package/dist/terminal/TerminalMenu.d.ts +4 -1
- package/dist/terminal/TerminalMenu.js +12 -5
- package/dist/terminal/ghostty/contrast.logic.d.ts +45 -0
- package/dist/terminal/ghostty/contrast.logic.js +130 -0
- package/dist/terminal/ghostty/core.d.ts +6 -0
- package/dist/terminal/ghostty/renderer.d.ts +9 -2
- package/dist/terminal/ghostty/renderer.js +91 -14
- package/dist/terminal/ghostty/surface.d.ts +8 -0
- package/dist/terminal/ghostty/surface.js +27 -1
- package/dist/terminal/terminal.css +87 -61
- package/dist/text/text.css +16 -7
- package/dist/themes/catalog.js +4 -3
- package/dist/themes/themes.generated.css +1307 -264
- package/dist/themes/tokens.d.ts +69 -14
- package/dist/themes/tokens.js +920 -97
- package/dist/tokens.css +239 -0
- package/dist/tooltip/Tooltip.d.ts +6 -0
- package/dist/tooltip/Tooltip.js +48 -6
- package/dist/tooltip/Tooltip.logic.d.ts +89 -12
- package/dist/tooltip/Tooltip.logic.js +142 -20
- package/dist/tooltip/index.d.ts +1 -1
- package/dist/tooltip/index.js +1 -1
- package/dist/tooltip/tooltip.css +39 -9
- 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
|
+
}
|
package/dist/run/RunHeader.d.ts
CHANGED
|
@@ -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.
|
|
47
|
-
* by
|
|
48
|
-
*
|
|
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;
|
package/dist/run/RunHeader.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { CircleCheck, CirclePause, CircleSlash, CircleX, Hourglass
|
|
2
|
+
import { CircleCheck, CirclePause, CircleSlash, CircleX, Hourglass } from 'lucide-react';
|
|
3
3
|
import { ActivityBar } from '../activity/ActivityBar.js';
|
|
4
|
-
|
|
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.
|
|
23
|
-
* by
|
|
24
|
-
*
|
|
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
|
|
5
|
-
|
|
6
|
-
|
|
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:
|
|
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:
|
|
22
|
+
column-gap: var(--space-4);
|
|
20
23
|
}
|
|
21
24
|
|
|
22
|
-
/*
|
|
25
|
+
/* A large icon centred on the headline's line. */
|
|
23
26
|
.run-header-glyph {
|
|
24
|
-
width:
|
|
25
|
-
height:
|
|
26
|
-
margin-top:
|
|
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
|
|
32
|
-
motion
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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:
|
|
65
|
-
font-weight:
|
|
66
|
-
line-height:
|
|
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:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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-
|
|
83
|
+
font-family: var(--font-mono);
|
|
84
|
+
font-size: var(--font-size-heading);
|
|
84
85
|
font-variant-numeric: tabular-nums;
|
|
85
|
-
font-weight:
|
|
86
|
-
line-height:
|
|
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
|
-
.
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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
|
-
|
|
115
|
-
|
|
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
|
-
|
|
124
|
-
|
|
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
|
-
|
|
133
|
-
|
|
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:
|
|
133
|
+
gap: var(--space-4);
|
|
140
134
|
min-width: 0;
|
|
141
135
|
overflow: hidden;
|
|
142
136
|
color: var(--text-dim);
|
|
143
|
-
font-size:
|
|
137
|
+
font-size: var(--font-size-small);
|
|
144
138
|
font-variant-numeric: tabular-nums;
|
|
145
|
-
line-height:
|
|
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: -
|
|
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:
|
|
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:
|
|
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
|
|
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
|
|
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
|
|
15
|
-
|
|
16
|
-
|
|
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
|
|
4
|
-
|
|
5
|
-
|
|
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:
|
|
27
|
+
gap: var(--space-1);
|
|
28
|
+
min-height: var(--segmented-height, var(--control-height-sm));
|
|
11
29
|
margin: 0;
|
|
12
|
-
padding:
|
|
13
|
-
border-radius:
|
|
14
|
-
background:
|
|
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
|
-
|
|
21
|
-
|
|
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:
|
|
49
|
+
border-radius: calc(var(--radius-md) - var(--space-1) - var(--line));
|
|
24
50
|
background: transparent;
|
|
25
|
-
color: var(--text-
|
|
51
|
+
color: var(--text-on-surface);
|
|
26
52
|
font-family: var(--font-ui);
|
|
27
|
-
font-size:
|
|
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:
|
|
57
|
+
cursor: default;
|
|
30
58
|
}
|
|
31
59
|
|
|
32
|
-
.segmented-choice-option
|
|
33
|
-
|
|
60
|
+
.segmented-choice-option > svg {
|
|
61
|
+
flex: none;
|
|
62
|
+
width: var(--icon-sm);
|
|
63
|
+
height: var(--icon-sm);
|
|
34
64
|
}
|
|
35
65
|
|
|
36
|
-
|
|
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
|
|
40
|
-
|
|
41
|
-
var(--shadow-
|
|
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
|
-
|
|
48
|
-
|
|
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
|
|
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
|
|
19
|
-
*
|
|
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
|