@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
package/dist/ui/code.js
ADDED
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCopyToClipboard } from "../hooks/use-copy-to-clipboard.js";
|
|
3
|
+
import { cn } from "../lib/cn.js";
|
|
4
|
+
import { Button } from "./button.js";
|
|
5
|
+
import { ScrollArea } from "./scroll-area.js";
|
|
6
|
+
import { highlightToTokens } from "../lib/code-tokens.js";
|
|
7
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./tooltip.js";
|
|
8
|
+
import { Children, createContext, isValidElement, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
9
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { CheckIcon, CopyIcon } from "lucide-react";
|
|
11
|
+
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
12
|
+
//#region src/ui/code.tsx
|
|
13
|
+
const VIRTUALIZE_THRESHOLD = 200;
|
|
14
|
+
const ESTIMATED_LINE_HEIGHT = 20;
|
|
15
|
+
const CodeContext = createContext(null);
|
|
16
|
+
function useCodeContext() {
|
|
17
|
+
const context = useContext(CodeContext);
|
|
18
|
+
if (!context) throw new Error("Code compound parts must be rendered inside <Code>.");
|
|
19
|
+
return context;
|
|
20
|
+
}
|
|
21
|
+
function hasCodeHeader(children) {
|
|
22
|
+
return Children.toArray(children).some((child) => isValidElement(child) && child.type === CodeHeader);
|
|
23
|
+
}
|
|
24
|
+
function Code({ overflow = "scroll", chrome = "standalone", density = "default", className, children, ...props }) {
|
|
25
|
+
const hasHeader = hasCodeHeader(children);
|
|
26
|
+
return /* @__PURE__ */ jsx(CodeContext.Provider, {
|
|
27
|
+
value: {
|
|
28
|
+
chrome,
|
|
29
|
+
density,
|
|
30
|
+
overflow,
|
|
31
|
+
hasHeader
|
|
32
|
+
},
|
|
33
|
+
children: /* @__PURE__ */ jsx("figure", {
|
|
34
|
+
"data-control-ui": "code",
|
|
35
|
+
"data-control-family": "code",
|
|
36
|
+
"data-slot": "root",
|
|
37
|
+
"data-surface": "panel",
|
|
38
|
+
"data-chrome": chrome,
|
|
39
|
+
"data-density": density,
|
|
40
|
+
"data-header": hasHeader ? "true" : void 0,
|
|
41
|
+
className: cn("min-w-0 overflow-hidden", !hasHeader && "relative", className),
|
|
42
|
+
...props,
|
|
43
|
+
children
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function CodeHeader({ className, ...props }) {
|
|
48
|
+
return /* @__PURE__ */ jsx("figcaption", {
|
|
49
|
+
"data-control-ui": "code",
|
|
50
|
+
"data-control-family": "code",
|
|
51
|
+
"data-slot": "header",
|
|
52
|
+
className: cn("flex items-center justify-between", className),
|
|
53
|
+
...props
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function CodeTitle({ className, ...props }) {
|
|
57
|
+
return /* @__PURE__ */ jsx("span", {
|
|
58
|
+
"data-control-ui": "code",
|
|
59
|
+
"data-control-family": "code",
|
|
60
|
+
"data-slot": "title",
|
|
61
|
+
className: cn("block min-w-0 truncate", className),
|
|
62
|
+
...props
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function CodeActions({ className, ...props }) {
|
|
66
|
+
return /* @__PURE__ */ jsx("div", {
|
|
67
|
+
"data-control-ui": "code",
|
|
68
|
+
"data-control-family": "code",
|
|
69
|
+
"data-slot": "actions",
|
|
70
|
+
className: cn("flex shrink-0 items-center", className),
|
|
71
|
+
...props
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function CodeCopy({ value, copiedLabel, copiedAriaLabel = "Copied", children, className, "aria-label": ariaLabel, ...props }) {
|
|
75
|
+
const { isCopied, handleCopy } = useCopyToClipboard({ text: value });
|
|
76
|
+
const isIconOnly = children === void 0;
|
|
77
|
+
const label = ariaLabel ?? (isIconOnly ? "Copy code" : void 0);
|
|
78
|
+
const copied = copiedLabel ?? (isIconOnly ? /* @__PURE__ */ jsx(CheckIcon, {
|
|
79
|
+
"aria-hidden": "true",
|
|
80
|
+
className: "size-3.5"
|
|
81
|
+
}) : "Copied");
|
|
82
|
+
const button = /* @__PURE__ */ jsx(Button, {
|
|
83
|
+
type: "button",
|
|
84
|
+
variant: "quiet",
|
|
85
|
+
size: "xs",
|
|
86
|
+
"aria-live": "polite",
|
|
87
|
+
"aria-label": label && isCopied ? copiedAriaLabel : label,
|
|
88
|
+
"data-code-copy": isIconOnly ? "true" : void 0,
|
|
89
|
+
className,
|
|
90
|
+
...props,
|
|
91
|
+
onClick: handleCopy,
|
|
92
|
+
children: isCopied ? copied : children ?? /* @__PURE__ */ jsx(CopyIcon, {
|
|
93
|
+
"aria-hidden": "true",
|
|
94
|
+
className: "size-3.5"
|
|
95
|
+
})
|
|
96
|
+
});
|
|
97
|
+
if (!isIconOnly) return button;
|
|
98
|
+
return /* @__PURE__ */ jsx(TooltipProvider, {
|
|
99
|
+
delay: 0,
|
|
100
|
+
children: /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: button }), /* @__PURE__ */ jsx(TooltipContent, {
|
|
101
|
+
side: "left",
|
|
102
|
+
children: label
|
|
103
|
+
})] })
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
function CodeFloatingCopy({ className, ...props }) {
|
|
107
|
+
return /* @__PURE__ */ jsx(CodeCopy, {
|
|
108
|
+
"data-code-floating": "true",
|
|
109
|
+
className: cn("absolute top-2 right-2 z-10", className),
|
|
110
|
+
...props
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
/** Null until resolved, and whenever highlighting is off or language is unknown — callers fall back to plain text. */
|
|
114
|
+
function useCodeTokens({ code, lang, tokens, highlight }) {
|
|
115
|
+
const requestKey = `${lang ?? ""}\n${code}`;
|
|
116
|
+
const [clientTokens, setClientTokens] = useState(null);
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
if (highlight === "none" || tokens !== void 0 || !lang) return;
|
|
119
|
+
let cancelled = false;
|
|
120
|
+
highlightToTokens(code, lang).then((result) => {
|
|
121
|
+
if (!cancelled) setClientTokens({
|
|
122
|
+
key: requestKey,
|
|
123
|
+
tokens: result
|
|
124
|
+
});
|
|
125
|
+
}).catch(() => {
|
|
126
|
+
if (!cancelled) setClientTokens({
|
|
127
|
+
key: requestKey,
|
|
128
|
+
tokens: null
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
return () => {
|
|
132
|
+
cancelled = true;
|
|
133
|
+
};
|
|
134
|
+
}, [
|
|
135
|
+
code,
|
|
136
|
+
lang,
|
|
137
|
+
tokens,
|
|
138
|
+
highlight,
|
|
139
|
+
requestKey
|
|
140
|
+
]);
|
|
141
|
+
if (highlight === "none") return null;
|
|
142
|
+
if (tokens !== void 0) return tokens;
|
|
143
|
+
return clientTokens?.key === requestKey ? clientTokens.tokens : null;
|
|
144
|
+
}
|
|
145
|
+
function CodeTokenLine({ tokens, plain }) {
|
|
146
|
+
if (!tokens || tokens.length === 0) return plain;
|
|
147
|
+
return tokens.map((token, index) => {
|
|
148
|
+
const style = { ...token.style };
|
|
149
|
+
return /* @__PURE__ */ jsx("span", {
|
|
150
|
+
style,
|
|
151
|
+
children: token.content
|
|
152
|
+
}, index);
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
function CodeRow({ index, number, tokens, plain, overflow, showLineNumbers, measureRef, style }) {
|
|
156
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
157
|
+
ref: measureRef,
|
|
158
|
+
"data-index": index,
|
|
159
|
+
"data-control-ui": "code",
|
|
160
|
+
"data-control-family": "code",
|
|
161
|
+
"data-slot": "line",
|
|
162
|
+
className: "flex w-full",
|
|
163
|
+
style,
|
|
164
|
+
children: [showLineNumbers ? /* @__PURE__ */ jsx("span", {
|
|
165
|
+
"data-control-ui": "code",
|
|
166
|
+
"data-control-family": "code",
|
|
167
|
+
"data-slot": "gutter",
|
|
168
|
+
"aria-hidden": "true",
|
|
169
|
+
className: "shrink-0 select-none",
|
|
170
|
+
children: number
|
|
171
|
+
}) : null, /* @__PURE__ */ jsx("code", {
|
|
172
|
+
className: cn("min-w-0 flex-1", overflow === "wrap" ? "whitespace-pre-wrap break-words" : "whitespace-pre"),
|
|
173
|
+
children: /* @__PURE__ */ jsx(CodeTokenLine, {
|
|
174
|
+
tokens,
|
|
175
|
+
plain
|
|
176
|
+
})
|
|
177
|
+
})]
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
function CodeContent({ code, lang, tokens, highlight = "auto", showLineNumbers = false, startLine = 1, maxHeight = "32rem", virtualize, className, ref, style, ...props }) {
|
|
181
|
+
const { chrome, density, overflow, hasHeader } = useCodeContext();
|
|
182
|
+
const resolvedTokens = useCodeTokens({
|
|
183
|
+
code,
|
|
184
|
+
lang,
|
|
185
|
+
tokens,
|
|
186
|
+
highlight
|
|
187
|
+
});
|
|
188
|
+
const plainLines = useMemo(() => code.split("\n"), [code]);
|
|
189
|
+
const isCompact = density === "compact";
|
|
190
|
+
const scrollRef = useRef(null);
|
|
191
|
+
function setScrollElement(node) {
|
|
192
|
+
scrollRef.current = node;
|
|
193
|
+
if (typeof ref === "function") ref(node);
|
|
194
|
+
else if (ref) ref.current = node;
|
|
195
|
+
}
|
|
196
|
+
const shouldVirtualize = virtualize ?? plainLines.length > VIRTUALIZE_THRESHOLD;
|
|
197
|
+
const useScrollArea = density !== "compact" || overflow !== "wrap";
|
|
198
|
+
const virtualizer = useVirtualizer({
|
|
199
|
+
count: plainLines.length,
|
|
200
|
+
getScrollElement: () => scrollRef.current,
|
|
201
|
+
estimateSize: () => ESTIMATED_LINE_HEIGHT,
|
|
202
|
+
overscan: 24,
|
|
203
|
+
enabled: shouldVirtualize
|
|
204
|
+
});
|
|
205
|
+
const gridClassName = overflow === "scroll" ? "w-max min-w-full" : "w-full";
|
|
206
|
+
const textStyle = style;
|
|
207
|
+
const grid = shouldVirtualize ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("pre", {
|
|
208
|
+
"data-control-ui": "code",
|
|
209
|
+
"data-control-family": "code",
|
|
210
|
+
"data-slot": "accessible-source",
|
|
211
|
+
className: "sr-only",
|
|
212
|
+
children: /* @__PURE__ */ jsx("code", { children: code })
|
|
213
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
214
|
+
"data-control-ui": "code",
|
|
215
|
+
"data-control-family": "code",
|
|
216
|
+
"data-slot": "grid",
|
|
217
|
+
"data-density": isCompact ? "compact" : "default",
|
|
218
|
+
"aria-hidden": "true",
|
|
219
|
+
className: gridClassName,
|
|
220
|
+
style: {
|
|
221
|
+
...textStyle,
|
|
222
|
+
position: "relative",
|
|
223
|
+
height: `${virtualizer.getTotalSize()}px`
|
|
224
|
+
},
|
|
225
|
+
children: virtualizer.getVirtualItems().map((item) => /* @__PURE__ */ jsx(CodeRow, {
|
|
226
|
+
index: item.index,
|
|
227
|
+
number: startLine + item.index,
|
|
228
|
+
tokens: resolvedTokens?.[item.index] ?? null,
|
|
229
|
+
plain: plainLines[item.index] ?? "",
|
|
230
|
+
overflow,
|
|
231
|
+
showLineNumbers,
|
|
232
|
+
measureRef: virtualizer.measureElement,
|
|
233
|
+
style: {
|
|
234
|
+
position: "absolute",
|
|
235
|
+
top: 0,
|
|
236
|
+
left: 0,
|
|
237
|
+
width: "100%",
|
|
238
|
+
transform: `translateY(${item.start}px)`
|
|
239
|
+
}
|
|
240
|
+
}, item.key))
|
|
241
|
+
})] }) : /* @__PURE__ */ jsx("div", {
|
|
242
|
+
"data-control-ui": "code",
|
|
243
|
+
"data-control-family": "code",
|
|
244
|
+
"data-slot": "grid",
|
|
245
|
+
"data-density": isCompact ? "compact" : "default",
|
|
246
|
+
className: gridClassName,
|
|
247
|
+
style: textStyle,
|
|
248
|
+
children: plainLines.map((plain, index) => /* @__PURE__ */ jsx(CodeRow, {
|
|
249
|
+
number: startLine + index,
|
|
250
|
+
tokens: resolvedTokens?.[index] ?? null,
|
|
251
|
+
plain,
|
|
252
|
+
overflow,
|
|
253
|
+
showLineNumbers
|
|
254
|
+
}, index))
|
|
255
|
+
});
|
|
256
|
+
const content = useScrollArea ? /* @__PURE__ */ jsx(ScrollArea, {
|
|
257
|
+
maxHeight,
|
|
258
|
+
viewportClassName: className,
|
|
259
|
+
viewportProps: {
|
|
260
|
+
...props,
|
|
261
|
+
"data-control-ui": "code",
|
|
262
|
+
"data-control-family": "code",
|
|
263
|
+
"data-slot": "content",
|
|
264
|
+
style
|
|
265
|
+
},
|
|
266
|
+
viewportRef: setScrollElement,
|
|
267
|
+
children: grid
|
|
268
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
269
|
+
ref: setScrollElement,
|
|
270
|
+
"data-control-ui": "code",
|
|
271
|
+
"data-control-family": "code",
|
|
272
|
+
"data-slot": "content",
|
|
273
|
+
className: cn("overflow-auto", className),
|
|
274
|
+
style: {
|
|
275
|
+
...style,
|
|
276
|
+
maxHeight
|
|
277
|
+
},
|
|
278
|
+
...props,
|
|
279
|
+
children: grid
|
|
280
|
+
});
|
|
281
|
+
if (hasHeader || chrome === "embedded") return content;
|
|
282
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
283
|
+
"data-control-ui": "code",
|
|
284
|
+
"data-control-family": "code",
|
|
285
|
+
"data-slot": "floating-frame",
|
|
286
|
+
"data-density": isCompact ? "compact" : "default",
|
|
287
|
+
className: "relative",
|
|
288
|
+
children: [/* @__PURE__ */ jsx(CodeFloatingCopy, { value: code }), content]
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
//#endregion
|
|
292
|
+
export { Code, CodeActions, CodeContent, CodeCopy, CodeFloatingCopy, CodeHeader, CodeTitle, CodeTokenLine, useCodeTokens };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { OpenChangeEventDetails, RenderProp } from "../control-props.js";
|
|
2
|
+
import { CollapsibleKnobStyle } from "../knob-contracts/collapsible-knobs.js";
|
|
3
|
+
import { CSSProperties, ComponentProps, ReactNode } from "react";
|
|
4
|
+
//#region src/ui/collapsible.d.ts
|
|
5
|
+
type CollapsibleProps = Omit<ComponentProps<"div">, "onChange"> & {
|
|
6
|
+
open?: boolean;
|
|
7
|
+
defaultOpen?: boolean;
|
|
8
|
+
onOpenChange?: (open: boolean, eventDetails: OpenChangeEventDetails) => void;
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
} & {
|
|
11
|
+
style?: CSSProperties & CollapsibleKnobStyle;
|
|
12
|
+
};
|
|
13
|
+
type CollapsibleTriggerProps = Omit<ComponentProps<"button">, "style"> & {
|
|
14
|
+
"data-slot"?: string;
|
|
15
|
+
render?: RenderProp<ComponentProps<"button">, {
|
|
16
|
+
open: boolean;
|
|
17
|
+
}>;
|
|
18
|
+
nativeButton?: boolean;
|
|
19
|
+
style?: CSSProperties & CollapsibleKnobStyle;
|
|
20
|
+
};
|
|
21
|
+
type CollapsibleContentProps = ComponentProps<"div"> & {
|
|
22
|
+
"data-slot"?: string;
|
|
23
|
+
keepMounted?: boolean;
|
|
24
|
+
} & {
|
|
25
|
+
style?: CSSProperties & CollapsibleKnobStyle;
|
|
26
|
+
};
|
|
27
|
+
declare function Collapsible({ className, ...props }: CollapsibleProps): import("react").JSX.Element;
|
|
28
|
+
declare function CollapsibleTrigger({ render, className, children, ...props }: CollapsibleTriggerProps): import("react").JSX.Element;
|
|
29
|
+
declare function CollapsibleContent({ className, children, ...props }: CollapsibleContentProps): import("react").JSX.Element;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { Collapsible, CollapsibleContent, CollapsibleContentProps, CollapsibleProps, CollapsibleTrigger, CollapsibleTriggerProps };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.js";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { Collapsible as Collapsible$1 } from "@base-ui/react/collapsible";
|
|
6
|
+
//#region src/ui/collapsible.tsx
|
|
7
|
+
function CollapsibleTriggerElement({ triggerProps, open, render, className, children }) {
|
|
8
|
+
return useRender({
|
|
9
|
+
defaultTagName: "button",
|
|
10
|
+
render,
|
|
11
|
+
state: { open },
|
|
12
|
+
props: {
|
|
13
|
+
...triggerProps,
|
|
14
|
+
"data-control-ui": triggerProps["data-control-ui"] ?? "collapsible",
|
|
15
|
+
"data-control-family": triggerProps["data-control-family"] ?? "collapsible",
|
|
16
|
+
"data-slot": triggerProps["data-slot"] ?? "trigger",
|
|
17
|
+
"data-state": open ? "open" : "closed",
|
|
18
|
+
className: cn(triggerProps.className, className),
|
|
19
|
+
children
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function Collapsible({ className, ...props }) {
|
|
24
|
+
return /* @__PURE__ */ jsx(Collapsible$1.Root, {
|
|
25
|
+
className,
|
|
26
|
+
render: (renderProps, state) => /* @__PURE__ */ jsx("div", {
|
|
27
|
+
"data-control-ui": "collapsible",
|
|
28
|
+
"data-control-family": "collapsible",
|
|
29
|
+
"data-slot": "root",
|
|
30
|
+
...renderProps,
|
|
31
|
+
"data-state": state.open ? "open" : "closed",
|
|
32
|
+
className: renderProps.className
|
|
33
|
+
}),
|
|
34
|
+
...props
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function CollapsibleTrigger({ render, className, children, ...props }) {
|
|
38
|
+
return /* @__PURE__ */ jsx(Collapsible$1.Trigger, {
|
|
39
|
+
"data-control-ui": "collapsible",
|
|
40
|
+
"data-control-family": "collapsible",
|
|
41
|
+
"data-slot": "trigger",
|
|
42
|
+
className: "cursor-pointer",
|
|
43
|
+
...props,
|
|
44
|
+
render: (triggerProps, state) => /* @__PURE__ */ jsx(CollapsibleTriggerElement, {
|
|
45
|
+
triggerProps,
|
|
46
|
+
open: state.open,
|
|
47
|
+
render,
|
|
48
|
+
className,
|
|
49
|
+
children
|
|
50
|
+
})
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function CollapsibleContent({ className, children, ...props }) {
|
|
54
|
+
return /* @__PURE__ */ jsx(Collapsible$1.Panel, {
|
|
55
|
+
className: "h-[var(--collapsible-panel-height)] overflow-hidden data-ending-style:h-0 data-starting-style:h-0",
|
|
56
|
+
...props,
|
|
57
|
+
render: (renderProps, state) => /* @__PURE__ */ jsx("div", {
|
|
58
|
+
"data-control-ui": "collapsible",
|
|
59
|
+
"data-control-family": "collapsible",
|
|
60
|
+
"data-slot": "content",
|
|
61
|
+
...renderProps,
|
|
62
|
+
"data-state": state.open ? "open" : "closed",
|
|
63
|
+
className: renderProps.className
|
|
64
|
+
}),
|
|
65
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
66
|
+
className,
|
|
67
|
+
children
|
|
68
|
+
})
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
export { Collapsible, CollapsibleContent, CollapsibleTrigger };
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { OpenChangeEventDetails } from "../control-props.js";
|
|
2
|
+
import { ControlSize } from "../control-variants.js";
|
|
3
|
+
import { ButtonKnobStyle } from "../knob-contracts/button-knobs.js";
|
|
4
|
+
import { PopupKnobStyle } from "../knob-contracts/popup-knobs.js";
|
|
5
|
+
import { ColorPickerKnobStyle } from "../knob-contracts/color-picker-knobs.js";
|
|
6
|
+
import { CSSProperties, ComponentProps, ReactNode } from "react";
|
|
7
|
+
//#region src/ui/color-picker.d.ts
|
|
8
|
+
type ColorFormat = "hex" | "rgb" | "hsl" | "oklch";
|
|
9
|
+
type ColorPickerProps = {
|
|
10
|
+
value?: string;
|
|
11
|
+
defaultValue?: string;
|
|
12
|
+
onValueChange?: (value: string) => void;
|
|
13
|
+
format?: ColorFormat;
|
|
14
|
+
defaultFormat?: ColorFormat;
|
|
15
|
+
onFormatChange?: (format: ColorFormat) => void;
|
|
16
|
+
alpha?: boolean;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
open?: boolean;
|
|
19
|
+
defaultOpen?: boolean;
|
|
20
|
+
onOpenChange?: (open: boolean, eventDetails: OpenChangeEventDetails) => void;
|
|
21
|
+
children?: ReactNode;
|
|
22
|
+
};
|
|
23
|
+
type ColorPickerTriggerProps = Omit<ComponentProps<"button">, "style"> & {
|
|
24
|
+
style?: CSSProperties & ColorPickerKnobStyle;
|
|
25
|
+
};
|
|
26
|
+
type ColorPickerContentProps = Omit<ComponentProps<"div">, "style"> & {
|
|
27
|
+
style?: CSSProperties & PopupKnobStyle;
|
|
28
|
+
} & {
|
|
29
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
30
|
+
align?: "start" | "center" | "end";
|
|
31
|
+
sideOffset?: number;
|
|
32
|
+
};
|
|
33
|
+
type ColorPickerPanelProps = Omit<ComponentProps<"div">, "style"> & {
|
|
34
|
+
style?: CSSProperties & PopupKnobStyle;
|
|
35
|
+
};
|
|
36
|
+
type ColorPickerAreaProps = Omit<ComponentProps<"div">, "style"> & {
|
|
37
|
+
style?: CSSProperties & ColorPickerKnobStyle;
|
|
38
|
+
};
|
|
39
|
+
type ColorPickerAreaThumbProps = Omit<ComponentProps<"div">, "style"> & {
|
|
40
|
+
style?: CSSProperties & ColorPickerKnobStyle;
|
|
41
|
+
};
|
|
42
|
+
type ColorPickerHueProps = Omit<Pick<ComponentProps<"div">, "className" | "aria-label" | "aria-labelledby" | "style">, "style"> & {
|
|
43
|
+
style?: CSSProperties & ColorPickerKnobStyle;
|
|
44
|
+
};
|
|
45
|
+
type ColorPickerAlphaProps = Omit<Pick<ComponentProps<"div">, "className" | "aria-label" | "aria-labelledby" | "style">, "style"> & {
|
|
46
|
+
style?: CSSProperties & ColorPickerKnobStyle;
|
|
47
|
+
};
|
|
48
|
+
type ColorPickerWheelProps = Omit<ComponentProps<"div">, "style"> & {
|
|
49
|
+
style?: CSSProperties & ColorPickerKnobStyle;
|
|
50
|
+
};
|
|
51
|
+
type ColorPickerEyeDropperProps = Omit<Omit<ComponentProps<"button">, "onError">, "style"> & {
|
|
52
|
+
style?: CSSProperties & ButtonKnobStyle;
|
|
53
|
+
};
|
|
54
|
+
type ColorPickerInputProps = Omit<Omit<ComponentProps<"input">, "value" | "defaultValue" | "onChange" | "size">, "style"> & {
|
|
55
|
+
style?: CSSProperties & ColorPickerKnobStyle;
|
|
56
|
+
} & {
|
|
57
|
+
size?: ControlSize;
|
|
58
|
+
};
|
|
59
|
+
type ColorPickerFormatSelectProps = {
|
|
60
|
+
formats?: ColorFormat[];
|
|
61
|
+
size?: ControlSize;
|
|
62
|
+
className?: string;
|
|
63
|
+
"aria-label"?: string;
|
|
64
|
+
"aria-labelledby"?: string;
|
|
65
|
+
style?: CSSProperties & ButtonKnobStyle;
|
|
66
|
+
};
|
|
67
|
+
type ColorPickerChannelsProps = ComponentProps<"div"> & {
|
|
68
|
+
style?: CSSProperties & ColorPickerKnobStyle;
|
|
69
|
+
};
|
|
70
|
+
type ColorPickerChannelProps = Omit<Omit<ComponentProps<"div">, "children" | "aria-label">, "style"> & {
|
|
71
|
+
style?: CSSProperties & ColorPickerKnobStyle;
|
|
72
|
+
} & {
|
|
73
|
+
channel: "r" | "g" | "b" | "h" | "s" | "l" | "okl" | "okc" | "okh" | "a";
|
|
74
|
+
label?: ReactNode;
|
|
75
|
+
"aria-label"?: string;
|
|
76
|
+
};
|
|
77
|
+
type ColorPickerSwatchesProps = ComponentProps<"div"> & {
|
|
78
|
+
colors?: string[];
|
|
79
|
+
label?: ReactNode;
|
|
80
|
+
} & {
|
|
81
|
+
style?: CSSProperties & ColorPickerKnobStyle;
|
|
82
|
+
};
|
|
83
|
+
type ColorPickerSwatchProps = Omit<Omit<ComponentProps<"button">, "color">, "style"> & {
|
|
84
|
+
style?: CSSProperties & ColorPickerKnobStyle;
|
|
85
|
+
} & {
|
|
86
|
+
color: string;
|
|
87
|
+
};
|
|
88
|
+
type ColorPickerSwatchAddProps = Omit<Omit<ComponentProps<"button">, "onClick">, "style"> & {
|
|
89
|
+
style?: CSSProperties & ColorPickerKnobStyle;
|
|
90
|
+
} & {
|
|
91
|
+
onAdd?: (value: string) => void;
|
|
92
|
+
};
|
|
93
|
+
type ColorPickerContrastProps = Omit<Omit<ComponentProps<"div">, "children">, "style"> & {
|
|
94
|
+
style?: CSSProperties & ColorPickerKnobStyle;
|
|
95
|
+
} & {
|
|
96
|
+
background?: string;
|
|
97
|
+
};
|
|
98
|
+
type ColorPickerOutputProps = Omit<Omit<ComponentProps<"div">, "children">, "style"> & {
|
|
99
|
+
style?: CSSProperties & ColorPickerKnobStyle;
|
|
100
|
+
} & {
|
|
101
|
+
children?: ReactNode;
|
|
102
|
+
renderValue?: (state: {
|
|
103
|
+
value: string;
|
|
104
|
+
}) => ReactNode;
|
|
105
|
+
};
|
|
106
|
+
declare function ColorPicker({ open, defaultOpen, onOpenChange, children, ...state }: ColorPickerProps): import("react").JSX.Element;
|
|
107
|
+
declare function ColorPickerTrigger({ className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }: ColorPickerTriggerProps): import("react").JSX.Element;
|
|
108
|
+
declare function ColorPickerContent({ className, children, side, align, sideOffset, ...props }: ColorPickerContentProps): import("react").JSX.Element;
|
|
109
|
+
declare function ColorPickerPanel({ className, children, ...props }: ColorPickerPanelProps): import("react").JSX.Element;
|
|
110
|
+
declare function ColorPickerArea({ className, style, ...props }: ColorPickerAreaProps): import("react").JSX.Element;
|
|
111
|
+
declare function ColorPickerAreaThumb({ className, ...props }: ColorPickerAreaThumbProps): import("react").JSX.Element;
|
|
112
|
+
declare function ColorPickerHue({ className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }: ColorPickerHueProps): import("react").JSX.Element;
|
|
113
|
+
declare function ColorPickerAlpha({ className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }: ColorPickerAlphaProps): import("react").JSX.Element | null;
|
|
114
|
+
declare function ColorPickerWheel({ className, style, ...props }: ColorPickerWheelProps): import("react").JSX.Element;
|
|
115
|
+
declare function ColorPickerInput({ size, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }: ColorPickerInputProps): import("react").JSX.Element;
|
|
116
|
+
declare function ColorPickerFormatSelect({ formats, size, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, style }: ColorPickerFormatSelectProps): import("react").JSX.Element;
|
|
117
|
+
declare function ColorPickerChannels({ className, children, ...props }: ColorPickerChannelsProps): import("react").JSX.Element;
|
|
118
|
+
declare function ColorPickerChannel({ channel, label, className, "aria-label": ariaLabel, ...props }: ColorPickerChannelProps): import("react").JSX.Element | null;
|
|
119
|
+
declare global {
|
|
120
|
+
interface Window {
|
|
121
|
+
EyeDropper?: {
|
|
122
|
+
new (): {
|
|
123
|
+
open: () => Promise<{
|
|
124
|
+
sRGBHex: string;
|
|
125
|
+
}>;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
declare function ColorPickerEyeDropper({ className, children, ...props }: ColorPickerEyeDropperProps): import("react").JSX.Element | null;
|
|
131
|
+
declare function ColorPickerSwatches({ colors, label, className, children, ...props }: ColorPickerSwatchesProps): import("react").JSX.Element;
|
|
132
|
+
declare function ColorPickerSwatch({ color, className, "aria-label": ariaLabel, ...props }: ColorPickerSwatchProps): import("react").JSX.Element;
|
|
133
|
+
declare function ColorPickerSwatchAdd({ onAdd, className, children, ...props }: ColorPickerSwatchAddProps): import("react").JSX.Element;
|
|
134
|
+
declare function ColorPickerContrast({ background, className, ...props }: ColorPickerContrastProps): import("react").JSX.Element | null;
|
|
135
|
+
declare function ColorPickerOutput({ className, children, renderValue, ...props }: ColorPickerOutputProps): import("react").JSX.Element;
|
|
136
|
+
//#endregion
|
|
137
|
+
export { ColorFormat, ColorPicker, ColorPickerAlpha, ColorPickerAlphaProps, ColorPickerArea, ColorPickerAreaProps, ColorPickerAreaThumb, ColorPickerAreaThumbProps, ColorPickerChannel, ColorPickerChannelProps, ColorPickerChannels, ColorPickerChannelsProps, ColorPickerContent, ColorPickerContentProps, ColorPickerContrast, ColorPickerContrastProps, ColorPickerEyeDropper, ColorPickerEyeDropperProps, ColorPickerFormatSelect, ColorPickerFormatSelectProps, ColorPickerHue, ColorPickerHueProps, ColorPickerInput, ColorPickerInputProps, ColorPickerOutput, ColorPickerOutputProps, ColorPickerPanel, ColorPickerPanelProps, ColorPickerProps, ColorPickerSwatch, ColorPickerSwatchAdd, ColorPickerSwatchAddProps, ColorPickerSwatchProps, ColorPickerSwatches, ColorPickerSwatchesProps, ColorPickerTrigger, ColorPickerTriggerProps, ColorPickerWheel, ColorPickerWheelProps };
|