basalt-ui 2.13.2 → 2.14.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.
Files changed (143) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/MIGRATING.md +40 -12
  3. package/dist/agent/chat/thread-feed-row.d.ts.map +1 -1
  4. package/dist/agent/chat/thread-feed-row.js +2 -2
  5. package/dist/agent/chat/thread-message.d.ts.map +1 -1
  6. package/dist/agent/chat/thread-message.js +2 -2
  7. package/dist/agent/chat/thread-outcome-card.js +2 -2
  8. package/dist/charts/DualPanel.d.ts.map +1 -1
  9. package/dist/charts/DualPanel.js +1 -0
  10. package/dist/charts/compile.d.ts.map +1 -1
  11. package/dist/charts/compile.js +3 -2
  12. package/dist/charts/cursor.d.ts +10 -6
  13. package/dist/charts/cursor.d.ts.map +1 -1
  14. package/dist/charts/cursor.js +20 -13
  15. package/dist/charts/legend.d.ts +5 -4
  16. package/dist/charts/legend.d.ts.map +1 -1
  17. package/dist/charts/legend.js +3 -3
  18. package/dist/charts/panel.d.ts +2 -0
  19. package/dist/charts/panel.d.ts.map +1 -1
  20. package/dist/charts/panel.js +1 -0
  21. package/dist/commands/notifications/center.d.ts.map +1 -1
  22. package/dist/commands/notifications/center.js +2 -11
  23. package/dist/controls/control-name.d.ts +27 -0
  24. package/dist/controls/control-name.d.ts.map +1 -0
  25. package/dist/controls/control-name.js +11 -0
  26. package/dist/controls/enum-filter.d.ts +3 -6
  27. package/dist/controls/enum-filter.d.ts.map +1 -1
  28. package/dist/controls/enum-filter.js +8 -4
  29. package/dist/controls/filter-base.d.ts +30 -0
  30. package/dist/controls/filter-base.d.ts.map +1 -0
  31. package/dist/controls/filter-base.js +0 -0
  32. package/dist/controls/filter-pill.d.ts +3 -1
  33. package/dist/controls/filter-pill.d.ts.map +1 -1
  34. package/dist/controls/filter-pill.js +2 -0
  35. package/dist/controls/filter-sheet.d.ts +0 -32
  36. package/dist/controls/filter-sheet.d.ts.map +1 -1
  37. package/dist/controls/filter-sheet.js +1 -28
  38. package/dist/controls/glyphs.d.ts +12 -0
  39. package/dist/controls/glyphs.d.ts.map +1 -1
  40. package/dist/controls/glyphs.js +23 -2
  41. package/dist/controls/index.d.ts +2 -1
  42. package/dist/controls/index.d.ts.map +1 -1
  43. package/dist/controls/multi-select-filter.d.ts +8 -3
  44. package/dist/controls/multi-select-filter.d.ts.map +1 -1
  45. package/dist/controls/multi-select-filter.js +27 -10
  46. package/dist/controls/number-filter.d.ts +3 -12
  47. package/dist/controls/number-filter.d.ts.map +1 -1
  48. package/dist/controls/number-filter.js +17 -6
  49. package/dist/controls/panel-row.d.ts +5 -8
  50. package/dist/controls/panel-row.d.ts.map +1 -1
  51. package/dist/controls/panel-row.js +3 -0
  52. package/dist/controls/range-filter.d.ts +14 -14
  53. package/dist/controls/range-filter.d.ts.map +1 -1
  54. package/dist/controls/range-filter.js +18 -41
  55. package/dist/controls/search-filter.d.ts +5 -2
  56. package/dist/controls/search-filter.d.ts.map +1 -1
  57. package/dist/controls/search-filter.js +74 -40
  58. package/dist/controls/select-filter.d.ts +2 -15
  59. package/dist/controls/select-filter.d.ts.map +1 -1
  60. package/dist/controls/sync-button.d.ts +0 -6
  61. package/dist/controls/sync-button.d.ts.map +1 -1
  62. package/dist/controls/sync-button.js +6 -36
  63. package/dist/controls/toggle-filter.d.ts +2 -2
  64. package/dist/controls/toggle-filter.d.ts.map +1 -1
  65. package/dist/controls/toggle-filter.js +3 -2
  66. package/dist/controls/view-tabs.d.ts +3 -4
  67. package/dist/controls/view-tabs.d.ts.map +1 -1
  68. package/dist/controls/view-tabs.js +24 -5
  69. package/dist/format/date.d.ts +43 -10
  70. package/dist/format/date.d.ts.map +1 -1
  71. package/dist/format/date.js +109 -18
  72. package/dist/format/index.d.ts +12 -11
  73. package/dist/format/index.d.ts.map +1 -1
  74. package/dist/format/index.js +11 -2
  75. package/dist/format/measure.d.ts +9 -9
  76. package/dist/format/measure.d.ts.map +1 -1
  77. package/dist/format/measure.js +19 -8
  78. package/dist/format/number.d.ts +35 -27
  79. package/dist/format/number.d.ts.map +1 -1
  80. package/dist/format/number.js +41 -20
  81. package/dist/format/shared.d.ts +38 -7
  82. package/dist/format/shared.d.ts.map +1 -1
  83. package/dist/format/shared.js +61 -13
  84. package/dist/provider/create-router.d.ts +9 -4
  85. package/dist/provider/create-router.d.ts.map +1 -1
  86. package/dist/provider/create-router.js +1 -19
  87. package/dist/provider/error-fallback.module.css +4 -15
  88. package/dist/provider/error-fallback.module.css.d.ts +0 -1
  89. package/dist/provider/fallback.module.css +37 -0
  90. package/dist/provider/fallback.module.css.d.ts +11 -0
  91. package/dist/provider/index.d.ts +13 -1
  92. package/dist/provider/index.d.ts.map +1 -1
  93. package/dist/provider/index.js +10 -1
  94. package/dist/provider/route-defaults.d.ts +10 -0
  95. package/dist/provider/route-defaults.d.ts.map +1 -0
  96. package/dist/provider/route-defaults.js +25 -0
  97. package/dist/provider/route-defaults.module.css +39 -0
  98. package/dist/provider/route-defaults.module.css.d.ts +10 -0
  99. package/llms.txt +35 -14
  100. package/package.json +1 -1
  101. package/src/agent/chat/thread-feed-row.tsx +2 -2
  102. package/src/agent/chat/thread-message.tsx +2 -2
  103. package/src/agent/chat/thread-outcome-card.tsx +2 -2
  104. package/src/charts/DualPanel.tsx +1 -0
  105. package/src/charts/compile.ts +3 -2
  106. package/src/charts/cursor.ts +44 -27
  107. package/src/charts/legend.tsx +9 -6
  108. package/src/charts/panel.tsx +3 -0
  109. package/src/commands/notifications/center.tsx +2 -14
  110. package/src/controls/control-name.ts +33 -0
  111. package/src/controls/enum-filter.tsx +29 -27
  112. package/src/controls/filter-base.ts +31 -0
  113. package/src/controls/filter-pill.tsx +4 -0
  114. package/src/controls/filter-sheet.tsx +0 -56
  115. package/src/controls/glyphs.tsx +45 -2
  116. package/src/controls/index.ts +2 -1
  117. package/src/controls/multi-select-filter.tsx +67 -43
  118. package/src/controls/number-filter.tsx +47 -47
  119. package/src/controls/panel-row.tsx +7 -8
  120. package/src/controls/range-filter.tsx +54 -78
  121. package/src/controls/search-filter.tsx +107 -54
  122. package/src/controls/select-filter.tsx +2 -18
  123. package/src/controls/sync-button.tsx +7 -40
  124. package/src/controls/toggle-filter.tsx +9 -7
  125. package/src/controls/view-tabs.tsx +41 -21
  126. package/src/format/date.ts +189 -36
  127. package/src/format/index.ts +12 -11
  128. package/src/format/measure.ts +29 -18
  129. package/src/format/number.ts +76 -37
  130. package/src/format/shared.ts +116 -25
  131. package/src/provider/create-router.tsx +2 -36
  132. package/src/provider/error-fallback.module.css +4 -15
  133. package/src/provider/error-fallback.module.css.d.ts +0 -1
  134. package/src/provider/fallback.module.css +37 -0
  135. package/src/provider/fallback.module.css.d.ts +11 -0
  136. package/src/provider/index.tsx +25 -1
  137. package/src/provider/route-defaults.module.css +39 -0
  138. package/src/provider/route-defaults.module.css.d.ts +10 -0
  139. package/src/provider/route-defaults.tsx +39 -0
  140. package/dist/agent/chat/relative-time.d.ts +0 -27
  141. package/dist/agent/chat/relative-time.d.ts.map +0 -1
  142. package/dist/agent/chat/relative-time.js +0 -27
  143. package/src/agent/chat/relative-time.ts +0 -55
