@krosoft/react 0.0.137 → 0.0.138

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,215 @@
1
+ import { jsxs as s, jsx as e, Fragment as O } from "react/jsx-runtime";
2
+ import * as W from "react";
3
+ import { ChevronDownIcon as $, SearchIcon as L, MenuIcon as B } from "lucide-react";
4
+ import { T as M, c as Q, a as R, b as q, B as F } from "./tooltip-BWyFpIxo.js";
5
+ import { c as r } from "./tailwind.helper-B6yFEsav.js";
6
+ import "./sidebar.context-D5nywlmP.js";
7
+ import { u as G } from "./useSidebar-BJuALHqQ.js";
8
+ import "react-i18next";
9
+ import "next-themes";
10
+ import { I as _, S as E, b as H, h as J, c as K } from "./sheet-Gop1cIaU.js";
11
+ import { S as A } from "./skeleton-8o8eJd3P.js";
12
+ const U = ({
13
+ path: n,
14
+ // eslint-disable-next-line @typescript-eslint/naming-convention
15
+ icon: h,
16
+ label: f,
17
+ badge: p,
18
+ subItems: t,
19
+ currentPath: o,
20
+ collapsed: m,
21
+ dense: d = !1,
22
+ onItemClick: v
23
+ }) => {
24
+ const [b, S] = W.useState((t == null ? void 0 : t.some((a) => o === a.path || o.startsWith(`${a.path}/`))) || !1), l = n ? o === n || n !== "/" && o.startsWith(`${n}/`) : !1, u = t == null ? void 0 : t.some((a) => o === a.path || o.startsWith(`${a.path}/`)), y = /* @__PURE__ */ s(
25
+ "a",
26
+ {
27
+ href: n || "#",
28
+ onClick: (a) => {
29
+ a.preventDefault(), t && t.length > 0 ? m || S(!b) : n && v(n);
30
+ },
31
+ className: r(
32
+ "flex items-center cursor-pointer transition-all duration-200 group",
33
+ d ? "gap-2.5 rounded-lg mb-0.5" : "gap-3 rounded-2xl mb-2",
34
+ m ? d ? "justify-center p-2 h-9 w-9 mx-auto" : "justify-center p-3 h-12 w-12 mx-auto" : d ? "px-3 py-1.5 h-9" : "px-4 py-3 h-12",
35
+ l || !m && u ? d ? "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"
36
+ ),
37
+ children: [
38
+ /* @__PURE__ */ e("div", { className: r("flex-shrink-0 transition-transform group-hover:scale-110", m ? "flex items-center justify-center" : ""), children: /* @__PURE__ */ e(h, { className: "size-4" }) }),
39
+ !m && /* @__PURE__ */ s(O, { children: [
40
+ /* @__PURE__ */ e("span", { className: r("flex-grow transition-opacity duration-150 font-medium", d ? "text-sm" : ""), children: f }),
41
+ p !== 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: p }),
42
+ t && t.length > 0 && /* @__PURE__ */ e($, { className: r("size-4 transition-transform duration-200", b ? "rotate-180" : "") })
43
+ ] })
44
+ ]
45
+ }
46
+ );
47
+ return /* @__PURE__ */ s(O, { children: [
48
+ m ? /* @__PURE__ */ s(M, { children: [
49
+ /* @__PURE__ */ e(Q, { asChild: !0, children: y }),
50
+ /* @__PURE__ */ e(
51
+ R,
52
+ {
53
+ side: "right",
54
+ sideOffset: 6,
55
+ className: "rounded-xl z-[99999] flex gap-2 bg-sidebar text-sidebar-foreground border border-sidebar-border py-2 text-sm shadow-lg",
56
+ children: /* @__PURE__ */ e("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
57
+ /* @__PURE__ */ e("p", { className: "font-semibold", children: f }),
58
+ p !== void 0 && /* @__PURE__ */ s("span", { className: "ml-1 text-xs", children: [
59
+ "(",
60
+ p,
61
+ ")"
62
+ ] })
63
+ ] }) })
64
+ }
65
+ )
66
+ ] }) : y,
67
+ !m && t && t.length > 0 && b && /* @__PURE__ */ e(
68
+ "div",
69
+ {
70
+ className: r(
71
+ "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",
72
+ d ? "gap-0.5 mb-0.5" : "gap-1 mb-2"
73
+ ),
74
+ children: t.map((a, g) => {
75
+ const j = o === a.path || a.path !== "/" && o.startsWith(`${a.path}/`);
76
+ return /* @__PURE__ */ s(
77
+ "a",
78
+ {
79
+ href: a.path,
80
+ onClick: (C) => {
81
+ C.preventDefault(), v(a.path);
82
+ },
83
+ className: r(
84
+ "flex items-center justify-between rounded-xl text-sm transition-all duration-200",
85
+ d ? "px-3 py-1" : "px-4 py-2",
86
+ j ? "bg-sidebar-accent/50 text-sidebar-primary font-semibold" : "text-sidebar-muted hover:bg-sidebar-accent hover:text-sidebar-foreground"
87
+ ),
88
+ children: [
89
+ /* @__PURE__ */ e("span", { children: a.label }),
90
+ a.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: a.badge })
91
+ ]
92
+ },
93
+ g
94
+ );
95
+ })
96
+ }
97
+ )
98
+ ] });
99
+ }, ie = ({
100
+ groups: n,
101
+ onItemClick: h,
102
+ currentPath: f,
103
+ appName: p = "appname",
104
+ appSubName: t = "appsubname",
105
+ // eslint-disable-next-line @typescript-eslint/naming-convention
106
+ appIcon: o,
107
+ headerNode: m,
108
+ footerNode: d,
109
+ loading: v = !1,
110
+ searchable: b = !1,
111
+ searchPlaceholder: S = "Rechercher...",
112
+ dense: l = !1
113
+ }) => {
114
+ const { collapsed: u, isMobile: N, setCollapsed: k } = G(), [z, D] = W.useState(""), c = N ? !1 : u, y = !u, a = (i) => {
115
+ h(i), N && k(!0);
116
+ }, g = z.trim().toLowerCase(), j = g === "" ? n : n.map((i) => ({
117
+ ...i,
118
+ items: i.items.filter(
119
+ (x) => {
120
+ var w;
121
+ return x.label.toLowerCase().includes(g) || (((w = x.subItems) == null ? void 0 : w.some((T) => T.label.toLowerCase().includes(g))) ?? !1);
122
+ }
123
+ )
124
+ })).filter((i) => i.items.length > 0), C = /* @__PURE__ */ s("div", { className: "flex flex-col h-full bg-sidebar text-sidebar-foreground", children: [
125
+ m ?? /* @__PURE__ */ s("div", { className: r("flex items-center flex-shrink-0 gap-3 px-4", l ? "h-14" : "h-16 md:h-20", c ? "justify-center" : ""), children: [
126
+ o !== void 0 && /* @__PURE__ */ e("div", { className: "flex-shrink-0 text-sidebar-foreground", children: /* @__PURE__ */ e(o, { className: l ? "size-5" : "size-6" }) }),
127
+ !c && /* @__PURE__ */ s("div", { className: "flex flex-col", children: [
128
+ /* @__PURE__ */ e("h1", { className: r("font-bold text-sidebar-foreground leading-tight", l ? "text-base" : "text-lg"), children: p }),
129
+ /* @__PURE__ */ e("span", { className: r("text-sidebar-muted font-medium", l ? "text-[11px]" : "text-xs"), children: t })
130
+ ] })
131
+ ] }),
132
+ b && !c && /* @__PURE__ */ e("div", { className: r("px-4", l ? "pt-2" : "pt-4"), children: /* @__PURE__ */ s("div", { className: "relative", children: [
133
+ /* @__PURE__ */ e(L, { className: "absolute left-3 top-1/2 size-4 -translate-y-1/2 text-sidebar-muted" }),
134
+ /* @__PURE__ */ e(
135
+ _,
136
+ {
137
+ type: "search",
138
+ value: z,
139
+ onChange: (i) => {
140
+ D(i.target.value);
141
+ },
142
+ placeholder: S,
143
+ className: r(
144
+ "bg-sidebar-accent/40 border-sidebar-border pl-9 text-sidebar-foreground placeholder:text-sidebar-muted",
145
+ l ? "h-8 text-sm" : "h-9"
146
+ )
147
+ }
148
+ )
149
+ ] }) }),
150
+ /* @__PURE__ */ e("div", { className: r("flex-1 overflow-y-auto px-2 scrollbar-modern", l ? "py-2" : "py-4"), children: v ? Array.from({ length: 5 }).map((i, x) => /* @__PURE__ */ s("div", { className: r("flex items-center gap-3", l ? "mb-1 h-9" : "mb-2 h-12", c ? "justify-center px-3" : "px-4"), children: [
151
+ /* @__PURE__ */ e(A, { className: "size-5 flex-shrink-0 rounded-md" }),
152
+ !c && /* @__PURE__ */ e(A, { className: "h-4 flex-1" })
153
+ ] }, x)) : j.map((i, x) => /* @__PURE__ */ s("div", { className: l ? "mb-3" : "mb-6", children: [
154
+ !c && i.title !== void 0 && i.title !== "" && /* @__PURE__ */ e("h3", { className: r("px-4 text-xs uppercase tracking-wider font-semibold text-sidebar-muted", l ? "mb-1" : "mb-2"), children: i.title }),
155
+ /* @__PURE__ */ e("nav", { className: r("flex flex-col", l ? "gap-0.5" : "gap-1"), children: i.items.map((w, T) => /* @__PURE__ */ e(U, { ...w, currentPath: f, collapsed: c, dense: l, onItemClick: a }, T)) })
156
+ ] }, x)) }),
157
+ d && /* @__PURE__ */ e("div", { className: r("border-t border-sidebar-border", l ? "p-2" : "p-4", c ? "flex justify-center" : ""), children: d })
158
+ ] });
159
+ return N ? /* @__PURE__ */ e(
160
+ E,
161
+ {
162
+ open: y,
163
+ onOpenChange: (i) => {
164
+ k(!i);
165
+ },
166
+ children: /* @__PURE__ */ s(H, { side: "left", className: "w-[16rem] p-0 bg-sidebar border-r border-sidebar-border overflow-hidden [&>button]:text-sidebar-foreground", children: [
167
+ /* @__PURE__ */ e(J, { className: "sr-only", children: "Menu de navigation" }),
168
+ /* @__PURE__ */ e(K, { className: "sr-only", children: "Navigation principale de l'application" }),
169
+ C
170
+ ] })
171
+ }
172
+ ) : /* @__PURE__ */ e(q, { delayDuration: 0, children: /* @__PURE__ */ e(
173
+ "aside",
174
+ {
175
+ className: r("flex flex-col bg-sidebar h-screen transition-all duration-300", c ? "w-[--navbar-width-icon]" : "w-[--navbar-width]", "flex"),
176
+ style: {
177
+ "--navbar-width": "16rem",
178
+ "--navbar-width-icon": "5rem"
179
+ },
180
+ children: C
181
+ }
182
+ ) });
183
+ }, se = ({ collapsed: n, isMobile: h, onToggleSidebar: f, actionsNode: p, userMenuNode: t }) => /* @__PURE__ */ s(
184
+ "header",
185
+ {
186
+ className: r(
187
+ "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",
188
+ h && "left-0",
189
+ !h && n && "left-[5rem]",
190
+ !h && !n && "left-[16rem]"
191
+ ),
192
+ tabIndex: -1,
193
+ children: [
194
+ /* @__PURE__ */ e("div", { className: "flex items-center min-w-0 flex-1", children: /* @__PURE__ */ e(
195
+ F,
196
+ {
197
+ variant: "ghost",
198
+ size: "icon",
199
+ onClick: f,
200
+ className: "text-topbar-foreground hover:bg-topbar-accent hover:text-topbar-accent-foreground",
201
+ children: /* @__PURE__ */ e(B, { className: "size-4" })
202
+ }
203
+ ) }),
204
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-2 md:gap-4 flex-shrink-0", children: [
205
+ p,
206
+ t
207
+ ] })
208
+ ]
209
+ }
210
+ );
211
+ export {
212
+ ie as S,
213
+ se as T,
214
+ U as a
215
+ };
@@ -11,7 +11,7 @@ import { A as w } from "../../AppActions-DCaejx-3.js";
11
11
  import { A as J } from "../../AppSubTitle-BNd5_q0i.js";
