@krosoft/react 0.0.329 → 0.0.331
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-CqK8g-ry.js} +2 -2
- package/dist/{AppSubTitle-Fqo3lk2A.js → AppSubTitle-ByOiQg8S.js} +2 -2
- package/dist/{AppTitle-CK5tYl7t.js → AppTitle-I4yLJGmv.js} +1 -1
- package/dist/{ErrorAlert-B9xG4dAD.js → ErrorAlert-NmwmpbVN.js} +1 -1
- package/dist/{GenericForm-BOoNPBx5.js → GenericForm-DI6udL1l.js} +6 -6
- package/dist/{ImageInput-BESvVwnK.js → ImageInput-DTNsRZaT.js} +2 -2
- package/dist/{MultiSelect-DQX1rk-t.js → MultiSelect-C7d047Y9.js} +3 -3
- package/dist/{SearchInput-BFh0o1RM.js → SearchInput-7uYKK54l.js} +4 -4
- package/dist/{behavior-B1Zn_N2M.js → behavior-BcXL-ZOv.js} +1 -1
- package/dist/{cards-OMWaiu9p.js → cards-cB4kYZpQ.js} +2 -2
- package/dist/{charts-NxoXrN5w.js → charts-CHWqB53l.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/index.d.ts +1 -0
- package/dist/components/core/filters/index.d.ts.map +1 -1
- package/dist/components/core/filters/index.js +273 -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-CeB4q0UB.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 +18 -0
- package/dist/i18n/krosoftLocales.d.ts.map +1 -1
- package/dist/{i18n-BuQgyJAA.js → i18n-CmJWr9V5.js} +20 -2
- package/dist/{inputs-BpZ4hAO1.js → inputs-BiMbj0lF.js} +4 -4
- package/dist/{language-CK1Toh4q.js → language-NFREv4sJ.js} +2 -2
- package/dist/{navbar-uE-TcuY6.js → navbar-CFV6_0Q8.js} +3 -3
- package/dist/pwa/index.js +1 -1
- package/dist/{sheet-BtfL6yxE.js → sheet-0N3ZYjHb.js} +1 -1
- package/dist/{states-lmDbJIGj.js → states-B45Wppt5.js} +2 -2
- package/dist/{theme-nG-VcChv.js → theme-BH6YyXQP.js} +2 -2
- package/dist/{ui-yvfaMQwo.js → ui-CB_byKCw.js} +1 -1
- package/dist/{ui-pTlOByAk.js → ui-DOXKkmS3.js} +3 -3
- package/dist/{useDocumentTitle-Dwdvj0Cq.js → useDocumentTitle-C50DpJU1.js} +1 -1
- package/dist/{useLanguage-COBm8fDW.js → useLanguage-B__JHFZi.js} +1 -1
- package/dist/{useTheme-DnfZqWof.js → useTheme-C8wQV332.js} +1 -1
- package/package.json +2 -2
|
@@ -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-CmJWr9V5.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-CB_byKCw.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-0N3ZYjHb.js";
|
|
6
|
+
import { t as T } from "../../../useMobile-pTQ8lWvt.js";
|
|
7
|
+
import { t as E } from "../../../MultiSelect-C7d047Y9.js";
|
|
8
|
+
import { i as D, n as O, r as k, t as A } from "../../../SearchInput-7uYKK54l.js";
|
|
9
|
+
import "../../../ui-DOXKkmS3.js";
|
|
10
|
+
import { useEffect as j, useMemo as M, useState as N } from "react";
|
|
11
|
+
import { Fragment as P, jsx as F, jsxs as I } from "react/jsx-runtime";
|
|
12
|
+
import { getLocale as L } from "@krosoft/core/helpers";
|
|
13
|
+
import { ChevronDownIcon as R, Filter as z, FilterIcon as B, FilterXIcon as V, XIcon as H } from "lucide-react";
|
|
14
14
|
//#region src/components/core/filters/ActiveFilters.tsx
|
|
15
|
-
var
|
|
16
|
-
if (t instanceof Date) return t.toLocaleDateString(
|
|
15
|
+
var U = (e, t, n, r = {}) => {
|
|
16
|
+
if (t instanceof Date) return t.toLocaleDateString(L());
|
|
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 W({ 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__ */ I("div", {
|
|
23
23
|
className: "flex flex-wrap items-center gap-2 mb-4",
|
|
24
24
|
children: [
|
|
25
|
-
/* @__PURE__ */
|
|
25
|
+
/* @__PURE__ */ F("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 = U(e, t, s, o);
|
|
33
|
+
return /* @__PURE__ */ I(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__ */ F("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__ */ F(H, { className: "size-4" })
|
|
46
46
|
})
|
|
47
47
|
]
|
|
48
48
|
}, `${e}_${String(t)}`);
|
|
49
49
|
});
|
|
50
|
-
let l =
|
|
51
|
-
return /* @__PURE__ */
|
|
50
|
+
let l = U(e, t, s, o);
|
|
51
|
+
return /* @__PURE__ */ I(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__ */ F("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__ */ F(H, { className: "size-4" })
|
|
64
64
|
})
|
|
65
65
|
]
|
|
66
66
|
}, e);
|
|
67
67
|
}),
|
|
68
|
-
c.length > 0 && /* @__PURE__ */
|
|
68
|
+
c.length > 0 && /* @__PURE__ */ F("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 G = ({ 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__ */ F(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__ */ F(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__ */ F(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__ */ F(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__ */ F(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__ */ F(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
|
+
}, K = (e) => !(e == null || e === "" || Array.isArray(e) && e.length === 0);
|
|
131
|
+
function q({ sections: e, filters: r, onFiltersChange: i, buttonText: a, sheetTitle: o }) {
|
|
132
|
+
let { t: s } = t(), [c, l] = N(!1), [u, d] = N(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) && K(n)).length;
|
|
151
151
|
}, [e, r]);
|
|
152
|
-
return /* @__PURE__ */
|
|
152
|
+
return /* @__PURE__ */ I(C, {
|
|
153
153
|
open: c,
|
|
154
154
|
onOpenChange: l,
|
|
155
|
-
children: [/* @__PURE__ */
|
|
155
|
+
children: [/* @__PURE__ */ F(w, {
|
|
156
156
|
asChild: !0,
|
|
157
|
-
children: /* @__PURE__ */
|
|
157
|
+
children: /* @__PURE__ */ I(m, {
|
|
158
158
|
variant: "outline",
|
|
159
159
|
className: "gap-2",
|
|
160
160
|
children: [
|
|
161
|
-
/* @__PURE__ */
|
|
161
|
+
/* @__PURE__ */ F(z, { className: "size-4 shrink-0" }),
|
|
162
162
|
a ?? s("filters.more"),
|
|
163
|
-
|
|
163
|
+
y > 0 && /* @__PURE__ */ F("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__ */ I(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__ */ F(b, {
|
|
174
174
|
className: "p-6 pb-0",
|
|
175
|
-
children: /* @__PURE__ */
|
|
175
|
+
children: /* @__PURE__ */ F(v, { children: o ?? s("filters.advanced") })
|
|
176
176
|
}),
|
|
177
|
-
/* @__PURE__ */
|
|
177
|
+
/* @__PURE__ */ F("div", {
|
|
178
178
|
className: "flex-1 overflow-y-auto p-6 pt-6",
|
|
179
|
-
children: /* @__PURE__ */
|
|
179
|
+
children: /* @__PURE__ */ F("div", {
|
|
180
180
|
className: "space-y-6",
|
|
181
|
-
children: e.map((e, t) => /* @__PURE__ */
|
|
181
|
+
children: e.map((e, t) => /* @__PURE__ */ I("div", {
|
|
182
182
|
className: "space-y-4",
|
|
183
|
-
children: [/* @__PURE__ */
|
|
183
|
+
children: [/* @__PURE__ */ F("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__ */ I("div", {
|
|
187
187
|
className: "space-y-2",
|
|
188
|
-
children: [/* @__PURE__ */
|
|
188
|
+
children: [/* @__PURE__ */ F(n, {
|
|
189
189
|
htmlFor: e.key,
|
|
190
190
|
children: s(e.labelKey)
|
|
191
|
-
}), /* @__PURE__ */
|
|
191
|
+
}), /* @__PURE__ */ F(G, {
|
|
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__ */ I(h, {
|
|
206
206
|
className: "gap-2 p-6 border-t bg-background",
|
|
207
|
-
children: [/* @__PURE__ */
|
|
207
|
+
children: [/* @__PURE__ */ F(m, {
|
|
208
208
|
variant: "outline",
|
|
209
209
|
className: "flex-1",
|
|
210
|
-
onClick:
|
|
210
|
+
onClick: _,
|
|
211
211
|
children: s("filters.clear")
|
|
212
|
-
}), /* @__PURE__ */
|
|
212
|
+
}), /* @__PURE__ */ F(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 J = {
|
|
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 Y(t, n, r) {
|
|
229
|
+
return r === void 0 ? t ? J[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 X({ options: t, values: n, onToggle: r, variant: i = "solid" }) {
|
|
232
|
+
return /* @__PURE__ */ F("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 = Y(n.includes(t), i, c);
|
|
236
|
+
return /* @__PURE__ */ I("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__ */ F(s, { className: "size-3 shrink-0" }),
|
|
243
243
|
a,
|
|
244
244
|
" ",
|
|
245
|
-
o !== void 0 && /* @__PURE__ */
|
|
245
|
+
o !== void 0 && /* @__PURE__ */ I("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 Z({ options: e, value: t, onChange: n, variant: r = "solid" }) {
|
|
261
|
+
return /* @__PURE__ */ F(X, {
|
|
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] = N(!1);
|
|
272
|
+
return /* @__PURE__ */ I(i, {
|
|
273
|
+
open: p,
|
|
274
274
|
onOpenChange: h,
|
|
275
|
-
children: [/* @__PURE__ */
|
|
275
|
+
children: [/* @__PURE__ */ F(f, {
|
|
276
276
|
asChild: !0,
|
|
277
|
-
children: /* @__PURE__ */
|
|
277
|
+
children: /* @__PURE__ */ I(m, {
|
|
278
278
|
variant: "outline",
|
|
279
279
|
className: "relative",
|
|
280
280
|
children: [
|
|
281
|
-
/* @__PURE__ */
|
|
282
|
-
|
|
283
|
-
n > 0 && /* @__PURE__ */
|
|
281
|
+
/* @__PURE__ */ F(B, { className: "h-4 w-4 mr-2" }),
|
|
282
|
+
d("filters.filter"),
|
|
283
|
+
n > 0 && /* @__PURE__ */ F("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__ */ I(r, { children: [
|
|
290
|
+
/* @__PURE__ */ F(s, { children: /* @__PURE__ */ F(c, { children: d("filters.title") }) }),
|
|
291
|
+
/* @__PURE__ */ F("div", {
|
|
292
292
|
className: "flex flex-col gap-4 px-4 pb-4",
|
|
293
293
|
children: e
|
|
294
294
|
}),
|
|
295
|
-
/* @__PURE__ */
|
|
295
|
+
/* @__PURE__ */ I(o, {
|
|
296
296
|
className: "flex-row gap-2",
|
|
297
|
-
children: [/* @__PURE__ */
|
|
297
|
+
children: [/* @__PURE__ */ I(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__ */ F(V, { className: "h-4 w-4 mr-2" }), d("filters.reset")]
|
|
304
|
+
}), /* @__PURE__ */ F(u, {
|
|
305
305
|
asChild: !0,
|
|
306
|
-
children: /* @__PURE__ */
|
|
306
|
+
children: /* @__PURE__ */ F(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 $({ 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__ */ I("div", {
|
|
323
323
|
className: "flex items-center gap-2",
|
|
324
|
-
children: [o !== void 0 && /* @__PURE__ */
|
|
324
|
+
children: [o !== void 0 && /* @__PURE__ */ F("div", {
|
|
325
325
|
className: "flex-1",
|
|
326
|
-
children: /* @__PURE__ */
|
|
326
|
+
children: /* @__PURE__ */ F(A, {
|
|
327
327
|
search: n ?? "",
|
|
328
328
|
onSearch: o,
|
|
329
329
|
placeholder: r
|
|
330
330
|
})
|
|
331
|
-
}), /* @__PURE__ */
|
|
331
|
+
}), /* @__PURE__ */ F(Q, {
|
|
332
332
|
activeFiltersCount: i,
|
|
333
333
|
onReset: a,
|
|
334
334
|
children: e
|
|
335
335
|
})]
|
|
336
|
-
}) : /* @__PURE__ */
|
|
336
|
+
}) : /* @__PURE__ */ I("div", {
|
|
337
337
|
className: "flex justify-between",
|
|
338
|
-
children: [/* @__PURE__ */
|
|
338
|
+
children: [/* @__PURE__ */ I("div", {
|
|
339
339
|
className: "flex flex-wrap gap-2",
|
|
340
|
-
children: [o !== void 0 && /* @__PURE__ */
|
|
340
|
+
children: [o !== void 0 && /* @__PURE__ */ F(A, {
|
|
341
341
|
search: n ?? "",
|
|
342
342
|
onSearch: o,
|
|
343
343
|
placeholder: r
|
|
344
344
|
}), e]
|
|
345
|
-
}), a && /* @__PURE__ */
|
|
345
|
+
}), a && /* @__PURE__ */ F("div", {
|
|
346
346
|
className: "flex flex-wrap gap-4",
|
|
347
|
-
children: /* @__PURE__ */
|
|
347
|
+
children: /* @__PURE__ */ I(m, {
|
|
348
348
|
variant: "outline",
|
|
349
349
|
onClick: a,
|
|
350
350
|
className: "relative",
|
|
351
351
|
children: [
|
|
352
|
-
/* @__PURE__ */
|
|
352
|
+
/* @__PURE__ */ F(V, {}),
|
|
353
353
|
s("filters.reset"),
|
|
354
|
-
i > 0 && /* @__PURE__ */
|
|
354
|
+
i > 0 && /* @__PURE__ */ F("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 ee({ 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__ */ I("div", {
|
|
408
408
|
className: "space-y-4 w-full",
|
|
409
|
-
children: [/* @__PURE__ */
|
|
409
|
+
children: [/* @__PURE__ */ I("div", {
|
|
410
410
|
className: "flex flex-wrap items-center gap-2 justify-between",
|
|
411
|
-
children: [/* @__PURE__ */
|
|
411
|
+
children: [/* @__PURE__ */ I("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__ */ F(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__ */ F(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__ */ F(q, {
|
|
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__ */ F(W, {
|
|
448
448
|
filters: i,
|
|
449
449
|
onRemoveFilter: p,
|
|
450
450
|
onClearAll: f,
|
|
@@ -454,4 +454,153 @@ 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 te = (e) => e?.requiresValue !== !1;
|
|
459
|
+
function ne({ fields: r, operators: i, value: a, onChange: o, labelKey: s, icon: c, disabled: u = !1, className: f }) {
|
|
460
|
+
let { t: h } = t(), [v, b] = N(!1), [S, C] = N({ 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 = te(D), A = D?.numeric === !0, j = S.value.trim(), M = k && A && j !== "" && Number.isNaN(Number(j)), L = S.field !== void 0 && D !== void 0 && (!k || j !== "") && !M, z = (e) => {
|
|
461
|
+
e && C(a === void 0 ? { value: "" } : { ...a }), b(e);
|
|
462
|
+
}, B = () => {
|
|
463
|
+
L && 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
|
+
}, U = h(s === void 0 ? "filters.condition.label" : s);
|
|
471
|
+
return /* @__PURE__ */ I(x, {
|
|
472
|
+
open: v,
|
|
473
|
+
onOpenChange: z,
|
|
474
|
+
children: [/* @__PURE__ */ F(_, {
|
|
475
|
+
asChild: !0,
|
|
476
|
+
children: /* @__PURE__ */ I("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__ */ I("span", {
|
|
481
|
+
className: "flex min-w-0 items-center gap-1.5",
|
|
482
|
+
children: [c !== void 0 && /* @__PURE__ */ F(c, { className: "size-3.5 shrink-0 opacity-70" }), /* @__PURE__ */ F("span", {
|
|
483
|
+
className: "truncate",
|
|
484
|
+
children: a === void 0 ? U : /* @__PURE__ */ I(P, { children: [
|
|
485
|
+
U,
|
|
486
|
+
" :",
|
|
487
|
+
" ",
|
|
488
|
+
/* @__PURE__ */ F("span", {
|
|
489
|
+
className: "font-semibold",
|
|
490
|
+
children: w?.label ?? a.field
|
|
491
|
+
}),
|
|
492
|
+
" ",
|
|
493
|
+
T?.label ?? a.operator,
|
|
494
|
+
a.value !== "" && /* @__PURE__ */ I("span", {
|
|
495
|
+
className: "font-semibold",
|
|
496
|
+
children: [" ", a.value]
|
|
497
|
+
})
|
|
498
|
+
] })
|
|
499
|
+
})]
|
|
500
|
+
}), /* @__PURE__ */ I("span", {
|
|
501
|
+
className: "flex shrink-0 items-center gap-1",
|
|
502
|
+
children: [E && !u && /* @__PURE__ */ F("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__ */ F(H, { className: "size-3.5" })
|
|
514
|
+
}), /* @__PURE__ */ F(R, { className: e("size-3.5 opacity-60 transition-transform", v && "rotate-180") })]
|
|
515
|
+
})]
|
|
516
|
+
})
|
|
517
|
+
}), /* @__PURE__ */ I(y, {
|
|
518
|
+
align: "start",
|
|
519
|
+
className: "w-80 space-y-4",
|
|
520
|
+
children: [
|
|
521
|
+
/* @__PURE__ */ I("div", {
|
|
522
|
+
className: "space-y-1.5",
|
|
523
|
+
children: [/* @__PURE__ */ F(n, { children: h("filters.condition.field") }), /* @__PURE__ */ F(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__ */ I("div", {
|
|
536
|
+
className: "space-y-1.5",
|
|
537
|
+
children: [/* @__PURE__ */ F(n, { children: h("filters.condition.operator") }), /* @__PURE__ */ F(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__ */ F(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__ */ I("div", {
|
|
563
|
+
className: "space-y-1.5",
|
|
564
|
+
children: [
|
|
565
|
+
/* @__PURE__ */ F(n, {
|
|
566
|
+
htmlFor: "condition-filter-value",
|
|
567
|
+
children: h("filters.condition.value")
|
|
568
|
+
}),
|
|
569
|
+
/* @__PURE__ */ F(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__ */ I("div", {
|
|
588
|
+
className: "flex justify-end gap-2",
|
|
589
|
+
children: [E && /* @__PURE__ */ F(m, {
|
|
590
|
+
variant: "ghost",
|
|
591
|
+
size: "sm",
|
|
592
|
+
onClick: V,
|
|
593
|
+
children: h("filters.condition.clear")
|
|
594
|
+
}), /* @__PURE__ */ F(m, {
|
|
595
|
+
size: "sm",
|
|
596
|
+
onClick: B,
|
|
597
|
+
disabled: !L,
|
|
598
|
+
children: h("filters.condition.apply")
|
|
599
|
+
})]
|
|
600
|
+
})
|
|
601
|
+
]
|
|
602
|
+
})]
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
//#endregion
|
|
606
|
+
export { W as ActiveFilters, q as AdvancedFilters, ne as ConditionFilter, G as FilterField, Z as FilterPills, X as FilterPillsGroup, $ as FiltersContainer, Q as FiltersMobileDrawer, ee as TableFilter };
|