@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,275 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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 _reactusecontrollablestate = require('@radix-ui/react-use-controllable-state');
|
|
4
|
+
var _button = require('../ui/button');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _command = require('../ui/command');
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
var _popover = require('../ui/popover');
|
|
17
|
+
var _utils = require('../../lib/utils');
|
|
18
|
+
var _lucidereact = require('lucide-react');
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
var _react = require('react');
|
|
28
|
+
const deviceIdRegex = /\(([\da-fA-F]{4}:[\da-fA-F]{4})\)$/;
|
|
29
|
+
const MicSelectorContext = _react.createContext.call(void 0, {
|
|
30
|
+
data: [],
|
|
31
|
+
onOpenChange: void 0,
|
|
32
|
+
onValueChange: void 0,
|
|
33
|
+
open: false,
|
|
34
|
+
setWidth: void 0,
|
|
35
|
+
value: void 0,
|
|
36
|
+
width: 200
|
|
37
|
+
});
|
|
38
|
+
const MicSelector = ({
|
|
39
|
+
defaultValue,
|
|
40
|
+
value: controlledValue,
|
|
41
|
+
onValueChange: controlledOnValueChange,
|
|
42
|
+
defaultOpen = false,
|
|
43
|
+
open: controlledOpen,
|
|
44
|
+
onOpenChange: controlledOnOpenChange,
|
|
45
|
+
...props
|
|
46
|
+
}) => {
|
|
47
|
+
const [value, onValueChange] = _reactusecontrollablestate.useControllableState.call(void 0, {
|
|
48
|
+
defaultProp: defaultValue,
|
|
49
|
+
onChange: controlledOnValueChange,
|
|
50
|
+
prop: controlledValue
|
|
51
|
+
});
|
|
52
|
+
const [open, onOpenChange] = _reactusecontrollablestate.useControllableState.call(void 0, {
|
|
53
|
+
defaultProp: defaultOpen,
|
|
54
|
+
onChange: controlledOnOpenChange,
|
|
55
|
+
prop: controlledOpen
|
|
56
|
+
});
|
|
57
|
+
const [width, setWidth] = _react.useState.call(void 0, 200);
|
|
58
|
+
const { devices, loading, hasPermission, loadDevices } = useAudioDevices();
|
|
59
|
+
_react.useEffect.call(void 0, () => {
|
|
60
|
+
if (open && !hasPermission && !loading) {
|
|
61
|
+
loadDevices();
|
|
62
|
+
}
|
|
63
|
+
}, [open, hasPermission, loading, loadDevices]);
|
|
64
|
+
const contextValue = _react.useMemo.call(void 0,
|
|
65
|
+
() => ({
|
|
66
|
+
data: devices,
|
|
67
|
+
onOpenChange,
|
|
68
|
+
onValueChange,
|
|
69
|
+
open,
|
|
70
|
+
setWidth,
|
|
71
|
+
value,
|
|
72
|
+
width
|
|
73
|
+
}),
|
|
74
|
+
[devices, onOpenChange, onValueChange, open, setWidth, value, width]
|
|
75
|
+
);
|
|
76
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, MicSelectorContext.Provider, { value: contextValue, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _popover.Popover, { ...props, onOpenChange, open }) });
|
|
77
|
+
};
|
|
78
|
+
const MicSelectorTrigger = ({
|
|
79
|
+
children,
|
|
80
|
+
...props
|
|
81
|
+
}) => {
|
|
82
|
+
const { setWidth } = _react.use.call(void 0, MicSelectorContext);
|
|
83
|
+
const ref = _react.useRef.call(void 0, null);
|
|
84
|
+
_react.useEffect.call(void 0, () => {
|
|
85
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
86
|
+
for (const entry of entries) {
|
|
87
|
+
const newWidth = entry.target.offsetWidth;
|
|
88
|
+
if (newWidth) {
|
|
89
|
+
_optionalChain([setWidth, 'optionalCall', _ => _(newWidth)]);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
if (ref.current) {
|
|
94
|
+
resizeObserver.observe(ref.current);
|
|
95
|
+
}
|
|
96
|
+
return () => {
|
|
97
|
+
resizeObserver.disconnect();
|
|
98
|
+
};
|
|
99
|
+
}, [setWidth]);
|
|
100
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _popover.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _button.Button, { variant: "outline", ...props, ref, children: [
|
|
101
|
+
children,
|
|
102
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
103
|
+
_lucidereact.ChevronsUpDownIcon,
|
|
104
|
+
{
|
|
105
|
+
className: "shrink-0 text-muted-foreground",
|
|
106
|
+
size: 16
|
|
107
|
+
}
|
|
108
|
+
)
|
|
109
|
+
] }) });
|
|
110
|
+
};
|
|
111
|
+
const MicSelectorContent = ({
|
|
112
|
+
className,
|
|
113
|
+
popoverOptions,
|
|
114
|
+
...props
|
|
115
|
+
}) => {
|
|
116
|
+
const { width, onValueChange, value } = _react.use.call(void 0, MicSelectorContext);
|
|
117
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
118
|
+
_popover.PopoverContent,
|
|
119
|
+
{
|
|
120
|
+
className: _utils.cn.call(void 0, "p-0", className),
|
|
121
|
+
style: { width },
|
|
122
|
+
...popoverOptions,
|
|
123
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _command.Command, { onValueChange, value, ...props })
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
};
|
|
127
|
+
const MicSelectorInput = ({ ...props }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _command.CommandInput, { placeholder: "Search microphones\u2026", ...props });
|
|
128
|
+
const MicSelectorList = ({
|
|
129
|
+
children,
|
|
130
|
+
...props
|
|
131
|
+
}) => {
|
|
132
|
+
const { data } = _react.use.call(void 0, MicSelectorContext);
|
|
133
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _command.CommandList, { ...props, children: children(data) });
|
|
134
|
+
};
|
|
135
|
+
const MicSelectorEmpty = ({
|
|
136
|
+
children = "No microphone found.",
|
|
137
|
+
...props
|
|
138
|
+
}) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _command.CommandEmpty, { ...props, children });
|
|
139
|
+
const MicSelectorItem = (props) => {
|
|
140
|
+
const { onValueChange, onOpenChange } = _react.use.call(void 0, MicSelectorContext);
|
|
141
|
+
const handleSelect = _react.useCallback.call(void 0,
|
|
142
|
+
(currentValue) => {
|
|
143
|
+
_optionalChain([onValueChange, 'optionalCall', _2 => _2(currentValue)]);
|
|
144
|
+
_optionalChain([onOpenChange, 'optionalCall', _3 => _3(false)]);
|
|
145
|
+
},
|
|
146
|
+
[onValueChange, onOpenChange]
|
|
147
|
+
);
|
|
148
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _command.CommandItem, { onSelect: handleSelect, ...props });
|
|
149
|
+
};
|
|
150
|
+
const MicSelectorLabel = ({
|
|
151
|
+
device,
|
|
152
|
+
className,
|
|
153
|
+
...props
|
|
154
|
+
}) => {
|
|
155
|
+
const matches = device.label.match(deviceIdRegex);
|
|
156
|
+
if (!matches) {
|
|
157
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className, ...props, children: device.label });
|
|
158
|
+
}
|
|
159
|
+
const [, deviceId] = matches;
|
|
160
|
+
const name = device.label.replace(deviceIdRegex, "");
|
|
161
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className, ...props, children: [
|
|
162
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: name }),
|
|
163
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-muted-foreground", children: [
|
|
164
|
+
" (",
|
|
165
|
+
deviceId,
|
|
166
|
+
")"
|
|
167
|
+
] })
|
|
168
|
+
] });
|
|
169
|
+
};
|
|
170
|
+
const MicSelectorValue = ({
|
|
171
|
+
className,
|
|
172
|
+
...props
|
|
173
|
+
}) => {
|
|
174
|
+
const { data, value } = _react.use.call(void 0, MicSelectorContext);
|
|
175
|
+
const currentDevice = data.find((d) => d.deviceId === value);
|
|
176
|
+
if (!currentDevice) {
|
|
177
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: _utils.cn.call(void 0, "flex-1 text-left", className), ...props, children: "Select microphone\u2026" });
|
|
178
|
+
}
|
|
179
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
180
|
+
MicSelectorLabel,
|
|
181
|
+
{
|
|
182
|
+
className: _utils.cn.call(void 0, "flex-1 text-left", className),
|
|
183
|
+
device: currentDevice,
|
|
184
|
+
...props
|
|
185
|
+
}
|
|
186
|
+
);
|
|
187
|
+
};
|
|
188
|
+
const useAudioDevices = () => {
|
|
189
|
+
const [devices, setDevices] = _react.useState.call(void 0, []);
|
|
190
|
+
const [loading, setLoading] = _react.useState.call(void 0, true);
|
|
191
|
+
const [error, setError] = _react.useState.call(void 0, null);
|
|
192
|
+
const [hasPermission, setHasPermission] = _react.useState.call(void 0, false);
|
|
193
|
+
const loadDevicesWithoutPermission = _react.useCallback.call(void 0, async () => {
|
|
194
|
+
try {
|
|
195
|
+
setLoading(true);
|
|
196
|
+
setError(null);
|
|
197
|
+
const deviceList = await navigator.mediaDevices.enumerateDevices();
|
|
198
|
+
const audioInputs = deviceList.filter(
|
|
199
|
+
(device) => device.kind === "audioinput"
|
|
200
|
+
);
|
|
201
|
+
setDevices(audioInputs);
|
|
202
|
+
} catch (error2) {
|
|
203
|
+
const message = error2 instanceof Error ? error2.message : "Failed to get audio devices";
|
|
204
|
+
setError(message);
|
|
205
|
+
console.error("Error getting audio devices:", message);
|
|
206
|
+
} finally {
|
|
207
|
+
setLoading(false);
|
|
208
|
+
}
|
|
209
|
+
}, []);
|
|
210
|
+
const loadDevicesWithPermission = _react.useCallback.call(void 0, async () => {
|
|
211
|
+
if (loading) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
try {
|
|
215
|
+
setLoading(true);
|
|
216
|
+
setError(null);
|
|
217
|
+
const tempStream = await navigator.mediaDevices.getUserMedia({
|
|
218
|
+
audio: true
|
|
219
|
+
});
|
|
220
|
+
for (const track of tempStream.getTracks()) {
|
|
221
|
+
track.stop();
|
|
222
|
+
}
|
|
223
|
+
const deviceList = await navigator.mediaDevices.enumerateDevices();
|
|
224
|
+
const audioInputs = deviceList.filter(
|
|
225
|
+
(device) => device.kind === "audioinput"
|
|
226
|
+
);
|
|
227
|
+
setDevices(audioInputs);
|
|
228
|
+
setHasPermission(true);
|
|
229
|
+
} catch (error2) {
|
|
230
|
+
const message = error2 instanceof Error ? error2.message : "Failed to get audio devices";
|
|
231
|
+
setError(message);
|
|
232
|
+
console.error("Error getting audio devices:", message);
|
|
233
|
+
} finally {
|
|
234
|
+
setLoading(false);
|
|
235
|
+
}
|
|
236
|
+
}, [loading]);
|
|
237
|
+
_react.useEffect.call(void 0, () => {
|
|
238
|
+
loadDevicesWithoutPermission();
|
|
239
|
+
}, [loadDevicesWithoutPermission]);
|
|
240
|
+
_react.useEffect.call(void 0, () => {
|
|
241
|
+
const handleDeviceChange = () => {
|
|
242
|
+
if (hasPermission) {
|
|
243
|
+
loadDevicesWithPermission();
|
|
244
|
+
} else {
|
|
245
|
+
loadDevicesWithoutPermission();
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
navigator.mediaDevices.addEventListener("devicechange", handleDeviceChange);
|
|
249
|
+
return () => {
|
|
250
|
+
navigator.mediaDevices.removeEventListener(
|
|
251
|
+
"devicechange",
|
|
252
|
+
handleDeviceChange
|
|
253
|
+
);
|
|
254
|
+
};
|
|
255
|
+
}, [hasPermission, loadDevicesWithPermission, loadDevicesWithoutPermission]);
|
|
256
|
+
return {
|
|
257
|
+
devices,
|
|
258
|
+
error,
|
|
259
|
+
hasPermission,
|
|
260
|
+
loadDevices: loadDevicesWithPermission,
|
|
261
|
+
loading
|
|
262
|
+
};
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
exports.MicSelector = MicSelector; exports.MicSelectorContent = MicSelectorContent; exports.MicSelectorEmpty = MicSelectorEmpty; exports.MicSelectorInput = MicSelectorInput; exports.MicSelectorItem = MicSelectorItem; exports.MicSelectorLabel = MicSelectorLabel; exports.MicSelectorList = MicSelectorList; exports.MicSelectorTrigger = MicSelectorTrigger; exports.MicSelectorValue = MicSelectorValue; exports.useAudioDevices = useAudioDevices;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
3
|
+
import { Button } from '../ui/button.cjs';
|
|
4
|
+
import { Command, CommandEmpty, CommandInput, CommandItem, CommandList } from '../ui/command.cjs';
|
|
5
|
+
import { Popover, PopoverContent } from '../ui/popover.cjs';
|
|
6
|
+
import 'class-variance-authority/types';
|
|
7
|
+
import 'class-variance-authority';
|
|
8
|
+
import 'cmdk';
|
|
9
|
+
import '../ui/dialog.cjs';
|
|
10
|
+
import 'radix-ui';
|
|
11
|
+
|
|
12
|
+
type MicSelectorProps = ComponentProps<typeof Popover> & {
|
|
13
|
+
defaultValue?: string;
|
|
14
|
+
value?: string | undefined;
|
|
15
|
+
onValueChange?: (value: string | undefined) => void;
|
|
16
|
+
open?: boolean;
|
|
17
|
+
onOpenChange?: (open: boolean) => void;
|
|
18
|
+
};
|
|
19
|
+
declare const MicSelector: ({ defaultValue, value: controlledValue, onValueChange: controlledOnValueChange, defaultOpen, open: controlledOpen, onOpenChange: controlledOnOpenChange, ...props }: MicSelectorProps) => react_jsx_runtime.JSX.Element;
|
|
20
|
+
type MicSelectorTriggerProps = ComponentProps<typeof Button>;
|
|
21
|
+
declare const MicSelectorTrigger: ({ children, ...props }: MicSelectorTriggerProps) => react_jsx_runtime.JSX.Element;
|
|
22
|
+
type MicSelectorContentProps = ComponentProps<typeof Command> & {
|
|
23
|
+
popoverOptions?: ComponentProps<typeof PopoverContent>;
|
|
24
|
+
};
|
|
25
|
+
declare const MicSelectorContent: ({ className, popoverOptions, ...props }: MicSelectorContentProps) => react_jsx_runtime.JSX.Element;
|
|
26
|
+
type MicSelectorInputProps = ComponentProps<typeof CommandInput> & {
|
|
27
|
+
value?: string;
|
|
28
|
+
defaultValue?: string;
|
|
29
|
+
onValueChange?: (value: string) => void;
|
|
30
|
+
};
|
|
31
|
+
declare const MicSelectorInput: ({ ...props }: MicSelectorInputProps) => react_jsx_runtime.JSX.Element;
|
|
32
|
+
type MicSelectorListProps = Omit<ComponentProps<typeof CommandList>, "children"> & {
|
|
33
|
+
children: (devices: MediaDeviceInfo[]) => ReactNode;
|
|
34
|
+
};
|
|
35
|
+
declare const MicSelectorList: ({ children, ...props }: MicSelectorListProps) => react_jsx_runtime.JSX.Element;
|
|
36
|
+
type MicSelectorEmptyProps = ComponentProps<typeof CommandEmpty>;
|
|
37
|
+
declare const MicSelectorEmpty: ({ children, ...props }: MicSelectorEmptyProps) => react_jsx_runtime.JSX.Element;
|
|
38
|
+
type MicSelectorItemProps = ComponentProps<typeof CommandItem>;
|
|
39
|
+
declare const MicSelectorItem: (props: MicSelectorItemProps) => react_jsx_runtime.JSX.Element;
|
|
40
|
+
type MicSelectorLabelProps = ComponentProps<"span"> & {
|
|
41
|
+
device: MediaDeviceInfo;
|
|
42
|
+
};
|
|
43
|
+
declare const MicSelectorLabel: ({ device, className, ...props }: MicSelectorLabelProps) => react_jsx_runtime.JSX.Element;
|
|
44
|
+
type MicSelectorValueProps = ComponentProps<"span">;
|
|
45
|
+
declare const MicSelectorValue: ({ className, ...props }: MicSelectorValueProps) => react_jsx_runtime.JSX.Element;
|
|
46
|
+
declare const useAudioDevices: () => {
|
|
47
|
+
devices: MediaDeviceInfo[];
|
|
48
|
+
error: string | null;
|
|
49
|
+
hasPermission: boolean;
|
|
50
|
+
loadDevices: () => Promise<void>;
|
|
51
|
+
loading: boolean;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export { MicSelector, MicSelectorContent, type MicSelectorContentProps, MicSelectorEmpty, type MicSelectorEmptyProps, MicSelectorInput, type MicSelectorInputProps, MicSelectorItem, type MicSelectorItemProps, MicSelectorLabel, type MicSelectorLabelProps, MicSelectorList, type MicSelectorListProps, type MicSelectorProps, MicSelectorTrigger, type MicSelectorTriggerProps, MicSelectorValue, type MicSelectorValueProps, useAudioDevices };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
3
|
+
import { Button } from '../ui/button.js';
|
|
4
|
+
import { Command, CommandEmpty, CommandInput, CommandItem, CommandList } from '../ui/command.js';
|
|
5
|
+
import { Popover, PopoverContent } from '../ui/popover.js';
|
|
6
|
+
import 'class-variance-authority/types';
|
|
7
|
+
import 'class-variance-authority';
|
|
8
|
+
import 'cmdk';
|
|
9
|
+
import '../ui/dialog.js';
|
|
10
|
+
import 'radix-ui';
|
|
11
|
+
|
|
12
|
+
type MicSelectorProps = ComponentProps<typeof Popover> & {
|
|
13
|
+
defaultValue?: string;
|
|
14
|
+
value?: string | undefined;
|
|
15
|
+
onValueChange?: (value: string | undefined) => void;
|
|
16
|
+
open?: boolean;
|
|
17
|
+
onOpenChange?: (open: boolean) => void;
|
|
18
|
+
};
|
|
19
|
+
declare const MicSelector: ({ defaultValue, value: controlledValue, onValueChange: controlledOnValueChange, defaultOpen, open: controlledOpen, onOpenChange: controlledOnOpenChange, ...props }: MicSelectorProps) => react_jsx_runtime.JSX.Element;
|
|
20
|
+
type MicSelectorTriggerProps = ComponentProps<typeof Button>;
|
|
21
|
+
declare const MicSelectorTrigger: ({ children, ...props }: MicSelectorTriggerProps) => react_jsx_runtime.JSX.Element;
|
|
22
|
+
type MicSelectorContentProps = ComponentProps<typeof Command> & {
|
|
23
|
+
popoverOptions?: ComponentProps<typeof PopoverContent>;
|
|
24
|
+
};
|
|
25
|
+
declare const MicSelectorContent: ({ className, popoverOptions, ...props }: MicSelectorContentProps) => react_jsx_runtime.JSX.Element;
|
|
26
|
+
type MicSelectorInputProps = ComponentProps<typeof CommandInput> & {
|
|
27
|
+
value?: string;
|
|
28
|
+
defaultValue?: string;
|
|
29
|
+
onValueChange?: (value: string) => void;
|
|
30
|
+
};
|
|
31
|
+
declare const MicSelectorInput: ({ ...props }: MicSelectorInputProps) => react_jsx_runtime.JSX.Element;
|
|
32
|
+
type MicSelectorListProps = Omit<ComponentProps<typeof CommandList>, "children"> & {
|
|
33
|
+
children: (devices: MediaDeviceInfo[]) => ReactNode;
|
|
34
|
+
};
|
|
35
|
+
declare const MicSelectorList: ({ children, ...props }: MicSelectorListProps) => react_jsx_runtime.JSX.Element;
|
|
36
|
+
type MicSelectorEmptyProps = ComponentProps<typeof CommandEmpty>;
|
|
37
|
+
declare const MicSelectorEmpty: ({ children, ...props }: MicSelectorEmptyProps) => react_jsx_runtime.JSX.Element;
|
|
38
|
+
type MicSelectorItemProps = ComponentProps<typeof CommandItem>;
|
|
39
|
+
declare const MicSelectorItem: (props: MicSelectorItemProps) => react_jsx_runtime.JSX.Element;
|
|
40
|
+
type MicSelectorLabelProps = ComponentProps<"span"> & {
|
|
41
|
+
device: MediaDeviceInfo;
|
|
42
|
+
};
|
|
43
|
+
declare const MicSelectorLabel: ({ device, className, ...props }: MicSelectorLabelProps) => react_jsx_runtime.JSX.Element;
|
|
44
|
+
type MicSelectorValueProps = ComponentProps<"span">;
|
|
45
|
+
declare const MicSelectorValue: ({ className, ...props }: MicSelectorValueProps) => react_jsx_runtime.JSX.Element;
|
|
46
|
+
declare const useAudioDevices: () => {
|
|
47
|
+
devices: MediaDeviceInfo[];
|
|
48
|
+
error: string | null;
|
|
49
|
+
hasPermission: boolean;
|
|
50
|
+
loadDevices: () => Promise<void>;
|
|
51
|
+
loading: boolean;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export { MicSelector, MicSelectorContent, type MicSelectorContentProps, MicSelectorEmpty, type MicSelectorEmptyProps, MicSelectorInput, type MicSelectorInputProps, MicSelectorItem, type MicSelectorItemProps, MicSelectorLabel, type MicSelectorLabelProps, MicSelectorList, type MicSelectorListProps, type MicSelectorProps, MicSelectorTrigger, type MicSelectorTriggerProps, MicSelectorValue, type MicSelectorValueProps, useAudioDevices };
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
4
|
+
import { Button } from "../ui/button";
|
|
5
|
+
import {
|
|
6
|
+
Command,
|
|
7
|
+
CommandEmpty,
|
|
8
|
+
CommandInput,
|
|
9
|
+
CommandItem,
|
|
10
|
+
CommandList
|
|
11
|
+
} from "../ui/command";
|
|
12
|
+
import {
|
|
13
|
+
Popover,
|
|
14
|
+
PopoverContent,
|
|
15
|
+
PopoverTrigger
|
|
16
|
+
} from "../ui/popover";
|
|
17
|
+
import { cn } from "../../lib/utils";
|
|
18
|
+
import { ChevronsUpDownIcon } from "lucide-react";
|
|
19
|
+
import {
|
|
20
|
+
createContext,
|
|
21
|
+
useCallback,
|
|
22
|
+
use,
|
|
23
|
+
useEffect,
|
|
24
|
+
useMemo,
|
|
25
|
+
useRef,
|
|
26
|
+
useState
|
|
27
|
+
} from "react";
|
|
28
|
+
const deviceIdRegex = /\(([\da-fA-F]{4}:[\da-fA-F]{4})\)$/;
|
|
29
|
+
const MicSelectorContext = createContext({
|
|
30
|
+
data: [],
|
|
31
|
+
onOpenChange: void 0,
|
|
32
|
+
onValueChange: void 0,
|
|
33
|
+
open: false,
|
|
34
|
+
setWidth: void 0,
|
|
35
|
+
value: void 0,
|
|
36
|
+
width: 200
|
|
37
|
+
});
|
|
38
|
+
const MicSelector = ({
|
|
39
|
+
defaultValue,
|
|
40
|
+
value: controlledValue,
|
|
41
|
+
onValueChange: controlledOnValueChange,
|
|
42
|
+
defaultOpen = false,
|
|
43
|
+
open: controlledOpen,
|
|
44
|
+
onOpenChange: controlledOnOpenChange,
|
|
45
|
+
...props
|
|
46
|
+
}) => {
|
|
47
|
+
const [value, onValueChange] = useControllableState({
|
|
48
|
+
defaultProp: defaultValue,
|
|
49
|
+
onChange: controlledOnValueChange,
|
|
50
|
+
prop: controlledValue
|
|
51
|
+
});
|
|
52
|
+
const [open, onOpenChange] = useControllableState({
|
|
53
|
+
defaultProp: defaultOpen,
|
|
54
|
+
onChange: controlledOnOpenChange,
|
|
55
|
+
prop: controlledOpen
|
|
56
|
+
});
|
|
57
|
+
const [width, setWidth] = useState(200);
|
|
58
|
+
const { devices, loading, hasPermission, loadDevices } = useAudioDevices();
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (open && !hasPermission && !loading) {
|
|
61
|
+
loadDevices();
|
|
62
|
+
}
|
|
63
|
+
}, [open, hasPermission, loading, loadDevices]);
|
|
64
|
+
const contextValue = useMemo(
|
|
65
|
+
() => ({
|
|
66
|
+
data: devices,
|
|
67
|
+
onOpenChange,
|
|
68
|
+
onValueChange,
|
|
69
|
+
open,
|
|
70
|
+
setWidth,
|
|
71
|
+
value,
|
|
72
|
+
width
|
|
73
|
+
}),
|
|
74
|
+
[devices, onOpenChange, onValueChange, open, setWidth, value, width]
|
|
75
|
+
);
|
|
76
|
+
return /* @__PURE__ */ jsx(MicSelectorContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(Popover, { ...props, onOpenChange, open }) });
|
|
77
|
+
};
|
|
78
|
+
const MicSelectorTrigger = ({
|
|
79
|
+
children,
|
|
80
|
+
...props
|
|
81
|
+
}) => {
|
|
82
|
+
const { setWidth } = use(MicSelectorContext);
|
|
83
|
+
const ref = useRef(null);
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
86
|
+
for (const entry of entries) {
|
|
87
|
+
const newWidth = entry.target.offsetWidth;
|
|
88
|
+
if (newWidth) {
|
|
89
|
+
setWidth?.(newWidth);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
if (ref.current) {
|
|
94
|
+
resizeObserver.observe(ref.current);
|
|
95
|
+
}
|
|
96
|
+
return () => {
|
|
97
|
+
resizeObserver.disconnect();
|
|
98
|
+
};
|
|
99
|
+
}, [setWidth]);
|
|
100
|
+
return /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { variant: "outline", ...props, ref, children: [
|
|
101
|
+
children,
|
|
102
|
+
/* @__PURE__ */ jsx(
|
|
103
|
+
ChevronsUpDownIcon,
|
|
104
|
+
{
|
|
105
|
+
className: "shrink-0 text-muted-foreground",
|
|
106
|
+
size: 16
|
|
107
|
+
}
|
|
108
|
+
)
|
|
109
|
+
] }) });
|
|
110
|
+
};
|
|
111
|
+
const MicSelectorContent = ({
|
|
112
|
+
className,
|
|
113
|
+
popoverOptions,
|
|
114
|
+
...props
|
|
115
|
+
}) => {
|
|
116
|
+
const { width, onValueChange, value } = use(MicSelectorContext);
|
|
117
|
+
return /* @__PURE__ */ jsx(
|
|
118
|
+
PopoverContent,
|
|
119
|
+
{
|
|
120
|
+
className: cn("p-0", className),
|
|
121
|
+
style: { width },
|
|
122
|
+
...popoverOptions,
|
|
123
|
+
children: /* @__PURE__ */ jsx(Command, { onValueChange, value, ...props })
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
};
|
|
127
|
+
const MicSelectorInput = ({ ...props }) => /* @__PURE__ */ jsx(CommandInput, { placeholder: "Search microphones\u2026", ...props });
|
|
128
|
+
const MicSelectorList = ({
|
|
129
|
+
children,
|
|
130
|
+
...props
|
|
131
|
+
}) => {
|
|
132
|
+
const { data } = use(MicSelectorContext);
|
|
133
|
+
return /* @__PURE__ */ jsx(CommandList, { ...props, children: children(data) });
|
|
134
|
+
};
|
|
135
|
+
const MicSelectorEmpty = ({
|
|
136
|
+
children = "No microphone found.",
|
|
137
|
+
...props
|
|
138
|
+
}) => /* @__PURE__ */ jsx(CommandEmpty, { ...props, children });
|
|
139
|
+
const MicSelectorItem = (props) => {
|
|
140
|
+
const { onValueChange, onOpenChange } = use(MicSelectorContext);
|
|
141
|
+
const handleSelect = useCallback(
|
|
142
|
+
(currentValue) => {
|
|
143
|
+
onValueChange?.(currentValue);
|
|
144
|
+
onOpenChange?.(false);
|
|
145
|
+
},
|
|
146
|
+
[onValueChange, onOpenChange]
|
|
147
|
+
);
|
|
148
|
+
return /* @__PURE__ */ jsx(CommandItem, { onSelect: handleSelect, ...props });
|
|
149
|
+
};
|
|
150
|
+
const MicSelectorLabel = ({
|
|
151
|
+
device,
|
|
152
|
+
className,
|
|
153
|
+
...props
|
|
154
|
+
}) => {
|
|
155
|
+
const matches = device.label.match(deviceIdRegex);
|
|
156
|
+
if (!matches) {
|
|
157
|
+
return /* @__PURE__ */ jsx("span", { className, ...props, children: device.label });
|
|
158
|
+
}
|
|
159
|
+
const [, deviceId] = matches;
|
|
160
|
+
const name = device.label.replace(deviceIdRegex, "");
|
|
161
|
+
return /* @__PURE__ */ jsxs("span", { className, ...props, children: [
|
|
162
|
+
/* @__PURE__ */ jsx("span", { children: name }),
|
|
163
|
+
/* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
|
|
164
|
+
" (",
|
|
165
|
+
deviceId,
|
|
166
|
+
")"
|
|
167
|
+
] })
|
|
168
|
+
] });
|
|
169
|
+
};
|
|
170
|
+
const MicSelectorValue = ({
|
|
171
|
+
className,
|
|
172
|
+
...props
|
|
173
|
+
}) => {
|
|
174
|
+
const { data, value } = use(MicSelectorContext);
|
|
175
|
+
const currentDevice = data.find((d) => d.deviceId === value);
|
|
176
|
+
if (!currentDevice) {
|
|
177
|
+
return /* @__PURE__ */ jsx("span", { className: cn("flex-1 text-left", className), ...props, children: "Select microphone\u2026" });
|
|
178
|
+
}
|
|
179
|
+
return /* @__PURE__ */ jsx(
|
|
180
|
+
MicSelectorLabel,
|
|
181
|
+
{
|
|
182
|
+
className: cn("flex-1 text-left", className),
|
|
183
|
+
device: currentDevice,
|
|
184
|
+
...props
|
|
185
|
+
}
|
|
186
|
+
);
|
|
187
|
+
};
|
|
188
|
+
const useAudioDevices = () => {
|
|
189
|
+
const [devices, setDevices] = useState([]);
|
|
190
|
+
const [loading, setLoading] = useState(true);
|
|
191
|
+
const [error, setError] = useState(null);
|
|
192
|
+
const [hasPermission, setHasPermission] = useState(false);
|
|
193
|
+
const loadDevicesWithoutPermission = useCallback(async () => {
|
|
194
|
+
try {
|
|
195
|
+
setLoading(true);
|
|
196
|
+
setError(null);
|
|
197
|
+
const deviceList = await navigator.mediaDevices.enumerateDevices();
|
|
198
|
+
const audioInputs = deviceList.filter(
|
|
199
|
+
(device) => device.kind === "audioinput"
|
|
200
|
+
);
|
|
201
|
+
setDevices(audioInputs);
|
|
202
|
+
} catch (error2) {
|
|
203
|
+
const message = error2 instanceof Error ? error2.message : "Failed to get audio devices";
|
|
204
|
+
setError(message);
|
|
205
|
+
console.error("Error getting audio devices:", message);
|
|
206
|
+
} finally {
|
|
207
|
+
setLoading(false);
|
|
208
|
+
}
|
|
209
|
+
}, []);
|
|
210
|
+
const loadDevicesWithPermission = useCallback(async () => {
|
|
211
|
+
if (loading) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
try {
|
|
215
|
+
setLoading(true);
|
|
216
|
+
setError(null);
|
|
217
|
+
const tempStream = await navigator.mediaDevices.getUserMedia({
|
|
218
|
+
audio: true
|
|
219
|
+
});
|
|
220
|
+
for (const track of tempStream.getTracks()) {
|
|
221
|
+
track.stop();
|
|
222
|
+
}
|
|
223
|
+
const deviceList = await navigator.mediaDevices.enumerateDevices();
|
|
224
|
+
const audioInputs = deviceList.filter(
|
|
225
|
+
(device) => device.kind === "audioinput"
|
|
226
|
+
);
|
|
227
|
+
setDevices(audioInputs);
|
|
228
|
+
setHasPermission(true);
|
|
229
|
+
} catch (error2) {
|
|
230
|
+
const message = error2 instanceof Error ? error2.message : "Failed to get audio devices";
|
|
231
|
+
setError(message);
|
|
232
|
+
console.error("Error getting audio devices:", message);
|
|
233
|
+
} finally {
|
|
234
|
+
setLoading(false);
|
|
235
|
+
}
|
|
236
|
+
}, [loading]);
|
|
237
|
+
useEffect(() => {
|
|
238
|
+
loadDevicesWithoutPermission();
|
|
239
|
+
}, [loadDevicesWithoutPermission]);
|
|
240
|
+
useEffect(() => {
|
|
241
|
+
const handleDeviceChange = () => {
|
|
242
|
+
if (hasPermission) {
|
|
243
|
+
loadDevicesWithPermission();
|
|
244
|
+
} else {
|
|
245
|
+
loadDevicesWithoutPermission();
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
navigator.mediaDevices.addEventListener("devicechange", handleDeviceChange);
|
|
249
|
+
return () => {
|
|
250
|
+
navigator.mediaDevices.removeEventListener(
|
|
251
|
+
"devicechange",
|
|
252
|
+
handleDeviceChange
|
|
253
|
+
);
|
|
254
|
+
};
|
|
255
|
+
}, [hasPermission, loadDevicesWithPermission, loadDevicesWithoutPermission]);
|
|
256
|
+
return {
|
|
257
|
+
devices,
|
|
258
|
+
error,
|
|
259
|
+
hasPermission,
|
|
260
|
+
loadDevices: loadDevicesWithPermission,
|
|
261
|
+
loading
|
|
262
|
+
};
|
|
263
|
+
};
|
|
264
|
+
export {
|
|
265
|
+
MicSelector,
|
|
266
|
+
MicSelectorContent,
|
|
267
|
+
MicSelectorEmpty,
|
|
268
|
+
MicSelectorInput,
|
|
269
|
+
MicSelectorItem,
|
|
270
|
+
MicSelectorLabel,
|
|
271
|
+
MicSelectorList,
|
|
272
|
+
MicSelectorTrigger,
|
|
273
|
+
MicSelectorValue,
|
|
274
|
+
useAudioDevices
|
|
275
|
+
};
|