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.
- package/CHANGELOG.md +31 -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/bin/generate-tokens.ts +13 -7
- package/components/assistant/index.ts +6 -6
- package/components/assistant/xertica-assistant/index.ts +2 -0
- package/components/assistant/xertica-assistant/use-assistant.ts +564 -0
- package/components/assistant/xertica-assistant/xertica-assistant.stories.tsx +200 -0
- package/components/assistant/xertica-assistant/xertica-assistant.tsx +183 -474
- 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/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 +7 -7
- 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/index.ts +2 -0
- package/components/layout/sidebar/sidebar.mdx +1 -1
- package/components/layout/sidebar/sidebar.stories.tsx +160 -8
- package/components/layout/sidebar/sidebar.test.tsx +11 -11
- package/components/layout/sidebar/sidebar.tsx +610 -471
- package/components/layout/sidebar/use-sidebar.ts +113 -0
- package/components/media/FloatingMediaWrapper.tsx +11 -11
- package/components/media/audio-player/AudioPlayer.tsx +22 -22
- 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/HomePage.tsx +1 -1
- package/components/pages/home-page/home-page.mdx +53 -53
- package/components/pages/index.ts +8 -8
- package/components/pages/template-content/TemplateContent.tsx +5 -5
- 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/TemplatePage.tsx +5 -5
- 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/shared/layout-constants.ts +1 -1
- 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 -344
- package/components/ui/chart/chart.test.tsx +154 -154
- package/components/ui/chart/chart.tsx +2367 -1494
- 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.stories.tsx +100 -0
- package/components/ui/file-upload/file-upload.tsx +14 -74
- package/components/ui/file-upload/index.ts +1 -0
- package/components/ui/file-upload/use-file-upload.ts +181 -0
- 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/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/index.ts +2 -0
- package/components/ui/pagination/pagination.mdx +8 -8
- package/components/ui/pagination/pagination.stories.tsx +94 -0
- package/components/ui/pagination/use-pagination.ts +194 -0
- 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/index.ts +2 -0
- package/components/ui/rich-text-editor/rich-text-editor.stories.tsx +129 -1
- package/components/ui/rich-text-editor/rich-text-editor.tsx +86 -305
- package/components/ui/rich-text-editor/use-rich-text-editor.ts +439 -0
- 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/index.ts +3 -1
- package/components/ui/stepper/stepper.mdx +8 -8
- package/components/ui/stepper/stepper.stories.tsx +116 -0
- package/components/ui/stepper/stepper.tsx +4 -4
- package/components/ui/stepper/use-stepper.ts +137 -0
- 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/index.ts +4 -1
- package/components/ui/tree-view/tree-view.mdx +8 -8
- package/components/ui/tree-view/tree-view.stories.tsx +110 -4
- package/components/ui/tree-view/tree-view.tsx +17 -125
- package/components/ui/tree-view/use-tree-view.ts +229 -0
- package/components.json +1512 -1512
- package/contexts/ApiKeyContext.tsx +72 -72
- package/contexts/BrandColorsContext.tsx +26 -26
- package/contexts/LanguageContext.tsx +13 -13
- package/contexts/LayoutContext.test.tsx +11 -11
- package/contexts/LayoutContext.tsx +29 -29
- 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-BAx9VQvb.cjs → AssistantChart-CldVCVDe.cjs} +311 -94
- package/dist/{AssistantChart-CVko2A1W.js → AssistantChart-Cu3m7RBo.js} +314 -97
- package/dist/{AssistantChart-9w31gdAb.cjs → AssistantChart-DoZCyS5r.cjs} +4 -4
- package/dist/AudioPlayer-B1lt5cPl.cjs +989 -0
- package/dist/AudioPlayer-BZ7bibzU.cjs +982 -0
- package/dist/AudioPlayer-C12BjQBV.cjs +997 -0
- package/dist/AudioPlayer-DMcG_c7L.js +990 -0
- package/dist/AudioPlayer-DcFKRJE_.js +998 -0
- 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/ImageWithFallback-CGtidP6B.cjs +4542 -0
- package/dist/ImageWithFallback-lsg3pdFg.js +4508 -0
- 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-BE-L9mB7.js → VerifyEmailPage-C0c2e5n0.js} +7 -7
- package/dist/{VerifyEmailPage-DMBh4NM9.cjs → VerifyEmailPage-CYXtbKi3.cjs} +1 -1
- package/dist/{VerifyEmailPage-CR7kb5df.cjs → VerifyEmailPage-Cwi3kbol.cjs} +7 -7
- package/dist/{VerifyEmailPage-CdYPSJoO.js → VerifyEmailPage-DvMLZgFt.js} +1 -1
- package/dist/XerticaOrbe-KL1RBHzw.cjs +1354 -0
- package/dist/XerticaOrbe-zwS1p2a8.js +1355 -0
- package/dist/XerticaProvider-6btlAlzc.js +17 -0
- 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-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 +2 -1
- package/dist/assistant.es.js +3 -2
- 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 +14 -8
- package/dist/components/assistant/xertica-assistant/index.d.ts +2 -0
- package/dist/components/assistant/xertica-assistant/use-assistant.d.ts +126 -0
- package/dist/components/assistant/xertica-assistant/xertica-assistant.d.ts +7 -2
- 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/layout/sidebar/index.d.ts +2 -0
- package/dist/components/layout/sidebar/sidebar.d.ts +80 -0
- package/dist/components/layout/sidebar/use-sidebar.d.ts +22 -0
- package/dist/components/shared/layout-constants.d.ts +1 -1
- package/dist/components/ui/button/button.d.ts +1 -1
- package/dist/components/ui/chart/chart.d.ts +162 -5
- package/dist/components/ui/file-upload/file-upload.d.ts +2 -0
- package/dist/components/ui/file-upload/index.d.ts +1 -0
- package/dist/components/ui/file-upload/use-file-upload.d.ts +49 -0
- package/dist/components/ui/pagination/index.d.ts +2 -0
- package/dist/components/ui/pagination/use-pagination.d.ts +78 -0
- package/dist/components/ui/rich-text-editor/index.d.ts +2 -0
- package/dist/components/ui/rich-text-editor/use-rich-text-editor.d.ts +107 -0
- package/dist/components/ui/stepper/index.d.ts +3 -1
- package/dist/components/ui/stepper/stepper.d.ts +2 -2
- package/dist/components/ui/stepper/use-stepper.d.ts +60 -0
- package/dist/components/ui/tree-view/index.d.ts +4 -1
- package/dist/components/ui/tree-view/tree-view.d.ts +4 -6
- package/dist/components/ui/tree-view/use-tree-view.d.ts +60 -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 +1 -1
- package/dist/hooks.es.js +1 -1
- 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 +19 -8
- package/dist/index.es.js +39 -28
- 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 +89 -1
- package/dist/layout.es.js +90 -2
- package/dist/pages.cjs.js +1 -1
- package/dist/pages.es.js +1 -1
- 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-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-DgF8s7xW.js +2949 -0
- package/dist/rich-text-editor-Dxjw31Z4.js +2341 -0
- package/dist/rich-text-editor-DzP0Epmb.js +2356 -0
- package/dist/rich-text-editor-mWoaSCE4.cjs +2966 -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-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 +14 -4
- package/dist/ui.es.js +26 -16
- package/dist/use-mobile-B0hNy_Y6.cjs +4303 -0
- package/dist/use-mobile-BXuYROXM.js +4202 -0
- 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/use-mobile-CG2-SdXV.cjs +4235 -0
- 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/{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/ai-usage.md +28 -10
- package/docs/architecture.md +76 -0
- package/docs/components/assistant.md +159 -0
- 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 +354 -39
- package/docs/components/file-upload.md +119 -2
- package/docs/components/map.md +84 -84
- package/docs/components/pagination.md +187 -0
- package/docs/components/rich-text-editor.md +164 -0
- package/docs/components/sidebar.md +153 -4
- package/docs/components/stepper.md +157 -12
- package/docs/components/tree-view.md +164 -6
- package/docs/components/xertica-provider.md +24 -24
- package/docs/decision-tree.md +287 -287
- package/docs/getting-started.md +1 -1
- package/docs/guidelines.md +14 -8
- package/docs/layout.md +2 -2
- package/docs/llms.md +4 -4
- package/guidelines/Guidelines.md +252 -250
- 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 +327 -327
- 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/styles/xertica/tokens.css +41 -12
- package/templates/CLAUDE.md +182 -172
- package/templates/guidelines/Guidelines.md +325 -313
- package/templates/package.json +3 -3
- 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 +70 -70
- package/templates/src/features/auth/ui/LoginContent.tsx +90 -90
- package/templates/src/features/auth/ui/ResetPasswordContent.tsx +151 -151
- package/templates/src/features/auth/ui/SocialLoginButtons.tsx +59 -59
- package/templates/src/features/auth/ui/VerifyEmailContent.tsx +82 -82
- package/templates/src/features/home/index.ts +1 -1
- package/templates/src/features/home/ui/HomeContent.tsx +100 -100
- package/templates/src/features/template/index.ts +5 -5
- package/templates/src/features/template/ui/CrudTemplate.tsx +3 -3
- package/templates/src/features/template/ui/DashboardTemplate.tsx +3 -3
- package/templates/src/features/template/ui/FormTemplate.tsx +120 -120
- package/templates/src/features/template/ui/LoginTemplate.tsx +3 -3
- package/templates/src/pages/AssistantPage.tsx +328 -328
- package/templates/src/pages/ForgotPasswordPage.tsx +6 -6
- package/templates/src/pages/HomePage.tsx +57 -57
- package/templates/src/pages/LoginPage.tsx +10 -10
- package/templates/src/pages/ResetPasswordPage.tsx +6 -6
- package/templates/src/pages/TemplatePage.tsx +30 -30
- package/templates/src/pages/VerifyEmailPage.tsx +6 -6
- package/templates/src/shared/config/navigation.ts +20 -20
- package/templates/src/shared/lib/auth.ts +20 -20
- package/templates/src/shared/types/auth.ts +3 -3
- package/templates/src/styles/xertica/tokens.css +39 -10
- package/templates/tsconfig.json +5 -5
- package/utils/gemini.ts +140 -140
- package/dist/VerifyEmailPage-Bae2cBXT.cjs +0 -2827
- package/dist/VerifyEmailPage-CbgjOF0v.js +0 -2828
- package/dist/index-CkTUgOwX.js +0 -8
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
import { useRef, useState, useEffect, useCallback } from 'react';
|
|
2
|
+
|
|
3
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
4
|
+
// Types
|
|
5
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
6
|
+
|
|
7
|
+
export interface ActiveFormats {
|
|
8
|
+
bold: boolean;
|
|
9
|
+
italic: boolean;
|
|
10
|
+
underline: boolean;
|
|
11
|
+
justifyLeft: boolean;
|
|
12
|
+
justifyCenter: boolean;
|
|
13
|
+
justifyRight: boolean;
|
|
14
|
+
insertUnorderedList: boolean;
|
|
15
|
+
insertOrderedList: boolean;
|
|
16
|
+
link: boolean;
|
|
17
|
+
h1: boolean;
|
|
18
|
+
h2: boolean;
|
|
19
|
+
h3: boolean;
|
|
20
|
+
p: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface UseRichTextEditorProps {
|
|
24
|
+
/** Current HTML value of the editor */
|
|
25
|
+
value: string;
|
|
26
|
+
/** Called whenever the editor content changes */
|
|
27
|
+
onChange?: (value: string) => void;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface UseRichTextEditorReturn {
|
|
31
|
+
// ── Refs ──────────────────────────────────────────────────────────────────
|
|
32
|
+
/** Attach to the `contenteditable` div */
|
|
33
|
+
editorRef: React.RefObject<HTMLDivElement>;
|
|
34
|
+
/** Attach to the search `<input>` */
|
|
35
|
+
searchInputRef: React.RefObject<HTMLInputElement>;
|
|
36
|
+
/** Attach to the link URL `<input>` */
|
|
37
|
+
linkInputRef: React.RefObject<HTMLInputElement>;
|
|
38
|
+
|
|
39
|
+
// ── State ─────────────────────────────────────────────────────────────────
|
|
40
|
+
/** Map of currently active formatting commands */
|
|
41
|
+
activeFormats: ActiveFormats;
|
|
42
|
+
/** Whether the inline search bar is open */
|
|
43
|
+
isSearchOpen: boolean;
|
|
44
|
+
setIsSearchOpen: (open: boolean) => void;
|
|
45
|
+
/** Current search query string */
|
|
46
|
+
searchQuery: string;
|
|
47
|
+
setSearchQuery: (query: string) => void;
|
|
48
|
+
/** Current link URL being edited */
|
|
49
|
+
linkUrl: string;
|
|
50
|
+
setLinkUrl: (url: string) => void;
|
|
51
|
+
/** Whether the link popover is open */
|
|
52
|
+
isLinkOpen: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* True when the popover was opened with a non-collapsed text selection
|
|
55
|
+
* (or with the cursor inside an existing link). Use this to decide whether
|
|
56
|
+
* to show the link-insert form vs. the "select text first" hint.
|
|
57
|
+
*/
|
|
58
|
+
hasSavedSelection: boolean;
|
|
59
|
+
|
|
60
|
+
// ── Computed ──────────────────────────────────────────────────────────────
|
|
61
|
+
/** Word count of the editor content */
|
|
62
|
+
wordCount: number;
|
|
63
|
+
/** Character count of the editor content */
|
|
64
|
+
characterCount: number;
|
|
65
|
+
|
|
66
|
+
// ── Handlers ──────────────────────────────────────────────────────────────
|
|
67
|
+
/** Re-read the current selection and update `activeFormats` */
|
|
68
|
+
updateActiveFormats: () => void;
|
|
69
|
+
/** Execute a `document.execCommand` and sync state */
|
|
70
|
+
execCommand: (command: string, value?: string) => void;
|
|
71
|
+
/** Called on every `input` event of the editor */
|
|
72
|
+
handleInput: () => void;
|
|
73
|
+
/** Search forward or backward for `searchQuery` */
|
|
74
|
+
performSearch: (text: string, backward?: boolean) => void;
|
|
75
|
+
/** Create or update a hyperlink at the current selection */
|
|
76
|
+
handleCreateLink: () => void;
|
|
77
|
+
/** Remove the hyperlink at the current cursor position */
|
|
78
|
+
handleUnlink: () => void;
|
|
79
|
+
/** Handle link popover open/close (saves selection, pre-fills URL) */
|
|
80
|
+
onLinkPopoverOpenChange: (open: boolean) => void;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
84
|
+
// Hook
|
|
85
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* `useRichTextEditor` — Headless hook for the RichTextEditor component.
|
|
89
|
+
*
|
|
90
|
+
* Encapsulates all state, refs, and DOM-manipulation logic for a
|
|
91
|
+
* `contenteditable`-based rich text editor. Use this hook when you need to
|
|
92
|
+
* build a fully custom editor UI while reusing the same formatting logic as
|
|
93
|
+
* the default `RichTextEditor` component.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```tsx
|
|
97
|
+
* import { useRichTextEditor } from 'xertica-ui/ui';
|
|
98
|
+
*
|
|
99
|
+
* function MyEditor({ value, onChange }) {
|
|
100
|
+
* const {
|
|
101
|
+
* editorRef,
|
|
102
|
+
* activeFormats,
|
|
103
|
+
* execCommand,
|
|
104
|
+
* handleInput,
|
|
105
|
+
* wordCount,
|
|
106
|
+
* } = useRichTextEditor({ value, onChange });
|
|
107
|
+
*
|
|
108
|
+
* return (
|
|
109
|
+
* <div>
|
|
110
|
+
* <button
|
|
111
|
+
* onClick={() => execCommand('bold')}
|
|
112
|
+
* style={{ fontWeight: activeFormats.bold ? 'bold' : 'normal' }}
|
|
113
|
+
* >
|
|
114
|
+
* B
|
|
115
|
+
* </button>
|
|
116
|
+
* <div
|
|
117
|
+
* ref={editorRef}
|
|
118
|
+
* contentEditable
|
|
119
|
+
* onInput={handleInput}
|
|
120
|
+
* />
|
|
121
|
+
* <span>{wordCount} words</span>
|
|
122
|
+
* </div>
|
|
123
|
+
* );
|
|
124
|
+
* }
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
export function useRichTextEditor({
|
|
128
|
+
value,
|
|
129
|
+
onChange,
|
|
130
|
+
}: UseRichTextEditorProps): UseRichTextEditorReturn {
|
|
131
|
+
|
|
132
|
+
// ── Refs ────────────────────────────────────────────────────────────────────
|
|
133
|
+
const editorRef = useRef<HTMLDivElement>(null);
|
|
134
|
+
const searchInputRef = useRef<HTMLInputElement>(null);
|
|
135
|
+
const linkInputRef = useRef<HTMLInputElement>(null);
|
|
136
|
+
const savedSelection = useRef<Range | null>(null);
|
|
137
|
+
|
|
138
|
+
// ── State ───────────────────────────────────────────────────────────────────
|
|
139
|
+
const [activeFormats, setActiveFormats] = useState<ActiveFormats>({
|
|
140
|
+
bold: false,
|
|
141
|
+
italic: false,
|
|
142
|
+
underline: false,
|
|
143
|
+
justifyLeft: false,
|
|
144
|
+
justifyCenter: false,
|
|
145
|
+
justifyRight: false,
|
|
146
|
+
insertUnorderedList: false,
|
|
147
|
+
insertOrderedList: false,
|
|
148
|
+
link: false,
|
|
149
|
+
h1: false,
|
|
150
|
+
h2: false,
|
|
151
|
+
h3: false,
|
|
152
|
+
p: true,
|
|
153
|
+
});
|
|
154
|
+
const [isSearchOpen, setIsSearchOpen] = useState(false);
|
|
155
|
+
const [searchQuery, setSearchQuery] = useState('');
|
|
156
|
+
const [linkUrl, setLinkUrl] = useState('https://');
|
|
157
|
+
const [isLinkOpen, setIsLinkOpen] = useState(false);
|
|
158
|
+
const [hasSavedSelection, setHasSavedSelection] = useState(false);
|
|
159
|
+
|
|
160
|
+
// ── Helpers ─────────────────────────────────────────────────────────────────
|
|
161
|
+
|
|
162
|
+
const findParentTag = useCallback((node: Node | null, tagName: string): HTMLElement | null => {
|
|
163
|
+
let current = node;
|
|
164
|
+
while (current && current !== editorRef.current) {
|
|
165
|
+
if (current.nodeName === tagName) return current as HTMLElement;
|
|
166
|
+
current = current.parentNode;
|
|
167
|
+
}
|
|
168
|
+
return null;
|
|
169
|
+
}, []);
|
|
170
|
+
|
|
171
|
+
const updateActiveFormats = useCallback(() => {
|
|
172
|
+
let formatBlock = '';
|
|
173
|
+
try {
|
|
174
|
+
formatBlock = document.queryCommandValue('formatBlock');
|
|
175
|
+
} catch (_e) { /* ignore */ }
|
|
176
|
+
|
|
177
|
+
const selection = window.getSelection();
|
|
178
|
+
const anchorNode = selection?.anchorNode;
|
|
179
|
+
const focusNode = selection?.focusNode;
|
|
180
|
+
|
|
181
|
+
setActiveFormats({
|
|
182
|
+
bold: document.queryCommandState('bold'),
|
|
183
|
+
italic: document.queryCommandState('italic'),
|
|
184
|
+
underline: document.queryCommandState('underline'),
|
|
185
|
+
justifyLeft: document.queryCommandState('justifyLeft'),
|
|
186
|
+
justifyCenter: document.queryCommandState('justifyCenter'),
|
|
187
|
+
justifyRight: document.queryCommandState('justifyRight'),
|
|
188
|
+
insertUnorderedList: document.queryCommandState('insertUnorderedList'),
|
|
189
|
+
insertOrderedList: document.queryCommandState('insertOrderedList'),
|
|
190
|
+
link: !!(findParentTag(anchorNode || null, 'A') || findParentTag(focusNode || null, 'A')),
|
|
191
|
+
h1: formatBlock === 'h1' || formatBlock === 'H1',
|
|
192
|
+
h2: formatBlock === 'h2' || formatBlock === 'H2',
|
|
193
|
+
h3: formatBlock === 'h3' || formatBlock === 'H3',
|
|
194
|
+
p: formatBlock === 'p' || formatBlock === 'P' || formatBlock === 'div' || formatBlock === 'DIV' || formatBlock === '',
|
|
195
|
+
});
|
|
196
|
+
}, [findParentTag]);
|
|
197
|
+
|
|
198
|
+
// ── Effects ─────────────────────────────────────────────────────────────────
|
|
199
|
+
|
|
200
|
+
// Initialize editor content and listen for selection changes
|
|
201
|
+
useEffect(() => {
|
|
202
|
+
if (editorRef.current && editorRef.current.innerHTML !== value) {
|
|
203
|
+
editorRef.current.innerHTML = value;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
const handleSelectionChange = () => {
|
|
207
|
+
if (document.activeElement === editorRef.current) {
|
|
208
|
+
updateActiveFormats();
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
document.addEventListener('selectionchange', handleSelectionChange);
|
|
213
|
+
return () => document.removeEventListener('selectionchange', handleSelectionChange);
|
|
214
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
215
|
+
}, []);
|
|
216
|
+
|
|
217
|
+
// ── Computed ────────────────────────────────────────────────────────────────
|
|
218
|
+
|
|
219
|
+
const wordCount = (() => {
|
|
220
|
+
const text = editorRef.current?.innerText || '';
|
|
221
|
+
return text.trim() ? text.trim().split(/\s+/).length : 0;
|
|
222
|
+
})();
|
|
223
|
+
|
|
224
|
+
const characterCount = (() => {
|
|
225
|
+
const text = editorRef.current?.innerText || '';
|
|
226
|
+
return text.trim() ? text.length : 0;
|
|
227
|
+
})();
|
|
228
|
+
|
|
229
|
+
// ── Handlers ────────────────────────────────────────────────────────────────
|
|
230
|
+
|
|
231
|
+
const handleInput = useCallback(() => {
|
|
232
|
+
if (editorRef.current) {
|
|
233
|
+
onChange?.(editorRef.current.innerHTML);
|
|
234
|
+
updateActiveFormats();
|
|
235
|
+
}
|
|
236
|
+
}, [onChange, updateActiveFormats]);
|
|
237
|
+
|
|
238
|
+
const execCommand = useCallback((command: string, val: string = '') => {
|
|
239
|
+
document.execCommand(command, false, val);
|
|
240
|
+
updateActiveFormats();
|
|
241
|
+
editorRef.current?.focus();
|
|
242
|
+
if (editorRef.current) {
|
|
243
|
+
onChange?.(editorRef.current.innerHTML);
|
|
244
|
+
}
|
|
245
|
+
}, [onChange, updateActiveFormats]);
|
|
246
|
+
|
|
247
|
+
const performSearch = useCallback((text: string, backward = false) => {
|
|
248
|
+
if (!text || !editorRef.current) return;
|
|
249
|
+
|
|
250
|
+
const editor = editorRef.current;
|
|
251
|
+
const selection = window.getSelection();
|
|
252
|
+
if (!selection) return;
|
|
253
|
+
|
|
254
|
+
const walker = document.createTreeWalker(editor, NodeFilter.SHOW_TEXT);
|
|
255
|
+
const segments: Array<{ node: Text; start: number }> = [];
|
|
256
|
+
let offset = 0;
|
|
257
|
+
let node: Node | null;
|
|
258
|
+
while ((node = walker.nextNode())) {
|
|
259
|
+
segments.push({ node: node as Text, start: offset });
|
|
260
|
+
offset += (node as Text).length;
|
|
261
|
+
}
|
|
262
|
+
const fullText = segments.reduce((acc, s) => acc + (s.node.textContent ?? ''), '');
|
|
263
|
+
|
|
264
|
+
let searchFrom = 0;
|
|
265
|
+
if (selection.rangeCount > 0) {
|
|
266
|
+
const range = selection.getRangeAt(0);
|
|
267
|
+
if (editor.contains(range.startContainer)) {
|
|
268
|
+
const seg = segments.find(s => s.node === range.startContainer);
|
|
269
|
+
if (seg) {
|
|
270
|
+
searchFrom = backward
|
|
271
|
+
? seg.start + range.startOffset - 1
|
|
272
|
+
: seg.start + range.endOffset;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
const lowerFull = fullText.toLowerCase();
|
|
278
|
+
const lowerQuery = text.toLowerCase();
|
|
279
|
+
let matchStart = -1;
|
|
280
|
+
|
|
281
|
+
if (backward) {
|
|
282
|
+
matchStart = lowerFull.lastIndexOf(lowerQuery, Math.max(0, searchFrom));
|
|
283
|
+
if (matchStart === -1) matchStart = lowerFull.lastIndexOf(lowerQuery);
|
|
284
|
+
} else {
|
|
285
|
+
matchStart = lowerFull.indexOf(lowerQuery, searchFrom);
|
|
286
|
+
if (matchStart === -1) matchStart = lowerFull.indexOf(lowerQuery);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
if (matchStart === -1) return;
|
|
290
|
+
|
|
291
|
+
const matchEnd = matchStart + text.length;
|
|
292
|
+
const range = document.createRange();
|
|
293
|
+
let startSet = false;
|
|
294
|
+
let endSet = false;
|
|
295
|
+
|
|
296
|
+
for (let i = 0; i < segments.length && !endSet; i++) {
|
|
297
|
+
const seg = segments[i];
|
|
298
|
+
const segEnd = seg.start + seg.node.length;
|
|
299
|
+
|
|
300
|
+
if (!startSet && matchStart < segEnd && matchStart >= seg.start) {
|
|
301
|
+
range.setStart(seg.node, matchStart - seg.start);
|
|
302
|
+
startSet = true;
|
|
303
|
+
}
|
|
304
|
+
if (startSet && matchEnd <= segEnd) {
|
|
305
|
+
range.setEnd(seg.node, matchEnd - seg.start);
|
|
306
|
+
endSet = true;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
if (startSet && endSet) {
|
|
311
|
+
selection.removeAllRanges();
|
|
312
|
+
selection.addRange(range);
|
|
313
|
+
(range.startContainer as Element).parentElement?.scrollIntoView?.({ block: 'nearest' });
|
|
314
|
+
}
|
|
315
|
+
}, []);
|
|
316
|
+
|
|
317
|
+
const handleCreateLink = useCallback(() => {
|
|
318
|
+
if (savedSelection.current) {
|
|
319
|
+
const selection = window.getSelection();
|
|
320
|
+
selection?.removeAllRanges();
|
|
321
|
+
selection?.addRange(savedSelection.current);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
const selection = window.getSelection();
|
|
325
|
+
const anchorNode = selection?.anchorNode;
|
|
326
|
+
const existingLink = findParentTag(anchorNode || null, 'A');
|
|
327
|
+
|
|
328
|
+
if (existingLink) {
|
|
329
|
+
if (linkUrl) {
|
|
330
|
+
existingLink.setAttribute('href', linkUrl);
|
|
331
|
+
existingLink.setAttribute('target', '_blank');
|
|
332
|
+
existingLink.setAttribute('rel', 'noopener noreferrer');
|
|
333
|
+
existingLink.style.color = 'hsl(var(--primary))';
|
|
334
|
+
existingLink.style.textDecoration = 'underline';
|
|
335
|
+
existingLink.style.cursor = 'pointer';
|
|
336
|
+
}
|
|
337
|
+
handleInput();
|
|
338
|
+
setIsLinkOpen(false);
|
|
339
|
+
savedSelection.current = null;
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
if (!selection || selection.rangeCount === 0 || selection.isCollapsed) {
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
if (linkUrl) {
|
|
348
|
+
document.execCommand('createLink', false, linkUrl);
|
|
349
|
+
setTimeout(() => {
|
|
350
|
+
const anchor = findParentTag(window.getSelection()?.anchorNode || null, 'A');
|
|
351
|
+
if (anchor) {
|
|
352
|
+
anchor.setAttribute('target', '_blank');
|
|
353
|
+
anchor.setAttribute('rel', 'noopener noreferrer');
|
|
354
|
+
anchor.style.color = 'hsl(var(--primary))';
|
|
355
|
+
anchor.style.textDecoration = 'underline';
|
|
356
|
+
anchor.style.cursor = 'pointer';
|
|
357
|
+
}
|
|
358
|
+
handleInput();
|
|
359
|
+
}, 10);
|
|
360
|
+
setIsLinkOpen(false);
|
|
361
|
+
savedSelection.current = null;
|
|
362
|
+
}
|
|
363
|
+
}, [linkUrl, findParentTag, handleInput]);
|
|
364
|
+
|
|
365
|
+
const handleUnlink = useCallback(() => {
|
|
366
|
+
const selection = window.getSelection();
|
|
367
|
+
const anchorNode = selection?.anchorNode;
|
|
368
|
+
const existingLink = findParentTag(anchorNode || null, 'A');
|
|
369
|
+
|
|
370
|
+
if (existingLink) {
|
|
371
|
+
const parent = existingLink.parentNode;
|
|
372
|
+
while (existingLink.firstChild) {
|
|
373
|
+
parent?.insertBefore(existingLink.firstChild, existingLink);
|
|
374
|
+
}
|
|
375
|
+
parent?.removeChild(existingLink);
|
|
376
|
+
handleInput();
|
|
377
|
+
} else {
|
|
378
|
+
document.execCommand('unlink', false, '');
|
|
379
|
+
}
|
|
380
|
+
}, [findParentTag, handleInput]);
|
|
381
|
+
|
|
382
|
+
const onLinkPopoverOpenChange = useCallback((open: boolean) => {
|
|
383
|
+
if (open) {
|
|
384
|
+
const selection = window.getSelection();
|
|
385
|
+
const anchorNode = selection?.anchorNode;
|
|
386
|
+
const focusNode = selection?.focusNode;
|
|
387
|
+
const existingLink = findParentTag(anchorNode || null, 'A') || findParentTag(focusNode || null, 'A');
|
|
388
|
+
|
|
389
|
+
if (existingLink) {
|
|
390
|
+
setLinkUrl(existingLink.getAttribute('href') || 'https://');
|
|
391
|
+
} else {
|
|
392
|
+
setLinkUrl('https://');
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
// Save the selection whenever there is one (collapsed or not) so
|
|
396
|
+
// handleCreateLink can restore it after the popover steals focus.
|
|
397
|
+
// Also mark hasSavedSelection so the UI can show the insert form.
|
|
398
|
+
if (selection && selection.rangeCount > 0 && (!selection.isCollapsed || existingLink)) {
|
|
399
|
+
savedSelection.current = selection.getRangeAt(0).cloneRange();
|
|
400
|
+
setHasSavedSelection(true);
|
|
401
|
+
} else {
|
|
402
|
+
savedSelection.current = null;
|
|
403
|
+
setHasSavedSelection(false);
|
|
404
|
+
}
|
|
405
|
+
setTimeout(() => linkInputRef.current?.focus(), 100);
|
|
406
|
+
} else {
|
|
407
|
+
setHasSavedSelection(false);
|
|
408
|
+
}
|
|
409
|
+
setIsLinkOpen(open);
|
|
410
|
+
}, [findParentTag]);
|
|
411
|
+
|
|
412
|
+
return {
|
|
413
|
+
// Refs
|
|
414
|
+
editorRef,
|
|
415
|
+
searchInputRef,
|
|
416
|
+
linkInputRef,
|
|
417
|
+
// State
|
|
418
|
+
activeFormats,
|
|
419
|
+
isSearchOpen,
|
|
420
|
+
setIsSearchOpen,
|
|
421
|
+
searchQuery,
|
|
422
|
+
setSearchQuery,
|
|
423
|
+
linkUrl,
|
|
424
|
+
setLinkUrl,
|
|
425
|
+
isLinkOpen,
|
|
426
|
+
hasSavedSelection,
|
|
427
|
+
// Computed
|
|
428
|
+
wordCount,
|
|
429
|
+
characterCount,
|
|
430
|
+
// Handlers
|
|
431
|
+
updateActiveFormats,
|
|
432
|
+
execCommand,
|
|
433
|
+
handleInput,
|
|
434
|
+
performSearch,
|
|
435
|
+
handleCreateLink,
|
|
436
|
+
handleUnlink,
|
|
437
|
+
onLinkPopoverOpenChange,
|
|
438
|
+
};
|
|
439
|
+
}
|
|
@@ -10,14 +10,14 @@ import * as RouteMapStories from './route-map.stories';
|
|
|
10
10
|
|
|
11
11
|
<Primary />
|
|
12
12
|
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## Variations
|
|
16
|
-
|
|
17
|
-
<Stories />
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Variations
|
|
16
|
+
|
|
17
|
+
<Stories />
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
21
|
## AI Best Practices
|
|
22
22
|
|
|
23
23
|
> [!IMPORTANT]
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { RouteMap } from './route-map';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
|
|
5
|
-
function MapStoryFrame({ children }: { children: React.ReactNode }) {
|
|
6
|
-
return (
|
|
7
|
-
<div style={{ width: 'min(100vw - 48px, 960px)', minWidth: 320 }}>
|
|
8
|
-
{children}
|
|
9
|
-
</div>
|
|
10
|
-
);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const meta: Meta<typeof RouteMap> = {
|
|
14
|
-
title: 'UI/RouteMap',
|
|
15
|
-
component: RouteMap,
|
|
16
|
-
render: (args) => (
|
|
17
|
-
<MapStoryFrame>
|
|
18
|
-
<RouteMap {...args} />
|
|
19
|
-
</MapStoryFrame>
|
|
20
|
-
),
|
|
21
|
-
parameters: {
|
|
22
|
-
layout: 'centered',
|
|
23
|
-
},
|
|
24
|
-
argTypes: {
|
|
25
|
-
travelMode: {
|
|
26
|
-
control: 'select',
|
|
27
|
-
options: ['DRIVING', 'WALKING', 'BICYCLING', 'TRANSIT'],
|
|
28
|
-
},
|
|
29
|
-
height: { control: 'text' },
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export default meta;
|
|
34
|
-
type Story = StoryObj<typeof RouteMap>;
|
|
35
|
-
|
|
36
|
-
export const Default: Story = {
|
|
37
|
-
args: {
|
|
38
|
-
origin: { lat: -23.5505, lng: -46.6333 },
|
|
39
|
-
destination: { lat: -23.5617, lng: -46.6560 },
|
|
40
|
-
height: "400px",
|
|
41
|
-
onRouteCalculated: (dist, dur) => console.log(`Distance: ${dist}, Duration: ${dur}`),
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export const WithWaypoints: Story = {
|
|
46
|
-
args: {
|
|
47
|
-
origin: { lat: -23.5505, lng: -46.6333 },
|
|
48
|
-
destination: { lat: -23.5617, lng: -46.6560 },
|
|
49
|
-
waypoints: [
|
|
50
|
-
{ lat: -23.5550, lng: -46.6450 },
|
|
51
|
-
],
|
|
52
|
-
height: "500px",
|
|
53
|
-
},
|
|
54
|
-
};
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { RouteMap } from './route-map';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
function MapStoryFrame({ children }: { children: React.ReactNode }) {
|
|
6
|
+
return (
|
|
7
|
+
<div style={{ width: 'min(100vw - 48px, 960px)', minWidth: 320 }}>
|
|
8
|
+
{children}
|
|
9
|
+
</div>
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const meta: Meta<typeof RouteMap> = {
|
|
14
|
+
title: 'UI/RouteMap',
|
|
15
|
+
component: RouteMap,
|
|
16
|
+
render: (args) => (
|
|
17
|
+
<MapStoryFrame>
|
|
18
|
+
<RouteMap {...args} />
|
|
19
|
+
</MapStoryFrame>
|
|
20
|
+
),
|
|
21
|
+
parameters: {
|
|
22
|
+
layout: 'centered',
|
|
23
|
+
},
|
|
24
|
+
argTypes: {
|
|
25
|
+
travelMode: {
|
|
26
|
+
control: 'select',
|
|
27
|
+
options: ['DRIVING', 'WALKING', 'BICYCLING', 'TRANSIT'],
|
|
28
|
+
},
|
|
29
|
+
height: { control: 'text' },
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default meta;
|
|
34
|
+
type Story = StoryObj<typeof RouteMap>;
|
|
35
|
+
|
|
36
|
+
export const Default: Story = {
|
|
37
|
+
args: {
|
|
38
|
+
origin: { lat: -23.5505, lng: -46.6333 },
|
|
39
|
+
destination: { lat: -23.5617, lng: -46.6560 },
|
|
40
|
+
height: "400px",
|
|
41
|
+
onRouteCalculated: (dist, dur) => console.log(`Distance: ${dist}, Duration: ${dur}`),
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const WithWaypoints: Story = {
|
|
46
|
+
args: {
|
|
47
|
+
origin: { lat: -23.5505, lng: -46.6333 },
|
|
48
|
+
destination: { lat: -23.5617, lng: -46.6560 },
|
|
49
|
+
waypoints: [
|
|
50
|
+
{ lat: -23.5550, lng: -46.6450 },
|
|
51
|
+
],
|
|
52
|
+
height: "500px",
|
|
53
|
+
},
|
|
54
|
+
};
|
|
@@ -188,7 +188,7 @@ const RouteMapContent = React.forwardRef<HTMLDivElement, RouteMapProps & { apiKe
|
|
|
188
188
|
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
|
|
189
189
|
</svg>
|
|
190
190
|
</div>
|
|
191
|
-
<p className="text-sm font-medium text-foreground">Failed to load Google Maps</p>
|
|
191
|
+
<p className="text-sm font-medium text-foreground">Failed to load Google Maps</p>
|
|
192
192
|
<p className="text-xs text-muted-foreground">Check API key in Settings</p>
|
|
193
193
|
</div>
|
|
194
194
|
</div>
|
|
@@ -298,4 +298,4 @@ export const RouteMap = React.forwardRef<HTMLDivElement, RouteMapProps>(
|
|
|
298
298
|
);
|
|
299
299
|
}
|
|
300
300
|
);
|
|
301
|
-
RouteMap.displayName = "RouteMap";
|
|
301
|
+
RouteMap.displayName = "RouteMap";
|
|
@@ -10,14 +10,14 @@ import * as ScrollAreaStories from './scroll-area.stories';
|
|
|
10
10
|
|
|
11
11
|
<Primary />
|
|
12
12
|
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## Variations
|
|
16
|
-
|
|
17
|
-
<Stories />
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Variations
|
|
16
|
+
|
|
17
|
+
<Stories />
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
21
|
## AI Best Practices
|
|
22
22
|
|
|
23
23
|
> [!IMPORTANT]
|
|
@@ -10,14 +10,14 @@ import * as SearchStories from './search.stories';
|
|
|
10
10
|
|
|
11
11
|
<Primary />
|
|
12
12
|
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## Variations
|
|
16
|
-
|
|
17
|
-
<Stories />
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Variations
|
|
16
|
+
|
|
17
|
+
<Stories />
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
21
|
## AI Best Practices
|
|
22
22
|
|
|
23
23
|
> [!IMPORTANT]
|
|
@@ -10,14 +10,14 @@ import * as SelectStories from './select.stories';
|
|
|
10
10
|
|
|
11
11
|
<Primary />
|
|
12
12
|
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## Variations
|
|
16
|
-
|
|
17
|
-
<Stories />
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Variations
|
|
16
|
+
|
|
17
|
+
<Stories />
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
21
|
## AI Best Practices
|
|
22
22
|
|
|
23
23
|
> [!IMPORTANT]
|