basalt-ui 2.13.3 → 2.15.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 +66 -0
- package/MIGRATING.md +42 -12
- package/agent/agents/basalt-design-reviewer.md +83 -0
- package/agent/rules/basalt-batteries.md +1 -2
- package/agent/rules/basalt-charts.md +1 -1
- package/agent/rules/basalt-controls.md +3 -3
- package/agent/rules/basalt-mantine.md +1 -2
- package/agent/rules/basalt-state.md +1 -2
- package/agent/rules/basalt-tokens.md +1 -3
- package/agent/skills/basalt-design/SKILL.md +26 -8
- package/agent/templates/AGENTS-block.md.tpl +7 -0
- package/configs/oxlint-plugin.js +39 -2
- package/configs/oxlint-plugin.test.ts +48 -0
- package/dist/agent/chat/thread-feed-row.d.ts.map +1 -1
- package/dist/agent/chat/thread-feed-row.js +2 -2
- package/dist/agent/chat/thread-message.d.ts.map +1 -1
- package/dist/agent/chat/thread-message.js +2 -2
- package/dist/agent/chat/thread-outcome-card.js +2 -2
- package/dist/charts/DualPanel.d.ts.map +1 -1
- package/dist/charts/DualPanel.js +1 -0
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +3 -2
- package/dist/charts/cursor.d.ts +10 -6
- package/dist/charts/cursor.d.ts.map +1 -1
- package/dist/charts/cursor.js +20 -13
- package/dist/charts/legend.d.ts +7 -6
- package/dist/charts/legend.d.ts.map +1 -1
- package/dist/charts/legend.js +3 -3
- package/dist/charts/panel.d.ts +2 -0
- package/dist/charts/panel.d.ts.map +1 -1
- package/dist/charts/panel.js +1 -0
- package/dist/cli/board-freshness.d.ts +25 -0
- package/dist/cli/board-freshness.d.ts.map +1 -0
- package/dist/cli/board-freshness.js +88 -0
- package/dist/cli/doctor.d.ts +2 -1
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +3 -1
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +9 -3
- package/dist/cli/index.d.ts +15 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +57 -7
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +6 -1
- package/dist/cli/shot/board.d.ts +5 -0
- package/dist/cli/shot/board.d.ts.map +1 -0
- package/dist/cli/shot/board.js +96 -0
- package/dist/cli/shot/capture.d.ts +59 -0
- package/dist/cli/shot/capture.d.ts.map +1 -0
- package/dist/cli/shot/capture.js +473 -0
- package/dist/cli/shot/index.d.ts +45 -0
- package/dist/cli/shot/index.d.ts.map +1 -0
- package/dist/cli/shot/index.js +289 -0
- package/dist/cli/shot/measure.d.ts +28 -0
- package/dist/cli/shot/measure.d.ts.map +1 -0
- package/dist/cli/shot/measure.js +176 -0
- package/dist/cli/shot/playwright.d.ts +101 -0
- package/dist/cli/shot/playwright.d.ts.map +1 -0
- package/dist/cli/shot/playwright.js +60 -0
- package/dist/cli/shot/serve.d.ts +6 -0
- package/dist/cli/shot/serve.d.ts.map +1 -0
- package/dist/cli/shot/serve.js +33 -0
- package/dist/cli/shot/types.d.ts +97 -0
- package/dist/cli/shot/types.d.ts.map +1 -0
- package/dist/cli/shot/types.js +17 -0
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +2 -1
- package/dist/commands/notifications/center.d.ts.map +1 -1
- package/dist/commands/notifications/center.js +2 -11
- package/dist/controls/control-name.d.ts +27 -0
- package/dist/controls/control-name.d.ts.map +1 -0
- package/dist/controls/control-name.js +11 -0
- package/dist/controls/enum-filter.d.ts +3 -6
- package/dist/controls/enum-filter.d.ts.map +1 -1
- package/dist/controls/enum-filter.js +8 -4
- package/dist/controls/filter-base.d.ts +30 -0
- package/dist/controls/filter-base.d.ts.map +1 -0
- package/dist/controls/filter-base.js +0 -0
- package/dist/controls/filter-pill.d.ts +3 -1
- package/dist/controls/filter-pill.d.ts.map +1 -1
- package/dist/controls/filter-pill.js +2 -0
- package/dist/controls/filter-sheet.d.ts +0 -32
- package/dist/controls/filter-sheet.d.ts.map +1 -1
- package/dist/controls/filter-sheet.js +1 -28
- package/dist/controls/glyphs.d.ts +12 -0
- package/dist/controls/glyphs.d.ts.map +1 -1
- package/dist/controls/glyphs.js +23 -2
- package/dist/controls/index.d.ts +2 -1
- package/dist/controls/index.d.ts.map +1 -1
- package/dist/controls/multi-select-filter.d.ts +8 -3
- package/dist/controls/multi-select-filter.d.ts.map +1 -1
- package/dist/controls/multi-select-filter.js +27 -10
- package/dist/controls/number-filter.d.ts +3 -12
- package/dist/controls/number-filter.d.ts.map +1 -1
- package/dist/controls/number-filter.js +17 -6
- package/dist/controls/panel-row.d.ts +5 -8
- package/dist/controls/panel-row.d.ts.map +1 -1
- package/dist/controls/panel-row.js +3 -0
- package/dist/controls/range-filter.d.ts +14 -14
- package/dist/controls/range-filter.d.ts.map +1 -1
- package/dist/controls/range-filter.js +18 -41
- package/dist/controls/search-filter.d.ts +5 -2
- package/dist/controls/search-filter.d.ts.map +1 -1
- package/dist/controls/search-filter.js +74 -40
- package/dist/controls/select-filter.d.ts +2 -15
- package/dist/controls/select-filter.d.ts.map +1 -1
- package/dist/controls/sync-button.d.ts +0 -6
- package/dist/controls/sync-button.d.ts.map +1 -1
- package/dist/controls/sync-button.js +6 -36
- package/dist/controls/toggle-filter.d.ts +2 -2
- package/dist/controls/toggle-filter.d.ts.map +1 -1
- package/dist/controls/toggle-filter.js +3 -2
- package/dist/controls/view-tabs.d.ts +3 -4
- package/dist/controls/view-tabs.d.ts.map +1 -1
- package/dist/controls/view-tabs.js +24 -5
- package/dist/format/date.d.ts +43 -10
- package/dist/format/date.d.ts.map +1 -1
- package/dist/format/date.js +109 -18
- package/dist/format/index.d.ts +12 -11
- package/dist/format/index.d.ts.map +1 -1
- package/dist/format/index.js +11 -2
- package/dist/format/measure.d.ts +9 -9
- package/dist/format/measure.d.ts.map +1 -1
- package/dist/format/measure.js +19 -8
- package/dist/format/number.d.ts +35 -27
- package/dist/format/number.d.ts.map +1 -1
- package/dist/format/number.js +41 -20
- package/dist/format/shared.d.ts +38 -7
- package/dist/format/shared.d.ts.map +1 -1
- package/dist/format/shared.js +61 -13
- package/dist/provider/index.d.ts +13 -1
- package/dist/provider/index.d.ts.map +1 -1
- package/dist/provider/index.js +8 -0
- package/dist/surfaces.d.ts +2 -0
- package/dist/surfaces.d.ts.map +1 -1
- package/dist/surfaces.js +2 -0
- package/llms.txt +35 -14
- package/package.json +1 -1
- package/src/agent/chat/thread-feed-row.tsx +2 -2
- package/src/agent/chat/thread-message.tsx +2 -2
- package/src/agent/chat/thread-outcome-card.tsx +2 -2
- package/src/charts/DualPanel.tsx +1 -0
- package/src/charts/compile.ts +3 -2
- package/src/charts/cursor.ts +44 -27
- package/src/charts/legend.tsx +11 -8
- package/src/charts/panel.tsx +3 -0
- package/src/cli/board-freshness.ts +132 -0
- package/src/cli/doctor.ts +10 -1
- package/src/cli/help.ts +14 -2
- package/src/cli/index.ts +80 -10
- package/src/cli/init.ts +8 -1
- package/src/cli/shot/board.ts +154 -0
- package/src/cli/shot/capture.ts +650 -0
- package/src/cli/shot/index.ts +362 -0
- package/src/cli/shot/measure.ts +225 -0
- package/src/cli/shot/playwright.ts +152 -0
- package/src/cli/shot/serve.ts +35 -0
- package/src/cli/shot/types.ts +91 -0
- package/src/cli/sync.ts +2 -1
- package/src/commands/notifications/center.tsx +2 -14
- package/src/controls/control-name.ts +33 -0
- package/src/controls/enum-filter.tsx +29 -27
- package/src/controls/filter-base.ts +31 -0
- package/src/controls/filter-pill.tsx +4 -0
- package/src/controls/filter-sheet.tsx +0 -56
- package/src/controls/glyphs.tsx +45 -2
- package/src/controls/index.ts +2 -1
- package/src/controls/multi-select-filter.tsx +67 -43
- package/src/controls/number-filter.tsx +47 -47
- package/src/controls/panel-row.tsx +7 -8
- package/src/controls/range-filter.tsx +54 -78
- package/src/controls/search-filter.tsx +107 -54
- package/src/controls/select-filter.tsx +2 -18
- package/src/controls/sync-button.tsx +7 -40
- package/src/controls/toggle-filter.tsx +9 -7
- package/src/controls/view-tabs.tsx +41 -21
- package/src/format/date.ts +189 -36
- package/src/format/index.ts +12 -11
- package/src/format/measure.ts +29 -18
- package/src/format/number.ts +76 -37
- package/src/format/shared.ts +116 -25
- package/src/provider/index.tsx +23 -0
- package/src/surfaces.ts +5 -0
- package/dist/agent/chat/relative-time.d.ts +0 -27
- package/dist/agent/chat/relative-time.d.ts.map +0 -1
- package/dist/agent/chat/relative-time.js +0 -27
- package/src/agent/chat/relative-time.ts +0 -55
|
@@ -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,YAAY,EAAE,MAAM,
|
|
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,CA8G/F"}
|
|
@@ -5,20 +5,34 @@ 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
7
|
import { FilterClearButton, FilterPill } from "./filter-pill.js";
|
|
8
|
-
import {
|
|
8
|
+
import { useControlName } from "./control-name.js";
|
|
9
|
+
import { CheckGlyph } from "./glyphs.js";
|
|
9
10
|
import { PanelRow } from "./panel-row.js";
|
|
10
11
|
const PANEL_FACET_MAX = 6;
|
|
11
12
|
function MultiSelectFilter(props) {
|
|
12
13
|
assertRequiredProps("MultiSelectFilter", props, ["field"], {
|
|
13
14
|
field: "bind it to a store field (`store.field.<name>`), never a value/onChange pair."
|
|
14
15
|
});
|
|
15
|
-
const {
|
|
16
|
+
const {
|
|
17
|
+
field,
|
|
18
|
+
label,
|
|
19
|
+
icon,
|
|
20
|
+
noun,
|
|
21
|
+
counts,
|
|
22
|
+
max,
|
|
23
|
+
clearable = true,
|
|
24
|
+
disabled,
|
|
25
|
+
options: optionsProp,
|
|
26
|
+
className,
|
|
27
|
+
style
|
|
28
|
+
} = props;
|
|
16
29
|
const [value, setValue] = field.use();
|
|
17
30
|
const surface = useFilterSurface();
|
|
18
31
|
const isDefault = field.isDefault(value);
|
|
19
|
-
|
|
32
|
+
const clearFilter = () => {
|
|
20
33
|
field.clear();
|
|
21
|
-
}
|
|
34
|
+
};
|
|
35
|
+
useFilterRegistration(!isDefault, clearFilter);
|
|
22
36
|
const options = optionsProp ?? field.options;
|
|
23
37
|
const inSheet = surface === "sheet";
|
|
24
38
|
const inPanel = surface === "panel";
|
|
@@ -43,6 +57,7 @@ function MultiSelectFilter(props) {
|
|
|
43
57
|
options,
|
|
44
58
|
selected: value,
|
|
45
59
|
max: max ?? PANEL_FACET_MAX,
|
|
60
|
+
...disabled === true && { disabled: true },
|
|
46
61
|
onToggle: toggle,
|
|
47
62
|
...counts !== void 0 && { counts }
|
|
48
63
|
}
|
|
@@ -69,11 +84,11 @@ function MultiSelectFilter(props) {
|
|
|
69
84
|
{
|
|
70
85
|
value: option.value,
|
|
71
86
|
label: option.label,
|
|
72
|
-
...option.disabled === true && { disabled: true }
|
|
87
|
+
...(option.disabled === true || disabled === true) && { disabled: true }
|
|
73
88
|
},
|
|
74
89
|
option.value
|
|
75
90
|
)) }),
|
|
76
|
-
!isDefault && /* @__PURE__ */ jsx(FilterClearButton, { onClear:
|
|
91
|
+
clearable && !isDefault && disabled !== true && /* @__PURE__ */ jsx(FilterClearButton, { onClear: clearFilter })
|
|
77
92
|
]
|
|
78
93
|
}
|
|
79
94
|
)
|
|
@@ -83,6 +98,7 @@ function MultiSelectFilter(props) {
|
|
|
83
98
|
{
|
|
84
99
|
label: carriesInformation ? `${value.length} ${noun ?? label.toLowerCase()}` : label,
|
|
85
100
|
active: !isDefault,
|
|
101
|
+
...disabled === true && { disabled: true },
|
|
86
102
|
...icon !== void 0 && { icon },
|
|
87
103
|
...className !== void 0 && { className },
|
|
88
104
|
...style !== void 0 && { style },
|
|
@@ -96,7 +112,8 @@ function FacetList({
|
|
|
96
112
|
selected,
|
|
97
113
|
counts,
|
|
98
114
|
max,
|
|
99
|
-
onToggle
|
|
115
|
+
onToggle,
|
|
116
|
+
disabled
|
|
100
117
|
}) {
|
|
101
118
|
const [expanded, setExpanded] = useState(false);
|
|
102
119
|
const shown = expanded ? options : options.slice(0, max);
|
|
@@ -105,7 +122,7 @@ function FacetList({
|
|
|
105
122
|
return (
|
|
106
123
|
// A real `<fieldset>` named by the row's own label — the native element carries the grouping
|
|
107
124
|
// semantics, and the heading is already visible.
|
|
108
|
-
/* @__PURE__ */ jsxs("fieldset", { className: classes.facetList, "aria-labelledby": labelId, children: [
|
|
125
|
+
/* @__PURE__ */ jsxs("fieldset", { className: classes.facetList, "aria-labelledby": labelId, disabled, children: [
|
|
109
126
|
shown.map((option) => {
|
|
110
127
|
const isSelected = selected.includes(option.value);
|
|
111
128
|
const count = counts?.[option.value];
|
|
@@ -114,7 +131,7 @@ function FacetList({
|
|
|
114
131
|
{
|
|
115
132
|
className: classes.facetOption,
|
|
116
133
|
...isSelected && { "data-selected": true },
|
|
117
|
-
...option.disabled === true && { "data-disabled": true },
|
|
134
|
+
...(option.disabled === true || disabled === true) && { "data-disabled": true },
|
|
118
135
|
children: [
|
|
119
136
|
/* @__PURE__ */ jsx(
|
|
120
137
|
"input",
|
|
@@ -123,7 +140,7 @@ function FacetList({
|
|
|
123
140
|
type: "checkbox",
|
|
124
141
|
value: option.value,
|
|
125
142
|
checked: isSelected,
|
|
126
|
-
disabled: option.disabled === true,
|
|
143
|
+
disabled: option.disabled === true || disabled === true,
|
|
127
144
|
"aria-label": option.label,
|
|
128
145
|
onChange: () => {
|
|
129
146
|
onToggle(option.value);
|
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { FieldHandle } from '../state.js';
|
|
3
3
|
import type { NumberField } from '../state/fields.js';
|
|
4
|
+
import type { FilterBase, FilterOption } from './filter-base.js';
|
|
4
5
|
import type { UncontrolledProps } from './uncontrolled.js';
|
|
5
|
-
|
|
6
|
-
* the set is declared at the call site, so a row that should not be offered is left out. */
|
|
7
|
-
export type NumberFilterOption = {
|
|
8
|
-
readonly value: number;
|
|
9
|
-
readonly label: string;
|
|
10
|
-
};
|
|
11
|
-
export type NumberFilterProps = UncontrolledProps & {
|
|
6
|
+
export type NumberFilterProps = UncontrolledProps & FilterBase & {
|
|
12
7
|
readonly field: FieldHandle<NumberField>;
|
|
13
8
|
/** The popover/sheet heading and the accessible name — never the pill text, which reads the
|
|
14
9
|
* VALUE (see `EnumFilter`'s doc for why a pill may only print what is selected). */
|
|
15
10
|
readonly label: string;
|
|
16
|
-
readonly icon?: ReactNode;
|
|
17
11
|
/** Present → the radio-list form. Absent → the stepper form. */
|
|
18
|
-
readonly options?: readonly
|
|
12
|
+
readonly options?: readonly FilterOption<number>[];
|
|
19
13
|
/**
|
|
20
14
|
* The stepper's increment, overriding the field's own. Ignored in the `options` form, which has
|
|
21
15
|
* no stepper.
|
|
@@ -24,9 +18,6 @@ export type NumberFilterProps = UncontrolledProps & {
|
|
|
24
18
|
* declared none. Absent on both, the input keeps Mantine's own default of 1.
|
|
25
19
|
*/
|
|
26
20
|
readonly step?: number;
|
|
27
|
-
/** Adds a `Clear` action that clears the field — the same `field.clear()` `Reset all` calls.
|
|
28
|
-
* Parity with `SelectFilter`/`EnumFilter`, in both forms. */
|
|
29
|
-
readonly clearable?: boolean;
|
|
30
21
|
};
|
|
31
22
|
export declare function NumberFilter(props: NumberFilterProps): ReactNode;
|
|
32
23
|
//# sourceMappingURL=number-filter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-filter.d.ts","sourceRoot":"","sources":["../../src/controls/number-filter.tsx"],"names":[],"mappings":"AAmEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"number-filter.d.ts","sourceRoot":"","sources":["../../src/controls/number-filter.tsx"],"names":[],"mappings":"AAmEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAKlD,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAI7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAEvD,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,GAC/C,UAAU,GAAG;IACX,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,WAAW,CAAC,CAAA;IACxC;yFACqF;IACrF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,gEAAgE;IAChE,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,YAAY,CAAC,MAAM,CAAC,EAAE,CAAA;IAClD;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAEH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,CAuChE"}
|
|
@@ -6,13 +6,13 @@ import classes from "./controls.module.css";
|
|
|
6
6
|
import { EnumFilter } from "./enum-filter.js";
|
|
7
7
|
import { useFilterRegistration, useFilterSurface } from "./filter-context.js";
|
|
8
8
|
import { FilterClearButton, FilterPill } from "./filter-pill.js";
|
|
9
|
-
import { useControlName } from "./
|
|
9
|
+
import { useControlName } from "./control-name.js";
|
|
10
10
|
import { PanelRow } from "./panel-row.js";
|
|
11
11
|
function NumberFilter(props) {
|
|
12
12
|
assertRequiredProps("NumberFilter", props, ["field"], {
|
|
13
13
|
field: "bind it to a store field (`store.field.<name>`), never a value/onChange pair."
|
|
14
14
|
});
|
|
15
|
-
const { field, label, icon, options, step, clearable, className, style } = props;
|
|
15
|
+
const { field, label, icon, options, step, clearable, disabled, className, style } = props;
|
|
16
16
|
if (options !== void 0) {
|
|
17
17
|
return /* @__PURE__ */ jsx(
|
|
18
18
|
NumberChoice,
|
|
@@ -21,6 +21,7 @@ function NumberFilter(props) {
|
|
|
21
21
|
label,
|
|
22
22
|
options,
|
|
23
23
|
...clearable === true && { clearable: true },
|
|
24
|
+
...disabled === true && { disabled: true },
|
|
24
25
|
...icon !== void 0 && { icon },
|
|
25
26
|
...className !== void 0 && { className },
|
|
26
27
|
...style !== void 0 && { style }
|
|
@@ -34,6 +35,7 @@ function NumberFilter(props) {
|
|
|
34
35
|
field,
|
|
35
36
|
label,
|
|
36
37
|
...clearable === true && { clearable: true },
|
|
38
|
+
...disabled === true && { disabled: true },
|
|
37
39
|
...icon !== void 0 && { icon },
|
|
38
40
|
...grain !== void 0 && { step: grain },
|
|
39
41
|
...className !== void 0 && { className },
|
|
@@ -47,11 +49,15 @@ function NumberChoice({
|
|
|
47
49
|
icon,
|
|
48
50
|
options,
|
|
49
51
|
clearable,
|
|
52
|
+
disabled,
|
|
50
53
|
className,
|
|
51
54
|
style
|
|
52
55
|
}) {
|
|
53
56
|
const [value, setValue] = field.use();
|
|
54
|
-
const rows = options.map((option) => ({
|
|
57
|
+
const rows = options.map((option) => ({
|
|
58
|
+
...option,
|
|
59
|
+
value: String(option.value)
|
|
60
|
+
}));
|
|
55
61
|
const named = field.options.find((option) => option.value === String(value))?.label;
|
|
56
62
|
const choice = {
|
|
57
63
|
fallback: String(field.fallback),
|
|
@@ -76,6 +82,7 @@ function NumberChoice({
|
|
|
76
82
|
options: rows,
|
|
77
83
|
...named !== void 0 && { unmatchedLabel: named },
|
|
78
84
|
...clearable === true && { clearable: true },
|
|
85
|
+
...disabled === true && { disabled: true },
|
|
79
86
|
...icon !== void 0 && { icon },
|
|
80
87
|
...className !== void 0 && { className },
|
|
81
88
|
...style !== void 0 && { style }
|
|
@@ -88,6 +95,7 @@ function NumberStepper({
|
|
|
88
95
|
icon,
|
|
89
96
|
step,
|
|
90
97
|
clearable,
|
|
98
|
+
disabled,
|
|
91
99
|
className,
|
|
92
100
|
style
|
|
93
101
|
}) {
|
|
@@ -95,9 +103,10 @@ function NumberStepper({
|
|
|
95
103
|
const surface = useFilterSurface();
|
|
96
104
|
const inSheet = surface === "sheet";
|
|
97
105
|
const isDefault = field.isDefault(value);
|
|
98
|
-
|
|
106
|
+
const clearFilter = () => {
|
|
99
107
|
field.clear();
|
|
100
|
-
}
|
|
108
|
+
};
|
|
109
|
+
useFilterRegistration(!isDefault, clearFilter);
|
|
101
110
|
const inPanel = surface === "panel";
|
|
102
111
|
const { labelId, nameProps } = useControlName(label, inSheet || inPanel);
|
|
103
112
|
const draft = useCommittedNumber(value, setValue, { min: field.min, max: field.max });
|
|
@@ -106,6 +115,7 @@ function NumberStepper({
|
|
|
106
115
|
{
|
|
107
116
|
...nameProps,
|
|
108
117
|
size: "ctl",
|
|
118
|
+
...disabled === true && { disabled: true },
|
|
109
119
|
...field.min !== void 0 && { min: field.min },
|
|
110
120
|
...field.max !== void 0 && { max: field.max },
|
|
111
121
|
...field.int && { allowDecimal: false },
|
|
@@ -138,12 +148,13 @@ function NumberStepper({
|
|
|
138
148
|
label: field.options.find((option) => option.value === String(value))?.label ?? String(value),
|
|
139
149
|
numeric: true,
|
|
140
150
|
active: !isDefault,
|
|
151
|
+
...disabled === true && { disabled: true },
|
|
141
152
|
...icon !== void 0 && { icon },
|
|
142
153
|
...className !== void 0 && { className },
|
|
143
154
|
...style !== void 0 && { style },
|
|
144
155
|
children: /* @__PURE__ */ jsxs("div", { className: classes.optionList, children: [
|
|
145
156
|
input,
|
|
146
|
-
clearable === true && !isDefault && /* @__PURE__ */ jsx(FilterClearButton, { onClear:
|
|
157
|
+
clearable === true && !isDefault && /* @__PURE__ */ jsx(FilterClearButton, { onClear: clearFilter })
|
|
147
158
|
] })
|
|
148
159
|
}
|
|
149
160
|
);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ReactNode, RefObject } from 'react';
|
|
2
2
|
import type { BasaltProps } from '../common/props.js';
|
|
3
|
+
import type { FilterOption } from './filter-base.js';
|
|
3
4
|
/**
|
|
4
5
|
* Past three options a panel row's choice is a `Select`, not a track. Same arithmetic as
|
|
5
6
|
* `ViewTabs`' phone form, against the aside's ~300px rather than a phone's: a four-segment track at
|
|
@@ -44,12 +45,6 @@ export type PanelRowProps = BasaltProps & {
|
|
|
44
45
|
readonly children?: ReactNode;
|
|
45
46
|
};
|
|
46
47
|
export declare function PanelRow({ label, hint, readout, end, disabled, labelId, htmlFor, children, className, style, }: PanelRowProps): ReactNode;
|
|
47
|
-
/** One option as both surfaces render it — `disabled` is the `SegmentedControl` half. */
|
|
48
|
-
export type PanelChoiceOption = {
|
|
49
|
-
readonly value: string;
|
|
50
|
-
readonly label: string;
|
|
51
|
-
readonly disabled?: boolean;
|
|
52
|
-
};
|
|
53
48
|
export type PanelChoiceProps = {
|
|
54
49
|
/** The control's accessible name, as `useControlName` resolved it for this surface. */
|
|
55
50
|
readonly nameProps: {
|
|
@@ -58,7 +53,9 @@ export type PanelChoiceProps = {
|
|
|
58
53
|
'aria-label': string;
|
|
59
54
|
};
|
|
60
55
|
readonly value: string;
|
|
61
|
-
readonly options: readonly
|
|
56
|
+
readonly options: readonly FilterOption[];
|
|
57
|
+
/** The whole control is inert. */
|
|
58
|
+
readonly disabled?: boolean;
|
|
62
59
|
/** Numeric labels (`7d` / `30d`) get the mono treatment `segmented-control.module.css` owns. */
|
|
63
60
|
readonly numeric?: boolean;
|
|
64
61
|
readonly onChange: (next: string) => void;
|
|
@@ -128,5 +125,5 @@ export declare function useTrackFits(countFits: boolean, dataKey: string): {
|
|
|
128
125
|
* the geometry of a ~300px column, which is a property of the ROW, not of any one filter, so it
|
|
129
126
|
* belongs beside the row that imposes it.
|
|
130
127
|
*/
|
|
131
|
-
export declare function PanelChoice({ nameProps, value, options, numeric, onChange, }: PanelChoiceProps): ReactNode;
|
|
128
|
+
export declare function PanelChoice({ nameProps, value, options, numeric, disabled, onChange, }: PanelChoiceProps): ReactNode;
|
|
132
129
|
//# sourceMappingURL=panel-row.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"panel-row.d.ts","sourceRoot":"","sources":["../../src/controls/panel-row.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"panel-row.d.ts","sourceRoot":"","sources":["../../src/controls/panel-row.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAGlD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAGjD;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,IAAI,CAAA;AAEhC,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG;IACxC,8EAA8E;IAC9E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,6FAA6F;IAC7F,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IACtB;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAA;IAC5B;;;OAGG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,SAAS,CAAA;IACxB,2FAA2F;IAC3F,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,gFAAgF;IAChF,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;CAC9B,CAAA;AAED,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,IAAI,EACJ,OAAO,EACP,GAAG,EACH,QAAQ,EACR,OAAO,EACP,OAAO,EACP,QAAQ,EACR,SAAS,EACT,KAAK,GACN,EAAE,aAAa,GAAG,SAAS,CAiC3B;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,uFAAuF;IACvF,QAAQ,CAAC,SAAS,EAAE;QAAE,iBAAiB,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,CAAA;IAC5E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,CAAA;IACzC,kCAAkC;IAClC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAC3B,gGAAgG;IAChG,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAC1C,CAAA;AAyDD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,wBAAgB,YAAY,CAC1B,SAAS,EAAE,OAAO,EAClB,OAAO,EAAE,MAAM,GACd;IAAE,OAAO,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CA0F9D;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,EAC1B,SAAS,EACT,KAAK,EACL,OAAO,EACP,OAAO,EACP,QAAQ,EACR,QAAQ,GACT,EAAE,gBAAgB,GAAG,SAAS,CAmC9B"}
|
|
@@ -129,6 +129,7 @@ function PanelChoice({
|
|
|
129
129
|
value,
|
|
130
130
|
options,
|
|
131
131
|
numeric,
|
|
132
|
+
disabled,
|
|
132
133
|
onChange
|
|
133
134
|
}) {
|
|
134
135
|
const data = options.map((option) => ({
|
|
@@ -147,6 +148,7 @@ function PanelChoice({
|
|
|
147
148
|
fullWidth: true,
|
|
148
149
|
value,
|
|
149
150
|
data,
|
|
151
|
+
...disabled === true && { disabled: true },
|
|
150
152
|
...numeric === true && { "data-numeric": true },
|
|
151
153
|
onChange
|
|
152
154
|
}
|
|
@@ -159,6 +161,7 @@ function PanelChoice({
|
|
|
159
161
|
value,
|
|
160
162
|
allowDeselect: false,
|
|
161
163
|
data,
|
|
164
|
+
...disabled === true && { disabled: true },
|
|
162
165
|
onChange: (next) => {
|
|
163
166
|
if (next !== null) onChange(next);
|
|
164
167
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ComponentType, ReactNode } from 'react';
|
|
2
2
|
import type { FieldHandle } from '../state.js';
|
|
3
3
|
import type { RangeField } from '../state/fields.js';
|
|
4
|
+
import type { FilterBase } from './filter-base.js';
|
|
4
5
|
import type { UncontrolledProps } from './uncontrolled.js';
|
|
5
6
|
/**
|
|
6
7
|
* The contract a custom-range picker satisfies — `basalt-ui/controls-dates`' `DateRangePicker`, or a
|
|
@@ -18,7 +19,9 @@ export type RangeCustomPickerProps = {
|
|
|
18
19
|
}) => void;
|
|
19
20
|
};
|
|
20
21
|
/** Everything about the props that does not depend on the field's `custom` flag. */
|
|
21
|
-
type
|
|
22
|
+
type RangeFilterCommon<P extends string, C extends boolean> = UncontrolledProps & Omit<FilterBase, 'clearable' | 'label'> & {
|
|
23
|
+
/** Sheet-form heading. The pill's own label is the VALUE, which is what a bar reads. @default 'Range' */
|
|
24
|
+
readonly label?: string;
|
|
22
25
|
/**
|
|
23
26
|
* A range handle from either store factory. Generic over the field's `custom` flag so a
|
|
24
27
|
* `field.range({ ... })` WITHOUT `custom` (whose handle is `RangeField<P, false>`, and whose
|
|
@@ -26,20 +29,17 @@ type RangeFilterBase<P extends string, C extends boolean> = UncontrolledProps &
|
|
|
26
29
|
* `boolean` here made the setter contravariantly incompatible and forced one at every call site.
|
|
27
30
|
*/
|
|
28
31
|
readonly field: FieldHandle<RangeField<P, C>>;
|
|
29
|
-
/** Leading pill icon. Defaults to a calendar glyph — a range filter reads as a date control, so
|
|
30
|
-
* the glyph is part of the control's identity, not a per-call-site decision. */
|
|
31
|
-
readonly icon?: ReactNode;
|
|
32
|
-
/** Sheet-form heading. The pill's own label is the VALUE, which is what a bar reads. @default 'Range' */
|
|
33
|
-
readonly label?: string;
|
|
34
|
-
};
|
|
35
|
-
export type RangeFilterProps<P extends string, C extends boolean = boolean> = RangeFilterBase<P, C> & {
|
|
36
|
-
/**
|
|
37
|
-
* Rendered when the field declares `custom: true`. Omitted → presets only, which stays LEGAL
|
|
38
|
-
* (a range that only ever shows presets is a real configuration) but warns once in dev when the
|
|
39
|
-
* field allows a custom window: the affordance is then unreachable, and nothing else says so.
|
|
40
|
-
*/
|
|
41
|
-
readonly customPicker?: ComponentType<RangeCustomPickerProps>;
|
|
42
32
|
};
|
|
33
|
+
/**
|
|
34
|
+
* `customPicker` is REQUIRED exactly when the field is `custom: true` and FORBIDDEN otherwise, so
|
|
35
|
+
* the unreachable-affordance state (a custom window nobody can pick) is a type error instead of a
|
|
36
|
+
* dev warning. A widened handle (`C = boolean`) cannot say which, so it must supply the picker.
|
|
37
|
+
*/
|
|
38
|
+
export type RangeFilterProps<P extends string, C extends boolean = boolean> = RangeFilterCommon<P, C> & ([C] extends [false] ? {
|
|
39
|
+
readonly customPicker?: never;
|
|
40
|
+
} : {
|
|
41
|
+
readonly customPicker: ComponentType<RangeCustomPickerProps>;
|
|
42
|
+
});
|
|
43
43
|
export declare function RangeFilter<P extends string, C extends boolean = boolean>(props: RangeFilterProps<P, C>): ReactNode;
|
|
44
44
|
export {};
|
|
45
45
|
//# sourceMappingURL=range-filter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"range-filter.d.ts","sourceRoot":"","sources":["../../src/controls/range-filter.tsx"],"names":[],"mappings":"
|
|
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,yGAAyG;IACzG,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"}
|
|
@@ -6,33 +6,16 @@ import classes from "./controls.module.css";
|
|
|
6
6
|
import { useFilterRegistration, useFilterSurface } from "./filter-context.js";
|
|
7
7
|
import { FilterPill } from "./filter-pill.js";
|
|
8
8
|
import { CalendarGlyph } from "./glyphs.js";
|
|
9
|
-
import { useControlName } from "./
|
|
9
|
+
import { useControlName } from "./control-name.js";
|
|
10
10
|
import { PanelRow } from "./panel-row.js";
|
|
11
11
|
const VERTICAL_FROM = 5;
|
|
12
12
|
const CUSTOM_ROW_LABEL = "Custom range\u2026";
|
|
13
13
|
const NUMERIC_LABEL = /^\d/;
|
|
14
|
-
const noPickerWarned = /* @__PURE__ */ new Set();
|
|
15
|
-
function warnCustomWithoutPicker(label, unreachable) {
|
|
16
|
-
if (!unreachable || process.env.NODE_ENV === "production" || noPickerWarned.has(label)) return;
|
|
17
|
-
noPickerWarned.add(label);
|
|
18
|
-
console.warn(
|
|
19
|
-
`[basalt-ui] RangeFilter('${label}'): the field declares \`custom: true\` but no \`customPicker\` was injected, so the custom window cannot be reached. Pass \`customPicker={DateRangePicker}\` (\`basalt-ui/controls-dates\`), or drop \`custom: true\` from the field. (dev only)`
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
14
|
function RangeFilter(props) {
|
|
23
15
|
assertRequiredProps("RangeFilter", props, ["field"], {
|
|
24
16
|
field: "bind it to a store field (`store.field.<name>`), never a value/onChange pair."
|
|
25
17
|
});
|
|
26
|
-
const {
|
|
27
|
-
field,
|
|
28
|
-
icon,
|
|
29
|
-
customPicker,
|
|
30
|
-
label = "Range",
|
|
31
|
-
className,
|
|
32
|
-
style
|
|
33
|
-
// One cast, at the one boundary a generic `C` cannot be read through: `C` only ever describes
|
|
34
|
-
// the FIELD's custom flag, and the body handles both.
|
|
35
|
-
} = props;
|
|
18
|
+
const { field, icon, disabled, customPicker: Picker, label = "Range", className, style } = props;
|
|
36
19
|
const [value, setValue] = field.use();
|
|
37
20
|
const surface = useFilterSurface();
|
|
38
21
|
const isDefault = field.isDefault(value);
|
|
@@ -45,8 +28,6 @@ function RangeFilter(props) {
|
|
|
45
28
|
const numeric = presets.length > 0 && presets.every((option) => NUMERIC_LABEL.test(option.label));
|
|
46
29
|
const inSheet = surface === "sheet";
|
|
47
30
|
const inPanel = surface === "panel";
|
|
48
|
-
const Picker = customPicker;
|
|
49
|
-
warnCustomWithoutPicker(label, allowsCustom && Picker === void 0);
|
|
50
31
|
const { labelId, nameProps } = useControlName(label, inSheet || inPanel);
|
|
51
32
|
const [customOpen, setCustomOpen] = useState(value.preset === "custom");
|
|
52
33
|
const seenPreset = useRef(value.preset);
|
|
@@ -55,7 +36,16 @@ function RangeFilter(props) {
|
|
|
55
36
|
seenPreset.current = value.preset;
|
|
56
37
|
setCustomOpen(value.preset === "custom");
|
|
57
38
|
}, [value.preset]);
|
|
58
|
-
const
|
|
39
|
+
const picker = allowsCustom && Picker !== void 0 ? /* @__PURE__ */ jsx(
|
|
40
|
+
Picker,
|
|
41
|
+
{
|
|
42
|
+
value: { from: value.from, to: value.to },
|
|
43
|
+
onChange: ({ from, to }) => {
|
|
44
|
+
if (disabled === true) return;
|
|
45
|
+
setValue({ preset: "custom", from, to });
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
) : null;
|
|
59
49
|
if (inPanel || inSheet) {
|
|
60
50
|
return /* @__PURE__ */ jsxs(
|
|
61
51
|
PanelRow,
|
|
@@ -70,10 +60,11 @@ function RangeFilter(props) {
|
|
|
70
60
|
{
|
|
71
61
|
...nameProps,
|
|
72
62
|
allowDeselect: false,
|
|
63
|
+
...disabled === true && { disabled: true },
|
|
73
64
|
value: customOpen ? "custom" : value.preset,
|
|
74
65
|
data: [
|
|
75
66
|
...presets.map((option) => ({ value: option.value, label: option.label })),
|
|
76
|
-
...
|
|
67
|
+
...picker !== null ? [{ value: "custom", label: CUSTOM_ROW_LABEL }] : []
|
|
77
68
|
],
|
|
78
69
|
onChange: (next) => {
|
|
79
70
|
if (next === null) return;
|
|
@@ -86,15 +77,7 @@ function RangeFilter(props) {
|
|
|
86
77
|
}
|
|
87
78
|
}
|
|
88
79
|
),
|
|
89
|
-
|
|
90
|
-
Picker,
|
|
91
|
-
{
|
|
92
|
-
value: { from: value.from, to: value.to },
|
|
93
|
-
onChange: ({ from, to }) => {
|
|
94
|
-
setValue({ preset: "custom", from, to });
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
)
|
|
80
|
+
customOpen && picker
|
|
98
81
|
]
|
|
99
82
|
}
|
|
100
83
|
);
|
|
@@ -105,6 +88,7 @@ function RangeFilter(props) {
|
|
|
105
88
|
{
|
|
106
89
|
...nameProps,
|
|
107
90
|
size: "ctl",
|
|
91
|
+
...disabled === true && { disabled: true },
|
|
108
92
|
orientation: presets.length >= VERTICAL_FROM ? "vertical" : "horizontal",
|
|
109
93
|
value: value.preset,
|
|
110
94
|
data: presets.map((option) => ({ value: option.value, label: option.label })),
|
|
@@ -114,15 +98,7 @@ function RangeFilter(props) {
|
|
|
114
98
|
}
|
|
115
99
|
}
|
|
116
100
|
),
|
|
117
|
-
|
|
118
|
-
Picker,
|
|
119
|
-
{
|
|
120
|
-
value: { from: value.from, to: value.to },
|
|
121
|
-
onChange: ({ from, to }) => {
|
|
122
|
-
setValue({ preset: "custom", from, to });
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
)
|
|
101
|
+
picker
|
|
126
102
|
] });
|
|
127
103
|
return /* @__PURE__ */ jsx(
|
|
128
104
|
FilterPill,
|
|
@@ -130,6 +106,7 @@ function RangeFilter(props) {
|
|
|
130
106
|
label: rangeLabel(value, options),
|
|
131
107
|
active: !isDefault,
|
|
132
108
|
numeric: numeric && value.preset !== "custom",
|
|
109
|
+
...disabled === true && { disabled: true },
|
|
133
110
|
icon: icon ?? /* @__PURE__ */ jsx(CalendarGlyph, {}),
|
|
134
111
|
...className !== void 0 && { className },
|
|
135
112
|
...style !== void 0 && { style },
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { FieldHandle } from '../state.js';
|
|
3
3
|
import type { StringField } from '../state/fields.js';
|
|
4
|
+
import type { FilterBase } from './filter-base.js';
|
|
4
5
|
import type { UncontrolledProps } from './uncontrolled.js';
|
|
5
|
-
export type SearchFilterProps = UncontrolledProps & {
|
|
6
|
+
export type SearchFilterProps = UncontrolledProps & Omit<FilterBase, 'icon' | 'label' | 'clearable'> & {
|
|
6
7
|
readonly field: FieldHandle<StringField>;
|
|
7
8
|
readonly placeholder?: string;
|
|
8
|
-
/** Sheet-form heading. @default 'Search' */
|
|
9
|
+
/** Sheet-form heading and the accessible name. @default 'Search' */
|
|
9
10
|
readonly label?: string;
|
|
11
|
+
/** The clear button shown while the box holds text. @default true */
|
|
12
|
+
readonly clearable?: boolean;
|
|
10
13
|
};
|
|
11
14
|
export declare function SearchFilter(props: SearchFilterProps): ReactNode;
|
|
12
15
|
//# sourceMappingURL=search-filter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-filter.d.ts","sourceRoot":"","sources":["../../src/controls/search-filter.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"search-filter.d.ts","sourceRoot":"","sources":["../../src/controls/search-filter.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAElD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAI/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAKvD,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,GAC/C,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,GAAG,WAAW,CAAC,GAAG;IACjD,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,WAAW,CAAC,CAAA;IACxC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,oEAAoE;IACpE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,qEAAqE;IACrE,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAC7B,CAAA;AAEH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,CAoFhE"}
|