@krosoft/react 0.0.238 → 0.0.240
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-C_0YI75w.js +60 -0
- package/dist/AppSubTitle-tqqV9nuT.js +19 -0
- package/dist/AppTitle-BR4JFZfp.js +19 -0
- package/dist/ErrorAlert-BDqDHUUc.js +27 -0
- package/dist/GenericForm-CWXT5wiv.js +310 -0
- package/dist/ImageInput-CN2ozjpc.js +80 -0
- package/dist/MultiSelect-BF0zL0B0.js +134 -0
- package/dist/SearchInput-BJPT0SbB.js +255 -0
- package/dist/alert-REQGK9bR.js +32 -0
- package/dist/behavior-BR_V9Rpe.js +76 -0
- package/dist/cards-Cta6x49J.js +126 -0
- package/dist/chart-Dq3AIrue.js +166 -0
- package/dist/charts-CXhVUqLH.js +328 -0
- package/dist/components/core/cards/index.js +2 -10
- package/dist/components/core/charts/index.js +2 -11
- package/dist/components/core/dialogs/index.js +4 -19
- package/dist/components/core/filters/index.js +426 -7
- package/dist/components/core/forms/index.js +2 -4
- package/dist/components/core/index.js +24 -97
- package/dist/components/core/inputs/index.js +4 -11
- package/dist/components/core/language/index.js +2 -4
- package/dist/components/core/layouts/index.js +50 -11
- package/dist/components/core/navbar/index.js +2 -9
- package/dist/components/core/states/index.js +3 -8
- package/dist/components/core/table/index.js +2 -15
- package/dist/components/core/tabs/index.js +188 -6
- package/dist/components/core/theme/index.js +2 -4
- package/dist/components/index.js +28 -322
- package/dist/components/ui/index.js +8 -240
- package/dist/contexts/index.js +2 -5
- package/dist/dialogs-BGHSClsq.js +208 -0
- package/dist/helpers/index.js +39 -46
- package/dist/hooks/behavior/index.js +2 -10
- package/dist/hooks/index.js +11 -30
- package/dist/hooks/ui/index.js +10 -22
- package/dist/i18n/index.js +2 -10
- package/dist/i18n-Dw99bRmg.js +190 -0
- package/dist/language-DxHhlpgN.js +58 -0
- package/dist/navbar-Bc5OQWRI.js +385 -0
- package/dist/providers/index.js +42 -49
- package/dist/pwa/index.js +32 -34
- package/dist/select-ULiTPOr5.js +81 -0
- package/dist/sheet-CRrYTZrl.js +226 -0
- package/dist/sidebar.context-BahtU6hE.js +5 -0
- package/dist/skeleton-D6Ga4BLw.js +11 -0
- package/dist/states-N8-LjFng.js +26 -0
- package/dist/table-muUyiaK6.js +571 -0
- package/dist/tailwind/index.js +126 -156
- package/dist/tailwind.helper-CJaRYBmL.js +8 -0
- package/dist/theme-B_n0F6R4.js +57 -0
- package/dist/tokens/index.js +37 -46
- package/dist/tooltip-B2dzyfs9.js +50 -0
- package/dist/types/forms/index.js +0 -1
- package/dist/types/index.js +1 -1
- package/dist/ui-CiX0E_bn.js +1165 -0
- package/dist/ui-DSVBO3iM.js +46 -0
- package/dist/useDocumentTitle-D7MywIeB.js +19 -0
- package/dist/useFixedColumns-DfAX30tT.js +147 -0
- package/dist/useLanguage-DN3CuBv5.js +19 -0
- package/dist/useMobile-pTQ8lWvt.js +16 -0
- package/dist/useNotifications-CyhTruIG.js +20 -0
- package/dist/useScrollFade-D9kqJBDh.js +27 -0
- package/dist/useTheme-DVfcJ-Qd.js +25 -0
- package/dist/useToast-UeDRLovh.js +103 -0
- package/package.json +3 -3
- package/dist/AppActions-BFwztl-1.js +0 -76
- package/dist/AppSubTitle-BTN0YAc7.js +0 -13
- package/dist/AppTitle-D15YXeMx.js +0 -13
- package/dist/AppVerticalTabs-B7XXtAVj.js +0 -103
- package/dist/ConfirmationDialog-Dj4WdnHg.js +0 -188
- package/dist/DataTable-CjrR27Di.js +0 -638
- package/dist/ErrorAlert-B99Xb_Hg.js +0 -23
- package/dist/ErrorState-CkeS_IBT.js +0 -14
- package/dist/GenericForm-CydibLHU.js +0 -343
- package/dist/ImageInput-DoOOvvth.js +0 -70
- package/dist/KpiCardsLayout-Bq4xQ3i8.js +0 -43
- package/dist/LanguageSelector-C7E51rCQ.js +0 -47
- package/dist/LoadingState-BN0YaPSs.js +0 -9
- package/dist/MetricCard-B0xnFyim.js +0 -53
- package/dist/MultiSelect-DbH7LrsD.js +0 -149
- package/dist/PieChart-uozNJtEx.js +0 -295
- package/dist/SearchInput-DIZ5Yt6L.js +0 -246
- package/dist/SkeletonCards-B9C4cNMr.js +0 -75
- package/dist/TableFilter-CmEVF5Bo.js +0 -422
- package/dist/ThemeSelector-CLi4_epH.js +0 -52
- package/dist/Topbar-Clby5_uj.js +0 -431
- package/dist/alert-B9F1N9Qk.js +0 -30
- package/dist/chart-DntJZGxB.js +0 -181
- package/dist/select-BpjFWqAY.js +0 -96
- package/dist/sheet-XYI-ezvY.js +0 -292
- package/dist/sidebar.context-D5nywlmP.js +0 -6
- package/dist/skeleton-BX4RcsiK.js +0 -8
- package/dist/tailwind.helper-B6yFEsav.js +0 -8
- package/dist/toaster-CyzB1m5z.js +0 -75
- package/dist/toggle-group-iZqnrTj7.js +0 -1276
- package/dist/tooltip-DVeqVwqV.js +0 -61
- package/dist/useDateFnsLocale-D6VExZ8U.js +0 -11
- package/dist/useDocumentTitle-WNwdPz-I.js +0 -14
- package/dist/useFixedColumns-CKZyu4PD.js +0 -161
- package/dist/useKrosoftTranslation-BTp46G94.js +0 -47
- package/dist/useLanguage-C9jI2nwn.js +0 -19
- package/dist/useMobile-DN1_OMDB.js +0 -16
- package/dist/useNotifications-zbUhCvF_.js +0 -12
- package/dist/usePage-BQm6tdJD.js +0 -84
- package/dist/useScrollFade-BA4KqJYp.js +0 -23
- package/dist/useServerTable-UvTY6L1N.js +0 -38
- package/dist/useSidebar-BJuALHqQ.js +0 -11
- package/dist/useTheme-DS6ZjdzM.js +0 -27
- package/dist/useToast-BFTk4lWz.js +0 -100
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { jsxs as s, jsx as e, Fragment as o } from "react/jsx-runtime";
|
|
2
|
-
import { formatNumber as g } from "@krosoft/core/helpers";
|
|
3
|
-
import { useTranslation as b } from "react-i18next";
|
|
4
|
-
import { c as m } from "./tailwind.helper-B6yFEsav.js";
|
|
5
|
-
import "./toggle-group-iZqnrTj7.js";
|
|
6
|
-
import "./alert-B9F1N9Qk.js";
|
|
7
|
-
import "@radix-ui/react-aspect-ratio";
|
|
8
|
-
import "./tooltip-DVeqVwqV.js";
|
|
9
|
-
import { C as c, d as p, e as v, a as h } from "./chart-DntJZGxB.js";
|
|
10
|
-
import "@radix-ui/react-collapsible";
|
|
11
|
-
import "./sheet-XYI-ezvY.js";
|
|
12
|
-
import "lucide-react";
|
|
13
|
-
import "react-resizable-panels";
|
|
14
|
-
import "./select-BpjFWqAY.js";
|
|
15
|
-
import { S as n } from "./skeleton-BX4RcsiK.js";
|
|
16
|
-
import "next-themes";
|
|
17
|
-
import "sonner";
|
|
18
|
-
import "react";
|
|
19
|
-
const y = ({
|
|
20
|
-
titleKey: a,
|
|
21
|
-
value: i,
|
|
22
|
-
valueClassName: t,
|
|
23
|
-
icon: r,
|
|
24
|
-
iconClassName: N,
|
|
25
|
-
description: u,
|
|
26
|
-
descriptionClassName: f,
|
|
27
|
-
onClick: d,
|
|
28
|
-
isLoading: x,
|
|
29
|
-
error: l
|
|
30
|
-
}) => {
|
|
31
|
-
const { t: C } = b();
|
|
32
|
-
return /* @__PURE__ */ s(c, { className: m(d !== void 0 ? "hover:border-primary cursor-pointer" : ""), onClick: d, children: [
|
|
33
|
-
/* @__PURE__ */ s(p, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
34
|
-
/* @__PURE__ */ e(v, { className: "text-sm font-medium", children: C(a) }),
|
|
35
|
-
/* @__PURE__ */ e(r, { className: m("size-6 text-muted-foreground", N) })
|
|
36
|
-
] }),
|
|
37
|
-
/* @__PURE__ */ e(h, { children: x ? /* @__PURE__ */ s(o, { children: [
|
|
38
|
-
/* @__PURE__ */ e(n, { className: "h-8 w-24 mb-1" }),
|
|
39
|
-
/* @__PURE__ */ e(n, { className: "h-3 w-32" })
|
|
40
|
-
] }) : l ? /* @__PURE__ */ s(o, { children: [
|
|
41
|
-
/* @__PURE__ */ e("div", { className: "text-2xl font-bold text-destructive", children: "—" }),
|
|
42
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-destructive", children: l })
|
|
43
|
-
] }) : /* @__PURE__ */ s(o, { children: [
|
|
44
|
-
/* @__PURE__ */ e("div", { className: m("text-2xl font-bold", t), children: typeof i == "number" ? g(i) : i instanceof Date ? i.toLocaleDateString() : i }),
|
|
45
|
-
/* @__PURE__ */ e("p", { className: m("text-xs text-muted-foreground", f), children: u })
|
|
46
|
-
] }) })
|
|
47
|
-
] });
|
|
48
|
-
}, J = ({ stats: a, isLoading: i, error: t }) => /* @__PURE__ */ e("div", { className: "grid gap-6 md:grid-cols-2 lg:grid-cols-4", children: a.map((r) => /* @__PURE__ */ e(
|
|
49
|
-
y,
|
|
50
|
-
{
|
|
51
|
-
titleKey: r.titleKey,
|
|
52
|
-
value: r.value,
|
|
53
|
-
valueClassName: r.valueClassName,
|
|
54
|
-
icon: r.icon,
|
|
55
|
-
iconClassName: r.iconClassName,
|
|
56
|
-
description: r.description,
|
|
57
|
-
descriptionClassName: r.descriptionClassName,
|
|
58
|
-
onClick: r.onClick,
|
|
59
|
-
isLoading: i,
|
|
60
|
-
error: t
|
|
61
|
-
},
|
|
62
|
-
r.titleKey
|
|
63
|
-
)) }), w = () => /* @__PURE__ */ s(c, { className: "animate-pulse", children: [
|
|
64
|
-
/* @__PURE__ */ e(p, { children: /* @__PURE__ */ e("div", { className: "h-6 bg-muted rounded w-1/4" }) }),
|
|
65
|
-
/* @__PURE__ */ e(h, { children: /* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
66
|
-
/* @__PURE__ */ e("div", { className: "h-4 bg-muted rounded" }),
|
|
67
|
-
/* @__PURE__ */ e("div", { className: "h-4 bg-muted rounded w-3/4" })
|
|
68
|
-
] }) })
|
|
69
|
-
] }), M = ({ count: a = 1 }) => /* @__PURE__ */ e("div", { className: "grid gap-6", style: { gridTemplateColumns: `repeat(${a}, minmax(0, 1fr))` }, children: Array.from({ length: a }).map((i, t) => /* @__PURE__ */ e(w, {}, t)) });
|
|
70
|
-
export {
|
|
71
|
-
y as K,
|
|
72
|
-
w as S,
|
|
73
|
-
J as a,
|
|
74
|
-
M as b
|
|
75
|
-
};
|
|
@@ -1,422 +0,0 @@
|
|
|
1
|
-
import { jsxs as u, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import "date-fns/locale";
|
|
3
|
-
import "react-i18next";
|
|
4
|
-
import { u as S } from "./useKrosoftTranslation-BTp46G94.js";
|
|
5
|
-
import { useState as C, useEffect as O, useMemo as w } from "react";
|
|
6
|
-
import { a as z, D as I, b as $, S as B } from "./SearchInput-DIZ5Yt6L.js";
|
|
7
|
-
import { getLocale as Q } from "@krosoft/core/helpers";
|
|
8
|
-
import { B as E, aw as V, E as P } from "./toggle-group-iZqnrTj7.js";
|
|
9
|
-
import "./alert-B9F1N9Qk.js";
|
|
10
|
-
import "@radix-ui/react-aspect-ratio";
|
|
11
|
-
import { B as F, e as _ } from "./tooltip-DVeqVwqV.js";
|
|
12
|
-
import "./chart-DntJZGxB.js";
|
|
13
|
-
import "@radix-ui/react-collapsible";
|
|
14
|
-
import { I as L, u as R, F as H, w as K, z as X, E as G, y as J, P as U, s as W, r as Y } from "./sheet-XYI-ezvY.js";
|
|
15
|
-
import { XIcon as T, Filter as Z, ChevronDown as q, Search as ee } from "lucide-react";
|
|
16
|
-
import "react-resizable-panels";
|
|
17
|
-
import "clsx";
|
|
18
|
-
import "tailwind-merge";
|
|
19
|
-
import { S as re, h as te, i as le, a as ae, c as se } from "./select-BpjFWqAY.js";
|
|
20
|
-
import "next-themes";
|
|
21
|
-
import "sonner";
|
|
22
|
-
import { c as j } from "./tailwind.helper-B6yFEsav.js";
|
|
23
|
-
import { M as ne } from "./MultiSelect-DbH7LrsD.js";
|
|
24
|
-
const D = (a, n, c, i = {}) => {
|
|
25
|
-
if (n instanceof Date)
|
|
26
|
-
return n.toLocaleDateString(Q());
|
|
27
|
-
const d = String(n), o = i[`${a}_${d}`];
|
|
28
|
-
return o !== void 0 ? o : a.includes("ok") || n === "true" || n === "false" ? c(n === "true" ? "filters.yes" : "filters.no") : d;
|
|
29
|
-
};
|
|
30
|
-
function ce({ filters: a, onRemoveFilter: n, onClearAll: c, filterLabels: i = {}, optionLabels: d = {} }) {
|
|
31
|
-
const { t: o } = S(), h = Object.entries(a).filter(([p, m]) => !(m == null || m === "" || Array.isArray(m) && m.length === 0));
|
|
32
|
-
return h.length === 0 ? null : /* @__PURE__ */ u("div", { className: "flex flex-wrap items-center gap-2 mb-4", children: [
|
|
33
|
-
/* @__PURE__ */ r("span", { className: "text-sm text-gray-600 font-medium", children: "Filtres actifs :" }),
|
|
34
|
-
h.flatMap(([p, m]) => {
|
|
35
|
-
const b = i[p] ?? p;
|
|
36
|
-
if (Array.isArray(m))
|
|
37
|
-
return m.map((y) => {
|
|
38
|
-
const f = D(p, y, o, d);
|
|
39
|
-
return /* @__PURE__ */ u(
|
|
40
|
-
E,
|
|
41
|
-
{
|
|
42
|
-
variant: "secondary",
|
|
43
|
-
className: "flex items-center gap-1 px-3 py-1 bg-blue-50 text-blue-700 border border-blue-200 hover:bg-blue-100",
|
|
44
|
-
children: [
|
|
45
|
-
b,
|
|
46
|
-
": ",
|
|
47
|
-
f,
|
|
48
|
-
/* @__PURE__ */ r(
|
|
49
|
-
"button",
|
|
50
|
-
{
|
|
51
|
-
onClick: () => {
|
|
52
|
-
n(p, y);
|
|
53
|
-
},
|
|
54
|
-
className: "ml-1 hover:bg-blue-200 rounded-full p-0.5",
|
|
55
|
-
children: /* @__PURE__ */ r(T, { className: "size-4" })
|
|
56
|
-
}
|
|
57
|
-
)
|
|
58
|
-
]
|
|
59
|
-
},
|
|
60
|
-
`${p}_${String(y)}`
|
|
61
|
-
);
|
|
62
|
-
});
|
|
63
|
-
const x = D(p, m, o, d);
|
|
64
|
-
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: [
|
|
65
|
-
b,
|
|
66
|
-
": ",
|
|
67
|
-
x,
|
|
68
|
-
/* @__PURE__ */ r(
|
|
69
|
-
"button",
|
|
70
|
-
{
|
|
71
|
-
onClick: () => {
|
|
72
|
-
n(p);
|
|
73
|
-
},
|
|
74
|
-
className: "ml-1 hover:bg-blue-200 rounded-full p-0.5",
|
|
75
|
-
children: /* @__PURE__ */ r(T, { className: "size-4" })
|
|
76
|
-
}
|
|
77
|
-
)
|
|
78
|
-
] }, p);
|
|
79
|
-
}),
|
|
80
|
-
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" })
|
|
81
|
-
] });
|
|
82
|
-
}
|
|
83
|
-
const oe = ({
|
|
84
|
-
field: a,
|
|
85
|
-
value: n,
|
|
86
|
-
onChange: c,
|
|
87
|
-
onToggleMultiSelect: i
|
|
88
|
-
}) => {
|
|
89
|
-
var o;
|
|
90
|
-
const { t: d } = S();
|
|
91
|
-
switch (a.type) {
|
|
92
|
-
case "text":
|
|
93
|
-
return /* @__PURE__ */ r(
|
|
94
|
-
L,
|
|
95
|
-
{
|
|
96
|
-
placeholder: a.placeholder,
|
|
97
|
-
value: n ?? "",
|
|
98
|
-
onChange: (h) => {
|
|
99
|
-
c(h.target.value);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
);
|
|
103
|
-
case "number":
|
|
104
|
-
return /* @__PURE__ */ r(
|
|
105
|
-
L,
|
|
106
|
-
{
|
|
107
|
-
type: "number",
|
|
108
|
-
placeholder: a.placeholder,
|
|
109
|
-
value: n ?? "",
|
|
110
|
-
onChange: (h) => {
|
|
111
|
-
c(h.target.value);
|
|
112
|
-
},
|
|
113
|
-
min: a.min,
|
|
114
|
-
max: a.max
|
|
115
|
-
}
|
|
116
|
-
);
|
|
117
|
-
case "select":
|
|
118
|
-
return a.searchable === !0 ? /* @__PURE__ */ r(
|
|
119
|
-
$,
|
|
120
|
-
{
|
|
121
|
-
options: a.options ?? [],
|
|
122
|
-
value: n,
|
|
123
|
-
onChange: c,
|
|
124
|
-
placeholder: a.placeholder,
|
|
125
|
-
searchPlaceholder: a.searchPlaceholder
|
|
126
|
-
}
|
|
127
|
-
) : /* @__PURE__ */ u(re, { value: n ?? "", onValueChange: c, children: [
|
|
128
|
-
/* @__PURE__ */ r(te, { className: j((n === void 0 || n === "") && "text-muted-foreground"), children: /* @__PURE__ */ r(le, { placeholder: a.placeholder }) }),
|
|
129
|
-
/* @__PURE__ */ r(ae, { children: (o = a.options) == null ? void 0 : o.map((h) => /* @__PURE__ */ r(se, { value: h.value, children: h.label }, h.value)) })
|
|
130
|
-
] });
|
|
131
|
-
case "date":
|
|
132
|
-
return /* @__PURE__ */ r(I, { date: n, onDateChange: c, placeholder: a.placeholder ?? d("date.pickDate") });
|
|
133
|
-
case "date-range":
|
|
134
|
-
return /* @__PURE__ */ r(z, { value: n, onChange: c, placeholder: a.placeholder });
|
|
135
|
-
case "multi-select":
|
|
136
|
-
return /* @__PURE__ */ r(
|
|
137
|
-
ne,
|
|
138
|
-
{
|
|
139
|
-
options: a.options ?? [],
|
|
140
|
-
selected: n ?? [],
|
|
141
|
-
onToggle: i,
|
|
142
|
-
onClear: () => {
|
|
143
|
-
c([]);
|
|
144
|
-
},
|
|
145
|
-
onSelectAll: c,
|
|
146
|
-
placeholder: a.placeholder,
|
|
147
|
-
searchable: a.searchable,
|
|
148
|
-
searchPlaceholder: a.searchPlaceholder
|
|
149
|
-
}
|
|
150
|
-
);
|
|
151
|
-
default:
|
|
152
|
-
return null;
|
|
153
|
-
}
|
|
154
|
-
}, ie = (a) => !(a == null || a === "" || Array.isArray(a) && a.length === 0);
|
|
155
|
-
function de({
|
|
156
|
-
sections: a,
|
|
157
|
-
filters: n,
|
|
158
|
-
onFiltersChange: c,
|
|
159
|
-
buttonText: i,
|
|
160
|
-
sheetTitle: d
|
|
161
|
-
}) {
|
|
162
|
-
const { t: o } = S(), [h, p] = C(!1), [m, b] = C(n);
|
|
163
|
-
O(() => {
|
|
164
|
-
b(n);
|
|
165
|
-
}, [n, h]);
|
|
166
|
-
const x = (l, e) => {
|
|
167
|
-
b((t) => ({ ...t, [l]: e }));
|
|
168
|
-
}, y = (l, e) => {
|
|
169
|
-
const t = m[l], s = Array.isArray(t) ? t : [], g = s.includes(e) ? s.filter((A) => A !== e) : [...s, e];
|
|
170
|
-
x(l, g);
|
|
171
|
-
}, f = () => {
|
|
172
|
-
c(m), p(!1);
|
|
173
|
-
}, v = () => {
|
|
174
|
-
b({}), c({}), p(!1);
|
|
175
|
-
}, N = w(() => {
|
|
176
|
-
const l = new Set(a.flatMap((e) => e.filters.map((t) => t.key)));
|
|
177
|
-
return Object.entries(n).filter(([e, t]) => l.has(e) && ie(t)).length;
|
|
178
|
-
}, [a, n]);
|
|
179
|
-
return /* @__PURE__ */ u(R, { open: h, onOpenChange: p, children: [
|
|
180
|
-
/* @__PURE__ */ r(H, { asChild: !0, children: /* @__PURE__ */ u(F, { variant: "outline", className: "gap-2", children: [
|
|
181
|
-
/* @__PURE__ */ r(Z, { className: "size-4 shrink-0" }),
|
|
182
|
-
i ?? o("filters.more"),
|
|
183
|
-
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 })
|
|
184
|
-
] }) }),
|
|
185
|
-
/* @__PURE__ */ u(K, { side: "right", className: "w-[400px] sm:w-[500px] flex flex-col p-0", children: [
|
|
186
|
-
/* @__PURE__ */ r(X, { className: "p-6 pb-0", children: /* @__PURE__ */ r(G, { children: d ?? o("filters.advanced") }) }),
|
|
187
|
-
/* @__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: [
|
|
188
|
-
/* @__PURE__ */ r("h3", { className: "font-semibold text-sm text-gray-900 dark:text-gray-100 border-b pb-2", children: l.title }),
|
|
189
|
-
l.filters.map((t) => /* @__PURE__ */ u("div", { className: "space-y-2", children: [
|
|
190
|
-
/* @__PURE__ */ r(V, { htmlFor: t.key, children: t.label }),
|
|
191
|
-
/* @__PURE__ */ r(
|
|
192
|
-
oe,
|
|
193
|
-
{
|
|
194
|
-
field: t,
|
|
195
|
-
value: m[t.key],
|
|
196
|
-
onChange: (s) => {
|
|
197
|
-
x(t.key, s);
|
|
198
|
-
},
|
|
199
|
-
onToggleMultiSelect: (s) => {
|
|
200
|
-
y(t.key, s);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
)
|
|
204
|
-
] }, t.key))
|
|
205
|
-
] }, e)) }) }),
|
|
206
|
-
/* @__PURE__ */ u(J, { className: "gap-2 p-6 border-t bg-white dark:bg-gray-950", children: [
|
|
207
|
-
/* @__PURE__ */ r(F, { variant: "outline", className: "flex-1", onClick: v, children: "Effacer les filtres" }),
|
|
208
|
-
/* @__PURE__ */ r(F, { className: "flex-1 bg-orange-500 hover:bg-orange-600 text-white", onClick: f, children: "Rechercher" })
|
|
209
|
-
] })
|
|
210
|
-
] })
|
|
211
|
-
] });
|
|
212
|
-
}
|
|
213
|
-
function ue({
|
|
214
|
-
label: a,
|
|
215
|
-
options: n,
|
|
216
|
-
selected: c,
|
|
217
|
-
onToggle: i,
|
|
218
|
-
onClear: d,
|
|
219
|
-
onSelectAll: o,
|
|
220
|
-
searchable: h = !1,
|
|
221
|
-
searchPlaceholder: p
|
|
222
|
-
}) {
|
|
223
|
-
const { t: m } = S(), [b, x] = C(""), y = c.length > 0, f = w(() => b === "" ? n : n.filter((l) => l.label.toLowerCase().includes(b.toLowerCase())), [n, b]), v = w(() => f.length === 0 ? !1 : f.every((l) => c.includes(l.value)), [f, c]), N = () => {
|
|
224
|
-
if (v)
|
|
225
|
-
if (o !== void 0) {
|
|
226
|
-
const l = f.map((t) => t.value), e = c.filter((t) => !l.includes(t));
|
|
227
|
-
o(e);
|
|
228
|
-
} else d !== void 0 ? d() : c.forEach((l) => {
|
|
229
|
-
i(l);
|
|
230
|
-
});
|
|
231
|
-
else if (o !== void 0) {
|
|
232
|
-
const l = [...c];
|
|
233
|
-
f.forEach((e) => {
|
|
234
|
-
l.includes(e.value) || l.push(e.value);
|
|
235
|
-
}), o(l);
|
|
236
|
-
} else
|
|
237
|
-
f.forEach((l) => {
|
|
238
|
-
c.includes(l.value) || i(l.value);
|
|
239
|
-
});
|
|
240
|
-
};
|
|
241
|
-
return /* @__PURE__ */ u(
|
|
242
|
-
U,
|
|
243
|
-
{
|
|
244
|
-
onOpenChange: () => {
|
|
245
|
-
x("");
|
|
246
|
-
},
|
|
247
|
-
children: [
|
|
248
|
-
/* @__PURE__ */ r(W, { asChild: !0, children: /* @__PURE__ */ u(
|
|
249
|
-
"button",
|
|
250
|
-
{
|
|
251
|
-
className: j(
|
|
252
|
-
_,
|
|
253
|
-
"inline-flex items-center gap-1.5 whitespace-nowrap transition-colors",
|
|
254
|
-
y ? "border-primary bg-primary/10 text-primary font-medium" : "hover:bg-muted"
|
|
255
|
-
),
|
|
256
|
-
children: [
|
|
257
|
-
a,
|
|
258
|
-
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 }),
|
|
259
|
-
/* @__PURE__ */ r(q, { className: "size-3.5 opacity-60" })
|
|
260
|
-
]
|
|
261
|
-
}
|
|
262
|
-
) }),
|
|
263
|
-
/* @__PURE__ */ u(Y, { className: "w-56 p-0", align: "start", children: [
|
|
264
|
-
h ? /* @__PURE__ */ r("div", { className: "border-b border-border p-2", children: /* @__PURE__ */ u("div", { className: "relative", children: [
|
|
265
|
-
/* @__PURE__ */ r(ee, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
|
|
266
|
-
/* @__PURE__ */ r(
|
|
267
|
-
"input",
|
|
268
|
-
{
|
|
269
|
-
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",
|
|
270
|
-
placeholder: p ?? m("search.placeholder"),
|
|
271
|
-
value: b,
|
|
272
|
-
onChange: (l) => {
|
|
273
|
-
x(l.target.value);
|
|
274
|
-
},
|
|
275
|
-
autoFocus: !0
|
|
276
|
-
}
|
|
277
|
-
)
|
|
278
|
-
] }) }) : null,
|
|
279
|
-
/* @__PURE__ */ u("div", { className: "flex flex-col gap-0.5 max-h-56 overflow-y-auto p-1.5", children: [
|
|
280
|
-
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: [
|
|
281
|
-
/* @__PURE__ */ r(P, { checked: v, onCheckedChange: N }),
|
|
282
|
-
"Tout sélectionner"
|
|
283
|
-
] }),
|
|
284
|
-
f.length === 0 && /* @__PURE__ */ r("p", { className: "px-2 py-3 text-center text-xs text-muted-foreground", children: m("states.noResult") }),
|
|
285
|
-
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: [
|
|
286
|
-
/* @__PURE__ */ r(
|
|
287
|
-
P,
|
|
288
|
-
{
|
|
289
|
-
checked: c.includes(l.value),
|
|
290
|
-
onCheckedChange: () => {
|
|
291
|
-
i(l.value);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
),
|
|
295
|
-
l.color && /* @__PURE__ */ r("span", { className: "size-2.5 shrink-0 rounded-full", style: { backgroundColor: l.color } }),
|
|
296
|
-
l.label
|
|
297
|
-
] }, l.value))
|
|
298
|
-
] }),
|
|
299
|
-
c.length > 0 && /* @__PURE__ */ r("div", { className: "border-t border-border p-1.5", children: /* @__PURE__ */ r(
|
|
300
|
-
"button",
|
|
301
|
-
{
|
|
302
|
-
onClick: () => {
|
|
303
|
-
d !== void 0 ? d() : c.forEach((l) => {
|
|
304
|
-
i(l);
|
|
305
|
-
});
|
|
306
|
-
},
|
|
307
|
-
className: "w-full rounded-md px-2 py-1.5 text-xs text-muted-foreground hover:text-foreground hover:bg-muted transition-colors text-center",
|
|
308
|
-
children: "Tout désélectionner"
|
|
309
|
-
}
|
|
310
|
-
) })
|
|
311
|
-
] })
|
|
312
|
-
]
|
|
313
|
-
}
|
|
314
|
-
);
|
|
315
|
-
}
|
|
316
|
-
function Oe({
|
|
317
|
-
searchQuery: a,
|
|
318
|
-
onSearchChange: n,
|
|
319
|
-
searchPlaceholder: c,
|
|
320
|
-
filters: i,
|
|
321
|
-
onFiltersChange: d,
|
|
322
|
-
sections: o,
|
|
323
|
-
advancedButtonText: h = "Filtres",
|
|
324
|
-
sheetTitle: p
|
|
325
|
-
}) {
|
|
326
|
-
const { t: m } = S(), b = (e, t) => {
|
|
327
|
-
const s = i[e], g = Array.isArray(s) ? s : [], A = g.includes(t) ? g.filter((M) => M !== t) : [...g, t], k = { ...i };
|
|
328
|
-
A.length === 0 ? delete k[e] : k[e] = A, d(k);
|
|
329
|
-
}, x = (e) => {
|
|
330
|
-
const t = { ...i };
|
|
331
|
-
delete t[e], d(t);
|
|
332
|
-
}, y = () => {
|
|
333
|
-
d({});
|
|
334
|
-
}, f = (e, t) => {
|
|
335
|
-
const s = { ...i }, g = s[e];
|
|
336
|
-
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);
|
|
337
|
-
}, v = w(() => {
|
|
338
|
-
const e = [];
|
|
339
|
-
return o.forEach((t) => {
|
|
340
|
-
t.filters.forEach((s) => {
|
|
341
|
-
s.isQuickFilter === !0 && e.push({
|
|
342
|
-
key: s.key,
|
|
343
|
-
label: s.label,
|
|
344
|
-
options: s.options ?? [],
|
|
345
|
-
searchable: s.searchable,
|
|
346
|
-
searchPlaceholder: s.searchPlaceholder
|
|
347
|
-
});
|
|
348
|
-
});
|
|
349
|
-
}), e;
|
|
350
|
-
}, [o]), N = w(() => {
|
|
351
|
-
const e = {};
|
|
352
|
-
return o.forEach((t) => {
|
|
353
|
-
t.filters.forEach((s) => {
|
|
354
|
-
e[s.key] = s.badgeLabel ?? s.label;
|
|
355
|
-
});
|
|
356
|
-
}), e;
|
|
357
|
-
}, [o]), l = w(() => {
|
|
358
|
-
const e = {};
|
|
359
|
-
return o.forEach((t) => {
|
|
360
|
-
t.filters.forEach((s) => {
|
|
361
|
-
s.options !== void 0 && s.options.forEach((g) => {
|
|
362
|
-
e[`${s.key}_${g.value}`] = g.label;
|
|
363
|
-
});
|
|
364
|
-
});
|
|
365
|
-
}), e;
|
|
366
|
-
}, [o]);
|
|
367
|
-
return /* @__PURE__ */ u("div", { className: "space-y-4 w-full", children: [
|
|
368
|
-
/* @__PURE__ */ u("div", { className: "flex flex-wrap items-center gap-3 justify-between", children: [
|
|
369
|
-
/* @__PURE__ */ u("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
370
|
-
n !== void 0 ? /* @__PURE__ */ r(
|
|
371
|
-
B,
|
|
372
|
-
{
|
|
373
|
-
searchQuery: a,
|
|
374
|
-
onSearch: n,
|
|
375
|
-
onClear: () => {
|
|
376
|
-
n("");
|
|
377
|
-
},
|
|
378
|
-
placeholder: c ?? m("search.placeholder")
|
|
379
|
-
}
|
|
380
|
-
) : null,
|
|
381
|
-
v.map((e) => /* @__PURE__ */ r(
|
|
382
|
-
ue,
|
|
383
|
-
{
|
|
384
|
-
label: e.label,
|
|
385
|
-
options: e.options,
|
|
386
|
-
selected: Array.isArray(i[e.key]) ? i[e.key] : [],
|
|
387
|
-
onToggle: (t) => {
|
|
388
|
-
b(e.key, t);
|
|
389
|
-
},
|
|
390
|
-
onClear: () => {
|
|
391
|
-
x(e.key);
|
|
392
|
-
},
|
|
393
|
-
onSelectAll: (t) => {
|
|
394
|
-
d({ ...i, [e.key]: t });
|
|
395
|
-
},
|
|
396
|
-
searchable: e.searchable,
|
|
397
|
-
searchPlaceholder: e.searchPlaceholder
|
|
398
|
-
},
|
|
399
|
-
e.key
|
|
400
|
-
))
|
|
401
|
-
] }),
|
|
402
|
-
o.length > 0 && /* @__PURE__ */ r(de, { sections: o, filters: i, onFiltersChange: d, buttonText: h, sheetTitle: p })
|
|
403
|
-
] }),
|
|
404
|
-
/* @__PURE__ */ r(
|
|
405
|
-
ce,
|
|
406
|
-
{
|
|
407
|
-
filters: i,
|
|
408
|
-
onRemoveFilter: f,
|
|
409
|
-
onClearAll: y,
|
|
410
|
-
filterLabels: N,
|
|
411
|
-
optionLabels: l
|
|
412
|
-
}
|
|
413
|
-
)
|
|
414
|
-
] });
|
|
415
|
-
}
|
|
416
|
-
export {
|
|
417
|
-
ce as A,
|
|
418
|
-
oe as F,
|
|
419
|
-
ue as S,
|
|
420
|
-
Oe as T,
|
|
421
|
-
de as a
|
|
422
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { jsx as a, jsxs as l } from "react/jsx-runtime";
|
|
2
|
-
import "date-fns/locale";
|
|
3
|
-
import "react-i18next";
|
|
4
|
-
import { u } from "./useKrosoftTranslation-BTp46G94.js";
|
|
5
|
-
import { b as g, T as f, c as v, B as b, a as p } from "./tooltip-DVeqVwqV.js";
|
|
6
|
-
import { S as N, h as T, i as x, a as C, c as S } from "./select-BpjFWqAY.js";
|
|
7
|
-
import { u as y } from "./useTheme-DS6ZjdzM.js";
|
|
8
|
-
function w({ themeOptions: c, variant: o = "select", id: t }) {
|
|
9
|
-
const { t: i } = u(), { theme: n, handleThemeChange: m, currentThemeOption: e, nextThemeOption: r, cycleTheme: d } = y(c);
|
|
10
|
-
if (o === "mini") {
|
|
11
|
-
const s = e == null ? void 0 : e.icon;
|
|
12
|
-
return /* @__PURE__ */ a(g, { children: /* @__PURE__ */ l(f, { children: [
|
|
13
|
-
/* @__PURE__ */ a(v, { asChild: !0, children: /* @__PURE__ */ l(
|
|
14
|
-
b,
|
|
15
|
-
{
|
|
16
|
-
id: t,
|
|
17
|
-
variant: "ghost",
|
|
18
|
-
size: "icon",
|
|
19
|
-
onClick: d,
|
|
20
|
-
className: "text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
21
|
-
children: [
|
|
22
|
-
s && /* @__PURE__ */ a(s, { className: "size-4" }),
|
|
23
|
-
/* @__PURE__ */ l("span", { className: "sr-only", children: [
|
|
24
|
-
"Thème actuel : ",
|
|
25
|
-
e == null ? void 0 : e.label
|
|
26
|
-
] })
|
|
27
|
-
]
|
|
28
|
-
}
|
|
29
|
-
) }),
|
|
30
|
-
/* @__PURE__ */ l(p, { side: "bottom", align: "center", children: [
|
|
31
|
-
"Passer en ",
|
|
32
|
-
r == null ? void 0 : r.label
|
|
33
|
-
] })
|
|
34
|
-
] }) });
|
|
35
|
-
}
|
|
36
|
-
return /* @__PURE__ */ l("div", { className: "space-y-2", children: [
|
|
37
|
-
/* @__PURE__ */ l(N, { value: n, onValueChange: m, children: [
|
|
38
|
-
/* @__PURE__ */ a(T, { id: t, className: "w-full", children: /* @__PURE__ */ a(x, { placeholder: i("select.theme") }) }),
|
|
39
|
-
/* @__PURE__ */ a(C, { children: c.map((s) => {
|
|
40
|
-
const h = s.icon;
|
|
41
|
-
return /* @__PURE__ */ a(S, { value: s.value, children: /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
42
|
-
/* @__PURE__ */ a(h, { className: "size-4" }),
|
|
43
|
-
s.label
|
|
44
|
-
] }) }, s.value);
|
|
45
|
-
}) })
|
|
46
|
-
] }),
|
|
47
|
-
(e == null ? void 0 : e.message) && /* @__PURE__ */ a("p", { className: "text-sm text-muted-foreground", children: e.message })
|
|
48
|
-
] });
|
|
49
|
-
}
|
|
50
|
-
export {
|
|
51
|
-
w as T
|
|
52
|
-
};
|