@espressif/dashboard-ui-components 1.12.0 → 1.14.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/.claude/rules/dashboard-ui-consumption.md +63 -2
- package/.cursor/rules/dashboard-ui-consumption.mdc +61 -3
- package/CHANGELOG.md +265 -0
- package/README.md +59 -8
- package/dist/{alert.props-CcKo49Rb.d.ts → alert.props-BuLuWmXA.d.ts} +3 -3
- package/dist/common/copyright-card/copyright-card.js +1 -1
- package/dist/common/footer-card/footer-card.js +2 -2
- package/dist/common/index.d.ts +3 -0
- package/dist/common/my-account-menu/my-account-menu.js +2 -2
- package/dist/common/page-loader/page-loader.js +4 -1
- package/dist/common/profile-card/profile-card.js +2 -2
- package/dist/components/accordion/accordion.js +6 -11
- package/dist/components/alert/index.d.ts +5 -5
- package/dist/components/anchored-panel/anchored-panel.js +4 -4
- package/dist/components/async-multi-select/async-multi-select.js +8 -8
- package/dist/components/badge/index.d.ts +1 -1
- package/dist/components/bottom-sheet/_hooks/use-sheet-drag.js +112 -0
- package/dist/components/bottom-sheet/bottom-sheet.js +84 -0
- package/dist/components/bottom-sheet/index.d.ts +50 -0
- package/dist/components/bottom-sheet/index.js +3 -0
- package/dist/components/bubble/bubble.js +1 -1
- package/dist/components/calendar/calendar.js +5 -5
- package/dist/components/cards/animated-card/animated-card.js +1 -1
- package/dist/components/cards/basic-details-card.js +2 -2
- package/dist/components/cards/collapsible-card.js +1 -1
- package/dist/components/cards/index.d.ts +2 -2
- package/dist/components/cards/no-data-card/no-data-card.js +2 -2
- package/dist/components/cards/section-card.js +49 -41
- package/dist/components/cards/simple-card.js +2 -5
- package/dist/components/category-card/category-card.js +2 -2
- package/dist/components/chart/chart.js +4 -4
- package/dist/components/chart/donut-chart.js +1 -1
- package/dist/components/chart/treemap-chart.js +1 -1
- package/dist/components/choice-card/choice-card.js +3 -3
- package/dist/components/code-editor/code-editor.js +4 -3
- package/dist/components/data-table/table-header.js +1 -1
- package/dist/components/date-range-picker/date-range-picker.js +3 -3
- package/dist/components/dynamic-list/dynamic-list.js +14 -13
- package/dist/components/dynamic-list/index.d.ts +1 -1
- package/dist/components/error-display/full-size-error/full-size-error.js +2 -2
- package/dist/components/expandable-text/expandable-text-overlay.js +1 -1
- package/dist/components/facet-filters/filter-group.js +2 -2
- package/dist/components/feature-grid/feature-grid.js +3 -3
- package/dist/components/file-input/file-input.js +8 -8
- package/dist/components/file-upload/file-upload.js +4 -4
- package/dist/components/floating-window/_hooks/use-drag-move.js +1 -0
- package/dist/components/floating-window/_hooks/use-resize.js +133 -0
- package/dist/components/floating-window/floating-window.js +67 -40
- package/dist/components/floating-window/index.d.ts +21 -2
- package/dist/components/fullscreen-dialog/fullscreen-dialog.js +1 -1
- package/dist/components/gradient-ring-button/_hooks/use-ring-geometry.js +116 -0
- package/dist/components/gradient-ring-button/gradient-ring-button.js +44 -0
- package/dist/components/gradient-ring-button/gradient-ring.js +77 -0
- package/dist/components/gradient-ring-button/index.d.ts +66 -0
- package/dist/components/gradient-ring-button/index.js +3 -0
- package/dist/components/horizontal-stepper/horizontal-stepper.js +2 -6
- package/dist/components/horizontal-stepper/index.d.ts +2 -2
- package/dist/components/icon-avatar/index.d.ts +3 -3
- package/dist/components/icon-text-action-card/index.d.ts +4 -4
- package/dist/components/index.d.ts +14 -8
- package/dist/components/index.js +15 -6
- package/dist/components/key-value-manager/key-value-manager-add-popover.js +1 -1
- package/dist/components/key-value-manager/key-value-manager-table.js +1 -1
- package/dist/components/keyframes/index.d.ts +53 -0
- package/dist/components/keyframes/index.js +3 -0
- package/dist/components/keyframes/keyframes-motion.js +23 -0
- package/dist/components/keyframes/keyframes.js +37 -0
- package/dist/components/link/link.js +7 -7
- package/dist/components/list/list-item.utils.js +5 -4
- package/dist/components/list/list.js +1 -1
- package/dist/components/list-details/index.d.ts +2 -2
- package/dist/components/markdown-content/markdown-content.components.js +2 -2
- package/dist/components/media-card/media-card-reveal.js +2 -2
- package/dist/components/media-card/media-card.js +2 -2
- package/dist/components/monospace-content/index.d.ts +4 -4
- package/dist/components/monospace-content/monospace-content.js +9 -11
- package/dist/components/nav-bar/nav-bar-mobile-menu.js +3 -3
- package/dist/components/nav-bar/nav-bar.js +4 -4
- package/dist/components/notice-strip/notice-strip.js +1 -1
- package/dist/components/option-card-group/option-card-group.js +2 -2
- package/dist/components/overflow-badge-list/index.d.ts +2 -2
- package/dist/components/overflow-badge-list/overflow-badge-list.js +3 -3
- package/dist/components/page-banner/page-banner.js +1 -1
- package/dist/components/page-container/page-container.js +1 -1
- package/dist/components/pagination/pagination.js +1 -1
- package/dist/components/progress-bar/progress-bar.js +2 -2
- package/dist/components/qr-code/index.d.ts +26 -0
- package/dist/components/qr-code/index.js +2 -0
- package/dist/components/qr-code/qr-code.js +69 -0
- package/dist/components/radio-group/radio-group.js +3 -3
- package/dist/components/range-field/index.d.ts +45 -0
- package/dist/components/range-field/index.js +2 -0
- package/dist/components/range-field/range-field.js +161 -0
- package/dist/components/readout/readout.js +1 -1
- package/dist/components/requirement-list/requirement-list.js +5 -10
- package/dist/components/reveal/index.d.ts +6 -3
- package/dist/components/reveal/reveal.js +7 -4
- package/dist/components/scrollable-sections/scrollable-sections.js +1 -1
- package/dist/components/search-box/index.d.ts +3 -1
- package/dist/components/search-box/search-box.js +7 -12
- package/dist/components/search-field-shell.js +8 -8
- package/dist/components/selectable-card-list/selectable-card-list-shared.js +6 -6
- package/dist/components/showcase-card/index.d.ts +14 -3
- package/dist/components/showcase-card/showcase-card.js +43 -2
- package/dist/components/sidebar/sidebar.js +13 -15
- package/dist/components/simple-clickable-card/index.d.ts +4 -4
- package/dist/components/simple-clickable-card/simple-clickable-card-shared.js +19 -23
- package/dist/components/simple-info-card/index.d.ts +3 -3
- package/dist/components/simple-list/index.d.ts +1 -1
- package/dist/components/simple-list/simple-list.js +8 -8
- package/dist/components/simple-paginated-list/simple-paginated-list.js +1 -4
- package/dist/components/stat-card/stat-card.js +7 -13
- package/dist/components/status-badge/index.d.ts +3 -3
- package/dist/components/status-badge/status-badge.js +4 -4
- package/dist/components/status-card-list/status-card-list.js +6 -6
- package/dist/components/step-tabs/index.d.ts +1 -1
- package/dist/components/tag/index.d.ts +1 -1
- package/dist/components/tag/tag.js +4 -4
- package/dist/components/tag-input/tag-input.js +12 -12
- package/dist/components/timeline/timeline.js +2 -2
- package/dist/components/toast/index.d.ts +1 -1
- package/dist/components/toast/toast.js +2 -2
- package/dist/components/toolbar/index.d.ts +5 -2
- package/dist/components/toolbar/toolbar-button.js +1 -1
- package/dist/components/toolbar/toolbar.js +9 -3
- package/dist/components/trace/index.d.ts +49 -0
- package/dist/components/trace/index.js +2 -0
- package/dist/components/trace/trace.js +109 -0
- package/dist/components/transfer-list/transfer-list.js +2 -2
- package/dist/components/typography/index.d.ts +12 -3
- package/dist/components/typography/typography-variants.js +98 -13
- package/dist/components/typography/typography.js +4 -2
- package/dist/components/user-type-badge/user-type-badge.js +4 -4
- package/dist/components/vertical-stepper/index.d.ts +2 -2
- package/dist/components/vertical-stepper/vertical-stepper.js +18 -11
- package/dist/core/alert.js +3 -3
- package/dist/core/animate-ui/components/animate/code-header.js +1 -1
- package/dist/core/animate-ui/components/animate/code.js +1 -1
- package/dist/core/animate-ui/components/animate/tabs.js +6 -6
- package/dist/core/animate-ui/components/animate/tooltip.js +1 -1
- package/dist/core/animate-ui/components/base/progress.js +2 -2
- package/dist/core/animate-ui/components/radix/accordion.js +2 -2
- package/dist/core/animate-ui/components/radix/dialog.js +2 -2
- package/dist/core/animate-ui/components/radix/dropdown-menu.js +6 -6
- package/dist/core/animate-ui/components/radix/sheet.js +2 -2
- package/dist/core/animate-ui/components/radix/sidebar.js +8 -8
- package/dist/core/animate-ui/components/radix/toggle.js +1 -1
- package/dist/core/badge.js +1 -1
- package/dist/core/breadcrumb.js +1 -1
- package/dist/core/button/button.js +2 -2
- package/dist/core/button-group.js +1 -1
- package/dist/core/button.js +2 -2
- package/dist/core/card.js +2 -2
- package/dist/core/combobox/combobox.js +3 -3
- package/dist/core/command.js +5 -5
- package/dist/core/field-label-row.js +4 -4
- package/dist/core/form.js +2 -2
- package/dist/core/index.d.ts +1 -1
- package/dist/core/input/input.js +11 -11
- package/dist/core/input-otp/input-otp.js +12 -12
- package/dist/core/label.js +1 -1
- package/dist/core/select.js +6 -6
- package/dist/core/separator.js +1 -1
- package/dist/core/table.js +2 -2
- package/dist/core/textarea/textarea.js +9 -9
- package/dist/{icon-avatar.props-RYtw2eSW.d.ts → icon-avatar.props-BJe0-vva.d.ts} +1 -1
- package/dist/{icon-text-action-card.props-B2ggncUK.d.ts → icon-text-action-card.props-BU7yFi2Q.d.ts} +2 -2
- package/dist/index.d.ts +14 -8
- package/dist/index.js +16 -7
- package/dist/layouts/entry-layout/entry-layout.js +1 -1
- package/dist/layouts/index.d.ts +21 -6
- package/dist/layouts/index.js +1 -1
- package/dist/layouts/minimal-workspace-layout/minimal-workspace-layout.js +10 -18
- package/dist/layouts/minimal-workspace-layout/sidebar-trigger.js +35 -7
- package/dist/layouts/workspace-layout/footer/footer.js +1 -1
- package/dist/markdown/index.d.ts +4 -4
- package/dist/{section-card-B7c5uc08.d.ts → section-card-DqQeQkzU.d.ts} +1 -1
- package/dist/{simple-clickable-card.props-BrPCw7CR.d.ts → simple-clickable-card.props-BhhotZMp.d.ts} +2 -2
- package/dist/{status-badge.props-lKlEOfRt.d.ts → status-badge.props-BVe8CmQZ.d.ts} +1 -1
- package/dist/styles/type-scale.js +153 -0
- package/dist/tailwind-preset.js +120 -1
- package/dist/toast/index.d.ts +1 -1
- package/dist/utils/cn.js +16 -5
- package/dist/utils/index.d.ts +31 -2
- package/dist/utils/index.js +2 -1
- package/dist/utils/variant.js +47 -47
- package/dist/{variant-D81RhpbR.d.ts → variant-DjdaxfIA.d.ts} +6 -1
- package/dist/{vertical-stepper.props-BXYcbW70.d.ts → vertical-stepper.props-DONJJXIy.d.ts} +1 -0
- package/package.json +9 -1
- package/src/styles/theme.css +23 -3
- package/src/styles/type-scale.css +152 -0
- package/tailwind.preset.ts +23 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { useLayoutEffect, useRef } from "react";
|
|
2
|
+
//#region src/components/floating-window/_hooks/use-resize.ts
|
|
3
|
+
/** The smallest a window may be made when the app names no `minSize`: a bar's controls and a few lines still fit. */
|
|
4
|
+
var DEFAULT_MIN_WINDOW_SIZE = {
|
|
5
|
+
width: 280,
|
|
6
|
+
height: 200
|
|
7
|
+
};
|
|
8
|
+
/** One arrow press on the handle; with Shift, four. */
|
|
9
|
+
var KEY_STEP = 16;
|
|
10
|
+
/**
|
|
11
|
+
* A size no smaller than `min` and no larger than what fits between the
|
|
12
|
+
* frame's top-left corner and the viewport's far edges — so a resize never
|
|
13
|
+
* pushes the window off screen. A viewport too small for `min` wins over it.
|
|
14
|
+
*/
|
|
15
|
+
function clampSize(size, min, at, viewport) {
|
|
16
|
+
const room = {
|
|
17
|
+
width: Math.max(viewport.width - Math.max(at.x, 0), 0),
|
|
18
|
+
height: Math.max(viewport.height - Math.max(at.y, 0), 0)
|
|
19
|
+
};
|
|
20
|
+
return {
|
|
21
|
+
width: Math.min(Math.max(size.width, min.width), Math.max(room.width, Math.min(min.width, viewport.width))),
|
|
22
|
+
height: Math.min(Math.max(size.height, min.height), Math.max(room.height, Math.min(min.height, viewport.height)))
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
var viewport = () => ({
|
|
26
|
+
width: window.innerWidth,
|
|
27
|
+
height: window.innerHeight
|
|
28
|
+
});
|
|
29
|
+
/** The frame's measured size and where it sits. */
|
|
30
|
+
function measure(frame) {
|
|
31
|
+
const rect = frame.getBoundingClientRect();
|
|
32
|
+
return {
|
|
33
|
+
size: {
|
|
34
|
+
width: rect.width,
|
|
35
|
+
height: rect.height
|
|
36
|
+
},
|
|
37
|
+
at: {
|
|
38
|
+
x: rect.left,
|
|
39
|
+
y: rect.top
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Resizes a fixed-position frame by a corner handle (pointer, or the arrow
|
|
45
|
+
* keys on the focused handle). Like the move, the size changes on every
|
|
46
|
+
* pointer move, so it is written to the element from here — never from a
|
|
47
|
+
* `style` prop — and handed back once the pointer is released, clamped, for
|
|
48
|
+
* the caller to remember. A remembered size is applied before the first
|
|
49
|
+
* paint; `null` leaves the frame at its default size until it is resized.
|
|
50
|
+
*/
|
|
51
|
+
function useResize(frame, size, onResize, minSize) {
|
|
52
|
+
const drag = useRef(null);
|
|
53
|
+
function apply(next) {
|
|
54
|
+
if (frame) {
|
|
55
|
+
frame.style.width = `${next.width}px`;
|
|
56
|
+
frame.style.height = `${next.height}px`;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const width = size?.width;
|
|
60
|
+
const height = size?.height;
|
|
61
|
+
useLayoutEffect(() => {
|
|
62
|
+
if (!frame || drag.current || width === void 0 || height === void 0) return;
|
|
63
|
+
apply(clampSize({
|
|
64
|
+
width,
|
|
65
|
+
height
|
|
66
|
+
}, minSize, measure(frame).at, viewport()));
|
|
67
|
+
}, [
|
|
68
|
+
frame,
|
|
69
|
+
width,
|
|
70
|
+
height
|
|
71
|
+
]);
|
|
72
|
+
function settle(next) {
|
|
73
|
+
if (!frame) return;
|
|
74
|
+
const clamped = clampSize(next, minSize, measure(frame).at, viewport());
|
|
75
|
+
const settled = {
|
|
76
|
+
width: Math.round(clamped.width),
|
|
77
|
+
height: Math.round(clamped.height)
|
|
78
|
+
};
|
|
79
|
+
apply(settled);
|
|
80
|
+
onResize?.(settled);
|
|
81
|
+
}
|
|
82
|
+
function onPointerDown(event) {
|
|
83
|
+
if (event.button !== 0 || !frame) return;
|
|
84
|
+
event.preventDefault();
|
|
85
|
+
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
86
|
+
drag.current = {
|
|
87
|
+
pointerId: event.pointerId,
|
|
88
|
+
x: event.clientX,
|
|
89
|
+
y: event.clientY,
|
|
90
|
+
from: measure(frame).size
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function onPointerMove(event) {
|
|
94
|
+
const active = drag.current;
|
|
95
|
+
if (!active || active.pointerId !== event.pointerId || !frame) return;
|
|
96
|
+
apply(clampSize({
|
|
97
|
+
width: active.from.width + event.clientX - active.x,
|
|
98
|
+
height: active.from.height + event.clientY - active.y
|
|
99
|
+
}, minSize, measure(frame).at, viewport()));
|
|
100
|
+
}
|
|
101
|
+
function onPointerUp(event) {
|
|
102
|
+
const active = drag.current;
|
|
103
|
+
if (!active || active.pointerId !== event.pointerId || !frame) return;
|
|
104
|
+
drag.current = null;
|
|
105
|
+
event.currentTarget.releasePointerCapture?.(event.pointerId);
|
|
106
|
+
settle(measure(frame).size);
|
|
107
|
+
}
|
|
108
|
+
function onKeyDown(event) {
|
|
109
|
+
const step = {
|
|
110
|
+
ArrowLeft: [-1, 0],
|
|
111
|
+
ArrowRight: [1, 0],
|
|
112
|
+
ArrowUp: [0, -1],
|
|
113
|
+
ArrowDown: [0, 1]
|
|
114
|
+
}[event.key];
|
|
115
|
+
if (!step || !frame) return;
|
|
116
|
+
event.preventDefault();
|
|
117
|
+
const by = KEY_STEP * (event.shiftKey ? 4 : 1);
|
|
118
|
+
const { size: from } = measure(frame);
|
|
119
|
+
settle({
|
|
120
|
+
width: from.width + step[0] * by,
|
|
121
|
+
height: from.height + step[1] * by
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
onPointerDown,
|
|
126
|
+
onPointerMove,
|
|
127
|
+
onPointerUp,
|
|
128
|
+
onPointerCancel: onPointerUp,
|
|
129
|
+
onKeyDown
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
//#endregion
|
|
133
|
+
export { DEFAULT_MIN_WINDOW_SIZE, clampSize, useResize };
|
|
@@ -3,6 +3,7 @@ import { Button } from "../button/button.js";
|
|
|
3
3
|
import { Typography } from "../typography/typography.js";
|
|
4
4
|
import { ToolbarButton } from "../toolbar/toolbar-button.js";
|
|
5
5
|
import { useDragMove } from "./_hooks/use-drag-move.js";
|
|
6
|
+
import { DEFAULT_MIN_WINDOW_SIZE, useResize } from "./_hooks/use-resize.js";
|
|
6
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
8
|
import { Dock, GripHorizontal, MessageSquare, Minus, X } from "lucide-react";
|
|
8
9
|
//#region src/components/floating-window/floating-window.tsx
|
|
@@ -25,15 +26,34 @@ function Pill({ title, label, attention, onRestore }) {
|
|
|
25
26
|
})]
|
|
26
27
|
});
|
|
27
28
|
}
|
|
29
|
+
/** The resize handle: a corner grip, focusable so the arrow keys resize too. */
|
|
30
|
+
function ResizeHandle({ label, handlers }) {
|
|
31
|
+
return /* @__PURE__ */ jsx("div", {
|
|
32
|
+
role: "button",
|
|
33
|
+
tabIndex: 0,
|
|
34
|
+
"aria-label": label,
|
|
35
|
+
title: label,
|
|
36
|
+
"data-slot": "floating-window-resize",
|
|
37
|
+
...handlers,
|
|
38
|
+
className: "absolute right-0 bottom-0 z-10 flex size-5 cursor-se-resize touch-none items-end justify-end rounded-br-xl p-1 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",
|
|
39
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
40
|
+
"aria-hidden": true,
|
|
41
|
+
className: "size-2 rounded-br-sm border-r-2 border-b-2 border-foreground-muted"
|
|
42
|
+
})
|
|
43
|
+
});
|
|
44
|
+
}
|
|
28
45
|
/**
|
|
29
46
|
* A small window floating over the page, moved by its bar: a non-modal
|
|
30
47
|
* dialog, so the page behind it stays live. Its bar carries Minimize (to a
|
|
31
48
|
* pill in the bottom-left corner), the way back (Dock) and the way out
|
|
32
49
|
* (Close); Escape docks. Wrap `onMinimize` / `onRestore` in
|
|
33
|
-
* `startViewTransition` and the window morphs into its pill and back.
|
|
50
|
+
* `startViewTransition` and the window morphs into its pill and back. With
|
|
51
|
+
* `onResize` it is resized by its bottom-right corner, and the app keeps the
|
|
52
|
+
* size it hands back (`size`), as it keeps the position.
|
|
34
53
|
*/
|
|
35
|
-
function FloatingWindow({ title, children, position, onMove, minimized = false, onMinimize, onRestore, onDock, onClose, dockLabel, closeLabel, minimizeLabel, restoreLabel, attention, moveLabel, className }) {
|
|
54
|
+
function FloatingWindow({ title, children, position, onMove, size = null, onResize, minSize = DEFAULT_MIN_WINDOW_SIZE, resizeLabel, minimized = false, onMinimize, onRestore, onDock, onClose, dockLabel, closeLabel, minimizeLabel, restoreLabel, attention, moveLabel, className }) {
|
|
36
55
|
const handle = useDragMove(position, onMove);
|
|
56
|
+
const resize = useResize(handle.frame, size, onResize, minSize);
|
|
37
57
|
function onKeyDown(event) {
|
|
38
58
|
if (event.key === "Escape") {
|
|
39
59
|
event.stopPropagation();
|
|
@@ -53,44 +73,51 @@ function FloatingWindow({ title, children, position, onMove, minimized = false,
|
|
|
53
73
|
onKeyDown,
|
|
54
74
|
"data-slot": "floating-window",
|
|
55
75
|
className: cn("view-transition-morph fixed top-0 left-0 z-30 flex h-128 max-h-dvh w-96 max-w-dvw flex-col overflow-hidden rounded-xl border border-border bg-background shadow-float", className),
|
|
56
|
-
children: [
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ jsxs("div", {
|
|
78
|
+
"aria-label": moveLabel,
|
|
79
|
+
onPointerDown: handle.onPointerDown,
|
|
80
|
+
onPointerMove: handle.onPointerMove,
|
|
81
|
+
onPointerUp: handle.onPointerUp,
|
|
82
|
+
onPointerCancel: handle.onPointerCancel,
|
|
83
|
+
className: "flex h-9 shrink-0 cursor-move touch-none items-center gap-2 border-b border-border bg-surface-container-low px-2 select-none",
|
|
84
|
+
children: [
|
|
85
|
+
/* @__PURE__ */ jsx(GripHorizontal, {
|
|
86
|
+
className: "h-4 w-4 shrink-0 text-foreground-muted",
|
|
87
|
+
"aria-hidden": true
|
|
88
|
+
}),
|
|
89
|
+
/* @__PURE__ */ jsx(Typography, {
|
|
90
|
+
variant: "subtitle2",
|
|
91
|
+
as: "h2",
|
|
92
|
+
className: "m-0 min-w-0 flex-1 truncate text-foreground",
|
|
93
|
+
children: title
|
|
94
|
+
}),
|
|
95
|
+
onMinimize && /* @__PURE__ */ jsx(ToolbarButton, {
|
|
96
|
+
label: minimizeLabel ?? title,
|
|
97
|
+
icon: /* @__PURE__ */ jsx(Minus, {}),
|
|
98
|
+
onClick: onMinimize
|
|
99
|
+
}),
|
|
100
|
+
/* @__PURE__ */ jsx(ToolbarButton, {
|
|
101
|
+
label: dockLabel,
|
|
102
|
+
icon: /* @__PURE__ */ jsx(Dock, {}),
|
|
103
|
+
onClick: onDock
|
|
104
|
+
}),
|
|
105
|
+
/* @__PURE__ */ jsx(ToolbarButton, {
|
|
106
|
+
label: closeLabel,
|
|
107
|
+
icon: /* @__PURE__ */ jsx(X, {}),
|
|
108
|
+
onClick: onClose
|
|
109
|
+
})
|
|
110
|
+
]
|
|
111
|
+
}),
|
|
112
|
+
/* @__PURE__ */ jsx("div", {
|
|
113
|
+
className: "min-h-0 flex-1",
|
|
114
|
+
children
|
|
115
|
+
}),
|
|
116
|
+
onResize && /* @__PURE__ */ jsx(ResizeHandle, {
|
|
117
|
+
label: resizeLabel ?? title,
|
|
118
|
+
handlers: resize
|
|
119
|
+
})
|
|
120
|
+
]
|
|
94
121
|
});
|
|
95
122
|
}
|
|
96
123
|
//#endregion
|
|
@@ -5,6 +5,10 @@ interface FloatingWindowPosition {
|
|
|
5
5
|
x: number;
|
|
6
6
|
y: number;
|
|
7
7
|
}
|
|
8
|
+
interface FloatingWindowSize {
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
}
|
|
8
12
|
interface FloatingWindowProps {
|
|
9
13
|
/** The window's accessible name, shown in its bar and on its pill. */
|
|
10
14
|
title: string;
|
|
@@ -13,6 +17,19 @@ interface FloatingWindowProps {
|
|
|
13
17
|
position: FloatingWindowPosition | null;
|
|
14
18
|
/** Called once a drag ends, with the new spot (kept inside the viewport). */
|
|
15
19
|
onMove: (position: FloatingWindowPosition) => void;
|
|
20
|
+
/** Its size in pixels; null or absent = the default size (24rem × 32rem, capped by the viewport). */
|
|
21
|
+
size?: FloatingWindowSize | null;
|
|
22
|
+
/**
|
|
23
|
+
* Makes the window resizable: a handle in its bottom-right corner, dragged
|
|
24
|
+
* or moved with the arrow keys (Shift for bigger steps). Called once a
|
|
25
|
+
* resize ends, with the new size (no smaller than `minSize`, kept inside
|
|
26
|
+
* the viewport). Without it the window keeps its size, as before.
|
|
27
|
+
*/
|
|
28
|
+
onResize?: (size: FloatingWindowSize) => void;
|
|
29
|
+
/** The smallest it may be made. @default { width: 280, height: 200 } */
|
|
30
|
+
minSize?: FloatingWindowSize;
|
|
31
|
+
/** The resize handle's accessible name and tooltip. Pass it with `onResize`. */
|
|
32
|
+
resizeLabel?: string;
|
|
16
33
|
/** Folded to a pill in the bottom-left corner; the pill opens the window again where it was. */
|
|
17
34
|
minimized?: boolean;
|
|
18
35
|
onMinimize?: () => void;
|
|
@@ -38,8 +55,10 @@ interface FloatingWindowProps {
|
|
|
38
55
|
* dialog, so the page behind it stays live. Its bar carries Minimize (to a
|
|
39
56
|
* pill in the bottom-left corner), the way back (Dock) and the way out
|
|
40
57
|
* (Close); Escape docks. Wrap `onMinimize` / `onRestore` in
|
|
41
|
-
* `startViewTransition` and the window morphs into its pill and back.
|
|
58
|
+
* `startViewTransition` and the window morphs into its pill and back. With
|
|
59
|
+
* `onResize` it is resized by its bottom-right corner, and the app keeps the
|
|
60
|
+
* size it hands back (`size`), as it keeps the position.
|
|
42
61
|
*/
|
|
43
|
-
declare function FloatingWindow({ title, children, position, onMove, minimized, onMinimize, onRestore, onDock, onClose, dockLabel, closeLabel, minimizeLabel, restoreLabel, attention, moveLabel, className }: FloatingWindowProps): React.JSX.Element;
|
|
62
|
+
declare function FloatingWindow({ title, children, position, onMove, size, onResize, minSize, resizeLabel, minimized, onMinimize, onRestore, onDock, onClose, dockLabel, closeLabel, minimizeLabel, restoreLabel, attention, moveLabel, className }: FloatingWindowProps): React.JSX.Element;
|
|
44
63
|
|
|
45
64
|
export { FloatingWindow, type FloatingWindowPosition, type FloatingWindowProps };
|
|
@@ -45,7 +45,7 @@ function FullscreenDialog({ icon, iconSize = "lg", heading, secondaryText, child
|
|
|
45
45
|
})
|
|
46
46
|
}),
|
|
47
47
|
heading != null && /* @__PURE__ */ jsx("h1", {
|
|
48
|
-
className: "
|
|
48
|
+
className: "type-title mb-4 font-normal text-center text-muted-foreground shrink-0",
|
|
49
49
|
children: heading
|
|
50
50
|
}),
|
|
51
51
|
secondaryText != null && /* @__PURE__ */ jsx("div", {
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { useEffect, useLayoutEffect, useRef } from "react";
|
|
2
|
+
//#region src/components/gradient-ring-button/_hooks/use-ring-geometry.ts
|
|
3
|
+
/** The ring's width in px: the stroke, and the padding it sits in around the control (`p-0.5`). */
|
|
4
|
+
var RING_WIDTH = 2;
|
|
5
|
+
/** One full turn of the gradient while the control is engaged, in seconds, when none is given. */
|
|
6
|
+
var DEFAULT_TURN_SECONDS = 1.5;
|
|
7
|
+
/** How long after it appears a cued ring starts its one turn: once whatever it sits in has risen into place. */
|
|
8
|
+
var CUE_DELAY_MS = 800;
|
|
9
|
+
/** The pill's outline, a RING_WIDTH stroke centred half its width inside the control's edge. */
|
|
10
|
+
function place(wrap, svg) {
|
|
11
|
+
const { width, height } = wrap.getBoundingClientRect();
|
|
12
|
+
const inset = RING_WIDTH / 2;
|
|
13
|
+
const w = Math.max(width - RING_WIDTH, 0);
|
|
14
|
+
const h = Math.max(height - RING_WIDTH, 0);
|
|
15
|
+
for (const rect of svg.querySelectorAll("rect")) {
|
|
16
|
+
rect.setAttribute("x", String(inset));
|
|
17
|
+
rect.setAttribute("y", String(inset));
|
|
18
|
+
rect.setAttribute("width", String(w));
|
|
19
|
+
rect.setAttribute("height", String(h));
|
|
20
|
+
rect.setAttribute("rx", String(h / 2));
|
|
21
|
+
rect.setAttribute("ry", String(h / 2));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/** Whether this SVG has the timeline methods the turn needs (jsdom, for one, has only some). */
|
|
25
|
+
function hasTimeline(svg) {
|
|
26
|
+
return [
|
|
27
|
+
"pauseAnimations",
|
|
28
|
+
"unpauseAnimations",
|
|
29
|
+
"animationsPaused",
|
|
30
|
+
"getCurrentTime",
|
|
31
|
+
"setCurrentTime"
|
|
32
|
+
].every((name) => typeof svg[name] === "function");
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Pointed at, or holding focus that came from the keyboard. `:hover` counts
|
|
36
|
+
* only where a pointer can hover: a touch screen keeps it true after a tap
|
|
37
|
+
* until the next tap elsewhere, and the ring would turn on and on.
|
|
38
|
+
*/
|
|
39
|
+
function engaged(wrap) {
|
|
40
|
+
return typeof window.matchMedia === "function" && window.matchMedia("(hover: hover)").matches && wrap.matches(":hover") || wrap.querySelector(":focus-visible") !== null;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Plays the ring's turn while it is engaged; let go, it finishes the turn it
|
|
44
|
+
* is on and pauses exactly at the start of the next, so it always rests as it
|
|
45
|
+
* began (start colour on the left, end colour on the right). Engaged again
|
|
46
|
+
* before then, it simply carries on. Returns the cleanup.
|
|
47
|
+
*/
|
|
48
|
+
function runWhileEngaged(wrap, svg, turn, cue) {
|
|
49
|
+
let settle;
|
|
50
|
+
svg.pauseAnimations();
|
|
51
|
+
svg.setCurrentTime(0);
|
|
52
|
+
function play() {
|
|
53
|
+
if (!engaged(wrap)) return;
|
|
54
|
+
clearTimeout(settle);
|
|
55
|
+
settle = void 0;
|
|
56
|
+
svg.unpauseAnimations();
|
|
57
|
+
}
|
|
58
|
+
function letGo() {
|
|
59
|
+
if (engaged(wrap) || svg.animationsPaused() || settle !== void 0) return;
|
|
60
|
+
const into = svg.getCurrentTime() % turn;
|
|
61
|
+
settle = setTimeout(() => {
|
|
62
|
+
settle = void 0;
|
|
63
|
+
svg.pauseAnimations();
|
|
64
|
+
svg.setCurrentTime(Math.round(svg.getCurrentTime() / turn) * turn);
|
|
65
|
+
}, (turn - into) * 1e3);
|
|
66
|
+
}
|
|
67
|
+
const cueing = cue ? setTimeout(() => {
|
|
68
|
+
svg.unpauseAnimations();
|
|
69
|
+
letGo();
|
|
70
|
+
}, CUE_DELAY_MS) : void 0;
|
|
71
|
+
const events = [
|
|
72
|
+
["pointerenter", play],
|
|
73
|
+
["focusin", play],
|
|
74
|
+
["pointerleave", letGo],
|
|
75
|
+
["focusout", letGo]
|
|
76
|
+
];
|
|
77
|
+
for (const [name, handler] of events) wrap.addEventListener(name, handler);
|
|
78
|
+
return () => {
|
|
79
|
+
clearTimeout(settle);
|
|
80
|
+
clearTimeout(cueing);
|
|
81
|
+
for (const [name, handler] of events) wrap.removeEventListener(name, handler);
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Keeps the ring's SVG outline the shape of its control (a pill is a
|
|
86
|
+
* rectangle whose corner radius is half its height, measured, since SVG
|
|
87
|
+
* cannot express it otherwise), and runs the ring's turn (`turn` seconds a
|
|
88
|
+
* revolution, the SMIL `dur`) only while the control is pointed at or focused
|
|
89
|
+
* from the keyboard. Cued, it also turns once by itself as it appears.
|
|
90
|
+
*/
|
|
91
|
+
function useRingGeometry(moving, turn, cue = false) {
|
|
92
|
+
const wrapRef = useRef(null);
|
|
93
|
+
const svgRef = useRef(null);
|
|
94
|
+
useLayoutEffect(() => {
|
|
95
|
+
const wrap = wrapRef.current;
|
|
96
|
+
const svg = svgRef.current;
|
|
97
|
+
if (!wrap || !svg) return;
|
|
98
|
+
place(wrap, svg);
|
|
99
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
100
|
+
const observer = new ResizeObserver(() => place(wrap, svg));
|
|
101
|
+
observer.observe(wrap);
|
|
102
|
+
return () => observer.disconnect();
|
|
103
|
+
}, []);
|
|
104
|
+
useEffect(() => {
|
|
105
|
+
const wrap = wrapRef.current;
|
|
106
|
+
const svg = svgRef.current;
|
|
107
|
+
if (!moving || !wrap || !svg || !hasTimeline(svg)) return;
|
|
108
|
+
return runWhileEngaged(wrap, svg, turn, cue);
|
|
109
|
+
}, [moving, turn]);
|
|
110
|
+
return {
|
|
111
|
+
wrapRef,
|
|
112
|
+
svgRef
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
//#endregion
|
|
116
|
+
export { DEFAULT_TURN_SECONDS, RING_WIDTH, useRingGeometry };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { cn } from "../../utils/cn.js";
|
|
2
|
+
import { Button } from "../button/button.js";
|
|
3
|
+
import { DEFAULT_TURN_SECONDS } from "./_hooks/use-ring-geometry.js";
|
|
4
|
+
import { GradientRing } from "./gradient-ring.js";
|
|
5
|
+
import * as React$1 from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/gradient-ring-button/gradient-ring-button.tsx
|
|
8
|
+
/**
|
|
9
|
+
* The button inside the ring: clear in every state (the surface behind shows
|
|
10
|
+
* through; the ring is an SVG outline, so nothing behind needs covering),
|
|
11
|
+
* plain text, no shadow. Its own rings are off too: the ghost Button draws
|
|
12
|
+
* one on hover (2px, with a 2px offset painted in the page background) as
|
|
13
|
+
* well as on focus, and either covers the gradient ring with a dark band.
|
|
14
|
+
* The gradient ring is the hover and focus indicator instead.
|
|
15
|
+
*/
|
|
16
|
+
var CLEAR = "rounded-full border-0 bg-transparent font-semibold text-foreground shadow-none hover:bg-transparent hover:ring-0 hover:ring-offset-0 focus-visible:bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 focus-visible:outline-none active:bg-transparent";
|
|
17
|
+
/**
|
|
18
|
+
* A clear pill button with a 2px border in the theme's gradient tokens that
|
|
19
|
+
* turns clockwise while it is pointed at or focused from the keyboard, and
|
|
20
|
+
* settles back when let go (see `GradientRing`). For the one step into
|
|
21
|
+
* something new on a surface, where a filled primary button is too loud.
|
|
22
|
+
*
|
|
23
|
+
* Every prop of the styled Button passes through except `variant` and
|
|
24
|
+
* `color`. `disabled` fades the ring and holds it still; `fullWidth`
|
|
25
|
+
* (default `false`) makes the ring the full width too.
|
|
26
|
+
*/
|
|
27
|
+
var GradientRingButton = React$1.forwardRef(({ turnSeconds = DEFAULT_TURN_SECONDS, cue = false, fullWidth = false, disabled, className, ...props }, ref) => /* @__PURE__ */ jsx(GradientRing, {
|
|
28
|
+
wide: fullWidth,
|
|
29
|
+
quiet: Boolean(disabled),
|
|
30
|
+
cue,
|
|
31
|
+
turnSeconds,
|
|
32
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
33
|
+
ref,
|
|
34
|
+
...props,
|
|
35
|
+
variant: "ghost",
|
|
36
|
+
color: "gray",
|
|
37
|
+
fullWidth,
|
|
38
|
+
disabled,
|
|
39
|
+
className: cn(CLEAR, className)
|
|
40
|
+
})
|
|
41
|
+
}));
|
|
42
|
+
GradientRingButton.displayName = "GradientRingButton";
|
|
43
|
+
//#endregion
|
|
44
|
+
export { GradientRingButton };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { cn } from "../../utils/cn.js";
|
|
2
|
+
import { usePrefersReducedMotion } from "../../core/hooks/use-prefers-reduced-motion.js";
|
|
3
|
+
import { DEFAULT_TURN_SECONDS, RING_WIDTH, useRingGeometry } from "./_hooks/use-ring-geometry.js";
|
|
4
|
+
import { useId } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/gradient-ring-button/gradient-ring.tsx
|
|
7
|
+
/**
|
|
8
|
+
* A 2px border in the theme's gradient (`--color-gradient-start` → middle →
|
|
9
|
+
* end) around one pill-shaped control: at rest the start colour is on the
|
|
10
|
+
* left and the end colour on the right. While the control is pointed at (or
|
|
11
|
+
* focused from the keyboard) the whole gradient turns clockwise, and when it
|
|
12
|
+
* is let go it finishes the turn it is on and settles back.
|
|
13
|
+
*
|
|
14
|
+
* SVG, not a turning CSS layer: a turning layer has to be clipped to the
|
|
15
|
+
* pill, and a clip on an animated layer softens its outermost pixel, which is
|
|
16
|
+
* the whole ring. A stroke is painted as a line wherever it is, so the
|
|
17
|
+
* control can stay transparent. The gradient turns in the outline's own box
|
|
18
|
+
* (objectBoundingBox), so a quarter turn puts the start colour along the
|
|
19
|
+
* whole top however wide the pill is. The stops take the tokens through
|
|
20
|
+
* `currentColor`, and the turn is SMIL. Not rendered for someone who asked
|
|
21
|
+
* for less motion: the ring then only brightens, and keyboard focus gets the
|
|
22
|
+
* page's usual outline.
|
|
23
|
+
*/
|
|
24
|
+
function GradientRing({ children, wide = false, quiet = false, cue = false, turnSeconds = DEFAULT_TURN_SECONDS }) {
|
|
25
|
+
const reduced = usePrefersReducedMotion();
|
|
26
|
+
const moving = !quiet && !reduced;
|
|
27
|
+
const gradient = `gradient-ring-${useId().replace(/[^a-zA-Z0-9]/g, "")}`;
|
|
28
|
+
const { wrapRef, svgRef } = useRingGeometry(moving, turnSeconds, cue);
|
|
29
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
30
|
+
ref: wrapRef,
|
|
31
|
+
"data-slot": "gradient-ring",
|
|
32
|
+
className: cn("group/ring relative rounded-full p-0.5", wide ? "flex w-full" : "inline-flex", !moving && !quiet && "has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-ring"),
|
|
33
|
+
children: [children, /* @__PURE__ */ jsxs("svg", {
|
|
34
|
+
ref: svgRef,
|
|
35
|
+
"aria-hidden": "true",
|
|
36
|
+
className: cn("pointer-events-none absolute inset-0 size-full overflow-visible transition-opacity duration-300 motion-reduce:transition-none", quiet ? "opacity-35" : "opacity-75 group-hover/ring:opacity-100 group-has-focus-visible/ring:opacity-100"),
|
|
37
|
+
children: [/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", {
|
|
38
|
+
id: gradient,
|
|
39
|
+
x1: "0",
|
|
40
|
+
y1: "0.5",
|
|
41
|
+
x2: "1",
|
|
42
|
+
y2: "0.5",
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ jsx("stop", {
|
|
45
|
+
offset: "0",
|
|
46
|
+
stopColor: "currentColor",
|
|
47
|
+
className: "text-gradient-start"
|
|
48
|
+
}),
|
|
49
|
+
/* @__PURE__ */ jsx("stop", {
|
|
50
|
+
offset: "0.5",
|
|
51
|
+
stopColor: "currentColor",
|
|
52
|
+
className: "text-gradient-middle"
|
|
53
|
+
}),
|
|
54
|
+
/* @__PURE__ */ jsx("stop", {
|
|
55
|
+
offset: "1",
|
|
56
|
+
stopColor: "currentColor",
|
|
57
|
+
className: "text-gradient-end"
|
|
58
|
+
}),
|
|
59
|
+
moving && /* @__PURE__ */ jsx("animateTransform", {
|
|
60
|
+
attributeName: "gradientTransform",
|
|
61
|
+
type: "rotate",
|
|
62
|
+
from: "0 0.5 0.5",
|
|
63
|
+
to: "360 0.5 0.5",
|
|
64
|
+
dur: `${turnSeconds}s`,
|
|
65
|
+
repeatCount: "indefinite"
|
|
66
|
+
})
|
|
67
|
+
]
|
|
68
|
+
}) }), /* @__PURE__ */ jsx("rect", {
|
|
69
|
+
fill: "none",
|
|
70
|
+
stroke: `url(#${gradient})`,
|
|
71
|
+
strokeWidth: RING_WIDTH
|
|
72
|
+
})]
|
|
73
|
+
})]
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
77
|
+
export { GradientRing };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { b as ButtonProps } from '../../button-BxJ7s6sR.js';
|
|
4
|
+
import '../../button-BK-DIR_L.js';
|
|
5
|
+
import 'class-variance-authority/types';
|
|
6
|
+
import 'class-variance-authority';
|
|
7
|
+
import '../../style-axes-DSQ2DGc5.js';
|
|
8
|
+
import '../../index-BQANnKs9.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The styled Button's props, less `variant` and `color` (the look is the
|
|
12
|
+
* component: clear, plain text, the gradient ring). `fullWidth` defaults to
|
|
13
|
+
* `false` here, and the ring goes full width with the button.
|
|
14
|
+
*/
|
|
15
|
+
interface GradientRingButtonProps extends Omit<ButtonProps, "variant" | "color"> {
|
|
16
|
+
/** One full turn of the ring's gradient while pointed at or focused from the keyboard, in seconds. Default 1.5. */
|
|
17
|
+
turnSeconds?: number;
|
|
18
|
+
/** Turn once by itself as it appears ("this is your next step"), then settle. Read on mount only. */
|
|
19
|
+
cue?: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* A clear pill button with a 2px border in the theme's gradient tokens that
|
|
24
|
+
* turns clockwise while it is pointed at or focused from the keyboard, and
|
|
25
|
+
* settles back when let go (see `GradientRing`). For the one step into
|
|
26
|
+
* something new on a surface, where a filled primary button is too loud.
|
|
27
|
+
*
|
|
28
|
+
* Every prop of the styled Button passes through except `variant` and
|
|
29
|
+
* `color`. `disabled` fades the ring and holds it still; `fullWidth`
|
|
30
|
+
* (default `false`) makes the ring the full width too.
|
|
31
|
+
*/
|
|
32
|
+
declare const GradientRingButton: React.ForwardRefExoticComponent<GradientRingButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
33
|
+
|
|
34
|
+
interface GradientRingProps {
|
|
35
|
+
/** One pill-shaped control (the ring draws over its outermost pixel). */
|
|
36
|
+
children: ReactNode;
|
|
37
|
+
/** The control takes the full width (a phone's own row). */
|
|
38
|
+
wide?: boolean;
|
|
39
|
+
/** A control that cannot be used now: the ring fades and stays still. */
|
|
40
|
+
quiet?: boolean;
|
|
41
|
+
/** Turn once by itself as it appears, then settle. Read on mount only. */
|
|
42
|
+
cue?: boolean;
|
|
43
|
+
/** One full turn of the gradient while the control is engaged, in seconds. Default 1.5. */
|
|
44
|
+
turnSeconds?: number;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* A 2px border in the theme's gradient (`--color-gradient-start` → middle →
|
|
49
|
+
* end) around one pill-shaped control: at rest the start colour is on the
|
|
50
|
+
* left and the end colour on the right. While the control is pointed at (or
|
|
51
|
+
* focused from the keyboard) the whole gradient turns clockwise, and when it
|
|
52
|
+
* is let go it finishes the turn it is on and settles back.
|
|
53
|
+
*
|
|
54
|
+
* SVG, not a turning CSS layer: a turning layer has to be clipped to the
|
|
55
|
+
* pill, and a clip on an animated layer softens its outermost pixel, which is
|
|
56
|
+
* the whole ring. A stroke is painted as a line wherever it is, so the
|
|
57
|
+
* control can stay transparent. The gradient turns in the outline's own box
|
|
58
|
+
* (objectBoundingBox), so a quarter turn puts the start colour along the
|
|
59
|
+
* whole top however wide the pill is. The stops take the tokens through
|
|
60
|
+
* `currentColor`, and the turn is SMIL. Not rendered for someone who asked
|
|
61
|
+
* for less motion: the ring then only brightens, and keyboard focus gets the
|
|
62
|
+
* page's usual outline.
|
|
63
|
+
*/
|
|
64
|
+
declare function GradientRing({ children, wide, quiet, cue, turnSeconds }: GradientRingProps): React.JSX.Element;
|
|
65
|
+
|
|
66
|
+
export { GradientRing, GradientRingButton, type GradientRingButtonProps, type GradientRingProps };
|
|
@@ -7,16 +7,12 @@ var sizes = {
|
|
|
7
7
|
sm: {
|
|
8
8
|
node: "size-7",
|
|
9
9
|
icon: "size-3.5",
|
|
10
|
-
label: "text-[11px]",
|
|
11
|
-
description: "text-[11px]",
|
|
12
10
|
line: "top-3.5",
|
|
13
11
|
lineFromNode: "left-9"
|
|
14
12
|
},
|
|
15
13
|
default: {
|
|
16
14
|
node: "size-9",
|
|
17
15
|
icon: "size-4.5",
|
|
18
|
-
label: "text-xs",
|
|
19
|
-
description: "text-xs",
|
|
20
16
|
line: "top-4.5",
|
|
21
17
|
lineFromNode: "left-11"
|
|
22
18
|
}
|
|
@@ -106,11 +102,11 @@ function HorizontalStepper({ steps, color = "primary", size = "default", tone =
|
|
|
106
102
|
children: sized(step.icon, s.icon)
|
|
107
103
|
}),
|
|
108
104
|
/* @__PURE__ */ jsx("span", {
|
|
109
|
-
className: cn("max-w-full font-semibold", step.description ? "mt-1" : "truncate",
|
|
105
|
+
className: cn("max-w-full type-label font-semibold", step.description ? "mt-1" : "truncate", reached ? t.label : t.upcomingLabel, start && "text-left"),
|
|
110
106
|
children: step.label
|
|
111
107
|
}),
|
|
112
108
|
step.description && /* @__PURE__ */ jsx("span", {
|
|
113
|
-
className: cn("max-w-full
|
|
109
|
+
className: cn("max-w-full type-secondary text-muted-foreground", start ? "text-left" : "text-center"),
|
|
114
110
|
children: step.description
|
|
115
111
|
})
|
|
116
112
|
]
|