@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
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import { DropdownMenu as DropdownMenuPrimitive } from 'radix-ui';
|
|
2
1
|
import * as React from 'react';
|
|
2
|
+
import * as DropdownMenuPrimitive from '../primitives/vendor/radix/react-dropdown-menu';
|
|
3
3
|
declare function DropdownMenu(props: React.ComponentProps<typeof DropdownMenuPrimitive.Root>): React.JSX.Element;
|
|
4
|
-
declare
|
|
4
|
+
declare const DropdownMenuTrigger: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
5
5
|
declare function DropdownMenuGroup(props: React.ComponentProps<typeof DropdownMenuPrimitive.Group>): React.JSX.Element;
|
|
6
|
-
declare
|
|
7
|
-
|
|
6
|
+
declare const DropdownMenuContent: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export interface DropdownMenuItemProps extends React.ComponentProps<typeof DropdownMenuPrimitive.Item> {
|
|
8
8
|
inset?: boolean;
|
|
9
9
|
variant?: 'default' | 'destructive';
|
|
10
|
-
}
|
|
11
|
-
declare
|
|
10
|
+
}
|
|
11
|
+
declare const DropdownMenuItem: React.ForwardRefExoticComponent<Omit<DropdownMenuItemProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
declare const DropdownMenuCheckboxItem: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuCheckboxItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
13
|
declare function DropdownMenuRadioGroup(props: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>): React.JSX.Element;
|
|
13
|
-
declare
|
|
14
|
-
declare
|
|
14
|
+
declare const DropdownMenuRadioItem: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuRadioItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
+
declare const DropdownMenuLabel: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuLabelProps & React.RefAttributes<HTMLDivElement> & {
|
|
15
16
|
inset?: boolean;
|
|
16
|
-
}
|
|
17
|
-
declare
|
|
18
|
-
declare
|
|
17
|
+
}, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
18
|
+
declare const DropdownMenuSeparator: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
declare const DropdownMenuShortcut: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
19
20
|
declare function DropdownMenuSub(props: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>): React.JSX.Element;
|
|
20
|
-
declare
|
|
21
|
+
declare const DropdownMenuSubTrigger: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSubTriggerProps & React.RefAttributes<HTMLDivElement> & {
|
|
21
22
|
inset?: boolean;
|
|
22
|
-
}
|
|
23
|
-
declare
|
|
23
|
+
}, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
24
|
+
declare const DropdownMenuSubContent: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSubContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
24
25
|
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, };
|
|
@@ -1,108 +1,118 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { cn } from "../lib/utils.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import "react";
|
|
3
|
+
import { CheckboxItem, Content, Group, Item, ItemIndicator, Label, Portal, RadioGroup, RadioItem, Root, Separator, Sub, SubContent, SubTrigger, Trigger } from "../primitives/vendor/radix/react-dropdown-menu/dropdown-menu.js";
|
|
4
|
+
import { menuItemClasses, menuLabelClasses, surfaceClasses } from "./popover.js";
|
|
5
|
+
import * as React from "react";
|
|
5
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
7
|
import ChevronRight from "@burtson-labs/icons/react/chevron-right";
|
|
7
8
|
import Check from "@burtson-labs/icons/react/check";
|
|
8
9
|
//#region src/components/dropdown-menu.tsx
|
|
9
|
-
function DropdownMenu
|
|
10
|
-
return /* @__PURE__ */ jsx(
|
|
10
|
+
function DropdownMenu(props) {
|
|
11
|
+
return /* @__PURE__ */ jsx(Root, {
|
|
11
12
|
"data-slot": "dropdown-menu",
|
|
12
13
|
...props
|
|
13
14
|
});
|
|
14
15
|
}
|
|
15
|
-
function DropdownMenuTrigger(props) {
|
|
16
|
-
return /* @__PURE__ */ jsx(
|
|
16
|
+
var DropdownMenuTrigger = React.forwardRef(function DropdownMenuTrigger(props, ref) {
|
|
17
|
+
return /* @__PURE__ */ jsx(Trigger, {
|
|
18
|
+
ref,
|
|
17
19
|
"data-slot": "dropdown-menu-trigger",
|
|
18
20
|
...props
|
|
19
21
|
});
|
|
20
|
-
}
|
|
22
|
+
});
|
|
21
23
|
function DropdownMenuGroup(props) {
|
|
22
|
-
return /* @__PURE__ */ jsx(
|
|
24
|
+
return /* @__PURE__ */ jsx(Group, {
|
|
23
25
|
"data-slot": "dropdown-menu-group",
|
|
24
26
|
...props
|
|
25
27
|
});
|
|
26
28
|
}
|
|
27
|
-
function DropdownMenuContent({ className, sideOffset = 4, ...props }) {
|
|
28
|
-
return /* @__PURE__ */ jsx(
|
|
29
|
+
var DropdownMenuContent = React.forwardRef(function DropdownMenuContent({ className, sideOffset = 4, ...props }, ref) {
|
|
30
|
+
return /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Content, {
|
|
31
|
+
ref,
|
|
29
32
|
"data-slot": "dropdown-menu-content",
|
|
30
33
|
sideOffset,
|
|
31
34
|
className: cn(surfaceClasses, "max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto p-1", className),
|
|
32
35
|
...props
|
|
33
36
|
}) });
|
|
34
|
-
}
|
|
35
|
-
function DropdownMenuItem({ className, inset, variant = "default", ...props }) {
|
|
36
|
-
return /* @__PURE__ */ jsx(
|
|
37
|
+
});
|
|
38
|
+
var DropdownMenuItem = React.forwardRef(function DropdownMenuItem({ className, inset, variant = "default", ...props }, ref) {
|
|
39
|
+
return /* @__PURE__ */ jsx(Item, {
|
|
40
|
+
ref,
|
|
37
41
|
"data-slot": "dropdown-menu-item",
|
|
38
42
|
"data-inset": inset || void 0,
|
|
39
43
|
"data-variant": variant,
|
|
40
44
|
className: cn(menuItemClasses, "data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:*:[svg]:!text-destructive", className),
|
|
41
45
|
...props
|
|
42
46
|
});
|
|
43
|
-
}
|
|
44
|
-
function DropdownMenuCheckboxItem({ className, children, checked, ...props }) {
|
|
45
|
-
return /* @__PURE__ */ jsxs(
|
|
47
|
+
});
|
|
48
|
+
var DropdownMenuCheckboxItem = React.forwardRef(function DropdownMenuCheckboxItem({ className, children, checked, ...props }, ref) {
|
|
49
|
+
return /* @__PURE__ */ jsxs(CheckboxItem, {
|
|
50
|
+
ref,
|
|
46
51
|
"data-slot": "dropdown-menu-checkbox-item",
|
|
47
52
|
className: cn(menuItemClasses, "pl-8", className),
|
|
48
53
|
checked,
|
|
49
54
|
...props,
|
|
50
55
|
children: [/* @__PURE__ */ jsx("span", {
|
|
51
56
|
className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",
|
|
52
|
-
children: /* @__PURE__ */ jsx(
|
|
57
|
+
children: /* @__PURE__ */ jsx(ItemIndicator, { children: /* @__PURE__ */ jsx(Check, {
|
|
53
58
|
className: "size-4 text-foreground",
|
|
54
59
|
"aria-hidden": true
|
|
55
60
|
}) })
|
|
56
61
|
}), children]
|
|
57
62
|
});
|
|
58
|
-
}
|
|
63
|
+
});
|
|
59
64
|
function DropdownMenuRadioGroup(props) {
|
|
60
|
-
return /* @__PURE__ */ jsx(
|
|
65
|
+
return /* @__PURE__ */ jsx(RadioGroup, {
|
|
61
66
|
"data-slot": "dropdown-menu-radio-group",
|
|
62
67
|
...props
|
|
63
68
|
});
|
|
64
69
|
}
|
|
65
|
-
function DropdownMenuRadioItem({ className, children, ...props }) {
|
|
66
|
-
return /* @__PURE__ */ jsxs(
|
|
70
|
+
var DropdownMenuRadioItem = React.forwardRef(function DropdownMenuRadioItem({ className, children, ...props }, ref) {
|
|
71
|
+
return /* @__PURE__ */ jsxs(RadioItem, {
|
|
72
|
+
ref,
|
|
67
73
|
"data-slot": "dropdown-menu-radio-item",
|
|
68
74
|
className: cn(menuItemClasses, "pl-8", className),
|
|
69
75
|
...props,
|
|
70
76
|
children: [/* @__PURE__ */ jsx("span", {
|
|
71
77
|
className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",
|
|
72
|
-
children: /* @__PURE__ */ jsx(
|
|
78
|
+
children: /* @__PURE__ */ jsx(ItemIndicator, { children: /* @__PURE__ */ jsx("span", { className: "block size-2 rounded-full bg-foreground" }) })
|
|
73
79
|
}), children]
|
|
74
80
|
});
|
|
75
|
-
}
|
|
76
|
-
function DropdownMenuLabel({ className, inset, ...props }) {
|
|
77
|
-
return /* @__PURE__ */ jsx(
|
|
81
|
+
});
|
|
82
|
+
var DropdownMenuLabel = React.forwardRef(function DropdownMenuLabel({ className, inset, ...props }, ref) {
|
|
83
|
+
return /* @__PURE__ */ jsx(Label, {
|
|
84
|
+
ref,
|
|
78
85
|
"data-slot": "dropdown-menu-label",
|
|
79
86
|
"data-inset": inset || void 0,
|
|
80
|
-
className: cn("
|
|
87
|
+
className: cn(menuLabelClasses, "data-[inset]:pl-8", className),
|
|
81
88
|
...props
|
|
82
89
|
});
|
|
83
|
-
}
|
|
84
|
-
function DropdownMenuSeparator({ className, ...props }) {
|
|
85
|
-
return /* @__PURE__ */ jsx(
|
|
90
|
+
});
|
|
91
|
+
var DropdownMenuSeparator = React.forwardRef(function DropdownMenuSeparator({ className, ...props }, ref) {
|
|
92
|
+
return /* @__PURE__ */ jsx(Separator, {
|
|
93
|
+
ref,
|
|
86
94
|
"data-slot": "dropdown-menu-separator",
|
|
87
95
|
className: cn("-mx-1 my-1 h-px bg-border", className),
|
|
88
96
|
...props
|
|
89
97
|
});
|
|
90
|
-
}
|
|
91
|
-
function DropdownMenuShortcut({ className, ...props }) {
|
|
98
|
+
});
|
|
99
|
+
var DropdownMenuShortcut = React.forwardRef(function DropdownMenuShortcut({ className, ...props }, ref) {
|
|
92
100
|
return /* @__PURE__ */ jsx("span", {
|
|
101
|
+
ref,
|
|
93
102
|
"data-slot": "dropdown-menu-shortcut",
|
|
94
103
|
className: cn("ml-auto text-xs tracking-widest text-muted-foreground", className),
|
|
95
104
|
...props
|
|
96
105
|
});
|
|
97
|
-
}
|
|
106
|
+
});
|
|
98
107
|
function DropdownMenuSub(props) {
|
|
99
|
-
return /* @__PURE__ */ jsx(
|
|
108
|
+
return /* @__PURE__ */ jsx(Sub, {
|
|
100
109
|
"data-slot": "dropdown-menu-sub",
|
|
101
110
|
...props
|
|
102
111
|
});
|
|
103
112
|
}
|
|
104
|
-
function DropdownMenuSubTrigger({ className, inset, children, ...props }) {
|
|
105
|
-
return /* @__PURE__ */ jsxs(
|
|
113
|
+
var DropdownMenuSubTrigger = React.forwardRef(function DropdownMenuSubTrigger({ className, inset, children, ...props }, ref) {
|
|
114
|
+
return /* @__PURE__ */ jsxs(SubTrigger, {
|
|
115
|
+
ref,
|
|
106
116
|
"data-slot": "dropdown-menu-sub-trigger",
|
|
107
117
|
"data-inset": inset || void 0,
|
|
108
118
|
className: cn(menuItemClasses, "data-[state=open]:bg-secondary", className),
|
|
@@ -112,15 +122,16 @@ function DropdownMenuSubTrigger({ className, inset, children, ...props }) {
|
|
|
112
122
|
"aria-hidden": true
|
|
113
123
|
})]
|
|
114
124
|
});
|
|
115
|
-
}
|
|
116
|
-
function DropdownMenuSubContent({ className, ...props }) {
|
|
117
|
-
return /* @__PURE__ */ jsx(
|
|
125
|
+
});
|
|
126
|
+
var DropdownMenuSubContent = React.forwardRef(function DropdownMenuSubContent({ className, ...props }, ref) {
|
|
127
|
+
return /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(SubContent, {
|
|
128
|
+
ref,
|
|
118
129
|
"data-slot": "dropdown-menu-sub-content",
|
|
119
130
|
className: cn(surfaceClasses, "min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden p-1", className),
|
|
120
131
|
...props
|
|
121
132
|
}) });
|
|
122
|
-
}
|
|
133
|
+
});
|
|
123
134
|
//#endregion
|
|
124
|
-
export { DropdownMenu
|
|
135
|
+
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger };
|
|
125
136
|
|
|
126
137
|
//# sourceMappingURL=dropdown-menu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-menu.js","names":["DropdownMenu","DropdownMenuPrimitive","itemClasses"],"sources":["../../src/components/dropdown-menu.tsx"],"sourcesContent":["import Check from '@burtson-labs/icons/react/check';\nimport ChevronRight from '@burtson-labs/icons/react/chevron-right';\nimport { DropdownMenu as DropdownMenuPrimitive } from 'radix-ui';\nimport * as React from 'react';\n\nimport { cn } from '../lib/utils';\n\nimport { menuItemClasses as itemClasses, surfaceClasses } from './popover';\n\nfunction DropdownMenu(props: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {\n return <DropdownMenuPrimitive.Root data-slot=\"dropdown-menu\" {...props} />;\n}\n\nfunction DropdownMenuTrigger(props: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {\n return <DropdownMenuPrimitive.Trigger data-slot=\"dropdown-menu-trigger\" {...props} />;\n}\n\nfunction DropdownMenuGroup(props: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {\n return <DropdownMenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props} />;\n}\n\nfunction DropdownMenuContent({\n className,\n sideOffset = 4,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {\n return (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n data-slot=\"dropdown-menu-content\"\n sideOffset={sideOffset}\n className={cn(\n surfaceClasses,\n 'max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto p-1',\n className,\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n );\n}\n\nfunction DropdownMenuItem({\n className,\n inset,\n variant = 'default',\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean;\n variant?: 'default' | 'destructive';\n}) {\n return (\n <DropdownMenuPrimitive.Item\n data-slot=\"dropdown-menu-item\"\n data-inset={inset || undefined}\n data-variant={variant}\n className={cn(\n itemClasses,\n 'data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:*:[svg]:!text-destructive',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction DropdownMenuCheckboxItem({\n className,\n children,\n checked,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {\n return (\n <DropdownMenuPrimitive.CheckboxItem\n data-slot=\"dropdown-menu-checkbox-item\"\n className={cn(itemClasses, 'pl-8', className)}\n checked={checked}\n {...props}\n >\n <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Check className=\"size-4 text-foreground\" aria-hidden />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n );\n}\n\nfunction DropdownMenuRadioGroup(\n props: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>,\n) {\n return <DropdownMenuPrimitive.RadioGroup data-slot=\"dropdown-menu-radio-group\" {...props} />;\n}\n\nfunction DropdownMenuRadioItem({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {\n return (\n <DropdownMenuPrimitive.RadioItem\n data-slot=\"dropdown-menu-radio-item\"\n className={cn(itemClasses, 'pl-8', className)}\n {...props}\n >\n <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <span className=\"block size-2 rounded-full bg-foreground\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n );\n}\n\nfunction DropdownMenuLabel({\n className,\n inset,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & { inset?: boolean }) {\n return (\n <DropdownMenuPrimitive.Label\n data-slot=\"dropdown-menu-label\"\n data-inset={inset || undefined}\n className={cn(\n 'px-2 pt-2 pb-1 text-[11px] font-semibold tracking-[0.08em] text-muted-foreground uppercase data-[inset]:pl-8',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction DropdownMenuSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {\n return (\n <DropdownMenuPrimitive.Separator\n data-slot=\"dropdown-menu-separator\"\n className={cn('-mx-1 my-1 h-px bg-border', className)}\n {...props}\n />\n );\n}\n\nfunction DropdownMenuShortcut({ className, ...props }: React.ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"dropdown-menu-shortcut\"\n className={cn('ml-auto text-xs tracking-widest text-muted-foreground', className)}\n {...props}\n />\n );\n}\n\nfunction DropdownMenuSub(props: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {\n return <DropdownMenuPrimitive.Sub data-slot=\"dropdown-menu-sub\" {...props} />;\n}\n\nfunction DropdownMenuSubTrigger({\n className,\n inset,\n children,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & { inset?: boolean }) {\n return (\n <DropdownMenuPrimitive.SubTrigger\n data-slot=\"dropdown-menu-sub-trigger\"\n data-inset={inset || undefined}\n className={cn(itemClasses, 'data-[state=open]:bg-secondary', className)}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto size-4\" aria-hidden />\n </DropdownMenuPrimitive.SubTrigger>\n );\n}\n\nfunction DropdownMenuSubContent({\n className,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {\n return (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.SubContent\n data-slot=\"dropdown-menu-sub-content\"\n className={cn(\n surfaceClasses,\n 'min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden p-1',\n className,\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n );\n}\n\nexport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n};\n"],"mappings":";;;;;;;;AASA,SAASA,eAAa,OAAgE;CACpF,OAAO,oBAACC,aAAsB,MAAvB;EAA4B,aAAU;EAAgB,GAAI;CAAQ,CAAA;AAC3E;AAEA,SAAS,oBAAoB,OAAmE;CAC9F,OAAO,oBAACA,aAAsB,SAAvB;EAA+B,aAAU;EAAwB,GAAI;CAAQ,CAAA;AACtF;AAEA,SAAS,kBAAkB,OAAiE;CAC1F,OAAO,oBAACA,aAAsB,OAAvB;EAA6B,aAAU;EAAsB,GAAI;CAAQ,CAAA;AAClF;AAEA,SAAS,oBAAoB,EAC3B,W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AY,SAAS,KAAA;EACrB,WAAW,GACT,gHACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,sBAAsB,EAC7B,WACA,GAAG,SAC4D;CAC/D,OACE,oBAACA,aAAsB,WAAvB;EACE,aAAU;EACV,WAAW,GAAG,6BAA6B,SAAS;EACpD,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,qBAAqB,EAAE,WAAW,GAAG,SAAuC;CACnF,OACE,oBAAC,QAAD;EACE,aAAU;EACV,WAAW,GAAG,yDAAyD,SAAS;EAChF,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,gBAAgB,OAA+D;CACtF,OAAO,oBAACA,aAAsB,KAAvB;EAA2B,aAAU;EAAoB,GAAI;CAAQ,CAAA;AAC9E;AAEA,SAAS,uBAAuB,EAC9B,WACA,OACA,UACA,GAAG,SACmF;CACtF,OACE,qBAACA,aAAsB,YAAvB;EACE,aAAU;EACV,cAAY,SAAS,KAAA;EACrB,WAAW,GAAGC,iBAAa,kCAAkC,SAAS;EACtE,GAAI;EAJN,UAAA,CAMG,UACD,oBAAC,cAAD;GAAc,WAAU;GAAiB,eAAA;EAAa,CAAA,CACtB;;AAEtC;AAEA,SAAS,uBAAuB,EAC9B,WACA,GAAG,SAC6D;CAChE,OACE,oBAACD,aAAsB,QAAvB,EAAA,UACE,oBAACA,aAAsB,YAAvB;EACE,aAAU;EACV,WAAW,GACT,gBACA,4FACA,SACF;EACA,GAAI;CACL,CAAA,EAC2B,CAAA;AAElC"}
|
|
1
|
+
{"version":3,"file":"dropdown-menu.js","names":["DropdownMenuPrimitive.Root","DropdownMenuPrimitive.Trigger","DropdownMenuPrimitive.Group","DropdownMenuPrimitive.Portal","DropdownMenuPrimitive.Content","DropdownMenuPrimitive.Item","itemClasses","DropdownMenuPrimitive.CheckboxItem","DropdownMenuPrimitive.ItemIndicator","DropdownMenuPrimitive.RadioGroup","DropdownMenuPrimitive.RadioItem","DropdownMenuPrimitive.Label","DropdownMenuPrimitive.Separator","DropdownMenuPrimitive.Sub","DropdownMenuPrimitive.SubTrigger","DropdownMenuPrimitive.SubContent"],"sources":["../../src/components/dropdown-menu.tsx"],"sourcesContent":["import Check from '@burtson-labs/icons/react/check';\nimport ChevronRight from '@burtson-labs/icons/react/chevron-right';\nimport * as React from 'react';\n\nimport { cn } from '../lib/utils';\nimport * as DropdownMenuPrimitive from '../primitives/vendor/radix/react-dropdown-menu';\n\nimport { menuItemClasses as itemClasses, menuLabelClasses, surfaceClasses } from './popover';\n\nfunction DropdownMenu(props: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {\n return <DropdownMenuPrimitive.Root data-slot=\"dropdown-menu\" {...props} />;\n}\n\nconst DropdownMenuTrigger = React.forwardRef<\n HTMLButtonElement,\n React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>\n>(function DropdownMenuTrigger(props, ref) {\n return <DropdownMenuPrimitive.Trigger ref={ref} data-slot=\"dropdown-menu-trigger\" {...props} />;\n});\n\nfunction DropdownMenuGroup(props: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {\n return <DropdownMenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props} />;\n}\n\nconst DropdownMenuContent = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<typeof DropdownMenuPrimitive.Content>\n>(function DropdownMenuContent({ className, sideOffset = 4, ...props }, ref) {\n return (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n ref={ref}\n data-slot=\"dropdown-menu-content\"\n sideOffset={sideOffset}\n className={cn(\n surfaceClasses,\n 'max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto p-1',\n className,\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n );\n});\n\nexport interface DropdownMenuItemProps extends React.ComponentProps<\n typeof DropdownMenuPrimitive.Item\n> {\n inset?: boolean;\n variant?: 'default' | 'destructive';\n}\n\nconst DropdownMenuItem = React.forwardRef<HTMLDivElement, DropdownMenuItemProps>(\n function DropdownMenuItem({ className, inset, variant = 'default', ...props }, ref) {\n return (\n <DropdownMenuPrimitive.Item\n ref={ref}\n data-slot=\"dropdown-menu-item\"\n data-inset={inset || undefined}\n data-variant={variant}\n className={cn(\n itemClasses,\n 'data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:*:[svg]:!text-destructive',\n className,\n )}\n {...props}\n />\n );\n },\n);\n\nconst DropdownMenuCheckboxItem = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>\n>(function DropdownMenuCheckboxItem({ className, children, checked, ...props }, ref) {\n return (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n data-slot=\"dropdown-menu-checkbox-item\"\n className={cn(itemClasses, 'pl-8', className)}\n checked={checked}\n {...props}\n >\n <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Check className=\"size-4 text-foreground\" aria-hidden />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n );\n});\n\nfunction DropdownMenuRadioGroup(\n props: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>,\n) {\n return <DropdownMenuPrimitive.RadioGroup data-slot=\"dropdown-menu-radio-group\" {...props} />;\n}\n\nconst DropdownMenuRadioItem = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>\n>(function DropdownMenuRadioItem({ className, children, ...props }, ref) {\n return (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n data-slot=\"dropdown-menu-radio-item\"\n className={cn(itemClasses, 'pl-8', className)}\n {...props}\n >\n <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <span className=\"block size-2 rounded-full bg-foreground\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n );\n});\n\nconst DropdownMenuLabel = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<typeof DropdownMenuPrimitive.Label> & { inset?: boolean }\n>(function DropdownMenuLabel({ className, inset, ...props }, ref) {\n return (\n <DropdownMenuPrimitive.Label\n ref={ref}\n data-slot=\"dropdown-menu-label\"\n data-inset={inset || undefined}\n className={cn(menuLabelClasses, 'data-[inset]:pl-8', className)}\n {...props}\n />\n );\n});\n\nconst DropdownMenuSeparator = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<typeof DropdownMenuPrimitive.Separator>\n>(function DropdownMenuSeparator({ className, ...props }, ref) {\n return (\n <DropdownMenuPrimitive.Separator\n ref={ref}\n data-slot=\"dropdown-menu-separator\"\n className={cn('-mx-1 my-1 h-px bg-border', className)}\n {...props}\n />\n );\n});\n\nconst DropdownMenuShortcut = React.forwardRef<HTMLSpanElement, React.ComponentProps<'span'>>(\n function DropdownMenuShortcut({ className, ...props }, ref) {\n return (\n <span\n ref={ref}\n data-slot=\"dropdown-menu-shortcut\"\n className={cn('ml-auto text-xs tracking-widest text-muted-foreground', className)}\n {...props}\n />\n );\n },\n);\n\nfunction DropdownMenuSub(props: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {\n return <DropdownMenuPrimitive.Sub data-slot=\"dropdown-menu-sub\" {...props} />;\n}\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & { inset?: boolean }\n>(function DropdownMenuSubTrigger({ className, inset, children, ...props }, ref) {\n return (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n data-slot=\"dropdown-menu-sub-trigger\"\n data-inset={inset || undefined}\n className={cn(itemClasses, 'data-[state=open]:bg-secondary', className)}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto size-4\" aria-hidden />\n </DropdownMenuPrimitive.SubTrigger>\n );\n});\n\nconst DropdownMenuSubContent = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>\n>(function DropdownMenuSubContent({ className, ...props }, ref) {\n return (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n data-slot=\"dropdown-menu-sub-content\"\n className={cn(\n surfaceClasses,\n 'min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden p-1',\n className,\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n );\n});\n\nexport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n};\n"],"mappings":";;;;;;;;;AASA,SAAS,aAAa,OAAgE;CACpF,OAAO,oBAACA,MAAD;EAA4B,aAAU;EAAgB,GAAI;CAAQ,CAAA;AAC3E;AAEA,IAAM,sBAAsB,MAAM,WAGhC,SAAS,oBAAoB,OAAO,KAAK;CACzC,OAAO,oBAACC,SAAD;EAAoC;EAAK,aAAU;EAAwB,GAAI;CAAQ,CAAA;AAChG,CAAC;AAED,SAAS,kBAAkB,OAAiE;CAC1F,OAAO,oBAACC,OAAD;EAA6B,aAAU;EAAsB,GAAI;CAAQ,CAAA;AAClF;AAEA,IAAM,sBAAsB,MAAM,WAGhC,SAAS,oBAAoB,EAAE,WAAW,aAAa,GAAG,GAAG,SAAS,KAAK;CAC3E,OACE,oBAACC,QAAD,EAAA,UACE,oBAACC,SAAD;EACO;EACL,aAAU;EACE;EACZ,WAAW,GACT,gBACA,qKACA,SACF;EACA,GAAI;CACL,CAAA,EAC2B,CAAA;AAElC,CAAC;AASD,IAAM,mBAAmB,MAAM,WAC7B,SAAS,iBAAiB,EAAE,WAAW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AAS,sBAAsB,EAAE,WAAW,GAAG,SAAS,KAAK;CAC7D,OACE,oBAACC,WAAD;EACO;EACL,aAAU;EACV,WAAW,GAAG,6BAA6B,SAAS;EACpD,GAAI;CACL,CAAA;AAEL,CAAC;AAED,IAAM,uBAAuB,MAAM,WACjC,SAAS,qBAAqB,EAAE,WAAW,GAAG,SAAS,KAAK;CAC1D,OACE,oBAAC,QAAD;EACO;EACL,aAAU;EACV,WAAW,GAAG,yDAAyD,SAAS;EAChF,GAAI;CACL,CAAA;AAEL,CACF;AAEA,SAAS,gBAAgB,OAA+D;CACtF,OAAO,oBAACC,KAAD;EAA2B,aAAU;EAAoB,GAAI;CAAQ,CAAA;AAC9E;AAEA,IAAM,yBAAyB,MAAM,WAGnC,SAAS,uBAAuB,EAAE,WAAW,OAAO,UAAU,GAAG,SAAS,KAAK;CAC/E,OACE,qBAACC,YAAD;EACO;EACL,aAAU;EACV,cAAY,SAAS,KAAA;EACrB,WAAW,GAAGR,iBAAa,kCAAkC,SAAS;EACtE,GAAI;EALN,UAAA,CAOG,UACD,oBAAC,cAAD;GAAc,WAAU;GAAiB,eAAA;EAAa,CAAA,CACtB;;AAEtC,CAAC;AAED,IAAM,yBAAyB,MAAM,WAGnC,SAAS,uBAAuB,EAAE,WAAW,GAAG,SAAS,KAAK;CAC9D,OACE,oBAACH,QAAD,EAAA,UACE,oBAACY,YAAD;EACO;EACL,aAAU;EACV,WAAW,GACT,gBACA,4FACA,SACF;EACA,GAAI;CACL,CAAA,EAC2B,CAAA;AAElC,CAAC"}
|
|
@@ -43,5 +43,5 @@ export interface EditorTabsProps extends Omit<React.ComponentProps<'div'>, 'chil
|
|
|
43
43
|
* and PageDown move the tab. Middle-click closes. The strip scrolls when the
|
|
44
44
|
* tabs overflow and keeps the active tab in view.
|
|
45
45
|
*/
|
|
46
|
-
declare
|
|
46
|
+
declare const EditorTabs: React.ForwardRefExoticComponent<Omit<EditorTabsProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
47
47
|
export { EditorTabs };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn, focusRingClasses } from "../lib/utils.js";
|
|
2
3
|
import * as React from "react";
|
|
3
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
5
|
import X from "@burtson-labs/icons/react/x";
|
|
@@ -9,7 +10,7 @@ import X from "@burtson-labs/icons/react/x";
|
|
|
9
10
|
* and PageDown move the tab. Middle-click closes. The strip scrolls when the
|
|
10
11
|
* tabs overflow and keeps the active tab in view.
|
|
11
12
|
*/
|
|
12
|
-
function EditorTabs({ tabs, activeId, onActiveChange, onClose, onMove, actions, onTabContextMenu, className, "aria-label": ariaLabel, ...props }) {
|
|
13
|
+
var EditorTabs = React.forwardRef(function EditorTabs({ tabs, activeId, onActiveChange, onClose, onMove, actions, onTabContextMenu, className, "aria-label": ariaLabel, ...props }, ref) {
|
|
13
14
|
const baseId = React.useId();
|
|
14
15
|
const tabRefs = React.useRef(/* @__PURE__ */ new Map());
|
|
15
16
|
const listRef = React.useRef(null);
|
|
@@ -109,6 +110,7 @@ function EditorTabs({ tabs, activeId, onActiveChange, onClose, onMove, actions,
|
|
|
109
110
|
if (handled) event.preventDefault();
|
|
110
111
|
};
|
|
111
112
|
return /* @__PURE__ */ jsxs("div", {
|
|
113
|
+
ref,
|
|
112
114
|
"data-slot": "editor-tabs",
|
|
113
115
|
className: cn("flex h-9 min-w-0 items-stretch border-b bg-surface-muted", className),
|
|
114
116
|
...props,
|
|
@@ -165,7 +167,7 @@ function EditorTabs({ tabs, activeId, onActiveChange, onClose, onMove, actions,
|
|
|
165
167
|
onFocus: () => setFocusedId(tab.id),
|
|
166
168
|
onClick: () => onActiveChange(tab.id),
|
|
167
169
|
onKeyDown: (event) => onKeyDown(event, tab),
|
|
168
|
-
className: cn("flex h-full min-w-0 items-center gap-1.5 ps-3
|
|
170
|
+
className: cn("flex h-full min-w-0 items-center gap-1.5 ps-3", focusRingClasses, "focus-visible:outline-offset-[-2px]", closeable ? "pe-1" : "pe-3"),
|
|
169
171
|
children: [
|
|
170
172
|
tab.icon && /* @__PURE__ */ jsx("span", {
|
|
171
173
|
"aria-hidden": true,
|
|
@@ -193,7 +195,7 @@ function EditorTabs({ tabs, activeId, onActiveChange, onClose, onMove, actions,
|
|
|
193
195
|
"aria-label": `Close ${tab.label}`,
|
|
194
196
|
title: "Close (Delete)",
|
|
195
197
|
onClick: () => onClose?.(tab.id),
|
|
196
|
-
className: "me-1 flex size-5 shrink-0 items-center justify-center rounded-xs text-muted-foreground
|
|
198
|
+
className: cn("me-1 flex size-5 shrink-0 items-center justify-center rounded-xs text-muted-foreground hover:bg-muted hover:text-foreground", focusRingClasses, "focus-visible:outline-offset-[-1px]"),
|
|
197
199
|
children: [tab.dirty && /* @__PURE__ */ jsx("span", {
|
|
198
200
|
"aria-hidden": true,
|
|
199
201
|
className: "size-2 rounded-full bg-foreground/70 group-hover/tab:hidden"
|
|
@@ -214,7 +216,7 @@ function EditorTabs({ tabs, activeId, onActiveChange, onClose, onMove, actions,
|
|
|
214
216
|
children: actions
|
|
215
217
|
})]
|
|
216
218
|
});
|
|
217
|
-
}
|
|
219
|
+
});
|
|
218
220
|
//#endregion
|
|
219
221
|
export { EditorTabs };
|
|
220
222
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-tabs.js","names":[],"sources":["../../src/components/editor-tabs.tsx"],"sourcesContent":["import X from '@burtson-labs/icons/react/x';\nimport * as React from 'react';\n\nimport { cn } from '../lib/utils';\n\nexport interface EditorTab {\n /** Stable identity, usually the file path. */\n id: string;\n label: string;\n /** Full path or context; the tooltip and the accessible description. */\n description?: string;\n icon?: React.ReactNode;\n /** Unsaved changes: a dot replaces the close button until hover. */\n dirty?: boolean;\n /** Default true. */\n closeable?: boolean;\n /** A preview tab that the next opened file replaces; shown in italics. */\n preview?: boolean;\n /** The id of the panel this tab shows, for aria-controls. */\n controls?: string;\n}\n\nexport interface EditorTabsProps extends Omit<\n React.ComponentProps<'div'>,\n 'children' | 'aria-label'\n> {\n tabs: EditorTab[];\n activeId: string | null;\n onActiveChange: (id: string) => void;\n /**\n * A request to close. The component never removes a tab itself: for a dirty\n * tab, ask the person (save, discard, cancel) and then update `tabs`.\n */\n onClose?: (id: string) => void;\n /**\n * Reorder by drag or Ctrl+Shift+PageUp/PageDown. `toIndex` is the new position.\n * Dragging uses pointer events, not HTML5 drag and drop, so it also works in\n * desktop webviews (Tauri, Electron) that intercept native drags.\n */\n onMove?: (id: string, toIndex: number) => void;\n /** Required: e.g. \"Open editors\". */\n 'aria-label': string;\n /** Right-hand slot for split, more and similar buttons. */\n actions?: React.ReactNode;\n /** Right-click on a tab. */\n onTabContextMenu?: (id: string, event: React.MouseEvent) => void;\n}\n\n/**\n * The strip of open files above an editor. One tab stop; Left/Right/Home/End\n * move focus, Enter or Space opens, Delete asks to close, Ctrl+Shift+PageUp\n * and PageDown move the tab. Middle-click closes. The strip scrolls when the\n * tabs overflow and keeps the active tab in view.\n */\nfunction EditorTabs({\n tabs,\n activeId,\n onActiveChange,\n onClose,\n onMove,\n actions,\n onTabContextMenu,\n className,\n 'aria-label': ariaLabel,\n ...props\n}: EditorTabsProps) {\n const baseId = React.useId();\n const tabRefs = React.useRef(new Map<string, HTMLButtonElement>());\n const listRef = React.useRef<HTMLDivElement>(null);\n const [focusedId, setFocusedId] = React.useState<string | null>(null);\n const [dragId, setDragId] = React.useState<string | null>(null);\n // The gap a dragged tab would land in: 0 is before the first tab,\n // tabs.length after the last.\n const [dropGap, setDropGap] = React.useState<number | null>(null);\n // Set once a press becomes a drag, so the click that ends it does nothing.\n const dragged = React.useRef(false);\n const dragCleanup = React.useRef<(() => void) | null>(null);\n React.useEffect(() => () => dragCleanup.current?.(), []);\n const lastIds = React.useRef<string[]>([]);\n const hadFocus = React.useRef(false);\n\n const ids = tabs.map((t) => t.id);\n const idsKey = ids.join('\\u0000');\n const tabStop =\n (focusedId && ids.includes(focusedId) ? focusedId : null) ??\n (activeId && ids.includes(activeId) ? activeId : null) ??\n ids[0] ??\n null;\n\n React.useEffect(() => {\n if (activeId)\n tabRefs.current.get(activeId)?.scrollIntoView?.({ block: 'nearest', inline: 'nearest' });\n }, [activeId]);\n\n // After a close, keep keyboard focus in the strip: the active tab if the\n // app picked one, else the neighbour at the closed tab's position.\n React.useLayoutEffect(() => {\n if (focusedId && !ids.includes(focusedId)) {\n const next =\n (activeId && ids.includes(activeId) ? activeId : null) ??\n ids[Math.min(Math.max(0, lastIds.current.indexOf(focusedId)), ids.length - 1)] ??\n null;\n setFocusedId(next);\n const active = document.activeElement;\n if (next && hadFocus.current && (!active || active === document.body))\n tabRefs.current.get(next)?.focus();\n }\n lastIds.current = ids;\n // ids is derived from tabs each render; idsKey is its stable form.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [focusedId, idsKey, activeId]);\n\n /** Which gap the pointer is over, measured from the rendered tabs. */\n const gapAt = (clientX: number) => {\n const els = Array.from(\n listRef.current?.querySelectorAll<HTMLElement>('[data-slot=\"editor-tab\"]') ?? [],\n );\n const rtl = listRef.current ? getComputedStyle(listRef.current).direction === 'rtl' : false;\n for (let i = 0; i < els.length; i++) {\n const rect = els[i]!.getBoundingClientRect();\n const mid = rect.left + rect.width / 2;\n if (rtl ? clientX > mid : clientX < mid) return i;\n }\n return els.length;\n };\n\n const startDrag = (event: React.PointerEvent, id: string) => {\n if (!onMove || event.button !== 0) return;\n dragCleanup.current?.();\n dragged.current = false;\n const downX = event.clientX;\n const move = (e: PointerEvent) => {\n // A few pixels of slop so an ordinary click is not read as a drag.\n if (!dragged.current && Math.abs(e.clientX - downX) < 4) return;\n if (!dragged.current) {\n dragged.current = true;\n setDragId(id);\n }\n setDropGap(gapAt(e.clientX));\n };\n const stop = (e: PointerEvent | null) => {\n window.removeEventListener('pointermove', move);\n window.removeEventListener('pointerup', up);\n window.removeEventListener('pointercancel', cancel);\n dragCleanup.current = null;\n if (e && dragged.current) {\n const from = lastIds.current.indexOf(id);\n const gap = gapAt(e.clientX);\n const to = gap > from ? gap - 1 : gap;\n if (from !== -1 && to !== from) onMove(id, to);\n }\n setDragId(null);\n setDropGap(null);\n };\n const up = (e: PointerEvent) => stop(e);\n const cancel = () => stop(null);\n window.addEventListener('pointermove', move);\n window.addEventListener('pointerup', up);\n window.addEventListener('pointercancel', cancel);\n dragCleanup.current = () => stop(null);\n };\n\n const focusTab = (id: string | undefined) => {\n if (!id) return;\n setFocusedId(id);\n tabRefs.current.get(id)?.focus();\n };\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>, tab: EditorTab) => {\n const i = ids.indexOf(tab.id);\n const rtl = listRef.current ? getComputedStyle(listRef.current).direction === 'rtl' : false;\n const [prev, next] = rtl ? ['ArrowRight', 'ArrowLeft'] : ['ArrowLeft', 'ArrowRight'];\n let handled = true;\n if (event.ctrlKey && event.shiftKey && (event.key === 'PageUp' || event.key === 'PageDown')) {\n const to = event.key === 'PageUp' ? i - 1 : i + 1;\n if (onMove && to >= 0 && to < ids.length) onMove(tab.id, to);\n } else if (event.key === prev) focusTab(ids[(i - 1 + ids.length) % ids.length]);\n else if (event.key === next) focusTab(ids[(i + 1) % ids.length]);\n else if (event.key === 'Home') focusTab(ids[0]);\n else if (event.key === 'End') focusTab(ids[ids.length - 1]);\n else if (event.key === 'Delete' && tab.closeable !== false && onClose) onClose(tab.id);\n else handled = false;\n if (handled) event.preventDefault();\n };\n\n return (\n <div\n data-slot=\"editor-tabs\"\n className={cn('flex h-9 min-w-0 items-stretch border-b bg-surface-muted', className)}\n {...props}\n >\n <div\n ref={listRef}\n role=\"tablist\"\n aria-label={ariaLabel}\n aria-orientation=\"horizontal\"\n className=\"flex min-w-0 flex-1 items-stretch overflow-x-auto [scrollbar-width:thin]\"\n onFocus={() => (hadFocus.current = true)}\n onBlur={(event) => {\n if (!listRef.current?.contains(event.relatedTarget)) hadFocus.current = false;\n }}\n >\n {tabs.map((tab, i) => {\n const active = tab.id === activeId;\n const closeable = tab.closeable !== false && Boolean(onClose);\n const tabId = `${baseId}-tab-${i}`;\n return (\n <div\n key={tab.id}\n data-slot=\"editor-tab\"\n data-state={active ? 'active' : 'inactive'}\n data-dirty={tab.dirty || undefined}\n data-dragging={dragId === tab.id || undefined}\n data-drop={\n dragId === null\n ? undefined\n : dropGap === i\n ? 'before'\n : dropGap === tabs.length && i === tabs.length - 1\n ? 'after'\n : undefined\n }\n onPointerDown={(event) => startDrag(event, tab.id)}\n onClickCapture={(event) => {\n // Swallow the click that ends a drag.\n if (dragged.current) {\n dragged.current = false;\n event.stopPropagation();\n event.preventDefault();\n }\n }}\n onAuxClick={(event) => {\n if (event.button === 1 && closeable) {\n event.preventDefault();\n onClose?.(tab.id);\n }\n }}\n onContextMenu={\n onTabContextMenu ? (event) => onTabContextMenu(tab.id, event) : undefined\n }\n className={cn(\n 'group/tab relative flex max-w-60 shrink-0 items-center border-e text-[13px] text-muted-foreground',\n 'hover:bg-muted/60 data-[state=active]:bg-background data-[state=active]:text-foreground',\n // The active tab's top edge carries the brand colour.\n 'data-[state=active]:before:absolute data-[state=active]:before:inset-x-0 data-[state=active]:before:top-0 data-[state=active]:before:h-0.5 data-[state=active]:before:bg-brand data-[state=active]:before:content-[\"\"]',\n 'data-[dragging]:opacity-50 data-[dragging]:select-none',\n // Where a dragged tab will land.\n 'data-[drop=before]:shadow-[inset_2px_0_0_var(--brand)] data-[drop=after]:shadow-[inset_-2px_0_0_var(--brand)]',\n )}\n >\n <button\n ref={(el) => {\n if (el) tabRefs.current.set(tab.id, el);\n else tabRefs.current.delete(tab.id);\n }}\n type=\"button\"\n role=\"tab\"\n id={tabId}\n aria-selected={active}\n aria-controls={tab.controls}\n aria-describedby={tab.description ? `${tabId}-desc` : undefined}\n title={tab.description}\n tabIndex={tab.id === tabStop ? 0 : -1}\n onFocus={() => setFocusedId(tab.id)}\n onClick={() => onActiveChange(tab.id)}\n onKeyDown={(event) => onKeyDown(event, tab)}\n className={cn(\n 'flex h-full min-w-0 items-center gap-1.5 ps-3 outline-none focus-visible:shadow-[inset_0_0_0_1px_var(--ring)]',\n closeable ? 'pe-1' : 'pe-3',\n )}\n >\n {tab.icon && (\n <span aria-hidden className=\"flex shrink-0 [&_svg]:size-4\">\n {tab.icon}\n </span>\n )}\n <span className={cn('truncate', tab.preview && 'italic')}>{tab.label}</span>\n {tab.dirty && <span className=\"sr-only\">, unsaved changes</span>}\n </button>\n {tab.description && (\n <span id={`${tabId}-desc`} hidden>\n {tab.description}\n </span>\n )}\n {closeable ? (\n <button\n type=\"button\"\n tabIndex={-1}\n aria-label={`Close ${tab.label}`}\n title=\"Close (Delete)\"\n onClick={() => onClose?.(tab.id)}\n className=\"me-1 flex size-5 shrink-0 items-center justify-center rounded-xs text-muted-foreground outline-none hover:bg-muted hover:text-foreground\"\n >\n {tab.dirty && (\n <span\n aria-hidden\n className=\"size-2 rounded-full bg-foreground/70 group-hover/tab:hidden\"\n />\n )}\n <X\n aria-hidden\n className={cn(\n 'size-3.5',\n tab.dirty\n ? 'hidden group-hover/tab:block'\n : 'opacity-0 group-hover/tab:opacity-100 group-data-[state=active]/tab:opacity-100 group-focus-within/tab:opacity-100',\n )}\n />\n </button>\n ) : tab.dirty ? (\n <span aria-hidden className=\"me-3 size-2 shrink-0 rounded-full bg-foreground/70\" />\n ) : null}\n </div>\n );\n })}\n </div>\n {actions && (\n <div data-slot=\"editor-tabs-actions\" className=\"flex shrink-0 items-center gap-0.5 px-1\">\n {actions}\n </div>\n )}\n </div>\n );\n}\n\nexport { EditorTabs };\n"],"mappings":";;;;;;;;;;;AAsDA,SAAS,WAAW,EAClB,MACA,UACA,gBACA,SACA,QACA,SACA,kBACA,WACA,cAAc,WACd,GAAG,SACe;CAClB,MAAM,SAAS,MAAM,MAAM;CAC3B,MAAM,UAAU,MAAM,uBAAO,IAAI,IAA+B,CAAC;CACjE,MAAM,UAAU,MAAM,OAAuB,IAAI;CACjD,MAAM,CAAC,WAAW,gBAAgB,MAAM,S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AY,SAAS,MACvB;OAnBF,UAAA;QAqBG,IAAI,QACH,oBAAC,QAAD;SAAM,eAAA;SAAY,WAAU;SACzB,UAAA,IAAI;QACD,CAAA;QAER,oBAAC,QAAD;SAAM,WAAW,GAAG,YAAY,IAAI,WAAW,QAAQ;SAAI,UAAA,IAAI;QAAY,CAAA;QAC1E,IAAI,SAAS,oBAAC,QAAD;SAAM,WAAU;SAAU,UAAA;QAAuB,CAAA;OACzD;;MACP,IAAI,eACH,oBAAC,QAAD;OAAM,IAAI,GAAG,MAAM;OAAQ,QAAA;OACxB,UAAA,IAAI;MACD,CAAA;MAEP,YACC,qBAAC,UAAD;OACE,MAAK;OACL,UAAU;OACV,cAAY,SAAS,IAAI;OACzB,OAAM;OACN,eAAe,UAAU,IAAI,EAAE;OAC/B,WAAU;OANZ,UAAA,CAQG,IAAI,SACH,oBAAC,QAAD;QACE,eAAA;QACA,WAAU;OACX,CAAA,GAEH,oBAAC,GAAD;QACE,eAAA;QACA,WAAW,GACT,YACA,IAAI,QACA,iCACA,oHACN;OACD,CAAA,CACK;MACN,CAAA,IAAA,IAAI,QACN,oBAAC,QAAD;OAAM,eAAA;OAAY,WAAU;MAAsD,CAAA,IAChF;KACD;IAxGE,GAAA,IAAI,EAwGN;GAET,CAAC;EACE,CAAA,GACJ,WACC,oBAAC,OAAD;GAAK,aAAU;GAAsB,WAAU;GAC5C,UAAA;EACE,CAAA,CAEJ;;AAET"}
|
|
1
|
+
{"version":3,"file":"editor-tabs.js","names":[],"sources":["../../src/components/editor-tabs.tsx"],"sourcesContent":["import X from '@burtson-labs/icons/react/x';\nimport * as React from 'react';\n\nimport { cn, focusRingClasses } from '../lib/utils';\n\nexport interface EditorTab {\n /** Stable identity, usually the file path. */\n id: string;\n label: string;\n /** Full path or context; the tooltip and the accessible description. */\n description?: string;\n icon?: React.ReactNode;\n /** Unsaved changes: a dot replaces the close button until hover. */\n dirty?: boolean;\n /** Default true. */\n closeable?: boolean;\n /** A preview tab that the next opened file replaces; shown in italics. */\n preview?: boolean;\n /** The id of the panel this tab shows, for aria-controls. */\n controls?: string;\n}\n\nexport interface EditorTabsProps extends Omit<\n React.ComponentProps<'div'>,\n 'children' | 'aria-label'\n> {\n tabs: EditorTab[];\n activeId: string | null;\n onActiveChange: (id: string) => void;\n /**\n * A request to close. The component never removes a tab itself: for a dirty\n * tab, ask the person (save, discard, cancel) and then update `tabs`.\n */\n onClose?: (id: string) => void;\n /**\n * Reorder by drag or Ctrl+Shift+PageUp/PageDown. `toIndex` is the new position.\n * Dragging uses pointer events, not HTML5 drag and drop, so it also works in\n * desktop webviews (Tauri, Electron) that intercept native drags.\n */\n onMove?: (id: string, toIndex: number) => void;\n /** Required: e.g. \"Open editors\". */\n 'aria-label': string;\n /** Right-hand slot for split, more and similar buttons. */\n actions?: React.ReactNode;\n /** Right-click on a tab. */\n onTabContextMenu?: (id: string, event: React.MouseEvent) => void;\n}\n\n/**\n * The strip of open files above an editor. One tab stop; Left/Right/Home/End\n * move focus, Enter or Space opens, Delete asks to close, Ctrl+Shift+PageUp\n * and PageDown move the tab. Middle-click closes. The strip scrolls when the\n * tabs overflow and keeps the active tab in view.\n */\nconst EditorTabs = React.forwardRef<HTMLDivElement, EditorTabsProps>(function EditorTabs(\n {\n tabs,\n activeId,\n onActiveChange,\n onClose,\n onMove,\n actions,\n onTabContextMenu,\n className,\n 'aria-label': ariaLabel,\n ...props\n },\n ref,\n) {\n const baseId = React.useId();\n const tabRefs = React.useRef(new Map<string, HTMLButtonElement>());\n const listRef = React.useRef<HTMLDivElement>(null);\n const [focusedId, setFocusedId] = React.useState<string | null>(null);\n const [dragId, setDragId] = React.useState<string | null>(null);\n // The gap a dragged tab would land in: 0 is before the first tab,\n // tabs.length after the last.\n const [dropGap, setDropGap] = React.useState<number | null>(null);\n // Set once a press becomes a drag, so the click that ends it does nothing.\n const dragged = React.useRef(false);\n const dragCleanup = React.useRef<(() => void) | null>(null);\n React.useEffect(() => () => dragCleanup.current?.(), []);\n const lastIds = React.useRef<string[]>([]);\n const hadFocus = React.useRef(false);\n\n const ids = tabs.map((t) => t.id);\n const idsKey = ids.join('\\u0000');\n const tabStop =\n (focusedId && ids.includes(focusedId) ? focusedId : null) ??\n (activeId && ids.includes(activeId) ? activeId : null) ??\n ids[0] ??\n null;\n\n React.useEffect(() => {\n if (activeId)\n tabRefs.current.get(activeId)?.scrollIntoView?.({ block: 'nearest', inline: 'nearest' });\n }, [activeId]);\n\n // After a close, keep keyboard focus in the strip: the active tab if the\n // app picked one, else the neighbour at the closed tab's position.\n React.useLayoutEffect(() => {\n if (focusedId && !ids.includes(focusedId)) {\n const next =\n (activeId && ids.includes(activeId) ? activeId : null) ??\n ids[Math.min(Math.max(0, lastIds.current.indexOf(focusedId)), ids.length - 1)] ??\n null;\n setFocusedId(next);\n const active = document.activeElement;\n if (next && hadFocus.current && (!active || active === document.body))\n tabRefs.current.get(next)?.focus();\n }\n lastIds.current = ids;\n // ids is derived from tabs each render; idsKey is its stable form.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [focusedId, idsKey, activeId]);\n\n /** Which gap the pointer is over, measured from the rendered tabs. */\n const gapAt = (clientX: number) => {\n const els = Array.from(\n listRef.current?.querySelectorAll<HTMLElement>('[data-slot=\"editor-tab\"]') ?? [],\n );\n const rtl = listRef.current ? getComputedStyle(listRef.current).direction === 'rtl' : false;\n for (let i = 0; i < els.length; i++) {\n const rect = els[i]!.getBoundingClientRect();\n const mid = rect.left + rect.width / 2;\n if (rtl ? clientX > mid : clientX < mid) return i;\n }\n return els.length;\n };\n\n const startDrag = (event: React.PointerEvent, id: string) => {\n if (!onMove || event.button !== 0) return;\n dragCleanup.current?.();\n dragged.current = false;\n const downX = event.clientX;\n const move = (e: PointerEvent) => {\n // A few pixels of slop so an ordinary click is not read as a drag.\n if (!dragged.current && Math.abs(e.clientX - downX) < 4) return;\n if (!dragged.current) {\n dragged.current = true;\n setDragId(id);\n }\n setDropGap(gapAt(e.clientX));\n };\n const stop = (e: PointerEvent | null) => {\n window.removeEventListener('pointermove', move);\n window.removeEventListener('pointerup', up);\n window.removeEventListener('pointercancel', cancel);\n dragCleanup.current = null;\n if (e && dragged.current) {\n const from = lastIds.current.indexOf(id);\n const gap = gapAt(e.clientX);\n const to = gap > from ? gap - 1 : gap;\n if (from !== -1 && to !== from) onMove(id, to);\n }\n setDragId(null);\n setDropGap(null);\n };\n const up = (e: PointerEvent) => stop(e);\n const cancel = () => stop(null);\n window.addEventListener('pointermove', move);\n window.addEventListener('pointerup', up);\n window.addEventListener('pointercancel', cancel);\n dragCleanup.current = () => stop(null);\n };\n\n const focusTab = (id: string | undefined) => {\n if (!id) return;\n setFocusedId(id);\n tabRefs.current.get(id)?.focus();\n };\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>, tab: EditorTab) => {\n const i = ids.indexOf(tab.id);\n const rtl = listRef.current ? getComputedStyle(listRef.current).direction === 'rtl' : false;\n const [prev, next] = rtl ? ['ArrowRight', 'ArrowLeft'] : ['ArrowLeft', 'ArrowRight'];\n let handled = true;\n if (event.ctrlKey && event.shiftKey && (event.key === 'PageUp' || event.key === 'PageDown')) {\n const to = event.key === 'PageUp' ? i - 1 : i + 1;\n if (onMove && to >= 0 && to < ids.length) onMove(tab.id, to);\n } else if (event.key === prev) focusTab(ids[(i - 1 + ids.length) % ids.length]);\n else if (event.key === next) focusTab(ids[(i + 1) % ids.length]);\n else if (event.key === 'Home') focusTab(ids[0]);\n else if (event.key === 'End') focusTab(ids[ids.length - 1]);\n else if (event.key === 'Delete' && tab.closeable !== false && onClose) onClose(tab.id);\n else handled = false;\n if (handled) event.preventDefault();\n };\n\n return (\n <div\n ref={ref}\n data-slot=\"editor-tabs\"\n className={cn('flex h-9 min-w-0 items-stretch border-b bg-surface-muted', className)}\n {...props}\n >\n <div\n ref={listRef}\n role=\"tablist\"\n aria-label={ariaLabel}\n aria-orientation=\"horizontal\"\n className=\"flex min-w-0 flex-1 items-stretch overflow-x-auto [scrollbar-width:thin]\"\n onFocus={() => (hadFocus.current = true)}\n onBlur={(event) => {\n if (!listRef.current?.contains(event.relatedTarget)) hadFocus.current = false;\n }}\n >\n {tabs.map((tab, i) => {\n const active = tab.id === activeId;\n const closeable = tab.closeable !== false && Boolean(onClose);\n const tabId = `${baseId}-tab-${i}`;\n return (\n <div\n key={tab.id}\n data-slot=\"editor-tab\"\n data-state={active ? 'active' : 'inactive'}\n data-dirty={tab.dirty || undefined}\n data-dragging={dragId === tab.id || undefined}\n data-drop={\n dragId === null\n ? undefined\n : dropGap === i\n ? 'before'\n : dropGap === tabs.length && i === tabs.length - 1\n ? 'after'\n : undefined\n }\n onPointerDown={(event) => startDrag(event, tab.id)}\n onClickCapture={(event) => {\n // Swallow the click that ends a drag.\n if (dragged.current) {\n dragged.current = false;\n event.stopPropagation();\n event.preventDefault();\n }\n }}\n onAuxClick={(event) => {\n if (event.button === 1 && closeable) {\n event.preventDefault();\n onClose?.(tab.id);\n }\n }}\n onContextMenu={\n onTabContextMenu ? (event) => onTabContextMenu(tab.id, event) : undefined\n }\n className={cn(\n 'group/tab relative flex max-w-60 shrink-0 items-center border-e text-[13px] text-muted-foreground',\n 'hover:bg-muted/60 data-[state=active]:bg-background data-[state=active]:text-foreground',\n // The active tab's top edge carries the brand colour.\n 'data-[state=active]:before:absolute data-[state=active]:before:inset-x-0 data-[state=active]:before:top-0 data-[state=active]:before:h-0.5 data-[state=active]:before:bg-brand data-[state=active]:before:content-[\"\"]',\n 'data-[dragging]:opacity-50 data-[dragging]:select-none',\n // Where a dragged tab will land.\n 'data-[drop=before]:shadow-[inset_2px_0_0_var(--brand)] data-[drop=after]:shadow-[inset_-2px_0_0_var(--brand)]',\n )}\n >\n <button\n ref={(el) => {\n if (el) tabRefs.current.set(tab.id, el);\n else tabRefs.current.delete(tab.id);\n }}\n type=\"button\"\n role=\"tab\"\n id={tabId}\n aria-selected={active}\n aria-controls={tab.controls}\n aria-describedby={tab.description ? `${tabId}-desc` : undefined}\n title={tab.description}\n tabIndex={tab.id === tabStop ? 0 : -1}\n onFocus={() => setFocusedId(tab.id)}\n onClick={() => onActiveChange(tab.id)}\n onKeyDown={(event) => onKeyDown(event, tab)}\n className={cn(\n 'flex h-full min-w-0 items-center gap-1.5 ps-3',\n focusRingClasses,\n 'focus-visible:outline-offset-[-2px]',\n closeable ? 'pe-1' : 'pe-3',\n )}\n >\n {tab.icon && (\n <span aria-hidden className=\"flex shrink-0 [&_svg]:size-4\">\n {tab.icon}\n </span>\n )}\n <span className={cn('truncate', tab.preview && 'italic')}>{tab.label}</span>\n {tab.dirty && <span className=\"sr-only\">, unsaved changes</span>}\n </button>\n {tab.description && (\n <span id={`${tabId}-desc`} hidden>\n {tab.description}\n </span>\n )}\n {closeable ? (\n <button\n type=\"button\"\n tabIndex={-1}\n aria-label={`Close ${tab.label}`}\n title=\"Close (Delete)\"\n onClick={() => onClose?.(tab.id)}\n className={cn(\n 'me-1 flex size-5 shrink-0 items-center justify-center rounded-xs text-muted-foreground hover:bg-muted hover:text-foreground',\n focusRingClasses,\n 'focus-visible:outline-offset-[-1px]',\n )}\n >\n {tab.dirty && (\n <span\n aria-hidden\n className=\"size-2 rounded-full bg-foreground/70 group-hover/tab:hidden\"\n />\n )}\n <X\n aria-hidden\n className={cn(\n 'size-3.5',\n tab.dirty\n ? 'hidden group-hover/tab:block'\n : 'opacity-0 group-hover/tab:opacity-100 group-data-[state=active]/tab:opacity-100 group-focus-within/tab:opacity-100',\n )}\n />\n </button>\n ) : tab.dirty ? (\n <span aria-hidden className=\"me-3 size-2 shrink-0 rounded-full bg-foreground/70\" />\n ) : null}\n </div>\n );\n })}\n </div>\n {actions && (\n <div data-slot=\"editor-tabs-actions\" className=\"flex shrink-0 items-center gap-0.5 px-1\">\n {actions}\n </div>\n )}\n </div>\n );\n});\n\nexport { EditorTabs };\n"],"mappings":";;;;;;;;;;;;AAsDA,IAAM,aAAa,MAAM,WAA4C,SAAS,WAC5E,EACE,MACA,UACA,gBACA,SACA,QACA,SACA,k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|
-
declare
|
|
6
|
-
declare
|
|
2
|
+
declare const EmptyState: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
3
|
+
declare const EmptyStateIcon: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
declare const EmptyStateTitle: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
5
|
+
declare const EmptyStateDescription: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
6
|
+
declare const EmptyStateActions: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
7
7
|
export { EmptyState, EmptyStateActions, EmptyStateDescription, EmptyStateIcon, EmptyStateTitle };
|
|
@@ -1,43 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { cn } from "../lib/utils.js";
|
|
2
|
-
import "react";
|
|
3
|
+
import * as React from "react";
|
|
3
4
|
import { jsx } from "react/jsx-runtime";
|
|
4
5
|
//#region src/components/empty-state.tsx
|
|
5
|
-
function EmptyState({ className, ...props }) {
|
|
6
|
+
var EmptyState = React.forwardRef(function EmptyState({ className, ...props }, ref) {
|
|
6
7
|
return /* @__PURE__ */ jsx("div", {
|
|
8
|
+
ref,
|
|
7
9
|
"data-slot": "empty-state",
|
|
8
10
|
className: cn("flex min-h-64 flex-col items-center justify-center rounded-xl border border-dashed border-border-strong bg-surface-muted/60 px-6 py-10 text-center", className),
|
|
9
11
|
...props
|
|
10
12
|
});
|
|
11
|
-
}
|
|
12
|
-
function EmptyStateIcon({ className, ...props }) {
|
|
13
|
+
});
|
|
14
|
+
var EmptyStateIcon = React.forwardRef(function EmptyStateIcon({ className, ...props }, ref) {
|
|
13
15
|
return /* @__PURE__ */ jsx("div", {
|
|
16
|
+
ref,
|
|
14
17
|
"data-slot": "empty-state-icon",
|
|
15
18
|
className: cn("mb-4 grid size-10 place-items-center rounded-lg border border-brand/15 bg-brand-soft text-brand [&_svg]:size-5", className),
|
|
16
19
|
...props
|
|
17
20
|
});
|
|
18
|
-
}
|
|
19
|
-
function EmptyStateTitle({ className, children, ...props }) {
|
|
21
|
+
});
|
|
22
|
+
var EmptyStateTitle = React.forwardRef(function EmptyStateTitle({ className, children, ...props }, ref) {
|
|
20
23
|
return /* @__PURE__ */ jsx("h3", {
|
|
24
|
+
ref,
|
|
21
25
|
"data-slot": "empty-state-title",
|
|
22
26
|
className: cn("text-sm font-semibold text-foreground", className),
|
|
23
27
|
...props,
|
|
24
28
|
children
|
|
25
29
|
});
|
|
26
|
-
}
|
|
27
|
-
function EmptyStateDescription({ className, ...props }) {
|
|
30
|
+
});
|
|
31
|
+
var EmptyStateDescription = React.forwardRef(function EmptyStateDescription({ className, ...props }, ref) {
|
|
28
32
|
return /* @__PURE__ */ jsx("p", {
|
|
33
|
+
ref,
|
|
29
34
|
"data-slot": "empty-state-description",
|
|
30
35
|
className: cn("mt-1 max-w-md text-sm leading-5 text-muted-foreground", className),
|
|
31
36
|
...props
|
|
32
37
|
});
|
|
33
|
-
}
|
|
34
|
-
function EmptyStateActions({ className, ...props }) {
|
|
38
|
+
});
|
|
39
|
+
var EmptyStateActions = React.forwardRef(function EmptyStateActions({ className, ...props }, ref) {
|
|
35
40
|
return /* @__PURE__ */ jsx("div", {
|
|
41
|
+
ref,
|
|
36
42
|
"data-slot": "empty-state-actions",
|
|
37
43
|
className: cn("mt-5 flex flex-wrap justify-center gap-2", className),
|
|
38
44
|
...props
|
|
39
45
|
});
|
|
40
|
-
}
|
|
46
|
+
});
|
|
41
47
|
//#endregion
|
|
42
48
|
export { EmptyState, EmptyStateActions, EmptyStateDescription, EmptyStateIcon, EmptyStateTitle };
|
|
43
49
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empty-state.js","names":[],"sources":["../../src/components/empty-state.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { cn } from '../lib/utils';\n\
|
|
1
|
+
{"version":3,"file":"empty-state.js","names":[],"sources":["../../src/components/empty-state.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { cn } from '../lib/utils';\n\nconst EmptyState = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(\n function EmptyState({ className, ...props }, ref) {\n return (\n <div\n ref={ref}\n data-slot=\"empty-state\"\n className={cn(\n 'flex min-h-64 flex-col items-center justify-center rounded-xl border border-dashed border-border-strong bg-surface-muted/60 px-6 py-10 text-center',\n className,\n )}\n {...props}\n />\n );\n },\n);\n\nconst EmptyStateIcon = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(\n function EmptyStateIcon({ className, ...props }, ref) {\n return (\n <div\n ref={ref}\n data-slot=\"empty-state-icon\"\n className={cn(\n 'mb-4 grid size-10 place-items-center rounded-lg border border-brand/15 bg-brand-soft text-brand [&_svg]:size-5',\n className,\n )}\n {...props}\n />\n );\n },\n);\n\nconst EmptyStateTitle = React.forwardRef<HTMLHeadingElement, React.ComponentProps<'h3'>>(\n function EmptyStateTitle({ className, children, ...props }, ref) {\n return (\n <h3\n ref={ref}\n data-slot=\"empty-state-title\"\n className={cn('text-sm font-semibold text-foreground', className)}\n {...props}\n >\n {children}\n </h3>\n );\n },\n);\n\nconst EmptyStateDescription = React.forwardRef<HTMLParagraphElement, React.ComponentProps<'p'>>(\n function EmptyStateDescription({ className, ...props }, ref) {\n return (\n <p\n ref={ref}\n data-slot=\"empty-state-description\"\n className={cn('mt-1 max-w-md text-sm leading-5 text-muted-foreground', className)}\n {...props}\n />\n );\n },\n);\n\nconst EmptyStateActions = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(\n function EmptyStateActions({ className, ...props }, ref) {\n return (\n <div\n ref={ref}\n data-slot=\"empty-state-actions\"\n className={cn('mt-5 flex flex-wrap justify-center gap-2', className)}\n {...props}\n />\n );\n },\n);\n\nexport { EmptyState, EmptyStateActions, EmptyStateDescription, EmptyStateIcon, EmptyStateTitle };\n"],"mappings":";;;;;AAIA,IAAM,aAAa,MAAM,WACvB,SAAS,WAAW,EAAE,WAAW,GAAG,SAAS,KAAK;CAChD,OACE,oBAAC,OAAD;EACO;EACL,aAAU;EACV,WAAW,GACT,sJACA,SACF;EACA,GAAI;CACL,CAAA;AAEL,CACF;AAEA,IAAM,iBAAiB,MAAM,WAC3B,SAAS,eAAe,EAAE,WAAW,GAAG,SAAS,KAAK;CACpD,OACE,oBAAC,OAAD;EACO;EACL,aAAU;EACV,WAAW,GACT,kHACA,SACF;EACA,GAAI;CACL,CAAA;AAEL,CACF;AAEA,IAAM,kBAAkB,MAAM,WAC5B,SAAS,gBAAgB,EAAE,WAAW,UAAU,GAAG,SAAS,KAAK;CAC/D,OACE,oBAAC,MAAD;EACO;EACL,aAAU;EACV,WAAW,GAAG,yCAAyC,SAAS;EAChE,GAAI;EAEH;CACC,CAAA;AAER,CACF;AAEA,IAAM,wBAAwB,MAAM,WAClC,SAAS,sBAAsB,EAAE,WAAW,GAAG,SAAS,KAAK;CAC3D,OACE,oBAAC,KAAD;EACO;EACL,aAAU;EACV,WAAW,GAAG,yDAAyD,SAAS;EAChF,GAAI;CACL,CAAA;AAEL,CACF;AAEA,IAAM,oBAAoB,MAAM,WAC9B,SAAS,kBAAkB,EAAE,WAAW,GAAG,SAAS,KAAK;CACvD,OACE,oBAAC,OAAD;EACO;EACL,aAAU;EACV,WAAW,GAAG,4CAA4C,SAAS;EACnE,GAAI;CACL,CAAA;AAEL,CACF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface ErrorSummaryItem {
|
|
3
|
+
/** The id of the field with the problem; the entry links to it. */
|
|
4
|
+
id: string;
|
|
5
|
+
message: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export interface ErrorSummaryProps extends Omit<React.ComponentProps<'div'>, 'children' | 'title' | 'onSelect'> {
|
|
8
|
+
/** Nothing renders while this is empty. */
|
|
9
|
+
errors: ErrorSummaryItem[];
|
|
10
|
+
title?: React.ReactNode;
|
|
11
|
+
/** Called with the field id when an entry is chosen, after the field is focused. */
|
|
12
|
+
onSelect?: (id: string) => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The errors of a long form, at the top of it after a failed submit, each a
|
|
16
|
+
* link to its field. Focus moves here when errors appear, so a screen reader
|
|
17
|
+
* hears the list; choosing an entry focuses the field and scrolls it into
|
|
18
|
+
* view.
|
|
19
|
+
*/
|
|
20
|
+
declare const ErrorSummary: React.ForwardRefExoticComponent<Omit<ErrorSummaryProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
21
|
+
export { ErrorSummary };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn, focusRingClasses } from "../lib/utils.js";
|
|
3
|
+
import { Alert, AlertDescription, AlertTitle } from "./alert.js";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import AlertCircle from "@burtson-labs/icons/react/alert-circle";
|
|
7
|
+
//#region src/components/error-summary.tsx
|
|
8
|
+
/**
|
|
9
|
+
* The errors of a long form, at the top of it after a failed submit, each a
|
|
10
|
+
* link to its field. Focus moves here when errors appear, so a screen reader
|
|
11
|
+
* hears the list; choosing an entry focuses the field and scrolls it into
|
|
12
|
+
* view.
|
|
13
|
+
*/
|
|
14
|
+
var ErrorSummary = React.forwardRef(function ErrorSummary({ errors, title = "Fix these to continue", onSelect, className, ...props }, ref) {
|
|
15
|
+
const local = React.useRef(null);
|
|
16
|
+
const count = errors.length;
|
|
17
|
+
React.useEffect(() => {
|
|
18
|
+
if (count) local.current?.focus();
|
|
19
|
+
}, [count]);
|
|
20
|
+
if (!count) return null;
|
|
21
|
+
return /* @__PURE__ */ jsx("div", {
|
|
22
|
+
ref: (node) => {
|
|
23
|
+
local.current = node;
|
|
24
|
+
if (typeof ref === "function") ref(node);
|
|
25
|
+
else if (ref) ref.current = node;
|
|
26
|
+
},
|
|
27
|
+
tabIndex: -1,
|
|
28
|
+
"data-slot": "error-summary",
|
|
29
|
+
className: cn("outline-none", className),
|
|
30
|
+
...props,
|
|
31
|
+
children: /* @__PURE__ */ jsxs(Alert, {
|
|
32
|
+
variant: "destructive",
|
|
33
|
+
children: [
|
|
34
|
+
/* @__PURE__ */ jsx(AlertCircle, {}),
|
|
35
|
+
/* @__PURE__ */ jsx(AlertTitle, { children: title }),
|
|
36
|
+
/* @__PURE__ */ jsx(AlertDescription, { children: /* @__PURE__ */ jsx("ul", {
|
|
37
|
+
className: "grid gap-0.5",
|
|
38
|
+
children: errors.map(({ id, message }) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("a", {
|
|
39
|
+
href: `#${id}`,
|
|
40
|
+
className: cn("rounded-xs text-foreground underline underline-offset-2 hover:text-destructive", focusRingClasses),
|
|
41
|
+
onClick: (event) => {
|
|
42
|
+
const el = document.getElementById(id);
|
|
43
|
+
if (!el) return;
|
|
44
|
+
event.preventDefault();
|
|
45
|
+
el.focus();
|
|
46
|
+
el.scrollIntoView?.({
|
|
47
|
+
block: "center",
|
|
48
|
+
behavior: typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches ? "auto" : "smooth"
|
|
49
|
+
});
|
|
50
|
+
onSelect?.(id);
|
|
51
|
+
},
|
|
52
|
+
children: message
|
|
53
|
+
}) }, id))
|
|
54
|
+
}) })
|
|
55
|
+
]
|
|
56
|
+
})
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
//#endregion
|
|
60
|
+
export { ErrorSummary };
|
|
61
|
+
|
|
62
|
+
//# sourceMappingURL=error-summary.js.map
|