@krosoft/react 0.0.119 → 0.0.120
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/TableFilter-CLjQU36k.js +413 -0
- package/dist/components/core/filters/AdvancedFilters.d.ts +5 -5
- package/dist/components/core/filters/AdvancedFilters.d.ts.map +1 -1
- package/dist/components/core/filters/FilterField.d.ts +4 -4
- package/dist/components/core/filters/FilterField.d.ts.map +1 -1
- package/dist/components/core/filters/TableFilter.d.ts +6 -9
- package/dist/components/core/filters/TableFilter.d.ts.map +1 -1
- package/dist/components/core/filters/index.js +1 -1
- package/dist/components/core/index.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/types/FilterFieldConfig.d.ts +3 -2
- package/dist/types/FilterFieldConfig.d.ts.map +1 -1
- package/dist/types/FilterSection.d.ts +2 -2
- package/dist/types/FilterSection.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/TableFilter-DqDmlzhk.js +0 -409
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
import { jsxs as u, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useState as w, useEffect as D, useMemo as N } from "react";
|
|
3
|
+
import { a as M, D as $, b as O, S as _ } from "./SearchInput-DJ_F3emq.js";
|
|
4
|
+
import { aW as k, bD as I, bM as j, bF as z, bI as R, bL as B, a$ as Q, bH as V, bv as H, bx as W, bw as X, ce as G, _ as C } from "./toggle-group-wIgXZYDq.js";
|
|
5
|
+
import "./alert-B34E_4uH.js";
|
|
6
|
+
import { B as P } from "./badge-CfWlt79h.js";
|
|
7
|
+
import { B as F, C as J } from "./tooltip-YhBPXbcJ.js";
|
|
8
|
+
import { X as E, S as K, h as U, i as Y, a as Z, c as q } from "./select-DlQvLtI3.js";
|
|
9
|
+
import "next-themes";
|
|
10
|
+
import { c as ee } from "./tailwind.helper-gWiv5-6R.js";
|
|
11
|
+
import { M as re } from "./MultiSelect-BoisW4Kn.js";
|
|
12
|
+
import { c as te } from "./createLucideIcon-MP_wDWjs.js";
|
|
13
|
+
/**
|
|
14
|
+
* @license lucide-react v1.17.0 - ISC
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the ISC license.
|
|
17
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
18
|
+
*/
|
|
19
|
+
const le = [
|
|
20
|
+
[
|
|
21
|
+
"path",
|
|
22
|
+
{
|
|
23
|
+
d: "M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",
|
|
24
|
+
key: "sc7q7i"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
], ae = te("funnel", le), L = (c, l, s = {}) => {
|
|
28
|
+
if (l instanceof Date)
|
|
29
|
+
return l.toLocaleDateString("fr-FR");
|
|
30
|
+
const i = String(l), d = s[`${c}_${i}`];
|
|
31
|
+
return d !== void 0 ? d : c.includes("ok") || l === "true" || l === "false" ? l === "true" ? "Oui" : "Non" : i;
|
|
32
|
+
};
|
|
33
|
+
function se({ filters: c, onRemoveFilter: l, onClearAll: s, filterLabels: i = {}, optionLabels: d = {} }) {
|
|
34
|
+
const n = Object.entries(c).filter(([h, m]) => !(m == null || m === "" || Array.isArray(m) && m.length === 0));
|
|
35
|
+
return n.length === 0 ? null : /* @__PURE__ */ u("div", { className: "flex flex-wrap items-center gap-2 mb-4", children: [
|
|
36
|
+
/* @__PURE__ */ r("span", { className: "text-sm text-gray-600 font-medium", children: "Filtres actifs :" }),
|
|
37
|
+
n.flatMap(([h, m]) => {
|
|
38
|
+
const b = i[h] ?? h;
|
|
39
|
+
if (Array.isArray(m))
|
|
40
|
+
return m.map((v) => {
|
|
41
|
+
const p = L(h, v, d);
|
|
42
|
+
return /* @__PURE__ */ u(
|
|
43
|
+
P,
|
|
44
|
+
{
|
|
45
|
+
variant: "secondary",
|
|
46
|
+
className: "flex items-center gap-1 px-3 py-1 bg-blue-50 text-blue-700 border border-blue-200 hover:bg-blue-100",
|
|
47
|
+
children: [
|
|
48
|
+
b,
|
|
49
|
+
": ",
|
|
50
|
+
p,
|
|
51
|
+
/* @__PURE__ */ r(
|
|
52
|
+
"button",
|
|
53
|
+
{
|
|
54
|
+
onClick: () => {
|
|
55
|
+
l(h, v);
|
|
56
|
+
},
|
|
57
|
+
className: "ml-1 hover:bg-blue-200 rounded-full p-0.5",
|
|
58
|
+
children: /* @__PURE__ */ r(E, { className: "size-4" })
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
`${h}_${String(v)}`
|
|
64
|
+
);
|
|
65
|
+
});
|
|
66
|
+
const x = L(h, m, d);
|
|
67
|
+
return /* @__PURE__ */ u(P, { variant: "secondary", className: "flex items-center gap-1 px-3 py-1 bg-blue-50 text-blue-700 border border-blue-200 hover:bg-blue-100", children: [
|
|
68
|
+
b,
|
|
69
|
+
": ",
|
|
70
|
+
x,
|
|
71
|
+
/* @__PURE__ */ r(
|
|
72
|
+
"button",
|
|
73
|
+
{
|
|
74
|
+
onClick: () => {
|
|
75
|
+
l(h);
|
|
76
|
+
},
|
|
77
|
+
className: "ml-1 hover:bg-blue-200 rounded-full p-0.5",
|
|
78
|
+
children: /* @__PURE__ */ r(E, { className: "size-4" })
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
] }, h);
|
|
82
|
+
}),
|
|
83
|
+
n.length > 0 && /* @__PURE__ */ r("button", { onClick: s, className: "text-xs text-red-500 hover:text-red-600 transition-colors font-medium ml-2", children: "Effacer tout" })
|
|
84
|
+
] });
|
|
85
|
+
}
|
|
86
|
+
const ce = ({
|
|
87
|
+
field: c,
|
|
88
|
+
value: l,
|
|
89
|
+
onChange: s,
|
|
90
|
+
onToggleMultiSelect: i
|
|
91
|
+
}) => {
|
|
92
|
+
var d;
|
|
93
|
+
switch (c.type) {
|
|
94
|
+
case "text":
|
|
95
|
+
return /* @__PURE__ */ r(
|
|
96
|
+
k,
|
|
97
|
+
{
|
|
98
|
+
placeholder: c.placeholder,
|
|
99
|
+
value: l ?? "",
|
|
100
|
+
onChange: (n) => {
|
|
101
|
+
s(n.target.value);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
case "number":
|
|
106
|
+
return /* @__PURE__ */ r(
|
|
107
|
+
k,
|
|
108
|
+
{
|
|
109
|
+
type: "number",
|
|
110
|
+
placeholder: c.placeholder,
|
|
111
|
+
value: l ?? "",
|
|
112
|
+
onChange: (n) => {
|
|
113
|
+
s(n.target.value);
|
|
114
|
+
},
|
|
115
|
+
min: c.min,
|
|
116
|
+
max: c.max
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
case "select":
|
|
120
|
+
return c.searchable === !0 ? /* @__PURE__ */ r(
|
|
121
|
+
O,
|
|
122
|
+
{
|
|
123
|
+
options: c.options ?? [],
|
|
124
|
+
value: l,
|
|
125
|
+
onChange: s,
|
|
126
|
+
placeholder: c.placeholder,
|
|
127
|
+
searchPlaceholder: c.searchPlaceholder
|
|
128
|
+
}
|
|
129
|
+
) : /* @__PURE__ */ u(K, { value: l ?? "", onValueChange: s, children: [
|
|
130
|
+
/* @__PURE__ */ r(U, { className: ee((l === void 0 || l === "") && "text-muted-foreground"), children: /* @__PURE__ */ r(Y, { placeholder: c.placeholder }) }),
|
|
131
|
+
/* @__PURE__ */ r(Z, { children: (d = c.options) == null ? void 0 : d.map((n) => /* @__PURE__ */ r(q, { value: n.value, children: n.label }, n.value)) })
|
|
132
|
+
] });
|
|
133
|
+
case "date":
|
|
134
|
+
return /* @__PURE__ */ r($, { date: l, onDateChange: s, placeholder: c.placeholder ?? "Sélectionner une date" });
|
|
135
|
+
case "date-range":
|
|
136
|
+
return /* @__PURE__ */ r(M, { value: l, onChange: s, placeholder: c.placeholder });
|
|
137
|
+
case "multi-select":
|
|
138
|
+
return /* @__PURE__ */ r(
|
|
139
|
+
re,
|
|
140
|
+
{
|
|
141
|
+
options: c.options ?? [],
|
|
142
|
+
selected: l ?? [],
|
|
143
|
+
onToggle: i,
|
|
144
|
+
onClear: () => {
|
|
145
|
+
s([]);
|
|
146
|
+
},
|
|
147
|
+
onSelectAll: s,
|
|
148
|
+
placeholder: c.placeholder,
|
|
149
|
+
searchable: c.searchable,
|
|
150
|
+
searchPlaceholder: c.searchPlaceholder
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
default:
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
function ne({
|
|
158
|
+
sections: c,
|
|
159
|
+
filters: l,
|
|
160
|
+
onFiltersChange: s,
|
|
161
|
+
buttonText: i = "Plus de filtres",
|
|
162
|
+
sheetTitle: d = "Filtres avancés"
|
|
163
|
+
}) {
|
|
164
|
+
const [n, h] = w(!1), [m, b] = w(l);
|
|
165
|
+
D(() => {
|
|
166
|
+
b(l);
|
|
167
|
+
}, [l, n]);
|
|
168
|
+
const x = (f, t) => {
|
|
169
|
+
b((e) => ({ ...e, [f]: t }));
|
|
170
|
+
}, v = (f, t) => {
|
|
171
|
+
const e = m[f], a = Array.isArray(e) ? e : [], o = a.includes(t) ? a.filter((g) => g !== t) : [...a, t];
|
|
172
|
+
x(f, o);
|
|
173
|
+
}, p = () => {
|
|
174
|
+
s(m), h(!1);
|
|
175
|
+
}, y = () => {
|
|
176
|
+
b({}), s({}), h(!1);
|
|
177
|
+
};
|
|
178
|
+
return /* @__PURE__ */ u(I, { open: n, onOpenChange: h, children: [
|
|
179
|
+
/* @__PURE__ */ r(j, { asChild: !0, children: /* @__PURE__ */ u(F, { variant: "outline", className: "gap-2", children: [
|
|
180
|
+
/* @__PURE__ */ r(ae, { className: "size-4 shrink-0" }),
|
|
181
|
+
i
|
|
182
|
+
] }) }),
|
|
183
|
+
/* @__PURE__ */ u(z, { side: "right", className: "w-[400px] sm:w-[500px] flex flex-col p-0", children: [
|
|
184
|
+
/* @__PURE__ */ r(R, { className: "p-6 pb-0", children: /* @__PURE__ */ r(B, { children: d }) }),
|
|
185
|
+
/* @__PURE__ */ r("div", { className: "flex-1 overflow-y-auto p-6 pt-6", children: /* @__PURE__ */ r("div", { className: "space-y-6", children: c.map((f, t) => /* @__PURE__ */ u("div", { className: "space-y-4", children: [
|
|
186
|
+
/* @__PURE__ */ r("h3", { className: "font-semibold text-sm text-gray-900 dark:text-gray-100 border-b pb-2", children: f.title }),
|
|
187
|
+
f.filters.map((e) => /* @__PURE__ */ u("div", { className: "space-y-2", children: [
|
|
188
|
+
/* @__PURE__ */ r(Q, { htmlFor: e.key, children: e.label }),
|
|
189
|
+
/* @__PURE__ */ r(
|
|
190
|
+
ce,
|
|
191
|
+
{
|
|
192
|
+
field: e,
|
|
193
|
+
value: m[e.key],
|
|
194
|
+
onChange: (a) => {
|
|
195
|
+
x(e.key, a);
|
|
196
|
+
},
|
|
197
|
+
onToggleMultiSelect: (a) => {
|
|
198
|
+
v(e.key, a);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
)
|
|
202
|
+
] }, e.key))
|
|
203
|
+
] }, t)) }) }),
|
|
204
|
+
/* @__PURE__ */ u(V, { className: "gap-2 p-6 border-t bg-white dark:bg-gray-950", children: [
|
|
205
|
+
/* @__PURE__ */ r(F, { variant: "outline", className: "flex-1", onClick: y, children: "Effacer les filtres" }),
|
|
206
|
+
/* @__PURE__ */ r(F, { className: "flex-1 bg-orange-500 hover:bg-orange-600 text-white", onClick: p, children: "Rechercher" })
|
|
207
|
+
] })
|
|
208
|
+
] })
|
|
209
|
+
] });
|
|
210
|
+
}
|
|
211
|
+
function oe({
|
|
212
|
+
label: c,
|
|
213
|
+
options: l,
|
|
214
|
+
selected: s,
|
|
215
|
+
onToggle: i,
|
|
216
|
+
onClear: d,
|
|
217
|
+
onSelectAll: n,
|
|
218
|
+
searchable: h = !1,
|
|
219
|
+
searchPlaceholder: m = "Rechercher..."
|
|
220
|
+
}) {
|
|
221
|
+
const [b, x] = w(""), v = s.length > 0, p = N(() => b === "" ? l : l.filter((t) => t.label.toLowerCase().includes(b.toLowerCase())), [l, b]), y = N(() => p.length === 0 ? !1 : p.every((t) => s.includes(t.value)), [p, s]), f = () => {
|
|
222
|
+
if (y)
|
|
223
|
+
if (n !== void 0) {
|
|
224
|
+
const t = p.map((a) => a.value), e = s.filter((a) => !t.includes(a));
|
|
225
|
+
n(e);
|
|
226
|
+
} else d !== void 0 ? d() : s.forEach((t) => {
|
|
227
|
+
i(t);
|
|
228
|
+
});
|
|
229
|
+
else if (n !== void 0) {
|
|
230
|
+
const t = [...s];
|
|
231
|
+
p.forEach((e) => {
|
|
232
|
+
t.includes(e.value) || t.push(e.value);
|
|
233
|
+
}), n(t);
|
|
234
|
+
} else
|
|
235
|
+
p.forEach((t) => {
|
|
236
|
+
s.includes(t.value) || i(t.value);
|
|
237
|
+
});
|
|
238
|
+
};
|
|
239
|
+
return /* @__PURE__ */ u(
|
|
240
|
+
H,
|
|
241
|
+
{
|
|
242
|
+
onOpenChange: () => {
|
|
243
|
+
x("");
|
|
244
|
+
},
|
|
245
|
+
children: [
|
|
246
|
+
/* @__PURE__ */ r(W, { asChild: !0, children: /* @__PURE__ */ u(
|
|
247
|
+
"button",
|
|
248
|
+
{
|
|
249
|
+
className: `inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-sm transition-colors whitespace-nowrap ${v ? "border-primary bg-primary/10 text-primary font-medium" : "border-border bg-card text-card-foreground hover:bg-muted"}`,
|
|
250
|
+
children: [
|
|
251
|
+
c,
|
|
252
|
+
s.length > 0 && /* @__PURE__ */ r("span", { className: "flex h-4 min-w-[16px] items-center justify-center rounded-full bg-primary px-1 text-[10px] font-bold text-primary-foreground", children: s.length }),
|
|
253
|
+
/* @__PURE__ */ r(J, { className: "size-3.5 opacity-60" })
|
|
254
|
+
]
|
|
255
|
+
}
|
|
256
|
+
) }),
|
|
257
|
+
/* @__PURE__ */ u(X, { className: "w-56 p-0", align: "start", children: [
|
|
258
|
+
h ? /* @__PURE__ */ r("div", { className: "border-b border-border p-2", children: /* @__PURE__ */ u("div", { className: "relative", children: [
|
|
259
|
+
/* @__PURE__ */ r(G, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
|
|
260
|
+
/* @__PURE__ */ r(
|
|
261
|
+
"input",
|
|
262
|
+
{
|
|
263
|
+
className: "w-full rounded-md bg-muted/50 py-1.5 pl-7 pr-2 text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring",
|
|
264
|
+
placeholder: m,
|
|
265
|
+
value: b,
|
|
266
|
+
onChange: (t) => {
|
|
267
|
+
x(t.target.value);
|
|
268
|
+
},
|
|
269
|
+
autoFocus: !0
|
|
270
|
+
}
|
|
271
|
+
)
|
|
272
|
+
] }) }) : null,
|
|
273
|
+
/* @__PURE__ */ u("div", { className: "flex flex-col gap-0.5 max-h-56 overflow-y-auto p-1.5", children: [
|
|
274
|
+
p.length > 0 && /* @__PURE__ */ u("label", { className: "flex items-center gap-2.5 rounded-md px-2 py-2 text-sm hover:bg-muted cursor-pointer transition-colors", children: [
|
|
275
|
+
/* @__PURE__ */ r(C, { checked: y, onCheckedChange: f }),
|
|
276
|
+
"Tout sélectionner"
|
|
277
|
+
] }),
|
|
278
|
+
p.length === 0 && /* @__PURE__ */ r("p", { className: "px-2 py-3 text-center text-xs text-muted-foreground", children: "Aucun résultat" }),
|
|
279
|
+
p.map((t) => /* @__PURE__ */ u("label", { className: "flex items-center gap-2.5 rounded-md px-2 py-2 text-sm hover:bg-muted cursor-pointer transition-colors", children: [
|
|
280
|
+
/* @__PURE__ */ r(
|
|
281
|
+
C,
|
|
282
|
+
{
|
|
283
|
+
checked: s.includes(t.value),
|
|
284
|
+
onCheckedChange: () => {
|
|
285
|
+
i(t.value);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
),
|
|
289
|
+
t.label
|
|
290
|
+
] }, t.value))
|
|
291
|
+
] }),
|
|
292
|
+
s.length > 0 && /* @__PURE__ */ r("div", { className: "border-t border-border p-1.5", children: /* @__PURE__ */ r(
|
|
293
|
+
"button",
|
|
294
|
+
{
|
|
295
|
+
onClick: () => {
|
|
296
|
+
d !== void 0 ? d() : s.forEach((t) => {
|
|
297
|
+
i(t);
|
|
298
|
+
});
|
|
299
|
+
},
|
|
300
|
+
className: "w-full rounded-md px-2 py-1.5 text-xs text-muted-foreground hover:text-foreground hover:bg-muted transition-colors text-center",
|
|
301
|
+
children: "Tout désélectionner"
|
|
302
|
+
}
|
|
303
|
+
) })
|
|
304
|
+
] })
|
|
305
|
+
]
|
|
306
|
+
}
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
function Ne({
|
|
310
|
+
searchQuery: c,
|
|
311
|
+
onSearchChange: l,
|
|
312
|
+
searchPlaceholder: s = "Rechercher...",
|
|
313
|
+
filters: i,
|
|
314
|
+
onFiltersChange: d,
|
|
315
|
+
sections: n,
|
|
316
|
+
advancedButtonText: h = "Filtres",
|
|
317
|
+
sheetTitle: m = "Filtres avancés"
|
|
318
|
+
}) {
|
|
319
|
+
const b = (e, a) => {
|
|
320
|
+
const o = i[e], g = Array.isArray(o) ? o : [], A = g.includes(a) ? g.filter((T) => T !== a) : [...g, a], S = { ...i };
|
|
321
|
+
A.length === 0 ? delete S[e] : S[e] = A, d(S);
|
|
322
|
+
}, x = (e) => {
|
|
323
|
+
const a = { ...i };
|
|
324
|
+
delete a[e], d(a);
|
|
325
|
+
}, v = () => {
|
|
326
|
+
d({});
|
|
327
|
+
}, p = (e, a) => {
|
|
328
|
+
const o = { ...i }, g = o[e];
|
|
329
|
+
Array.isArray(g) && a !== void 0 ? (o[e] = g.filter((A) => A !== a), Array.isArray(o[e]) && o[e].length === 0 && delete o[e]) : delete o[e], d(o);
|
|
330
|
+
}, y = N(() => {
|
|
331
|
+
const e = [];
|
|
332
|
+
return n.forEach((a) => {
|
|
333
|
+
a.filters.forEach((o) => {
|
|
334
|
+
o.isQuickFilter === !0 && e.push({
|
|
335
|
+
key: o.key,
|
|
336
|
+
label: o.label,
|
|
337
|
+
options: o.options ?? [],
|
|
338
|
+
searchable: o.searchable,
|
|
339
|
+
searchPlaceholder: o.searchPlaceholder
|
|
340
|
+
});
|
|
341
|
+
});
|
|
342
|
+
}), e;
|
|
343
|
+
}, [n]), f = N(() => {
|
|
344
|
+
const e = {};
|
|
345
|
+
return n.forEach((a) => {
|
|
346
|
+
a.filters.forEach((o) => {
|
|
347
|
+
e[o.key] = o.badgeLabel ?? o.label;
|
|
348
|
+
});
|
|
349
|
+
}), e;
|
|
350
|
+
}, [n]), t = N(() => {
|
|
351
|
+
const e = {};
|
|
352
|
+
return n.forEach((a) => {
|
|
353
|
+
a.filters.forEach((o) => {
|
|
354
|
+
o.options !== void 0 && o.options.forEach((g) => {
|
|
355
|
+
e[`${o.key}_${g.value}`] = g.label;
|
|
356
|
+
});
|
|
357
|
+
});
|
|
358
|
+
}), e;
|
|
359
|
+
}, [n]);
|
|
360
|
+
return /* @__PURE__ */ u("div", { className: "space-y-4 w-full", children: [
|
|
361
|
+
/* @__PURE__ */ r("div", { className: "flex flex-wrap items-center gap-3 justify-between", children: /* @__PURE__ */ u("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
362
|
+
l !== void 0 ? /* @__PURE__ */ r(
|
|
363
|
+
_,
|
|
364
|
+
{
|
|
365
|
+
searchQuery: c,
|
|
366
|
+
onSearch: l,
|
|
367
|
+
onClear: () => {
|
|
368
|
+
l("");
|
|
369
|
+
},
|
|
370
|
+
placeholder: s
|
|
371
|
+
}
|
|
372
|
+
) : null,
|
|
373
|
+
y.map((e) => /* @__PURE__ */ r(
|
|
374
|
+
oe,
|
|
375
|
+
{
|
|
376
|
+
label: e.label,
|
|
377
|
+
options: e.options,
|
|
378
|
+
selected: Array.isArray(i[e.key]) ? i[e.key] : [],
|
|
379
|
+
onToggle: (a) => {
|
|
380
|
+
b(e.key, a);
|
|
381
|
+
},
|
|
382
|
+
onClear: () => {
|
|
383
|
+
x(e.key);
|
|
384
|
+
},
|
|
385
|
+
onSelectAll: (a) => {
|
|
386
|
+
d({ ...i, [e.key]: a });
|
|
387
|
+
},
|
|
388
|
+
searchable: e.searchable,
|
|
389
|
+
searchPlaceholder: e.searchPlaceholder
|
|
390
|
+
},
|
|
391
|
+
e.key
|
|
392
|
+
)),
|
|
393
|
+
n.length > 0 && /* @__PURE__ */ r(ne, { sections: n, filters: i, onFiltersChange: d, buttonText: h, sheetTitle: m })
|
|
394
|
+
] }) }),
|
|
395
|
+
/* @__PURE__ */ r(
|
|
396
|
+
se,
|
|
397
|
+
{
|
|
398
|
+
filters: i,
|
|
399
|
+
onRemoveFilter: p,
|
|
400
|
+
onClearAll: v,
|
|
401
|
+
filterLabels: f,
|
|
402
|
+
optionLabels: t
|
|
403
|
+
}
|
|
404
|
+
)
|
|
405
|
+
] });
|
|
406
|
+
}
|
|
407
|
+
export {
|
|
408
|
+
se as A,
|
|
409
|
+
ce as F,
|
|
410
|
+
oe as S,
|
|
411
|
+
Ne as T,
|
|
412
|
+
ne as a
|
|
413
|
+
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { FilterSection } from "@/types/FilterSection";
|
|
3
|
-
export interface AdvancedFiltersProps {
|
|
4
|
-
sections: FilterSection[];
|
|
5
|
-
filters:
|
|
6
|
-
onFiltersChange: (filters:
|
|
3
|
+
export interface AdvancedFiltersProps<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
4
|
+
sections: FilterSection<T>[];
|
|
5
|
+
filters: T;
|
|
6
|
+
onFiltersChange: (filters: T) => void;
|
|
7
7
|
buttonText?: string;
|
|
8
8
|
sheetTitle?: string;
|
|
9
9
|
}
|
|
10
|
-
export declare function AdvancedFilters({ sections, filters, onFiltersChange, buttonText, sheetTitle, }: AdvancedFiltersProps): React.ReactElement;
|
|
10
|
+
export declare function AdvancedFilters<T extends Record<string, unknown> = Record<string, unknown>>({ sections, filters, onFiltersChange, buttonText, sheetTitle, }: AdvancedFiltersProps<T>): React.ReactElement;
|
|
11
11
|
//# sourceMappingURL=AdvancedFilters.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdvancedFilters.d.ts","sourceRoot":"","sources":["../../../../src/components/core/filters/AdvancedFilters.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAGnD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGtD,MAAM,WAAW,oBAAoB
|
|
1
|
+
{"version":3,"file":"AdvancedFilters.d.ts","sourceRoot":"","sources":["../../../../src/components/core/filters/AdvancedFilters.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAGnD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGtD,MAAM,WAAW,oBAAoB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC/F,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7B,OAAO,EAAE,CAAC,CAAC;IACX,eAAe,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,IAAI,CAAC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAC3F,QAAQ,EACR,OAAO,EACP,eAAe,EACf,UAA8B,EAC9B,UAA8B,GAC/B,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,YAAY,CAiF9C"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
interface FilterFieldProps {
|
|
4
|
-
field: FilterFieldConfig
|
|
2
|
+
import { FilterFieldConfig } from "@/types/FilterFieldConfig";
|
|
3
|
+
interface FilterFieldProps<T extends Record<string, unknown>> {
|
|
4
|
+
field: FilterFieldConfig<T>;
|
|
5
5
|
value: unknown;
|
|
6
6
|
onChange: (value: unknown) => void;
|
|
7
7
|
onToggleMultiSelect: (value: string) => void;
|
|
8
8
|
}
|
|
9
|
-
export declare const FilterField: ({ field, value, onChange, onToggleMultiSelect }: FilterFieldProps) => React.ReactElement | null;
|
|
9
|
+
export declare const FilterField: <T extends Record<string, unknown>>({ field, value, onChange, onToggleMultiSelect, }: FilterFieldProps<T>) => React.ReactElement | null;
|
|
10
10
|
export {};
|
|
11
11
|
//# sourceMappingURL=FilterField.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterField.d.ts","sourceRoot":"","sources":["../../../../src/components/core/filters/FilterField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"FilterField.d.ts","sourceRoot":"","sources":["../../../../src/components/core/filters/FilterField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,UAAU,gBAAgB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC1D,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C;AAED,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,kDAK5D,gBAAgB,CAAC,CAAC,CAAC,KAAG,KAAK,CAAC,YAAY,GAAG,IA+E7C,CAAC"}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
+
import type { FilterSection } from "@/types/FilterSection";
|
|
1
2
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
import { FilterFieldConfig } from "@/types/FilterFieldConfig";
|
|
4
|
-
interface TableFilterProps {
|
|
3
|
+
export interface TableFilterProps<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
5
4
|
searchQuery?: string;
|
|
6
5
|
onSearchChange?: (query: string) => void;
|
|
7
6
|
searchPlaceholder?: string;
|
|
8
|
-
filters:
|
|
9
|
-
onFiltersChange: (filters:
|
|
10
|
-
|
|
11
|
-
sections: FilterSection[];
|
|
7
|
+
filters: T;
|
|
8
|
+
onFiltersChange: (filters: T) => void;
|
|
9
|
+
sections: FilterSection<T>[];
|
|
12
10
|
advancedButtonText?: string;
|
|
13
11
|
sheetTitle?: string;
|
|
14
12
|
}
|
|
15
|
-
export declare function TableFilter({ searchQuery, onSearchChange, searchPlaceholder, filters, onFiltersChange,
|
|
16
|
-
export type { FilterFieldConfig, FilterSection };
|
|
13
|
+
export declare function TableFilter<T extends Record<string, unknown> = Record<string, unknown>>({ searchQuery, onSearchChange, searchPlaceholder, filters, onFiltersChange, sections, advancedButtonText, sheetTitle, }: TableFilterProps<T>): React.ReactElement;
|
|
17
14
|
//# sourceMappingURL=TableFilter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableFilter.d.ts","sourceRoot":"","sources":["../../../../src/components/core/filters/TableFilter.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"TableFilter.d.ts","sourceRoot":"","sources":["../../../../src/components/core/filters/TableFilter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAkB,MAAM,OAAO,CAAC;AAMvC,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAE3F,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAG3B,OAAO,EAAE,CAAC,CAAC;IACX,eAAe,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,IAAI,CAAC;IAGtC,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;IAG7B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EACvF,WAAW,EACX,cAAc,EACd,iBAAmC,EACnC,OAAO,EACP,eAAe,EACf,QAAQ,EACR,kBAA8B,EAC9B,UAA8B,GAC/B,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,YAAY,CAkJ1C"}
|
|
@@ -2,7 +2,7 @@ import { D as r, M as o } from "../../MetricCard-C-ewNR_i.js";
|
|
|
2
2
|
import { K as t, a as i, S as l, b as p } from "../../SkeletonCards-C5lXTSrB.js";
|
|
3
3
|
import { A as b, C as f, F as g } from "../../ConfirmationDialog-CkMyyh_3.js";
|
|
4
4
|
import { D as T, a as n, b as c, c as d, d as x, e as A, f as S, g as C, h as F, i as P, P as h } from "../../toggle-group-wIgXZYDq.js";
|
|
5
|
-
import { A as k, a as I, F as K, S as v, T as E } from "../../TableFilter-
|
|
5
|
+
import { A as k, a as I, F as K, S as v, T as E } from "../../TableFilter-CLjQU36k.js";
|
|
6
6
|
import { G as y } from "../../GenericForm-CmwqEXiQ.js";
|
|
7
7
|
import { I as L } from "../../ImageInput-C8HcxE8t.js";
|
|
8
8
|
import { D as G, a as N, S as O, b as R } from "../../SearchInput-DJ_F3emq.js";
|
package/dist/components/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { D as o, M as s } from "../MetricCard-C-ewNR_i.js";
|
|
|
2
2
|
import { K as t, a as n, S as i, b as l } from "../SkeletonCards-C5lXTSrB.js";
|
|
3
3
|
import { A as p, C as u, F as g } from "../ConfirmationDialog-CkMyyh_3.js";
|
|
4
4
|
import { A as d, j as m, k as c, l as T, m as S, n as D, o as M, p as x, q as A, r as I, s as P, t as h, u as w, v, w as f, x as F, B as L, y as B, z as G, C as R, E as k, F as H, G as N, H as y, I as E, J as O, K as V, L as K, M as z, N as U, O as j, Q as q, R as J, S as Q, T as W, U as X, V as Y, W as Z, X as _, Y as $, Z as aa, _ as ea, $ as oa, a0 as sa, a1 as ra, a2 as ta, a3 as na, a4 as ia, a5 as la, a6 as ba, a7 as pa, a8 as ua, a9 as ga, aa as Ca, ab as da, ac as ma, ad as ca, ae as Ta, af as Sa, ag as Da, ah as Ma, ai as xa, aj as Aa, ak as Ia, al as Pa, am as ha, D as wa, a as va, b as fa, c as Fa, d as La, e as Ba, f as Ga, g as Ra, h as ka, i as Ha, an as Na, ao as ya, ap as Ea, aq as Oa, ar as Va, as as Ka, at as za, au as Ua, av as ja, aw as qa, ax as Ja, ay as Qa, az as Wa, aA as Xa, aB as Ya, aC as Za, aD as _a, aE as $a, aF as ae, aG as ee, aH as oe, aI as se, aJ as re, aK as te, aL as ne, aM as ie, aN as le, aO as be, aP as pe, aQ as ue, aR as ge, aS as Ce, aT as de, aU as me, aV as ce, aW as Te, aX as Se, aY as De, aZ as Me, a_ as xe, a$ as Ae, b0 as Ie, b1 as Pe, b2 as he, b3 as we, b4 as ve, b5 as fe, b6 as Fe, b7 as Le, b8 as Be, b9 as Ge, ba as Re, bb as ke, bc as He, bd as Ne, be as ye, bf as Ee, bg as Oe, bh as Ve, bi as Ke, bj as ze, bk as Ue, bl as je, bm as qe, bn as Je, bo as Qe, bp as We, bq as Xe, br as Ye, bs as Ze, bt as _e, bu as $e, bv as ao, bw as eo, bx as oo, P as so, by as ro, bz as to, bA as no, bB as io, bC as lo, bD as bo, bE as po, bF as uo, bG as go, bH as Co, bI as mo, bJ as co, bK as To, bL as So, bM as Do, bN as Mo, bO as xo, bP as Ao, bQ as Io, bR as Po, bS as ho, bT as wo, bU as vo, bV as fo, bW as Fo, bX as Lo, bY as Bo, bZ as Go, b_ as Ro, b$ as ko, c0 as Ho, c1 as No, c2 as yo, c3 as Eo, c4 as Oo, c5 as Vo, c6 as Ko, c7 as zo, c8 as Uo, c9 as jo, ca as qo, cb as Jo, cc as Qo, cd as Wo } from "../toggle-group-wIgXZYDq.js";
|
|
5
|
-
import { A as Yo, a as Zo, F as _o, S as $o, T as as } from "../TableFilter-
|
|
5
|
+
import { A as Yo, a as Zo, F as _o, S as $o, T as as } from "../TableFilter-CLjQU36k.js";
|
|
6
6
|
import { G as os } from "../GenericForm-CmwqEXiQ.js";
|
|
7
7
|
import { I as rs } from "../ImageInput-C8HcxE8t.js";
|
|
8
8
|
import { D as ns, a as is, S as ls, b as bs } from "../SearchInput-DJ_F3emq.js";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { SelectOption } from "@krosoft/core/types";
|
|
2
|
-
export interface FilterFieldConfig {
|
|
3
|
-
key: string
|
|
2
|
+
export interface FilterFieldConfig<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
3
|
+
key: Extract<keyof T, string>;
|
|
4
4
|
label: string;
|
|
5
|
+
badgeLabel?: string;
|
|
5
6
|
type: "text" | "select" | "date" | "date-range" | "number" | "multi-select";
|
|
6
7
|
placeholder?: string;
|
|
7
8
|
options?: SelectOption[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterFieldConfig.d.ts","sourceRoot":"","sources":["../../src/types/FilterFieldConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,WAAW,iBAAiB;
|
|
1
|
+
{"version":3,"file":"FilterFieldConfig.d.ts","sourceRoot":"","sources":["../../src/types/FilterFieldConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC5F,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,YAAY,GAAG,QAAQ,GAAG,cAAc,CAAC;IAC5E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FilterFieldConfig } from "./FilterFieldConfig";
|
|
2
|
-
export interface FilterSection {
|
|
2
|
+
export interface FilterSection<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
3
3
|
title: string;
|
|
4
|
-
filters: FilterFieldConfig[];
|
|
4
|
+
filters: FilterFieldConfig<T>[];
|
|
5
5
|
}
|
|
6
6
|
//# sourceMappingURL=FilterSection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterSection.d.ts","sourceRoot":"","sources":["../../src/types/FilterSection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,WAAW,aAAa;
|
|
1
|
+
{"version":3,"file":"FilterSection.d.ts","sourceRoot":"","sources":["../../src/types/FilterSection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACxF,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC;CACjC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -5,9 +5,9 @@ export * from "./ColumnDef";
|
|
|
5
5
|
export * from "./ConfirmDialogConfig";
|
|
6
6
|
export * from "./FilterFieldConfig";
|
|
7
7
|
export * from "./FilterSection";
|
|
8
|
+
export * from "./forms";
|
|
8
9
|
export * from "./RowAction";
|
|
9
10
|
export * from "./TabConfig";
|
|
10
11
|
export * from "./UseDataTableProps";
|
|
11
12
|
export * from "./UseDataTableResult";
|
|
12
|
-
export * from "./forms";
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,409 +0,0 @@
|
|
|
1
|
-
import { jsxs as m, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { useState as k, useEffect as M, useMemo as A } from "react";
|
|
3
|
-
import { a as $, D as O, b as _, S as I } from "./SearchInput-DJ_F3emq.js";
|
|
4
|
-
import { aW as C, bD as j, bM as z, bF as R, bI as B, bL as Q, a$ as V, bH as H, bv as W, bx as X, bw as G, ce as J, _ as P } from "./toggle-group-wIgXZYDq.js";
|
|
5
|
-
import "./alert-B34E_4uH.js";
|
|
6
|
-
import { B as w, C as K } from "./tooltip-YhBPXbcJ.js";
|
|
7
|
-
import { X as E, S as U, h as Y, i as Z, a as q, c as ee } from "./select-DlQvLtI3.js";
|
|
8
|
-
import "next-themes";
|
|
9
|
-
import { B as L } from "./badge-CfWlt79h.js";
|
|
10
|
-
import { c as re } from "./tailwind.helper-gWiv5-6R.js";
|
|
11
|
-
import { M as te } from "./MultiSelect-BoisW4Kn.js";
|
|
12
|
-
import { c as le } from "./createLucideIcon-MP_wDWjs.js";
|
|
13
|
-
/**
|
|
14
|
-
* @license lucide-react v1.17.0 - ISC
|
|
15
|
-
*
|
|
16
|
-
* This source code is licensed under the ISC license.
|
|
17
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/
|
|
19
|
-
const ae = [
|
|
20
|
-
[
|
|
21
|
-
"path",
|
|
22
|
-
{
|
|
23
|
-
d: "M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",
|
|
24
|
-
key: "sc7q7i"
|
|
25
|
-
}
|
|
26
|
-
]
|
|
27
|
-
], se = le("funnel", ae), T = (s, l, a = {}) => {
|
|
28
|
-
if (l instanceof Date)
|
|
29
|
-
return l.toLocaleDateString("fr-FR");
|
|
30
|
-
const o = String(l), i = a[`${s}_${o}`];
|
|
31
|
-
return i !== void 0 ? i : s.includes("ok") || l === "true" || l === "false" ? l === "true" ? "Oui" : "Non" : o;
|
|
32
|
-
};
|
|
33
|
-
function ce({ filters: s, onRemoveFilter: l, onClearAll: a, filterLabels: o = {}, optionLabels: i = {} }) {
|
|
34
|
-
const d = Object.entries(s).filter(([n, p]) => !(p == null || p === "" || Array.isArray(p) && p.length === 0));
|
|
35
|
-
return d.length === 0 ? null : /* @__PURE__ */ m("div", { className: "flex flex-wrap items-center gap-2 mb-4", children: [
|
|
36
|
-
/* @__PURE__ */ r("span", { className: "text-sm text-gray-600 font-medium", children: "Filtres actifs :" }),
|
|
37
|
-
d.flatMap(([n, p]) => {
|
|
38
|
-
const f = o[n] ?? n;
|
|
39
|
-
if (Array.isArray(p))
|
|
40
|
-
return p.map((v) => {
|
|
41
|
-
const b = T(n, v, i);
|
|
42
|
-
return /* @__PURE__ */ m(
|
|
43
|
-
L,
|
|
44
|
-
{
|
|
45
|
-
variant: "secondary",
|
|
46
|
-
className: "flex items-center gap-1 px-3 py-1 bg-blue-50 text-blue-700 border border-blue-200 hover:bg-blue-100",
|
|
47
|
-
children: [
|
|
48
|
-
f,
|
|
49
|
-
": ",
|
|
50
|
-
b,
|
|
51
|
-
/* @__PURE__ */ r(
|
|
52
|
-
"button",
|
|
53
|
-
{
|
|
54
|
-
onClick: () => {
|
|
55
|
-
l(n, v);
|
|
56
|
-
},
|
|
57
|
-
className: "ml-1 hover:bg-blue-200 rounded-full p-0.5",
|
|
58
|
-
children: /* @__PURE__ */ r(E, { className: "size-4" })
|
|
59
|
-
}
|
|
60
|
-
)
|
|
61
|
-
]
|
|
62
|
-
},
|
|
63
|
-
`${n}_${String(v)}`
|
|
64
|
-
);
|
|
65
|
-
});
|
|
66
|
-
const x = T(n, p, i);
|
|
67
|
-
return /* @__PURE__ */ m(L, { variant: "secondary", className: "flex items-center gap-1 px-3 py-1 bg-blue-50 text-blue-700 border border-blue-200 hover:bg-blue-100", children: [
|
|
68
|
-
f,
|
|
69
|
-
": ",
|
|
70
|
-
x,
|
|
71
|
-
/* @__PURE__ */ r(
|
|
72
|
-
"button",
|
|
73
|
-
{
|
|
74
|
-
onClick: () => {
|
|
75
|
-
l(n);
|
|
76
|
-
},
|
|
77
|
-
className: "ml-1 hover:bg-blue-200 rounded-full p-0.5",
|
|
78
|
-
children: /* @__PURE__ */ r(E, { className: "size-4" })
|
|
79
|
-
}
|
|
80
|
-
)
|
|
81
|
-
] }, n);
|
|
82
|
-
}),
|
|
83
|
-
d.length > 0 && /* @__PURE__ */ r("button", { onClick: a, className: "text-xs text-red-500 hover:text-red-600 transition-colors font-medium ml-2", children: "Effacer tout" })
|
|
84
|
-
] });
|
|
85
|
-
}
|
|
86
|
-
const ne = ({ field: s, value: l, onChange: a, onToggleMultiSelect: o }) => {
|
|
87
|
-
var i;
|
|
88
|
-
switch (s.type) {
|
|
89
|
-
case "text":
|
|
90
|
-
return /* @__PURE__ */ r(
|
|
91
|
-
C,
|
|
92
|
-
{
|
|
93
|
-
placeholder: s.placeholder,
|
|
94
|
-
value: l ?? "",
|
|
95
|
-
onChange: (d) => {
|
|
96
|
-
a(d.target.value);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
);
|
|
100
|
-
case "number":
|
|
101
|
-
return /* @__PURE__ */ r(
|
|
102
|
-
C,
|
|
103
|
-
{
|
|
104
|
-
type: "number",
|
|
105
|
-
placeholder: s.placeholder,
|
|
106
|
-
value: l ?? "",
|
|
107
|
-
onChange: (d) => {
|
|
108
|
-
a(d.target.value);
|
|
109
|
-
},
|
|
110
|
-
min: s.min,
|
|
111
|
-
max: s.max
|
|
112
|
-
}
|
|
113
|
-
);
|
|
114
|
-
case "select":
|
|
115
|
-
return s.searchable === !0 ? /* @__PURE__ */ r(
|
|
116
|
-
_,
|
|
117
|
-
{
|
|
118
|
-
options: s.options ?? [],
|
|
119
|
-
value: l,
|
|
120
|
-
onChange: a,
|
|
121
|
-
placeholder: s.placeholder,
|
|
122
|
-
searchPlaceholder: s.searchPlaceholder
|
|
123
|
-
}
|
|
124
|
-
) : /* @__PURE__ */ m(U, { value: l ?? "", onValueChange: a, children: [
|
|
125
|
-
/* @__PURE__ */ r(Y, { className: re((l === void 0 || l === "") && "text-muted-foreground"), children: /* @__PURE__ */ r(Z, { placeholder: s.placeholder }) }),
|
|
126
|
-
/* @__PURE__ */ r(q, { children: (i = s.options) == null ? void 0 : i.map((d) => /* @__PURE__ */ r(ee, { value: d.value, children: d.label }, d.value)) })
|
|
127
|
-
] });
|
|
128
|
-
case "date":
|
|
129
|
-
return /* @__PURE__ */ r(O, { date: l, onDateChange: a, placeholder: s.placeholder ?? "Sélectionner une date" });
|
|
130
|
-
case "date-range":
|
|
131
|
-
return /* @__PURE__ */ r($, { value: l, onChange: a, placeholder: s.placeholder });
|
|
132
|
-
case "multi-select":
|
|
133
|
-
return /* @__PURE__ */ r(
|
|
134
|
-
te,
|
|
135
|
-
{
|
|
136
|
-
options: s.options ?? [],
|
|
137
|
-
selected: l ?? [],
|
|
138
|
-
onToggle: o,
|
|
139
|
-
onClear: () => {
|
|
140
|
-
a([]);
|
|
141
|
-
},
|
|
142
|
-
onSelectAll: a,
|
|
143
|
-
placeholder: s.placeholder,
|
|
144
|
-
searchable: s.searchable,
|
|
145
|
-
searchPlaceholder: s.searchPlaceholder
|
|
146
|
-
}
|
|
147
|
-
);
|
|
148
|
-
default:
|
|
149
|
-
return null;
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
function oe({
|
|
153
|
-
sections: s,
|
|
154
|
-
filters: l,
|
|
155
|
-
onFiltersChange: a,
|
|
156
|
-
buttonText: o = "Plus de filtres",
|
|
157
|
-
sheetTitle: i = "Filtres avancés"
|
|
158
|
-
}) {
|
|
159
|
-
const [d, n] = k(!1), [p, f] = k(l);
|
|
160
|
-
M(() => {
|
|
161
|
-
f(l);
|
|
162
|
-
}, [l, d]);
|
|
163
|
-
const x = (g, t) => {
|
|
164
|
-
f((h) => ({ ...h, [g]: t }));
|
|
165
|
-
}, v = (g, t) => {
|
|
166
|
-
const h = p[g], e = Array.isArray(h) ? h : [], u = e.includes(t) ? e.filter((c) => c !== t) : [...e, t];
|
|
167
|
-
x(g, u);
|
|
168
|
-
}, b = () => {
|
|
169
|
-
a(p), n(!1);
|
|
170
|
-
}, N = () => {
|
|
171
|
-
f({}), a({}), n(!1);
|
|
172
|
-
};
|
|
173
|
-
return /* @__PURE__ */ m(j, { open: d, onOpenChange: n, children: [
|
|
174
|
-
/* @__PURE__ */ r(z, { asChild: !0, children: /* @__PURE__ */ m(w, { variant: "outline", className: "gap-2", children: [
|
|
175
|
-
/* @__PURE__ */ r(se, { className: "size-4 shrink-0" }),
|
|
176
|
-
o
|
|
177
|
-
] }) }),
|
|
178
|
-
/* @__PURE__ */ m(R, { side: "right", className: "w-[400px] sm:w-[500px] flex flex-col p-0", children: [
|
|
179
|
-
/* @__PURE__ */ r(B, { className: "p-6 pb-0", children: /* @__PURE__ */ r(Q, { children: i }) }),
|
|
180
|
-
/* @__PURE__ */ r("div", { className: "flex-1 overflow-y-auto p-6 pt-6", children: /* @__PURE__ */ r("div", { className: "space-y-6", children: s.map((g, t) => /* @__PURE__ */ m("div", { className: "space-y-4", children: [
|
|
181
|
-
/* @__PURE__ */ r("h3", { className: "font-semibold text-sm text-gray-900 dark:text-gray-100 border-b pb-2", children: g.title }),
|
|
182
|
-
g.filters.map((h) => /* @__PURE__ */ m("div", { className: "space-y-2", children: [
|
|
183
|
-
/* @__PURE__ */ r(V, { htmlFor: h.key, children: h.label }),
|
|
184
|
-
/* @__PURE__ */ r(
|
|
185
|
-
ne,
|
|
186
|
-
{
|
|
187
|
-
field: h,
|
|
188
|
-
value: p[h.key],
|
|
189
|
-
onChange: (e) => {
|
|
190
|
-
x(h.key, e);
|
|
191
|
-
},
|
|
192
|
-
onToggleMultiSelect: (e) => {
|
|
193
|
-
v(h.key, e);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
)
|
|
197
|
-
] }, h.key))
|
|
198
|
-
] }, t)) }) }),
|
|
199
|
-
/* @__PURE__ */ m(H, { className: "gap-2 p-6 border-t bg-white dark:bg-gray-950", children: [
|
|
200
|
-
/* @__PURE__ */ r(w, { variant: "outline", className: "flex-1", onClick: N, children: "Effacer les filtres" }),
|
|
201
|
-
/* @__PURE__ */ r(w, { className: "flex-1 bg-orange-500 hover:bg-orange-600 text-white", onClick: b, children: "Rechercher" })
|
|
202
|
-
] })
|
|
203
|
-
] })
|
|
204
|
-
] });
|
|
205
|
-
}
|
|
206
|
-
function ie({
|
|
207
|
-
label: s,
|
|
208
|
-
options: l,
|
|
209
|
-
selected: a,
|
|
210
|
-
onToggle: o,
|
|
211
|
-
onClear: i,
|
|
212
|
-
onSelectAll: d,
|
|
213
|
-
searchable: n = !1,
|
|
214
|
-
searchPlaceholder: p = "Rechercher..."
|
|
215
|
-
}) {
|
|
216
|
-
const [f, x] = k(""), v = a.length > 0, b = A(() => f === "" ? l : l.filter((t) => t.label.toLowerCase().includes(f.toLowerCase())), [l, f]), N = A(() => b.length === 0 ? !1 : b.every((t) => a.includes(t.value)), [b, a]), g = () => {
|
|
217
|
-
if (N)
|
|
218
|
-
if (d !== void 0) {
|
|
219
|
-
const t = b.map((e) => e.value), h = a.filter((e) => !t.includes(e));
|
|
220
|
-
d(h);
|
|
221
|
-
} else i !== void 0 ? i() : a.forEach((t) => {
|
|
222
|
-
o(t);
|
|
223
|
-
});
|
|
224
|
-
else if (d !== void 0) {
|
|
225
|
-
const t = [...a];
|
|
226
|
-
b.forEach((h) => {
|
|
227
|
-
t.includes(h.value) || t.push(h.value);
|
|
228
|
-
}), d(t);
|
|
229
|
-
} else
|
|
230
|
-
b.forEach((t) => {
|
|
231
|
-
a.includes(t.value) || o(t.value);
|
|
232
|
-
});
|
|
233
|
-
};
|
|
234
|
-
return /* @__PURE__ */ m(
|
|
235
|
-
W,
|
|
236
|
-
{
|
|
237
|
-
onOpenChange: () => {
|
|
238
|
-
x("");
|
|
239
|
-
},
|
|
240
|
-
children: [
|
|
241
|
-
/* @__PURE__ */ r(X, { asChild: !0, children: /* @__PURE__ */ m(
|
|
242
|
-
"button",
|
|
243
|
-
{
|
|
244
|
-
className: `inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-sm transition-colors whitespace-nowrap ${v ? "border-primary bg-primary/10 text-primary font-medium" : "border-border bg-card text-card-foreground hover:bg-muted"}`,
|
|
245
|
-
children: [
|
|
246
|
-
s,
|
|
247
|
-
a.length > 0 && /* @__PURE__ */ r("span", { className: "flex h-4 min-w-[16px] items-center justify-center rounded-full bg-primary px-1 text-[10px] font-bold text-primary-foreground", children: a.length }),
|
|
248
|
-
/* @__PURE__ */ r(K, { className: "size-3.5 opacity-60" })
|
|
249
|
-
]
|
|
250
|
-
}
|
|
251
|
-
) }),
|
|
252
|
-
/* @__PURE__ */ m(G, { className: "w-56 p-0", align: "start", children: [
|
|
253
|
-
n ? /* @__PURE__ */ r("div", { className: "border-b border-border p-2", children: /* @__PURE__ */ m("div", { className: "relative", children: [
|
|
254
|
-
/* @__PURE__ */ r(J, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
|
|
255
|
-
/* @__PURE__ */ r(
|
|
256
|
-
"input",
|
|
257
|
-
{
|
|
258
|
-
className: "w-full rounded-md bg-muted/50 py-1.5 pl-7 pr-2 text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring",
|
|
259
|
-
placeholder: p,
|
|
260
|
-
value: f,
|
|
261
|
-
onChange: (t) => {
|
|
262
|
-
x(t.target.value);
|
|
263
|
-
},
|
|
264
|
-
autoFocus: !0
|
|
265
|
-
}
|
|
266
|
-
)
|
|
267
|
-
] }) }) : null,
|
|
268
|
-
/* @__PURE__ */ m("div", { className: "flex flex-col gap-0.5 max-h-56 overflow-y-auto p-1.5", children: [
|
|
269
|
-
b.length > 0 && /* @__PURE__ */ m("label", { className: "flex items-center gap-2.5 rounded-md px-2 py-2 text-sm hover:bg-muted cursor-pointer transition-colors", children: [
|
|
270
|
-
/* @__PURE__ */ r(P, { checked: N, onCheckedChange: g }),
|
|
271
|
-
"Tout sélectionner"
|
|
272
|
-
] }),
|
|
273
|
-
b.length === 0 && /* @__PURE__ */ r("p", { className: "px-2 py-3 text-center text-xs text-muted-foreground", children: "Aucun résultat" }),
|
|
274
|
-
b.map((t) => /* @__PURE__ */ m("label", { className: "flex items-center gap-2.5 rounded-md px-2 py-2 text-sm hover:bg-muted cursor-pointer transition-colors", children: [
|
|
275
|
-
/* @__PURE__ */ r(
|
|
276
|
-
P,
|
|
277
|
-
{
|
|
278
|
-
checked: a.includes(t.value),
|
|
279
|
-
onCheckedChange: () => {
|
|
280
|
-
o(t.value);
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
),
|
|
284
|
-
t.label
|
|
285
|
-
] }, t.value))
|
|
286
|
-
] }),
|
|
287
|
-
a.length > 0 && /* @__PURE__ */ r("div", { className: "border-t border-border p-1.5", children: /* @__PURE__ */ r(
|
|
288
|
-
"button",
|
|
289
|
-
{
|
|
290
|
-
onClick: () => {
|
|
291
|
-
i !== void 0 ? i() : a.forEach((t) => {
|
|
292
|
-
o(t);
|
|
293
|
-
});
|
|
294
|
-
},
|
|
295
|
-
className: "w-full rounded-md px-2 py-1.5 text-xs text-muted-foreground hover:text-foreground hover:bg-muted transition-colors text-center",
|
|
296
|
-
children: "Tout désélectionner"
|
|
297
|
-
}
|
|
298
|
-
) })
|
|
299
|
-
] })
|
|
300
|
-
]
|
|
301
|
-
}
|
|
302
|
-
);
|
|
303
|
-
}
|
|
304
|
-
function Ae({
|
|
305
|
-
searchQuery: s,
|
|
306
|
-
onSearchChange: l,
|
|
307
|
-
searchPlaceholder: a = "Rechercher...",
|
|
308
|
-
filters: o,
|
|
309
|
-
onFiltersChange: i,
|
|
310
|
-
filterLabels: d = {},
|
|
311
|
-
sections: n,
|
|
312
|
-
advancedButtonText: p = "Filtres",
|
|
313
|
-
sheetTitle: f = "Filtres avancés"
|
|
314
|
-
}) {
|
|
315
|
-
const x = (e, u) => {
|
|
316
|
-
const c = o[e], y = Array.isArray(c) ? c : [], S = y.includes(u) ? y.filter((D) => D !== u) : [...y, u], F = { ...o };
|
|
317
|
-
S.length === 0 ? delete F[e] : F[e] = S, i(F);
|
|
318
|
-
}, v = (e) => {
|
|
319
|
-
const u = { ...o };
|
|
320
|
-
delete u[e], i(u);
|
|
321
|
-
}, b = () => {
|
|
322
|
-
i({});
|
|
323
|
-
}, N = (e, u) => {
|
|
324
|
-
const c = { ...o }, y = c[e];
|
|
325
|
-
Array.isArray(y) && u !== void 0 ? (c[e] = y.filter((S) => S !== u), Array.isArray(c[e]) && c[e].length === 0 && delete c[e]) : delete c[e], i(c);
|
|
326
|
-
}, g = A(() => {
|
|
327
|
-
const e = [];
|
|
328
|
-
return n.forEach((u) => {
|
|
329
|
-
u.filters.forEach((c) => {
|
|
330
|
-
c.isQuickFilter === !0 && e.push({
|
|
331
|
-
key: c.key,
|
|
332
|
-
label: c.label,
|
|
333
|
-
options: c.options ?? [],
|
|
334
|
-
searchable: c.searchable,
|
|
335
|
-
searchPlaceholder: c.searchPlaceholder
|
|
336
|
-
});
|
|
337
|
-
});
|
|
338
|
-
}), e;
|
|
339
|
-
}, [n]), t = A(() => {
|
|
340
|
-
const e = { ...d };
|
|
341
|
-
return n.forEach((u) => {
|
|
342
|
-
u.filters.forEach((c) => {
|
|
343
|
-
e[c.key] = c.label;
|
|
344
|
-
});
|
|
345
|
-
}), e;
|
|
346
|
-
}, [n, d]), h = A(() => {
|
|
347
|
-
const e = {};
|
|
348
|
-
return n.forEach((u) => {
|
|
349
|
-
u.filters.forEach((c) => {
|
|
350
|
-
c.options !== void 0 && c.options.forEach((y) => {
|
|
351
|
-
e[`${c.key}_${y.value}`] = y.label;
|
|
352
|
-
});
|
|
353
|
-
});
|
|
354
|
-
}), e;
|
|
355
|
-
}, [n]);
|
|
356
|
-
return /* @__PURE__ */ m("div", { className: "space-y-4 w-full", children: [
|
|
357
|
-
/* @__PURE__ */ r("div", { className: "flex flex-wrap items-center gap-3 justify-between", children: /* @__PURE__ */ m("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
358
|
-
l !== void 0 ? /* @__PURE__ */ r(
|
|
359
|
-
I,
|
|
360
|
-
{
|
|
361
|
-
searchQuery: s,
|
|
362
|
-
onSearch: l,
|
|
363
|
-
onClear: () => {
|
|
364
|
-
l("");
|
|
365
|
-
},
|
|
366
|
-
placeholder: a
|
|
367
|
-
}
|
|
368
|
-
) : null,
|
|
369
|
-
g.map((e) => /* @__PURE__ */ r(
|
|
370
|
-
ie,
|
|
371
|
-
{
|
|
372
|
-
label: e.label,
|
|
373
|
-
options: e.options,
|
|
374
|
-
selected: Array.isArray(o[e.key]) ? o[e.key] : [],
|
|
375
|
-
onToggle: (u) => {
|
|
376
|
-
x(e.key, u);
|
|
377
|
-
},
|
|
378
|
-
onClear: () => {
|
|
379
|
-
v(e.key);
|
|
380
|
-
},
|
|
381
|
-
onSelectAll: (u) => {
|
|
382
|
-
i({ ...o, [e.key]: u });
|
|
383
|
-
},
|
|
384
|
-
searchable: e.searchable,
|
|
385
|
-
searchPlaceholder: e.searchPlaceholder
|
|
386
|
-
},
|
|
387
|
-
e.key
|
|
388
|
-
)),
|
|
389
|
-
n.length > 0 && /* @__PURE__ */ r(oe, { sections: n, filters: o, onFiltersChange: i, buttonText: p, sheetTitle: f })
|
|
390
|
-
] }) }),
|
|
391
|
-
/* @__PURE__ */ r(
|
|
392
|
-
ce,
|
|
393
|
-
{
|
|
394
|
-
filters: o,
|
|
395
|
-
onRemoveFilter: N,
|
|
396
|
-
onClearAll: b,
|
|
397
|
-
filterLabels: t,
|
|
398
|
-
optionLabels: h
|
|
399
|
-
}
|
|
400
|
-
)
|
|
401
|
-
] });
|
|
402
|
-
}
|
|
403
|
-
export {
|
|
404
|
-
ce as A,
|
|
405
|
-
ne as F,
|
|
406
|
-
ie as S,
|
|
407
|
-
Ae as T,
|
|
408
|
-
oe as a
|
|
409
|
-
};
|