motion-ui-skill 2.0.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 +22 -0
- package/README.md +637 -0
- package/SKILL.md +529 -0
- package/agents/openai.yaml +8 -0
- package/bin/index.mjs +242 -0
- package/bin/installer.mjs +457 -0
- package/bin/updater.mjs +207 -0
- package/catalog.json +8120 -0
- package/components/agents/agent-activity/activity-row.tsx +242 -0
- package/components/agents/agent-activity/index.tsx +287 -0
- package/components/agents/agent-activity/types.ts +106 -0
- package/components/agents/agent-code.tsx +171 -0
- package/components/agents/agent-disclosure.tsx +55 -0
- package/components/agents/ai-sidebar.tsx +981 -0
- package/components/agents/approval-card/index.tsx +467 -0
- package/components/agents/approval-card/types.ts +56 -0
- package/components/agents/chat-app.tsx +97 -0
- package/components/agents/citations.tsx +288 -0
- package/components/agents/code-block.tsx +202 -0
- package/components/agents/file-diff.tsx +288 -0
- package/components/agents/image-generation.tsx +388 -0
- package/components/agents/loading-states/agent-progress.tsx +105 -0
- package/components/agents/loading-states/index.ts +13 -0
- package/components/agents/loading-states/reasoning-text.tsx +224 -0
- package/components/agents/loading-states/thinking-shimmer.tsx +27 -0
- package/components/agents/message-bubble.tsx +369 -0
- package/components/agents/message-context.tsx +9 -0
- package/components/agents/message-scroller.tsx +487 -0
- package/components/agents/message.tsx +272 -0
- package/components/agents/prompt-input.tsx +327 -0
- package/components/agents/streaming-response.tsx +263 -0
- package/components/agents/todo-list.tsx +387 -0
- package/components/agents/tool-approval.tsx +276 -0
- package/components/agents/tool-result.tsx +352 -0
- package/components/app/icons.tsx +19 -0
- package/components/audio/music-player-card.tsx +146 -0
- package/components/audio/music-playlist-card.tsx +172 -0
- package/components/audio/now-playing-bar.tsx +116 -0
- package/components/background-gradient/arc-bands-background.tsx +54 -0
- package/components/background-gradient/aurora-background.tsx +49 -0
- package/components/background-gradient/cherry-petal-background.tsx +50 -0
- package/components/background-gradient/coral-glow-background.tsx +47 -0
- package/components/background-gradient/dark-arc-bands-background.tsx +52 -0
- package/components/background-gradient/dark-aurora-background.tsx +52 -0
- package/components/background-gradient/dark-carbon-spotlight-background.tsx +47 -0
- package/components/background-gradient/dark-ember-background.tsx +47 -0
- package/components/background-gradient/dark-ink-field-background.tsx +46 -0
- package/components/background-gradient/dark-midnight-mesh-background.tsx +61 -0
- package/components/background-gradient/dark-rose-noir-background.tsx +52 -0
- package/components/background-gradient/dark-teal-depth-background.tsx +52 -0
- package/components/background-gradient/frost-mesh-background.tsx +56 -0
- package/components/background-gradient/halftone-pop-background.tsx +52 -0
- package/components/background-gradient/honey-ember-background.tsx +47 -0
- package/components/background-gradient/ink-wash-background.tsx +49 -0
- package/components/background-gradient/linen-weave-background.tsx +47 -0
- package/components/background-gradient/mint-lagoon-background.tsx +47 -0
- package/components/background-gradient/paper-fold-background.tsx +52 -0
- package/components/background-gradient/rain-prism-background.tsx +52 -0
- package/components/background-gradient/sand-drift-background.tsx +47 -0
- package/components/background-gradient/soft-spotlight-background.tsx +47 -0
- package/components/background-gradient/sunrise-horizon-background.tsx +51 -0
- package/components/background-gradient/sunset-bloom-background.tsx +47 -0
- package/components/background-gradient/terrazzo-fragment-background.tsx +53 -0
- package/components/background-gradient/tropical-tide-background.tsx +47 -0
- package/components/background-pattern/diagonal-box-pattern.tsx +29 -0
- package/components/background-pattern/dot-grid-pattern.tsx +29 -0
- package/components/background-pattern/fine-grain-pattern.tsx +39 -0
- package/components/background-pattern/graph-paper-pattern.tsx +29 -0
- package/components/background-pattern/line-grid-pattern.tsx +39 -0
- package/components/background-pattern/reverse-diagonal-box-pattern.tsx +30 -0
- package/components/buttons/add-to-cart-button.tsx +190 -0
- package/components/buttons/bookmark-save-button.tsx +105 -0
- package/components/buttons/cinder-latch-button.tsx +80 -0
- package/components/buttons/copy-button.tsx +155 -0
- package/components/buttons/depth-outline-button.tsx +72 -0
- package/components/buttons/dimple-switch.tsx +114 -0
- package/components/buttons/download-button.tsx +186 -0
- package/components/buttons/follow-button.tsx +98 -0
- package/components/buttons/hold-to-delete-button.tsx +205 -0
- package/components/buttons/inset-button.tsx +82 -0
- package/components/buttons/like-button.tsx +135 -0
- package/components/buttons/linen-tab-button.tsx +92 -0
- package/components/buttons/prism-depth-button.tsx +90 -0
- package/components/buttons/quantity-stepper-button.tsx +104 -0
- package/components/buttons/segmented-toggle-button.tsx +134 -0
- package/components/buttons/sheen-pill-button.tsx +127 -0
- package/components/buttons/slate-chip-switch.tsx +94 -0
- package/components/buttons/slide-to-confirm-button.tsx +163 -0
- package/components/buttons/soft-pill-button.tsx +86 -0
- package/components/buttons/soft-ui-button.tsx +59 -0
- package/components/buttons/three-d-button.tsx +99 -0
- package/components/buttons/three-d-icon-button.tsx +88 -0
- package/components/calendar/booking-slot-calendar.tsx +315 -0
- package/components/calendar/date-range-picker-card.tsx +216 -0
- package/components/calendar/event-countdown-card.tsx +105 -0
- package/components/calendar/month-picker-calendar.tsx +183 -0
- package/components/calendar/week-strip-calendar.tsx +182 -0
- package/components/contact/copy-email.tsx +94 -0
- package/components/docks/Icons.tsx +222 -0
- package/components/docks/app-dock.tsx +111 -0
- package/components/docks/editor-tool-dock.tsx +113 -0
- package/components/docks/mac-dock.tsx +144 -0
- package/components/docks/presence-dock.tsx +178 -0
- package/components/docks/spotlight-bar.tsx +188 -0
- package/components/dropdowns/file-menu-dropdown.tsx +192 -0
- package/components/dropdowns/filter-sort-dropdown.tsx +189 -0
- package/components/dropdowns/kebab-actions-dropdown.tsx +195 -0
- package/components/dropdowns/notification-dropdown.tsx +235 -0
- package/components/dropdowns/share-menu-dropdown.tsx +197 -0
- package/components/dropdowns/user-menu-dropdown.tsx +251 -0
- package/components/dropdowns/workspace-switcher-dropdown.tsx +248 -0
- package/components/event/event-ticket-card.tsx +116 -0
- package/components/files/ink-stamp-document-card.tsx +88 -0
- package/components/files/stacked-folder-card.tsx +176 -0
- package/components/folder/folder-tab-card.tsx +123 -0
- package/components/forms/contact-form.tsx +417 -0
- package/components/forms/forgot-password-form.tsx +264 -0
- package/components/forms/login-form.tsx +342 -0
- package/components/forms/newsletter-form.tsx +212 -0
- package/components/forms/signup-form.tsx +487 -0
- package/components/frames/circle-cut-frame.tsx +198 -0
- package/components/frames/hard-shadow-polaroid-frame.tsx +158 -0
- package/components/frames/sticky-note-polaroid-frame.tsx +230 -0
- package/components/frames/transform-box-frame.tsx +287 -0
- package/components/frames/transform-plus-frame.tsx +308 -0
- package/components/gallery/film-strip-card.tsx +103 -0
- package/components/gallery/gallery-grid-card.tsx +106 -0
- package/components/gallery/gallery-wall-card.tsx +71 -0
- package/components/gallery/glass-overlay-image-card.tsx +156 -0
- package/components/gallery/museum-placard-card.tsx +105 -0
- package/components/gallery/photo-album-card.tsx +114 -0
- package/components/gallery/photo-contact-sheet-card.tsx +71 -0
- package/components/gallery/polaroid-image-card.tsx +81 -0
- package/components/gallery/slow-living-polaroid-card.tsx +88 -0
- package/components/gallery/stamp-postcard-card.tsx +78 -0
- package/components/inputs/checkbox-field-input.tsx +148 -0
- package/components/inputs/combobox-field-input.tsx +466 -0
- package/components/inputs/date-field-input.tsx +472 -0
- package/components/inputs/file-upload-field-input.tsx +578 -0
- package/components/inputs/floating-label-field-input.tsx +206 -0
- package/components/inputs/input-group-field.tsx +132 -0
- package/components/inputs/password-field-input.tsx +125 -0
- package/components/inputs/phone-field-input.tsx +157 -0
- package/components/inputs/radio-group-field-input.tsx +220 -0
- package/components/inputs/search-input.tsx +163 -0
- package/components/inputs/select-field-input.tsx +416 -0
- package/components/inputs/switch-field-input.tsx +179 -0
- package/components/inputs/text-field-input.tsx +89 -0
- package/components/inputs/textarea-field-input.tsx +152 -0
- package/components/loaders/apple-hello-loader.tsx +86 -0
- package/components/loaders/spin-loader.tsx +51 -0
- package/components/loaders/text-loader.tsx +148 -0
- package/components/mockups/apple-ipod-mockup-card.tsx +155 -0
- package/components/mockups/apple-watch-mockup-card.tsx +278 -0
- package/components/mockups/browser-mockup-card.tsx +109 -0
- package/components/mockups/laptop-mockup-card.tsx +118 -0
- package/components/mockups/phone-mockup-card.tsx +210 -0
- package/components/mockups/tablet-mockup-card.tsx +212 -0
- package/components/motion/action-sheet.tsx +218 -0
- package/components/motion/action-swap-roll.tsx +32 -0
- package/components/motion/action-swap.tsx +340 -0
- package/components/motion/adaptive-stepper.tsx +442 -0
- package/components/motion/animated-badge.tsx +213 -0
- package/components/motion/animated-number.tsx +50 -0
- package/components/motion/animated-sidebar.tsx +1174 -0
- package/components/motion/animated-toast-stack.tsx +503 -0
- package/components/motion/aspect-ratio.tsx +55 -0
- package/components/motion/attachment-upload.tsx +1080 -0
- package/components/motion/audio-player.tsx +266 -0
- package/components/motion/autocomplete.tsx +183 -0
- package/components/motion/availability-scheduler/copy-menu.tsx +119 -0
- package/components/motion/availability-scheduler/day-row.tsx +231 -0
- package/components/motion/availability-scheduler/icon-button.tsx +46 -0
- package/components/motion/availability-scheduler/index.tsx +154 -0
- package/components/motion/availability-scheduler/time-select.tsx +49 -0
- package/components/motion/availability-scheduler/types.ts +189 -0
- package/components/motion/avatar-group.tsx +154 -0
- package/components/motion/bloom-menu.tsx +216 -0
- package/components/motion/bottom-sheet.tsx +249 -0
- package/components/motion/bounce-sidebar.tsx +266 -0
- package/components/motion/bouncy-accordion.tsx +325 -0
- package/components/motion/breadcrumb.tsx +122 -0
- package/components/motion/button/base.tsx +189 -0
- package/components/motion/button/index.tsx +13 -0
- package/components/motion/button/magnetic.tsx +25 -0
- package/components/motion/button/metallic.tsx +100 -0
- package/components/motion/button/stateful.tsx +237 -0
- package/components/motion/card-folder.tsx +345 -0
- package/components/motion/card-resize.tsx +229 -0
- package/components/motion/cascader.tsx +279 -0
- package/components/motion/center-morph-modal.tsx +366 -0
- package/components/motion/checkbox.tsx +123 -0
- package/components/motion/chip.tsx +121 -0
- package/components/motion/chromatic-text-reveal.tsx +203 -0
- package/components/motion/collapsible.tsx +108 -0
- package/components/motion/color-picker.tsx +206 -0
- package/components/motion/combobox/content.tsx +163 -0
- package/components/motion/combobox/context.tsx +359 -0
- package/components/motion/combobox/list.tsx +222 -0
- package/components/motion/combobox/trigger.tsx +191 -0
- package/components/motion/combobox/use-active-option.ts +130 -0
- package/components/motion/combobox.tsx +33 -0
- package/components/motion/command-palette.tsx +381 -0
- package/components/motion/confetti.tsx +128 -0
- package/components/motion/context-menu.tsx +790 -0
- package/components/motion/copy-button.tsx +103 -0
- package/components/motion/cylinder-carousel.tsx +459 -0
- package/components/motion/date-range-picker.tsx +218 -0
- package/components/motion/digit-swap.tsx +125 -0
- package/components/motion/dock.tsx +113 -0
- package/components/motion/drawer.tsx +108 -0
- package/components/motion/dynamic-island.tsx +221 -0
- package/components/motion/error-shake.tsx +66 -0
- package/components/motion/event-calendar.tsx +224 -0
- package/components/motion/expandable-action-bar.tsx +412 -0
- package/components/motion/expandable-control.tsx +254 -0
- package/components/motion/expandable-tabs.tsx +444 -0
- package/components/motion/expanding-arrow-button.tsx +171 -0
- package/components/motion/feedback-widget.tsx +473 -0
- package/components/motion/file-tree.tsx +429 -0
- package/components/motion/file-upload.tsx +606 -0
- package/components/motion/filter-builder.tsx +283 -0
- package/components/motion/frame.tsx +116 -0
- package/components/motion/gantt.tsx +156 -0
- package/components/motion/glow-button.tsx +101 -0
- package/components/motion/haptic-pressable.tsx +107 -0
- package/components/motion/hold-action-button.tsx +279 -0
- package/components/motion/hover-card.tsx +118 -0
- package/components/motion/icon-stack.tsx +138 -0
- package/components/motion/infinite-masonry.tsx +349 -0
- package/components/motion/input.tsx +242 -0
- package/components/motion/kanban.tsx +255 -0
- package/components/motion/kbd.tsx +127 -0
- package/components/motion/knockout-bracket.tsx +909 -0
- package/components/motion/knockout-wheel.tsx +1112 -0
- package/components/motion/liquid.tsx +351 -0
- package/components/motion/loader.tsx +616 -0
- package/components/motion/magnet-dock.tsx +117 -0
- package/components/motion/magnetic.tsx +50 -0
- package/components/motion/marquee.tsx +66 -0
- package/components/motion/metric-card.tsx +116 -0
- package/components/motion/morphing-modal.tsx +160 -0
- package/components/motion/morphing-search.tsx +643 -0
- package/components/motion/morphing-tabs.tsx +940 -0
- package/components/motion/multi-select/content.tsx +164 -0
- package/components/motion/multi-select/context.tsx +381 -0
- package/components/motion/multi-select/index.tsx +33 -0
- package/components/motion/multi-select/list.tsx +239 -0
- package/components/motion/multi-select/trigger.tsx +262 -0
- package/components/motion/not-found/glitch.tsx +107 -0
- package/components/motion/not-found/index.tsx +11 -0
- package/components/motion/not-found/magnetic.tsx +57 -0
- package/components/motion/not-found/shared.tsx +96 -0
- package/components/motion/not-found/spotlight.tsx +86 -0
- package/components/motion/not-found/stacked.tsx +77 -0
- package/components/motion/not-found/terminal.tsx +83 -0
- package/components/motion/notification-stack.tsx +380 -0
- package/components/motion/number-field.tsx +178 -0
- package/components/motion/number-ticker.tsx +185 -0
- package/components/motion/otp-input.tsx +392 -0
- package/components/motion/overflow-actions.tsx +375 -0
- package/components/motion/page-transition.tsx +92 -0
- package/components/motion/pagination.tsx +163 -0
- package/components/motion/parallax.tsx +64 -0
- package/components/motion/password-input.tsx +165 -0
- package/components/motion/phone-input.tsx +181 -0
- package/components/motion/popover-morph.tsx +317 -0
- package/components/motion/popover-position.ts +86 -0
- package/components/motion/popover.tsx +694 -0
- package/components/motion/prediction-market.tsx +682 -0
- package/components/motion/preview-rail.tsx +390 -0
- package/components/motion/progress-ring.tsx +115 -0
- package/components/motion/project-folder.tsx +418 -0
- package/components/motion/pull-to-refresh.tsx +522 -0
- package/components/motion/radio.tsx +148 -0
- package/components/motion/range-slider.tsx +93 -0
- package/components/motion/rating.tsx +171 -0
- package/components/motion/reorder-grid.tsx +123 -0
- package/components/motion/resizable-panel.tsx +160 -0
- package/components/motion/scroll-progress.tsx +127 -0
- package/components/motion/scroll-reveal.tsx +60 -0
- package/components/motion/scroll-to.tsx +48 -0
- package/components/motion/segmented-control.tsx +130 -0
- package/components/motion/segmented-progress.tsx +128 -0
- package/components/motion/select.tsx +440 -0
- package/components/motion/shader-background.tsx +134 -0
- package/components/motion/shared-layout-bg.tsx +151 -0
- package/components/motion/signup-form.tsx +467 -0
- package/components/motion/slide-action-button.tsx +203 -0
- package/components/motion/smooth-scroll.tsx +264 -0
- package/components/motion/sortable-list.tsx +98 -0
- package/components/motion/speed-dial.tsx +144 -0
- package/components/motion/split-text.tsx +115 -0
- package/components/motion/spotlight-card.tsx +89 -0
- package/components/motion/stepper.tsx +127 -0
- package/components/motion/success-check.tsx +142 -0
- package/components/motion/swap/constants.ts +2 -0
- package/components/motion/swap/controls.tsx +201 -0
- package/components/motion/swap/data.ts +186 -0
- package/components/motion/swap/field.tsx +115 -0
- package/components/motion/swap/quote-row.tsx +46 -0
- package/components/motion/swap/token-badges.tsx +83 -0
- package/components/motion/swap/token-picker.tsx +219 -0
- package/components/motion/swap/types.ts +20 -0
- package/components/motion/swap/utils.ts +28 -0
- package/components/motion/swap.tsx +182 -0
- package/components/motion/swipeable-list.tsx +507 -0
- package/components/motion/switch.tsx +96 -0
- package/components/motion/table/editable-cell.tsx +22 -0
- package/components/motion/table/index.tsx +431 -0
- package/components/motion/table/row-handle.tsx +81 -0
- package/components/motion/table/skeleton-rows.tsx +39 -0
- package/components/motion/table/table-header.tsx +344 -0
- package/components/motion/table/table-menu.tsx +129 -0
- package/components/motion/table/types.ts +86 -0
- package/components/motion/table/use-column-reorder.ts +105 -0
- package/components/motion/table/use-column-resize.ts +81 -0
- package/components/motion/table/use-column-sort.ts +64 -0
- package/components/motion/table/use-row-selection.ts +59 -0
- package/components/motion/table/utils.ts +33 -0
- package/components/motion/tabs.tsx +207 -0
- package/components/motion/text-cascade.tsx +22 -0
- package/components/motion/text-reveal.tsx +143 -0
- package/components/motion/text-scramble.tsx +84 -0
- package/components/motion/text-shimmer.tsx +34 -0
- package/components/motion/text-swap.tsx +56 -0
- package/components/motion/theme-toggle.tsx +210 -0
- package/components/motion/tilt-card.tsx +68 -0
- package/components/motion/timeline.tsx +236 -0
- package/components/motion/toggle-group.tsx +128 -0
- package/components/motion/tooltip.tsx +297 -0
- package/components/motion/tree-view.tsx +200 -0
- package/components/motion/wallet-card/account-avatar.tsx +21 -0
- package/components/motion/wallet-card/account-switcher.tsx +199 -0
- package/components/motion/wallet-card/actions.tsx +59 -0
- package/components/motion/wallet-card/balance-delta.tsx +69 -0
- package/components/motion/wallet-card/constants.ts +18 -0
- package/components/motion/wallet-card/copy-button.tsx +58 -0
- package/components/motion/wallet-card/index.tsx +151 -0
- package/components/motion/wallet-card/search-bar.tsx +198 -0
- package/components/motion/wallet-card/types.ts +34 -0
- package/components/motion/wallet-card/utils.ts +9 -0
- package/components/motion/wheel-picker.tsx +610 -0
- package/components/notifications/apple-notification-banner.tsx +155 -0
- package/components/notifications/calendar-reminder-notification-banner.tsx +138 -0
- package/components/notifications/chat-bubble-notification-banner.tsx +136 -0
- package/components/notifications/delivery-notification-banner.tsx +126 -0
- package/components/notifications/deploy-notification-banner.tsx +140 -0
- package/components/notifications/email-notification-banner.tsx +148 -0
- package/components/notifications/incoming-call-notification-banner.tsx +144 -0
- package/components/notifications/payment-notification-banner.tsx +137 -0
- package/components/notifications/system-alert-banner.tsx +137 -0
- package/components/notifications/toast-notification-banner.tsx +130 -0
- package/components/others/progress-ring-card.tsx +217 -0
- package/components/others/stacked-cards-effect.tsx +62 -0
- package/components/others/terminal-log-card.tsx +107 -0
- package/components/others/thermal-receipt-card.tsx +132 -0
- package/components/others/weather-snapshot-card.tsx +124 -0
- package/components/otp/otp-boxed-input.tsx +482 -0
- package/components/otp/otp-underline-input.tsx +356 -0
- package/components/previews/agents/agent-activity.preview.tsx +136 -0
- package/components/previews/agents/ai-sidebar.preview.tsx +236 -0
- package/components/previews/agents/chat-app-usage.tsx +689 -0
- package/components/previews/agents/chat-app.preview.tsx +130 -0
- package/components/previews/agents/chat-preview.tsx +285 -0
- package/components/previews/agents/citations.preview.tsx +78 -0
- package/components/previews/agents/code-block.preview.tsx +67 -0
- package/components/previews/agents/file-diff.preview.tsx +64 -0
- package/components/previews/agents/image-generation.preview.tsx +117 -0
- package/components/previews/agents/message-bubble.preview.tsx +12 -0
- package/components/previews/agents/message-scroller.preview.tsx +70 -0
- package/components/previews/agents/message.preview.tsx +14 -0
- package/components/previews/agents/prompt-input.preview.tsx +145 -0
- package/components/previews/agents/streaming-response.preview.tsx +156 -0
- package/components/previews/agents/todo-list.preview.tsx +73 -0
- package/components/previews/agents/tool-approval.preview.tsx +80 -0
- package/components/previews/agents/use-tool-result-demo.ts +28 -0
- package/components/previews/blocks/availability-scheduler.preview.tsx +11 -0
- package/components/previews/blocks/bloom-menu.preview.tsx +11 -0
- package/components/previews/blocks/card-folder.preview.tsx +105 -0
- package/components/previews/blocks/command-palette.preview.tsx +40 -0
- package/components/previews/blocks/dynamic-island.preview.tsx +150 -0
- package/components/previews/blocks/expandable-action-bar.preview.tsx +136 -0
- package/components/previews/blocks/expandable-tabs.preview.tsx +136 -0
- package/components/previews/blocks/feedback-widget.preview.tsx +34 -0
- package/components/previews/blocks/file-upload.preview.tsx +175 -0
- package/components/previews/blocks/infinite-masonry.preview.tsx +145 -0
- package/components/previews/blocks/knockout-bracket.preview.tsx +43 -0
- package/components/previews/blocks/morphing-search.preview.tsx +59 -0
- package/components/previews/blocks/morphing-tabs.preview.tsx +91 -0
- package/components/previews/blocks/notification-stack.preview.tsx +39 -0
- package/components/previews/blocks/otp-input.preview.tsx +29 -0
- package/components/previews/blocks/overflow-actions.preview.tsx +51 -0
- package/components/previews/blocks/prediction-market.preview.tsx +41 -0
- package/components/previews/blocks/project-folder.preview.tsx +41 -0
- package/components/previews/blocks/signup-form.preview.tsx +36 -0
- package/components/previews/blocks/swap.preview.tsx +11 -0
- package/components/previews/blocks/swipeable-list.preview.tsx +149 -0
- package/components/previews/blocks/wallet-card.preview.tsx +36 -0
- package/components/previews/motion/action-swap.preview.tsx +82 -0
- package/components/previews/motion/adaptive-stepper.preview.tsx +20 -0
- package/components/previews/motion/animated-badge.preview.tsx +43 -0
- package/components/previews/motion/animated-sidebar.preview.tsx +269 -0
- package/components/previews/motion/animated-toast-stack.preview.tsx +151 -0
- package/components/previews/motion/bottom-sheet.preview.tsx +35 -0
- package/components/previews/motion/bounce-sidebar.preview.tsx +30 -0
- package/components/previews/motion/bouncy-accordion.preview.tsx +66 -0
- package/components/previews/motion/center-morph-modal.preview.tsx +75 -0
- package/components/previews/motion/checkbox.preview.tsx +26 -0
- package/components/previews/motion/combobox.preview.tsx +119 -0
- package/components/previews/motion/context-menu.preview.tsx +144 -0
- package/components/previews/motion/cylinder-carousel.preview.tsx +96 -0
- package/components/previews/motion/dock.preview.tsx +46 -0
- package/components/previews/motion/drawer.preview.tsx +46 -0
- package/components/previews/motion/expandable-control.preview.tsx +27 -0
- package/components/previews/motion/expanding-arrow-button.preview.tsx +11 -0
- package/components/previews/motion/file-tree.preview.tsx +67 -0
- package/components/previews/motion/input.preview.tsx +55 -0
- package/components/previews/motion/loader.preview.tsx +36 -0
- package/components/previews/motion/marquee.preview.tsx +22 -0
- package/components/previews/motion/morphing-modal.preview.tsx +184 -0
- package/components/previews/motion/multi-select.preview.tsx +73 -0
- package/components/previews/motion/number.preview.tsx +61 -0
- package/components/previews/motion/popover.preview.tsx +53 -0
- package/components/previews/motion/preview-rail.preview.tsx +108 -0
- package/components/previews/motion/pull-to-refresh.preview.tsx +117 -0
- package/components/previews/motion/radio.preview.tsx +17 -0
- package/components/previews/motion/range-slider.preview.tsx +19 -0
- package/components/previews/motion/select.preview.tsx +29 -0
- package/components/previews/motion/shader-background.preview.tsx +308 -0
- package/components/previews/motion/shared-layout-bg.preview.tsx +33 -0
- package/components/previews/motion/switch.preview.tsx +15 -0
- package/components/previews/motion/table.preview.tsx +140 -0
- package/components/previews/motion/tabs.preview.tsx +49 -0
- package/components/previews/motion/text-animation.preview.tsx +63 -0
- package/components/previews/motion/theme-toggle.preview.tsx +28 -0
- package/components/previews/motion/tilt-card.preview.tsx +15 -0
- package/components/previews/motion/tooltip.preview.tsx +34 -0
- package/components/previews/motion/wheel-picker.preview.tsx +91 -0
- package/components/pricing/retail-price-tag-card.tsx +104 -0
- package/components/pricing/toggle-pricing-cards.tsx +209 -0
- package/components/profile/contact-profile-card.tsx +100 -0
- package/components/profile/editorial-staff-profile-card.tsx +79 -0
- package/components/profile/team-member-profile-grid.tsx +159 -0
- package/components/profile/user-profile-card.tsx +125 -0
- package/components/resources/resource-links-panel.tsx +176 -0
- package/components/socials/discord-chat-card.tsx +157 -0
- package/components/socials/facebook-post-card.tsx +198 -0
- package/components/socials/github-contribution.tsx +716 -0
- package/components/socials/github-repo-card.tsx +111 -0
- package/components/socials/instagram-post-card.tsx +204 -0
- package/components/socials/linked-in-post-card.tsx +213 -0
- package/components/socials/linked-in-profile-card.tsx +173 -0
- package/components/socials/threads-post-card.tsx +162 -0
- package/components/socials/twitter-post-card.tsx +184 -0
- package/components/socials/twitter-profile-card.tsx +180 -0
- package/components/system/loaders/index.ts +1 -0
- package/components/system/loaders/page-loader-overlay.tsx +16 -0
- package/components/table/customers-table.tsx +146 -0
- package/components/table/orders-table.tsx +195 -0
- package/components/table/recent-transactions-table.tsx +125 -0
- package/components/table/tasks-table.tsx +163 -0
- package/components/table/team-members-table.tsx +155 -0
- package/components/table/users-select-table.tsx +184 -0
- package/components/text/cafe-menu-board-card.tsx +101 -0
- package/components/text/cinema-ticket-card.tsx +99 -0
- package/components/text/daily-motivation-card.tsx +80 -0
- package/components/text/denim-product-editorial-card.tsx +101 -0
- package/components/text/drop-cap-editorial-card.tsx +54 -0
- package/components/text/editorial-quote-card.tsx +98 -0
- package/components/text/journal-writing-card.tsx +131 -0
- package/components/text/keyboard-shortcuts-card.tsx +92 -0
- package/components/text/magazine-cover-card.tsx +109 -0
- package/components/text/notepad-card.tsx +95 -0
- package/components/travel/flight-boarding-card.tsx +177 -0
- package/components/travel/travel-postcard-card.tsx +96 -0
- package/components/underlines/annotated-text-showcase.tsx +37 -0
- package/components/underlines/annotated-text.tsx +471 -0
- package/components/users/credit-card-glass.tsx +113 -0
- package/components/users/team-member-card.tsx +50 -0
- package/components/users/testimonial-card.tsx +239 -0
- package/components/wallet/wallet-pass-card.tsx +220 -0
- package/components/widgets/analog-clock-widget.tsx +203 -0
- package/components/widgets/audio-recorder-widget.tsx +87 -0
- package/components/widgets/battery-face-widget.tsx +152 -0
- package/components/widgets/blob-profile.tsx +64 -0
- package/components/widgets/bluetooth-face-widget.tsx +125 -0
- package/components/widgets/compass-widget.tsx +296 -0
- package/components/widgets/daily-activity-calendar-widget.tsx +133 -0
- package/components/widgets/dnd-face-widget.tsx +129 -0
- package/components/widgets/electric-scooter-widget.tsx +88 -0
- package/components/widgets/flight-arrival-widget.tsx +76 -0
- package/components/widgets/focus-breath-widget.tsx +71 -0
- package/components/widgets/heart-rate-widget.tsx +93 -0
- package/components/widgets/hydration-widget.tsx +109 -0
- package/components/widgets/ios-calendar-widget.tsx +87 -0
- package/components/widgets/ios-digital-clock-widget.tsx +192 -0
- package/components/widgets/ios-earbuds-widget.tsx +120 -0
- package/components/widgets/ios-map-location-widget.tsx +133 -0
- package/components/widgets/minimal-agenda-widget.tsx +123 -0
- package/components/widgets/pomodoro-widget.tsx +155 -0
- package/components/widgets/recorder-face-widget.tsx +146 -0
- package/components/widgets/ride-pickup-widget.tsx +72 -0
- package/components/widgets/sleep-score-widget.tsx +107 -0
- package/components/widgets/step-count-widget.tsx +53 -0
- package/components/widgets/stopwatch-widget.tsx +176 -0
- package/components/widgets/torch-face-widget.tsx +128 -0
- package/components/widgets/voice-assistant-widget.tsx +103 -0
- package/components/widgets/wifi-toggle-widget.tsx +108 -0
- package/lib/cn.ts +1 -0
- package/lib/ease.ts +108 -0
- package/lib/favicon.ts +8 -0
- package/lib/hooks/use-dismiss.ts +120 -0
- package/lib/hooks/use-favicon.ts +39 -0
- package/lib/hooks/use-haptic.ts +44 -0
- package/lib/hooks/use-hover-capable.ts +23 -0
- package/lib/hooks/use-hover-gesture.ts +61 -0
- package/lib/hooks/use-in-view-animation.ts +35 -0
- package/lib/hooks/use-measure.ts +39 -0
- package/lib/hooks/use-on-open.ts +24 -0
- package/lib/hooks/use-row-cursor.ts +86 -0
- package/lib/hooks/use-slider.ts +176 -0
- package/lib/hooks/use-tap-gesture.ts +66 -0
- package/lib/hooks/use-touch-capable.ts +31 -0
- package/lib/presence-gate.tsx +52 -0
- package/lib/styles.ts +124 -0
- package/lib/text-shimmer.ts +21 -0
- package/lib/tick-sound.ts +151 -0
- package/lib/touch.ts +117 -0
- package/lib/utils.ts +6 -0
- package/package.json +49 -0
- package/references/agents/agent-activity.md +747 -0
- package/references/agents/ai-sidebar.md +293 -0
- package/references/agents/approval-card.md +233 -0
- package/references/agents/chat-app.md +184 -0
- package/references/agents/citations.md +159 -0
- package/references/agents/code-block.md +122 -0
- package/references/agents/file-diff.md +119 -0
- package/references/agents/image-generation.md +173 -0
- package/references/agents/loading-states.md +186 -0
- package/references/agents/message-bubble.md +274 -0
- package/references/agents/message-scroller.md +128 -0
- package/references/agents/message.md +162 -0
- package/references/agents/prompt-input.md +204 -0
- package/references/agents/streaming-response.md +216 -0
- package/references/agents/todo-list.md +123 -0
- package/references/agents/tool-approval.md +143 -0
- package/references/agents/tool-result.md +199 -0
- package/references/blocks/availability-scheduler.md +59 -0
- package/references/blocks/bloom-menu.md +56 -0
- package/references/blocks/card-folder.md +165 -0
- package/references/blocks/command-palette.md +89 -0
- package/references/blocks/dynamic-island.md +203 -0
- package/references/blocks/expandable-action-bar.md +191 -0
- package/references/blocks/expandable-tabs.md +184 -0
- package/references/blocks/feedback-widget.md +82 -0
- package/references/blocks/file-upload.md +406 -0
- package/references/blocks/infinite-masonry.md +211 -0
- package/references/blocks/knockout-bracket.md +161 -0
- package/references/blocks/morphing-search.md +113 -0
- package/references/blocks/morphing-tabs.md +143 -0
- package/references/blocks/not-found.md +228 -0
- package/references/blocks/notification-stack.md +92 -0
- package/references/blocks/otp-input.md +85 -0
- package/references/blocks/overflow-actions.md +105 -0
- package/references/blocks/prediction-market.md +97 -0
- package/references/blocks/project-folder.md +99 -0
- package/references/blocks/signup-form.md +92 -0
- package/references/blocks/swap.md +58 -0
- package/references/blocks/swipeable-list.md +202 -0
- package/references/blocks/wallet-card.md +97 -0
- package/references/codex-install.md +59 -0
- package/references/craft/3d-button.md +51 -0
- package/references/craft/3d-icon-button.md +51 -0
- package/references/craft/add-to-cart-button.md +52 -0
- package/references/craft/analog-clock-minimal.md +51 -0
- package/references/craft/analog-clock-numeric.md +51 -0
- package/references/craft/analog-clock-roman.md +51 -0
- package/references/craft/annotated-text.md +51 -0
- package/references/craft/app-dock.md +52 -0
- package/references/craft/apple-hello-loader.md +51 -0
- package/references/craft/apple-notification.md +53 -0
- package/references/craft/apple-watch.md +51 -0
- package/references/craft/arc-bands-background.md +51 -0
- package/references/craft/audio-recorder.md +52 -0
- package/references/craft/aurora-background.md +51 -0
- package/references/craft/battery-face.md +52 -0
- package/references/craft/blob-profile.md +53 -0
- package/references/craft/bluetooth-face.md +52 -0
- package/references/craft/booking-slot-calendar.md +52 -0
- package/references/craft/bookmark-save-button.md +52 -0
- package/references/craft/browser.md +51 -0
- package/references/craft/cafe-menu-board.md +52 -0
- package/references/craft/calendar-reminder-notification.md +52 -0
- package/references/craft/chat-bubble-notification.md +53 -0
- package/references/craft/checkbox-field-input.md +52 -0
- package/references/craft/cherry-petal-background.md +51 -0
- package/references/craft/cinder-latch-button.md +51 -0
- package/references/craft/cinema-ticket.md +52 -0
- package/references/craft/circle-cut-frame.md +51 -0
- package/references/craft/combobox-field-input.md +52 -0
- package/references/craft/compass.md +51 -0
- package/references/craft/contact-form.md +52 -0
- package/references/craft/contact-profile.md +52 -0
- package/references/craft/copy-email.md +53 -0
- package/references/craft/coral-glow-background.md +51 -0
- package/references/craft/craft-copy-button.md +52 -0
- package/references/craft/craft-signup-form.md +53 -0
- package/references/craft/credit-card-glass.md +51 -0
- package/references/craft/customers-table.md +52 -0
- package/references/craft/daily-activity-calendar.md +52 -0
- package/references/craft/daily-motivation.md +53 -0
- package/references/craft/dark-arc-bands-background.md +51 -0
- package/references/craft/dark-aurora-background.md +51 -0
- package/references/craft/dark-carbon-spotlight-background.md +51 -0
- package/references/craft/dark-ember-background.md +51 -0
- package/references/craft/dark-ink-field-background.md +51 -0
- package/references/craft/dark-midnight-mesh-background.md +51 -0
- package/references/craft/dark-rose-noir-background.md +51 -0
- package/references/craft/dark-teal-depth-background.md +51 -0
- package/references/craft/date-field-input.md +52 -0
- package/references/craft/date-range-picker-card.md +52 -0
- package/references/craft/delivery-notification.md +52 -0
- package/references/craft/denim-product-editorial.md +52 -0
- package/references/craft/deploy-notification.md +52 -0
- package/references/craft/depth-outline-button.md +51 -0
- package/references/craft/diagonal-box-pattern.md +51 -0
- package/references/craft/dimple-switch.md +51 -0
- package/references/craft/discord-chat.md +53 -0
- package/references/craft/dnd-face.md +52 -0
- package/references/craft/dot-grid-pattern.md +51 -0
- package/references/craft/download-button.md +52 -0
- package/references/craft/drop-cap-editorial.md +52 -0
- package/references/craft/editor-tool-dock.md +52 -0
- package/references/craft/editorial-quote.md +52 -0
- package/references/craft/editorial-staff-profile.md +51 -0
- package/references/craft/electric-scooter.md +53 -0
- package/references/craft/email-notification.md +53 -0
- package/references/craft/event-countdown-card.md +51 -0
- package/references/craft/event-ticket.md +53 -0
- package/references/craft/facebook-post.md +53 -0
- package/references/craft/file-menu.md +52 -0
- package/references/craft/file-upload-field-input.md +52 -0
- package/references/craft/film-strip.md +52 -0
- package/references/craft/filter-sort.md +52 -0
- package/references/craft/fine-grain-pattern.md +51 -0
- package/references/craft/flight-arrival.md +52 -0
- package/references/craft/flight-boarding.md +52 -0
- package/references/craft/floating-label-field-input.md +51 -0
- package/references/craft/focus-breath.md +51 -0
- package/references/craft/folder-tab-card.md +52 -0
- package/references/craft/follow-button.md +52 -0
- package/references/craft/forgot-password-form.md +53 -0
- package/references/craft/frost-mesh-background.md +51 -0
- package/references/craft/gallery-grid.md +53 -0
- package/references/craft/gallery-wall.md +52 -0
- package/references/craft/github-contribution.md +52 -0
- package/references/craft/github-repo.md +52 -0
- package/references/craft/glass-overlay-image.md +53 -0
- package/references/craft/graph-paper-pattern.md +51 -0
- package/references/craft/halftone-pop-background.md +51 -0
- package/references/craft/hard-shadow-polaroid-frame.md +51 -0
- package/references/craft/heart-rate.md +52 -0
- package/references/craft/hold-to-delete-button.md +52 -0
- package/references/craft/honey-ember-background.md +51 -0
- package/references/craft/hydration.md +51 -0
- package/references/craft/incoming-call-notification.md +53 -0
- package/references/craft/ink-stamp-document.md +52 -0
- package/references/craft/ink-wash-background.md +51 -0
- package/references/craft/input-group-field.md +51 -0
- package/references/craft/inset-button.md +51 -0
- package/references/craft/instagram-post.md +53 -0
- package/references/craft/ios-calendar-widget.md +51 -0
- package/references/craft/ios-digital-clock.md +51 -0
- package/references/craft/ios-earbuds.md +51 -0
- package/references/craft/ios-map-location.md +51 -0
- package/references/craft/ipad.md +51 -0
- package/references/craft/ipod.md +51 -0
- package/references/craft/journal-writing.md +52 -0
- package/references/craft/kebab-actions.md +52 -0
- package/references/craft/keyboard-shortcuts.md +52 -0
- package/references/craft/laptop.md +51 -0
- package/references/craft/like-button.md +52 -0
- package/references/craft/line-grid-pattern.md +51 -0
- package/references/craft/linen-tab-button.md +51 -0
- package/references/craft/linen-weave-background.md +51 -0
- package/references/craft/linked-in-post.md +53 -0
- package/references/craft/linked-in-profile.md +52 -0
- package/references/craft/login-form.md +53 -0
- package/references/craft/mac-dock.md +52 -0
- package/references/craft/magazine-cover.md +53 -0
- package/references/craft/minimal-agenda.md +52 -0
- package/references/craft/mint-lagoon-background.md +51 -0
- package/references/craft/month-picker-calendar.md +52 -0
- package/references/craft/museum-placard.md +51 -0
- package/references/craft/music-player.md +53 -0
- package/references/craft/music-playlist.md +53 -0
- package/references/craft/newsletter-form.md +52 -0
- package/references/craft/notepad.md +52 -0
- package/references/craft/notification.md +52 -0
- package/references/craft/now-playing-bar.md +53 -0
- package/references/craft/orders-table.md +52 -0
- package/references/craft/otp-boxed-input.md +52 -0
- package/references/craft/otp-underline-input.md +51 -0
- package/references/craft/page-loader-overlay.md +46 -0
- package/references/craft/paper-fold-background.md +51 -0
- package/references/craft/password-field-input.md +52 -0
- package/references/craft/payment-notification.md +52 -0
- package/references/craft/phone-field-input.md +51 -0
- package/references/craft/phone.md +51 -0
- package/references/craft/photo-album.md +52 -0
- package/references/craft/photo-contact-sheet.md +52 -0
- package/references/craft/polaroid-image.md +52 -0
- package/references/craft/pomodoro.md +52 -0
- package/references/craft/presence-dock.md +51 -0
- package/references/craft/prism-depth-button.md +51 -0
- package/references/craft/progress-ring-card.md +51 -0
- package/references/craft/quantity-stepper-button.md +52 -0
- package/references/craft/radio-group-field-input.md +51 -0
- package/references/craft/rain-prism-background.md +51 -0
- package/references/craft/recent-transactions-table.md +52 -0
- package/references/craft/recorder-face.md +52 -0
- package/references/craft/resource-links-panel.md +52 -0
- package/references/craft/retail-price-tag.md +51 -0
- package/references/craft/reverse-diagonal-box-pattern.md +51 -0
- package/references/craft/ride-pickup.md +53 -0
- package/references/craft/sand-drift-background.md +51 -0
- package/references/craft/search-input.md +52 -0
- package/references/craft/segmented-toggle-button.md +51 -0
- package/references/craft/select-field-input.md +52 -0
- package/references/craft/share-menu.md +52 -0
- package/references/craft/sheen-pill-button.md +51 -0
- package/references/craft/slate-chip-switch.md +51 -0
- package/references/craft/sleep-score.md +52 -0
- package/references/craft/slide-to-confirm-button.md +52 -0
- package/references/craft/slow-living-polaroid.md +52 -0
- package/references/craft/soft-pill-button.md +51 -0
- package/references/craft/soft-spotlight-background.md +51 -0
- package/references/craft/soft-ui-button.md +51 -0
- package/references/craft/spin-loader.md +52 -0
- package/references/craft/spotlight-bar.md +52 -0
- package/references/craft/stacked-cards-effect.md +52 -0
- package/references/craft/stacked-folder-card.md +52 -0
- package/references/craft/stamp-postcard.md +52 -0
- package/references/craft/step-count.md +51 -0
- package/references/craft/sticky-note-polaroid-frame.md +51 -0
- package/references/craft/stopwatch.md +52 -0
- package/references/craft/sunrise-horizon-background.md +51 -0
- package/references/craft/sunset-bloom-background.md +51 -0
- package/references/craft/switch-field-input.md +51 -0
- package/references/craft/system-alert.md +52 -0
- package/references/craft/tasks-table.md +53 -0
- package/references/craft/team-member-profile-grid.md +52 -0
- package/references/craft/team-member.md +53 -0
- package/references/craft/team-members-table.md +53 -0
- package/references/craft/terminal-log.md +52 -0
- package/references/craft/terrazzo-fragment-background.md +51 -0
- package/references/craft/testimonial.md +53 -0
- package/references/craft/text-field-input.md +51 -0
- package/references/craft/text-loader.md +51 -0
- package/references/craft/textarea-field-input.md +51 -0
- package/references/craft/thermal-receipt.md +52 -0
- package/references/craft/threads-post.md +53 -0
- package/references/craft/toast-notification.md +52 -0
- package/references/craft/toggle-pricing-cards.md +52 -0
- package/references/craft/torch-face.md +52 -0
- package/references/craft/transform-box-frame.md +51 -0
- package/references/craft/transform-plus-frame.md +51 -0
- package/references/craft/travel-postcard.md +53 -0
- package/references/craft/tropical-tide-background.md +51 -0
- package/references/craft/twitter-post.md +53 -0
- package/references/craft/twitter-profile.md +53 -0
- package/references/craft/user-menu.md +53 -0
- package/references/craft/user-profile.md +53 -0
- package/references/craft/users-select-table.md +53 -0
- package/references/craft/voice-assistant.md +52 -0
- package/references/craft/wallet-pass.md +52 -0
- package/references/craft/weather-snapshot.md +52 -0
- package/references/craft/week-strip-calendar.md +52 -0
- package/references/craft/wifi-toggle.md +52 -0
- package/references/craft/workspace-switcher.md +52 -0
- package/references/guides/baseline-ui-craft.md +61 -0
- package/references/guides/craft-surface-design-system.md +120 -0
- package/references/guides/design-system-checklist.md +98 -0
- package/references/guides/enterprise-dashboard-patterns.md +53 -0
- package/references/guides/interaction-transitions.md +71 -0
- package/references/guides/motion-engineering.md +137 -0
- package/references/guides/motion-patterns.md +106 -0
- package/references/guides/motion-performance.md +66 -0
- package/references/guides/style-presets.md +115 -0
- package/references/guides/universal-mobile-patterns.md +72 -0
- package/references/motion/action-sheet.md +98 -0
- package/references/motion/action-swap.md +339 -0
- package/references/motion/adaptive-stepper.md +95 -0
- package/references/motion/animated-badge.md +92 -0
- package/references/motion/animated-sidebar.md +446 -0
- package/references/motion/animated-toast-stack.md +214 -0
- package/references/motion/aspect-ratio.md +59 -0
- package/references/motion/audio-player.md +59 -0
- package/references/motion/autocomplete.md +69 -0
- package/references/motion/avatar-group.md +93 -0
- package/references/motion/bottom-sheet.md +85 -0
- package/references/motion/bounce-sidebar.md +80 -0
- package/references/motion/bouncy-accordion.md +115 -0
- package/references/motion/breadcrumb.md +62 -0
- package/references/motion/button.md +271 -0
- package/references/motion/card-resize.md +60 -0
- package/references/motion/cascader.md +99 -0
- package/references/motion/center-morph-modal.md +133 -0
- package/references/motion/checkbox.md +76 -0
- package/references/motion/chip.md +81 -0
- package/references/motion/collapsible.md +73 -0
- package/references/motion/color-picker.md +57 -0
- package/references/motion/combobox.md +247 -0
- package/references/motion/confetti.md +65 -0
- package/references/motion/context-menu.md +269 -0
- package/references/motion/copy-button.md +59 -0
- package/references/motion/cylinder-carousel.md +151 -0
- package/references/motion/date-range-picker.md +68 -0
- package/references/motion/dock.md +105 -0
- package/references/motion/drawer.md +94 -0
- package/references/motion/error-shake.md +85 -0
- package/references/motion/event-calendar.md +81 -0
- package/references/motion/expandable-control.md +89 -0
- package/references/motion/expanding-arrow-button.md +178 -0
- package/references/motion/file-tree.md +139 -0
- package/references/motion/filter-builder.md +106 -0
- package/references/motion/frame.md +61 -0
- package/references/motion/gantt.md +61 -0
- package/references/motion/glow-button.md +59 -0
- package/references/motion/haptic-pressable.md +64 -0
- package/references/motion/hover-card.md +86 -0
- package/references/motion/icon-stack.md +64 -0
- package/references/motion/input.md +108 -0
- package/references/motion/kanban.md +111 -0
- package/references/motion/kbd.md +66 -0
- package/references/motion/loader.md +82 -0
- package/references/motion/magnet-dock.md +64 -0
- package/references/motion/marquee.md +68 -0
- package/references/motion/metric-card.md +81 -0
- package/references/motion/morphing-modal.md +230 -0
- package/references/motion/multi-select.md +202 -0
- package/references/motion/number-field.md +70 -0
- package/references/motion/number.md +198 -0
- package/references/motion/page-transition.md +78 -0
- package/references/motion/pagination.md +64 -0
- package/references/motion/password-input.md +77 -0
- package/references/motion/phone-input.md +63 -0
- package/references/motion/popover.md +209 -0
- package/references/motion/preview-rail.md +165 -0
- package/references/motion/progress-ring.md +73 -0
- package/references/motion/pull-to-refresh.md +172 -0
- package/references/motion/radio.md +73 -0
- package/references/motion/range-slider.md +290 -0
- package/references/motion/rating.md +69 -0
- package/references/motion/reorder-grid.md +69 -0
- package/references/motion/resizable-panel.md +75 -0
- package/references/motion/scroll-animation.md +397 -0
- package/references/motion/segmented-control.md +68 -0
- package/references/motion/segmented-progress.md +70 -0
- package/references/motion/select.md +196 -0
- package/references/motion/shader-background.md +351 -0
- package/references/motion/shared-layout-bg.md +80 -0
- package/references/motion/sortable-list.md +62 -0
- package/references/motion/speed-dial.md +63 -0
- package/references/motion/split-text.md +62 -0
- package/references/motion/spotlight-card.md +67 -0
- package/references/motion/stepper.md +83 -0
- package/references/motion/success-check.md +67 -0
- package/references/motion/switch.md +62 -0
- package/references/motion/table.md +519 -0
- package/references/motion/tabs.md +116 -0
- package/references/motion/text-animation.md +285 -0
- package/references/motion/text-swap.md +64 -0
- package/references/motion/theme-toggle.md +82 -0
- package/references/motion/tilt-card.md +59 -0
- package/references/motion/timeline.md +85 -0
- package/references/motion/toggle-group.md +70 -0
- package/references/motion/tooltip.md +82 -0
- package/references/motion/tree-view.md +87 -0
- package/references/motion/wheel-picker.md +142 -0
- package/scripts/build_docs.py +557 -0
- package/scripts/install-component.py +232 -0
- package/scripts/test_release.py +119 -0
- package/scripts/updater.mjs +9 -0
- package/scripts/verify_skill.py +84 -0
|
@@ -0,0 +1,1174 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { ChevronRight } from "lucide-react";
|
|
4
|
+
import {
|
|
5
|
+
AnimatePresence,
|
|
6
|
+
type HTMLMotionProps,
|
|
7
|
+
motion,
|
|
8
|
+
useReducedMotion,
|
|
9
|
+
type Variants,
|
|
10
|
+
} from "motion/react";
|
|
11
|
+
import {
|
|
12
|
+
type ButtonHTMLAttributes,
|
|
13
|
+
type CSSProperties,
|
|
14
|
+
createContext,
|
|
15
|
+
forwardRef,
|
|
16
|
+
type HTMLAttributes,
|
|
17
|
+
type ReactNode,
|
|
18
|
+
useCallback,
|
|
19
|
+
useContext,
|
|
20
|
+
useEffect,
|
|
21
|
+
useId,
|
|
22
|
+
useRef,
|
|
23
|
+
useState,
|
|
24
|
+
useSyncExternalStore,
|
|
25
|
+
} from "react";
|
|
26
|
+
import { createPortal } from "react-dom";
|
|
27
|
+
import { SharedLayoutBg } from "@/components/motion/shared-layout-bg";
|
|
28
|
+
import {
|
|
29
|
+
EASE_DRAWER,
|
|
30
|
+
EASE_OUT,
|
|
31
|
+
SPRING_LAYOUT,
|
|
32
|
+
SPRING_PRESS,
|
|
33
|
+
} from "@/lib/ease";
|
|
34
|
+
import { cn } from "@/lib/utils";
|
|
35
|
+
|
|
36
|
+
type SidebarState = "expanded" | "collapsed";
|
|
37
|
+
type SidebarSide = "left" | "right";
|
|
38
|
+
type SidebarVariant = "sidebar" | "floating" | "inset";
|
|
39
|
+
type SidebarCollapsible = "offcanvas" | "icon" | "none";
|
|
40
|
+
|
|
41
|
+
const MOBILE_QUERY = "(max-width: 767px)";
|
|
42
|
+
const SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
43
|
+
|
|
44
|
+
const PANEL_TRANSITION = {
|
|
45
|
+
duration: 0.36,
|
|
46
|
+
ease: EASE_DRAWER,
|
|
47
|
+
} as const;
|
|
48
|
+
|
|
49
|
+
// The desktop rail settles at a hard zero-width boundary. Keep the spring
|
|
50
|
+
// critically damped so it cannot overshoot, pause against that boundary, and
|
|
51
|
+
// then snap back during the final frame.
|
|
52
|
+
const SIDEBAR_MORPH_TRANSITION = {
|
|
53
|
+
type: "spring",
|
|
54
|
+
stiffness: 380,
|
|
55
|
+
damping: 35,
|
|
56
|
+
mass: 0.75,
|
|
57
|
+
} as const;
|
|
58
|
+
|
|
59
|
+
const LABEL_ENTER_TRANSITION = {
|
|
60
|
+
duration: 0.2,
|
|
61
|
+
delay: 0.08,
|
|
62
|
+
ease: EASE_OUT,
|
|
63
|
+
} as const;
|
|
64
|
+
|
|
65
|
+
const LABEL_EXIT_TRANSITION = {
|
|
66
|
+
duration: 0.12,
|
|
67
|
+
ease: EASE_OUT,
|
|
68
|
+
} as const;
|
|
69
|
+
|
|
70
|
+
const SUBMENU_TRANSITION = {
|
|
71
|
+
duration: 0.18,
|
|
72
|
+
ease: EASE_OUT,
|
|
73
|
+
} as const;
|
|
74
|
+
|
|
75
|
+
const SUBMENU_VARIANTS: Variants = {
|
|
76
|
+
closed: {
|
|
77
|
+
opacity: 0,
|
|
78
|
+
clipPath: "inset(0 0 100% 0 round 8px)",
|
|
79
|
+
transition: {
|
|
80
|
+
duration: 0.14,
|
|
81
|
+
ease: EASE_OUT,
|
|
82
|
+
staggerChildren: 0.025,
|
|
83
|
+
staggerDirection: -1,
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
open: {
|
|
87
|
+
opacity: 1,
|
|
88
|
+
clipPath: "inset(0 0 0% 0 round 8px)",
|
|
89
|
+
transition: {
|
|
90
|
+
duration: 0.2,
|
|
91
|
+
delayChildren: 0.035,
|
|
92
|
+
ease: EASE_OUT,
|
|
93
|
+
staggerChildren: 0.045,
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const SUBMENU_ITEM_VARIANTS: Variants = {
|
|
99
|
+
closed: {
|
|
100
|
+
opacity: 0,
|
|
101
|
+
y: -6,
|
|
102
|
+
filter: "blur(3px)",
|
|
103
|
+
},
|
|
104
|
+
open: {
|
|
105
|
+
opacity: 1,
|
|
106
|
+
y: 0,
|
|
107
|
+
filter: "blur(0px)",
|
|
108
|
+
transition: SUBMENU_TRANSITION,
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const REDUCED_TRANSITION = {
|
|
113
|
+
duration: 0.16,
|
|
114
|
+
ease: EASE_OUT,
|
|
115
|
+
} as const;
|
|
116
|
+
|
|
117
|
+
const FOCUSABLE_SELECTOR = [
|
|
118
|
+
"a[href]",
|
|
119
|
+
"button:not([disabled])",
|
|
120
|
+
"input:not([disabled])",
|
|
121
|
+
"select:not([disabled])",
|
|
122
|
+
"textarea:not([disabled])",
|
|
123
|
+
"[tabindex]:not([tabindex='-1'])",
|
|
124
|
+
].join(",");
|
|
125
|
+
|
|
126
|
+
function subscribeToMobileQuery(callback: () => void) {
|
|
127
|
+
const query = window.matchMedia(MOBILE_QUERY);
|
|
128
|
+
query.addEventListener("change", callback);
|
|
129
|
+
return () => query.removeEventListener("change", callback);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function getMobileSnapshot() {
|
|
133
|
+
return window.matchMedia(MOBILE_QUERY).matches;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function getServerMobileSnapshot() {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function useIsMobile() {
|
|
141
|
+
return useSyncExternalStore(
|
|
142
|
+
subscribeToMobileQuery,
|
|
143
|
+
getMobileSnapshot,
|
|
144
|
+
getServerMobileSnapshot,
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
interface AnimatedSidebarContextValue {
|
|
149
|
+
isMobile: boolean;
|
|
150
|
+
layoutId: string;
|
|
151
|
+
open: boolean;
|
|
152
|
+
openMobile: boolean;
|
|
153
|
+
reduce: boolean;
|
|
154
|
+
setOpen: (open: boolean) => void;
|
|
155
|
+
setOpenMobile: (open: boolean) => void;
|
|
156
|
+
state: SidebarState;
|
|
157
|
+
toggleSidebar: () => void;
|
|
158
|
+
triggerRef: React.RefObject<HTMLButtonElement | null>;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const AnimatedSidebarContext =
|
|
162
|
+
createContext<AnimatedSidebarContextValue | null>(null);
|
|
163
|
+
|
|
164
|
+
interface AnimatedSidebarPanelContextValue {
|
|
165
|
+
collapsed: boolean;
|
|
166
|
+
collapsible: SidebarCollapsible;
|
|
167
|
+
side: SidebarSide;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const AnimatedSidebarPanelContext =
|
|
171
|
+
createContext<AnimatedSidebarPanelContextValue | null>(null);
|
|
172
|
+
|
|
173
|
+
export function useAnimatedSidebar() {
|
|
174
|
+
const context = useContext(AnimatedSidebarContext);
|
|
175
|
+
if (!context) {
|
|
176
|
+
throw new Error(
|
|
177
|
+
"useAnimatedSidebar must be used inside AnimatedSidebarProvider.",
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
return context;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function useAnimatedSidebarPanel() {
|
|
184
|
+
const context = useContext(AnimatedSidebarPanelContext);
|
|
185
|
+
if (!context) {
|
|
186
|
+
throw new Error(
|
|
187
|
+
"Animated Sidebar parts must be used inside AnimatedSidebar.",
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
return context;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
type SidebarProviderStyle = CSSProperties & {
|
|
194
|
+
"--sidebar-width"?: string;
|
|
195
|
+
"--sidebar-width-icon"?: string;
|
|
196
|
+
"--sidebar-width-mobile"?: string;
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
export interface AnimatedSidebarProviderProps
|
|
200
|
+
extends HTMLAttributes<HTMLDivElement> {
|
|
201
|
+
open?: boolean;
|
|
202
|
+
defaultOpen?: boolean;
|
|
203
|
+
onOpenChange?: (open: boolean) => void;
|
|
204
|
+
openMobile?: boolean;
|
|
205
|
+
defaultOpenMobile?: boolean;
|
|
206
|
+
onOpenMobileChange?: (open: boolean) => void;
|
|
207
|
+
style?: SidebarProviderStyle;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export function AnimatedSidebarProvider({
|
|
211
|
+
children,
|
|
212
|
+
open,
|
|
213
|
+
defaultOpen = true,
|
|
214
|
+
onOpenChange,
|
|
215
|
+
openMobile,
|
|
216
|
+
defaultOpenMobile = false,
|
|
217
|
+
onOpenMobileChange,
|
|
218
|
+
className,
|
|
219
|
+
style,
|
|
220
|
+
...props
|
|
221
|
+
}: AnimatedSidebarProviderProps) {
|
|
222
|
+
const [internalOpen, setInternalOpen] = useState(defaultOpen);
|
|
223
|
+
const [internalOpenMobile, setInternalOpenMobile] =
|
|
224
|
+
useState(defaultOpenMobile);
|
|
225
|
+
const isMobile = useIsMobile();
|
|
226
|
+
const reduce = useReducedMotion() ?? false;
|
|
227
|
+
const generatedId = useId();
|
|
228
|
+
const triggerRef = useRef<HTMLButtonElement>(null);
|
|
229
|
+
const desktopOpen = open ?? internalOpen;
|
|
230
|
+
const mobileOpen = openMobile ?? internalOpenMobile;
|
|
231
|
+
|
|
232
|
+
const setOpen = useCallback(
|
|
233
|
+
(nextOpen: boolean) => {
|
|
234
|
+
if (open === undefined) setInternalOpen(nextOpen);
|
|
235
|
+
onOpenChange?.(nextOpen);
|
|
236
|
+
},
|
|
237
|
+
[onOpenChange, open],
|
|
238
|
+
);
|
|
239
|
+
|
|
240
|
+
const setOpenMobile = useCallback(
|
|
241
|
+
(nextOpen: boolean) => {
|
|
242
|
+
if (openMobile === undefined) setInternalOpenMobile(nextOpen);
|
|
243
|
+
onOpenMobileChange?.(nextOpen);
|
|
244
|
+
},
|
|
245
|
+
[onOpenMobileChange, openMobile],
|
|
246
|
+
);
|
|
247
|
+
|
|
248
|
+
const toggleSidebar = useCallback(() => {
|
|
249
|
+
if (isMobile) setOpenMobile(!mobileOpen);
|
|
250
|
+
else setOpen(!desktopOpen);
|
|
251
|
+
}, [desktopOpen, isMobile, mobileOpen, setOpen, setOpenMobile]);
|
|
252
|
+
|
|
253
|
+
useEffect(() => {
|
|
254
|
+
const handleShortcut = (event: KeyboardEvent) => {
|
|
255
|
+
if (
|
|
256
|
+
event.key.toLowerCase() === SIDEBAR_KEYBOARD_SHORTCUT &&
|
|
257
|
+
(event.metaKey || event.ctrlKey)
|
|
258
|
+
) {
|
|
259
|
+
event.preventDefault();
|
|
260
|
+
toggleSidebar();
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
window.addEventListener("keydown", handleShortcut);
|
|
265
|
+
return () => window.removeEventListener("keydown", handleShortcut);
|
|
266
|
+
}, [toggleSidebar]);
|
|
267
|
+
|
|
268
|
+
return (
|
|
269
|
+
<AnimatedSidebarContext.Provider
|
|
270
|
+
value={{
|
|
271
|
+
isMobile,
|
|
272
|
+
layoutId: `${generatedId}-active`,
|
|
273
|
+
open: desktopOpen,
|
|
274
|
+
openMobile: mobileOpen,
|
|
275
|
+
reduce,
|
|
276
|
+
setOpen,
|
|
277
|
+
setOpenMobile,
|
|
278
|
+
state: desktopOpen ? "expanded" : "collapsed",
|
|
279
|
+
toggleSidebar,
|
|
280
|
+
triggerRef,
|
|
281
|
+
}}
|
|
282
|
+
>
|
|
283
|
+
<div
|
|
284
|
+
{...props}
|
|
285
|
+
data-slot="sidebar-wrapper"
|
|
286
|
+
data-state={desktopOpen ? "expanded" : "collapsed"}
|
|
287
|
+
style={{
|
|
288
|
+
"--sidebar-width": "16rem",
|
|
289
|
+
"--sidebar-width-icon": "4.25rem",
|
|
290
|
+
"--sidebar-width-mobile": "18rem",
|
|
291
|
+
...style,
|
|
292
|
+
}}
|
|
293
|
+
className={cn(
|
|
294
|
+
"group/sidebar-wrapper flex min-h-svh w-full min-w-0",
|
|
295
|
+
className,
|
|
296
|
+
)}
|
|
297
|
+
>
|
|
298
|
+
{children}
|
|
299
|
+
</div>
|
|
300
|
+
</AnimatedSidebarContext.Provider>
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
function MobileSidebar({
|
|
305
|
+
ariaLabel,
|
|
306
|
+
children,
|
|
307
|
+
className,
|
|
308
|
+
side,
|
|
309
|
+
}: {
|
|
310
|
+
ariaLabel: string;
|
|
311
|
+
children: ReactNode;
|
|
312
|
+
className?: string;
|
|
313
|
+
side: SidebarSide;
|
|
314
|
+
}) {
|
|
315
|
+
const context = useAnimatedSidebar();
|
|
316
|
+
const panelRef = useRef<HTMLDivElement>(null);
|
|
317
|
+
const [mounted, setMounted] = useState(false);
|
|
318
|
+
// The sheet is mounted for as long as the viewport is mobile, so it hides
|
|
319
|
+
// itself while closed rather than sitting there transparent and interactive.
|
|
320
|
+
// Opening shows it in the same commit that starts the slide — a delayed show
|
|
321
|
+
// would run the focus effect below against a still-hidden panel, and focus()
|
|
322
|
+
// on a hidden element is ignored. Closing waits for the slide to finish, and
|
|
323
|
+
// the panel's own exit tells us when that is: no duration to keep in sync.
|
|
324
|
+
const [hidden, setHidden] = useState(!context.openMobile);
|
|
325
|
+
// The completion callback fires for the open slide too, and it reads state
|
|
326
|
+
// from whenever motion settles: a ref keeps it on the current one.
|
|
327
|
+
const openMobileRef = useRef(context.openMobile);
|
|
328
|
+
|
|
329
|
+
useEffect(() => setMounted(true), []);
|
|
330
|
+
|
|
331
|
+
useEffect(() => {
|
|
332
|
+
openMobileRef.current = context.openMobile;
|
|
333
|
+
if (context.openMobile) setHidden(false);
|
|
334
|
+
}, [context.openMobile]);
|
|
335
|
+
|
|
336
|
+
useEffect(() => {
|
|
337
|
+
if (!context.openMobile) return;
|
|
338
|
+
|
|
339
|
+
const body = document.body;
|
|
340
|
+
const scrollY = window.scrollY;
|
|
341
|
+
const previousBodyStyles = {
|
|
342
|
+
left: body.style.left,
|
|
343
|
+
overflow: body.style.overflow,
|
|
344
|
+
position: body.style.position,
|
|
345
|
+
right: body.style.right,
|
|
346
|
+
top: body.style.top,
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
body.style.position = "fixed";
|
|
350
|
+
body.style.top = `-${scrollY}px`;
|
|
351
|
+
body.style.left = "0";
|
|
352
|
+
body.style.right = "0";
|
|
353
|
+
body.style.overflow = "hidden";
|
|
354
|
+
|
|
355
|
+
const focusFrame = requestAnimationFrame(() => {
|
|
356
|
+
const firstFocusable =
|
|
357
|
+
panelRef.current?.querySelector<HTMLElement>(FOCUSABLE_SELECTOR);
|
|
358
|
+
(firstFocusable ?? panelRef.current)?.focus({ preventScroll: true });
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
return () => {
|
|
362
|
+
cancelAnimationFrame(focusFrame);
|
|
363
|
+
body.style.position = previousBodyStyles.position;
|
|
364
|
+
body.style.top = previousBodyStyles.top;
|
|
365
|
+
body.style.left = previousBodyStyles.left;
|
|
366
|
+
body.style.right = previousBodyStyles.right;
|
|
367
|
+
body.style.overflow = previousBodyStyles.overflow;
|
|
368
|
+
window.scrollTo(0, scrollY);
|
|
369
|
+
context.triggerRef.current?.focus({ preventScroll: true });
|
|
370
|
+
};
|
|
371
|
+
}, [context.openMobile, context.triggerRef]);
|
|
372
|
+
|
|
373
|
+
if (!mounted) return null;
|
|
374
|
+
|
|
375
|
+
// This container groups the sheet for hiding and the z-index and carries no
|
|
376
|
+
// box: both children are `fixed` and resolve against the viewport themselves.
|
|
377
|
+
// The scrim spans the viewport edges but paints a colour, and the panel is
|
|
378
|
+
// inset off one side and paints its own surface, so no layer here is a
|
|
379
|
+
// transparent edge-spanning one. See tests/fixed-overlay-edge-sampling.test.tsx.
|
|
380
|
+
return createPortal(
|
|
381
|
+
<div
|
|
382
|
+
className={cn(
|
|
383
|
+
"pointer-events-none fixed left-0 top-0 z-50 size-0 md:hidden",
|
|
384
|
+
hidden && !context.openMobile ? "invisible" : "visible",
|
|
385
|
+
)}
|
|
386
|
+
>
|
|
387
|
+
<motion.button
|
|
388
|
+
type="button"
|
|
389
|
+
aria-label="Close sidebar"
|
|
390
|
+
tabIndex={context.openMobile ? 0 : -1}
|
|
391
|
+
initial={false}
|
|
392
|
+
animate={{ opacity: context.openMobile ? 1 : 0 }}
|
|
393
|
+
transition={
|
|
394
|
+
context.reduce ? REDUCED_TRANSITION : PANEL_TRANSITION
|
|
395
|
+
}
|
|
396
|
+
onClick={() => context.setOpenMobile(false)}
|
|
397
|
+
className={cn(
|
|
398
|
+
"fixed inset-0 bg-black/40",
|
|
399
|
+
context.openMobile
|
|
400
|
+
? "pointer-events-auto"
|
|
401
|
+
: "pointer-events-none",
|
|
402
|
+
)}
|
|
403
|
+
/>
|
|
404
|
+
|
|
405
|
+
<motion.div
|
|
406
|
+
ref={panelRef}
|
|
407
|
+
role="dialog"
|
|
408
|
+
aria-modal="true"
|
|
409
|
+
aria-label={ariaLabel}
|
|
410
|
+
aria-hidden={!context.openMobile}
|
|
411
|
+
inert={!context.openMobile}
|
|
412
|
+
tabIndex={-1}
|
|
413
|
+
data-mobile="true"
|
|
414
|
+
data-state={context.openMobile ? "expanded" : "collapsed"}
|
|
415
|
+
data-side={side}
|
|
416
|
+
initial={false}
|
|
417
|
+
animate={{
|
|
418
|
+
opacity: context.reduce
|
|
419
|
+
? context.openMobile
|
|
420
|
+
? 1
|
|
421
|
+
: 0
|
|
422
|
+
: 1,
|
|
423
|
+
x: context.reduce
|
|
424
|
+
? 0
|
|
425
|
+
: context.openMobile
|
|
426
|
+
? "0%"
|
|
427
|
+
: side === "left"
|
|
428
|
+
? "-100%"
|
|
429
|
+
: "100%",
|
|
430
|
+
}}
|
|
431
|
+
transition={
|
|
432
|
+
context.reduce ? REDUCED_TRANSITION : PANEL_TRANSITION
|
|
433
|
+
}
|
|
434
|
+
onAnimationComplete={() => {
|
|
435
|
+
if (!openMobileRef.current) setHidden(true);
|
|
436
|
+
}}
|
|
437
|
+
onKeyDown={(event) => {
|
|
438
|
+
if (event.key === "Escape") {
|
|
439
|
+
event.preventDefault();
|
|
440
|
+
context.setOpenMobile(false);
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
if (event.key !== "Tab") return;
|
|
445
|
+
const focusable = panelRef.current
|
|
446
|
+
? Array.from(
|
|
447
|
+
panelRef.current.querySelectorAll<HTMLElement>(
|
|
448
|
+
FOCUSABLE_SELECTOR,
|
|
449
|
+
),
|
|
450
|
+
)
|
|
451
|
+
: [];
|
|
452
|
+
|
|
453
|
+
if (focusable.length === 0) {
|
|
454
|
+
event.preventDefault();
|
|
455
|
+
panelRef.current?.focus();
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
const first = focusable[0];
|
|
460
|
+
const last = focusable[focusable.length - 1];
|
|
461
|
+
if (event.shiftKey && document.activeElement === first) {
|
|
462
|
+
event.preventDefault();
|
|
463
|
+
last.focus();
|
|
464
|
+
} else if (!event.shiftKey && document.activeElement === last) {
|
|
465
|
+
event.preventDefault();
|
|
466
|
+
first.focus();
|
|
467
|
+
}
|
|
468
|
+
}}
|
|
469
|
+
className={cn(
|
|
470
|
+
"pointer-events-auto fixed inset-y-0 flex h-dvh w-(--sidebar-width-mobile) max-w-[88vw] flex-col overflow-hidden",
|
|
471
|
+
"border-border bg-background shadow-2xl will-change-transform",
|
|
472
|
+
side === "left" ? "left-0 border-r" : "right-0 border-l",
|
|
473
|
+
!context.openMobile && "pointer-events-none",
|
|
474
|
+
className,
|
|
475
|
+
)}
|
|
476
|
+
>
|
|
477
|
+
<AnimatedSidebarPanelContext.Provider
|
|
478
|
+
value={{ collapsed: false, collapsible: "none", side }}
|
|
479
|
+
>
|
|
480
|
+
{children}
|
|
481
|
+
</AnimatedSidebarPanelContext.Provider>
|
|
482
|
+
</motion.div>
|
|
483
|
+
</div>,
|
|
484
|
+
document.body,
|
|
485
|
+
);
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
export interface AnimatedSidebarProps
|
|
489
|
+
extends Omit<HTMLMotionProps<"aside">, "children"> {
|
|
490
|
+
children?: ReactNode;
|
|
491
|
+
side?: SidebarSide;
|
|
492
|
+
variant?: SidebarVariant;
|
|
493
|
+
collapsible?: SidebarCollapsible;
|
|
494
|
+
ariaLabel?: string;
|
|
495
|
+
panelClassName?: string;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
export const AnimatedSidebar = forwardRef<HTMLElement, AnimatedSidebarProps>(
|
|
499
|
+
function AnimatedSidebar(
|
|
500
|
+
{
|
|
501
|
+
side = "left",
|
|
502
|
+
variant = "sidebar",
|
|
503
|
+
collapsible = "icon",
|
|
504
|
+
ariaLabel = "Sidebar",
|
|
505
|
+
children,
|
|
506
|
+
className,
|
|
507
|
+
panelClassName,
|
|
508
|
+
style,
|
|
509
|
+
...props
|
|
510
|
+
},
|
|
511
|
+
forwardedRef,
|
|
512
|
+
) {
|
|
513
|
+
const context = useAnimatedSidebar();
|
|
514
|
+
const collapsed = collapsible !== "none" && !context.open;
|
|
515
|
+
const offcanvas = collapsed && collapsible === "offcanvas";
|
|
516
|
+
const width = offcanvas
|
|
517
|
+
? "0px"
|
|
518
|
+
: collapsed
|
|
519
|
+
? "var(--sidebar-width-icon)"
|
|
520
|
+
: "var(--sidebar-width)";
|
|
521
|
+
|
|
522
|
+
if (context.isMobile) {
|
|
523
|
+
return (
|
|
524
|
+
<MobileSidebar
|
|
525
|
+
ariaLabel={ariaLabel}
|
|
526
|
+
className={className}
|
|
527
|
+
side={side}
|
|
528
|
+
>
|
|
529
|
+
{children}
|
|
530
|
+
</MobileSidebar>
|
|
531
|
+
);
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
return (
|
|
535
|
+
<motion.aside
|
|
536
|
+
{...props}
|
|
537
|
+
ref={forwardedRef}
|
|
538
|
+
initial={false}
|
|
539
|
+
aria-label={ariaLabel}
|
|
540
|
+
data-slot="sidebar"
|
|
541
|
+
data-state={collapsed ? "collapsed" : "expanded"}
|
|
542
|
+
data-collapsible={collapsible}
|
|
543
|
+
data-variant={variant}
|
|
544
|
+
data-side={side}
|
|
545
|
+
animate={{ width }}
|
|
546
|
+
transition={
|
|
547
|
+
context.reduce ? { duration: 0 } : SIDEBAR_MORPH_TRANSITION
|
|
548
|
+
}
|
|
549
|
+
style={style}
|
|
550
|
+
className={cn(
|
|
551
|
+
"group/sidebar relative hidden h-auto shrink-0 md:block will-change-[width]",
|
|
552
|
+
"peer",
|
|
553
|
+
side === "right" && "order-last",
|
|
554
|
+
className,
|
|
555
|
+
)}
|
|
556
|
+
>
|
|
557
|
+
<motion.div
|
|
558
|
+
initial={false}
|
|
559
|
+
animate={{
|
|
560
|
+
opacity: offcanvas ? 0 : 1,
|
|
561
|
+
x: offcanvas ? (side === "left" ? "-100%" : "100%") : "0%",
|
|
562
|
+
}}
|
|
563
|
+
transition={
|
|
564
|
+
context.reduce ? REDUCED_TRANSITION : PANEL_TRANSITION
|
|
565
|
+
}
|
|
566
|
+
className={cn(
|
|
567
|
+
"sticky top-0 flex h-svh w-full flex-col overflow-hidden bg-background",
|
|
568
|
+
collapsible === "offcanvas" && "w-[var(--sidebar-width)]",
|
|
569
|
+
variant === "sidebar" &&
|
|
570
|
+
(side === "left" ? "border-border border-r" : "border-border border-l"),
|
|
571
|
+
variant === "floating" &&
|
|
572
|
+
"m-2 h-[calc(100svh-1rem)] rounded-2xl border border-border shadow-sm",
|
|
573
|
+
variant === "inset" && "m-2 h-[calc(100svh-1rem)] rounded-2xl",
|
|
574
|
+
panelClassName,
|
|
575
|
+
)}
|
|
576
|
+
>
|
|
577
|
+
<AnimatedSidebarPanelContext.Provider
|
|
578
|
+
value={{ collapsed, collapsible, side }}
|
|
579
|
+
>
|
|
580
|
+
{children}
|
|
581
|
+
</AnimatedSidebarPanelContext.Provider>
|
|
582
|
+
</motion.div>
|
|
583
|
+
</motion.aside>
|
|
584
|
+
);
|
|
585
|
+
},
|
|
586
|
+
);
|
|
587
|
+
|
|
588
|
+
export interface AnimatedSidebarTriggerProps
|
|
589
|
+
extends ButtonHTMLAttributes<HTMLButtonElement> {}
|
|
590
|
+
|
|
591
|
+
export const AnimatedSidebarTrigger = forwardRef<
|
|
592
|
+
HTMLButtonElement,
|
|
593
|
+
AnimatedSidebarTriggerProps
|
|
594
|
+
>(function AnimatedSidebarTrigger(
|
|
595
|
+
{ className, onClick, type = "button", ...props },
|
|
596
|
+
forwardedRef,
|
|
597
|
+
) {
|
|
598
|
+
const context = useAnimatedSidebar();
|
|
599
|
+
const expanded = context.isMobile ? context.openMobile : context.open;
|
|
600
|
+
|
|
601
|
+
return (
|
|
602
|
+
<button
|
|
603
|
+
{...props}
|
|
604
|
+
ref={(node) => {
|
|
605
|
+
context.triggerRef.current = node;
|
|
606
|
+
if (typeof forwardedRef === "function") forwardedRef(node);
|
|
607
|
+
else if (forwardedRef) forwardedRef.current = node;
|
|
608
|
+
}}
|
|
609
|
+
type={type}
|
|
610
|
+
aria-label={props["aria-label"] ?? "Toggle sidebar"}
|
|
611
|
+
aria-expanded={expanded}
|
|
612
|
+
data-slot="sidebar-trigger"
|
|
613
|
+
data-state={expanded ? "expanded" : "collapsed"}
|
|
614
|
+
onClick={(event) => {
|
|
615
|
+
onClick?.(event);
|
|
616
|
+
if (!event.defaultPrevented) context.toggleSidebar();
|
|
617
|
+
}}
|
|
618
|
+
className={cn(
|
|
619
|
+
"inline-flex size-10 shrink-0 items-center justify-center rounded-xl outline-none",
|
|
620
|
+
"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
621
|
+
className,
|
|
622
|
+
)}
|
|
623
|
+
/>
|
|
624
|
+
);
|
|
625
|
+
});
|
|
626
|
+
|
|
627
|
+
export interface AnimatedSidebarCloseProps
|
|
628
|
+
extends ButtonHTMLAttributes<HTMLButtonElement> {}
|
|
629
|
+
|
|
630
|
+
export const AnimatedSidebarClose = forwardRef<
|
|
631
|
+
HTMLButtonElement,
|
|
632
|
+
AnimatedSidebarCloseProps
|
|
633
|
+
>(function AnimatedSidebarClose(
|
|
634
|
+
{ className, onClick, type = "button", ...props },
|
|
635
|
+
forwardedRef,
|
|
636
|
+
) {
|
|
637
|
+
const context = useAnimatedSidebar();
|
|
638
|
+
|
|
639
|
+
return (
|
|
640
|
+
<button
|
|
641
|
+
{...props}
|
|
642
|
+
ref={forwardedRef}
|
|
643
|
+
type={type}
|
|
644
|
+
aria-label={props["aria-label"] ?? "Close sidebar"}
|
|
645
|
+
onClick={(event) => {
|
|
646
|
+
onClick?.(event);
|
|
647
|
+
if (event.defaultPrevented) return;
|
|
648
|
+
if (context.isMobile) context.setOpenMobile(false);
|
|
649
|
+
else context.setOpen(false);
|
|
650
|
+
}}
|
|
651
|
+
className={cn(
|
|
652
|
+
"inline-flex size-10 shrink-0 items-center justify-center rounded-xl outline-none",
|
|
653
|
+
"focus-visible:ring-2 focus-visible:ring-ring",
|
|
654
|
+
className,
|
|
655
|
+
)}
|
|
656
|
+
/>
|
|
657
|
+
);
|
|
658
|
+
});
|
|
659
|
+
|
|
660
|
+
export interface AnimatedSidebarRailProps
|
|
661
|
+
extends ButtonHTMLAttributes<HTMLButtonElement> {}
|
|
662
|
+
|
|
663
|
+
export const AnimatedSidebarRail = forwardRef<
|
|
664
|
+
HTMLButtonElement,
|
|
665
|
+
AnimatedSidebarRailProps
|
|
666
|
+
>(function AnimatedSidebarRail(
|
|
667
|
+
{ className, onClick, type = "button", ...props },
|
|
668
|
+
forwardedRef,
|
|
669
|
+
) {
|
|
670
|
+
const context = useAnimatedSidebar();
|
|
671
|
+
const panel = useAnimatedSidebarPanel();
|
|
672
|
+
|
|
673
|
+
return (
|
|
674
|
+
<button
|
|
675
|
+
{...props}
|
|
676
|
+
ref={forwardedRef}
|
|
677
|
+
type={type}
|
|
678
|
+
data-side={panel.side}
|
|
679
|
+
aria-label={props["aria-label"] ?? "Toggle sidebar"}
|
|
680
|
+
title="Toggle sidebar"
|
|
681
|
+
tabIndex={-1}
|
|
682
|
+
onClick={(event) => {
|
|
683
|
+
onClick?.(event);
|
|
684
|
+
if (!event.defaultPrevented) context.toggleSidebar();
|
|
685
|
+
}}
|
|
686
|
+
className={cn(
|
|
687
|
+
"absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 outline-none md:block",
|
|
688
|
+
"after:absolute after:inset-y-0 after:left-1/2 after:w-px after:bg-transparent after:transition-colors hover:after:bg-border",
|
|
689
|
+
"data-[side=right]:right-0 data-[side=right]:translate-x-1/2 data-[side=left]:left-full",
|
|
690
|
+
className,
|
|
691
|
+
)}
|
|
692
|
+
/>
|
|
693
|
+
);
|
|
694
|
+
});
|
|
695
|
+
|
|
696
|
+
export interface AnimatedSidebarInsetProps
|
|
697
|
+
extends HTMLMotionProps<"main"> {}
|
|
698
|
+
|
|
699
|
+
export const AnimatedSidebarInset = forwardRef<
|
|
700
|
+
HTMLElement,
|
|
701
|
+
AnimatedSidebarInsetProps
|
|
702
|
+
>(function AnimatedSidebarInset({ className, ...props }, forwardedRef) {
|
|
703
|
+
return (
|
|
704
|
+
<motion.main
|
|
705
|
+
{...props}
|
|
706
|
+
ref={forwardedRef}
|
|
707
|
+
data-slot="sidebar-inset"
|
|
708
|
+
className={cn(
|
|
709
|
+
"relative flex min-h-svh min-w-0 flex-1 flex-col bg-background",
|
|
710
|
+
"md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-2xl md:peer-data-[variant=inset]:shadow-sm",
|
|
711
|
+
className,
|
|
712
|
+
)}
|
|
713
|
+
/>
|
|
714
|
+
);
|
|
715
|
+
});
|
|
716
|
+
|
|
717
|
+
export const AnimatedSidebarHeader = forwardRef<
|
|
718
|
+
HTMLDivElement,
|
|
719
|
+
HTMLAttributes<HTMLDivElement>
|
|
720
|
+
>(function AnimatedSidebarHeader({ className, ...props }, forwardedRef) {
|
|
721
|
+
return (
|
|
722
|
+
<div
|
|
723
|
+
{...props}
|
|
724
|
+
ref={forwardedRef}
|
|
725
|
+
data-slot="sidebar-header"
|
|
726
|
+
className={cn("flex shrink-0 flex-col gap-2 p-3", className)}
|
|
727
|
+
/>
|
|
728
|
+
);
|
|
729
|
+
});
|
|
730
|
+
|
|
731
|
+
export const AnimatedSidebarContent = forwardRef<
|
|
732
|
+
HTMLDivElement,
|
|
733
|
+
HTMLAttributes<HTMLDivElement>
|
|
734
|
+
>(function AnimatedSidebarContent({ className, ...props }, forwardedRef) {
|
|
735
|
+
return (
|
|
736
|
+
<div
|
|
737
|
+
{...props}
|
|
738
|
+
ref={forwardedRef}
|
|
739
|
+
data-slot="sidebar-content"
|
|
740
|
+
className={cn(
|
|
741
|
+
"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto overflow-x-hidden overscroll-contain px-2 py-2",
|
|
742
|
+
className,
|
|
743
|
+
)}
|
|
744
|
+
/>
|
|
745
|
+
);
|
|
746
|
+
});
|
|
747
|
+
|
|
748
|
+
export const AnimatedSidebarFooter = forwardRef<
|
|
749
|
+
HTMLDivElement,
|
|
750
|
+
HTMLAttributes<HTMLDivElement>
|
|
751
|
+
>(function AnimatedSidebarFooter({ className, ...props }, forwardedRef) {
|
|
752
|
+
return (
|
|
753
|
+
<div
|
|
754
|
+
{...props}
|
|
755
|
+
ref={forwardedRef}
|
|
756
|
+
data-slot="sidebar-footer"
|
|
757
|
+
className={cn(
|
|
758
|
+
"flex shrink-0 flex-col gap-2 border-border border-t p-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]",
|
|
759
|
+
className,
|
|
760
|
+
)}
|
|
761
|
+
/>
|
|
762
|
+
);
|
|
763
|
+
});
|
|
764
|
+
|
|
765
|
+
export const AnimatedSidebarGroup = forwardRef<
|
|
766
|
+
HTMLDivElement,
|
|
767
|
+
HTMLAttributes<HTMLDivElement>
|
|
768
|
+
>(function AnimatedSidebarGroup({ className, ...props }, forwardedRef) {
|
|
769
|
+
return (
|
|
770
|
+
<div
|
|
771
|
+
{...props}
|
|
772
|
+
ref={forwardedRef}
|
|
773
|
+
data-slot="sidebar-group"
|
|
774
|
+
className={cn("flex w-full min-w-0 flex-col px-1 py-1.5", className)}
|
|
775
|
+
/>
|
|
776
|
+
);
|
|
777
|
+
});
|
|
778
|
+
|
|
779
|
+
export const AnimatedSidebarGroupLabel = forwardRef<
|
|
780
|
+
HTMLDivElement,
|
|
781
|
+
HTMLAttributes<HTMLDivElement>
|
|
782
|
+
>(function AnimatedSidebarGroupLabel(
|
|
783
|
+
{ children, className, ...props },
|
|
784
|
+
forwardedRef,
|
|
785
|
+
) {
|
|
786
|
+
const { collapsed } = useAnimatedSidebarPanel();
|
|
787
|
+
|
|
788
|
+
return (
|
|
789
|
+
<div
|
|
790
|
+
{...props}
|
|
791
|
+
ref={forwardedRef}
|
|
792
|
+
aria-hidden={collapsed}
|
|
793
|
+
data-slot="sidebar-group-label"
|
|
794
|
+
className={cn(
|
|
795
|
+
"mb-1 h-7 overflow-hidden px-2 text-[10px] font-medium uppercase tracking-[0.14em] text-muted-foreground transition-opacity",
|
|
796
|
+
collapsed ? "opacity-0" : "opacity-100",
|
|
797
|
+
className,
|
|
798
|
+
)}
|
|
799
|
+
>
|
|
800
|
+
{children}
|
|
801
|
+
</div>
|
|
802
|
+
);
|
|
803
|
+
});
|
|
804
|
+
|
|
805
|
+
export const AnimatedSidebarGroupContent = forwardRef<
|
|
806
|
+
HTMLDivElement,
|
|
807
|
+
HTMLAttributes<HTMLDivElement>
|
|
808
|
+
>(function AnimatedSidebarGroupContent(
|
|
809
|
+
{ className, ...props },
|
|
810
|
+
forwardedRef,
|
|
811
|
+
) {
|
|
812
|
+
return (
|
|
813
|
+
<div
|
|
814
|
+
{...props}
|
|
815
|
+
ref={forwardedRef}
|
|
816
|
+
data-slot="sidebar-group-content"
|
|
817
|
+
className={cn("w-full min-w-0", className)}
|
|
818
|
+
/>
|
|
819
|
+
);
|
|
820
|
+
});
|
|
821
|
+
|
|
822
|
+
export const AnimatedSidebarMenu = forwardRef<
|
|
823
|
+
HTMLUListElement,
|
|
824
|
+
HTMLAttributes<HTMLUListElement>
|
|
825
|
+
>(function AnimatedSidebarMenu(
|
|
826
|
+
{ children, className, ...props },
|
|
827
|
+
forwardedRef,
|
|
828
|
+
) {
|
|
829
|
+
return (
|
|
830
|
+
<SharedLayoutBg
|
|
831
|
+
{...props}
|
|
832
|
+
ref={forwardedRef as React.Ref<HTMLElement>}
|
|
833
|
+
as="ul"
|
|
834
|
+
inset={0}
|
|
835
|
+
pillClassName="rounded-xl bg-muted/70"
|
|
836
|
+
pillContainerClassName="inset-y-auto top-0 h-9"
|
|
837
|
+
data-slot="sidebar-menu"
|
|
838
|
+
className={cn("flex w-full min-w-0 list-none flex-col gap-0.5", className)}
|
|
839
|
+
>
|
|
840
|
+
{children}
|
|
841
|
+
</SharedLayoutBg>
|
|
842
|
+
);
|
|
843
|
+
});
|
|
844
|
+
|
|
845
|
+
export const AnimatedSidebarMenuItem = forwardRef<
|
|
846
|
+
HTMLLIElement,
|
|
847
|
+
HTMLMotionProps<"li">
|
|
848
|
+
>(function AnimatedSidebarMenuItem({ className, ...props }, forwardedRef) {
|
|
849
|
+
return (
|
|
850
|
+
<motion.li
|
|
851
|
+
{...props}
|
|
852
|
+
ref={forwardedRef}
|
|
853
|
+
layout="position"
|
|
854
|
+
transition={SPRING_LAYOUT}
|
|
855
|
+
data-slot="sidebar-menu-item"
|
|
856
|
+
className={cn("relative", className)}
|
|
857
|
+
/>
|
|
858
|
+
);
|
|
859
|
+
});
|
|
860
|
+
|
|
861
|
+
export interface AnimatedSidebarMenuSubProps
|
|
862
|
+
extends Omit<HTMLMotionProps<"ul">, "children"> {
|
|
863
|
+
open: boolean;
|
|
864
|
+
children?: ReactNode;
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
export const AnimatedSidebarMenuSub = forwardRef<
|
|
868
|
+
HTMLUListElement,
|
|
869
|
+
AnimatedSidebarMenuSubProps
|
|
870
|
+
>(function AnimatedSidebarMenuSub(
|
|
871
|
+
{ open, children, className, ...props },
|
|
872
|
+
forwardedRef,
|
|
873
|
+
) {
|
|
874
|
+
const context = useAnimatedSidebar();
|
|
875
|
+
const panel = useAnimatedSidebarPanel();
|
|
876
|
+
|
|
877
|
+
return (
|
|
878
|
+
<AnimatePresence initial={false} mode="popLayout">
|
|
879
|
+
{open && !panel.collapsed ? (
|
|
880
|
+
<motion.ul
|
|
881
|
+
{...props}
|
|
882
|
+
ref={forwardedRef}
|
|
883
|
+
key="sidebar-submenu"
|
|
884
|
+
variants={context.reduce ? undefined : SUBMENU_VARIANTS}
|
|
885
|
+
initial={context.reduce ? false : "closed"}
|
|
886
|
+
animate={context.reduce ? { opacity: 1 } : "open"}
|
|
887
|
+
exit={context.reduce ? { opacity: 0 } : "closed"}
|
|
888
|
+
transition={context.reduce ? { duration: 0.12 } : undefined}
|
|
889
|
+
data-slot="sidebar-menu-sub"
|
|
890
|
+
className={cn(
|
|
891
|
+
"relative mt-1 ml-5 flex min-w-0 flex-col gap-0.5 border-border border-l pl-3",
|
|
892
|
+
className,
|
|
893
|
+
)}
|
|
894
|
+
>
|
|
895
|
+
{children}
|
|
896
|
+
</motion.ul>
|
|
897
|
+
) : null}
|
|
898
|
+
</AnimatePresence>
|
|
899
|
+
);
|
|
900
|
+
});
|
|
901
|
+
|
|
902
|
+
export const AnimatedSidebarMenuSubItem = forwardRef<
|
|
903
|
+
HTMLLIElement,
|
|
904
|
+
HTMLMotionProps<"li">
|
|
905
|
+
>(function AnimatedSidebarMenuSubItem(
|
|
906
|
+
{ className, ...props },
|
|
907
|
+
forwardedRef,
|
|
908
|
+
) {
|
|
909
|
+
return (
|
|
910
|
+
<motion.li
|
|
911
|
+
{...props}
|
|
912
|
+
ref={forwardedRef}
|
|
913
|
+
variants={SUBMENU_ITEM_VARIANTS}
|
|
914
|
+
data-slot="sidebar-menu-sub-item"
|
|
915
|
+
className={cn("relative min-w-0", className)}
|
|
916
|
+
/>
|
|
917
|
+
);
|
|
918
|
+
});
|
|
919
|
+
|
|
920
|
+
export interface AnimatedSidebarMenuSubButtonProps {
|
|
921
|
+
children: ReactNode;
|
|
922
|
+
icon?: ReactNode;
|
|
923
|
+
href?: string;
|
|
924
|
+
isActive?: boolean;
|
|
925
|
+
disabled?: boolean;
|
|
926
|
+
closeOnSelect?: boolean;
|
|
927
|
+
target?: "_blank" | "_self" | "_parent" | "_top";
|
|
928
|
+
rel?: string;
|
|
929
|
+
onSelect?: () => void;
|
|
930
|
+
className?: string;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
export function AnimatedSidebarMenuSubButton({
|
|
934
|
+
children,
|
|
935
|
+
icon,
|
|
936
|
+
href,
|
|
937
|
+
isActive = false,
|
|
938
|
+
disabled = false,
|
|
939
|
+
closeOnSelect = true,
|
|
940
|
+
target,
|
|
941
|
+
rel,
|
|
942
|
+
onSelect,
|
|
943
|
+
className,
|
|
944
|
+
}: AnimatedSidebarMenuSubButtonProps) {
|
|
945
|
+
const context = useAnimatedSidebar();
|
|
946
|
+
|
|
947
|
+
const select = (
|
|
948
|
+
event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>,
|
|
949
|
+
) => {
|
|
950
|
+
if (disabled) {
|
|
951
|
+
event.preventDefault();
|
|
952
|
+
return;
|
|
953
|
+
}
|
|
954
|
+
onSelect?.();
|
|
955
|
+
if (context.isMobile && closeOnSelect) context.setOpenMobile(false);
|
|
956
|
+
};
|
|
957
|
+
|
|
958
|
+
const content = (
|
|
959
|
+
<>
|
|
960
|
+
<span
|
|
961
|
+
aria-hidden="true"
|
|
962
|
+
className="grid size-4 shrink-0 place-items-center"
|
|
963
|
+
>
|
|
964
|
+
{icon ?? <span className="size-1 rounded-full bg-current" />}
|
|
965
|
+
</span>
|
|
966
|
+
<span className="min-w-0 flex-1 truncate">{children}</span>
|
|
967
|
+
</>
|
|
968
|
+
);
|
|
969
|
+
|
|
970
|
+
const interactiveClassName = cn(
|
|
971
|
+
"flex min-h-8 w-full min-w-0 items-center gap-2 rounded-lg px-2 text-left text-xs outline-none",
|
|
972
|
+
"text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground",
|
|
973
|
+
"focus-visible:bg-muted/70 focus-visible:ring-2 focus-visible:ring-ring",
|
|
974
|
+
isActive && "bg-muted/70 text-foreground",
|
|
975
|
+
disabled && "cursor-not-allowed opacity-40",
|
|
976
|
+
className,
|
|
977
|
+
);
|
|
978
|
+
|
|
979
|
+
return href ? (
|
|
980
|
+
<motion.a
|
|
981
|
+
href={href}
|
|
982
|
+
target={target}
|
|
983
|
+
rel={
|
|
984
|
+
rel ??
|
|
985
|
+
(target === "_blank" ? "noreferrer noopener" : undefined)
|
|
986
|
+
}
|
|
987
|
+
aria-current={isActive ? "page" : undefined}
|
|
988
|
+
aria-disabled={disabled || undefined}
|
|
989
|
+
tabIndex={disabled ? -1 : undefined}
|
|
990
|
+
onClick={select}
|
|
991
|
+
whileTap={context.reduce || disabled ? undefined : { scale: 0.98 }}
|
|
992
|
+
transition={SPRING_PRESS}
|
|
993
|
+
className={interactiveClassName}
|
|
994
|
+
>
|
|
995
|
+
{content}
|
|
996
|
+
</motion.a>
|
|
997
|
+
) : (
|
|
998
|
+
<motion.button
|
|
999
|
+
type="button"
|
|
1000
|
+
disabled={disabled}
|
|
1001
|
+
aria-current={isActive ? "page" : undefined}
|
|
1002
|
+
onClick={select}
|
|
1003
|
+
whileTap={context.reduce || disabled ? undefined : { scale: 0.98 }}
|
|
1004
|
+
transition={SPRING_PRESS}
|
|
1005
|
+
className={interactiveClassName}
|
|
1006
|
+
>
|
|
1007
|
+
{content}
|
|
1008
|
+
</motion.button>
|
|
1009
|
+
);
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
export interface AnimatedSidebarMenuButtonProps {
|
|
1013
|
+
children: ReactNode;
|
|
1014
|
+
icon?: ReactNode;
|
|
1015
|
+
badge?: ReactNode;
|
|
1016
|
+
href?: string;
|
|
1017
|
+
isActive?: boolean;
|
|
1018
|
+
ariaExpanded?: boolean;
|
|
1019
|
+
disabled?: boolean;
|
|
1020
|
+
closeOnSelect?: boolean;
|
|
1021
|
+
target?: "_blank" | "_self" | "_parent" | "_top";
|
|
1022
|
+
rel?: string;
|
|
1023
|
+
onSelect?: () => void;
|
|
1024
|
+
className?: string;
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
export function AnimatedSidebarMenuButton({
|
|
1028
|
+
children,
|
|
1029
|
+
icon,
|
|
1030
|
+
badge,
|
|
1031
|
+
href,
|
|
1032
|
+
isActive = false,
|
|
1033
|
+
ariaExpanded,
|
|
1034
|
+
disabled = false,
|
|
1035
|
+
closeOnSelect,
|
|
1036
|
+
target,
|
|
1037
|
+
rel,
|
|
1038
|
+
onSelect,
|
|
1039
|
+
className,
|
|
1040
|
+
}: AnimatedSidebarMenuButtonProps) {
|
|
1041
|
+
const context = useAnimatedSidebar();
|
|
1042
|
+
const panel = useAnimatedSidebarPanel();
|
|
1043
|
+
const textLabel = typeof children === "string" ? children : undefined;
|
|
1044
|
+
|
|
1045
|
+
const select = (
|
|
1046
|
+
event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>,
|
|
1047
|
+
) => {
|
|
1048
|
+
if (disabled) {
|
|
1049
|
+
event.preventDefault();
|
|
1050
|
+
return;
|
|
1051
|
+
}
|
|
1052
|
+
onSelect?.();
|
|
1053
|
+
const shouldCloseOnSelect =
|
|
1054
|
+
closeOnSelect ?? ariaExpanded === undefined;
|
|
1055
|
+
if (context.isMobile && shouldCloseOnSelect) {
|
|
1056
|
+
context.setOpenMobile(false);
|
|
1057
|
+
}
|
|
1058
|
+
// A submenu cannot render in the icon rail, so opening one from there
|
|
1059
|
+
// leaves its children unreachable — a pointer can still fall back to the
|
|
1060
|
+
// rail or the shortcut, a finger has nothing. Selecting a group unfolds
|
|
1061
|
+
// the panel that is about to hold it.
|
|
1062
|
+
if (ariaExpanded !== undefined && panel.collapsed && !context.isMobile) {
|
|
1063
|
+
context.setOpen(true);
|
|
1064
|
+
}
|
|
1065
|
+
};
|
|
1066
|
+
|
|
1067
|
+
const content = (
|
|
1068
|
+
<>
|
|
1069
|
+
{isActive ? (
|
|
1070
|
+
<motion.span
|
|
1071
|
+
layoutId={context.layoutId}
|
|
1072
|
+
transition={context.reduce ? { duration: 0 } : SPRING_LAYOUT}
|
|
1073
|
+
className="absolute inset-0 rounded-xl bg-muted"
|
|
1074
|
+
/>
|
|
1075
|
+
) : null}
|
|
1076
|
+
{icon ? (
|
|
1077
|
+
<span
|
|
1078
|
+
aria-hidden="true"
|
|
1079
|
+
className="relative z-10 grid size-5 shrink-0 place-items-center"
|
|
1080
|
+
>
|
|
1081
|
+
{icon}
|
|
1082
|
+
</span>
|
|
1083
|
+
) : null}
|
|
1084
|
+
<motion.span
|
|
1085
|
+
initial={false}
|
|
1086
|
+
animate={{
|
|
1087
|
+
opacity: panel.collapsed ? 0 : 1,
|
|
1088
|
+
x: panel.collapsed ? -4 : 0,
|
|
1089
|
+
}}
|
|
1090
|
+
transition={
|
|
1091
|
+
context.reduce
|
|
1092
|
+
? REDUCED_TRANSITION
|
|
1093
|
+
: panel.collapsed
|
|
1094
|
+
? LABEL_EXIT_TRANSITION
|
|
1095
|
+
: LABEL_ENTER_TRANSITION
|
|
1096
|
+
}
|
|
1097
|
+
aria-hidden={panel.collapsed}
|
|
1098
|
+
className={cn(
|
|
1099
|
+
"relative z-10 min-w-0 flex-1 truncate",
|
|
1100
|
+
panel.collapsed && "pointer-events-none",
|
|
1101
|
+
)}
|
|
1102
|
+
>
|
|
1103
|
+
{children}
|
|
1104
|
+
</motion.span>
|
|
1105
|
+
{badge && !panel.collapsed ? (
|
|
1106
|
+
<span className="relative z-10 shrink-0 text-xs text-muted-foreground">
|
|
1107
|
+
{badge}
|
|
1108
|
+
</span>
|
|
1109
|
+
) : null}
|
|
1110
|
+
{ariaExpanded !== undefined ? (
|
|
1111
|
+
<motion.span
|
|
1112
|
+
aria-hidden="true"
|
|
1113
|
+
initial={false}
|
|
1114
|
+
animate={{
|
|
1115
|
+
opacity: panel.collapsed ? 0 : 1,
|
|
1116
|
+
rotate: ariaExpanded ? 90 : 0,
|
|
1117
|
+
x: panel.collapsed ? 4 : 0,
|
|
1118
|
+
}}
|
|
1119
|
+
transition={context.reduce ? { duration: 0 } : SPRING_LAYOUT}
|
|
1120
|
+
className="relative z-10 grid size-4 shrink-0 place-items-center text-muted-foreground"
|
|
1121
|
+
>
|
|
1122
|
+
<ChevronRight className="size-3.5" />
|
|
1123
|
+
</motion.span>
|
|
1124
|
+
) : null}
|
|
1125
|
+
</>
|
|
1126
|
+
);
|
|
1127
|
+
|
|
1128
|
+
const interactiveClassName = cn(
|
|
1129
|
+
"relative flex min-h-9 w-full min-w-0 items-center gap-2.5 overflow-hidden rounded-xl px-3 text-left text-sm font-medium outline-none",
|
|
1130
|
+
"text-muted-foreground transition-colors hover:text-foreground",
|
|
1131
|
+
"focus-visible:bg-muted/70 focus-visible:ring-2 focus-visible:ring-ring",
|
|
1132
|
+
isActive && "text-foreground",
|
|
1133
|
+
disabled && "cursor-not-allowed opacity-40",
|
|
1134
|
+
className,
|
|
1135
|
+
);
|
|
1136
|
+
|
|
1137
|
+
return href ? (
|
|
1138
|
+
<motion.a
|
|
1139
|
+
href={href}
|
|
1140
|
+
target={target}
|
|
1141
|
+
rel={
|
|
1142
|
+
rel ??
|
|
1143
|
+
(target === "_blank" ? "noreferrer noopener" : undefined)
|
|
1144
|
+
}
|
|
1145
|
+
aria-current={isActive ? "page" : undefined}
|
|
1146
|
+
aria-expanded={ariaExpanded}
|
|
1147
|
+
aria-disabled={disabled || undefined}
|
|
1148
|
+
aria-label={panel.collapsed ? textLabel : undefined}
|
|
1149
|
+
title={panel.collapsed ? textLabel : undefined}
|
|
1150
|
+
tabIndex={disabled ? -1 : undefined}
|
|
1151
|
+
onClick={select}
|
|
1152
|
+
whileTap={context.reduce || disabled ? undefined : { scale: 0.98 }}
|
|
1153
|
+
transition={SPRING_PRESS}
|
|
1154
|
+
className={interactiveClassName}
|
|
1155
|
+
>
|
|
1156
|
+
{content}
|
|
1157
|
+
</motion.a>
|
|
1158
|
+
) : (
|
|
1159
|
+
<motion.button
|
|
1160
|
+
type="button"
|
|
1161
|
+
disabled={disabled}
|
|
1162
|
+
aria-current={isActive ? "page" : undefined}
|
|
1163
|
+
aria-expanded={ariaExpanded}
|
|
1164
|
+
aria-label={panel.collapsed ? textLabel : undefined}
|
|
1165
|
+
title={panel.collapsed ? textLabel : undefined}
|
|
1166
|
+
onClick={select}
|
|
1167
|
+
whileTap={context.reduce || disabled ? undefined : { scale: 0.98 }}
|
|
1168
|
+
transition={SPRING_PRESS}
|
|
1169
|
+
className={interactiveClassName}
|
|
1170
|
+
>
|
|
1171
|
+
{content}
|
|
1172
|
+
</motion.button>
|
|
1173
|
+
);
|
|
1174
|
+
}
|