@krosoft/react 0.0.124 → 0.0.126

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.
Files changed (62) hide show
  1. package/dist/{AppActions-po4LjUcM.js → AppActions-BbAnhStS.js} +22 -18
  2. package/dist/{AppSubTitle-CWrsJYFJ.js → AppSubTitle-lg3d5NWc.js} +1 -1
  3. package/dist/{AppTitle-CDxWr_0y.js → AppTitle-uboDuil4.js} +1 -1
  4. package/dist/{AppVerticalTabs-CdqoObXx.js → AppVerticalTabs-CBijkDF_.js} +33 -49
  5. package/dist/ConfirmationDialog-Co5yl0yA.js +184 -0
  6. package/dist/{DataTable-CrJoeR_0.js → DataTable-DSIgTHZS.js} +174 -218
  7. package/dist/ErrorAlert-DH1onuyt.js +17 -0
  8. package/dist/GenericForm-QoeireeW.js +339 -0
  9. package/dist/ImageInput-DLTYJMwr.js +65 -0
  10. package/dist/KpiCardsLayout-C3LmSeL1.js +22 -0
  11. package/dist/{LoadingState-PhGi7HXH.js → LoadingState-BN0YaPSs.js} +3 -3
  12. package/dist/{MetricCard-C-ewNR_i.js → MetricCard-CPw-fiNS.js} +6 -6
  13. package/dist/{MultiSelect-BoisW4Kn.js → MultiSelect-CX051kfk.js} +32 -27
  14. package/dist/SearchInput-D6LmcOjp.js +249 -0
  15. package/dist/SkeletonCards-BIEnyOuZ.js +62 -0
  16. package/dist/{TableFilter-CLjQU36k.js → TableFilter-Wh_Womy4.js} +114 -123
  17. package/dist/{ThemeSelector--w3R6Ff3.js → ThemeSelector-Qv8QBlYq.js} +2 -2
  18. package/dist/{Topbar-DFu_OdSs.js → Topbar-DVww-tU8.js} +49 -59
  19. package/dist/{alert-B34E_4uH.js → alert-B78CiTYe.js} +2 -2
  20. package/dist/components/core/cards/index.js +2 -2
  21. package/dist/components/core/dialogs/index.js +2 -2
  22. package/dist/components/core/filters/index.js +1 -1
  23. package/dist/components/core/forms/index.js +1 -1
  24. package/dist/components/core/index.js +19 -19
  25. package/dist/components/core/inputs/index.js +3 -3
  26. package/dist/components/core/layouts/index.js +4 -4
  27. package/dist/components/core/navbar/index.js +1 -1
  28. package/dist/components/core/states/index.js +2 -2
  29. package/dist/components/core/table/index.js +1 -1
  30. package/dist/components/core/tabs/index.js +1 -1
  31. package/dist/components/core/theme/index.js +1 -1
  32. package/dist/components/index.js +270 -270
  33. package/dist/components/ui/index.js +213 -213
  34. package/dist/helpers/index.js +1 -1
  35. package/dist/hooks/behavior/index.js +1 -1
  36. package/dist/hooks/index.js +1 -1
  37. package/dist/select-MWzbMBAS.js +106 -0
  38. package/dist/tailwind.helper-B6yFEsav.js +8 -0
  39. package/dist/toaster-DTC8Duvh.js +75 -0
  40. package/dist/toggle-group-CSdAiS44.js +1694 -0
  41. package/dist/tooltip-BWyFpIxo.js +56 -0
  42. package/dist/useConfirmDeleteDialog-CiBQmRxg.js +65 -0
  43. package/package.json +4 -4
  44. package/dist/ConfirmationDialog-CkMyyh_3.js +0 -221
  45. package/dist/ErrorAlert-C6BbHHRZ.js +0 -33
  46. package/dist/GenericForm-CmwqEXiQ.js +0 -11410
  47. package/dist/ImageInput-C8HcxE8t.js +0 -82
  48. package/dist/KpiCardsLayout-CETMpB7A.js +0 -15
  49. package/dist/SearchInput-DJ_F3emq.js +0 -586
  50. package/dist/SkeletonCards-C5lXTSrB.js +0 -57
  51. package/dist/badge-CfWlt79h.js +0 -26
  52. package/dist/createLucideIcon-MP_wDWjs.js +0 -116
  53. package/dist/ellipsis-vertical-kB5yFb-i.js +0 -15
  54. package/dist/grip-vertical-DGywJXzS.js +0 -18
  55. package/dist/index-Be16PP7H.js +0 -34
  56. package/dist/loader-circle-CKy7u7JW.js +0 -11
  57. package/dist/select-DlQvLtI3.js +0 -1763
  58. package/dist/tailwind.helper-gWiv5-6R.js +0 -2278
  59. package/dist/toaster-CKoOjjKr.js +0 -134
  60. package/dist/toggle-group-wIgXZYDq.js +0 -29086
  61. package/dist/tooltip-YhBPXbcJ.js +0 -2477
  62. package/dist/useConfirmDeleteDialog-BOb3XFpz.js +0 -75
