xertica-ui 2.5.2 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (577) hide show
  1. package/CHANGELOG.md +687 -656
  2. package/README.md +482 -482
  3. package/assets/xertica-logo.svg +37 -37
  4. package/assets/xertica-x-logo.svg +20 -20
  5. package/bin/cli.ts +1293 -1256
  6. package/bin/generate-tokens.ts +256 -262
  7. package/bin/language-config.test.ts +32 -0
  8. package/bin/language-config.ts +36 -11
  9. package/components/Introduction.mdx +121 -121
  10. package/components/assistant/code-block/CodeBlock.tsx +7 -6
  11. package/components/assistant/code-block/code-block.mdx +38 -38
  12. package/components/assistant/code-block/code-block.test.tsx +2 -1
  13. package/components/assistant/formatted-document/FormattedDocument.tsx +3 -0
  14. package/components/assistant/formatted-document/formatted-document.mdx +31 -31
  15. package/components/assistant/formatted-document/formatted-document.test.tsx +5 -4
  16. package/components/assistant/markdown-message/MarkdownMessage.tsx +1 -1
  17. package/components/assistant/markdown-message/markdown-message.mdx +44 -44
  18. package/components/assistant/modern-chat-input/modern-chat-input.mdx +71 -71
  19. package/components/assistant/modern-chat-input/modern-chat-input.test.tsx +3 -2
  20. package/components/assistant/xertica-assistant/parts/AssistantMessageBubble.tsx +1 -1
  21. package/components/assistant/xertica-assistant/types.ts +3 -2
  22. package/components/assistant/xertica-assistant/use-assistant.ts +5 -4
  23. package/components/assistant/xertica-assistant/xertica-assistant.mdx +66 -66
  24. package/components/assistant/xertica-assistant/xertica-assistant.test.tsx +2 -1
  25. package/components/blocks/card-patterns/card-patterns.mdx +123 -123
  26. package/components/brand/branding/branding.mdx +27 -27
  27. package/components/brand/language-selector/language-selector.mdx +126 -126
  28. package/components/brand/theme-toggle/theme-toggle.mdx +47 -47
  29. package/components/brand/theme-toggle/theme-toggle.test.tsx +6 -2
  30. package/components/brand/xertica-logo/xertica-logo.mdx +56 -56
  31. package/components/brand/xertica-orbe/xertica-orbe.mdx +38 -38
  32. package/components/brand/xertica-provider/XerticaProvider.tsx +112 -112
  33. package/components/brand/xertica-provider/xertica-provider.mdx +61 -61
  34. package/components/brand/xertica-provider/xertica-provider.test.tsx +25 -13
  35. package/components/brand/xertica-xlogo/xertica-xlogo.mdx +55 -55
  36. package/components/examples/DrawingMapExample.tsx +1 -4
  37. package/components/layout/header/header.mdx +117 -117
  38. package/components/layout/header/header.test.tsx +2 -1
  39. package/components/layout/sidebar/sidebar.mdx +99 -99
  40. package/components/layout/sidebar/sidebar.stories.tsx +1033 -1033
  41. package/components/layout/sidebar/sidebar.test.tsx +2 -1
  42. package/components/layout/sidebar/sidebar.tsx +1509 -1501
  43. package/components/media/audio-player/AudioPlayer.mdx +67 -67
  44. package/components/media/audio-player/AudioPlayer.test.tsx +2 -1
  45. package/components/media/floating-media-wrapper.mdx +74 -74
  46. package/components/media/video-player/VideoPlayer.mdx +102 -102
  47. package/components/media/video-player/VideoPlayer.test.tsx +3 -2
  48. package/components/pages/forgot-password-page/ForgotPasswordPage.tsx +188 -188
  49. package/components/pages/forgot-password-page/forgot-password-page.mdx +60 -60
  50. package/components/pages/forgot-password-page/forgot-password-page.test.tsx +2 -1
  51. package/components/pages/home-content/HomeContent.tsx +2 -3
  52. package/components/pages/home-content/home-content.mdx +62 -62
  53. package/components/pages/home-page/HomePage.stories.tsx +8 -15
  54. package/components/pages/home-page/home-page.mdx +53 -53
  55. package/components/pages/home-page/home-page.test.tsx +2 -1
  56. package/components/pages/login-page/LoginPage.mdx +31 -31
  57. package/components/pages/login-page/LoginPage.tsx +218 -218
  58. package/components/pages/login-page/login-page.test.tsx +2 -1
  59. package/components/pages/reset-password-page/ResetPasswordPage.tsx +243 -243
  60. package/components/pages/reset-password-page/reset-password-page.mdx +63 -63
  61. package/components/pages/template-content/TemplateContent.tsx +2 -3
  62. package/components/pages/template-content/template-content.mdx +61 -61
  63. package/components/pages/template-page/TemplatePage.stories.tsx +32 -32
  64. package/components/pages/template-page/template-page.mdx +53 -53
  65. package/components/pages/template-page/template-page.test.tsx +2 -1
  66. package/components/pages/verify-email-page/VerifyEmailPage.tsx +206 -206
  67. package/components/pages/verify-email-page/verify-email-page.mdx +55 -55
  68. package/components/public-api-smoke.test.tsx +10 -6
  69. package/components/shared/assistant-utils.ts +3 -2
  70. package/components/shared/navigation.ts +2 -2
  71. package/components/ui/accordion/accordion.mdx +29 -29
  72. package/components/ui/alert/alert.mdx +29 -29
  73. package/components/ui/alert-dialog/alert-dialog.mdx +26 -26
  74. package/components/ui/aspect-ratio/aspect-ratio.mdx +25 -25
  75. package/components/ui/assistant-chart/AssistantChart.tsx +8 -2
  76. package/components/ui/assistant-chart/assistant-chart.mdx +25 -25
  77. package/components/ui/avatar/avatar.mdx +26 -26
  78. package/components/ui/badge/badge.mdx +28 -28
  79. package/components/ui/breadcrumb/breadcrumb.mdx +26 -26
  80. package/components/ui/button/button.mdx +29 -29
  81. package/components/ui/calendar/calendar.mdx +26 -26
  82. package/components/ui/card/card.mdx +26 -26
  83. package/components/ui/carousel/carousel.mdx +26 -26
  84. package/components/ui/chart/chart.mdx +26 -26
  85. package/components/ui/chart/chart.test.tsx +178 -178
  86. package/components/ui/chart/chart.tsx +2252 -2245
  87. package/components/ui/checkbox/checkbox.mdx +26 -26
  88. package/components/ui/collapsible/collapsible.mdx +25 -25
  89. package/components/ui/command/command.mdx +26 -26
  90. package/components/ui/context-menu/context-menu.mdx +26 -26
  91. package/components/ui/dialog/dialog.mdx +26 -26
  92. package/components/ui/drawer/drawer.mdx +26 -26
  93. package/components/ui/dropdown-menu/dropdown-menu.mdx +26 -26
  94. package/components/ui/empty/empty.mdx +26 -26
  95. package/components/ui/file-upload/file-upload.mdx +26 -26
  96. package/components/ui/form/form.mdx +20 -20
  97. package/components/ui/google-maps-loader/google-maps-loader.mdx +68 -68
  98. package/components/ui/hover-card/hover-card.mdx +26 -26
  99. package/components/ui/input/input.mdx +29 -29
  100. package/components/ui/input-otp/input-otp.mdx +26 -26
  101. package/components/ui/label/label.mdx +25 -25
  102. package/components/ui/map/map.mdx +26 -26
  103. package/components/ui/map/map.tsx +6 -1
  104. package/components/ui/menubar/menubar.mdx +26 -26
  105. package/components/ui/navigation-menu/navigation-menu.mdx +26 -26
  106. package/components/ui/notification-badge/notification-badge.mdx +26 -26
  107. package/components/ui/page-header/page-header.mdx +44 -44
  108. package/components/ui/pagination/pagination.mdx +26 -26
  109. package/components/ui/popover/popover.mdx +26 -26
  110. package/components/ui/progress/progress.mdx +25 -25
  111. package/components/ui/radio-group/radio-group.mdx +26 -26
  112. package/components/ui/rating/rating.mdx +26 -26
  113. package/components/ui/resizable/resizable.mdx +26 -26
  114. package/components/ui/resizable/resizable.tsx +13 -8
  115. package/components/ui/rich-text-editor/rich-text-editor.mdx +47 -47
  116. package/components/ui/route-map/route-map.mdx +26 -26
  117. package/components/ui/scroll-area/scroll-area.mdx +25 -25
  118. package/components/ui/search/search.mdx +27 -27
  119. package/components/ui/select/select.mdx +26 -26
  120. package/components/ui/separator/separator.mdx +25 -25
  121. package/components/ui/sheet/sheet.mdx +26 -26
  122. package/components/ui/simple-map/simple-map.mdx +25 -25
  123. package/components/ui/skeleton/skeleton.mdx +25 -25
  124. package/components/ui/slider/slider.mdx +26 -26
  125. package/components/ui/sonner/sonner.mdx +26 -26
  126. package/components/ui/stats-card/stats-card.mdx +26 -26
  127. package/components/ui/stats-card/stats-card.stories.tsx +117 -117
  128. package/components/ui/stats-card/stats-card.tsx +109 -109
  129. package/components/ui/stepper/stepper.mdx +26 -26
  130. package/components/ui/switch/switch.mdx +25 -25
  131. package/components/ui/table/table.mdx +27 -27
  132. package/components/ui/tabs/tabs.mdx +26 -26
  133. package/components/ui/textarea/textarea.mdx +25 -25
  134. package/components/ui/timeline/timeline.mdx +26 -26
  135. package/components/ui/toggle/toggle.mdx +26 -26
  136. package/components/ui/toggle-group/toggle-group.mdx +26 -26
  137. package/components/ui/tooltip/tooltip.mdx +26 -26
  138. package/components/ui/tree-view/tree-view.mdx +26 -26
  139. package/components.json +511 -511
  140. package/contexts/BrandColorsContext.tsx +282 -282
  141. package/contexts/i18n-singleton.test.tsx +57 -0
  142. package/contexts/theme-data.ts +391 -391
  143. package/dist/{AssistantChart-DMJJ_Amf.js → AssistantChart-BMNSA_Pk.js} +5 -5
  144. package/dist/{AssistantChart-D0A1FPYt.cjs → AssistantChart-BzM7plyc.cjs} +150 -114
  145. package/dist/{AssistantChart-BXU1ACnh.js → AssistantChart-C842evTi.js} +134 -240
  146. package/dist/{AssistantChart-BZTPJ5dP.cjs → AssistantChart-CVF2uh37.cjs} +5 -5
  147. package/dist/{AssistantChart-COGiOV-g.cjs → AssistantChart-JooMdVQU.cjs} +17 -7
  148. package/dist/{AssistantChart-CWX1OWNM.js → AssistantChart-KHS-tp-L.js} +17 -7
  149. package/dist/{BrandColorsContext-BwY-b6M4.cjs → BrandColorsContext-B4_81eas.cjs} +2 -2
  150. package/dist/{BrandColorsContext-BMRJ04Wf.js → BrandColorsContext-DbK5LnQ_.js} +2 -2
  151. package/dist/{CodeBlock-CjeFavqV.js → CodeBlock-DiKO8ocT.js} +11 -11
  152. package/dist/{CodeBlock-CV6dtsTM.cjs → CodeBlock-ZYThr7Kn.cjs} +12 -9
  153. package/dist/{XerticaXLogo-mqjoBiLI.js → LanguageSelector-CmTj3lWq.js} +85 -82
  154. package/dist/{XerticaXLogo-BX3ueACh.js → LanguageSelector-DxW6o7bt.js} +81 -81
  155. package/dist/{XerticaXLogo-uQgwns_E.cjs → LanguageSelector-Sw73qvWV.cjs} +84 -81
  156. package/dist/{ThemeContext-BgclCB35.js → ThemeContext-BGeh_Kdr.js} +290 -212
  157. package/dist/{ThemeContext-BblcjQup.cjs → ThemeContext-D50irx5T.cjs} +291 -205
  158. package/dist/{VerifyEmailPage-C_Zk6Gen.cjs → VerifyEmailPage-B6bOrybJ.cjs} +17 -17
  159. package/dist/{VerifyEmailPage-B31mCrMc.js → VerifyEmailPage-BRE5Fz59.js} +8 -8
  160. package/dist/{VerifyEmailPage-BJjAMUTW.js → VerifyEmailPage-BcCluouh.js} +151 -78
  161. package/dist/VerifyEmailPage-Bx1sr0uQ.cjs +3298 -0
  162. package/dist/{VerifyEmailPage-X14vhdyl.js → VerifyEmailPage-DUYyXCX9.js} +12 -12
  163. package/dist/VerifyEmailPage-DXXMHbzq.js +3289 -0
  164. package/dist/{VerifyEmailPage-u_Dn7t1U.cjs → VerifyEmailPage-DpYtFk35.cjs} +21 -21
  165. package/dist/{VerifyEmailPage-Cyl55sJb.js → VerifyEmailPage-NXKWW3Dk.js} +134 -64
  166. package/dist/{VerifyEmailPage-Bv8Ah_TK.cjs → VerifyEmailPage-QrCz4Wqr.cjs} +143 -73
  167. package/dist/{VerifyEmailPage-CkBYfsNy.cjs → VerifyEmailPage-ZmQra0Wi.cjs} +160 -87
  168. package/dist/{XerticaProvider-BErr83Bg.js → XerticaProvider-BF3q_myt.js} +5 -4
  169. package/dist/{XerticaProvider-CeS5G_n5.cjs → XerticaProvider-C_JSOz1U.cjs} +2 -2
  170. package/dist/{XerticaProvider-CwOkHxiT.cjs → XerticaProvider-D5zjrqZq.cjs} +5 -4
  171. package/dist/{XerticaProvider-ra2NciRq.js → XerticaProvider-KTGl4Cn1.js} +2 -2
  172. package/dist/{alert-dialog-DqlRW_An.js → alert-dialog-BrpwXKwS.js} +3 -3
  173. package/dist/{alert-dialog-DhwPioBa.cjs → alert-dialog-CZU1Zase.cjs} +3 -3
  174. package/dist/{alert-dialog-KpoabzJb.js → alert-dialog-ClRoLH7l.js} +40 -56
  175. package/dist/{alert-dialog-B4M3vQKS.cjs → alert-dialog-DBBqvU-V.cjs} +53 -38
  176. package/dist/assistant.cjs.js +2 -2
  177. package/dist/assistant.es.js +2 -2
  178. package/dist/brand.cjs.js +6 -6
  179. package/dist/brand.es.js +2 -2
  180. package/dist/cli.js +63 -21
  181. package/dist/components/assistant/code-block/CodeBlock.d.ts +2 -1
  182. package/dist/components/assistant/formatted-document/FormattedDocument.d.ts +2 -1
  183. package/dist/components/assistant/markdown-message/MarkdownMessage.d.ts +2 -1
  184. package/dist/components/assistant/modern-chat-input/ModernChatInput.d.ts +2 -1
  185. package/dist/components/assistant/xertica-assistant/parts/AssistantCollapsedView.d.ts +2 -1
  186. package/dist/components/assistant/xertica-assistant/parts/AssistantConversationList.d.ts +2 -1
  187. package/dist/components/assistant/xertica-assistant/parts/AssistantDocumentEditor.d.ts +2 -1
  188. package/dist/components/assistant/xertica-assistant/parts/AssistantFeedbackDialog.d.ts +2 -1
  189. package/dist/components/assistant/xertica-assistant/parts/AssistantHeader.d.ts +2 -1
  190. package/dist/components/assistant/xertica-assistant/parts/AssistantMessageBubble.d.ts +2 -1
  191. package/dist/components/assistant/xertica-assistant/parts/AssistantTabBar.d.ts +2 -1
  192. package/dist/components/assistant/xertica-assistant/parts/AssistantTypingIndicator.d.ts +2 -1
  193. package/dist/components/assistant/xertica-assistant/parts/AssistantWelcomeScreen.d.ts +2 -1
  194. package/dist/components/assistant/xertica-assistant/types.d.ts +3 -2
  195. package/dist/components/assistant/xertica-assistant/use-assistant.d.ts +1 -1
  196. package/dist/components/assistant/xertica-assistant/xertica-assistant.d.ts +2 -1
  197. package/dist/components/blocks/card-patterns/ActivityCard.d.ts +1 -1
  198. package/dist/components/blocks/card-patterns/ActivityCardSkeleton.d.ts +1 -1
  199. package/dist/components/blocks/card-patterns/FeatureCard.d.ts +1 -1
  200. package/dist/components/blocks/card-patterns/FeatureCardSkeleton.d.ts +1 -1
  201. package/dist/components/blocks/card-patterns/NotificationCard.d.ts +1 -1
  202. package/dist/components/blocks/card-patterns/NotificationCardSkeleton.d.ts +1 -1
  203. package/dist/components/blocks/card-patterns/ProfileCard.d.ts +1 -1
  204. package/dist/components/blocks/card-patterns/ProfileCardSkeleton.d.ts +1 -1
  205. package/dist/components/blocks/card-patterns/ProjectCard.d.ts +1 -1
  206. package/dist/components/blocks/card-patterns/ProjectCardSkeleton.d.ts +1 -1
  207. package/dist/components/blocks/card-patterns/QuickActionCard.d.ts +1 -1
  208. package/dist/components/blocks/card-patterns/QuickActionCardSkeleton.d.ts +1 -1
  209. package/dist/components/brand/language-selector/LanguageSelector.d.ts +2 -1
  210. package/dist/components/brand/theme-toggle/ThemeToggle.d.ts +2 -1
  211. package/dist/components/brand/xertica-logo/XerticaLogo.d.ts +2 -1
  212. package/dist/components/brand/xertica-orbe/XerticaOrbe.d.ts +2 -1
  213. package/dist/components/brand/xertica-provider/XerticaProvider.d.ts +1 -1
  214. package/dist/components/brand/xertica-xlogo/XerticaXLogo.d.ts +2 -1
  215. package/dist/components/examples/DrawingMapExample.d.ts +2 -1
  216. package/dist/components/examples/FilterableMapExample.d.ts +1 -1
  217. package/dist/components/examples/MapShowcase.d.ts +2 -1
  218. package/dist/components/examples/SimpleFilterableMap.d.ts +2 -1
  219. package/dist/components/figma/ImageWithFallback.d.ts +1 -1
  220. package/dist/components/layout/header/header.d.ts +1 -1
  221. package/dist/components/layout/sidebar/sidebar.d.ts +25 -13
  222. package/dist/components/media/FloatingMediaWrapper.d.ts +1 -1
  223. package/dist/components/media/audio-player/AudioPlayer.d.ts +2 -1
  224. package/dist/components/media/video-player/VideoPlayer.d.ts +2 -1
  225. package/dist/components/pages/forgot-password-page/ForgotPasswordPage.d.ts +2 -1
  226. package/dist/components/pages/home-content/HomeContent.d.ts +2 -1
  227. package/dist/components/pages/home-page/HomePage.d.ts +2 -1
  228. package/dist/components/pages/login-page/LoginPage.d.ts +2 -1
  229. package/dist/components/pages/reset-password-page/ResetPasswordPage.d.ts +2 -1
  230. package/dist/components/pages/template-content/TemplateContent.d.ts +2 -1
  231. package/dist/components/pages/template-page/TemplatePage.d.ts +2 -1
  232. package/dist/components/pages/verify-email-page/VerifyEmailPage.d.ts +2 -1
  233. package/dist/components/shared/CustomTooltipContent.d.ts +1 -1
  234. package/dist/components/shared/assistant-utils.d.ts +3 -2
  235. package/dist/components/shared/error-boundary.d.ts +4 -4
  236. package/dist/components/shared/error-fallbacks.d.ts +4 -3
  237. package/dist/components/shared/navigation.d.ts +6 -2
  238. package/dist/components/ui/accordion/accordion.d.ts +4 -4
  239. package/dist/components/ui/alert/alert.d.ts +3 -3
  240. package/dist/components/ui/alert-dialog/alert-dialog.d.ts +10 -10
  241. package/dist/components/ui/aspect-ratio/aspect-ratio.d.ts +1 -1
  242. package/dist/components/ui/assistant-chart/AssistantChart.d.ts +4 -3
  243. package/dist/components/ui/avatar/avatar.d.ts +3 -3
  244. package/dist/components/ui/badge/badge.d.ts +1 -1
  245. package/dist/components/ui/breadcrumb/breadcrumb.d.ts +7 -7
  246. package/dist/components/ui/calendar/calendar.d.ts +2 -2
  247. package/dist/components/ui/card/card.d.ts +7 -7
  248. package/dist/components/ui/carousel/carousel.d.ts +5 -5
  249. package/dist/components/ui/chart/chart.d.ts +16 -16
  250. package/dist/components/ui/collapsible/collapsible.d.ts +3 -3
  251. package/dist/components/ui/command/command.d.ts +9 -9
  252. package/dist/components/ui/context-menu/context-menu.d.ts +15 -15
  253. package/dist/components/ui/dialog/dialog.d.ts +9 -9
  254. package/dist/components/ui/drawer/drawer.d.ts +10 -10
  255. package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts +15 -15
  256. package/dist/components/ui/form/form.d.ts +7 -7
  257. package/dist/components/ui/google-maps-loader/google-maps-loader.d.ts +3 -3
  258. package/dist/components/ui/hover-card/hover-card.d.ts +3 -3
  259. package/dist/components/ui/input-otp/input-otp.d.ts +4 -4
  260. package/dist/components/ui/label/label.d.ts +1 -1
  261. package/dist/components/ui/menubar/menubar.d.ts +16 -16
  262. package/dist/components/ui/navigation-menu/navigation-menu.d.ts +8 -8
  263. package/dist/components/ui/page-header/page-header.d.ts +3 -3
  264. package/dist/components/ui/pagination/pagination.d.ts +7 -7
  265. package/dist/components/ui/popover/popover.d.ts +4 -4
  266. package/dist/components/ui/progress/progress.d.ts +1 -1
  267. package/dist/components/ui/resizable/resizable.d.ts +11 -7
  268. package/dist/components/ui/rich-text-editor/rich-text-editor.d.ts +1 -1
  269. package/dist/components/ui/scroll-area/scroll-area.d.ts +2 -2
  270. package/dist/components/ui/separator/separator.d.ts +1 -1
  271. package/dist/components/ui/sheet/sheet.d.ts +10 -10
  272. package/dist/components/ui/skeleton/skeleton.d.ts +1 -1
  273. package/dist/components/ui/sonner/sonner.d.ts +2 -1
  274. package/dist/components/ui/stats-card/stats-card-skeleton.d.ts +1 -1
  275. package/dist/components/ui/table/table.d.ts +8 -8
  276. package/dist/components/ui/tabs/tabs.d.ts +4 -4
  277. package/dist/components/ui/tooltip/tooltip.d.ts +4 -4
  278. package/dist/contexts/ApiKeyContext.d.ts +2 -2
  279. package/dist/contexts/AssistenteContext.d.ts +1 -1
  280. package/dist/contexts/AuthContext.d.ts +1 -1
  281. package/dist/contexts/LanguageContext.d.ts +2 -2
  282. package/dist/contexts/LayoutContext.d.ts +2 -2
  283. package/dist/contexts/ThemeContext.d.ts +1 -1
  284. package/dist/features/assistant/hooks/useAssistantConfig.d.ts +1 -1
  285. package/dist/features/home/hooks/useDashboardStats.d.ts +1 -1
  286. package/dist/features/home/hooks/useFeatureCards.d.ts +1 -1
  287. package/dist/features/home/hooks/useTeamMembers.d.ts +1 -1
  288. package/dist/{google-maps-loader-BCe58h9D.js → google-maps-loader-BOug999f.js} +0 -4
  289. package/dist/{google-maps-loader-casMyxlo.cjs → google-maps-loader-DfeBRI8Q.cjs} +0 -5
  290. package/dist/hooks.cjs.js +2 -2
  291. package/dist/hooks.es.js +2 -2
  292. package/dist/{index-9GWd0qxq.cjs → index-BQjx1Mdf.cjs} +1 -1
  293. package/dist/index-Bei5DzAL.js +6 -0
  294. package/dist/index.cjs.js +18 -18
  295. package/dist/index.es.js +12 -12
  296. package/dist/{input-cc-PTD4R.js → input-B0_vbA3g.js} +3 -61
  297. package/dist/{input-C_UiS2Py.cjs → input-ByYuOv8A.cjs} +1 -62
  298. package/dist/layout.cjs.js +1 -1
  299. package/dist/layout.es.js +1 -1
  300. package/dist/pages.cjs.js +1 -1
  301. package/dist/pages.es.js +1 -1
  302. package/dist/{rich-text-editor-DxO1Hz3a.cjs → rich-text-editor-BuqSu718.cjs} +70 -5
  303. package/dist/{rich-text-editor-DqLICivI.js → rich-text-editor-CV8FtA_l.js} +68 -6
  304. package/dist/{rich-text-editor-DloeW0wc.js → rich-text-editor-DV1SixzE.js} +61 -3
  305. package/dist/{rich-text-editor-B2CKz7nx.cjs → rich-text-editor-DnSDglzW.cjs} +63 -2
  306. package/dist/{sidebar-BS1p2V7t.cjs → sidebar-BGJ0j567.cjs} +367 -9
  307. package/dist/{sidebar-3XyzjVBw.js → sidebar-BI6mZlC8.js} +364 -6
  308. package/dist/{sidebar-DyYvgyBj.cjs → sidebar-BtmotOg-.cjs} +367 -9
  309. package/dist/{sidebar-Duermn32.js → sidebar-D3EgGVxF.js} +77 -63
  310. package/dist/{sidebar-CLmIjgNd.cjs → sidebar-DDTqMGnR.cjs} +80 -66
  311. package/dist/{sidebar-B4ZWaMrE.js → sidebar-I7EXyf5D.js} +364 -6
  312. package/dist/ui.cjs.js +7 -7
  313. package/dist/ui.es.js +5 -5
  314. package/dist/{xertica-assistant-QFUnv5I2.cjs → xertica-assistant-BrF9jScR.cjs} +4 -4
  315. package/dist/{xertica-assistant-BbgzsgsG.js → xertica-assistant-CJVnvMqU.js} +55 -45
  316. package/dist/{xertica-assistant-d2qs2Vd9.cjs → xertica-assistant-CKPtc1z5.cjs} +58 -40
  317. package/dist/{xertica-assistant-CyikE3N_.js → xertica-assistant-CsBsxTsI.js} +2 -2
  318. package/dist/{xertica-assistant-CIaUlbIt.cjs → xertica-assistant-DER0brPQ.cjs} +6 -5
  319. package/dist/{xertica-assistant-B1NaSFFj.js → xertica-assistant-DQCjpk5M.js} +4 -3
  320. package/dist/{xertica-assistant-B687qEPU.js → xertica-assistant-Dk-9AJzw.js} +16 -7
  321. package/dist/{xertica-assistant-sOHwTgIP.cjs → xertica-assistant-DxhIKvuY.cjs} +18 -9
  322. package/dist/xertica-ui.css +2 -2
  323. package/docs/components/audio-player.md +1 -1
  324. package/docs/components/sidebar.md +331 -331
  325. package/docs/components/stats-card.md +138 -138
  326. package/docs/components/toggle.md +12 -0
  327. package/docs/doc-audit.md +35 -229
  328. package/docs/i18n.md +31 -10
  329. package/docs/llms.md +6 -4
  330. package/llms-compact.txt +444 -444
  331. package/llms-full.txt +12144 -12144
  332. package/llms.txt +187 -187
  333. package/package.json +223 -219
  334. package/scripts/a11y-audit.mjs +162 -162
  335. package/scripts/fix-stories.cjs +19 -19
  336. package/styles/globals.css +0 -1
  337. package/styles/xertica/base.css +8 -0
  338. package/styles/xertica/tokens.css +240 -240
  339. package/templates/.env.example +2 -2
  340. package/templates/.prettierignore +4 -4
  341. package/templates/.prettierrc +10 -10
  342. package/templates/guidelines/Guidelines.md +865 -865
  343. package/templates/index.html +13 -13
  344. package/templates/package.json +69 -69
  345. package/templates/src/app/components/AuthGuard.tsx +11 -0
  346. package/templates/src/features/auth/ui/AuthPageShell.tsx +32 -32
  347. package/templates/src/features/home/ui/HomeContent.tsx +2 -3
  348. package/templates/src/features/settings/index.ts +2 -0
  349. package/templates/src/features/settings/ui/SettingsContent.tsx +134 -0
  350. package/templates/src/features/template/ui/TemplateContent.tsx +2 -3
  351. package/templates/src/i18n.ts +36 -13
  352. package/templates/src/locales/en/pages/settings.json +15 -0
  353. package/templates/src/locales/es/pages/settings.json +15 -0
  354. package/templates/src/locales/pt-BR/pages/settings.json +15 -0
  355. package/templates/src/pages/SettingsPage.tsx +28 -0
  356. package/templates/src/shared/config/navigation.ts +2 -2
  357. package/templates/src/styles/xertica/tokens.css +240 -240
  358. package/templates/vite.config.d.ts +2 -2
  359. package/templates/vite.config.js +20 -20
  360. package/utils/gemini.ts +2 -2
  361. package/dist/AssistantChart-9w31gdAb.cjs +0 -3363
  362. package/dist/AssistantChart-BAudAfne.cjs +0 -3591
  363. package/dist/AssistantChart-BAx9VQvb.cjs +0 -3374
  364. package/dist/AssistantChart-BP8upjMk.js +0 -3565
  365. package/dist/AssistantChart-CVko2A1W.js +0 -3348
  366. package/dist/AssistantChart-CVzmmhx4.js +0 -3337
  367. package/dist/AssistantChart-CeU2dIb6.js +0 -3469
  368. package/dist/AssistantChart-DO5UuX4J.cjs +0 -3495
  369. package/dist/AudioPlayer-1ypwE2Wh.cjs +0 -936
  370. package/dist/AudioPlayer-BJ2IuRQW.cjs +0 -1275
  371. package/dist/AudioPlayer-BWDW6TN9.cjs +0 -1279
  372. package/dist/AudioPlayer-CM962GEh.js +0 -1280
  373. package/dist/AudioPlayer-CbZId7cj.cjs +0 -998
  374. package/dist/AudioPlayer-DU8zt8-z.js +0 -999
  375. package/dist/AudioPlayer-DuKXrCfy.js +0 -937
  376. package/dist/AudioPlayer-Xxma6_-H.js +0 -1276
  377. package/dist/BrandColorsContext-DLVJgtmH.js +0 -666
  378. package/dist/BrandColorsContext-DZT7JjeD.js +0 -659
  379. package/dist/BrandColorsContext-GUyFmkX0.cjs +0 -665
  380. package/dist/BrandColorsContext-awnBCmC4.cjs +0 -666
  381. package/dist/CodeBlock-C2ZUXt8V.js +0 -219
  382. package/dist/CodeBlock-C5oYnLQp.cjs +0 -218
  383. package/dist/CodeBlock-DuxdtN-l.js +0 -219
  384. package/dist/CodeBlock-POVYONvC.cjs +0 -218
  385. package/dist/CustomTooltipContent-BT6brkVJ.cjs +0 -49
  386. package/dist/CustomTooltipContent-CfOfikhq.js +0 -33
  387. package/dist/CustomTooltipContent-DHjkY0ww.js +0 -40
  388. package/dist/CustomTooltipContent-c_K-DWRr.cjs +0 -56
  389. package/dist/FeatureCard-9GhnlgL3.js +0 -336
  390. package/dist/FeatureCard-Bcb3Zi54.js +0 -302
  391. package/dist/FeatureCard-Cfs6Ishq.js +0 -485
  392. package/dist/FeatureCard-CkPd2psQ.cjs +0 -301
  393. package/dist/FeatureCard-Dkp-xmzM.cjs +0 -335
  394. package/dist/FeatureCard-ie3L8Fpr.cjs +0 -484
  395. package/dist/FeatureCardSkeleton-CAgu8stE.js +0 -27
  396. package/dist/FeatureCardSkeleton-mO3Bdm_V.cjs +0 -26
  397. package/dist/LanguageContext-BwhwC3G2.js +0 -657
  398. package/dist/LanguageContext-DvUt5jBg.cjs +0 -656
  399. package/dist/LayoutContext-BDmcZfMH.cjs +0 -84
  400. package/dist/LayoutContext-C4kKN9RV.cjs +0 -93
  401. package/dist/LayoutContext-CGEe1oPq.js +0 -94
  402. package/dist/LayoutContext-CwT5KLiW.cjs +0 -104
  403. package/dist/LayoutContext-DVLCsoQn.js +0 -105
  404. package/dist/LayoutContext-dbQvdC4O.js +0 -85
  405. package/dist/ThemeContext-BbBNoFTG.js +0 -735
  406. package/dist/ThemeContext-Bo-W2WZH.js +0 -1856
  407. package/dist/ThemeContext-CP3a0jxy.cjs +0 -1855
  408. package/dist/ThemeContext-Cmr8Ex8H.cjs +0 -734
  409. package/dist/ThemeContext-CpqYShLq.cjs +0 -324
  410. package/dist/ThemeContext-D3LzacmG.js +0 -188
  411. package/dist/ThemeContext-DQUOeziy.cjs +0 -1855
  412. package/dist/ThemeContext-Du2nE1PL.js +0 -325
  413. package/dist/ThemeContext-GeEBTJ3q.cjs +0 -1621
  414. package/dist/ThemeContext-JyLK9B1o.js +0 -1622
  415. package/dist/ThemeContext-RTy1m2Uq.js +0 -82
  416. package/dist/ThemeContext-U4dEYc6C.cjs +0 -187
  417. package/dist/ThemeContext-bSzuOit2.cjs +0 -81
  418. package/dist/ThemeContext-ept8jhXI.js +0 -1856
  419. package/dist/VerifyEmailPage-BE-L9mB7.js +0 -2828
  420. package/dist/VerifyEmailPage-BIBOKV7Z.js +0 -3214
  421. package/dist/VerifyEmailPage-BRSP-Pwt.cjs +0 -3196
  422. package/dist/VerifyEmailPage-Bae2cBXT.cjs +0 -2827
  423. package/dist/VerifyEmailPage-BiRm7Nh4.cjs +0 -3213
  424. package/dist/VerifyEmailPage-Bvfv8HVQ.js +0 -3214
  425. package/dist/VerifyEmailPage-CR7kb5df.cjs +0 -2827
  426. package/dist/VerifyEmailPage-C_ihbcth.js +0 -2828
  427. package/dist/VerifyEmailPage-CbgjOF0v.js +0 -2828
  428. package/dist/VerifyEmailPage-CdYPSJoO.js +0 -2828
  429. package/dist/VerifyEmailPage-D-FRj5TU.cjs +0 -3213
  430. package/dist/VerifyEmailPage-DF2ilhum.cjs +0 -3210
  431. package/dist/VerifyEmailPage-DMBh4NM9.cjs +0 -2827
  432. package/dist/VerifyEmailPage-DTtFfC-J.js +0 -3197
  433. package/dist/VerifyEmailPage-Dt7zgA4w.cjs +0 -2827
  434. package/dist/VerifyEmailPage-EhudUdqF.js +0 -3211
  435. package/dist/VerifyEmailPage-RrUApqBN.js +0 -3214
  436. package/dist/VerifyEmailPage-VoMI7MYH.cjs +0 -3213
  437. package/dist/VerifyEmailPage-hdB8JQGv.cjs +0 -3213
  438. package/dist/VerifyEmailPage-vYHbYK3q.js +0 -3214
  439. package/dist/XerticaOrbe-BCUVSPPB.cjs +0 -1924
  440. package/dist/XerticaOrbe-BGIB1CTK.js +0 -1355
  441. package/dist/XerticaOrbe-By8eEvR-.js +0 -1925
  442. package/dist/XerticaOrbe-FWGjBj0U.cjs +0 -1354
  443. package/dist/XerticaProvider-AChwphCO.cjs +0 -48
  444. package/dist/XerticaProvider-AbWlr7Af.cjs +0 -48
  445. package/dist/XerticaProvider-B8CaV7xu.cjs +0 -39
  446. package/dist/XerticaProvider-BITjgC5p.js +0 -39
  447. package/dist/XerticaProvider-BSyFrmC0.js +0 -49
  448. package/dist/XerticaProvider-By8q3Roe.cjs +0 -38
  449. package/dist/XerticaProvider-CUYJZc32.js +0 -49
  450. package/dist/XerticaProvider-CW9hpCdF.cjs +0 -39
  451. package/dist/XerticaProvider-CWgby5mY.js +0 -49
  452. package/dist/XerticaProvider-CWs6EwNa.js +0 -49
  453. package/dist/XerticaProvider-CiNKjMx1.cjs +0 -48
  454. package/dist/XerticaProvider-CjQAQPcn.cjs +0 -48
  455. package/dist/XerticaProvider-D5lLumH-.js +0 -49
  456. package/dist/XerticaProvider-DQtvJU7m.js +0 -40
  457. package/dist/XerticaProvider-DUOJg9iX.js +0 -49
  458. package/dist/XerticaProvider-Dl_b72_l.cjs +0 -51
  459. package/dist/XerticaProvider-qQUDop71.cjs +0 -48
  460. package/dist/XerticaProvider-siSt9uG2.js +0 -40
  461. package/dist/XerticaXLogo-8TTzBjHw.cjs +0 -251
  462. package/dist/XerticaXLogo-B2svDGZh.cjs +0 -251
  463. package/dist/XerticaXLogo-BWaag64t.js +0 -252
  464. package/dist/XerticaXLogo-CFuIlYFH.js +0 -252
  465. package/dist/XerticaXLogo-CU-U-GP4.cjs +0 -251
  466. package/dist/XerticaXLogo-ChryA6xj.js +0 -252
  467. package/dist/XerticaXLogo-CowGv7BC.js +0 -252
  468. package/dist/XerticaXLogo-CziKMQil.cjs +0 -242
  469. package/dist/XerticaXLogo-D8jf0SNv.cjs +0 -214
  470. package/dist/XerticaXLogo-DHz5SugF.js +0 -252
  471. package/dist/XerticaXLogo-DTee_y8X.cjs +0 -251
  472. package/dist/XerticaXLogo-DfUvz-lD.js +0 -243
  473. package/dist/XerticaXLogo-DzXKZBtG.js +0 -231
  474. package/dist/XerticaXLogo-fAJMy3H4.js +0 -215
  475. package/dist/XerticaXLogo-kslQ8Tk_.cjs +0 -251
  476. package/dist/XerticaXLogo-xWbElCZj.cjs +0 -230
  477. package/dist/alert-dialog-iDe5VE5o.js +0 -842
  478. package/dist/alert-dialog-yckpaOpy.cjs +0 -865
  479. package/dist/avatar-Cq5_E8r9.cjs +0 -78
  480. package/dist/avatar-CuYu2MKt.cjs +0 -72
  481. package/dist/avatar-Cxyofu1H.js +0 -56
  482. package/dist/avatar-DSBfJMRJ.js +0 -62
  483. package/dist/breadcrumb-CVzzzqfo.js +0 -103
  484. package/dist/breadcrumb-DIJ0X3Ot.js +0 -96
  485. package/dist/breadcrumb-DjSxkjlQ.cjs +0 -95
  486. package/dist/breadcrumb-DnDlQFg2.cjs +0 -102
  487. package/dist/button-0CXwCRTm.cjs +0 -85
  488. package/dist/button-Bnv9SvYK.cjs +0 -79
  489. package/dist/button-C6uvh0rV.js +0 -63
  490. package/dist/button-qkz7Icqf.js +0 -69
  491. package/dist/card-B8-Gl5DL.js +0 -73
  492. package/dist/card-Bv_c57KU.cjs +0 -72
  493. package/dist/card-DJTsYhLL.cjs +0 -89
  494. package/dist/card-fi8zAN-I.js +0 -90
  495. package/dist/dropdown-menu-B_uEXNc4.cjs +0 -220
  496. package/dist/dropdown-menu-CFuCssWA.js +0 -204
  497. package/dist/dropdown-menu-Ze1YZFyc.cjs +0 -247
  498. package/dist/dropdown-menu-nc_Lvg-u.js +0 -231
  499. package/dist/google-maps-loader-BVoVhUwA.js +0 -316
  500. package/dist/google-maps-loader-BqsYL48U.cjs +0 -285
  501. package/dist/google-maps-loader-DjJaYhV6.cjs +0 -316
  502. package/dist/google-maps-loader-t2IlYBzw.js +0 -286
  503. package/dist/index-B7A523O_.js +0 -8
  504. package/dist/index-BabBx2pa.js +0 -6
  505. package/dist/index-CkTUgOwX.js +0 -8
  506. package/dist/index-D3RLKRAs.cjs +0 -7
  507. package/dist/index-DmHhnb7a.cjs +0 -7
  508. package/dist/index.umd.js +0 -13712
  509. package/dist/input-CNFHVKvo.cjs +0 -145
  510. package/dist/input-CPl84zAx.cjs +0 -151
  511. package/dist/input-D-6IsAca.js +0 -133
  512. package/dist/input-wPYg0d0P.js +0 -127
  513. package/dist/progress-BLwqortq.cjs +0 -105
  514. package/dist/progress-Cs9i4DPx.js +0 -81
  515. package/dist/progress-D9mtsf6j.js +0 -89
  516. package/dist/progress-DDeuWPZw.cjs +0 -97
  517. package/dist/rich-text-editor-1UW3Y2JK.js +0 -2891
  518. package/dist/rich-text-editor-BM-LPpTh.js +0 -2902
  519. package/dist/rich-text-editor-BmsjY03B.js +0 -2949
  520. package/dist/rich-text-editor-BrdC5evx.js +0 -2244
  521. package/dist/rich-text-editor-CyggTOLQ.cjs +0 -2908
  522. package/dist/rich-text-editor-DbV-S7Fi.cjs +0 -2261
  523. package/dist/rich-text-editor-DoCkKhzk.cjs +0 -2919
  524. package/dist/rich-text-editor-GS2kpTAK.cjs +0 -2966
  525. package/dist/routes.d.ts +0 -10
  526. package/dist/select-Cmb8zF7w.cjs +0 -156
  527. package/dist/select-CprSNX0z.js +0 -139
  528. package/dist/select-DT7Zjn42.cjs +0 -162
  529. package/dist/select-En8DkoaQ.js +0 -145
  530. package/dist/sidebar-B3EYhli0.cjs +0 -800
  531. package/dist/sidebar-B9NR0lCe.cjs +0 -800
  532. package/dist/sidebar-BcJ6LxvX.cjs +0 -733
  533. package/dist/sidebar-BvF5I2Ue.cjs +0 -800
  534. package/dist/sidebar-C5B_LHek.cjs +0 -795
  535. package/dist/sidebar-CA6_ek3f.js +0 -801
  536. package/dist/sidebar-CRMiBtAi.js +0 -801
  537. package/dist/sidebar-CVUGHOS_.cjs +0 -756
  538. package/dist/sidebar-CZ2mWaMM.cjs +0 -800
  539. package/dist/sidebar-CmvwjnVb.js +0 -757
  540. package/dist/sidebar-CplprZpM.js +0 -801
  541. package/dist/sidebar-Dz7bd3zP.js +0 -796
  542. package/dist/sidebar-KIS0C2JH.js +0 -801
  543. package/dist/sidebar-OTO_up7Z.js +0 -801
  544. package/dist/sidebar-WoKvFWCN.js +0 -717
  545. package/dist/sidebar-zowjejT2.cjs +0 -800
  546. package/dist/skeleton-4zoHiFJ_.cjs +0 -83
  547. package/dist/skeleton-C4bHqUBf.js +0 -84
  548. package/dist/slider-C0JKA9k3.js +0 -56
  549. package/dist/slider-CPmwzm_3.cjs +0 -73
  550. package/dist/slider-DcJharR9.cjs +0 -73
  551. package/dist/slider-Pay3fka2.js +0 -56
  552. package/dist/sonner-DeUIj0Zg.cjs +0 -63
  553. package/dist/sonner-g9RIfi35.js +0 -47
  554. package/dist/tooltip-CNtsL5cB.cjs +0 -71
  555. package/dist/tooltip-CTyZCD8h.js +0 -55
  556. package/dist/tooltip-CwgSdy3h.cjs +0 -67
  557. package/dist/tooltip-D-OrYnKO.js +0 -51
  558. package/dist/use-audio-player-BJFV24XW.js +0 -188
  559. package/dist/use-audio-player-Bkh23vQ3.js +0 -177
  560. package/dist/use-audio-player-Dn1NR9xN.cjs +0 -176
  561. package/dist/use-audio-player-DyVYlOnR.cjs +0 -187
  562. package/dist/use-mobile-BB4M_4Ru.cjs +0 -47
  563. package/dist/use-mobile-CLu9nqGL.js +0 -31
  564. package/dist/use-mobile-CNwiBNxu.js +0 -33
  565. package/dist/use-mobile-Dlf74ufz.cjs +0 -49
  566. package/dist/xertica-assistant-B1IaHXnB.cjs +0 -1894
  567. package/dist/xertica-assistant-BMqdyRVi.js +0 -2082
  568. package/dist/xertica-assistant-Bj3vBCq_.cjs +0 -2081
  569. package/dist/xertica-assistant-CfBCo21g.js +0 -2148
  570. package/dist/xertica-assistant-DIM_Do1k.js +0 -1866
  571. package/dist/xertica-assistant-DPsESB6t.js +0 -1878
  572. package/dist/xertica-assistant-DrsRwla1.cjs +0 -2147
  573. package/dist/xertica-assistant-Qp3ydksa.cjs +0 -1882
  574. package/dist/xertica-assistant-gnCJdcZY.js +0 -1866
  575. package/dist/xertica-assistant-yyrR0JKl.cjs +0 -1882
  576. package/styles/xertica/app-overrides/scrollbar.css +0 -33
  577. package/dist/{XerticaXLogo-qBPhwK3g.cjs → LanguageSelector-1cINLJ23.cjs} +80 -80