@@ -1,7 +1,7 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { BasaltProps } from '../common/props.js';
3
3
  import type { FieldOption } from '../state/fields.js';
4
- import type { FilterOption } from './select-filter.js';
4
+ import type { FilterBase, FilterOption } from './filter-base.js';
5
5
  /**
6
6
  * The slice of a `FieldHandle` this body actually binds to, generic over the VALUE rather than over
7
7
  * the field kind. `FieldHandle<EnumField<T>>` satisfies it at `T` and `FieldHandle<StringField>` at
@@ -17,12 +17,9 @@ export type ChoiceHandle<T extends string> = {
17
17
  * of the fallback back over it. See `useFilterRegistration`'s doc for why. */
18
18
  clear(): void;
19
19
  };
20
- export type EnumFilterProps<T extends string> = BasaltProps & {
20
+ export type EnumFilterProps<T extends string> = BasaltProps & FilterBase & {
21
21
  readonly field: ChoiceHandle<T>;
22
22
  readonly label: string;
23
- readonly icon?: ReactNode;
24
- /** Adds a `Clear` action that clears the field — the same `field.clear()` `Reset all` calls. */
25
- readonly clearable?: boolean;
26
23
  /**
27
24
  * Overrides `field.options` at render — a runtime catalogue whose labels carry live data, or the
28
25
  * only row source a `StringField` has. `| undefined` explicitly: an internal component is spread
@@ -39,5 +36,5 @@ export type EnumFilterProps<T extends string> = BasaltProps & {
39
36
  */
40
37
  readonly numeric?: boolean | undefined;
41
38
  };
42
- export declare function EnumFilter<T extends string>({ field, label, icon, clearable, numeric, options: optionsProp, unmatchedLabel, className, style, }: EnumFilterProps<T>): ReactNode;
39
+ export declare function EnumFilter<T extends string>({ field, label, icon, clearable, disabled, numeric, options: optionsProp, unmatchedLabel, className, style, }: EnumFilterProps<T>): ReactNode;
43
40
  //# sourceMappingURL=enum-filter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"enum-filter.d.ts","sourceRoot":"","sources":["../../src/controls/enum-filter.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAMlD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAEnD;;;;;GAKG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,IAAI;IAC3C,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAA;IACpB,QAAQ,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,CAAA;IACxC,GAAG,IAAI,SAAS,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC,CAAA;IACtC,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,CAAA;IACxB;kFAC8E;IAC9E,KAAK,IAAI,IAAI,CAAA;CACd,CAAA;AAED,MAAM,MAAM,eAAe,CAAC,C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AI,SAAS,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC,CAAA;IACtC,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,CAAA;IACxB;kFAC8E;IAC9E,KAAK,IAAI,IAAI,CAAA;CACd,CAAA;AAED,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,MAAM,IAAI,WAAW,GACzD,UAAU,GAAG;IACX,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,CAAA;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,YAAY,EAAE,GAAG,SAAS,CAAA;IACtD;wFACoF;IACpF,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5C;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CACvC,CAAA;AAEH,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,EAC3C,KAAK,EACL,KAAK,EACL,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,OAAO,EACP,OAAO,EAAE,WAAW,EACpB,cAAc,EACd,SAAS,EACT,KAAK,GACN,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,SAAS,CA8FhC"}
@@ -3,13 +3,14 @@ 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
5
  import { FilterClearButton, FilterPill } from "./filter-pill.js";
6
- import { useControlName } from "./filter-sheet.js";
6
+ import { useControlName } from "./control-name.js";
7
7
  import { PanelChoice, PanelRow } from "./panel-row.js";
8
8
  function EnumFilter({
9
9
  field,
10
10
  label,
11
11
  icon,
12
12
  clearable,
13
+ disabled,
13
14
  numeric,
14
15
  options: optionsProp,
15
16
  unmatchedLabel,
@@ -19,9 +20,10 @@ function EnumFilter({
19
20
  const [value, setValue] = field.use();
20
21
  const surface = useFilterSurface();
21
22
  const isDefault = field.isDefault(value);
22
- useFilterRegistration(!isDefault, () => {
23
+ const clearFilter = () => {
23
24
  field.clear();
24
- });
25
+ };
26
+ useFilterRegistration(!isDefault, clearFilter);
25
27
  const options = optionsProp ?? field.options;
26
28
  const selected = options.find((option) => option.value === value);
27
29
  const inSheet = surface === "sheet";
@@ -42,6 +44,7 @@ function EnumFilter({
42
44
  value,
43
45
  options,
44
46
  ...numeric === true && { numeric: true },
47
+ ...disabled === true && { disabled: true },
45
48
  onChange: (next) => {
46
49
  setValue(next);
47
50
  }
@@ -76,7 +79,7 @@ function EnumFilter({
76
79
  },
77
80
  option.value
78
81
  )) }),
79
- clearable === true && !isDefault && /* @__PURE__ */ jsx(FilterClearButton, { onClear: () => field.clear() })
82
+ clearable === true && !isDefault && /* @__PURE__ */ jsx(FilterClearButton, { onClear: clearFilter })
80
83
  ]
81
84
  }
82
85
  )
@@ -87,6 +90,7 @@ function EnumFilter({
87
90
  label: selected?.label ?? unmatchedLabel ?? label,
88
91
  active: !isDefault,
89
92
  ...numeric === true && { numeric: true },
93
+ ...disabled === true && { disabled: true },
90
94
  ...icon !== void 0 && { icon },
91
95
  ...className !== void 0 && { className },
92
96
  ...style !== void 0 && { style },
@@ -0,0 +1,30 @@
1
+ /**
2
+ * The prop and option shapes every filter shares (`docs/CONTROLS-SPEC.md` §3). INTERNAL — the
3
+ * filters re-state their own props from these, so a new member lands on the whole family at once.
4
+ */
5
+ import type { ReactNode } from 'react';
6
+ /**
7
+ * What every filter takes besides its `field`. A filter picks the members that mean something to it
8
+ * (`Omit<FilterBase, 'clearable'>` for a toggle) and tightens `label` to required where no sensible
9
+ * default exists — a store field declares no name of its own, only its VALUES' labels.
10
+ */
11
+ export type FilterBase = {
12
+ /** The popover/sheet heading and the accessible name — never the pill text, which reads the VALUE. */
13
+ readonly label?: string;
14
+ /** Leading pill icon. */
15
+ readonly icon?: ReactNode;
16
+ /** Adds a `Clear` action that clears the field — the same `field.clear()` `Reset all` calls. */
17
+ readonly clearable?: boolean;
18
+ /** Renders the control inert: a pill that will not open, a row that will not edit. */
19
+ readonly disabled?: boolean;
20
+ };
21
+ /**
22
+ * One row of any option list. `disabled` renders the row and refuses the selection — a live
23
+ * catalogue cannot leave an archived value out, because rows already pointing at it still label it.
24
+ */
25
+ export type FilterOption<V extends string | number = string> = {
26
+ readonly value: V;
27
+ readonly label: string;
28
+ readonly disabled?: boolean;
29
+ };
30
+ //# sourceMappingURL=filter-base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-base.d.ts","sourceRoot":"","sources":["../../src/controls/filter-base.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,sGAAsG;IACtG,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,yBAAyB;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAA;IACzB,gGAAgG;IAChG,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;IAC5B,sFAAsF;IACtF,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAC5B,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,IAAI;IAC7D,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAA;IACjB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAC5B,CAAA"}
File without changes
@@ -19,12 +19,14 @@ export type FilterPillProps = BasaltProps & {
19
19
  * where `aria-expanded` (which Mantine's `Popover.Target` supplies) is the correct state.
20
20
  */
21
21
  readonly pressed?: boolean;
22
+ /** Inert: the pill cannot be pressed, so its popover never opens. */
23
+ readonly disabled?: boolean;
22
24
  /** Set by `FilterSet` on its own fold/sheet pills; a filter never passes either of these. */
23
25
  readonly hideGlyph?: boolean;
24
26
  /** `data-shown` — the CSS hook that reveals the `+N` fold pill once folding is needed. */
25
27
  readonly shown?: boolean;
26
28
  };
27
- export declare function FilterPill({ label, icon, active, numeric, children, onClick, ariaLabel, pressed, className, style, hideGlyph, shown, }: FilterPillProps): ReactNode;
29
+ export declare function FilterPill({ label, icon, active, numeric, children, onClick, ariaLabel, pressed, disabled, className, style, hideGlyph, shown, }: FilterPillProps): ReactNode;
28
30
  /**
29
31
  * The popover's `Clear` — one button for `EnumFilter`, `NumberFilter` and `MultiSelectFilter`. Its
30
32
  * 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":"AAiBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAKlD,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG;IAC1C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAA;IACzB,iGAAiG;IACjG,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,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C,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;AAED,wBAAgB,UAAU,CAAC,EACzB,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,CA8D7B;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,GAAG,SAAS,CAa1F"}
@@ -14,6 +14,7 @@ function FilterPill({
14
14
  onClick,
15
15
  ariaLabel,
16
16
  pressed,
17
+ disabled,
17
18
  className,
18
19
  style,
19
20
  hideGlyph,
@@ -34,6 +35,7 @@ function FilterPill({
34
35
  ...ariaLabel !== void 0 && { "aria-label": ariaLabel },
35
36
  ...pressed !== void 0 && children === void 0 && { "aria-pressed": pressed },
36
37
  ...shown === true && { "data-shown": true },
38
+ ...disabled === true && { disabled: true },
37
39
  ...icon !== void 0 && {
38
40
  // `IconSlot` owns the 16px box and the optical centring; `.pillIcon` adds only the pill's
39
41
  // muted-then-ink colour law. A consumer's glyph can no longer set this row's height.
@@ -22,36 +22,4 @@ export type FilterSheetProps = BasaltProps & {
22
22
  * it, a header does not (`docs/CONTROLS-SPEC.md` §2.1: hairlines between OPTION rows only).
23
23
  */
24
24
  export declare function FilterSheet({ opened, onClose, onResetAll, title, children, className, style, }: FilterSheetProps): ReactNode;
25
- /**
26
- * The selected-row mark — 16px, drawn at the row's trailing edge (`docs/CONTROLS-SPEC.md` §2.1).
27
- * Exported from the MODULE, not from `./index.ts`: the panel surface's facet list draws the same
28
- * mark at the same edge, and two hand-drawn checks would drift.
29
- */
30
- export declare function CheckGlyph(): ReactNode;
31
- /**
32
- * Names a control that has no VISIBLE Mantine `label`, and does it differently per surface — which
33
- * is the whole reason this is one helper instead of an `aria-label` sprinkled per call site.
34
- *
35
- * In the SHEET and the PANEL the visible `PanelRow` heading is right there, so the control points
36
- * at it (`aria-labelledby`) and the heading stops being decoration. In the PILL surface there is no
37
- * visible name to point at — the pill text is the VALUE (`EUR`, `30d`, `3 channels`) — so the
38
- * control carries the filter's own name instead. Either way the announced name is what is being
39
- * filtered, not what it currently holds.
40
- *
41
- * The id is generated by the CONTROL, not by `PanelRow`, because the control renders its own
42
- * `PanelRow`: an id published downward through context could never reach the sibling that needs it.
43
- *
44
- * @example
45
- * const { labelId, nameProps } = useControlName(label, inSheet || inPanel)
46
- * <Radio.Group {...nameProps} …/>
47
- * // and, in the sheet/panel branch: <PanelRow label={label} labelId={labelId}>…</PanelRow>
48
- */
49
- export declare function useControlName(label: string, named: boolean): {
50
- labelId: string;
51
- nameProps: {
52
- 'aria-labelledby': string;
53
- } | {
54
- 'aria-label': string;
55
- };
56
- };
57
25
  //# sourceMappingURL=filter-sheet.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"filter-sheet.d.ts","sourceRoot":"","sources":["../../src/controls/filter-sheet.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAGlD,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG;IAC3C,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAA;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAA;IAChC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAA;CAC7B,CAAA;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EACN,OAAO,EACP,UAAU,EACV,KAAiB,EACjB,QAAQ,EACR,SAAS,EACT,KAAK,GACN,EAAE,gBAAgB,GAAG,SAAS,CAwB9B;AAED;;;;GAIG;AACH,wBAAgB,UAAU,IAAI,SAAS,CAgBtC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,OAAO,GACb;IACD,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE;QAAE,iBAAiB,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,CAAA;CACpE,CAMA"}
1
+ {"version":3,"file":"filter-sheet.d.ts","sourceRoot":"","sources":["../../src/controls/filter-sheet.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAGlD,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG;IAC3C,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAA;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAA;IAChC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAA;CAC7B,CAAA;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EACN,OAAO,EACP,UAAU,EACV,KAAiB,EACjB,QAAQ,EACR,SAAS,EACT,KAAK,GACN,EAAE,gBAAgB,GAAG,SAAS,CAwB9B"}
@@ -1,6 +1,5 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Button, Drawer } from "@mantine/core";
3
- import { useId } from "react";
4
3
  import classes from "./controls.module.css";
5
4
  function FilterSheet({
6
5
  opened,
@@ -29,32 +28,6 @@ function FilterSheet({
29
28
  }
30
29
  );
31
30
  }
32
- function CheckGlyph() {
33
- return /* @__PURE__ */ jsx(
34
- "svg",
35
- {
36
- width: 16,
37
- height: 16,
38
- viewBox: "0 0 24 24",
39
- fill: "none",
40
- stroke: "currentColor",
41
- strokeWidth: 2.25,
42
- strokeLinecap: "round",
43
- strokeLinejoin: "round",
44
- "aria-hidden": true,
45
- children: /* @__PURE__ */ jsx("path", { d: "M5 12.5l5 5l9 -11" })
46
- }
47
- );
48
- }
49
- function useControlName(label, named) {
50
- const labelId = useId();
51
- return {
52
- labelId,
53
- nameProps: named ? { "aria-labelledby": labelId } : { "aria-label": label }
54
- };
55
- }
56
31
  export {
57
- CheckGlyph,
58
- FilterSheet,
59
- useControlName
32
+ FilterSheet
60
33
  };
@@ -22,4 +22,16 @@ export declare function FunnelGlyph(): ReactNode;
22
22
  * and shifted with the font stack; the path is centred in its own box.
23
23
  */
24
24
  export declare function UpDownGlyph(): ReactNode;
25
+ /**
26
+ * The selected-row mark — 16px, drawn at the row's trailing edge (`docs/CONTROLS-SPEC.md` §2.1).
27
+ * Shared by the facet list and any other row that marks a selection at its trailing edge, so two
28
+ * hand-drawn checks cannot drift.
29
+ */
30
+ export declare function CheckGlyph(): ReactNode;
31
+ /** `SearchFilter`'s leading icon. */
32
+ export declare function SearchGlyph(): ReactNode;
33
+ /** `SyncButton`'s icon; the caller owns the spin class, which lives in its own stylesheet. */
34
+ export declare function RefreshGlyph({ className }: {
35
+ className?: string | undefined;
36
+ }): ReactNode;
25
37
  //# sourceMappingURL=glyphs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"glyphs.d.ts","sourceRoot":"","sources":["../../src/controls/glyphs.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAwBtC,4CAA4C;AAC5C,wBAAgB,aAAa,IAAI,SAAS,CASzC;AAED,oDAAoD;AACpD,wBAAgB,WAAW,IAAI,SAAS,CAMvC;AAED;;;;GAIG;AACH,wBAAgB,WAAW,IAAI,SAAS,CAOvC"}
1
+ {"version":3,"file":"glyphs.d.ts","sourceRoot":"","sources":["../../src/controls/glyphs.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAmCtC,4CAA4C;AAC5C,wBAAgB,aAAa,IAAI,SAAS,CASzC;AAED,oDAAoD;AACpD,wBAAgB,WAAW,IAAI,SAAS,CAMvC;AAED;;;;GAIG;AACH,wBAAgB,WAAW,IAAI,SAAS,CAOvC;AAED;;;;GAIG;AACH,wBAAgB,UAAU,IAAI,SAAS,CAMtC;AAED,qCAAqC;AACrC,wBAAgB,WAAW,IAAI,SAAS,CAOvC;AAED,8FAA8F;AAC9F,wBAAgB,YAAY,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAAG,SAAS,CAMzF"}
@@ -1,7 +1,12 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  const ICON_SIZE = 16;
3
3
  const AFFORDANCE_SIZE = 14;
4
- function Stroke({ size = ICON_SIZE, children }) {
4
+ function Stroke({
5
+ size = ICON_SIZE,
6
+ strokeWidth = 1.75,
7
+ className,
8
+ children
9
+ }) {
5
10
  return /* @__PURE__ */ jsx(
6
11
  "svg",
7
12
  {
@@ -10,7 +15,8 @@ function Stroke({ size = ICON_SIZE, children }) {
10
15
  viewBox: "0 0 24 24",
11
16
  fill: "none",
12
17
  stroke: "currentColor",
13
- strokeWidth: 1.75,
18
+ strokeWidth,
19
+ ...className !== void 0 && { className },
14
20
  strokeLinecap: "round",
15
21
  strokeLinejoin: "round",
16
22
  "aria-hidden": true,
@@ -35,8 +41,23 @@ function UpDownGlyph() {
35
41
  /* @__PURE__ */ jsx("path", { d: "M8 15l4 4l4 -4" })
36
42
  ] });
37
43
  }
44
+ function CheckGlyph() {
45
+ return /* @__PURE__ */ jsx(Stroke, { strokeWidth: 2.25, children: /* @__PURE__ */ jsx("path", { d: "M5 12.5l5 5l9 -11" }) });
46
+ }
47
+ function SearchGlyph() {
48
+ return /* @__PURE__ */ jsxs(Stroke, { strokeWidth: 2, children: [
49
+ /* @__PURE__ */ jsx("circle", { cx: "11", cy: "11", r: "7" }),
50
+ /* @__PURE__ */ jsx("path", { d: "M21 21l-4.35 -4.35" })
51
+ ] });
52
+ }
53
+ function RefreshGlyph({ className }) {
54
+ return /* @__PURE__ */ jsx(Stroke, { strokeWidth: 2, className, children: /* @__PURE__ */ jsx("path", { d: "M20 11a8 8 0 1 0-2.34 5.66M20 5v6h-6" }) });
55
+ }
38
56
  export {
39
57
  CalendarGlyph,
58
+ CheckGlyph,
40
59
  FunnelGlyph,
60
+ RefreshGlyph,
61
+ SearchGlyph,
41
62
  UpDownGlyph
42
63
  };
@@ -7,12 +7,13 @@
7
7
  export { type BarAction, type GlobalAction } from './actions.js';
8
8
  export { SyncButton } from './sync-button.js';
9
9
  export { FilterSet } from './filter-set.js';
10
- export { RangeFilter } from './range-filter.js';
10
+ export { RangeFilter, type RangeCustomPickerProps } from './range-filter.js';
11
11
  export { SelectFilter } from './select-filter.js';
12
12
  export { MultiSelectFilter } from './multi-select-filter.js';
13
13
  export { NumberFilter } from './number-filter.js';
14
14
  export { SearchFilter } from './search-filter.js';
15
15
  export { ToggleFilter } from './toggle-filter.js';
16
16
  export { ViewTabs } from './view-tabs.js';
17
+ export type { FilterOption } from './filter-base.js';
17
18
  export { FormRow, FormGroup } from './form-layout.js';
18
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/controls/index.ts"],"names":[],"mappings":"AAAA;;;;;GA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;AACtC,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA"}
@@ -1,12 +1,17 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { FieldHandle } from '../state.js';
3
3
  import type { MultiField } from '../state/fields.js';
4
- import type { FilterOption } from './select-filter.js';
4
+ import type { FilterBase, FilterOption } from './filter-base.js';
5
5
  import type { UncontrolledProps } from './uncontrolled.js';
6
- export type MultiSelectFilterProps<T extends string> = UncontrolledProps & {
6
+ export type MultiSelectFilterProps<T extends string> = UncontrolledProps & FilterBase & {
7
7
  readonly field: FieldHandle<MultiField<T>>;
8
8
  readonly label: string;
9
- readonly icon?: ReactNode;
9
+ /**
10
+ * Adds a `Clear` action to the popover. Multi has always shown one.
11
+ *
12
+ * @default true
13
+ */
14
+ readonly clearable?: boolean;
10
15
  /**
11
16
  * The plural noun in the `3 channels` count.
12
17
  *
@@ -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,iBAAiB,CAAA;AAMnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAMvD,MAAM,MAAM,sBAAsB,CAAC,CAAC,SAAS,MAAM,IAAI,iBAAiB,GAAG;IACzE,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA;IAC1C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAA;I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;;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 { CheckGlyph, useControlName } from "./filter-sheet.js";
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 { field, label, icon, noun, counts, max, options: optionsProp, className, style } = props;
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
- useFilterRegistration(!isDefault, () => {
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: () => field.clear() })
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
- /** One row of a numeric preset set. Narrower than `FilterOption` — a preset is never `disabled`:
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 NumberFilterOption[];
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;AAQlD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAEvD;6FAC6F;AAC7F,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,GAAG;IAClD,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,WAAW,CAAC,CAAA;IACxC;yFACqF;IACrF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAA;IACzB,gEAAgE;IAChE,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAA;IAChD;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IACtB;kEAC8D;IAC9D,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAC7B,CAAA;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,CAqChE"}
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 "./filter-sheet.js";
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) => ({ value: String(option.value), label: option.label }));
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
- useFilterRegistration(!isDefault, () => {
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: () => field.clear() })
157
+ clearable === true && !isDefault && /* @__PURE__ */ jsx(FilterClearButton, { onClear: clearFilter })
147
158
  ] })
148
159
  }
149
160
  );