xertica-ui 2.2.1 → 2.4.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 +564 -525
- package/README.md +417 -382
- package/bin/cli.ts +1244 -748
- package/bin/generate-tokens.ts +262 -262
- package/bin/language-config.ts +5 -8
- package/components/assets/xertica-orbe-animation.ts +1162 -1162
- package/components/assistant/code-block/CodeBlock.tsx +268 -268
- 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 -147
- 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 +17 -7
- 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 -99
- package/components/assistant/xertica-assistant/parts/AssistantConversationList.tsx +104 -106
- package/components/assistant/xertica-assistant/parts/AssistantDocumentEditor.tsx +81 -81
- package/components/assistant/xertica-assistant/parts/AssistantFeedbackDialog.tsx +88 -78
- package/components/assistant/xertica-assistant/parts/AssistantHeader.tsx +75 -75
- package/components/assistant/xertica-assistant/parts/AssistantMessageBubble.tsx +564 -560
- package/components/assistant/xertica-assistant/parts/AssistantTabBar.tsx +67 -67
- package/components/assistant/xertica-assistant/parts/AssistantTypingIndicator.tsx +41 -41
- package/components/assistant/xertica-assistant/parts/AssistantWelcomeScreen.tsx +103 -103
- 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 -615
- 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 +611 -613
- package/components/blocks/card-patterns/ActivityCard.tsx +100 -100
- package/components/blocks/card-patterns/FeatureCard.tsx +109 -109
- package/components/blocks/card-patterns/FeatureCardSkeleton.tsx +1 -6
- package/components/blocks/card-patterns/NotificationCard.tsx +140 -140
- package/components/blocks/card-patterns/ProfileCard.tsx +112 -114
- package/components/blocks/card-patterns/ProjectCard.tsx +123 -123
- package/components/blocks/card-patterns/ProjectCardSkeleton.tsx +1 -6
- package/components/blocks/card-patterns/QuickActionCard.tsx +68 -68
- package/components/blocks/card-patterns/card-patterns.mdx +123 -123
- package/components/blocks/card-patterns/card-patterns.stories.tsx +594 -594
- package/components/blocks/card-patterns/index.ts +29 -29
- 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/index.ts +1 -1
- package/components/brand/language-selector/language-selector.mdx +126 -126
- package/components/brand/language-selector/language-selector.stories.tsx +1 -4
- package/components/brand/theme-toggle/ThemeToggle.tsx +74 -70
- 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 +1 -4
- package/components/brand/xertica-provider/index.ts +1 -1
- 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 +86 -90
- 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.stories.tsx +586 -586
- package/components/layout/sidebar/sidebar.test.tsx +76 -76
- package/components/layout/sidebar/sidebar.tsx +1079 -1073
- package/components/layout/sidebar/use-sidebar.ts +104 -104
- package/components/media/FloatingMediaWrapper.tsx +371 -371
- 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 +767 -765
- 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 -310
- 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 -120
- 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 +78 -74
- 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 +218 -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 +243 -239
- 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 +1354 -1235
- package/components/pages/template-content/index.ts +1 -1
- 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.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 +114 -132
- package/components/shared/error-boundary.tsx +150 -154
- package/components/shared/error-fallbacks.tsx +222 -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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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 -2
- package/components/ui/stats-card/stats-card-skeleton.tsx +1 -3
- package/components/ui/stats-card/stats-card.stories.tsx +99 -99
- 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.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.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.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.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.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.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.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.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.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.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 +121 -118
- package/contexts/BrandColorsContext.test.tsx +21 -21
- package/contexts/BrandColorsContext.tsx +251 -251
- package/contexts/LanguageContext.tsx +1 -2
- 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-COGiOV-g.cjs +3541 -0
- package/dist/AssistantChart-CWX1OWNM.js +3373 -0
- package/dist/AudioPlayer-9psiEucT.cjs +1282 -0
- package/dist/AudioPlayer-Dp2bD1Gk.js +1278 -0
- package/dist/BrandColorsContext-DZT7JjeD.js +659 -0
- package/dist/BrandColorsContext-awnBCmC4.cjs +666 -0
- package/dist/CodeBlock-DYkTfR0f.js +221 -0
- package/dist/CodeBlock-EOvp9cVu.cjs +223 -0
- package/dist/CustomTooltipContent-BhdIeBEg.cjs +54 -0
- package/dist/CustomTooltipContent-CNbVB2NS.js +33 -0
- package/dist/FeatureCard-BZ4CYxFf.cjs +497 -0
- package/dist/FeatureCard-DNycVGwT.js +485 -0
- package/dist/FeatureCardSkeleton-DZqc96mt.js +27 -0
- package/dist/FeatureCardSkeleton-pTa0YNKP.cjs +29 -0
- package/dist/LayoutContext-BEq_-n98.cjs +96 -0
- package/dist/LayoutContext-DNl1xSoX.js +92 -0
- package/dist/ThemeContext-CMD3z2Dz.cjs +1930 -0
- package/dist/ThemeContext-x_F2zsnv.js +1923 -0
- package/dist/VerifyEmailPage-BJjAMUTW.js +3223 -0
- package/dist/VerifyEmailPage-Bv8Ah_TK.cjs +3235 -0
- package/dist/VerifyEmailPage-CkBYfsNy.cjs +3232 -0
- package/dist/VerifyEmailPage-Cyl55sJb.js +3226 -0
- package/dist/VerifyEmailPage-X14vhdyl.js +3296 -0
- package/dist/VerifyEmailPage-u_Dn7t1U.cjs +3305 -0
- package/dist/XerticaOrbe-Uk2JML1-.cjs +1927 -0
- package/dist/XerticaOrbe-jA5T2iOk.js +1925 -0
- package/dist/XerticaProvider-BErr83Bg.js +42 -0
- package/dist/XerticaProvider-CwOkHxiT.cjs +44 -0
- package/dist/XerticaProvider-DUOJg9iX.js +49 -0
- package/dist/XerticaProvider-Dl_b72_l.cjs +51 -0
- package/dist/XerticaXLogo-BX3ueACh.js +255 -0
- package/dist/XerticaXLogo-mqjoBiLI.js +252 -0
- package/dist/XerticaXLogo-qBPhwK3g.cjs +260 -0
- package/dist/XerticaXLogo-uQgwns_E.cjs +257 -0
- package/dist/alert-dialog-DhwPioBa.cjs +885 -0
- package/dist/alert-dialog-DqlRW_An.js +831 -0
- package/dist/assistant.cjs.js +8 -4
- package/dist/assistant.es.js +5 -11
- package/dist/avatar-3kO2Anrp.js +54 -0
- package/dist/avatar-BCM7YQRC.cjs +77 -0
- package/dist/blocks.cjs.js +9 -4
- package/dist/blocks.es.js +2 -16
- package/dist/brand.cjs.js +10 -5
- package/dist/brand.es.js +3 -11
- package/dist/breadcrumb-BKtHF4gk.cjs +98 -0
- package/dist/breadcrumb-ifNsA7Zl.js +90 -0
- package/dist/button-0BlA47It.cjs +85 -0
- package/dist/button-DZHzN1Gd.js +62 -0
- package/dist/cli.js +471 -93
- package/dist/components/brand/theme-toggle/ThemeToggle.d.ts +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/dropdown-menu-BMcykFDf.cjs +225 -0
- package/dist/dropdown-menu-Dn_eV2Xb.js +190 -0
- package/dist/google-maps-loader-BCe58h9D.js +308 -0
- package/dist/google-maps-loader-casMyxlo.cjs +316 -0
- package/dist/hooks.cjs.js +12 -8
- package/dist/hooks.es.js +10 -27
- package/dist/index-9GWd0qxq.cjs +12 -0
- package/dist/index-BabBx2pa.js +6 -0
- package/dist/index.cjs.js +37 -32
- package/dist/index.es.js +30 -363
- package/dist/input-C_UiS2Py.cjs +152 -0
- package/dist/input-cc-PTD4R.js +123 -0
- package/dist/layout.cjs.js +10 -6
- package/dist/layout.es.js +7 -9
- package/dist/media.cjs.js +8 -3
- package/dist/media.es.js +1 -6
- package/dist/pages.cjs.js +8 -3
- package/dist/pages.es.js +1 -11
- package/dist/progress-C7Lti5wo.js +80 -0
- package/dist/progress-Cqwxbqs1.cjs +103 -0
- package/dist/rich-text-editor-DqLICivI.js +2832 -0
- package/dist/rich-text-editor-DxO1Hz3a.cjs +2903 -0
- package/dist/select-CH6v_KcQ.cjs +161 -0
- package/dist/select-D-xvCZK2.js +130 -0
- package/dist/sidebar-3XyzjVBw.js +792 -0
- package/dist/sidebar-B4ZWaMrE.js +792 -0
- package/dist/sidebar-BS1p2V7t.cjs +795 -0
- package/dist/sidebar-DyYvgyBj.cjs +795 -0
- package/dist/skeleton-DjiHerJn.cjs +87 -0
- package/dist/skeleton-DtR5tkYe.js +78 -0
- package/dist/slider-B00b9SVK.cjs +78 -0
- package/dist/slider-DQCNUUMj.js +56 -0
- package/dist/sonner-B-jWlik1.cjs +68 -0
- package/dist/sonner-C9tiqj4f.js +47 -0
- package/dist/tooltip-D8n9UYoU.cjs +72 -0
- package/dist/tooltip-RtbSmPYJ.js +48 -0
- package/dist/ui.cjs.js +23 -18
- package/dist/ui.es.js +16 -303
- package/dist/use-audio-player-B78fd2ct.js +188 -0
- package/dist/use-audio-player-DGvhPrgR.cjs +190 -0
- package/dist/use-mobile-BdXTRb0Z.cjs +51 -0
- package/dist/use-mobile-Ce2cBAQe.js +29 -0
- package/dist/xertica-assistant-B1NaSFFj.js +2173 -0
- package/dist/xertica-assistant-B687qEPU.js +2165 -0
- package/dist/xertica-assistant-CIaUlbIt.cjs +2180 -0
- package/dist/xertica-assistant-sOHwTgIP.cjs +2172 -0
- package/dist/xertica-ui.css +1 -1
- package/docs/ai-usage.md +195 -195
- package/docs/architecture-improvements.md +456 -456
- package/docs/architecture.md +312 -306
- 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 +428 -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 -252
- 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 +447 -445
- 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 +201 -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 +432 -430
- 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 +20 -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 +323 -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 +244 -243
- package/docs/form-sizing.md +162 -162
- package/docs/getting-started.md +616 -591
- package/docs/guidelines.md +330 -328
- package/docs/i18n.md +61 -57
- package/docs/installation.md +268 -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 -289
- package/guidelines/Guidelines.md +409 -406
- 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 +2 -1
- package/llms.txt +2 -1
- package/mcp/resources.json +22 -22
- package/mcp/tools.json +35 -35
- package/package.json +219 -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 +90 -71
- package/styles/xertica/integrations/google-maps.css +76 -76
- package/styles/xertica/integrations/sonner.css +73 -73
- package/styles/xertica/theme-map.css +102 -99
- package/styles/xertica/tokens.css +240 -236
- package/templates/CLAUDE.md +16 -1
- package/templates/eslint.config.js +26 -26
- package/templates/guidelines/Guidelines.md +577 -553
- 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 +131 -82
- package/templates/src/app/context/AuthContext.tsx +108 -108
- 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 -72
- package/templates/src/features/auth/ui/LoginContent.tsx +92 -92
- package/templates/src/features/auth/ui/ResetPasswordContent.tsx +6 -2
- package/templates/src/features/auth/ui/SocialLoginButtons.tsx +78 -78
- package/templates/src/features/auth/ui/VerifyEmailContent.tsx +2 -6
- package/templates/src/features/home/data/mock.ts +41 -35
- 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 +117 -119
- package/templates/src/features/template/index.ts +5 -5
- package/templates/src/features/template/ui/CrudTemplate.tsx +1 -4
- package/templates/src/features/template/ui/LoginTemplate.tsx +1 -1
- package/templates/src/features/template/ui/TemplateContent.tsx +29 -21
- package/templates/src/locales/en/pages/templates.json +17 -17
- package/templates/src/locales/es/pages/templates.json +17 -17
- package/templates/src/locales/pt-BR/pages/templates.json +17 -17
- package/templates/src/main.tsx +11 -11
- package/templates/src/pages/AssistantPage.tsx +26 -20
- package/templates/src/pages/ForgotPasswordPage.tsx +6 -6
- package/templates/src/pages/HomePage.tsx +53 -49
- 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 +150 -154
- package/templates/src/shared/error-fallbacks.tsx +222 -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 +240 -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.js +20 -20
- package/templates/vite.config.ts +54 -51
- 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
|
@@ -0,0 +1,1278 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useEffect, useRef, useCallback } from 'react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { Maximize2, GripHorizontal, X, Play, Pause, VolumeX, Volume2, Maximize, PictureInPicture, Radio, ExternalLink, PauseCircle, PlayCircle, RotateCcw, Info, Gauge, Download, MoreHorizontal, MoreVertical } from 'lucide-react';
|
|
5
|
+
import { S as Slider } from './slider-DQCNUUMj.js';
|
|
6
|
+
import { B as Button, c as cn } from './button-DZHzN1Gd.js';
|
|
7
|
+
import { createPortal } from 'react-dom';
|
|
8
|
+
import { b as TooltipProvider, T as Tooltip, c as TooltipTrigger, a as TooltipContent } from './tooltip-RtbSmPYJ.js';
|
|
9
|
+
import { D as DropdownMenu, n as DropdownMenuTrigger, b as DropdownMenuContent, d as DropdownMenuItem, i as DropdownMenuSeparator } from './dropdown-menu-Dn_eV2Xb.js';
|
|
10
|
+
import { u as useAudioPlayer } from './use-audio-player-B78fd2ct.js';
|
|
11
|
+
|
|
12
|
+
function FloatingMediaWrapper({
|
|
13
|
+
children,
|
|
14
|
+
isFloating,
|
|
15
|
+
setIsFloating,
|
|
16
|
+
title,
|
|
17
|
+
onClose,
|
|
18
|
+
onCloseMedia,
|
|
19
|
+
aspectRatio = 16 / 9,
|
|
20
|
+
className,
|
|
21
|
+
minWidth = 320,
|
|
22
|
+
minHeight = 110,
|
|
23
|
+
colorVariant = "default",
|
|
24
|
+
playerId = "default",
|
|
25
|
+
enablePadding = false
|
|
26
|
+
}) {
|
|
27
|
+
const { t } = useTranslation();
|
|
28
|
+
const [isMounted, setIsMounted] = useState(false);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
setIsMounted(true);
|
|
31
|
+
return () => setIsMounted(false);
|
|
32
|
+
}, []);
|
|
33
|
+
if (isFloating) {
|
|
34
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
35
|
+
/* @__PURE__ */ jsxs(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
className: cn(
|
|
39
|
+
"w-full rounded-[var(--radius-card)] bg-muted/20 border border-dashed border-muted-foreground/20 flex items-center justify-center flex-col gap-2 p-8 text-muted-foreground transition-all",
|
|
40
|
+
className
|
|
41
|
+
),
|
|
42
|
+
style: { aspectRatio },
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ jsx(Maximize2, { className: "w-8 h-8 opacity-50" }),
|
|
45
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: t("media.playingFloating") }),
|
|
46
|
+
/* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", onClick: () => setIsFloating(false), children: t("media.restoreToPage") })
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
isMounted && createPortal(
|
|
51
|
+
/* @__PURE__ */ jsx(
|
|
52
|
+
FloatingContainer,
|
|
53
|
+
{
|
|
54
|
+
setIsFloating,
|
|
55
|
+
onClose,
|
|
56
|
+
onCloseMedia,
|
|
57
|
+
title,
|
|
58
|
+
aspectRatio,
|
|
59
|
+
minWidth,
|
|
60
|
+
minHeight,
|
|
61
|
+
colorVariant,
|
|
62
|
+
playerId,
|
|
63
|
+
enablePadding,
|
|
64
|
+
children
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
document.body
|
|
68
|
+
)
|
|
69
|
+
] });
|
|
70
|
+
}
|
|
71
|
+
return /* @__PURE__ */ jsx("div", { className: cn("relative w-full overflow-hidden rounded-[var(--radius-card)]", className), children });
|
|
72
|
+
}
|
|
73
|
+
function FloatingContainer({
|
|
74
|
+
children,
|
|
75
|
+
setIsFloating,
|
|
76
|
+
onClose,
|
|
77
|
+
onCloseMedia,
|
|
78
|
+
title,
|
|
79
|
+
aspectRatio,
|
|
80
|
+
minWidth,
|
|
81
|
+
minHeight,
|
|
82
|
+
colorVariant,
|
|
83
|
+
playerId = "default",
|
|
84
|
+
enablePadding = false
|
|
85
|
+
}) {
|
|
86
|
+
const { t } = useTranslation();
|
|
87
|
+
const minPlayerHeight = minWidth / aspectRatio;
|
|
88
|
+
const containerRef = useRef(null);
|
|
89
|
+
const resizeHandleRef = useRef(null);
|
|
90
|
+
const getInitialState = useCallback(() => {
|
|
91
|
+
const storageKey = `xertica-media-player-${playerId}`;
|
|
92
|
+
const stored = typeof window !== "undefined" ? window.localStorage?.getItem(storageKey) : null;
|
|
93
|
+
if (stored) {
|
|
94
|
+
try {
|
|
95
|
+
return JSON.parse(stored);
|
|
96
|
+
} catch {
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
position: {
|
|
101
|
+
x: typeof window !== "undefined" ? window.innerWidth - minWidth - 24 : 0,
|
|
102
|
+
y: typeof window !== "undefined" ? window.innerHeight - minPlayerHeight - 24 : 0
|
|
103
|
+
},
|
|
104
|
+
size: {
|
|
105
|
+
width: minWidth,
|
|
106
|
+
height: minPlayerHeight
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}, [minWidth, minPlayerHeight, playerId]);
|
|
110
|
+
const [state, setState] = useState(getInitialState);
|
|
111
|
+
const { position, size } = state;
|
|
112
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
113
|
+
const [isResizing, setIsResizing] = useState(false);
|
|
114
|
+
const dragStartPos = useRef({ x: 0, y: 0 });
|
|
115
|
+
const dragStartOffset = useRef({ x: 0, y: 0 });
|
|
116
|
+
const resizeStartState = useRef({ position: { x: 0, y: 0 }, size: { width: 0, height: 0 } });
|
|
117
|
+
const saveState = useCallback(
|
|
118
|
+
(newPosition, newSize) => {
|
|
119
|
+
if (typeof window === "undefined") return;
|
|
120
|
+
const storageKey = `xertica-media-player-${playerId}`;
|
|
121
|
+
window.localStorage?.setItem(
|
|
122
|
+
storageKey,
|
|
123
|
+
JSON.stringify({ position: newPosition, size: newSize })
|
|
124
|
+
);
|
|
125
|
+
},
|
|
126
|
+
[playerId]
|
|
127
|
+
);
|
|
128
|
+
const handleMouseDown = (e) => {
|
|
129
|
+
setIsDragging(true);
|
|
130
|
+
dragStartPos.current = { x: e.clientX, y: e.clientY };
|
|
131
|
+
dragStartOffset.current = { x: position.x, y: position.y };
|
|
132
|
+
};
|
|
133
|
+
const handleResizeStart = (e, direction) => {
|
|
134
|
+
e.stopPropagation();
|
|
135
|
+
setIsResizing(true);
|
|
136
|
+
resizeHandleRef.current = direction;
|
|
137
|
+
dragStartPos.current = { x: e.clientX, y: e.clientY };
|
|
138
|
+
resizeStartState.current = { position: { ...position }, size: { ...size } };
|
|
139
|
+
};
|
|
140
|
+
const handleMouseMove = useCallback(
|
|
141
|
+
(e) => {
|
|
142
|
+
if (isDragging) {
|
|
143
|
+
const deltaX = e.clientX - dragStartPos.current.x;
|
|
144
|
+
const deltaY = e.clientY - dragStartPos.current.y;
|
|
145
|
+
const newPos = {
|
|
146
|
+
x: dragStartOffset.current.x + deltaX,
|
|
147
|
+
y: dragStartOffset.current.y + deltaY
|
|
148
|
+
};
|
|
149
|
+
setState((prev) => ({ ...prev, position: newPos }));
|
|
150
|
+
saveState(newPos, state.size);
|
|
151
|
+
}
|
|
152
|
+
if (isResizing && resizeHandleRef.current) {
|
|
153
|
+
const deltaX = e.clientX - dragStartPos.current.x;
|
|
154
|
+
const deltaY = e.clientY - dragStartPos.current.y;
|
|
155
|
+
const direction = resizeHandleRef.current;
|
|
156
|
+
let newPos = { ...resizeStartState.current.position };
|
|
157
|
+
let newSize = { ...resizeStartState.current.size };
|
|
158
|
+
if (direction.includes("right")) {
|
|
159
|
+
newSize.width = Math.max(minWidth, resizeStartState.current.size.width + deltaX);
|
|
160
|
+
}
|
|
161
|
+
if (direction.includes("left")) {
|
|
162
|
+
const newW = Math.max(minWidth, resizeStartState.current.size.width - deltaX);
|
|
163
|
+
newPos.x = resizeStartState.current.position.x + (resizeStartState.current.size.width - newW);
|
|
164
|
+
newSize.width = newW;
|
|
165
|
+
}
|
|
166
|
+
if (direction.includes("bottom")) {
|
|
167
|
+
newSize.height = Math.max(minHeight, resizeStartState.current.size.height + deltaY);
|
|
168
|
+
}
|
|
169
|
+
if (direction.includes("top")) {
|
|
170
|
+
const newH = Math.max(minHeight, resizeStartState.current.size.height - deltaY);
|
|
171
|
+
newPos.y = resizeStartState.current.position.y + (resizeStartState.current.size.height - newH);
|
|
172
|
+
newSize.height = newH;
|
|
173
|
+
}
|
|
174
|
+
setState({ position: newPos, size: newSize });
|
|
175
|
+
saveState(newPos, newSize);
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
[isDragging, isResizing, state.size, minWidth, minHeight, saveState]
|
|
179
|
+
);
|
|
180
|
+
const handleMouseUp = useCallback(() => {
|
|
181
|
+
setIsDragging(false);
|
|
182
|
+
setIsResizing(false);
|
|
183
|
+
resizeHandleRef.current = null;
|
|
184
|
+
}, []);
|
|
185
|
+
useEffect(() => {
|
|
186
|
+
if (!isDragging && !isResizing) return;
|
|
187
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
188
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
189
|
+
return () => {
|
|
190
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
191
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
192
|
+
};
|
|
193
|
+
}, [isDragging, isResizing, handleMouseMove, handleMouseUp]);
|
|
194
|
+
return /* @__PURE__ */ jsx("div", { className: "fixed inset-0 pointer-events-none z-50 overflow-hidden", children: /* @__PURE__ */ jsx(
|
|
195
|
+
"div",
|
|
196
|
+
{
|
|
197
|
+
ref: containerRef,
|
|
198
|
+
className: "pointer-events-auto absolute",
|
|
199
|
+
style: {
|
|
200
|
+
transform: `translate(${position.x}px, ${position.y}px)`,
|
|
201
|
+
width: size.width,
|
|
202
|
+
height: size.height
|
|
203
|
+
},
|
|
204
|
+
role: "dialog",
|
|
205
|
+
"aria-label": title || t("media.playingMedia"),
|
|
206
|
+
children: /* @__PURE__ */ jsxs(
|
|
207
|
+
"div",
|
|
208
|
+
{
|
|
209
|
+
className: cn(
|
|
210
|
+
"shadow-2xl rounded-[var(--radius-card)] overflow-hidden border backdrop-blur-sm",
|
|
211
|
+
colorVariant === "primary" ? "bg-primary border-primary-foreground/20 text-primary-foreground" : "border-border bg-card/95 text-card-foreground"
|
|
212
|
+
),
|
|
213
|
+
children: [
|
|
214
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col h-full w-full", children: [
|
|
215
|
+
/* @__PURE__ */ jsxs(
|
|
216
|
+
"div",
|
|
217
|
+
{
|
|
218
|
+
className: cn(
|
|
219
|
+
"h-9 backdrop-blur-sm border-b flex items-center justify-between px-2 cursor-move select-none",
|
|
220
|
+
colorVariant === "primary" ? "bg-primary-foreground/10 border-primary-foreground/10" : "bg-muted/20 border-border/40"
|
|
221
|
+
),
|
|
222
|
+
onMouseDown: handleMouseDown,
|
|
223
|
+
style: { touchAction: "none", userSelect: "none" },
|
|
224
|
+
children: [
|
|
225
|
+
/* @__PURE__ */ jsxs(
|
|
226
|
+
"div",
|
|
227
|
+
{
|
|
228
|
+
className: cn(
|
|
229
|
+
"flex items-center gap-2 text-[10px] uppercase tracking-wider font-bold truncate flex-1",
|
|
230
|
+
colorVariant === "primary" ? "text-primary-foreground" : "text-muted-foreground"
|
|
231
|
+
),
|
|
232
|
+
children: [
|
|
233
|
+
/* @__PURE__ */ jsx(GripHorizontal, { className: "w-3.5 h-3.5" }),
|
|
234
|
+
/* @__PURE__ */ jsx("span", { className: "truncate max-w-[150px]", children: title || t("media.playingMedia") })
|
|
235
|
+
]
|
|
236
|
+
}
|
|
237
|
+
),
|
|
238
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsx(
|
|
239
|
+
Button,
|
|
240
|
+
{
|
|
241
|
+
variant: "ghost",
|
|
242
|
+
size: "icon",
|
|
243
|
+
className: cn(
|
|
244
|
+
"h-7 w-7 rounded-full transition-colors",
|
|
245
|
+
colorVariant === "primary" ? "text-primary-foreground/70 hover:bg-destructive/20 hover:text-destructive-foreground" : "text-muted-foreground hover:bg-destructive/10 hover:text-destructive"
|
|
246
|
+
),
|
|
247
|
+
onClick: onCloseMedia || onClose,
|
|
248
|
+
title: t("common.close"),
|
|
249
|
+
"aria-label": t("media.closePlayer"),
|
|
250
|
+
children: /* @__PURE__ */ jsx(X, { className: "w-4 h-4" })
|
|
251
|
+
}
|
|
252
|
+
) })
|
|
253
|
+
]
|
|
254
|
+
}
|
|
255
|
+
),
|
|
256
|
+
/* @__PURE__ */ jsx(
|
|
257
|
+
"div",
|
|
258
|
+
{
|
|
259
|
+
className: cn(
|
|
260
|
+
"flex-1 relative overflow-hidden group",
|
|
261
|
+
enablePadding && "p-2",
|
|
262
|
+
colorVariant === "primary" ? "bg-primary" : "bg-card"
|
|
263
|
+
),
|
|
264
|
+
children
|
|
265
|
+
}
|
|
266
|
+
)
|
|
267
|
+
] }),
|
|
268
|
+
/* @__PURE__ */ jsx(
|
|
269
|
+
"div",
|
|
270
|
+
{
|
|
271
|
+
"aria-hidden": "true",
|
|
272
|
+
className: "absolute top-0 left-0 w-2 h-full cursor-ew-resize hover:bg-primary/20 transition-colors",
|
|
273
|
+
onMouseDown: (e) => handleResizeStart(e, "left")
|
|
274
|
+
}
|
|
275
|
+
),
|
|
276
|
+
/* @__PURE__ */ jsx(
|
|
277
|
+
"div",
|
|
278
|
+
{
|
|
279
|
+
"aria-hidden": "true",
|
|
280
|
+
className: "absolute top-0 right-0 w-2 h-full cursor-ew-resize hover:bg-primary/20 transition-colors",
|
|
281
|
+
onMouseDown: (e) => handleResizeStart(e, "right")
|
|
282
|
+
}
|
|
283
|
+
),
|
|
284
|
+
/* @__PURE__ */ jsx(
|
|
285
|
+
"div",
|
|
286
|
+
{
|
|
287
|
+
"aria-hidden": "true",
|
|
288
|
+
className: "absolute top-0 left-0 w-full h-2 cursor-ns-resize hover:bg-primary/20 transition-colors",
|
|
289
|
+
onMouseDown: (e) => handleResizeStart(e, "top")
|
|
290
|
+
}
|
|
291
|
+
),
|
|
292
|
+
/* @__PURE__ */ jsx(
|
|
293
|
+
"div",
|
|
294
|
+
{
|
|
295
|
+
"aria-hidden": "true",
|
|
296
|
+
className: "absolute bottom-0 left-0 w-full h-2 cursor-ns-resize hover:bg-primary/20 transition-colors",
|
|
297
|
+
onMouseDown: (e) => handleResizeStart(e, "bottom")
|
|
298
|
+
}
|
|
299
|
+
),
|
|
300
|
+
/* @__PURE__ */ jsx(
|
|
301
|
+
"div",
|
|
302
|
+
{
|
|
303
|
+
"aria-hidden": "true",
|
|
304
|
+
className: "absolute top-0 left-0 w-4 h-4 cursor-nwse-resize hover:bg-primary/20 transition-colors",
|
|
305
|
+
onMouseDown: (e) => handleResizeStart(e, "top-left")
|
|
306
|
+
}
|
|
307
|
+
),
|
|
308
|
+
/* @__PURE__ */ jsx(
|
|
309
|
+
"div",
|
|
310
|
+
{
|
|
311
|
+
"aria-hidden": "true",
|
|
312
|
+
className: "absolute top-0 right-0 w-4 h-4 cursor-nesw-resize hover:bg-primary/20 transition-colors",
|
|
313
|
+
onMouseDown: (e) => handleResizeStart(e, "top-right")
|
|
314
|
+
}
|
|
315
|
+
),
|
|
316
|
+
/* @__PURE__ */ jsx(
|
|
317
|
+
"div",
|
|
318
|
+
{
|
|
319
|
+
"aria-hidden": "true",
|
|
320
|
+
className: "absolute bottom-0 left-0 w-4 h-4 cursor-nesw-resize hover:bg-primary/20 transition-colors",
|
|
321
|
+
onMouseDown: (e) => handleResizeStart(e, "bottom-left")
|
|
322
|
+
}
|
|
323
|
+
),
|
|
324
|
+
/* @__PURE__ */ jsx(
|
|
325
|
+
"div",
|
|
326
|
+
{
|
|
327
|
+
"aria-hidden": "true",
|
|
328
|
+
className: "absolute bottom-0 right-0 w-4 h-4 cursor-nwse-resize hover:bg-primary/20 transition-colors",
|
|
329
|
+
onMouseDown: (e) => handleResizeStart(e, "bottom-right")
|
|
330
|
+
}
|
|
331
|
+
)
|
|
332
|
+
]
|
|
333
|
+
}
|
|
334
|
+
)
|
|
335
|
+
}
|
|
336
|
+
) });
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
function VideoPlayer({
|
|
340
|
+
src,
|
|
341
|
+
poster,
|
|
342
|
+
title,
|
|
343
|
+
autoPlay = false,
|
|
344
|
+
enableAutoFloat = true,
|
|
345
|
+
className
|
|
346
|
+
}) {
|
|
347
|
+
const { t } = useTranslation();
|
|
348
|
+
const videoRef = useRef(null);
|
|
349
|
+
const containerRef = useRef(null);
|
|
350
|
+
const [isPlaying, setIsPlaying] = useState(false);
|
|
351
|
+
const [progress, setProgress] = useState(0);
|
|
352
|
+
const [volume, setVolume] = useState(1);
|
|
353
|
+
const [isMuted, setIsMuted] = useState(false);
|
|
354
|
+
const [currentTime, setCurrentTime] = useState(0);
|
|
355
|
+
const [duration, setDuration] = useState(0);
|
|
356
|
+
const [isFloating, setIsFloating] = useState(false);
|
|
357
|
+
const [isManualFloating, setIsManualFloating] = useState(false);
|
|
358
|
+
const [showControls, setShowControls] = useState(true);
|
|
359
|
+
const [enableAutoFloatLocal, setEnableAutoFloatLocal] = useState(enableAutoFloat);
|
|
360
|
+
let controlsTimeout;
|
|
361
|
+
const handleSetFloating = (floating) => {
|
|
362
|
+
if (videoRef.current) {
|
|
363
|
+
setCurrentTime(videoRef.current.currentTime);
|
|
364
|
+
}
|
|
365
|
+
setIsFloating(floating);
|
|
366
|
+
if (!floating) {
|
|
367
|
+
setIsManualFloating(false);
|
|
368
|
+
}
|
|
369
|
+
};
|
|
370
|
+
useEffect(() => {
|
|
371
|
+
const video = videoRef.current;
|
|
372
|
+
if (video) {
|
|
373
|
+
if (Math.abs(video.currentTime - currentTime) > 0.5) {
|
|
374
|
+
video.currentTime = currentTime;
|
|
375
|
+
}
|
|
376
|
+
if (isPlaying) {
|
|
377
|
+
const playPromise = video.play();
|
|
378
|
+
if (playPromise !== void 0) {
|
|
379
|
+
playPromise.catch((error) => {
|
|
380
|
+
console.log("Playback interrupted during switch:", error);
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}, [isFloating]);
|
|
386
|
+
useEffect(() => {
|
|
387
|
+
const container = containerRef.current;
|
|
388
|
+
if (!container || !enableAutoFloatLocal) return;
|
|
389
|
+
const observer = new IntersectionObserver(
|
|
390
|
+
(entries) => {
|
|
391
|
+
const entry = entries[0];
|
|
392
|
+
if (!entry) return;
|
|
393
|
+
if (isPlaying && !entry.isIntersecting && !isFloating) {
|
|
394
|
+
if (videoRef.current) setCurrentTime(videoRef.current.currentTime);
|
|
395
|
+
setIsFloating(true);
|
|
396
|
+
} else if (entry.isIntersecting && isFloating && !isManualFloating) {
|
|
397
|
+
if (videoRef.current) setCurrentTime(videoRef.current.currentTime);
|
|
398
|
+
handleSetFloating(false);
|
|
399
|
+
}
|
|
400
|
+
},
|
|
401
|
+
{ threshold: 0.2 }
|
|
402
|
+
);
|
|
403
|
+
observer.observe(container);
|
|
404
|
+
return () => observer.disconnect();
|
|
405
|
+
}, [isPlaying, isFloating, isManualFloating, enableAutoFloatLocal]);
|
|
406
|
+
useEffect(() => {
|
|
407
|
+
const video = videoRef.current;
|
|
408
|
+
if (!video) return;
|
|
409
|
+
const updateTime = () => {
|
|
410
|
+
setCurrentTime(video.currentTime);
|
|
411
|
+
};
|
|
412
|
+
const updateDuration = () => setDuration(video.duration);
|
|
413
|
+
const onPlay = () => setIsPlaying(true);
|
|
414
|
+
const onPause = () => setIsPlaying(false);
|
|
415
|
+
video.addEventListener("timeupdate", updateTime);
|
|
416
|
+
video.addEventListener("loadedmetadata", updateDuration);
|
|
417
|
+
video.addEventListener("play", onPlay);
|
|
418
|
+
video.addEventListener("pause", onPause);
|
|
419
|
+
video.volume = volume;
|
|
420
|
+
video.muted = isMuted;
|
|
421
|
+
return () => {
|
|
422
|
+
video.removeEventListener("timeupdate", updateTime);
|
|
423
|
+
video.removeEventListener("loadedmetadata", updateDuration);
|
|
424
|
+
video.removeEventListener("play", onPlay);
|
|
425
|
+
video.removeEventListener("pause", onPause);
|
|
426
|
+
};
|
|
427
|
+
}, [isFloating]);
|
|
428
|
+
const togglePlay = () => {
|
|
429
|
+
if (videoRef.current) {
|
|
430
|
+
if (isPlaying) {
|
|
431
|
+
videoRef.current.pause();
|
|
432
|
+
} else {
|
|
433
|
+
videoRef.current.play();
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
};
|
|
437
|
+
const handleSeek = (value) => {
|
|
438
|
+
if (videoRef.current) {
|
|
439
|
+
videoRef.current.currentTime = value[0];
|
|
440
|
+
setCurrentTime(value[0]);
|
|
441
|
+
}
|
|
442
|
+
};
|
|
443
|
+
const handleVolumeChange = (value) => {
|
|
444
|
+
const newVolume = value[0];
|
|
445
|
+
if (videoRef.current) {
|
|
446
|
+
videoRef.current.volume = newVolume;
|
|
447
|
+
setVolume(newVolume);
|
|
448
|
+
setIsMuted(newVolume === 0);
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
const toggleMute = () => {
|
|
452
|
+
if (videoRef.current) {
|
|
453
|
+
const newMutedState = !isMuted;
|
|
454
|
+
videoRef.current.muted = newMutedState;
|
|
455
|
+
setIsMuted(newMutedState);
|
|
456
|
+
if (newMutedState) {
|
|
457
|
+
setVolume(0);
|
|
458
|
+
} else {
|
|
459
|
+
setVolume(1);
|
|
460
|
+
videoRef.current.volume = 1;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
};
|
|
464
|
+
const handleMouseMove = () => {
|
|
465
|
+
setShowControls(true);
|
|
466
|
+
clearTimeout(controlsTimeout);
|
|
467
|
+
controlsTimeout = setTimeout(() => {
|
|
468
|
+
if (isPlaying) setShowControls(false);
|
|
469
|
+
}, 2500);
|
|
470
|
+
};
|
|
471
|
+
const formatTime = (time) => {
|
|
472
|
+
const minutes = Math.floor(time / 60);
|
|
473
|
+
const seconds = Math.floor(time % 60);
|
|
474
|
+
return `${minutes}:${seconds < 10 ? "0" : ""}${seconds}`;
|
|
475
|
+
};
|
|
476
|
+
return /* @__PURE__ */ jsx("div", { ref: containerRef, className, children: /* @__PURE__ */ jsx(
|
|
477
|
+
FloatingMediaWrapper,
|
|
478
|
+
{
|
|
479
|
+
isFloating,
|
|
480
|
+
setIsFloating: handleSetFloating,
|
|
481
|
+
onClose: () => handleSetFloating(false),
|
|
482
|
+
onCloseMedia: () => {
|
|
483
|
+
setIsFloating(false);
|
|
484
|
+
setEnableAutoFloatLocal(false);
|
|
485
|
+
},
|
|
486
|
+
title: title || t("media.untitledVideo"),
|
|
487
|
+
aspectRatio: 16 / 9,
|
|
488
|
+
className: "w-full h-full",
|
|
489
|
+
playerId: "video-player",
|
|
490
|
+
children: /* @__PURE__ */ jsxs(
|
|
491
|
+
"div",
|
|
492
|
+
{
|
|
493
|
+
className: "relative w-full h-full bg-black group overflow-hidden",
|
|
494
|
+
onMouseMove: handleMouseMove,
|
|
495
|
+
onMouseLeave: () => isPlaying && setShowControls(false),
|
|
496
|
+
children: [
|
|
497
|
+
/* @__PURE__ */ jsx(
|
|
498
|
+
"video",
|
|
499
|
+
{
|
|
500
|
+
ref: videoRef,
|
|
501
|
+
src,
|
|
502
|
+
poster,
|
|
503
|
+
className: "w-full h-full object-contain",
|
|
504
|
+
onClick: togglePlay,
|
|
505
|
+
autoPlay,
|
|
506
|
+
title: title || t("media.video")
|
|
507
|
+
}
|
|
508
|
+
),
|
|
509
|
+
!isPlaying && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none", children: /* @__PURE__ */ jsx("div", { className: "w-16 h-16 rounded-full bg-black/40 backdrop-blur-sm flex items-center justify-center border border-white/20 shadow-2xl", children: /* @__PURE__ */ jsx(Play, { className: "w-8 h-8 text-white ml-1", fill: "white" }) }) }),
|
|
510
|
+
/* @__PURE__ */ jsxs(
|
|
511
|
+
"div",
|
|
512
|
+
{
|
|
513
|
+
className: cn(
|
|
514
|
+
"absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/60 via-black/30 to-transparent pt-12 pb-4 px-4 transition-opacity duration-300",
|
|
515
|
+
showControls ? "opacity-100" : "opacity-0"
|
|
516
|
+
),
|
|
517
|
+
children: [
|
|
518
|
+
/* @__PURE__ */ jsx("div", { className: "mb-4 group/slider", children: /* @__PURE__ */ jsx(
|
|
519
|
+
Slider,
|
|
520
|
+
{
|
|
521
|
+
value: [currentTime],
|
|
522
|
+
max: duration || 100,
|
|
523
|
+
step: 1,
|
|
524
|
+
onValueChange: handleSeek,
|
|
525
|
+
className: "cursor-pointer [&_[data-slot=slider-track]]:bg-white/30 [&_[data-slot=slider-range]]:bg-white [&_[data-slot=slider-thumb]]:bg-white [&_[data-slot=slider-thumb]]:border-white",
|
|
526
|
+
"aria-label": t("media.videoProgress")
|
|
527
|
+
}
|
|
528
|
+
) }),
|
|
529
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
530
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
|
|
531
|
+
/* @__PURE__ */ jsx(
|
|
532
|
+
Button,
|
|
533
|
+
{
|
|
534
|
+
variant: "ghost",
|
|
535
|
+
size: "icon",
|
|
536
|
+
className: "text-white hover:text-white hover:bg-black/50 h-8 w-8",
|
|
537
|
+
onClick: togglePlay,
|
|
538
|
+
"aria-label": isPlaying ? t("media.pause") : t("media.play"),
|
|
539
|
+
children: isPlaying ? /* @__PURE__ */ jsx(Pause, { className: "w-5 h-5", fill: "currentColor" }) : /* @__PURE__ */ jsx(Play, { className: "w-5 h-5", fill: "currentColor" })
|
|
540
|
+
}
|
|
541
|
+
),
|
|
542
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 group/vol", children: [
|
|
543
|
+
/* @__PURE__ */ jsx(
|
|
544
|
+
Button,
|
|
545
|
+
{
|
|
546
|
+
variant: "ghost",
|
|
547
|
+
size: "icon",
|
|
548
|
+
className: "text-white hover:text-white hover:bg-black/50 h-8 w-8",
|
|
549
|
+
onClick: toggleMute,
|
|
550
|
+
"aria-label": isMuted || volume === 0 ? t("media.unmute") : t("media.mute"),
|
|
551
|
+
children: isMuted || volume === 0 ? /* @__PURE__ */ jsx(VolumeX, { className: "w-5 h-5" }) : /* @__PURE__ */ jsx(Volume2, { className: "w-5 h-5" })
|
|
552
|
+
}
|
|
553
|
+
),
|
|
554
|
+
/* @__PURE__ */ jsx("div", { className: "w-0 overflow-hidden group-hover/vol:w-20 transition-all duration-300", children: /* @__PURE__ */ jsx(
|
|
555
|
+
Slider,
|
|
556
|
+
{
|
|
557
|
+
value: [isMuted ? 0 : volume],
|
|
558
|
+
max: 1,
|
|
559
|
+
step: 0.01,
|
|
560
|
+
onValueChange: handleVolumeChange,
|
|
561
|
+
className: "w-20 [&_[data-slot=slider-track]]:bg-white/30 [&_[data-slot=slider-range]]:bg-white [&_[data-slot=slider-thumb]]:bg-white [&_[data-slot=slider-thumb]]:border-white",
|
|
562
|
+
"aria-label": t("media.volume")
|
|
563
|
+
}
|
|
564
|
+
) })
|
|
565
|
+
] }),
|
|
566
|
+
/* @__PURE__ */ jsxs("div", { className: "text-white text-xs font-medium tabular-nums select-none drop-shadow-md", children: [
|
|
567
|
+
formatTime(currentTime),
|
|
568
|
+
" / ",
|
|
569
|
+
formatTime(duration)
|
|
570
|
+
] })
|
|
571
|
+
] }),
|
|
572
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx(
|
|
573
|
+
Button,
|
|
574
|
+
{
|
|
575
|
+
variant: "ghost",
|
|
576
|
+
size: "icon",
|
|
577
|
+
className: "text-white hover:text-white hover:bg-black/50 h-8 w-8",
|
|
578
|
+
onClick: () => {
|
|
579
|
+
setEnableAutoFloatLocal(true);
|
|
580
|
+
if (!isFloating) setIsManualFloating(true);
|
|
581
|
+
handleSetFloating(!isFloating);
|
|
582
|
+
},
|
|
583
|
+
title: isFloating ? t("media.restore") : t("media.popOut"),
|
|
584
|
+
"aria-label": isFloating ? t("media.restore") : t("media.popOut"),
|
|
585
|
+
children: isFloating ? /* @__PURE__ */ jsx(Maximize, { className: "w-4 h-4" }) : /* @__PURE__ */ jsx(PictureInPicture, { className: "w-4 h-4" })
|
|
586
|
+
}
|
|
587
|
+
) })
|
|
588
|
+
] })
|
|
589
|
+
]
|
|
590
|
+
}
|
|
591
|
+
)
|
|
592
|
+
]
|
|
593
|
+
}
|
|
594
|
+
)
|
|
595
|
+
}
|
|
596
|
+
) });
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
function AudioPlayer({
|
|
600
|
+
src,
|
|
601
|
+
title,
|
|
602
|
+
artist,
|
|
603
|
+
subtitle,
|
|
604
|
+
autoPlay = false,
|
|
605
|
+
className,
|
|
606
|
+
variant = "card",
|
|
607
|
+
isOpen = true,
|
|
608
|
+
onClose,
|
|
609
|
+
duration: initialDuration,
|
|
610
|
+
currentTime: initialTime = 0,
|
|
611
|
+
colorVariant = "default",
|
|
612
|
+
enableAutoFloat = true,
|
|
613
|
+
onCloseFloating
|
|
614
|
+
}) {
|
|
615
|
+
const { t } = useTranslation();
|
|
616
|
+
const {
|
|
617
|
+
audioRef,
|
|
618
|
+
containerRef,
|
|
619
|
+
isPlaying,
|
|
620
|
+
currentTime,
|
|
621
|
+
duration,
|
|
622
|
+
volume,
|
|
623
|
+
isMuted,
|
|
624
|
+
playbackSpeed,
|
|
625
|
+
isFloating,
|
|
626
|
+
isManualFloating,
|
|
627
|
+
isVisible,
|
|
628
|
+
isMobile,
|
|
629
|
+
enableAutoFloatLocal,
|
|
630
|
+
sidebarExpanded,
|
|
631
|
+
sidebarWidth,
|
|
632
|
+
assistenteExpanded,
|
|
633
|
+
togglePlay,
|
|
634
|
+
toggleMute,
|
|
635
|
+
handleSeek,
|
|
636
|
+
handleVolumeChange,
|
|
637
|
+
handleSetFloating,
|
|
638
|
+
handleEnableManualFloat,
|
|
639
|
+
setPlaybackSpeed,
|
|
640
|
+
resetAudio,
|
|
641
|
+
formatTime,
|
|
642
|
+
onPlay,
|
|
643
|
+
onPause,
|
|
644
|
+
onEnded,
|
|
645
|
+
onTimeUpdate,
|
|
646
|
+
onLoadedMetadata
|
|
647
|
+
} = useAudioPlayer({
|
|
648
|
+
src,
|
|
649
|
+
autoPlay,
|
|
650
|
+
initialTime,
|
|
651
|
+
initialDuration,
|
|
652
|
+
variant,
|
|
653
|
+
isOpen,
|
|
654
|
+
enableAutoFloat,
|
|
655
|
+
onCloseFloating
|
|
656
|
+
});
|
|
657
|
+
const audioElement = /* @__PURE__ */ jsx(
|
|
658
|
+
"audio",
|
|
659
|
+
{
|
|
660
|
+
ref: audioRef,
|
|
661
|
+
src,
|
|
662
|
+
autoPlay,
|
|
663
|
+
className: "hidden",
|
|
664
|
+
onTimeUpdate,
|
|
665
|
+
onLoadedMetadata,
|
|
666
|
+
onPlay,
|
|
667
|
+
onPause,
|
|
668
|
+
onEnded
|
|
669
|
+
}
|
|
670
|
+
);
|
|
671
|
+
const desktopLayout = /* @__PURE__ */ jsxs(
|
|
672
|
+
"div",
|
|
673
|
+
{
|
|
674
|
+
className: cn(
|
|
675
|
+
"px-6 flex items-center justify-between gap-4",
|
|
676
|
+
colorVariant === "primary" ? "h-[80px] gap-6" : "h-[80px]"
|
|
677
|
+
),
|
|
678
|
+
children: [
|
|
679
|
+
/* @__PURE__ */ jsxs(
|
|
680
|
+
"div",
|
|
681
|
+
{
|
|
682
|
+
className: cn(
|
|
683
|
+
"flex flex-col min-w-0 shrink-0 relative z-10",
|
|
684
|
+
colorVariant === "primary" ? "w-[280px]" : "w-[280px]"
|
|
685
|
+
),
|
|
686
|
+
children: [
|
|
687
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-0.5", children: [
|
|
688
|
+
colorVariant === "primary" ? /* @__PURE__ */ jsx("div", { className: "w-2 h-2 rounded-full bg-[var(--chart-4)] animate-pulse shrink-0" }) : /* @__PURE__ */ jsx(Radio, { className: "w-3 h-3 text-[var(--chart-4)] animate-pulse shrink-0" }),
|
|
689
|
+
/* @__PURE__ */ jsx(
|
|
690
|
+
"h4",
|
|
691
|
+
{
|
|
692
|
+
className: cn(
|
|
693
|
+
"truncate",
|
|
694
|
+
colorVariant === "primary" ? "font-semibold text-base tracking-tight" : "font-medium text-base"
|
|
695
|
+
),
|
|
696
|
+
title: title || t("media.audioTitle"),
|
|
697
|
+
children: title || t("media.audioTitle")
|
|
698
|
+
}
|
|
699
|
+
)
|
|
700
|
+
] }),
|
|
701
|
+
/* @__PURE__ */ jsxs(
|
|
702
|
+
"div",
|
|
703
|
+
{
|
|
704
|
+
className: cn(
|
|
705
|
+
"flex items-center gap-1 text-xs text-muted-foreground",
|
|
706
|
+
colorVariant === "primary" && "opacity-80"
|
|
707
|
+
),
|
|
708
|
+
children: [
|
|
709
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: subtitle || artist }),
|
|
710
|
+
/* @__PURE__ */ jsx(
|
|
711
|
+
ExternalLink,
|
|
712
|
+
{
|
|
713
|
+
className: cn(
|
|
714
|
+
"w-3 h-3 cursor-pointer hover:text-foreground ml-1 transition-opacity",
|
|
715
|
+
colorVariant === "primary" ? "opacity-60 hover:opacity-100" : "opacity-70 hover:opacity-100"
|
|
716
|
+
)
|
|
717
|
+
}
|
|
718
|
+
)
|
|
719
|
+
]
|
|
720
|
+
}
|
|
721
|
+
)
|
|
722
|
+
]
|
|
723
|
+
}
|
|
724
|
+
),
|
|
725
|
+
/* @__PURE__ */ jsxs(
|
|
726
|
+
"div",
|
|
727
|
+
{
|
|
728
|
+
className: cn(
|
|
729
|
+
"flex-1 flex items-center justify-center gap-4 min-w-0 max-w-xl relative z-10",
|
|
730
|
+
colorVariant === "primary" && "gap-4"
|
|
731
|
+
),
|
|
732
|
+
children: [
|
|
733
|
+
/* @__PURE__ */ jsx(
|
|
734
|
+
"button",
|
|
735
|
+
{
|
|
736
|
+
onClick: togglePlay,
|
|
737
|
+
"aria-label": isPlaying ? t("media.pause") : t("media.play"),
|
|
738
|
+
className: cn(
|
|
739
|
+
"transition-all focus:outline-none shrink-0",
|
|
740
|
+
colorVariant === "primary" ? "hover:scale-110" : "text-muted-foreground hover:text-foreground hover:scale-110 active:scale-95 transform duration-100"
|
|
741
|
+
),
|
|
742
|
+
children: isPlaying ? /* @__PURE__ */ jsx(
|
|
743
|
+
PauseCircle,
|
|
744
|
+
{
|
|
745
|
+
className: cn(colorVariant === "primary" ? "w-12 h-12" : "w-10 h-10"),
|
|
746
|
+
strokeWidth: colorVariant === "primary" ? 1 : 1.5
|
|
747
|
+
}
|
|
748
|
+
) : /* @__PURE__ */ jsx(
|
|
749
|
+
PlayCircle,
|
|
750
|
+
{
|
|
751
|
+
className: cn(colorVariant === "primary" ? "w-12 h-12" : "w-10 h-10"),
|
|
752
|
+
strokeWidth: colorVariant === "primary" ? 1 : 1.5
|
|
753
|
+
}
|
|
754
|
+
)
|
|
755
|
+
}
|
|
756
|
+
),
|
|
757
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 flex items-center gap-3 max-w-lg", children: [
|
|
758
|
+
/* @__PURE__ */ jsx(
|
|
759
|
+
"span",
|
|
760
|
+
{
|
|
761
|
+
className: cn(
|
|
762
|
+
"text-xs font-mono shrink-0 w-10 text-right",
|
|
763
|
+
colorVariant === "primary" ? "text-[11px] w-12 opacity-80" : "text-muted-foreground"
|
|
764
|
+
),
|
|
765
|
+
children: formatTime(currentTime)
|
|
766
|
+
}
|
|
767
|
+
),
|
|
768
|
+
/* @__PURE__ */ jsx(
|
|
769
|
+
Slider,
|
|
770
|
+
{
|
|
771
|
+
value: [currentTime],
|
|
772
|
+
max: duration || 100,
|
|
773
|
+
onValueChange: handleSeek,
|
|
774
|
+
className: "cursor-pointer"
|
|
775
|
+
}
|
|
776
|
+
),
|
|
777
|
+
/* @__PURE__ */ jsx(
|
|
778
|
+
"span",
|
|
779
|
+
{
|
|
780
|
+
className: cn(
|
|
781
|
+
"text-xs font-mono shrink-0 w-10",
|
|
782
|
+
colorVariant === "primary" ? "text-[11px] w-12 opacity-80" : "text-muted-foreground"
|
|
783
|
+
),
|
|
784
|
+
children: formatTime(duration)
|
|
785
|
+
}
|
|
786
|
+
)
|
|
787
|
+
] })
|
|
788
|
+
]
|
|
789
|
+
}
|
|
790
|
+
),
|
|
791
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 shrink-0 relative z-10", children: [
|
|
792
|
+
/* @__PURE__ */ jsxs("div", { className: "hidden lg:flex items-center gap-2 w-28 mr-2 group", children: [
|
|
793
|
+
/* @__PURE__ */ jsx(
|
|
794
|
+
"button",
|
|
795
|
+
{
|
|
796
|
+
onClick: toggleMute,
|
|
797
|
+
className: "text-muted-foreground hover:text-foreground",
|
|
798
|
+
"aria-label": isMuted || volume === 0 ? t("media.unmute") : t("media.mute"),
|
|
799
|
+
children: isMuted || volume === 0 ? /* @__PURE__ */ jsx(VolumeX, { className: "w-5 h-5" }) : /* @__PURE__ */ jsx(Volume2, { className: "w-5 h-5" })
|
|
800
|
+
}
|
|
801
|
+
),
|
|
802
|
+
/* @__PURE__ */ jsx(
|
|
803
|
+
Slider,
|
|
804
|
+
{
|
|
805
|
+
value: [isMuted ? 0 : volume * 100],
|
|
806
|
+
max: 100,
|
|
807
|
+
onValueChange: (val) => handleVolumeChange([val[0] / 100]),
|
|
808
|
+
className: "w-full opacity-60 group-hover:opacity-100 transition-opacity"
|
|
809
|
+
}
|
|
810
|
+
)
|
|
811
|
+
] }),
|
|
812
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
813
|
+
/* @__PURE__ */ jsxs("div", { className: "hidden md:flex", children: [
|
|
814
|
+
/* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
815
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
816
|
+
Button,
|
|
817
|
+
{
|
|
818
|
+
variant: "ghost",
|
|
819
|
+
size: "icon",
|
|
820
|
+
className: "rounded-full h-9 w-9",
|
|
821
|
+
onClick: resetAudio,
|
|
822
|
+
"aria-label": t("media.restart"),
|
|
823
|
+
children: /* @__PURE__ */ jsx(RotateCcw, { className: "w-4 h-4" })
|
|
824
|
+
}
|
|
825
|
+
) }),
|
|
826
|
+
/* @__PURE__ */ jsx(TooltipContent, { className: "z-[1001]", children: t("media.restart") })
|
|
827
|
+
] }) }),
|
|
828
|
+
/* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
829
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
830
|
+
Button,
|
|
831
|
+
{
|
|
832
|
+
variant: "ghost",
|
|
833
|
+
size: "icon",
|
|
834
|
+
className: "text-[var(--chart-3)] hover:bg-accent rounded-full h-9 w-9",
|
|
835
|
+
"aria-label": t("media.audioInfo"),
|
|
836
|
+
children: /* @__PURE__ */ jsx(Info, { className: "w-4 h-4 fill-current" })
|
|
837
|
+
}
|
|
838
|
+
) }),
|
|
839
|
+
/* @__PURE__ */ jsx(TooltipContent, { className: "z-[1001]", children: t("media.info") })
|
|
840
|
+
] }) })
|
|
841
|
+
] }),
|
|
842
|
+
/* @__PURE__ */ jsxs("div", { className: "hidden xl:flex items-center gap-1", children: [
|
|
843
|
+
/* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
844
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
845
|
+
Button,
|
|
846
|
+
{
|
|
847
|
+
variant: "ghost",
|
|
848
|
+
size: "icon",
|
|
849
|
+
className: "rounded-full h-9 w-9",
|
|
850
|
+
"aria-label": t("media.selectSpeed"),
|
|
851
|
+
children: /* @__PURE__ */ jsx(Gauge, { className: "w-4 h-4" })
|
|
852
|
+
}
|
|
853
|
+
) }),
|
|
854
|
+
/* @__PURE__ */ jsx(DropdownMenuContent, { align: "center", className: "w-32 z-[1001]", children: [0.5, 1, 1.5, 2].map((speed) => /* @__PURE__ */ jsxs(
|
|
855
|
+
DropdownMenuItem,
|
|
856
|
+
{
|
|
857
|
+
onClick: () => setPlaybackSpeed(speed),
|
|
858
|
+
className: cn(
|
|
859
|
+
"cursor-pointer",
|
|
860
|
+
playbackSpeed === speed && "bg-accent font-bold"
|
|
861
|
+
),
|
|
862
|
+
children: [
|
|
863
|
+
speed,
|
|
864
|
+
"x"
|
|
865
|
+
]
|
|
866
|
+
},
|
|
867
|
+
speed
|
|
868
|
+
)) })
|
|
869
|
+
] }),
|
|
870
|
+
/* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
871
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
872
|
+
Button,
|
|
873
|
+
{
|
|
874
|
+
variant: "ghost",
|
|
875
|
+
size: "icon",
|
|
876
|
+
className: "rounded-full h-9 w-9",
|
|
877
|
+
"aria-label": t("media.downloadAudio"),
|
|
878
|
+
children: /* @__PURE__ */ jsx(Download, { className: "w-4 h-4" })
|
|
879
|
+
}
|
|
880
|
+
) }),
|
|
881
|
+
/* @__PURE__ */ jsx(TooltipContent, { className: "z-[1001]", children: t("media.downloadAudio") })
|
|
882
|
+
] }) })
|
|
883
|
+
] }),
|
|
884
|
+
/* @__PURE__ */ jsx("div", { className: "xl:hidden", children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
885
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
886
|
+
Button,
|
|
887
|
+
{
|
|
888
|
+
variant: "ghost",
|
|
889
|
+
size: "icon",
|
|
890
|
+
className: "rounded-full h-9 w-9",
|
|
891
|
+
"aria-label": t("media.moreOptions"),
|
|
892
|
+
children: /* @__PURE__ */ jsx(MoreHorizontal, { className: "w-5 h-5" })
|
|
893
|
+
}
|
|
894
|
+
) }),
|
|
895
|
+
/* @__PURE__ */ jsxs(DropdownMenuContent, { align: "end", className: "w-56 p-2 z-[1001]", children: [
|
|
896
|
+
/* @__PURE__ */ jsxs("div", { className: "lg:hidden", children: [
|
|
897
|
+
/* @__PURE__ */ jsxs("div", { className: "px-2 py-3", children: [
|
|
898
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-between mb-3 px-1", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
899
|
+
isMuted || volume === 0 ? /* @__PURE__ */ jsx(VolumeX, { className: "w-4 h-4 text-muted-foreground" }) : /* @__PURE__ */ jsx(Volume2, { className: "w-4 h-4 text-muted-foreground" }),
|
|
900
|
+
/* @__PURE__ */ jsx("span", { className: "text-[11px] font-medium uppercase tracking-wider text-muted-foreground/70", children: "Volume" })
|
|
901
|
+
] }) }),
|
|
902
|
+
/* @__PURE__ */ jsx(
|
|
903
|
+
Slider,
|
|
904
|
+
{
|
|
905
|
+
value: [isMuted ? 0 : volume * 100],
|
|
906
|
+
max: 100,
|
|
907
|
+
onValueChange: (val) => handleVolumeChange([val[0] / 100])
|
|
908
|
+
}
|
|
909
|
+
)
|
|
910
|
+
] }),
|
|
911
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, { className: "my-1" })
|
|
912
|
+
] }),
|
|
913
|
+
/* @__PURE__ */ jsxs("div", { className: "md:hidden", children: [
|
|
914
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: resetAudio, className: "cursor-pointer py-2.5", children: [
|
|
915
|
+
/* @__PURE__ */ jsx(RotateCcw, { className: "w-4 h-4 mr-3 text-muted-foreground" }),
|
|
916
|
+
" ",
|
|
917
|
+
t("media.restart")
|
|
918
|
+
] }),
|
|
919
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, { className: "cursor-pointer py-2.5", children: [
|
|
920
|
+
/* @__PURE__ */ jsx(Info, { className: "w-4 h-4 mr-3 text-muted-foreground" }),
|
|
921
|
+
" ",
|
|
922
|
+
t("media.info")
|
|
923
|
+
] }),
|
|
924
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, { className: "my-1" })
|
|
925
|
+
] }),
|
|
926
|
+
/* @__PURE__ */ jsxs("div", { className: "xl:hidden", children: [
|
|
927
|
+
/* @__PURE__ */ jsxs("div", { className: "px-3 py-2 flex flex-col gap-2", children: [
|
|
928
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
929
|
+
/* @__PURE__ */ jsx(Gauge, { className: "w-4 h-4 text-muted-foreground" }),
|
|
930
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: t("media.speed") })
|
|
931
|
+
] }),
|
|
932
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1", children: [0.5, 1, 1.5, 2].map((speed) => /* @__PURE__ */ jsxs(
|
|
933
|
+
"button",
|
|
934
|
+
{
|
|
935
|
+
onClick: () => setPlaybackSpeed(speed),
|
|
936
|
+
className: cn(
|
|
937
|
+
"px-2 py-0.5 text-[10px] rounded border transition-colors",
|
|
938
|
+
playbackSpeed === speed ? "bg-primary text-primary-foreground border-primary" : "bg-transparent border-border hover:bg-accent"
|
|
939
|
+
),
|
|
940
|
+
children: [
|
|
941
|
+
speed,
|
|
942
|
+
"x"
|
|
943
|
+
]
|
|
944
|
+
},
|
|
945
|
+
speed
|
|
946
|
+
)) })
|
|
947
|
+
] }),
|
|
948
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, { className: "my-1" }),
|
|
949
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, { className: "cursor-pointer py-2.5", children: [
|
|
950
|
+
/* @__PURE__ */ jsx(Download, { className: "w-4 h-4 mr-3 text-muted-foreground" }),
|
|
951
|
+
" ",
|
|
952
|
+
t("media.downloadAudio")
|
|
953
|
+
] })
|
|
954
|
+
] })
|
|
955
|
+
] })
|
|
956
|
+
] }) }),
|
|
957
|
+
/* @__PURE__ */ jsx("div", { className: "w-px h-8 bg-border mx-1" }),
|
|
958
|
+
/* @__PURE__ */ jsx(
|
|
959
|
+
Button,
|
|
960
|
+
{
|
|
961
|
+
onClick: onClose,
|
|
962
|
+
variant: "ghost",
|
|
963
|
+
size: "icon",
|
|
964
|
+
className: "rounded-full h-9 w-9",
|
|
965
|
+
"aria-label": t("media.closePlayer"),
|
|
966
|
+
children: /* @__PURE__ */ jsx(X, { className: "w-5 h-5" })
|
|
967
|
+
}
|
|
968
|
+
)
|
|
969
|
+
] })
|
|
970
|
+
] })
|
|
971
|
+
]
|
|
972
|
+
}
|
|
973
|
+
);
|
|
974
|
+
const mobileLayout = /* @__PURE__ */ jsxs(
|
|
975
|
+
"div",
|
|
976
|
+
{
|
|
977
|
+
className: cn(
|
|
978
|
+
"flex flex-col py-3 px-4 gap-3",
|
|
979
|
+
colorVariant === "primary" && "py-4 px-5 gap-4"
|
|
980
|
+
),
|
|
981
|
+
children: [
|
|
982
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-3", children: [
|
|
983
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col min-w-0 flex-1", children: [
|
|
984
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-1", children: [
|
|
985
|
+
colorVariant === "primary" ? /* @__PURE__ */ jsx("div", { className: "w-2 h-2 rounded-full bg-[var(--chart-4)] animate-pulse shrink-0" }) : /* @__PURE__ */ jsx(Radio, { className: "w-3 h-3 text-[var(--chart-4)] animate-pulse shrink-0" }),
|
|
986
|
+
/* @__PURE__ */ jsx(
|
|
987
|
+
"h4",
|
|
988
|
+
{
|
|
989
|
+
className: cn(
|
|
990
|
+
"truncate",
|
|
991
|
+
colorVariant === "primary" ? "font-semibold text-sm tracking-tight" : "font-medium text-sm"
|
|
992
|
+
),
|
|
993
|
+
children: title
|
|
994
|
+
}
|
|
995
|
+
)
|
|
996
|
+
] }),
|
|
997
|
+
/* @__PURE__ */ jsx(
|
|
998
|
+
"div",
|
|
999
|
+
{
|
|
1000
|
+
className: cn(
|
|
1001
|
+
"flex items-center gap-1.5 text-xs text-muted-foreground",
|
|
1002
|
+
colorVariant === "primary" && "opacity-70"
|
|
1003
|
+
),
|
|
1004
|
+
children: /* @__PURE__ */ jsx("span", { className: "truncate", children: subtitle || artist })
|
|
1005
|
+
}
|
|
1006
|
+
)
|
|
1007
|
+
] }),
|
|
1008
|
+
/* @__PURE__ */ jsx(
|
|
1009
|
+
Button,
|
|
1010
|
+
{
|
|
1011
|
+
onClick: onClose,
|
|
1012
|
+
variant: "ghost",
|
|
1013
|
+
size: "icon",
|
|
1014
|
+
className: "rounded-full h-8 w-8 shrink-0",
|
|
1015
|
+
"aria-label": t("media.closePlayer"),
|
|
1016
|
+
children: /* @__PURE__ */ jsx(X, { className: "w-4 h-4" })
|
|
1017
|
+
}
|
|
1018
|
+
)
|
|
1019
|
+
] }),
|
|
1020
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
1021
|
+
/* @__PURE__ */ jsx(
|
|
1022
|
+
"button",
|
|
1023
|
+
{
|
|
1024
|
+
onClick: togglePlay,
|
|
1025
|
+
"aria-label": isPlaying ? t("media.pause") : t("media.play"),
|
|
1026
|
+
className: "shrink-0 transition-transform active:scale-95",
|
|
1027
|
+
children: isPlaying ? /* @__PURE__ */ jsx(
|
|
1028
|
+
PauseCircle,
|
|
1029
|
+
{
|
|
1030
|
+
className: cn(colorVariant === "primary" ? "w-12 h-12" : "w-10 h-10"),
|
|
1031
|
+
strokeWidth: colorVariant === "primary" ? 1 : 1.5
|
|
1032
|
+
}
|
|
1033
|
+
) : /* @__PURE__ */ jsx(
|
|
1034
|
+
PlayCircle,
|
|
1035
|
+
{
|
|
1036
|
+
className: cn(colorVariant === "primary" ? "w-12 h-12" : "w-10 h-10"),
|
|
1037
|
+
strokeWidth: colorVariant === "primary" ? 1 : 1.5
|
|
1038
|
+
}
|
|
1039
|
+
)
|
|
1040
|
+
}
|
|
1041
|
+
),
|
|
1042
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 flex items-center gap-2", children: /* @__PURE__ */ jsx(
|
|
1043
|
+
Slider,
|
|
1044
|
+
{
|
|
1045
|
+
value: [currentTime],
|
|
1046
|
+
max: duration || 100,
|
|
1047
|
+
onValueChange: handleSeek,
|
|
1048
|
+
className: "cursor-pointer",
|
|
1049
|
+
"aria-label": t("media.playbackProgress")
|
|
1050
|
+
}
|
|
1051
|
+
) }),
|
|
1052
|
+
/* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
1053
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
1054
|
+
Button,
|
|
1055
|
+
{
|
|
1056
|
+
variant: "ghost",
|
|
1057
|
+
size: "icon",
|
|
1058
|
+
className: "h-9 w-9 rounded-full",
|
|
1059
|
+
"aria-label": t("media.moreOptions"),
|
|
1060
|
+
children: /* @__PURE__ */ jsx(MoreVertical, { className: "w-5 h-5" })
|
|
1061
|
+
}
|
|
1062
|
+
) }),
|
|
1063
|
+
/* @__PURE__ */ jsxs(DropdownMenuContent, { align: "end", className: "w-56 p-2 z-[1001]", children: [
|
|
1064
|
+
/* @__PURE__ */ jsx(DropdownMenuItem, { onClick: resetAudio, children: t("media.restart") }),
|
|
1065
|
+
/* @__PURE__ */ jsx(DropdownMenuItem, { children: t("media.speedLabel", { speed: playbackSpeed }) })
|
|
1066
|
+
] })
|
|
1067
|
+
] })
|
|
1068
|
+
] })
|
|
1069
|
+
]
|
|
1070
|
+
}
|
|
1071
|
+
);
|
|
1072
|
+
const desktopLayoutCompact = /* @__PURE__ */ jsxs(
|
|
1073
|
+
"div",
|
|
1074
|
+
{
|
|
1075
|
+
className: cn(
|
|
1076
|
+
"flex items-center gap-3 w-full",
|
|
1077
|
+
isFloating ? "px-3 py-1 text-foreground" : "px-4 py-3"
|
|
1078
|
+
),
|
|
1079
|
+
children: [
|
|
1080
|
+
/* @__PURE__ */ jsx(
|
|
1081
|
+
Button,
|
|
1082
|
+
{
|
|
1083
|
+
onClick: togglePlay,
|
|
1084
|
+
size: "icon",
|
|
1085
|
+
variant: "outline",
|
|
1086
|
+
className: cn(
|
|
1087
|
+
"shrink-0 rounded-full border-border text-foreground hover:bg-accent transition-colors",
|
|
1088
|
+
colorVariant === "primary" && "border-primary-foreground/20 hover:bg-primary-foreground/10 text-primary-foreground",
|
|
1089
|
+
isFloating ? "h-8 w-8" : "h-10 w-10"
|
|
1090
|
+
),
|
|
1091
|
+
"aria-label": isPlaying ? t("media.pause") : t("media.play"),
|
|
1092
|
+
children: isPlaying ? /* @__PURE__ */ jsx(Pause, { className: cn(isFloating ? "w-3 h-3" : "w-4 h-4", "fill-current") }) : /* @__PURE__ */ jsx(Play, { className: cn(isFloating ? "w-3 h-3" : "w-4 h-4", "fill-current ml-0.5") })
|
|
1093
|
+
}
|
|
1094
|
+
),
|
|
1095
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0 flex flex-col justify-center gap-1.5", children: [
|
|
1096
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-xs leading-none", children: [
|
|
1097
|
+
/* @__PURE__ */ jsx(
|
|
1098
|
+
"span",
|
|
1099
|
+
{
|
|
1100
|
+
className: cn(
|
|
1101
|
+
"font-medium truncate",
|
|
1102
|
+
colorVariant === "primary" ? "text-primary-foreground" : "text-foreground"
|
|
1103
|
+
),
|
|
1104
|
+
children: title
|
|
1105
|
+
}
|
|
1106
|
+
),
|
|
1107
|
+
/* @__PURE__ */ jsxs(
|
|
1108
|
+
"span",
|
|
1109
|
+
{
|
|
1110
|
+
className: cn(
|
|
1111
|
+
"font-medium tabular-nums text-[10px] sm:text-xs",
|
|
1112
|
+
colorVariant === "primary" ? "text-primary-foreground/70" : "text-muted-foreground"
|
|
1113
|
+
),
|
|
1114
|
+
children: [
|
|
1115
|
+
formatTime(currentTime),
|
|
1116
|
+
" / ",
|
|
1117
|
+
formatTime(duration)
|
|
1118
|
+
]
|
|
1119
|
+
}
|
|
1120
|
+
)
|
|
1121
|
+
] }),
|
|
1122
|
+
/* @__PURE__ */ jsx(
|
|
1123
|
+
Slider,
|
|
1124
|
+
{
|
|
1125
|
+
value: [currentTime],
|
|
1126
|
+
max: duration || 100,
|
|
1127
|
+
step: 1,
|
|
1128
|
+
onValueChange: handleSeek,
|
|
1129
|
+
className: "w-full",
|
|
1130
|
+
"aria-label": t("media.playbackProgress")
|
|
1131
|
+
}
|
|
1132
|
+
)
|
|
1133
|
+
] }),
|
|
1134
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
1135
|
+
/* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
1136
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
1137
|
+
Button,
|
|
1138
|
+
{
|
|
1139
|
+
variant: "ghost",
|
|
1140
|
+
size: "icon",
|
|
1141
|
+
className: cn(
|
|
1142
|
+
"rounded-full",
|
|
1143
|
+
colorVariant === "primary" ? "text-primary-foreground/80 hover:text-primary-foreground hover:bg-primary-foreground/10" : "text-muted-foreground hover:text-foreground",
|
|
1144
|
+
isFloating ? "h-7 w-7" : "h-8 w-8"
|
|
1145
|
+
),
|
|
1146
|
+
"aria-label": "Mais opções",
|
|
1147
|
+
children: /* @__PURE__ */ jsx(MoreVertical, { className: isFloating ? "w-4 h-4" : "w-5 h-5" })
|
|
1148
|
+
}
|
|
1149
|
+
) }),
|
|
1150
|
+
/* @__PURE__ */ jsxs(DropdownMenuContent, { align: "end", className: "w-56 p-2 z-[1001]", children: [
|
|
1151
|
+
/* @__PURE__ */ jsxs("div", { className: "px-2 py-3", children: [
|
|
1152
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-between mb-3 px-1", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1153
|
+
isMuted || volume === 0 ? /* @__PURE__ */ jsx(VolumeX, { className: "w-4 h-4 text-muted-foreground" }) : /* @__PURE__ */ jsx(Volume2, { className: "w-4 h-4 text-muted-foreground" }),
|
|
1154
|
+
/* @__PURE__ */ jsx("span", { className: "text-[11px] font-medium uppercase tracking-wider text-muted-foreground/70", children: "Volume" })
|
|
1155
|
+
] }) }),
|
|
1156
|
+
/* @__PURE__ */ jsx(
|
|
1157
|
+
Slider,
|
|
1158
|
+
{
|
|
1159
|
+
value: [isMuted ? 0 : volume * 100],
|
|
1160
|
+
max: 100,
|
|
1161
|
+
onValueChange: (val) => handleVolumeChange([val[0] / 100]),
|
|
1162
|
+
"aria-label": "Volume"
|
|
1163
|
+
}
|
|
1164
|
+
)
|
|
1165
|
+
] }),
|
|
1166
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, { className: "my-2" }),
|
|
1167
|
+
/* @__PURE__ */ jsxs("div", { className: "px-2 py-1 flex flex-col gap-2", children: [
|
|
1168
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1169
|
+
/* @__PURE__ */ jsx(Gauge, { className: "w-4 h-4 text-muted-foreground" }),
|
|
1170
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: t("media.speed") })
|
|
1171
|
+
] }),
|
|
1172
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1", children: [0.5, 1, 1.5, 2].map((speed) => /* @__PURE__ */ jsxs(
|
|
1173
|
+
"button",
|
|
1174
|
+
{
|
|
1175
|
+
onClick: () => setPlaybackSpeed(speed),
|
|
1176
|
+
className: cn(
|
|
1177
|
+
"px-2 py-1 text-[10px] rounded border transition-colors",
|
|
1178
|
+
playbackSpeed === speed ? "bg-primary text-primary-foreground border-primary" : "bg-transparent border-border hover:bg-accent"
|
|
1179
|
+
),
|
|
1180
|
+
children: [
|
|
1181
|
+
speed,
|
|
1182
|
+
"x"
|
|
1183
|
+
]
|
|
1184
|
+
},
|
|
1185
|
+
speed
|
|
1186
|
+
)) })
|
|
1187
|
+
] }),
|
|
1188
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, { className: "my-2" }),
|
|
1189
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: resetAudio, className: "cursor-pointer py-2.5", children: [
|
|
1190
|
+
/* @__PURE__ */ jsx(RotateCcw, { className: "w-4 h-4 mr-3 text-muted-foreground" }),
|
|
1191
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm", children: t("media.restart") })
|
|
1192
|
+
] }),
|
|
1193
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, { className: "cursor-pointer py-2.5", children: [
|
|
1194
|
+
/* @__PURE__ */ jsx(Download, { className: "w-4 h-4 mr-3 text-muted-foreground" }),
|
|
1195
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm", children: t("media.downloadFile") })
|
|
1196
|
+
] })
|
|
1197
|
+
] })
|
|
1198
|
+
] }),
|
|
1199
|
+
!isFloating && /* @__PURE__ */ jsx(
|
|
1200
|
+
Button,
|
|
1201
|
+
{
|
|
1202
|
+
variant: "ghost",
|
|
1203
|
+
size: "icon",
|
|
1204
|
+
className: cn(
|
|
1205
|
+
"h-8 w-8",
|
|
1206
|
+
colorVariant === "primary" ? "text-primary-foreground/80 hover:text-primary-foreground hover:bg-primary-foreground/10" : "text-muted-foreground hover:text-foreground"
|
|
1207
|
+
),
|
|
1208
|
+
onClick: handleEnableManualFloat,
|
|
1209
|
+
title: t("media.floatingMode"),
|
|
1210
|
+
"aria-label": t("media.openFloatingMode"),
|
|
1211
|
+
children: /* @__PURE__ */ jsx(Maximize2, { className: "w-4 h-4" })
|
|
1212
|
+
}
|
|
1213
|
+
)
|
|
1214
|
+
] })
|
|
1215
|
+
]
|
|
1216
|
+
}
|
|
1217
|
+
);
|
|
1218
|
+
if (!isVisible) return null;
|
|
1219
|
+
if (variant === "bar" && isVisible && typeof document !== "undefined") {
|
|
1220
|
+
return createPortal(
|
|
1221
|
+
/* @__PURE__ */ jsxs(
|
|
1222
|
+
"div",
|
|
1223
|
+
{
|
|
1224
|
+
className: cn(
|
|
1225
|
+
"fixed bottom-0 z-[100] border-t transition-all duration-300 ease-in-out",
|
|
1226
|
+
colorVariant === "primary" ? "bg-primary/95 text-primary-foreground border-primary/20 backdrop-blur-sm [&_.text-muted-foreground]:text-primary-foreground/70 [&_.text-foreground]:text-primary-foreground [&_button]:text-primary-foreground [&_[data-slot=slider-track]]:bg-primary-foreground/30 [&_[data-slot=slider-range]]:bg-primary-foreground [&_[data-slot=slider-thumb]]:border-primary-foreground [&_[data-slot=slider-thumb]]:bg-primary-foreground" : "bg-card/95 text-card-foreground border-border backdrop-blur-md shadow-[var(--elevation-sm)]",
|
|
1227
|
+
isOpen ? "translate-y-0 opacity-100" : "translate-y-full opacity-0",
|
|
1228
|
+
className
|
|
1229
|
+
),
|
|
1230
|
+
style: {
|
|
1231
|
+
left: isMobile ? 0 : sidebarExpanded ? sidebarWidth : 80,
|
|
1232
|
+
right: isMobile ? 0 : assistenteExpanded ? 420 : 80
|
|
1233
|
+
},
|
|
1234
|
+
children: [
|
|
1235
|
+
audioElement,
|
|
1236
|
+
!isMobile ? desktopLayout : mobileLayout
|
|
1237
|
+
]
|
|
1238
|
+
}
|
|
1239
|
+
),
|
|
1240
|
+
document.body
|
|
1241
|
+
);
|
|
1242
|
+
}
|
|
1243
|
+
return /* @__PURE__ */ jsxs("div", { ref: containerRef, className, children: [
|
|
1244
|
+
audioElement,
|
|
1245
|
+
/* @__PURE__ */ jsx(
|
|
1246
|
+
FloatingMediaWrapper,
|
|
1247
|
+
{
|
|
1248
|
+
isFloating,
|
|
1249
|
+
setIsFloating: handleSetFloating,
|
|
1250
|
+
onClose: () => handleSetFloating(false),
|
|
1251
|
+
onCloseMedia: () => {
|
|
1252
|
+
handleSetFloating(false);
|
|
1253
|
+
},
|
|
1254
|
+
title: t("media.playingMedia"),
|
|
1255
|
+
aspectRatio: 320 / 110,
|
|
1256
|
+
minHeight: 110,
|
|
1257
|
+
minWidth: 320,
|
|
1258
|
+
colorVariant,
|
|
1259
|
+
className: "w-full",
|
|
1260
|
+
playerId: "audio-player",
|
|
1261
|
+
enablePadding: true,
|
|
1262
|
+
children: /* @__PURE__ */ jsx(
|
|
1263
|
+
"div",
|
|
1264
|
+
{
|
|
1265
|
+
className: cn(
|
|
1266
|
+
"w-full overflow-hidden flex flex-col justify-center",
|
|
1267
|
+
colorVariant === "primary" ? "bg-primary text-primary-foreground [&_[data-slot=slider-track]]:bg-white/20 [&_[data-slot=slider-range]]:bg-white [&_[data-slot=slider-thumb]]:border-white [&_[data-slot=slider-thumb]]:bg-white" : "bg-card text-card-foreground",
|
|
1268
|
+
isFloating ? "h-full bg-transparent" : "border rounded-md shadow-sm"
|
|
1269
|
+
),
|
|
1270
|
+
children: desktopLayoutCompact
|
|
1271
|
+
}
|
|
1272
|
+
)
|
|
1273
|
+
}
|
|
1274
|
+
)
|
|
1275
|
+
] });
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
export { AudioPlayer as A, FloatingMediaWrapper as F, VideoPlayer as V };
|