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