@krosoft/react 0.0.206 → 0.0.208

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.
@@ -0,0 +1,306 @@
1
+ import { jsxs as i, Fragment as A, jsx as e } from "react/jsx-runtime";
2
+ import * as j from "react";
3
+ import { SearchIcon as O, LoaderCircleIcon as W, ChevronDownIcon as M, MenuIcon as B } from "lucide-react";
4
+ import { c as o } from "./tailwind.helper-B6yFEsav.js";
5
+ import { B as E, T as F, c as Q, a as q, b as H } from "./tooltip-DVeqVwqV.js";
6
+ import { j as U, m as V, o as _, k as J, l as X, n as Y, I as Z, S as P, s as I, y as ee, t as re } from "./sheet-C-QvdRNi.js";
7
+ import "./sidebar.context-D5nywlmP.js";
8
+ import { u as G } from "./useSidebar-BJuALHqQ.js";
9
+ import "react-i18next";
10
+ import "next-themes";
11
+ import { S as $ } from "./skeleton-BX4RcsiK.js";
12
+ const he = ({
13
+ groups: a,
14
+ search: m,
15
+ onSearch: f,
16
+ onSelect: l,
17
+ loading: r = !1,
18
+ open: n,
19
+ onOpenChange: d,
20
+ trigger: b = !0,
21
+ triggerLabel: v = "Rechercher",
22
+ shortcut: u = !0,
23
+ shortcutLabel: g = "Ctrl+K",
24
+ placeholder: k = "Rechercher...",
25
+ emptyLabel: C = "Aucun résultat.",
26
+ loadingLabel: S = "Recherche...",
27
+ title: z = "Recherche globale",
28
+ description: T = "Rechercher une page ou une donnée dans l'application.",
29
+ hint: x,
30
+ className: D
31
+ }) => {
32
+ const [K, N] = j.useState(!1), s = n !== void 0, y = s ? n : K, t = j.useCallback(
33
+ (c) => {
34
+ s || N(c), d == null || d(c);
35
+ },
36
+ [s, d]
37
+ );
38
+ j.useEffect(() => {
39
+ if (!u) return;
40
+ const c = (h) => {
41
+ h.key.toLowerCase() !== "k" || !(h.metaKey || h.ctrlKey) || (h.preventDefault(), t(!y));
42
+ };
43
+ return window.addEventListener("keydown", c), () => {
44
+ window.removeEventListener("keydown", c);
45
+ };
46
+ }, [u, y, t]);
47
+ const p = (c) => {
48
+ t(!1), f(""), l(c);
49
+ }, w = a.some((c) => c.items.length > 0);
50
+ return /* @__PURE__ */ i(A, { children: [
51
+ b && /* @__PURE__ */ e(
52
+ E,
53
+ {
54
+ variant: "ghost",
55
+ size: "icon",
56
+ "aria-label": v,
57
+ title: u ? `${v} (${g})` : v,
58
+ className: "rounded-full",
59
+ onClick: () => {
60
+ t(!0);
61
+ },
62
+ children: /* @__PURE__ */ e(O, { className: "size-4" })
63
+ }
64
+ ),
65
+ /* @__PURE__ */ i(U, { open: y, onOpenChange: t, title: z, description: T, shouldFilter: !1, className: D, children: [
66
+ /* @__PURE__ */ e(V, { value: m, onValueChange: f, placeholder: k }),
67
+ /* @__PURE__ */ i(_, { children: [
68
+ r && /* @__PURE__ */ i("div", { className: "flex items-center justify-center gap-2 py-6 text-sm text-muted-foreground", children: [
69
+ /* @__PURE__ */ e(W, { className: "size-4 animate-spin" }),
70
+ S
71
+ ] }),
72
+ !w && !r && /* @__PURE__ */ e(J, { children: C }),
73
+ a.map(
74
+ (c) => c.items.length === 0 ? null : /* @__PURE__ */ e(X, { heading: c.heading, children: c.items.map((h) => {
75
+ const L = h.icon;
76
+ return /* @__PURE__ */ i(
77
+ Y,
78
+ {
79
+ value: h.key,
80
+ className: "gap-3 px-2 py-2",
81
+ onSelect: () => {
82
+ p(h);
83
+ },
84
+ children: [
85
+ L && /* @__PURE__ */ e("span", { className: o("flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground", h.iconClassName), children: /* @__PURE__ */ e(L, { className: "size-4" }) }),
86
+ /* @__PURE__ */ i("span", { className: "flex min-w-0 flex-1 flex-col", children: [
87
+ /* @__PURE__ */ e("span", { className: "truncate font-medium", children: h.label }),
88
+ h.description !== void 0 && h.description !== "" && /* @__PURE__ */ e("span", { className: "truncate text-xs text-muted-foreground", children: h.description })
89
+ ] })
90
+ ]
91
+ },
92
+ h.key
93
+ );
94
+ }) }, c.heading)
95
+ )
96
+ ] }),
97
+ x !== void 0 && w && !r && /* @__PURE__ */ e("div", { className: "border-t border-border p-2 text-center text-xs text-muted-foreground", children: x })
98
+ ] })
99
+ ] });
100
+ }, R = (a, m, f) => m === a ? !0 : a === "/" || !m.startsWith(`${a}/`) ? !1 : !f.some(
101
+ (l) => l !== a && l.startsWith(`${a}/`) && (m === l || m.startsWith(`${l}/`))
102
+ ), ae = ({
103
+ path: a,
104
+ // eslint-disable-next-line @typescript-eslint/naming-convention
105
+ icon: m,
106
+ label: f,
107
+ badge: l,
108
+ subItems: r,
109
+ currentPath: n,
110
+ collapsed: d,
111
+ dense: b = !1,
112
+ onItemClick: v
113
+ }) => {
114
+ const u = (r == null ? void 0 : r.map((s) => s.path)) ?? [], [g, k] = j.useState((r == null ? void 0 : r.some((s) => R(s.path, n, u))) ?? !1), C = a ? n === a || a !== "/" && n.startsWith(`${a}/`) : !1, S = r == null ? void 0 : r.some((s) => R(s.path, n, u)), N = /* @__PURE__ */ i(
115
+ "a",
116
+ {
117
+ href: a ?? "#",
118
+ onClick: (s) => {
119
+ s.ctrlKey || s.metaKey || s.button === 1 || (s.preventDefault(), r && r.length > 0 ? d || k(!g) : a && v(a));
120
+ },
121
+ className: o(
122
+ "flex items-center cursor-pointer transition-all duration-200 group rounded-control",
123
+ b ? "gap-2.5 mb-0.5" : "gap-3 mb-1",
124
+ d ? b ? "justify-center p-2 h-9 w-9 mx-auto" : "justify-center p-3 h-12 w-12 mx-auto" : b ? "px-3 py-1.5 h-9" : "px-4 py-3 h-12",
125
+ C || !d && S ? b ? "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"
126
+ ),
127
+ children: [
128
+ /* @__PURE__ */ e("div", { className: o("flex-shrink-0 transition-transform group-hover:scale-110", d ? "flex items-center justify-center" : ""), children: /* @__PURE__ */ e(m, { className: "size-4" }) }),
129
+ !d && /* @__PURE__ */ i(A, { children: [
130
+ /* @__PURE__ */ e("span", { className: o("flex-grow transition-opacity duration-150 font-medium", b ? "text-sm" : ""), children: f }),
131
+ l !== 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: l }),
132
+ r && r.length > 0 && /* @__PURE__ */ e(M, { className: o("size-4 transition-transform duration-200", g ? "rotate-180" : "") })
133
+ ] })
134
+ ]
135
+ }
136
+ );
137
+ return /* @__PURE__ */ i(A, { children: [
138
+ d ? /* @__PURE__ */ i(F, { children: [
139
+ /* @__PURE__ */ e(Q, { asChild: !0, children: N }),
140
+ /* @__PURE__ */ e(
141
+ q,
142
+ {
143
+ side: "right",
144
+ sideOffset: 6,
145
+ className: "rounded-surface z-[99999] flex gap-2 bg-sidebar text-sidebar-foreground border border-sidebar-border py-2 text-sm shadow-lg",
146
+ children: /* @__PURE__ */ e("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
147
+ /* @__PURE__ */ e("p", { className: "font-semibold", children: f }),
148
+ l !== void 0 && /* @__PURE__ */ i("span", { className: "ml-1 text-xs", children: [
149
+ "(",
150
+ l,
151
+ ")"
152
+ ] })
153
+ ] }) })
154
+ }
155
+ )
156
+ ] }) : N,
157
+ !d && r && r.length > 0 && g && /* @__PURE__ */ e(
158
+ "div",
159
+ {
160
+ className: o(
161
+ "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",
162
+ b ? "gap-0.5 mb-0.5" : "gap-1 mb-2"
163
+ ),
164
+ children: r.map((s, y) => {
165
+ const t = R(s.path, n, u);
166
+ return /* @__PURE__ */ i(
167
+ "a",
168
+ {
169
+ href: s.path,
170
+ onClick: (p) => {
171
+ p.ctrlKey || p.metaKey || p.button === 1 || (p.preventDefault(), v(s.path));
172
+ },
173
+ className: o(
174
+ "flex items-center justify-between rounded-control text-sm transition-all duration-200",
175
+ b ? "px-3 py-1" : "px-4 py-2",
176
+ t ? "bg-sidebar-accent/50 text-sidebar-primary font-semibold" : "text-sidebar-muted hover:bg-sidebar-accent hover:text-sidebar-foreground"
177
+ ),
178
+ children: [
179
+ /* @__PURE__ */ e("span", { children: s.label }),
180
+ s.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: s.badge })
181
+ ]
182
+ },
183
+ y
184
+ );
185
+ })
186
+ }
187
+ )
188
+ ] });
189
+ }, pe = ({ groups: a, currentPath: m, onItemClick: f, slots: l, search: r, dense: n = !1, loading: d = !1 }) => {
190
+ const { enabled: b = !1, placeholder: v = "Rechercher..." } = r ?? {}, { header: u, footer: g } = l ?? {}, { collapsed: k, isMobile: C, setCollapsed: S } = G(), [z, T] = j.useState(""), x = C ? !1 : k, D = !k, K = (t) => {
191
+ f(t), C && S(!0);
192
+ }, N = z.trim().toLowerCase(), s = N === "" ? a : a.map((t) => ({
193
+ ...t,
194
+ items: t.items.filter(
195
+ (p) => {
196
+ var w;
197
+ return p.label.toLowerCase().includes(N) || (((w = p.subItems) == null ? void 0 : w.some((c) => c.label.toLowerCase().includes(N))) ?? !1);
198
+ }
199
+ )
200
+ })).filter((t) => t.items.length > 0), y = /* @__PURE__ */ i("div", { className: "flex flex-col h-full bg-sidebar text-sidebar-foreground", children: [
201
+ u,
202
+ b && !x && /* @__PURE__ */ e("div", { className: o("px-4", n ? "pt-2" : "pt-4"), children: /* @__PURE__ */ i("div", { className: "relative", children: [
203
+ /* @__PURE__ */ e(O, { className: "absolute left-3 top-1/2 size-4 -translate-y-1/2 text-sidebar-muted" }),
204
+ /* @__PURE__ */ e(
205
+ Z,
206
+ {
207
+ type: "search",
208
+ value: z,
209
+ onChange: (t) => {
210
+ T(t.target.value);
211
+ },
212
+ placeholder: v,
213
+ className: o(
214
+ "bg-sidebar-accent/40 border-sidebar-border pl-9 text-sidebar-foreground placeholder:text-sidebar-muted",
215
+ n ? "h-8 text-sm" : "h-9"
216
+ )
217
+ }
218
+ )
219
+ ] }) }),
220
+ /* @__PURE__ */ e("div", { className: o("flex-1 overflow-y-auto scrollbar-modern", x ? "px-0" : "px-2", n ? "py-2" : "py-4"), children: d ? Array.from({ length: 5 }).map((t, p) => /* @__PURE__ */ i("div", { className: o("flex items-center gap-3", n ? "mb-1 h-9" : "mb-2 h-12", x ? "justify-center px-3" : "px-4"), children: [
221
+ /* @__PURE__ */ e($, { className: "size-5 flex-shrink-0 rounded-control" }),
222
+ !x && /* @__PURE__ */ e($, { className: "h-4 flex-1" })
223
+ ] }, p)) : s.map((t, p) => /* @__PURE__ */ i("div", { className: n ? "mb-3" : "mb-6", children: [
224
+ !x && t.title !== void 0 && t.title !== "" && /* @__PURE__ */ e("h3", { className: o("px-4 text-xs uppercase tracking-wider font-semibold text-sidebar-muted", n ? "mb-1" : "mb-2"), children: t.title }),
225
+ /* @__PURE__ */ e("nav", { className: o("flex flex-col", n ? "gap-0.5" : "gap-1"), children: t.items.map((w, c) => /* @__PURE__ */ e(ae, { ...w, currentPath: m, collapsed: x, dense: n, onItemClick: K }, c)) })
226
+ ] }, p)) }),
227
+ g && /* @__PURE__ */ e("div", { className: o("border-t border-sidebar-border", n ? "p-2" : "p-4", x ? "flex justify-center" : ""), children: g })
228
+ ] });
229
+ return C ? /* @__PURE__ */ e(
230
+ P,
231
+ {
232
+ open: D,
233
+ onOpenChange: (t) => {
234
+ S(!t);
235
+ },
236
+ children: /* @__PURE__ */ i(I, { side: "left", className: "w-[16rem] p-0 bg-sidebar border-r border-sidebar-border overflow-hidden [&>button]:text-sidebar-foreground", children: [
237
+ /* @__PURE__ */ e(ee, { className: "sr-only", children: "Menu de navigation" }),
238
+ /* @__PURE__ */ e(re, { className: "sr-only", children: "Navigation principale de l'application" }),
239
+ y
240
+ ] })
241
+ }
242
+ ) : /* @__PURE__ */ e(H, { delayDuration: 0, children: /* @__PURE__ */ e(
243
+ "aside",
244
+ {
245
+ className: o(
246
+ "flex flex-col bg-sidebar h-screen border-r border-sidebar-border transition-all duration-300",
247
+ x ? "w-[--navbar-width-icon]" : "w-[--navbar-width]",
248
+ "flex"
249
+ ),
250
+ style: {
251
+ "--navbar-width": "16rem",
252
+ "--navbar-width-icon": "4rem"
253
+ },
254
+ children: y
255
+ }
256
+ ) });
257
+ }, xe = ({
258
+ name: a = "appname",
259
+ subName: m = "appsubname",
260
+ // eslint-disable-next-line @typescript-eslint/naming-convention
261
+ icon: f,
262
+ dense: l = !1
263
+ }) => {
264
+ const { collapsed: r, isMobile: n } = G(), d = n ? !1 : r;
265
+ return /* @__PURE__ */ i("div", { className: o("flex items-center flex-shrink-0 gap-3 px-4", l ? "h-14" : "h-16 md:h-20", d ? "justify-center" : ""), children: [
266
+ f !== void 0 && /* @__PURE__ */ e("div", { className: "flex-shrink-0 text-sidebar-foreground", children: /* @__PURE__ */ e(f, { className: l ? "size-5" : "size-6" }) }),
267
+ !d && /* @__PURE__ */ i("div", { className: "flex flex-col", children: [
268
+ /* @__PURE__ */ e("h1", { className: o("font-bold text-sidebar-foreground leading-tight", l ? "text-base" : "text-lg"), children: a }),
269
+ /* @__PURE__ */ e("span", { className: o("text-sidebar-muted font-medium", l ? "text-[11px]" : "text-xs"), children: m })
270
+ ] })
271
+ ] });
272
+ }, be = ({ collapsed: a, isMobile: m, onToggleSidebar: f, actionsNode: l, userMenuNode: r }) => /* @__PURE__ */ i(
273
+ "header",
274
+ {
275
+ className: o(
276
+ "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",
277
+ m && "left-0",
278
+ !m && a && "left-[5rem]",
279
+ !m && !a && "left-[16rem]"
280
+ ),
281
+ tabIndex: -1,
282
+ children: [
283
+ /* @__PURE__ */ e("div", { className: "flex items-center min-w-0 flex-1", children: /* @__PURE__ */ e(
284
+ E,
285
+ {
286
+ variant: "ghost",
287
+ size: "icon",
288
+ onClick: f,
289
+ className: "text-topbar-foreground hover:bg-topbar-accent hover:text-topbar-accent-foreground",
290
+ children: /* @__PURE__ */ e(B, { className: "size-4" })
291
+ }
292
+ ) }),
293
+ /* @__PURE__ */ i("div", { className: "flex items-center gap-2 md:gap-4 flex-shrink-0", children: [
294
+ l,
295
+ r
296
+ ] })
297
+ ]
298
+ }
299
+ );
300
+ export {
301
+ he as G,
302
+ pe as S,
303
+ be as T,
304
+ xe as a,
305
+ ae as b
306
+ };
@@ -13,7 +13,7 @@ import { A as $ } from "../../AppActions-ViFjSupi.js";
13
13
  import { A as ra, K as ea } from "../../KpiCardsLayout-D9NSC5Fb.js";
