@burtson-labs/ui 0.13.1 → 0.14.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/LICENSES/DEPENDENCIES.txt +2745 -0
- package/LICENSES/Radix-MIT.txt +21 -0
- package/LICENSES/cmdk-MIT.txt +21 -0
- package/LICENSES/overrides/react-remove-scroll-bar.txt +26 -0
- package/LICENSES/shadcn-MIT.txt +21 -0
- package/README.md +5 -1
- package/THIRD_PARTY_NOTICES.md +15 -3
- package/dist/components/accordion.d.ts +1 -1
- package/dist/components/accordion.js +9 -8
- package/dist/components/accordion.js.map +1 -1
- package/dist/components/alert-dialog.d.ts +1 -1
- package/dist/components/alert-dialog.js +12 -11
- package/dist/components/alert-dialog.js.map +1 -1
- package/dist/components/alert.js +1 -0
- package/dist/components/alert.js.map +1 -1
- package/dist/components/app-shell.js +1 -0
- package/dist/components/app-shell.js.map +1 -1
- package/dist/components/attachment.js +1 -0
- package/dist/components/attachment.js.map +1 -1
- package/dist/components/audio-player.js +1 -0
- package/dist/components/audio-player.js.map +1 -1
- package/dist/components/avatar.d.ts +1 -1
- package/dist/components/avatar.js +7 -6
- package/dist/components/avatar.js.map +1 -1
- package/dist/components/badge.js +3 -3
- package/dist/components/badge.js.map +1 -1
- package/dist/components/breadcrumb.js +3 -3
- package/dist/components/breadcrumb.js.map +1 -1
- package/dist/components/button.d.ts +2 -2
- package/dist/components/button.js +3 -3
- package/dist/components/button.js.map +1 -1
- package/dist/components/card.d.ts +1 -1
- package/dist/components/card.js +1 -0
- package/dist/components/card.js.map +1 -1
- package/dist/components/chat-history.js +1 -0
- package/dist/components/chat-history.js.map +1 -1
- package/dist/components/chat-layout.js +1 -0
- package/dist/components/chat-layout.js.map +1 -1
- package/dist/components/checkbox-card.d.ts +1 -1
- package/dist/components/checkbox-card.js +3 -3
- package/dist/components/checkbox-card.js.map +1 -1
- package/dist/components/checkbox.d.ts +1 -1
- package/dist/components/checkbox.js +6 -5
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/collapsible.d.ts +1 -1
- package/dist/components/collapsible.js +7 -6
- package/dist/components/collapsible.js.map +1 -1
- package/dist/components/combobox.js +1 -0
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/command.d.ts +1 -1
- package/dist/components/command.js +12 -11
- package/dist/components/command.js.map +1 -1
- package/dist/components/composer.js +1 -0
- package/dist/components/composer.js.map +1 -1
- package/dist/components/connection-status.js +1 -0
- package/dist/components/connection-status.js.map +1 -1
- package/dist/components/context-menu.d.ts +1 -1
- package/dist/components/context-menu.js +19 -18
- package/dist/components/context-menu.js.map +1 -1
- package/dist/components/conversation.js +1 -0
- package/dist/components/conversation.js.map +1 -1
- package/dist/components/copy-button.js +1 -0
- package/dist/components/copy-button.js.map +1 -1
- package/dist/components/data-table.js +1 -0
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/dialog.d.ts +1 -1
- package/dist/components/dialog.js +13 -12
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/dropdown-menu.d.ts +1 -1
- package/dist/components/dropdown-menu.js +19 -18
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/editor-tabs.js +1 -0
- package/dist/components/editor-tabs.js.map +1 -1
- package/dist/components/empty-state.js +1 -0
- package/dist/components/empty-state.js.map +1 -1
- package/dist/components/field.js +1 -0
- package/dist/components/field.js.map +1 -1
- package/dist/components/icon-button.js +1 -0
- package/dist/components/icon-button.js.map +1 -1
- package/dist/components/input.js +1 -0
- package/dist/components/input.js.map +1 -1
- package/dist/components/kbd.js +1 -0
- package/dist/components/kbd.js.map +1 -1
- package/dist/components/label.d.ts +1 -1
- package/dist/components/label.js +5 -4
- package/dist/components/label.js.map +1 -1
- package/dist/components/markdown.js +1 -0
- package/dist/components/markdown.js.map +1 -1
- package/dist/components/menubar.d.ts +1 -1
- package/dist/components/menubar.js +20 -19
- package/dist/components/menubar.js.map +1 -1
- package/dist/components/message-actions.js +1 -0
- package/dist/components/message-actions.js.map +1 -1
- package/dist/components/message.js +1 -0
- package/dist/components/message.js.map +1 -1
- package/dist/components/mobile-nav.js +1 -0
- package/dist/components/mobile-nav.js.map +1 -1
- package/dist/components/navigation-menu.d.ts +1 -1
- package/dist/components/navigation-menu.js +12 -11
- package/dist/components/navigation-menu.js.map +1 -1
- package/dist/components/onboarding-checklist.js +1 -0
- package/dist/components/onboarding-checklist.js.map +1 -1
- package/dist/components/page-header.js +1 -0
- package/dist/components/page-header.js.map +1 -1
- package/dist/components/pagination.js +1 -0
- package/dist/components/pagination.js.map +1 -1
- package/dist/components/popover.d.ts +1 -1
- package/dist/components/popover.js +8 -7
- package/dist/components/popover.js.map +1 -1
- package/dist/components/progress.d.ts +1 -1
- package/dist/components/progress.js +6 -5
- package/dist/components/progress.js.map +1 -1
- package/dist/components/radio-group.d.ts +1 -1
- package/dist/components/radio-group.js +7 -6
- package/dist/components/radio-group.js.map +1 -1
- package/dist/components/reasoning.js +5 -4
- package/dist/components/reasoning.js.map +1 -1
- package/dist/components/resizable.js +1 -0
- package/dist/components/resizable.js.map +1 -1
- package/dist/components/scroll-area.d.ts +1 -1
- package/dist/components/scroll-area.js +9 -8
- package/dist/components/scroll-area.js.map +1 -1
- package/dist/components/secret-input.js +1 -0
- package/dist/components/secret-input.js.map +1 -1
- package/dist/components/select.d.ts +1 -1
- package/dist/components/select.js +18 -17
- package/dist/components/select.js.map +1 -1
- package/dist/components/separator.d.ts +1 -1
- package/dist/components/separator.js +5 -4
- package/dist/components/separator.js.map +1 -1
- package/dist/components/sheet.d.ts +1 -1
- package/dist/components/sheet.js +10 -9
- package/dist/components/sheet.js.map +1 -1
- package/dist/components/skeleton.js +1 -0
- package/dist/components/skeleton.js.map +1 -1
- package/dist/components/slider.js +1 -0
- package/dist/components/slider.js.map +1 -1
- package/dist/components/source.js +1 -0
- package/dist/components/source.js.map +1 -1
- package/dist/components/spinner.js +1 -0
- package/dist/components/spinner.js.map +1 -1
- package/dist/components/stat-card.js +1 -0
- package/dist/components/stat-card.js.map +1 -1
- package/dist/components/status.js +1 -0
- package/dist/components/status.js.map +1 -1
- package/dist/components/steps.js +1 -0
- package/dist/components/steps.js.map +1 -1
- package/dist/components/switch.d.ts +1 -1
- package/dist/components/switch.js +6 -5
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table.js +1 -0
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.d.ts +1 -1
- package/dist/components/tabs.js +8 -7
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/textarea.js +1 -0
- package/dist/components/textarea.js.map +1 -1
- package/dist/components/toast.d.ts +1 -1
- package/dist/components/toast.js +11 -10
- package/dist/components/toast.js.map +1 -1
- package/dist/components/toaster.js +1 -0
- package/dist/components/toaster.js.map +1 -1
- package/dist/components/tool-call.js +5 -4
- package/dist/components/tool-call.js.map +1 -1
- package/dist/components/toolbar.js +1 -0
- package/dist/components/toolbar.js.map +1 -1
- package/dist/components/tooltip.d.ts +1 -1
- package/dist/components/tooltip.js +10 -9
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/tour.js +8 -6
- package/dist/components/tour.js.map +1 -1
- package/dist/components/tree-view.js +1 -0
- package/dist/components/tree-view.js.map +1 -1
- package/dist/components/voice-recorder.js +1 -0
- package/dist/components/voice-recorder.js.map +1 -1
- package/dist/primitives/vendor/cmdk/command-score.d.ts +1 -0
- package/dist/primitives/vendor/cmdk/command-score.js +64 -0
- package/dist/primitives/vendor/cmdk/command-score.js.map +1 -0
- package/dist/primitives/vendor/cmdk/index.d.ts +384 -0
- package/dist/primitives/vendor/cmdk/index.js +687 -0
- package/dist/primitives/vendor/cmdk/index.js.map +1 -0
- package/dist/primitives/vendor/radix/number/index.d.ts +1 -0
- package/dist/primitives/vendor/radix/number/number.d.ts +2 -0
- package/dist/primitives/vendor/radix/number/number.js +9 -0
- package/dist/primitives/vendor/radix/number/number.js.map +1 -0
- package/dist/primitives/vendor/radix/primitive/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/primitive/is-development.d.ts +1 -0
- package/dist/primitives/vendor/radix/primitive/is-development.js +7 -0
- package/dist/primitives/vendor/radix/primitive/is-development.js.map +1 -0
- package/dist/primitives/vendor/radix/primitive/primitive.d.ts +14 -0
- package/dist/primitives/vendor/radix/primitive/primitive.js +12 -0
- package/dist/primitives/vendor/radix/primitive/primitive.js.map +1 -0
- package/dist/primitives/vendor/radix/primitive/types.d.ts +5 -0
- package/dist/primitives/vendor/radix/react-accordion/accordion.d.ts +112 -0
- package/dist/primitives/vendor/radix/react-accordion/accordion.js +266 -0
- package/dist/primitives/vendor/radix/react-accordion/accordion.js.map +1 -0
- package/dist/primitives/vendor/radix/react-accordion/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-alert-dialog/alert-dialog.d.ts +49 -0
- package/dist/primitives/vendor/radix/react-alert-dialog/alert-dialog.js +122 -0
- package/dist/primitives/vendor/radix/react-alert-dialog/alert-dialog.js.map +1 -0
- package/dist/primitives/vendor/radix/react-alert-dialog/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-arrow/arrow.d.ts +9 -0
- package/dist/primitives/vendor/radix/react-arrow/arrow.js +22 -0
- package/dist/primitives/vendor/radix/react-arrow/arrow.js.map +1 -0
- package/dist/primitives/vendor/radix/react-arrow/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-avatar/avatar.d.ts +19 -0
- package/dist/primitives/vendor/radix/react-avatar/avatar.js +132 -0
- package/dist/primitives/vendor/radix/react-avatar/avatar.js.map +1 -0
- package/dist/primitives/vendor/radix/react-avatar/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-checkbox/checkbox.d.ts +47 -0
- package/dist/primitives/vendor/radix/react-checkbox/checkbox.js +197 -0
- package/dist/primitives/vendor/radix/react-checkbox/checkbox.js.map +1 -0
- package/dist/primitives/vendor/radix/react-checkbox/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-collapsible/collapsible.d.ts +31 -0
- package/dist/primitives/vendor/radix/react-collapsible/collapsible.js +133 -0
- package/dist/primitives/vendor/radix/react-collapsible/collapsible.js.map +1 -0
- package/dist/primitives/vendor/radix/react-collapsible/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-collection/collection-legacy.d.ts +21 -0
- package/dist/primitives/vendor/radix/react-collection/collection-legacy.js +84 -0
- package/dist/primitives/vendor/radix/react-collection/collection-legacy.js.map +1 -0
- package/dist/primitives/vendor/radix/react-collection/collection.d.ts +32 -0
- package/dist/primitives/vendor/radix/react-collection/index.d.ts +4 -0
- package/dist/primitives/vendor/radix/react-collection/ordered-dictionary.d.ts +51 -0
- package/dist/primitives/vendor/radix/react-compose-refs/compose-refs.d.ts +13 -0
- package/dist/primitives/vendor/radix/react-compose-refs/compose-refs.js +43 -0
- package/dist/primitives/vendor/radix/react-compose-refs/compose-refs.js.map +1 -0
- package/dist/primitives/vendor/radix/react-compose-refs/index.d.ts +1 -0
- package/dist/primitives/vendor/radix/react-context/create-context.d.ts +45 -0
- package/dist/primitives/vendor/radix/react-context/create-context.js +74 -0
- package/dist/primitives/vendor/radix/react-context/create-context.js.map +1 -0
- package/dist/primitives/vendor/radix/react-context/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-context-menu/context-menu.d.ts +95 -0
- package/dist/primitives/vendor/radix/react-context-menu/context-menu.js +279 -0
- package/dist/primitives/vendor/radix/react-context-menu/context-menu.js.map +1 -0
- package/dist/primitives/vendor/radix/react-context-menu/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-dialog/dialog.d.ts +97 -0
- package/dist/primitives/vendor/radix/react-dialog/dialog.js +262 -0
- package/dist/primitives/vendor/radix/react-dialog/dialog.js.map +1 -0
- package/dist/primitives/vendor/radix/react-dialog/index.d.ts +4 -0
- package/dist/primitives/vendor/radix/react-direction/direction.d.ts +10 -0
- package/dist/primitives/vendor/radix/react-direction/direction.js +13 -0
- package/dist/primitives/vendor/radix/react-direction/direction.js.map +1 -0
- package/dist/primitives/vendor/radix/react-direction/index.d.ts +1 -0
- package/dist/primitives/vendor/radix/react-dismissable-layer/dismissable-layer.d.ts +61 -0
- package/dist/primitives/vendor/radix/react-dismissable-layer/dismissable-layer.js +336 -0
- package/dist/primitives/vendor/radix/react-dismissable-layer/dismissable-layer.js.map +1 -0
- package/dist/primitives/vendor/radix/react-dismissable-layer/index.d.ts +4 -0
- package/dist/primitives/vendor/radix/react-dropdown-menu/dropdown-menu.d.ts +95 -0
- package/dist/primitives/vendor/radix/react-dropdown-menu/dropdown-menu.js +257 -0
- package/dist/primitives/vendor/radix/react-dropdown-menu/dropdown-menu.js.map +1 -0
- package/dist/primitives/vendor/radix/react-dropdown-menu/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-focus-guards/focus-guards.d.ts +11 -0
- package/dist/primitives/vendor/radix/react-focus-guards/focus-guards.js +49 -0
- package/dist/primitives/vendor/radix/react-focus-guards/focus-guards.js.map +1 -0
- package/dist/primitives/vendor/radix/react-focus-guards/index.d.ts +1 -0
- package/dist/primitives/vendor/radix/react-focus-scope/focus-scope.d.ts +31 -0
- package/dist/primitives/vendor/radix/react-focus-scope/focus-scope.js +221 -0
- package/dist/primitives/vendor/radix/react-focus-scope/focus-scope.js.map +1 -0
- package/dist/primitives/vendor/radix/react-focus-scope/index.d.ts +1 -0
- package/dist/primitives/vendor/radix/react-id/id.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-id/id.js +17 -0
- package/dist/primitives/vendor/radix/react-id/id.js.map +1 -0
- package/dist/primitives/vendor/radix/react-id/index.d.ts +1 -0
- package/dist/primitives/vendor/radix/react-label/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-label/label.d.ts +9 -0
- package/dist/primitives/vendor/radix/react-label/label.js +21 -0
- package/dist/primitives/vendor/radix/react-label/label.js.map +1 -0
- package/dist/primitives/vendor/radix/react-menu/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-menu/menu.d.ts +173 -0
- package/dist/primitives/vendor/radix/react-menu/menu.js +806 -0
- package/dist/primitives/vendor/radix/react-menu/menu.js.map +1 -0
- package/dist/primitives/vendor/radix/react-menubar/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-menubar/menubar.d.ts +106 -0
- package/dist/primitives/vendor/radix/react-menubar/menubar.js +377 -0
- package/dist/primitives/vendor/radix/react-menubar/menubar.js.map +1 -0
- package/dist/primitives/vendor/radix/react-navigation-menu/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-navigation-menu/navigation-menu.d.ts +124 -0
- package/dist/primitives/vendor/radix/react-navigation-menu/navigation-menu.js +743 -0
- package/dist/primitives/vendor/radix/react-navigation-menu/navigation-menu.js.map +1 -0
- package/dist/primitives/vendor/radix/react-popover/index.d.ts +1 -0
- package/dist/primitives/vendor/radix/react-popover/popover.d.ts +83 -0
- package/dist/primitives/vendor/radix/react-popover/popover.js +236 -0
- package/dist/primitives/vendor/radix/react-popover/popover.js.map +1 -0
- package/dist/primitives/vendor/radix/react-popper/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-popper/popper.d.ts +44 -0
- package/dist/primitives/vendor/radix/react-popper/popper.js +276 -0
- package/dist/primitives/vendor/radix/react-popper/popper.js.map +1 -0
- package/dist/primitives/vendor/radix/react-portal/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-portal/portal.d.ts +13 -0
- package/dist/primitives/vendor/radix/react-portal/portal.js +21 -0
- package/dist/primitives/vendor/radix/react-portal/portal.js.map +1 -0
- package/dist/primitives/vendor/radix/react-presence/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-presence/presence.d.ts +11 -0
- package/dist/primitives/vendor/radix/react-presence/presence.js +152 -0
- package/dist/primitives/vendor/radix/react-presence/presence.js.map +1 -0
- package/dist/primitives/vendor/radix/react-presence/use-state-machine.d.ts +10 -0
- package/dist/primitives/vendor/radix/react-presence/use-state-machine.js +12 -0
- package/dist/primitives/vendor/radix/react-presence/use-state-machine.js.map +1 -0
- package/dist/primitives/vendor/radix/react-primitive/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-primitive/primitive.d.ts +56 -0
- package/dist/primitives/vendor/radix/react-primitive/primitive.js +84 -0
- package/dist/primitives/vendor/radix/react-primitive/primitive.js.map +1 -0
- package/dist/primitives/vendor/radix/react-progress/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-progress/progress.d.ts +17 -0
- package/dist/primitives/vendor/radix/react-progress/progress.js +79 -0
- package/dist/primitives/vendor/radix/react-progress/progress.js.map +1 -0
- package/dist/primitives/vendor/radix/react-radio-group/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-radio-group/radio-group.d.ts +55 -0
- package/dist/primitives/vendor/radix/react-radio-group/radio-group.js +173 -0
- package/dist/primitives/vendor/radix/react-radio-group/radio-group.js.map +1 -0
- package/dist/primitives/vendor/radix/react-radio-group/radio.d.ts +62 -0
- package/dist/primitives/vendor/radix/react-radio-group/radio.js +150 -0
- package/dist/primitives/vendor/radix/react-radio-group/radio.js.map +1 -0
- package/dist/primitives/vendor/radix/react-roving-focus/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-roving-focus/roving-focus-group.d.ts +47 -0
- package/dist/primitives/vendor/radix/react-roving-focus/roving-focus-group.js +218 -0
- package/dist/primitives/vendor/radix/react-roving-focus/roving-focus-group.js.map +1 -0
- package/dist/primitives/vendor/radix/react-scroll-area/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-scroll-area/scroll-area.d.ts +121 -0
- package/dist/primitives/vendor/radix/react-scroll-area/scroll-area.js +713 -0
- package/dist/primitives/vendor/radix/react-scroll-area/scroll-area.js.map +1 -0
- package/dist/primitives/vendor/radix/react-scroll-area/use-state-machine.d.ts +10 -0
- package/dist/primitives/vendor/radix/react-scroll-area/use-state-machine.js +12 -0
- package/dist/primitives/vendor/radix/react-scroll-area/use-state-machine.js.map +1 -0
- package/dist/primitives/vendor/radix/react-select/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-select/select.d.ts +163 -0
- package/dist/primitives/vendor/radix/react-select/select.js +1040 -0
- package/dist/primitives/vendor/radix/react-select/select.js.map +1 -0
- package/dist/primitives/vendor/radix/react-separator/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-separator/separator.d.ts +20 -0
- package/dist/primitives/vendor/radix/react-separator/separator.js +29 -0
- package/dist/primitives/vendor/radix/react-separator/separator.js.map +1 -0
- package/dist/primitives/vendor/radix/react-slot/index.d.ts +1 -0
- package/dist/primitives/vendor/radix/react-slot/slot.d.ts +29 -0
- package/dist/primitives/vendor/radix/react-slot/slot.js +107 -0
- package/dist/primitives/vendor/radix/react-slot/slot.js.map +1 -0
- package/dist/primitives/vendor/radix/react-switch/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-switch/switch.d.ts +41 -0
- package/dist/primitives/vendor/radix/react-switch/switch.js +185 -0
- package/dist/primitives/vendor/radix/react-switch/switch.js.map +1 -0
- package/dist/primitives/vendor/radix/react-tabs/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-tabs/tabs.d.ts +54 -0
- package/dist/primitives/vendor/radix/react-tabs/tabs.js +145 -0
- package/dist/primitives/vendor/radix/react-tabs/tabs.js.map +1 -0
- package/dist/primitives/vendor/radix/react-toast/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-toast/toast.d.ts +125 -0
- package/dist/primitives/vendor/radix/react-toast/toast.js +557 -0
- package/dist/primitives/vendor/radix/react-toast/toast.js.map +1 -0
- package/dist/primitives/vendor/radix/react-tooltip/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-tooltip/tooltip.d.ts +99 -0
- package/dist/primitives/vendor/radix/react-tooltip/tooltip.js +503 -0
- package/dist/primitives/vendor/radix/react-tooltip/tooltip.js.map +1 -0
- package/dist/primitives/vendor/radix/react-use-callback-ref/index.d.ts +1 -0
- package/dist/primitives/vendor/radix/react-use-callback-ref/use-callback-ref.d.ts +6 -0
- package/dist/primitives/vendor/radix/react-use-callback-ref/use-callback-ref.js +18 -0
- package/dist/primitives/vendor/radix/react-use-callback-ref/use-callback-ref.js.map +1 -0
- package/dist/primitives/vendor/radix/react-use-controllable-state/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-use-controllable-state/use-controllable-state-reducer.d.ts +28 -0
- package/dist/primitives/vendor/radix/react-use-controllable-state/use-controllable-state.d.ts +11 -0
- package/dist/primitives/vendor/radix/react-use-controllable-state/use-controllable-state.js +59 -0
- package/dist/primitives/vendor/radix/react-use-controllable-state/use-controllable-state.js.map +1 -0
- package/dist/primitives/vendor/radix/react-use-effect-event/index.d.ts +1 -0
- package/dist/primitives/vendor/radix/react-use-effect-event/use-effect-event.d.ts +7 -0
- package/dist/primitives/vendor/radix/react-use-is-hydrated/index.d.ts +1 -0
- package/dist/primitives/vendor/radix/react-use-is-hydrated/use-is-hydrated-legacy.d.ts +1 -0
- package/dist/primitives/vendor/radix/react-use-is-hydrated/use-is-hydrated-legacy.js +18 -0
- package/dist/primitives/vendor/radix/react-use-is-hydrated/use-is-hydrated-legacy.js.map +1 -0
- package/dist/primitives/vendor/radix/react-use-is-hydrated/use-is-hydrated.d.ts +6 -0
- package/dist/primitives/vendor/radix/react-use-is-hydrated/use-is-hydrated.js +19 -0
- package/dist/primitives/vendor/radix/react-use-is-hydrated/use-is-hydrated.js.map +1 -0
- package/dist/primitives/vendor/radix/react-use-layout-effect/index.d.ts +1 -0
- package/dist/primitives/vendor/radix/react-use-layout-effect/use-layout-effect.d.ts +10 -0
- package/dist/primitives/vendor/radix/react-use-layout-effect/use-layout-effect.js +15 -0
- package/dist/primitives/vendor/radix/react-use-layout-effect/use-layout-effect.js.map +1 -0
- package/dist/primitives/vendor/radix/react-use-previous/index.d.ts +1 -0
- package/dist/primitives/vendor/radix/react-use-previous/use-previous.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-use-previous/use-previous.js +20 -0
- package/dist/primitives/vendor/radix/react-use-previous/use-previous.js.map +1 -0
- package/dist/primitives/vendor/radix/react-use-size/index.d.ts +1 -0
- package/dist/primitives/vendor/radix/react-use-size/use-size.d.ts +5 -0
- package/dist/primitives/vendor/radix/react-use-size/use-size.js +42 -0
- package/dist/primitives/vendor/radix/react-use-size/use-size.js.map +1 -0
- package/dist/primitives/vendor/radix/react-visually-hidden/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-visually-hidden/visually-hidden.d.ts +21 -0
- package/dist/primitives/vendor/radix/react-visually-hidden/visually-hidden.js +32 -0
- package/dist/primitives/vendor/radix/react-visually-hidden/visually-hidden.js.map +1 -0
- package/dist/primitives/vendor/radix/rect/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/rect/observe-element-rect.d.ts +16 -0
- package/dist/styles.css +1 -1
- package/package.json +21 -11
- package/vendor-manifest.json +1101 -0
|
@@ -0,0 +1,687 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { composeRefs } from "../radix/react-compose-refs/compose-refs.js";
|
|
4
|
+
import { Primitive } from "../radix/react-primitive/primitive.js";
|
|
5
|
+
import { useId } from "../radix/react-id/id.js";
|
|
6
|
+
import { Content as DialogContent, Dialog as Dialog$1, DialogOverlay, DialogPortal } from "../radix/react-dialog/dialog.js";
|
|
7
|
+
import { commandScore } from "./command-score.js";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
//#region src/primitives/vendor/cmdk/index.tsx
|
|
11
|
+
var GROUP_SELECTOR = `[cmdk-group=""]`;
|
|
12
|
+
var GROUP_ITEMS_SELECTOR = `[cmdk-group-items=""]`;
|
|
13
|
+
var GROUP_HEADING_SELECTOR = `[cmdk-group-heading=""]`;
|
|
14
|
+
var ITEM_SELECTOR = `[cmdk-item=""]`;
|
|
15
|
+
var VALID_ITEM_SELECTOR = `${ITEM_SELECTOR}:not([aria-disabled="true"])`;
|
|
16
|
+
var SELECT_EVENT = `cmdk-item-select`;
|
|
17
|
+
var VALUE_ATTR = `data-value`;
|
|
18
|
+
var defaultFilter = (value, search, keywords) => commandScore(value, search, keywords);
|
|
19
|
+
var CommandContext = React.createContext(void 0);
|
|
20
|
+
var useCommand = () => React.useContext(CommandContext);
|
|
21
|
+
var StoreContext = React.createContext(void 0);
|
|
22
|
+
var useStore = () => React.useContext(StoreContext);
|
|
23
|
+
var GroupContext = React.createContext(void 0);
|
|
24
|
+
var Command = React.forwardRef((props, forwardedRef) => {
|
|
25
|
+
const state = useLazyRef(() => ({
|
|
26
|
+
/** Value of the search query. */
|
|
27
|
+
search: "",
|
|
28
|
+
/** Currently selected item value. */
|
|
29
|
+
value: props.value ?? props.defaultValue ?? "",
|
|
30
|
+
/** Currently selected item id. */
|
|
31
|
+
selectedItemId: void 0,
|
|
32
|
+
filtered: {
|
|
33
|
+
/** The count of all visible items. */
|
|
34
|
+
count: 0,
|
|
35
|
+
/** Map from visible item id to its search score. */
|
|
36
|
+
items: /* @__PURE__ */ new Map(),
|
|
37
|
+
/** Set of groups with at least one visible item. */
|
|
38
|
+
groups: /* @__PURE__ */ new Set()
|
|
39
|
+
}
|
|
40
|
+
}));
|
|
41
|
+
const allItems = useLazyRef(() => /* @__PURE__ */ new Set());
|
|
42
|
+
const allGroups = useLazyRef(() => /* @__PURE__ */ new Map());
|
|
43
|
+
const ids = useLazyRef(() => /* @__PURE__ */ new Map());
|
|
44
|
+
const listeners = useLazyRef(() => /* @__PURE__ */ new Set());
|
|
45
|
+
const propsRef = useAsRef(props);
|
|
46
|
+
const { label, children, value, onValueChange, filter, shouldFilter, loop, disablePointerSelection = false, vimBindings = true, ...etc } = props;
|
|
47
|
+
const listId = useId();
|
|
48
|
+
const labelId = useId();
|
|
49
|
+
const inputId = useId();
|
|
50
|
+
const listInnerRef = React.useRef(null);
|
|
51
|
+
const schedule = useScheduleLayoutEffect();
|
|
52
|
+
/** Controlled mode `value` handling. */
|
|
53
|
+
useLayoutEffect(() => {
|
|
54
|
+
if (value !== void 0) {
|
|
55
|
+
const v = value.trim();
|
|
56
|
+
state.current.value = v;
|
|
57
|
+
store.emit();
|
|
58
|
+
}
|
|
59
|
+
}, [value]);
|
|
60
|
+
useLayoutEffect(() => {
|
|
61
|
+
schedule(6, scrollSelectedIntoView);
|
|
62
|
+
}, []);
|
|
63
|
+
const store = React.useMemo(() => {
|
|
64
|
+
return {
|
|
65
|
+
subscribe: (cb) => {
|
|
66
|
+
listeners.current.add(cb);
|
|
67
|
+
return () => listeners.current.delete(cb);
|
|
68
|
+
},
|
|
69
|
+
snapshot: () => {
|
|
70
|
+
return state.current;
|
|
71
|
+
},
|
|
72
|
+
setState: (key, value, opts) => {
|
|
73
|
+
if (Object.is(state.current[key], value)) return;
|
|
74
|
+
state.current[key] = value;
|
|
75
|
+
if (key === "search") {
|
|
76
|
+
filterItems();
|
|
77
|
+
sort();
|
|
78
|
+
schedule(1, selectFirstItem);
|
|
79
|
+
} else if (key === "value") {
|
|
80
|
+
if (document.activeElement?.hasAttribute("cmdk-input") || document.activeElement?.hasAttribute("cmdk-root")) {
|
|
81
|
+
const input = document.getElementById(inputId);
|
|
82
|
+
if (input) input.focus();
|
|
83
|
+
else document.getElementById(listId)?.focus();
|
|
84
|
+
}
|
|
85
|
+
schedule(7, () => {
|
|
86
|
+
state.current.selectedItemId = getSelectedItem()?.id;
|
|
87
|
+
store.emit();
|
|
88
|
+
});
|
|
89
|
+
if (!opts) schedule(5, scrollSelectedIntoView);
|
|
90
|
+
if (propsRef.current?.value !== void 0) {
|
|
91
|
+
const newValue = value ?? "";
|
|
92
|
+
propsRef.current.onValueChange?.(newValue);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
store.emit();
|
|
97
|
+
},
|
|
98
|
+
emit: () => {
|
|
99
|
+
listeners.current.forEach((l) => l());
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
}, []);
|
|
103
|
+
const context = React.useMemo(() => ({
|
|
104
|
+
value: (id, value, keywords) => {
|
|
105
|
+
if (value !== ids.current.get(id)?.value) {
|
|
106
|
+
ids.current.set(id, {
|
|
107
|
+
value,
|
|
108
|
+
keywords
|
|
109
|
+
});
|
|
110
|
+
state.current.filtered.items.set(id, score(value, keywords));
|
|
111
|
+
schedule(2, () => {
|
|
112
|
+
sort();
|
|
113
|
+
store.emit();
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
item: (id, groupId) => {
|
|
118
|
+
allItems.current.add(id);
|
|
119
|
+
if (groupId) {
|
|
120
|
+
if (!allGroups.current.has(groupId)) allGroups.current.set(groupId, /* @__PURE__ */ new Set([id]));
|
|
121
|
+
else allGroups.current.get(groupId).add(id);
|
|
122
|
+
}
|
|
123
|
+
schedule(3, () => {
|
|
124
|
+
filterItems();
|
|
125
|
+
sort();
|
|
126
|
+
if (!state.current.value) selectFirstItem();
|
|
127
|
+
store.emit();
|
|
128
|
+
});
|
|
129
|
+
return () => {
|
|
130
|
+
ids.current.delete(id);
|
|
131
|
+
allItems.current.delete(id);
|
|
132
|
+
state.current.filtered.items.delete(id);
|
|
133
|
+
const selectedItem = getSelectedItem();
|
|
134
|
+
schedule(4, () => {
|
|
135
|
+
filterItems();
|
|
136
|
+
if (selectedItem?.getAttribute("id") === id) selectFirstItem();
|
|
137
|
+
store.emit();
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
},
|
|
141
|
+
group: (id) => {
|
|
142
|
+
if (!allGroups.current.has(id)) allGroups.current.set(id, /* @__PURE__ */ new Set());
|
|
143
|
+
return () => {
|
|
144
|
+
ids.current.delete(id);
|
|
145
|
+
allGroups.current.delete(id);
|
|
146
|
+
};
|
|
147
|
+
},
|
|
148
|
+
filter: () => {
|
|
149
|
+
return propsRef.current.shouldFilter;
|
|
150
|
+
},
|
|
151
|
+
label: label || props["aria-label"],
|
|
152
|
+
getDisablePointerSelection: () => {
|
|
153
|
+
return propsRef.current.disablePointerSelection;
|
|
154
|
+
},
|
|
155
|
+
listId,
|
|
156
|
+
inputId,
|
|
157
|
+
labelId,
|
|
158
|
+
listInnerRef
|
|
159
|
+
}), []);
|
|
160
|
+
function score(value, keywords) {
|
|
161
|
+
const filter = propsRef.current?.filter ?? defaultFilter;
|
|
162
|
+
return value ? filter(value, state.current.search, keywords) : 0;
|
|
163
|
+
}
|
|
164
|
+
/** Sorts items by score, and groups by highest item score. */
|
|
165
|
+
function sort() {
|
|
166
|
+
if (!state.current.search || propsRef.current.shouldFilter === false) return;
|
|
167
|
+
const scores = state.current.filtered.items;
|
|
168
|
+
const groups = [];
|
|
169
|
+
state.current.filtered.groups.forEach((value) => {
|
|
170
|
+
const items = allGroups.current.get(value);
|
|
171
|
+
let max = 0;
|
|
172
|
+
items?.forEach((item) => {
|
|
173
|
+
const score = scores.get(item);
|
|
174
|
+
max = Math.max(score ?? 0, max);
|
|
175
|
+
});
|
|
176
|
+
groups.push([value, max]);
|
|
177
|
+
});
|
|
178
|
+
const listInsertionElement = listInnerRef.current;
|
|
179
|
+
getValidItems().sort((a, b) => {
|
|
180
|
+
const valueA = a.getAttribute("id");
|
|
181
|
+
const valueB = b.getAttribute("id");
|
|
182
|
+
return (scores.get(valueB) ?? 0) - (scores.get(valueA) ?? 0);
|
|
183
|
+
}).forEach((item) => {
|
|
184
|
+
const group = item.closest(GROUP_ITEMS_SELECTOR);
|
|
185
|
+
if (group) group.appendChild(item.parentElement === group ? item : item.closest(`${GROUP_ITEMS_SELECTOR} > *`));
|
|
186
|
+
else listInsertionElement.appendChild(item.parentElement === listInsertionElement ? item : item.closest(`${GROUP_ITEMS_SELECTOR} > *`));
|
|
187
|
+
});
|
|
188
|
+
groups.sort((a, b) => b[1] - a[1]).forEach((group) => {
|
|
189
|
+
const element = listInnerRef.current?.querySelector(`${GROUP_SELECTOR}[${VALUE_ATTR}="${encodeURIComponent(group[0])}"]`);
|
|
190
|
+
element?.parentElement?.appendChild(element);
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
function selectFirstItem() {
|
|
194
|
+
const value = getValidItems().find((item) => item.getAttribute("aria-disabled") !== "true")?.getAttribute(VALUE_ATTR);
|
|
195
|
+
store.setState("value", value || void 0);
|
|
196
|
+
}
|
|
197
|
+
/** Filters the current items. */
|
|
198
|
+
function filterItems() {
|
|
199
|
+
if (!state.current.search || propsRef.current.shouldFilter === false) {
|
|
200
|
+
state.current.filtered.count = allItems.current.size;
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
state.current.filtered.groups = /* @__PURE__ */ new Set();
|
|
204
|
+
let itemCount = 0;
|
|
205
|
+
for (const id of allItems.current) {
|
|
206
|
+
const rank = score(ids.current.get(id)?.value ?? "", ids.current.get(id)?.keywords ?? []);
|
|
207
|
+
state.current.filtered.items.set(id, rank);
|
|
208
|
+
if (rank > 0) itemCount++;
|
|
209
|
+
}
|
|
210
|
+
for (const [groupId, group] of allGroups.current) for (const itemId of group) if ((state.current.filtered.items.get(itemId) ?? 0) > 0) {
|
|
211
|
+
state.current.filtered.groups.add(groupId);
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
214
|
+
state.current.filtered.count = itemCount;
|
|
215
|
+
}
|
|
216
|
+
function scrollSelectedIntoView() {
|
|
217
|
+
const item = getSelectedItem();
|
|
218
|
+
if (item) {
|
|
219
|
+
if (item.parentElement?.firstChild === item) item.closest(GROUP_SELECTOR)?.querySelector(GROUP_HEADING_SELECTOR)?.scrollIntoView({ block: "nearest" });
|
|
220
|
+
item.scrollIntoView({ block: "nearest" });
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
/** Getters */
|
|
224
|
+
function getSelectedItem() {
|
|
225
|
+
return listInnerRef.current?.querySelector(`${ITEM_SELECTOR}[aria-selected="true"]`);
|
|
226
|
+
}
|
|
227
|
+
function getValidItems() {
|
|
228
|
+
return Array.from(listInnerRef.current?.querySelectorAll(VALID_ITEM_SELECTOR) || []);
|
|
229
|
+
}
|
|
230
|
+
/** Setters */
|
|
231
|
+
function updateSelectedToIndex(index) {
|
|
232
|
+
const item = getValidItems()[index];
|
|
233
|
+
if (item) store.setState("value", item.getAttribute(VALUE_ATTR));
|
|
234
|
+
}
|
|
235
|
+
function updateSelectedByItem(change) {
|
|
236
|
+
const selected = getSelectedItem();
|
|
237
|
+
const items = getValidItems();
|
|
238
|
+
const index = items.findIndex((item) => item === selected);
|
|
239
|
+
let newSelected = items[index + change];
|
|
240
|
+
if (propsRef.current?.loop) newSelected = index + change < 0 ? items[items.length - 1] : index + change === items.length ? items[0] : items[index + change];
|
|
241
|
+
if (newSelected) store.setState("value", newSelected.getAttribute(VALUE_ATTR));
|
|
242
|
+
}
|
|
243
|
+
function updateSelectedByGroup(change) {
|
|
244
|
+
let group = getSelectedItem()?.closest(GROUP_SELECTOR);
|
|
245
|
+
let item;
|
|
246
|
+
while (group && !item) {
|
|
247
|
+
group = change > 0 ? findNextSibling(group, GROUP_SELECTOR) : findPreviousSibling(group, GROUP_SELECTOR);
|
|
248
|
+
item = group?.querySelector(VALID_ITEM_SELECTOR);
|
|
249
|
+
}
|
|
250
|
+
if (item) store.setState("value", item.getAttribute(VALUE_ATTR));
|
|
251
|
+
else updateSelectedByItem(change);
|
|
252
|
+
}
|
|
253
|
+
const last = () => updateSelectedToIndex(getValidItems().length - 1);
|
|
254
|
+
const next = (e) => {
|
|
255
|
+
e.preventDefault();
|
|
256
|
+
if (e.metaKey) last();
|
|
257
|
+
else if (e.altKey) updateSelectedByGroup(1);
|
|
258
|
+
else updateSelectedByItem(1);
|
|
259
|
+
};
|
|
260
|
+
const prev = (e) => {
|
|
261
|
+
e.preventDefault();
|
|
262
|
+
if (e.metaKey) updateSelectedToIndex(0);
|
|
263
|
+
else if (e.altKey) updateSelectedByGroup(-1);
|
|
264
|
+
else updateSelectedByItem(-1);
|
|
265
|
+
};
|
|
266
|
+
return /* @__PURE__ */ jsxs(Primitive.div, {
|
|
267
|
+
ref: forwardedRef,
|
|
268
|
+
tabIndex: -1,
|
|
269
|
+
...etc,
|
|
270
|
+
"cmdk-root": "",
|
|
271
|
+
onKeyDown: (e) => {
|
|
272
|
+
etc.onKeyDown?.(e);
|
|
273
|
+
const isComposing = e.nativeEvent.isComposing || e.keyCode === 229;
|
|
274
|
+
if (e.defaultPrevented || isComposing) return;
|
|
275
|
+
switch (e.key) {
|
|
276
|
+
case "n":
|
|
277
|
+
case "j":
|
|
278
|
+
if (vimBindings && e.ctrlKey) next(e);
|
|
279
|
+
break;
|
|
280
|
+
case "ArrowDown":
|
|
281
|
+
next(e);
|
|
282
|
+
break;
|
|
283
|
+
case "p":
|
|
284
|
+
case "k":
|
|
285
|
+
if (vimBindings && e.ctrlKey) prev(e);
|
|
286
|
+
break;
|
|
287
|
+
case "ArrowUp":
|
|
288
|
+
prev(e);
|
|
289
|
+
break;
|
|
290
|
+
case "Home":
|
|
291
|
+
e.preventDefault();
|
|
292
|
+
updateSelectedToIndex(0);
|
|
293
|
+
break;
|
|
294
|
+
case "End":
|
|
295
|
+
e.preventDefault();
|
|
296
|
+
last();
|
|
297
|
+
break;
|
|
298
|
+
case "Enter": {
|
|
299
|
+
e.preventDefault();
|
|
300
|
+
const item = getSelectedItem();
|
|
301
|
+
if (item) {
|
|
302
|
+
const event = new Event(SELECT_EVENT);
|
|
303
|
+
item.dispatchEvent(event);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
children: [/* @__PURE__ */ jsx("label", {
|
|
309
|
+
"cmdk-label": "",
|
|
310
|
+
htmlFor: context.inputId,
|
|
311
|
+
id: context.labelId,
|
|
312
|
+
style: srOnlyStyles,
|
|
313
|
+
children: label
|
|
314
|
+
}), SlottableWithNestedChildren(props, (child) => /* @__PURE__ */ jsx(StoreContext.Provider, {
|
|
315
|
+
value: store,
|
|
316
|
+
children: /* @__PURE__ */ jsx(CommandContext.Provider, {
|
|
317
|
+
value: context,
|
|
318
|
+
children: child
|
|
319
|
+
})
|
|
320
|
+
}))]
|
|
321
|
+
});
|
|
322
|
+
});
|
|
323
|
+
/**
|
|
324
|
+
* Command menu item. Becomes active on pointer enter or through keyboard navigation.
|
|
325
|
+
* Preferably pass a `value`, otherwise the value will be inferred from `children` or
|
|
326
|
+
* the rendered item's `textContent`.
|
|
327
|
+
*/
|
|
328
|
+
var Item = React.forwardRef((props, forwardedRef) => {
|
|
329
|
+
const id = useId();
|
|
330
|
+
const ref = React.useRef(null);
|
|
331
|
+
const groupContext = React.useContext(GroupContext);
|
|
332
|
+
const context = useCommand();
|
|
333
|
+
const propsRef = useAsRef(props);
|
|
334
|
+
const forceMount = propsRef.current?.forceMount ?? groupContext?.forceMount;
|
|
335
|
+
useLayoutEffect(() => {
|
|
336
|
+
if (!forceMount) return context.item(id, groupContext?.id);
|
|
337
|
+
}, [forceMount]);
|
|
338
|
+
const value = useValue(id, ref, [
|
|
339
|
+
props.value,
|
|
340
|
+
props.children,
|
|
341
|
+
ref
|
|
342
|
+
], props.keywords);
|
|
343
|
+
const store = useStore();
|
|
344
|
+
const selected = useCmdk((state) => state.value && state.value === value.current);
|
|
345
|
+
const render = useCmdk((state) => forceMount ? true : context.filter() === false ? true : !state.search ? true : (state.filtered.items.get(id) ?? 0) > 0);
|
|
346
|
+
React.useEffect(() => {
|
|
347
|
+
const element = ref.current;
|
|
348
|
+
if (!element || props.disabled) return;
|
|
349
|
+
element.addEventListener(SELECT_EVENT, onSelect);
|
|
350
|
+
return () => element.removeEventListener(SELECT_EVENT, onSelect);
|
|
351
|
+
}, [
|
|
352
|
+
render,
|
|
353
|
+
props.onSelect,
|
|
354
|
+
props.disabled
|
|
355
|
+
]);
|
|
356
|
+
function onSelect() {
|
|
357
|
+
select();
|
|
358
|
+
propsRef.current.onSelect?.(value.current);
|
|
359
|
+
}
|
|
360
|
+
function select() {
|
|
361
|
+
store.setState("value", value.current, true);
|
|
362
|
+
}
|
|
363
|
+
if (!render) return null;
|
|
364
|
+
const { disabled, value: _, onSelect: __, forceMount: ___, keywords: ____, ...etc } = props;
|
|
365
|
+
return /* @__PURE__ */ jsx(Primitive.div, {
|
|
366
|
+
ref: composeRefs(ref, forwardedRef),
|
|
367
|
+
...etc,
|
|
368
|
+
id,
|
|
369
|
+
"cmdk-item": "",
|
|
370
|
+
role: "option",
|
|
371
|
+
"aria-disabled": Boolean(disabled),
|
|
372
|
+
"aria-selected": Boolean(selected),
|
|
373
|
+
"data-disabled": Boolean(disabled),
|
|
374
|
+
"data-selected": Boolean(selected),
|
|
375
|
+
onPointerMove: disabled || context.getDisablePointerSelection() ? void 0 : select,
|
|
376
|
+
onClick: disabled ? void 0 : onSelect,
|
|
377
|
+
children: props.children
|
|
378
|
+
});
|
|
379
|
+
});
|
|
380
|
+
/**
|
|
381
|
+
* Group command menu items together with a heading.
|
|
382
|
+
* Grouped items are always shown together.
|
|
383
|
+
*/
|
|
384
|
+
var Group = React.forwardRef((props, forwardedRef) => {
|
|
385
|
+
const { heading, children, forceMount, ...etc } = props;
|
|
386
|
+
const id = useId();
|
|
387
|
+
const ref = React.useRef(null);
|
|
388
|
+
const headingRef = React.useRef(null);
|
|
389
|
+
const headingId = useId();
|
|
390
|
+
const context = useCommand();
|
|
391
|
+
const render = useCmdk((state) => forceMount ? true : context.filter() === false ? true : !state.search ? true : state.filtered.groups.has(id));
|
|
392
|
+
useLayoutEffect(() => {
|
|
393
|
+
return context.group(id);
|
|
394
|
+
}, []);
|
|
395
|
+
useValue(id, ref, [
|
|
396
|
+
props.value,
|
|
397
|
+
props.heading,
|
|
398
|
+
headingRef
|
|
399
|
+
]);
|
|
400
|
+
const contextValue = React.useMemo(() => ({
|
|
401
|
+
id,
|
|
402
|
+
forceMount
|
|
403
|
+
}), [forceMount]);
|
|
404
|
+
return /* @__PURE__ */ jsxs(Primitive.div, {
|
|
405
|
+
ref: composeRefs(ref, forwardedRef),
|
|
406
|
+
...etc,
|
|
407
|
+
"cmdk-group": "",
|
|
408
|
+
role: "presentation",
|
|
409
|
+
hidden: render ? void 0 : true,
|
|
410
|
+
children: [heading && /* @__PURE__ */ jsx("div", {
|
|
411
|
+
ref: headingRef,
|
|
412
|
+
"cmdk-group-heading": "",
|
|
413
|
+
"aria-hidden": true,
|
|
414
|
+
id: headingId,
|
|
415
|
+
children: heading
|
|
416
|
+
}), SlottableWithNestedChildren(props, (child) => /* @__PURE__ */ jsx("div", {
|
|
417
|
+
"cmdk-group-items": "",
|
|
418
|
+
role: "group",
|
|
419
|
+
"aria-labelledby": heading ? headingId : void 0,
|
|
420
|
+
children: /* @__PURE__ */ jsx(GroupContext.Provider, {
|
|
421
|
+
value: contextValue,
|
|
422
|
+
children: child
|
|
423
|
+
})
|
|
424
|
+
}))]
|
|
425
|
+
});
|
|
426
|
+
});
|
|
427
|
+
/**
|
|
428
|
+
* A visual and semantic separator between items or groups.
|
|
429
|
+
* Visible when the search query is empty or `alwaysRender` is true, hidden otherwise.
|
|
430
|
+
*/
|
|
431
|
+
var Separator = React.forwardRef((props, forwardedRef) => {
|
|
432
|
+
const { alwaysRender, ...etc } = props;
|
|
433
|
+
const ref = React.useRef(null);
|
|
434
|
+
const render = useCmdk((state) => !state.search);
|
|
435
|
+
if (!alwaysRender && !render) return null;
|
|
436
|
+
return /* @__PURE__ */ jsx(Primitive.div, {
|
|
437
|
+
ref: composeRefs(ref, forwardedRef),
|
|
438
|
+
...etc,
|
|
439
|
+
"cmdk-separator": "",
|
|
440
|
+
role: "separator"
|
|
441
|
+
});
|
|
442
|
+
});
|
|
443
|
+
/**
|
|
444
|
+
* Command menu input.
|
|
445
|
+
* All props are forwarded to the underyling `input` element.
|
|
446
|
+
*/
|
|
447
|
+
var Input = React.forwardRef((props, forwardedRef) => {
|
|
448
|
+
const { onValueChange, ...etc } = props;
|
|
449
|
+
const isControlled = props.value != null;
|
|
450
|
+
const store = useStore();
|
|
451
|
+
const search = useCmdk((state) => state.search);
|
|
452
|
+
const selectedItemId = useCmdk((state) => state.selectedItemId);
|
|
453
|
+
const context = useCommand();
|
|
454
|
+
React.useEffect(() => {
|
|
455
|
+
if (props.value != null) store.setState("search", props.value);
|
|
456
|
+
}, [props.value]);
|
|
457
|
+
return /* @__PURE__ */ jsx(Primitive.input, {
|
|
458
|
+
ref: forwardedRef,
|
|
459
|
+
...etc,
|
|
460
|
+
"cmdk-input": "",
|
|
461
|
+
autoComplete: "off",
|
|
462
|
+
autoCorrect: "off",
|
|
463
|
+
spellCheck: false,
|
|
464
|
+
"aria-autocomplete": "list",
|
|
465
|
+
role: "combobox",
|
|
466
|
+
"aria-expanded": true,
|
|
467
|
+
"aria-controls": context.listId,
|
|
468
|
+
"aria-labelledby": context.labelId,
|
|
469
|
+
"aria-activedescendant": selectedItemId,
|
|
470
|
+
id: context.inputId,
|
|
471
|
+
type: "text",
|
|
472
|
+
value: isControlled ? props.value : search,
|
|
473
|
+
onChange: (e) => {
|
|
474
|
+
if (!isControlled) store.setState("search", e.target.value);
|
|
475
|
+
onValueChange?.(e.target.value);
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
});
|
|
479
|
+
/**
|
|
480
|
+
* Contains `Item`, `Group`, and `Separator`.
|
|
481
|
+
* Use the `--cmdk-list-height` CSS variable to animate height based on the number of results.
|
|
482
|
+
*/
|
|
483
|
+
var List = React.forwardRef((props, forwardedRef) => {
|
|
484
|
+
const { children, label = "Suggestions", ...etc } = props;
|
|
485
|
+
const ref = React.useRef(null);
|
|
486
|
+
const height = React.useRef(null);
|
|
487
|
+
const selectedItemId = useCmdk((state) => state.selectedItemId);
|
|
488
|
+
const context = useCommand();
|
|
489
|
+
React.useEffect(() => {
|
|
490
|
+
if (height.current && ref.current) {
|
|
491
|
+
const el = height.current;
|
|
492
|
+
const wrapper = ref.current;
|
|
493
|
+
let animationFrame = 0;
|
|
494
|
+
const observer = new ResizeObserver(() => {
|
|
495
|
+
animationFrame = requestAnimationFrame(() => {
|
|
496
|
+
const height = el.offsetHeight;
|
|
497
|
+
wrapper.style.setProperty(`--cmdk-list-height`, height.toFixed(1) + "px");
|
|
498
|
+
});
|
|
499
|
+
});
|
|
500
|
+
observer.observe(el);
|
|
501
|
+
return () => {
|
|
502
|
+
cancelAnimationFrame(animationFrame);
|
|
503
|
+
observer.unobserve(el);
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
}, []);
|
|
507
|
+
return /* @__PURE__ */ jsx(Primitive.div, {
|
|
508
|
+
ref: composeRefs(ref, forwardedRef),
|
|
509
|
+
...etc,
|
|
510
|
+
"cmdk-list": "",
|
|
511
|
+
role: "listbox",
|
|
512
|
+
tabIndex: -1,
|
|
513
|
+
"aria-activedescendant": selectedItemId,
|
|
514
|
+
"aria-label": label,
|
|
515
|
+
id: context.listId,
|
|
516
|
+
children: SlottableWithNestedChildren(props, (child) => /* @__PURE__ */ jsx("div", {
|
|
517
|
+
ref: composeRefs(height, context.listInnerRef),
|
|
518
|
+
"cmdk-list-sizer": "",
|
|
519
|
+
children: child
|
|
520
|
+
}))
|
|
521
|
+
});
|
|
522
|
+
});
|
|
523
|
+
/**
|
|
524
|
+
* Renders the command menu in a Radix Dialog.
|
|
525
|
+
*/
|
|
526
|
+
var Dialog = React.forwardRef((props, forwardedRef) => {
|
|
527
|
+
const { open, onOpenChange, overlayClassName, contentClassName, container, ...etc } = props;
|
|
528
|
+
return /* @__PURE__ */ jsx(Dialog$1, {
|
|
529
|
+
open,
|
|
530
|
+
onOpenChange,
|
|
531
|
+
children: /* @__PURE__ */ jsxs(DialogPortal, {
|
|
532
|
+
container,
|
|
533
|
+
children: [/* @__PURE__ */ jsx(DialogOverlay, {
|
|
534
|
+
"cmdk-overlay": "",
|
|
535
|
+
className: overlayClassName
|
|
536
|
+
}), /* @__PURE__ */ jsx(DialogContent, {
|
|
537
|
+
"aria-label": props.label,
|
|
538
|
+
"cmdk-dialog": "",
|
|
539
|
+
className: contentClassName,
|
|
540
|
+
children: /* @__PURE__ */ jsx(Command, {
|
|
541
|
+
ref: forwardedRef,
|
|
542
|
+
...etc
|
|
543
|
+
})
|
|
544
|
+
})]
|
|
545
|
+
})
|
|
546
|
+
});
|
|
547
|
+
});
|
|
548
|
+
/**
|
|
549
|
+
* Automatically renders when there are no results for the search query.
|
|
550
|
+
*/
|
|
551
|
+
var Empty = React.forwardRef((props, forwardedRef) => {
|
|
552
|
+
if (!useCmdk((state) => state.filtered.count === 0)) return null;
|
|
553
|
+
return /* @__PURE__ */ jsx(Primitive.div, {
|
|
554
|
+
ref: forwardedRef,
|
|
555
|
+
...props,
|
|
556
|
+
"cmdk-empty": "",
|
|
557
|
+
role: "presentation"
|
|
558
|
+
});
|
|
559
|
+
});
|
|
560
|
+
/**
|
|
561
|
+
* You should conditionally render this with `progress` while loading asynchronous items.
|
|
562
|
+
*/
|
|
563
|
+
var Loading = React.forwardRef((props, forwardedRef) => {
|
|
564
|
+
const { progress, children, label = "Loading...", ...etc } = props;
|
|
565
|
+
return /* @__PURE__ */ jsx(Primitive.div, {
|
|
566
|
+
ref: forwardedRef,
|
|
567
|
+
...etc,
|
|
568
|
+
"cmdk-loading": "",
|
|
569
|
+
role: "progressbar",
|
|
570
|
+
"aria-valuenow": progress,
|
|
571
|
+
"aria-valuemin": 0,
|
|
572
|
+
"aria-valuemax": 100,
|
|
573
|
+
"aria-label": label,
|
|
574
|
+
children: SlottableWithNestedChildren(props, (child) => /* @__PURE__ */ jsx("div", {
|
|
575
|
+
"aria-hidden": true,
|
|
576
|
+
children: child
|
|
577
|
+
}))
|
|
578
|
+
});
|
|
579
|
+
});
|
|
580
|
+
var pkg = Object.assign(Command, {
|
|
581
|
+
List,
|
|
582
|
+
Item,
|
|
583
|
+
Input,
|
|
584
|
+
Group,
|
|
585
|
+
Separator,
|
|
586
|
+
Dialog,
|
|
587
|
+
Empty,
|
|
588
|
+
Loading
|
|
589
|
+
});
|
|
590
|
+
/**
|
|
591
|
+
*
|
|
592
|
+
*
|
|
593
|
+
* Helpers
|
|
594
|
+
*
|
|
595
|
+
*
|
|
596
|
+
*/
|
|
597
|
+
function findNextSibling(el, selector) {
|
|
598
|
+
let sibling = el.nextElementSibling;
|
|
599
|
+
while (sibling) {
|
|
600
|
+
if (sibling.matches(selector)) return sibling;
|
|
601
|
+
sibling = sibling.nextElementSibling;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
function findPreviousSibling(el, selector) {
|
|
605
|
+
let sibling = el.previousElementSibling;
|
|
606
|
+
while (sibling) {
|
|
607
|
+
if (sibling.matches(selector)) return sibling;
|
|
608
|
+
sibling = sibling.previousElementSibling;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
function useAsRef(data) {
|
|
612
|
+
const ref = React.useRef(data);
|
|
613
|
+
useLayoutEffect(() => {
|
|
614
|
+
ref.current = data;
|
|
615
|
+
});
|
|
616
|
+
return ref;
|
|
617
|
+
}
|
|
618
|
+
var useLayoutEffect = typeof window === "undefined" ? React.useEffect : React.useLayoutEffect;
|
|
619
|
+
function useLazyRef(fn) {
|
|
620
|
+
const ref = React.useRef(void 0);
|
|
621
|
+
if (ref.current === void 0) ref.current = fn();
|
|
622
|
+
return ref;
|
|
623
|
+
}
|
|
624
|
+
/** Run a selector against the store state. */
|
|
625
|
+
function useCmdk(selector) {
|
|
626
|
+
const store = useStore();
|
|
627
|
+
const cb = () => selector(store.snapshot());
|
|
628
|
+
return React.useSyncExternalStore(store.subscribe, cb, cb);
|
|
629
|
+
}
|
|
630
|
+
function useValue(id, ref, deps, aliases = []) {
|
|
631
|
+
const valueRef = React.useRef(void 0);
|
|
632
|
+
const context = useCommand();
|
|
633
|
+
useLayoutEffect(() => {
|
|
634
|
+
const value = (() => {
|
|
635
|
+
for (const part of deps) {
|
|
636
|
+
if (typeof part === "string") return part.trim();
|
|
637
|
+
if (part !== null && typeof part === "object" && "current" in part) {
|
|
638
|
+
if (part.current) return part.current.textContent?.trim();
|
|
639
|
+
return valueRef.current;
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
})();
|
|
643
|
+
const keywords = aliases.map((alias) => alias.trim());
|
|
644
|
+
context.value(id, value, keywords);
|
|
645
|
+
ref.current?.setAttribute(VALUE_ATTR, value);
|
|
646
|
+
valueRef.current = value;
|
|
647
|
+
});
|
|
648
|
+
return valueRef;
|
|
649
|
+
}
|
|
650
|
+
/** Imperatively run a function on the next layout effect cycle. */
|
|
651
|
+
var useScheduleLayoutEffect = () => {
|
|
652
|
+
const [s, ss] = React.useState();
|
|
653
|
+
const fns = useLazyRef(() => /* @__PURE__ */ new Map());
|
|
654
|
+
useLayoutEffect(() => {
|
|
655
|
+
fns.current.forEach((f) => f());
|
|
656
|
+
fns.current = /* @__PURE__ */ new Map();
|
|
657
|
+
}, [s]);
|
|
658
|
+
return (id, cb) => {
|
|
659
|
+
fns.current.set(id, cb);
|
|
660
|
+
ss({});
|
|
661
|
+
};
|
|
662
|
+
};
|
|
663
|
+
function renderChildren(children) {
|
|
664
|
+
const childrenType = children.type;
|
|
665
|
+
if (typeof childrenType === "function") return childrenType(children.props);
|
|
666
|
+
else if ("render" in childrenType) return childrenType.render(children.props);
|
|
667
|
+
else return children;
|
|
668
|
+
}
|
|
669
|
+
function SlottableWithNestedChildren({ asChild, children }, render) {
|
|
670
|
+
if (asChild && React.isValidElement(children)) return React.cloneElement(renderChildren(children), { ref: children.ref }, render(children.props.children));
|
|
671
|
+
return render(children);
|
|
672
|
+
}
|
|
673
|
+
var srOnlyStyles = {
|
|
674
|
+
position: "absolute",
|
|
675
|
+
width: "1px",
|
|
676
|
+
height: "1px",
|
|
677
|
+
padding: "0",
|
|
678
|
+
margin: "-1px",
|
|
679
|
+
overflow: "hidden",
|
|
680
|
+
clip: "rect(0, 0, 0, 0)",
|
|
681
|
+
whiteSpace: "nowrap",
|
|
682
|
+
borderWidth: "0"
|
|
683
|
+
};
|
|
684
|
+
//#endregion
|
|
685
|
+
export { pkg as Command, Dialog as CommandDialog, Empty as CommandEmpty, Group as CommandGroup, Input as CommandInput, Item as CommandItem, List as CommandList, Loading as CommandLoading, Command as CommandRoot, Separator as CommandSeparator, defaultFilter, useCmdk as useCommandState };
|
|
686
|
+
|
|
687
|
+
//# sourceMappingURL=index.js.map
|