@vvedantb/ui 0.66.0 → 0.69.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/app/src/auth/useStableAuth.ts +0 -2
- package/app/src/confirm/ConfirmSkipHint.tsx +0 -2
- package/app/src/confirm/useAltHeld.ts +0 -17
- package/app/src/convex/ConvexClerkProvider.tsx +0 -3
- package/app/src/convex/env.ts +0 -4
- package/app/src/convex/errorMessage.ts +0 -1
- package/app/src/convex/useHeldResult.ts +0 -3
- package/app/src/page-motion/PageMotionProvider.tsx +0 -6
- package/app/src/page-title/createPageTitleContext.tsx +0 -14
- package/app/src/settings/SettingsEmptyState.tsx +0 -4
- package/app/src/settings/SettingsField.tsx +0 -4
- package/app/src/settings/SettingsPage.tsx +0 -12
- package/app/src/settings/SettingsSection.tsx +0 -14
- package/app/src/settings/ThemeModePicker.tsx +0 -6
- package/app/src/theme/createThemeProvider.tsx +0 -33
- package/app/src/time/compactRelativeTime.ts +0 -16
- package/app/src/update/staleDeployReload.ts +0 -40
- package/app/src/update/updateWatcher.ts +0 -8
- package/dist/app/src/auth/useStableAuth.js +0 -1
- package/dist/app/src/confirm/ConfirmSkipHint.js +0 -3
- package/dist/app/src/confirm/useAltHeld.js +0 -17
- package/dist/app/src/convex/env.js +0 -3
- package/dist/app/src/convex/errorMessage.js +0 -2
- package/dist/app/src/settings/ThemeModePicker.js +0 -1
- package/dist/app/src/theme/createThemeProvider.js +1 -11
- package/dist/app/src/time/compactRelativeTime.js +0 -8
- package/dist/app/src/update/staleDeployReload.js +3 -38
- package/dist/app/src/update/updateWatcher.js +1 -3
- package/dist/shell/src/AppShell.js +0 -14
- package/dist/shell/src/PageHeaderBar.js +0 -3
- package/dist/shell/src/SessionsHoverCard.js +0 -9
- package/dist/shell/src/SidePanelTabs.js +0 -36
- package/dist/shell/src/Sidebar.js +0 -1
- package/dist/shell/src/SidebarAccountMenu.js +1 -1
- package/dist/shell/src/SidebarChrome.js +0 -19
- package/dist/shell/src/SidebarIconTooltip.js +0 -1
- package/dist/shell/src/SidebarRail.js +0 -12
- package/dist/shell/src/SidebarResize.js +1 -4
- package/dist/shell/src/app-shell-classes.js +0 -10
- package/dist/shell/src/index.js +0 -1
- package/dist/shell/src/shell-panel-motion.js +0 -12
- package/dist/src/ai-elements/activity-shared.js +0 -6
- package/dist/src/ai-elements/activity-step-label.js +0 -6
- package/dist/src/ai-elements/activity-step-types.js +0 -4
- package/dist/src/ai-elements/activity-tasks-utils.js +0 -17
- package/dist/src/ai-elements/activity-tasks.js +0 -55
- package/dist/src/ai-elements/artifact.js +0 -4
- package/dist/src/ai-elements/attachments.js +0 -41
- package/dist/src/ai-elements/code-block.js +0 -18
- package/dist/src/ai-elements/collapsible-user-message-body.js +0 -2
- package/dist/src/ai-elements/context.js +0 -13
- package/dist/src/ai-elements/conversation.js +0 -4
- package/dist/src/ai-elements/jump-rail.js +0 -5
- package/dist/src/ai-elements/message.js +3 -9
- package/dist/src/ai-elements/model-picker-types.js +0 -1
- package/dist/src/ai-elements/model-picker.js +1 -6
- package/dist/src/ai-elements/model-selector.js +0 -4
- package/dist/src/ai-elements/prompt-input-speech.js +0 -13
- package/dist/src/ai-elements/prompt-input.js +0 -1
- package/dist/src/ai-elements/provider-icon.js +0 -4
- package/dist/src/ai-elements/queue.js +2 -16
- package/dist/src/ai-elements/shimmer.js +0 -14
- package/dist/src/ai-elements/speech-input.js +0 -7
- package/dist/src/artifacts/artifact-card.js +1 -1
- package/dist/src/artifacts/artifact-frame.js +0 -2
- package/dist/src/artifacts/artifact-viewer.js +2 -1
- package/dist/src/audio/playChime.js +0 -2
- package/dist/src/audio/playTone.js +1 -4
- package/dist/src/brand/AppWordmark.js +0 -5
- package/dist/src/brand/svg.js +0 -6
- package/dist/src/client.js +0 -43
- package/dist/src/composer/Composer.js +0 -27
- package/dist/src/composer/input-area/InputArea.js +0 -3
- package/dist/src/composer/input-area/InputAreaEditor.js +1 -50
- package/dist/src/composer/input-area/composerPrediction.js +0 -3
- package/dist/src/generative-ui/content.js +0 -2
- package/dist/src/generative-ui/index.js +0 -3
- package/dist/src/generative-ui/layout.js +0 -5
- package/dist/src/hooks/use-count-up-display.js +0 -2
- package/dist/src/hooks/use-idle-callback.js +0 -3
- package/dist/src/hooks/use-persisted-scroll-parent.js +1 -8
- package/dist/src/icons/animated/index.js +0 -4
- package/dist/src/icons/board-icon.js +74 -41
- package/dist/src/icons/bolt-icon.js +30 -20
- package/dist/src/icons/building-icon.js +125 -61
- package/dist/src/icons/files-icon.js +103 -43
- package/dist/src/icons/inbox-icon.js +101 -49
- package/dist/src/icons/index.js +2 -1
- package/dist/src/icons/memory-icon.js +135 -58
- package/dist/src/icons/search-icon.js +143 -46
- package/dist/src/icons/settings-icon.js +113 -53
- package/dist/src/icons/solid-icons.js +665 -0
- package/dist/src/icons/with-active.js +25 -0
- package/dist/src/index.js +0 -40
- package/dist/src/kibo/gantt-features.js +0 -10
- package/dist/src/kibo/gantt-provider.js +0 -34
- package/dist/src/kibo/kanban.js +0 -15
- package/dist/src/kibo/list.js +0 -3
- package/dist/src/kibo/video-player.js +0 -7
- package/dist/src/logos/index.js +0 -4
- package/dist/src/markdown/Markdown.js +0 -15
- package/dist/src/markdown/MarkdownCodeBlock.js +0 -16
- package/dist/src/markdown/MarkdownInlineCode.js +0 -6
- package/dist/src/markdown/MarkdownLink.js +0 -5
- package/dist/src/markdown/codeFence.js +0 -1
- package/dist/src/markdown/codeHighlight.js +0 -19
- package/dist/src/markdown/incrementalBlocks.js +0 -45
- package/dist/src/markdown/markdownClipboard.js +0 -13
- package/dist/src/markdown/mermaid.js +0 -25
- package/dist/src/markdown/rehypeGithubAlerts.js +0 -4
- package/dist/src/markdown/useSmoothText.js +0 -5
- package/dist/src/marketing/PricingModal.js +0 -2
- package/dist/src/marketing/ProductHero.js +0 -2
- package/dist/src/marketing/createLandingKit.js +0 -5
- package/dist/src/marketing/marketing-classes.js +0 -7
- package/dist/src/motion/dock-motion.js +0 -27
- package/dist/src/motion/panel-transition.js +0 -2
- package/dist/src/ui/_field-classes.js +0 -3
- package/dist/src/ui/_menu-classes.js +6 -6
- package/dist/src/ui/_picker-classes.js +0 -9
- package/dist/src/ui/accordion.alt.js +0 -12
- package/dist/src/ui/badge.js +0 -1
- package/dist/src/ui/border-beam.js +0 -2
- package/dist/src/ui/breadcrumb.js +0 -15
- package/dist/src/ui/bulk-action-bar.js +0 -11
- package/dist/src/ui/button.js +0 -20
- package/dist/src/ui/calendar.js +1 -20
- package/dist/src/ui/card.js +0 -3
- package/dist/src/ui/carousel.js +0 -1
- package/dist/src/ui/clear-input.alt.js +0 -9
- package/dist/src/ui/clearInputDissolve.js +0 -4
- package/dist/src/ui/command.js +0 -15
- package/dist/src/ui/confetti-burst.js +0 -3
- package/dist/src/ui/confirm-dialog-parts.js +0 -11
- package/dist/src/ui/confirm-dialog.js +0 -6
- package/dist/src/ui/context-menu.js +40 -34
- package/dist/src/ui/crossfade-icon.js +0 -2
- package/dist/src/ui/date-picker.js +0 -22
- package/dist/src/ui/dialog.js +0 -5
- package/dist/src/ui/dropdown-menu.js +40 -34
- package/dist/src/ui/empty-state.js +0 -7
- package/dist/src/ui/field.js +0 -21
- package/dist/src/ui/image-lightbox.js +0 -5
- package/dist/src/ui/input-group.alt.js +0 -24
- package/dist/src/ui/input-group.js +0 -4
- package/dist/src/ui/kbd.js +0 -3
- package/dist/src/ui/loading-state.js +0 -17
- package/dist/src/ui/marquee-on-hover.js +0 -3
- package/dist/src/ui/media-preview.js +0 -2
- package/dist/src/ui/modalTransition.js +0 -33
- package/dist/src/ui/overlay-a11y.js +0 -1
- package/dist/src/ui/page-title.js +0 -3
- package/dist/src/ui/refresh-spin-icon.js +0 -12
- package/dist/src/ui/search-input.js +0 -1
- package/dist/src/ui/select-field.js +0 -1
- package/dist/src/ui/send-queue-icon.js +0 -3
- package/dist/src/ui/sheet.js +0 -33
- package/dist/src/ui/slider.js +103 -82
- package/dist/src/ui/sonner-icons.js +0 -5
- package/dist/src/ui/sonner.js +0 -60
- package/dist/src/ui/spinner.js +0 -35
- package/dist/src/ui/status-dot.js +0 -2
- package/dist/src/ui/surface.js +0 -14
- package/dist/src/ui/switch.js +213 -36
- package/dist/src/ui/table.js +0 -1
- package/dist/src/ui/tabs-transition.js +0 -1
- package/dist/src/ui/tabs.js +0 -17
- package/dist/src/ui/tabsSliding.js +0 -6
- package/dist/src/ui/time-picker.js +0 -15
- package/dist/src/ui/toggle-search.js +0 -3
- package/dist/src/ui/ui-config.js +0 -16
- package/dist/src/utils/cat-color.js +0 -17
- package/dist/src/utils/cn.js +0 -5
- package/dist/src/utils/gesture.js +0 -8
- package/dist/src/utils/ref.js +0 -1
- package/dist/src/utils/runtimeVisibility.js +1 -22
- package/dist/src/utils/surface-radius.js +0 -11
- package/dist/src/utils/useDragSensors.js +0 -4
- package/dist/tokens/src/tailwind-preset.mjs +0 -3
- package/package.json +3 -3
- package/scripts/build-brand-assets.mjs +0 -8
- package/shell/src/AppShell.tsx +0 -37
- package/shell/src/AppSidebar.tsx +0 -14
- package/shell/src/ButtonTrack.tsx +0 -1
- package/shell/src/PageHeaderBar.tsx +0 -61
- package/shell/src/PageWrapper.tsx +0 -26
- package/shell/src/PillTabs.tsx +0 -1
- package/shell/src/SessionsHoverCard.tsx +0 -40
- package/shell/src/SidePanelTabs.tsx +0 -61
- package/shell/src/Sidebar.tsx +0 -1
- package/shell/src/SidebarAccountMenu.tsx +1 -41
- package/shell/src/SidebarChrome.tsx +0 -32
- package/shell/src/SidebarIconTooltip.tsx +0 -3
- package/shell/src/SidebarPanel.tsx +0 -20
- package/shell/src/SidebarRail.tsx +0 -44
- package/shell/src/SidebarResize.tsx +0 -6
- package/shell/src/SidebarUpgradeCard.tsx +0 -2
- package/shell/src/SignOutDialog.tsx +0 -6
- package/shell/src/app-shell-classes.ts +0 -15
- package/shell/src/index.ts +0 -1
- package/shell/src/shell-panel-motion.ts +0 -11
- package/shell/src/shell-variant.ts +0 -6
- package/src/ai-elements/__snapshots__/queue.test.tsx.snap +2 -2
- package/src/ai-elements/activity-question.tsx +0 -2
- package/src/ai-elements/activity-shared.tsx +0 -11
- package/src/ai-elements/activity-step-detail.tsx +0 -2
- package/src/ai-elements/activity-step-label.ts +0 -5
- package/src/ai-elements/activity-step-types.ts +0 -24
- package/src/ai-elements/activity-tasks-utils.ts +0 -13
- package/src/ai-elements/activity-tasks.tsx +0 -61
- package/src/ai-elements/artifact.tsx +0 -7
- package/src/ai-elements/attachments.tsx +0 -33
- package/src/ai-elements/chat-day-divider.tsx +0 -3
- package/src/ai-elements/chat-jump-rail.tsx +0 -9
- package/src/ai-elements/code-block.tsx +0 -28
- package/src/ai-elements/collapsible-user-message-body.tsx +0 -2
- package/src/ai-elements/context.tsx +0 -10
- package/src/ai-elements/conversation.tsx +0 -16
- package/src/ai-elements/jump-rail.tsx +0 -31
- package/src/ai-elements/message.tsx +3 -34
- package/src/ai-elements/model-picker-content.tsx +0 -17
- package/src/ai-elements/model-picker-types.ts +0 -5
- package/src/ai-elements/model-picker.tsx +0 -36
- package/src/ai-elements/model-selector.tsx +0 -5
- package/src/ai-elements/prompt-input-speech.tsx +0 -11
- package/src/ai-elements/prompt-input.tsx +0 -26
- package/src/ai-elements/provider-icon.tsx +0 -2
- package/src/ai-elements/queue.tsx +2 -20
- package/src/ai-elements/reasoning.tsx +0 -4
- package/src/ai-elements/shimmer.tsx +0 -16
- package/src/ai-elements/simple-model-ladder.tsx +0 -1
- package/src/ai-elements/speech-input.tsx +0 -6
- package/src/ai-elements/test-results.tsx +0 -5
- package/src/ai-elements/trace.tsx +0 -2
- package/src/ai-elements/web-preview.tsx +0 -7
- package/src/artifacts/artifact-card.tsx +1 -8
- package/src/artifacts/artifact-dialogs.tsx +0 -4
- package/src/artifacts/artifact-frame.tsx +0 -10
- package/src/artifacts/artifact-list-toolbar.tsx +0 -6
- package/src/artifacts/artifact-list.tsx +0 -4
- package/src/artifacts/artifact-type-icon.tsx +0 -1
- package/src/artifacts/artifact-versions-menu.tsx +0 -3
- package/src/artifacts/artifact-viewer.tsx +2 -6
- package/src/artifacts/types.ts +0 -1
- package/src/audio/playChime.ts +0 -1
- package/src/audio/playTone.ts +0 -7
- package/src/brand/AppIcons.tsx +0 -5
- package/src/brand/AppMark.tsx +0 -6
- package/src/brand/AppWordmark.tsx +0 -10
- package/src/brand/familyApps.ts +0 -2
- package/src/brand/svg.ts +0 -9
- package/src/client.ts +0 -34
- package/src/composer/Composer.tsx +0 -70
- package/src/composer/input-area/ComposerSlashMenu.tsx +0 -1
- package/src/composer/input-area/ConnectionStatusMenuItem.tsx +0 -2
- package/src/composer/input-area/FadePresence.tsx +0 -4
- package/src/composer/input-area/InputActions.tsx +0 -5
- package/src/composer/input-area/InputArea.tsx +1 -28
- package/src/composer/input-area/InputAreaEditor.tsx +0 -39
- package/src/composer/input-area/InputBanners.tsx +0 -1
- package/src/composer/input-area/PromoBanner.tsx +0 -1
- package/src/composer/input-area/composerPrediction.ts +0 -2
- package/src/composer/input-area/useComposerSlashMenu.ts +0 -1
- package/src/composer/input-area/useInputAreaPrediction.ts +0 -1
- package/src/composer/prediction.ts +0 -6
- package/src/composer/useComposerPrediction.ts +0 -2
- package/src/generative-ui/GenerativeUiPanel.tsx +0 -11
- package/src/generative-ui/content.tsx +0 -2
- package/src/generative-ui/index.ts +0 -3
- package/src/generative-ui/layout.tsx +0 -5
- package/src/hooks/use-count-up-display.ts +0 -1
- package/src/hooks/use-idle-callback.ts +0 -5
- package/src/hooks/use-persisted-scroll-parent.ts +0 -4
- package/src/hooks/use-single-flight.ts +0 -5
- package/src/icons/animated/animated-bell-icon.tsx +0 -6
- package/src/icons/animated/animated-counter.tsx +0 -5
- package/src/icons/animated/animated-key-icon.tsx +0 -4
- package/src/icons/animated/animated-notification-icon.tsx +0 -14
- package/src/icons/animated/animated-progress.tsx +0 -10
- package/src/icons/animated/animated-status-dot.tsx +0 -4
- package/src/icons/animated/index.ts +0 -4
- package/src/icons/animated/morphing-menu-icon.tsx +0 -5
- package/src/icons/animated/morphing-mic-icon.tsx +0 -2
- package/src/icons/animated/pulsing-rings.tsx +0 -4
- package/src/icons/automation-icon.tsx +0 -1
- package/src/icons/board-icon.tsx +13 -10
- package/src/icons/bolt-icon.tsx +5 -4
- package/src/icons/building-icon.tsx +11 -9
- package/src/icons/draft-icon.tsx +0 -1
- package/src/icons/files-icon.tsx +9 -5
- package/src/icons/inbox-arrow-icon.tsx +0 -1
- package/src/icons/inbox-icon.tsx +9 -5
- package/src/icons/index.ts +12 -1
- package/src/icons/memory-icon.tsx +9 -11
- package/src/icons/nav-icon-base.tsx +0 -10
- package/src/icons/search-icon.tsx +7 -6
- package/src/icons/settings-icon.tsx +11 -13
- package/src/icons/sidebar-toggle-icon.tsx +0 -1
- package/src/icons/solid-icons.tsx +138 -0
- package/src/icons/with-active.tsx +14 -0
- package/src/index.ts +0 -30
- package/src/kibo/gantt-features.tsx +0 -16
- package/src/kibo/gantt-header.tsx +0 -4
- package/src/kibo/gantt-provider.tsx +0 -36
- package/src/kibo/gantt-sidebar.tsx +0 -7
- package/src/kibo/gantt-timeline.tsx +0 -4
- package/src/kibo/kanban.tsx +0 -49
- package/src/kibo/list.tsx +0 -8
- package/src/kibo/theme-switcher.tsx +0 -5
- package/src/kibo/video-player.tsx +0 -9
- package/src/logos/index.ts +0 -3
- package/src/logos/logo-svg.tsx +0 -5
- package/src/markdown/Markdown.tsx +0 -20
- package/src/markdown/MarkdownCodeBlock.tsx +0 -14
- package/src/markdown/MarkdownInlineCode.tsx +0 -6
- package/src/markdown/MarkdownLink.tsx +0 -4
- package/src/markdown/codeFence.ts +0 -3
- package/src/markdown/codeHighlight.ts +0 -16
- package/src/markdown/incrementalBlocks.ts +0 -49
- package/src/markdown/markdownClipboard.ts +0 -12
- package/src/markdown/mermaid.ts +0 -22
- package/src/markdown/rehypeGithubAlerts.ts +0 -3
- package/src/markdown/useSmoothText.ts +0 -5
- package/src/marketing/FloatingBar.tsx +0 -3
- package/src/marketing/PricingModal.tsx +0 -45
- package/src/marketing/ProductHero.tsx +0 -23
- package/src/marketing/ProductHeroOrbit.tsx +0 -5
- package/src/marketing/SiteFooter.tsx +0 -23
- package/src/marketing/SiteHeader.tsx +0 -14
- package/src/marketing/VProPricingModal.tsx +0 -5
- package/src/marketing/createLandingKit.tsx +0 -12
- package/src/marketing/landing.tsx +0 -12
- package/src/marketing/marketing-classes.ts +0 -7
- package/src/motion/dock-motion.ts +0 -25
- package/src/motion/list-enter.tsx +0 -4
- package/src/motion/panel-transition.tsx +0 -5
- package/src/ui/_field-classes.ts +0 -2
- package/src/ui/_menu-classes.ts +7 -4
- package/src/ui/_menu-parts.tsx +0 -5
- package/src/ui/_picker-classes.ts +0 -6
- package/src/ui/accordion.alt.tsx +0 -8
- package/src/ui/accordion.tsx +0 -4
- package/src/ui/badge.tsx +0 -1
- package/src/ui/border-beam.tsx +0 -11
- package/src/ui/breadcrumb.tsx +0 -13
- package/src/ui/bulk-action-bar.tsx +0 -24
- package/src/ui/button.tsx +0 -27
- package/src/ui/calendar.tsx +0 -18
- package/src/ui/card.tsx +0 -3
- package/src/ui/carousel.tsx +0 -4
- package/src/ui/checkbox.tsx +0 -1
- package/src/ui/clear-input.alt.tsx +0 -8
- package/src/ui/clear-input.tsx +0 -16
- package/src/ui/clearInputDissolve.ts +0 -4
- package/src/ui/command.tsx +0 -22
- package/src/ui/confetti-burst.tsx +0 -4
- package/src/ui/confirm-dialog-parts.tsx +0 -45
- package/src/ui/confirm-dialog.tsx +0 -26
- package/src/ui/context-menu.tsx +4 -11
- package/src/ui/count-pop.tsx +0 -2
- package/src/ui/crossfade-icon.tsx +0 -3
- package/src/ui/date-picker.tsx +0 -40
- package/src/ui/dialog.tsx +0 -18
- package/src/ui/dropdown-menu.tsx +4 -12
- package/src/ui/empty-state.tsx +0 -15
- package/src/ui/error-boundary.tsx +0 -7
- package/src/ui/field.tsx +0 -18
- package/src/ui/hover-card.tsx +0 -6
- package/src/ui/image-lightbox.tsx +0 -7
- package/src/ui/input-group.alt.tsx +0 -16
- package/src/ui/input-group.tsx +0 -3
- package/src/ui/kbd.tsx +0 -3
- package/src/ui/label.tsx +0 -1
- package/src/ui/labeled-slider-row.tsx +0 -2
- package/src/ui/list-row.tsx +0 -46
- package/src/ui/loading-state.tsx +0 -23
- package/src/ui/marquee-on-hover.tsx +1 -6
- package/src/ui/media-preview.tsx +0 -5
- package/src/ui/modalTransition.ts +0 -25
- package/src/ui/overlay-a11y.ts +0 -1
- package/src/ui/page-title.tsx +0 -4
- package/src/ui/popover.tsx +0 -8
- package/src/ui/progress.tsx +0 -1
- package/src/ui/refresh-spin-icon.tsx +0 -11
- package/src/ui/relative-date-time.tsx +0 -3
- package/src/ui/rolling-number.tsx +0 -2
- package/src/ui/search-input.tsx +0 -9
- package/src/ui/select-field.tsx +0 -5
- package/src/ui/select.tsx +0 -8
- package/src/ui/send-queue-icon.tsx +0 -3
- package/src/ui/separator.tsx +0 -1
- package/src/ui/sheet.tsx +0 -42
- package/src/ui/slide-over-panel.tsx +0 -2
- package/src/ui/slider.tsx +21 -9
- package/src/ui/sonner-icons.tsx +0 -4
- package/src/ui/sonner.tsx +0 -78
- package/src/ui/spinner.tsx +0 -50
- package/src/ui/status-dot.tsx +0 -10
- package/src/ui/surface.tsx +0 -13
- package/src/ui/switch.tsx +72 -3
- package/src/ui/table.tsx +0 -3
- package/src/ui/tabs-transition.tsx +0 -12
- package/src/ui/tabs.tsx +0 -17
- package/src/ui/tabsSliding.ts +0 -5
- package/src/ui/time-picker.tsx +0 -17
- package/src/ui/toggle-search.tsx +0 -6
- package/src/ui/toolbar-search-input.tsx +0 -3
- package/src/ui/tooltip.tsx +0 -5
- package/src/ui/ui-config.tsx +0 -19
- package/src/utils/cat-color.ts +0 -20
- package/src/utils/cn.ts +0 -4
- package/src/utils/gesture.ts +0 -8
- package/src/utils/ref.ts +0 -1
- package/src/utils/runtimeVisibility.ts +0 -19
- package/src/utils/surface-radius.ts +0 -11
- package/src/utils/useDragSensors.ts +0 -2
- package/tokens/examples/compat-shadcn-rgb/vite.config.ts +0 -2
- package/tokens/examples/toaster/Fixture.tsx +0 -4
- package/tokens/examples/toaster/UpdateToastFixture.tsx +0 -4
- package/tokens/examples/toaster/vite.config.ts +0 -2
- package/tokens/examples/tokens-moved/Fixture.tsx +0 -4
- package/tokens/examples/tokens-moved/vite.config.ts +0 -2
- package/tokens/src/tailwind-preset.mjs +0 -3
|
@@ -6,12 +6,10 @@ import { Button } from "./button";
|
|
|
6
6
|
|
|
7
7
|
export interface SlideOverPanelProps {
|
|
8
8
|
open: boolean;
|
|
9
|
-
/** Panel width. Default `"w-96"`. */
|
|
10
9
|
width?: "w-80" | "w-96";
|
|
11
10
|
onClose: () => void;
|
|
12
11
|
header: ReactNode;
|
|
13
12
|
children: ReactNode;
|
|
14
|
-
/** `aria-label` of the close button. Default `"Close panel"`. */
|
|
15
13
|
closeLabel?: string;
|
|
16
14
|
className?: string;
|
|
17
15
|
}
|
package/src/ui/slider.tsx
CHANGED
|
@@ -8,20 +8,12 @@ export interface SliderConfig {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
type SliderProps = React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root> & {
|
|
11
|
-
/** Accessible name per thumb, by index. Wins over `aria-label` on the first thumb. */
|
|
12
11
|
thumbLabels?: string[];
|
|
13
|
-
/** Classes for the track, merged after the defaults so they win (`bg-default dark:bg-muted/40`). check-tokens-allow: muted */
|
|
14
12
|
trackClassName?: string;
|
|
15
|
-
/** Classes for the filled range, merged after the defaults so they win (`bg-primary`). */
|
|
16
13
|
rangeClassName?: string;
|
|
17
|
-
/** Classes for every thumb, merged after the defaults so they win (`bg-background dark:bg-foreground dark:border-muted`). check-tokens-allow: muted */
|
|
18
14
|
thumbClassName?: string;
|
|
19
15
|
};
|
|
20
16
|
|
|
21
|
-
// `id`, `aria-label`, `aria-labelledby` and `aria-valuetext` go to the first
|
|
22
|
-
// Thumb, not Root: the thumb is the focusable role="slider" element, so
|
|
23
|
-
// `<Label htmlFor={id}>` and the accessible name land on it. The ref stays on Root.
|
|
24
|
-
// `children` render inside the track, after the range (for example tick marks).
|
|
25
17
|
const Slider = React.forwardRef<React.ComponentRef<typeof SliderPrimitive.Root>, SliderProps>(
|
|
26
18
|
(
|
|
27
19
|
{
|
|
@@ -42,6 +34,20 @@ const Slider = React.forwardRef<React.ComponentRef<typeof SliderPrimitive.Root>,
|
|
|
42
34
|
const classes = useUiConfig("Slider")?.classes;
|
|
43
35
|
const cn = useCn();
|
|
44
36
|
const count = (props.value ?? props.defaultValue ?? [props.min ?? 0]).length;
|
|
37
|
+
const [dragging, setDragging] = React.useState(false);
|
|
38
|
+
const [activeIndex, setActiveIndex] = React.useState(0);
|
|
39
|
+
const { onPointerDown, disabled } = props;
|
|
40
|
+
|
|
41
|
+
React.useEffect(() => {
|
|
42
|
+
if (!dragging) return;
|
|
43
|
+
const stop = () => setDragging(false);
|
|
44
|
+
window.addEventListener("pointerup", stop);
|
|
45
|
+
window.addEventListener("pointercancel", stop);
|
|
46
|
+
return () => {
|
|
47
|
+
window.removeEventListener("pointerup", stop);
|
|
48
|
+
window.removeEventListener("pointercancel", stop);
|
|
49
|
+
};
|
|
50
|
+
}, [dragging]);
|
|
45
51
|
return (
|
|
46
52
|
<SliderPrimitive.Root
|
|
47
53
|
className={cn(
|
|
@@ -50,6 +56,10 @@ const Slider = React.forwardRef<React.ComponentRef<typeof SliderPrimitive.Root>,
|
|
|
50
56
|
className,
|
|
51
57
|
)}
|
|
52
58
|
{...props}
|
|
59
|
+
onPointerDown={(event) => {
|
|
60
|
+
onPointerDown?.(event);
|
|
61
|
+
if (!disabled) setDragging(true);
|
|
62
|
+
}}
|
|
53
63
|
ref={ref}
|
|
54
64
|
>
|
|
55
65
|
<SliderPrimitive.Track
|
|
@@ -75,9 +85,11 @@ const Slider = React.forwardRef<React.ComponentRef<typeof SliderPrimitive.Root>,
|
|
|
75
85
|
aria-label={thumbLabels?.[i] ?? (i === 0 ? ariaLabel : undefined)}
|
|
76
86
|
aria-labelledby={i === 0 ? ariaLabelledBy : undefined}
|
|
77
87
|
aria-valuetext={i === 0 ? ariaValueText : undefined}
|
|
88
|
+
data-dragging={dragging && (count === 1 || activeIndex === i) ? "" : undefined}
|
|
89
|
+
onFocus={() => setActiveIndex(i)}
|
|
78
90
|
className={cn(
|
|
79
91
|
classes?.thumb ??
|
|
80
|
-
"block
|
|
92
|
+
"block h-5 w-8 shrink-0 rounded-full border border-border bg-background shadow-sm [transition-property:scale,background-color,border-color,box-shadow,backdrop-filter] duration-200 ease-smooth motion-reduce:transition-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring data-[disabled]:cursor-not-allowed data-[orientation=vertical]:h-8 data-[orientation=vertical]:w-5 data-[dragging]:[scale:1.45] data-[dragging]:border-background/70 data-[dragging]:bg-background/25 data-[dragging]:backdrop-blur-[2px] data-[dragging]:backdrop-saturate-150 data-[dragging]:shadow-[inset_0_1px_1px_rgb(255_255_255/0.9),inset_0_-1px_2px_rgb(255_255_255/0.45),0_10px_28px_rgb(0_0_0/0.2)] dark:border-muted dark:bg-foreground dark:data-[dragging]:border-foreground/40 dark:data-[dragging]:bg-foreground/25", // check-tokens-allow: muted
|
|
81
93
|
thumbClassName,
|
|
82
94
|
)}
|
|
83
95
|
/>
|
package/src/ui/sonner-icons.tsx
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { Spinner } from "./spinner";
|
|
2
2
|
|
|
3
|
-
// 24px filled icons for `SonnerToaster` (`toastIcons="filled24"`). Self-contained
|
|
4
|
-
// SVGs, tinted with package colour tokens. Sonner wraps each in its `data-icon` slot.
|
|
5
|
-
|
|
6
3
|
function InfoIcon() {
|
|
7
4
|
return (
|
|
8
5
|
<svg
|
|
@@ -81,7 +78,6 @@ function CloseIcon() {
|
|
|
81
78
|
);
|
|
82
79
|
}
|
|
83
80
|
|
|
84
|
-
/** 24px success / info / warning / error icons, a matching loader and a 14px close cross. */
|
|
85
81
|
const filledToastIcons = {
|
|
86
82
|
success: <SuccessIcon />,
|
|
87
83
|
info: <InfoIcon />,
|
package/src/ui/sonner.tsx
CHANGED
|
@@ -4,76 +4,24 @@ import { filledToastIcons } from "./sonner-icons";
|
|
|
4
4
|
import { useUiConfig } from "./ui-config";
|
|
5
5
|
import "./sonner.css";
|
|
6
6
|
|
|
7
|
-
// Sonner toaster aligned with flat tonal surfaces. `unstyled: true` strips
|
|
8
|
-
// sonner's default visual styling so our classes are the single source of
|
|
9
|
-
// truth. Toast surfaces use `glass-panel-strong` (flat popover fill) plus
|
|
10
|
-
// `smooth-shadow-ring-md`. `!font-sans` is forced on the toaster section because
|
|
11
|
-
// sonner sets its own `font-family` on `[data-sonner-toaster]` from a stylesheet
|
|
12
|
-
// that loads after app globals. Variant icons (success / error / warning / info)
|
|
13
|
-
// are tinted via a `data-icon` descendant selector, leaving the rest of the toast
|
|
14
|
-
// neutral. Callers should pass `theme` so sonner's internal `data-theme`
|
|
15
|
-
// attribute matches the active app theme.
|
|
16
|
-
//
|
|
17
|
-
// Position: `top-right` by default (sonner's own default is `bottom-right`), as
|
|
18
|
-
// apps mount it. A `position` prop or `UiConfig.SonnerToaster.position` wins.
|
|
19
|
-
// `mobileOffset` adds the safe-area insets to sonner's 16px; a prop or config replaces it.
|
|
20
|
-
//
|
|
21
|
-
// Stacking: `expand={false}` keeps toasts collapsed (offset + scale). Hovering
|
|
22
|
-
// the stack expands them. `sonner.css` hides back-toast content while collapsed
|
|
23
|
-
// because `unstyled` disables sonner's built-in `data-styled` stack rules.
|
|
24
|
-
//
|
|
25
|
-
// Caller props merge with these defaults instead of replacing them: see
|
|
26
|
-
// `mergeToastClassNames`, `mergeToasterStyle` and the `SonnerToaster` props.
|
|
27
|
-
|
|
28
7
|
type ToastClassNames = NonNullable<
|
|
29
8
|
NonNullable<ToasterProps["toastOptions"]>["classNames"]
|
|
30
9
|
>;
|
|
31
10
|
type ToasterStyle = CSSProperties & Record<`--${string}`, string>;
|
|
32
11
|
|
|
33
12
|
type SonnerToasterOptions = {
|
|
34
|
-
/**
|
|
35
|
-
* `"lg"` (default) uses `rounded-lg`. `"surface"` uses `rounded-surface`.
|
|
36
|
-
* `"control"` uses `rounded-field`, the radius of inputs and selects
|
|
37
|
-
* (`min(var(--radius), 0.625rem)`, 10px, from 0.16.3).
|
|
38
|
-
*/
|
|
39
13
|
toastRadius?: "lg" | "surface" | "control";
|
|
40
|
-
/** `"default"` keeps the current padding and text size. `"compact"` tightens padding, gap and text. */
|
|
41
14
|
density?: "default" | "compact";
|
|
42
|
-
/** `"default"` keeps sonner's icons. `"filled24"` uses 24px filled icons. */
|
|
43
15
|
toastIcons?: "default" | "filled24";
|
|
44
|
-
/**
|
|
45
|
-
* `"default"` keeps the text-style close button. `"hoverChip"` uses a round chip at the
|
|
46
|
-
* top-right, shown on hover (always on small screens) and enables sonner's `closeButton`
|
|
47
|
-
* unless the caller sets it.
|
|
48
|
-
*/
|
|
49
16
|
closeButtonStyle?: "default" | "hoverChip";
|
|
50
|
-
/** When true, set sonner's `--normal-*` variables from `--color-*` tokens and `font-family: inherit`. */
|
|
51
17
|
sonnerVars?: boolean;
|
|
52
|
-
/** When true, descriptions use `text-muted-foreground!` so sonner's dark rule cannot win. */
|
|
53
18
|
descriptionMuted?: boolean;
|
|
54
|
-
/** `"snug"` (default) keeps `leading-snug`. `"5"` uses `leading-5` (20px at `text-sm`). */
|
|
55
19
|
titleLeading?: "snug" | "5";
|
|
56
|
-
/** Custom loading icon. Merged into `icons`. A caller `icons.loading` wins. */
|
|
57
20
|
loadingIcon?: ReactNode;
|
|
58
|
-
/**
|
|
59
|
-
* When true, adds a class that hides the content of toasts behind the front toast
|
|
60
|
-
* while the stack is collapsed. Default false. `sonner.css` has the same rule.
|
|
61
|
-
*/
|
|
62
21
|
hideStackedContent?: boolean;
|
|
63
|
-
/**
|
|
64
|
-
* Replaces built-in classes. Toast parts (`toast`, `title`, `loader`, …)
|
|
65
|
-
* replace the package `classNames` per key (`""` removes one); caller
|
|
66
|
-
* `toastOptions.classNames` still merge after. `toaster` replaces
|
|
67
|
-
* `toaster group !font-sans` on the toaster list (`""` removes it).
|
|
68
|
-
*/
|
|
69
22
|
classes?: ToastClassNames & { toaster?: string };
|
|
70
23
|
};
|
|
71
24
|
|
|
72
|
-
/**
|
|
73
|
-
* App defaults for `SonnerToaster` (`UiConfig.SonnerToaster`): every key is a
|
|
74
|
-
* default for the prop of the same name. An explicit prop wins; a prop passed
|
|
75
|
-
* as `undefined` keeps the config value.
|
|
76
|
-
*/
|
|
77
25
|
type SonnerToasterConfig = Omit<ToasterProps, "className" | "toastOptions"> & SonnerToasterOptions;
|
|
78
26
|
|
|
79
27
|
const defaultToasterClassName = "toaster group !font-sans";
|
|
@@ -87,12 +35,6 @@ const hoverChipCloseButtonClassName =
|
|
|
87
35
|
const defaultCloseButtonClassName =
|
|
88
36
|
"rounded-lg bg-default px-2.5 py-1 text-xs font-medium text-foreground transition-colors hover:bg-default/78";
|
|
89
37
|
|
|
90
|
-
// Action and cancel buttons: 28px tall (`h-7`), 10px side padding, 12px text,
|
|
91
|
-
// `rounded-control` (10px), the classes apps already set through `classes`.
|
|
92
|
-
// Measured on the toaster fixture's Refresh button: 28px tall, up from 24px with the 0.31.0
|
|
93
|
-
// `px-2.5 py-1 rounded-lg` (16px radius) string. `shrink-0` keeps the button
|
|
94
|
-
// from squeezing when the text column grows. `motion-press` is an app utility
|
|
95
|
-
// (not in `tokens.css`), as in `BulkActionBar`.
|
|
96
38
|
const defaultActionButtonClassName =
|
|
97
39
|
"h-7 shrink-0 rounded-control bg-primary px-2.5 text-xs font-medium text-primary-foreground motion-press active:scale-[0.96] hover:bg-primary/90";
|
|
98
40
|
|
|
@@ -101,9 +43,6 @@ const defaultCancelButtonClassName =
|
|
|
101
43
|
|
|
102
44
|
const defaultToasterPosition = "top-right" satisfies ToasterProps["position"];
|
|
103
45
|
|
|
104
|
-
// Sonner's 16px phone offset (viewport up to 600px) plus the safe-area inset, so
|
|
105
|
-
// toasts clear the notch and home indicator under a translucent status bar
|
|
106
|
-
// (`viewport-fit=cover`). `env()` is 0 without it. Left and right keep 16px.
|
|
107
46
|
const defaultMobileOffset = {
|
|
108
47
|
top: "calc(16px + env(safe-area-inset-top, 0px))",
|
|
109
48
|
bottom: "calc(16px + env(safe-area-inset-bottom, 0px))",
|
|
@@ -115,11 +54,6 @@ const toastRadiusClasses = {
|
|
|
115
54
|
control: "rounded-field",
|
|
116
55
|
} as const;
|
|
117
56
|
|
|
118
|
-
/**
|
|
119
|
-
* Default `classNames`, with the opt-in variants applied. No options gives the
|
|
120
|
-
* 0.2.1 defaults, plus `content` and the 28px `actionButton` and `cancelButton`
|
|
121
|
-
* (from 0.31.1).
|
|
122
|
-
*/
|
|
123
57
|
function createToasterClassNames({
|
|
124
58
|
toastRadius = "lg",
|
|
125
59
|
density = "default",
|
|
@@ -141,11 +75,7 @@ function createToasterClassNames({
|
|
|
141
75
|
const descriptionSize = compact ? "text-xs" : "text-[13px]";
|
|
142
76
|
return {
|
|
143
77
|
toast: `group toast glass-panel-strong flex w-full items-center ${compact ? "gap-2" : "gap-3"} ${radius} ${compact ? "px-3 py-2 text-xs" : "px-4 py-3 text-sm"} text-foreground smooth-shadow-ring-md${hideStackedContent ? ` ${hideStackedContentClassName}` : ""}`,
|
|
144
|
-
// `unstyled` drops sonner's `[data-content]` grow, so the text column grows
|
|
145
|
-
// here and the action and cancel buttons sit at the right edge.
|
|
146
78
|
content: "flex min-w-0 grow flex-col",
|
|
147
|
-
// `unstyled` also drops sonner's `position: relative` on `[data-icon]`, so
|
|
148
|
-
// the absolutely positioned `.sonner-loader` anchors here, not to the toast.
|
|
149
79
|
icon: "relative",
|
|
150
80
|
title: titleLeading === "5" ? "font-medium leading-5" : "font-medium leading-snug",
|
|
151
81
|
description: descriptionMuted
|
|
@@ -165,7 +95,6 @@ function createToasterClassNames({
|
|
|
165
95
|
};
|
|
166
96
|
}
|
|
167
97
|
|
|
168
|
-
/** Per key, joins the default class string and the caller string (defaults first, so callers win). */
|
|
169
98
|
function mergeToastClassNames(
|
|
170
99
|
defaults: ToastClassNames,
|
|
171
100
|
overrides?: ToastClassNames,
|
|
@@ -180,7 +109,6 @@ function mergeToastClassNames(
|
|
|
180
109
|
return merged as ToastClassNames;
|
|
181
110
|
}
|
|
182
111
|
|
|
183
|
-
/** Sonner variables read from `--color-*` tokens. Work with `tokens.css` and the compat file. */
|
|
184
112
|
const sonnerVarsStyle: ToasterStyle = {
|
|
185
113
|
fontFamily: "inherit",
|
|
186
114
|
"--normal-bg": "var(--color-card)",
|
|
@@ -190,7 +118,6 @@ const sonnerVarsStyle: ToasterStyle = {
|
|
|
190
118
|
"--normal-border-hover": "var(--color-border)",
|
|
191
119
|
};
|
|
192
120
|
|
|
193
|
-
/** `{ ...defaults, ...overrides }`. The package adds no style keys unless `sonnerVars` is on. */
|
|
194
121
|
function mergeToasterStyle(
|
|
195
122
|
defaults: CSSProperties | undefined,
|
|
196
123
|
overrides: CSSProperties | undefined,
|
|
@@ -199,7 +126,6 @@ function mergeToasterStyle(
|
|
|
199
126
|
return overrides ? { ...defaults, ...overrides } : defaults;
|
|
200
127
|
}
|
|
201
128
|
|
|
202
|
-
/** Package defaults first. Caller wins per field, except `classNames`, which merge. */
|
|
203
129
|
function mergeToastOptions(
|
|
204
130
|
defaults: NonNullable<ToasterProps["toastOptions"]>,
|
|
205
131
|
overrides?: ToasterProps["toastOptions"],
|
|
@@ -212,7 +138,6 @@ function mergeToastOptions(
|
|
|
212
138
|
};
|
|
213
139
|
}
|
|
214
140
|
|
|
215
|
-
/** `{ ...defaults, ...props }`, except that a prop set to `undefined` keeps its default. */
|
|
216
141
|
function withConfigDefaults<T extends object>(defaults: Partial<T> | undefined, props: T): T {
|
|
217
142
|
const merged = { ...defaults, ...props };
|
|
218
143
|
for (const key in defaults) {
|
|
@@ -222,12 +147,9 @@ function withConfigDefaults<T extends object>(defaults: Partial<T> | undefined,
|
|
|
222
147
|
return merged;
|
|
223
148
|
}
|
|
224
149
|
|
|
225
|
-
/** Defaults come from `UiConfig.SonnerToaster` when the app sets it; explicit props win. */
|
|
226
150
|
function SonnerToaster(props: ToasterProps & SonnerToasterOptions) {
|
|
227
151
|
const {
|
|
228
152
|
classes,
|
|
229
|
-
// Defaulted here, not by spreading after a literal, so `position={undefined}`
|
|
230
|
-
// still gets top-right rather than sonner's bottom-right.
|
|
231
153
|
position = defaultToasterPosition,
|
|
232
154
|
mobileOffset = defaultMobileOffset,
|
|
233
155
|
toastRadius,
|
package/src/ui/spinner.tsx
CHANGED
|
@@ -28,63 +28,32 @@ export interface SpinnerMark {
|
|
|
28
28
|
|
|
29
29
|
/** Stroke colours of the `circle` variant. Each defaults to `currentColor`. */
|
|
30
30
|
export interface SpinnerCircleColors {
|
|
31
|
-
/** The faint full ring (drawn at 20% opacity). */
|
|
32
31
|
track?: string;
|
|
33
|
-
/** The longer arc. */
|
|
34
32
|
arc?: string;
|
|
35
|
-
/** The shorter arc drawn over the leading half of `arc`. */
|
|
36
33
|
lead?: string;
|
|
37
34
|
}
|
|
38
35
|
|
|
39
36
|
export interface SpinnerConfig {
|
|
40
|
-
/** Default for the `mark` prop: every `<Spinner />` without a `variant` draws this mark. */
|
|
41
37
|
mark?: SpinnerMark;
|
|
42
|
-
/** Default for the `colors` prop of the `circle` variant. */
|
|
43
38
|
circle?: SpinnerCircleColors;
|
|
44
39
|
}
|
|
45
40
|
|
|
46
41
|
export type SpinnerProps = Omit<React.ComponentPropsWithoutRef<"svg">, "size" | "stroke"> & {
|
|
47
|
-
/**
|
|
48
|
-
* What to draw. Without it: the `mark` (prop, else `UiConfig.Spinner.mark`),
|
|
49
|
-
* else the loader icon. An explicit `variant` wins over the configured mark.
|
|
50
|
-
* - `"icon"`: the rotating loader icon.
|
|
51
|
-
* - `"circle"`: a faint ring with a two-tone arc sweeping around it, for
|
|
52
|
-
* small slots (inline buttons, menu rows) where a mark is too small to read.
|
|
53
|
-
* - `"ring"`: the `Button` loading ring, a fixed 16px (`h-4 w-4`) ring and arc
|
|
54
|
-
* in `currentColor`. Unlabelled (the button's `disabled` and `data-loading`
|
|
55
|
-
* carry the state); `size`, `tone`, `stroke` and `decorative` do not apply.
|
|
56
|
-
*/
|
|
57
42
|
variant?: "icon" | "circle" | "ring";
|
|
58
|
-
/** Named size (a `size-*` class; `default` is an alias of `md`) or a pixel size (`width`/`height`, no size class). Default `"md"`. Not used with `"ring"`. */
|
|
59
43
|
size?: "sm" | "md" | "default" | "lg" | number;
|
|
60
|
-
/** Icon stroke width. Default the icon's own (2). Only for `"icon"`. */
|
|
61
44
|
stroke?: number | string;
|
|
62
|
-
/** `"muted"` adds `text-muted-foreground`; `"inherit"` adds no colour class, so the icon uses `currentColor`. Default `"muted"`. Only for `"icon"`. */
|
|
63
45
|
tone?: "muted" | "inherit";
|
|
64
|
-
/** Hide from assistive tech (`aria-hidden`, no `role="status"` or label), e.g. inside a labelled button. Default `false`. Not used with `"ring"`. */
|
|
65
46
|
decorative?: boolean;
|
|
66
|
-
/** Draw this outline with a running dash instead of the loader icon. Default `UiConfig.Spinner.mark`, else none. Ignored with a `variant`. */
|
|
67
47
|
mark?: SpinnerMark;
|
|
68
|
-
/** Stroke colours of the `"circle"` variant. Default `UiConfig.Spinner.circle`, else `currentColor`. */
|
|
69
48
|
colors?: SpinnerCircleColors;
|
|
70
49
|
};
|
|
71
50
|
|
|
72
|
-
/** Props every variant renderer takes: the svg props plus the shared ones. */
|
|
73
51
|
type VariantProps = Omit<SpinnerProps, "variant" | "mark" | "stroke" | "tone" | "colors">;
|
|
74
52
|
|
|
75
53
|
function a11yProps(decorative: boolean) {
|
|
76
54
|
return decorative ? { "aria-hidden": true } : { role: "status", "aria-label": "Loading" };
|
|
77
55
|
}
|
|
78
56
|
|
|
79
|
-
/**
|
|
80
|
-
* Runs the dash around one shape: `stroke-dashoffset` 0 → -1 over 2s, forever,
|
|
81
|
-
* against `pathLength=1`. Web Animations rather than SMIL `<animate>`: SMIL
|
|
82
|
-
* ticks each shape's animated attribute on its own (a style recalc per shape
|
|
83
|
-
* per frame); WAAPI folds into the frame's single recalc and needs no app
|
|
84
|
-
* keyframes. {@link bindRuntimeAnimation} pauses it while the tab is hidden or
|
|
85
|
-
* the shape is off screen. Module-level so the ref identity is stable across
|
|
86
|
-
* renders; React 19 runs the returned cleanup on detach.
|
|
87
|
-
*/
|
|
88
57
|
function traceDash(shape: SVGGeometryElement | null): (() => void) | undefined {
|
|
89
58
|
if (!shape) return undefined;
|
|
90
59
|
const trace = shape.animate(
|
|
@@ -145,12 +114,6 @@ function MarkSpinner({
|
|
|
145
114
|
);
|
|
146
115
|
}
|
|
147
116
|
|
|
148
|
-
/**
|
|
149
|
-
* Rotates the arc around the viewBox centre, forever. Web Animations rather
|
|
150
|
-
* than a CSS class: WAAPI gives {@link bindRuntimeAnimation} a handle to pause
|
|
151
|
-
* the loop while the tab is hidden or the spinner is off screen, which a CSS
|
|
152
|
-
* `animate-spin` cannot offer. Module-level so the ref identity is stable.
|
|
153
|
-
*/
|
|
154
117
|
function spinArc(arc: SVGGElement): () => void {
|
|
155
118
|
const spin = arc.animate(
|
|
156
119
|
[{ transform: "rotate(0deg)" }, { transform: "rotate(360deg)" }],
|
|
@@ -159,14 +122,6 @@ function spinArc(arc: SVGGElement): () => void {
|
|
|
159
122
|
return bindRuntimeAnimation(arc, spin);
|
|
160
123
|
}
|
|
161
124
|
|
|
162
|
-
/**
|
|
163
|
-
* The `circle` variant: a faint full ring with a two-tone arc sweeping around it.
|
|
164
|
-
*
|
|
165
|
-
* The arc is two circles rather than one gradient stroke: a gradient only
|
|
166
|
-
* samples the slice of its box the arc crosses, so at 12–16px one end washes
|
|
167
|
-
* out. Drawing `lead` over the leading half of a longer `arc` dash keeps both
|
|
168
|
-
* colours legible at every size, and needs no per-instance gradient id.
|
|
169
|
-
*/
|
|
170
125
|
function CircleSpinner({
|
|
171
126
|
colors,
|
|
172
127
|
size = "md",
|
|
@@ -215,7 +170,6 @@ function CircleSpinner({
|
|
|
215
170
|
);
|
|
216
171
|
}
|
|
217
172
|
|
|
218
|
-
/** The `ring` variant: the `Button` loading ring, a fixed markup with a CSS `animate-spin`. */
|
|
219
173
|
function RingSpinner({
|
|
220
174
|
className,
|
|
221
175
|
size: _size,
|
|
@@ -231,10 +185,6 @@ function RingSpinner({
|
|
|
231
185
|
);
|
|
232
186
|
}
|
|
233
187
|
|
|
234
|
-
/**
|
|
235
|
-
* The one loading spinner: the loader icon, an app mark with a running dash,
|
|
236
|
-
* the two-tone `circle`, or the `Button` `ring`. See {@link SpinnerProps.variant}.
|
|
237
|
-
*/
|
|
238
188
|
function Spinner({ variant, mark, colors, stroke, tone = "muted", ...props }: SpinnerProps) {
|
|
239
189
|
const config = useUiConfig("Spinner");
|
|
240
190
|
const merge = useCn();
|
package/src/ui/status-dot.tsx
CHANGED
|
@@ -8,25 +8,16 @@ export type StatusTone =
|
|
|
8
8
|
| "code-review"
|
|
9
9
|
| "done"
|
|
10
10
|
| "cancelled"
|
|
11
|
-
/**
|
|
12
|
-
* Live/online/enabled. Distinct from `done`: this is a *state* something is
|
|
13
|
-
* currently in, not a workflow stage it has reached.
|
|
14
|
-
*/
|
|
15
11
|
| "active"
|
|
16
|
-
/** Something is wrong and needs attention: a critical finding, a hard error. */
|
|
17
12
|
| "critical"
|
|
18
13
|
| "neutral";
|
|
19
14
|
|
|
20
15
|
export interface StatusDotConfig {
|
|
21
|
-
/** Replaces the built-in classes of a part. */
|
|
22
16
|
classes?: {
|
|
23
|
-
/** Fill class per tone. A tone left out keeps its built-in class. */
|
|
24
17
|
tone?: Partial<Record<StatusTone, string>>;
|
|
25
18
|
};
|
|
26
19
|
}
|
|
27
20
|
|
|
28
|
-
// Plain Record so Tailwind's static-class scanner can see every literal
|
|
29
|
-
// class here — a computed `bg-${tone}` string would not survive the purge.
|
|
30
21
|
const TONE_CLASS: Record<StatusTone, string> = {
|
|
31
22
|
progress: "bg-warning",
|
|
32
23
|
"business-review": "bg-primary",
|
|
@@ -45,7 +36,6 @@ const SIZE_CLASS: Record<"sm" | "md", string> = {
|
|
|
45
36
|
|
|
46
37
|
export interface StatusDotProps extends HTMLAttributes<HTMLSpanElement> {
|
|
47
38
|
tone: StatusTone;
|
|
48
|
-
/** Slightly larger dot for detail views. Default "sm". */
|
|
49
39
|
size?: "sm" | "md";
|
|
50
40
|
ref?: Ref<HTMLSpanElement>;
|
|
51
41
|
}
|
package/src/ui/surface.tsx
CHANGED
|
@@ -4,27 +4,14 @@ import { cva, type VariantProps } from "class-variance-authority";
|
|
|
4
4
|
import { useCn } from "./ui-config";
|
|
5
5
|
import { SURFACE_RADIUS_CLASS } from "../utils/surface-radius";
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* A panel with the card fill and one of four paddings.
|
|
9
|
-
*
|
|
10
|
-
* `Card` splits padding across Header / Content / Footer, which is right for a
|
|
11
|
-
* titled card and wrong for a box that just needs one padding. Density is a
|
|
12
|
-
* prop rather than a `className` so the paddings stay a closed set;
|
|
13
|
-
* `className` still overrides when a layout needs it.
|
|
14
|
-
*/
|
|
15
7
|
const surfaceVariants = cva(
|
|
16
8
|
`${SURFACE_RADIUS_CLASS} bg-card text-card-foreground`,
|
|
17
9
|
{
|
|
18
10
|
variants: {
|
|
19
11
|
density: {
|
|
20
|
-
// Dense list items and inline panels.
|
|
21
12
|
tight: "p-3",
|
|
22
|
-
// The default box: settings sections, stat cards, banners.
|
|
23
13
|
default: "p-4",
|
|
24
|
-
// Standalone cards that carry a heading of their own.
|
|
25
14
|
comfortable: "p-6",
|
|
26
|
-
// The caller owns padding entirely — for surfaces with their own
|
|
27
|
-
// internal regions, such as a table that must reach the edge.
|
|
28
15
|
none: "",
|
|
29
16
|
},
|
|
30
17
|
},
|
package/src/ui/switch.tsx
CHANGED
|
@@ -8,27 +8,96 @@ export interface SwitchConfig {
|
|
|
8
8
|
classes?: { root?: string; thumb?: string };
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
const PRESSED_THUMB_PX = 24;
|
|
12
|
+
const DRAG_THRESHOLD_PX = 3;
|
|
13
|
+
|
|
11
14
|
const Switch = React.forwardRef<
|
|
12
15
|
React.ComponentRef<typeof SwitchPrimitive.Root>,
|
|
13
16
|
React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root>
|
|
14
|
-
>(({ className, ...props }, ref) => {
|
|
17
|
+
>(({ className, onPointerDown, onPointerMove, onPointerUp, onPointerCancel, onClick, ...props }, ref) => {
|
|
15
18
|
const classes = useUiConfig("Switch")?.classes;
|
|
16
19
|
const merge = useCn();
|
|
20
|
+
const [dragX, setDragX] = React.useState<number | null>(null);
|
|
21
|
+
const drag = React.useRef({ startClientX: 0, startX: 0, active: false, moved: false });
|
|
22
|
+
const swallowClick = React.useRef(false);
|
|
23
|
+
const programmatic = React.useRef(false);
|
|
24
|
+
|
|
25
|
+
const range = (el: HTMLElement) => Math.max(0, el.clientWidth - PRESSED_THUMB_PX);
|
|
26
|
+
const wantsChecked = (el: HTMLElement, x: number) => x + PRESSED_THUMB_PX / 2 > el.clientWidth / 2;
|
|
27
|
+
|
|
28
|
+
const finish = (event: React.PointerEvent<HTMLButtonElement>) => {
|
|
29
|
+
const state = drag.current;
|
|
30
|
+
if (!state.active) return;
|
|
31
|
+
state.active = false;
|
|
32
|
+
const el = event.currentTarget;
|
|
33
|
+
if (state.moved) {
|
|
34
|
+
swallowClick.current = true;
|
|
35
|
+
const x = Math.min(Math.max(state.startX + event.clientX - state.startClientX, 0), range(el));
|
|
36
|
+
if (wantsChecked(el, x) !== (el.dataset.state === "checked")) {
|
|
37
|
+
programmatic.current = true;
|
|
38
|
+
el.click();
|
|
39
|
+
programmatic.current = false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
setDragX(null);
|
|
43
|
+
};
|
|
44
|
+
|
|
17
45
|
return (
|
|
18
46
|
<SwitchPrimitive.Root
|
|
19
47
|
className={merge(
|
|
20
48
|
classes?.root ??
|
|
21
|
-
"peer relative inline-flex h-5 w-
|
|
49
|
+
"peer group relative inline-flex h-5 w-12 shrink-0 cursor-pointer touch-pan-y select-none items-center rounded-full border border-border bg-default transition-[background-color,border-color] duration-200 ease-smooth focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=unchecked]:bg-default dark:data-[state=unchecked]:border-muted/60 dark:data-[state=unchecked]:bg-muted/40 before:absolute before:inset-[-8px] before:content-['']", // check-tokens-allow: muted
|
|
22
50
|
className,
|
|
23
51
|
)}
|
|
24
52
|
{...props}
|
|
25
53
|
ref={ref}
|
|
54
|
+
onClick={(event) => {
|
|
55
|
+
onClick?.(event);
|
|
56
|
+
if (swallowClick.current && !programmatic.current) {
|
|
57
|
+
swallowClick.current = false;
|
|
58
|
+
event.preventDefault();
|
|
59
|
+
}
|
|
60
|
+
}}
|
|
61
|
+
onPointerDown={(event) => {
|
|
62
|
+
onPointerDown?.(event);
|
|
63
|
+
if (props.disabled || event.button !== 0) return;
|
|
64
|
+
swallowClick.current = false;
|
|
65
|
+
const el = event.currentTarget;
|
|
66
|
+
drag.current = {
|
|
67
|
+
startClientX: event.clientX,
|
|
68
|
+
startX: el.dataset.state === "checked" ? range(el) : 0,
|
|
69
|
+
active: true,
|
|
70
|
+
moved: false,
|
|
71
|
+
};
|
|
72
|
+
el.setPointerCapture(event.pointerId);
|
|
73
|
+
}}
|
|
74
|
+
onPointerMove={(event) => {
|
|
75
|
+
onPointerMove?.(event);
|
|
76
|
+
const state = drag.current;
|
|
77
|
+
if (!state.active) return;
|
|
78
|
+
const dx = event.clientX - state.startClientX;
|
|
79
|
+
if (!state.moved && Math.abs(dx) < DRAG_THRESHOLD_PX) return;
|
|
80
|
+
state.moved = true;
|
|
81
|
+
setDragX(Math.min(Math.max(state.startX + dx, 0), range(event.currentTarget)));
|
|
82
|
+
}}
|
|
83
|
+
onPointerUp={(event) => {
|
|
84
|
+
onPointerUp?.(event);
|
|
85
|
+
finish(event);
|
|
86
|
+
}}
|
|
87
|
+
onPointerCancel={(event) => {
|
|
88
|
+
onPointerCancel?.(event);
|
|
89
|
+
drag.current.active = false;
|
|
90
|
+
drag.current.moved = false;
|
|
91
|
+
setDragX(null);
|
|
92
|
+
}}
|
|
26
93
|
>
|
|
27
94
|
<SwitchPrimitive.Thumb
|
|
95
|
+
data-dragging={dragX === null ? undefined : ""}
|
|
96
|
+
style={dragX === null ? undefined : ({ "--switch-x": `${dragX}px` } as React.CSSProperties)}
|
|
28
97
|
className={
|
|
29
98
|
classes?.thumb ??
|
|
30
99
|
cn(
|
|
31
|
-
"pointer-events-none block
|
|
100
|
+
"pointer-events-none block h-4 w-4 rounded-full bg-background shadow-sm ring-0 [transition-property:transform,translate,width,background-color,box-shadow,backdrop-filter] duration-200 ease-smooth motion-reduce:transition-none data-[state=checked]:translate-x-[30px] data-[state=checked]:bg-primary-foreground data-[state=unchecked]:translate-x-0 dark:data-[state=unchecked]:bg-foreground group-active:w-6 group-active:data-[state=checked]:translate-x-[22px] group-active:bg-background/60 group-active:backdrop-blur-[2px] group-active:backdrop-saturate-150 group-active:shadow-[inset_0_1px_1px_rgb(255_255_255/0.9),0_4px_12px_rgb(0_0_0/0.2)] group-disabled:group-active:w-4 group-disabled:group-active:data-[state=checked]:translate-x-[30px] data-[dragging]:translate-x-(--switch-x)! data-[dragging]:[transition-property:width,background-color,box-shadow,backdrop-filter]",
|
|
32
101
|
)
|
|
33
102
|
}
|
|
34
103
|
/>
|
package/src/ui/table.tsx
CHANGED
|
@@ -2,9 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import { useCn, useUiConfig } from "./ui-config";
|
|
3
3
|
|
|
4
4
|
export interface TableConfig {
|
|
5
|
-
/** Replaces the built-in classes of a part. A part left out keeps its default. */
|
|
6
5
|
classes?: {
|
|
7
|
-
/** The scroll wrapper `<div>` around the `<table>`. */
|
|
8
6
|
wrapper?: string;
|
|
9
7
|
table?: string;
|
|
10
8
|
header?: string;
|
|
@@ -17,7 +15,6 @@ export interface TableConfig {
|
|
|
17
15
|
};
|
|
18
16
|
}
|
|
19
17
|
|
|
20
|
-
/** The app's class string for `part` (else `fallback`), merged with the caller `className`. */
|
|
21
18
|
function useTableClass(
|
|
22
19
|
part: keyof NonNullable<TableConfig["classes"]>,
|
|
23
20
|
fallback: string,
|
|
@@ -26,7 +26,6 @@ const variants: Record<Exclude<TabsTransitionVariant, "none">, Variants> = {
|
|
|
26
26
|
slide: {
|
|
27
27
|
enter: (dir: Direction) => ({ x: dir * SLIDE_PX, opacity: 0 }),
|
|
28
28
|
center: { x: 0, opacity: 1, transition: { duration: 0.24, ease: motionEase } },
|
|
29
|
-
// Leaves faster than it enters, so the old panel never lingers.
|
|
30
29
|
exit: (dir: Direction) => ({
|
|
31
30
|
x: -dir * SLIDE_PX,
|
|
32
31
|
opacity: 0,
|
|
@@ -44,20 +43,11 @@ const variants: Record<Exclude<TabsTransitionVariant, "none">, Variants> = {
|
|
|
44
43
|
};
|
|
45
44
|
|
|
46
45
|
export interface TabsTransitionProps {
|
|
47
|
-
/** The selected tab. A new value plays the transition. */
|
|
48
46
|
value: string;
|
|
49
|
-
/** Tab values in their on-screen order, left to right; gives the direction. */
|
|
50
47
|
order: ReadonlyArray<string>;
|
|
51
|
-
/** Defaults to the app's `UiConfig.Tabs.transition`, then `"none"`. */
|
|
52
48
|
variant?: TabsTransitionVariant;
|
|
53
49
|
className?: string;
|
|
54
|
-
/**
|
|
55
|
-
* Classes on the moving panel. Full-height layouts pass the same flex
|
|
56
|
-
* classes as their container (`flex min-h-0 flex-1 flex-col`) so the panel
|
|
57
|
-
* still fills it.
|
|
58
|
-
*/
|
|
59
50
|
panelClassName?: string;
|
|
60
|
-
/** The selected tab's content. */
|
|
61
51
|
children: ReactNode;
|
|
62
52
|
}
|
|
63
53
|
|
|
@@ -78,8 +68,6 @@ export function TabsTransition({
|
|
|
78
68
|
}: TabsTransitionProps) {
|
|
79
69
|
const configVariant = useUiConfig("Tabs")?.transition;
|
|
80
70
|
const variant = variantProp ?? configVariant ?? "none";
|
|
81
|
-
// Direction follows the move from the previous tab to this one. Derived in
|
|
82
|
-
// render (adjust-state-on-change), so the first frame already knows it.
|
|
83
71
|
const [previous, setPrevious] = useState(value);
|
|
84
72
|
const [direction, setDirection] = useState<Direction>(1);
|
|
85
73
|
if (value !== previous) {
|
package/src/ui/tabs.tsx
CHANGED
|
@@ -8,10 +8,6 @@ import { useCn, useUiConfig } from "./ui-config";
|
|
|
8
8
|
|
|
9
9
|
const Tabs = TabsPrimitive.Root;
|
|
10
10
|
|
|
11
|
-
// `pills` (default): isolated rounded pills with a gap, no shared track.
|
|
12
|
-
// `segmented`: connected bar with a sliding pill, kept for marketing surfaces.
|
|
13
|
-
// `soft`: borderless wrapping pills, the active one filled. Uses no `t-tabs`
|
|
14
|
-
// CSS, so triggers can hold an absolutely placed child (e.g. a progress bar).
|
|
15
11
|
type TabsListVariant = "pills" | "segmented" | "soft";
|
|
16
12
|
type TabsListSize = "default" | "sm";
|
|
17
13
|
|
|
@@ -25,7 +21,6 @@ type TabsListSize = "default" | "sm";
|
|
|
25
21
|
export interface TabsConfig {
|
|
26
22
|
variant?: TabsListVariant;
|
|
27
23
|
pillMotion?: TabsPillMotion;
|
|
28
|
-
/** Default `TabsTransition` variant for every tab set in the app. */
|
|
29
24
|
transition?: TabsTransitionVariant;
|
|
30
25
|
classes?: {
|
|
31
26
|
list?: string;
|
|
@@ -36,7 +31,6 @@ export interface TabsConfig {
|
|
|
36
31
|
};
|
|
37
32
|
}
|
|
38
33
|
|
|
39
|
-
// `sm` shrinks the triggers from the list, so callers do not size each one.
|
|
40
34
|
const tabsListSizeClasses: Record<TabsListSize, string> = {
|
|
41
35
|
default: "",
|
|
42
36
|
sm: "[&_.t-tab]:px-2.5 [&_.t-tab]:py-1 [&_.t-tab]:text-xs",
|
|
@@ -48,9 +42,7 @@ const TabsList = React.forwardRef<
|
|
|
48
42
|
React.ComponentRef<typeof TabsPrimitive.List>,
|
|
49
43
|
React.ComponentPropsWithoutRef<typeof TabsPrimitive.List> & {
|
|
50
44
|
variant?: TabsListVariant;
|
|
51
|
-
/** `sm` makes the triggers smaller. No classes for `default`. */
|
|
52
45
|
size?: TabsListSize;
|
|
53
|
-
/** How the segmented pill moves. Overrides `UiConfig.Tabs.pillMotion`. */
|
|
54
46
|
pillMotion?: TabsPillMotion;
|
|
55
47
|
}
|
|
56
48
|
>(({ className, children, variant: variantProp, size, pillMotion: pillMotionProp, ...props }, ref) => {
|
|
@@ -214,11 +206,6 @@ export const tabsBarVariants = cva(
|
|
|
214
206
|
},
|
|
215
207
|
);
|
|
216
208
|
|
|
217
|
-
/**
|
|
218
|
-
* Page- or panel-level tab strip: a `TabsList` on the hairline that divides it
|
|
219
|
-
* from the content below, with an optional trailing `actions` slot for toolbar
|
|
220
|
-
* controls. `size="sm"` for nested panels; `className` overrides the padding.
|
|
221
|
-
*/
|
|
222
209
|
const TabsBar = React.forwardRef<
|
|
223
210
|
HTMLDivElement,
|
|
224
211
|
React.ComponentPropsWithoutRef<"div"> &
|
|
@@ -236,10 +223,6 @@ const TabsBar = React.forwardRef<
|
|
|
236
223
|
});
|
|
237
224
|
TabsBar.displayName = "TabsBar";
|
|
238
225
|
|
|
239
|
-
// raw radix primitives, use these when you need a tabs layout that the
|
|
240
|
-
// styled `tabs`/`tabslist`/`tabstrigger`/`tabscontent` defaults don't fit
|
|
241
|
-
// (e.g a vertical sidebar of tabs inside a popover) the styled exports
|
|
242
|
-
// above are tuned for horizontal pill, style tab bars
|
|
243
226
|
export { TabsPrimitive };
|
|
244
227
|
|
|
245
228
|
export { Tabs, TabsBar, TabsList, TabsTrigger, TabsContent };
|