@burtson-labs/ui 0.13.1 → 0.14.1
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 +20 -12
- package/THIRD_PARTY_NOTICES.md +15 -3
- package/dist/components/accordion.d.ts +4 -4
- package/dist/components/accordion.js +22 -18
- package/dist/components/accordion.js.map +1 -1
- package/dist/components/alert-dialog.d.ts +13 -11
- package/dist/components/alert-dialog.js +41 -31
- package/dist/components/alert-dialog.js.map +1 -1
- package/dist/components/alert.d.ts +5 -3
- package/dist/components/alert.js +12 -7
- package/dist/components/alert.js.map +1 -1
- package/dist/components/app-shell.d.ts +7 -6
- package/dist/components/app-shell.js +22 -14
- package/dist/components/app-shell.js.map +1 -1
- package/dist/components/attachment.d.ts +3 -3
- package/dist/components/attachment.js +11 -7
- package/dist/components/attachment.js.map +1 -1
- package/dist/components/audio-player.d.ts +2 -2
- package/dist/components/audio-player.js +9 -6
- package/dist/components/audio-player.js.map +1 -1
- package/dist/components/avatar.d.ts +4 -4
- package/dist/components/avatar.js +16 -12
- package/dist/components/avatar.js.map +1 -1
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/badge.js +15 -13
- package/dist/components/badge.js.map +1 -1
- package/dist/components/breadcrumb.d.ts +8 -8
- package/dist/components/breadcrumb.js +27 -20
- package/dist/components/breadcrumb.js.map +1 -1
- package/dist/components/button.d.ts +9 -2
- package/dist/components/button.js +15 -6
- package/dist/components/button.js.map +1 -1
- package/dist/components/card.d.ts +9 -9
- package/dist/components/card.js +33 -23
- package/dist/components/card.js.map +1 -1
- package/dist/components/chat-history.d.ts +1 -1
- package/dist/components/chat-history.js +11 -9
- package/dist/components/chat-history.js.map +1 -1
- package/dist/components/chat-layout.d.ts +1 -1
- package/dist/components/chat-layout.js +8 -3
- package/dist/components/chat-layout.js.map +1 -1
- package/dist/components/checkbox-card.d.ts +3 -3
- package/dist/components/checkbox-card.js +12 -10
- package/dist/components/checkbox-card.js.map +1 -1
- package/dist/components/checkbox.d.ts +24 -3
- package/dist/components/checkbox.js +52 -9
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/collapsible.d.ts +3 -3
- package/dist/components/collapsible.js +14 -11
- package/dist/components/collapsible.js.map +1 -1
- package/dist/components/combobox.d.ts +14 -4
- package/dist/components/combobox.js +19 -8
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/command.d.ts +68 -12
- package/dist/components/command.js +48 -34
- package/dist/components/command.js.map +1 -1
- package/dist/components/composer.d.ts +2 -2
- package/dist/components/composer.js +10 -7
- package/dist/components/composer.js.map +1 -1
- package/dist/components/connection-status.d.ts +3 -3
- package/dist/components/connection-status.js +19 -14
- package/dist/components/connection-status.js.map +1 -1
- package/dist/components/context-menu.d.ts +15 -14
- package/dist/components/context-menu.js +52 -41
- package/dist/components/context-menu.js.map +1 -1
- package/dist/components/conversation.d.ts +1 -1
- package/dist/components/conversation.js +7 -5
- package/dist/components/conversation.js.map +1 -1
- package/dist/components/copy-button.d.ts +1 -1
- package/dist/components/copy-button.js +4 -2
- package/dist/components/copy-button.js.map +1 -1
- package/dist/components/data-table.d.ts +7 -2
- package/dist/components/data-table.js +17 -42
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/dialog.d.ts +19 -10
- package/dist/components/dialog.js +50 -33
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/dropdown-menu.d.ts +15 -14
- package/dist/components/dropdown-menu.js +52 -41
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/editor-tabs.d.ts +1 -1
- package/dist/components/editor-tabs.js +7 -5
- package/dist/components/editor-tabs.js.map +1 -1
- package/dist/components/empty-state.d.ts +5 -5
- package/dist/components/empty-state.js +17 -11
- package/dist/components/empty-state.js.map +1 -1
- package/dist/components/error-summary.d.ts +21 -0
- package/dist/components/error-summary.js +62 -0
- package/dist/components/error-summary.js.map +1 -0
- package/dist/components/field.d.ts +66 -7
- package/dist/components/field.js +152 -20
- package/dist/components/field.js.map +1 -1
- package/dist/components/form-actions.d.ts +18 -0
- package/dist/components/form-actions.js +30 -0
- package/dist/components/form-actions.js.map +1 -0
- package/dist/components/icon-button.d.ts +3 -1
- package/dist/components/icon-button.js +6 -3
- package/dist/components/icon-button.js.map +1 -1
- package/dist/components/input.d.ts +42 -7
- package/dist/components/input.js +54 -10
- package/dist/components/input.js.map +1 -1
- package/dist/components/kbd.d.ts +2 -2
- package/dist/components/kbd.js +8 -5
- package/dist/components/kbd.js.map +1 -1
- package/dist/components/label.d.ts +7 -2
- package/dist/components/label.js +14 -7
- package/dist/components/label.js.map +1 -1
- package/dist/components/markdown.d.ts +4 -3
- package/dist/components/markdown.js +8 -6
- package/dist/components/markdown.js.map +1 -1
- package/dist/components/menubar.d.ts +17 -15
- package/dist/components/menubar.js +58 -45
- package/dist/components/menubar.js.map +1 -1
- package/dist/components/message-actions.d.ts +3 -3
- package/dist/components/message-actions.js +16 -12
- package/dist/components/message-actions.js.map +1 -1
- package/dist/components/message.d.ts +1 -1
- package/dist/components/message.js +6 -3
- package/dist/components/message.js.map +1 -1
- package/dist/components/mobile-nav.d.ts +1 -1
- package/dist/components/mobile-nav.js +7 -5
- package/dist/components/mobile-nav.js.map +1 -1
- package/dist/components/native-select.d.ts +16 -0
- package/dist/components/native-select.js +33 -0
- package/dist/components/native-select.js.map +1 -0
- package/dist/components/navigation-menu.d.ts +13 -12
- package/dist/components/navigation-menu.js +43 -33
- package/dist/components/navigation-menu.js.map +1 -1
- package/dist/components/number-input.d.ts +23 -0
- package/dist/components/number-input.js +45 -0
- package/dist/components/number-input.js.map +1 -0
- package/dist/components/onboarding-checklist.d.ts +1 -1
- package/dist/components/onboarding-checklist.js +5 -3
- package/dist/components/onboarding-checklist.js.map +1 -1
- package/dist/components/page-header.d.ts +7 -6
- package/dist/components/page-header.js +23 -15
- package/dist/components/page-header.js.map +1 -1
- package/dist/components/pagination.d.ts +1 -1
- package/dist/components/pagination.js +4 -2
- package/dist/components/pagination.js.map +1 -1
- package/dist/components/popover.d.ts +14 -11
- package/dist/components/popover.js +30 -23
- package/dist/components/popover.js.map +1 -1
- package/dist/components/progress.d.ts +2 -2
- package/dist/components/progress.js +11 -9
- package/dist/components/progress.js.map +1 -1
- package/dist/components/radio-group.d.ts +23 -4
- package/dist/components/radio-group.js +56 -14
- package/dist/components/radio-group.js.map +1 -1
- package/dist/components/reasoning.d.ts +3 -3
- package/dist/components/reasoning.js +14 -11
- 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 +4 -3
- package/dist/components/scroll-area.js +18 -14
- package/dist/components/scroll-area.js.map +1 -1
- package/dist/components/secret-input.d.ts +3 -2
- package/dist/components/secret-input.js +7 -4
- package/dist/components/secret-input.js.map +1 -1
- package/dist/components/select.d.ts +12 -7
- package/dist/components/select.js +42 -35
- package/dist/components/select.js.map +1 -1
- package/dist/components/separator.d.ts +2 -2
- package/dist/components/separator.js +8 -6
- package/dist/components/separator.js.map +1 -1
- package/dist/components/sheet.d.ts +11 -9
- package/dist/components/sheet.js +41 -29
- package/dist/components/sheet.js.map +1 -1
- package/dist/components/skeleton.d.ts +2 -1
- package/dist/components/skeleton.js +7 -4
- package/dist/components/skeleton.js.map +1 -1
- package/dist/components/slider.d.ts +10 -6
- package/dist/components/slider.js +16 -7
- package/dist/components/slider.js.map +1 -1
- package/dist/components/source.d.ts +2 -2
- package/dist/components/source.js +10 -7
- package/dist/components/source.js.map +1 -1
- package/dist/components/spinner.d.ts +4 -2
- package/dist/components/spinner.js +5 -3
- package/dist/components/spinner.js.map +1 -1
- package/dist/components/stat-card.d.ts +27 -2
- package/dist/components/stat-card.js +70 -9
- package/dist/components/stat-card.js.map +1 -1
- package/dist/components/status.d.ts +7 -6
- package/dist/components/status.js +12 -5
- package/dist/components/status.js.map +1 -1
- package/dist/components/steps.d.ts +1 -1
- package/dist/components/steps.js +5 -3
- package/dist/components/steps.js.map +1 -1
- package/dist/components/switch.d.ts +47 -3
- package/dist/components/switch.js +89 -11
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table.d.ts +29 -12
- package/dist/components/table.js +80 -34
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.d.ts +10 -5
- package/dist/components/tabs.js +29 -19
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/textarea.d.ts +6 -1
- package/dist/components/textarea.js +4 -3
- package/dist/components/textarea.js.map +1 -1
- package/dist/components/toast.d.ts +11 -7
- package/dist/components/toast.js +37 -27
- package/dist/components/toast.js.map +1 -1
- package/dist/components/toaster.d.ts +4 -2
- package/dist/components/toaster.js +7 -2
- package/dist/components/toaster.js.map +1 -1
- package/dist/components/tool-call.d.ts +2 -2
- package/dist/components/tool-call.js +15 -12
- package/dist/components/tool-call.js.map +1 -1
- package/dist/components/toolbar.d.ts +9 -4
- package/dist/components/toolbar.js +15 -9
- package/dist/components/toolbar.js.map +1 -1
- package/dist/components/tooltip.d.ts +4 -3
- package/dist/components/tooltip.js +17 -13
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/tour.js +10 -8
- package/dist/components/tour.js.map +1 -1
- package/dist/components/tree-view.d.ts +1 -1
- package/dist/components/tree-view.js +10 -5
- package/dist/components/tree-view.js.map +1 -1
- package/dist/components/voice-recorder.d.ts +1 -1
- package/dist/components/voice-recorder.js +5 -2
- package/dist/components/voice-recorder.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +17 -12
- package/dist/lib/media.d.ts +18 -0
- package/dist/lib/media.js +34 -0
- package/dist/lib/media.js.map +1 -0
- package/dist/lib/utils.d.ts +32 -0
- package/dist/lib/utils.js +33 -1
- package/dist/lib/utils.js.map +1 -1
- package/dist/mui/index.js +20 -8
- package/dist/mui/index.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/dist/theme.css +36 -17
- package/dist/tokens.d.ts +78 -36
- package/dist/tokens.js +63 -32
- package/dist/tokens.js.map +1 -1
- package/package.json +25 -13
- package/vendor-manifest.json +1101 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export declare class OrderedDict<K, V> extends Map<K, V> {
|
|
2
|
+
#private;
|
|
3
|
+
constructor(iterable?: Iterable<readonly [K, V]> | null | undefined);
|
|
4
|
+
set(key: K, value: V): this;
|
|
5
|
+
insert(index: number, key: K, value: V): this;
|
|
6
|
+
with(index: number, key: K, value: V): OrderedDict<K, V>;
|
|
7
|
+
before(key: K): [K, V] | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Sets a new key-value pair at the position before the given key.
|
|
10
|
+
*/
|
|
11
|
+
setBefore(key: K, newKey: K, value: V): this;
|
|
12
|
+
after(key: K): [K, V] | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Sets a new key-value pair at the position after the given key.
|
|
15
|
+
*/
|
|
16
|
+
setAfter(key: K, newKey: K, value: V): this;
|
|
17
|
+
first(): [K, V] | undefined;
|
|
18
|
+
last(): [K, V] | undefined;
|
|
19
|
+
clear(): void;
|
|
20
|
+
delete(key: K): boolean;
|
|
21
|
+
deleteAt(index: number): boolean;
|
|
22
|
+
at(index: number): V | undefined;
|
|
23
|
+
entryAt(index: number): [K, V] | undefined;
|
|
24
|
+
indexOf(key: K): number;
|
|
25
|
+
keyAt(index: number): K | undefined;
|
|
26
|
+
from(key: K, offset: number): V | undefined;
|
|
27
|
+
keyFrom(key: K, offset: number): K | undefined;
|
|
28
|
+
find(predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => boolean, thisArg?: any): [K, V] | undefined;
|
|
29
|
+
findIndex(predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => boolean, thisArg?: any): number;
|
|
30
|
+
filter<KK extends K, VV extends V>(predicate: (entry: [K, V], index: number, dict: OrderedDict<K, V>) => entry is [KK, VV], thisArg?: any): OrderedDict<KK, VV>;
|
|
31
|
+
filter(predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown, thisArg?: any): OrderedDict<K, V>;
|
|
32
|
+
map<U>(callbackfn: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => U, thisArg?: any): OrderedDict<K, U>;
|
|
33
|
+
reduce(callbackfn: (previousValue: [K, V], currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict<K, V>) => [K, V]): [K, V];
|
|
34
|
+
reduce(callbackfn: (previousValue: [K, V], currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict<K, V>) => [K, V], initialValue: [K, V]): [K, V];
|
|
35
|
+
reduce<U>(callbackfn: (previousValue: U, currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict<K, V>) => U, initialValue: U): U;
|
|
36
|
+
reduceRight(callbackfn: (previousValue: [K, V], currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict<K, V>) => [K, V]): [K, V];
|
|
37
|
+
reduceRight(callbackfn: (previousValue: [K, V], currentEntry: [K, V], currentIndex: number, dictionary: OrderedDict<K, V>) => [K, V], initialValue: [K, V]): [K, V];
|
|
38
|
+
reduceRight<U>(callbackfn: (previousValue: [K, V], currentValue: U, currentIndex: number, dictionary: OrderedDict<K, V>) => U, initialValue: U): U;
|
|
39
|
+
toSorted(compareFn?: (a: [K, V], b: [K, V]) => number): OrderedDict<K, V>;
|
|
40
|
+
toReversed(): OrderedDict<K, V>;
|
|
41
|
+
toSpliced(start: number, deleteCount?: number): OrderedDict<K, V>;
|
|
42
|
+
toSpliced(start: number, deleteCount: number, ...items: [K, V][]): OrderedDict<K, V>;
|
|
43
|
+
slice(start?: number, end?: number): OrderedDict<K, V>;
|
|
44
|
+
every(predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown, thisArg?: any): boolean;
|
|
45
|
+
some(predicate: (entry: [K, V], index: number, dictionary: OrderedDict<K, V>) => unknown, thisArg?: any): boolean;
|
|
46
|
+
}
|
|
47
|
+
export type KeyOf<D extends OrderedDict<any, any>> = D extends OrderedDict<infer K, any> ? K : never;
|
|
48
|
+
export type ValueOf<D extends OrderedDict<any, any>> = D extends OrderedDict<any, infer V> ? V : never;
|
|
49
|
+
export type EntryOf<D extends OrderedDict<any, any>> = [KeyOf<D>, ValueOf<D>];
|
|
50
|
+
export type KeyFrom<E extends EntryOf<any>> = E[0];
|
|
51
|
+
export type ValueFrom<E extends EntryOf<any>> = E[1];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
type PossibleRef<T> = React.Ref<T> | undefined;
|
|
3
|
+
/**
|
|
4
|
+
* A utility to compose multiple refs together
|
|
5
|
+
* Accepts callback refs and RefObject(s)
|
|
6
|
+
*/
|
|
7
|
+
declare function composeRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T>;
|
|
8
|
+
/**
|
|
9
|
+
* A custom hook that composes multiple refs
|
|
10
|
+
* Accepts callback refs and RefObject(s)
|
|
11
|
+
*/
|
|
12
|
+
declare function useComposedRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T>;
|
|
13
|
+
export { composeRefs, useComposedRefs };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
//#region src/primitives/vendor/radix/react-compose-refs/compose-refs.tsx
|
|
4
|
+
/**
|
|
5
|
+
* Set a given ref to a given value
|
|
6
|
+
* This utility takes care of different types of refs: callback refs and RefObject(s)
|
|
7
|
+
*/
|
|
8
|
+
function setRef(ref, value) {
|
|
9
|
+
if (typeof ref === "function") return ref(value);
|
|
10
|
+
else if (ref !== null && ref !== void 0) ref.current = value;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A utility to compose multiple refs together
|
|
14
|
+
* Accepts callback refs and RefObject(s)
|
|
15
|
+
*/
|
|
16
|
+
function composeRefs(...refs) {
|
|
17
|
+
return (node) => {
|
|
18
|
+
let hasCleanup = false;
|
|
19
|
+
const cleanups = refs.map((ref) => {
|
|
20
|
+
const cleanup = setRef(ref, node);
|
|
21
|
+
if (!hasCleanup && typeof cleanup == "function") hasCleanup = true;
|
|
22
|
+
return cleanup;
|
|
23
|
+
});
|
|
24
|
+
if (hasCleanup) return () => {
|
|
25
|
+
for (let i = 0; i < cleanups.length; i++) {
|
|
26
|
+
const cleanup = cleanups[i];
|
|
27
|
+
if (typeof cleanup == "function") cleanup();
|
|
28
|
+
else setRef(refs[i], null);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A custom hook that composes multiple refs
|
|
35
|
+
* Accepts callback refs and RefObject(s)
|
|
36
|
+
*/
|
|
37
|
+
function useComposedRefs(...refs) {
|
|
38
|
+
return React.useCallback(composeRefs(...refs), refs);
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { composeRefs, useComposedRefs };
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=compose-refs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose-refs.js","names":[],"sources":["../../../../../src/primitives/vendor/radix/react-compose-refs/compose-refs.tsx"],"sourcesContent":["// Vendored from Radix Primitives (c) 2022 WorkOS, MIT. See vendor/LICENSE.radix.\n// Local modification: package imports resolve to the pinned local source.\nimport * as React from 'react';\n\ntype PossibleRef<T> = React.Ref<T> | undefined;\n\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */\nfunction setRef<T>(ref: PossibleRef<T>, value: T) {\n if (typeof ref === 'function') {\n return ref(value);\n } else if (ref !== null && ref !== undefined) {\n ref.current = value;\n }\n}\n\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */\nfunction composeRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T> {\n return (node) => {\n let hasCleanup = false;\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node);\n if (!hasCleanup && typeof cleanup == 'function') {\n hasCleanup = true;\n }\n return cleanup;\n });\n\n // React <19 will log an error to the console if a callback ref returns a\n // value. We don't use ref cleanups internally so this will only happen if a\n // user's ref callback returns a value, which we only expect if they are\n // using the cleanup functionality added in React 19.\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < cleanups.length; i++) {\n const cleanup = cleanups[i];\n if (typeof cleanup == 'function') {\n cleanup();\n } else {\n setRef(refs[i], null);\n }\n }\n };\n }\n };\n}\n\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */\nfunction useComposedRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T> {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs);\n}\n\nexport { composeRefs, useComposedRefs };\n"],"mappings":";;;;;;;AAUA,SAAS,OAAU,KAAqB,OAAU;CAChD,IAAI,OAAO,QAAQ,YACjB,OAAO,IAAI,KAAK;MACX,IAAI,QAAQ,QAAQ,QAAQ,KAAA,GACjC,IAAI,UAAU;AAElB;;;;;AAMA,SAAS,YAAe,GAAG,MAA8C;CACvE,QAAQ,SAAS;EACf,IAAI,aAAa;EACjB,MAAM,WAAW,KAAK,KAAK,QAAQ;GACjC,MAAM,UAAU,OAAO,KAAK,IAAI;GAChC,IAAI,CAAC,cAAc,OAAO,WAAW,YACnC,aAAa;GAEf,OAAO;EACT,CAAC;EAMD,IAAI,YACF,aAAa;GACX,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;IACxC,MAAM,UAAU,SAAS;IACzB,IAAI,OAAO,WAAW,YACpB,QAAQ;SAER,OAAO,KAAK,IAAI,IAAI;GAExB;EACF;CAEJ;AACF;;;;;AAMA,SAAS,gBAAmB,GAAG,MAA8C;CAE3E,OAAO,MAAM,YAAY,YAAY,GAAG,IAAI,GAAG,IAAI;AACrD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { composeRefs, useComposedRefs } from './compose-refs';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
type ContextProvider<ContextValueType extends object | null> = React.FC<ContextValueType & {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}>;
|
|
5
|
+
interface UseAssertedContext<ContextValueType extends object | null> {
|
|
6
|
+
(consumerName: string): ContextValueType;
|
|
7
|
+
}
|
|
8
|
+
interface UseContext<ContextValueType extends object | null> {
|
|
9
|
+
(consumerName: string): ContextValueType;
|
|
10
|
+
(consumerName: string, options: {
|
|
11
|
+
optional: true;
|
|
12
|
+
}): ContextValueType | undefined;
|
|
13
|
+
}
|
|
14
|
+
declare function createContext<ContextValueType extends object | null>(rootComponentName: string): readonly [ContextProvider<ContextValueType>, UseContext<ContextValueType>];
|
|
15
|
+
declare function createContext<ContextValueType extends object | null>(rootComponentName: string, defaultContext: ContextValueType): readonly [ContextProvider<ContextValueType>, UseAssertedContext<ContextValueType>];
|
|
16
|
+
type Scope<C = any> = {
|
|
17
|
+
[scopeName: string]: React.Context<C>[];
|
|
18
|
+
} | undefined;
|
|
19
|
+
type ScopeHook = (scope: Scope) => {
|
|
20
|
+
[__scopeProp: string]: Scope;
|
|
21
|
+
};
|
|
22
|
+
interface CreateScope {
|
|
23
|
+
scopeName: string;
|
|
24
|
+
(): ScopeHook;
|
|
25
|
+
}
|
|
26
|
+
type ScopedContextProvider<ContextValueType extends object | null> = React.FC<ContextValueType & {
|
|
27
|
+
scope: Scope<ContextValueType>;
|
|
28
|
+
children: React.ReactNode;
|
|
29
|
+
}>;
|
|
30
|
+
interface UseScopedContext<ContextValueType extends object | null> {
|
|
31
|
+
(consumerName: string, scope: Scope<ContextValueType | undefined>): ContextValueType;
|
|
32
|
+
(consumerName: string, scope: Scope<ContextValueType | undefined>, options: {
|
|
33
|
+
optional?: true;
|
|
34
|
+
}): ContextValueType | undefined;
|
|
35
|
+
}
|
|
36
|
+
interface UseAssertedScopedContext<ContextValueType extends object | null> {
|
|
37
|
+
(consumerName: string, scope: Scope<ContextValueType | undefined>): ContextValueType;
|
|
38
|
+
}
|
|
39
|
+
interface CreateScopedContext {
|
|
40
|
+
<ContextValueType extends object | null>(rootComponentName: string): readonly [ScopedContextProvider<ContextValueType>, UseScopedContext<ContextValueType>];
|
|
41
|
+
<ContextValueType extends object | null>(rootComponentName: string, defaultContext: ContextValueType): readonly [ScopedContextProvider<ContextValueType>, UseAssertedScopedContext<ContextValueType>];
|
|
42
|
+
}
|
|
43
|
+
declare function createContextScope(scopeName: string, createContextScopeDeps?: CreateScope[]): readonly [CreateScopedContext, CreateScope];
|
|
44
|
+
export { createContext, createContextScope };
|
|
45
|
+
export type { CreateScope, CreateScopedContext, Scope, UseAssertedContext, UseAssertedScopedContext, UseContext, UseScopedContext, };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/primitives/vendor/radix/react-context/create-context.tsx
|
|
5
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
6
|
+
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
7
|
+
let defaultContexts = [];
|
|
8
|
+
function createContext(rootComponentName, defaultContext) {
|
|
9
|
+
const BaseContext = React.createContext(defaultContext);
|
|
10
|
+
BaseContext.displayName = rootComponentName + "Context";
|
|
11
|
+
const index = defaultContexts.length;
|
|
12
|
+
defaultContexts = [...defaultContexts, defaultContext];
|
|
13
|
+
const Provider = (props) => {
|
|
14
|
+
const { scope, children, ...context } = props;
|
|
15
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
16
|
+
const value = React.useMemo(() => context, Object.values(context));
|
|
17
|
+
return /* @__PURE__ */ jsx(Context.Provider, {
|
|
18
|
+
value,
|
|
19
|
+
children
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
Provider.displayName = rootComponentName + "Provider";
|
|
23
|
+
function useContext(consumerName, scope, options = {}) {
|
|
24
|
+
const { optional = false } = options;
|
|
25
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
26
|
+
const context = React.useContext(Context);
|
|
27
|
+
if (context) return context;
|
|
28
|
+
if (defaultContext !== void 0) return defaultContext;
|
|
29
|
+
if (optional) return void 0;
|
|
30
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
31
|
+
}
|
|
32
|
+
return [Provider, useContext];
|
|
33
|
+
}
|
|
34
|
+
const createScope = () => {
|
|
35
|
+
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
36
|
+
return React.createContext(defaultContext);
|
|
37
|
+
});
|
|
38
|
+
return function useScope(scope) {
|
|
39
|
+
const contexts = scope?.[scopeName] || scopeContexts;
|
|
40
|
+
return React.useMemo(() => ({ [`__scope${scopeName}`]: {
|
|
41
|
+
...scope,
|
|
42
|
+
[scopeName]: contexts
|
|
43
|
+
} }), [scope, contexts]);
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
createScope.scopeName = scopeName;
|
|
47
|
+
return [createContext, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
48
|
+
}
|
|
49
|
+
function composeContextScopes(...scopes) {
|
|
50
|
+
const baseScope = scopes[0];
|
|
51
|
+
if (scopes.length === 1) return baseScope;
|
|
52
|
+
const createScope = () => {
|
|
53
|
+
const scopeHooks = scopes.map((createScope) => ({
|
|
54
|
+
useScope: createScope(),
|
|
55
|
+
scopeName: createScope.scopeName
|
|
56
|
+
}));
|
|
57
|
+
return function useComposedScopes(overrideScopes) {
|
|
58
|
+
const nextScopes = scopeHooks.reduce((nextScopes, { useScope, scopeName }) => {
|
|
59
|
+
const currentScope = useScope(overrideScopes)[`__scope${scopeName}`];
|
|
60
|
+
return {
|
|
61
|
+
...nextScopes,
|
|
62
|
+
...currentScope
|
|
63
|
+
};
|
|
64
|
+
}, {});
|
|
65
|
+
return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
createScope.scopeName = baseScope.scopeName;
|
|
69
|
+
return createScope;
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
export { createContextScope };
|
|
73
|
+
|
|
74
|
+
//# sourceMappingURL=create-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-context.js","names":[],"sources":["../../../../../src/primitives/vendor/radix/react-context/create-context.tsx"],"sourcesContent":["// Vendored from Radix Primitives (c) 2022 WorkOS, MIT. See vendor/LICENSE.radix.\n// Local modification: package imports resolve to the pinned local source.\nimport * as React from 'react';\n\ntype ContextProvider<ContextValueType extends object | null> = React.FC<\n ContextValueType & {\n children: React.ReactNode;\n }\n>;\n\ninterface UseAssertedContext<ContextValueType extends object | null> {\n (consumerName: string): ContextValueType;\n}\n\ninterface UseContext<ContextValueType extends object | null> {\n (consumerName: string): ContextValueType;\n (consumerName: string, options: { optional: true }): ContextValueType | undefined;\n}\n\nfunction createContext<ContextValueType extends object | null>(\n rootComponentName: string,\n): readonly [ContextProvider<ContextValueType>, UseContext<ContextValueType>];\nfunction createContext<ContextValueType extends object | null>(\n rootComponentName: string,\n defaultContext: ContextValueType,\n): readonly [ContextProvider<ContextValueType>, UseAssertedContext<ContextValueType>];\n\n/* @__NO_SIDE_EFFECTS__ */ function createContext<ContextValueType extends object | null>(\n rootComponentName: string,\n defaultContext?: ContextValueType,\n): readonly [ContextProvider<ContextValueType>, UseContext<ContextValueType>] {\n const Context = React.createContext<ContextValueType | undefined>(defaultContext);\n Context.displayName = rootComponentName + 'Context';\n\n const Provider: ContextProvider<ContextValueType> = (props) => {\n const { children, ...context } = props;\n // Only re-memoize when prop values change\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const value = React.useMemo(() => context, Object.values(context)) as ContextValueType;\n return <Context.Provider value={value}>{children}</Context.Provider>;\n };\n\n Provider.displayName = rootComponentName + 'Provider';\n\n function useContext(consumerName: string): ContextValueType;\n function useContext(\n consumerName: string,\n options: { optional: true },\n ): ContextValueType | undefined;\n\n function useContext(\n consumerName: string,\n options: { optional?: boolean } = {},\n ): ContextValueType | undefined {\n const { optional = false } = options;\n const context = React.useContext(Context);\n if (context) return context;\n if (defaultContext !== undefined) return defaultContext;\n if (optional) return undefined;\n // if a defaultContext wasn't specified, it's a required context.\n throw new Error(`\\`${consumerName}\\` must be used within \\`${rootComponentName}\\``);\n }\n\n return [Provider, useContext];\n}\n\n/* -------------------------------------------------------------------------------------------------\n * createContextScope\n * -----------------------------------------------------------------------------------------------*/\n\ntype Scope<C = any> = { [scopeName: string]: React.Context<C>[] } | undefined;\ntype ScopeHook = (scope: Scope) => { [__scopeProp: string]: Scope };\ninterface CreateScope {\n scopeName: string;\n (): ScopeHook;\n}\n\ntype ScopedContextProvider<ContextValueType extends object | null> = React.FC<\n ContextValueType & {\n scope: Scope<ContextValueType>;\n children: React.ReactNode;\n }\n>;\n\ninterface UseScopedContext<ContextValueType extends object | null> {\n (consumerName: string, scope: Scope<ContextValueType | undefined>): ContextValueType;\n (\n consumerName: string,\n scope: Scope<ContextValueType | undefined>,\n options: { optional?: true },\n ): ContextValueType | undefined;\n}\n\ninterface UseAssertedScopedContext<ContextValueType extends object | null> {\n (consumerName: string, scope: Scope<ContextValueType | undefined>): ContextValueType;\n}\n\ninterface CreateScopedContext {\n <ContextValueType extends object | null>(\n rootComponentName: string,\n ): readonly [ScopedContextProvider<ContextValueType>, UseScopedContext<ContextValueType>];\n <ContextValueType extends object | null>(\n rootComponentName: string,\n defaultContext: ContextValueType,\n ): readonly [ScopedContextProvider<ContextValueType>, UseAssertedScopedContext<ContextValueType>];\n}\n\n/* @__NO_SIDE_EFFECTS__ */ function createContextScope(\n scopeName: string,\n createContextScopeDeps: CreateScope[] = [],\n): readonly [CreateScopedContext, CreateScope] {\n let defaultContexts: any[] = [];\n\n /* -----------------------------------------------------------------------------------------------\n * createContext\n * ---------------------------------------------------------------------------------------------*/\n\n function createContext<ContextValueType extends object | null>(\n rootComponentName: string,\n defaultContext?: ContextValueType,\n ) {\n const BaseContext = React.createContext<ContextValueType | undefined>(defaultContext);\n BaseContext.displayName = rootComponentName + 'Context';\n const index = defaultContexts.length;\n defaultContexts = [...defaultContexts, defaultContext];\n\n const Provider: ScopedContextProvider<ContextValueType> = (props) => {\n const { scope, children, ...context } = props;\n const Context = scope?.[scopeName]?.[index] || BaseContext;\n // Only re-memoize when prop values change\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const value = React.useMemo(() => context, Object.values(context)) as ContextValueType;\n return <Context.Provider value={value}>{children}</Context.Provider>;\n };\n\n Provider.displayName = rootComponentName + 'Provider';\n\n function useContext(\n consumerName: string,\n scope: Scope<ContextValueType | undefined>,\n ): ContextValueType;\n function useContext(\n consumerName: string,\n scope: Scope<ContextValueType | undefined>,\n options: { optional: true },\n ): ContextValueType | undefined;\n\n function useContext(\n consumerName: string,\n scope: Scope<ContextValueType | undefined>,\n options: { optional?: boolean } = {},\n ): ContextValueType | undefined {\n const { optional = false } = options;\n const Context = scope?.[scopeName]?.[index] || BaseContext;\n const context = React.useContext(Context);\n if (context) return context;\n if (defaultContext !== undefined) return defaultContext;\n if (optional) return undefined;\n // if a defaultContext wasn't specified, it's a required context.\n throw new Error(`\\`${consumerName}\\` must be used within \\`${rootComponentName}\\``);\n }\n\n return [Provider, useContext] as const;\n }\n\n /* -----------------------------------------------------------------------------------------------\n * createScope\n * ---------------------------------------------------------------------------------------------*/\n\n const createScope: CreateScope = () => {\n const scopeContexts = defaultContexts.map((defaultContext) => {\n return React.createContext(defaultContext);\n });\n return function useScope(scope: Scope) {\n const contexts = scope?.[scopeName] || scopeContexts;\n return React.useMemo(\n () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),\n [scope, contexts],\n );\n };\n };\n\n createScope.scopeName = scopeName;\n return [createContext, composeContextScopes(createScope, ...createContextScopeDeps)] as const;\n}\n\n/* -------------------------------------------------------------------------------------------------\n * composeContextScopes\n * -----------------------------------------------------------------------------------------------*/\n\nfunction composeContextScopes(...scopes: [CreateScope, ...CreateScope[]]): CreateScope {\n const baseScope = scopes[0];\n if (scopes.length === 1) return baseScope;\n\n const createScope: CreateScope = () => {\n const scopeHooks = scopes.map((createScope) => ({\n useScope: createScope(),\n scopeName: createScope.scopeName,\n }));\n\n return function useComposedScopes(overrideScopes) {\n const nextScopes = scopeHooks.reduce((nextScopes, { useScope, scopeName }) => {\n // We are calling a hook inside a callback which React warns against to avoid inconsistent\n // renders, however, scoping doesn't have render side effects so we ignore the rule.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const scopeProps = useScope(overrideScopes);\n const currentScope = scopeProps[`__scope${scopeName}`];\n return { ...nextScopes, ...currentScope };\n }, {});\n\n return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);\n };\n };\n\n createScope.scopeName = baseScope.scopeName;\n return createScope;\n}\n\n/* -----------------------------------------------------------------------------------------------*/\n\nexport { createContext, createContextScope };\nexport type {\n CreateScope,\n CreateScopedContext,\n Scope,\n UseAssertedContext,\n UseAssertedScopedContext,\n UseContext,\n UseScopedContext,\n};\n"],"mappings":";;;;;AA2G2B,SAAS,mBAClC,WACA,yBAAwC,CAAC,GACI;CAC7C,IAAI,kBAAyB,CAAC;CAM9B,SAAS,cACP,mBACA,gBACA;EACA,MAAM,cAAc,MAAM,cAA4C,cAAc;EACpF,YAAY,cAAc,oBAAoB;EAC9C,MAAM,QAAQ,gBAAgB;EAC9B,kBAAkB,CAAC,GAAG,iBAAiB,cAAc;EAErD,MAAM,YAAqD,UAAU;GACnE,MAAM,EAAE,OAAO,UAAU,GAAG,YAAY;GACxC,MAAM,UAAU,QAAQ,UAAU,GAAG,UAAU;GAG/C,MAAM,QAAQ,MAAM,cAAc,SAAS,OAAO,OAAO,OAAO,CAAC;GACjE,OAAO,oBAAC,QAAQ,UAAT;IAAyB;IAAQ;GAA2B,CAAA;EACrE;EAEA,SAAS,cAAc,oBAAoB;EAY3C,SAAS,WACP,cACA,OACA,UAAkC,CAAC,GACL;GAC9B,MAAM,EAAE,WAAW,UAAU;GAC7B,MAAM,UAAU,QAAQ,UAAU,GAAG,UAAU;GAC/C,MAAM,UAAU,MAAM,WAAW,OAAO;GACxC,IAAI,SAAS,OAAO;GACpB,IAAI,mBAAmB,KAAA,GAAW,OAAO;GACzC,IAAI,UAAU,OAAO,KAAA;GAErB,MAAM,IAAI,MAAM,KAAK,aAAa,2BAA2B,kBAAkB,GAAG;EACpF;EAEA,OAAO,CAAC,UAAU,UAAU;CAC9B;CAMA,MAAM,oBAAiC;EACrC,MAAM,gBAAgB,gBAAgB,KAAK,mBAAmB;GAC5D,OAAO,MAAM,cAAc,cAAc;EAC3C,CAAC;EACD,OAAO,SAAS,SAAS,OAAc;GACrC,MAAM,WAAW,QAAQ,cAAc;GACvC,OAAO,MAAM,eACJ,GAAG,UAAU,cAAc;IAAE,GAAG;KAAQ,YAAY;GAAS,EAAE,IACtE,CAAC,OAAO,QAAQ,CAClB;EACF;CACF;CAEA,YAAY,YAAY;CACxB,OAAO,CAAC,eAAe,qBAAqB,aAAa,GAAG,sBAAsB,CAAC;AACrF;AAMA,SAAS,qBAAqB,GAAG,QAAsD;CACrF,MAAM,YAAY,OAAO;CACzB,IAAI,OAAO,WAAW,GAAG,OAAO;CAEhC,MAAM,oBAAiC;EACrC,MAAM,aAAa,OAAO,KAAK,iBAAiB;GAC9C,UAAU,YAAY;GACtB,WAAW,YAAY;EACzB,EAAE;EAEF,OAAO,SAAS,kBAAkB,gBAAgB;GAChD,MAAM,aAAa,WAAW,QAAQ,YAAY,EAAE,UAAU,gBAAgB;IAK5E,MAAM,eADa,SAAS,cACP,CAAA,CAAW,UAAU;IAC1C,OAAO;KAAE,GAAG;KAAY,GAAG;IAAa;GAC1C,GAAG,CAAC,CAAC;GAEL,OAAO,MAAM,eAAe,GAAG,UAAU,UAAU,cAAc,WAAW,IAAI,CAAC,UAAU,CAAC;EAC9F;CACF;CAEA,YAAY,YAAY,UAAU;CAClC,OAAO;AACT"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Primitive } from '../react-primitive';
|
|
3
|
+
import * as MenuPrimitive from '../react-menu';
|
|
4
|
+
type Direction = 'ltr' | 'rtl';
|
|
5
|
+
declare const createContextMenuScope: import("../react-context").CreateScope;
|
|
6
|
+
interface ContextMenuProps {
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
open?: boolean;
|
|
9
|
+
onOpenChange?(open: boolean): void;
|
|
10
|
+
dir?: Direction;
|
|
11
|
+
modal?: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare const ContextMenu: React.FC<ContextMenuProps>;
|
|
14
|
+
type PrimitiveSpanProps = React.ComponentPropsWithoutRef<typeof Primitive.span>;
|
|
15
|
+
interface ContextMenuTriggerProps extends PrimitiveSpanProps {
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
}
|
|
18
|
+
declare const ContextMenuTrigger: React.ForwardRefExoticComponent<ContextMenuTriggerProps & React.RefAttributes<HTMLSpanElement>>;
|
|
19
|
+
type MenuPortalProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Portal>;
|
|
20
|
+
interface ContextMenuPortalProps extends MenuPortalProps {
|
|
21
|
+
}
|
|
22
|
+
declare const ContextMenuPortal: React.FC<ContextMenuPortalProps>;
|
|
23
|
+
type MenuContentProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Content>;
|
|
24
|
+
interface ContextMenuContentProps extends Omit<MenuContentProps, 'onEntryFocus' | 'side' | 'sideOffset' | 'align'> {
|
|
25
|
+
}
|
|
26
|
+
declare const ContextMenuContent: React.ForwardRefExoticComponent<ContextMenuContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
27
|
+
type MenuGroupProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Group>;
|
|
28
|
+
interface ContextMenuGroupProps extends MenuGroupProps {
|
|
29
|
+
}
|
|
30
|
+
declare const ContextMenuGroup: React.ForwardRefExoticComponent<ContextMenuGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
31
|
+
type MenuLabelProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Label>;
|
|
32
|
+
interface ContextMenuLabelProps extends MenuLabelProps {
|
|
33
|
+
}
|
|
34
|
+
declare const ContextMenuLabel: React.ForwardRefExoticComponent<ContextMenuLabelProps & React.RefAttributes<HTMLDivElement>>;
|
|
35
|
+
type MenuItemProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Item>;
|
|
36
|
+
interface ContextMenuItemProps extends MenuItemProps {
|
|
37
|
+
}
|
|
38
|
+
declare const ContextMenuItem: React.ForwardRefExoticComponent<ContextMenuItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
39
|
+
type MenuCheckboxItemProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.CheckboxItem>;
|
|
40
|
+
interface ContextMenuCheckboxItemProps extends MenuCheckboxItemProps {
|
|
41
|
+
}
|
|
42
|
+
declare const ContextMenuCheckboxItem: React.ForwardRefExoticComponent<ContextMenuCheckboxItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
43
|
+
type MenuRadioGroupProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioGroup>;
|
|
44
|
+
interface ContextMenuRadioGroupProps extends MenuRadioGroupProps {
|
|
45
|
+
}
|
|
46
|
+
declare const ContextMenuRadioGroup: React.ForwardRefExoticComponent<ContextMenuRadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
47
|
+
type MenuRadioItemProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioItem>;
|
|
48
|
+
interface ContextMenuRadioItemProps extends MenuRadioItemProps {
|
|
49
|
+
}
|
|
50
|
+
declare const ContextMenuRadioItem: React.ForwardRefExoticComponent<ContextMenuRadioItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
51
|
+
type MenuItemIndicatorProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.ItemIndicator>;
|
|
52
|
+
interface ContextMenuItemIndicatorProps extends MenuItemIndicatorProps {
|
|
53
|
+
}
|
|
54
|
+
declare const ContextMenuItemIndicator: React.ForwardRefExoticComponent<ContextMenuItemIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
|
|
55
|
+
type MenuSeparatorProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Separator>;
|
|
56
|
+
interface ContextMenuSeparatorProps extends MenuSeparatorProps {
|
|
57
|
+
}
|
|
58
|
+
declare const ContextMenuSeparator: React.ForwardRefExoticComponent<ContextMenuSeparatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
59
|
+
type MenuArrowProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Arrow>;
|
|
60
|
+
interface ContextMenuArrowProps extends MenuArrowProps {
|
|
61
|
+
}
|
|
62
|
+
declare const ContextMenuArrow: React.ForwardRefExoticComponent<ContextMenuArrowProps & React.RefAttributes<SVGSVGElement>>;
|
|
63
|
+
interface ContextMenuSubProps {
|
|
64
|
+
children?: React.ReactNode;
|
|
65
|
+
open?: boolean;
|
|
66
|
+
defaultOpen?: boolean;
|
|
67
|
+
onOpenChange?(open: boolean): void;
|
|
68
|
+
}
|
|
69
|
+
declare const ContextMenuSub: React.FC<ContextMenuSubProps>;
|
|
70
|
+
type MenuSubTriggerProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.SubTrigger>;
|
|
71
|
+
interface ContextMenuSubTriggerProps extends MenuSubTriggerProps {
|
|
72
|
+
}
|
|
73
|
+
declare const ContextMenuSubTrigger: React.ForwardRefExoticComponent<ContextMenuSubTriggerProps & React.RefAttributes<HTMLDivElement>>;
|
|
74
|
+
type MenuSubContentProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.SubContent>;
|
|
75
|
+
interface ContextMenuSubContentProps extends MenuSubContentProps {
|
|
76
|
+
}
|
|
77
|
+
declare const ContextMenuSubContent: React.ForwardRefExoticComponent<ContextMenuSubContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
78
|
+
declare const Root: React.FC<ContextMenuProps>;
|
|
79
|
+
declare const Trigger: React.ForwardRefExoticComponent<ContextMenuTriggerProps & React.RefAttributes<HTMLSpanElement>>;
|
|
80
|
+
declare const Portal: React.FC<ContextMenuPortalProps>;
|
|
81
|
+
declare const Content: React.ForwardRefExoticComponent<ContextMenuContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
82
|
+
declare const Group: React.ForwardRefExoticComponent<ContextMenuGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
83
|
+
declare const Label: React.ForwardRefExoticComponent<ContextMenuLabelProps & React.RefAttributes<HTMLDivElement>>;
|
|
84
|
+
declare const Item: React.ForwardRefExoticComponent<ContextMenuItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
85
|
+
declare const CheckboxItem: React.ForwardRefExoticComponent<ContextMenuCheckboxItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
86
|
+
declare const RadioGroup: React.ForwardRefExoticComponent<ContextMenuRadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
87
|
+
declare const RadioItem: React.ForwardRefExoticComponent<ContextMenuRadioItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
88
|
+
declare const ItemIndicator: React.ForwardRefExoticComponent<ContextMenuItemIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
|
|
89
|
+
declare const Separator: React.ForwardRefExoticComponent<ContextMenuSeparatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
90
|
+
declare const Arrow: React.ForwardRefExoticComponent<ContextMenuArrowProps & React.RefAttributes<SVGSVGElement>>;
|
|
91
|
+
declare const Sub: React.FC<ContextMenuSubProps>;
|
|
92
|
+
declare const SubTrigger: React.ForwardRefExoticComponent<ContextMenuSubTriggerProps & React.RefAttributes<HTMLDivElement>>;
|
|
93
|
+
declare const SubContent: React.ForwardRefExoticComponent<ContextMenuSubContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
94
|
+
export { createContextMenuScope, ContextMenu, ContextMenuTrigger, ContextMenuPortal, ContextMenuContent, ContextMenuGroup, ContextMenuLabel, ContextMenuItem, ContextMenuCheckboxItem, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuItemIndicator, ContextMenuSeparator, ContextMenuArrow, ContextMenuSub, ContextMenuSubTrigger, ContextMenuSubContent, Root, Trigger, Portal, Content, Group, Label, Item, CheckboxItem, RadioGroup, RadioItem, ItemIndicator, Separator, Arrow, Sub, SubTrigger, SubContent, };
|
|
95
|
+
export type { ContextMenuProps, ContextMenuTriggerProps, ContextMenuPortalProps, ContextMenuContentProps, ContextMenuGroupProps, ContextMenuLabelProps, ContextMenuItemProps, ContextMenuCheckboxItemProps, ContextMenuRadioGroupProps, ContextMenuRadioItemProps, ContextMenuItemIndicatorProps, ContextMenuSeparatorProps, ContextMenuArrowProps, ContextMenuSubProps, ContextMenuSubTriggerProps, ContextMenuSubContentProps, };
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContextScope } from "../react-context/create-context.js";
|
|
3
|
+
import { composeEventHandlers } from "../primitive/primitive.js";
|
|
4
|
+
import { IS_DEVELOPMENT } from "../primitive/is-development.js";
|
|
5
|
+
import { useControllableState } from "../react-use-controllable-state/use-controllable-state.js";
|
|
6
|
+
import { Primitive } from "../react-primitive/primitive.js";
|
|
7
|
+
import { Anchor, CheckboxItem as CheckboxItem$1, Content as Content$1, Group as Group$1, Item as Item$1, ItemIndicator as ItemIndicator$1, Label as Label$1, Portal as Portal$1, RadioGroup as RadioGroup$1, RadioItem as RadioItem$1, Root as Root$1, Separator as Separator$1, Sub as Sub$1, SubContent as SubContent$1, SubTrigger as SubTrigger$1, createMenuScope } from "../react-menu/menu.js";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
//#region src/primitives/vendor/radix/react-context-menu/context-menu.tsx
|
|
11
|
+
var CONTEXT_MENU_NAME = "ContextMenu";
|
|
12
|
+
var [createContextMenuContext, createContextMenuScope] = createContextScope(CONTEXT_MENU_NAME, [createMenuScope]);
|
|
13
|
+
var useMenuScope = createMenuScope();
|
|
14
|
+
var [ContextMenuProvider, useContextMenuContext] = createContextMenuContext(CONTEXT_MENU_NAME);
|
|
15
|
+
var ContextMenu = (props) => {
|
|
16
|
+
const { __scopeContextMenu, children, onOpenChange, open: openProp, dir, modal = true } = props;
|
|
17
|
+
const hasInteractedRef = React.useRef(false);
|
|
18
|
+
if (IS_DEVELOPMENT) {
|
|
19
|
+
const hasWarnedRef = React.useRef(false);
|
|
20
|
+
React.useEffect(() => {
|
|
21
|
+
if (openProp === true && !hasInteractedRef.current && !hasWarnedRef.current) {
|
|
22
|
+
hasWarnedRef.current = true;
|
|
23
|
+
console.warn("ContextMenu: The `open` prop has been set to `true` before the user has interacted with the trigger, so its position is indeterminate. This is likely unintended and will result in the menu being anchored to the top-left corner of the viewport.");
|
|
24
|
+
}
|
|
25
|
+
}, [openProp]);
|
|
26
|
+
}
|
|
27
|
+
const [open, setOpen] = useControllableState({
|
|
28
|
+
prop: openProp,
|
|
29
|
+
defaultProp: false,
|
|
30
|
+
onChange: onOpenChange,
|
|
31
|
+
caller: CONTEXT_MENU_NAME
|
|
32
|
+
});
|
|
33
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
34
|
+
return /* @__PURE__ */ jsx(ContextMenuProvider, {
|
|
35
|
+
scope: __scopeContextMenu,
|
|
36
|
+
open,
|
|
37
|
+
onOpenChange: setOpen,
|
|
38
|
+
modal,
|
|
39
|
+
hasInteractedRef,
|
|
40
|
+
children: /* @__PURE__ */ jsx(Root$1, {
|
|
41
|
+
...menuScope,
|
|
42
|
+
dir,
|
|
43
|
+
open,
|
|
44
|
+
onOpenChange: setOpen,
|
|
45
|
+
modal,
|
|
46
|
+
children
|
|
47
|
+
})
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
var TRIGGER_NAME = "ContextMenuTrigger";
|
|
51
|
+
var ContextMenuTrigger = /* @__PURE__ */ React.forwardRef(function ContextMenuTrigger(props, forwardedRef) {
|
|
52
|
+
const { __scopeContextMenu, disabled = false, ...triggerProps } = props;
|
|
53
|
+
const context = useContextMenuContext(TRIGGER_NAME, __scopeContextMenu);
|
|
54
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
55
|
+
const [point, setPoint] = React.useState({
|
|
56
|
+
x: 0,
|
|
57
|
+
y: 0
|
|
58
|
+
});
|
|
59
|
+
const virtualRef = React.useMemo(() => ({ current: { getBoundingClientRect: () => DOMRect.fromRect({
|
|
60
|
+
width: 0,
|
|
61
|
+
height: 0,
|
|
62
|
+
...point
|
|
63
|
+
}) } }), [point]);
|
|
64
|
+
const longPressTimerRef = React.useRef(0);
|
|
65
|
+
const clearLongPress = React.useCallback(() => window.clearTimeout(longPressTimerRef.current), []);
|
|
66
|
+
const handleOpen = (event) => {
|
|
67
|
+
context.hasInteractedRef.current = true;
|
|
68
|
+
setPoint({
|
|
69
|
+
x: event.clientX,
|
|
70
|
+
y: event.clientY
|
|
71
|
+
});
|
|
72
|
+
context.onOpenChange(true);
|
|
73
|
+
};
|
|
74
|
+
React.useEffect(() => clearLongPress, [clearLongPress]);
|
|
75
|
+
React.useEffect(() => void (disabled && clearLongPress()), [disabled, clearLongPress]);
|
|
76
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Anchor, {
|
|
77
|
+
...menuScope,
|
|
78
|
+
virtualRef
|
|
79
|
+
}), /* @__PURE__ */ jsx(Primitive.span, {
|
|
80
|
+
"data-state": context.open ? "open" : "closed",
|
|
81
|
+
"data-disabled": disabled ? "" : void 0,
|
|
82
|
+
...triggerProps,
|
|
83
|
+
ref: forwardedRef,
|
|
84
|
+
style: {
|
|
85
|
+
WebkitTouchCallout: "none",
|
|
86
|
+
...props.style
|
|
87
|
+
},
|
|
88
|
+
onContextMenu: disabled ? props.onContextMenu : composeEventHandlers(props.onContextMenu, (event) => {
|
|
89
|
+
clearLongPress();
|
|
90
|
+
handleOpen(event);
|
|
91
|
+
event.preventDefault();
|
|
92
|
+
}),
|
|
93
|
+
onPointerDown: disabled ? props.onPointerDown : composeEventHandlers(props.onPointerDown, whenTouchOrPen((event) => {
|
|
94
|
+
clearLongPress();
|
|
95
|
+
if (context.open) context.onOpenChange(false);
|
|
96
|
+
longPressTimerRef.current = window.setTimeout(() => handleOpen(event), 700);
|
|
97
|
+
})),
|
|
98
|
+
onPointerMove: disabled ? props.onPointerMove : composeEventHandlers(props.onPointerMove, whenTouchOrPen(clearLongPress)),
|
|
99
|
+
onPointerCancel: disabled ? props.onPointerCancel : composeEventHandlers(props.onPointerCancel, whenTouchOrPen(clearLongPress)),
|
|
100
|
+
onPointerUp: disabled ? props.onPointerUp : composeEventHandlers(props.onPointerUp, whenTouchOrPen(clearLongPress))
|
|
101
|
+
})] });
|
|
102
|
+
});
|
|
103
|
+
var ContextMenuPortal = (props) => {
|
|
104
|
+
const { __scopeContextMenu, ...portalProps } = props;
|
|
105
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
106
|
+
return /* @__PURE__ */ jsx(Portal$1, {
|
|
107
|
+
...menuScope,
|
|
108
|
+
...portalProps
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
var CONTENT_NAME = "ContextMenuContent";
|
|
112
|
+
var ContextMenuContent = /* @__PURE__ */ React.forwardRef(function ContextMenuContent(props, forwardedRef) {
|
|
113
|
+
const { __scopeContextMenu, ...contentProps } = props;
|
|
114
|
+
const context = useContextMenuContext(CONTENT_NAME, __scopeContextMenu);
|
|
115
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
116
|
+
const hasInteractedOutsideRef = React.useRef(false);
|
|
117
|
+
return /* @__PURE__ */ jsx(Content$1, {
|
|
118
|
+
...menuScope,
|
|
119
|
+
...contentProps,
|
|
120
|
+
ref: forwardedRef,
|
|
121
|
+
side: "right",
|
|
122
|
+
sideOffset: 2,
|
|
123
|
+
align: "start",
|
|
124
|
+
onCloseAutoFocus: (event) => {
|
|
125
|
+
props.onCloseAutoFocus?.(event);
|
|
126
|
+
if (!event.defaultPrevented && hasInteractedOutsideRef.current) event.preventDefault();
|
|
127
|
+
hasInteractedOutsideRef.current = false;
|
|
128
|
+
},
|
|
129
|
+
onInteractOutside: (event) => {
|
|
130
|
+
props.onInteractOutside?.(event);
|
|
131
|
+
if (!event.defaultPrevented && !context.modal) hasInteractedOutsideRef.current = true;
|
|
132
|
+
},
|
|
133
|
+
style: {
|
|
134
|
+
...props.style,
|
|
135
|
+
"--radix-context-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
136
|
+
"--radix-context-menu-content-available-width": "var(--radix-popper-available-width)",
|
|
137
|
+
"--radix-context-menu-content-available-height": "var(--radix-popper-available-height)",
|
|
138
|
+
"--radix-context-menu-trigger-width": "var(--radix-popper-anchor-width)",
|
|
139
|
+
"--radix-context-menu-trigger-height": "var(--radix-popper-anchor-height)"
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
var ContextMenuGroup = /* @__PURE__ */ React.forwardRef(function ContextMenuGroup(props, forwardedRef) {
|
|
144
|
+
const { __scopeContextMenu, ...groupProps } = props;
|
|
145
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
146
|
+
return /* @__PURE__ */ jsx(Group$1, {
|
|
147
|
+
...menuScope,
|
|
148
|
+
...groupProps,
|
|
149
|
+
ref: forwardedRef
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
var ContextMenuLabel = /* @__PURE__ */ React.forwardRef(function ContextMenuLabel(props, forwardedRef) {
|
|
153
|
+
const { __scopeContextMenu, ...labelProps } = props;
|
|
154
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
155
|
+
return /* @__PURE__ */ jsx(Label$1, {
|
|
156
|
+
...menuScope,
|
|
157
|
+
...labelProps,
|
|
158
|
+
ref: forwardedRef
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
var ContextMenuItem = /* @__PURE__ */ React.forwardRef(function ContextMenuItem(props, forwardedRef) {
|
|
162
|
+
const { __scopeContextMenu, ...itemProps } = props;
|
|
163
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
164
|
+
return /* @__PURE__ */ jsx(Item$1, {
|
|
165
|
+
...menuScope,
|
|
166
|
+
...itemProps,
|
|
167
|
+
ref: forwardedRef
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
var ContextMenuCheckboxItem = /* @__PURE__ */ React.forwardRef(function ContextMenuCheckboxItem(props, forwardedRef) {
|
|
171
|
+
const { __scopeContextMenu, ...checkboxItemProps } = props;
|
|
172
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
173
|
+
return /* @__PURE__ */ jsx(CheckboxItem$1, {
|
|
174
|
+
...menuScope,
|
|
175
|
+
...checkboxItemProps,
|
|
176
|
+
ref: forwardedRef
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
var ContextMenuRadioGroup = /* @__PURE__ */ React.forwardRef(function ContextMenuRadioGroup(props, forwardedRef) {
|
|
180
|
+
const { __scopeContextMenu, ...radioGroupProps } = props;
|
|
181
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
182
|
+
return /* @__PURE__ */ jsx(RadioGroup$1, {
|
|
183
|
+
...menuScope,
|
|
184
|
+
...radioGroupProps,
|
|
185
|
+
ref: forwardedRef
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
var ContextMenuRadioItem = /* @__PURE__ */ React.forwardRef(function ContextMenuRadioItem(props, forwardedRef) {
|
|
189
|
+
const { __scopeContextMenu, ...radioItemProps } = props;
|
|
190
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
191
|
+
return /* @__PURE__ */ jsx(RadioItem$1, {
|
|
192
|
+
...menuScope,
|
|
193
|
+
...radioItemProps,
|
|
194
|
+
ref: forwardedRef
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
var ContextMenuItemIndicator = /* @__PURE__ */ React.forwardRef(function ContextMenuItemIndicator(props, forwardedRef) {
|
|
198
|
+
const { __scopeContextMenu, ...itemIndicatorProps } = props;
|
|
199
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
200
|
+
return /* @__PURE__ */ jsx(ItemIndicator$1, {
|
|
201
|
+
...menuScope,
|
|
202
|
+
...itemIndicatorProps,
|
|
203
|
+
ref: forwardedRef
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
var ContextMenuSeparator = /* @__PURE__ */ React.forwardRef(function ContextMenuSeparator(props, forwardedRef) {
|
|
207
|
+
const { __scopeContextMenu, ...separatorProps } = props;
|
|
208
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
209
|
+
return /* @__PURE__ */ jsx(Separator$1, {
|
|
210
|
+
...menuScope,
|
|
211
|
+
...separatorProps,
|
|
212
|
+
ref: forwardedRef
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
var SUB_NAME = "ContextMenuSub";
|
|
216
|
+
var ContextMenuSub = (props) => {
|
|
217
|
+
const { __scopeContextMenu, children, onOpenChange, open: openProp, defaultOpen } = props;
|
|
218
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
219
|
+
const [open, setOpen] = useControllableState({
|
|
220
|
+
prop: openProp,
|
|
221
|
+
defaultProp: defaultOpen ?? false,
|
|
222
|
+
onChange: onOpenChange,
|
|
223
|
+
caller: SUB_NAME
|
|
224
|
+
});
|
|
225
|
+
return /* @__PURE__ */ jsx(Sub$1, {
|
|
226
|
+
...menuScope,
|
|
227
|
+
open,
|
|
228
|
+
onOpenChange: setOpen,
|
|
229
|
+
children
|
|
230
|
+
});
|
|
231
|
+
};
|
|
232
|
+
var ContextMenuSubTrigger = /* @__PURE__ */ React.forwardRef(function ContextMenuSubTrigger(props, forwardedRef) {
|
|
233
|
+
const { __scopeContextMenu, ...triggerItemProps } = props;
|
|
234
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
235
|
+
return /* @__PURE__ */ jsx(SubTrigger$1, {
|
|
236
|
+
...menuScope,
|
|
237
|
+
...triggerItemProps,
|
|
238
|
+
ref: forwardedRef
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
var ContextMenuSubContent = /* @__PURE__ */ React.forwardRef(function ContextMenuSubContent(props, forwardedRef) {
|
|
242
|
+
const { __scopeContextMenu, ...subContentProps } = props;
|
|
243
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
244
|
+
return /* @__PURE__ */ jsx(SubContent$1, {
|
|
245
|
+
...menuScope,
|
|
246
|
+
...subContentProps,
|
|
247
|
+
ref: forwardedRef,
|
|
248
|
+
style: {
|
|
249
|
+
...props.style,
|
|
250
|
+
"--radix-context-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
251
|
+
"--radix-context-menu-content-available-width": "var(--radix-popper-available-width)",
|
|
252
|
+
"--radix-context-menu-content-available-height": "var(--radix-popper-available-height)",
|
|
253
|
+
"--radix-context-menu-trigger-width": "var(--radix-popper-anchor-width)",
|
|
254
|
+
"--radix-context-menu-trigger-height": "var(--radix-popper-anchor-height)"
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
function whenTouchOrPen(handler) {
|
|
259
|
+
return (event) => event.pointerType !== "mouse" ? handler(event) : void 0;
|
|
260
|
+
}
|
|
261
|
+
var Root = ContextMenu;
|
|
262
|
+
var Trigger = ContextMenuTrigger;
|
|
263
|
+
var Portal = ContextMenuPortal;
|
|
264
|
+
var Content = ContextMenuContent;
|
|
265
|
+
var Group = ContextMenuGroup;
|
|
266
|
+
var Label = ContextMenuLabel;
|
|
267
|
+
var Item = ContextMenuItem;
|
|
268
|
+
var CheckboxItem = ContextMenuCheckboxItem;
|
|
269
|
+
var RadioGroup = ContextMenuRadioGroup;
|
|
270
|
+
var RadioItem = ContextMenuRadioItem;
|
|
271
|
+
var ItemIndicator = ContextMenuItemIndicator;
|
|
272
|
+
var Separator = ContextMenuSeparator;
|
|
273
|
+
var Sub = ContextMenuSub;
|
|
274
|
+
var SubTrigger = ContextMenuSubTrigger;
|
|
275
|
+
var SubContent = ContextMenuSubContent;
|
|
276
|
+
//#endregion
|
|
277
|
+
export { CheckboxItem, Content, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuItemIndicator, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, Group, Item, ItemIndicator, Label, Portal, RadioGroup, RadioItem, Root, Separator, Sub, SubContent, SubTrigger, Trigger };
|
|
278
|
+
|
|
279
|
+
//# sourceMappingURL=context-menu.js.map
|