xertica-ui 2.1.4 → 2.1.6
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.
- package/CHANGELOG.md +56 -0
- package/README.md +1 -1
- package/assets/xertica-logo.svg +37 -37
- package/assets/xertica-x-logo.svg +20 -20
- package/bin/cli.ts +1 -1
- package/components/assistant/index.ts +6 -6
- package/components/assistant/xertica-assistant/hooks/index.ts +8 -0
- package/components/assistant/xertica-assistant/hooks/use-assistant-conversations.ts +119 -0
- package/components/assistant/xertica-assistant/hooks/use-assistant-messages.ts +323 -0
- package/components/assistant/xertica-assistant/hooks/use-assistant-suggestions.ts +64 -0
- package/components/assistant/xertica-assistant/use-assistant.ts +294 -559
- package/components/assistant/xertica-assistant/xertica-assistant.tsx +5 -13
- package/components/blocks/card-patterns/ActivityCard.tsx +72 -72
- package/components/blocks/card-patterns/FeatureCard.tsx +100 -100
- package/components/blocks/card-patterns/NotificationCard.tsx +127 -127
- package/components/blocks/card-patterns/ProfileCard.tsx +84 -84
- package/components/blocks/card-patterns/ProjectCard.tsx +89 -89
- package/components/blocks/card-patterns/QuickActionCard.tsx +62 -62
- package/components/blocks/card-patterns/card-patterns.stories.tsx +445 -445
- package/components/blocks/card-patterns/card-patterns.test.tsx +448 -0
- package/components/blocks/card-patterns/index.ts +17 -17
- package/components/blocks/index.ts +1 -1
- package/components/brand/index.ts +6 -6
- package/components/brand/xertica-provider/XerticaProvider.tsx +48 -48
- package/components/brand/xertica-provider/xertica-provider.mdx +61 -61
- package/components/brand/xertica-provider/xertica-provider.test.tsx +52 -52
- package/components/examples/MapExamples.tsx +282 -282
- package/components/examples/SimpleFilterableMap.tsx +191 -191
- package/components/examples/index.ts +51 -51
- package/components/figma/ImageWithFallback.tsx +27 -27
- package/components/hooks/index.ts +12 -0
- package/components/index.ts +5 -5
- package/components/layout/header/header.test.tsx +8 -8
- package/components/layout/header/header.tsx +4 -4
- package/components/layout/index.ts +2 -2
- package/components/layout/sidebar/sidebar.mdx +1 -1
- package/components/layout/sidebar/sidebar.test.tsx +11 -11
- package/components/layout/sidebar/sidebar.tsx +25 -10
- package/components/media/FloatingMediaWrapper.tsx +11 -11
- package/components/media/audio-player/use-audio-player.ts +15 -5
- package/components/media/index.ts +3 -3
- package/components/pages/home-content/HomeContent.tsx +7 -7
- package/components/pages/home-content/home-content.mdx +62 -62
- package/components/pages/home-page/HomePage.stories.tsx +39 -39
- package/components/pages/home-page/home-page.mdx +53 -53
- package/components/pages/index.ts +8 -8
- package/components/pages/template-content/template-content.mdx +61 -61
- package/components/pages/template-page/TemplatePage.stories.tsx +39 -39
- package/components/pages/template-page/template-page.mdx +53 -53
- package/components/public-api-smoke.test.tsx +52 -52
- package/components/shared/assistant-utils.ts +43 -43
- package/components/ui/accordion/accordion.mdx +8 -8
- package/components/ui/accordion/accordion.stories.tsx +53 -53
- package/components/ui/alert/alert.mdx +8 -8
- package/components/ui/alert-dialog/alert-dialog.mdx +8 -8
- package/components/ui/aspect-ratio/aspect-ratio.mdx +8 -8
- package/components/ui/assistant-chart/assistant-chart.mdx +8 -8
- package/components/ui/avatar/avatar.mdx +8 -8
- package/components/ui/badge/badge.mdx +8 -8
- package/components/ui/badge/badge.tsx +9 -9
- package/components/ui/breadcrumb/breadcrumb.mdx +8 -8
- package/components/ui/button/button.mdx +8 -8
- package/components/ui/calendar/calendar.mdx +8 -8
- package/components/ui/calendar/calendar.tsx +258 -258
- package/components/ui/card/card.mdx +8 -8
- package/components/ui/card/card.stories.tsx +245 -245
- package/components/ui/carousel/carousel.mdx +8 -8
- package/components/ui/chart/chart.mdx +8 -8
- package/components/ui/chart/chart.stories.tsx +1303 -1303
- package/components/ui/chart/chart.test.tsx +254 -83
- package/components/ui/chart/chart.tsx +79 -2367
- package/components/ui/chart/parts/chart-dashboard.tsx +1025 -0
- package/components/ui/chart/parts/chart-metric.tsx +622 -0
- package/components/ui/chart/parts/chart-primitives.tsx +432 -0
- package/components/ui/chart/parts/chart-shared.tsx +201 -0
- package/components/ui/chart/parts/chart-utils.ts +145 -0
- package/components/ui/chart/parts/index.ts +5 -0
- package/components/ui/checkbox/checkbox.mdx +8 -8
- package/components/ui/checkbox/checkbox.stories.tsx +20 -20
- package/components/ui/collapsible/collapsible.mdx +8 -8
- package/components/ui/command/command.mdx +8 -8
- package/components/ui/context-menu/context-menu.mdx +8 -8
- package/components/ui/dialog/dialog.mdx +8 -8
- package/components/ui/drawer/drawer.mdx +8 -8
- package/components/ui/dropdown-menu/dropdown-menu.mdx +8 -8
- package/components/ui/empty/empty.mdx +8 -8
- package/components/ui/file-upload/file-upload.mdx +8 -8
- package/components/ui/file-upload/file-upload.test.tsx +6 -2
- package/components/ui/file-upload/file-upload.tsx +17 -5
- package/components/ui/file-upload/use-file-upload.test.ts +173 -0
- package/components/ui/file-upload/use-file-upload.ts +76 -25
- package/components/ui/google-maps-loader/google-maps-loader.tsx +2 -2
- package/components/ui/hover-card/hover-card.mdx +8 -8
- package/components/ui/index.ts +1 -1
- package/components/ui/input/input.mdx +8 -8
- package/components/ui/input-otp/input-otp.mdx +8 -8
- package/components/ui/input-otp/input-otp.stories.tsx +6 -6
- package/components/ui/label/label.mdx +8 -8
- package/components/ui/map/map.mdx +8 -8
- package/components/ui/map/map.stories.tsx +51 -51
- package/components/ui/map/map.tsx +2 -2
- package/components/ui/menubar/menubar.mdx +8 -8
- package/components/ui/navigation-menu/navigation-menu.mdx +8 -8
- package/components/ui/notification-badge/notification-badge.mdx +8 -8
- package/components/ui/pagination/pagination.mdx +8 -8
- package/components/ui/pagination/pagination.tsx +17 -0
- package/components/ui/pagination/use-pagination.test.ts +104 -0
- package/components/ui/pagination/use-pagination.ts +33 -16
- package/components/ui/popover/popover.mdx +8 -8
- package/components/ui/progress/progress.mdx +8 -8
- package/components/ui/progress/progress.tsx +68 -68
- package/components/ui/radio-group/radio-group.mdx +8 -8
- package/components/ui/rating/rating.mdx +8 -8
- package/components/ui/resizable/resizable.mdx +8 -8
- package/components/ui/rich-text-editor/rich-text-editor.tsx +9 -3
- package/components/ui/rich-text-editor/use-rich-text-editor.test.ts +110 -0
- package/components/ui/rich-text-editor/use-rich-text-editor.ts +42 -15
- package/components/ui/route-map/route-map.mdx +8 -8
- package/components/ui/route-map/route-map.stories.tsx +54 -54
- package/components/ui/route-map/route-map.tsx +2 -2
- package/components/ui/scroll-area/scroll-area.mdx +8 -8
- package/components/ui/search/search.mdx +8 -8
- package/components/ui/select/select.mdx +8 -8
- package/components/ui/select/select.stories.tsx +9 -9
- package/components/ui/separator/separator.mdx +8 -8
- package/components/ui/sheet/sheet.mdx +8 -8
- package/components/ui/sheet/sheet.stories.tsx +95 -95
- package/components/ui/simple-map/simple-map.mdx +8 -8
- package/components/ui/simple-map/simple-map.stories.tsx +48 -48
- package/components/ui/skeleton/skeleton.mdx +8 -8
- package/components/ui/slider/slider.mdx +8 -8
- package/components/ui/sonner/sonner.mdx +8 -8
- package/components/ui/stats-card/stats-card.mdx +8 -8
- package/components/ui/stepper/stepper.mdx +8 -8
- package/components/ui/stepper/stepper.tsx +21 -2
- package/components/ui/stepper/use-stepper.test.ts +109 -0
- package/components/ui/stepper/use-stepper.ts +4 -1
- package/components/ui/switch/switch.mdx +8 -8
- package/components/ui/switch/switch.stories.tsx +20 -20
- package/components/ui/table/table.mdx +8 -8
- package/components/ui/tabs/tabs.mdx +8 -8
- package/components/ui/tabs/tabs.stories.tsx +26 -26
- package/components/ui/textarea/textarea.mdx +8 -8
- package/components/ui/timeline/timeline.mdx +8 -8
- package/components/ui/toggle/toggle.mdx +8 -8
- package/components/ui/toggle-group/toggle-group.mdx +8 -8
- package/components/ui/tooltip/tooltip.mdx +8 -8
- package/components/ui/tree-view/tree-view.mdx +8 -8
- package/components/ui/tree-view/tree-view.tsx +29 -4
- package/components/ui/tree-view/use-tree-view.test.ts +91 -0
- package/components/ui/tree-view/use-tree-view.ts +38 -19
- package/components.json +1512 -1512
- package/contexts/ApiKeyContext.tsx +72 -72
- package/contexts/LanguageContext.tsx +13 -13
- package/contexts/LayoutContext.test.tsx +11 -11
- package/contexts/ThemeContext.tsx +26 -26
- package/contexts/theme-data.ts +4 -4
- package/dist/{AssistantChart-CVzmmhx4.js → AssistantChart-C_hwFRRr.js} +4 -4
- package/dist/{AssistantChart-BAudAfne.cjs → AssistantChart-CldVCVDe.cjs} +5 -5
- package/dist/{AssistantChart-BP8upjMk.js → AssistantChart-Cu3m7RBo.js} +5 -5
- package/dist/AssistantChart-DIpshm3i.js +4784 -0
- package/dist/{AssistantChart-9w31gdAb.cjs → AssistantChart-DoZCyS5r.cjs} +4 -4
- package/dist/AssistantChart-zjsy2GaZ.cjs +4810 -0
- package/dist/AudioPlayer-B1lt5cPl.cjs +989 -0
- package/dist/AudioPlayer-BZ7bibzU.cjs +982 -0
- package/dist/AudioPlayer-C12BjQBV.cjs +997 -0
- package/dist/{AudioPlayer-DuKXrCfy.js → AudioPlayer-CGRUtUdN.js} +1 -1
- package/dist/AudioPlayer-DMcG_c7L.js +990 -0
- package/dist/AudioPlayer-DcFKRJE_.js +998 -0
- package/dist/{AudioPlayer-1ypwE2Wh.cjs → AudioPlayer-IAU5q5T1.cjs} +1 -1
- package/dist/AudioPlayer-e8LfNoqO.js +983 -0
- package/dist/{xertica-assistant-Qp3ydksa.cjs → CodeBlock-7TTgmdGG.cjs} +263 -51
- package/dist/{xertica-assistant-gnCJdcZY.js → CodeBlock-BeSt1h5P.js} +219 -7
- package/dist/CodeBlock-BgfYL_rD.cjs +2094 -0
- package/dist/CodeBlock-BlcqlA9M.cjs +2094 -0
- package/dist/CodeBlock-Bnmeu5ez.cjs +2094 -0
- package/dist/CodeBlock-BtfPlbAI.js +2078 -0
- package/dist/CodeBlock-CIySIuYr.js +2078 -0
- package/dist/CodeBlock-CuPtUM-7.cjs +2094 -0
- package/dist/CodeBlock-D6ffWXgc.js +2078 -0
- package/dist/CodeBlock-D8dcwbit.cjs +2094 -0
- package/dist/CodeBlock-DMZrFnlw.cjs +2094 -0
- package/dist/CodeBlock-DlBehYN8.js +2078 -0
- package/dist/CodeBlock-DnYNI8rQ.js +2078 -0
- package/dist/CodeBlock-DvKWbSnE.cjs +2094 -0
- package/dist/CodeBlock-DwMCfkFY.js +2078 -0
- package/dist/CodeBlock-Dy6CNYyj.js +2078 -0
- package/dist/CodeBlock-U1pPOQI7.cjs +2094 -0
- package/dist/CodeBlock-f_GpNhEB.js +2078 -0
- package/dist/CodeBlock-oB6u8nI1.js +2078 -0
- package/dist/CodeBlock-tZC31B73.cjs +2094 -0
- package/dist/FeatureCard-CxC-7C-C.cjs +300 -0
- package/dist/FeatureCard-DbHWCb4E.js +301 -0
- package/dist/ImageWithFallback-CGtidP6B.cjs +4542 -0
- package/dist/ImageWithFallback-lsg3pdFg.js +4508 -0
- package/dist/{LanguageContext-DvUt5jBg.cjs → LanguageContext-B_KFTCzT.cjs} +2 -2
- package/dist/{LanguageContext-BwhwC3G2.js → LanguageContext-CS14yCpi.js} +2 -2
- package/dist/LanguageSelector-B5YfbHra.js +231 -0
- package/dist/LanguageSelector-D6uacAIM.cjs +230 -0
- package/dist/LayoutContext-BAql6ZRY.js +97 -0
- package/dist/LayoutContext-BvK-ggDa.cjs +96 -0
- package/dist/ThemeContext-BoH4NLfN.js +734 -0
- package/dist/{ThemeContext-BbBNoFTG.js → ThemeContext-C2EwAPDt.js} +2 -2
- package/dist/ThemeContext-r69W20Xg.cjs +733 -0
- package/dist/{ThemeContext-Cmr8Ex8H.cjs → ThemeContext-vTjumZeM.cjs} +2 -2
- package/dist/{VerifyEmailPage-C_ihbcth.js → VerifyEmailPage-C0c2e5n0.js} +6 -6
- package/dist/{VerifyEmailPage-DMBh4NM9.cjs → VerifyEmailPage-CYXtbKi3.cjs} +1 -1
- package/dist/{VerifyEmailPage-CbgjOF0v.js → VerifyEmailPage-CqKsR2v8.js} +10 -11
- package/dist/{VerifyEmailPage-Bae2cBXT.cjs → VerifyEmailPage-Cwi3kbol.cjs} +7 -7
- package/dist/{VerifyEmailPage-CdYPSJoO.js → VerifyEmailPage-DvMLZgFt.js} +1 -1
- package/dist/{VerifyEmailPage-Dt7zgA4w.cjs → VerifyEmailPage-s-1X3LDJ.cjs} +142 -143
- package/dist/XerticaOrbe-KL1RBHzw.cjs +1354 -0
- package/dist/XerticaOrbe-zwS1p2a8.js +1355 -0
- package/dist/XerticaProvider-6btlAlzc.js +17 -0
- package/dist/{XerticaProvider-siSt9uG2.js → XerticaProvider-B7EVH-NF.js} +2 -2
- package/dist/XerticaProvider-BNoNOxQ5.cjs +16 -0
- package/dist/XerticaProvider-BlY2limY.cjs +38 -0
- package/dist/{XerticaProvider-BITjgC5p.js → XerticaProvider-CEoWMTxu.js} +2 -2
- package/dist/{XerticaProvider-By8q3Roe.cjs → XerticaProvider-CllrbMEJ.cjs} +2 -2
- package/dist/XerticaProvider-DDuiIcKo.js +39 -0
- package/dist/{XerticaProvider-CW9hpCdF.cjs → XerticaProvider-ET0ihewn.cjs} +2 -2
- package/dist/XerticaProvider-cI9hSs27.cjs +38 -0
- package/dist/XerticaProvider-hSwhNQex.js +39 -0
- package/dist/{alert-dialog-yckpaOpy.cjs → alert-dialog-DSKByiKZ.cjs} +3 -3
- package/dist/{alert-dialog-iDe5VE5o.js → alert-dialog-s-vmNkJ_.js} +3 -3
- package/dist/assistant.cjs.js +1 -1
- package/dist/assistant.es.js +1 -1
- package/dist/blocks.cjs.js +1 -1
- package/dist/blocks.es.js +1 -1
- package/dist/brand.cjs.js +1 -1
- package/dist/brand.es.js +1 -1
- package/dist/breadcrumb-CqJ7bHY5.js +161 -0
- package/dist/breadcrumb-m9Hb2_XN.cjs +177 -0
- package/dist/cli.js +1 -1
- package/dist/components/assistant/xertica-assistant/hooks/index.d.ts +6 -0
- package/dist/components/assistant/xertica-assistant/hooks/use-assistant-conversations.d.ts +21 -0
- package/dist/components/assistant/xertica-assistant/hooks/use-assistant-messages.d.ts +49 -0
- package/dist/components/assistant/xertica-assistant/hooks/use-assistant-suggestions.d.ts +16 -0
- package/dist/components/assistant/xertica-assistant/xertica-assistant.d.ts +5 -13
- package/dist/components/blocks/audio-player/AudioPlayer.d.ts +35 -0
- package/dist/components/blocks/audio-player/index.d.ts +1 -0
- package/dist/components/blocks/document-editor/DocumentEditor.d.ts +26 -0
- package/dist/components/blocks/document-editor/index.d.ts +1 -0
- package/dist/components/blocks/podcast-player/PodcastPlayer.d.ts +41 -0
- package/dist/components/blocks/podcast-player/index.d.ts +1 -0
- package/dist/components/hooks/index.d.ts +10 -0
- package/dist/components/ui/chart/chart.d.ts +9 -324
- package/dist/components/ui/chart/parts/chart-dashboard.d.ts +113 -0
- package/dist/components/ui/chart/parts/chart-metric.d.ts +118 -0
- package/dist/components/ui/chart/parts/chart-primitives.d.ts +101 -0
- package/dist/components/ui/chart/parts/chart-shared.d.ts +20 -0
- package/dist/components/ui/chart/parts/chart-utils.d.ts +12 -0
- package/dist/components/ui/chart/parts/index.d.ts +5 -0
- package/dist/components/ui/file-upload/use-file-upload.d.ts +9 -15
- package/dist/components/ui/index.d.ts +1 -1
- package/dist/components/ui/pagination/pagination.d.ts +5 -3
- package/dist/components/ui/tree-view/tree-view.d.ts +2 -0
- package/dist/dropdown-menu-BDB5CmQs.cjs +247 -0
- package/dist/dropdown-menu-DQidbKBD.js +231 -0
- package/dist/google-maps-loader-BFWp6VPd.js +287 -0
- package/dist/{google-maps-loader-t2IlYBzw.js → google-maps-loader-CTYySAun.js} +4 -0
- package/dist/{google-maps-loader-BqsYL48U.cjs → google-maps-loader-Y-QkD-Li.cjs} +5 -0
- package/dist/google-maps-loader-eS3uQ5TA.cjs +287 -0
- package/dist/header-Cgy6vYPk.cjs +731 -0
- package/dist/header-DRlT4jgI.js +715 -0
- package/dist/header-Dux00SI4.cjs +731 -0
- package/dist/header-EkGKXPsD.js +715 -0
- package/dist/header-WfEywpyc.cjs +731 -0
- package/dist/header-tifNQn2U.js +715 -0
- package/dist/hooks.cjs.js +9 -2
- package/dist/hooks.es.js +10 -3
- package/dist/index-BhapVLVj.js +8 -0
- package/dist/{index-D3RLKRAs.cjs → index-COtD8bRW.cjs} +1 -1
- package/dist/index-D6fxYEY8.cjs +7 -0
- package/dist/index-DW5tYe26.js +8 -0
- package/dist/index.cjs.js +54 -40
- package/dist/index.es.js +259 -245
- package/dist/index.umd.js +1043 -470
- package/dist/input-2R4loU86.js +127 -0
- package/dist/input-DWANSKGb.cjs +145 -0
- package/dist/layout.cjs.js +1 -1
- package/dist/layout.es.js +1 -1
- package/dist/media.cjs.js +1 -1
- package/dist/media.es.js +1 -1
- package/dist/pages.cjs.js +1 -1
- package/dist/pages.es.js +1 -1
- package/dist/progress-DPtzoVV8.js +175 -0
- package/dist/progress-EeaoqqUs.cjs +191 -0
- package/dist/rich-text-editor-0mraWT5y.cjs +2376 -0
- package/dist/rich-text-editor-B6jMRLzk.cjs +1939 -0
- package/dist/rich-text-editor-B8_oYcIR.js +1730 -0
- package/dist/rich-text-editor-B9UbSXNb.js +1203 -0
- package/dist/rich-text-editor-BYuRBNBU.js +2373 -0
- package/dist/rich-text-editor-Bb9pySTs.cjs +2374 -0
- package/dist/rich-text-editor-BcL6L3cm.cjs +2374 -0
- package/dist/rich-text-editor-BoVZYtTs.cjs +2391 -0
- package/dist/rich-text-editor-CMgSN_w2.js +1189 -0
- package/dist/rich-text-editor-CPV1lEPH.cjs +1748 -0
- package/dist/rich-text-editor-CoKqbCtu.cjs +1799 -0
- package/dist/rich-text-editor-Cw56T_mB.js +2356 -0
- package/dist/rich-text-editor-Cyt8qs2b.js +1921 -0
- package/dist/rich-text-editor-D6H84OcX.cjs +1220 -0
- package/dist/rich-text-editor-D76gD-QI.js +2328 -0
- package/dist/rich-text-editor-DKkokOnA.js +1781 -0
- package/dist/rich-text-editor-DNsdpN64.cjs +2359 -0
- package/dist/rich-text-editor-DfG8bCyY.js +2358 -0
- package/dist/rich-text-editor-Dxjw31Z4.js +2341 -0
- package/dist/rich-text-editor-DzP0Epmb.js +2356 -0
- package/dist/rich-text-editor-lyYE2ZG5.cjs +1207 -0
- package/dist/rich-text-editor-skplNlBM.cjs +2345 -0
- package/dist/select-Bkbr0f-Z.cjs +162 -0
- package/dist/select-CvIVdX2n.js +145 -0
- package/dist/{sidebar-CmvwjnVb.js → sidebar-BViy8Eeu.js} +17 -9
- package/dist/{sidebar-CVUGHOS_.cjs → sidebar-BxGXsDAd.cjs} +16 -8
- package/dist/sidebar-CK_0ZQHj.cjs +803 -0
- package/dist/sidebar-CUuOvYhK.js +787 -0
- package/dist/slider-Bc5Hd0y1.js +56 -0
- package/dist/slider-N7hFFj6X.cjs +73 -0
- package/dist/tooltip-Ded96neP.cjs +137 -0
- package/dist/tooltip-HDOoD2-0.js +120 -0
- package/dist/ui.cjs.js +48 -34
- package/dist/ui.es.js +237 -223
- package/dist/{use-audio-player-Dn1NR9xN.cjs → use-audio-player-NKsWyjWu.cjs} +7 -3
- package/dist/{use-audio-player-Bkh23vQ3.js → use-audio-player-nv8ZSGa1.js} +7 -3
- package/dist/use-file-upload-BcjEo2S5.js +404 -0
- package/dist/use-file-upload-CRJR68Tj.cjs +403 -0
- package/dist/use-mobile-B0hNy_Y6.cjs +4303 -0
- package/dist/{AssistantChart-CVko2A1W.js → use-mobile-BXuYROXM.js} +1025 -171
- package/dist/use-mobile-Bbd51ASU.cjs +4392 -0
- package/dist/use-mobile-Bk6CX-TC.js +4359 -0
- package/dist/use-mobile-BvYdisLP.js +4202 -0
- package/dist/use-mobile-BzuxjzNX.cjs +4392 -0
- package/dist/{AssistantChart-BAx9VQvb.cjs → use-mobile-CG2-SdXV.cjs} +1070 -209
- package/dist/use-mobile-CKb5pqTs.js +4269 -0
- package/dist/use-mobile-CYuAuGDl.js +4202 -0
- package/dist/use-mobile-CaENcqm-.js +4508 -0
- package/dist/use-mobile-CbrYgJGJ.js +4203 -0
- package/dist/use-mobile-DMOvImGQ.cjs +4542 -0
- package/dist/use-mobile-DRB3BQgD.cjs +4235 -0
- package/dist/use-mobile-DZvv7QMR.js +4359 -0
- package/dist/use-mobile-DdI_TXam.cjs +4235 -0
- package/dist/use-mobile-DlceKf8a.js +4359 -0
- package/dist/use-mobile-DsOnow1o.cjs +4236 -0
- package/dist/use-mobile-Kcj6jSnK.cjs +4392 -0
- package/dist/use-mobile-bnKcua_i.js +4202 -0
- package/dist/use-mobile-ncXBeE2z.cjs +4235 -0
- package/dist/use-rich-text-editor-DjiddBGv.js +282 -0
- package/dist/use-rich-text-editor-lpeswbCs.cjs +281 -0
- package/dist/{xertica-assistant-BMqdyRVi.js → xertica-assistant-BdiZag0h.js} +232 -127
- package/dist/{xertica-assistant-Bj3vBCq_.cjs → xertica-assistant-DUBpmEgo.cjs} +231 -126
- package/dist/{xertica-assistant-B1IaHXnB.cjs → xertica-assistant-dyP7KHM5.cjs} +533 -392
- package/dist/{xertica-assistant-DPsESB6t.js → xertica-assistant-yX1CFBBo.js} +535 -394
- package/dist/xertica-ui.css +2 -2
- package/docs/components/calendar.md +154 -154
- package/docs/components/card-patterns.md +337 -337
- package/docs/components/card.md +235 -235
- package/docs/components/chart.md +11 -0
- package/docs/components/file-upload.md +15 -9
- package/docs/components/hooks.md +479 -0
- package/docs/components/map.md +84 -84
- package/docs/components/pagination.md +16 -5
- package/docs/components/rich-text-editor.md +2 -1
- package/docs/components/sidebar.md +43 -11
- package/docs/components/stepper.md +1 -0
- package/docs/components/tree-view.md +3 -2
- package/docs/components/xertica-provider.md +24 -24
- package/docs/decision-tree.md +287 -287
- package/guidelines/Guidelines.md +252 -252
- package/hooks/useTheme.ts +3 -3
- package/imports/Podcast.tsx +388 -388
- package/imports/XerticaAi.tsx +45 -45
- package/imports/XerticaX.tsx +19 -19
- package/imports/svg-aueiaqngck.ts +11 -11
- package/imports/svg-v9krss1ozd.ts +16 -16
- package/imports/svg-vhrdofe3qe.ts +5 -5
- package/llms-compact.txt +376 -327
- package/llms-full.txt +8 -3
- package/llms.txt +160 -160
- package/package.json +203 -203
- package/styles/xertica/app-overrides/chat.css +61 -61
- package/styles/xertica/app-overrides/scrollbar.css +33 -33
- package/styles/xertica/integrations/google-maps.css +76 -76
- package/styles/xertica/integrations/sonner.css +73 -73
- package/templates/CLAUDE.md +231 -182
- package/templates/README.md +152 -0
- package/templates/guidelines/Guidelines.md +560 -325
- package/templates/package.json +5 -2
- package/templates/src/app/App.tsx +6 -1
- package/templates/src/app/components/AppLayout.tsx +7 -5
- package/templates/src/app/components/AuthGuard.tsx +53 -30
- package/templates/src/features/auth/index.ts +4 -4
- package/templates/src/features/auth/ui/AuthPageShell.tsx +34 -34
- package/templates/src/features/auth/ui/ForgotPasswordContent.tsx +68 -70
- package/templates/src/features/auth/ui/LoginContent.tsx +91 -90
- package/templates/src/features/auth/ui/ResetPasswordContent.tsx +152 -151
- package/templates/src/features/auth/ui/SocialLoginButtons.tsx +59 -59
- package/templates/src/features/auth/ui/VerifyEmailContent.tsx +80 -82
- package/templates/src/features/home/index.ts +1 -1
- package/templates/src/features/home/ui/HomeContent.tsx +119 -100
- package/templates/src/features/settings/index.ts +1 -0
- package/templates/src/features/settings/ui/SettingsContent.tsx +210 -0
- package/templates/src/features/template/index.ts +5 -5
- package/templates/src/features/template/ui/CrudTemplate.tsx +268 -106
- package/templates/src/features/template/ui/DashboardTemplate.tsx +201 -101
- package/templates/src/features/template/ui/FormTemplate.tsx +227 -120
- package/templates/src/features/template/ui/LoginTemplate.tsx +4 -6
- package/templates/src/pages/AssistantPage.tsx +333 -328
- package/templates/src/pages/ForgotPasswordPage.tsx +6 -6
- package/templates/src/pages/HomePage.tsx +47 -57
- package/templates/src/pages/LoginPage.tsx +10 -10
- package/templates/src/pages/NotFoundPage.tsx +29 -0
- package/templates/src/pages/ResetPasswordPage.tsx +6 -6
- package/templates/src/pages/SettingsPage.tsx +21 -0
- package/templates/src/pages/TemplatePage.tsx +30 -30
- package/templates/src/pages/VerifyEmailPage.tsx +6 -6
- package/templates/src/shared/config/assistant.ts +20 -0
- package/templates/src/shared/config/navigation.ts +21 -20
- package/templates/src/shared/lib/api.ts +79 -0
- package/templates/src/shared/lib/auth.ts +31 -20
- package/templates/src/shared/types/auth.ts +9 -3
- package/templates/src/shared/ui/PageContent.tsx +35 -0
- package/templates/src/styles/index.css +2 -2
- package/templates/src/vite-env.d.ts +12 -0
- package/templates/tsconfig.json +5 -5
- package/utils/gemini.ts +140 -140
- package/dist/VerifyEmailPage-BE-L9mB7.js +0 -2828
- package/dist/VerifyEmailPage-CR7kb5df.cjs +0 -2827
- package/dist/index-CkTUgOwX.js +0 -8
- package/dist/{rich-text-editor-BmsjY03B.js → rich-text-editor-DgF8s7xW.js} +26 -26
- package/dist/{rich-text-editor-GS2kpTAK.cjs → rich-text-editor-mWoaSCE4.cjs} +26 -26
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const React = require("react");
|
|
3
|
+
function usePagination({
|
|
4
|
+
totalItems,
|
|
5
|
+
pageSize = 10,
|
|
6
|
+
initialPage = 1,
|
|
7
|
+
page: controlledPage,
|
|
8
|
+
onPageChange,
|
|
9
|
+
siblingCount = 1
|
|
10
|
+
}) {
|
|
11
|
+
const [internalPage, setInternalPage] = React.useState(initialPage);
|
|
12
|
+
const isControlled = controlledPage !== void 0;
|
|
13
|
+
const currentPage = isControlled ? controlledPage : internalPage;
|
|
14
|
+
const totalPages = Math.max(1, Math.ceil(totalItems / pageSize));
|
|
15
|
+
const setPage = React.useCallback(
|
|
16
|
+
(p) => {
|
|
17
|
+
const clamped = Math.min(Math.max(1, p), totalPages);
|
|
18
|
+
if (!isControlled) setInternalPage(clamped);
|
|
19
|
+
onPageChange == null ? void 0 : onPageChange(clamped);
|
|
20
|
+
},
|
|
21
|
+
[isControlled, onPageChange, totalPages]
|
|
22
|
+
);
|
|
23
|
+
const startIndex = (currentPage - 1) * pageSize;
|
|
24
|
+
const endIndex = Math.min(startIndex + pageSize, totalItems);
|
|
25
|
+
const canGoPrev = currentPage > 1;
|
|
26
|
+
const canGoNext = currentPage < totalPages;
|
|
27
|
+
const isFirstPage = currentPage === 1;
|
|
28
|
+
const isLastPage = currentPage === totalPages;
|
|
29
|
+
const items = React.useMemo(() => {
|
|
30
|
+
const range = (start, end) => Array.from({ length: Math.max(0, end - start + 1) }, (_, i) => start + i);
|
|
31
|
+
const leftSibling = Math.max(currentPage - siblingCount, 1);
|
|
32
|
+
const rightSibling = Math.min(currentPage + siblingCount, totalPages);
|
|
33
|
+
const showLeftEllipsis = leftSibling > 2;
|
|
34
|
+
const showRightEllipsis = rightSibling < totalPages - 1;
|
|
35
|
+
const pageNumbers = [];
|
|
36
|
+
pageNumbers.push(1);
|
|
37
|
+
if (!showLeftEllipsis) {
|
|
38
|
+
for (const p of range(2, leftSibling - 1)) pageNumbers.push(p);
|
|
39
|
+
}
|
|
40
|
+
for (const p of range(Math.max(leftSibling, 2), Math.min(rightSibling, totalPages - 1))) {
|
|
41
|
+
pageNumbers.push(p);
|
|
42
|
+
}
|
|
43
|
+
if (!showRightEllipsis) {
|
|
44
|
+
for (const p of range(rightSibling + 1, totalPages - 1)) pageNumbers.push(p);
|
|
45
|
+
}
|
|
46
|
+
if (totalPages > 1) pageNumbers.push(totalPages);
|
|
47
|
+
const seen = /* @__PURE__ */ new Set();
|
|
48
|
+
const deduped = pageNumbers.filter((p) => {
|
|
49
|
+
if (seen.has(p)) return false;
|
|
50
|
+
seen.add(p);
|
|
51
|
+
return true;
|
|
52
|
+
});
|
|
53
|
+
const result = [];
|
|
54
|
+
for (let i = 0; i < deduped.length; i++) {
|
|
55
|
+
result.push({ type: "page", page: deduped[i] });
|
|
56
|
+
if (i < deduped.length - 1 && deduped[i + 1] - deduped[i] > 1) {
|
|
57
|
+
result.push({ type: "ellipsis", key: `ellipsis-${deduped[i]}` });
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return result;
|
|
61
|
+
}, [currentPage, siblingCount, totalPages]);
|
|
62
|
+
const goTo = React.useCallback((p) => setPage(p), [setPage]);
|
|
63
|
+
const next = React.useCallback(() => setPage(currentPage + 1), [currentPage, setPage]);
|
|
64
|
+
const prev = React.useCallback(() => setPage(currentPage - 1), [currentPage, setPage]);
|
|
65
|
+
const first = React.useCallback(() => setPage(1), [setPage]);
|
|
66
|
+
const last = React.useCallback(() => setPage(totalPages), [setPage, totalPages]);
|
|
67
|
+
return {
|
|
68
|
+
currentPage,
|
|
69
|
+
totalPages,
|
|
70
|
+
startIndex,
|
|
71
|
+
endIndex,
|
|
72
|
+
canGoPrev,
|
|
73
|
+
canGoNext,
|
|
74
|
+
isFirstPage,
|
|
75
|
+
isLastPage,
|
|
76
|
+
items,
|
|
77
|
+
goTo,
|
|
78
|
+
next,
|
|
79
|
+
prev,
|
|
80
|
+
first,
|
|
81
|
+
last
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function findParent(nodes, targetId) {
|
|
85
|
+
var _a;
|
|
86
|
+
for (const n of nodes) {
|
|
87
|
+
if ((_a = n.children) == null ? void 0 : _a.some((c) => c.id === targetId)) return n;
|
|
88
|
+
if (n.children) {
|
|
89
|
+
const found = findParent(n.children, targetId);
|
|
90
|
+
if (found) return found;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
function useTreeView({
|
|
96
|
+
data,
|
|
97
|
+
defaultExpanded = [],
|
|
98
|
+
selectedNodeId,
|
|
99
|
+
onNodeClick,
|
|
100
|
+
onNodeSelect
|
|
101
|
+
}) {
|
|
102
|
+
const [expanded, setExpanded] = React.useState(new Set(defaultExpanded));
|
|
103
|
+
const [internalSelectedId, setInternalSelectedId] = React.useState(void 0);
|
|
104
|
+
const nodeRefs = React.useRef(/* @__PURE__ */ new Map());
|
|
105
|
+
const isControlled = selectedNodeId !== void 0;
|
|
106
|
+
const effectiveSelectedId = isControlled ? selectedNodeId : internalSelectedId;
|
|
107
|
+
const getNodeRef = React.useCallback(
|
|
108
|
+
(nodeId) => (el) => {
|
|
109
|
+
if (el) nodeRefs.current.set(nodeId, el);
|
|
110
|
+
else nodeRefs.current.delete(nodeId);
|
|
111
|
+
},
|
|
112
|
+
[]
|
|
113
|
+
);
|
|
114
|
+
const getVisibleNodes = React.useCallback(() => {
|
|
115
|
+
const result = [];
|
|
116
|
+
const traverse = (nodes) => {
|
|
117
|
+
var _a;
|
|
118
|
+
for (const node of nodes) {
|
|
119
|
+
result.push(node);
|
|
120
|
+
if (((_a = node.children) == null ? void 0 : _a.length) && expanded.has(node.id)) traverse(node.children);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
traverse(data);
|
|
124
|
+
return result;
|
|
125
|
+
}, [data, expanded]);
|
|
126
|
+
const toggleExpand = React.useCallback((nodeId) => {
|
|
127
|
+
setExpanded((prev) => {
|
|
128
|
+
const next = new Set(prev);
|
|
129
|
+
next.has(nodeId) ? next.delete(nodeId) : next.add(nodeId);
|
|
130
|
+
return next;
|
|
131
|
+
});
|
|
132
|
+
}, []);
|
|
133
|
+
const handleSelect = React.useCallback(
|
|
134
|
+
(node) => {
|
|
135
|
+
if (!isControlled) setInternalSelectedId(node.id);
|
|
136
|
+
onNodeSelect == null ? void 0 : onNodeSelect(node);
|
|
137
|
+
onNodeClick == null ? void 0 : onNodeClick(node);
|
|
138
|
+
},
|
|
139
|
+
[isControlled, onNodeClick, onNodeSelect]
|
|
140
|
+
);
|
|
141
|
+
const handleKeyDown = React.useCallback(
|
|
142
|
+
(e, node) => {
|
|
143
|
+
var _a, _b;
|
|
144
|
+
const visibleNodes = getVisibleNodes();
|
|
145
|
+
const idx = visibleNodes.findIndex((n) => n.id === node.id);
|
|
146
|
+
const hasChildren = !!((_a = node.children) == null ? void 0 : _a.length);
|
|
147
|
+
const isExpanded = expanded.has(node.id);
|
|
148
|
+
const focusNode = (id) => {
|
|
149
|
+
var _a2;
|
|
150
|
+
(_a2 = nodeRefs.current.get(id)) == null ? void 0 : _a2.focus();
|
|
151
|
+
};
|
|
152
|
+
switch (e.key) {
|
|
153
|
+
case "ArrowDown": {
|
|
154
|
+
e.preventDefault();
|
|
155
|
+
const next = visibleNodes[idx + 1];
|
|
156
|
+
if (next) focusNode(next.id);
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
case "ArrowUp": {
|
|
160
|
+
e.preventDefault();
|
|
161
|
+
const prev = visibleNodes[idx - 1];
|
|
162
|
+
if (prev) focusNode(prev.id);
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
case "ArrowRight": {
|
|
166
|
+
e.preventDefault();
|
|
167
|
+
if (hasChildren && !isExpanded) {
|
|
168
|
+
toggleExpand(node.id);
|
|
169
|
+
} else if (hasChildren && isExpanded && ((_b = node.children) == null ? void 0 : _b.length)) {
|
|
170
|
+
focusNode(node.children[0].id);
|
|
171
|
+
}
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
case "ArrowLeft": {
|
|
175
|
+
e.preventDefault();
|
|
176
|
+
if (hasChildren && isExpanded) {
|
|
177
|
+
toggleExpand(node.id);
|
|
178
|
+
} else {
|
|
179
|
+
const parent = findParent(data, node.id);
|
|
180
|
+
if (parent) focusNode(parent.id);
|
|
181
|
+
}
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
case "Home": {
|
|
185
|
+
e.preventDefault();
|
|
186
|
+
if (visibleNodes.length > 0) focusNode(visibleNodes[0].id);
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
case "End": {
|
|
190
|
+
e.preventDefault();
|
|
191
|
+
const last = visibleNodes[visibleNodes.length - 1];
|
|
192
|
+
if (last) focusNode(last.id);
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
case "Enter": {
|
|
196
|
+
e.preventDefault();
|
|
197
|
+
if (hasChildren) toggleExpand(node.id);
|
|
198
|
+
handleSelect(node);
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
case " ": {
|
|
202
|
+
e.preventDefault();
|
|
203
|
+
if (hasChildren) {
|
|
204
|
+
toggleExpand(node.id);
|
|
205
|
+
} else {
|
|
206
|
+
handleSelect(node);
|
|
207
|
+
}
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
[data, expanded, getVisibleNodes, handleSelect, toggleExpand]
|
|
213
|
+
);
|
|
214
|
+
return {
|
|
215
|
+
expanded,
|
|
216
|
+
effectiveSelectedId,
|
|
217
|
+
nodeRefs,
|
|
218
|
+
getNodeRef,
|
|
219
|
+
toggleExpand,
|
|
220
|
+
handleSelect,
|
|
221
|
+
handleKeyDown,
|
|
222
|
+
getVisibleNodes
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
function useStepper({
|
|
226
|
+
totalSteps,
|
|
227
|
+
initialStep = 1,
|
|
228
|
+
step: controlledStep,
|
|
229
|
+
onStepChange,
|
|
230
|
+
onBeforeNext
|
|
231
|
+
}) {
|
|
232
|
+
const [internalStep, setInternalStep] = React.useState(
|
|
233
|
+
() => Math.min(Math.max(1, initialStep), totalSteps)
|
|
234
|
+
);
|
|
235
|
+
const isControlled = controlledStep !== void 0;
|
|
236
|
+
const currentStep = isControlled ? controlledStep : internalStep;
|
|
237
|
+
const setStep = React.useCallback(
|
|
238
|
+
(s) => {
|
|
239
|
+
const clamped = Math.min(Math.max(1, s), totalSteps);
|
|
240
|
+
if (!isControlled) setInternalStep(clamped);
|
|
241
|
+
onStepChange == null ? void 0 : onStepChange(clamped);
|
|
242
|
+
},
|
|
243
|
+
[isControlled, onStepChange, totalSteps]
|
|
244
|
+
);
|
|
245
|
+
const isFirstStep = currentStep === 1;
|
|
246
|
+
const isLastStep = currentStep === totalSteps;
|
|
247
|
+
const canGoPrev = currentStep > 1;
|
|
248
|
+
const canGoNext = currentStep < totalSteps;
|
|
249
|
+
const next = React.useCallback(async () => {
|
|
250
|
+
if (!canGoNext) return;
|
|
251
|
+
if (onBeforeNext) {
|
|
252
|
+
const allowed = await onBeforeNext(currentStep);
|
|
253
|
+
if (!allowed) return;
|
|
254
|
+
}
|
|
255
|
+
setStep(currentStep + 1);
|
|
256
|
+
}, [canGoNext, currentStep, onBeforeNext, setStep]);
|
|
257
|
+
const prev = React.useCallback(() => {
|
|
258
|
+
if (!canGoPrev) return;
|
|
259
|
+
setStep(currentStep - 1);
|
|
260
|
+
}, [canGoPrev, currentStep, setStep]);
|
|
261
|
+
const goTo = React.useCallback((s) => setStep(s), [setStep]);
|
|
262
|
+
const reset = React.useCallback(() => setStep(1), [setStep]);
|
|
263
|
+
return {
|
|
264
|
+
currentStep,
|
|
265
|
+
totalSteps,
|
|
266
|
+
isFirstStep,
|
|
267
|
+
isLastStep,
|
|
268
|
+
canGoPrev,
|
|
269
|
+
canGoNext,
|
|
270
|
+
next,
|
|
271
|
+
prev,
|
|
272
|
+
goTo,
|
|
273
|
+
reset
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
function matchesAccept(file, accept) {
|
|
277
|
+
const tokens = accept.split(",").map((t) => t.trim().toLowerCase());
|
|
278
|
+
return tokens.some((token) => {
|
|
279
|
+
if (token.startsWith(".")) return file.name.toLowerCase().endsWith(token);
|
|
280
|
+
if (token.endsWith("/*")) return file.type.startsWith(token.slice(0, -1));
|
|
281
|
+
return file.type === token;
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
function useFileUpload({
|
|
285
|
+
maxFiles = 1,
|
|
286
|
+
maxSize = 5 * 1024 * 1024,
|
|
287
|
+
onFilesChange,
|
|
288
|
+
onError,
|
|
289
|
+
disabled = false,
|
|
290
|
+
accept
|
|
291
|
+
} = {}) {
|
|
292
|
+
const [files, setFiles] = React.useState([]);
|
|
293
|
+
const [dragActive, setDragActive] = React.useState(false);
|
|
294
|
+
const [errorMessage, setErrorMessage] = React.useState(null);
|
|
295
|
+
const inputRef = React.useRef(null);
|
|
296
|
+
const handleFiles = React.useCallback(
|
|
297
|
+
(newFiles) => {
|
|
298
|
+
if (!newFiles) return;
|
|
299
|
+
setErrorMessage(null);
|
|
300
|
+
const filesArray = accept ? Array.from(newFiles).filter((f) => matchesAccept(f, accept)) : Array.from(newFiles);
|
|
301
|
+
const oversized = filesArray.filter((f) => f.size > maxSize);
|
|
302
|
+
const validFiles = filesArray.filter((f) => f.size <= maxSize);
|
|
303
|
+
let pendingError = null;
|
|
304
|
+
if (oversized.length > 0) {
|
|
305
|
+
const limitMB = (maxSize / 1024 / 1024).toFixed(0);
|
|
306
|
+
pendingError = {
|
|
307
|
+
msg: `${oversized.length} arquivo(s) excedem o limite de ${limitMB}MB e não foram adicionados.`,
|
|
308
|
+
files: oversized,
|
|
309
|
+
reason: "size"
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
setFiles((prev) => {
|
|
313
|
+
const merged = maxFiles === 1 ? validFiles.slice(0, 1) : [...prev, ...validFiles].slice(0, maxFiles);
|
|
314
|
+
const countRejected = maxFiles === 1 ? validFiles.slice(1) : [...prev, ...validFiles].slice(maxFiles);
|
|
315
|
+
if (countRejected.length > 0) {
|
|
316
|
+
pendingError = {
|
|
317
|
+
msg: `Apenas ${maxFiles} arquivo(s) permitido(s). ${countRejected.length} arquivo(s) não foram adicionados.`,
|
|
318
|
+
files: countRejected,
|
|
319
|
+
reason: "count"
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
onFilesChange == null ? void 0 : onFilesChange(merged);
|
|
323
|
+
return merged;
|
|
324
|
+
});
|
|
325
|
+
if (pendingError) {
|
|
326
|
+
setErrorMessage(pendingError.msg);
|
|
327
|
+
onError == null ? void 0 : onError(pendingError.files, pendingError.reason);
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
[maxFiles, maxSize, onError, onFilesChange]
|
|
331
|
+
);
|
|
332
|
+
const handleDrag = React.useCallback((e) => {
|
|
333
|
+
e.preventDefault();
|
|
334
|
+
e.stopPropagation();
|
|
335
|
+
if (e.type === "dragenter" || e.type === "dragover") {
|
|
336
|
+
setDragActive(true);
|
|
337
|
+
} else if (e.type === "dragleave") {
|
|
338
|
+
setDragActive(false);
|
|
339
|
+
}
|
|
340
|
+
}, []);
|
|
341
|
+
const handleDrop = React.useCallback(
|
|
342
|
+
(e) => {
|
|
343
|
+
e.preventDefault();
|
|
344
|
+
e.stopPropagation();
|
|
345
|
+
setDragActive(false);
|
|
346
|
+
if (disabled) return;
|
|
347
|
+
handleFiles(e.dataTransfer.files);
|
|
348
|
+
},
|
|
349
|
+
[disabled, handleFiles]
|
|
350
|
+
);
|
|
351
|
+
const handleChange = React.useCallback(
|
|
352
|
+
(e) => {
|
|
353
|
+
e.preventDefault();
|
|
354
|
+
if (disabled) return;
|
|
355
|
+
handleFiles(e.target.files);
|
|
356
|
+
},
|
|
357
|
+
[disabled, handleFiles]
|
|
358
|
+
);
|
|
359
|
+
const removeFile = React.useCallback(
|
|
360
|
+
(index) => {
|
|
361
|
+
setFiles((prev) => {
|
|
362
|
+
const updated = prev.filter((_, i) => i !== index);
|
|
363
|
+
onFilesChange == null ? void 0 : onFilesChange(updated);
|
|
364
|
+
if (updated.length === 0) setErrorMessage(null);
|
|
365
|
+
return updated;
|
|
366
|
+
});
|
|
367
|
+
if (inputRef.current) {
|
|
368
|
+
inputRef.current.value = "";
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
[onFilesChange]
|
|
372
|
+
);
|
|
373
|
+
const openFileDialog = React.useCallback(() => {
|
|
374
|
+
var _a;
|
|
375
|
+
if (!disabled) {
|
|
376
|
+
setErrorMessage(null);
|
|
377
|
+
(_a = inputRef.current) == null ? void 0 : _a.click();
|
|
378
|
+
}
|
|
379
|
+
}, [disabled]);
|
|
380
|
+
const clearFiles = React.useCallback(() => {
|
|
381
|
+
setFiles([]);
|
|
382
|
+
setErrorMessage(null);
|
|
383
|
+
onFilesChange == null ? void 0 : onFilesChange([]);
|
|
384
|
+
if (inputRef.current) inputRef.current.value = "";
|
|
385
|
+
}, [onFilesChange]);
|
|
386
|
+
return {
|
|
387
|
+
files,
|
|
388
|
+
dragActive,
|
|
389
|
+
errorMessage,
|
|
390
|
+
inputRef,
|
|
391
|
+
handleFiles,
|
|
392
|
+
handleDrag,
|
|
393
|
+
handleDrop,
|
|
394
|
+
handleChange,
|
|
395
|
+
removeFile,
|
|
396
|
+
openFileDialog,
|
|
397
|
+
clearFiles
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
exports.useFileUpload = useFileUpload;
|
|
401
|
+
exports.usePagination = usePagination;
|
|
402
|
+
exports.useStepper = useStepper;
|
|
403
|
+
exports.useTreeView = useTreeView;
|