@krosoft/react 0.0.330 → 0.0.332
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-CJiYlj_g.js → AppActions-DPh6HcIc.js} +2 -2
- package/dist/{AppSubTitle-Fqo3lk2A.js → AppSubTitle-CpWp6lKN.js} +2 -2
- package/dist/{AppTitle-CK5tYl7t.js → AppTitle-BmC38bpm.js} +1 -1
- package/dist/{ErrorAlert-B9xG4dAD.js → ErrorAlert-D3C6XbWD.js} +1 -1
- package/dist/{GenericForm-BOoNPBx5.js → GenericForm-CTYXe8AF.js} +6 -6
- package/dist/{ImageInput-BESvVwnK.js → ImageInput-BwSbiNlX.js} +2 -2
- package/dist/{MultiSelect-DQX1rk-t.js → MultiSelect-CmIK-KEB.js} +3 -3
- package/dist/{SearchInput-BFh0o1RM.js → SearchInput-Bqn-zWhm.js} +4 -4
- package/dist/{behavior-B1Zn_N2M.js → behavior-COsb588c.js} +1 -1
- package/dist/{cards-OMWaiu9p.js → cards-C3as3YSO.js} +2 -2
- package/dist/{charts-NxoXrN5w.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/ConditionFilter.d.ts +46 -0
- package/dist/components/core/filters/ConditionFilter.d.ts.map +1 -0
- 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 +2 -0
- package/dist/components/core/filters/index.d.ts.map +1 -1
- package/dist/components/core/filters/index.js +315 -124
- 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/index.js +2 -2
- 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-BVf-OP_h.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 +20 -0
- package/dist/i18n/krosoftLocales.d.ts.map +1 -1
- package/dist/{i18n-BuQgyJAA.js → i18n-3KRQA34v.js} +22 -2
- package/dist/{inputs-BpZ4hAO1.js → inputs-Cv9fjA5w.js} +4 -4
- package/dist/{language-CK1Toh4q.js → language-C1eieYDM.js} +2 -2
- package/dist/{navbar-uE-TcuY6.js → navbar-Dx734K-w.js} +3 -3
- package/dist/pwa/index.js +1 -1
- package/dist/{sheet-BtfL6yxE.js → sheet-0NJBIygH.js} +1 -1
- package/dist/{states-lmDbJIGj.js → states-9YpSp3Na.js} +2 -2
- package/dist/{theme-nG-VcChv.js → theme-DE_YkyN8.js} +2 -2
- package/dist/{ui-pTlOByAk.js → ui-Cb1DWMv_.js} +3 -3
- package/dist/{ui-yvfaMQwo.js → ui-DerGE_cz.js} +1 -1
- package/dist/{useDocumentTitle-Dwdvj0Cq.js → useDocumentTitle-Debw93h6.js} +1 -1
- package/dist/{useLanguage-COBm8fDW.js → useLanguage-DfuWcRWA.js} +1 -1
- package/dist/{useTheme-DnfZqWof.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,
|
|
4
|
-
import { c as
|
|
5
|
-
import { a as
|
|
6
|
-
import { t as
|
|
7
|
-
import { t as
|
|
8
|
-
import { i as
|
|
9
|
-
import "../../../ui-
|
|
10
|
-
import { useEffect as
|
|
11
|
-
import { jsx as
|
|
12
|
-
import { getLocale as
|
|
13
|
-
import { Filter as
|
|
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
|
+
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-0NJBIygH.js";
|
|
6
|
+
import { t as T } from "../../../useMobile-pTQ8lWvt.js";
|
|
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 I({ 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 L = ({ 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__ */ O
|
|
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 L = ({ 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,91 +127,91 @@ var L = ({ 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] =
|
|
133
|
-
|
|
134
|
-
|
|
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
|
+
j(() => {
|
|
134
|
+
d(r);
|
|
135
135
|
}, [r, c]);
|
|
136
|
-
let
|
|
137
|
-
|
|
136
|
+
let f = (e, t) => {
|
|
137
|
+
d((n) => ({
|
|
138
138
|
...n,
|
|
139
139
|
[e]: t
|
|
140
140
|
}));
|
|
141
|
-
},
|
|
141
|
+
}, p = (e, t) => {
|
|
142
142
|
let n = u[e], r = Array.isArray(n) ? n : [], i = r.includes(t) ? r.filter((e) => e !== t) : [...r, t];
|
|
143
|
-
|
|
144
|
-
},
|
|
143
|
+
f(e, i);
|
|
144
|
+
}, g = () => {
|
|
145
145
|
i(u), l(!1);
|
|
146
|
-
},
|
|
147
|
-
|
|
148
|
-
},
|
|
146
|
+
}, _ = () => {
|
|
147
|
+
d({}), i({}), l(!1);
|
|
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
|
-
|
|
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
|
-
children:
|
|
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) => {
|
|
195
|
-
|
|
195
|
+
f(e.key, t);
|
|
196
196
|
},
|
|
197
197
|
onToggleMultiSelect: (t) => {
|
|
198
|
-
|
|
198
|
+
p(e.key, t);
|
|
199
199
|
}
|
|
200
200
|
})]
|
|
201
201
|
}, e.key))]
|
|
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
|
-
onClick:
|
|
210
|
+
onClick: _,
|
|
211
211
|
children: s("filters.clear")
|
|
212
|
-
}), /* @__PURE__ */
|
|
212
|
+
}), /* @__PURE__ */ I(m, {
|
|
213
213
|
className: "flex-1",
|
|
214
|
-
onClick:
|
|
214
|
+
onClick: g,
|
|
215
215
|
children: s("filters.apply")
|
|
216
216
|
})]
|
|
217
217
|
})
|
|
@@ -221,28 +221,28 @@ function z({ 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 H({ 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,
|
|
@@ -267,48 +267,48 @@ function U({ options: e, value: t, onChange: n, variant: r = "solid" }) {
|
|
|
267
267
|
}
|
|
268
268
|
//#endregion
|
|
269
269
|
//#region src/components/core/filters/FiltersMobileDrawer.tsx
|
|
270
|
-
function
|
|
271
|
-
let { t:
|
|
272
|
-
return /* @__PURE__ */
|
|
273
|
-
open:
|
|
270
|
+
function Q({ children: e, activeFiltersCount: n = 0, onReset: a, onApply: l }) {
|
|
271
|
+
let { t: d } = t(), [p, h] = P(!1);
|
|
272
|
+
return /* @__PURE__ */ L(i, {
|
|
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__ */
|
|
282
|
-
|
|
283
|
-
n > 0 && /* @__PURE__ */
|
|
281
|
+
/* @__PURE__ */ I(V, { className: "h-4 w-4 mr-2" }),
|
|
282
|
+
d("filters.filter"),
|
|
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
|
},
|
|
310
310
|
className: "flex-1",
|
|
311
|
-
children:
|
|
311
|
+
children: d("actions.apply")
|
|
312
312
|
})
|
|
313
313
|
})]
|
|
314
314
|
})
|
|
@@ -317,41 +317,41 @@ function W({ children: e, activeFiltersCount: n = 0, onReset: a, onApply: f }) {
|
|
|
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
|
|
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 G({ 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);
|
|
@@ -374,7 +374,7 @@ function K({ searchQuery: e, onSearchChange: n, searchPlaceholder: r, filters: i
|
|
|
374
374
|
}, p = (e, t) => {
|
|
375
375
|
let n = { ...i }, r = n[e];
|
|
376
376
|
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);
|
|
377
|
-
}, m =
|
|
377
|
+
}, m = M(() => {
|
|
378
378
|
let e = [];
|
|
379
379
|
return o.forEach((t) => {
|
|
380
380
|
t.filters.forEach((t) => {
|
|
@@ -387,14 +387,14 @@ function K({ searchQuery: e, onSearchChange: n, searchPlaceholder: r, filters: i
|
|
|
387
387
|
});
|
|
388
388
|
});
|
|
389
389
|
}), e;
|
|
390
|
-
}, [o]), h =
|
|
390
|
+
}, [o]), h = M(() => {
|
|
391
391
|
let e = {};
|
|
392
392
|
return o.forEach((t) => {
|
|
393
393
|
t.filters.forEach((t) => {
|
|
394
394
|
e[t.key] = t.badgeLabelKey ?? t.labelKey;
|
|
395
395
|
});
|
|
396
396
|
}), e;
|
|
397
|
-
}, [o]), g =
|
|
397
|
+
}, [o]), g = M(() => {
|
|
398
398
|
let e = {};
|
|
399
399
|
return o.forEach((t) => {
|
|
400
400
|
t.filters.forEach((t) => {
|
|
@@ -404,20 +404,20 @@ function K({ searchQuery: e, onSearchChange: n, searchPlaceholder: r, filters: i
|
|
|
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 K({ searchQuery: e, onSearchChange: n, searchPlaceholder: r, filters: i
|
|
|
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,
|
|
@@ -454,4 +454,195 @@ function K({ searchQuery: e, onSearchChange: n, searchPlaceholder: r, filters: i
|
|
|
454
454
|
});
|
|
455
455
|
}
|
|
456
456
|
//#endregion
|
|
457
|
-
|
|
457
|
+
//#region src/components/core/filters/ConditionFilter.tsx
|
|
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
|
+
e && C(a === void 0 ? { value: "" } : { ...a }), b(e);
|
|
462
|
+
}, B = () => {
|
|
463
|
+
N && S.field !== void 0 && D !== void 0 && (o({
|
|
464
|
+
field: S.field,
|
|
465
|
+
operator: D.value,
|
|
466
|
+
value: k ? j : ""
|
|
467
|
+
}), b(!1));
|
|
468
|
+
}, V = () => {
|
|
469
|
+
o(void 0), b(!1);
|
|
470
|
+
}, H = h(s === void 0 ? "filters.condition.label" : s);
|
|
471
|
+
return /* @__PURE__ */ L(x, {
|
|
472
|
+
open: v,
|
|
473
|
+
onOpenChange: R,
|
|
474
|
+
children: [/* @__PURE__ */ I(_, {
|
|
475
|
+
asChild: !0,
|
|
476
|
+
children: /* @__PURE__ */ L("button", {
|
|
477
|
+
type: "button",
|
|
478
|
+
disabled: u,
|
|
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__ */ L("span", {
|
|
481
|
+
className: "flex min-w-0 items-center gap-1.5",
|
|
482
|
+
children: [c !== void 0 && /* @__PURE__ */ I(c, { className: "size-3.5 shrink-0 opacity-70" }), /* @__PURE__ */ I("span", {
|
|
483
|
+
className: "truncate",
|
|
484
|
+
children: a === void 0 ? H : /* @__PURE__ */ L(F, { children: [
|
|
485
|
+
H,
|
|
486
|
+
" :",
|
|
487
|
+
" ",
|
|
488
|
+
/* @__PURE__ */ I("span", {
|
|
489
|
+
className: "font-semibold",
|
|
490
|
+
children: w?.label ?? a.field
|
|
491
|
+
}),
|
|
492
|
+
" ",
|
|
493
|
+
T?.label ?? a.operator,
|
|
494
|
+
a.value !== "" && /* @__PURE__ */ L("span", {
|
|
495
|
+
className: "font-semibold",
|
|
496
|
+
children: [" ", a.value]
|
|
497
|
+
})
|
|
498
|
+
] })
|
|
499
|
+
})]
|
|
500
|
+
}), /* @__PURE__ */ L("span", {
|
|
501
|
+
className: "flex shrink-0 items-center gap-1",
|
|
502
|
+
children: [E && !u && /* @__PURE__ */ I("span", {
|
|
503
|
+
role: "button",
|
|
504
|
+
tabIndex: -1,
|
|
505
|
+
"aria-label": h("filters.condition.clear"),
|
|
506
|
+
onClick: (e) => {
|
|
507
|
+
e.stopPropagation();
|
|
508
|
+
},
|
|
509
|
+
onPointerDown: (e) => {
|
|
510
|
+
e.preventDefault(), e.stopPropagation(), o(void 0);
|
|
511
|
+
},
|
|
512
|
+
className: "opacity-70 hover:opacity-100",
|
|
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
|
+
})]
|
|
516
|
+
})
|
|
517
|
+
}), /* @__PURE__ */ L(y, {
|
|
518
|
+
align: "start",
|
|
519
|
+
className: "w-80 space-y-4",
|
|
520
|
+
children: [
|
|
521
|
+
/* @__PURE__ */ L("div", {
|
|
522
|
+
className: "space-y-1.5",
|
|
523
|
+
children: [/* @__PURE__ */ I(n, { children: h("filters.condition.field") }), /* @__PURE__ */ I(O, {
|
|
524
|
+
options: r,
|
|
525
|
+
value: S.field,
|
|
526
|
+
onChange: (e) => {
|
|
527
|
+
C((t) => ({
|
|
528
|
+
...t,
|
|
529
|
+
field: e
|
|
530
|
+
}));
|
|
531
|
+
},
|
|
532
|
+
placeholder: h("filters.condition.selectField")
|
|
533
|
+
})]
|
|
534
|
+
}),
|
|
535
|
+
/* @__PURE__ */ L("div", {
|
|
536
|
+
className: "space-y-1.5",
|
|
537
|
+
children: [/* @__PURE__ */ I(n, { children: h("filters.condition.operator") }), /* @__PURE__ */ I(d, {
|
|
538
|
+
type: "single",
|
|
539
|
+
variant: "outline",
|
|
540
|
+
size: "sm",
|
|
541
|
+
className: "flex-wrap justify-start",
|
|
542
|
+
value: S.operator ?? "",
|
|
543
|
+
onValueChange: (e) => {
|
|
544
|
+
C((t) => {
|
|
545
|
+
let n = i.find((t) => t.value === e)?.numeric !== !0 || !Number.isNaN(Number(t.value.trim()));
|
|
546
|
+
return {
|
|
547
|
+
...t,
|
|
548
|
+
operator: e === "" ? void 0 : e,
|
|
549
|
+
value: n ? t.value : ""
|
|
550
|
+
};
|
|
551
|
+
});
|
|
552
|
+
},
|
|
553
|
+
children: i.map((e) => /* @__PURE__ */ I(l, {
|
|
554
|
+
value: e.value,
|
|
555
|
+
title: e.title,
|
|
556
|
+
"aria-label": e.title ?? e.label,
|
|
557
|
+
className: "min-w-9 px-2",
|
|
558
|
+
children: e.label
|
|
559
|
+
}, e.value))
|
|
560
|
+
})]
|
|
561
|
+
}),
|
|
562
|
+
k && /* @__PURE__ */ L("div", {
|
|
563
|
+
className: "space-y-1.5",
|
|
564
|
+
children: [
|
|
565
|
+
/* @__PURE__ */ I(n, {
|
|
566
|
+
htmlFor: "condition-filter-value",
|
|
567
|
+
children: h("filters.condition.value")
|
|
568
|
+
}),
|
|
569
|
+
/* @__PURE__ */ I(g, {
|
|
570
|
+
id: "condition-filter-value",
|
|
571
|
+
value: S.value,
|
|
572
|
+
type: A ? "number" : "text",
|
|
573
|
+
step: "any",
|
|
574
|
+
onChange: (e) => {
|
|
575
|
+
C((t) => ({
|
|
576
|
+
...t,
|
|
577
|
+
value: e.target.value
|
|
578
|
+
}));
|
|
579
|
+
},
|
|
580
|
+
onKeyDown: (e) => {
|
|
581
|
+
e.key === "Enter" && (e.preventDefault(), B());
|
|
582
|
+
}
|
|
583
|
+
}),
|
|
584
|
+
" "
|
|
585
|
+
]
|
|
586
|
+
}),
|
|
587
|
+
/* @__PURE__ */ L("div", {
|
|
588
|
+
className: "flex justify-end gap-2",
|
|
589
|
+
children: [E && /* @__PURE__ */ I(m, {
|
|
590
|
+
variant: "ghost",
|
|
591
|
+
size: "sm",
|
|
592
|
+
onClick: V,
|
|
593
|
+
children: h("filters.condition.clear")
|
|
594
|
+
}), /* @__PURE__ */ I(m, {
|
|
595
|
+
size: "sm",
|
|
596
|
+
onClick: B,
|
|
597
|
+
disabled: !N,
|
|
598
|
+
children: h("filters.condition.apply")
|
|
599
|
+
})]
|
|
600
|
+
})
|
|
601
|
+
]
|
|
602
|
+
})]
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
//#endregion
|
|
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 };
|