@yuno-payments/dashboard-design-system 0.0.136 → 0.0.138-beta.1
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/components/atoms/filter/filter-date-range.js +185 -161
- package/dist/components/atoms/filter/filter.d.ts +4 -0
- package/dist/components/atoms/filter/filter.js +82 -70
- package/dist/components/atoms/filter-dropdown/filter-dropdown.js +84 -87
- package/dist/components/atoms/icon/icon-list.d.ts +0 -3
- package/dist/components/atoms/icon/icon-list.js +392 -398
- package/dist/components/atoms/multi-values-field/multi-values-field.js +28 -28
- package/dist/components/atoms/radio-group/radio-group-option.js +7 -7
- package/dist/components/atoms/search-field/search-field.js +9 -9
- package/dist/components/atoms/switch/switch.js +13 -13
- package/dist/components/atoms/time-picker/time-picker.d.ts +5 -0
- package/dist/components/atoms/time-picker/time-picker.js +123 -115
- package/dist/components/molecules/empty/empty-icon.js +6 -6
- package/dist/components/organisms/data-table/data-table.d.ts +1 -24
- package/dist/components/organisms/data-table/data-table.js +93 -104
- package/dist/components/organisms/data-table/data-table.types.d.ts +0 -20
- package/dist/components/organisms/data-table/hooks/use-data-table-state.d.ts +2 -7
- package/dist/components/organisms/data-table/hooks/use-data-table-state.js +46 -80
- package/dist/components/organisms/data-table/utils/data-table-constants.d.ts +2 -2
- package/dist/components/organisms/data-table/utils/data-table-constants.js +11 -11
- package/dist/index.css +1 -1
- package/dist/vendor/shadcn/badge.js +17 -17
- package/dist/vendor/shadcn/card.js +7 -7
- package/dist/vendor/shadcn/input.js +7 -7
- package/dist/vendor/shadcn/select.js +1 -1
- package/dist/vendor/shadcn/table.js +18 -18
- package/package.json +1 -1
- package/dist/components/atoms/icon/aida-logo.d.ts +0 -3
- package/dist/components/atoms/icon/aida-logo.js +0 -64
- package/dist/node_modules/@phosphor-icons/react/dist/csr/File.es.js +0 -8
- package/dist/node_modules/@phosphor-icons/react/dist/csr/Table.es.js +0 -8
- package/dist/node_modules/@phosphor-icons/react/dist/defs/File.es.js +0 -30
- package/dist/node_modules/@phosphor-icons/react/dist/defs/Table.es.js +0 -30
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { j as e } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { Button as
|
|
2
|
+
import { forwardRef as f, useState as A, useMemo as M } from "react";
|
|
3
|
+
import { Button as j } from "../../../vendor/shadcn/button.js";
|
|
4
4
|
import { Badge as C } from "../../../vendor/shadcn/badge.js";
|
|
5
5
|
import { Separator as p } from "../../../vendor/shadcn/separator.js";
|
|
6
|
-
import { Checkbox as
|
|
7
|
-
import { RadioGroup as
|
|
6
|
+
import { Checkbox as E } from "../../../vendor/shadcn/checkbox.js";
|
|
7
|
+
import { RadioGroup as Q, RadioGroupItem as L } from "../../../vendor/shadcn/radio-group.js";
|
|
8
8
|
import { Icon as y } from "../icon/icon.js";
|
|
9
|
-
import { cn as
|
|
9
|
+
import { cn as g } from "../../../lib/utils.js";
|
|
10
10
|
import { Field as k } from "../field/field.js";
|
|
11
11
|
import { Tooltip as v } from "../tooltip/tooltip.js";
|
|
12
|
-
const F =
|
|
12
|
+
const F = f(
|
|
13
13
|
({ label: s, onRemove: t, className: n, ...l }, i) => /* @__PURE__ */ e.jsxs(
|
|
14
14
|
C,
|
|
15
15
|
{
|
|
16
16
|
ref: i,
|
|
17
17
|
variant: "secondary",
|
|
18
|
-
className:
|
|
18
|
+
className: g("h-8 gap-2 px-3 py-2 shadow-xs", n),
|
|
19
19
|
...l,
|
|
20
20
|
children: [
|
|
21
21
|
/* @__PURE__ */ e.jsx("span", { className: "text-xs font-medium leading-none", children: s }),
|
|
@@ -33,49 +33,49 @@ const F = x(
|
|
|
33
33
|
)
|
|
34
34
|
);
|
|
35
35
|
F.displayName = "FilterTag";
|
|
36
|
-
const P =
|
|
36
|
+
const P = f(
|
|
37
37
|
({
|
|
38
38
|
appliedFilters: s = [],
|
|
39
39
|
onRemoveFilter: t,
|
|
40
40
|
onClearAll: n,
|
|
41
41
|
maxVisibleTags: l = 4,
|
|
42
42
|
className: i,
|
|
43
|
-
...
|
|
44
|
-
},
|
|
45
|
-
const
|
|
43
|
+
...c
|
|
44
|
+
}, r) => {
|
|
45
|
+
const o = s.length > 0, x = s.slice(0, l), u = s.length - l;
|
|
46
46
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
47
47
|
/* @__PURE__ */ e.jsxs(
|
|
48
|
-
|
|
48
|
+
j,
|
|
49
49
|
{
|
|
50
|
-
ref:
|
|
50
|
+
ref: r,
|
|
51
51
|
variant: "outline",
|
|
52
52
|
size: "sm",
|
|
53
|
-
className:
|
|
54
|
-
...
|
|
53
|
+
className: g("h-8 gap-2 px-3 py-2", i),
|
|
54
|
+
...c,
|
|
55
55
|
children: [
|
|
56
56
|
/* @__PURE__ */ e.jsx(y, { name: "FunnelSimple", className: "size-4" }),
|
|
57
57
|
/* @__PURE__ */ e.jsx("span", { className: "text-xs font-medium leading-none", children: "Add filter" })
|
|
58
58
|
]
|
|
59
59
|
}
|
|
60
60
|
),
|
|
61
|
-
|
|
61
|
+
o && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
62
62
|
/* @__PURE__ */ e.jsx(p, { orientation: "vertical", className: "h-5" }),
|
|
63
63
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
64
|
-
|
|
64
|
+
x.map((m) => /* @__PURE__ */ e.jsx(
|
|
65
65
|
F,
|
|
66
66
|
{
|
|
67
|
-
label:
|
|
68
|
-
onRemove: () => t?.(
|
|
67
|
+
label: m.label,
|
|
68
|
+
onRemove: () => t?.(m.id)
|
|
69
69
|
},
|
|
70
|
-
|
|
70
|
+
m.id
|
|
71
71
|
)),
|
|
72
|
-
|
|
72
|
+
u > 0 && /* @__PURE__ */ e.jsx(C, { variant: "default", className: "h-8 px-3 py-2 shadow-xs", children: /* @__PURE__ */ e.jsxs("span", { className: "text-xs font-medium leading-none", children: [
|
|
73
73
|
"+",
|
|
74
|
-
|
|
74
|
+
u,
|
|
75
75
|
" more"
|
|
76
76
|
] }) }),
|
|
77
77
|
n && /* @__PURE__ */ e.jsx(
|
|
78
|
-
|
|
78
|
+
j,
|
|
79
79
|
{
|
|
80
80
|
variant: "ghost",
|
|
81
81
|
size: "sm",
|
|
@@ -86,7 +86,7 @@ const P = x(
|
|
|
86
86
|
)
|
|
87
87
|
] })
|
|
88
88
|
] }),
|
|
89
|
-
!
|
|
89
|
+
!o && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
90
90
|
/* @__PURE__ */ e.jsx(p, { orientation: "vertical", className: "h-5" }),
|
|
91
91
|
/* @__PURE__ */ e.jsx("span", { className: "text-sm font-normal text-muted-foreground", children: "No filters applied" })
|
|
92
92
|
] })
|
|
@@ -94,43 +94,43 @@ const P = x(
|
|
|
94
94
|
}
|
|
95
95
|
);
|
|
96
96
|
P.displayName = "FilterButton";
|
|
97
|
-
const X =
|
|
97
|
+
const X = f(
|
|
98
98
|
(s, t) => {
|
|
99
99
|
const {
|
|
100
100
|
title: n,
|
|
101
101
|
items: l,
|
|
102
102
|
className: i,
|
|
103
|
-
searchable:
|
|
104
|
-
searchPlaceholder:
|
|
105
|
-
showActions:
|
|
106
|
-
enableSelectAll:
|
|
107
|
-
enableInverse:
|
|
108
|
-
enableNone:
|
|
109
|
-
} = s,
|
|
103
|
+
searchable: c = !1,
|
|
104
|
+
searchPlaceholder: r = "Search...",
|
|
105
|
+
showActions: o = !1,
|
|
106
|
+
enableSelectAll: x = !0,
|
|
107
|
+
enableInverse: u = !0,
|
|
108
|
+
enableNone: m = !0
|
|
109
|
+
} = s, d = s.type || "checkbox", w = d === "radio", z = d === "checkbox" || !s.type, [N, I] = A(""), b = M(() => N ? l.filter(
|
|
110
110
|
(a) => a.label.toLowerCase().includes(N.toLowerCase())
|
|
111
111
|
) : l, [l, N]), R = () => {
|
|
112
|
-
if (
|
|
113
|
-
const a = l.map((
|
|
112
|
+
if (d === "checkbox" && "selectedValues" in s) {
|
|
113
|
+
const a = l.map((h) => h.value);
|
|
114
114
|
s.onChange(a);
|
|
115
115
|
}
|
|
116
116
|
}, T = () => {
|
|
117
|
-
if (
|
|
118
|
-
const a = l.filter((
|
|
117
|
+
if (d === "checkbox" && "selectedValues" in s) {
|
|
118
|
+
const a = l.filter((h) => !s.selectedValues.includes(h.value)).map((h) => h.value);
|
|
119
119
|
s.onChange(a);
|
|
120
120
|
}
|
|
121
121
|
}, B = () => {
|
|
122
|
-
|
|
122
|
+
d === "checkbox" && "selectedValues" in s ? s.onChange([]) : d === "radio" && "selectedValue" in s && s.onChange("");
|
|
123
123
|
}, G = (a) => {
|
|
124
|
-
if (
|
|
124
|
+
if (d === "checkbox" && "selectedValues" in s) {
|
|
125
125
|
const O = s.selectedValues.includes(a) ? s.selectedValues.filter(($) => $ !== a) : [...s.selectedValues, a];
|
|
126
126
|
s.onChange(O);
|
|
127
127
|
}
|
|
128
128
|
};
|
|
129
|
-
return /* @__PURE__ */ e.jsxs("div", { ref: t, className:
|
|
130
|
-
|
|
129
|
+
return /* @__PURE__ */ e.jsxs("div", { ref: t, className: g("flex flex-col h-full", i), children: [
|
|
130
|
+
c && /* @__PURE__ */ e.jsx(
|
|
131
131
|
k,
|
|
132
132
|
{
|
|
133
|
-
placeholder:
|
|
133
|
+
placeholder: r,
|
|
134
134
|
value: N,
|
|
135
135
|
onChange: (a) => I(a.target.value),
|
|
136
136
|
startIcon: "MagnifyingGlass",
|
|
@@ -139,9 +139,9 @@ const X = x(
|
|
|
139
139
|
),
|
|
140
140
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between mb-1", children: [
|
|
141
141
|
/* @__PURE__ */ e.jsx("span", { className: "text-sm font-normal text-foreground", children: n }),
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
o && d === "checkbox" && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-end gap-2", children: [
|
|
143
|
+
x && /* @__PURE__ */ e.jsx(
|
|
144
|
+
j,
|
|
145
145
|
{
|
|
146
146
|
variant: "link",
|
|
147
147
|
size: "sm",
|
|
@@ -150,8 +150,8 @@ const X = x(
|
|
|
150
150
|
children: "Select all"
|
|
151
151
|
}
|
|
152
152
|
),
|
|
153
|
-
|
|
154
|
-
|
|
153
|
+
u && /* @__PURE__ */ e.jsx(
|
|
154
|
+
j,
|
|
155
155
|
{
|
|
156
156
|
variant: "link",
|
|
157
157
|
size: "sm",
|
|
@@ -160,8 +160,8 @@ const X = x(
|
|
|
160
160
|
children: "Inverse"
|
|
161
161
|
}
|
|
162
162
|
),
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
m && /* @__PURE__ */ e.jsx(
|
|
164
|
+
j,
|
|
165
165
|
{
|
|
166
166
|
variant: "link",
|
|
167
167
|
size: "sm",
|
|
@@ -173,14 +173,14 @@ const X = x(
|
|
|
173
173
|
] })
|
|
174
174
|
] }),
|
|
175
175
|
/* @__PURE__ */ e.jsx(p, { className: "w-full mb-6" }),
|
|
176
|
-
|
|
177
|
-
|
|
176
|
+
w && "selectedValue" in s ? /* @__PURE__ */ e.jsx(
|
|
177
|
+
Q,
|
|
178
178
|
{
|
|
179
179
|
value: s.selectedValue,
|
|
180
180
|
onValueChange: s.onChange,
|
|
181
|
-
className: "grid grid-cols-2 gap-4 overflow-y-auto",
|
|
181
|
+
className: "grid grid-cols-2 gap-x-4 gap-y-5 overflow-y-auto",
|
|
182
182
|
children: b.map((a) => /* @__PURE__ */ e.jsx(
|
|
183
|
-
|
|
183
|
+
S,
|
|
184
184
|
{
|
|
185
185
|
label: a.label,
|
|
186
186
|
value: a.value,
|
|
@@ -189,11 +189,12 @@ const X = x(
|
|
|
189
189
|
a.value
|
|
190
190
|
))
|
|
191
191
|
}
|
|
192
|
-
) : z && "selectedValues" in s ? /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-2 gap-4 overflow-y-auto", children: b.map((a) => /* @__PURE__ */ e.jsx(
|
|
192
|
+
) : z && "selectedValues" in s ? /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-2 gap-x-4 gap-y-5 overflow-y-auto", children: b.map((a) => /* @__PURE__ */ e.jsx(
|
|
193
193
|
V,
|
|
194
194
|
{
|
|
195
195
|
label: a.label,
|
|
196
196
|
description: a.description,
|
|
197
|
+
icon: a.icon,
|
|
197
198
|
checked: s.selectedValues.includes(a.value),
|
|
198
199
|
onCheckedChange: () => G(a.value)
|
|
199
200
|
},
|
|
@@ -203,19 +204,30 @@ const X = x(
|
|
|
203
204
|
}
|
|
204
205
|
);
|
|
205
206
|
X.displayName = "FilterSection";
|
|
206
|
-
const V =
|
|
207
|
-
const
|
|
208
|
-
return /* @__PURE__ */ e.jsxs("label", { className:
|
|
209
|
-
/* @__PURE__ */ e.jsx(
|
|
207
|
+
const V = f(({ label: s, checked: t, onCheckedChange: n, description: l, className: i, maxLabelLength: c = 14, icon: r }, o) => {
|
|
208
|
+
const x = s.length > c, u = x ? `${s.slice(0, c)}...` : s;
|
|
209
|
+
return /* @__PURE__ */ e.jsxs("label", { className: g("flex items-start gap-2 cursor-pointer", i), children: [
|
|
210
|
+
/* @__PURE__ */ e.jsx(E, { ref: o, checked: t, onCheckedChange: n }),
|
|
211
|
+
r && /* @__PURE__ */ e.jsx(
|
|
212
|
+
"img",
|
|
213
|
+
{
|
|
214
|
+
src: r,
|
|
215
|
+
alt: "",
|
|
216
|
+
className: "size-4 object-contain shrink-0",
|
|
217
|
+
onError: (m) => {
|
|
218
|
+
m.currentTarget.style.display = "none";
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
),
|
|
210
222
|
/* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-1.5 min-w-0 flex-1", children: [
|
|
211
|
-
/* @__PURE__ */ e.jsx(v, { content:
|
|
223
|
+
/* @__PURE__ */ e.jsx(v, { content: x ? s : "", children: /* @__PURE__ */ e.jsx("span", { className: "text-sm font-medium leading-none truncate", children: u }) }),
|
|
212
224
|
l && /* @__PURE__ */ e.jsx("span", { className: "text-sm font-normal leading-5 text-muted-foreground truncate", children: l })
|
|
213
225
|
] })
|
|
214
226
|
] });
|
|
215
227
|
});
|
|
216
228
|
V.displayName = "FilterCheckboxOption";
|
|
217
|
-
const
|
|
218
|
-
({ label: s, value: t, description: n, className: l }, i) => /* @__PURE__ */ e.jsxs("div", { className:
|
|
229
|
+
const S = f(
|
|
230
|
+
({ label: s, value: t, description: n, className: l }, i) => /* @__PURE__ */ e.jsxs("div", { className: g("flex items-start gap-3", l), children: [
|
|
219
231
|
/* @__PURE__ */ e.jsx(L, { ref: i, value: t, id: `radio-${t}` }),
|
|
220
232
|
/* @__PURE__ */ e.jsxs(
|
|
221
233
|
"label",
|
|
@@ -230,22 +242,22 @@ const w = x(
|
|
|
230
242
|
)
|
|
231
243
|
] })
|
|
232
244
|
);
|
|
233
|
-
|
|
234
|
-
const q =
|
|
245
|
+
S.displayName = "FilterRadioOption";
|
|
246
|
+
const q = f(
|
|
235
247
|
({
|
|
236
248
|
children: s,
|
|
237
249
|
showSearch: t = !1,
|
|
238
250
|
searchPlaceholder: n = "Search...",
|
|
239
251
|
searchValue: l,
|
|
240
252
|
onSearchChange: i,
|
|
241
|
-
className:
|
|
242
|
-
},
|
|
253
|
+
className: c
|
|
254
|
+
}, r) => /* @__PURE__ */ e.jsxs(
|
|
243
255
|
"div",
|
|
244
256
|
{
|
|
245
|
-
ref:
|
|
246
|
-
className:
|
|
247
|
-
"flex flex-col gap-6 bg-
|
|
248
|
-
|
|
257
|
+
ref: r,
|
|
258
|
+
className: g(
|
|
259
|
+
"flex flex-col gap-6 bg-background rounded-md p-6 min-w-[448px]",
|
|
260
|
+
c
|
|
249
261
|
),
|
|
250
262
|
children: [
|
|
251
263
|
t && /* @__PURE__ */ e.jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ e.jsxs("div", { className: "relative", children: [
|
|
@@ -261,7 +273,7 @@ const q = x(
|
|
|
261
273
|
{
|
|
262
274
|
placeholder: n,
|
|
263
275
|
value: l,
|
|
264
|
-
onChange: (
|
|
276
|
+
onChange: (o) => i?.(o.target.value),
|
|
265
277
|
className: "pl-9"
|
|
266
278
|
}
|
|
267
279
|
)
|
|
@@ -276,7 +288,7 @@ export {
|
|
|
276
288
|
P as FilterButton,
|
|
277
289
|
V as FilterCheckboxOption,
|
|
278
290
|
q as FilterContent,
|
|
279
|
-
|
|
291
|
+
S as FilterRadioOption,
|
|
280
292
|
X as FilterSection,
|
|
281
293
|
F as FilterTag
|
|
282
294
|
};
|
|
@@ -1,51 +1,51 @@
|
|
|
1
1
|
import { j as t } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
-
import { forwardRef as j, useState as
|
|
3
|
-
import { Button as
|
|
4
|
-
import { Separator as
|
|
2
|
+
import { forwardRef as j, useState as F, useRef as _, useCallback as K, useEffect as X } from "react";
|
|
3
|
+
import { Button as I } from "../../../vendor/shadcn/button.js";
|
|
4
|
+
import { Separator as E } from "../../../vendor/shadcn/separator.js";
|
|
5
5
|
import { Badge as k } from "../../../vendor/shadcn/badge.js";
|
|
6
6
|
import { Icon as b } from "../icon/icon.js";
|
|
7
|
-
import { FilterSection as
|
|
7
|
+
import { FilterSection as S } from "../filter/filter.js";
|
|
8
8
|
import { FilterDateRange as Y, FilterDateRangeValue as g } from "../filter/filter-date-range.js";
|
|
9
|
-
import { cn as
|
|
10
|
-
const
|
|
11
|
-
({ icon:
|
|
9
|
+
import { cn as c } from "../../../lib/utils.js";
|
|
10
|
+
const M = j(
|
|
11
|
+
({ icon: s, label: u, isActive: r = !1, showChevron: m = !1, className: h, ...l }, C) => /* @__PURE__ */ t.jsxs(
|
|
12
12
|
"button",
|
|
13
13
|
{
|
|
14
14
|
ref: C,
|
|
15
|
-
className:
|
|
15
|
+
className: c(
|
|
16
16
|
"flex items-center gap-2 h-8 px-2 rounded-md w-full transition-colors",
|
|
17
17
|
"hover:bg-secondary",
|
|
18
18
|
h
|
|
19
19
|
),
|
|
20
|
-
...
|
|
20
|
+
...l,
|
|
21
21
|
children: [
|
|
22
|
-
|
|
22
|
+
s && /* @__PURE__ */ t.jsx(
|
|
23
23
|
b,
|
|
24
24
|
{
|
|
25
|
-
name:
|
|
26
|
-
className:
|
|
25
|
+
name: s,
|
|
26
|
+
className: c(
|
|
27
27
|
"size-4 shrink-0",
|
|
28
|
-
|
|
28
|
+
r ? "text-primary" : "text-foreground"
|
|
29
29
|
)
|
|
30
30
|
}
|
|
31
31
|
),
|
|
32
32
|
/* @__PURE__ */ t.jsx(
|
|
33
33
|
"span",
|
|
34
34
|
{
|
|
35
|
-
className:
|
|
35
|
+
className: c(
|
|
36
36
|
"flex-1 text-sm font-normal text-left truncate",
|
|
37
|
-
|
|
37
|
+
r ? "font-medium text-primary" : "text-foreground"
|
|
38
38
|
),
|
|
39
39
|
children: u
|
|
40
40
|
}
|
|
41
41
|
),
|
|
42
|
-
(
|
|
42
|
+
(r || m) && /* @__PURE__ */ t.jsx(
|
|
43
43
|
b,
|
|
44
44
|
{
|
|
45
45
|
name: "CaretRight",
|
|
46
|
-
className:
|
|
46
|
+
className: c(
|
|
47
47
|
"size-4 shrink-0",
|
|
48
|
-
|
|
48
|
+
r ? "text-primary" : "text-foreground"
|
|
49
49
|
)
|
|
50
50
|
}
|
|
51
51
|
)
|
|
@@ -53,94 +53,91 @@ const A = j(
|
|
|
53
53
|
}
|
|
54
54
|
)
|
|
55
55
|
);
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
({ items:
|
|
56
|
+
M.displayName = "FilterMenuItem";
|
|
57
|
+
const A = j(
|
|
58
|
+
({ items: s, activeItemId: u, onItemClick: r, className: m }, h) => /* @__PURE__ */ t.jsx(
|
|
59
59
|
"div",
|
|
60
60
|
{
|
|
61
61
|
ref: h,
|
|
62
|
-
className:
|
|
62
|
+
className: c(
|
|
63
63
|
"flex flex-col gap-2 w-64 h-full p-2 bg-surface border border-border rounded-md",
|
|
64
64
|
m
|
|
65
65
|
),
|
|
66
|
-
children:
|
|
67
|
-
|
|
66
|
+
children: s.map((l) => /* @__PURE__ */ t.jsx(
|
|
67
|
+
M,
|
|
68
68
|
{
|
|
69
|
-
icon:
|
|
70
|
-
label:
|
|
71
|
-
isActive: u ===
|
|
72
|
-
showChevron:
|
|
73
|
-
onClick: () =>
|
|
69
|
+
icon: l.icon,
|
|
70
|
+
label: l.label,
|
|
71
|
+
isActive: u === l.id,
|
|
72
|
+
showChevron: l.showChevron,
|
|
73
|
+
onClick: () => r?.(l.id)
|
|
74
74
|
},
|
|
75
|
-
|
|
75
|
+
l.id
|
|
76
76
|
))
|
|
77
77
|
}
|
|
78
78
|
)
|
|
79
79
|
);
|
|
80
|
-
|
|
80
|
+
A.displayName = "FilterMenu";
|
|
81
81
|
const $ = j(
|
|
82
82
|
({
|
|
83
|
-
filters:
|
|
83
|
+
filters: s,
|
|
84
84
|
buttonText: u = "Add filter",
|
|
85
|
-
appliedFilters:
|
|
85
|
+
appliedFilters: r = [],
|
|
86
86
|
onRemoveFilter: m,
|
|
87
87
|
onClearAllFilters: h,
|
|
88
|
-
maxVisibleTags:
|
|
88
|
+
maxVisibleTags: l = 4,
|
|
89
89
|
className: C,
|
|
90
|
-
disabled:
|
|
90
|
+
disabled: V = !1
|
|
91
91
|
}, x) => {
|
|
92
|
-
const [f, p] =
|
|
93
|
-
|
|
94
|
-
),
|
|
92
|
+
const [f, p] = F(!1), [v, w] = F(
|
|
93
|
+
s.length > 0 && s[0]?.id || ""
|
|
94
|
+
), N = _(null), O = K(
|
|
95
95
|
(n) => {
|
|
96
|
-
|
|
96
|
+
N.current = n, typeof x == "function" ? x(n) : x && (x.current = n);
|
|
97
97
|
},
|
|
98
98
|
[x]
|
|
99
99
|
);
|
|
100
100
|
X(() => {
|
|
101
101
|
if (!f) return;
|
|
102
|
-
const n = (
|
|
103
|
-
const
|
|
104
|
-
|
|
102
|
+
const n = (i) => {
|
|
103
|
+
const d = i.target;
|
|
104
|
+
N.current?.contains(d) || d.closest?.(
|
|
105
105
|
"[data-radix-popper-content-wrapper], [data-radix-portal]"
|
|
106
|
-
) ||
|
|
106
|
+
) || d.closest?.(
|
|
107
107
|
".rdp, .rdp-root, [data-calendar]"
|
|
108
108
|
) || p(!1);
|
|
109
|
-
}, a = (
|
|
110
|
-
|
|
111
|
-
},
|
|
109
|
+
}, a = (i) => {
|
|
110
|
+
i.key === "Escape" && p(!1);
|
|
111
|
+
}, o = setTimeout(() => {
|
|
112
112
|
document.addEventListener("mousedown", n), document.addEventListener("keydown", a);
|
|
113
113
|
}, 0);
|
|
114
114
|
return () => {
|
|
115
|
-
clearTimeout(
|
|
115
|
+
clearTimeout(o), document.removeEventListener("mousedown", n), document.removeEventListener("keydown", a);
|
|
116
116
|
};
|
|
117
117
|
}, [f]);
|
|
118
|
-
const
|
|
119
|
-
if (
|
|
120
|
-
const
|
|
121
|
-
if (
|
|
122
|
-
const
|
|
123
|
-
if (
|
|
118
|
+
const R = r.length > 0, z = r.slice(0, l), y = r.length - l, T = (n) => s.find((o) => o.id === n)?.clearable !== !1, L = (n) => {
|
|
119
|
+
if (s.find((i) => i.id === n)) return n;
|
|
120
|
+
const o = n.split("-");
|
|
121
|
+
if (o.length > 1) {
|
|
122
|
+
const i = o[0];
|
|
123
|
+
if (s.find((D) => D.id === i)) return i;
|
|
124
124
|
}
|
|
125
125
|
return n;
|
|
126
|
-
}, D = (n) => {
|
|
127
|
-
const a = T(n);
|
|
128
|
-
return r.find((s) => s.id === a)?.clearable !== !1;
|
|
129
126
|
}, P = (n) => {
|
|
130
|
-
const a =
|
|
131
|
-
|
|
132
|
-
}, B =
|
|
133
|
-
(n) =>
|
|
134
|
-
), U =
|
|
127
|
+
const a = L(n);
|
|
128
|
+
w(a), p(!0);
|
|
129
|
+
}, B = r.some(
|
|
130
|
+
(n) => T(n.id)
|
|
131
|
+
), U = s.map((n) => ({
|
|
135
132
|
id: n.id,
|
|
136
133
|
icon: n.icon,
|
|
137
134
|
label: n.label
|
|
138
|
-
})), e =
|
|
135
|
+
})), e = s.find((n) => n.id === v), H = () => {
|
|
139
136
|
if (!e) return null;
|
|
140
137
|
switch (e.type) {
|
|
141
138
|
case "checkbox":
|
|
142
139
|
return /* @__PURE__ */ t.jsx(
|
|
143
|
-
|
|
140
|
+
S,
|
|
144
141
|
{
|
|
145
142
|
title: e.label,
|
|
146
143
|
items: e.items || [],
|
|
@@ -157,7 +154,7 @@ const $ = j(
|
|
|
157
154
|
);
|
|
158
155
|
case "radio":
|
|
159
156
|
return /* @__PURE__ */ t.jsx(
|
|
160
|
-
|
|
157
|
+
S,
|
|
161
158
|
{
|
|
162
159
|
type: "radio",
|
|
163
160
|
title: e.label,
|
|
@@ -176,10 +173,10 @@ const $ = j(
|
|
|
176
173
|
case "date": {
|
|
177
174
|
const n = (a) => {
|
|
178
175
|
if (e.onDateValueChange?.(a), a === g.CUSTOM && !e.dateInit && !e.dateEnd) {
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
const
|
|
182
|
-
|
|
176
|
+
const o = /* @__PURE__ */ new Date(), i = new Date(o);
|
|
177
|
+
i.setHours(23, 59, 59, 999);
|
|
178
|
+
const d = new Date(o);
|
|
179
|
+
d.setHours(0, 0, 0, 0), e.onDateInitChange?.(d), e.onDateEndChange?.(i), e.startTime || e.onStartTimeChange?.("00:00:00"), e.endTime || e.onEndTimeChange?.("23:59:59");
|
|
183
180
|
}
|
|
184
181
|
};
|
|
185
182
|
return /* @__PURE__ */ t.jsx(
|
|
@@ -214,42 +211,42 @@ const $ = j(
|
|
|
214
211
|
return /* @__PURE__ */ t.jsxs(
|
|
215
212
|
"div",
|
|
216
213
|
{
|
|
217
|
-
ref:
|
|
218
|
-
className:
|
|
214
|
+
ref: O,
|
|
215
|
+
className: c("flex flex-col gap-1 relative", C),
|
|
219
216
|
children: [
|
|
220
217
|
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
221
218
|
/* @__PURE__ */ t.jsxs(
|
|
222
|
-
|
|
219
|
+
I,
|
|
223
220
|
{
|
|
224
221
|
variant: "outline",
|
|
225
222
|
size: "sm",
|
|
226
|
-
className: "h-8 gap-2 px-3 py-2",
|
|
223
|
+
className: "h-8 gap-2 px-3 py-2 border-border dark:bg-white/[0.045]",
|
|
227
224
|
onClick: () => p(!f),
|
|
228
|
-
disabled:
|
|
225
|
+
disabled: V,
|
|
229
226
|
children: [
|
|
230
227
|
/* @__PURE__ */ t.jsx(b, { name: "FunnelSimple", className: "size-4" }),
|
|
231
228
|
/* @__PURE__ */ t.jsx("span", { className: "text-xs font-medium leading-none", children: u })
|
|
232
229
|
]
|
|
233
230
|
}
|
|
234
231
|
),
|
|
235
|
-
|
|
236
|
-
/* @__PURE__ */ t.jsx(
|
|
232
|
+
R ? /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
233
|
+
/* @__PURE__ */ t.jsx(E, { orientation: "vertical", className: "h-5" }),
|
|
237
234
|
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
238
|
-
|
|
239
|
-
const a =
|
|
235
|
+
z.map((n) => {
|
|
236
|
+
const a = T(n.id);
|
|
240
237
|
return /* @__PURE__ */ t.jsxs(
|
|
241
238
|
k,
|
|
242
239
|
{
|
|
243
240
|
variant: "secondary",
|
|
244
|
-
className: "h-8 gap-2 px-3 py-2 shadow-xs cursor-pointer",
|
|
241
|
+
className: "h-8 gap-2 px-3 py-2 shadow-xs cursor-pointer border-border dark:bg-white/[0.045]",
|
|
245
242
|
onClick: () => P(n.id),
|
|
246
243
|
children: [
|
|
247
244
|
/* @__PURE__ */ t.jsx("span", { className: "text-xs font-medium leading-none", children: n.label }),
|
|
248
245
|
m && a && /* @__PURE__ */ t.jsx(
|
|
249
246
|
"button",
|
|
250
247
|
{
|
|
251
|
-
onClick: (
|
|
252
|
-
|
|
248
|
+
onClick: (o) => {
|
|
249
|
+
o.stopPropagation(), m(n.id);
|
|
253
250
|
},
|
|
254
251
|
className: "inline-flex items-center justify-center",
|
|
255
252
|
"aria-label": `Remove ${n.label} filter`,
|
|
@@ -267,7 +264,7 @@ const $ = j(
|
|
|
267
264
|
" more"
|
|
268
265
|
] }) }),
|
|
269
266
|
h && B && /* @__PURE__ */ t.jsx(
|
|
270
|
-
|
|
267
|
+
I,
|
|
271
268
|
{
|
|
272
269
|
variant: "ghost",
|
|
273
270
|
size: "sm",
|
|
@@ -278,14 +275,14 @@ const $ = j(
|
|
|
278
275
|
)
|
|
279
276
|
] })
|
|
280
277
|
] }) : /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
281
|
-
/* @__PURE__ */ t.jsx(
|
|
278
|
+
/* @__PURE__ */ t.jsx(E, { orientation: "vertical", className: "h-5" }),
|
|
282
279
|
/* @__PURE__ */ t.jsx("span", { className: "text-sm font-normal text-muted-foreground", children: "No filters applied" })
|
|
283
280
|
] })
|
|
284
281
|
] }),
|
|
285
282
|
f && /* @__PURE__ */ t.jsxs(
|
|
286
283
|
"div",
|
|
287
284
|
{
|
|
288
|
-
className:
|
|
285
|
+
className: c(
|
|
289
286
|
"z-50 shadow-lg",
|
|
290
287
|
"absolute top-full left-0 mt-1",
|
|
291
288
|
"flex flex-row gap-2",
|
|
@@ -294,11 +291,11 @@ const $ = j(
|
|
|
294
291
|
),
|
|
295
292
|
children: [
|
|
296
293
|
/* @__PURE__ */ t.jsx(
|
|
297
|
-
|
|
294
|
+
A,
|
|
298
295
|
{
|
|
299
296
|
items: U,
|
|
300
297
|
activeItemId: v,
|
|
301
|
-
onItemClick:
|
|
298
|
+
onItemClick: w
|
|
302
299
|
}
|
|
303
300
|
),
|
|
304
301
|
/* @__PURE__ */ t.jsx("div", { className: "flex flex-col gap-4 p-6 bg-popover w-[448px] h-full rounded-md overflow-y-auto", children: H() })
|
|
@@ -313,6 +310,6 @@ const $ = j(
|
|
|
313
310
|
$.displayName = "FilterDropdown";
|
|
314
311
|
export {
|
|
315
312
|
$ as FilterDropdown,
|
|
316
|
-
|
|
317
|
-
|
|
313
|
+
A as FilterMenu,
|
|
314
|
+
M as FilterMenuItem
|
|
318
315
|
};
|