xertica-ui 2.1.2 → 2.1.4

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 (181) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +1 -1
  3. package/bin/cli.ts +1 -1
  4. package/bin/generate-tokens.ts +13 -7
  5. package/components/assistant/xertica-assistant/index.ts +2 -0
  6. package/components/assistant/xertica-assistant/parts/AssistantCollapsedView.tsx +97 -0
  7. package/components/assistant/xertica-assistant/parts/AssistantConversationList.tsx +104 -0
  8. package/components/assistant/xertica-assistant/parts/AssistantDocumentEditor.tsx +81 -0
  9. package/components/assistant/xertica-assistant/parts/AssistantFeedbackDialog.tsx +86 -0
  10. package/components/assistant/xertica-assistant/parts/AssistantHeader.tsx +77 -0
  11. package/components/assistant/xertica-assistant/parts/AssistantMessageBubble.tsx +573 -0
  12. package/components/assistant/xertica-assistant/parts/AssistantTabBar.tsx +65 -0
  13. package/components/assistant/xertica-assistant/parts/AssistantTypingIndicator.tsx +41 -0
  14. package/components/assistant/xertica-assistant/parts/AssistantWelcomeScreen.tsx +98 -0
  15. package/components/assistant/xertica-assistant/parts/index.ts +16 -0
  16. package/components/assistant/xertica-assistant/types.ts +139 -0
  17. package/components/assistant/xertica-assistant/use-assistant.ts +559 -0
  18. package/components/assistant/xertica-assistant/xertica-assistant.stories.tsx +200 -0
  19. package/components/assistant/xertica-assistant/xertica-assistant.tsx +198 -1460
  20. package/components/brand/theme-toggle/ThemeToggle.tsx +8 -27
  21. package/components/hooks/index.ts +3 -0
  22. package/components/hooks/use-layout-shortcuts.ts +46 -0
  23. package/components/layout/sidebar/index.ts +2 -0
  24. package/components/layout/sidebar/sidebar.stories.tsx +160 -8
  25. package/components/layout/sidebar/sidebar.tsx +606 -497
  26. package/components/layout/sidebar/use-sidebar.ts +104 -0
  27. package/components/media/audio-player/AudioPlayer.tsx +131 -206
  28. package/components/media/audio-player/use-audio-player.ts +298 -0
  29. package/components/pages/home-page/HomePage.tsx +1 -1
  30. package/components/pages/template-content/TemplateContent.tsx +5 -5
  31. package/components/pages/template-page/TemplatePage.tsx +5 -5
  32. package/components/shared/CustomTooltipContent.tsx +52 -0
  33. package/components/shared/layout-constants.ts +1 -1
  34. package/components/ui/chart/chart.stories.tsx +966 -7
  35. package/components/ui/chart/chart.tsx +918 -45
  36. package/components/ui/file-upload/file-upload.stories.tsx +100 -0
  37. package/components/ui/file-upload/file-upload.tsx +14 -74
  38. package/components/ui/file-upload/index.ts +1 -0
  39. package/components/ui/file-upload/use-file-upload.ts +181 -0
  40. package/components/ui/pagination/index.ts +2 -0
  41. package/components/ui/pagination/pagination.stories.tsx +94 -0
  42. package/components/ui/pagination/use-pagination.ts +194 -0
  43. package/components/ui/rich-text-editor/index.ts +2 -0
  44. package/components/ui/rich-text-editor/rich-text-editor.stories.tsx +129 -1
  45. package/components/ui/rich-text-editor/rich-text-editor.tsx +86 -305
  46. package/components/ui/rich-text-editor/use-rich-text-editor.ts +439 -0
  47. package/components/ui/stepper/index.ts +3 -1
  48. package/components/ui/stepper/stepper.stories.tsx +116 -0
  49. package/components/ui/stepper/stepper.tsx +4 -4
  50. package/components/ui/stepper/use-stepper.ts +137 -0
  51. package/components/ui/tree-view/index.ts +4 -1
  52. package/components/ui/tree-view/tree-view.stories.tsx +110 -4
  53. package/components/ui/tree-view/tree-view.tsx +17 -125
  54. package/components/ui/tree-view/use-tree-view.ts +229 -0
  55. package/contexts/AssistenteContext.tsx +17 -54
  56. package/contexts/BrandColorsContext.tsx +6 -17
  57. package/contexts/LayoutContext.tsx +5 -31
  58. package/dist/AssistantChart-BAudAfne.cjs +3591 -0
  59. package/dist/AssistantChart-BP8upjMk.js +3565 -0
  60. package/dist/AudioPlayer-1ypwE2Wh.cjs +936 -0
  61. package/dist/AudioPlayer-DuKXrCfy.js +937 -0
  62. package/dist/CustomTooltipContent-DHjkY0ww.js +40 -0
  63. package/dist/CustomTooltipContent-c_K-DWRr.cjs +56 -0
  64. package/dist/LanguageContext-BwhwC3G2.js +657 -0
  65. package/dist/LanguageContext-DvUt5jBg.cjs +656 -0
  66. package/dist/LayoutContext-BDmcZfMH.cjs +84 -0
  67. package/dist/LayoutContext-dbQvdC4O.js +85 -0
  68. package/dist/ThemeContext-RTy1m2Uq.js +82 -0
  69. package/dist/ThemeContext-bSzuOit2.cjs +81 -0
  70. package/dist/VerifyEmailPage-C_ihbcth.js +2828 -0
  71. package/dist/VerifyEmailPage-Dt7zgA4w.cjs +2827 -0
  72. package/dist/XerticaProvider-CW9hpCdF.cjs +39 -0
  73. package/dist/XerticaProvider-siSt9uG2.js +40 -0
  74. package/dist/XerticaXLogo-D8jf0SNv.cjs +214 -0
  75. package/dist/XerticaXLogo-fAJMy3H4.js +215 -0
  76. package/dist/assistant.cjs.js +2 -1
  77. package/dist/assistant.es.js +3 -2
  78. package/dist/brand.cjs.js +2 -2
  79. package/dist/brand.es.js +2 -2
  80. package/dist/cli.js +14 -8
  81. package/dist/components/assistant/xertica-assistant/index.d.ts +2 -0
  82. package/dist/components/assistant/xertica-assistant/parts/AssistantCollapsedView.d.ts +13 -0
  83. package/dist/components/assistant/xertica-assistant/parts/AssistantConversationList.d.ts +16 -0
  84. package/dist/components/assistant/xertica-assistant/parts/AssistantDocumentEditor.d.ts +17 -0
  85. package/dist/components/assistant/xertica-assistant/parts/AssistantFeedbackDialog.d.ts +19 -0
  86. package/dist/components/assistant/xertica-assistant/parts/AssistantHeader.d.ts +11 -0
  87. package/dist/components/assistant/xertica-assistant/parts/AssistantMessageBubble.d.ts +29 -0
  88. package/dist/components/assistant/xertica-assistant/parts/AssistantTabBar.d.ts +13 -0
  89. package/dist/components/assistant/xertica-assistant/parts/AssistantTypingIndicator.d.ts +4 -0
  90. package/dist/components/assistant/xertica-assistant/parts/AssistantWelcomeScreen.d.ts +17 -0
  91. package/dist/components/assistant/xertica-assistant/parts/index.d.ts +16 -0
  92. package/dist/components/assistant/xertica-assistant/types.d.ts +106 -0
  93. package/dist/components/assistant/xertica-assistant/use-assistant.d.ts +125 -0
  94. package/dist/components/assistant/xertica-assistant/xertica-assistant.d.ts +8 -97
  95. package/dist/components/hooks/index.d.ts +3 -0
  96. package/dist/components/hooks/use-layout-shortcuts.d.ts +22 -0
  97. package/dist/components/layout/sidebar/index.d.ts +2 -0
  98. package/dist/components/layout/sidebar/sidebar.d.ts +80 -0
  99. package/dist/components/layout/sidebar/use-sidebar.d.ts +22 -0
  100. package/dist/components/media/audio-player/AudioPlayer.d.ts +4 -1
  101. package/dist/components/media/audio-player/use-audio-player.d.ts +72 -0
  102. package/dist/components/shared/CustomTooltipContent.d.ts +20 -0
  103. package/dist/components/shared/layout-constants.d.ts +1 -1
  104. package/dist/components/ui/alert/alert.d.ts +1 -1
  105. package/dist/components/ui/badge/badge.d.ts +1 -1
  106. package/dist/components/ui/button/button.d.ts +2 -2
  107. package/dist/components/ui/chart/chart.d.ts +162 -5
  108. package/dist/components/ui/file-upload/file-upload.d.ts +2 -0
  109. package/dist/components/ui/file-upload/index.d.ts +1 -0
  110. package/dist/components/ui/file-upload/use-file-upload.d.ts +49 -0
  111. package/dist/components/ui/pagination/index.d.ts +2 -0
  112. package/dist/components/ui/pagination/use-pagination.d.ts +78 -0
  113. package/dist/components/ui/rich-text-editor/index.d.ts +2 -0
  114. package/dist/components/ui/rich-text-editor/use-rich-text-editor.d.ts +107 -0
  115. package/dist/components/ui/stepper/index.d.ts +3 -1
  116. package/dist/components/ui/stepper/stepper.d.ts +2 -2
  117. package/dist/components/ui/stepper/use-stepper.d.ts +60 -0
  118. package/dist/components/ui/tree-view/index.d.ts +4 -1
  119. package/dist/components/ui/tree-view/tree-view.d.ts +4 -6
  120. package/dist/components/ui/tree-view/use-tree-view.d.ts +60 -0
  121. package/dist/contexts/AssistenteContext.d.ts +10 -49
  122. package/dist/hooks.cjs.js +30 -10
  123. package/dist/hooks.es.js +25 -4
  124. package/dist/index.cjs.js +20 -9
  125. package/dist/index.es.js +38 -27
  126. package/dist/layout.cjs.js +82 -1
  127. package/dist/layout.es.js +83 -2
  128. package/dist/media.cjs.js +1 -1
  129. package/dist/media.es.js +1 -1
  130. package/dist/pages.cjs.js +1 -1
  131. package/dist/pages.es.js +1 -1
  132. package/dist/rich-text-editor-BmsjY03B.js +2949 -0
  133. package/dist/rich-text-editor-GS2kpTAK.cjs +2966 -0
  134. package/dist/sidebar-CVUGHOS_.cjs +756 -0
  135. package/dist/sidebar-CmvwjnVb.js +757 -0
  136. package/dist/ui.cjs.js +12 -2
  137. package/dist/ui.es.js +24 -14
  138. package/dist/use-audio-player-Bkh23vQ3.js +177 -0
  139. package/dist/use-audio-player-Dn1NR9xN.cjs +176 -0
  140. package/dist/utils/color-utils.d.ts +51 -0
  141. package/dist/xertica-assistant-BMqdyRVi.js +2082 -0
  142. package/dist/xertica-assistant-Bj3vBCq_.cjs +2081 -0
  143. package/dist/xertica-ui.css +1 -1
  144. package/docs/ai-usage.md +28 -10
  145. package/docs/architecture-improvements.md +463 -0
  146. package/docs/architecture.md +77 -1
  147. package/docs/components/assistant-chart.md +1 -1
  148. package/docs/components/assistant.md +159 -0
  149. package/docs/components/audio-player.md +46 -0
  150. package/docs/components/branding.md +251 -0
  151. package/docs/components/chart.md +354 -39
  152. package/docs/components/code-block.md +108 -0
  153. package/docs/components/file-upload.md +119 -2
  154. package/docs/components/formatted-document.md +113 -0
  155. package/docs/components/hooks.md +430 -0
  156. package/docs/components/image-with-fallback.md +106 -0
  157. package/docs/components/map-layers.md +140 -0
  158. package/docs/components/modern-chat-input.md +163 -0
  159. package/docs/components/pages.md +351 -0
  160. package/docs/components/pagination.md +187 -0
  161. package/docs/components/rich-text-editor.md +164 -0
  162. package/docs/components/sidebar.md +153 -4
  163. package/docs/components/stepper.md +157 -12
  164. package/docs/components/tree-view.md +164 -6
  165. package/docs/doc-audit.md +223 -0
  166. package/docs/getting-started.md +155 -1
  167. package/docs/guidelines.md +14 -8
  168. package/docs/layout.md +2 -2
  169. package/docs/llms.md +29 -9
  170. package/docs/patterns/detail-page.md +276 -0
  171. package/docs/patterns/settings.md +346 -0
  172. package/docs/patterns/wizard.md +217 -0
  173. package/guidelines/Guidelines.md +5 -3
  174. package/llms.txt +1 -1
  175. package/package.json +10 -10
  176. package/styles/xertica/tokens.css +41 -12
  177. package/templates/CLAUDE.md +16 -6
  178. package/templates/guidelines/Guidelines.md +16 -4
  179. package/templates/package.json +3 -3
  180. package/templates/src/styles/xertica/tokens.css +39 -10
  181. package/utils/color-utils.ts +72 -0
