@rafal.lemieszewski/tide-ui 0.88.0 → 0.88.2

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.
@@ -1,21 +1,22 @@
1
- import { jsxs as v, jsx as e, Fragment as ne } from "react/jsx-runtime";
2
- import * as u from "react";
3
- import { cn as D } from "../../lib/utils.js";
4
- import { Button as Q } from "../fundamental/button.js";
5
- import { Input as ee } from "../fundamental/input.js";
6
- import { AutocompleteSearch as he } from "../fundamental/autocomplete-search.js";
7
- import { Icon as H } from "../fundamental/icon.js";
8
- import { ListFilter as xe, X as oe, Pin as se, PinOff as be } from "lucide-react";
9
- import { Checkbox as le } from "../fundamental/checkbox.js";
10
- import { RadioGroup as fe, RadioGroupItem as ie } from "../fundamental/radio-group.js";
11
- import { Select as ge, SelectTrigger as ye, SelectValue as Ne, SelectContent as we, SelectItem as Ce } from "../fundamental/select.js";
12
- import { MonthPicker as Se } from "../fundamental/month-picker.js";
13
- import { Calendar as ke } from "../fundamental/calendar.js";
14
- import { Popover as ce, PopoverTrigger as de, PopoverContent as ue } from "../fundamental/popover.js";
15
- import { Separator as re } from "../fundamental/separator.js";
16
- import { Badge as te } from "../fundamental/badge.js";
17
- import { getPresetLabel as $e, calculatePresetRange as pe, formatDateRange as Ie } from "../../lib/date-utils.js";
18
- const Ae = [
1
+ import { jsxs as v, jsx as e, Fragment as se } from "react/jsx-runtime";
2
+ import * as c from "react";
3
+ import { cn as E } from "../../lib/utils.js";
4
+ import { Button as G } from "../fundamental/button.js";
5
+ import { Input as ae } from "../fundamental/input.js";
6
+ import { AutocompleteSearch as Se } from "../fundamental/autocomplete-search.js";
7
+ import { Icon as _ } from "../fundamental/icon.js";
8
+ import { ListFilter as Ie, X as de, Pin as ue, PinOff as ke } from "lucide-react";
9
+ import { Checkbox as pe } from "../fundamental/checkbox.js";
10
+ import { RadioGroup as $e, RadioGroupItem as me } from "../fundamental/radio-group.js";
11
+ import { Select as Ae, SelectTrigger as De, SelectValue as Me, SelectContent as ze, SelectItem as Ee } from "../fundamental/select.js";
12
+ import { MonthPicker as Le } from "../fundamental/month-picker.js";
13
+ import { Calendar as Re } from "../fundamental/calendar.js";
14
+ import { Popover as ve, PopoverTrigger as he, PopoverContent as xe } from "../fundamental/popover.js";
15
+ import { TooltipProvider as Oe, Tooltip as Pe, TooltipTrigger as Ve, TooltipContent as Fe } from "../fundamental/tooltip.js";
16
+ import { Separator as ne } from "../fundamental/separator.js";
17
+ import { Badge as oe } from "../fundamental/badge.js";
18
+ import { getPresetLabel as Te, calculatePresetRange as be, formatDateRange as je } from "../../lib/date-utils.js";
19
+ const Ke = [
19
20
  "this-month",
20
21
  "last-month",
21
22
  "this-quarter",
@@ -23,7 +24,7 @@ const Ae = [
23
24
  "this-year",
24
25
  "last-year",
25
26
  "custom"
26
- ], ze = [
27
+ ], _e = [
27
28
  "this-week",
28
29
  "last-week",
29
30
  "last-30-days",
@@ -32,288 +33,288 @@ const Ae = [
32
33
  "last-month",
33
34
  "custom"
34
35
  ];
35
- function De(x) {
36
- let r = 0;
36
+ function He(x) {
37
+ let t = 0;
37
38
  if (x.groups)
38
- for (const s of x.groups)
39
- for (const b of s.options)
40
- r++, b.children && (r += b.children.length);
41
- return x.options && (r = x.options.length), r;
39
+ for (const l of x.groups)
40
+ for (const b of l.options)
41
+ t++, b.children && (t += b.children.length);
42
+ return x.options && (t = x.options.length), t;
42
43
  }
43
- const ve = /* @__PURE__ */ u.memo(function({ filter: r, value: s, onChange: b, onReset: g, autoFocusSearch: y = !0 }) {
44
- const [k, A] = u.useState(""), f = u.useDeferredValue(k), [$, M] = u.useState(""), [w, R] = u.useState(""), [I, P] = u.useState(null), [T, E] = u.useState(null), [K, c] = u.useState(!1), [C, S] = u.useState((/* @__PURE__ */ new Date()).getFullYear()), h = u.useMemo(() => s ? Array.isArray(s) ? s.map(String) : [String(s)] : [], [s]);
45
- u.useEffect(() => {
46
- if (r.type === "number" && r.rangeMode) {
47
- const n = s;
44
+ const ge = /* @__PURE__ */ c.memo(function({ filter: t, value: l, onChange: b, onReset: N, autoFocusSearch: w = !0 }) {
45
+ const [k, z] = c.useState(""), g = c.useDeferredValue(k), [A, L] = c.useState(""), [C, V] = c.useState(""), [D, O] = c.useState(null), [F, R] = c.useState(null), [T, d] = c.useState(!1), [S, I] = c.useState((/* @__PURE__ */ new Date()).getFullYear()), h = c.useMemo(() => l ? Array.isArray(l) ? l.map(String) : [String(l)] : [], [l]);
46
+ c.useEffect(() => {
47
+ if (t.type === "number" && t.rangeMode) {
48
+ const n = l;
48
49
  if (Array.isArray(n)) {
49
- const [d, p] = n;
50
- M(d === -1 / 0 ? "" : d?.toString() || ""), R(p === 1 / 0 ? "" : p?.toString() || "");
51
- } else typeof n == "number" ? (M(n.toString()), R("")) : (M(""), R(""));
52
- P(null), E(null);
50
+ const [u, m] = n;
51
+ L(u === -1 / 0 ? "" : u?.toString() || ""), V(m === 1 / 0 ? "" : m?.toString() || "");
52
+ } else typeof n == "number" ? (L(n.toString()), V("")) : (L(""), V(""));
53
+ O(null), R(null);
53
54
  }
54
- }, [s, r.type, r.rangeMode]);
55
- const F = u.useMemo(() => {
56
- const n = r.showSearch ?? "auto";
55
+ }, [l, t.type, t.rangeMode]);
56
+ const j = c.useMemo(() => {
57
+ const n = t.showSearch ?? "auto";
57
58
  if (n === !0) return !0;
58
59
  if (n === !1) return !1;
59
- const d = De(r), p = r.searchThreshold ?? 8;
60
- return d >= p;
61
- }, [r]), B = u.useMemo(() => {
62
- if (r.groups) {
63
- if (!f) return r.groups;
64
- const n = f.toLowerCase();
65
- return r.groups.map((d) => ({
66
- ...d,
67
- options: d.options.filter(
68
- (p) => p.label.toLowerCase().includes(n) || p.children?.some(
69
- (m) => m.label.toLowerCase().includes(n)
60
+ const u = He(t), m = t.searchThreshold ?? 8;
61
+ return u >= m;
62
+ }, [t]), W = c.useMemo(() => {
63
+ if (t.groups) {
64
+ if (!g) return t.groups;
65
+ const n = g.toLowerCase();
66
+ return t.groups.map((u) => ({
67
+ ...u,
68
+ options: u.options.filter(
69
+ (m) => m.label.toLowerCase().includes(n) || m.children?.some(
70
+ (p) => p.label.toLowerCase().includes(n)
70
71
  )
71
72
  )
72
- })).filter((d) => d.options.length > 0);
73
+ })).filter((u) => u.options.length > 0);
73
74
  }
74
- if (r.options) {
75
- const n = f ? r.options.filter(
76
- (d) => d.label.toLowerCase().includes(f.toLowerCase())
77
- ) : r.options;
78
- return n.length > 0 ? [{ label: r.label, options: n }] : [];
75
+ if (t.options) {
76
+ const n = g ? t.options.filter(
77
+ (u) => u.label.toLowerCase().includes(g.toLowerCase())
78
+ ) : t.options;
79
+ return n.length > 0 ? [{ label: t.label, options: n }] : [];
79
80
  }
80
81
  return [];
81
- }, [r.groups, r.options, r.label, f]), Y = (n) => {
82
- if (r.type === "multiselect") {
83
- const d = h.includes(n) ? h.filter((p) => p !== n) : [...h, n];
84
- b(d.length > 0 ? d : void 0);
82
+ }, [t.groups, t.options, t.label, g]), H = (n) => {
83
+ if (t.type === "multiselect") {
84
+ const u = h.includes(n) ? h.filter((m) => m !== n) : [...h, n];
85
+ b(u.length > 0 ? u : void 0);
85
86
  } else
86
87
  b(n === h[0] ? void 0 : n);
88
+ }, Z = (n) => {
89
+ if (t.type !== "multiselect") return;
90
+ const u = n.options.flatMap(
91
+ (p) => [p.value, ...p.children?.map((f) => f.value) || []]
92
+ ), m = h.filter((p) => !u.includes(p));
93
+ b(m.length > 0 ? m : void 0);
87
94
  }, X = (n) => {
88
- if (r.type !== "multiselect") return;
89
- const d = n.options.flatMap(
90
- (m) => [m.value, ...m.children?.map((N) => N.value) || []]
91
- ), p = h.filter((m) => !d.includes(m));
92
- b(p.length > 0 ? p : void 0);
93
- }, q = (n) => {
94
- if (r.type !== "multiselect") return;
95
- const d = n.options.flatMap(
96
- (m) => [m.value, ...m.children?.map((N) => N.value) || []]
97
- ), p = Array.from(/* @__PURE__ */ new Set([...h, ...d]));
98
- b(p.length > 0 ? p : void 0);
99
- }, J = (n) => {
100
- if (r.type !== "multiselect") return;
101
- const p = n.options.filter((O) => !k || O.label.toLowerCase().includes(k.toLowerCase())).flatMap((O) => {
102
- const W = O.value, t = O.children?.filter(
103
- (a) => !k || a.label.toLowerCase().includes(k.toLowerCase())
104
- ).map((a) => a.value) || [];
105
- return [W, ...t];
106
- }), m = h.filter((O) => !p.includes(O)), N = p.filter((O) => !h.includes(O)), G = [...m, ...N];
107
- b(G.length > 0 ? G : void 0);
108
- }, _ = () => {
109
- const n = $.trim(), d = w.trim();
110
- if (P(null), E(null), n === "" && d === "") {
95
+ if (t.type !== "multiselect") return;
96
+ const u = n.options.flatMap(
97
+ (p) => [p.value, ...p.children?.map((f) => f.value) || []]
98
+ ), m = Array.from(/* @__PURE__ */ new Set([...h, ...u]));
99
+ b(m.length > 0 ? m : void 0);
100
+ }, ee = (n) => {
101
+ if (t.type !== "multiselect") return;
102
+ const m = n.options.filter((P) => !k || P.label.toLowerCase().includes(k.toLowerCase())).flatMap((P) => {
103
+ const re = P.value, K = P.children?.filter(
104
+ (q) => !k || q.label.toLowerCase().includes(k.toLowerCase())
105
+ ).map((q) => q.value) || [];
106
+ return [re, ...K];
107
+ }), p = h.filter((P) => !m.includes(P)), f = m.filter((P) => !h.includes(P)), J = [...p, ...f];
108
+ b(J.length > 0 ? J : void 0);
109
+ }, B = () => {
110
+ const n = A.trim(), u = C.trim();
111
+ if (O(null), R(null), n === "" && u === "") {
111
112
  b(void 0);
112
113
  return;
113
114
  }
114
- const p = n === "" ? -1 / 0 : parseFloat(n), m = d === "" ? 1 / 0 : parseFloat(d);
115
- if (n !== "" && isNaN(p)) {
116
- P("Invalid minimum value");
115
+ const m = n === "" ? -1 / 0 : parseFloat(n), p = u === "" ? 1 / 0 : parseFloat(u);
116
+ if (n !== "" && isNaN(m)) {
117
+ O("Invalid minimum value");
117
118
  return;
118
119
  }
119
- if (d !== "" && isNaN(m)) {
120
- E("Invalid maximum value");
120
+ if (u !== "" && isNaN(p)) {
121
+ R("Invalid maximum value");
121
122
  return;
122
123
  }
123
- if (p !== -1 / 0 && m !== 1 / 0 && p > m) {
124
- P("Minimum must be less than maximum"), E("Maximum must be more than minimum");
124
+ if (m !== -1 / 0 && p !== 1 / 0 && m > p) {
125
+ O("Minimum must be less than maximum"), R("Maximum must be more than minimum");
125
126
  return;
126
127
  }
127
- b([p, m]);
128
- }, j = r.dateConfig?.granularity || "month", U = () => r.dateConfig?.presets ? r.dateConfig.presets : j === "day" ? ze : Ae, Z = () => {
129
- if (K)
128
+ b([m, p]);
129
+ }, Y = t.dateConfig?.granularity || "month", U = () => t.dateConfig?.presets ? t.dateConfig.presets : Y === "day" ? _e : Ke, Q = () => {
130
+ if (T)
130
131
  return "custom";
131
- const n = s;
132
+ const n = l;
132
133
  if (!n || !Array.isArray(n))
133
134
  return U().includes("all-time") ? "all-time" : "";
134
- for (const d of U()) {
135
- if (d === "custom") continue;
136
- const p = pe(d);
137
- if (p && p[0].getTime() === n[0].getTime() && p[1].getTime() === n[1].getTime())
138
- return d;
135
+ for (const u of U()) {
136
+ if (u === "custom") continue;
137
+ const m = be(u);
138
+ if (m && m[0].getTime() === n[0].getTime() && m[1].getTime() === n[1].getTime())
139
+ return u;
139
140
  }
140
141
  return "custom";
141
- }, ae = (n) => {
142
+ }, te = (n) => {
142
143
  if (n === "custom") {
143
- c(!0);
144
+ d(!0);
144
145
  return;
145
146
  }
146
- c(!1);
147
- const d = pe(n);
148
- b(d);
147
+ d(!1);
148
+ const u = be(n);
149
+ b(u);
149
150
  };
150
151
  return /* @__PURE__ */ v("div", { className: "flex flex-col gap-[var(--space-3xl)]", children: [
151
- F && /* @__PURE__ */ v("div", { className: "relative", children: [
152
+ j && /* @__PURE__ */ v("div", { className: "relative", children: [
152
153
  /* @__PURE__ */ e(
153
- H,
154
+ _,
154
155
  {
155
156
  name: "search",
156
157
  className: "absolute left-[var(--space-m)] top-1/2 -translate-y-1/2 h-[var(--size-xs)] w-[var(--size-xs)] text-[var(--color-text-tertiary)] pointer-events-none"
157
158
  }
158
159
  ),
159
160
  /* @__PURE__ */ e(
160
- ee,
161
+ ae,
161
162
  {
162
163
  type: "text",
163
164
  size: "l",
164
- placeholder: r.searchPlaceholder || `Search for a ${r.label.toLowerCase()}`,
165
+ placeholder: t.searchPlaceholder || `Search for a ${t.label.toLowerCase()}`,
165
166
  value: k,
166
- onChange: (n) => A(n.target.value),
167
+ onChange: (n) => z(n.target.value),
167
168
  className: "pl-[calc(var(--space-m)+var(--size-xs)+var(--space-s))]",
168
- autoFocus: y
169
+ autoFocus: w
169
170
  }
170
171
  )
171
172
  ] }),
172
- r.type === "number" && r.rangeMode && /* @__PURE__ */ v("div", { className: "flex flex-col gap-[var(--space-s)]", children: [
173
- /* @__PURE__ */ e("div", { className: "text-body-medium-sm text-[var(--color-text-tertiary)]", children: r.label }),
173
+ t.type === "number" && t.rangeMode && /* @__PURE__ */ v("div", { className: "flex flex-col gap-[var(--space-s)]", children: [
174
+ /* @__PURE__ */ e("div", { className: "text-body-medium-sm text-[var(--color-text-tertiary)]", children: t.label }),
174
175
  /* @__PURE__ */ e("div", { className: "h-px w-full mb-[var(--space-s)]", children: /* @__PURE__ */ e("div", { "aria-hidden": "true", className: "border-[var(--color-border-primary-subtle)] border-[0px_0px_1px] border-solid h-px" }) }),
175
176
  /* @__PURE__ */ v("div", { className: "flex flex-col gap-[var(--space-s)]", children: [
176
177
  /* @__PURE__ */ e("label", { className: "text-label-md text-[var(--color-text-primary)]", children: "At least..." }),
177
178
  /* @__PURE__ */ v("div", { className: "relative", children: [
178
- r.numberConfig?.prefix && /* @__PURE__ */ e("span", { className: "absolute left-[var(--space-m)] top-1/2 -translate-y-1/2 text-body-md text-[var(--color-text-tertiary)] pointer-events-none", children: r.numberConfig.prefix }),
179
+ t.numberConfig?.prefix && /* @__PURE__ */ e("span", { className: "absolute left-[var(--space-m)] top-1/2 -translate-y-1/2 text-body-md text-[var(--color-text-tertiary)] pointer-events-none", children: t.numberConfig.prefix }),
179
180
  /* @__PURE__ */ e(
180
- ee,
181
+ ae,
181
182
  {
182
183
  type: "text",
183
184
  inputMode: "numeric",
184
185
  size: "l",
185
- variant: I ? "error" : "default",
186
- value: $,
186
+ variant: D ? "error" : "default",
187
+ value: A,
187
188
  onChange: (n) => {
188
- M(n.target.value), P(null);
189
+ L(n.target.value), O(null);
189
190
  },
190
- onBlur: _,
191
+ onBlur: B,
191
192
  onKeyDown: (n) => {
192
- n.key === "Enter" && _();
193
+ n.key === "Enter" && B();
193
194
  },
194
- placeholder: r.numberConfig?.min?.toString() || "0.00",
195
- className: D(
196
- r.numberConfig?.prefix && "pl-[calc(var(--space-l)+var(--space-m))]",
197
- r.numberConfig?.suffix && "pr-[calc(var(--space-l)+var(--space-m))]"
195
+ placeholder: t.numberConfig?.min?.toString() || "0.00",
196
+ className: E(
197
+ t.numberConfig?.prefix && "pl-[calc(var(--space-l)+var(--space-m))]",
198
+ t.numberConfig?.suffix && "pr-[calc(var(--space-l)+var(--space-m))]"
198
199
  )
199
200
  }
200
201
  ),
201
- r.numberConfig?.suffix && /* @__PURE__ */ e("span", { className: "absolute right-[var(--space-m)] top-1/2 -translate-y-1/2 text-body-md text-[var(--color-text-tertiary)] pointer-events-none", children: r.numberConfig.suffix })
202
+ t.numberConfig?.suffix && /* @__PURE__ */ e("span", { className: "absolute right-[var(--space-m)] top-1/2 -translate-y-1/2 text-body-md text-[var(--color-text-tertiary)] pointer-events-none", children: t.numberConfig.suffix })
202
203
  ] }),
203
- I && /* @__PURE__ */ e("span", { className: "text-caption-sm text-[var(--color-text-error-bold)]", children: I })
204
+ D && /* @__PURE__ */ e("span", { className: "text-caption-sm text-[var(--color-text-error-bold)]", children: D })
204
205
  ] }),
205
206
  /* @__PURE__ */ v("div", { className: "flex flex-col gap-[var(--space-s)]", children: [
206
207
  /* @__PURE__ */ e("label", { className: "text-label-md text-[var(--color-text-primary)]", children: "No more than..." }),
207
208
  /* @__PURE__ */ v("div", { className: "relative", children: [
208
- r.numberConfig?.prefix && /* @__PURE__ */ e("span", { className: "absolute left-[var(--space-m)] top-1/2 -translate-y-1/2 text-body-md text-[var(--color-text-tertiary)] pointer-events-none", children: r.numberConfig.prefix }),
209
+ t.numberConfig?.prefix && /* @__PURE__ */ e("span", { className: "absolute left-[var(--space-m)] top-1/2 -translate-y-1/2 text-body-md text-[var(--color-text-tertiary)] pointer-events-none", children: t.numberConfig.prefix }),
209
210
  /* @__PURE__ */ e(
210
- ee,
211
+ ae,
211
212
  {
212
213
  type: "text",
213
214
  inputMode: "numeric",
214
215
  size: "l",
215
- variant: T ? "error" : "default",
216
- value: w,
216
+ variant: F ? "error" : "default",
217
+ value: C,
217
218
  onChange: (n) => {
218
- R(n.target.value), E(null);
219
+ V(n.target.value), R(null);
219
220
  },
220
- onBlur: _,
221
+ onBlur: B,
221
222
  onKeyDown: (n) => {
222
- n.key === "Enter" && _();
223
+ n.key === "Enter" && B();
223
224
  },
224
- placeholder: r.numberConfig?.max?.toString() || "0.00",
225
- className: D(
226
- r.numberConfig?.prefix && "pl-[calc(var(--space-l)+var(--space-m))]",
227
- r.numberConfig?.suffix && "pr-[calc(var(--space-l)+var(--space-m))]"
225
+ placeholder: t.numberConfig?.max?.toString() || "0.00",
226
+ className: E(
227
+ t.numberConfig?.prefix && "pl-[calc(var(--space-l)+var(--space-m))]",
228
+ t.numberConfig?.suffix && "pr-[calc(var(--space-l)+var(--space-m))]"
228
229
  )
229
230
  }
230
231
  ),
231
- r.numberConfig?.suffix && /* @__PURE__ */ e("span", { className: "absolute right-[var(--space-m)] top-1/2 -translate-y-1/2 text-body-md text-[var(--color-text-tertiary)] pointer-events-none", children: r.numberConfig.suffix })
232
+ t.numberConfig?.suffix && /* @__PURE__ */ e("span", { className: "absolute right-[var(--space-m)] top-1/2 -translate-y-1/2 text-body-md text-[var(--color-text-tertiary)] pointer-events-none", children: t.numberConfig.suffix })
232
233
  ] }),
233
- T && /* @__PURE__ */ e("span", { className: "text-caption-sm text-[var(--color-text-error-bold)]", children: T })
234
+ F && /* @__PURE__ */ e("span", { className: "text-caption-sm text-[var(--color-text-error-bold)]", children: F })
234
235
  ] }),
235
- g && ($ !== "" || w !== "") && /* @__PURE__ */ e(
236
- Q,
236
+ N && (A !== "" || C !== "") && /* @__PURE__ */ e(
237
+ G,
237
238
  {
238
239
  variant: "default",
239
240
  onClick: () => {
240
- M(""), R(""), P(null), E(null), g();
241
+ L(""), V(""), O(null), R(null), N();
241
242
  },
242
243
  className: "self-start",
243
244
  children: /* @__PURE__ */ e("span", { className: "text-body-medium-sm", children: "Reset" })
244
245
  }
245
246
  )
246
247
  ] }),
247
- r.type === "date" && r.rangeMode && /* @__PURE__ */ v("div", { className: "flex flex-col gap-[var(--space-s)]", children: [
248
- /* @__PURE__ */ e("div", { className: "text-body-medium-sm text-[var(--color-text-tertiary)]", children: r.label }),
248
+ t.type === "date" && t.rangeMode && /* @__PURE__ */ v("div", { className: "flex flex-col gap-[var(--space-s)]", children: [
249
+ /* @__PURE__ */ e("div", { className: "text-body-medium-sm text-[var(--color-text-tertiary)]", children: t.label }),
249
250
  /* @__PURE__ */ e("div", { className: "h-px w-full mb-[var(--space-s)]", children: /* @__PURE__ */ e("div", { "aria-hidden": "true", className: "border-[var(--color-border-primary-subtle)] border-[0px_0px_1px] border-solid h-px" }) }),
250
251
  /* @__PURE__ */ v("div", { className: "flex flex-col gap-[var(--space-s)]", children: [
251
252
  /* @__PURE__ */ e("label", { className: "text-label-md text-[var(--color-text-primary)]", children: "Date range" }),
252
- /* @__PURE__ */ v(ge, { value: Z(), onValueChange: ae, children: [
253
- /* @__PURE__ */ e(ye, { size: "l", children: /* @__PURE__ */ e(Ne, { placeholder: "Select date range..." }) }),
254
- /* @__PURE__ */ e(we, { children: U().map((n) => /* @__PURE__ */ e(Ce, { value: n, children: $e(n) }, n)) })
253
+ /* @__PURE__ */ v(Ae, { value: Q(), onValueChange: te, children: [
254
+ /* @__PURE__ */ e(De, { size: "l", children: /* @__PURE__ */ e(Me, { placeholder: "Select date range..." }) }),
255
+ /* @__PURE__ */ e(ze, { children: U().map((n) => /* @__PURE__ */ e(Ee, { value: n, children: Te(n) }, n)) })
255
256
  ] })
256
257
  ] }),
257
- Z() === "custom" && /* @__PURE__ */ v(ne, { children: [
258
- /* @__PURE__ */ e("p", { className: "text-body-sm text-[var(--color-text-secondary)]", children: j === "day" ? "Select start and end dates for custom range" : "Select start and end months for custom range" }),
259
- j === "day" && /* @__PURE__ */ e(
260
- ke,
258
+ Q() === "custom" && /* @__PURE__ */ v(se, { children: [
259
+ /* @__PURE__ */ e("p", { className: "text-body-sm text-[var(--color-text-secondary)]", children: Y === "day" ? "Select start and end dates for custom range" : "Select start and end months for custom range" }),
260
+ Y === "day" && /* @__PURE__ */ e(
261
+ Re,
261
262
  {
262
263
  mode: "range",
263
- selected: s && Array.isArray(s) && s.length === 2 ? { from: s[0], to: s[1] } : void 0,
264
+ selected: l && Array.isArray(l) && l.length === 2 ? { from: l[0], to: l[1] } : void 0,
264
265
  onSelect: (n) => {
265
266
  if (n?.from && n?.to) {
266
- const d = new Date(n.from);
267
- d.setHours(0, 0, 0, 0);
268
- const p = new Date(n.to);
269
- p.setHours(23, 59, 59, 999), b([d, p]), c(!1);
267
+ const u = new Date(n.from);
268
+ u.setHours(0, 0, 0, 0);
269
+ const m = new Date(n.to);
270
+ m.setHours(23, 59, 59, 999), b([u, m]), d(!1);
270
271
  }
271
272
  },
272
273
  numberOfMonths: 2,
273
- disabled: r.dateConfig?.minDate || r.dateConfig?.maxDate ? (n) => !!(r.dateConfig?.minDate && n < r.dateConfig.minDate || r.dateConfig?.maxDate && n > r.dateConfig.maxDate) : void 0
274
+ disabled: t.dateConfig?.minDate || t.dateConfig?.maxDate ? (n) => !!(t.dateConfig?.minDate && n < t.dateConfig.minDate || t.dateConfig?.maxDate && n > t.dateConfig.maxDate) : void 0
274
275
  }
275
276
  ),
276
- j === "month" && /* @__PURE__ */ e(
277
- Se,
277
+ Y === "month" && /* @__PURE__ */ e(
278
+ Le,
278
279
  {
279
- value: s,
280
+ value: l,
280
281
  onChange: (n) => {
281
- b(n), c(!1);
282
+ b(n), d(!1);
282
283
  },
283
284
  mode: "range",
284
285
  yearCount: 2,
285
286
  size: "small",
286
287
  enableNavigation: !0,
287
- onYearNavigate: (n) => S(n),
288
- minDate: r.dateConfig?.minDate,
289
- maxDate: r.dateConfig?.maxDate
288
+ onYearNavigate: (n) => I(n),
289
+ minDate: t.dateConfig?.minDate,
290
+ maxDate: t.dateConfig?.maxDate
290
291
  }
291
292
  )
292
293
  ] })
293
294
  ] }),
294
- B.map((n, d) => {
295
- const p = `filter-group-${d}-${n.label.replace(/\s+/g, "-").toLowerCase()}`;
295
+ W.map((n, u) => {
296
+ const m = `filter-group-${u}-${n.label.replace(/\s+/g, "-").toLowerCase()}`;
296
297
  return /* @__PURE__ */ v(
297
298
  "div",
298
299
  {
299
300
  role: "group",
300
- "aria-labelledby": p,
301
+ "aria-labelledby": m,
301
302
  className: "flex flex-col gap-[var(--space-s)]",
302
303
  children: [
303
304
  /* @__PURE__ */ v("div", { className: "flex gap-[var(--space-s)] items-start justify-start w-full", children: [
304
305
  /* @__PURE__ */ e(
305
306
  "div",
306
307
  {
307
- id: p,
308
+ id: m,
308
309
  className: "flex-1 text-body-medium-sm text-[var(--color-text-tertiary)]",
309
310
  children: n.label
310
311
  }
311
312
  ),
312
- g && r.type === "multiselect" && /* @__PURE__ */ v("div", { className: "flex gap-[var(--space-xs)] items-center text-body-medium-sm text-[var(--color-text-brand-bold)]", children: [
313
+ N && t.type === "multiselect" && /* @__PURE__ */ v("div", { className: "flex gap-[var(--space-xs)] items-center text-body-medium-sm text-[var(--color-text-brand-bold)]", children: [
313
314
  /* @__PURE__ */ e(
314
315
  "button",
315
316
  {
316
- onClick: () => q(n),
317
+ onClick: () => X(n),
317
318
  "aria-label": `Select all ${n.label} options`,
318
319
  className: "hover:text-[var(--color-text-brand-bold-hovered)] hover:underline",
319
320
  children: "All"
@@ -323,7 +324,7 @@ const ve = /* @__PURE__ */ u.memo(function({ filter: r, value: s, onChange: b, o
323
324
  /* @__PURE__ */ e(
324
325
  "button",
325
326
  {
326
- onClick: () => J(n),
327
+ onClick: () => ee(n),
327
328
  "aria-label": `Inverse selection in ${n.label}`,
328
329
  className: "hover:text-[var(--color-text-brand-bold-hovered)] hover:underline",
329
330
  children: "Inverse"
@@ -333,7 +334,7 @@ const ve = /* @__PURE__ */ u.memo(function({ filter: r, value: s, onChange: b, o
333
334
  /* @__PURE__ */ e(
334
335
  "button",
335
336
  {
336
- onClick: () => X(n),
337
+ onClick: () => Z(n),
337
338
  "aria-label": `Clear all ${n.label} selections`,
338
339
  className: "hover:text-[var(--color-text-brand-bold-hovered)] hover:underline",
339
340
  children: "None"
@@ -342,162 +343,162 @@ const ve = /* @__PURE__ */ u.memo(function({ filter: r, value: s, onChange: b, o
342
343
  ] })
343
344
  ] }),
344
345
  /* @__PURE__ */ e("div", { className: "h-px w-full", children: /* @__PURE__ */ e("div", { "aria-hidden": "true", className: "border-[var(--color-border-primary-subtle)] border-[0px_0px_1px] border-solid h-px" }) }),
345
- r.type === "multiselect" ? /* @__PURE__ */ e("div", { className: "flex flex-col gap-[var(--space-s)]", children: n.options.map((m) => /* @__PURE__ */ v(u.Fragment, { children: [
346
+ t.type === "multiselect" ? /* @__PURE__ */ e("div", { className: "flex flex-col gap-[var(--space-s)]", children: n.options.map((p) => /* @__PURE__ */ v(c.Fragment, { children: [
346
347
  /* @__PURE__ */ v("div", { className: "flex gap-[var(--space-s)] h-[20px] items-center", children: [
347
348
  /* @__PURE__ */ e(
348
- le,
349
+ pe,
349
350
  {
350
- id: `checkbox-${r.id}-${m.value}`,
351
- checked: h.includes(m.value),
352
- onCheckedChange: () => Y(m.value)
351
+ id: `checkbox-${t.id}-${p.value}`,
352
+ checked: h.includes(p.value),
353
+ onCheckedChange: () => H(p.value)
353
354
  }
354
355
  ),
355
356
  /* @__PURE__ */ e(
356
357
  "label",
357
358
  {
358
- htmlFor: `checkbox-${r.id}-${m.value}`,
359
+ htmlFor: `checkbox-${t.id}-${p.value}`,
359
360
  className: "flex-1 text-body-md text-[var(--color-text-primary)] cursor-pointer",
360
- children: m.label
361
+ children: p.label
361
362
  }
362
363
  )
363
364
  ] }),
364
- m.children && m.children.map((N) => /* @__PURE__ */ v("div", { className: "flex gap-[var(--space-s)] h-[20px] items-center pl-[var(--space-3xl)]", children: [
365
+ p.children && p.children.map((f) => /* @__PURE__ */ v("div", { className: "flex gap-[var(--space-s)] h-[20px] items-center pl-[var(--space-3xl)]", children: [
365
366
  /* @__PURE__ */ e(
366
- le,
367
+ pe,
367
368
  {
368
- id: `checkbox-${r.id}-${N.value}`,
369
- checked: h.includes(N.value),
370
- onCheckedChange: () => Y(N.value)
369
+ id: `checkbox-${t.id}-${f.value}`,
370
+ checked: h.includes(f.value),
371
+ onCheckedChange: () => H(f.value)
371
372
  }
372
373
  ),
373
374
  /* @__PURE__ */ e(
374
375
  "label",
375
376
  {
376
- htmlFor: `checkbox-${r.id}-${N.value}`,
377
+ htmlFor: `checkbox-${t.id}-${f.value}`,
377
378
  className: "flex-1 text-body-md text-[var(--color-text-primary)] cursor-pointer",
378
- children: N.label
379
+ children: f.label
379
380
  }
380
381
  )
381
- ] }, N.value))
382
- ] }, m.value)) }) : /* @__PURE__ */ e(fe, { value: h[0] || "", onValueChange: Y, "aria-label": n.label, children: /* @__PURE__ */ e("div", { className: "flex flex-col gap-[var(--space-s)]", children: n.options.map((m) => /* @__PURE__ */ v(u.Fragment, { children: [
382
+ ] }, f.value))
383
+ ] }, p.value)) }) : /* @__PURE__ */ e($e, { value: h[0] || "", onValueChange: H, "aria-label": n.label, children: /* @__PURE__ */ e("div", { className: "flex flex-col gap-[var(--space-s)]", children: n.options.map((p) => /* @__PURE__ */ v(c.Fragment, { children: [
383
384
  /* @__PURE__ */ v("div", { className: "flex gap-[var(--space-s)] h-[20px] items-center", children: [
384
- /* @__PURE__ */ e(ie, { id: `radio-${r.id}-${m.value}`, value: m.value }),
385
+ /* @__PURE__ */ e(me, { id: `radio-${t.id}-${p.value}`, value: p.value }),
385
386
  /* @__PURE__ */ e(
386
387
  "label",
387
388
  {
388
- htmlFor: `radio-${r.id}-${m.value}`,
389
+ htmlFor: `radio-${t.id}-${p.value}`,
389
390
  className: "flex-1 text-body-md text-[var(--color-text-primary)] cursor-pointer",
390
- children: m.label
391
+ children: p.label
391
392
  }
392
393
  )
393
394
  ] }),
394
- m.children && m.children.map((N) => /* @__PURE__ */ v("div", { className: "flex gap-[var(--space-s)] h-[20px] items-center pl-[var(--space-3xl)]", children: [
395
- /* @__PURE__ */ e(ie, { id: `radio-${r.id}-${N.value}`, value: N.value }),
395
+ p.children && p.children.map((f) => /* @__PURE__ */ v("div", { className: "flex gap-[var(--space-s)] h-[20px] items-center pl-[var(--space-3xl)]", children: [
396
+ /* @__PURE__ */ e(me, { id: `radio-${t.id}-${f.value}`, value: f.value }),
396
397
  /* @__PURE__ */ e(
397
398
  "label",
398
399
  {
399
- htmlFor: `radio-${r.id}-${N.value}`,
400
+ htmlFor: `radio-${t.id}-${f.value}`,
400
401
  className: "flex-1 text-body-md text-[var(--color-text-primary)] cursor-pointer",
401
- children: N.label
402
+ children: f.label
402
403
  }
403
404
  )
404
- ] }, N.value))
405
- ] }, m.value)) }) })
405
+ ] }, f.value))
406
+ ] }, p.value)) }) })
406
407
  ]
407
408
  },
408
409
  n.label
409
410
  );
410
411
  })
411
412
  ] });
412
- }), me = /* @__PURE__ */ u.memo(function({ filter: r, isSelected: s, isPinned: b, valueCount: g, onSelect: y, onTogglePin: k, onPrefetch: A }) {
413
- const f = r.icon, [$, M] = u.useState(!1);
413
+ }), fe = /* @__PURE__ */ c.memo(function({ filter: t, isSelected: l, isPinned: b, valueCount: N, onSelect: w, onTogglePin: k, onPrefetch: z }) {
414
+ const g = t.icon, [A, L] = c.useState(!1);
414
415
  return /* @__PURE__ */ v(
415
416
  "div",
416
417
  {
417
- id: `filter-option-${r.id}`,
418
+ id: `filter-option-${t.id}`,
418
419
  role: "option",
419
- "aria-selected": s,
420
- "aria-label": `${r.label}${g ? `, ${g} selected` : ""}`,
420
+ "aria-selected": l,
421
+ "aria-label": `${t.label}${N ? `, ${N} selected` : ""}`,
421
422
  tabIndex: -1,
422
- onKeyDown: (w) => {
423
- (w.key === "Enter" || w.key === " ") && (w.preventDefault(), y());
423
+ onKeyDown: (C) => {
424
+ (C.key === "Enter" || C.key === " ") && (C.preventDefault(), w());
424
425
  },
425
426
  onMouseEnter: () => {
426
- M(!0), A?.();
427
+ L(!0), z?.();
427
428
  },
428
- onMouseLeave: () => M(!1),
429
- className: D(
429
+ onMouseLeave: () => L(!1),
430
+ className: E(
430
431
  "group/item box-border flex gap-[var(--space-m)] h-[var(--size-m)] items-center justify-start px-[var(--space-l)] py-[var(--space-s)] relative rounded-[var(--border-radius-m)] shrink-0 w-full cursor-pointer transition-colors",
431
432
  "hover:bg-[var(--color-background-neutral-hovered)]",
432
- s && "bg-[var(--color-background-blue-subtle-selected)] hover:bg-[var(--color-background-blue-subtle-selected-hovered)] group-focus-visible/listbox:ring-2 group-focus-visible/listbox:ring-[var(--ring-color)] group-focus-visible/listbox:ring-inset"
433
+ l && "bg-[var(--color-background-blue-subtle-selected)] hover:bg-[var(--color-background-blue-subtle-selected-hovered)] group-focus-visible/listbox:ring-2 group-focus-visible/listbox:ring-[var(--ring-color)] group-focus-visible/listbox:ring-inset"
433
434
  ),
434
- onClick: y,
435
+ onClick: w,
435
436
  children: [
436
437
  /* @__PURE__ */ v("div", { className: "flex-1 flex gap-[var(--space-s)] items-center justify-start min-w-0", children: [
437
- /* @__PURE__ */ e(f, { className: D(
438
+ /* @__PURE__ */ e(g, { className: E(
438
439
  "h-[var(--size-2xs)] w-[var(--size-2xs)] shrink-0",
439
- s ? "text-[var(--color-text-brand-bold)]" : "text-[var(--color-text-primary)]"
440
+ l ? "text-[var(--color-text-brand-bold)]" : "text-[var(--color-text-primary)]"
440
441
  ) }),
441
- /* @__PURE__ */ e("div", { className: D(
442
+ /* @__PURE__ */ e("div", { className: E(
442
443
  "truncate [&]:text-label-md",
443
- s ? "text-[var(--color-text-brand-bold)]" : "text-[var(--color-text-primary)]"
444
- ), children: r.label }),
445
- g !== void 0 && g > 0 && /* @__PURE__ */ e(
446
- te,
444
+ l ? "text-[var(--color-text-brand-bold)]" : "text-[var(--color-text-primary)]"
445
+ ), children: t.label }),
446
+ N !== void 0 && N > 0 && /* @__PURE__ */ e(
447
+ oe,
447
448
  {
448
449
  size: "s",
449
- intent: s ? "brand" : "neutral",
450
- appearance: s || $ ? "bold" : "subtle",
451
- children: g
450
+ intent: l ? "brand" : "neutral",
451
+ appearance: l || A ? "bold" : "subtle",
452
+ children: N
452
453
  }
453
454
  )
454
455
  ] }),
455
456
  /* @__PURE__ */ e("div", { className: "flex items-center gap-[var(--space-s)] shrink-0", children: /* @__PURE__ */ e(
456
- Q,
457
+ G,
457
458
  {
458
459
  variant: "ghost",
459
460
  size: "s",
460
461
  tabIndex: -1,
461
- "aria-label": b ? `Unpin ${r.label} filter` : `Pin ${r.label} filter`,
462
+ "aria-label": b ? `Unpin ${t.label} filter` : `Pin ${t.label} filter`,
462
463
  "aria-pressed": b,
463
- onClick: (w) => {
464
- w.stopPropagation(), k();
464
+ onClick: (C) => {
465
+ C.stopPropagation(), k();
465
466
  },
466
- className: D(
467
+ className: E(
467
468
  "group/pin h-auto w-auto p-[var(--space-xs)] transition-opacity",
468
469
  b ? "opacity-100" : "opacity-0 group-hover/item:opacity-100"
469
470
  ),
470
- children: b ? /* @__PURE__ */ v(ne, { children: [
471
+ children: b ? /* @__PURE__ */ v(se, { children: [
471
472
  /* @__PURE__ */ e(
472
- H,
473
+ _,
473
474
  {
474
- name: se,
475
+ name: ue,
475
476
  "aria-hidden": "true",
476
- className: D(
477
+ className: E(
477
478
  "h-[12px] w-[12px] group-hover/pin:hidden",
478
- s ? "text-[var(--color-text-brand-bold)]" : "text-[var(--color-text-primary)]"
479
+ l ? "text-[var(--color-text-brand-bold)]" : "text-[var(--color-text-primary)]"
479
480
  )
480
481
  }
481
482
  ),
482
483
  /* @__PURE__ */ e(
483
- H,
484
+ _,
484
485
  {
485
- name: be,
486
+ name: ke,
486
487
  "aria-hidden": "true",
487
- className: D(
488
+ className: E(
488
489
  "h-[12px] w-[12px] hidden group-hover/pin:block",
489
- s ? "text-[var(--color-text-brand-bold)]" : "text-[var(--color-text-primary)]"
490
+ l ? "text-[var(--color-text-brand-bold)]" : "text-[var(--color-text-primary)]"
490
491
  )
491
492
  }
492
493
  )
493
494
  ] }) : /* @__PURE__ */ e(
494
- H,
495
+ _,
495
496
  {
496
- name: se,
497
+ name: ue,
497
498
  "aria-hidden": "true",
498
- className: D(
499
+ className: E(
499
500
  "h-[12px] w-[12px]",
500
- s ? "text-[var(--color-text-brand-bold)]" : "text-[var(--color-text-primary)]"
501
+ l ? "text-[var(--color-text-brand-bold)]" : "text-[var(--color-text-primary)]"
501
502
  )
502
503
  }
503
504
  )
@@ -507,256 +508,294 @@ const ve = /* @__PURE__ */ u.memo(function({ filter: r, value: s, onChange: b, o
507
508
  }
508
509
  );
509
510
  });
510
- function Me({ placeholder: x = "Search for keyword...", onAddSearchTerm: r }) {
511
- const [s, b] = u.useState("");
511
+ function Be({ placeholder: x = "Search for keyword...", onAddSearchTerm: t }) {
512
+ const [l, b] = c.useState("");
512
513
  return /* @__PURE__ */ e("div", { className: "min-w-[200px] w-[280px]", children: /* @__PURE__ */ e(
513
- ee,
514
+ ae,
514
515
  {
515
516
  type: "search",
516
517
  "aria-label": "Search filters by keyword",
517
518
  placeholder: x,
518
- value: s,
519
- onChange: (y) => b(y.target.value),
520
- onKeyDown: (y) => {
521
- y.key === "Enter" && s.trim() && (y.preventDefault(), r(s.trim()), b(""));
519
+ value: l,
520
+ onChange: (w) => b(w.target.value),
521
+ onKeyDown: (w) => {
522
+ w.key === "Enter" && l.trim() && (w.preventDefault(), t(l.trim()), b(""));
522
523
  },
523
524
  size: "m"
524
525
  }
525
526
  ) });
526
527
  }
527
- function Le({
528
+ function Ye({
528
529
  placeholder: x = "Search for keyword...",
529
- onAddSearchTerm: r,
530
- suggestions: s,
530
+ onAddSearchTerm: t,
531
+ suggestions: l,
531
532
  minCharacters: b
532
533
  }) {
533
- const [g, y] = u.useState("");
534
+ const [N, w] = c.useState("");
534
535
  return /* @__PURE__ */ e("div", { className: "min-w-[200px] w-[280px]", children: /* @__PURE__ */ e(
535
- he,
536
+ Se,
536
537
  {
537
- value: g,
538
- onValueChange: y,
539
- onSelect: (A, f) => {
540
- r(A, f), y("");
538
+ value: N,
539
+ onValueChange: w,
540
+ onSelect: (z, g) => {
541
+ t(z, g), w("");
541
542
  },
542
- suggestions: s,
543
+ suggestions: l,
543
544
  placeholder: x,
544
545
  minCharacters: b
545
546
  }
546
547
  ) });
547
548
  }
548
- function Ee({
549
+ function Ue({
549
550
  filters: x,
550
- pinnedFilters: r,
551
- activeFilters: s,
551
+ pinnedFilters: t,
552
+ activeFilters: l,
552
553
  onPinnedFiltersChange: b,
553
- onFilterChange: g,
554
- sidebarWidth: y = 240
554
+ onFilterChange: N,
555
+ sidebarWidth: w = 240
555
556
  }) {
556
- const [k, A] = u.useState(x[0]?.id), [f, $] = u.useState("mouse"), M = u.useRef(null), w = u.useMemo(() => x.map((c) => c.id), [x]), R = (c) => {
557
- const C = w.indexOf(k);
558
- let S = C;
559
- switch (c.key) {
557
+ const [k, z] = c.useState(x[0]?.id), [g, A] = c.useState("mouse"), L = c.useRef(null), C = c.useMemo(() => x.map((d) => d.id), [x]), V = (d) => {
558
+ const S = C.indexOf(k);
559
+ let I = S;
560
+ switch (d.key) {
560
561
  case "ArrowDown":
561
- c.preventDefault(), S = Math.min(C + 1, w.length - 1);
562
+ d.preventDefault(), I = Math.min(S + 1, C.length - 1);
562
563
  break;
563
564
  case "ArrowUp":
564
- c.preventDefault(), S = Math.max(C - 1, 0);
565
+ d.preventDefault(), I = Math.max(S - 1, 0);
565
566
  break;
566
567
  case "Home":
567
- c.preventDefault(), S = 0;
568
+ d.preventDefault(), I = 0;
568
569
  break;
569
570
  case "End":
570
- c.preventDefault(), S = w.length - 1;
571
+ d.preventDefault(), I = C.length - 1;
571
572
  break;
572
573
  default:
573
574
  return;
574
575
  }
575
- S !== C && ($("keyboard"), A(w[S]));
576
- }, I = x.find((c) => c.id === k), P = u.useCallback((c) => {
577
- I && g(I.id, c);
578
- }, [I?.id, g]), T = u.useCallback(() => {
579
- I && g(I.id, void 0);
580
- }, [I?.id, g]), E = (c) => {
581
- const C = r.includes(c) ? r.filter((S) => S !== c) : [...r, c];
582
- b(C);
583
- }, K = u.useMemo(() => {
584
- const c = {}, C = [], S = [];
576
+ I !== S && (A("keyboard"), z(C[I]));
577
+ }, D = x.find((d) => d.id === k), O = c.useCallback((d) => {
578
+ D && N(D.id, d);
579
+ }, [D?.id, N]), F = c.useCallback(() => {
580
+ D && N(D.id, void 0);
581
+ }, [D?.id, N]), R = (d) => {
582
+ const S = t.includes(d) ? t.filter((I) => I !== d) : [...t, d];
583
+ b(S);
584
+ }, T = c.useMemo(() => {
585
+ const d = {}, S = [], I = [];
585
586
  return x.forEach((h) => {
586
- h.group ? (c[h.group] || (c[h.group] = [], S.push(h.group)), c[h.group].push(h)) : C.push(h);
587
- }), { grouped: c, ungrouped: C, groupOrder: S };
587
+ h.group ? (d[h.group] || (d[h.group] = [], I.push(h.group)), d[h.group].push(h)) : S.push(h);
588
+ }), { grouped: d, ungrouped: S, groupOrder: I };
588
589
  }, [x]);
589
590
  return /* @__PURE__ */ e("div", { className: "bg-[var(--color-surface-primary)] relative rounded-[var(--border-radius-m)] max-h-[480px] flex flex-col", children: /* @__PURE__ */ v("div", { className: "flex items-stretch justify-start min-h-0 overflow-hidden rounded-[var(--border-radius-m)] flex-1", children: [
590
591
  /* @__PURE__ */ e(
591
592
  "div",
592
593
  {
593
594
  className: "bg-[var(--color-background-neutral-default)] relative shrink-0 border-r border-[var(--color-border-primary-subtle)] flex flex-col",
594
- style: { width: typeof y == "number" ? `${y}px` : y },
595
+ style: { width: typeof w == "number" ? `${w}px` : w },
595
596
  children: /* @__PURE__ */ v(
596
597
  "div",
597
598
  {
598
- ref: M,
599
+ ref: L,
599
600
  role: "listbox",
600
601
  "aria-label": "Filter categories",
601
602
  "aria-orientation": "vertical",
602
603
  "aria-activedescendant": k ? `filter-option-${k}` : void 0,
603
604
  tabIndex: 0,
604
- onKeyDown: R,
605
+ onKeyDown: V,
605
606
  className: "group/listbox box-border flex flex-col gap-[var(--space-s)] p-[var(--space-s)] overflow-y-auto focus-visible:outline-none",
606
607
  children: [
607
- K.ungrouped.map((c) => {
608
- const C = s[c.id], S = Array.isArray(C) ? C.length : C != null ? 1 : 0;
608
+ T.ungrouped.map((d) => {
609
+ const S = l[d.id], I = Array.isArray(S) ? S.length : S != null ? 1 : 0;
609
610
  return /* @__PURE__ */ e(
610
- me,
611
+ fe,
611
612
  {
612
- filter: c,
613
- isSelected: c.id === k,
614
- isPinned: r.includes(c.id),
615
- valueCount: S,
613
+ filter: d,
614
+ isSelected: d.id === k,
615
+ isPinned: t.includes(d.id),
616
+ valueCount: I,
616
617
  onSelect: () => {
617
- $("mouse"), A(c.id);
618
+ A("mouse"), z(d.id);
618
619
  },
619
- onTogglePin: () => E(c.id)
620
+ onTogglePin: () => R(d.id)
620
621
  },
621
- c.id
622
+ d.id
622
623
  );
623
624
  }),
624
- K.groupOrder.map((c, C) => {
625
- const S = K.grouped[c];
625
+ T.groupOrder.map((d, S) => {
626
+ const I = T.grouped[d];
626
627
  return /* @__PURE__ */ v("div", { className: "flex flex-col gap-[var(--space-s)]", children: [
627
- /* @__PURE__ */ e("div", { className: D(
628
+ /* @__PURE__ */ e("div", { className: E(
628
629
  "px-[var(--space-m)] pb-[var(--space-xs)]",
629
- C === 0 && K.ungrouped.length === 0 ? "pt-0" : "pt-[var(--space-m)]"
630
- ), children: /* @__PURE__ */ e("div", { className: "text-caption-sm text-[var(--color-text-tertiary)] tracking-[0.1px]", children: c }) }),
631
- S.map((h) => {
632
- const F = s[h.id], B = Array.isArray(F) ? F.length : F != null ? 1 : 0;
630
+ S === 0 && T.ungrouped.length === 0 ? "pt-0" : "pt-[var(--space-m)]"
631
+ ), children: /* @__PURE__ */ e("div", { className: "text-caption-sm text-[var(--color-text-tertiary)] tracking-[0.1px]", children: d }) }),
632
+ I.map((h) => {
633
+ const j = l[h.id], W = Array.isArray(j) ? j.length : j != null ? 1 : 0;
633
634
  return /* @__PURE__ */ e(
634
- me,
635
+ fe,
635
636
  {
636
637
  filter: h,
637
638
  isSelected: h.id === k,
638
- isPinned: r.includes(h.id),
639
- valueCount: B,
639
+ isPinned: t.includes(h.id),
640
+ valueCount: W,
640
641
  onSelect: () => {
641
- $("mouse"), A(h.id);
642
+ A("mouse"), z(h.id);
642
643
  },
643
- onTogglePin: () => E(h.id)
644
+ onTogglePin: () => R(h.id)
644
645
  },
645
646
  h.id
646
647
  );
647
648
  })
648
- ] }, c);
649
+ ] }, d);
649
650
  })
650
651
  ]
651
652
  }
652
653
  )
653
654
  }
654
655
  ),
655
- /* @__PURE__ */ e("div", { className: "flex-1 box-border p-[var(--space-l)] overflow-y-auto", children: I && /* @__PURE__ */ e(
656
- ve,
656
+ /* @__PURE__ */ e("div", { className: "flex-1 box-border p-[var(--space-l)] overflow-y-auto", children: D && /* @__PURE__ */ e(
657
+ ge,
657
658
  {
658
- filter: I,
659
- value: s[I.id],
660
- onChange: P,
661
- onReset: T,
662
- autoFocusSearch: f === "mouse"
659
+ filter: D,
660
+ value: l[D.id],
661
+ onChange: O,
662
+ onReset: F,
663
+ autoFocusSearch: g === "mouse"
663
664
  }
664
665
  ) })
665
666
  ] }) });
666
667
  }
667
- function Xe({
668
+ function ur({
668
669
  filters: x,
669
- pinnedFilters: r,
670
- activeFilters: s,
670
+ pinnedFilters: t,
671
+ activeFilters: l,
671
672
  onPinnedFiltersChange: b,
672
- onFilterChange: g,
673
- onFilterClear: y,
673
+ onFilterChange: N,
674
+ onFilterClear: w,
674
675
  onFilterReset: k,
675
- enableGlobalSearch: A = !1,
676
- globalSearchTerms: f = [],
677
- onGlobalSearchChange: $,
678
- globalSearchPlaceholder: M,
679
- enableAutocomplete: w = !1,
680
- autocompleteMinCharacters: R = 2,
681
- hideReset: I = !1,
682
- hideFiltersButton: P = !1,
683
- actionButtons: T
676
+ enableGlobalSearch: z = !1,
677
+ globalSearchTerms: g = [],
678
+ onGlobalSearchChange: A,
679
+ globalSearchPlaceholder: L,
680
+ enableAutocomplete: C = !1,
681
+ autocompleteMinCharacters: V = 2,
682
+ hideReset: D = !1,
683
+ hideFiltersButton: O = !1,
684
+ actionButtons: F
684
685
  }) {
685
- const [E, K] = u.useState(!1), [c, C] = u.useState(null), [S, h] = u.useState(""), F = u.useRef(s), B = u.useRef(f), Y = u.useRef({}), X = u.useCallback((t, a) => {
686
- const o = c;
687
- C(t ? a : null), !t && o === a && setTimeout(() => {
688
- Y.current[a]?.focus();
689
- }, 0);
690
- }, [c]);
691
- u.useEffect(() => {
692
- const t = F.current, a = B.current, o = Object.keys(s).filter(
693
- (L) => s[L] !== void 0 && s[L] !== null && (!Array.isArray(s[L]) || s[L].length > 0)
694
- ).length, i = Object.keys(t).filter(
695
- (L) => t[L] !== void 0 && t[L] !== null && (!Array.isArray(t[L]) || t[L].length > 0)
696
- ).length, l = f.length, V = a.length;
697
- let z = "";
698
- if (o !== i && (o > i ? z = "Filter applied." : o < i && (z = "Filter removed.")), l !== V && (l > V ? z = z ? `${z} Search term added.` : "Search term added." : l < V && (z = z ? `${z} Search term removed.` : "Search term removed.")), z) {
699
- const L = o + l;
700
- L === 0 ? z = "All filters cleared." : z = `${z} ${L} active filter${L !== 1 ? "s" : ""}.`, h(z);
686
+ const [R, T] = c.useState(!1), [d, S] = c.useState(null), [I, h] = c.useState(null), [j, W] = c.useState(""), H = c.useRef(l), Z = c.useRef(g), X = c.useRef({}), ee = c.useRef(null), [B, Y] = c.useState(/* @__PURE__ */ new Set()), U = c.useRef(null), [Q, te] = c.useState(!1), n = c.useCallback((r, a) => {
687
+ const o = d;
688
+ S(r ? a : null), !r && o === a && (h(a), setTimeout(() => h(null), 500), setTimeout(() => {
689
+ X.current[a]?.focus();
690
+ }, 0));
691
+ }, [d]);
692
+ c.useEffect(() => {
693
+ const r = H.current, a = Z.current, o = Object.keys(l).filter(
694
+ (M) => l[M] !== void 0 && l[M] !== null && (!Array.isArray(l[M]) || l[M].length > 0)
695
+ ).length, i = Object.keys(r).filter(
696
+ (M) => r[M] !== void 0 && r[M] !== null && (!Array.isArray(r[M]) || r[M].length > 0)
697
+ ).length, s = g.length, $ = a.length;
698
+ let y = "";
699
+ if (o !== i && (o > i ? y = "Filter applied." : o < i && (y = "Filter removed.")), s !== $ && (s > $ ? y = y ? `${y} Search term added.` : "Search term added." : s < $ && (y = y ? `${y} Search term removed.` : "Search term removed.")), y) {
700
+ const M = o + s;
701
+ M === 0 ? y = "All filters cleared." : y = `${y} ${M} active filter${M !== 1 ? "s" : ""}.`, W(y);
701
702
  }
702
- F.current = s, B.current = f;
703
- }, [s, f]);
704
- const q = !P && x.length > 0, J = Object.keys(s).some(
705
- (t) => s[t] !== void 0 && s[t] !== null
706
- ), _ = f.length > 0, j = Object.keys(s).filter(
707
- (t) => {
708
- const a = s[t];
703
+ H.current = l, Z.current = g;
704
+ }, [l, g]);
705
+ const u = !O && x.length > 0, m = Object.keys(l).some(
706
+ (r) => l[r] !== void 0 && l[r] !== null
707
+ ), p = g.length > 0, f = Object.keys(l).filter(
708
+ (r) => {
709
+ const a = l[r];
709
710
  return a != null && (!Array.isArray(a) || a.length > 0);
710
711
  }
711
- ).length, U = (t, a) => {
712
- if (!t.groups) return a;
713
- for (const o of t.groups)
712
+ ).length, J = (r, a) => {
713
+ if (!r.groups) return a;
714
+ for (const o of r.groups)
714
715
  for (const i of o.options) {
715
716
  if (i.value === a) return i.label;
716
717
  if (i.children) {
717
- const l = i.children.find((V) => V.value === a);
718
- if (l) return l.label;
718
+ const s = i.children.find(($) => $.value === a);
719
+ if (s) return s.label;
719
720
  }
720
721
  }
721
722
  return a;
722
- }, Z = (t, a, o) => {
723
- const i = o?.prefix || "", l = o?.suffix || "";
724
- return t === -1 / 0 ? `≤ ${i}${a}${l}` : a === 1 / 0 ? `≥ ${i}${t}${l}` : `${i}${t}${l} - ${i}${a}${l}`;
725
- }, ae = (t) => {
726
- const a = s[t.id];
723
+ }, P = (r, a, o) => {
724
+ const i = o?.prefix || "", s = o?.suffix || "";
725
+ return r === -1 / 0 ? `≤ ${i}${a}${s}` : a === 1 / 0 ? `≥ ${i}${r}${s}` : `${i}${r}${s} - ${i}${a}${s}`;
726
+ }, re = (r) => {
727
+ const a = l[r.id];
727
728
  if (!a || Array.isArray(a) && a.length === 0)
728
- return { type: "empty", icon: t.icon, content: t.label };
729
- if (t.type === "number" && t.rangeMode && Array.isArray(a) && a.length === 2) {
730
- const [o, i] = a, l = t.formatValue?.(
729
+ return { type: "empty", icon: r.icon, content: r.label };
730
+ if (r.type === "number" && r.rangeMode && Array.isArray(a) && a.length === 2) {
731
+ const [o, i] = a, s = r.formatValue?.(
731
732
  [o.toString(), i.toString()],
732
733
  2
733
- ) ?? Z(o, i, t.numberConfig);
734
- return { type: "values", icon: t.icon, content: l };
734
+ ) ?? P(o, i, r.numberConfig);
735
+ return { type: "values", icon: r.icon, content: s };
735
736
  }
736
- if (t.type === "date" && t.rangeMode && Array.isArray(a) && a.length === 2) {
737
- const [o, i] = a, l = t.formatValue?.(
737
+ if (r.type === "date" && r.rangeMode && Array.isArray(a) && a.length === 2) {
738
+ const [o, i] = a, s = r.formatValue?.(
738
739
  [o.toISOString(), i.toISOString()],
739
740
  2
740
- ) ?? Ie(o, i);
741
- return { type: "values", icon: t.icon, content: l };
741
+ ) ?? je(o, i);
742
+ return { type: "values", icon: r.icon, content: s };
742
743
  }
743
744
  if (Array.isArray(a))
744
745
  if (a.length <= 3) {
745
- const o = a.map(String), i = t.formatValue?.(o, o.length) ?? o.map((l) => U(t, l)).join(", ");
746
- return { type: "values", icon: t.icon, content: i };
746
+ const o = a.map(String), i = r.formatValue?.(o, o.length) ?? o.map((s) => J(r, s)).join(", ");
747
+ return { type: "values", icon: r.icon, content: i };
747
748
  } else
748
749
  return {
749
750
  type: "count",
750
- icon: t.icon,
751
- label: t.label,
751
+ icon: r.icon,
752
+ label: r.label,
752
753
  count: a.length
753
754
  };
754
- return { type: "values", icon: t.icon, content: U(t, String(a)) };
755
- }, n = x.filter((t) => r.includes(t.id)), d = u.useMemo(() => {
756
- const t = [];
755
+ return { type: "values", icon: r.icon, content: J(r, String(a)) };
756
+ }, K = x.filter((r) => t.includes(r.id));
757
+ c.useEffect(() => {
758
+ const r = U.current;
759
+ if (!r) return;
760
+ const a = r.parentElement;
761
+ if (!a) return;
762
+ const o = () => {
763
+ let s = 0, $ = 0;
764
+ for (const M of Array.from(a.children)) {
765
+ if (M === r) continue;
766
+ const ce = M.offsetWidth;
767
+ ce !== 0 && (s += ce, $++);
768
+ }
769
+ const y = ($ + 1) * 3;
770
+ return a.clientWidth - s - y;
771
+ }, i = new ResizeObserver(() => {
772
+ te(o() < 320);
773
+ });
774
+ return i.observe(a), () => i.disconnect();
775
+ }, []), c.useEffect(() => {
776
+ const r = ee.current;
777
+ if (!r || K.length === 0) return;
778
+ const a = new IntersectionObserver(
779
+ (o) => {
780
+ Y((i) => {
781
+ const s = new Set(i);
782
+ return o.forEach(($) => {
783
+ const y = $.target.dataset.filterId;
784
+ y && ($.isIntersecting && $.intersectionRatio >= 1 ? s.add(y) : s.delete(y));
785
+ }), s;
786
+ });
787
+ },
788
+ { root: r, threshold: 1 }
789
+ );
790
+ return Object.values(X.current).forEach((o) => {
791
+ o && a.observe(o);
792
+ }), () => a.disconnect();
793
+ }, [K]);
794
+ const q = c.useMemo(() => {
795
+ const r = [];
757
796
  for (const a of x) {
758
797
  const o = (i) => {
759
- t.push({
798
+ r.push({
760
799
  normalizedLabel: i.toLowerCase(),
761
800
  filterId: a.id,
762
801
  icon: a.icon
@@ -764,33 +803,33 @@ function Xe({
764
803
  };
765
804
  if (a.groups)
766
805
  for (const i of a.groups)
767
- for (const l of i.options)
768
- o(l.label), l.children?.forEach((V) => o(V.label));
806
+ for (const s of i.options)
807
+ o(s.label), s.children?.forEach(($) => o($.label));
769
808
  a.options && a.options.forEach((i) => {
770
- o(i.label), i.children?.forEach((l) => o(l.label));
809
+ o(i.label), i.children?.forEach((s) => o(s.label));
771
810
  });
772
811
  }
773
- return t;
774
- }, [x]), p = u.useCallback((t) => {
775
- if (!t) return null;
776
- const a = t.toLowerCase();
777
- for (const o of d)
812
+ return r;
813
+ }, [x]), le = c.useCallback((r) => {
814
+ if (!r) return null;
815
+ const a = r.toLowerCase();
816
+ for (const o of q)
778
817
  if (o.normalizedLabel.includes(a))
779
818
  return { filterId: o.filterId, icon: o.icon };
780
819
  return null;
781
- }, [d]), m = u.useMemo(() => f.filter((a) => a && typeof a == "string").map((a) => {
820
+ }, [q]), ye = c.useMemo(() => g.filter((a) => a && typeof a == "string").map((a) => {
782
821
  if (a.includes("|")) {
783
- const [i, l] = a.split("|"), V = x.find((z) => z.label === l);
822
+ const [i, s] = a.split("|"), $ = x.find((y) => y.label === s);
784
823
  return {
785
824
  value: a,
786
825
  // Keep encoded term for removal
787
- matchedFilter: V ? {
788
- filterId: V.id,
789
- icon: V.icon
826
+ matchedFilter: $ ? {
827
+ filterId: $.id,
828
+ icon: $.icon
790
829
  } : void 0
791
830
  };
792
831
  }
793
- const o = p(a);
832
+ const o = le(a);
794
833
  return {
795
834
  value: a,
796
835
  matchedFilter: o ? {
@@ -798,35 +837,35 @@ function Xe({
798
837
  icon: o.icon
799
838
  } : void 0
800
839
  };
801
- }), [f, x, p]), N = u.useMemo(() => {
802
- if (!w || !A)
840
+ }), [g, x, le]), Ne = c.useMemo(() => {
841
+ if (!C || !z)
803
842
  return [];
804
- const t = [];
843
+ const r = [];
805
844
  return x.forEach((a) => {
806
845
  a.groups ? a.groups.forEach((o) => {
807
846
  o.options.forEach((i) => {
808
- i.label && i.value && t.push({
847
+ i.label && i.value && r.push({
809
848
  label: i.label,
810
849
  value: i.value,
811
850
  filterLabel: a.label,
812
851
  filterIcon: a.icon
813
- }), i.children && i.children.forEach((l) => {
814
- l.label && l.value && t.push({
815
- label: l.label,
816
- value: l.value,
852
+ }), i.children && i.children.forEach((s) => {
853
+ s.label && s.value && r.push({
854
+ label: s.label,
855
+ value: s.value,
817
856
  filterLabel: a.label,
818
857
  filterIcon: a.icon
819
858
  });
820
859
  });
821
860
  });
822
861
  }) : a.options && a.options.forEach((o) => {
823
- o.label && o.value && t.push({
862
+ o.label && o.value && r.push({
824
863
  label: o.label,
825
864
  value: o.value,
826
865
  filterLabel: a.label,
827
866
  filterIcon: a.icon
828
867
  }), o.children && o.children.forEach((i) => {
829
- i.label && i.value && t.push({
868
+ i.label && i.value && r.push({
830
869
  label: i.label,
831
870
  value: i.value,
832
871
  filterLabel: a.label,
@@ -834,18 +873,18 @@ function Xe({
834
873
  });
835
874
  });
836
875
  });
837
- }), t.sort((a, o) => {
876
+ }), r.sort((a, o) => {
838
877
  const i = a.label.localeCompare(o.label);
839
878
  return i !== 0 ? i : a.filterLabel.localeCompare(o.filterLabel);
840
879
  });
841
- }, [x, w, A]), G = (t, a) => {
842
- if (!$) return;
843
- const o = a ? `${t}|${a}` : t;
844
- f.includes(o) || $([...f, o]);
845
- }, O = (t) => {
846
- $ && $(f.filter((a) => a !== t));
847
- }, W = () => {
848
- k(), $ && _ && $([]);
880
+ }, [x, C, z]), ie = (r, a) => {
881
+ if (!A) return;
882
+ const o = a ? `${r}|${a}` : r;
883
+ g.includes(o) || A([...g, o]);
884
+ }, we = (r) => {
885
+ A && A(g.filter((a) => a !== r));
886
+ }, Ce = () => {
887
+ k(), A && p && A([]);
849
888
  };
850
889
  return /* @__PURE__ */ v("div", { className: "flex gap-[3px] items-center min-w-0", children: [
851
890
  /* @__PURE__ */ e(
@@ -855,146 +894,156 @@ function Xe({
855
894
  "aria-live": "polite",
856
895
  "aria-atomic": "true",
857
896
  className: "sr-only",
858
- children: S
897
+ children: j
859
898
  }
860
899
  ),
861
- q && /* @__PURE__ */ v(ce, { open: E, onOpenChange: K, children: [
862
- /* @__PURE__ */ e(de, { asChild: !0, children: /* @__PURE__ */ v(
863
- Q,
900
+ u && /* @__PURE__ */ v(ve, { open: R, onOpenChange: T, children: [
901
+ /* @__PURE__ */ e(he, { asChild: !0, children: /* @__PURE__ */ v(
902
+ G,
864
903
  {
865
904
  className: "h-[var(--size-m)] gap-[var(--space-xs)]",
866
- "aria-label": `Filters${j > 0 ? `, ${j} active` : ""}`,
867
- "aria-expanded": E,
905
+ "aria-label": `Filters${f > 0 ? `, ${f} active` : ""}`,
906
+ "aria-expanded": R,
868
907
  "aria-haspopup": "dialog",
869
908
  children: [
870
- /* @__PURE__ */ e(H, { name: xe, className: "h-[var(--size-2xs)] w-[var(--size-2xs)]", "aria-hidden": "true" }),
909
+ /* @__PURE__ */ e(_, { name: Ie, className: "h-[var(--size-2xs)] w-[var(--size-2xs)]", "aria-hidden": "true" }),
871
910
  /* @__PURE__ */ e("span", { className: "text-label-md", children: "Filters" }),
872
- j > 0 && /* @__PURE__ */ e(te, { size: "s", intent: "neutral", appearance: "subtle", "aria-hidden": "true", children: j })
911
+ f > 0 && /* @__PURE__ */ e(oe, { size: "s", intent: "neutral", appearance: "subtle", "aria-hidden": "true", children: f })
873
912
  ]
874
913
  }
875
914
  ) }),
876
915
  /* @__PURE__ */ e(
877
- ue,
916
+ xe,
878
917
  {
879
918
  className: "w-[660px] p-0",
880
919
  align: "start",
881
920
  children: /* @__PURE__ */ e(
882
- Ee,
921
+ Ue,
883
922
  {
884
923
  filters: x,
885
- pinnedFilters: r,
886
- activeFilters: s,
924
+ pinnedFilters: t,
925
+ activeFilters: l,
887
926
  onPinnedFiltersChange: b,
888
- onFilterChange: g
927
+ onFilterChange: N
889
928
  }
890
929
  )
891
930
  }
892
931
  )
893
932
  ] }),
894
- q && n.length > 0 && /* @__PURE__ */ e(re, { type: "dot", layout: "horizontal" }),
895
- n.length > 0 && /* @__PURE__ */ e("div", { className: "min-w-0 flex gap-[7px] overflow-x-auto scrollbar-hide p-1", children: n.map((t) => {
896
- const a = ae(t), o = a.type !== "empty", i = a.icon;
933
+ u && K.length > 0 && !Q && /* @__PURE__ */ e(ne, { type: "dot" }),
934
+ K.length > 0 && /* @__PURE__ */ e("div", { ref: U, className: E("min-w-0 flex-1 overflow-hidden", Q && "hidden"), children: !Q && /* @__PURE__ */ e(Oe, { delayDuration: 400, children: /* @__PURE__ */ e("div", { ref: ee, className: "min-w-0 flex gap-[7px] overflow-x-auto scrollbar-hide p-1", children: K.map((r) => {
935
+ const a = re(r), o = a.type !== "empty", i = a.icon;
897
936
  return /* @__PURE__ */ v(
898
- ce,
937
+ Pe,
899
938
  {
900
- open: c === t.id,
901
- onOpenChange: (l) => X(l, t.id),
939
+ open: d === r.id || I === r.id || !B.has(r.id) ? !1 : void 0,
902
940
  children: [
903
- /* @__PURE__ */ e(de, { asChild: !0, children: /* @__PURE__ */ v(
904
- "div",
941
+ /* @__PURE__ */ v(
942
+ ve,
905
943
  {
906
- ref: (l) => {
907
- Y.current[t.id] = l;
908
- },
909
- role: "button",
910
- tabIndex: 0,
911
- "aria-label": `${t.label}: ${a.type === "empty" ? "not set, click to add filter" : a.type === "count" ? `${a.count} selected, click to edit` : `${a.content}, click to edit`}`,
912
- "aria-expanded": c === t.id,
913
- "aria-haspopup": "dialog",
914
- onKeyDown: (l) => {
915
- (l.key === "Enter" || l.key === " ") && (l.preventDefault(), X(c !== t.id, t.id));
916
- },
917
- className: D(
918
- "group/slot h-[var(--size-m)] rounded-[var(--border-radius-l)] flex items-center justify-center gap-[var(--space-s)] transition-colors cursor-pointer flex-shrink-0",
919
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring-color)] focus-visible:ring-offset-2",
920
- o ? "bg-[var(--color-background-neutral-selected)] hover:bg-[var(--color-background-neutral-hovered)] px-[var(--space-m)] pr-[4px]" : "border border-dashed border-[var(--color-border-primary-strong)] px-[var(--space-m)] pr-[var(--space-s)] hover:border-[var(--grey-400)] active:bg-[var(--grey-25)]"
921
- ),
944
+ open: d === r.id,
945
+ onOpenChange: (s) => n(s, r.id),
922
946
  children: [
923
- /* @__PURE__ */ e(i, { className: D(
924
- "h-[var(--size-2xs)] w-[var(--size-2xs)]",
925
- o ? "text-[var(--color-icon-primary)]" : "text-[var(--grey-400)] group-hover/slot:text-[var(--grey-500)]"
926
- ) }),
927
- a.type === "count" ? /* @__PURE__ */ v(ne, { children: [
928
- /* @__PURE__ */ e("span", { className: "whitespace-nowrap [&]:text-label-md text-[var(--color-text-primary)]", children: a.label }),
929
- /* @__PURE__ */ e(te, { size: "s", intent: "neutral", appearance: "bold", children: a.count })
930
- ] }) : /* @__PURE__ */ e("span", { className: D(
931
- "whitespace-nowrap [&]:text-label-md",
932
- o ? "text-[var(--color-text-primary)]" : "text-[var(--color-text-tertiary)] group-hover/slot:text-[var(--grey-500)]"
933
- ), children: a.content }),
934
- o && /* @__PURE__ */ e(
935
- Q,
947
+ /* @__PURE__ */ e(Ve, { asChild: !0, children: /* @__PURE__ */ e(he, { asChild: !0, children: /* @__PURE__ */ v(
948
+ "div",
936
949
  {
937
- variant: "ghost",
938
- size: "s",
939
- "aria-label": `Clear ${t.label} filter`,
940
- onClick: (l) => {
941
- l.stopPropagation(), y(t.id);
950
+ ref: (s) => {
951
+ X.current[r.id] = s;
942
952
  },
943
- onKeyDown: (l) => {
944
- (l.key === "Enter" || l.key === " ") && (l.preventDefault(), l.stopPropagation(), y(t.id));
953
+ "data-filter-id": r.id,
954
+ role: "button",
955
+ tabIndex: 0,
956
+ "aria-label": `${r.label}: ${a.type === "empty" ? "not set, click to add filter" : a.type === "count" ? `${a.count} selected, click to edit` : `${a.content}, click to edit`}`,
957
+ "aria-expanded": d === r.id,
958
+ "aria-haspopup": "dialog",
959
+ onKeyDown: (s) => {
960
+ (s.key === "Enter" || s.key === " ") && (s.preventDefault(), n(d !== r.id, r.id));
945
961
  },
946
- className: "h-auto w-auto p-[var(--space-xs)]",
947
- children: /* @__PURE__ */ e(H, { name: oe, className: "h-[var(--size-2xs)] w-[var(--size-2xs)]", "aria-hidden": "true" })
962
+ className: E(
963
+ "group/slot h-[var(--size-m)] rounded-[var(--border-radius-l)] flex items-center justify-center gap-[var(--space-s)] transition-colors cursor-pointer flex-shrink-0",
964
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring-color)] focus-visible:ring-offset-2",
965
+ o ? "bg-[var(--color-background-neutral-selected)] hover:bg-[var(--color-background-neutral-hovered)] px-[var(--space-m)] pr-[4px]" : "border border-dashed border-[var(--color-border-primary-strong)] px-[var(--space-m)] pr-[var(--space-s)] hover:border-[var(--grey-400)] active:bg-[var(--grey-25)]"
966
+ ),
967
+ children: [
968
+ /* @__PURE__ */ e(i, { className: E(
969
+ "h-[var(--size-2xs)] w-[var(--size-2xs)]",
970
+ o ? "text-[var(--color-icon-primary)]" : "text-[var(--grey-400)] group-hover/slot:text-[var(--grey-500)]"
971
+ ) }),
972
+ a.type === "count" ? /* @__PURE__ */ v(se, { children: [
973
+ /* @__PURE__ */ e("span", { className: "whitespace-nowrap [&]:text-label-md text-[var(--color-text-primary)]", children: a.label }),
974
+ /* @__PURE__ */ e(oe, { size: "s", intent: "neutral", appearance: "bold", children: a.count })
975
+ ] }) : /* @__PURE__ */ e("span", { className: E(
976
+ "whitespace-nowrap [&]:text-label-md",
977
+ o ? "text-[var(--color-text-primary)]" : "text-[var(--color-text-tertiary)] group-hover/slot:text-[var(--grey-500)]"
978
+ ), children: a.content }),
979
+ o && /* @__PURE__ */ e(
980
+ G,
981
+ {
982
+ variant: "ghost",
983
+ size: "s",
984
+ "aria-label": `Clear ${r.label} filter`,
985
+ onClick: (s) => {
986
+ s.stopPropagation(), w(r.id);
987
+ },
988
+ onKeyDown: (s) => {
989
+ (s.key === "Enter" || s.key === " ") && (s.preventDefault(), s.stopPropagation(), w(r.id));
990
+ },
991
+ className: "h-auto w-auto p-[var(--space-xs)]",
992
+ children: /* @__PURE__ */ e(_, { name: de, className: "h-[var(--size-2xs)] w-[var(--size-2xs)]", "aria-hidden": "true" })
993
+ }
994
+ )
995
+ ]
996
+ }
997
+ ) }) }),
998
+ /* @__PURE__ */ e(
999
+ xe,
1000
+ {
1001
+ className: E(
1002
+ "p-[var(--space-l)]",
1003
+ r.type === "date" ? "w-[600px]" : "w-[320px]",
1004
+ "max-h-[var(--radix-popover-content-available-height)] overflow-y-auto"
1005
+ ),
1006
+ align: "start",
1007
+ collisionPadding: 8,
1008
+ children: /* @__PURE__ */ e(
1009
+ ge,
1010
+ {
1011
+ filter: r,
1012
+ value: l[r.id],
1013
+ onChange: (s) => N(r.id, s),
1014
+ onReset: () => w(r.id)
1015
+ }
1016
+ )
948
1017
  }
949
1018
  )
950
1019
  ]
951
1020
  }
952
- ) }),
953
- /* @__PURE__ */ e(
954
- ue,
955
- {
956
- className: D(
957
- "p-[var(--space-l)]",
958
- t.type === "date" ? "w-[600px]" : "w-[320px]",
959
- "max-h-[var(--radix-popover-content-available-height)] overflow-y-auto"
960
- ),
961
- align: "start",
962
- collisionPadding: 8,
963
- children: /* @__PURE__ */ e(
964
- ve,
965
- {
966
- filter: t,
967
- value: s[t.id],
968
- onChange: (l) => g(t.id, l),
969
- onReset: () => y(t.id)
970
- }
971
- )
972
- }
973
- )
1021
+ ),
1022
+ a.type === "values" && /* @__PURE__ */ e(Fe, { side: "top", children: r.label })
974
1023
  ]
975
1024
  },
976
- t.id
1025
+ r.id
977
1026
  );
978
- }) }),
979
- A && (q || n.length > 0) && /* @__PURE__ */ e(re, { type: "line", layout: "horizontal", className: "mx-[var(--space-s)]" }),
980
- A && !w && /* @__PURE__ */ e(
981
- Me,
1027
+ }) }) }) }),
1028
+ z && (u || K.length > 0) && /* @__PURE__ */ e(ne, { type: "vertical-line", className: "mx-[var(--space-s)]" }),
1029
+ z && !C && /* @__PURE__ */ e(
1030
+ Be,
982
1031
  {
983
- placeholder: M,
984
- onAddSearchTerm: G
1032
+ placeholder: L,
1033
+ onAddSearchTerm: ie
985
1034
  }
986
1035
  ),
987
- A && w && /* @__PURE__ */ e(
988
- Le,
1036
+ z && C && /* @__PURE__ */ e(
1037
+ Ye,
989
1038
  {
990
- placeholder: M,
991
- onAddSearchTerm: G,
992
- suggestions: N,
993
- minCharacters: R
1039
+ placeholder: L,
1040
+ onAddSearchTerm: ie,
1041
+ suggestions: Ne,
1042
+ minCharacters: V
994
1043
  }
995
1044
  ),
996
- m.map((t) => {
997
- const a = t.matchedFilter?.icon, o = t.value.includes("|") ? t.value.split("|")[0] : t.value;
1045
+ ye.map((r) => {
1046
+ const a = r.matchedFilter?.icon, o = r.value.includes("|") ? r.value.split("|")[0] : r.value;
998
1047
  return /* @__PURE__ */ v(
999
1048
  "div",
1000
1049
  {
@@ -1003,40 +1052,40 @@ function Xe({
1003
1052
  a && /* @__PURE__ */ e(a, { className: "h-[var(--size-2xs)] w-[var(--size-2xs)] text-[var(--color-icon-primary)]" }),
1004
1053
  /* @__PURE__ */ e("span", { className: "whitespace-nowrap [&]:text-label-md text-[var(--color-text-primary)]", children: o }),
1005
1054
  /* @__PURE__ */ e(
1006
- Q,
1055
+ G,
1007
1056
  {
1008
1057
  variant: "ghost",
1009
1058
  size: "s",
1010
1059
  "aria-label": `Remove search term: ${o}`,
1011
- onClick: () => O(t.value),
1060
+ onClick: () => we(r.value),
1012
1061
  className: "h-auto w-auto p-[var(--space-xs)]",
1013
- children: /* @__PURE__ */ e(H, { name: oe, className: "h-[var(--size-2xs)] w-[var(--size-2xs)]", "aria-hidden": "true" })
1062
+ children: /* @__PURE__ */ e(_, { name: de, className: "h-[var(--size-2xs)] w-[var(--size-2xs)]", "aria-hidden": "true" })
1014
1063
  }
1015
1064
  )
1016
1065
  ]
1017
1066
  },
1018
- t.value
1067
+ r.value
1019
1068
  );
1020
1069
  }),
1021
- !I && (J || _) && /* @__PURE__ */ e(re, { type: "dot", layout: "horizontal" }),
1022
- !I && (J || _) && /* @__PURE__ */ e(
1023
- Q,
1070
+ !D && (m || p) && /* @__PURE__ */ e(ne, { type: "dot" }),
1071
+ !D && (m || p) && /* @__PURE__ */ e(
1072
+ G,
1024
1073
  {
1025
1074
  variant: "ghost",
1026
- onClick: W,
1075
+ onClick: Ce,
1027
1076
  "aria-label": "Reset all filters and search terms",
1028
1077
  className: "h-[var(--size-m)] rounded-[var(--border-radius-s)] px-[var(--space-m)]",
1029
1078
  children: /* @__PURE__ */ e("span", { className: "text-label-md", children: "Clear all" })
1030
1079
  }
1031
1080
  ),
1032
- T && /* @__PURE__ */ e("div", { className: "flex-1" }),
1033
- T
1081
+ F && /* @__PURE__ */ e("div", { className: "flex-1" }),
1082
+ F
1034
1083
  ] });
1035
1084
  }
1036
1085
  export {
1037
- ze as DEFAULT_DAY_PRESETS,
1038
- Ae as DEFAULT_MONTH_PRESETS,
1039
- Ee as FilterDropdownMenu,
1040
- ve as FilterPanelContent,
1041
- Xe as Filters
1086
+ _e as DEFAULT_DAY_PRESETS,
1087
+ Ke as DEFAULT_MONTH_PRESETS,
1088
+ Ue as FilterDropdownMenu,
1089
+ ge as FilterPanelContent,
1090
+ ur as Filters
1042
1091
  };