basalt-ui 2.27.2 → 2.29.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 +466 -307
- package/MIGRATING.md +358 -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-app/SKILL.md +3 -3
- package/agent/skills/basalt-charts/SKILL.md +1 -1
- package/agent/skills/basalt-design/SKILL.md +12 -6
- package/agent/skills/basalt-design/references/catalogue.md +42 -36
- package/agent/skills/basalt-design/references/recipes.md +47 -0
- package/agent/skills/basalt-design/references/states.md +1 -1
- package/configs/oxlint-basalt.json +2 -1
- package/configs/oxlint-plugin.js +112 -3
- package/configs/oxlint-plugin.test.ts +99 -4
- package/configs/oxlint.json +1 -0
- 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 +14 -7
- package/dist/charts/ChartCard.d.ts.map +1 -1
- package/dist/charts/ChartCard.js +112 -23
- package/dist/charts/Lines.d.ts.map +1 -1
- package/dist/charts/Lines.js +11 -4
- package/dist/charts/Sparkline.d.ts +14 -2
- package/dist/charts/Sparkline.d.ts.map +1 -1
- package/dist/charts/Sparkline.js +155 -44
- package/dist/charts/chart-box.module.css +59 -2
- package/dist/charts/chart-box.module.css.d.ts +5 -0
- package/dist/charts/chart-card.module.css +28 -17
- package/dist/charts/chart-card.module.css.d.ts +3 -0
- package/dist/charts/compile.d.ts +1 -1
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +38 -27
- 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 +37 -8
- package/dist/charts/ref-label.d.ts.map +1 -1
- package/dist/charts/ref-label.js +55 -10
- package/dist/charts/sparkline.module.css +50 -0
- package/dist/charts/sparkline.module.css.d.ts +3 -0
- package/dist/charts/state.d.ts +4 -4
- package/dist/charts/state.d.ts.map +1 -1
- package/dist/charts/state.js +23 -5
- package/dist/cli/doctor-upgrade.d.ts +11 -0
- package/dist/cli/doctor-upgrade.d.ts.map +1 -1
- package/dist/cli/doctor-upgrade.js +54 -0
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +32 -0
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +8 -3
- package/dist/cli/index.d.ts +13 -13
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +36 -2
- package/dist/cli/init.d.ts +6 -0
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +118 -27
- package/dist/cli/router-wiring.d.ts +3 -0
- package/dist/cli/router-wiring.d.ts.map +1 -1
- package/dist/cli/router-wiring.js +2 -0
- package/dist/cli/shot/capture.d.ts +34 -2
- package/dist/cli/shot/capture.d.ts.map +1 -1
- package/dist/cli/shot/capture.js +95 -12
- package/dist/cli/shot/detect.d.ts +4 -1
- package/dist/cli/shot/detect.d.ts.map +1 -1
- package/dist/cli/shot/detect.js +38 -16
- package/dist/cli/shot/index.d.ts.map +1 -1
- package/dist/cli/shot/index.js +9 -2
- package/dist/cli/shot/measure.d.ts.map +1 -1
- package/dist/cli/shot/measure.js +11 -2
- package/dist/cli/shot/types.d.ts +4 -1
- package/dist/cli/shot/types.d.ts.map +1 -1
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +10 -2
- package/dist/common/could-not-load.d.ts +13 -0
- package/dist/common/could-not-load.d.ts.map +1 -0
- package/dist/common/could-not-load.js +14 -0
- 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/index.d.ts +1 -0
- package/dist/common/index.d.ts.map +1 -1
- package/dist/common/index.js +3 -0
- package/dist/common/props.d.ts +20 -0
- package/dist/common/props.d.ts.map +1 -1
- package/dist/common/props.js +13 -1
- package/dist/common/retry-button.module.css +7 -3
- 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 +5 -5
- package/dist/dashboard/bar-list.d.ts.map +1 -1
- package/dist/dashboard/bar-list.js +15 -8
- package/dist/dashboard/bar-list.module.css +21 -5
- 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 +247 -0
- package/dist/dashboard/board.module.css +179 -0
- package/dist/dashboard/board.module.css.d.ts +28 -0
- package/dist/dashboard/empty-state.d.ts +6 -6
- package/dist/dashboard/empty-state.d.ts.map +1 -1
- package/dist/dashboard/empty-state.js +17 -8
- package/dist/dashboard/event-list-model.d.ts +54 -0
- package/dist/dashboard/event-list-model.d.ts.map +1 -0
- package/dist/dashboard/event-list-model.js +76 -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 +89 -0
- package/dist/dashboard/event-list-scroll.d.ts +55 -0
- package/dist/dashboard/event-list-scroll.d.ts.map +1 -0
- package/dist/dashboard/event-list-scroll.js +216 -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 +34 -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 +208 -0
- package/dist/dashboard/event-list.module.css +336 -0
- package/dist/dashboard/event-list.module.css.d.ts +34 -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-model.d.ts +6 -3
- package/dist/dashboard/meter-model.d.ts.map +1 -1
- package/dist/dashboard/meter-model.js +9 -4
- package/dist/dashboard/meter-parts.d.ts +3 -0
- package/dist/dashboard/meter-parts.d.ts.map +1 -1
- package/dist/dashboard/meter-parts.js +36 -6
- package/dist/dashboard/meter.d.ts +3 -3
- package/dist/dashboard/meter.d.ts.map +1 -1
- package/dist/dashboard/meter.js +10 -2
- package/dist/dashboard/meter.module.css +20 -12
- package/dist/dashboard/meter.module.css.d.ts +0 -1
- package/dist/dashboard/page-summary.d.ts +3 -3
- package/dist/dashboard/page-summary.d.ts.map +1 -1
- package/dist/dashboard/page-summary.js +7 -2
- package/dist/dashboard/page-summary.module.css +5 -2
- package/dist/dashboard/query-state.d.ts +9 -8
- package/dist/dashboard/query-state.d.ts.map +1 -1
- package/dist/dashboard/query-state.js +29 -11
- package/dist/dashboard/section.d.ts +11 -3
- package/dist/dashboard/section.d.ts.map +1 -1
- package/dist/dashboard/section.js +34 -7
- package/dist/dashboard/settings-section.d.ts +8 -5
- package/dist/dashboard/settings-section.d.ts.map +1 -1
- package/dist/dashboard/settings-section.js +12 -8
- package/dist/dashboard/settings-section.module.css +25 -4
- package/dist/dashboard/settings-section.module.css.d.ts +1 -0
- 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 +3 -3
- package/dist/dashboard/stat-card.d.ts.map +1 -1
- package/dist/dashboard/stat-card.js +47 -12
- package/dist/dashboard/stat-card.module.css +42 -7
- package/dist/dashboard/stat-card.module.css.d.ts +3 -0
- package/dist/dashboard/stat-group.d.ts +2 -2
- package/dist/dashboard/stat-group.d.ts.map +1 -1
- package/dist/dashboard/stat-group.js +10 -3
- package/dist/dashboard/stat-strip.d.ts +5 -4
- package/dist/dashboard/stat-strip.d.ts.map +1 -1
- package/dist/dashboard/stat-strip.js +41 -31
- package/dist/dashboard/stat-strip.module.css +8 -6
- package/dist/dashboard/visual-slot.d.ts +4 -0
- package/dist/dashboard/visual-slot.d.ts.map +1 -1
- package/dist/dashboard/visual-slot.js +2 -0
- package/dist/dashboard/widget-header.d.ts +6 -6
- package/dist/dashboard/widget-header.d.ts.map +1 -1
- package/dist/dashboard/widget-header.js +4 -2
- package/dist/dashboard/widget-header.module.css +12 -15
- package/dist/format/shared.d.ts.map +1 -1
- package/dist/format/shared.js +24 -1
- package/dist/guard/index.d.ts +1 -1
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +4 -1
- 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 +69 -0
- 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 +47 -0
- package/dist/table/cell-kinds.d.ts.map +1 -0
- package/dist/table/cell-kinds.js +180 -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 +155 -0
- package/dist/table/data-table-fold.d.ts.map +1 -0
- package/dist/table/data-table-fold.js +320 -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 +13 -28
- package/dist/table/data-table.d.ts.map +1 -1
- package/dist/table/data-table.js +362 -255
- package/dist/table/data-table.module.css +282 -3
- package/dist/table/data-table.module.css.d.ts +16 -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 +55 -2
- 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 +295 -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 +175 -31
- package/src/charts/Lines.tsx +13 -4
- package/src/charts/Sparkline.tsx +213 -48
- package/src/charts/chart-box.module.css +59 -2
- package/src/charts/chart-box.module.css.d.ts +5 -0
- package/src/charts/chart-card.module.css +28 -17
- package/src/charts/chart-card.module.css.d.ts +3 -0
- package/src/charts/compile.ts +59 -33
- package/src/charts/labels.ts +175 -24
- package/src/charts/legend.tsx +3 -2
- package/src/charts/ref-label.ts +114 -18
- package/src/charts/sparkline.module.css +50 -0
- package/src/charts/sparkline.module.css.d.ts +3 -0
- package/src/charts/state.tsx +40 -10
- package/src/cli/doctor-upgrade.ts +75 -0
- package/src/cli/doctor.ts +36 -0
- package/src/cli/help.ts +16 -6
- package/src/cli/index.ts +73 -67
- package/src/cli/init.ts +157 -36
- package/src/cli/router-wiring.ts +2 -2
- package/src/cli/shot/capture.ts +138 -16
- package/src/cli/shot/detect.ts +46 -22
- package/src/cli/shot/index.ts +8 -2
- package/src/cli/shot/measure.ts +11 -2
- package/src/cli/shot/types.ts +4 -1
- package/src/cli/sync.ts +12 -2
- package/src/common/could-not-load.ts +22 -0
- package/src/common/empty-copy.ts +17 -0
- package/src/common/index.ts +1 -0
- package/src/common/props.ts +30 -0
- package/src/common/retry-button.module.css +7 -3
- 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 +21 -5
- package/src/dashboard/bar-list.tsx +53 -45
- package/src/dashboard/board-nav.ts +67 -0
- package/src/dashboard/board.module.css +179 -0
- package/src/dashboard/board.module.css.d.ts +28 -0
- package/src/dashboard/board.tsx +415 -0
- package/src/dashboard/empty-state.tsx +21 -11
- package/src/dashboard/event-list-model.ts +125 -0
- package/src/dashboard/event-list-rows.tsx +117 -0
- package/src/dashboard/event-list-scroll.ts +291 -0
- package/src/dashboard/event-list-skeleton.tsx +62 -0
- package/src/dashboard/event-list.module.css +336 -0
- package/src/dashboard/event-list.module.css.d.ts +34 -0
- package/src/dashboard/event-list.tsx +336 -0
- package/src/dashboard/index.ts +2 -0
- package/src/dashboard/meter-model.ts +16 -7
- package/src/dashboard/meter-parts.tsx +53 -14
- package/src/dashboard/meter.module.css +20 -12
- package/src/dashboard/meter.module.css.d.ts +0 -1
- package/src/dashboard/meter.tsx +36 -18
- package/src/dashboard/page-summary.module.css +5 -2
- package/src/dashboard/page-summary.tsx +13 -6
- package/src/dashboard/query-state.tsx +55 -30
- package/src/dashboard/section.tsx +83 -41
- package/src/dashboard/settings-section.module.css +25 -4
- package/src/dashboard/settings-section.module.css.d.ts +1 -0
- package/src/dashboard/settings-section.tsx +18 -8
- package/src/dashboard/stat-card-parts.tsx +20 -3
- package/src/dashboard/stat-card.module.css +42 -7
- package/src/dashboard/stat-card.module.css.d.ts +3 -0
- package/src/dashboard/stat-card.tsx +55 -13
- package/src/dashboard/stat-group.tsx +22 -14
- package/src/dashboard/stat-strip.module.css +8 -6
- package/src/dashboard/stat-strip.tsx +29 -20
- package/src/dashboard/visual-slot.ts +5 -0
- package/src/dashboard/widget-header.module.css +12 -15
- package/src/dashboard/widget-header.tsx +8 -5
- package/src/format/shared.ts +30 -1
- package/src/guard/index.ts +7 -1
- package/src/index.ts +4 -0
- package/src/shell/app-main.module.css +18 -0
- package/src/styles.css +69 -0
- 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 +263 -0
- package/src/table/data-table-fold.tsx +567 -0
- package/src/table/data-table-state.ts +24 -13
- package/src/table/data-table.module.css +282 -3
- package/src/table/data-table.module.css.d.ts +16 -0
- package/src/table/data-table.tsx +430 -362
- 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 +55 -2
- 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
|
@@ -2,7 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Radio, Stack } from "@mantine/core";
|
|
3
3
|
import classes from "./controls.module.css";
|
|
4
4
|
import { POPOVER_ROW_HIT_GAP, useFilterRegistration, useFilterSurface } from "./filter-context.js";
|
|
5
|
-
import { FilterClearButton, FilterPill } from "./filter-pill.js";
|
|
5
|
+
import { FilterClearButton, FilterPill, filterReading } from "./filter-pill.js";
|
|
6
6
|
import { useControlName } from "./control-name.js";
|
|
7
7
|
import { PanelChoice, PanelRow } from "./panel-row.js";
|
|
8
8
|
function EnumFilter({
|
|
@@ -84,10 +84,16 @@ function EnumFilter({
|
|
|
84
84
|
}
|
|
85
85
|
)
|
|
86
86
|
);
|
|
87
|
+
const shownLabel = selected?.label ?? unmatchedLabel;
|
|
87
88
|
return /* @__PURE__ */ jsx(
|
|
88
89
|
FilterPill,
|
|
89
90
|
{
|
|
90
|
-
|
|
91
|
+
...filterReading({
|
|
92
|
+
name: label,
|
|
93
|
+
informative: !isDefault,
|
|
94
|
+
value: shownLabel ?? value,
|
|
95
|
+
unsetText: shownLabel ?? label
|
|
96
|
+
}),
|
|
91
97
|
active: !isDefault,
|
|
92
98
|
...numeric === true && { numeric: true },
|
|
93
99
|
...disabled === true && { disabled: true },
|
|
@@ -1,9 +1,33 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { BasaltProps } from '../common/props.js';
|
|
3
|
-
export type
|
|
3
|
+
export type FilterPillReading = {
|
|
4
4
|
readonly label: string;
|
|
5
|
+
readonly value: string;
|
|
6
|
+
readonly unset?: never;
|
|
7
|
+
} | {
|
|
8
|
+
readonly label: string;
|
|
9
|
+
readonly unset: true;
|
|
10
|
+
readonly value?: never;
|
|
11
|
+
} | {
|
|
12
|
+
readonly label: string;
|
|
13
|
+
readonly value?: never;
|
|
14
|
+
readonly unset?: never;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* The ONE place a facet filter turns its state into a {@link FilterPillReading}: `informative` is
|
|
18
|
+
* the single predicate for "this filter is filtering" (and what the caller hands `active` too, so
|
|
19
|
+
* the muted anatomy and the ink border can never disagree); `value` is the selection's text and
|
|
20
|
+
* `unsetText` what the pill reads while it is not filtering (the control's existing copy).
|
|
21
|
+
*/
|
|
22
|
+
export declare function filterReading(input: {
|
|
23
|
+
readonly name: string;
|
|
24
|
+
readonly informative: boolean;
|
|
25
|
+
readonly value: string;
|
|
26
|
+
readonly unsetText: string;
|
|
27
|
+
}): FilterPillReading;
|
|
28
|
+
export type FilterPillProps = BasaltProps & FilterPillReading & {
|
|
5
29
|
readonly icon?: ReactNode;
|
|
6
|
-
/** Non-default →
|
|
30
|
+
/** Non-default → ink border (selection is ink, never the accent). Derived from `field.isDefault(value)`, never hand-set. */
|
|
7
31
|
readonly active?: boolean;
|
|
8
32
|
/** Mono label, for a numeric preset set (`7d` / `30d`) — the same law `[data-numeric]` applies
|
|
9
33
|
* to a numeric SegmentedControl label (`theme/segmented-control.module.css`). */
|
|
@@ -26,7 +50,7 @@ export type FilterPillProps = BasaltProps & {
|
|
|
26
50
|
/** `data-shown` — the CSS hook that reveals the `+N` fold pill once folding is needed. */
|
|
27
51
|
readonly shown?: boolean;
|
|
28
52
|
};
|
|
29
|
-
export declare function FilterPill({ label, icon, active, numeric, children, onClick, ariaLabel, pressed, disabled, className, style, hideGlyph, shown, }: FilterPillProps): ReactNode;
|
|
53
|
+
export declare function FilterPill({ label, value, unset, icon, active, numeric, children, onClick, ariaLabel, pressed, disabled, className, style, hideGlyph, shown, }: FilterPillProps): ReactNode;
|
|
30
54
|
/**
|
|
31
55
|
* The popover's `Clear` — one button for `EnumFilter`, `NumberFilter` and `MultiSelectFilter`. Its
|
|
32
56
|
* mousedown keeps focus where it is: a stepper commits its draft on blur, so a press that blurred
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter-pill.d.ts","sourceRoot":"","sources":["../../src/controls/filter-pill.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"filter-pill.d.ts","sourceRoot":"","sources":["../../src/controls/filter-pill.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAalD,MAAM,MAAM,iBAAiB,GACzB;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,GAC1E;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,GACxE;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,CAAA;AAE9E;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAA;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC3B,GAAG,iBAAiB,CAGpB;AAED,MAAM,MAAM,eAAe,GAAG,WAAW,GACvC,iBAAiB,GAAG;IAClB,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAA;IACzB,4HAA4H;IAC5H,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;IACzB;sFACkF;IAClF,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;IAC1B,kDAAkD;IAClD,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;IAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IAC7B,qEAAqE;IACrE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;IAC1B,qEAAqE;IACrE,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAC3B,6FAA6F;IAC7F,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;IAC5B,0FAA0F;IAC1F,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CACzB,CAAA;AAEH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,KAAK,EACL,KAAK,EACL,IAAI,EACJ,MAAM,EACN,OAAO,EACP,QAAQ,EACR,OAAO,EACP,SAAS,EACT,OAAO,EACP,QAAQ,EACR,SAAS,EACT,KAAK,EACL,SAAS,EACT,KAAK,GACN,EAAE,eAAe,GAAG,SAAS,CA+E7B;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,GAAG,SAAS,CAa1F"}
|
|
@@ -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 },
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import type { BasaltProps } from '../common/props.js';
|
|
2
|
+
import type { BasaltProps, DataAttributes } from '../common/props.js';
|
|
3
3
|
type BarListItem = {
|
|
4
4
|
label: string;
|
|
5
5
|
value: number;
|
|
@@ -12,7 +12,7 @@ type BarListItem = {
|
|
|
12
12
|
/** Names the tick for assistive tech (visually hidden text in the track). Default "Threshold". */
|
|
13
13
|
tickLabel?: string;
|
|
14
14
|
};
|
|
15
|
-
export type BarListProps = BasaltProps & {
|
|
15
|
+
export type BarListProps = BasaltProps & DataAttributes & {
|
|
16
16
|
/** Accessible name of the list. Required. */
|
|
17
17
|
label: string;
|
|
18
18
|
/** Rows in display order (sort them yourself; the list does not reorder). */
|
|
@@ -38,11 +38,11 @@ export type BarListProps = BasaltProps & {
|
|
|
38
38
|
secondaryAlign?: 'start' | 'end';
|
|
39
39
|
/** Renders row-shaped skeletons. */
|
|
40
40
|
loading?: boolean;
|
|
41
|
-
/** Skeleton rows while loading. Default 5. */
|
|
41
|
+
/** Skeleton rows while loading. Default: the rows `items` holds now (a refetch, capped at 30), else 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
|
-
export declare function BarList({ label, items, format, max, variant, accentLeader, secondaryAlign, loading, loadingRows, emptyText, className, style, }: BarListProps): import("react").JSX.Element;
|
|
46
|
+
export declare function BarList({ label, items, format, max, variant, accentLeader, secondaryAlign, loading, loadingRows, emptyText, className, style, ...rest }: BarListProps): import("react").JSX.Element;
|
|
47
47
|
export {};
|
|
48
48
|
//# sourceMappingURL=bar-list.d.ts.map
|