@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,167 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
//#region src/hooks/use-user-ask.ts
|
|
3
|
+
function upsert(entries, entry) {
|
|
4
|
+
const index = entries.findIndex((existing) => existing.key === entry.key);
|
|
5
|
+
if (index === -1) return [...entries, entry];
|
|
6
|
+
const next = [...entries];
|
|
7
|
+
next[index] = entry;
|
|
8
|
+
return next;
|
|
9
|
+
}
|
|
10
|
+
function useUserAsk({ onComplete, onDismiss }) {
|
|
11
|
+
const [questions, setQuestions] = useState([]);
|
|
12
|
+
const [optionsByQuestion, setOptionsByQuestion] = useState({});
|
|
13
|
+
const [selections, setSelections] = useState({});
|
|
14
|
+
const [freeformTexts, setFreeformTexts] = useState({});
|
|
15
|
+
const [requestedIndex, setRequestedIndex] = useState(0);
|
|
16
|
+
const [registerQuestion] = useState(() => (entry) => {
|
|
17
|
+
setQuestions((previous) => upsert(previous, entry));
|
|
18
|
+
});
|
|
19
|
+
const [unregisterQuestion] = useState(() => (key) => {
|
|
20
|
+
setQuestions((previous) => previous.filter((question) => question.key !== key));
|
|
21
|
+
});
|
|
22
|
+
const [registerOption] = useState(() => (questionId, entry) => {
|
|
23
|
+
setOptionsByQuestion((previous) => ({
|
|
24
|
+
...previous,
|
|
25
|
+
[questionId]: upsert(previous[questionId] ?? [], entry)
|
|
26
|
+
}));
|
|
27
|
+
});
|
|
28
|
+
const [unregisterOption] = useState(() => (questionId, key) => {
|
|
29
|
+
setOptionsByQuestion((previous) => ({
|
|
30
|
+
...previous,
|
|
31
|
+
[questionId]: (previous[questionId] ?? []).filter((option) => option.key !== key)
|
|
32
|
+
}));
|
|
33
|
+
});
|
|
34
|
+
const activeIndex = questions.length === 0 ? 0 : Math.min(requestedIndex, questions.length - 1);
|
|
35
|
+
const activeQuestion = questions[activeIndex];
|
|
36
|
+
function optionsFor(questionId) {
|
|
37
|
+
return optionsByQuestion[questionId] ?? [];
|
|
38
|
+
}
|
|
39
|
+
function selectionFor(questionId) {
|
|
40
|
+
const explicit = selections[questionId];
|
|
41
|
+
if (explicit) return explicit;
|
|
42
|
+
const defaultValue = questions.find((question) => question.id === questionId)?.defaultValue;
|
|
43
|
+
if (defaultValue === void 0) return void 0;
|
|
44
|
+
return optionsFor(questionId).find((option) => !option.freeform && option.value === defaultValue)?.key;
|
|
45
|
+
}
|
|
46
|
+
function isSelected(questionId, optionKey) {
|
|
47
|
+
return selectionFor(questionId) === optionKey;
|
|
48
|
+
}
|
|
49
|
+
function select(questionId, optionKey) {
|
|
50
|
+
setSelections((previous) => ({
|
|
51
|
+
...previous,
|
|
52
|
+
[questionId]: optionKey
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
function freeformTextFor(questionId) {
|
|
56
|
+
return freeformTexts[questionId] ?? "";
|
|
57
|
+
}
|
|
58
|
+
function setFreeformText(questionId, text) {
|
|
59
|
+
setFreeformTexts((previous) => ({
|
|
60
|
+
...previous,
|
|
61
|
+
[questionId]: text
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
function answerFor(questionId) {
|
|
65
|
+
const selectedKey = selectionFor(questionId);
|
|
66
|
+
const option = optionsFor(questionId).find((entry) => entry.key === selectedKey);
|
|
67
|
+
if (!option) return void 0;
|
|
68
|
+
if (!option.freeform) return option.value;
|
|
69
|
+
const text = freeformTextFor(questionId).trim();
|
|
70
|
+
return text.length > 0 ? text : void 0;
|
|
71
|
+
}
|
|
72
|
+
const canContinue = activeQuestion !== void 0 && answerFor(activeQuestion.id) !== void 0;
|
|
73
|
+
const isLastQuestion = activeIndex === questions.length - 1;
|
|
74
|
+
function goTo(index) {
|
|
75
|
+
setRequestedIndex(Math.max(0, Math.min(index, questions.length - 1)));
|
|
76
|
+
}
|
|
77
|
+
function resolveAnswers() {
|
|
78
|
+
const answers = {};
|
|
79
|
+
for (const question of questions) {
|
|
80
|
+
const answer = answerFor(question.id);
|
|
81
|
+
if (answer !== void 0) answers[question.id] = answer;
|
|
82
|
+
}
|
|
83
|
+
return answers;
|
|
84
|
+
}
|
|
85
|
+
function advance() {
|
|
86
|
+
if (!canContinue) return;
|
|
87
|
+
if (isLastQuestion) onComplete?.(resolveAnswers());
|
|
88
|
+
else goTo(activeIndex + 1);
|
|
89
|
+
}
|
|
90
|
+
function dismiss() {
|
|
91
|
+
onDismiss?.();
|
|
92
|
+
}
|
|
93
|
+
function moveSelection(delta) {
|
|
94
|
+
if (!activeQuestion) return;
|
|
95
|
+
const options = optionsFor(activeQuestion.id);
|
|
96
|
+
if (!options.some((option) => !option.disabled)) return;
|
|
97
|
+
const currentKey = selectionFor(activeQuestion.id);
|
|
98
|
+
const currentIndex = options.findIndex((option) => option.key === currentKey);
|
|
99
|
+
let start = currentIndex;
|
|
100
|
+
if (currentIndex === -1) start = delta > 0 ? -1 : 0;
|
|
101
|
+
for (let step = 1; step <= options.length; step += 1) {
|
|
102
|
+
const candidate = options[(start + delta * step + options.length * step) % options.length];
|
|
103
|
+
if (candidate && !candidate.disabled) {
|
|
104
|
+
select(activeQuestion.id, candidate.key);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function selectDigit(digit) {
|
|
110
|
+
if (!activeQuestion) return;
|
|
111
|
+
const option = optionsFor(activeQuestion.id)[digit - 1];
|
|
112
|
+
if (option && !option.disabled) select(activeQuestion.id, option.key);
|
|
113
|
+
}
|
|
114
|
+
function handleKeyDown(event) {
|
|
115
|
+
if (event.defaultPrevented) return;
|
|
116
|
+
if (event.key === "Escape") {
|
|
117
|
+
event.preventDefault();
|
|
118
|
+
dismiss();
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
if (event.key === "Enter") {
|
|
122
|
+
event.preventDefault();
|
|
123
|
+
advance();
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
if (event.target instanceof HTMLElement && event.target.closest("input, textarea, [contenteditable]")) return;
|
|
127
|
+
if (event.key === "ArrowDown") {
|
|
128
|
+
event.preventDefault();
|
|
129
|
+
moveSelection(1);
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
if (event.key === "ArrowUp") {
|
|
133
|
+
event.preventDefault();
|
|
134
|
+
moveSelection(-1);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (/^[1-9]$/.test(event.key)) {
|
|
138
|
+
event.preventDefault();
|
|
139
|
+
selectDigit(Number(event.key));
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
questions,
|
|
144
|
+
activeIndex,
|
|
145
|
+
activeQuestion,
|
|
146
|
+
canContinue,
|
|
147
|
+
isLastQuestion,
|
|
148
|
+
registerQuestion,
|
|
149
|
+
unregisterQuestion,
|
|
150
|
+
registerOption,
|
|
151
|
+
unregisterOption,
|
|
152
|
+
optionsFor,
|
|
153
|
+
selectionFor,
|
|
154
|
+
isSelected,
|
|
155
|
+
select,
|
|
156
|
+
freeformTextFor,
|
|
157
|
+
setFreeformText,
|
|
158
|
+
answerFor,
|
|
159
|
+
resolveAnswers,
|
|
160
|
+
goTo,
|
|
161
|
+
advance,
|
|
162
|
+
dismiss,
|
|
163
|
+
handleKeyDown
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
//#endregion
|
|
167
|
+
export { useUserAsk };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { InlineAttachmentKnobStyle } from "./knob-contracts/inline-attachment-knobs.js";
|
|
2
|
+
import { CSSProperties, ComponentProps } from "react";
|
|
3
|
+
//#region src/inline-attachment.d.ts
|
|
4
|
+
type InlineAttachmentState = "ready" | "pending" | "error";
|
|
5
|
+
type InlineAttachmentStyleProps<Props, Style> = Omit<Props, "style"> & {
|
|
6
|
+
style?: CSSProperties & Style;
|
|
7
|
+
};
|
|
8
|
+
type InlineAttachmentProps = InlineAttachmentStyleProps<ComponentProps<"button">, InlineAttachmentKnobStyle> & {
|
|
9
|
+
name: string;
|
|
10
|
+
state?: InlineAttachmentState;
|
|
11
|
+
/** Width-to-height ratio of the reserved box — generated media knows its ratio before its pixels, so arrival never reflows the turn. */
|
|
12
|
+
aspect?: number;
|
|
13
|
+
};
|
|
14
|
+
declare function InlineAttachment({ name, state, aspect, disabled, className, children, style, "aria-label": ariaLabel, ...props }: InlineAttachmentProps): import("react").JSX.Element;
|
|
15
|
+
type InlineAttachmentMediaProps = ComponentProps<"div"> & {
|
|
16
|
+
src?: string;
|
|
17
|
+
alt?: string;
|
|
18
|
+
} & {
|
|
19
|
+
style?: CSSProperties & InlineAttachmentKnobStyle;
|
|
20
|
+
};
|
|
21
|
+
declare function InlineAttachmentMedia({ src, alt, className, children, ...props }: InlineAttachmentMediaProps): import("react").JSX.Element;
|
|
22
|
+
type InlineAttachmentContentProps = InlineAttachmentStyleProps<ComponentProps<"div">, InlineAttachmentKnobStyle>;
|
|
23
|
+
declare function InlineAttachmentContent({ className, ...props }: InlineAttachmentContentProps): import("react").JSX.Element;
|
|
24
|
+
type InlineAttachmentTitleProps = ComponentProps<"div"> & {
|
|
25
|
+
style?: CSSProperties & InlineAttachmentKnobStyle;
|
|
26
|
+
};
|
|
27
|
+
declare function InlineAttachmentTitle({ children, className, ...props }: InlineAttachmentTitleProps): import("react").JSX.Element;
|
|
28
|
+
type InlineAttachmentDescriptionProps = InlineAttachmentStyleProps<ComponentProps<"div">, InlineAttachmentKnobStyle>;
|
|
29
|
+
declare function InlineAttachmentDescription({ className, ...props }: InlineAttachmentDescriptionProps): import("react").JSX.Element;
|
|
30
|
+
type InlineAttachmentActionsProps = ComponentProps<"div"> & {
|
|
31
|
+
style?: CSSProperties & InlineAttachmentKnobStyle;
|
|
32
|
+
};
|
|
33
|
+
declare function InlineAttachmentActions({ className, ...props }: InlineAttachmentActionsProps): import("react").JSX.Element;
|
|
34
|
+
type InlineAttachmentActionProps = InlineAttachmentStyleProps<ComponentProps<"span">, InlineAttachmentKnobStyle>;
|
|
35
|
+
declare function InlineAttachmentAction({ className, ...props }: InlineAttachmentActionProps): import("react").JSX.Element;
|
|
36
|
+
//#endregion
|
|
37
|
+
export { InlineAttachment, InlineAttachmentAction, InlineAttachmentActionProps, InlineAttachmentActions, InlineAttachmentActionsProps, InlineAttachmentContent, InlineAttachmentContentProps, InlineAttachmentDescription, InlineAttachmentDescriptionProps, InlineAttachmentMedia, InlineAttachmentMediaProps, InlineAttachmentProps, InlineAttachmentState, InlineAttachmentTitle, InlineAttachmentTitleProps };
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "./lib/cn.js";
|
|
3
|
+
import { createContext, useContext } from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/inline-attachment.tsx
|
|
6
|
+
const InlineAttachmentContext = createContext(null);
|
|
7
|
+
function useInlineAttachmentContext() {
|
|
8
|
+
const context = useContext(InlineAttachmentContext);
|
|
9
|
+
if (!context) throw new Error("InlineAttachment compound components must be rendered inside <InlineAttachment>.");
|
|
10
|
+
return context;
|
|
11
|
+
}
|
|
12
|
+
function defaultLabel(name, state) {
|
|
13
|
+
if (state === "pending") return `Generating ${name}`;
|
|
14
|
+
if (state === "error") return `${name} is unavailable`;
|
|
15
|
+
return `Open attachment: ${name}`;
|
|
16
|
+
}
|
|
17
|
+
function InlineAttachment({ name, state = "ready", aspect = 1.26, disabled, className, children, style, "aria-label": ariaLabel, ...props }) {
|
|
18
|
+
const attachmentStyle = {
|
|
19
|
+
aspectRatio: aspect,
|
|
20
|
+
...style
|
|
21
|
+
};
|
|
22
|
+
return /* @__PURE__ */ jsx(InlineAttachmentContext.Provider, {
|
|
23
|
+
value: {
|
|
24
|
+
name,
|
|
25
|
+
state
|
|
26
|
+
},
|
|
27
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
28
|
+
type: "button",
|
|
29
|
+
"aria-label": ariaLabel ?? defaultLabel(name, state),
|
|
30
|
+
"aria-busy": state === "pending" || void 0,
|
|
31
|
+
disabled: disabled || state === "pending",
|
|
32
|
+
"data-control-ui": "inline-attachment",
|
|
33
|
+
"data-control-family": "inline-attachment",
|
|
34
|
+
"data-slot": "root",
|
|
35
|
+
"data-surface": "panel",
|
|
36
|
+
"data-state": state,
|
|
37
|
+
className: cn("group relative w-full max-w-72 cursor-pointer overflow-hidden disabled:cursor-default", className),
|
|
38
|
+
style: attachmentStyle,
|
|
39
|
+
...props,
|
|
40
|
+
children
|
|
41
|
+
})
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function GeneratingPlaceholder() {
|
|
45
|
+
return /* @__PURE__ */ jsx("div", {
|
|
46
|
+
"aria-hidden": "true",
|
|
47
|
+
"data-control-ui": "inline-attachment",
|
|
48
|
+
"data-control-family": "inline-attachment",
|
|
49
|
+
"data-slot": "placeholder",
|
|
50
|
+
className: cn("size-full", "halftone")
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function DocumentPlaceholder() {
|
|
54
|
+
return /* @__PURE__ */ jsx("div", {
|
|
55
|
+
"data-control-ui": "inline-attachment",
|
|
56
|
+
"data-control-family": "inline-attachment",
|
|
57
|
+
"data-slot": "document",
|
|
58
|
+
className: "size-full",
|
|
59
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
60
|
+
"data-control-ui": "inline-attachment",
|
|
61
|
+
"data-control-family": "inline-attachment",
|
|
62
|
+
"data-slot": "document-sheet",
|
|
63
|
+
className: "h-full",
|
|
64
|
+
children: [
|
|
65
|
+
/* @__PURE__ */ jsx("div", {
|
|
66
|
+
"data-control-ui": "inline-attachment",
|
|
67
|
+
"data-control-family": "inline-attachment",
|
|
68
|
+
"data-slot": "document-heading",
|
|
69
|
+
className: ""
|
|
70
|
+
}),
|
|
71
|
+
/* @__PURE__ */ jsxs("div", {
|
|
72
|
+
className: "grid",
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ jsx("div", {
|
|
75
|
+
"data-control-ui": "inline-attachment",
|
|
76
|
+
"data-control-family": "inline-attachment",
|
|
77
|
+
"data-slot": "document-line",
|
|
78
|
+
"data-width": "long",
|
|
79
|
+
className: ""
|
|
80
|
+
}),
|
|
81
|
+
/* @__PURE__ */ jsx("div", {
|
|
82
|
+
"data-control-ui": "inline-attachment",
|
|
83
|
+
"data-control-family": "inline-attachment",
|
|
84
|
+
"data-slot": "document-line",
|
|
85
|
+
"data-width": "medium",
|
|
86
|
+
className: ""
|
|
87
|
+
}),
|
|
88
|
+
/* @__PURE__ */ jsx("div", {
|
|
89
|
+
"data-control-ui": "inline-attachment",
|
|
90
|
+
"data-control-family": "inline-attachment",
|
|
91
|
+
"data-slot": "document-line",
|
|
92
|
+
"data-width": "longest",
|
|
93
|
+
className: ""
|
|
94
|
+
}),
|
|
95
|
+
/* @__PURE__ */ jsx("div", {
|
|
96
|
+
"data-control-ui": "inline-attachment",
|
|
97
|
+
"data-control-family": "inline-attachment",
|
|
98
|
+
"data-slot": "document-line",
|
|
99
|
+
"data-width": "short",
|
|
100
|
+
className: ""
|
|
101
|
+
})
|
|
102
|
+
]
|
|
103
|
+
}),
|
|
104
|
+
/* @__PURE__ */ jsx("div", {
|
|
105
|
+
"data-control-ui": "inline-attachment",
|
|
106
|
+
"data-control-family": "inline-attachment",
|
|
107
|
+
"data-slot": "document-stamp",
|
|
108
|
+
className: ""
|
|
109
|
+
})
|
|
110
|
+
]
|
|
111
|
+
})
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
function mediaContent({ state, src, alt, children }) {
|
|
115
|
+
if (state === "pending") return /* @__PURE__ */ jsx(GeneratingPlaceholder, {});
|
|
116
|
+
if (src) return /* @__PURE__ */ jsx("img", {
|
|
117
|
+
src,
|
|
118
|
+
alt,
|
|
119
|
+
loading: "lazy",
|
|
120
|
+
decoding: "async",
|
|
121
|
+
"data-control-ui": "inline-attachment",
|
|
122
|
+
"data-control-family": "inline-attachment",
|
|
123
|
+
"data-slot": "media-image",
|
|
124
|
+
className: "size-full object-cover"
|
|
125
|
+
});
|
|
126
|
+
return children ?? /* @__PURE__ */ jsx(DocumentPlaceholder, {});
|
|
127
|
+
}
|
|
128
|
+
function InlineAttachmentMedia({ src, alt, className, children, ...props }) {
|
|
129
|
+
const { name, state } = useInlineAttachmentContext();
|
|
130
|
+
return /* @__PURE__ */ jsx("div", {
|
|
131
|
+
"data-control-ui": "inline-attachment",
|
|
132
|
+
"data-control-family": "inline-attachment",
|
|
133
|
+
"data-slot": "image",
|
|
134
|
+
className: cn("size-full", className),
|
|
135
|
+
...props,
|
|
136
|
+
children: mediaContent({
|
|
137
|
+
state,
|
|
138
|
+
src,
|
|
139
|
+
alt: alt ?? name,
|
|
140
|
+
children
|
|
141
|
+
})
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
function InlineAttachmentContent({ className, ...props }) {
|
|
145
|
+
return /* @__PURE__ */ jsx("div", {
|
|
146
|
+
"data-control-ui": "inline-attachment",
|
|
147
|
+
"data-control-family": "inline-attachment",
|
|
148
|
+
"data-slot": "content",
|
|
149
|
+
className: cn("absolute inset-x-3 bottom-3", className),
|
|
150
|
+
...props
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
function InlineAttachmentTitle({ children, className, ...props }) {
|
|
154
|
+
const { name } = useInlineAttachmentContext();
|
|
155
|
+
return /* @__PURE__ */ jsx("div", {
|
|
156
|
+
"data-control-ui": "inline-attachment",
|
|
157
|
+
"data-control-family": "inline-attachment",
|
|
158
|
+
"data-slot": "title",
|
|
159
|
+
className: cn("truncate", className),
|
|
160
|
+
...props,
|
|
161
|
+
children: children ?? name
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
function InlineAttachmentDescription({ className, ...props }) {
|
|
165
|
+
return /* @__PURE__ */ jsx("div", {
|
|
166
|
+
"data-control-ui": "inline-attachment",
|
|
167
|
+
"data-control-family": "inline-attachment",
|
|
168
|
+
"data-slot": "description",
|
|
169
|
+
className: cn("truncate", className),
|
|
170
|
+
...props
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
function InlineAttachmentActions({ className, ...props }) {
|
|
174
|
+
return /* @__PURE__ */ jsx("div", {
|
|
175
|
+
"data-control-ui": "inline-attachment",
|
|
176
|
+
"data-control-family": "inline-attachment",
|
|
177
|
+
"data-slot": "actions",
|
|
178
|
+
className: cn("flex items-center", className),
|
|
179
|
+
...props
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
function InlineAttachmentAction({ className, ...props }) {
|
|
183
|
+
return /* @__PURE__ */ jsx("span", {
|
|
184
|
+
"data-control-ui": "inline-attachment",
|
|
185
|
+
"data-control-family": "inline-attachment",
|
|
186
|
+
"data-slot": "action",
|
|
187
|
+
className: cn(className),
|
|
188
|
+
...props
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
//#endregion
|
|
192
|
+
export { InlineAttachment, InlineAttachmentAction, InlineAttachmentActions, InlineAttachmentContent, InlineAttachmentDescription, InlineAttachmentMedia, InlineAttachmentTitle };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Button } from "./ui/button.js";
|
|
2
|
+
import { Popover, PopoverContent, PopoverTrigger } from "./ui/popover.js";
|
|
3
|
+
import { InlineCitationKnobStyle } from "./knob-contracts/inline-citation-knobs.js";
|
|
4
|
+
import { CSSProperties, ComponentProps, ReactNode } from "react";
|
|
5
|
+
//#region src/inline-citation.d.ts
|
|
6
|
+
type SourceReference = {
|
|
7
|
+
href: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
quote?: string;
|
|
11
|
+
faviconSrc?: string | false;
|
|
12
|
+
};
|
|
13
|
+
type InlineCitationStyleProps<Props, Style> = Omit<Props, "style"> & {
|
|
14
|
+
style?: CSSProperties & Style;
|
|
15
|
+
};
|
|
16
|
+
type PopoverRootProps = ComponentProps<typeof Popover>;
|
|
17
|
+
type InlineCitationProps = ComponentProps<"span"> & {
|
|
18
|
+
sources: readonly SourceReference[];
|
|
19
|
+
open?: PopoverRootProps["open"];
|
|
20
|
+
defaultOpen?: PopoverRootProps["defaultOpen"];
|
|
21
|
+
onOpenChange?: PopoverRootProps["onOpenChange"];
|
|
22
|
+
} & {
|
|
23
|
+
style?: CSSProperties & InlineCitationKnobStyle;
|
|
24
|
+
};
|
|
25
|
+
declare function InlineCitation({ sources, open, defaultOpen, onOpenChange, className, children, ...props }: InlineCitationProps): import("react").JSX.Element;
|
|
26
|
+
type InlineCitationTriggerProps = InlineCitationStyleProps<ComponentProps<typeof PopoverTrigger>, InlineCitationKnobStyle>;
|
|
27
|
+
declare function InlineCitationTrigger({ "aria-label": ariaLabel, className, children, disabled, render, ...props }: InlineCitationTriggerProps): import("react").JSX.Element;
|
|
28
|
+
type InlineCitationFaviconsProps = InlineCitationStyleProps<ComponentProps<"span">, InlineCitationKnobStyle> & {
|
|
29
|
+
limit?: number;
|
|
30
|
+
};
|
|
31
|
+
declare function InlineCitationFavicons({ limit, className, ...props }: InlineCitationFaviconsProps): import("react").JSX.Element;
|
|
32
|
+
type InlineCitationLabelProps = ComponentProps<"span"> & {
|
|
33
|
+
style?: CSSProperties & InlineCitationKnobStyle;
|
|
34
|
+
};
|
|
35
|
+
declare function InlineCitationLabel({ className, children, ...props }: InlineCitationLabelProps): import("react").JSX.Element;
|
|
36
|
+
type InlineCitationContentProps = ComponentProps<typeof PopoverContent>;
|
|
37
|
+
declare function InlineCitationContent({ className, children, align, padding, ...props }: InlineCitationContentProps): import("react").JSX.Element;
|
|
38
|
+
type InlineCitationNavigationProps = InlineCitationStyleProps<ComponentProps<"div">, InlineCitationKnobStyle>;
|
|
39
|
+
declare function InlineCitationNavigation({ className, children, ...props }: InlineCitationNavigationProps): import("react").JSX.Element;
|
|
40
|
+
type InlineCitationPreviousProps = Omit<ComponentProps<typeof Button>, "children"> & {
|
|
41
|
+
children?: ReactNode;
|
|
42
|
+
};
|
|
43
|
+
declare function InlineCitationPrevious({ className, children, disabled, onClick, ...props }: InlineCitationPreviousProps): import("react").JSX.Element;
|
|
44
|
+
type InlineCitationNextProps = Omit<ComponentProps<typeof Button>, "children"> & {
|
|
45
|
+
children?: ReactNode;
|
|
46
|
+
};
|
|
47
|
+
declare function InlineCitationNext({ className, children, disabled, onClick, ...props }: InlineCitationNextProps): import("react").JSX.Element;
|
|
48
|
+
type InlineCitationPositionProps = InlineCitationStyleProps<ComponentProps<"span">, InlineCitationKnobStyle>;
|
|
49
|
+
declare function InlineCitationPosition({ className, children, ...props }: InlineCitationPositionProps): import("react").JSX.Element;
|
|
50
|
+
type InlineCitationSourceProps = Omit<ComponentProps<"article">, "style"> & {
|
|
51
|
+
source?: SourceReference;
|
|
52
|
+
style?: CSSProperties & InlineCitationKnobStyle;
|
|
53
|
+
};
|
|
54
|
+
declare function InlineCitationSource({ source: sourceProp, className, children, style, ref, ...props }: InlineCitationSourceProps): import("react").JSX.Element | null;
|
|
55
|
+
//#endregion
|
|
56
|
+
export { InlineCitation, InlineCitationContent, InlineCitationContentProps, InlineCitationFavicons, InlineCitationFaviconsProps, InlineCitationLabel, InlineCitationLabelProps, InlineCitationNavigation, InlineCitationNavigationProps, InlineCitationNext, InlineCitationNextProps, InlineCitationPosition, InlineCitationPositionProps, InlineCitationPrevious, InlineCitationPreviousProps, InlineCitationProps, InlineCitationSource, InlineCitationSourceProps, InlineCitationTrigger, InlineCitationTriggerProps, SourceReference };
|