12
12
  import { A as U } from "../../AppTitle-uboDuil4.js";
13
13
  import { K as X } from "../../KpiCardsLayout-DDR49Qqh.js";
14
- import { S as Z, a as _, T as $ } from "../../Topbar-BTrdr7wj.js";
14
+ import { S as Z, a as _, T as $ } from "../../Topbar-DZGhCt0o.js";
15
15
  import { E as ea } from "../../ErrorAlert-DH1onuyt.js";
16
16
  import { E as oa } from "../../ErrorState-vU8d4CwD.js";
17
17
  import { L as ta } from "../../LoadingState-BN0YaPSs.js";
@@ -26,6 +26,7 @@ export interface SidebarProps {
26
26
  loading?: boolean;
27
27
  searchable?: boolean;
28
28
  searchPlaceholder?: string;
29
+ dense?: boolean;
29
30
  }
30
- export declare const Sidebar: ({ groups, onItemClick, currentPath, appName, appSubName, appIcon: AppIcon, headerNode, footerNode, loading, searchable, searchPlaceholder, }: SidebarProps) => React.ReactElement;
31
+ export declare const Sidebar: ({ groups, onItemClick, currentPath, appName, appSubName, appIcon: AppIcon, headerNode, footerNode, loading, searchable, searchPlaceholder, dense, }: SidebarProps) => React.ReactElement;
31
32
  //# sourceMappingURL=Sidebar.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Sidebar.d.ts","sourceRoot":"","sources":["../../../../src/components/core/navbar/Sidebar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,KAAK,CAAC,WAAW,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC9D;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC;IAC5B,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,eAAO,MAAM,OAAO,GAAI,8IAarB,YAAY,KAAG,KAAK,CAAC,YA4HvB,CAAC"}