@@ -1,2261 +0,0 @@
1
- "use strict";
2
- const jsxRuntime = require("react/jsx-runtime");
3
- const React = require("react");
4
- const RechartsPrimitive = require("recharts");
5
- const button = require("./button-0CXwCRTm.cjs");
6
- const classVarianceAuthority = require("class-variance-authority");
7
- const lucideReact = require("lucide-react");
8
- const card = require("./card-DJTsYhLL.cjs");
9
- const select = require("./select-DT7Zjn42.cjs");
10
- const DialogPrimitive = require("@radix-ui/react-dialog");
11
- const dropdownMenu = require("./dropdown-menu-Ze1YZFyc.cjs");
12
- const input = require("./input-CPl84zAx.cjs");
13
- function _interopNamespaceDefault(e) {
14
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
15
- if (e) {
16
- for (const k in e) {
17
- if (k !== "default") {
18
- const d = Object.getOwnPropertyDescriptor(e, k);
19
- Object.defineProperty(n, k, d.get ? d : {
20
- enumerable: true,
21
- get: () => e[k]
22
- });
23
- }
24
- }
25
- }
26
- n.default = e;
27
- return Object.freeze(n);
28
- }
29
- const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
30
- const RechartsPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(RechartsPrimitive);
31
- const DialogPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(DialogPrimitive);
32
- const alertVariants = classVarianceAuthority.cva(
33
- "relative w-full rounded-[var(--radius)] border-l-4 px-4 py-3 grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-5 [&>svg]:translate-y-0.5 [&>svg]:text-current",
34
- {
35
- variants: {
36
- variant: {
37
- default: "bg-muted/50 border-l-border text-foreground [&>svg]:text-muted-foreground",
38
- success: "bg-[color:var(--success)]/10 dark:bg-[color:var(--success)]/20 border-l-[color:var(--success)] text-foreground [&>svg]:text-[color:var(--success)]",
39
- info: "bg-[color:var(--info)]/10 dark:bg-[color:var(--info)]/20 border-l-[color:var(--info)] text-foreground [&>svg]:text-[color:var(--info)]",
40
- warning: "bg-[color:var(--warning)]/10 dark:bg-[color:var(--warning)]/20 border-l-[color:var(--warning)] text-foreground [&>svg]:text-[color:var(--warning)]",
41
- destructive: "bg-[color:var(--destructive)]/10 dark:bg-[color:var(--destructive)]/20 border-l-[color:var(--destructive)] text-foreground [&>svg]:text-[color:var(--destructive)]"
42
- }
43
- },
44
- defaultVariants: {
45
- variant: "default"
46
- }
47
- }
48
- );
49
- const alertIcons = {
50
- default: lucideReact.Info,
51
- success: lucideReact.CheckCircle,
52
- info: lucideReact.Info,
53
- warning: lucideReact.AlertTriangle,
54
- destructive: lucideReact.XCircle
55
- };
56
- function Alert({
57
- className,
58
- variant,
59
- icon,
60
- children,
61
- ...props
62
- }) {
63
- const alertVariant = variant && variant in alertIcons ? variant : "default";
64
- const DefaultIcon = alertIcons[alertVariant];
65
- return /* @__PURE__ */ jsxRuntime.jsxs(
66
- "div",
67
- {
68
- "data-slot": "alert",
69
- role: "alert",
70
- className: button.cn(alertVariants({ variant }), className),
71
- ...props,
72
- children: [
73
- icon !== void 0 ? icon : /* @__PURE__ */ jsxRuntime.jsx(DefaultIcon, { className: "flex-shrink-0" }),
74
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1", children })
75
- ]
76
- }
77
- );
78
- }
79
- function AlertTitle({ className, ...props }) {
80
- return /* @__PURE__ */ jsxRuntime.jsx(
81
- "div",
82
- {
83
- "data-slot": "alert-title",
84
- className: button.cn(
85
- "font-medium mb-1 leading-tight",
86
- className
87
- ),
88
- ...props
89
- }
90
- );
91
- }
92
- function AlertDescription({
93
- className,
94
- ...props
95
- }) {
96
- return /* @__PURE__ */ jsxRuntime.jsx(
97
- "div",
98
- {
99
- "data-slot": "alert-description",
100
- className: button.cn(
101
- "leading-relaxed",
102
- className
103
- ),
104
- ...props
105
- }
106
- );
107
- }
108
- const Empty = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
109
- "div",
110
- {
111
- ref,
112
- className: button.cn(
113
- "flex min-h-[400px] flex-col items-center justify-center rounded-[var(--radius-card)] border border-dashed border-border p-8 text-center animate-in fade-in-50",
114
- className
115
- ),
116
- ...props
117
- }
118
- ));
119
- Empty.displayName = "Empty";
120
- const EmptyIcon = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
121
- "div",
122
- {
123
- ref,
124
- className: button.cn(
125
- "mx-auto flex h-20 w-20 items-center justify-center rounded-full bg-muted",
126
- className
127
- ),
128
- ...props
129
- }
130
- ));
131
- EmptyIcon.displayName = "EmptyIcon";
132
- const EmptyImage = React__namespace.forwardRef(({ className, alt, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
133
- "img",
134
- {
135
- ref,
136
- alt,
137
- className: button.cn("mx-auto mb-4 h-48 w-48 object-contain opacity-50", className),
138
- ...props
139
- }
140
- ));
141
- EmptyImage.displayName = "EmptyImage";
142
- const EmptyTitle = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
143
- "h3",
144
- {
145
- ref,
146
- className: button.cn("mt-4 font-semibold text-foreground", className),
147
- ...props
148
- }
149
- ));
150
- EmptyTitle.displayName = "EmptyTitle";
151
- const EmptyDescription = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
152
- "p",
153
- {
154
- ref,
155
- className: button.cn("mt-2 text-sm text-muted-foreground max-w-sm mx-auto", className),
156
- ...props
157
- }
158
- ));
159
- EmptyDescription.displayName = "EmptyDescription";
160
- const EmptyAction = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
161
- "div",
162
- {
163
- ref,
164
- className: button.cn("mt-6 flex flex-col gap-2 sm:flex-row sm:gap-4", className),
165
- ...props
166
- }
167
- ));
168
- EmptyAction.displayName = "EmptyAction";
169
- function Skeleton({ className, ...props }) {
170
- return /* @__PURE__ */ jsxRuntime.jsx(
171
- "div",
172
- {
173
- "data-slot": "skeleton",
174
- className: button.cn("bg-accent animate-pulse rounded-md", className),
175
- ...props
176
- }
177
- );
178
- }
179
- const THEMES = { light: "", dark: ".dark" };
180
- const defaultPeriods = [
181
- { value: "7d", label: "7 days" },
182
- { value: "30d", label: "30 days" },
183
- { value: "90d", label: "90 days" }
184
- ];
185
- const defaultChartColors = [
186
- "var(--chart-1)",
187
- "var(--chart-2)",
188
- "var(--chart-3)",
189
- "var(--chart-4)",
190
- "var(--chart-5)"
191
- ];
192
- const chartBarSizes = {
193
- sm: 8,
194
- md: 14,
195
- lg: 22,
196
- xl: 32
197
- };
198
- const ChartContext = React__namespace.createContext(null);
199
- function useChart() {
200
- const context = React__namespace.useContext(ChartContext);
201
- if (!context) {
202
- throw new Error("useChart must be used within a <ChartContainer />");
203
- }
204
- return context;
205
- }
206
- function ChartContainer({
207
- id,
208
- className,
209
- children,
210
- config,
211
- ...props
212
- }) {
213
- const uniqueId = React__namespace.useId();
214
- const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
215
- return /* @__PURE__ */ jsxRuntime.jsx(ChartContext.Provider, { value: { config }, children: /* @__PURE__ */ jsxRuntime.jsxs(
216
- "div",
217
- {
218
- "data-slot": "chart",
219
- "data-chart": chartId,
220
- className: button.cn(
221
- "[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border relative h-[300px] min-h-[200px] w-full min-w-0 overflow-hidden text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden",
222
- className
223
- ),
224
- ...props,
225
- children: [
226
- /* @__PURE__ */ jsxRuntime.jsx(ChartStyle, { id: chartId, config }),
227
- /* @__PURE__ */ jsxRuntime.jsx(RechartsPrimitive__namespace.ResponsiveContainer, { width: "100%", height: "100%", children })
228
- ]
229
- }
230
- ) });
231
- }
232
- const ChartStyle = ({ id, config }) => {
233
- const colorConfig = Object.entries(config).filter(
234
- ([, config2]) => config2.theme || config2.color
235
- );
236
- if (!colorConfig.length) {
237
- return null;
238
- }
239
- return /* @__PURE__ */ jsxRuntime.jsx(
240
- "style",
241
- {
242
- dangerouslySetInnerHTML: {
243
- __html: Object.entries(THEMES).map(
244
- ([theme, prefix]) => `
245
- ${prefix} [data-chart=${id}] {
246
- ${colorConfig.map(([key, itemConfig]) => {
247
- var _a;
248
- const color = ((_a = itemConfig.theme) == null ? void 0 : _a[theme]) || itemConfig.color;
249
- return color ? ` --color-${key}: ${color};` : null;
250
- }).join("\n")}
251
- }
252
- `
253
- ).join("\n")
254
- }
255
- }
256
- );
257
- };
258
- const ChartTooltip = RechartsPrimitive__namespace.Tooltip;
259
- function ChartTooltipContent({
260
- active,
261
- payload,
262
- className,
263
- indicator = "dot",
264
- hideLabel = false,
265
- hideIndicator = false,
266
- label,
267
- labelFormatter,
268
- labelClassName,
269
- formatter,
270
- color,
271
- nameKey,
272
- labelKey
273
- }) {
274
- const { config } = useChart();
275
- const tooltipLabel = React__namespace.useMemo(() => {
276
- var _a;
277
- if (hideLabel || !(payload == null ? void 0 : payload.length)) {
278
- return null;
279
- }
280
- const [item] = payload;
281
- const key = `${labelKey || (item == null ? void 0 : item.dataKey) || (item == null ? void 0 : item.name) || "value"}`;
282
- const itemConfig = getPayloadConfigFromPayload(config, item, key);
283
- const value = !labelKey && typeof label === "string" ? ((_a = config[label]) == null ? void 0 : _a.label) || label : itemConfig == null ? void 0 : itemConfig.label;
284
- if (labelFormatter) {
285
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: button.cn("font-medium", labelClassName), children: labelFormatter(value, payload) });
286
- }
287
- if (!value) {
288
- return null;
289
- }
290
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: button.cn("font-medium", labelClassName), children: value });
291
- }, [
292
- label,
293
- labelFormatter,
294
- payload,
295
- hideLabel,
296
- labelClassName,
297
- config,
298
- labelKey
299
- ]);
300
- if (!active || !(payload == null ? void 0 : payload.length)) {
301
- return null;
302
- }
303
- const nestLabel = payload.length === 1 && indicator !== "dot";
304
- return /* @__PURE__ */ jsxRuntime.jsxs(
305
- "div",
306
- {
307
- className: button.cn(
308
- "border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl",
309
- className
310
- ),
311
- children: [
312
- !nestLabel ? tooltipLabel : null,
313
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid gap-1.5", children: payload.map((item, index) => {
314
- var _a;
315
- const key = `${nameKey || item.name || item.dataKey || "value"}`;
316
- const itemConfig = getPayloadConfigFromPayload(config, item, key);
317
- const indicatorColor = color || ((_a = item.payload) == null ? void 0 : _a.fill) || item.color;
318
- return /* @__PURE__ */ jsxRuntime.jsx(
319
- "div",
320
- {
321
- className: button.cn(
322
- "[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5",
323
- indicator === "dot" && "items-center"
324
- ),
325
- children: formatter && (item == null ? void 0 : item.value) !== void 0 && item.name ? formatter(item.value, item.name, item, index, item.payload) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
326
- (itemConfig == null ? void 0 : itemConfig.icon) ? /* @__PURE__ */ jsxRuntime.jsx(itemConfig.icon, {}) : !hideIndicator && /* @__PURE__ */ jsxRuntime.jsx(
327
- "div",
328
- {
329
- className: button.cn(
330
- "shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",
331
- {
332
- "h-2.5 w-2.5": indicator === "dot",
333
- "w-1": indicator === "line",
334
- "w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
335
- "my-0.5": nestLabel && indicator === "dashed"
336
- }
337
- ),
338
- style: {
339
- "--color-bg": indicatorColor,
340
- "--color-border": indicatorColor
341
- }
342
- }
343
- ),
344
- /* @__PURE__ */ jsxRuntime.jsxs(
345
- "div",
346
- {
347
- className: button.cn(
348
- "flex flex-1 justify-between leading-none",
349
- nestLabel ? "items-end" : "items-center"
350
- ),
351
- children: [
352
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-1.5", children: [
353
- nestLabel ? tooltipLabel : null,
354
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: (itemConfig == null ? void 0 : itemConfig.label) || item.name })
355
- ] }),
356
- item.value && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground font-mono font-medium tabular-nums", children: item.value.toLocaleString() })
357
- ]
358
- }
359
- )
360
- ] })
361
- },
362
- item.dataKey
363
- );
364
- }) })
365
- ]
366
- }
367
- );
368
- }
369
- const ChartLegend = RechartsPrimitive__namespace.Legend;
370
- function ChartLegendContent({
371
- className,
372
- hideIcon = false,
373
- payload,
374
- verticalAlign = "bottom",
375
- nameKey
376
- }) {
377
- const { config } = useChart();
378
- if (!(payload == null ? void 0 : payload.length)) {
379
- return null;
380
- }
381
- return /* @__PURE__ */ jsxRuntime.jsx(
382
- "div",
383
- {
384
- className: button.cn(
385
- "flex items-center justify-center gap-4",
386
- verticalAlign === "top" ? "pb-3" : "pt-3",
387
- className
388
- ),
389
- children: payload.map((item) => {
390
- const key = `${nameKey ? item.value : item.dataKey || item.value || "value"}`;
391
- const itemConfig = getPayloadConfigFromPayload(config, item, key);
392
- return /* @__PURE__ */ jsxRuntime.jsxs(
393
- "div",
394
- {
395
- className: button.cn(
396
- "[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"
397
- ),
398
- children: [
399
- (itemConfig == null ? void 0 : itemConfig.icon) && !hideIcon ? /* @__PURE__ */ jsxRuntime.jsx(itemConfig.icon, {}) : /* @__PURE__ */ jsxRuntime.jsx(
400
- "div",
401
- {
402
- className: "h-2 w-2 shrink-0 rounded-[2px] bg-(--color-bg)",
403
- style: {
404
- "--color-bg": item.color || `var(--color-${key})`
405
- }
406
- }
407
- ),
408
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: (itemConfig == null ? void 0 : itemConfig.label) || item.value })
409
- ]
410
- },
411
- item.value
412
- );
413
- })
414
- }
415
- );
416
- }
417
- function getPayloadConfigFromPayload(config, payload, key) {
418
- if (typeof payload !== "object" || payload === null) {
419
- return void 0;
420
- }
421
- const payloadPayload = "payload" in payload && typeof payload.payload === "object" && payload.payload !== null ? payload.payload : void 0;
422
- let configLabelKey = key;
423
- if (key in payload && typeof payload[key] === "string") {
424
- configLabelKey = payload[key];
425
- } else if (payloadPayload && key in payloadPayload && typeof payloadPayload[key] === "string") {
426
- configLabelKey = payloadPayload[key];
427
- }
428
- return configLabelKey in config ? config[configLabelKey] : config[key];
429
- }
430
- function getChartSeries(config, series) {
431
- if (series == null ? void 0 : series.length) {
432
- return series;
433
- }
434
- return Object.entries(config).map(([key, item]) => ({
435
- key,
436
- label: item.label
437
- }));
438
- }
439
- function getSeriesColor(key, index, colors) {
440
- if (Array.isArray(colors)) {
441
- return colors[index] || defaultChartColors[index % defaultChartColors.length];
442
- }
443
- return (colors == null ? void 0 : colors[key]) || defaultChartColors[index % defaultChartColors.length];
444
- }
445
- function getChartConfigWithColors(config, keys, colors) {
446
- return keys.reduce((nextConfig, key, index) => {
447
- const item = config[key];
448
- if ((item == null ? void 0 : item.theme) && !colors) {
449
- nextConfig[key] = item;
450
- return nextConfig;
451
- }
452
- nextConfig[key] = {
453
- label: (item == null ? void 0 : item.label) || key,
454
- icon: item == null ? void 0 : item.icon,
455
- color: colors ? getSeriesColor(key, index, colors) : (item == null ? void 0 : item.color) || getSeriesColor(key, index)
456
- };
457
- return nextConfig;
458
- }, {});
459
- }
460
- function formatTick(value) {
461
- if (typeof value !== "number") {
462
- return value;
463
- }
464
- return Intl.NumberFormat("en", {
465
- notation: "compact",
466
- maximumFractionDigits: 1
467
- }).format(value);
468
- }
469
- function defaultFilterData(data, period) {
470
- const match = period.match(/^(\d+)/);
471
- if (!match) {
472
- return data;
473
- }
474
- const limit = Number(match[1]);
475
- return data.slice(Math.max(data.length - limit, 0));
476
- }
477
- function getErrorDescription(error) {
478
- if (typeof error === "string") {
479
- return error;
480
- }
481
- if (error instanceof Error) {
482
- return error.message;
483
- }
484
- return void 0;
485
- }
486
- function getBarSize(barSize = "md") {
487
- return typeof barSize === "number" ? barSize : chartBarSizes[barSize];
488
- }
489
- function hasChartData(data, series) {
490
- if (!data.length || !series.length) {
491
- return false;
492
- }
493
- return data.some(
494
- (item) => series.some((serie) => {
495
- const value = item[serie.key];
496
- return value !== null && value !== void 0 && value !== "";
497
- })
498
- );
499
- }
500
- function hasPieData(data, nameKey, valueKey) {
501
- return data.some((item) => {
502
- const name = item[nameKey];
503
- const value = item[valueKey];
504
- return name !== null && name !== void 0 && name !== "" && value !== null && value !== void 0 && value !== "";
505
- });
506
- }
507
- function ChartState({
508
- type,
509
- className,
510
- error,
511
- onRetry,
512
- retryLabel = "Try again",
513
- emptyTitle = "No data available",
514
- emptyDescription = "There is no data available for this chart yet.",
515
- errorTitle = "Connection error",
516
- errorDescription,
517
- loadingLabel = "Loading chart data"
518
- }) {
519
- if (type === "loading") {
520
- return /* @__PURE__ */ jsxRuntime.jsxs(
521
- "div",
522
- {
523
- className: button.cn(
524
- "flex min-h-[240px] flex-col justify-end gap-3 rounded-[var(--radius-card)] border border-border p-6",
525
- className
526
- ),
527
- "aria-label": typeof loadingLabel === "string" ? loadingLabel : void 0,
528
- children: [
529
- /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-8 w-2/5" }),
530
- /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-14 w-3/5" }),
531
- /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-24 w-4/5" }),
532
- /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-36 w-full" })
533
- ]
534
- }
535
- );
536
- }
537
- if (type === "error") {
538
- return /* @__PURE__ */ jsxRuntime.jsx(
539
- "div",
540
- {
541
- className: button.cn(
542
- "flex min-h-[240px] items-center justify-center rounded-[var(--radius-card)] border border-border p-6",
543
- className
544
- ),
545
- children: /* @__PURE__ */ jsxRuntime.jsxs(Alert, { variant: "destructive", className: "max-w-xl", children: [
546
- /* @__PURE__ */ jsxRuntime.jsx(AlertTitle, { children: errorTitle }),
547
- /* @__PURE__ */ jsxRuntime.jsx(AlertDescription, { children: errorDescription || getErrorDescription(error) || "Unable to load chart data. Check your connection and try again." }),
548
- onRetry ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3", children: /* @__PURE__ */ jsxRuntime.jsxs(button.Button, { size: "sm", variant: "outline", onClick: onRetry, children: [
549
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RefreshCw, { className: "size-4" }),
550
- retryLabel
551
- ] }) }) : null
552
- ] })
553
- }
554
- );
555
- }
556
- return /* @__PURE__ */ jsxRuntime.jsxs(Empty, { className: button.cn("min-h-[240px]", className), children: [
557
- /* @__PURE__ */ jsxRuntime.jsx(EmptyIcon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.BarChart3, { className: "size-10 text-muted-foreground" }) }),
558
- /* @__PURE__ */ jsxRuntime.jsx(EmptyTitle, { children: emptyTitle }),
559
- /* @__PURE__ */ jsxRuntime.jsx(EmptyDescription, { children: emptyDescription }),
560
- onRetry ? /* @__PURE__ */ jsxRuntime.jsx(EmptyAction, { children: /* @__PURE__ */ jsxRuntime.jsxs(button.Button, { size: "sm", variant: "outline", onClick: onRetry, children: [
561
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.WifiOff, { className: "size-4" }),
562
- retryLabel
563
- ] }) }) : null
564
- ] });
565
- }
566
- function getChartState(state, hasData, className) {
567
- if (state.isLoading) {
568
- return /* @__PURE__ */ jsxRuntime.jsx(ChartState, { ...state, type: "loading", className });
569
- }
570
- if (state.error) {
571
- return /* @__PURE__ */ jsxRuntime.jsx(ChartState, { ...state, type: "error", className });
572
- }
573
- if (!hasData) {
574
- return /* @__PURE__ */ jsxRuntime.jsx(ChartState, { ...state, type: "empty", className });
575
- }
576
- return null;
577
- }
578
- function ChartCard({
579
- title,
580
- description,
581
- action,
582
- footer,
583
- children,
584
- className,
585
- contentClassName,
586
- ...props
587
- }) {
588
- return /* @__PURE__ */ jsxRuntime.jsxs(card.Card, { className: button.cn("w-full min-w-0 overflow-hidden", className), ...props, children: [
589
- /* @__PURE__ */ jsxRuntime.jsxs(card.CardHeader, { children: [
590
- /* @__PURE__ */ jsxRuntime.jsx(card.CardTitle, { children: title }),
591
- description ? /* @__PURE__ */ jsxRuntime.jsx(card.CardDescription, { children: description }) : null,
592
- action ? /* @__PURE__ */ jsxRuntime.jsx(card.CardAction, { children: action }) : null
593
- ] }),
594
- /* @__PURE__ */ jsxRuntime.jsx(card.CardContent, { className: contentClassName, children }),
595
- footer ? /* @__PURE__ */ jsxRuntime.jsx(card.CardFooter, { children: footer }) : null
596
- ] });
597
- }
598
- function DashboardBarChart({
599
- data,
600
- config,
601
- indexKey = "name",
602
- series,
603
- colors,
604
- barSize = "md",
605
- stacked = false,
606
- showGrid = true,
607
- showLegend = true,
608
- valueFormatter = formatTick,
609
- isLoading,
610
- error,
611
- onRetry,
612
- retryLabel,
613
- emptyTitle,
614
- emptyDescription,
615
- errorTitle,
616
- errorDescription,
617
- loadingLabel,
618
- stateClassName,
619
- className,
620
- ...props
621
- }) {
622
- const chartSeries = getChartSeries(config, series);
623
- const chartConfig = getChartConfigWithColors(
624
- config,
625
- chartSeries.map((item) => item.key),
626
- colors
627
- );
628
- const chartState = getChartState(
629
- {
630
- isLoading,
631
- error,
632
- onRetry,
633
- retryLabel,
634
- emptyTitle,
635
- emptyDescription,
636
- errorTitle,
637
- errorDescription,
638
- loadingLabel
639
- },
640
- hasChartData(data, chartSeries),
641
- button.cn("h-[320px] w-full", stateClassName)
642
- );
643
- if (chartState) {
644
- return chartState;
645
- }
646
- return /* @__PURE__ */ jsxRuntime.jsx(
647
- ChartContainer,
648
- {
649
- config: chartConfig,
650
- className: button.cn("h-[320px] w-full", className),
651
- ...props,
652
- children: /* @__PURE__ */ jsxRuntime.jsxs(RechartsPrimitive__namespace.BarChart, { data, accessibilityLayer: true, children: [
653
- showGrid ? /* @__PURE__ */ jsxRuntime.jsx(RechartsPrimitive__namespace.CartesianGrid, { vertical: false }) : null,
654
- /* @__PURE__ */ jsxRuntime.jsx(
655
- RechartsPrimitive__namespace.XAxis,
656
- {
657
- dataKey: indexKey,
658
- tickLine: false,
659
- axisLine: false,
660
- tickMargin: 8
661
- }
662
- ),
663
- /* @__PURE__ */ jsxRuntime.jsx(
664
- RechartsPrimitive__namespace.YAxis,
665
- {
666
- tickLine: false,
667
- axisLine: false,
668
- tickMargin: 8,
669
- tickFormatter: valueFormatter
670
- }
671
- ),
672
- /* @__PURE__ */ jsxRuntime.jsx(ChartTooltip, { content: /* @__PURE__ */ jsxRuntime.jsx(ChartTooltipContent, {}) }),
673
- showLegend ? /* @__PURE__ */ jsxRuntime.jsx(ChartLegend, { content: /* @__PURE__ */ jsxRuntime.jsx(ChartLegendContent, {}) }) : null,
674
- (() => {
675
- const topOfStack = /* @__PURE__ */ new Set();
676
- if (stacked) {
677
- const lastByStack = /* @__PURE__ */ new Map();
678
- chartSeries.forEach((s) => lastByStack.set(s.stackId || "total", s.key));
679
- lastByStack.forEach((key) => topOfStack.add(key));
680
- }
681
- return chartSeries.map((item) => {
682
- const isTop = !stacked || topOfStack.has(item.key);
683
- return /* @__PURE__ */ jsxRuntime.jsx(
684
- RechartsPrimitive__namespace.Bar,
685
- {
686
- dataKey: item.key,
687
- fill: `var(--color-${item.key})`,
688
- radius: isTop ? [4, 4, 0, 0] : [0, 0, 0, 0],
689
- barSize: getBarSize(barSize),
690
- stackId: stacked ? item.stackId || "total" : item.stackId
691
- },
692
- item.key
693
- );
694
- });
695
- })()
696
- ] })
697
- }
698
- );
699
- }
700
- function DashboardLineChart({
701
- data,
702
- config,
703
- indexKey = "name",
704
- series,
705
- colors,
706
- showDots = false,
707
- showGrid = true,
708
- showLegend = true,
709
- valueFormatter = formatTick,
710
- isLoading,
711
- error,
712
- onRetry,
713
- retryLabel,
714
- emptyTitle,
715
- emptyDescription,
716
- errorTitle,
717
- errorDescription,
718
- loadingLabel,
719
- stateClassName,
720
- className,
721
- ...props
722
- }) {
723
- const chartSeries = getChartSeries(config, series);
724
- const chartConfig = getChartConfigWithColors(
725
- config,
726
- chartSeries.map((item) => item.key),
727
- colors
728
- );
729
- const chartState = getChartState(
730
- {
731
- isLoading,
732
- error,
733
- onRetry,
734
- retryLabel,
735
- emptyTitle,
736
- emptyDescription,
737
- errorTitle,
738
- errorDescription,
739
- loadingLabel
740
- },
741
- hasChartData(data, chartSeries),
742
- button.cn("h-[320px] w-full", stateClassName)
743
- );
744
- if (chartState) {
745
- return chartState;
746
- }
747
- return /* @__PURE__ */ jsxRuntime.jsx(
748
- ChartContainer,
749
- {
750
- config: chartConfig,
751
- className: button.cn("h-[320px] w-full", className),
752
- ...props,
753
- children: /* @__PURE__ */ jsxRuntime.jsxs(RechartsPrimitive__namespace.LineChart, { data, accessibilityLayer: true, children: [
754
- showGrid ? /* @__PURE__ */ jsxRuntime.jsx(RechartsPrimitive__namespace.CartesianGrid, { vertical: false }) : null,
755
- /* @__PURE__ */ jsxRuntime.jsx(
756
- RechartsPrimitive__namespace.XAxis,
757
- {
758
- dataKey: indexKey,
759
- tickLine: false,
760
- axisLine: false,
761
- tickMargin: 8
762
- }
763
- ),
764
- /* @__PURE__ */ jsxRuntime.jsx(
765
- RechartsPrimitive__namespace.YAxis,
766
- {
767
- tickLine: false,
768
- axisLine: false,
769
- tickMargin: 8,
770
- tickFormatter: valueFormatter
771
- }
772
- ),
773
- /* @__PURE__ */ jsxRuntime.jsx(ChartTooltip, { content: /* @__PURE__ */ jsxRuntime.jsx(ChartTooltipContent, { indicator: "line" }) }),
774
- showLegend ? /* @__PURE__ */ jsxRuntime.jsx(ChartLegend, { content: /* @__PURE__ */ jsxRuntime.jsx(ChartLegendContent, {}) }) : null,
775
- chartSeries.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
776
- RechartsPrimitive__namespace.Line,
777
- {
778
- type: "monotone",
779
- dataKey: item.key,
780
- stroke: `var(--color-${item.key})`,
781
- strokeWidth: 2,
782
- dot: showDots ? { r: 3, fill: `var(--color-${item.key})` } : false,
783
- activeDot: { r: 5 },
784
- yAxisId: item.yAxisId
785
- },
786
- item.key
787
- ))
788
- ] })
789
- }
790
- );
791
- }
792
- function HorizontalBarChart({
793
- data,
794
- config,
795
- indexKey = "name",
796
- series,
797
- colors,
798
- barSize = "md",
799
- stacked = false,
800
- categoryWidth = 96,
801
- showGrid = true,
802
- showLegend = true,
803
- valueFormatter = formatTick,
804
- isLoading,
805
- error,
806
- onRetry,
807
- retryLabel,
808
- emptyTitle,
809
- emptyDescription,
810
- errorTitle,
811
- errorDescription,
812
- loadingLabel,
813
- stateClassName,
814
- className,
815
- ...props
816
- }) {
817
- const chartSeries = getChartSeries(config, series);
818
- const chartConfig = getChartConfigWithColors(
819
- config,
820
- chartSeries.map((item) => item.key),
821
- colors
822
- );
823
- const chartState = getChartState(
824
- {
825
- isLoading,
826
- error,
827
- onRetry,
828
- retryLabel,
829
- emptyTitle,
830
- emptyDescription,
831
- errorTitle,
832
- errorDescription,
833
- loadingLabel
834
- },
835
- hasChartData(data, chartSeries),
836
- button.cn("h-[320px] w-full", stateClassName)
837
- );
838
- if (chartState) {
839
- return chartState;
840
- }
841
- return /* @__PURE__ */ jsxRuntime.jsx(
842
- ChartContainer,
843
- {
844
- config: chartConfig,
845
- className: button.cn("h-[320px] w-full", className),
846
- ...props,
847
- children: /* @__PURE__ */ jsxRuntime.jsxs(
848
- RechartsPrimitive__namespace.BarChart,
849
- {
850
- data,
851
- layout: "vertical",
852
- accessibilityLayer: true,
853
- margin: { left: 8, right: 16 },
854
- children: [
855
- showGrid ? /* @__PURE__ */ jsxRuntime.jsx(RechartsPrimitive__namespace.CartesianGrid, { horizontal: false }) : null,
856
- /* @__PURE__ */ jsxRuntime.jsx(
857
- RechartsPrimitive__namespace.XAxis,
858
- {
859
- type: "number",
860
- tickLine: false,
861
- axisLine: false,
862
- tickMargin: 8,
863
- tickFormatter: valueFormatter
864
- }
865
- ),
866
- /* @__PURE__ */ jsxRuntime.jsx(
867
- RechartsPrimitive__namespace.YAxis,
868
- {
869
- dataKey: indexKey,
870
- type: "category",
871
- tickLine: false,
872
- axisLine: false,
873
- tickMargin: 8,
874
- width: categoryWidth
875
- }
876
- ),
877
- /* @__PURE__ */ jsxRuntime.jsx(ChartTooltip, { content: /* @__PURE__ */ jsxRuntime.jsx(ChartTooltipContent, {}) }),
878
- showLegend ? /* @__PURE__ */ jsxRuntime.jsx(ChartLegend, { content: /* @__PURE__ */ jsxRuntime.jsx(ChartLegendContent, {}) }) : null,
879
- chartSeries.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
880
- RechartsPrimitive__namespace.Bar,
881
- {
882
- dataKey: item.key,
883
- fill: `var(--color-${item.key})`,
884
- radius: [0, 4, 4, 0],
885
- barSize: getBarSize(barSize),
886
- stackId: stacked ? item.stackId || "total" : item.stackId
887
- },
888
- item.key
889
- ))
890
- ]
891
- }
892
- )
893
- }
894
- );
895
- }
896
- function InteractiveTimeSeriesChart({
897
- data,
898
- config,
899
- indexKey = "date",
900
- series,
901
- colors,
902
- periods = defaultPeriods,
903
- defaultPeriod = ((_a) => (_a = periods[1]) == null ? void 0 : _a.value)() || ((_b) => (_b = periods[0]) == null ? void 0 : _b.value)() || "30d",
904
- defaultSeries,
905
- filterData = defaultFilterData,
906
- showGrid = true,
907
- showLegend = false,
908
- valueFormatter = formatTick,
909
- isLoading,
910
- error,
911
- onRetry,
912
- retryLabel,
913
- emptyTitle,
914
- emptyDescription,
915
- errorTitle,
916
- errorDescription,
917
- loadingLabel,
918
- stateClassName,
919
- className,
920
- ...props
921
- }) {
922
- var _a2;
923
- const chartSeries = getChartSeries(config, series);
924
- const chartConfig = getChartConfigWithColors(
925
- config,
926
- chartSeries.map((item) => item.key),
927
- colors
928
- );
929
- const [period, setPeriod] = React__namespace.useState(defaultPeriod);
930
- const [activeSeries, setActiveSeries] = React__namespace.useState(
931
- defaultSeries || ((_a2 = chartSeries[0]) == null ? void 0 : _a2.key) || ""
932
- );
933
- const filteredData = React__namespace.useMemo(
934
- () => filterData(data, period),
935
- [data, filterData, period]
936
- );
937
- const visibleSeries = chartSeries.length > 1 ? chartSeries.filter((item) => item.key === activeSeries) : chartSeries;
938
- const chartState = getChartState(
939
- {
940
- isLoading,
941
- error,
942
- onRetry,
943
- retryLabel,
944
- emptyTitle,
945
- emptyDescription,
946
- errorTitle,
947
- errorDescription,
948
- loadingLabel
949
- },
950
- hasChartData(filteredData, visibleSeries),
951
- button.cn("h-[320px] w-full", stateClassName)
952
- );
953
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full space-y-4", children: [
954
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between", children: [
955
- chartSeries.length > 1 ? /* @__PURE__ */ jsxRuntime.jsx(
956
- "div",
957
- {
958
- className: "inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
959
- role: "group",
960
- "aria-label": "Selecionar metrica do grafico",
961
- children: chartSeries.map((item) => {
962
- var _a3;
963
- const label = item.label || ((_a3 = config[item.key]) == null ? void 0 : _a3.label) || item.key;
964
- return /* @__PURE__ */ jsxRuntime.jsx(
965
- button.Button,
966
- {
967
- type: "button",
968
- variant: "ghost",
969
- size: "sm",
970
- "aria-pressed": activeSeries === item.key,
971
- onClick: () => setActiveSeries(item.key),
972
- className: button.cn(
973
- "h-8 px-3 text-sm font-medium",
974
- activeSeries === item.key ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"
975
- ),
976
- children: label
977
- },
978
- item.key
979
- );
980
- })
981
- }
982
- ) : /* @__PURE__ */ jsxRuntime.jsx("div", {}),
983
- /* @__PURE__ */ jsxRuntime.jsxs(select.Select, { value: period, onValueChange: setPeriod, children: [
984
- /* @__PURE__ */ jsxRuntime.jsx(select.SelectTrigger, { className: "w-full sm:w-[160px]", size: "sm", "aria-label": "Selecionar periodo do grafico", children: /* @__PURE__ */ jsxRuntime.jsx(select.SelectValue, { placeholder: "Period" }) }),
985
- /* @__PURE__ */ jsxRuntime.jsx(select.SelectContent, { children: periods.map((item) => /* @__PURE__ */ jsxRuntime.jsx(select.SelectItem, { value: item.value, children: item.label }, item.value)) })
986
- ] })
987
- ] }),
988
- chartState || /* @__PURE__ */ jsxRuntime.jsx(
989
- ChartContainer,
990
- {
991
- config: chartConfig,
992
- className: button.cn("h-[320px] w-full", className),
993
- ...props,
994
- children: /* @__PURE__ */ jsxRuntime.jsxs(RechartsPrimitive__namespace.AreaChart, { data: filteredData, accessibilityLayer: true, children: [
995
- showGrid ? /* @__PURE__ */ jsxRuntime.jsx(RechartsPrimitive__namespace.CartesianGrid, { vertical: false }) : null,
996
- /* @__PURE__ */ jsxRuntime.jsx(
997
- RechartsPrimitive__namespace.XAxis,
998
- {
999
- dataKey: indexKey,
1000
- tickLine: false,
1001
- axisLine: false,
1002
- tickMargin: 8
1003
- }
1004
- ),
1005
- /* @__PURE__ */ jsxRuntime.jsx(
1006
- RechartsPrimitive__namespace.YAxis,
1007
- {
1008
- tickLine: false,
1009
- axisLine: false,
1010
- tickMargin: 8,
1011
- tickFormatter: valueFormatter
1012
- }
1013
- ),
1014
- /* @__PURE__ */ jsxRuntime.jsx(ChartTooltip, { content: /* @__PURE__ */ jsxRuntime.jsx(ChartTooltipContent, { indicator: "line" }) }),
1015
- showLegend ? /* @__PURE__ */ jsxRuntime.jsx(ChartLegend, { content: /* @__PURE__ */ jsxRuntime.jsx(ChartLegendContent, {}) }) : null,
1016
- visibleSeries.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
1017
- RechartsPrimitive__namespace.Area,
1018
- {
1019
- type: "monotone",
1020
- dataKey: item.key,
1021
- stroke: `var(--color-${item.key})`,
1022
- fill: `var(--color-${item.key})`,
1023
- fillOpacity: 0.16,
1024
- strokeWidth: 2,
1025
- dot: false
1026
- },
1027
- item.key
1028
- ))
1029
- ] })
1030
- }
1031
- )
1032
- ] });
1033
- }
1034
- function ComboMetricChart({
1035
- data,
1036
- config,
1037
- indexKey = "name",
1038
- series,
1039
- colors,
1040
- barSize = "md",
1041
- showGrid = true,
1042
- showLegend = true,
1043
- valueFormatter = formatTick,
1044
- isLoading,
1045
- error,
1046
- onRetry,
1047
- retryLabel,
1048
- emptyTitle,
1049
- emptyDescription,
1050
- errorTitle,
1051
- errorDescription,
1052
- loadingLabel,
1053
- stateClassName,
1054
- className,
1055
- ...props
1056
- }) {
1057
- const chartSeries = getChartSeries(config, series);
1058
- const chartConfig = getChartConfigWithColors(
1059
- config,
1060
- chartSeries.map((item) => item.key),
1061
- colors
1062
- );
1063
- const chartState = getChartState(
1064
- {
1065
- isLoading,
1066
- error,
1067
- onRetry,
1068
- retryLabel,
1069
- emptyTitle,
1070
- emptyDescription,
1071
- errorTitle,
1072
- errorDescription,
1073
- loadingLabel
1074
- },
1075
- hasChartData(data, chartSeries),
1076
- button.cn("h-[340px] w-full", stateClassName)
1077
- );
1078
- if (chartState) {
1079
- return chartState;
1080
- }
1081
- return /* @__PURE__ */ jsxRuntime.jsx(
1082
- ChartContainer,
1083
- {
1084
- config: chartConfig,
1085
- className: button.cn("h-[340px] w-full", className),
1086
- ...props,
1087
- children: /* @__PURE__ */ jsxRuntime.jsxs(RechartsPrimitive__namespace.ComposedChart, { data, accessibilityLayer: true, children: [
1088
- showGrid ? /* @__PURE__ */ jsxRuntime.jsx(RechartsPrimitive__namespace.CartesianGrid, { vertical: false }) : null,
1089
- /* @__PURE__ */ jsxRuntime.jsx(
1090
- RechartsPrimitive__namespace.XAxis,
1091
- {
1092
- dataKey: indexKey,
1093
- tickLine: false,
1094
- axisLine: false,
1095
- tickMargin: 8
1096
- }
1097
- ),
1098
- /* @__PURE__ */ jsxRuntime.jsx(
1099
- RechartsPrimitive__namespace.YAxis,
1100
- {
1101
- tickLine: false,
1102
- axisLine: false,
1103
- tickMargin: 8,
1104
- tickFormatter: valueFormatter
1105
- }
1106
- ),
1107
- /* @__PURE__ */ jsxRuntime.jsx(ChartTooltip, { content: /* @__PURE__ */ jsxRuntime.jsx(ChartTooltipContent, {}) }),
1108
- showLegend ? /* @__PURE__ */ jsxRuntime.jsx(ChartLegend, { content: /* @__PURE__ */ jsxRuntime.jsx(ChartLegendContent, {}) }) : null,
1109
- chartSeries.map(
1110
- (item) => item.type === "line" ? /* @__PURE__ */ jsxRuntime.jsx(
1111
- RechartsPrimitive__namespace.Line,
1112
- {
1113
- type: "monotone",
1114
- dataKey: item.key,
1115
- stroke: `var(--color-${item.key})`,
1116
- strokeWidth: 2,
1117
- dot: false,
1118
- yAxisId: item.yAxisId
1119
- },
1120
- item.key
1121
- ) : item.type === "area" ? /* @__PURE__ */ jsxRuntime.jsx(
1122
- RechartsPrimitive__namespace.Area,
1123
- {
1124
- type: "monotone",
1125
- dataKey: item.key,
1126
- stroke: `var(--color-${item.key})`,
1127
- fill: `var(--color-${item.key})`,
1128
- fillOpacity: 0.12,
1129
- strokeWidth: 2,
1130
- dot: false,
1131
- yAxisId: item.yAxisId
1132
- },
1133
- item.key
1134
- ) : /* @__PURE__ */ jsxRuntime.jsx(
1135
- RechartsPrimitive__namespace.Bar,
1136
- {
1137
- dataKey: item.key,
1138
- fill: `var(--color-${item.key})`,
1139
- radius: [4, 4, 0, 0],
1140
- barSize: getBarSize(barSize),
1141
- yAxisId: item.yAxisId
1142
- },
1143
- item.key
1144
- )
1145
- )
1146
- ] })
1147
- }
1148
- );
1149
- }
1150
- function DonutBreakdownChart({
1151
- data,
1152
- config,
1153
- nameKey = "name",
1154
- valueKey = "value",
1155
- colors,
1156
- centerLabel,
1157
- centerValue,
1158
- showLegend = true,
1159
- isLoading,
1160
- error,
1161
- onRetry,
1162
- retryLabel,
1163
- emptyTitle,
1164
- emptyDescription,
1165
- errorTitle,
1166
- errorDescription,
1167
- loadingLabel,
1168
- stateClassName,
1169
- className,
1170
- ...props
1171
- }) {
1172
- const [activeIndex, setActiveIndex] = React__namespace.useState(0);
1173
- const chartKeys = data.map(
1174
- (entry, index) => String(entry[nameKey] || `segment-${index}`)
1175
- );
1176
- const chartConfig = getChartConfigWithColors(config, chartKeys, colors);
1177
- const chartState = getChartState(
1178
- {
1179
- isLoading,
1180
- error,
1181
- onRetry,
1182
- retryLabel,
1183
- emptyTitle,
1184
- emptyDescription,
1185
- errorTitle,
1186
- errorDescription,
1187
- loadingLabel
1188
- },
1189
- hasPieData(data, nameKey, valueKey),
1190
- button.cn("h-[320px] w-full", stateClassName)
1191
- );
1192
- if (chartState) {
1193
- return chartState;
1194
- }
1195
- return /* @__PURE__ */ jsxRuntime.jsx(
1196
- ChartContainer,
1197
- {
1198
- config: chartConfig,
1199
- className: button.cn("h-[320px] w-full", className),
1200
- ...props,
1201
- children: /* @__PURE__ */ jsxRuntime.jsxs(RechartsPrimitive__namespace.PieChart, { accessibilityLayer: true, children: [
1202
- /* @__PURE__ */ jsxRuntime.jsx(
1203
- ChartTooltip,
1204
- {
1205
- cursor: false,
1206
- content: /* @__PURE__ */ jsxRuntime.jsx(ChartTooltipContent, { hideLabel: true, nameKey })
1207
- }
1208
- ),
1209
- showLegend ? /* @__PURE__ */ jsxRuntime.jsx(
1210
- ChartLegend,
1211
- {
1212
- content: /* @__PURE__ */ jsxRuntime.jsx(ChartLegendContent, { nameKey }),
1213
- verticalAlign: "bottom"
1214
- }
1215
- ) : null,
1216
- /* @__PURE__ */ jsxRuntime.jsxs(
1217
- RechartsPrimitive__namespace.Pie,
1218
- {
1219
- data,
1220
- dataKey: valueKey,
1221
- nameKey,
1222
- innerRadius: "58%",
1223
- outerRadius: "82%",
1224
- paddingAngle: 2,
1225
- activeIndex,
1226
- onMouseEnter: (_, index) => setActiveIndex(index),
1227
- children: [
1228
- data.map((entry, index) => {
1229
- const key = String(entry[nameKey] || `segment-${index}`);
1230
- return /* @__PURE__ */ jsxRuntime.jsx(
1231
- RechartsPrimitive__namespace.Cell,
1232
- {
1233
- fill: `var(--color-${key})`,
1234
- opacity: index === activeIndex ? 1 : 0.72
1235
- },
1236
- key
1237
- );
1238
- }),
1239
- centerValue || centerLabel ? /* @__PURE__ */ jsxRuntime.jsx(
1240
- RechartsPrimitive__namespace.Label,
1241
- {
1242
- position: "center",
1243
- content: ({ viewBox }) => {
1244
- if (!viewBox || !("cx" in viewBox) || !("cy" in viewBox)) {
1245
- return null;
1246
- }
1247
- return /* @__PURE__ */ jsxRuntime.jsxs(
1248
- "text",
1249
- {
1250
- x: viewBox.cx,
1251
- y: viewBox.cy,
1252
- textAnchor: "middle",
1253
- dominantBaseline: "middle",
1254
- children: [
1255
- centerValue ? /* @__PURE__ */ jsxRuntime.jsx(
1256
- "tspan",
1257
- {
1258
- x: viewBox.cx,
1259
- y: viewBox.cy,
1260
- className: "fill-foreground text-2xl font-semibold",
1261
- children: centerValue
1262
- }
1263
- ) : null,
1264
- centerLabel ? /* @__PURE__ */ jsxRuntime.jsx(
1265
- "tspan",
1266
- {
1267
- x: viewBox.cx,
1268
- y: Number(viewBox.cy) + 22,
1269
- className: "fill-muted-foreground text-xs",
1270
- children: centerLabel
1271
- }
1272
- ) : null
1273
- ]
1274
- }
1275
- );
1276
- }
1277
- }
1278
- ) : null
1279
- ]
1280
- }
1281
- )
1282
- ] })
1283
- }
1284
- );
1285
- }
1286
- function Table({ className, ...props }) {
1287
- return /* @__PURE__ */ jsxRuntime.jsx(
1288
- "div",
1289
- {
1290
- "data-slot": "table-container",
1291
- className: "relative w-full overflow-x-auto",
1292
- children: /* @__PURE__ */ jsxRuntime.jsx(
1293
- "table",
1294
- {
1295
- "data-slot": "table",
1296
- className: button.cn("w-full caption-bottom text-sm", className),
1297
- ...props
1298
- }
1299
- )
1300
- }
1301
- );
1302
- }
1303
- function TableHeader({ className, ...props }) {
1304
- return /* @__PURE__ */ jsxRuntime.jsx(
1305
- "thead",
1306
- {
1307
- "data-slot": "table-header",
1308
- className: button.cn("[&_tr]:border-b", className),
1309
- ...props
1310
- }
1311
- );
1312
- }
1313
- function TableBody({ className, ...props }) {
1314
- return /* @__PURE__ */ jsxRuntime.jsx(
1315
- "tbody",
1316
- {
1317
- "data-slot": "table-body",
1318
- className: button.cn("[&_tr:last-child]:border-0", className),
1319
- ...props
1320
- }
1321
- );
1322
- }
1323
- function TableFooter({ className, ...props }) {
1324
- return /* @__PURE__ */ jsxRuntime.jsx(
1325
- "tfoot",
1326
- {
1327
- "data-slot": "table-footer",
1328
- className: button.cn(
1329
- "bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",
1330
- className
1331
- ),
1332
- ...props
1333
- }
1334
- );
1335
- }
1336
- function TableRow({ className, ...props }) {
1337
- return /* @__PURE__ */ jsxRuntime.jsx(
1338
- "tr",
1339
- {
1340
- "data-slot": "table-row",
1341
- className: button.cn(
1342
- "hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",
1343
- className
1344
- ),
1345
- ...props
1346
- }
1347
- );
1348
- }
1349
- function TableHead({ className, ...props }) {
1350
- return /* @__PURE__ */ jsxRuntime.jsx(
1351
- "th",
1352
- {
1353
- "data-slot": "table-head",
1354
- className: button.cn(
1355
- "text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
1356
- className
1357
- ),
1358
- ...props
1359
- }
1360
- );
1361
- }
1362
- function TableCell({ className, ...props }) {
1363
- return /* @__PURE__ */ jsxRuntime.jsx(
1364
- "td",
1365
- {
1366
- "data-slot": "table-cell",
1367
- className: button.cn(
1368
- "p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
1369
- className
1370
- ),
1371
- ...props
1372
- }
1373
- );
1374
- }
1375
- function TableCaption({
1376
- className,
1377
- ...props
1378
- }) {
1379
- return /* @__PURE__ */ jsxRuntime.jsx(
1380
- "caption",
1381
- {
1382
- "data-slot": "table-caption",
1383
- className: button.cn("text-muted-foreground mt-4 text-sm", className),
1384
- ...props
1385
- }
1386
- );
1387
- }
1388
- function Dialog({
1389
- ...props
1390
- }) {
1391
- return /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Root, { "data-slot": "dialog", ...props });
1392
- }
1393
- function DialogTrigger({
1394
- ...props
1395
- }) {
1396
- return /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Trigger, { "data-slot": "dialog-trigger", ...props });
1397
- }
1398
- function DialogPortal({
1399
- ...props
1400
- }) {
1401
- return /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Portal, { "data-slot": "dialog-portal", ...props });
1402
- }
1403
- function DialogClose({
1404
- ...props
1405
- }) {
1406
- return /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Close, { "data-slot": "dialog-close", ...props });
1407
- }
1408
- const DialogOverlay = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1409
- DialogPrimitive__namespace.Overlay,
1410
- {
1411
- ref,
1412
- "data-slot": "dialog-overlay",
1413
- className: button.cn(
1414
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/40 backdrop-blur-sm",
1415
- className
1416
- ),
1417
- ...props
1418
- }
1419
- ));
1420
- DialogOverlay.displayName = DialogPrimitive__namespace.Overlay.displayName;
1421
- const dialogVariants = classVarianceAuthority.cva(
1422
- "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 flex flex-col w-full translate-x-[-50%] translate-y-[-50%] border shadow-elevation-sm duration-200 rounded-[var(--radius-card)] overflow-hidden max-h-[calc(100dvh-2rem)]",
1423
- {
1424
- variants: {
1425
- size: {
1426
- sm: "max-w-sm",
1427
- md: "max-w-md",
1428
- lg: "max-w-lg",
1429
- xl: "max-w-xl",
1430
- "2xl": "max-w-2xl",
1431
- "3xl": "max-w-3xl",
1432
- "4xl": "max-w-4xl",
1433
- "5xl": "max-w-5xl",
1434
- full: "max-w-[calc(100vw-2rem)] h-[calc(100dvh-2rem)]"
1435
- }
1436
- },
1437
- defaultVariants: {
1438
- size: "lg"
1439
- }
1440
- }
1441
- );
1442
- const DialogContent = React__namespace.forwardRef(({ className, children, size, showClose = true, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [
1443
- /* @__PURE__ */ jsxRuntime.jsx(DialogOverlay, {}),
1444
- /* @__PURE__ */ jsxRuntime.jsxs(
1445
- DialogPrimitive__namespace.Content,
1446
- {
1447
- ref,
1448
- "data-slot": "dialog-content",
1449
- className: button.cn(dialogVariants({ size }), className),
1450
- ...props,
1451
- children: [
1452
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-4 p-6 overflow-y-auto flex-1 min-h-0", children }),
1453
- showClose && /* @__PURE__ */ jsxRuntime.jsxs(DialogPrimitive__namespace.Close, { className: "absolute top-4 right-4 z-10 rounded-full p-2 opacity-70 transition-all hover:opacity-100 hover:bg-accent focus:ring-2 focus:ring-primary focus:ring-offset-2 focus:outline-none disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", children: [
1454
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, {}),
1455
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Close" })
1456
- ] })
1457
- ]
1458
- }
1459
- )
1460
- ] }));
1461
- DialogContent.displayName = DialogPrimitive__namespace.Content.displayName;
1462
- function DialogHeader({ className, ...props }) {
1463
- return /* @__PURE__ */ jsxRuntime.jsx(
1464
- "div",
1465
- {
1466
- "data-slot": "dialog-header",
1467
- className: button.cn("flex flex-col gap-2 text-left shrink-0", className),
1468
- ...props
1469
- }
1470
- );
1471
- }
1472
- function DialogBody({ className, ...props }) {
1473
- return /* @__PURE__ */ jsxRuntime.jsx(
1474
- "div",
1475
- {
1476
- "data-slot": "dialog-body",
1477
- className: button.cn("flex-1 overflow-y-auto min-h-0 -mx-6 px-6", className),
1478
- ...props
1479
- }
1480
- );
1481
- }
1482
- function DialogFooter({ className, ...props }) {
1483
- return /* @__PURE__ */ jsxRuntime.jsx(
1484
- "div",
1485
- {
1486
- "data-slot": "dialog-footer",
1487
- className: button.cn(
1488
- "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end shrink-0",
1489
- className
1490
- ),
1491
- ...props
1492
- }
1493
- );
1494
- }
1495
- function DialogTitle({
1496
- className,
1497
- ...props
1498
- }) {
1499
- return /* @__PURE__ */ jsxRuntime.jsx(
1500
- DialogPrimitive__namespace.Title,
1501
- {
1502
- "data-slot": "dialog-title",
1503
- className: button.cn("text-foreground font-semibold leading-tight text-[length:var(--text-h4)]", className),
1504
- ...props
1505
- }
1506
- );
1507
- }
1508
- function DialogDescription({
1509
- className,
1510
- ...props
1511
- }) {
1512
- return /* @__PURE__ */ jsxRuntime.jsx(
1513
- DialogPrimitive__namespace.Description,
1514
- {
1515
- "data-slot": "dialog-description",
1516
- className: button.cn("text-muted-foreground", className),
1517
- ...props
1518
- }
1519
- );
1520
- }
1521
- const Textarea = React__namespace.forwardRef(
1522
- ({ className, size = "md", ...props }, ref) => {
1523
- const sizeClasses = {
1524
- sm: "px-2 py-1 text-sm",
1525
- md: "px-3 py-2 text-base",
1526
- lg: "px-4 py-3 text-base"
1527
- };
1528
- return /* @__PURE__ */ jsxRuntime.jsx(
1529
- "textarea",
1530
- {
1531
- "data-slot": "textarea",
1532
- className: button.cn(
1533
- "flex min-h-16 w-full bg-background rounded-[var(--radius)] border border-border transition-colors outline-none resize-none text-foreground",
1534
- "placeholder:text-muted-foreground",
1535
- "focus:ring-2 focus:ring-primary focus:border-transparent",
1536
- "disabled:cursor-not-allowed disabled:opacity-50",
1537
- sizeClasses[size],
1538
- className
1539
- ),
1540
- ref,
1541
- ...props
1542
- }
1543
- );
1544
- }
1545
- );
1546
- Textarea.displayName = "Textarea";
1547
- function RichTextEditor({
1548
- value,
1549
- onChange,
1550
- placeholder,
1551
- className,
1552
- actionButton,
1553
- allowSearch = true,
1554
- allowLinks = true,
1555
- allowUndoRedo = true,
1556
- allowHeadings = true,
1557
- allowFormatting = true,
1558
- allowAlignment = true,
1559
- allowLists = true,
1560
- showWordCount = true,
1561
- showCharacterCount = true,
1562
- disabled = false,
1563
- readOnly = false,
1564
- onFocus,
1565
- onBlur,
1566
- minHeight,
1567
- maxHeight
1568
- }) {
1569
- const isEditable = !disabled && !readOnly;
1570
- const showToolbar = isEditable;
1571
- const editorRef = React.useRef(null);
1572
- const [activeFormats, setActiveFormats] = React.useState({});
1573
- const [isSearchOpen, setIsSearchOpen] = React.useState(false);
1574
- const [searchQuery, setSearchQuery] = React.useState("");
1575
- const [linkUrl, setLinkUrl] = React.useState("https://");
1576
- const [isLinkOpen, setIsLinkOpen] = React.useState(false);
1577
- const searchInputRef = React.useRef(null);
1578
- const linkInputRef = React.useRef(null);
1579
- const savedSelection = React.useRef(null);
1580
- const findParentTag = (node, tagName) => {
1581
- let current = node;
1582
- while (current && current !== editorRef.current) {
1583
- if (current.nodeName === tagName) return current;
1584
- current = current.parentNode;
1585
- }
1586
- return null;
1587
- };
1588
- const updateActiveFormats = () => {
1589
- let formatBlock = "";
1590
- try {
1591
- formatBlock = document.queryCommandValue("formatBlock");
1592
- } catch (e) {
1593
- }
1594
- const selection = window.getSelection();
1595
- const anchorNode = selection == null ? void 0 : selection.anchorNode;
1596
- const focusNode = selection == null ? void 0 : selection.focusNode;
1597
- setActiveFormats({
1598
- bold: document.queryCommandState("bold"),
1599
- italic: document.queryCommandState("italic"),
1600
- underline: document.queryCommandState("underline"),
1601
- justifyLeft: document.queryCommandState("justifyLeft"),
1602
- justifyCenter: document.queryCommandState("justifyCenter"),
1603
- justifyRight: document.queryCommandState("justifyRight"),
1604
- insertUnorderedList: document.queryCommandState("insertUnorderedList"),
1605
- insertOrderedList: document.queryCommandState("insertOrderedList"),
1606
- link: !!(findParentTag(anchorNode || null, "A") || findParentTag(focusNode || null, "A")),
1607
- h1: formatBlock === "h1" || formatBlock === "H1",
1608
- h2: formatBlock === "h2" || formatBlock === "H2",
1609
- h3: formatBlock === "h3" || formatBlock === "H3",
1610
- p: formatBlock === "p" || formatBlock === "P" || formatBlock === "div" || formatBlock === "DIV" || formatBlock === ""
1611
- });
1612
- };
1613
- const getCurrentBlockLabel = () => {
1614
- if (activeFormats.h1) return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1615
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Heading1, { className: "w-4 h-4 mr-1 shrink-0" }),
1616
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: "Título 1" })
1617
- ] });
1618
- if (activeFormats.h2) return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1619
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Heading2, { className: "w-4 h-4 mr-1 shrink-0" }),
1620
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: "Título 2" })
1621
- ] });
1622
- if (activeFormats.h3) return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1623
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Heading3, { className: "w-4 h-4 mr-1 shrink-0" }),
1624
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: "Título 3" })
1625
- ] });
1626
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1627
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Type, { className: "w-4 h-4 mr-1 shrink-0" }),
1628
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: "Parágrafo" })
1629
- ] });
1630
- };
1631
- React.useEffect(() => {
1632
- if (editorRef.current && editorRef.current.innerHTML !== value) {
1633
- editorRef.current.innerHTML = value;
1634
- }
1635
- const handleSelectionChange = () => {
1636
- if (document.activeElement === editorRef.current) {
1637
- updateActiveFormats();
1638
- }
1639
- };
1640
- document.addEventListener("selectionchange", handleSelectionChange);
1641
- return () => document.removeEventListener("selectionchange", handleSelectionChange);
1642
- }, []);
1643
- const execCommand = (command, value2 = "") => {
1644
- var _a;
1645
- document.execCommand(command, false, value2);
1646
- updateActiveFormats();
1647
- (_a = editorRef.current) == null ? void 0 : _a.focus();
1648
- handleInput();
1649
- };
1650
- const handleInput = () => {
1651
- if (editorRef.current) {
1652
- onChange == null ? void 0 : onChange(editorRef.current.innerHTML);
1653
- updateActiveFormats();
1654
- }
1655
- };
1656
- const getWordCount = () => {
1657
- var _a;
1658
- const text = ((_a = editorRef.current) == null ? void 0 : _a.innerText) || "";
1659
- return text.trim() ? text.trim().split(/\s+/).length : 0;
1660
- };
1661
- const getCharacterCount = () => {
1662
- var _a;
1663
- const text = ((_a = editorRef.current) == null ? void 0 : _a.innerText) || "";
1664
- return text.trim() ? text.length : 0;
1665
- };
1666
- const performSearch = (text, backward = false) => {
1667
- var _a, _b;
1668
- if (!text || !editorRef.current) return;
1669
- const editor = editorRef.current;
1670
- const selection = window.getSelection();
1671
- if (!selection) return;
1672
- const walker = document.createTreeWalker(editor, NodeFilter.SHOW_TEXT);
1673
- const segments = [];
1674
- let offset = 0;
1675
- let node;
1676
- while (node = walker.nextNode()) {
1677
- segments.push({ node, start: offset });
1678
- offset += node.length;
1679
- }
1680
- const fullText = segments.reduce((acc, s) => acc + (s.node.textContent ?? ""), "");
1681
- let searchFrom = 0;
1682
- if (selection.rangeCount > 0) {
1683
- const range2 = selection.getRangeAt(0);
1684
- if (editor.contains(range2.startContainer)) {
1685
- const seg = segments.find((s) => s.node === range2.startContainer);
1686
- if (seg) {
1687
- searchFrom = backward ? seg.start + range2.startOffset - 1 : seg.start + range2.endOffset;
1688
- }
1689
- }
1690
- }
1691
- const lowerFull = fullText.toLowerCase();
1692
- const lowerQuery = text.toLowerCase();
1693
- let matchStart = -1;
1694
- if (backward) {
1695
- matchStart = lowerFull.lastIndexOf(lowerQuery, Math.max(0, searchFrom));
1696
- if (matchStart === -1) matchStart = lowerFull.lastIndexOf(lowerQuery);
1697
- } else {
1698
- matchStart = lowerFull.indexOf(lowerQuery, searchFrom);
1699
- if (matchStart === -1) matchStart = lowerFull.indexOf(lowerQuery);
1700
- }
1701
- if (matchStart === -1) return;
1702
- const matchEnd = matchStart + text.length;
1703
- const range = document.createRange();
1704
- let startSet = false;
1705
- let endSet = false;
1706
- for (let i = 0; i < segments.length && !endSet; i++) {
1707
- const seg = segments[i];
1708
- const segEnd = seg.start + seg.node.length;
1709
- if (!startSet && matchStart < segEnd && matchStart >= seg.start) {
1710
- range.setStart(seg.node, matchStart - seg.start);
1711
- startSet = true;
1712
- }
1713
- if (startSet && matchEnd <= segEnd) {
1714
- range.setEnd(seg.node, matchEnd - seg.start);
1715
- endSet = true;
1716
- }
1717
- }
1718
- if (startSet && endSet) {
1719
- selection.removeAllRanges();
1720
- selection.addRange(range);
1721
- (_b = (_a = range.startContainer.parentElement) == null ? void 0 : _a.scrollIntoView) == null ? void 0 : _b.call(_a, { block: "nearest" });
1722
- }
1723
- };
1724
- const handleCreateLink = () => {
1725
- if (savedSelection.current) {
1726
- const selection2 = window.getSelection();
1727
- selection2 == null ? void 0 : selection2.removeAllRanges();
1728
- selection2 == null ? void 0 : selection2.addRange(savedSelection.current);
1729
- }
1730
- const selection = window.getSelection();
1731
- const anchorNode = selection == null ? void 0 : selection.anchorNode;
1732
- const existingLink = findParentTag(anchorNode || null, "A");
1733
- if (existingLink) {
1734
- if (linkUrl) {
1735
- existingLink.setAttribute("href", linkUrl);
1736
- existingLink.setAttribute("target", "_blank");
1737
- existingLink.setAttribute("rel", "noopener noreferrer");
1738
- existingLink.style.color = "hsl(var(--primary))";
1739
- existingLink.style.textDecoration = "underline";
1740
- existingLink.style.cursor = "pointer";
1741
- }
1742
- handleInput();
1743
- setIsLinkOpen(false);
1744
- savedSelection.current = null;
1745
- return;
1746
- }
1747
- if (!selection || selection.rangeCount === 0 || selection.isCollapsed) {
1748
- return;
1749
- }
1750
- if (linkUrl) {
1751
- execCommand("createLink", linkUrl);
1752
- setTimeout(() => {
1753
- var _a;
1754
- const anchor = findParentTag(((_a = window.getSelection()) == null ? void 0 : _a.anchorNode) || null, "A");
1755
- if (anchor) {
1756
- anchor.setAttribute("target", "_blank");
1757
- anchor.setAttribute("rel", "noopener noreferrer");
1758
- anchor.style.color = "hsl(var(--primary))";
1759
- anchor.style.textDecoration = "underline";
1760
- anchor.style.cursor = "pointer";
1761
- }
1762
- handleInput();
1763
- }, 10);
1764
- setIsLinkOpen(false);
1765
- savedSelection.current = null;
1766
- }
1767
- };
1768
- const handleUnlink = () => {
1769
- const selection = window.getSelection();
1770
- const anchorNode = selection == null ? void 0 : selection.anchorNode;
1771
- const existingLink = findParentTag(anchorNode || null, "A");
1772
- if (existingLink) {
1773
- const parent = existingLink.parentNode;
1774
- while (existingLink.firstChild) {
1775
- parent == null ? void 0 : parent.insertBefore(existingLink.firstChild, existingLink);
1776
- }
1777
- parent == null ? void 0 : parent.removeChild(existingLink);
1778
- handleInput();
1779
- } else {
1780
- execCommand("unlink");
1781
- }
1782
- };
1783
- const onLinkPopoverOpenChange = (open) => {
1784
- if (open) {
1785
- const selection = window.getSelection();
1786
- const anchorNode = selection == null ? void 0 : selection.anchorNode;
1787
- const focusNode = selection == null ? void 0 : selection.focusNode;
1788
- const existingLink = findParentTag(anchorNode || null, "A") || findParentTag(focusNode || null, "A");
1789
- if (existingLink) {
1790
- setLinkUrl(existingLink.getAttribute("href") || "https://");
1791
- } else {
1792
- setLinkUrl("https://");
1793
- }
1794
- if (selection && selection.rangeCount > 0 && (!selection.isCollapsed || existingLink)) {
1795
- savedSelection.current = selection.getRangeAt(0).cloneRange();
1796
- } else {
1797
- savedSelection.current = null;
1798
- }
1799
- setTimeout(() => {
1800
- var _a;
1801
- return (_a = linkInputRef.current) == null ? void 0 : _a.focus();
1802
- }, 100);
1803
- }
1804
- setIsLinkOpen(open);
1805
- };
1806
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: button.cn("flex flex-col h-full w-full bg-background sm:border border-border sm:shadow-sm sm:rounded-lg overflow-hidden", disabled && "opacity-50 pointer-events-none", className), children: [
1807
- /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
1808
- [contenteditable]:empty:before {
1809
- content: attr(data-placeholder);
1810
- color: hsl(var(--muted-foreground));
1811
- pointer-events: none;
1812
- display: block;
1813
- }
1814
- .prose-editor ul {
1815
- list-style-type: disc !important;
1816
- padding-left: 1.5rem !important;
1817
- margin-top: 0.5rem !important;
1818
- margin-bottom: 0.5rem !important;
1819
- }
1820
- .prose-editor ol {
1821
- list-style-type: decimal !important;
1822
- padding-left: 1.5rem !important;
1823
- margin-top: 0.5rem !important;
1824
- margin-bottom: 0.5rem !important;
1825
- }
1826
- .prose-editor b, .prose-editor strong {
1827
- font-weight: 600 !important;
1828
- }
1829
- .prose-editor i, .prose-editor em {
1830
- font-style: italic !important;
1831
- }
1832
- .prose-editor u {
1833
- text-decoration: underline !important;
1834
- }
1835
- .prose-editor h1 {
1836
- font-size: 2.25rem !important;
1837
- font-weight: 700 !important;
1838
- margin-bottom: 1.25rem !important;
1839
- line-height: 1.2 !important;
1840
- margin-top: 2rem !important;
1841
- color: hsl(var(--foreground));
1842
- }
1843
- .prose-editor h2 {
1844
- font-size: 1.75rem !important;
1845
- font-weight: 600 !important;
1846
- margin-bottom: 1rem !important;
1847
- margin-top: 1.5rem !important;
1848
- color: hsl(var(--foreground));
1849
- }
1850
- .prose-editor h3 {
1851
- font-size: 1.35rem !important;
1852
- font-weight: 600 !important;
1853
- margin-bottom: 0.75rem !important;
1854
- margin-top: 1.25rem !important;
1855
- color: hsl(var(--foreground));
1856
- }
1857
- .prose-editor p {
1858
- margin-bottom: 1rem !important;
1859
- line-height: 1.6 !important;
1860
- }
1861
- .prose-editor a {
1862
- color: var(--info) !important;
1863
- text-decoration: underline !important;
1864
- cursor: pointer !important;
1865
- }
1866
- .prose-editor h1:first-child, .prose-editor h2:first-child, .prose-editor h3:first-child, .prose-editor p:first-child {
1867
- margin-top: 0 !important;
1868
- }
1869
- .prose-editor {
1870
- outline: none !important;
1871
- }
1872
- ` }),
1873
- showToolbar && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-3 py-2 border-b border-border bg-muted/30 flex items-center gap-1 flex-wrap shrink-0", children: [
1874
- allowUndoRedo && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1875
- /* @__PURE__ */ jsxRuntime.jsx(
1876
- button.Button,
1877
- {
1878
- variant: "ghost",
1879
- size: "icon",
1880
- className: "h-8 w-8 text-muted-foreground",
1881
- onClick: () => execCommand("undo"),
1882
- title: "Desfazer",
1883
- "aria-label": "Desfazer",
1884
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Undo, { className: "w-4 h-4" })
1885
- }
1886
- ),
1887
- /* @__PURE__ */ jsxRuntime.jsx(
1888
- button.Button,
1889
- {
1890
- variant: "ghost",
1891
- size: "icon",
1892
- className: "h-8 w-8 text-muted-foreground",
1893
- onClick: () => execCommand("redo"),
1894
- title: "Refazer",
1895
- "aria-label": "Refazer",
1896
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Redo, { className: "w-4 h-4" })
1897
- }
1898
- ),
1899
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-px h-6 bg-border mx-1 hidden sm:block" })
1900
- ] }),
1901
- allowHeadings && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1902
- /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu.DropdownMenu, { modal: false, children: [
1903
- /* @__PURE__ */ jsxRuntime.jsx(dropdownMenu.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(button.Button, { variant: "ghost", size: "sm", className: "h-8 gap-0 text-muted-foreground w-[120px] justify-start px-2", children: [
1904
- getCurrentBlockLabel(),
1905
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "w-3 h-3 ml-auto opacity-50 shrink-0" })
1906
- ] }) }),
1907
- /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu.DropdownMenuContent, { align: "start", className: "w-[160px]", style: { zIndex: 9999 }, children: [
1908
- /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu.DropdownMenuItem, { onPointerDown: (e) => e.preventDefault(), onClick: () => execCommand("formatBlock", "P"), className: "gap-2", children: [
1909
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Type, { className: "w-4 h-4 text-muted-foreground" }),
1910
- " Parágrafo"
1911
- ] }),
1912
- /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu.DropdownMenuItem, { onPointerDown: (e) => e.preventDefault(), onClick: () => execCommand("formatBlock", "H1"), className: "gap-2", children: [
1913
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Heading1, { className: "w-4 h-4 text-muted-foreground" }),
1914
- " Título 1"
1915
- ] }),
1916
- /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu.DropdownMenuItem, { onPointerDown: (e) => e.preventDefault(), onClick: () => execCommand("formatBlock", "H2"), className: "gap-2", children: [
1917
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Heading2, { className: "w-4 h-4 text-muted-foreground" }),
1918
- " Título 2"
1919
- ] }),
1920
- /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu.DropdownMenuItem, { onPointerDown: (e) => e.preventDefault(), onClick: () => execCommand("formatBlock", "H3"), className: "gap-2", children: [
1921
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Heading3, { className: "w-4 h-4 text-muted-foreground" }),
1922
- " Título 3"
1923
- ] })
1924
- ] })
1925
- ] }),
1926
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-px h-6 bg-border mx-1 hidden sm:block" })
1927
- ] }),
1928
- allowFormatting && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1929
- /* @__PURE__ */ jsxRuntime.jsx(
1930
- button.Button,
1931
- {
1932
- variant: "ghost",
1933
- size: "icon",
1934
- className: button.cn("h-8 w-8 text-muted-foreground", activeFormats.bold && "bg-muted text-foreground"),
1935
- onClick: () => execCommand("bold"),
1936
- title: "Negrito",
1937
- "aria-label": "Negrito",
1938
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Bold, { className: "w-4 h-4" })
1939
- }
1940
- ),
1941
- /* @__PURE__ */ jsxRuntime.jsx(
1942
- button.Button,
1943
- {
1944
- variant: "ghost",
1945
- size: "icon",
1946
- className: button.cn("h-8 w-8 text-muted-foreground", activeFormats.italic && "bg-muted text-foreground"),
1947
- onClick: () => execCommand("italic"),
1948
- title: "Itálico",
1949
- "aria-label": "Itálico",
1950
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Italic, { className: "w-4 h-4" })
1951
- }
1952
- ),
1953
- /* @__PURE__ */ jsxRuntime.jsx(
1954
- button.Button,
1955
- {
1956
- variant: "ghost",
1957
- size: "icon",
1958
- className: button.cn("h-8 w-8 text-muted-foreground", activeFormats.underline && "bg-muted text-foreground"),
1959
- onClick: () => execCommand("underline"),
1960
- title: "Sublinhado",
1961
- "aria-label": "Sublinhado",
1962
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Underline, { className: "w-4 h-4" })
1963
- }
1964
- ),
1965
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-px h-6 bg-border mx-1 hidden sm:block" })
1966
- ] }),
1967
- allowAlignment && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1968
- /* @__PURE__ */ jsxRuntime.jsx(
1969
- button.Button,
1970
- {
1971
- variant: "ghost",
1972
- size: "icon",
1973
- className: button.cn("h-8 w-8 text-muted-foreground", activeFormats.justifyLeft && "bg-muted text-foreground"),
1974
- onClick: () => execCommand("justifyLeft"),
1975
- title: "Alinhar à esquerda",
1976
- "aria-label": "Alinhar à esquerda",
1977
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlignLeft, { className: "w-4 h-4" })
1978
- }
1979
- ),
1980
- /* @__PURE__ */ jsxRuntime.jsx(
1981
- button.Button,
1982
- {
1983
- variant: "ghost",
1984
- size: "icon",
1985
- className: button.cn("h-8 w-8 text-muted-foreground", activeFormats.justifyCenter && "bg-muted text-foreground"),
1986
- onClick: () => execCommand("justifyCenter"),
1987
- title: "Centralizar",
1988
- "aria-label": "Centralizar",
1989
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlignCenter, { className: "w-4 h-4" })
1990
- }
1991
- ),
1992
- /* @__PURE__ */ jsxRuntime.jsx(
1993
- button.Button,
1994
- {
1995
- variant: "ghost",
1996
- size: "icon",
1997
- className: button.cn("h-8 w-8 text-muted-foreground", activeFormats.justifyRight && "bg-muted text-foreground"),
1998
- onClick: () => execCommand("justifyRight"),
1999
- title: "Alinhar à direita",
2000
- "aria-label": "Alinhar à direita",
2001
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlignRight, { className: "w-4 h-4" })
2002
- }
2003
- ),
2004
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-px h-6 bg-border mx-1 hidden sm:block" })
2005
- ] }),
2006
- allowLists && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2007
- /* @__PURE__ */ jsxRuntime.jsx(
2008
- button.Button,
2009
- {
2010
- variant: "ghost",
2011
- size: "icon",
2012
- className: button.cn("h-8 w-8 text-muted-foreground", activeFormats.insertUnorderedList && "bg-muted text-foreground"),
2013
- onClick: () => execCommand("insertUnorderedList"),
2014
- title: "Lista com marcadores",
2015
- "aria-label": "Lista com marcadores",
2016
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.List, { className: "w-4 h-4" })
2017
- }
2018
- ),
2019
- /* @__PURE__ */ jsxRuntime.jsx(
2020
- button.Button,
2021
- {
2022
- variant: "ghost",
2023
- size: "icon",
2024
- className: button.cn("h-8 w-8 text-muted-foreground", activeFormats.insertOrderedList && "bg-muted text-foreground"),
2025
- onClick: () => execCommand("insertOrderedList"),
2026
- title: "Lista numerada",
2027
- "aria-label": "Lista numerada",
2028
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ListOrdered, { className: "w-4 h-4" })
2029
- }
2030
- ),
2031
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-px h-6 bg-border mx-1 hidden sm:block" })
2032
- ] }),
2033
- allowLinks && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2034
- /* @__PURE__ */ jsxRuntime.jsxs(input.Popover, { open: isLinkOpen, onOpenChange: onLinkPopoverOpenChange, modal: false, children: [
2035
- /* @__PURE__ */ jsxRuntime.jsx(input.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
2036
- button.Button,
2037
- {
2038
- variant: "ghost",
2039
- size: "icon",
2040
- className: button.cn("h-8 w-8 text-muted-foreground", (activeFormats.link || isLinkOpen) && "bg-muted text-foreground"),
2041
- title: "Inserir link",
2042
- "aria-label": "Inserir link",
2043
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Link, { className: "w-4 h-4" })
2044
- }
2045
- ) }),
2046
- /* @__PURE__ */ jsxRuntime.jsx(input.PopoverContent, { className: "w-80 p-3", align: "start", style: { zIndex: 9999 }, children: !savedSelection.current && !activeFormats.link ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground py-1", children: "Selecione um texto para criar um link." }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
2047
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs font-medium", children: activeFormats.link ? "Editar Link" : "Inserir Link" }),
2048
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2", children: [
2049
- /* @__PURE__ */ jsxRuntime.jsx(
2050
- input.Input,
2051
- {
2052
- ref: linkInputRef,
2053
- placeholder: "https://...",
2054
- value: linkUrl,
2055
- onChange: (e) => setLinkUrl(e.target.value),
2056
- onKeyDown: (e) => e.key === "Enter" && handleCreateLink(),
2057
- className: "h-8 text-xs"
2058
- }
2059
- ),
2060
- /* @__PURE__ */ jsxRuntime.jsx(button.Button, { size: "sm", className: "h-8", onClick: handleCreateLink, children: "Aplicar" })
2061
- ] })
2062
- ] }) })
2063
- ] }),
2064
- /* @__PURE__ */ jsxRuntime.jsx(
2065
- button.Button,
2066
- {
2067
- variant: "ghost",
2068
- size: "icon",
2069
- className: "h-8 w-8 text-muted-foreground",
2070
- onClick: handleUnlink,
2071
- title: "Remover link",
2072
- "aria-label": "Remover link",
2073
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "w-4 h-4" })
2074
- }
2075
- ),
2076
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-px h-6 bg-border mx-1 hidden sm:block" })
2077
- ] }),
2078
- (allowFormatting || allowHeadings || allowAlignment || allowLists || allowLinks) && /* @__PURE__ */ jsxRuntime.jsx(
2079
- button.Button,
2080
- {
2081
- variant: "ghost",
2082
- size: "icon",
2083
- className: "h-8 w-8 text-muted-foreground",
2084
- onClick: () => execCommand("removeFormat"),
2085
- title: "Limpar formatação",
2086
- "aria-label": "Limpar formatação",
2087
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Type, { className: "w-4 h-4" })
2088
- }
2089
- ),
2090
- allowSearch && /* @__PURE__ */ jsxRuntime.jsx(
2091
- button.Button,
2092
- {
2093
- variant: "ghost",
2094
- size: "icon",
2095
- className: button.cn("h-8 w-8 text-muted-foreground", isSearchOpen && "bg-muted text-foreground"),
2096
- onClick: () => {
2097
- setIsSearchOpen(!isSearchOpen);
2098
- if (!isSearchOpen) setTimeout(() => {
2099
- var _a;
2100
- return (_a = searchInputRef.current) == null ? void 0 : _a.focus();
2101
- }, 100);
2102
- },
2103
- title: "Buscar",
2104
- "aria-label": "Buscar",
2105
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "w-4 h-4" })
2106
- }
2107
- ),
2108
- actionButton && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2109
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1" }),
2110
- actionButton
2111
- ] })
2112
- ] }),
2113
- isSearchOpen && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-3 py-1.5 border-b border-border bg-muted/20 flex items-center gap-2", children: [
2114
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex-1 max-w-sm", children: [
2115
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground" }),
2116
- /* @__PURE__ */ jsxRuntime.jsx(
2117
- input.Input,
2118
- {
2119
- ref: searchInputRef,
2120
- placeholder: "Buscar no texto...",
2121
- value: searchQuery,
2122
- onChange: (e) => setSearchQuery(e.target.value),
2123
- onKeyDown: (e) => {
2124
- if (e.key === "Enter") {
2125
- e.preventDefault();
2126
- performSearch(searchQuery, e.shiftKey);
2127
- }
2128
- if (e.key === "Escape") {
2129
- setIsSearchOpen(false);
2130
- }
2131
- },
2132
- className: "h-8 pl-8 text-xs bg-background"
2133
- }
2134
- )
2135
- ] }),
2136
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
2137
- /* @__PURE__ */ jsxRuntime.jsx(
2138
- button.Button,
2139
- {
2140
- variant: "ghost",
2141
- size: "icon",
2142
- className: "h-7 w-7",
2143
- onMouseDown: (e) => e.preventDefault(),
2144
- onClick: () => performSearch(searchQuery, true),
2145
- title: "Anterior",
2146
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUp, { className: "w-4 h-4" })
2147
- }
2148
- ),
2149
- /* @__PURE__ */ jsxRuntime.jsx(
2150
- button.Button,
2151
- {
2152
- variant: "ghost",
2153
- size: "icon",
2154
- className: "h-7 w-7",
2155
- onMouseDown: (e) => e.preventDefault(),
2156
- onClick: () => performSearch(searchQuery, false),
2157
- title: "Próximo",
2158
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "w-4 h-4" })
2159
- }
2160
- ),
2161
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-px h-4 bg-border mx-1" }),
2162
- /* @__PURE__ */ jsxRuntime.jsx(
2163
- button.Button,
2164
- {
2165
- variant: "ghost",
2166
- size: "icon",
2167
- className: "h-7 w-7 text-muted-foreground hover:text-foreground",
2168
- onClick: () => setIsSearchOpen(false),
2169
- title: "Fechar busca",
2170
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "w-4 h-4" })
2171
- }
2172
- )
2173
- ] }),
2174
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "hidden sm:block text-[10px] text-muted-foreground ml-auto uppercase tracking-wider font-medium", children: "Pressione Enter para buscar" })
2175
- ] }),
2176
- /* @__PURE__ */ jsxRuntime.jsx(
2177
- "div",
2178
- {
2179
- className: "flex-1 overflow-y-auto p-4 sm:p-8 bg-background scrollbar-thin",
2180
- style: { minHeight, maxHeight },
2181
- children: /* @__PURE__ */ jsxRuntime.jsx(
2182
- "div",
2183
- {
2184
- ref: editorRef,
2185
- contentEditable: isEditable,
2186
- onInput: handleInput,
2187
- onSelect: isEditable ? updateActiveFormats : void 0,
2188
- onFocus: () => {
2189
- updateActiveFormats();
2190
- onFocus == null ? void 0 : onFocus();
2191
- },
2192
- onBlur,
2193
- className: "prose-editor min-h-full max-w-none focus:outline-none",
2194
- "data-placeholder": placeholder
2195
- }
2196
- )
2197
- }
2198
- ),
2199
- (showWordCount || showCharacterCount) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-4 py-2 border-t border-border bg-muted/20 flex items-center justify-between", children: [
2200
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-[10px] sm:text-xs text-muted-foreground font-medium uppercase tracking-wider flex items-center gap-2", children: [
2201
- showWordCount && /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
2202
- getWordCount(),
2203
- " ",
2204
- getWordCount() === 1 ? "palavra" : "palavras"
2205
- ] }),
2206
- showWordCount && showCharacterCount && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "•" }),
2207
- showCharacterCount && /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
2208
- getCharacterCount(),
2209
- " ",
2210
- getCharacterCount() === 1 ? "caractere" : "caracteres"
2211
- ] })
2212
- ] }),
2213
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[10px] sm:text-xs text-muted-foreground italic", children: "Auto-save ativo" })
2214
- ] })
2215
- ] });
2216
- }
2217
- exports.Alert = Alert;
2218
- exports.AlertDescription = AlertDescription;
2219
- exports.AlertTitle = AlertTitle;
2220
- exports.ChartCard = ChartCard;
2221
- exports.ChartContainer = ChartContainer;
2222
- exports.ChartLegend = ChartLegend;
2223
- exports.ChartLegendContent = ChartLegendContent;
2224
- exports.ChartStyle = ChartStyle;
2225
- exports.ChartTooltip = ChartTooltip;
2226
- exports.ChartTooltipContent = ChartTooltipContent;
2227
- exports.ComboMetricChart = ComboMetricChart;
2228
- exports.DashboardBarChart = DashboardBarChart;
2229
- exports.DashboardLineChart = DashboardLineChart;
2230
- exports.Dialog = Dialog;
2231
- exports.DialogBody = DialogBody;
2232
- exports.DialogClose = DialogClose;
2233
- exports.DialogContent = DialogContent;
2234
- exports.DialogDescription = DialogDescription;
2235
- exports.DialogFooter = DialogFooter;
2236
- exports.DialogHeader = DialogHeader;
2237
- exports.DialogOverlay = DialogOverlay;
2238
- exports.DialogPortal = DialogPortal;
2239
- exports.DialogTitle = DialogTitle;
2240
- exports.DialogTrigger = DialogTrigger;
2241
- exports.DonutBreakdownChart = DonutBreakdownChart;
2242
- exports.Empty = Empty;
2243
- exports.EmptyAction = EmptyAction;
2244
- exports.EmptyDescription = EmptyDescription;
2245
- exports.EmptyIcon = EmptyIcon;
2246
- exports.EmptyImage = EmptyImage;
2247
- exports.EmptyTitle = EmptyTitle;
2248
- exports.HorizontalBarChart = HorizontalBarChart;
2249
- exports.InteractiveTimeSeriesChart = InteractiveTimeSeriesChart;
2250
- exports.RichTextEditor = RichTextEditor;
2251
- exports.Skeleton = Skeleton;
2252
- exports.Table = Table;
2253
- exports.TableBody = TableBody;
2254
- exports.TableCaption = TableCaption;
2255
- exports.TableCell = TableCell;
2256
- exports.TableFooter = TableFooter;
2257
- exports.TableHead = TableHead;
2258
- exports.TableHeader = TableHeader;
2259
- exports.TableRow = TableRow;
2260
- exports.Textarea = Textarea;
2261
- exports.useChart = useChart;