@burtson-labs/ui 0.13.1 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSES/DEPENDENCIES.txt +2745 -0
- package/LICENSES/Radix-MIT.txt +21 -0
- package/LICENSES/cmdk-MIT.txt +21 -0
- package/LICENSES/overrides/react-remove-scroll-bar.txt +26 -0
- package/LICENSES/shadcn-MIT.txt +21 -0
- package/README.md +20 -12
- package/THIRD_PARTY_NOTICES.md +15 -3
- package/dist/components/accordion.d.ts +4 -4
- package/dist/components/accordion.js +22 -18
- package/dist/components/accordion.js.map +1 -1
- package/dist/components/alert-dialog.d.ts +13 -11
- package/dist/components/alert-dialog.js +41 -31
- package/dist/components/alert-dialog.js.map +1 -1
- package/dist/components/alert.d.ts +5 -3
- package/dist/components/alert.js +12 -7
- package/dist/components/alert.js.map +1 -1
- package/dist/components/app-shell.d.ts +7 -6
- package/dist/components/app-shell.js +22 -14
- package/dist/components/app-shell.js.map +1 -1
- package/dist/components/attachment.d.ts +3 -3
- package/dist/components/attachment.js +11 -7
- package/dist/components/attachment.js.map +1 -1
- package/dist/components/audio-player.d.ts +2 -2
- package/dist/components/audio-player.js +9 -6
- package/dist/components/audio-player.js.map +1 -1
- package/dist/components/avatar.d.ts +4 -4
- package/dist/components/avatar.js +16 -12
- package/dist/components/avatar.js.map +1 -1
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/badge.js +15 -13
- package/dist/components/badge.js.map +1 -1
- package/dist/components/breadcrumb.d.ts +8 -8
- package/dist/components/breadcrumb.js +27 -20
- package/dist/components/breadcrumb.js.map +1 -1
- package/dist/components/button.d.ts +9 -2
- package/dist/components/button.js +15 -6
- package/dist/components/button.js.map +1 -1
- package/dist/components/card.d.ts +9 -9
- package/dist/components/card.js +33 -23
- package/dist/components/card.js.map +1 -1
- package/dist/components/chat-history.d.ts +1 -1
- package/dist/components/chat-history.js +11 -9
- package/dist/components/chat-history.js.map +1 -1
- package/dist/components/chat-layout.d.ts +1 -1
- package/dist/components/chat-layout.js +8 -3
- package/dist/components/chat-layout.js.map +1 -1
- package/dist/components/checkbox-card.d.ts +3 -3
- package/dist/components/checkbox-card.js +12 -10
- package/dist/components/checkbox-card.js.map +1 -1
- package/dist/components/checkbox.d.ts +24 -3
- package/dist/components/checkbox.js +52 -9
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/collapsible.d.ts +3 -3
- package/dist/components/collapsible.js +14 -11
- package/dist/components/collapsible.js.map +1 -1
- package/dist/components/combobox.d.ts +14 -4
- package/dist/components/combobox.js +19 -8
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/command.d.ts +68 -12
- package/dist/components/command.js +48 -34
- package/dist/components/command.js.map +1 -1
- package/dist/components/composer.d.ts +2 -2
- package/dist/components/composer.js +10 -7
- package/dist/components/composer.js.map +1 -1
- package/dist/components/connection-status.d.ts +3 -3
- package/dist/components/connection-status.js +19 -14
- package/dist/components/connection-status.js.map +1 -1
- package/dist/components/context-menu.d.ts +15 -14
- package/dist/components/context-menu.js +52 -41
- package/dist/components/context-menu.js.map +1 -1
- package/dist/components/conversation.d.ts +1 -1
- package/dist/components/conversation.js +7 -5
- package/dist/components/conversation.js.map +1 -1
- package/dist/components/copy-button.d.ts +1 -1
- package/dist/components/copy-button.js +4 -2
- package/dist/components/copy-button.js.map +1 -1
- package/dist/components/data-table.d.ts +7 -2
- package/dist/components/data-table.js +17 -42
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/dialog.d.ts +19 -10
- package/dist/components/dialog.js +50 -33
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/dropdown-menu.d.ts +15 -14
- package/dist/components/dropdown-menu.js +52 -41
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/editor-tabs.d.ts +1 -1
- package/dist/components/editor-tabs.js +7 -5
- package/dist/components/editor-tabs.js.map +1 -1
- package/dist/components/empty-state.d.ts +5 -5
- package/dist/components/empty-state.js +17 -11
- package/dist/components/empty-state.js.map +1 -1
- package/dist/components/error-summary.d.ts +21 -0
- package/dist/components/error-summary.js +62 -0
- package/dist/components/error-summary.js.map +1 -0
- package/dist/components/field.d.ts +66 -7
- package/dist/components/field.js +152 -20
- package/dist/components/field.js.map +1 -1
- package/dist/components/form-actions.d.ts +18 -0
- package/dist/components/form-actions.js +30 -0
- package/dist/components/form-actions.js.map +1 -0
- package/dist/components/icon-button.d.ts +3 -1
- package/dist/components/icon-button.js +6 -3
- package/dist/components/icon-button.js.map +1 -1
- package/dist/components/input.d.ts +42 -7
- package/dist/components/input.js +54 -10
- package/dist/components/input.js.map +1 -1
- package/dist/components/kbd.d.ts +2 -2
- package/dist/components/kbd.js +8 -5
- package/dist/components/kbd.js.map +1 -1
- package/dist/components/label.d.ts +7 -2
- package/dist/components/label.js +14 -7
- package/dist/components/label.js.map +1 -1
- package/dist/components/markdown.d.ts +4 -3
- package/dist/components/markdown.js +8 -6
- package/dist/components/markdown.js.map +1 -1
- package/dist/components/menubar.d.ts +17 -15
- package/dist/components/menubar.js +58 -45
- package/dist/components/menubar.js.map +1 -1
- package/dist/components/message-actions.d.ts +3 -3
- package/dist/components/message-actions.js +16 -12
- package/dist/components/message-actions.js.map +1 -1
- package/dist/components/message.d.ts +1 -1
- package/dist/components/message.js +6 -3
- package/dist/components/message.js.map +1 -1
- package/dist/components/mobile-nav.d.ts +1 -1
- package/dist/components/mobile-nav.js +7 -5
- package/dist/components/mobile-nav.js.map +1 -1
- package/dist/components/native-select.d.ts +16 -0
- package/dist/components/native-select.js +33 -0
- package/dist/components/native-select.js.map +1 -0
- package/dist/components/navigation-menu.d.ts +13 -12
- package/dist/components/navigation-menu.js +43 -33
- package/dist/components/navigation-menu.js.map +1 -1
- package/dist/components/number-input.d.ts +23 -0
- package/dist/components/number-input.js +45 -0
- package/dist/components/number-input.js.map +1 -0
- package/dist/components/onboarding-checklist.d.ts +1 -1
- package/dist/components/onboarding-checklist.js +5 -3
- package/dist/components/onboarding-checklist.js.map +1 -1
- package/dist/components/page-header.d.ts +7 -6
- package/dist/components/page-header.js +23 -15
- package/dist/components/page-header.js.map +1 -1
- package/dist/components/pagination.d.ts +1 -1
- package/dist/components/pagination.js +4 -2
- package/dist/components/pagination.js.map +1 -1
- package/dist/components/popover.d.ts +14 -11
- package/dist/components/popover.js +30 -23
- package/dist/components/popover.js.map +1 -1
- package/dist/components/progress.d.ts +2 -2
- package/dist/components/progress.js +11 -9
- package/dist/components/progress.js.map +1 -1
- package/dist/components/radio-group.d.ts +23 -4
- package/dist/components/radio-group.js +56 -14
- package/dist/components/radio-group.js.map +1 -1
- package/dist/components/reasoning.d.ts +3 -3
- package/dist/components/reasoning.js +14 -11
- package/dist/components/reasoning.js.map +1 -1
- package/dist/components/resizable.js +1 -0
- package/dist/components/resizable.js.map +1 -1
- package/dist/components/scroll-area.d.ts +4 -3
- package/dist/components/scroll-area.js +18 -14
- package/dist/components/scroll-area.js.map +1 -1
- package/dist/components/secret-input.d.ts +3 -2
- package/dist/components/secret-input.js +7 -4
- package/dist/components/secret-input.js.map +1 -1
- package/dist/components/select.d.ts +12 -7
- package/dist/components/select.js +42 -35
- package/dist/components/select.js.map +1 -1
- package/dist/components/separator.d.ts +2 -2
- package/dist/components/separator.js +8 -6
- package/dist/components/separator.js.map +1 -1
- package/dist/components/sheet.d.ts +11 -9
- package/dist/components/sheet.js +41 -29
- package/dist/components/sheet.js.map +1 -1
- package/dist/components/skeleton.d.ts +2 -1
- package/dist/components/skeleton.js +7 -4
- package/dist/components/skeleton.js.map +1 -1
- package/dist/components/slider.d.ts +10 -6
- package/dist/components/slider.js +16 -7
- package/dist/components/slider.js.map +1 -1
- package/dist/components/source.d.ts +2 -2
- package/dist/components/source.js +10 -7
- package/dist/components/source.js.map +1 -1
- package/dist/components/spinner.d.ts +4 -2
- package/dist/components/spinner.js +5 -3
- package/dist/components/spinner.js.map +1 -1
- package/dist/components/stat-card.d.ts +27 -2
- package/dist/components/stat-card.js +70 -9
- package/dist/components/stat-card.js.map +1 -1
- package/dist/components/status.d.ts +7 -6
- package/dist/components/status.js +12 -5
- package/dist/components/status.js.map +1 -1
- package/dist/components/steps.d.ts +1 -1
- package/dist/components/steps.js +5 -3
- package/dist/components/steps.js.map +1 -1
- package/dist/components/switch.d.ts +47 -3
- package/dist/components/switch.js +89 -11
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table.d.ts +29 -12
- package/dist/components/table.js +80 -34
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.d.ts +10 -5
- package/dist/components/tabs.js +29 -19
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/textarea.d.ts +6 -1
- package/dist/components/textarea.js +4 -3
- package/dist/components/textarea.js.map +1 -1
- package/dist/components/toast.d.ts +11 -7
- package/dist/components/toast.js +37 -27
- package/dist/components/toast.js.map +1 -1
- package/dist/components/toaster.d.ts +4 -2
- package/dist/components/toaster.js +7 -2
- package/dist/components/toaster.js.map +1 -1
- package/dist/components/tool-call.d.ts +2 -2
- package/dist/components/tool-call.js +15 -12
- package/dist/components/tool-call.js.map +1 -1
- package/dist/components/toolbar.d.ts +9 -4
- package/dist/components/toolbar.js +15 -9
- package/dist/components/toolbar.js.map +1 -1
- package/dist/components/tooltip.d.ts +4 -3
- package/dist/components/tooltip.js +17 -13
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/tour.js +10 -8
- package/dist/components/tour.js.map +1 -1
- package/dist/components/tree-view.d.ts +1 -1
- package/dist/components/tree-view.js +10 -5
- package/dist/components/tree-view.js.map +1 -1
- package/dist/components/voice-recorder.d.ts +1 -1
- package/dist/components/voice-recorder.js +5 -2
- package/dist/components/voice-recorder.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +17 -12
- package/dist/lib/media.d.ts +18 -0
- package/dist/lib/media.js +34 -0
- package/dist/lib/media.js.map +1 -0
- package/dist/lib/utils.d.ts +32 -0
- package/dist/lib/utils.js +33 -1
- package/dist/lib/utils.js.map +1 -1
- package/dist/mui/index.js +20 -8
- package/dist/mui/index.js.map +1 -1
- package/dist/primitives/vendor/cmdk/command-score.d.ts +1 -0
- package/dist/primitives/vendor/cmdk/command-score.js +64 -0
- package/dist/primitives/vendor/cmdk/command-score.js.map +1 -0
- package/dist/primitives/vendor/cmdk/index.d.ts +384 -0
- package/dist/primitives/vendor/cmdk/index.js +687 -0
- package/dist/primitives/vendor/cmdk/index.js.map +1 -0
- package/dist/primitives/vendor/radix/number/index.d.ts +1 -0
- package/dist/primitives/vendor/radix/number/number.d.ts +2 -0
- package/dist/primitives/vendor/radix/number/number.js +9 -0
- package/dist/primitives/vendor/radix/number/number.js.map +1 -0
- package/dist/primitives/vendor/radix/primitive/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/primitive/is-development.d.ts +1 -0
- package/dist/primitives/vendor/radix/primitive/is-development.js +7 -0
- package/dist/primitives/vendor/radix/primitive/is-development.js.map +1 -0
- package/dist/primitives/vendor/radix/primitive/primitive.d.ts +14 -0
- package/dist/primitives/vendor/radix/primitive/primitive.js +12 -0
- package/dist/primitives/vendor/radix/primitive/primitive.js.map +1 -0
- package/dist/primitives/vendor/radix/primitive/types.d.ts +5 -0
- package/dist/primitives/vendor/radix/react-accordion/accordion.d.ts +112 -0
- package/dist/primitives/vendor/radix/react-accordion/accordion.js +266 -0
- package/dist/primitives/vendor/radix/react-accordion/accordion.js.map +1 -0
- package/dist/primitives/vendor/radix/react-accordion/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-alert-dialog/alert-dialog.d.ts +49 -0
- package/dist/primitives/vendor/radix/react-alert-dialog/alert-dialog.js +122 -0
- package/dist/primitives/vendor/radix/react-alert-dialog/alert-dialog.js.map +1 -0
- package/dist/primitives/vendor/radix/react-alert-dialog/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-arrow/arrow.d.ts +9 -0
- package/dist/primitives/vendor/radix/react-arrow/arrow.js +22 -0
- package/dist/primitives/vendor/radix/react-arrow/arrow.js.map +1 -0
- package/dist/primitives/vendor/radix/react-arrow/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-avatar/avatar.d.ts +19 -0
- package/dist/primitives/vendor/radix/react-avatar/avatar.js +132 -0
- package/dist/primitives/vendor/radix/react-avatar/avatar.js.map +1 -0
- package/dist/primitives/vendor/radix/react-avatar/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-checkbox/checkbox.d.ts +47 -0
- package/dist/primitives/vendor/radix/react-checkbox/checkbox.js +197 -0
- package/dist/primitives/vendor/radix/react-checkbox/checkbox.js.map +1 -0
- package/dist/primitives/vendor/radix/react-checkbox/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-collapsible/collapsible.d.ts +31 -0
- package/dist/primitives/vendor/radix/react-collapsible/collapsible.js +133 -0
- package/dist/primitives/vendor/radix/react-collapsible/collapsible.js.map +1 -0
- package/dist/primitives/vendor/radix/react-collapsible/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-collection/collection-legacy.d.ts +21 -0
- package/dist/primitives/vendor/radix/react-collection/collection-legacy.js +84 -0
- package/dist/primitives/vendor/radix/react-collection/collection-legacy.js.map +1 -0
- package/dist/primitives/vendor/radix/react-collection/collection.d.ts +32 -0
- package/dist/primitives/vendor/radix/react-collection/index.d.ts +4 -0
- package/dist/primitives/vendor/radix/react-collection/ordered-dictionary.d.ts +51 -0
- package/dist/primitives/vendor/radix/react-compose-refs/compose-refs.d.ts +13 -0
- package/dist/primitives/vendor/radix/react-compose-refs/compose-refs.js +43 -0
- package/dist/primitives/vendor/radix/react-compose-refs/compose-refs.js.map +1 -0
- package/dist/primitives/vendor/radix/react-compose-refs/index.d.ts +1 -0
- package/dist/primitives/vendor/radix/react-context/create-context.d.ts +45 -0
- package/dist/primitives/vendor/radix/react-context/create-context.js +74 -0
- package/dist/primitives/vendor/radix/react-context/create-context.js.map +1 -0
- package/dist/primitives/vendor/radix/react-context/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-context-menu/context-menu.d.ts +95 -0
- package/dist/primitives/vendor/radix/react-context-menu/context-menu.js +279 -0
- package/dist/primitives/vendor/radix/react-context-menu/context-menu.js.map +1 -0
- package/dist/primitives/vendor/radix/react-context-menu/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-dialog/dialog.d.ts +97 -0
- package/dist/primitives/vendor/radix/react-dialog/dialog.js +262 -0
- package/dist/primitives/vendor/radix/react-dialog/dialog.js.map +1 -0
- package/dist/primitives/vendor/radix/react-dialog/index.d.ts +4 -0
- package/dist/primitives/vendor/radix/react-direction/direction.d.ts +10 -0
- package/dist/primitives/vendor/radix/react-direction/direction.js +13 -0
- package/dist/primitives/vendor/radix/react-direction/direction.js.map +1 -0
- package/dist/primitives/vendor/radix/react-direction/index.d.ts +1 -0
- package/dist/primitives/vendor/radix/react-dismissable-layer/dismissable-layer.d.ts +61 -0
- package/dist/primitives/vendor/radix/react-dismissable-layer/dismissable-layer.js +336 -0
- package/dist/primitives/vendor/radix/react-dismissable-layer/dismissable-layer.js.map +1 -0
- package/dist/primitives/vendor/radix/react-dismissable-layer/index.d.ts +4 -0
- package/dist/primitives/vendor/radix/react-dropdown-menu/dropdown-menu.d.ts +95 -0
- package/dist/primitives/vendor/radix/react-dropdown-menu/dropdown-menu.js +257 -0
- package/dist/primitives/vendor/radix/react-dropdown-menu/dropdown-menu.js.map +1 -0
- package/dist/primitives/vendor/radix/react-dropdown-menu/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-focus-guards/focus-guards.d.ts +11 -0
- package/dist/primitives/vendor/radix/react-focus-guards/focus-guards.js +49 -0
- package/dist/primitives/vendor/radix/react-focus-guards/focus-guards.js.map +1 -0
- package/dist/primitives/vendor/radix/react-focus-guards/index.d.ts +1 -0
- package/dist/primitives/vendor/radix/react-focus-scope/focus-scope.d.ts +31 -0
- package/dist/primitives/vendor/radix/react-focus-scope/focus-scope.js +221 -0
- package/dist/primitives/vendor/radix/react-focus-scope/focus-scope.js.map +1 -0
- package/dist/primitives/vendor/radix/react-focus-scope/index.d.ts +1 -0
- package/dist/primitives/vendor/radix/react-id/id.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-id/id.js +17 -0
- package/dist/primitives/vendor/radix/react-id/id.js.map +1 -0
- package/dist/primitives/vendor/radix/react-id/index.d.ts +1 -0
- package/dist/primitives/vendor/radix/react-label/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-label/label.d.ts +9 -0
- package/dist/primitives/vendor/radix/react-label/label.js +21 -0
- package/dist/primitives/vendor/radix/react-label/label.js.map +1 -0
- package/dist/primitives/vendor/radix/react-menu/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-menu/menu.d.ts +173 -0
- package/dist/primitives/vendor/radix/react-menu/menu.js +806 -0
- package/dist/primitives/vendor/radix/react-menu/menu.js.map +1 -0
- package/dist/primitives/vendor/radix/react-menubar/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-menubar/menubar.d.ts +106 -0
- package/dist/primitives/vendor/radix/react-menubar/menubar.js +377 -0
- package/dist/primitives/vendor/radix/react-menubar/menubar.js.map +1 -0
- package/dist/primitives/vendor/radix/react-navigation-menu/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-navigation-menu/navigation-menu.d.ts +124 -0
- package/dist/primitives/vendor/radix/react-navigation-menu/navigation-menu.js +743 -0
- package/dist/primitives/vendor/radix/react-navigation-menu/navigation-menu.js.map +1 -0
- package/dist/primitives/vendor/radix/react-popover/index.d.ts +1 -0
- package/dist/primitives/vendor/radix/react-popover/popover.d.ts +83 -0
- package/dist/primitives/vendor/radix/react-popover/popover.js +236 -0
- package/dist/primitives/vendor/radix/react-popover/popover.js.map +1 -0
- package/dist/primitives/vendor/radix/react-popper/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-popper/popper.d.ts +44 -0
- package/dist/primitives/vendor/radix/react-popper/popper.js +276 -0
- package/dist/primitives/vendor/radix/react-popper/popper.js.map +1 -0
- package/dist/primitives/vendor/radix/react-portal/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-portal/portal.d.ts +13 -0
- package/dist/primitives/vendor/radix/react-portal/portal.js +21 -0
- package/dist/primitives/vendor/radix/react-portal/portal.js.map +1 -0
- package/dist/primitives/vendor/radix/react-presence/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-presence/presence.d.ts +11 -0
- package/dist/primitives/vendor/radix/react-presence/presence.js +152 -0
- package/dist/primitives/vendor/radix/react-presence/presence.js.map +1 -0
- package/dist/primitives/vendor/radix/react-presence/use-state-machine.d.ts +10 -0
- package/dist/primitives/vendor/radix/react-presence/use-state-machine.js +12 -0
- package/dist/primitives/vendor/radix/react-presence/use-state-machine.js.map +1 -0
- package/dist/primitives/vendor/radix/react-primitive/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-primitive/primitive.d.ts +56 -0
- package/dist/primitives/vendor/radix/react-primitive/primitive.js +84 -0
- package/dist/primitives/vendor/radix/react-primitive/primitive.js.map +1 -0
- package/dist/primitives/vendor/radix/react-progress/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-progress/progress.d.ts +17 -0
- package/dist/primitives/vendor/radix/react-progress/progress.js +79 -0
- package/dist/primitives/vendor/radix/react-progress/progress.js.map +1 -0
- package/dist/primitives/vendor/radix/react-radio-group/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-radio-group/radio-group.d.ts +55 -0
- package/dist/primitives/vendor/radix/react-radio-group/radio-group.js +173 -0
- package/dist/primitives/vendor/radix/react-radio-group/radio-group.js.map +1 -0
- package/dist/primitives/vendor/radix/react-radio-group/radio.d.ts +62 -0
- package/dist/primitives/vendor/radix/react-radio-group/radio.js +150 -0
- package/dist/primitives/vendor/radix/react-radio-group/radio.js.map +1 -0
- package/dist/primitives/vendor/radix/react-roving-focus/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-roving-focus/roving-focus-group.d.ts +47 -0
- package/dist/primitives/vendor/radix/react-roving-focus/roving-focus-group.js +218 -0
- package/dist/primitives/vendor/radix/react-roving-focus/roving-focus-group.js.map +1 -0
- package/dist/primitives/vendor/radix/react-scroll-area/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-scroll-area/scroll-area.d.ts +121 -0
- package/dist/primitives/vendor/radix/react-scroll-area/scroll-area.js +713 -0
- package/dist/primitives/vendor/radix/react-scroll-area/scroll-area.js.map +1 -0
- package/dist/primitives/vendor/radix/react-scroll-area/use-state-machine.d.ts +10 -0
- package/dist/primitives/vendor/radix/react-scroll-area/use-state-machine.js +12 -0
- package/dist/primitives/vendor/radix/react-scroll-area/use-state-machine.js.map +1 -0
- package/dist/primitives/vendor/radix/react-select/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-select/select.d.ts +163 -0
- package/dist/primitives/vendor/radix/react-select/select.js +1040 -0
- package/dist/primitives/vendor/radix/react-select/select.js.map +1 -0
- package/dist/primitives/vendor/radix/react-separator/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-separator/separator.d.ts +20 -0
- package/dist/primitives/vendor/radix/react-separator/separator.js +29 -0
- package/dist/primitives/vendor/radix/react-separator/separator.js.map +1 -0
- package/dist/primitives/vendor/radix/react-slot/index.d.ts +1 -0
- package/dist/primitives/vendor/radix/react-slot/slot.d.ts +29 -0
- package/dist/primitives/vendor/radix/react-slot/slot.js +107 -0
- package/dist/primitives/vendor/radix/react-slot/slot.js.map +1 -0
- package/dist/primitives/vendor/radix/react-switch/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-switch/switch.d.ts +41 -0
- package/dist/primitives/vendor/radix/react-switch/switch.js +185 -0
- package/dist/primitives/vendor/radix/react-switch/switch.js.map +1 -0
- package/dist/primitives/vendor/radix/react-tabs/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-tabs/tabs.d.ts +54 -0
- package/dist/primitives/vendor/radix/react-tabs/tabs.js +145 -0
- package/dist/primitives/vendor/radix/react-tabs/tabs.js.map +1 -0
- package/dist/primitives/vendor/radix/react-toast/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-toast/toast.d.ts +125 -0
- package/dist/primitives/vendor/radix/react-toast/toast.js +557 -0
- package/dist/primitives/vendor/radix/react-toast/toast.js.map +1 -0
- package/dist/primitives/vendor/radix/react-tooltip/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-tooltip/tooltip.d.ts +99 -0
- package/dist/primitives/vendor/radix/react-tooltip/tooltip.js +503 -0
- package/dist/primitives/vendor/radix/react-tooltip/tooltip.js.map +1 -0
- package/dist/primitives/vendor/radix/react-use-callback-ref/index.d.ts +1 -0
- package/dist/primitives/vendor/radix/react-use-callback-ref/use-callback-ref.d.ts +6 -0
- package/dist/primitives/vendor/radix/react-use-callback-ref/use-callback-ref.js +18 -0
- package/dist/primitives/vendor/radix/react-use-callback-ref/use-callback-ref.js.map +1 -0
- package/dist/primitives/vendor/radix/react-use-controllable-state/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-use-controllable-state/use-controllable-state-reducer.d.ts +28 -0
- package/dist/primitives/vendor/radix/react-use-controllable-state/use-controllable-state.d.ts +11 -0
- package/dist/primitives/vendor/radix/react-use-controllable-state/use-controllable-state.js +59 -0
- package/dist/primitives/vendor/radix/react-use-controllable-state/use-controllable-state.js.map +1 -0
- package/dist/primitives/vendor/radix/react-use-effect-event/index.d.ts +1 -0
- package/dist/primitives/vendor/radix/react-use-effect-event/use-effect-event.d.ts +7 -0
- package/dist/primitives/vendor/radix/react-use-is-hydrated/index.d.ts +1 -0
- package/dist/primitives/vendor/radix/react-use-is-hydrated/use-is-hydrated-legacy.d.ts +1 -0
- package/dist/primitives/vendor/radix/react-use-is-hydrated/use-is-hydrated-legacy.js +18 -0
- package/dist/primitives/vendor/radix/react-use-is-hydrated/use-is-hydrated-legacy.js.map +1 -0
- package/dist/primitives/vendor/radix/react-use-is-hydrated/use-is-hydrated.d.ts +6 -0
- package/dist/primitives/vendor/radix/react-use-is-hydrated/use-is-hydrated.js +19 -0
- package/dist/primitives/vendor/radix/react-use-is-hydrated/use-is-hydrated.js.map +1 -0
- package/dist/primitives/vendor/radix/react-use-layout-effect/index.d.ts +1 -0
- package/dist/primitives/vendor/radix/react-use-layout-effect/use-layout-effect.d.ts +10 -0
- package/dist/primitives/vendor/radix/react-use-layout-effect/use-layout-effect.js +15 -0
- package/dist/primitives/vendor/radix/react-use-layout-effect/use-layout-effect.js.map +1 -0
- package/dist/primitives/vendor/radix/react-use-previous/index.d.ts +1 -0
- package/dist/primitives/vendor/radix/react-use-previous/use-previous.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-use-previous/use-previous.js +20 -0
- package/dist/primitives/vendor/radix/react-use-previous/use-previous.js.map +1 -0
- package/dist/primitives/vendor/radix/react-use-size/index.d.ts +1 -0
- package/dist/primitives/vendor/radix/react-use-size/use-size.d.ts +5 -0
- package/dist/primitives/vendor/radix/react-use-size/use-size.js +42 -0
- package/dist/primitives/vendor/radix/react-use-size/use-size.js.map +1 -0
- package/dist/primitives/vendor/radix/react-visually-hidden/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/react-visually-hidden/visually-hidden.d.ts +21 -0
- package/dist/primitives/vendor/radix/react-visually-hidden/visually-hidden.js +32 -0
- package/dist/primitives/vendor/radix/react-visually-hidden/visually-hidden.js.map +1 -0
- package/dist/primitives/vendor/radix/rect/index.d.ts +2 -0
- package/dist/primitives/vendor/radix/rect/observe-element-rect.d.ts +16 -0
- package/dist/styles.css +1 -1
- package/dist/theme.css +36 -17
- package/dist/tokens.d.ts +78 -36
- package/dist/tokens.js +63 -32
- package/dist/tokens.js.map +1 -1
- package/package.json +25 -13
- package/vendor-manifest.json +1101 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-summary.js","names":[],"sources":["../../src/components/error-summary.tsx"],"sourcesContent":["import AlertCircle from '@burtson-labs/icons/react/alert-circle';\nimport * as React from 'react';\n\nimport { cn, focusRingClasses } from '../lib/utils';\n\nimport { Alert, AlertDescription, AlertTitle } from './alert';\n\nexport interface ErrorSummaryItem {\n /** The id of the field with the problem; the entry links to it. */\n id: string;\n message: React.ReactNode;\n}\n\nexport interface ErrorSummaryProps extends Omit<\n React.ComponentProps<'div'>,\n 'children' | 'title' | 'onSelect'\n> {\n /** Nothing renders while this is empty. */\n errors: ErrorSummaryItem[];\n title?: React.ReactNode;\n /** Called with the field id when an entry is chosen, after the field is focused. */\n onSelect?: (id: string) => void;\n}\n\n/**\n * The errors of a long form, at the top of it after a failed submit, each a\n * link to its field. Focus moves here when errors appear, so a screen reader\n * hears the list; choosing an entry focuses the field and scrolls it into\n * view.\n */\nconst ErrorSummary = React.forwardRef<HTMLDivElement, ErrorSummaryProps>(function ErrorSummary(\n { errors, title = 'Fix these to continue', onSelect, className, ...props },\n ref,\n) {\n const local = React.useRef<HTMLDivElement | null>(null);\n const count = errors.length;\n React.useEffect(() => {\n if (count) local.current?.focus();\n }, [count]);\n if (!count) return null;\n return (\n <div\n ref={(node) => {\n local.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) ref.current = node;\n }}\n tabIndex={-1}\n data-slot=\"error-summary\"\n className={cn('outline-none', className)}\n {...props}\n >\n <Alert variant=\"destructive\">\n <AlertCircle />\n <AlertTitle>{title}</AlertTitle>\n <AlertDescription>\n <ul className=\"grid gap-0.5\">\n {errors.map(({ id, message }) => (\n <li key={id}>\n <a\n href={`#${id}`}\n className={cn(\n 'rounded-xs text-foreground underline underline-offset-2 hover:text-destructive',\n focusRingClasses,\n )}\n onClick={(event) => {\n const el = document.getElementById(id);\n if (!el) return;\n event.preventDefault();\n el.focus();\n el.scrollIntoView?.({\n block: 'center',\n behavior:\n typeof matchMedia === 'function' &&\n matchMedia('(prefers-reduced-motion: reduce)').matches\n ? 'auto'\n : 'smooth',\n });\n onSelect?.(id);\n }}\n >\n {message}\n </a>\n </li>\n ))}\n </ul>\n </AlertDescription>\n </Alert>\n </div>\n );\n});\n\nexport { ErrorSummary };\n"],"mappings":";;;;;;;;;;;;;AA8BA,IAAM,eAAe,MAAM,WAA8C,SAAS,aAChF,EAAE,QAAQ,QAAQ,yBAAyB,UAAU,WAAW,GAAG,SACnE,KACA;CACA,MAAM,QAAQ,MAAM,OAA8B,IAAI;CACtD,MAAM,QAAQ,OAAO;CACrB,MAAM,gBAAgB;EACpB,IAAI,OAAO,MAAM,SAAS,MAAM;CAClC,GAAG,CAAC,KAAK,CAAC;CACV,IAAI,CAAC,OAAO,OAAO;CACnB,OACE,oBAAC,OAAD;EACE,MAAM,SAAS;GACb,MAAM,UAAU;GAChB,IAAI,OAAO,QAAQ,YAAY,IAAI,IAAI;QAClC,IAAI,KAAK,IAAI,UAAU;EAC9B;EACA,UAAU;EACV,aAAU;EACV,WAAW,GAAG,gBAAgB,SAAS;EACvC,GAAI;EAEJ,UAAA,qBAAC,OAAD;GAAO,SAAQ;GAAf,UAAA;IACE,oBAAC,aAAD,CAAc,CAAA;IACd,oBAAC,YAAD,EAAA,UAAa,MAAkB,CAAA;IAC/B,oBAAC,kBAAD,EAAA,UACE,oBAAC,MAAD;KAAI,WAAU;KACX,UAAA,OAAO,KAAK,EAAE,IAAI,cACjB,oBAAC,MAAD,EAAA,UACE,oBAAC,KAAD;MACE,MAAM,IAAI;MACV,WAAW,GACT,kFACA,gBACF;MACA,UAAU,UAAU;OAClB,MAAM,KAAK,SAAS,eAAe,EAAE;OACrC,IAAI,CAAC,IAAI;OACT,MAAM,eAAe;OACrB,GAAG,MAAM;OACT,GAAG,iBAAiB;QAClB,OAAO;QACP,UACE,OAAO,eAAe,cACtB,WAAW,kCAAkC,CAAC,CAAC,UAC3C,SACA;OACR,CAAC;OACD,WAAW,EAAE;MACf;MAEC,UAAA;KACA,CAAA,EACD,GAzBK,EAyBL,CACL;IACC,CAAA,EACY,CAAA;GACb;;CACJ,CAAA;AAET,CAAC"}
|
|
@@ -1,8 +1,67 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
export interface FieldContextValue {
|
|
3
|
+
/** The control's id (the label points at it). */
|
|
4
|
+
id: string;
|
|
5
|
+
/** Ids of the description and error, for aria-describedby. */
|
|
6
|
+
describedBy?: string;
|
|
7
|
+
invalid: boolean;
|
|
8
|
+
required?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/** The enclosing Field's id and aria wiring, for a custom control made of several inputs. */
|
|
11
|
+
export declare const useField: () => FieldContextValue | null;
|
|
12
|
+
export interface FieldProps extends React.ComponentProps<'div'> {
|
|
13
|
+
/** Sets the recipe: a label above the control. */
|
|
14
|
+
label?: React.ReactNode;
|
|
15
|
+
/** Help under the control. */
|
|
16
|
+
description?: React.ReactNode;
|
|
17
|
+
/** An error under the control; sets aria-invalid on it. */
|
|
18
|
+
error?: React.ReactNode;
|
|
19
|
+
/** Right of the label: a status, a count. `optional` shows "Optional". */
|
|
20
|
+
hint?: React.ReactNode;
|
|
21
|
+
optional?: boolean;
|
|
22
|
+
/** Sets aria-required on the control. (Mark whichever is rarer in the form, optional or required.) */
|
|
23
|
+
required?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* The child is a group of inputs (a time range), not one control: the label
|
|
26
|
+
* names the group and each input keeps its own aria-label.
|
|
27
|
+
*/
|
|
28
|
+
group?: boolean;
|
|
29
|
+
/** Across every column of a FieldGrid. */
|
|
30
|
+
span?: boolean;
|
|
31
|
+
}
|
|
32
|
+
declare const Field: React.ForwardRefExoticComponent<Omit<FieldProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
33
|
+
declare const FieldHeader: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
34
|
+
declare const FieldLabel: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "ref"> & React.RefAttributes<HTMLLabelElement>>;
|
|
35
|
+
declare const FieldHint: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
36
|
+
declare const FieldDescription: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
37
|
+
declare const FieldError: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
38
|
+
declare const gridColumns: {
|
|
39
|
+
readonly 1: "";
|
|
40
|
+
readonly 2: "sm:grid-cols-2";
|
|
41
|
+
readonly 3: "sm:grid-cols-3";
|
|
42
|
+
readonly 4: "sm:grid-cols-2 xl:grid-cols-4";
|
|
43
|
+
};
|
|
44
|
+
export interface FieldGridProps extends React.ComponentProps<'div'> {
|
|
45
|
+
/** Columns from 640px up; one column on phones. */
|
|
46
|
+
columns?: keyof typeof gridColumns;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Fields side by side. Each recipe Field spans three rows of a subgrid
|
|
50
|
+
* (label, control, help), so the controls in a row share a top edge even
|
|
51
|
+
* when one label wraps or one field has help and its neighbour does not.
|
|
52
|
+
*/
|
|
53
|
+
declare const FieldGrid: React.ForwardRefExoticComponent<Omit<FieldGridProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
54
|
+
export interface FieldSetProps extends React.ComponentProps<'fieldset'> {
|
|
55
|
+
/** The group's name, as its legend. */
|
|
56
|
+
legend?: React.ReactNode;
|
|
57
|
+
description?: React.ReactNode;
|
|
58
|
+
/** Beside the legend, right-aligned: a count, a small button. */
|
|
59
|
+
action?: React.ReactNode;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* A titled group of fields. Sets stack with a rule between them; `disabled`
|
|
63
|
+
* greys and locks everything inside. The legend names the fieldset through
|
|
64
|
+
* aria-labelledby, so it can sit in a row with the action.
|
|
65
|
+
*/
|
|
66
|
+
declare const FieldSet: React.ForwardRefExoticComponent<Omit<FieldSetProps, "ref"> & React.RefAttributes<HTMLFieldSetElement>>;
|
|
67
|
+
export { Field, FieldDescription, FieldError, FieldGrid, FieldHeader, FieldHint, FieldLabel, FieldSet, };
|
package/dist/components/field.js
CHANGED
|
@@ -1,51 +1,183 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { cn } from "../lib/utils.js";
|
|
2
|
-
import "
|
|
3
|
-
import
|
|
3
|
+
import { Select, SelectTrigger } from "./select.js";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
6
|
//#region src/components/field.tsx
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
var FieldContext = React.createContext(null);
|
|
8
|
+
/** The enclosing Field's id and aria wiring, for a custom control made of several inputs. */
|
|
9
|
+
var useField = () => React.useContext(FieldContext);
|
|
10
|
+
var wire = (el, ctx) => React.cloneElement(el, {
|
|
11
|
+
id: el.props.id ?? ctx.id,
|
|
12
|
+
"aria-describedby": el.props["aria-describedby"] ?? ctx.describedBy,
|
|
13
|
+
"aria-invalid": el.props["aria-invalid"] ?? (ctx.invalid || void 0),
|
|
14
|
+
"aria-required": el.props["aria-required"] ?? (ctx.required || void 0)
|
|
15
|
+
});
|
|
16
|
+
/** The control the label points at: a kit Select's trigger, else the child itself. */
|
|
17
|
+
function wireControl(children, ctx) {
|
|
18
|
+
if (!React.isValidElement(children)) return children;
|
|
19
|
+
if (children.type === Select) return React.cloneElement(children, { children: React.Children.map(children.props.children, (c) => React.isValidElement(c) && c.type === SelectTrigger ? wire(c, ctx) : c) });
|
|
20
|
+
return wire(children, ctx);
|
|
21
|
+
}
|
|
22
|
+
var Field = React.forwardRef(function Field({ label, description, error, hint, optional, required, group, span, id: idProp, className, children, ...props }, ref) {
|
|
23
|
+
const auto = React.useId();
|
|
24
|
+
if (!(label !== void 0)) return /* @__PURE__ */ jsx("div", {
|
|
25
|
+
ref,
|
|
26
|
+
id: idProp,
|
|
7
27
|
"data-slot": "field",
|
|
8
|
-
className: cn("grid gap-1.5", className),
|
|
9
|
-
...props
|
|
28
|
+
className: cn("grid gap-1.5", span && "sm:col-span-full", className),
|
|
29
|
+
...props,
|
|
30
|
+
children
|
|
10
31
|
});
|
|
11
|
-
}
|
|
12
|
-
|
|
32
|
+
const id = idProp ?? `f${auto.replace(/:/g, "")}`;
|
|
33
|
+
const descriptionId = description ? `${id}-description` : void 0;
|
|
34
|
+
const errorId = error ? `${id}-error` : void 0;
|
|
35
|
+
const describedBy = [errorId, descriptionId].filter(Boolean).join(" ") || void 0;
|
|
36
|
+
const ctx = {
|
|
37
|
+
id,
|
|
38
|
+
describedBy,
|
|
39
|
+
invalid: Boolean(error),
|
|
40
|
+
required
|
|
41
|
+
};
|
|
42
|
+
return /* @__PURE__ */ jsx(FieldContext.Provider, {
|
|
43
|
+
value: ctx,
|
|
44
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
45
|
+
ref,
|
|
46
|
+
"data-slot": "field",
|
|
47
|
+
"data-invalid": error ? "" : void 0,
|
|
48
|
+
role: group ? "group" : void 0,
|
|
49
|
+
"aria-labelledby": group ? `${id}-label` : void 0,
|
|
50
|
+
"aria-describedby": group ? describedBy : void 0,
|
|
51
|
+
className: cn("grid min-w-0 grid-cols-[minmax(0,1fr)] content-start", "[[data-slot=field-grid]>&]:row-span-3 [[data-slot=field-grid]>&]:grid-rows-subgrid", span && "sm:col-span-full", className),
|
|
52
|
+
...props,
|
|
53
|
+
children: [
|
|
54
|
+
/* @__PURE__ */ jsxs(FieldHeader, {
|
|
55
|
+
className: "min-h-5 items-end pb-1.5",
|
|
56
|
+
children: [group ? /* @__PURE__ */ jsx("span", {
|
|
57
|
+
id: `${id}-label`,
|
|
58
|
+
"data-slot": "field-label",
|
|
59
|
+
className: labelClasses,
|
|
60
|
+
children: label
|
|
61
|
+
}) : /* @__PURE__ */ jsx(FieldLabel, {
|
|
62
|
+
htmlFor: id,
|
|
63
|
+
children: label
|
|
64
|
+
}), (hint || optional) && /* @__PURE__ */ jsx(FieldHint, {
|
|
65
|
+
className: "shrink-0 leading-5",
|
|
66
|
+
children: hint ?? "Optional"
|
|
67
|
+
})]
|
|
68
|
+
}),
|
|
69
|
+
/* @__PURE__ */ jsx("div", {
|
|
70
|
+
className: "flex min-w-0 items-start",
|
|
71
|
+
children: group ? children : wireControl(children, ctx)
|
|
72
|
+
}),
|
|
73
|
+
/* @__PURE__ */ jsxs("div", {
|
|
74
|
+
className: "grid content-start gap-1 pt-1.5 empty:hidden",
|
|
75
|
+
children: [error && /* @__PURE__ */ jsx(FieldError, {
|
|
76
|
+
id: errorId,
|
|
77
|
+
children: error
|
|
78
|
+
}), description && /* @__PURE__ */ jsx(FieldDescription, {
|
|
79
|
+
id: descriptionId,
|
|
80
|
+
children: description
|
|
81
|
+
})]
|
|
82
|
+
})
|
|
83
|
+
]
|
|
84
|
+
})
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
var labelClasses = "text-[13px] leading-5 font-semibold text-foreground";
|
|
88
|
+
var FieldHeader = React.forwardRef(function FieldHeader({ className, ...props }, ref) {
|
|
13
89
|
return /* @__PURE__ */ jsx("div", {
|
|
90
|
+
ref,
|
|
14
91
|
"data-slot": "field-header",
|
|
15
92
|
className: cn("flex items-baseline justify-between gap-3", className),
|
|
16
93
|
...props
|
|
17
94
|
});
|
|
18
|
-
}
|
|
19
|
-
function FieldLabel({ className, ...props }) {
|
|
95
|
+
});
|
|
96
|
+
var FieldLabel = React.forwardRef(function FieldLabel({ className, ...props }, ref) {
|
|
20
97
|
return /* @__PURE__ */ jsx("label", {
|
|
98
|
+
ref,
|
|
21
99
|
"data-slot": "field-label",
|
|
22
|
-
className: cn(
|
|
100
|
+
className: cn(labelClasses, className),
|
|
23
101
|
...props
|
|
24
102
|
});
|
|
25
|
-
}
|
|
26
|
-
function FieldHint({ className, ...props }) {
|
|
103
|
+
});
|
|
104
|
+
var FieldHint = React.forwardRef(function FieldHint({ className, ...props }, ref) {
|
|
27
105
|
return /* @__PURE__ */ jsx("span", {
|
|
106
|
+
ref,
|
|
28
107
|
"data-slot": "field-hint",
|
|
29
108
|
className: cn("text-xs text-muted-foreground", className),
|
|
30
109
|
...props
|
|
31
110
|
});
|
|
32
|
-
}
|
|
33
|
-
function FieldDescription({ className, ...props }) {
|
|
111
|
+
});
|
|
112
|
+
var FieldDescription = React.forwardRef(function FieldDescription({ className, ...props }, ref) {
|
|
34
113
|
return /* @__PURE__ */ jsx("p", {
|
|
114
|
+
ref,
|
|
35
115
|
"data-slot": "field-description",
|
|
36
116
|
className: cn("text-xs leading-5 text-muted-foreground", className),
|
|
37
117
|
...props
|
|
38
118
|
});
|
|
39
|
-
}
|
|
40
|
-
function FieldError({ className, ...props }) {
|
|
119
|
+
});
|
|
120
|
+
var FieldError = React.forwardRef(function FieldError({ className, ...props }, ref) {
|
|
41
121
|
return /* @__PURE__ */ jsx("p", {
|
|
122
|
+
ref,
|
|
42
123
|
"data-slot": "field-error",
|
|
43
124
|
role: "alert",
|
|
44
|
-
className: cn("text-xs font-medium text-destructive", className),
|
|
125
|
+
className: cn("text-xs leading-5 font-medium text-destructive", className),
|
|
45
126
|
...props
|
|
46
127
|
});
|
|
47
|
-
}
|
|
128
|
+
});
|
|
129
|
+
var gridColumns = {
|
|
130
|
+
1: "",
|
|
131
|
+
2: "sm:grid-cols-2",
|
|
132
|
+
3: "sm:grid-cols-3",
|
|
133
|
+
4: "sm:grid-cols-2 xl:grid-cols-4"
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Fields side by side. Each recipe Field spans three rows of a subgrid
|
|
137
|
+
* (label, control, help), so the controls in a row share a top edge even
|
|
138
|
+
* when one label wraps or one field has help and its neighbour does not.
|
|
139
|
+
*/
|
|
140
|
+
var FieldGrid = React.forwardRef(function FieldGrid({ columns = 2, className, ...props }, ref) {
|
|
141
|
+
return /* @__PURE__ */ jsx("div", {
|
|
142
|
+
ref,
|
|
143
|
+
"data-slot": "field-grid",
|
|
144
|
+
className: cn("-mb-5 grid min-w-0 grid-cols-[minmax(0,1fr)] gap-x-4 gap-y-0 [&>*]:mb-5", gridColumns[columns], className),
|
|
145
|
+
...props
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
/**
|
|
149
|
+
* A titled group of fields. Sets stack with a rule between them; `disabled`
|
|
150
|
+
* greys and locks everything inside. The legend names the fieldset through
|
|
151
|
+
* aria-labelledby, so it can sit in a row with the action.
|
|
152
|
+
*/
|
|
153
|
+
var FieldSet = React.forwardRef(function FieldSet({ legend, description, action, className, children, ...props }, ref) {
|
|
154
|
+
const id = React.useId();
|
|
155
|
+
return /* @__PURE__ */ jsxs("fieldset", {
|
|
156
|
+
ref,
|
|
157
|
+
"data-slot": "field-set",
|
|
158
|
+
"aria-labelledby": legend ? `${id}-legend` : void 0,
|
|
159
|
+
"aria-describedby": description ? `${id}-description` : void 0,
|
|
160
|
+
className: cn("grid min-w-0 gap-4 border-border [&+&]:border-t [&+&]:pt-5 disabled:opacity-60", className),
|
|
161
|
+
...props,
|
|
162
|
+
children: [(legend || action) && /* @__PURE__ */ jsxs("div", {
|
|
163
|
+
className: "flex items-start justify-between gap-3",
|
|
164
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
165
|
+
className: "grid gap-1",
|
|
166
|
+
children: [legend && /* @__PURE__ */ jsx("div", {
|
|
167
|
+
id: `${id}-legend`,
|
|
168
|
+
"data-slot": "field-set-legend",
|
|
169
|
+
className: "text-sm leading-5 font-semibold",
|
|
170
|
+
children: legend
|
|
171
|
+
}), description && /* @__PURE__ */ jsx("p", {
|
|
172
|
+
id: `${id}-description`,
|
|
173
|
+
className: "text-[13px] leading-5 text-muted-foreground",
|
|
174
|
+
children: description
|
|
175
|
+
})]
|
|
176
|
+
}), action]
|
|
177
|
+
}), children]
|
|
178
|
+
});
|
|
179
|
+
});
|
|
48
180
|
//#endregion
|
|
49
|
-
export { Field, FieldDescription, FieldError, FieldHeader, FieldHint, FieldLabel };
|
|
181
|
+
export { Field, FieldDescription, FieldError, FieldGrid, FieldHeader, FieldHint, FieldLabel, FieldSet, useField };
|
|
50
182
|
|
|
51
183
|
//# sourceMappingURL=field.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.js","names":[],"sources":["../../src/components/field.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { cn } from '../lib/utils';\n\nfunction Field({ className, ...props }: React.ComponentProps<'div'>) {\n return <div data-slot=\"field\" className={cn('grid gap-1.5', className)} {...props} />;\n}\n\nfunction FieldHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"field-header\"\n className={cn('flex items-baseline justify-between gap-3', className)}\n {...props}\n />\n );\n}\n\nfunction FieldLabel({ className, ...props }: React.ComponentProps<'label'>) {\n return (\n // Callers pass htmlFor (or wrap the control); the rule cannot see through the spread.\n // eslint-disable-next-line jsx-a11y/label-has-associated-control\n <label\n data-slot=\"field-label\"\n className={cn('text-[13px] font-semibold text-foreground', className)}\n {...props}\n />\n );\n}\n\nfunction FieldHint({ className, ...props }: React.ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"field-hint\"\n className={cn('text-xs text-muted-foreground', className)}\n {...props}\n />\n );\n}\n\nfunction FieldDescription({ className, ...props }: React.ComponentProps<'p'>) {\n return (\n <p\n data-slot=\"field-description\"\n className={cn('text-xs leading-5 text-muted-foreground', className)}\n {...props}\n />\n );\n}\n\nfunction FieldError({ className, ...props }: React.ComponentProps<'p'>) {\n return (\n <p\n data-slot=\"field-error\"\n role=\"alert\"\n className={cn('text-xs font-medium text-destructive', className)}\n {...props}\n />\n );\n}\n\nexport { Field, FieldDescription, FieldError, FieldHeader, FieldHint, FieldLabel };\n"],"mappings":";;;;AAIA,SAAS,MAAM,EAAE,WAAW,GAAG,SAAsC;CACnE,OAAO,oBAAC,OAAD;EAAK,aAAU;EAAQ,WAAW,GAAG,gBAAgB,SAAS;EAAG,GAAI;CAAQ,CAAA;AACtF;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,SAAsC;CACzE,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GAAG,6CAA6C,SAAS;EACpE,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,WAAW,EAAE,WAAW,GAAG,SAAwC;CAC1E,OAGE,oBAAC,SAAD;EACE,aAAU;EACV,WAAW,GAAG,6CAA6C,SAAS;EACpE,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,UAAU,EAAE,WAAW,GAAG,SAAuC;CACxE,OACE,oBAAC,QAAD;EACE,aAAU;EACV,WAAW,GAAG,iCAAiC,SAAS;EACxD,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,iBAAiB,EAAE,WAAW,GAAG,SAAoC;CAC5E,OACE,oBAAC,KAAD;EACE,aAAU;EACV,WAAW,GAAG,2CAA2C,SAAS;EAClE,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,WAAW,EAAE,WAAW,GAAG,SAAoC;CACtE,OACE,oBAAC,KAAD;EACE,aAAU;EACV,MAAK;EACL,WAAW,GAAG,wCAAwC,SAAS;EAC/D,GAAI;CACL,CAAA;AAEL"}
|
|
1
|
+
{"version":3,"file":"field.js","names":[],"sources":["../../src/components/field.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { cn } from '../lib/utils';\n\nimport { Select, SelectTrigger } from './select';\n\n/*\n * Label, hint, description and error around a control. Two ways in:\n *\n * <Field label=\"Name\" description=\"Shown in logs\" error={error}>\n * <Input />\n * </Field>\n *\n * wires the control's id, aria-describedby, aria-invalid and aria-required\n * for you (one control as the child; `group` for several), or compose the\n * parts yourself: <Field><FieldLabel htmlFor=…/><Input id=…/><FieldError/></Field>.\n */\n\nexport interface FieldContextValue {\n /** The control's id (the label points at it). */\n id: string;\n /** Ids of the description and error, for aria-describedby. */\n describedBy?: string;\n invalid: boolean;\n required?: boolean;\n}\n\nconst FieldContext = React.createContext<FieldContextValue | null>(null);\n\n/** The enclosing Field's id and aria wiring, for a custom control made of several inputs. */\nexport const useField = () => React.useContext(FieldContext);\n\nexport interface FieldProps extends React.ComponentProps<'div'> {\n /** Sets the recipe: a label above the control. */\n label?: React.ReactNode;\n /** Help under the control. */\n description?: React.ReactNode;\n /** An error under the control; sets aria-invalid on it. */\n error?: React.ReactNode;\n /** Right of the label: a status, a count. `optional` shows \"Optional\". */\n hint?: React.ReactNode;\n optional?: boolean;\n /** Sets aria-required on the control. (Mark whichever is rarer in the form, optional or required.) */\n required?: boolean;\n /**\n * The child is a group of inputs (a time range), not one control: the label\n * names the group and each input keeps its own aria-label.\n */\n group?: boolean;\n /** Across every column of a FieldGrid. */\n span?: boolean;\n}\n\nconst wire = (\n el: React.ReactElement<Record<string, unknown>>,\n ctx: FieldContextValue,\n): React.ReactElement =>\n React.cloneElement(el, {\n id: el.props.id ?? ctx.id,\n 'aria-describedby': el.props['aria-describedby'] ?? ctx.describedBy,\n 'aria-invalid': el.props['aria-invalid'] ?? (ctx.invalid || undefined),\n 'aria-required': el.props['aria-required'] ?? (ctx.required || undefined),\n });\n\n/** The control the label points at: a kit Select's trigger, else the child itself. */\nfunction wireControl(children: React.ReactNode, ctx: FieldContextValue): React.ReactNode {\n if (!React.isValidElement<Record<string, unknown>>(children)) return children;\n if (children.type === Select)\n return React.cloneElement(children, {\n children: React.Children.map(children.props.children as React.ReactNode, (c) =>\n React.isValidElement<Record<string, unknown>>(c) && c.type === SelectTrigger\n ? wire(c, ctx)\n : c,\n ),\n });\n return wire(children, ctx);\n}\n\nconst Field = React.forwardRef<HTMLDivElement, FieldProps>(function Field(\n {\n label,\n description,\n error,\n hint,\n optional,\n required,\n group,\n span,\n id: idProp,\n className,\n children,\n ...props\n },\n ref,\n) {\n const auto = React.useId();\n const recipe = label !== undefined;\n if (!recipe)\n return (\n <div\n ref={ref}\n id={idProp}\n data-slot=\"field\"\n className={cn('grid gap-1.5', span && 'sm:col-span-full', className)}\n {...props}\n >\n {children}\n </div>\n );\n const id = idProp ?? `f${auto.replace(/:/g, '')}`;\n const descriptionId = description ? `${id}-description` : undefined;\n const errorId = error ? `${id}-error` : undefined;\n const describedBy = [errorId, descriptionId].filter(Boolean).join(' ') || undefined;\n const ctx: FieldContextValue = { id, describedBy, invalid: Boolean(error), required };\n return (\n <FieldContext.Provider value={ctx}>\n <div\n ref={ref}\n data-slot=\"field\"\n data-invalid={error ? '' : undefined}\n role={group ? 'group' : undefined}\n aria-labelledby={group ? `${id}-label` : undefined}\n aria-describedby={group ? describedBy : undefined}\n className={cn(\n 'grid min-w-0 grid-cols-[minmax(0,1fr)] content-start',\n // In a FieldGrid each field spans three rows of the subgrid, so\n // labels, controls and help in one row share their top edges.\n '[[data-slot=field-grid]>&]:row-span-3 [[data-slot=field-grid]>&]:grid-rows-subgrid',\n span && 'sm:col-span-full',\n className,\n )}\n {...props}\n >\n <FieldHeader className=\"min-h-5 items-end pb-1.5\">\n {group ? (\n <span id={`${id}-label`} data-slot=\"field-label\" className={labelClasses}>\n {label}\n </span>\n ) : (\n <FieldLabel htmlFor={id}>{label}</FieldLabel>\n )}\n {(hint || optional) && (\n <FieldHint className=\"shrink-0 leading-5\">{hint ?? 'Optional'}</FieldHint>\n )}\n </FieldHeader>\n <div className=\"flex min-w-0 items-start\">\n {group ? children : wireControl(children, ctx)}\n </div>\n <div className=\"grid content-start gap-1 pt-1.5 empty:hidden\">\n {error && <FieldError id={errorId}>{error}</FieldError>}\n {description && <FieldDescription id={descriptionId}>{description}</FieldDescription>}\n </div>\n </div>\n </FieldContext.Provider>\n );\n});\n\nconst labelClasses = 'text-[13px] leading-5 font-semibold text-foreground';\n\nconst FieldHeader = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(\n function FieldHeader({ className, ...props }, ref) {\n return (\n <div\n ref={ref}\n data-slot=\"field-header\"\n className={cn('flex items-baseline justify-between gap-3', className)}\n {...props}\n />\n );\n },\n);\n\nconst FieldLabel = React.forwardRef<HTMLLabelElement, React.ComponentProps<'label'>>(\n function FieldLabel({ className, ...props }, ref) {\n return (\n // Callers pass htmlFor (or wrap the control); the rule cannot see through the spread.\n // eslint-disable-next-line jsx-a11y/label-has-associated-control\n <label ref={ref} data-slot=\"field-label\" className={cn(labelClasses, className)} {...props} />\n );\n },\n);\n\nconst FieldHint = React.forwardRef<HTMLSpanElement, React.ComponentProps<'span'>>(\n function FieldHint({ className, ...props }, ref) {\n return (\n <span\n ref={ref}\n data-slot=\"field-hint\"\n className={cn('text-xs text-muted-foreground', className)}\n {...props}\n />\n );\n },\n);\n\nconst FieldDescription = React.forwardRef<HTMLParagraphElement, React.ComponentProps<'p'>>(\n function FieldDescription({ className, ...props }, ref) {\n return (\n <p\n ref={ref}\n data-slot=\"field-description\"\n className={cn('text-xs leading-5 text-muted-foreground', className)}\n {...props}\n />\n );\n },\n);\n\nconst FieldError = React.forwardRef<HTMLParagraphElement, React.ComponentProps<'p'>>(\n function FieldError({ className, ...props }, ref) {\n return (\n <p\n ref={ref}\n data-slot=\"field-error\"\n role=\"alert\"\n className={cn('text-xs leading-5 font-medium text-destructive', className)}\n {...props}\n />\n );\n },\n);\n\nconst gridColumns = {\n 1: '',\n 2: 'sm:grid-cols-2',\n 3: 'sm:grid-cols-3',\n 4: 'sm:grid-cols-2 xl:grid-cols-4',\n} as const;\n\nexport interface FieldGridProps extends React.ComponentProps<'div'> {\n /** Columns from 640px up; one column on phones. */\n columns?: keyof typeof gridColumns;\n}\n\n/**\n * Fields side by side. Each recipe Field spans three rows of a subgrid\n * (label, control, help), so the controls in a row share a top edge even\n * when one label wraps or one field has help and its neighbour does not.\n */\nconst FieldGrid = React.forwardRef<HTMLDivElement, FieldGridProps>(function FieldGrid(\n { columns = 2, className, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"field-grid\"\n className={cn(\n // Rows are spaced by each child's bottom margin, so a field's label,\n // control and help sit in rows of their own with no gap between them.\n '-mb-5 grid min-w-0 grid-cols-[minmax(0,1fr)] gap-x-4 gap-y-0 [&>*]:mb-5',\n gridColumns[columns],\n className,\n )}\n {...props}\n />\n );\n});\n\nexport interface FieldSetProps extends React.ComponentProps<'fieldset'> {\n /** The group's name, as its legend. */\n legend?: React.ReactNode;\n description?: React.ReactNode;\n /** Beside the legend, right-aligned: a count, a small button. */\n action?: React.ReactNode;\n}\n\n/**\n * A titled group of fields. Sets stack with a rule between them; `disabled`\n * greys and locks everything inside. The legend names the fieldset through\n * aria-labelledby, so it can sit in a row with the action.\n */\nconst FieldSet = React.forwardRef<HTMLFieldSetElement, FieldSetProps>(function FieldSet(\n { legend, description, action, className, children, ...props },\n ref,\n) {\n const id = React.useId();\n return (\n <fieldset\n ref={ref}\n data-slot=\"field-set\"\n aria-labelledby={legend ? `${id}-legend` : undefined}\n aria-describedby={description ? `${id}-description` : undefined}\n className={cn(\n 'grid min-w-0 gap-4 border-border [&+&]:border-t [&+&]:pt-5 disabled:opacity-60',\n className,\n )}\n {...props}\n >\n {(legend || action) && (\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"grid gap-1\">\n {legend && (\n <div\n id={`${id}-legend`}\n data-slot=\"field-set-legend\"\n className=\"text-sm leading-5 font-semibold\"\n >\n {legend}\n </div>\n )}\n {description && (\n <p id={`${id}-description`} className=\"text-[13px] leading-5 text-muted-foreground\">\n {description}\n </p>\n )}\n </div>\n {action}\n </div>\n )}\n {children}\n </fieldset>\n );\n});\n\nexport {\n Field,\n FieldDescription,\n FieldError,\n FieldGrid,\n FieldHeader,\n FieldHint,\n FieldLabel,\n FieldSet,\n};\n"],"mappings":"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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface FormActionsProps extends React.ComponentProps<'div'> {
|
|
3
|
+
/** Cancel, Back or Delete: left-aligned on wide screens, first in the row on phones. */
|
|
4
|
+
start?: React.ReactNode;
|
|
5
|
+
/**
|
|
6
|
+
* On phones the row is pinned to the bottom of the screen, above the home
|
|
7
|
+
* indicator, while the form scrolls under it. For a page's own form, not
|
|
8
|
+
* one inside a card or a dialog.
|
|
9
|
+
*/
|
|
10
|
+
sticky?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A form's buttons. Wide screens: right-aligned, the primary last, with
|
|
14
|
+
* `start` on the left. Phones: one row, the buttons sharing the width and
|
|
15
|
+
* the primary (the last one) taking twice the share.
|
|
16
|
+
*/
|
|
17
|
+
declare const FormActions: React.ForwardRefExoticComponent<Omit<FormActionsProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
18
|
+
export { FormActions };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/utils.js";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/form-actions.tsx
|
|
6
|
+
/**
|
|
7
|
+
* A form's buttons. Wide screens: right-aligned, the primary last, with
|
|
8
|
+
* `start` on the left. Phones: one row, the buttons sharing the width and
|
|
9
|
+
* the primary (the last one) taking twice the share.
|
|
10
|
+
*/
|
|
11
|
+
var FormActions = React.forwardRef(function FormActions({ start, sticky, className, children, ...props }, ref) {
|
|
12
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
13
|
+
ref,
|
|
14
|
+
"data-slot": "form-actions",
|
|
15
|
+
"data-sticky": sticky || void 0,
|
|
16
|
+
className: cn("flex items-center gap-2", "max-sm:*:contents max-sm:**:data-[slot=button]:min-w-0 max-sm:**:data-[slot=button]:flex-1", "max-sm:[&>div:last-child>[data-slot=button]:last-child]:flex-[2]", sticky && "max-sm:sticky max-sm:bottom-0 max-sm:z-20 max-sm:-mx-4 max-sm:border-t max-sm:border-border max-sm:bg-background/95 max-sm:px-4 max-sm:pt-3 max-sm:pb-[max(0.75rem,env(safe-area-inset-bottom))] max-sm:backdrop-blur-md", className),
|
|
17
|
+
...props,
|
|
18
|
+
children: [start && /* @__PURE__ */ jsx("div", {
|
|
19
|
+
className: "mr-auto flex items-center gap-2",
|
|
20
|
+
children: start
|
|
21
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
22
|
+
className: "ml-auto flex items-center gap-2",
|
|
23
|
+
children
|
|
24
|
+
})]
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
//#endregion
|
|
28
|
+
export { FormActions };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=form-actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-actions.js","names":[],"sources":["../../src/components/form-actions.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { cn } from '../lib/utils';\n\nexport interface FormActionsProps extends React.ComponentProps<'div'> {\n /** Cancel, Back or Delete: left-aligned on wide screens, first in the row on phones. */\n start?: React.ReactNode;\n /**\n * On phones the row is pinned to the bottom of the screen, above the home\n * indicator, while the form scrolls under it. For a page's own form, not\n * one inside a card or a dialog.\n */\n sticky?: boolean;\n}\n\n/**\n * A form's buttons. Wide screens: right-aligned, the primary last, with\n * `start` on the left. Phones: one row, the buttons sharing the width and\n * the primary (the last one) taking twice the share.\n */\nconst FormActions = React.forwardRef<HTMLDivElement, FormActionsProps>(function FormActions(\n { start, sticky, className, children, ...props },\n ref,\n) {\n return (\n <div\n ref={ref}\n data-slot=\"form-actions\"\n data-sticky={sticky || undefined}\n className={cn(\n 'flex items-center gap-2',\n // Phone: the two groups dissolve into one row; the primary is widest.\n 'max-sm:*:contents max-sm:**:data-[slot=button]:min-w-0 max-sm:**:data-[slot=button]:flex-1',\n 'max-sm:[&>div:last-child>[data-slot=button]:last-child]:flex-[2]',\n sticky &&\n 'max-sm:sticky max-sm:bottom-0 max-sm:z-20 max-sm:-mx-4 max-sm:border-t max-sm:border-border max-sm:bg-background/95 max-sm:px-4 max-sm:pt-3 max-sm:pb-[max(0.75rem,env(safe-area-inset-bottom))] max-sm:backdrop-blur-md',\n className,\n )}\n {...props}\n >\n {start && <div className=\"mr-auto flex items-center gap-2\">{start}</div>}\n <div className=\"ml-auto flex items-center gap-2\">{children}</div>\n </div>\n );\n});\n\nexport { FormActions };\n"],"mappings":";;;;;;;;;;AAoBA,IAAM,cAAc,MAAM,WAA6C,SAAS,YAC9E,EAAE,OAAO,QAAQ,WAAW,UAAU,GAAG,SACzC,KACA;CACA,OACE,qBAAC,OAAD;EACO;EACL,aAAU;EACV,eAAa,UAAU,KAAA;EACvB,WAAW,GACT,2BAEA,8FACA,oEACA,UACE,4NACF,SACF;EACA,GAAI;EAbN,UAAA,CAeG,SAAS,oBAAC,OAAD;GAAK,WAAU;GAAmC,UAAA;EAAW,CAAA,GACvE,oBAAC,OAAD;GAAK,WAAU;GAAmC;EAAc,CAAA,CAC7D;;AAET,CAAC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type ButtonProps } from './button';
|
|
3
3
|
export interface IconButtonProps extends Omit<ButtonProps, 'children'> {
|
|
4
|
+
/** The accessible name, also the tooltip: "Open terminal". */
|
|
4
5
|
label: string;
|
|
5
6
|
children: React.ReactNode;
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
+
/** An icon-only Button with its name built in. Keeps `data-slot="button"`, since it is one. */
|
|
9
|
+
declare const IconButton: React.ForwardRefExoticComponent<Omit<IconButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
8
10
|
export { IconButton };
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { cn } from "../lib/utils.js";
|
|
2
3
|
import { Button } from "./button.js";
|
|
3
|
-
import "react";
|
|
4
|
+
import * as React from "react";
|
|
4
5
|
import { jsx } from "react/jsx-runtime";
|
|
5
6
|
//#region src/components/icon-button.tsx
|
|
6
|
-
|
|
7
|
+
/** An icon-only Button with its name built in. Keeps `data-slot="button"`, since it is one. */
|
|
8
|
+
var IconButton = React.forwardRef(function IconButton({ label, className, children, size = "icon", ...props }, ref) {
|
|
7
9
|
return /* @__PURE__ */ jsx(Button, {
|
|
10
|
+
ref,
|
|
8
11
|
"aria-label": label,
|
|
9
12
|
title: props.title ?? label,
|
|
10
13
|
size,
|
|
@@ -12,7 +15,7 @@ function IconButton({ label, className, children, size = "icon", ...props }) {
|
|
|
12
15
|
...props,
|
|
13
16
|
children
|
|
14
17
|
});
|
|
15
|
-
}
|
|
18
|
+
});
|
|
16
19
|
//#endregion
|
|
17
20
|
export { IconButton };
|
|
18
21
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon-button.js","names":[],"sources":["../../src/components/icon-button.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { cn } from '../lib/utils';\n\nimport { Button, type ButtonProps } from './button';\n\nexport interface IconButtonProps extends Omit<ButtonProps, 'children'> {\n label: string;\n children: React.ReactNode;\n}\n\
|
|
1
|
+
{"version":3,"file":"icon-button.js","names":[],"sources":["../../src/components/icon-button.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { cn } from '../lib/utils';\n\nimport { Button, type ButtonProps } from './button';\n\nexport interface IconButtonProps extends Omit<ButtonProps, 'children'> {\n /** The accessible name, also the tooltip: \"Open terminal\". */\n label: string;\n children: React.ReactNode;\n}\n\n/** An icon-only Button with its name built in. Keeps `data-slot=\"button\"`, since it is one. */\nconst IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(function IconButton(\n { label, className, children, size = 'icon', ...props },\n ref,\n) {\n return (\n <Button\n ref={ref}\n aria-label={label}\n title={props.title ?? label}\n size={size}\n className={cn('rounded-md', className)}\n {...props}\n >\n {children}\n </Button>\n );\n});\n\nexport { IconButton };\n"],"mappings":";;;;;;;AAaA,IAAM,aAAa,MAAM,WAA+C,SAAS,WAC/E,EAAE,OAAO,WAAW,UAAU,OAAO,QAAQ,GAAG,SAChD,KACA;CACA,OACE,oBAAC,QAAD;EACO;EACL,cAAY;EACZ,OAAO,MAAM,SAAS;EAChB;EACN,WAAW,GAAG,cAAc,SAAS;EACrC,GAAI;EAEH;CACK,CAAA;AAEZ,CAAC"}
|
|
@@ -4,15 +4,50 @@ import * as React from 'react';
|
|
|
4
4
|
* one (Composer, a bordered Command): the border turns the ring colour and a
|
|
5
5
|
* 1px inset ring doubles it to 2px. It sits inside the border box, so it
|
|
6
6
|
* follows the radius exactly and no overflow can clip it. The outline is
|
|
7
|
-
* suppressed with !important
|
|
8
|
-
* would otherwise beat the utilities layer and draw a second, offset box
|
|
9
|
-
*
|
|
7
|
+
* suppressed with !important (an app's unlayered `:focus-visible { outline }`
|
|
8
|
+
* would otherwise beat the utilities layer and draw a second, offset box) and
|
|
9
|
+
* comes back as a system-colour outline in forced-colors mode, where no ring
|
|
10
|
+
* colour survives.
|
|
10
11
|
*/
|
|
11
|
-
export declare const fieldFocusClasses = "outline-
|
|
12
|
+
export declare const fieldFocusClasses = "outline-none! forced-colors:focus-visible:[outline:2px_solid_Highlight]! forced-colors:focus-visible:outline-offset-2 focus-visible:border-ring focus-visible:inset-ring-1 focus-visible:inset-ring-ring aria-invalid:focus-visible:inset-ring-destructive";
|
|
12
13
|
/**
|
|
13
14
|
* Fields and field-like triggers: 10px radius (radius-md). Popovers are 12px
|
|
14
15
|
* (radius-lg) and their rows 8px (radius-sm: 12px less the 4px inset).
|
|
16
|
+
* Placeholder text is the muted foreground at full strength (4.5:1 on the
|
|
17
|
+
* field); disabled fields fill with muted and dim.
|
|
15
18
|
*/
|
|
16
|
-
export declare const fieldClasses = "w-full min-w-0 rounded-md border border-input bg-surface px-3 text-base sm:text-sm text-foreground shadow-xs transition-[border-color,box-shadow,background-color] placeholder:text-muted-foreground
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
export declare const fieldClasses = "w-full min-w-0 rounded-md border border-input bg-surface px-3 text-base sm:text-sm text-foreground shadow-xs transition-[border-color,box-shadow,background-color] placeholder:text-muted-foreground hover:border-border-strong outline-none! forced-colors:focus-visible:[outline:2px_solid_Highlight]! forced-colors:focus-visible:outline-offset-2 focus-visible:border-ring focus-visible:inset-ring-1 focus-visible:inset-ring-ring aria-invalid:focus-visible:inset-ring-destructive disabled:cursor-not-allowed disabled:bg-muted disabled:opacity-60 aria-invalid:border-destructive dark:bg-surface-raised";
|
|
20
|
+
/**
|
|
21
|
+
* Field widths by what goes in them, on the 4px scale. Every width is full on
|
|
22
|
+
* a phone (fields stack there); from 640px a field takes the width its
|
|
23
|
+
* content needs, so a row of them reads as a form rather than a column of
|
|
24
|
+
* bars. `full` always fills the row.
|
|
25
|
+
*/
|
|
26
|
+
export declare const fieldWidthClasses: {
|
|
27
|
+
/** 2–4 digits: minutes, a percentage, a count. */
|
|
28
|
+
readonly xs: "w-full sm:w-24";
|
|
29
|
+
/** Money, gallons, a year, a time of day. */
|
|
30
|
+
readonly sm: "w-full sm:w-36";
|
|
31
|
+
/** A date, a short code, a short choice. */
|
|
32
|
+
readonly md: "w-full sm:w-48";
|
|
33
|
+
/** Names, emails, most choices: capped so they do not run across a wide card. */
|
|
34
|
+
readonly lg: "w-full sm:max-w-sm";
|
|
35
|
+
readonly full: "w-full";
|
|
36
|
+
};
|
|
37
|
+
export type FieldWidth = keyof typeof fieldWidthClasses;
|
|
38
|
+
export interface InputProps extends React.ComponentProps<'input'> {
|
|
39
|
+
/** How wide the field is from 640px up; full width on phones. */
|
|
40
|
+
width?: FieldWidth;
|
|
41
|
+
}
|
|
42
|
+
declare const Input: React.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
43
|
+
export interface SearchInputProps extends Omit<InputProps, 'type'> {
|
|
44
|
+
/** Classes for the wrapper that positions the icon; `className` goes to the input. */
|
|
45
|
+
containerClassName?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A search box: the magnifier inside the field, `type="search"` for the
|
|
49
|
+
* browser's clear control and the search key on phone keyboards, and Enter
|
|
50
|
+
* left to the form. Name it with `aria-label`, `aria-labelledby` or a Label.
|
|
51
|
+
*/
|
|
52
|
+
declare const SearchInput: React.ForwardRefExoticComponent<Omit<SearchInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
53
|
+
export { Input, SearchInput };
|
package/dist/components/input.js
CHANGED
|
@@ -1,32 +1,76 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn, noOutlineClasses } from "../lib/utils.js";
|
|
2
3
|
import * as React from "react";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import Search from "@burtson-labs/icons/react/search";
|
|
4
6
|
//#region src/components/input.tsx
|
|
5
7
|
/**
|
|
6
8
|
* Keyboard focus for anything that is a text field, or a box that contains
|
|
7
9
|
* one (Composer, a bordered Command): the border turns the ring colour and a
|
|
8
10
|
* 1px inset ring doubles it to 2px. It sits inside the border box, so it
|
|
9
11
|
* follows the radius exactly and no overflow can clip it. The outline is
|
|
10
|
-
* suppressed with !important
|
|
11
|
-
* would otherwise beat the utilities layer and draw a second, offset box
|
|
12
|
-
*
|
|
12
|
+
* suppressed with !important (an app's unlayered `:focus-visible { outline }`
|
|
13
|
+
* would otherwise beat the utilities layer and draw a second, offset box) and
|
|
14
|
+
* comes back as a system-colour outline in forced-colors mode, where no ring
|
|
15
|
+
* colour survives.
|
|
13
16
|
*/
|
|
14
|
-
var fieldFocusClasses =
|
|
17
|
+
var fieldFocusClasses = `${noOutlineClasses} focus-visible:border-ring focus-visible:inset-ring-1 focus-visible:inset-ring-ring aria-invalid:focus-visible:inset-ring-destructive`;
|
|
15
18
|
/**
|
|
16
19
|
* Fields and field-like triggers: 10px radius (radius-md). Popovers are 12px
|
|
17
20
|
* (radius-lg) and their rows 8px (radius-sm: 12px less the 4px inset).
|
|
21
|
+
* Placeholder text is the muted foreground at full strength (4.5:1 on the
|
|
22
|
+
* field); disabled fields fill with muted and dim.
|
|
18
23
|
*/
|
|
19
|
-
var fieldClasses = `w-full min-w-0 rounded-md border border-input bg-surface px-3 text-base sm:text-sm text-foreground shadow-xs transition-[border-color,box-shadow,background-color] placeholder:text-muted-foreground
|
|
20
|
-
|
|
24
|
+
var fieldClasses = `w-full min-w-0 rounded-md border border-input bg-surface px-3 text-base sm:text-sm text-foreground shadow-xs transition-[border-color,box-shadow,background-color] placeholder:text-muted-foreground hover:border-border-strong ${fieldFocusClasses} disabled:cursor-not-allowed disabled:bg-muted disabled:opacity-60 aria-invalid:border-destructive dark:bg-surface-raised`;
|
|
25
|
+
/**
|
|
26
|
+
* Field widths by what goes in them, on the 4px scale. Every width is full on
|
|
27
|
+
* a phone (fields stack there); from 640px a field takes the width its
|
|
28
|
+
* content needs, so a row of them reads as a form rather than a column of
|
|
29
|
+
* bars. `full` always fills the row.
|
|
30
|
+
*/
|
|
31
|
+
var fieldWidthClasses = {
|
|
32
|
+
/** 2–4 digits: minutes, a percentage, a count. */
|
|
33
|
+
xs: "w-full sm:w-24",
|
|
34
|
+
/** Money, gallons, a year, a time of day. */
|
|
35
|
+
sm: "w-full sm:w-36",
|
|
36
|
+
/** A date, a short code, a short choice. */
|
|
37
|
+
md: "w-full sm:w-48",
|
|
38
|
+
/** Names, emails, most choices: capped so they do not run across a wide card. */
|
|
39
|
+
lg: "w-full sm:max-w-sm",
|
|
40
|
+
full: "w-full"
|
|
41
|
+
};
|
|
42
|
+
var Input = React.forwardRef(function Input({ className, type, width, ...props }, ref) {
|
|
21
43
|
return /* @__PURE__ */ jsx("input", {
|
|
22
44
|
ref,
|
|
23
45
|
type,
|
|
24
46
|
"data-slot": "input",
|
|
25
|
-
className: cn(fieldClasses, "h-9 py-1.5 file:mr-3 file:border-0 file:bg-transparent file:text-sm file:font-semibold file:text-foreground", className),
|
|
47
|
+
className: cn(fieldClasses, "h-9 py-1.5 file:mr-3 file:border-0 file:bg-transparent file:text-sm file:font-semibold file:text-foreground", width && fieldWidthClasses[width], className),
|
|
26
48
|
...props
|
|
27
49
|
});
|
|
28
50
|
});
|
|
51
|
+
/**
|
|
52
|
+
* A search box: the magnifier inside the field, `type="search"` for the
|
|
53
|
+
* browser's clear control and the search key on phone keyboards, and Enter
|
|
54
|
+
* left to the form. Name it with `aria-label`, `aria-labelledby` or a Label.
|
|
55
|
+
*/
|
|
56
|
+
var SearchInput = React.forwardRef(function SearchInput({ className, containerClassName, width, ...props }, ref) {
|
|
57
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
58
|
+
"data-slot": "search-input",
|
|
59
|
+
className: cn("relative flex min-w-0", width ? fieldWidthClasses[width] : "w-full", containerClassName),
|
|
60
|
+
children: [/* @__PURE__ */ jsx(Search, {
|
|
61
|
+
"aria-hidden": true,
|
|
62
|
+
className: "pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"
|
|
63
|
+
}), /* @__PURE__ */ jsx(Input, {
|
|
64
|
+
ref,
|
|
65
|
+
type: "search",
|
|
66
|
+
autoComplete: "off",
|
|
67
|
+
enterKeyHint: "search",
|
|
68
|
+
className: cn("pl-9", className),
|
|
69
|
+
...props
|
|
70
|
+
})]
|
|
71
|
+
});
|
|
72
|
+
});
|
|
29
73
|
//#endregion
|
|
30
|
-
export { Input, fieldClasses, fieldFocusClasses };
|
|
74
|
+
export { Input, SearchInput, fieldClasses, fieldFocusClasses, fieldWidthClasses };
|
|
31
75
|
|
|
32
76
|
//# sourceMappingURL=input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","names":[],"sources":["../../src/components/input.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { cn } from '../lib/utils';\n\n/**\n * Keyboard focus for anything that is a text field, or a box that contains\n * one (Composer, a bordered Command): the border turns the ring colour and a\n * 1px inset ring doubles it to 2px. It sits inside the border box, so it\n * follows the radius exactly and no overflow can clip it. The outline is\n * suppressed with !important
|
|
1
|
+
{"version":3,"file":"input.js","names":[],"sources":["../../src/components/input.tsx"],"sourcesContent":["import Search from '@burtson-labs/icons/react/search';\nimport * as React from 'react';\n\nimport { cn, noOutlineClasses } from '../lib/utils';\n\n/**\n * Keyboard focus for anything that is a text field, or a box that contains\n * one (Composer, a bordered Command): the border turns the ring colour and a\n * 1px inset ring doubles it to 2px. It sits inside the border box, so it\n * follows the radius exactly and no overflow can clip it. The outline is\n * suppressed with !important (an app's unlayered `:focus-visible { outline }`\n * would otherwise beat the utilities layer and draw a second, offset box) and\n * comes back as a system-colour outline in forced-colors mode, where no ring\n * colour survives.\n */\nexport const fieldFocusClasses = `${noOutlineClasses} focus-visible:border-ring focus-visible:inset-ring-1 focus-visible:inset-ring-ring aria-invalid:focus-visible:inset-ring-destructive`;\n\n/**\n * Fields and field-like triggers: 10px radius (radius-md). Popovers are 12px\n * (radius-lg) and their rows 8px (radius-sm: 12px less the 4px inset).\n * Placeholder text is the muted foreground at full strength (4.5:1 on the\n * field); disabled fields fill with muted and dim.\n */\nexport const fieldClasses = `w-full min-w-0 rounded-md border border-input bg-surface px-3 text-base sm:text-sm text-foreground shadow-xs transition-[border-color,box-shadow,background-color] placeholder:text-muted-foreground hover:border-border-strong ${fieldFocusClasses} disabled:cursor-not-allowed disabled:bg-muted disabled:opacity-60 aria-invalid:border-destructive dark:bg-surface-raised`;\n\n/**\n * Field widths by what goes in them, on the 4px scale. Every width is full on\n * a phone (fields stack there); from 640px a field takes the width its\n * content needs, so a row of them reads as a form rather than a column of\n * bars. `full` always fills the row.\n */\nexport const fieldWidthClasses = {\n /** 2–4 digits: minutes, a percentage, a count. */\n xs: 'w-full sm:w-24',\n /** Money, gallons, a year, a time of day. */\n sm: 'w-full sm:w-36',\n /** A date, a short code, a short choice. */\n md: 'w-full sm:w-48',\n /** Names, emails, most choices: capped so they do not run across a wide card. */\n lg: 'w-full sm:max-w-sm',\n full: 'w-full',\n} as const;\n\nexport type FieldWidth = keyof typeof fieldWidthClasses;\n\nexport interface InputProps extends React.ComponentProps<'input'> {\n /** How wide the field is from 640px up; full width on phones. */\n width?: FieldWidth;\n}\n\nconst Input = React.forwardRef<HTMLInputElement, InputProps>(function Input(\n { className, type, width, ...props }: InputProps,\n ref,\n) {\n return (\n <input\n ref={ref}\n type={type}\n data-slot=\"input\"\n className={cn(\n fieldClasses,\n 'h-9 py-1.5 file:mr-3 file:border-0 file:bg-transparent file:text-sm file:font-semibold file:text-foreground',\n width && fieldWidthClasses[width],\n className,\n )}\n {...props}\n />\n );\n});\n\nexport interface SearchInputProps extends Omit<InputProps, 'type'> {\n /** Classes for the wrapper that positions the icon; `className` goes to the input. */\n containerClassName?: string;\n}\n\n/**\n * A search box: the magnifier inside the field, `type=\"search\"` for the\n * browser's clear control and the search key on phone keyboards, and Enter\n * left to the form. Name it with `aria-label`, `aria-labelledby` or a Label.\n */\nconst SearchInput = React.forwardRef<HTMLInputElement, SearchInputProps>(function SearchInput(\n { className, containerClassName, width, ...props }: SearchInputProps,\n ref,\n) {\n return (\n <span\n data-slot=\"search-input\"\n className={cn(\n 'relative flex min-w-0',\n width ? fieldWidthClasses[width] : 'w-full',\n containerClassName,\n )}\n >\n <Search\n aria-hidden\n className=\"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground\"\n />\n <Input\n ref={ref}\n type=\"search\"\n autoComplete=\"off\"\n enterKeyHint=\"search\"\n className={cn('pl-9', className)}\n {...props}\n />\n </span>\n );\n});\n\nexport { Input, SearchInput };\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,IAAa,oBAAoB,GAAG,iBAAiB;;;;;;;AAQrD,IAAa,eAAe,mOAAmO,kBAAkB;;;;;;;AAQjR,IAAa,oBAAoB;;CAE/B,IAAI;;CAEJ,IAAI;;CAEJ,IAAI;;CAEJ,IAAI;CACJ,MAAM;AACR;AASA,IAAM,QAAQ,MAAM,WAAyC,SAAS,MACpE,EAAE,WAAW,MAAM,OAAO,GAAG,SAC7B,KACA;CACA,OACE,oBAAC,SAAD;EACO;EACC;EACN,aAAU;EACV,WAAW,GACT,cACA,+GACA,SAAS,kBAAkB,QAC3B,SACF;EACA,GAAI;CACL,CAAA;AAEL,CAAC;;;;;;AAYD,IAAM,cAAc,MAAM,WAA+C,SAAS,YAChF,EAAE,WAAW,oBAAoB,OAAO,GAAG,SAC3C,KACA;CACA,OACE,qBAAC,QAAD;EACE,aAAU;EACV,WAAW,GACT,yBACA,QAAQ,kBAAkB,SAAS,UACnC,kBACF;EANF,UAAA,CAQE,oBAAC,QAAD;GACE,eAAA;GACA,WAAU;EACX,CAAA,GACD,oBAAC,OAAD;GACO;GACL,MAAK;GACL,cAAa;GACb,cAAa;GACb,WAAW,GAAG,QAAQ,SAAS;GAC/B,GAAI;EACL,CAAA,CACG;;AAEV,CAAC"}
|
package/dist/components/kbd.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
declare
|
|
3
|
-
declare
|
|
2
|
+
declare const Kbd: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
3
|
+
declare const KbdGroup: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
4
4
|
export { Kbd, KbdGroup };
|