1
+ {"version":3,"file":"Sidebar.d.ts","sourceRoot":"","sources":["../../../../src/components/core/navbar/Sidebar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,KAAK,CAAC,WAAW,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC9D;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC;IAC5B,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,eAAO,MAAM,OAAO,GAAI,qJAcrB,YAAY,KAAG,KAAK,CAAC,YA+HvB,CAAC"}
@@ -3,7 +3,8 @@ import { SidebarItem } from "./Sidebar";
3
3
  export interface SidebarNavItemProps extends SidebarItem {
4
4
  currentPath: string;
5
5
  collapsed: boolean;
6
+ dense?: boolean;
6
7
  onItemClick: (path: string) => void;
7
8
  }
8
- export declare const SidebarNavItem: ({ path, icon: Icon, label, badge, subItems, currentPath, collapsed, onItemClick, }: SidebarNavItemProps) => React.ReactElement;
9
+ export declare const SidebarNavItem: ({ path, icon: Icon, label, badge, subItems, currentPath, collapsed, dense, onItemClick, }: SidebarNavItemProps) => React.ReactElement;
9
10
  //# sourceMappingURL=SidebarNavItem.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SidebarNavItem.d.ts","sourceRoot":"","sources":["../../../../src/components/core/navbar/SidebarNavItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACtD,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAED,eAAO,MAAM,cAAc,GAAI,oFAU5B,mBAAmB,KAAG,KAAK,CAAC,YA+F9B,CAAC"}
1
+ {"version":3,"file":"SidebarNavItem.d.ts","sourceRoot":"","sources":["../../../../src/components/core/navbar/SidebarNavItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACtD,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAED,eAAO,MAAM,cAAc,GAAI,2FAW5B,mBAAmB,KAAG,KAAK,CAAC,YAwG9B,CAAC"}
@@ -1,4 +1,4 @@
1
- import { S as e, a as b, T as o } from "../../../Topbar-BTrdr7wj.js";
1
+ import { S as e, a as b, T as o } from "../../../Topbar-DZGhCt0o.js";
2
2
  export {
3
3
  e as Sidebar,
4
4
  b as SidebarNavItem,
@@ -11,7 +11,7 @@ import { A as rr } from "../AppActions-DCaejx-3.js";
11
11
  import { A as tr } from "../AppSubTitle-BNd5_q0i.js";
12
12
  import { A as ir } from "../AppTitle-uboDuil4.js";
13
13
  import { K as br } from "../KpiCardsLayout-DDR49Qqh.js";
14
- import { S as ur, a as gr, T as mr } from "../Topbar-BTrdr7wj.js";
14
+ import { S as ur, a as gr, T as mr } from "../Topbar-DZGhCt0o.js";
15
15
  import { E as dr } from "../ErrorAlert-DH1onuyt.js";
16
16
  import { E as Sr } from "../ErrorState-vU8d4CwD.js";
17
17
  import { L as Dr } from "../LoadingState-BN0YaPSs.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krosoft/react",
3
- "version": "0.0.137",
3
+ "version": "0.0.138",
4
4
  "description": "Krosoft shared React package",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -1,199 +0,0 @@
1
- import { jsxs as i, jsx as e, Fragment as T } from "react/jsx-runtime";
2
- import * as O from "react";
3
- import { ChevronDownIcon as W, SearchIcon as $, MenuIcon as L } from "lucide-react";
4
- import { T as B, c as M, a as Q, b as R, B as q } from "./tooltip-BWyFpIxo.js";
5
- import { c as d } from "./tailwind.helper-B6yFEsav.js";
6
- import "./sidebar.context-D5nywlmP.js";
7
- import { u as F } from "./useSidebar-BJuALHqQ.js";
8
- import "react-i18next";
9
- import "next-themes";
10
- import { I as G, S as _, b as E, h as H, c as J } from "./sheet-Gop1cIaU.js";
11
- import { S as D } from "./skeleton-8o8eJd3P.js";
12
- const K = ({
13
- path: s,
14
- // eslint-disable-next-line @typescript-eslint/naming-convention
15
- icon: m,
16
- label: h,
17
- badge: c,
18
- subItems: a,
19
- currentPath: n,
20
- collapsed: o,
21
- onItemClick: p
22
- }) => {
23
- const [x, N] = O.useState((a == null ? void 0 : a.some((r) => n === r.path || n.startsWith(`${r.path}/`))) || !1), y = s ? n === s || s !== "/" && n.startsWith(`${s}/`) : !1, g = a == null ? void 0 : a.some((r) => n === r.path || n.startsWith(`${r.path}/`)), b = /* @__PURE__ */ i(
24
- "a",
25
- {
26
- href: s || "#",
27
- onClick: (r) => {
28
- r.preventDefault(), a && a.length > 0 ? o || N(!x) : s && p(s);
29
- },
30
- className: d(
31
- "flex items-center gap-3 rounded-2xl cursor-pointer mb-2 transition-all duration-200 group",
32
- o ? "justify-center p-3 h-12 w-12 mx-auto" : "px-4 py-3 h-12",
33
- y || !o && g ? "bg-sidebar-primary text-sidebar-primary-foreground shadow-lg" : "hover:bg-sidebar-accent text-sidebar-foreground hover:text-sidebar-accent-foreground"
34
- ),
35
- children: [
36
- /* @__PURE__ */ e("div", { className: d("flex-shrink-0 transition-transform group-hover:scale-110", o ? "flex items-center justify-center" : ""), children: /* @__PURE__ */ e(m, { className: "size-4" }) }),
37
- !o && /* @__PURE__ */ i(T, { children: [
38
- /* @__PURE__ */ e("span", { className: "flex-grow transition-opacity duration-150 font-medium", children: h }),
39
- c !== 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: c }),
40
- a && a.length > 0 && /* @__PURE__ */ e(W, { className: d("size-4 transition-transform duration-200", x ? "rotate-180" : "") })
41
- ] })
42
- ]
43
- }
44
- );
45
- return /* @__PURE__ */ i(T, { children: [
46
- o ? /* @__PURE__ */ i(B, { children: [
47
- /* @__PURE__ */ e(M, { asChild: !0, children: b }),
48
- /* @__PURE__ */ e(
49
- Q,
50
- {
51
- side: "right",
52
- sideOffset: 6,
53
- className: "rounded-xl z-[99999] flex gap-2 bg-sidebar text-sidebar-foreground border border-sidebar-border py-2 text-sm shadow-lg",
54
- children: /* @__PURE__ */ e("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
55
- /* @__PURE__ */ e("p", { className: "font-semibold", children: h }),
56
- c !== void 0 && /* @__PURE__ */ i("span", { className: "ml-1 text-xs", children: [
57
- "(",
58
- c,
59
- ")"
60
- ] })
61
- ] }) })
62
- }
63
- )
64
- ] }) : b,
65
- !o && a && a.length > 0 && x && /* @__PURE__ */ e("div", { className: "flex flex-col gap-1 mb-2 ml-4 pl-4 border-l-2 border-sidebar-border/50 animate-in slide-in-from-top-2 fade-in duration-200", children: a.map((r, l) => {
66
- const C = n === r.path || r.path !== "/" && n.startsWith(`${r.path}/`);
67
- return /* @__PURE__ */ i(
68
- "a",
69
- {
70
- href: r.path,
71
- onClick: (S) => {
72
- S.preventDefault(), p(r.path);
73
- },
74
- className: d(
75
- "flex items-center justify-between px-4 py-2 rounded-xl text-sm transition-all duration-200",
76
- C ? "bg-sidebar-accent/50 text-sidebar-primary font-semibold" : "text-sidebar-muted hover:bg-sidebar-accent hover:text-sidebar-foreground"
77
- ),
78
- children: [
79
- /* @__PURE__ */ e("span", { children: r.label }),
80
- r.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: r.badge })
81
- ]
82
- },
83
- l
84
- );
85
- }) })
86
- ] });
87
- }, te = ({
88
- groups: s,
89
- onItemClick: m,
90
- currentPath: h,
91
- appName: c = "appname",
92
- appSubName: a = "appsubname",
93
- // eslint-disable-next-line @typescript-eslint/naming-convention
94
- appIcon: n,
95
- headerNode: o,
96
- footerNode: p,
97
- loading: x = !1,
98
- searchable: N = !1,
99
- searchPlaceholder: y = "Rechercher..."
100
- }) => {
101
- const { collapsed: g, isMobile: v, setCollapsed: w } = F(), [b, r] = O.useState(""), l = v ? !1 : g, C = !g, S = (t) => {
102
- m(t), v && w(!0);
103
- }, k = b.trim().toLowerCase(), A = k === "" ? s : s.map((t) => ({
104
- ...t,
105
- items: t.items.filter(
106
- (f) => {
107
- var u;
108
- return f.label.toLowerCase().includes(k) || (((u = f.subItems) == null ? void 0 : u.some((z) => z.label.toLowerCase().includes(k))) ?? !1);
109
- }
110
- )
111
- })).filter((t) => t.items.length > 0), j = /* @__PURE__ */ i("div", { className: "flex flex-col h-full bg-sidebar text-sidebar-foreground", children: [
112
- o ?? /* @__PURE__ */ i("div", { className: d("flex items-center h-16 md:h-20 flex-shrink-0 gap-3 px-4", l ? "justify-center" : ""), children: [
113
- n !== void 0 && /* @__PURE__ */ e("div", { className: "flex-shrink-0 text-sidebar-foreground", children: /* @__PURE__ */ e(n, { className: "size-6" }) }),
114
- !l && /* @__PURE__ */ i("div", { className: "flex flex-col", children: [
115
- /* @__PURE__ */ e("h1", { className: "font-bold text-lg text-sidebar-foreground leading-tight", children: c }),
116
- /* @__PURE__ */ e("span", { className: "text-xs text-sidebar-muted font-medium", children: a })
117
- ] })
118
- ] }),
119
- N && !l && /* @__PURE__ */ e("div", { className: "px-4 pt-4", children: /* @__PURE__ */ i("div", { className: "relative", children: [
120
- /* @__PURE__ */ e($, { className: "absolute left-3 top-1/2 size-4 -translate-y-1/2 text-sidebar-muted" }),
121
- /* @__PURE__ */ e(
122
- G,
123
- {
124
- type: "search",
125
- value: b,
126
- onChange: (t) => {
127
- r(t.target.value);
128
- },
129
- placeholder: y,
130
- className: "h-9 bg-sidebar-accent/40 border-sidebar-border pl-9 text-sidebar-foreground placeholder:text-sidebar-muted"
131
- }
132
- )
133
- ] }) }),
134
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto py-4 px-2 scrollbar-modern", children: x ? Array.from({ length: 5 }).map((t, f) => /* @__PURE__ */ i("div", { className: d("flex items-center gap-3 mb-2 h-12", l ? "justify-center px-3" : "px-4"), children: [
135
- /* @__PURE__ */ e(D, { className: "size-5 flex-shrink-0 rounded-md" }),
136
- !l && /* @__PURE__ */ e(D, { className: "h-4 flex-1" })
137
- ] }, f)) : A.map((t, f) => /* @__PURE__ */ i("div", { className: "mb-6", children: [
138
- !l && t.title !== void 0 && t.title !== "" && /* @__PURE__ */ e("h3", { className: "px-4 mb-2 text-xs uppercase tracking-wider font-semibold text-sidebar-muted", children: t.title }),
139
- /* @__PURE__ */ e("nav", { className: "flex flex-col gap-1", children: t.items.map((u, z) => /* @__PURE__ */ e(K, { ...u, currentPath: h, collapsed: l, onItemClick: S }, z)) })
140
- ] }, f)) }),
141
- p && /* @__PURE__ */ e("div", { className: d("p-4 border-t border-sidebar-border", l ? "flex justify-center" : ""), children: p })
142
- ] });
143
- return v ? /* @__PURE__ */ e(
144
- _,
145
- {
146
- open: C,
147
- onOpenChange: (t) => {
148
- w(!t);
149
- },
150
- children: /* @__PURE__ */ i(E, { side: "left", className: "w-[16rem] p-0 bg-sidebar border-r border-sidebar-border overflow-hidden [&>button]:text-sidebar-foreground", children: [
151
- /* @__PURE__ */ e(H, { className: "sr-only", children: "Menu de navigation" }),
152
- /* @__PURE__ */ e(J, { className: "sr-only", children: "Navigation principale de l'application" }),
153
- j
154
- ] })
155
- }
156
- ) : /* @__PURE__ */ e(R, { delayDuration: 0, children: /* @__PURE__ */ e(
157
- "aside",
158
- {
159
- className: d("flex flex-col bg-sidebar h-screen transition-all duration-300", l ? "w-[--navbar-width-icon]" : "w-[--navbar-width]", "flex"),
160
- style: {
161
- "--navbar-width": "16rem",
162
- "--navbar-width-icon": "5rem"
163
- },
164
- children: j
165
- }
166
- ) });
167
- }, ie = ({ collapsed: s, isMobile: m, onToggleSidebar: h, actionsNode: c, userMenuNode: a }) => /* @__PURE__ */ i(
168
- "header",
169
- {
170
- className: d(
171
- "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",
172
- m && "left-0",
173
- !m && s && "left-[5rem]",
174
- !m && !s && "left-[16rem]"
175
- ),
176
- tabIndex: -1,
177
- children: [
178
- /* @__PURE__ */ e("div", { className: "flex items-center min-w-0 flex-1", children: /* @__PURE__ */ e(
179
- q,
180
- {
181
- variant: "ghost",
182
- size: "icon",
183
- onClick: h,
184
- className: "text-topbar-foreground hover:bg-topbar-accent hover:text-topbar-accent-foreground",
185
- children: /* @__PURE__ */ e(L, { className: "size-4" })
186
- }
187
- ) }),
188
- /* @__PURE__ */ i("div", { className: "flex items-center gap-2 md:gap-4 flex-shrink-0", children: [
189
- c,
190
- a
191
- ] })
192
- ]
193
- }
194
- );
195
- export {
196
- te as S,
197
- ie as T,
198
- K as a
199
- };