14
14
  import { A as sa } from "../../AppSubTitle-ClHzadQW.js";
15
15
  import { A as ia } from "../../AppTitle-D15YXeMx.js";
16
- import { G as pa, S as ba, a as ma, b as ga, T as ca } from "../../Topbar-0EBMHLwG.js";
16
+ import { G as pa, S as ba, a as ma, b as ga, T as ca } from "../../Topbar-158DklWB.js";
17
17
  import { E as fa } from "../../ErrorAlert-SrIcU1mM.js";
18
18
  import { E as na } from "../../ErrorState-CmaxuJyW.js";
19
19
  import { L as Ta } from "../../LoadingState-BN0YaPSs.js";
@@ -6,6 +6,12 @@ export interface GlobalSearchItem {
6
6
  /** Seconde ligne, en plus discret : module parent, référence, date… */
7
7
  description?: string;
8
8
  icon?: React.ElementType;
9
+ /**
10
+ * Classes de la pastille d'icône : fond et couleur du glyphe, qui hérite de
11
+ * `currentColor` — par exemple `"bg-blue-500/10 text-blue-500"`. Sans valeur,
12
+ * la pastille est neutre.
13
+ */
14
+ iconClassName?: string;
9
15
  /** Chemin de destination, laissé à la charge de l'appelant dans `onSelect`. */
10
16
  path?: string;
11
17
  }
