@glimstone/react 4.9.1 → 5.0.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/README.md +3 -2
- package/dist/AngleSlider.d.ts +1 -1
- package/dist/AngleSlider.js +17 -4
- package/dist/Avatar.js +1 -1
- package/dist/Badge.d.ts +3 -6
- package/dist/Badge.js +2 -2
- package/dist/Card.d.ts +4 -1
- package/dist/Card.js +2 -2
- package/dist/Chart.d.ts +30 -0
- package/dist/Chart.js +22 -0
- package/dist/Checkbox.js +1 -2
- package/dist/ColorPicker.d.ts +3 -1
- package/dist/ColorPicker.js +22 -5
- package/dist/Combobox.js +14 -4
- package/dist/ConfirmDialog.js +4 -2
- package/dist/ConnectionRow.d.ts +3 -1
- package/dist/ConnectionRow.js +2 -2
- package/dist/ContextMenu.d.ts +3 -1
- package/dist/ContextMenu.js +3 -3
- package/dist/DatePicker.js +6 -1
- package/dist/FieldRow.d.ts +1 -1
- package/dist/FieldRow.js +8 -4
- package/dist/FileUpload.d.ts +3 -1
- package/dist/FileUpload.js +6 -3
- package/dist/FortressPermissions.js +3 -2
- package/dist/HoverCard.d.ts +13 -3
- package/dist/HoverCard.js +3 -3
- package/dist/IconTipButton.d.ts +4 -1
- package/dist/IconTipButton.js +3 -3
- package/dist/InfoBubble.js +1 -1
- package/dist/{AboutCard.d.ts → InfoTile.d.ts} +0 -44
- package/dist/{AboutCard.js → InfoTile.js} +1 -28
- package/dist/ListRow.d.ts +19 -4
- package/dist/ListRow.js +15 -2
- package/dist/ListTable.d.ts +6 -1
- package/dist/ListTable.js +19 -6
- package/dist/Meter.d.ts +5 -1
- package/dist/Meter.js +8 -3
- package/dist/MultiSelect.d.ts +18 -0
- package/dist/MultiSelect.js +60 -0
- package/dist/NotifyCard.js +1 -1
- package/dist/NumberField.js +2 -2
- package/dist/Pagination.js +7 -4
- package/dist/PasswordField.js +10 -4
- package/dist/PinInput.js +3 -3
- package/dist/Rating.js +9 -3
- package/dist/Select.js +8 -4
- package/dist/Selector.d.ts +5 -4
- package/dist/Selector.js +21 -4
- package/dist/SettingsNav.d.ts +41 -0
- package/dist/SettingsNav.js +48 -0
- package/dist/SignInTile.js +48 -24
- package/dist/SkeletonRow.d.ts +5 -1
- package/dist/SkeletonRow.js +3 -3
- package/dist/Slider.js +1 -1
- package/dist/StatusSummary.d.ts +16 -0
- package/dist/StatusSummary.js +8 -0
- package/dist/SubCard.d.ts +6 -7
- package/dist/SubCard.js +4 -6
- package/dist/TextField.d.ts +1 -1
- package/dist/TextField.js +17 -6
- package/dist/TimePicker.d.ts +30 -0
- package/dist/TimePicker.js +146 -0
- package/dist/Timer.js +6 -1
- package/dist/Toast.d.ts +3 -1
- package/dist/Toast.js +9 -7
- package/dist/Toggle.js +1 -1
- package/dist/Tour.js +6 -3
- package/dist/Window.d.ts +3 -1
- package/dist/Window.js +2 -2
- package/dist/engines.d.ts +7 -1
- package/dist/engines.js +17 -2
- package/dist/fieldErrorLine.d.ts +4 -0
- package/dist/fieldErrorLine.js +18 -0
- package/dist/glyphs.d.ts +2 -0
- package/dist/glyphs.js +2 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +5 -2
- package/dist/searchHit.d.ts +4 -0
- package/dist/searchHit.js +10 -0
- package/dist/useTipBubble.d.ts +11 -2
- package/dist/useTipBubble.js +14 -10
- package/package.json +3 -3
- package/dist/DropdownListbox.d.ts +0 -22
- package/dist/DropdownListbox.js +0 -190
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type TimePickerText } from "@glimstone/core";
|
|
2
|
+
export type { TimePickerText } from "@glimstone/core";
|
|
3
|
+
export interface TimePickerProps {
|
|
4
|
+
label?: string;
|
|
5
|
+
/** The time as "08:30", or null while a segment is empty. */
|
|
6
|
+
value: string | null;
|
|
7
|
+
onChange: (value: string | null) => void;
|
|
8
|
+
/** How far an arrow moves the minutes. */
|
|
9
|
+
minuteStep?: number;
|
|
10
|
+
/** The name the time is sent under in a form. */
|
|
11
|
+
name?: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
/** The segments' names. English where left out. */
|
|
14
|
+
text?: Partial<TimePickerText>;
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface TimeRangePickerProps {
|
|
18
|
+
label?: string;
|
|
19
|
+
/** The start and the end as "08:00", each null while one of its segments is empty. */
|
|
20
|
+
value: [string | null, string | null];
|
|
21
|
+
onChange: (value: [string | null, string | null]) => void;
|
|
22
|
+
/** How far an arrow moves the minutes. */
|
|
23
|
+
minuteStep?: number;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
/** The segments' names, the halves' and the word between them. English where left out. */
|
|
26
|
+
text?: Partial<TimePickerText>;
|
|
27
|
+
className?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare function TimePicker({ value, onChange, name, ...shared }: TimePickerProps): import("react").JSX.Element;
|
|
30
|
+
export declare function TimeRangePicker({ value, onChange, ...shared }: TimeRangePickerProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, useEffect, useId, useLayoutEffect, useRef, useState } from "react";
|
|
3
|
+
import { DIAL, TIME_PICKER_TEXT, anchorName, attachDial, dialAngle, dialInner, dialMarks, dialSegment, faceOf, floatBeside, formatTime, nearestTurn, parseTime, segmentText, stepSegment, timeKey, timeRangeValue, timeWheel, wheelSegments, } from "@glimstone/core";
|
|
4
|
+
import { useFieldName } from "./fieldName.js";
|
|
5
|
+
export function TimePicker({ value, onChange, name, ...shared }) {
|
|
6
|
+
const [values, setValues] = useSegments([value]);
|
|
7
|
+
return (_jsx(TimeShell, { ...shared, "data-glim": "TimePicker", values: values, onValues: (next) => {
|
|
8
|
+
setValues(next);
|
|
9
|
+
const time = formatTime(next);
|
|
10
|
+
if (time !== value)
|
|
11
|
+
onChange(time);
|
|
12
|
+
}, children: name && _jsx("input", { type: "hidden", name: name, value: formatTime(values) ?? "" }) }));
|
|
13
|
+
}
|
|
14
|
+
export function TimeRangePicker({ value, onChange, ...shared }) {
|
|
15
|
+
const [values, setValues] = useSegments(value);
|
|
16
|
+
return (_jsx(TimeShell, { ...shared, "data-glim": "TimeRangePicker", values: values, onValues: (next) => {
|
|
17
|
+
setValues(next);
|
|
18
|
+
const span = timeRangeValue(next);
|
|
19
|
+
if (span[0] !== value[0] || span[1] !== value[1])
|
|
20
|
+
onChange(span);
|
|
21
|
+
} }));
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The segments of one or two times. A time from the app replaces its
|
|
25
|
+
* segments, and so does a null that clears a whole time, but a half-typed
|
|
26
|
+
* time the app only knows as null stays.
|
|
27
|
+
*/
|
|
28
|
+
function useSegments(times) {
|
|
29
|
+
const [values, setValues] = useState(() => times.flatMap(parseTime));
|
|
30
|
+
const key = times.join("|");
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
setValues((now) => times.flatMap((time, i) => {
|
|
33
|
+
const half = now.slice(i * 2, i * 2 + 2);
|
|
34
|
+
return time === null && formatTime(half) === null ? half : parseTime(time);
|
|
35
|
+
}));
|
|
36
|
+
}, [key]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
37
|
+
return [values, setValues];
|
|
38
|
+
}
|
|
39
|
+
function TimeShell({ "data-glim": glim, label, values, onValues, minuteStep = 1, disabled = false, text, className, children, }) {
|
|
40
|
+
const fieldName = useFieldName(label);
|
|
41
|
+
const words = { ...TIME_PICKER_TEXT, ...text };
|
|
42
|
+
const typed = useRef("");
|
|
43
|
+
const root = useRef(null);
|
|
44
|
+
const segments = useRef([]);
|
|
45
|
+
const range = values.length > 2;
|
|
46
|
+
// The segment the clock face edits while it is open.
|
|
47
|
+
const [dial, setDial] = useState(null);
|
|
48
|
+
const wheel = useRef(() => false);
|
|
49
|
+
useLayoutEffect(() => {
|
|
50
|
+
wheel.current = (at, deltaY) => {
|
|
51
|
+
const next = disabled ? null : timeWheel(values, at, deltaY, minuteStep);
|
|
52
|
+
if (next)
|
|
53
|
+
onValues(next);
|
|
54
|
+
return next !== null;
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
useEffect(() => wheelSegments(root.current, (at, deltaY) => wheel.current(at, deltaY)), []);
|
|
58
|
+
function focus(at) {
|
|
59
|
+
typed.current = "";
|
|
60
|
+
segments.current[at]?.focus();
|
|
61
|
+
}
|
|
62
|
+
function onKeyDown(at, e) {
|
|
63
|
+
if (disabled)
|
|
64
|
+
return;
|
|
65
|
+
const result = timeKey(values, at, e.key, typed.current, minuteStep);
|
|
66
|
+
if (!result)
|
|
67
|
+
return;
|
|
68
|
+
e.preventDefault();
|
|
69
|
+
if (result.values.some((v, i) => v !== values[i]))
|
|
70
|
+
onValues(result.values);
|
|
71
|
+
if (result.focus !== at)
|
|
72
|
+
focus(result.focus);
|
|
73
|
+
else
|
|
74
|
+
typed.current = result.buffer;
|
|
75
|
+
}
|
|
76
|
+
// A press into the field opens the face for the segment it hit, and a press
|
|
77
|
+
// beside the segments lands on the hours, as on a text field's padding.
|
|
78
|
+
function onMouseDown(e) {
|
|
79
|
+
if (disabled)
|
|
80
|
+
return;
|
|
81
|
+
const target = e.target;
|
|
82
|
+
const pressed = target.closest(".glim-time-seg");
|
|
83
|
+
const half = target.closest(".glim-time-half");
|
|
84
|
+
const at = dialSegment(pressed ? segments.current.indexOf(pressed) : null, half ? [...root.current.querySelectorAll(".glim-time-half")].indexOf(half) : null);
|
|
85
|
+
if (!pressed) {
|
|
86
|
+
e.preventDefault();
|
|
87
|
+
focus(at);
|
|
88
|
+
}
|
|
89
|
+
setDial(at);
|
|
90
|
+
}
|
|
91
|
+
function setSegment(at, value) {
|
|
92
|
+
if (values[at] !== value)
|
|
93
|
+
onValues(values.map((v, i) => (i === at ? value : v)));
|
|
94
|
+
}
|
|
95
|
+
const segment = (at) => (_jsx("span", { ref: (el) => {
|
|
96
|
+
segments.current[at] = el;
|
|
97
|
+
}, role: "spinbutton", tabIndex: disabled ? -1 : 0, "aria-label": at % 2 === 0 ? words.hour : words.minute, "aria-valuemin": 0, "aria-valuemax": at % 2 === 0 ? 23 : 59, "aria-valuenow": values[at] ?? undefined, "aria-valuetext": values[at] === null ? undefined : segmentText(values[at]), "aria-disabled": disabled || undefined, "data-empty": values[at] === null ? "" : undefined, "data-editing": dial === at ? "" : undefined, className: "glim-time-seg", onKeyDown: (e) => onKeyDown(at, e), onFocus: () => {
|
|
98
|
+
typed.current = "";
|
|
99
|
+
if (dial !== null)
|
|
100
|
+
setDial(at);
|
|
101
|
+
}, children: segmentText(values[at]) }));
|
|
102
|
+
const time = (first) => (_jsxs(_Fragment, { children: [segment(first), _jsx("span", { className: "glim-time-colon", "aria-hidden": "true", children: ":" }), segment(first + 1)] }));
|
|
103
|
+
return (_jsxs("div", { ref: root, "data-glim": glim, role: "group", "aria-label": fieldName, "data-disabled": disabled ? "" : undefined, className: ["glim-time", className].filter(Boolean).join(" "), onMouseDown: onMouseDown, onBlur: (e) => {
|
|
104
|
+
if (!e.currentTarget.contains(e.relatedTarget))
|
|
105
|
+
setDial(null);
|
|
106
|
+
}, children: [range
|
|
107
|
+
? [0, 2].map((first) => (_jsxs(Fragment, { children: [first > 0 && (_jsx("span", { className: "glim-time-to", "aria-hidden": "true", children: words.to })), _jsx("span", { role: "group", "aria-label": first === 0 ? words.start : words.end, className: "glim-time-half", children: time(first) })] }, first)))
|
|
108
|
+
: time(0), dial !== null && (_jsx(TimeDial, { anchor: root.current, face: faceOf(dial), value: values[dial] ?? null, minuteStep: minuteStep, onPoint: (value, done) => {
|
|
109
|
+
setSegment(dial, value);
|
|
110
|
+
if (!done)
|
|
111
|
+
return;
|
|
112
|
+
if (dial % 2 === 0)
|
|
113
|
+
focus(dial + 1);
|
|
114
|
+
else
|
|
115
|
+
setDial(null);
|
|
116
|
+
}, onTurn: (delta) => setSegment(dial, stepSegment(values[dial] ?? null, dial, delta, dial % 2 === 1 ? minuteStep : 1)), onClose: () => setDial(null) })), children] }));
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* The clock face over a time field, a pointer aid on top of the segments: it
|
|
120
|
+
* floats beside the field without the focus and is hidden from a screen
|
|
121
|
+
* reader, since the segments it edits are the controls.
|
|
122
|
+
*/
|
|
123
|
+
function TimeDial({ anchor, face, value, minuteStep, onPoint, onTurn, onClose, }) {
|
|
124
|
+
const panel = useRef(null);
|
|
125
|
+
const plate = useRef(null);
|
|
126
|
+
const id = useId();
|
|
127
|
+
const latest = useRef({ face, minuteStep, onPoint, onTurn, onClose });
|
|
128
|
+
useLayoutEffect(() => {
|
|
129
|
+
latest.current = { face, minuteStep, onPoint, onTurn, onClose };
|
|
130
|
+
});
|
|
131
|
+
useLayoutEffect(() => floatBeside(panel.current, anchor, anchorName(id), () => latest.current.onClose()), [anchor, id]);
|
|
132
|
+
useEffect(() => attachDial(plate.current, {
|
|
133
|
+
face: () => latest.current.face,
|
|
134
|
+
step: () => latest.current.minuteStep,
|
|
135
|
+
point: (v, done) => latest.current.onPoint(v, done),
|
|
136
|
+
turn: (delta) => latest.current.onTurn(delta),
|
|
137
|
+
}), []);
|
|
138
|
+
// The hand keeps the turn it stands at, so the next value is reached the short way round.
|
|
139
|
+
const turned = useRef(0);
|
|
140
|
+
if (value !== null)
|
|
141
|
+
turned.current = nearestTurn(turned.current, dialAngle(face, value));
|
|
142
|
+
const reach = value !== null && dialInner(face, value) ? DIAL.inner : DIAL.outer;
|
|
143
|
+
const marks = dialMarks(face);
|
|
144
|
+
const middle = DIAL.size / 2;
|
|
145
|
+
return (_jsx("div", { ref: panel, popover: "manual", "aria-hidden": "true", "data-face": face, className: "glim-popover glim-time-dial", children: _jsxs("svg", { ref: plate, viewBox: `0 0 ${DIAL.size} ${DIAL.size}`, children: [_jsx("circle", { className: "glim-time-dial-plate", cx: middle, cy: middle, r: middle }), value !== null && (_jsxs("g", { className: "glim-time-dial-hand", "data-value": value, style: { transform: `rotate(${turned.current}deg)` }, children: [_jsx("line", { x1: middle, y1: middle, x2: middle, y2: middle - reach }), _jsx("circle", { cx: middle, cy: middle - reach, r: reach === DIAL.inner ? 14 : 16 }), !marks.some((m) => m.value === value) && _jsx("circle", { className: "glim-time-dial-dot", cx: middle, cy: middle - reach, r: 2 })] })), _jsx("circle", { className: "glim-time-dial-hub", cx: middle, cy: middle, r: 3 }), _jsx("g", { className: "glim-time-dial-marks", children: marks.map((m) => (_jsx("g", { className: "glim-time-dial-mark", "data-value": m.value, "data-inner": m.inner ? "" : undefined, "data-chosen": m.value === value ? "" : undefined, children: _jsx("text", { x: m.x, y: m.y, children: m.text }) }, m.value))) }, face)] }) }));
|
|
146
|
+
}
|
package/dist/Timer.js
CHANGED
|
@@ -10,5 +10,10 @@ export function Timer({ countdown = false, startMs = 0, targetMs, autoStart = fa
|
|
|
10
10
|
const service = useMachine(timer.machine, { id: useId(), countdown, startMs, targetMs, autoStart, interval: 250, onComplete });
|
|
11
11
|
const api = timer.connect(service, normalizeProps);
|
|
12
12
|
const { hours, minutes, seconds } = api.time;
|
|
13
|
-
|
|
13
|
+
// Zag's reset keeps a running timer going, and Reset waits for Start, so a running timer pauses first.
|
|
14
|
+
const reset = () => {
|
|
15
|
+
api.pause();
|
|
16
|
+
api.reset();
|
|
17
|
+
};
|
|
18
|
+
return (_jsxs("div", { "data-glim": "Timer", ...api.getRootProps(), className: "glim-timer", children: [_jsxs("div", { ...api.getAreaProps(), role: "timer", "aria-label": words.spoken(hours, minutes, seconds), "data-running": api.running ? "" : undefined, className: "glim-timer-figure glim-num", children: [_jsx("span", { ...api.getItemProps({ type: "hours" }), children: api.formattedTime.hours }), _jsx("span", { ...api.getSeparatorProps(), children: ":" }), _jsx("span", { ...api.getItemProps({ type: "minutes" }), children: api.formattedTime.minutes }), _jsx("span", { ...api.getSeparatorProps(), children: ":" }), _jsx("span", { ...api.getItemProps({ type: "seconds" }), children: api.formattedTime.seconds })] }), _jsxs("div", { ...api.getControlProps(), className: "glim-timer-control", children: [api.running ? (_jsx(Button, { label: words.pause, labelKey: null, glyph: _jsx(IconPause, {}), onClick: api.pause })) : api.paused ? (_jsx(Button, { label: words.resume, labelKey: null, glyph: _jsx(IconPlay, {}), onClick: api.resume })) : (_jsx(Button, { label: words.start, labelKey: null, glyph: _jsx(IconPlay, {}), onClick: api.start })), _jsx(Button, { label: words.reset, labelKey: null, glyph: _jsx(IconResetArrow, {}), onClick: reset })] })] }));
|
|
14
19
|
}
|
package/dist/Toast.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { type ToastAction, type ToastSeverity, type ToastViewportEntry } from "@
|
|
|
2
2
|
export type { ToastViewportEntry } from "@glimstone/core";
|
|
3
3
|
export interface ToastCardProps {
|
|
4
4
|
id: string;
|
|
5
|
+
/** A short first line; the message then reads as its description. */
|
|
6
|
+
title?: string;
|
|
5
7
|
message: string;
|
|
6
8
|
severity: ToastSeverity;
|
|
7
9
|
/** A button such as Undo. A press runs it and dismisses the toast. */
|
|
@@ -14,7 +16,7 @@ export interface ToastCardProps {
|
|
|
14
16
|
onFocus: (id: string) => void;
|
|
15
17
|
onBlur: (id: string) => void;
|
|
16
18
|
}
|
|
17
|
-
export declare function ToastCard({ id, message, severity, action, dismissLabel, onDismiss, onMouseEnter, onMouseLeave, onFocus, onBlur, }: ToastCardProps): import("react").JSX.Element;
|
|
19
|
+
export declare function ToastCard({ id, title, message, severity, action, dismissLabel, onDismiss, onMouseEnter, onMouseLeave, onFocus, onBlur, }: ToastCardProps): import("react").JSX.Element;
|
|
18
20
|
export interface ToastViewportProps {
|
|
19
21
|
toasts: ToastViewportEntry[];
|
|
20
22
|
dismissLabel: string;
|
package/dist/Toast.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Fragment, useEffect, useRef } from "react";
|
|
3
|
-
import { announce, liveRegionAttrs, MARKS, softBreaks, TOAST_MARKS, toastPoliteness } from "@glimstone/core";
|
|
2
|
+
import { Fragment, useEffect, useLayoutEffect, useRef } from "react";
|
|
3
|
+
import { announce, leaveBehind, liveRegionAttrs, MARKS, softBreaks, TOAST_MARKS, toastAnnouncement, toastPoliteness, watchToastStack } from "@glimstone/core";
|
|
4
4
|
import { Button } from "./Button.js";
|
|
5
5
|
import { MarkSvg } from "./glyphs.js";
|
|
6
|
-
export function ToastCard({ id, message, severity, action, dismissLabel, onDismiss, onMouseEnter, onMouseLeave, onFocus, onBlur, }) {
|
|
7
|
-
return (_jsxs("div", { "data-glim": "ToastCard",
|
|
6
|
+
export function ToastCard({ id, title, message, severity, action, dismissLabel, onDismiss, onMouseEnter, onMouseLeave, onFocus, onBlur, }) {
|
|
7
|
+
return (_jsxs("div", { ref: leaveBehind, "data-glim": "ToastCard",
|
|
8
8
|
// React's onFocus and onBlur bubble, so tabbing onto the dismiss button
|
|
9
9
|
// pauses the countdown like a hover does.
|
|
10
10
|
onMouseEnter: () => onMouseEnter(id), onMouseLeave: () => onMouseLeave(id), onFocus: () => onFocus(id), onBlur: () => onBlur(id), onKeyDown: (e) => {
|
|
@@ -12,7 +12,7 @@ export function ToastCard({ id, message, severity, action, dismissLabel, onDismi
|
|
|
12
12
|
e.stopPropagation();
|
|
13
13
|
onDismiss(id);
|
|
14
14
|
}
|
|
15
|
-
}, className: "glim-toast glim-toast-card", children: [_jsx(MarkSvg, { mark: TOAST_MARKS[severity], className: `glim-toast-glyph glim-toast-glyph--${severity}` }), _jsxs("div", { className: "glim-toast-body", children: [_jsx("p", { className: "glim-toast-message", children: softBreaks(message).map((part, i) => (_jsxs(Fragment, { children: [i > 0 && _jsx("wbr", {}), part] }, i))) }), action && (_jsx(Button, { className: "glim-toast-action", tone: "subtle", label: action.label, labelKey: null, onClick: () => {
|
|
15
|
+
}, className: title ? "glim-toast glim-toast-card glim-toast-card--titled" : "glim-toast glim-toast-card", children: [_jsx(MarkSvg, { mark: TOAST_MARKS[severity], className: `glim-toast-glyph glim-toast-glyph--${severity}` }), _jsxs("div", { className: "glim-toast-body", children: [title && _jsx("p", { className: "glim-toast-title", children: title }), _jsx("p", { className: "glim-toast-message", children: softBreaks(message).map((part, i) => (_jsxs(Fragment, { children: [i > 0 && _jsx("wbr", {}), part] }, i))) }), action && (_jsx(Button, { className: "glim-toast-action", tone: "subtle", label: action.label, labelKey: null, onClick: () => {
|
|
16
16
|
action.onClick();
|
|
17
17
|
onDismiss(id);
|
|
18
18
|
} }))] }), _jsx("button", { type: "button", onClick: () => onDismiss(id), "aria-label": dismissLabel, className: "glim-btn-bare glim-toast-dismiss", children: _jsx(MarkSvg, { mark: MARKS.dismiss }) })] }));
|
|
@@ -29,8 +29,10 @@ export function ToastViewport({ toasts, dismissLabel, onDismiss, onMouseEnter, o
|
|
|
29
29
|
if (heard.current.has(t.id))
|
|
30
30
|
continue;
|
|
31
31
|
heard.current.add(t.id);
|
|
32
|
-
announce(t
|
|
32
|
+
announce(toastAnnouncement(t), toastPoliteness(t.severity));
|
|
33
33
|
}
|
|
34
34
|
}, [toasts]);
|
|
35
|
-
|
|
35
|
+
const stack = useRef(null);
|
|
36
|
+
useLayoutEffect(() => watchToastStack(stack.current), []);
|
|
37
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "glim-sr-only", ...liveRegionAttrs("polite") }), _jsx("div", { className: "glim-sr-only", ...liveRegionAttrs("assertive") }), _jsx("div", { ref: stack, "data-glim": "ToastViewport", className: "glim-toast-stack", children: toasts.map((t) => (_jsx(ToastCard, { id: t.id, title: t.title, message: t.message, severity: t.severity, action: t.action, dismissLabel: dismissLabel, onDismiss: onDismiss, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onFocus: onFocus, onBlur: onBlur }, t.id))) })] }));
|
|
36
38
|
}
|
package/dist/Toggle.js
CHANGED
|
@@ -10,7 +10,7 @@ export function Toggle({ checked, onChange, label, hideLabel = false, disabled,
|
|
|
10
10
|
useEffect(() => (shakes > 0 ? shake(frame.current) : undefined), [shakes]);
|
|
11
11
|
const tip = useTipBubble(refused);
|
|
12
12
|
const reason = useId();
|
|
13
|
-
return (_jsxs(_Fragment, { children: [_jsxs("span", { "data-glim": "Toggle", ref: frame, className: `glim-toggle${className ? ` ${className}` : ""}`, style: style, children: [label !== undefined && !hideLabel && _jsx("span", { className: "glim-toggle-label", children: label }), _jsx("button", { ...rest, ...(refused ? tip.handlers : {}), ref: tip.ref, type: "button", role: "switch", "aria-checked": checked, "aria-label": name, "aria-disabled": refused ? true : undefined, "aria-describedby": refused ? reason : rest["aria-describedby"], disabled: disabled, onClick: (e) => {
|
|
13
|
+
return (_jsxs(_Fragment, { children: [_jsxs("span", { "data-glim": "Toggle", ref: frame, className: `glim-toggle${className ? ` ${className}` : ""}`, style: style, children: [label !== undefined && !hideLabel && (_jsx("span", { className: "glim-toggle-label", onClick: () => frame.current?.querySelector(".glim-toggle-track")?.click(), children: label })), _jsx("button", { ...rest, ...(refused ? tip.handlers : {}), ref: tip.ref, type: "button", role: "switch", "aria-checked": checked, "aria-label": name, "aria-disabled": refused ? true : undefined, "aria-describedby": refused ? reason : rest["aria-describedby"], disabled: disabled, onClick: (e) => {
|
|
14
14
|
onClick?.(e);
|
|
15
15
|
if (refused)
|
|
16
16
|
setShakes((n) => n + 1);
|
package/dist/Tour.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useId } from "react";
|
|
2
|
+
import { useEffect, useId, useState } from "react";
|
|
3
3
|
import * as tour from "@zag-js/tour";
|
|
4
4
|
import { normalizeProps, Portal, useMachine } from "@zag-js/react";
|
|
5
|
-
import { TOUR_TEXT, pageDir, portalTarget, tourSteps } from "@glimstone/core";
|
|
5
|
+
import { TOUR_TEXT, pageDir, portalTarget, tourDots, tourSpotlight, tourSteps } from "@glimstone/core";
|
|
6
6
|
import { Badge } from "./Badge.js";
|
|
7
7
|
import { Button } from "./Button.js";
|
|
8
8
|
import { IconBack, IconCheck, IconForward } from "./glyphs.js";
|
|
9
9
|
export function Tour({ steps, open, onOpenChange, text }) {
|
|
10
10
|
const words = { ...TOUR_TEXT, ...text };
|
|
11
|
+
const [at, setAt] = useState(0);
|
|
11
12
|
const service = useMachine(tour.machine, {
|
|
12
13
|
id: useId(),
|
|
13
14
|
dir: pageDir(),
|
|
14
15
|
steps: tourSteps(steps),
|
|
16
|
+
...tourSpotlight(steps, at),
|
|
17
|
+
onStepChange: (d) => setAt(d.stepIndex),
|
|
15
18
|
onStatusChange: (d) => {
|
|
16
19
|
if (d.status === "dismissed" || d.status === "completed" || d.status === "skipped") {
|
|
17
20
|
onOpenChange(false);
|
|
@@ -26,5 +29,5 @@ export function Tour({ steps, open, onOpenChange, text }) {
|
|
|
26
29
|
if (open && !api.open)
|
|
27
30
|
api.start();
|
|
28
31
|
}, [open]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
29
|
-
return (_jsx(Portal, { container: { current: portalTarget() }, children: api.open && api.step && (_jsxs("div", { "data-glim": "Tour", className: "glim-tour-layer", children: [_jsx("div", { ...api.getBackdropProps(), className: "glim-tour-backdrop" }), _jsx("div", { ...api.getSpotlightProps(), className: "glim-tour-spotlight" }), _jsx("div", { ...api.getPositionerProps(), className: "glim-tour-positioner", children: _jsxs("div", { ...api.getContentProps(), className: "glim-tour", children: [_jsx("h2", { ...api.getTitleProps(), className: "glim-panel-heading", children: _jsx(Badge, { tone: "heading", size: "heading", wrap: true, children: api.step.title }) }), _jsx("p", { ...api.getDescriptionProps(), className: "glim-tour-text", children: api.step.description }), _jsxs("div", { className: "glim-tour-foot", children: [
|
|
32
|
+
return (_jsx(Portal, { container: { current: portalTarget() }, children: api.open && api.step && (_jsxs("div", { "data-glim": "Tour", className: "glim-tour-layer", children: [_jsx("div", { ...api.getBackdropProps(), className: "glim-tour-backdrop" }), _jsx("div", { ...api.getSpotlightProps(), className: "glim-tour-spotlight" }), _jsx("div", { ...api.getPositionerProps(), className: "glim-tour-positioner", children: _jsxs("div", { ...api.getContentProps(), className: "glim-tour", children: [_jsx("h2", { ...api.getTitleProps(), className: "glim-panel-heading", children: _jsx(Badge, { tone: "heading", size: "heading", wrap: true, children: api.step.title }) }), _jsx("p", { ...api.getDescriptionProps(), className: "glim-tour-text", children: api.step.description }), _jsxs("div", { className: "glim-tour-foot", children: [_jsxs("span", { ...api.getProgressTextProps(), className: "glim-tour-progress", children: [_jsx("span", { className: "glim-sr-only", children: words.progress(api.stepIndex + 1, api.totalSteps) }), tourDots(api.totalSteps, api.stepIndex).map((current, i) => (_jsx("span", { "aria-hidden": "true", className: "glim-tour-dot", "data-current": current || undefined }, i)))] }), _jsx(Button, { label: words.back, labelKey: null, glyph: _jsx(IconBack, {}), disabled: !api.hasPrevStep, onClick: api.prev }), api.lastStep ? (_jsx(Button, { label: words.close, labelKey: null, glyph: _jsx(IconCheck, {}), tone: "accent", onClick: end })) : (_jsx(Button, { label: words.next, labelKey: null, glyph: _jsx(IconForward, {}), tone: "accent", onClick: api.next }))] })] }) })] })) }));
|
|
30
33
|
}
|
package/dist/Window.d.ts
CHANGED
|
@@ -14,7 +14,9 @@ export interface WindowProps extends Omit<HTMLAttributes<HTMLDivElement>, "title
|
|
|
14
14
|
actions?: WindowAction[];
|
|
15
15
|
/** A quiet line at the start of the foot, such as where the work carries on. */
|
|
16
16
|
start?: ReactNode;
|
|
17
|
-
/** `
|
|
17
|
+
/** The width: `small` (400px) for a question, `normal` (560px) for a form,
|
|
18
|
+
* `large` (720px) for a longer form, `wide` (960px) for a list, `full` for
|
|
19
|
+
* a tool. */
|
|
18
20
|
size?: WindowSize;
|
|
19
21
|
/** The words of the way out the window adds. */
|
|
20
22
|
text: {
|
package/dist/Window.js
CHANGED
|
@@ -5,7 +5,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
5
5
|
// it on onClose. The other props of a <div> go to the card.
|
|
6
6
|
import { useId, useImperativeHandle, useLayoutEffect, useRef, useState } from "react";
|
|
7
7
|
import { createPortal } from "react-dom";
|
|
8
|
-
import { focusedAsker, menuIsOpen, returnFocus, stackWindow, windowFocusTarget, portalTarget, } from "@glimstone/core";
|
|
8
|
+
import { focusedAsker, menuIsOpen, returnFocus, leaveBehind, stackWindow, windowFocusTarget, portalTarget, } from "@glimstone/core";
|
|
9
9
|
import { Badge } from "./Badge.js";
|
|
10
10
|
import { WindowFootRow } from "./WindowFootRow.js";
|
|
11
11
|
export function Window({ title, drawn, children, actions = [], start, size = "normal", text, closeOnBackdrop = true, onClose, className, ref, ...rest }) {
|
|
@@ -34,7 +34,7 @@ export function Window({ title, drawn, children, actions = [], start, size = "no
|
|
|
34
34
|
returnFocus(asker);
|
|
35
35
|
};
|
|
36
36
|
}, [asker]);
|
|
37
|
-
return createPortal(_jsx("div", { className: "glim-modal-backdrop",
|
|
37
|
+
return createPortal(_jsx("div", { ref: leaveBehind, className: "glim-modal-backdrop",
|
|
38
38
|
// A press beside an open menu only closes the menu, not the window under it.
|
|
39
39
|
onMouseDown: (e) => {
|
|
40
40
|
if (closeOnBackdrop && e.target === e.currentTarget && !menuIsOpen())
|
package/dist/engines.d.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import { type Density, type Motion, type RainbowState, type Shape } from "@glimstone/core";
|
|
1
|
+
import { type Density, type GlyphStyle, type Layout, type Light, type Motion, type RainbowState, type Shape } from "@glimstone/core";
|
|
2
2
|
/** The rainbow state. Setting it applies the new state to the document. */
|
|
3
3
|
export declare function useRainbow(): [RainbowState, (next: RainbowState) => void];
|
|
4
4
|
/** The custom properties that put an element at a rainbow position. */
|
|
5
5
|
export declare function useHue(index: number | undefined): Record<string, string> | undefined;
|
|
6
6
|
export declare function useShape(): [Shape, (next: Shape) => void];
|
|
7
7
|
export declare function useMotion(): [Motion, (next: Motion) => void];
|
|
8
|
+
/** How light falls on the stone. */
|
|
9
|
+
export declare function useLight(): [Light, (next: Light) => void];
|
|
10
|
+
/** Whether the glyphs are drawn filled or as lines. */
|
|
11
|
+
export declare function useGlyphs(): [GlyphStyle, (next: GlyphStyle) => void];
|
|
12
|
+
/** Whether what lies on a card is drawn with cards or without. */
|
|
13
|
+
export declare function useLayout(): [Layout, (next: Layout) => void];
|
|
8
14
|
/** The row density of lists and tables. */
|
|
9
15
|
export declare function useDensity(): [Density, (next: Density) => void];
|
|
10
16
|
/** The accent the user chose, or "" for the default. */
|
package/dist/engines.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useMemo, useSyncExternalStore } from "react";
|
|
2
|
-
import { applyAccent, applyDensity, applyMotion, applyRainbow, applyShape, DEFAULT_DENSITY, DEFAULT_MOTION, DEFAULT_SHAPE, hueVars, rainbowState, subscribeRainbow, } from "@glimstone/core";
|
|
3
|
-
// The colour, shape, motion and density engines as hooks, the twins of the Vue
|
|
2
|
+
import { applyAccent, applyDensity, applyGlyphs, applyLayout, applyLight, applyMotion, applyRainbow, applyShape, DEFAULT_DENSITY, DEFAULT_GLYPHS, DEFAULT_LAYOUT, DEFAULT_LIGHT, DEFAULT_MOTION, DEFAULT_SHAPE, hueVars, rainbowState, subscribeRainbow, } from "@glimstone/core";
|
|
3
|
+
// The colour, shape, motion, light, glyph, layout and density engines as hooks, the twins of the Vue
|
|
4
4
|
// composables. Each value belongs to the document, not a component, so every
|
|
5
5
|
// hook follows the document and writes back through the core, in the
|
|
6
6
|
// [value, set] shape of useState.
|
|
@@ -24,6 +24,9 @@ function useRoot(attribute, read) {
|
|
|
24
24
|
}
|
|
25
25
|
const readShape = () => document.documentElement.getAttribute("data-shape") ?? DEFAULT_SHAPE;
|
|
26
26
|
const readMotion = () => document.documentElement.getAttribute("data-motion") ?? DEFAULT_MOTION;
|
|
27
|
+
const readLight = () => document.documentElement.getAttribute("data-light") ?? DEFAULT_LIGHT;
|
|
28
|
+
const readGlyphs = () => document.documentElement.getAttribute("data-glyphs") ?? DEFAULT_GLYPHS;
|
|
29
|
+
const readLayout = () => document.documentElement.getAttribute("data-layout") ?? DEFAULT_LAYOUT;
|
|
27
30
|
const readDensity = () => document.documentElement.getAttribute("data-density") ?? DEFAULT_DENSITY;
|
|
28
31
|
const readAccent = () => document.documentElement.style.getPropertyValue("--accent");
|
|
29
32
|
export function useShape() {
|
|
@@ -32,6 +35,18 @@ export function useShape() {
|
|
|
32
35
|
export function useMotion() {
|
|
33
36
|
return [useRoot("data-motion", readMotion), applyMotion];
|
|
34
37
|
}
|
|
38
|
+
/** How light falls on the stone. */
|
|
39
|
+
export function useLight() {
|
|
40
|
+
return [useRoot("data-light", readLight), applyLight];
|
|
41
|
+
}
|
|
42
|
+
/** Whether the glyphs are drawn filled or as lines. */
|
|
43
|
+
export function useGlyphs() {
|
|
44
|
+
return [useRoot("data-glyphs", readGlyphs), applyGlyphs];
|
|
45
|
+
}
|
|
46
|
+
/** Whether what lies on a card is drawn with cards or without. */
|
|
47
|
+
export function useLayout() {
|
|
48
|
+
return [useRoot("data-layout", readLayout), applyLayout];
|
|
49
|
+
}
|
|
35
50
|
/** The row density of lists and tables. */
|
|
36
51
|
export function useDensity() {
|
|
37
52
|
return [useRoot("data-density", readDensity), applyDensity];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// The error line the fields draw under themselves. Once the value is fixed it
|
|
3
|
+
// stays a moment with data-closing, so the stylesheet can close it as softly
|
|
4
|
+
// as it opened instead of the form jumping.
|
|
5
|
+
import { useEffect, useRef, useState } from "react";
|
|
6
|
+
import { TOAST_MARKS, whenFieldErrorClosed } from "@glimstone/core";
|
|
7
|
+
import { MarkSvg } from "./glyphs.js";
|
|
8
|
+
export function FieldErrorLine({ id, error }) {
|
|
9
|
+
const [shown, setShown] = useState(id && error ? { id, error } : null);
|
|
10
|
+
const line = useRef(null);
|
|
11
|
+
if (id && error && (shown?.id !== id || shown.error !== error))
|
|
12
|
+
setShown({ id, error });
|
|
13
|
+
const closing = !error && shown !== null;
|
|
14
|
+
useEffect(() => (closing && line.current ? whenFieldErrorClosed(line.current, () => setShown(null)) : undefined), [closing]);
|
|
15
|
+
if (!shown)
|
|
16
|
+
return null;
|
|
17
|
+
return (_jsxs("span", { ref: line, "data-glim": "FieldError", id: closing ? undefined : shown.id, "data-closing": closing ? "" : undefined, className: "glim-field-error", children: [_jsx(MarkSvg, { mark: TOAST_MARKS.fail }), shown.error] }));
|
|
18
|
+
}
|
package/dist/glyphs.d.ts
CHANGED
|
@@ -31,7 +31,9 @@ export declare const IconSearch: () => import("react").JSX.Element;
|
|
|
31
31
|
export declare const IconForward: () => import("react").JSX.Element;
|
|
32
32
|
export declare const IconUpload: () => import("react").JSX.Element;
|
|
33
33
|
export declare const IconCalendar: () => import("react").JSX.Element;
|
|
34
|
+
export declare const IconClock: () => import("react").JSX.Element;
|
|
34
35
|
export declare const IconStar: () => import("react").JSX.Element;
|
|
35
36
|
export declare const IconPlay: () => import("react").JSX.Element;
|
|
36
37
|
export declare const IconPause: () => import("react").JSX.Element;
|
|
37
38
|
export declare const IconResetArrow: () => import("react").JSX.Element;
|
|
39
|
+
export declare const IconMore: () => import("react").JSX.Element;
|
package/dist/glyphs.js
CHANGED
|
@@ -39,7 +39,9 @@ export const IconSearch = () => _jsx(MarkSvg, { mark: MARKS.search, className: "
|
|
|
39
39
|
export const IconForward = () => _jsx(MarkSvg, { mark: MARKS.forward, className: "glim-mark" });
|
|
40
40
|
export const IconUpload = () => _jsx(MarkSvg, { mark: MARKS.upload, className: "glim-mark" });
|
|
41
41
|
export const IconCalendar = () => _jsx(MarkSvg, { mark: MARKS.calendar, className: "glim-mark" });
|
|
42
|
+
export const IconClock = () => _jsx(MarkSvg, { mark: MARKS.clock, className: "glim-mark" });
|
|
42
43
|
export const IconStar = () => _jsx(MarkSvg, { mark: MARKS.star, className: "glim-mark" });
|
|
43
44
|
export const IconPlay = () => _jsx(MarkSvg, { mark: MARKS.play, className: "glim-mark" });
|
|
44
45
|
export const IconPause = () => _jsx(MarkSvg, { mark: MARKS.pause, className: "glim-mark" });
|
|
45
46
|
export const IconResetArrow = () => _jsx(MarkSvg, { mark: MARKS.resetArrow, className: "glim-mark" });
|
|
47
|
+
export const IconMore = () => _jsx(MarkSvg, { mark: MARKS.more, className: "glim-mark" });
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export * from "./AboutCard.tsx";
|
|
2
1
|
export * from "./Badge.tsx";
|
|
3
2
|
export * from "./Button.tsx";
|
|
4
3
|
export * from "./BusyRing.tsx";
|
|
@@ -11,7 +10,6 @@ export * from "./ConnectionRow.tsx";
|
|
|
11
10
|
export * from "./ContextMenu.tsx";
|
|
12
11
|
export * from "./CopyField.tsx";
|
|
13
12
|
export * from "./CryptoDonateDialog.tsx";
|
|
14
|
-
export * from "./DropdownListbox.tsx";
|
|
15
13
|
export * from "./EmptyState.tsx";
|
|
16
14
|
export * from "./engines.ts";
|
|
17
15
|
export * from "./FieldError.tsx";
|
|
@@ -27,11 +25,13 @@ export { useFieldName } from "./fieldName.ts";
|
|
|
27
25
|
export * from "./IconButton.tsx";
|
|
28
26
|
export * from "./IconTipButton.tsx";
|
|
29
27
|
export * from "./InfoBubble.tsx";
|
|
28
|
+
export * from "./InfoTile.tsx";
|
|
30
29
|
export * from "./InstanceCard.tsx";
|
|
31
30
|
export * from "./Kbd.tsx";
|
|
32
31
|
export * from "./ListRow.tsx";
|
|
33
32
|
export * from "./ListTable.tsx";
|
|
34
33
|
export * from "./MenuBar.tsx";
|
|
34
|
+
export * from "./Chart.tsx";
|
|
35
35
|
export * from "./Meter.tsx";
|
|
36
36
|
export * from "./NumberField.tsx";
|
|
37
37
|
export * from "./PasswordField.tsx";
|
|
@@ -44,6 +44,7 @@ export * from "./ProgressBar.tsx";
|
|
|
44
44
|
export * from "./ReadmeButton.tsx";
|
|
45
45
|
export * from "./RowMark.tsx";
|
|
46
46
|
export * from "./Selector.tsx";
|
|
47
|
+
export * from "./SettingsNav.tsx";
|
|
47
48
|
export * from "./SidebarRow.tsx";
|
|
48
49
|
export * from "./Sheet.tsx";
|
|
49
50
|
export * from "./SignInCard.tsx";
|
|
@@ -51,9 +52,11 @@ export * from "./SignInReauthWindow.tsx";
|
|
|
51
52
|
export * from "./SignInTile.tsx";
|
|
52
53
|
export * from "./NotifyCard.tsx";
|
|
53
54
|
export * from "./SkeletonRow.tsx";
|
|
55
|
+
export * from "./StatusSummary.tsx";
|
|
54
56
|
export * from "./SubCard.tsx";
|
|
55
57
|
export * from "./Table.tsx";
|
|
56
58
|
export * from "./TextField.tsx";
|
|
59
|
+
export * from "./TimePicker.tsx";
|
|
57
60
|
export * from "./Toast.tsx";
|
|
58
61
|
export * from "./Toggle.tsx";
|
|
59
62
|
export * from "./Tree.tsx";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export * from "./AboutCard.js";
|
|
2
1
|
export * from "./Badge.js";
|
|
3
2
|
export * from "./Button.js";
|
|
4
3
|
export * from "./BusyRing.js";
|
|
@@ -11,7 +10,6 @@ export * from "./ConnectionRow.js";
|
|
|
11
10
|
export * from "./ContextMenu.js";
|
|
12
11
|
export * from "./CopyField.js";
|
|
13
12
|
export * from "./CryptoDonateDialog.js";
|
|
14
|
-
export * from "./DropdownListbox.js";
|
|
15
13
|
export * from "./EmptyState.js";
|
|
16
14
|
export * from "./engines.js";
|
|
17
15
|
export * from "./FieldError.js";
|
|
@@ -27,11 +25,13 @@ export { useFieldName } from "./fieldName.js";
|
|
|
27
25
|
export * from "./IconButton.js";
|
|
28
26
|
export * from "./IconTipButton.js";
|
|
29
27
|
export * from "./InfoBubble.js";
|
|
28
|
+
export * from "./InfoTile.js";
|
|
30
29
|
export * from "./InstanceCard.js";
|
|
31
30
|
export * from "./Kbd.js";
|
|
32
31
|
export * from "./ListRow.js";
|
|
33
32
|
export * from "./ListTable.js";
|
|
34
33
|
export * from "./MenuBar.js";
|
|
34
|
+
export * from "./Chart.js";
|
|
35
35
|
export * from "./Meter.js";
|
|
36
36
|
export * from "./NumberField.js";
|
|
37
37
|
export * from "./PasswordField.js";
|
|
@@ -44,6 +44,7 @@ export * from "./ProgressBar.js";
|
|
|
44
44
|
export * from "./ReadmeButton.js";
|
|
45
45
|
export * from "./RowMark.js";
|
|
46
46
|
export * from "./Selector.js";
|
|
47
|
+
export * from "./SettingsNav.js";
|
|
47
48
|
export * from "./SidebarRow.js";
|
|
48
49
|
export * from "./Sheet.js";
|
|
49
50
|
export * from "./SignInCard.js";
|
|
@@ -51,9 +52,11 @@ export * from "./SignInReauthWindow.js";
|
|
|
51
52
|
export * from "./SignInTile.js";
|
|
52
53
|
export * from "./NotifyCard.js";
|
|
53
54
|
export * from "./SkeletonRow.js";
|
|
55
|
+
export * from "./StatusSummary.js";
|
|
54
56
|
export * from "./SubCard.js";
|
|
55
57
|
export * from "./Table.js";
|
|
56
58
|
export * from "./TextField.js";
|
|
59
|
+
export * from "./TimePicker.js";
|
|
57
60
|
export * from "./Toast.js";
|
|
58
61
|
export * from "./Toggle.js";
|
|
59
62
|
export * from "./Tree.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// A row's label in a list that filters as somebody types, with the part that
|
|
3
|
+
// matches the search set apart.
|
|
4
|
+
import { searchParts } from "@glimstone/core";
|
|
5
|
+
export function SearchHit({ label, query }) {
|
|
6
|
+
const parts = searchParts(label, query);
|
|
7
|
+
if (!parts)
|
|
8
|
+
return _jsx(_Fragment, { children: label });
|
|
9
|
+
return (_jsxs(_Fragment, { children: [parts.before, _jsx("span", { className: "glim-combobox-hit", children: parts.hit }), parts.after] }));
|
|
10
|
+
}
|
package/dist/useTipBubble.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
+
import { type BubbleKind } from "@glimstone/core";
|
|
2
3
|
export interface TipBubble {
|
|
3
4
|
/** Ref callback for the trigger element the bubble is placed against. A
|
|
4
5
|
* callback, so a trigger that keeps its own ref can feed both from one
|
|
@@ -22,13 +23,21 @@ export interface TipBubble {
|
|
|
22
23
|
* since a disabled <button> emits no mouse events. Other triggers pass
|
|
23
24
|
* through unchanged. */
|
|
24
25
|
wrap: (node: ReactNode) => ReactNode;
|
|
25
|
-
/** Open or close by hand, for a hover wrapper of the call site's own.
|
|
26
|
+
/** Open or close by hand, for a hover wrapper of the call site's own. A
|
|
27
|
+
* tooltip opens once the pointer has rested. */
|
|
26
28
|
show: () => void;
|
|
27
29
|
hide: () => void;
|
|
28
30
|
}
|
|
31
|
+
export interface TipBubbleOptions {
|
|
32
|
+
/** `tip` names a control: small, inverted, once the pointer has rested.
|
|
33
|
+
* `info` explains: roomier, on the floating surface, at once. */
|
|
34
|
+
kind?: BubbleKind;
|
|
35
|
+
/** A keyboard shortcut drawn beside a tooltip's words, such as "Ctrl K". */
|
|
36
|
+
shortcut?: string;
|
|
37
|
+
}
|
|
29
38
|
/**
|
|
30
39
|
* @param tip What the bubble says. When it is empty nothing opens or renders
|
|
31
40
|
* and `wrap` passes its node through.
|
|
32
41
|
* @param disabled Whether the trigger is currently disabled; see `wrap`.
|
|
33
42
|
*/
|
|
34
|
-
export declare function useTipBubble(tip?: string, disabled?: boolean): TipBubble;
|
|
43
|
+
export declare function useTipBubble(tip?: string, disabled?: boolean, { kind, shortcut }?: TipBubbleOptions): TipBubble;
|