@krosoft/react 0.0.200 → 0.0.201

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 (47) hide show
  1. package/dist/{AppActions-DeBcK3cv.js → AppActions-ViFjSupi.js} +6 -6
  2. package/dist/{AppSubTitle-CdIM6aXB.js → AppSubTitle-ClHzadQW.js} +1 -1
  3. package/dist/{AppVerticalTabs-BlgIZ0mf.js → AppVerticalTabs-Cj66X8_R.js} +7 -7
  4. package/dist/{ConfirmationDialog-DZ6tvSwP.js → ConfirmationDialog-BoajNW2s.js} +15 -15
  5. package/dist/{DataTable-BDW0AEsH.js → DataTable-BUcnJCi6.js} +22 -22
  6. package/dist/{GenericForm-DFTUIw-X.js → GenericForm-BPY5O-B6.js} +43 -43
  7. package/dist/{ImageInput-MzY2W495.js → ImageInput-DOIglcpv.js} +2 -2
  8. package/dist/{KpiCardsLayout-fcfJK4ts.js → KpiCardsLayout-D9NSC5Fb.js} +4 -4
  9. package/dist/{MultiSelect-V-RantiK.js → MultiSelect-B60y82TF.js} +16 -16
  10. package/dist/{SearchInput-tz8UERbu.js → SearchInput-C-jCOSoi.js} +49 -49
  11. package/dist/{SkeletonCards-CyP7ZysR.js → SkeletonCards-63vDljXy.js} +2 -2
  12. package/dist/{TableFilter-BXf-oSjf.js → TableFilter-DP7cq0PU.js} +26 -26
  13. package/dist/Topbar-0EBMHLwG.js +301 -0
  14. package/dist/components/core/cards/index.js +1 -1
  15. package/dist/components/core/dialogs/index.js +8 -7
  16. package/dist/components/core/filters/index.js +1 -1
  17. package/dist/components/core/forms/index.js +1 -1
  18. package/dist/components/core/index.js +66 -64
  19. package/dist/components/core/inputs/index.js +3 -3
  20. package/dist/components/core/layouts/index.js +3 -3
  21. package/dist/components/core/navbar/GlobalSearch.d.ts +52 -0
  22. package/dist/components/core/navbar/GlobalSearch.d.ts.map +1 -0
  23. package/dist/components/core/navbar/index.d.ts +2 -0
  24. package/dist/components/core/navbar/index.d.ts.map +1 -1
  25. package/dist/components/core/navbar/index.js +6 -5
  26. package/dist/components/core/table/index.js +1 -1
  27. package/dist/components/core/tabs/index.js +1 -1
  28. package/dist/components/index.js +293 -292
  29. package/dist/components/ui/command.d.ts +20 -2
  30. package/dist/components/ui/command.d.ts.map +1 -1
  31. package/dist/components/ui/index.d.ts +1 -0
  32. package/dist/components/ui/index.d.ts.map +1 -1
  33. package/dist/components/ui/index.js +187 -187
  34. package/dist/hooks/behavior/index.d.ts +1 -0
  35. package/dist/hooks/behavior/index.d.ts.map +1 -1
  36. package/dist/hooks/behavior/index.js +6 -5
  37. package/dist/hooks/behavior/useDebouncedValue.d.ts +6 -0
  38. package/dist/hooks/behavior/useDebouncedValue.d.ts.map +1 -0
  39. package/dist/hooks/index.js +20 -19
  40. package/dist/sheet-C-QvdRNi.js +245 -0
  41. package/dist/{toaster-DG7IvN3o.js → toaster-D6OHn49K.js} +9 -9
  42. package/dist/{toggle-group-CKCJXGta.js → toggle-group-DLLrEwv2.js} +576 -714
  43. package/dist/usePage-BFE9lxI1.js +84 -0
  44. package/package.json +1 -1
  45. package/dist/Topbar-CFmKB_S2.js +0 -217
  46. package/dist/sheet-B_uq6-K_.js +0 -87
  47. package/dist/usePage-u2gRhvQ0.js +0 -72
