@espressif/dashboard-ui-components 1.15.0 → 1.15.1
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 +15 -0
- package/CHANGELOG.md +45 -0
- package/dist/bottom-sheet.props-CFpM7Gvx.d.ts +26 -0
- package/dist/components/bottom-sheet/index.d.ts +3 -25
- package/dist/components/filters-bar/filters-bar-sheet.js +73 -0
- package/dist/components/filters-bar/filters-bar.js +51 -28
- package/dist/components/filters-bar/index.d.ts +35 -8
- package/dist/components/index.d.ts +3 -2
- package/dist/components/stat-card/index.d.ts +8 -0
- package/dist/components/stat-card/stat-card.js +60 -48
- package/dist/index.d.ts +3 -2
- package/package.json +1 -1
|
@@ -296,6 +296,15 @@ Things agents get wrong about it:
|
|
|
296
296
|
(`landscape` 4:3, `square`); do not set the stage height through `className`.
|
|
297
297
|
- The reflection fade uses `mask-*` utilities, which need Tailwind **4.1+**.
|
|
298
298
|
|
|
299
|
+
## StatCard
|
|
300
|
+
|
|
301
|
+
- What a number counts goes in `description`, not inside `heading` as a node: it wraps
|
|
302
|
+
under the heading and is never cut short. `infoContent` is for longer notes behind
|
|
303
|
+
the info button.
|
|
304
|
+
- It lays itself out by its own width (a container query): below about 22rem the icon
|
|
305
|
+
moves above the heading. Do not switch layouts per breakpoint in the app, and give it
|
|
306
|
+
a width (a grid or flex cell), not a shrink-to-fit parent.
|
|
307
|
+
|
|
299
308
|
## CategoryCard or SimpleClickableCard
|
|
300
309
|
|
|
301
310
|
- `CategoryCard` (from `/components`): a "browse by kind" card, stacked: icon tile, a count
|
|
@@ -355,6 +364,12 @@ Things agents get wrong about it:
|
|
|
355
364
|
- `AnchoredPanel` is non-modal and positioned by a zero-size anchor element the app keeps at
|
|
356
365
|
the point (`anchorRef`); pass `keepOpenFor` for the control that toggles it, or that
|
|
357
366
|
control's own click closes and reopens it.
|
|
367
|
+
- `FiltersBar` puts `search` and `actions` on its first row and `filters` on rows of their own
|
|
368
|
+
below. Pass the filter controls only: with `onClearAll` (set it only while something is
|
|
369
|
+
set) and `labels` (`FiltersBarLabels`: `filters`, `clearAll`, `sheet`) it renders "Clear all"
|
|
370
|
+
itself, and below a 576px-wide bar folds the filters into a "Filters" button
|
|
371
|
+
(`activeFilterCount` badge) that opens a `BottomSheet`. Without `labels` the filters scroll
|
|
372
|
+
sideways on a narrow bar. `searchClassName` replaces the default `max-w-md`.
|
|
358
373
|
- `BottomSheet` is non-modal and has no `open` prop: render it to open it, stop rendering it in
|
|
359
374
|
`onClose`. It keeps its own height (half or tall). `labels` (`expand`, `collapse`, `close`)
|
|
360
375
|
are required and not translated. It is `fixed` to the viewport; inside a framed preview pass
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,51 @@ 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.15.1] - 2026-12-04
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- **`StatCard` `description`.** One or two sentences under the heading that say
|
|
11
|
+
what the number counts. It wraps and is never cut short (`body` role,
|
|
12
|
+
`secondary` at `size="sm"`). Apps that put a description inside `heading`
|
|
13
|
+
can move it here.
|
|
14
|
+
- `FiltersBar` `labels` (`FiltersBarLabels`: `filters`, `clearAll`, `sheet`),
|
|
15
|
+
`activeFilterCount` and `onClearAll`. With `labels`, below a 576px-wide bar
|
|
16
|
+
the filters fold into a "Filters" button with a count badge that opens a
|
|
17
|
+
`BottomSheet`: the filters full width, and "Clear all" pinned to its bottom
|
|
18
|
+
edge. `onClearAll` also puts a "Clear all" link after the filters on a wider
|
|
19
|
+
bar, so pages no longer render their own.
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
- **`StatCard` stacks its header when the card is narrow.** Below a content
|
|
23
|
+
width of 20rem (a card about 22rem wide at the default size) the icon moves
|
|
24
|
+
above the heading and is drawn smaller, so the heading and description use
|
|
25
|
+
the card's full width instead of a squeezed column beside the icon. Wider
|
|
26
|
+
cards look as before. The card measures its own width (a container query,
|
|
27
|
+
like `CategoryCard`), so it needs a width from its parent: a grid or flex
|
|
28
|
+
cell, not a shrink-to-fit box.
|
|
29
|
+
- **`StatCard`'s info button sits beside the heading.** The button that opens
|
|
30
|
+
`infoContent` moved from the bottom-right corner to just after the heading,
|
|
31
|
+
so it reads as "about this number"; its popover opens below it. The bottom
|
|
32
|
+
row now appears only for a trend (`previousValue`).
|
|
33
|
+
- **`StatCard` values line up in a row of cards.** When cards in a grid are
|
|
34
|
+
stretched to the same height, the value (and what follows it) sits at the
|
|
35
|
+
bottom, so values stay level when headings or descriptions differ in length.
|
|
36
|
+
- **`FiltersBar` keeps its search and actions in one place, however many
|
|
37
|
+
filters a page has.** The search and the page actions now always share the
|
|
38
|
+
first row, and the filters get a row of their own below it that wraps onto
|
|
39
|
+
further rows. Before, from a 768px-wide bar, everything shared one wrapping
|
|
40
|
+
row: with four filters the search floated halfway down, "Clear all" dropped
|
|
41
|
+
under the first filter and the actions drifted. The filters row wraps from a
|
|
42
|
+
576px-wide bar (was 768px); below that, without `labels`, it still scrolls
|
|
43
|
+
sideways.
|
|
44
|
+
- `FiltersBar`'s search keeps at least 12rem; when the actions don't fit
|
|
45
|
+
beside it they wrap onto a line of their own, end-aligned, instead of
|
|
46
|
+
squeezing it.
|
|
47
|
+
- `FiltersBar` `searchClassName` now replaces `max-w-md` in every layout
|
|
48
|
+
(with `filters` it used to replace `@3xl:w-xs`). A page that passed an
|
|
49
|
+
`@3xl:w-*` width gets a search that grows to fill the row; pass a
|
|
50
|
+
`max-w-*` instead.
|
|
51
|
+
|
|
7
52
|
## [1.15.0] - 2026-11-26
|
|
8
53
|
|
|
9
54
|
### Added
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
/** The sheet's own controls, named in the page's language (no English defaults). */
|
|
4
|
+
interface BottomSheetLabels {
|
|
5
|
+
/** The handle's name while the sheet is at half height. */
|
|
6
|
+
expand: string;
|
|
7
|
+
/** The handle's name while the sheet is tall. */
|
|
8
|
+
collapse: string;
|
|
9
|
+
/** The ✕ button's name. */
|
|
10
|
+
close: string;
|
|
11
|
+
}
|
|
12
|
+
interface BottomSheetProps {
|
|
13
|
+
/** Names the sheet (its dialog role) and shows in its title bar. */
|
|
14
|
+
title: string;
|
|
15
|
+
/** Beside the title. */
|
|
16
|
+
icon?: ReactNode;
|
|
17
|
+
labels: BottomSheetLabels;
|
|
18
|
+
/** Escape, ✕, or a drag or flick down. Open and closed is the parent's: it renders the sheet or doesn't. */
|
|
19
|
+
onClose: () => void;
|
|
20
|
+
/** What the sheet holds; it scrolls on its own below the title bar. */
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
/** Merged onto the sheet's `<section>` (e.g. `absolute` instead of `fixed` inside a framed preview). */
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type { BottomSheetLabels as B, BottomSheetProps as a };
|
|
@@ -1,28 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
/** The sheet's own controls, named in the page's language (no English defaults). */
|
|
5
|
-
interface BottomSheetLabels {
|
|
6
|
-
/** The handle's name while the sheet is at half height. */
|
|
7
|
-
expand: string;
|
|
8
|
-
/** The handle's name while the sheet is tall. */
|
|
9
|
-
collapse: string;
|
|
10
|
-
/** The ✕ button's name. */
|
|
11
|
-
close: string;
|
|
12
|
-
}
|
|
13
|
-
interface BottomSheetProps {
|
|
14
|
-
/** Names the sheet (its dialog role) and shows in its title bar. */
|
|
15
|
-
title: string;
|
|
16
|
-
/** Beside the title. */
|
|
17
|
-
icon?: ReactNode;
|
|
18
|
-
labels: BottomSheetLabels;
|
|
19
|
-
/** Escape, ✕, or a drag or flick down. Open and closed is the parent's: it renders the sheet or doesn't. */
|
|
20
|
-
onClose: () => void;
|
|
21
|
-
/** What the sheet holds; it scrolls on its own below the title bar. */
|
|
22
|
-
children: ReactNode;
|
|
23
|
-
/** Merged onto the sheet's `<section>` (e.g. `absolute` instead of `fixed` inside a framed preview). */
|
|
24
|
-
className?: string;
|
|
25
|
-
}
|
|
2
|
+
import { a as BottomSheetProps } from '../../bottom-sheet.props-CFpM7Gvx.js';
|
|
3
|
+
export { B as BottomSheetLabels } from '../../bottom-sheet.props-CFpM7Gvx.js';
|
|
26
4
|
|
|
27
5
|
/**
|
|
28
6
|
* A phone's panel: a sheet up from the bottom edge, half the screen, so what
|
|
@@ -47,4 +25,4 @@ declare function settleSheet({ share, velocity, from }: {
|
|
|
47
25
|
from: Exclude<SheetRest, "closed">;
|
|
48
26
|
}): SheetRest;
|
|
49
27
|
|
|
50
|
-
export { BottomSheet,
|
|
28
|
+
export { BottomSheet, BottomSheetProps, type SheetRest, settleSheet };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Button } from "../button/button.js";
|
|
2
|
+
import { Badge } from "../../core/badge.js";
|
|
3
|
+
import { BottomSheet } from "../bottom-sheet/bottom-sheet.js";
|
|
4
|
+
import * as React$1 from "react";
|
|
5
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { SlidersHorizontal } from "lucide-react";
|
|
7
|
+
import { createPortal } from "react-dom";
|
|
8
|
+
//#region src/components/filters-bar/filters-bar-sheet.tsx
|
|
9
|
+
/** Matches `@xl` (36rem), where the bar starts showing its filters inline. */
|
|
10
|
+
var INLINE_FILTERS_MIN_WIDTH = 576;
|
|
11
|
+
/**
|
|
12
|
+
* The narrow bar's "Filters" button and the bottom sheet it opens, which holds
|
|
13
|
+
* the filters full width and, pinned to its bottom edge, the "Clear all" link.
|
|
14
|
+
*/
|
|
15
|
+
function FiltersBarSheet({ barRef, filters, activeFilterCount, onClearAll, labels }) {
|
|
16
|
+
const [open, setOpen] = React$1.useState(false);
|
|
17
|
+
React$1.useEffect(() => {
|
|
18
|
+
const bar = barRef.current;
|
|
19
|
+
if (!open || !bar || typeof ResizeObserver === "undefined") return;
|
|
20
|
+
const observer = new ResizeObserver(([entry]) => {
|
|
21
|
+
if (entry && entry.contentRect.width >= INLINE_FILTERS_MIN_WIDTH) setOpen(false);
|
|
22
|
+
});
|
|
23
|
+
observer.observe(bar);
|
|
24
|
+
return () => observer.disconnect();
|
|
25
|
+
}, [open, barRef]);
|
|
26
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(Button, {
|
|
27
|
+
type: "button",
|
|
28
|
+
variant: "outline",
|
|
29
|
+
color: "gray",
|
|
30
|
+
size: "sm",
|
|
31
|
+
fullWidth: false,
|
|
32
|
+
"aria-expanded": open,
|
|
33
|
+
"aria-haspopup": "dialog",
|
|
34
|
+
startIcon: /* @__PURE__ */ jsx(SlidersHorizontal, { "aria-hidden": true }),
|
|
35
|
+
className: "shrink-0 @xl:hidden",
|
|
36
|
+
onClick: () => setOpen(!open),
|
|
37
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
38
|
+
className: "sr-only",
|
|
39
|
+
children: labels.filters
|
|
40
|
+
}), activeFilterCount > 0 && /* @__PURE__ */ jsx(Badge, {
|
|
41
|
+
variant: "solid",
|
|
42
|
+
color: "primary",
|
|
43
|
+
radius: "full",
|
|
44
|
+
className: "font-mono",
|
|
45
|
+
children: activeFilterCount
|
|
46
|
+
})]
|
|
47
|
+
}), open && createPortal(/* @__PURE__ */ jsx(BottomSheet, {
|
|
48
|
+
title: labels.filters,
|
|
49
|
+
icon: /* @__PURE__ */ jsx(SlidersHorizontal, {}),
|
|
50
|
+
labels: labels.sheet,
|
|
51
|
+
onClose: () => setOpen(false),
|
|
52
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
53
|
+
className: "flex min-h-full flex-col",
|
|
54
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
55
|
+
className: "flex flex-col gap-3 p-4 *:w-full *:max-w-none! *:justify-start [&>*>:last-child]:ml-auto",
|
|
56
|
+
children: filters
|
|
57
|
+
}), onClearAll && /* @__PURE__ */ jsx("div", {
|
|
58
|
+
className: "sticky bottom-0 mt-auto border-t border-border bg-background p-4",
|
|
59
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
60
|
+
type: "button",
|
|
61
|
+
variant: "link",
|
|
62
|
+
color: "error",
|
|
63
|
+
size: "sm",
|
|
64
|
+
className: "justify-center font-normal",
|
|
65
|
+
onClick: onClearAll,
|
|
66
|
+
children: labels.clearAll
|
|
67
|
+
})
|
|
68
|
+
})]
|
|
69
|
+
})
|
|
70
|
+
}), document.body)] });
|
|
71
|
+
}
|
|
72
|
+
//#endregion
|
|
73
|
+
export { FiltersBarSheet as default };
|
|
@@ -1,39 +1,62 @@
|
|
|
1
1
|
import { cn } from "../../utils/cn.js";
|
|
2
2
|
import { densityStyle } from "../../utils/style-axes.js";
|
|
3
|
+
import { Button } from "../button/button.js";
|
|
4
|
+
import FiltersBarSheet from "./filters-bar-sheet.js";
|
|
5
|
+
import * as React$1 from "react";
|
|
3
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
7
|
//#region src/components/filters-bar/filters-bar.tsx
|
|
5
|
-
|
|
8
|
+
/**
|
|
9
|
+
* A list page's toolbar. The first row holds the search and the page actions;
|
|
10
|
+
* the filters and "Clear all" get rows of their own below it, so adding a
|
|
11
|
+
* filter never moves the search or the actions.
|
|
12
|
+
*/
|
|
13
|
+
function FiltersBar({ search, actions, filters, activeFilterCount = 0, onClearAll, labels, searchClassName, className, density }) {
|
|
14
|
+
const barRef = React$1.useRef(null);
|
|
6
15
|
const style = densityStyle(density);
|
|
7
|
-
|
|
8
|
-
|
|
16
|
+
const foldsIntoSheet = Boolean(filters && labels);
|
|
17
|
+
const clearAll = onClearAll && labels && /* @__PURE__ */ jsx(Button, {
|
|
18
|
+
type: "button",
|
|
19
|
+
variant: "link",
|
|
20
|
+
color: "error",
|
|
21
|
+
size: "sm",
|
|
22
|
+
fullWidth: false,
|
|
23
|
+
className: "font-normal",
|
|
24
|
+
onClick: onClearAll,
|
|
25
|
+
children: labels.clearAll
|
|
26
|
+
});
|
|
27
|
+
const firstRow = (search || actions || foldsIntoSheet) && /* @__PURE__ */ jsxs("div", {
|
|
28
|
+
className: "flex w-full flex-wrap items-center justify-between gap-3 md:gap-4",
|
|
29
|
+
children: [
|
|
30
|
+
search && /* @__PURE__ */ jsx("div", {
|
|
31
|
+
className: cn("min-w-48 flex-1", searchClassName ?? "max-w-md"),
|
|
32
|
+
children: search
|
|
33
|
+
}),
|
|
34
|
+
foldsIntoSheet && labels && /* @__PURE__ */ jsx(FiltersBarSheet, {
|
|
35
|
+
barRef,
|
|
36
|
+
filters,
|
|
37
|
+
activeFilterCount,
|
|
38
|
+
onClearAll,
|
|
39
|
+
labels
|
|
40
|
+
}),
|
|
41
|
+
actions && /* @__PURE__ */ jsx("div", {
|
|
42
|
+
className: "ml-auto flex shrink-0 items-center justify-end gap-2 md:gap-3",
|
|
43
|
+
children: actions
|
|
44
|
+
})
|
|
45
|
+
]
|
|
46
|
+
});
|
|
47
|
+
if (!filters) return /* @__PURE__ */ jsx("div", {
|
|
48
|
+
className: cn("w-full", className),
|
|
9
49
|
style,
|
|
10
|
-
children:
|
|
11
|
-
className: cn("min-w-0 flex-1", searchClassName ?? "max-w-md"),
|
|
12
|
-
children: search
|
|
13
|
-
}), actions && /* @__PURE__ */ jsx("div", {
|
|
14
|
-
className: "ml-auto flex shrink-0 items-center justify-end gap-2 md:gap-3",
|
|
15
|
-
children: actions
|
|
16
|
-
})]
|
|
50
|
+
children: firstRow
|
|
17
51
|
});
|
|
18
|
-
return /* @__PURE__ */
|
|
19
|
-
|
|
52
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
53
|
+
ref: barRef,
|
|
54
|
+
className: cn("@container flex w-full flex-col gap-3", className),
|
|
20
55
|
style,
|
|
21
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
22
|
-
className: "flex flex-
|
|
23
|
-
children: [
|
|
24
|
-
|
|
25
|
-
children: [search && /* @__PURE__ */ jsx("div", {
|
|
26
|
-
className: cn("min-w-0 flex-1 @3xl:order-1 @3xl:flex-none", searchClassName ?? "@3xl:w-xs"),
|
|
27
|
-
children: search
|
|
28
|
-
}), actions && /* @__PURE__ */ jsx("div", {
|
|
29
|
-
className: "ml-auto flex shrink-0 items-center justify-end gap-2 @3xl:order-3",
|
|
30
|
-
children: actions
|
|
31
|
-
})]
|
|
32
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
33
|
-
className: "-m-1 flex min-w-0 flex-nowrap items-center gap-2 overflow-x-auto p-1 [scrollbar-width:none] empty:hidden *:shrink-0 [&::-webkit-scrollbar]:hidden @3xl:order-2 @3xl:m-0 @3xl:flex-1 @3xl:flex-wrap @3xl:gap-x-5 @3xl:gap-y-3 @3xl:overflow-visible @3xl:p-0",
|
|
34
|
-
children: filters
|
|
35
|
-
})]
|
|
36
|
-
})
|
|
56
|
+
children: [firstRow, /* @__PURE__ */ jsxs("div", {
|
|
57
|
+
className: cn("-m-1 flex min-w-0 flex-nowrap items-center gap-2 overflow-x-auto p-1 [scrollbar-width:none] empty:hidden *:shrink-0 [&::-webkit-scrollbar]:hidden @xl:m-0 @xl:flex-wrap @xl:overflow-visible @xl:p-0", foldsIntoSheet && "@max-xl:hidden"),
|
|
58
|
+
children: [filters, clearAll]
|
|
59
|
+
})]
|
|
37
60
|
});
|
|
38
61
|
}
|
|
39
62
|
//#endregion
|
|
@@ -1,26 +1,53 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
+
import { B as BottomSheetLabels } from '../../bottom-sheet.props-CFpM7Gvx.js';
|
|
3
4
|
import { d as DensityProps } from '../../style-axes-DSQ2DGc5.js';
|
|
4
5
|
|
|
6
|
+
/** The bar's own words, in the page's language (no English defaults). */
|
|
7
|
+
interface FiltersBarLabels {
|
|
8
|
+
/** Names the button that opens the filters sheet on a narrow bar, and titles that sheet. */
|
|
9
|
+
filters: string;
|
|
10
|
+
/** The "Clear all" link shown after the filters while `onClearAll` is set. */
|
|
11
|
+
clearAll: string;
|
|
12
|
+
/** The filters sheet's own controls. */
|
|
13
|
+
sheet: BottomSheetLabels;
|
|
14
|
+
}
|
|
5
15
|
interface FiltersBarProps extends DensityProps {
|
|
6
16
|
/** Search box. Grows to fill the first row next to `actions`. */
|
|
7
17
|
search?: ReactNode;
|
|
8
|
-
/** Primary actions (create, scope menus). End-aligned and never shrunk. */
|
|
18
|
+
/** Primary actions (create, scope menus). End-aligned on the first row and never shrunk. */
|
|
9
19
|
actions?: ReactNode;
|
|
10
20
|
/**
|
|
11
|
-
* Filter controls
|
|
12
|
-
*
|
|
13
|
-
*
|
|
21
|
+
* Filter controls. They get a row of their own under the search and
|
|
22
|
+
* actions, and wrap onto further rows when they don't fit. Below a
|
|
23
|
+
* 576px-wide bar, with `labels`, they fold into a "Filters" button that opens
|
|
24
|
+
* a bottom sheet; without `labels` they scroll sideways instead. Omit for a
|
|
25
|
+
* single search + actions row.
|
|
14
26
|
*/
|
|
15
27
|
filters?: ReactNode;
|
|
28
|
+
/** How many filters are set, shown as a badge on the narrow bar's "Filters" button. */
|
|
29
|
+
activeFilterCount?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Clears every filter. While set (and with `labels`), the bar shows a
|
|
32
|
+
* "Clear all" link after the filters and in the filters sheet. Pass it only
|
|
33
|
+
* while something is set.
|
|
34
|
+
*/
|
|
35
|
+
onClearAll?: () => void;
|
|
36
|
+
/** Needed for the "Filters" button, its sheet and the "Clear all" link. */
|
|
37
|
+
labels?: FiltersBarLabels;
|
|
16
38
|
/**
|
|
17
|
-
* Replaces the search wrapper's default width
|
|
18
|
-
*
|
|
39
|
+
* Replaces the search wrapper's default width, `max-w-md`: a different
|
|
40
|
+
* maximum, or a fixed width that stops it growing.
|
|
19
41
|
*/
|
|
20
42
|
searchClassName?: string;
|
|
21
43
|
className?: string;
|
|
22
44
|
}
|
|
23
45
|
|
|
24
|
-
|
|
46
|
+
/**
|
|
47
|
+
* A list page's toolbar. The first row holds the search and the page actions;
|
|
48
|
+
* the filters and "Clear all" get rows of their own below it, so adding a
|
|
49
|
+
* filter never moves the search or the actions.
|
|
50
|
+
*/
|
|
51
|
+
declare function FiltersBar({ search, actions, filters, activeFilterCount, onClearAll, labels, searchClassName, className, density, }: FiltersBarProps): React.JSX.Element;
|
|
25
52
|
|
|
26
|
-
export { FiltersBar, type FiltersBarProps };
|
|
53
|
+
export { FiltersBar, type FiltersBarLabels, type FiltersBarProps };
|
|
@@ -34,7 +34,8 @@ export { ViewMode, ViewToggle, ViewToggleLabels, ViewToggleProps } from './view-
|
|
|
34
34
|
export { Toolbar, ToolbarButton, ToolbarButtonProps, ToolbarProps } from './toolbar/index.js';
|
|
35
35
|
export { AnchoredPanel, AnchoredPanelProps } from './anchored-panel/index.js';
|
|
36
36
|
export { FloatingWindow, FloatingWindowPosition, FloatingWindowProps } from './floating-window/index.js';
|
|
37
|
-
export { BottomSheet,
|
|
37
|
+
export { BottomSheet, SheetRest, settleSheet } from './bottom-sheet/index.js';
|
|
38
|
+
export { B as BottomSheetLabels, a as BottomSheetProps } from '../bottom-sheet.props-CFpM7Gvx.js';
|
|
38
39
|
export { NoticeStrip, NoticeStripProps, NoticeTone } from './notice-strip/index.js';
|
|
39
40
|
export { Trace, TraceCollapsible, TraceCollapsibleContent, TraceCollapsibleContentProps, TraceCollapsibleProps, TraceCollapsibleTrigger, TraceCollapsibleTriggerProps, TraceDescription, TraceDescriptionProps, TraceIcon, TraceIconProps, TraceLine, TraceLineProps, TraceProps, TraceStatus, TraceTitle, TraceTitleProps } from './trace/index.js';
|
|
40
41
|
export { Readout, ReadoutProps, ReadoutSegment } from './readout/index.js';
|
|
@@ -96,7 +97,7 @@ export { useIsMobile } from './use-mobile/index.js';
|
|
|
96
97
|
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow } from './table/index.js';
|
|
97
98
|
export { Link, LinkColor, LinkProps } from './link/index.js';
|
|
98
99
|
export { SearchBox, SearchBoxProps } from './search-box/index.js';
|
|
99
|
-
export { FiltersBar, FiltersBarProps } from './filters-bar/index.js';
|
|
100
|
+
export { FiltersBar, FiltersBarLabels, FiltersBarProps } from './filters-bar/index.js';
|
|
100
101
|
export { AdvancedSearchBox, AdvancedSearchBoxProps, SearchMeta } from './advanced-search-box/index.js';
|
|
101
102
|
export { TogglableItem, TogglableItemsList, TogglableItemsListProps } from './togglable-items-list/index.js';
|
|
102
103
|
export { DEFAULT_PAGE_SIZE_OPTIONS, Pagination, PaginationProps } from './pagination/index.js';
|
|
@@ -17,6 +17,14 @@ interface StatCardProps extends Omit<HTMLAttributes<HTMLDivElement>, "color">, P
|
|
|
17
17
|
loading?: boolean;
|
|
18
18
|
icon?: ReactNode;
|
|
19
19
|
heading: string | ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* One or two sentences under the heading that say what the number counts
|
|
22
|
+
* ("Devices that connected at least once in the window"). It wraps, and is
|
|
23
|
+
* never cut short. While the card is narrower than about 22rem the icon
|
|
24
|
+
* moves above the heading, so the heading and description get the card's
|
|
25
|
+
* full width.
|
|
26
|
+
*/
|
|
27
|
+
description?: ReactNode;
|
|
20
28
|
value: number;
|
|
21
29
|
previousValue?: number;
|
|
22
30
|
previousValueComparisonTip?: string | ReactNode;
|
|
@@ -39,10 +39,11 @@ var SIZE_STYLES = {
|
|
|
39
39
|
gap: "gap-4",
|
|
40
40
|
headerGap: "gap-3",
|
|
41
41
|
avatar: 40,
|
|
42
|
-
|
|
42
|
+
avatarClass: "size-9! @[20rem]:size-10!",
|
|
43
|
+
icon: "size-4.5 @[20rem]:size-5",
|
|
43
44
|
value: "text-2xl",
|
|
44
45
|
badge: "gap-1 rounded-[var(--espd-own-radius,var(--espd-radius-pill,calc(infinity*1px)))] px-2.5 py-0.5 type-caption",
|
|
45
|
-
info: "size-
|
|
46
|
+
info: "-my-1 size-6 [&_svg]:size-3.5",
|
|
46
47
|
visual: "h-7"
|
|
47
48
|
},
|
|
48
49
|
default: {
|
|
@@ -50,10 +51,11 @@ var SIZE_STYLES = {
|
|
|
50
51
|
gap: "gap-5",
|
|
51
52
|
headerGap: "gap-3",
|
|
52
53
|
avatar: 52,
|
|
53
|
-
|
|
54
|
+
avatarClass: "size-10! @[20rem]:size-13!",
|
|
55
|
+
icon: "size-5 @[20rem]:size-6",
|
|
54
56
|
value: "text-3xl",
|
|
55
57
|
badge: "gap-1 rounded-[var(--espd-own-radius,var(--espd-radius-pill,calc(infinity*1px)))] px-3 py-1 type-caption",
|
|
56
|
-
info: "size-
|
|
58
|
+
info: "-my-1 size-7 [&_svg]:size-4",
|
|
57
59
|
visual: "h-8"
|
|
58
60
|
},
|
|
59
61
|
lg: {
|
|
@@ -61,10 +63,11 @@ var SIZE_STYLES = {
|
|
|
61
63
|
gap: "gap-6",
|
|
62
64
|
headerGap: "gap-4",
|
|
63
65
|
avatar: 60,
|
|
64
|
-
|
|
66
|
+
avatarClass: "size-12! @[20rem]:size-15!",
|
|
67
|
+
icon: "size-6 @[20rem]:size-7",
|
|
65
68
|
value: "text-4xl",
|
|
66
69
|
badge: "gap-1.5 rounded-[var(--espd-own-radius,var(--espd-radius-pill,calc(infinity*1px)))] px-3.5 py-1 type-caption",
|
|
67
|
-
info: "size-
|
|
70
|
+
info: "-my-1 size-8 [&_svg]:size-5",
|
|
68
71
|
visual: "h-10"
|
|
69
72
|
}
|
|
70
73
|
};
|
|
@@ -113,7 +116,7 @@ function getTrend(value, previousValue) {
|
|
|
113
116
|
label: `${Math.abs(percent).toLocaleString(void 0, { maximumFractionDigits: 1 })}%`
|
|
114
117
|
};
|
|
115
118
|
}
|
|
116
|
-
var StatCard = React$1.forwardRef(({ color, size = "default", loading = false, icon, heading, value, previousValue, previousValueComparisonTip, infoContent, infoIconLabel = "More information", valueType = "number", surface: surfaceKind = "tinted", visual, caption, className, style, radius, ...divProps }, ref) => {
|
|
119
|
+
var StatCard = React$1.forwardRef(({ color, size = "default", loading = false, icon, heading, description, value, previousValue, previousValueComparisonTip, infoContent, infoIconLabel = "More information", valueType = "number", surface: surfaceKind = "tinted", visual, caption, className, style, radius, ...divProps }, ref) => {
|
|
117
120
|
const { partStyle } = useStyleAxes({ radius }, ["radius"]);
|
|
118
121
|
const s = SIZE_STYLES[size];
|
|
119
122
|
const statColor = resolveStatColor(color, value, previousValue);
|
|
@@ -121,7 +124,6 @@ var StatCard = React$1.forwardRef(({ color, size = "default", loading = false, i
|
|
|
121
124
|
const trend = getTrend(value, previousValue);
|
|
122
125
|
const showTrend = trend !== void 0 && !(value === 0 && previousValue === 0);
|
|
123
126
|
const showInfo = hasRenderableContent(infoContent);
|
|
124
|
-
const showFooter = showTrend || showInfo;
|
|
125
127
|
const presetInfoClass = isPresetColor(statColor) ? PRESET_INFO_CLASS[statColor] : void 0;
|
|
126
128
|
const infoButtonStyle = !isPresetColor(statColor) && typeof statColor === "string" ? {
|
|
127
129
|
color: statColor,
|
|
@@ -129,7 +131,7 @@ var StatCard = React$1.forwardRef(({ color, size = "default", loading = false, i
|
|
|
129
131
|
} : void 0;
|
|
130
132
|
return /* @__PURE__ */ jsxs("div", {
|
|
131
133
|
ref,
|
|
132
|
-
className: cn("relative isolate flex w-full flex-col overflow-hidden border border-transparent text-foreground", s.card, surface.className, className),
|
|
134
|
+
className: cn("@container relative isolate flex w-full flex-col overflow-hidden border border-transparent text-foreground", s.card, surface.className, className),
|
|
133
135
|
style: {
|
|
134
136
|
...partStyle,
|
|
135
137
|
...surface.style,
|
|
@@ -144,10 +146,11 @@ var StatCard = React$1.forwardRef(({ color, size = "default", loading = false, i
|
|
|
144
146
|
color: statColor
|
|
145
147
|
})
|
|
146
148
|
}) : null, /* @__PURE__ */ jsxs("div", {
|
|
147
|
-
className: cn("relative z-10 flex flex-col", s.gap, loading && "pointer-events-none blur-[1px] opacity-60"),
|
|
149
|
+
className: cn("relative z-10 flex flex-1 flex-col", s.gap, loading && "pointer-events-none blur-[1px] opacity-60"),
|
|
148
150
|
children: [
|
|
149
151
|
/* @__PURE__ */ jsxs("div", {
|
|
150
|
-
|
|
152
|
+
"data-slot": "stat-card-header",
|
|
153
|
+
className: cn("flex flex-col items-start @[20rem]:flex-row @[20rem]:items-center", s.headerGap),
|
|
151
154
|
children: [icon ? /* @__PURE__ */ jsx(IconAvatar, {
|
|
152
155
|
color: statColor,
|
|
153
156
|
size: s.avatar,
|
|
@@ -155,16 +158,42 @@ var StatCard = React$1.forwardRef(({ color, size = "default", loading = false, i
|
|
|
155
158
|
show: true,
|
|
156
159
|
color: statColor
|
|
157
160
|
},
|
|
161
|
+
className: s.avatarClass,
|
|
162
|
+
discClassName: s.avatarClass,
|
|
158
163
|
children: renderSizedIcon(icon, s.icon)
|
|
159
|
-
}) : null, /* @__PURE__ */
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
+
}) : null, /* @__PURE__ */ jsxs("div", {
|
|
165
|
+
className: "flex min-w-0 flex-col gap-1 @[20rem]:flex-1",
|
|
166
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
167
|
+
className: "flex min-w-0 items-center gap-1",
|
|
168
|
+
children: [/* @__PURE__ */ jsx(Typography, {
|
|
169
|
+
as: "div",
|
|
170
|
+
variant: "heading",
|
|
171
|
+
className: "min-w-0 font-medium leading-tight",
|
|
172
|
+
children: heading
|
|
173
|
+
}), showInfo ? /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
174
|
+
asChild: true,
|
|
175
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
176
|
+
type: "button",
|
|
177
|
+
"aria-label": infoIconLabel,
|
|
178
|
+
className: cn("inline-flex shrink-0 items-center justify-center rounded-full outline-none transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-background", s.info, presetInfoClass),
|
|
179
|
+
style: infoButtonStyle,
|
|
180
|
+
children: /* @__PURE__ */ jsx(Info, { "aria-hidden": true })
|
|
181
|
+
})
|
|
182
|
+
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
183
|
+
align: "start",
|
|
184
|
+
side: "bottom",
|
|
185
|
+
sideOffset: 8,
|
|
186
|
+
children: infoContent
|
|
187
|
+
})] }) : null]
|
|
188
|
+
}), hasRenderableContent(description) ? /* @__PURE__ */ jsx("div", {
|
|
189
|
+
"data-slot": "stat-card-description",
|
|
190
|
+
className: cn("text-foreground-secondary", size === "sm" ? "type-secondary" : "type-body"),
|
|
191
|
+
children: description
|
|
192
|
+
}) : null]
|
|
164
193
|
})]
|
|
165
194
|
}),
|
|
166
195
|
/* @__PURE__ */ jsx("div", {
|
|
167
|
-
className: cn("font-bold leading-none tracking-tight text-foreground", s.value),
|
|
196
|
+
className: cn("mt-auto font-bold leading-none tracking-tight text-foreground", s.value),
|
|
168
197
|
children: formatValue(value, valueType)
|
|
169
198
|
}),
|
|
170
199
|
visual != null || caption != null ? /* @__PURE__ */ jsxs("div", {
|
|
@@ -178,37 +207,20 @@ var StatCard = React$1.forwardRef(({ color, size = "default", loading = false, i
|
|
|
178
207
|
children: caption
|
|
179
208
|
}) : null]
|
|
180
209
|
}) : null,
|
|
181
|
-
|
|
182
|
-
className: "flex items-center gap-3 type-secondary",
|
|
183
|
-
children: [/* @__PURE__ */ jsxs(
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
children: previousValueComparisonTip
|
|
196
|
-
}) : null]
|
|
197
|
-
}), showInfo ? /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
198
|
-
asChild: true,
|
|
199
|
-
children: /* @__PURE__ */ jsx("button", {
|
|
200
|
-
type: "button",
|
|
201
|
-
"aria-label": infoIconLabel,
|
|
202
|
-
className: cn("inline-flex shrink-0 items-center justify-center rounded-full outline-none transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-background", s.info, presetInfoClass),
|
|
203
|
-
style: infoButtonStyle,
|
|
204
|
-
children: /* @__PURE__ */ jsx(Info, { "aria-hidden": true })
|
|
205
|
-
})
|
|
206
|
-
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
207
|
-
align: "end",
|
|
208
|
-
side: "top",
|
|
209
|
-
sideOffset: 8,
|
|
210
|
-
children: infoContent
|
|
211
|
-
})] }) : null]
|
|
210
|
+
showTrend ? /* @__PURE__ */ jsxs("div", {
|
|
211
|
+
className: "flex min-w-0 items-center gap-3 type-secondary",
|
|
212
|
+
children: [/* @__PURE__ */ jsxs(Badge, {
|
|
213
|
+
color: statColor,
|
|
214
|
+
variant: "outline",
|
|
215
|
+
className: s.badge,
|
|
216
|
+
children: [trend.direction === "flat" ? null : /* @__PURE__ */ jsx(Triangle, {
|
|
217
|
+
"aria-hidden": true,
|
|
218
|
+
className: cn("size-3 fill-current stroke-current", trend.direction === "down" && "rotate-180")
|
|
219
|
+
}), trend.label]
|
|
220
|
+
}), hasRenderableContent(previousValueComparisonTip) ? /* @__PURE__ */ jsx("span", {
|
|
221
|
+
className: "min-w-0 truncate text-foreground",
|
|
222
|
+
children: previousValueComparisonTip
|
|
223
|
+
}) : null]
|
|
212
224
|
}) : null
|
|
213
225
|
]
|
|
214
226
|
})]
|
package/dist/index.d.ts
CHANGED
|
@@ -34,7 +34,8 @@ export { ViewMode, ViewToggle, ViewToggleLabels, ViewToggleProps } from './compo
|
|
|
34
34
|
export { Toolbar, ToolbarButton, ToolbarButtonProps, ToolbarProps } from './components/toolbar/index.js';
|
|
35
35
|
export { AnchoredPanel, AnchoredPanelProps } from './components/anchored-panel/index.js';
|
|
36
36
|
export { FloatingWindow, FloatingWindowPosition, FloatingWindowProps } from './components/floating-window/index.js';
|
|
37
|
-
export { BottomSheet,
|
|
37
|
+
export { BottomSheet, SheetRest, settleSheet } from './components/bottom-sheet/index.js';
|
|
38
|
+
export { B as BottomSheetLabels, a as BottomSheetProps } from './bottom-sheet.props-CFpM7Gvx.js';
|
|
38
39
|
export { NoticeStrip, NoticeStripProps, NoticeTone } from './components/notice-strip/index.js';
|
|
39
40
|
export { Trace, TraceCollapsible, TraceCollapsibleContent, TraceCollapsibleContentProps, TraceCollapsibleProps, TraceCollapsibleTrigger, TraceCollapsibleTriggerProps, TraceDescription, TraceDescriptionProps, TraceIcon, TraceIconProps, TraceLine, TraceLineProps, TraceProps, TraceStatus, TraceTitle, TraceTitleProps } from './components/trace/index.js';
|
|
40
41
|
export { Readout, ReadoutProps, ReadoutSegment } from './components/readout/index.js';
|
|
@@ -96,7 +97,7 @@ export { useIsMobile } from './components/use-mobile/index.js';
|
|
|
96
97
|
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow } from './components/table/index.js';
|
|
97
98
|
export { Link, LinkColor, LinkProps } from './components/link/index.js';
|
|
98
99
|
export { SearchBox, SearchBoxProps } from './components/search-box/index.js';
|
|
99
|
-
export { FiltersBar, FiltersBarProps } from './components/filters-bar/index.js';
|
|
100
|
+
export { FiltersBar, FiltersBarLabels, FiltersBarProps } from './components/filters-bar/index.js';
|
|
100
101
|
export { AdvancedSearchBox, AdvancedSearchBoxProps, SearchMeta } from './components/advanced-search-box/index.js';
|
|
101
102
|
export { TogglableItem, TogglableItemsList, TogglableItemsListProps } from './components/togglable-items-list/index.js';
|
|
102
103
|
export { DEFAULT_PAGE_SIZE_OPTIONS, Pagination, PaginationProps } from './components/pagination/index.js';
|
package/package.json
CHANGED