@krosoft/react 0.0.292 → 0.0.294
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/{GenericForm-BdKwapAz.js → GenericForm-D7ni-5-4.js} +1 -1
- package/dist/MultiSelect-CZ4hye2w.js +147 -0
- package/dist/SearchInput-nr0CrMLK.js +316 -0
- package/dist/components/core/dialogs/index.js +1 -1
- package/dist/components/core/filters/FilterField.d.ts.map +1 -1
- package/dist/components/core/filters/FilterPills.d.ts +1 -1
- package/dist/components/core/filters/TableFilter.d.ts.map +1 -1
- package/dist/components/core/filters/index.d.ts +0 -1
- package/dist/components/core/filters/index.d.ts.map +1 -1
- package/dist/components/core/filters/index.js +138 -253
- package/dist/components/core/forms/index.js +1 -1
- package/dist/components/core/index.js +15 -15
- package/dist/components/core/inputs/MultiSelect.d.ts +15 -7
- package/dist/components/core/inputs/MultiSelect.d.ts.map +1 -1
- package/dist/components/core/inputs/SingleSelect.d.ts +30 -0
- package/dist/components/core/inputs/SingleSelect.d.ts.map +1 -0
- package/dist/components/core/inputs/index.d.ts +2 -2
- package/dist/components/core/inputs/index.d.ts.map +1 -1
- package/dist/components/core/inputs/index.js +4 -4
- package/dist/components/index.js +15 -15
- package/dist/{dialogs-BxyPBIc6.js → dialogs-BjqvZvax.js} +1 -1
- package/dist/{inputs-CUNf48Vk.js → inputs-BMCt-VqZ.js} +2 -2
- package/package.json +1 -1
- package/dist/MultiSelect-O4JP5fRO.js +0 -129
- package/dist/SearchInput-BSIjKB_9.js +0 -259
- package/dist/components/core/filters/SearchableFilterPill.d.ts +0 -16
- package/dist/components/core/filters/SearchableFilterPill.d.ts.map +0 -1
- package/dist/components/core/inputs/SearchableSelect.d.ts +0 -28
- package/dist/components/core/inputs/SearchableSelect.d.ts.map +0 -1
|
@@ -1,70 +1,69 @@
|
|
|
1
1
|
import { t as e } from "../../../tailwind.helper-CJaRYBmL.js";
|
|
2
2
|
import { t } from "../../../i18n-d2p0RJo9.js";
|
|
3
|
-
import { At as n, Pn as r
|
|
4
|
-
import {
|
|
5
|
-
import { a
|
|
6
|
-
import {
|
|
7
|
-
import { t as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { ChevronDown as N, Filter as P, Search as F, XIcon as I } from "lucide-react";
|
|
3
|
+
import { At as n, Pn as r } from "../../../ui-D8Pg34YW.js";
|
|
4
|
+
import { s as i } from "../../../tooltip-BmZ9Bfou.js";
|
|
5
|
+
import { a, g as o, l as s, o as c, r as l, t as u, u as d } from "../../../sheet-DQTOen4V.js";
|
|
6
|
+
import { t as f } from "../../../MultiSelect-CZ4hye2w.js";
|
|
7
|
+
import { i as p, n as m, r as h, t as g } from "../../../SearchInput-nr0CrMLK.js";
|
|
8
|
+
import { useEffect as _, useMemo as v, useState as y } from "react";
|
|
9
|
+
import { jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
10
|
+
import { getLocale as S } from "@krosoft/core/helpers";
|
|
11
|
+
import { Filter as C, XIcon as w } from "lucide-react";
|
|
13
12
|
//#region src/components/core/filters/ActiveFilters.tsx
|
|
14
|
-
var
|
|
15
|
-
if (t instanceof Date) return t.toLocaleDateString(
|
|
13
|
+
var T = (e, t, n, r = {}) => {
|
|
14
|
+
if (t instanceof Date) return t.toLocaleDateString(S());
|
|
16
15
|
let i = String(t), a = r[`${e}_${i}`];
|
|
17
16
|
return a === void 0 ? e.includes("ok") || t === "true" || t === "false" ? n(t === "true" ? "filters.yes" : "filters.no") : i : a;
|
|
18
17
|
};
|
|
19
|
-
function
|
|
18
|
+
function E({ filters: e, onRemoveFilter: n, onClearAll: i, filterLabelKeys: a = {}, optionLabels: o = {} }) {
|
|
20
19
|
let { t: s } = t(), c = Object.entries(e).filter(([e, t]) => !(t == null || t === "" || Array.isArray(t) && t.length === 0));
|
|
21
|
-
return c.length === 0 ? null : /* @__PURE__ */
|
|
20
|
+
return c.length === 0 ? null : /* @__PURE__ */ x("div", {
|
|
22
21
|
className: "flex flex-wrap items-center gap-2 mb-4",
|
|
23
22
|
children: [
|
|
24
|
-
/* @__PURE__ */
|
|
23
|
+
/* @__PURE__ */ b("span", {
|
|
25
24
|
className: "text-sm text-muted-foreground font-medium",
|
|
26
25
|
children: s("filters.active")
|
|
27
26
|
}),
|
|
28
27
|
c.flatMap(([e, t]) => {
|
|
29
28
|
let i = a[e], c = i === void 0 ? e : s(i);
|
|
30
29
|
if (Array.isArray(t)) return t.map((t) => {
|
|
31
|
-
let i =
|
|
32
|
-
return /* @__PURE__ */
|
|
30
|
+
let i = T(e, t, s, o);
|
|
31
|
+
return /* @__PURE__ */ x(r, {
|
|
33
32
|
variant: "secondary",
|
|
34
33
|
className: "flex items-center gap-1 px-3 py-1 bg-primary/10 text-primary border border-primary/20 hover:bg-primary/20",
|
|
35
34
|
children: [
|
|
36
35
|
c,
|
|
37
36
|
": ",
|
|
38
37
|
i,
|
|
39
|
-
/* @__PURE__ */
|
|
38
|
+
/* @__PURE__ */ b("button", {
|
|
40
39
|
onClick: () => {
|
|
41
40
|
n(e, t);
|
|
42
41
|
},
|
|
43
42
|
className: "ml-1 hover:bg-primary/20 rounded-full p-0.5",
|
|
44
|
-
children: /* @__PURE__ */
|
|
43
|
+
children: /* @__PURE__ */ b(w, { className: "size-4" })
|
|
45
44
|
})
|
|
46
45
|
]
|
|
47
46
|
}, `${e}_${String(t)}`);
|
|
48
47
|
});
|
|
49
|
-
let l =
|
|
50
|
-
return /* @__PURE__ */
|
|
48
|
+
let l = T(e, t, s, o);
|
|
49
|
+
return /* @__PURE__ */ x(r, {
|
|
51
50
|
variant: "secondary",
|
|
52
51
|
className: "flex items-center gap-1 px-3 py-1 bg-primary/10 text-primary border border-primary/20 hover:bg-primary/20",
|
|
53
52
|
children: [
|
|
54
53
|
c,
|
|
55
54
|
": ",
|
|
56
55
|
l,
|
|
57
|
-
/* @__PURE__ */
|
|
56
|
+
/* @__PURE__ */ b("button", {
|
|
58
57
|
onClick: () => {
|
|
59
58
|
n(e);
|
|
60
59
|
},
|
|
61
60
|
className: "ml-1 hover:bg-primary/20 rounded-full p-0.5",
|
|
62
|
-
children: /* @__PURE__ */
|
|
61
|
+
children: /* @__PURE__ */ b(w, { className: "size-4" })
|
|
63
62
|
})
|
|
64
63
|
]
|
|
65
64
|
}, e);
|
|
66
65
|
}),
|
|
67
|
-
c.length > 0 && /* @__PURE__ */
|
|
66
|
+
c.length > 0 && /* @__PURE__ */ b("button", {
|
|
68
67
|
onClick: i,
|
|
69
68
|
className: "text-xs text-destructive hover:text-destructive/80 transition-colors font-medium ml-auto",
|
|
70
69
|
children: s("filters.clearAll")
|
|
@@ -74,153 +73,144 @@ function R({ filters: e, onRemoveFilter: n, onClearAll: i, filterLabelKeys: a =
|
|
|
74
73
|
}
|
|
75
74
|
//#endregion
|
|
76
75
|
//#region src/components/core/filters/FilterField.tsx
|
|
77
|
-
var
|
|
78
|
-
let { t:
|
|
79
|
-
switch (
|
|
80
|
-
case "text": return /* @__PURE__ */
|
|
81
|
-
placeholder:
|
|
82
|
-
value:
|
|
76
|
+
var D = ({ field: e, value: n, onChange: r, onToggleMultiSelect: i }) => {
|
|
77
|
+
let { t: a } = t();
|
|
78
|
+
switch (e.type) {
|
|
79
|
+
case "text": return /* @__PURE__ */ b(o, {
|
|
80
|
+
placeholder: e.placeholder,
|
|
81
|
+
value: n ?? "",
|
|
83
82
|
onChange: (e) => {
|
|
84
|
-
|
|
83
|
+
r(e.target.value);
|
|
85
84
|
}
|
|
86
85
|
});
|
|
87
|
-
case "number": return /* @__PURE__ */
|
|
86
|
+
case "number": return /* @__PURE__ */ b(o, {
|
|
88
87
|
type: "number",
|
|
89
|
-
placeholder:
|
|
90
|
-
value:
|
|
88
|
+
placeholder: e.placeholder,
|
|
89
|
+
value: n ?? "",
|
|
91
90
|
onChange: (e) => {
|
|
92
|
-
|
|
91
|
+
r(e.target.value);
|
|
93
92
|
},
|
|
94
|
-
min:
|
|
95
|
-
max:
|
|
93
|
+
min: e.min,
|
|
94
|
+
max: e.max
|
|
96
95
|
});
|
|
97
|
-
case "select": return
|
|
98
|
-
options:
|
|
99
|
-
value:
|
|
100
|
-
onChange:
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
value: r ?? "",
|
|
105
|
-
onValueChange: i,
|
|
106
|
-
children: [/* @__PURE__ */ A(v, {
|
|
107
|
-
className: e((r === void 0 || r === "") && "text-muted-foreground"),
|
|
108
|
-
children: /* @__PURE__ */ A(x, { placeholder: n.placeholder })
|
|
109
|
-
}), /* @__PURE__ */ A(y, { children: n.options?.map((e) => /* @__PURE__ */ A(_, {
|
|
110
|
-
value: e.value,
|
|
111
|
-
children: e.label
|
|
112
|
-
}, e.value)) })]
|
|
96
|
+
case "select": return /* @__PURE__ */ b(m, {
|
|
97
|
+
options: e.options ?? [],
|
|
98
|
+
value: n,
|
|
99
|
+
onChange: r,
|
|
100
|
+
searchable: e.searchable === !0,
|
|
101
|
+
placeholder: e.placeholder,
|
|
102
|
+
searchPlaceholder: e.searchPlaceholder
|
|
113
103
|
});
|
|
114
|
-
case "date": return /* @__PURE__ */
|
|
115
|
-
date:
|
|
116
|
-
onDateChange:
|
|
117
|
-
placeholder:
|
|
104
|
+
case "date": return /* @__PURE__ */ b(p, {
|
|
105
|
+
date: n,
|
|
106
|
+
onDateChange: r,
|
|
107
|
+
placeholder: e.placeholder ?? a("date.pickDate")
|
|
118
108
|
});
|
|
119
|
-
case "date-range": return /* @__PURE__ */
|
|
120
|
-
value:
|
|
121
|
-
onChange:
|
|
122
|
-
placeholder:
|
|
109
|
+
case "date-range": return /* @__PURE__ */ b(h, {
|
|
110
|
+
value: n,
|
|
111
|
+
onChange: r,
|
|
112
|
+
placeholder: e.placeholder
|
|
123
113
|
});
|
|
124
|
-
case "multi-select": return /* @__PURE__ */
|
|
125
|
-
options:
|
|
126
|
-
selected:
|
|
127
|
-
onToggle:
|
|
114
|
+
case "multi-select": return /* @__PURE__ */ b(f, {
|
|
115
|
+
options: e.options ?? [],
|
|
116
|
+
selected: n ?? [],
|
|
117
|
+
onToggle: i,
|
|
128
118
|
onClear: () => {
|
|
129
|
-
|
|
119
|
+
r([]);
|
|
130
120
|
},
|
|
131
|
-
onSelectAll:
|
|
132
|
-
placeholder:
|
|
133
|
-
searchable:
|
|
134
|
-
searchPlaceholder:
|
|
121
|
+
onSelectAll: r,
|
|
122
|
+
placeholder: e.placeholder,
|
|
123
|
+
searchable: e.searchable,
|
|
124
|
+
searchPlaceholder: e.searchPlaceholder
|
|
135
125
|
});
|
|
136
126
|
default: return null;
|
|
137
127
|
}
|
|
138
|
-
},
|
|
139
|
-
function
|
|
140
|
-
let { t:
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}, [r,
|
|
144
|
-
let
|
|
145
|
-
|
|
128
|
+
}, O = (e) => !(e == null || e === "" || Array.isArray(e) && e.length === 0);
|
|
129
|
+
function k({ sections: e, filters: r, onFiltersChange: o, buttonText: f, sheetTitle: p }) {
|
|
130
|
+
let { t: m } = t(), [h, g] = y(!1), [S, w] = y(r);
|
|
131
|
+
_(() => {
|
|
132
|
+
w(r);
|
|
133
|
+
}, [r, h]);
|
|
134
|
+
let T = (e, t) => {
|
|
135
|
+
w((n) => ({
|
|
146
136
|
...n,
|
|
147
137
|
[e]: t
|
|
148
138
|
}));
|
|
149
|
-
},
|
|
150
|
-
let n =
|
|
151
|
-
|
|
152
|
-
},
|
|
153
|
-
|
|
154
|
-
},
|
|
155
|
-
|
|
156
|
-
},
|
|
139
|
+
}, E = (e, t) => {
|
|
140
|
+
let n = S[e], r = Array.isArray(n) ? n : [], i = r.includes(t) ? r.filter((e) => e !== t) : [...r, t];
|
|
141
|
+
T(e, i);
|
|
142
|
+
}, k = () => {
|
|
143
|
+
o(S), g(!1);
|
|
144
|
+
}, A = () => {
|
|
145
|
+
w({}), o({}), g(!1);
|
|
146
|
+
}, j = v(() => {
|
|
157
147
|
let t = new Set(e.flatMap((e) => e.filters.map((e) => e.key)));
|
|
158
|
-
return Object.entries(r).filter(([e, n]) => t.has(e) &&
|
|
148
|
+
return Object.entries(r).filter(([e, n]) => t.has(e) && O(n)).length;
|
|
159
149
|
}, [e, r]);
|
|
160
|
-
return /* @__PURE__ */
|
|
161
|
-
open:
|
|
162
|
-
onOpenChange:
|
|
163
|
-
children: [/* @__PURE__ */
|
|
150
|
+
return /* @__PURE__ */ x(u, {
|
|
151
|
+
open: h,
|
|
152
|
+
onOpenChange: g,
|
|
153
|
+
children: [/* @__PURE__ */ b(d, {
|
|
164
154
|
asChild: !0,
|
|
165
|
-
children: /* @__PURE__ */
|
|
155
|
+
children: /* @__PURE__ */ x(i, {
|
|
166
156
|
variant: "outline",
|
|
167
157
|
className: "gap-2",
|
|
168
158
|
children: [
|
|
169
|
-
/* @__PURE__ */
|
|
170
|
-
|
|
171
|
-
|
|
159
|
+
/* @__PURE__ */ b(C, { className: "size-4 shrink-0" }),
|
|
160
|
+
f ?? m("filters.more"),
|
|
161
|
+
j > 0 && /* @__PURE__ */ b("span", {
|
|
172
162
|
className: "ml-1 flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1.5 text-xs font-semibold text-primary-foreground",
|
|
173
|
-
children:
|
|
163
|
+
children: j
|
|
174
164
|
})
|
|
175
165
|
]
|
|
176
166
|
})
|
|
177
|
-
}), /* @__PURE__ */
|
|
167
|
+
}), /* @__PURE__ */ x(l, {
|
|
178
168
|
side: "right",
|
|
179
169
|
className: "w-[400px] sm:w-[500px] flex flex-col p-0",
|
|
180
170
|
children: [
|
|
181
|
-
/* @__PURE__ */
|
|
171
|
+
/* @__PURE__ */ b(c, {
|
|
182
172
|
className: "p-6 pb-0",
|
|
183
|
-
children: /* @__PURE__ */
|
|
173
|
+
children: /* @__PURE__ */ b(s, { children: p ?? m("filters.advanced") })
|
|
184
174
|
}),
|
|
185
|
-
/* @__PURE__ */
|
|
175
|
+
/* @__PURE__ */ b("div", {
|
|
186
176
|
className: "flex-1 overflow-y-auto p-6 pt-6",
|
|
187
|
-
children: /* @__PURE__ */
|
|
177
|
+
children: /* @__PURE__ */ b("div", {
|
|
188
178
|
className: "space-y-6",
|
|
189
|
-
children: e.map((e, t) => /* @__PURE__ */
|
|
179
|
+
children: e.map((e, t) => /* @__PURE__ */ x("div", {
|
|
190
180
|
className: "space-y-4",
|
|
191
|
-
children: [/* @__PURE__ */
|
|
181
|
+
children: [/* @__PURE__ */ b("h3", {
|
|
192
182
|
className: "font-semibold text-sm text-foreground border-b pb-2",
|
|
193
|
-
children:
|
|
194
|
-
}), e.filters.map((e) => /* @__PURE__ */
|
|
183
|
+
children: m(e.titleKey)
|
|
184
|
+
}), e.filters.map((e) => /* @__PURE__ */ x("div", {
|
|
195
185
|
className: "space-y-2",
|
|
196
|
-
children: [/* @__PURE__ */
|
|
186
|
+
children: [/* @__PURE__ */ b(n, {
|
|
197
187
|
htmlFor: e.key,
|
|
198
|
-
children:
|
|
199
|
-
}), /* @__PURE__ */
|
|
188
|
+
children: m(e.labelKey)
|
|
189
|
+
}), /* @__PURE__ */ b(D, {
|
|
200
190
|
field: e,
|
|
201
|
-
value:
|
|
191
|
+
value: S[e.key],
|
|
202
192
|
onChange: (t) => {
|
|
203
|
-
|
|
193
|
+
T(e.key, t);
|
|
204
194
|
},
|
|
205
195
|
onToggleMultiSelect: (t) => {
|
|
206
|
-
|
|
196
|
+
E(e.key, t);
|
|
207
197
|
}
|
|
208
198
|
})]
|
|
209
199
|
}, e.key))]
|
|
210
200
|
}, t))
|
|
211
201
|
})
|
|
212
202
|
}),
|
|
213
|
-
/* @__PURE__ */
|
|
203
|
+
/* @__PURE__ */ x(a, {
|
|
214
204
|
className: "gap-2 p-6 border-t bg-background",
|
|
215
|
-
children: [/* @__PURE__ */
|
|
205
|
+
children: [/* @__PURE__ */ b(i, {
|
|
216
206
|
variant: "outline",
|
|
217
207
|
className: "flex-1",
|
|
218
|
-
onClick:
|
|
219
|
-
children:
|
|
220
|
-
}), /* @__PURE__ */
|
|
208
|
+
onClick: A,
|
|
209
|
+
children: m("filters.clear")
|
|
210
|
+
}), /* @__PURE__ */ b(i, {
|
|
221
211
|
className: "flex-1",
|
|
222
|
-
onClick:
|
|
223
|
-
children:
|
|
212
|
+
onClick: k,
|
|
213
|
+
children: m("filters.apply")
|
|
224
214
|
})]
|
|
225
215
|
})
|
|
226
216
|
]
|
|
@@ -229,28 +219,28 @@ function V({ sections: e, filters: r, onFiltersChange: i, buttonText: a, sheetTi
|
|
|
229
219
|
}
|
|
230
220
|
//#endregion
|
|
231
221
|
//#region src/components/core/filters/FilterPillsGroup.tsx
|
|
232
|
-
var
|
|
222
|
+
var A = {
|
|
233
223
|
solid: "border-foreground bg-foreground text-background",
|
|
234
224
|
outline: "border-primary bg-primary/10 text-primary font-medium"
|
|
235
225
|
};
|
|
236
|
-
function
|
|
237
|
-
return r === void 0 ? t ?
|
|
226
|
+
function j(t, n, r) {
|
|
227
|
+
return r === void 0 ? t ? A[n] : "border-border bg-background text-muted-foreground hover:text-foreground hover:border-foreground/40" : e(r, t ? "font-semibold" : "opacity-60 hover:opacity-100");
|
|
238
228
|
}
|
|
239
|
-
function
|
|
240
|
-
return /* @__PURE__ */
|
|
229
|
+
function M({ options: t, values: n, onToggle: r, variant: i = "solid" }) {
|
|
230
|
+
return /* @__PURE__ */ b("div", {
|
|
241
231
|
className: "flex flex-wrap gap-1.5",
|
|
242
232
|
children: t.map(({ value: t, label: a, count: o, icon: s, className: c }) => {
|
|
243
|
-
let l =
|
|
244
|
-
return /* @__PURE__ */
|
|
233
|
+
let l = j(n.includes(t), i, c);
|
|
234
|
+
return /* @__PURE__ */ x("button", {
|
|
245
235
|
onClick: () => {
|
|
246
236
|
r(t);
|
|
247
237
|
},
|
|
248
238
|
className: e("inline-flex items-center gap-1 text-xs px-2.5 py-1 rounded-control border transition-colors", l),
|
|
249
239
|
children: [
|
|
250
|
-
s && /* @__PURE__ */
|
|
240
|
+
s && /* @__PURE__ */ b(s, { className: "size-3 shrink-0" }),
|
|
251
241
|
a,
|
|
252
242
|
" ",
|
|
253
|
-
o !== void 0 && /* @__PURE__ */
|
|
243
|
+
o !== void 0 && /* @__PURE__ */ x("span", {
|
|
254
244
|
className: "opacity-60",
|
|
255
245
|
children: [
|
|
256
246
|
"(",
|
|
@@ -265,8 +255,8 @@ function W({ options: t, values: n, onToggle: r, variant: i = "solid" }) {
|
|
|
265
255
|
}
|
|
266
256
|
//#endregion
|
|
267
257
|
//#region src/components/core/filters/FilterPills.tsx
|
|
268
|
-
function
|
|
269
|
-
return /* @__PURE__ */
|
|
258
|
+
function N({ options: e, value: t, onChange: n, variant: r = "solid" }) {
|
|
259
|
+
return /* @__PURE__ */ b(M, {
|
|
270
260
|
options: e,
|
|
271
261
|
values: [t],
|
|
272
262
|
onToggle: n,
|
|
@@ -274,126 +264,20 @@ function G({ options: e, value: t, onChange: n, variant: r = "solid" }) {
|
|
|
274
264
|
});
|
|
275
265
|
}
|
|
276
266
|
//#endregion
|
|
277
|
-
//#region src/components/core/filters/SearchableFilterPill.tsx
|
|
278
|
-
function K({ labelKey: n, options: r, selected: o, onToggle: s, onClear: c, onSelectAll: u, searchable: f = !1, searchPlaceholder: m }) {
|
|
279
|
-
let { t: h } = t(), [g, _] = k(""), v = o.length > 0, y = O(() => g === "" ? r : r.filter((e) => e.label.toLowerCase().includes(g.toLowerCase())), [r, g]), b = O(() => y.length !== 0 && y.every((e) => o.includes(e.value)), [y, o]);
|
|
280
|
-
return /* @__PURE__ */ j(p, {
|
|
281
|
-
onOpenChange: () => {
|
|
282
|
-
_("");
|
|
283
|
-
},
|
|
284
|
-
children: [/* @__PURE__ */ A(l, {
|
|
285
|
-
asChild: !0,
|
|
286
|
-
children: /* @__PURE__ */ j("button", {
|
|
287
|
-
className: e(a, "inline-flex items-center gap-1.5 whitespace-nowrap transition-colors", v ? "border-primary bg-primary/10 text-primary font-medium" : "hover:bg-muted"),
|
|
288
|
-
children: [
|
|
289
|
-
h(n),
|
|
290
|
-
o.length > 0 && /* @__PURE__ */ A("span", {
|
|
291
|
-
className: "flex h-4 min-w-[16px] items-center justify-center rounded-full bg-primary px-1 text-[10px] font-bold text-primary-foreground",
|
|
292
|
-
children: o.length
|
|
293
|
-
}),
|
|
294
|
-
/* @__PURE__ */ A(N, { className: "size-3.5 opacity-60" })
|
|
295
|
-
]
|
|
296
|
-
})
|
|
297
|
-
}), /* @__PURE__ */ j(d, {
|
|
298
|
-
className: "w-72 max-w-[var(--radix-popover-content-available-width)] p-0",
|
|
299
|
-
align: "start",
|
|
300
|
-
children: [
|
|
301
|
-
f ? /* @__PURE__ */ A("div", {
|
|
302
|
-
className: "border-b border-border p-2",
|
|
303
|
-
children: /* @__PURE__ */ j("div", {
|
|
304
|
-
className: "relative",
|
|
305
|
-
children: [/* @__PURE__ */ A(F, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }), /* @__PURE__ */ A("input", {
|
|
306
|
-
className: "w-full rounded-control 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",
|
|
307
|
-
placeholder: m ?? h("search.placeholder"),
|
|
308
|
-
value: g,
|
|
309
|
-
onChange: (e) => {
|
|
310
|
-
_(e.target.value);
|
|
311
|
-
},
|
|
312
|
-
autoFocus: !0
|
|
313
|
-
})]
|
|
314
|
-
})
|
|
315
|
-
}) : null,
|
|
316
|
-
/* @__PURE__ */ j("div", {
|
|
317
|
-
className: "flex flex-col gap-0.5 max-h-56 overflow-y-auto overflow-x-hidden p-1.5",
|
|
318
|
-
children: [y.length === 0 && /* @__PURE__ */ A("p", {
|
|
319
|
-
className: "px-2 py-3 text-center text-xs text-muted-foreground",
|
|
320
|
-
children: h("states.noResult")
|
|
321
|
-
}), y.map((e) => /* @__PURE__ */ j("label", {
|
|
322
|
-
className: "flex min-w-0 items-center gap-2.5 rounded-md px-2 py-2 text-sm hover:bg-muted cursor-pointer transition-colors",
|
|
323
|
-
children: [
|
|
324
|
-
/* @__PURE__ */ A("span", {
|
|
325
|
-
className: "shrink-0",
|
|
326
|
-
children: /* @__PURE__ */ A(i, {
|
|
327
|
-
checked: o.includes(e.value),
|
|
328
|
-
onCheckedChange: () => {
|
|
329
|
-
s(e.value);
|
|
330
|
-
}
|
|
331
|
-
})
|
|
332
|
-
}),
|
|
333
|
-
e.color && /* @__PURE__ */ A("span", {
|
|
334
|
-
className: "size-2.5 shrink-0 rounded-full",
|
|
335
|
-
style: { backgroundColor: e.color }
|
|
336
|
-
}),
|
|
337
|
-
/* @__PURE__ */ A("span", {
|
|
338
|
-
className: "min-w-0 flex-1 truncate",
|
|
339
|
-
title: e.label,
|
|
340
|
-
children: e.label
|
|
341
|
-
})
|
|
342
|
-
]
|
|
343
|
-
}, e.value))]
|
|
344
|
-
}),
|
|
345
|
-
y.length > 0 && /* @__PURE__ */ A("div", {
|
|
346
|
-
className: "border-t border-border p-1.5",
|
|
347
|
-
children: b ? /* @__PURE__ */ A("button", {
|
|
348
|
-
onClick: () => {
|
|
349
|
-
c === void 0 ? o.forEach((e) => {
|
|
350
|
-
s(e);
|
|
351
|
-
}) : c();
|
|
352
|
-
},
|
|
353
|
-
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",
|
|
354
|
-
children: h("filters.deselectAll")
|
|
355
|
-
}) : /* @__PURE__ */ A("button", {
|
|
356
|
-
type: "button",
|
|
357
|
-
onClick: () => {
|
|
358
|
-
if (b) {
|
|
359
|
-
if (u !== void 0) {
|
|
360
|
-
let e = y.map((e) => e.value);
|
|
361
|
-
u(o.filter((t) => !e.includes(t)));
|
|
362
|
-
} else c === void 0 ? o.forEach((e) => {
|
|
363
|
-
s(e);
|
|
364
|
-
}) : c();
|
|
365
|
-
} else if (u !== void 0) {
|
|
366
|
-
let e = [...o];
|
|
367
|
-
y.forEach((t) => {
|
|
368
|
-
e.includes(t.value) || e.push(t.value);
|
|
369
|
-
}), u(e);
|
|
370
|
-
} else y.forEach((e) => {
|
|
371
|
-
o.includes(e.value) || s(e.value);
|
|
372
|
-
});
|
|
373
|
-
},
|
|
374
|
-
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",
|
|
375
|
-
children: h("filters.selectAll")
|
|
376
|
-
})
|
|
377
|
-
})
|
|
378
|
-
]
|
|
379
|
-
})]
|
|
380
|
-
});
|
|
381
|
-
}
|
|
382
|
-
//#endregion
|
|
383
267
|
//#region src/components/core/filters/TableFilter.tsx
|
|
384
|
-
function
|
|
268
|
+
function P({ searchQuery: e, onSearchChange: n, searchPlaceholder: r, filters: i, onFiltersChange: a, sections: o, advancedButtonText: s, sheetTitle: c }) {
|
|
385
269
|
let { t: l } = t(), u = (e, t) => {
|
|
386
270
|
let n = i[e], r = Array.isArray(n) ? n : [], o = r.includes(t) ? r.filter((e) => e !== t) : [...r, t], s = { ...i };
|
|
387
271
|
o.length === 0 ? delete s[e] : s[e] = o, a(s);
|
|
388
272
|
}, d = (e) => {
|
|
389
273
|
let t = { ...i };
|
|
390
274
|
delete t[e], a(t);
|
|
391
|
-
},
|
|
275
|
+
}, p = () => {
|
|
392
276
|
a({});
|
|
393
|
-
},
|
|
277
|
+
}, m = (e, t) => {
|
|
394
278
|
let n = { ...i }, r = n[e];
|
|
395
279
|
Array.isArray(r) ? t === void 0 ? delete n[e] : (n[e] = r.filter((e) => e !== t), Array.isArray(n[e]) && n[e].length === 0 && delete n[e]) : delete n[e], a(n);
|
|
396
|
-
},
|
|
280
|
+
}, h = v(() => {
|
|
397
281
|
let e = [];
|
|
398
282
|
return o.forEach((t) => {
|
|
399
283
|
t.filters.forEach((t) => {
|
|
@@ -406,14 +290,14 @@ function q({ searchQuery: e, onSearchChange: n, searchPlaceholder: r, filters: i
|
|
|
406
290
|
});
|
|
407
291
|
});
|
|
408
292
|
}), e;
|
|
409
|
-
}, [o]),
|
|
293
|
+
}, [o]), _ = v(() => {
|
|
410
294
|
let e = {};
|
|
411
295
|
return o.forEach((t) => {
|
|
412
296
|
t.filters.forEach((t) => {
|
|
413
297
|
e[t.key] = t.badgeLabelKey ?? t.labelKey;
|
|
414
298
|
});
|
|
415
299
|
}), e;
|
|
416
|
-
}, [o]),
|
|
300
|
+
}, [o]), y = v(() => {
|
|
417
301
|
let e = {};
|
|
418
302
|
return o.forEach((t) => {
|
|
419
303
|
t.filters.forEach((t) => {
|
|
@@ -423,20 +307,21 @@ function q({ searchQuery: e, onSearchChange: n, searchPlaceholder: r, filters: i
|
|
|
423
307
|
});
|
|
424
308
|
}), e;
|
|
425
309
|
}, [o]);
|
|
426
|
-
return /* @__PURE__ */
|
|
310
|
+
return /* @__PURE__ */ x("div", {
|
|
427
311
|
className: "space-y-4 w-full",
|
|
428
|
-
children: [/* @__PURE__ */
|
|
312
|
+
children: [/* @__PURE__ */ x("div", {
|
|
429
313
|
className: "flex flex-wrap items-center gap-2 justify-between",
|
|
430
|
-
children: [/* @__PURE__ */
|
|
314
|
+
children: [/* @__PURE__ */ x("div", {
|
|
431
315
|
className: "flex flex-wrap items-center gap-2",
|
|
432
|
-
children: [n === void 0 ? null : /* @__PURE__ */
|
|
316
|
+
children: [n === void 0 ? null : /* @__PURE__ */ b(g, {
|
|
433
317
|
searchQuery: e,
|
|
434
318
|
onSearch: n,
|
|
435
319
|
onClear: () => {
|
|
436
320
|
n("");
|
|
437
321
|
},
|
|
438
322
|
placeholder: r ?? l("search.placeholder")
|
|
439
|
-
}),
|
|
323
|
+
}), h.map((e) => /* @__PURE__ */ b(f, {
|
|
324
|
+
variant: "pill",
|
|
440
325
|
labelKey: e.labelKey,
|
|
441
326
|
options: e.options,
|
|
442
327
|
selected: Array.isArray(i[e.key]) ? i[e.key] : [],
|
|
@@ -455,21 +340,21 @@ function q({ searchQuery: e, onSearchChange: n, searchPlaceholder: r, filters: i
|
|
|
455
340
|
searchable: e.searchable,
|
|
456
341
|
searchPlaceholder: e.searchPlaceholder
|
|
457
342
|
}, e.key))]
|
|
458
|
-
}), o.length > 0 && /* @__PURE__ */
|
|
343
|
+
}), o.length > 0 && /* @__PURE__ */ b(k, {
|
|
459
344
|
sections: o,
|
|
460
345
|
filters: i,
|
|
461
346
|
onFiltersChange: a,
|
|
462
347
|
buttonText: s,
|
|
463
348
|
sheetTitle: c
|
|
464
349
|
})]
|
|
465
|
-
}), /* @__PURE__ */
|
|
350
|
+
}), /* @__PURE__ */ b(E, {
|
|
466
351
|
filters: i,
|
|
467
|
-
onRemoveFilter:
|
|
468
|
-
onClearAll:
|
|
469
|
-
filterLabelKeys:
|
|
470
|
-
optionLabels:
|
|
352
|
+
onRemoveFilter: m,
|
|
353
|
+
onClearAll: p,
|
|
354
|
+
filterLabelKeys: _,
|
|
355
|
+
optionLabels: y
|
|
471
356
|
})]
|
|
472
357
|
});
|
|
473
358
|
}
|
|
474
359
|
//#endregion
|
|
475
|
-
export {
|
|
360
|
+
export { E as ActiveFilters, k as AdvancedFilters, D as FilterField, N as FilterPills, M as FilterPillsGroup, P as TableFilter };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../../GenericForm-
|
|
1
|
+
import { t as e } from "../../../GenericForm-D7ni-5-4.js";
|
|
2
2
|
export { e as GenericForm };
|
|
@@ -2,23 +2,23 @@ import { a as e, i as t, n, o as r, r as i, t as a } from "../../cards-BBgGXmYa.
|
|
|
2
2
|
import { I as o } from "../../ui-D8Pg34YW.js";
|
|
3
3
|
import { A as s, D as c, E as l, F as u, M as d, N as f, O as p, P as m, j as h, k as g } from "../../sheet-DQTOen4V.js";
|
|
4
4
|
import { a as _, c as v, i as y, n as b, o as x, r as S, s as C, t as w } from "../../charts-C7MWuqi9.js";
|
|
5
|
-
import { n as T, r as E, t as D } from "../../dialogs-
|
|
5
|
+
import { n as T, r as E, t as D } from "../../dialogs-BjqvZvax.js";
|
|
6
6
|
import { t as O } from "../../ImageInput-BPNEywyf.js";
|
|
7
7
|
import { t as k } from "../../AppActions-CpbkO_3O.js";
|
|
8
8
|
import { t as A } from "../../AppSubTitle-BOVTZlUB.js";
|
|
9
|
-
import { t as j } from "../../MultiSelect-
|
|
10
|
-
import { t as M } from "../../GenericForm-
|
|
9
|
+
import { t as j } from "../../MultiSelect-CZ4hye2w.js";
|
|
10
|
+
import { t as M } from "../../GenericForm-D7ni-5-4.js";
|
|
11
11
|
import { t as N } from "../../ErrorAlert-L2s8Dd1_.js";
|
|
12
|
-
import { i as P, n as F, r as I, t as L } from "../../SearchInput-
|
|
13
|
-
import { ActiveFilters as R, AdvancedFilters as z, FilterField as B, FilterPills as V, FilterPillsGroup as H,
|
|
12
|
+
import { i as P, n as F, r as I, t as L } from "../../SearchInput-nr0CrMLK.js";
|
|
13
|
+
import { ActiveFilters as R, AdvancedFilters as z, FilterField as B, FilterPills as V, FilterPillsGroup as H, TableFilter as U } from "./filters/index.js";
|
|
14
14
|
import "./forms/index.js";
|
|
15
|
-
import { t as
|
|
16
|
-
import { t as
|
|
17
|
-
import { t as
|
|
18
|
-
import { n as
|
|
19
|
-
import { AppPageHeader as
|
|
20
|
-
import { a as
|
|
21
|
-
import { DataTable as
|
|
22
|
-
import { AppTabContainer as
|
|
23
|
-
import { t as
|
|
24
|
-
export { R as ActiveFilters, z as AdvancedFilters, k as AppActions, E as AppDialog,
|
|
15
|
+
import { t as W } from "../../inputs-BMCt-VqZ.js";
|
|
16
|
+
import { t as G } from "../../language-DOGOdjzx.js";
|
|
17
|
+
import { t as K } from "../../AppTitle-BZ5jQWbs.js";
|
|
18
|
+
import { n as q, t as J } from "../../states-BQK9jqS4.js";
|
|
19
|
+
import { AppPageHeader as Y, KpiCardsLayout as X } from "./layouts/index.js";
|
|
20
|
+
import { a as Z, i as Q, n as $, o as ee, r as te, t as ne } from "../../navbar-CCHGdEzE.js";
|
|
21
|
+
import { DataTable as re, JsonTableOutput as ie, TableActions as ae, TableBody as oe, TableBulkActions as se, TableHeader as ce, TablePagination as le, TableSettings as ue } from "./table/index.js";
|
|
22
|
+
import { AppTabContainer as de, AppTabHeader as fe, AppTabs as pe, AppVerticalTabs as me } from "./tabs/index.js";
|
|
23
|
+
import { t as he } from "../../theme-q2uzluEd.js";
|
|
24
|
+
export { R as ActiveFilters, z as AdvancedFilters, k as AppActions, E as AppDialog, Y as AppPageHeader, A as AppSubTitle, de as AppTabContainer, fe as AppTabHeader, pe as AppTabs, K as AppTitle, me as AppVerticalTabs, v as BarChartHorizontal, C as BarChartVertical, _ as CHART_COLORS, y as ChartCard, S as CircularGauge, D as ConfirmationDialog, r as DashboardCard, re as DataTable, P as DatePicker, I as DateRangePicker, l as Dialog, c as DialogClose, p as DialogContent, g as DialogDescription, s as DialogFooter, h as DialogHeader, d as DialogOverlay, f as DialogPortal, m as DialogTitle, u as DialogTrigger, N as ErrorAlert, q as ErrorState, B as FilterField, V as FilterPills, H as FilterPillsGroup, T as FormDialog, M as GenericForm, ee as GlobalSearch, O as ImageInput, ie as JsonTableOutput, e as KpiCard, t as KpiCards, X as KpiCardsLayout, G as LanguageSelector, b as LineChart, J as LoadingState, i as MetricCard, j as MultiSelect, Z as NotificationsBell, w as PieChart, o as Progress, W as RatingInput, L as SearchInput, te as Sidebar, $ as SidebarHeader, Q as SidebarNavItem, F as SingleSelect, n as SkeletonCard, a as SkeletonCards, ae as TableActions, oe as TableBody, se as TableBulkActions, U as TableFilter, ce as TableHeader, le as TablePagination, ue as TableSettings, he as ThemeSelector, ne as Topbar, x as getChartColor };
|