xertica-ui 2.1.10 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +525 -469
- package/README.md +382 -299
- package/assets/xertica-logo.svg +37 -37
- package/assets/xertica-x-logo.svg +20 -20
- package/bin/cli.ts +748 -548
- package/bin/generate-tokens.ts +262 -262
- package/bin/language-config.ts +361 -0
- package/components/assets/xertica-orbe-animation.ts +1162 -1162
- package/components/assistant/code-block/CodeBlock.tsx +268 -266
- package/components/assistant/code-block/code-block.stories.tsx +57 -57
- package/components/assistant/code-block/code-block.test.tsx +44 -44
- package/components/assistant/code-block/index.ts +1 -1
- package/components/assistant/formatted-document/FormattedDocument.tsx +147 -145
- package/components/assistant/formatted-document/formatted-document.stories.tsx +51 -51
- package/components/assistant/formatted-document/formatted-document.test.tsx +42 -42
- package/components/assistant/formatted-document/index.ts +1 -1
- package/components/assistant/index.ts +6 -6
- package/components/assistant/markdown-message/MarkdownMessage.tsx +152 -152
- package/components/assistant/markdown-message/index.ts +1 -1
- package/components/assistant/markdown-message/markdown-message.stories.tsx +50 -50
- package/components/assistant/markdown-message/markdown-message.test.tsx +33 -33
- package/components/assistant/modern-chat-input/ModernChatInput.tsx +36 -31
- package/components/assistant/modern-chat-input/index.ts +1 -1
- package/components/assistant/modern-chat-input/modern-chat-input.stories.tsx +131 -131
- package/components/assistant/modern-chat-input/modern-chat-input.test.tsx +79 -79
- package/components/assistant/xertica-assistant/index.ts +3 -3
- package/components/assistant/xertica-assistant/parts/AssistantCollapsedView.tsx +99 -97
- package/components/assistant/xertica-assistant/parts/AssistantConversationList.tsx +106 -104
- package/components/assistant/xertica-assistant/parts/AssistantDocumentEditor.tsx +81 -79
- package/components/assistant/xertica-assistant/parts/AssistantFeedbackDialog.tsx +78 -74
- package/components/assistant/xertica-assistant/parts/AssistantHeader.tsx +75 -73
- package/components/assistant/xertica-assistant/parts/AssistantMessageBubble.tsx +560 -558
- package/components/assistant/xertica-assistant/parts/AssistantTabBar.tsx +67 -65
- package/components/assistant/xertica-assistant/parts/AssistantTypingIndicator.tsx +41 -41
- package/components/assistant/xertica-assistant/parts/AssistantWelcomeScreen.tsx +103 -101
- package/components/assistant/xertica-assistant/parts/index.ts +16 -16
- package/components/assistant/xertica-assistant/types.ts +134 -134
- package/components/assistant/xertica-assistant/use-assistant.ts +615 -608
- package/components/assistant/xertica-assistant/xertica-assistant.stories.tsx +407 -407
- package/components/assistant/xertica-assistant/xertica-assistant.test.tsx +65 -65
- package/components/assistant/xertica-assistant/xertica-assistant.tsx +613 -609
- package/components/blocks/card-patterns/ActivityCard.tsx +100 -81
- package/components/blocks/card-patterns/ActivityCardSkeleton.tsx +56 -0
- package/components/blocks/card-patterns/FeatureCard.tsx +109 -109
- package/components/blocks/card-patterns/FeatureCardSkeleton.tsx +63 -0
- package/components/blocks/card-patterns/NotificationCard.tsx +140 -137
- package/components/blocks/card-patterns/NotificationCardSkeleton.tsx +81 -0
- package/components/blocks/card-patterns/ProfileCard.tsx +114 -100
- package/components/blocks/card-patterns/ProfileCardSkeleton.tsx +69 -0
- package/components/blocks/card-patterns/ProjectCard.tsx +123 -110
- package/components/blocks/card-patterns/ProjectCardSkeleton.tsx +72 -0
- package/components/blocks/card-patterns/QuickActionCard.tsx +68 -68
- package/components/blocks/card-patterns/QuickActionCardSkeleton.tsx +44 -0
- package/components/blocks/card-patterns/card-patterns.mdx +123 -0
- package/components/blocks/card-patterns/card-patterns.stories.tsx +594 -515
- package/components/blocks/card-patterns/index.ts +29 -17
- package/components/blocks/index.ts +1 -1
- package/components/brand/branding/branding.stories.tsx +57 -57
- package/components/brand/index.ts +6 -6
- package/components/brand/language-selector/LanguageSelector.tsx +47 -12
- package/components/brand/language-selector/index.ts +1 -1
- package/components/brand/language-selector/language-selector.mdx +126 -57
- package/components/brand/language-selector/language-selector.stories.tsx +66 -16
- package/components/brand/language-selector/language-selector.test.tsx +64 -8
- package/components/brand/theme-toggle/ThemeToggle.tsx +70 -68
- package/components/brand/theme-toggle/index.ts +1 -1
- package/components/brand/theme-toggle/theme-toggle.stories.tsx +34 -34
- package/components/brand/theme-toggle/theme-toggle.test.tsx +34 -34
- package/components/brand/xertica-logo/XerticaLogo.stories.tsx +82 -82
- package/components/brand/xertica-logo/XerticaLogo.tsx +104 -104
- package/components/brand/xertica-logo/index.ts +1 -1
- package/components/brand/xertica-logo/xertica-logo.test.tsx +26 -26
- package/components/brand/xertica-orbe/XerticaOrbe.tsx +1927 -1927
- package/components/brand/xertica-orbe/index.ts +1 -1
- package/components/brand/xertica-orbe/xertica-orbe.stories.tsx +40 -40
- package/components/brand/xertica-orbe/xertica-orbe.test.tsx +19 -19
- package/components/brand/xertica-provider/XerticaProvider.tsx +38 -2
- package/components/brand/xertica-provider/index.ts +1 -1
- package/components/brand/xertica-provider/xertica-provider.mdx +61 -61
- package/components/brand/xertica-provider/xertica-provider.test.tsx +74 -74
- package/components/brand/xertica-xlogo/XerticaXLogo.stories.tsx +79 -79
- package/components/brand/xertica-xlogo/XerticaXLogo.tsx +65 -65
- package/components/brand/xertica-xlogo/index.ts +1 -1
- package/components/brand/xertica-xlogo/xertica-xlogo.test.tsx +16 -16
- package/components/examples/ApiKeyMapExample.tsx +71 -71
- package/components/examples/DrawingMapExample.tsx +565 -565
- package/components/examples/FilterableMapExample.tsx +393 -393
- package/components/examples/LocationPickerExample.tsx +348 -348
- package/components/examples/MapExamples.tsx +268 -268
- package/components/examples/MapGmpExample.tsx +169 -169
- package/components/examples/MapShowcase.tsx +471 -471
- package/components/examples/RouteMapExamples.tsx +329 -329
- package/components/examples/SidebarLogoExample.tsx +65 -65
- package/components/examples/SimpleFilterableMap.tsx +219 -219
- package/components/examples/index.ts +45 -45
- package/components/figma/ImageWithFallback.tsx +27 -27
- package/components/hooks/index.ts +13 -13
- package/components/hooks/use-layout-shortcuts.ts +43 -43
- package/components/index.ts +90 -77
- package/components/layout/header/header.stories.tsx +204 -204
- package/components/layout/header/header.test.tsx +75 -75
- package/components/layout/header/header.tsx +349 -349
- package/components/layout/header/index.ts +1 -1
- package/components/layout/index.ts +2 -2
- package/components/layout/sidebar/index.ts +3 -3
- package/components/layout/sidebar/sidebar.mdx +1 -1
- package/components/layout/sidebar/sidebar.stories.tsx +586 -586
- package/components/layout/sidebar/sidebar.test.tsx +76 -76
- package/components/layout/sidebar/sidebar.tsx +1073 -1068
- package/components/layout/sidebar/use-sidebar.ts +104 -104
- package/components/media/FloatingMediaWrapper.tsx +371 -368
- package/components/media/audio-player/AudioPlayer.stories.tsx +124 -124
- package/components/media/audio-player/AudioPlayer.test.tsx +106 -106
- package/components/media/audio-player/AudioPlayer.tsx +765 -762
- package/components/media/audio-player/index.ts +1 -1
- package/components/media/audio-player/use-audio-player.ts +312 -312
- package/components/media/index.ts +3 -3
- package/components/media/video-player/VideoPlayer.stories.tsx +98 -98
- package/components/media/video-player/VideoPlayer.test.tsx +73 -73
- package/components/media/video-player/VideoPlayer.tsx +310 -308
- package/components/media/video-player/index.ts +1 -1
- package/components/pages/forgot-password-page/ForgotPasswordPage.stories.tsx +24 -24
- package/components/pages/forgot-password-page/ForgotPasswordPage.tsx +188 -188
- package/components/pages/forgot-password-page/forgot-password-page.test.tsx +45 -45
- package/components/pages/forgot-password-page/index.ts +1 -1
- package/components/pages/home-content/HomeContent.stories.tsx +43 -43
- package/components/pages/home-content/HomeContent.tsx +120 -125
- package/components/pages/home-content/home-content.mdx +62 -62
- package/components/pages/home-content/index.ts +1 -1
- package/components/pages/home-page/HomePage.stories.tsx +39 -39
- package/components/pages/home-page/HomePage.tsx +74 -75
- package/components/pages/home-page/home-page.mdx +53 -53
- package/components/pages/home-page/home-page.test.tsx +53 -53
- package/components/pages/home-page/index.ts +1 -1
- package/components/pages/index.ts +8 -8
- package/components/pages/login-page/LoginPage.stories.tsx +39 -39
- package/components/pages/login-page/LoginPage.tsx +216 -216
- package/components/pages/login-page/index.ts +1 -1
- package/components/pages/login-page/login-page.test.tsx +63 -63
- package/components/pages/reset-password-page/ResetPasswordPage.stories.tsx +24 -24
- package/components/pages/reset-password-page/ResetPasswordPage.tsx +239 -237
- package/components/pages/reset-password-page/index.ts +1 -1
- package/components/pages/template-content/TemplateContent.stories.tsx +43 -43
- package/components/pages/template-content/TemplateContent.tsx +1235 -1237
- package/components/pages/template-content/index.ts +1 -1
- 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 +62 -62
- package/components/pages/template-page/index.ts +1 -1
- package/components/pages/template-page/template-page.mdx +53 -53
- package/components/pages/template-page/template-page.test.tsx +52 -52
- package/components/pages/verify-email-page/VerifyEmailPage.stories.tsx +41 -41
- package/components/pages/verify-email-page/VerifyEmailPage.tsx +206 -206
- package/components/pages/verify-email-page/index.ts +1 -1
- package/components/public-api-smoke.test.tsx +52 -52
- package/components/shared/CustomTooltipContent.tsx +48 -48
- package/components/shared/assistant-utils.test.ts +16 -16
- package/components/shared/assistant-utils.ts +225 -225
- package/components/shared/error-boundary.stories.tsx +132 -132
- package/components/shared/error-boundary.tsx +154 -154
- package/components/shared/error-fallbacks.tsx +226 -226
- package/components/shared/layout-constants.ts +8 -8
- package/components/shared/navigation.ts +35 -35
- package/components/shared/use-mobile.test.ts +16 -16
- package/components/shared/use-mobile.ts +36 -36
- package/components/shared/utils.test.ts +14 -14
- package/components/shared/utils.ts +6 -6
- package/components/ui/accordion/accordion.mdx +8 -8
- package/components/ui/accordion/accordion.stories.tsx +105 -105
- package/components/ui/accordion/accordion.test.tsx +59 -59
- package/components/ui/accordion/accordion.tsx +77 -77
- package/components/ui/accordion/index.ts +1 -1
- package/components/ui/alert/alert.mdx +8 -8
- package/components/ui/alert/alert.stories.tsx +86 -86
- package/components/ui/alert/alert.test.tsx +53 -53
- package/components/ui/alert/alert.tsx +93 -93
- package/components/ui/alert/index.ts +1 -1
- package/components/ui/alert-dialog/alert-dialog.mdx +8 -8
- package/components/ui/alert-dialog/alert-dialog.stories.tsx +84 -84
- package/components/ui/alert-dialog/alert-dialog.test.tsx +70 -70
- package/components/ui/alert-dialog/alert-dialog.tsx +149 -149
- package/components/ui/alert-dialog/index.ts +1 -1
- package/components/ui/aspect-ratio/aspect-ratio.mdx +8 -8
- package/components/ui/aspect-ratio/aspect-ratio.stories.tsx +46 -46
- package/components/ui/aspect-ratio/aspect-ratio.test.tsx +28 -28
- package/components/ui/aspect-ratio/aspect-ratio.tsx +20 -20
- package/components/ui/aspect-ratio/index.ts +1 -1
- package/components/ui/assistant-chart/AssistantChart.tsx +64 -64
- package/components/ui/assistant-chart/assistant-chart.mdx +8 -8
- package/components/ui/assistant-chart/assistant-chart.stories.tsx +44 -44
- package/components/ui/assistant-chart/assistant-chart.test.tsx +46 -46
- package/components/ui/assistant-chart/index.ts +1 -1
- package/components/ui/avatar/avatar.mdx +8 -8
- package/components/ui/avatar/avatar.stories.tsx +86 -86
- package/components/ui/avatar/avatar.test.tsx +55 -55
- package/components/ui/avatar/avatar.tsx +71 -71
- package/components/ui/avatar/index.ts +1 -1
- package/components/ui/badge/badge.mdx +8 -8
- package/components/ui/badge/badge.stories.tsx +72 -72
- package/components/ui/badge/badge.test.tsx +40 -40
- package/components/ui/badge/badge.tsx +58 -58
- package/components/ui/badge/index.ts +1 -1
- package/components/ui/breadcrumb/breadcrumb.mdx +8 -8
- package/components/ui/breadcrumb/breadcrumb.stories.tsx +123 -123
- package/components/ui/breadcrumb/breadcrumb.test.tsx +70 -70
- package/components/ui/breadcrumb/breadcrumb.tsx +114 -114
- package/components/ui/breadcrumb/index.ts +1 -1
- package/components/ui/button/button.mdx +8 -8
- package/components/ui/button/button.stories.tsx +183 -183
- package/components/ui/button/button.test.tsx +64 -64
- package/components/ui/button/button.tsx +98 -98
- package/components/ui/button/index.ts +1 -1
- package/components/ui/calendar/calendar.mdx +8 -8
- package/components/ui/calendar/calendar.stories.tsx +108 -108
- package/components/ui/calendar/calendar.test.tsx +53 -53
- package/components/ui/calendar/calendar.tsx +230 -230
- package/components/ui/calendar/index.ts +1 -1
- package/components/ui/card/card.mdx +8 -8
- package/components/ui/card/card.stories.tsx +301 -301
- package/components/ui/card/card.test.tsx +55 -55
- package/components/ui/card/card.tsx +83 -83
- package/components/ui/card/index.ts +1 -1
- package/components/ui/carousel/carousel.mdx +8 -8
- package/components/ui/carousel/carousel.stories.tsx +80 -80
- package/components/ui/carousel/carousel.test.tsx +75 -75
- package/components/ui/carousel/carousel.tsx +242 -242
- package/components/ui/carousel/index.ts +1 -1
- package/components/ui/chart/chart.mdx +8 -8
- package/components/ui/chart/chart.stories.tsx +1328 -1328
- package/components/ui/chart/chart.test.tsx +178 -178
- package/components/ui/chart/chart.tsx +2232 -2232
- package/components/ui/chart/index.ts +1 -1
- package/components/ui/checkbox/checkbox.mdx +8 -8
- package/components/ui/checkbox/checkbox.stories.tsx +109 -109
- package/components/ui/checkbox/checkbox.test.tsx +49 -49
- package/components/ui/checkbox/checkbox.tsx +68 -68
- package/components/ui/checkbox/index.ts +1 -1
- package/components/ui/collapsible/collapsible.mdx +8 -8
- package/components/ui/collapsible/collapsible.stories.tsx +45 -45
- package/components/ui/collapsible/collapsible.test.tsx +51 -51
- package/components/ui/collapsible/collapsible.tsx +32 -32
- package/components/ui/collapsible/index.ts +1 -1
- package/components/ui/command/command.mdx +8 -8
- package/components/ui/command/command.stories.tsx +134 -134
- package/components/ui/command/command.test.tsx +48 -48
- package/components/ui/command/command.tsx +163 -163
- package/components/ui/command/index.ts +1 -1
- package/components/ui/context-menu/context-menu.mdx +8 -8
- package/components/ui/context-menu/context-menu.stories.tsx +76 -76
- package/components/ui/context-menu/context-menu.test.tsx +61 -61
- package/components/ui/context-menu/context-menu.tsx +236 -236
- package/components/ui/context-menu/index.ts +1 -1
- package/components/ui/dialog/dialog.mdx +8 -8
- package/components/ui/dialog/dialog.stories.tsx +174 -174
- package/components/ui/dialog/dialog.test.tsx +78 -78
- package/components/ui/dialog/dialog.tsx +189 -189
- package/components/ui/dialog/index.ts +1 -1
- package/components/ui/drawer/drawer.mdx +8 -8
- package/components/ui/drawer/drawer.stories.tsx +71 -71
- package/components/ui/drawer/drawer.test.tsx +67 -67
- package/components/ui/drawer/drawer.tsx +146 -146
- package/components/ui/drawer/index.ts +1 -1
- package/components/ui/dropdown-menu/dropdown-menu.mdx +8 -8
- package/components/ui/dropdown-menu/dropdown-menu.stories.tsx +156 -156
- package/components/ui/dropdown-menu/dropdown-menu.test.tsx +62 -62
- package/components/ui/dropdown-menu/dropdown-menu.tsx +240 -240
- package/components/ui/dropdown-menu/index.ts +1 -1
- package/components/ui/empty/empty.mdx +8 -8
- package/components/ui/empty/empty.stories.tsx +85 -85
- package/components/ui/empty/empty.test.tsx +31 -31
- package/components/ui/empty/empty.tsx +88 -88
- package/components/ui/empty/index.ts +1 -1
- package/components/ui/file-upload/file-upload.mdx +8 -8
- package/components/ui/file-upload/file-upload.stories.tsx +144 -144
- package/components/ui/file-upload/file-upload.test.tsx +65 -65
- package/components/ui/file-upload/file-upload.tsx +142 -142
- package/components/ui/file-upload/index.ts +2 -2
- package/components/ui/file-upload/use-file-upload.ts +177 -177
- package/components/ui/form/form.stories.tsx +85 -85
- package/components/ui/form/form.test.tsx +75 -75
- package/components/ui/form/form.tsx +163 -163
- package/components/ui/form/index.ts +1 -1
- package/components/ui/google-maps-loader/google-maps-loader.test.tsx +35 -35
- package/components/ui/google-maps-loader/google-maps-loader.tsx +465 -465
- package/components/ui/google-maps-loader/index.ts +1 -1
- package/components/ui/hover-card/hover-card.mdx +8 -8
- package/components/ui/hover-card/hover-card.stories.tsx +61 -61
- package/components/ui/hover-card/hover-card.test.tsx +48 -48
- package/components/ui/hover-card/hover-card.tsx +50 -50
- package/components/ui/hover-card/index.ts +1 -1
- package/components/ui/index.ts +400 -400
- package/components/ui/input/index.ts +1 -1
- package/components/ui/input/input.mdx +8 -8
- package/components/ui/input/input.stories.tsx +153 -153
- package/components/ui/input/input.test.tsx +47 -47
- package/components/ui/input/input.tsx +57 -57
- package/components/ui/input-otp/index.ts +1 -1
- package/components/ui/input-otp/input-otp.mdx +8 -8
- package/components/ui/input-otp/input-otp.stories.tsx +120 -120
- package/components/ui/input-otp/input-otp.test.tsx +74 -74
- package/components/ui/input-otp/input-otp.tsx +101 -101
- package/components/ui/label/index.ts +1 -1
- package/components/ui/label/label.mdx +8 -8
- package/components/ui/label/label.stories.tsx +74 -74
- package/components/ui/label/label.test.tsx +45 -45
- package/components/ui/label/label.tsx +53 -53
- package/components/ui/map/index.ts +1 -1
- package/components/ui/map/map.mdx +8 -8
- package/components/ui/map/map.stories.tsx +86 -86
- package/components/ui/map/map.test.tsx +82 -82
- package/components/ui/map/map.tsx +506 -506
- package/components/ui/map/mock.test.tsx +13 -13
- package/components/ui/map-config/index.ts +1 -1
- package/components/ui/map-config/map-config.ts +18 -18
- package/components/ui/map-layers/index.ts +1 -1
- package/components/ui/map-layers/map-layers.test.tsx +48 -48
- package/components/ui/map-layers/map-layers.tsx +126 -126
- package/components/ui/map.exports/index.ts +1 -1
- package/components/ui/map.exports/map.exports.ts +31 -31
- package/components/ui/menubar/index.ts +1 -1
- package/components/ui/menubar/menubar.mdx +8 -8
- package/components/ui/menubar/menubar.stories.tsx +130 -130
- package/components/ui/menubar/menubar.test.tsx +53 -53
- package/components/ui/menubar/menubar.tsx +265 -265
- package/components/ui/navigation-menu/index.ts +1 -1
- package/components/ui/navigation-menu/navigation-menu.mdx +8 -8
- package/components/ui/navigation-menu/navigation-menu.stories.tsx +126 -126
- package/components/ui/navigation-menu/navigation-menu.test.tsx +47 -47
- package/components/ui/navigation-menu/navigation-menu.tsx +165 -165
- package/components/ui/notification-badge/index.ts +1 -1
- package/components/ui/notification-badge/notification-badge.mdx +8 -8
- package/components/ui/notification-badge/notification-badge.stories.tsx +66 -66
- package/components/ui/notification-badge/notification-badge.test.tsx +61 -61
- package/components/ui/notification-badge/notification-badge.tsx +91 -91
- package/components/ui/page-header/index.ts +1 -1
- package/components/ui/page-header/page-header.stories.tsx +69 -69
- package/components/ui/page-header/page-header.test.tsx +37 -37
- package/components/ui/page-header/page-header.tsx +124 -124
- package/components/ui/pagination/index.ts +3 -3
- package/components/ui/pagination/pagination.mdx +8 -8
- package/components/ui/pagination/pagination.stories.tsx +210 -210
- package/components/ui/pagination/pagination.test.tsx +63 -63
- package/components/ui/pagination/pagination.tsx +140 -140
- package/components/ui/pagination/use-pagination.ts +173 -173
- package/components/ui/popover/index.ts +1 -1
- package/components/ui/popover/popover.mdx +8 -8
- package/components/ui/popover/popover.stories.tsx +73 -73
- package/components/ui/popover/popover.test.tsx +48 -48
- package/components/ui/popover/popover.tsx +54 -54
- package/components/ui/progress/index.ts +1 -1
- package/components/ui/progress/progress.mdx +8 -8
- package/components/ui/progress/progress.stories.tsx +55 -55
- package/components/ui/progress/progress.test.tsx +23 -23
- package/components/ui/progress/progress.tsx +68 -68
- package/components/ui/radio-group/index.ts +1 -1
- package/components/ui/radio-group/radio-group.mdx +8 -8
- package/components/ui/radio-group/radio-group.stories.tsx +114 -114
- package/components/ui/radio-group/radio-group.test.tsx +78 -78
- package/components/ui/radio-group/radio-group.tsx +93 -93
- package/components/ui/rating/index.ts +1 -1
- package/components/ui/rating/rating.mdx +8 -8
- package/components/ui/rating/rating.stories.tsx +50 -50
- package/components/ui/rating/rating.test.tsx +48 -48
- package/components/ui/rating/rating.tsx +145 -145
- package/components/ui/resizable/index.ts +1 -1
- package/components/ui/resizable/resizable.mdx +8 -8
- package/components/ui/resizable/resizable.stories.tsx +88 -88
- package/components/ui/resizable/resizable.test.tsx +61 -61
- package/components/ui/resizable/resizable.tsx +452 -452
- package/components/ui/rich-text-editor/index.ts +7 -7
- package/components/ui/rich-text-editor/rich-text-editor.stories.tsx +290 -290
- package/components/ui/rich-text-editor/rich-text-editor.test.tsx +86 -86
- package/components/ui/rich-text-editor/rich-text-editor.tsx +634 -634
- package/components/ui/rich-text-editor/use-rich-text-editor.ts +453 -453
- package/components/ui/route-map/index.ts +1 -1
- package/components/ui/route-map/route-map.mdx +8 -8
- package/components/ui/route-map/route-map.stories.tsx +48 -48
- package/components/ui/route-map/route-map.test.tsx +108 -108
- package/components/ui/route-map/route-map.tsx +349 -349
- package/components/ui/scroll-area/index.ts +1 -1
- package/components/ui/scroll-area/scroll-area.mdx +8 -8
- package/components/ui/scroll-area/scroll-area.stories.tsx +31 -31
- package/components/ui/scroll-area/scroll-area.test.tsx +27 -27
- package/components/ui/scroll-area/scroll-area.tsx +70 -70
- package/components/ui/search/index.ts +1 -1
- package/components/ui/search/search.mdx +8 -8
- package/components/ui/search/search.stories.tsx +107 -107
- package/components/ui/search/search.test.tsx +67 -67
- package/components/ui/search/search.tsx +141 -141
- package/components/ui/select/index.ts +1 -1
- package/components/ui/select/select.mdx +8 -8
- package/components/ui/select/select.stories.tsx +163 -163
- package/components/ui/select/select.test.tsx +99 -99
- package/components/ui/select/select.tsx +195 -195
- package/components/ui/separator/index.ts +1 -1
- package/components/ui/separator/separator.mdx +8 -8
- package/components/ui/separator/separator.stories.tsx +55 -55
- package/components/ui/separator/separator.test.tsx +23 -23
- package/components/ui/separator/separator.tsx +39 -39
- package/components/ui/sheet/index.ts +1 -1
- package/components/ui/sheet/sheet.mdx +8 -8
- package/components/ui/sheet/sheet.stories.tsx +93 -93
- package/components/ui/sheet/sheet.test.tsx +62 -62
- package/components/ui/sheet/sheet.tsx +149 -149
- package/components/ui/simple-map/index.ts +1 -1
- package/components/ui/simple-map/simple-map.mdx +8 -8
- package/components/ui/simple-map/simple-map.stories.tsx +44 -44
- package/components/ui/simple-map/simple-map.test.tsx +36 -36
- package/components/ui/simple-map/simple-map.tsx +92 -92
- package/components/ui/skeleton/index.ts +1 -1
- package/components/ui/skeleton/skeleton.mdx +8 -8
- package/components/ui/skeleton/skeleton.stories.tsx +36 -36
- package/components/ui/skeleton/skeleton.test.tsx +19 -19
- package/components/ui/skeleton/skeleton.tsx +25 -25
- package/components/ui/slider/index.ts +1 -1
- package/components/ui/slider/slider.mdx +8 -8
- package/components/ui/slider/slider.stories.tsx +44 -44
- package/components/ui/slider/slider.test.tsx +25 -25
- package/components/ui/slider/slider.tsx +66 -66
- package/components/ui/sonner/index.ts +1 -1
- package/components/ui/sonner/sonner.mdx +8 -8
- package/components/ui/sonner/sonner.stories.tsx +41 -41
- package/components/ui/sonner/sonner.test.tsx +24 -24
- package/components/ui/sonner/sonner.tsx +74 -74
- package/components/ui/stats-card/index.ts +2 -1
- package/components/ui/stats-card/stats-card-skeleton.tsx +62 -0
- package/components/ui/stats-card/stats-card.mdx +8 -8
- package/components/ui/stats-card/stats-card.stories.tsx +99 -77
- package/components/ui/stats-card/stats-card.test.tsx +34 -34
- package/components/ui/stats-card/stats-card.tsx +93 -93
- package/components/ui/stepper/index.ts +3 -3
- package/components/ui/stepper/stepper.mdx +8 -8
- package/components/ui/stepper/stepper.stories.tsx +171 -171
- package/components/ui/stepper/stepper.test.tsx +47 -47
- package/components/ui/stepper/stepper.tsx +190 -190
- package/components/ui/stepper/use-stepper.ts +139 -139
- package/components/ui/switch/index.ts +1 -1
- package/components/ui/switch/switch.mdx +8 -8
- package/components/ui/switch/switch.stories.tsx +93 -93
- package/components/ui/switch/switch.test.tsx +44 -44
- package/components/ui/switch/switch.tsx +70 -70
- package/components/ui/table/index.ts +1 -1
- package/components/ui/table/table.mdx +8 -8
- package/components/ui/table/table.stories.tsx +114 -114
- package/components/ui/table/table.test.tsx +43 -43
- package/components/ui/table/table.tsx +104 -104
- package/components/ui/tabs/index.ts +1 -1
- package/components/ui/tabs/tabs.mdx +8 -8
- package/components/ui/tabs/tabs.stories.tsx +140 -140
- package/components/ui/tabs/tabs.test.tsx +50 -50
- package/components/ui/tabs/tabs.tsx +66 -66
- package/components/ui/textarea/index.ts +1 -1
- package/components/ui/textarea/textarea.mdx +8 -8
- package/components/ui/textarea/textarea.stories.tsx +69 -69
- package/components/ui/textarea/textarea.test.tsx +41 -41
- package/components/ui/textarea/textarea.tsx +61 -61
- package/components/ui/timeline/index.ts +1 -1
- package/components/ui/timeline/timeline.mdx +8 -8
- package/components/ui/timeline/timeline.stories.tsx +97 -97
- package/components/ui/timeline/timeline.test.tsx +53 -53
- package/components/ui/timeline/timeline.tsx +124 -124
- package/components/ui/toggle/index.ts +1 -1
- package/components/ui/toggle/toggle.mdx +8 -8
- package/components/ui/toggle/toggle.stories.tsx +56 -56
- package/components/ui/toggle/toggle.test.tsx +32 -32
- package/components/ui/toggle/toggle.tsx +55 -55
- package/components/ui/toggle-group/index.ts +1 -1
- package/components/ui/toggle-group/toggle-group.mdx +8 -8
- package/components/ui/toggle-group/toggle-group.stories.tsx +66 -66
- package/components/ui/toggle-group/toggle-group.test.tsx +47 -47
- package/components/ui/toggle-group/toggle-group.tsx +79 -79
- package/components/ui/tooltip/index.ts +1 -1
- package/components/ui/tooltip/tooltip.mdx +8 -8
- package/components/ui/tooltip/tooltip.stories.tsx +83 -83
- package/components/ui/tooltip/tooltip.test.tsx +39 -39
- package/components/ui/tooltip/tooltip.tsx +69 -69
- package/components/ui/tree-view/index.ts +4 -4
- package/components/ui/tree-view/tree-view.mdx +8 -8
- package/components/ui/tree-view/tree-view.stories.tsx +154 -154
- package/components/ui/tree-view/tree-view.test.tsx +58 -58
- package/components/ui/tree-view/tree-view.tsx +171 -171
- package/components/ui/tree-view/use-tree-view.ts +237 -237
- package/components.json +892 -892
- package/contexts/ApiKeyContext.test.tsx +26 -26
- package/contexts/ApiKeyContext.tsx +196 -196
- package/contexts/AssistenteContext.test.tsx +17 -17
- package/contexts/AssistenteContext.tsx +113 -113
- package/contexts/AuthContext.tsx +118 -118
- package/contexts/BrandColorsContext.test.tsx +21 -21
- package/contexts/BrandColorsContext.tsx +251 -251
- package/contexts/LanguageContext.test.tsx +108 -16
- package/contexts/LanguageContext.tsx +202 -17
- package/contexts/LayoutContext.test.tsx +29 -29
- package/contexts/LayoutContext.tsx +140 -140
- package/contexts/ThemeContext.test.tsx +38 -38
- package/contexts/ThemeContext.tsx +111 -111
- package/contexts/index.ts +8 -8
- package/contexts/theme-data.ts +340 -340
- package/dist/{AssistantChart-DoZCyS5r.cjs → AssistantChart-9w31gdAb.cjs} +4 -4
- package/dist/{AssistantChart-CldVCVDe.cjs → AssistantChart-BAudAfne.cjs} +5 -5
- package/dist/{AssistantChart-Bdd44uBn.cjs → AssistantChart-BAx9VQvb.cjs} +127 -388
- package/dist/{AssistantChart-Cu3m7RBo.js → AssistantChart-BP8upjMk.js} +5 -5
- package/dist/{use-mobile-BXuYROXM.js → AssistantChart-BXU1ACnh.js} +958 -1671
- package/dist/{AssistantChart-CFhDdGyU.js → AssistantChart-CVko2A1W.js} +130 -391
- package/dist/{AssistantChart-C_hwFRRr.js → AssistantChart-CVzmmhx4.js} +4 -4
- package/dist/{use-mobile-CG2-SdXV.cjs → AssistantChart-D0A1FPYt.cjs} +980 -1700
- package/dist/{AudioPlayer-IAU5q5T1.cjs → AudioPlayer-1ypwE2Wh.cjs} +1 -1
- package/dist/AudioPlayer-BWDW6TN9.cjs +1279 -0
- package/dist/AudioPlayer-CM962GEh.js +1280 -0
- package/dist/{AudioPlayer-CySJIyvL.js → AudioPlayer-DuKXrCfy.js} +1 -1
- package/dist/CodeBlock-CV6dtsTM.cjs +220 -0
- package/dist/CodeBlock-CjeFavqV.js +221 -0
- package/dist/{FeatureCard-DbHWCb4E.js → FeatureCard-Cfs6Ishq.js} +221 -37
- package/dist/FeatureCard-ie3L8Fpr.cjs +484 -0
- package/dist/FeatureCardSkeleton-CAgu8stE.js +27 -0
- package/dist/FeatureCardSkeleton-mO3Bdm_V.cjs +26 -0
- package/dist/{LanguageContext-CS14yCpi.js → LanguageContext-BwhwC3G2.js} +2 -2
- package/dist/{LanguageContext-B_KFTCzT.cjs → LanguageContext-DvUt5jBg.cjs} +2 -2
- package/dist/{ThemeContext-C2EwAPDt.js → ThemeContext-BbBNoFTG.js} +2 -2
- package/dist/ThemeContext-BblcjQup.cjs +1855 -0
- package/dist/ThemeContext-Bo-W2WZH.js +1856 -0
- package/dist/ThemeContext-CP3a0jxy.cjs +1855 -0
- package/dist/{ThemeContext-vTjumZeM.cjs → ThemeContext-Cmr8Ex8H.cjs} +2 -2
- package/dist/ThemeContext-CpqYShLq.cjs +324 -0
- package/dist/{ThemeContext-CQSo4Iwc.js → ThemeContext-D3LzacmG.js} +8 -1
- package/dist/ThemeContext-Du2nE1PL.js +325 -0
- package/dist/ThemeContext-GeEBTJ3q.cjs +1621 -0
- package/dist/ThemeContext-JyLK9B1o.js +1622 -0
- package/dist/{ThemeContext-CGk3KK0k.cjs → ThemeContext-U4dEYc6C.cjs} +8 -1
- package/dist/ThemeContext-ept8jhXI.js +1856 -0
- package/dist/{VerifyEmailPage-C0c2e5n0.js → VerifyEmailPage-BE-L9mB7.js} +7 -7
- package/dist/VerifyEmailPage-BIBOKV7Z.js +3214 -0
- package/dist/{VerifyEmailPage--1Vurewl.cjs → VerifyEmailPage-BRSP-Pwt.cjs} +3 -3
- package/dist/{VerifyEmailPage-Cwi3kbol.cjs → VerifyEmailPage-Bae2cBXT.cjs} +7 -7
- package/dist/{VerifyEmailPage-DjQKRlUS.cjs → VerifyEmailPage-BiRm7Nh4.cjs} +1185 -796
- package/dist/VerifyEmailPage-Bvfv8HVQ.js +3214 -0
- package/dist/{VerifyEmailPage-BComraR7.cjs → VerifyEmailPage-CR7kb5df.cjs} +22 -12
- package/dist/{VerifyEmailPage-MTD7AG1Z.js → VerifyEmailPage-C_ihbcth.js} +4 -4
- package/dist/{VerifyEmailPage-1WwWczAn.js → VerifyEmailPage-CbgjOF0v.js} +22 -12
- package/dist/{VerifyEmailPage-DvMLZgFt.js → VerifyEmailPage-CdYPSJoO.js} +1 -1
- package/dist/VerifyEmailPage-D-FRj5TU.cjs +3213 -0
- package/dist/{VerifyEmailPage-s-1X3LDJ.cjs → VerifyEmailPage-DF2ilhum.cjs} +1049 -665
- package/dist/{VerifyEmailPage-CYXtbKi3.cjs → VerifyEmailPage-DMBh4NM9.cjs} +1 -1
- package/dist/{VerifyEmailPage-CgMxRb4z.js → VerifyEmailPage-DTtFfC-J.js} +3 -3
- package/dist/{VerifyEmailPage-CFLMls1p.cjs → VerifyEmailPage-Dt7zgA4w.cjs} +4 -4
- package/dist/VerifyEmailPage-EhudUdqF.js +3211 -0
- package/dist/VerifyEmailPage-hdB8JQGv.cjs +3213 -0
- package/dist/VerifyEmailPage-vYHbYK3q.js +3214 -0
- package/dist/XerticaProvider-AChwphCO.cjs +48 -0
- package/dist/XerticaProvider-AbWlr7Af.cjs +48 -0
- package/dist/{XerticaProvider-D-yNhF94.cjs → XerticaProvider-B8CaV7xu.cjs} +1 -1
- package/dist/{XerticaProvider-CEoWMTxu.js → XerticaProvider-BITjgC5p.js} +2 -2
- package/dist/{XerticaProvider-CllrbMEJ.cjs → XerticaProvider-By8q3Roe.cjs} +2 -2
- package/dist/XerticaProvider-CUYJZc32.js +49 -0
- package/dist/{XerticaProvider-ET0ihewn.cjs → XerticaProvider-CW9hpCdF.cjs} +2 -2
- package/dist/XerticaProvider-CWgby5mY.js +49 -0
- package/dist/XerticaProvider-CWs6EwNa.js +49 -0
- package/dist/XerticaProvider-CjQAQPcn.cjs +48 -0
- package/dist/XerticaProvider-D5lLumH-.js +49 -0
- package/dist/{XerticaProvider-DYq4JWtg.js → XerticaProvider-DQtvJU7m.js} +1 -1
- package/dist/XerticaProvider-qQUDop71.cjs +48 -0
- package/dist/{XerticaProvider-B7EVH-NF.js → XerticaProvider-siSt9uG2.js} +2 -2
- package/dist/{LanguageSelector-D6uacAIM.cjs → XerticaXLogo-8TTzBjHw.cjs} +136 -115
- package/dist/{LanguageSelector-B5YfbHra.js → XerticaXLogo-BWaag64t.js} +136 -115
- package/dist/XerticaXLogo-CFuIlYFH.js +252 -0
- package/dist/XerticaXLogo-CU-U-GP4.cjs +251 -0
- package/dist/XerticaXLogo-ChryA6xj.js +252 -0
- package/dist/{XerticaXLogo-CQUUjXoH.cjs → XerticaXLogo-CziKMQil.cjs} +8 -8
- package/dist/XerticaXLogo-DHz5SugF.js +252 -0
- package/dist/XerticaXLogo-DTee_y8X.cjs +251 -0
- package/dist/{XerticaXLogo-Cmsp-Eey.js → XerticaXLogo-DfUvz-lD.js} +9 -9
- package/dist/XerticaXLogo-kslQ8Tk_.cjs +251 -0
- package/dist/{alert-dialog-s-vmNkJ_.js → alert-dialog-iDe5VE5o.js} +3 -3
- package/dist/{alert-dialog-DSKByiKZ.cjs → alert-dialog-yckpaOpy.cjs} +3 -3
- package/dist/assistant.cjs.js +2 -2
- package/dist/assistant.es.js +2 -2
- package/dist/blocks.cjs.js +8 -1
- package/dist/blocks.es.js +10 -3
- package/dist/brand.cjs.js +2 -2
- package/dist/brand.es.js +2 -2
- package/dist/cli.js +524 -164
- package/dist/components/blocks/card-patterns/ActivityCardSkeleton.d.ts +19 -0
- package/dist/components/blocks/card-patterns/FeatureCardSkeleton.d.ts +18 -0
- package/dist/components/blocks/card-patterns/NotificationCardSkeleton.d.ts +21 -0
- package/dist/components/blocks/card-patterns/ProfileCardSkeleton.d.ts +20 -0
- package/dist/components/blocks/card-patterns/ProjectCardSkeleton.d.ts +18 -0
- package/dist/components/blocks/card-patterns/QuickActionCardSkeleton.d.ts +16 -0
- package/dist/components/blocks/card-patterns/index.d.ts +12 -0
- package/dist/components/brand/language-selector/LanguageSelector.d.ts +15 -1
- package/dist/components/brand/xertica-provider/XerticaProvider.d.ts +29 -1
- package/dist/components/index.d.ts +3 -0
- package/dist/components/ui/stats-card/index.d.ts +1 -0
- package/dist/components/ui/stats-card/stats-card-skeleton.d.ts +25 -0
- package/dist/contexts/LanguageContext.d.ts +66 -5
- package/dist/features/assistant/data/mock.d.ts +2 -2
- package/dist/features/assistant/hooks/useAssistantConfig.d.ts +0 -1
- package/dist/features/assistant/index.d.ts +1 -1
- package/dist/features/home/hooks/useDashboardStats.d.ts +0 -1
- package/dist/features/home/hooks/useFeatureCards.d.ts +0 -1
- package/dist/features/home/hooks/useTeamMembers.d.ts +0 -1
- package/dist/features/home/index.d.ts +3 -3
- package/dist/{google-maps-loader-Y-QkD-Li.cjs → google-maps-loader-BqsYL48U.cjs} +0 -5
- package/dist/{google-maps-loader-CTYySAun.js → google-maps-loader-t2IlYBzw.js} +0 -4
- package/dist/hooks.cjs.js +2 -1
- package/dist/hooks.es.js +2 -1
- package/dist/i18n.d.ts +13 -0
- package/dist/index-CkTUgOwX.js +8 -0
- package/dist/{index-COtD8bRW.cjs → index-D3RLKRAs.cjs} +1 -1
- package/dist/index.cjs.js +34 -19
- package/dist/index.es.js +71 -56
- package/dist/index.umd.js +454 -1027
- 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/{rich-text-editor-Bp3zQqMC.js → rich-text-editor-1UW3Y2JK.js} +989 -1052
- package/dist/{rich-text-editor-CeucBdIv.cjs → rich-text-editor-CyggTOLQ.cjs} +989 -1052
- package/dist/{sidebar-DQj1z3jG.cjs → sidebar-B3EYhli0.cjs} +269 -227
- package/dist/{sidebar-CK_0ZQHj.cjs → sidebar-B9NR0lCe.cjs} +271 -274
- package/dist/sidebar-BvF5I2Ue.cjs +800 -0
- package/dist/{sidebar-q7P2Godd.cjs → sidebar-C5B_LHek.cjs} +1 -1
- package/dist/{sidebar-LluMXfam.js → sidebar-CA6_ek3f.js} +269 -227
- package/dist/{sidebar-BxGXsDAd.cjs → sidebar-CVUGHOS_.cjs} +8 -16
- package/dist/{sidebar-BViy8Eeu.js → sidebar-CmvwjnVb.js} +9 -17
- package/dist/{sidebar-CUuOvYhK.js → sidebar-CplprZpM.js} +272 -258
- package/dist/{sidebar-BbVIQvlP.js → sidebar-Dz7bd3zP.js} +1 -1
- package/dist/sidebar-KIS0C2JH.js +801 -0
- package/dist/sidebar-OTO_up7Z.js +801 -0
- package/dist/sidebar-zowjejT2.cjs +800 -0
- package/dist/skeleton-4zoHiFJ_.cjs +83 -0
- package/dist/skeleton-C4bHqUBf.js +84 -0
- package/dist/ui.cjs.js +12 -11
- package/dist/ui.es.js +46 -45
- package/dist/{use-audio-player-nv8ZSGa1.js → use-audio-player-Bkh23vQ3.js} +3 -7
- package/dist/{use-audio-player-NKsWyjWu.cjs → use-audio-player-Dn1NR9xN.cjs} +3 -7
- package/dist/{xertica-assistant-dyP7KHM5.cjs → xertica-assistant-B1IaHXnB.cjs} +388 -529
- package/dist/{xertica-assistant-ciJaWqm1.js → xertica-assistant-BMqdyRVi.js} +10 -28
- package/dist/{xertica-assistant-BdiZag0h.js → xertica-assistant-BbgzsgsG.js} +539 -562
- package/dist/{xertica-assistant-V_IdW4WF.cjs → xertica-assistant-Bj3vBCq_.cjs} +9 -27
- package/dist/{xertica-assistant-yX1CFBBo.js → xertica-assistant-DPsESB6t.js} +390 -531
- package/dist/{CodeBlock-7TTgmdGG.cjs → xertica-assistant-Qp3ydksa.cjs} +51 -263
- package/dist/{xertica-assistant-DUBpmEgo.cjs → xertica-assistant-d2qs2Vd9.cjs} +538 -561
- package/dist/{CodeBlock-DnYNI8rQ.js → xertica-assistant-gnCJdcZY.js} +7 -219
- package/dist/xertica-ui.css +2 -2
- package/docs/ai-usage.md +195 -195
- package/docs/architecture-improvements.md +456 -476
- package/docs/architecture.md +306 -273
- package/docs/components/accordion.md +109 -109
- package/docs/components/alert-dialog.md +127 -127
- package/docs/components/alert.md +106 -106
- package/docs/components/aspect-ratio.md +58 -58
- package/docs/components/assistant-chart.md +47 -47
- package/docs/components/assistant.md +426 -426
- package/docs/components/audio-player.md +167 -167
- package/docs/components/avatar.md +101 -101
- package/docs/components/badge.md +84 -84
- package/docs/components/branding.md +252 -249
- package/docs/components/breadcrumb.md +104 -104
- package/docs/components/button.md +156 -156
- package/docs/components/calendar.md +141 -141
- package/docs/components/card-patterns.md +445 -376
- package/docs/components/card.md +245 -245
- package/docs/components/carousel.md +100 -100
- package/docs/components/chart.md +638 -638
- package/docs/components/checkbox.md +88 -88
- package/docs/components/code-block.md +105 -105
- package/docs/components/collapsible.md +86 -86
- package/docs/components/command.md +113 -113
- package/docs/components/context-menu.md +81 -81
- package/docs/components/dialog.md +198 -198
- package/docs/components/drawer.md +105 -105
- package/docs/components/dropdown-menu.md +127 -127
- package/docs/components/empty.md +127 -127
- package/docs/components/error-boundary.md +191 -191
- package/docs/components/file-upload.md +189 -189
- package/docs/components/floating-media-wrapper.md +63 -63
- package/docs/components/form.md +177 -177
- package/docs/components/formatted-document.md +105 -105
- package/docs/components/google-maps-loader.md +44 -44
- package/docs/components/header.md +177 -177
- package/docs/components/hooks.md +430 -425
- package/docs/components/hover-card.md +86 -86
- package/docs/components/image-with-fallback.md +107 -107
- package/docs/components/input-otp.md +95 -95
- package/docs/components/input.md +130 -130
- package/docs/components/label.md +69 -69
- package/docs/components/language-selector.md +71 -16
- package/docs/components/map-layers.md +138 -138
- package/docs/components/map.md +84 -84
- package/docs/components/markdown-message.md +47 -47
- package/docs/components/menubar.md +89 -89
- package/docs/components/modern-chat-input.md +164 -164
- package/docs/components/navigation-menu.md +83 -83
- package/docs/components/notification-badge.md +78 -78
- package/docs/components/page-header.md +93 -93
- package/docs/components/pages.md +309 -309
- package/docs/components/pagination.md +334 -334
- package/docs/components/popover.md +116 -116
- package/docs/components/progress.md +103 -103
- package/docs/components/radio-group.md +133 -133
- package/docs/components/rating.md +77 -77
- package/docs/components/resizable.md +84 -84
- package/docs/components/rich-text-editor.md +255 -255
- package/docs/components/route-map.md +124 -124
- package/docs/components/scroll-area.md +58 -58
- package/docs/components/search.md +87 -87
- package/docs/components/select.md +144 -144
- package/docs/components/separator.md +58 -58
- package/docs/components/sheet.md +122 -122
- package/docs/components/sidebar.md +314 -314
- package/docs/components/simple-map.md +51 -51
- package/docs/components/skeleton.md +99 -99
- package/docs/components/slider.md +84 -84
- package/docs/components/sonner.md +115 -115
- package/docs/components/stats-card.md +120 -120
- package/docs/components/stepper.md +268 -268
- package/docs/components/switch.md +106 -106
- package/docs/components/table.md +138 -138
- package/docs/components/tabs.md +117 -117
- package/docs/components/textarea.md +86 -86
- package/docs/components/theme-toggle.md +73 -73
- package/docs/components/timeline.md +121 -121
- package/docs/components/toggle-group.md +68 -68
- package/docs/components/toggle.md +62 -62
- package/docs/components/tooltip.md +116 -116
- package/docs/components/tree-view.md +238 -238
- package/docs/components/use-mobile.md +96 -96
- package/docs/components/video-player.md +68 -68
- package/docs/components/xertica-logo.md +36 -36
- package/docs/components/xertica-orbe.md +35 -35
- package/docs/components/xertica-provider.md +65 -65
- package/docs/components/xertica-xlogo.md +35 -35
- package/docs/decision-tree.md +293 -293
- package/docs/doc-audit.md +243 -224
- package/docs/form-sizing.md +162 -162
- package/docs/getting-started.md +591 -568
- package/docs/guidelines.md +328 -222
- package/docs/i18n.md +324 -43
- package/docs/installation.md +267 -267
- package/docs/layout.md +143 -143
- package/docs/llms.md +295 -295
- package/docs/patterns/analytics.md +194 -194
- package/docs/patterns/crud.md +149 -149
- package/docs/patterns/dashboard.md +138 -138
- package/docs/patterns/detail-page.md +296 -296
- package/docs/patterns/form.md +241 -241
- package/docs/patterns/login.md +156 -156
- package/docs/patterns/settings.md +368 -368
- package/docs/patterns/wizard.md +213 -213
- package/docs/state-management.md +289 -283
- package/guidelines/Guidelines.md +406 -257
- package/hooks/useTheme.test.tsx +16 -16
- package/hooks/useTheme.ts +4 -4
- package/imports/Podcast.tsx +540 -540
- package/imports/XerticaAi.tsx +46 -46
- package/imports/XerticaX.tsx +15 -15
- package/imports/svg-aueiaqngck.ts +20 -20
- package/imports/svg-v9krss1ozd.ts +23 -23
- package/imports/svg-vhrdofe3qe.ts +6 -6
- package/llms-compact.txt +1 -1
- package/llms-full.txt +5 -2
- package/llms.txt +186 -186
- package/mcp/resources.json +22 -22
- package/mcp/tools.json +35 -35
- package/package.json +213 -213
- package/scripts/ai-validator.ts +91 -91
- package/scripts/cleanup-case-dupes.ts +62 -62
- package/scripts/generate-ai-manifests.ts +107 -107
- package/styles/globals.css +13 -13
- package/styles/xertica/app-overrides/chat.css +61 -61
- package/styles/xertica/app-overrides/scrollbar.css +33 -33
- package/styles/xertica/base.css +71 -71
- package/styles/xertica/integrations/google-maps.css +76 -76
- package/styles/xertica/integrations/sonner.css +73 -73
- package/styles/xertica/theme-map.css +99 -99
- package/styles/xertica/tokens.css +236 -236
- package/templates/.prettierignore +4 -4
- package/templates/.prettierrc +10 -10
- package/templates/CLAUDE.md +180 -180
- package/templates/eslint.config.js +26 -26
- package/templates/guidelines/Guidelines.md +553 -335
- package/templates/package.json +69 -69
- package/templates/postcss.config.js +6 -6
- package/templates/src/app/App.tsx +46 -46
- package/templates/src/app/components/AppLayout.tsx +55 -55
- package/templates/src/app/components/AuthGuard.tsx +82 -82
- package/templates/src/app/context/AuthContext.tsx +108 -108
- package/templates/src/features/assistant/data/mock.ts +21 -12
- package/templates/src/features/assistant/hooks/useAssistantConfig.ts +4 -3
- package/templates/src/features/assistant/index.ts +5 -5
- package/templates/src/features/auth/index.ts +4 -4
- package/templates/src/features/auth/ui/AuthPageShell.tsx +32 -32
- 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 +177 -177
- package/templates/src/features/auth/ui/SocialLoginButtons.tsx +73 -73
- package/templates/src/features/auth/ui/VerifyEmailContent.tsx +82 -82
- package/templates/src/features/home/data/mock.ts +35 -35
- package/templates/src/features/home/hooks/useFeatureCards.ts +4 -3
- package/templates/src/features/home/index.ts +11 -11
- package/templates/src/features/home/store/dashboardStore.ts +25 -25
- package/templates/src/features/home/ui/HomeContent.tsx +119 -121
- package/templates/src/features/template/index.ts +5 -5
- package/templates/src/features/template/ui/CrudTemplate.tsx +32 -17
- package/templates/src/features/template/ui/DashboardTemplate.tsx +31 -15
- package/templates/src/features/template/ui/FormTemplate.tsx +21 -21
- package/templates/src/features/template/ui/LoginTemplate.tsx +14 -7
- package/templates/src/features/template/ui/TemplateContent.tsx +403 -288
- package/templates/src/i18n.ts +97 -11
- package/templates/src/locales/en/common.json +21 -0
- package/templates/src/locales/en/components/activityCard.json +10 -0
- package/templates/src/locales/en/components/assistant.json +105 -0
- package/templates/src/locales/en/components/media.json +29 -0
- package/templates/src/locales/en/components/notificationCard.json +5 -0
- package/templates/src/locales/en/components/profileCard.json +8 -0
- package/templates/src/locales/en/components/projectCard.json +10 -0
- package/templates/src/locales/en/components/sidebar.json +14 -0
- package/templates/src/locales/en/components/stats.json +8 -0
- package/templates/src/locales/en/components/team.json +14 -0
- package/templates/src/locales/en/errors.json +9 -0
- package/templates/src/locales/en/languageSelector.json +7 -0
- package/templates/src/locales/en/nav.json +6 -0
- package/templates/src/locales/en/pages/crudTemplate.json +25 -0
- package/templates/src/locales/en/pages/dashboardTemplate.json +20 -0
- package/templates/src/locales/en/pages/formTemplate.json +16 -0
- package/templates/src/locales/en/pages/home.json +7 -0
- package/templates/src/locales/en/pages/login.json +15 -0
- package/templates/src/locales/en/pages/loginTemplate.json +9 -0
- package/templates/src/locales/en/pages/resetPassword.json +18 -0
- package/templates/src/locales/en/pages/templates.json +317 -0
- package/templates/src/locales/en/pages/verifyEmail.json +12 -0
- package/templates/src/locales/en/themeToggle.json +6 -0
- package/templates/src/locales/es/common.json +21 -0
- package/templates/src/locales/es/components/activityCard.json +10 -0
- package/templates/src/locales/es/components/assistant.json +105 -0
- package/templates/src/locales/es/components/media.json +29 -0
- package/templates/src/locales/es/components/notificationCard.json +5 -0
- package/templates/src/locales/es/components/profileCard.json +8 -0
- package/templates/src/locales/es/components/projectCard.json +10 -0
- package/templates/src/locales/es/components/sidebar.json +14 -0
- package/templates/src/locales/es/components/stats.json +8 -0
- package/templates/src/locales/es/components/team.json +14 -0
- package/templates/src/locales/es/errors.json +9 -0
- package/templates/src/locales/es/languageSelector.json +7 -0
- package/templates/src/locales/es/nav.json +6 -0
- package/templates/src/locales/es/pages/crudTemplate.json +25 -0
- package/templates/src/locales/es/pages/dashboardTemplate.json +20 -0
- package/templates/src/locales/es/pages/formTemplate.json +16 -0
- package/templates/src/locales/es/pages/home.json +7 -0
- package/templates/src/locales/es/pages/login.json +15 -0
- package/templates/src/locales/es/pages/loginTemplate.json +9 -0
- package/templates/src/locales/es/pages/resetPassword.json +18 -0
- package/templates/src/locales/es/pages/templates.json +317 -0
- package/templates/src/locales/es/pages/verifyEmail.json +12 -0
- package/templates/src/locales/es/themeToggle.json +6 -0
- package/templates/src/locales/pt-BR/common.json +21 -0
- package/templates/src/locales/pt-BR/components/activityCard.json +10 -0
- package/templates/src/locales/pt-BR/components/assistant.json +105 -0
- package/templates/src/locales/pt-BR/components/media.json +29 -0
- package/templates/src/locales/pt-BR/components/notificationCard.json +5 -0
- package/templates/src/locales/pt-BR/components/profileCard.json +8 -0
- package/templates/src/locales/pt-BR/components/projectCard.json +10 -0
- package/templates/src/locales/pt-BR/components/sidebar.json +14 -0
- package/templates/src/locales/pt-BR/components/stats.json +8 -0
- package/templates/src/locales/pt-BR/components/team.json +14 -0
- package/templates/src/locales/pt-BR/errors.json +9 -0
- package/templates/src/locales/pt-BR/languageSelector.json +7 -0
- package/templates/src/locales/pt-BR/nav.json +6 -0
- package/templates/src/locales/pt-BR/pages/crudTemplate.json +25 -0
- package/templates/src/locales/pt-BR/pages/dashboardTemplate.json +20 -0
- package/templates/src/locales/pt-BR/pages/formTemplate.json +16 -0
- package/templates/src/locales/pt-BR/pages/home.json +7 -0
- package/templates/src/locales/pt-BR/pages/login.json +15 -0
- package/templates/src/locales/pt-BR/pages/loginTemplate.json +9 -0
- package/templates/src/locales/pt-BR/pages/resetPassword.json +18 -0
- package/templates/src/locales/pt-BR/pages/templates.json +317 -0
- package/templates/src/locales/pt-BR/pages/verifyEmail.json +12 -0
- package/templates/src/locales/pt-BR/themeToggle.json +6 -0
- package/templates/src/main.tsx +11 -11
- package/templates/src/pages/AssistantPage.tsx +463 -463
- package/templates/src/pages/ForgotPasswordPage.tsx +6 -6
- package/templates/src/pages/HomePage.tsx +49 -50
- package/templates/src/pages/LoginPage.tsx +10 -10
- package/templates/src/pages/ResetPasswordPage.tsx +6 -6
- package/templates/src/pages/TemplatePage.tsx +28 -28
- package/templates/src/pages/VerifyEmailPage.tsx +6 -6
- package/templates/src/shared/config/navigation.ts +19 -19
- package/templates/src/shared/error-boundary.tsx +154 -154
- package/templates/src/shared/error-fallbacks.tsx +226 -226
- package/templates/src/shared/lib/auth.ts +20 -20
- package/templates/src/shared/types/auth.ts +3 -3
- package/templates/src/styles/index.css +95 -95
- package/templates/src/styles/xertica/tokens.css +236 -236
- package/templates/tsconfig.json +25 -25
- package/templates/tsconfig.node.json +12 -12
- package/templates/vite-env.d.ts +1 -1
- package/templates/vite.config.ts +51 -21
- package/utils/color-utils.ts +72 -72
- package/utils/demo-responses.test.ts +10 -10
- package/utils/demo-responses.ts +151 -151
- package/utils/gemini.test.ts +25 -25
- package/utils/gemini.ts +155 -155
- package/dist/AssistantChart-DIpshm3i.js +0 -4784
- package/dist/AssistantChart-zjsy2GaZ.cjs +0 -4810
- package/dist/AudioPlayer-B1lt5cPl.cjs +0 -989
- package/dist/AudioPlayer-BZ7bibzU.cjs +0 -982
- package/dist/AudioPlayer-C12BjQBV.cjs +0 -997
- package/dist/AudioPlayer-CFeV8t-5.cjs +0 -936
- package/dist/AudioPlayer-CGRUtUdN.js +0 -937
- package/dist/AudioPlayer-DMcG_c7L.js +0 -990
- package/dist/AudioPlayer-DcFKRJE_.js +0 -998
- package/dist/AudioPlayer-e8LfNoqO.js +0 -983
- package/dist/CodeBlock-BeSt1h5P.js +0 -2078
- package/dist/CodeBlock-BgfYL_rD.cjs +0 -2094
- package/dist/CodeBlock-BlcqlA9M.cjs +0 -2094
- package/dist/CodeBlock-Bnmeu5ez.cjs +0 -2094
- package/dist/CodeBlock-BtfPlbAI.js +0 -2078
- package/dist/CodeBlock-CIySIuYr.js +0 -2078
- package/dist/CodeBlock-CuPtUM-7.cjs +0 -2094
- package/dist/CodeBlock-D6ffWXgc.js +0 -2078
- package/dist/CodeBlock-D8dcwbit.cjs +0 -2094
- package/dist/CodeBlock-DMZrFnlw.cjs +0 -2094
- package/dist/CodeBlock-DlBehYN8.js +0 -2078
- package/dist/CodeBlock-DvKWbSnE.cjs +0 -2094
- package/dist/CodeBlock-DwMCfkFY.js +0 -2078
- package/dist/CodeBlock-Dy6CNYyj.js +0 -2078
- package/dist/CodeBlock-U1pPOQI7.cjs +0 -2094
- package/dist/CodeBlock-f_GpNhEB.js +0 -2078
- package/dist/CodeBlock-oB6u8nI1.js +0 -2078
- package/dist/CodeBlock-tZC31B73.cjs +0 -2094
- package/dist/FeatureCard-CxC-7C-C.cjs +0 -300
- package/dist/ImageWithFallback-CGtidP6B.cjs +0 -4542
- package/dist/ImageWithFallback-lsg3pdFg.js +0 -4508
- package/dist/LayoutContext-BAql6ZRY.js +0 -97
- package/dist/LayoutContext-BvK-ggDa.cjs +0 -96
- package/dist/ThemeContext-BoH4NLfN.js +0 -734
- package/dist/ThemeContext-r69W20Xg.cjs +0 -733
- package/dist/VerifyEmailPage-COiyNl1y.js +0 -2825
- package/dist/VerifyEmailPage-CqKsR2v8.js +0 -2827
- package/dist/XerticaOrbe-KL1RBHzw.cjs +0 -1354
- package/dist/XerticaOrbe-zwS1p2a8.js +0 -1355
- package/dist/XerticaProvider-6btlAlzc.js +0 -17
- package/dist/XerticaProvider-BNoNOxQ5.cjs +0 -16
- package/dist/XerticaProvider-BlY2limY.cjs +0 -38
- package/dist/XerticaProvider-DDuiIcKo.js +0 -39
- package/dist/XerticaProvider-cI9hSs27.cjs +0 -38
- package/dist/XerticaProvider-hSwhNQex.js +0 -39
- package/dist/breadcrumb-CqJ7bHY5.js +0 -161
- package/dist/breadcrumb-m9Hb2_XN.cjs +0 -177
- package/dist/components/assistant/xertica-assistant/hooks/index.d.ts +0 -6
- package/dist/components/assistant/xertica-assistant/hooks/use-assistant-conversations.d.ts +0 -21
- package/dist/components/assistant/xertica-assistant/hooks/use-assistant-messages.d.ts +0 -49
- package/dist/components/assistant/xertica-assistant/hooks/use-assistant-suggestions.d.ts +0 -16
- package/dist/components/blocks/audio-player/AudioPlayer.d.ts +0 -35
- package/dist/components/blocks/audio-player/index.d.ts +0 -1
- package/dist/components/blocks/document-editor/DocumentEditor.d.ts +0 -26
- package/dist/components/blocks/document-editor/index.d.ts +0 -1
- package/dist/components/blocks/podcast-player/PodcastPlayer.d.ts +0 -41
- package/dist/components/blocks/podcast-player/index.d.ts +0 -1
- package/dist/components/ui/chart/parts/chart-dashboard.d.ts +0 -113
- package/dist/components/ui/chart/parts/chart-metric.d.ts +0 -118
- package/dist/components/ui/chart/parts/chart-primitives.d.ts +0 -101
- package/dist/components/ui/chart/parts/chart-shared.d.ts +0 -20
- package/dist/components/ui/chart/parts/chart-utils.d.ts +0 -12
- package/dist/components/ui/chart/parts/index.d.ts +0 -5
- package/dist/dropdown-menu-BDB5CmQs.cjs +0 -247
- package/dist/dropdown-menu-DQidbKBD.js +0 -231
- package/dist/google-maps-loader-BFWp6VPd.js +0 -287
- package/dist/google-maps-loader-eS3uQ5TA.cjs +0 -287
- package/dist/header-Cgy6vYPk.cjs +0 -731
- package/dist/header-DRlT4jgI.js +0 -715
- package/dist/header-Dux00SI4.cjs +0 -731
- package/dist/header-EkGKXPsD.js +0 -715
- package/dist/header-WfEywpyc.cjs +0 -731
- package/dist/header-tifNQn2U.js +0 -715
- package/dist/index-BhapVLVj.js +0 -8
- package/dist/index-D6fxYEY8.cjs +0 -7
- package/dist/index-DW5tYe26.js +0 -8
- package/dist/input-2R4loU86.js +0 -127
- package/dist/input-DWANSKGb.cjs +0 -145
- package/dist/progress-DPtzoVV8.js +0 -175
- package/dist/progress-EeaoqqUs.cjs +0 -191
- package/dist/rich-text-editor-0mraWT5y.cjs +0 -2376
- package/dist/rich-text-editor-B6jMRLzk.cjs +0 -1939
- package/dist/rich-text-editor-B8_oYcIR.js +0 -1730
- package/dist/rich-text-editor-B9UbSXNb.js +0 -1203
- package/dist/rich-text-editor-BYuRBNBU.js +0 -2373
- package/dist/rich-text-editor-Bb9pySTs.cjs +0 -2374
- package/dist/rich-text-editor-BcL6L3cm.cjs +0 -2374
- package/dist/rich-text-editor-BoVZYtTs.cjs +0 -2391
- package/dist/rich-text-editor-CMgSN_w2.js +0 -1189
- package/dist/rich-text-editor-CPV1lEPH.cjs +0 -1748
- package/dist/rich-text-editor-CoKqbCtu.cjs +0 -1799
- package/dist/rich-text-editor-Cw56T_mB.js +0 -2356
- package/dist/rich-text-editor-Cyt8qs2b.js +0 -1921
- package/dist/rich-text-editor-D6H84OcX.cjs +0 -1220
- package/dist/rich-text-editor-D76gD-QI.js +0 -2328
- package/dist/rich-text-editor-DKkokOnA.js +0 -1781
- package/dist/rich-text-editor-DNsdpN64.cjs +0 -2359
- package/dist/rich-text-editor-DfG8bCyY.js +0 -2358
- package/dist/rich-text-editor-Dxjw31Z4.js +0 -2341
- package/dist/rich-text-editor-DzP0Epmb.js +0 -2356
- package/dist/rich-text-editor-lyYE2ZG5.cjs +0 -1207
- package/dist/rich-text-editor-skplNlBM.cjs +0 -2345
- package/dist/select-Bkbr0f-Z.cjs +0 -162
- package/dist/select-CvIVdX2n.js +0 -145
- package/dist/sidebar-Djn5syhi.cjs +0 -786
- package/dist/sidebar-_rT7rBMk.js +0 -787
- package/dist/slider-Bc5Hd0y1.js +0 -56
- package/dist/slider-N7hFFj6X.cjs +0 -73
- package/dist/tooltip-Ded96neP.cjs +0 -137
- package/dist/tooltip-HDOoD2-0.js +0 -120
- package/dist/use-audio-player-BkmEmj8Q.js +0 -185
- package/dist/use-audio-player-CLFTWFW1.cjs +0 -184
- package/dist/use-file-upload-BcjEo2S5.js +0 -404
- package/dist/use-file-upload-CRJR68Tj.cjs +0 -403
- package/dist/use-mobile-B0hNy_Y6.cjs +0 -4303
- package/dist/use-mobile-Bbd51ASU.cjs +0 -4392
- package/dist/use-mobile-Bk6CX-TC.js +0 -4359
- package/dist/use-mobile-BvYdisLP.js +0 -4202
- package/dist/use-mobile-BzuxjzNX.cjs +0 -4392
- package/dist/use-mobile-CKb5pqTs.js +0 -4269
- package/dist/use-mobile-CYuAuGDl.js +0 -4202
- package/dist/use-mobile-CaENcqm-.js +0 -4508
- package/dist/use-mobile-CbrYgJGJ.js +0 -4203
- package/dist/use-mobile-DMOvImGQ.cjs +0 -4542
- package/dist/use-mobile-DRB3BQgD.cjs +0 -4235
- package/dist/use-mobile-DZvv7QMR.js +0 -4359
- package/dist/use-mobile-DdI_TXam.cjs +0 -4235
- package/dist/use-mobile-DlceKf8a.js +0 -4359
- package/dist/use-mobile-DsOnow1o.cjs +0 -4236
- package/dist/use-mobile-Kcj6jSnK.cjs +0 -4392
- package/dist/use-mobile-bnKcua_i.js +0 -4202
- package/dist/use-mobile-ncXBeE2z.cjs +0 -4235
- package/dist/use-rich-text-editor-DjiddBGv.js +0 -282
- package/dist/use-rich-text-editor-lpeswbCs.cjs +0 -281
- package/templates/src/locales/en.json +0 -79
- package/templates/src/locales/es.json +0 -79
- package/templates/src/locales/pt-BR.json +0 -79
- package/dist/{rich-text-editor-DgF8s7xW.js → rich-text-editor-BmsjY03B.js} +26 -26
- package/dist/{rich-text-editor-mWoaSCE4.cjs → rich-text-editor-GS2kpTAK.cjs} +26 -26
|
@@ -1,634 +1,634 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useRichTextEditor } from './use-rich-text-editor';
|
|
3
|
-
import { cn } from '../../shared/utils';
|
|
4
|
-
import { Button } from '../button';
|
|
5
|
-
import {
|
|
6
|
-
DropdownMenu,
|
|
7
|
-
DropdownMenuContent,
|
|
8
|
-
DropdownMenuItem,
|
|
9
|
-
DropdownMenuTrigger,
|
|
10
|
-
} from '../dropdown-menu';
|
|
11
|
-
import { Popover, PopoverContent, PopoverTrigger } from '../popover';
|
|
12
|
-
import {
|
|
13
|
-
Bold,
|
|
14
|
-
Italic,
|
|
15
|
-
Underline,
|
|
16
|
-
AlignLeft,
|
|
17
|
-
AlignCenter,
|
|
18
|
-
AlignRight,
|
|
19
|
-
List,
|
|
20
|
-
ListOrdered,
|
|
21
|
-
Type,
|
|
22
|
-
Heading1,
|
|
23
|
-
Heading2,
|
|
24
|
-
Heading3,
|
|
25
|
-
ChevronDown,
|
|
26
|
-
Undo,
|
|
27
|
-
Redo,
|
|
28
|
-
Search,
|
|
29
|
-
ChevronUp,
|
|
30
|
-
X,
|
|
31
|
-
Link as LinkIcon,
|
|
32
|
-
} from 'lucide-react';
|
|
33
|
-
import { Input } from '../input';
|
|
34
|
-
|
|
35
|
-
export interface RichTextEditorProps {
|
|
36
|
-
value: string;
|
|
37
|
-
onChange?: (value: string) => void;
|
|
38
|
-
placeholder?: string;
|
|
39
|
-
className?: string;
|
|
40
|
-
actionButton?: React.ReactNode;
|
|
41
|
-
allowSearch?: boolean;
|
|
42
|
-
allowLinks?: boolean;
|
|
43
|
-
allowUndoRedo?: boolean;
|
|
44
|
-
allowHeadings?: boolean;
|
|
45
|
-
allowFormatting?: boolean;
|
|
46
|
-
allowAlignment?: boolean;
|
|
47
|
-
allowLists?: boolean;
|
|
48
|
-
showWordCount?: boolean;
|
|
49
|
-
showCharacterCount?: boolean;
|
|
50
|
-
/** Disables all editing and applies opacity-50. Hides the toolbar. */
|
|
51
|
-
disabled?: boolean;
|
|
52
|
-
/** Makes the editor non-editable while keeping full visual fidelity. Hides the toolbar. */
|
|
53
|
-
readOnly?: boolean;
|
|
54
|
-
/** Called when the editor area receives focus. */
|
|
55
|
-
onFocus?: () => void;
|
|
56
|
-
/** Called when the editor area loses focus. */
|
|
57
|
-
onBlur?: () => void;
|
|
58
|
-
/** Minimum height of the editable area (CSS value, e.g. "200px"). */
|
|
59
|
-
minHeight?: string;
|
|
60
|
-
/** Maximum height of the editable area (CSS value, e.g. "600px"). */
|
|
61
|
-
maxHeight?: string;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
65
|
-
// Component
|
|
66
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
67
|
-
export function RichTextEditor({
|
|
68
|
-
value,
|
|
69
|
-
onChange,
|
|
70
|
-
placeholder,
|
|
71
|
-
className,
|
|
72
|
-
actionButton,
|
|
73
|
-
allowSearch = true,
|
|
74
|
-
allowLinks = true,
|
|
75
|
-
allowUndoRedo = true,
|
|
76
|
-
allowHeadings = true,
|
|
77
|
-
allowFormatting = true,
|
|
78
|
-
allowAlignment = true,
|
|
79
|
-
allowLists = true,
|
|
80
|
-
showWordCount = true,
|
|
81
|
-
showCharacterCount = true,
|
|
82
|
-
disabled = false,
|
|
83
|
-
readOnly = false,
|
|
84
|
-
onFocus,
|
|
85
|
-
onBlur,
|
|
86
|
-
minHeight,
|
|
87
|
-
maxHeight,
|
|
88
|
-
}: RichTextEditorProps) {
|
|
89
|
-
const isEditable = !disabled && !readOnly;
|
|
90
|
-
const showToolbar = isEditable;
|
|
91
|
-
|
|
92
|
-
const {
|
|
93
|
-
editorRef,
|
|
94
|
-
searchInputRef,
|
|
95
|
-
linkInputRef,
|
|
96
|
-
activeFormats,
|
|
97
|
-
isSearchOpen,
|
|
98
|
-
setIsSearchOpen,
|
|
99
|
-
searchQuery,
|
|
100
|
-
setSearchQuery,
|
|
101
|
-
linkUrl,
|
|
102
|
-
setLinkUrl,
|
|
103
|
-
isLinkOpen,
|
|
104
|
-
hasSavedSelection,
|
|
105
|
-
wordCount,
|
|
106
|
-
characterCount,
|
|
107
|
-
updateActiveFormats,
|
|
108
|
-
execCommand,
|
|
109
|
-
handleInput,
|
|
110
|
-
performSearch,
|
|
111
|
-
handleCreateLink,
|
|
112
|
-
handleUnlink,
|
|
113
|
-
onLinkPopoverOpenChange,
|
|
114
|
-
} = useRichTextEditor({ value, onChange });
|
|
115
|
-
|
|
116
|
-
const getCurrentBlockLabel = () => {
|
|
117
|
-
if (activeFormats.h1)
|
|
118
|
-
return (
|
|
119
|
-
<>
|
|
120
|
-
<Heading1 className="w-4 h-4 mr-1 shrink-0" />
|
|
121
|
-
<span className="truncate">Título 1</span>
|
|
122
|
-
</>
|
|
123
|
-
);
|
|
124
|
-
if (activeFormats.h2)
|
|
125
|
-
return (
|
|
126
|
-
<>
|
|
127
|
-
<Heading2 className="w-4 h-4 mr-1 shrink-0" />
|
|
128
|
-
<span className="truncate">Título 2</span>
|
|
129
|
-
</>
|
|
130
|
-
);
|
|
131
|
-
if (activeFormats.h3)
|
|
132
|
-
return (
|
|
133
|
-
<>
|
|
134
|
-
<Heading3 className="w-4 h-4 mr-1 shrink-0" />
|
|
135
|
-
<span className="truncate">Título 3</span>
|
|
136
|
-
</>
|
|
137
|
-
);
|
|
138
|
-
return (
|
|
139
|
-
<>
|
|
140
|
-
<Type className="w-4 h-4 mr-1 shrink-0" />
|
|
141
|
-
<span className="truncate">Parágrafo</span>
|
|
142
|
-
</>
|
|
143
|
-
);
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
return (
|
|
147
|
-
<div
|
|
148
|
-
className={cn(
|
|
149
|
-
'flex flex-col h-full w-full bg-background sm:border border-border sm:shadow-sm sm:rounded-lg overflow-hidden',
|
|
150
|
-
disabled && 'opacity-50 pointer-events-none',
|
|
151
|
-
className
|
|
152
|
-
)}
|
|
153
|
-
>
|
|
154
|
-
<style>{`
|
|
155
|
-
[contenteditable]:empty:before {
|
|
156
|
-
content: attr(data-placeholder);
|
|
157
|
-
color: hsl(var(--muted-foreground));
|
|
158
|
-
pointer-events: none;
|
|
159
|
-
display: block;
|
|
160
|
-
}
|
|
161
|
-
.prose-editor ul {
|
|
162
|
-
list-style-type: disc !important;
|
|
163
|
-
padding-left: 1.5rem !important;
|
|
164
|
-
margin-top: 0.5rem !important;
|
|
165
|
-
margin-bottom: 0.5rem !important;
|
|
166
|
-
}
|
|
167
|
-
.prose-editor ol {
|
|
168
|
-
list-style-type: decimal !important;
|
|
169
|
-
padding-left: 1.5rem !important;
|
|
170
|
-
margin-top: 0.5rem !important;
|
|
171
|
-
margin-bottom: 0.5rem !important;
|
|
172
|
-
}
|
|
173
|
-
.prose-editor b, .prose-editor strong {
|
|
174
|
-
font-weight: 600 !important;
|
|
175
|
-
}
|
|
176
|
-
.prose-editor i, .prose-editor em {
|
|
177
|
-
font-style: italic !important;
|
|
178
|
-
}
|
|
179
|
-
.prose-editor u {
|
|
180
|
-
text-decoration: underline !important;
|
|
181
|
-
}
|
|
182
|
-
.prose-editor h1 {
|
|
183
|
-
font-size: 2.25rem !important;
|
|
184
|
-
font-weight: 700 !important;
|
|
185
|
-
margin-bottom: 1.25rem !important;
|
|
186
|
-
line-height: 1.2 !important;
|
|
187
|
-
margin-top: 2rem !important;
|
|
188
|
-
color: hsl(var(--foreground));
|
|
189
|
-
}
|
|
190
|
-
.prose-editor h2 {
|
|
191
|
-
font-size: 1.75rem !important;
|
|
192
|
-
font-weight: 600 !important;
|
|
193
|
-
margin-bottom: 1rem !important;
|
|
194
|
-
margin-top: 1.5rem !important;
|
|
195
|
-
color: hsl(var(--foreground));
|
|
196
|
-
}
|
|
197
|
-
.prose-editor h3 {
|
|
198
|
-
font-size: 1.35rem !important;
|
|
199
|
-
font-weight: 600 !important;
|
|
200
|
-
margin-bottom: 0.75rem !important;
|
|
201
|
-
margin-top: 1.25rem !important;
|
|
202
|
-
color: hsl(var(--foreground));
|
|
203
|
-
}
|
|
204
|
-
.prose-editor p {
|
|
205
|
-
margin-bottom: 1rem !important;
|
|
206
|
-
line-height: 1.6 !important;
|
|
207
|
-
}
|
|
208
|
-
.prose-editor a {
|
|
209
|
-
color: var(--info) !important;
|
|
210
|
-
text-decoration: underline !important;
|
|
211
|
-
cursor: pointer !important;
|
|
212
|
-
}
|
|
213
|
-
.prose-editor h1:first-child, .prose-editor h2:first-child, .prose-editor h3:first-child, .prose-editor p:first-child {
|
|
214
|
-
margin-top: 0 !important;
|
|
215
|
-
}
|
|
216
|
-
.prose-editor {
|
|
217
|
-
outline: none !important;
|
|
218
|
-
}
|
|
219
|
-
`}</style>
|
|
220
|
-
|
|
221
|
-
{/* Toolbar — hidden in disabled/readOnly mode */}
|
|
222
|
-
{showToolbar && (
|
|
223
|
-
<div className="px-3 py-2 border-b border-border bg-muted/30 flex items-center gap-1 flex-wrap shrink-0">
|
|
224
|
-
{allowUndoRedo && (
|
|
225
|
-
<>
|
|
226
|
-
<Button
|
|
227
|
-
variant="ghost"
|
|
228
|
-
size="icon"
|
|
229
|
-
className="h-8 w-8 text-muted-foreground"
|
|
230
|
-
onClick={() => execCommand('undo')}
|
|
231
|
-
title="Desfazer"
|
|
232
|
-
aria-label="Desfazer"
|
|
233
|
-
>
|
|
234
|
-
<Undo className="w-4 h-4" />
|
|
235
|
-
</Button>
|
|
236
|
-
<Button
|
|
237
|
-
variant="ghost"
|
|
238
|
-
size="icon"
|
|
239
|
-
className="h-8 w-8 text-muted-foreground"
|
|
240
|
-
onClick={() => execCommand('redo')}
|
|
241
|
-
title="Refazer"
|
|
242
|
-
aria-label="Refazer"
|
|
243
|
-
>
|
|
244
|
-
<Redo className="w-4 h-4" />
|
|
245
|
-
</Button>
|
|
246
|
-
<div className="w-px h-6 bg-border mx-1 hidden sm:block"></div>
|
|
247
|
-
</>
|
|
248
|
-
)}
|
|
249
|
-
|
|
250
|
-
{allowHeadings && (
|
|
251
|
-
<>
|
|
252
|
-
<DropdownMenu modal={false}>
|
|
253
|
-
<DropdownMenuTrigger asChild>
|
|
254
|
-
<Button
|
|
255
|
-
variant="ghost"
|
|
256
|
-
size="sm"
|
|
257
|
-
className="h-8 gap-0 text-muted-foreground w-[120px] justify-start px-2"
|
|
258
|
-
>
|
|
259
|
-
{getCurrentBlockLabel()}
|
|
260
|
-
<ChevronDown className="w-3 h-3 ml-auto opacity-50 shrink-0" />
|
|
261
|
-
</Button>
|
|
262
|
-
</DropdownMenuTrigger>
|
|
263
|
-
<DropdownMenuContent align="start" className="w-[160px]" style={{ zIndex: 9999 }}>
|
|
264
|
-
<DropdownMenuItem
|
|
265
|
-
onPointerDown={e => e.preventDefault()}
|
|
266
|
-
onClick={() => execCommand('formatBlock', 'P')}
|
|
267
|
-
className="gap-2"
|
|
268
|
-
>
|
|
269
|
-
<Type className="w-4 h-4 text-muted-foreground" /> Parágrafo
|
|
270
|
-
</DropdownMenuItem>
|
|
271
|
-
<DropdownMenuItem
|
|
272
|
-
onPointerDown={e => e.preventDefault()}
|
|
273
|
-
onClick={() => execCommand('formatBlock', 'H1')}
|
|
274
|
-
className="gap-2"
|
|
275
|
-
>
|
|
276
|
-
<Heading1 className="w-4 h-4 text-muted-foreground" /> Título 1
|
|
277
|
-
</DropdownMenuItem>
|
|
278
|
-
<DropdownMenuItem
|
|
279
|
-
onPointerDown={e => e.preventDefault()}
|
|
280
|
-
onClick={() => execCommand('formatBlock', 'H2')}
|
|
281
|
-
className="gap-2"
|
|
282
|
-
>
|
|
283
|
-
<Heading2 className="w-4 h-4 text-muted-foreground" /> Título 2
|
|
284
|
-
</DropdownMenuItem>
|
|
285
|
-
<DropdownMenuItem
|
|
286
|
-
onPointerDown={e => e.preventDefault()}
|
|
287
|
-
onClick={() => execCommand('formatBlock', 'H3')}
|
|
288
|
-
className="gap-2"
|
|
289
|
-
>
|
|
290
|
-
<Heading3 className="w-4 h-4 text-muted-foreground" /> Título 3
|
|
291
|
-
</DropdownMenuItem>
|
|
292
|
-
</DropdownMenuContent>
|
|
293
|
-
</DropdownMenu>
|
|
294
|
-
<div className="w-px h-6 bg-border mx-1 hidden sm:block"></div>
|
|
295
|
-
</>
|
|
296
|
-
)}
|
|
297
|
-
|
|
298
|
-
{allowFormatting && (
|
|
299
|
-
<>
|
|
300
|
-
<Button
|
|
301
|
-
variant="ghost"
|
|
302
|
-
size="icon"
|
|
303
|
-
className={cn(
|
|
304
|
-
'h-8 w-8 text-muted-foreground',
|
|
305
|
-
activeFormats.bold && 'bg-muted text-foreground'
|
|
306
|
-
)}
|
|
307
|
-
onClick={() => execCommand('bold')}
|
|
308
|
-
title="Negrito"
|
|
309
|
-
aria-label="Negrito"
|
|
310
|
-
>
|
|
311
|
-
<Bold className="w-4 h-4" />
|
|
312
|
-
</Button>
|
|
313
|
-
<Button
|
|
314
|
-
variant="ghost"
|
|
315
|
-
size="icon"
|
|
316
|
-
className={cn(
|
|
317
|
-
'h-8 w-8 text-muted-foreground',
|
|
318
|
-
activeFormats.italic && 'bg-muted text-foreground'
|
|
319
|
-
)}
|
|
320
|
-
onClick={() => execCommand('italic')}
|
|
321
|
-
title="Itálico"
|
|
322
|
-
aria-label="Itálico"
|
|
323
|
-
>
|
|
324
|
-
<Italic className="w-4 h-4" />
|
|
325
|
-
</Button>
|
|
326
|
-
<Button
|
|
327
|
-
variant="ghost"
|
|
328
|
-
size="icon"
|
|
329
|
-
className={cn(
|
|
330
|
-
'h-8 w-8 text-muted-foreground',
|
|
331
|
-
activeFormats.underline && 'bg-muted text-foreground'
|
|
332
|
-
)}
|
|
333
|
-
onClick={() => execCommand('underline')}
|
|
334
|
-
title="Sublinhado"
|
|
335
|
-
aria-label="Sublinhado"
|
|
336
|
-
>
|
|
337
|
-
<Underline className="w-4 h-4" />
|
|
338
|
-
</Button>
|
|
339
|
-
<div className="w-px h-6 bg-border mx-1 hidden sm:block"></div>
|
|
340
|
-
</>
|
|
341
|
-
)}
|
|
342
|
-
|
|
343
|
-
{allowAlignment && (
|
|
344
|
-
<>
|
|
345
|
-
<Button
|
|
346
|
-
variant="ghost"
|
|
347
|
-
size="icon"
|
|
348
|
-
className={cn(
|
|
349
|
-
'h-8 w-8 text-muted-foreground',
|
|
350
|
-
activeFormats.justifyLeft && 'bg-muted text-foreground'
|
|
351
|
-
)}
|
|
352
|
-
onClick={() => execCommand('justifyLeft')}
|
|
353
|
-
title="Alinhar à esquerda"
|
|
354
|
-
aria-label="Alinhar à esquerda"
|
|
355
|
-
>
|
|
356
|
-
<AlignLeft className="w-4 h-4" />
|
|
357
|
-
</Button>
|
|
358
|
-
<Button
|
|
359
|
-
variant="ghost"
|
|
360
|
-
size="icon"
|
|
361
|
-
className={cn(
|
|
362
|
-
'h-8 w-8 text-muted-foreground',
|
|
363
|
-
activeFormats.justifyCenter && 'bg-muted text-foreground'
|
|
364
|
-
)}
|
|
365
|
-
onClick={() => execCommand('justifyCenter')}
|
|
366
|
-
title="Centralizar"
|
|
367
|
-
aria-label="Centralizar"
|
|
368
|
-
>
|
|
369
|
-
<AlignCenter className="w-4 h-4" />
|
|
370
|
-
</Button>
|
|
371
|
-
<Button
|
|
372
|
-
variant="ghost"
|
|
373
|
-
size="icon"
|
|
374
|
-
className={cn(
|
|
375
|
-
'h-8 w-8 text-muted-foreground',
|
|
376
|
-
activeFormats.justifyRight && 'bg-muted text-foreground'
|
|
377
|
-
)}
|
|
378
|
-
onClick={() => execCommand('justifyRight')}
|
|
379
|
-
title="Alinhar à direita"
|
|
380
|
-
aria-label="Alinhar à direita"
|
|
381
|
-
>
|
|
382
|
-
<AlignRight className="w-4 h-4" />
|
|
383
|
-
</Button>
|
|
384
|
-
<div className="w-px h-6 bg-border mx-1 hidden sm:block"></div>
|
|
385
|
-
</>
|
|
386
|
-
)}
|
|
387
|
-
|
|
388
|
-
{allowLists && (
|
|
389
|
-
<>
|
|
390
|
-
<Button
|
|
391
|
-
variant="ghost"
|
|
392
|
-
size="icon"
|
|
393
|
-
className={cn(
|
|
394
|
-
'h-8 w-8 text-muted-foreground',
|
|
395
|
-
activeFormats.insertUnorderedList && 'bg-muted text-foreground'
|
|
396
|
-
)}
|
|
397
|
-
onClick={() => execCommand('insertUnorderedList')}
|
|
398
|
-
title="Lista com marcadores"
|
|
399
|
-
aria-label="Lista com marcadores"
|
|
400
|
-
>
|
|
401
|
-
<List className="w-4 h-4" />
|
|
402
|
-
</Button>
|
|
403
|
-
<Button
|
|
404
|
-
variant="ghost"
|
|
405
|
-
size="icon"
|
|
406
|
-
className={cn(
|
|
407
|
-
'h-8 w-8 text-muted-foreground',
|
|
408
|
-
activeFormats.insertOrderedList && 'bg-muted text-foreground'
|
|
409
|
-
)}
|
|
410
|
-
onClick={() => execCommand('insertOrderedList')}
|
|
411
|
-
title="Lista numerada"
|
|
412
|
-
aria-label="Lista numerada"
|
|
413
|
-
>
|
|
414
|
-
<ListOrdered className="w-4 h-4" />
|
|
415
|
-
</Button>
|
|
416
|
-
<div className="w-px h-6 bg-border mx-1 hidden sm:block"></div>
|
|
417
|
-
</>
|
|
418
|
-
)}
|
|
419
|
-
|
|
420
|
-
{allowLinks && (
|
|
421
|
-
<>
|
|
422
|
-
<Popover open={isLinkOpen} onOpenChange={onLinkPopoverOpenChange} modal={false}>
|
|
423
|
-
<PopoverTrigger asChild>
|
|
424
|
-
<Button
|
|
425
|
-
variant="ghost"
|
|
426
|
-
size="icon"
|
|
427
|
-
className={cn(
|
|
428
|
-
'h-8 w-8 text-muted-foreground',
|
|
429
|
-
(activeFormats.link || isLinkOpen) && 'bg-muted text-foreground'
|
|
430
|
-
)}
|
|
431
|
-
title="Inserir link"
|
|
432
|
-
aria-label="Inserir link"
|
|
433
|
-
>
|
|
434
|
-
<LinkIcon className="w-4 h-4" />
|
|
435
|
-
</Button>
|
|
436
|
-
</PopoverTrigger>
|
|
437
|
-
<PopoverContent className="w-80 p-3" align="start" style={{ zIndex: 9999 }}>
|
|
438
|
-
{!activeFormats.link && !hasSavedSelection ? (
|
|
439
|
-
<p className="text-xs text-muted-foreground py-1">
|
|
440
|
-
Selecione um texto para criar um link.
|
|
441
|
-
</p>
|
|
442
|
-
) : (
|
|
443
|
-
<div className="flex flex-col gap-2">
|
|
444
|
-
<div className="text-xs font-medium">
|
|
445
|
-
{activeFormats.link ? 'Editar Link' : 'Inserir Link'}
|
|
446
|
-
</div>
|
|
447
|
-
<div className="flex gap-2">
|
|
448
|
-
<Input
|
|
449
|
-
ref={linkInputRef}
|
|
450
|
-
placeholder="https://..."
|
|
451
|
-
value={linkUrl}
|
|
452
|
-
onChange={e => setLinkUrl(e.target.value)}
|
|
453
|
-
onKeyDown={e => {
|
|
454
|
-
if (e.key === 'Enter') {
|
|
455
|
-
e.preventDefault();
|
|
456
|
-
e.stopPropagation();
|
|
457
|
-
handleCreateLink();
|
|
458
|
-
}
|
|
459
|
-
}}
|
|
460
|
-
className="h-8 text-xs"
|
|
461
|
-
/>
|
|
462
|
-
<Button size="sm" className="h-8" onClick={handleCreateLink}>
|
|
463
|
-
Aplicar
|
|
464
|
-
</Button>
|
|
465
|
-
</div>
|
|
466
|
-
</div>
|
|
467
|
-
)}
|
|
468
|
-
</PopoverContent>
|
|
469
|
-
</Popover>
|
|
470
|
-
|
|
471
|
-
<Button
|
|
472
|
-
variant="ghost"
|
|
473
|
-
size="icon"
|
|
474
|
-
className="h-8 w-8 text-muted-foreground"
|
|
475
|
-
onClick={handleUnlink}
|
|
476
|
-
title="Remover link"
|
|
477
|
-
aria-label="Remover link"
|
|
478
|
-
>
|
|
479
|
-
<X className="w-4 h-4" />
|
|
480
|
-
</Button>
|
|
481
|
-
|
|
482
|
-
<div className="w-px h-6 bg-border mx-1 hidden sm:block"></div>
|
|
483
|
-
</>
|
|
484
|
-
)}
|
|
485
|
-
|
|
486
|
-
{(allowFormatting || allowHeadings || allowAlignment || allowLists || allowLinks) && (
|
|
487
|
-
<Button
|
|
488
|
-
variant="ghost"
|
|
489
|
-
size="icon"
|
|
490
|
-
className="h-8 w-8 text-muted-foreground"
|
|
491
|
-
onClick={() => execCommand('removeFormat')}
|
|
492
|
-
title="Limpar formatação"
|
|
493
|
-
aria-label="Limpar formatação"
|
|
494
|
-
>
|
|
495
|
-
<Type className="w-4 h-4" />
|
|
496
|
-
</Button>
|
|
497
|
-
)}
|
|
498
|
-
|
|
499
|
-
{allowSearch && (
|
|
500
|
-
<Button
|
|
501
|
-
variant="ghost"
|
|
502
|
-
size="icon"
|
|
503
|
-
className={cn(
|
|
504
|
-
'h-8 w-8 text-muted-foreground',
|
|
505
|
-
isSearchOpen && 'bg-muted text-foreground'
|
|
506
|
-
)}
|
|
507
|
-
onClick={() => {
|
|
508
|
-
setIsSearchOpen(!isSearchOpen);
|
|
509
|
-
if (!isSearchOpen) setTimeout(() => searchInputRef.current?.focus(), 100);
|
|
510
|
-
}}
|
|
511
|
-
title="Buscar"
|
|
512
|
-
aria-label="Buscar"
|
|
513
|
-
>
|
|
514
|
-
<Search className="w-4 h-4" />
|
|
515
|
-
</Button>
|
|
516
|
-
)}
|
|
517
|
-
|
|
518
|
-
{actionButton && (
|
|
519
|
-
<>
|
|
520
|
-
<div className="flex-1"></div>
|
|
521
|
-
{actionButton}
|
|
522
|
-
</>
|
|
523
|
-
)}
|
|
524
|
-
</div>
|
|
525
|
-
)}
|
|
526
|
-
|
|
527
|
-
{/* Search Bar */}
|
|
528
|
-
{isSearchOpen && (
|
|
529
|
-
<div className="px-3 py-1.5 border-b border-border bg-muted/20 flex items-center gap-2">
|
|
530
|
-
<div className="relative flex-1 max-w-sm">
|
|
531
|
-
<Search className="absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground" />
|
|
532
|
-
<Input
|
|
533
|
-
ref={searchInputRef}
|
|
534
|
-
placeholder="Buscar no texto..."
|
|
535
|
-
value={searchQuery}
|
|
536
|
-
onChange={e => setSearchQuery(e.target.value)}
|
|
537
|
-
onKeyDown={e => {
|
|
538
|
-
if (e.key === 'Enter') {
|
|
539
|
-
e.preventDefault();
|
|
540
|
-
performSearch(searchQuery, e.shiftKey);
|
|
541
|
-
}
|
|
542
|
-
if (e.key === 'Escape') {
|
|
543
|
-
setIsSearchOpen(false);
|
|
544
|
-
}
|
|
545
|
-
}}
|
|
546
|
-
className="h-8 pl-8 text-xs bg-background"
|
|
547
|
-
/>
|
|
548
|
-
</div>
|
|
549
|
-
<div className="flex items-center gap-1">
|
|
550
|
-
<Button
|
|
551
|
-
variant="ghost"
|
|
552
|
-
size="icon"
|
|
553
|
-
className="h-7 w-7"
|
|
554
|
-
onMouseDown={e => e.preventDefault()}
|
|
555
|
-
onClick={() => performSearch(searchQuery, true)}
|
|
556
|
-
title="Anterior"
|
|
557
|
-
>
|
|
558
|
-
<ChevronUp className="w-4 h-4" />
|
|
559
|
-
</Button>
|
|
560
|
-
<Button
|
|
561
|
-
variant="ghost"
|
|
562
|
-
size="icon"
|
|
563
|
-
className="h-7 w-7"
|
|
564
|
-
onMouseDown={e => e.preventDefault()}
|
|
565
|
-
onClick={() => performSearch(searchQuery, false)}
|
|
566
|
-
title="Próximo"
|
|
567
|
-
>
|
|
568
|
-
<ChevronDown className="w-4 h-4" />
|
|
569
|
-
</Button>
|
|
570
|
-
<div className="w-px h-4 bg-border mx-1"></div>
|
|
571
|
-
<Button
|
|
572
|
-
variant="ghost"
|
|
573
|
-
size="icon"
|
|
574
|
-
className="h-7 w-7 text-muted-foreground hover:text-foreground"
|
|
575
|
-
onClick={() => setIsSearchOpen(false)}
|
|
576
|
-
title="Fechar busca"
|
|
577
|
-
>
|
|
578
|
-
<X className="w-4 h-4" />
|
|
579
|
-
</Button>
|
|
580
|
-
</div>
|
|
581
|
-
<div className="hidden sm:block text-[10px] text-muted-foreground ml-auto uppercase tracking-wider font-medium">
|
|
582
|
-
Pressione Enter para buscar
|
|
583
|
-
</div>
|
|
584
|
-
</div>
|
|
585
|
-
)}
|
|
586
|
-
|
|
587
|
-
{/* Editable Area */}
|
|
588
|
-
<div
|
|
589
|
-
className="flex-1 overflow-y-auto p-4 sm:p-8 bg-background scrollbar-thin"
|
|
590
|
-
style={{ minHeight, maxHeight }}
|
|
591
|
-
>
|
|
592
|
-
<div
|
|
593
|
-
ref={editorRef}
|
|
594
|
-
contentEditable={isEditable}
|
|
595
|
-
role="textbox"
|
|
596
|
-
aria-multiline="true"
|
|
597
|
-
aria-label={placeholder || 'Editor de texto'}
|
|
598
|
-
aria-readonly={readOnly}
|
|
599
|
-
aria-disabled={disabled}
|
|
600
|
-
onInput={handleInput}
|
|
601
|
-
onSelect={isEditable ? updateActiveFormats : undefined}
|
|
602
|
-
onFocus={() => {
|
|
603
|
-
updateActiveFormats();
|
|
604
|
-
onFocus?.();
|
|
605
|
-
}}
|
|
606
|
-
onBlur={onBlur}
|
|
607
|
-
className="prose-editor min-h-full max-w-none focus:outline-none"
|
|
608
|
-
data-placeholder={placeholder}
|
|
609
|
-
/>
|
|
610
|
-
</div>
|
|
611
|
-
|
|
612
|
-
{/* Footer / Status Bar */}
|
|
613
|
-
{(showWordCount || showCharacterCount) && (
|
|
614
|
-
<div className="px-4 py-2 border-t border-border bg-muted/20 flex items-center justify-between">
|
|
615
|
-
<div className="text-[10px] sm:text-xs text-muted-foreground font-medium uppercase tracking-wider flex items-center gap-2">
|
|
616
|
-
{showWordCount && (
|
|
617
|
-
<span>
|
|
618
|
-
{wordCount} {wordCount === 1 ? 'palavra' : 'palavras'}
|
|
619
|
-
</span>
|
|
620
|
-
)}
|
|
621
|
-
{showWordCount && showCharacterCount && (
|
|
622
|
-
<span className="text-muted-foreground">•</span>
|
|
623
|
-
)}
|
|
624
|
-
{showCharacterCount && (
|
|
625
|
-
<span>
|
|
626
|
-
{characterCount} {characterCount === 1 ? 'caractere' : 'caracteres'}
|
|
627
|
-
</span>
|
|
628
|
-
)}
|
|
629
|
-
</div>
|
|
630
|
-
</div>
|
|
631
|
-
)}
|
|
632
|
-
</div>
|
|
633
|
-
);
|
|
634
|
-
}
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useRichTextEditor } from './use-rich-text-editor';
|
|
3
|
+
import { cn } from '../../shared/utils';
|
|
4
|
+
import { Button } from '../button';
|
|
5
|
+
import {
|
|
6
|
+
DropdownMenu,
|
|
7
|
+
DropdownMenuContent,
|
|
8
|
+
DropdownMenuItem,
|
|
9
|
+
DropdownMenuTrigger,
|
|
10
|
+
} from '../dropdown-menu';
|
|
11
|
+
import { Popover, PopoverContent, PopoverTrigger } from '../popover';
|
|
12
|
+
import {
|
|
13
|
+
Bold,
|
|
14
|
+
Italic,
|
|
15
|
+
Underline,
|
|
16
|
+
AlignLeft,
|
|
17
|
+
AlignCenter,
|
|
18
|
+
AlignRight,
|
|
19
|
+
List,
|
|
20
|
+
ListOrdered,
|
|
21
|
+
Type,
|
|
22
|
+
Heading1,
|
|
23
|
+
Heading2,
|
|
24
|
+
Heading3,
|
|
25
|
+
ChevronDown,
|
|
26
|
+
Undo,
|
|
27
|
+
Redo,
|
|
28
|
+
Search,
|
|
29
|
+
ChevronUp,
|
|
30
|
+
X,
|
|
31
|
+
Link as LinkIcon,
|
|
32
|
+
} from 'lucide-react';
|
|
33
|
+
import { Input } from '../input';
|
|
34
|
+
|
|
35
|
+
export interface RichTextEditorProps {
|
|
36
|
+
value: string;
|
|
37
|
+
onChange?: (value: string) => void;
|
|
38
|
+
placeholder?: string;
|
|
39
|
+
className?: string;
|
|
40
|
+
actionButton?: React.ReactNode;
|
|
41
|
+
allowSearch?: boolean;
|
|
42
|
+
allowLinks?: boolean;
|
|
43
|
+
allowUndoRedo?: boolean;
|
|
44
|
+
allowHeadings?: boolean;
|
|
45
|
+
allowFormatting?: boolean;
|
|
46
|
+
allowAlignment?: boolean;
|
|
47
|
+
allowLists?: boolean;
|
|
48
|
+
showWordCount?: boolean;
|
|
49
|
+
showCharacterCount?: boolean;
|
|
50
|
+
/** Disables all editing and applies opacity-50. Hides the toolbar. */
|
|
51
|
+
disabled?: boolean;
|
|
52
|
+
/** Makes the editor non-editable while keeping full visual fidelity. Hides the toolbar. */
|
|
53
|
+
readOnly?: boolean;
|
|
54
|
+
/** Called when the editor area receives focus. */
|
|
55
|
+
onFocus?: () => void;
|
|
56
|
+
/** Called when the editor area loses focus. */
|
|
57
|
+
onBlur?: () => void;
|
|
58
|
+
/** Minimum height of the editable area (CSS value, e.g. "200px"). */
|
|
59
|
+
minHeight?: string;
|
|
60
|
+
/** Maximum height of the editable area (CSS value, e.g. "600px"). */
|
|
61
|
+
maxHeight?: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
65
|
+
// Component
|
|
66
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
67
|
+
export function RichTextEditor({
|
|
68
|
+
value,
|
|
69
|
+
onChange,
|
|
70
|
+
placeholder,
|
|
71
|
+
className,
|
|
72
|
+
actionButton,
|
|
73
|
+
allowSearch = true,
|
|
74
|
+
allowLinks = true,
|
|
75
|
+
allowUndoRedo = true,
|
|
76
|
+
allowHeadings = true,
|
|
77
|
+
allowFormatting = true,
|
|
78
|
+
allowAlignment = true,
|
|
79
|
+
allowLists = true,
|
|
80
|
+
showWordCount = true,
|
|
81
|
+
showCharacterCount = true,
|
|
82
|
+
disabled = false,
|
|
83
|
+
readOnly = false,
|
|
84
|
+
onFocus,
|
|
85
|
+
onBlur,
|
|
86
|
+
minHeight,
|
|
87
|
+
maxHeight,
|
|
88
|
+
}: RichTextEditorProps) {
|
|
89
|
+
const isEditable = !disabled && !readOnly;
|
|
90
|
+
const showToolbar = isEditable;
|
|
91
|
+
|
|
92
|
+
const {
|
|
93
|
+
editorRef,
|
|
94
|
+
searchInputRef,
|
|
95
|
+
linkInputRef,
|
|
96
|
+
activeFormats,
|
|
97
|
+
isSearchOpen,
|
|
98
|
+
setIsSearchOpen,
|
|
99
|
+
searchQuery,
|
|
100
|
+
setSearchQuery,
|
|
101
|
+
linkUrl,
|
|
102
|
+
setLinkUrl,
|
|
103
|
+
isLinkOpen,
|
|
104
|
+
hasSavedSelection,
|
|
105
|
+
wordCount,
|
|
106
|
+
characterCount,
|
|
107
|
+
updateActiveFormats,
|
|
108
|
+
execCommand,
|
|
109
|
+
handleInput,
|
|
110
|
+
performSearch,
|
|
111
|
+
handleCreateLink,
|
|
112
|
+
handleUnlink,
|
|
113
|
+
onLinkPopoverOpenChange,
|
|
114
|
+
} = useRichTextEditor({ value, onChange });
|
|
115
|
+
|
|
116
|
+
const getCurrentBlockLabel = () => {
|
|
117
|
+
if (activeFormats.h1)
|
|
118
|
+
return (
|
|
119
|
+
<>
|
|
120
|
+
<Heading1 className="w-4 h-4 mr-1 shrink-0" />
|
|
121
|
+
<span className="truncate">Título 1</span>
|
|
122
|
+
</>
|
|
123
|
+
);
|
|
124
|
+
if (activeFormats.h2)
|
|
125
|
+
return (
|
|
126
|
+
<>
|
|
127
|
+
<Heading2 className="w-4 h-4 mr-1 shrink-0" />
|
|
128
|
+
<span className="truncate">Título 2</span>
|
|
129
|
+
</>
|
|
130
|
+
);
|
|
131
|
+
if (activeFormats.h3)
|
|
132
|
+
return (
|
|
133
|
+
<>
|
|
134
|
+
<Heading3 className="w-4 h-4 mr-1 shrink-0" />
|
|
135
|
+
<span className="truncate">Título 3</span>
|
|
136
|
+
</>
|
|
137
|
+
);
|
|
138
|
+
return (
|
|
139
|
+
<>
|
|
140
|
+
<Type className="w-4 h-4 mr-1 shrink-0" />
|
|
141
|
+
<span className="truncate">Parágrafo</span>
|
|
142
|
+
</>
|
|
143
|
+
);
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
return (
|
|
147
|
+
<div
|
|
148
|
+
className={cn(
|
|
149
|
+
'flex flex-col h-full w-full bg-background sm:border border-border sm:shadow-sm sm:rounded-lg overflow-hidden',
|
|
150
|
+
disabled && 'opacity-50 pointer-events-none',
|
|
151
|
+
className
|
|
152
|
+
)}
|
|
153
|
+
>
|
|
154
|
+
<style>{`
|
|
155
|
+
[contenteditable]:empty:before {
|
|
156
|
+
content: attr(data-placeholder);
|
|
157
|
+
color: hsl(var(--muted-foreground));
|
|
158
|
+
pointer-events: none;
|
|
159
|
+
display: block;
|
|
160
|
+
}
|
|
161
|
+
.prose-editor ul {
|
|
162
|
+
list-style-type: disc !important;
|
|
163
|
+
padding-left: 1.5rem !important;
|
|
164
|
+
margin-top: 0.5rem !important;
|
|
165
|
+
margin-bottom: 0.5rem !important;
|
|
166
|
+
}
|
|
167
|
+
.prose-editor ol {
|
|
168
|
+
list-style-type: decimal !important;
|
|
169
|
+
padding-left: 1.5rem !important;
|
|
170
|
+
margin-top: 0.5rem !important;
|
|
171
|
+
margin-bottom: 0.5rem !important;
|
|
172
|
+
}
|
|
173
|
+
.prose-editor b, .prose-editor strong {
|
|
174
|
+
font-weight: 600 !important;
|
|
175
|
+
}
|
|
176
|
+
.prose-editor i, .prose-editor em {
|
|
177
|
+
font-style: italic !important;
|
|
178
|
+
}
|
|
179
|
+
.prose-editor u {
|
|
180
|
+
text-decoration: underline !important;
|
|
181
|
+
}
|
|
182
|
+
.prose-editor h1 {
|
|
183
|
+
font-size: 2.25rem !important;
|
|
184
|
+
font-weight: 700 !important;
|
|
185
|
+
margin-bottom: 1.25rem !important;
|
|
186
|
+
line-height: 1.2 !important;
|
|
187
|
+
margin-top: 2rem !important;
|
|
188
|
+
color: hsl(var(--foreground));
|
|
189
|
+
}
|
|
190
|
+
.prose-editor h2 {
|
|
191
|
+
font-size: 1.75rem !important;
|
|
192
|
+
font-weight: 600 !important;
|
|
193
|
+
margin-bottom: 1rem !important;
|
|
194
|
+
margin-top: 1.5rem !important;
|
|
195
|
+
color: hsl(var(--foreground));
|
|
196
|
+
}
|
|
197
|
+
.prose-editor h3 {
|
|
198
|
+
font-size: 1.35rem !important;
|
|
199
|
+
font-weight: 600 !important;
|
|
200
|
+
margin-bottom: 0.75rem !important;
|
|
201
|
+
margin-top: 1.25rem !important;
|
|
202
|
+
color: hsl(var(--foreground));
|
|
203
|
+
}
|
|
204
|
+
.prose-editor p {
|
|
205
|
+
margin-bottom: 1rem !important;
|
|
206
|
+
line-height: 1.6 !important;
|
|
207
|
+
}
|
|
208
|
+
.prose-editor a {
|
|
209
|
+
color: var(--info) !important;
|
|
210
|
+
text-decoration: underline !important;
|
|
211
|
+
cursor: pointer !important;
|
|
212
|
+
}
|
|
213
|
+
.prose-editor h1:first-child, .prose-editor h2:first-child, .prose-editor h3:first-child, .prose-editor p:first-child {
|
|
214
|
+
margin-top: 0 !important;
|
|
215
|
+
}
|
|
216
|
+
.prose-editor {
|
|
217
|
+
outline: none !important;
|
|
218
|
+
}
|
|
219
|
+
`}</style>
|
|
220
|
+
|
|
221
|
+
{/* Toolbar — hidden in disabled/readOnly mode */}
|
|
222
|
+
{showToolbar && (
|
|
223
|
+
<div className="px-3 py-2 border-b border-border bg-muted/30 flex items-center gap-1 flex-wrap shrink-0">
|
|
224
|
+
{allowUndoRedo && (
|
|
225
|
+
<>
|
|
226
|
+
<Button
|
|
227
|
+
variant="ghost"
|
|
228
|
+
size="icon"
|
|
229
|
+
className="h-8 w-8 text-muted-foreground"
|
|
230
|
+
onClick={() => execCommand('undo')}
|
|
231
|
+
title="Desfazer"
|
|
232
|
+
aria-label="Desfazer"
|
|
233
|
+
>
|
|
234
|
+
<Undo className="w-4 h-4" />
|
|
235
|
+
</Button>
|
|
236
|
+
<Button
|
|
237
|
+
variant="ghost"
|
|
238
|
+
size="icon"
|
|
239
|
+
className="h-8 w-8 text-muted-foreground"
|
|
240
|
+
onClick={() => execCommand('redo')}
|
|
241
|
+
title="Refazer"
|
|
242
|
+
aria-label="Refazer"
|
|
243
|
+
>
|
|
244
|
+
<Redo className="w-4 h-4" />
|
|
245
|
+
</Button>
|
|
246
|
+
<div className="w-px h-6 bg-border mx-1 hidden sm:block"></div>
|
|
247
|
+
</>
|
|
248
|
+
)}
|
|
249
|
+
|
|
250
|
+
{allowHeadings && (
|
|
251
|
+
<>
|
|
252
|
+
<DropdownMenu modal={false}>
|
|
253
|
+
<DropdownMenuTrigger asChild>
|
|
254
|
+
<Button
|
|
255
|
+
variant="ghost"
|
|
256
|
+
size="sm"
|
|
257
|
+
className="h-8 gap-0 text-muted-foreground w-[120px] justify-start px-2"
|
|
258
|
+
>
|
|
259
|
+
{getCurrentBlockLabel()}
|
|
260
|
+
<ChevronDown className="w-3 h-3 ml-auto opacity-50 shrink-0" />
|
|
261
|
+
</Button>
|
|
262
|
+
</DropdownMenuTrigger>
|
|
263
|
+
<DropdownMenuContent align="start" className="w-[160px]" style={{ zIndex: 9999 }}>
|
|
264
|
+
<DropdownMenuItem
|
|
265
|
+
onPointerDown={e => e.preventDefault()}
|
|
266
|
+
onClick={() => execCommand('formatBlock', 'P')}
|
|
267
|
+
className="gap-2"
|
|
268
|
+
>
|
|
269
|
+
<Type className="w-4 h-4 text-muted-foreground" /> Parágrafo
|
|
270
|
+
</DropdownMenuItem>
|
|
271
|
+
<DropdownMenuItem
|
|
272
|
+
onPointerDown={e => e.preventDefault()}
|
|
273
|
+
onClick={() => execCommand('formatBlock', 'H1')}
|
|
274
|
+
className="gap-2"
|
|
275
|
+
>
|
|
276
|
+
<Heading1 className="w-4 h-4 text-muted-foreground" /> Título 1
|
|
277
|
+
</DropdownMenuItem>
|
|
278
|
+
<DropdownMenuItem
|
|
279
|
+
onPointerDown={e => e.preventDefault()}
|
|
280
|
+
onClick={() => execCommand('formatBlock', 'H2')}
|
|
281
|
+
className="gap-2"
|
|
282
|
+
>
|
|
283
|
+
<Heading2 className="w-4 h-4 text-muted-foreground" /> Título 2
|
|
284
|
+
</DropdownMenuItem>
|
|
285
|
+
<DropdownMenuItem
|
|
286
|
+
onPointerDown={e => e.preventDefault()}
|
|
287
|
+
onClick={() => execCommand('formatBlock', 'H3')}
|
|
288
|
+
className="gap-2"
|
|
289
|
+
>
|
|
290
|
+
<Heading3 className="w-4 h-4 text-muted-foreground" /> Título 3
|
|
291
|
+
</DropdownMenuItem>
|
|
292
|
+
</DropdownMenuContent>
|
|
293
|
+
</DropdownMenu>
|
|
294
|
+
<div className="w-px h-6 bg-border mx-1 hidden sm:block"></div>
|
|
295
|
+
</>
|
|
296
|
+
)}
|
|
297
|
+
|
|
298
|
+
{allowFormatting && (
|
|
299
|
+
<>
|
|
300
|
+
<Button
|
|
301
|
+
variant="ghost"
|
|
302
|
+
size="icon"
|
|
303
|
+
className={cn(
|
|
304
|
+
'h-8 w-8 text-muted-foreground',
|
|
305
|
+
activeFormats.bold && 'bg-muted text-foreground'
|
|
306
|
+
)}
|
|
307
|
+
onClick={() => execCommand('bold')}
|
|
308
|
+
title="Negrito"
|
|
309
|
+
aria-label="Negrito"
|
|
310
|
+
>
|
|
311
|
+
<Bold className="w-4 h-4" />
|
|
312
|
+
</Button>
|
|
313
|
+
<Button
|
|
314
|
+
variant="ghost"
|
|
315
|
+
size="icon"
|
|
316
|
+
className={cn(
|
|
317
|
+
'h-8 w-8 text-muted-foreground',
|
|
318
|
+
activeFormats.italic && 'bg-muted text-foreground'
|
|
319
|
+
)}
|
|
320
|
+
onClick={() => execCommand('italic')}
|
|
321
|
+
title="Itálico"
|
|
322
|
+
aria-label="Itálico"
|
|
323
|
+
>
|
|
324
|
+
<Italic className="w-4 h-4" />
|
|
325
|
+
</Button>
|
|
326
|
+
<Button
|
|
327
|
+
variant="ghost"
|
|
328
|
+
size="icon"
|
|
329
|
+
className={cn(
|
|
330
|
+
'h-8 w-8 text-muted-foreground',
|
|
331
|
+
activeFormats.underline && 'bg-muted text-foreground'
|
|
332
|
+
)}
|
|
333
|
+
onClick={() => execCommand('underline')}
|
|
334
|
+
title="Sublinhado"
|
|
335
|
+
aria-label="Sublinhado"
|
|
336
|
+
>
|
|
337
|
+
<Underline className="w-4 h-4" />
|
|
338
|
+
</Button>
|
|
339
|
+
<div className="w-px h-6 bg-border mx-1 hidden sm:block"></div>
|
|
340
|
+
</>
|
|
341
|
+
)}
|
|
342
|
+
|
|
343
|
+
{allowAlignment && (
|
|
344
|
+
<>
|
|
345
|
+
<Button
|
|
346
|
+
variant="ghost"
|
|
347
|
+
size="icon"
|
|
348
|
+
className={cn(
|
|
349
|
+
'h-8 w-8 text-muted-foreground',
|
|
350
|
+
activeFormats.justifyLeft && 'bg-muted text-foreground'
|
|
351
|
+
)}
|
|
352
|
+
onClick={() => execCommand('justifyLeft')}
|
|
353
|
+
title="Alinhar à esquerda"
|
|
354
|
+
aria-label="Alinhar à esquerda"
|
|
355
|
+
>
|
|
356
|
+
<AlignLeft className="w-4 h-4" />
|
|
357
|
+
</Button>
|
|
358
|
+
<Button
|
|
359
|
+
variant="ghost"
|
|
360
|
+
size="icon"
|
|
361
|
+
className={cn(
|
|
362
|
+
'h-8 w-8 text-muted-foreground',
|
|
363
|
+
activeFormats.justifyCenter && 'bg-muted text-foreground'
|
|
364
|
+
)}
|
|
365
|
+
onClick={() => execCommand('justifyCenter')}
|
|
366
|
+
title="Centralizar"
|
|
367
|
+
aria-label="Centralizar"
|
|
368
|
+
>
|
|
369
|
+
<AlignCenter className="w-4 h-4" />
|
|
370
|
+
</Button>
|
|
371
|
+
<Button
|
|
372
|
+
variant="ghost"
|
|
373
|
+
size="icon"
|
|
374
|
+
className={cn(
|
|
375
|
+
'h-8 w-8 text-muted-foreground',
|
|
376
|
+
activeFormats.justifyRight && 'bg-muted text-foreground'
|
|
377
|
+
)}
|
|
378
|
+
onClick={() => execCommand('justifyRight')}
|
|
379
|
+
title="Alinhar à direita"
|
|
380
|
+
aria-label="Alinhar à direita"
|
|
381
|
+
>
|
|
382
|
+
<AlignRight className="w-4 h-4" />
|
|
383
|
+
</Button>
|
|
384
|
+
<div className="w-px h-6 bg-border mx-1 hidden sm:block"></div>
|
|
385
|
+
</>
|
|
386
|
+
)}
|
|
387
|
+
|
|
388
|
+
{allowLists && (
|
|
389
|
+
<>
|
|
390
|
+
<Button
|
|
391
|
+
variant="ghost"
|
|
392
|
+
size="icon"
|
|
393
|
+
className={cn(
|
|
394
|
+
'h-8 w-8 text-muted-foreground',
|
|
395
|
+
activeFormats.insertUnorderedList && 'bg-muted text-foreground'
|
|
396
|
+
)}
|
|
397
|
+
onClick={() => execCommand('insertUnorderedList')}
|
|
398
|
+
title="Lista com marcadores"
|
|
399
|
+
aria-label="Lista com marcadores"
|
|
400
|
+
>
|
|
401
|
+
<List className="w-4 h-4" />
|
|
402
|
+
</Button>
|
|
403
|
+
<Button
|
|
404
|
+
variant="ghost"
|
|
405
|
+
size="icon"
|
|
406
|
+
className={cn(
|
|
407
|
+
'h-8 w-8 text-muted-foreground',
|
|
408
|
+
activeFormats.insertOrderedList && 'bg-muted text-foreground'
|
|
409
|
+
)}
|
|
410
|
+
onClick={() => execCommand('insertOrderedList')}
|
|
411
|
+
title="Lista numerada"
|
|
412
|
+
aria-label="Lista numerada"
|
|
413
|
+
>
|
|
414
|
+
<ListOrdered className="w-4 h-4" />
|
|
415
|
+
</Button>
|
|
416
|
+
<div className="w-px h-6 bg-border mx-1 hidden sm:block"></div>
|
|
417
|
+
</>
|
|
418
|
+
)}
|
|
419
|
+
|
|
420
|
+
{allowLinks && (
|
|
421
|
+
<>
|
|
422
|
+
<Popover open={isLinkOpen} onOpenChange={onLinkPopoverOpenChange} modal={false}>
|
|
423
|
+
<PopoverTrigger asChild>
|
|
424
|
+
<Button
|
|
425
|
+
variant="ghost"
|
|
426
|
+
size="icon"
|
|
427
|
+
className={cn(
|
|
428
|
+
'h-8 w-8 text-muted-foreground',
|
|
429
|
+
(activeFormats.link || isLinkOpen) && 'bg-muted text-foreground'
|
|
430
|
+
)}
|
|
431
|
+
title="Inserir link"
|
|
432
|
+
aria-label="Inserir link"
|
|
433
|
+
>
|
|
434
|
+
<LinkIcon className="w-4 h-4" />
|
|
435
|
+
</Button>
|
|
436
|
+
</PopoverTrigger>
|
|
437
|
+
<PopoverContent className="w-80 p-3" align="start" style={{ zIndex: 9999 }}>
|
|
438
|
+
{!activeFormats.link && !hasSavedSelection ? (
|
|
439
|
+
<p className="text-xs text-muted-foreground py-1">
|
|
440
|
+
Selecione um texto para criar um link.
|
|
441
|
+
</p>
|
|
442
|
+
) : (
|
|
443
|
+
<div className="flex flex-col gap-2">
|
|
444
|
+
<div className="text-xs font-medium">
|
|
445
|
+
{activeFormats.link ? 'Editar Link' : 'Inserir Link'}
|
|
446
|
+
</div>
|
|
447
|
+
<div className="flex gap-2">
|
|
448
|
+
<Input
|
|
449
|
+
ref={linkInputRef}
|
|
450
|
+
placeholder="https://..."
|
|
451
|
+
value={linkUrl}
|
|
452
|
+
onChange={e => setLinkUrl(e.target.value)}
|
|
453
|
+
onKeyDown={e => {
|
|
454
|
+
if (e.key === 'Enter') {
|
|
455
|
+
e.preventDefault();
|
|
456
|
+
e.stopPropagation();
|
|
457
|
+
handleCreateLink();
|
|
458
|
+
}
|
|
459
|
+
}}
|
|
460
|
+
className="h-8 text-xs"
|
|
461
|
+
/>
|
|
462
|
+
<Button size="sm" className="h-8" onClick={handleCreateLink}>
|
|
463
|
+
Aplicar
|
|
464
|
+
</Button>
|
|
465
|
+
</div>
|
|
466
|
+
</div>
|
|
467
|
+
)}
|
|
468
|
+
</PopoverContent>
|
|
469
|
+
</Popover>
|
|
470
|
+
|
|
471
|
+
<Button
|
|
472
|
+
variant="ghost"
|
|
473
|
+
size="icon"
|
|
474
|
+
className="h-8 w-8 text-muted-foreground"
|
|
475
|
+
onClick={handleUnlink}
|
|
476
|
+
title="Remover link"
|
|
477
|
+
aria-label="Remover link"
|
|
478
|
+
>
|
|
479
|
+
<X className="w-4 h-4" />
|
|
480
|
+
</Button>
|
|
481
|
+
|
|
482
|
+
<div className="w-px h-6 bg-border mx-1 hidden sm:block"></div>
|
|
483
|
+
</>
|
|
484
|
+
)}
|
|
485
|
+
|
|
486
|
+
{(allowFormatting || allowHeadings || allowAlignment || allowLists || allowLinks) && (
|
|
487
|
+
<Button
|
|
488
|
+
variant="ghost"
|
|
489
|
+
size="icon"
|
|
490
|
+
className="h-8 w-8 text-muted-foreground"
|
|
491
|
+
onClick={() => execCommand('removeFormat')}
|
|
492
|
+
title="Limpar formatação"
|
|
493
|
+
aria-label="Limpar formatação"
|
|
494
|
+
>
|
|
495
|
+
<Type className="w-4 h-4" />
|
|
496
|
+
</Button>
|
|
497
|
+
)}
|
|
498
|
+
|
|
499
|
+
{allowSearch && (
|
|
500
|
+
<Button
|
|
501
|
+
variant="ghost"
|
|
502
|
+
size="icon"
|
|
503
|
+
className={cn(
|
|
504
|
+
'h-8 w-8 text-muted-foreground',
|
|
505
|
+
isSearchOpen && 'bg-muted text-foreground'
|
|
506
|
+
)}
|
|
507
|
+
onClick={() => {
|
|
508
|
+
setIsSearchOpen(!isSearchOpen);
|
|
509
|
+
if (!isSearchOpen) setTimeout(() => searchInputRef.current?.focus(), 100);
|
|
510
|
+
}}
|
|
511
|
+
title="Buscar"
|
|
512
|
+
aria-label="Buscar"
|
|
513
|
+
>
|
|
514
|
+
<Search className="w-4 h-4" />
|
|
515
|
+
</Button>
|
|
516
|
+
)}
|
|
517
|
+
|
|
518
|
+
{actionButton && (
|
|
519
|
+
<>
|
|
520
|
+
<div className="flex-1"></div>
|
|
521
|
+
{actionButton}
|
|
522
|
+
</>
|
|
523
|
+
)}
|
|
524
|
+
</div>
|
|
525
|
+
)}
|
|
526
|
+
|
|
527
|
+
{/* Search Bar */}
|
|
528
|
+
{isSearchOpen && (
|
|
529
|
+
<div className="px-3 py-1.5 border-b border-border bg-muted/20 flex items-center gap-2">
|
|
530
|
+
<div className="relative flex-1 max-w-sm">
|
|
531
|
+
<Search className="absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground" />
|
|
532
|
+
<Input
|
|
533
|
+
ref={searchInputRef}
|
|
534
|
+
placeholder="Buscar no texto..."
|
|
535
|
+
value={searchQuery}
|
|
536
|
+
onChange={e => setSearchQuery(e.target.value)}
|
|
537
|
+
onKeyDown={e => {
|
|
538
|
+
if (e.key === 'Enter') {
|
|
539
|
+
e.preventDefault();
|
|
540
|
+
performSearch(searchQuery, e.shiftKey);
|
|
541
|
+
}
|
|
542
|
+
if (e.key === 'Escape') {
|
|
543
|
+
setIsSearchOpen(false);
|
|
544
|
+
}
|
|
545
|
+
}}
|
|
546
|
+
className="h-8 pl-8 text-xs bg-background"
|
|
547
|
+
/>
|
|
548
|
+
</div>
|
|
549
|
+
<div className="flex items-center gap-1">
|
|
550
|
+
<Button
|
|
551
|
+
variant="ghost"
|
|
552
|
+
size="icon"
|
|
553
|
+
className="h-7 w-7"
|
|
554
|
+
onMouseDown={e => e.preventDefault()}
|
|
555
|
+
onClick={() => performSearch(searchQuery, true)}
|
|
556
|
+
title="Anterior"
|
|
557
|
+
>
|
|
558
|
+
<ChevronUp className="w-4 h-4" />
|
|
559
|
+
</Button>
|
|
560
|
+
<Button
|
|
561
|
+
variant="ghost"
|
|
562
|
+
size="icon"
|
|
563
|
+
className="h-7 w-7"
|
|
564
|
+
onMouseDown={e => e.preventDefault()}
|
|
565
|
+
onClick={() => performSearch(searchQuery, false)}
|
|
566
|
+
title="Próximo"
|
|
567
|
+
>
|
|
568
|
+
<ChevronDown className="w-4 h-4" />
|
|
569
|
+
</Button>
|
|
570
|
+
<div className="w-px h-4 bg-border mx-1"></div>
|
|
571
|
+
<Button
|
|
572
|
+
variant="ghost"
|
|
573
|
+
size="icon"
|
|
574
|
+
className="h-7 w-7 text-muted-foreground hover:text-foreground"
|
|
575
|
+
onClick={() => setIsSearchOpen(false)}
|
|
576
|
+
title="Fechar busca"
|
|
577
|
+
>
|
|
578
|
+
<X className="w-4 h-4" />
|
|
579
|
+
</Button>
|
|
580
|
+
</div>
|
|
581
|
+
<div className="hidden sm:block text-[10px] text-muted-foreground ml-auto uppercase tracking-wider font-medium">
|
|
582
|
+
Pressione Enter para buscar
|
|
583
|
+
</div>
|
|
584
|
+
</div>
|
|
585
|
+
)}
|
|
586
|
+
|
|
587
|
+
{/* Editable Area */}
|
|
588
|
+
<div
|
|
589
|
+
className="flex-1 overflow-y-auto p-4 sm:p-8 bg-background scrollbar-thin"
|
|
590
|
+
style={{ minHeight, maxHeight }}
|
|
591
|
+
>
|
|
592
|
+
<div
|
|
593
|
+
ref={editorRef}
|
|
594
|
+
contentEditable={isEditable}
|
|
595
|
+
role="textbox"
|
|
596
|
+
aria-multiline="true"
|
|
597
|
+
aria-label={placeholder || 'Editor de texto'}
|
|
598
|
+
aria-readonly={readOnly}
|
|
599
|
+
aria-disabled={disabled}
|
|
600
|
+
onInput={handleInput}
|
|
601
|
+
onSelect={isEditable ? updateActiveFormats : undefined}
|
|
602
|
+
onFocus={() => {
|
|
603
|
+
updateActiveFormats();
|
|
604
|
+
onFocus?.();
|
|
605
|
+
}}
|
|
606
|
+
onBlur={onBlur}
|
|
607
|
+
className="prose-editor min-h-full max-w-none focus:outline-none"
|
|
608
|
+
data-placeholder={placeholder}
|
|
609
|
+
/>
|
|
610
|
+
</div>
|
|
611
|
+
|
|
612
|
+
{/* Footer / Status Bar */}
|
|
613
|
+
{(showWordCount || showCharacterCount) && (
|
|
614
|
+
<div className="px-4 py-2 border-t border-border bg-muted/20 flex items-center justify-between">
|
|
615
|
+
<div className="text-[10px] sm:text-xs text-muted-foreground font-medium uppercase tracking-wider flex items-center gap-2">
|
|
616
|
+
{showWordCount && (
|
|
617
|
+
<span>
|
|
618
|
+
{wordCount} {wordCount === 1 ? 'palavra' : 'palavras'}
|
|
619
|
+
</span>
|
|
620
|
+
)}
|
|
621
|
+
{showWordCount && showCharacterCount && (
|
|
622
|
+
<span className="text-muted-foreground">•</span>
|
|
623
|
+
)}
|
|
624
|
+
{showCharacterCount && (
|
|
625
|
+
<span>
|
|
626
|
+
{characterCount} {characterCount === 1 ? 'caractere' : 'caracteres'}
|
|
627
|
+
</span>
|
|
628
|
+
)}
|
|
629
|
+
</div>
|
|
630
|
+
</div>
|
|
631
|
+
)}
|
|
632
|
+
</div>
|
|
633
|
+
);
|
|
634
|
+
}
|