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