@@ -34,6 +40,8 @@ export interface GlobalSearchProps {
34
40
  loadingLabel?: string;
35
41
  title?: string;
36
42
  description?: string;
43
+ /** Ligne d'aide sous la liste, visible seulement quand il y a des résultats. */
44
+ hint?: React.ReactNode;
37
45
  className?: string;
38
46
  }
39
47
  /**
@@ -48,5 +56,5 @@ export interface GlobalSearchProps {
48
56
  * arrivent déjà filtrés en amont — côté serveur pour les données, sans accents pour
49
57
  * les pages — et cmdk en masquerait une partie en refiltrant sur la saisie brute.
50
58
  */
51
- export declare const GlobalSearch: ({ groups, search, onSearch, onSelect, loading, open, onOpenChange, trigger, triggerLabel, shortcut, shortcutLabel, placeholder, emptyLabel, loadingLabel, title, description, className, }: GlobalSearchProps) => React.ReactElement;
59
+ export declare const GlobalSearch: ({ groups, search, onSearch, onSelect, loading, open, onOpenChange, trigger, triggerLabel, shortcut, shortcutLabel, placeholder, emptyLabel, loadingLabel, title, description, hint, className, }: GlobalSearchProps) => React.ReactElement;
52
60
  //# sourceMappingURL=GlobalSearch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GlobalSearch.d.ts","sourceRoot":"","sources":["../../../../src/components/core/navbar/GlobalSearch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,MAAM,WAAW,gBAAgB;IAC/B,6EAA6E;IAC7E,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC;IACzB,+EAA+E;IAC/E,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,gBAAgB,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,iBAAiB;IAChC,8EAA8E;IAC9E,MAAM,EAAE,iBAAiB,EAAE,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAE3C,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,+EAA+E;IAC/E,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAEvC,wFAAwF;IACxF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,GAAI,4LAkB1B,iBAAiB,KAAG,KAAK,CAAC,YAiG5B,CAAC"}
