xertica-ui 2.1.2 → 2.1.3

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