@stackone/malachite 2.86.0 → 2.88.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 (66) hide show
  1. package/COMPONENTS.md +5 -4
  2. package/dist/components/Accordion.js +206 -179
  3. package/dist/components/Accordion.js.map +1 -1
  4. package/dist/components/Button.js +118 -81
  5. package/dist/components/Button.js.map +1 -1
  6. package/dist/components/Card.js +128 -75
  7. package/dist/components/Card.js.map +1 -1
  8. package/dist/components/Chat/ChatModelPicker.js +70 -67
  9. package/dist/components/Chat/ChatModelPicker.js.map +1 -1
  10. package/dist/components/FilterSearch.js +237 -232
  11. package/dist/components/FilterSearch.js.map +1 -1
  12. package/dist/components/FrameHeader.js +36 -0
  13. package/dist/components/FrameHeader.js.map +1 -0
  14. package/dist/components/LoadingBar.js +5 -5
  15. package/dist/components/LoadingBar.js.map +1 -1
  16. package/dist/components/MultiSelect.js +438 -388
  17. package/dist/components/MultiSelect.js.map +1 -1
  18. package/dist/components/PinnedCornerCap.js +32 -19
  19. package/dist/components/PinnedCornerCap.js.map +1 -1
  20. package/dist/components/QueryInput.js +95 -92
  21. package/dist/components/QueryInput.js.map +1 -1
  22. package/dist/components/SplitButton.js +62 -61
  23. package/dist/components/SplitButton.js.map +1 -1
  24. package/dist/components/Surface.js +98 -94
  25. package/dist/components/Surface.js.map +1 -1
  26. package/dist/components/Table/Table.js +630 -606
  27. package/dist/components/Table/Table.js.map +1 -1
  28. package/dist/components/TimeBarChart/TimeBarChart.js +241 -0
  29. package/dist/components/TimeBarChart/TimeBarChart.js.map +1 -0
  30. package/dist/components/TimeBarChart/TimeBarChartAxes.js +49 -0
  31. package/dist/components/TimeBarChart/TimeBarChartAxes.js.map +1 -0
  32. package/dist/components/TimeBarChart/TimeBarChartBars.js +58 -0
  33. package/dist/components/TimeBarChart/TimeBarChartBars.js.map +1 -0
  34. package/dist/components/TimeBarChart/TimeBarChartLegend.js +29 -0
  35. package/dist/components/TimeBarChart/TimeBarChartLegend.js.map +1 -0
  36. package/dist/components/TimeBarChart/TimeBarChartTable.js +33 -0
  37. package/dist/components/TimeBarChart/TimeBarChartTable.js.map +1 -0
  38. package/dist/components/TimeBarChart/TimeBarChartTooltip.js +77 -0
  39. package/dist/components/TimeBarChart/TimeBarChartTooltip.js.map +1 -0
  40. package/dist/components/TimeBarChart/stackLayout.js +25 -0
  41. package/dist/components/TimeBarChart/stackLayout.js.map +1 -0
  42. package/dist/components/TimeBarChart/timeBuckets.js +133 -0
  43. package/dist/components/TimeBarChart/timeBuckets.js.map +1 -0
  44. package/dist/components/TimeBarChart/tones.js +10 -0
  45. package/dist/components/TimeBarChart/tones.js.map +1 -0
  46. package/dist/components/Tooltip.js +93 -90
  47. package/dist/components/Tooltip.js.map +1 -1
  48. package/dist/components/activeElement.js +5 -1
  49. package/dist/components/activeElement.js.map +1 -1
  50. package/dist/components/dateMath.js +1 -0
  51. package/dist/components/dateMath.js.map +1 -1
  52. package/dist/components/filterSearchModel.js +53 -45
  53. package/dist/components/filterSearchModel.js.map +1 -1
  54. package/dist/components/frameStyles.js +14 -0
  55. package/dist/components/frameStyles.js.map +1 -0
  56. package/dist/components/headerContent.js +10 -0
  57. package/dist/components/headerContent.js.map +1 -0
  58. package/dist/components/useFollowTrigger.js +28 -0
  59. package/dist/components/useFollowTrigger.js.map +1 -0
  60. package/dist/index.d.ts +131 -9
  61. package/dist/index.js +24 -22
  62. package/dist/index.js.map +1 -1
  63. package/dist/tailwind.css.js +1 -1
  64. package/dist/theme.js +340 -340
  65. package/dist/theme.js.map +1 -1
  66. package/package.json +1 -1
