@chatsdk-dev/ui 0.0.1 → 0.1.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/README.md +7 -7
- package/dist/atoms/accordion.d.ts +7 -0
- package/dist/atoms/accordion.d.ts.map +1 -0
- package/dist/atoms/accordion.js +18 -0
- package/dist/atoms/alert-dialog.d.ts +19 -0
- package/dist/atoms/alert-dialog.d.ts.map +1 -0
- package/dist/atoms/alert-dialog.js +42 -0
- package/dist/atoms/alert.d.ts +11 -0
- package/dist/atoms/alert.d.ts.map +1 -0
- package/dist/atoms/alert.js +27 -0
- package/dist/atoms/avatar.d.ts +12 -0
- package/dist/atoms/avatar.d.ts.map +1 -0
- package/dist/atoms/avatar.js +23 -0
- package/dist/atoms/badge.d.ts +8 -0
- package/dist/atoms/badge.d.ts.map +1 -0
- package/dist/atoms/badge.js +44 -0
- package/dist/atoms/button-group.d.ts +11 -0
- package/dist/atoms/button-group.d.ts.map +1 -0
- package/dist/atoms/button-group.js +36 -0
- package/dist/atoms/button-loader.d.ts +9 -0
- package/dist/atoms/button-loader.d.ts.map +1 -0
- package/dist/atoms/button-loader.js +10 -0
- package/dist/atoms/button.d.ts +9 -0
- package/dist/atoms/button.d.ts.map +1 -0
- package/dist/atoms/button.js +32 -0
- package/dist/atoms/card.d.ts +12 -0
- package/dist/atoms/card.d.ts.map +1 -0
- package/dist/atoms/card.js +25 -0
- package/dist/atoms/carousel.d.ts +29 -0
- package/dist/atoms/carousel.d.ts.map +1 -0
- package/dist/atoms/carousel.js +91 -0
- package/dist/atoms/collapsible.d.ts +6 -0
- package/dist/atoms/collapsible.d.ts.map +1 -0
- package/dist/atoms/collapsible.js +13 -0
- package/dist/atoms/command.d.ts +20 -0
- package/dist/atoms/command.d.ts.map +1 -0
- package/dist/atoms/command.js +35 -0
- package/dist/atoms/container.d.ts +8 -0
- package/dist/atoms/container.d.ts.map +1 -0
- package/dist/atoms/container.js +5 -0
- package/dist/atoms/dialog.d.ts +19 -0
- package/dist/atoms/dialog.d.ts.map +1 -0
- package/dist/atoms/dialog.js +38 -0
- package/dist/atoms/dots-loader.d.ts +15 -0
- package/dist/atoms/dots-loader.d.ts.map +1 -0
- package/dist/atoms/dots-loader.js +21 -0
- package/dist/atoms/drawer.d.ts +14 -0
- package/dist/atoms/drawer.d.ts.map +1 -0
- package/dist/atoms/drawer.js +35 -0
- package/dist/atoms/dropdown-menu.d.ts +26 -0
- package/dist/atoms/dropdown-menu.d.ts.map +1 -0
- package/dist/atoms/dropdown-menu.js +51 -0
- package/dist/atoms/empty.d.ts +12 -0
- package/dist/atoms/empty.d.ts.map +1 -0
- package/dist/atoms/empty.js +33 -0
- package/dist/atoms/field.d.ts +25 -0
- package/dist/atoms/field.d.ts.map +1 -0
- package/dist/atoms/field.js +68 -0
- package/dist/atoms/form.d.ts +23 -0
- package/dist/atoms/form.d.ts.map +1 -0
- package/dist/atoms/form.js +68 -0
- package/dist/atoms/header.d.ts +6 -0
- package/dist/atoms/header.d.ts.map +1 -0
- package/dist/atoms/header.js +6 -0
- package/dist/atoms/hover-card.d.ts +6 -0
- package/dist/atoms/hover-card.d.ts.map +1 -0
- package/dist/atoms/hover-card.js +14 -0
- package/dist/atoms/index.d.ts +5 -0
- package/dist/atoms/index.d.ts.map +1 -0
- package/dist/atoms/index.js +5 -0
- package/dist/atoms/input-group.d.ts +19 -0
- package/dist/atoms/input-group.d.ts.map +1 -0
- package/dist/atoms/input-group.js +57 -0
- package/dist/atoms/input.d.ts +7 -0
- package/dist/atoms/input.d.ts.map +1 -0
- package/dist/atoms/input.js +6 -0
- package/dist/atoms/label.d.ts +3 -0
- package/dist/atoms/label.d.ts.map +1 -0
- package/dist/atoms/label.js +7 -0
- package/dist/atoms/logo.d.ts +7 -0
- package/dist/atoms/logo.d.ts.map +1 -0
- package/dist/atoms/logo.js +6 -0
- package/dist/atoms/number-flow.d.ts +3 -0
- package/dist/atoms/number-flow.d.ts.map +1 -0
- package/dist/atoms/number-flow.js +6 -0
- package/dist/atoms/popover.d.ts +10 -0
- package/dist/atoms/popover.d.ts.map +1 -0
- package/dist/atoms/popover.js +23 -0
- package/dist/atoms/progress.d.ts +8 -0
- package/dist/atoms/progress.d.ts.map +1 -0
- package/dist/atoms/progress.js +20 -0
- package/dist/atoms/radio-group.d.ts +6 -0
- package/dist/atoms/radio-group.d.ts.map +1 -0
- package/dist/atoms/radio-group.js +13 -0
- package/dist/atoms/scroll-area.d.ts +5 -0
- package/dist/atoms/scroll-area.d.ts.map +1 -0
- package/dist/atoms/scroll-area.js +11 -0
- package/dist/atoms/select.d.ts +17 -0
- package/dist/atoms/select.d.ts.map +1 -0
- package/dist/atoms/select.js +34 -0
- package/dist/atoms/separator.d.ts +3 -0
- package/dist/atoms/separator.d.ts.map +1 -0
- package/dist/atoms/separator.js +7 -0
- package/dist/atoms/sheet.d.ts +15 -0
- package/dist/atoms/sheet.d.ts.map +1 -0
- package/dist/atoms/sheet.js +37 -0
- package/dist/atoms/sidebar.d.ts +65 -0
- package/dist/atoms/sidebar.d.ts.map +1 -0
- package/dist/atoms/sidebar.js +258 -0
- package/dist/atoms/skeleton.d.ts +2 -0
- package/dist/atoms/skeleton.d.ts.map +1 -0
- package/dist/atoms/skeleton.js +5 -0
- package/dist/atoms/spinner.d.ts +3 -0
- package/dist/atoms/spinner.d.ts.map +1 -0
- package/dist/atoms/spinner.js +7 -0
- package/dist/atoms/switch.d.ts +5 -0
- package/dist/atoms/switch.d.ts.map +1 -0
- package/dist/atoms/switch.js +7 -0
- package/dist/atoms/table.d.ts +13 -0
- package/dist/atoms/table.d.ts.map +1 -0
- package/dist/atoms/table.js +28 -0
- package/dist/atoms/tabs.d.ts +12 -0
- package/dist/atoms/tabs.d.ts.map +1 -0
- package/dist/atoms/tabs.js +32 -0
- package/dist/atoms/textarea.d.ts +3 -0
- package/dist/atoms/textarea.d.ts.map +1 -0
- package/dist/atoms/textarea.js +5 -0
- package/dist/atoms/toggle.d.ts +9 -0
- package/dist/atoms/toggle.d.ts.map +1 -0
- package/dist/atoms/toggle.js +26 -0
- package/dist/atoms/tooltip.d.ts +7 -0
- package/dist/atoms/tooltip.d.ts.map +1 -0
- package/dist/atoms/tooltip.js +17 -0
- package/dist/atoms/typography/h1.d.ts +10 -0
- package/dist/atoms/typography/h1.d.ts.map +1 -0
- package/dist/atoms/typography/h1.js +6 -0
- package/dist/atoms/typography/paragraph.d.ts +6 -0
- package/dist/atoms/typography/paragraph.d.ts.map +1 -0
- package/dist/atoms/typography/paragraph.js +6 -0
- package/dist/atoms/typography/text.d.ts +14 -0
- package/dist/atoms/typography/text.d.ts.map +1 -0
- package/dist/atoms/typography/text.js +41 -0
- package/dist/components/responsive-alert-dialog.d.ts +16 -0
- package/dist/components/responsive-alert-dialog.d.ts.map +1 -0
- package/dist/components/responsive-alert-dialog.js +20 -0
- package/dist/components/responsive-dialog.d.ts +11 -0
- package/dist/components/responsive-dialog.d.ts.map +1 -0
- package/dist/components/responsive-dialog.js +21 -0
- package/dist/hooks/use-copy-to-clipboard.d.ts +2 -0
- package/dist/hooks/use-copy-to-clipboard.d.ts.map +1 -0
- package/dist/hooks/use-copy-to-clipboard.js +31 -0
- package/dist/index.css +1580 -39
- package/dist/molecules/actions.d.ts +10 -0
- package/dist/molecules/actions.d.ts.map +1 -0
- package/dist/molecules/actions.js +13 -0
- package/dist/molecules/agent.d.ts +27 -0
- package/dist/molecules/agent.d.ts.map +1 -0
- package/dist/molecules/agent.js +27 -0
- package/dist/molecules/ai/actions.d.ts +10 -0
- package/dist/molecules/ai/actions.d.ts.map +1 -0
- package/dist/molecules/ai/actions.js +13 -0
- package/dist/molecules/ai/agent.d.ts +27 -0
- package/dist/molecules/ai/agent.d.ts.map +1 -0
- package/dist/molecules/ai/agent.js +27 -0
- package/dist/molecules/ai/artifact.d.ts +24 -0
- package/dist/molecules/ai/artifact.d.ts.map +1 -0
- package/dist/molecules/ai/artifact.js +20 -0
- package/dist/molecules/ai/attachments.d.ts +55 -0
- package/dist/molecules/ai/attachments.d.ts.map +1 -0
- package/dist/molecules/ai/attachments.js +125 -0
- package/dist/molecules/ai/audio-player.d.ts +30 -0
- package/dist/molecules/ai/audio-player.d.ts.map +1 -0
- package/dist/molecules/ai/audio-player.js +43 -0
- package/dist/molecules/ai/canvas.d.ts +9 -0
- package/dist/molecules/ai/canvas.d.ts.map +1 -0
- package/dist/molecules/ai/canvas.js +5 -0
- package/dist/molecules/ai/chain-of-thought.d.ts +30 -0
- package/dist/molecules/ai/chain-of-thought.d.ts.map +1 -0
- package/dist/molecules/ai/chain-of-thought.js +49 -0
- package/dist/molecules/ai/checkpoint.d.ts +12 -0
- package/dist/molecules/ai/checkpoint.d.ts.map +1 -0
- package/dist/molecules/ai/checkpoint.js +10 -0
- package/dist/molecules/ai/code-block.d.ts +46 -0
- package/dist/molecules/ai/code-block.d.ts.map +1 -0
- package/dist/molecules/ai/code-block.js +216 -0
- package/dist/molecules/ai/commit.d.ts +65 -0
- package/dist/molecules/ai/commit.d.ts.map +1 -0
- package/dist/molecules/ai/commit.js +95 -0
- package/dist/molecules/ai/confirmation.d.ts +50 -0
- package/dist/molecules/ai/confirmation.d.ts.map +1 -0
- package/dist/molecules/ai/confirmation.js +61 -0
- package/dist/molecules/ai/connection.d.ts +3 -0
- package/dist/molecules/ai/connection.d.ts.map +1 -0
- package/dist/molecules/ai/connection.js +3 -0
- package/dist/molecules/ai/context.d.ts +33 -0
- package/dist/molecules/ai/context.d.ts.map +1 -0
- package/dist/molecules/ai/context.js +164 -0
- package/dist/molecules/ai/controls.d.ts +5 -0
- package/dist/molecules/ai/controls.d.ts.map +1 -0
- package/dist/molecules/ai/controls.js +5 -0
- package/dist/molecules/ai/conversation.d.ts +24 -0
- package/dist/molecules/ai/conversation.d.ts.map +1 -0
- package/dist/molecules/ai/conversation.js +41 -0
- package/dist/molecules/ai/edge.d.ts +6 -0
- package/dist/molecules/ai/edge.d.ts.map +1 -0
- package/dist/molecules/ai/edge.js +87 -0
- package/dist/molecules/ai/environment-variables.d.ts +39 -0
- package/dist/molecules/ai/environment-variables.d.ts.map +1 -0
- package/dist/molecules/ai/environment-variables.js +87 -0
- package/dist/molecules/ai/file-tree.d.ts +27 -0
- package/dist/molecules/ai/file-tree.d.ts.map +1 -0
- package/dist/molecules/ai/file-tree.js +71 -0
- package/dist/molecules/ai/image.d.ts +7 -0
- package/dist/molecules/ai/image.d.ts.map +1 -0
- package/dist/molecules/ai/image.js +3 -0
- package/dist/molecules/ai/inline-citation.d.ts +39 -0
- package/dist/molecules/ai/inline-citation.d.ts.map +1 -0
- package/dist/molecules/ai/inline-citation.js +68 -0
- package/dist/molecules/ai/jsx-preview.d.ts +30 -0
- package/dist/molecules/ai/jsx-preview.d.ts.map +1 -0
- package/dist/molecules/ai/jsx-preview.js +167 -0
- package/dist/molecules/ai/loader.d.ts +6 -0
- package/dist/molecules/ai/loader.d.ts.map +1 -0
- package/dist/molecules/ai/loader.js +4 -0
- package/dist/molecules/ai/message.d.ts +38 -0
- package/dist/molecules/ai/message.d.ts.map +1 -0
- package/dist/molecules/ai/message.js +92 -0
- package/dist/molecules/ai/mic-selector.d.ts +46 -0
- package/dist/molecules/ai/mic-selector.d.ts.map +1 -0
- package/dist/molecules/ai/mic-selector.js +184 -0
- package/dist/molecules/ai/model-selector.d.ts +36 -0
- package/dist/molecules/ai/model-selector.d.ts.map +1 -0
- package/dist/molecules/ai/model-selector.js +18 -0
- package/dist/molecules/ai/node.d.ts +22 -0
- package/dist/molecules/ai/node.d.ts.map +1 -0
- package/dist/molecules/ai/node.js +11 -0
- package/dist/molecules/ai/open-in-chat.d.ts +29 -0
- package/dist/molecules/ai/open-in-chat.d.ts.map +1 -0
- package/dist/molecules/ai/open-in-chat.js +100 -0
- package/dist/molecules/ai/package-info.d.ts +30 -0
- package/dist/molecules/ai/package-info.d.ts.map +1 -0
- package/dist/molecules/ai/package-info.js +50 -0
- package/dist/molecules/ai/panel.d.ts +6 -0
- package/dist/molecules/ai/panel.d.ts.map +1 -0
- package/dist/molecules/ai/panel.js +4 -0
- package/dist/molecules/ai/persona.d.ts +49 -0
- package/dist/molecules/ai/persona.d.ts.map +1 -0
- package/dist/molecules/ai/persona.js +189 -0
- package/dist/molecules/ai/plan.d.ts +26 -0
- package/dist/molecules/ai/plan.d.ts.map +1 -0
- package/dist/molecules/ai/plan.js +34 -0
- package/dist/molecules/ai/prompt-input.d.ts +149 -0
- package/dist/molecules/ai/prompt-input.d.ts.map +1 -0
- package/dist/molecules/ai/prompt-input.js +702 -0
- package/dist/molecules/ai/queue.d.ts +62 -0
- package/dist/molecules/ai/queue.d.ts.map +1 -0
- package/dist/molecules/ai/queue.js +28 -0
- package/dist/molecules/ai/reasoning.d.ts +27 -0
- package/dist/molecules/ai/reasoning.d.ts.map +1 -0
- package/dist/molecules/ai/reasoning.js +95 -0
- package/dist/molecules/ai/response.d.ts +6 -0
- package/dist/molecules/ai/response.d.ts.map +1 -0
- package/dist/molecules/ai/response.js +18 -0
- package/dist/molecules/ai/sandbox.d.ts +25 -0
- package/dist/molecules/ai/sandbox.d.ts.map +1 -0
- package/dist/molecules/ai/sandbox.js +15 -0
- package/dist/molecules/ai/schema-display.d.ts +56 -0
- package/dist/molecules/ai/schema-display.d.ts.map +1 -0
- package/dist/molecules/ai/schema-display.js +73 -0
- package/dist/molecules/ai/shimmer.d.ts +10 -0
- package/dist/molecules/ai/shimmer.d.ts.map +1 -0
- package/dist/molecules/ai/shimmer.js +28 -0
- package/dist/molecules/ai/snippet.d.ts +19 -0
- package/dist/molecules/ai/snippet.d.ts.map +1 -0
- package/dist/molecules/ai/snippet.js +46 -0
- package/dist/molecules/ai/sources.d.ts +13 -0
- package/dist/molecules/ai/sources.d.ts.map +1 -0
- package/dist/molecules/ai/sources.js +9 -0
- package/dist/molecules/ai/speech-input.d.ts +55 -0
- package/dist/molecules/ai/speech-input.d.ts.map +1 -0
- package/dist/molecules/ai/speech-input.js +187 -0
- package/dist/molecules/ai/stack-trace.d.ts +38 -0
- package/dist/molecules/ai/stack-trace.d.ts.map +1 -0
- package/dist/molecules/ai/stack-trace.js +194 -0
- package/dist/molecules/ai/suggestion.d.ts +11 -0
- package/dist/molecules/ai/suggestion.d.ts.map +1 -0
- package/dist/molecules/ai/suggestion.js +13 -0
- package/dist/molecules/ai/task.d.ts +15 -0
- package/dist/molecules/ai/task.d.ts.map +1 -0
- package/dist/molecules/ai/task.js +10 -0
- package/dist/molecules/ai/terminal.d.ts +28 -0
- package/dist/molecules/ai/terminal.d.ts.map +1 -0
- package/dist/molecules/ai/terminal.js +68 -0
- package/dist/molecules/ai/test-results.d.ts +59 -0
- package/dist/molecules/ai/test-results.d.ts.map +1 -0
- package/dist/molecules/ai/test-results.js +97 -0
- package/dist/molecules/ai/tool.d.ts +32 -0
- package/dist/molecules/ai/tool.d.ts.map +1 -0
- package/dist/molecules/ai/tool.js +49 -0
- package/dist/molecules/ai/toolbar.d.ts +6 -0
- package/dist/molecules/ai/toolbar.d.ts.map +1 -0
- package/dist/molecules/ai/toolbar.js +4 -0
- package/dist/molecules/ai/transcription.d.ts +17 -0
- package/dist/molecules/ai/transcription.d.ts.map +1 -0
- package/dist/molecules/ai/transcription.js +36 -0
- package/dist/molecules/ai/voice-selector.d.ts +64 -0
- package/dist/molecules/ai/voice-selector.d.ts.map +1 -0
- package/dist/molecules/ai/voice-selector.js +224 -0
- package/dist/molecules/ai/web-preview.d.ts +35 -0
- package/dist/molecules/ai/web-preview.d.ts.map +1 -0
- package/dist/molecules/ai/web-preview.js +65 -0
- package/dist/molecules/artifact.d.ts +24 -0
- package/dist/molecules/artifact.d.ts.map +1 -0
- package/dist/molecules/artifact.js +20 -0
- package/dist/molecules/attachments.d.ts +55 -0
- package/dist/molecules/attachments.d.ts.map +1 -0
- package/dist/molecules/attachments.js +125 -0
- package/dist/molecules/audio-player.d.ts +30 -0
- package/dist/molecules/audio-player.d.ts.map +1 -0
- package/dist/molecules/audio-player.js +43 -0
- package/dist/molecules/canvas.d.ts +9 -0
- package/dist/molecules/canvas.d.ts.map +1 -0
- package/dist/molecules/canvas.js +5 -0
- package/dist/molecules/chain-of-thought.d.ts +30 -0
- package/dist/molecules/chain-of-thought.d.ts.map +1 -0
- package/dist/molecules/chain-of-thought.js +49 -0
- package/dist/molecules/chat-message.d.ts +10 -0
- package/dist/molecules/chat-message.d.ts.map +1 -0
- package/dist/molecules/chat-message.js +53 -0
- package/dist/molecules/checkpoint.d.ts +12 -0
- package/dist/molecules/checkpoint.d.ts.map +1 -0
- package/dist/molecules/checkpoint.js +10 -0
- package/dist/molecules/code-block.d.ts +46 -0
- package/dist/molecules/code-block.d.ts.map +1 -0
- package/dist/molecules/code-block.js +216 -0
- package/dist/molecules/commit.d.ts +65 -0
- package/dist/molecules/commit.d.ts.map +1 -0
- package/dist/molecules/commit.js +95 -0
- package/dist/molecules/confirmation.d.ts +50 -0
- package/dist/molecules/confirmation.d.ts.map +1 -0
- package/dist/molecules/confirmation.js +61 -0
- package/dist/molecules/connection.d.ts +3 -0
- package/dist/molecules/connection.d.ts.map +1 -0
- package/dist/molecules/connection.js +3 -0
- package/dist/molecules/context.d.ts +33 -0
- package/dist/molecules/context.d.ts.map +1 -0
- package/dist/molecules/context.js +164 -0
- package/dist/molecules/controls.d.ts +5 -0
- package/dist/molecules/controls.d.ts.map +1 -0
- package/dist/molecules/controls.js +5 -0
- package/dist/molecules/conversation.d.ts +24 -0
- package/dist/molecules/conversation.d.ts.map +1 -0
- package/dist/molecules/conversation.js +41 -0
- package/dist/molecules/edge.d.ts +6 -0
- package/dist/molecules/edge.d.ts.map +1 -0
- package/dist/molecules/edge.js +87 -0
- package/dist/molecules/environment-variables.d.ts +39 -0
- package/dist/molecules/environment-variables.d.ts.map +1 -0
- package/dist/molecules/environment-variables.js +87 -0
- package/dist/molecules/file-tree.d.ts +27 -0
- package/dist/molecules/file-tree.d.ts.map +1 -0
- package/dist/molecules/file-tree.js +71 -0
- package/dist/molecules/image.d.ts +7 -0
- package/dist/molecules/image.d.ts.map +1 -0
- package/dist/molecules/image.js +3 -0
- package/dist/molecules/inline-citation.d.ts +39 -0
- package/dist/molecules/inline-citation.d.ts.map +1 -0
- package/dist/molecules/inline-citation.js +68 -0
- package/dist/molecules/jsx-preview.d.ts +30 -0
- package/dist/molecules/jsx-preview.d.ts.map +1 -0
- package/dist/molecules/jsx-preview.js +167 -0
- package/dist/molecules/loader.d.ts +6 -0
- package/dist/molecules/loader.d.ts.map +1 -0
- package/dist/molecules/loader.js +4 -0
- package/dist/molecules/message.d.ts +38 -0
- package/dist/molecules/message.d.ts.map +1 -0
- package/dist/molecules/message.js +92 -0
- package/dist/molecules/mic-selector.d.ts +46 -0
- package/dist/molecules/mic-selector.d.ts.map +1 -0
- package/dist/molecules/mic-selector.js +184 -0
- package/dist/molecules/model-selector.d.ts +36 -0
- package/dist/molecules/model-selector.d.ts.map +1 -0
- package/dist/molecules/model-selector.js +18 -0
- package/dist/molecules/node.d.ts +22 -0
- package/dist/molecules/node.d.ts.map +1 -0
- package/dist/molecules/node.js +11 -0
- package/dist/molecules/open-in-chat.d.ts +29 -0
- package/dist/molecules/open-in-chat.d.ts.map +1 -0
- package/dist/molecules/open-in-chat.js +100 -0
- package/dist/molecules/package-info.d.ts +30 -0
- package/dist/molecules/package-info.d.ts.map +1 -0
- package/dist/molecules/package-info.js +50 -0
- package/dist/molecules/panel.d.ts +6 -0
- package/dist/molecules/panel.d.ts.map +1 -0
- package/dist/molecules/panel.js +4 -0
- package/dist/molecules/persona.d.ts +49 -0
- package/dist/molecules/persona.d.ts.map +1 -0
- package/dist/molecules/persona.js +189 -0
- package/dist/molecules/plan.d.ts +26 -0
- package/dist/molecules/plan.d.ts.map +1 -0
- package/dist/molecules/plan.js +34 -0
- package/dist/molecules/prompt-input.d.ts +149 -0
- package/dist/molecules/prompt-input.d.ts.map +1 -0
- package/dist/molecules/prompt-input.js +702 -0
- package/dist/molecules/queue.d.ts +62 -0
- package/dist/molecules/queue.d.ts.map +1 -0
- package/dist/molecules/queue.js +28 -0
- package/dist/molecules/reasoning.d.ts +27 -0
- package/dist/molecules/reasoning.d.ts.map +1 -0
- package/dist/molecules/reasoning.js +95 -0
- package/dist/molecules/response.d.ts +6 -0
- package/dist/molecules/response.d.ts.map +1 -0
- package/dist/molecules/response.js +18 -0
- package/dist/molecules/responsive-alert-dialog.d.ts +16 -0
- package/dist/molecules/responsive-alert-dialog.d.ts.map +1 -0
- package/dist/molecules/responsive-alert-dialog.js +20 -0
- package/dist/molecules/responsive-dialog.d.ts +11 -0
- package/dist/molecules/responsive-dialog.d.ts.map +1 -0
- package/dist/molecules/responsive-dialog.js +21 -0
- package/dist/molecules/sandbox.d.ts +25 -0
- package/dist/molecules/sandbox.d.ts.map +1 -0
- package/dist/molecules/sandbox.js +15 -0
- package/dist/molecules/schema-display.d.ts +56 -0
- package/dist/molecules/schema-display.d.ts.map +1 -0
- package/dist/molecules/schema-display.js +73 -0
- package/dist/molecules/shimmer.d.ts +10 -0
- package/dist/molecules/shimmer.d.ts.map +1 -0
- package/dist/molecules/shimmer.js +28 -0
- package/dist/molecules/snippet.d.ts +19 -0
- package/dist/molecules/snippet.d.ts.map +1 -0
- package/dist/molecules/snippet.js +46 -0
- package/dist/molecules/sources.d.ts +13 -0
- package/dist/molecules/sources.d.ts.map +1 -0
- package/dist/molecules/sources.js +9 -0
- package/dist/molecules/speech-input.d.ts +55 -0
- package/dist/molecules/speech-input.d.ts.map +1 -0
- package/dist/molecules/speech-input.js +187 -0
- package/dist/molecules/stack-trace.d.ts +38 -0
- package/dist/molecules/stack-trace.d.ts.map +1 -0
- package/dist/molecules/stack-trace.js +194 -0
- package/dist/molecules/suggestion.d.ts +11 -0
- package/dist/molecules/suggestion.d.ts.map +1 -0
- package/dist/molecules/suggestion.js +13 -0
- package/dist/molecules/task.d.ts +15 -0
- package/dist/molecules/task.d.ts.map +1 -0
- package/dist/molecules/task.js +10 -0
- package/dist/molecules/terminal.d.ts +28 -0
- package/dist/molecules/terminal.d.ts.map +1 -0
- package/dist/molecules/terminal.js +68 -0
- package/dist/molecules/test-results.d.ts +59 -0
- package/dist/molecules/test-results.d.ts.map +1 -0
- package/dist/molecules/test-results.js +97 -0
- package/dist/molecules/tool.d.ts +32 -0
- package/dist/molecules/tool.d.ts.map +1 -0
- package/dist/molecules/tool.js +49 -0
- package/dist/molecules/toolbar.d.ts +6 -0
- package/dist/molecules/toolbar.d.ts.map +1 -0
- package/dist/molecules/toolbar.js +4 -0
- package/dist/molecules/transcription.d.ts +17 -0
- package/dist/molecules/transcription.d.ts.map +1 -0
- package/dist/molecules/transcription.js +36 -0
- package/dist/molecules/voice-selector.d.ts +64 -0
- package/dist/molecules/voice-selector.d.ts.map +1 -0
- package/dist/molecules/voice-selector.js +224 -0
- package/dist/molecules/web-preview.d.ts +35 -0
- package/dist/molecules/web-preview.d.ts.map +1 -0
- package/dist/molecules/web-preview.js +65 -0
- package/package.json +27 -8
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Alert, AlertDescription } from "@chatsdk-dev/ui/atoms/alert";
|
|
4
|
+
import { Button } from "@chatsdk-dev/ui/atoms/button";
|
|
5
|
+
import { cn } from "@chatsdk-dev/ui/lib/utils";
|
|
6
|
+
import { createContext, useContext, useMemo } from "react";
|
|
7
|
+
const ConfirmationContext = createContext(null);
|
|
8
|
+
const useConfirmation = () => {
|
|
9
|
+
const context = useContext(ConfirmationContext);
|
|
10
|
+
if (!context) {
|
|
11
|
+
throw new Error("Confirmation components must be used within Confirmation");
|
|
12
|
+
}
|
|
13
|
+
return context;
|
|
14
|
+
};
|
|
15
|
+
export const Confirmation = ({ className, approval, state, ...props }) => {
|
|
16
|
+
const contextValue = useMemo(() => ({ approval, state }), [approval, state]);
|
|
17
|
+
if (!approval || state === "input-streaming" || state === "input-available") {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
return (_jsx(ConfirmationContext.Provider, { value: contextValue, children: _jsx(Alert, { className: cn("flex flex-col gap-2", className), ...props }) }));
|
|
21
|
+
};
|
|
22
|
+
export const ConfirmationTitle = ({ className, ...props }) => (_jsx(AlertDescription, { className: cn("inline", className), ...props }));
|
|
23
|
+
export const ConfirmationRequest = ({ children }) => {
|
|
24
|
+
const { state } = useConfirmation();
|
|
25
|
+
// Only show when approval is requested
|
|
26
|
+
if (state !== "approval-requested") {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
return children;
|
|
30
|
+
};
|
|
31
|
+
export const ConfirmationAccepted = ({ children, }) => {
|
|
32
|
+
const { approval, state } = useConfirmation();
|
|
33
|
+
// Only show when approved and in response states
|
|
34
|
+
if (!approval?.approved ||
|
|
35
|
+
(state !== "approval-responded" &&
|
|
36
|
+
state !== "output-denied" &&
|
|
37
|
+
state !== "output-available")) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
return children;
|
|
41
|
+
};
|
|
42
|
+
export const ConfirmationRejected = ({ children, }) => {
|
|
43
|
+
const { approval, state } = useConfirmation();
|
|
44
|
+
// Only show when rejected and in response states
|
|
45
|
+
if (approval?.approved !== false ||
|
|
46
|
+
(state !== "approval-responded" &&
|
|
47
|
+
state !== "output-denied" &&
|
|
48
|
+
state !== "output-available")) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
return children;
|
|
52
|
+
};
|
|
53
|
+
export const ConfirmationActions = ({ className, ...props }) => {
|
|
54
|
+
const { state } = useConfirmation();
|
|
55
|
+
// Only show when approval is requested
|
|
56
|
+
if (state !== "approval-requested") {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
return (_jsx("div", { className: cn("flex items-center justify-end gap-2 self-end", className), ...props }));
|
|
60
|
+
};
|
|
61
|
+
export const ConfirmationAction = (props) => (_jsx(Button, { className: "h-8 px-3 text-sm", type: "button", ...props }));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../../src/molecules/ai/connection.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAI7D,eAAO,MAAM,UAAU,EAAE,uBAuBxB,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
const HALF = 0.5;
|
|
3
|
+
export const Connection = ({ fromX, fromY, toX, toY, }) => (_jsxs("g", { children: [_jsx("path", { className: "animated", d: `M${fromX},${fromY} C ${fromX + (toX - fromX) * HALF},${fromY} ${fromX + (toX - fromX) * HALF},${toY} ${toX},${toY}`, fill: "none", stroke: "var(--color-ring)", strokeWidth: 1 }), _jsx("circle", { cx: toX, cy: toY, fill: "#fff", r: 3, stroke: "var(--color-ring)", strokeWidth: 1 })] }));
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Button } from "@chatsdk-dev/ui/atoms/button";
|
|
2
|
+
import { HoverCard, HoverCardContent } from "@chatsdk-dev/ui/atoms/hover-card";
|
|
3
|
+
import type { LanguageModelUsage } from "ai";
|
|
4
|
+
import type { ComponentProps } from "react";
|
|
5
|
+
type ModelId = string;
|
|
6
|
+
interface ContextSchema {
|
|
7
|
+
usedTokens: number;
|
|
8
|
+
maxTokens: number;
|
|
9
|
+
usage?: LanguageModelUsage;
|
|
10
|
+
modelId?: ModelId;
|
|
11
|
+
}
|
|
12
|
+
export type ContextProps = ComponentProps<typeof HoverCard> & ContextSchema;
|
|
13
|
+
export declare const Context: ({ usedTokens, maxTokens, usage, modelId, ...props }: ContextProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export type ContextTriggerProps = ComponentProps<typeof Button>;
|
|
15
|
+
export declare const ContextTrigger: ({ children, ...props }: ContextTriggerProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export type ContextContentProps = ComponentProps<typeof HoverCardContent>;
|
|
17
|
+
export declare const ContextContent: ({ className, ...props }: ContextContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export type ContextContentHeaderProps = ComponentProps<"div">;
|
|
19
|
+
export declare const ContextContentHeader: ({ children, className, ...props }: ContextContentHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export type ContextContentBodyProps = ComponentProps<"div">;
|
|
21
|
+
export declare const ContextContentBody: ({ children, className, ...props }: ContextContentBodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export type ContextContentFooterProps = ComponentProps<"div">;
|
|
23
|
+
export declare const ContextContentFooter: ({ children, className, ...props }: ContextContentFooterProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export type ContextInputUsageProps = ComponentProps<"div">;
|
|
25
|
+
export declare const ContextInputUsage: ({ className, children, ...props }: ContextInputUsageProps) => string | number | bigint | true | import("react/jsx-runtime").JSX.Element | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | null;
|
|
26
|
+
export type ContextOutputUsageProps = ComponentProps<"div">;
|
|
27
|
+
export declare const ContextOutputUsage: ({ className, children, ...props }: ContextOutputUsageProps) => string | number | bigint | true | import("react/jsx-runtime").JSX.Element | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | null;
|
|
28
|
+
export type ContextReasoningUsageProps = ComponentProps<"div">;
|
|
29
|
+
export declare const ContextReasoningUsage: ({ className, children, ...props }: ContextReasoningUsageProps) => string | number | bigint | true | import("react/jsx-runtime").JSX.Element | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | null;
|
|
30
|
+
export type ContextCacheUsageProps = ComponentProps<"div">;
|
|
31
|
+
export declare const ContextCacheUsage: ({ className, children, ...props }: ContextCacheUsageProps) => string | number | bigint | true | import("react/jsx-runtime").JSX.Element | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | null;
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/molecules/ai/context.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EACL,SAAS,EACT,gBAAgB,EAEjB,MAAM,kCAAkC,CAAC;AAG1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,IAAI,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAU5C,KAAK,OAAO,GAAG,MAAM,CAAC;AAEtB,UAAU,aAAa;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,kBAAkB,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAcD,MAAM,MAAM,YAAY,GAAG,cAAc,CAAC,OAAO,SAAS,CAAC,GAAG,aAAa,CAAC;AAE5E,eAAO,MAAM,OAAO,GAAI,qDAMrB,YAAY,4CAWd,CAAC;AA2CF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC;AAEhE,eAAO,MAAM,cAAc,GAAI,wBAAwB,mBAAmB,4CAwBzE,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1E,eAAO,MAAM,cAAc,GAAI,yBAG5B,mBAAmB,4CAKrB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAE9D,eAAO,MAAM,oBAAoB,GAAI,mCAIlC,yBAAyB,4CA+B3B,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAE5D,eAAO,MAAM,kBAAkB,GAAI,mCAIhC,uBAAuB,4CAIzB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAE9D,eAAO,MAAM,oBAAoB,GAAI,mCAIlC,yBAAyB,4CAgC3B,CAAC;AAqBF,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAE3D,eAAO,MAAM,iBAAiB,GAAI,mCAI/B,sBAAsB,6VAgCxB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAE5D,eAAO,MAAM,kBAAkB,GAAI,mCAIhC,uBAAuB,6VAgCzB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAE/D,eAAO,MAAM,qBAAqB,GAAI,mCAInC,0BAA0B,6VAgC5B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAE3D,eAAO,MAAM,iBAAiB,GAAI,mCAI/B,sBAAsB,6VAgCxB,CAAC"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { Button } from "@chatsdk-dev/ui/atoms/button";
|
|
4
|
+
import { HoverCard, HoverCardContent, HoverCardTrigger, } from "@chatsdk-dev/ui/atoms/hover-card";
|
|
5
|
+
import { Progress } from "@chatsdk-dev/ui/atoms/progress";
|
|
6
|
+
import { cn } from "@chatsdk-dev/ui/lib/utils";
|
|
7
|
+
import { createContext, useContext, useMemo } from "react";
|
|
8
|
+
import { getUsage } from "tokenlens";
|
|
9
|
+
const PERCENT_MAX = 100;
|
|
10
|
+
const ICON_RADIUS = 10;
|
|
11
|
+
const ICON_VIEWBOX = 24;
|
|
12
|
+
const ICON_CENTER = 12;
|
|
13
|
+
const ICON_STROKE_WIDTH = 2;
|
|
14
|
+
const ContextContext = createContext(null);
|
|
15
|
+
const useContextValue = () => {
|
|
16
|
+
const context = useContext(ContextContext);
|
|
17
|
+
if (!context) {
|
|
18
|
+
throw new Error("Context components must be used within Context");
|
|
19
|
+
}
|
|
20
|
+
return context;
|
|
21
|
+
};
|
|
22
|
+
export const Context = ({ usedTokens, maxTokens, usage, modelId, ...props }) => {
|
|
23
|
+
const contextValue = useMemo(() => ({ maxTokens, modelId, usage, usedTokens }), [maxTokens, modelId, usage, usedTokens]);
|
|
24
|
+
return (_jsx(ContextContext.Provider, { value: contextValue, children: _jsx(HoverCard, { ...props }) }));
|
|
25
|
+
};
|
|
26
|
+
const ContextIcon = () => {
|
|
27
|
+
const { usedTokens, maxTokens } = useContextValue();
|
|
28
|
+
const circumference = 2 * Math.PI * ICON_RADIUS;
|
|
29
|
+
const usedPercent = usedTokens / maxTokens;
|
|
30
|
+
const dashOffset = circumference * (1 - usedPercent);
|
|
31
|
+
return (_jsxs("svg", { "aria-label": "Model context usage", height: "20", role: "img", style: { color: "currentcolor" }, viewBox: `0 0 ${ICON_VIEWBOX} ${ICON_VIEWBOX}`, width: "20", children: [_jsx("circle", { cx: ICON_CENTER, cy: ICON_CENTER, fill: "none", opacity: "0.25", r: ICON_RADIUS, stroke: "currentColor", strokeWidth: ICON_STROKE_WIDTH }), _jsx("circle", { cx: ICON_CENTER, cy: ICON_CENTER, fill: "none", opacity: "0.7", r: ICON_RADIUS, stroke: "currentColor", strokeDasharray: `${circumference} ${circumference}`, strokeDashoffset: dashOffset, strokeLinecap: "round", strokeWidth: ICON_STROKE_WIDTH, style: { transform: "rotate(-90deg)", transformOrigin: "center" } })] }));
|
|
32
|
+
};
|
|
33
|
+
export const ContextTrigger = ({ children, ...props }) => {
|
|
34
|
+
const { usedTokens, maxTokens } = useContextValue();
|
|
35
|
+
const usedPercent = usedTokens / maxTokens;
|
|
36
|
+
const renderedPercent = new Intl.NumberFormat("en-US", {
|
|
37
|
+
maximumFractionDigits: 1,
|
|
38
|
+
style: "percent",
|
|
39
|
+
}).format(usedPercent);
|
|
40
|
+
return (_jsx(HoverCardTrigger, { render: () => children ? (_jsx(_Fragment, { children: children })) : (_jsxs(Button, { type: "button", variant: "ghost", ...props, children: [_jsx("span", { className: "font-medium text-muted-foreground", children: renderedPercent }), _jsx(ContextIcon, {})] })) }));
|
|
41
|
+
};
|
|
42
|
+
export const ContextContent = ({ className, ...props }) => (_jsx(HoverCardContent, { className: cn("min-w-60 divide-y overflow-hidden p-0", className), ...props }));
|
|
43
|
+
export const ContextContentHeader = ({ children, className, ...props }) => {
|
|
44
|
+
const { usedTokens, maxTokens } = useContextValue();
|
|
45
|
+
const usedPercent = usedTokens / maxTokens;
|
|
46
|
+
const displayPct = new Intl.NumberFormat("en-US", {
|
|
47
|
+
maximumFractionDigits: 1,
|
|
48
|
+
style: "percent",
|
|
49
|
+
}).format(usedPercent);
|
|
50
|
+
const used = new Intl.NumberFormat("en-US", {
|
|
51
|
+
notation: "compact",
|
|
52
|
+
}).format(usedTokens);
|
|
53
|
+
const total = new Intl.NumberFormat("en-US", {
|
|
54
|
+
notation: "compact",
|
|
55
|
+
}).format(maxTokens);
|
|
56
|
+
return (_jsx("div", { className: cn("w-full space-y-2 p-3", className), ...props, children: children ?? (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex items-center justify-between gap-3 text-xs", children: [_jsx("p", { children: displayPct }), _jsxs("p", { className: "font-mono text-muted-foreground", children: [used, " / ", total] })] }), _jsx("div", { className: "space-y-2", children: _jsx(Progress, { className: "bg-muted", value: usedPercent * PERCENT_MAX }) })] })) }));
|
|
57
|
+
};
|
|
58
|
+
export const ContextContentBody = ({ children, className, ...props }) => (_jsx("div", { className: cn("w-full p-3", className), ...props, children: children }));
|
|
59
|
+
export const ContextContentFooter = ({ children, className, ...props }) => {
|
|
60
|
+
const { modelId, usage } = useContextValue();
|
|
61
|
+
const costUSD = modelId
|
|
62
|
+
? getUsage({
|
|
63
|
+
modelId,
|
|
64
|
+
usage: {
|
|
65
|
+
input: usage?.inputTokens ?? 0,
|
|
66
|
+
output: usage?.outputTokens ?? 0,
|
|
67
|
+
},
|
|
68
|
+
}).costUSD?.totalUSD
|
|
69
|
+
: undefined;
|
|
70
|
+
const totalCost = new Intl.NumberFormat("en-US", {
|
|
71
|
+
currency: "USD",
|
|
72
|
+
style: "currency",
|
|
73
|
+
}).format(costUSD ?? 0);
|
|
74
|
+
return (_jsx("div", { className: cn("flex w-full items-center justify-between gap-3 bg-secondary p-3 text-xs", className), ...props, children: children ?? (_jsxs(_Fragment, { children: [_jsx("span", { className: "text-muted-foreground", children: "Total cost" }), _jsx("span", { children: totalCost })] })) }));
|
|
75
|
+
};
|
|
76
|
+
const TokensWithCost = ({ tokens, costText, }) => (_jsxs("span", { children: [tokens === undefined
|
|
77
|
+
? "—"
|
|
78
|
+
: new Intl.NumberFormat("en-US", {
|
|
79
|
+
notation: "compact",
|
|
80
|
+
}).format(tokens), costText ? (_jsxs("span", { className: "ml-2 text-muted-foreground", children: ["\u2022 ", costText] })) : null] }));
|
|
81
|
+
export const ContextInputUsage = ({ className, children, ...props }) => {
|
|
82
|
+
const { usage, modelId } = useContextValue();
|
|
83
|
+
const inputTokens = usage?.inputTokens ?? 0;
|
|
84
|
+
if (children) {
|
|
85
|
+
return children;
|
|
86
|
+
}
|
|
87
|
+
if (!inputTokens) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
const inputCost = modelId
|
|
91
|
+
? getUsage({
|
|
92
|
+
modelId,
|
|
93
|
+
usage: { input: inputTokens, output: 0 },
|
|
94
|
+
}).costUSD?.totalUSD
|
|
95
|
+
: undefined;
|
|
96
|
+
const inputCostText = new Intl.NumberFormat("en-US", {
|
|
97
|
+
currency: "USD",
|
|
98
|
+
style: "currency",
|
|
99
|
+
}).format(inputCost ?? 0);
|
|
100
|
+
return (_jsxs("div", { className: cn("flex items-center justify-between text-xs", className), ...props, children: [_jsx("span", { className: "text-muted-foreground", children: "Input" }), _jsx(TokensWithCost, { costText: inputCostText, tokens: inputTokens })] }));
|
|
101
|
+
};
|
|
102
|
+
export const ContextOutputUsage = ({ className, children, ...props }) => {
|
|
103
|
+
const { usage, modelId } = useContextValue();
|
|
104
|
+
const outputTokens = usage?.outputTokens ?? 0;
|
|
105
|
+
if (children) {
|
|
106
|
+
return children;
|
|
107
|
+
}
|
|
108
|
+
if (!outputTokens) {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
const outputCost = modelId
|
|
112
|
+
? getUsage({
|
|
113
|
+
modelId,
|
|
114
|
+
usage: { input: 0, output: outputTokens },
|
|
115
|
+
}).costUSD?.totalUSD
|
|
116
|
+
: undefined;
|
|
117
|
+
const outputCostText = new Intl.NumberFormat("en-US", {
|
|
118
|
+
currency: "USD",
|
|
119
|
+
style: "currency",
|
|
120
|
+
}).format(outputCost ?? 0);
|
|
121
|
+
return (_jsxs("div", { className: cn("flex items-center justify-between text-xs", className), ...props, children: [_jsx("span", { className: "text-muted-foreground", children: "Output" }), _jsx(TokensWithCost, { costText: outputCostText, tokens: outputTokens })] }));
|
|
122
|
+
};
|
|
123
|
+
export const ContextReasoningUsage = ({ className, children, ...props }) => {
|
|
124
|
+
const { usage, modelId } = useContextValue();
|
|
125
|
+
const reasoningTokens = usage?.reasoningTokens ?? 0;
|
|
126
|
+
if (children) {
|
|
127
|
+
return children;
|
|
128
|
+
}
|
|
129
|
+
if (!reasoningTokens) {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
const reasoningCost = modelId
|
|
133
|
+
? getUsage({
|
|
134
|
+
modelId,
|
|
135
|
+
usage: { reasoningTokens },
|
|
136
|
+
}).costUSD?.totalUSD
|
|
137
|
+
: undefined;
|
|
138
|
+
const reasoningCostText = new Intl.NumberFormat("en-US", {
|
|
139
|
+
currency: "USD",
|
|
140
|
+
style: "currency",
|
|
141
|
+
}).format(reasoningCost ?? 0);
|
|
142
|
+
return (_jsxs("div", { className: cn("flex items-center justify-between text-xs", className), ...props, children: [_jsx("span", { className: "text-muted-foreground", children: "Reasoning" }), _jsx(TokensWithCost, { costText: reasoningCostText, tokens: reasoningTokens })] }));
|
|
143
|
+
};
|
|
144
|
+
export const ContextCacheUsage = ({ className, children, ...props }) => {
|
|
145
|
+
const { usage, modelId } = useContextValue();
|
|
146
|
+
const cacheTokens = usage?.cachedInputTokens ?? 0;
|
|
147
|
+
if (children) {
|
|
148
|
+
return children;
|
|
149
|
+
}
|
|
150
|
+
if (!cacheTokens) {
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
const cacheCost = modelId
|
|
154
|
+
? getUsage({
|
|
155
|
+
modelId,
|
|
156
|
+
usage: { cacheReads: cacheTokens, input: 0, output: 0 },
|
|
157
|
+
}).costUSD?.totalUSD
|
|
158
|
+
: undefined;
|
|
159
|
+
const cacheCostText = new Intl.NumberFormat("en-US", {
|
|
160
|
+
currency: "USD",
|
|
161
|
+
style: "currency",
|
|
162
|
+
}).format(cacheCost ?? 0);
|
|
163
|
+
return (_jsxs("div", { className: cn("flex items-center justify-between text-xs", className), ...props, children: [_jsx("span", { className: "text-muted-foreground", children: "Cache" }), _jsx(TokensWithCost, { costText: cacheCostText, tokens: cacheTokens })] }));
|
|
164
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Controls as ControlsPrimitive } from "@xyflow/react";
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
3
|
+
export type ControlsProps = ComponentProps<typeof ControlsPrimitive>;
|
|
4
|
+
export declare const Controls: ({ className, ...props }: ControlsProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
//# sourceMappingURL=controls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../../../src/molecules/ai/controls.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAErE,eAAO,MAAM,QAAQ,GAAI,yBAAyB,aAAa,4CAS9D,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "@chatsdk-dev/ui/lib/utils";
|
|
4
|
+
import { Controls as ControlsPrimitive } from "@xyflow/react";
|
|
5
|
+
export const Controls = ({ className, ...props }) => (_jsx(ControlsPrimitive, { className: cn("gap-px overflow-hidden rounded-md border bg-card p-1 shadow-none!", "[&>button]:rounded-md [&>button]:border-none! [&>button]:bg-transparent! [&>button]:hover:bg-secondary!", className), ...props }));
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Button } from "@chatsdk-dev/ui/atoms/button";
|
|
2
|
+
import type { UIMessage } from "ai";
|
|
3
|
+
import type { ComponentProps } from "react";
|
|
4
|
+
import { StickToBottom } from "use-stick-to-bottom";
|
|
5
|
+
export type ConversationProps = ComponentProps<typeof StickToBottom>;
|
|
6
|
+
export declare const Conversation: ({ className, ...props }: ConversationProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export type ConversationContentProps = ComponentProps<typeof StickToBottom.Content>;
|
|
8
|
+
export declare const ConversationContent: ({ className, ...props }: ConversationContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export type ConversationEmptyStateProps = ComponentProps<"div"> & {
|
|
10
|
+
title?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
icon?: React.ReactNode;
|
|
13
|
+
};
|
|
14
|
+
export declare const ConversationEmptyState: ({ className, title, description, icon, children, ...props }: ConversationEmptyStateProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export type ConversationScrollButtonProps = ComponentProps<typeof Button>;
|
|
16
|
+
export declare const ConversationScrollButton: ({ className, ...props }: ConversationScrollButtonProps) => false | import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export type ConversationDownloadProps = Omit<ComponentProps<typeof Button>, "onClick"> & {
|
|
18
|
+
messages: UIMessage[];
|
|
19
|
+
filename?: string;
|
|
20
|
+
formatMessage?: (message: UIMessage, index: number) => string;
|
|
21
|
+
};
|
|
22
|
+
export declare const messagesToMarkdown: (messages: UIMessage[], formatMessage?: (message: UIMessage, index: number) => string) => string;
|
|
23
|
+
export declare const ConversationDownload: ({ messages, filename, formatMessage, className, children, ...props }: ConversationDownloadProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
//# sourceMappingURL=conversation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../src/molecules/ai/conversation.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAEtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAEpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,aAAa,EAA2B,MAAM,qBAAqB,CAAC;AAE7E,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,OAAO,aAAa,CAAC,CAAC;AAErE,eAAO,MAAM,YAAY,GAAI,yBAAyB,iBAAiB,4CAQtE,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,cAAc,CACnD,OAAO,aAAa,CAAC,OAAO,CAC7B,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,yBAGjC,wBAAwB,4CAK1B,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IAChE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,6DAOpC,2BAA2B,4CAoB7B,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC;AAE1E,eAAO,MAAM,wBAAwB,GAAI,yBAGtC,6BAA6B,oDAwB/B,CAAC;AAQF,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAC1C,cAAc,CAAC,OAAO,MAAM,CAAC,EAC7B,SAAS,CACV,GAAG;IACF,QAAQ,EAAE,SAAS,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CAC/D,CAAC;AAQF,eAAO,MAAM,kBAAkB,GAC7B,UAAU,SAAS,EAAE,EACrB,gBAAe,CACb,OAAO,EAAE,SAAS,EAClB,KAAK,EAAE,MAAM,KACV,MAA6B,KACjC,MAAsE,CAAC;AAE1E,eAAO,MAAM,oBAAoB,GAAI,sEAOlC,yBAAyB,4CA6B3B,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { Button } from "@chatsdk-dev/ui/atoms/button";
|
|
4
|
+
import { cn } from "@chatsdk-dev/ui/lib/utils";
|
|
5
|
+
import { ArrowDownIcon, DownloadIcon } from "lucide-react";
|
|
6
|
+
import { useCallback } from "react";
|
|
7
|
+
import { StickToBottom, useStickToBottomContext } from "use-stick-to-bottom";
|
|
8
|
+
export const Conversation = ({ className, ...props }) => (_jsx(StickToBottom, { className: cn("relative flex-1 overflow-y-hidden", className), initial: "smooth", resize: "smooth", role: "log", ...props }));
|
|
9
|
+
export const ConversationContent = ({ className, ...props }) => (_jsx(StickToBottom.Content, { className: cn("flex flex-col gap-8 p-4", className), ...props }));
|
|
10
|
+
export const ConversationEmptyState = ({ className, title = "No messages yet", description = "Start a conversation to see messages here", icon, children, ...props }) => (_jsx("div", { className: cn("flex size-full flex-col items-center justify-center gap-3 p-8 text-center", className), ...props, children: children ?? (_jsxs(_Fragment, { children: [icon && _jsx("div", { className: "text-muted-foreground", children: icon }), _jsxs("div", { className: "space-y-1", children: [_jsx("h3", { className: "font-medium text-sm", children: title }), description && (_jsx("p", { className: "text-muted-foreground text-sm", children: description }))] })] })) }));
|
|
11
|
+
export const ConversationScrollButton = ({ className, ...props }) => {
|
|
12
|
+
const { isAtBottom, scrollToBottom } = useStickToBottomContext();
|
|
13
|
+
const handleScrollToBottom = useCallback(() => {
|
|
14
|
+
scrollToBottom();
|
|
15
|
+
}, [scrollToBottom]);
|
|
16
|
+
return (!isAtBottom && (_jsx(Button, { className: cn("absolute bottom-4 left-[50%] translate-x-[-50%] rounded-full dark:bg-background dark:hover:bg-muted", className), onClick: handleScrollToBottom, size: "icon", type: "button", variant: "outline", ...props, children: _jsx(ArrowDownIcon, { className: "size-4" }) })));
|
|
17
|
+
};
|
|
18
|
+
const getMessageText = (message) => message.parts
|
|
19
|
+
.filter((part) => part.type === "text")
|
|
20
|
+
.map((part) => part.text)
|
|
21
|
+
.join("");
|
|
22
|
+
const defaultFormatMessage = (message) => {
|
|
23
|
+
const roleLabel = message.role.charAt(0).toUpperCase() + message.role.slice(1);
|
|
24
|
+
return `**${roleLabel}:** ${getMessageText(message)}`;
|
|
25
|
+
};
|
|
26
|
+
export const messagesToMarkdown = (messages, formatMessage = defaultFormatMessage) => messages.map((msg, i) => formatMessage(msg, i)).join("\n\n");
|
|
27
|
+
export const ConversationDownload = ({ messages, filename = "conversation.md", formatMessage = defaultFormatMessage, className, children, ...props }) => {
|
|
28
|
+
const handleDownload = useCallback(() => {
|
|
29
|
+
const markdown = messagesToMarkdown(messages, formatMessage);
|
|
30
|
+
const blob = new Blob([markdown], { type: "text/markdown" });
|
|
31
|
+
const url = URL.createObjectURL(blob);
|
|
32
|
+
const link = document.createElement("a");
|
|
33
|
+
link.href = url;
|
|
34
|
+
link.download = filename;
|
|
35
|
+
document.body.append(link);
|
|
36
|
+
link.click();
|
|
37
|
+
link.remove();
|
|
38
|
+
URL.revokeObjectURL(url);
|
|
39
|
+
}, [messages, filename, formatMessage]);
|
|
40
|
+
return (_jsx(Button, { className: cn("absolute top-4 right-4 rounded-full dark:bg-background dark:hover:bg-muted", className), onClick: handleDownload, size: "icon", type: "button", variant: "outline", ...props, children: children ?? _jsx(DownloadIcon, { className: "size-4" }) }));
|
|
41
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { EdgeProps } from "@xyflow/react";
|
|
2
|
+
export declare const Edge: {
|
|
3
|
+
Animated: ({ id, source, target, markerEnd, style }: EdgeProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
4
|
+
Temporary: ({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, }: EdgeProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=edge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edge.d.ts","sourceRoot":"","sources":["../../../src/molecules/ai/edge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAsB,MAAM,eAAe,CAAC;AA2InE,eAAO,MAAM,IAAI;yDAhC2C,SAAS;6FA1FlE,SAAS;CA6HX,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { BaseEdge, getBezierPath, getSimpleBezierPath, Position, useInternalNode, } from "@xyflow/react";
|
|
3
|
+
const Temporary = ({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, }) => {
|
|
4
|
+
const [edgePath] = getSimpleBezierPath({
|
|
5
|
+
sourcePosition,
|
|
6
|
+
sourceX,
|
|
7
|
+
sourceY,
|
|
8
|
+
targetPosition,
|
|
9
|
+
targetX,
|
|
10
|
+
targetY,
|
|
11
|
+
});
|
|
12
|
+
return (_jsx(BaseEdge, { className: "stroke-1 stroke-ring", id: id, path: edgePath, style: {
|
|
13
|
+
strokeDasharray: "5, 5",
|
|
14
|
+
} }));
|
|
15
|
+
};
|
|
16
|
+
const getHandleCoordsByPosition = (node, handlePosition) => {
|
|
17
|
+
// Choose the handle type based on position - Left is for target, Right is for source
|
|
18
|
+
const handleType = handlePosition === Position.Left ? "target" : "source";
|
|
19
|
+
const handle = node.internals.handleBounds?.[handleType]?.find((h) => h.position === handlePosition);
|
|
20
|
+
if (!handle) {
|
|
21
|
+
return [0, 0];
|
|
22
|
+
}
|
|
23
|
+
let offsetX = handle.width / 2;
|
|
24
|
+
let offsetY = handle.height / 2;
|
|
25
|
+
// this is a tiny detail to make the markerEnd of an edge visible.
|
|
26
|
+
// The handle position that gets calculated has the origin top-left, so depending which side we are using, we add a little offset
|
|
27
|
+
// when the handlePosition is Position.Right for example, we need to add an offset as big as the handle itself in order to get the correct position
|
|
28
|
+
switch (handlePosition) {
|
|
29
|
+
case Position.Left: {
|
|
30
|
+
offsetX = 0;
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
case Position.Right: {
|
|
34
|
+
offsetX = handle.width;
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
case Position.Top: {
|
|
38
|
+
offsetY = 0;
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
case Position.Bottom: {
|
|
42
|
+
offsetY = handle.height;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
default: {
|
|
46
|
+
throw new Error(`Invalid handle position: ${handlePosition}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const x = node.internals.positionAbsolute.x + handle.x + offsetX;
|
|
50
|
+
const y = node.internals.positionAbsolute.y + handle.y + offsetY;
|
|
51
|
+
return [x, y];
|
|
52
|
+
};
|
|
53
|
+
const getEdgeParams = (source, target) => {
|
|
54
|
+
const sourcePos = Position.Right;
|
|
55
|
+
const [sx, sy] = getHandleCoordsByPosition(source, sourcePos);
|
|
56
|
+
const targetPos = Position.Left;
|
|
57
|
+
const [tx, ty] = getHandleCoordsByPosition(target, targetPos);
|
|
58
|
+
return {
|
|
59
|
+
sourcePos,
|
|
60
|
+
sx,
|
|
61
|
+
sy,
|
|
62
|
+
targetPos,
|
|
63
|
+
tx,
|
|
64
|
+
ty,
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
const Animated = ({ id, source, target, markerEnd, style }) => {
|
|
68
|
+
const sourceNode = useInternalNode(source);
|
|
69
|
+
const targetNode = useInternalNode(target);
|
|
70
|
+
if (!(sourceNode && targetNode)) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
const { sx, sy, tx, ty, sourcePos, targetPos } = getEdgeParams(sourceNode, targetNode);
|
|
74
|
+
const [edgePath] = getBezierPath({
|
|
75
|
+
sourcePosition: sourcePos,
|
|
76
|
+
sourceX: sx,
|
|
77
|
+
sourceY: sy,
|
|
78
|
+
targetPosition: targetPos,
|
|
79
|
+
targetX: tx,
|
|
80
|
+
targetY: ty,
|
|
81
|
+
});
|
|
82
|
+
return (_jsxs(_Fragment, { children: [_jsx(BaseEdge, { id: id, markerEnd: markerEnd, path: edgePath, style: style }), _jsx("circle", { fill: "var(--primary)", r: "4", children: _jsx("animateMotion", { dur: "2s", path: edgePath, repeatCount: "indefinite" }) })] }));
|
|
83
|
+
};
|
|
84
|
+
export const Edge = {
|
|
85
|
+
Animated,
|
|
86
|
+
Temporary,
|
|
87
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Badge } from "@chatsdk-dev/ui/atoms/badge";
|
|
2
|
+
import { Button } from "@chatsdk-dev/ui/atoms/button";
|
|
3
|
+
import { Switch } from "@chatsdk-dev/ui/atoms/switch";
|
|
4
|
+
import type { ComponentProps, HTMLAttributes } from "react";
|
|
5
|
+
export type EnvironmentVariablesProps = HTMLAttributes<HTMLDivElement> & {
|
|
6
|
+
showValues?: boolean;
|
|
7
|
+
defaultShowValues?: boolean;
|
|
8
|
+
onShowValuesChange?: (show: boolean) => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const EnvironmentVariables: ({ showValues: controlledShowValues, defaultShowValues, onShowValuesChange, className, children, ...props }: EnvironmentVariablesProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export type EnvironmentVariablesHeaderProps = HTMLAttributes<HTMLDivElement>;
|
|
12
|
+
export declare const EnvironmentVariablesHeader: ({ className, children, ...props }: EnvironmentVariablesHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export type EnvironmentVariablesTitleProps = HTMLAttributes<HTMLHeadingElement>;
|
|
14
|
+
export declare const EnvironmentVariablesTitle: ({ className, children, ...props }: EnvironmentVariablesTitleProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export type EnvironmentVariablesToggleProps = ComponentProps<typeof Switch>;
|
|
16
|
+
export declare const EnvironmentVariablesToggle: ({ className, ...props }: EnvironmentVariablesToggleProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export type EnvironmentVariablesContentProps = HTMLAttributes<HTMLDivElement>;
|
|
18
|
+
export declare const EnvironmentVariablesContent: ({ className, children, ...props }: EnvironmentVariablesContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export type EnvironmentVariableGroupProps = HTMLAttributes<HTMLDivElement>;
|
|
20
|
+
export declare const EnvironmentVariableGroup: ({ className, children, ...props }: EnvironmentVariableGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export type EnvironmentVariableNameProps = HTMLAttributes<HTMLSpanElement>;
|
|
22
|
+
export declare const EnvironmentVariableName: ({ className, children, ...props }: EnvironmentVariableNameProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export type EnvironmentVariableValueProps = HTMLAttributes<HTMLSpanElement>;
|
|
24
|
+
export declare const EnvironmentVariableValue: ({ className, children, ...props }: EnvironmentVariableValueProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export type EnvironmentVariableProps = HTMLAttributes<HTMLDivElement> & {
|
|
26
|
+
name: string;
|
|
27
|
+
value: string;
|
|
28
|
+
};
|
|
29
|
+
export declare const EnvironmentVariable: ({ name, value, className, children, ...props }: EnvironmentVariableProps) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export type EnvironmentVariableCopyButtonProps = ComponentProps<typeof Button> & {
|
|
31
|
+
onCopy?: () => void;
|
|
32
|
+
onError?: (error: Error) => void;
|
|
33
|
+
timeout?: number;
|
|
34
|
+
copyFormat?: "name" | "value" | "export";
|
|
35
|
+
};
|
|
36
|
+
export declare const EnvironmentVariableCopyButton: ({ onCopy, onError, timeout, copyFormat, children, className, ...props }: EnvironmentVariableCopyButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
export type EnvironmentVariableRequiredProps = ComponentProps<typeof Badge>;
|
|
38
|
+
export declare const EnvironmentVariableRequired: ({ className, children, ...props }: EnvironmentVariableRequiredProps) => import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
//# sourceMappingURL=environment-variables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment-variables.d.ts","sourceRoot":"","sources":["../../../src/molecules/ai/environment-variables.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAGtD,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AA0B5D,MAAM,MAAM,yBAAyB,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IACvE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9C,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,4GAOlC,yBAAyB,4CA4B3B,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAE7E,eAAO,MAAM,0BAA0B,GAAI,mCAIxC,+BAA+B,4CAUjC,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,cAAc,CAAC,kBAAkB,CAAC,CAAC;AAEhF,eAAO,MAAM,yBAAyB,GAAI,mCAIvC,8BAA8B,4CAIhC,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC;AAE5E,eAAO,MAAM,0BAA0B,GAAI,yBAGxC,+BAA+B,4CAgBjC,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAE9E,eAAO,MAAM,2BAA2B,GAAI,mCAIzC,gCAAgC,4CAIlC,CAAC;AAaF,MAAM,MAAM,6BAA6B,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAE3E,eAAO,MAAM,wBAAwB,GAAI,mCAItC,6BAA6B,4CAI/B,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,cAAc,CAAC,eAAe,CAAC,CAAC;AAE3E,eAAO,MAAM,uBAAuB,GAAI,mCAIrC,4BAA4B,4CAQ9B,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG,cAAc,CAAC,eAAe,CAAC,CAAC;AAE5E,eAAO,MAAM,wBAAwB,GAAI,mCAItC,6BAA6B,4CAoB/B,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,gDAMjC,wBAAwB,4CAuB1B,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG,cAAc,CAC7D,OAAO,MAAM,CACd,GAAG;IACF,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;CAC1C,CAAC;AAEF,eAAO,MAAM,6BAA6B,GAAI,yEAQ3C,kCAAkC,4CAkDpC,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG,cAAc,CAAC,OAAO,KAAK,CAAC,CAAC;AAE5E,eAAO,MAAM,2BAA2B,GAAI,mCAIzC,gCAAgC,4CAIlC,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { Badge } from "@chatsdk-dev/ui/atoms/badge";
|
|
4
|
+
import { Button } from "@chatsdk-dev/ui/atoms/button";
|
|
5
|
+
import { Switch } from "@chatsdk-dev/ui/atoms/switch";
|
|
6
|
+
import { cn } from "@chatsdk-dev/ui/lib/utils";
|
|
7
|
+
import { CheckIcon, CopyIcon, EyeIcon, EyeOffIcon } from "lucide-react";
|
|
8
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, } from "react";
|
|
9
|
+
// Default noop for context default value
|
|
10
|
+
// oxlint-disable-next-line eslint(no-empty-function)
|
|
11
|
+
const noop = () => { };
|
|
12
|
+
const EnvironmentVariablesContext = createContext({
|
|
13
|
+
setShowValues: noop,
|
|
14
|
+
showValues: false,
|
|
15
|
+
});
|
|
16
|
+
export const EnvironmentVariables = ({ showValues: controlledShowValues, defaultShowValues = false, onShowValuesChange, className, children, ...props }) => {
|
|
17
|
+
const [internalShowValues, setInternalShowValues] = useState(defaultShowValues);
|
|
18
|
+
const showValues = controlledShowValues ?? internalShowValues;
|
|
19
|
+
const setShowValues = useCallback((show) => {
|
|
20
|
+
setInternalShowValues(show);
|
|
21
|
+
onShowValuesChange?.(show);
|
|
22
|
+
}, [onShowValuesChange]);
|
|
23
|
+
const contextValue = useMemo(() => ({ setShowValues, showValues }), [setShowValues, showValues]);
|
|
24
|
+
return (_jsx(EnvironmentVariablesContext.Provider, { value: contextValue, children: _jsx("div", { className: cn("rounded-lg border bg-background", className), ...props, children: children }) }));
|
|
25
|
+
};
|
|
26
|
+
export const EnvironmentVariablesHeader = ({ className, children, ...props }) => (_jsx("div", { className: cn("flex items-center justify-between border-b px-4 py-3", className), ...props, children: children }));
|
|
27
|
+
export const EnvironmentVariablesTitle = ({ className, children, ...props }) => (_jsx("h3", { className: cn("font-medium text-sm", className), ...props, children: children ?? "Environment Variables" }));
|
|
28
|
+
export const EnvironmentVariablesToggle = ({ className, ...props }) => {
|
|
29
|
+
const { showValues, setShowValues } = useContext(EnvironmentVariablesContext);
|
|
30
|
+
return (_jsxs("div", { className: cn("flex items-center gap-2", className), children: [_jsx("span", { className: "text-muted-foreground text-xs", children: showValues ? _jsx(EyeIcon, { size: 14 }) : _jsx(EyeOffIcon, { size: 14 }) }), _jsx(Switch, { "aria-label": "Toggle value visibility", checked: showValues, onCheckedChange: setShowValues, ...props })] }));
|
|
31
|
+
};
|
|
32
|
+
export const EnvironmentVariablesContent = ({ className, children, ...props }) => (_jsx("div", { className: cn("divide-y", className), ...props, children: children }));
|
|
33
|
+
const EnvironmentVariableContext = createContext({
|
|
34
|
+
name: "",
|
|
35
|
+
value: "",
|
|
36
|
+
});
|
|
37
|
+
export const EnvironmentVariableGroup = ({ className, children, ...props }) => (_jsx("div", { className: cn("flex items-center gap-2", className), ...props, children: children }));
|
|
38
|
+
export const EnvironmentVariableName = ({ className, children, ...props }) => {
|
|
39
|
+
const { name } = useContext(EnvironmentVariableContext);
|
|
40
|
+
return (_jsx("span", { className: cn("font-mono text-sm", className), ...props, children: children ?? name }));
|
|
41
|
+
};
|
|
42
|
+
export const EnvironmentVariableValue = ({ className, children, ...props }) => {
|
|
43
|
+
const { value } = useContext(EnvironmentVariableContext);
|
|
44
|
+
const { showValues } = useContext(EnvironmentVariablesContext);
|
|
45
|
+
const displayValue = showValues
|
|
46
|
+
? value
|
|
47
|
+
: "•".repeat(Math.min(value.length, 20));
|
|
48
|
+
return (_jsx("span", { className: cn("font-mono text-muted-foreground text-sm", !showValues && "select-none", className), ...props, children: children ?? displayValue }));
|
|
49
|
+
};
|
|
50
|
+
export const EnvironmentVariable = ({ name, value, className, children, ...props }) => {
|
|
51
|
+
const envVarContextValue = useMemo(() => ({ name, value }), [name, value]);
|
|
52
|
+
return (_jsx(EnvironmentVariableContext.Provider, { value: envVarContextValue, children: _jsx("div", { className: cn("flex items-center justify-between gap-4 px-4 py-3", className), ...props, children: children ?? (_jsxs(_Fragment, { children: [_jsx("div", { className: "flex items-center gap-2", children: _jsx(EnvironmentVariableName, {}) }), _jsx(EnvironmentVariableValue, {})] })) }) }));
|
|
53
|
+
};
|
|
54
|
+
export const EnvironmentVariableCopyButton = ({ onCopy, onError, timeout = 2000, copyFormat = "value", children, className, ...props }) => {
|
|
55
|
+
const [isCopied, setIsCopied] = useState(false);
|
|
56
|
+
const timeoutRef = useRef(0);
|
|
57
|
+
const { name, value } = useContext(EnvironmentVariableContext);
|
|
58
|
+
const getTextToCopy = useCallback(() => {
|
|
59
|
+
const formatMap = {
|
|
60
|
+
export: () => `export ${name}="${value}"`,
|
|
61
|
+
name: () => name,
|
|
62
|
+
value: () => value,
|
|
63
|
+
};
|
|
64
|
+
return formatMap[copyFormat]();
|
|
65
|
+
}, [name, value, copyFormat]);
|
|
66
|
+
const copyToClipboard = useCallback(async () => {
|
|
67
|
+
if (typeof window === "undefined" || !navigator?.clipboard?.writeText) {
|
|
68
|
+
onError?.(new Error("Clipboard API not available"));
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
try {
|
|
72
|
+
await navigator.clipboard.writeText(getTextToCopy());
|
|
73
|
+
setIsCopied(true);
|
|
74
|
+
onCopy?.();
|
|
75
|
+
timeoutRef.current = window.setTimeout(() => setIsCopied(false), timeout);
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
onError?.(error);
|
|
79
|
+
}
|
|
80
|
+
}, [getTextToCopy, onCopy, onError, timeout]);
|
|
81
|
+
useEffect(() => () => {
|
|
82
|
+
window.clearTimeout(timeoutRef.current);
|
|
83
|
+
}, []);
|
|
84
|
+
const Icon = isCopied ? CheckIcon : CopyIcon;
|
|
85
|
+
return (_jsx(Button, { className: cn("size-6 shrink-0", className), onClick: copyToClipboard, size: "icon", variant: "ghost", ...props, children: children ?? _jsx(Icon, { size: 12 }) }));
|
|
86
|
+
};
|
|
87
|
+
export const EnvironmentVariableRequired = ({ className, children, ...props }) => (_jsx(Badge, { className: cn("text-xs", className), variant: "secondary", ...props, children: children ?? "Required" }));
|