xertica-ui 2.3.0 → 2.4.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 (534) hide show
  1. package/CHANGELOG.md +564 -552
  2. package/README.md +417 -406
  3. package/assets/xertica-logo.svg +37 -37
  4. package/assets/xertica-x-logo.svg +20 -20
  5. package/bin/cli.ts +1244 -1155
  6. package/bin/language-config.ts +358 -361
  7. package/components/assistant/code-block/CodeBlock.tsx +268 -268
  8. package/components/assistant/formatted-document/FormattedDocument.tsx +147 -147
  9. package/components/assistant/modern-chat-input/ModernChatInput.tsx +564 -554
  10. package/components/assistant/xertica-assistant/parts/AssistantCollapsedView.tsx +99 -99
  11. package/components/assistant/xertica-assistant/parts/AssistantConversationList.tsx +104 -106
  12. package/components/assistant/xertica-assistant/parts/AssistantDocumentEditor.tsx +81 -81
  13. package/components/assistant/xertica-assistant/parts/AssistantFeedbackDialog.tsx +88 -78
  14. package/components/assistant/xertica-assistant/parts/AssistantHeader.tsx +75 -75
  15. package/components/assistant/xertica-assistant/parts/AssistantMessageBubble.tsx +564 -560
  16. package/components/assistant/xertica-assistant/parts/AssistantTabBar.tsx +67 -67
  17. package/components/assistant/xertica-assistant/parts/AssistantWelcomeScreen.tsx +103 -103
  18. package/components/assistant/xertica-assistant/use-assistant.ts +615 -615
  19. package/components/assistant/xertica-assistant/xertica-assistant.tsx +611 -613
  20. package/components/blocks/card-patterns/ActivityCard.tsx +100 -100
  21. package/components/blocks/card-patterns/ActivityCardSkeleton.tsx +56 -56
  22. package/components/blocks/card-patterns/FeatureCardSkeleton.tsx +58 -63
  23. package/components/blocks/card-patterns/NotificationCard.tsx +140 -140
  24. package/components/blocks/card-patterns/NotificationCardSkeleton.tsx +81 -81
  25. package/components/blocks/card-patterns/ProfileCard.tsx +112 -114
  26. package/components/blocks/card-patterns/ProfileCardSkeleton.tsx +69 -69
  27. package/components/blocks/card-patterns/ProjectCard.tsx +123 -123
  28. package/components/blocks/card-patterns/ProjectCardSkeleton.tsx +67 -72
  29. package/components/blocks/card-patterns/QuickActionCardSkeleton.tsx +44 -44
  30. package/components/blocks/card-patterns/card-patterns.stories.tsx +594 -594
  31. package/components/blocks/card-patterns/index.ts +29 -29
  32. package/components/brand/language-selector/LanguageSelector.tsx +102 -102
  33. package/components/brand/language-selector/language-selector.stories.tsx +111 -114
  34. package/components/brand/language-selector/language-selector.test.tsx +101 -101
  35. package/components/brand/theme-toggle/ThemeToggle.tsx +74 -70
  36. package/components/brand/xertica-provider/XerticaProvider.tsx +109 -112
  37. package/components/brand/xertica-provider/xertica-provider.mdx +61 -61
  38. package/components/index.ts +86 -90
  39. package/components/layout/sidebar/sidebar.mdx +1 -1
  40. package/components/layout/sidebar/sidebar.tsx +1079 -1073
  41. package/components/media/FloatingMediaWrapper.tsx +371 -371
  42. package/components/media/audio-player/AudioPlayer.tsx +768 -766
  43. package/components/media/video-player/VideoPlayer.tsx +310 -310
  44. package/components/pages/forgot-password-page/ForgotPasswordPage.tsx +1 -1
  45. package/components/pages/home-content/HomeContent.tsx +120 -120
  46. package/components/pages/home-content/home-content.mdx +62 -62
  47. package/components/pages/home-page/HomePage.tsx +78 -74
  48. package/components/pages/home-page/home-page.mdx +53 -53
  49. package/components/pages/login-page/LoginPage.tsx +218 -216
  50. package/components/pages/reset-password-page/ResetPasswordPage.tsx +243 -239
  51. package/components/pages/template-content/TemplateContent.tsx +1354 -1235
  52. package/components/pages/template-content/template-content.mdx +61 -61
  53. package/components/pages/template-page/template-page.mdx +53 -53
  54. package/components/pages/verify-email-page/VerifyEmailPage.tsx +206 -206
  55. package/components/shared/error-boundary.stories.tsx +4 -22
  56. package/components/shared/error-boundary.tsx +1 -5
  57. package/components/shared/error-fallbacks.tsx +4 -8
  58. package/components/ui/accordion/accordion.mdx +8 -8
  59. package/components/ui/alert/alert.mdx +8 -8
  60. package/components/ui/alert-dialog/alert-dialog.mdx +8 -8
  61. package/components/ui/aspect-ratio/aspect-ratio.mdx +8 -8
  62. package/components/ui/assistant-chart/assistant-chart.mdx +8 -8
  63. package/components/ui/avatar/avatar.mdx +8 -8
  64. package/components/ui/badge/badge.mdx +8 -8
  65. package/components/ui/breadcrumb/breadcrumb.mdx +8 -8
  66. package/components/ui/button/button.mdx +8 -8
  67. package/components/ui/calendar/calendar.mdx +8 -8
  68. package/components/ui/card/card.mdx +8 -8
  69. package/components/ui/carousel/carousel.mdx +8 -8
  70. package/components/ui/chart/chart.mdx +8 -8
  71. package/components/ui/checkbox/checkbox.mdx +8 -8
  72. package/components/ui/collapsible/collapsible.mdx +8 -8
  73. package/components/ui/command/command.mdx +8 -8
  74. package/components/ui/context-menu/context-menu.mdx +8 -8
  75. package/components/ui/dialog/dialog.mdx +8 -8
  76. package/components/ui/drawer/drawer.mdx +8 -8
  77. package/components/ui/dropdown-menu/dropdown-menu.mdx +8 -8
  78. package/components/ui/empty/empty.mdx +8 -8
  79. package/components/ui/file-upload/file-upload.mdx +8 -8
  80. package/components/ui/hover-card/hover-card.mdx +8 -8
  81. package/components/ui/input/input.mdx +8 -8
  82. package/components/ui/input-otp/input-otp.mdx +8 -8
  83. package/components/ui/label/label.mdx +8 -8
  84. package/components/ui/map/map.mdx +8 -8
  85. package/components/ui/menubar/menubar.mdx +8 -8
  86. package/components/ui/navigation-menu/navigation-menu.mdx +8 -8
  87. package/components/ui/notification-badge/notification-badge.mdx +8 -8
  88. package/components/ui/pagination/pagination.mdx +8 -8
  89. package/components/ui/popover/popover.mdx +8 -8
  90. package/components/ui/progress/progress.mdx +8 -8
  91. package/components/ui/radio-group/radio-group.mdx +8 -8
  92. package/components/ui/rating/rating.mdx +8 -8
  93. package/components/ui/resizable/resizable.mdx +8 -8
  94. package/components/ui/route-map/route-map.mdx +8 -8
  95. package/components/ui/scroll-area/scroll-area.mdx +8 -8
  96. package/components/ui/search/search.mdx +8 -8
  97. package/components/ui/select/select.mdx +8 -8
  98. package/components/ui/separator/separator.mdx +8 -8
  99. package/components/ui/sheet/sheet.mdx +8 -8
  100. package/components/ui/simple-map/simple-map.mdx +8 -8
  101. package/components/ui/skeleton/skeleton.mdx +8 -8
  102. package/components/ui/slider/slider.mdx +8 -8
  103. package/components/ui/sonner/sonner.mdx +8 -8
  104. package/components/ui/stats-card/index.ts +2 -2
  105. package/components/ui/stats-card/stats-card-skeleton.tsx +60 -62
  106. package/components/ui/stats-card/stats-card.mdx +8 -8
  107. package/components/ui/stats-card/stats-card.stories.tsx +99 -99
  108. package/components/ui/stepper/stepper.mdx +8 -8
  109. package/components/ui/switch/switch.mdx +8 -8
  110. package/components/ui/table/table.mdx +8 -8
  111. package/components/ui/tabs/tabs.mdx +8 -8
  112. package/components/ui/textarea/textarea.mdx +8 -8
  113. package/components/ui/timeline/timeline.mdx +8 -8
  114. package/components/ui/toggle/toggle.mdx +8 -8
  115. package/components/ui/toggle-group/toggle-group.mdx +8 -8
  116. package/components/ui/tooltip/tooltip.mdx +8 -8
  117. package/components/ui/tree-view/tree-view.mdx +8 -8
  118. package/components.json +892 -892
  119. package/contexts/AuthContext.tsx +11 -8
  120. package/contexts/LanguageContext.test.tsx +121 -121
  121. package/contexts/LanguageContext.tsx +250 -251
  122. package/dist/{AssistantChart-DoZCyS5r.cjs → AssistantChart-9w31gdAb.cjs} +4 -4
  123. package/dist/{AssistantChart-CldVCVDe.cjs → AssistantChart-BAudAfne.cjs} +5 -5
  124. package/dist/{AssistantChart-Bdd44uBn.cjs → AssistantChart-BAx9VQvb.cjs} +127 -388
  125. package/dist/{AssistantChart-Cu3m7RBo.js → AssistantChart-BP8upjMk.js} +5 -5
  126. package/dist/{AssistantChart-CFhDdGyU.js → AssistantChart-CVko2A1W.js} +130 -391
  127. package/dist/{AssistantChart-C_hwFRRr.js → AssistantChart-CVzmmhx4.js} +4 -4
  128. package/dist/{AudioPlayer-IAU5q5T1.cjs → AudioPlayer-1ypwE2Wh.cjs} +1 -1
  129. package/dist/{AudioPlayer-CGRUtUdN.js → AudioPlayer-DuKXrCfy.js} +1 -1
  130. package/dist/{LanguageContext-CS14yCpi.js → LanguageContext-BwhwC3G2.js} +2 -2
  131. package/dist/{LanguageContext-B_KFTCzT.cjs → LanguageContext-DvUt5jBg.cjs} +2 -2
  132. package/dist/{ThemeContext-C2EwAPDt.js → ThemeContext-BbBNoFTG.js} +2 -2
  133. package/dist/{ThemeContext-Bmod0Cg2.cjs → ThemeContext-BblcjQup.cjs} +13 -8
  134. package/dist/{ThemeContext-BWq9ACPo.js → ThemeContext-Bo-W2WZH.js} +13 -8
  135. package/dist/{ThemeContext-j5aGtPky.cjs → ThemeContext-CP3a0jxy.cjs} +193 -262
  136. package/dist/{ThemeContext-vTjumZeM.cjs → ThemeContext-Cmr8Ex8H.cjs} +2 -2
  137. package/dist/ThemeContext-CpqYShLq.cjs +324 -0
  138. package/dist/{ThemeContext-CQSo4Iwc.js → ThemeContext-D3LzacmG.js} +8 -1
  139. package/dist/ThemeContext-Du2nE1PL.js +325 -0
  140. package/dist/ThemeContext-GeEBTJ3q.cjs +1621 -0
  141. package/dist/ThemeContext-JyLK9B1o.js +1622 -0
  142. package/dist/{ThemeContext-CGk3KK0k.cjs → ThemeContext-U4dEYc6C.cjs} +8 -1
  143. package/dist/{ThemeContext-BXjrgUjW.js → ThemeContext-ept8jhXI.js} +200 -261
  144. package/dist/{VerifyEmailPage-C0c2e5n0.js → VerifyEmailPage-BE-L9mB7.js} +7 -7
  145. package/dist/{VerifyEmailPage-DSBMRHtl.js → VerifyEmailPage-BIBOKV7Z.js} +41 -36
  146. package/dist/{VerifyEmailPage-DgIid028.js → VerifyEmailPage-BJjAMUTW.js} +4 -4
  147. package/dist/{VerifyEmailPage--1Vurewl.cjs → VerifyEmailPage-BRSP-Pwt.cjs} +3 -3
  148. package/dist/{VerifyEmailPage-Cwi3kbol.cjs → VerifyEmailPage-Bae2cBXT.cjs} +7 -7
  149. package/dist/{VerifyEmailPage-De6bQjrz.cjs → VerifyEmailPage-BiRm7Nh4.cjs} +41 -36
  150. package/dist/{VerifyEmailPage-ByerOcm4.cjs → VerifyEmailPage-Bv8Ah_TK.cjs} +23 -20
  151. package/dist/VerifyEmailPage-Bvfv8HVQ.js +3214 -0
  152. package/dist/{VerifyEmailPage-BComraR7.cjs → VerifyEmailPage-CR7kb5df.cjs} +22 -12
  153. package/dist/{VerifyEmailPage-MTD7AG1Z.js → VerifyEmailPage-C_ihbcth.js} +4 -4
  154. package/dist/{VerifyEmailPage-1WwWczAn.js → VerifyEmailPage-CbgjOF0v.js} +22 -12
  155. package/dist/{VerifyEmailPage-DvMLZgFt.js → VerifyEmailPage-CdYPSJoO.js} +1 -1
  156. package/dist/{VerifyEmailPage-By3Jf__L.cjs → VerifyEmailPage-CkBYfsNy.cjs} +4 -4
  157. package/dist/{VerifyEmailPage-CJLz3jrn.js → VerifyEmailPage-Cyl55sJb.js} +23 -20
  158. package/dist/VerifyEmailPage-D-FRj5TU.cjs +3213 -0
  159. package/dist/VerifyEmailPage-DF2ilhum.cjs +3210 -0
  160. package/dist/{VerifyEmailPage-CYXtbKi3.cjs → VerifyEmailPage-DMBh4NM9.cjs} +1 -1
  161. package/dist/{VerifyEmailPage-CgMxRb4z.js → VerifyEmailPage-DTtFfC-J.js} +3 -3
  162. package/dist/{VerifyEmailPage-CFLMls1p.cjs → VerifyEmailPage-Dt7zgA4w.cjs} +4 -4
  163. package/dist/VerifyEmailPage-EhudUdqF.js +3211 -0
  164. package/dist/{VerifyEmailPage-C5TNQTBa.js → VerifyEmailPage-X14vhdyl.js} +148 -75
  165. package/dist/VerifyEmailPage-hdB8JQGv.cjs +3213 -0
  166. package/dist/{VerifyEmailPage-B4peJjAT.cjs → VerifyEmailPage-u_Dn7t1U.cjs} +148 -75
  167. package/dist/VerifyEmailPage-vYHbYK3q.js +3214 -0
  168. package/dist/{XerticaProvider-CBGc4EMA.cjs → XerticaProvider-AChwphCO.cjs} +4 -4
  169. package/dist/{XerticaProvider-BIrqfZ-i.cjs → XerticaProvider-AbWlr7Af.cjs} +8 -11
  170. package/dist/{XerticaProvider-D-yNhF94.cjs → XerticaProvider-B8CaV7xu.cjs} +1 -1
  171. package/dist/{XerticaProvider-DDuiIcKo.js → XerticaProvider-BErr83Bg.js} +14 -11
  172. package/dist/{XerticaProvider-CEoWMTxu.js → XerticaProvider-BITjgC5p.js} +2 -2
  173. package/dist/{XerticaProvider-CllrbMEJ.cjs → XerticaProvider-By8q3Roe.cjs} +2 -2
  174. package/dist/{XerticaProvider-C1DKnvLh.js → XerticaProvider-CUYJZc32.js} +4 -4
  175. package/dist/{XerticaProvider-ET0ihewn.cjs → XerticaProvider-CW9hpCdF.cjs} +2 -2
  176. package/dist/{XerticaProvider-Dt5HEzbQ.js → XerticaProvider-CWgby5mY.js} +10 -10
  177. package/dist/XerticaProvider-CWs6EwNa.js +49 -0
  178. package/dist/XerticaProvider-CjQAQPcn.cjs +48 -0
  179. package/dist/XerticaProvider-CwOkHxiT.cjs +44 -0
  180. package/dist/XerticaProvider-D5lLumH-.js +49 -0
  181. package/dist/{XerticaProvider-DYq4JWtg.js → XerticaProvider-DQtvJU7m.js} +1 -1
  182. package/dist/XerticaProvider-qQUDop71.cjs +48 -0
  183. package/dist/{XerticaProvider-B7EVH-NF.js → XerticaProvider-siSt9uG2.js} +2 -2
  184. package/dist/{XerticaXLogo-Zw2B276b.cjs → XerticaXLogo-8TTzBjHw.cjs} +1 -1
  185. package/dist/{XerticaXLogo-B7xQ5dhi.js → XerticaXLogo-BWaag64t.js} +1 -1
  186. package/dist/{XerticaXLogo-DZbo4vOE.js → XerticaXLogo-BX3ueACh.js} +5 -2
  187. package/dist/XerticaXLogo-CFuIlYFH.js +252 -0
  188. package/dist/XerticaXLogo-CU-U-GP4.cjs +251 -0
  189. package/dist/XerticaXLogo-ChryA6xj.js +252 -0
  190. package/dist/{XerticaXLogo-CQUUjXoH.cjs → XerticaXLogo-CziKMQil.cjs} +8 -8
  191. package/dist/XerticaXLogo-DHz5SugF.js +252 -0
  192. package/dist/XerticaXLogo-DTee_y8X.cjs +251 -0
  193. package/dist/{XerticaXLogo-Cmsp-Eey.js → XerticaXLogo-DfUvz-lD.js} +9 -9
  194. package/dist/XerticaXLogo-kslQ8Tk_.cjs +251 -0
  195. package/dist/{XerticaXLogo-bvZSgwGF.cjs → XerticaXLogo-qBPhwK3g.cjs} +5 -2
  196. package/dist/{alert-dialog-s-vmNkJ_.js → alert-dialog-iDe5VE5o.js} +3 -3
  197. package/dist/{alert-dialog-DSKByiKZ.cjs → alert-dialog-yckpaOpy.cjs} +3 -3
  198. package/dist/assistant.cjs.js +1 -1
  199. package/dist/assistant.es.js +1 -1
  200. package/dist/brand.cjs.js +2 -2
  201. package/dist/brand.es.js +2 -2
  202. package/dist/cli.js +90 -37
  203. package/dist/components/brand/theme-toggle/ThemeToggle.d.ts +1 -1
  204. package/dist/components/index.d.ts +1 -1
  205. package/dist/{google-maps-loader-Y-QkD-Li.cjs → google-maps-loader-BqsYL48U.cjs} +0 -5
  206. package/dist/{google-maps-loader-CTYySAun.js → google-maps-loader-t2IlYBzw.js} +0 -4
  207. package/dist/index-CkTUgOwX.js +8 -0
  208. package/dist/{index-COtD8bRW.cjs → index-D3RLKRAs.cjs} +1 -1
  209. package/dist/index.cjs.js +5 -5
  210. package/dist/index.es.js +5 -5
  211. package/dist/index.umd.js +454 -1027
  212. package/dist/layout.cjs.js +1 -1
  213. package/dist/layout.es.js +1 -1
  214. package/dist/pages.cjs.js +1 -1
  215. package/dist/pages.es.js +1 -1
  216. package/dist/{sidebar-DAaY8bRU.cjs → sidebar-B3EYhli0.cjs} +33 -24
  217. package/dist/{sidebar-B6SlKZYN.js → sidebar-B4ZWaMrE.js} +1 -1
  218. package/dist/{sidebar-DQj1z3jG.cjs → sidebar-B9NR0lCe.cjs} +269 -227
  219. package/dist/{sidebar-nzPoVHBQ.cjs → sidebar-BS1p2V7t.cjs} +1 -1
  220. package/dist/sidebar-BvF5I2Ue.cjs +800 -0
  221. package/dist/{sidebar-q7P2Godd.cjs → sidebar-C5B_LHek.cjs} +1 -1
  222. package/dist/{sidebar-CrQDDdcz.js → sidebar-CA6_ek3f.js} +33 -24
  223. package/dist/{sidebar-BxGXsDAd.cjs → sidebar-CVUGHOS_.cjs} +8 -16
  224. package/dist/{sidebar-BViy8Eeu.js → sidebar-CmvwjnVb.js} +9 -17
  225. package/dist/sidebar-CplprZpM.js +801 -0
  226. package/dist/{sidebar-BbVIQvlP.js → sidebar-Dz7bd3zP.js} +1 -1
  227. package/dist/sidebar-KIS0C2JH.js +801 -0
  228. package/dist/sidebar-OTO_up7Z.js +801 -0
  229. package/dist/sidebar-zowjejT2.cjs +800 -0
  230. package/dist/{use-audio-player-nv8ZSGa1.js → use-audio-player-Bkh23vQ3.js} +3 -7
  231. package/dist/{use-audio-player-NKsWyjWu.cjs → use-audio-player-Dn1NR9xN.cjs} +3 -7
  232. package/dist/{xertica-assistant-dyP7KHM5.cjs → xertica-assistant-B1IaHXnB.cjs} +388 -529
  233. package/dist/{xertica-assistant-DCsnQyi5.js → xertica-assistant-B1NaSFFj.js} +46 -29
  234. package/dist/{xertica-assistant-ciJaWqm1.js → xertica-assistant-BMqdyRVi.js} +10 -28
  235. package/dist/{xertica-assistant-V_IdW4WF.cjs → xertica-assistant-Bj3vBCq_.cjs} +9 -27
  236. package/dist/{xertica-assistant-CrgTb6Hs.cjs → xertica-assistant-CIaUlbIt.cjs} +47 -22
  237. package/dist/{xertica-assistant-yX1CFBBo.js → xertica-assistant-DPsESB6t.js} +390 -531
  238. package/dist/{CodeBlock-BgfYL_rD.cjs → xertica-assistant-Qp3ydksa.cjs} +51 -263
  239. package/dist/{CodeBlock-BeSt1h5P.js → xertica-assistant-gnCJdcZY.js} +7 -219
  240. package/dist/xertica-ui.css +2 -2
  241. package/docs/architecture-improvements.md +456 -456
  242. package/docs/architecture.md +312 -306
  243. package/docs/components/assistant.md +428 -428
  244. package/docs/components/branding.md +252 -252
  245. package/docs/components/card-patterns.md +447 -445
  246. package/docs/components/error-boundary.md +32 -22
  247. package/docs/components/hooks.md +432 -430
  248. package/docs/components/language-selector.md +176 -172
  249. package/docs/components/pages.md +20 -6
  250. package/docs/doc-audit.md +244 -243
  251. package/docs/getting-started.md +616 -603
  252. package/docs/guidelines.md +330 -328
  253. package/docs/i18n.md +480 -476
  254. package/docs/installation.md +7 -6
  255. package/docs/llms.md +295 -295
  256. package/docs/state-management.md +289 -289
  257. package/guidelines/Guidelines.md +409 -406
  258. package/llms-compact.txt +1 -1
  259. package/llms.txt +1 -1
  260. package/package.json +219 -219
  261. package/styles/xertica/base.css +6 -0
  262. package/templates/.prettierignore +4 -4
  263. package/templates/.prettierrc +10 -10
  264. package/templates/CLAUDE.md +180 -165
  265. package/templates/guidelines/Guidelines.md +577 -553
  266. package/templates/package.json +69 -69
  267. package/templates/src/app/App.tsx +46 -46
  268. package/templates/src/app/components/AuthGuard.tsx +57 -8
  269. package/templates/src/features/assistant/data/mock.ts +75 -75
  270. package/templates/src/features/assistant/hooks/useAssistantConfig.ts +20 -20
  271. package/templates/src/features/assistant/index.ts +5 -5
  272. package/templates/src/features/auth/ui/AuthPageShell.tsx +1 -1
  273. package/templates/src/features/auth/ui/ForgotPasswordContent.tsx +70 -72
  274. package/templates/src/features/auth/ui/LoginContent.tsx +92 -92
  275. package/templates/src/features/auth/ui/ResetPasswordContent.tsx +183 -179
  276. package/templates/src/features/auth/ui/SocialLoginButtons.tsx +78 -78
  277. package/templates/src/features/auth/ui/VerifyEmailContent.tsx +80 -84
  278. package/templates/src/features/home/data/mock.ts +6 -0
  279. package/templates/src/features/home/hooks/useFeatureCards.ts +20 -20
  280. package/templates/src/features/home/index.ts +11 -11
  281. package/templates/src/features/home/ui/HomeContent.tsx +117 -119
  282. package/templates/src/features/template/ui/CrudTemplate.tsx +112 -115
  283. package/templates/src/features/template/ui/DashboardTemplate.tsx +110 -110
  284. package/templates/src/features/template/ui/FormTemplate.tsx +117 -117
  285. package/templates/src/features/template/ui/LoginTemplate.tsx +59 -59
  286. package/templates/src/features/template/ui/TemplateContent.tsx +1322 -1314
  287. package/templates/src/i18n.ts +124 -124
  288. package/templates/src/locales/en/common.json +21 -21
  289. package/templates/src/locales/en/components/activityCard.json +10 -10
  290. package/templates/src/locales/en/components/assistant.json +119 -119
  291. package/templates/src/locales/en/components/media.json +29 -29
  292. package/templates/src/locales/en/components/notificationCard.json +5 -5
  293. package/templates/src/locales/en/components/profileCard.json +8 -8
  294. package/templates/src/locales/en/components/projectCard.json +10 -10
  295. package/templates/src/locales/en/components/sidebar.json +14 -14
  296. package/templates/src/locales/en/components/stats.json +8 -8
  297. package/templates/src/locales/en/components/team.json +14 -14
  298. package/templates/src/locales/en/errors.json +9 -9
  299. package/templates/src/locales/en/languageSelector.json +7 -7
  300. package/templates/src/locales/en/nav.json +6 -6
  301. package/templates/src/locales/en/pages/crudTemplate.json +25 -25
  302. package/templates/src/locales/en/pages/dashboardTemplate.json +20 -20
  303. package/templates/src/locales/en/pages/forgotPassword.json +10 -10
  304. package/templates/src/locales/en/pages/formTemplate.json +16 -16
  305. package/templates/src/locales/en/pages/home.json +7 -7
  306. package/templates/src/locales/en/pages/login.json +15 -15
  307. package/templates/src/locales/en/pages/loginTemplate.json +9 -9
  308. package/templates/src/locales/en/pages/resetPassword.json +18 -18
  309. package/templates/src/locales/en/pages/templates.json +317 -317
  310. package/templates/src/locales/en/pages/verifyEmail.json +12 -12
  311. package/templates/src/locales/en/themeToggle.json +6 -6
  312. package/templates/src/locales/es/common.json +21 -21
  313. package/templates/src/locales/es/components/activityCard.json +10 -10
  314. package/templates/src/locales/es/components/assistant.json +119 -119
  315. package/templates/src/locales/es/components/media.json +29 -29
  316. package/templates/src/locales/es/components/notificationCard.json +5 -5
  317. package/templates/src/locales/es/components/profileCard.json +8 -8
  318. package/templates/src/locales/es/components/projectCard.json +10 -10
  319. package/templates/src/locales/es/components/sidebar.json +14 -14
  320. package/templates/src/locales/es/components/stats.json +8 -8
  321. package/templates/src/locales/es/components/team.json +14 -14
  322. package/templates/src/locales/es/errors.json +9 -9
  323. package/templates/src/locales/es/languageSelector.json +7 -7
  324. package/templates/src/locales/es/nav.json +6 -6
  325. package/templates/src/locales/es/pages/crudTemplate.json +25 -25
  326. package/templates/src/locales/es/pages/dashboardTemplate.json +20 -20
  327. package/templates/src/locales/es/pages/forgotPassword.json +10 -10
  328. package/templates/src/locales/es/pages/formTemplate.json +16 -16
  329. package/templates/src/locales/es/pages/home.json +7 -7
  330. package/templates/src/locales/es/pages/login.json +15 -15
  331. package/templates/src/locales/es/pages/loginTemplate.json +9 -9
  332. package/templates/src/locales/es/pages/resetPassword.json +18 -18
  333. package/templates/src/locales/es/pages/templates.json +317 -317
  334. package/templates/src/locales/es/pages/verifyEmail.json +12 -12
  335. package/templates/src/locales/es/themeToggle.json +6 -6
  336. package/templates/src/locales/pt-BR/common.json +21 -21
  337. package/templates/src/locales/pt-BR/components/activityCard.json +10 -10
  338. package/templates/src/locales/pt-BR/components/assistant.json +119 -119
  339. package/templates/src/locales/pt-BR/components/media.json +29 -29
  340. package/templates/src/locales/pt-BR/components/notificationCard.json +5 -5
  341. package/templates/src/locales/pt-BR/components/profileCard.json +8 -8
  342. package/templates/src/locales/pt-BR/components/projectCard.json +10 -10
  343. package/templates/src/locales/pt-BR/components/sidebar.json +14 -14
  344. package/templates/src/locales/pt-BR/components/stats.json +8 -8
  345. package/templates/src/locales/pt-BR/components/team.json +14 -14
  346. package/templates/src/locales/pt-BR/errors.json +9 -9
  347. package/templates/src/locales/pt-BR/languageSelector.json +7 -7
  348. package/templates/src/locales/pt-BR/nav.json +6 -6
  349. package/templates/src/locales/pt-BR/pages/crudTemplate.json +25 -25
  350. package/templates/src/locales/pt-BR/pages/dashboardTemplate.json +20 -20
  351. package/templates/src/locales/pt-BR/pages/forgotPassword.json +10 -10
  352. package/templates/src/locales/pt-BR/pages/formTemplate.json +16 -16
  353. package/templates/src/locales/pt-BR/pages/home.json +7 -7
  354. package/templates/src/locales/pt-BR/pages/login.json +15 -15
  355. package/templates/src/locales/pt-BR/pages/loginTemplate.json +9 -9
  356. package/templates/src/locales/pt-BR/pages/resetPassword.json +18 -18
  357. package/templates/src/locales/pt-BR/pages/templates.json +317 -317
  358. package/templates/src/locales/pt-BR/pages/verifyEmail.json +12 -12
  359. package/templates/src/locales/pt-BR/themeToggle.json +6 -6
  360. package/templates/src/pages/AssistantPage.tsx +470 -464
  361. package/templates/src/pages/HomePage.tsx +53 -49
  362. package/templates/src/shared/error-boundary.tsx +1 -5
  363. package/templates/src/shared/error-fallbacks.tsx +4 -8
  364. package/templates/vite.config.js +20 -20
  365. package/templates/vite.config.ts +55 -52
  366. package/dist/AssistantChart-CxGjH7Qk.js +0 -3477
  367. package/dist/AssistantChart-DIpshm3i.js +0 -4784
  368. package/dist/AssistantChart-D_PTeu8P.cjs +0 -3503
  369. package/dist/AssistantChart-zjsy2GaZ.cjs +0 -4810
  370. package/dist/AudioPlayer-B1lt5cPl.cjs +0 -989
  371. package/dist/AudioPlayer-BZ7bibzU.cjs +0 -982
  372. package/dist/AudioPlayer-BpRPS4-1.cjs +0 -1277
  373. package/dist/AudioPlayer-C12BjQBV.cjs +0 -997
  374. package/dist/AudioPlayer-CFeV8t-5.cjs +0 -936
  375. package/dist/AudioPlayer-Coly3q5R.js +0 -1278
  376. package/dist/AudioPlayer-CySJIyvL.js +0 -937
  377. package/dist/AudioPlayer-DMcG_c7L.js +0 -990
  378. package/dist/AudioPlayer-DcFKRJE_.js +0 -998
  379. package/dist/AudioPlayer-e8LfNoqO.js +0 -983
  380. package/dist/BrandColorsContext-565dDHd5.js +0 -660
  381. package/dist/BrandColorsContext-BcJbtkqn.cjs +0 -659
  382. package/dist/CodeBlock-7TTgmdGG.cjs +0 -2094
  383. package/dist/CodeBlock-BlcqlA9M.cjs +0 -2094
  384. package/dist/CodeBlock-Bnmeu5ez.cjs +0 -2094
  385. package/dist/CodeBlock-BtfPlbAI.js +0 -2078
  386. package/dist/CodeBlock-CIySIuYr.js +0 -2078
  387. package/dist/CodeBlock-CuPtUM-7.cjs +0 -2094
  388. package/dist/CodeBlock-D6ffWXgc.js +0 -2078
  389. package/dist/CodeBlock-D8dcwbit.cjs +0 -2094
  390. package/dist/CodeBlock-DMZrFnlw.cjs +0 -2094
  391. package/dist/CodeBlock-DlBehYN8.js +0 -2078
  392. package/dist/CodeBlock-DnYNI8rQ.js +0 -2078
  393. package/dist/CodeBlock-DvKWbSnE.cjs +0 -2094
  394. package/dist/CodeBlock-DwMCfkFY.js +0 -2078
  395. package/dist/CodeBlock-Dy6CNYyj.js +0 -2078
  396. package/dist/CodeBlock-U1pPOQI7.cjs +0 -2094
  397. package/dist/CodeBlock-f_GpNhEB.js +0 -2078
  398. package/dist/CodeBlock-oB6u8nI1.js +0 -2078
  399. package/dist/CodeBlock-tZC31B73.cjs +0 -2094
  400. package/dist/FeatureCard-CxC-7C-C.cjs +0 -300
  401. package/dist/FeatureCard-DbHWCb4E.js +0 -301
  402. package/dist/ImageWithFallback-CGtidP6B.cjs +0 -4542
  403. package/dist/ImageWithFallback-lsg3pdFg.js +0 -4508
  404. package/dist/LanguageSelector-B5YfbHra.js +0 -231
  405. package/dist/LanguageSelector-D6uacAIM.cjs +0 -230
  406. package/dist/LayoutContext-B45-e9DI.cjs +0 -93
  407. package/dist/LayoutContext-BAql6ZRY.js +0 -97
  408. package/dist/LayoutContext-Bav3UMEA.js +0 -94
  409. package/dist/LayoutContext-BvK-ggDa.cjs +0 -96
  410. package/dist/ThemeContext-BoH4NLfN.js +0 -734
  411. package/dist/ThemeContext-r69W20Xg.cjs +0 -733
  412. package/dist/VerifyEmailPage-COiyNl1y.js +0 -2825
  413. package/dist/VerifyEmailPage-CqKsR2v8.js +0 -2827
  414. package/dist/VerifyEmailPage-DjQKRlUS.cjs +0 -2824
  415. package/dist/VerifyEmailPage-s-1X3LDJ.cjs +0 -2826
  416. package/dist/XerticaOrbe-KL1RBHzw.cjs +0 -1354
  417. package/dist/XerticaOrbe-zwS1p2a8.js +0 -1355
  418. package/dist/XerticaProvider-6btlAlzc.js +0 -17
  419. package/dist/XerticaProvider-BNoNOxQ5.cjs +0 -16
  420. package/dist/XerticaProvider-BlY2limY.cjs +0 -38
  421. package/dist/XerticaProvider-cI9hSs27.cjs +0 -38
  422. package/dist/XerticaProvider-hSwhNQex.js +0 -39
  423. package/dist/alert-dialog-BOje--vD.js +0 -847
  424. package/dist/alert-dialog-BtEuQqrg.cjs +0 -870
  425. package/dist/breadcrumb-CqJ7bHY5.js +0 -161
  426. package/dist/breadcrumb-m9Hb2_XN.cjs +0 -177
  427. package/dist/components/assistant/xertica-assistant/hooks/index.d.ts +0 -6
  428. package/dist/components/assistant/xertica-assistant/hooks/use-assistant-conversations.d.ts +0 -21
  429. package/dist/components/assistant/xertica-assistant/hooks/use-assistant-messages.d.ts +0 -49
  430. package/dist/components/assistant/xertica-assistant/hooks/use-assistant-suggestions.d.ts +0 -16
  431. package/dist/components/blocks/audio-player/AudioPlayer.d.ts +0 -35
  432. package/dist/components/blocks/audio-player/index.d.ts +0 -1
  433. package/dist/components/blocks/document-editor/DocumentEditor.d.ts +0 -26
  434. package/dist/components/blocks/document-editor/index.d.ts +0 -1
  435. package/dist/components/blocks/podcast-player/PodcastPlayer.d.ts +0 -41
  436. package/dist/components/blocks/podcast-player/index.d.ts +0 -1
  437. package/dist/components/ui/chart/parts/chart-dashboard.d.ts +0 -113
  438. package/dist/components/ui/chart/parts/chart-metric.d.ts +0 -118
  439. package/dist/components/ui/chart/parts/chart-primitives.d.ts +0 -101
  440. package/dist/components/ui/chart/parts/chart-shared.d.ts +0 -20
  441. package/dist/components/ui/chart/parts/chart-utils.d.ts +0 -12
  442. package/dist/components/ui/chart/parts/index.d.ts +0 -5
  443. package/dist/dropdown-menu-BDB5CmQs.cjs +0 -247
  444. package/dist/dropdown-menu-DQidbKBD.js +0 -231
  445. package/dist/google-maps-loader-BFWp6VPd.js +0 -287
  446. package/dist/google-maps-loader-BKcdgFbu.cjs +0 -312
  447. package/dist/google-maps-loader-CumCNXeG.js +0 -312
  448. package/dist/google-maps-loader-eS3uQ5TA.cjs +0 -287
  449. package/dist/header-Cgy6vYPk.cjs +0 -731
  450. package/dist/header-DRlT4jgI.js +0 -715
  451. package/dist/header-Dux00SI4.cjs +0 -731
  452. package/dist/header-EkGKXPsD.js +0 -715
  453. package/dist/header-WfEywpyc.cjs +0 -731
  454. package/dist/header-tifNQn2U.js +0 -715
  455. package/dist/index-BhapVLVj.js +0 -8
  456. package/dist/index-D6fxYEY8.cjs +0 -7
  457. package/dist/index-DAIp0_HK.js +0 -8
  458. package/dist/index-DW5tYe26.js +0 -8
  459. package/dist/index-GA__GvnG.cjs +0 -7
  460. package/dist/input-2R4loU86.js +0 -127
  461. package/dist/input-DWANSKGb.cjs +0 -145
  462. package/dist/progress-DPtzoVV8.js +0 -175
  463. package/dist/progress-EeaoqqUs.cjs +0 -191
  464. package/dist/rich-text-editor-0mraWT5y.cjs +0 -2376
  465. package/dist/rich-text-editor-B-IkcPD0.js +0 -2874
  466. package/dist/rich-text-editor-B6jMRLzk.cjs +0 -1939
  467. package/dist/rich-text-editor-B8_oYcIR.js +0 -1730
  468. package/dist/rich-text-editor-B9UbSXNb.js +0 -1203
  469. package/dist/rich-text-editor-BYuRBNBU.js +0 -2373
  470. package/dist/rich-text-editor-Bb9pySTs.cjs +0 -2374
  471. package/dist/rich-text-editor-BcL6L3cm.cjs +0 -2374
  472. package/dist/rich-text-editor-BoVZYtTs.cjs +0 -2391
  473. package/dist/rich-text-editor-Bp3zQqMC.js +0 -2954
  474. package/dist/rich-text-editor-CMgSN_w2.js +0 -1189
  475. package/dist/rich-text-editor-CPV1lEPH.cjs +0 -1748
  476. package/dist/rich-text-editor-CeucBdIv.cjs +0 -2971
  477. package/dist/rich-text-editor-CoKqbCtu.cjs +0 -1799
  478. package/dist/rich-text-editor-Cw56T_mB.js +0 -2356
  479. package/dist/rich-text-editor-Cyt8qs2b.js +0 -1921
  480. package/dist/rich-text-editor-D6H84OcX.cjs +0 -1220
  481. package/dist/rich-text-editor-D76gD-QI.js +0 -2328
  482. package/dist/rich-text-editor-DKkokOnA.js +0 -1781
  483. package/dist/rich-text-editor-DNsdpN64.cjs +0 -2359
  484. package/dist/rich-text-editor-DfG8bCyY.js +0 -2358
  485. package/dist/rich-text-editor-Dxjw31Z4.js +0 -2341
  486. package/dist/rich-text-editor-DzP0Epmb.js +0 -2356
  487. package/dist/rich-text-editor-bRkNoeZY.cjs +0 -2891
  488. package/dist/rich-text-editor-lyYE2ZG5.cjs +0 -1207
  489. package/dist/rich-text-editor-skplNlBM.cjs +0 -2345
  490. package/dist/select-Bkbr0f-Z.cjs +0 -162
  491. package/dist/select-CvIVdX2n.js +0 -145
  492. package/dist/sidebar-CK_0ZQHj.cjs +0 -803
  493. package/dist/sidebar-CUuOvYhK.js +0 -787
  494. package/dist/sidebar-Djn5syhi.cjs +0 -786
  495. package/dist/sidebar-LluMXfam.js +0 -759
  496. package/dist/sidebar-_rT7rBMk.js +0 -787
  497. package/dist/slider-Bc5Hd0y1.js +0 -56
  498. package/dist/slider-N7hFFj6X.cjs +0 -73
  499. package/dist/tooltip-Ded96neP.cjs +0 -137
  500. package/dist/tooltip-HDOoD2-0.js +0 -120
  501. package/dist/use-audio-player-B31J-aqh.cjs +0 -187
  502. package/dist/use-audio-player-BkmEmj8Q.js +0 -185
  503. package/dist/use-audio-player-CLFTWFW1.cjs +0 -184
  504. package/dist/use-audio-player-CLLn00I6.js +0 -188
  505. package/dist/use-file-upload-BcjEo2S5.js +0 -404
  506. package/dist/use-file-upload-CRJR68Tj.cjs +0 -403
  507. package/dist/use-mobile-B0hNy_Y6.cjs +0 -4303
  508. package/dist/use-mobile-BXuYROXM.js +0 -4202
  509. package/dist/use-mobile-Bbd51ASU.cjs +0 -4392
  510. package/dist/use-mobile-Bk6CX-TC.js +0 -4359
  511. package/dist/use-mobile-BvYdisLP.js +0 -4202
  512. package/dist/use-mobile-BzuxjzNX.cjs +0 -4392
  513. package/dist/use-mobile-CG2-SdXV.cjs +0 -4235
  514. package/dist/use-mobile-CKb5pqTs.js +0 -4269
  515. package/dist/use-mobile-CYuAuGDl.js +0 -4202
  516. package/dist/use-mobile-CaENcqm-.js +0 -4508
  517. package/dist/use-mobile-CbrYgJGJ.js +0 -4203
  518. package/dist/use-mobile-Cd4xPrKq.cjs +0 -46
  519. package/dist/use-mobile-DMOvImGQ.cjs +0 -4542
  520. package/dist/use-mobile-DRB3BQgD.cjs +0 -4235
  521. package/dist/use-mobile-DZvv7QMR.js +0 -4359
  522. package/dist/use-mobile-DdI_TXam.cjs +0 -4235
  523. package/dist/use-mobile-DlceKf8a.js +0 -4359
  524. package/dist/use-mobile-DsOnow1o.cjs +0 -4236
  525. package/dist/use-mobile-Kcj6jSnK.cjs +0 -4392
  526. package/dist/use-mobile-bnKcua_i.js +0 -4202
  527. package/dist/use-mobile-j4w2Jrf1.js +0 -30
  528. package/dist/use-mobile-ncXBeE2z.cjs +0 -4235
  529. package/dist/use-rich-text-editor-DjiddBGv.js +0 -282
  530. package/dist/use-rich-text-editor-lpeswbCs.cjs +0 -281
  531. package/dist/xertica-assistant-BdiZag0h.js +0 -2187
  532. package/dist/xertica-assistant-DUBpmEgo.cjs +0 -2186
  533. package/dist/{rich-text-editor-DgF8s7xW.js → rich-text-editor-BmsjY03B.js} +26 -26
  534. package/dist/{rich-text-editor-mWoaSCE4.cjs → rich-text-editor-GS2kpTAK.cjs} +26 -26