1
+ {"version":3,"file":"GlobalSearch.d.ts","sourceRoot":"","sources":["../../../../src/components/core/navbar/GlobalSearch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,MAAM,WAAW,gBAAgB;IAC/B,6EAA6E;IAC7E,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC;IACzB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,+EAA+E;IAC/E,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,gBAAgB,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,iBAAiB;IAChC,8EAA8E;IAC9E,MAAM,EAAE,iBAAiB,EAAE,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAE3C,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,+EAA+E;IAC/E,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAEvC,wFAAwF;IACxF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,GAAI,kMAmB1B,iBAAiB,KAAG,KAAK,CAAC,YA2G5B,CAAC"}
@@ -1,4 +1,4 @@
1
- import { G as r, S as b, a as s, b as S, T as d } from "../../../Topbar-0EBMHLwG.js";
1
+ import { G as r, S as b, a as s, b as S, T as d } from "../../../Topbar-158DklWB.js";
2
2
  export {
3
3
  r as GlobalSearch,
4
4
  b as Sidebar,
@@ -13,7 +13,7 @@ import { A as uo } from "../AppActions-ViFjSupi.js";
13
13
  import { A as go, K as mo } from "../KpiCardsLayout-D9NSC5Fb.js";
14
14
  import { A as To } from "../AppSubTitle-ClHzadQW.js";
15
15
  import { A as Do } from "../AppTitle-D15YXeMx.js";
16
- import { G as xo, S as Ao, a as ho, b as fo, T as Po } from "../Topbar-0EBMHLwG.js";
16
+ import { G as xo, S as Ao, a as ho, b as fo, T as Po } from "../Topbar-158DklWB.js";
17
17
  import { E as wo } from "../ErrorAlert-SrIcU1mM.js";
18
18
  import { E as Fo } from "../ErrorState-CmaxuJyW.js";
19
19
  import { L as Bo } from "../LoadingState-BN0YaPSs.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krosoft/react",
3
- "version": "0.0.206",
3
+ "version": "0.0.208",
4
4
  "description": "Krosoft shared React package",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -95,7 +95,7 @@
95
95
  "zod": "^4.4.3"
96
96
  },
97
97
  "devDependencies": {
98
- "@krosoft/core": "^0.0.58",
98
+ "@krosoft/core": "^0.0.59",
99
99
  "@krosoft/tooling-eslint-react": "^0.0.27",
100
100
  "@krosoft/tooling-prettier": "^0.0.18",
101
101
  "@krosoft/tooling-tsconfig-react": "^0.0.10",
@@ -1,301 +0,0 @@
1
- import { jsxs as s, Fragment as R, jsx as e } from "react/jsx-runtime";
2
- import * as z from "react";
3
- import { SearchIcon as $, LoaderCircleIcon as G, ChevronDownIcon as W, MenuIcon as M } from "lucide-react";
4
- import { B as O, T as B, c as F, a as Q, b as q } from "./tooltip-DVeqVwqV.js";
5
- import { j as H, m as U, o as V, k as _, l as J, n as X, I as Y, S as Z, s as P, y as I, t as ee } from "./sheet-C-QvdRNi.js";
6
- import { c } from "./tailwind.helper-B6yFEsav.js";
7
- import "./sidebar.context-D5nywlmP.js";
8
- import { u as E } from "./useSidebar-BJuALHqQ.js";
9
- import "react-i18next";
10
- import "next-themes";
11
- import { S as L } from "./skeleton-BX4RcsiK.js";
12
- const fe = ({
13
- groups: a,
14
- search: f,
15
- onSearch: h,
16
- onSelect: i,
17
- loading: r = !1,
18
- open: l,
19
- onOpenChange: d,
20
- trigger: x = !0,
21
- triggerLabel: y = "Rechercher",
22
- shortcut: g = !0,
23
- shortcutLabel: N = "Ctrl+K",
24
- placeholder: w = "Rechercher...",
25
- emptyLabel: C = "Aucun résultat.",
26
- loadingLabel: k = "Recherche...",
27
- title: S = "Recherche globale",
28
- description: j = "Rechercher une page ou une donnée dans l'application.",
29
- className: b
30
- }) => {
31
- const [T, D] = z.useState(!1), u = l !== void 0, t = u ? l : T, v = z.useCallback(
32
- (o) => {
33
- u || D(o), d == null || d(o);
34
- },
35
- [u, d]
36
- );
37
- z.useEffect(() => {
38
- if (!g) return;
39
- const o = (m) => {
40
- m.key.toLowerCase() !== "k" || !(m.metaKey || m.ctrlKey) || (m.preventDefault(), v(!t));
41
- };
42
- return window.addEventListener("keydown", o), () => {
43
- window.removeEventListener("keydown", o);
44
- };
45
- }, [g, t, v]);
46
- const n = (o) => {
47
- v(!1), h(""), i(o);
48
- }, p = a.some((o) => o.items.length > 0);
49
- return /* @__PURE__ */ s(R, { children: [
50
- x && /* @__PURE__ */ e(
51
- O,
52
- {
53
- variant: "ghost",
54
- size: "icon",
55
- "aria-label": y,
56
- title: g ? `${y} (${N})` : y,
57
- className: "rounded-full",
58
- onClick: () => {
59
- v(!0);
60
- },
61
- children: /* @__PURE__ */ e($, { className: "size-4" })
62
- }
63
- ),
64
- /* @__PURE__ */ s(H, { open: t, onOpenChange: v, title: S, description: j, shouldFilter: !1, className: b, children: [
65
- /* @__PURE__ */ e(U, { value: f, onValueChange: h, placeholder: w }),
66
- /* @__PURE__ */ s(V, { children: [
67
- r && /* @__PURE__ */ s("div", { className: "flex items-center justify-center gap-2 py-6 text-sm text-muted-foreground", children: [
68
- /* @__PURE__ */ e(G, { className: "size-4 animate-spin" }),
69
- k
70
- ] }),
71
- !p && !r && /* @__PURE__ */ e(_, { children: C }),
72
- a.map(
73
- (o) => o.items.length === 0 ? null : /* @__PURE__ */ e(J, { heading: o.heading, children: o.items.map((m) => {
74
- const A = m.icon;
75
- return /* @__PURE__ */ s(
76
- X,
77
- {
78
- value: m.key,
79
- onSelect: () => {
80
- n(m);
81
- },
82
- children: [
83
- A && /* @__PURE__ */ e(A, { className: "mr-2 size-4 shrink-0" }),
84
- /* @__PURE__ */ e("span", { className: "truncate", children: m.label }),
85
- m.description !== void 0 && m.description !== "" && /* @__PURE__ */ e("span", { className: "ml-2 truncate text-xs text-muted-foreground", children: m.description })
86
- ]
87
- },
88
- m.key
89
- );
90
- }) }, o.heading)
91
- )
92
- ] })
93
- ] })
94
- ] });
95
- }, K = (a, f, h) => f === a ? !0 : a === "/" || !f.startsWith(`${a}/`) ? !1 : !h.some(
96
- (i) => i !== a && i.startsWith(`${a}/`) && (f === i || f.startsWith(`${i}/`))
97
- ), re = ({
98
- path: a,
99
- // eslint-disable-next-line @typescript-eslint/naming-convention
100
- icon: f,
101
- label: h,
102
- badge: i,
103
- subItems: r,
104
- currentPath: l,
105
- collapsed: d,
106
- dense: x = !1,
107
- onItemClick: y
108
- }) => {
109
- const g = (r == null ? void 0 : r.map((t) => t.path)) ?? [], [N, w] = z.useState((r == null ? void 0 : r.some((t) => K(t.path, l, g))) ?? !1), C = a ? l === a || a !== "/" && l.startsWith(`${a}/`) : !1, k = r == null ? void 0 : r.some((t) => K(t.path, l, g)), u = /* @__PURE__ */ s(
110
- "a",
111
- {
112
- href: a ?? "#",
113
- onClick: (t) => {
114
- t.ctrlKey || t.metaKey || t.button === 1 || (t.preventDefault(), r && r.length > 0 ? d || w(!N) : a && y(a));
115
- },
116
- className: c(
117
- "flex items-center cursor-pointer transition-all duration-200 group rounded-control",
118
- x ? "gap-2.5 mb-0.5" : "gap-3 mb-1",
119
- d ? x ? "justify-center p-2 h-9 w-9 mx-auto" : "justify-center p-3 h-12 w-12 mx-auto" : x ? "px-3 py-1.5 h-9" : "px-4 py-3 h-12",
120
- C || !d && k ? x ? "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"
121
- ),
122
- children: [
123
- /* @__PURE__ */ e("div", { className: c("flex-shrink-0 transition-transform group-hover:scale-110", d ? "flex items-center justify-center" : ""), children: /* @__PURE__ */ e(f, { className: "size-4" }) }),
124
- !d && /* @__PURE__ */ s(R, { children: [
125
- /* @__PURE__ */ e("span", { className: c("flex-grow transition-opacity duration-150 font-medium", x ? "text-sm" : ""), children: h }),
126
- 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 }),
127
- r && r.length > 0 && /* @__PURE__ */ e(W, { className: c("size-4 transition-transform duration-200", N ? "rotate-180" : "") })
128
- ] })
129
- ]
130
- }
131
- );
132
- return /* @__PURE__ */ s(R, { children: [
133
- d ? /* @__PURE__ */ s(B, { children: [
134
- /* @__PURE__ */ e(F, { asChild: !0, children: u }),
135
- /* @__PURE__ */ e(
136
- Q,
137
- {
138
- side: "right",
139
- sideOffset: 6,
140
- className: "rounded-surface z-[99999] flex gap-2 bg-sidebar text-sidebar-foreground border border-sidebar-border py-2 text-sm shadow-lg",
141
- children: /* @__PURE__ */ e("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
142
- /* @__PURE__ */ e("p", { className: "font-semibold", children: h }),
143
- i !== void 0 && /* @__PURE__ */ s("span", { className: "ml-1 text-xs", children: [
144
- "(",
145
- i,
146
- ")"
147
- ] })
148
- ] }) })
149
- }
150
- )
151
- ] }) : u,
152
- !d && r && r.length > 0 && N && /* @__PURE__ */ e(
153
- "div",
154
- {
155
- className: c(
156
- "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",
157
- x ? "gap-0.5 mb-0.5" : "gap-1 mb-2"
158
- ),
159
- children: r.map((t, v) => {
160
- const n = K(t.path, l, g);
161
- return /* @__PURE__ */ s(
162
- "a",
163
- {
164
- href: t.path,
165
- onClick: (p) => {
166
- p.ctrlKey || p.metaKey || p.button === 1 || (p.preventDefault(), y(t.path));
167
- },
168
- className: c(
169
- "flex items-center justify-between rounded-control text-sm transition-all duration-200",
170
- x ? "px-3 py-1" : "px-4 py-2",
171
- n ? "bg-sidebar-accent/50 text-sidebar-primary font-semibold" : "text-sidebar-muted hover:bg-sidebar-accent hover:text-sidebar-foreground"
172
- ),
173
- children: [
174
- /* @__PURE__ */ e("span", { children: t.label }),
175
- 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 })
176
- ]
177
- },
178
- v
179
- );
180
- })
181
- }
182
- )
183
- ] });
184
- }, he = ({ groups: a, currentPath: f, onItemClick: h, slots: i, search: r, dense: l = !1, loading: d = !1 }) => {
185
- const { enabled: x = !1, placeholder: y = "Rechercher..." } = r ?? {}, { header: g, footer: N } = i ?? {}, { collapsed: w, isMobile: C, setCollapsed: k } = E(), [S, j] = z.useState(""), b = C ? !1 : w, T = !w, D = (n) => {
186
- h(n), C && k(!0);
187
- }, u = S.trim().toLowerCase(), t = u === "" ? a : a.map((n) => ({
188
- ...n,
189
- items: n.items.filter(
190
- (p) => {
191
- var o;
192
- return p.label.toLowerCase().includes(u) || (((o = p.subItems) == null ? void 0 : o.some((m) => m.label.toLowerCase().includes(u))) ?? !1);
193
- }
194
- )
195
- })).filter((n) => n.items.length > 0), v = /* @__PURE__ */ s("div", { className: "flex flex-col h-full bg-sidebar text-sidebar-foreground", children: [
196
- g,
197
- x && !b && /* @__PURE__ */ e("div", { className: c("px-4", l ? "pt-2" : "pt-4"), children: /* @__PURE__ */ s("div", { className: "relative", children: [
198
- /* @__PURE__ */ e($, { className: "absolute left-3 top-1/2 size-4 -translate-y-1/2 text-sidebar-muted" }),
199
- /* @__PURE__ */ e(
200
- Y,
201
- {
202
- type: "search",
203
- value: S,
204
- onChange: (n) => {
205
- j(n.target.value);
206
- },
207
- placeholder: y,
208
- className: c(
209
- "bg-sidebar-accent/40 border-sidebar-border pl-9 text-sidebar-foreground placeholder:text-sidebar-muted",
210
- l ? "h-8 text-sm" : "h-9"
211
- )
212
- }
213
- )
214
- ] }) }),
215
- /* @__PURE__ */ e("div", { className: c("flex-1 overflow-y-auto scrollbar-modern", b ? "px-0" : "px-2", l ? "py-2" : "py-4"), children: d ? Array.from({ length: 5 }).map((n, p) => /* @__PURE__ */ s("div", { className: c("flex items-center gap-3", l ? "mb-1 h-9" : "mb-2 h-12", b ? "justify-center px-3" : "px-4"), children: [
216
- /* @__PURE__ */ e(L, { className: "size-5 flex-shrink-0 rounded-control" }),
217
- !b && /* @__PURE__ */ e(L, { className: "h-4 flex-1" })
218
- ] }, p)) : t.map((n, p) => /* @__PURE__ */ s("div", { className: l ? "mb-3" : "mb-6", children: [
219
- !b && n.title !== void 0 && n.title !== "" && /* @__PURE__ */ e("h3", { className: c("px-4 text-xs uppercase tracking-wider font-semibold text-sidebar-muted", l ? "mb-1" : "mb-2"), children: n.title }),
220
- /* @__PURE__ */ e("nav", { className: c("flex flex-col", l ? "gap-0.5" : "gap-1"), children: n.items.map((o, m) => /* @__PURE__ */ e(re, { ...o, currentPath: f, collapsed: b, dense: l, onItemClick: D }, m)) })
221
- ] }, p)) }),
222
- N && /* @__PURE__ */ e("div", { className: c("border-t border-sidebar-border", l ? "p-2" : "p-4", b ? "flex justify-center" : ""), children: N })
223
- ] });
224
- return C ? /* @__PURE__ */ e(
225
- Z,
226
- {
227
- open: T,
228
- onOpenChange: (n) => {
229
- k(!n);
230
- },
231
- children: /* @__PURE__ */ s(P, { side: "left", className: "w-[16rem] p-0 bg-sidebar border-r border-sidebar-border overflow-hidden [&>button]:text-sidebar-foreground", children: [
232
- /* @__PURE__ */ e(I, { className: "sr-only", children: "Menu de navigation" }),
233
- /* @__PURE__ */ e(ee, { className: "sr-only", children: "Navigation principale de l'application" }),
234
- v
235
- ] })
236
- }
237
- ) : /* @__PURE__ */ e(q, { delayDuration: 0, children: /* @__PURE__ */ e(
238
- "aside",
239
- {
240
- className: c(
241
- "flex flex-col bg-sidebar h-screen border-r border-sidebar-border transition-all duration-300",
242
- b ? "w-[--navbar-width-icon]" : "w-[--navbar-width]",
243
- "flex"
244
- ),
245
- style: {
246
- "--navbar-width": "16rem",
247
- "--navbar-width-icon": "4rem"
248
- },
249
- children: v
250
- }
251
- ) });
252
- }, pe = ({
253
- name: a = "appname",
254
- subName: f = "appsubname",
255
- // eslint-disable-next-line @typescript-eslint/naming-convention
256
- icon: h,
257
- dense: i = !1
258
- }) => {
259
- const { collapsed: r, isMobile: l } = E(), d = l ? !1 : r;
260
- return /* @__PURE__ */ s("div", { className: c("flex items-center flex-shrink-0 gap-3 px-4", i ? "h-14" : "h-16 md:h-20", d ? "justify-center" : ""), children: [
261
- h !== void 0 && /* @__PURE__ */ e("div", { className: "flex-shrink-0 text-sidebar-foreground", children: /* @__PURE__ */ e(h, { className: i ? "size-5" : "size-6" }) }),
262
- !d && /* @__PURE__ */ s("div", { className: "flex flex-col", children: [
263
- /* @__PURE__ */ e("h1", { className: c("font-bold text-sidebar-foreground leading-tight", i ? "text-base" : "text-lg"), children: a }),
264
- /* @__PURE__ */ e("span", { className: c("text-sidebar-muted font-medium", i ? "text-[11px]" : "text-xs"), children: f })
265
- ] })
266
- ] });
267
- }, xe = ({ collapsed: a, isMobile: f, onToggleSidebar: h, actionsNode: i, userMenuNode: r }) => /* @__PURE__ */ s(
268
- "header",
269
- {
270
- className: c(
271
- "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",
272
- f && "left-0",
273
- !f && a && "left-[5rem]",
274
- !f && !a && "left-[16rem]"
275
- ),
276
- tabIndex: -1,
277
- children: [
278
- /* @__PURE__ */ e("div", { className: "flex items-center min-w-0 flex-1", children: /* @__PURE__ */ e(
279
- O,
280
- {
281
- variant: "ghost",
282
- size: "icon",
283
- onClick: h,
284
- className: "text-topbar-foreground hover:bg-topbar-accent hover:text-topbar-accent-foreground",
285
- children: /* @__PURE__ */ e(M, { className: "size-4" })
286
- }
287
- ) }),
288
- /* @__PURE__ */ s("div", { className: "flex items-center gap-2 md:gap-4 flex-shrink-0", children: [
289
- i,
290
- r
291
- ] })
292
- ]
293
- }
294
- );
295
- export {
296
- fe as G,
297
- he as S,
298
- xe as T,
299
- pe as a,
300
- re as b
301
- };