@ctrl-ui/react 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -0
- package/dist/action-bar.d.ts +44 -0
- package/dist/action-bar.js +89 -0
- package/dist/activity.d.ts +53 -0
- package/dist/activity.js +188 -0
- package/dist/audio-recorder.d.ts +32 -0
- package/dist/audio-recorder.js +235 -0
- package/dist/audio-visualizer.d.ts +12 -0
- package/dist/audio-visualizer.js +58 -0
- package/dist/blocks/chat.d.ts +10 -0
- package/dist/blocks/chat.js +12 -0
- package/dist/blocks/coding-agent.d.ts +61 -0
- package/dist/blocks/coding-agent.js +255 -0
- package/dist/blocks/file-explorer-data.d.ts +57 -0
- package/dist/blocks/file-explorer-data.js +74 -0
- package/dist/blocks/file-explorer.d.ts +24 -0
- package/dist/blocks/file-explorer.js +427 -0
- package/dist/blocks/settings-data.d.ts +36 -0
- package/dist/blocks/settings-data.js +66 -0
- package/dist/blocks/settings.d.ts +19 -0
- package/dist/blocks/settings.js +282 -0
- package/dist/blocks/theme-toggle.d.ts +43 -0
- package/dist/blocks/theme-toggle.js +180 -0
- package/dist/chat-composer-attachment.d.ts +55 -0
- package/dist/chat-composer-attachment.js +267 -0
- package/dist/chat-composer-editor/extensions/mention.d.ts +14 -0
- package/dist/chat-composer-editor/extensions/mention.js +278 -0
- package/dist/chat-composer-editor/ghost.d.ts +5 -0
- package/dist/chat-composer-editor/ghost.js +55 -0
- package/dist/chat-composer-editor/schema.d.ts +6 -0
- package/dist/chat-composer-editor/schema.js +25 -0
- package/dist/chat-composer-editor/serialize.d.ts +6 -0
- package/dist/chat-composer-editor/serialize.js +16 -0
- package/dist/chat-composer-editor/types.d.ts +29 -0
- package/dist/chat-composer-editor/types.js +0 -0
- package/dist/chat-composer-editor.d.ts +9 -0
- package/dist/chat-composer-editor.js +154 -0
- package/dist/chat-composer.d.ts +60 -0
- package/dist/chat-composer.js +134 -0
- package/dist/chat-layout.d.ts +27 -0
- package/dist/chat-layout.js +114 -0
- package/dist/chat-message.d.ts +31 -0
- package/dist/chat-message.js +95 -0
- package/dist/code-block-editor.d.ts +59 -0
- package/dist/code-block-editor.js +250 -0
- package/dist/context-model.d.ts +33 -0
- package/dist/context-model.js +52 -0
- package/dist/context.d.ts +47 -0
- package/dist/context.js +335 -0
- package/dist/control-props.d.ts +28 -0
- package/dist/control-props.js +4 -0
- package/dist/control-variants.d.ts +8 -0
- package/dist/control-variants.js +14 -0
- package/dist/dynamic-notification-glass.d.ts +10 -0
- package/dist/dynamic-notification-glass.js +311 -0
- package/dist/dynamic-notification-liquid.d.ts +24 -0
- package/dist/dynamic-notification-liquid.js +682 -0
- package/dist/dynamic-notification-siri-wave.d.ts +4 -0
- package/dist/dynamic-notification-siri-wave.js +82 -0
- package/dist/dynamic-notification.d.ts +74 -0
- package/dist/dynamic-notification.js +342 -0
- package/dist/environment-variables.d.ts +124 -0
- package/dist/environment-variables.js +492 -0
- package/dist/extensions/create-track-highlight.d.ts +12 -0
- package/dist/extensions/create-track-highlight.js +147 -0
- package/dist/extensions/track-highlight.d.ts +22 -0
- package/dist/extensions/track-highlight.js +52 -0
- package/dist/hooks/use-audio-recorder.d.ts +107 -0
- package/dist/hooks/use-audio-recorder.js +577 -0
- package/dist/hooks/use-chat-composer.d.ts +56 -0
- package/dist/hooks/use-chat-composer.js +63 -0
- package/dist/hooks/use-chat-message.d.ts +28 -0
- package/dist/hooks/use-chat-message.js +24 -0
- package/dist/hooks/use-color-area.d.ts +18 -0
- package/dist/hooks/use-color-area.js +60 -0
- package/dist/hooks/use-copy-to-clipboard.d.ts +22 -0
- package/dist/hooks/use-copy-to-clipboard.js +90 -0
- package/dist/hooks/use-dropzone.d.ts +59 -0
- package/dist/hooks/use-dropzone.js +372 -0
- package/dist/hooks/use-dynamic-notification.d.ts +37 -0
- package/dist/hooks/use-dynamic-notification.js +87 -0
- package/dist/hooks/use-environment-variables.d.ts +51 -0
- package/dist/hooks/use-environment-variables.js +188 -0
- package/dist/hooks/use-mobile.d.ts +5 -0
- package/dist/hooks/use-mobile.js +29 -0
- package/dist/hooks/use-textarea-trigger-menu.d.ts +8 -0
- package/dist/hooks/use-textarea-trigger-menu.js +69 -0
- package/dist/hooks/use-trigger-menu.d.ts +49 -0
- package/dist/hooks/use-trigger-menu.js +102 -0
- package/dist/hooks/use-user-ask.d.ts +48 -0
- package/dist/hooks/use-user-ask.js +167 -0
- package/dist/inline-attachment.d.ts +37 -0
- package/dist/inline-attachment.js +192 -0
- package/dist/inline-citation.d.ts +56 -0
- package/dist/inline-citation.js +319 -0
- package/dist/knob-contracts/accordion-knobs.d.ts +5 -0
- package/dist/knob-contracts/accordion-knobs.js +9 -0
- package/dist/knob-contracts/action-bar-knobs.d.ts +5 -0
- package/dist/knob-contracts/action-bar-knobs.js +4 -0
- package/dist/knob-contracts/activity-knobs.d.ts +5 -0
- package/dist/knob-contracts/activity-knobs.js +9 -0
- package/dist/knob-contracts/alert-knobs.d.ts +5 -0
- package/dist/knob-contracts/alert-knobs.js +9 -0
- package/dist/knob-contracts/audio-recorder-knobs.d.ts +5 -0
- package/dist/knob-contracts/audio-recorder-knobs.js +9 -0
- package/dist/knob-contracts/audio-visualizer-knobs.d.ts +5 -0
- package/dist/knob-contracts/audio-visualizer-knobs.js +9 -0
- package/dist/knob-contracts/avatar-knobs.d.ts +5 -0
- package/dist/knob-contracts/avatar-knobs.js +9 -0
- package/dist/knob-contracts/badge-knobs.d.ts +5 -0
- package/dist/knob-contracts/badge-knobs.js +9 -0
- package/dist/knob-contracts/button-group-knobs.d.ts +5 -0
- package/dist/knob-contracts/button-group-knobs.js +9 -0
- package/dist/knob-contracts/button-knobs.d.ts +5 -0
- package/dist/knob-contracts/button-knobs.js +25 -0
- package/dist/knob-contracts/calendar-knobs.d.ts +5 -0
- package/dist/knob-contracts/calendar-knobs.js +10 -0
- package/dist/knob-contracts/card-knobs.d.ts +5 -0
- package/dist/knob-contracts/card-knobs.js +11 -0
- package/dist/knob-contracts/chat-composer-attachment-knobs.d.ts +5 -0
- package/dist/knob-contracts/chat-composer-attachment-knobs.js +11 -0
- package/dist/knob-contracts/chat-composer-knobs.d.ts +5 -0
- package/dist/knob-contracts/chat-composer-knobs.js +18 -0
- package/dist/knob-contracts/chat-layout-knobs.d.ts +5 -0
- package/dist/knob-contracts/chat-layout-knobs.js +11 -0
- package/dist/knob-contracts/chat-message-knobs.d.ts +5 -0
- package/dist/knob-contracts/chat-message-knobs.js +17 -0
- package/dist/knob-contracts/choice-knobs.d.ts +5 -0
- package/dist/knob-contracts/choice-knobs.js +9 -0
- package/dist/knob-contracts/code-block-editor-knobs.d.ts +5 -0
- package/dist/knob-contracts/code-block-editor-knobs.js +11 -0
- package/dist/knob-contracts/code-diff-knobs.d.ts +5 -0
- package/dist/knob-contracts/code-diff-knobs.js +18 -0
- package/dist/knob-contracts/code-knobs.d.ts +5 -0
- package/dist/knob-contracts/code-knobs.js +11 -0
- package/dist/knob-contracts/collapsible-knobs.d.ts +5 -0
- package/dist/knob-contracts/collapsible-knobs.js +4 -0
- package/dist/knob-contracts/color-picker-knobs.d.ts +5 -0
- package/dist/knob-contracts/color-picker-knobs.js +12 -0
- package/dist/knob-contracts/context-knobs.d.ts +5 -0
- package/dist/knob-contracts/context-knobs.js +13 -0
- package/dist/knob-contracts/dockable-panel-knobs.d.ts +5 -0
- package/dist/knob-contracts/dockable-panel-knobs.js +12 -0
- package/dist/knob-contracts/dropzone-knobs.d.ts +5 -0
- package/dist/knob-contracts/dropzone-knobs.js +11 -0
- package/dist/knob-contracts/dynamic-notification-knobs.d.ts +5 -0
- package/dist/knob-contracts/dynamic-notification-knobs.js +18 -0
- package/dist/knob-contracts/empty-knobs.d.ts +5 -0
- package/dist/knob-contracts/empty-knobs.js +12 -0
- package/dist/knob-contracts/environment-variables-knobs.d.ts +5 -0
- package/dist/knob-contracts/environment-variables-knobs.js +11 -0
- package/dist/knob-contracts/field-knobs.d.ts +5 -0
- package/dist/knob-contracts/field-knobs.js +16 -0
- package/dist/knob-contracts/gradient-editor-knobs.d.ts +5 -0
- package/dist/knob-contracts/gradient-editor-knobs.js +13 -0
- package/dist/knob-contracts/infinite-canvas-knobs.d.ts +5 -0
- package/dist/knob-contracts/infinite-canvas-knobs.js +13 -0
- package/dist/knob-contracts/inline-attachment-knobs.d.ts +5 -0
- package/dist/knob-contracts/inline-attachment-knobs.js +14 -0
- package/dist/knob-contracts/inline-citation-knobs.d.ts +5 -0
- package/dist/knob-contracts/inline-citation-knobs.js +14 -0
- package/dist/knob-contracts/item-knobs.d.ts +5 -0
- package/dist/knob-contracts/item-knobs.js +10 -0
- package/dist/knob-contracts/kbd-knobs.d.ts +5 -0
- package/dist/knob-contracts/kbd-knobs.js +10 -0
- package/dist/knob-contracts/markdown-block-knobs.d.ts +5 -0
- package/dist/knob-contracts/markdown-block-knobs.js +11 -0
- package/dist/knob-contracts/markdown-knobs.d.ts +5 -0
- package/dist/knob-contracts/markdown-knobs.js +14 -0
- package/dist/knob-contracts/morphing-panel-knobs.d.ts +5 -0
- package/dist/knob-contracts/morphing-panel-knobs.js +11 -0
- package/dist/knob-contracts/pagination-knobs.d.ts +5 -0
- package/dist/knob-contracts/pagination-knobs.js +10 -0
- package/dist/knob-contracts/phone-input-knobs.d.ts +5 -0
- package/dist/knob-contracts/phone-input-knobs.js +10 -0
- package/dist/knob-contracts/popup-knobs.d.ts +5 -0
- package/dist/knob-contracts/popup-knobs.js +21 -0
- package/dist/knob-contracts/range-knobs.d.ts +5 -0
- package/dist/knob-contracts/range-knobs.js +13 -0
- package/dist/knob-contracts/resizable-knobs.d.ts +5 -0
- package/dist/knob-contracts/resizable-knobs.js +14 -0
- package/dist/knob-contracts/rich-tooltip-knobs.d.ts +5 -0
- package/dist/knob-contracts/rich-tooltip-knobs.js +13 -0
- package/dist/knob-contracts/scroll-area-knobs.d.ts +5 -0
- package/dist/knob-contracts/scroll-area-knobs.js +8 -0
- package/dist/knob-contracts/separator-knobs.d.ts +5 -0
- package/dist/knob-contracts/separator-knobs.js +4 -0
- package/dist/knob-contracts/sidebar-knobs.d.ts +5 -0
- package/dist/knob-contracts/sidebar-knobs.js +26 -0
- package/dist/knob-contracts/skeleton-knobs.d.ts +5 -0
- package/dist/knob-contracts/skeleton-knobs.js +4 -0
- package/dist/knob-contracts/source-badge-knobs.d.ts +5 -0
- package/dist/knob-contracts/source-badge-knobs.js +11 -0
- package/dist/knob-contracts/spinner-knobs.d.ts +5 -0
- package/dist/knob-contracts/spinner-knobs.js +4 -0
- package/dist/knob-contracts/stepper-knobs.d.ts +5 -0
- package/dist/knob-contracts/stepper-knobs.js +11 -0
- package/dist/knob-contracts/switch-knobs.d.ts +5 -0
- package/dist/knob-contracts/switch-knobs.js +12 -0
- package/dist/knob-contracts/table-knobs.d.ts +5 -0
- package/dist/knob-contracts/table-knobs.js +12 -0
- package/dist/knob-contracts/table-of-contents-knobs.d.ts +5 -0
- package/dist/knob-contracts/table-of-contents-knobs.js +8 -0
- package/dist/knob-contracts/tabs-knobs.d.ts +5 -0
- package/dist/knob-contracts/tabs-knobs.js +16 -0
- package/dist/knob-contracts/task-list-knobs.d.ts +5 -0
- package/dist/knob-contracts/task-list-knobs.js +14 -0
- package/dist/knob-contracts/thread-rail-knobs.d.ts +5 -0
- package/dist/knob-contracts/thread-rail-knobs.js +14 -0
- package/dist/knob-contracts/timeline-knobs.d.ts +5 -0
- package/dist/knob-contracts/timeline-knobs.js +12 -0
- package/dist/knob-contracts/toolbar-knobs.d.ts +5 -0
- package/dist/knob-contracts/toolbar-knobs.js +20 -0
- package/dist/knob-contracts/track-highlight-knobs.d.ts +5 -0
- package/dist/knob-contracts/track-highlight-knobs.js +11 -0
- package/dist/knob-contracts/transcript-divider-knobs.d.ts +5 -0
- package/dist/knob-contracts/transcript-divider-knobs.js +10 -0
- package/dist/knob-contracts/tree-knobs.d.ts +5 -0
- package/dist/knob-contracts/tree-knobs.js +13 -0
- package/dist/knob-contracts/user-ask-knobs.d.ts +5 -0
- package/dist/knob-contracts/user-ask-knobs.js +17 -0
- package/dist/lib/cn.d.ts +5 -0
- package/dist/lib/cn.js +34 -0
- package/dist/lib/code-block-shiki.d.ts +9 -0
- package/dist/lib/code-block-shiki.js +6 -0
- package/dist/lib/code-tokens.d.ts +28 -0
- package/dist/lib/code-tokens.js +160 -0
- package/dist/lib/color.d.ts +72 -0
- package/dist/lib/color.js +490 -0
- package/dist/lib/contrast.d.ts +30 -0
- package/dist/lib/contrast.js +64 -0
- package/dist/lib/diff.d.ts +50 -0
- package/dist/lib/diff.js +315 -0
- package/dist/lib/dropzone-validation.d.ts +66 -0
- package/dist/lib/dropzone-validation.js +228 -0
- package/dist/lib/env-file.d.ts +28 -0
- package/dist/lib/env-file.js +218 -0
- package/dist/lib/format-audio-recorder-duration.d.ts +4 -0
- package/dist/lib/format-audio-recorder-duration.js +7 -0
- package/dist/lib/liquid-glass-optics.d.ts +4 -0
- package/dist/lib/liquid-glass-optics.js +96 -0
- package/dist/lib/phone-input-format.d.ts +6 -0
- package/dist/lib/phone-input-format.js +26 -0
- package/dist/lib/phone-number.d.ts +18 -0
- package/dist/lib/phone-number.js +28 -0
- package/dist/lib/trigger-detect.d.ts +15 -0
- package/dist/lib/trigger-detect.js +77 -0
- package/dist/markdown-block.d.ts +25 -0
- package/dist/markdown-block.js +77 -0
- package/dist/skin.config.d.ts +5 -0
- package/dist/skin.config.js +4 -0
- package/dist/skin.d.ts +69 -0
- package/dist/skin.js +62 -0
- package/dist/source-badge.d.ts +23 -0
- package/dist/source-badge.js +72 -0
- package/dist/styles/chat-composer-editor.css +44 -0
- package/dist/styles/code.css +57 -0
- package/dist/styles/effects.css +126 -0
- package/dist/styles/index.css +81 -0
- package/dist/styles/recipes/accordion.css +87 -0
- package/dist/styles/recipes/action-bar.css +19 -0
- package/dist/styles/recipes/activity.css +129 -0
- package/dist/styles/recipes/alert.css +75 -0
- package/dist/styles/recipes/audio-recorder.css +102 -0
- package/dist/styles/recipes/audio-visualizer.css +90 -0
- package/dist/styles/recipes/avatar.css +52 -0
- package/dist/styles/recipes/badge.css +110 -0
- package/dist/styles/recipes/button-group.css +64 -0
- package/dist/styles/recipes/button.css +305 -0
- package/dist/styles/recipes/calendar.css +152 -0
- package/dist/styles/recipes/card.css +93 -0
- package/dist/styles/recipes/chat-composer-attachment.css +177 -0
- package/dist/styles/recipes/chat-composer.css +195 -0
- package/dist/styles/recipes/chat-layout.css +108 -0
- package/dist/styles/recipes/chat-message.css +160 -0
- package/dist/styles/recipes/choice.css +108 -0
- package/dist/styles/recipes/code-block-editor.css +136 -0
- package/dist/styles/recipes/code-diff.css +256 -0
- package/dist/styles/recipes/code.css +136 -0
- package/dist/styles/recipes/collapsible.css +27 -0
- package/dist/styles/recipes/color-picker-details.css +61 -0
- package/dist/styles/recipes/color-picker-values.css +117 -0
- package/dist/styles/recipes/color-picker.css +158 -0
- package/dist/styles/recipes/context.css +237 -0
- package/dist/styles/recipes/dockable-panel.css +106 -0
- package/dist/styles/recipes/dropzone.css +149 -0
- package/dist/styles/recipes/dynamic-notification-input.css +29 -0
- package/dist/styles/recipes/dynamic-notification-motion.css +298 -0
- package/dist/styles/recipes/dynamic-notification.css +241 -0
- package/dist/styles/recipes/empty.css +96 -0
- package/dist/styles/recipes/environment-variables.css +173 -0
- package/dist/styles/recipes/field-parts.css +148 -0
- package/dist/styles/recipes/field.css +234 -0
- package/dist/styles/recipes/gradient-editor.css +109 -0
- package/dist/styles/recipes/infinite-canvas.css +78 -0
- package/dist/styles/recipes/inline-attachment.css +182 -0
- package/dist/styles/recipes/inline-citation.css +174 -0
- package/dist/styles/recipes/item.css +107 -0
- package/dist/styles/recipes/kbd.css +55 -0
- package/dist/styles/recipes/markdown-block.css +75 -0
- package/dist/styles/recipes/markdown.css +204 -0
- package/dist/styles/recipes/morphing-panel.css +123 -0
- package/dist/styles/recipes/pagination.css +86 -0
- package/dist/styles/recipes/phone-input.css +105 -0
- package/dist/styles/recipes/popup-controls.css +59 -0
- package/dist/styles/recipes/popup-drawer.css +162 -0
- package/dist/styles/recipes/popup-lists.css +198 -0
- package/dist/styles/recipes/popup-motion.css +94 -0
- package/dist/styles/recipes/popup-toast.css +126 -0
- package/dist/styles/recipes/popup.css +396 -0
- package/dist/styles/recipes/range.css +259 -0
- package/dist/styles/recipes/resizable.css +170 -0
- package/dist/styles/recipes/rich-tooltip.css +272 -0
- package/dist/styles/recipes/scroll-area.css +59 -0
- package/dist/styles/recipes/separator.css +12 -0
- package/dist/styles/recipes/sidebar.css +345 -0
- package/dist/styles/recipes/skeleton.css +23 -0
- package/dist/styles/recipes/source-badge.css +77 -0
- package/dist/styles/recipes/spinner.css +33 -0
- package/dist/styles/recipes/stepper.css +178 -0
- package/dist/styles/recipes/switch.css +149 -0
- package/dist/styles/recipes/table-of-contents.css +107 -0
- package/dist/styles/recipes/table.css +124 -0
- package/dist/styles/recipes/tabs.css +235 -0
- package/dist/styles/recipes/task-list.css +146 -0
- package/dist/styles/recipes/thread-rail.css +247 -0
- package/dist/styles/recipes/timeline.css +107 -0
- package/dist/styles/recipes/toolbar.css +260 -0
- package/dist/styles/recipes/track-highlight.css +73 -0
- package/dist/styles/recipes/transcript-divider.css +64 -0
- package/dist/styles/recipes/tree.css +137 -0
- package/dist/styles/recipes/user-ask-details.css +45 -0
- package/dist/styles/recipes/user-ask.css +204 -0
- package/dist/styles/skin-theme.css +137 -0
- package/dist/styles/skin.css +143 -0
- package/dist/styles/theme.css +628 -0
- package/dist/styles/type-scale.css +45 -0
- package/dist/surface-variants.d.ts +6 -0
- package/dist/surface-variants.js +16 -0
- package/dist/task-list.d.ts +34 -0
- package/dist/task-list.js +177 -0
- package/dist/thread-rail.d.ts +52 -0
- package/dist/thread-rail.js +190 -0
- package/dist/transcript-divider.d.ts +15 -0
- package/dist/transcript-divider.js +25 -0
- package/dist/ui/accordion.d.ts +31 -0
- package/dist/ui/accordion.js +60 -0
- package/dist/ui/alert-dialog.d.ts +36 -0
- package/dist/ui/alert-dialog.js +100 -0
- package/dist/ui/alert.d.ts +21 -0
- package/dist/ui/alert.js +36 -0
- package/dist/ui/aspect-ratio.d.ts +8 -0
- package/dist/ui/aspect-ratio.js +17 -0
- package/dist/ui/autocomplete.d.ts +70 -0
- package/dist/ui/autocomplete.js +150 -0
- package/dist/ui/avatar.d.ts +24 -0
- package/dist/ui/avatar.js +44 -0
- package/dist/ui/badge.d.ts +20 -0
- package/dist/ui/badge.js +36 -0
- package/dist/ui/button-group.d.ts +24 -0
- package/dist/ui/button-group.js +45 -0
- package/dist/ui/button.d.ts +36 -0
- package/dist/ui/button.js +104 -0
- package/dist/ui/calendar.d.ts +11 -0
- package/dist/ui/calendar.js +160 -0
- package/dist/ui/card.d.ts +36 -0
- package/dist/ui/card.js +70 -0
- package/dist/ui/checkbox-group.d.ts +11 -0
- package/dist/ui/checkbox-group.js +16 -0
- package/dist/ui/checkbox.d.ts +23 -0
- package/dist/ui/checkbox.js +58 -0
- package/dist/ui/code-diff.d.ts +28 -0
- package/dist/ui/code-diff.js +561 -0
- package/dist/ui/code.d.ts +62 -0
- package/dist/ui/code.js +292 -0
- package/dist/ui/collapsible.d.ts +31 -0
- package/dist/ui/collapsible.js +72 -0
- package/dist/ui/color-picker.d.ts +137 -0
- package/dist/ui/color-picker.js +797 -0
- package/dist/ui/combobox-disabled-selection.d.ts +5 -0
- package/dist/ui/combobox-disabled-selection.js +11 -0
- package/dist/ui/combobox.d.ts +70 -0
- package/dist/ui/combobox.js +194 -0
- package/dist/ui/command.d.ts +44 -0
- package/dist/ui/command.js +166 -0
- package/dist/ui/context-menu.d.ts +86 -0
- package/dist/ui/context-menu.js +202 -0
- package/dist/ui/dialog.d.ts +38 -0
- package/dist/ui/dialog.js +124 -0
- package/dist/ui/dockable-panel-geometry.d.ts +18 -0
- package/dist/ui/dockable-panel-geometry.js +17 -0
- package/dist/ui/dockable-panel.d.ts +58 -0
- package/dist/ui/dockable-panel.js +366 -0
- package/dist/ui/drawer.d.ts +42 -0
- package/dist/ui/drawer.js +182 -0
- package/dist/ui/dropdown-menu.d.ts +46 -0
- package/dist/ui/dropdown-menu.js +89 -0
- package/dist/ui/dropzone.d.ts +66 -0
- package/dist/ui/dropzone.js +311 -0
- package/dist/ui/empty.d.ts +28 -0
- package/dist/ui/empty.js +59 -0
- package/dist/ui/field.d.ts +64 -0
- package/dist/ui/field.js +166 -0
- package/dist/ui/form.d.ts +10 -0
- package/dist/ui/form.js +17 -0
- package/dist/ui/gradient-editor.d.ts +47 -0
- package/dist/ui/gradient-editor.js +301 -0
- package/dist/ui/hover-card.d.ts +25 -0
- package/dist/ui/hover-card.js +46 -0
- package/dist/ui/infinite-canvas.d.ts +40 -0
- package/dist/ui/infinite-canvas.js +278 -0
- package/dist/ui/input-group.d.ts +21 -0
- package/dist/ui/input-group.js +44 -0
- package/dist/ui/input-otp.d.ts +38 -0
- package/dist/ui/input-otp.js +45 -0
- package/dist/ui/input.d.ts +12 -0
- package/dist/ui/input.js +18 -0
- package/dist/ui/item.d.ts +46 -0
- package/dist/ui/item.js +110 -0
- package/dist/ui/kbd.d.ts +12 -0
- package/dist/ui/kbd.js +23 -0
- package/dist/ui/markdown-elements.d.ts +52 -0
- package/dist/ui/markdown-elements.js +211 -0
- package/dist/ui/markdown.d.ts +14 -0
- package/dist/ui/markdown.js +31 -0
- package/dist/ui/menubar.d.ts +74 -0
- package/dist/ui/menubar.js +162 -0
- package/dist/ui/meter.d.ts +34 -0
- package/dist/ui/meter.js +57 -0
- package/dist/ui/morphing-panel.d.ts +24 -0
- package/dist/ui/morphing-panel.js +87 -0
- package/dist/ui/native-select.d.ts +12 -0
- package/dist/ui/native-select.js +41 -0
- package/dist/ui/navigation-menu.d.ts +51 -0
- package/dist/ui/navigation-menu.js +135 -0
- package/dist/ui/number-field.d.ts +72 -0
- package/dist/ui/number-field.js +124 -0
- package/dist/ui/pagination.d.ts +26 -0
- package/dist/ui/pagination.js +77 -0
- package/dist/ui/phone-input.d.ts +30 -0
- package/dist/ui/phone-input.js +263 -0
- package/dist/ui/popover.d.ts +34 -0
- package/dist/ui/popover.js +87 -0
- package/dist/ui/progress.d.ts +34 -0
- package/dist/ui/progress.js +57 -0
- package/dist/ui/radio-group.d.ts +29 -0
- package/dist/ui/radio-group.js +37 -0
- package/dist/ui/resizable.d.ts +56 -0
- package/dist/ui/resizable.js +82 -0
- package/dist/ui/responsive-dialog.d.ts +18 -0
- package/dist/ui/responsive-dialog.js +121 -0
- package/dist/ui/rich-tooltip-tour.d.ts +12 -0
- package/dist/ui/rich-tooltip-tour.js +20 -0
- package/dist/ui/rich-tooltip.d.ts +83 -0
- package/dist/ui/rich-tooltip.js +331 -0
- package/dist/ui/scroll-area.d.ts +25 -0
- package/dist/ui/scroll-area.js +93 -0
- package/dist/ui/select.d.ts +44 -0
- package/dist/ui/select.js +124 -0
- package/dist/ui/separator.d.ts +9 -0
- package/dist/ui/separator.js +16 -0
- package/dist/ui/sheet.d.ts +25 -0
- package/dist/ui/sheet.js +76 -0
- package/dist/ui/sidebar.d.ts +88 -0
- package/dist/ui/sidebar.js +362 -0
- package/dist/ui/skeleton.d.ts +8 -0
- package/dist/ui/skeleton.js +13 -0
- package/dist/ui/slider.d.ts +24 -0
- package/dist/ui/slider.js +114 -0
- package/dist/ui/spinner.d.ts +12 -0
- package/dist/ui/spinner.js +26 -0
- package/dist/ui/stepper.d.ts +58 -0
- package/dist/ui/stepper.js +232 -0
- package/dist/ui/switch.d.ts +26 -0
- package/dist/ui/switch.js +71 -0
- package/dist/ui/table-of-contents.d.ts +22 -0
- package/dist/ui/table-of-contents.js +181 -0
- package/dist/ui/table.d.ts +37 -0
- package/dist/ui/table.js +83 -0
- package/dist/ui/tabs.d.ts +36 -0
- package/dist/ui/tabs.js +127 -0
- package/dist/ui/textarea.d.ts +9 -0
- package/dist/ui/textarea.js +16 -0
- package/dist/ui/timeline.d.ts +40 -0
- package/dist/ui/timeline.js +80 -0
- package/dist/ui/toast.d.ts +28 -0
- package/dist/ui/toast.js +132 -0
- package/dist/ui/toggle.d.ts +20 -0
- package/dist/ui/toggle.js +71 -0
- package/dist/ui/toolbar.d.ts +40 -0
- package/dist/ui/toolbar.js +72 -0
- package/dist/ui/tooltip.d.ts +27 -0
- package/dist/ui/tooltip.js +93 -0
- package/dist/ui/tree.d.ts +56 -0
- package/dist/ui/tree.js +438 -0
- package/dist/ui/trigger-menu.d.ts +46 -0
- package/dist/ui/trigger-menu.js +116 -0
- package/dist/user-ask.d.ts +50 -0
- package/dist/user-ask.js +398 -0
- package/package.json +115 -0
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "./lib/cn.js";
|
|
3
|
+
import { Button } from "./ui/button.js";
|
|
4
|
+
import { DUPLICATE_ENVIRONMENT_VARIABLE_MESSAGE, collectEnvironmentVariables, rowsToEnvFileText } from "./lib/env-file.js";
|
|
5
|
+
import { useEnvironmentVariables } from "./hooks/use-environment-variables.js";
|
|
6
|
+
import { Input } from "./ui/input.js";
|
|
7
|
+
import { InputGroup, InputGroupAddon, InputGroupInput } from "./ui/input-group.js";
|
|
8
|
+
import { createContext, use, useId } from "react";
|
|
9
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { AlertTriangleIcon, EyeIcon, EyeOffIcon, FileUpIcon, PlusIcon, RotateCcwIcon, SaveIcon, Trash2Icon } from "lucide-react";
|
|
11
|
+
//#region src/environment-variables.tsx
|
|
12
|
+
const EnvironmentVariablesContext = createContext(null);
|
|
13
|
+
function useEnvironmentVariablesContext(componentName) {
|
|
14
|
+
const context = use(EnvironmentVariablesContext);
|
|
15
|
+
if (!context) throw new Error(`${componentName} must be used inside <EnvironmentVariables.Root>.`);
|
|
16
|
+
return context;
|
|
17
|
+
}
|
|
18
|
+
function EnvironmentVariablesRoot({ editor, disabled = false, readOnly = false, rowErrors, keyLabel = "Key", valueLabel = "Value", keyPlaceholder = "OPENAI_API_KEY", valuePlaceholder = "sk-...", duplicateKeyMessage = DUPLICATE_ENVIRONMENT_VARIABLE_MESSAGE, onSubmit, className, children, ...props }) {
|
|
19
|
+
function handleSubmit(event) {
|
|
20
|
+
if (event.defaultPrevented || !onSubmit) return;
|
|
21
|
+
event.preventDefault();
|
|
22
|
+
if (editor.hasDuplicateKeys) return;
|
|
23
|
+
const rows = editor.getRowsForSubmit();
|
|
24
|
+
onSubmit({
|
|
25
|
+
rows,
|
|
26
|
+
variables: collectEnvironmentVariables(rows),
|
|
27
|
+
envFileText: rowsToEnvFileText(rows),
|
|
28
|
+
reset: () => editor.resetRows(rows)
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return /* @__PURE__ */ jsx(EnvironmentVariablesContext.Provider, {
|
|
32
|
+
value: {
|
|
33
|
+
editor,
|
|
34
|
+
disabled,
|
|
35
|
+
readOnly,
|
|
36
|
+
rowErrors,
|
|
37
|
+
keyLabel,
|
|
38
|
+
valueLabel,
|
|
39
|
+
keyPlaceholder,
|
|
40
|
+
valuePlaceholder,
|
|
41
|
+
duplicateKeyMessage
|
|
42
|
+
},
|
|
43
|
+
children: /* @__PURE__ */ jsx("form", {
|
|
44
|
+
"data-control-ui": "environment-variables",
|
|
45
|
+
"data-control-family": "environment-variables",
|
|
46
|
+
"data-slot": "root",
|
|
47
|
+
"data-surface": "panel",
|
|
48
|
+
"data-disabled": disabled ? "true" : void 0,
|
|
49
|
+
"data-readonly": readOnly ? "true" : void 0,
|
|
50
|
+
className: cn("flex min-w-0 flex-col", className),
|
|
51
|
+
onSubmit: handleSubmit,
|
|
52
|
+
...props,
|
|
53
|
+
children
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function EnvironmentVariablesComponent({ editor: providedEditor, initialRows, rows, onRowsChange, createDefaultRow, createRow, getEditableRows, getPreservedRows, maxUploadSize, title = "Environment variables", description, error, submitLabel = "Save", resetLabel = "Reset", addLabel = "Add variable", hideDefaultActions = false, children, onSubmit, ...props }) {
|
|
58
|
+
const internalEditor = useEnvironmentVariables({
|
|
59
|
+
initialRows,
|
|
60
|
+
rows,
|
|
61
|
+
onRowsChange,
|
|
62
|
+
createDefaultRow,
|
|
63
|
+
createRow,
|
|
64
|
+
getEditableRows,
|
|
65
|
+
getPreservedRows,
|
|
66
|
+
maxUploadSize
|
|
67
|
+
});
|
|
68
|
+
return /* @__PURE__ */ jsx(EnvironmentVariablesRoot, {
|
|
69
|
+
editor: providedEditor ?? internalEditor,
|
|
70
|
+
onSubmit,
|
|
71
|
+
...props,
|
|
72
|
+
children: children ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
73
|
+
/* @__PURE__ */ jsx(EnvironmentVariablesHeader, {
|
|
74
|
+
title,
|
|
75
|
+
description
|
|
76
|
+
}),
|
|
77
|
+
/* @__PURE__ */ jsx(EnvironmentVariablesToolbar, {}),
|
|
78
|
+
/* @__PURE__ */ jsx(EnvironmentVariablesUploadError, {}),
|
|
79
|
+
/* @__PURE__ */ jsx(EnvironmentVariablesRows, {}),
|
|
80
|
+
/* @__PURE__ */ jsx(EnvironmentVariablesDuplicateKeysError, {}),
|
|
81
|
+
/* @__PURE__ */ jsx(EnvironmentVariablesMessage, { error }),
|
|
82
|
+
!hideDefaultActions && /* @__PURE__ */ jsxs(EnvironmentVariablesActions, { children: [/* @__PURE__ */ jsx(EnvironmentVariablesAddButton, { children: addLabel }), /* @__PURE__ */ jsxs("div", {
|
|
83
|
+
className: "flex min-w-0 items-center",
|
|
84
|
+
children: [/* @__PURE__ */ jsx(EnvironmentVariablesResetButton, { children: resetLabel }), onSubmit ? /* @__PURE__ */ jsx(EnvironmentVariablesSubmitButton, { children: submitLabel }) : null]
|
|
85
|
+
})] })
|
|
86
|
+
] })
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function EnvironmentVariablesHeader({ title, description, className, children, ...props }) {
|
|
90
|
+
if (children) return /* @__PURE__ */ jsx("div", {
|
|
91
|
+
"data-control-ui": "environment-variables",
|
|
92
|
+
"data-control-family": "environment-variables",
|
|
93
|
+
"data-slot": "header",
|
|
94
|
+
className: cn("flex flex-col", className),
|
|
95
|
+
...props,
|
|
96
|
+
children
|
|
97
|
+
});
|
|
98
|
+
if (!title && !description) return null;
|
|
99
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
100
|
+
"data-control-ui": "environment-variables",
|
|
101
|
+
"data-control-family": "environment-variables",
|
|
102
|
+
"data-slot": "header",
|
|
103
|
+
className: cn("flex flex-col", className),
|
|
104
|
+
...props,
|
|
105
|
+
children: [title ? /* @__PURE__ */ jsx("div", {
|
|
106
|
+
"data-control-ui": "environment-variables",
|
|
107
|
+
"data-control-family": "environment-variables",
|
|
108
|
+
"data-slot": "title",
|
|
109
|
+
children: title
|
|
110
|
+
}) : null, description ? /* @__PURE__ */ jsx("div", {
|
|
111
|
+
"data-control-ui": "environment-variables",
|
|
112
|
+
"data-control-family": "environment-variables",
|
|
113
|
+
"data-slot": "description",
|
|
114
|
+
className: "max-w-2xl",
|
|
115
|
+
children: description
|
|
116
|
+
}) : null]
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
function EnvironmentVariablesToolbar({ className, children, ...props }) {
|
|
120
|
+
const { readOnly } = useEnvironmentVariablesContext("EnvironmentVariables.Toolbar");
|
|
121
|
+
if (readOnly) return null;
|
|
122
|
+
return /* @__PURE__ */ jsx("div", {
|
|
123
|
+
"data-control-ui": "environment-variables",
|
|
124
|
+
"data-control-family": "environment-variables",
|
|
125
|
+
"data-slot": "toolbar",
|
|
126
|
+
className: cn("flex min-w-0 flex-col sm:flex-row sm:items-center", className),
|
|
127
|
+
...props,
|
|
128
|
+
children: children ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("p", {
|
|
129
|
+
"data-control-ui": "environment-variables",
|
|
130
|
+
"data-control-family": "environment-variables",
|
|
131
|
+
"data-slot": "hint",
|
|
132
|
+
className: "min-w-0 flex-1",
|
|
133
|
+
children: [
|
|
134
|
+
"Paste one or more",
|
|
135
|
+
" ",
|
|
136
|
+
/* @__PURE__ */ jsx("code", {
|
|
137
|
+
"data-control-ui": "environment-variables",
|
|
138
|
+
"data-control-family": "environment-variables",
|
|
139
|
+
"data-slot": "hint-code",
|
|
140
|
+
children: "KEY=value"
|
|
141
|
+
}),
|
|
142
|
+
" ",
|
|
143
|
+
"lines directly into any field."
|
|
144
|
+
]
|
|
145
|
+
}), /* @__PURE__ */ jsx(EnvironmentVariablesUploadButton, {})] })
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
function EnvironmentVariablesUploadButton({ inputLabel = "Import .env file", children = "Upload .env", variant = "surface", size = "sm", disabled, onClick, ...props }) {
|
|
149
|
+
const { editor, disabled: contextDisabled, readOnly } = useEnvironmentVariablesContext("EnvironmentVariables.UploadButton");
|
|
150
|
+
const inputId = useId();
|
|
151
|
+
const isDisabled = disabled ?? (contextDisabled || readOnly);
|
|
152
|
+
function handleChange(event) {
|
|
153
|
+
editor.handleFileUpload(event);
|
|
154
|
+
}
|
|
155
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("input", {
|
|
156
|
+
id: inputId,
|
|
157
|
+
type: "file",
|
|
158
|
+
accept: ".env,text/plain",
|
|
159
|
+
className: "sr-only",
|
|
160
|
+
disabled: isDisabled,
|
|
161
|
+
"aria-label": inputLabel,
|
|
162
|
+
onChange: handleChange
|
|
163
|
+
}), /* @__PURE__ */ jsxs(Button, {
|
|
164
|
+
type: "button",
|
|
165
|
+
variant,
|
|
166
|
+
size,
|
|
167
|
+
disabled: isDisabled,
|
|
168
|
+
onClick: (event) => {
|
|
169
|
+
onClick?.(event);
|
|
170
|
+
if (!event.defaultPrevented) event.currentTarget.ownerDocument.getElementById(inputId)?.click();
|
|
171
|
+
},
|
|
172
|
+
...props,
|
|
173
|
+
children: [/* @__PURE__ */ jsx(FileUpIcon, {
|
|
174
|
+
"aria-hidden": "true",
|
|
175
|
+
className: "size-3.5"
|
|
176
|
+
}), children]
|
|
177
|
+
})] });
|
|
178
|
+
}
|
|
179
|
+
function EnvironmentVariablesRows({ rowErrors, className, children, ...props }) {
|
|
180
|
+
const { editor, keyLabel, valueLabel, readOnly } = useEnvironmentVariablesContext("EnvironmentVariables.Rows");
|
|
181
|
+
return /* @__PURE__ */ jsx("div", {
|
|
182
|
+
"data-control-ui": "environment-variables",
|
|
183
|
+
"data-control-family": "environment-variables",
|
|
184
|
+
"data-slot": "rows",
|
|
185
|
+
className: cn("min-w-0", className),
|
|
186
|
+
...props,
|
|
187
|
+
children: children ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("div", {
|
|
188
|
+
"aria-hidden": "true",
|
|
189
|
+
"data-control-ui": "environment-variables",
|
|
190
|
+
"data-control-family": "environment-variables",
|
|
191
|
+
"data-slot": "column-labels",
|
|
192
|
+
className: cn("hidden min-w-0 grid-cols-[minmax(0,1fr)_minmax(0,1.2fr)_auto] sm:grid", readOnly && "grid-cols-[minmax(0,1fr)_minmax(0,1.2fr)]"),
|
|
193
|
+
children: [
|
|
194
|
+
/* @__PURE__ */ jsx("span", { children: keyLabel }),
|
|
195
|
+
/* @__PURE__ */ jsx("span", { children: valueLabel }),
|
|
196
|
+
!readOnly ? /* @__PURE__ */ jsx("span", { className: "size-[var(--control-h-sm)]" }) : null
|
|
197
|
+
]
|
|
198
|
+
}), editor.rows.map((row, index) => /* @__PURE__ */ jsx(EnvironmentVariablesRow, {
|
|
199
|
+
row,
|
|
200
|
+
index,
|
|
201
|
+
rowErrors
|
|
202
|
+
}, editor.getRowId(index)))] })
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
function EnvironmentVariablesRow({ row, index, rowErrors, className, ...props }) {
|
|
206
|
+
const { editor, disabled, readOnly, rowErrors: contextRowErrors, keyLabel, valueLabel, keyPlaceholder, valuePlaceholder, duplicateKeyMessage } = useEnvironmentVariablesContext("EnvironmentVariables.Row");
|
|
207
|
+
const resolvedRowErrors = rowErrors ?? contextRowErrors;
|
|
208
|
+
const keyError = resolvedRowErrors?.[index]?.key ?? (editor.rowHasDuplicateKey(index) ? duplicateKeyMessage : null);
|
|
209
|
+
const valueError = resolvedRowErrors?.[index]?.value;
|
|
210
|
+
const isDisabled = disabled || readOnly;
|
|
211
|
+
const rowId = editor.getRowId(index);
|
|
212
|
+
const keyInputId = `${rowId}-key`;
|
|
213
|
+
const valueInputId = `${rowId}-value`;
|
|
214
|
+
const revealValueLabel = editor.isValueRevealed(index) ? "Hide value" : "Show value";
|
|
215
|
+
const removeRowLabel = `Remove environment variable ${row.key.trim() || index + 1}`;
|
|
216
|
+
function handlePaste(event) {
|
|
217
|
+
if (editor.handlePaste(index, event.clipboardData.getData("text"))) event.preventDefault();
|
|
218
|
+
}
|
|
219
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
220
|
+
"data-control-ui": "environment-variables",
|
|
221
|
+
"data-control-family": "environment-variables",
|
|
222
|
+
"data-slot": "row",
|
|
223
|
+
className: cn("relative grid min-w-0 sm:grid-cols-[minmax(0,1fr)_minmax(0,1.2fr)_auto]", className),
|
|
224
|
+
...props,
|
|
225
|
+
children: [
|
|
226
|
+
/* @__PURE__ */ jsxs("div", {
|
|
227
|
+
className: "flex min-w-0 flex-col",
|
|
228
|
+
children: [
|
|
229
|
+
/* @__PURE__ */ jsx("label", {
|
|
230
|
+
"data-control-ui": "environment-variables",
|
|
231
|
+
"data-control-family": "environment-variables",
|
|
232
|
+
"data-slot": "field-label",
|
|
233
|
+
htmlFor: keyInputId,
|
|
234
|
+
className: "sm:sr-only",
|
|
235
|
+
children: keyLabel
|
|
236
|
+
}),
|
|
237
|
+
/* @__PURE__ */ jsx(Input, {
|
|
238
|
+
"data-control-ui": "environment-variables",
|
|
239
|
+
"data-control-family": "environment-variables",
|
|
240
|
+
"data-slot": "key-input",
|
|
241
|
+
id: keyInputId,
|
|
242
|
+
size: "sm",
|
|
243
|
+
value: row.key,
|
|
244
|
+
placeholder: keyPlaceholder,
|
|
245
|
+
disabled: isDisabled,
|
|
246
|
+
"aria-invalid": Boolean(keyError),
|
|
247
|
+
onChange: (event) => editor.updateRow(index, { key: event.target.value }),
|
|
248
|
+
onPaste: handlePaste
|
|
249
|
+
}),
|
|
250
|
+
keyError ? /* @__PURE__ */ jsx("p", {
|
|
251
|
+
"data-control-ui": "environment-variables",
|
|
252
|
+
"data-control-family": "environment-variables",
|
|
253
|
+
"data-slot": "field-error",
|
|
254
|
+
children: keyError
|
|
255
|
+
}) : null
|
|
256
|
+
]
|
|
257
|
+
}),
|
|
258
|
+
/* @__PURE__ */ jsxs("div", {
|
|
259
|
+
className: "flex min-w-0 flex-col",
|
|
260
|
+
children: [
|
|
261
|
+
/* @__PURE__ */ jsx("label", {
|
|
262
|
+
"data-control-ui": "environment-variables",
|
|
263
|
+
"data-control-family": "environment-variables",
|
|
264
|
+
"data-slot": "field-label",
|
|
265
|
+
htmlFor: valueInputId,
|
|
266
|
+
className: "sm:sr-only",
|
|
267
|
+
children: valueLabel
|
|
268
|
+
}),
|
|
269
|
+
/* @__PURE__ */ jsxs(InputGroup, {
|
|
270
|
+
"data-control-ui": "environment-variables",
|
|
271
|
+
"data-control-family": "environment-variables",
|
|
272
|
+
"data-slot": "value-group",
|
|
273
|
+
"data-invalid": valueError ? "true" : void 0,
|
|
274
|
+
size: "sm",
|
|
275
|
+
children: [/* @__PURE__ */ jsx(InputGroupInput, {
|
|
276
|
+
"data-control-ui": "environment-variables",
|
|
277
|
+
"data-control-family": "environment-variables",
|
|
278
|
+
"data-slot": "value-input",
|
|
279
|
+
id: valueInputId,
|
|
280
|
+
value: row.value,
|
|
281
|
+
placeholder: valuePlaceholder,
|
|
282
|
+
disabled: isDisabled,
|
|
283
|
+
"aria-invalid": Boolean(valueError),
|
|
284
|
+
type: editor.isValueRevealed(index) ? "text" : "password",
|
|
285
|
+
onChange: (event) => editor.updateRow(index, { value: event.target.value }),
|
|
286
|
+
onPaste: handlePaste
|
|
287
|
+
}), /* @__PURE__ */ jsx(InputGroupAddon, {
|
|
288
|
+
className: "pr-1",
|
|
289
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
290
|
+
type: "button",
|
|
291
|
+
variant: "quiet",
|
|
292
|
+
size: "sm",
|
|
293
|
+
iconOnly: true,
|
|
294
|
+
disabled: isDisabled,
|
|
295
|
+
"aria-label": revealValueLabel,
|
|
296
|
+
title: revealValueLabel,
|
|
297
|
+
onClick: () => editor.toggleValueVisibility(index),
|
|
298
|
+
children: editor.isValueRevealed(index) ? /* @__PURE__ */ jsx(EyeOffIcon, {
|
|
299
|
+
"aria-hidden": "true",
|
|
300
|
+
className: "size-3.5"
|
|
301
|
+
}) : /* @__PURE__ */ jsx(EyeIcon, {
|
|
302
|
+
"aria-hidden": "true",
|
|
303
|
+
className: "size-3.5"
|
|
304
|
+
})
|
|
305
|
+
})
|
|
306
|
+
})]
|
|
307
|
+
}),
|
|
308
|
+
valueError ? /* @__PURE__ */ jsx("p", {
|
|
309
|
+
"data-control-ui": "environment-variables",
|
|
310
|
+
"data-control-family": "environment-variables",
|
|
311
|
+
"data-slot": "field-error",
|
|
312
|
+
children: valueError
|
|
313
|
+
}) : null
|
|
314
|
+
]
|
|
315
|
+
}),
|
|
316
|
+
!readOnly ? /* @__PURE__ */ jsx(Button, {
|
|
317
|
+
type: "button",
|
|
318
|
+
variant: "quiet",
|
|
319
|
+
tone: "danger",
|
|
320
|
+
size: "sm",
|
|
321
|
+
iconOnly: true,
|
|
322
|
+
disabled,
|
|
323
|
+
"aria-label": removeRowLabel,
|
|
324
|
+
title: "Remove variable",
|
|
325
|
+
className: "absolute top-2 right-1 sm:static sm:justify-self-end sm:self-start",
|
|
326
|
+
onClick: () => editor.removeRow(index),
|
|
327
|
+
children: /* @__PURE__ */ jsx(Trash2Icon, {
|
|
328
|
+
"aria-hidden": "true",
|
|
329
|
+
className: "size-3.5"
|
|
330
|
+
})
|
|
331
|
+
}) : null
|
|
332
|
+
]
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
function EnvironmentVariablesAddButton({ children = "Add variable", variant = "surface", size = "sm", disabled, onClick, ...props }) {
|
|
336
|
+
const { editor, disabled: contextDisabled, readOnly } = useEnvironmentVariablesContext("EnvironmentVariables.AddButton");
|
|
337
|
+
if (readOnly) return null;
|
|
338
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
339
|
+
type: "button",
|
|
340
|
+
variant,
|
|
341
|
+
size,
|
|
342
|
+
disabled: disabled ?? contextDisabled,
|
|
343
|
+
onClick: (event) => {
|
|
344
|
+
onClick?.(event);
|
|
345
|
+
if (!event.defaultPrevented) editor.appendRow();
|
|
346
|
+
},
|
|
347
|
+
...props,
|
|
348
|
+
children: [/* @__PURE__ */ jsx(PlusIcon, {
|
|
349
|
+
"aria-hidden": "true",
|
|
350
|
+
className: "size-3.5"
|
|
351
|
+
}), children]
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
function EnvironmentVariablesResetButton({ children = "Reset", variant = "quiet", size = "sm", disabled, onClick, ...props }) {
|
|
355
|
+
const { editor, disabled: contextDisabled, readOnly } = useEnvironmentVariablesContext("EnvironmentVariables.ResetButton");
|
|
356
|
+
if (readOnly) return null;
|
|
357
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
358
|
+
type: "button",
|
|
359
|
+
variant,
|
|
360
|
+
size,
|
|
361
|
+
disabled: disabled ?? (contextDisabled || !editor.isDirty),
|
|
362
|
+
onClick: (event) => {
|
|
363
|
+
onClick?.(event);
|
|
364
|
+
if (!event.defaultPrevented) editor.resetRows();
|
|
365
|
+
},
|
|
366
|
+
...props,
|
|
367
|
+
children: [/* @__PURE__ */ jsx(RotateCcwIcon, {
|
|
368
|
+
"aria-hidden": "true",
|
|
369
|
+
className: "size-3.5"
|
|
370
|
+
}), children]
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
function EnvironmentVariablesSubmitButton({ children = "Save", variant = "solid", tone = "primary", size = "sm", disabled, ...props }) {
|
|
374
|
+
const { editor, disabled: contextDisabled, readOnly } = useEnvironmentVariablesContext("EnvironmentVariables.SubmitButton");
|
|
375
|
+
if (readOnly) return null;
|
|
376
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
377
|
+
type: "submit",
|
|
378
|
+
variant,
|
|
379
|
+
tone,
|
|
380
|
+
size,
|
|
381
|
+
disabled: disabled ?? (contextDisabled || editor.hasDuplicateKeys),
|
|
382
|
+
...props,
|
|
383
|
+
children: [/* @__PURE__ */ jsx(SaveIcon, {
|
|
384
|
+
"aria-hidden": "true",
|
|
385
|
+
className: "size-3.5"
|
|
386
|
+
}), children]
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
function EnvironmentVariablesActions({ className, ...props }) {
|
|
390
|
+
return /* @__PURE__ */ jsx("div", {
|
|
391
|
+
"data-control-ui": "environment-variables",
|
|
392
|
+
"data-control-family": "environment-variables",
|
|
393
|
+
"data-slot": "actions",
|
|
394
|
+
className: cn("flex min-w-0 items-center justify-between", className),
|
|
395
|
+
...props
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
function EnvironmentVariablesMessage({ error, className, children, ...props }) {
|
|
399
|
+
const content = children ?? error;
|
|
400
|
+
if (!content) return null;
|
|
401
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
402
|
+
role: "alert",
|
|
403
|
+
"data-control-ui": "environment-variables",
|
|
404
|
+
"data-control-family": "environment-variables",
|
|
405
|
+
"data-slot": "message",
|
|
406
|
+
className: cn("flex items-start", className),
|
|
407
|
+
...props,
|
|
408
|
+
children: [/* @__PURE__ */ jsx(AlertTriangleIcon, {
|
|
409
|
+
"aria-hidden": "true",
|
|
410
|
+
className: "mt-0.5 size-3.5 shrink-0"
|
|
411
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
412
|
+
className: "min-w-0",
|
|
413
|
+
children: content
|
|
414
|
+
})]
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
function EnvironmentVariablesDuplicateKeysError({ message, ...props }) {
|
|
418
|
+
const { editor, duplicateKeyMessage } = useEnvironmentVariablesContext("EnvironmentVariables.DuplicateKeysError");
|
|
419
|
+
if (!editor.hasDuplicateKeys) return null;
|
|
420
|
+
return /* @__PURE__ */ jsx(EnvironmentVariablesMessage, {
|
|
421
|
+
error: message ?? duplicateKeyMessage,
|
|
422
|
+
...props
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
function EnvironmentVariablesUploadError(props) {
|
|
426
|
+
const { editor } = useEnvironmentVariablesContext("EnvironmentVariables.UploadError");
|
|
427
|
+
return /* @__PURE__ */ jsx(EnvironmentVariablesMessage, {
|
|
428
|
+
error: editor.uploadError,
|
|
429
|
+
...props
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
function EnvironmentVariablesReadOnlyList({ rows, emptyMessage = "No environment variables", className, children, ...props }) {
|
|
433
|
+
const context = use(EnvironmentVariablesContext);
|
|
434
|
+
const filledRows = (rows ?? context?.editor.rows ?? []).filter((row) => row.key.trim());
|
|
435
|
+
return /* @__PURE__ */ jsx("div", {
|
|
436
|
+
"data-control-ui": "environment-variables",
|
|
437
|
+
"data-control-family": "environment-variables",
|
|
438
|
+
"data-slot": "readonly-list",
|
|
439
|
+
className: cn("flex flex-col", className),
|
|
440
|
+
...props,
|
|
441
|
+
children: children ?? (filledRows.length > 0 ? filledRows.map((row) => /* @__PURE__ */ jsx(EnvironmentVariablesReadOnlyItem, {
|
|
442
|
+
name: row.key,
|
|
443
|
+
value: row.value
|
|
444
|
+
}, row.key)) : /* @__PURE__ */ jsx("div", {
|
|
445
|
+
"data-control-ui": "environment-variables",
|
|
446
|
+
"data-control-family": "environment-variables",
|
|
447
|
+
"data-slot": "empty",
|
|
448
|
+
children: emptyMessage
|
|
449
|
+
}))
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
function EnvironmentVariablesReadOnlyItem({ name, value = "********", revealed = false, className, ...props }) {
|
|
453
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
454
|
+
"data-control-ui": "environment-variables",
|
|
455
|
+
"data-control-family": "environment-variables",
|
|
456
|
+
"data-slot": "readonly-item",
|
|
457
|
+
className: cn("grid min-w-0 grid-cols-[minmax(0,0.9fr)_minmax(0,1.1fr)]", className),
|
|
458
|
+
...props,
|
|
459
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
460
|
+
"data-control-ui": "environment-variables",
|
|
461
|
+
"data-control-family": "environment-variables",
|
|
462
|
+
"data-slot": "readonly-key",
|
|
463
|
+
className: "min-w-0 truncate",
|
|
464
|
+
children: name
|
|
465
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
466
|
+
"data-control-ui": "environment-variables",
|
|
467
|
+
"data-control-family": "environment-variables",
|
|
468
|
+
"data-slot": "readonly-value",
|
|
469
|
+
className: "min-w-0 truncate",
|
|
470
|
+
children: revealed ? value : "********"
|
|
471
|
+
})]
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
const EnvironmentVariables = Object.assign(EnvironmentVariablesComponent, {
|
|
475
|
+
Root: EnvironmentVariablesRoot,
|
|
476
|
+
Header: EnvironmentVariablesHeader,
|
|
477
|
+
Toolbar: EnvironmentVariablesToolbar,
|
|
478
|
+
UploadButton: EnvironmentVariablesUploadButton,
|
|
479
|
+
UploadError: EnvironmentVariablesUploadError,
|
|
480
|
+
Rows: EnvironmentVariablesRows,
|
|
481
|
+
Row: EnvironmentVariablesRow,
|
|
482
|
+
AddButton: EnvironmentVariablesAddButton,
|
|
483
|
+
ResetButton: EnvironmentVariablesResetButton,
|
|
484
|
+
SubmitButton: EnvironmentVariablesSubmitButton,
|
|
485
|
+
Actions: EnvironmentVariablesActions,
|
|
486
|
+
Message: EnvironmentVariablesMessage,
|
|
487
|
+
DuplicateKeysError: EnvironmentVariablesDuplicateKeysError,
|
|
488
|
+
ReadOnlyList: EnvironmentVariablesReadOnlyList,
|
|
489
|
+
ReadOnlyItem: EnvironmentVariablesReadOnlyItem
|
|
490
|
+
});
|
|
491
|
+
//#endregion
|
|
492
|
+
export { EnvironmentVariables, EnvironmentVariablesActions, EnvironmentVariablesAddButton, EnvironmentVariablesDuplicateKeysError, EnvironmentVariablesHeader, EnvironmentVariablesMessage, EnvironmentVariablesReadOnlyItem, EnvironmentVariablesReadOnlyList, EnvironmentVariablesResetButton, EnvironmentVariablesRoot, EnvironmentVariablesRow, EnvironmentVariablesRows, EnvironmentVariablesSubmitButton, EnvironmentVariablesToolbar, EnvironmentVariablesUploadButton, EnvironmentVariablesUploadError };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/extensions/create-track-highlight.d.ts
|
|
2
|
+
type TrackHighlightOptions = {
|
|
3
|
+
/** Selector for highlightable rows, resolved within track. */
|
|
4
|
+
itemSelector: string;
|
|
5
|
+
/** Selector for resting row (active/selected) used when nothing is hovered. */
|
|
6
|
+
activeSelector: string;
|
|
7
|
+
range?: boolean;
|
|
8
|
+
followHover?: boolean;
|
|
9
|
+
};
|
|
10
|
+
declare function createTrackHighlight(track: HTMLElement, highlight: HTMLElement, options: TrackHighlightOptions, hoverHighlight?: HTMLElement): () => void;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { TrackHighlightOptions, createTrackHighlight };
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
//#region src/extensions/create-track-highlight.ts
|
|
2
|
+
const STABLE_EPSILON = .5;
|
|
3
|
+
const MAX_FOLLOW_FRAMES = 90;
|
|
4
|
+
function isHighlightable(node) {
|
|
5
|
+
return node instanceof HTMLElement && node.getAttribute("aria-disabled") !== "true" && node.getAttribute("data-disabled") !== "true" && node.checkVisibility();
|
|
6
|
+
}
|
|
7
|
+
function createTrackHighlight(track, highlight, options, hoverHighlight) {
|
|
8
|
+
const { itemSelector, activeSelector, range = false, followHover = true } = options;
|
|
9
|
+
let hovered = null;
|
|
10
|
+
let rafId = 0;
|
|
11
|
+
let followFrames = 0;
|
|
12
|
+
const activeLayer = {
|
|
13
|
+
ready: false,
|
|
14
|
+
last: {
|
|
15
|
+
x: 0,
|
|
16
|
+
y: 0,
|
|
17
|
+
w: 0,
|
|
18
|
+
h: 0
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const hoverLayer = {
|
|
22
|
+
ready: false,
|
|
23
|
+
last: {
|
|
24
|
+
x: 0,
|
|
25
|
+
y: 0,
|
|
26
|
+
w: 0,
|
|
27
|
+
h: 0
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
function measureBox(target, trackRect) {
|
|
31
|
+
const rect = target.getBoundingClientRect();
|
|
32
|
+
return {
|
|
33
|
+
x: rect.left - trackRect.left + track.scrollLeft - track.clientLeft,
|
|
34
|
+
y: rect.top - trackRect.top + track.scrollTop - track.clientTop,
|
|
35
|
+
w: rect.width,
|
|
36
|
+
h: rect.height
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function resolveActiveBox(trackRect) {
|
|
40
|
+
const actives = Array.from(track.querySelectorAll(activeSelector)).filter(isHighlightable);
|
|
41
|
+
const firstActive = actives[0];
|
|
42
|
+
if (!firstActive) return null;
|
|
43
|
+
if (!range) return measureBox(firstActive, trackRect);
|
|
44
|
+
let box = measureBox(firstActive, trackRect);
|
|
45
|
+
for (const active of actives.slice(1)) {
|
|
46
|
+
const b = measureBox(active, trackRect);
|
|
47
|
+
const left = Math.min(box.x, b.x);
|
|
48
|
+
const top = Math.min(box.y, b.y);
|
|
49
|
+
const right = Math.max(box.x + box.w, b.x + b.w);
|
|
50
|
+
const bottom = Math.max(box.y + box.h, b.y + b.h);
|
|
51
|
+
box = {
|
|
52
|
+
x: left,
|
|
53
|
+
y: top,
|
|
54
|
+
w: right - left,
|
|
55
|
+
h: bottom - top
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return box;
|
|
59
|
+
}
|
|
60
|
+
function resolveHoveredBox(trackRect) {
|
|
61
|
+
if (!followHover || !hovered || !track.contains(hovered) || !isHighlightable(hovered)) return null;
|
|
62
|
+
return measureBox(hovered, trackRect);
|
|
63
|
+
}
|
|
64
|
+
function place(element, state, next, visible) {
|
|
65
|
+
if (!next) {
|
|
66
|
+
element.removeAttribute("data-visible");
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
const moved = Math.abs(next.x - state.last.x) > STABLE_EPSILON || Math.abs(next.y - state.last.y) > STABLE_EPSILON || Math.abs(next.w - state.last.w) > STABLE_EPSILON || Math.abs(next.h - state.last.h) > STABLE_EPSILON;
|
|
70
|
+
state.last = next;
|
|
71
|
+
if (!state.ready) element.style.transition = "none";
|
|
72
|
+
element.style.left = `${next.x}px`;
|
|
73
|
+
element.style.top = `${next.y}px`;
|
|
74
|
+
element.style.right = `${track.clientWidth - (next.x + next.w)}px`;
|
|
75
|
+
element.style.bottom = `${track.clientHeight - (next.y + next.h)}px`;
|
|
76
|
+
element.toggleAttribute("data-visible", visible);
|
|
77
|
+
if (!state.ready) {
|
|
78
|
+
element.offsetWidth;
|
|
79
|
+
element.style.transition = "";
|
|
80
|
+
state.ready = true;
|
|
81
|
+
}
|
|
82
|
+
return moved;
|
|
83
|
+
}
|
|
84
|
+
function placeHighlightLayers() {
|
|
85
|
+
const trackRect = track.getBoundingClientRect();
|
|
86
|
+
const activeBox = resolveActiveBox(trackRect);
|
|
87
|
+
const hoveredBox = resolveHoveredBox(trackRect);
|
|
88
|
+
const isAway = hoveredBox !== null && hovered !== null && !hovered.matches(activeSelector);
|
|
89
|
+
track.toggleAttribute("data-track-hover", isAway);
|
|
90
|
+
const activeMoved = place(highlight, activeLayer, hoverHighlight ? activeBox : hoveredBox ?? activeBox, Boolean(activeBox || hoveredBox));
|
|
91
|
+
if (!hoverHighlight) highlight.toggleAttribute("data-hover", isAway);
|
|
92
|
+
const hoverMoved = hoverHighlight ? place(hoverHighlight, hoverLayer, hoveredBox ?? activeBox, Boolean(hoveredBox)) : false;
|
|
93
|
+
return activeMoved || hoverMoved;
|
|
94
|
+
}
|
|
95
|
+
function scheduleFollow() {
|
|
96
|
+
followFrames = 0;
|
|
97
|
+
if (rafId) return;
|
|
98
|
+
const step = () => {
|
|
99
|
+
rafId = 0;
|
|
100
|
+
if (!placeHighlightLayers() || followFrames >= MAX_FOLLOW_FRAMES) return;
|
|
101
|
+
followFrames += 1;
|
|
102
|
+
rafId = requestAnimationFrame(step);
|
|
103
|
+
};
|
|
104
|
+
rafId = requestAnimationFrame(step);
|
|
105
|
+
}
|
|
106
|
+
const onPointerOver = (event) => {
|
|
107
|
+
if (event.pointerType === "touch" || !(event.target instanceof Element)) return;
|
|
108
|
+
const item = event.target.closest(itemSelector);
|
|
109
|
+
if (!isHighlightable(item) || !track.contains(item) || item === hovered) return;
|
|
110
|
+
hovered = item;
|
|
111
|
+
scheduleFollow();
|
|
112
|
+
};
|
|
113
|
+
const onPointerLeave = () => {
|
|
114
|
+
if (!hovered) return;
|
|
115
|
+
hovered = null;
|
|
116
|
+
scheduleFollow();
|
|
117
|
+
};
|
|
118
|
+
if (followHover) {
|
|
119
|
+
track.addEventListener("pointerover", onPointerOver);
|
|
120
|
+
track.addEventListener("pointerleave", onPointerLeave);
|
|
121
|
+
}
|
|
122
|
+
const resizeObserver = new ResizeObserver(() => scheduleFollow());
|
|
123
|
+
resizeObserver.observe(track);
|
|
124
|
+
const mutationObserver = new MutationObserver(() => scheduleFollow());
|
|
125
|
+
mutationObserver.observe(track, {
|
|
126
|
+
subtree: true,
|
|
127
|
+
childList: true,
|
|
128
|
+
attributes: true,
|
|
129
|
+
attributeFilter: [
|
|
130
|
+
"data-selected",
|
|
131
|
+
"aria-selected",
|
|
132
|
+
"data-active",
|
|
133
|
+
"data-state"
|
|
134
|
+
]
|
|
135
|
+
});
|
|
136
|
+
scheduleFollow();
|
|
137
|
+
return () => {
|
|
138
|
+
if (rafId) cancelAnimationFrame(rafId);
|
|
139
|
+
track.removeEventListener("pointerover", onPointerOver);
|
|
140
|
+
track.removeEventListener("pointerleave", onPointerLeave);
|
|
141
|
+
track.removeAttribute("data-track-hover");
|
|
142
|
+
resizeObserver.disconnect();
|
|
143
|
+
mutationObserver.disconnect();
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
//#endregion
|
|
147
|
+
export { createTrackHighlight };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { TrackHighlightKnobStyle } from "../knob-contracts/track-highlight-knobs.js";
|
|
2
|
+
import { CSSProperties, ComponentProps, ReactNode, RefObject } from "react";
|
|
3
|
+
//#region src/extensions/track-highlight.d.ts
|
|
4
|
+
type TrackHighlightProps = Omit<ComponentProps<"div">, "children" | "ref" | "style"> & {
|
|
5
|
+
/** Track container (`relative isolate`) highlight is measured against. Defaults to highlight's parent element. */
|
|
6
|
+
trackRef?: RefObject<HTMLElement | null>;
|
|
7
|
+
/** Selector for highlightable rows, resolved within track. */
|
|
8
|
+
itemSelector?: string;
|
|
9
|
+
/** Selector for resting row (active/selected) used when nothing is hovered. */
|
|
10
|
+
activeSelector?: string;
|
|
11
|
+
/** Span box across union of every active row (first..last) instead of single row. */
|
|
12
|
+
range?: boolean;
|
|
13
|
+
/** Follow pointer to hovered row; turn off for purely selection/scroll-driven box. */
|
|
14
|
+
followHover?: boolean;
|
|
15
|
+
/** Non-empty = second layer that follows hover while primary layer stays pinned on selection. */
|
|
16
|
+
hoverClassName?: string;
|
|
17
|
+
children?: ReactNode;
|
|
18
|
+
style?: CSSProperties & TrackHighlightKnobStyle;
|
|
19
|
+
};
|
|
20
|
+
declare function TrackHighlight({ trackRef, itemSelector, activeSelector, range, followHover, hoverClassName, className, style, children, ...props }: TrackHighlightProps): import("react").JSX.Element;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { TrackHighlight, TrackHighlightProps };
|