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