@krosoft/react 0.0.237 → 0.0.239
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,8 +1,427 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { t as e } from "../../../tailwind.helper-CJaRYBmL.js";
|
|
2
|
+
import { At as t, Pn as n, bn as r } from "../../../ui-CiX0E_bn.js";
|
|
3
|
+
import { a as i, s as a } from "../../../tooltip-B2dzyfs9.js";
|
|
4
|
+
import { t as o } from "../../../i18n-Dw99bRmg.js";
|
|
5
|
+
import { a as s, g as c, h as l, l as u, m as d, o as f, p, r as m, t as h, u as g } from "../../../sheet-CRrYTZrl.js";
|
|
6
|
+
import { i as _, l as v, n as y, t as b, u as x } from "../../../select-ULiTPOr5.js";
|
|
7
|
+
import { t as S } from "../../../MultiSelect-BF0zL0B0.js";
|
|
8
|
+
import { i as C, n as w, r as T, t as E } from "../../../SearchInput-BJPT0SbB.js";
|
|
9
|
+
import { useEffect as D, useMemo as O, useState as k } from "react";
|
|
10
|
+
import { jsx as A, jsxs as j } from "react/jsx-runtime";
|
|
11
|
+
import { getLocale as M } from "@krosoft/core/helpers";
|
|
12
|
+
import { ChevronDown as N, Filter as P, Search as F, XIcon as I } from "lucide-react";
|
|
13
|
+
//#region src/components/core/filters/ActiveFilters.tsx
|
|
14
|
+
var L = (e, t, n, r = {}) => {
|
|
15
|
+
if (t instanceof Date) return t.toLocaleDateString(M());
|
|
16
|
+
let i = String(t), a = r[`${e}_${i}`];
|
|
17
|
+
return a === void 0 ? e.includes("ok") || t === "true" || t === "false" ? n(t === "true" ? "filters.yes" : "filters.no") : i : a;
|
|
8
18
|
};
|
|
19
|
+
function R({ filters: e, onRemoveFilter: t, onClearAll: r, filterLabels: i = {}, optionLabels: a = {} }) {
|
|
20
|
+
let { t: s } = o(), c = Object.entries(e).filter(([e, t]) => !(t == null || t === "" || Array.isArray(t) && t.length === 0));
|
|
21
|
+
return c.length === 0 ? null : /* @__PURE__ */ j("div", {
|
|
22
|
+
className: "flex flex-wrap items-center gap-2 mb-4",
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ A("span", {
|
|
25
|
+
className: "text-sm text-gray-600 font-medium",
|
|
26
|
+
children: "Filtres actifs :"
|
|
27
|
+
}),
|
|
28
|
+
c.flatMap(([e, r]) => {
|
|
29
|
+
let o = i[e] ?? e;
|
|
30
|
+
if (Array.isArray(r)) return r.map((r) => {
|
|
31
|
+
let i = L(e, r, s, a);
|
|
32
|
+
return /* @__PURE__ */ j(n, {
|
|
33
|
+
variant: "secondary",
|
|
34
|
+
className: "flex items-center gap-1 px-3 py-1 bg-blue-50 text-blue-700 border border-blue-200 hover:bg-blue-100",
|
|
35
|
+
children: [
|
|
36
|
+
o,
|
|
37
|
+
": ",
|
|
38
|
+
i,
|
|
39
|
+
/* @__PURE__ */ A("button", {
|
|
40
|
+
onClick: () => {
|
|
41
|
+
t(e, r);
|
|
42
|
+
},
|
|
43
|
+
className: "ml-1 hover:bg-blue-200 rounded-full p-0.5",
|
|
44
|
+
children: /* @__PURE__ */ A(I, { className: "size-4" })
|
|
45
|
+
})
|
|
46
|
+
]
|
|
47
|
+
}, `${e}_${String(r)}`);
|
|
48
|
+
});
|
|
49
|
+
let c = L(e, r, s, a);
|
|
50
|
+
return /* @__PURE__ */ j(n, {
|
|
51
|
+
variant: "secondary",
|
|
52
|
+
className: "flex items-center gap-1 px-3 py-1 bg-blue-50 text-blue-700 border border-blue-200 hover:bg-blue-100",
|
|
53
|
+
children: [
|
|
54
|
+
o,
|
|
55
|
+
": ",
|
|
56
|
+
c,
|
|
57
|
+
/* @__PURE__ */ A("button", {
|
|
58
|
+
onClick: () => {
|
|
59
|
+
t(e);
|
|
60
|
+
},
|
|
61
|
+
className: "ml-1 hover:bg-blue-200 rounded-full p-0.5",
|
|
62
|
+
children: /* @__PURE__ */ A(I, { className: "size-4" })
|
|
63
|
+
})
|
|
64
|
+
]
|
|
65
|
+
}, e);
|
|
66
|
+
}),
|
|
67
|
+
c.length > 0 && /* @__PURE__ */ A("button", {
|
|
68
|
+
onClick: r,
|
|
69
|
+
className: "text-xs text-red-500 hover:text-red-600 transition-colors font-medium ml-auto",
|
|
70
|
+
children: "Effacer tout"
|
|
71
|
+
})
|
|
72
|
+
]
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/components/core/filters/FilterField.tsx
|
|
77
|
+
var z = ({ field: t, value: n, onChange: r, onToggleMultiSelect: i }) => {
|
|
78
|
+
let { t: a } = o();
|
|
79
|
+
switch (t.type) {
|
|
80
|
+
case "text": return /* @__PURE__ */ A(c, {
|
|
81
|
+
placeholder: t.placeholder,
|
|
82
|
+
value: n ?? "",
|
|
83
|
+
onChange: (e) => {
|
|
84
|
+
r(e.target.value);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
case "number": return /* @__PURE__ */ A(c, {
|
|
88
|
+
type: "number",
|
|
89
|
+
placeholder: t.placeholder,
|
|
90
|
+
value: n ?? "",
|
|
91
|
+
onChange: (e) => {
|
|
92
|
+
r(e.target.value);
|
|
93
|
+
},
|
|
94
|
+
min: t.min,
|
|
95
|
+
max: t.max
|
|
96
|
+
});
|
|
97
|
+
case "select": return t.searchable === !0 ? /* @__PURE__ */ A(w, {
|
|
98
|
+
options: t.options ?? [],
|
|
99
|
+
value: n,
|
|
100
|
+
onChange: r,
|
|
101
|
+
placeholder: t.placeholder,
|
|
102
|
+
searchPlaceholder: t.searchPlaceholder
|
|
103
|
+
}) : /* @__PURE__ */ j(b, {
|
|
104
|
+
value: n ?? "",
|
|
105
|
+
onValueChange: r,
|
|
106
|
+
children: [/* @__PURE__ */ A(v, {
|
|
107
|
+
className: e((n === void 0 || n === "") && "text-muted-foreground"),
|
|
108
|
+
children: /* @__PURE__ */ A(x, { placeholder: t.placeholder })
|
|
109
|
+
}), /* @__PURE__ */ A(y, { children: t.options?.map((e) => /* @__PURE__ */ A(_, {
|
|
110
|
+
value: e.value,
|
|
111
|
+
children: e.label
|
|
112
|
+
}, e.value)) })]
|
|
113
|
+
});
|
|
114
|
+
case "date": return /* @__PURE__ */ A(C, {
|
|
115
|
+
date: n,
|
|
116
|
+
onDateChange: r,
|
|
117
|
+
placeholder: t.placeholder ?? a("date.pickDate")
|
|
118
|
+
});
|
|
119
|
+
case "date-range": return /* @__PURE__ */ A(T, {
|
|
120
|
+
value: n,
|
|
121
|
+
onChange: r,
|
|
122
|
+
placeholder: t.placeholder
|
|
123
|
+
});
|
|
124
|
+
case "multi-select": return /* @__PURE__ */ A(S, {
|
|
125
|
+
options: t.options ?? [],
|
|
126
|
+
selected: n ?? [],
|
|
127
|
+
onToggle: i,
|
|
128
|
+
onClear: () => {
|
|
129
|
+
r([]);
|
|
130
|
+
},
|
|
131
|
+
onSelectAll: r,
|
|
132
|
+
placeholder: t.placeholder,
|
|
133
|
+
searchable: t.searchable,
|
|
134
|
+
searchPlaceholder: t.searchPlaceholder
|
|
135
|
+
});
|
|
136
|
+
default: return null;
|
|
137
|
+
}
|
|
138
|
+
}, B = (e) => !(e == null || e === "" || Array.isArray(e) && e.length === 0);
|
|
139
|
+
function V({ sections: e, filters: n, onFiltersChange: r, buttonText: i, sheetTitle: c }) {
|
|
140
|
+
let { t: l } = o(), [d, p] = k(!1), [_, v] = k(n);
|
|
141
|
+
D(() => {
|
|
142
|
+
v(n);
|
|
143
|
+
}, [n, d]);
|
|
144
|
+
let y = (e, t) => {
|
|
145
|
+
v((n) => ({
|
|
146
|
+
...n,
|
|
147
|
+
[e]: t
|
|
148
|
+
}));
|
|
149
|
+
}, b = (e, t) => {
|
|
150
|
+
let n = _[e], r = Array.isArray(n) ? n : [], i = r.includes(t) ? r.filter((e) => e !== t) : [...r, t];
|
|
151
|
+
y(e, i);
|
|
152
|
+
}, x = () => {
|
|
153
|
+
r(_), p(!1);
|
|
154
|
+
}, S = () => {
|
|
155
|
+
v({}), r({}), p(!1);
|
|
156
|
+
}, C = O(() => {
|
|
157
|
+
let t = new Set(e.flatMap((e) => e.filters.map((e) => e.key)));
|
|
158
|
+
return Object.entries(n).filter(([e, n]) => t.has(e) && B(n)).length;
|
|
159
|
+
}, [e, n]);
|
|
160
|
+
return /* @__PURE__ */ j(h, {
|
|
161
|
+
open: d,
|
|
162
|
+
onOpenChange: p,
|
|
163
|
+
children: [/* @__PURE__ */ A(g, {
|
|
164
|
+
asChild: !0,
|
|
165
|
+
children: /* @__PURE__ */ j(a, {
|
|
166
|
+
variant: "outline",
|
|
167
|
+
className: "gap-2",
|
|
168
|
+
children: [
|
|
169
|
+
/* @__PURE__ */ A(P, { className: "size-4 shrink-0" }),
|
|
170
|
+
i ?? l("filters.more"),
|
|
171
|
+
C > 0 && /* @__PURE__ */ A("span", {
|
|
172
|
+
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",
|
|
173
|
+
children: C
|
|
174
|
+
})
|
|
175
|
+
]
|
|
176
|
+
})
|
|
177
|
+
}), /* @__PURE__ */ j(m, {
|
|
178
|
+
side: "right",
|
|
179
|
+
className: "w-[400px] sm:w-[500px] flex flex-col p-0",
|
|
180
|
+
children: [
|
|
181
|
+
/* @__PURE__ */ A(f, {
|
|
182
|
+
className: "p-6 pb-0",
|
|
183
|
+
children: /* @__PURE__ */ A(u, { children: c ?? l("filters.advanced") })
|
|
184
|
+
}),
|
|
185
|
+
/* @__PURE__ */ A("div", {
|
|
186
|
+
className: "flex-1 overflow-y-auto p-6 pt-6",
|
|
187
|
+
children: /* @__PURE__ */ A("div", {
|
|
188
|
+
className: "space-y-6",
|
|
189
|
+
children: e.map((e, n) => /* @__PURE__ */ j("div", {
|
|
190
|
+
className: "space-y-4",
|
|
191
|
+
children: [/* @__PURE__ */ A("h3", {
|
|
192
|
+
className: "font-semibold text-sm text-gray-900 dark:text-gray-100 border-b pb-2",
|
|
193
|
+
children: e.title
|
|
194
|
+
}), e.filters.map((e) => /* @__PURE__ */ j("div", {
|
|
195
|
+
className: "space-y-2",
|
|
196
|
+
children: [/* @__PURE__ */ A(t, {
|
|
197
|
+
htmlFor: e.key,
|
|
198
|
+
children: e.label
|
|
199
|
+
}), /* @__PURE__ */ A(z, {
|
|
200
|
+
field: e,
|
|
201
|
+
value: _[e.key],
|
|
202
|
+
onChange: (t) => {
|
|
203
|
+
y(e.key, t);
|
|
204
|
+
},
|
|
205
|
+
onToggleMultiSelect: (t) => {
|
|
206
|
+
b(e.key, t);
|
|
207
|
+
}
|
|
208
|
+
})]
|
|
209
|
+
}, e.key))]
|
|
210
|
+
}, n))
|
|
211
|
+
})
|
|
212
|
+
}),
|
|
213
|
+
/* @__PURE__ */ j(s, {
|
|
214
|
+
className: "gap-2 p-6 border-t bg-white dark:bg-gray-950",
|
|
215
|
+
children: [/* @__PURE__ */ A(a, {
|
|
216
|
+
variant: "outline",
|
|
217
|
+
className: "flex-1",
|
|
218
|
+
onClick: S,
|
|
219
|
+
children: "Effacer les filtres"
|
|
220
|
+
}), /* @__PURE__ */ A(a, {
|
|
221
|
+
className: "flex-1 bg-orange-500 hover:bg-orange-600 text-white",
|
|
222
|
+
onClick: x,
|
|
223
|
+
children: "Rechercher"
|
|
224
|
+
})]
|
|
225
|
+
})
|
|
226
|
+
]
|
|
227
|
+
})]
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
//#endregion
|
|
231
|
+
//#region src/components/core/filters/SearchableFilterPill.tsx
|
|
232
|
+
function H({ label: t, options: n, selected: a, onToggle: s, onClear: c, onSelectAll: u, searchable: f = !1, searchPlaceholder: m }) {
|
|
233
|
+
let { t: h } = o(), [g, _] = k(""), v = a.length > 0, y = O(() => g === "" ? n : n.filter((e) => e.label.toLowerCase().includes(g.toLowerCase())), [n, g]), b = O(() => y.length !== 0 && y.every((e) => a.includes(e.value)), [y, a]);
|
|
234
|
+
return /* @__PURE__ */ j(p, {
|
|
235
|
+
onOpenChange: () => {
|
|
236
|
+
_("");
|
|
237
|
+
},
|
|
238
|
+
children: [/* @__PURE__ */ A(l, {
|
|
239
|
+
asChild: !0,
|
|
240
|
+
children: /* @__PURE__ */ j("button", {
|
|
241
|
+
className: e(i, "inline-flex items-center gap-1.5 whitespace-nowrap transition-colors", v ? "border-primary bg-primary/10 text-primary font-medium" : "hover:bg-muted"),
|
|
242
|
+
children: [
|
|
243
|
+
t,
|
|
244
|
+
a.length > 0 && /* @__PURE__ */ A("span", {
|
|
245
|
+
className: "flex h-4 min-w-[16px] items-center justify-center rounded-full bg-primary px-1 text-[10px] font-bold text-primary-foreground",
|
|
246
|
+
children: a.length
|
|
247
|
+
}),
|
|
248
|
+
/* @__PURE__ */ A(N, { className: "size-3.5 opacity-60" })
|
|
249
|
+
]
|
|
250
|
+
})
|
|
251
|
+
}), /* @__PURE__ */ j(d, {
|
|
252
|
+
className: "w-56 p-0",
|
|
253
|
+
align: "start",
|
|
254
|
+
children: [
|
|
255
|
+
f ? /* @__PURE__ */ A("div", {
|
|
256
|
+
className: "border-b border-border p-2",
|
|
257
|
+
children: /* @__PURE__ */ j("div", {
|
|
258
|
+
className: "relative",
|
|
259
|
+
children: [/* @__PURE__ */ A(F, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }), /* @__PURE__ */ A("input", {
|
|
260
|
+
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",
|
|
261
|
+
placeholder: m ?? h("search.placeholder"),
|
|
262
|
+
value: g,
|
|
263
|
+
onChange: (e) => {
|
|
264
|
+
_(e.target.value);
|
|
265
|
+
},
|
|
266
|
+
autoFocus: !0
|
|
267
|
+
})]
|
|
268
|
+
})
|
|
269
|
+
}) : null,
|
|
270
|
+
/* @__PURE__ */ j("div", {
|
|
271
|
+
className: "flex flex-col gap-0.5 max-h-56 overflow-y-auto p-1.5",
|
|
272
|
+
children: [
|
|
273
|
+
y.length > 0 && /* @__PURE__ */ j("label", {
|
|
274
|
+
className: "flex items-center gap-2.5 rounded-md px-2 py-2 text-sm hover:bg-muted cursor-pointer transition-colors",
|
|
275
|
+
children: [/* @__PURE__ */ A(r, {
|
|
276
|
+
checked: b,
|
|
277
|
+
onCheckedChange: () => {
|
|
278
|
+
if (b) {
|
|
279
|
+
if (u !== void 0) {
|
|
280
|
+
let e = y.map((e) => e.value);
|
|
281
|
+
u(a.filter((t) => !e.includes(t)));
|
|
282
|
+
} else c === void 0 ? a.forEach((e) => {
|
|
283
|
+
s(e);
|
|
284
|
+
}) : c();
|
|
285
|
+
} else if (u !== void 0) {
|
|
286
|
+
let e = [...a];
|
|
287
|
+
y.forEach((t) => {
|
|
288
|
+
e.includes(t.value) || e.push(t.value);
|
|
289
|
+
}), u(e);
|
|
290
|
+
} else y.forEach((e) => {
|
|
291
|
+
a.includes(e.value) || s(e.value);
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
}), "Tout sélectionner"]
|
|
295
|
+
}),
|
|
296
|
+
y.length === 0 && /* @__PURE__ */ A("p", {
|
|
297
|
+
className: "px-2 py-3 text-center text-xs text-muted-foreground",
|
|
298
|
+
children: h("states.noResult")
|
|
299
|
+
}),
|
|
300
|
+
y.map((e) => /* @__PURE__ */ j("label", {
|
|
301
|
+
className: "flex items-center gap-2.5 rounded-md px-2 py-2 text-sm hover:bg-muted cursor-pointer transition-colors",
|
|
302
|
+
children: [
|
|
303
|
+
/* @__PURE__ */ A(r, {
|
|
304
|
+
checked: a.includes(e.value),
|
|
305
|
+
onCheckedChange: () => {
|
|
306
|
+
s(e.value);
|
|
307
|
+
}
|
|
308
|
+
}),
|
|
309
|
+
e.color && /* @__PURE__ */ A("span", {
|
|
310
|
+
className: "size-2.5 shrink-0 rounded-full",
|
|
311
|
+
style: { backgroundColor: e.color }
|
|
312
|
+
}),
|
|
313
|
+
e.label
|
|
314
|
+
]
|
|
315
|
+
}, e.value))
|
|
316
|
+
]
|
|
317
|
+
}),
|
|
318
|
+
a.length > 0 && /* @__PURE__ */ A("div", {
|
|
319
|
+
className: "border-t border-border p-1.5",
|
|
320
|
+
children: /* @__PURE__ */ A("button", {
|
|
321
|
+
onClick: () => {
|
|
322
|
+
c === void 0 ? a.forEach((e) => {
|
|
323
|
+
s(e);
|
|
324
|
+
}) : c();
|
|
325
|
+
},
|
|
326
|
+
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",
|
|
327
|
+
children: "Tout désélectionner"
|
|
328
|
+
})
|
|
329
|
+
})
|
|
330
|
+
]
|
|
331
|
+
})]
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
//#endregion
|
|
335
|
+
//#region src/components/core/filters/TableFilter.tsx
|
|
336
|
+
function U({ searchQuery: e, onSearchChange: t, searchPlaceholder: n, filters: r, onFiltersChange: i, sections: a, advancedButtonText: s = "Filtres", sheetTitle: c }) {
|
|
337
|
+
let { t: l } = o(), u = (e, t) => {
|
|
338
|
+
let n = r[e], a = Array.isArray(n) ? n : [], o = a.includes(t) ? a.filter((e) => e !== t) : [...a, t], s = { ...r };
|
|
339
|
+
o.length === 0 ? delete s[e] : s[e] = o, i(s);
|
|
340
|
+
}, d = (e) => {
|
|
341
|
+
let t = { ...r };
|
|
342
|
+
delete t[e], i(t);
|
|
343
|
+
}, f = () => {
|
|
344
|
+
i({});
|
|
345
|
+
}, p = (e, t) => {
|
|
346
|
+
let n = { ...r }, a = n[e];
|
|
347
|
+
Array.isArray(a) ? t === void 0 ? delete n[e] : (n[e] = a.filter((e) => e !== t), Array.isArray(n[e]) && n[e].length === 0 && delete n[e]) : delete n[e], i(n);
|
|
348
|
+
}, m = O(() => {
|
|
349
|
+
let e = [];
|
|
350
|
+
return a.forEach((t) => {
|
|
351
|
+
t.filters.forEach((t) => {
|
|
352
|
+
t.isQuickFilter === !0 && e.push({
|
|
353
|
+
key: t.key,
|
|
354
|
+
label: t.label,
|
|
355
|
+
options: t.options ?? [],
|
|
356
|
+
searchable: t.searchable,
|
|
357
|
+
searchPlaceholder: t.searchPlaceholder
|
|
358
|
+
});
|
|
359
|
+
});
|
|
360
|
+
}), e;
|
|
361
|
+
}, [a]), h = O(() => {
|
|
362
|
+
let e = {};
|
|
363
|
+
return a.forEach((t) => {
|
|
364
|
+
t.filters.forEach((t) => {
|
|
365
|
+
e[t.key] = t.badgeLabel ?? t.label;
|
|
366
|
+
});
|
|
367
|
+
}), e;
|
|
368
|
+
}, [a]), g = O(() => {
|
|
369
|
+
let e = {};
|
|
370
|
+
return a.forEach((t) => {
|
|
371
|
+
t.filters.forEach((t) => {
|
|
372
|
+
t.options !== void 0 && t.options.forEach((n) => {
|
|
373
|
+
e[`${t.key}_${n.value}`] = n.label;
|
|
374
|
+
});
|
|
375
|
+
});
|
|
376
|
+
}), e;
|
|
377
|
+
}, [a]);
|
|
378
|
+
return /* @__PURE__ */ j("div", {
|
|
379
|
+
className: "space-y-4 w-full",
|
|
380
|
+
children: [/* @__PURE__ */ j("div", {
|
|
381
|
+
className: "flex flex-wrap items-center gap-3 justify-between",
|
|
382
|
+
children: [/* @__PURE__ */ j("div", {
|
|
383
|
+
className: "flex flex-wrap items-center gap-3",
|
|
384
|
+
children: [t === void 0 ? null : /* @__PURE__ */ A(E, {
|
|
385
|
+
searchQuery: e,
|
|
386
|
+
onSearch: t,
|
|
387
|
+
onClear: () => {
|
|
388
|
+
t("");
|
|
389
|
+
},
|
|
390
|
+
placeholder: n ?? l("search.placeholder")
|
|
391
|
+
}), m.map((e) => /* @__PURE__ */ A(H, {
|
|
392
|
+
label: e.label,
|
|
393
|
+
options: e.options,
|
|
394
|
+
selected: Array.isArray(r[e.key]) ? r[e.key] : [],
|
|
395
|
+
onToggle: (t) => {
|
|
396
|
+
u(e.key, t);
|
|
397
|
+
},
|
|
398
|
+
onClear: () => {
|
|
399
|
+
d(e.key);
|
|
400
|
+
},
|
|
401
|
+
onSelectAll: (t) => {
|
|
402
|
+
i({
|
|
403
|
+
...r,
|
|
404
|
+
[e.key]: t
|
|
405
|
+
});
|
|
406
|
+
},
|
|
407
|
+
searchable: e.searchable,
|
|
408
|
+
searchPlaceholder: e.searchPlaceholder
|
|
409
|
+
}, e.key))]
|
|
410
|
+
}), a.length > 0 && /* @__PURE__ */ A(V, {
|
|
411
|
+
sections: a,
|
|
412
|
+
filters: r,
|
|
413
|
+
onFiltersChange: i,
|
|
414
|
+
buttonText: s,
|
|
415
|
+
sheetTitle: c
|
|
416
|
+
})]
|
|
417
|
+
}), /* @__PURE__ */ A(R, {
|
|
418
|
+
filters: r,
|
|
419
|
+
onRemoveFilter: p,
|
|
420
|
+
onClearAll: f,
|
|
421
|
+
filterLabels: h,
|
|
422
|
+
optionLabels: g
|
|
423
|
+
})]
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
//#endregion
|
|
427
|
+
export { R as ActiveFilters, V as AdvancedFilters, z as FilterField, H as SearchableFilterPill, U as TableFilter };
|
|
@@ -1,97 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
export {
|
|
25
|
-
Fa as ACTIONS_COLUMN_KEY,
|
|
26
|
-
G as ActiveFilters,
|
|
27
|
-
_ as AdvancedFilters,
|
|
28
|
-
ea as AppActions,
|
|
29
|
-
T as AppDialog,
|
|
30
|
-
oa as AppPageHeader,
|
|
31
|
-
ia as AppSubTitle,
|
|
32
|
-
Ga as AppTabContainer,
|
|
33
|
-
_a as AppTabHeader,
|
|
34
|
-
va as AppTabs,
|
|
35
|
-
pa as AppTitle,
|
|
36
|
-
ya as AppVerticalTabs,
|
|
37
|
-
m as BarChartHorizontal,
|
|
38
|
-
C as BarChartVertical,
|
|
39
|
-
n as CHART_COLORS,
|
|
40
|
-
b as ChartCard,
|
|
41
|
-
f as CircularGauge,
|
|
42
|
-
x as ConfirmationDialog,
|
|
43
|
-
r as DashboardCard,
|
|
44
|
-
La as DataTable,
|
|
45
|
-
q as DatePicker,
|
|
46
|
-
w as DateRangePicker,
|
|
47
|
-
F as Dialog,
|
|
48
|
-
L as DialogClose,
|
|
49
|
-
P as DialogContent,
|
|
50
|
-
u as DialogDescription,
|
|
51
|
-
E as DialogFooter,
|
|
52
|
-
H as DialogHeader,
|
|
53
|
-
I as DialogOverlay,
|
|
54
|
-
K as DialogPortal,
|
|
55
|
-
N as DialogTitle,
|
|
56
|
-
O as DialogTrigger,
|
|
57
|
-
da as ErrorAlert,
|
|
58
|
-
Ta as ErrorState,
|
|
59
|
-
v as FilterField,
|
|
60
|
-
D as FormDialog,
|
|
61
|
-
V as GenericForm,
|
|
62
|
-
ma as GlobalSearch,
|
|
63
|
-
z as ImageInput,
|
|
64
|
-
t as KpiCard,
|
|
65
|
-
i as KpiCards,
|
|
66
|
-
sa as KpiCardsLayout,
|
|
67
|
-
$ as LanguageSelector,
|
|
68
|
-
A as LineChart,
|
|
69
|
-
Da as LoadingState,
|
|
70
|
-
o as MetricCard,
|
|
71
|
-
X as MultiSelect,
|
|
72
|
-
Ca as NotificationsBell,
|
|
73
|
-
c as PieChart,
|
|
74
|
-
M as Progress,
|
|
75
|
-
Pa as SELECTION_COLUMN_KEY,
|
|
76
|
-
J as SearchInput,
|
|
77
|
-
y as SearchableFilterPill,
|
|
78
|
-
Q as SearchableSelect,
|
|
79
|
-
na as Sidebar,
|
|
80
|
-
ba as SidebarHeader,
|
|
81
|
-
fa as SidebarNavItem,
|
|
82
|
-
l as SkeletonCard,
|
|
83
|
-
p as SkeletonCards,
|
|
84
|
-
ua as TableActions,
|
|
85
|
-
Ea as TableBody,
|
|
86
|
-
Ha as TableBulkActions,
|
|
87
|
-
R as TableFilter,
|
|
88
|
-
Ia as TableHeader,
|
|
89
|
-
Ka as TablePagination,
|
|
90
|
-
Na as TableSettings,
|
|
91
|
-
Ua as ThemeSelector,
|
|
92
|
-
Aa as Topbar,
|
|
93
|
-
Oa as getAlignmentClass,
|
|
94
|
-
d as getChartColor,
|
|
95
|
-
Ba as getColumnAlignment,
|
|
96
|
-
Ma as getFixedCellProps
|
|
97
|
-
};
|
|
1
|
+
import { a as e, i as t, n, o as r, r as i, t as a } from "../../cards-Cta6x49J.js";
|
|
2
|
+
import { I as o } from "../../ui-CiX0E_bn.js";
|
|
3
|
+
import { A as s, D as c, E as l, F as u, M as d, N as f, O as p, P as m, j as h, k as g } from "../../sheet-CRrYTZrl.js";
|
|
4
|
+
import { a as _, c as v, i as y, n as b, o as x, r as S, s as C, t as w } from "../../charts-CXhVUqLH.js";
|
|
5
|
+
import { n as T, r as E, t as D } from "../../dialogs-BGHSClsq.js";
|
|
6
|
+
import { t as O } from "../../ImageInput-CN2ozjpc.js";
|
|
7
|
+
import { t as k } from "../../AppActions-C_0YI75w.js";
|
|
8
|
+
import { t as A } from "../../AppSubTitle-tqqV9nuT.js";
|
|
9
|
+
import { t as j } from "../../MultiSelect-BF0zL0B0.js";
|
|
10
|
+
import { t as M } from "../../GenericForm-CWXT5wiv.js";
|
|
11
|
+
import { t as N } from "../../ErrorAlert-BDqDHUUc.js";
|
|
12
|
+
import { i as P, n as F, r as I, t as L } from "../../SearchInput-BJPT0SbB.js";
|
|
13
|
+
import { ActiveFilters as R, AdvancedFilters as z, FilterField as B, SearchableFilterPill as V, TableFilter as H } from "./filters/index.js";
|
|
14
|
+
import "./forms/index.js";
|
|
15
|
+
import "./inputs/index.js";
|
|
16
|
+
import { t as U } from "../../language-DxHhlpgN.js";
|
|
17
|
+
import { t as W } from "../../AppTitle-BR4JFZfp.js";
|
|
18
|
+
import { n as G, t as K } from "../../states-N8-LjFng.js";
|
|
19
|
+
import { AppPageHeader as q, KpiCardsLayout as J } from "./layouts/index.js";
|
|
20
|
+
import { a as Y, i as X, n as Z, o as Q, r as $, t as ee } from "../../navbar-Bc5OQWRI.js";
|
|
21
|
+
import { a as te, c as ne, d as re, f as ie, i as ae, l as oe, n as se, o as ce, r as le, s as ue, t as de, u as fe } from "../../table-muUyiaK6.js";
|
|
22
|
+
import { AppTabContainer as pe, AppTabHeader as me, AppTabs as he, AppVerticalTabs as ge } from "./tabs/index.js";
|
|
23
|
+
import { t as _e } from "../../theme-B_n0F6R4.js";
|
|
24
|
+
export { ue as ACTIONS_COLUMN_KEY, R as ActiveFilters, z as AdvancedFilters, k as AppActions, E as AppDialog, q as AppPageHeader, A as AppSubTitle, pe as AppTabContainer, me as AppTabHeader, he as AppTabs, W as AppTitle, ge as AppVerticalTabs, v as BarChartHorizontal, C as BarChartVertical, _ as CHART_COLORS, y as ChartCard, S as CircularGauge, D as ConfirmationDialog, r as DashboardCard, de as DataTable, P as DatePicker, I as DateRangePicker, l as Dialog, c as DialogClose, p as DialogContent, g as DialogDescription, s as DialogFooter, h as DialogHeader, d as DialogOverlay, f as DialogPortal, m as DialogTitle, u as DialogTrigger, N as ErrorAlert, G as ErrorState, B as FilterField, T as FormDialog, M as GenericForm, Q as GlobalSearch, O as ImageInput, e as KpiCard, t as KpiCards, J as KpiCardsLayout, U as LanguageSelector, b as LineChart, K as LoadingState, i as MetricCard, j as MultiSelect, Y as NotificationsBell, w as PieChart, o as Progress, ne as SELECTION_COLUMN_KEY, L as SearchInput, V as SearchableFilterPill, F as SearchableSelect, $ as Sidebar, Z as SidebarHeader, X as SidebarNavItem, n as SkeletonCard, a as SkeletonCards, ie as TableActions, ce as TableBody, te as TableBulkActions, H as TableFilter, ae as TableHeader, le as TablePagination, se as TableSettings, _e as ThemeSelector, ee as Topbar, fe as getAlignmentClass, x as getChartColor, re as getColumnAlignment, oe as getFixedCellProps };
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
5
|
-
c as DatePicker,
|
|
6
|
-
o as DateRangePicker,
|
|
7
|
-
r as ImageInput,
|
|
8
|
-
l as MultiSelect,
|
|
9
|
-
s as SearchInput,
|
|
10
|
-
p as SearchableSelect
|
|
11
|
-
};
|
|
1
|
+
import { t as e } from "../../../ImageInput-CN2ozjpc.js";
|
|
2
|
+
import { t } from "../../../MultiSelect-BF0zL0B0.js";
|
|
3
|
+
import { i as n, n as r, r as i, t as a } from "../../../SearchInput-BJPT0SbB.js";
|
|
4
|
+
export { n as DatePicker, i as DateRangePicker, e as ImageInput, t as MultiSelect, a as SearchInput, r as SearchableSelect };
|
|
@@ -1,11 +1,50 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
1
|
+
import { i as e, t } from "../../../cards-Cta6x49J.js";
|
|
2
|
+
import "../../../ui-CiX0E_bn.js";
|
|
3
|
+
import { s as n } from "../../../tooltip-B2dzyfs9.js";
|
|
4
|
+
import { t as r } from "../../../AppActions-C_0YI75w.js";
|
|
5
|
+
import { t as i } from "../../../AppSubTitle-tqqV9nuT.js";
|
|
6
|
+
import { t as a } from "../../../AppTitle-BR4JFZfp.js";
|
|
7
|
+
import { t as o } from "../../../useDocumentTitle-D7MywIeB.js";
|
|
8
|
+
import { n as s } from "../../../states-N8-LjFng.js";
|
|
9
|
+
import "react";
|
|
10
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
11
|
+
import { useTranslation as u } from "react-i18next";
|
|
12
|
+
import { ArrowLeftIcon as d } from "lucide-react";
|
|
13
|
+
//#region src/components/core/layouts/AppPageHeader.tsx
|
|
14
|
+
function f({ icon: e, titleKey: t, descriptionKey: i, actions: s, onBack: f, renderPreActions: p, className: m }) {
|
|
15
|
+
let { t: h } = u();
|
|
16
|
+
return o(h(t)), /* @__PURE__ */ l("div", {
|
|
17
|
+
className: "flex flex-row items-center justify-between gap-3 md:gap-4",
|
|
18
|
+
children: [/* @__PURE__ */ l("div", {
|
|
19
|
+
className: "flex min-w-0 items-center gap-3 md:gap-4",
|
|
20
|
+
children: [
|
|
21
|
+
f && /* @__PURE__ */ c(n, {
|
|
22
|
+
variant: "ghost",
|
|
23
|
+
size: "icon",
|
|
24
|
+
className: "shrink-0",
|
|
25
|
+
onClick: f,
|
|
26
|
+
children: /* @__PURE__ */ c(d, { className: "h-4 w-4" })
|
|
27
|
+
}),
|
|
28
|
+
e && /* @__PURE__ */ c("div", {
|
|
29
|
+
className: "size-12 shrink-0 bg-blue-100 rounded-control flex items-center justify-center",
|
|
30
|
+
children: /* @__PURE__ */ c(e, { className: "h-6 w-6 text-blue-600" })
|
|
31
|
+
}),
|
|
32
|
+
/* @__PURE__ */ c(a, {
|
|
33
|
+
titleKey: t,
|
|
34
|
+
descriptionKey: i
|
|
35
|
+
})
|
|
36
|
+
]
|
|
37
|
+
}), /* @__PURE__ */ l("div", {
|
|
38
|
+
className: "flex shrink-0 items-center gap-2 md:gap-4",
|
|
39
|
+
children: [p && p(), /* @__PURE__ */ c(r, {
|
|
40
|
+
actions: s,
|
|
41
|
+
className: m
|
|
42
|
+
})]
|
|
43
|
+
})]
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/components/core/layouts/KpiCardsLayout.tsx
|
|
48
|
+
var p = ({ stats: n, isLoading: r, error: i }) => r ? /* @__PURE__ */ c(t, { count: 4 }) : i ? /* @__PURE__ */ c(s, { message: i.message }) : /* @__PURE__ */ c(e, { stats: n });
|
|
49
|
+
//#endregion
|
|
50
|
+
export { r as AppActions, f as AppPageHeader, i as AppSubTitle, a as AppTitle, p as KpiCardsLayout };
|
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
r as GlobalSearch,
|
|
4
|
-
s as NotificationsBell,
|
|
5
|
-
b as Sidebar,
|
|
6
|
-
i as SidebarHeader,
|
|
7
|
-
o as SidebarNavItem,
|
|
8
|
-
S as Topbar
|
|
9
|
-
};
|
|
1
|
+
import { a as e, i as t, n, o as r, r as i, t as a } from "../../../navbar-Bc5OQWRI.js";
|
|
2
|
+
export { r as GlobalSearch, e as NotificationsBell, i as Sidebar, n as SidebarHeader, t as SidebarNavItem, a as Topbar };
|