@otfdashkit/ui 0.1.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/LICENSE +21 -0
- package/dist/index.js +14886 -0
- package/dist/index.mjs +14389 -0
- package/package.json +124 -0
- package/src/advanced/BulkActions/BulkActions.stories.tsx +14 -0
- package/src/advanced/BulkActions/BulkActions.test.tsx +9 -0
- package/src/advanced/BulkActions/BulkActions.tsx +46 -0
- package/src/advanced/BulkActions/index.ts +2 -0
- package/src/advanced/CommandBar/CommandBar.stories.tsx +14 -0
- package/src/advanced/CommandBar/CommandBar.test.tsx +9 -0
- package/src/advanced/CommandBar/CommandBar.tsx +115 -0
- package/src/advanced/CommandBar/index.ts +2 -0
- package/src/advanced/Filters/Filters.stories.tsx +14 -0
- package/src/advanced/Filters/Filters.test.tsx +9 -0
- package/src/advanced/Filters/Filters.tsx +103 -0
- package/src/advanced/Filters/index.ts +2 -0
- package/src/advanced/Kanban/Kanban.stories.tsx +14 -0
- package/src/advanced/Kanban/Kanban.test.tsx +9 -0
- package/src/advanced/Kanban/Kanban.tsx +95 -0
- package/src/advanced/Kanban/index.ts +2 -0
- package/src/advanced/ToggleButton/ToggleButton.stories.tsx +14 -0
- package/src/advanced/ToggleButton/ToggleButton.test.tsx +9 -0
- package/src/advanced/ToggleButton/ToggleButton.tsx +78 -0
- package/src/advanced/ToggleButton/index.ts +2 -0
- package/src/advanced/bulk-actions.tsx +46 -0
- package/src/advanced/command-bar.tsx +115 -0
- package/src/advanced/filters.tsx +103 -0
- package/src/advanced/gantt.tsx +824 -0
- package/src/advanced/kanban.tsx +95 -0
- package/src/advanced/rich-editor.tsx +700 -0
- package/src/advanced/toggle-button.tsx +78 -0
- package/src/advanced/utils/cn.ts +1 -0
- package/src/app-shell/AppShell.tsx +24 -0
- package/src/app-shell/BillingStatus.tsx +63 -0
- package/src/app-shell/Sidebar.tsx +172 -0
- package/src/app-shell/SidebarResizer.tsx +109 -0
- package/src/app-shell/SortableNav.tsx +122 -0
- package/src/app-shell/UserMenu.tsx +135 -0
- package/src/app-shell/WorkspacesMenu.tsx +114 -0
- package/src/app-shell/index.ts +18 -0
- package/src/backgrounds/AnimatedGradient.tsx +151 -0
- package/src/backgrounds/DottedBackground.tsx +64 -0
- package/src/backgrounds/GradientBackground.tsx +113 -0
- package/src/backgrounds/HeroShaderA.tsx +255 -0
- package/src/backgrounds/NoiseBackground.tsx +51 -0
- package/src/backgrounds/index.ts +5 -0
- package/src/blocks/ChatDetail/ChatDetail.stories.tsx +14 -0
- package/src/blocks/ChatDetail/ChatDetail.test.tsx +9 -0
- package/src/blocks/ChatDetail/ChatDetail.tsx +73 -0
- package/src/blocks/ChatDetail/index.ts +2 -0
- package/src/blocks/FeedbackModal/FeedbackModal.stories.tsx +14 -0
- package/src/blocks/FeedbackModal/FeedbackModal.test.tsx +9 -0
- package/src/blocks/FeedbackModal/FeedbackModal.tsx +68 -0
- package/src/blocks/FeedbackModal/index.ts +2 -0
- package/src/blocks/FileCards/FileCards.stories.tsx +14 -0
- package/src/blocks/FileCards/FileCards.test.tsx +9 -0
- package/src/blocks/FileCards/FileCards.tsx +56 -0
- package/src/blocks/FileCards/index.ts +2 -0
- package/src/blocks/FilesList/FilesList.stories.tsx +14 -0
- package/src/blocks/FilesList/FilesList.test.tsx +9 -0
- package/src/blocks/FilesList/FilesList.tsx +72 -0
- package/src/blocks/FilesList/index.ts +2 -0
- package/src/blocks/FloatingActionButton/FloatingActionButton.stories.tsx +223 -0
- package/src/blocks/FloatingActionButton/FloatingActionButton.test.tsx +47 -0
- package/src/blocks/FloatingActionButton/FloatingActionButton.tsx +253 -0
- package/src/blocks/FloatingActionButton/index.ts +1 -0
- package/src/blocks/IntegrationCard/IntegrationCard.stories.tsx +14 -0
- package/src/blocks/IntegrationCard/IntegrationCard.test.tsx +9 -0
- package/src/blocks/IntegrationCard/IntegrationCard.tsx +50 -0
- package/src/blocks/IntegrationCard/index.ts +2 -0
- package/src/blocks/InviteModal/InviteModal.stories.tsx +14 -0
- package/src/blocks/InviteModal/InviteModal.test.tsx +9 -0
- package/src/blocks/InviteModal/InviteModal.tsx +69 -0
- package/src/blocks/InviteModal/index.ts +2 -0
- package/src/blocks/ManageTagsModal/ManageTagsModal.stories.tsx +14 -0
- package/src/blocks/ManageTagsModal/ManageTagsModal.test.tsx +9 -0
- package/src/blocks/ManageTagsModal/ManageTagsModal.tsx +63 -0
- package/src/blocks/ManageTagsModal/index.ts +2 -0
- package/src/blocks/MessagesCard/MessagesCard.stories.tsx +14 -0
- package/src/blocks/MessagesCard/MessagesCard.test.tsx +9 -0
- package/src/blocks/MessagesCard/MessagesCard.tsx +59 -0
- package/src/blocks/MessagesCard/index.ts +2 -0
- package/src/blocks/MetricCard/MetricCard.stories.tsx +14 -0
- package/src/blocks/MetricCard/MetricCard.test.tsx +9 -0
- package/src/blocks/MetricCard/MetricCard.tsx +79 -0
- package/src/blocks/MetricCard/index.ts +2 -0
- package/src/blocks/NotificationSettings/NotificationSettings.stories.tsx +14 -0
- package/src/blocks/NotificationSettings/NotificationSettings.test.tsx +9 -0
- package/src/blocks/NotificationSettings/NotificationSettings.tsx +61 -0
- package/src/blocks/NotificationSettings/index.ts +2 -0
- package/src/blocks/OrganizationMenu/OrganizationMenu.stories.tsx +14 -0
- package/src/blocks/OrganizationMenu/OrganizationMenu.test.tsx +9 -0
- package/src/blocks/OrganizationMenu/OrganizationMenu.tsx +66 -0
- package/src/blocks/OrganizationMenu/index.ts +2 -0
- package/src/blocks/RolesMenu/RolesMenu.stories.tsx +14 -0
- package/src/blocks/RolesMenu/RolesMenu.test.tsx +9 -0
- package/src/blocks/RolesMenu/RolesMenu.tsx +61 -0
- package/src/blocks/RolesMenu/index.ts +2 -0
- package/src/blocks/SelectUsersModal/SelectUsersModal.stories.tsx +14 -0
- package/src/blocks/SelectUsersModal/SelectUsersModal.test.tsx +9 -0
- package/src/blocks/SelectUsersModal/SelectUsersModal.tsx +64 -0
- package/src/blocks/SelectUsersModal/index.ts +2 -0
- package/src/blocks/SidebarLayoutDashboard/SidebarLayoutDashboard.stories.tsx +14 -0
- package/src/blocks/SidebarLayoutDashboard/SidebarLayoutDashboard.test.tsx +9 -0
- package/src/blocks/SidebarLayoutDashboard/SidebarLayoutDashboard.tsx +97 -0
- package/src/blocks/SidebarLayoutDashboard/index.ts +2 -0
- package/src/blocks/SidebarLayoutGroups/SidebarLayoutGroups.stories.tsx +14 -0
- package/src/blocks/SidebarLayoutGroups/SidebarLayoutGroups.test.tsx +9 -0
- package/src/blocks/SidebarLayoutGroups/SidebarLayoutGroups.tsx +79 -0
- package/src/blocks/SidebarLayoutGroups/index.ts +2 -0
- package/src/blocks/SidebarLayoutMinimal/SidebarLayoutMinimal.stories.tsx +14 -0
- package/src/blocks/SidebarLayoutMinimal/SidebarLayoutMinimal.test.tsx +9 -0
- package/src/blocks/SidebarLayoutMinimal/SidebarLayoutMinimal.tsx +73 -0
- package/src/blocks/SidebarLayoutMinimal/index.ts +2 -0
- package/src/blocks/SidebarLayoutSearch/SidebarLayoutSearch.stories.tsx +14 -0
- package/src/blocks/SidebarLayoutSearch/SidebarLayoutSearch.test.tsx +9 -0
- package/src/blocks/SidebarLayoutSearch/SidebarLayoutSearch.tsx +79 -0
- package/src/blocks/SidebarLayoutSearch/index.ts +2 -0
- package/src/blocks/SidebarLayoutUser/SidebarLayoutUser.stories.tsx +14 -0
- package/src/blocks/SidebarLayoutUser/SidebarLayoutUser.test.tsx +9 -0
- package/src/blocks/SidebarLayoutUser/SidebarLayoutUser.tsx +82 -0
- package/src/blocks/SidebarLayoutUser/index.ts +2 -0
- package/src/blocks/SortableTaskList/SortableTaskList.stories.tsx +14 -0
- package/src/blocks/SortableTaskList/SortableTaskList.test.tsx +9 -0
- package/src/blocks/SortableTaskList/SortableTaskList.tsx +70 -0
- package/src/blocks/SortableTaskList/index.ts +2 -0
- package/src/blocks/StackedLayoutBranded/StackedLayoutBranded.stories.tsx +14 -0
- package/src/blocks/StackedLayoutBranded/StackedLayoutBranded.test.tsx +9 -0
- package/src/blocks/StackedLayoutBranded/StackedLayoutBranded.tsx +64 -0
- package/src/blocks/StackedLayoutBranded/index.ts +2 -0
- package/src/blocks/StackedLayoutTabs/StackedLayoutTabs.stories.tsx +14 -0
- package/src/blocks/StackedLayoutTabs/StackedLayoutTabs.test.tsx +9 -0
- package/src/blocks/StackedLayoutTabs/StackedLayoutTabs.tsx +80 -0
- package/src/blocks/StackedLayoutTabs/index.ts +2 -0
- package/src/blocks/TaskCard/TaskCard.stories.tsx +14 -0
- package/src/blocks/TaskCard/TaskCard.test.tsx +9 -0
- package/src/blocks/TaskCard/TaskCard.tsx +88 -0
- package/src/blocks/TaskCard/index.ts +2 -0
- package/src/blocks/UserMenu/UserMenu.stories.tsx +14 -0
- package/src/blocks/UserMenu/UserMenu.test.tsx +9 -0
- package/src/blocks/UserMenu/UserMenu.tsx +62 -0
- package/src/blocks/UserMenu/index.ts +2 -0
- package/src/blocks/WorkspaceMembers/WorkspaceMembers.stories.tsx +14 -0
- package/src/blocks/WorkspaceMembers/WorkspaceMembers.test.tsx +9 -0
- package/src/blocks/WorkspaceMembers/WorkspaceMembers.tsx +61 -0
- package/src/blocks/WorkspaceMembers/index.ts +2 -0
- package/src/blocks/activity-heatmap.tsx +122 -0
- package/src/blocks/bar-list.tsx +75 -0
- package/src/blocks/chat-detail.tsx +73 -0
- package/src/blocks/feedback-modal.tsx +68 -0
- package/src/blocks/file-cards.tsx +56 -0
- package/src/blocks/files-list.tsx +72 -0
- package/src/blocks/integration-card.tsx +50 -0
- package/src/blocks/invite-modal.tsx +69 -0
- package/src/blocks/manage-tags-modal.tsx +63 -0
- package/src/blocks/messages-card.tsx +59 -0
- package/src/blocks/metric-card.tsx +79 -0
- package/src/blocks/notification-settings.tsx +61 -0
- package/src/blocks/organization-menu.tsx +85 -0
- package/src/blocks/roles-menu.tsx +61 -0
- package/src/blocks/select-users-modal.tsx +64 -0
- package/src/blocks/sidebar-layout-dashboard.tsx +97 -0
- package/src/blocks/sidebar-layout-groups.tsx +79 -0
- package/src/blocks/sidebar-layout-minimal.tsx +73 -0
- package/src/blocks/sidebar-layout-search.tsx +79 -0
- package/src/blocks/sidebar-layout-user.tsx +82 -0
- package/src/blocks/sortable-task-list.tsx +70 -0
- package/src/blocks/stacked-layout-branded.tsx +64 -0
- package/src/blocks/stacked-layout-tabs.tsx +80 -0
- package/src/blocks/task-card.tsx +88 -0
- package/src/blocks/user-menu.tsx +62 -0
- package/src/blocks/utils/cn.ts +1 -0
- package/src/blocks/workspace-members.tsx +61 -0
- package/src/charts/area-chart.tsx +83 -0
- package/src/charts/bar-chart.tsx +146 -0
- package/src/charts/heatmap.tsx +185 -0
- package/src/charts/line-chart.tsx +89 -0
- package/src/charts/sparkline.tsx +62 -0
- package/src/charts/utils/cn.ts +1 -0
- package/src/components/Banner/Banner.stories.tsx +14 -0
- package/src/components/Banner/Banner.test.tsx +9 -0
- package/src/components/Banner/Banner.tsx +203 -0
- package/src/components/Banner/index.ts +2 -0
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +14 -0
- package/src/components/Breadcrumb/Breadcrumb.test.tsx +9 -0
- package/src/components/Breadcrumb/Breadcrumb.tsx +58 -0
- package/src/components/Breadcrumb/index.ts +2 -0
- package/src/components/CommandItem/CommandItem.stories.tsx +14 -0
- package/src/components/CommandItem/CommandItem.test.tsx +9 -0
- package/src/components/CommandItem/CommandItem.tsx +36 -0
- package/src/components/CommandItem/index.ts +2 -0
- package/src/components/DataGrid/DataGrid.stories.tsx +14 -0
- package/src/components/DataGrid/DataGrid.test.tsx +9 -0
- package/src/components/DataGrid/DataGrid.tsx +125 -0
- package/src/components/DataGrid/index.ts +2 -0
- package/src/components/DataTable/DataTable.stories.tsx +14 -0
- package/src/components/DataTable/DataTable.test.tsx +9 -0
- package/src/components/DataTable/DataTable.tsx +139 -0
- package/src/components/DataTable/index.ts +2 -0
- package/src/components/EmptyState/EmptyState.stories.tsx +14 -0
- package/src/components/EmptyState/EmptyState.test.tsx +9 -0
- package/src/components/EmptyState/EmptyState.tsx +106 -0
- package/src/components/EmptyState/index.ts +2 -0
- package/src/components/Hotkeys/Hotkeys.stories.tsx +14 -0
- package/src/components/Hotkeys/Hotkeys.test.tsx +9 -0
- package/src/components/Hotkeys/Hotkeys.tsx +31 -0
- package/src/components/Hotkeys/index.ts +2 -0
- package/src/components/IconBadge/IconBadge.stories.tsx +14 -0
- package/src/components/IconBadge/IconBadge.test.tsx +9 -0
- package/src/components/IconBadge/IconBadge.tsx +35 -0
- package/src/components/IconBadge/index.ts +2 -0
- package/src/components/LoadingOverlay/LoadingOverlay.stories.tsx +14 -0
- package/src/components/LoadingOverlay/LoadingOverlay.test.tsx +9 -0
- package/src/components/LoadingOverlay/LoadingOverlay.tsx +38 -0
- package/src/components/LoadingOverlay/index.ts +2 -0
- package/src/components/Persona/Persona.stories.tsx +14 -0
- package/src/components/Persona/Persona.test.tsx +9 -0
- package/src/components/Persona/Persona.tsx +38 -0
- package/src/components/Persona/index.ts +2 -0
- package/src/components/PropertyList/PropertyList.stories.tsx +14 -0
- package/src/components/PropertyList/PropertyList.test.tsx +9 -0
- package/src/components/PropertyList/PropertyList.tsx +29 -0
- package/src/components/PropertyList/index.ts +2 -0
- package/src/components/Stat/Stat.stories.tsx +14 -0
- package/src/components/Stat/Stat.test.tsx +9 -0
- package/src/components/Stat/Stat.tsx +51 -0
- package/src/components/Stat/index.ts +2 -0
- package/src/components/Stepper/Stepper.stories.tsx +14 -0
- package/src/components/Stepper/Stepper.test.tsx +9 -0
- package/src/components/Stepper/Stepper.tsx +58 -0
- package/src/components/Stepper/index.ts +2 -0
- package/src/components/StructuredList/StructuredList.stories.tsx +14 -0
- package/src/components/StructuredList/StructuredList.test.tsx +9 -0
- package/src/components/StructuredList/StructuredList.tsx +51 -0
- package/src/components/StructuredList/index.ts +2 -0
- package/src/components/Timeline/Timeline.stories.tsx +14 -0
- package/src/components/Timeline/Timeline.test.tsx +9 -0
- package/src/components/Timeline/Timeline.tsx +69 -0
- package/src/components/Timeline/index.ts +2 -0
- package/src/components/Toaster/Toaster.stories.tsx +14 -0
- package/src/components/Toaster/Toaster.test.tsx +9 -0
- package/src/components/Toaster/Toaster.tsx +42 -0
- package/src/components/Toaster/index.ts +2 -0
- package/src/components/banner.tsx +203 -0
- package/src/components/breadcrumb.tsx +58 -0
- package/src/components/command-item.tsx +36 -0
- package/src/components/data-grid.tsx +125 -0
- package/src/components/data-table.tsx +139 -0
- package/src/components/empty-state.tsx +31 -0
- package/src/components/hotkeys.tsx +31 -0
- package/src/components/icon-badge.tsx +35 -0
- package/src/components/loading-overlay.tsx +38 -0
- package/src/components/persona.tsx +38 -0
- package/src/components/property-list.tsx +29 -0
- package/src/components/stat.tsx +51 -0
- package/src/components/stepper.tsx +69 -0
- package/src/components/structured-list.tsx +51 -0
- package/src/components/timeline.tsx +69 -0
- package/src/components/toaster.tsx +42 -0
- package/src/components/utils/cn.ts +1 -0
- package/src/data/ActionBar.tsx +115 -0
- package/src/data/DataGrid.tsx +453 -0
- package/src/data/DataList.tsx +79 -0
- package/src/data/EventCalendar.tsx +794 -0
- package/src/data/Filters.tsx +271 -0
- package/src/data/GridList.tsx +67 -0
- package/src/data/ImageCrop.tsx +198 -0
- package/src/data/SortableList.tsx +258 -0
- package/src/data/Tree.tsx +510 -0
- package/src/data/VideoPlayer.tsx +564 -0
- package/src/data/index.ts +6 -0
- package/src/engagement/Beacon/Beacon.stories.tsx +14 -0
- package/src/engagement/Beacon/Beacon.test.tsx +9 -0
- package/src/engagement/Beacon/Beacon.tsx +50 -0
- package/src/engagement/Beacon/index.ts +2 -0
- package/src/engagement/Tour/Tour.stories.tsx +14 -0
- package/src/engagement/Tour/Tour.test.tsx +9 -0
- package/src/engagement/Tour/Tour.tsx +106 -0
- package/src/engagement/Tour/index.ts +2 -0
- package/src/engagement/beacon.tsx +50 -0
- package/src/engagement/checklist.tsx +259 -0
- package/src/engagement/intro-disclosure.tsx +210 -0
- package/src/engagement/tour.tsx +106 -0
- package/src/engagement/utils/cn.ts +1 -0
- package/src/feedback/Toaster.tsx +141 -0
- package/src/feedback/index.ts +2 -0
- package/src/feedback/toast-emitter.ts +74 -0
- package/src/forms/ArrayField/ArrayField.stories.tsx +14 -0
- package/src/forms/ArrayField/ArrayField.test.tsx +9 -0
- package/src/forms/ArrayField/ArrayField.tsx +61 -0
- package/src/forms/ArrayField/index.ts +2 -0
- package/src/forms/AutoForm/AutoForm.stories.tsx +14 -0
- package/src/forms/AutoForm/AutoForm.test.tsx +9 -0
- package/src/forms/AutoForm/AutoForm.tsx +133 -0
- package/src/forms/AutoForm/index.ts +2 -0
- package/src/forms/DatePicker/DatePicker.stories.tsx +14 -0
- package/src/forms/DatePicker/DatePicker.test.tsx +9 -0
- package/src/forms/DatePicker/DatePicker.tsx +109 -0
- package/src/forms/DatePicker/index.ts +2 -0
- package/src/forms/Field/Field.stories.tsx +14 -0
- package/src/forms/Field/Field.test.tsx +9 -0
- package/src/forms/Field/Field.tsx +62 -0
- package/src/forms/Field/index.ts +2 -0
- package/src/forms/FileUpload/FileUpload.stories.tsx +14 -0
- package/src/forms/FileUpload/FileUpload.test.tsx +9 -0
- package/src/forms/FileUpload/FileUpload.tsx +101 -0
- package/src/forms/FileUpload/index.ts +2 -0
- package/src/forms/Form/Form.stories.tsx +14 -0
- package/src/forms/Form/Form.test.tsx +9 -0
- package/src/forms/Form/Form.tsx +57 -0
- package/src/forms/Form/index.ts +2 -0
- package/src/forms/ObjectField/ObjectField.stories.tsx +14 -0
- package/src/forms/ObjectField/ObjectField.test.tsx +9 -0
- package/src/forms/ObjectField/ObjectField.tsx +53 -0
- package/src/forms/ObjectField/index.ts +2 -0
- package/src/forms/PasswordInput/PasswordInput.stories.tsx +14 -0
- package/src/forms/PasswordInput/PasswordInput.test.tsx +9 -0
- package/src/forms/PasswordInput/PasswordInput.tsx +54 -0
- package/src/forms/PasswordInput/index.ts +2 -0
- package/src/forms/SearchInput/SearchInput.stories.tsx +14 -0
- package/src/forms/SearchInput/SearchInput.test.tsx +9 -0
- package/src/forms/SearchInput/SearchInput.tsx +64 -0
- package/src/forms/SearchInput/index.ts +2 -0
- package/src/forms/StepForm/StepForm.stories.tsx +14 -0
- package/src/forms/StepForm/StepForm.test.tsx +9 -0
- package/src/forms/StepForm/StepForm.tsx +113 -0
- package/src/forms/StepForm/index.ts +2 -0
- package/src/forms/array-field.tsx +61 -0
- package/src/forms/auto-form.tsx +133 -0
- package/src/forms/color-picker.tsx +258 -0
- package/src/forms/combobox.tsx +106 -0
- package/src/forms/date-picker.tsx +109 -0
- package/src/forms/field.tsx +62 -0
- package/src/forms/file-upload.tsx +101 -0
- package/src/forms/form.tsx +57 -0
- package/src/forms/object-field.tsx +53 -0
- package/src/forms/password-input.tsx +54 -0
- package/src/forms/search-input.tsx +64 -0
- package/src/forms/step-form.tsx +113 -0
- package/src/forms/tags.tsx +270 -0
- package/src/forms/utils/cn.ts +1 -0
- package/src/headers/ScrollHeader.tsx +110 -0
- package/src/headers/index.ts +1 -0
- package/src/index.ts +171 -0
- package/src/layout/PageContainer.tsx +40 -0
- package/src/layout/PageLayout.tsx +55 -0
- package/src/layout/index.ts +2 -0
- package/src/layouts/AppShell/AppShell.stories.tsx +14 -0
- package/src/layouts/AppShell/AppShell.test.tsx +9 -0
- package/src/layouts/AppShell/AppShell.tsx +129 -0
- package/src/layouts/AppShell/index.ts +2 -0
- package/src/layouts/Container/Container.stories.tsx +14 -0
- package/src/layouts/Container/Container.test.tsx +9 -0
- package/src/layouts/Container/Container.tsx +33 -0
- package/src/layouts/Container/index.ts +2 -0
- package/src/layouts/Navbar/Navbar.stories.tsx +14 -0
- package/src/layouts/Navbar/Navbar.test.tsx +9 -0
- package/src/layouts/Navbar/Navbar.tsx +60 -0
- package/src/layouts/Navbar/index.ts +2 -0
- package/src/layouts/Page/Page.stories.tsx +14 -0
- package/src/layouts/Page/Page.test.tsx +9 -0
- package/src/layouts/Page/Page.tsx +61 -0
- package/src/layouts/Page/index.ts +2 -0
- package/src/layouts/ResizeBox/ResizeBox.stories.tsx +14 -0
- package/src/layouts/ResizeBox/ResizeBox.test.tsx +9 -0
- package/src/layouts/ResizeBox/ResizeBox.tsx +45 -0
- package/src/layouts/ResizeBox/index.ts +2 -0
- package/src/layouts/Sidebar/Sidebar.stories.tsx +14 -0
- package/src/layouts/Sidebar/Sidebar.test.tsx +9 -0
- package/src/layouts/Sidebar/Sidebar.tsx +99 -0
- package/src/layouts/Sidebar/index.ts +2 -0
- package/src/layouts/SplitPage/SplitPage.stories.tsx +14 -0
- package/src/layouts/SplitPage/SplitPage.test.tsx +9 -0
- package/src/layouts/SplitPage/SplitPage.tsx +32 -0
- package/src/layouts/SplitPage/index.ts +2 -0
- package/src/layouts/Stack/Stack.stories.tsx +14 -0
- package/src/layouts/Stack/Stack.test.tsx +9 -0
- package/src/layouts/Stack/Stack.tsx +56 -0
- package/src/layouts/Stack/index.ts +2 -0
- package/src/layouts/app-shell.tsx +129 -0
- package/src/layouts/container.tsx +33 -0
- package/src/layouts/navbar.tsx +60 -0
- package/src/layouts/page.tsx +61 -0
- package/src/layouts/resize-box.tsx +45 -0
- package/src/layouts/sidebar.tsx +99 -0
- package/src/layouts/split-page.tsx +32 -0
- package/src/layouts/stack.tsx +56 -0
- package/src/layouts/utils/cn.ts +1 -0
- package/src/motion/FadeIn.tsx +33 -0
- package/src/motion/Morph.tsx +17 -0
- package/src/motion/Parallax.tsx +37 -0
- package/src/motion/Reveal.tsx +32 -0
- package/src/motion/Ripple.tsx +78 -0
- package/src/motion/ScaleIn.tsx +33 -0
- package/src/motion/SlideIn.tsx +42 -0
- package/src/motion/Stagger.tsx +48 -0
- package/src/motion/Transition.tsx +13 -0
- package/src/motion/index.ts +13 -0
- package/src/motion/presets.ts +33 -0
- package/src/motion/useLayoutId.ts +6 -0
- package/src/nav/CommandPalette.tsx +197 -0
- package/src/nav/HotkeysProvider.tsx +223 -0
- package/src/nav/index.ts +2 -0
- package/src/primitives/Accordion/Accordion.stories.tsx +14 -0
- package/src/primitives/Accordion/Accordion.test.tsx +9 -0
- package/src/primitives/Accordion/Accordion.tsx +56 -0
- package/src/primitives/Accordion/index.ts +2 -0
- package/src/primitives/Alert/Alert.stories.tsx +14 -0
- package/src/primitives/Alert/Alert.test.tsx +9 -0
- package/src/primitives/Alert/Alert.tsx +60 -0
- package/src/primitives/Alert/index.ts +2 -0
- package/src/primitives/AlertDialog/AlertDialog.stories.tsx +14 -0
- package/src/primitives/AlertDialog/AlertDialog.test.tsx +9 -0
- package/src/primitives/AlertDialog/AlertDialog.tsx +140 -0
- package/src/primitives/AlertDialog/index.ts +2 -0
- package/src/primitives/AspectRatio/AspectRatio.stories.tsx +14 -0
- package/src/primitives/AspectRatio/AspectRatio.test.tsx +9 -0
- package/src/primitives/AspectRatio/AspectRatio.tsx +6 -0
- package/src/primitives/AspectRatio/index.ts +2 -0
- package/src/primitives/Avatar/Avatar.stories.tsx +14 -0
- package/src/primitives/Avatar/Avatar.test.tsx +9 -0
- package/src/primitives/Avatar/Avatar.tsx +35 -0
- package/src/primitives/Avatar/index.ts +2 -0
- package/src/primitives/Badge/Badge.stories.tsx +14 -0
- package/src/primitives/Badge/Badge.test.tsx +9 -0
- package/src/primitives/Badge/Badge.tsx +28 -0
- package/src/primitives/Badge/index.ts +2 -0
- package/src/primitives/Button/Button.stories.tsx +14 -0
- package/src/primitives/Button/Button.test.tsx +9 -0
- package/src/primitives/Button/Button.tsx +113 -0
- package/src/primitives/Button/index.ts +2 -0
- package/src/primitives/Calendar/Calendar.stories.tsx +14 -0
- package/src/primitives/Calendar/Calendar.test.tsx +9 -0
- package/src/primitives/Calendar/Calendar.tsx +214 -0
- package/src/primitives/Calendar/index.ts +2 -0
- package/src/primitives/Card/Card.stories.tsx +14 -0
- package/src/primitives/Card/Card.test.tsx +9 -0
- package/src/primitives/Card/Card.tsx +48 -0
- package/src/primitives/Card/TextureCard.tsx +93 -0
- package/src/primitives/Card/index.ts +3 -0
- package/src/primitives/Carousel/Carousel.stories.tsx +14 -0
- package/src/primitives/Carousel/Carousel.test.tsx +9 -0
- package/src/primitives/Carousel/Carousel.tsx +261 -0
- package/src/primitives/Carousel/index.ts +2 -0
- package/src/primitives/Chart/Chart.stories.tsx +14 -0
- package/src/primitives/Chart/Chart.test.tsx +9 -0
- package/src/primitives/Chart/Chart.tsx +368 -0
- package/src/primitives/Chart/index.ts +2 -0
- package/src/primitives/Checkbox/Checkbox.stories.tsx +14 -0
- package/src/primitives/Checkbox/Checkbox.test.tsx +9 -0
- package/src/primitives/Checkbox/Checkbox.tsx +27 -0
- package/src/primitives/Checkbox/index.ts +2 -0
- package/src/primitives/Collapsible/Collapsible.stories.tsx +14 -0
- package/src/primitives/Collapsible/Collapsible.test.tsx +9 -0
- package/src/primitives/Collapsible/Collapsible.tsx +12 -0
- package/src/primitives/Collapsible/index.ts +2 -0
- package/src/primitives/Command/Command.stories.tsx +14 -0
- package/src/primitives/Command/Command.test.tsx +9 -0
- package/src/primitives/Command/Command.tsx +154 -0
- package/src/primitives/Command/index.ts +2 -0
- package/src/primitives/ContextMenu/ContextMenu.stories.tsx +14 -0
- package/src/primitives/ContextMenu/ContextMenu.test.tsx +9 -0
- package/src/primitives/ContextMenu/ContextMenu.tsx +101 -0
- package/src/primitives/ContextMenu/index.ts +2 -0
- package/src/primitives/Dialog/Dialog.stories.tsx +14 -0
- package/src/primitives/Dialog/Dialog.test.tsx +9 -0
- package/src/primitives/Dialog/Dialog.tsx +88 -0
- package/src/primitives/Dialog/DialogProvider.tsx +130 -0
- package/src/primitives/Dialog/index.ts +3 -0
- package/src/primitives/Drawer/Drawer.stories.tsx +14 -0
- package/src/primitives/Drawer/Drawer.test.tsx +9 -0
- package/src/primitives/Drawer/Drawer.tsx +123 -0
- package/src/primitives/Drawer/index.ts +2 -0
- package/src/primitives/DropdownMenu/DropdownMenu.stories.tsx +14 -0
- package/src/primitives/DropdownMenu/DropdownMenu.test.tsx +9 -0
- package/src/primitives/DropdownMenu/DropdownMenu.tsx +111 -0
- package/src/primitives/DropdownMenu/index.ts +2 -0
- package/src/primitives/Form/Form.stories.tsx +14 -0
- package/src/primitives/Form/Form.test.tsx +9 -0
- package/src/primitives/Form/Form.tsx +179 -0
- package/src/primitives/Form/index.ts +2 -0
- package/src/primitives/HoverCard/HoverCard.stories.tsx +14 -0
- package/src/primitives/HoverCard/HoverCard.test.tsx +9 -0
- package/src/primitives/HoverCard/HoverCard.tsx +31 -0
- package/src/primitives/HoverCard/index.ts +2 -0
- package/src/primitives/Input/Input.stories.tsx +14 -0
- package/src/primitives/Input/Input.test.tsx +9 -0
- package/src/primitives/Input/Input.tsx +110 -0
- package/src/primitives/Input/index.ts +2 -0
- package/src/primitives/InputOtp/InputOtp.stories.tsx +14 -0
- package/src/primitives/InputOtp/InputOtp.test.tsx +9 -0
- package/src/primitives/InputOtp/InputOtp.tsx +70 -0
- package/src/primitives/InputOtp/index.ts +2 -0
- package/src/primitives/Label/Label.stories.tsx +14 -0
- package/src/primitives/Label/Label.test.tsx +9 -0
- package/src/primitives/Label/Label.tsx +27 -0
- package/src/primitives/Label/index.ts +2 -0
- package/src/primitives/Menubar/Menubar.stories.tsx +14 -0
- package/src/primitives/Menubar/Menubar.test.tsx +9 -0
- package/src/primitives/Menubar/Menubar.tsx +255 -0
- package/src/primitives/Menubar/index.ts +2 -0
- package/src/primitives/NavigationMenu/NavigationMenu.stories.tsx +14 -0
- package/src/primitives/NavigationMenu/NavigationMenu.test.tsx +9 -0
- package/src/primitives/NavigationMenu/NavigationMenu.tsx +129 -0
- package/src/primitives/NavigationMenu/index.ts +2 -0
- package/src/primitives/Pagination/Pagination.stories.tsx +14 -0
- package/src/primitives/Pagination/Pagination.test.tsx +9 -0
- package/src/primitives/Pagination/Pagination.tsx +118 -0
- package/src/primitives/Pagination/index.ts +2 -0
- package/src/primitives/Popover/Popover.stories.tsx +14 -0
- package/src/primitives/Popover/Popover.test.tsx +9 -0
- package/src/primitives/Popover/Popover.tsx +30 -0
- package/src/primitives/Popover/index.ts +2 -0
- package/src/primitives/Progress/Progress.stories.tsx +14 -0
- package/src/primitives/Progress/Progress.test.tsx +9 -0
- package/src/primitives/Progress/Progress.tsx +20 -0
- package/src/primitives/Progress/index.ts +2 -0
- package/src/primitives/Radio/Radio.stories.tsx +14 -0
- package/src/primitives/Radio/Radio.test.tsx +9 -0
- package/src/primitives/Radio/Radio.tsx +33 -0
- package/src/primitives/Radio/index.ts +2 -0
- package/src/primitives/Resizable/Resizable.stories.tsx +14 -0
- package/src/primitives/Resizable/Resizable.test.tsx +9 -0
- package/src/primitives/Resizable/Resizable.tsx +44 -0
- package/src/primitives/Resizable/index.ts +2 -0
- package/src/primitives/ScrollArea/ScrollArea.stories.tsx +14 -0
- package/src/primitives/ScrollArea/ScrollArea.test.tsx +9 -0
- package/src/primitives/ScrollArea/ScrollArea.tsx +49 -0
- package/src/primitives/ScrollArea/index.ts +2 -0
- package/src/primitives/Select/Select.stories.tsx +14 -0
- package/src/primitives/Select/Select.test.tsx +9 -0
- package/src/primitives/Select/Select.tsx +140 -0
- package/src/primitives/Select/index.ts +2 -0
- package/src/primitives/Separator/Separator.stories.tsx +14 -0
- package/src/primitives/Separator/Separator.test.tsx +9 -0
- package/src/primitives/Separator/Separator.tsx +21 -0
- package/src/primitives/Separator/index.ts +2 -0
- package/src/primitives/Sheet/Sheet.stories.tsx +14 -0
- package/src/primitives/Sheet/Sheet.test.tsx +9 -0
- package/src/primitives/Sheet/Sheet.tsx +88 -0
- package/src/primitives/Sheet/index.ts +2 -0
- package/src/primitives/Skeleton/Skeleton.stories.tsx +14 -0
- package/src/primitives/Skeleton/Skeleton.test.tsx +9 -0
- package/src/primitives/Skeleton/Skeleton.tsx +71 -0
- package/src/primitives/Skeleton/index.ts +2 -0
- package/src/primitives/Slider/Slider.stories.tsx +14 -0
- package/src/primitives/Slider/Slider.test.tsx +9 -0
- package/src/primitives/Slider/Slider.tsx +20 -0
- package/src/primitives/Slider/index.ts +2 -0
- package/src/primitives/Sonner/Sonner.stories.tsx +14 -0
- package/src/primitives/Sonner/Sonner.test.tsx +9 -0
- package/src/primitives/Sonner/Sonner.tsx +30 -0
- package/src/primitives/Sonner/index.ts +2 -0
- package/src/primitives/Spinner/Spinner.stories.tsx +14 -0
- package/src/primitives/Spinner/Spinner.test.tsx +9 -0
- package/src/primitives/Spinner/Spinner.tsx +17 -0
- package/src/primitives/Spinner/index.ts +2 -0
- package/src/primitives/Switch/Switch.stories.tsx +14 -0
- package/src/primitives/Switch/Switch.test.tsx +9 -0
- package/src/primitives/Switch/Switch.tsx +31 -0
- package/src/primitives/Switch/index.ts +2 -0
- package/src/primitives/Table/Table.stories.tsx +14 -0
- package/src/primitives/Table/Table.test.tsx +9 -0
- package/src/primitives/Table/Table.tsx +121 -0
- package/src/primitives/Table/index.ts +2 -0
- package/src/primitives/Tabs/Tabs.stories.tsx +14 -0
- package/src/primitives/Tabs/Tabs.test.tsx +9 -0
- package/src/primitives/Tabs/Tabs.tsx +53 -0
- package/src/primitives/Tabs/index.ts +2 -0
- package/src/primitives/Textarea/Textarea.stories.tsx +14 -0
- package/src/primitives/Textarea/Textarea.test.tsx +9 -0
- package/src/primitives/Textarea/Textarea.tsx +22 -0
- package/src/primitives/Textarea/index.ts +2 -0
- package/src/primitives/Toggle/Toggle.stories.tsx +14 -0
- package/src/primitives/Toggle/Toggle.test.tsx +9 -0
- package/src/primitives/Toggle/Toggle.tsx +44 -0
- package/src/primitives/Toggle/index.ts +2 -0
- package/src/primitives/ToggleGroup/ToggleGroup.stories.tsx +14 -0
- package/src/primitives/ToggleGroup/ToggleGroup.test.tsx +9 -0
- package/src/primitives/ToggleGroup/ToggleGroup.tsx +62 -0
- package/src/primitives/ToggleGroup/index.ts +2 -0
- package/src/primitives/Tooltip/Tooltip.stories.tsx +14 -0
- package/src/primitives/Tooltip/Tooltip.test.tsx +9 -0
- package/src/primitives/Tooltip/Tooltip.tsx +29 -0
- package/src/primitives/Tooltip/index.ts +2 -0
- package/src/primitives/accordion.tsx +56 -0
- package/src/primitives/alert-dialog.tsx +140 -0
- package/src/primitives/alert.tsx +60 -0
- package/src/primitives/aspect-ratio.tsx +6 -0
- package/src/primitives/avatar.tsx +100 -0
- package/src/primitives/badge.tsx +28 -0
- package/src/primitives/button.tsx +43 -0
- package/src/primitives/calendar.tsx +214 -0
- package/src/primitives/card.tsx +48 -0
- package/src/primitives/carousel.tsx +261 -0
- package/src/primitives/chart.tsx +368 -0
- package/src/primitives/checkbox.tsx +26 -0
- package/src/primitives/code-block.tsx +173 -0
- package/src/primitives/collapsible.tsx +12 -0
- package/src/primitives/command.tsx +154 -0
- package/src/primitives/comparison.tsx +184 -0
- package/src/primitives/context-menu.tsx +101 -0
- package/src/primitives/dialog.tsx +88 -0
- package/src/primitives/drawer.tsx +117 -0
- package/src/primitives/dropdown-menu.tsx +111 -0
- package/src/primitives/form.tsx +179 -0
- package/src/primitives/hover-card.tsx +30 -0
- package/src/primitives/input-otp.tsx +70 -0
- package/src/primitives/input.tsx +23 -0
- package/src/primitives/label.tsx +27 -0
- package/src/primitives/logo-carousel.tsx +110 -0
- package/src/primitives/marquee.tsx +84 -0
- package/src/primitives/menubar.tsx +255 -0
- package/src/primitives/navigation-menu.tsx +129 -0
- package/src/primitives/pagination.tsx +118 -0
- package/src/primitives/popover.tsx +29 -0
- package/src/primitives/progress.tsx +20 -0
- package/src/primitives/qr-code.tsx +89 -0
- package/src/primitives/radio.tsx +33 -0
- package/src/primitives/rating.tsx +157 -0
- package/src/primitives/resizable.tsx +43 -0
- package/src/primitives/scroll-area.tsx +49 -0
- package/src/primitives/select.tsx +137 -0
- package/src/primitives/separator.tsx +21 -0
- package/src/primitives/sheet.tsx +87 -0
- package/src/primitives/skeleton.tsx +11 -0
- package/src/primitives/slider.tsx +20 -0
- package/src/primitives/sonner.tsx +27 -0
- package/src/primitives/spinner.tsx +17 -0
- package/src/primitives/switch.tsx +30 -0
- package/src/primitives/table.tsx +121 -0
- package/src/primitives/tabs.tsx +53 -0
- package/src/primitives/textarea.tsx +22 -0
- package/src/primitives/texture-card.tsx +52 -0
- package/src/primitives/toggle-group.tsx +62 -0
- package/src/primitives/toggle.tsx +44 -0
- package/src/primitives/tooltip.tsx +28 -0
- package/src/primitives/utils/cn.ts +1 -0
- package/src/provider/otf-ui-provider.tsx +66 -0
- package/src/styles.css +6 -0
- package/src/text/AnimatedNumber.tsx +157 -0
- package/src/text/Body.tsx +47 -0
- package/src/text/Caption.tsx +32 -0
- package/src/text/Code.tsx +43 -0
- package/src/text/GradientHeading.tsx +90 -0
- package/src/text/Heading.tsx +44 -0
- package/src/text/TextReveal.tsx +96 -0
- package/src/text/Typewriter.tsx +107 -0
- package/src/text/index.ts +8 -0
- package/src/theme/ColorSchemeSelect.tsx +74 -0
- package/src/theme/ThemeSwitch.tsx +116 -0
- package/src/theme/index.ts +2 -0
- package/src/themes/base.css +25 -0
- package/src/themes/glass.css +142 -0
- package/src/themes/linear.css +123 -0
- package/src/themes/midnight.css +131 -0
- package/src/themes/minimal.css +121 -0
- package/src/utils/cn.ts +6 -0
|
@@ -0,0 +1,564 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import React from 'react'
|
|
4
|
+
import {
|
|
5
|
+
Play,
|
|
6
|
+
Pause,
|
|
7
|
+
Volume2,
|
|
8
|
+
VolumeX,
|
|
9
|
+
Volume1,
|
|
10
|
+
Maximize,
|
|
11
|
+
Minimize,
|
|
12
|
+
Layers,
|
|
13
|
+
} from 'lucide-react'
|
|
14
|
+
import { Button } from '../primitives/button'
|
|
15
|
+
import { Slider } from '../primitives/slider'
|
|
16
|
+
import { Popover, PopoverContent, PopoverTrigger } from '../primitives/popover'
|
|
17
|
+
import {
|
|
18
|
+
Tooltip,
|
|
19
|
+
TooltipContent,
|
|
20
|
+
TooltipProvider,
|
|
21
|
+
TooltipTrigger,
|
|
22
|
+
} from '../primitives/tooltip'
|
|
23
|
+
import { cn } from '../utils/cn'
|
|
24
|
+
|
|
25
|
+
// ── Types ────────────────────────────────────────────────────────
|
|
26
|
+
|
|
27
|
+
export type VideoChapter = {
|
|
28
|
+
/** Chapter start time in seconds. */
|
|
29
|
+
time: number
|
|
30
|
+
title: string
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type VideoPlayerProps = Omit<
|
|
34
|
+
React.VideoHTMLAttributes<HTMLVideoElement>,
|
|
35
|
+
'controls'
|
|
36
|
+
> & {
|
|
37
|
+
src: string
|
|
38
|
+
poster?: string
|
|
39
|
+
/** Optional chapter markers + dropdown list. */
|
|
40
|
+
chapters?: VideoChapter[]
|
|
41
|
+
/** Default true. False hides the bottom control bar (hero loops). */
|
|
42
|
+
controls?: boolean
|
|
43
|
+
onPlay?: () => void
|
|
44
|
+
onPause?: () => void
|
|
45
|
+
onTimeUpdate?: (time: number, duration: number) => void
|
|
46
|
+
onEnded?: () => void
|
|
47
|
+
className?: string
|
|
48
|
+
/** Wrapper class — override the default `aspect-video`. */
|
|
49
|
+
containerClassName?: string
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// ── Helpers ──────────────────────────────────────────────────────
|
|
53
|
+
|
|
54
|
+
function formatTime(seconds: number, showHours: boolean): string {
|
|
55
|
+
if (!Number.isFinite(seconds) || seconds < 0) seconds = 0
|
|
56
|
+
const h = Math.floor(seconds / 3600)
|
|
57
|
+
const m = Math.floor((seconds % 3600) / 60)
|
|
58
|
+
const s = Math.floor(seconds % 60)
|
|
59
|
+
const pad = (n: number) => n.toString().padStart(2, '0')
|
|
60
|
+
if (showHours) return `${h}:${pad(m)}:${pad(s)}`
|
|
61
|
+
return `${m}:${pad(s)}`
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function isFullscreenActive(): boolean {
|
|
65
|
+
return Boolean(
|
|
66
|
+
document.fullscreenElement ||
|
|
67
|
+
// Safari / older WebKit
|
|
68
|
+
(document as unknown as { webkitFullscreenElement?: Element })
|
|
69
|
+
.webkitFullscreenElement,
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async function requestFs(el: HTMLElement): Promise<void> {
|
|
74
|
+
type FsEl = HTMLElement & {
|
|
75
|
+
webkitRequestFullscreen?: () => Promise<void> | void
|
|
76
|
+
webkitEnterFullscreen?: () => Promise<void> | void
|
|
77
|
+
}
|
|
78
|
+
const e = el as FsEl
|
|
79
|
+
if (e.requestFullscreen) return void e.requestFullscreen()
|
|
80
|
+
if (e.webkitRequestFullscreen) return void e.webkitRequestFullscreen()
|
|
81
|
+
if (e.webkitEnterFullscreen) return void e.webkitEnterFullscreen()
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async function exitFs(): Promise<void> {
|
|
85
|
+
type FsDoc = Document & {
|
|
86
|
+
webkitExitFullscreen?: () => Promise<void> | void
|
|
87
|
+
}
|
|
88
|
+
const d = document as FsDoc
|
|
89
|
+
if (d.exitFullscreen) return void d.exitFullscreen()
|
|
90
|
+
if (d.webkitExitFullscreen) return void d.webkitExitFullscreen()
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// ── Component ────────────────────────────────────────────────────
|
|
94
|
+
|
|
95
|
+
export const VideoPlayer = React.forwardRef<HTMLDivElement, VideoPlayerProps>(
|
|
96
|
+
(
|
|
97
|
+
{
|
|
98
|
+
src,
|
|
99
|
+
poster,
|
|
100
|
+
chapters,
|
|
101
|
+
controls: controlsEnabled = true,
|
|
102
|
+
onPlay,
|
|
103
|
+
onPause,
|
|
104
|
+
onTimeUpdate,
|
|
105
|
+
onEnded,
|
|
106
|
+
className,
|
|
107
|
+
containerClassName,
|
|
108
|
+
autoPlay,
|
|
109
|
+
loop,
|
|
110
|
+
muted: mutedProp,
|
|
111
|
+
...videoProps
|
|
112
|
+
},
|
|
113
|
+
ref,
|
|
114
|
+
) => {
|
|
115
|
+
const containerRef = React.useRef<HTMLDivElement>(null)
|
|
116
|
+
const videoRef = React.useRef<HTMLVideoElement>(null)
|
|
117
|
+
const hideTimerRef = React.useRef<ReturnType<typeof setTimeout> | null>(null)
|
|
118
|
+
|
|
119
|
+
const [isPlaying, setIsPlaying] = React.useState(false)
|
|
120
|
+
const [hasPlayed, setHasPlayed] = React.useState(Boolean(autoPlay))
|
|
121
|
+
const [currentTime, setCurrentTime] = React.useState(0)
|
|
122
|
+
const [duration, setDuration] = React.useState(0)
|
|
123
|
+
const [buffered, setBuffered] = React.useState(0)
|
|
124
|
+
const [volume, setVolume] = React.useState(1)
|
|
125
|
+
const [isMuted, setIsMuted] = React.useState(Boolean(mutedProp ?? autoPlay))
|
|
126
|
+
const [isFullscreen, setIsFullscreen] = React.useState(false)
|
|
127
|
+
const [showControls, setShowControls] = React.useState(true)
|
|
128
|
+
|
|
129
|
+
// Forward inner container ref to outer ref.
|
|
130
|
+
React.useImperativeHandle(ref, () => containerRef.current as HTMLDivElement)
|
|
131
|
+
|
|
132
|
+
// Sync video element state.
|
|
133
|
+
React.useEffect(() => {
|
|
134
|
+
const v = videoRef.current
|
|
135
|
+
if (!v) return
|
|
136
|
+
v.volume = volume
|
|
137
|
+
v.muted = isMuted
|
|
138
|
+
}, [volume, isMuted])
|
|
139
|
+
|
|
140
|
+
// Auto-hide controls during playback.
|
|
141
|
+
const showAndScheduleHide = React.useCallback(() => {
|
|
142
|
+
setShowControls(true)
|
|
143
|
+
if (hideTimerRef.current) clearTimeout(hideTimerRef.current)
|
|
144
|
+
if (isPlaying) {
|
|
145
|
+
hideTimerRef.current = setTimeout(() => setShowControls(false), 3000)
|
|
146
|
+
}
|
|
147
|
+
}, [isPlaying])
|
|
148
|
+
|
|
149
|
+
React.useEffect(() => {
|
|
150
|
+
if (!isPlaying) {
|
|
151
|
+
if (hideTimerRef.current) clearTimeout(hideTimerRef.current)
|
|
152
|
+
setShowControls(true)
|
|
153
|
+
return
|
|
154
|
+
}
|
|
155
|
+
hideTimerRef.current = setTimeout(() => setShowControls(false), 3000)
|
|
156
|
+
return () => {
|
|
157
|
+
if (hideTimerRef.current) clearTimeout(hideTimerRef.current)
|
|
158
|
+
}
|
|
159
|
+
}, [isPlaying])
|
|
160
|
+
|
|
161
|
+
// Fullscreen change listeners (Fullscreen API + WebKit prefix).
|
|
162
|
+
React.useEffect(() => {
|
|
163
|
+
const onFsChange = () => setIsFullscreen(isFullscreenActive())
|
|
164
|
+
document.addEventListener('fullscreenchange', onFsChange)
|
|
165
|
+
document.addEventListener('webkitfullscreenchange', onFsChange)
|
|
166
|
+
return () => {
|
|
167
|
+
document.removeEventListener('fullscreenchange', onFsChange)
|
|
168
|
+
document.removeEventListener('webkitfullscreenchange', onFsChange)
|
|
169
|
+
}
|
|
170
|
+
}, [])
|
|
171
|
+
|
|
172
|
+
// ── Actions ──
|
|
173
|
+
|
|
174
|
+
const togglePlay = React.useCallback(() => {
|
|
175
|
+
const v = videoRef.current
|
|
176
|
+
if (!v) return
|
|
177
|
+
if (v.paused) {
|
|
178
|
+
void v.play()
|
|
179
|
+
} else {
|
|
180
|
+
v.pause()
|
|
181
|
+
}
|
|
182
|
+
}, [])
|
|
183
|
+
|
|
184
|
+
const toggleMute = React.useCallback(() => {
|
|
185
|
+
setIsMuted((m) => !m)
|
|
186
|
+
}, [])
|
|
187
|
+
|
|
188
|
+
const toggleFullscreen = React.useCallback(() => {
|
|
189
|
+
const el = containerRef.current
|
|
190
|
+
if (!el) return
|
|
191
|
+
if (isFullscreenActive()) void exitFs()
|
|
192
|
+
else void requestFs(el)
|
|
193
|
+
}, [])
|
|
194
|
+
|
|
195
|
+
const seekTo = React.useCallback((time: number) => {
|
|
196
|
+
const v = videoRef.current
|
|
197
|
+
if (!v) return
|
|
198
|
+
const clamped = Math.max(0, Math.min(v.duration || 0, time))
|
|
199
|
+
v.currentTime = clamped
|
|
200
|
+
}, [])
|
|
201
|
+
|
|
202
|
+
const seekBy = React.useCallback(
|
|
203
|
+
(delta: number) => {
|
|
204
|
+
seekTo((videoRef.current?.currentTime ?? 0) + delta)
|
|
205
|
+
},
|
|
206
|
+
[seekTo],
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
// ── Video event handlers ──
|
|
210
|
+
|
|
211
|
+
const handlePlay = () => {
|
|
212
|
+
setIsPlaying(true)
|
|
213
|
+
setHasPlayed(true)
|
|
214
|
+
onPlay?.()
|
|
215
|
+
}
|
|
216
|
+
const handlePause = () => {
|
|
217
|
+
setIsPlaying(false)
|
|
218
|
+
onPause?.()
|
|
219
|
+
}
|
|
220
|
+
const handleTimeUpdate = () => {
|
|
221
|
+
const v = videoRef.current
|
|
222
|
+
if (!v) return
|
|
223
|
+
setCurrentTime(v.currentTime)
|
|
224
|
+
onTimeUpdate?.(v.currentTime, v.duration || 0)
|
|
225
|
+
}
|
|
226
|
+
const handleLoadedMetadata = () => {
|
|
227
|
+
const v = videoRef.current
|
|
228
|
+
if (!v) return
|
|
229
|
+
setDuration(v.duration || 0)
|
|
230
|
+
}
|
|
231
|
+
const handleProgress = () => {
|
|
232
|
+
const v = videoRef.current
|
|
233
|
+
if (!v || v.buffered.length === 0) return
|
|
234
|
+
setBuffered(v.buffered.end(v.buffered.length - 1))
|
|
235
|
+
}
|
|
236
|
+
const handleEnded = () => {
|
|
237
|
+
setIsPlaying(false)
|
|
238
|
+
onEnded?.()
|
|
239
|
+
}
|
|
240
|
+
const handleVolumeChange = () => {
|
|
241
|
+
const v = videoRef.current
|
|
242
|
+
if (!v) return
|
|
243
|
+
setVolume(v.volume)
|
|
244
|
+
setIsMuted(v.muted)
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// ── Keyboard ──
|
|
248
|
+
|
|
249
|
+
const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {
|
|
250
|
+
// Numbers 0-9 → seek 0%-90%.
|
|
251
|
+
if (/^[0-9]$/.test(e.key)) {
|
|
252
|
+
const v = videoRef.current
|
|
253
|
+
if (v && v.duration) {
|
|
254
|
+
seekTo((parseInt(e.key, 10) / 10) * v.duration)
|
|
255
|
+
e.preventDefault()
|
|
256
|
+
}
|
|
257
|
+
return
|
|
258
|
+
}
|
|
259
|
+
switch (e.key) {
|
|
260
|
+
case ' ':
|
|
261
|
+
case 'Spacebar':
|
|
262
|
+
togglePlay()
|
|
263
|
+
e.preventDefault()
|
|
264
|
+
break
|
|
265
|
+
case 'ArrowLeft':
|
|
266
|
+
seekBy(-5)
|
|
267
|
+
e.preventDefault()
|
|
268
|
+
break
|
|
269
|
+
case 'ArrowRight':
|
|
270
|
+
seekBy(5)
|
|
271
|
+
e.preventDefault()
|
|
272
|
+
break
|
|
273
|
+
case 'ArrowUp':
|
|
274
|
+
setVolume((vol) => Math.min(1, vol + 0.1))
|
|
275
|
+
setIsMuted(false)
|
|
276
|
+
e.preventDefault()
|
|
277
|
+
break
|
|
278
|
+
case 'ArrowDown':
|
|
279
|
+
setVolume((vol) => Math.max(0, vol - 0.1))
|
|
280
|
+
e.preventDefault()
|
|
281
|
+
break
|
|
282
|
+
case 'f':
|
|
283
|
+
case 'F':
|
|
284
|
+
toggleFullscreen()
|
|
285
|
+
e.preventDefault()
|
|
286
|
+
break
|
|
287
|
+
case 'm':
|
|
288
|
+
case 'M':
|
|
289
|
+
toggleMute()
|
|
290
|
+
e.preventDefault()
|
|
291
|
+
break
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// ── Derived ──
|
|
296
|
+
|
|
297
|
+
const showHours = duration >= 3600
|
|
298
|
+
const progressPct = duration > 0 ? (currentTime / duration) * 100 : 0
|
|
299
|
+
const bufferedPct = duration > 0 ? (buffered / duration) * 100 : 0
|
|
300
|
+
const VolumeIcon = isMuted || volume === 0 ? VolumeX : volume < 0.5 ? Volume1 : Volume2
|
|
301
|
+
|
|
302
|
+
return (
|
|
303
|
+
<TooltipProvider delayDuration={150}>
|
|
304
|
+
<div
|
|
305
|
+
ref={containerRef}
|
|
306
|
+
role="region"
|
|
307
|
+
aria-label="Video player"
|
|
308
|
+
tabIndex={0}
|
|
309
|
+
onKeyDown={handleKeyDown}
|
|
310
|
+
onMouseMove={showAndScheduleHide}
|
|
311
|
+
onFocus={showAndScheduleHide}
|
|
312
|
+
className={cn(
|
|
313
|
+
'group relative isolate select-none overflow-hidden rounded-lg bg-black outline-none',
|
|
314
|
+
'focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
|
|
315
|
+
'aspect-video',
|
|
316
|
+
containerClassName,
|
|
317
|
+
)}
|
|
318
|
+
>
|
|
319
|
+
<video
|
|
320
|
+
ref={videoRef}
|
|
321
|
+
src={src}
|
|
322
|
+
poster={poster}
|
|
323
|
+
autoPlay={autoPlay}
|
|
324
|
+
loop={loop}
|
|
325
|
+
muted={isMuted}
|
|
326
|
+
preload="metadata"
|
|
327
|
+
onClick={togglePlay}
|
|
328
|
+
onPlay={handlePlay}
|
|
329
|
+
onPause={handlePause}
|
|
330
|
+
onTimeUpdate={handleTimeUpdate}
|
|
331
|
+
onLoadedMetadata={handleLoadedMetadata}
|
|
332
|
+
onDurationChange={handleLoadedMetadata}
|
|
333
|
+
onCanPlay={handleLoadedMetadata}
|
|
334
|
+
onProgress={handleProgress}
|
|
335
|
+
onEnded={handleEnded}
|
|
336
|
+
onVolumeChange={handleVolumeChange}
|
|
337
|
+
playsInline
|
|
338
|
+
className={cn(
|
|
339
|
+
'block h-full w-full cursor-pointer object-cover',
|
|
340
|
+
className,
|
|
341
|
+
)}
|
|
342
|
+
{...videoProps}
|
|
343
|
+
/>
|
|
344
|
+
|
|
345
|
+
{/* Big center play button before first play (only when controls enabled). */}
|
|
346
|
+
{controlsEnabled && !hasPlayed && (
|
|
347
|
+
<button
|
|
348
|
+
type="button"
|
|
349
|
+
onClick={togglePlay}
|
|
350
|
+
aria-label="Play"
|
|
351
|
+
className={cn(
|
|
352
|
+
'absolute inset-0 flex items-center justify-center',
|
|
353
|
+
'bg-black/20 transition-colors hover:bg-black/30',
|
|
354
|
+
)}
|
|
355
|
+
>
|
|
356
|
+
<span
|
|
357
|
+
className={cn(
|
|
358
|
+
'flex h-16 w-16 items-center justify-center rounded-full',
|
|
359
|
+
'bg-background/90 text-foreground shadow-lg backdrop-blur',
|
|
360
|
+
'transition-transform hover:scale-105',
|
|
361
|
+
)}
|
|
362
|
+
>
|
|
363
|
+
<Play className="h-7 w-7 translate-x-0.5 fill-current" strokeWidth={0} />
|
|
364
|
+
</span>
|
|
365
|
+
</button>
|
|
366
|
+
)}
|
|
367
|
+
|
|
368
|
+
{/* Minimal mode: small play overlay when paused. */}
|
|
369
|
+
{!controlsEnabled && !isPlaying && hasPlayed && (
|
|
370
|
+
<div className="pointer-events-none absolute inset-0 flex items-center justify-center bg-black/20">
|
|
371
|
+
<span className="flex h-12 w-12 items-center justify-center rounded-full bg-background/80 text-foreground backdrop-blur">
|
|
372
|
+
<Play className="h-5 w-5 translate-x-0.5 fill-current" strokeWidth={0} />
|
|
373
|
+
</span>
|
|
374
|
+
</div>
|
|
375
|
+
)}
|
|
376
|
+
|
|
377
|
+
{/* Bottom control bar. */}
|
|
378
|
+
{controlsEnabled && (
|
|
379
|
+
<div
|
|
380
|
+
className={cn(
|
|
381
|
+
'absolute inset-x-0 bottom-0 z-10',
|
|
382
|
+
'bg-gradient-to-t from-black/70 via-black/40 to-transparent',
|
|
383
|
+
'px-3 pb-2 pt-8',
|
|
384
|
+
'transition-opacity duration-200',
|
|
385
|
+
showControls
|
|
386
|
+
? 'opacity-100'
|
|
387
|
+
: 'opacity-0 group-hover:opacity-100 group-focus-within:opacity-100',
|
|
388
|
+
)}
|
|
389
|
+
onMouseEnter={() => {
|
|
390
|
+
if (hideTimerRef.current) clearTimeout(hideTimerRef.current)
|
|
391
|
+
setShowControls(true)
|
|
392
|
+
}}
|
|
393
|
+
>
|
|
394
|
+
{/* Scrubber row. */}
|
|
395
|
+
<div className="relative mb-1 flex items-center">
|
|
396
|
+
{/* Buffered range overlay. */}
|
|
397
|
+
<div
|
|
398
|
+
className="pointer-events-none absolute inset-y-0 left-0 z-0 my-auto h-1.5 rounded-full bg-white/25"
|
|
399
|
+
style={{ width: `${bufferedPct}%` }}
|
|
400
|
+
aria-hidden="true"
|
|
401
|
+
/>
|
|
402
|
+
{/* Chapter ticks. */}
|
|
403
|
+
{chapters && duration > 0 && (
|
|
404
|
+
<div
|
|
405
|
+
className="pointer-events-none absolute inset-y-0 left-0 right-0 my-auto h-1.5"
|
|
406
|
+
aria-hidden="true"
|
|
407
|
+
>
|
|
408
|
+
{chapters.map((c, i) => {
|
|
409
|
+
const left = Math.min(100, (c.time / duration) * 100)
|
|
410
|
+
return (
|
|
411
|
+
<span
|
|
412
|
+
key={i}
|
|
413
|
+
className="absolute top-0 h-full w-0.5 bg-background/80"
|
|
414
|
+
style={{ left: `${left}%` }}
|
|
415
|
+
/>
|
|
416
|
+
)
|
|
417
|
+
})}
|
|
418
|
+
</div>
|
|
419
|
+
)}
|
|
420
|
+
<Tooltip>
|
|
421
|
+
<TooltipTrigger asChild>
|
|
422
|
+
<div className="relative z-10 w-full">
|
|
423
|
+
<Slider
|
|
424
|
+
aria-label="Seek"
|
|
425
|
+
value={[progressPct]}
|
|
426
|
+
min={0}
|
|
427
|
+
max={100}
|
|
428
|
+
step={0.1}
|
|
429
|
+
onValueChange={(v) => {
|
|
430
|
+
const pct = v[0] ?? 0
|
|
431
|
+
if (duration > 0) seekTo((pct / 100) * duration)
|
|
432
|
+
}}
|
|
433
|
+
className="cursor-pointer [&_[data-orientation=horizontal]>span]:cursor-pointer [&_[role=slider]]:cursor-pointer"
|
|
434
|
+
/>
|
|
435
|
+
</div>
|
|
436
|
+
</TooltipTrigger>
|
|
437
|
+
<TooltipContent side="top">
|
|
438
|
+
{formatTime(currentTime, showHours)}
|
|
439
|
+
</TooltipContent>
|
|
440
|
+
</Tooltip>
|
|
441
|
+
</div>
|
|
442
|
+
|
|
443
|
+
{/* Bottom row: play / time / volume / chapters / fullscreen. */}
|
|
444
|
+
<div className="flex items-center gap-1 text-white">
|
|
445
|
+
<Button
|
|
446
|
+
variant="ghost"
|
|
447
|
+
size="icon"
|
|
448
|
+
onClick={togglePlay}
|
|
449
|
+
aria-label={isPlaying ? 'Pause' : 'Play'}
|
|
450
|
+
className="h-8 w-8 text-white hover:bg-white/15 hover:text-white"
|
|
451
|
+
>
|
|
452
|
+
{isPlaying ? <Pause className="h-4 w-4" /> : <Play className="h-4 w-4" />}
|
|
453
|
+
</Button>
|
|
454
|
+
|
|
455
|
+
<span className="ml-1 font-mono text-xs tabular-nums text-white/90">
|
|
456
|
+
{formatTime(currentTime, showHours)} / {formatTime(duration, showHours)}
|
|
457
|
+
</span>
|
|
458
|
+
|
|
459
|
+
<div className="flex-1" />
|
|
460
|
+
|
|
461
|
+
{/* Volume — hover to reveal slider. */}
|
|
462
|
+
<div className="group/vol flex items-center">
|
|
463
|
+
<Button
|
|
464
|
+
variant="ghost"
|
|
465
|
+
size="icon"
|
|
466
|
+
onClick={toggleMute}
|
|
467
|
+
aria-label={isMuted ? 'Unmute' : 'Mute'}
|
|
468
|
+
className="h-8 w-8 text-white hover:bg-white/15 hover:text-white"
|
|
469
|
+
>
|
|
470
|
+
<VolumeIcon className="h-4 w-4" />
|
|
471
|
+
</Button>
|
|
472
|
+
<div
|
|
473
|
+
className={cn(
|
|
474
|
+
'overflow-hidden transition-[width] duration-200',
|
|
475
|
+
'w-0 group-hover/vol:w-20 group-focus-within/vol:w-20',
|
|
476
|
+
)}
|
|
477
|
+
>
|
|
478
|
+
<div className="px-2">
|
|
479
|
+
<Slider
|
|
480
|
+
aria-label="Volume"
|
|
481
|
+
value={[isMuted ? 0 : volume * 100]}
|
|
482
|
+
min={0}
|
|
483
|
+
max={100}
|
|
484
|
+
step={1}
|
|
485
|
+
onValueChange={(v) => {
|
|
486
|
+
const next = v[0] ?? 0
|
|
487
|
+
setVolume(next / 100)
|
|
488
|
+
if (next > 0) setIsMuted(false)
|
|
489
|
+
}}
|
|
490
|
+
className="cursor-pointer [&_[role=slider]]:cursor-pointer"
|
|
491
|
+
/>
|
|
492
|
+
</div>
|
|
493
|
+
</div>
|
|
494
|
+
</div>
|
|
495
|
+
|
|
496
|
+
{/* Chapters dropdown. */}
|
|
497
|
+
{chapters && chapters.length > 0 && (
|
|
498
|
+
<Popover>
|
|
499
|
+
<PopoverTrigger asChild>
|
|
500
|
+
<Button
|
|
501
|
+
variant="ghost"
|
|
502
|
+
size="icon"
|
|
503
|
+
aria-label="Chapters"
|
|
504
|
+
className="h-8 w-8 text-white hover:bg-white/15 hover:text-white"
|
|
505
|
+
>
|
|
506
|
+
<Layers className="h-4 w-4" />
|
|
507
|
+
</Button>
|
|
508
|
+
</PopoverTrigger>
|
|
509
|
+
<PopoverContent
|
|
510
|
+
align="end"
|
|
511
|
+
side="top"
|
|
512
|
+
className="w-64 p-1"
|
|
513
|
+
>
|
|
514
|
+
<div className="max-h-64 overflow-y-auto">
|
|
515
|
+
{chapters.map((c, i) => {
|
|
516
|
+
const next = chapters[i + 1]
|
|
517
|
+
const isCurrent =
|
|
518
|
+
currentTime >= c.time &&
|
|
519
|
+
(next === undefined || currentTime < next.time)
|
|
520
|
+
return (
|
|
521
|
+
<button
|
|
522
|
+
key={i}
|
|
523
|
+
type="button"
|
|
524
|
+
onClick={() => seekTo(c.time)}
|
|
525
|
+
className={cn(
|
|
526
|
+
'flex w-full items-center justify-between gap-3 rounded-sm px-2 py-1.5 text-left text-sm',
|
|
527
|
+
'hover:bg-accent hover:text-accent-foreground',
|
|
528
|
+
isCurrent && 'bg-accent text-accent-foreground',
|
|
529
|
+
)}
|
|
530
|
+
>
|
|
531
|
+
<span className="truncate">{c.title}</span>
|
|
532
|
+
<span className="font-mono text-xs tabular-nums text-muted-foreground">
|
|
533
|
+
{formatTime(c.time, showHours)}
|
|
534
|
+
</span>
|
|
535
|
+
</button>
|
|
536
|
+
)
|
|
537
|
+
})}
|
|
538
|
+
</div>
|
|
539
|
+
</PopoverContent>
|
|
540
|
+
</Popover>
|
|
541
|
+
)}
|
|
542
|
+
|
|
543
|
+
<Button
|
|
544
|
+
variant="ghost"
|
|
545
|
+
size="icon"
|
|
546
|
+
onClick={toggleFullscreen}
|
|
547
|
+
aria-label={isFullscreen ? 'Exit fullscreen' : 'Enter fullscreen'}
|
|
548
|
+
className="h-8 w-8 text-white hover:bg-white/15 hover:text-white"
|
|
549
|
+
>
|
|
550
|
+
{isFullscreen ? (
|
|
551
|
+
<Minimize className="h-4 w-4" />
|
|
552
|
+
) : (
|
|
553
|
+
<Maximize className="h-4 w-4" />
|
|
554
|
+
)}
|
|
555
|
+
</Button>
|
|
556
|
+
</div>
|
|
557
|
+
</div>
|
|
558
|
+
)}
|
|
559
|
+
</div>
|
|
560
|
+
</TooltipProvider>
|
|
561
|
+
)
|
|
562
|
+
},
|
|
563
|
+
)
|
|
564
|
+
VideoPlayer.displayName = 'VideoPlayer'
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { Beacon } from './Beacon'
|
|
3
|
+
|
|
4
|
+
// TODO: add all variants
|
|
5
|
+
const meta: Meta<typeof Beacon> = {
|
|
6
|
+
title: 'Engagement/Beacon',
|
|
7
|
+
component: Beacon,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default meta
|
|
12
|
+
type Story = StoryObj<typeof Beacon>
|
|
13
|
+
|
|
14
|
+
export const Default: Story = {}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { cn } from '../utils/cn'
|
|
3
|
+
|
|
4
|
+
const colorMap = {
|
|
5
|
+
primary: 'bg-[hsl(var(--primary))]',
|
|
6
|
+
success: 'bg-green-500',
|
|
7
|
+
warning: 'bg-yellow-500',
|
|
8
|
+
error: 'bg-red-500',
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const sizeMap = {
|
|
12
|
+
sm: 'h-1.5 w-1.5',
|
|
13
|
+
md: 'h-2.5 w-2.5',
|
|
14
|
+
lg: 'h-3.5 w-3.5',
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface BeaconProps {
|
|
18
|
+
color?: keyof typeof colorMap
|
|
19
|
+
size?: keyof typeof sizeMap
|
|
20
|
+
children?: React.ReactNode
|
|
21
|
+
className?: string
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function BeaconDot({ color = 'primary', size = 'md' }: Pick<BeaconProps, 'color' | 'size'>) {
|
|
25
|
+
return (
|
|
26
|
+
<span className="relative flex">
|
|
27
|
+
<span className={cn('animate-ping absolute inline-flex h-full w-full rounded-full opacity-75', colorMap[color])} />
|
|
28
|
+
<span className={cn('relative inline-flex rounded-full', sizeMap[size], colorMap[color])} />
|
|
29
|
+
</span>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function Beacon({ color = 'primary', size = 'md', children, className }: BeaconProps) {
|
|
34
|
+
if (!children) {
|
|
35
|
+
return (
|
|
36
|
+
<span className={cn('inline-flex', className)}>
|
|
37
|
+
<BeaconDot color={color} size={size} />
|
|
38
|
+
</span>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<span className={cn('relative inline-flex', className)}>
|
|
44
|
+
{children}
|
|
45
|
+
<span className="absolute -top-1 -right-1 flex">
|
|
46
|
+
<BeaconDot color={color} size={size} />
|
|
47
|
+
</span>
|
|
48
|
+
</span>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { Tour } from './Tour'
|
|
3
|
+
|
|
4
|
+
// TODO: add all variants
|
|
5
|
+
const meta: Meta<typeof Tour> = {
|
|
6
|
+
title: 'Engagement/Tour',
|
|
7
|
+
component: Tour,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default meta
|
|
12
|
+
type Story = StoryObj<typeof Tour>
|
|
13
|
+
|
|
14
|
+
export const Default: Story = {}
|