@@ -1,38 +1,39 @@
1
- import { jsxs as f, Fragment as B, jsx as l } from "react/jsx-runtime";
2
- import { useId as je, useState as F, useRef as E, useMemo as U, useEffect as X, useCallback as q, useLayoutEffect as we, useInsertionEffect as Ue } from "react";
3
- import { createPortal as Xe } from "react-dom";
4
- import qe from "./CustomIcons/CaretDownIcon.js";
5
- import Be from "./CustomIcons/CheckmarkIcon.js";
6
- import ke from "./CustomIcons/DismissIcon.js";
7
- import Ve from "./CustomIcons/SearchIcon.js";
8
- import Ze from "./Spinner.js";
9
- import { CONTROL_TEXT_SIZE_CLASS as J, CONTROL_TEXT_SIZE as Ke } from "./controlTextSize.js";
10
- import { controlWidthStyle as Qe } from "./controlWidth.js";
11
- import { getTriggerVisual as Ye, DROPDOWN_TRIGGER_ATTR as Je } from "./dropdownTriggerStyle.js";
12
- import { pushEscapeLayer as et } from "./escapeLayers.js";
13
- import { orderSelections as tt, resolveMode as rt, filterRows as Se, searchRows as nt, chipText as it, removeFilter as ot, clearAll as lt, selectAll as at, deselectAll as st, toggleValue as ct } from "./filterSearchModel.js";
14
- import { ensureFilterSearchStyles as dt, FILTER_SEARCH_CLASS as I } from "./filterSearchStyles.js";
15
- import { measureMenuGeometry as pt, MENU_MAX_HEIGHT_PX as ut, MENU_SPECS as O } from "./floatingMenuGeometry.js";
16
- import { FOCUS_RING as ee } from "./focusRing.js";
17
- import { usePopupLayer as mt } from "./overlayLayers.js";
18
- import { useTopLayer as ft } from "./topLayer.js";
19
- import { useLatestRef as ht } from "./useLatestRef.js";
20
- const gt = {
21
- small: `min-h-[var(--malachite-control-height-small,28px)] gap-1 px-2.5 py-[2px] ${J.small} rounded-[var(--malachite-radius-10,10px)]`,
22
- medium: `min-h-[var(--malachite-control-height-medium,32px)] gap-1 px-3 py-[3px] ${J.medium} rounded-xl`,
23
- large: `min-h-[var(--malachite-control-height-large,42px)] gap-1.5 px-4 py-[6px] ${J.large} rounded-[var(--malachite-radius-xxl,14px)]`
24
- }, xt = {
1
+ import { jsxs as f, Fragment as V, jsx as l } from "react/jsx-runtime";
2
+ import { useId as Xe, useState as O, useRef as R, useMemo as H, useEffect as q, useCallback as B, useLayoutEffect as ke, useInsertionEffect as qe } from "react";
3
+ import { createPortal as Be } from "react-dom";
4
+ import Ve from "./CustomIcons/CaretDownIcon.js";
5
+ import Ze from "./CustomIcons/CheckmarkIcon.js";
6
+ import Se from "./CustomIcons/DismissIcon.js";
7
+ import Ke from "./CustomIcons/SearchIcon.js";
8
+ import Qe from "./Spinner.js";
9
+ import { CONTROL_TEXT_SIZE_CLASS as ee, CONTROL_TEXT_SIZE as Ye } from "./controlTextSize.js";
10
+ import { controlWidthStyle as Je } from "./controlWidth.js";
11
+ import { getTriggerVisual as et, DROPDOWN_TRIGGER_ATTR as tt } from "./dropdownTriggerStyle.js";
12
+ import { pushEscapeLayer as rt } from "./escapeLayers.js";
13
+ import { orderSelections as nt, resolveMode as it, openFilterOf as ot, filterRows as Re, searchRows as lt, chipText as at, removeFilter as st, clearAll as ct, selectAll as pt, deselectAll as dt, toggleValue as ut } from "./filterSearchModel.js";
14
+ import { ensureFilterSearchStyles as mt, FILTER_SEARCH_CLASS as D } from "./filterSearchStyles.js";
15
+ import { measureMenuGeometry as ft, MENU_MAX_HEIGHT_PX as ht, MENU_SPECS as P } from "./floatingMenuGeometry.js";
16
+ import { FOCUS_RING as te } from "./focusRing.js";
17
+ import { usePopupLayer as gt } from "./overlayLayers.js";
18
+ import { useTopLayer as xt } from "./topLayer.js";
19
+ import { useFollowTrigger as bt } from "./useFollowTrigger.js";
20
+ import { useLatestRef as vt } from "./useLatestRef.js";
21
+ const yt = {
22
+ small: `min-h-[var(--malachite-control-height-small,28px)] gap-1 px-2.5 py-[2px] ${ee.small} rounded-[var(--malachite-radius-10,10px)]`,
23
+ medium: `min-h-[var(--malachite-control-height-medium,32px)] gap-1 px-3 py-[3px] ${ee.medium} rounded-xl`,
24
+ large: `min-h-[var(--malachite-control-height-large,42px)] gap-1.5 px-4 py-[6px] ${ee.large} rounded-[var(--malachite-radius-xxl,14px)]`
25
+ }, wt = {
25
26
  small: "gap-1",
26
27
  medium: "gap-1",
27
28
  large: "gap-1.5"
28
- }, te = {
29
+ }, re = {
29
30
  resting: "bg-[var(--malachite-tag-default-background,rgba(123,123,123,0.1))] text-[var(--malachite-text-primary,rgb(10,10,10))]",
30
31
  active: "bg-[var(--malachite-accent-background,rgb(0,175,102))] text-[var(--malachite-card-background,rgb(255,255,255))]"
31
- }, bt = 5, re = (i) => !!i && !(i.kind === "item" && i.row.item.disabled), vt = (i, s) => {
32
- for (let g = Math.max(s, 0); g < i.length; g++)
33
- if (re(i[g])) return g;
32
+ }, kt = 5, ne = (i) => !!i && !(i.kind === "item" && i.row.item.disabled), St = (i, h) => {
33
+ for (let a = Math.max(h, 0); a < i.length; a++)
34
+ if (ne(i[a])) return a;
34
35
  return -1;
35
- }, yt = {
36
+ }, Rt = {
36
37
  display: "flex",
37
38
  alignItems: "center",
38
39
  gap: 8,
@@ -45,33 +46,33 @@ const gt = {
45
46
  font: "inherit",
46
47
  cursor: "pointer",
47
48
  minWidth: 0
48
- }, Ee = {
49
+ }, Ce = {
49
50
  borderRadius: 6,
50
51
  padding: "2px 6px",
51
52
  flexShrink: 0,
52
53
  whiteSpace: "nowrap"
53
- }, V = {
54
+ }, Z = {
54
55
  overflow: "hidden",
55
56
  textOverflow: "ellipsis",
56
57
  whiteSpace: "nowrap",
57
58
  minWidth: 0
58
- }, Re = { ...V, marginLeft: "auto", flexShrink: 1 }, Ce = (i) => i.preventDefault(), wt = (i) => {
59
+ }, Ee = { ...Z, marginLeft: "auto", flexShrink: 1 }, Ne = (i) => i.preventDefault(), Ct = (i) => {
59
60
  i.preventDefault(), i.stopPropagation();
60
- }, kt = ({ row: i, showFilter: s }) => {
61
+ }, Et = ({ row: i, showFilter: h }) => {
61
62
  if (i.kind === "filter")
62
- return /* @__PURE__ */ f(B, { children: [
63
- /* @__PURE__ */ l("span", { className: I.pill, style: Ee, children: i.filter.label }),
64
- i.filter.info && /* @__PURE__ */ l("span", { style: V, children: i.filter.info }),
65
- i.filter.example && /* @__PURE__ */ l("span", { className: I.hint, style: Re, children: i.filter.example })
63
+ return /* @__PURE__ */ f(V, { children: [
64
+ /* @__PURE__ */ l("span", { className: D.pill, style: Ce, children: i.filter.label }),
65
+ i.filter.info && /* @__PURE__ */ l("span", { style: Z, children: i.filter.info }),
66
+ i.filter.example && /* @__PURE__ */ l("span", { className: D.hint, style: Ee, children: i.filter.example })
66
67
  ] });
67
68
  if (i.kind === "toggle")
68
69
  return /* @__PURE__ */ l("span", { style: { color: "var(--malachite-text-primary, rgb(10, 10, 10))" }, children: i.toggle === "select" ? "Select All" : "Deselect All" });
69
- const { item: g, filter: R, selected: Z } = i.row;
70
- return /* @__PURE__ */ f(B, { children: [
71
- s && /* @__PURE__ */ l("span", { className: I.pill, style: Ee, children: R.label }),
72
- /* @__PURE__ */ l("span", { style: V, children: g.label }),
73
- Z ? /* @__PURE__ */ l(
74
- Be,
70
+ const { item: a, filter: T, selected: L } = i.row;
71
+ return /* @__PURE__ */ f(V, { children: [
72
+ h && /* @__PURE__ */ l("span", { className: D.pill, style: Ce, children: T.label }),
73
+ /* @__PURE__ */ l("span", { style: Z, children: a.label }),
74
+ L ? /* @__PURE__ */ l(
75
+ Ze,
75
76
  {
76
77
  size: 16,
77
78
  style: {
@@ -80,34 +81,35 @@ const gt = {
80
81
  color: "var(--malachite-accent-background, rgb(0, 175, 102))"
81
82
  }
82
83
  }
83
- ) : s && R.info && /* @__PURE__ */ l("span", { className: I.hint, style: Re, children: R.info })
84
+ ) : h && T.info && /* @__PURE__ */ l("span", { className: D.hint, style: Ee, children: T.info })
84
85
  ] });
85
- }, Gt = ({
86
+ }, Bt = ({
86
87
  filters: i,
87
- value: s,
88
- onChange: g,
89
- onClear: R,
90
- onActiveFilterChange: Z,
88
+ searchFilters: h,
89
+ value: a,
90
+ onChange: T,
91
+ onClear: L,
92
+ onActiveFilterChange: Ie,
91
93
  placeholder: K = "Search",
92
94
  size: Q = "medium",
93
- width: Ne,
94
- loading: p = !1,
95
+ width: De,
96
+ loading: d = !1,
95
97
  disabled: u = !1,
96
- clearable: Ie = !1,
97
- maxVisibleChips: De = 4,
98
- className: Ae = "",
98
+ clearable: Te = !1,
99
+ maxVisibleChips: Ae = 4,
100
+ className: $e = "",
99
101
  style: Le,
100
- id: Te,
101
- "aria-label": ne,
102
- "aria-labelledby": ie
102
+ id: Me,
103
+ "aria-label": ie,
104
+ "aria-labelledby": oe
103
105
  }) => {
104
- var ye;
105
- const oe = je(), le = `${oe}-listbox`, ae = (e) => `${oe}-option-${e}`, [a, Y] = F(!1), [x, y] = F(""), [c, $e] = F(null), [se, m] = F(0), [d, ce] = F(null), D = E(null), T = E(null), w = E(null), H = E(null), de = E([]);
106
- ft(w, a);
107
- const Me = mt("multiselect", a, w), pe = E(/* @__PURE__ */ new Map()), $ = U(() => {
106
+ var we;
107
+ const le = Xe(), ae = `${le}-listbox`, se = (e) => `${le}-option-${e}`, [s, Y] = O(!1), [x, y] = O(""), [c, _e] = O(null), [ce, m] = O(0), [p, pe] = O(null), C = R(null), M = R(null), w = R(null), z = R(null), de = R([]);
108
+ xt(w, s);
109
+ const Fe = gt("multiselect", s, w), ue = R(/* @__PURE__ */ new Map()), _ = H(() => {
108
110
  var t;
109
- const e = new Map(pe.current);
110
- for (const r of i) {
111
+ const e = new Map(ue.current);
112
+ for (const r of [...h ?? [], ...i]) {
111
113
  const n = ((t = e.get(r.value)) == null ? void 0 : t.items) ?? /* @__PURE__ */ new Map();
112
114
  e.set(r.value, {
113
115
  label: r.label,
@@ -118,54 +120,57 @@ const gt = {
118
120
  });
119
121
  }
120
122
  return e;
121
- }, [i]);
122
- X(() => {
123
- pe.current = $;
124
- }, [$]);
125
- const ue = E([]), M = U(
126
- () => tt(s, ue.current, c),
127
- [s, c]
123
+ }, [i, h]);
124
+ q(() => {
125
+ ue.current = _;
126
+ }, [_]);
127
+ const me = R([]), F = H(
128
+ () => nt(a, me.current, c),
129
+ [a, c]
128
130
  );
129
- X(() => {
130
- ue.current = M;
131
- }, [M]);
132
- const h = rt(c, x), C = i.find((e) => e.value === c), me = E(c), P = ht(Z), k = q(
131
+ q(() => {
132
+ me.current = F;
133
+ }, [F]);
134
+ const g = it(c, x), J = h ?? i, E = H(
135
+ () => ot(c, i, h, a),
136
+ [c, i, h, a]
137
+ ), fe = R(c), W = vt(Ie), k = B(
133
138
  (e) => {
134
139
  var t;
135
- me.current !== e && (me.current = e, $e(e), (t = P.current) == null || t.call(P, e));
140
+ fe.current !== e && (fe.current = e, _e(e), (t = W.current) == null || t.call(W, e));
136
141
  },
137
- [P]
138
- ), b = U(() => {
139
- if (p) return [];
140
- if (h === "filters") return i.map((r) => ({ kind: "filter", filter: r }));
141
- const { toggle: e, items: t } = h === "items" ? Se(C, s, x) : nt(i, s, x);
142
+ [W]
143
+ ), b = H(() => {
144
+ if (d) return [];
145
+ if (g === "filters") return i.map((r) => ({ kind: "filter", filter: r }));
146
+ const { toggle: e, items: t } = g === "items" ? Re(E, a, x) : lt(J, a, x);
142
147
  return [
143
148
  ...e ? [{ kind: "toggle", toggle: e }] : [],
144
149
  ...t.map((r) => ({ kind: "item", row: r }))
145
150
  ];
146
- }, [p, h, i, C, s, x]), z = U(() => {
147
- const e = new Map(s.map((n) => [n.filter, n.items])), t = (n) => {
148
- const o = $.get(n), v = e.get(n);
151
+ }, [d, g, i, J, E, a, x]), G = H(() => {
152
+ const e = new Map(a.map((n) => [n.filter, n.items])), t = (n) => {
153
+ const o = _.get(n), v = e.get(n);
149
154
  if (!v)
150
155
  return n === c ? [{ filter: n, text: (o == null ? void 0 : o.label) ?? n }] : [];
151
- if (!o && p) return [];
152
- const N = v.map((S) => (o == null ? void 0 : o.items.get(S)) ?? S);
153
- return [{ filter: n, text: it((o == null ? void 0 : o.label) ?? n, N) }];
154
- }, r = c !== null && !M.includes(c);
155
- return [...M, ...r ? [c] : []].flatMap(t);
156
- }, [M, s, $, p, c]), fe = z.slice(0, De), he = z.length - fe.length, W = q(
156
+ if (!o && d) return [];
157
+ const I = v.map((S) => (o == null ? void 0 : o.items.get(S)) ?? S);
158
+ return [{ filter: n, text: at((o == null ? void 0 : o.label) ?? n, I) }];
159
+ }, r = c !== null && !F.includes(c);
160
+ return [...F, ...r ? [c] : []].flatMap(t);
161
+ }, [F, a, _, d, c]), he = G.slice(0, Ae), ge = G.length - he.length, j = B(
157
162
  ({ next: e, changes: t }) => {
158
- t.length > 0 && g(e, t);
163
+ t.length > 0 && T(e, t);
159
164
  },
160
- [g]
161
- ), A = q(() => {
162
- Y(!1), y(""), k(null), ce(null);
163
- }, [k]), G = () => {
164
- u || a || (m(0), Y(!0));
165
- }, _ = q(() => {
166
- const e = D.current;
167
- e && ce(
168
- pt(w.current, {
165
+ [T]
166
+ ), N = B(() => {
167
+ Y(!1), y(""), k(null), pe(null);
168
+ }, [k]), U = () => {
169
+ u || s || (m(0), Y(!0));
170
+ }, A = B(() => {
171
+ const e = C.current;
172
+ e && pe(
173
+ ft(w.current, {
169
174
  triggerRect: e.getBoundingClientRect(),
170
175
  preset: "standard",
171
176
  viewportWidth: window.innerWidth,
@@ -173,158 +178,158 @@ const gt = {
173
178
  })
174
179
  );
175
180
  }, []);
176
- X(() => {
177
- u && a && A();
178
- }, [u, a, A]), X(() => {
179
- if (!a) return;
181
+ bt(s, C, A, N), q(() => {
182
+ u && s && N();
183
+ }, [u, s, N]), q(() => {
184
+ if (!s) return;
180
185
  const e = (o) => {
181
- const v = o.composedPath(), N = D.current, S = w.current;
182
- (!N || !v.includes(N)) && (!S || !v.includes(S)) && A();
186
+ const v = o.composedPath(), I = C.current, S = w.current;
187
+ (!I || !v.includes(I)) && (!S || !v.includes(S)) && N();
183
188
  };
184
189
  let t = null;
185
190
  const r = () => {
186
191
  t === null && (t = requestAnimationFrame(() => {
187
- t = null, _();
192
+ t = null, A();
188
193
  }));
189
- }, n = et(A);
190
- return document.addEventListener("mousedown", e), window.addEventListener("scroll", r, !0), window.addEventListener("resize", r), () => {
191
- document.removeEventListener("mousedown", e), window.removeEventListener("scroll", r, !0), window.removeEventListener("resize", r), t !== null && cancelAnimationFrame(t), n();
194
+ }, n = rt(N);
195
+ return document.addEventListener("mousedown", e), window.addEventListener("resize", r), () => {
196
+ document.removeEventListener("mousedown", e), window.removeEventListener("resize", r), t !== null && cancelAnimationFrame(t), n();
192
197
  };
193
- }, [a, A, _]), we(() => {
194
- if (!a || (_(), typeof ResizeObserver > "u")) return;
195
- const e = new ResizeObserver(() => _());
196
- return w.current && e.observe(w.current), D.current && e.observe(D.current), () => e.disconnect();
197
- }, [a, _]), we(() => {
198
- H.current && (H.current.scrollTop = 0);
199
- }, [h, c, x]), Ue(() => {
200
- a && dt();
201
- }, [a]);
202
- const ge = (e) => {
198
+ }, [s, N, A]), ke(() => {
199
+ if (!s || (A(), typeof ResizeObserver > "u")) return;
200
+ const e = new ResizeObserver(() => A());
201
+ return w.current && e.observe(w.current), C.current && e.observe(C.current), () => e.disconnect();
202
+ }, [s, A]), ke(() => {
203
+ z.current && (z.current.scrollTop = 0);
204
+ }, [g, c, x]), qe(() => {
205
+ s && mt();
206
+ }, [s]);
207
+ const xe = (e) => {
203
208
  requestAnimationFrame(() => {
204
- const t = de.current[e], r = H.current;
209
+ const t = de.current[e], r = z.current;
205
210
  if (!t || !r) return;
206
211
  const n = t.offsetTop, o = n + t.offsetHeight;
207
212
  o > r.scrollTop + r.clientHeight ? r.scrollTop = o - r.clientHeight : n < r.scrollTop && (r.scrollTop = n);
208
213
  });
209
- }, xe = (e) => {
214
+ }, be = (e) => {
210
215
  if (e.kind === "filter") {
211
216
  k(e.filter.value), y(""), m(0);
212
217
  return;
213
218
  }
214
219
  if (e.kind === "toggle") {
215
- const j = h === "items" && C ? [C] : i;
216
- W(
217
- e.toggle === "select" ? at(j, s, x) : st(j, s, x)
220
+ const X = g === "items" && E ? [E] : J;
221
+ j(
222
+ e.toggle === "select" ? pt(X, a, x) : dt(X, a, x)
218
223
  ), y(""), m(0);
219
224
  return;
220
225
  }
221
226
  const { item: t, filter: r } = e.row;
222
227
  if (t.disabled) return;
223
- const n = ct(s, r.value, t.value);
224
- if (W(n), y(""), h !== "items") {
228
+ const n = ut(a, r.value, t.value);
229
+ if (j(n), y(""), g !== "items") {
225
230
  m(0);
226
231
  return;
227
232
  }
228
- const { toggle: o, items: v } = Se(r, n.next, ""), N = v.findIndex((j) => j.item.value === t.value), S = N < 0 ? 0 : N + (o ? 1 : 0);
229
- m(S), ge(S);
230
- }, _e = (e) => {
233
+ const { toggle: o, items: v } = Re(r, n.next, ""), I = v.findIndex((X) => X.item.value === t.value), S = I < 0 ? 0 : I + (o ? 1 : 0);
234
+ m(S), xe(S);
235
+ }, Oe = (e) => {
231
236
  if (b.length === 0) return;
232
- let t = L < 0 ? se : L;
237
+ let t = $ < 0 ? ce : $;
233
238
  for (let r = 0; r < b.length; r++)
234
- if (t = (t + e + b.length) % b.length, re(b[t])) {
235
- m(t), ge(t);
239
+ if (t = (t + e + b.length) % b.length, ne(b[t])) {
240
+ m(t), xe(t);
236
241
  return;
237
242
  }
238
- }, be = (e) => {
239
- e === c && k(null), W(ot(s, e));
240
- }, Fe = (e) => {
243
+ }, ve = (e) => {
244
+ e === c && k(null), j(st(a, e));
245
+ }, He = (e) => {
241
246
  var t;
242
- u || p || (k(e), y(""), m(0), Y(!0), (t = T.current) == null || t.focus());
243
- }, Oe = (e) => {
247
+ u || d || (k(e), y(""), m(0), Y(!0), (t = M.current) == null || t.focus());
248
+ }, Pe = (e) => {
244
249
  if (!(e.nativeEvent.isComposing || e.nativeEvent.keyCode === 229))
245
250
  switch (e.key) {
246
251
  case "ArrowDown":
247
252
  case "ArrowUp": {
248
- if (e.preventDefault(), !a) {
249
- G();
253
+ if (e.preventDefault(), !s) {
254
+ U();
250
255
  return;
251
256
  }
252
- _e(e.key === "ArrowDown" ? 1 : -1);
257
+ Oe(e.key === "ArrowDown" ? 1 : -1);
253
258
  return;
254
259
  }
255
260
  case "Enter": {
256
- if (e.preventDefault(), !a) {
257
- G();
261
+ if (e.preventDefault(), !s) {
262
+ U();
258
263
  return;
259
264
  }
260
- const t = b[L];
261
- re(t) && xe(t);
265
+ const t = b[$];
266
+ ne(t) && be(t);
262
267
  return;
263
268
  }
264
269
  case "Backspace": {
265
270
  if (x !== "") return;
266
- if (c !== null && !s.some((o) => o.filter === c)) {
271
+ if (c !== null && !a.some((o) => o.filter === c)) {
267
272
  e.preventDefault(), k(null), m(0);
268
273
  return;
269
274
  }
270
- const r = z.filter((o) => s.some((v) => v.filter === o.filter)), n = r[r.length - 1];
275
+ const r = G.filter((o) => a.some((v) => v.filter === o.filter)), n = r[r.length - 1];
271
276
  if (!n) return;
272
- e.preventDefault(), be(n.filter);
277
+ e.preventDefault(), ve(n.filter);
273
278
  return;
274
279
  }
275
280
  }
276
- }, He = (e) => {
277
- e.stopPropagation(), W(lt(s)), k(null), y(""), R == null || R();
278
- }, Pe = () => {
281
+ }, ze = (e) => {
282
+ e.stopPropagation(), j(ct(a)), k(null), y(""), L == null || L();
283
+ }, We = () => {
279
284
  k(null), y(""), m(0);
280
- }, ve = Ie && s.length > 0 && !u && !p, L = a ? vt(b, se) : -1, ze = Ye({ disabled: u, open: a }), We = h === "filters" ? "No filters available" : "No matching values", Ge = {
285
+ }, ye = Te && a.length > 0 && !u && !d, $ = s ? St(b, ce) : -1, Ge = et({ disabled: u, open: s }), je = g === "filters" ? "No filters available" : "No matching values", Ue = {
281
286
  position: "fixed",
282
- top: (d == null ? void 0 : d.top) ?? 0,
283
- left: (d == null ? void 0 : d.left) ?? 0,
284
- width: d == null ? void 0 : d.width,
285
- background: O.standard.background,
286
- border: O.standard.border,
287
- borderRadius: O.standard.radius,
288
- boxShadow: O.standard.shadow,
289
- padding: O.standard.padding,
287
+ top: (p == null ? void 0 : p.top) ?? 0,
288
+ left: (p == null ? void 0 : p.left) ?? 0,
289
+ width: p == null ? void 0 : p.width,
290
+ background: P.standard.background,
291
+ border: P.standard.border,
292
+ borderRadius: P.standard.radius,
293
+ boxShadow: P.standard.shadow,
294
+ padding: P.standard.padding,
290
295
  display: "flex",
291
296
  flexDirection: "column",
292
297
  gap: 4,
293
- maxHeight: (d == null ? void 0 : d.maxHeight) ?? ut,
294
- fontSize: Ke[Q],
295
- visibility: d ? "visible" : "hidden",
296
- opacity: d ? 1 : 0
298
+ maxHeight: (p == null ? void 0 : p.maxHeight) ?? ht,
299
+ fontSize: Ye[Q],
300
+ visibility: p ? "visible" : "hidden",
301
+ opacity: p ? 1 : 0
297
302
  };
298
- return /* @__PURE__ */ f(B, { children: [
303
+ return /* @__PURE__ */ f(V, { children: [
299
304
  /* @__PURE__ */ f(
300
305
  "div",
301
306
  {
302
- className: `relative min-w-0 ${Ae}`,
303
- style: { ...Qe(Ne), ...Le },
307
+ className: `relative min-w-0 ${$e}`,
308
+ style: { ...Je(De), ...Le },
304
309
  children: [
305
310
  /* @__PURE__ */ f(
306
311
  "div",
307
312
  {
308
- ref: D,
309
- [Je]: "",
310
- "data-open": a || void 0,
313
+ ref: C,
314
+ [tt]: "",
315
+ "data-open": s || void 0,
311
316
  onBlur: (e) => {
312
317
  var r, n;
313
318
  const t = e.relatedTarget;
314
- t && ((r = D.current) != null && r.contains(t) || (n = w.current) != null && n.contains(t)) || A();
319
+ t && ((r = C.current) != null && r.contains(t) || (n = w.current) != null && n.contains(t)) || N();
315
320
  },
316
321
  onMouseDown: (e) => {
317
322
  var t;
318
- u || (e.target !== T.current && e.preventDefault(), (t = T.current) == null || t.focus(), G());
323
+ u || (e.target !== M.current && e.preventDefault(), (t = M.current) == null || t.focus(), U());
319
324
  },
320
325
  style: {
321
326
  transition: "border-color 0.15s ease, box-shadow 0.15s ease",
322
- ...ze
327
+ ...Ge
323
328
  },
324
- className: `w-full min-w-0 flex items-center border border-solid font-normal ${gt[Q]} ${u ? "cursor-not-allowed" : "cursor-text"}`,
329
+ className: `w-full min-w-0 flex items-center border border-solid font-normal ${yt[Q]} ${u ? "cursor-not-allowed" : "cursor-text"}`,
325
330
  children: [
326
331
  /* @__PURE__ */ l(
327
- Ve,
332
+ Ke,
328
333
  {
329
334
  size: 13,
330
335
  className: "shrink-0 mr-1",
@@ -334,15 +339,15 @@ const gt = {
334
339
  /* @__PURE__ */ f(
335
340
  "div",
336
341
  {
337
- className: `flex flex-1 min-w-0 flex-wrap items-center ${xt[Q]} ${ve ? "pr-[18px]" : ""}`,
342
+ className: `flex flex-1 min-w-0 flex-wrap items-center ${wt[Q]} ${ye ? "pr-[18px]" : ""}`,
338
343
  children: [
339
- fe.map((e) => {
340
- const t = a && e.filter === c;
344
+ he.map((e) => {
345
+ const t = s && e.filter === c;
341
346
  return /* @__PURE__ */ f(
342
347
  "span",
343
348
  {
344
- onMouseDown: wt,
345
- className: `inline-flex items-center gap-1 max-w-[max(60px,calc(100%-64px))] min-w-0 h-[22px] pl-1.5 pr-1 rounded-md text-xs ${t ? te.active : te.resting}`,
349
+ onMouseDown: Ct,
350
+ className: `inline-flex items-center gap-1 max-w-[max(60px,calc(100%-64px))] min-w-0 h-[22px] pl-1.5 pr-1 rounded-md text-xs ${t ? re.active : re.resting}`,
346
351
  children: [
347
352
  /* @__PURE__ */ l(
348
353
  "button",
@@ -351,8 +356,8 @@ const gt = {
351
356
  disabled: u,
352
357
  title: e.text,
353
358
  "aria-label": `Edit filter ${e.text}`,
354
- onClick: () => Fe(e.filter),
355
- className: `truncate min-w-0 bg-transparent border-none p-0 text-[length:inherit] text-current ${u || p ? "cursor-default" : "cursor-pointer"} ${ee}`,
359
+ onClick: () => He(e.filter),
360
+ className: `truncate min-w-0 bg-transparent border-none p-0 text-[length:inherit] text-current ${u || d ? "cursor-default" : "cursor-pointer"} ${te}`,
356
361
  children: e.text
357
362
  }
358
363
  ),
@@ -363,10 +368,10 @@ const gt = {
363
368
  "aria-label": `Remove filter ${e.text}`,
364
369
  onClick: (r) => {
365
370
  var n;
366
- r.stopPropagation(), be(e.filter), (n = T.current) == null || n.focus();
371
+ r.stopPropagation(), ve(e.filter), (n = M.current) == null || n.focus();
367
372
  },
368
- className: `flex items-center justify-center shrink-0 bg-transparent border-none p-0 text-current opacity-70 hover:opacity-100 cursor-pointer ${ee}`,
369
- children: /* @__PURE__ */ l(ke, { size: 10 })
373
+ className: `flex items-center justify-center shrink-0 bg-transparent border-none p-0 text-current opacity-70 hover:opacity-100 cursor-pointer ${te}`,
374
+ children: /* @__PURE__ */ l(Se, { size: 10 })
370
375
  }
371
376
  )
372
377
  ]
@@ -374,82 +379,82 @@ const gt = {
374
379
  e.filter
375
380
  );
376
381
  }),
377
- he > 0 && /* @__PURE__ */ f(
382
+ ge > 0 && /* @__PURE__ */ f(
378
383
  "span",
379
384
  {
380
- className: `inline-flex items-center h-[22px] px-1.5 rounded-md text-xs ${te.resting}`,
385
+ className: `inline-flex items-center h-[22px] px-1.5 rounded-md text-xs ${re.resting}`,
381
386
  children: [
382
387
  "+",
383
- he
388
+ ge
384
389
  ]
385
390
  }
386
391
  ),
387
392
  /* @__PURE__ */ l(
388
393
  "input",
389
394
  {
390
- ref: T,
391
- id: Te,
395
+ ref: M,
396
+ id: Me,
392
397
  type: "text",
393
398
  role: "combobox",
394
399
  value: x,
395
400
  disabled: u,
396
- placeholder: z.length === 0 ? K : "",
401
+ placeholder: G.length === 0 ? K : "",
397
402
  autoComplete: "off",
398
403
  spellCheck: !1,
399
- "aria-label": ie ? void 0 : ne ?? K,
400
- "aria-labelledby": ie,
404
+ "aria-label": oe ? void 0 : ie ?? K,
405
+ "aria-labelledby": oe,
401
406
  "aria-haspopup": "listbox",
402
407
  "aria-autocomplete": "list",
403
- "aria-expanded": a,
404
- "aria-controls": a ? le : void 0,
405
- "aria-activedescendant": L >= 0 ? ae(L) : void 0,
406
- "aria-busy": p || void 0,
408
+ "aria-expanded": s,
409
+ "aria-controls": s ? ae : void 0,
410
+ "aria-activedescendant": $ >= 0 ? se($) : void 0,
411
+ "aria-busy": d || void 0,
407
412
  onChange: (e) => {
408
- y(e.target.value), m(0), G();
413
+ y(e.target.value), m(0), U();
409
414
  },
410
- onKeyDown: Oe,
415
+ onKeyDown: Pe,
411
416
  className: "flex-1 min-w-[60px] border-none outline-none bg-transparent p-0 text-[length:inherit] text-[var(--malachite-text-primary,rgb(10,10,10))] placeholder:text-[var(--malachite-text-placeholder,rgb(187,187,187))] disabled:cursor-not-allowed"
412
417
  }
413
418
  )
414
419
  ]
415
420
  }
416
421
  ),
417
- /* @__PURE__ */ l("span", { className: "flex items-center justify-center shrink-0 size-[14px] ml-1", children: p ? /* @__PURE__ */ l(Ze, { size: "xxxsmall" }) : /* @__PURE__ */ l(
418
- qe,
422
+ /* @__PURE__ */ l("span", { className: "flex items-center justify-center shrink-0 size-[14px] ml-1", children: d ? /* @__PURE__ */ l(Qe, { size: "xxxsmall" }) : /* @__PURE__ */ l(
423
+ Ve,
419
424
  {
420
425
  size: 13,
421
426
  style: {
422
- color: a ? "var(--malachite-text-primary, rgb(10, 10, 10))" : "var(--malachite-text-placeholder, rgb(187, 187, 187))",
427
+ color: s ? "var(--malachite-text-primary, rgb(10, 10, 10))" : "var(--malachite-text-placeholder, rgb(187, 187, 187))",
423
428
  transition: "transform 0.2s ease, color 0.2s ease",
424
- transform: a ? "rotate(180deg)" : "rotate(0deg)"
429
+ transform: s ? "rotate(180deg)" : "rotate(0deg)"
425
430
  }
426
431
  }
427
432
  ) })
428
433
  ]
429
434
  }
430
435
  ),
431
- ve && /* @__PURE__ */ l(
436
+ ye && /* @__PURE__ */ l(
432
437
  "button",
433
438
  {
434
439
  type: "button",
435
440
  "aria-label": "Clear filters",
436
- onMouseDown: Ce,
437
- onClick: He,
438
- className: `absolute top-0 bottom-0 right-[30px] flex items-center justify-center px-[2px] bg-transparent border-none text-[var(--malachite-text-placeholder)] hover:text-[var(--malachite-text-primary)] cursor-pointer ${ee}`,
439
- children: /* @__PURE__ */ l(ke, { size: 10 })
441
+ onMouseDown: Ne,
442
+ onClick: ze,
443
+ className: `absolute top-0 bottom-0 right-[30px] flex items-center justify-center px-[2px] bg-transparent border-none text-[var(--malachite-text-placeholder)] hover:text-[var(--malachite-text-primary)] cursor-pointer ${te}`,
444
+ children: /* @__PURE__ */ l(Se, { size: 10 })
440
445
  }
441
446
  )
442
447
  ]
443
448
  }
444
449
  ),
445
- a && Xe(
450
+ s && Be(
446
451
  /* @__PURE__ */ f(
447
452
  "div",
448
453
  {
449
454
  ref: w,
450
- ...Me,
451
- style: Ge,
452
- onMouseDown: Ce,
455
+ ...Fe,
456
+ style: Ue,
457
+ onMouseDown: Ne,
453
458
  children: [
454
459
  /* @__PURE__ */ l(
455
460
  "div",
@@ -461,14 +466,14 @@ const gt = {
461
466
  gap: 4,
462
467
  minWidth: 0
463
468
  },
464
- children: h === "items" ? /* @__PURE__ */ f(B, { children: [
469
+ children: g === "items" ? /* @__PURE__ */ f(V, { children: [
465
470
  /* @__PURE__ */ l(
466
471
  "button",
467
472
  {
468
473
  type: "button",
469
474
  tabIndex: -1,
470
- onClick: Pe,
471
- className: I.crumb,
475
+ onClick: We,
476
+ className: D.crumb,
472
477
  style: {
473
478
  background: "none",
474
479
  border: "none",
@@ -479,19 +484,19 @@ const gt = {
479
484
  children: "Filters"
480
485
  }
481
486
  ),
482
- /* @__PURE__ */ l("span", { style: V, children: `> ${(C == null ? void 0 : C.label) ?? ((ye = $.get(c ?? "")) == null ? void 0 : ye.label) ?? ""}` })
487
+ /* @__PURE__ */ l("span", { style: Z, children: `> ${(E == null ? void 0 : E.label) ?? ((we = _.get(c ?? "")) == null ? void 0 : we.label) ?? ""}` })
483
488
  ] }) : "Filters"
484
489
  }
485
490
  ),
486
491
  /* @__PURE__ */ f(
487
492
  "div",
488
493
  {
489
- ref: H,
490
- id: le,
494
+ ref: z,
495
+ id: ae,
491
496
  role: "listbox",
492
- "aria-multiselectable": h !== "filters",
493
- "aria-label": ne ?? K,
494
- "aria-busy": p || void 0,
497
+ "aria-multiselectable": g !== "filters",
498
+ "aria-label": ie ?? K,
499
+ "aria-busy": d || void 0,
495
500
  style: {
496
501
  display: "flex",
497
502
  flexDirection: "column",
@@ -503,11 +508,11 @@ const gt = {
503
508
  scrollbarWidth: "thin"
504
509
  },
505
510
  children: [
506
- p && Array.from({ length: bt }, (e, t) => /* @__PURE__ */ l(
511
+ d && Array.from({ length: kt }, (e, t) => /* @__PURE__ */ l(
507
512
  "div",
508
513
  {
509
514
  role: "presentation",
510
- className: I.loading,
515
+ className: D.loading,
511
516
  style: {
512
517
  height: 24,
513
518
  margin: "4px 10px",
@@ -517,7 +522,7 @@ const gt = {
517
522
  },
518
523
  t
519
524
  )),
520
- !p && b.length === 0 && /* @__PURE__ */ l(
525
+ !d && b.length === 0 && /* @__PURE__ */ l(
521
526
  "div",
522
527
  {
523
528
  role: "presentation",
@@ -525,7 +530,7 @@ const gt = {
525
530
  padding: "6px 10px",
526
531
  color: "var(--malachite-text-secondary, rgb(123, 123, 123))"
527
532
  },
528
- children: We
533
+ children: je
529
534
  }
530
535
  ),
531
536
  b.map((e, t) => {
@@ -533,7 +538,7 @@ const gt = {
533
538
  return /* @__PURE__ */ l(
534
539
  "button",
535
540
  {
536
- id: ae(t),
541
+ id: se(t),
537
542
  ref: (o) => {
538
543
  de.current[t] = o;
539
544
  },
@@ -542,15 +547,15 @@ const gt = {
542
547
  role: "option",
543
548
  "aria-selected": e.kind === "item" ? e.row.selected : !1,
544
549
  "aria-disabled": n || void 0,
545
- "data-highlighted": t === L,
550
+ "data-highlighted": t === $,
546
551
  "data-disabled": n,
547
- className: I.row,
552
+ className: D.row,
548
553
  onMouseEnter: () => {
549
554
  n || m(t);
550
555
  },
551
- onClick: () => xe(e),
552
- style: yt,
553
- children: /* @__PURE__ */ l(kt, { row: e, showFilter: h === "search" })
556
+ onClick: () => be(e),
557
+ style: Rt,
558
+ children: /* @__PURE__ */ l(Et, { row: e, showFilter: g === "search" })
554
559
  },
555
560
  r
556
561
  );
@@ -566,7 +571,7 @@ const gt = {
566
571
  ] });
567
572
  };
568
573
  export {
569
- Gt as FilterSearch,
570
- Gt as default
574
+ Bt as FilterSearch,
575
+ Bt as default
571
576
  };
572
577
  //# sourceMappingURL=FilterSearch.js.map