@@ -0,0 +1,249 @@
1
+ import { jsxs as a, jsx as t } from "react/jsx-runtime";
2
+ import * as N from "react";
3
+ import { useState as k, useRef as C, useEffect as z, useMemo as S } from "react";
4
+ import { I, bw as R, by as L, bx as T, aX as j } from "./toggle-group-CSdAiS44.js";
5
+ import "./alert-B78CiTYe.js";
6
+ import "@radix-ui/react-aspect-ratio";
7
+ import { B as h } from "./tooltip-BWyFpIxo.js";
8
+ import "@radix-ui/react-collapsible";
9
+ import { CalendarIcon as O, XIcon as M, ChevronDownIcon as A, SearchIcon as D, CheckIcon as q } from "lucide-react";
10
+ import "react-resizable-panels";
11
+ import { c as m } from "./tailwind.helper-B6yFEsav.js";
12
+ import "./select-MWzbMBAS.js";
13
+ import "next-themes";
14
+ import "sonner";
15
+ import { format as x } from "date-fns";
16
+ import { fr as v } from "date-fns/locale";
17
+ const te = ({ date: r, onDateChange: o, placeholder: p }) => {
18
+ const [u, f] = k(!1), c = C(null);
19
+ z(() => {
20
+ if (!u) return;
21
+ const s = (n) => {
22
+ c.current !== null && !c.current.contains(n.target) && f(!1);
23
+ };
24
+ return document.addEventListener("mousedown", s), () => {
25
+ document.removeEventListener("mousedown", s);
26
+ };
27
+ }, [u]);
28
+ const d = () => {
29
+ f((s) => !s);
30
+ }, l = (s) => {
31
+ o(s), f(!1);
32
+ };
33
+ return /* @__PURE__ */ a("div", { ref: c, className: "relative w-full", children: [
34
+ /* @__PURE__ */ a(
35
+ h,
36
+ {
37
+ variant: "outline",
38
+ type: "button",
39
+ onClick: d,
40
+ className: m(
41
+ "w-full justify-start text-left font-normal focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
42
+ u && "ring-2 ring-ring ring-offset-2",
43
+ r === void 0 && "text-muted-foreground"
44
+ ),
45
+ children: [
46
+ /* @__PURE__ */ t(O, { className: "mr-2 size-4 shrink-0" }),
47
+ r !== void 0 ? x(r, "dd/MM/yyyy", { locale: v }) : /* @__PURE__ */ t("span", { children: p })
48
+ ]
49
+ }
50
+ ),
51
+ u ? /* @__PURE__ */ t("div", { className: "absolute left-0 top-[calc(100%+4px)] z-[100] rounded-md border bg-popover text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 slide-in-from-top-2", children: /* @__PURE__ */ t(I, { mode: "single", selected: r, onSelect: l }) }) : null
52
+ ] });
53
+ }, re = ({ value: r, onChange: o, placeholder: p = "Selectionner une periode", className: u }) => {
54
+ const [f, c] = N.useState(!1), [d, l] = N.useState(r);
55
+ N.useEffect(() => {
56
+ f && l(r);
57
+ }, [f, r]);
58
+ const s = (i) => {
59
+ i.stopPropagation(), o(void 0), c(!1);
60
+ }, n = () => {
61
+ o(d), c(!1);
62
+ }, g = () => {
63
+ l(r), c(!1);
64
+ }, b = () => {
65
+ l(void 0);
66
+ }, y = (i) => i != null && i.from ? !i.to || i.from.getTime() === i.to.getTime() ? x(i.from, "dd MMM yyyy", { locale: v }) : `${x(i.from, "dd MMM yyyy", { locale: v })} - ${x(i.to, "dd MMM yyyy", { locale: v })}` : p;
67
+ return /* @__PURE__ */ t("div", { className: m("grid gap-2", u), children: /* @__PURE__ */ a(R, { open: f, onOpenChange: c, children: [
68
+ /* @__PURE__ */ t(L, { asChild: !0, children: /* @__PURE__ */ a(h, { id: "date", variant: "outline", className: m("w-[300px] justify-start text-left font-normal", !(r != null && r.from) && "text-muted-foreground"), children: [
69
+ /* @__PURE__ */ t(O, { className: "mr-2 size-4" }),
70
+ y(r),
71
+ (r == null ? void 0 : r.from) && /* @__PURE__ */ t(
72
+ h,
73
+ {
74
+ type: "button",
75
+ variant: "ghost",
76
+ size: "icon",
77
+ "aria-label": "Effacer la periode selectionnee",
78
+ className: "ml-auto h-5 w-5 opacity-50 hover:opacity-100",
79
+ onClick: s,
80
+ children: /* @__PURE__ */ t(M, { className: "size-4" })
81
+ }
82
+ )
83
+ ] }) }),
84
+ /* @__PURE__ */ a(T, { className: "w-auto p-0", align: "start", side: "bottom", sideOffset: 4, children: [
85
+ /* @__PURE__ */ t(
86
+ I,
87
+ {
88
+ mode: "range",
89
+ defaultMonth: d == null ? void 0 : d.from,
90
+ selected: d,
91
+ onSelect: l,
92
+ numberOfMonths: 2,
93
+ weekStartsOn: 1,
94
+ className: "pointer-events-auto p-3"
95
+ }
96
+ ),
97
+ /* @__PURE__ */ a("div", { className: "flex items-center justify-between border-t border-border px-3 py-2", children: [
98
+ /* @__PURE__ */ t(h, { variant: "ghost", size: "sm", onClick: b, children: "Effacer" }),
99
+ /* @__PURE__ */ a("div", { className: "flex gap-2", children: [
100
+ /* @__PURE__ */ t(h, { variant: "ghost", size: "sm", onClick: g, children: "Annuler" }),
101
+ /* @__PURE__ */ t(h, { size: "sm", onClick: n, children: "Appliquer" })
102
+ ] })
103
+ ] })
104
+ ] })
105
+ ] }) });
106
+ }, oe = ({
107
+ options: r = [],
108
+ value: o,
109
+ onChange: p,
110
+ onClear: u,
111
+ placeholder: f = "Sélectionner...",
112
+ searchPlaceholder: c = "Rechercher...",
113
+ disabled: d = !1
114
+ }) => {
115
+ const [l, s] = k(""), [n, g] = k(!1), b = C(null), y = C(null), i = S(() => l === "" ? r : r.filter((e) => e.label.toLowerCase().includes(l.toLowerCase())), [r, l]), E = S(() => {
116
+ var e;
117
+ if (!(o === void 0 || o === ""))
118
+ return ((e = r.find((w) => w.value === o)) == null ? void 0 : e.label) ?? o;
119
+ }, [r, o]);
120
+ z(() => {
121
+ n && requestAnimationFrame(() => {
122
+ var e;
123
+ (e = y.current) == null || e.focus();
124
+ });
125
+ }, [n]), z(() => {
126
+ if (!n) return;
127
+ const e = (w) => {
128
+ b.current !== null && !b.current.contains(w.target) && (g(!1), s(""));
129
+ };
130
+ return document.addEventListener("mousedown", e), () => {
131
+ document.removeEventListener("mousedown", e);
132
+ };
133
+ }, [n]);
134
+ const P = (e) => {
135
+ p(e), g(!1), s("");
136
+ };
137
+ return /* @__PURE__ */ a("div", { ref: b, className: "relative w-full", children: [
138
+ /* @__PURE__ */ a(
139
+ "button",
140
+ {
141
+ type: "button",
142
+ onClick: () => {
143
+ d || g((e) => (e && s(""), !e));
144
+ },
145
+ disabled: d,
146
+ className: m(
147
+ "flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
148
+ n && "ring-2 ring-ring ring-offset-2",
149
+ (o === void 0 || o === "") && "text-muted-foreground"
150
+ ),
151
+ children: [
152
+ /* @__PURE__ */ t("span", { className: "truncate", children: E ?? f }),
153
+ /* @__PURE__ */ a("div", { className: "flex items-center gap-1", children: [
154
+ u && o !== void 0 && o !== "" && !d && /* @__PURE__ */ t(
155
+ "span",
156
+ {
157
+ role: "button",
158
+ tabIndex: -1,
159
+ onClick: (e) => {
160
+ e.stopPropagation();
161
+ },
162
+ onPointerDown: (e) => {
163
+ e.preventDefault(), e.stopPropagation(), u();
164
+ },
165
+ className: "text-muted-foreground hover:text-foreground",
166
+ children: /* @__PURE__ */ t(M, { className: "size-4" })
167
+ }
168
+ ),
169
+ /* @__PURE__ */ t(A, { className: m("size-4 opacity-50 shrink-0 transition-transform", n && "rotate-180") })
170
+ ] })
171
+ ]
172
+ }
173
+ ),
174
+ n ? /* @__PURE__ */ a("div", { className: "absolute left-0 right-0 top-[calc(100%+4px)] z-[100] rounded-md border bg-popover text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 slide-in-from-top-2", children: [
175
+ /* @__PURE__ */ t("div", { className: "border-b border-border p-2", children: /* @__PURE__ */ a("div", { className: "relative", children: [
176
+ /* @__PURE__ */ t(D, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
177
+ /* @__PURE__ */ t(
178
+ "input",
179
+ {
180
+ ref: y,
181
+ className: "w-full rounded-md 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",
182
+ placeholder: c,
183
+ value: l,
184
+ onChange: (e) => {
185
+ s(e.target.value);
186
+ }
187
+ }
188
+ )
189
+ ] }) }),
190
+ /* @__PURE__ */ a("div", { className: "flex flex-col gap-0.5 max-h-56 overflow-y-auto p-1.5 scrollbar-thin scrollbar-thumb-rounded scrollbar-thumb-muted-foreground/20 scrollbar-track-transparent [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-muted-foreground/20 [&::-webkit-scrollbar-track]:bg-transparent", children: [
191
+ i.length === 0 && /* @__PURE__ */ t("p", { className: "px-2 py-3 text-center text-xs text-muted-foreground", children: "Aucun résultat" }),
192
+ i.map((e) => /* @__PURE__ */ a(
193
+ "button",
194
+ {
195
+ type: "button",
196
+ onClick: () => {
197
+ P(e.value);
198
+ },
199
+ className: m(
200
+ "flex items-center gap-2.5 rounded-md px-2 py-2 text-sm hover:bg-muted cursor-pointer transition-colors text-left w-full",
201
+ o === e.value && "bg-muted font-medium"
202
+ ),
203
+ children: [
204
+ /* @__PURE__ */ t(q, { className: m("size-3.5 shrink-0", o === e.value ? "opacity-100" : "opacity-0") }),
205
+ e.label
206
+ ]
207
+ },
208
+ e.value
209
+ ))
210
+ ] })
211
+ ] }) : null
212
+ ] });
213
+ }, ne = ({
214
+ searchQuery: r,
215
+ search: o,
216
+ placeholder: p = "Rechercher...",
217
+ onSearch: u,
218
+ onSubmit: f,
219
+ onClear: c,
220
+ className: d
221
+ }) => {
222
+ const l = r ?? o ?? "", s = () => {
223
+ u(""), c !== void 0 && c();
224
+ };
225
+ return /* @__PURE__ */ a("div", { className: m("relative h-fit w-full md:w-64", d), children: [
226
+ /* @__PURE__ */ t(D, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground w-4 h-4" }),
227
+ /* @__PURE__ */ t(
228
+ j,
229
+ {
230
+ placeholder: p,
231
+ value: l,
232
+ onChange: (n) => {
233
+ u(n.target.value);
234
+ },
235
+ className: "pl-8",
236
+ onKeyDown: (n) => {
237
+ n.key === "Enter" && f !== void 0 && (n.preventDefault(), f());
238
+ }
239
+ }
240
+ ),
241
+ l !== "" ? /* @__PURE__ */ t("button", { onClick: s, className: "absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-700", type: "button", children: /* @__PURE__ */ t(M, { className: "size-4" }) }) : null
242
+ ] });
243
+ };
244
+ export {
245
+ te as D,
246
+ ne as S,
247
+ re as a,
248
+ oe as b
249
+ };
@@ -0,0 +1,62 @@
1
+ import { jsxs as i, jsx as e } from "react/jsx-runtime";
2
+ import { formatNumber as h } from "@krosoft/core/helpers";
3
+ import { useTranslation as C } from "react-i18next";
4
+ import { c as s } from "./tailwind.helper-B6yFEsav.js";
5
+ import { J as d, N as l, O as f, K as t } from "./toggle-group-CSdAiS44.js";
6
+ import "./alert-B78CiTYe.js";
7
+ import "@radix-ui/react-aspect-ratio";
8
+ import "./tooltip-BWyFpIxo.js";
9
+ import "@radix-ui/react-collapsible";
10
+ import "lucide-react";
11
+ import "react-resizable-panels";
12
+ import "./select-MWzbMBAS.js";
13
+ import "next-themes";
14
+ import "sonner";
15
+ import "react";
16
+ const g = ({
17
+ titleKey: a,
18
+ value: r,
19
+ valueClassName: m,
20
+ icon: n,
21
+ iconClassName: c,
22
+ description: p,
23
+ descriptionClassName: u,
24
+ onClick: o
25
+ }) => {
26
+ const { t: N } = C();
27
+ return /* @__PURE__ */ i(d, { className: s(o !== void 0 ? "hover:border-primary cursor-pointer" : ""), onClick: o, children: [
28
+ /* @__PURE__ */ i(l, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
29
+ /* @__PURE__ */ e(f, { className: "text-sm font-medium", children: N(a) }),
30
+ /* @__PURE__ */ e(n, { className: s("size-6 text-muted-foreground", c) })
31
+ ] }),
32
+ /* @__PURE__ */ i(t, { children: [
33
+ /* @__PURE__ */ e("div", { className: s("text-2xl font-bold", m), children: h(r) }),
34
+ /* @__PURE__ */ e("p", { className: s("text-xs text-muted-foreground", u), children: p })
35
+ ] })
36
+ ] });
37
+ }, $ = ({ stats: a }) => /* @__PURE__ */ e("div", { className: "grid gap-6 md:grid-cols-2 lg:grid-cols-4", children: a.map((r) => /* @__PURE__ */ e(
38
+ g,
39
+ {
40
+ titleKey: r.titleKey,
41
+ value: r.value,
42
+ valueClassName: r.valueClassName,
43
+ icon: r.icon,
44
+ iconClassName: r.iconClassName,
45
+ description: r.description,
46
+ descriptionClassName: r.descriptionClassName,
47
+ onClick: r.onClick
48
+ },
49
+ r.titleKey
50
+ )) }), v = () => /* @__PURE__ */ i(d, { className: "animate-pulse", children: [
51
+ /* @__PURE__ */ e(l, { children: /* @__PURE__ */ e("div", { className: "h-6 bg-muted rounded w-1/4" }) }),
52
+ /* @__PURE__ */ e(t, { children: /* @__PURE__ */ i("div", { className: "space-y-2", children: [
53
+ /* @__PURE__ */ e("div", { className: "h-4 bg-muted rounded" }),
54
+ /* @__PURE__ */ e("div", { className: "h-4 bg-muted rounded w-3/4" })
55
+ ] }) })
56
+ ] }), q = ({ count: a = 1 }) => /* @__PURE__ */ e("div", { className: "grid gap-6", style: { gridTemplateColumns: `repeat(${a}, minmax(0, 1fr))` }, children: Array.from({ length: a }).map((r, m) => /* @__PURE__ */ e(v, {}, m)) });
57
+ export {
58
+ g as K,
59
+ v as S,
60
+ $ as a,
61
+ q as b
62
+ };