@yuno-payments/dashboard-design-system 0.0.133 → 0.0.135
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,14 +1,14 @@
|
|
|
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
|
|
5
|
-
import { Badge as
|
|
2
|
+
import { forwardRef as j, useState as I, useRef as _, useCallback as K, useEffect as X } from "react";
|
|
3
|
+
import { Button as E } from "../../../vendor/shadcn/button.js";
|
|
4
|
+
import { Separator as S } from "../../../vendor/shadcn/separator.js";
|
|
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 M } from "../filter/filter.js";
|
|
8
8
|
import { FilterDateRange as Y, FilterDateRangeValue as g } from "../filter/filter-date-range.js";
|
|
9
9
|
import { cn as d } from "../../../lib/utils.js";
|
|
10
|
-
const
|
|
11
|
-
({ icon:
|
|
10
|
+
const A = j(
|
|
11
|
+
({ icon: r, label: u, isActive: l = !1, showChevron: m = !1, className: h, ...o }, C) => /* @__PURE__ */ t.jsxs(
|
|
12
12
|
"button",
|
|
13
13
|
{
|
|
14
14
|
ref: C,
|
|
@@ -17,15 +17,15 @@ const M = j(
|
|
|
17
17
|
"hover:bg-secondary",
|
|
18
18
|
h
|
|
19
19
|
),
|
|
20
|
-
...
|
|
20
|
+
...o,
|
|
21
21
|
children: [
|
|
22
|
-
|
|
22
|
+
r && /* @__PURE__ */ t.jsx(
|
|
23
23
|
b,
|
|
24
24
|
{
|
|
25
|
-
name:
|
|
25
|
+
name: r,
|
|
26
26
|
className: d(
|
|
27
27
|
"size-4 shrink-0",
|
|
28
|
-
|
|
28
|
+
l ? "text-primary" : "text-foreground"
|
|
29
29
|
)
|
|
30
30
|
}
|
|
31
31
|
),
|
|
@@ -34,18 +34,18 @@ const M = j(
|
|
|
34
34
|
{
|
|
35
35
|
className: d(
|
|
36
36
|
"flex-1 text-sm font-normal text-left truncate",
|
|
37
|
-
|
|
37
|
+
l ? "font-medium text-primary" : "text-foreground"
|
|
38
38
|
),
|
|
39
39
|
children: u
|
|
40
40
|
}
|
|
41
41
|
),
|
|
42
|
-
(
|
|
42
|
+
(l || m) && /* @__PURE__ */ t.jsx(
|
|
43
43
|
b,
|
|
44
44
|
{
|
|
45
45
|
name: "CaretRight",
|
|
46
46
|
className: d(
|
|
47
47
|
"size-4 shrink-0",
|
|
48
|
-
|
|
48
|
+
l ? "text-primary" : "text-foreground"
|
|
49
49
|
)
|
|
50
50
|
}
|
|
51
51
|
)
|
|
@@ -53,9 +53,9 @@ const M = j(
|
|
|
53
53
|
}
|
|
54
54
|
)
|
|
55
55
|
);
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
({ items:
|
|
56
|
+
A.displayName = "FilterMenuItem";
|
|
57
|
+
const V = j(
|
|
58
|
+
({ items: r, activeItemId: u, onItemClick: l, className: m }, h) => /* @__PURE__ */ t.jsx(
|
|
59
59
|
"div",
|
|
60
60
|
{
|
|
61
61
|
ref: h,
|
|
@@ -63,35 +63,35 @@ const A = j(
|
|
|
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: r.map((o) => /* @__PURE__ */ t.jsx(
|
|
67
|
+
A,
|
|
68
68
|
{
|
|
69
|
-
icon:
|
|
70
|
-
label:
|
|
71
|
-
isActive: u ===
|
|
72
|
-
showChevron:
|
|
73
|
-
onClick: () =>
|
|
69
|
+
icon: o.icon,
|
|
70
|
+
label: o.label,
|
|
71
|
+
isActive: u === o.id,
|
|
72
|
+
showChevron: o.showChevron,
|
|
73
|
+
onClick: () => l?.(o.id)
|
|
74
74
|
},
|
|
75
|
-
|
|
75
|
+
o.id
|
|
76
76
|
))
|
|
77
77
|
}
|
|
78
78
|
)
|
|
79
79
|
);
|
|
80
|
-
|
|
80
|
+
V.displayName = "FilterMenu";
|
|
81
81
|
const $ = j(
|
|
82
82
|
({
|
|
83
|
-
filters:
|
|
83
|
+
filters: r,
|
|
84
84
|
buttonText: u = "Add filter",
|
|
85
|
-
appliedFilters:
|
|
85
|
+
appliedFilters: l = [],
|
|
86
86
|
onRemoveFilter: m,
|
|
87
87
|
onClearAllFilters: h,
|
|
88
|
-
maxVisibleTags:
|
|
88
|
+
maxVisibleTags: o = 4,
|
|
89
89
|
className: C,
|
|
90
|
-
disabled:
|
|
90
|
+
disabled: O = !1
|
|
91
91
|
}, x) => {
|
|
92
|
-
const [f, p] =
|
|
93
|
-
|
|
94
|
-
), w = _(null),
|
|
92
|
+
const [f, p] = I(!1), [v, N] = I(
|
|
93
|
+
r.length > 0 && r[0]?.id || ""
|
|
94
|
+
), w = _(null), R = K(
|
|
95
95
|
(n) => {
|
|
96
96
|
w.current = n, typeof x == "function" ? x(n) : x && (x.current = n);
|
|
97
97
|
},
|
|
@@ -99,45 +99,48 @@ const $ = j(
|
|
|
99
99
|
);
|
|
100
100
|
X(() => {
|
|
101
101
|
if (!f) return;
|
|
102
|
-
const n = (
|
|
103
|
-
const c =
|
|
102
|
+
const n = (s) => {
|
|
103
|
+
const c = s.target;
|
|
104
104
|
w.current?.contains(c) || c.closest?.(
|
|
105
105
|
"[data-radix-popper-content-wrapper], [data-radix-portal]"
|
|
106
106
|
) || c.closest?.(
|
|
107
107
|
".rdp, .rdp-root, [data-calendar]"
|
|
108
108
|
) || p(!1);
|
|
109
|
-
}, a = (
|
|
110
|
-
|
|
111
|
-
},
|
|
109
|
+
}, a = (s) => {
|
|
110
|
+
s.key === "Escape" && p(!1);
|
|
111
|
+
}, i = setTimeout(() => {
|
|
112
112
|
document.addEventListener("mousedown", n), document.addEventListener("keydown", a);
|
|
113
113
|
}, 0);
|
|
114
114
|
return () => {
|
|
115
|
-
clearTimeout(
|
|
115
|
+
clearTimeout(i), 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 z = l.length > 0, L = l.slice(0, o), y = l.length - o, T = (n) => {
|
|
119
|
+
if (r.find((s) => s.id === n)) return n;
|
|
120
|
+
const i = n.split("-");
|
|
121
|
+
if (i.length > 1) {
|
|
122
|
+
const s = i[0];
|
|
123
|
+
if (r.find((F) => F.id === s)) return s;
|
|
124
124
|
}
|
|
125
125
|
return n;
|
|
126
|
+
}, D = (n) => {
|
|
127
|
+
const a = T(n);
|
|
128
|
+
return r.find((s) => s.id === a)?.clearable !== !1;
|
|
126
129
|
}, P = (n) => {
|
|
127
|
-
const a =
|
|
130
|
+
const a = T(n);
|
|
128
131
|
N(a), p(!0);
|
|
129
|
-
}, B =
|
|
130
|
-
(n) =>
|
|
131
|
-
), U =
|
|
132
|
+
}, B = l.some(
|
|
133
|
+
(n) => D(n.id)
|
|
134
|
+
), U = r.map((n) => ({
|
|
132
135
|
id: n.id,
|
|
133
136
|
icon: n.icon,
|
|
134
137
|
label: n.label
|
|
135
|
-
})), e =
|
|
138
|
+
})), e = r.find((n) => n.id === v), H = () => {
|
|
136
139
|
if (!e) return null;
|
|
137
140
|
switch (e.type) {
|
|
138
141
|
case "checkbox":
|
|
139
142
|
return /* @__PURE__ */ t.jsx(
|
|
140
|
-
|
|
143
|
+
M,
|
|
141
144
|
{
|
|
142
145
|
title: e.label,
|
|
143
146
|
items: e.items || [],
|
|
@@ -154,7 +157,7 @@ const $ = j(
|
|
|
154
157
|
);
|
|
155
158
|
case "radio":
|
|
156
159
|
return /* @__PURE__ */ t.jsx(
|
|
157
|
-
|
|
160
|
+
M,
|
|
158
161
|
{
|
|
159
162
|
type: "radio",
|
|
160
163
|
title: e.label,
|
|
@@ -173,10 +176,10 @@ const $ = j(
|
|
|
173
176
|
case "date": {
|
|
174
177
|
const n = (a) => {
|
|
175
178
|
if (e.onDateValueChange?.(a), a === g.CUSTOM && !e.dateInit && !e.dateEnd) {
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
const c = new Date(
|
|
179
|
-
c.setHours(0, 0, 0, 0), e.onDateInitChange?.(c), e.onDateEndChange?.(
|
|
179
|
+
const i = /* @__PURE__ */ new Date(), s = new Date(i);
|
|
180
|
+
s.setHours(23, 59, 59, 999);
|
|
181
|
+
const c = new Date(i);
|
|
182
|
+
c.setHours(0, 0, 0, 0), e.onDateInitChange?.(c), e.onDateEndChange?.(s), e.startTime || e.onStartTimeChange?.("00:00:00"), e.endTime || e.onEndTimeChange?.("23:59:59");
|
|
180
183
|
}
|
|
181
184
|
};
|
|
182
185
|
return /* @__PURE__ */ t.jsx(
|
|
@@ -211,31 +214,31 @@ const $ = j(
|
|
|
211
214
|
return /* @__PURE__ */ t.jsxs(
|
|
212
215
|
"div",
|
|
213
216
|
{
|
|
214
|
-
ref:
|
|
217
|
+
ref: R,
|
|
215
218
|
className: d("flex flex-col gap-1 relative", C),
|
|
216
219
|
children: [
|
|
217
220
|
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
218
221
|
/* @__PURE__ */ t.jsxs(
|
|
219
|
-
|
|
222
|
+
E,
|
|
220
223
|
{
|
|
221
224
|
variant: "outline",
|
|
222
225
|
size: "sm",
|
|
223
226
|
className: "h-8 gap-2 px-3 py-2",
|
|
224
227
|
onClick: () => p(!f),
|
|
225
|
-
disabled:
|
|
228
|
+
disabled: O,
|
|
226
229
|
children: [
|
|
227
230
|
/* @__PURE__ */ t.jsx(b, { name: "FunnelSimple", className: "size-4" }),
|
|
228
231
|
/* @__PURE__ */ t.jsx("span", { className: "text-xs font-medium leading-none", children: u })
|
|
229
232
|
]
|
|
230
233
|
}
|
|
231
234
|
),
|
|
232
|
-
|
|
233
|
-
/* @__PURE__ */ t.jsx(
|
|
235
|
+
z ? /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
236
|
+
/* @__PURE__ */ t.jsx(S, { orientation: "vertical", className: "h-5" }),
|
|
234
237
|
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
235
|
-
|
|
236
|
-
const a =
|
|
238
|
+
L.map((n) => {
|
|
239
|
+
const a = D(n.id);
|
|
237
240
|
return /* @__PURE__ */ t.jsxs(
|
|
238
|
-
|
|
241
|
+
k,
|
|
239
242
|
{
|
|
240
243
|
variant: "secondary",
|
|
241
244
|
className: "h-8 gap-2 px-3 py-2 shadow-xs cursor-pointer",
|
|
@@ -245,8 +248,8 @@ const $ = j(
|
|
|
245
248
|
m && a && /* @__PURE__ */ t.jsx(
|
|
246
249
|
"button",
|
|
247
250
|
{
|
|
248
|
-
onClick: (
|
|
249
|
-
|
|
251
|
+
onClick: (i) => {
|
|
252
|
+
i.stopPropagation(), m(n.id);
|
|
250
253
|
},
|
|
251
254
|
className: "inline-flex items-center justify-center",
|
|
252
255
|
"aria-label": `Remove ${n.label} filter`,
|
|
@@ -258,13 +261,13 @@ const $ = j(
|
|
|
258
261
|
n.id
|
|
259
262
|
);
|
|
260
263
|
}),
|
|
261
|
-
y > 0 && /* @__PURE__ */ t.jsx(
|
|
264
|
+
y > 0 && /* @__PURE__ */ t.jsx(k, { variant: "default", className: "h-8 px-3 py-2 shadow-xs", children: /* @__PURE__ */ t.jsxs("span", { className: "text-xs font-medium leading-none", children: [
|
|
262
265
|
"+",
|
|
263
266
|
y,
|
|
264
267
|
" more"
|
|
265
268
|
] }) }),
|
|
266
269
|
h && B && /* @__PURE__ */ t.jsx(
|
|
267
|
-
|
|
270
|
+
E,
|
|
268
271
|
{
|
|
269
272
|
variant: "ghost",
|
|
270
273
|
size: "sm",
|
|
@@ -275,7 +278,7 @@ const $ = j(
|
|
|
275
278
|
)
|
|
276
279
|
] })
|
|
277
280
|
] }) : /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
278
|
-
/* @__PURE__ */ t.jsx(
|
|
281
|
+
/* @__PURE__ */ t.jsx(S, { orientation: "vertical", className: "h-5" }),
|
|
279
282
|
/* @__PURE__ */ t.jsx("span", { className: "text-sm font-normal text-muted-foreground", children: "No filters applied" })
|
|
280
283
|
] })
|
|
281
284
|
] }),
|
|
@@ -291,7 +294,7 @@ const $ = j(
|
|
|
291
294
|
),
|
|
292
295
|
children: [
|
|
293
296
|
/* @__PURE__ */ t.jsx(
|
|
294
|
-
|
|
297
|
+
V,
|
|
295
298
|
{
|
|
296
299
|
items: U,
|
|
297
300
|
activeItemId: v,
|
|
@@ -310,6 +313,6 @@ const $ = j(
|
|
|
310
313
|
$.displayName = "FilterDropdown";
|
|
311
314
|
export {
|
|
312
315
|
$ as FilterDropdown,
|
|
313
|
-
|
|
314
|
-
|
|
316
|
+
V as FilterMenu,
|
|
317
|
+
A as FilterMenuItem
|
|
315
318
|
};
|