basalt-ui 2.27.1 → 2.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +111 -0
- package/MIGRATING.md +172 -12
- package/agent/rules/basalt-batteries.md +1 -1
- package/agent/rules/basalt-mantine.md +1 -1
- package/agent/rules/basalt-tokens.md +2 -2
- package/agent/skills/basalt-design/SKILL.md +1 -1
- package/agent/skills/basalt-design/references/catalogue.md +40 -36
- package/agent/skills/basalt-design/references/recipes.md +47 -0
- package/configs/oxlint-basalt.json +2 -1
- package/configs/oxlint-plugin.js +110 -2
- package/configs/oxlint-plugin.test.ts +99 -4
- package/dist/agent/chat/thread-message.d.ts +1 -160
- package/dist/agent/chat/thread-message.d.ts.map +1 -1
- package/dist/agent/chat/thread-message.js +7 -162
- package/dist/agent/chat/virtualize.d.ts +5 -5
- package/dist/charts/ChartCard.d.ts +5 -2
- package/dist/charts/ChartCard.d.ts.map +1 -1
- package/dist/charts/ChartCard.js +46 -13
- package/dist/charts/Lines.d.ts.map +1 -1
- package/dist/charts/Lines.js +11 -4
- package/dist/charts/Sparkline.d.ts +9 -2
- package/dist/charts/Sparkline.d.ts.map +1 -1
- package/dist/charts/Sparkline.js +104 -41
- package/dist/charts/chart-box.module.css +69 -3
- package/dist/charts/chart-box.module.css.d.ts +5 -0
- package/dist/charts/chart-card.module.css +12 -4
- package/dist/charts/chart-card.module.css.d.ts +1 -0
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +21 -19
- package/dist/charts/labels.d.ts +13 -3
- package/dist/charts/labels.d.ts.map +1 -1
- package/dist/charts/labels.js +131 -20
- package/dist/charts/legend.d.ts.map +1 -1
- package/dist/charts/legend.js +1 -1
- package/dist/charts/ref-label.d.ts +31 -8
- package/dist/charts/ref-label.d.ts.map +1 -1
- package/dist/charts/ref-label.js +40 -9
- package/dist/charts/sparkline.module.css +6 -0
- package/dist/charts/state.d.ts +3 -3
- package/dist/charts/state.d.ts.map +1 -1
- package/dist/charts/state.js +20 -2
- package/dist/cli/shot/capture.d.ts +6 -1
- package/dist/cli/shot/capture.d.ts.map +1 -1
- package/dist/cli/shot/capture.js +18 -5
- package/dist/common/empty-copy.d.ts +16 -0
- package/dist/common/empty-copy.d.ts.map +1 -0
- package/dist/common/empty-copy.js +9 -0
- package/dist/common/virtual-rows.d.ts +196 -0
- package/dist/common/virtual-rows.d.ts.map +1 -0
- package/dist/common/virtual-rows.js +290 -0
- package/dist/controls/controls.module.css +33 -1
- package/dist/controls/controls.module.css.d.ts +2 -0
- package/dist/controls/enum-filter.d.ts.map +1 -1
- package/dist/controls/enum-filter.js +8 -2
- package/dist/controls/filter-pill.d.ts +27 -3
- package/dist/controls/filter-pill.d.ts.map +1 -1
- package/dist/controls/filter-pill.js +15 -4
- package/dist/controls/form-layout.d.ts +9 -3
- package/dist/controls/form-layout.d.ts.map +1 -1
- package/dist/controls/form-layout.js +74 -12
- package/dist/controls/form-layout.module.css +112 -7
- package/dist/controls/form-layout.module.css.d.ts +1 -0
- package/dist/controls/multi-select-filter.d.ts +2 -2
- package/dist/controls/multi-select-filter.d.ts.map +1 -1
- package/dist/controls/multi-select-filter.js +12 -6
- package/dist/controls/range-filter.d.ts +1 -1
- package/dist/controls/range-filter.d.ts.map +1 -1
- package/dist/controls/range-filter.js +8 -2
- package/dist/dashboard/bar-list.d.ts +1 -1
- package/dist/dashboard/bar-list.d.ts.map +1 -1
- package/dist/dashboard/bar-list.js +6 -2
- package/dist/dashboard/bar-list.module.css +0 -2
- package/dist/dashboard/board-nav.d.ts +22 -0
- package/dist/dashboard/board-nav.d.ts.map +1 -0
- package/dist/dashboard/board-nav.js +49 -0
- package/dist/dashboard/board.d.ts +52 -0
- package/dist/dashboard/board.d.ts.map +1 -0
- package/dist/dashboard/board.js +228 -0
- package/dist/dashboard/board.module.css +160 -0
- package/dist/dashboard/board.module.css.d.ts +26 -0
- package/dist/dashboard/empty-state.d.ts +3 -3
- package/dist/dashboard/empty-state.d.ts.map +1 -1
- package/dist/dashboard/empty-state.js +13 -6
- package/dist/dashboard/event-list-model.d.ts +51 -0
- package/dist/dashboard/event-list-model.d.ts.map +1 -0
- package/dist/dashboard/event-list-model.js +72 -0
- package/dist/dashboard/event-list-rows.d.ts +23 -0
- package/dist/dashboard/event-list-rows.d.ts.map +1 -0
- package/dist/dashboard/event-list-rows.js +93 -0
- package/dist/dashboard/event-list-scroll.d.ts +27 -0
- package/dist/dashboard/event-list-scroll.d.ts.map +1 -0
- package/dist/dashboard/event-list-scroll.js +103 -0
- package/dist/dashboard/event-list-skeleton.d.ts +10 -0
- package/dist/dashboard/event-list-skeleton.d.ts.map +1 -0
- package/dist/dashboard/event-list-skeleton.js +36 -0
- package/dist/dashboard/event-list.d.ts +65 -0
- package/dist/dashboard/event-list.d.ts.map +1 -0
- package/dist/dashboard/event-list.js +178 -0
- package/dist/dashboard/event-list.module.css +283 -0
- package/dist/dashboard/event-list.module.css.d.ts +33 -0
- package/dist/dashboard/index.d.ts +2 -0
- package/dist/dashboard/index.d.ts.map +1 -1
- package/dist/dashboard/index.js +4 -0
- package/dist/dashboard/meter-parts.d.ts.map +1 -1
- package/dist/dashboard/meter-parts.js +5 -3
- package/dist/dashboard/meter.module.css +2 -1
- package/dist/dashboard/query-state.js +1 -1
- package/dist/dashboard/settings-section.d.ts +4 -1
- package/dist/dashboard/settings-section.d.ts.map +1 -1
- package/dist/dashboard/settings-section.js +1 -1
- package/dist/dashboard/settings-section.module.css +19 -4
- package/dist/dashboard/stat-card-parts.d.ts +5 -1
- package/dist/dashboard/stat-card-parts.d.ts.map +1 -1
- package/dist/dashboard/stat-card-parts.js +8 -3
- package/dist/dashboard/stat-card.d.ts.map +1 -1
- package/dist/dashboard/stat-card.js +26 -7
- package/dist/dashboard/stat-card.module.css +31 -7
- package/dist/dashboard/stat-card.module.css.d.ts +3 -0
- package/dist/dashboard/stat-strip.js +1 -1
- package/dist/dashboard/stat-strip.module.css +4 -1
- package/dist/dashboard/widget-header.d.ts.map +1 -1
- package/dist/dashboard/widget-header.js +15 -2
- package/dist/dashboard/widget-header.module.css +17 -1
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/shell/app-main.module.css +18 -0
- package/dist/styles.css +46 -8
- package/dist/surfaces.d.ts +2 -2
- package/dist/surfaces.d.ts.map +1 -1
- package/dist/surfaces.js +8 -2
- package/dist/table/cell-kinds.d.ts +44 -0
- package/dist/table/cell-kinds.d.ts.map +1 -0
- package/dist/table/cell-kinds.js +169 -0
- package/dist/table/cell-kinds.module.css +55 -0
- package/dist/table/cell-kinds.module.css.d.ts +15 -0
- package/dist/table/data-table-fold.d.ts +147 -0
- package/dist/table/data-table-fold.d.ts.map +1 -0
- package/dist/table/data-table-fold.js +288 -0
- package/dist/table/data-table-state.d.ts +10 -3
- package/dist/table/data-table-state.d.ts.map +1 -1
- package/dist/table/data-table-state.js +11 -6
- package/dist/table/data-table.d.ts +11 -26
- package/dist/table/data-table.d.ts.map +1 -1
- package/dist/table/data-table.js +354 -254
- package/dist/table/data-table.module.css +210 -3
- package/dist/table/data-table.module.css.d.ts +12 -0
- package/dist/table/table-features.d.ts +34 -4
- package/dist/table/table-features.d.ts.map +1 -1
- package/dist/table/table-features.js +10 -0
- package/dist/theme/card-inset.module.css +35 -0
- package/dist/theme/controls.module.css +32 -0
- package/dist/theme/ctl-theme.d.ts.map +1 -1
- package/dist/theme/ctl-theme.js +5 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +14 -10
- package/dist/tokens/core.d.ts +1 -0
- package/dist/tokens/core.d.ts.map +1 -1
- package/dist/tokens/core.js +1 -0
- package/dist/tokens/derive.js +1 -1
- package/dist/tokens/palette.d.ts +2 -1
- package/dist/tokens/palette.d.ts.map +1 -1
- package/llms.txt +34 -5
- package/package.json +1 -1
- package/src/agent/chat/thread-message.tsx +10 -403
- package/src/agent/chat/virtualize.ts +5 -5
- package/src/charts/ChartCard.tsx +79 -17
- package/src/charts/Lines.tsx +13 -4
- package/src/charts/Sparkline.tsx +131 -45
- package/src/charts/chart-box.module.css +69 -3
- package/src/charts/chart-box.module.css.d.ts +5 -0
- package/src/charts/chart-card.module.css +12 -4
- package/src/charts/chart-card.module.css.d.ts +1 -0
- package/src/charts/compile.ts +24 -20
- package/src/charts/labels.ts +175 -24
- package/src/charts/legend.tsx +3 -2
- package/src/charts/ref-label.ts +86 -17
- package/src/charts/sparkline.module.css +6 -0
- package/src/charts/state.tsx +36 -7
- package/src/cli/shot/capture.ts +29 -6
- package/src/common/empty-copy.ts +17 -0
- package/src/common/virtual-rows.tsx +682 -0
- package/src/controls/controls.module.css +33 -1
- package/src/controls/controls.module.css.d.ts +2 -0
- package/src/controls/enum-filter.tsx +8 -2
- package/src/controls/filter-pill.tsx +80 -27
- package/src/controls/form-layout.module.css +112 -7
- package/src/controls/form-layout.module.css.d.ts +1 -0
- package/src/controls/form-layout.tsx +115 -22
- package/src/controls/multi-select-filter.tsx +22 -11
- package/src/controls/range-filter.tsx +9 -3
- package/src/dashboard/bar-list.module.css +0 -2
- package/src/dashboard/bar-list.tsx +8 -5
- package/src/dashboard/board-nav.ts +67 -0
- package/src/dashboard/board.module.css +160 -0
- package/src/dashboard/board.module.css.d.ts +26 -0
- package/src/dashboard/board.tsx +394 -0
- package/src/dashboard/empty-state.tsx +16 -9
- package/src/dashboard/event-list-model.ts +113 -0
- package/src/dashboard/event-list-rows.tsx +120 -0
- package/src/dashboard/event-list-scroll.ts +145 -0
- package/src/dashboard/event-list-skeleton.tsx +58 -0
- package/src/dashboard/event-list.module.css +283 -0
- package/src/dashboard/event-list.module.css.d.ts +33 -0
- package/src/dashboard/event-list.tsx +309 -0
- package/src/dashboard/index.ts +2 -0
- package/src/dashboard/meter-parts.tsx +9 -2
- package/src/dashboard/meter.module.css +2 -1
- package/src/dashboard/query-state.tsx +1 -1
- package/src/dashboard/settings-section.module.css +19 -4
- package/src/dashboard/settings-section.tsx +7 -2
- package/src/dashboard/stat-card-parts.tsx +20 -3
- package/src/dashboard/stat-card.module.css +31 -7
- package/src/dashboard/stat-card.module.css.d.ts +3 -0
- package/src/dashboard/stat-card.tsx +25 -6
- package/src/dashboard/stat-strip.module.css +4 -1
- package/src/dashboard/stat-strip.tsx +1 -1
- package/src/dashboard/widget-header.module.css +17 -1
- package/src/dashboard/widget-header.tsx +29 -5
- package/src/guard/index.ts +2 -0
- package/src/index.ts +4 -0
- package/src/shell/app-main.module.css +18 -0
- package/src/styles.css +46 -8
- package/src/surfaces.ts +7 -1
- package/src/table/cell-kinds.module.css +55 -0
- package/src/table/cell-kinds.module.css.d.ts +15 -0
- package/src/table/cell-kinds.tsx +234 -0
- package/src/table/data-table-fold.tsx +514 -0
- package/src/table/data-table-state.ts +24 -13
- package/src/table/data-table.module.css +210 -3
- package/src/table/data-table.module.css.d.ts +12 -0
- package/src/table/data-table.tsx +406 -359
- package/src/table/table-features.ts +44 -4
- package/src/theme/__snapshots__/plain-theme.test.ts.snap +2 -66
- package/src/theme/card-inset.module.css +35 -0
- package/src/theme/controls.module.css +32 -0
- package/src/theme/ctl-theme.tsx +8 -0
- package/src/theme/index.ts +12 -8
- package/src/tokens/core.ts +1 -0
- package/src/tokens/derive.ts +1 -1
- package/src/tokens/palette.ts +4 -1
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button, Popover } from "@mantine/core";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { cx } from "../common/props.js";
|
|
5
5
|
import { IconSlot } from "../theme/icon-slot.js";
|
|
6
6
|
import classes from "./controls.module.css";
|
|
7
7
|
import { UpDownGlyph } from "./glyphs.js";
|
|
8
|
+
const hasText = (value) => value.trim() !== "";
|
|
9
|
+
function filterReading(input) {
|
|
10
|
+
if (input.informative && hasText(input.value)) return { label: input.name, value: input.value };
|
|
11
|
+
return { label: input.unsetText, unset: true };
|
|
12
|
+
}
|
|
8
13
|
function FilterPill({
|
|
9
14
|
label,
|
|
15
|
+
value,
|
|
16
|
+
unset,
|
|
10
17
|
icon,
|
|
11
18
|
active,
|
|
12
19
|
numeric,
|
|
@@ -28,7 +35,7 @@ function FilterPill({
|
|
|
28
35
|
size: "ctl",
|
|
29
36
|
className: cx(classes.pill, className),
|
|
30
37
|
"data-basalt-hit": true,
|
|
31
|
-
title: label,
|
|
38
|
+
title: value !== void 0 && hasText(value) ? `${label} ${value}` : label,
|
|
32
39
|
classNames: { label: classes.pillLabel },
|
|
33
40
|
...style !== void 0 && { style },
|
|
34
41
|
...active === true && { "data-active": true },
|
|
@@ -48,7 +55,10 @@ function FilterPill({
|
|
|
48
55
|
onClick: onClick ?? (() => {
|
|
49
56
|
setOpened((current) => !current);
|
|
50
57
|
}),
|
|
51
|
-
children:
|
|
58
|
+
children: value !== void 0 && hasText(value) ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
59
|
+
/* @__PURE__ */ jsx("span", { className: classes.pillName, "data-pill-part": "name", children: label }),
|
|
60
|
+
/* @__PURE__ */ jsx("span", { className: classes.pillValue, "data-pill-part": "value", children: value })
|
|
61
|
+
] }) : unset === true || value !== void 0 ? /* @__PURE__ */ jsx("span", { className: classes.pillName, "data-pill-part": "name", children: label }) : label
|
|
52
62
|
}
|
|
53
63
|
);
|
|
54
64
|
if (children === void 0) return target;
|
|
@@ -88,5 +98,6 @@ function FilterClearButton({ onClear }) {
|
|
|
88
98
|
}
|
|
89
99
|
export {
|
|
90
100
|
FilterClearButton,
|
|
91
|
-
FilterPill
|
|
101
|
+
FilterPill,
|
|
102
|
+
filterReading
|
|
92
103
|
};
|
|
@@ -36,7 +36,7 @@ export declare function FormSection(props: FormSectionProps): import("react").JS
|
|
|
36
36
|
/** The three boxes `FormRow` paints (`common/props.ts`). */
|
|
37
37
|
export type FormRowSlot = 'root' | 'label' | 'control';
|
|
38
38
|
export type FormRowProps = BasaltProps & SlotStylesProps<FormRowSlot> & {
|
|
39
|
-
/** The field's label. Ink, `--vx-text-
|
|
39
|
+
/** The field's label. Ink, `--vx-text-sm` — the same size `SettingsRow` gives its own. */
|
|
40
40
|
label: string;
|
|
41
41
|
/** Muted line under the label: the rule, the unit, the example. Never the error. */
|
|
42
42
|
hint?: string;
|
|
@@ -60,7 +60,7 @@ export type FormRowProps = BasaltProps & SlotStylesProps<FormRowSlot> & {
|
|
|
60
60
|
children: ReactNode;
|
|
61
61
|
};
|
|
62
62
|
/**
|
|
63
|
-
* One labelled field: label left / control right
|
|
63
|
+
* One labelled field: label left / control right, label above the control under 600 px of the row (`basalt-form`).
|
|
64
64
|
* The swap is CSS (law C9) — no `useMediaQuery`, so it is correct in SSR markup and it costs no
|
|
65
65
|
* render.
|
|
66
66
|
*
|
|
@@ -78,7 +78,7 @@ export type FormRowProps = BasaltProps & SlotStylesProps<FormRowSlot> & {
|
|
|
78
78
|
* @example
|
|
79
79
|
* // A raw control renders no error of its own — pass it explicitly.
|
|
80
80
|
* <FormRow label="Email" required error={inputProps(form, 'email').error}>
|
|
81
|
-
* <
|
|
81
|
+
* <MyEmailField value={form.values.email} onChange={(v) => form.setFieldValue('email', v)} />
|
|
82
82
|
* </FormRow>
|
|
83
83
|
*/
|
|
84
84
|
export declare function FormRow(props: FormRowProps): import("react").JSX.Element;
|
|
@@ -98,6 +98,12 @@ export type FormGroupProps = BasaltProps & {
|
|
|
98
98
|
* container, so its intrinsic width is zero and it collapses otherwise. @default 'column'
|
|
99
99
|
*/
|
|
100
100
|
direction?: 'row' | 'column';
|
|
101
|
+
/**
|
|
102
|
+
* Sets the group up as a form SECTION: the legend becomes the section title (`md`, 500), the
|
|
103
|
+
* children stack 12 apart like rows, and a section followed by another keeps 24 between them —
|
|
104
|
+
* so a form is a run of `section` groups with no wrapper to space them. @default false
|
|
105
|
+
*/
|
|
106
|
+
section?: boolean;
|
|
101
107
|
/** The cluster — checkboxes, radios, chips. */
|
|
102
108
|
children: ReactNode;
|
|
103
109
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-layout.d.ts","sourceRoot":"","sources":["../../src/controls/form-layout.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"form-layout.d.ts","sourceRoot":"","sources":["../../src/controls/form-layout.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAA;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAGnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAE5C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AAoGxE,gEAAgE;AAChE,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAA;AAExD;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,WAAW,GACxC,eAAe,CAAC,eAAe,CAAC,GAChC,sBAAsB,GAAG;IACvB,0DAA0D;IAC1D,QAAQ,EAAE,SAAS,CAAA;CACpB,CAAA;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,+BAoBlD;AAID,4DAA4D;AAC5D,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAA;AAEtD,MAAM,MAAM,YAAY,GAAG,WAAW,GACpC,eAAe,CAAC,WAAW,CAAC,GAAG;IAC7B,0FAA0F;IAC1F,KAAK,EAAE,MAAM,CAAA;IACb,oFAAoF;IACpF,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,oGAAoG;IACpG,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,4FAA4F;IAC5F,QAAQ,EAAE,SAAS,CAAA;CACpB,CAAA;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,+BAoC1C;AAID,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG;IACzC,qGAAqG;IACrG,KAAK,EAAE,MAAM,CAAA;IACb,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,0DAA0D;IAC1D,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAA;IAC5B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,+CAA+C;IAC/C,QAAQ,EAAE,SAAS,CAAA;CACpB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,+BAuC9C;AAID,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG;IAC3C;;;;;;;;OAQG;IACH,OAAO,EAAE,WAAW,CAAA;CACrB,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,+BAgBlD"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { VisuallyHidden } from "@mantine/core";
|
|
3
|
+
import { useId } from "react";
|
|
3
4
|
import { cx } from "../common/props.js";
|
|
4
5
|
import { assertRequiredProps } from "../common/validate.js";
|
|
5
6
|
import { BarActionSlot } from "./actions.js";
|
|
6
7
|
import { WidgetHeader } from "../dashboard/widget-header.js";
|
|
8
|
+
import { CtlSlot } from "../theme/index.js";
|
|
7
9
|
import { useFormState } from "../forms/form-state.js";
|
|
8
10
|
import classes from "./form-layout.module.css";
|
|
9
11
|
function RequiredMark({ required }) {
|
|
@@ -13,9 +15,46 @@ function RequiredMark({ required }) {
|
|
|
13
15
|
/* @__PURE__ */ jsx(VisuallyHidden, { children: "(required)" })
|
|
14
16
|
] });
|
|
15
17
|
}
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
function hasError(error) {
|
|
19
|
+
return error !== void 0 && error !== null && typeof error !== "boolean" && error !== "";
|
|
20
|
+
}
|
|
21
|
+
const GLYPH_CIRCLE = { cx: 8, cy: 8, r: 6.25 };
|
|
22
|
+
const GLYPH_PATH = "M8 4.75v3.9M8 11.2v.05";
|
|
23
|
+
const GLYPH_MASK = `url("data:image/svg+xml,${encodeURIComponent(
|
|
24
|
+
`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round'><circle cx='${GLYPH_CIRCLE.cx}' cy='${GLYPH_CIRCLE.cy}' r='${GLYPH_CIRCLE.r}'/><path d='${GLYPH_PATH}'/></svg>`
|
|
25
|
+
)}")`;
|
|
26
|
+
const glyphVars = { "--basalt-field-error-glyph": GLYPH_MASK };
|
|
27
|
+
function FieldError({ error, id }) {
|
|
28
|
+
return /* @__PURE__ */ jsx("span", { id, className: classes.error, "aria-live": "polite", children: hasError(error) && /* @__PURE__ */ jsx(FieldErrorBody, { error }) });
|
|
29
|
+
}
|
|
30
|
+
function FieldErrorBody({ error }) {
|
|
31
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
32
|
+
/* @__PURE__ */ jsxs(
|
|
33
|
+
"svg",
|
|
34
|
+
{
|
|
35
|
+
className: classes.errorIcon,
|
|
36
|
+
viewBox: "0 0 16 16",
|
|
37
|
+
fill: "none",
|
|
38
|
+
stroke: "currentColor",
|
|
39
|
+
strokeWidth: "1.5",
|
|
40
|
+
strokeLinecap: "round",
|
|
41
|
+
"aria-hidden": "true",
|
|
42
|
+
"data-field-error-icon": "",
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ jsx("circle", { ...GLYPH_CIRCLE }),
|
|
45
|
+
/* @__PURE__ */ jsx("path", { d: GLYPH_PATH })
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
/* @__PURE__ */ jsx("span", { children: error })
|
|
50
|
+
] });
|
|
51
|
+
}
|
|
52
|
+
function useDescribedBy(hint, error) {
|
|
53
|
+
const uid = useId();
|
|
54
|
+
const hintId = `${uid}-hint`;
|
|
55
|
+
const errorId = `${uid}-error`;
|
|
56
|
+
const ids = [hint !== void 0 && hintId, hasError(error) && errorId].filter(Boolean);
|
|
57
|
+
return { hintId, errorId, describedBy: ids.length > 0 ? ids.join(" ") : void 0 };
|
|
19
58
|
}
|
|
20
59
|
function FormSection(props) {
|
|
21
60
|
assertRequiredProps("FormSection", props, ["title"]);
|
|
@@ -46,6 +85,7 @@ function FormRow(props) {
|
|
|
46
85
|
assertRequiredProps("FormRow", props, ["label"]);
|
|
47
86
|
const { label, hint, error, required, htmlFor, children, className, style, classNames } = props;
|
|
48
87
|
const { disabled } = useFormState();
|
|
88
|
+
const { hintId, errorId, describedBy } = useDescribedBy(hint, error);
|
|
49
89
|
return /* @__PURE__ */ jsx(
|
|
50
90
|
"div",
|
|
51
91
|
{
|
|
@@ -57,34 +97,56 @@ function FormRow(props) {
|
|
|
57
97
|
label,
|
|
58
98
|
/* @__PURE__ */ jsx(RequiredMark, { required })
|
|
59
99
|
] }),
|
|
60
|
-
hint !== void 0 && /* @__PURE__ */ jsx("span", { className: classes.hint, children: hint })
|
|
100
|
+
hint !== void 0 && /* @__PURE__ */ jsx("span", { id: hintId, className: classes.hint, children: hint })
|
|
61
101
|
] }),
|
|
62
|
-
/* @__PURE__ */ jsxs(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
102
|
+
/* @__PURE__ */ jsxs(
|
|
103
|
+
"fieldset",
|
|
104
|
+
{
|
|
105
|
+
className: cx(classes.control, classNames?.control),
|
|
106
|
+
disabled,
|
|
107
|
+
style: glyphVars,
|
|
108
|
+
...describedBy !== void 0 && { "aria-describedby": describedBy },
|
|
109
|
+
children: [
|
|
110
|
+
/* @__PURE__ */ jsx(CtlSlot, { children }),
|
|
111
|
+
/* @__PURE__ */ jsx(FieldError, { error, id: errorId })
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
)
|
|
66
115
|
] })
|
|
67
116
|
}
|
|
68
117
|
);
|
|
69
118
|
}
|
|
70
119
|
function FormGroup(props) {
|
|
71
120
|
assertRequiredProps("FormGroup", props, ["label"]);
|
|
72
|
-
const {
|
|
121
|
+
const {
|
|
122
|
+
label,
|
|
123
|
+
hint,
|
|
124
|
+
error,
|
|
125
|
+
required,
|
|
126
|
+
direction = "column",
|
|
127
|
+
section = false,
|
|
128
|
+
children,
|
|
129
|
+
className,
|
|
130
|
+
style
|
|
131
|
+
} = props;
|
|
73
132
|
const { disabled } = useFormState();
|
|
133
|
+
const { hintId, errorId, describedBy } = useDescribedBy(hint, error);
|
|
74
134
|
return /* @__PURE__ */ jsxs(
|
|
75
135
|
"fieldset",
|
|
76
136
|
{
|
|
77
137
|
className: cx(classes.group, className),
|
|
78
138
|
disabled,
|
|
79
|
-
|
|
139
|
+
style: style === void 0 ? glyphVars : { ...glyphVars, ...style },
|
|
140
|
+
...section && { "data-section": "" },
|
|
141
|
+
...describedBy !== void 0 && { "aria-describedby": describedBy },
|
|
80
142
|
children: [
|
|
81
143
|
/* @__PURE__ */ jsxs("legend", { className: classes.legend, children: [
|
|
82
144
|
label,
|
|
83
145
|
/* @__PURE__ */ jsx(RequiredMark, { required })
|
|
84
146
|
] }),
|
|
85
|
-
hint !== void 0 && /* @__PURE__ */ jsx("span", { className: classes.hint, children: hint }),
|
|
147
|
+
hint !== void 0 && /* @__PURE__ */ jsx("span", { id: hintId, className: classes.hint, children: hint }),
|
|
86
148
|
/* @__PURE__ */ jsx("div", { className: classes.groupControls, "data-direction": direction, children }),
|
|
87
|
-
/* @__PURE__ */ jsx(FieldError, { error })
|
|
149
|
+
/* @__PURE__ */ jsx(FieldError, { error, id: errorId })
|
|
88
150
|
]
|
|
89
151
|
}
|
|
90
152
|
);
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
/* ── FormRow ─────────────────────────────────────────────────────────────────────────────────── */
|
|
38
38
|
|
|
39
39
|
/*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
40
|
+
* One row rule for FormRow and SettingsRow: a 15rem label column, then a control column capped at
|
|
41
|
+
* 20rem — beside each other, left-packed, never a 656px field behind a 480px gutter. `align-items: start` so a two-line label does not centre
|
|
42
42
|
* itself against a one-line input.
|
|
43
43
|
*/
|
|
44
44
|
.row {
|
|
@@ -48,7 +48,8 @@
|
|
|
48
48
|
|
|
49
49
|
.grid {
|
|
50
50
|
display: grid;
|
|
51
|
-
grid-template-columns: minmax(0,
|
|
51
|
+
grid-template-columns: minmax(0, 15rem) minmax(0, 20rem);
|
|
52
|
+
justify-content: start;
|
|
52
53
|
align-items: start;
|
|
53
54
|
gap: var(--vx-space-settings-row-gap);
|
|
54
55
|
}
|
|
@@ -56,18 +57,29 @@
|
|
|
56
57
|
.rowLabel {
|
|
57
58
|
display: flex;
|
|
58
59
|
flex-direction: column;
|
|
59
|
-
gap: var(--vx-space-stack-xs);
|
|
60
60
|
min-inline-size: 0;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
/*
|
|
64
|
+
* The label's first line sits on the optical centre of the 32 px field it names (44 under a coarse
|
|
65
|
+
* pointer): top padding is half of field height minus one line. The description then follows the
|
|
66
|
+
* label directly instead of hanging 32 px below it. Stacked, the label is just a line.
|
|
67
|
+
*/
|
|
63
68
|
.label {
|
|
64
|
-
|
|
69
|
+
padding-block-start: calc(
|
|
70
|
+
(max(var(--vx-space-control-height-ctl) * var(--mantine-scale, 1), var(--vx-hit, 0px)) - 1lh) /
|
|
71
|
+
2
|
|
72
|
+
);
|
|
73
|
+
font-size: var(--vx-text-sm);
|
|
65
74
|
color: var(--vx-ink);
|
|
66
75
|
}
|
|
67
76
|
|
|
68
77
|
.hint {
|
|
69
|
-
font-size: var(--vx-text-
|
|
78
|
+
font-size: var(--vx-text-xs);
|
|
70
79
|
color: var(--vx-muted);
|
|
80
|
+
/* Hangs tight under the label and gives back the line it would add to the row: the next row
|
|
81
|
+
reads as near as its own gap, not a description-high further. */
|
|
82
|
+
margin-block-end: calc(-1 * var(--vx-space-stack-xs));
|
|
71
83
|
}
|
|
72
84
|
|
|
73
85
|
.required {
|
|
@@ -90,17 +102,81 @@
|
|
|
90
102
|
padding: 0;
|
|
91
103
|
}
|
|
92
104
|
|
|
105
|
+
/*
|
|
106
|
+
* The error: the bad-status glyph, then one sentence. `1lh` is the glyph's box so it centres on the
|
|
107
|
+
* FIRST line when the sentence wraps. A Mantine input wired through `inputProps` renders its own
|
|
108
|
+
* error (Input.Wrapper), so the same glyph is drawn on that error as a mask, in the same colour:
|
|
109
|
+
* the two paths read as one.
|
|
110
|
+
*/
|
|
111
|
+
/*
|
|
112
|
+
* An auto-height Textarea sizes from its line and padding (35 px for one row), not from the tier:
|
|
113
|
+
* the floor is the field height itself, 44 under a coarse pointer.
|
|
114
|
+
*/
|
|
115
|
+
.control :global(.mantine-Textarea-input) {
|
|
116
|
+
min-block-size: max(
|
|
117
|
+
var(--vx-space-control-height-ctl) * var(--mantine-scale, 1),
|
|
118
|
+
var(--vx-hit, 0px)
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
93
122
|
.error {
|
|
123
|
+
display: flex;
|
|
124
|
+
align-items: flex-start;
|
|
125
|
+
gap: var(--vx-space-stack-xs);
|
|
126
|
+
font-size: var(--vx-text-sm);
|
|
127
|
+
color: var(--vx-status-bad);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* The always-mounted live region is empty while clean: out of flow (no flex gap), still in the a11y tree. */
|
|
131
|
+
.error:empty {
|
|
132
|
+
position: absolute;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.errorIcon {
|
|
136
|
+
flex: none;
|
|
137
|
+
inline-size: 1em;
|
|
138
|
+
block-size: 1lh;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
:is(.control, .group) :global(.mantine-InputWrapper-error),
|
|
142
|
+
:is(.control, .group) :global(.mantine-Checkbox-error),
|
|
143
|
+
:is(.control, .group) :global(.mantine-Switch-error),
|
|
144
|
+
:is(.control, .group) :global(.mantine-Radio-error) {
|
|
145
|
+
display: flex;
|
|
146
|
+
align-items: flex-start;
|
|
147
|
+
gap: var(--vx-space-stack-xs);
|
|
148
|
+
margin-block-start: 0;
|
|
94
149
|
font-size: var(--vx-text-sm);
|
|
95
150
|
color: var(--vx-status-bad);
|
|
96
151
|
}
|
|
97
152
|
|
|
153
|
+
:is(.control, .group) :global(.mantine-InputWrapper-error)::before,
|
|
154
|
+
:is(.control, .group) :global(.mantine-Checkbox-error)::before,
|
|
155
|
+
:is(.control, .group) :global(.mantine-Switch-error)::before,
|
|
156
|
+
:is(.control, .group) :global(.mantine-Radio-error)::before {
|
|
157
|
+
content: '';
|
|
158
|
+
flex: none;
|
|
159
|
+
inline-size: 1em;
|
|
160
|
+
block-size: 1lh;
|
|
161
|
+
background-color: currentColor;
|
|
162
|
+
mask: var(--basalt-field-error-glyph) center / contain no-repeat;
|
|
163
|
+
}
|
|
164
|
+
|
|
98
165
|
/* The narrow twin: the control needs the full width, so the label goes above it. */
|
|
99
166
|
@container basalt-form (max-width: 599.9px) {
|
|
100
167
|
.grid {
|
|
101
168
|
grid-template-columns: minmax(0, 1fr);
|
|
102
169
|
gap: var(--vx-space-stack-xs);
|
|
103
170
|
}
|
|
171
|
+
|
|
172
|
+
.label {
|
|
173
|
+
padding-block-start: 0;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/* Stacked, the grid gap is the label-to-control distance: do not pull the description into it. */
|
|
177
|
+
.hint {
|
|
178
|
+
margin-block-end: 0;
|
|
179
|
+
}
|
|
104
180
|
}
|
|
105
181
|
|
|
106
182
|
/* ── FormGroup ───────────────────────────────────────────────────────────────────────────────── */
|
|
@@ -124,10 +200,39 @@
|
|
|
124
200
|
float: left;
|
|
125
201
|
width: 100%;
|
|
126
202
|
padding: 0;
|
|
127
|
-
font-size: var(--vx-text-
|
|
203
|
+
font-size: var(--vx-text-sm);
|
|
128
204
|
color: var(--vx-ink);
|
|
129
205
|
}
|
|
130
206
|
|
|
207
|
+
/* A section: the legend is the section title (`md`, 500), the cluster stacks 12 apart like rows, and
|
|
208
|
+
a section that follows another keeps 24 above it (never before the action row) — the form's whole rhythm, owned here. */
|
|
209
|
+
.group[data-section] {
|
|
210
|
+
gap: var(--vx-space-stack-sm);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.group[data-section] + .group[data-section] {
|
|
214
|
+
margin-block-start: var(--vx-space-stack-xl);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.group[data-section] > .legend {
|
|
218
|
+
font-size: var(--vx-text-md);
|
|
219
|
+
font-weight: 500;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.group[data-section] > .groupControls[data-direction='column'] {
|
|
223
|
+
display: block;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/* D54: the rows of a section divide exactly as `SettingsSection`'s do — the row inset above and below
|
|
227
|
+
and a 1px `--vx-divider` rule under every row but the last, so a form and a settings page read as one system. */
|
|
228
|
+
.group[data-section] > .groupControls[data-direction='column'] > .row {
|
|
229
|
+
padding-block: var(--vx-space-settings-row-inset-y);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.group[data-section] > .groupControls[data-direction='column'] > .row:not(:last-child) {
|
|
233
|
+
border-block-end: 1px solid var(--vx-divider);
|
|
234
|
+
}
|
|
235
|
+
|
|
131
236
|
.groupControls {
|
|
132
237
|
display: flex;
|
|
133
238
|
clear: both;
|
|
@@ -13,9 +13,9 @@ export type MultiSelectFilterProps<T extends string> = UncontrolledProps & Filte
|
|
|
13
13
|
*/
|
|
14
14
|
readonly clearable?: boolean;
|
|
15
15
|
/**
|
|
16
|
-
* The
|
|
16
|
+
* The word after the count, in place of `selected`: `3 channels`.
|
|
17
17
|
*
|
|
18
|
-
* @default
|
|
18
|
+
* @default 'selected'
|
|
19
19
|
*/
|
|
20
20
|
readonly noun?: string;
|
|
21
21
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multi-select-filter.d.ts","sourceRoot":"","sources":["../../src/controls/multi-select-filter.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAA;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAO7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAMvD,MAAM,MAAM,sBAAsB,CAAC,CAAC,SAAS,MAAM,IAAI,iBAAiB,GACtE,UAAU,GAAG;IACX,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA;IAC1C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IACtB;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,YAAY,EAAE,CAAA;IAC1C;;;;;;;OAOG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACxC;;;;OAIG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAEH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,sBAAsB,CAAC,CAAC,CAAC,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"multi-select-filter.d.ts","sourceRoot":"","sources":["../../src/controls/multi-select-filter.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAA;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAO7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAMvD,MAAM,MAAM,sBAAsB,CAAC,CAAC,SAAS,MAAM,IAAI,iBAAiB,GACtE,UAAU,GAAG;IACX,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA;IAC1C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IACtB;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,YAAY,EAAE,CAAA;IAC1C;;;;;;;OAOG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACxC;;;;OAIG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAEH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,sBAAsB,CAAC,CAAC,CAAC,GAAG,SAAS,CAyH/F"}
|
|
@@ -4,7 +4,7 @@ import { useState } from "react";
|
|
|
4
4
|
import { assertRequiredProps } from "../common/validate.js";
|
|
5
5
|
import classes from "./controls.module.css";
|
|
6
6
|
import { POPOVER_ROW_HIT_GAP, useFilterRegistration, useFilterSurface } from "./filter-context.js";
|
|
7
|
-
import { FilterClearButton, FilterPill } from "./filter-pill.js";
|
|
7
|
+
import { FilterClearButton, FilterPill, filterReading } from "./filter-pill.js";
|
|
8
8
|
import { useControlName } from "./control-name.js";
|
|
9
9
|
import { CheckGlyph } from "./glyphs.js";
|
|
10
10
|
import { PanelRow } from "./panel-row.js";
|
|
@@ -32,11 +32,12 @@ function MultiSelectFilter(props) {
|
|
|
32
32
|
const clearFilter = () => {
|
|
33
33
|
field.clear();
|
|
34
34
|
};
|
|
35
|
-
useFilterRegistration(!isDefault, clearFilter);
|
|
36
35
|
const options = optionsProp ?? field.options;
|
|
37
36
|
const inSheet = surface === "sheet";
|
|
38
37
|
const inPanel = surface === "panel";
|
|
39
|
-
const
|
|
38
|
+
const everyOffered = options.every((option) => value.includes(option.value));
|
|
39
|
+
const informative = !isDefault && value.length > 0 && !everyOffered;
|
|
40
|
+
useFilterRegistration(informative, clearFilter);
|
|
40
41
|
const { labelId } = useControlName(label, inSheet || inPanel);
|
|
41
42
|
const toggle = (next) => {
|
|
42
43
|
const has = value.includes(next);
|
|
@@ -88,7 +89,7 @@ function MultiSelectFilter(props) {
|
|
|
88
89
|
},
|
|
89
90
|
option.value
|
|
90
91
|
)) }),
|
|
91
|
-
clearable &&
|
|
92
|
+
clearable && informative && disabled !== true && /* @__PURE__ */ jsx(FilterClearButton, { onClear: clearFilter })
|
|
92
93
|
]
|
|
93
94
|
}
|
|
94
95
|
)
|
|
@@ -96,8 +97,13 @@ function MultiSelectFilter(props) {
|
|
|
96
97
|
return /* @__PURE__ */ jsx(
|
|
97
98
|
FilterPill,
|
|
98
99
|
{
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
...filterReading({
|
|
101
|
+
name: label,
|
|
102
|
+
informative,
|
|
103
|
+
value: `${value.length} ${noun ?? "selected"}`,
|
|
104
|
+
unsetText: label
|
|
105
|
+
}),
|
|
106
|
+
active: informative,
|
|
101
107
|
...disabled === true && { disabled: true },
|
|
102
108
|
...icon !== void 0 && { icon },
|
|
103
109
|
...className !== void 0 && { className },
|
|
@@ -20,7 +20,7 @@ export type RangeCustomPickerProps = {
|
|
|
20
20
|
};
|
|
21
21
|
/** Everything about the props that does not depend on the field's `custom` flag. */
|
|
22
22
|
type RangeFilterCommon<P extends string, C extends boolean> = UncontrolledProps & Omit<FilterBase, 'clearable' | 'label'> & {
|
|
23
|
-
/**
|
|
23
|
+
/** The filter's name: the sheet-form heading, and the pill's muted label once a range is chosen (`Window 7d`); at the default the pill reads the range alone. @default 'Range' */
|
|
24
24
|
readonly label?: string;
|
|
25
25
|
/**
|
|
26
26
|
* A range handle from either store factory. Generic over the field's `custom` flag so a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"range-filter.d.ts","sourceRoot":"","sources":["../../src/controls/range-filter.tsx"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,iBAAiB,CAAA;AAG7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAK/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAUvD;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,CAAA;IACxF,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;CAChE,CAAA;AAED,oFAAoF;AACpF,KAAK,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,OAAO,IAAI,iBAAiB,GAC7E,IAAI,CAAC,UAAU,EAAE,WAAW,GAAG,OAAO,CAAC,GAAG;IACxC,
|
|
1
|
+
{"version":3,"file":"range-filter.d.ts","sourceRoot":"","sources":["../../src/controls/range-filter.tsx"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,iBAAiB,CAAA;AAG7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAK/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAUvD;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,CAAA;IACxF,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;CAChE,CAAA;AAED,oFAAoF;AACpF,KAAK,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,OAAO,IAAI,iBAAiB,GAC7E,IAAI,CAAC,UAAU,EAAE,WAAW,GAAG,OAAO,CAAC,GAAG;IACxC,mLAAmL;IACnL,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;CAC9C,CAAA;AAEH;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,OAAO,GAAG,OAAO,IAAI,iBAAiB,CAC7F,CAAC,EACD,CAAC,CACF,GACC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAChB;IAAE,QAAQ,CAAC,YAAY,CAAC,EAAE,KAAK,CAAA;CAAE,GACjC;IAAE,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC,sBAAsB,CAAC,CAAA;CAAE,CAAC,CAAA;AAEvE,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,OAAO,GAAG,OAAO,EACvE,KAAK,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,GAC5B,SAAS,CAAA"}
|
|
@@ -4,7 +4,7 @@ import { useEffect, useRef, useState } from "react";
|
|
|
4
4
|
import { assertRequiredProps } from "../common/validate.js";
|
|
5
5
|
import classes from "./controls.module.css";
|
|
6
6
|
import { useFilterRegistration, useFilterSurface } from "./filter-context.js";
|
|
7
|
-
import { FilterPill } from "./filter-pill.js";
|
|
7
|
+
import { FilterPill, filterReading } from "./filter-pill.js";
|
|
8
8
|
import { CalendarGlyph } from "./glyphs.js";
|
|
9
9
|
import { useControlName } from "./control-name.js";
|
|
10
10
|
import { PanelRow } from "./panel-row.js";
|
|
@@ -100,10 +100,16 @@ function RangeFilter(props) {
|
|
|
100
100
|
),
|
|
101
101
|
picker
|
|
102
102
|
] });
|
|
103
|
+
const rangeText = rangeLabel(value, options);
|
|
103
104
|
return /* @__PURE__ */ jsx(
|
|
104
105
|
FilterPill,
|
|
105
106
|
{
|
|
106
|
-
|
|
107
|
+
...filterReading({
|
|
108
|
+
name: label,
|
|
109
|
+
informative: !isDefault,
|
|
110
|
+
value: rangeText,
|
|
111
|
+
unsetText: rangeText
|
|
112
|
+
}),
|
|
107
113
|
active: !isDefault,
|
|
108
114
|
numeric: numeric && value.preset !== "custom",
|
|
109
115
|
...disabled === true && { disabled: true },
|
|
@@ -40,7 +40,7 @@ export type BarListProps = BasaltProps & {
|
|
|
40
40
|
loading?: boolean;
|
|
41
41
|
/** Skeleton rows while loading. Default 5. */
|
|
42
42
|
loadingRows?: number;
|
|
43
|
-
/**
|
|
43
|
+
/** Title of the `EmptyState` tile shown when `items` is empty. Default "No items to compare yet"; pass the cause for your list. */
|
|
44
44
|
emptyText?: string;
|
|
45
45
|
};
|
|
46
46
|
export declare function BarList({ label, items, format, max, variant, accentLeader, secondaryAlign, loading, loadingRows, emptyText, className, style, }: BarListProps): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bar-list.d.ts","sourceRoot":"","sources":["../../src/dashboard/bar-list.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bar-list.d.ts","sourceRoot":"","sources":["../../src/dashboard/bar-list.tsx"],"names":[],"mappings":"AAkDA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAMlD,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,6FAA6F;IAC7F,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,yEAAyE;IACzE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,kGAAkG;IAClG,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG;IACvC,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAA;IACb,6EAA6E;IAC7E,KAAK,EAAE,SAAS,WAAW,EAAE,CAAA;IAC7B;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,KAAK,KAAK,MAAM,CAAA;IACzD,oGAAoG;IACpG,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAA;IAC3B,4DAA4D;IAC5D,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,KAAK,CAAA;IAChC,oCAAoC;IACpC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,8CAA8C;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,mIAAmI;IACnI,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAmBD,wBAAgB,OAAO,CAAC,EACtB,KAAK,EACL,KAAK,EACL,MAAe,EACf,GAAG,EACH,OAAgB,EAChB,YAAoB,EACpB,cAAc,EACd,OAAe,EACf,WAAe,EACf,SAAqC,EACrC,SAAS,EACT,KAAK,GACN,EAAE,YAAY,+BAmHd"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Skeleton, VisuallyHidden } from "@mantine/core";
|
|
3
|
+
import { EmptyState } from "./empty-state.js";
|
|
3
4
|
import { isValidElement } from "react";
|
|
4
5
|
import { cx } from "../common/props.js";
|
|
5
6
|
import classes from "./bar-list.module.css";
|
|
@@ -19,7 +20,7 @@ function BarList({
|
|
|
19
20
|
secondaryAlign,
|
|
20
21
|
loading = false,
|
|
21
22
|
loadingRows = 5,
|
|
22
|
-
emptyText = "No
|
|
23
|
+
emptyText = "No items to compare yet",
|
|
23
24
|
className,
|
|
24
25
|
style
|
|
25
26
|
}) {
|
|
@@ -44,7 +45,10 @@ function BarList({
|
|
|
44
45
|
] }) });
|
|
45
46
|
}
|
|
46
47
|
if (items.length === 0) {
|
|
47
|
-
return /* @__PURE__ */ jsx("div", { className: cx(classes.frame, className), style, children: /* @__PURE__ */
|
|
48
|
+
return /* @__PURE__ */ jsx("div", { className: cx(classes.frame, className), style, children: /* @__PURE__ */ jsxs("div", { className: classes.root, role: "status", children: [
|
|
49
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { children: label }),
|
|
50
|
+
/* @__PURE__ */ jsx(EmptyState, { tier: "section", title: emptyText, className: classes.empty })
|
|
51
|
+
] }) });
|
|
48
52
|
}
|
|
49
53
|
const scale = max ?? items.reduce(
|
|
50
54
|
(top, i) => i.max === void 0 && Number.isFinite(i.value) ? Math.max(top, i.value) : top,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Roving-focus movement for `Board`: pure, so the keyboard law is testable without a DOM. */
|
|
2
|
+
export type BoardKey = 'ArrowUp' | 'ArrowDown' | 'ArrowLeft' | 'ArrowRight' | 'Home' | 'End';
|
|
3
|
+
export declare const BOARD_KEYS: readonly ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Home", "End"];
|
|
4
|
+
export declare function isBoardKey(key: string): key is BoardKey;
|
|
5
|
+
export type BoardPos = {
|
|
6
|
+
col: number;
|
|
7
|
+
row: number;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* The position `key` moves to from `from`, or `null` when it stays put. `sizes` is the card count of
|
|
11
|
+
* every column in order. Up/Down/Home/End stay in the column; Left/Right jump to the nearest
|
|
12
|
+
* non-empty column in that direction and land on the same row index, clamped to its last card.
|
|
13
|
+
*/
|
|
14
|
+
export declare function moveOnBoard(sizes: readonly number[], from: BoardPos, key: BoardKey): BoardPos | null;
|
|
15
|
+
/**
|
|
16
|
+
* Only http(s) and relative references render as links; anything else (`javascript:`, `data:`,
|
|
17
|
+
* `mailto:`) stays text. The scheme is case-insensitive (`HTTPS://` is http). A leading `/` must not
|
|
18
|
+
* be followed by another `/` or a `\` — browsers read both as a host (`//evil`, `/\evil`) — and a
|
|
19
|
+
* leading `\` is rejected the same way.
|
|
20
|
+
*/
|
|
21
|
+
export declare function isSafeHref(href: string): boolean;
|
|
22
|
+
//# sourceMappingURL=board-nav.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"board-nav.d.ts","sourceRoot":"","sources":["../../src/dashboard/board-nav.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAE9F,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,WAAW,GAAG,WAAW,GAAG,YAAY,GAAG,MAAM,GAAG,KAAK,CAAA;AAE5F,eAAO,MAAM,UAAU,6EAOiB,CAAA;AAExC,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,IAAI,QAAQ,CAEvD;AAED,MAAM,MAAM,QAAQ,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAA;AAEnD;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,IAAI,EAAE,QAAQ,EACd,GAAG,EAAE,QAAQ,GACZ,QAAQ,GAAG,IAAI,CA4BjB;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEhD"}
|