@@ -1,1939 +0,0 @@
1
- "use strict";
2
- const jsxRuntime = require("react/jsx-runtime");
3
- const React = require("react");
4
- const RechartsPrimitive = require("recharts");
5
- const tooltip = require("./tooltip-Ded96neP.cjs");
6
- const select = require("./select-Bkbr0f-Z.cjs");
7
- const TabsPrimitive = require("@radix-ui/react-tabs");
8
- const DialogPrimitive = require("@radix-ui/react-dialog");
9
- const lucideReact = require("lucide-react");
10
- const classVarianceAuthority = require("class-variance-authority");
11
- const dropdownMenu = require("./dropdown-menu-BDB5CmQs.cjs");
12
- const input = require("./input-DWANSKGb.cjs");
13
- function _interopNamespaceDefault(e) {
14
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
15
- if (e) {
16
- for (const k in e) {
17
- if (k !== "default") {
18
- const d = Object.getOwnPropertyDescriptor(e, k);
19
- Object.defineProperty(n, k, d.get ? d : {
20
- enumerable: true,
21
- get: () => e[k]
22
- });
23
- }
24
- }
25
- }
26
- n.default = e;
27
- return Object.freeze(n);
28
- }
29
- const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
30
- const RechartsPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(RechartsPrimitive);
31
- const TabsPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(TabsPrimitive);
32
- const DialogPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(DialogPrimitive);
33
- function Card({ className, ...props }) {
34
- return /* @__PURE__ */ jsxRuntime.jsx(
35
- "div",
36
- {
37
- "data-slot": "card",
38
- className: tooltip.cn(
39
- "bg-card text-card-foreground flex flex-col gap-6 rounded-[var(--radius-card)]",
40
- className
41
- ),
42
- ...props
43
- }
44
- );
45
- }
46
- function CardHeader({ className, ...props }) {
47
- return /* @__PURE__ */ jsxRuntime.jsx(
48
- "div",
49
- {
50
- "data-slot": "card-header",
51
- className: tooltip.cn(
52
- "@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 pt-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
53
- className
54
- ),
55
- ...props
56
- }
57
- );
58
- }
59
- function CardTitle({ className, ...props }) {
60
- return /* @__PURE__ */ jsxRuntime.jsx(
61
- "h4",
62
- {
63
- "data-slot": "card-title",
64
- className: tooltip.cn("leading-none", className),
65
- ...props
66
- }
67
- );
68
- }
69
- function CardDescription({ className, ...props }) {
70
- return /* @__PURE__ */ jsxRuntime.jsx(
71
- "p",
72
- {
73
- "data-slot": "card-description",
74
- className: tooltip.cn("text-muted-foreground", className),
75
- ...props
76
- }
77
- );
78
- }
79
- function CardAction({ className, ...props }) {
80
- return /* @__PURE__ */ jsxRuntime.jsx(
81
- "div",
82
- {
83
- "data-slot": "card-action",
84
- className: tooltip.cn(
85
- "col-start-2 row-span-2 row-start-1 self-start justify-self-end",
86
- className
87
- ),
88
- ...props
89
- }
90
- );
91
- }
92
- function CardContent({ className, ...props }) {
93
- return /* @__PURE__ */ jsxRuntime.jsx(
94
- "div",
95
- {
96
- "data-slot": "card-content",
97
- className: tooltip.cn("px-6 [&:last-child]:pb-6", className),
98
- ...props
99
- }
100
- );
101
- }
102
- function CardFooter({ className, ...props }) {
103
- return /* @__PURE__ */ jsxRuntime.jsx(
104
- "div",
105
- {
106
- "data-slot": "card-footer",
107
- className: tooltip.cn("flex items-center px-6 pb-6 [.border-t]:pt-6", className),
108
- ...props
109
- }
110
- );
111
- }
112
- function Tabs({
113
- className,
114
- ...props
115
- }) {
116
- return /* @__PURE__ */ jsxRuntime.jsx(
117
- TabsPrimitive__namespace.Root,
118
- {
119
- "data-slot": "tabs",
120
- className: tooltip.cn("flex flex-col gap-2", className),
121
- ...props
122
- }
123
- );
124
- }
125
- function TabsList({
126
- className,
127
- ...props
128
- }) {
129
- return /* @__PURE__ */ jsxRuntime.jsx(
130
- TabsPrimitive__namespace.List,
131
- {
132
- "data-slot": "tabs-list",
133
- className: tooltip.cn(
134
- "relative inline-flex h-12 w-fit items-end justify-start border-b border-border bg-transparent",
135
- className
136
- ),
137
- ...props
138
- }
139
- );
140
- }
141
- function TabsTrigger({
142
- className,
143
- ...props
144
- }) {
145
- return /* @__PURE__ */ jsxRuntime.jsx(
146
- TabsPrimitive__namespace.Trigger,
147
- {
148
- "data-slot": "tabs-trigger",
149
- className: tooltip.cn(
150
- "relative inline-flex h-12 items-center justify-center gap-1.5 bg-transparent px-4 py-3 text-sm font-medium whitespace-nowrap transition-all duration-200 ease-in-out border-b-2 border-transparent text-muted-foreground hover:text-foreground hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 data-[state=active]:text-primary data-[state=active]:border-primary data-[state=active]:bg-transparent [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
151
- className
152
- ),
153
- ...props
154
- }
155
- );
156
- }
157
- function TabsContent({
158
- className,
159
- ...props
160
- }) {
161
- return /* @__PURE__ */ jsxRuntime.jsx(
162
- TabsPrimitive__namespace.Content,
163
- {
164
- "data-slot": "tabs-content",
165
- className: tooltip.cn("flex-1 outline-none", className),
166
- ...props
167
- }
168
- );
169
- }
170
- const THEMES = { light: "", dark: ".dark" };
171
- const defaultPeriods = [
172
- { value: "7d", label: "7 days" },
173
- { value: "30d", label: "30 days" },
174
- { value: "90d", label: "90 days" }
175
- ];
176
- const defaultChartColors = [
177
- "var(--chart-1)",
178
- "var(--chart-2)",
179
- "var(--chart-3)",
180
- "var(--chart-4)",
181
- "var(--chart-5)"
182
- ];
183
- const ChartContext = React__namespace.createContext(null);
184
- function useChart() {
185
- const context = React__namespace.useContext(ChartContext);
186
- if (!context) {
187
- throw new Error("useChart must be used within a <ChartContainer />");
188
- }
189
- return context;
190
- }
191
- function ChartContainer({
192
- id,
193
- className,
194
- children,
195
- config,
196
- ...props
197
- }) {
198
- const uniqueId = React__namespace.useId();
199
- const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
200
- return /* @__PURE__ */ jsxRuntime.jsx(ChartContext.Provider, { value: { config }, children: /* @__PURE__ */ jsxRuntime.jsxs(
201
- "div",
202
- {
203
- "data-slot": "chart",
204
- "data-chart": chartId,
205
- className: tooltip.cn(
206
- "[&_.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 flex justify-center text-xs overflow-hidden [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden h-[300px] w-full",
207
- className
208
- ),
209
- ...props,
210
- children: [
211
- /* @__PURE__ */ jsxRuntime.jsx(ChartStyle, { id: chartId, config }),
212
- /* @__PURE__ */ jsxRuntime.jsx(RechartsPrimitive__namespace.ResponsiveContainer, { width: "100%", height: "100%", children })
213
- ]
214
- }
215
- ) });
216
- }
217
- const ChartStyle = ({ id, config }) => {
218
- const colorConfig = Object.entries(config).filter(
219
- ([, config2]) => config2.theme || config2.color
220
- );
221
- if (!colorConfig.length) {
222
- return null;
223
- }
224
- return /* @__PURE__ */ jsxRuntime.jsx(
225
- "style",
226
- {
227
- dangerouslySetInnerHTML: {
228
- __html: Object.entries(THEMES).map(
229
- ([theme, prefix]) => `
230
- ${prefix} [data-chart=${id}] {
231
- ${colorConfig.map(([key, itemConfig]) => {
232
- var _a;
233
- const color = ((_a = itemConfig.theme) == null ? void 0 : _a[theme]) || itemConfig.color;
234
- return color ? ` --color-${key}: ${color};` : null;
235
- }).join("\n")}
236
- }
237
- `
238
- ).join("\n")
239
- }
240
- }
241
- );
242
- };
243
- const ChartTooltip = RechartsPrimitive__namespace.Tooltip;
244
- function ChartTooltipContent({
245
- active,
246
- payload,
247
- className,
248
- indicator = "dot",
249
- hideLabel = false,
250
- hideIndicator = false,
251
- label,
252
- labelFormatter,
253
- labelClassName,
254
- formatter,
255
- color,
256
- nameKey,
257
- labelKey
258
- }) {
259
- const { config } = useChart();
260
- const tooltipLabel = React__namespace.useMemo(() => {
261
- var _a;
262
- if (hideLabel || !(payload == null ? void 0 : payload.length)) {
263
- return null;
264
- }
265
- const [item] = payload;
266
- const key = `${labelKey || (item == null ? void 0 : item.dataKey) || (item == null ? void 0 : item.name) || "value"}`;
267
- const itemConfig = getPayloadConfigFromPayload(config, item, key);
268
- const value = !labelKey && typeof label === "string" ? ((_a = config[label]) == null ? void 0 : _a.label) || label : itemConfig == null ? void 0 : itemConfig.label;
269
- if (labelFormatter) {
270
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: tooltip.cn("font-medium", labelClassName), children: labelFormatter(value, payload) });
271
- }
272
- if (!value) {
273
- return null;
274
- }
275
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: tooltip.cn("font-medium", labelClassName), children: value });
276
- }, [
277
- label,
278
- labelFormatter,
279
- payload,
280
- hideLabel,
281
- labelClassName,
282
- config,
283
- labelKey
284
- ]);
285
- if (!active || !(payload == null ? void 0 : payload.length)) {
286
- return null;
287
- }
288
- const nestLabel = payload.length === 1 && indicator !== "dot";
289
- return /* @__PURE__ */ jsxRuntime.jsxs(
290
- "div",
291
- {
292
- className: tooltip.cn(
293
- "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",
294
- className
295
- ),
296
- children: [
297
- !nestLabel ? tooltipLabel : null,
298
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid gap-1.5", children: payload.map((item, index) => {
299
- var _a;
300
- const key = `${nameKey || item.name || item.dataKey || "value"}`;
301
- const itemConfig = getPayloadConfigFromPayload(config, item, key);
302
- const indicatorColor = color || ((_a = item.payload) == null ? void 0 : _a.fill) || item.color;
303
- return /* @__PURE__ */ jsxRuntime.jsx(
304
- "div",
305
- {
306
- className: tooltip.cn(
307
- "[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5",
308
- indicator === "dot" && "items-center"
309
- ),
310
- children: formatter && (item == null ? void 0 : item.value) !== void 0 && item.name ? formatter(item.value, item.name, item, index, item.payload) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
311
- (itemConfig == null ? void 0 : itemConfig.icon) ? /* @__PURE__ */ jsxRuntime.jsx(itemConfig.icon, {}) : !hideIndicator && /* @__PURE__ */ jsxRuntime.jsx(
312
- "div",
313
- {
314
- className: tooltip.cn(
315
- "shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",
316
- {
317
- "h-2.5 w-2.5": indicator === "dot",
318
- "w-1": indicator === "line",
319
- "w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
320
- "my-0.5": nestLabel && indicator === "dashed"
321
- }
322
- ),
323
- style: {
324
- "--color-bg": indicatorColor,
325
- "--color-border": indicatorColor
326
- }
327
- }
328
- ),
329
- /* @__PURE__ */ jsxRuntime.jsxs(
330
- "div",
331
- {
332
- className: tooltip.cn(
333
- "flex flex-1 justify-between leading-none",
334
- nestLabel ? "items-end" : "items-center"
335
- ),
336
- children: [
337
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-1.5", children: [
338
- nestLabel ? tooltipLabel : null,
339
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: (itemConfig == null ? void 0 : itemConfig.label) || item.name })
340
- ] }),
341
- item.value && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground font-mono font-medium tabular-nums", children: item.value.toLocaleString() })
342
- ]
343
- }
344
- )
345
- ] })
346
- },
347
- item.dataKey
348
- );
349
- }) })
350
- ]
351
- }
352
- );
353
- }
354
- const ChartLegend = RechartsPrimitive__namespace.Legend;
355
- function ChartLegendContent({
356
- className,
357
- hideIcon = false,
358
- payload,
359
- verticalAlign = "bottom",
360
- nameKey
361
- }) {
362
- const { config } = useChart();
363
- if (!(payload == null ? void 0 : payload.length)) {
364
- return null;
365
- }
366
- return /* @__PURE__ */ jsxRuntime.jsx(
367
- "div",
368
- {
369
- className: tooltip.cn(
370
- "flex items-center justify-center gap-4",
371
- verticalAlign === "top" ? "pb-3" : "pt-3",
372
- className
373
- ),
374
- children: payload.map((item) => {
375
- const key = `${nameKey ? item.value : item.dataKey || item.value || "value"}`;
376
- const itemConfig = getPayloadConfigFromPayload(config, item, key);
377
- return /* @__PURE__ */ jsxRuntime.jsxs(
378
- "div",
379
- {
380
- className: tooltip.cn(
381
- "[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"
382
- ),
383
- children: [
384
- (itemConfig == null ? void 0 : itemConfig.icon) && !hideIcon ? /* @__PURE__ */ jsxRuntime.jsx(itemConfig.icon, {}) : /* @__PURE__ */ jsxRuntime.jsx(
385
- "div",
386
- {
387
- className: "h-2 w-2 shrink-0 rounded-[2px] bg-(--color-bg)",
388
- style: {
389
- "--color-bg": item.color || `var(--color-${key})`
390
- }
391
- }
392
- ),
393
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: (itemConfig == null ? void 0 : itemConfig.label) || item.value })
394
- ]
395
- },
396
- item.value
397
- );
398
- })
399
- }
400
- );
401
- }
402
- function getPayloadConfigFromPayload(config, payload, key) {
403
- if (typeof payload !== "object" || payload === null) {
404
- return void 0;
405
- }
406
- const payloadPayload = "payload" in payload && typeof payload.payload === "object" && payload.payload !== null ? payload.payload : void 0;
407
- let configLabelKey = key;
408
- if (key in payload && typeof payload[key] === "string") {
409
- configLabelKey = payload[key];
410
- } else if (payloadPayload && key in payloadPayload && typeof payloadPayload[key] === "string") {
411
- configLabelKey = payloadPayload[key];
412
- }
413
- return configLabelKey in config ? config[configLabelKey] : config[key];
414
- }
415
- function getChartSeries(config, series) {
416
- if (series == null ? void 0 : series.length) {
417
- return series;
418
- }
419
- return Object.entries(config).map(([key, item]) => ({
420
- key,
421
- label: item.label
422
- }));
423
- }
424
- function getSeriesColor(key, index, colors) {
425
- if (Array.isArray(colors)) {
426
- return colors[index] || defaultChartColors[index % defaultChartColors.length];
427
- }
428
- return (colors == null ? void 0 : colors[key]) || defaultChartColors[index % defaultChartColors.length];
429
- }
430
- function getChartConfigWithColors(config, keys, colors) {
431
- return keys.reduce((nextConfig, key, index) => {
432
- const item = config[key];
433
- if ((item == null ? void 0 : item.theme) && !colors) {
434
- nextConfig[key] = item;
435
- return nextConfig;
436
- }
437
- nextConfig[key] = {
438
- label: (item == null ? void 0 : item.label) || key,
439
- icon: item == null ? void 0 : item.icon,
440
- color: colors ? getSeriesColor(key, index, colors) : (item == null ? void 0 : item.color) || getSeriesColor(key, index)
441
- };
442
- return nextConfig;
443
- }, {});
444
- }
445
- function formatTick(value) {
446
- if (typeof value !== "number") {
447
- return value;
448
- }
449
- return Intl.NumberFormat("en", {
450
- notation: "compact",
451
- maximumFractionDigits: 1
452
- }).format(value);
453
- }
454
- function defaultFilterData(data, period) {
455
- const match = period.match(/^(\d+)/);
456
- if (!match) {
457
- return data;
458
- }
459
- const limit = Number(match[1]);
460
- return data.slice(Math.max(data.length - limit, 0));
461
- }
462
- function ChartCard({
463
- title,
464
- description,
465
- action,
466
- footer,
467
- children,
468
- className,
469
- contentClassName,
470
- ...props
471
- }) {
472
- return /* @__PURE__ */ jsxRuntime.jsxs(Card, { className: tooltip.cn("overflow-hidden", className), ...props, children: [
473
- /* @__PURE__ */ jsxRuntime.jsxs(CardHeader, { children: [
474
- /* @__PURE__ */ jsxRuntime.jsx(CardTitle, { children: title }),
475
- description ? /* @__PURE__ */ jsxRuntime.jsx(CardDescription, { children: description }) : null,
476
- action ? /* @__PURE__ */ jsxRuntime.jsx(CardAction, { children: action }) : null
477
- ] }),
478
- /* @__PURE__ */ jsxRuntime.jsx(CardContent, { className: contentClassName, children }),
479
- footer ? /* @__PURE__ */ jsxRuntime.jsx(CardFooter, { children: footer }) : null
480
- ] });
481
- }
482
- function DashboardBarChart({
483
- data,
484
- config,
485
- indexKey = "name",
486
- series,
487
- colors,
488
- stacked = false,
489
- showGrid = true,
490
- showLegend = true,
491
- valueFormatter = formatTick,
492
- className,
493
- ...props
494
- }) {
495
- const chartSeries = getChartSeries(config, series);
496
- const chartConfig = getChartConfigWithColors(
497
- config,
498
- chartSeries.map((item) => item.key),
499
- colors
500
- );
501
- return /* @__PURE__ */ jsxRuntime.jsx(
502
- ChartContainer,
503
- {
504
- config: chartConfig,
505
- className: tooltip.cn("h-[320px] w-full", className),
506
- ...props,
507
- children: /* @__PURE__ */ jsxRuntime.jsxs(RechartsPrimitive__namespace.BarChart, { data, accessibilityLayer: true, children: [
508
- showGrid ? /* @__PURE__ */ jsxRuntime.jsx(RechartsPrimitive__namespace.CartesianGrid, { vertical: false }) : null,
509
- /* @__PURE__ */ jsxRuntime.jsx(
510
- RechartsPrimitive__namespace.XAxis,
511
- {
512
- dataKey: indexKey,
513
- tickLine: false,
514
- axisLine: false,
515
- tickMargin: 8
516
- }
517
- ),
518
- /* @__PURE__ */ jsxRuntime.jsx(
519
- RechartsPrimitive__namespace.YAxis,
520
- {
521
- tickLine: false,
522
- axisLine: false,
523
- tickMargin: 8,
524
- tickFormatter: valueFormatter
525
- }
526
- ),
527
- /* @__PURE__ */ jsxRuntime.jsx(ChartTooltip, { content: /* @__PURE__ */ jsxRuntime.jsx(ChartTooltipContent, {}) }),
528
- showLegend ? /* @__PURE__ */ jsxRuntime.jsx(ChartLegend, { content: /* @__PURE__ */ jsxRuntime.jsx(ChartLegendContent, {}) }) : null,
529
- chartSeries.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
530
- RechartsPrimitive__namespace.Bar,
531
- {
532
- dataKey: item.key,
533
- fill: `var(--color-${item.key})`,
534
- radius: [4, 4, 0, 0],
535
- stackId: stacked ? item.stackId || "total" : item.stackId
536
- },
537
- item.key
538
- ))
539
- ] })
540
- }
541
- );
542
- }
543
- function DashboardLineChart({
544
- data,
545
- config,
546
- indexKey = "name",
547
- series,
548
- colors,
549
- showDots = false,
550
- showGrid = true,
551
- showLegend = true,
552
- valueFormatter = formatTick,
553
- className,
554
- ...props
555
- }) {
556
- const chartSeries = getChartSeries(config, series);
557
- const chartConfig = getChartConfigWithColors(
558
- config,
559
- chartSeries.map((item) => item.key),
560
- colors
561
- );
562
- return /* @__PURE__ */ jsxRuntime.jsx(
563
- ChartContainer,
564
- {
565
- config: chartConfig,
566
- className: tooltip.cn("h-[320px] w-full", className),
567
- ...props,
568
- children: /* @__PURE__ */ jsxRuntime.jsxs(RechartsPrimitive__namespace.LineChart, { data, accessibilityLayer: true, children: [
569
- showGrid ? /* @__PURE__ */ jsxRuntime.jsx(RechartsPrimitive__namespace.CartesianGrid, { vertical: false }) : null,
570
- /* @__PURE__ */ jsxRuntime.jsx(
571
- RechartsPrimitive__namespace.XAxis,
572
- {
573
- dataKey: indexKey,
574
- tickLine: false,
575
- axisLine: false,
576
- tickMargin: 8
577
- }
578
- ),
579
- /* @__PURE__ */ jsxRuntime.jsx(
580
- RechartsPrimitive__namespace.YAxis,
581
- {
582
- tickLine: false,
583
- axisLine: false,
584
- tickMargin: 8,
585
- tickFormatter: valueFormatter
586
- }
587
- ),
588
- /* @__PURE__ */ jsxRuntime.jsx(ChartTooltip, { content: /* @__PURE__ */ jsxRuntime.jsx(ChartTooltipContent, { indicator: "line" }) }),
589
- showLegend ? /* @__PURE__ */ jsxRuntime.jsx(ChartLegend, { content: /* @__PURE__ */ jsxRuntime.jsx(ChartLegendContent, {}) }) : null,
590
- chartSeries.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
591
- RechartsPrimitive__namespace.Line,
592
- {
593
- type: "monotone",
594
- dataKey: item.key,
595
- stroke: `var(--color-${item.key})`,
596
- strokeWidth: 2,
597
- dot: showDots ? { r: 3, fill: `var(--color-${item.key})` } : false,
598
- activeDot: { r: 5 },
599
- yAxisId: item.yAxisId
600
- },
601
- item.key
602
- ))
603
- ] })
604
- }
605
- );
606
- }
607
- function HorizontalBarChart({
608
- data,
609
- config,
610
- indexKey = "name",
611
- series,
612
- colors,
613
- stacked = false,
614
- categoryWidth = 96,
615
- showGrid = true,
616
- showLegend = true,
617
- valueFormatter = formatTick,
618
- className,
619
- ...props
620
- }) {
621
- const chartSeries = getChartSeries(config, series);
622
- const chartConfig = getChartConfigWithColors(
623
- config,
624
- chartSeries.map((item) => item.key),
625
- colors
626
- );
627
- return /* @__PURE__ */ jsxRuntime.jsx(
628
- ChartContainer,
629
- {
630
- config: chartConfig,
631
- className: tooltip.cn("h-[320px] w-full", className),
632
- ...props,
633
- children: /* @__PURE__ */ jsxRuntime.jsxs(
634
- RechartsPrimitive__namespace.BarChart,
635
- {
636
- data,
637
- layout: "vertical",
638
- accessibilityLayer: true,
639
- margin: { left: 8, right: 16 },
640
- children: [
641
- showGrid ? /* @__PURE__ */ jsxRuntime.jsx(RechartsPrimitive__namespace.CartesianGrid, { horizontal: false }) : null,
642
- /* @__PURE__ */ jsxRuntime.jsx(
643
- RechartsPrimitive__namespace.XAxis,
644
- {
645
- type: "number",
646
- tickLine: false,
647
- axisLine: false,
648
- tickMargin: 8,
649
- tickFormatter: valueFormatter
650
- }
651
- ),
652
- /* @__PURE__ */ jsxRuntime.jsx(
653
- RechartsPrimitive__namespace.YAxis,
654
- {
655
- dataKey: indexKey,
656
- type: "category",
657
- tickLine: false,
658
- axisLine: false,
659
- tickMargin: 8,
660
- width: categoryWidth
661
- }
662
- ),
663
- /* @__PURE__ */ jsxRuntime.jsx(ChartTooltip, { content: /* @__PURE__ */ jsxRuntime.jsx(ChartTooltipContent, {}) }),
664
- showLegend ? /* @__PURE__ */ jsxRuntime.jsx(ChartLegend, { content: /* @__PURE__ */ jsxRuntime.jsx(ChartLegendContent, {}) }) : null,
665
- chartSeries.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
666
- RechartsPrimitive__namespace.Bar,
667
- {
668
- dataKey: item.key,
669
- fill: `var(--color-${item.key})`,
670
- radius: [0, 4, 4, 0],
671
- stackId: stacked ? item.stackId || "total" : item.stackId
672
- },
673
- item.key
674
- ))
675
- ]
676
- }
677
- )
678
- }
679
- );
680
- }
681
- function InteractiveTimeSeriesChart({
682
- data,
683
- config,
684
- indexKey = "date",
685
- series,
686
- colors,
687
- periods = defaultPeriods,
688
- defaultPeriod = ((_a) => (_a = periods[1]) == null ? void 0 : _a.value)() || ((_b) => (_b = periods[0]) == null ? void 0 : _b.value)() || "30d",
689
- defaultSeries,
690
- filterData = defaultFilterData,
691
- showGrid = true,
692
- showLegend = false,
693
- valueFormatter = formatTick,
694
- className,
695
- ...props
696
- }) {
697
- var _a2;
698
- const chartSeries = getChartSeries(config, series);
699
- const chartConfig = getChartConfigWithColors(
700
- config,
701
- chartSeries.map((item) => item.key),
702
- colors
703
- );
704
- const [period, setPeriod] = React__namespace.useState(defaultPeriod);
705
- const [activeSeries, setActiveSeries] = React__namespace.useState(
706
- defaultSeries || ((_a2 = chartSeries[0]) == null ? void 0 : _a2.key) || ""
707
- );
708
- const filteredData = React__namespace.useMemo(
709
- () => filterData(data, period),
710
- [data, filterData, period]
711
- );
712
- const visibleSeries = chartSeries.length > 1 ? chartSeries.filter((item) => item.key === activeSeries) : chartSeries;
713
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
714
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between", children: [
715
- chartSeries.length > 1 ? /* @__PURE__ */ jsxRuntime.jsx(Tabs, { value: activeSeries, onValueChange: setActiveSeries, children: /* @__PURE__ */ jsxRuntime.jsx(TabsList, { className: "h-10", children: chartSeries.map((item) => {
716
- var _a3;
717
- return /* @__PURE__ */ jsxRuntime.jsx(TabsTrigger, { value: item.key, className: "h-10", children: item.label || ((_a3 = config[item.key]) == null ? void 0 : _a3.label) || item.key }, item.key);
718
- }) }) }) : /* @__PURE__ */ jsxRuntime.jsx("div", {}),
719
- /* @__PURE__ */ jsxRuntime.jsxs(select.Select, { value: period, onValueChange: setPeriod, children: [
720
- /* @__PURE__ */ jsxRuntime.jsx(select.SelectTrigger, { className: "w-full sm:w-[160px]", size: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(select.SelectValue, { placeholder: "Period" }) }),
721
- /* @__PURE__ */ jsxRuntime.jsx(select.SelectContent, { children: periods.map((item) => /* @__PURE__ */ jsxRuntime.jsx(select.SelectItem, { value: item.value, children: item.label }, item.value)) })
722
- ] })
723
- ] }),
724
- /* @__PURE__ */ jsxRuntime.jsx(
725
- ChartContainer,
726
- {
727
- config: chartConfig,
728
- className: tooltip.cn("h-[320px] w-full", className),
729
- ...props,
730
- children: /* @__PURE__ */ jsxRuntime.jsxs(RechartsPrimitive__namespace.AreaChart, { data: filteredData, accessibilityLayer: true, children: [
731
- showGrid ? /* @__PURE__ */ jsxRuntime.jsx(RechartsPrimitive__namespace.CartesianGrid, { vertical: false }) : null,
732
- /* @__PURE__ */ jsxRuntime.jsx(
733
- RechartsPrimitive__namespace.XAxis,
734
- {
735
- dataKey: indexKey,
736
- tickLine: false,
737
- axisLine: false,
738
- tickMargin: 8
739
- }
740
- ),
741
- /* @__PURE__ */ jsxRuntime.jsx(
742
- RechartsPrimitive__namespace.YAxis,
743
- {
744
- tickLine: false,
745
- axisLine: false,
746
- tickMargin: 8,
747
- tickFormatter: valueFormatter
748
- }
749
- ),
750
- /* @__PURE__ */ jsxRuntime.jsx(ChartTooltip, { content: /* @__PURE__ */ jsxRuntime.jsx(ChartTooltipContent, { indicator: "line" }) }),
751
- showLegend ? /* @__PURE__ */ jsxRuntime.jsx(ChartLegend, { content: /* @__PURE__ */ jsxRuntime.jsx(ChartLegendContent, {}) }) : null,
752
- visibleSeries.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
753
- RechartsPrimitive__namespace.Area,
754
- {
755
- type: "monotone",
756
- dataKey: item.key,
757
- stroke: `var(--color-${item.key})`,
758
- fill: `var(--color-${item.key})`,
759
- fillOpacity: 0.16,
760
- strokeWidth: 2,
761
- dot: false
762
- },
763
- item.key
764
- ))
765
- ] })
766
- }
767
- )
768
- ] });
769
- }
770
- function ComboMetricChart({
771
- data,
772
- config,
773
- indexKey = "name",
774
- series,
775
- colors,
776
- showGrid = true,
777
- showLegend = true,
778
- valueFormatter = formatTick,
779
- className,
780
- ...props
781
- }) {
782
- const chartSeries = getChartSeries(config, series);
783
- const chartConfig = getChartConfigWithColors(
784
- config,
785
- chartSeries.map((item) => item.key),
786
- colors
787
- );
788
- return /* @__PURE__ */ jsxRuntime.jsx(
789
- ChartContainer,
790
- {
791
- config: chartConfig,
792
- className: tooltip.cn("h-[340px] w-full", className),
793
- ...props,
794
- children: /* @__PURE__ */ jsxRuntime.jsxs(RechartsPrimitive__namespace.ComposedChart, { data, accessibilityLayer: true, children: [
795
- showGrid ? /* @__PURE__ */ jsxRuntime.jsx(RechartsPrimitive__namespace.CartesianGrid, { vertical: false }) : null,
796
- /* @__PURE__ */ jsxRuntime.jsx(
797
- RechartsPrimitive__namespace.XAxis,
798
- {
799
- dataKey: indexKey,
800
- tickLine: false,
801
- axisLine: false,
802
- tickMargin: 8
803
- }
804
- ),
805
- /* @__PURE__ */ jsxRuntime.jsx(
806
- RechartsPrimitive__namespace.YAxis,
807
- {
808
- tickLine: false,
809
- axisLine: false,
810
- tickMargin: 8,
811
- tickFormatter: valueFormatter
812
- }
813
- ),
814
- /* @__PURE__ */ jsxRuntime.jsx(ChartTooltip, { content: /* @__PURE__ */ jsxRuntime.jsx(ChartTooltipContent, {}) }),
815
- showLegend ? /* @__PURE__ */ jsxRuntime.jsx(ChartLegend, { content: /* @__PURE__ */ jsxRuntime.jsx(ChartLegendContent, {}) }) : null,
816
- chartSeries.map(
817
- (item) => item.type === "line" ? /* @__PURE__ */ jsxRuntime.jsx(
818
- RechartsPrimitive__namespace.Line,
819
- {
820
- type: "monotone",
821
- dataKey: item.key,
822
- stroke: `var(--color-${item.key})`,
823
- strokeWidth: 2,
824
- dot: false,
825
- yAxisId: item.yAxisId
826
- },
827
- item.key
828
- ) : item.type === "area" ? /* @__PURE__ */ jsxRuntime.jsx(
829
- RechartsPrimitive__namespace.Area,
830
- {
831
- type: "monotone",
832
- dataKey: item.key,
833
- stroke: `var(--color-${item.key})`,
834
- fill: `var(--color-${item.key})`,
835
- fillOpacity: 0.12,
836
- strokeWidth: 2,
837
- dot: false,
838
- yAxisId: item.yAxisId
839
- },
840
- item.key
841
- ) : /* @__PURE__ */ jsxRuntime.jsx(
842
- RechartsPrimitive__namespace.Bar,
843
- {
844
- dataKey: item.key,
845
- fill: `var(--color-${item.key})`,
846
- radius: [4, 4, 0, 0],
847
- yAxisId: item.yAxisId
848
- },
849
- item.key
850
- )
851
- )
852
- ] })
853
- }
854
- );
855
- }
856
- function DonutBreakdownChart({
857
- data,
858
- config,
859
- nameKey = "name",
860
- valueKey = "value",
861
- colors,
862
- centerLabel,
863
- centerValue,
864
- showLegend = true,
865
- className,
866
- ...props
867
- }) {
868
- const [activeIndex, setActiveIndex] = React__namespace.useState(0);
869
- const chartKeys = data.map(
870
- (entry, index) => String(entry[nameKey] || `segment-${index}`)
871
- );
872
- const chartConfig = getChartConfigWithColors(config, chartKeys, colors);
873
- return /* @__PURE__ */ jsxRuntime.jsx(
874
- ChartContainer,
875
- {
876
- config: chartConfig,
877
- className: tooltip.cn("h-[320px] w-full", className),
878
- ...props,
879
- children: /* @__PURE__ */ jsxRuntime.jsxs(RechartsPrimitive__namespace.PieChart, { accessibilityLayer: true, children: [
880
- /* @__PURE__ */ jsxRuntime.jsx(
881
- ChartTooltip,
882
- {
883
- cursor: false,
884
- content: /* @__PURE__ */ jsxRuntime.jsx(ChartTooltipContent, { hideLabel: true, nameKey })
885
- }
886
- ),
887
- showLegend ? /* @__PURE__ */ jsxRuntime.jsx(
888
- ChartLegend,
889
- {
890
- content: /* @__PURE__ */ jsxRuntime.jsx(ChartLegendContent, { nameKey }),
891
- verticalAlign: "bottom"
892
- }
893
- ) : null,
894
- /* @__PURE__ */ jsxRuntime.jsxs(
895
- RechartsPrimitive__namespace.Pie,
896
- {
897
- data,
898
- dataKey: valueKey,
899
- nameKey,
900
- innerRadius: "58%",
901
- outerRadius: "82%",
902
- paddingAngle: 2,
903
- activeIndex,
904
- onMouseEnter: (_, index) => setActiveIndex(index),
905
- children: [
906
- data.map((entry, index) => {
907
- const key = String(entry[nameKey] || `segment-${index}`);
908
- return /* @__PURE__ */ jsxRuntime.jsx(
909
- RechartsPrimitive__namespace.Cell,
910
- {
911
- fill: `var(--color-${key})`,
912
- opacity: index === activeIndex ? 1 : 0.72
913
- },
914
- key
915
- );
916
- }),
917
- centerValue || centerLabel ? /* @__PURE__ */ jsxRuntime.jsx(
918
- RechartsPrimitive__namespace.Label,
919
- {
920
- position: "center",
921
- content: ({ viewBox }) => {
922
- if (!viewBox || !("cx" in viewBox) || !("cy" in viewBox)) {
923
- return null;
924
- }
925
- return /* @__PURE__ */ jsxRuntime.jsxs(
926
- "text",
927
- {
928
- x: viewBox.cx,
929
- y: viewBox.cy,
930
- textAnchor: "middle",
931
- dominantBaseline: "middle",
932
- children: [
933
- centerValue ? /* @__PURE__ */ jsxRuntime.jsx(
934
- "tspan",
935
- {
936
- x: viewBox.cx,
937
- y: viewBox.cy,
938
- className: "fill-foreground text-2xl font-semibold",
939
- children: centerValue
940
- }
941
- ) : null,
942
- centerLabel ? /* @__PURE__ */ jsxRuntime.jsx(
943
- "tspan",
944
- {
945
- x: viewBox.cx,
946
- y: Number(viewBox.cy) + 22,
947
- className: "fill-muted-foreground text-xs",
948
- children: centerLabel
949
- }
950
- ) : null
951
- ]
952
- }
953
- );
954
- }
955
- }
956
- ) : null
957
- ]
958
- }
959
- )
960
- ] })
961
- }
962
- );
963
- }
964
- function Table({ className, ...props }) {
965
- return /* @__PURE__ */ jsxRuntime.jsx(
966
- "div",
967
- {
968
- "data-slot": "table-container",
969
- className: "relative w-full overflow-x-auto",
970
- children: /* @__PURE__ */ jsxRuntime.jsx(
971
- "table",
972
- {
973
- "data-slot": "table",
974
- className: tooltip.cn("w-full caption-bottom text-sm", className),
975
- ...props
976
- }
977
- )
978
- }
979
- );
980
- }
981
- function TableHeader({ className, ...props }) {
982
- return /* @__PURE__ */ jsxRuntime.jsx(
983
- "thead",
984
- {
985
- "data-slot": "table-header",
986
- className: tooltip.cn("[&_tr]:border-b", className),
987
- ...props
988
- }
989
- );
990
- }
991
- function TableBody({ className, ...props }) {
992
- return /* @__PURE__ */ jsxRuntime.jsx(
993
- "tbody",
994
- {
995
- "data-slot": "table-body",
996
- className: tooltip.cn("[&_tr:last-child]:border-0", className),
997
- ...props
998
- }
999
- );
1000
- }
1001
- function TableFooter({ className, ...props }) {
1002
- return /* @__PURE__ */ jsxRuntime.jsx(
1003
- "tfoot",
1004
- {
1005
- "data-slot": "table-footer",
1006
- className: tooltip.cn(
1007
- "bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",
1008
- className
1009
- ),
1010
- ...props
1011
- }
1012
- );
1013
- }
1014
- function TableRow({ className, ...props }) {
1015
- return /* @__PURE__ */ jsxRuntime.jsx(
1016
- "tr",
1017
- {
1018
- "data-slot": "table-row",
1019
- className: tooltip.cn(
1020
- "hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",
1021
- className
1022
- ),
1023
- ...props
1024
- }
1025
- );
1026
- }
1027
- function TableHead({ className, ...props }) {
1028
- return /* @__PURE__ */ jsxRuntime.jsx(
1029
- "th",
1030
- {
1031
- "data-slot": "table-head",
1032
- className: tooltip.cn(
1033
- "text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
1034
- className
1035
- ),
1036
- ...props
1037
- }
1038
- );
1039
- }
1040
- function TableCell({ className, ...props }) {
1041
- return /* @__PURE__ */ jsxRuntime.jsx(
1042
- "td",
1043
- {
1044
- "data-slot": "table-cell",
1045
- className: tooltip.cn(
1046
- "p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
1047
- className
1048
- ),
1049
- ...props
1050
- }
1051
- );
1052
- }
1053
- function TableCaption({
1054
- className,
1055
- ...props
1056
- }) {
1057
- return /* @__PURE__ */ jsxRuntime.jsx(
1058
- "caption",
1059
- {
1060
- "data-slot": "table-caption",
1061
- className: tooltip.cn("text-muted-foreground mt-4 text-sm", className),
1062
- ...props
1063
- }
1064
- );
1065
- }
1066
- function Dialog({
1067
- ...props
1068
- }) {
1069
- return /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Root, { "data-slot": "dialog", ...props });
1070
- }
1071
- function DialogTrigger({
1072
- ...props
1073
- }) {
1074
- return /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Trigger, { "data-slot": "dialog-trigger", ...props });
1075
- }
1076
- function DialogPortal({
1077
- ...props
1078
- }) {
1079
- return /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Portal, { "data-slot": "dialog-portal", ...props });
1080
- }
1081
- function DialogClose({
1082
- ...props
1083
- }) {
1084
- return /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Close, { "data-slot": "dialog-close", ...props });
1085
- }
1086
- const DialogOverlay = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1087
- DialogPrimitive__namespace.Overlay,
1088
- {
1089
- ref,
1090
- "data-slot": "dialog-overlay",
1091
- className: tooltip.cn(
1092
- "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",
1093
- className
1094
- ),
1095
- ...props
1096
- }
1097
- ));
1098
- DialogOverlay.displayName = DialogPrimitive__namespace.Overlay.displayName;
1099
- const dialogVariants = classVarianceAuthority.cva(
1100
- "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)]",
1101
- {
1102
- variants: {
1103
- size: {
1104
- sm: "max-w-sm",
1105
- md: "max-w-md",
1106
- lg: "max-w-lg",
1107
- xl: "max-w-xl",
1108
- "2xl": "max-w-2xl",
1109
- "3xl": "max-w-3xl",
1110
- "4xl": "max-w-4xl",
1111
- "5xl": "max-w-5xl",
1112
- full: "max-w-[calc(100vw-2rem)] h-[calc(100dvh-2rem)]"
1113
- }
1114
- },
1115
- defaultVariants: {
1116
- size: "lg"
1117
- }
1118
- }
1119
- );
1120
- const DialogContent = React__namespace.forwardRef(({ className, children, size, showClose = true, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [
1121
- /* @__PURE__ */ jsxRuntime.jsx(DialogOverlay, {}),
1122
- /* @__PURE__ */ jsxRuntime.jsxs(
1123
- DialogPrimitive__namespace.Content,
1124
- {
1125
- ref,
1126
- "data-slot": "dialog-content",
1127
- className: tooltip.cn(dialogVariants({ size }), className),
1128
- ...props,
1129
- children: [
1130
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-4 p-6 overflow-y-auto flex-1 min-h-0", children }),
1131
- showClose && /* @__PURE__ */ jsxRuntime.jsxs(DialogPrimitive__namespace.Close, { className: "absolute top-4 right-4 z-10 rounded-full p-2 opacity-70 transition-all hover:opacity-100 hover:bg-accent focus:ring-2 focus:ring-primary focus:ring-offset-2 focus:outline-none disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", children: [
1132
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, {}),
1133
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Close" })
1134
- ] })
1135
- ]
1136
- }
1137
- )
1138
- ] }));
1139
- DialogContent.displayName = DialogPrimitive__namespace.Content.displayName;
1140
- function DialogHeader({ className, ...props }) {
1141
- return /* @__PURE__ */ jsxRuntime.jsx(
1142
- "div",
1143
- {
1144
- "data-slot": "dialog-header",
1145
- className: tooltip.cn("flex flex-col gap-2 text-left shrink-0", className),
1146
- ...props
1147
- }
1148
- );
1149
- }
1150
- function DialogBody({ className, ...props }) {
1151
- return /* @__PURE__ */ jsxRuntime.jsx(
1152
- "div",
1153
- {
1154
- "data-slot": "dialog-body",
1155
- className: tooltip.cn("flex-1 overflow-y-auto min-h-0 -mx-6 px-6", className),
1156
- ...props
1157
- }
1158
- );
1159
- }
1160
- function DialogFooter({ className, ...props }) {
1161
- return /* @__PURE__ */ jsxRuntime.jsx(
1162
- "div",
1163
- {
1164
- "data-slot": "dialog-footer",
1165
- className: tooltip.cn(
1166
- "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end shrink-0",
1167
- className
1168
- ),
1169
- ...props
1170
- }
1171
- );
1172
- }
1173
- function DialogTitle({
1174
- className,
1175
- ...props
1176
- }) {
1177
- return /* @__PURE__ */ jsxRuntime.jsx(
1178
- DialogPrimitive__namespace.Title,
1179
- {
1180
- "data-slot": "dialog-title",
1181
- className: tooltip.cn("text-foreground font-semibold leading-tight text-[length:var(--text-h4)]", className),
1182
- ...props
1183
- }
1184
- );
1185
- }
1186
- function DialogDescription({
1187
- className,
1188
- ...props
1189
- }) {
1190
- return /* @__PURE__ */ jsxRuntime.jsx(
1191
- DialogPrimitive__namespace.Description,
1192
- {
1193
- "data-slot": "dialog-description",
1194
- className: tooltip.cn("text-muted-foreground", className),
1195
- ...props
1196
- }
1197
- );
1198
- }
1199
- const Textarea = React__namespace.forwardRef(
1200
- ({ className, size = "md", ...props }, ref) => {
1201
- const sizeClasses = {
1202
- sm: "px-2 py-1 text-sm",
1203
- md: "px-3 py-2 text-base",
1204
- lg: "px-4 py-3 text-base"
1205
- };
1206
- return /* @__PURE__ */ jsxRuntime.jsx(
1207
- "textarea",
1208
- {
1209
- "data-slot": "textarea",
1210
- className: tooltip.cn(
1211
- "flex min-h-16 w-full bg-background rounded-[var(--radius)] border border-border transition-colors outline-none resize-none text-foreground",
1212
- "placeholder:text-muted-foreground",
1213
- "focus:ring-2 focus:ring-primary focus:border-transparent",
1214
- "disabled:cursor-not-allowed disabled:opacity-50",
1215
- sizeClasses[size],
1216
- className
1217
- ),
1218
- ref,
1219
- ...props
1220
- }
1221
- );
1222
- }
1223
- );
1224
- Textarea.displayName = "Textarea";
1225
- function RichTextEditor({
1226
- value,
1227
- onChange,
1228
- placeholder,
1229
- className,
1230
- actionButton,
1231
- allowSearch = true,
1232
- allowLinks = true,
1233
- allowUndoRedo = true,
1234
- allowHeadings = true,
1235
- allowFormatting = true,
1236
- allowAlignment = true,
1237
- allowLists = true,
1238
- showWordCount = true,
1239
- showCharacterCount = true,
1240
- disabled = false,
1241
- readOnly = false,
1242
- onFocus,
1243
- onBlur,
1244
- minHeight,
1245
- maxHeight
1246
- }) {
1247
- const isEditable = !disabled && !readOnly;
1248
- const showToolbar = isEditable;
1249
- const editorRef = React.useRef(null);
1250
- const [activeFormats, setActiveFormats] = React.useState({});
1251
- const [isSearchOpen, setIsSearchOpen] = React.useState(false);
1252
- const [searchQuery, setSearchQuery] = React.useState("");
1253
- const [linkUrl, setLinkUrl] = React.useState("https://");
1254
- const [isLinkOpen, setIsLinkOpen] = React.useState(false);
1255
- const searchInputRef = React.useRef(null);
1256
- const linkInputRef = React.useRef(null);
1257
- const savedSelection = React.useRef(null);
1258
- const findParentTag = (node, tagName) => {
1259
- let current = node;
1260
- while (current && current !== editorRef.current) {
1261
- if (current.nodeName === tagName) return current;
1262
- current = current.parentNode;
1263
- }
1264
- return null;
1265
- };
1266
- const updateActiveFormats = () => {
1267
- let formatBlock = "";
1268
- try {
1269
- formatBlock = document.queryCommandValue("formatBlock");
1270
- } catch (e) {
1271
- }
1272
- const selection = window.getSelection();
1273
- const anchorNode = selection == null ? void 0 : selection.anchorNode;
1274
- const focusNode = selection == null ? void 0 : selection.focusNode;
1275
- setActiveFormats({
1276
- bold: document.queryCommandState("bold"),
1277
- italic: document.queryCommandState("italic"),
1278
- underline: document.queryCommandState("underline"),
1279
- justifyLeft: document.queryCommandState("justifyLeft"),
1280
- justifyCenter: document.queryCommandState("justifyCenter"),
1281
- justifyRight: document.queryCommandState("justifyRight"),
1282
- insertUnorderedList: document.queryCommandState("insertUnorderedList"),
1283
- insertOrderedList: document.queryCommandState("insertOrderedList"),
1284
- link: !!(findParentTag(anchorNode || null, "A") || findParentTag(focusNode || null, "A")),
1285
- h1: formatBlock === "h1" || formatBlock === "H1",
1286
- h2: formatBlock === "h2" || formatBlock === "H2",
1287
- h3: formatBlock === "h3" || formatBlock === "H3",
1288
- p: formatBlock === "p" || formatBlock === "P" || formatBlock === "div" || formatBlock === "DIV" || formatBlock === ""
1289
- });
1290
- };
1291
- const getCurrentBlockLabel = () => {
1292
- if (activeFormats.h1) return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1293
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Heading1, { className: "w-4 h-4 mr-1 shrink-0" }),
1294
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: "Título 1" })
1295
- ] });
1296
- if (activeFormats.h2) return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1297
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Heading2, { className: "w-4 h-4 mr-1 shrink-0" }),
1298
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: "Título 2" })
1299
- ] });
1300
- if (activeFormats.h3) return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1301
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Heading3, { className: "w-4 h-4 mr-1 shrink-0" }),
1302
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: "Título 3" })
1303
- ] });
1304
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1305
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Type, { className: "w-4 h-4 mr-1 shrink-0" }),
1306
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: "Parágrafo" })
1307
- ] });
1308
- };
1309
- React.useEffect(() => {
1310
- if (editorRef.current && editorRef.current.innerHTML !== value) {
1311
- editorRef.current.innerHTML = value;
1312
- }
1313
- const handleSelectionChange = () => {
1314
- if (document.activeElement === editorRef.current) {
1315
- updateActiveFormats();
1316
- }
1317
- };
1318
- document.addEventListener("selectionchange", handleSelectionChange);
1319
- return () => document.removeEventListener("selectionchange", handleSelectionChange);
1320
- }, []);
1321
- const execCommand = (command, value2 = "") => {
1322
- var _a;
1323
- document.execCommand(command, false, value2);
1324
- updateActiveFormats();
1325
- (_a = editorRef.current) == null ? void 0 : _a.focus();
1326
- handleInput();
1327
- };
1328
- const handleInput = () => {
1329
- if (editorRef.current) {
1330
- onChange == null ? void 0 : onChange(editorRef.current.innerHTML);
1331
- updateActiveFormats();
1332
- }
1333
- };
1334
- const getWordCount = () => {
1335
- var _a;
1336
- const text = ((_a = editorRef.current) == null ? void 0 : _a.innerText) || "";
1337
- return text.trim() ? text.trim().split(/\s+/).length : 0;
1338
- };
1339
- const getCharacterCount = () => {
1340
- var _a;
1341
- const text = ((_a = editorRef.current) == null ? void 0 : _a.innerText) || "";
1342
- return text.trim() ? text.length : 0;
1343
- };
1344
- const performSearch = (text, backward = false) => {
1345
- var _a, _b;
1346
- if (!text || !editorRef.current) return;
1347
- const editor = editorRef.current;
1348
- const selection = window.getSelection();
1349
- if (!selection) return;
1350
- const walker = document.createTreeWalker(editor, NodeFilter.SHOW_TEXT);
1351
- const segments = [];
1352
- let offset = 0;
1353
- let node;
1354
- while (node = walker.nextNode()) {
1355
- segments.push({ node, start: offset });
1356
- offset += node.length;
1357
- }
1358
- const fullText = segments.reduce((acc, s) => acc + (s.node.textContent ?? ""), "");
1359
- let searchFrom = 0;
1360
- if (selection.rangeCount > 0) {
1361
- const range2 = selection.getRangeAt(0);
1362
- if (editor.contains(range2.startContainer)) {
1363
- const seg = segments.find((s) => s.node === range2.startContainer);
1364
- if (seg) {
1365
- searchFrom = backward ? seg.start + range2.startOffset - 1 : seg.start + range2.endOffset;
1366
- }
1367
- }
1368
- }
1369
- const lowerFull = fullText.toLowerCase();
1370
- const lowerQuery = text.toLowerCase();
1371
- let matchStart = -1;
1372
- if (backward) {
1373
- matchStart = lowerFull.lastIndexOf(lowerQuery, Math.max(0, searchFrom));
1374
- if (matchStart === -1) matchStart = lowerFull.lastIndexOf(lowerQuery);
1375
- } else {
1376
- matchStart = lowerFull.indexOf(lowerQuery, searchFrom);
1377
- if (matchStart === -1) matchStart = lowerFull.indexOf(lowerQuery);
1378
- }
1379
- if (matchStart === -1) return;
1380
- const matchEnd = matchStart + text.length;
1381
- const range = document.createRange();
1382
- let startSet = false;
1383
- let endSet = false;
1384
- for (let i = 0; i < segments.length && !endSet; i++) {
1385
- const seg = segments[i];
1386
- const segEnd = seg.start + seg.node.length;
1387
- if (!startSet && matchStart < segEnd && matchStart >= seg.start) {
1388
- range.setStart(seg.node, matchStart - seg.start);
1389
- startSet = true;
1390
- }
1391
- if (startSet && matchEnd <= segEnd) {
1392
- range.setEnd(seg.node, matchEnd - seg.start);
1393
- endSet = true;
1394
- }
1395
- }
1396
- if (startSet && endSet) {
1397
- selection.removeAllRanges();
1398
- selection.addRange(range);
1399
- (_b = (_a = range.startContainer.parentElement) == null ? void 0 : _a.scrollIntoView) == null ? void 0 : _b.call(_a, { block: "nearest" });
1400
- }
1401
- };
1402
- const handleCreateLink = () => {
1403
- if (savedSelection.current) {
1404
- const selection2 = window.getSelection();
1405
- selection2 == null ? void 0 : selection2.removeAllRanges();
1406
- selection2 == null ? void 0 : selection2.addRange(savedSelection.current);
1407
- }
1408
- const selection = window.getSelection();
1409
- const anchorNode = selection == null ? void 0 : selection.anchorNode;
1410
- const existingLink = findParentTag(anchorNode || null, "A");
1411
- if (existingLink) {
1412
- if (linkUrl) {
1413
- existingLink.setAttribute("href", linkUrl);
1414
- existingLink.setAttribute("target", "_blank");
1415
- existingLink.setAttribute("rel", "noopener noreferrer");
1416
- existingLink.style.color = "hsl(var(--primary))";
1417
- existingLink.style.textDecoration = "underline";
1418
- existingLink.style.cursor = "pointer";
1419
- }
1420
- handleInput();
1421
- setIsLinkOpen(false);
1422
- savedSelection.current = null;
1423
- return;
1424
- }
1425
- if (!selection || selection.rangeCount === 0 || selection.isCollapsed) {
1426
- return;
1427
- }
1428
- if (linkUrl) {
1429
- execCommand("createLink", linkUrl);
1430
- setTimeout(() => {
1431
- var _a;
1432
- const anchor = findParentTag(((_a = window.getSelection()) == null ? void 0 : _a.anchorNode) || null, "A");
1433
- if (anchor) {
1434
- anchor.setAttribute("target", "_blank");
1435
- anchor.setAttribute("rel", "noopener noreferrer");
1436
- anchor.style.color = "hsl(var(--primary))";
1437
- anchor.style.textDecoration = "underline";
1438
- anchor.style.cursor = "pointer";
1439
- }
1440
- handleInput();
1441
- }, 10);
1442
- setIsLinkOpen(false);
1443
- savedSelection.current = null;
1444
- }
1445
- };
1446
- const handleUnlink = () => {
1447
- const selection = window.getSelection();
1448
- const anchorNode = selection == null ? void 0 : selection.anchorNode;
1449
- const existingLink = findParentTag(anchorNode || null, "A");
1450
- if (existingLink) {
1451
- const parent = existingLink.parentNode;
1452
- while (existingLink.firstChild) {
1453
- parent == null ? void 0 : parent.insertBefore(existingLink.firstChild, existingLink);
1454
- }
1455
- parent == null ? void 0 : parent.removeChild(existingLink);
1456
- handleInput();
1457
- } else {
1458
- execCommand("unlink");
1459
- }
1460
- };
1461
- const onLinkPopoverOpenChange = (open) => {
1462
- if (open) {
1463
- const selection = window.getSelection();
1464
- const anchorNode = selection == null ? void 0 : selection.anchorNode;
1465
- const focusNode = selection == null ? void 0 : selection.focusNode;
1466
- const existingLink = findParentTag(anchorNode || null, "A") || findParentTag(focusNode || null, "A");
1467
- if (existingLink) {
1468
- setLinkUrl(existingLink.getAttribute("href") || "https://");
1469
- } else {
1470
- setLinkUrl("https://");
1471
- }
1472
- if (selection && selection.rangeCount > 0 && (!selection.isCollapsed || existingLink)) {
1473
- savedSelection.current = selection.getRangeAt(0).cloneRange();
1474
- } else {
1475
- savedSelection.current = null;
1476
- }
1477
- setTimeout(() => {
1478
- var _a;
1479
- return (_a = linkInputRef.current) == null ? void 0 : _a.focus();
1480
- }, 100);
1481
- }
1482
- setIsLinkOpen(open);
1483
- };
1484
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: tooltip.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: [
1485
- /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
1486
- [contenteditable]:empty:before {
1487
- content: attr(data-placeholder);
1488
- color: hsl(var(--muted-foreground));
1489
- pointer-events: none;
1490
- display: block;
1491
- }
1492
- .prose-editor ul {
1493
- list-style-type: disc !important;
1494
- padding-left: 1.5rem !important;
1495
- margin-top: 0.5rem !important;
1496
- margin-bottom: 0.5rem !important;
1497
- }
1498
- .prose-editor ol {
1499
- list-style-type: decimal !important;
1500
- padding-left: 1.5rem !important;
1501
- margin-top: 0.5rem !important;
1502
- margin-bottom: 0.5rem !important;
1503
- }
1504
- .prose-editor b, .prose-editor strong {
1505
- font-weight: 600 !important;
1506
- }
1507
- .prose-editor i, .prose-editor em {
1508
- font-style: italic !important;
1509
- }
1510
- .prose-editor u {
1511
- text-decoration: underline !important;
1512
- }
1513
- .prose-editor h1 {
1514
- font-size: 2.25rem !important;
1515
- font-weight: 700 !important;
1516
- margin-bottom: 1.25rem !important;
1517
- line-height: 1.2 !important;
1518
- margin-top: 2rem !important;
1519
- color: hsl(var(--foreground));
1520
- }
1521
- .prose-editor h2 {
1522
- font-size: 1.75rem !important;
1523
- font-weight: 600 !important;
1524
- margin-bottom: 1rem !important;
1525
- margin-top: 1.5rem !important;
1526
- color: hsl(var(--foreground));
1527
- }
1528
- .prose-editor h3 {
1529
- font-size: 1.35rem !important;
1530
- font-weight: 600 !important;
1531
- margin-bottom: 0.75rem !important;
1532
- margin-top: 1.25rem !important;
1533
- color: hsl(var(--foreground));
1534
- }
1535
- .prose-editor p {
1536
- margin-bottom: 1rem !important;
1537
- line-height: 1.6 !important;
1538
- }
1539
- .prose-editor a {
1540
- color: var(--info) !important;
1541
- text-decoration: underline !important;
1542
- cursor: pointer !important;
1543
- }
1544
- .prose-editor h1:first-child, .prose-editor h2:first-child, .prose-editor h3:first-child, .prose-editor p:first-child {
1545
- margin-top: 0 !important;
1546
- }
1547
- .prose-editor {
1548
- outline: none !important;
1549
- }
1550
- ` }),
1551
- showToolbar && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-3 py-2 border-b border-border bg-muted/30 flex items-center gap-1 flex-wrap shrink-0", children: [
1552
- allowUndoRedo && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1553
- /* @__PURE__ */ jsxRuntime.jsx(
1554
- tooltip.Button,
1555
- {
1556
- variant: "ghost",
1557
- size: "icon",
1558
- className: "h-8 w-8 text-muted-foreground",
1559
- onClick: () => execCommand("undo"),
1560
- title: "Desfazer",
1561
- "aria-label": "Desfazer",
1562
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Undo, { className: "w-4 h-4" })
1563
- }
1564
- ),
1565
- /* @__PURE__ */ jsxRuntime.jsx(
1566
- tooltip.Button,
1567
- {
1568
- variant: "ghost",
1569
- size: "icon",
1570
- className: "h-8 w-8 text-muted-foreground",
1571
- onClick: () => execCommand("redo"),
1572
- title: "Refazer",
1573
- "aria-label": "Refazer",
1574
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Redo, { className: "w-4 h-4" })
1575
- }
1576
- ),
1577
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-px h-6 bg-border mx-1 hidden sm:block" })
1578
- ] }),
1579
- allowHeadings && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1580
- /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu.DropdownMenu, { modal: false, children: [
1581
- /* @__PURE__ */ jsxRuntime.jsx(dropdownMenu.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(tooltip.Button, { variant: "ghost", size: "sm", className: "h-8 gap-0 text-muted-foreground w-[120px] justify-start px-2", children: [
1582
- getCurrentBlockLabel(),
1583
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "w-3 h-3 ml-auto opacity-50 shrink-0" })
1584
- ] }) }),
1585
- /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu.DropdownMenuContent, { align: "start", className: "w-[160px]", style: { zIndex: 9999 }, children: [
1586
- /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu.DropdownMenuItem, { onPointerDown: (e) => e.preventDefault(), onClick: () => execCommand("formatBlock", "P"), className: "gap-2", children: [
1587
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Type, { className: "w-4 h-4 text-muted-foreground" }),
1588
- " Parágrafo"
1589
- ] }),
1590
- /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu.DropdownMenuItem, { onPointerDown: (e) => e.preventDefault(), onClick: () => execCommand("formatBlock", "H1"), className: "gap-2", children: [
1591
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Heading1, { className: "w-4 h-4 text-muted-foreground" }),
1592
- " Título 1"
1593
- ] }),
1594
- /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu.DropdownMenuItem, { onPointerDown: (e) => e.preventDefault(), onClick: () => execCommand("formatBlock", "H2"), className: "gap-2", children: [
1595
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Heading2, { className: "w-4 h-4 text-muted-foreground" }),
1596
- " Título 2"
1597
- ] }),
1598
- /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu.DropdownMenuItem, { onPointerDown: (e) => e.preventDefault(), onClick: () => execCommand("formatBlock", "H3"), className: "gap-2", children: [
1599
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Heading3, { className: "w-4 h-4 text-muted-foreground" }),
1600
- " Título 3"
1601
- ] })
1602
- ] })
1603
- ] }),
1604
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-px h-6 bg-border mx-1 hidden sm:block" })
1605
- ] }),
1606
- allowFormatting && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1607
- /* @__PURE__ */ jsxRuntime.jsx(
1608
- tooltip.Button,
1609
- {
1610
- variant: "ghost",
1611
- size: "icon",
1612
- className: tooltip.cn("h-8 w-8 text-muted-foreground", activeFormats.bold && "bg-muted text-foreground"),
1613
- onClick: () => execCommand("bold"),
1614
- title: "Negrito",
1615
- "aria-label": "Negrito",
1616
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Bold, { className: "w-4 h-4" })
1617
- }
1618
- ),
1619
- /* @__PURE__ */ jsxRuntime.jsx(
1620
- tooltip.Button,
1621
- {
1622
- variant: "ghost",
1623
- size: "icon",
1624
- className: tooltip.cn("h-8 w-8 text-muted-foreground", activeFormats.italic && "bg-muted text-foreground"),
1625
- onClick: () => execCommand("italic"),
1626
- title: "Itálico",
1627
- "aria-label": "Itálico",
1628
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Italic, { className: "w-4 h-4" })
1629
- }
1630
- ),
1631
- /* @__PURE__ */ jsxRuntime.jsx(
1632
- tooltip.Button,
1633
- {
1634
- variant: "ghost",
1635
- size: "icon",
1636
- className: tooltip.cn("h-8 w-8 text-muted-foreground", activeFormats.underline && "bg-muted text-foreground"),
1637
- onClick: () => execCommand("underline"),
1638
- title: "Sublinhado",
1639
- "aria-label": "Sublinhado",
1640
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Underline, { className: "w-4 h-4" })
1641
- }
1642
- ),
1643
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-px h-6 bg-border mx-1 hidden sm:block" })
1644
- ] }),
1645
- allowAlignment && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1646
- /* @__PURE__ */ jsxRuntime.jsx(
1647
- tooltip.Button,
1648
- {
1649
- variant: "ghost",
1650
- size: "icon",
1651
- className: tooltip.cn("h-8 w-8 text-muted-foreground", activeFormats.justifyLeft && "bg-muted text-foreground"),
1652
- onClick: () => execCommand("justifyLeft"),
1653
- title: "Alinhar à esquerda",
1654
- "aria-label": "Alinhar à esquerda",
1655
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlignLeft, { className: "w-4 h-4" })
1656
- }
1657
- ),
1658
- /* @__PURE__ */ jsxRuntime.jsx(
1659
- tooltip.Button,
1660
- {
1661
- variant: "ghost",
1662
- size: "icon",
1663
- className: tooltip.cn("h-8 w-8 text-muted-foreground", activeFormats.justifyCenter && "bg-muted text-foreground"),
1664
- onClick: () => execCommand("justifyCenter"),
1665
- title: "Centralizar",
1666
- "aria-label": "Centralizar",
1667
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlignCenter, { className: "w-4 h-4" })
1668
- }
1669
- ),
1670
- /* @__PURE__ */ jsxRuntime.jsx(
1671
- tooltip.Button,
1672
- {
1673
- variant: "ghost",
1674
- size: "icon",
1675
- className: tooltip.cn("h-8 w-8 text-muted-foreground", activeFormats.justifyRight && "bg-muted text-foreground"),
1676
- onClick: () => execCommand("justifyRight"),
1677
- title: "Alinhar à direita",
1678
- "aria-label": "Alinhar à direita",
1679
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlignRight, { className: "w-4 h-4" })
1680
- }
1681
- ),
1682
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-px h-6 bg-border mx-1 hidden sm:block" })
1683
- ] }),
1684
- allowLists && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1685
- /* @__PURE__ */ jsxRuntime.jsx(
1686
- tooltip.Button,
1687
- {
1688
- variant: "ghost",
1689
- size: "icon",
1690
- className: tooltip.cn("h-8 w-8 text-muted-foreground", activeFormats.insertUnorderedList && "bg-muted text-foreground"),
1691
- onClick: () => execCommand("insertUnorderedList"),
1692
- title: "Lista com marcadores",
1693
- "aria-label": "Lista com marcadores",
1694
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.List, { className: "w-4 h-4" })
1695
- }
1696
- ),
1697
- /* @__PURE__ */ jsxRuntime.jsx(
1698
- tooltip.Button,
1699
- {
1700
- variant: "ghost",
1701
- size: "icon",
1702
- className: tooltip.cn("h-8 w-8 text-muted-foreground", activeFormats.insertOrderedList && "bg-muted text-foreground"),
1703
- onClick: () => execCommand("insertOrderedList"),
1704
- title: "Lista numerada",
1705
- "aria-label": "Lista numerada",
1706
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ListOrdered, { className: "w-4 h-4" })
1707
- }
1708
- ),
1709
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-px h-6 bg-border mx-1 hidden sm:block" })
1710
- ] }),
1711
- allowLinks && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1712
- /* @__PURE__ */ jsxRuntime.jsxs(input.Popover, { open: isLinkOpen, onOpenChange: onLinkPopoverOpenChange, modal: false, children: [
1713
- /* @__PURE__ */ jsxRuntime.jsx(input.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
1714
- tooltip.Button,
1715
- {
1716
- variant: "ghost",
1717
- size: "icon",
1718
- className: tooltip.cn("h-8 w-8 text-muted-foreground", (activeFormats.link || isLinkOpen) && "bg-muted text-foreground"),
1719
- title: "Inserir link",
1720
- "aria-label": "Inserir link",
1721
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Link, { className: "w-4 h-4" })
1722
- }
1723
- ) }),
1724
- /* @__PURE__ */ jsxRuntime.jsx(input.PopoverContent, { className: "w-80 p-3", align: "start", style: { zIndex: 9999 }, children: !savedSelection.current && !activeFormats.link ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground py-1", children: "Selecione um texto para criar um link." }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
1725
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs font-medium", children: activeFormats.link ? "Editar Link" : "Inserir Link" }),
1726
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2", children: [
1727
- /* @__PURE__ */ jsxRuntime.jsx(
1728
- input.Input,
1729
- {
1730
- ref: linkInputRef,
1731
- placeholder: "https://...",
1732
- value: linkUrl,
1733
- onChange: (e) => setLinkUrl(e.target.value),
1734
- onKeyDown: (e) => e.key === "Enter" && handleCreateLink(),
1735
- className: "h-8 text-xs"
1736
- }
1737
- ),
1738
- /* @__PURE__ */ jsxRuntime.jsx(tooltip.Button, { size: "sm", className: "h-8", onClick: handleCreateLink, children: "Aplicar" })
1739
- ] })
1740
- ] }) })
1741
- ] }),
1742
- /* @__PURE__ */ jsxRuntime.jsx(
1743
- tooltip.Button,
1744
- {
1745
- variant: "ghost",
1746
- size: "icon",
1747
- className: "h-8 w-8 text-muted-foreground",
1748
- onClick: handleUnlink,
1749
- title: "Remover link",
1750
- "aria-label": "Remover link",
1751
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "w-4 h-4" })
1752
- }
1753
- ),
1754
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-px h-6 bg-border mx-1 hidden sm:block" })
1755
- ] }),
1756
- (allowFormatting || allowHeadings || allowAlignment || allowLists || allowLinks) && /* @__PURE__ */ jsxRuntime.jsx(
1757
- tooltip.Button,
1758
- {
1759
- variant: "ghost",
1760
- size: "icon",
1761
- className: "h-8 w-8 text-muted-foreground",
1762
- onClick: () => execCommand("removeFormat"),
1763
- title: "Limpar formatação",
1764
- "aria-label": "Limpar formatação",
1765
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Type, { className: "w-4 h-4" })
1766
- }
1767
- ),
1768
- allowSearch && /* @__PURE__ */ jsxRuntime.jsx(
1769
- tooltip.Button,
1770
- {
1771
- variant: "ghost",
1772
- size: "icon",
1773
- className: tooltip.cn("h-8 w-8 text-muted-foreground", isSearchOpen && "bg-muted text-foreground"),
1774
- onClick: () => {
1775
- setIsSearchOpen(!isSearchOpen);
1776
- if (!isSearchOpen) setTimeout(() => {
1777
- var _a;
1778
- return (_a = searchInputRef.current) == null ? void 0 : _a.focus();
1779
- }, 100);
1780
- },
1781
- title: "Buscar",
1782
- "aria-label": "Buscar",
1783
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "w-4 h-4" })
1784
- }
1785
- ),
1786
- actionButton && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1787
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1" }),
1788
- actionButton
1789
- ] })
1790
- ] }),
1791
- isSearchOpen && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-3 py-1.5 border-b border-border bg-muted/20 flex items-center gap-2", children: [
1792
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex-1 max-w-sm", children: [
1793
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground" }),
1794
- /* @__PURE__ */ jsxRuntime.jsx(
1795
- input.Input,
1796
- {
1797
- ref: searchInputRef,
1798
- placeholder: "Buscar no texto...",
1799
- value: searchQuery,
1800
- onChange: (e) => setSearchQuery(e.target.value),
1801
- onKeyDown: (e) => {
1802
- if (e.key === "Enter") {
1803
- e.preventDefault();
1804
- performSearch(searchQuery, e.shiftKey);
1805
- }
1806
- if (e.key === "Escape") {
1807
- setIsSearchOpen(false);
1808
- }
1809
- },
1810
- className: "h-8 pl-8 text-xs bg-background"
1811
- }
1812
- )
1813
- ] }),
1814
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
1815
- /* @__PURE__ */ jsxRuntime.jsx(
1816
- tooltip.Button,
1817
- {
1818
- variant: "ghost",
1819
- size: "icon",
1820
- className: "h-7 w-7",
1821
- onMouseDown: (e) => e.preventDefault(),
1822
- onClick: () => performSearch(searchQuery, true),
1823
- title: "Anterior",
1824
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUp, { className: "w-4 h-4" })
1825
- }
1826
- ),
1827
- /* @__PURE__ */ jsxRuntime.jsx(
1828
- tooltip.Button,
1829
- {
1830
- variant: "ghost",
1831
- size: "icon",
1832
- className: "h-7 w-7",
1833
- onMouseDown: (e) => e.preventDefault(),
1834
- onClick: () => performSearch(searchQuery, false),
1835
- title: "Próximo",
1836
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "w-4 h-4" })
1837
- }
1838
- ),
1839
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-px h-4 bg-border mx-1" }),
1840
- /* @__PURE__ */ jsxRuntime.jsx(
1841
- tooltip.Button,
1842
- {
1843
- variant: "ghost",
1844
- size: "icon",
1845
- className: "h-7 w-7 text-muted-foreground hover:text-foreground",
1846
- onClick: () => setIsSearchOpen(false),
1847
- title: "Fechar busca",
1848
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "w-4 h-4" })
1849
- }
1850
- )
1851
- ] }),
1852
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "hidden sm:block text-[10px] text-muted-foreground ml-auto uppercase tracking-wider font-medium", children: "Pressione Enter para buscar" })
1853
- ] }),
1854
- /* @__PURE__ */ jsxRuntime.jsx(
1855
- "div",
1856
- {
1857
- className: "flex-1 overflow-y-auto p-4 sm:p-8 bg-background scrollbar-thin",
1858
- style: { minHeight, maxHeight },
1859
- children: /* @__PURE__ */ jsxRuntime.jsx(
1860
- "div",
1861
- {
1862
- ref: editorRef,
1863
- contentEditable: isEditable,
1864
- onInput: handleInput,
1865
- onSelect: isEditable ? updateActiveFormats : void 0,
1866
- onFocus: () => {
1867
- updateActiveFormats();
1868
- onFocus == null ? void 0 : onFocus();
1869
- },
1870
- onBlur,
1871
- className: "prose-editor min-h-full max-w-none focus:outline-none",
1872
- "data-placeholder": placeholder
1873
- }
1874
- )
1875
- }
1876
- ),
1877
- (showWordCount || showCharacterCount) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-4 py-2 border-t border-border bg-muted/20 flex items-center justify-between", children: [
1878
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-[10px] sm:text-xs text-muted-foreground font-medium uppercase tracking-wider flex items-center gap-2", children: [
1879
- showWordCount && /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
1880
- getWordCount(),
1881
- " ",
1882
- getWordCount() === 1 ? "palavra" : "palavras"
1883
- ] }),
1884
- showWordCount && showCharacterCount && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground/40", children: "•" }),
1885
- showCharacterCount && /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
1886
- getCharacterCount(),
1887
- " ",
1888
- getCharacterCount() === 1 ? "caractere" : "caracteres"
1889
- ] })
1890
- ] }),
1891
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[10px] sm:text-xs text-muted-foreground/60 italic", children: "Auto-save ativo" })
1892
- ] })
1893
- ] });
1894
- }
1895
- exports.Card = Card;
1896
- exports.CardAction = CardAction;
1897
- exports.CardContent = CardContent;
1898
- exports.CardDescription = CardDescription;
1899
- exports.CardFooter = CardFooter;
1900
- exports.CardHeader = CardHeader;
1901
- exports.CardTitle = CardTitle;
1902
- exports.ChartCard = ChartCard;
1903
- exports.ChartContainer = ChartContainer;
1904
- exports.ChartLegend = ChartLegend;
1905
- exports.ChartLegendContent = ChartLegendContent;
1906
- exports.ChartStyle = ChartStyle;
1907
- exports.ChartTooltip = ChartTooltip;
1908
- exports.ChartTooltipContent = ChartTooltipContent;
1909
- exports.ComboMetricChart = ComboMetricChart;
1910
- exports.DashboardBarChart = DashboardBarChart;
1911
- exports.DashboardLineChart = DashboardLineChart;
1912
- exports.Dialog = Dialog;
1913
- exports.DialogBody = DialogBody;
1914
- exports.DialogClose = DialogClose;
1915
- exports.DialogContent = DialogContent;
1916
- exports.DialogDescription = DialogDescription;
1917
- exports.DialogFooter = DialogFooter;
1918
- exports.DialogHeader = DialogHeader;
1919
- exports.DialogOverlay = DialogOverlay;
1920
- exports.DialogPortal = DialogPortal;
1921
- exports.DialogTitle = DialogTitle;
1922
- exports.DialogTrigger = DialogTrigger;
1923
- exports.DonutBreakdownChart = DonutBreakdownChart;
1924
- exports.HorizontalBarChart = HorizontalBarChart;
1925
- exports.InteractiveTimeSeriesChart = InteractiveTimeSeriesChart;
1926
- exports.RichTextEditor = RichTextEditor;
1927
- exports.Table = Table;
1928
- exports.TableBody = TableBody;
1929
- exports.TableCaption = TableCaption;
1930
- exports.TableCell = TableCell;
1931
- exports.TableFooter = TableFooter;
1932
- exports.TableHead = TableHead;
1933
- exports.TableHeader = TableHeader;
1934
- exports.TableRow = TableRow;
1935
- exports.Tabs = Tabs;
1936
- exports.TabsContent = TabsContent;
1937
- exports.TabsList = TabsList;
1938
- exports.TabsTrigger = TabsTrigger;
1939
- exports.Textarea = Textarea;