@rafal.lemieszewski/tide-ui 0.85.1 → 0.87.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/fundamental/breadcrumb.cjs +1 -1
- package/dist/cjs/components/fundamental/button.cjs +1 -1
- package/dist/cjs/components/fundamental/calendar.cjs +1 -1
- package/dist/cjs/components/fundamental/country-dropdown.cjs +1 -1
- package/dist/cjs/components/fundamental/custom-icons.cjs +1 -1
- package/dist/cjs/components/fundamental/dialog.cjs +1 -1
- package/dist/cjs/components/fundamental/file-upload.cjs +1 -1
- package/dist/cjs/components/fundamental/icon.cjs +1 -1
- package/dist/cjs/components/fundamental/month-picker.cjs +1 -1
- package/dist/cjs/components/fundamental/pagination.cjs +1 -1
- package/dist/cjs/components/fundamental/select.cjs +1 -1
- package/dist/cjs/components/fundamental/separator.cjs +1 -1
- package/dist/cjs/components/fundamental/sidebar.cjs +1 -1
- package/dist/cjs/components/fundamental/toast.cjs +1 -1
- package/dist/cjs/components/fundamental/tree.cjs +1 -1
- package/dist/cjs/components/product/app-frame.cjs +1 -1
- package/dist/cjs/components/product/attributes-list.cjs +1 -1
- package/dist/cjs/components/product/bookmarks.cjs +1 -1
- package/dist/cjs/components/product/data-table-settings-menu.cjs +1 -1
- package/dist/cjs/components/product/data-table.cjs +1 -1
- package/dist/cjs/components/product/filters.cjs +1 -1
- package/dist/cjs/components/product/fixture-status.cjs +1 -1
- package/dist/cjs/components/product/linked-chart.cjs +1 -1
- package/dist/cjs/components/product/view-mode-menu.cjs +1 -1
- package/dist/es/components/fundamental/button.js +10 -9
- package/dist/es/components/fundamental/calendar.js +18 -17
- package/dist/es/components/fundamental/custom-icons.js +283 -517
- package/dist/es/components/fundamental/dialog.js +25 -24
- package/dist/es/components/fundamental/file-upload.js +17 -16
- package/dist/es/components/fundamental/icon.js +68 -147
- package/dist/es/components/fundamental/month-picker.js +21 -20
- package/dist/es/components/fundamental/pagination.js +44 -43
- package/dist/es/components/fundamental/select.js +40 -39
- package/dist/es/components/fundamental/separator.js +11 -10
- package/dist/es/components/fundamental/sidebar.js +85 -84
- package/dist/es/components/fundamental/toast.js +8 -7
- package/dist/es/components/product/app-frame.js +83 -82
- package/dist/es/components/product/attributes-list.js +61 -60
- package/dist/es/components/product/bookmarks.js +170 -169
- package/dist/es/components/product/data-table-settings-menu.js +38 -37
- package/dist/es/components/product/data-table.js +374 -373
- package/dist/es/components/product/filters.js +93 -92
- package/dist/es/components/product/fixture-status.js +89 -87
- package/dist/es/components/product/linked-chart.js +54 -53
- package/dist/es/components/product/view-mode-menu.js +176 -175
- package/dist/types/components/core-index.d.cts +1 -1
- package/dist/types/components/core-index.d.ts +1 -1
- package/dist/types/components/fundamental/custom-icons.d.ts +32 -36
- package/dist/types/components/fundamental/dropdown-menu.d.ts +2 -1
- package/dist/types/components/fundamental/icon.d.ts +1 -3
- package/dist/types/components/index.d.ts +2 -1
- package/dist/types/components/product/fixture-status.d.ts +2 -2
- package/dist/types/lib/index.d.cts +1 -1
- package/dist/types/lib/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -3,18 +3,19 @@ import * as u from "react";
|
|
|
3
3
|
import { cn as D } from "../../lib/utils.js";
|
|
4
4
|
import { Button as Q } from "../fundamental/button.js";
|
|
5
5
|
import { Input as ee } from "../fundamental/input.js";
|
|
6
|
-
import { AutocompleteSearch as
|
|
6
|
+
import { AutocompleteSearch as he } from "../fundamental/autocomplete-search.js";
|
|
7
7
|
import { Icon as H } from "../fundamental/icon.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
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";
|
|
14
15
|
import { Separator as re } from "../fundamental/separator.js";
|
|
15
16
|
import { Badge as te } from "../fundamental/badge.js";
|
|
16
|
-
import { getPresetLabel as
|
|
17
|
-
const
|
|
17
|
+
import { getPresetLabel as $e, calculatePresetRange as pe, formatDateRange as Ie } from "../../lib/date-utils.js";
|
|
18
|
+
const Ae = [
|
|
18
19
|
"this-month",
|
|
19
20
|
"last-month",
|
|
20
21
|
"this-quarter",
|
|
@@ -22,7 +23,7 @@ const Se = [
|
|
|
22
23
|
"this-year",
|
|
23
24
|
"last-year",
|
|
24
25
|
"custom"
|
|
25
|
-
],
|
|
26
|
+
], ze = [
|
|
26
27
|
"this-week",
|
|
27
28
|
"last-week",
|
|
28
29
|
"last-30-days",
|
|
@@ -31,7 +32,7 @@ const Se = [
|
|
|
31
32
|
"last-month",
|
|
32
33
|
"custom"
|
|
33
34
|
];
|
|
34
|
-
function
|
|
35
|
+
function De(x) {
|
|
35
36
|
let r = 0;
|
|
36
37
|
if (x.groups)
|
|
37
38
|
for (const s of x.groups)
|
|
@@ -39,8 +40,8 @@ function $e(x) {
|
|
|
39
40
|
r++, b.children && (r += b.children.length);
|
|
40
41
|
return x.options && (r = x.options.length), r;
|
|
41
42
|
}
|
|
42
|
-
const
|
|
43
|
-
const [k, A] = u.useState(""), f = u.useDeferredValue(k), [$, M] = u.useState(""), [w, R] = u.useState(""), [I,
|
|
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]);
|
|
44
45
|
u.useEffect(() => {
|
|
45
46
|
if (r.type === "number" && r.rangeMode) {
|
|
46
47
|
const n = s;
|
|
@@ -48,14 +49,14 @@ const pe = /* @__PURE__ */ u.memo(function({ filter: r, value: s, onChange: b, o
|
|
|
48
49
|
const [d, p] = n;
|
|
49
50
|
M(d === -1 / 0 ? "" : d?.toString() || ""), R(p === 1 / 0 ? "" : p?.toString() || "");
|
|
50
51
|
} else typeof n == "number" ? (M(n.toString()), R("")) : (M(""), R(""));
|
|
51
|
-
|
|
52
|
+
P(null), E(null);
|
|
52
53
|
}
|
|
53
54
|
}, [s, r.type, r.rangeMode]);
|
|
54
55
|
const F = u.useMemo(() => {
|
|
55
56
|
const n = r.showSearch ?? "auto";
|
|
56
57
|
if (n === !0) return !0;
|
|
57
58
|
if (n === !1) return !1;
|
|
58
|
-
const d =
|
|
59
|
+
const d = De(r), p = r.searchThreshold ?? 8;
|
|
59
60
|
return d >= p;
|
|
60
61
|
}, [r]), B = u.useMemo(() => {
|
|
61
62
|
if (r.groups) {
|
|
@@ -83,7 +84,7 @@ const pe = /* @__PURE__ */ u.memo(function({ filter: r, value: s, onChange: b, o
|
|
|
83
84
|
b(d.length > 0 ? d : void 0);
|
|
84
85
|
} else
|
|
85
86
|
b(n === h[0] ? void 0 : n);
|
|
86
|
-
},
|
|
87
|
+
}, X = (n) => {
|
|
87
88
|
if (r.type !== "multiselect") return;
|
|
88
89
|
const d = n.options.flatMap(
|
|
89
90
|
(m) => [m.value, ...m.children?.map((N) => N.value) || []]
|
|
@@ -95,36 +96,36 @@ const pe = /* @__PURE__ */ u.memo(function({ filter: r, value: s, onChange: b, o
|
|
|
95
96
|
(m) => [m.value, ...m.children?.map((N) => N.value) || []]
|
|
96
97
|
), p = Array.from(/* @__PURE__ */ new Set([...h, ...d]));
|
|
97
98
|
b(p.length > 0 ? p : void 0);
|
|
98
|
-
},
|
|
99
|
+
}, J = (n) => {
|
|
99
100
|
if (r.type !== "multiselect") return;
|
|
100
|
-
const p = n.options.filter((
|
|
101
|
-
const W =
|
|
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(
|
|
102
103
|
(a) => !k || a.label.toLowerCase().includes(k.toLowerCase())
|
|
103
104
|
).map((a) => a.value) || [];
|
|
104
105
|
return [W, ...t];
|
|
105
|
-
}), m = h.filter((
|
|
106
|
+
}), m = h.filter((O) => !p.includes(O)), N = p.filter((O) => !h.includes(O)), G = [...m, ...N];
|
|
106
107
|
b(G.length > 0 ? G : void 0);
|
|
107
108
|
}, _ = () => {
|
|
108
109
|
const n = $.trim(), d = w.trim();
|
|
109
|
-
if (
|
|
110
|
+
if (P(null), E(null), n === "" && d === "") {
|
|
110
111
|
b(void 0);
|
|
111
112
|
return;
|
|
112
113
|
}
|
|
113
114
|
const p = n === "" ? -1 / 0 : parseFloat(n), m = d === "" ? 1 / 0 : parseFloat(d);
|
|
114
115
|
if (n !== "" && isNaN(p)) {
|
|
115
|
-
|
|
116
|
+
P("Invalid minimum value");
|
|
116
117
|
return;
|
|
117
118
|
}
|
|
118
119
|
if (d !== "" && isNaN(m)) {
|
|
119
|
-
|
|
120
|
+
E("Invalid maximum value");
|
|
120
121
|
return;
|
|
121
122
|
}
|
|
122
123
|
if (p !== -1 / 0 && m !== 1 / 0 && p > m) {
|
|
123
|
-
|
|
124
|
+
P("Minimum must be less than maximum"), E("Maximum must be more than minimum");
|
|
124
125
|
return;
|
|
125
126
|
}
|
|
126
127
|
b([p, m]);
|
|
127
|
-
}, j = r.dateConfig?.granularity || "month", U = () => r.dateConfig?.presets ? r.dateConfig.presets : j === "day" ?
|
|
128
|
+
}, j = r.dateConfig?.granularity || "month", U = () => r.dateConfig?.presets ? r.dateConfig.presets : j === "day" ? ze : Ae, Z = () => {
|
|
128
129
|
if (K)
|
|
129
130
|
return "custom";
|
|
130
131
|
const n = s;
|
|
@@ -132,7 +133,7 @@ const pe = /* @__PURE__ */ u.memo(function({ filter: r, value: s, onChange: b, o
|
|
|
132
133
|
return U().includes("all-time") ? "all-time" : "";
|
|
133
134
|
for (const d of U()) {
|
|
134
135
|
if (d === "custom") continue;
|
|
135
|
-
const p =
|
|
136
|
+
const p = pe(d);
|
|
136
137
|
if (p && p[0].getTime() === n[0].getTime() && p[1].getTime() === n[1].getTime())
|
|
137
138
|
return d;
|
|
138
139
|
}
|
|
@@ -143,7 +144,7 @@ const pe = /* @__PURE__ */ u.memo(function({ filter: r, value: s, onChange: b, o
|
|
|
143
144
|
return;
|
|
144
145
|
}
|
|
145
146
|
c(!1);
|
|
146
|
-
const d =
|
|
147
|
+
const d = pe(n);
|
|
147
148
|
b(d);
|
|
148
149
|
};
|
|
149
150
|
return /* @__PURE__ */ v("div", { className: "flex flex-col gap-[var(--space-3xl)]", children: [
|
|
@@ -184,7 +185,7 @@ const pe = /* @__PURE__ */ u.memo(function({ filter: r, value: s, onChange: b, o
|
|
|
184
185
|
variant: I ? "error" : "default",
|
|
185
186
|
value: $,
|
|
186
187
|
onChange: (n) => {
|
|
187
|
-
M(n.target.value),
|
|
188
|
+
M(n.target.value), P(null);
|
|
188
189
|
},
|
|
189
190
|
onBlur: _,
|
|
190
191
|
onKeyDown: (n) => {
|
|
@@ -214,7 +215,7 @@ const pe = /* @__PURE__ */ u.memo(function({ filter: r, value: s, onChange: b, o
|
|
|
214
215
|
variant: T ? "error" : "default",
|
|
215
216
|
value: w,
|
|
216
217
|
onChange: (n) => {
|
|
217
|
-
R(n.target.value),
|
|
218
|
+
R(n.target.value), E(null);
|
|
218
219
|
},
|
|
219
220
|
onBlur: _,
|
|
220
221
|
onKeyDown: (n) => {
|
|
@@ -236,7 +237,7 @@ const pe = /* @__PURE__ */ u.memo(function({ filter: r, value: s, onChange: b, o
|
|
|
236
237
|
{
|
|
237
238
|
variant: "default",
|
|
238
239
|
onClick: () => {
|
|
239
|
-
M(""), R(""),
|
|
240
|
+
M(""), R(""), P(null), E(null), g();
|
|
240
241
|
},
|
|
241
242
|
className: "self-start",
|
|
242
243
|
children: /* @__PURE__ */ e("span", { className: "text-body-medium-sm", children: "Reset" })
|
|
@@ -248,15 +249,15 @@ const pe = /* @__PURE__ */ u.memo(function({ filter: r, value: s, onChange: b, o
|
|
|
248
249
|
/* @__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" }) }),
|
|
249
250
|
/* @__PURE__ */ v("div", { className: "flex flex-col gap-[var(--space-s)]", children: [
|
|
250
251
|
/* @__PURE__ */ e("label", { className: "text-label-md text-[var(--color-text-primary)]", children: "Date range" }),
|
|
251
|
-
/* @__PURE__ */ v(
|
|
252
|
-
/* @__PURE__ */ e(
|
|
253
|
-
/* @__PURE__ */ e(
|
|
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)) })
|
|
254
255
|
] })
|
|
255
256
|
] }),
|
|
256
257
|
Z() === "custom" && /* @__PURE__ */ v(ne, { children: [
|
|
257
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" }),
|
|
258
259
|
j === "day" && /* @__PURE__ */ e(
|
|
259
|
-
|
|
260
|
+
ke,
|
|
260
261
|
{
|
|
261
262
|
mode: "range",
|
|
262
263
|
selected: s && Array.isArray(s) && s.length === 2 ? { from: s[0], to: s[1] } : void 0,
|
|
@@ -273,7 +274,7 @@ const pe = /* @__PURE__ */ u.memo(function({ filter: r, value: s, onChange: b, o
|
|
|
273
274
|
}
|
|
274
275
|
),
|
|
275
276
|
j === "month" && /* @__PURE__ */ e(
|
|
276
|
-
|
|
277
|
+
Se,
|
|
277
278
|
{
|
|
278
279
|
value: s,
|
|
279
280
|
onChange: (n) => {
|
|
@@ -322,7 +323,7 @@ const pe = /* @__PURE__ */ u.memo(function({ filter: r, value: s, onChange: b, o
|
|
|
322
323
|
/* @__PURE__ */ e(
|
|
323
324
|
"button",
|
|
324
325
|
{
|
|
325
|
-
onClick: () =>
|
|
326
|
+
onClick: () => J(n),
|
|
326
327
|
"aria-label": `Inverse selection in ${n.label}`,
|
|
327
328
|
className: "hover:text-[var(--color-text-brand-bold-hovered)] hover:underline",
|
|
328
329
|
children: "Inverse"
|
|
@@ -332,7 +333,7 @@ const pe = /* @__PURE__ */ u.memo(function({ filter: r, value: s, onChange: b, o
|
|
|
332
333
|
/* @__PURE__ */ e(
|
|
333
334
|
"button",
|
|
334
335
|
{
|
|
335
|
-
onClick: () =>
|
|
336
|
+
onClick: () => X(n),
|
|
336
337
|
"aria-label": `Clear all ${n.label} selections`,
|
|
337
338
|
className: "hover:text-[var(--color-text-brand-bold-hovered)] hover:underline",
|
|
338
339
|
children: "None"
|
|
@@ -344,7 +345,7 @@ const pe = /* @__PURE__ */ u.memo(function({ filter: r, value: s, onChange: b, o
|
|
|
344
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: [
|
|
345
346
|
/* @__PURE__ */ v("div", { className: "flex gap-[var(--space-s)] h-[20px] items-center", children: [
|
|
346
347
|
/* @__PURE__ */ e(
|
|
347
|
-
|
|
348
|
+
le,
|
|
348
349
|
{
|
|
349
350
|
id: `checkbox-${r.id}-${m.value}`,
|
|
350
351
|
checked: h.includes(m.value),
|
|
@@ -362,7 +363,7 @@ const pe = /* @__PURE__ */ u.memo(function({ filter: r, value: s, onChange: b, o
|
|
|
362
363
|
] }),
|
|
363
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: [
|
|
364
365
|
/* @__PURE__ */ e(
|
|
365
|
-
|
|
366
|
+
le,
|
|
366
367
|
{
|
|
367
368
|
id: `checkbox-${r.id}-${N.value}`,
|
|
368
369
|
checked: h.includes(N.value),
|
|
@@ -378,9 +379,9 @@ const pe = /* @__PURE__ */ u.memo(function({ filter: r, value: s, onChange: b, o
|
|
|
378
379
|
}
|
|
379
380
|
)
|
|
380
381
|
] }, N.value))
|
|
381
|
-
] }, m.value)) }) : /* @__PURE__ */ e(
|
|
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
383
|
/* @__PURE__ */ v("div", { className: "flex gap-[var(--space-s)] h-[20px] items-center", children: [
|
|
383
|
-
/* @__PURE__ */ e(
|
|
384
|
+
/* @__PURE__ */ e(ie, { id: `radio-${r.id}-${m.value}`, value: m.value }),
|
|
384
385
|
/* @__PURE__ */ e(
|
|
385
386
|
"label",
|
|
386
387
|
{
|
|
@@ -391,7 +392,7 @@ const pe = /* @__PURE__ */ u.memo(function({ filter: r, value: s, onChange: b, o
|
|
|
391
392
|
)
|
|
392
393
|
] }),
|
|
393
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: [
|
|
394
|
-
/* @__PURE__ */ e(
|
|
395
|
+
/* @__PURE__ */ e(ie, { id: `radio-${r.id}-${N.value}`, value: N.value }),
|
|
395
396
|
/* @__PURE__ */ e(
|
|
396
397
|
"label",
|
|
397
398
|
{
|
|
@@ -408,7 +409,7 @@ const pe = /* @__PURE__ */ u.memo(function({ filter: r, value: s, onChange: b, o
|
|
|
408
409
|
);
|
|
409
410
|
})
|
|
410
411
|
] });
|
|
411
|
-
}),
|
|
412
|
+
}), me = /* @__PURE__ */ u.memo(function({ filter: r, isSelected: s, isPinned: b, valueCount: g, onSelect: y, onTogglePin: k, onPrefetch: A }) {
|
|
412
413
|
const f = r.icon, [$, M] = u.useState(!1);
|
|
413
414
|
return /* @__PURE__ */ v(
|
|
414
415
|
"div",
|
|
@@ -470,7 +471,7 @@ const pe = /* @__PURE__ */ u.memo(function({ filter: r, value: s, onChange: b, o
|
|
|
470
471
|
/* @__PURE__ */ e(
|
|
471
472
|
H,
|
|
472
473
|
{
|
|
473
|
-
name:
|
|
474
|
+
name: se,
|
|
474
475
|
"aria-hidden": "true",
|
|
475
476
|
className: D(
|
|
476
477
|
"h-[12px] w-[12px] group-hover/pin:hidden",
|
|
@@ -481,7 +482,7 @@ const pe = /* @__PURE__ */ u.memo(function({ filter: r, value: s, onChange: b, o
|
|
|
481
482
|
/* @__PURE__ */ e(
|
|
482
483
|
H,
|
|
483
484
|
{
|
|
484
|
-
name:
|
|
485
|
+
name: be,
|
|
485
486
|
"aria-hidden": "true",
|
|
486
487
|
className: D(
|
|
487
488
|
"h-[12px] w-[12px] hidden group-hover/pin:block",
|
|
@@ -492,7 +493,7 @@ const pe = /* @__PURE__ */ u.memo(function({ filter: r, value: s, onChange: b, o
|
|
|
492
493
|
] }) : /* @__PURE__ */ e(
|
|
493
494
|
H,
|
|
494
495
|
{
|
|
495
|
-
name:
|
|
496
|
+
name: se,
|
|
496
497
|
"aria-hidden": "true",
|
|
497
498
|
className: D(
|
|
498
499
|
"h-[12px] w-[12px]",
|
|
@@ -506,7 +507,7 @@ const pe = /* @__PURE__ */ u.memo(function({ filter: r, value: s, onChange: b, o
|
|
|
506
507
|
}
|
|
507
508
|
);
|
|
508
509
|
});
|
|
509
|
-
function
|
|
510
|
+
function Me({ placeholder: x = "Search for keyword...", onAddSearchTerm: r }) {
|
|
510
511
|
const [s, b] = u.useState("");
|
|
511
512
|
return /* @__PURE__ */ e("div", { className: "min-w-[200px] w-[280px]", children: /* @__PURE__ */ e(
|
|
512
513
|
ee,
|
|
@@ -523,7 +524,7 @@ function Ie({ placeholder: x = "Search for keyword...", onAddSearchTerm: r }) {
|
|
|
523
524
|
}
|
|
524
525
|
) });
|
|
525
526
|
}
|
|
526
|
-
function
|
|
527
|
+
function Le({
|
|
527
528
|
placeholder: x = "Search for keyword...",
|
|
528
529
|
onAddSearchTerm: r,
|
|
529
530
|
suggestions: s,
|
|
@@ -531,7 +532,7 @@ function Ae({
|
|
|
531
532
|
}) {
|
|
532
533
|
const [g, y] = u.useState("");
|
|
533
534
|
return /* @__PURE__ */ e("div", { className: "min-w-[200px] w-[280px]", children: /* @__PURE__ */ e(
|
|
534
|
-
|
|
535
|
+
he,
|
|
535
536
|
{
|
|
536
537
|
value: g,
|
|
537
538
|
onValueChange: y,
|
|
@@ -544,7 +545,7 @@ function Ae({
|
|
|
544
545
|
}
|
|
545
546
|
) });
|
|
546
547
|
}
|
|
547
|
-
function
|
|
548
|
+
function Ee({
|
|
548
549
|
filters: x,
|
|
549
550
|
pinnedFilters: r,
|
|
550
551
|
activeFilters: s,
|
|
@@ -572,11 +573,11 @@ function ze({
|
|
|
572
573
|
return;
|
|
573
574
|
}
|
|
574
575
|
S !== C && ($("keyboard"), A(w[S]));
|
|
575
|
-
}, I = x.find((c) => c.id === k),
|
|
576
|
+
}, I = x.find((c) => c.id === k), P = u.useCallback((c) => {
|
|
576
577
|
I && g(I.id, c);
|
|
577
578
|
}, [I?.id, g]), T = u.useCallback(() => {
|
|
578
579
|
I && g(I.id, void 0);
|
|
579
|
-
}, [I?.id, g]),
|
|
580
|
+
}, [I?.id, g]), E = (c) => {
|
|
580
581
|
const C = r.includes(c) ? r.filter((S) => S !== c) : [...r, c];
|
|
581
582
|
b(C);
|
|
582
583
|
}, K = u.useMemo(() => {
|
|
@@ -606,7 +607,7 @@ function ze({
|
|
|
606
607
|
K.ungrouped.map((c) => {
|
|
607
608
|
const C = s[c.id], S = Array.isArray(C) ? C.length : C != null ? 1 : 0;
|
|
608
609
|
return /* @__PURE__ */ e(
|
|
609
|
-
|
|
610
|
+
me,
|
|
610
611
|
{
|
|
611
612
|
filter: c,
|
|
612
613
|
isSelected: c.id === k,
|
|
@@ -615,7 +616,7 @@ function ze({
|
|
|
615
616
|
onSelect: () => {
|
|
616
617
|
$("mouse"), A(c.id);
|
|
617
618
|
},
|
|
618
|
-
onTogglePin: () =>
|
|
619
|
+
onTogglePin: () => E(c.id)
|
|
619
620
|
},
|
|
620
621
|
c.id
|
|
621
622
|
);
|
|
@@ -630,7 +631,7 @@ function ze({
|
|
|
630
631
|
S.map((h) => {
|
|
631
632
|
const F = s[h.id], B = Array.isArray(F) ? F.length : F != null ? 1 : 0;
|
|
632
633
|
return /* @__PURE__ */ e(
|
|
633
|
-
|
|
634
|
+
me,
|
|
634
635
|
{
|
|
635
636
|
filter: h,
|
|
636
637
|
isSelected: h.id === k,
|
|
@@ -639,7 +640,7 @@ function ze({
|
|
|
639
640
|
onSelect: () => {
|
|
640
641
|
$("mouse"), A(h.id);
|
|
641
642
|
},
|
|
642
|
-
onTogglePin: () =>
|
|
643
|
+
onTogglePin: () => E(h.id)
|
|
643
644
|
},
|
|
644
645
|
h.id
|
|
645
646
|
);
|
|
@@ -652,18 +653,18 @@ function ze({
|
|
|
652
653
|
}
|
|
653
654
|
),
|
|
654
655
|
/* @__PURE__ */ e("div", { className: "flex-1 box-border p-[var(--space-l)] overflow-y-auto", children: I && /* @__PURE__ */ e(
|
|
655
|
-
|
|
656
|
+
ve,
|
|
656
657
|
{
|
|
657
658
|
filter: I,
|
|
658
659
|
value: s[I.id],
|
|
659
|
-
onChange:
|
|
660
|
+
onChange: P,
|
|
660
661
|
onReset: T,
|
|
661
662
|
autoFocusSearch: f === "mouse"
|
|
662
663
|
}
|
|
663
664
|
) })
|
|
664
665
|
] }) });
|
|
665
666
|
}
|
|
666
|
-
function
|
|
667
|
+
function Xe({
|
|
667
668
|
filters: x,
|
|
668
669
|
pinnedFilters: r,
|
|
669
670
|
activeFilters: s,
|
|
@@ -678,10 +679,10 @@ function Ye({
|
|
|
678
679
|
enableAutocomplete: w = !1,
|
|
679
680
|
autocompleteMinCharacters: R = 2,
|
|
680
681
|
hideReset: I = !1,
|
|
681
|
-
hideFiltersButton:
|
|
682
|
+
hideFiltersButton: P = !1,
|
|
682
683
|
actionButtons: T
|
|
683
684
|
}) {
|
|
684
|
-
const [
|
|
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) => {
|
|
685
686
|
const o = c;
|
|
686
687
|
C(t ? a : null), !t && o === a && setTimeout(() => {
|
|
687
688
|
Y.current[a]?.focus();
|
|
@@ -689,18 +690,18 @@ function Ye({
|
|
|
689
690
|
}, [c]);
|
|
690
691
|
u.useEffect(() => {
|
|
691
692
|
const t = F.current, a = B.current, o = Object.keys(s).filter(
|
|
692
|
-
(
|
|
693
|
+
(L) => s[L] !== void 0 && s[L] !== null && (!Array.isArray(s[L]) || s[L].length > 0)
|
|
693
694
|
).length, i = Object.keys(t).filter(
|
|
694
|
-
(
|
|
695
|
+
(L) => t[L] !== void 0 && t[L] !== null && (!Array.isArray(t[L]) || t[L].length > 0)
|
|
695
696
|
).length, l = f.length, V = a.length;
|
|
696
697
|
let z = "";
|
|
697
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) {
|
|
698
|
-
const
|
|
699
|
-
|
|
699
|
+
const L = o + l;
|
|
700
|
+
L === 0 ? z = "All filters cleared." : z = `${z} ${L} active filter${L !== 1 ? "s" : ""}.`, h(z);
|
|
700
701
|
}
|
|
701
702
|
F.current = s, B.current = f;
|
|
702
703
|
}, [s, f]);
|
|
703
|
-
const q = !
|
|
704
|
+
const q = !P && x.length > 0, J = Object.keys(s).some(
|
|
704
705
|
(t) => s[t] !== void 0 && s[t] !== null
|
|
705
706
|
), _ = f.length > 0, j = Object.keys(s).filter(
|
|
706
707
|
(t) => {
|
|
@@ -736,7 +737,7 @@ function Ye({
|
|
|
736
737
|
const [o, i] = a, l = t.formatValue?.(
|
|
737
738
|
[o.toISOString(), i.toISOString()],
|
|
738
739
|
2
|
|
739
|
-
) ??
|
|
740
|
+
) ?? Ie(o, i);
|
|
740
741
|
return { type: "values", icon: t.icon, content: l };
|
|
741
742
|
}
|
|
742
743
|
if (Array.isArray(a))
|
|
@@ -841,7 +842,7 @@ function Ye({
|
|
|
841
842
|
if (!$) return;
|
|
842
843
|
const o = a ? `${t}|${a}` : t;
|
|
843
844
|
f.includes(o) || $([...f, o]);
|
|
844
|
-
},
|
|
845
|
+
}, O = (t) => {
|
|
845
846
|
$ && $(f.filter((a) => a !== t));
|
|
846
847
|
}, W = () => {
|
|
847
848
|
k(), $ && _ && $([]);
|
|
@@ -857,28 +858,28 @@ function Ye({
|
|
|
857
858
|
children: S
|
|
858
859
|
}
|
|
859
860
|
),
|
|
860
|
-
q && /* @__PURE__ */ v(
|
|
861
|
-
/* @__PURE__ */ e(
|
|
861
|
+
q && /* @__PURE__ */ v(ce, { open: E, onOpenChange: K, children: [
|
|
862
|
+
/* @__PURE__ */ e(de, { asChild: !0, children: /* @__PURE__ */ v(
|
|
862
863
|
Q,
|
|
863
864
|
{
|
|
864
865
|
className: "h-[var(--size-m)] gap-[var(--space-xs)]",
|
|
865
866
|
"aria-label": `Filters${j > 0 ? `, ${j} active` : ""}`,
|
|
866
|
-
"aria-expanded":
|
|
867
|
+
"aria-expanded": E,
|
|
867
868
|
"aria-haspopup": "dialog",
|
|
868
869
|
children: [
|
|
869
|
-
/* @__PURE__ */ e(H, { name:
|
|
870
|
+
/* @__PURE__ */ e(H, { name: xe, className: "h-[var(--size-2xs)] w-[var(--size-2xs)]", "aria-hidden": "true" }),
|
|
870
871
|
/* @__PURE__ */ e("span", { className: "text-label-md", children: "Filters" }),
|
|
871
872
|
j > 0 && /* @__PURE__ */ e(te, { size: "s", intent: "neutral", appearance: "subtle", "aria-hidden": "true", children: j })
|
|
872
873
|
]
|
|
873
874
|
}
|
|
874
875
|
) }),
|
|
875
876
|
/* @__PURE__ */ e(
|
|
876
|
-
|
|
877
|
+
ue,
|
|
877
878
|
{
|
|
878
879
|
className: "w-[660px] p-0",
|
|
879
880
|
align: "start",
|
|
880
881
|
children: /* @__PURE__ */ e(
|
|
881
|
-
|
|
882
|
+
Ee,
|
|
882
883
|
{
|
|
883
884
|
filters: x,
|
|
884
885
|
pinnedFilters: r,
|
|
@@ -894,12 +895,12 @@ function Ye({
|
|
|
894
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) => {
|
|
895
896
|
const a = ae(t), o = a.type !== "empty", i = a.icon;
|
|
896
897
|
return /* @__PURE__ */ v(
|
|
897
|
-
|
|
898
|
+
ce,
|
|
898
899
|
{
|
|
899
900
|
open: c === t.id,
|
|
900
|
-
onOpenChange: (l) =>
|
|
901
|
+
onOpenChange: (l) => X(l, t.id),
|
|
901
902
|
children: [
|
|
902
|
-
/* @__PURE__ */ e(
|
|
903
|
+
/* @__PURE__ */ e(de, { asChild: !0, children: /* @__PURE__ */ v(
|
|
903
904
|
"div",
|
|
904
905
|
{
|
|
905
906
|
ref: (l) => {
|
|
@@ -911,7 +912,7 @@ function Ye({
|
|
|
911
912
|
"aria-expanded": c === t.id,
|
|
912
913
|
"aria-haspopup": "dialog",
|
|
913
914
|
onKeyDown: (l) => {
|
|
914
|
-
(l.key === "Enter" || l.key === " ") && (l.preventDefault(),
|
|
915
|
+
(l.key === "Enter" || l.key === " ") && (l.preventDefault(), X(c !== t.id, t.id));
|
|
915
916
|
},
|
|
916
917
|
className: D(
|
|
917
918
|
"group/slot h-[var(--size-m)] rounded-l flex items-center justify-center gap-[var(--space-s)] transition-colors cursor-pointer flex-shrink-0",
|
|
@@ -943,14 +944,14 @@ function Ye({
|
|
|
943
944
|
(l.key === "Enter" || l.key === " ") && (l.preventDefault(), l.stopPropagation(), y(t.id));
|
|
944
945
|
},
|
|
945
946
|
className: "h-auto w-auto p-[var(--space-xs)]",
|
|
946
|
-
children: /* @__PURE__ */ e(H, { name:
|
|
947
|
+
children: /* @__PURE__ */ e(H, { name: oe, className: "h-[var(--size-2xs)] w-[var(--size-2xs)]", "aria-hidden": "true" })
|
|
947
948
|
}
|
|
948
949
|
)
|
|
949
950
|
]
|
|
950
951
|
}
|
|
951
952
|
) }),
|
|
952
953
|
/* @__PURE__ */ e(
|
|
953
|
-
|
|
954
|
+
ue,
|
|
954
955
|
{
|
|
955
956
|
className: D(
|
|
956
957
|
"p-[var(--space-l)]",
|
|
@@ -960,7 +961,7 @@ function Ye({
|
|
|
960
961
|
align: "start",
|
|
961
962
|
collisionPadding: 8,
|
|
962
963
|
children: /* @__PURE__ */ e(
|
|
963
|
-
|
|
964
|
+
ve,
|
|
964
965
|
{
|
|
965
966
|
filter: t,
|
|
966
967
|
value: s[t.id],
|
|
@@ -977,14 +978,14 @@ function Ye({
|
|
|
977
978
|
}) }),
|
|
978
979
|
A && (q || n.length > 0) && /* @__PURE__ */ e(re, { type: "line", layout: "horizontal", className: "mx-[var(--space-s)]" }),
|
|
979
980
|
A && !w && /* @__PURE__ */ e(
|
|
980
|
-
|
|
981
|
+
Me,
|
|
981
982
|
{
|
|
982
983
|
placeholder: M,
|
|
983
984
|
onAddSearchTerm: G
|
|
984
985
|
}
|
|
985
986
|
),
|
|
986
987
|
A && w && /* @__PURE__ */ e(
|
|
987
|
-
|
|
988
|
+
Le,
|
|
988
989
|
{
|
|
989
990
|
placeholder: M,
|
|
990
991
|
onAddSearchTerm: G,
|
|
@@ -1007,9 +1008,9 @@ function Ye({
|
|
|
1007
1008
|
variant: "ghost",
|
|
1008
1009
|
size: "s",
|
|
1009
1010
|
"aria-label": `Remove search term: ${o}`,
|
|
1010
|
-
onClick: () =>
|
|
1011
|
+
onClick: () => O(t.value),
|
|
1011
1012
|
className: "h-auto w-auto p-[var(--space-xs)]",
|
|
1012
|
-
children: /* @__PURE__ */ e(H, { name:
|
|
1013
|
+
children: /* @__PURE__ */ e(H, { name: oe, className: "h-[var(--size-2xs)] w-[var(--size-2xs)]", "aria-hidden": "true" })
|
|
1013
1014
|
}
|
|
1014
1015
|
)
|
|
1015
1016
|
]
|
|
@@ -1017,8 +1018,8 @@ function Ye({
|
|
|
1017
1018
|
t.value
|
|
1018
1019
|
);
|
|
1019
1020
|
}),
|
|
1020
|
-
!I && (
|
|
1021
|
-
!I && (
|
|
1021
|
+
!I && (J || _) && /* @__PURE__ */ e(re, { type: "dot", layout: "horizontal" }),
|
|
1022
|
+
!I && (J || _) && /* @__PURE__ */ e(
|
|
1022
1023
|
Q,
|
|
1023
1024
|
{
|
|
1024
1025
|
variant: "ghost",
|
|
@@ -1033,9 +1034,9 @@ function Ye({
|
|
|
1033
1034
|
] });
|
|
1034
1035
|
}
|
|
1035
1036
|
export {
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1037
|
+
ze as DEFAULT_DAY_PRESETS,
|
|
1038
|
+
Ae as DEFAULT_MONTH_PRESETS,
|
|
1039
|
+
Ee as FilterDropdownMenu,
|
|
1040
|
+
ve as FilterPanelContent,
|
|
1041
|
+
Xe as Filters
|
|
1041
1042
|
};
|