@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.
- package/dist/cjs/components/fundamental/chart.cjs +1 -1
- package/dist/cjs/components/product/app-frame.cjs +1 -1
- package/dist/cjs/components/product/bookmarks.cjs +1 -1
- package/dist/cjs/components/product/filters.cjs +1 -1
- package/dist/es/components/fundamental/chart.js +99 -99
- package/dist/es/components/product/app-frame.js +3 -3
- package/dist/es/components/product/bookmarks.js +28 -29
- package/dist/es/components/product/filters.js +566 -517
- package/dist/types/components/fundamental/chart.d.cts +1 -1
- package/dist/types/components/fundamental/chart.d.ts +1 -1
- package/package.json +2 -1
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { jsxs as v, jsx as e, Fragment as
|
|
2
|
-
import * as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { Button as
|
|
5
|
-
import { Input as
|
|
6
|
-
import { AutocompleteSearch as
|
|
7
|
-
import { Icon as
|
|
8
|
-
import { ListFilter as
|
|
9
|
-
import { Checkbox as
|
|
10
|
-
import { RadioGroup as
|
|
11
|
-
import { Select as
|
|
12
|
-
import { MonthPicker as
|
|
13
|
-
import { Calendar as
|
|
14
|
-
import { Popover as
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
|
|
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
|
-
],
|
|
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
|
|
36
|
-
let
|
|
36
|
+
function He(x) {
|
|
37
|
+
let t = 0;
|
|
37
38
|
if (x.groups)
|
|
38
|
-
for (const
|
|
39
|
-
for (const b of
|
|
40
|
-
|
|
41
|
-
return x.options && (
|
|
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
|
|
44
|
-
const [k,
|
|
45
|
-
|
|
46
|
-
if (
|
|
47
|
-
const n =
|
|
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 [
|
|
50
|
-
|
|
51
|
-
} else typeof n == "number" ? (
|
|
52
|
-
|
|
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
|
-
}, [
|
|
55
|
-
const
|
|
56
|
-
const n =
|
|
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
|
|
60
|
-
return
|
|
61
|
-
}, [
|
|
62
|
-
if (
|
|
63
|
-
if (!
|
|
64
|
-
const n =
|
|
65
|
-
return
|
|
66
|
-
...
|
|
67
|
-
options:
|
|
68
|
-
(
|
|
69
|
-
(
|
|
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((
|
|
73
|
+
})).filter((u) => u.options.length > 0);
|
|
73
74
|
}
|
|
74
|
-
if (
|
|
75
|
-
const n =
|
|
76
|
-
(
|
|
77
|
-
) :
|
|
78
|
-
return n.length > 0 ? [{ label:
|
|
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
|
-
}, [
|
|
82
|
-
if (
|
|
83
|
-
const
|
|
84
|
-
b(
|
|
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 (
|
|
89
|
-
const
|
|
90
|
-
(
|
|
91
|
-
),
|
|
92
|
-
b(
|
|
93
|
-
},
|
|
94
|
-
if (
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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
|
|
115
|
-
if (n !== "" && isNaN(
|
|
116
|
-
|
|
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 (
|
|
120
|
-
|
|
120
|
+
if (u !== "" && isNaN(p)) {
|
|
121
|
+
R("Invalid maximum value");
|
|
121
122
|
return;
|
|
122
123
|
}
|
|
123
|
-
if (
|
|
124
|
-
|
|
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([
|
|
128
|
-
},
|
|
129
|
-
if (
|
|
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 =
|
|
132
|
+
const n = l;
|
|
132
133
|
if (!n || !Array.isArray(n))
|
|
133
134
|
return U().includes("all-time") ? "all-time" : "";
|
|
134
|
-
for (const
|
|
135
|
-
if (
|
|
136
|
-
const
|
|
137
|
-
if (
|
|
138
|
-
return
|
|
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
|
-
},
|
|
142
|
+
}, te = (n) => {
|
|
142
143
|
if (n === "custom") {
|
|
143
|
-
|
|
144
|
+
d(!0);
|
|
144
145
|
return;
|
|
145
146
|
}
|
|
146
|
-
|
|
147
|
-
const
|
|
148
|
-
b(
|
|
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
|
-
|
|
152
|
+
j && /* @__PURE__ */ v("div", { className: "relative", children: [
|
|
152
153
|
/* @__PURE__ */ e(
|
|
153
|
-
|
|
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
|
-
|
|
161
|
+
ae,
|
|
161
162
|
{
|
|
162
163
|
type: "text",
|
|
163
164
|
size: "l",
|
|
164
|
-
placeholder:
|
|
165
|
+
placeholder: t.searchPlaceholder || `Search for a ${t.label.toLowerCase()}`,
|
|
165
166
|
value: k,
|
|
166
|
-
onChange: (n) =>
|
|
167
|
+
onChange: (n) => z(n.target.value),
|
|
167
168
|
className: "pl-[calc(var(--space-m)+var(--size-xs)+var(--space-s))]",
|
|
168
|
-
autoFocus:
|
|
169
|
+
autoFocus: w
|
|
169
170
|
}
|
|
170
171
|
)
|
|
171
172
|
] }),
|
|
172
|
-
|
|
173
|
-
/* @__PURE__ */ e("div", { className: "text-body-medium-sm text-[var(--color-text-tertiary)]", children:
|
|
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
|
-
|
|
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
|
-
|
|
181
|
+
ae,
|
|
181
182
|
{
|
|
182
183
|
type: "text",
|
|
183
184
|
inputMode: "numeric",
|
|
184
185
|
size: "l",
|
|
185
|
-
variant:
|
|
186
|
-
value:
|
|
186
|
+
variant: D ? "error" : "default",
|
|
187
|
+
value: A,
|
|
187
188
|
onChange: (n) => {
|
|
188
|
-
|
|
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:
|
|
195
|
-
className:
|
|
196
|
-
|
|
197
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
211
|
+
ae,
|
|
211
212
|
{
|
|
212
213
|
type: "text",
|
|
213
214
|
inputMode: "numeric",
|
|
214
215
|
size: "l",
|
|
215
|
-
variant:
|
|
216
|
-
value:
|
|
216
|
+
variant: F ? "error" : "default",
|
|
217
|
+
value: C,
|
|
217
218
|
onChange: (n) => {
|
|
218
|
-
|
|
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:
|
|
225
|
-
className:
|
|
226
|
-
|
|
227
|
-
|
|
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
|
-
|
|
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
|
-
|
|
234
|
+
F && /* @__PURE__ */ e("span", { className: "text-caption-sm text-[var(--color-text-error-bold)]", children: F })
|
|
234
235
|
] }),
|
|
235
|
-
|
|
236
|
-
|
|
236
|
+
N && (A !== "" || C !== "") && /* @__PURE__ */ e(
|
|
237
|
+
G,
|
|
237
238
|
{
|
|
238
239
|
variant: "default",
|
|
239
240
|
onClick: () => {
|
|
240
|
-
|
|
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
|
-
|
|
248
|
-
/* @__PURE__ */ e("div", { className: "text-body-medium-sm text-[var(--color-text-tertiary)]", children:
|
|
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(
|
|
253
|
-
/* @__PURE__ */ e(
|
|
254
|
-
/* @__PURE__ */ e(
|
|
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
|
-
|
|
258
|
-
/* @__PURE__ */ e("p", { className: "text-body-sm text-[var(--color-text-secondary)]", children:
|
|
259
|
-
|
|
260
|
-
|
|
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:
|
|
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
|
|
267
|
-
|
|
268
|
-
const
|
|
269
|
-
|
|
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:
|
|
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
|
-
|
|
277
|
-
|
|
277
|
+
Y === "month" && /* @__PURE__ */ e(
|
|
278
|
+
Le,
|
|
278
279
|
{
|
|
279
|
-
value:
|
|
280
|
+
value: l,
|
|
280
281
|
onChange: (n) => {
|
|
281
|
-
b(n),
|
|
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) =>
|
|
288
|
-
minDate:
|
|
289
|
-
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
|
-
|
|
295
|
-
const
|
|
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":
|
|
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:
|
|
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
|
-
|
|
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: () =>
|
|
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: () =>
|
|
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: () =>
|
|
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
|
-
|
|
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
|
-
|
|
349
|
+
pe,
|
|
349
350
|
{
|
|
350
|
-
id: `checkbox-${
|
|
351
|
-
checked: h.includes(
|
|
352
|
-
onCheckedChange: () =>
|
|
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-${
|
|
359
|
+
htmlFor: `checkbox-${t.id}-${p.value}`,
|
|
359
360
|
className: "flex-1 text-body-md text-[var(--color-text-primary)] cursor-pointer",
|
|
360
|
-
children:
|
|
361
|
+
children: p.label
|
|
361
362
|
}
|
|
362
363
|
)
|
|
363
364
|
] }),
|
|
364
|
-
|
|
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
|
-
|
|
367
|
+
pe,
|
|
367
368
|
{
|
|
368
|
-
id: `checkbox-${
|
|
369
|
-
checked: h.includes(
|
|
370
|
-
onCheckedChange: () =>
|
|
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-${
|
|
377
|
+
htmlFor: `checkbox-${t.id}-${f.value}`,
|
|
377
378
|
className: "flex-1 text-body-md text-[var(--color-text-primary)] cursor-pointer",
|
|
378
|
-
children:
|
|
379
|
+
children: f.label
|
|
379
380
|
}
|
|
380
381
|
)
|
|
381
|
-
] },
|
|
382
|
-
] },
|
|
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(
|
|
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-${
|
|
389
|
+
htmlFor: `radio-${t.id}-${p.value}`,
|
|
389
390
|
className: "flex-1 text-body-md text-[var(--color-text-primary)] cursor-pointer",
|
|
390
|
-
children:
|
|
391
|
+
children: p.label
|
|
391
392
|
}
|
|
392
393
|
)
|
|
393
394
|
] }),
|
|
394
|
-
|
|
395
|
-
/* @__PURE__ */ e(
|
|
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-${
|
|
400
|
+
htmlFor: `radio-${t.id}-${f.value}`,
|
|
400
401
|
className: "flex-1 text-body-md text-[var(--color-text-primary)] cursor-pointer",
|
|
401
|
-
children:
|
|
402
|
+
children: f.label
|
|
402
403
|
}
|
|
403
404
|
)
|
|
404
|
-
] },
|
|
405
|
-
] },
|
|
405
|
+
] }, f.value))
|
|
406
|
+
] }, p.value)) }) })
|
|
406
407
|
]
|
|
407
408
|
},
|
|
408
409
|
n.label
|
|
409
410
|
);
|
|
410
411
|
})
|
|
411
412
|
] });
|
|
412
|
-
}),
|
|
413
|
-
const
|
|
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-${
|
|
418
|
+
id: `filter-option-${t.id}`,
|
|
418
419
|
role: "option",
|
|
419
|
-
"aria-selected":
|
|
420
|
-
"aria-label": `${
|
|
420
|
+
"aria-selected": l,
|
|
421
|
+
"aria-label": `${t.label}${N ? `, ${N} selected` : ""}`,
|
|
421
422
|
tabIndex: -1,
|
|
422
|
-
onKeyDown: (
|
|
423
|
-
(
|
|
423
|
+
onKeyDown: (C) => {
|
|
424
|
+
(C.key === "Enter" || C.key === " ") && (C.preventDefault(), w());
|
|
424
425
|
},
|
|
425
426
|
onMouseEnter: () => {
|
|
426
|
-
|
|
427
|
+
L(!0), z?.();
|
|
427
428
|
},
|
|
428
|
-
onMouseLeave: () =>
|
|
429
|
-
className:
|
|
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
|
-
|
|
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:
|
|
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(
|
|
438
|
+
/* @__PURE__ */ e(g, { className: E(
|
|
438
439
|
"h-[var(--size-2xs)] w-[var(--size-2xs)] shrink-0",
|
|
439
|
-
|
|
440
|
+
l ? "text-[var(--color-text-brand-bold)]" : "text-[var(--color-text-primary)]"
|
|
440
441
|
) }),
|
|
441
|
-
/* @__PURE__ */ e("div", { className:
|
|
442
|
+
/* @__PURE__ */ e("div", { className: E(
|
|
442
443
|
"truncate [&]:text-label-md",
|
|
443
|
-
|
|
444
|
-
), children:
|
|
445
|
-
|
|
446
|
-
|
|
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:
|
|
450
|
-
appearance:
|
|
451
|
-
children:
|
|
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
|
-
|
|
457
|
+
G,
|
|
457
458
|
{
|
|
458
459
|
variant: "ghost",
|
|
459
460
|
size: "s",
|
|
460
461
|
tabIndex: -1,
|
|
461
|
-
"aria-label": b ? `Unpin ${
|
|
462
|
+
"aria-label": b ? `Unpin ${t.label} filter` : `Pin ${t.label} filter`,
|
|
462
463
|
"aria-pressed": b,
|
|
463
|
-
onClick: (
|
|
464
|
-
|
|
464
|
+
onClick: (C) => {
|
|
465
|
+
C.stopPropagation(), k();
|
|
465
466
|
},
|
|
466
|
-
className:
|
|
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(
|
|
471
|
+
children: b ? /* @__PURE__ */ v(se, { children: [
|
|
471
472
|
/* @__PURE__ */ e(
|
|
472
|
-
|
|
473
|
+
_,
|
|
473
474
|
{
|
|
474
|
-
name:
|
|
475
|
+
name: ue,
|
|
475
476
|
"aria-hidden": "true",
|
|
476
|
-
className:
|
|
477
|
+
className: E(
|
|
477
478
|
"h-[12px] w-[12px] group-hover/pin:hidden",
|
|
478
|
-
|
|
479
|
+
l ? "text-[var(--color-text-brand-bold)]" : "text-[var(--color-text-primary)]"
|
|
479
480
|
)
|
|
480
481
|
}
|
|
481
482
|
),
|
|
482
483
|
/* @__PURE__ */ e(
|
|
483
|
-
|
|
484
|
+
_,
|
|
484
485
|
{
|
|
485
|
-
name:
|
|
486
|
+
name: ke,
|
|
486
487
|
"aria-hidden": "true",
|
|
487
|
-
className:
|
|
488
|
+
className: E(
|
|
488
489
|
"h-[12px] w-[12px] hidden group-hover/pin:block",
|
|
489
|
-
|
|
490
|
+
l ? "text-[var(--color-text-brand-bold)]" : "text-[var(--color-text-primary)]"
|
|
490
491
|
)
|
|
491
492
|
}
|
|
492
493
|
)
|
|
493
494
|
] }) : /* @__PURE__ */ e(
|
|
494
|
-
|
|
495
|
+
_,
|
|
495
496
|
{
|
|
496
|
-
name:
|
|
497
|
+
name: ue,
|
|
497
498
|
"aria-hidden": "true",
|
|
498
|
-
className:
|
|
499
|
+
className: E(
|
|
499
500
|
"h-[12px] w-[12px]",
|
|
500
|
-
|
|
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
|
|
511
|
-
const [
|
|
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
|
-
|
|
514
|
+
ae,
|
|
514
515
|
{
|
|
515
516
|
type: "search",
|
|
516
517
|
"aria-label": "Search filters by keyword",
|
|
517
518
|
placeholder: x,
|
|
518
|
-
value:
|
|
519
|
-
onChange: (
|
|
520
|
-
onKeyDown: (
|
|
521
|
-
|
|
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
|
|
528
|
+
function Ye({
|
|
528
529
|
placeholder: x = "Search for keyword...",
|
|
529
|
-
onAddSearchTerm:
|
|
530
|
-
suggestions:
|
|
530
|
+
onAddSearchTerm: t,
|
|
531
|
+
suggestions: l,
|
|
531
532
|
minCharacters: b
|
|
532
533
|
}) {
|
|
533
|
-
const [
|
|
534
|
+
const [N, w] = c.useState("");
|
|
534
535
|
return /* @__PURE__ */ e("div", { className: "min-w-[200px] w-[280px]", children: /* @__PURE__ */ e(
|
|
535
|
-
|
|
536
|
+
Se,
|
|
536
537
|
{
|
|
537
|
-
value:
|
|
538
|
-
onValueChange:
|
|
539
|
-
onSelect: (
|
|
540
|
-
|
|
538
|
+
value: N,
|
|
539
|
+
onValueChange: w,
|
|
540
|
+
onSelect: (z, g) => {
|
|
541
|
+
t(z, g), w("");
|
|
541
542
|
},
|
|
542
|
-
suggestions:
|
|
543
|
+
suggestions: l,
|
|
543
544
|
placeholder: x,
|
|
544
545
|
minCharacters: b
|
|
545
546
|
}
|
|
546
547
|
) });
|
|
547
548
|
}
|
|
548
|
-
function
|
|
549
|
+
function Ue({
|
|
549
550
|
filters: x,
|
|
550
|
-
pinnedFilters:
|
|
551
|
-
activeFilters:
|
|
551
|
+
pinnedFilters: t,
|
|
552
|
+
activeFilters: l,
|
|
552
553
|
onPinnedFiltersChange: b,
|
|
553
|
-
onFilterChange:
|
|
554
|
-
sidebarWidth:
|
|
554
|
+
onFilterChange: N,
|
|
555
|
+
sidebarWidth: w = 240
|
|
555
556
|
}) {
|
|
556
|
-
const [k,
|
|
557
|
-
const
|
|
558
|
-
let
|
|
559
|
-
switch (
|
|
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
|
-
|
|
562
|
+
d.preventDefault(), I = Math.min(S + 1, C.length - 1);
|
|
562
563
|
break;
|
|
563
564
|
case "ArrowUp":
|
|
564
|
-
|
|
565
|
+
d.preventDefault(), I = Math.max(S - 1, 0);
|
|
565
566
|
break;
|
|
566
567
|
case "Home":
|
|
567
|
-
|
|
568
|
+
d.preventDefault(), I = 0;
|
|
568
569
|
break;
|
|
569
570
|
case "End":
|
|
570
|
-
|
|
571
|
+
d.preventDefault(), I = C.length - 1;
|
|
571
572
|
break;
|
|
572
573
|
default:
|
|
573
574
|
return;
|
|
574
575
|
}
|
|
575
|
-
|
|
576
|
-
},
|
|
577
|
-
|
|
578
|
-
}, [
|
|
579
|
-
|
|
580
|
-
}, [
|
|
581
|
-
const
|
|
582
|
-
b(
|
|
583
|
-
},
|
|
584
|
-
const
|
|
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 ? (
|
|
587
|
-
}), { grouped:
|
|
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
|
|
595
|
+
style: { width: typeof w == "number" ? `${w}px` : w },
|
|
595
596
|
children: /* @__PURE__ */ v(
|
|
596
597
|
"div",
|
|
597
598
|
{
|
|
598
|
-
ref:
|
|
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:
|
|
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
|
-
|
|
608
|
-
const
|
|
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
|
-
|
|
611
|
+
fe,
|
|
611
612
|
{
|
|
612
|
-
filter:
|
|
613
|
-
isSelected:
|
|
614
|
-
isPinned:
|
|
615
|
-
valueCount:
|
|
613
|
+
filter: d,
|
|
614
|
+
isSelected: d.id === k,
|
|
615
|
+
isPinned: t.includes(d.id),
|
|
616
|
+
valueCount: I,
|
|
616
617
|
onSelect: () => {
|
|
617
|
-
|
|
618
|
+
A("mouse"), z(d.id);
|
|
618
619
|
},
|
|
619
|
-
onTogglePin: () =>
|
|
620
|
+
onTogglePin: () => R(d.id)
|
|
620
621
|
},
|
|
621
|
-
|
|
622
|
+
d.id
|
|
622
623
|
);
|
|
623
624
|
}),
|
|
624
|
-
|
|
625
|
-
const
|
|
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:
|
|
628
|
+
/* @__PURE__ */ e("div", { className: E(
|
|
628
629
|
"px-[var(--space-m)] pb-[var(--space-xs)]",
|
|
629
|
-
|
|
630
|
-
), children: /* @__PURE__ */ e("div", { className: "text-caption-sm text-[var(--color-text-tertiary)] tracking-[0.1px]", children:
|
|
631
|
-
|
|
632
|
-
const
|
|
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
|
-
|
|
635
|
+
fe,
|
|
635
636
|
{
|
|
636
637
|
filter: h,
|
|
637
638
|
isSelected: h.id === k,
|
|
638
|
-
isPinned:
|
|
639
|
-
valueCount:
|
|
639
|
+
isPinned: t.includes(h.id),
|
|
640
|
+
valueCount: W,
|
|
640
641
|
onSelect: () => {
|
|
641
|
-
|
|
642
|
+
A("mouse"), z(h.id);
|
|
642
643
|
},
|
|
643
|
-
onTogglePin: () =>
|
|
644
|
+
onTogglePin: () => R(h.id)
|
|
644
645
|
},
|
|
645
646
|
h.id
|
|
646
647
|
);
|
|
647
648
|
})
|
|
648
|
-
] },
|
|
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:
|
|
656
|
-
|
|
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:
|
|
659
|
-
value:
|
|
660
|
-
onChange:
|
|
661
|
-
onReset:
|
|
662
|
-
autoFocusSearch:
|
|
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
|
|
668
|
+
function ur({
|
|
668
669
|
filters: x,
|
|
669
|
-
pinnedFilters:
|
|
670
|
-
activeFilters:
|
|
670
|
+
pinnedFilters: t,
|
|
671
|
+
activeFilters: l,
|
|
671
672
|
onPinnedFiltersChange: b,
|
|
672
|
-
onFilterChange:
|
|
673
|
-
onFilterClear:
|
|
673
|
+
onFilterChange: N,
|
|
674
|
+
onFilterClear: w,
|
|
674
675
|
onFilterReset: k,
|
|
675
|
-
enableGlobalSearch:
|
|
676
|
-
globalSearchTerms:
|
|
677
|
-
onGlobalSearchChange:
|
|
678
|
-
globalSearchPlaceholder:
|
|
679
|
-
enableAutocomplete:
|
|
680
|
-
autocompleteMinCharacters:
|
|
681
|
-
hideReset:
|
|
682
|
-
hideFiltersButton:
|
|
683
|
-
actionButtons:
|
|
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 [
|
|
686
|
-
const o =
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
}, 0);
|
|
690
|
-
}, [
|
|
691
|
-
|
|
692
|
-
const
|
|
693
|
-
(
|
|
694
|
-
).length, i = Object.keys(
|
|
695
|
-
(
|
|
696
|
-
).length,
|
|
697
|
-
let
|
|
698
|
-
if (o !== i && (o > i ?
|
|
699
|
-
const
|
|
700
|
-
|
|
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
|
-
|
|
703
|
-
}, [
|
|
704
|
-
const
|
|
705
|
-
(
|
|
706
|
-
),
|
|
707
|
-
(
|
|
708
|
-
const a =
|
|
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,
|
|
712
|
-
if (!
|
|
713
|
-
for (const o of
|
|
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
|
|
718
|
-
if (
|
|
718
|
+
const s = i.children.find(($) => $.value === a);
|
|
719
|
+
if (s) return s.label;
|
|
719
720
|
}
|
|
720
721
|
}
|
|
721
722
|
return a;
|
|
722
|
-
},
|
|
723
|
-
const i = o?.prefix || "",
|
|
724
|
-
return
|
|
725
|
-
},
|
|
726
|
-
const a =
|
|
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:
|
|
729
|
-
if (
|
|
730
|
-
const [o, i] = a,
|
|
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
|
-
) ??
|
|
734
|
-
return { type: "values", icon:
|
|
734
|
+
) ?? P(o, i, r.numberConfig);
|
|
735
|
+
return { type: "values", icon: r.icon, content: s };
|
|
735
736
|
}
|
|
736
|
-
if (
|
|
737
|
-
const [o, i] = a,
|
|
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
|
-
) ??
|
|
741
|
-
return { type: "values", icon:
|
|
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 =
|
|
746
|
-
return { type: "values", icon:
|
|
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:
|
|
751
|
-
label:
|
|
751
|
+
icon: r.icon,
|
|
752
|
+
label: r.label,
|
|
752
753
|
count: a.length
|
|
753
754
|
};
|
|
754
|
-
return { type: "values", icon:
|
|
755
|
-
},
|
|
756
|
-
|
|
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
|
-
|
|
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
|
|
768
|
-
o(
|
|
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((
|
|
809
|
+
o(i.label), i.children?.forEach((s) => o(s.label));
|
|
771
810
|
});
|
|
772
811
|
}
|
|
773
|
-
return
|
|
774
|
-
}, [x]),
|
|
775
|
-
if (!
|
|
776
|
-
const a =
|
|
777
|
-
for (const o of
|
|
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
|
-
}, [
|
|
820
|
+
}, [q]), ye = c.useMemo(() => g.filter((a) => a && typeof a == "string").map((a) => {
|
|
782
821
|
if (a.includes("|")) {
|
|
783
|
-
const [i,
|
|
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:
|
|
788
|
-
filterId:
|
|
789
|
-
icon:
|
|
826
|
+
matchedFilter: $ ? {
|
|
827
|
+
filterId: $.id,
|
|
828
|
+
icon: $.icon
|
|
790
829
|
} : void 0
|
|
791
830
|
};
|
|
792
831
|
}
|
|
793
|
-
const o =
|
|
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
|
-
}), [
|
|
802
|
-
if (!
|
|
840
|
+
}), [g, x, le]), Ne = c.useMemo(() => {
|
|
841
|
+
if (!C || !z)
|
|
803
842
|
return [];
|
|
804
|
-
const
|
|
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 &&
|
|
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((
|
|
814
|
-
|
|
815
|
-
label:
|
|
816
|
-
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 &&
|
|
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 &&
|
|
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
|
-
}),
|
|
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,
|
|
842
|
-
if (
|
|
843
|
-
const o = a ? `${
|
|
844
|
-
|
|
845
|
-
},
|
|
846
|
-
|
|
847
|
-
},
|
|
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:
|
|
897
|
+
children: j
|
|
859
898
|
}
|
|
860
899
|
),
|
|
861
|
-
|
|
862
|
-
/* @__PURE__ */ e(
|
|
863
|
-
|
|
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${
|
|
867
|
-
"aria-expanded":
|
|
905
|
+
"aria-label": `Filters${f > 0 ? `, ${f} active` : ""}`,
|
|
906
|
+
"aria-expanded": R,
|
|
868
907
|
"aria-haspopup": "dialog",
|
|
869
908
|
children: [
|
|
870
|
-
/* @__PURE__ */ e(
|
|
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
|
-
|
|
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
|
-
|
|
916
|
+
xe,
|
|
878
917
|
{
|
|
879
918
|
className: "w-[660px] p-0",
|
|
880
919
|
align: "start",
|
|
881
920
|
children: /* @__PURE__ */ e(
|
|
882
|
-
|
|
921
|
+
Ue,
|
|
883
922
|
{
|
|
884
923
|
filters: x,
|
|
885
|
-
pinnedFilters:
|
|
886
|
-
activeFilters:
|
|
924
|
+
pinnedFilters: t,
|
|
925
|
+
activeFilters: l,
|
|
887
926
|
onPinnedFiltersChange: b,
|
|
888
|
-
onFilterChange:
|
|
927
|
+
onFilterChange: N
|
|
889
928
|
}
|
|
890
929
|
)
|
|
891
930
|
}
|
|
892
931
|
)
|
|
893
932
|
] }),
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
const a =
|
|
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
|
-
|
|
937
|
+
Pe,
|
|
899
938
|
{
|
|
900
|
-
open:
|
|
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__ */
|
|
904
|
-
|
|
941
|
+
/* @__PURE__ */ v(
|
|
942
|
+
ve,
|
|
905
943
|
{
|
|
906
|
-
|
|
907
|
-
|
|
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(
|
|
924
|
-
"
|
|
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
|
-
|
|
938
|
-
|
|
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
|
-
|
|
944
|
-
|
|
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:
|
|
947
|
-
|
|
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
|
-
|
|
1025
|
+
r.id
|
|
977
1026
|
);
|
|
978
|
-
}) }),
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
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:
|
|
984
|
-
onAddSearchTerm:
|
|
1032
|
+
placeholder: L,
|
|
1033
|
+
onAddSearchTerm: ie
|
|
985
1034
|
}
|
|
986
1035
|
),
|
|
987
|
-
|
|
988
|
-
|
|
1036
|
+
z && C && /* @__PURE__ */ e(
|
|
1037
|
+
Ye,
|
|
989
1038
|
{
|
|
990
|
-
placeholder:
|
|
991
|
-
onAddSearchTerm:
|
|
992
|
-
suggestions:
|
|
993
|
-
minCharacters:
|
|
1039
|
+
placeholder: L,
|
|
1040
|
+
onAddSearchTerm: ie,
|
|
1041
|
+
suggestions: Ne,
|
|
1042
|
+
minCharacters: V
|
|
994
1043
|
}
|
|
995
1044
|
),
|
|
996
|
-
|
|
997
|
-
const a =
|
|
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
|
-
|
|
1055
|
+
G,
|
|
1007
1056
|
{
|
|
1008
1057
|
variant: "ghost",
|
|
1009
1058
|
size: "s",
|
|
1010
1059
|
"aria-label": `Remove search term: ${o}`,
|
|
1011
|
-
onClick: () =>
|
|
1060
|
+
onClick: () => we(r.value),
|
|
1012
1061
|
className: "h-auto w-auto p-[var(--space-xs)]",
|
|
1013
|
-
children: /* @__PURE__ */ e(
|
|
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
|
-
|
|
1067
|
+
r.value
|
|
1019
1068
|
);
|
|
1020
1069
|
}),
|
|
1021
|
-
!
|
|
1022
|
-
!
|
|
1023
|
-
|
|
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:
|
|
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
|
-
|
|
1033
|
-
|
|
1081
|
+
F && /* @__PURE__ */ e("div", { className: "flex-1" }),
|
|
1082
|
+
F
|
|
1034
1083
|
] });
|
|
1035
1084
|
}
|
|
1036
1085
|
export {
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
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
|
};
|