@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,185 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContextScope } from "../react-context/create-context.js";
|
|
3
|
+
import { useComposedRefs } from "../react-compose-refs/compose-refs.js";
|
|
4
|
+
import { composeEventHandlers } from "../primitive/primitive.js";
|
|
5
|
+
import { useControllableState } from "../react-use-controllable-state/use-controllable-state.js";
|
|
6
|
+
import { Primitive } from "../react-primitive/primitive.js";
|
|
7
|
+
import { useSize } from "../react-use-size/use-size.js";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
//#region src/primitives/vendor/radix/react-switch/switch.tsx
|
|
11
|
+
var SWITCH_NAME = "Switch";
|
|
12
|
+
var [createSwitchContext, createSwitchScope] = createContextScope(SWITCH_NAME);
|
|
13
|
+
var [SwitchProviderImpl, useSwitchContext] = createSwitchContext(SWITCH_NAME);
|
|
14
|
+
function SwitchProvider(props) {
|
|
15
|
+
const { __scopeSwitch, checked: checkedProp, children, defaultChecked, disabled, form, name, onCheckedChange, required, value = "on", internal_do_not_use_render } = props;
|
|
16
|
+
const [checked, setChecked] = useControllableState({
|
|
17
|
+
prop: checkedProp,
|
|
18
|
+
defaultProp: defaultChecked ?? false,
|
|
19
|
+
onChange: onCheckedChange,
|
|
20
|
+
caller: SWITCH_NAME
|
|
21
|
+
});
|
|
22
|
+
const [control, setControl] = React.useState(null);
|
|
23
|
+
const [bubbleInput, setBubbleInput] = React.useState(null);
|
|
24
|
+
const hasConsumerStoppedPropagationRef = React.useRef(false);
|
|
25
|
+
const [userInteractionCount, onUserInteraction] = React.useReducer((count) => count + 1, 0);
|
|
26
|
+
const context = {
|
|
27
|
+
checked,
|
|
28
|
+
setChecked,
|
|
29
|
+
disabled,
|
|
30
|
+
control,
|
|
31
|
+
setControl,
|
|
32
|
+
name,
|
|
33
|
+
form,
|
|
34
|
+
value,
|
|
35
|
+
hasConsumerStoppedPropagationRef,
|
|
36
|
+
userInteractionCount,
|
|
37
|
+
onUserInteraction,
|
|
38
|
+
required,
|
|
39
|
+
defaultChecked,
|
|
40
|
+
isFormControl: control ? !!form || !!control.closest("form") : true,
|
|
41
|
+
bubbleInput,
|
|
42
|
+
setBubbleInput
|
|
43
|
+
};
|
|
44
|
+
return /* @__PURE__ */ jsx(SwitchProviderImpl, {
|
|
45
|
+
scope: __scopeSwitch,
|
|
46
|
+
...context,
|
|
47
|
+
children: isFunction(internal_do_not_use_render) ? internal_do_not_use_render(context) : children
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
var TRIGGER_NAME = "SwitchTrigger";
|
|
51
|
+
var SwitchTrigger = /* @__PURE__ */ React.forwardRef(function SwitchTrigger({ __scopeSwitch, onClick, ...switchProps }, forwardedRef) {
|
|
52
|
+
const { control, form, value, disabled, checked, required, setControl, setChecked, hasConsumerStoppedPropagationRef, onUserInteraction, isFormControl, bubbleInput } = useSwitchContext(TRIGGER_NAME, __scopeSwitch);
|
|
53
|
+
const composedRefs = useComposedRefs(forwardedRef, setControl);
|
|
54
|
+
const initialCheckedStateRef = React.useRef(checked);
|
|
55
|
+
React.useEffect(() => {
|
|
56
|
+
const associatedForm = form ? control?.ownerDocument.getElementById(form) : control?.form;
|
|
57
|
+
if (associatedForm instanceof HTMLFormElement) {
|
|
58
|
+
const reset = () => setChecked(initialCheckedStateRef.current);
|
|
59
|
+
associatedForm.addEventListener("reset", reset);
|
|
60
|
+
return () => associatedForm.removeEventListener("reset", reset);
|
|
61
|
+
}
|
|
62
|
+
}, [
|
|
63
|
+
control,
|
|
64
|
+
form,
|
|
65
|
+
setChecked
|
|
66
|
+
]);
|
|
67
|
+
return /* @__PURE__ */ jsx(Primitive.button, {
|
|
68
|
+
type: "button",
|
|
69
|
+
role: "switch",
|
|
70
|
+
"aria-checked": checked,
|
|
71
|
+
"aria-required": required,
|
|
72
|
+
"data-state": getState(checked),
|
|
73
|
+
"data-disabled": disabled ? "" : void 0,
|
|
74
|
+
disabled,
|
|
75
|
+
value,
|
|
76
|
+
...switchProps,
|
|
77
|
+
ref: composedRefs,
|
|
78
|
+
onClick: composeEventHandlers(onClick, (event) => {
|
|
79
|
+
onUserInteraction();
|
|
80
|
+
setChecked((prevChecked) => !prevChecked);
|
|
81
|
+
if (bubbleInput && isFormControl) {
|
|
82
|
+
hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
|
|
83
|
+
if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
|
|
84
|
+
}
|
|
85
|
+
})
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
var Switch = /* @__PURE__ */ React.forwardRef(function Switch(props, forwardedRef) {
|
|
89
|
+
const { __scopeSwitch, name, checked, defaultChecked, required, disabled, value, onCheckedChange, form, ...switchProps } = props;
|
|
90
|
+
return /* @__PURE__ */ jsx(SwitchProvider, {
|
|
91
|
+
__scopeSwitch,
|
|
92
|
+
checked,
|
|
93
|
+
defaultChecked,
|
|
94
|
+
disabled,
|
|
95
|
+
required,
|
|
96
|
+
onCheckedChange,
|
|
97
|
+
name,
|
|
98
|
+
form,
|
|
99
|
+
value,
|
|
100
|
+
internal_do_not_use_render: ({ isFormControl }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(SwitchTrigger, {
|
|
101
|
+
...switchProps,
|
|
102
|
+
ref: forwardedRef,
|
|
103
|
+
__scopeSwitch
|
|
104
|
+
}), isFormControl && /* @__PURE__ */ jsx(SwitchBubbleInput, { __scopeSwitch })] })
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
var THUMB_NAME = "SwitchThumb";
|
|
108
|
+
var SwitchThumb = /* @__PURE__ */ React.forwardRef(function SwitchThumb(props, forwardedRef) {
|
|
109
|
+
const { __scopeSwitch, ...thumbProps } = props;
|
|
110
|
+
const context = useSwitchContext(THUMB_NAME, __scopeSwitch);
|
|
111
|
+
return /* @__PURE__ */ jsx(Primitive.span, {
|
|
112
|
+
"data-state": getState(context.checked),
|
|
113
|
+
"data-disabled": context.disabled ? "" : void 0,
|
|
114
|
+
...thumbProps,
|
|
115
|
+
ref: forwardedRef
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
var BUBBLE_INPUT_NAME = "SwitchBubbleInput";
|
|
119
|
+
var SwitchBubbleInput = /* @__PURE__ */ React.forwardRef(function SwitchBubbleInput({ __scopeSwitch, onClick, ...props }, forwardedRef) {
|
|
120
|
+
const { control, hasConsumerStoppedPropagationRef, userInteractionCount, checked, defaultChecked, required, disabled, name, value, form, bubbleInput, setBubbleInput } = useSwitchContext(BUBBLE_INPUT_NAME, __scopeSwitch);
|
|
121
|
+
const composedRefs = useComposedRefs(forwardedRef, setBubbleInput);
|
|
122
|
+
const controlSize = useSize(control);
|
|
123
|
+
const shouldStopClickPropagationRef = React.useRef(false);
|
|
124
|
+
const prevCheckedRef = React.useRef(checked);
|
|
125
|
+
const prevUserInteractionCountRef = React.useRef(userInteractionCount);
|
|
126
|
+
React.useEffect(() => {
|
|
127
|
+
const input = bubbleInput;
|
|
128
|
+
if (!input) return;
|
|
129
|
+
const inputProto = window.HTMLInputElement.prototype;
|
|
130
|
+
const setChecked = Object.getOwnPropertyDescriptor(inputProto, "checked").set;
|
|
131
|
+
const isUserInteraction = userInteractionCount !== prevUserInteractionCountRef.current;
|
|
132
|
+
prevUserInteractionCountRef.current = userInteractionCount;
|
|
133
|
+
const checkedChanged = prevCheckedRef.current !== checked;
|
|
134
|
+
prevCheckedRef.current = checked;
|
|
135
|
+
const bubbles = !(isUserInteraction && hasConsumerStoppedPropagationRef.current);
|
|
136
|
+
if (checkedChanged && setChecked) {
|
|
137
|
+
shouldStopClickPropagationRef.current = !isUserInteraction;
|
|
138
|
+
const event = new Event("click", { bubbles });
|
|
139
|
+
setChecked.call(input, checked);
|
|
140
|
+
input.dispatchEvent(event);
|
|
141
|
+
shouldStopClickPropagationRef.current = false;
|
|
142
|
+
}
|
|
143
|
+
}, [
|
|
144
|
+
bubbleInput,
|
|
145
|
+
checked,
|
|
146
|
+
hasConsumerStoppedPropagationRef,
|
|
147
|
+
userInteractionCount
|
|
148
|
+
]);
|
|
149
|
+
const defaultCheckedRef = React.useRef(checked);
|
|
150
|
+
return /* @__PURE__ */ jsx(Primitive.input, {
|
|
151
|
+
type: "checkbox",
|
|
152
|
+
"aria-hidden": true,
|
|
153
|
+
defaultChecked: defaultChecked ?? defaultCheckedRef.current,
|
|
154
|
+
required,
|
|
155
|
+
disabled,
|
|
156
|
+
name,
|
|
157
|
+
value,
|
|
158
|
+
form,
|
|
159
|
+
...props,
|
|
160
|
+
tabIndex: -1,
|
|
161
|
+
ref: composedRefs,
|
|
162
|
+
onClick: composeEventHandlers(onClick, (event) => {
|
|
163
|
+
if (shouldStopClickPropagationRef.current) event.stopPropagation();
|
|
164
|
+
}),
|
|
165
|
+
style: {
|
|
166
|
+
...props.style,
|
|
167
|
+
...controlSize,
|
|
168
|
+
position: "absolute",
|
|
169
|
+
pointerEvents: "none",
|
|
170
|
+
opacity: 0,
|
|
171
|
+
margin: 0,
|
|
172
|
+
transform: "translateX(-100%)"
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
function isFunction(value) {
|
|
177
|
+
return typeof value === "function";
|
|
178
|
+
}
|
|
179
|
+
function getState(checked) {
|
|
180
|
+
return checked ? "checked" : "unchecked";
|
|
181
|
+
}
|
|
182
|
+
//#endregion
|
|
183
|
+
export { SwitchBubbleInput as BubbleInput, SwitchBubbleInput, SwitchProvider as Provider, SwitchProvider, Switch as Root, Switch, SwitchThumb, SwitchThumb as Thumb, SwitchTrigger, SwitchTrigger as Trigger };
|
|
184
|
+
|
|
185
|
+
//# sourceMappingURL=switch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"switch.js","names":["_Fragment"],"sources":["../../../../../src/primitives/vendor/radix/react-switch/switch.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';\nimport { composeEventHandlers } from '../primitive';\nimport { useComposedRefs } from '../react-compose-refs';\nimport { createContextScope } from '../react-context';\nimport { useControllableState } from '../react-use-controllable-state';\nimport { useSize } from '../react-use-size';\nimport { Primitive } from '../react-primitive';\n\nimport type { Scope } from '../react-context';\n\nconst SWITCH_NAME = 'Switch';\n\ntype ScopedProps<P> = P & { __scopeSwitch?: Scope };\nconst [createSwitchContext, createSwitchScope] = createContextScope(SWITCH_NAME);\n\ntype SwitchContextValue = {\n checked: boolean;\n setChecked: React.Dispatch<React.SetStateAction<boolean>>;\n disabled: boolean | undefined;\n control: HTMLButtonElement | null;\n setControl: React.Dispatch<React.SetStateAction<HTMLButtonElement | null>>;\n name: string | undefined;\n form: string | undefined;\n value: string | number | readonly string[];\n hasConsumerStoppedPropagationRef: React.RefObject<boolean>;\n userInteractionCount: number;\n onUserInteraction: () => void;\n required: boolean | undefined;\n defaultChecked: boolean | undefined;\n isFormControl: boolean;\n bubbleInput: HTMLInputElement | null;\n setBubbleInput: React.Dispatch<React.SetStateAction<HTMLInputElement | null>>;\n};\n\nconst [SwitchProviderImpl, useSwitchContext] = createSwitchContext<SwitchContextValue>(SWITCH_NAME);\n\n/* -------------------------------------------------------------------------------------------------\n * SwitchProvider\n * -----------------------------------------------------------------------------------------------*/\n\ninterface SwitchProviderProps {\n checked?: boolean;\n defaultChecked?: boolean;\n required?: boolean;\n onCheckedChange?(checked: boolean): void;\n name?: string;\n form?: string;\n disabled?: boolean;\n value?: string | number | readonly string[];\n children?: React.ReactNode;\n}\n\nfunction SwitchProvider(props: ScopedProps<SwitchProviderProps>) {\n const {\n __scopeSwitch,\n checked: checkedProp,\n children,\n defaultChecked,\n disabled,\n form,\n name,\n onCheckedChange,\n required,\n value = 'on',\n // @ts-expect-error\n internal_do_not_use_render,\n } = props;\n\n const [checked, setChecked] = useControllableState({\n prop: checkedProp,\n defaultProp: defaultChecked ?? false,\n onChange: onCheckedChange,\n caller: SWITCH_NAME,\n });\n const [control, setControl] = React.useState<HTMLButtonElement | null>(null);\n const [bubbleInput, setBubbleInput] = React.useState<HTMLInputElement | null>(null);\n const hasConsumerStoppedPropagationRef = React.useRef(false);\n\n // Incremented on every user interaction with the trigger. The bubble input\n // compares this against the value it last handled to tell whether a `checked`\n // change was driven by the user (vs. a controlled/programmatic update). Using\n // a counter guarantees the marker is updated in the same commit as the\n // resulting render, so it can never go stale and leak into a later\n // programmatic update.\n const [userInteractionCount, onUserInteraction] = React.useReducer(\n (count: number): number => count + 1,\n 0,\n );\n\n const isFormControl = control\n ? !!form || !!control.closest('form')\n : // We set this to true by default so that events bubble to forms without JS (SSR)\n true;\n\n const context: SwitchContextValue = {\n checked,\n setChecked,\n disabled,\n control,\n setControl,\n name,\n form,\n value,\n hasConsumerStoppedPropagationRef,\n userInteractionCount,\n onUserInteraction,\n required,\n defaultChecked,\n isFormControl,\n bubbleInput,\n setBubbleInput,\n };\n\n return (\n <SwitchProviderImpl scope={__scopeSwitch} {...context}>\n {isFunction(internal_do_not_use_render) ? internal_do_not_use_render(context) : children}\n </SwitchProviderImpl>\n );\n}\n\n/* -------------------------------------------------------------------------------------------------\n * SwitchTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'SwitchTrigger';\n\ninterface SwitchTriggerProps extends Omit<\n React.ComponentPropsWithoutRef<typeof Primitive.button>,\n keyof SwitchProviderProps\n> {\n children?: React.ReactNode;\n}\n\nconst SwitchTrigger = /* @__PURE__ */ React.forwardRef<HTMLButtonElement, SwitchTriggerProps>(\n function SwitchTrigger(\n { __scopeSwitch, onClick, ...switchProps }: ScopedProps<SwitchTriggerProps>,\n forwardedRef,\n ) {\n const {\n control,\n form,\n value,\n disabled,\n checked,\n required,\n setControl,\n setChecked,\n hasConsumerStoppedPropagationRef,\n onUserInteraction,\n isFormControl,\n bubbleInput,\n } = useSwitchContext(TRIGGER_NAME, __scopeSwitch);\n const composedRefs = useComposedRefs(forwardedRef, setControl);\n\n const initialCheckedStateRef = React.useRef(checked);\n React.useEffect(() => {\n const associatedForm = form ? control?.ownerDocument.getElementById(form) : control?.form;\n if (associatedForm instanceof HTMLFormElement) {\n const reset = () => setChecked(initialCheckedStateRef.current);\n associatedForm.addEventListener('reset', reset);\n return () => associatedForm.removeEventListener('reset', reset);\n }\n }, [control, form, setChecked]);\n\n return (\n <Primitive.button\n type=\"button\"\n role=\"switch\"\n aria-checked={checked}\n aria-required={required}\n data-state={getState(checked)}\n data-disabled={disabled ? '' : undefined}\n disabled={disabled}\n value={value}\n {...switchProps}\n ref={composedRefs}\n onClick={composeEventHandlers(onClick, (event) => {\n onUserInteraction();\n setChecked((prevChecked) => !prevChecked);\n if (bubbleInput && isFormControl) {\n hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();\n // if switch has a bubble input and is a form control, stop\n // propagation from the button so that we only propagate one click\n // event (from the input). We propagate changes from an input so\n // that native form validation works and form events reflect switch\n // updates.\n if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();\n }\n })}\n />\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * Switch\n * -----------------------------------------------------------------------------------------------*/\n\ntype SwitchElement = React.ComponentRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface SwitchProps extends Omit<PrimitiveButtonProps, 'checked' | 'defaultChecked'> {\n checked?: boolean;\n defaultChecked?: boolean;\n required?: boolean;\n onCheckedChange?(checked: boolean): void;\n}\n\nconst Switch = /* @__PURE__ */ React.forwardRef<SwitchElement, SwitchProps>(\n // blank line to reduce diff noise\n function Switch(props: ScopedProps<SwitchProps>, forwardedRef) {\n const {\n __scopeSwitch,\n name,\n checked,\n defaultChecked,\n required,\n disabled,\n value,\n onCheckedChange,\n form,\n ...switchProps\n } = props;\n\n return (\n <SwitchProvider\n __scopeSwitch={__scopeSwitch}\n checked={checked}\n defaultChecked={defaultChecked}\n disabled={disabled}\n required={required}\n onCheckedChange={onCheckedChange}\n name={name}\n form={form}\n value={value}\n // @ts-expect-error\n internal_do_not_use_render={({ isFormControl }: SwitchContextValue) => (\n <>\n <SwitchTrigger\n {...switchProps}\n ref={forwardedRef}\n // @ts-expect-error\n __scopeSwitch={__scopeSwitch}\n />\n {isFormControl && (\n <SwitchBubbleInput\n // @ts-expect-error\n __scopeSwitch={__scopeSwitch}\n />\n )}\n </>\n )}\n />\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * SwitchThumb\n * -----------------------------------------------------------------------------------------------*/\n\nconst THUMB_NAME = 'SwitchThumb';\n\ntype SwitchThumbElement = React.ComponentRef<typeof Primitive.span>;\ntype PrimitiveSpanProps = React.ComponentPropsWithoutRef<typeof Primitive.span>;\ninterface SwitchThumbProps extends PrimitiveSpanProps {}\n\nconst SwitchThumb = /* @__PURE__ */ React.forwardRef<SwitchThumbElement, SwitchThumbProps>(\n function SwitchThumb(props: ScopedProps<SwitchThumbProps>, forwardedRef) {\n const { __scopeSwitch, ...thumbProps } = props;\n const context = useSwitchContext(THUMB_NAME, __scopeSwitch);\n return (\n <Primitive.span\n data-state={getState(context.checked)}\n data-disabled={context.disabled ? '' : undefined}\n {...thumbProps}\n ref={forwardedRef}\n />\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * SwitchBubbleInput\n * -----------------------------------------------------------------------------------------------*/\n\nconst BUBBLE_INPUT_NAME = 'SwitchBubbleInput';\n\ntype InputProps = React.ComponentPropsWithoutRef<typeof Primitive.input>;\ninterface SwitchBubbleInputProps extends Omit<InputProps, 'checked'> {}\n\nconst SwitchBubbleInput = /* @__PURE__ */ React.forwardRef<\n HTMLInputElement,\n SwitchBubbleInputProps\n>(\n // blank line to reduce diff noise\n function SwitchBubbleInput(\n { __scopeSwitch, onClick, ...props }: ScopedProps<SwitchBubbleInputProps>,\n forwardedRef,\n ) {\n const {\n control,\n hasConsumerStoppedPropagationRef,\n userInteractionCount,\n checked,\n defaultChecked,\n required,\n disabled,\n name,\n value,\n form,\n bubbleInput,\n setBubbleInput,\n } = useSwitchContext(BUBBLE_INPUT_NAME, __scopeSwitch);\n\n const composedRefs = useComposedRefs(forwardedRef, setBubbleInput);\n const controlSize = useSize(control);\n // When the checked change is not driven by a user interaction (e.g. a\n // controlled `checked` update), the `click` event we dispatch to notify\n // forms must not reach ancestor `onClick` handlers. We can't simply make it\n // non-bubbling because React derives the switch's `change` event from a\n // bubbling `click`. Instead we stop propagation of the synthetic click,\n // which still lets the `change` event reach the form.\n const shouldStopClickPropagationRef = React.useRef(false);\n\n // The `checked` value we last synced to the input, and the interaction\n // counter we last accounted for. Comparing against these lets us detect a\n // genuine `checked` change and whether it followed a user interaction, even\n // on renders caused by clicks that don't change `checked` (e.g. a\n // controlled value that ignores the change).\n const prevCheckedRef = React.useRef(checked);\n const prevUserInteractionCountRef = React.useRef(userInteractionCount);\n\n // Bubble checked change to parents (e.g form change event)\n React.useEffect(() => {\n const input = bubbleInput;\n if (!input) return;\n\n const inputProto = window.HTMLInputElement.prototype;\n const descriptor = Object.getOwnPropertyDescriptor(\n inputProto,\n 'checked',\n ) as PropertyDescriptor;\n const setChecked = descriptor.set;\n\n const isUserInteraction = userInteractionCount !== prevUserInteractionCountRef.current;\n prevUserInteractionCountRef.current = userInteractionCount;\n const checkedChanged = prevCheckedRef.current !== checked;\n prevCheckedRef.current = checked;\n\n const bubbles = !(isUserInteraction && hasConsumerStoppedPropagationRef.current);\n if (checkedChanged && setChecked) {\n shouldStopClickPropagationRef.current = !isUserInteraction;\n const event = new Event('click', { bubbles });\n setChecked.call(input, checked);\n input.dispatchEvent(event);\n shouldStopClickPropagationRef.current = false;\n }\n }, [bubbleInput, checked, hasConsumerStoppedPropagationRef, userInteractionCount]);\n\n const defaultCheckedRef = React.useRef(checked);\n return (\n <Primitive.input\n type=\"checkbox\"\n aria-hidden\n defaultChecked={defaultChecked ?? defaultCheckedRef.current}\n required={required}\n disabled={disabled}\n name={name}\n value={value}\n form={form}\n {...props}\n tabIndex={-1}\n ref={composedRefs}\n onClick={composeEventHandlers(onClick, (event) => {\n // Prevent the synthetic click dispatched on controlled/programmatic\n // updates from triggering ancestor `onClick` handlers, while still\n // allowing the resulting `change` event to reach the form.\n if (shouldStopClickPropagationRef.current) {\n event.stopPropagation();\n }\n })}\n style={{\n ...props.style,\n ...controlSize,\n position: 'absolute',\n pointerEvents: 'none',\n opacity: 0,\n margin: 0,\n // We transform because the input is absolutely positioned but we have\n // rendered it **after** the button. This pulls it back to sit on top\n // of the button.\n transform: 'translateX(-100%)',\n }}\n />\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction isFunction(value: unknown): value is (...args: any[]) => any {\n return typeof value === 'function';\n}\n\nfunction getState(checked: boolean) {\n return checked ? 'checked' : 'unchecked';\n}\n\nexport {\n createSwitchScope,\n //\n Switch,\n SwitchProvider,\n SwitchTrigger,\n SwitchThumb,\n SwitchBubbleInput,\n //\n Switch as Root,\n SwitchProvider as Provider,\n SwitchTrigger as Trigger,\n SwitchThumb as Thumb,\n SwitchBubbleInput as BubbleInput,\n};\nexport type {\n SwitchProps,\n SwitchProviderProps,\n SwitchTriggerProps,\n SwitchThumbProps,\n SwitchBubbleInputProps,\n};\n"],"mappings":"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"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Primitive } from '../react-primitive';
|
|
3
|
+
import * as RovingFocusGroup from '../react-roving-focus';
|
|
4
|
+
declare const createTabsScope: import("../react-context").CreateScope;
|
|
5
|
+
type RovingFocusGroupProps = React.ComponentPropsWithoutRef<typeof RovingFocusGroup.Root>;
|
|
6
|
+
type PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;
|
|
7
|
+
interface TabsProps extends PrimitiveDivProps {
|
|
8
|
+
/** The value for the selected tab, if controlled */
|
|
9
|
+
value?: string;
|
|
10
|
+
/** The value of the tab to select by default, if uncontrolled */
|
|
11
|
+
defaultValue?: string;
|
|
12
|
+
/** A function called when a new tab is selected */
|
|
13
|
+
onValueChange?: (value: string) => void;
|
|
14
|
+
/**
|
|
15
|
+
* The orientation the tabs are layed out.
|
|
16
|
+
* Mainly so arrow navigation is done accordingly (left & right vs. up & down)
|
|
17
|
+
* @defaultValue horizontal
|
|
18
|
+
*/
|
|
19
|
+
orientation?: RovingFocusGroupProps['orientation'];
|
|
20
|
+
/**
|
|
21
|
+
* The direction of navigation between toolbar items.
|
|
22
|
+
*/
|
|
23
|
+
dir?: RovingFocusGroupProps['dir'];
|
|
24
|
+
/**
|
|
25
|
+
* Whether a tab is activated automatically or manually.
|
|
26
|
+
* @defaultValue automatic
|
|
27
|
+
* */
|
|
28
|
+
activationMode?: 'automatic' | 'manual';
|
|
29
|
+
}
|
|
30
|
+
declare const Tabs: React.ForwardRefExoticComponent<TabsProps & React.RefAttributes<HTMLDivElement>>;
|
|
31
|
+
interface TabsListProps extends PrimitiveDivProps {
|
|
32
|
+
loop?: RovingFocusGroupProps['loop'];
|
|
33
|
+
}
|
|
34
|
+
declare const TabsList: React.ForwardRefExoticComponent<TabsListProps & React.RefAttributes<HTMLDivElement>>;
|
|
35
|
+
type PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;
|
|
36
|
+
interface TabsTriggerProps extends PrimitiveButtonProps {
|
|
37
|
+
value: string;
|
|
38
|
+
}
|
|
39
|
+
declare const TabsTrigger: React.ForwardRefExoticComponent<TabsTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
40
|
+
interface TabsContentProps extends PrimitiveDivProps {
|
|
41
|
+
value: string;
|
|
42
|
+
/**
|
|
43
|
+
* Used to force mounting when more control is needed. Useful when
|
|
44
|
+
* controlling animation with React animation libraries.
|
|
45
|
+
*/
|
|
46
|
+
forceMount?: true;
|
|
47
|
+
}
|
|
48
|
+
declare const TabsContent: React.ForwardRefExoticComponent<TabsContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
49
|
+
declare const Root: React.ForwardRefExoticComponent<TabsProps & React.RefAttributes<HTMLDivElement>>;
|
|
50
|
+
declare const List: React.ForwardRefExoticComponent<TabsListProps & React.RefAttributes<HTMLDivElement>>;
|
|
51
|
+
declare const Trigger: React.ForwardRefExoticComponent<TabsTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
52
|
+
declare const Content: React.ForwardRefExoticComponent<TabsContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
53
|
+
export { createTabsScope, Tabs, TabsList, TabsTrigger, TabsContent, Root, List, Trigger, Content, };
|
|
54
|
+
export type { TabsProps, TabsListProps, TabsTriggerProps, TabsContentProps };
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContextScope } from "../react-context/create-context.js";
|
|
3
|
+
import { composeEventHandlers } from "../primitive/primitive.js";
|
|
4
|
+
import { useControllableState } from "../react-use-controllable-state/use-controllable-state.js";
|
|
5
|
+
import { Primitive } from "../react-primitive/primitive.js";
|
|
6
|
+
import { Presence } from "../react-presence/presence.js";
|
|
7
|
+
import { useId } from "../react-id/id.js";
|
|
8
|
+
import { useDirection } from "../react-direction/direction.js";
|
|
9
|
+
import { Item, Root as Root$1, createRovingFocusGroupScope } from "../react-roving-focus/roving-focus-group.js";
|
|
10
|
+
import * as React from "react";
|
|
11
|
+
import { jsx } from "react/jsx-runtime";
|
|
12
|
+
//#region src/primitives/vendor/radix/react-tabs/tabs.tsx
|
|
13
|
+
var TABS_NAME = "Tabs";
|
|
14
|
+
var [createTabsContext, createTabsScope] = createContextScope(TABS_NAME, [createRovingFocusGroupScope]);
|
|
15
|
+
var useRovingFocusGroupScope = createRovingFocusGroupScope();
|
|
16
|
+
var [TabsProvider, useTabsContext] = createTabsContext(TABS_NAME);
|
|
17
|
+
var Tabs = /* @__PURE__ */ React.forwardRef(function Tabs(props, forwardedRef) {
|
|
18
|
+
const { __scopeTabs, value: valueProp, onValueChange, defaultValue, orientation = "horizontal", dir, activationMode = "automatic", ...tabsProps } = props;
|
|
19
|
+
const direction = useDirection(dir);
|
|
20
|
+
const [value, setValue] = useControllableState({
|
|
21
|
+
prop: valueProp,
|
|
22
|
+
onChange: onValueChange,
|
|
23
|
+
defaultProp: defaultValue ?? "",
|
|
24
|
+
caller: TABS_NAME
|
|
25
|
+
});
|
|
26
|
+
return /* @__PURE__ */ jsx(TabsProvider, {
|
|
27
|
+
scope: __scopeTabs,
|
|
28
|
+
baseId: useId(),
|
|
29
|
+
value,
|
|
30
|
+
onValueChange: setValue,
|
|
31
|
+
orientation,
|
|
32
|
+
dir: direction,
|
|
33
|
+
activationMode,
|
|
34
|
+
children: /* @__PURE__ */ jsx(Primitive.div, {
|
|
35
|
+
dir: direction,
|
|
36
|
+
"data-orientation": orientation,
|
|
37
|
+
...tabsProps,
|
|
38
|
+
ref: forwardedRef
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
var TAB_LIST_NAME = "TabsList";
|
|
43
|
+
var TabsList = /* @__PURE__ */ React.forwardRef(function TabsList(props, forwardedRef) {
|
|
44
|
+
const { __scopeTabs, loop = true, ...listProps } = props;
|
|
45
|
+
const context = useTabsContext(TAB_LIST_NAME, __scopeTabs);
|
|
46
|
+
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeTabs);
|
|
47
|
+
return /* @__PURE__ */ jsx(Root$1, {
|
|
48
|
+
asChild: true,
|
|
49
|
+
...rovingFocusGroupScope,
|
|
50
|
+
orientation: context.orientation,
|
|
51
|
+
dir: context.dir,
|
|
52
|
+
loop,
|
|
53
|
+
children: /* @__PURE__ */ jsx(Primitive.div, {
|
|
54
|
+
role: "tablist",
|
|
55
|
+
"aria-orientation": context.orientation,
|
|
56
|
+
...listProps,
|
|
57
|
+
ref: forwardedRef
|
|
58
|
+
})
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
var TRIGGER_NAME = "TabsTrigger";
|
|
62
|
+
var TabsTrigger = /* @__PURE__ */ React.forwardRef(function TabsTrigger(props, forwardedRef) {
|
|
63
|
+
const { __scopeTabs, value, disabled = false, ...triggerProps } = props;
|
|
64
|
+
const context = useTabsContext(TRIGGER_NAME, __scopeTabs);
|
|
65
|
+
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeTabs);
|
|
66
|
+
const triggerId = makeTriggerId(context.baseId, value);
|
|
67
|
+
const contentId = makeContentId(context.baseId, value);
|
|
68
|
+
const isSelected = value === context.value;
|
|
69
|
+
return /* @__PURE__ */ jsx(Item, {
|
|
70
|
+
asChild: true,
|
|
71
|
+
...rovingFocusGroupScope,
|
|
72
|
+
focusable: !disabled,
|
|
73
|
+
active: isSelected,
|
|
74
|
+
children: /* @__PURE__ */ jsx(Primitive.button, {
|
|
75
|
+
type: "button",
|
|
76
|
+
role: "tab",
|
|
77
|
+
"aria-selected": isSelected,
|
|
78
|
+
"aria-controls": contentId,
|
|
79
|
+
"data-state": isSelected ? "active" : "inactive",
|
|
80
|
+
"data-disabled": disabled ? "" : void 0,
|
|
81
|
+
disabled,
|
|
82
|
+
id: triggerId,
|
|
83
|
+
...triggerProps,
|
|
84
|
+
ref: forwardedRef,
|
|
85
|
+
onMouseDown: composeEventHandlers(props.onMouseDown, (event) => {
|
|
86
|
+
if (!disabled && event.button === 0 && event.ctrlKey === false) context.onValueChange(value);
|
|
87
|
+
else event.preventDefault();
|
|
88
|
+
}),
|
|
89
|
+
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
90
|
+
if (disabled || event.target !== event.currentTarget) return;
|
|
91
|
+
if ([" ", "Enter"].includes(event.key)) context.onValueChange(value);
|
|
92
|
+
}),
|
|
93
|
+
onFocus: composeEventHandlers(props.onFocus, () => {
|
|
94
|
+
const isAutomaticActivation = context.activationMode !== "manual";
|
|
95
|
+
if (!isSelected && !disabled && isAutomaticActivation) context.onValueChange(value);
|
|
96
|
+
})
|
|
97
|
+
})
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
var CONTENT_NAME = "TabsContent";
|
|
101
|
+
var TabsContent = /* @__PURE__ */ React.forwardRef(function TabsContent(props, forwardedRef) {
|
|
102
|
+
const { __scopeTabs, value, forceMount, children, ...contentProps } = props;
|
|
103
|
+
const context = useTabsContext(CONTENT_NAME, __scopeTabs);
|
|
104
|
+
const triggerId = makeTriggerId(context.baseId, value);
|
|
105
|
+
const contentId = makeContentId(context.baseId, value);
|
|
106
|
+
const isSelected = value === context.value;
|
|
107
|
+
const isMountAnimationPreventedRef = React.useRef(isSelected);
|
|
108
|
+
React.useEffect(() => {
|
|
109
|
+
const rAF = requestAnimationFrame(() => isMountAnimationPreventedRef.current = false);
|
|
110
|
+
return () => cancelAnimationFrame(rAF);
|
|
111
|
+
}, []);
|
|
112
|
+
return /* @__PURE__ */ jsx(Presence, {
|
|
113
|
+
present: forceMount || isSelected,
|
|
114
|
+
children: ({ present }) => /* @__PURE__ */ jsx(Primitive.div, {
|
|
115
|
+
"data-state": isSelected ? "active" : "inactive",
|
|
116
|
+
"data-orientation": context.orientation,
|
|
117
|
+
role: "tabpanel",
|
|
118
|
+
"aria-labelledby": triggerId,
|
|
119
|
+
hidden: !present,
|
|
120
|
+
id: contentId,
|
|
121
|
+
tabIndex: 0,
|
|
122
|
+
...contentProps,
|
|
123
|
+
ref: forwardedRef,
|
|
124
|
+
style: {
|
|
125
|
+
...props.style,
|
|
126
|
+
animationDuration: isMountAnimationPreventedRef.current ? "0s" : void 0
|
|
127
|
+
},
|
|
128
|
+
children: present && children
|
|
129
|
+
})
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
function makeTriggerId(baseId, value) {
|
|
133
|
+
return `${baseId}-trigger-${value}`;
|
|
134
|
+
}
|
|
135
|
+
function makeContentId(baseId, value) {
|
|
136
|
+
return `${baseId}-content-${value}`;
|
|
137
|
+
}
|
|
138
|
+
var Root = Tabs;
|
|
139
|
+
var List = TabsList;
|
|
140
|
+
var Trigger = TabsTrigger;
|
|
141
|
+
var Content = TabsContent;
|
|
142
|
+
//#endregion
|
|
143
|
+
export { Content, List, Root, Tabs, TabsContent, TabsList, TabsTrigger, Trigger };
|
|
144
|
+
|
|
145
|
+
//# sourceMappingURL=tabs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.js","names":["RovingFocusGroup.Root","RovingFocusGroup.Item"],"sources":["../../../../../src/primitives/vendor/radix/react-tabs/tabs.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';\nimport { composeEventHandlers } from '../primitive';\nimport { createContextScope } from '../react-context';\nimport { createRovingFocusGroupScope } from '../react-roving-focus';\nimport { Presence } from '../react-presence';\nimport { Primitive } from '../react-primitive';\nimport * as RovingFocusGroup from '../react-roving-focus';\nimport { useDirection } from '../react-direction';\nimport { useControllableState } from '../react-use-controllable-state';\nimport { useId } from '../react-id';\n\nimport type { Scope } from '../react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * Tabs\n * -----------------------------------------------------------------------------------------------*/\n\nconst TABS_NAME = 'Tabs';\n\ntype ScopedProps<P> = P & { __scopeTabs?: Scope };\nconst [createTabsContext, createTabsScope] = createContextScope(TABS_NAME, [\n createRovingFocusGroupScope,\n]);\nconst useRovingFocusGroupScope = createRovingFocusGroupScope();\n\ntype TabsContextValue = {\n baseId: string;\n value: string;\n onValueChange: (value: string) => void;\n orientation?: TabsProps['orientation'];\n dir?: TabsProps['dir'];\n activationMode?: TabsProps['activationMode'];\n};\n\nconst [TabsProvider, useTabsContext] = createTabsContext<TabsContextValue>(TABS_NAME);\n\ntype TabsElement = React.ComponentRef<typeof Primitive.div>;\ntype RovingFocusGroupProps = React.ComponentPropsWithoutRef<typeof RovingFocusGroup.Root>;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface TabsProps extends PrimitiveDivProps {\n /** The value for the selected tab, if controlled */\n value?: string;\n /** The value of the tab to select by default, if uncontrolled */\n defaultValue?: string;\n /** A function called when a new tab is selected */\n onValueChange?: (value: string) => void;\n /**\n * The orientation the tabs are layed out.\n * Mainly so arrow navigation is done accordingly (left & right vs. up & down)\n * @defaultValue horizontal\n */\n orientation?: RovingFocusGroupProps['orientation'];\n /**\n * The direction of navigation between toolbar items.\n */\n dir?: RovingFocusGroupProps['dir'];\n /**\n * Whether a tab is activated automatically or manually.\n * @defaultValue automatic\n * */\n activationMode?: 'automatic' | 'manual';\n}\n\nconst Tabs = /* @__PURE__ */ React.forwardRef<TabsElement, TabsProps>(\n // blank line to reduce diff noise\n function Tabs(props: ScopedProps<TabsProps>, forwardedRef) {\n const {\n __scopeTabs,\n value: valueProp,\n onValueChange,\n defaultValue,\n orientation = 'horizontal',\n dir,\n activationMode = 'automatic',\n ...tabsProps\n } = props;\n const direction = useDirection(dir);\n const [value, setValue] = useControllableState({\n prop: valueProp,\n onChange: onValueChange,\n defaultProp: defaultValue ?? '',\n caller: TABS_NAME,\n });\n\n return (\n <TabsProvider\n scope={__scopeTabs}\n baseId={useId()}\n value={value}\n onValueChange={setValue}\n orientation={orientation}\n dir={direction}\n activationMode={activationMode}\n >\n <Primitive.div\n dir={direction}\n data-orientation={orientation}\n {...tabsProps}\n ref={forwardedRef}\n />\n </TabsProvider>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * TabsList\n * -----------------------------------------------------------------------------------------------*/\n\nconst TAB_LIST_NAME = 'TabsList';\n\ntype TabsListElement = React.ComponentRef<typeof Primitive.div>;\ninterface TabsListProps extends PrimitiveDivProps {\n loop?: RovingFocusGroupProps['loop'];\n}\n\nconst TabsList = /* @__PURE__ */ React.forwardRef<TabsListElement, TabsListProps>(\n // blank line to reduce diff noise\n function TabsList(props: ScopedProps<TabsListProps>, forwardedRef) {\n const { __scopeTabs, loop = true, ...listProps } = props;\n const context = useTabsContext(TAB_LIST_NAME, __scopeTabs);\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeTabs);\n return (\n <RovingFocusGroup.Root\n asChild\n {...rovingFocusGroupScope}\n orientation={context.orientation}\n dir={context.dir}\n loop={loop}\n >\n <Primitive.div\n role=\"tablist\"\n aria-orientation={context.orientation}\n {...listProps}\n ref={forwardedRef}\n />\n </RovingFocusGroup.Root>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * TabsTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'TabsTrigger';\n\ntype TabsTriggerElement = React.ComponentRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface TabsTriggerProps extends PrimitiveButtonProps {\n value: string;\n}\n\nconst TabsTrigger = /* @__PURE__ */ React.forwardRef<TabsTriggerElement, TabsTriggerProps>(\n function TabsTrigger(props: ScopedProps<TabsTriggerProps>, forwardedRef) {\n const { __scopeTabs, value, disabled = false, ...triggerProps } = props;\n const context = useTabsContext(TRIGGER_NAME, __scopeTabs);\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeTabs);\n const triggerId = makeTriggerId(context.baseId, value);\n const contentId = makeContentId(context.baseId, value);\n const isSelected = value === context.value;\n return (\n <RovingFocusGroup.Item\n asChild\n {...rovingFocusGroupScope}\n focusable={!disabled}\n active={isSelected}\n >\n <Primitive.button\n type=\"button\"\n role=\"tab\"\n aria-selected={isSelected}\n aria-controls={contentId}\n data-state={isSelected ? 'active' : 'inactive'}\n data-disabled={disabled ? '' : undefined}\n disabled={disabled}\n id={triggerId}\n {...triggerProps}\n ref={forwardedRef}\n onMouseDown={composeEventHandlers(props.onMouseDown, (event) => {\n // only call handler if it's the left button (mousedown gets triggered by all mouse buttons)\n // but not when the control key is pressed (avoiding MacOS right click)\n if (!disabled && event.button === 0 && event.ctrlKey === false) {\n context.onValueChange(value);\n } else {\n // prevent focus to avoid accidental activation\n event.preventDefault();\n }\n })}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n // Only react to keys originating from the trigger itself. Focusable\n // descendants (eg. content portaled out of the trigger's DOM\n // subtree) bubble their key events here through React's event\n // system.\n // See: https://github.com/radix-ui/primitives/issues/3232\n if (disabled || event.target !== event.currentTarget) {\n return;\n }\n\n if ([' ', 'Enter'].includes(event.key)) {\n context.onValueChange(value);\n }\n })}\n onFocus={composeEventHandlers(props.onFocus, () => {\n // handle \"automatic\" activation if necessary\n // ie. activate tab following focus\n const isAutomaticActivation = context.activationMode !== 'manual';\n if (!isSelected && !disabled && isAutomaticActivation) {\n context.onValueChange(value);\n }\n })}\n />\n </RovingFocusGroup.Item>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * TabsContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'TabsContent';\n\ntype TabsContentElement = React.ComponentRef<typeof Primitive.div>;\ninterface TabsContentProps extends PrimitiveDivProps {\n value: string;\n\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst TabsContent = /* @__PURE__ */ React.forwardRef<TabsContentElement, TabsContentProps>(\n function TabsContent(props: ScopedProps<TabsContentProps>, forwardedRef) {\n const { __scopeTabs, value, forceMount, children, ...contentProps } = props;\n const context = useTabsContext(CONTENT_NAME, __scopeTabs);\n const triggerId = makeTriggerId(context.baseId, value);\n const contentId = makeContentId(context.baseId, value);\n const isSelected = value === context.value;\n const isMountAnimationPreventedRef = React.useRef(isSelected);\n\n React.useEffect(() => {\n const rAF = requestAnimationFrame(() => (isMountAnimationPreventedRef.current = false));\n return () => cancelAnimationFrame(rAF);\n }, []);\n\n return (\n <Presence present={forceMount || isSelected}>\n {({ present }) => (\n <Primitive.div\n data-state={isSelected ? 'active' : 'inactive'}\n data-orientation={context.orientation}\n role=\"tabpanel\"\n aria-labelledby={triggerId}\n hidden={!present}\n id={contentId}\n tabIndex={0}\n {...contentProps}\n ref={forwardedRef}\n style={{\n ...props.style,\n animationDuration: isMountAnimationPreventedRef.current ? '0s' : undefined,\n }}\n >\n {present && children}\n </Primitive.div>\n )}\n </Presence>\n );\n },\n);\n\n/* ---------------------------------------------------------------------------------------------- */\n\nfunction makeTriggerId(baseId: string, value: string) {\n return `${baseId}-trigger-${value}`;\n}\n\nfunction makeContentId(baseId: string, value: string) {\n return `${baseId}-content-${value}`;\n}\n\nconst Root = Tabs;\nconst List = TabsList;\nconst Trigger = TabsTrigger;\nconst Content = TabsContent;\n\nexport {\n createTabsScope,\n //\n Tabs,\n TabsList,\n TabsTrigger,\n TabsContent,\n //\n Root,\n List,\n Trigger,\n Content,\n};\nexport type { TabsProps, TabsListProps, TabsTriggerProps, TabsContentProps };\n"],"mappings":"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"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { createToastScope, ToastProvider, ToastViewport, Toast, ToastTitle, ToastDescription, ToastAction, ToastClose, Provider, Viewport, Root, Title, Description, Action, Close, } from './toast';
|
|
2
|
+
export type { ToastProviderProps, ToastViewportProps, ToastProps, ToastTitleProps, ToastDescriptionProps, ToastActionProps, ToastCloseProps, } from './toast';
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as DismissableLayer from '../react-dismissable-layer';
|
|
3
|
+
import { Primitive } from '../react-primitive';
|
|
4
|
+
type SwipeDirection = 'up' | 'down' | 'left' | 'right';
|
|
5
|
+
declare const createToastScope: import("../react-context").CreateScope;
|
|
6
|
+
interface ToastProviderProps {
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* An author-localized label for each toast. Used to help screen reader users
|
|
10
|
+
* associate the interruption with a toast.
|
|
11
|
+
* @defaultValue 'Notification'
|
|
12
|
+
*/
|
|
13
|
+
label?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Time in milliseconds that each toast should remain visible for.
|
|
16
|
+
* @defaultValue 5000
|
|
17
|
+
*/
|
|
18
|
+
duration?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Direction of pointer swipe that should close the toast.
|
|
21
|
+
* @defaultValue 'right'
|
|
22
|
+
*/
|
|
23
|
+
swipeDirection?: SwipeDirection;
|
|
24
|
+
/**
|
|
25
|
+
* Distance in pixels that the swipe must pass before a close is triggered.
|
|
26
|
+
* @defaultValue 50
|
|
27
|
+
*/
|
|
28
|
+
swipeThreshold?: number;
|
|
29
|
+
/**
|
|
30
|
+
* An optional container where the toast announcements should be appended.
|
|
31
|
+
* This is useful when working with focus traps or modal dialogs that make
|
|
32
|
+
* other elements inert.
|
|
33
|
+
* @defaultValue document.body
|
|
34
|
+
*/
|
|
35
|
+
announcerContainer?: Element | DocumentFragment;
|
|
36
|
+
}
|
|
37
|
+
declare const ToastProvider: React.FC<ToastProviderProps>;
|
|
38
|
+
type PrimitiveOrderedListProps = React.ComponentPropsWithoutRef<typeof Primitive.ol>;
|
|
39
|
+
interface ToastViewportProps extends PrimitiveOrderedListProps {
|
|
40
|
+
/**
|
|
41
|
+
* The keys to use as the keyboard shortcut that will move focus to the toast viewport.
|
|
42
|
+
* @defaultValue ['F8']
|
|
43
|
+
*/
|
|
44
|
+
hotkey?: string[];
|
|
45
|
+
/**
|
|
46
|
+
* An author-localized label for the toast viewport to provide context for screen reader users
|
|
47
|
+
* when navigating page landmarks. The available `{hotkey}` placeholder will be replaced for you.
|
|
48
|
+
* @defaultValue 'Notifications ({hotkey})'
|
|
49
|
+
*/
|
|
50
|
+
label?: string;
|
|
51
|
+
}
|
|
52
|
+
declare const ToastViewport: React.ForwardRefExoticComponent<ToastViewportProps & React.RefAttributes<HTMLOListElement>>;
|
|
53
|
+
type ToastElement = ToastImplElement;
|
|
54
|
+
interface ToastProps extends Omit<ToastImplProps, keyof ToastImplPrivateProps> {
|
|
55
|
+
open?: boolean;
|
|
56
|
+
defaultOpen?: boolean;
|
|
57
|
+
onOpenChange?(open: boolean): void;
|
|
58
|
+
/**
|
|
59
|
+
* Used to force mounting when more control is needed. Useful when
|
|
60
|
+
* controlling animation with React animation libraries.
|
|
61
|
+
*/
|
|
62
|
+
forceMount?: true;
|
|
63
|
+
}
|
|
64
|
+
declare const Toast: React.ForwardRefExoticComponent<ToastProps & React.RefAttributes<HTMLLIElement>>;
|
|
65
|
+
type SwipeEvent = {
|
|
66
|
+
currentTarget: EventTarget & ToastElement;
|
|
67
|
+
} & Omit<CustomEvent<{
|
|
68
|
+
originalEvent: React.PointerEvent;
|
|
69
|
+
delta: {
|
|
70
|
+
x: number;
|
|
71
|
+
y: number;
|
|
72
|
+
};
|
|
73
|
+
}>, 'currentTarget'>;
|
|
74
|
+
type ToastImplElement = React.ComponentRef<typeof Primitive.li>;
|
|
75
|
+
type DismissableLayerProps = React.ComponentPropsWithoutRef<typeof DismissableLayer.Root>;
|
|
76
|
+
type ToastImplPrivateProps = {
|
|
77
|
+
open: boolean;
|
|
78
|
+
onClose(): void;
|
|
79
|
+
};
|
|
80
|
+
type PrimitiveListItemProps = React.ComponentPropsWithoutRef<typeof Primitive.li>;
|
|
81
|
+
interface ToastImplProps extends ToastImplPrivateProps, PrimitiveListItemProps {
|
|
82
|
+
type?: 'foreground' | 'background';
|
|
83
|
+
/**
|
|
84
|
+
* Time in milliseconds that toast should remain visible for. Overrides value
|
|
85
|
+
* given to `ToastProvider`.
|
|
86
|
+
*/
|
|
87
|
+
duration?: number;
|
|
88
|
+
onEscapeKeyDown?: DismissableLayerProps['onEscapeKeyDown'];
|
|
89
|
+
onPause?(): void;
|
|
90
|
+
onResume?(): void;
|
|
91
|
+
onSwipeStart?(event: SwipeEvent): void;
|
|
92
|
+
onSwipeMove?(event: SwipeEvent): void;
|
|
93
|
+
onSwipeCancel?(event: SwipeEvent): void;
|
|
94
|
+
onSwipeEnd?(event: SwipeEvent): void;
|
|
95
|
+
}
|
|
96
|
+
type PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;
|
|
97
|
+
interface ToastTitleProps extends PrimitiveDivProps {
|
|
98
|
+
}
|
|
99
|
+
declare const ToastTitle: React.ForwardRefExoticComponent<ToastTitleProps & React.RefAttributes<HTMLDivElement>>;
|
|
100
|
+
interface ToastDescriptionProps extends PrimitiveDivProps {
|
|
101
|
+
}
|
|
102
|
+
declare const ToastDescription: React.ForwardRefExoticComponent<ToastDescriptionProps & React.RefAttributes<HTMLDivElement>>;
|
|
103
|
+
interface ToastActionProps extends ToastCloseProps {
|
|
104
|
+
/**
|
|
105
|
+
* A short description for an alternate way to carry out the action. For screen reader users
|
|
106
|
+
* who will not be able to navigate to the button easily/quickly.
|
|
107
|
+
* @example <ToastAction altText="Goto account settings to upgrade">Upgrade</ToastAction>
|
|
108
|
+
* @example <ToastAction altText="Undo (Alt+U)">Undo</ToastAction>
|
|
109
|
+
*/
|
|
110
|
+
altText: string;
|
|
111
|
+
}
|
|
112
|
+
declare const ToastAction: React.ForwardRefExoticComponent<ToastActionProps & React.RefAttributes<HTMLButtonElement>>;
|
|
113
|
+
type PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;
|
|
114
|
+
interface ToastCloseProps extends PrimitiveButtonProps {
|
|
115
|
+
}
|
|
116
|
+
declare const ToastClose: React.ForwardRefExoticComponent<ToastCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
117
|
+
declare const Provider: React.FC<ToastProviderProps>;
|
|
118
|
+
declare const Viewport: React.ForwardRefExoticComponent<ToastViewportProps & React.RefAttributes<HTMLOListElement>>;
|
|
119
|
+
declare const Root: React.ForwardRefExoticComponent<ToastProps & React.RefAttributes<HTMLLIElement>>;
|
|
120
|
+
declare const Title: React.ForwardRefExoticComponent<ToastTitleProps & React.RefAttributes<HTMLDivElement>>;
|
|
121
|
+
declare const Description: React.ForwardRefExoticComponent<ToastDescriptionProps & React.RefAttributes<HTMLDivElement>>;
|
|
122
|
+
declare const Action: React.ForwardRefExoticComponent<ToastActionProps & React.RefAttributes<HTMLButtonElement>>;
|
|
123
|
+
declare const Close: React.ForwardRefExoticComponent<ToastCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
124
|
+
export { createToastScope, ToastProvider, ToastViewport, Toast, ToastTitle, ToastDescription, ToastAction, ToastClose, Provider, Viewport, Root, Title, Description, Action, Close, };
|
|
125
|
+
export type { ToastProviderProps, ToastViewportProps, ToastProps, ToastTitleProps, ToastDescriptionProps, ToastActionProps, ToastCloseProps, };
|