@ctrl-ui/react 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -0
- package/dist/action-bar.d.ts +44 -0
- package/dist/action-bar.js +89 -0
- package/dist/activity.d.ts +53 -0
- package/dist/activity.js +188 -0
- package/dist/audio-recorder.d.ts +32 -0
- package/dist/audio-recorder.js +235 -0
- package/dist/audio-visualizer.d.ts +12 -0
- package/dist/audio-visualizer.js +58 -0
- package/dist/blocks/chat.d.ts +10 -0
- package/dist/blocks/chat.js +12 -0
- package/dist/blocks/coding-agent.d.ts +61 -0
- package/dist/blocks/coding-agent.js +255 -0
- package/dist/blocks/file-explorer-data.d.ts +57 -0
- package/dist/blocks/file-explorer-data.js +74 -0
- package/dist/blocks/file-explorer.d.ts +24 -0
- package/dist/blocks/file-explorer.js +427 -0
- package/dist/blocks/settings-data.d.ts +36 -0
- package/dist/blocks/settings-data.js +66 -0
- package/dist/blocks/settings.d.ts +19 -0
- package/dist/blocks/settings.js +282 -0
- package/dist/blocks/theme-toggle.d.ts +43 -0
- package/dist/blocks/theme-toggle.js +180 -0
- package/dist/chat-composer-attachment.d.ts +55 -0
- package/dist/chat-composer-attachment.js +267 -0
- package/dist/chat-composer-editor/extensions/mention.d.ts +14 -0
- package/dist/chat-composer-editor/extensions/mention.js +278 -0
- package/dist/chat-composer-editor/ghost.d.ts +5 -0
- package/dist/chat-composer-editor/ghost.js +55 -0
- package/dist/chat-composer-editor/schema.d.ts +6 -0
- package/dist/chat-composer-editor/schema.js +25 -0
- package/dist/chat-composer-editor/serialize.d.ts +6 -0
- package/dist/chat-composer-editor/serialize.js +16 -0
- package/dist/chat-composer-editor/types.d.ts +29 -0
- package/dist/chat-composer-editor/types.js +0 -0
- package/dist/chat-composer-editor.d.ts +9 -0
- package/dist/chat-composer-editor.js +154 -0
- package/dist/chat-composer.d.ts +60 -0
- package/dist/chat-composer.js +134 -0
- package/dist/chat-layout.d.ts +27 -0
- package/dist/chat-layout.js +114 -0
- package/dist/chat-message.d.ts +31 -0
- package/dist/chat-message.js +95 -0
- package/dist/code-block-editor.d.ts +59 -0
- package/dist/code-block-editor.js +250 -0
- package/dist/context-model.d.ts +33 -0
- package/dist/context-model.js +52 -0
- package/dist/context.d.ts +47 -0
- package/dist/context.js +335 -0
- package/dist/control-props.d.ts +28 -0
- package/dist/control-props.js +4 -0
- package/dist/control-variants.d.ts +8 -0
- package/dist/control-variants.js +14 -0
- package/dist/dynamic-notification-glass.d.ts +10 -0
- package/dist/dynamic-notification-glass.js +311 -0
- package/dist/dynamic-notification-liquid.d.ts +24 -0
- package/dist/dynamic-notification-liquid.js +682 -0
- package/dist/dynamic-notification-siri-wave.d.ts +4 -0
- package/dist/dynamic-notification-siri-wave.js +82 -0
- package/dist/dynamic-notification.d.ts +74 -0
- package/dist/dynamic-notification.js +342 -0
- package/dist/environment-variables.d.ts +124 -0
- package/dist/environment-variables.js +492 -0
- package/dist/extensions/create-track-highlight.d.ts +12 -0
- package/dist/extensions/create-track-highlight.js +147 -0
- package/dist/extensions/track-highlight.d.ts +22 -0
- package/dist/extensions/track-highlight.js +52 -0
- package/dist/hooks/use-audio-recorder.d.ts +107 -0
- package/dist/hooks/use-audio-recorder.js +577 -0
- package/dist/hooks/use-chat-composer.d.ts +56 -0
- package/dist/hooks/use-chat-composer.js +63 -0
- package/dist/hooks/use-chat-message.d.ts +28 -0
- package/dist/hooks/use-chat-message.js +24 -0
- package/dist/hooks/use-color-area.d.ts +18 -0
- package/dist/hooks/use-color-area.js +60 -0
- package/dist/hooks/use-copy-to-clipboard.d.ts +22 -0
- package/dist/hooks/use-copy-to-clipboard.js +90 -0
- package/dist/hooks/use-dropzone.d.ts +59 -0
- package/dist/hooks/use-dropzone.js +372 -0
- package/dist/hooks/use-dynamic-notification.d.ts +37 -0
- package/dist/hooks/use-dynamic-notification.js +87 -0
- package/dist/hooks/use-environment-variables.d.ts +51 -0
- package/dist/hooks/use-environment-variables.js +188 -0
- package/dist/hooks/use-mobile.d.ts +5 -0
- package/dist/hooks/use-mobile.js +29 -0
- package/dist/hooks/use-textarea-trigger-menu.d.ts +8 -0
- package/dist/hooks/use-textarea-trigger-menu.js +69 -0
- package/dist/hooks/use-trigger-menu.d.ts +49 -0
- package/dist/hooks/use-trigger-menu.js +102 -0
- package/dist/hooks/use-user-ask.d.ts +48 -0
- package/dist/hooks/use-user-ask.js +167 -0
- package/dist/inline-attachment.d.ts +37 -0
- package/dist/inline-attachment.js +192 -0
- package/dist/inline-citation.d.ts +56 -0
- package/dist/inline-citation.js +319 -0
- package/dist/knob-contracts/accordion-knobs.d.ts +5 -0
- package/dist/knob-contracts/accordion-knobs.js +9 -0
- package/dist/knob-contracts/action-bar-knobs.d.ts +5 -0
- package/dist/knob-contracts/action-bar-knobs.js +4 -0
- package/dist/knob-contracts/activity-knobs.d.ts +5 -0
- package/dist/knob-contracts/activity-knobs.js +9 -0
- package/dist/knob-contracts/alert-knobs.d.ts +5 -0
- package/dist/knob-contracts/alert-knobs.js +9 -0
- package/dist/knob-contracts/audio-recorder-knobs.d.ts +5 -0
- package/dist/knob-contracts/audio-recorder-knobs.js +9 -0
- package/dist/knob-contracts/audio-visualizer-knobs.d.ts +5 -0
- package/dist/knob-contracts/audio-visualizer-knobs.js +9 -0
- package/dist/knob-contracts/avatar-knobs.d.ts +5 -0
- package/dist/knob-contracts/avatar-knobs.js +9 -0
- package/dist/knob-contracts/badge-knobs.d.ts +5 -0
- package/dist/knob-contracts/badge-knobs.js +9 -0
- package/dist/knob-contracts/button-group-knobs.d.ts +5 -0
- package/dist/knob-contracts/button-group-knobs.js +9 -0
- package/dist/knob-contracts/button-knobs.d.ts +5 -0
- package/dist/knob-contracts/button-knobs.js +25 -0
- package/dist/knob-contracts/calendar-knobs.d.ts +5 -0
- package/dist/knob-contracts/calendar-knobs.js +10 -0
- package/dist/knob-contracts/card-knobs.d.ts +5 -0
- package/dist/knob-contracts/card-knobs.js +11 -0
- package/dist/knob-contracts/chat-composer-attachment-knobs.d.ts +5 -0
- package/dist/knob-contracts/chat-composer-attachment-knobs.js +11 -0
- package/dist/knob-contracts/chat-composer-knobs.d.ts +5 -0
- package/dist/knob-contracts/chat-composer-knobs.js +18 -0
- package/dist/knob-contracts/chat-layout-knobs.d.ts +5 -0
- package/dist/knob-contracts/chat-layout-knobs.js +11 -0
- package/dist/knob-contracts/chat-message-knobs.d.ts +5 -0
- package/dist/knob-contracts/chat-message-knobs.js +17 -0
- package/dist/knob-contracts/choice-knobs.d.ts +5 -0
- package/dist/knob-contracts/choice-knobs.js +9 -0
- package/dist/knob-contracts/code-block-editor-knobs.d.ts +5 -0
- package/dist/knob-contracts/code-block-editor-knobs.js +11 -0
- package/dist/knob-contracts/code-diff-knobs.d.ts +5 -0
- package/dist/knob-contracts/code-diff-knobs.js +18 -0
- package/dist/knob-contracts/code-knobs.d.ts +5 -0
- package/dist/knob-contracts/code-knobs.js +11 -0
- package/dist/knob-contracts/collapsible-knobs.d.ts +5 -0
- package/dist/knob-contracts/collapsible-knobs.js +4 -0
- package/dist/knob-contracts/color-picker-knobs.d.ts +5 -0
- package/dist/knob-contracts/color-picker-knobs.js +12 -0
- package/dist/knob-contracts/context-knobs.d.ts +5 -0
- package/dist/knob-contracts/context-knobs.js +13 -0
- package/dist/knob-contracts/dockable-panel-knobs.d.ts +5 -0
- package/dist/knob-contracts/dockable-panel-knobs.js +12 -0
- package/dist/knob-contracts/dropzone-knobs.d.ts +5 -0
- package/dist/knob-contracts/dropzone-knobs.js +11 -0
- package/dist/knob-contracts/dynamic-notification-knobs.d.ts +5 -0
- package/dist/knob-contracts/dynamic-notification-knobs.js +18 -0
- package/dist/knob-contracts/empty-knobs.d.ts +5 -0
- package/dist/knob-contracts/empty-knobs.js +12 -0
- package/dist/knob-contracts/environment-variables-knobs.d.ts +5 -0
- package/dist/knob-contracts/environment-variables-knobs.js +11 -0
- package/dist/knob-contracts/field-knobs.d.ts +5 -0
- package/dist/knob-contracts/field-knobs.js +16 -0
- package/dist/knob-contracts/gradient-editor-knobs.d.ts +5 -0
- package/dist/knob-contracts/gradient-editor-knobs.js +13 -0
- package/dist/knob-contracts/infinite-canvas-knobs.d.ts +5 -0
- package/dist/knob-contracts/infinite-canvas-knobs.js +13 -0
- package/dist/knob-contracts/inline-attachment-knobs.d.ts +5 -0
- package/dist/knob-contracts/inline-attachment-knobs.js +14 -0
- package/dist/knob-contracts/inline-citation-knobs.d.ts +5 -0
- package/dist/knob-contracts/inline-citation-knobs.js +14 -0
- package/dist/knob-contracts/item-knobs.d.ts +5 -0
- package/dist/knob-contracts/item-knobs.js +10 -0
- package/dist/knob-contracts/kbd-knobs.d.ts +5 -0
- package/dist/knob-contracts/kbd-knobs.js +10 -0
- package/dist/knob-contracts/markdown-block-knobs.d.ts +5 -0
- package/dist/knob-contracts/markdown-block-knobs.js +11 -0
- package/dist/knob-contracts/markdown-knobs.d.ts +5 -0
- package/dist/knob-contracts/markdown-knobs.js +14 -0
- package/dist/knob-contracts/morphing-panel-knobs.d.ts +5 -0
- package/dist/knob-contracts/morphing-panel-knobs.js +11 -0
- package/dist/knob-contracts/pagination-knobs.d.ts +5 -0
- package/dist/knob-contracts/pagination-knobs.js +10 -0
- package/dist/knob-contracts/phone-input-knobs.d.ts +5 -0
- package/dist/knob-contracts/phone-input-knobs.js +10 -0
- package/dist/knob-contracts/popup-knobs.d.ts +5 -0
- package/dist/knob-contracts/popup-knobs.js +21 -0
- package/dist/knob-contracts/range-knobs.d.ts +5 -0
- package/dist/knob-contracts/range-knobs.js +13 -0
- package/dist/knob-contracts/resizable-knobs.d.ts +5 -0
- package/dist/knob-contracts/resizable-knobs.js +14 -0
- package/dist/knob-contracts/rich-tooltip-knobs.d.ts +5 -0
- package/dist/knob-contracts/rich-tooltip-knobs.js +13 -0
- package/dist/knob-contracts/scroll-area-knobs.d.ts +5 -0
- package/dist/knob-contracts/scroll-area-knobs.js +8 -0
- package/dist/knob-contracts/separator-knobs.d.ts +5 -0
- package/dist/knob-contracts/separator-knobs.js +4 -0
- package/dist/knob-contracts/sidebar-knobs.d.ts +5 -0
- package/dist/knob-contracts/sidebar-knobs.js +26 -0
- package/dist/knob-contracts/skeleton-knobs.d.ts +5 -0
- package/dist/knob-contracts/skeleton-knobs.js +4 -0
- package/dist/knob-contracts/source-badge-knobs.d.ts +5 -0
- package/dist/knob-contracts/source-badge-knobs.js +11 -0
- package/dist/knob-contracts/spinner-knobs.d.ts +5 -0
- package/dist/knob-contracts/spinner-knobs.js +4 -0
- package/dist/knob-contracts/stepper-knobs.d.ts +5 -0
- package/dist/knob-contracts/stepper-knobs.js +11 -0
- package/dist/knob-contracts/switch-knobs.d.ts +5 -0
- package/dist/knob-contracts/switch-knobs.js +12 -0
- package/dist/knob-contracts/table-knobs.d.ts +5 -0
- package/dist/knob-contracts/table-knobs.js +12 -0
- package/dist/knob-contracts/table-of-contents-knobs.d.ts +5 -0
- package/dist/knob-contracts/table-of-contents-knobs.js +8 -0
- package/dist/knob-contracts/tabs-knobs.d.ts +5 -0
- package/dist/knob-contracts/tabs-knobs.js +16 -0
- package/dist/knob-contracts/task-list-knobs.d.ts +5 -0
- package/dist/knob-contracts/task-list-knobs.js +14 -0
- package/dist/knob-contracts/thread-rail-knobs.d.ts +5 -0
- package/dist/knob-contracts/thread-rail-knobs.js +14 -0
- package/dist/knob-contracts/timeline-knobs.d.ts +5 -0
- package/dist/knob-contracts/timeline-knobs.js +12 -0
- package/dist/knob-contracts/toolbar-knobs.d.ts +5 -0
- package/dist/knob-contracts/toolbar-knobs.js +20 -0
- package/dist/knob-contracts/track-highlight-knobs.d.ts +5 -0
- package/dist/knob-contracts/track-highlight-knobs.js +11 -0
- package/dist/knob-contracts/transcript-divider-knobs.d.ts +5 -0
- package/dist/knob-contracts/transcript-divider-knobs.js +10 -0
- package/dist/knob-contracts/tree-knobs.d.ts +5 -0
- package/dist/knob-contracts/tree-knobs.js +13 -0
- package/dist/knob-contracts/user-ask-knobs.d.ts +5 -0
- package/dist/knob-contracts/user-ask-knobs.js +17 -0
- package/dist/lib/cn.d.ts +5 -0
- package/dist/lib/cn.js +34 -0
- package/dist/lib/code-block-shiki.d.ts +9 -0
- package/dist/lib/code-block-shiki.js +6 -0
- package/dist/lib/code-tokens.d.ts +28 -0
- package/dist/lib/code-tokens.js +160 -0
- package/dist/lib/color.d.ts +72 -0
- package/dist/lib/color.js +490 -0
- package/dist/lib/contrast.d.ts +30 -0
- package/dist/lib/contrast.js +64 -0
- package/dist/lib/diff.d.ts +50 -0
- package/dist/lib/diff.js +315 -0
- package/dist/lib/dropzone-validation.d.ts +66 -0
- package/dist/lib/dropzone-validation.js +228 -0
- package/dist/lib/env-file.d.ts +28 -0
- package/dist/lib/env-file.js +218 -0
- package/dist/lib/format-audio-recorder-duration.d.ts +4 -0
- package/dist/lib/format-audio-recorder-duration.js +7 -0
- package/dist/lib/liquid-glass-optics.d.ts +4 -0
- package/dist/lib/liquid-glass-optics.js +96 -0
- package/dist/lib/phone-input-format.d.ts +6 -0
- package/dist/lib/phone-input-format.js +26 -0
- package/dist/lib/phone-number.d.ts +18 -0
- package/dist/lib/phone-number.js +28 -0
- package/dist/lib/trigger-detect.d.ts +15 -0
- package/dist/lib/trigger-detect.js +77 -0
- package/dist/markdown-block.d.ts +25 -0
- package/dist/markdown-block.js +77 -0
- package/dist/skin.config.d.ts +5 -0
- package/dist/skin.config.js +4 -0
- package/dist/skin.d.ts +69 -0
- package/dist/skin.js +62 -0
- package/dist/source-badge.d.ts +23 -0
- package/dist/source-badge.js +72 -0
- package/dist/styles/chat-composer-editor.css +44 -0
- package/dist/styles/code.css +57 -0
- package/dist/styles/effects.css +126 -0
- package/dist/styles/index.css +81 -0
- package/dist/styles/recipes/accordion.css +87 -0
- package/dist/styles/recipes/action-bar.css +19 -0
- package/dist/styles/recipes/activity.css +129 -0
- package/dist/styles/recipes/alert.css +75 -0
- package/dist/styles/recipes/audio-recorder.css +102 -0
- package/dist/styles/recipes/audio-visualizer.css +90 -0
- package/dist/styles/recipes/avatar.css +52 -0
- package/dist/styles/recipes/badge.css +110 -0
- package/dist/styles/recipes/button-group.css +64 -0
- package/dist/styles/recipes/button.css +305 -0
- package/dist/styles/recipes/calendar.css +152 -0
- package/dist/styles/recipes/card.css +93 -0
- package/dist/styles/recipes/chat-composer-attachment.css +177 -0
- package/dist/styles/recipes/chat-composer.css +195 -0
- package/dist/styles/recipes/chat-layout.css +108 -0
- package/dist/styles/recipes/chat-message.css +160 -0
- package/dist/styles/recipes/choice.css +108 -0
- package/dist/styles/recipes/code-block-editor.css +136 -0
- package/dist/styles/recipes/code-diff.css +256 -0
- package/dist/styles/recipes/code.css +136 -0
- package/dist/styles/recipes/collapsible.css +27 -0
- package/dist/styles/recipes/color-picker-details.css +61 -0
- package/dist/styles/recipes/color-picker-values.css +117 -0
- package/dist/styles/recipes/color-picker.css +158 -0
- package/dist/styles/recipes/context.css +237 -0
- package/dist/styles/recipes/dockable-panel.css +106 -0
- package/dist/styles/recipes/dropzone.css +149 -0
- package/dist/styles/recipes/dynamic-notification-input.css +29 -0
- package/dist/styles/recipes/dynamic-notification-motion.css +298 -0
- package/dist/styles/recipes/dynamic-notification.css +241 -0
- package/dist/styles/recipes/empty.css +96 -0
- package/dist/styles/recipes/environment-variables.css +173 -0
- package/dist/styles/recipes/field-parts.css +148 -0
- package/dist/styles/recipes/field.css +234 -0
- package/dist/styles/recipes/gradient-editor.css +109 -0
- package/dist/styles/recipes/infinite-canvas.css +78 -0
- package/dist/styles/recipes/inline-attachment.css +182 -0
- package/dist/styles/recipes/inline-citation.css +174 -0
- package/dist/styles/recipes/item.css +107 -0
- package/dist/styles/recipes/kbd.css +55 -0
- package/dist/styles/recipes/markdown-block.css +75 -0
- package/dist/styles/recipes/markdown.css +204 -0
- package/dist/styles/recipes/morphing-panel.css +123 -0
- package/dist/styles/recipes/pagination.css +86 -0
- package/dist/styles/recipes/phone-input.css +105 -0
- package/dist/styles/recipes/popup-controls.css +59 -0
- package/dist/styles/recipes/popup-drawer.css +162 -0
- package/dist/styles/recipes/popup-lists.css +198 -0
- package/dist/styles/recipes/popup-motion.css +94 -0
- package/dist/styles/recipes/popup-toast.css +126 -0
- package/dist/styles/recipes/popup.css +396 -0
- package/dist/styles/recipes/range.css +259 -0
- package/dist/styles/recipes/resizable.css +170 -0
- package/dist/styles/recipes/rich-tooltip.css +272 -0
- package/dist/styles/recipes/scroll-area.css +59 -0
- package/dist/styles/recipes/separator.css +12 -0
- package/dist/styles/recipes/sidebar.css +345 -0
- package/dist/styles/recipes/skeleton.css +23 -0
- package/dist/styles/recipes/source-badge.css +77 -0
- package/dist/styles/recipes/spinner.css +33 -0
- package/dist/styles/recipes/stepper.css +178 -0
- package/dist/styles/recipes/switch.css +149 -0
- package/dist/styles/recipes/table-of-contents.css +107 -0
- package/dist/styles/recipes/table.css +124 -0
- package/dist/styles/recipes/tabs.css +235 -0
- package/dist/styles/recipes/task-list.css +146 -0
- package/dist/styles/recipes/thread-rail.css +247 -0
- package/dist/styles/recipes/timeline.css +107 -0
- package/dist/styles/recipes/toolbar.css +260 -0
- package/dist/styles/recipes/track-highlight.css +73 -0
- package/dist/styles/recipes/transcript-divider.css +64 -0
- package/dist/styles/recipes/tree.css +137 -0
- package/dist/styles/recipes/user-ask-details.css +45 -0
- package/dist/styles/recipes/user-ask.css +204 -0
- package/dist/styles/skin-theme.css +137 -0
- package/dist/styles/skin.css +143 -0
- package/dist/styles/theme.css +628 -0
- package/dist/styles/type-scale.css +45 -0
- package/dist/surface-variants.d.ts +6 -0
- package/dist/surface-variants.js +16 -0
- package/dist/task-list.d.ts +34 -0
- package/dist/task-list.js +177 -0
- package/dist/thread-rail.d.ts +52 -0
- package/dist/thread-rail.js +190 -0
- package/dist/transcript-divider.d.ts +15 -0
- package/dist/transcript-divider.js +25 -0
- package/dist/ui/accordion.d.ts +31 -0
- package/dist/ui/accordion.js +60 -0
- package/dist/ui/alert-dialog.d.ts +36 -0
- package/dist/ui/alert-dialog.js +100 -0
- package/dist/ui/alert.d.ts +21 -0
- package/dist/ui/alert.js +36 -0
- package/dist/ui/aspect-ratio.d.ts +8 -0
- package/dist/ui/aspect-ratio.js +17 -0
- package/dist/ui/autocomplete.d.ts +70 -0
- package/dist/ui/autocomplete.js +150 -0
- package/dist/ui/avatar.d.ts +24 -0
- package/dist/ui/avatar.js +44 -0
- package/dist/ui/badge.d.ts +20 -0
- package/dist/ui/badge.js +36 -0
- package/dist/ui/button-group.d.ts +24 -0
- package/dist/ui/button-group.js +45 -0
- package/dist/ui/button.d.ts +36 -0
- package/dist/ui/button.js +104 -0
- package/dist/ui/calendar.d.ts +11 -0
- package/dist/ui/calendar.js +160 -0
- package/dist/ui/card.d.ts +36 -0
- package/dist/ui/card.js +70 -0
- package/dist/ui/checkbox-group.d.ts +11 -0
- package/dist/ui/checkbox-group.js +16 -0
- package/dist/ui/checkbox.d.ts +23 -0
- package/dist/ui/checkbox.js +58 -0
- package/dist/ui/code-diff.d.ts +28 -0
- package/dist/ui/code-diff.js +561 -0
- package/dist/ui/code.d.ts +62 -0
- package/dist/ui/code.js +292 -0
- package/dist/ui/collapsible.d.ts +31 -0
- package/dist/ui/collapsible.js +72 -0
- package/dist/ui/color-picker.d.ts +137 -0
- package/dist/ui/color-picker.js +797 -0
- package/dist/ui/combobox-disabled-selection.d.ts +5 -0
- package/dist/ui/combobox-disabled-selection.js +11 -0
- package/dist/ui/combobox.d.ts +70 -0
- package/dist/ui/combobox.js +194 -0
- package/dist/ui/command.d.ts +44 -0
- package/dist/ui/command.js +166 -0
- package/dist/ui/context-menu.d.ts +86 -0
- package/dist/ui/context-menu.js +202 -0
- package/dist/ui/dialog.d.ts +38 -0
- package/dist/ui/dialog.js +124 -0
- package/dist/ui/dockable-panel-geometry.d.ts +18 -0
- package/dist/ui/dockable-panel-geometry.js +17 -0
- package/dist/ui/dockable-panel.d.ts +58 -0
- package/dist/ui/dockable-panel.js +366 -0
- package/dist/ui/drawer.d.ts +42 -0
- package/dist/ui/drawer.js +182 -0
- package/dist/ui/dropdown-menu.d.ts +46 -0
- package/dist/ui/dropdown-menu.js +89 -0
- package/dist/ui/dropzone.d.ts +66 -0
- package/dist/ui/dropzone.js +311 -0
- package/dist/ui/empty.d.ts +28 -0
- package/dist/ui/empty.js +59 -0
- package/dist/ui/field.d.ts +64 -0
- package/dist/ui/field.js +166 -0
- package/dist/ui/form.d.ts +10 -0
- package/dist/ui/form.js +17 -0
- package/dist/ui/gradient-editor.d.ts +47 -0
- package/dist/ui/gradient-editor.js +301 -0
- package/dist/ui/hover-card.d.ts +25 -0
- package/dist/ui/hover-card.js +46 -0
- package/dist/ui/infinite-canvas.d.ts +40 -0
- package/dist/ui/infinite-canvas.js +278 -0
- package/dist/ui/input-group.d.ts +21 -0
- package/dist/ui/input-group.js +44 -0
- package/dist/ui/input-otp.d.ts +38 -0
- package/dist/ui/input-otp.js +45 -0
- package/dist/ui/input.d.ts +12 -0
- package/dist/ui/input.js +18 -0
- package/dist/ui/item.d.ts +46 -0
- package/dist/ui/item.js +110 -0
- package/dist/ui/kbd.d.ts +12 -0
- package/dist/ui/kbd.js +23 -0
- package/dist/ui/markdown-elements.d.ts +52 -0
- package/dist/ui/markdown-elements.js +211 -0
- package/dist/ui/markdown.d.ts +14 -0
- package/dist/ui/markdown.js +31 -0
- package/dist/ui/menubar.d.ts +74 -0
- package/dist/ui/menubar.js +162 -0
- package/dist/ui/meter.d.ts +34 -0
- package/dist/ui/meter.js +57 -0
- package/dist/ui/morphing-panel.d.ts +24 -0
- package/dist/ui/morphing-panel.js +87 -0
- package/dist/ui/native-select.d.ts +12 -0
- package/dist/ui/native-select.js +41 -0
- package/dist/ui/navigation-menu.d.ts +51 -0
- package/dist/ui/navigation-menu.js +135 -0
- package/dist/ui/number-field.d.ts +72 -0
- package/dist/ui/number-field.js +124 -0
- package/dist/ui/pagination.d.ts +26 -0
- package/dist/ui/pagination.js +77 -0
- package/dist/ui/phone-input.d.ts +30 -0
- package/dist/ui/phone-input.js +263 -0
- package/dist/ui/popover.d.ts +34 -0
- package/dist/ui/popover.js +87 -0
- package/dist/ui/progress.d.ts +34 -0
- package/dist/ui/progress.js +57 -0
- package/dist/ui/radio-group.d.ts +29 -0
- package/dist/ui/radio-group.js +37 -0
- package/dist/ui/resizable.d.ts +56 -0
- package/dist/ui/resizable.js +82 -0
- package/dist/ui/responsive-dialog.d.ts +18 -0
- package/dist/ui/responsive-dialog.js +121 -0
- package/dist/ui/rich-tooltip-tour.d.ts +12 -0
- package/dist/ui/rich-tooltip-tour.js +20 -0
- package/dist/ui/rich-tooltip.d.ts +83 -0
- package/dist/ui/rich-tooltip.js +331 -0
- package/dist/ui/scroll-area.d.ts +25 -0
- package/dist/ui/scroll-area.js +93 -0
- package/dist/ui/select.d.ts +44 -0
- package/dist/ui/select.js +124 -0
- package/dist/ui/separator.d.ts +9 -0
- package/dist/ui/separator.js +16 -0
- package/dist/ui/sheet.d.ts +25 -0
- package/dist/ui/sheet.js +76 -0
- package/dist/ui/sidebar.d.ts +88 -0
- package/dist/ui/sidebar.js +362 -0
- package/dist/ui/skeleton.d.ts +8 -0
- package/dist/ui/skeleton.js +13 -0
- package/dist/ui/slider.d.ts +24 -0
- package/dist/ui/slider.js +114 -0
- package/dist/ui/spinner.d.ts +12 -0
- package/dist/ui/spinner.js +26 -0
- package/dist/ui/stepper.d.ts +58 -0
- package/dist/ui/stepper.js +232 -0
- package/dist/ui/switch.d.ts +26 -0
- package/dist/ui/switch.js +71 -0
- package/dist/ui/table-of-contents.d.ts +22 -0
- package/dist/ui/table-of-contents.js +181 -0
- package/dist/ui/table.d.ts +37 -0
- package/dist/ui/table.js +83 -0
- package/dist/ui/tabs.d.ts +36 -0
- package/dist/ui/tabs.js +127 -0
- package/dist/ui/textarea.d.ts +9 -0
- package/dist/ui/textarea.js +16 -0
- package/dist/ui/timeline.d.ts +40 -0
- package/dist/ui/timeline.js +80 -0
- package/dist/ui/toast.d.ts +28 -0
- package/dist/ui/toast.js +132 -0
- package/dist/ui/toggle.d.ts +20 -0
- package/dist/ui/toggle.js +71 -0
- package/dist/ui/toolbar.d.ts +40 -0
- package/dist/ui/toolbar.js +72 -0
- package/dist/ui/tooltip.d.ts +27 -0
- package/dist/ui/tooltip.js +93 -0
- package/dist/ui/tree.d.ts +56 -0
- package/dist/ui/tree.js +438 -0
- package/dist/ui/trigger-menu.d.ts +46 -0
- package/dist/ui/trigger-menu.js +116 -0
- package/dist/user-ask.d.ts +50 -0
- package/dist/user-ask.js +398 -0
- package/package.json +115 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.js";
|
|
3
|
+
import { skinEffects, skinId } from "../skin.js";
|
|
4
|
+
import { popupItemStructureClasses } from "../surface-variants.js";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { Menu } from "@base-ui/react/menu";
|
|
7
|
+
//#region src/ui/dropdown-menu.tsx
|
|
8
|
+
const dropdownMenuTriggerVariants = ["surface", "ghost"];
|
|
9
|
+
function DropdownMenu({ children, ...props }) {
|
|
10
|
+
return /* @__PURE__ */ jsx(Menu.Root, {
|
|
11
|
+
...props,
|
|
12
|
+
children
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
function DropdownMenuTrigger({ size = "sm", iconOnly = false, variant = "surface", className, children, disabled, ...props }) {
|
|
16
|
+
return /* @__PURE__ */ jsx(Menu.Trigger, {
|
|
17
|
+
"data-control-ui": "dropdown-menu",
|
|
18
|
+
"data-control-family": "button",
|
|
19
|
+
"data-slot": "trigger",
|
|
20
|
+
"data-control": "true",
|
|
21
|
+
"data-size": size,
|
|
22
|
+
"data-icon-only": iconOnly ? "true" : void 0,
|
|
23
|
+
"data-variant": variant,
|
|
24
|
+
"data-tone": "neutral",
|
|
25
|
+
"data-shape": "default",
|
|
26
|
+
className: cn("relative isolate inline-flex shrink-0 items-center justify-center overflow-visible", className),
|
|
27
|
+
disabled,
|
|
28
|
+
...props,
|
|
29
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
30
|
+
"data-control-ui": "button",
|
|
31
|
+
"data-control-family": "button",
|
|
32
|
+
"data-slot": "content",
|
|
33
|
+
className: "relative z-[1] inline-flex items-center justify-center gap-[inherit]",
|
|
34
|
+
children
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function DropdownMenuContent({ className, children, ...props }) {
|
|
39
|
+
return /* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(Menu.Positioner, {
|
|
40
|
+
"data-skin": skinId(),
|
|
41
|
+
"data-effects": skinEffects(),
|
|
42
|
+
side: "bottom",
|
|
43
|
+
align: "start",
|
|
44
|
+
sideOffset: 6,
|
|
45
|
+
className: "z-[80]",
|
|
46
|
+
children: /* @__PURE__ */ jsx(Menu.Popup, {
|
|
47
|
+
"data-control-ui": "dropdown-menu",
|
|
48
|
+
"data-slot": "content",
|
|
49
|
+
"data-surface": "floating",
|
|
50
|
+
"data-control-family": "popup",
|
|
51
|
+
"data-popup-part": "list-surface",
|
|
52
|
+
className: cn("min-w-[max(11rem,var(--anchor-width))]", className),
|
|
53
|
+
...props,
|
|
54
|
+
children
|
|
55
|
+
})
|
|
56
|
+
}) });
|
|
57
|
+
}
|
|
58
|
+
function DropdownMenuItem({ className, ...props }) {
|
|
59
|
+
return /* @__PURE__ */ jsx(Menu.Item, {
|
|
60
|
+
"data-control-ui": "dropdown-menu",
|
|
61
|
+
"data-slot": "item",
|
|
62
|
+
"data-control-family": "popup",
|
|
63
|
+
"data-popup-part": "item",
|
|
64
|
+
className: cn(popupItemStructureClasses, className),
|
|
65
|
+
...props
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function DropdownMenuSeparator({ className, ...props }) {
|
|
69
|
+
return /* @__PURE__ */ jsx(Menu.Separator, {
|
|
70
|
+
"data-control-ui": "dropdown-menu",
|
|
71
|
+
"data-slot": "separator",
|
|
72
|
+
"data-control-family": "popup",
|
|
73
|
+
"data-popup-part": "separator",
|
|
74
|
+
className: cn(className),
|
|
75
|
+
...props
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function DropdownMenuLabel({ className, ...props }) {
|
|
79
|
+
return /* @__PURE__ */ jsx("div", {
|
|
80
|
+
"data-control-ui": "dropdown-menu",
|
|
81
|
+
"data-slot": "label",
|
|
82
|
+
"data-control-family": "popup",
|
|
83
|
+
"data-popup-part": "label",
|
|
84
|
+
className: cn(className),
|
|
85
|
+
...props
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
export { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, dropdownMenuTriggerVariants };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Button } from "./button.js";
|
|
2
|
+
import { DropzoneAccept, DropzoneErrorCode, DropzoneErrorCodeValue, DropzoneFileError, DropzoneFileRejection, DropzonePolicy, DropzoneSelectionMode, DropzoneValidator, DropzoneValidatorResult, formatDropzoneFileSize } from "../lib/dropzone-validation.js";
|
|
3
|
+
import { DropzoneDropDetails, DropzoneEvent, DropzoneGetFilesFromEvent, DropzoneValueChangeDetails, DropzoneValueChangeReason, DropzoneVisualState, UseDropzoneOptions, UseDropzoneReturn, useDropzone } from "../hooks/use-dropzone.js";
|
|
4
|
+
import { DropzoneKnobStyle } from "../knob-contracts/dropzone-knobs.js";
|
|
5
|
+
import { CSSProperties, ComponentProps, ReactNode } from "react";
|
|
6
|
+
//#region src/ui/dropzone.d.ts
|
|
7
|
+
type DropzoneOverlayScope = "local" | "global";
|
|
8
|
+
type DropzoneProps = Omit<ComponentProps<"div">, "defaultValue" | "onChange" | "onDrop" | "onError"> & {
|
|
9
|
+
value?: readonly File[];
|
|
10
|
+
defaultValue?: readonly File[];
|
|
11
|
+
onValueChange?: (value: readonly File[], details: DropzoneValueChangeDetails) => void;
|
|
12
|
+
policy?: DropzonePolicy;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
getFilesFromEvent?: DropzoneGetFilesFromEvent;
|
|
15
|
+
onDrop?: (details: DropzoneDropDetails) => void;
|
|
16
|
+
onError?: (error: Error) => void;
|
|
17
|
+
} & {
|
|
18
|
+
style?: CSSProperties & DropzoneKnobStyle;
|
|
19
|
+
};
|
|
20
|
+
type DropzoneAreaProps = ComponentProps<"div"> & {
|
|
21
|
+
style?: CSSProperties & DropzoneKnobStyle;
|
|
22
|
+
};
|
|
23
|
+
type DropzoneInputProps = Omit<ComponentProps<"input">, "accept" | "disabled" | "multiple" | "onChange" | "onClick" | "type"> & {
|
|
24
|
+
style?: CSSProperties & DropzoneKnobStyle;
|
|
25
|
+
};
|
|
26
|
+
type DropzoneTriggerProps = Omit<ComponentProps<"button">, "style"> & {
|
|
27
|
+
style?: CSSProperties & DropzoneKnobStyle;
|
|
28
|
+
};
|
|
29
|
+
type DropzoneOverlayProps = Omit<ComponentProps<"div">, "style"> & {
|
|
30
|
+
scope?: DropzoneOverlayScope;
|
|
31
|
+
style?: CSSProperties & DropzoneKnobStyle;
|
|
32
|
+
};
|
|
33
|
+
type DropzoneFileListProps = Omit<ComponentProps<"ul">, "children"> & {
|
|
34
|
+
children?: (file: File, index: number) => ReactNode;
|
|
35
|
+
} & {
|
|
36
|
+
style?: CSSProperties & DropzoneKnobStyle;
|
|
37
|
+
};
|
|
38
|
+
type DropzoneRejectionListProps = Omit<ComponentProps<"ul">, "children"> & {
|
|
39
|
+
children?: (rejection: DropzoneFileRejection, index: number) => ReactNode;
|
|
40
|
+
} & {
|
|
41
|
+
style?: CSSProperties & DropzoneKnobStyle;
|
|
42
|
+
};
|
|
43
|
+
type DropzoneContextValue = UseDropzoneReturn & {
|
|
44
|
+
registerGlobalOverlay: () => () => void;
|
|
45
|
+
};
|
|
46
|
+
type DropzoneStatusProps = Omit<ComponentProps<"div">, "children" | "style"> & {
|
|
47
|
+
children?: (state: DropzoneContextValue) => ReactNode;
|
|
48
|
+
style?: CSSProperties & DropzoneKnobStyle;
|
|
49
|
+
};
|
|
50
|
+
type DropzoneRemoveProps = ComponentProps<typeof Button> & {
|
|
51
|
+
file: File;
|
|
52
|
+
};
|
|
53
|
+
type DropzoneClearProps = ComponentProps<typeof Button>;
|
|
54
|
+
declare function useDropzoneContext(): DropzoneContextValue;
|
|
55
|
+
declare function Dropzone({ value, defaultValue, onValueChange, policy, disabled, getFilesFromEvent, onDrop, onError, className, children, ...props }: DropzoneProps): import("react").JSX.Element;
|
|
56
|
+
declare function DropzoneArea({ className, ...props }: DropzoneAreaProps): import("react").JSX.Element;
|
|
57
|
+
declare function DropzoneInput({ className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }: DropzoneInputProps): import("react").JSX.Element;
|
|
58
|
+
declare function DropzoneTrigger({ className, children, onClick, disabled, ...props }: DropzoneTriggerProps): import("react").JSX.Element;
|
|
59
|
+
declare function DropzoneOverlay({ scope, className, children, ...props }: DropzoneOverlayProps): import("react").JSX.Element;
|
|
60
|
+
declare function DropzoneFileList({ className, children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }: DropzoneFileListProps): import("react").JSX.Element;
|
|
61
|
+
declare function DropzoneRejectionList({ className, children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }: DropzoneRejectionListProps): import("react").JSX.Element;
|
|
62
|
+
declare function DropzoneStatus({ className, children, role, "aria-live": ariaLive, ...props }: DropzoneStatusProps): import("react").JSX.Element;
|
|
63
|
+
declare function DropzoneRemove({ file, children, onClick, disabled, ...props }: DropzoneRemoveProps): import("react").JSX.Element;
|
|
64
|
+
declare function DropzoneClear({ children, onClick, disabled, ...props }: DropzoneClearProps): import("react").JSX.Element;
|
|
65
|
+
//#endregion
|
|
66
|
+
export { Dropzone, type DropzoneAccept, DropzoneArea, DropzoneAreaProps, DropzoneClear, DropzoneClearProps, DropzoneContextValue, type DropzoneDropDetails, DropzoneErrorCode, type DropzoneErrorCodeValue, type DropzoneEvent, type DropzoneFileError, DropzoneFileList, DropzoneFileListProps, type DropzoneFileRejection, type DropzoneGetFilesFromEvent, DropzoneInput, DropzoneInputProps, DropzoneOverlay, DropzoneOverlayProps, DropzoneOverlayScope, type DropzonePolicy, DropzoneProps, DropzoneRejectionList, DropzoneRejectionListProps, DropzoneRemove, DropzoneRemoveProps, type DropzoneSelectionMode, DropzoneStatus, DropzoneStatusProps, DropzoneTrigger, DropzoneTriggerProps, type DropzoneValidator, type DropzoneValidatorResult, type DropzoneValueChangeDetails, type DropzoneValueChangeReason, type DropzoneVisualState, type UseDropzoneOptions, type UseDropzoneReturn, formatDropzoneFileSize, useDropzone, useDropzoneContext };
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.js";
|
|
3
|
+
import { Button } from "./button.js";
|
|
4
|
+
import { DropzoneErrorCode, formatDropzoneFileSize } from "../lib/dropzone-validation.js";
|
|
5
|
+
import { useDropzone } from "../hooks/use-dropzone.js";
|
|
6
|
+
import { Item, ItemActions, ItemContent, ItemDescription, ItemMedia, ItemTitle } from "./item.js";
|
|
7
|
+
import { createContext, useContext, useEffect, useState } from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { CircleAlert, CloudUpload, FileIcon, LoaderCircle, Search, XIcon } from "lucide-react";
|
|
10
|
+
//#region src/ui/dropzone.tsx
|
|
11
|
+
const DropzoneContext = createContext(null);
|
|
12
|
+
const fileRenderKeys = /* @__PURE__ */ new WeakMap();
|
|
13
|
+
let nextFileRenderKey = 0;
|
|
14
|
+
function getFileRenderKey(file) {
|
|
15
|
+
const existingKey = fileRenderKeys.get(file);
|
|
16
|
+
if (existingKey) return existingKey;
|
|
17
|
+
const key = `dropzone-file-${nextFileRenderKey}`;
|
|
18
|
+
nextFileRenderKey += 1;
|
|
19
|
+
fileRenderKeys.set(file, key);
|
|
20
|
+
return key;
|
|
21
|
+
}
|
|
22
|
+
function useDropzoneContext() {
|
|
23
|
+
const context = useContext(DropzoneContext);
|
|
24
|
+
if (!context) throw new Error("Dropzone parts must be used inside Dropzone.");
|
|
25
|
+
return context;
|
|
26
|
+
}
|
|
27
|
+
function Dropzone({ value, defaultValue, onValueChange, policy, disabled, getFilesFromEvent, onDrop, onError, className, children, ...props }) {
|
|
28
|
+
const [globalOverlayCount, setGlobalOverlayCount] = useState(0);
|
|
29
|
+
const [registerGlobalOverlay] = useState(() => () => {
|
|
30
|
+
let registered = true;
|
|
31
|
+
setGlobalOverlayCount((count) => count + 1);
|
|
32
|
+
return () => {
|
|
33
|
+
if (!registered) return;
|
|
34
|
+
registered = false;
|
|
35
|
+
setGlobalOverlayCount((count) => Math.max(0, count - 1));
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
const dropzone = useDropzone({
|
|
39
|
+
value,
|
|
40
|
+
defaultValue,
|
|
41
|
+
onValueChange,
|
|
42
|
+
policy,
|
|
43
|
+
disabled,
|
|
44
|
+
getFilesFromEvent,
|
|
45
|
+
onDrop,
|
|
46
|
+
onError,
|
|
47
|
+
trackDocumentDrag: globalOverlayCount > 0
|
|
48
|
+
});
|
|
49
|
+
const context = {
|
|
50
|
+
...dropzone,
|
|
51
|
+
registerGlobalOverlay
|
|
52
|
+
};
|
|
53
|
+
const empty = dropzone.value.length === 0 && dropzone.fileRejections.length === 0;
|
|
54
|
+
return /* @__PURE__ */ jsx(DropzoneContext.Provider, {
|
|
55
|
+
value: context,
|
|
56
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
57
|
+
...props,
|
|
58
|
+
"data-control-ui": "dropzone",
|
|
59
|
+
"data-control-family": "dropzone",
|
|
60
|
+
"data-slot": "root",
|
|
61
|
+
"data-disabled": dropzone.disabled ? "true" : void 0,
|
|
62
|
+
"data-empty": empty ? "true" : void 0,
|
|
63
|
+
className: cn("min-w-0", className),
|
|
64
|
+
children
|
|
65
|
+
})
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function DropzoneArea({ className, ...props }) {
|
|
69
|
+
const context = useDropzoneContext();
|
|
70
|
+
const areaProps = context.getRootProps(props);
|
|
71
|
+
return /* @__PURE__ */ jsx("div", {
|
|
72
|
+
...areaProps,
|
|
73
|
+
"aria-busy": context.isProcessing ? "true" : "false",
|
|
74
|
+
"data-control-ui": "dropzone",
|
|
75
|
+
"data-control-family": "dropzone",
|
|
76
|
+
"data-slot": "area",
|
|
77
|
+
"data-state": context.visualState,
|
|
78
|
+
"data-disabled": context.disabled ? "true" : void 0,
|
|
79
|
+
className: cn("relative isolate min-w-0", className)
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function DropzoneInput({ className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }) {
|
|
83
|
+
const inputProps = useDropzoneContext().getInputProps({
|
|
84
|
+
...props,
|
|
85
|
+
"aria-label": ariaLabelledBy ? ariaLabel : ariaLabel ?? "Choose files",
|
|
86
|
+
"aria-labelledby": ariaLabelledBy
|
|
87
|
+
});
|
|
88
|
+
return /* @__PURE__ */ jsx("input", {
|
|
89
|
+
...inputProps,
|
|
90
|
+
"data-control-ui": "dropzone",
|
|
91
|
+
"data-control-family": "dropzone",
|
|
92
|
+
"data-slot": "input",
|
|
93
|
+
className: cn("sr-only", className)
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function DropzoneTrigger({ className, children, onClick, disabled, ...props }) {
|
|
97
|
+
const context = useDropzoneContext();
|
|
98
|
+
const triggerDisabled = disabled || context.disabled || context.isProcessing;
|
|
99
|
+
return /* @__PURE__ */ jsx("button", {
|
|
100
|
+
...props,
|
|
101
|
+
type: "button",
|
|
102
|
+
disabled: triggerDisabled,
|
|
103
|
+
"data-control-ui": "dropzone",
|
|
104
|
+
"data-control-family": "dropzone",
|
|
105
|
+
"data-slot": "trigger",
|
|
106
|
+
"data-state": context.visualState,
|
|
107
|
+
"data-disabled": triggerDisabled ? "true" : void 0,
|
|
108
|
+
className: cn("flex w-full cursor-pointer flex-col items-center justify-center disabled:cursor-not-allowed", className),
|
|
109
|
+
onClick: (event) => {
|
|
110
|
+
onClick?.(event);
|
|
111
|
+
if (!event.defaultPrevented) context.open();
|
|
112
|
+
},
|
|
113
|
+
children: children ?? /* @__PURE__ */ jsx(DropzoneFeedback, { state: context.visualState })
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
function DropzoneOverlay({ scope = "local", className, children, ...props }) {
|
|
117
|
+
const context = useDropzoneContext();
|
|
118
|
+
const active = scope === "global" ? context.isDragGlobal : context.isDragActive;
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
if (scope !== "global") return;
|
|
121
|
+
return context.registerGlobalOverlay();
|
|
122
|
+
}, [context.registerGlobalOverlay, scope]);
|
|
123
|
+
return /* @__PURE__ */ jsx("div", {
|
|
124
|
+
...props,
|
|
125
|
+
"aria-hidden": "true",
|
|
126
|
+
"data-control-ui": "dropzone",
|
|
127
|
+
"data-control-family": "dropzone",
|
|
128
|
+
"data-slot": "overlay",
|
|
129
|
+
"data-state": context.visualState,
|
|
130
|
+
"data-active": active ? "true" : void 0,
|
|
131
|
+
"data-scope": scope,
|
|
132
|
+
className: cn("pointer-events-none absolute inset-0 z-10 hidden items-center justify-center data-[active=true]:flex", className),
|
|
133
|
+
children: children ?? /* @__PURE__ */ jsx(DropzoneFeedback, { state: context.visualState })
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function DropzoneFileList({ className, children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }) {
|
|
137
|
+
const context = useDropzoneContext();
|
|
138
|
+
const empty = context.value.length === 0;
|
|
139
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
140
|
+
...props,
|
|
141
|
+
hidden: empty,
|
|
142
|
+
"aria-label": ariaLabelledBy ? ariaLabel : ariaLabel ?? "Selected files",
|
|
143
|
+
"aria-labelledby": ariaLabelledBy,
|
|
144
|
+
"data-control-ui": "dropzone",
|
|
145
|
+
"data-control-family": "dropzone",
|
|
146
|
+
"data-slot": "file-list",
|
|
147
|
+
"data-empty": empty ? "true" : void 0,
|
|
148
|
+
className: cn("flex flex-col", className),
|
|
149
|
+
children: context.value.map((file, index) => /* @__PURE__ */ jsx("li", {
|
|
150
|
+
"data-control-ui": "dropzone",
|
|
151
|
+
"data-control-family": "dropzone",
|
|
152
|
+
"data-slot": "file",
|
|
153
|
+
className: void 0,
|
|
154
|
+
children: children ? children(file, index) : /* @__PURE__ */ jsx(DefaultFile, { file })
|
|
155
|
+
}, getFileRenderKey(file)))
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
function DropzoneRejectionList({ className, children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }) {
|
|
159
|
+
const context = useDropzoneContext();
|
|
160
|
+
const empty = context.fileRejections.length === 0;
|
|
161
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
162
|
+
...props,
|
|
163
|
+
hidden: empty,
|
|
164
|
+
"aria-label": ariaLabelledBy ? ariaLabel : ariaLabel ?? "Rejected files",
|
|
165
|
+
"aria-labelledby": ariaLabelledBy,
|
|
166
|
+
"data-control-ui": "dropzone",
|
|
167
|
+
"data-control-family": "dropzone",
|
|
168
|
+
"data-slot": "rejection-list",
|
|
169
|
+
"data-empty": empty ? "true" : void 0,
|
|
170
|
+
className: cn("flex flex-col", className),
|
|
171
|
+
children: context.fileRejections.map((rejection, index) => /* @__PURE__ */ jsx("li", {
|
|
172
|
+
"data-control-ui": "dropzone",
|
|
173
|
+
"data-control-family": "dropzone",
|
|
174
|
+
"data-slot": "rejection",
|
|
175
|
+
className: void 0,
|
|
176
|
+
children: children ? children(rejection, index) : /* @__PURE__ */ jsx(DefaultRejection, { rejection })
|
|
177
|
+
}, getFileRenderKey(rejection.file)))
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
function DropzoneStatus({ className, children, role = "status", "aria-live": ariaLive = "polite", ...props }) {
|
|
181
|
+
const context = useDropzoneContext();
|
|
182
|
+
return /* @__PURE__ */ jsx("div", {
|
|
183
|
+
...props,
|
|
184
|
+
role,
|
|
185
|
+
"aria-live": ariaLive,
|
|
186
|
+
"data-control-ui": "dropzone",
|
|
187
|
+
"data-control-family": "dropzone",
|
|
188
|
+
"data-slot": "status",
|
|
189
|
+
"data-state": context.visualState,
|
|
190
|
+
className,
|
|
191
|
+
children: children ? children(context) : getDropzoneStatusMessage(context)
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
function DropzoneRemove({ file, children, onClick, disabled, ...props }) {
|
|
195
|
+
const context = useDropzoneContext();
|
|
196
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
197
|
+
...props,
|
|
198
|
+
type: "button",
|
|
199
|
+
variant: props.variant ?? "quiet",
|
|
200
|
+
size: props.size ?? "sm",
|
|
201
|
+
iconOnly: props.iconOnly ?? true,
|
|
202
|
+
"aria-label": props["aria-label"] ?? `Remove ${file.name}`,
|
|
203
|
+
disabled: disabled || context.disabled || context.isProcessing,
|
|
204
|
+
onClick: (event) => {
|
|
205
|
+
onClick?.(event);
|
|
206
|
+
if (!event.defaultPrevented) context.removeFile(file);
|
|
207
|
+
},
|
|
208
|
+
children: children ?? /* @__PURE__ */ jsx(XIcon, { "aria-hidden": "true" })
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
function DropzoneClear({ children, onClick, disabled, ...props }) {
|
|
212
|
+
const context = useDropzoneContext();
|
|
213
|
+
const empty = context.value.length === 0 && context.fileRejections.length === 0;
|
|
214
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
215
|
+
...props,
|
|
216
|
+
type: "button",
|
|
217
|
+
variant: props.variant ?? "quiet",
|
|
218
|
+
size: props.size ?? "sm",
|
|
219
|
+
disabled: disabled || context.disabled || context.isProcessing || empty,
|
|
220
|
+
onClick: (event) => {
|
|
221
|
+
onClick?.(event);
|
|
222
|
+
if (!event.defaultPrevented) context.reset();
|
|
223
|
+
},
|
|
224
|
+
children: children ?? "Clear all"
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
function DropzoneFeedback({ state }) {
|
|
228
|
+
let icon = /* @__PURE__ */ jsx(CloudUpload, { "aria-hidden": "true" });
|
|
229
|
+
let message = "Drop files here or choose files.";
|
|
230
|
+
if (state === "processing") {
|
|
231
|
+
icon = /* @__PURE__ */ jsx(LoaderCircle, {
|
|
232
|
+
"data-control-ui": "dropzone",
|
|
233
|
+
"data-control-family": "dropzone",
|
|
234
|
+
"data-slot": "feedback-spinner",
|
|
235
|
+
"aria-hidden": "true"
|
|
236
|
+
});
|
|
237
|
+
message = "Checking files…";
|
|
238
|
+
} else if (state === "accept") {
|
|
239
|
+
icon = /* @__PURE__ */ jsx(CloudUpload, { "aria-hidden": "true" });
|
|
240
|
+
message = "Release to add files.";
|
|
241
|
+
} else if (state === "reject") {
|
|
242
|
+
icon = /* @__PURE__ */ jsx(CircleAlert, { "aria-hidden": "true" });
|
|
243
|
+
message = "Some files are not accepted.";
|
|
244
|
+
} else if (state === "unknown") {
|
|
245
|
+
icon = /* @__PURE__ */ jsx(Search, { "aria-hidden": "true" });
|
|
246
|
+
message = "Release to check files.";
|
|
247
|
+
}
|
|
248
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
249
|
+
"data-control-ui": "dropzone",
|
|
250
|
+
"data-control-family": "dropzone",
|
|
251
|
+
"data-slot": "feedback",
|
|
252
|
+
className: "flex flex-col items-center",
|
|
253
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
254
|
+
"data-control-ui": "dropzone",
|
|
255
|
+
"data-control-family": "dropzone",
|
|
256
|
+
"data-slot": "feedback-icon",
|
|
257
|
+
className: "[&>svg]:size-6",
|
|
258
|
+
children: icon
|
|
259
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
260
|
+
"data-control-ui": "dropzone",
|
|
261
|
+
"data-control-family": "dropzone",
|
|
262
|
+
"data-slot": "feedback-message",
|
|
263
|
+
children: message
|
|
264
|
+
})]
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
function DefaultFile({ file }) {
|
|
268
|
+
return /* @__PURE__ */ jsxs(Item, {
|
|
269
|
+
variant: "muted",
|
|
270
|
+
children: [
|
|
271
|
+
/* @__PURE__ */ jsx(ItemMedia, { children: /* @__PURE__ */ jsx(FileIcon, { "aria-hidden": "true" }) }),
|
|
272
|
+
/* @__PURE__ */ jsxs(ItemContent, { children: [/* @__PURE__ */ jsx(ItemTitle, {
|
|
273
|
+
className: "wrap-anywhere",
|
|
274
|
+
children: file.name
|
|
275
|
+
}), /* @__PURE__ */ jsx(ItemDescription, { children: formatDropzoneFileSize(file.size) })] }),
|
|
276
|
+
/* @__PURE__ */ jsx(ItemActions, { children: /* @__PURE__ */ jsx(DropzoneRemove, { file }) })
|
|
277
|
+
]
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
function DefaultRejection({ rejection }) {
|
|
281
|
+
return /* @__PURE__ */ jsxs(Item, {
|
|
282
|
+
variant: "muted",
|
|
283
|
+
children: [/* @__PURE__ */ jsx(ItemMedia, {
|
|
284
|
+
"data-dropzone-invalid": "",
|
|
285
|
+
children: /* @__PURE__ */ jsx(CircleAlert, { "aria-hidden": "true" })
|
|
286
|
+
}), /* @__PURE__ */ jsxs(ItemContent, { children: [/* @__PURE__ */ jsx(ItemTitle, {
|
|
287
|
+
className: "wrap-anywhere",
|
|
288
|
+
children: rejection.file.name
|
|
289
|
+
}), rejection.errors.map((error) => /* @__PURE__ */ jsx(ItemDescription, {
|
|
290
|
+
"data-dropzone-invalid": "",
|
|
291
|
+
children: error.message
|
|
292
|
+
}, `${error.code}-${error.message}`))] })]
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
function getDropzoneStatusMessage(context) {
|
|
296
|
+
if (context.isProcessing) return "Checking files…";
|
|
297
|
+
if (context.isDragActive && context.isDragReject) return "Some files are not accepted.";
|
|
298
|
+
if (context.isDragActive && context.isDragAccept) return "Release to add files.";
|
|
299
|
+
if (context.isDragActive && context.isDragUnknown) return "Release to check files.";
|
|
300
|
+
if (context.fileRejections.length > 0) {
|
|
301
|
+
const count = context.fileRejections.length;
|
|
302
|
+
return `${count} ${count === 1 ? "file" : "files"} could not be added.`;
|
|
303
|
+
}
|
|
304
|
+
if (context.value.length > 0) {
|
|
305
|
+
const count = context.value.length;
|
|
306
|
+
return `${count} ${count === 1 ? "file" : "files"} selected.`;
|
|
307
|
+
}
|
|
308
|
+
return "No files selected.";
|
|
309
|
+
}
|
|
310
|
+
//#endregion
|
|
311
|
+
export { Dropzone, DropzoneArea, DropzoneClear, DropzoneErrorCode, DropzoneFileList, DropzoneInput, DropzoneOverlay, DropzoneRejectionList, DropzoneRemove, DropzoneStatus, DropzoneTrigger, formatDropzoneFileSize, useDropzone, useDropzoneContext };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { EmptyKnobStyle } from "../knob-contracts/empty-knobs.js";
|
|
2
|
+
import { CSSProperties, ComponentProps } from "react";
|
|
3
|
+
//#region src/ui/empty.d.ts
|
|
4
|
+
type EmptyProps = Omit<ComponentProps<"div">, "style"> & {
|
|
5
|
+
style?: CSSProperties & EmptyKnobStyle;
|
|
6
|
+
};
|
|
7
|
+
type EmptyMediaProps = Omit<ComponentProps<"div">, "style"> & {
|
|
8
|
+
style?: CSSProperties & EmptyKnobStyle;
|
|
9
|
+
};
|
|
10
|
+
type EmptyContentProps = Omit<ComponentProps<"div">, "style"> & {
|
|
11
|
+
style?: CSSProperties & EmptyKnobStyle;
|
|
12
|
+
};
|
|
13
|
+
type EmptyDescriptionProps = Omit<ComponentProps<"p">, "style"> & {
|
|
14
|
+
style?: CSSProperties & EmptyKnobStyle;
|
|
15
|
+
};
|
|
16
|
+
type EmptyTitleProps = Omit<ComponentProps<"div">, "style"> & {
|
|
17
|
+
style?: CSSProperties & EmptyKnobStyle;
|
|
18
|
+
};
|
|
19
|
+
declare function Empty({ className, ...props }: EmptyProps): import("react").JSX.Element;
|
|
20
|
+
declare function EmptyHeader({ className, ...props }: ComponentProps<"div"> & {
|
|
21
|
+
style?: CSSProperties & EmptyKnobStyle;
|
|
22
|
+
}): import("react").JSX.Element;
|
|
23
|
+
declare function EmptyMedia({ className, ...props }: EmptyMediaProps): import("react").JSX.Element;
|
|
24
|
+
declare function EmptyTitle({ className, ...props }: EmptyTitleProps): import("react").JSX.Element;
|
|
25
|
+
declare function EmptyDescription({ className, ...props }: EmptyDescriptionProps): import("react").JSX.Element;
|
|
26
|
+
declare function EmptyContent({ className, ...props }: EmptyContentProps): import("react").JSX.Element;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { Empty, EmptyContent, EmptyContentProps, EmptyDescription, EmptyDescriptionProps, EmptyHeader, EmptyMedia, EmptyMediaProps, EmptyProps, EmptyTitle, EmptyTitleProps };
|
package/dist/ui/empty.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/ui/empty.tsx
|
|
4
|
+
function Empty({ className, ...props }) {
|
|
5
|
+
return /* @__PURE__ */ jsx("div", {
|
|
6
|
+
"data-control-ui": "empty",
|
|
7
|
+
"data-control-family": "empty",
|
|
8
|
+
"data-slot": "root",
|
|
9
|
+
className: cn("flex min-w-0 flex-1 flex-col items-center justify-center", className),
|
|
10
|
+
...props
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
function EmptyHeader({ className, ...props }) {
|
|
14
|
+
return /* @__PURE__ */ jsx("div", {
|
|
15
|
+
"data-control-ui": "empty",
|
|
16
|
+
"data-control-family": "empty",
|
|
17
|
+
"data-slot": "header",
|
|
18
|
+
className: cn("flex max-w-sm flex-col items-center", className),
|
|
19
|
+
...props
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function EmptyMedia({ className, ...props }) {
|
|
23
|
+
return /* @__PURE__ */ jsx("div", {
|
|
24
|
+
"data-control-ui": "empty",
|
|
25
|
+
"data-control-family": "empty",
|
|
26
|
+
"data-slot": "media",
|
|
27
|
+
className: cn("flex shrink-0 items-center justify-center [&>svg]:size-5 [&>svg]:shrink-0", className),
|
|
28
|
+
...props
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function EmptyTitle({ className, ...props }) {
|
|
32
|
+
return /* @__PURE__ */ jsx("div", {
|
|
33
|
+
"data-control-ui": "empty",
|
|
34
|
+
"data-control-family": "empty",
|
|
35
|
+
"data-slot": "title",
|
|
36
|
+
className,
|
|
37
|
+
...props
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function EmptyDescription({ className, ...props }) {
|
|
41
|
+
return /* @__PURE__ */ jsx("p", {
|
|
42
|
+
"data-control-ui": "empty",
|
|
43
|
+
"data-control-family": "empty",
|
|
44
|
+
"data-slot": "description",
|
|
45
|
+
className,
|
|
46
|
+
...props
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function EmptyContent({ className, ...props }) {
|
|
50
|
+
return /* @__PURE__ */ jsx("div", {
|
|
51
|
+
"data-control-ui": "empty",
|
|
52
|
+
"data-control-family": "empty",
|
|
53
|
+
"data-slot": "content",
|
|
54
|
+
className: cn("flex w-full max-w-sm flex-col items-center justify-center", className),
|
|
55
|
+
...props
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
export { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { FieldKnobStyle } from "../knob-contracts/field-knobs.js";
|
|
2
|
+
import { CSSProperties, ComponentProps, ReactNode } from "react";
|
|
3
|
+
import { Field as Field$1 } from "@base-ui/react/field";
|
|
4
|
+
//#region src/ui/field.d.ts
|
|
5
|
+
type FieldProps = ComponentProps<"div"> & {
|
|
6
|
+
orientation?: "vertical" | "horizontal" | "responsive";
|
|
7
|
+
name?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
invalid?: boolean;
|
|
10
|
+
validationMode?: "onSubmit" | "onBlur" | "onChange";
|
|
11
|
+
} & {
|
|
12
|
+
style?: CSSProperties & FieldKnobStyle;
|
|
13
|
+
};
|
|
14
|
+
type FieldLabelProps = Omit<ComponentProps<"label">, "style"> & {
|
|
15
|
+
style?: CSSProperties & FieldKnobStyle;
|
|
16
|
+
};
|
|
17
|
+
type FieldContentProps = ComponentProps<"div"> & {
|
|
18
|
+
style?: CSSProperties & FieldKnobStyle;
|
|
19
|
+
};
|
|
20
|
+
type FieldTitleProps = Omit<ComponentProps<"div">, "style"> & {
|
|
21
|
+
style?: CSSProperties & FieldKnobStyle;
|
|
22
|
+
};
|
|
23
|
+
type FieldControlProps = Omit<ComponentProps<"input">, "style"> & {
|
|
24
|
+
style?: CSSProperties & FieldKnobStyle;
|
|
25
|
+
};
|
|
26
|
+
type FieldDescriptionProps = Omit<ComponentProps<"p">, "style"> & {
|
|
27
|
+
style?: CSSProperties & FieldKnobStyle;
|
|
28
|
+
};
|
|
29
|
+
type FieldErrorMatch = boolean | keyof ValidityState;
|
|
30
|
+
type FieldErrorProps = Omit<ComponentProps<"div">, "style"> & {
|
|
31
|
+
match?: FieldErrorMatch;
|
|
32
|
+
style?: CSSProperties & FieldKnobStyle;
|
|
33
|
+
};
|
|
34
|
+
type FieldGroupProps = ComponentProps<"div"> & {
|
|
35
|
+
style?: CSSProperties & FieldKnobStyle;
|
|
36
|
+
};
|
|
37
|
+
type FieldSeparatorProps = Omit<ComponentProps<"div">, "style"> & {
|
|
38
|
+
children?: ReactNode;
|
|
39
|
+
style?: CSSProperties & FieldKnobStyle;
|
|
40
|
+
};
|
|
41
|
+
type FieldItemProps = ComponentProps<"div"> & {
|
|
42
|
+
style?: CSSProperties & FieldKnobStyle;
|
|
43
|
+
};
|
|
44
|
+
type FieldSetProps = Omit<ComponentProps<"fieldset">, "style"> & {
|
|
45
|
+
style?: CSSProperties & FieldKnobStyle;
|
|
46
|
+
};
|
|
47
|
+
type FieldLegendProps = Omit<ComponentProps<"div">, "style"> & {
|
|
48
|
+
style?: CSSProperties & FieldKnobStyle;
|
|
49
|
+
};
|
|
50
|
+
declare function Field({ className, orientation, ...props }: FieldProps): import("react").JSX.Element;
|
|
51
|
+
declare function FieldContent({ className, ...props }: FieldContentProps): import("react").JSX.Element;
|
|
52
|
+
declare function FieldTitle({ className, ...props }: FieldTitleProps): import("react").JSX.Element;
|
|
53
|
+
declare function FieldLabel({ className, ...props }: FieldLabelProps): import("react").JSX.Element;
|
|
54
|
+
type RefinedFieldControlProps = FieldControlProps & Pick<ComponentProps<typeof Field$1.Control>, "render">;
|
|
55
|
+
declare function FieldControl({ className, render, ...props }: RefinedFieldControlProps): import("react").JSX.Element;
|
|
56
|
+
declare function FieldDescription({ className, ...props }: FieldDescriptionProps): import("react").JSX.Element;
|
|
57
|
+
declare function FieldError({ className, ...props }: FieldErrorProps): import("react").JSX.Element;
|
|
58
|
+
declare function FieldGroup({ className, ...props }: FieldGroupProps): import("react").JSX.Element;
|
|
59
|
+
declare function FieldSeparator({ children, className, ...props }: FieldSeparatorProps): import("react").JSX.Element;
|
|
60
|
+
declare function FieldItem({ className, ...props }: FieldItemProps): import("react").JSX.Element;
|
|
61
|
+
declare function FieldSet({ className, ...props }: FieldSetProps): import("react").JSX.Element;
|
|
62
|
+
declare function FieldLegend({ className, ...props }: FieldLegendProps): import("react").JSX.Element;
|
|
63
|
+
//#endregion
|
|
64
|
+
export { Field, FieldContent, FieldContentProps, FieldControl, FieldControlProps, FieldDescription, FieldDescriptionProps, FieldError, FieldErrorMatch, FieldErrorProps, FieldGroup, FieldGroupProps, FieldItem, FieldItemProps, FieldLabel, FieldLabelProps, FieldLegend, FieldLegendProps, FieldProps, FieldSeparator, FieldSeparatorProps, FieldSet, FieldSetProps, FieldTitle, FieldTitleProps };
|