@sero-ai/ui 0.3.0 → 0.3.2
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/dist/components/ai-elements/agent.cjs +89 -0
- package/dist/components/ai-elements/agent.d.cts +32 -0
- package/dist/components/ai-elements/agent.d.ts +32 -0
- package/dist/components/ai-elements/agent.js +89 -0
- package/dist/components/ai-elements/artifact.cjs +121 -0
- package/dist/components/ai-elements/artifact.d.cts +29 -0
- package/dist/components/ai-elements/artifact.d.ts +29 -0
- package/dist/components/ai-elements/artifact.js +121 -0
- package/dist/components/ai-elements/attachments.cjs +283 -0
- package/dist/components/ai-elements/attachments.d.cts +60 -0
- package/dist/components/ai-elements/attachments.d.ts +60 -0
- package/dist/components/ai-elements/attachments.js +283 -0
- package/dist/components/ai-elements/audio-player.cjs +174 -0
- package/dist/components/ai-elements/audio-player.d.cts +33 -0
- package/dist/components/ai-elements/audio-player.d.ts +33 -0
- package/dist/components/ai-elements/audio-player.js +174 -0
- package/dist/components/ai-elements/canvas.cjs +23 -0
- package/dist/components/ai-elements/canvas.d.cts +10 -0
- package/dist/components/ai-elements/canvas.d.ts +10 -0
- package/dist/components/ai-elements/canvas.js +23 -0
- package/dist/components/ai-elements/chain-of-thought.cjs +170 -0
- package/dist/components/ai-elements/chain-of-thought.d.cts +37 -0
- package/dist/components/ai-elements/chain-of-thought.d.ts +37 -0
- package/dist/components/ai-elements/chain-of-thought.js +170 -0
- package/dist/components/ai-elements/checkpoint.cjs +49 -0
- package/dist/components/ai-elements/checkpoint.d.cts +18 -0
- package/dist/components/ai-elements/checkpoint.d.ts +18 -0
- package/dist/components/ai-elements/checkpoint.js +49 -0
- package/dist/components/ai-elements/code-block.cjs +380 -0
- package/dist/components/ai-elements/code-block.d.cts +51 -0
- package/dist/components/ai-elements/code-block.d.ts +51 -0
- package/dist/components/ai-elements/code-block.js +380 -0
- package/dist/components/ai-elements/commit.cjs +337 -0
- package/dist/components/ai-elements/commit.d.cts +71 -0
- package/dist/components/ai-elements/commit.d.ts +71 -0
- package/dist/components/ai-elements/commit.js +337 -0
- package/dist/components/ai-elements/confirmation.cjs +82 -0
- package/dist/components/ai-elements/confirmation.d.cts +54 -0
- package/dist/components/ai-elements/confirmation.d.ts +54 -0
- package/dist/components/ai-elements/confirmation.js +82 -0
- package/dist/components/ai-elements/connection.cjs +33 -0
- package/dist/components/ai-elements/connection.d.cts +5 -0
- package/dist/components/ai-elements/connection.d.ts +5 -0
- package/dist/components/ai-elements/connection.js +33 -0
- package/dist/components/ai-elements/context.cjs +329 -0
- package/dist/components/ai-elements/context.d.cts +39 -0
- package/dist/components/ai-elements/context.d.ts +39 -0
- package/dist/components/ai-elements/context.js +329 -0
- package/dist/components/ai-elements/controls.cjs +18 -0
- package/dist/components/ai-elements/controls.d.cts +8 -0
- package/dist/components/ai-elements/controls.d.ts +8 -0
- package/dist/components/ai-elements/controls.js +18 -0
- package/dist/components/ai-elements/conversation.cjs +124 -0
- package/dist/components/ai-elements/conversation.d.cts +32 -0
- package/dist/components/ai-elements/conversation.d.ts +32 -0
- package/dist/components/ai-elements/conversation.js +124 -0
- package/dist/components/ai-elements/edge.cjs +116 -0
- package/dist/components/ai-elements/edge.d.cts +9 -0
- package/dist/components/ai-elements/edge.d.ts +9 -0
- package/dist/components/ai-elements/edge.js +116 -0
- package/dist/components/ai-elements/environment-variables.cjs +227 -0
- package/dist/components/ai-elements/environment-variables.d.cts +45 -0
- package/dist/components/ai-elements/environment-variables.d.ts +45 -0
- package/dist/components/ai-elements/environment-variables.js +227 -0
- package/dist/components/ai-elements/file-tree.cjs +217 -0
- package/dist/components/ai-elements/file-tree.d.cts +30 -0
- package/dist/components/ai-elements/file-tree.d.ts +30 -0
- package/dist/components/ai-elements/file-tree.js +217 -0
- package/dist/components/ai-elements/image.cjs +22 -0
- package/dist/components/ai-elements/image.d.cts +10 -0
- package/dist/components/ai-elements/image.d.ts +10 -0
- package/dist/components/ai-elements/image.js +22 -0
- package/dist/components/ai-elements/inline-citation.cjs +223 -0
- package/dist/components/ai-elements/inline-citation.d.cts +47 -0
- package/dist/components/ai-elements/inline-citation.d.ts +47 -0
- package/dist/components/ai-elements/inline-citation.js +223 -0
- package/dist/components/ai-elements/jsx-preview.cjs +176 -0
- package/dist/components/ai-elements/jsx-preview.d.cts +31 -0
- package/dist/components/ai-elements/jsx-preview.d.ts +31 -0
- package/dist/components/ai-elements/jsx-preview.js +176 -0
- package/dist/components/ai-elements/message.cjs +287 -0
- package/dist/components/ai-elements/message.d.cts +46 -0
- package/dist/components/ai-elements/message.d.ts +46 -0
- package/dist/components/ai-elements/message.js +287 -0
- package/dist/components/ai-elements/mic-selector.cjs +275 -0
- package/dist/components/ai-elements/mic-selector.d.cts +54 -0
- package/dist/components/ai-elements/mic-selector.d.ts +54 -0
- package/dist/components/ai-elements/mic-selector.js +275 -0
- package/dist/components/ai-elements/model-selector.cjs +100 -0
- package/dist/components/ai-elements/model-selector.d.cts +41 -0
- package/dist/components/ai-elements/model-selector.d.ts +41 -0
- package/dist/components/ai-elements/model-selector.js +100 -0
- package/dist/components/ai-elements/node.cjs +54 -0
- package/dist/components/ai-elements/node.d.cts +25 -0
- package/dist/components/ai-elements/node.d.ts +25 -0
- package/dist/components/ai-elements/node.js +54 -0
- package/dist/components/ai-elements/open-in-chat.cjs +353 -0
- package/dist/components/ai-elements/open-in-chat.d.cts +33 -0
- package/dist/components/ai-elements/open-in-chat.d.ts +33 -0
- package/dist/components/ai-elements/open-in-chat.js +353 -0
- package/dist/components/ai-elements/package-info.cjs +171 -0
- package/dist/components/ai-elements/package-info.d.cts +32 -0
- package/dist/components/ai-elements/package-info.d.ts +32 -0
- package/dist/components/ai-elements/package-info.js +171 -0
- package/dist/components/ai-elements/panel.cjs +16 -0
- package/dist/components/ai-elements/panel.d.cts +8 -0
- package/dist/components/ai-elements/panel.d.ts +8 -0
- package/dist/components/ai-elements/panel.js +16 -0
- package/dist/components/ai-elements/persona.cjs +202 -0
- package/dist/components/ai-elements/persona.d.cts +50 -0
- package/dist/components/ai-elements/persona.d.ts +50 -0
- package/dist/components/ai-elements/persona.js +202 -0
- package/dist/components/ai-elements/plan.cjs +90 -0
- package/dist/components/ai-elements/plan.d.cts +30 -0
- package/dist/components/ai-elements/plan.d.ts +30 -0
- package/dist/components/ai-elements/plan.js +90 -0
- package/dist/components/ai-elements/prompt-input-context.cjs +161 -0
- package/dist/components/ai-elements/prompt-input-context.d.cts +58 -0
- package/dist/components/ai-elements/prompt-input-context.d.ts +58 -0
- package/dist/components/ai-elements/prompt-input-context.js +161 -0
- package/dist/components/ai-elements/prompt-input-elements.cjs +246 -0
- package/dist/components/ai-elements/prompt-input-elements.d.cts +88 -0
- package/dist/components/ai-elements/prompt-input-elements.d.ts +88 -0
- package/dist/components/ai-elements/prompt-input-elements.js +246 -0
- package/dist/components/ai-elements/prompt-input-textarea.cjs +89 -0
- package/dist/components/ai-elements/prompt-input-textarea.d.cts +11 -0
- package/dist/components/ai-elements/prompt-input-textarea.d.ts +11 -0
- package/dist/components/ai-elements/prompt-input-textarea.js +89 -0
- package/dist/components/ai-elements/prompt-input.cjs +306 -0
- package/dist/components/ai-elements/prompt-input.d.cts +39 -0
- package/dist/components/ai-elements/prompt-input.d.ts +39 -0
- package/dist/components/ai-elements/prompt-input.js +306 -0
- package/dist/components/ai-elements/queue.cjs +193 -0
- package/dist/components/ai-elements/queue.d.cts +68 -0
- package/dist/components/ai-elements/queue.d.ts +68 -0
- package/dist/components/ai-elements/queue.js +193 -0
- package/dist/components/ai-elements/reasoning.cjs +178 -0
- package/dist/components/ai-elements/reasoning.d.cts +31 -0
- package/dist/components/ai-elements/reasoning.d.ts +31 -0
- package/dist/components/ai-elements/reasoning.js +178 -0
- package/dist/components/ai-elements/sandbox.cjs +114 -0
- package/dist/components/ai-elements/sandbox.d.cts +31 -0
- package/dist/components/ai-elements/sandbox.d.ts +31 -0
- package/dist/components/ai-elements/sandbox.js +114 -0
- package/dist/components/ai-elements/schema-display.cjs +330 -0
- package/dist/components/ai-elements/schema-display.d.cts +61 -0
- package/dist/components/ai-elements/schema-display.d.ts +61 -0
- package/dist/components/ai-elements/schema-display.js +330 -0
- package/dist/components/ai-elements/shimmer.cjs +55 -0
- package/dist/components/ai-elements/shimmer.d.cts +14 -0
- package/dist/components/ai-elements/shimmer.d.ts +14 -0
- package/dist/components/ai-elements/shimmer.js +55 -0
- package/dist/components/ai-elements/snippet.cjs +105 -0
- package/dist/components/ai-elements/snippet.d.cts +25 -0
- package/dist/components/ai-elements/snippet.d.ts +25 -0
- package/dist/components/ai-elements/snippet.js +105 -0
- package/dist/components/ai-elements/sources.cjs +70 -0
- package/dist/components/ai-elements/sources.d.cts +17 -0
- package/dist/components/ai-elements/sources.d.ts +17 -0
- package/dist/components/ai-elements/sources.js +70 -0
- package/dist/components/ai-elements/speech-input.cjs +207 -0
- package/dist/components/ai-elements/speech-input.d.cts +59 -0
- package/dist/components/ai-elements/speech-input.d.ts +59 -0
- package/dist/components/ai-elements/speech-input.js +207 -0
- package/dist/components/ai-elements/stack-trace.cjs +403 -0
- package/dist/components/ai-elements/stack-trace.d.cts +45 -0
- package/dist/components/ai-elements/stack-trace.d.ts +45 -0
- package/dist/components/ai-elements/stack-trace.js +403 -0
- package/dist/components/ai-elements/suggestion.cjs +46 -0
- package/dist/components/ai-elements/suggestion.d.cts +17 -0
- package/dist/components/ai-elements/suggestion.d.ts +17 -0
- package/dist/components/ai-elements/suggestion.js +46 -0
- package/dist/components/ai-elements/task.cjs +62 -0
- package/dist/components/ai-elements/task.d.cts +19 -0
- package/dist/components/ai-elements/task.d.ts +19 -0
- package/dist/components/ai-elements/task.js +62 -0
- package/dist/components/ai-elements/terminal.cjs +220 -0
- package/dist/components/ai-elements/terminal.d.cts +33 -0
- package/dist/components/ai-elements/terminal.d.ts +33 -0
- package/dist/components/ai-elements/terminal.js +220 -0
- package/dist/components/ai-elements/test-results.cjs +376 -0
- package/dist/components/ai-elements/test-results.d.cts +62 -0
- package/dist/components/ai-elements/test-results.d.ts +62 -0
- package/dist/components/ai-elements/test-results.js +376 -0
- package/dist/components/ai-elements/tool.cjs +130 -0
- package/dist/components/ai-elements/tool.d.cts +36 -0
- package/dist/components/ai-elements/tool.d.ts +36 -0
- package/dist/components/ai-elements/tool.js +130 -0
- package/dist/components/ai-elements/toolbar.cjs +17 -0
- package/dist/components/ai-elements/toolbar.d.cts +8 -0
- package/dist/components/ai-elements/toolbar.d.ts +8 -0
- package/dist/components/ai-elements/toolbar.js +17 -0
- package/dist/components/ai-elements/transcription.cjs +92 -0
- package/dist/components/ai-elements/transcription.d.cts +19 -0
- package/dist/components/ai-elements/transcription.d.ts +19 -0
- package/dist/components/ai-elements/transcription.js +92 -0
- package/dist/components/ai-elements/voice-selector-accent.cjs +11 -0
- package/dist/components/ai-elements/voice-selector-accent.d.cts +10 -0
- package/dist/components/ai-elements/voice-selector-accent.d.ts +10 -0
- package/dist/components/ai-elements/voice-selector-accent.js +11 -0
- package/dist/components/ai-elements/voice-selector.cjs +246 -0
- package/dist/components/ai-elements/voice-selector.d.cts +66 -0
- package/dist/components/ai-elements/voice-selector.d.ts +66 -0
- package/dist/components/ai-elements/voice-selector.js +246 -0
- package/dist/components/ai-elements/web-preview.cjs +237 -0
- package/dist/components/ai-elements/web-preview.d.cts +40 -0
- package/dist/components/ai-elements/web-preview.d.ts +40 -0
- package/dist/components/ai-elements/web-preview.js +237 -0
- package/dist/components/model-selection/available-model-picker.cjs +172 -0
- package/dist/components/model-selection/available-model-picker.d.cts +18 -0
- package/dist/components/model-selection/available-model-picker.d.ts +18 -0
- package/dist/components/model-selection/available-model-picker.js +172 -0
- package/dist/components/model-selection/model-warning-list.cjs +24 -0
- package/dist/components/model-selection/model-warning-list.d.cts +10 -0
- package/dist/components/model-selection/model-warning-list.d.ts +10 -0
- package/dist/components/model-selection/model-warning-list.js +24 -0
- package/dist/components/model-selection/thinking-level-picker.cjs +39 -0
- package/dist/components/model-selection/thinking-level-picker.d.cts +14 -0
- package/dist/components/model-selection/thinking-level-picker.d.ts +14 -0
- package/dist/components/model-selection/thinking-level-picker.js +39 -0
- package/dist/components/ui/accordion.cjs +64 -0
- package/dist/components/ui/accordion.d.cts +10 -0
- package/dist/components/ui/accordion.d.ts +10 -0
- package/dist/components/ui/accordion.js +64 -0
- package/dist/components/ui/alert-dialog.cjs +178 -0
- package/dist/components/ui/alert-dialog.d.cts +23 -0
- package/dist/components/ui/alert-dialog.d.ts +23 -0
- package/dist/components/ui/alert-dialog.js +178 -0
- package/dist/components/ui/alert.cjs +66 -0
- package/dist/components/ui/alert.d.cts +13 -0
- package/dist/components/ui/alert.d.ts +13 -0
- package/dist/components/ui/alert.js +66 -0
- package/dist/components/ui/aspect-ratio.cjs +11 -0
- package/dist/components/ui/aspect-ratio.d.cts +6 -0
- package/dist/components/ui/aspect-ratio.d.ts +6 -0
- package/dist/components/ui/aspect-ratio.js +11 -0
- package/dist/components/ui/avatar.cjs +103 -0
- package/dist/components/ui/avatar.d.cts +14 -0
- package/dist/components/ui/avatar.d.ts +14 -0
- package/dist/components/ui/avatar.js +103 -0
- package/dist/components/ui/badge.cjs +43 -0
- package/dist/components/ui/badge.d.cts +13 -0
- package/dist/components/ui/badge.d.ts +13 -0
- package/dist/components/ui/badge.js +43 -0
- package/dist/components/ui/breadcrumb.cjs +103 -0
- package/dist/components/ui/breadcrumb.d.cts +14 -0
- package/dist/components/ui/breadcrumb.d.ts +14 -0
- package/dist/components/ui/breadcrumb.js +103 -0
- package/dist/components/ui/button-group.cjs +76 -0
- package/dist/components/ui/button-group.d.cts +17 -0
- package/dist/components/ui/button-group.d.ts +17 -0
- package/dist/components/ui/button-group.js +76 -0
- package/dist/components/ui/button.cjs +56 -0
- package/dist/components/ui/button.d.cts +14 -0
- package/dist/components/ui/button.d.ts +14 -0
- package/dist/components/ui/button.js +56 -0
- package/dist/components/ui/calendar.cjs +194 -0
- package/dist/components/ui/calendar.d.cts +13 -0
- package/dist/components/ui/calendar.d.ts +13 -0
- package/dist/components/ui/calendar.js +194 -0
- package/dist/components/ui/card.cjs +90 -0
- package/dist/components/ui/card.d.cts +12 -0
- package/dist/components/ui/card.d.ts +12 -0
- package/dist/components/ui/card.js +90 -0
- package/dist/components/ui/carousel.cjs +198 -0
- package/dist/components/ui/carousel.d.cts +24 -0
- package/dist/components/ui/carousel.d.ts +24 -0
- package/dist/components/ui/carousel.js +198 -0
- package/dist/components/ui/chart.cjs +242 -0
- package/dist/components/ui/chart.d.cts +43 -0
- package/dist/components/ui/chart.d.ts +43 -0
- package/dist/components/ui/chart.js +242 -0
- package/dist/components/ui/checkbox.cjs +32 -0
- package/dist/components/ui/checkbox.d.cts +7 -0
- package/dist/components/ui/checkbox.d.ts +7 -0
- package/dist/components/ui/checkbox.js +32 -0
- package/dist/components/ui/collapsible.cjs +34 -0
- package/dist/components/ui/collapsible.d.cts +8 -0
- package/dist/components/ui/collapsible.d.ts +8 -0
- package/dist/components/ui/collapsible.js +34 -0
- package/dist/components/ui/combobox.cjs +297 -0
- package/dist/components/ui/combobox.d.cts +27 -0
- package/dist/components/ui/combobox.d.ts +27 -0
- package/dist/components/ui/combobox.js +297 -0
- package/dist/components/ui/command.cjs +177 -0
- package/dist/components/ui/command.d.cts +22 -0
- package/dist/components/ui/command.d.ts +22 -0
- package/dist/components/ui/command.js +177 -0
- package/dist/components/ui/context-menu.cjs +224 -0
- package/dist/components/ui/context-menu.d.cts +28 -0
- package/dist/components/ui/context-menu.d.ts +28 -0
- package/dist/components/ui/context-menu.js +224 -0
- package/dist/components/ui/dialog.cjs +147 -0
- package/dist/components/ui/dialog.d.cts +20 -0
- package/dist/components/ui/dialog.d.ts +20 -0
- package/dist/components/ui/dialog.js +147 -0
- package/dist/components/ui/direction.cjs +15 -0
- package/dist/components/ui/direction.d.cts +10 -0
- package/dist/components/ui/direction.d.ts +10 -0
- package/dist/components/ui/direction.js +15 -0
- package/dist/components/ui/drawer.cjs +128 -0
- package/dist/components/ui/drawer.d.cts +16 -0
- package/dist/components/ui/drawer.d.ts +16 -0
- package/dist/components/ui/drawer.js +128 -0
- package/dist/components/ui/dropdown-menu.cjs +232 -0
- package/dist/components/ui/dropdown-menu.d.cts +28 -0
- package/dist/components/ui/dropdown-menu.d.ts +28 -0
- package/dist/components/ui/dropdown-menu.js +232 -0
- package/dist/components/ui/empty.cjs +102 -0
- package/dist/components/ui/empty.d.cts +15 -0
- package/dist/components/ui/empty.d.ts +15 -0
- package/dist/components/ui/empty.js +102 -0
- package/dist/components/ui/field.cjs +230 -0
- package/dist/components/ui/field.d.cts +30 -0
- package/dist/components/ui/field.d.ts +30 -0
- package/dist/components/ui/field.js +230 -0
- package/dist/components/ui/form.cjs +121 -0
- package/dist/components/ui/form.d.cts +27 -0
- package/dist/components/ui/form.d.ts +27 -0
- package/dist/components/ui/form.js +121 -0
- package/dist/components/ui/hover-card.cjs +38 -0
- package/dist/components/ui/hover-card.d.cts +9 -0
- package/dist/components/ui/hover-card.d.ts +9 -0
- package/dist/components/ui/hover-card.js +38 -0
- package/dist/components/ui/input-group.cjs +154 -0
- package/dist/components/ui/input-group.d.cts +20 -0
- package/dist/components/ui/input-group.d.ts +20 -0
- package/dist/components/ui/input-group.js +154 -0
- package/dist/components/ui/input-otp.cjs +67 -0
- package/dist/components/ui/input-otp.d.cts +14 -0
- package/dist/components/ui/input-otp.d.ts +14 -0
- package/dist/components/ui/input-otp.js +67 -0
- package/dist/components/ui/input.cjs +23 -0
- package/dist/components/ui/input.d.cts +6 -0
- package/dist/components/ui/input.d.ts +6 -0
- package/dist/components/ui/input.js +23 -0
- package/dist/components/ui/item.cjs +187 -0
- package/dist/components/ui/item.d.cts +28 -0
- package/dist/components/ui/item.d.ts +28 -0
- package/dist/components/ui/item.js +187 -0
- package/dist/components/ui/kbd.cjs +31 -0
- package/dist/components/ui/kbd.d.cts +6 -0
- package/dist/components/ui/kbd.d.ts +6 -0
- package/dist/components/ui/kbd.js +31 -0
- package/dist/components/ui/label.cjs +22 -0
- package/dist/components/ui/label.d.cts +7 -0
- package/dist/components/ui/label.d.ts +7 -0
- package/dist/components/ui/label.js +22 -0
- package/dist/components/ui/menubar.cjs +252 -0
- package/dist/components/ui/menubar.d.cts +29 -0
- package/dist/components/ui/menubar.d.ts +29 -0
- package/dist/components/ui/menubar.js +252 -0
- package/dist/components/ui/native-select.cjs +63 -0
- package/dist/components/ui/native-select.d.cts +10 -0
- package/dist/components/ui/native-select.d.ts +10 -0
- package/dist/components/ui/native-select.js +63 -0
- package/dist/components/ui/navigation-menu.cjs +170 -0
- package/dist/components/ui/navigation-menu.d.cts +18 -0
- package/dist/components/ui/navigation-menu.d.ts +18 -0
- package/dist/components/ui/navigation-menu.js +170 -0
- package/dist/components/ui/pagination.cjs +122 -0
- package/dist/components/ui/pagination.d.cts +18 -0
- package/dist/components/ui/pagination.d.ts +18 -0
- package/dist/components/ui/pagination.js +122 -0
- package/dist/components/ui/plugin-safety-disclaimer.cjs +26 -0
- package/dist/components/ui/plugin-safety-disclaimer.d.cts +8 -0
- package/dist/components/ui/plugin-safety-disclaimer.d.ts +8 -0
- package/dist/components/ui/plugin-safety-disclaimer.js +26 -0
- package/dist/components/ui/popover.cjs +80 -0
- package/dist/components/ui/popover.d.cts +13 -0
- package/dist/components/ui/popover.d.ts +13 -0
- package/dist/components/ui/popover.js +80 -0
- package/dist/components/ui/progress.cjs +32 -0
- package/dist/components/ui/progress.d.cts +7 -0
- package/dist/components/ui/progress.d.ts +7 -0
- package/dist/components/ui/progress.js +32 -0
- package/dist/components/ui/radio-group.cjs +45 -0
- package/dist/components/ui/radio-group.d.cts +8 -0
- package/dist/components/ui/radio-group.d.ts +8 -0
- package/dist/components/ui/radio-group.js +45 -0
- package/dist/components/ui/resizable.cjs +47 -0
- package/dist/components/ui/resizable.d.cts +10 -0
- package/dist/components/ui/resizable.d.ts +10 -0
- package/dist/components/ui/resizable.js +47 -0
- package/dist/components/ui/scroll-area.cjs +60 -0
- package/dist/components/ui/scroll-area.d.cts +8 -0
- package/dist/components/ui/scroll-area.d.ts +8 -0
- package/dist/components/ui/scroll-area.js +60 -0
- package/dist/components/ui/search-input.cjs +39 -0
- package/dist/components/ui/search-input.d.cts +12 -0
- package/dist/components/ui/search-input.d.ts +12 -0
- package/dist/components/ui/search-input.js +39 -0
- package/dist/components/ui/select.cjs +179 -0
- package/dist/components/ui/select.d.cts +18 -0
- package/dist/components/ui/select.d.ts +18 -0
- package/dist/components/ui/select.js +179 -0
- package/dist/components/ui/separator.cjs +27 -0
- package/dist/components/ui/separator.d.cts +7 -0
- package/dist/components/ui/separator.d.ts +7 -0
- package/dist/components/ui/separator.js +27 -0
- package/dist/components/ui/sheet.cjs +129 -0
- package/dist/components/ui/sheet.d.cts +18 -0
- package/dist/components/ui/sheet.d.ts +18 -0
- package/dist/components/ui/sheet.js +129 -0
- package/dist/components/ui/sidebar.cjs +649 -0
- package/dist/components/ui/sidebar.d.cts +74 -0
- package/dist/components/ui/sidebar.d.ts +74 -0
- package/dist/components/ui/sidebar.js +649 -0
- package/dist/components/ui/skeleton.cjs +15 -0
- package/dist/components/ui/skeleton.d.cts +5 -0
- package/dist/components/ui/skeleton.d.ts +5 -0
- package/dist/components/ui/skeleton.js +15 -0
- package/dist/components/ui/slider.cjs +68 -0
- package/dist/components/ui/slider.d.cts +7 -0
- package/dist/components/ui/slider.d.ts +7 -0
- package/dist/components/ui/slider.js +68 -0
- package/dist/components/ui/sonner.cjs +38 -0
- package/dist/components/ui/sonner.d.cts +6 -0
- package/dist/components/ui/sonner.d.ts +6 -0
- package/dist/components/ui/sonner.js +38 -0
- package/dist/components/ui/spinner.cjs +17 -0
- package/dist/components/ui/spinner.d.cts +5 -0
- package/dist/components/ui/spinner.d.ts +5 -0
- package/dist/components/ui/spinner.js +17 -0
- package/dist/components/ui/switch.cjs +33 -0
- package/dist/components/ui/switch.d.cts +9 -0
- package/dist/components/ui/switch.d.ts +9 -0
- package/dist/components/ui/switch.js +33 -0
- package/dist/components/ui/table.cjs +115 -0
- package/dist/components/ui/table.d.cts +13 -0
- package/dist/components/ui/table.d.ts +13 -0
- package/dist/components/ui/table.js +115 -0
- package/dist/components/ui/tabs.cjs +92 -0
- package/dist/components/ui/tabs.d.cts +15 -0
- package/dist/components/ui/tabs.d.ts +15 -0
- package/dist/components/ui/tabs.js +92 -0
- package/dist/components/ui/textarea.cjs +20 -0
- package/dist/components/ui/textarea.d.cts +6 -0
- package/dist/components/ui/textarea.d.ts +6 -0
- package/dist/components/ui/textarea.js +20 -0
- package/dist/components/ui/toggle-group.cjs +69 -0
- package/dist/components/ui/toggle-group.d.cts +13 -0
- package/dist/components/ui/toggle-group.d.ts +13 -0
- package/dist/components/ui/toggle-group.js +69 -0
- package/dist/components/ui/toggle.cjs +44 -0
- package/dist/components/ui/toggle.d.cts +13 -0
- package/dist/components/ui/toggle.d.ts +13 -0
- package/dist/components/ui/toggle.js +44 -0
- package/dist/components/ui/tooltip.cjs +56 -0
- package/dist/components/ui/tooltip.d.cts +10 -0
- package/dist/components/ui/tooltip.d.ts +10 -0
- package/dist/components/ui/tooltip.js +56 -0
- package/dist/components/ui/tree.cjs +131 -0
- package/dist/components/ui/tree.d.cts +35 -0
- package/dist/components/ui/tree.d.ts +35 -0
- package/dist/components/ui/tree.js +131 -0
- package/dist/hooks/use-mobile.cjs +16 -0
- package/dist/hooks/use-mobile.d.cts +3 -0
- package/dist/hooks/use-mobile.d.ts +3 -0
- package/dist/hooks/use-mobile.js +16 -0
- package/dist/index.cjs +121 -15527
- package/dist/index.d.cts +145 -2246
- package/dist/index.d.ts +145 -2246
- package/dist/index.js +118 -14982
- package/dist/lib/utils.cjs +8 -0
- package/dist/lib/utils.d.cts +5 -0
- package/dist/lib/utils.d.ts +5 -0
- package/dist/lib/utils.js +8 -0
- package/dist/styles/globals.css +438 -0
- package/dist/styles/plugin.css +4 -0
- package/dist/theme/apply-theme.cjs +221 -0
- package/dist/theme/apply-theme.d.cts +13 -0
- package/dist/theme/apply-theme.d.ts +13 -0
- package/dist/theme/apply-theme.js +221 -0
- package/dist/theme/index.cjs +2 -0
- package/dist/theme/index.d.cts +2 -0
- package/dist/theme/index.d.ts +2 -0
- package/dist/theme/index.js +2 -0
- package/dist/theme/types.cjs +90 -0
- package/dist/theme/types.d.cts +133 -0
- package/dist/theme/types.d.ts +133 -0
- package/dist/theme/types.js +90 -0
- package/package.json +22 -5
- package/tsup.config.ts +18 -0
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
|
|
2
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
3
|
+
var _button = require('../ui/button');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _hovercard = require('../ui/hover-card');
|
|
9
|
+
var _utils = require('../../lib/utils');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var _lucidereact = require('lucide-react');
|
|
19
|
+
var _react = require('react');
|
|
20
|
+
const mediaCategoryIcons = {
|
|
21
|
+
audio: _lucidereact.Music2Icon,
|
|
22
|
+
document: _lucidereact.FileTextIcon,
|
|
23
|
+
image: _lucidereact.ImageIcon,
|
|
24
|
+
source: _lucidereact.GlobeIcon,
|
|
25
|
+
unknown: _lucidereact.PaperclipIcon,
|
|
26
|
+
video: _lucidereact.VideoIcon
|
|
27
|
+
};
|
|
28
|
+
const getMediaCategory = (data) => {
|
|
29
|
+
if (data.type === "source-document") {
|
|
30
|
+
return "source";
|
|
31
|
+
}
|
|
32
|
+
const mediaType = _nullishCoalesce(data.mediaType, () => ( ""));
|
|
33
|
+
if (mediaType.startsWith("image/")) {
|
|
34
|
+
return "image";
|
|
35
|
+
}
|
|
36
|
+
if (mediaType.startsWith("video/")) {
|
|
37
|
+
return "video";
|
|
38
|
+
}
|
|
39
|
+
if (mediaType.startsWith("audio/")) {
|
|
40
|
+
return "audio";
|
|
41
|
+
}
|
|
42
|
+
if (mediaType.startsWith("application/") || mediaType.startsWith("text/")) {
|
|
43
|
+
return "document";
|
|
44
|
+
}
|
|
45
|
+
return "unknown";
|
|
46
|
+
};
|
|
47
|
+
const getAttachmentLabel = (data) => {
|
|
48
|
+
if (data.type === "source-document") {
|
|
49
|
+
return data.title || data.filename || "Source";
|
|
50
|
+
}
|
|
51
|
+
const category = getMediaCategory(data);
|
|
52
|
+
return data.filename || (category === "image" ? "Image" : "Attachment");
|
|
53
|
+
};
|
|
54
|
+
const renderAttachmentImage = (url, filename, isGrid) => isGrid ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
55
|
+
"img",
|
|
56
|
+
{
|
|
57
|
+
alt: filename || "Image",
|
|
58
|
+
className: "size-full object-cover",
|
|
59
|
+
height: 96,
|
|
60
|
+
src: url,
|
|
61
|
+
width: 96
|
|
62
|
+
}
|
|
63
|
+
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
64
|
+
"img",
|
|
65
|
+
{
|
|
66
|
+
alt: filename || "Image",
|
|
67
|
+
className: "size-full rounded object-cover",
|
|
68
|
+
height: 20,
|
|
69
|
+
src: url,
|
|
70
|
+
width: 20
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
const AttachmentsContext = _react.createContext.call(void 0, null);
|
|
74
|
+
const AttachmentContext = _react.createContext.call(void 0, null);
|
|
75
|
+
const useAttachmentsContext = () => _nullishCoalesce(_react.use.call(void 0, AttachmentsContext), () => ( { variant: "grid" }));
|
|
76
|
+
const useAttachmentContext = () => {
|
|
77
|
+
const ctx = _react.use.call(void 0, AttachmentContext);
|
|
78
|
+
if (!ctx) {
|
|
79
|
+
throw new Error("Attachment components must be used within <Attachment>");
|
|
80
|
+
}
|
|
81
|
+
return ctx;
|
|
82
|
+
};
|
|
83
|
+
const Attachments = ({
|
|
84
|
+
variant = "grid",
|
|
85
|
+
className,
|
|
86
|
+
children,
|
|
87
|
+
...props
|
|
88
|
+
}) => {
|
|
89
|
+
const contextValue = _react.useMemo.call(void 0, () => ({ variant }), [variant]);
|
|
90
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AttachmentsContext.Provider, { value: contextValue, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
91
|
+
"div",
|
|
92
|
+
{
|
|
93
|
+
className: _utils.cn.call(void 0,
|
|
94
|
+
"flex items-start",
|
|
95
|
+
variant === "list" ? "flex-col gap-2" : "flex-wrap gap-2",
|
|
96
|
+
variant === "grid" && "ml-auto w-fit",
|
|
97
|
+
className
|
|
98
|
+
),
|
|
99
|
+
...props,
|
|
100
|
+
children
|
|
101
|
+
}
|
|
102
|
+
) });
|
|
103
|
+
};
|
|
104
|
+
const Attachment = ({
|
|
105
|
+
data,
|
|
106
|
+
onRemove,
|
|
107
|
+
className,
|
|
108
|
+
children,
|
|
109
|
+
...props
|
|
110
|
+
}) => {
|
|
111
|
+
const { variant } = useAttachmentsContext();
|
|
112
|
+
const mediaCategory = getMediaCategory(data);
|
|
113
|
+
const contextValue = _react.useMemo.call(void 0,
|
|
114
|
+
() => ({ data, mediaCategory, onRemove, variant }),
|
|
115
|
+
[data, mediaCategory, onRemove, variant]
|
|
116
|
+
);
|
|
117
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AttachmentContext.Provider, { value: contextValue, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
118
|
+
"div",
|
|
119
|
+
{
|
|
120
|
+
className: _utils.cn.call(void 0,
|
|
121
|
+
"group relative",
|
|
122
|
+
variant === "grid" && "size-24 overflow-hidden rounded-lg",
|
|
123
|
+
variant === "inline" && [
|
|
124
|
+
"flex h-8 cursor-pointer select-none items-center gap-1.5",
|
|
125
|
+
"rounded-md border border-border px-1.5",
|
|
126
|
+
"font-medium text-sm transition-all",
|
|
127
|
+
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50"
|
|
128
|
+
],
|
|
129
|
+
variant === "list" && [
|
|
130
|
+
"flex w-full items-center gap-3 rounded-lg border p-3",
|
|
131
|
+
"hover:bg-accent/50"
|
|
132
|
+
],
|
|
133
|
+
className
|
|
134
|
+
),
|
|
135
|
+
...props,
|
|
136
|
+
children
|
|
137
|
+
}
|
|
138
|
+
) });
|
|
139
|
+
};
|
|
140
|
+
const AttachmentPreview = ({
|
|
141
|
+
fallbackIcon,
|
|
142
|
+
className,
|
|
143
|
+
...props
|
|
144
|
+
}) => {
|
|
145
|
+
const { data, mediaCategory, variant } = useAttachmentContext();
|
|
146
|
+
const iconSize = variant === "inline" ? "size-3" : "size-4";
|
|
147
|
+
const renderIcon = (Icon) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Icon, { className: _utils.cn.call(void 0, iconSize, "text-muted-foreground") });
|
|
148
|
+
const renderContent = () => {
|
|
149
|
+
if (mediaCategory === "image" && data.type === "file" && data.url) {
|
|
150
|
+
return renderAttachmentImage(data.url, data.filename, variant === "grid");
|
|
151
|
+
}
|
|
152
|
+
if (mediaCategory === "video" && data.type === "file" && data.url) {
|
|
153
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "video", { "aria-label": "Video preview", className: "size-full object-cover", muted: true, src: data.url });
|
|
154
|
+
}
|
|
155
|
+
const Icon = mediaCategoryIcons[mediaCategory];
|
|
156
|
+
return _nullishCoalesce(fallbackIcon, () => ( renderIcon(Icon)));
|
|
157
|
+
};
|
|
158
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
159
|
+
"div",
|
|
160
|
+
{
|
|
161
|
+
className: _utils.cn.call(void 0,
|
|
162
|
+
"flex shrink-0 items-center justify-center overflow-hidden",
|
|
163
|
+
variant === "grid" && "size-full bg-muted",
|
|
164
|
+
variant === "inline" && "size-5 rounded bg-background",
|
|
165
|
+
variant === "list" && "size-12 rounded bg-muted",
|
|
166
|
+
className
|
|
167
|
+
),
|
|
168
|
+
...props,
|
|
169
|
+
children: renderContent()
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
};
|
|
173
|
+
const AttachmentInfo = ({
|
|
174
|
+
showMediaType = false,
|
|
175
|
+
className,
|
|
176
|
+
...props
|
|
177
|
+
}) => {
|
|
178
|
+
const { data, variant } = useAttachmentContext();
|
|
179
|
+
const label = getAttachmentLabel(data);
|
|
180
|
+
if (variant === "grid") {
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _utils.cn.call(void 0, "min-w-0 flex-1", className), ...props, children: [
|
|
184
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "block truncate", children: label }),
|
|
185
|
+
showMediaType && data.mediaType && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "block truncate text-muted-foreground text-xs", children: data.mediaType })
|
|
186
|
+
] });
|
|
187
|
+
};
|
|
188
|
+
const AttachmentRemove = ({
|
|
189
|
+
label = "Remove",
|
|
190
|
+
className,
|
|
191
|
+
children,
|
|
192
|
+
...props
|
|
193
|
+
}) => {
|
|
194
|
+
const { onRemove, variant } = useAttachmentContext();
|
|
195
|
+
const handleClick = _react.useCallback.call(void 0,
|
|
196
|
+
(e) => {
|
|
197
|
+
e.stopPropagation();
|
|
198
|
+
_optionalChain([onRemove, 'optionalCall', _ => _()]);
|
|
199
|
+
},
|
|
200
|
+
[onRemove]
|
|
201
|
+
);
|
|
202
|
+
if (!onRemove) {
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
206
|
+
_button.Button,
|
|
207
|
+
{
|
|
208
|
+
"aria-label": label,
|
|
209
|
+
className: _utils.cn.call(void 0,
|
|
210
|
+
variant === "grid" && [
|
|
211
|
+
"absolute top-2 right-2 size-6 rounded-full p-0",
|
|
212
|
+
"bg-background/80 backdrop-blur-sm",
|
|
213
|
+
"opacity-0 transition-opacity group-hover:opacity-100",
|
|
214
|
+
"hover:bg-background",
|
|
215
|
+
"[&>svg]:size-3"
|
|
216
|
+
],
|
|
217
|
+
variant === "inline" && [
|
|
218
|
+
"size-5 rounded p-0",
|
|
219
|
+
"opacity-0 transition-opacity group-hover:opacity-100",
|
|
220
|
+
"[&>svg]:size-2.5"
|
|
221
|
+
],
|
|
222
|
+
variant === "list" && ["size-8 shrink-0 rounded p-0", "[&>svg]:size-4"],
|
|
223
|
+
className
|
|
224
|
+
),
|
|
225
|
+
onClick: handleClick,
|
|
226
|
+
type: "button",
|
|
227
|
+
variant: "ghost",
|
|
228
|
+
...props,
|
|
229
|
+
children: [
|
|
230
|
+
_nullishCoalesce(children, () => ( /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.XIcon, {}))),
|
|
231
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", children: label })
|
|
232
|
+
]
|
|
233
|
+
}
|
|
234
|
+
);
|
|
235
|
+
};
|
|
236
|
+
const AttachmentHoverCard = ({
|
|
237
|
+
openDelay = 0,
|
|
238
|
+
closeDelay = 0,
|
|
239
|
+
...props
|
|
240
|
+
}) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _hovercard.HoverCard, { closeDelay, openDelay, ...props });
|
|
241
|
+
const AttachmentHoverCardTrigger = (props) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _hovercard.HoverCardTrigger, { ...props });
|
|
242
|
+
const AttachmentHoverCardContent = ({
|
|
243
|
+
align = "start",
|
|
244
|
+
className,
|
|
245
|
+
...props
|
|
246
|
+
}) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
247
|
+
_hovercard.HoverCardContent,
|
|
248
|
+
{
|
|
249
|
+
align,
|
|
250
|
+
className: _utils.cn.call(void 0, "w-auto p-2", className),
|
|
251
|
+
...props
|
|
252
|
+
}
|
|
253
|
+
);
|
|
254
|
+
const AttachmentEmpty = ({
|
|
255
|
+
className,
|
|
256
|
+
children,
|
|
257
|
+
...props
|
|
258
|
+
}) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
259
|
+
"div",
|
|
260
|
+
{
|
|
261
|
+
className: _utils.cn.call(void 0,
|
|
262
|
+
"flex items-center justify-center p-4 text-muted-foreground text-sm",
|
|
263
|
+
className
|
|
264
|
+
),
|
|
265
|
+
...props,
|
|
266
|
+
children: _nullishCoalesce(children, () => ( "No attachments"))
|
|
267
|
+
}
|
|
268
|
+
);
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
exports.Attachment = Attachment; exports.AttachmentEmpty = AttachmentEmpty; exports.AttachmentHoverCard = AttachmentHoverCard; exports.AttachmentHoverCardContent = AttachmentHoverCardContent; exports.AttachmentHoverCardTrigger = AttachmentHoverCardTrigger; exports.AttachmentInfo = AttachmentInfo; exports.AttachmentPreview = AttachmentPreview; exports.AttachmentRemove = AttachmentRemove; exports.Attachments = Attachments; exports.getAttachmentLabel = getAttachmentLabel; exports.getMediaCategory = getMediaCategory; exports.useAttachmentContext = useAttachmentContext; exports.useAttachmentsContext = useAttachmentsContext;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { FileUIPart, SourceDocumentUIPart } from 'ai';
|
|
3
|
+
import { HTMLAttributes, ComponentProps, ReactNode } from 'react';
|
|
4
|
+
import { Button } from '../ui/button.cjs';
|
|
5
|
+
import { HoverCard, HoverCardContent, HoverCardTrigger } from '../ui/hover-card.cjs';
|
|
6
|
+
import 'class-variance-authority/types';
|
|
7
|
+
import 'class-variance-authority';
|
|
8
|
+
import 'radix-ui';
|
|
9
|
+
|
|
10
|
+
type AttachmentData = (FileUIPart & {
|
|
11
|
+
id: string;
|
|
12
|
+
}) | (SourceDocumentUIPart & {
|
|
13
|
+
id: string;
|
|
14
|
+
});
|
|
15
|
+
type AttachmentMediaCategory = "image" | "video" | "audio" | "document" | "source" | "unknown";
|
|
16
|
+
type AttachmentVariant = "grid" | "inline" | "list";
|
|
17
|
+
declare const getMediaCategory: (data: AttachmentData) => AttachmentMediaCategory;
|
|
18
|
+
declare const getAttachmentLabel: (data: AttachmentData) => string;
|
|
19
|
+
interface AttachmentsContextValue {
|
|
20
|
+
variant: AttachmentVariant;
|
|
21
|
+
}
|
|
22
|
+
interface AttachmentContextValue {
|
|
23
|
+
data: AttachmentData;
|
|
24
|
+
mediaCategory: AttachmentMediaCategory;
|
|
25
|
+
onRemove?: () => void;
|
|
26
|
+
variant: AttachmentVariant;
|
|
27
|
+
}
|
|
28
|
+
declare const useAttachmentsContext: () => AttachmentsContextValue;
|
|
29
|
+
declare const useAttachmentContext: () => AttachmentContextValue;
|
|
30
|
+
type AttachmentsProps = HTMLAttributes<HTMLDivElement> & {
|
|
31
|
+
variant?: AttachmentVariant;
|
|
32
|
+
};
|
|
33
|
+
declare const Attachments: ({ variant, className, children, ...props }: AttachmentsProps) => react_jsx_runtime.JSX.Element;
|
|
34
|
+
type AttachmentProps = HTMLAttributes<HTMLDivElement> & {
|
|
35
|
+
data: AttachmentData;
|
|
36
|
+
onRemove?: () => void;
|
|
37
|
+
};
|
|
38
|
+
declare const Attachment: ({ data, onRemove, className, children, ...props }: AttachmentProps) => react_jsx_runtime.JSX.Element;
|
|
39
|
+
type AttachmentPreviewProps = HTMLAttributes<HTMLDivElement> & {
|
|
40
|
+
fallbackIcon?: ReactNode;
|
|
41
|
+
};
|
|
42
|
+
declare const AttachmentPreview: ({ fallbackIcon, className, ...props }: AttachmentPreviewProps) => react_jsx_runtime.JSX.Element;
|
|
43
|
+
type AttachmentInfoProps = HTMLAttributes<HTMLDivElement> & {
|
|
44
|
+
showMediaType?: boolean;
|
|
45
|
+
};
|
|
46
|
+
declare const AttachmentInfo: ({ showMediaType, className, ...props }: AttachmentInfoProps) => react_jsx_runtime.JSX.Element | null;
|
|
47
|
+
type AttachmentRemoveProps = ComponentProps<typeof Button> & {
|
|
48
|
+
label?: string;
|
|
49
|
+
};
|
|
50
|
+
declare const AttachmentRemove: ({ label, className, children, ...props }: AttachmentRemoveProps) => react_jsx_runtime.JSX.Element | null;
|
|
51
|
+
type AttachmentHoverCardProps = ComponentProps<typeof HoverCard>;
|
|
52
|
+
declare const AttachmentHoverCard: ({ openDelay, closeDelay, ...props }: AttachmentHoverCardProps) => react_jsx_runtime.JSX.Element;
|
|
53
|
+
type AttachmentHoverCardTriggerProps = ComponentProps<typeof HoverCardTrigger>;
|
|
54
|
+
declare const AttachmentHoverCardTrigger: (props: AttachmentHoverCardTriggerProps) => react_jsx_runtime.JSX.Element;
|
|
55
|
+
type AttachmentHoverCardContentProps = ComponentProps<typeof HoverCardContent>;
|
|
56
|
+
declare const AttachmentHoverCardContent: ({ align, className, ...props }: AttachmentHoverCardContentProps) => react_jsx_runtime.JSX.Element;
|
|
57
|
+
type AttachmentEmptyProps = HTMLAttributes<HTMLDivElement>;
|
|
58
|
+
declare const AttachmentEmpty: ({ className, children, ...props }: AttachmentEmptyProps) => react_jsx_runtime.JSX.Element;
|
|
59
|
+
|
|
60
|
+
export { Attachment, type AttachmentData, AttachmentEmpty, type AttachmentEmptyProps, AttachmentHoverCard, AttachmentHoverCardContent, type AttachmentHoverCardContentProps, type AttachmentHoverCardProps, AttachmentHoverCardTrigger, type AttachmentHoverCardTriggerProps, AttachmentInfo, type AttachmentInfoProps, type AttachmentMediaCategory, AttachmentPreview, type AttachmentPreviewProps, type AttachmentProps, AttachmentRemove, type AttachmentRemoveProps, type AttachmentVariant, Attachments, type AttachmentsProps, getAttachmentLabel, getMediaCategory, useAttachmentContext, useAttachmentsContext };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { FileUIPart, SourceDocumentUIPart } from 'ai';
|
|
3
|
+
import { HTMLAttributes, ComponentProps, ReactNode } from 'react';
|
|
4
|
+
import { Button } from '../ui/button.js';
|
|
5
|
+
import { HoverCard, HoverCardContent, HoverCardTrigger } from '../ui/hover-card.js';
|
|
6
|
+
import 'class-variance-authority/types';
|
|
7
|
+
import 'class-variance-authority';
|
|
8
|
+
import 'radix-ui';
|
|
9
|
+
|
|
10
|
+
type AttachmentData = (FileUIPart & {
|
|
11
|
+
id: string;
|
|
12
|
+
}) | (SourceDocumentUIPart & {
|
|
13
|
+
id: string;
|
|
14
|
+
});
|
|
15
|
+
type AttachmentMediaCategory = "image" | "video" | "audio" | "document" | "source" | "unknown";
|
|
16
|
+
type AttachmentVariant = "grid" | "inline" | "list";
|
|
17
|
+
declare const getMediaCategory: (data: AttachmentData) => AttachmentMediaCategory;
|
|
18
|
+
declare const getAttachmentLabel: (data: AttachmentData) => string;
|
|
19
|
+
interface AttachmentsContextValue {
|
|
20
|
+
variant: AttachmentVariant;
|
|
21
|
+
}
|
|
22
|
+
interface AttachmentContextValue {
|
|
23
|
+
data: AttachmentData;
|
|
24
|
+
mediaCategory: AttachmentMediaCategory;
|
|
25
|
+
onRemove?: () => void;
|
|
26
|
+
variant: AttachmentVariant;
|
|
27
|
+
}
|
|
28
|
+
declare const useAttachmentsContext: () => AttachmentsContextValue;
|
|
29
|
+
declare const useAttachmentContext: () => AttachmentContextValue;
|
|
30
|
+
type AttachmentsProps = HTMLAttributes<HTMLDivElement> & {
|
|
31
|
+
variant?: AttachmentVariant;
|
|
32
|
+
};
|
|
33
|
+
declare const Attachments: ({ variant, className, children, ...props }: AttachmentsProps) => react_jsx_runtime.JSX.Element;
|
|
34
|
+
type AttachmentProps = HTMLAttributes<HTMLDivElement> & {
|
|
35
|
+
data: AttachmentData;
|
|
36
|
+
onRemove?: () => void;
|
|
37
|
+
};
|
|
38
|
+
declare const Attachment: ({ data, onRemove, className, children, ...props }: AttachmentProps) => react_jsx_runtime.JSX.Element;
|
|
39
|
+
type AttachmentPreviewProps = HTMLAttributes<HTMLDivElement> & {
|
|
40
|
+
fallbackIcon?: ReactNode;
|
|
41
|
+
};
|
|
42
|
+
declare const AttachmentPreview: ({ fallbackIcon, className, ...props }: AttachmentPreviewProps) => react_jsx_runtime.JSX.Element;
|
|
43
|
+
type AttachmentInfoProps = HTMLAttributes<HTMLDivElement> & {
|
|
44
|
+
showMediaType?: boolean;
|
|
45
|
+
};
|
|
46
|
+
declare const AttachmentInfo: ({ showMediaType, className, ...props }: AttachmentInfoProps) => react_jsx_runtime.JSX.Element | null;
|
|
47
|
+
type AttachmentRemoveProps = ComponentProps<typeof Button> & {
|
|
48
|
+
label?: string;
|
|
49
|
+
};
|
|
50
|
+
declare const AttachmentRemove: ({ label, className, children, ...props }: AttachmentRemoveProps) => react_jsx_runtime.JSX.Element | null;
|
|
51
|
+
type AttachmentHoverCardProps = ComponentProps<typeof HoverCard>;
|
|
52
|
+
declare const AttachmentHoverCard: ({ openDelay, closeDelay, ...props }: AttachmentHoverCardProps) => react_jsx_runtime.JSX.Element;
|
|
53
|
+
type AttachmentHoverCardTriggerProps = ComponentProps<typeof HoverCardTrigger>;
|
|
54
|
+
declare const AttachmentHoverCardTrigger: (props: AttachmentHoverCardTriggerProps) => react_jsx_runtime.JSX.Element;
|
|
55
|
+
type AttachmentHoverCardContentProps = ComponentProps<typeof HoverCardContent>;
|
|
56
|
+
declare const AttachmentHoverCardContent: ({ align, className, ...props }: AttachmentHoverCardContentProps) => react_jsx_runtime.JSX.Element;
|
|
57
|
+
type AttachmentEmptyProps = HTMLAttributes<HTMLDivElement>;
|
|
58
|
+
declare const AttachmentEmpty: ({ className, children, ...props }: AttachmentEmptyProps) => react_jsx_runtime.JSX.Element;
|
|
59
|
+
|
|
60
|
+
export { Attachment, type AttachmentData, AttachmentEmpty, type AttachmentEmptyProps, AttachmentHoverCard, AttachmentHoverCardContent, type AttachmentHoverCardContentProps, type AttachmentHoverCardProps, AttachmentHoverCardTrigger, type AttachmentHoverCardTriggerProps, AttachmentInfo, type AttachmentInfoProps, type AttachmentMediaCategory, AttachmentPreview, type AttachmentPreviewProps, type AttachmentProps, AttachmentRemove, type AttachmentRemoveProps, type AttachmentVariant, Attachments, type AttachmentsProps, getAttachmentLabel, getMediaCategory, useAttachmentContext, useAttachmentsContext };
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Button } from "../ui/button";
|
|
4
|
+
import {
|
|
5
|
+
HoverCard,
|
|
6
|
+
HoverCardContent,
|
|
7
|
+
HoverCardTrigger
|
|
8
|
+
} from "../ui/hover-card";
|
|
9
|
+
import { cn } from "../../lib/utils";
|
|
10
|
+
import {
|
|
11
|
+
FileTextIcon,
|
|
12
|
+
GlobeIcon,
|
|
13
|
+
ImageIcon,
|
|
14
|
+
Music2Icon,
|
|
15
|
+
PaperclipIcon,
|
|
16
|
+
VideoIcon,
|
|
17
|
+
XIcon
|
|
18
|
+
} from "lucide-react";
|
|
19
|
+
import { createContext, useCallback, use, useMemo } from "react";
|
|
20
|
+
const mediaCategoryIcons = {
|
|
21
|
+
audio: Music2Icon,
|
|
22
|
+
document: FileTextIcon,
|
|
23
|
+
image: ImageIcon,
|
|
24
|
+
source: GlobeIcon,
|
|
25
|
+
unknown: PaperclipIcon,
|
|
26
|
+
video: VideoIcon
|
|
27
|
+
};
|
|
28
|
+
const getMediaCategory = (data) => {
|
|
29
|
+
if (data.type === "source-document") {
|
|
30
|
+
return "source";
|
|
31
|
+
}
|
|
32
|
+
const mediaType = data.mediaType ?? "";
|
|
33
|
+
if (mediaType.startsWith("image/")) {
|
|
34
|
+
return "image";
|
|
35
|
+
}
|
|
36
|
+
if (mediaType.startsWith("video/")) {
|
|
37
|
+
return "video";
|
|
38
|
+
}
|
|
39
|
+
if (mediaType.startsWith("audio/")) {
|
|
40
|
+
return "audio";
|
|
41
|
+
}
|
|
42
|
+
if (mediaType.startsWith("application/") || mediaType.startsWith("text/")) {
|
|
43
|
+
return "document";
|
|
44
|
+
}
|
|
45
|
+
return "unknown";
|
|
46
|
+
};
|
|
47
|
+
const getAttachmentLabel = (data) => {
|
|
48
|
+
if (data.type === "source-document") {
|
|
49
|
+
return data.title || data.filename || "Source";
|
|
50
|
+
}
|
|
51
|
+
const category = getMediaCategory(data);
|
|
52
|
+
return data.filename || (category === "image" ? "Image" : "Attachment");
|
|
53
|
+
};
|
|
54
|
+
const renderAttachmentImage = (url, filename, isGrid) => isGrid ? /* @__PURE__ */ jsx(
|
|
55
|
+
"img",
|
|
56
|
+
{
|
|
57
|
+
alt: filename || "Image",
|
|
58
|
+
className: "size-full object-cover",
|
|
59
|
+
height: 96,
|
|
60
|
+
src: url,
|
|
61
|
+
width: 96
|
|
62
|
+
}
|
|
63
|
+
) : /* @__PURE__ */ jsx(
|
|
64
|
+
"img",
|
|
65
|
+
{
|
|
66
|
+
alt: filename || "Image",
|
|
67
|
+
className: "size-full rounded object-cover",
|
|
68
|
+
height: 20,
|
|
69
|
+
src: url,
|
|
70
|
+
width: 20
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
const AttachmentsContext = createContext(null);
|
|
74
|
+
const AttachmentContext = createContext(null);
|
|
75
|
+
const useAttachmentsContext = () => use(AttachmentsContext) ?? { variant: "grid" };
|
|
76
|
+
const useAttachmentContext = () => {
|
|
77
|
+
const ctx = use(AttachmentContext);
|
|
78
|
+
if (!ctx) {
|
|
79
|
+
throw new Error("Attachment components must be used within <Attachment>");
|
|
80
|
+
}
|
|
81
|
+
return ctx;
|
|
82
|
+
};
|
|
83
|
+
const Attachments = ({
|
|
84
|
+
variant = "grid",
|
|
85
|
+
className,
|
|
86
|
+
children,
|
|
87
|
+
...props
|
|
88
|
+
}) => {
|
|
89
|
+
const contextValue = useMemo(() => ({ variant }), [variant]);
|
|
90
|
+
return /* @__PURE__ */ jsx(AttachmentsContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(
|
|
91
|
+
"div",
|
|
92
|
+
{
|
|
93
|
+
className: cn(
|
|
94
|
+
"flex items-start",
|
|
95
|
+
variant === "list" ? "flex-col gap-2" : "flex-wrap gap-2",
|
|
96
|
+
variant === "grid" && "ml-auto w-fit",
|
|
97
|
+
className
|
|
98
|
+
),
|
|
99
|
+
...props,
|
|
100
|
+
children
|
|
101
|
+
}
|
|
102
|
+
) });
|
|
103
|
+
};
|
|
104
|
+
const Attachment = ({
|
|
105
|
+
data,
|
|
106
|
+
onRemove,
|
|
107
|
+
className,
|
|
108
|
+
children,
|
|
109
|
+
...props
|
|
110
|
+
}) => {
|
|
111
|
+
const { variant } = useAttachmentsContext();
|
|
112
|
+
const mediaCategory = getMediaCategory(data);
|
|
113
|
+
const contextValue = useMemo(
|
|
114
|
+
() => ({ data, mediaCategory, onRemove, variant }),
|
|
115
|
+
[data, mediaCategory, onRemove, variant]
|
|
116
|
+
);
|
|
117
|
+
return /* @__PURE__ */ jsx(AttachmentContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(
|
|
118
|
+
"div",
|
|
119
|
+
{
|
|
120
|
+
className: cn(
|
|
121
|
+
"group relative",
|
|
122
|
+
variant === "grid" && "size-24 overflow-hidden rounded-lg",
|
|
123
|
+
variant === "inline" && [
|
|
124
|
+
"flex h-8 cursor-pointer select-none items-center gap-1.5",
|
|
125
|
+
"rounded-md border border-border px-1.5",
|
|
126
|
+
"font-medium text-sm transition-all",
|
|
127
|
+
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50"
|
|
128
|
+
],
|
|
129
|
+
variant === "list" && [
|
|
130
|
+
"flex w-full items-center gap-3 rounded-lg border p-3",
|
|
131
|
+
"hover:bg-accent/50"
|
|
132
|
+
],
|
|
133
|
+
className
|
|
134
|
+
),
|
|
135
|
+
...props,
|
|
136
|
+
children
|
|
137
|
+
}
|
|
138
|
+
) });
|
|
139
|
+
};
|
|
140
|
+
const AttachmentPreview = ({
|
|
141
|
+
fallbackIcon,
|
|
142
|
+
className,
|
|
143
|
+
...props
|
|
144
|
+
}) => {
|
|
145
|
+
const { data, mediaCategory, variant } = useAttachmentContext();
|
|
146
|
+
const iconSize = variant === "inline" ? "size-3" : "size-4";
|
|
147
|
+
const renderIcon = (Icon) => /* @__PURE__ */ jsx(Icon, { className: cn(iconSize, "text-muted-foreground") });
|
|
148
|
+
const renderContent = () => {
|
|
149
|
+
if (mediaCategory === "image" && data.type === "file" && data.url) {
|
|
150
|
+
return renderAttachmentImage(data.url, data.filename, variant === "grid");
|
|
151
|
+
}
|
|
152
|
+
if (mediaCategory === "video" && data.type === "file" && data.url) {
|
|
153
|
+
return /* @__PURE__ */ jsx("video", { "aria-label": "Video preview", className: "size-full object-cover", muted: true, src: data.url });
|
|
154
|
+
}
|
|
155
|
+
const Icon = mediaCategoryIcons[mediaCategory];
|
|
156
|
+
return fallbackIcon ?? renderIcon(Icon);
|
|
157
|
+
};
|
|
158
|
+
return /* @__PURE__ */ jsx(
|
|
159
|
+
"div",
|
|
160
|
+
{
|
|
161
|
+
className: cn(
|
|
162
|
+
"flex shrink-0 items-center justify-center overflow-hidden",
|
|
163
|
+
variant === "grid" && "size-full bg-muted",
|
|
164
|
+
variant === "inline" && "size-5 rounded bg-background",
|
|
165
|
+
variant === "list" && "size-12 rounded bg-muted",
|
|
166
|
+
className
|
|
167
|
+
),
|
|
168
|
+
...props,
|
|
169
|
+
children: renderContent()
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
};
|
|
173
|
+
const AttachmentInfo = ({
|
|
174
|
+
showMediaType = false,
|
|
175
|
+
className,
|
|
176
|
+
...props
|
|
177
|
+
}) => {
|
|
178
|
+
const { data, variant } = useAttachmentContext();
|
|
179
|
+
const label = getAttachmentLabel(data);
|
|
180
|
+
if (variant === "grid") {
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("min-w-0 flex-1", className), ...props, children: [
|
|
184
|
+
/* @__PURE__ */ jsx("span", { className: "block truncate", children: label }),
|
|
185
|
+
showMediaType && data.mediaType && /* @__PURE__ */ jsx("span", { className: "block truncate text-muted-foreground text-xs", children: data.mediaType })
|
|
186
|
+
] });
|
|
187
|
+
};
|
|
188
|
+
const AttachmentRemove = ({
|
|
189
|
+
label = "Remove",
|
|
190
|
+
className,
|
|
191
|
+
children,
|
|
192
|
+
...props
|
|
193
|
+
}) => {
|
|
194
|
+
const { onRemove, variant } = useAttachmentContext();
|
|
195
|
+
const handleClick = useCallback(
|
|
196
|
+
(e) => {
|
|
197
|
+
e.stopPropagation();
|
|
198
|
+
onRemove?.();
|
|
199
|
+
},
|
|
200
|
+
[onRemove]
|
|
201
|
+
);
|
|
202
|
+
if (!onRemove) {
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
return /* @__PURE__ */ jsxs(
|
|
206
|
+
Button,
|
|
207
|
+
{
|
|
208
|
+
"aria-label": label,
|
|
209
|
+
className: cn(
|
|
210
|
+
variant === "grid" && [
|
|
211
|
+
"absolute top-2 right-2 size-6 rounded-full p-0",
|
|
212
|
+
"bg-background/80 backdrop-blur-sm",
|
|
213
|
+
"opacity-0 transition-opacity group-hover:opacity-100",
|
|
214
|
+
"hover:bg-background",
|
|
215
|
+
"[&>svg]:size-3"
|
|
216
|
+
],
|
|
217
|
+
variant === "inline" && [
|
|
218
|
+
"size-5 rounded p-0",
|
|
219
|
+
"opacity-0 transition-opacity group-hover:opacity-100",
|
|
220
|
+
"[&>svg]:size-2.5"
|
|
221
|
+
],
|
|
222
|
+
variant === "list" && ["size-8 shrink-0 rounded p-0", "[&>svg]:size-4"],
|
|
223
|
+
className
|
|
224
|
+
),
|
|
225
|
+
onClick: handleClick,
|
|
226
|
+
type: "button",
|
|
227
|
+
variant: "ghost",
|
|
228
|
+
...props,
|
|
229
|
+
children: [
|
|
230
|
+
children ?? /* @__PURE__ */ jsx(XIcon, {}),
|
|
231
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: label })
|
|
232
|
+
]
|
|
233
|
+
}
|
|
234
|
+
);
|
|
235
|
+
};
|
|
236
|
+
const AttachmentHoverCard = ({
|
|
237
|
+
openDelay = 0,
|
|
238
|
+
closeDelay = 0,
|
|
239
|
+
...props
|
|
240
|
+
}) => /* @__PURE__ */ jsx(HoverCard, { closeDelay, openDelay, ...props });
|
|
241
|
+
const AttachmentHoverCardTrigger = (props) => /* @__PURE__ */ jsx(HoverCardTrigger, { ...props });
|
|
242
|
+
const AttachmentHoverCardContent = ({
|
|
243
|
+
align = "start",
|
|
244
|
+
className,
|
|
245
|
+
...props
|
|
246
|
+
}) => /* @__PURE__ */ jsx(
|
|
247
|
+
HoverCardContent,
|
|
248
|
+
{
|
|
249
|
+
align,
|
|
250
|
+
className: cn("w-auto p-2", className),
|
|
251
|
+
...props
|
|
252
|
+
}
|
|
253
|
+
);
|
|
254
|
+
const AttachmentEmpty = ({
|
|
255
|
+
className,
|
|
256
|
+
children,
|
|
257
|
+
...props
|
|
258
|
+
}) => /* @__PURE__ */ jsx(
|
|
259
|
+
"div",
|
|
260
|
+
{
|
|
261
|
+
className: cn(
|
|
262
|
+
"flex items-center justify-center p-4 text-muted-foreground text-sm",
|
|
263
|
+
className
|
|
264
|
+
),
|
|
265
|
+
...props,
|
|
266
|
+
children: children ?? "No attachments"
|
|
267
|
+
}
|
|
268
|
+
);
|
|
269
|
+
export {
|
|
270
|
+
Attachment,
|
|
271
|
+
AttachmentEmpty,
|
|
272
|
+
AttachmentHoverCard,
|
|
273
|
+
AttachmentHoverCardContent,
|
|
274
|
+
AttachmentHoverCardTrigger,
|
|
275
|
+
AttachmentInfo,
|
|
276
|
+
AttachmentPreview,
|
|
277
|
+
AttachmentRemove,
|
|
278
|
+
Attachments,
|
|
279
|
+
getAttachmentLabel,
|
|
280
|
+
getMediaCategory,
|
|
281
|
+
useAttachmentContext,
|
|
282
|
+
useAttachmentsContext
|
|
283
|
+
};
|