@espressif/dashboard-ui-components 1.12.0 → 1.13.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 +22 -2
- package/.cursor/rules/dashboard-ui-consumption.mdc +22 -2
- package/CHANGELOG.md +43 -0
- package/README.md +9 -4
- package/dist/components/cards/section-card.js +37 -29
- 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/horizontal-stepper/index.d.ts +1 -1
- package/dist/components/index.d.ts +5 -1
- package/dist/components/index.js +11 -6
- 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/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/range-field/index.d.ts +45 -0
- package/dist/components/range-field/index.js +2 -0
- package/dist/components/range-field/range-field.js +164 -0
- package/dist/components/reveal/index.d.ts +6 -3
- package/dist/components/reveal/reveal.js +7 -4
- package/dist/components/search-box/index.d.ts +3 -1
- package/dist/components/search-box/search-box.js +7 -12
- package/dist/components/showcase-card/index.d.ts +14 -3
- package/dist/components/showcase-card/showcase-card.js +43 -2
- package/dist/components/simple-clickable-card/simple-clickable-card-shared.js +3 -1
- package/dist/components/step-tabs/index.d.ts +1 -1
- 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/vertical-stepper/index.d.ts +2 -2
- package/dist/components/vertical-stepper/vertical-stepper.js +7 -4
- package/dist/index.d.ts +5 -1
- package/dist/index.js +11 -6
- package/dist/{vertical-stepper.props-BXYcbW70.d.ts → vertical-stepper.props-DONJJXIy.d.ts} +1 -0
- package/package.json +7 -1
- package/src/styles/theme.css +15 -0
|
@@ -148,6 +148,7 @@ Install only when the feature is used:
|
|
|
148
148
|
|---------|-------------|
|
|
149
149
|
| `@tanstack/react-table` | DataTable |
|
|
150
150
|
| `react-hook-form` | Form-related components |
|
|
151
|
+
| `qrcode` | QrCode |
|
|
151
152
|
| `shiki` | `Code` / syntax highlighting |
|
|
152
153
|
| `recharts` | Chart components |
|
|
153
154
|
|
|
@@ -280,11 +281,28 @@ Things agents get wrong about it:
|
|
|
280
281
|
- A panel that is shown and hidden by a flag is `ColumnPanel` (`open`, `openSize`), not a
|
|
281
282
|
conditional render: it stays mounted (state survives) and goes `inert` when hidden. For your
|
|
282
283
|
own collapsible `ResizablePanel`, pass `usePanelFlag(open, openSize)` as its `panelRef`.
|
|
283
|
-
- `FloatingWindow` does not keep its own position: hold `position`
|
|
284
|
-
spot) and
|
|
284
|
+
- `FloatingWindow` does not keep its own position or size: hold `position` (null = default
|
|
285
|
+
spot) and, for a resizable window, `size` (null = default size) in the app, and store what
|
|
286
|
+
`onMove` / `onResize` hand back. Passing `onResize` (with `resizeLabel`) is what adds the
|
|
287
|
+
corner handle; without it the window keeps its default size. Minimized it renders only its pill.
|
|
285
288
|
- `AnchoredPanel` is non-modal and positioned by a zero-size anchor element the app keeps at
|
|
286
289
|
the point (`anchorRef`); pass `keepOpenFor` for the control that toggles it, or that
|
|
287
290
|
control's own click closes and reopens it.
|
|
291
|
+
- `Trace` lists an agent's steps; it holds nothing itself. Put each step in a `TraceLine`
|
|
292
|
+
(status `running` / `error` / `pending`, unset = done) and say the status in the title as
|
|
293
|
+
well ("Build failed"): colour and shimmer alone do not reach everyone. A line that opens is
|
|
294
|
+
`TraceCollapsible` > `TraceCollapsibleTrigger` (wrapping the `TraceLine`) +
|
|
295
|
+
`TraceCollapsibleContent`; a line with nothing to show stays a plain `TraceLine`, no trigger.
|
|
296
|
+
- `QrCode` needs the optional peer `qrcode` (`npm install qrcode`), loaded only when a code
|
|
297
|
+
shows; without it the `fallback` text shows in its place. Keep it dark on light (`ink` /
|
|
298
|
+
`paper`) in every theme: cameras read that. `label` names it for a screen reader.
|
|
299
|
+
- `RangeField` is controlled (`value` + `onChange`) and translates nothing: pass `labels`
|
|
300
|
+
(the −, + and slider names) in the page's language. `wrap` makes − and + go round (a
|
|
301
|
+
compass). It clamps a typed value on Enter or blur, not on every keystroke.
|
|
302
|
+
- `Keyframes` animates its parent SVG element and renders nothing unless a
|
|
303
|
+
`KeyframesMotion` provider around the scene says it may: provide `false` when the
|
|
304
|
+
person prefers reduced motion. Write the element's own attributes as the LAST value,
|
|
305
|
+
its resting frame.
|
|
288
306
|
- `MessageScroller` scrolls itself: give it a height or a flex parent; do not wrap it in
|
|
289
307
|
another `ScrollArea`. Put messages (`Bubble`s) directly inside.
|
|
290
308
|
|
|
@@ -293,6 +311,8 @@ Things agents get wrong about it:
|
|
|
293
311
|
- `ShowcaseCard` opens something; `ChoiceCard` chooses something (a toggle button with
|
|
294
312
|
`aria-pressed`). For a router link pass `open={{ link: (title) => <Link to=…>{title}</Link> }}`,
|
|
295
313
|
not `href` (which reloads the page).
|
|
314
|
+
- `ShowcaseCard layout="row"` lays the picture at the card's left (a wide list, a few
|
|
315
|
+
big choices); `reveal`, `mediaOverlay` and `titleAction` are for the column card only.
|
|
296
316
|
- The facet filters (`FiltersPanel`, `FiltersPill`, `ActiveFilters`) count nothing and
|
|
297
317
|
translate nothing: the app passes groups with counts, the selection and every label.
|
|
298
318
|
Use `useFiltersCollapsed()` for the panel/pill state and pass
|
|
@@ -133,6 +133,7 @@ Install only when the feature is used:
|
|
|
133
133
|
|---------|-------------|
|
|
134
134
|
| `@tanstack/react-table` | DataTable |
|
|
135
135
|
| `react-hook-form` | Form-related components |
|
|
136
|
+
| `qrcode` | QrCode |
|
|
136
137
|
| `shiki` | `Code` / syntax highlighting |
|
|
137
138
|
| `recharts` | Chart components |
|
|
138
139
|
|
|
@@ -265,11 +266,28 @@ Things agents get wrong about it:
|
|
|
265
266
|
- A panel that is shown and hidden by a flag is `ColumnPanel` (`open`, `openSize`), not a
|
|
266
267
|
conditional render: it stays mounted (state survives) and goes `inert` when hidden. For your
|
|
267
268
|
own collapsible `ResizablePanel`, pass `usePanelFlag(open, openSize)` as its `panelRef`.
|
|
268
|
-
- `FloatingWindow` does not keep its own position: hold `position`
|
|
269
|
-
spot) and
|
|
269
|
+
- `FloatingWindow` does not keep its own position or size: hold `position` (null = default
|
|
270
|
+
spot) and, for a resizable window, `size` (null = default size) in the app, and store what
|
|
271
|
+
`onMove` / `onResize` hand back. Passing `onResize` (with `resizeLabel`) is what adds the
|
|
272
|
+
corner handle; without it the window keeps its default size. Minimized it renders only its pill.
|
|
270
273
|
- `AnchoredPanel` is non-modal and positioned by a zero-size anchor element the app keeps at
|
|
271
274
|
the point (`anchorRef`); pass `keepOpenFor` for the control that toggles it, or that
|
|
272
275
|
control's own click closes and reopens it.
|
|
276
|
+
- `Trace` lists an agent's steps; it holds nothing itself. Put each step in a `TraceLine`
|
|
277
|
+
(status `running` / `error` / `pending`, unset = done) and say the status in the title as
|
|
278
|
+
well ("Build failed"): colour and shimmer alone do not reach everyone. A line that opens is
|
|
279
|
+
`TraceCollapsible` > `TraceCollapsibleTrigger` (wrapping the `TraceLine`) +
|
|
280
|
+
`TraceCollapsibleContent`; a line with nothing to show stays a plain `TraceLine`, no trigger.
|
|
281
|
+
- `QrCode` needs the optional peer `qrcode` (`npm install qrcode`), loaded only when a code
|
|
282
|
+
shows; without it the `fallback` text shows in its place. Keep it dark on light (`ink` /
|
|
283
|
+
`paper`) in every theme: cameras read that. `label` names it for a screen reader.
|
|
284
|
+
- `RangeField` is controlled (`value` + `onChange`) and translates nothing: pass `labels`
|
|
285
|
+
(the −, + and slider names) in the page's language. `wrap` makes − and + go round (a
|
|
286
|
+
compass). It clamps a typed value on Enter or blur, not on every keystroke.
|
|
287
|
+
- `Keyframes` animates its parent SVG element and renders nothing unless a
|
|
288
|
+
`KeyframesMotion` provider around the scene says it may: provide `false` when the
|
|
289
|
+
person prefers reduced motion. Write the element's own attributes as the LAST value,
|
|
290
|
+
its resting frame.
|
|
273
291
|
- `MessageScroller` scrolls itself: give it a height or a flex parent; do not wrap it in
|
|
274
292
|
another `ScrollArea`. Put messages (`Bubble`s) directly inside.
|
|
275
293
|
|
|
@@ -278,6 +296,8 @@ Things agents get wrong about it:
|
|
|
278
296
|
- `ShowcaseCard` opens something; `ChoiceCard` chooses something (a toggle button with
|
|
279
297
|
`aria-pressed`). For a router link pass `open={{ link: (title) => <Link to=…>{title}</Link> }}`,
|
|
280
298
|
not `href` (which reloads the page).
|
|
299
|
+
- `ShowcaseCard layout="row"` lays the picture at the card's left (a wide list, a few
|
|
300
|
+
big choices); `reveal`, `mediaOverlay` and `titleAction` are for the column card only.
|
|
281
301
|
- The facet filters (`FiltersPanel`, `FiltersPill`, `ActiveFilters`) count nothing and
|
|
282
302
|
translate nothing: the app passes groups with counts, the selection and every label.
|
|
283
303
|
Use `useFiltersCollapsed()` for the panel/pill state and pass
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,49 @@ All notable changes to this project are documented here. The format is based on
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres
|
|
5
5
|
to [Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [1.13.0] - 2026-11-19
|
|
8
|
+
|
|
9
|
+
New components and fixes. Nothing is removed or renamed, so existing code keeps
|
|
10
|
+
working. One component looks different: `Reveal` (see Changed).
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- **`Trace`**: a list of an agent's steps, one line each. A line can show its
|
|
14
|
+
status (running, failed, waiting) and open to show more.
|
|
15
|
+
- **`QrCode`**: draws a QR code as an SVG, dark on light in every theme. Needs
|
|
16
|
+
the new optional peer dependency `qrcode` (`npm install qrcode`).
|
|
17
|
+
- **`RangeField`**: a number in a range, with a slider, a box to type the exact
|
|
18
|
+
value, and − / + buttons. With `wrap`, − and + go round (like a compass).
|
|
19
|
+
- **`Keyframes`** and **`KeyframesMotion`**: simple SMIL animations on SVG
|
|
20
|
+
elements, which stay still when the person prefers reduced motion.
|
|
21
|
+
- **`FloatingWindow` can be resized**: pass `onResize` (with `resizeLabel`) to
|
|
22
|
+
get a handle in its corner. The app keeps the size, like the position (`size`,
|
|
23
|
+
`minSize`).
|
|
24
|
+
- **`ShowcaseCard` `layout="row"`**: the picture on the left and the text on the
|
|
25
|
+
right. A new `engage` prop passes pointer and focus handlers to the card.
|
|
26
|
+
- **`SearchBox` `clearLabel`**: the clear button's name for screen readers, in
|
|
27
|
+
the page's language (default "Clear search").
|
|
28
|
+
- **`animate-highlight`**: a short tint that fades out, to point at what just
|
|
29
|
+
opened.
|
|
30
|
+
- Demo pages for `Trace`, `QrCode`, `RangeField` and `Keyframes`, and a row
|
|
31
|
+
example for `ShowcaseCard`.
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
- **`Reveal` no longer hides its content while it waits.** It used to wait
|
|
35
|
+
invisible and fade in, so a section could stay blank in a screenshot, in a
|
|
36
|
+
background tab or with reduced motion. It now waits slightly lower and rises
|
|
37
|
+
into place.
|
|
38
|
+
|
|
39
|
+
### Fixed
|
|
40
|
+
- **`SearchBox`**: when empty, it showed a disabled button with no name, which
|
|
41
|
+
screen readers announced. It now shows a plain magnifier icon.
|
|
42
|
+
- **`Alert`, `IconTextActionCard` and `SimpleClickableCard`**: a description
|
|
43
|
+
passed as elements (several lines, a link) was drawn larger than a text
|
|
44
|
+
description. Both now look the same.
|
|
45
|
+
- **`VerticalStepper`**: a step with only a title now lines up with its icon,
|
|
46
|
+
and an empty description no longer adds a blank line.
|
|
47
|
+
- **`SectionCard`**: in a narrow card, the collapse chevron no longer drops to a
|
|
48
|
+
line of its own.
|
|
49
|
+
|
|
7
50
|
## [1.12.0] - 2026-11-13
|
|
8
51
|
|
|
9
52
|
Everything in this release is additive except the visual changes under
|
package/README.md
CHANGED
|
@@ -117,6 +117,7 @@ npm install @tanstack/react-table # DataTable component
|
|
|
117
117
|
npm install react-hook-form # Form component
|
|
118
118
|
npm install shiki # Code component
|
|
119
119
|
npm install recharts # Chart components
|
|
120
|
+
npm install qrcode # QrCode component
|
|
120
121
|
```
|
|
121
122
|
|
|
122
123
|
### Optional: JS-config projects (`tailwind.config.ts`)
|
|
@@ -569,7 +570,7 @@ This library is shipped as **pre-built ESM**, one module per source file (Vite).
|
|
|
569
570
|
### How to keep consumer builds sensible
|
|
570
571
|
|
|
571
572
|
1. Import from the narrowest [entry point](#entry-points): a single component (`/components/button`), a heavy family (`/charts`, `/date`, …), or a surface (`/components`, `/layouts`, …) rather than the root package.
|
|
572
|
-
2. Install **optional peer dependencies** only for features you use (`@tanstack/react-table`, `react-hook-form`, `shiki`, `recharts`).
|
|
573
|
+
2. Install **optional peer dependencies** only for features you use (`@tanstack/react-table`, `react-hook-form`, `shiki`, `recharts`, `qrcode`).
|
|
573
574
|
3. Prefer **production builds** when measuring size; dev servers and Babel-on-vendor paths often look worse than optimized output.
|
|
574
575
|
4. For web apps, use a **bundle analyzer** on your app if you need to chase kilobytes; expect a sizable vendor chunk for a full-featured UI kit.
|
|
575
576
|
|
|
@@ -680,12 +681,12 @@ version you have installed is the shipped type declarations:
|
|
|
680
681
|
| PreviewCard | Content preview card |
|
|
681
682
|
| Carousel | Slide carousel — horizontal/vertical, dots, arrows or custom navigation, optional autoplay |
|
|
682
683
|
| Coverflow | 3D ring of image cards on a glass reflection, with a caption under the front item; endless, optional autoplay |
|
|
683
|
-
| ShowcaseCard | Catalogue card on `MediaCard`: picture with a slide-up actions strip, a title that opens a page, an app route or an action, meta and footer rows |
|
|
684
|
+
| ShowcaseCard | Catalogue card on `MediaCard`: picture with a slide-up actions strip, a title that opens a page, an app route or an action, meta and footer rows; `layout="row"` puts the picture at the left |
|
|
684
685
|
| ChoiceCard | A card you click to choose something: one toggle button, picture on a mist, ring and tick when selected, greyed with its reason when disabled; `stack` or `row` layout |
|
|
685
686
|
| Toolbar / ToolbarButton | Thin bar of small controls with start, centre and end slots and arrow-key focus movement; 28px icon-only buttons with tooltip, toggle state, count or attention dot |
|
|
686
687
|
| ResizableGroup / ResizablePanel / ResizableSeparator | Panels resized by dragging or the keyboard (react-resizable-panels), with a remembered layout and collapsible panels |
|
|
687
688
|
| ColumnPanel | A resizable panel shown and hidden by a flag, staying mounted (and inert) while hidden; `usePanelFlag` drives any collapsible panel the same way |
|
|
688
|
-
| FloatingWindow | Small draggable non-modal window with minimize-to-pill, dock and close |
|
|
689
|
+
| FloatingWindow | Small draggable, optionally resizable non-modal window with minimize-to-pill, dock and close |
|
|
689
690
|
| AnchoredPanel | Small non-modal panel attached to a point by a leader line, beside the thing it edits |
|
|
690
691
|
| NoticeStrip | Full-width line of news (info, warning, error) across the top of a canvas, with actions and an optional dismiss |
|
|
691
692
|
| Readout | Instrument display: monospace values and units on a dark plate, optionally a toggle button |
|
|
@@ -693,7 +694,11 @@ version you have installed is the shipped type declarations:
|
|
|
693
694
|
| FiltersPanel / FilterGroup / FiltersPill / ActiveFilters | Catalogue filters: a side panel of counted groups with show-more and per-group search, folding into a floating pill, plus removable active-filter tags |
|
|
694
695
|
| InputGroup / InputGroupTextarea / InputGroupAddon | A field and its controls in one bordered box with a shared focus ring; an auto-growing text area |
|
|
695
696
|
| Bubble / MessageScroller | A conversation: one turn's text (tinted for the person's own words), and a scrolling log that follows new messages and offers a jump to the latest |
|
|
696
|
-
|
|
|
697
|
+
| Trace | An agent's steps, one line each (icon, title, description, status), each able to open to show more; a running title shimmers |
|
|
698
|
+
| Reveal | One part of a section's entrance, rising into place when revealed, staggered by order; fully drawn while it waits |
|
|
699
|
+
| QrCode | A QR code drawn as SVG, dark on light in every theme (optional peer `qrcode`) |
|
|
700
|
+
| RangeField | One number in a range: a slider, a box to type it, and − / + that can go round (a compass) |
|
|
701
|
+
| Keyframes | One SMIL animation on an SVG element as values at times; still under reduced motion (`KeyframesMotion`) |
|
|
697
702
|
| CheckBadge | Small success circle with a tick, for inside an SVG scene |
|
|
698
703
|
| PageContainer | Page wrapper with header |
|
|
699
704
|
| DynamicList | Dynamic item list |
|
|
@@ -282,38 +282,46 @@ function SectionCard({ icon, primaryText, secondaryText, truncateSecondaryText =
|
|
|
282
282
|
})
|
|
283
283
|
})
|
|
284
284
|
});
|
|
285
|
-
const
|
|
286
|
-
|
|
287
|
-
|
|
285
|
+
const hasActions = hasRenderableContent(actions);
|
|
286
|
+
const actionsBox = hasActions ? /* @__PURE__ */ jsx("div", {
|
|
287
|
+
className: cn("flex items-center gap-2", HEADER_RIGHT_CLASS, s.headerRightPad, showCollapseIcon && "pr-0"),
|
|
288
|
+
children: actions
|
|
288
289
|
}) : null;
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
290
|
+
function headerRowWith(main) {
|
|
291
|
+
if (!showCollapseIcon) return /* @__PURE__ */ jsxs("div", {
|
|
292
|
+
className: headerRowClass,
|
|
293
|
+
children: [main, actionsBox]
|
|
294
|
+
});
|
|
295
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
296
|
+
className: cn("flex min-w-0 items-center", s.headerRowPadY),
|
|
297
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
298
|
+
className: cn("flex min-w-0 flex-1 items-center justify-between", HEADER_WRAP_ROW_CLASS, s.headerRowGapY),
|
|
299
|
+
children: [main, actionsBox]
|
|
300
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
301
|
+
className: cn("flex shrink-0 items-center", s.headerRightPad, hasActions && "pl-2"),
|
|
302
|
+
children: chevronButton
|
|
303
|
+
})]
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
const header = expandOnHover ? headerRowWith(/* @__PURE__ */ jsx("button", {
|
|
307
|
+
type: "button",
|
|
308
|
+
className: cn("section-card-header", "flex min-w-0 flex-1 items-center text-left rounded-md", headerMainPad, s.gap, "cursor-default outline-none", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),
|
|
309
|
+
"aria-expanded": hasBody ? hover.open : void 0,
|
|
310
|
+
"aria-controls": hasBody ? hoverBodyId : void 0,
|
|
311
|
+
onClick: hover.onHeaderClick,
|
|
312
|
+
children: headerMain
|
|
313
|
+
})) : allowCollapse ? headerRowWith(/* @__PURE__ */ jsx(CollapsibleTrigger, {
|
|
314
|
+
asChild: true,
|
|
315
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
292
316
|
type: "button",
|
|
293
|
-
className: cn("section-card-header", "flex min-w-0 flex-1 items-center text-left rounded-md", headerMainPad, s.gap, "cursor-
|
|
294
|
-
"aria-
|
|
295
|
-
"aria-controls": hasBody ? hoverBodyId : void 0,
|
|
296
|
-
onClick: hover.onHeaderClick,
|
|
297
|
-
children: headerMain
|
|
298
|
-
}), headerRight]
|
|
299
|
-
}) : allowCollapse ? /* @__PURE__ */ jsxs("div", {
|
|
300
|
-
className: headerRowClass,
|
|
301
|
-
children: [/* @__PURE__ */ jsx(CollapsibleTrigger, {
|
|
302
|
-
asChild: true,
|
|
303
|
-
children: /* @__PURE__ */ jsx("button", {
|
|
304
|
-
type: "button",
|
|
305
|
-
className: cn("section-card-header", "flex min-w-0 flex-1 items-center text-left rounded-md", headerMainPad, s.gap, "cursor-pointer outline-none transition-colors hover:bg-muted/50", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),
|
|
306
|
-
"aria-label": toggleLabel,
|
|
307
|
-
children: headerMain
|
|
308
|
-
})
|
|
309
|
-
}), headerRight]
|
|
310
|
-
}) : /* @__PURE__ */ jsxs("div", {
|
|
311
|
-
className: headerRowClass,
|
|
312
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
313
|
-
className: cn("section-card-header", "flex min-w-0 flex-1 items-center", s.gap, headerMainPad),
|
|
317
|
+
className: cn("section-card-header", "flex min-w-0 flex-1 items-center text-left rounded-md", headerMainPad, s.gap, "cursor-pointer outline-none transition-colors hover:bg-muted/50", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),
|
|
318
|
+
"aria-label": toggleLabel,
|
|
314
319
|
children: headerMain
|
|
315
|
-
})
|
|
316
|
-
})
|
|
320
|
+
})
|
|
321
|
+
})) : headerRowWith(/* @__PURE__ */ jsx("div", {
|
|
322
|
+
className: cn("section-card-header", "flex min-w-0 flex-1 items-center", s.gap, headerMainPad),
|
|
323
|
+
children: headerMain
|
|
324
|
+
}));
|
|
317
325
|
const body = hasBody ? /* @__PURE__ */ jsx("div", {
|
|
318
326
|
className: cn("section-card-body", isHeaderRequired && "border-t border-border", variant === "outline" && "dark:border-border/45", fillHeight && "flex min-h-0 flex-1 flex-col", s.pad),
|
|
319
327
|
children
|
|
@@ -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 };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { C as Color } from '../../index-BQANnKs9.js';
|
|
4
|
-
import { c as VerticalStepperStepStatus } from '../../vertical-stepper.props-
|
|
4
|
+
import { c as VerticalStepperStepStatus } from '../../vertical-stepper.props-DONJJXIy.js';
|
|
5
5
|
|
|
6
6
|
/** One stop on the line. `status` is the same as a `VerticalStepper` step's, so data moves between the two. */
|
|
7
7
|
interface HorizontalStepperStep {
|
|
@@ -35,6 +35,7 @@ export { Toolbar, ToolbarButton, ToolbarButtonProps, ToolbarProps } from './tool
|
|
|
35
35
|
export { AnchoredPanel, AnchoredPanelProps } from './anchored-panel/index.js';
|
|
36
36
|
export { FloatingWindow, FloatingWindowPosition, FloatingWindowProps } from './floating-window/index.js';
|
|
37
37
|
export { NoticeStrip, NoticeStripProps, NoticeTone } from './notice-strip/index.js';
|
|
38
|
+
export { Trace, TraceCollapsible, TraceCollapsibleContent, TraceCollapsibleContentProps, TraceCollapsibleProps, TraceCollapsibleTrigger, TraceCollapsibleTriggerProps, TraceDescription, TraceDescriptionProps, TraceIcon, TraceIconProps, TraceLine, TraceLineProps, TraceProps, TraceStatus, TraceTitle, TraceTitleProps } from './trace/index.js';
|
|
38
39
|
export { Readout, ReadoutProps, ReadoutSegment } from './readout/index.js';
|
|
39
40
|
export { ChoiceCard, ChoiceCardProps } from './choice-card/index.js';
|
|
40
41
|
export { ShowcaseCard, ShowcaseCardOpen, ShowcaseCardProps } from './showcase-card/index.js';
|
|
@@ -43,6 +44,9 @@ export { ActiveFilterTag, ActiveFilters, ActiveFiltersProps, FacetFilterGroup, F
|
|
|
43
44
|
export { InputGroup, InputGroupAddon, InputGroupAddonProps, InputGroupProps, InputGroupTextarea, InputGroupTextareaProps } from './input-group/index.js';
|
|
44
45
|
export { Bubble, BubbleProps } from './bubble/index.js';
|
|
45
46
|
export { Reveal, RevealProps } from './reveal/index.js';
|
|
47
|
+
export { QrCode, QrCodeProps } from './qr-code/index.js';
|
|
48
|
+
export { RangeField, RangeFieldLabels, RangeFieldProps } from './range-field/index.js';
|
|
49
|
+
export { Keyframes, KeyframesMotion, KeyframesProps, easeOutSplines, keyTimes } from './keyframes/index.js';
|
|
46
50
|
export { CheckBadge, CheckBadgeProps } from './check-badge/index.js';
|
|
47
51
|
export { MessageScroller, MessageScrollerProps } from './message-scroller/index.js';
|
|
48
52
|
export { ResizableGroup, ResizablePanel, ResizableSeparator } from './resizable/index.js';
|
|
@@ -52,7 +56,7 @@ export { RadioGroup, RadioGroupProps, RadioGroupSize, RadioOption } from './radi
|
|
|
52
56
|
export { SelectableCardList, SelectableCardListElement, SelectableCardListItem, SelectableCardListMultiProps, SelectableCardListProps, SelectableCardListSingleProps, SelectableCardListSize } from './selectable-card-list/index.js';
|
|
53
57
|
export { StatusCardList, StatusCardListItem, StatusCardListProps, StatusCardListSize, StatusCardState } from './status-card-list/index.js';
|
|
54
58
|
export { VerticalStepper } from './vertical-stepper/index.js';
|
|
55
|
-
export { V as VerticalStepperProps, a as VerticalStepperSize, b as VerticalStepperStep, c as VerticalStepperStepStatus } from '../vertical-stepper.props-
|
|
59
|
+
export { V as VerticalStepperProps, a as VerticalStepperSize, b as VerticalStepperStep, c as VerticalStepperStepStatus } from '../vertical-stepper.props-DONJJXIy.js';
|
|
56
60
|
export { HorizontalStepper, HorizontalStepperAlign, HorizontalStepperProps, HorizontalStepperSemantics, HorizontalStepperSize, HorizontalStepperStep } from './horizontal-stepper/index.js';
|
|
57
61
|
export { OptionCardGroup, OptionCardGroupItem, OptionCardGroupProps, OptionCardGroupTag } from './option-card-group/index.js';
|
|
58
62
|
export { StepTabs, StepTabsProps, StepTabsSize, StepTabsStep, StepTabsVariant } from './step-tabs/index.js';
|