@@ -0,0 +1,757 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import React__default, { createContext, useState, useEffect, useRef, useContext } from "react";
3
+ import { Menu, Settings, User, LogOut, ArrowLeft, Search, Filter, MoreVertical, ChevronRight } from "lucide-react";
4
+ import { B as Button, c as cn } from "./button-qkz7Icqf.js";
5
+ import { L as LanguageSelector, T as ThemeToggle, X as XerticaLogo, a as XerticaXLogo } from "./XerticaXLogo-fAJMy3H4.js";
6
+ import { B as Breadcrumb, d as BreadcrumbList, b as BreadcrumbItem, c as BreadcrumbLink, e as BreadcrumbPage, f as BreadcrumbSeparator } from "./breadcrumb-CVzzzqfo.js";
7
+ import { D as DropdownMenu, n as DropdownMenuTrigger, b as DropdownMenuContent, e as DropdownMenuLabel, i as DropdownMenuSeparator, d as DropdownMenuItem, k as DropdownMenuSub, m as DropdownMenuSubTrigger, f as DropdownMenuPortal, l as DropdownMenuSubContent } from "./dropdown-menu-nc_Lvg-u.js";
8
+ import { A as Avatar, b as AvatarImage, a as AvatarFallback } from "./avatar-DSBfJMRJ.js";
9
+ import { a as useOptionalLayout } from "./LayoutContext-dbQvdC4O.js";
10
+ import { AnimatePresence, motion } from "framer-motion";
11
+ import { I as Input, S as ScrollArea, P as Popover, c as PopoverTrigger, b as PopoverContent } from "./input-D-6IsAca.js";
12
+ import { b as TooltipProvider, T as Tooltip, c as TooltipTrigger } from "./tooltip-CTyZCD8h.js";
13
+ import { C as CustomTooltipContent } from "./CustomTooltipContent-DHjkY0ww.js";
14
+ function Header({
15
+ title,
16
+ breadcrumbs,
17
+ showLanguageSelector = true,
18
+ showThemeToggle = true,
19
+ className,
20
+ user,
21
+ actions,
22
+ showSettings,
23
+ onSettingsClick,
24
+ showLogout,
25
+ onLogoutClick,
26
+ renderLink,
27
+ breadcrumbSlot
28
+ }) {
29
+ var _a;
30
+ const layout = useOptionalLayout();
31
+ const toggleSidebar = (layout == null ? void 0 : layout.toggleSidebar) ?? (() => {
32
+ });
33
+ return /* @__PURE__ */ jsx("header", { className: `bg-card text-foreground shadow-sm border-b border-border px-[24px] h-[64px] flex-shrink-0 flex items-center ${className || ""}`, children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between w-full p-[0px]", children: [
34
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-muted-foreground w-full overflow-x-auto", children: [
35
+ /* @__PURE__ */ jsx(
36
+ Button,
37
+ {
38
+ variant: "ghost",
39
+ size: "sm",
40
+ onClick: toggleSidebar,
41
+ className: "md:hidden mr-2 p-2 shrink-0",
42
+ "aria-label": "Abrir menu lateral",
43
+ children: /* @__PURE__ */ jsx(Menu, { className: "w-5 h-5" })
44
+ }
45
+ ),
46
+ breadcrumbs && breadcrumbs.length > 0 ? /* @__PURE__ */ jsx(Breadcrumb, { children: /* @__PURE__ */ jsx(BreadcrumbList, { className: "flex-nowrap whitespace-nowrap", children: breadcrumbs.map((item, index) => /* @__PURE__ */ jsxs(React__default.Fragment, { children: [
47
+ /* @__PURE__ */ jsx(BreadcrumbItem, { children: item.href ? renderLink ? /* @__PURE__ */ jsx(BreadcrumbLink, { asChild: true, className: "flex items-center gap-1.5", children: renderLink(item.href, {
48
+ className: "flex items-center gap-1.5",
49
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [
50
+ item.icon,
51
+ item.label
52
+ ] })
53
+ }) }) : /* @__PURE__ */ jsxs(BreadcrumbLink, { href: item.href, className: "flex items-center gap-1.5", children: [
54
+ item.icon,
55
+ item.label
56
+ ] }) : /* @__PURE__ */ jsxs(BreadcrumbPage, { className: "flex items-center gap-1.5", children: [
57
+ item.icon,
58
+ item.label
59
+ ] }) }),
60
+ index < breadcrumbs.length - 1 && /* @__PURE__ */ jsx(BreadcrumbSeparator, {})
61
+ ] }, index)) }) }) : title ? /* @__PURE__ */ jsx("span", { className: "text-foreground font-medium shrink-0", children: title }) : /* @__PURE__ */ jsx(Breadcrumb, { children: /* @__PURE__ */ jsx(BreadcrumbList, { className: "flex-nowrap whitespace-nowrap", children: /* @__PURE__ */ jsx(BreadcrumbItem, { children: /* @__PURE__ */ jsx(BreadcrumbPage, { className: "text-foreground font-medium shrink-0", children: "Xertica.ai" }) }) }) }),
62
+ breadcrumbSlot && /* @__PURE__ */ jsx("div", { className: "flex items-center shrink-0", children: breadcrumbSlot })
63
+ ] }),
64
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 shrink-0 ml-4", children: [
65
+ showLanguageSelector && /* @__PURE__ */ jsx(LanguageSelector, { variant: "minimal", showIcon: false, className: "hidden sm:flex" }),
66
+ showThemeToggle && /* @__PURE__ */ jsx(ThemeToggle, { className: "hover:bg-accent" }),
67
+ actions == null ? void 0 : actions.map((action) => /* @__PURE__ */ jsxs(
68
+ Button,
69
+ {
70
+ variant: "ghost",
71
+ size: action.label ? "sm" : "icon",
72
+ onClick: action.onClick,
73
+ className: `hover:bg-accent ${action.className || ""}`,
74
+ "aria-label": action.label || action.id,
75
+ children: [
76
+ action.icon,
77
+ action.label && /* @__PURE__ */ jsx("span", { className: "ml-2 hidden md:inline", children: action.label })
78
+ ]
79
+ },
80
+ action.id
81
+ )),
82
+ showSettings && /* @__PURE__ */ jsx(
83
+ Button,
84
+ {
85
+ variant: "ghost",
86
+ size: "icon",
87
+ onClick: onSettingsClick,
88
+ className: "hover:bg-accent",
89
+ "aria-label": "Configurações",
90
+ children: /* @__PURE__ */ jsx(Settings, { className: "w-5 h-5" })
91
+ }
92
+ ),
93
+ user && /* @__PURE__ */ jsxs(DropdownMenu, { children: [
94
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(Button, { variant: "ghost", className: "relative h-8 w-8 rounded-full p-0 overflow-hidden border border-border/50 hover:border-primary/30 transition-colors", "aria-label": "Menu do usuário", children: /* @__PURE__ */ jsxs(Avatar, { className: "h-8 w-8", children: [
95
+ /* @__PURE__ */ jsx(AvatarImage, { src: user.avatar, alt: user.name || "User" }),
96
+ /* @__PURE__ */ jsx(AvatarFallback, { className: "bg-primary/10 text-primary text-xs font-medium", children: user.name ? user.name.charAt(0).toUpperCase() : /* @__PURE__ */ jsx(User, { className: "w-4 h-4" }) })
97
+ ] }) }) }),
98
+ /* @__PURE__ */ jsxs(DropdownMenuContent, { className: "w-56", align: "end", forceMount: true, children: [
99
+ /* @__PURE__ */ jsx(DropdownMenuLabel, { className: "font-normal", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col space-y-1", children: [
100
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-medium leading-none", children: user.name || "User" }),
101
+ /* @__PURE__ */ jsx("p", { className: "text-xs leading-none text-muted-foreground", children: user.email || "user@example.com" })
102
+ ] }) }),
103
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
104
+ (_a = user.menuItems) == null ? void 0 : _a.map((item) => /* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: item.onClick, className: item.className, children: [
105
+ item.icon && /* @__PURE__ */ jsx("span", { className: "mr-2", children: item.icon }),
106
+ item.label
107
+ ] }, item.id)),
108
+ !user.menuItems && /* @__PURE__ */ jsxs(Fragment, { children: [
109
+ /* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: onSettingsClick, children: [
110
+ /* @__PURE__ */ jsx(Settings, { className: "mr-2 h-4 w-4" }),
111
+ /* @__PURE__ */ jsx("span", { children: "Settings" })
112
+ ] }),
113
+ /* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: onLogoutClick, className: "text-destructive focus:text-destructive", children: [
114
+ /* @__PURE__ */ jsx(LogOut, { className: "mr-2 h-4 w-4" }),
115
+ /* @__PURE__ */ jsx("span", { children: "Logout" })
116
+ ] })
117
+ ] })
118
+ ] })
119
+ ] }),
120
+ showLogout && /* @__PURE__ */ jsx(
121
+ Button,
122
+ {
123
+ variant: "ghost",
124
+ size: "icon",
125
+ onClick: onLogoutClick,
126
+ className: "hover:bg-accent text-muted-foreground hover:text-foreground",
127
+ "aria-label": "Sair",
128
+ children: /* @__PURE__ */ jsx(LogOut, { className: "w-5 h-5" })
129
+ }
130
+ )
131
+ ] })
132
+ ] }) });
133
+ }
134
+ const SidebarContext = createContext(null);
135
+ function useSidebarContext() {
136
+ const ctx = useContext(SidebarContext);
137
+ if (!ctx) {
138
+ throw new Error("Sidebar compound components must be used within <Sidebar.Root>");
139
+ }
140
+ return ctx;
141
+ }
142
+ function SidebarRoot({
143
+ expanded: expandedProp,
144
+ onToggle: onToggleProp,
145
+ navigate: navigateProp,
146
+ location: locationProp,
147
+ width: widthProp,
148
+ children,
149
+ className
150
+ }) {
151
+ const layoutContext = useOptionalLayout();
152
+ const [localExpanded, setLocalExpanded] = useState(false);
153
+ const [isMobileViewport, setIsMobileViewport] = useState(false);
154
+ const expanded = expandedProp !== void 0 ? expandedProp : (layoutContext == null ? void 0 : layoutContext.sidebarExpanded) ?? localExpanded;
155
+ const onToggle = onToggleProp || ((layoutContext == null ? void 0 : layoutContext.toggleSidebar) || (() => setLocalExpanded((prev) => !prev)));
156
+ const width = widthProp !== void 0 ? widthProp : (layoutContext == null ? void 0 : layoutContext.sidebarWidth) ?? 280;
157
+ const navigate = navigateProp || ((path) => {
158
+ if (typeof window !== "undefined") window.location.href = path;
159
+ });
160
+ const location = locationProp || (typeof window !== "undefined" ? window.location : { pathname: "/" });
161
+ useEffect(() => {
162
+ const checkViewport = () => setIsMobileViewport(window.innerWidth < 768);
163
+ checkViewport();
164
+ window.addEventListener("resize", checkViewport);
165
+ return () => window.removeEventListener("resize", checkViewport);
166
+ }, []);
167
+ return /* @__PURE__ */ jsx(SidebarContext.Provider, { value: { expanded, isMobileViewport, onToggle, navigate, location, width }, children: /* @__PURE__ */ jsxs(TooltipProvider, { delayDuration: 300, children: [
168
+ /* @__PURE__ */ jsx("style", { children: `
169
+ @media (max-width: 767px) {
170
+ [style*="padding-left"].flex-1,
171
+ [style*="paddingLeft"].flex-1 {
172
+ padding-left: 0 !important;
173
+ }
174
+ }
175
+ ` }),
176
+ /* @__PURE__ */ jsx(
177
+ "div",
178
+ {
179
+ className: cn(
180
+ "bg-sidebar text-sidebar-foreground transition-all duration-300 ease-in-out flex flex-col z-50",
181
+ 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",
182
+ className
183
+ ),
184
+ style: expanded && !isMobileViewport ? { width: `${width}px` } : void 0,
185
+ children
186
+ }
187
+ )
188
+ ] }) });
189
+ }
190
+ function SidebarHeader({
191
+ logo,
192
+ logoCollapsed
193
+ }) {
194
+ const { expanded, onToggle } = useSidebarContext();
195
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
196
+ /* @__PURE__ */ jsx("div", { className: "flex-shrink-0 p-[14px] pt-[13px] pr-[14px] pb-[12px] pl-[14px]", children: /* @__PURE__ */ jsx(
197
+ "button",
198
+ {
199
+ onClick: onToggle,
200
+ 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",
201
+ "aria-label": expanded ? "Recolher menu" : "Expandir menu",
202
+ children: expanded ? /* @__PURE__ */ jsx(ArrowLeft, { className: "w-5 h-5" }) : /* @__PURE__ */ jsx(Menu, { className: "w-5 h-5" })
203
+ }
204
+ ) }),
205
+ /* @__PURE__ */ jsx("div", { className: "flex-shrink-0 px-4 py-4", children: /* @__PURE__ */ jsx("div", { className: "flex items-center h-10 justify-center", children: /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center flex-shrink-0", children: expanded ? logo || /* @__PURE__ */ jsx(XerticaLogo, { className: "h-5 w-auto", variant: "white" }) : logoCollapsed || /* @__PURE__ */ jsx(XerticaXLogo, { className: "h-5 w-auto", variant: "white" }) }) }) })
206
+ ] });
207
+ }
208
+ function SidebarNav({
209
+ navigationGroups = [],
210
+ routes = [],
211
+ variant = "default"
212
+ }) {
213
+ const { expanded, navigate, location, onToggle } = useSidebarContext();
214
+ const navRef = useRef(null);
215
+ const [localActiveItem, setLocalActiveItem] = useState(null);
216
+ const [hasOverflow, setHasOverflow] = useState(false);
217
+ const [visibleItems, setVisibleItems] = useState([]);
218
+ const [overflowItems, setOverflowItems] = useState([]);
219
+ const labelTranslations = {
220
+ home: "Início",
221
+ dashboard: "Painel",
222
+ components: "Componentes"
223
+ };
224
+ const navigationItems = (routes || []).map((route) => ({
225
+ ...route,
226
+ label: labelTranslations[route.label.toLowerCase()] || route.label,
227
+ active: location.pathname === route.path || location.pathname.startsWith(route.path + "/"),
228
+ children: route.children
229
+ }));
230
+ useEffect(() => {
231
+ if (typeof window === "undefined") return;
232
+ const checkOverflow = () => {
233
+ if (!navRef.current) return;
234
+ if (variant === "assistant") return;
235
+ const navHeight = navRef.current.clientHeight;
236
+ const itemHeight = 44;
237
+ const maxVisibleItems = Math.floor(navHeight / itemHeight);
238
+ if (navigationItems.length > maxVisibleItems) {
239
+ setHasOverflow(true);
240
+ setVisibleItems(navigationItems.slice(0, maxVisibleItems - 1));
241
+ setOverflowItems(navigationItems.slice(maxVisibleItems - 1));
242
+ } else {
243
+ setHasOverflow(false);
244
+ setVisibleItems(navigationItems);
245
+ setOverflowItems([]);
246
+ }
247
+ };
248
+ checkOverflow();
249
+ window.addEventListener("resize", checkOverflow);
250
+ return () => window.removeEventListener("resize", checkOverflow);
251
+ }, [navigationItems.length, variant]);
252
+ const handleNavigate = (path) => {
253
+ setLocalActiveItem(path);
254
+ navigate(path);
255
+ if (typeof window !== "undefined" && window.innerWidth < 768) {
256
+ onToggle();
257
+ }
258
+ };
259
+ const toNavItem = (route) => ({
260
+ path: route.path,
261
+ label: labelTranslations[route.label.toLowerCase()] || route.label,
262
+ icon: route.icon,
263
+ active: location.pathname === route.path || location.pathname.startsWith(route.path + "/"),
264
+ children: route.children,
265
+ actions: route.actions
266
+ });
267
+ const renderActionItems = (actions) => {
268
+ return actions.map((action, idx) => {
269
+ const Icon = action.icon;
270
+ if (action.children && action.children.length > 0) {
271
+ return /* @__PURE__ */ jsxs(DropdownMenuSub, { children: [
272
+ /* @__PURE__ */ jsxs(DropdownMenuSubTrigger, { children: [
273
+ Icon && /* @__PURE__ */ jsx(Icon, { className: "mr-2 h-4 w-4" }),
274
+ /* @__PURE__ */ jsx("span", { children: action.label })
275
+ ] }),
276
+ /* @__PURE__ */ jsx(DropdownMenuPortal, { children: /* @__PURE__ */ jsx(DropdownMenuSubContent, { className: "w-48 bg-popover border-border", children: renderActionItems(action.children) }) })
277
+ ] }, idx);
278
+ }
279
+ return /* @__PURE__ */ jsxs(
280
+ DropdownMenuItem,
281
+ {
282
+ className: cn(
283
+ "flex items-center gap-2",
284
+ action.variant === "destructive" ? "text-destructive focus:text-destructive" : ""
285
+ ),
286
+ onClick: (e) => {
287
+ var _a;
288
+ e.stopPropagation();
289
+ (_a = action.onClick) == null ? void 0 : _a.call(action, null);
290
+ },
291
+ children: [
292
+ Icon && /* @__PURE__ */ jsx(Icon, { className: "h-4 w-4 flex-shrink-0" }),
293
+ /* @__PURE__ */ jsx("span", { children: action.label })
294
+ ]
295
+ },
296
+ idx
297
+ );
298
+ });
299
+ };
300
+ const renderAssistantActionMenu = (actions, isHeader = false) => {
301
+ if (!actions || actions.length === 0) return null;
302
+ return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
303
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
304
+ Button,
305
+ {
306
+ variant: "ghost",
307
+ size: "icon",
308
+ className: cn(
309
+ "h-8 w-8 text-sidebar-foreground/80 hover:bg-sidebar-foreground/20 hover:text-sidebar-foreground rounded-full transition-all",
310
+ !isHeader && "opacity-0 group-hover/item:opacity-100"
311
+ ),
312
+ "aria-label": "Mais opções",
313
+ children: /* @__PURE__ */ jsx(MoreVertical, { className: "h-4 w-4" })
314
+ }
315
+ ) }),
316
+ /* @__PURE__ */ jsx(DropdownMenuContent, { align: "end", className: "w-48 bg-popover border-border p-1", children: renderActionItems(actions) })
317
+ ] });
318
+ };
319
+ const renderDefaultItem = (item) => {
320
+ const Icon = item.icon;
321
+ const hasChildren = item.children && item.children.length > 0;
322
+ 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";
323
+ if (!expanded) {
324
+ return /* @__PURE__ */ jsxs(Tooltip, { children: [
325
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
326
+ "button",
327
+ {
328
+ onClick: () => handleNavigate(item.path),
329
+ className: cn(
330
+ "w-full h-10 flex items-center justify-center px-0 rounded-[var(--radius-button)] transition-all duration-200",
331
+ activeClass
332
+ ),
333
+ "aria-label": item.label,
334
+ children: Icon && /* @__PURE__ */ jsx(Icon, { className: "w-5 h-5 flex-shrink-0" })
335
+ }
336
+ ) }),
337
+ /* @__PURE__ */ jsx(CustomTooltipContent, { side: "right", sideOffset: 0, children: /* @__PURE__ */ jsx("p", { children: item.label }) })
338
+ ] }, item.path);
339
+ }
340
+ return /* @__PURE__ */ jsxs(
341
+ "div",
342
+ {
343
+ className: cn(
344
+ "group/item flex items-center w-full h-10 rounded-[var(--radius-button)] transition-all duration-200",
345
+ activeClass
346
+ ),
347
+ children: [
348
+ /* @__PURE__ */ jsxs(
349
+ "button",
350
+ {
351
+ onClick: () => handleNavigate(item.path),
352
+ className: "flex items-center gap-3 px-3 flex-1 h-full min-w-0 text-left",
353
+ children: [
354
+ Icon && /* @__PURE__ */ jsx(Icon, { className: "w-5 h-5 flex-shrink-0" }),
355
+ /* @__PURE__ */ jsx("span", { className: "truncate flex-1", children: item.label })
356
+ ]
357
+ }
358
+ ),
359
+ hasChildren && /* @__PURE__ */ jsxs(DropdownMenu, { children: [
360
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
361
+ "button",
362
+ {
363
+ onClick: (e) => e.stopPropagation(),
364
+ className: "h-full px-2 pr-2.5 flex items-center justify-center text-sidebar-foreground/40 hover:text-sidebar-foreground transition-colors",
365
+ "aria-label": `Submenu de ${item.label}`,
366
+ children: /* @__PURE__ */ jsx(ChevronRight, { className: "w-4 h-4" })
367
+ }
368
+ ) }),
369
+ /* @__PURE__ */ jsx(DropdownMenuContent, { side: "right", align: "start", className: "w-48 bg-popover border-border p-1", children: item.children.map((child) => {
370
+ const ChildIcon = child.icon;
371
+ const isChildActive = location.pathname === child.path || location.pathname.startsWith(child.path + "/");
372
+ return /* @__PURE__ */ jsxs(
373
+ DropdownMenuItem,
374
+ {
375
+ onClick: () => handleNavigate(child.path),
376
+ className: cn(
377
+ "flex items-center gap-2 cursor-pointer",
378
+ isChildActive && "bg-accent text-accent-foreground"
379
+ ),
380
+ children: [
381
+ ChildIcon && /* @__PURE__ */ jsx(ChildIcon, { className: "h-4 w-4 flex-shrink-0" }),
382
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: child.label })
383
+ ]
384
+ },
385
+ child.path
386
+ );
387
+ }) })
388
+ ] })
389
+ ]
390
+ },
391
+ item.path
392
+ );
393
+ };
394
+ const renderDefaultGroup = (group) => {
395
+ const GroupIcon = group.icon;
396
+ if (!expanded) {
397
+ return /* @__PURE__ */ jsx("div", { className: "space-y-1", children: group.items.map((item) => renderDefaultItem(toNavItem(item))) }, group.id);
398
+ }
399
+ return /* @__PURE__ */ jsxs("div", { children: [
400
+ (group.label || GroupIcon) && /* @__PURE__ */ jsxs("div", { className: "px-3 mb-1 flex items-center gap-2", children: [
401
+ GroupIcon && (React__default.isValidElement(GroupIcon) ? GroupIcon : /* @__PURE__ */ jsx(GroupIcon, { className: "h-3 w-3 text-sidebar-foreground/80" })),
402
+ group.label && /* @__PURE__ */ jsx("span", { className: "text-xs font-semibold uppercase tracking-wider text-sidebar-foreground/80", children: group.label })
403
+ ] }),
404
+ /* @__PURE__ */ jsx("div", { className: "space-y-1", children: group.items.map((item) => renderDefaultItem(toNavItem(item))) })
405
+ ] }, group.id);
406
+ };
407
+ const renderAssistantGroup = (group) => {
408
+ const isAnyItemActive = group.items.some(
409
+ (item) => location.pathname === item.path || location.pathname.startsWith(item.path + "/")
410
+ );
411
+ const GroupIcon = group.icon;
412
+ if (!expanded) {
413
+ if (!GroupIcon) return null;
414
+ return /* @__PURE__ */ jsx("div", { className: "py-2 flex justify-center", children: /* @__PURE__ */ jsxs(Tooltip, { children: [
415
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
416
+ "button",
417
+ {
418
+ onClick: () => onToggle(),
419
+ "aria-label": group.label,
420
+ className: cn(
421
+ "h-10 w-10 flex items-center justify-center rounded-[var(--radius-button)] transition-all duration-200",
422
+ isAnyItemActive ? "bg-sidebar-foreground/15 text-sidebar-foreground shadow-sm" : "text-sidebar-foreground/80 hover:bg-sidebar-foreground/15 hover:text-sidebar-foreground"
423
+ ),
424
+ children: React__default.isValidElement(GroupIcon) ? GroupIcon : /* @__PURE__ */ jsx(GroupIcon, { className: "h-5 w-5" })
425
+ }
426
+ ) }),
427
+ /* @__PURE__ */ jsx(CustomTooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: group.label }) })
428
+ ] }) }, group.id);
429
+ }
430
+ return /* @__PURE__ */ jsxs("div", { className: "py-2 group", children: [
431
+ (group.label || group.icon) && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-3 mb-1", children: [
432
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sidebar-foreground/80 text-xs font-semibold uppercase tracking-wider", children: [
433
+ GroupIcon && /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center", children: React__default.isValidElement(GroupIcon) ? GroupIcon : /* @__PURE__ */ jsx(GroupIcon, { className: "h-4 w-4" }) }),
434
+ group.label && /* @__PURE__ */ jsx("span", { children: group.label })
435
+ ] }),
436
+ renderAssistantActionMenu(group.actions, true)
437
+ ] }),
438
+ /* @__PURE__ */ jsx("div", { className: "space-y-1", children: group.items.map((item) => {
439
+ const isRouteActive = location.pathname === item.path || location.pathname.startsWith(item.path + "/");
440
+ const isActive = isRouteActive || localActiveItem === item.path;
441
+ const Icon = item.icon;
442
+ return /* @__PURE__ */ jsxs(
443
+ "div",
444
+ {
445
+ 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"}`,
446
+ onClick: () => handleNavigate(item.path),
447
+ children: [
448
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col min-w-0 flex-1", children: [
449
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 overflow-hidden h-5", children: [
450
+ Icon && /* @__PURE__ */ jsx("div", { className: "w-4 h-4 flex-shrink-0 flex items-center justify-center", children: React__default.isValidElement(Icon) ? Icon : /* @__PURE__ */ jsx(Icon, { className: "w-4 h-4" }) }),
451
+ /* @__PURE__ */ jsx("span", { className: "truncate text-sm font-medium leading-none", children: item.label })
452
+ ] }),
453
+ isActive && item.description && /* @__PURE__ */ 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 })
454
+ ] }),
455
+ /* @__PURE__ */ jsx("div", { className: "h-5 flex items-center ml-1", children: renderAssistantActionMenu(item.actions) })
456
+ ]
457
+ },
458
+ item.path
459
+ );
460
+ }) })
461
+ ] }, group.id);
462
+ };
463
+ if (variant === "assistant") {
464
+ return /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-0 overflow-hidden", children: /* @__PURE__ */ jsx(ScrollArea, { className: "h-full px-4", children: navigationGroups.map((group) => renderAssistantGroup(group)) }) });
465
+ }
466
+ return /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-0 overflow-hidden", children: /* @__PURE__ */ jsx("nav", { className: "h-full px-4 py-4 overflow-hidden", ref: navRef, children: navigationGroups && navigationGroups.length > 0 ? /* @__PURE__ */ jsx("div", { className: "space-y-3", children: navigationGroups.map((group) => /* @__PURE__ */ jsx(React__default.Fragment, { children: renderDefaultGroup(group) }, group.id)) }) : /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
467
+ (hasOverflow ? visibleItems : navigationItems).map(
468
+ (item) => renderDefaultItem(item)
469
+ ),
470
+ hasOverflow && /* @__PURE__ */ jsxs(Popover, { children: [
471
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
472
+ "button",
473
+ {
474
+ 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",
475
+ "aria-label": "Mais opções",
476
+ children: [
477
+ /* @__PURE__ */ jsx(MoreVertical, { className: "w-5 h-5 flex-shrink-0" }),
478
+ expanded && /* @__PURE__ */ jsx("span", { className: "truncate text-sidebar-foreground", children: "Mais opções" })
479
+ ]
480
+ }
481
+ ) }),
482
+ /* @__PURE__ */ jsx(
483
+ PopoverContent,
484
+ {
485
+ side: "right",
486
+ align: "start",
487
+ className: "w-56 p-2 bg-popover border border-border rounded-[var(--radius-card)] shadow-lg",
488
+ sideOffset: 8,
489
+ children: /* @__PURE__ */ jsx("div", { className: "space-y-1", children: overflowItems.map((item) => {
490
+ const Icon = item.icon;
491
+ return /* @__PURE__ */ jsxs(
492
+ "button",
493
+ {
494
+ onClick: () => handleNavigate(item.path),
495
+ 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",
496
+ children: [
497
+ Icon && /* @__PURE__ */ jsx(Icon, { className: "w-4 h-4 flex-shrink-0" }),
498
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: item.label })
499
+ ]
500
+ },
501
+ item.path
502
+ );
503
+ }) })
504
+ }
505
+ )
506
+ ] })
507
+ ] }) }) });
508
+ }
509
+ function SidebarSearch({
510
+ fixedArea,
511
+ search
512
+ }) {
513
+ var _a, _b;
514
+ const { expanded } = useSidebarContext();
515
+ const [isFilterOpen, setIsFilterOpen] = useState(false);
516
+ if (!(fixedArea && fixedArea.show || search && search.show)) return null;
517
+ return /* @__PURE__ */ jsxs("div", { className: "flex-shrink-0 px-4 pb-4 space-y-4 border-b border-sidebar-border/30 mb-2", children: [
518
+ (fixedArea == null ? void 0 : fixedArea.show) && fixedArea.content && expanded && /* @__PURE__ */ jsx("div", { className: "animate-in fade-in slide-in-from-top-1 duration-300", children: fixedArea.content }),
519
+ (search == null ? void 0 : search.show) && expanded && /* @__PURE__ */ jsxs(Fragment, { children: [
520
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
521
+ /* @__PURE__ */ jsxs("div", { className: "relative flex-1", children: [
522
+ /* @__PURE__ */ jsx(Search, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-sidebar-foreground/50" }),
523
+ /* @__PURE__ */ jsx(
524
+ Input,
525
+ {
526
+ type: "text",
527
+ placeholder: search.placeholder || "Buscar...",
528
+ "aria-label": search.placeholder || "Buscar...",
529
+ value: search.value,
530
+ onChange: (e) => {
531
+ var _a2;
532
+ return (_a2 = search.onChange) == null ? void 0 : _a2.call(search, e.target.value);
533
+ },
534
+ 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"
535
+ }
536
+ )
537
+ ] }),
538
+ ((_a = search.filter) == null ? void 0 : _a.show) && search.filter.content && /* @__PURE__ */ jsx(
539
+ Button,
540
+ {
541
+ variant: "ghost",
542
+ size: "icon",
543
+ onClick: () => setIsFilterOpen(!isFilterOpen),
544
+ className: cn(
545
+ "h-9 w-9 text-sidebar-foreground transition-all duration-200",
546
+ isFilterOpen ? "bg-sidebar-foreground/20" : "hover:bg-sidebar-foreground/15"
547
+ ),
548
+ "aria-label": isFilterOpen ? "Fechar filtros" : "Abrir filtros",
549
+ children: search.filter.icon || /* @__PURE__ */ jsx(Filter, { className: "h-4 w-4" })
550
+ }
551
+ )
552
+ ] }),
553
+ /* @__PURE__ */ jsx(AnimatePresence, { children: isFilterOpen && ((_b = search.filter) == null ? void 0 : _b.show) && search.filter.content && /* @__PURE__ */ jsx(
554
+ motion.div,
555
+ {
556
+ initial: { height: 0, opacity: 0 },
557
+ animate: { height: "auto", opacity: 1 },
558
+ exit: { height: 0, opacity: 0 },
559
+ transition: { duration: 0.2 },
560
+ className: "overflow-hidden",
561
+ children: /* @__PURE__ */ jsx("div", { className: "pt-2 border-t border-sidebar-border/20", children: search.filter.content })
562
+ }
563
+ ) })
564
+ ] }),
565
+ !expanded && ((fixedArea == null ? void 0 : fixedArea.show) || (search == null ? void 0 : search.show)) && /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-4 py-2", children: [
566
+ (fixedArea == null ? void 0 : fixedArea.show) && fixedArea.icon && /* @__PURE__ */ jsxs(Tooltip, { children: [
567
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
568
+ "button",
569
+ {
570
+ onClick: () => {
571
+ var _a2;
572
+ return (_a2 = fixedArea.onClick) == null ? void 0 : _a2.call(fixedArea);
573
+ },
574
+ 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",
575
+ "aria-label": "Nova Conversa",
576
+ children: React__default.isValidElement(fixedArea.icon) ? fixedArea.icon : /* @__PURE__ */ jsx(fixedArea.icon, { className: "h-5 w-5" })
577
+ }
578
+ ) }),
579
+ /* @__PURE__ */ jsx(CustomTooltipContent, { side: "right", children: "Nova Conversa" })
580
+ ] }),
581
+ (search == null ? void 0 : search.show) && /* @__PURE__ */ jsxs(Tooltip, { children: [
582
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
583
+ "button",
584
+ {
585
+ 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",
586
+ "aria-label": "Buscar",
587
+ children: /* @__PURE__ */ jsx(Search, { className: "h-5 w-5" })
588
+ }
589
+ ) }),
590
+ /* @__PURE__ */ jsx(CustomTooltipContent, { side: "right", children: "Buscar" })
591
+ ] })
592
+ ] })
593
+ ] });
594
+ }
595
+ function SidebarFooter({
596
+ user,
597
+ onLogout = () => {
598
+ },
599
+ onSettingsClick,
600
+ showUser = true,
601
+ showSettings = true,
602
+ showLogout = true
603
+ }) {
604
+ const { expanded, navigate, location, onToggle } = useSidebarContext();
605
+ const isSettingsActive = location.pathname === "/settings";
606
+ const handleSettingsClick = () => {
607
+ if (onSettingsClick) {
608
+ onSettingsClick();
609
+ } else {
610
+ navigate("/settings");
611
+ }
612
+ if (typeof window !== "undefined" && window.innerWidth < 768) {
613
+ onToggle();
614
+ }
615
+ };
616
+ return /* @__PURE__ */ jsxs("div", { className: "flex-shrink-0 p-4 space-y-2", children: [
617
+ showUser && (!expanded ? /* @__PURE__ */ jsxs(Tooltip, { children: [
618
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
619
+ "button",
620
+ {
621
+ 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",
622
+ "aria-label": "Perfil do usuário",
623
+ children: /* @__PURE__ */ jsxs(Avatar, { className: "w-7 h-7 flex-shrink-0", children: [
624
+ /* @__PURE__ */ jsx(AvatarImage, { src: user == null ? void 0 : user.avatar, alt: (user == null ? void 0 : user.name) || "User" }),
625
+ /* @__PURE__ */ jsx(AvatarFallback, { className: "bg-sidebar-foreground/15 text-sidebar-foreground text-xs", children: (user == null ? void 0 : user.name) ? user.name.charAt(0).toUpperCase() : "U" })
626
+ ] })
627
+ }
628
+ ) }),
629
+ /* @__PURE__ */ jsx(CustomTooltipContent, { side: "right", sideOffset: 0, children: /* @__PURE__ */ jsx("p", { children: (user == null ? void 0 : user.name) || "Perfil" }) })
630
+ ] }) : /* @__PURE__ */ 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: [
631
+ /* @__PURE__ */ jsxs(Avatar, { className: "w-7 h-7 flex-shrink-0", children: [
632
+ /* @__PURE__ */ jsx(AvatarImage, { src: user == null ? void 0 : user.avatar, alt: (user == null ? void 0 : user.name) || "User" }),
633
+ /* @__PURE__ */ jsx(AvatarFallback, { className: "bg-sidebar-foreground/15 text-sidebar-foreground text-xs", children: (user == null ? void 0 : user.name) ? user.name.charAt(0).toUpperCase() : "U" })
634
+ ] }),
635
+ /* @__PURE__ */ jsx("span", { className: "text-sidebar-foreground truncate", children: (user == null ? void 0 : user.name) || "Perfil" })
636
+ ] })),
637
+ showSettings && (!expanded ? /* @__PURE__ */ jsxs(Tooltip, { children: [
638
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
639
+ "button",
640
+ {
641
+ onClick: handleSettingsClick,
642
+ className: cn(
643
+ "w-full h-10 flex items-center justify-center px-0 rounded-[var(--radius-button)] transition-all duration-200",
644
+ isSettingsActive ? "bg-sidebar-foreground/15 text-sidebar-foreground shadow-sm" : "text-sidebar-foreground/80 hover:bg-sidebar-foreground/15 hover:text-sidebar-foreground"
645
+ ),
646
+ "aria-label": "Configurações",
647
+ children: /* @__PURE__ */ jsx(Settings, { className: "w-5 h-5 flex-shrink-0" })
648
+ }
649
+ ) }),
650
+ /* @__PURE__ */ jsx(CustomTooltipContent, { side: "right", sideOffset: 0, children: /* @__PURE__ */ jsx("p", { children: "Configurações" }) })
651
+ ] }) : /* @__PURE__ */ jsxs(
652
+ "button",
653
+ {
654
+ onClick: handleSettingsClick,
655
+ className: cn(
656
+ "w-full h-10 flex items-center gap-3 px-3 justify-start rounded-[var(--radius-button)] transition-all duration-200",
657
+ isSettingsActive ? "bg-sidebar-foreground/15 text-sidebar-foreground shadow-sm" : "text-sidebar-foreground/80 hover:bg-sidebar-foreground/15 hover:text-sidebar-foreground"
658
+ ),
659
+ children: [
660
+ /* @__PURE__ */ jsx(Settings, { className: "w-5 h-5 flex-shrink-0" }),
661
+ /* @__PURE__ */ jsx("span", { className: "truncate text-sidebar-foreground", children: "Configurações" })
662
+ ]
663
+ }
664
+ )),
665
+ showLogout && (!expanded ? /* @__PURE__ */ jsxs(Tooltip, { children: [
666
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
667
+ "button",
668
+ {
669
+ onClick: onLogout,
670
+ 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",
671
+ "aria-label": "Sair",
672
+ children: /* @__PURE__ */ jsx(LogOut, { className: "w-5 h-5 flex-shrink-0" })
673
+ }
674
+ ) }),
675
+ /* @__PURE__ */ jsx(CustomTooltipContent, { side: "right", sideOffset: 0, children: /* @__PURE__ */ jsx("p", { children: "Sair" }) })
676
+ ] }) : /* @__PURE__ */ jsxs(
677
+ "button",
678
+ {
679
+ onClick: onLogout,
680
+ 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",
681
+ children: [
682
+ /* @__PURE__ */ jsx(LogOut, { className: "w-5 h-5 flex-shrink-0" }),
683
+ /* @__PURE__ */ jsx("span", { className: "truncate text-sidebar-foreground", children: "Sair" })
684
+ ]
685
+ }
686
+ ))
687
+ ] });
688
+ }
689
+ function Sidebar({
690
+ expanded: expandedProp,
691
+ onToggle: onToggleProp,
692
+ user,
693
+ onLogout = () => {
694
+ },
695
+ onSettingsClick,
696
+ location: locationProp,
697
+ navigate: navigateProp,
698
+ routes,
699
+ logo,
700
+ logoCollapsed,
701
+ variant = "default",
702
+ fixedArea,
703
+ search,
704
+ navigationGroups = [],
705
+ footer,
706
+ showFooter,
707
+ width: widthProp
708
+ }) {
709
+ const {
710
+ showUser = true,
711
+ showSettings = true,
712
+ showLogout = true
713
+ } = footer || {};
714
+ const displayFooter = showFooter !== void 0 ? showFooter : variant === "default";
715
+ return /* @__PURE__ */ jsxs(
716
+ SidebarRoot,
717
+ {
718
+ expanded: expandedProp,
719
+ onToggle: onToggleProp,
720
+ navigate: navigateProp,
721
+ location: locationProp,
722
+ width: widthProp,
723
+ children: [
724
+ /* @__PURE__ */ jsx(SidebarHeader, { logo, logoCollapsed }),
725
+ variant === "assistant" && /* @__PURE__ */ jsx(SidebarSearch, { fixedArea, search }),
726
+ /* @__PURE__ */ jsx(
727
+ SidebarNav,
728
+ {
729
+ navigationGroups,
730
+ routes,
731
+ variant
732
+ }
733
+ ),
734
+ displayFooter && (showUser || showSettings || showLogout) && /* @__PURE__ */ jsx(
735
+ SidebarFooter,
736
+ {
737
+ user,
738
+ onLogout,
739
+ onSettingsClick,
740
+ showUser,
741
+ showSettings,
742
+ showLogout
743
+ }
744
+ )
745
+ ]
746
+ }
747
+ );
748
+ }
749
+ Sidebar.Root = SidebarRoot;
750
+ Sidebar.Header = SidebarHeader;
751
+ Sidebar.Search = SidebarSearch;
752
+ Sidebar.Nav = SidebarNav;
753
+ Sidebar.Footer = SidebarFooter;
754
+ export {
755
+ Header as H,
756
+ Sidebar as S
757
+ };