xertica-ui 2.7.0 → 2.8.0

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 (228) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +19 -11
  3. package/bin/generate-tokens.ts +25 -9
  4. package/components/assistant/xertica-assistant/xertica-assistant.tsx +1 -1
  5. package/components/ui/button/button.test.tsx +2 -2
  6. package/components/ui/button/button.tsx +6 -6
  7. package/components/ui/card/card.tsx +14 -2
  8. package/components/ui/input/input.tsx +1 -1
  9. package/components/ui/input-otp/input-otp.tsx +1 -1
  10. package/components/ui/search/search.tsx +1 -1
  11. package/components/ui/select/select.tsx +2 -2
  12. package/components/ui/switch/switch.tsx +1 -1
  13. package/components/ui/textarea/textarea.tsx +1 -1
  14. package/contexts/BrandColorsContext.tsx +50 -2
  15. package/contexts/theme-data.ts +100 -3
  16. package/dist/AssistantChart-BFBJXVcm.js +3383 -0
  17. package/dist/AssistantChart-BTnE94FR.cjs +3551 -0
  18. package/dist/AssistantChart-BvccsQMx.cjs +3551 -0
  19. package/dist/AssistantChart-CkskcBVD.js +3383 -0
  20. package/dist/AssistantChart-CrPkO9ip.js +3383 -0
  21. package/dist/AssistantChart-DKz2O1R8.cjs +3551 -0
  22. package/dist/AssistantChart-DYL6UEvo.cjs +3551 -0
  23. package/dist/AssistantChart-keo-ogKi.js +3383 -0
  24. package/dist/AudioPlayer-AoU5MTiM.cjs +1282 -0
  25. package/dist/AudioPlayer-Bx1vrblm.js +1278 -0
  26. package/dist/AudioPlayer-D0-I6J3J.cjs +1282 -0
  27. package/dist/AudioPlayer-DIWX_Yg7.cjs +1282 -0
  28. package/dist/AudioPlayer-DrWJnS7c.js +1278 -0
  29. package/dist/AudioPlayer-_P-Z7pAK.js +1278 -0
  30. package/dist/BrandColorsContext-B25Bpr3b.cjs +819 -0
  31. package/dist/BrandColorsContext-BCieATdW.js +812 -0
  32. package/dist/BrandColorsContext-DP0DXAXS.js +824 -0
  33. package/dist/BrandColorsContext-DjpC9wR_.cjs +798 -0
  34. package/dist/BrandColorsContext-MpXFhte7.cjs +831 -0
  35. package/dist/BrandColorsContext-V3tOc-Zw.js +791 -0
  36. package/dist/CodeBlock-CK4rO6lM.js +221 -0
  37. package/dist/CodeBlock-CKXamfVd.cjs +223 -0
  38. package/dist/CodeBlock-CVmE7isS.cjs +223 -0
  39. package/dist/CodeBlock-D7i5-cMv.js +221 -0
  40. package/dist/CodeBlock-Dg56j2ut.cjs +223 -0
  41. package/dist/CodeBlock-Dt6nUQoo.js +221 -0
  42. package/dist/CustomTooltipContent-Bxynuq7T.js +33 -0
  43. package/dist/CustomTooltipContent-BzjOSA0P.cjs +54 -0
  44. package/dist/CustomTooltipContent-C-ZeCNsf.js +33 -0
  45. package/dist/CustomTooltipContent-CON_QrXm.cjs +54 -0
  46. package/dist/CustomTooltipContent-UR_n2QfW.js +33 -0
  47. package/dist/CustomTooltipContent-v1SXjoFn.cjs +54 -0
  48. package/dist/FeatureCard-4n_8a63v.cjs +497 -0
  49. package/dist/FeatureCard-BLiAWT3w.js +485 -0
  50. package/dist/FeatureCard-BXRW97Ef.cjs +497 -0
  51. package/dist/FeatureCard-CDgLlWE2.js +485 -0
  52. package/dist/FeatureCard-CgQ8lq-I.cjs +497 -0
  53. package/dist/FeatureCard-Cp8cVC6T.cjs +497 -0
  54. package/dist/FeatureCard-D0MwrTRP.js +485 -0
  55. package/dist/FeatureCard-uE5i0in_.js +485 -0
  56. package/dist/ImageWithFallback-BOh1FM3I.js +98 -0
  57. package/dist/ImageWithFallback-BQO7952C.js +98 -0
  58. package/dist/ImageWithFallback-BkMXHCvV.cjs +122 -0
  59. package/dist/ImageWithFallback-C72nwszA.cjs +122 -0
  60. package/dist/ImageWithFallback-CCUMDuEC.cjs +122 -0
  61. package/dist/ImageWithFallback-DQD5TTlY.js +98 -0
  62. package/dist/LanguageSelector-1XhM7R1i.cjs +48 -0
  63. package/dist/LanguageSelector-B3ZVNc55.js +46 -0
  64. package/dist/LanguageSelector-Cj6zl0CM.js +46 -0
  65. package/dist/LanguageSelector-DK1zD4VH.cjs +48 -0
  66. package/dist/LanguageSelector-DseCAa0p.cjs +48 -0
  67. package/dist/LanguageSelector-Du09anfM.js +46 -0
  68. package/dist/LanguageSelector-PZHlFfEs.cjs +48 -0
  69. package/dist/LanguageSelector-SB-NJSmx.js +46 -0
  70. package/dist/PasswordStrengthMeter-B3S6i_k4.cjs +179 -0
  71. package/dist/PasswordStrengthMeter-B8ky1nJI.js +173 -0
  72. package/dist/PasswordStrengthMeter-C5VEopH-.cjs +179 -0
  73. package/dist/PasswordStrengthMeter-CIm7_jNT.js +173 -0
  74. package/dist/PasswordStrengthMeter-DKSAbQzu.js +173 -0
  75. package/dist/PasswordStrengthMeter-DxLu54p-.cjs +179 -0
  76. package/dist/PasswordStrengthMeter-k-e9Pole.cjs +179 -0
  77. package/dist/PasswordStrengthMeter-pAi2viq5.js +173 -0
  78. package/dist/ThemeToggle-4pQbVkpK.js +215 -0
  79. package/dist/ThemeToggle-B6rIVLvC.cjs +219 -0
  80. package/dist/ThemeToggle-BUOTps5l.cjs +219 -0
  81. package/dist/ThemeToggle-CO5mPl6e.js +215 -0
  82. package/dist/ThemeToggle-DbZQ0JSV.cjs +219 -0
  83. package/dist/ThemeToggle-vLXEq2TS.js +215 -0
  84. package/dist/VerifyEmailPage-BTjI2c9n.js +2954 -0
  85. package/dist/VerifyEmailPage-CJGfDSOx.js +2954 -0
  86. package/dist/VerifyEmailPage-DOlZUNc0.cjs +2963 -0
  87. package/dist/VerifyEmailPage-DQPRl_RJ.js +2954 -0
  88. package/dist/VerifyEmailPage-DrdqMbLC.cjs +2963 -0
  89. package/dist/VerifyEmailPage-hyDfeCRa.cjs +2963 -0
  90. package/dist/VerifyEmailPage-kKSXl8vu.cjs +2963 -0
  91. package/dist/VerifyEmailPage-w4N-bDhU.js +2954 -0
  92. package/dist/XerticaOrbe-B9tegV1n.js +1925 -0
  93. package/dist/XerticaOrbe-BQ_NjwPS.cjs +1927 -0
  94. package/dist/XerticaOrbe-BdUX171Q.cjs +1927 -0
  95. package/dist/XerticaOrbe-BdlKXRHU.cjs +1927 -0
  96. package/dist/XerticaOrbe-CByPAFE5.js +1925 -0
  97. package/dist/XerticaOrbe-Ccu9eFMu.js +1925 -0
  98. package/dist/XerticaProvider-BVid1oqn.cjs +46 -0
  99. package/dist/XerticaProvider-Bz_YfNY4.js +44 -0
  100. package/dist/XerticaProvider-CtvYfRbZ.cjs +46 -0
  101. package/dist/XerticaProvider-DMiyExQS.js +44 -0
  102. package/dist/XerticaProvider-DP2lzKip.cjs +46 -0
  103. package/dist/XerticaProvider-De79hhgp.js +44 -0
  104. package/dist/XerticaProvider-Dkk1Vbsy.js +44 -0
  105. package/dist/XerticaProvider-EdzH9Nrw.cjs +46 -0
  106. package/dist/alert-dialog-9XYAn5z5.js +819 -0
  107. package/dist/alert-dialog-B281hud0.cjs +872 -0
  108. package/dist/alert-dialog-BVWbrcrw.cjs +872 -0
  109. package/dist/alert-dialog-B_Ko1xpu.js +819 -0
  110. package/dist/alert-dialog-CIxE8T-J.cjs +872 -0
  111. package/dist/alert-dialog-DW-_iPuf.js +819 -0
  112. package/dist/assistant.cjs.js +2 -2
  113. package/dist/assistant.es.js +2 -2
  114. package/dist/avatar-BJwIMbZ_.js +54 -0
  115. package/dist/avatar-C4Zh5fAJ.cjs +77 -0
  116. package/dist/avatar-CTEUKZUT.js +54 -0
  117. package/dist/avatar-D1bZhlhL.cjs +77 -0
  118. package/dist/avatar-DKIxHeKG.cjs +77 -0
  119. package/dist/avatar-v16eZC8p.js +54 -0
  120. package/dist/blocks.cjs.js +2 -2
  121. package/dist/blocks.es.js +2 -2
  122. package/dist/brand.cjs.js +4 -4
  123. package/dist/brand.es.js +4 -4
  124. package/dist/breadcrumb-B1mUiaWB.cjs +98 -0
  125. package/dist/breadcrumb-BIRgmem-.js +90 -0
  126. package/dist/breadcrumb-BSng-oUf.cjs +98 -0
  127. package/dist/breadcrumb-CES7furU.js +90 -0
  128. package/dist/breadcrumb-CP275kbF.cjs +98 -0
  129. package/dist/breadcrumb-D7hr1EvJ.js +90 -0
  130. package/dist/button-BYtQygX5.cjs +85 -0
  131. package/dist/button-BnAW-a_w.js +62 -0
  132. package/dist/button-CUPDQews.js +62 -0
  133. package/dist/button-DFa-rtPy.js +62 -0
  134. package/dist/button-DV1G6XrI.cjs +85 -0
  135. package/dist/button-Kd9Fj53S.cjs +85 -0
  136. package/dist/cli.js +94 -10
  137. package/dist/components/ui/card/card.d.ts +11 -1
  138. package/dist/contexts/theme-data.d.ts +15 -1
  139. package/dist/dropdown-menu-B9wTZ0uX.cjs +225 -0
  140. package/dist/dropdown-menu-BeBtZOrs.cjs +225 -0
  141. package/dist/dropdown-menu-D7mRDGis.js +190 -0
  142. package/dist/dropdown-menu-D8ZmqHB7.js +190 -0
  143. package/dist/dropdown-menu-_AWBeOts.cjs +225 -0
  144. package/dist/dropdown-menu-qGzLO_HO.js +190 -0
  145. package/dist/hooks.cjs.js +1 -1
  146. package/dist/hooks.es.js +1 -1
  147. package/dist/index.cjs.js +24 -24
  148. package/dist/index.es.js +24 -24
  149. package/dist/input-B53E6K8G.js +65 -0
  150. package/dist/input-B7Q7vcoG.cjs +91 -0
  151. package/dist/input-BysqLMK1.js +65 -0
  152. package/dist/input-CStdFsaH.cjs +91 -0
  153. package/dist/input-CXYth6nW.cjs +91 -0
  154. package/dist/input-CX_fWE2D.cjs +91 -0
  155. package/dist/input-CitUVnEn.js +65 -0
  156. package/dist/input-wkBYTp-B.js +65 -0
  157. package/dist/layout.cjs.js +1 -1
  158. package/dist/layout.es.js +1 -1
  159. package/dist/media.cjs.js +1 -1
  160. package/dist/media.es.js +1 -1
  161. package/dist/pages.cjs.js +1 -1
  162. package/dist/pages.es.js +1 -1
  163. package/dist/rich-text-editor-BHiRUzWZ.js +2894 -0
  164. package/dist/rich-text-editor-BWMRUMJ2.js +2894 -0
  165. package/dist/rich-text-editor-BoE6Ks5x.cjs +2968 -0
  166. package/dist/rich-text-editor-BzuEwR_X.js +2894 -0
  167. package/dist/rich-text-editor-CcopGbQ-.js +2894 -0
  168. package/dist/rich-text-editor-CmxSRJIi.cjs +2968 -0
  169. package/dist/rich-text-editor-DyYAu28v.cjs +2968 -0
  170. package/dist/rich-text-editor-JS_eMQCC.cjs +2968 -0
  171. package/dist/select-BNfFJwYp.js +130 -0
  172. package/dist/select-CN8IDjGB.js +130 -0
  173. package/dist/select-CwRzQHA7.cjs +161 -0
  174. package/dist/select-CwgD3nMD.js +130 -0
  175. package/dist/select-DEHUm_AC.cjs +161 -0
  176. package/dist/select-DJDgpVm3.cjs +161 -0
  177. package/dist/select-DSLWQLmo.cjs +161 -0
  178. package/dist/select-YFx0wCYT.js +130 -0
  179. package/dist/sidebar-BF7JEL7U.js +1151 -0
  180. package/dist/sidebar-Bjr2doX5.cjs +1154 -0
  181. package/dist/sidebar-CMrNCmhb.cjs +1154 -0
  182. package/dist/sidebar-CO9x8AVn.cjs +1154 -0
  183. package/dist/sidebar-Cn_KB4c6.js +1151 -0
  184. package/dist/sidebar-Db_C30ph.cjs +1154 -0
  185. package/dist/sidebar-miPHsRz4.js +1151 -0
  186. package/dist/sidebar-pZF8mLLu.js +1151 -0
  187. package/dist/skeleton-BX2XTjMO.cjs +87 -0
  188. package/dist/skeleton-BoLK0iV7.js +78 -0
  189. package/dist/skeleton-Bysq8yeB.js +79 -0
  190. package/dist/skeleton-C7nspYnC.cjs +87 -0
  191. package/dist/skeleton-DL4V5Vub.cjs +87 -0
  192. package/dist/skeleton-DSMhdqp1.js +78 -0
  193. package/dist/skeleton-DhJswvTW.cjs +88 -0
  194. package/dist/skeleton-DicUfozA.js +78 -0
  195. package/dist/slider-77T_Eqw4.js +56 -0
  196. package/dist/slider-B6puMLXS.cjs +78 -0
  197. package/dist/slider-B785N7lZ.js +56 -0
  198. package/dist/slider-C6yssKyZ.cjs +78 -0
  199. package/dist/slider-CKZO9gVh.cjs +78 -0
  200. package/dist/slider-Cn-ImSze.js +56 -0
  201. package/dist/tooltip-BiJVGob3.cjs +72 -0
  202. package/dist/tooltip-D2OPn-1v.cjs +72 -0
  203. package/dist/tooltip-DlCHQuh1.js +48 -0
  204. package/dist/tooltip-fQ2Va0G8.cjs +72 -0
  205. package/dist/tooltip-oAw00FX2.js +48 -0
  206. package/dist/tooltip-u147L0wD.js +48 -0
  207. package/dist/ui.cjs.js +13 -13
  208. package/dist/ui.es.js +13 -13
  209. package/dist/xertica-assistant-C2A0R94j.js +2173 -0
  210. package/dist/xertica-assistant-CSUprvTR.js +2173 -0
  211. package/dist/xertica-assistant-Caubm0HR.js +2173 -0
  212. package/dist/xertica-assistant-DEexPM2u.cjs +2180 -0
  213. package/dist/xertica-assistant-Dh1dmEx3.cjs +2180 -0
  214. package/dist/xertica-assistant-GGcyHEZG.cjs +2180 -0
  215. package/dist/xertica-assistant-USefPe2L.js +2173 -0
  216. package/dist/xertica-assistant-cwSHFwfv.cjs +2180 -0
  217. package/dist/xertica-ui.css +1 -1
  218. package/package.json +3 -2
  219. package/styles/xertica/base.css +38 -0
  220. package/styles/xertica/tokens.css +9 -0
  221. package/templates/src/app/App.tsx +5 -1
  222. package/templates/src/features/home/ui/HomeContent.tsx +12 -13
  223. package/templates/src/features/template/ui/TemplateContent.tsx +569 -26
  224. package/templates/src/locales/en/pages/templates.json +112 -4
  225. package/templates/src/locales/es/pages/templates.json +112 -4
  226. package/templates/src/locales/pt-BR/pages/templates.json +112 -4
  227. package/templates/src/styles/xertica/tokens.css +9 -0
  228. package/templates/vite.config.ts +25 -0