@@ -0,0 +1,84 @@
1
+ import { TrashIcon as u } from "lucide-react";
2
+ import * as c from "react";
3
+ import { useState as l, useContext as m } from "react";
4
+ import { P as f } from "./sidebar.context-D5nywlmP.js";
5
+ const g = (e) => {
6
+ const [o, t] = l(null), r = (n, a) => {
7
+ var s;
8
+ (s = e == null ? void 0 : e.onReset) == null || s.call(e), t({ id: n, name: a });
9
+ }, i = () => {
10
+ t(null);
11
+ };
12
+ return {
13
+ id: (o == null ? void 0 : o.id) ?? null,
14
+ name: (o == null ? void 0 : o.name) ?? null,
15
+ isOpen: !!o,
16
+ openDialog: r,
17
+ onClose: i
18
+ };
19
+ }, d = ({
20
+ titleKey: e,
21
+ descriptionKey: o,
22
+ confirmKey: t = "Confirmer",
23
+ onConfirm: r,
24
+ onReset: i
25
+ }) => {
26
+ const n = g({ onReset: i }), a = async () => {
27
+ if (n.id)
28
+ try {
29
+ await r(n.id), n.onClose();
30
+ } catch (s) {
31
+ console.error("Error confirming action:", s);
32
+ }
33
+ };
34
+ return {
35
+ isOpen: n.isOpen,
36
+ itemName: n.name,
37
+ title: e,
38
+ description: o,
39
+ confirmKey: t,
40
+ openDialog: n.openDialog,
41
+ onClose: n.onClose,
42
+ onConfirm: a
43
+ };
44
+ }, b = ({
45
+ titleKey: e,
46
+ descriptionKey: o,
47
+ confirmKey: t = "Supprimer",
48
+ onConfirm: r,
49
+ onReset: i
50
+ }) => ({
51
+ ...d({
52
+ titleKey: e,
53
+ descriptionKey: o,
54
+ confirmKey: t,
55
+ onConfirm: r,
56
+ onReset: i
57
+ }),
58
+ loadingKey: "Suppression...",
59
+ icon: u,
60
+ titleClassName: "flex items-center gap-2 text-destructive",
61
+ headerClassName: "bg-gradient-to-r from-slate-900 to-purple-700 rounded-t-surface shrink-0"
62
+ }), x = (e, o = 250) => {
63
+ const [t, r] = c.useState(e);
64
+ return c.useEffect(() => {
65
+ const i = setTimeout(() => {
66
+ r(e);
67
+ }, o);
68
+ return () => {
69
+ clearTimeout(i);
70
+ };
71
+ }, [e, o]), t;
72
+ }, P = () => {
73
+ const e = m(f);
74
+ if (e === void 0)
75
+ throw new Error("usePage must be used within an PageProvider");
76
+ return e;
77
+ };
78
+ export {
79
+ d as a,
80
+ x as b,
81
+ g as c,
82
+ P as d,
83
+ b as u
84
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krosoft/react",
3
- "version": "0.0.200",
3
+ "version": "0.0.201",
4
4
  "description": "Krosoft shared React package",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -1,217 +0,0 @@
1
- import { jsxs as n, jsx as e, Fragment as D } from "react/jsx-runtime";
2
- import * as K from "react";
3
- import { ChevronDownIcon as $, SearchIcon as L, MenuIcon as M } from "lucide-react";
4
- import { T as B, c as Q, a as R, b as q, B as F } from "./tooltip-DVeqVwqV.js";
5
- import { c as l } from "./tailwind.helper-B6yFEsav.js";
6
- import "./sidebar.context-D5nywlmP.js";
7
- import { u as W } from "./useSidebar-BJuALHqQ.js";
8
- import "react-i18next";
9
- import "next-themes";
10
- import { I as G, S as H, b as _, h as E, c as J } from "./sheet-B_uq6-K_.js";
11
- import { S as O } from "./skeleton-BX4RcsiK.js";
12
- const z = (a, d, m) => d === a ? !0 : a === "/" || !d.startsWith(`${a}/`) ? !1 : !m.some(
13
- (i) => i !== a && i.startsWith(`${a}/`) && (d === i || d.startsWith(`${i}/`))
14
- ), U = ({
15
- path: a,
16
- // eslint-disable-next-line @typescript-eslint/naming-convention
17
- icon: d,
18
- label: m,
19
- badge: i,
20
- subItems: r,
21
- currentPath: o,
22
- collapsed: c,
23
- dense: p = !1,
24
- onItemClick: v
25
- }) => {
26
- const g = (r == null ? void 0 : r.map((t) => t.path)) ?? [], [x, N] = K.useState((r == null ? void 0 : r.some((t) => z(t.path, o, g))) ?? !1), u = a ? o === a || a !== "/" && o.startsWith(`${a}/`) : !1, y = r == null ? void 0 : r.some((t) => z(t.path, o, g)), b = /* @__PURE__ */ n(
27
- "a",
28
- {
29
- href: a ?? "#",
30
- onClick: (t) => {
31
- t.ctrlKey || t.metaKey || t.button === 1 || (t.preventDefault(), r && r.length > 0 ? c || N(!x) : a && v(a));
32
- },
33
- className: l(
34
- "flex items-center cursor-pointer transition-all duration-200 group rounded-control",
35
- p ? "gap-2.5 mb-0.5" : "gap-3 mb-1",
36
- c ? p ? "justify-center p-2 h-9 w-9 mx-auto" : "justify-center p-3 h-12 w-12 mx-auto" : p ? "px-3 py-1.5 h-9" : "px-4 py-3 h-12",
37
- u || !c && y ? p ? "bg-sidebar-primary text-sidebar-primary-foreground" : "bg-sidebar-primary text-sidebar-primary-foreground shadow-lg" : "hover:bg-sidebar-accent text-sidebar-foreground hover:text-sidebar-accent-foreground"
38
- ),
39
- children: [
40
- /* @__PURE__ */ e("div", { className: l("flex-shrink-0 transition-transform group-hover:scale-110", c ? "flex items-center justify-center" : ""), children: /* @__PURE__ */ e(d, { className: "size-4" }) }),
41
- !c && /* @__PURE__ */ n(D, { children: [
42
- /* @__PURE__ */ e("span", { className: l("flex-grow transition-opacity duration-150 font-medium", p ? "text-sm" : ""), children: m }),
43
- i !== void 0 && /* @__PURE__ */ e("span", { className: "bg-red-500 text-white text-xs rounded-full py-1 min-w-[20px] text-center px-2 font-semibold", children: i }),
44
- r && r.length > 0 && /* @__PURE__ */ e($, { className: l("size-4 transition-transform duration-200", x ? "rotate-180" : "") })
45
- ] })
46
- ]
47
- }
48
- );
49
- return /* @__PURE__ */ n(D, { children: [
50
- c ? /* @__PURE__ */ n(B, { children: [
51
- /* @__PURE__ */ e(Q, { asChild: !0, children: b }),
52
- /* @__PURE__ */ e(
53
- R,
54
- {
55
- side: "right",
56
- sideOffset: 6,
57
- className: "rounded-surface z-[99999] flex gap-2 bg-sidebar text-sidebar-foreground border border-sidebar-border py-2 text-sm shadow-lg",
58
- children: /* @__PURE__ */ e("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
59
- /* @__PURE__ */ e("p", { className: "font-semibold", children: m }),
60
- i !== void 0 && /* @__PURE__ */ n("span", { className: "ml-1 text-xs", children: [
61
- "(",
62
- i,
63
- ")"
64
- ] })
65
- ] }) })
66
- }
67
- )
68
- ] }) : b,
69
- !c && r && r.length > 0 && x && /* @__PURE__ */ e(
70
- "div",
71
- {
72
- className: l(
73
- "flex flex-col ml-4 pl-4 border-l-2 border-sidebar-border/50 animate-in slide-in-from-top-2 fade-in duration-200",
74
- p ? "gap-0.5 mb-0.5" : "gap-1 mb-2"
75
- ),
76
- children: r.map((t, C) => {
77
- const s = z(t.path, o, g);
78
- return /* @__PURE__ */ n(
79
- "a",
80
- {
81
- href: t.path,
82
- onClick: (f) => {
83
- f.ctrlKey || f.metaKey || f.button === 1 || (f.preventDefault(), v(t.path));
84
- },
85
- className: l(
86
- "flex items-center justify-between rounded-control text-sm transition-all duration-200",
87
- p ? "px-3 py-1" : "px-4 py-2",
88
- s ? "bg-sidebar-accent/50 text-sidebar-primary font-semibold" : "text-sidebar-muted hover:bg-sidebar-accent hover:text-sidebar-foreground"
89
- ),
90
- children: [
91
- /* @__PURE__ */ e("span", { children: t.label }),
92
- t.badge !== void 0 && /* @__PURE__ */ e("span", { className: "bg-sidebar-primary/20 text-sidebar-primary text-[10px] rounded-full py-0.5 px-2 font-semibold", children: t.badge })
93
- ]
94
- },
95
- C
96
- );
97
- })
98
- }
99
- )
100
- ] });
101
- }, ie = ({ groups: a, currentPath: d, onItemClick: m, slots: i, search: r, dense: o = !1, loading: c = !1 }) => {
102
- const { enabled: p = !1, placeholder: v = "Rechercher..." } = r ?? {}, { header: g, footer: x } = i ?? {}, { collapsed: N, isMobile: u, setCollapsed: y } = W(), [S, j] = K.useState(""), h = u ? !1 : N, T = !N, A = (s) => {
103
- m(s), u && y(!0);
104
- }, b = S.trim().toLowerCase(), t = b === "" ? a : a.map((s) => ({
105
- ...s,
106
- items: s.items.filter(
107
- (f) => {
108
- var w;
109
- return f.label.toLowerCase().includes(b) || (((w = f.subItems) == null ? void 0 : w.some((k) => k.label.toLowerCase().includes(b))) ?? !1);
110
- }
111
- )
112
- })).filter((s) => s.items.length > 0), C = /* @__PURE__ */ n("div", { className: "flex flex-col h-full bg-sidebar text-sidebar-foreground", children: [
113
- g,
114
- p && !h && /* @__PURE__ */ e("div", { className: l("px-4", o ? "pt-2" : "pt-4"), children: /* @__PURE__ */ n("div", { className: "relative", children: [
115
- /* @__PURE__ */ e(L, { className: "absolute left-3 top-1/2 size-4 -translate-y-1/2 text-sidebar-muted" }),
116
- /* @__PURE__ */ e(
117
- G,
118
- {
119
- type: "search",
120
- value: S,
121
- onChange: (s) => {
122
- j(s.target.value);
123
- },
124
- placeholder: v,
125
- className: l(
126
- "bg-sidebar-accent/40 border-sidebar-border pl-9 text-sidebar-foreground placeholder:text-sidebar-muted",
127
- o ? "h-8 text-sm" : "h-9"
128
- )
129
- }
130
- )
131
- ] }) }),
132
- /* @__PURE__ */ e("div", { className: l("flex-1 overflow-y-auto scrollbar-modern", h ? "px-0" : "px-2", o ? "py-2" : "py-4"), children: c ? Array.from({ length: 5 }).map((s, f) => /* @__PURE__ */ n("div", { className: l("flex items-center gap-3", o ? "mb-1 h-9" : "mb-2 h-12", h ? "justify-center px-3" : "px-4"), children: [
133
- /* @__PURE__ */ e(O, { className: "size-5 flex-shrink-0 rounded-control" }),
134
- !h && /* @__PURE__ */ e(O, { className: "h-4 flex-1" })
135
- ] }, f)) : t.map((s, f) => /* @__PURE__ */ n("div", { className: o ? "mb-3" : "mb-6", children: [
136
- !h && s.title !== void 0 && s.title !== "" && /* @__PURE__ */ e("h3", { className: l("px-4 text-xs uppercase tracking-wider font-semibold text-sidebar-muted", o ? "mb-1" : "mb-2"), children: s.title }),
137
- /* @__PURE__ */ e("nav", { className: l("flex flex-col", o ? "gap-0.5" : "gap-1"), children: s.items.map((w, k) => /* @__PURE__ */ e(U, { ...w, currentPath: d, collapsed: h, dense: o, onItemClick: A }, k)) })
138
- ] }, f)) }),
139
- x && /* @__PURE__ */ e("div", { className: l("border-t border-sidebar-border", o ? "p-2" : "p-4", h ? "flex justify-center" : ""), children: x })
140
- ] });
141
- return u ? /* @__PURE__ */ e(
142
- H,
143
- {
144
- open: T,
145
- onOpenChange: (s) => {
146
- y(!s);
147
- },
148
- children: /* @__PURE__ */ n(_, { side: "left", className: "w-[16rem] p-0 bg-sidebar border-r border-sidebar-border overflow-hidden [&>button]:text-sidebar-foreground", children: [
149
- /* @__PURE__ */ e(E, { className: "sr-only", children: "Menu de navigation" }),
150
- /* @__PURE__ */ e(J, { className: "sr-only", children: "Navigation principale de l'application" }),
151
- C
152
- ] })
153
- }
154
- ) : /* @__PURE__ */ e(q, { delayDuration: 0, children: /* @__PURE__ */ e(
155
- "aside",
156
- {
157
- className: l(
158
- "flex flex-col bg-sidebar h-screen border-r border-sidebar-border transition-all duration-300",
159
- h ? "w-[--navbar-width-icon]" : "w-[--navbar-width]",
160
- "flex"
161
- ),
162
- style: {
163
- "--navbar-width": "16rem",
164
- "--navbar-width-icon": "4rem"
165
- },
166
- children: C
167
- }
168
- ) });
169
- }, se = ({
170
- name: a = "appname",
171
- subName: d = "appsubname",
172
- // eslint-disable-next-line @typescript-eslint/naming-convention
173
- icon: m,
174
- dense: i = !1
175
- }) => {
176
- const { collapsed: r, isMobile: o } = W(), c = o ? !1 : r;
177
- return /* @__PURE__ */ n("div", { className: l("flex items-center flex-shrink-0 gap-3 px-4", i ? "h-14" : "h-16 md:h-20", c ? "justify-center" : ""), children: [
178
- m !== void 0 && /* @__PURE__ */ e("div", { className: "flex-shrink-0 text-sidebar-foreground", children: /* @__PURE__ */ e(m, { className: i ? "size-5" : "size-6" }) }),
179
- !c && /* @__PURE__ */ n("div", { className: "flex flex-col", children: [
180
- /* @__PURE__ */ e("h1", { className: l("font-bold text-sidebar-foreground leading-tight", i ? "text-base" : "text-lg"), children: a }),
181
- /* @__PURE__ */ e("span", { className: l("text-sidebar-muted font-medium", i ? "text-[11px]" : "text-xs"), children: d })
182
- ] })
183
- ] });
184
- }, le = ({ collapsed: a, isMobile: d, onToggleSidebar: m, actionsNode: i, userMenuNode: r }) => /* @__PURE__ */ n(
185
- "header",
186
- {
187
- className: l(
188
- "fixed top-0 right-0 z-[60] h-16 md:h-20 bg-topbar text-topbar-foreground flex items-center justify-between px-4 transition-all duration-300",
189
- d && "left-0",
190
- !d && a && "left-[5rem]",
191
- !d && !a && "left-[16rem]"
192
- ),
193
- tabIndex: -1,
194
- children: [
195
- /* @__PURE__ */ e("div", { className: "flex items-center min-w-0 flex-1", children: /* @__PURE__ */ e(
196
- F,
197
- {
198
- variant: "ghost",
199
- size: "icon",
200
- onClick: m,
201
- className: "text-topbar-foreground hover:bg-topbar-accent hover:text-topbar-accent-foreground",
202
- children: /* @__PURE__ */ e(M, { className: "size-4" })
203
- }
204
- ) }),
205
- /* @__PURE__ */ n("div", { className: "flex items-center gap-2 md:gap-4 flex-shrink-0", children: [
206
- i,
207
- r
208
- ] })
209
- ]
210
- }
211
- );
212
- export {
213
- ie as S,
214
- le as T,
215
- se as a,
216
- U as b
217
- };
@@ -1,87 +0,0 @@
1
- import { jsx as o, jsxs as l } from "react/jsx-runtime";
2
- import { c as i } from "./tailwind.helper-B6yFEsav.js";
3
- import * as r from "react";
4
- import { e as f } from "./tooltip-DVeqVwqV.js";
5
- import * as a from "@radix-ui/react-dialog";
6
- import { cva as c } from "class-variance-authority";
7
- import { X as p } from "lucide-react";
8
- const u = r.forwardRef(({ className: e, type: t, ...s }, n) => /* @__PURE__ */ o(
9
- "input",
10
- {
11
- type: t,
12
- className: i(
13
- f,
14
- // text-base sur mobile : évite le zoom automatique d'iOS à la prise de focus.
15
- "flex w-full text-base file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 md:text-sm",
16
- e
17
- ),
18
- ref: n,
19
- ...s
20
- }
21
- ));
22
- u.displayName = "Input";
23
- const D = a.Root, j = a.Trigger, k = a.Close, g = a.Portal, d = r.forwardRef(
24
- ({ className: e, ...t }, s) => /* @__PURE__ */ o(
25
- a.Overlay,
26
- {
27
- className: i(
28
- "fixed inset-0 z-[70] bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
29
- e
30
- ),
31
- ...t,
32
- ref: s
33
- }
34
- )
35
- );
36
- d.displayName = a.Overlay.displayName;
37
- const h = c(
38
- "fixed z-[70] gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
39
- {
40
- variants: {
41
- side: {
42
- top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
43
- bottom: "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
44
- left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
45
- right: "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"
46
- }
47
- },
48
- defaultVariants: {
49
- side: "right"
50
- }
51
- }
52
- ), x = r.forwardRef(
53
- ({ side: e = "right", className: t, children: s, ...n }, m) => /* @__PURE__ */ l(g, { children: [
54
- /* @__PURE__ */ o(d, {}),
55
- /* @__PURE__ */ l(a.Content, { ref: m, className: i(h({ side: e }), t), ...n, children: [
56
- s,
57
- /* @__PURE__ */ l(a.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-secondary hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none", children: [
58
- /* @__PURE__ */ o(p, { className: "size-4" }),
59
- /* @__PURE__ */ o("span", { className: "sr-only", children: "Close" })
60
- ] })
61
- ] })
62
- ] })
63
- );
64
- x.displayName = a.Content.displayName;
65
- const b = ({ className: e, ...t }) => /* @__PURE__ */ o("div", { className: i("flex flex-col space-y-2 text-center sm:text-left", e), ...t });
66
- b.displayName = "SheetHeader";
67
- const y = ({ className: e, ...t }) => /* @__PURE__ */ o("div", { className: i("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", e), ...t });
68
- y.displayName = "SheetFooter";
69
- const N = r.forwardRef(
70
- ({ className: e, ...t }, s) => /* @__PURE__ */ o(a.Title, { ref: s, className: i("text-lg font-semibold text-foreground", e), ...t })
71
- );
72
- N.displayName = a.Title.displayName;
73
- const v = r.forwardRef(({ className: e, ...t }, s) => /* @__PURE__ */ o(a.Description, { ref: s, className: i("text-sm text-muted-foreground", e), ...t }));
74
- v.displayName = a.Description.displayName;
75
- export {
76
- u as I,
77
- D as S,
78
- k as a,
79
- x as b,
80
- v as c,
81
- y as d,
82
- b as e,
83
- d as f,
84
- g,
85
- N as h,
86
- j as i
87
- };
@@ -1,72 +0,0 @@
1
- import { TrashIcon as l } from "lucide-react";
2
- import { useState as c, useContext as u } from "react";
3
- import { P as m } from "./sidebar.context-D5nywlmP.js";
4
- const g = (e) => {
5
- const [n, t] = c(null), i = (o, s) => {
6
- var a;
7
- (a = e == null ? void 0 : e.onReset) == null || a.call(e), t({ id: o, name: s });
8
- }, r = () => {
9
- t(null);
10
- };
11
- return {
12
- id: (n == null ? void 0 : n.id) ?? null,
13
- name: (n == null ? void 0 : n.name) ?? null,
14
- isOpen: !!n,
15
- openDialog: i,
16
- onClose: r
17
- };
18
- }, f = ({
19
- titleKey: e,
20
- descriptionKey: n,
21
- confirmKey: t = "Confirmer",
22
- onConfirm: i,
23
- onReset: r
24
- }) => {
25
- const o = g({ onReset: r }), s = async () => {
26
- if (o.id)
27
- try {
28
- await i(o.id), o.onClose();
29
- } catch (a) {
30
- console.error("Error confirming action:", a);
31
- }
32
- };
33
- return {
34
- isOpen: o.isOpen,
35
- itemName: o.name,
36
- title: e,
37
- description: n,
38
- confirmKey: t,
39
- openDialog: o.openDialog,
40
- onClose: o.onClose,
41
- onConfirm: s
42
- };
43
- }, h = ({
44
- titleKey: e,
45
- descriptionKey: n,
46
- confirmKey: t = "Supprimer",
47
- onConfirm: i,
48
- onReset: r
49
- }) => ({
50
- ...f({
51
- titleKey: e,
52
- descriptionKey: n,
53
- confirmKey: t,
54
- onConfirm: i,
55
- onReset: r
56
- }),
57
- loadingKey: "Suppression...",
58
- icon: l,
59
- titleClassName: "flex items-center gap-2 text-destructive",
60
- headerClassName: "bg-gradient-to-r from-slate-900 to-purple-700 rounded-t-surface shrink-0"
61
- }), x = () => {
62
- const e = u(m);
63
- if (e === void 0)
64
- throw new Error("usePage must be used within an PageProvider");
65
- return e;
66
- };
67
- export {
68
- f as a,
69
- g as b,
70
- x as c,
71
- h as u
72
- };