@krosoft/react 0.0.331 → 0.0.333
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/{AppActions-CqK8g-ry.js → AppActions-DPh6HcIc.js} +2 -2
- package/dist/{AppSubTitle-ByOiQg8S.js → AppSubTitle-CpWp6lKN.js} +2 -2
- package/dist/{AppTitle-I4yLJGmv.js → AppTitle-BmC38bpm.js} +1 -1
- package/dist/{ErrorAlert-NmwmpbVN.js → ErrorAlert-D3C6XbWD.js} +1 -1
- package/dist/{GenericForm-DI6udL1l.js → GenericForm-CTYXe8AF.js} +6 -6
- package/dist/{ImageInput-DTNsRZaT.js → ImageInput-BwSbiNlX.js} +2 -2
- package/dist/{MultiSelect-C7d047Y9.js → MultiSelect-CmIK-KEB.js} +3 -3
- package/dist/{SearchInput-7uYKK54l.js → SearchInput-Bqn-zWhm.js} +4 -4
- package/dist/{behavior-BcXL-ZOv.js → behavior-COsb588c.js} +1 -1
- package/dist/{cards-cB4kYZpQ.js → cards-C3as3YSO.js} +2 -2
- package/dist/{charts-CHWqB53l.js → charts-CC89IsVe.js} +1 -1
- package/dist/components/core/cards/index.js +1 -1
- package/dist/components/core/charts/index.js +1 -1
- package/dist/components/core/dialogs/index.js +3 -3
- package/dist/components/core/filters/ConditionFilterGroup.d.ts +26 -0
- package/dist/components/core/filters/ConditionFilterGroup.d.ts.map +1 -0
- package/dist/components/core/filters/index.d.ts +1 -0
- package/dist/components/core/filters/index.d.ts.map +1 -1
- package/dist/components/core/filters/index.js +173 -131
- package/dist/components/core/forms/index.js +1 -1
- package/dist/components/core/index.js +24 -24
- package/dist/components/core/inputs/index.js +4 -4
- package/dist/components/core/language/index.js +1 -1
- package/dist/components/core/layouts/index.js +8 -8
- package/dist/components/core/navbar/index.js +1 -1
- package/dist/components/core/states/index.js +2 -2
- package/dist/components/core/table/TablePagination.d.ts.map +1 -1
- package/dist/components/core/table/index.js +3 -4
- package/dist/components/core/tabs/index.js +5 -5
- package/dist/components/core/theme/index.js +1 -1
- package/dist/components/index.js +24 -24
- package/dist/components/ui/index.js +2 -2
- package/dist/{dialogs-CeB4q0UB.js → dialogs-BkwuOyyd.js} +5 -5
- package/dist/hooks/behavior/index.js +1 -1
- package/dist/hooks/index.js +5 -5
- package/dist/hooks/ui/index.js +4 -4
- package/dist/i18n/index.js +1 -1
- package/dist/i18n/krosoftLocales.d.ts +2 -0
- package/dist/i18n/krosoftLocales.d.ts.map +1 -1
- package/dist/{i18n-CmJWr9V5.js → i18n-3KRQA34v.js} +4 -2
- package/dist/{inputs-BiMbj0lF.js → inputs-Cv9fjA5w.js} +4 -4
- package/dist/{language-NFREv4sJ.js → language-C1eieYDM.js} +2 -2
- package/dist/{navbar-CFV6_0Q8.js → navbar-Dx734K-w.js} +3 -3
- package/dist/pwa/index.js +1 -1
- package/dist/{sheet-0N3ZYjHb.js → sheet-0NJBIygH.js} +1 -1
- package/dist/{states-B45Wppt5.js → states-9YpSp3Na.js} +2 -2
- package/dist/{theme-BH6YyXQP.js → theme-DE_YkyN8.js} +2 -2
- package/dist/{ui-DOXKkmS3.js → ui-Cb1DWMv_.js} +3 -3
- package/dist/{ui-CB_byKCw.js → ui-DerGE_cz.js} +1 -1
- package/dist/{useDocumentTitle-C50DpJU1.js → useDocumentTitle-Debw93h6.js} +1 -1
- package/dist/{useLanguage-B__JHFZi.js → useLanguage-DfuWcRWA.js} +1 -1
- package/dist/{useTheme-C8wQV332.js → useTheme-VQiX8TT8.js} +1 -1
- package/package.json +1 -1
|
@@ -1,71 +1,71 @@
|
|
|
1
1
|
import { t as e } from "../../../tailwind.helper-CJaRYBmL.js";
|
|
2
|
-
import { t } from "../../../i18n-
|
|
3
|
-
import { At as n, Jt as r, Kt as i, Pn as a, Xt as o, Zt as s, en as c, n as l, qt as u, t as d, tn as f } from "../../../ui-
|
|
2
|
+
import { t } from "../../../i18n-3KRQA34v.js";
|
|
3
|
+
import { At as n, Jt as r, Kt as i, Pn as a, Xt as o, Zt as s, en as c, n as l, qt as u, t as d, tn as f } from "../../../ui-DerGE_cz.js";
|
|
4
4
|
import { a as p, c as m } from "../../../tooltip-_geGvbS7.js";
|
|
5
|
-
import { a as h, g, h as _, l as v, m as y, o as b, p as x, r as S, t as C, u as w } from "../../../sheet-
|
|
5
|
+
import { a as h, g, h as _, l as v, m as y, o as b, p as x, r as S, t as C, u as w } from "../../../sheet-0NJBIygH.js";
|
|
6
6
|
import { t as T } from "../../../useMobile-pTQ8lWvt.js";
|
|
7
|
-
import { t as E } from "../../../MultiSelect-
|
|
8
|
-
import { i as D, n as O, r as k, t as A } from "../../../SearchInput-
|
|
9
|
-
import "../../../ui-
|
|
10
|
-
import { useEffect as j, useMemo as M,
|
|
11
|
-
import { Fragment as
|
|
12
|
-
import { getLocale as
|
|
13
|
-
import { ChevronDownIcon as
|
|
7
|
+
import { t as E } from "../../../MultiSelect-CmIK-KEB.js";
|
|
8
|
+
import { i as D, n as O, r as k, t as A } from "../../../SearchInput-Bqn-zWhm.js";
|
|
9
|
+
import "../../../ui-Cb1DWMv_.js";
|
|
10
|
+
import { useEffect as j, useMemo as M, useRef as N, useState as P } from "react";
|
|
11
|
+
import { Fragment as F, jsx as I, jsxs as L } from "react/jsx-runtime";
|
|
12
|
+
import { getLocale as R } from "@krosoft/core/helpers";
|
|
13
|
+
import { ChevronDownIcon as z, Filter as B, FilterIcon as V, FilterXIcon as H, PlusIcon as U, XIcon as W } from "lucide-react";
|
|
14
14
|
//#region src/components/core/filters/ActiveFilters.tsx
|
|
15
|
-
var
|
|
16
|
-
if (t instanceof Date) return t.toLocaleDateString(
|
|
15
|
+
var G = (e, t, n, r = {}) => {
|
|
16
|
+
if (t instanceof Date) return t.toLocaleDateString(R());
|
|
17
17
|
let i = String(t), a = r[`${e}_${i}`];
|
|
18
18
|
return a === void 0 ? e.includes("ok") || t === "true" || t === "false" ? n(t === "true" ? "filters.yes" : "filters.no") : i : a;
|
|
19
19
|
};
|
|
20
|
-
function
|
|
20
|
+
function K({ filters: e, onRemoveFilter: n, onClearAll: r, filterLabelKeys: i = {}, optionLabels: o = {} }) {
|
|
21
21
|
let { t: s } = t(), c = Object.entries(e).filter(([e, t]) => !(t == null || t === "" || Array.isArray(t) && t.length === 0));
|
|
22
|
-
return c.length === 0 ? null : /* @__PURE__ */
|
|
22
|
+
return c.length === 0 ? null : /* @__PURE__ */ L("div", {
|
|
23
23
|
className: "flex flex-wrap items-center gap-2 mb-4",
|
|
24
24
|
children: [
|
|
25
|
-
/* @__PURE__ */
|
|
25
|
+
/* @__PURE__ */ I("span", {
|
|
26
26
|
className: "text-sm text-muted-foreground font-medium",
|
|
27
27
|
children: s("filters.active")
|
|
28
28
|
}),
|
|
29
29
|
c.flatMap(([e, t]) => {
|
|
30
30
|
let r = i[e], c = r === void 0 ? e : s(r);
|
|
31
31
|
if (Array.isArray(t)) return t.map((t) => {
|
|
32
|
-
let r =
|
|
33
|
-
return /* @__PURE__ */
|
|
32
|
+
let r = G(e, t, s, o);
|
|
33
|
+
return /* @__PURE__ */ L(a, {
|
|
34
34
|
variant: "secondary",
|
|
35
35
|
className: "flex items-center gap-1 px-3 py-1 bg-primary/10 text-primary border border-primary/20 hover:bg-primary/20",
|
|
36
36
|
children: [
|
|
37
37
|
c,
|
|
38
38
|
": ",
|
|
39
39
|
r,
|
|
40
|
-
/* @__PURE__ */
|
|
40
|
+
/* @__PURE__ */ I("button", {
|
|
41
41
|
onClick: () => {
|
|
42
42
|
n(e, t);
|
|
43
43
|
},
|
|
44
44
|
className: "ml-1 hover:bg-primary/20 rounded-full p-0.5",
|
|
45
|
-
children: /* @__PURE__ */
|
|
45
|
+
children: /* @__PURE__ */ I(W, { className: "size-4" })
|
|
46
46
|
})
|
|
47
47
|
]
|
|
48
48
|
}, `${e}_${String(t)}`);
|
|
49
49
|
});
|
|
50
|
-
let l =
|
|
51
|
-
return /* @__PURE__ */
|
|
50
|
+
let l = G(e, t, s, o);
|
|
51
|
+
return /* @__PURE__ */ L(a, {
|
|
52
52
|
variant: "secondary",
|
|
53
53
|
className: "flex items-center gap-1 px-3 py-1 bg-primary/10 text-primary border border-primary/20 hover:bg-primary/20",
|
|
54
54
|
children: [
|
|
55
55
|
c,
|
|
56
56
|
": ",
|
|
57
57
|
l,
|
|
58
|
-
/* @__PURE__ */
|
|
58
|
+
/* @__PURE__ */ I("button", {
|
|
59
59
|
onClick: () => {
|
|
60
60
|
n(e);
|
|
61
61
|
},
|
|
62
62
|
className: "ml-1 hover:bg-primary/20 rounded-full p-0.5",
|
|
63
|
-
children: /* @__PURE__ */
|
|
63
|
+
children: /* @__PURE__ */ I(W, { className: "size-4" })
|
|
64
64
|
})
|
|
65
65
|
]
|
|
66
66
|
}, e);
|
|
67
67
|
}),
|
|
68
|
-
c.length > 0 && /* @__PURE__ */
|
|
68
|
+
c.length > 0 && /* @__PURE__ */ I("button", {
|
|
69
69
|
onClick: r,
|
|
70
70
|
className: "text-xs text-destructive hover:text-destructive/80 transition-colors font-medium ml-auto",
|
|
71
71
|
children: s("filters.clearAll")
|
|
@@ -75,17 +75,17 @@ function W({ filters: e, onRemoveFilter: n, onClearAll: r, filterLabelKeys: i =
|
|
|
75
75
|
}
|
|
76
76
|
//#endregion
|
|
77
77
|
//#region src/components/core/filters/FilterField.tsx
|
|
78
|
-
var
|
|
78
|
+
var q = ({ field: e, value: n, onChange: r, onToggleMultiSelect: i }) => {
|
|
79
79
|
let { t: a } = t();
|
|
80
80
|
switch (e.type) {
|
|
81
|
-
case "text": return /* @__PURE__ */
|
|
81
|
+
case "text": return /* @__PURE__ */ I(g, {
|
|
82
82
|
placeholder: e.placeholder,
|
|
83
83
|
value: n ?? "",
|
|
84
84
|
onChange: (e) => {
|
|
85
85
|
r(e.target.value);
|
|
86
86
|
}
|
|
87
87
|
});
|
|
88
|
-
case "number": return /* @__PURE__ */
|
|
88
|
+
case "number": return /* @__PURE__ */ I(g, {
|
|
89
89
|
type: "number",
|
|
90
90
|
placeholder: e.placeholder,
|
|
91
91
|
value: n ?? "",
|
|
@@ -95,7 +95,7 @@ var G = ({ field: e, value: n, onChange: r, onToggleMultiSelect: i }) => {
|
|
|
95
95
|
min: e.min,
|
|
96
96
|
max: e.max
|
|
97
97
|
});
|
|
98
|
-
case "select": return /* @__PURE__ */
|
|
98
|
+
case "select": return /* @__PURE__ */ I(O, {
|
|
99
99
|
options: e.options ?? [],
|
|
100
100
|
value: n,
|
|
101
101
|
onChange: r,
|
|
@@ -103,17 +103,17 @@ var G = ({ field: e, value: n, onChange: r, onToggleMultiSelect: i }) => {
|
|
|
103
103
|
placeholder: e.placeholder,
|
|
104
104
|
searchPlaceholder: e.searchPlaceholder
|
|
105
105
|
});
|
|
106
|
-
case "date": return /* @__PURE__ */
|
|
106
|
+
case "date": return /* @__PURE__ */ I(D, {
|
|
107
107
|
date: n,
|
|
108
108
|
onDateChange: r,
|
|
109
109
|
placeholder: e.placeholder ?? a("date.pickDate")
|
|
110
110
|
});
|
|
111
|
-
case "date-range": return /* @__PURE__ */
|
|
111
|
+
case "date-range": return /* @__PURE__ */ I(k, {
|
|
112
112
|
value: n,
|
|
113
113
|
onChange: r,
|
|
114
114
|
placeholder: e.placeholder
|
|
115
115
|
});
|
|
116
|
-
case "multi-select": return /* @__PURE__ */
|
|
116
|
+
case "multi-select": return /* @__PURE__ */ I(E, {
|
|
117
117
|
options: e.options ?? [],
|
|
118
118
|
selected: n ?? [],
|
|
119
119
|
onToggle: i,
|
|
@@ -127,9 +127,9 @@ var G = ({ field: e, value: n, onChange: r, onToggleMultiSelect: i }) => {
|
|
|
127
127
|
});
|
|
128
128
|
default: return null;
|
|
129
129
|
}
|
|
130
|
-
},
|
|
131
|
-
function
|
|
132
|
-
let { t: s } = t(), [c, l] =
|
|
130
|
+
}, J = (e) => !(e == null || e === "" || Array.isArray(e) && e.length === 0);
|
|
131
|
+
function Y({ sections: e, filters: r, onFiltersChange: i, buttonText: a, sheetTitle: o }) {
|
|
132
|
+
let { t: s } = t(), [c, l] = P(!1), [u, d] = P(r);
|
|
133
133
|
j(() => {
|
|
134
134
|
d(r);
|
|
135
135
|
}, [r, c]);
|
|
@@ -147,48 +147,48 @@ function q({ sections: e, filters: r, onFiltersChange: i, buttonText: a, sheetTi
|
|
|
147
147
|
d({}), i({}), l(!1);
|
|
148
148
|
}, y = M(() => {
|
|
149
149
|
let t = new Set(e.flatMap((e) => e.filters.map((e) => e.key)));
|
|
150
|
-
return Object.entries(r).filter(([e, n]) => t.has(e) &&
|
|
150
|
+
return Object.entries(r).filter(([e, n]) => t.has(e) && J(n)).length;
|
|
151
151
|
}, [e, r]);
|
|
152
|
-
return /* @__PURE__ */
|
|
152
|
+
return /* @__PURE__ */ L(C, {
|
|
153
153
|
open: c,
|
|
154
154
|
onOpenChange: l,
|
|
155
|
-
children: [/* @__PURE__ */
|
|
155
|
+
children: [/* @__PURE__ */ I(w, {
|
|
156
156
|
asChild: !0,
|
|
157
|
-
children: /* @__PURE__ */
|
|
157
|
+
children: /* @__PURE__ */ L(m, {
|
|
158
158
|
variant: "outline",
|
|
159
159
|
className: "gap-2",
|
|
160
160
|
children: [
|
|
161
|
-
/* @__PURE__ */
|
|
161
|
+
/* @__PURE__ */ I(B, { className: "size-4 shrink-0" }),
|
|
162
162
|
a ?? s("filters.more"),
|
|
163
|
-
y > 0 && /* @__PURE__ */
|
|
163
|
+
y > 0 && /* @__PURE__ */ I("span", {
|
|
164
164
|
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",
|
|
165
165
|
children: y
|
|
166
166
|
})
|
|
167
167
|
]
|
|
168
168
|
})
|
|
169
|
-
}), /* @__PURE__ */
|
|
169
|
+
}), /* @__PURE__ */ L(S, {
|
|
170
170
|
side: "right",
|
|
171
171
|
className: "w-[400px] sm:w-[500px] flex flex-col p-0",
|
|
172
172
|
children: [
|
|
173
|
-
/* @__PURE__ */
|
|
173
|
+
/* @__PURE__ */ I(b, {
|
|
174
174
|
className: "p-6 pb-0",
|
|
175
|
-
children: /* @__PURE__ */
|
|
175
|
+
children: /* @__PURE__ */ I(v, { children: o ?? s("filters.advanced") })
|
|
176
176
|
}),
|
|
177
|
-
/* @__PURE__ */
|
|
177
|
+
/* @__PURE__ */ I("div", {
|
|
178
178
|
className: "flex-1 overflow-y-auto p-6 pt-6",
|
|
179
|
-
children: /* @__PURE__ */
|
|
179
|
+
children: /* @__PURE__ */ I("div", {
|
|
180
180
|
className: "space-y-6",
|
|
181
|
-
children: e.map((e, t) => /* @__PURE__ */
|
|
181
|
+
children: e.map((e, t) => /* @__PURE__ */ L("div", {
|
|
182
182
|
className: "space-y-4",
|
|
183
|
-
children: [/* @__PURE__ */
|
|
183
|
+
children: [/* @__PURE__ */ I("h3", {
|
|
184
184
|
className: "font-semibold text-sm text-foreground border-b pb-2",
|
|
185
185
|
children: s(e.titleKey)
|
|
186
|
-
}), e.filters.map((e) => /* @__PURE__ */
|
|
186
|
+
}), e.filters.map((e) => /* @__PURE__ */ L("div", {
|
|
187
187
|
className: "space-y-2",
|
|
188
|
-
children: [/* @__PURE__ */
|
|
188
|
+
children: [/* @__PURE__ */ I(n, {
|
|
189
189
|
htmlFor: e.key,
|
|
190
190
|
children: s(e.labelKey)
|
|
191
|
-
}), /* @__PURE__ */
|
|
191
|
+
}), /* @__PURE__ */ I(q, {
|
|
192
192
|
field: e,
|
|
193
193
|
value: u[e.key],
|
|
194
194
|
onChange: (t) => {
|
|
@@ -202,14 +202,14 @@ function q({ sections: e, filters: r, onFiltersChange: i, buttonText: a, sheetTi
|
|
|
202
202
|
}, t))
|
|
203
203
|
})
|
|
204
204
|
}),
|
|
205
|
-
/* @__PURE__ */
|
|
205
|
+
/* @__PURE__ */ L(h, {
|
|
206
206
|
className: "gap-2 p-6 border-t bg-background",
|
|
207
|
-
children: [/* @__PURE__ */
|
|
207
|
+
children: [/* @__PURE__ */ I(m, {
|
|
208
208
|
variant: "outline",
|
|
209
209
|
className: "flex-1",
|
|
210
210
|
onClick: _,
|
|
211
211
|
children: s("filters.clear")
|
|
212
|
-
}), /* @__PURE__ */
|
|
212
|
+
}), /* @__PURE__ */ I(m, {
|
|
213
213
|
className: "flex-1",
|
|
214
214
|
onClick: g,
|
|
215
215
|
children: s("filters.apply")
|
|
@@ -221,28 +221,28 @@ function q({ sections: e, filters: r, onFiltersChange: i, buttonText: a, sheetTi
|
|
|
221
221
|
}
|
|
222
222
|
//#endregion
|
|
223
223
|
//#region src/components/core/filters/FilterPillsGroup.tsx
|
|
224
|
-
var
|
|
224
|
+
var X = {
|
|
225
225
|
solid: "border-foreground bg-foreground text-background",
|
|
226
226
|
outline: "border-primary bg-primary/10 text-primary font-medium"
|
|
227
227
|
};
|
|
228
|
-
function
|
|
229
|
-
return r === void 0 ? t ?
|
|
228
|
+
function ee(t, n, r) {
|
|
229
|
+
return r === void 0 ? t ? X[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");
|
|
230
230
|
}
|
|
231
|
-
function
|
|
232
|
-
return /* @__PURE__ */
|
|
231
|
+
function Z({ options: t, values: n, onToggle: r, variant: i = "solid" }) {
|
|
232
|
+
return /* @__PURE__ */ I("div", {
|
|
233
233
|
className: "flex flex-wrap gap-1.5",
|
|
234
234
|
children: t.map(({ value: t, label: a, count: o, icon: s, className: c }) => {
|
|
235
|
-
let l =
|
|
236
|
-
return /* @__PURE__ */
|
|
235
|
+
let l = ee(n.includes(t), i, c);
|
|
236
|
+
return /* @__PURE__ */ L("button", {
|
|
237
237
|
onClick: () => {
|
|
238
238
|
r(t);
|
|
239
239
|
},
|
|
240
240
|
className: e("inline-flex items-center gap-1 text-xs px-2.5 py-1 rounded-control border transition-colors", l),
|
|
241
241
|
children: [
|
|
242
|
-
s && /* @__PURE__ */
|
|
242
|
+
s && /* @__PURE__ */ I(s, { className: "size-3 shrink-0" }),
|
|
243
243
|
a,
|
|
244
244
|
" ",
|
|
245
|
-
o !== void 0 && /* @__PURE__ */
|
|
245
|
+
o !== void 0 && /* @__PURE__ */ L("span", {
|
|
246
246
|
className: "opacity-60",
|
|
247
247
|
children: [
|
|
248
248
|
"(",
|
|
@@ -257,8 +257,8 @@ function X({ options: t, values: n, onToggle: r, variant: i = "solid" }) {
|
|
|
257
257
|
}
|
|
258
258
|
//#endregion
|
|
259
259
|
//#region src/components/core/filters/FilterPills.tsx
|
|
260
|
-
function
|
|
261
|
-
return /* @__PURE__ */
|
|
260
|
+
function te({ options: e, value: t, onChange: n, variant: r = "solid" }) {
|
|
261
|
+
return /* @__PURE__ */ I(Z, {
|
|
262
262
|
options: e,
|
|
263
263
|
values: [t],
|
|
264
264
|
onToggle: n,
|
|
@@ -268,42 +268,42 @@ function Z({ options: e, value: t, onChange: n, variant: r = "solid" }) {
|
|
|
268
268
|
//#endregion
|
|
269
269
|
//#region src/components/core/filters/FiltersMobileDrawer.tsx
|
|
270
270
|
function Q({ children: e, activeFiltersCount: n = 0, onReset: a, onApply: l }) {
|
|
271
|
-
let { t: d } = t(), [p, h] =
|
|
272
|
-
return /* @__PURE__ */
|
|
271
|
+
let { t: d } = t(), [p, h] = P(!1);
|
|
272
|
+
return /* @__PURE__ */ L(i, {
|
|
273
273
|
open: p,
|
|
274
274
|
onOpenChange: h,
|
|
275
|
-
children: [/* @__PURE__ */
|
|
275
|
+
children: [/* @__PURE__ */ I(f, {
|
|
276
276
|
asChild: !0,
|
|
277
|
-
children: /* @__PURE__ */
|
|
277
|
+
children: /* @__PURE__ */ L(m, {
|
|
278
278
|
variant: "outline",
|
|
279
279
|
className: "relative",
|
|
280
280
|
children: [
|
|
281
|
-
/* @__PURE__ */
|
|
281
|
+
/* @__PURE__ */ I(V, { className: "h-4 w-4 mr-2" }),
|
|
282
282
|
d("filters.filter"),
|
|
283
|
-
n > 0 && /* @__PURE__ */
|
|
283
|
+
n > 0 && /* @__PURE__ */ I("span", {
|
|
284
284
|
className: "absolute -top-2 -right-2 flex h-5 w-5 items-center justify-center rounded-full bg-primary text-xs text-primary-foreground",
|
|
285
285
|
children: n
|
|
286
286
|
})
|
|
287
287
|
]
|
|
288
288
|
})
|
|
289
|
-
}), /* @__PURE__ */
|
|
290
|
-
/* @__PURE__ */
|
|
291
|
-
/* @__PURE__ */
|
|
289
|
+
}), /* @__PURE__ */ L(r, { children: [
|
|
290
|
+
/* @__PURE__ */ I(s, { children: /* @__PURE__ */ I(c, { children: d("filters.title") }) }),
|
|
291
|
+
/* @__PURE__ */ I("div", {
|
|
292
292
|
className: "flex flex-col gap-4 px-4 pb-4",
|
|
293
293
|
children: e
|
|
294
294
|
}),
|
|
295
|
-
/* @__PURE__ */
|
|
295
|
+
/* @__PURE__ */ L(o, {
|
|
296
296
|
className: "flex-row gap-2",
|
|
297
|
-
children: [/* @__PURE__ */
|
|
297
|
+
children: [/* @__PURE__ */ L(m, {
|
|
298
298
|
variant: "outline",
|
|
299
299
|
onClick: () => {
|
|
300
300
|
a?.(), h(!1);
|
|
301
301
|
},
|
|
302
302
|
className: "flex-1",
|
|
303
|
-
children: [/* @__PURE__ */
|
|
304
|
-
}), /* @__PURE__ */
|
|
303
|
+
children: [/* @__PURE__ */ I(H, { className: "h-4 w-4 mr-2" }), d("filters.reset")]
|
|
304
|
+
}), /* @__PURE__ */ I(u, {
|
|
305
305
|
asChild: !0,
|
|
306
|
-
children: /* @__PURE__ */
|
|
306
|
+
children: /* @__PURE__ */ I(m, {
|
|
307
307
|
onClick: () => {
|
|
308
308
|
l?.(), h(!1);
|
|
309
309
|
},
|
|
@@ -317,41 +317,41 @@ function Q({ children: e, activeFiltersCount: n = 0, onReset: a, onApply: l }) {
|
|
|
317
317
|
}
|
|
318
318
|
//#endregion
|
|
319
319
|
//#region src/components/core/filters/FiltersContainer.tsx
|
|
320
|
-
function
|
|
320
|
+
function ne({ children: e, search: n, searchPlaceholder: r, activeFiltersCount: i = 0, onReset: a, onSearch: o }) {
|
|
321
321
|
let { t: s } = t();
|
|
322
|
-
return T() ? /* @__PURE__ */
|
|
322
|
+
return T() ? /* @__PURE__ */ L("div", {
|
|
323
323
|
className: "flex items-center gap-2",
|
|
324
|
-
children: [o !== void 0 && /* @__PURE__ */
|
|
324
|
+
children: [o !== void 0 && /* @__PURE__ */ I("div", {
|
|
325
325
|
className: "flex-1",
|
|
326
|
-
children: /* @__PURE__ */
|
|
326
|
+
children: /* @__PURE__ */ I(A, {
|
|
327
327
|
search: n ?? "",
|
|
328
328
|
onSearch: o,
|
|
329
329
|
placeholder: r
|
|
330
330
|
})
|
|
331
|
-
}), /* @__PURE__ */
|
|
331
|
+
}), /* @__PURE__ */ I(Q, {
|
|
332
332
|
activeFiltersCount: i,
|
|
333
333
|
onReset: a,
|
|
334
334
|
children: e
|
|
335
335
|
})]
|
|
336
|
-
}) : /* @__PURE__ */
|
|
336
|
+
}) : /* @__PURE__ */ L("div", {
|
|
337
337
|
className: "flex justify-between",
|
|
338
|
-
children: [/* @__PURE__ */
|
|
338
|
+
children: [/* @__PURE__ */ L("div", {
|
|
339
339
|
className: "flex flex-wrap gap-2",
|
|
340
|
-
children: [o !== void 0 && /* @__PURE__ */
|
|
340
|
+
children: [o !== void 0 && /* @__PURE__ */ I(A, {
|
|
341
341
|
search: n ?? "",
|
|
342
342
|
onSearch: o,
|
|
343
343
|
placeholder: r
|
|
344
344
|
}), e]
|
|
345
|
-
}), a && /* @__PURE__ */
|
|
345
|
+
}), a && /* @__PURE__ */ I("div", {
|
|
346
346
|
className: "flex flex-wrap gap-4",
|
|
347
|
-
children: /* @__PURE__ */
|
|
347
|
+
children: /* @__PURE__ */ L(m, {
|
|
348
348
|
variant: "outline",
|
|
349
349
|
onClick: a,
|
|
350
350
|
className: "relative",
|
|
351
351
|
children: [
|
|
352
|
-
/* @__PURE__ */
|
|
352
|
+
/* @__PURE__ */ I(H, {}),
|
|
353
353
|
s("filters.reset"),
|
|
354
|
-
i > 0 && /* @__PURE__ */
|
|
354
|
+
i > 0 && /* @__PURE__ */ I("span", {
|
|
355
355
|
className: "absolute -top-2 -right-2 flex h-5 w-5 items-center justify-center rounded-full bg-primary text-xs text-primary-foreground",
|
|
356
356
|
children: i
|
|
357
357
|
})
|
|
@@ -362,7 +362,7 @@ function $({ children: e, search: n, searchPlaceholder: r, activeFiltersCount: i
|
|
|
362
362
|
}
|
|
363
363
|
//#endregion
|
|
364
364
|
//#region src/components/core/filters/TableFilter.tsx
|
|
365
|
-
function
|
|
365
|
+
function re({ searchQuery: e, onSearchChange: n, searchPlaceholder: r, filters: i, onFiltersChange: a, sections: o, advancedButtonText: s, sheetTitle: c }) {
|
|
366
366
|
let { t: l } = t(), u = (e, t) => {
|
|
367
367
|
let n = i[e], r = Array.isArray(n) ? n : [], o = r.includes(t) ? r.filter((e) => e !== t) : [...r, t], s = { ...i };
|
|
368
368
|
o.length === 0 ? delete s[e] : s[e] = o, a(s);
|
|
@@ -404,20 +404,20 @@ function ee({ searchQuery: e, onSearchChange: n, searchPlaceholder: r, filters:
|
|
|
404
404
|
});
|
|
405
405
|
}), e;
|
|
406
406
|
}, [o]);
|
|
407
|
-
return /* @__PURE__ */
|
|
407
|
+
return /* @__PURE__ */ L("div", {
|
|
408
408
|
className: "space-y-4 w-full",
|
|
409
|
-
children: [/* @__PURE__ */
|
|
409
|
+
children: [/* @__PURE__ */ L("div", {
|
|
410
410
|
className: "flex flex-wrap items-center gap-2 justify-between",
|
|
411
|
-
children: [/* @__PURE__ */
|
|
411
|
+
children: [/* @__PURE__ */ L("div", {
|
|
412
412
|
className: "flex flex-wrap items-center gap-2",
|
|
413
|
-
children: [n === void 0 ? null : /* @__PURE__ */
|
|
413
|
+
children: [n === void 0 ? null : /* @__PURE__ */ I(A, {
|
|
414
414
|
searchQuery: e,
|
|
415
415
|
onSearch: n,
|
|
416
416
|
onClear: () => {
|
|
417
417
|
n("");
|
|
418
418
|
},
|
|
419
419
|
placeholder: r ?? l("search.placeholder")
|
|
420
|
-
}), m.map((e) => /* @__PURE__ */
|
|
420
|
+
}), m.map((e) => /* @__PURE__ */ I(E, {
|
|
421
421
|
variant: "pill",
|
|
422
422
|
labelKey: e.labelKey,
|
|
423
423
|
options: e.options,
|
|
@@ -437,14 +437,14 @@ function ee({ searchQuery: e, onSearchChange: n, searchPlaceholder: r, filters:
|
|
|
437
437
|
searchable: e.searchable,
|
|
438
438
|
searchPlaceholder: e.searchPlaceholder
|
|
439
439
|
}, e.key))]
|
|
440
|
-
}), o.length > 0 && /* @__PURE__ */
|
|
440
|
+
}), o.length > 0 && /* @__PURE__ */ I(Y, {
|
|
441
441
|
sections: o,
|
|
442
442
|
filters: i,
|
|
443
443
|
onFiltersChange: a,
|
|
444
444
|
buttonText: s,
|
|
445
445
|
sheetTitle: c
|
|
446
446
|
})]
|
|
447
|
-
}), /* @__PURE__ */
|
|
447
|
+
}), /* @__PURE__ */ I(K, {
|
|
448
448
|
filters: i,
|
|
449
449
|
onRemoveFilter: p,
|
|
450
450
|
onClearAll: f,
|
|
@@ -455,51 +455,51 @@ function ee({ searchQuery: e, onSearchChange: n, searchPlaceholder: r, filters:
|
|
|
455
455
|
}
|
|
456
456
|
//#endregion
|
|
457
457
|
//#region src/components/core/filters/ConditionFilter.tsx
|
|
458
|
-
var
|
|
459
|
-
function
|
|
460
|
-
let { t: h } = t(), [v, b] =
|
|
458
|
+
var ie = (e) => e?.requiresValue !== !1;
|
|
459
|
+
function $({ fields: r, operators: i, value: a, onChange: o, labelKey: s, icon: c, disabled: u = !1, className: f }) {
|
|
460
|
+
let { t: h } = t(), [v, b] = P(!1), [S, C] = P({ value: "" }), w = a === void 0 ? void 0 : r.find((e) => e.value === a.field), T = a === void 0 ? void 0 : i.find((e) => e.value === a.operator), E = a !== void 0, D = i.find((e) => e.value === S.operator), k = ie(D), A = D?.numeric === !0, j = S.value.trim(), M = k && A && j !== "" && Number.isNaN(Number(j)), N = S.field !== void 0 && D !== void 0 && (!k || j !== "") && !M, R = (e) => {
|
|
461
461
|
e && C(a === void 0 ? { value: "" } : { ...a }), b(e);
|
|
462
462
|
}, B = () => {
|
|
463
|
-
|
|
463
|
+
N && S.field !== void 0 && D !== void 0 && (o({
|
|
464
464
|
field: S.field,
|
|
465
465
|
operator: D.value,
|
|
466
466
|
value: k ? j : ""
|
|
467
467
|
}), b(!1));
|
|
468
468
|
}, V = () => {
|
|
469
469
|
o(void 0), b(!1);
|
|
470
|
-
},
|
|
471
|
-
return /* @__PURE__ */
|
|
470
|
+
}, H = h(s === void 0 ? "filters.condition.label" : s);
|
|
471
|
+
return /* @__PURE__ */ L(x, {
|
|
472
472
|
open: v,
|
|
473
|
-
onOpenChange:
|
|
474
|
-
children: [/* @__PURE__ */
|
|
473
|
+
onOpenChange: R,
|
|
474
|
+
children: [/* @__PURE__ */ I(_, {
|
|
475
475
|
asChild: !0,
|
|
476
|
-
children: /* @__PURE__ */
|
|
476
|
+
children: /* @__PURE__ */ L("button", {
|
|
477
477
|
type: "button",
|
|
478
478
|
disabled: u,
|
|
479
479
|
className: e(p, "inline-flex items-center justify-between gap-1.5 whitespace-nowrap transition-colors", E ? "border-primary bg-primary/10 text-primary" : "hover:bg-muted", !E && "w-full md:w-[200px]", f),
|
|
480
|
-
children: [/* @__PURE__ */
|
|
480
|
+
children: [/* @__PURE__ */ L("span", {
|
|
481
481
|
className: "flex min-w-0 items-center gap-1.5",
|
|
482
|
-
children: [c !== void 0 && /* @__PURE__ */
|
|
482
|
+
children: [c !== void 0 && /* @__PURE__ */ I(c, { className: "size-3.5 shrink-0 opacity-70" }), /* @__PURE__ */ I("span", {
|
|
483
483
|
className: "truncate",
|
|
484
|
-
children: a === void 0 ?
|
|
485
|
-
|
|
484
|
+
children: a === void 0 ? H : /* @__PURE__ */ L(F, { children: [
|
|
485
|
+
H,
|
|
486
486
|
" :",
|
|
487
487
|
" ",
|
|
488
|
-
/* @__PURE__ */
|
|
488
|
+
/* @__PURE__ */ I("span", {
|
|
489
489
|
className: "font-semibold",
|
|
490
490
|
children: w?.label ?? a.field
|
|
491
491
|
}),
|
|
492
492
|
" ",
|
|
493
493
|
T?.label ?? a.operator,
|
|
494
|
-
a.value !== "" && /* @__PURE__ */
|
|
494
|
+
a.value !== "" && /* @__PURE__ */ L("span", {
|
|
495
495
|
className: "font-semibold",
|
|
496
496
|
children: [" ", a.value]
|
|
497
497
|
})
|
|
498
498
|
] })
|
|
499
499
|
})]
|
|
500
|
-
}), /* @__PURE__ */
|
|
500
|
+
}), /* @__PURE__ */ L("span", {
|
|
501
501
|
className: "flex shrink-0 items-center gap-1",
|
|
502
|
-
children: [E && !u && /* @__PURE__ */
|
|
502
|
+
children: [E && !u && /* @__PURE__ */ I("span", {
|
|
503
503
|
role: "button",
|
|
504
504
|
tabIndex: -1,
|
|
505
505
|
"aria-label": h("filters.condition.clear"),
|
|
@@ -510,17 +510,17 @@ function ne({ fields: r, operators: i, value: a, onChange: o, labelKey: s, icon:
|
|
|
510
510
|
e.preventDefault(), e.stopPropagation(), o(void 0);
|
|
511
511
|
},
|
|
512
512
|
className: "opacity-70 hover:opacity-100",
|
|
513
|
-
children: /* @__PURE__ */
|
|
514
|
-
}), /* @__PURE__ */
|
|
513
|
+
children: /* @__PURE__ */ I(W, { className: "size-3.5" })
|
|
514
|
+
}), /* @__PURE__ */ I(z, { className: e("size-3.5 opacity-60 transition-transform", v && "rotate-180") })]
|
|
515
515
|
})]
|
|
516
516
|
})
|
|
517
|
-
}), /* @__PURE__ */
|
|
517
|
+
}), /* @__PURE__ */ L(y, {
|
|
518
518
|
align: "start",
|
|
519
519
|
className: "w-80 space-y-4",
|
|
520
520
|
children: [
|
|
521
|
-
/* @__PURE__ */
|
|
521
|
+
/* @__PURE__ */ L("div", {
|
|
522
522
|
className: "space-y-1.5",
|
|
523
|
-
children: [/* @__PURE__ */
|
|
523
|
+
children: [/* @__PURE__ */ I(n, { children: h("filters.condition.field") }), /* @__PURE__ */ I(O, {
|
|
524
524
|
options: r,
|
|
525
525
|
value: S.field,
|
|
526
526
|
onChange: (e) => {
|
|
@@ -532,9 +532,9 @@ function ne({ fields: r, operators: i, value: a, onChange: o, labelKey: s, icon:
|
|
|
532
532
|
placeholder: h("filters.condition.selectField")
|
|
533
533
|
})]
|
|
534
534
|
}),
|
|
535
|
-
/* @__PURE__ */
|
|
535
|
+
/* @__PURE__ */ L("div", {
|
|
536
536
|
className: "space-y-1.5",
|
|
537
|
-
children: [/* @__PURE__ */
|
|
537
|
+
children: [/* @__PURE__ */ I(n, { children: h("filters.condition.operator") }), /* @__PURE__ */ I(d, {
|
|
538
538
|
type: "single",
|
|
539
539
|
variant: "outline",
|
|
540
540
|
size: "sm",
|
|
@@ -550,7 +550,7 @@ function ne({ fields: r, operators: i, value: a, onChange: o, labelKey: s, icon:
|
|
|
550
550
|
};
|
|
551
551
|
});
|
|
552
552
|
},
|
|
553
|
-
children: i.map((e) => /* @__PURE__ */
|
|
553
|
+
children: i.map((e) => /* @__PURE__ */ I(l, {
|
|
554
554
|
value: e.value,
|
|
555
555
|
title: e.title,
|
|
556
556
|
"aria-label": e.title ?? e.label,
|
|
@@ -559,14 +559,14 @@ function ne({ fields: r, operators: i, value: a, onChange: o, labelKey: s, icon:
|
|
|
559
559
|
}, e.value))
|
|
560
560
|
})]
|
|
561
561
|
}),
|
|
562
|
-
k && /* @__PURE__ */
|
|
562
|
+
k && /* @__PURE__ */ L("div", {
|
|
563
563
|
className: "space-y-1.5",
|
|
564
564
|
children: [
|
|
565
|
-
/* @__PURE__ */
|
|
565
|
+
/* @__PURE__ */ I(n, {
|
|
566
566
|
htmlFor: "condition-filter-value",
|
|
567
567
|
children: h("filters.condition.value")
|
|
568
568
|
}),
|
|
569
|
-
/* @__PURE__ */
|
|
569
|
+
/* @__PURE__ */ I(g, {
|
|
570
570
|
id: "condition-filter-value",
|
|
571
571
|
value: S.value,
|
|
572
572
|
type: A ? "number" : "text",
|
|
@@ -584,17 +584,17 @@ function ne({ fields: r, operators: i, value: a, onChange: o, labelKey: s, icon:
|
|
|
584
584
|
" "
|
|
585
585
|
]
|
|
586
586
|
}),
|
|
587
|
-
/* @__PURE__ */
|
|
587
|
+
/* @__PURE__ */ L("div", {
|
|
588
588
|
className: "flex justify-end gap-2",
|
|
589
|
-
children: [E && /* @__PURE__ */
|
|
589
|
+
children: [E && /* @__PURE__ */ I(m, {
|
|
590
590
|
variant: "ghost",
|
|
591
591
|
size: "sm",
|
|
592
592
|
onClick: V,
|
|
593
593
|
children: h("filters.condition.clear")
|
|
594
|
-
}), /* @__PURE__ */
|
|
594
|
+
}), /* @__PURE__ */ I(m, {
|
|
595
595
|
size: "sm",
|
|
596
596
|
onClick: B,
|
|
597
|
-
disabled: !
|
|
597
|
+
disabled: !N,
|
|
598
598
|
children: h("filters.condition.apply")
|
|
599
599
|
})]
|
|
600
600
|
})
|
|
@@ -603,4 +603,46 @@ function ne({ fields: r, operators: i, value: a, onChange: o, labelKey: s, icon:
|
|
|
603
603
|
});
|
|
604
604
|
}
|
|
605
605
|
//#endregion
|
|
606
|
-
|
|
606
|
+
//#region src/components/core/filters/ConditionFilterGroup.tsx
|
|
607
|
+
var ae = (e, t) => e.field === t.field && e.operator === t.operator && e.value === t.value;
|
|
608
|
+
function oe({ fields: t, operators: n, values: r, onChange: i, labelKey: a, max: o = 5, disabled: s = !1, className: c }) {
|
|
609
|
+
let l = N(!1), u = (e) => {
|
|
610
|
+
e === void 0 || r.some((t) => ae(t, e)) || i([...r, e]);
|
|
611
|
+
}, d = (e, t) => {
|
|
612
|
+
if (t === void 0) {
|
|
613
|
+
l.current = !0, i(r.filter((t, n) => n !== e));
|
|
614
|
+
return;
|
|
615
|
+
}
|
|
616
|
+
i(r.map((n, r) => r === e ? t : n));
|
|
617
|
+
}, f = r.length === 0, p = () => {
|
|
618
|
+
l.current = !1;
|
|
619
|
+
};
|
|
620
|
+
return /* @__PURE__ */ L("div", {
|
|
621
|
+
className: e("flex flex-wrap items-center gap-2", c),
|
|
622
|
+
onPointerDownCapture: p,
|
|
623
|
+
onKeyDownCapture: p,
|
|
624
|
+
onClickCapture: (e) => {
|
|
625
|
+
l.current && (l.current = !1, e.preventDefault(), e.stopPropagation());
|
|
626
|
+
},
|
|
627
|
+
children: [r.map((e, r) => /* @__PURE__ */ I($, {
|
|
628
|
+
fields: t,
|
|
629
|
+
operators: n,
|
|
630
|
+
value: e,
|
|
631
|
+
onChange: (e) => {
|
|
632
|
+
d(r, e);
|
|
633
|
+
},
|
|
634
|
+
labelKey: a,
|
|
635
|
+
disabled: s
|
|
636
|
+
}, r)), r.length < o && /* @__PURE__ */ I($, {
|
|
637
|
+
fields: t,
|
|
638
|
+
operators: n,
|
|
639
|
+
value: void 0,
|
|
640
|
+
onChange: u,
|
|
641
|
+
labelKey: f ? a : "filters.condition.add",
|
|
642
|
+
icon: f ? void 0 : U,
|
|
643
|
+
disabled: s
|
|
644
|
+
})]
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
//#endregion
|
|
648
|
+
export { K as ActiveFilters, Y as AdvancedFilters, $ as ConditionFilter, oe as ConditionFilterGroup, q as FilterField, te as FilterPills, Z as FilterPillsGroup, ne as FiltersContainer, Q as FiltersMobileDrawer, re as TableFilter };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../../GenericForm-
|
|
1
|
+
import { t as e } from "../../../GenericForm-CTYXe8AF.js";
|
|
2
2
|
export { e as GenericForm };
|