@@ -0,0 +1,1154 @@
1
+ 'use strict';
2
+
3
+ const jsxRuntime = require('react/jsx-runtime');
4
+ const React = require('react');
5
+ const lucideReact = require('lucide-react');
6
+ const button = require('./button-DV1G6XrI.cjs');
7
+ const ThemeToggle = require('./ThemeToggle-B6rIVLvC.cjs');
8
+ const LanguageSelector = require('./LanguageSelector-PZHlFfEs.cjs');
9
+ const breadcrumb = require('./breadcrumb-B1mUiaWB.cjs');
10
+ const dropdownMenu = require('./dropdown-menu-B9wTZ0uX.cjs');
11
+ const avatar = require('./avatar-D1bZhlhL.cjs');
12
+ const LayoutContext = require('./LayoutContext-BEq_-n98.cjs');
13
+ const framerMotion = require('framer-motion');
14
+ const reactI18next = require('react-i18next');
15
+ const input = require('./input-B7Q7vcoG.cjs');
16
+ const tooltip = require('./tooltip-D2OPn-1v.cjs');
17
+ const CustomTooltipContent = require('./CustomTooltipContent-v1SXjoFn.cjs');
18
+
19
+ function Header({
20
+ title,
21
+ breadcrumbs,
22
+ showLanguageSelector = true,
23
+ showThemeToggle = true,
24
+ className,
25
+ user,
26
+ actions,
27
+ showSettings,
28
+ onSettingsClick,
29
+ showLogout,
30
+ onLogoutClick,
31
+ renderLink,
32
+ breadcrumbSlot
33
+ }) {
34
+ const layout = LayoutContext.useOptionalLayout();
35
+ const toggleSidebar = layout?.toggleSidebar ?? (() => {
36
+ });
37
+ return /* @__PURE__ */ jsxRuntime.jsx(
38
+ "header",
39
+ {
40
+ className: `bg-card text-foreground shadow-sm border-b border-border px-[24px] h-[64px] flex-shrink-0 flex items-center ${className || ""}`,
41
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between w-full p-[0px]", children: [
42
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-muted-foreground w-full overflow-x-auto", children: [
43
+ /* @__PURE__ */ jsxRuntime.jsx(
44
+ button.Button,
45
+ {
46
+ variant: "ghost",
47
+ size: "sm",
48
+ onClick: toggleSidebar,
49
+ className: "md:hidden mr-2 p-2 shrink-0",
50
+ "aria-label": "Abrir menu lateral",
51
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Menu, { className: "w-5 h-5" })
52
+ }
53
+ ),
54
+ breadcrumbs && breadcrumbs.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(breadcrumb.Breadcrumb, { children: /* @__PURE__ */ jsxRuntime.jsx(breadcrumb.BreadcrumbList, { className: "flex-nowrap whitespace-nowrap", children: breadcrumbs.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
55
+ /* @__PURE__ */ jsxRuntime.jsx(breadcrumb.BreadcrumbItem, { children: item.href ? renderLink ? /* @__PURE__ */ jsxRuntime.jsx(breadcrumb.BreadcrumbLink, { asChild: true, className: "flex items-center gap-1.5", children: renderLink(item.href, {
56
+ className: "flex items-center gap-1.5",
57
+ children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
58
+ item.icon,
59
+ item.label
60
+ ] })
61
+ }) }) : /* @__PURE__ */ jsxRuntime.jsxs(breadcrumb.BreadcrumbLink, { href: item.href, className: "flex items-center gap-1.5", children: [
62
+ item.icon,
63
+ item.label
64
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(breadcrumb.BreadcrumbPage, { className: "flex items-center gap-1.5", children: [
65
+ item.icon,
66
+ item.label
67
+ ] }) }),
68
+ index < breadcrumbs.length - 1 && /* @__PURE__ */ jsxRuntime.jsx(breadcrumb.BreadcrumbSeparator, {})
69
+ ] }, index)) }) }) : title ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground font-medium shrink-0", children: title }) : /* @__PURE__ */ jsxRuntime.jsx(breadcrumb.Breadcrumb, { children: /* @__PURE__ */ jsxRuntime.jsx(breadcrumb.BreadcrumbList, { className: "flex-nowrap whitespace-nowrap", children: /* @__PURE__ */ jsxRuntime.jsx(breadcrumb.BreadcrumbItem, { children: /* @__PURE__ */ jsxRuntime.jsx(breadcrumb.BreadcrumbPage, { className: "text-foreground font-medium shrink-0", children: "Xertica.ai" }) }) }) }),
70
+ breadcrumbSlot && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center shrink-0", children: breadcrumbSlot })
71
+ ] }),
72
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 shrink-0 ml-4", children: [
73
+ showLanguageSelector && /* @__PURE__ */ jsxRuntime.jsx(LanguageSelector.LanguageSelector, { variant: "minimal", showIcon: false, className: "hidden sm:flex" }),
74
+ showThemeToggle && /* @__PURE__ */ jsxRuntime.jsx(ThemeToggle.ThemeToggle, { className: "hover:bg-accent" }),
75
+ actions?.map((action) => /* @__PURE__ */ jsxRuntime.jsxs(
76
+ button.Button,
77
+ {
78
+ variant: "ghost",
79
+ size: action.label ? "sm" : "icon",
80
+ onClick: action.onClick,
81
+ className: `hover:bg-accent ${action.className || ""}`,
82
+ "aria-label": action.label || action.id,
83
+ children: [
84
+ action.icon,
85
+ action.label && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-2 hidden md:inline", children: action.label })
86
+ ]
87
+ },
88
+ action.id
89
+ )),
90
+ showSettings && /* @__PURE__ */ jsxRuntime.jsx(
91
+ button.Button,
92
+ {
93
+ variant: "ghost",
94
+ size: "icon",
95
+ onClick: onSettingsClick,
96
+ className: "hover:bg-accent",
97
+ "aria-label": "Configurações",
98
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Settings, { className: "w-5 h-5" })
99
+ }
100
+ ),
101
+ user && /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu.DropdownMenu, { children: [
102
+ /* @__PURE__ */ jsxRuntime.jsx(dropdownMenu.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
103
+ button.Button,
104
+ {
105
+ variant: "ghost",
106
+ className: "relative h-8 w-8 rounded-full p-0 overflow-hidden border border-border/50 hover:border-primary/30 transition-colors",
107
+ "aria-label": "Menu do usuário",
108
+ children: /* @__PURE__ */ jsxRuntime.jsxs(avatar.Avatar, { className: "h-8 w-8", children: [
109
+ /* @__PURE__ */ jsxRuntime.jsx(avatar.AvatarImage, { src: user.avatar, alt: user.name || "User" }),
110
+ /* @__PURE__ */ jsxRuntime.jsx(avatar.AvatarFallback, { className: "bg-primary/10 text-primary text-xs font-medium", children: user.name ? user.name.charAt(0).toUpperCase() : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.User, { className: "w-4 h-4" }) })
111
+ ] })
112
+ }
113
+ ) }),
114
+ /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu.DropdownMenuContent, { className: "w-56", align: "end", forceMount: true, children: [
115
+ /* @__PURE__ */ jsxRuntime.jsx(dropdownMenu.DropdownMenuLabel, { className: "font-normal", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col space-y-1", children: [
116
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium leading-none", children: user.name || "User" }),
117
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs leading-none text-muted-foreground", children: user.email || "user@example.com" })
118
+ ] }) }),
119
+ /* @__PURE__ */ jsxRuntime.jsx(dropdownMenu.DropdownMenuSeparator, {}),
120
+ user.menuItems?.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu.DropdownMenuItem, { onClick: item.onClick, className: item.className, children: [
121
+ item.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mr-2", children: item.icon }),
122
+ item.label
123
+ ] }, item.id)),
124
+ !user.menuItems && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
125
+ /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu.DropdownMenuItem, { onClick: onSettingsClick, children: [
126
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Settings, { className: "mr-2 h-4 w-4" }),
127
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Settings" })
128
+ ] }),
129
+ /* @__PURE__ */ jsxRuntime.jsxs(
130
+ dropdownMenu.DropdownMenuItem,
131
+ {
132
+ onClick: onLogoutClick,
133
+ className: "text-destructive focus:text-destructive",
134
+ children: [
135
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LogOut, { className: "mr-2 h-4 w-4" }),
136
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Logout" })
137
+ ]
138
+ }
139
+ )
140
+ ] })
141
+ ] })
142
+ ] }),
143
+ showLogout && /* @__PURE__ */ jsxRuntime.jsx(
144
+ button.Button,
145
+ {
146
+ variant: "ghost",
147
+ size: "icon",
148
+ onClick: onLogoutClick,
149
+ className: "hover:bg-accent text-muted-foreground hover:text-foreground",
150
+ "aria-label": "Sair",
151
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LogOut, { className: "w-5 h-5" })
152
+ }
153
+ )
154
+ ] })
155
+ ] })
156
+ }
157
+ );
158
+ }
159
+
160
+ const SidebarContext = React.createContext(null);
161
+ function useSidebarContext() {
162
+ const ctx = React.useContext(SidebarContext);
163
+ if (!ctx) {
164
+ throw new Error("Sidebar compound components must be used within <Sidebar.Root>");
165
+ }
166
+ return ctx;
167
+ }
168
+ function SidebarRoot({
169
+ expanded: expandedProp,
170
+ onToggle: onToggleProp,
171
+ navigate: navigateProp,
172
+ location: locationProp,
173
+ width: widthProp,
174
+ children,
175
+ className
176
+ }) {
177
+ const layoutContext = LayoutContext.useOptionalLayout();
178
+ const [localExpanded, setLocalExpanded] = React.useState(false);
179
+ const [isMobileViewport, setIsMobileViewport] = React.useState(false);
180
+ const expanded = expandedProp !== void 0 ? expandedProp : layoutContext?.sidebarExpanded ?? localExpanded;
181
+ const onToggle = onToggleProp || layoutContext?.toggleSidebar || (() => setLocalExpanded((prev) => !prev));
182
+ const width = widthProp !== void 0 ? widthProp : layoutContext?.sidebarWidth ?? 280;
183
+ const navigate = navigateProp || ((path) => {
184
+ if (typeof window !== "undefined") window.location.href = path;
185
+ });
186
+ const location = locationProp || (typeof window !== "undefined" ? window.location : { pathname: "/" });
187
+ React.useEffect(() => {
188
+ const checkViewport = () => setIsMobileViewport(window.innerWidth < 768);
189
+ checkViewport();
190
+ window.addEventListener("resize", checkViewport);
191
+ return () => window.removeEventListener("resize", checkViewport);
192
+ }, []);
193
+ return /* @__PURE__ */ jsxRuntime.jsx(
194
+ SidebarContext.Provider,
195
+ {
196
+ value: { expanded, isMobileViewport, onToggle, navigate, location, width },
197
+ children: /* @__PURE__ */ jsxRuntime.jsxs(tooltip.TooltipProvider, { delayDuration: 300, children: [
198
+ /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
199
+ @media (max-width: 767px) {
200
+ [style*="padding-left"].flex-1,
201
+ [style*="paddingLeft"].flex-1 {
202
+ padding-left: 0 !important;
203
+ }
204
+ }
205
+ ` }),
206
+ /* @__PURE__ */ jsxRuntime.jsx(
207
+ "div",
208
+ {
209
+ className: button.cn(
210
+ "bg-sidebar text-sidebar-foreground transition-all duration-300 ease-in-out flex flex-col z-50",
211
+ expanded ? "fixed inset-0 md:fixed md:inset-y-0 md:left-0" : "fixed inset-y-0 left-0 w-20 -translate-x-full md:translate-x-0",
212
+ className
213
+ ),
214
+ style: expanded && !isMobileViewport ? { width: `${width}px` } : void 0,
215
+ children
216
+ }
217
+ )
218
+ ] })
219
+ }
220
+ );
221
+ }
222
+ function SidebarHeader({
223
+ logo,
224
+ logoCollapsed
225
+ }) {
226
+ const { expanded, onToggle } = useSidebarContext();
227
+ const { t } = reactI18next.useTranslation();
228
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
229
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-shrink-0 p-[14px] pt-[13px] pr-[14px] pb-[12px] pl-[14px]", children: /* @__PURE__ */ jsxRuntime.jsx(
230
+ "button",
231
+ {
232
+ onClick: onToggle,
233
+ className: "w-full h-10 flex items-center gap-3 px-3 justify-center rounded-[var(--radius-button)] transition-all duration-200 text-sidebar-foreground/80 hover:bg-sidebar-foreground/15 hover:text-sidebar-foreground",
234
+ "aria-label": expanded ? t("sidebar.collapse") : t("sidebar.expand"),
235
+ "aria-expanded": expanded,
236
+ "aria-controls": "sidebar-nav",
237
+ children: expanded ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowLeft, { className: "w-5 h-5" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Menu, { className: "w-5 h-5" })
238
+ }
239
+ ) }),
240
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-shrink-0 px-4 py-4", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center h-10 justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center flex-shrink-0", children: expanded ? logo || /* @__PURE__ */ jsxRuntime.jsx(ThemeToggle.XerticaLogo, { className: "h-5 w-auto", variant: "white" }) : logoCollapsed || /* @__PURE__ */ jsxRuntime.jsx(ThemeToggle.XerticaXLogo, { className: "h-5 w-auto", variant: "white" }) }) }) })
241
+ ] });
242
+ }
243
+ function OverflowGroupsAccordion({
244
+ expanded,
245
+ overflowGroups,
246
+ location,
247
+ handleNavigate,
248
+ moreOptionsLabel,
249
+ onOpenChange
250
+ }) {
251
+ const [isOpen, setIsOpen] = React.useState(false);
252
+ const toggle = () => {
253
+ const next = !isOpen;
254
+ setIsOpen(next);
255
+ onOpenChange?.(next);
256
+ };
257
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
258
+ /* @__PURE__ */ jsxRuntime.jsxs(
259
+ "button",
260
+ {
261
+ onClick: toggle,
262
+ className: button.cn(
263
+ "w-full h-10 flex items-center rounded-[var(--radius-button)] transition-all duration-200 text-sidebar-foreground/80 hover:bg-sidebar-foreground/15 hover:text-sidebar-foreground",
264
+ expanded ? "gap-3 px-3 justify-start" : "justify-center px-0"
265
+ ),
266
+ "aria-expanded": isOpen,
267
+ "aria-label": moreOptionsLabel,
268
+ children: [
269
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MoreVertical, { className: "w-5 h-5 flex-shrink-0" }),
270
+ expanded && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
271
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate flex-1 text-sidebar-foreground text-left", children: moreOptionsLabel }),
272
+ /* @__PURE__ */ jsxRuntime.jsx(
273
+ lucideReact.ChevronRight,
274
+ {
275
+ className: button.cn("w-4 h-4 flex-shrink-0 transition-transform duration-200", isOpen && "rotate-90")
276
+ }
277
+ )
278
+ ] })
279
+ ]
280
+ }
281
+ ),
282
+ /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { initial: false, children: isOpen && /* @__PURE__ */ jsxRuntime.jsx(
283
+ framerMotion.motion.div,
284
+ {
285
+ initial: { height: 0, opacity: 0 },
286
+ animate: { height: "auto", opacity: 1 },
287
+ exit: { height: 0, opacity: 0 },
288
+ transition: { duration: 0.2 },
289
+ className: "overflow-hidden",
290
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 space-y-3", children: overflowGroups.map((group) => {
291
+ const GroupIcon = group.icon;
292
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
293
+ (group.label || GroupIcon) && expanded && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-3 mb-1 flex items-center gap-2", children: [
294
+ GroupIcon && (React.isValidElement(GroupIcon) ? GroupIcon : /* @__PURE__ */ jsxRuntime.jsx(GroupIcon, { className: "h-3 w-3 text-sidebar-foreground/60" })),
295
+ group.label && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-semibold uppercase tracking-wider text-sidebar-foreground/60", children: group.label })
296
+ ] }),
297
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-0.5", children: group.items.map((item) => {
298
+ const Icon = item.icon;
299
+ const isActive = location.pathname === item.path || location.pathname.startsWith(item.path + "/");
300
+ return /* @__PURE__ */ jsxRuntime.jsxs(
301
+ "button",
302
+ {
303
+ onClick: () => handleNavigate(item.path),
304
+ className: button.cn(
305
+ "w-full h-9 flex items-center gap-2.5 rounded-[var(--radius-button)] transition-all duration-200 text-left text-sm",
306
+ expanded ? "px-3" : "justify-center px-0",
307
+ isActive ? "bg-sidebar-foreground/15 text-sidebar-foreground" : "text-sidebar-foreground/70 hover:bg-sidebar-foreground/10 hover:text-sidebar-foreground"
308
+ ),
309
+ children: [
310
+ Icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "w-4 h-4 flex-shrink-0" }),
311
+ expanded && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: item.label })
312
+ ]
313
+ },
314
+ item.path
315
+ );
316
+ }) })
317
+ ] }, group.id);
318
+ }) })
319
+ }
320
+ ) })
321
+ ] });
322
+ }
323
+ function SidebarNav({
324
+ navigationGroups = [],
325
+ routes = [],
326
+ variant = "default"
327
+ }) {
328
+ const { expanded, isMobileViewport, navigate, location, onToggle } = useSidebarContext();
329
+ const { t } = reactI18next.useTranslation();
330
+ const navRef = React.useRef(null);
331
+ const [localActiveItem, setLocalActiveItem] = React.useState(null);
332
+ const [hasOverflow, setHasOverflow] = React.useState(false);
333
+ const [visibleItems, setVisibleItems] = React.useState([]);
334
+ const [overflowItems, setOverflowItems] = React.useState([]);
335
+ const [openSubmenus, setOpenSubmenus] = React.useState(/* @__PURE__ */ new Set());
336
+ const [hasGroupOverflow, setHasGroupOverflow] = React.useState(false);
337
+ const [visibleGroups, setVisibleGroups] = React.useState([]);
338
+ const [overflowGroups, setOverflowGroups] = React.useState([]);
339
+ const [isOverflowAccordionOpen, setIsOverflowAccordionOpen] = React.useState(false);
340
+ const toggleSubmenu = (path) => {
341
+ setOpenSubmenus((prev) => {
342
+ const next = new Set(prev);
343
+ if (next.has(path)) {
344
+ next.delete(path);
345
+ } else {
346
+ next.add(path);
347
+ }
348
+ return next;
349
+ });
350
+ };
351
+ const labelTranslations = React.useMemo(
352
+ () => ({
353
+ home: "Início",
354
+ dashboard: "Painel",
355
+ components: "Componentes"
356
+ }),
357
+ []
358
+ );
359
+ const navigationItems = React.useMemo(
360
+ () => (routes || []).map((route) => ({
361
+ ...route,
362
+ label: labelTranslations[route.label.toLowerCase()] || route.label,
363
+ active: location.pathname === route.path || location.pathname.startsWith(route.path + "/"),
364
+ children: route.children
365
+ })),
366
+ [routes, location.pathname, labelTranslations]
367
+ );
368
+ React.useEffect(() => {
369
+ if (typeof window === "undefined") return;
370
+ const checkOverflow = () => {
371
+ if (!navRef.current) return;
372
+ if (variant === "assistant") return;
373
+ const navHeight = navRef.current.clientHeight;
374
+ const itemHeight = 44;
375
+ const maxVisibleItems = Math.floor(navHeight / itemHeight);
376
+ if (navigationItems.length > maxVisibleItems) {
377
+ setHasOverflow(true);
378
+ setVisibleItems(navigationItems.slice(0, maxVisibleItems - 1));
379
+ setOverflowItems(navigationItems.slice(maxVisibleItems - 1));
380
+ } else {
381
+ setHasOverflow(false);
382
+ setVisibleItems(navigationItems);
383
+ setOverflowItems([]);
384
+ }
385
+ };
386
+ checkOverflow();
387
+ window.addEventListener("resize", checkOverflow);
388
+ return () => window.removeEventListener("resize", checkOverflow);
389
+ }, [navigationItems.length, variant]);
390
+ React.useEffect(() => {
391
+ if (typeof window === "undefined") return;
392
+ if (variant === "assistant") return;
393
+ if (!navigationGroups || navigationGroups.length === 0) return;
394
+ const checkGroupOverflow = () => {
395
+ if (!navRef.current) return;
396
+ const containerHeight = navRef.current.clientHeight;
397
+ const itemHeight = 40;
398
+ const groupHeaderHeight = 32;
399
+ const groupSpacing = 12;
400
+ const moreButtonHeight = 44;
401
+ const padding = 32;
402
+ let currentHeight = padding;
403
+ let visibleCount = 0;
404
+ for (let i = 0; i < navigationGroups.length; i++) {
405
+ const group = navigationGroups[i];
406
+ let groupHeight = 0;
407
+ if (group.label) groupHeight += groupHeaderHeight;
408
+ groupHeight += group.items.length * itemHeight;
409
+ if (i > 0) groupHeight += groupSpacing;
410
+ const wouldExceed = currentHeight + groupHeight + (visibleCount < navigationGroups.length - 1 ? moreButtonHeight : 0) > containerHeight;
411
+ if (wouldExceed && visibleCount > 0) break;
412
+ currentHeight += groupHeight;
413
+ visibleCount++;
414
+ }
415
+ if (visibleCount < navigationGroups.length) {
416
+ setHasGroupOverflow(true);
417
+ setVisibleGroups(navigationGroups.slice(0, visibleCount));
418
+ setOverflowGroups(navigationGroups.slice(visibleCount));
419
+ } else {
420
+ setHasGroupOverflow(false);
421
+ setVisibleGroups(navigationGroups);
422
+ setOverflowGroups([]);
423
+ }
424
+ };
425
+ checkGroupOverflow();
426
+ window.addEventListener("resize", checkGroupOverflow);
427
+ return () => window.removeEventListener("resize", checkGroupOverflow);
428
+ }, [navigationGroups, expanded, variant]);
429
+ const handleNavigate = (path) => {
430
+ setLocalActiveItem(path);
431
+ navigate(path);
432
+ if (typeof window !== "undefined" && window.innerWidth < 768) {
433
+ onToggle();
434
+ }
435
+ };
436
+ const toNavItem = (route) => ({
437
+ path: route.path,
438
+ label: labelTranslations[route.label.toLowerCase()] || route.label,
439
+ icon: route.icon,
440
+ active: location.pathname === route.path || location.pathname.startsWith(route.path + "/"),
441
+ children: route.children,
442
+ actions: route.actions
443
+ });
444
+ const renderActionItems = (actions) => {
445
+ return actions.map((action, idx) => {
446
+ const Icon = action.icon;
447
+ if (action.children && action.children.length > 0) {
448
+ return /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu.DropdownMenuSub, { children: [
449
+ /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu.DropdownMenuSubTrigger, { children: [
450
+ Icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "mr-2 h-4 w-4" }),
451
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: action.label })
452
+ ] }),
453
+ /* @__PURE__ */ jsxRuntime.jsx(dropdownMenu.DropdownMenuPortal, { children: /* @__PURE__ */ jsxRuntime.jsx(dropdownMenu.DropdownMenuSubContent, { className: "w-48 bg-popover border-border", children: renderActionItems(action.children) }) })
454
+ ] }, idx);
455
+ }
456
+ return /* @__PURE__ */ jsxRuntime.jsxs(
457
+ dropdownMenu.DropdownMenuItem,
458
+ {
459
+ className: button.cn(
460
+ "flex items-center gap-2",
461
+ action.variant === "destructive" ? "text-destructive focus:text-destructive" : ""
462
+ ),
463
+ onClick: (e) => {
464
+ e.stopPropagation();
465
+ action.onClick?.(null);
466
+ },
467
+ children: [
468
+ Icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "h-4 w-4 flex-shrink-0" }),
469
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: action.label })
470
+ ]
471
+ },
472
+ idx
473
+ );
474
+ });
475
+ };
476
+ const renderAssistantActionMenu = (actions, isHeader = false) => {
477
+ if (!actions || actions.length === 0) return null;
478
+ return /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu.DropdownMenu, { children: [
479
+ /* @__PURE__ */ jsxRuntime.jsx(dropdownMenu.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
480
+ button.Button,
481
+ {
482
+ variant: "ghost",
483
+ size: "icon",
484
+ className: button.cn(
485
+ "h-8 w-8 text-sidebar-foreground/80 hover:bg-sidebar-foreground/20 hover:text-sidebar-foreground rounded-full transition-all",
486
+ !isHeader && "opacity-0 group-hover/item:opacity-100"
487
+ ),
488
+ "aria-label": t("sidebar.moreOptions"),
489
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MoreVertical, { className: "h-4 w-4" })
490
+ }
491
+ ) }),
492
+ /* @__PURE__ */ jsxRuntime.jsx(dropdownMenu.DropdownMenuContent, { align: "end", className: "w-48 bg-popover border-border p-1", children: renderActionItems(actions) })
493
+ ] });
494
+ };
495
+ const renderDefaultItem = (item) => {
496
+ const Icon = item.icon;
497
+ const hasChildren = item.children && item.children.length > 0;
498
+ const activeClass = item.active ? "bg-sidebar-foreground/15 text-sidebar-foreground shadow-sm" : "text-sidebar-foreground/80 hover:bg-sidebar-foreground/15 hover:text-sidebar-foreground";
499
+ if (!expanded) {
500
+ return /* @__PURE__ */ jsxRuntime.jsxs(tooltip.Tooltip, { children: [
501
+ /* @__PURE__ */ jsxRuntime.jsx(tooltip.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
502
+ "button",
503
+ {
504
+ onClick: () => handleNavigate(item.path),
505
+ className: button.cn(
506
+ "w-full h-10 flex items-center justify-center px-0 rounded-[var(--radius-button)] transition-all duration-200",
507
+ activeClass
508
+ ),
509
+ "aria-label": item.label,
510
+ children: Icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "w-5 h-5 flex-shrink-0" })
511
+ }
512
+ ) }),
513
+ /* @__PURE__ */ jsxRuntime.jsx(CustomTooltipContent.CustomTooltipContent, { side: "right", sideOffset: 0, children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: item.label }) })
514
+ ] }, item.path);
515
+ }
516
+ if (isMobileViewport && hasChildren) {
517
+ const isOpen = openSubmenus.has(item.path);
518
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
519
+ /* @__PURE__ */ jsxRuntime.jsxs(
520
+ "div",
521
+ {
522
+ className: button.cn(
523
+ "group/item flex items-center w-full h-10 rounded-[var(--radius-button)] transition-all duration-200",
524
+ activeClass
525
+ ),
526
+ children: [
527
+ /* @__PURE__ */ jsxRuntime.jsxs(
528
+ "button",
529
+ {
530
+ onClick: () => handleNavigate(item.path),
531
+ className: "flex items-center gap-3 px-3 flex-1 h-full min-w-0 text-left",
532
+ children: [
533
+ Icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "w-5 h-5 flex-shrink-0" }),
534
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate flex-1", children: item.label })
535
+ ]
536
+ }
537
+ ),
538
+ /* @__PURE__ */ jsxRuntime.jsx(
539
+ "button",
540
+ {
541
+ onClick: (e) => {
542
+ e.stopPropagation();
543
+ toggleSubmenu(item.path);
544
+ },
545
+ className: "h-full px-2 pr-2.5 flex items-center justify-center text-sidebar-foreground/40 hover:text-sidebar-foreground transition-colors",
546
+ "aria-label": t("sidebar.submenu", { label: item.label }),
547
+ "aria-expanded": isOpen,
548
+ children: /* @__PURE__ */ jsxRuntime.jsx(
549
+ lucideReact.ChevronRight,
550
+ {
551
+ className: button.cn("w-4 h-4 transition-transform duration-200", isOpen && "rotate-90")
552
+ }
553
+ )
554
+ }
555
+ )
556
+ ]
557
+ }
558
+ ),
559
+ /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { initial: false, children: isOpen && /* @__PURE__ */ jsxRuntime.jsx(
560
+ framerMotion.motion.div,
561
+ {
562
+ initial: { height: 0, opacity: 0 },
563
+ animate: { height: "auto", opacity: 1 },
564
+ exit: { height: 0, opacity: 0 },
565
+ transition: { duration: 0.2 },
566
+ className: "overflow-hidden",
567
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-4 mt-0.5 mb-0.5 space-y-0.5", children: item.children.map((child) => {
568
+ const ChildIcon = child.icon;
569
+ const isChildActive = location.pathname === child.path || location.pathname.startsWith(child.path + "/");
570
+ return /* @__PURE__ */ jsxRuntime.jsxs(
571
+ "button",
572
+ {
573
+ onClick: () => handleNavigate(child.path),
574
+ className: button.cn(
575
+ "w-full h-9 flex items-center gap-2.5 px-3 rounded-[var(--radius-button)] transition-all duration-200 text-left",
576
+ isChildActive ? "bg-sidebar-foreground/15 text-sidebar-foreground" : "text-sidebar-foreground/70 hover:bg-sidebar-foreground/10 hover:text-sidebar-foreground"
577
+ ),
578
+ children: [
579
+ ChildIcon && /* @__PURE__ */ jsxRuntime.jsx(ChildIcon, { className: "h-4 w-4 flex-shrink-0" }),
580
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-sm", children: child.label })
581
+ ]
582
+ },
583
+ child.path
584
+ );
585
+ }) })
586
+ }
587
+ ) })
588
+ ] }, item.path);
589
+ }
590
+ return /* @__PURE__ */ jsxRuntime.jsxs(
591
+ "div",
592
+ {
593
+ className: button.cn(
594
+ "group/item flex items-center w-full h-10 rounded-[var(--radius-button)] transition-all duration-200",
595
+ activeClass
596
+ ),
597
+ children: [
598
+ /* @__PURE__ */ jsxRuntime.jsxs(
599
+ "button",
600
+ {
601
+ onClick: () => handleNavigate(item.path),
602
+ className: "flex items-center gap-3 px-3 flex-1 h-full min-w-0 text-left",
603
+ children: [
604
+ Icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "w-5 h-5 flex-shrink-0" }),
605
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate flex-1", children: item.label })
606
+ ]
607
+ }
608
+ ),
609
+ hasChildren && /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu.DropdownMenu, { children: [
610
+ /* @__PURE__ */ jsxRuntime.jsx(dropdownMenu.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
611
+ "button",
612
+ {
613
+ onClick: (e) => e.stopPropagation(),
614
+ className: "h-full px-2 pr-2.5 flex items-center justify-center text-sidebar-foreground/40 hover:text-sidebar-foreground transition-colors",
615
+ "aria-label": t("sidebar.submenu", { label: item.label }),
616
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "w-4 h-4" })
617
+ }
618
+ ) }),
619
+ /* @__PURE__ */ jsxRuntime.jsx(
620
+ dropdownMenu.DropdownMenuContent,
621
+ {
622
+ side: "right",
623
+ align: "start",
624
+ className: "w-48 bg-popover border-border p-1",
625
+ children: item.children.map((child) => {
626
+ const ChildIcon = child.icon;
627
+ const isChildActive = location.pathname === child.path || location.pathname.startsWith(child.path + "/");
628
+ return /* @__PURE__ */ jsxRuntime.jsxs(
629
+ dropdownMenu.DropdownMenuItem,
630
+ {
631
+ onClick: () => handleNavigate(child.path),
632
+ className: button.cn(
633
+ "flex items-center gap-2 cursor-pointer",
634
+ isChildActive && "bg-accent text-accent-foreground"
635
+ ),
636
+ children: [
637
+ ChildIcon && /* @__PURE__ */ jsxRuntime.jsx(ChildIcon, { className: "h-4 w-4 flex-shrink-0" }),
638
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: child.label })
639
+ ]
640
+ },
641
+ child.path
642
+ );
643
+ })
644
+ }
645
+ )
646
+ ] })
647
+ ]
648
+ },
649
+ item.path
650
+ );
651
+ };
652
+ const renderDefaultGroup = (group) => {
653
+ const GroupIcon = group.icon;
654
+ if (!expanded) {
655
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: group.items.map((item) => renderDefaultItem(toNavItem(item))) }, group.id);
656
+ }
657
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
658
+ (group.label || GroupIcon) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-3 mb-1 flex items-center gap-2", children: [
659
+ GroupIcon && (React.isValidElement(GroupIcon) ? GroupIcon : /* @__PURE__ */ jsxRuntime.jsx(GroupIcon, { className: "h-3 w-3 text-sidebar-foreground/80" })),
660
+ group.label && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-semibold uppercase tracking-wider text-sidebar-foreground/80", children: group.label })
661
+ ] }),
662
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: group.items.map((item) => renderDefaultItem(toNavItem(item))) })
663
+ ] }, group.id);
664
+ };
665
+ const renderAssistantGroup = (group) => {
666
+ const isAnyItemActive = group.items.some(
667
+ (item) => location.pathname === item.path || location.pathname.startsWith(item.path + "/")
668
+ );
669
+ const GroupIcon = group.icon;
670
+ if (!expanded) {
671
+ if (!GroupIcon) return null;
672
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-2 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsxs(tooltip.Tooltip, { children: [
673
+ /* @__PURE__ */ jsxRuntime.jsx(tooltip.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
674
+ "button",
675
+ {
676
+ onClick: () => onToggle(),
677
+ "aria-label": group.label,
678
+ className: button.cn(
679
+ "h-10 w-10 flex items-center justify-center rounded-[var(--radius-button)] transition-all duration-200",
680
+ isAnyItemActive ? "bg-sidebar-foreground/15 text-sidebar-foreground shadow-sm" : "text-sidebar-foreground/80 hover:bg-sidebar-foreground/15 hover:text-sidebar-foreground"
681
+ ),
682
+ children: React.isValidElement(GroupIcon) ? GroupIcon : /* @__PURE__ */ jsxRuntime.jsx(GroupIcon, { className: "h-5 w-5" })
683
+ }
684
+ ) }),
685
+ /* @__PURE__ */ jsxRuntime.jsx(CustomTooltipContent.CustomTooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: group.label }) })
686
+ ] }) }, group.id);
687
+ }
688
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "py-2 group", children: [
689
+ (group.label || group.icon) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between px-3 mb-1", children: [
690
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sidebar-foreground/80 text-xs font-semibold uppercase tracking-wider", children: [
691
+ GroupIcon && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center", children: React.isValidElement(GroupIcon) ? GroupIcon : /* @__PURE__ */ jsxRuntime.jsx(GroupIcon, { className: "h-4 w-4" }) }),
692
+ group.label && /* @__PURE__ */ jsxRuntime.jsx("span", { children: group.label })
693
+ ] }),
694
+ renderAssistantActionMenu(group.actions, true)
695
+ ] }),
696
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: group.items.map((item) => {
697
+ const isRouteActive = location.pathname === item.path || location.pathname.startsWith(item.path + "/");
698
+ const isActive = isRouteActive || localActiveItem === item.path;
699
+ const Icon = item.icon;
700
+ return /* @__PURE__ */ jsxRuntime.jsxs(
701
+ "div",
702
+ {
703
+ className: `group/item flex items-start justify-between px-3 min-h-[36px] py-2.5 rounded-[var(--radius-button)] cursor-pointer transition-all duration-200 ${isActive ? "bg-sidebar-foreground/15 text-sidebar-foreground" : "text-sidebar-foreground/80 hover:bg-sidebar-foreground/10 hover:text-sidebar-foreground"}`,
704
+ onClick: () => handleNavigate(item.path),
705
+ children: [
706
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col min-w-0 flex-1", children: [
707
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 overflow-hidden h-5", children: [
708
+ Icon && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-4 h-4 flex-shrink-0 flex items-center justify-center", children: React.isValidElement(Icon) ? Icon : /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "w-4 h-4" }) }),
709
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-sm font-medium leading-none", children: item.label })
710
+ ] }),
711
+ isActive && item.description && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[11px] text-sidebar-foreground/60 mt-1.5 animate-in fade-in slide-in-from-top-1 duration-200", children: item.description })
712
+ ] }),
713
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-5 flex items-center ml-1", children: renderAssistantActionMenu(item.actions) })
714
+ ]
715
+ },
716
+ item.path
717
+ );
718
+ }) })
719
+ ] }, group.id);
720
+ };
721
+ if (variant === "assistant") {
722
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 min-h-0 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
723
+ "div",
724
+ {
725
+ className: "h-full px-4",
726
+ style: { overflowY: "auto", overflowX: "hidden" },
727
+ children: navigationGroups.map((group) => renderAssistantGroup(group))
728
+ }
729
+ ) });
730
+ }
731
+ if (isMobileViewport && isOverflowAccordionOpen) {
732
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 min-h-0 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
733
+ "div",
734
+ {
735
+ className: "h-full",
736
+ style: { overflowY: "auto", overflowX: "hidden" },
737
+ children: /* @__PURE__ */ jsxRuntime.jsx(
738
+ "nav",
739
+ {
740
+ id: "sidebar-nav",
741
+ "aria-label": t("sidebar.mainNavigation"),
742
+ className: "px-4 py-4",
743
+ ref: navRef,
744
+ children: navigationGroups && navigationGroups.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
745
+ (hasGroupOverflow ? visibleGroups : navigationGroups).map((group) => /* @__PURE__ */ jsxRuntime.jsx(React.Fragment, { children: renderDefaultGroup(group) }, group.id)),
746
+ hasGroupOverflow && /* @__PURE__ */ jsxRuntime.jsx(
747
+ OverflowGroupsAccordion,
748
+ {
749
+ expanded,
750
+ overflowGroups,
751
+ location,
752
+ handleNavigate,
753
+ moreOptionsLabel: t("sidebar.moreOptions"),
754
+ onOpenChange: setIsOverflowAccordionOpen
755
+ }
756
+ )
757
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
758
+ (hasOverflow ? visibleItems : navigationItems).map((item) => renderDefaultItem(item)),
759
+ hasOverflow && /* @__PURE__ */ jsxRuntime.jsxs(input.Popover, { children: [
760
+ /* @__PURE__ */ jsxRuntime.jsx(input.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
761
+ "button",
762
+ {
763
+ className: expanded ? "w-full h-10 flex items-center gap-3 px-3 justify-start rounded-[var(--radius-button)] transition-all duration-200 text-sidebar-foreground/80 hover:bg-sidebar-foreground/15 hover:text-sidebar-foreground" : "w-full h-10 flex items-center justify-center px-0 rounded-[var(--radius-button)] transition-all duration-200 text-sidebar-foreground/80 hover:bg-sidebar-foreground/15 hover:text-sidebar-foreground",
764
+ "aria-label": t("sidebar.moreOptions"),
765
+ children: [
766
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MoreVertical, { className: "w-5 h-5 flex-shrink-0" }),
767
+ expanded && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-sidebar-foreground", children: t("sidebar.moreOptions") })
768
+ ]
769
+ }
770
+ ) }),
771
+ /* @__PURE__ */ jsxRuntime.jsx(
772
+ input.PopoverContent,
773
+ {
774
+ side: "right",
775
+ align: "start",
776
+ className: "w-56 p-2 bg-popover border border-border rounded-[var(--radius-card)] shadow-lg",
777
+ sideOffset: 8,
778
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: overflowItems.map((item) => {
779
+ const Icon = item.icon;
780
+ return /* @__PURE__ */ jsxRuntime.jsxs(
781
+ "button",
782
+ {
783
+ onClick: () => handleNavigate(item.path),
784
+ className: "w-full h-9 flex items-center gap-2 px-3 rounded-[var(--radius-button)] transition-all duration-200 text-popover-foreground/80 hover:bg-accent hover:text-accent-foreground text-left",
785
+ children: [
786
+ Icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "w-4 h-4 flex-shrink-0" }),
787
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: item.label })
788
+ ]
789
+ },
790
+ item.path
791
+ );
792
+ }) })
793
+ }
794
+ )
795
+ ] })
796
+ ] })
797
+ }
798
+ )
799
+ }
800
+ ) });
801
+ }
802
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 min-h-0 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
803
+ "nav",
804
+ {
805
+ id: "sidebar-nav",
806
+ "aria-label": t("sidebar.mainNavigation"),
807
+ className: "h-full px-4 py-4 overflow-hidden",
808
+ ref: navRef,
809
+ children: navigationGroups && navigationGroups.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
810
+ (hasGroupOverflow ? visibleGroups : navigationGroups).map((group) => /* @__PURE__ */ jsxRuntime.jsx(React.Fragment, { children: renderDefaultGroup(group) }, group.id)),
811
+ hasGroupOverflow && (isMobileViewport ? (
812
+ // Mobile: accordion inline abre abaixo, igual aos subitens
813
+ /* @__PURE__ */ jsxRuntime.jsx(
814
+ OverflowGroupsAccordion,
815
+ {
816
+ expanded,
817
+ overflowGroups,
818
+ location,
819
+ handleNavigate,
820
+ moreOptionsLabel: t("sidebar.moreOptions"),
821
+ onOpenChange: setIsOverflowAccordionOpen
822
+ }
823
+ )
824
+ ) : (
825
+ // Desktop: popover lateral direito
826
+ /* @__PURE__ */ jsxRuntime.jsxs(input.Popover, { children: [
827
+ /* @__PURE__ */ jsxRuntime.jsx(input.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
828
+ "button",
829
+ {
830
+ className: expanded ? "w-full h-10 flex items-center gap-3 px-3 justify-start rounded-[var(--radius-button)] transition-all duration-200 text-sidebar-foreground/80 hover:bg-sidebar-foreground/15 hover:text-sidebar-foreground" : "w-full h-10 flex items-center justify-center px-0 rounded-[var(--radius-button)] transition-all duration-200 text-sidebar-foreground/80 hover:bg-sidebar-foreground/15 hover:text-sidebar-foreground",
831
+ "aria-label": t("sidebar.moreOptions"),
832
+ children: [
833
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MoreVertical, { className: "w-5 h-5 flex-shrink-0" }),
834
+ expanded && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-sidebar-foreground", children: t("sidebar.moreOptions") })
835
+ ]
836
+ }
837
+ ) }),
838
+ /* @__PURE__ */ jsxRuntime.jsx(
839
+ input.PopoverContent,
840
+ {
841
+ side: "right",
842
+ align: "start",
843
+ className: "w-56 p-2 bg-popover border border-border rounded-[var(--radius-card)] shadow-lg",
844
+ sideOffset: 8,
845
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-3", children: overflowGroups.map((group) => {
846
+ const GroupIcon = group.icon;
847
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
848
+ (group.label || GroupIcon) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-2 mb-1 flex items-center gap-2", children: [
849
+ GroupIcon && (React.isValidElement(GroupIcon) ? GroupIcon : /* @__PURE__ */ jsxRuntime.jsx(GroupIcon, { className: "h-3 w-3 text-popover-foreground/60" })),
850
+ group.label && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-semibold uppercase tracking-wider text-popover-foreground/60", children: group.label })
851
+ ] }),
852
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: group.items.map((item) => {
853
+ const Icon = item.icon;
854
+ const isActive = location.pathname === item.path || location.pathname.startsWith(item.path + "/");
855
+ return /* @__PURE__ */ jsxRuntime.jsxs(
856
+ "button",
857
+ {
858
+ onClick: () => handleNavigate(item.path),
859
+ className: button.cn(
860
+ "w-full h-9 flex items-center gap-2 px-2 rounded-[var(--radius-button)] transition-all duration-200 text-left text-sm",
861
+ isActive ? "bg-accent text-accent-foreground font-medium" : "text-popover-foreground/80 hover:bg-accent hover:text-accent-foreground"
862
+ ),
863
+ children: [
864
+ Icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "w-4 h-4 flex-shrink-0" }),
865
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: item.label })
866
+ ]
867
+ },
868
+ item.path
869
+ );
870
+ }) })
871
+ ] }, group.id);
872
+ }) })
873
+ }
874
+ )
875
+ ] })
876
+ ))
877
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
878
+ (hasOverflow ? visibleItems : navigationItems).map((item) => renderDefaultItem(item)),
879
+ hasOverflow && /* @__PURE__ */ jsxRuntime.jsxs(input.Popover, { children: [
880
+ /* @__PURE__ */ jsxRuntime.jsx(input.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
881
+ "button",
882
+ {
883
+ className: expanded ? "w-full h-10 flex items-center gap-3 px-3 justify-start rounded-[var(--radius-button)] transition-all duration-200 text-sidebar-foreground/80 hover:bg-sidebar-foreground/15 hover:text-sidebar-foreground" : "w-full h-10 flex items-center justify-center px-0 rounded-[var(--radius-button)] transition-all duration-200 text-sidebar-foreground/80 hover:bg-sidebar-foreground/15 hover:text-sidebar-foreground",
884
+ "aria-label": t("sidebar.moreOptions"),
885
+ children: [
886
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MoreVertical, { className: "w-5 h-5 flex-shrink-0" }),
887
+ expanded && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-sidebar-foreground", children: t("sidebar.moreOptions") })
888
+ ]
889
+ }
890
+ ) }),
891
+ /* @__PURE__ */ jsxRuntime.jsx(
892
+ input.PopoverContent,
893
+ {
894
+ side: "right",
895
+ align: "start",
896
+ className: "w-56 p-2 bg-popover border border-border rounded-[var(--radius-card)] shadow-lg",
897
+ sideOffset: 8,
898
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: overflowItems.map((item) => {
899
+ const Icon = item.icon;
900
+ return /* @__PURE__ */ jsxRuntime.jsxs(
901
+ "button",
902
+ {
903
+ onClick: () => handleNavigate(item.path),
904
+ className: "w-full h-9 flex items-center gap-2 px-3 rounded-[var(--radius-button)] transition-all duration-200 text-popover-foreground/80 hover:bg-accent hover:text-accent-foreground text-left",
905
+ children: [
906
+ Icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "w-4 h-4 flex-shrink-0" }),
907
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: item.label })
908
+ ]
909
+ },
910
+ item.path
911
+ );
912
+ }) })
913
+ }
914
+ )
915
+ ] })
916
+ ] })
917
+ }
918
+ ) });
919
+ }
920
+ function SidebarSearch({
921
+ fixedArea,
922
+ search
923
+ }) {
924
+ const { expanded } = useSidebarContext();
925
+ const { t } = reactI18next.useTranslation();
926
+ const [isFilterOpen, setIsFilterOpen] = React.useState(false);
927
+ if (!(fixedArea && fixedArea.show || search && search.show)) return null;
928
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-shrink-0 px-4 pb-4 space-y-4 border-b border-sidebar-border/30 mb-2", children: [
929
+ fixedArea?.show && fixedArea.content && expanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "animate-in fade-in slide-in-from-top-1 duration-300", children: fixedArea.content }),
930
+ search?.show && expanded && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
931
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
932
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex-1", children: [
933
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-sidebar-foreground/50" }),
934
+ /* @__PURE__ */ jsxRuntime.jsx(
935
+ input.Input,
936
+ {
937
+ type: "text",
938
+ placeholder: search.placeholder || t("sidebar.searchPlaceholder"),
939
+ "aria-label": search.placeholder || t("sidebar.searchPlaceholder"),
940
+ value: search.value,
941
+ onChange: (e) => search.onChange?.(e.target.value),
942
+ className: "w-full h-9 bg-sidebar-foreground/10 border-sidebar-border text-sidebar-foreground placeholder:text-sidebar-foreground/50 pl-9 focus-visible:ring-1 focus-visible:ring-sidebar-foreground/30 focus-visible:ring-offset-0"
943
+ }
944
+ )
945
+ ] }),
946
+ search.filter?.show && search.filter.content && /* @__PURE__ */ jsxRuntime.jsx(
947
+ button.Button,
948
+ {
949
+ variant: "ghost",
950
+ size: "icon",
951
+ onClick: () => setIsFilterOpen(!isFilterOpen),
952
+ className: button.cn(
953
+ "h-9 w-9 text-sidebar-foreground transition-all duration-200",
954
+ isFilterOpen ? "bg-sidebar-foreground/20" : "hover:bg-sidebar-foreground/15"
955
+ ),
956
+ "aria-label": isFilterOpen ? t("sidebar.closeFilters") : t("sidebar.openFilters"),
957
+ children: search.filter.icon || /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Filter, { className: "h-4 w-4" })
958
+ }
959
+ )
960
+ ] }),
961
+ /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: isFilterOpen && search.filter?.show && search.filter.content && /* @__PURE__ */ jsxRuntime.jsx(
962
+ framerMotion.motion.div,
963
+ {
964
+ initial: { height: 0, opacity: 0 },
965
+ animate: { height: "auto", opacity: 1 },
966
+ exit: { height: 0, opacity: 0 },
967
+ transition: { duration: 0.2 },
968
+ className: "overflow-hidden",
969
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pt-2 border-t border-sidebar-border/20", children: search.filter.content })
970
+ }
971
+ ) })
972
+ ] }),
973
+ !expanded && (fixedArea?.show || search?.show) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-4 py-2", children: [
974
+ fixedArea?.show && fixedArea.icon && /* @__PURE__ */ jsxRuntime.jsxs(tooltip.Tooltip, { children: [
975
+ /* @__PURE__ */ jsxRuntime.jsx(tooltip.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
976
+ "button",
977
+ {
978
+ onClick: () => fixedArea.onClick?.(),
979
+ className: "h-10 w-10 flex items-center justify-center rounded-[var(--radius-button)] bg-primary text-primary-foreground shadow-sm hover:bg-primary/90 transition-all",
980
+ "aria-label": t("assistant.newConversation"),
981
+ children: React.isValidElement(fixedArea.icon) ? fixedArea.icon : (() => {
982
+ const FixedAreaIcon = fixedArea.icon;
983
+ return /* @__PURE__ */ jsxRuntime.jsx(FixedAreaIcon, { className: "h-5 w-5" });
984
+ })()
985
+ }
986
+ ) }),
987
+ /* @__PURE__ */ jsxRuntime.jsx(CustomTooltipContent.CustomTooltipContent, { side: "right", children: t("assistant.newConversation") })
988
+ ] }),
989
+ search?.show && /* @__PURE__ */ jsxRuntime.jsxs(tooltip.Tooltip, { children: [
990
+ /* @__PURE__ */ jsxRuntime.jsx(tooltip.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
991
+ "button",
992
+ {
993
+ className: "h-10 w-10 flex items-center justify-center rounded-[var(--radius-button)] text-sidebar-foreground/80 hover:bg-sidebar-foreground/15 hover:text-sidebar-foreground",
994
+ "aria-label": t("sidebar.search"),
995
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "h-5 w-5" })
996
+ }
997
+ ) }),
998
+ /* @__PURE__ */ jsxRuntime.jsx(CustomTooltipContent.CustomTooltipContent, { side: "right", children: t("sidebar.search") })
999
+ ] })
1000
+ ] })
1001
+ ] });
1002
+ }
1003
+ function SidebarFooter({
1004
+ user,
1005
+ onLogout = () => {
1006
+ },
1007
+ onSettingsClick,
1008
+ showUser = true,
1009
+ showSettings = true,
1010
+ showLogout = true
1011
+ }) {
1012
+ const { expanded, navigate, location, onToggle } = useSidebarContext();
1013
+ const { t } = reactI18next.useTranslation();
1014
+ const isSettingsActive = location.pathname === "/settings";
1015
+ const handleSettingsClick = () => {
1016
+ if (onSettingsClick) {
1017
+ onSettingsClick();
1018
+ } else {
1019
+ navigate("/settings");
1020
+ }
1021
+ if (typeof window !== "undefined" && window.innerWidth < 768) {
1022
+ onToggle();
1023
+ }
1024
+ };
1025
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-shrink-0 p-4 space-y-2", children: [
1026
+ showUser && (!expanded ? /* @__PURE__ */ jsxRuntime.jsxs(tooltip.Tooltip, { children: [
1027
+ /* @__PURE__ */ jsxRuntime.jsx(tooltip.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
1028
+ "button",
1029
+ {
1030
+ className: "w-full h-10 flex items-center justify-center px-0 rounded-[var(--radius-button)] transition-all duration-200 text-sidebar-foreground/80 hover:bg-sidebar-foreground/15 hover:text-sidebar-foreground",
1031
+ "aria-label": t("sidebar.userProfile"),
1032
+ children: /* @__PURE__ */ jsxRuntime.jsxs(avatar.Avatar, { className: "w-7 h-7 flex-shrink-0", children: [
1033
+ /* @__PURE__ */ jsxRuntime.jsx(avatar.AvatarImage, { src: user?.avatar, alt: user?.name || "User" }),
1034
+ /* @__PURE__ */ jsxRuntime.jsx(avatar.AvatarFallback, { className: "bg-sidebar-foreground/15 text-sidebar-foreground text-xs", children: user?.name ? user.name.charAt(0).toUpperCase() : "U" })
1035
+ ] })
1036
+ }
1037
+ ) }),
1038
+ /* @__PURE__ */ jsxRuntime.jsx(CustomTooltipContent.CustomTooltipContent, { side: "right", sideOffset: 0, children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: user?.name || t("sidebar.profile") }) })
1039
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "w-full h-10 flex items-center gap-3 px-3 justify-start rounded-[var(--radius-button)] transition-all duration-200 text-sidebar-foreground/80 hover:bg-sidebar-foreground/15 hover:text-sidebar-foreground", children: [
1040
+ /* @__PURE__ */ jsxRuntime.jsxs(avatar.Avatar, { className: "w-7 h-7 flex-shrink-0", children: [
1041
+ /* @__PURE__ */ jsxRuntime.jsx(avatar.AvatarImage, { src: user?.avatar, alt: user?.name || "User" }),
1042
+ /* @__PURE__ */ jsxRuntime.jsx(avatar.AvatarFallback, { className: "bg-sidebar-foreground/15 text-sidebar-foreground text-xs", children: user?.name ? user.name.charAt(0).toUpperCase() : "U" })
1043
+ ] }),
1044
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sidebar-foreground truncate", children: user?.name || t("sidebar.profile") })
1045
+ ] })),
1046
+ showSettings && (!expanded ? /* @__PURE__ */ jsxRuntime.jsxs(tooltip.Tooltip, { children: [
1047
+ /* @__PURE__ */ jsxRuntime.jsx(tooltip.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
1048
+ "button",
1049
+ {
1050
+ onClick: handleSettingsClick,
1051
+ className: button.cn(
1052
+ "w-full h-10 flex items-center justify-center px-0 rounded-[var(--radius-button)] transition-all duration-200",
1053
+ isSettingsActive ? "bg-sidebar-foreground/15 text-sidebar-foreground shadow-sm" : "text-sidebar-foreground/80 hover:bg-sidebar-foreground/15 hover:text-sidebar-foreground"
1054
+ ),
1055
+ "aria-label": t("nav.settings"),
1056
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Settings, { className: "w-5 h-5 flex-shrink-0" })
1057
+ }
1058
+ ) }),
1059
+ /* @__PURE__ */ jsxRuntime.jsx(CustomTooltipContent.CustomTooltipContent, { side: "right", sideOffset: 0, children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: t("nav.settings") }) })
1060
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(
1061
+ "button",
1062
+ {
1063
+ onClick: handleSettingsClick,
1064
+ className: button.cn(
1065
+ "w-full h-10 flex items-center gap-3 px-3 justify-start rounded-[var(--radius-button)] transition-all duration-200",
1066
+ isSettingsActive ? "bg-sidebar-foreground/15 text-sidebar-foreground shadow-sm" : "text-sidebar-foreground/80 hover:bg-sidebar-foreground/15 hover:text-sidebar-foreground"
1067
+ ),
1068
+ children: [
1069
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Settings, { className: "w-5 h-5 flex-shrink-0" }),
1070
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-sidebar-foreground", children: t("nav.settings") })
1071
+ ]
1072
+ }
1073
+ )),
1074
+ showLogout && (!expanded ? /* @__PURE__ */ jsxRuntime.jsxs(tooltip.Tooltip, { children: [
1075
+ /* @__PURE__ */ jsxRuntime.jsx(tooltip.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
1076
+ "button",
1077
+ {
1078
+ onClick: onLogout,
1079
+ className: "w-full h-10 flex items-center justify-center px-0 rounded-[var(--radius-button)] transition-all duration-200 text-sidebar-foreground/80 hover:bg-sidebar-foreground/15 hover:text-sidebar-foreground",
1080
+ "aria-label": t("sidebar.logout"),
1081
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LogOut, { className: "w-5 h-5 flex-shrink-0" })
1082
+ }
1083
+ ) }),
1084
+ /* @__PURE__ */ jsxRuntime.jsx(CustomTooltipContent.CustomTooltipContent, { side: "right", sideOffset: 0, children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: t("sidebar.logout") }) })
1085
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(
1086
+ "button",
1087
+ {
1088
+ onClick: onLogout,
1089
+ className: "w-full h-10 flex items-center gap-3 px-3 justify-start rounded-[var(--radius-button)] transition-all duration-200 text-sidebar-foreground/80 hover:bg-sidebar-foreground/15 hover:text-sidebar-foreground",
1090
+ children: [
1091
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LogOut, { className: "w-5 h-5 flex-shrink-0" }),
1092
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-sidebar-foreground", children: t("sidebar.logout") })
1093
+ ]
1094
+ }
1095
+ ))
1096
+ ] });
1097
+ }
1098
+ function Sidebar({
1099
+ expanded: expandedProp,
1100
+ onToggle: onToggleProp,
1101
+ user,
1102
+ onLogout = () => {
1103
+ },
1104
+ onSettingsClick,
1105
+ location: locationProp,
1106
+ navigate: navigateProp,
1107
+ routes,
1108
+ logo,
1109
+ logoCollapsed,
1110
+ variant = "default",
1111
+ fixedArea,
1112
+ search,
1113
+ navigationGroups = [],
1114
+ footer,
1115
+ showFooter,
1116
+ width: widthProp
1117
+ }) {
1118
+ const { showUser = true, showSettings = true, showLogout = true } = footer || {};
1119
+ const displayFooter = showFooter !== void 0 ? showFooter : variant === "default";
1120
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1121
+ SidebarRoot,
1122
+ {
1123
+ expanded: expandedProp,
1124
+ onToggle: onToggleProp,
1125
+ navigate: navigateProp,
1126
+ location: locationProp,
1127
+ width: widthProp,
1128
+ children: [
1129
+ /* @__PURE__ */ jsxRuntime.jsx(SidebarHeader, { logo, logoCollapsed }),
1130
+ variant === "assistant" && /* @__PURE__ */ jsxRuntime.jsx(SidebarSearch, { fixedArea, search }),
1131
+ /* @__PURE__ */ jsxRuntime.jsx(SidebarNav, { navigationGroups, routes, variant }),
1132
+ displayFooter && (showUser || showSettings || showLogout) && /* @__PURE__ */ jsxRuntime.jsx(
1133
+ SidebarFooter,
1134
+ {
1135
+ user,
1136
+ onLogout,
1137
+ onSettingsClick,
1138
+ showUser,
1139
+ showSettings,
1140
+ showLogout
1141
+ }
1142
+ )
1143
+ ]
1144
+ }
1145
+ );
1146
+ }
1147
+ Sidebar.Root = SidebarRoot;
1148
+ Sidebar.Header = SidebarHeader;
1149
+ Sidebar.Search = SidebarSearch;
1150
+ Sidebar.Nav = SidebarNav;
1151
+ Sidebar.Footer = SidebarFooter;
1152
+
1153
+ exports.Header = Header;
1154
+ exports.Sidebar = Sidebar;