@krosoft/react 0.0.218 → 0.0.219
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/README.md +31 -0
- package/dist/{AppActions-BCXERyyB.js → AppActions-BFmagl91.js} +1 -1
- package/dist/{AppSubTitle-H8ElNObI.js → AppSubTitle-BMQMoehZ.js} +1 -1
- package/dist/AppVerticalTabs-0DrrDO3S.js +101 -0
- package/dist/{ConfirmationDialog-BmxaMEYz.js → ConfirmationDialog-CFsh-Eui.js} +62 -61
- package/dist/DataTable-Cpbp6yse.js +551 -0
- package/dist/ErrorAlert-D_203tKa.js +21 -0
- package/dist/ErrorState-DfJ009uc.js +12 -0
- package/dist/GenericForm-q9dvYl_h.js +342 -0
- package/dist/ImageInput-BYXz8wM1.js +68 -0
- package/dist/{KpiCardsLayout-XZTxB8FV.js → KpiCardsLayout-B-lMaUMA.js} +4 -4
- package/dist/{MultiSelect-Cj8vgAXJ.js → MultiSelect-Dkz1dgXo.js} +52 -51
- package/dist/{PieChart-D6y5EQnh.js → PieChart-bDy_V9Xt.js} +82 -81
- package/dist/SearchInput-CJ2YZpmB.js +244 -0
- package/dist/{SkeletonCards-CYo_lvKx.js → SkeletonCards-Bg2ygjwy.js} +1 -1
- package/dist/{TableFilter-DbnGaGKL.js → TableFilter-u6F06nMx.js} +133 -130
- package/dist/ThemeSelector-BRpEgvX8.js +49 -0
- package/dist/Topbar-bIyAunNd.js +318 -0
- package/dist/components/core/cards/index.js +1 -1
- package/dist/components/core/charts/ChartCard.d.ts.map +1 -1
- package/dist/components/core/charts/index.js +1 -1
- package/dist/components/core/dialogs/FormDialog.d.ts.map +1 -1
- package/dist/components/core/dialogs/index.js +2 -2
- package/dist/components/core/filters/ActiveFilters.d.ts.map +1 -1
- package/dist/components/core/filters/AdvancedFilters.d.ts.map +1 -1
- package/dist/components/core/filters/FilterField.d.ts.map +1 -1
- package/dist/components/core/filters/SearchableFilterPill.d.ts.map +1 -1
- package/dist/components/core/filters/TableFilter.d.ts.map +1 -1
- package/dist/components/core/filters/index.js +1 -1
- package/dist/components/core/forms/GenericForm.d.ts.map +1 -1
- package/dist/components/core/forms/index.js +1 -1
- package/dist/components/core/index.js +18 -18
- package/dist/components/core/inputs/DateRangePicker.d.ts.map +1 -1
- package/dist/components/core/inputs/ImageInput.d.ts.map +1 -1
- package/dist/components/core/inputs/MultiSelect.d.ts.map +1 -1
- package/dist/components/core/inputs/SearchInput.d.ts +1 -1
- package/dist/components/core/inputs/SearchInput.d.ts.map +1 -1
- package/dist/components/core/inputs/SearchableSelect.d.ts.map +1 -1
- package/dist/components/core/inputs/index.js +3 -3
- package/dist/components/core/layouts/index.js +3 -3
- package/dist/components/core/navbar/GlobalSearch.d.ts.map +1 -1
- package/dist/components/core/navbar/Sidebar.d.ts.map +1 -1
- package/dist/components/core/navbar/index.js +1 -1
- package/dist/components/core/states/ErrorAlert.d.ts.map +1 -1
- package/dist/components/core/states/ErrorState.d.ts.map +1 -1
- package/dist/components/core/states/index.js +2 -2
- package/dist/components/core/table/DataTable.d.ts.map +1 -1
- package/dist/components/core/table/TableBody.d.ts +1 -1
- package/dist/components/core/table/TableBody.d.ts.map +1 -1
- package/dist/components/core/table/TablePagination.d.ts.map +1 -1
- package/dist/components/core/table/index.js +1 -1
- package/dist/components/core/tabs/AppVerticalTabs.d.ts.map +1 -1
- package/dist/components/core/tabs/index.js +1 -1
- package/dist/components/core/theme/ThemeSelector.d.ts.map +1 -1
- package/dist/components/core/theme/index.js +1 -1
- package/dist/components/index.js +18 -18
- package/dist/components/ui/command.d.ts.map +1 -1
- package/dist/components/ui/index.js +1 -1
- package/dist/hooks/behavior/index.js +1 -1
- package/dist/hooks/behavior/useConfirmDeleteDialog.d.ts +1 -1
- package/dist/hooks/behavior/useConfirmDeleteDialog.d.ts.map +1 -1
- package/dist/hooks/index.js +2 -2
- package/dist/hooks/ui/index.js +1 -1
- package/dist/hooks/ui/useTheme.d.ts.map +1 -1
- package/dist/i18n/index.d.ts +3 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +7 -0
- package/dist/i18n/krosoftLocales.d.ts +175 -0
- package/dist/i18n/krosoftLocales.d.ts.map +1 -0
- package/dist/i18n/useKrosoftTranslation.d.ts +15 -0
- package/dist/i18n/useKrosoftTranslation.d.ts.map +1 -0
- package/dist/providers/index.js +1 -1
- package/dist/{sheet-BQmtrGf2.js → sheet-CDqLa-FP.js} +105 -108
- package/dist/useKrosoftTranslation-DdcylBY2.js +43 -0
- package/dist/usePage-Bhb81ffo.js +82 -0
- package/dist/useTheme-Cmw14Zxi.js +25 -0
- package/package.json +1 -1
- package/dist/AppVerticalTabs-aJmAVu6F.js +0 -100
- package/dist/DataTable-0-lae9KY.js +0 -550
- package/dist/ErrorAlert-SrIcU1mM.js +0 -17
- package/dist/ErrorState-CmaxuJyW.js +0 -8
- package/dist/GenericForm-DJR7PD-i.js +0 -341
- package/dist/ImageInput-DYe2XPNZ.js +0 -67
- package/dist/SearchInput-oeq0NBIc.js +0 -251
- package/dist/ThemeSelector-BFC37dSl.js +0 -48
- package/dist/Topbar-DUq-UeR0.js +0 -306
- package/dist/usePage-BFE9lxI1.js +0 -84
- package/dist/useTheme-CSr_h5xJ.js +0 -24
|
@@ -1,109 +1,112 @@
|
|
|
1
1
|
import { jsxs as u, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { u as w } from "./useKrosoftTranslation-DdcylBY2.js";
|
|
3
|
+
import { useState as C, useEffect as O, useMemo as S } from "react";
|
|
4
|
+
import { a as z, D as I, b as $, S as B } from "./SearchInput-CJ2YZpmB.js";
|
|
5
|
+
import { getLocale as Q } from "@krosoft/core/helpers";
|
|
6
|
+
import { B as E, aw as V, b0 as _, b2 as R, b1 as H, E as P } from "./toggle-group-DLLrEwv2.js";
|
|
5
7
|
import "./alert-B9F1N9Qk.js";
|
|
6
8
|
import "@radix-ui/react-aspect-ratio";
|
|
7
|
-
import { B as
|
|
9
|
+
import { B as F, e as K } from "./tooltip-DVeqVwqV.js";
|
|
8
10
|
import "./chart-DntJZGxB.js";
|
|
9
11
|
import "@radix-ui/react-collapsible";
|
|
10
|
-
import { I as
|
|
11
|
-
import { XIcon as
|
|
12
|
+
import { I as L, S as X, z as G, s as J, v as U, y as W, u as Y } from "./sheet-CDqLa-FP.js";
|
|
13
|
+
import { XIcon as T, Filter as Z, ChevronDown as q, Search as ee } from "lucide-react";
|
|
12
14
|
import "react-resizable-panels";
|
|
13
15
|
import "clsx";
|
|
14
16
|
import "tailwind-merge";
|
|
15
|
-
import { S as
|
|
17
|
+
import { S as re, h as te, i as le, a as ae, c as se } from "./select-BpjFWqAY.js";
|
|
16
18
|
import "next-themes";
|
|
17
19
|
import "sonner";
|
|
18
|
-
import { c as
|
|
19
|
-
import { M as
|
|
20
|
-
const
|
|
20
|
+
import { c as j } from "./tailwind.helper-B6yFEsav.js";
|
|
21
|
+
import { M as ne } from "./MultiSelect-Dkz1dgXo.js";
|
|
22
|
+
const D = (a, n, c, i = {}) => {
|
|
21
23
|
if (n instanceof Date)
|
|
22
|
-
return n.toLocaleDateString(
|
|
23
|
-
const
|
|
24
|
-
return
|
|
24
|
+
return n.toLocaleDateString(Q());
|
|
25
|
+
const d = String(n), o = i[`${a}_${d}`];
|
|
26
|
+
return o !== void 0 ? o : a.includes("ok") || n === "true" || n === "false" ? c(n === "true" ? "filters.yes" : "filters.no") : d;
|
|
25
27
|
};
|
|
26
|
-
function
|
|
27
|
-
const o = Object.entries(a).filter(([
|
|
28
|
-
return
|
|
28
|
+
function ce({ filters: a, onRemoveFilter: n, onClearAll: c, filterLabels: i = {}, optionLabels: d = {} }) {
|
|
29
|
+
const { t: o } = w(), h = Object.entries(a).filter(([p, m]) => !(m == null || m === "" || Array.isArray(m) && m.length === 0));
|
|
30
|
+
return h.length === 0 ? null : /* @__PURE__ */ u("div", { className: "flex flex-wrap items-center gap-2 mb-4", children: [
|
|
29
31
|
/* @__PURE__ */ r("span", { className: "text-sm text-gray-600 font-medium", children: "Filtres actifs :" }),
|
|
30
|
-
|
|
31
|
-
const b = i[
|
|
32
|
+
h.flatMap(([p, m]) => {
|
|
33
|
+
const b = i[p] ?? p;
|
|
32
34
|
if (Array.isArray(m))
|
|
33
|
-
return m.map((
|
|
34
|
-
const
|
|
35
|
+
return m.map((y) => {
|
|
36
|
+
const f = D(p, y, o, d);
|
|
35
37
|
return /* @__PURE__ */ u(
|
|
36
|
-
|
|
38
|
+
E,
|
|
37
39
|
{
|
|
38
40
|
variant: "secondary",
|
|
39
41
|
className: "flex items-center gap-1 px-3 py-1 bg-blue-50 text-blue-700 border border-blue-200 hover:bg-blue-100",
|
|
40
42
|
children: [
|
|
41
43
|
b,
|
|
42
44
|
": ",
|
|
43
|
-
|
|
45
|
+
f,
|
|
44
46
|
/* @__PURE__ */ r(
|
|
45
47
|
"button",
|
|
46
48
|
{
|
|
47
49
|
onClick: () => {
|
|
48
|
-
n(
|
|
50
|
+
n(p, y);
|
|
49
51
|
},
|
|
50
52
|
className: "ml-1 hover:bg-blue-200 rounded-full p-0.5",
|
|
51
|
-
children: /* @__PURE__ */ r(
|
|
53
|
+
children: /* @__PURE__ */ r(T, { className: "size-4" })
|
|
52
54
|
}
|
|
53
55
|
)
|
|
54
56
|
]
|
|
55
57
|
},
|
|
56
|
-
`${
|
|
58
|
+
`${p}_${String(y)}`
|
|
57
59
|
);
|
|
58
60
|
});
|
|
59
|
-
const
|
|
60
|
-
return /* @__PURE__ */ u(
|
|
61
|
+
const x = D(p, m, o, d);
|
|
62
|
+
return /* @__PURE__ */ u(E, { variant: "secondary", className: "flex items-center gap-1 px-3 py-1 bg-blue-50 text-blue-700 border border-blue-200 hover:bg-blue-100", children: [
|
|
61
63
|
b,
|
|
62
64
|
": ",
|
|
63
|
-
|
|
65
|
+
x,
|
|
64
66
|
/* @__PURE__ */ r(
|
|
65
67
|
"button",
|
|
66
68
|
{
|
|
67
69
|
onClick: () => {
|
|
68
|
-
n(
|
|
70
|
+
n(p);
|
|
69
71
|
},
|
|
70
72
|
className: "ml-1 hover:bg-blue-200 rounded-full p-0.5",
|
|
71
|
-
children: /* @__PURE__ */ r(
|
|
73
|
+
children: /* @__PURE__ */ r(T, { className: "size-4" })
|
|
72
74
|
}
|
|
73
75
|
)
|
|
74
|
-
] },
|
|
76
|
+
] }, p);
|
|
75
77
|
}),
|
|
76
|
-
|
|
78
|
+
h.length > 0 && /* @__PURE__ */ r("button", { onClick: c, className: "text-xs text-red-500 hover:text-red-600 transition-colors font-medium ml-auto", children: "Effacer tout" })
|
|
77
79
|
] });
|
|
78
80
|
}
|
|
79
|
-
const
|
|
81
|
+
const oe = ({
|
|
80
82
|
field: a,
|
|
81
83
|
value: n,
|
|
82
84
|
onChange: c,
|
|
83
85
|
onToggleMultiSelect: i
|
|
84
86
|
}) => {
|
|
85
|
-
var
|
|
87
|
+
var o;
|
|
88
|
+
const { t: d } = w();
|
|
86
89
|
switch (a.type) {
|
|
87
90
|
case "text":
|
|
88
91
|
return /* @__PURE__ */ r(
|
|
89
|
-
|
|
92
|
+
L,
|
|
90
93
|
{
|
|
91
94
|
placeholder: a.placeholder,
|
|
92
95
|
value: n ?? "",
|
|
93
|
-
onChange: (
|
|
94
|
-
c(
|
|
96
|
+
onChange: (h) => {
|
|
97
|
+
c(h.target.value);
|
|
95
98
|
}
|
|
96
99
|
}
|
|
97
100
|
);
|
|
98
101
|
case "number":
|
|
99
102
|
return /* @__PURE__ */ r(
|
|
100
|
-
|
|
103
|
+
L,
|
|
101
104
|
{
|
|
102
105
|
type: "number",
|
|
103
106
|
placeholder: a.placeholder,
|
|
104
107
|
value: n ?? "",
|
|
105
|
-
onChange: (
|
|
106
|
-
c(
|
|
108
|
+
onChange: (h) => {
|
|
109
|
+
c(h.target.value);
|
|
107
110
|
},
|
|
108
111
|
min: a.min,
|
|
109
112
|
max: a.max
|
|
@@ -111,7 +114,7 @@ const se = ({
|
|
|
111
114
|
);
|
|
112
115
|
case "select":
|
|
113
116
|
return a.searchable === !0 ? /* @__PURE__ */ r(
|
|
114
|
-
|
|
117
|
+
$,
|
|
115
118
|
{
|
|
116
119
|
options: a.options ?? [],
|
|
117
120
|
value: n,
|
|
@@ -119,17 +122,17 @@ const se = ({
|
|
|
119
122
|
placeholder: a.placeholder,
|
|
120
123
|
searchPlaceholder: a.searchPlaceholder
|
|
121
124
|
}
|
|
122
|
-
) : /* @__PURE__ */ u(
|
|
123
|
-
/* @__PURE__ */ r(
|
|
124
|
-
/* @__PURE__ */ r(
|
|
125
|
+
) : /* @__PURE__ */ u(re, { value: n ?? "", onValueChange: c, children: [
|
|
126
|
+
/* @__PURE__ */ r(te, { className: j((n === void 0 || n === "") && "text-muted-foreground"), children: /* @__PURE__ */ r(le, { placeholder: a.placeholder }) }),
|
|
127
|
+
/* @__PURE__ */ r(ae, { children: (o = a.options) == null ? void 0 : o.map((h) => /* @__PURE__ */ r(se, { value: h.value, children: h.label }, h.value)) })
|
|
125
128
|
] });
|
|
126
129
|
case "date":
|
|
127
|
-
return /* @__PURE__ */ r(
|
|
130
|
+
return /* @__PURE__ */ r(I, { date: n, onDateChange: c, placeholder: a.placeholder ?? d("date.pickDate") });
|
|
128
131
|
case "date-range":
|
|
129
|
-
return /* @__PURE__ */ r(
|
|
132
|
+
return /* @__PURE__ */ r(z, { value: n, onChange: c, placeholder: a.placeholder });
|
|
130
133
|
case "multi-select":
|
|
131
134
|
return /* @__PURE__ */ r(
|
|
132
|
-
|
|
135
|
+
ne,
|
|
133
136
|
{
|
|
134
137
|
options: a.options ?? [],
|
|
135
138
|
selected: n ?? [],
|
|
@@ -146,66 +149,66 @@ const se = ({
|
|
|
146
149
|
default:
|
|
147
150
|
return null;
|
|
148
151
|
}
|
|
149
|
-
},
|
|
150
|
-
function
|
|
152
|
+
}, ie = (a) => !(a == null || a === "" || Array.isArray(a) && a.length === 0);
|
|
153
|
+
function de({
|
|
151
154
|
sections: a,
|
|
152
155
|
filters: n,
|
|
153
156
|
onFiltersChange: c,
|
|
154
|
-
buttonText: i
|
|
155
|
-
sheetTitle: d
|
|
157
|
+
buttonText: i,
|
|
158
|
+
sheetTitle: d
|
|
156
159
|
}) {
|
|
157
|
-
const
|
|
160
|
+
const { t: o } = w(), [h, p] = C(!1), [m, b] = C(n);
|
|
158
161
|
O(() => {
|
|
159
162
|
b(n);
|
|
160
|
-
}, [n,
|
|
161
|
-
const
|
|
163
|
+
}, [n, h]);
|
|
164
|
+
const x = (l, e) => {
|
|
162
165
|
b((t) => ({ ...t, [l]: e }));
|
|
163
|
-
},
|
|
164
|
-
const t = m[l], s = Array.isArray(t) ? t : [],
|
|
165
|
-
|
|
166
|
-
},
|
|
167
|
-
c(m),
|
|
168
|
-
},
|
|
169
|
-
b({}), c({}),
|
|
170
|
-
},
|
|
166
|
+
}, y = (l, e) => {
|
|
167
|
+
const t = m[l], s = Array.isArray(t) ? t : [], g = s.includes(e) ? s.filter((A) => A !== e) : [...s, e];
|
|
168
|
+
x(l, g);
|
|
169
|
+
}, f = () => {
|
|
170
|
+
c(m), p(!1);
|
|
171
|
+
}, v = () => {
|
|
172
|
+
b({}), c({}), p(!1);
|
|
173
|
+
}, N = S(() => {
|
|
171
174
|
const l = new Set(a.flatMap((e) => e.filters.map((t) => t.key)));
|
|
172
|
-
return Object.entries(n).filter(([e, t]) => l.has(e) &&
|
|
175
|
+
return Object.entries(n).filter(([e, t]) => l.has(e) && ie(t)).length;
|
|
173
176
|
}, [a, n]);
|
|
174
|
-
return /* @__PURE__ */ u(
|
|
175
|
-
/* @__PURE__ */ r(
|
|
176
|
-
/* @__PURE__ */ r(
|
|
177
|
-
i,
|
|
178
|
-
|
|
177
|
+
return /* @__PURE__ */ u(X, { open: h, onOpenChange: p, children: [
|
|
178
|
+
/* @__PURE__ */ r(G, { asChild: !0, children: /* @__PURE__ */ u(F, { variant: "outline", className: "gap-2", children: [
|
|
179
|
+
/* @__PURE__ */ r(Z, { className: "size-4 shrink-0" }),
|
|
180
|
+
i ?? o("filters.more"),
|
|
181
|
+
N > 0 && /* @__PURE__ */ r("span", { 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", children: N })
|
|
179
182
|
] }) }),
|
|
180
|
-
/* @__PURE__ */ u(
|
|
181
|
-
/* @__PURE__ */ r(
|
|
183
|
+
/* @__PURE__ */ u(J, { side: "right", className: "w-[400px] sm:w-[500px] flex flex-col p-0", children: [
|
|
184
|
+
/* @__PURE__ */ r(U, { className: "p-6 pb-0", children: /* @__PURE__ */ r(W, { children: d ?? o("filters.advanced") }) }),
|
|
182
185
|
/* @__PURE__ */ r("div", { className: "flex-1 overflow-y-auto p-6 pt-6", children: /* @__PURE__ */ r("div", { className: "space-y-6", children: a.map((l, e) => /* @__PURE__ */ u("div", { className: "space-y-4", children: [
|
|
183
186
|
/* @__PURE__ */ r("h3", { className: "font-semibold text-sm text-gray-900 dark:text-gray-100 border-b pb-2", children: l.title }),
|
|
184
187
|
l.filters.map((t) => /* @__PURE__ */ u("div", { className: "space-y-2", children: [
|
|
185
|
-
/* @__PURE__ */ r(
|
|
188
|
+
/* @__PURE__ */ r(V, { htmlFor: t.key, children: t.label }),
|
|
186
189
|
/* @__PURE__ */ r(
|
|
187
|
-
|
|
190
|
+
oe,
|
|
188
191
|
{
|
|
189
192
|
field: t,
|
|
190
193
|
value: m[t.key],
|
|
191
194
|
onChange: (s) => {
|
|
192
|
-
|
|
195
|
+
x(t.key, s);
|
|
193
196
|
},
|
|
194
197
|
onToggleMultiSelect: (s) => {
|
|
195
|
-
|
|
198
|
+
y(t.key, s);
|
|
196
199
|
}
|
|
197
200
|
}
|
|
198
201
|
)
|
|
199
202
|
] }, t.key))
|
|
200
203
|
] }, e)) }) }),
|
|
201
|
-
/* @__PURE__ */ u(
|
|
202
|
-
/* @__PURE__ */ r(
|
|
203
|
-
/* @__PURE__ */ r(
|
|
204
|
+
/* @__PURE__ */ u(Y, { className: "gap-2 p-6 border-t bg-white dark:bg-gray-950", children: [
|
|
205
|
+
/* @__PURE__ */ r(F, { variant: "outline", className: "flex-1", onClick: v, children: "Effacer les filtres" }),
|
|
206
|
+
/* @__PURE__ */ r(F, { className: "flex-1 bg-orange-500 hover:bg-orange-600 text-white", onClick: f, children: "Rechercher" })
|
|
204
207
|
] })
|
|
205
208
|
] })
|
|
206
209
|
] });
|
|
207
210
|
}
|
|
208
|
-
function
|
|
211
|
+
function ue({
|
|
209
212
|
label: a,
|
|
210
213
|
options: n,
|
|
211
214
|
selected: c,
|
|
@@ -213,73 +216,73 @@ function oe({
|
|
|
213
216
|
onClear: d,
|
|
214
217
|
onSelectAll: o,
|
|
215
218
|
searchable: h = !1,
|
|
216
|
-
searchPlaceholder:
|
|
219
|
+
searchPlaceholder: p
|
|
217
220
|
}) {
|
|
218
|
-
const [b,
|
|
219
|
-
if (
|
|
221
|
+
const { t: m } = w(), [b, x] = C(""), y = c.length > 0, f = S(() => b === "" ? n : n.filter((l) => l.label.toLowerCase().includes(b.toLowerCase())), [n, b]), v = S(() => f.length === 0 ? !1 : f.every((l) => c.includes(l.value)), [f, c]), N = () => {
|
|
222
|
+
if (v)
|
|
220
223
|
if (o !== void 0) {
|
|
221
|
-
const l =
|
|
224
|
+
const l = f.map((t) => t.value), e = c.filter((t) => !l.includes(t));
|
|
222
225
|
o(e);
|
|
223
226
|
} else d !== void 0 ? d() : c.forEach((l) => {
|
|
224
227
|
i(l);
|
|
225
228
|
});
|
|
226
229
|
else if (o !== void 0) {
|
|
227
230
|
const l = [...c];
|
|
228
|
-
|
|
231
|
+
f.forEach((e) => {
|
|
229
232
|
l.includes(e.value) || l.push(e.value);
|
|
230
233
|
}), o(l);
|
|
231
234
|
} else
|
|
232
|
-
|
|
235
|
+
f.forEach((l) => {
|
|
233
236
|
c.includes(l.value) || i(l.value);
|
|
234
237
|
});
|
|
235
238
|
};
|
|
236
239
|
return /* @__PURE__ */ u(
|
|
237
|
-
|
|
240
|
+
_,
|
|
238
241
|
{
|
|
239
242
|
onOpenChange: () => {
|
|
240
|
-
|
|
243
|
+
x("");
|
|
241
244
|
},
|
|
242
245
|
children: [
|
|
243
246
|
/* @__PURE__ */ r(R, { asChild: !0, children: /* @__PURE__ */ u(
|
|
244
247
|
"button",
|
|
245
248
|
{
|
|
246
|
-
className:
|
|
247
|
-
|
|
249
|
+
className: j(
|
|
250
|
+
K,
|
|
248
251
|
"inline-flex items-center gap-1.5 whitespace-nowrap transition-colors",
|
|
249
|
-
|
|
252
|
+
y ? "border-primary bg-primary/10 text-primary font-medium" : "hover:bg-muted"
|
|
250
253
|
),
|
|
251
254
|
children: [
|
|
252
255
|
a,
|
|
253
256
|
c.length > 0 && /* @__PURE__ */ r("span", { className: "flex h-4 min-w-[16px] items-center justify-center rounded-full bg-primary px-1 text-[10px] font-bold text-primary-foreground", children: c.length }),
|
|
254
|
-
/* @__PURE__ */ r(
|
|
257
|
+
/* @__PURE__ */ r(q, { className: "size-3.5 opacity-60" })
|
|
255
258
|
]
|
|
256
259
|
}
|
|
257
260
|
) }),
|
|
258
|
-
/* @__PURE__ */ u(
|
|
261
|
+
/* @__PURE__ */ u(H, { className: "w-56 p-0", align: "start", children: [
|
|
259
262
|
h ? /* @__PURE__ */ r("div", { className: "border-b border-border p-2", children: /* @__PURE__ */ u("div", { className: "relative", children: [
|
|
260
|
-
/* @__PURE__ */ r(
|
|
263
|
+
/* @__PURE__ */ r(ee, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
|
|
261
264
|
/* @__PURE__ */ r(
|
|
262
265
|
"input",
|
|
263
266
|
{
|
|
264
267
|
className: "w-full rounded-control bg-muted/50 py-1.5 pl-7 pr-2 text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring",
|
|
265
|
-
placeholder: m,
|
|
268
|
+
placeholder: p ?? m("search.placeholder"),
|
|
266
269
|
value: b,
|
|
267
270
|
onChange: (l) => {
|
|
268
|
-
|
|
271
|
+
x(l.target.value);
|
|
269
272
|
},
|
|
270
273
|
autoFocus: !0
|
|
271
274
|
}
|
|
272
275
|
)
|
|
273
276
|
] }) }) : null,
|
|
274
277
|
/* @__PURE__ */ u("div", { className: "flex flex-col gap-0.5 max-h-56 overflow-y-auto p-1.5", children: [
|
|
275
|
-
|
|
276
|
-
/* @__PURE__ */ r(
|
|
278
|
+
f.length > 0 && /* @__PURE__ */ u("label", { className: "flex items-center gap-2.5 rounded-md px-2 py-2 text-sm hover:bg-muted cursor-pointer transition-colors", children: [
|
|
279
|
+
/* @__PURE__ */ r(P, { checked: v, onCheckedChange: N }),
|
|
277
280
|
"Tout sélectionner"
|
|
278
281
|
] }),
|
|
279
|
-
|
|
280
|
-
|
|
282
|
+
f.length === 0 && /* @__PURE__ */ r("p", { className: "px-2 py-3 text-center text-xs text-muted-foreground", children: m("states.noResult") }),
|
|
283
|
+
f.map((l) => /* @__PURE__ */ u("label", { className: "flex items-center gap-2.5 rounded-md px-2 py-2 text-sm hover:bg-muted cursor-pointer transition-colors", children: [
|
|
281
284
|
/* @__PURE__ */ r(
|
|
282
|
-
|
|
285
|
+
P,
|
|
283
286
|
{
|
|
284
287
|
checked: c.includes(l.value),
|
|
285
288
|
onCheckedChange: () => {
|
|
@@ -308,28 +311,28 @@ function oe({
|
|
|
308
311
|
}
|
|
309
312
|
);
|
|
310
313
|
}
|
|
311
|
-
function
|
|
314
|
+
function je({
|
|
312
315
|
searchQuery: a,
|
|
313
316
|
onSearchChange: n,
|
|
314
|
-
searchPlaceholder: c
|
|
317
|
+
searchPlaceholder: c,
|
|
315
318
|
filters: i,
|
|
316
319
|
onFiltersChange: d,
|
|
317
320
|
sections: o,
|
|
318
321
|
advancedButtonText: h = "Filtres",
|
|
319
|
-
sheetTitle:
|
|
322
|
+
sheetTitle: p
|
|
320
323
|
}) {
|
|
321
|
-
const b = (e, t) => {
|
|
322
|
-
const s = i[e],
|
|
323
|
-
|
|
324
|
-
},
|
|
324
|
+
const { t: m } = w(), b = (e, t) => {
|
|
325
|
+
const s = i[e], g = Array.isArray(s) ? s : [], A = g.includes(t) ? g.filter((M) => M !== t) : [...g, t], k = { ...i };
|
|
326
|
+
A.length === 0 ? delete k[e] : k[e] = A, d(k);
|
|
327
|
+
}, x = (e) => {
|
|
325
328
|
const t = { ...i };
|
|
326
329
|
delete t[e], d(t);
|
|
327
|
-
},
|
|
330
|
+
}, y = () => {
|
|
328
331
|
d({});
|
|
329
|
-
},
|
|
330
|
-
const s = { ...i },
|
|
331
|
-
Array.isArray(
|
|
332
|
-
},
|
|
332
|
+
}, f = (e, t) => {
|
|
333
|
+
const s = { ...i }, g = s[e];
|
|
334
|
+
Array.isArray(g) && t !== void 0 ? (s[e] = g.filter((A) => A !== t), Array.isArray(s[e]) && s[e].length === 0 && delete s[e]) : delete s[e], d(s);
|
|
335
|
+
}, v = S(() => {
|
|
333
336
|
const e = [];
|
|
334
337
|
return o.forEach((t) => {
|
|
335
338
|
t.filters.forEach((s) => {
|
|
@@ -342,19 +345,19 @@ function Ee({
|
|
|
342
345
|
});
|
|
343
346
|
});
|
|
344
347
|
}), e;
|
|
345
|
-
}, [o]),
|
|
348
|
+
}, [o]), N = S(() => {
|
|
346
349
|
const e = {};
|
|
347
350
|
return o.forEach((t) => {
|
|
348
351
|
t.filters.forEach((s) => {
|
|
349
352
|
e[s.key] = s.badgeLabel ?? s.label;
|
|
350
353
|
});
|
|
351
354
|
}), e;
|
|
352
|
-
}, [o]), l =
|
|
355
|
+
}, [o]), l = S(() => {
|
|
353
356
|
const e = {};
|
|
354
357
|
return o.forEach((t) => {
|
|
355
358
|
t.filters.forEach((s) => {
|
|
356
|
-
s.options !== void 0 && s.options.forEach((
|
|
357
|
-
e[`${s.key}_${
|
|
359
|
+
s.options !== void 0 && s.options.forEach((g) => {
|
|
360
|
+
e[`${s.key}_${g.value}`] = g.label;
|
|
358
361
|
});
|
|
359
362
|
});
|
|
360
363
|
}), e;
|
|
@@ -363,18 +366,18 @@ function Ee({
|
|
|
363
366
|
/* @__PURE__ */ u("div", { className: "flex flex-wrap items-center gap-3 justify-between", children: [
|
|
364
367
|
/* @__PURE__ */ u("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
365
368
|
n !== void 0 ? /* @__PURE__ */ r(
|
|
366
|
-
|
|
369
|
+
B,
|
|
367
370
|
{
|
|
368
371
|
searchQuery: a,
|
|
369
372
|
onSearch: n,
|
|
370
373
|
onClear: () => {
|
|
371
374
|
n("");
|
|
372
375
|
},
|
|
373
|
-
placeholder: c
|
|
376
|
+
placeholder: c ?? m("search.placeholder")
|
|
374
377
|
}
|
|
375
378
|
) : null,
|
|
376
|
-
|
|
377
|
-
|
|
379
|
+
v.map((e) => /* @__PURE__ */ r(
|
|
380
|
+
ue,
|
|
378
381
|
{
|
|
379
382
|
label: e.label,
|
|
380
383
|
options: e.options,
|
|
@@ -383,7 +386,7 @@ function Ee({
|
|
|
383
386
|
b(e.key, t);
|
|
384
387
|
},
|
|
385
388
|
onClear: () => {
|
|
386
|
-
|
|
389
|
+
x(e.key);
|
|
387
390
|
},
|
|
388
391
|
onSelectAll: (t) => {
|
|
389
392
|
d({ ...i, [e.key]: t });
|
|
@@ -394,24 +397,24 @@ function Ee({
|
|
|
394
397
|
e.key
|
|
395
398
|
))
|
|
396
399
|
] }),
|
|
397
|
-
o.length > 0 && /* @__PURE__ */ r(
|
|
400
|
+
o.length > 0 && /* @__PURE__ */ r(de, { sections: o, filters: i, onFiltersChange: d, buttonText: h, sheetTitle: p })
|
|
398
401
|
] }),
|
|
399
402
|
/* @__PURE__ */ r(
|
|
400
|
-
|
|
403
|
+
ce,
|
|
401
404
|
{
|
|
402
405
|
filters: i,
|
|
403
|
-
onRemoveFilter:
|
|
404
|
-
onClearAll:
|
|
405
|
-
filterLabels:
|
|
406
|
+
onRemoveFilter: f,
|
|
407
|
+
onClearAll: y,
|
|
408
|
+
filterLabels: N,
|
|
406
409
|
optionLabels: l
|
|
407
410
|
}
|
|
408
411
|
)
|
|
409
412
|
] });
|
|
410
413
|
}
|
|
411
414
|
export {
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
415
|
+
ce as A,
|
|
416
|
+
oe as F,
|
|
417
|
+
ue as S,
|
|
418
|
+
je as T,
|
|
419
|
+
de as a
|
|
417
420
|
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as a, jsxs as l } from "react/jsx-runtime";
|
|
2
|
+
import { u as h } from "./useKrosoftTranslation-DdcylBY2.js";
|
|
3
|
+
import { b as u, T as g, c as f, B as v, a as b } from "./tooltip-DVeqVwqV.js";
|
|
4
|
+
import { S as N, h as T, i as x, a as C, c as S } from "./select-BpjFWqAY.js";
|
|
5
|
+
import { u as p } from "./useTheme-Cmw14Zxi.js";
|
|
6
|
+
function P({ themeOptions: c, variant: t = "select" }) {
|
|
7
|
+
const { t: o } = h(), { theme: i, handleThemeChange: n, currentThemeOption: e, nextThemeOption: r, cycleTheme: d } = p(c);
|
|
8
|
+
if (t === "mini") {
|
|
9
|
+
const s = e == null ? void 0 : e.icon;
|
|
10
|
+
return /* @__PURE__ */ a(u, { children: /* @__PURE__ */ l(g, { children: [
|
|
11
|
+
/* @__PURE__ */ a(f, { asChild: !0, children: /* @__PURE__ */ l(
|
|
12
|
+
v,
|
|
13
|
+
{
|
|
14
|
+
variant: "ghost",
|
|
15
|
+
size: "icon",
|
|
16
|
+
onClick: d,
|
|
17
|
+
className: "text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
18
|
+
children: [
|
|
19
|
+
s && /* @__PURE__ */ a(s, { className: "size-4" }),
|
|
20
|
+
/* @__PURE__ */ l("span", { className: "sr-only", children: [
|
|
21
|
+
"Thème actuel : ",
|
|
22
|
+
e == null ? void 0 : e.label
|
|
23
|
+
] })
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
) }),
|
|
27
|
+
/* @__PURE__ */ l(b, { side: "bottom", align: "center", children: [
|
|
28
|
+
"Passer en ",
|
|
29
|
+
r == null ? void 0 : r.label
|
|
30
|
+
] })
|
|
31
|
+
] }) });
|
|
32
|
+
}
|
|
33
|
+
return /* @__PURE__ */ l("div", { className: "space-y-2", children: [
|
|
34
|
+
/* @__PURE__ */ l(N, { value: i, onValueChange: n, children: [
|
|
35
|
+
/* @__PURE__ */ a(T, { className: "w-full", children: /* @__PURE__ */ a(x, { placeholder: o("select.theme") }) }),
|
|
36
|
+
/* @__PURE__ */ a(C, { children: c.map((s) => {
|
|
37
|
+
const m = s.icon;
|
|
38
|
+
return /* @__PURE__ */ a(S, { value: s.value, children: /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
39
|
+
/* @__PURE__ */ a(m, { className: "size-4" }),
|
|
40
|
+
s.label
|
|
41
|
+
] }) }, s.value);
|
|
42
|
+
}) })
|
|
43
|
+
] }),
|
|
44
|
+
(e == null ? void 0 : e.message) && /* @__PURE__ */ a("p", { className: "text-sm text-muted-foreground", children: e.message })
|
|
45
|
+
] });
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
P as T
|
|
49
|
+
};
|