@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,19 @@
|
|
|
1
|
+
import { Button } from "../ui/button.js";
|
|
2
|
+
import { SettingDefinition, SettingsControlProps, SettingsPageDefinition, SettingsSectionDefinition } from "./settings-data.js";
|
|
3
|
+
import { ComponentProps, ReactNode } from "react";
|
|
4
|
+
//#region src/blocks/settings.d.ts
|
|
5
|
+
type SettingsBlockProps = Omit<ComponentProps<"div">, "children"> & {
|
|
6
|
+
pages: readonly SettingsPageDefinition[];
|
|
7
|
+
activePageId?: string;
|
|
8
|
+
defaultActivePageId?: string;
|
|
9
|
+
onActivePageChange?: (pageId: string) => void;
|
|
10
|
+
backAction?: ReactNode;
|
|
11
|
+
searchPlaceholder?: string;
|
|
12
|
+
layout?: "viewport" | "contained";
|
|
13
|
+
};
|
|
14
|
+
declare function SettingsBlock({ pages, activePageId, defaultActivePageId, onActivePageChange, backAction, searchPlaceholder, layout, className, style, ...props }: SettingsBlockProps): import("react").JSX.Element;
|
|
15
|
+
declare function SettingsBackAction({ children, ...props }: Omit<ComponentProps<typeof Button>, "children"> & {
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
}): import("react").JSX.Element;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { type SettingDefinition, SettingsBackAction, SettingsBlock, SettingsBlockProps, type SettingsControlProps, type SettingsPageDefinition, type SettingsSectionDefinition };
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.js";
|
|
3
|
+
import { Button } from "../ui/button.js";
|
|
4
|
+
import { ScrollArea } from "../ui/scroll-area.js";
|
|
5
|
+
import { InputGroup, InputGroupAddon, InputGroupInput } from "../ui/input-group.js";
|
|
6
|
+
import { Sidebar, SidebarContent, SidebarGroup, SidebarGroupLabel, SidebarHeader, SidebarInset, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarProvider, SidebarTrigger, useSidebar } from "../ui/sidebar.js";
|
|
7
|
+
import { Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "../ui/empty.js";
|
|
8
|
+
import { searchSettings } from "./settings-data.js";
|
|
9
|
+
import { Field, FieldContent, FieldDescription, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet } from "../ui/field.js";
|
|
10
|
+
import { useEffect, useId, useState } from "react";
|
|
11
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { ArrowLeftIcon, SearchIcon, XIcon } from "lucide-react";
|
|
13
|
+
//#region src/blocks/settings.tsx
|
|
14
|
+
function SettingsBlock({ pages, activePageId, defaultActivePageId, onActivePageChange, backAction, searchPlaceholder = "Search settings", layout = "viewport", className, style, ...props }) {
|
|
15
|
+
const [internalPageId, setInternalPageId] = useState(defaultActivePageId ?? pages[0]?.id);
|
|
16
|
+
const [query, setQuery] = useState("");
|
|
17
|
+
const [pendingTarget, setPendingTarget] = useState(null);
|
|
18
|
+
const instanceId = useId();
|
|
19
|
+
const requestedPageId = activePageId ?? internalPageId;
|
|
20
|
+
const currentPage = pages.find((page) => page.id === requestedPageId) ?? pages[0];
|
|
21
|
+
const results = searchSettings(pages, query);
|
|
22
|
+
function changePage(pageId) {
|
|
23
|
+
if (activePageId === void 0) setInternalPageId(pageId);
|
|
24
|
+
onActivePageChange?.(pageId);
|
|
25
|
+
}
|
|
26
|
+
const providerStyle = {
|
|
27
|
+
"--sidebar-width": "15.5rem",
|
|
28
|
+
...style
|
|
29
|
+
};
|
|
30
|
+
return /* @__PURE__ */ jsx(SidebarProvider, {
|
|
31
|
+
"data-settings-layout": layout,
|
|
32
|
+
className: cn("overflow-hidden bg-background text-foreground", layout === "viewport" ? "h-svh min-h-svh" : "relative h-full min-h-0", className),
|
|
33
|
+
style: providerStyle,
|
|
34
|
+
...props,
|
|
35
|
+
children: /* @__PURE__ */ jsx(SettingsShell, {
|
|
36
|
+
pages,
|
|
37
|
+
currentPage,
|
|
38
|
+
query,
|
|
39
|
+
results,
|
|
40
|
+
backAction,
|
|
41
|
+
searchPlaceholder,
|
|
42
|
+
contained: layout === "contained",
|
|
43
|
+
instanceId,
|
|
44
|
+
pendingTarget,
|
|
45
|
+
onPendingTargetChange: setPendingTarget,
|
|
46
|
+
onPageChange: changePage,
|
|
47
|
+
onQueryChange: setQuery
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function SettingsShell({ pages, currentPage, query, results, backAction, searchPlaceholder, contained, instanceId, pendingTarget, onPendingTargetChange, onPageChange, onQueryChange }) {
|
|
52
|
+
const { setOpenMobile } = useSidebar();
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (!pendingTarget || currentPage?.id !== pendingTarget.pageId) return;
|
|
55
|
+
const frame = requestAnimationFrame(() => {
|
|
56
|
+
const row = document.getElementById(pendingTarget.rowId);
|
|
57
|
+
const control = document.getElementById(pendingTarget.controlId);
|
|
58
|
+
row?.scrollIntoView({
|
|
59
|
+
block: "center",
|
|
60
|
+
behavior: window.matchMedia("(prefers-reduced-motion: reduce)").matches ? "auto" : "smooth"
|
|
61
|
+
});
|
|
62
|
+
(control instanceof HTMLElement ? control : row)?.focus({ preventScroll: true });
|
|
63
|
+
onPendingTargetChange(null);
|
|
64
|
+
});
|
|
65
|
+
return () => cancelAnimationFrame(frame);
|
|
66
|
+
}, [
|
|
67
|
+
currentPage?.id,
|
|
68
|
+
onPendingTargetChange,
|
|
69
|
+
pendingTarget
|
|
70
|
+
]);
|
|
71
|
+
function navigate(pageId) {
|
|
72
|
+
onPageChange(pageId);
|
|
73
|
+
setOpenMobile(false);
|
|
74
|
+
}
|
|
75
|
+
function openResult(result) {
|
|
76
|
+
const ids = settingDomIds(instanceId, result.page.id, result.section.id, result.setting.id);
|
|
77
|
+
onPendingTargetChange({
|
|
78
|
+
pageId: result.page.id,
|
|
79
|
+
rowId: ids.row,
|
|
80
|
+
controlId: ids.control
|
|
81
|
+
});
|
|
82
|
+
navigate(result.page.id);
|
|
83
|
+
}
|
|
84
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(Sidebar, {
|
|
85
|
+
collapsible: "offcanvas",
|
|
86
|
+
className: contained ? "absolute! inset-y-0! h-full" : void 0,
|
|
87
|
+
children: [/* @__PURE__ */ jsxs(SidebarHeader, {
|
|
88
|
+
className: "gap-3 border-b border-sidebar-border p-3",
|
|
89
|
+
children: [backAction ? /* @__PURE__ */ jsx("div", {
|
|
90
|
+
className: "min-w-0",
|
|
91
|
+
children: backAction
|
|
92
|
+
}) : null, /* @__PURE__ */ jsx(SettingsSearch, {
|
|
93
|
+
value: query,
|
|
94
|
+
placeholder: searchPlaceholder,
|
|
95
|
+
onValueChange: onQueryChange
|
|
96
|
+
})]
|
|
97
|
+
}), /* @__PURE__ */ jsx(SidebarContent, { children: query.trim() ? /* @__PURE__ */ jsx(SettingsSearchNavigation, {
|
|
98
|
+
results,
|
|
99
|
+
onSelect: openResult
|
|
100
|
+
}) : /* @__PURE__ */ jsx(SettingsPageNavigation, {
|
|
101
|
+
pages,
|
|
102
|
+
activePageId: currentPage?.id,
|
|
103
|
+
onSelect: navigate
|
|
104
|
+
}) })]
|
|
105
|
+
}), /* @__PURE__ */ jsxs(SidebarInset, {
|
|
106
|
+
className: "h-full min-h-0 min-w-0",
|
|
107
|
+
children: [/* @__PURE__ */ jsxs("header", {
|
|
108
|
+
className: "flex h-12 shrink-0 items-center gap-2 border-b px-3 md:hidden",
|
|
109
|
+
children: [/* @__PURE__ */ jsx(SidebarTrigger, {}), /* @__PURE__ */ jsx("span", {
|
|
110
|
+
className: "truncate text-label font-medium",
|
|
111
|
+
children: currentPage?.title ?? "Settings"
|
|
112
|
+
})]
|
|
113
|
+
}), /* @__PURE__ */ jsx(ScrollArea, {
|
|
114
|
+
className: "min-h-0 flex-1",
|
|
115
|
+
lockAxis: "x",
|
|
116
|
+
children: currentPage ? /* @__PURE__ */ jsx(SettingsPage, {
|
|
117
|
+
page: currentPage,
|
|
118
|
+
instanceId
|
|
119
|
+
}) : /* @__PURE__ */ jsx(SettingsEmpty, {
|
|
120
|
+
title: "No settings",
|
|
121
|
+
description: "Add a settings page to populate this space."
|
|
122
|
+
})
|
|
123
|
+
})]
|
|
124
|
+
})] });
|
|
125
|
+
}
|
|
126
|
+
function SettingsSearch({ value, placeholder, onValueChange }) {
|
|
127
|
+
return /* @__PURE__ */ jsxs(InputGroup, {
|
|
128
|
+
size: "sm",
|
|
129
|
+
children: [
|
|
130
|
+
/* @__PURE__ */ jsx(InputGroupAddon, {
|
|
131
|
+
className: "pl-2.5",
|
|
132
|
+
children: /* @__PURE__ */ jsx(SearchIcon, {
|
|
133
|
+
className: "size-3.5",
|
|
134
|
+
"aria-hidden": "true"
|
|
135
|
+
})
|
|
136
|
+
}),
|
|
137
|
+
/* @__PURE__ */ jsx(InputGroupInput, {
|
|
138
|
+
type: "search",
|
|
139
|
+
"aria-label": placeholder,
|
|
140
|
+
placeholder,
|
|
141
|
+
value,
|
|
142
|
+
onChange: (event) => onValueChange(event.currentTarget.value)
|
|
143
|
+
}),
|
|
144
|
+
value ? /* @__PURE__ */ jsx(Button, {
|
|
145
|
+
variant: "ghost",
|
|
146
|
+
size: "xs",
|
|
147
|
+
iconOnly: true,
|
|
148
|
+
"aria-label": "Clear settings search",
|
|
149
|
+
className: "mr-1",
|
|
150
|
+
onClick: () => onValueChange(""),
|
|
151
|
+
children: /* @__PURE__ */ jsx(XIcon, { className: "size-3.5" })
|
|
152
|
+
}) : null
|
|
153
|
+
]
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
function SettingsPageNavigation({ pages, activePageId, onSelect }) {
|
|
157
|
+
return /* @__PURE__ */ jsxs(SidebarGroup, { children: [/* @__PURE__ */ jsx(SidebarGroupLabel, { children: "Settings" }), /* @__PURE__ */ jsx(SidebarMenu, { children: pages.map((page) => /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(SidebarMenuButton, {
|
|
158
|
+
size: "sm",
|
|
159
|
+
isActive: page.id === activePageId,
|
|
160
|
+
onClick: () => onSelect(page.id),
|
|
161
|
+
children: [page.icon, /* @__PURE__ */ jsx("span", { children: page.title })]
|
|
162
|
+
}) }, page.id)) })] });
|
|
163
|
+
}
|
|
164
|
+
function SettingsSearchNavigation({ results, onSelect }) {
|
|
165
|
+
if (results.length === 0) return /* @__PURE__ */ jsx(SettingsEmpty, {
|
|
166
|
+
title: "No matching settings",
|
|
167
|
+
description: "Try another name or keyword."
|
|
168
|
+
});
|
|
169
|
+
const groups = /* @__PURE__ */ new Map();
|
|
170
|
+
for (const result of results) {
|
|
171
|
+
const group = groups.get(result.page.id) ?? {
|
|
172
|
+
page: result.page,
|
|
173
|
+
results: []
|
|
174
|
+
};
|
|
175
|
+
group.results.push(result);
|
|
176
|
+
groups.set(result.page.id, group);
|
|
177
|
+
}
|
|
178
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("span", {
|
|
179
|
+
className: "sr-only",
|
|
180
|
+
role: "status",
|
|
181
|
+
"aria-live": "polite",
|
|
182
|
+
children: [
|
|
183
|
+
results.length,
|
|
184
|
+
" ",
|
|
185
|
+
results.length === 1 ? "setting" : "settings",
|
|
186
|
+
" found"
|
|
187
|
+
]
|
|
188
|
+
}), [...groups.values()].map((group) => /* @__PURE__ */ jsxs(SidebarGroup, { children: [/* @__PURE__ */ jsxs(SidebarGroupLabel, { children: [group.page.icon, /* @__PURE__ */ jsx("span", { children: group.page.title })] }), /* @__PURE__ */ jsx(SidebarMenu, { children: group.results.map((result) => /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(SidebarMenuButton, {
|
|
189
|
+
size: "sm",
|
|
190
|
+
className: "h-auto min-h-[var(--control-h-sm)] py-1.5",
|
|
191
|
+
onClick: () => onSelect(result),
|
|
192
|
+
children: /* @__PURE__ */ jsx("span", { children: result.setting.title })
|
|
193
|
+
}) }, `${result.section.id}/${result.setting.id}`)) })] }, group.page.id))] });
|
|
194
|
+
}
|
|
195
|
+
function SettingsPage({ page, instanceId }) {
|
|
196
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
197
|
+
className: "mx-auto flex w-full max-w-4xl flex-col gap-10 px-5 py-8 md:px-10 md:py-12",
|
|
198
|
+
children: [/* @__PURE__ */ jsx("h1", {
|
|
199
|
+
className: "text-heading font-semibold text-foreground text-balance",
|
|
200
|
+
children: page.title
|
|
201
|
+
}), page.sections.map((section) => /* @__PURE__ */ jsxs(FieldSet, {
|
|
202
|
+
className: "gap-3",
|
|
203
|
+
children: [/* @__PURE__ */ jsx(FieldLegend, {
|
|
204
|
+
className: "text-body font-semibold",
|
|
205
|
+
children: section.title
|
|
206
|
+
}), /* @__PURE__ */ jsx(FieldGroup, {
|
|
207
|
+
className: "gap-0 overflow-hidden rounded-[var(--radius-lg)] border bg-card",
|
|
208
|
+
children: section.settings.map((setting, index) => /* @__PURE__ */ jsx(SettingsRow, {
|
|
209
|
+
pageId: page.id,
|
|
210
|
+
sectionId: section.id,
|
|
211
|
+
setting,
|
|
212
|
+
instanceId,
|
|
213
|
+
separated: index > 0
|
|
214
|
+
}, setting.id))
|
|
215
|
+
})]
|
|
216
|
+
}, section.id))]
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
function SettingsRow({ pageId, sectionId, setting, instanceId, separated }) {
|
|
220
|
+
const ids = settingDomIds(instanceId, pageId, sectionId, setting.id);
|
|
221
|
+
const controlProps = {
|
|
222
|
+
id: ids.control,
|
|
223
|
+
"aria-labelledby": ids.label,
|
|
224
|
+
"aria-describedby": setting.description ? ids.description : void 0
|
|
225
|
+
};
|
|
226
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [separated ? /* @__PURE__ */ jsx(FieldSeparator, {}) : null, /* @__PURE__ */ jsxs(Field, {
|
|
227
|
+
id: ids.row,
|
|
228
|
+
orientation: "responsive",
|
|
229
|
+
tabIndex: -1,
|
|
230
|
+
className: "scroll-m-8 gap-3 p-4 outline-none transition-colors duration-[var(--duration-fast)] focus:bg-foreground/4 focus-within:bg-foreground/4",
|
|
231
|
+
children: [/* @__PURE__ */ jsxs(FieldContent, { children: [/* @__PURE__ */ jsx(FieldLabel, {
|
|
232
|
+
id: ids.label,
|
|
233
|
+
htmlFor: ids.control,
|
|
234
|
+
className: "leading-snug",
|
|
235
|
+
children: setting.title
|
|
236
|
+
}), setting.description ? /* @__PURE__ */ jsx(FieldDescription, {
|
|
237
|
+
id: ids.description,
|
|
238
|
+
children: setting.description
|
|
239
|
+
}) : null] }), /* @__PURE__ */ jsx("div", {
|
|
240
|
+
className: "flex shrink-0 items-center",
|
|
241
|
+
children: setting.renderControl(controlProps)
|
|
242
|
+
})]
|
|
243
|
+
})] });
|
|
244
|
+
}
|
|
245
|
+
function SettingsEmpty({ title, description }) {
|
|
246
|
+
return /* @__PURE__ */ jsx(Empty, {
|
|
247
|
+
className: "min-h-40 gap-3 p-4",
|
|
248
|
+
children: /* @__PURE__ */ jsxs(EmptyHeader, { children: [
|
|
249
|
+
/* @__PURE__ */ jsx(EmptyMedia, {
|
|
250
|
+
className: "mb-0 size-8",
|
|
251
|
+
children: /* @__PURE__ */ jsx(SearchIcon, { className: "size-4" })
|
|
252
|
+
}),
|
|
253
|
+
/* @__PURE__ */ jsx(EmptyTitle, { children: title }),
|
|
254
|
+
/* @__PURE__ */ jsx(EmptyDescription, { children: description })
|
|
255
|
+
] })
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
function settingDomIds(instanceId, pageId, sectionId, settingId) {
|
|
259
|
+
const base = [
|
|
260
|
+
instanceId,
|
|
261
|
+
pageId,
|
|
262
|
+
sectionId,
|
|
263
|
+
settingId
|
|
264
|
+
].map((value) => value.replace(/[^a-zA-Z0-9_-]/g, "-")).join("-");
|
|
265
|
+
return {
|
|
266
|
+
row: `${base}-row`,
|
|
267
|
+
control: `${base}-control`,
|
|
268
|
+
label: `${base}-label`,
|
|
269
|
+
description: `${base}-description`
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
function SettingsBackAction({ children = "Back to app", ...props }) {
|
|
273
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
274
|
+
variant: "quiet",
|
|
275
|
+
size: "sm",
|
|
276
|
+
className: "-ml-1 justify-start gap-2",
|
|
277
|
+
...props,
|
|
278
|
+
children: [/* @__PURE__ */ jsx(ArrowLeftIcon, { className: "size-4" }), children]
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
//#endregion
|
|
282
|
+
export { SettingsBackAction, SettingsBlock };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Button } from "../ui/button.js";
|
|
2
|
+
import { DropdownMenuTrigger } from "../ui/dropdown-menu.js";
|
|
3
|
+
import { Switch } from "../ui/switch.js";
|
|
4
|
+
import { ComponentProps, ComponentType } from "react";
|
|
5
|
+
//#region src/blocks/theme-toggle.d.ts
|
|
6
|
+
type ThemeMode = "light" | "dark" | "system";
|
|
7
|
+
type ThemeToggleOption = {
|
|
8
|
+
value: ThemeMode;
|
|
9
|
+
label: string;
|
|
10
|
+
icon: ComponentType<{
|
|
11
|
+
className?: string;
|
|
12
|
+
"aria-hidden"?: boolean;
|
|
13
|
+
}>;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
};
|
|
16
|
+
type ThemeControlProps = {
|
|
17
|
+
value: ThemeMode;
|
|
18
|
+
onValueChange: (value: ThemeMode) => void;
|
|
19
|
+
options?: readonly ThemeToggleOption[];
|
|
20
|
+
};
|
|
21
|
+
type ThemeToggleProps = Omit<ComponentProps<typeof Button>, "value" | "onChange"> & ThemeControlProps & {
|
|
22
|
+
showLabel?: boolean;
|
|
23
|
+
showLabels?: boolean;
|
|
24
|
+
};
|
|
25
|
+
type ThemeSwitchProps = Omit<ComponentProps<typeof Switch>, "checked" | "defaultChecked" | "onCheckedChange" | "value"> & {
|
|
26
|
+
value: ThemeMode;
|
|
27
|
+
onValueChange: (value: ThemeMode) => void;
|
|
28
|
+
onValue?: ThemeMode;
|
|
29
|
+
offValue?: ThemeMode;
|
|
30
|
+
};
|
|
31
|
+
type ThemeSegmentedSwitchProps = Omit<ComponentProps<"div">, "onChange"> & ThemeControlProps & {
|
|
32
|
+
name?: string;
|
|
33
|
+
showLabels?: boolean;
|
|
34
|
+
};
|
|
35
|
+
type ThemeDropdownProps = Omit<ComponentProps<typeof DropdownMenuTrigger>, "children" | "value" | "onChange"> & ThemeControlProps & {
|
|
36
|
+
label?: string;
|
|
37
|
+
};
|
|
38
|
+
declare function ThemeSwitch({ value, onValueChange, onValue, offValue, checkedIcon, uncheckedIcon, "aria-label": ariaLabel, ...props }: ThemeSwitchProps): import("react").JSX.Element;
|
|
39
|
+
declare function ThemeSegmentedSwitch({ value, onValueChange, options, showLabels, name, className, style, "aria-label": ariaLabel, ...props }: ThemeSegmentedSwitchProps): import("react").JSX.Element;
|
|
40
|
+
declare function ThemeToggle({ value, onValueChange, options, showLabel, showLabels, className, onClick, "aria-label": ariaLabel, ...props }: ThemeToggleProps): import("react").JSX.Element;
|
|
41
|
+
declare function ThemeDropdown({ value, onValueChange, options, label, className, "aria-label": ariaLabel, ...props }: ThemeDropdownProps): import("react").JSX.Element;
|
|
42
|
+
//#endregion
|
|
43
|
+
export { ThemeDropdown, ThemeDropdownProps, ThemeMode, ThemeSegmentedSwitch, ThemeSegmentedSwitchProps, ThemeSwitch, ThemeSwitchProps, ThemeToggle, ThemeToggleOption, ThemeToggleProps };
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Button } from "../ui/button.js";
|
|
3
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuTrigger } from "../ui/dropdown-menu.js";
|
|
4
|
+
import { Switch } from "../ui/switch.js";
|
|
5
|
+
import { useId } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { CheckIcon, ChevronDownIcon, MonitorIcon, MoonIcon, SunIcon } from "lucide-react";
|
|
8
|
+
//#region src/blocks/theme-toggle.tsx
|
|
9
|
+
const systemThemeOption = {
|
|
10
|
+
value: "system",
|
|
11
|
+
label: "System",
|
|
12
|
+
icon: MonitorIcon
|
|
13
|
+
};
|
|
14
|
+
const defaultThemeOptions = [
|
|
15
|
+
{
|
|
16
|
+
value: "light",
|
|
17
|
+
label: "Light",
|
|
18
|
+
icon: SunIcon
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
value: "dark",
|
|
22
|
+
label: "Dark",
|
|
23
|
+
icon: MoonIcon
|
|
24
|
+
},
|
|
25
|
+
systemThemeOption
|
|
26
|
+
];
|
|
27
|
+
const defaultSwitchCheckedIcon = /* @__PURE__ */ jsx(MoonIcon, {});
|
|
28
|
+
const defaultSwitchUncheckedIcon = /* @__PURE__ */ jsx(SunIcon, {});
|
|
29
|
+
function classes(...values) {
|
|
30
|
+
return values.filter(Boolean).join(" ");
|
|
31
|
+
}
|
|
32
|
+
function enabledOptions(options) {
|
|
33
|
+
return options.filter((option) => !option.disabled);
|
|
34
|
+
}
|
|
35
|
+
function controlOptions(options) {
|
|
36
|
+
return options.length > 0 ? options : defaultThemeOptions;
|
|
37
|
+
}
|
|
38
|
+
function currentThemeOption(value, options) {
|
|
39
|
+
return options.find((option) => option.value === value) ?? defaultThemeOptions.find((option) => option.value === value) ?? systemThemeOption;
|
|
40
|
+
}
|
|
41
|
+
function effectiveThemeValue(value, options) {
|
|
42
|
+
if (options.some((option) => option.value === value)) return value;
|
|
43
|
+
return enabledOptions(options)[0]?.value ?? options[0]?.value ?? "system";
|
|
44
|
+
}
|
|
45
|
+
function nextThemeValue(value, options) {
|
|
46
|
+
const available = enabledOptions(options);
|
|
47
|
+
if (available.length === 0) return value;
|
|
48
|
+
return available[(available.findIndex((option) => option.value === value) + 1) % available.length]?.value ?? available[0]?.value ?? value;
|
|
49
|
+
}
|
|
50
|
+
function ThemeSwitch({ value, onValueChange, onValue = "dark", offValue = "light", checkedIcon, uncheckedIcon, "aria-label": ariaLabel, ...props }) {
|
|
51
|
+
return /* @__PURE__ */ jsx(Switch, {
|
|
52
|
+
checked: value === onValue,
|
|
53
|
+
checkedIcon: checkedIcon ?? defaultSwitchCheckedIcon,
|
|
54
|
+
uncheckedIcon: uncheckedIcon ?? defaultSwitchUncheckedIcon,
|
|
55
|
+
onCheckedChange: (checked) => onValueChange(checked ? onValue : offValue),
|
|
56
|
+
"aria-label": ariaLabel ?? "Dark mode",
|
|
57
|
+
...props
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function ThemeSegmentedSwitch({ value, onValueChange, options = defaultThemeOptions, showLabels = false, name, className, style, "aria-label": ariaLabel = "Theme", ...props }) {
|
|
61
|
+
const generatedName = useId();
|
|
62
|
+
const choices = controlOptions(options);
|
|
63
|
+
const currentValue = effectiveThemeValue(value, choices);
|
|
64
|
+
const activeIndex = Math.max(0, choices.findIndex((option) => option.value === currentValue));
|
|
65
|
+
const indicatorStyle = {
|
|
66
|
+
width: `calc((100% - 0.25rem) / ${choices.length})`,
|
|
67
|
+
transform: `translateX(${activeIndex * 100}%)`
|
|
68
|
+
};
|
|
69
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
70
|
+
role: "radiogroup",
|
|
71
|
+
"aria-label": ariaLabel,
|
|
72
|
+
className: classes("relative isolate inline-flex h-7 w-fit shrink-0 rounded-full border border-border bg-foreground/8 p-0.5 text-muted-foreground shadow-inner", className),
|
|
73
|
+
style,
|
|
74
|
+
...props,
|
|
75
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
76
|
+
"aria-hidden": true,
|
|
77
|
+
className: "pointer-events-none absolute inset-y-0.5 left-0.5 rounded-full bg-background shadow-sm transition-transform duration-[var(--duration-base)] ease-[var(--ease-emphasized)]",
|
|
78
|
+
style: indicatorStyle
|
|
79
|
+
}), choices.map((option) => {
|
|
80
|
+
const selected = option.value === currentValue;
|
|
81
|
+
const Icon = option.icon;
|
|
82
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
83
|
+
"data-selected": selected ? "true" : void 0,
|
|
84
|
+
"data-disabled": option.disabled ? "true" : void 0,
|
|
85
|
+
className: classes("relative z-[1] inline-flex h-6 cursor-pointer items-center justify-center gap-1.5 rounded-full px-1.5 text-xs font-medium outline-none transition-[color,scale] duration-[var(--duration-fast)] ease-[var(--ease-standard)] hover:text-foreground has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-foreground/25 data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-45 data-[selected=true]:text-foreground active:scale-95", showLabels ? "min-w-20" : "w-7"),
|
|
86
|
+
children: [
|
|
87
|
+
/* @__PURE__ */ jsx("input", {
|
|
88
|
+
type: "radio",
|
|
89
|
+
name: name ?? generatedName,
|
|
90
|
+
value: option.value,
|
|
91
|
+
checked: selected,
|
|
92
|
+
disabled: option.disabled,
|
|
93
|
+
"aria-label": option.label,
|
|
94
|
+
className: "sr-only",
|
|
95
|
+
onChange: (event) => {
|
|
96
|
+
if (event.currentTarget.checked) onValueChange(option.value);
|
|
97
|
+
}
|
|
98
|
+
}),
|
|
99
|
+
/* @__PURE__ */ jsx(Icon, {
|
|
100
|
+
className: "size-3.5",
|
|
101
|
+
"aria-hidden": true
|
|
102
|
+
}),
|
|
103
|
+
showLabels ? /* @__PURE__ */ jsx("span", { children: option.label }) : null
|
|
104
|
+
]
|
|
105
|
+
}, option.value);
|
|
106
|
+
})]
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function ThemeToggle({ value, onValueChange, options = defaultThemeOptions, showLabel, showLabels, className, onClick, "aria-label": ariaLabel, ...props }) {
|
|
110
|
+
const current = currentThemeOption(value, options);
|
|
111
|
+
const Icon = current.icon;
|
|
112
|
+
const visibleLabel = showLabel ?? showLabels ?? false;
|
|
113
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
114
|
+
variant: "surface",
|
|
115
|
+
size: "sm",
|
|
116
|
+
className: classes("gap-2", className),
|
|
117
|
+
"aria-label": ariaLabel ?? `Theme: ${current.label}`,
|
|
118
|
+
onClick: (event) => {
|
|
119
|
+
onClick?.(event);
|
|
120
|
+
if (!event.defaultPrevented) onValueChange(nextThemeValue(value, options));
|
|
121
|
+
},
|
|
122
|
+
...props,
|
|
123
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
124
|
+
className: "size-3.5",
|
|
125
|
+
"aria-hidden": true
|
|
126
|
+
}), visibleLabel ? /* @__PURE__ */ jsx("span", { children: current.label }) : null]
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
function ThemeDropdown({ value, onValueChange, options = defaultThemeOptions, label = "Theme", className, "aria-label": ariaLabel, ...props }) {
|
|
130
|
+
const current = currentThemeOption(value, options);
|
|
131
|
+
const CurrentIcon = current.icon;
|
|
132
|
+
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsxs(DropdownMenuTrigger, {
|
|
133
|
+
"aria-label": ariaLabel ?? label,
|
|
134
|
+
className: classes("min-w-36 gap-2", className),
|
|
135
|
+
...props,
|
|
136
|
+
children: [
|
|
137
|
+
/* @__PURE__ */ jsx(CurrentIcon, {
|
|
138
|
+
className: "size-3.5",
|
|
139
|
+
"aria-hidden": true
|
|
140
|
+
}),
|
|
141
|
+
/* @__PURE__ */ jsx("span", {
|
|
142
|
+
className: "min-w-0 truncate",
|
|
143
|
+
children: current.label
|
|
144
|
+
}),
|
|
145
|
+
/* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
146
|
+
className: "size-3 text-muted-foreground",
|
|
147
|
+
"aria-hidden": true
|
|
148
|
+
})
|
|
149
|
+
]
|
|
150
|
+
}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
|
|
151
|
+
className: "min-w-40",
|
|
152
|
+
children: [/* @__PURE__ */ jsx(DropdownMenuLabel, { children: label }), options.map((option) => {
|
|
153
|
+
const selected = option.value === value;
|
|
154
|
+
const Icon = option.icon;
|
|
155
|
+
return /* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
156
|
+
disabled: option.disabled,
|
|
157
|
+
onClick: () => onValueChange(option.value),
|
|
158
|
+
children: [
|
|
159
|
+
/* @__PURE__ */ jsx(Icon, {
|
|
160
|
+
className: "size-3.5",
|
|
161
|
+
"aria-hidden": true
|
|
162
|
+
}),
|
|
163
|
+
/* @__PURE__ */ jsx("span", {
|
|
164
|
+
className: "min-w-0 flex-1 truncate",
|
|
165
|
+
children: option.label
|
|
166
|
+
}),
|
|
167
|
+
selected ? /* @__PURE__ */ jsx(CheckIcon, {
|
|
168
|
+
className: "size-3.5",
|
|
169
|
+
"aria-hidden": true
|
|
170
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
171
|
+
className: "size-3.5",
|
|
172
|
+
"aria-hidden": true
|
|
173
|
+
})
|
|
174
|
+
]
|
|
175
|
+
}, option.value);
|
|
176
|
+
})]
|
|
177
|
+
})] });
|
|
178
|
+
}
|
|
179
|
+
//#endregion
|
|
180
|
+
export { ThemeDropdown, ThemeSegmentedSwitch, ThemeSwitch, ThemeToggle };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ButtonKnobStyle } from "./knob-contracts/button-knobs.js";
|
|
2
|
+
import { Button } from "./ui/button.js";
|
|
3
|
+
import { ChatComposerAttachmentKnobStyle } from "./knob-contracts/chat-composer-attachment-knobs.js";
|
|
4
|
+
import { CSSProperties, ComponentProps, ReactNode } from "react";
|
|
5
|
+
//#region src/chat-composer-attachment.d.ts
|
|
6
|
+
type ChatComposerAttachmentKind = "image" | "pdf" | "spreadsheet" | "document" | "archive" | "audio" | "video" | "file";
|
|
7
|
+
type ChatComposerAttachmentStatus = "idle" | "uploading" | "uploaded" | "error";
|
|
8
|
+
type ChatComposerAttachmentVariant = "auto" | "preview" | "file";
|
|
9
|
+
type ChatComposerAttachmentsProps = ComponentProps<"div"> & {
|
|
10
|
+
label?: string;
|
|
11
|
+
viewportClassName?: string;
|
|
12
|
+
} & {
|
|
13
|
+
style?: CSSProperties & ChatComposerAttachmentKnobStyle;
|
|
14
|
+
};
|
|
15
|
+
declare function ChatComposerAttachments({ label, className, viewportClassName, children, ...props }: ChatComposerAttachmentsProps): import("react").JSX.Element;
|
|
16
|
+
type ChatComposerAttachmentProps = Omit<ComponentProps<"li">, "style"> & {
|
|
17
|
+
name: string;
|
|
18
|
+
type?: string;
|
|
19
|
+
description?: ReactNode;
|
|
20
|
+
status?: ChatComposerAttachmentStatus;
|
|
21
|
+
progress?: number;
|
|
22
|
+
previewUrl?: string;
|
|
23
|
+
kind?: ChatComposerAttachmentKind;
|
|
24
|
+
variant?: ChatComposerAttachmentVariant;
|
|
25
|
+
onRemove?: () => void;
|
|
26
|
+
removeLabel?: string;
|
|
27
|
+
style?: CSSProperties & ChatComposerAttachmentKnobStyle;
|
|
28
|
+
};
|
|
29
|
+
declare function ChatComposerAttachment({ name, type, description, status, progress: progressInput, previewUrl, kind, variant, onRemove, removeLabel, className, children, role, "aria-label": ariaLabel, ...props }: ChatComposerAttachmentProps): import("react").JSX.Element;
|
|
30
|
+
type ChatComposerAttachmentPreviewProps = Omit<ComponentProps<"div">, "style"> & {
|
|
31
|
+
style?: CSSProperties & ChatComposerAttachmentKnobStyle;
|
|
32
|
+
};
|
|
33
|
+
declare function ChatComposerAttachmentPreview({ className, children, ...props }: ChatComposerAttachmentPreviewProps): import("react").JSX.Element;
|
|
34
|
+
type ChatComposerAttachmentContentProps = ComponentProps<"div"> & {
|
|
35
|
+
style?: CSSProperties & ChatComposerAttachmentKnobStyle;
|
|
36
|
+
};
|
|
37
|
+
declare function ChatComposerAttachmentContent({ className, ...props }: ChatComposerAttachmentContentProps): import("react").JSX.Element;
|
|
38
|
+
type ChatComposerAttachmentTitleProps = Omit<ComponentProps<"div">, "style"> & {
|
|
39
|
+
style?: CSSProperties & ChatComposerAttachmentKnobStyle;
|
|
40
|
+
};
|
|
41
|
+
declare function ChatComposerAttachmentTitle({ className, children, ...props }: ChatComposerAttachmentTitleProps): import("react").JSX.Element;
|
|
42
|
+
type ChatComposerAttachmentDescriptionProps = Omit<ComponentProps<"div">, "style"> & {
|
|
43
|
+
style?: CSSProperties & ChatComposerAttachmentKnobStyle;
|
|
44
|
+
};
|
|
45
|
+
declare function ChatComposerAttachmentDescription({ className, children, ...props }: ChatComposerAttachmentDescriptionProps): import("react").JSX.Element;
|
|
46
|
+
type ChatComposerAttachmentRemoveProps = Omit<ComponentProps<typeof Button>, "style"> & {
|
|
47
|
+
style?: CSSProperties & ButtonKnobStyle & ChatComposerAttachmentKnobStyle;
|
|
48
|
+
};
|
|
49
|
+
declare function ChatComposerAttachmentRemove({ className, onClick, children, "aria-label": ariaLabel, ...props }: ChatComposerAttachmentRemoveProps): import("react").JSX.Element | null;
|
|
50
|
+
type ChatComposerAttachmentProgressProps = Omit<ComponentProps<"div">, "style"> & {
|
|
51
|
+
style?: CSSProperties & ChatComposerAttachmentKnobStyle;
|
|
52
|
+
};
|
|
53
|
+
declare function ChatComposerAttachmentProgress({ className, children, style, ...props }: ChatComposerAttachmentProgressProps): import("react").JSX.Element | null;
|
|
54
|
+
//#endregion
|
|
55
|
+
export { ChatComposerAttachment, ChatComposerAttachmentContent, ChatComposerAttachmentContentProps, ChatComposerAttachmentDescription, ChatComposerAttachmentDescriptionProps, ChatComposerAttachmentKind, ChatComposerAttachmentPreview, ChatComposerAttachmentPreviewProps, ChatComposerAttachmentProgress, ChatComposerAttachmentProgressProps, ChatComposerAttachmentProps, ChatComposerAttachmentRemove, ChatComposerAttachmentRemoveProps, ChatComposerAttachmentStatus, ChatComposerAttachmentTitle, ChatComposerAttachmentTitleProps, ChatComposerAttachmentVariant, ChatComposerAttachments, ChatComposerAttachmentsProps };
|