@ctrl-ui/react 0.8.1 → 0.8.4
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 +32 -23
- package/dist/action-bar.d.ts +11 -12
- package/dist/activity.d.ts +24 -25
- package/dist/audio-recorder.d.ts +16 -16
- package/dist/audio-visualizer.d.ts +3 -4
- package/dist/blocks/chat.d.ts +3 -4
- package/dist/blocks/chat.js +6 -3
- package/dist/blocks/coding-agent.d.ts +11 -12
- package/dist/blocks/coding-agent.js +10 -9
- package/dist/blocks/file-explorer-data.d.ts +11 -12
- package/dist/blocks/file-explorer.d.ts +3 -3
- package/dist/blocks/settings-data.d.ts +8 -9
- package/dist/blocks/settings.d.ts +4 -4
- package/dist/blocks/theme-toggle.d.ts +11 -12
- package/dist/blocks/theme-toggle.js +14 -4
- package/dist/chat-composer-attachment.d.ts +20 -21
- package/dist/chat-composer-attachment.js +24 -20
- package/dist/chat-composer-editor/extensions/mention.d.ts +5 -6
- package/dist/chat-composer-editor/ghost.d.ts +3 -4
- package/dist/chat-composer-editor/schema.d.ts +2 -3
- package/dist/chat-composer-editor/serialize.d.ts +3 -4
- package/dist/chat-composer-editor/types.d.ts +5 -6
- package/dist/chat-composer-editor.d.ts +2 -3
- package/dist/chat-composer-editor.js +18 -4
- package/dist/chat-composer.d.ts +17 -18
- package/dist/chat-composer.js +14 -8
- package/dist/chat-layout.d.ts +12 -21
- package/dist/chat-layout.js +28 -83
- package/dist/chat-message.d.ts +14 -15
- package/dist/context-model.d.ts +7 -8
- package/dist/context.d.ts +21 -22
- package/dist/control-props.d.ts +10 -11
- package/dist/control-variants.d.ts +6 -7
- package/dist/dynamic-notification-glass.d.ts +3 -4
- package/dist/dynamic-notification-liquid.d.ts +3 -4
- package/dist/dynamic-notification-siri-wave.d.ts +2 -3
- package/dist/dynamic-notification.d.ts +28 -29
- package/dist/email/email.d.ts +6 -7
- package/dist/email/email.js +12 -3
- package/dist/email/length.d.ts +3 -0
- package/dist/email/length.js +34 -0
- package/dist/email/templates.d.ts +7 -8
- package/dist/email/templates.js +5 -5
- package/dist/email/theme.d.ts +16 -5
- package/dist/email/theme.js +21 -6
- package/dist/environment-variables.d.ts +35 -36
- package/dist/extensions/create-track-highlight.d.ts +3 -4
- package/dist/extensions/supports-anchor-transitions.d.ts +2 -3
- package/dist/extensions/track-highlight.d.ts +3 -4
- package/dist/hooks/use-audio-recorder.d.ts +14 -15
- package/dist/hooks/use-chat-composer.d.ts +5 -6
- package/dist/hooks/use-chat-message.d.ts +7 -8
- package/dist/hooks/use-color-area.d.ts +5 -6
- package/dist/hooks/use-copy-to-clipboard.d.ts +7 -8
- package/dist/hooks/use-dropzone.d.ts +11 -12
- package/dist/hooks/use-dynamic-notification.d.ts +6 -7
- package/dist/hooks/use-environment-variables.d.ts +9 -10
- package/dist/hooks/use-keyboard-navigation.d.ts +3 -0
- package/dist/hooks/use-keyboard-navigation.js +22 -0
- package/dist/hooks/use-mobile.d.ts +2 -3
- package/dist/hooks/use-textarea-trigger-menu.d.ts +2 -3
- package/dist/hooks/use-trigger-menu.d.ts +7 -8
- package/dist/hooks/use-user-ask.d.ts +6 -7
- package/dist/inline-attachment.d.ts +16 -17
- package/dist/inline-citation.d.ts +22 -23
- package/dist/knob-contracts/accordion-knobs.d.ts +3 -4
- package/dist/knob-contracts/accordion-knobs.js +1 -0
- package/dist/knob-contracts/action-bar-knobs.d.ts +3 -4
- package/dist/knob-contracts/activity-knobs.d.ts +3 -4
- package/dist/knob-contracts/alert-knobs.d.ts +3 -4
- package/dist/knob-contracts/alert-knobs.js +12 -1
- package/dist/knob-contracts/audio-recorder-knobs.d.ts +3 -4
- package/dist/knob-contracts/audio-visualizer-knobs.d.ts +3 -4
- package/dist/knob-contracts/avatar-knobs.d.ts +3 -4
- package/dist/knob-contracts/avatar-knobs.js +2 -1
- package/dist/knob-contracts/badge-knobs.d.ts +3 -4
- package/dist/knob-contracts/button-group-knobs.d.ts +3 -4
- package/dist/knob-contracts/button-knobs.d.ts +3 -4
- package/dist/knob-contracts/button-knobs.js +1 -0
- package/dist/knob-contracts/calendar-knobs.d.ts +3 -4
- package/dist/knob-contracts/card-knobs.d.ts +3 -4
- package/dist/knob-contracts/chat-composer-attachment-knobs.d.ts +3 -4
- package/dist/knob-contracts/chat-composer-attachment-knobs.js +3 -1
- package/dist/knob-contracts/chat-composer-knobs.d.ts +3 -4
- package/dist/knob-contracts/chat-composer-knobs.js +1 -0
- package/dist/knob-contracts/chat-layout-knobs.d.ts +3 -4
- package/dist/knob-contracts/chat-layout-knobs.js +2 -3
- package/dist/knob-contracts/chat-message-knobs.d.ts +3 -4
- package/dist/knob-contracts/choice-knobs.d.ts +3 -4
- package/dist/knob-contracts/choice-knobs.js +2 -1
- package/dist/knob-contracts/code-diff-knobs.d.ts +3 -4
- package/dist/knob-contracts/code-diff-knobs.js +1 -0
- package/dist/knob-contracts/code-knobs.d.ts +3 -4
- package/dist/knob-contracts/code-knobs.js +3 -1
- package/dist/knob-contracts/collapsible-knobs.d.ts +3 -4
- package/dist/knob-contracts/color-picker-knobs.d.ts +3 -4
- package/dist/knob-contracts/context-knobs.d.ts +3 -4
- package/dist/knob-contracts/dockable-panel-knobs.d.ts +3 -4
- package/dist/knob-contracts/dockable-panel-knobs.js +1 -0
- package/dist/knob-contracts/dropzone-knobs.d.ts +3 -4
- package/dist/knob-contracts/dropzone-knobs.js +1 -0
- package/dist/knob-contracts/dynamic-notification-knobs.d.ts +3 -4
- package/dist/knob-contracts/empty-knobs.d.ts +3 -4
- package/dist/knob-contracts/empty-knobs.js +14 -1
- package/dist/knob-contracts/environment-variables-knobs.d.ts +3 -4
- package/dist/knob-contracts/environment-variables-knobs.js +2 -1
- package/dist/knob-contracts/field-knobs.d.ts +3 -4
- package/dist/knob-contracts/gradient-editor-knobs.d.ts +3 -4
- package/dist/knob-contracts/gradient-editor-knobs.js +3 -1
- package/dist/knob-contracts/infinite-canvas-knobs.d.ts +3 -4
- package/dist/knob-contracts/inline-attachment-knobs.d.ts +3 -4
- package/dist/knob-contracts/inline-attachment-knobs.js +2 -1
- package/dist/knob-contracts/inline-citation-knobs.d.ts +3 -4
- package/dist/knob-contracts/inline-citation-knobs.js +1 -0
- package/dist/knob-contracts/item-knobs.d.ts +3 -4
- package/dist/knob-contracts/kbd-knobs.d.ts +3 -4
- package/dist/knob-contracts/markdown-block-knobs.d.ts +3 -4
- package/dist/knob-contracts/markdown-block-knobs.js +2 -0
- package/dist/knob-contracts/markdown-knobs.d.ts +3 -4
- package/dist/knob-contracts/markdown-knobs.js +1 -0
- package/dist/knob-contracts/morphing-panel-knobs.d.ts +3 -4
- package/dist/knob-contracts/pagination-knobs.d.ts +3 -4
- package/dist/knob-contracts/phone-input-knobs.d.ts +3 -4
- package/dist/knob-contracts/phone-input-knobs.js +1 -0
- package/dist/knob-contracts/popup-knobs.d.ts +3 -4
- package/dist/knob-contracts/progressive-blur-knobs.d.ts +3 -4
- package/dist/knob-contracts/progressive-blur-knobs.js +1 -0
- package/dist/knob-contracts/range-knobs.d.ts +3 -4
- package/dist/knob-contracts/resizable-knobs.d.ts +3 -4
- package/dist/knob-contracts/resizable-knobs.js +1 -0
- package/dist/knob-contracts/rich-tooltip-knobs.d.ts +3 -4
- package/dist/knob-contracts/scroll-area-knobs.d.ts +3 -4
- package/dist/knob-contracts/separator-knobs.d.ts +3 -4
- package/dist/knob-contracts/sidebar-knobs.d.ts +3 -4
- package/dist/knob-contracts/sidebar-knobs.js +1 -0
- package/dist/knob-contracts/skeleton-knobs.d.ts +3 -4
- package/dist/knob-contracts/skeleton-knobs.js +9 -1
- package/dist/knob-contracts/source-badge-knobs.d.ts +3 -4
- package/dist/knob-contracts/spinner-knobs.d.ts +3 -4
- package/dist/knob-contracts/stepper-knobs.d.ts +3 -4
- package/dist/knob-contracts/stepper-knobs.js +1 -0
- package/dist/knob-contracts/switch-knobs.d.ts +3 -4
- package/dist/knob-contracts/switch-knobs.js +7 -1
- package/dist/knob-contracts/table-knobs.d.ts +3 -4
- package/dist/knob-contracts/table-of-contents-knobs.d.ts +3 -4
- package/dist/knob-contracts/table-of-contents-knobs.js +25 -0
- package/dist/knob-contracts/tabs-knobs.d.ts +3 -4
- package/dist/knob-contracts/tabs-knobs.js +2 -1
- package/dist/knob-contracts/task-list-knobs.d.ts +3 -4
- package/dist/knob-contracts/task-list-knobs.js +1 -0
- package/dist/knob-contracts/thread-rail-knobs.d.ts +3 -4
- package/dist/knob-contracts/timeline-knobs.d.ts +3 -4
- package/dist/knob-contracts/toolbar-knobs.d.ts +3 -4
- package/dist/knob-contracts/toolbar-knobs.js +1 -0
- package/dist/knob-contracts/track-highlight-knobs.d.ts +3 -4
- package/dist/knob-contracts/transcript-divider-knobs.d.ts +3 -4
- package/dist/knob-contracts/tree-knobs.d.ts +3 -4
- package/dist/knob-contracts/user-ask-knobs.d.ts +3 -4
- package/dist/knob-contracts/user-ask-knobs.js +1 -0
- package/dist/lib/cn.d.ts +2 -3
- package/dist/lib/code-tokens.d.ts +12 -13
- package/dist/lib/color.d.ts +26 -27
- package/dist/lib/contrast.d.ts +12 -13
- package/dist/lib/diff.d.ts +14 -15
- package/dist/lib/dropzone-validation.d.ts +25 -26
- package/dist/lib/env-file.d.ts +12 -13
- package/dist/lib/format-audio-recorder-duration.d.ts +2 -3
- package/dist/lib/liquid-glass-optics.d.ts +2 -3
- package/dist/lib/phone-input-format.d.ts +3 -4
- package/dist/lib/phone-input-format.js +1 -1
- package/dist/lib/phone-number.d.ts +8 -9
- package/dist/lib/trigger-detect.d.ts +4 -5
- package/dist/markdown-block.d.ts +11 -12
- package/dist/scripts/contrast-eval.d.ts +16 -17
- package/dist/scripts/contrast-eval.js +13 -7
- package/dist/skin-provider.d.ts +14 -0
- package/dist/skin-provider.js +21 -0
- package/dist/skin.d.ts +14 -33
- package/dist/skin.js +3 -46
- package/dist/source-badge.d.ts +7 -8
- package/dist/styles/index.css +2 -4
- package/dist/styles/recipes/accordion.css +8 -2
- package/dist/styles/recipes/action-bar.css +5 -2
- package/dist/styles/recipes/alert.css +95 -16
- package/dist/styles/recipes/avatar.css +17 -1
- package/dist/styles/recipes/badge.css +0 -1
- package/dist/styles/recipes/button.css +34 -8
- package/dist/styles/recipes/calendar.css +0 -6
- package/dist/styles/recipes/chat-composer-attachment.css +51 -53
- package/dist/styles/recipes/chat-composer.css +26 -21
- package/dist/styles/recipes/chat-layout.css +21 -62
- package/dist/styles/recipes/chat-message.css +11 -5
- package/dist/styles/recipes/choice.css +9 -2
- package/dist/styles/recipes/code-diff.css +8 -1
- package/dist/styles/recipes/code.css +39 -17
- package/dist/styles/recipes/collapsible.css +0 -3
- package/dist/styles/recipes/color-picker-details.css +1 -2
- package/dist/styles/recipes/color-picker-values.css +0 -4
- package/dist/styles/recipes/dockable-panel.css +8 -1
- package/dist/styles/recipes/dropzone.css +9 -2
- package/dist/styles/recipes/empty.css +118 -17
- package/dist/styles/recipes/environment-variables.css +8 -1
- package/dist/styles/recipes/field-parts.css +1 -6
- package/dist/styles/recipes/field.css +9 -5
- package/dist/styles/recipes/gradient-editor.css +16 -5
- package/dist/styles/recipes/inline-attachment.css +13 -8
- package/dist/styles/recipes/inline-citation.css +8 -4
- package/dist/styles/recipes/item.css +1 -1
- package/dist/styles/recipes/kbd.css +8 -0
- package/dist/styles/recipes/markdown-block.css +16 -2
- package/dist/styles/recipes/markdown.css +12 -0
- package/dist/styles/recipes/morphing-panel.css +1 -1
- package/dist/styles/recipes/pagination.css +0 -4
- package/dist/styles/recipes/phone-input.css +8 -4
- package/dist/styles/recipes/popup-lists.css +11 -0
- package/dist/styles/recipes/popup-toast.css +1 -29
- package/dist/styles/recipes/popup.css +2 -2
- package/dist/styles/recipes/progressive-blur.css +28 -7
- package/dist/styles/recipes/range.css +50 -1
- package/dist/styles/recipes/resizable.css +8 -10
- package/dist/styles/recipes/rich-tooltip.css +0 -4
- package/dist/styles/recipes/scroll-area.css +8 -2
- package/dist/styles/recipes/sidebar-menu.css +150 -0
- package/dist/styles/recipes/sidebar.css +56 -110
- package/dist/styles/recipes/skeleton.css +85 -3
- package/dist/styles/recipes/source-badge.css +0 -3
- package/dist/styles/recipes/stepper.css +8 -1
- package/dist/styles/recipes/switch.css +89 -17
- package/dist/styles/recipes/table-of-contents.css +211 -45
- package/dist/styles/recipes/table.css +0 -1
- package/dist/styles/recipes/tabs.css +19 -2
- package/dist/styles/recipes/task-list.css +8 -2
- package/dist/styles/recipes/thread-rail.css +0 -4
- package/dist/styles/recipes/toolbar.css +18 -4
- package/dist/styles/recipes/track-highlight.css +63 -5
- package/dist/styles/recipes/tree.css +2 -0
- package/dist/styles/recipes/user-ask.css +8 -4
- package/dist/styles/theme.css +130 -138
- package/dist/surface-variants.d.ts +4 -5
- package/dist/task-list.d.ts +16 -17
- package/dist/thread-rail.d.ts +21 -22
- package/dist/transcript-divider.d.ts +6 -7
- package/dist/ui/accordion.d.ts +10 -11
- package/dist/ui/alert-dialog.d.ts +11 -12
- package/dist/ui/alert-dialog.js +8 -6
- package/dist/ui/alert.d.ts +9 -10
- package/dist/ui/alert.js +3 -3
- package/dist/ui/aspect-ratio.d.ts +3 -4
- package/dist/ui/autocomplete.d.ts +19 -20
- package/dist/ui/autocomplete.js +5 -3
- package/dist/ui/avatar.d.ts +9 -10
- package/dist/ui/badge.d.ts +9 -10
- package/dist/ui/button-group.d.ts +7 -8
- package/dist/ui/button-group.js +3 -2
- package/dist/ui/button.d.ts +17 -18
- package/dist/ui/button.js +20 -5
- package/dist/ui/calendar.d.ts +3 -4
- package/dist/ui/card.d.ts +16 -17
- package/dist/ui/checkbox-group.d.ts +4 -5
- package/dist/ui/checkbox-group.js +3 -2
- package/dist/ui/checkbox.d.ts +3 -4
- package/dist/ui/code-diff.d.ts +8 -9
- package/dist/ui/code.d.ts +32 -23
- package/dist/ui/code.js +41 -20
- package/dist/ui/collapsible.d.ts +7 -8
- package/dist/ui/color-picker.d.ts +40 -41
- package/dist/ui/color-picker.js +5 -3
- package/dist/ui/combobox-disabled-selection.d.ts +3 -4
- package/dist/ui/combobox.d.ts +21 -20
- package/dist/ui/combobox.js +5 -3
- package/dist/ui/command.d.ts +19 -18
- package/dist/ui/command.js +38 -12
- package/dist/ui/context-menu.d.ts +30 -31
- package/dist/ui/context-menu.js +8 -5
- package/dist/ui/dialog.d.ts +13 -13
- package/dist/ui/dialog.js +10 -8
- package/dist/ui/dockable-panel-geometry.d.ts +7 -8
- package/dist/ui/dockable-panel.d.ts +21 -22
- package/dist/ui/drawer.d.ts +17 -18
- package/dist/ui/drawer.js +7 -6
- package/dist/ui/dropdown-menu.d.ts +36 -29
- package/dist/ui/dropdown-menu.js +116 -9
- package/dist/ui/dropzone.d.ts +24 -24
- package/dist/ui/empty.d.ts +14 -14
- package/dist/ui/empty.js +3 -3
- package/dist/ui/field.d.ts +26 -27
- package/dist/ui/form.d.ts +4 -5
- package/dist/ui/gradient-editor.d.ts +16 -17
- package/dist/ui/hover-card.d.ts +6 -7
- package/dist/ui/hover-card.js +5 -3
- package/dist/ui/infinite-canvas.d.ts +11 -12
- package/dist/ui/input-group.d.ts +6 -7
- package/dist/ui/input-otp.d.ts +7 -8
- package/dist/ui/input.d.ts +3 -4
- package/dist/ui/item.d.ts +20 -21
- package/dist/ui/kbd.d.ts +7 -5
- package/dist/ui/kbd.js +4 -2
- package/dist/ui/markdown-elements.d.ts +20 -21
- package/dist/ui/markdown.d.ts +5 -6
- package/dist/ui/menubar.d.ts +25 -26
- package/dist/ui/menubar.js +8 -5
- package/dist/ui/meter.d.ts +11 -12
- package/dist/ui/morphing-panel.d.ts +8 -9
- package/dist/ui/native-select.d.ts +3 -4
- package/dist/ui/native-select.js +1 -1
- package/dist/ui/navigation-menu.d.ts +17 -18
- package/dist/ui/navigation-menu.js +5 -3
- package/dist/ui/number-field.d.ts +15 -16
- package/dist/ui/pagination.d.ts +10 -11
- package/dist/ui/phone-input.d.ts +5 -6
- package/dist/ui/phone-input.js +40 -37
- package/dist/ui/popover.d.ts +11 -12
- package/dist/ui/popover.js +5 -3
- package/dist/ui/progress.d.ts +11 -12
- package/dist/ui/progressive-blur.d.ts +4 -5
- package/dist/ui/radio-group.d.ts +5 -6
- package/dist/ui/resizable.d.ts +12 -13
- package/dist/ui/responsive-dialog.d.ts +11 -12
- package/dist/ui/rich-tooltip-tour.d.ts +5 -6
- package/dist/ui/rich-tooltip.d.ts +21 -23
- package/dist/ui/rich-tooltip.js +5 -5
- package/dist/ui/scroll-area.d.ts +7 -8
- package/dist/ui/scroll-area.js +9 -6
- package/dist/ui/select.d.ts +21 -14
- package/dist/ui/select.js +7 -4
- package/dist/ui/separator.d.ts +2 -3
- package/dist/ui/sheet.d.ts +8 -9
- package/dist/ui/sheet.js +7 -5
- package/dist/ui/sidebar-menu.d.ts +24 -15
- package/dist/ui/sidebar-menu.js +30 -4
- package/dist/ui/sidebar-provider.d.ts +32 -7
- package/dist/ui/sidebar-provider.js +82 -22
- package/dist/ui/sidebar-resize-rail.d.ts +8 -0
- package/dist/ui/sidebar-resize-rail.js +192 -0
- package/dist/ui/sidebar.d.ts +20 -14
- package/dist/ui/sidebar.js +122 -57
- package/dist/ui/skeleton.d.ts +7 -4
- package/dist/ui/skeleton.js +9 -2
- package/dist/ui/slider.d.ts +6 -5
- package/dist/ui/slider.js +16 -13
- package/dist/ui/spinner.d.ts +3 -4
- package/dist/ui/stepper.d.ts +22 -23
- package/dist/ui/switch.d.ts +3 -4
- package/dist/ui/switch.js +12 -1
- package/dist/ui/table-of-contents.d.ts +7 -8
- package/dist/ui/table-of-contents.js +4 -2
- package/dist/ui/table.d.ts +17 -18
- package/dist/ui/tabs.d.ts +14 -11
- package/dist/ui/textarea.d.ts +3 -4
- package/dist/ui/timeline.d.ts +18 -19
- package/dist/ui/toast.d.ts +9 -9
- package/dist/ui/toast.js +21 -14
- package/dist/ui/toggle.d.ts +5 -6
- package/dist/ui/toggle.js +3 -2
- package/dist/ui/toolbar.d.ts +15 -16
- package/dist/ui/toolbar.js +15 -4
- package/dist/ui/tooltip.d.ts +6 -13
- package/dist/ui/tooltip.js +7 -8
- package/dist/ui/tree.d.ts +18 -19
- package/dist/ui/tree.js +3 -2
- package/dist/ui/trigger-menu.d.ts +15 -16
- package/dist/ui/trigger-menu.js +5 -3
- package/dist/ui/use-switch-drag.d.ts +7 -0
- package/dist/ui/use-switch-drag.js +104 -0
- package/dist/user-ask.d.ts +24 -25
- package/package.json +15 -15
- package/dist/code-block-editor.d.ts +0 -59
- package/dist/code-block-editor.js +0 -250
- package/dist/knob-contracts/code-block-editor-knobs.d.ts +0 -5
- package/dist/knob-contracts/code-block-editor-knobs.js +0 -11
- package/dist/lib/code-block-shiki.d.ts +0 -9
- package/dist/lib/code-block-shiki.js +0 -6
- package/dist/skin.config.d.ts +0 -5
- package/dist/skin.config.js +0 -12
- package/dist/styles/recipes/code-block-editor.css +0 -136
- package/dist/styles/skin-theme.css +0 -137
- package/dist/styles/skin.css +0 -143
package/dist/user-ask.d.ts
CHANGED
|
@@ -6,16 +6,16 @@ import { CSSProperties, ComponentProps } from "react";
|
|
|
6
6
|
type UserAskStyleProps<Props, Style> = Omit<Props, "style"> & {
|
|
7
7
|
style?: CSSProperties & Style;
|
|
8
8
|
};
|
|
9
|
-
declare function UserAsk({ onComplete, onDismiss, autoFocus, className, children, ...props }: UserAskProps): import("react").JSX.Element;
|
|
10
|
-
type UserAskHeaderProps = ComponentProps<"header"> & {
|
|
9
|
+
export declare function UserAsk({ onComplete, onDismiss, autoFocus, className, children, ...props }: UserAskProps): import("react").JSX.Element;
|
|
10
|
+
export type UserAskHeaderProps = ComponentProps<"header"> & {
|
|
11
11
|
style?: CSSProperties & UserAskKnobStyle;
|
|
12
12
|
};
|
|
13
|
-
declare function UserAskHeader({ className, ...props }: UserAskHeaderProps): import("react").JSX.Element;
|
|
14
|
-
type UserAskTitleProps = UserAskStyleProps<ComponentProps<"h3">, UserAskKnobStyle>;
|
|
15
|
-
declare function UserAskTitle({ className, children, ...props }: UserAskTitleProps): import("react").JSX.Element;
|
|
16
|
-
type UserAskPaginationProps = UserAskStyleProps<ComponentProps<"div">, UserAskKnobStyle>;
|
|
17
|
-
declare function UserAskPagination({ className, ...props }: UserAskPaginationProps): import("react").JSX.Element | null;
|
|
18
|
-
type UserAskQuestionProps = Omit<ComponentProps<"div">, "title"> & {
|
|
13
|
+
export declare function UserAskHeader({ className, ...props }: UserAskHeaderProps): import("react").JSX.Element;
|
|
14
|
+
export type UserAskTitleProps = UserAskStyleProps<ComponentProps<"h3">, UserAskKnobStyle>;
|
|
15
|
+
export declare function UserAskTitle({ className, children, ...props }: UserAskTitleProps): import("react").JSX.Element;
|
|
16
|
+
export type UserAskPaginationProps = UserAskStyleProps<ComponentProps<"div">, UserAskKnobStyle>;
|
|
17
|
+
export declare function UserAskPagination({ className, ...props }: UserAskPaginationProps): import("react").JSX.Element | null;
|
|
18
|
+
export type UserAskQuestionProps = Omit<ComponentProps<"div">, "title"> & {
|
|
19
19
|
id: string;
|
|
20
20
|
title: string;
|
|
21
21
|
/** Pre-selects option carrying this value (e.g. recommended one) until user picks another. */
|
|
@@ -23,28 +23,27 @@ type UserAskQuestionProps = Omit<ComponentProps<"div">, "title"> & {
|
|
|
23
23
|
} & {
|
|
24
24
|
style?: CSSProperties & UserAskKnobStyle;
|
|
25
25
|
};
|
|
26
|
-
declare function UserAskQuestion({ id, title, defaultValue, className, children, ...props }: UserAskQuestionProps): import("react").JSX.Element;
|
|
27
|
-
type UserAskOptionProps = UserAskStyleProps<Omit<ComponentProps<"button">, "value">, UserAskKnobStyle> & {
|
|
26
|
+
export declare function UserAskQuestion({ id, title, defaultValue, className, children, ...props }: UserAskQuestionProps): import("react").JSX.Element;
|
|
27
|
+
export type UserAskOptionProps = UserAskStyleProps<Omit<ComponentProps<"button">, "value">, UserAskKnobStyle> & {
|
|
28
28
|
value: string;
|
|
29
29
|
recommended?: boolean;
|
|
30
30
|
};
|
|
31
|
-
declare function UserAskOption({ value, recommended, disabled, className, children, onClick, ...props }: UserAskOptionProps): import("react").JSX.Element;
|
|
32
|
-
type UserAskOptionLabelProps = UserAskStyleProps<ComponentProps<"span">, UserAskKnobStyle>;
|
|
33
|
-
declare function UserAskOptionLabel({ className, children, ...props }: UserAskOptionLabelProps): import("react").JSX.Element;
|
|
34
|
-
type UserAskOptionDescriptionProps = UserAskStyleProps<ComponentProps<"span">, UserAskKnobStyle>;
|
|
35
|
-
declare function UserAskOptionDescription({ className, ...props }: UserAskOptionDescriptionProps): import("react").JSX.Element;
|
|
36
|
-
type UserAskOptionInputProps = UserAskStyleProps<Omit<ComponentProps<"input">, "value">, UserAskKnobStyle> & {
|
|
31
|
+
export declare function UserAskOption({ value, recommended, disabled, className, children, onClick, ...props }: UserAskOptionProps): import("react").JSX.Element;
|
|
32
|
+
export type UserAskOptionLabelProps = UserAskStyleProps<ComponentProps<"span">, UserAskKnobStyle>;
|
|
33
|
+
export declare function UserAskOptionLabel({ className, children, ...props }: UserAskOptionLabelProps): import("react").JSX.Element;
|
|
34
|
+
export type UserAskOptionDescriptionProps = UserAskStyleProps<ComponentProps<"span">, UserAskKnobStyle>;
|
|
35
|
+
export declare function UserAskOptionDescription({ className, ...props }: UserAskOptionDescriptionProps): import("react").JSX.Element;
|
|
36
|
+
export type UserAskOptionInputProps = UserAskStyleProps<Omit<ComponentProps<"input">, "value">, UserAskKnobStyle> & {
|
|
37
37
|
/** Row label while unselected (option's "Other" affordance). */
|
|
38
38
|
label?: string;
|
|
39
39
|
};
|
|
40
|
-
declare function UserAskOptionInput({ label, placeholder, disabled, className, onChange, style, ...props }: UserAskOptionInputProps): import("react").JSX.Element;
|
|
41
|
-
type UserAskFooterProps = ComponentProps<"footer"> & {
|
|
40
|
+
export declare function UserAskOptionInput({ label, placeholder, disabled, className, onChange, style, ...props }: UserAskOptionInputProps): import("react").JSX.Element;
|
|
41
|
+
export type UserAskFooterProps = ComponentProps<"footer"> & {
|
|
42
42
|
style?: CSSProperties & UserAskKnobStyle;
|
|
43
43
|
};
|
|
44
|
-
declare function UserAskFooter({ className, ...props }: UserAskFooterProps): import("react").JSX.Element;
|
|
45
|
-
type UserAskDismissProps = ComponentProps<typeof Button>;
|
|
46
|
-
declare function UserAskDismiss({ className, children, onClick, ...props }: UserAskDismissProps): import("react").JSX.Element;
|
|
47
|
-
type UserAskSubmitProps = ComponentProps<typeof Button>;
|
|
48
|
-
declare function UserAskSubmit({ className, children, disabled, onClick, ...props }: UserAskSubmitProps): import("react").JSX.Element;
|
|
49
|
-
//#endregion
|
|
50
|
-
export { UserAsk, UserAskDismiss, UserAskDismissProps, UserAskFooter, UserAskFooterProps, UserAskHeader, UserAskHeaderProps, UserAskOption, UserAskOptionDescription, UserAskOptionDescriptionProps, UserAskOptionInput, UserAskOptionInputProps, UserAskOptionLabel, UserAskOptionLabelProps, UserAskOptionProps, UserAskPagination, UserAskPaginationProps, UserAskQuestion, UserAskQuestionProps, UserAskSubmit, UserAskSubmitProps, UserAskTitle, UserAskTitleProps };
|
|
44
|
+
export declare function UserAskFooter({ className, ...props }: UserAskFooterProps): import("react").JSX.Element;
|
|
45
|
+
export type UserAskDismissProps = ComponentProps<typeof Button>;
|
|
46
|
+
export declare function UserAskDismiss({ className, children, onClick, ...props }: UserAskDismissProps): import("react").JSX.Element;
|
|
47
|
+
export type UserAskSubmitProps = ComponentProps<typeof Button>;
|
|
48
|
+
export declare function UserAskSubmit({ className, children, disabled, onClick, ...props }: UserAskSubmitProps): import("react").JSX.Element;
|
|
49
|
+
//#endregion
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ctrl-ui/react",
|
|
3
|
-
"version": "0.8.
|
|
4
|
-
"description": "Control UI components, blocks, and primitives with
|
|
3
|
+
"version": "0.8.4",
|
|
4
|
+
"description": "Control UI components, blocks, and primitives with neutral defaults and consumer-owned themes.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -34,29 +34,29 @@
|
|
|
34
34
|
"lint": "biome lint ."
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@base-ui/react": "^1.
|
|
38
|
-
"@tanstack/react-virtual": "^3.14.
|
|
37
|
+
"@base-ui/react": "^1.8.0",
|
|
38
|
+
"@tanstack/react-virtual": "^3.14.13",
|
|
39
39
|
"class-variance-authority": "^0.7.1",
|
|
40
40
|
"clsx": "^2.1.1",
|
|
41
41
|
"cmdk": "^1.1.1",
|
|
42
42
|
"diff": "^9.0.0",
|
|
43
|
-
"libphonenumber-js": "^1.13.
|
|
44
|
-
"lucide-react": "^1.
|
|
43
|
+
"libphonenumber-js": "^1.13.13",
|
|
44
|
+
"lucide-react": "^1.47.0",
|
|
45
45
|
"prosemirror-commands": "^1.7.2",
|
|
46
46
|
"prosemirror-history": "^1.5.0",
|
|
47
47
|
"prosemirror-keymap": "^1.2.3",
|
|
48
48
|
"prosemirror-model": "^1.25.11",
|
|
49
49
|
"prosemirror-state": "^1.4.4",
|
|
50
|
-
"prosemirror-view": "^1.42.
|
|
50
|
+
"prosemirror-view": "^1.42.3",
|
|
51
51
|
"react": "^19.2.8",
|
|
52
52
|
"react-day-picker": "^10.0.1",
|
|
53
53
|
"react-email": "^6.9.5",
|
|
54
|
-
"react-phone-number-input": "^3.4.
|
|
55
|
-
"react-resizable-panels": "^4.12.
|
|
54
|
+
"react-phone-number-input": "^3.4.18",
|
|
55
|
+
"react-resizable-panels": "^4.12.4",
|
|
56
56
|
"shiki": "^4.4.3",
|
|
57
|
-
"streamdown": "^2.
|
|
58
|
-
"tailwind-merge": "^3.
|
|
59
|
-
"zod": "^4.
|
|
57
|
+
"streamdown": "^2.6.0",
|
|
58
|
+
"tailwind-merge": "^3.7.0",
|
|
59
|
+
"zod": "^4.6.5"
|
|
60
60
|
},
|
|
61
61
|
"peerDependenciesMeta": {
|
|
62
62
|
"@tanstack/react-virtual": {
|
|
@@ -112,8 +112,8 @@
|
|
|
112
112
|
}
|
|
113
113
|
},
|
|
114
114
|
"devDependencies": {
|
|
115
|
-
"@types/bun": "^1.
|
|
116
|
-
"@types/react": "^19.
|
|
117
|
-
"tsdown": "0.
|
|
115
|
+
"@types/bun": "^1.4.2",
|
|
116
|
+
"@types/react": "^19.3.0",
|
|
117
|
+
"tsdown": "0.23.0"
|
|
118
118
|
}
|
|
119
119
|
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { ButtonKnobStyle } from "./knob-contracts/button-knobs.js";
|
|
2
|
-
import { Button } from "./ui/button.js";
|
|
3
|
-
import { CodeBlockEditorKnobStyle } from "./knob-contracts/code-block-editor-knobs.js";
|
|
4
|
-
import { CodeKnobStyle } from "./knob-contracts/code-knobs.js";
|
|
5
|
-
import { CodeBlockEditorTokenLines } from "./lib/code-block-shiki.js";
|
|
6
|
-
import { CSSProperties, ComponentProps, ReactNode } from "react";
|
|
7
|
-
//#region src/code-block-editor.d.ts
|
|
8
|
-
type CodeBlockEditorStyleProps<Props, Style> = Omit<Props, "style"> & {
|
|
9
|
-
style?: CSSProperties & Style;
|
|
10
|
-
};
|
|
11
|
-
type CodeBlockEditorOverflow = "wrap" | "scroll";
|
|
12
|
-
type CodeBlockEditorHighlight = "auto" | "none";
|
|
13
|
-
type CodeBlockEditorChrome = "standalone" | "embedded";
|
|
14
|
-
type CodeBlockEditorDensity = "default" | "compact";
|
|
15
|
-
type CodeBlockEditorVariant = "default" | "command";
|
|
16
|
-
type CodeBlockEditorProps = CodeBlockEditorStyleProps<ComponentProps<"figure">, CodeBlockEditorKnobStyle> & {
|
|
17
|
-
overflow?: CodeBlockEditorOverflow;
|
|
18
|
-
chrome?: CodeBlockEditorChrome;
|
|
19
|
-
density?: CodeBlockEditorDensity;
|
|
20
|
-
variant?: CodeBlockEditorVariant;
|
|
21
|
-
};
|
|
22
|
-
type CodeBlockEditorHeaderProps = CodeBlockEditorStyleProps<ComponentProps<"figcaption">, CodeBlockEditorKnobStyle>;
|
|
23
|
-
type CodeBlockEditorTitleProps = CodeBlockEditorStyleProps<ComponentProps<"span">, CodeBlockEditorKnobStyle>;
|
|
24
|
-
type CodeBlockEditorActionsProps = ComponentProps<"div"> & {
|
|
25
|
-
style?: CSSProperties & CodeBlockEditorKnobStyle;
|
|
26
|
-
};
|
|
27
|
-
type CodeBlockEditorCopyProps = Omit<ComponentProps<typeof Button>, "children" | "onClick"> & {
|
|
28
|
-
value: string;
|
|
29
|
-
children?: ReactNode;
|
|
30
|
-
copiedLabel?: ReactNode;
|
|
31
|
-
copiedAriaLabel?: string;
|
|
32
|
-
};
|
|
33
|
-
type CodeBlockEditorContentProps = CodeBlockEditorStyleProps<Omit<ComponentProps<"pre">, "children">, CodeBlockEditorKnobStyle> & {
|
|
34
|
-
code: string;
|
|
35
|
-
lang?: string;
|
|
36
|
-
tokens?: CodeBlockEditorTokenLines | null;
|
|
37
|
-
highlight?: CodeBlockEditorHighlight;
|
|
38
|
-
maxHeight?: string;
|
|
39
|
-
scrollAreaClassName?: string;
|
|
40
|
-
};
|
|
41
|
-
type CodeBlockEditorTextareaProps = CodeBlockEditorStyleProps<Omit<ComponentProps<"textarea">, "defaultValue" | "value">, CodeBlockEditorKnobStyle> & {
|
|
42
|
-
value?: string;
|
|
43
|
-
defaultValue?: string;
|
|
44
|
-
onValueChange?: (value: string) => void;
|
|
45
|
-
fileName?: string;
|
|
46
|
-
};
|
|
47
|
-
declare function CodeBlockEditor({ overflow, chrome, density, variant, className, children, ...props }: CodeBlockEditorProps): import("react").JSX.Element;
|
|
48
|
-
declare function CodeBlockEditorHeader({ className, ...props }: CodeBlockEditorHeaderProps): import("react").JSX.Element;
|
|
49
|
-
declare function CodeBlockEditorTitle({ className, ...props }: CodeBlockEditorTitleProps): import("react").JSX.Element;
|
|
50
|
-
declare function CodeBlockEditorActions({ className, ...props }: CodeBlockEditorActionsProps): import("react").JSX.Element;
|
|
51
|
-
declare function CodeBlockEditorCopy({ value, copiedLabel, copiedAriaLabel, children, className, "aria-label": ariaLabel, ...props }: CodeBlockEditorCopyProps): import("react").JSX.Element;
|
|
52
|
-
type CodeBlockEditorFloatingCopyProps = Omit<CodeBlockEditorCopyProps, "children" | "copiedLabel" | "style"> & {
|
|
53
|
-
style?: CSSProperties & ButtonKnobStyle & CodeKnobStyle;
|
|
54
|
-
};
|
|
55
|
-
declare function CodeBlockEditorFloatingCopy({ className, ...props }: CodeBlockEditorFloatingCopyProps): import("react").JSX.Element;
|
|
56
|
-
declare function CodeBlockEditorContent({ code, lang, tokens, highlight, maxHeight, scrollAreaClassName, className, ...props }: CodeBlockEditorContentProps): import("react").JSX.Element;
|
|
57
|
-
declare function CodeBlockEditorTextarea({ value, defaultValue, onValueChange, onChange, fileName, className, "aria-label": ariaLabel, ...props }: CodeBlockEditorTextareaProps): import("react").JSX.Element;
|
|
58
|
-
//#endregion
|
|
59
|
-
export { CodeBlockEditor, CodeBlockEditorActions, CodeBlockEditorActionsProps, CodeBlockEditorChrome, CodeBlockEditorContent, CodeBlockEditorContentProps, CodeBlockEditorCopy, CodeBlockEditorCopyProps, CodeBlockEditorDensity, CodeBlockEditorFloatingCopy, CodeBlockEditorFloatingCopyProps, CodeBlockEditorHeader, CodeBlockEditorHeaderProps, CodeBlockEditorHighlight, CodeBlockEditorOverflow, CodeBlockEditorProps, CodeBlockEditorTextarea, CodeBlockEditorTextareaProps, CodeBlockEditorTitle, CodeBlockEditorTitleProps, CodeBlockEditorVariant };
|
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useCopyToClipboard } from "./hooks/use-copy-to-clipboard.js";
|
|
3
|
-
import { cn } from "./lib/cn.js";
|
|
4
|
-
import { Button } from "./ui/button.js";
|
|
5
|
-
import { ScrollArea } from "./ui/scroll-area.js";
|
|
6
|
-
import { highlightCodeToTokens } from "./lib/code-block-shiki.js";
|
|
7
|
-
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./ui/tooltip.js";
|
|
8
|
-
import { Children, Fragment, createContext, isValidElement, use, useEffect, useState } from "react";
|
|
9
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
-
import { CheckIcon, CopyIcon } from "lucide-react";
|
|
11
|
-
//#region src/code-block-editor.tsx
|
|
12
|
-
const CodeBlockEditorContext = createContext(null);
|
|
13
|
-
function useCodeBlockEditorContext() {
|
|
14
|
-
const context = use(CodeBlockEditorContext);
|
|
15
|
-
if (!context) throw new Error("CodeBlockEditor compound parts must be rendered inside <CodeBlockEditor>.");
|
|
16
|
-
return context;
|
|
17
|
-
}
|
|
18
|
-
function resolveCodeBlockEditorClasses({ overflow, density, variant }) {
|
|
19
|
-
const isCommand = variant === "command";
|
|
20
|
-
const isCompact = density === "compact" || isCommand;
|
|
21
|
-
return {
|
|
22
|
-
codeClassName: cn(overflow === "scroll" ? isCommand ? "w-full max-w-full overflow-x-auto whitespace-pre" : "w-max min-w-full whitespace-pre" : "w-full whitespace-pre-wrap break-words"),
|
|
23
|
-
editorClassName: cn("w-full max-w-full overflow-auto", overflow === "scroll" ? "whitespace-pre" : "whitespace-pre-wrap break-words"),
|
|
24
|
-
scrollable: !isCommand,
|
|
25
|
-
maxHeight: isCompact ? "320px" : "520px"
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
function hasCodeBlockEditorHeader(children) {
|
|
29
|
-
return Children.toArray(children).some((child) => isValidElement(child) && child.type === CodeBlockEditorHeader);
|
|
30
|
-
}
|
|
31
|
-
function createKeyedTokenLines(lines) {
|
|
32
|
-
return lines.reduce((state, line) => {
|
|
33
|
-
const tokenState = line.reduce((tokenAccumulator, token) => ({
|
|
34
|
-
offset: tokenAccumulator.offset + token.content.length,
|
|
35
|
-
tokens: [...tokenAccumulator.tokens, {
|
|
36
|
-
key: tokenAccumulator.offset,
|
|
37
|
-
content: token.content,
|
|
38
|
-
style: token.style
|
|
39
|
-
}]
|
|
40
|
-
}), {
|
|
41
|
-
offset: state.offset,
|
|
42
|
-
tokens: []
|
|
43
|
-
});
|
|
44
|
-
return {
|
|
45
|
-
offset: tokenState.offset + 1,
|
|
46
|
-
lines: [...state.lines, {
|
|
47
|
-
key: state.offset,
|
|
48
|
-
tokens: tokenState.tokens
|
|
49
|
-
}]
|
|
50
|
-
};
|
|
51
|
-
}, {
|
|
52
|
-
offset: 0,
|
|
53
|
-
lines: []
|
|
54
|
-
}).lines;
|
|
55
|
-
}
|
|
56
|
-
function useHighlightedTokens({ code, lang, tokens, highlight }) {
|
|
57
|
-
const tokenKey = `${lang ?? ""}\n${code}`;
|
|
58
|
-
const [clientTokens, setClientTokens] = useState(null);
|
|
59
|
-
useEffect(() => {
|
|
60
|
-
if (highlight === "none" || tokens !== void 0 || !lang) return;
|
|
61
|
-
let cancelled = false;
|
|
62
|
-
const requestKey = `${lang}\n${code}`;
|
|
63
|
-
highlightCodeToTokens(code, lang).then((result) => {
|
|
64
|
-
if (!cancelled) setClientTokens({
|
|
65
|
-
key: requestKey,
|
|
66
|
-
tokens: result
|
|
67
|
-
});
|
|
68
|
-
}).catch(() => {
|
|
69
|
-
if (!cancelled) setClientTokens({
|
|
70
|
-
key: requestKey,
|
|
71
|
-
tokens: null
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
return () => {
|
|
75
|
-
cancelled = true;
|
|
76
|
-
};
|
|
77
|
-
}, [
|
|
78
|
-
code,
|
|
79
|
-
lang,
|
|
80
|
-
tokens,
|
|
81
|
-
highlight
|
|
82
|
-
]);
|
|
83
|
-
if (highlight === "none") return null;
|
|
84
|
-
return tokens ?? (clientTokens?.key === tokenKey ? clientTokens.tokens : null);
|
|
85
|
-
}
|
|
86
|
-
function CodeBlockEditorCode({ code, lang, tokens, highlight, maxHeight, scrollAreaClassName, scrollable, className, ...props }) {
|
|
87
|
-
const highlightedTokens = useHighlightedTokens({
|
|
88
|
-
code,
|
|
89
|
-
lang,
|
|
90
|
-
tokens,
|
|
91
|
-
highlight
|
|
92
|
-
});
|
|
93
|
-
const codeNode = highlightedTokens === null || highlightedTokens.length === 0 ? /* @__PURE__ */ jsx("code", { children: code }) : /* @__PURE__ */ jsx("code", { children: createKeyedTokenLines(highlightedTokens).map((line, lineIndex, keyedLines) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", { children: line.tokens.map((token) => /* @__PURE__ */ jsx("span", {
|
|
94
|
-
style: token.style,
|
|
95
|
-
children: token.content
|
|
96
|
-
}, token.key)) }), lineIndex !== keyedLines.length - 1 ? "\n" : null] }, line.key)) });
|
|
97
|
-
const block = /* @__PURE__ */ jsx("pre", {
|
|
98
|
-
"data-control-ui": "code-block-editor",
|
|
99
|
-
"data-control-family": "code-block-editor",
|
|
100
|
-
"data-slot": "content",
|
|
101
|
-
className,
|
|
102
|
-
...props,
|
|
103
|
-
children: codeNode
|
|
104
|
-
});
|
|
105
|
-
if (!scrollable) return block;
|
|
106
|
-
return /* @__PURE__ */ jsx(ScrollArea, {
|
|
107
|
-
className: scrollAreaClassName,
|
|
108
|
-
maxHeight,
|
|
109
|
-
children: block
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
function CodeBlockEditor({ overflow, chrome = "standalone", density = "default", variant = "default", className, children, ...props }) {
|
|
113
|
-
const resolvedOverflow = overflow ?? (variant === "command" ? "wrap" : "scroll");
|
|
114
|
-
const hasHeader = hasCodeBlockEditorHeader(children);
|
|
115
|
-
return /* @__PURE__ */ jsx(CodeBlockEditorContext.Provider, {
|
|
116
|
-
value: {
|
|
117
|
-
overflow: resolvedOverflow,
|
|
118
|
-
chrome,
|
|
119
|
-
density,
|
|
120
|
-
variant,
|
|
121
|
-
hasHeader
|
|
122
|
-
},
|
|
123
|
-
children: /* @__PURE__ */ jsx("figure", {
|
|
124
|
-
"data-control-ui": "code-block-editor",
|
|
125
|
-
"data-control-family": "code-block-editor",
|
|
126
|
-
"data-slot": "root",
|
|
127
|
-
"data-surface": "panel",
|
|
128
|
-
"data-variant": variant,
|
|
129
|
-
"data-chrome": chrome,
|
|
130
|
-
"data-density": density,
|
|
131
|
-
"data-header": hasHeader ? "true" : void 0,
|
|
132
|
-
className: cn("min-w-0 overflow-hidden", !hasHeader && "relative", className),
|
|
133
|
-
...props,
|
|
134
|
-
children
|
|
135
|
-
})
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
function CodeBlockEditorHeader({ className, ...props }) {
|
|
139
|
-
return /* @__PURE__ */ jsx("figcaption", {
|
|
140
|
-
"data-control-ui": "code-block-editor",
|
|
141
|
-
"data-control-family": "code-block-editor",
|
|
142
|
-
"data-slot": "header",
|
|
143
|
-
className: cn("flex items-center justify-between", className),
|
|
144
|
-
...props
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
function CodeBlockEditorTitle({ className, ...props }) {
|
|
148
|
-
return /* @__PURE__ */ jsx("span", {
|
|
149
|
-
"data-control-ui": "code-block-editor",
|
|
150
|
-
"data-control-family": "code-block-editor",
|
|
151
|
-
"data-slot": "title",
|
|
152
|
-
className: cn("block min-w-0 truncate", className),
|
|
153
|
-
...props
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
function CodeBlockEditorActions({ className, ...props }) {
|
|
157
|
-
return /* @__PURE__ */ jsx("div", {
|
|
158
|
-
"data-control-ui": "code-block-editor",
|
|
159
|
-
"data-control-family": "code-block-editor",
|
|
160
|
-
"data-slot": "actions",
|
|
161
|
-
className: cn("flex shrink-0 items-center", className),
|
|
162
|
-
...props
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
function CodeBlockEditorCopy({ value, copiedLabel, copiedAriaLabel = "Copied", children, className, "aria-label": ariaLabel, ...props }) {
|
|
166
|
-
const { isCopied, handleCopy } = useCopyToClipboard({ text: value });
|
|
167
|
-
const isIconOnly = children === void 0;
|
|
168
|
-
const label = ariaLabel ?? (isIconOnly ? "Copy code" : void 0);
|
|
169
|
-
const copied = copiedLabel ?? (isIconOnly ? /* @__PURE__ */ jsx(CheckIcon, {
|
|
170
|
-
"aria-hidden": "true",
|
|
171
|
-
className: "size-3.5"
|
|
172
|
-
}) : "Copied");
|
|
173
|
-
const button = /* @__PURE__ */ jsx(Button, {
|
|
174
|
-
type: "button",
|
|
175
|
-
variant: "quiet",
|
|
176
|
-
size: "xs",
|
|
177
|
-
"aria-live": "polite",
|
|
178
|
-
"aria-label": label && isCopied ? copiedAriaLabel : label,
|
|
179
|
-
"data-code-block-editor-copy": isIconOnly ? "true" : void 0,
|
|
180
|
-
className,
|
|
181
|
-
...props,
|
|
182
|
-
onClick: handleCopy,
|
|
183
|
-
children: isCopied ? copied : children ?? /* @__PURE__ */ jsx(CopyIcon, {
|
|
184
|
-
"aria-hidden": "true",
|
|
185
|
-
className: "size-3.5"
|
|
186
|
-
})
|
|
187
|
-
});
|
|
188
|
-
if (!isIconOnly) return button;
|
|
189
|
-
return /* @__PURE__ */ jsx(TooltipProvider, {
|
|
190
|
-
delay: 0,
|
|
191
|
-
children: /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: button }), /* @__PURE__ */ jsx(TooltipContent, {
|
|
192
|
-
side: "left",
|
|
193
|
-
children: label
|
|
194
|
-
})] })
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
function CodeBlockEditorFloatingCopy({ className, ...props }) {
|
|
198
|
-
return /* @__PURE__ */ jsx(CodeBlockEditorCopy, {
|
|
199
|
-
"data-code-block-editor-floating-copy": "true",
|
|
200
|
-
className: cn("absolute top-2 right-2 z-10", className),
|
|
201
|
-
...props
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
function CodeBlockEditorContent({ code, lang, tokens, highlight = "auto", maxHeight, scrollAreaClassName, className, ...props }) {
|
|
205
|
-
const context = useCodeBlockEditorContext();
|
|
206
|
-
const classes = resolveCodeBlockEditorClasses(context);
|
|
207
|
-
const content = /* @__PURE__ */ jsx(CodeBlockEditorCode, {
|
|
208
|
-
code,
|
|
209
|
-
lang,
|
|
210
|
-
tokens,
|
|
211
|
-
highlight,
|
|
212
|
-
maxHeight: maxHeight ?? classes.maxHeight,
|
|
213
|
-
scrollAreaClassName,
|
|
214
|
-
scrollable: classes.scrollable,
|
|
215
|
-
className: cn(classes.codeClassName, className),
|
|
216
|
-
...props
|
|
217
|
-
});
|
|
218
|
-
if (context.hasHeader) return content;
|
|
219
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
220
|
-
"data-control-ui": "code-block-editor",
|
|
221
|
-
"data-control-family": "code-block-editor",
|
|
222
|
-
"data-slot": "floating-frame",
|
|
223
|
-
className: "relative",
|
|
224
|
-
children: [/* @__PURE__ */ jsx(CodeBlockEditorFloatingCopy, { value: code }), content]
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
function CodeBlockEditorTextarea({ value, defaultValue = "", onValueChange, onChange, fileName, className, "aria-label": ariaLabel, ...props }) {
|
|
228
|
-
const { editorClassName } = resolveCodeBlockEditorClasses(useCodeBlockEditorContext());
|
|
229
|
-
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
230
|
-
const currentValue = value ?? internalValue;
|
|
231
|
-
function handleChange(event) {
|
|
232
|
-
const nextValue = event.target.value;
|
|
233
|
-
if (value === void 0) setInternalValue(nextValue);
|
|
234
|
-
onValueChange?.(nextValue);
|
|
235
|
-
onChange?.(event);
|
|
236
|
-
}
|
|
237
|
-
return /* @__PURE__ */ jsx("textarea", {
|
|
238
|
-
"data-control-ui": "code-block-editor",
|
|
239
|
-
"data-control-family": "code-block-editor",
|
|
240
|
-
"data-slot": "editor",
|
|
241
|
-
value: currentValue,
|
|
242
|
-
onChange: handleChange,
|
|
243
|
-
"aria-label": ariaLabel ?? (fileName ? `${fileName} code` : "Code editor"),
|
|
244
|
-
spellCheck: false,
|
|
245
|
-
className: cn(editorClassName, "block resize-y", className),
|
|
246
|
-
...props
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
//#endregion
|
|
250
|
-
export { CodeBlockEditor, CodeBlockEditorActions, CodeBlockEditorContent, CodeBlockEditorCopy, CodeBlockEditorFloatingCopy, CodeBlockEditorHeader, CodeBlockEditorTextarea, CodeBlockEditorTitle };
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
//#region src/knob-contracts/code-block-editor-knobs.d.ts
|
|
2
|
-
declare const codeBlockEditorKnobs: readonly ["--cui-code-block-editor-radius", "--cui-code-block-editor-background", "--cui-code-block-editor-border-color", "--cui-code-block-editor-shadow", "--cui-code-block-editor-title-foreground", "--cui-code-block-editor-code-background"];
|
|
3
|
-
type CodeBlockEditorKnobStyle = Partial<Record<(typeof codeBlockEditorKnobs)[number], string>>;
|
|
4
|
-
//#endregion
|
|
5
|
-
export { CodeBlockEditorKnobStyle, codeBlockEditorKnobs };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
//#region src/knob-contracts/code-block-editor-knobs.ts
|
|
2
|
-
const codeBlockEditorKnobs = [
|
|
3
|
-
"--cui-code-block-editor-radius",
|
|
4
|
-
"--cui-code-block-editor-background",
|
|
5
|
-
"--cui-code-block-editor-border-color",
|
|
6
|
-
"--cui-code-block-editor-shadow",
|
|
7
|
-
"--cui-code-block-editor-title-foreground",
|
|
8
|
-
"--cui-code-block-editor-code-background"
|
|
9
|
-
];
|
|
10
|
-
//#endregion
|
|
11
|
-
export { codeBlockEditorKnobs };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { CodeToken, CodeTokenLines, CodeTokenStyle, highlightToTokens, normalizeLanguage as normalizeLanguage$1 } from "./code-tokens.js";
|
|
2
|
-
//#region src/lib/code-block-shiki.d.ts
|
|
3
|
-
type CodeBlockEditorToken = CodeToken;
|
|
4
|
-
type CodeBlockEditorTokenLines = CodeTokenLines;
|
|
5
|
-
type CodeBlockEditorTokenStyle = CodeTokenStyle;
|
|
6
|
-
declare const highlightCodeToTokens: typeof highlightToTokens;
|
|
7
|
-
declare const normalizeLanguage: typeof normalizeLanguage$1;
|
|
8
|
-
//#endregion
|
|
9
|
-
export { CodeBlockEditorToken, CodeBlockEditorTokenLines, CodeBlockEditorTokenStyle, highlightCodeToTokens, normalizeLanguage };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { highlightToTokens, normalizeLanguage as normalizeLanguage$1 } from "./code-tokens.js";
|
|
2
|
-
//#region src/lib/code-block-shiki.ts
|
|
3
|
-
const highlightCodeToTokens = highlightToTokens;
|
|
4
|
-
const normalizeLanguage = normalizeLanguage$1;
|
|
5
|
-
//#endregion
|
|
6
|
-
export { highlightCodeToTokens, normalizeLanguage };
|
package/dist/skin.config.d.ts
DELETED
package/dist/skin.config.js
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
@layer components {
|
|
2
|
-
:where([data-control-family="code-block-editor"][data-slot="root"]) {
|
|
3
|
-
--cui-code-block-editor-background: var(--background);
|
|
4
|
-
--cui-code-block-editor-border-color: var(--border);
|
|
5
|
-
--cui-code-block-editor-radius: min(var(--radius-panel), calc(0.5rem * var(--nest-corner-ratio)));
|
|
6
|
-
--cui-code-block-editor-shadow: var(--shadow-sm);
|
|
7
|
-
--cui-code-block-editor-code-background: var(--background);
|
|
8
|
-
--cui-code-block-editor-title-foreground: var(--muted-foreground);
|
|
9
|
-
margin-block: calc(var(--spacing) * 4);
|
|
10
|
-
border: 1px solid var(--cui-code-block-editor-border-color);
|
|
11
|
-
border-radius: var(--cui-code-block-editor-radius);
|
|
12
|
-
background: var(--cui-code-block-editor-background);
|
|
13
|
-
box-shadow: var(--cui-code-block-editor-shadow);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
:where([data-control-family="code-block-editor"][data-slot="root"][data-chrome="embedded"]) {
|
|
17
|
-
margin-block: 0;
|
|
18
|
-
border-width: 0px;
|
|
19
|
-
border-radius: 0px;
|
|
20
|
-
background: transparent;
|
|
21
|
-
box-shadow: none;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
:where([data-control-family="code-block-editor"][data-slot="header"]) {
|
|
25
|
-
min-block-size: calc(var(--spacing) * 11);
|
|
26
|
-
gap: calc(var(--spacing) * 3);
|
|
27
|
-
padding-inline: calc(var(--spacing) * 3);
|
|
28
|
-
padding-block: calc(var(--spacing) * 2);
|
|
29
|
-
border-bottom: 1px solid var(--border);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
:where([data-control-family="code-block-editor"][data-slot="actions"]) {
|
|
33
|
-
gap: calc(var(--spacing) * 1);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
:where([data-control-family="button"][data-code-block-editor-copy="true"]) {
|
|
37
|
-
inline-size: calc(var(--spacing) * 7);
|
|
38
|
-
block-size: calc(var(--spacing) * 7);
|
|
39
|
-
padding: 0;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
:where([data-control-family="code-block-editor"][data-slot="title"]) {
|
|
43
|
-
color: var(--cui-code-block-editor-title-foreground);
|
|
44
|
-
font-size: var(--text-label);
|
|
45
|
-
font-family: var(--font-mono);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
:where([data-control-family="code-block-editor"]:is([data-slot="content"], [data-slot="editor"])) {
|
|
49
|
-
min-block-size: 160px;
|
|
50
|
-
padding: calc(var(--spacing) * 4);
|
|
51
|
-
background: var(--cui-code-block-editor-code-background);
|
|
52
|
-
color: var(--code-foreground);
|
|
53
|
-
font-size: var(--text-label);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
:where(
|
|
57
|
-
[data-control-family="code-block-editor"][data-slot="root"][data-chrome="embedded"] :is([data-slot="content"], [data-slot="editor"])
|
|
58
|
-
) {
|
|
59
|
-
background: transparent;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
:where([data-control-family="code-block-editor"][data-slot="editor"]) {
|
|
63
|
-
max-block-size: 520px;
|
|
64
|
-
border-width: 0px;
|
|
65
|
-
outline: none;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
:where(
|
|
69
|
-
[data-control-family="code-block-editor"][data-slot="root"]:is([data-density="compact"], [data-variant="command"])
|
|
70
|
-
:is([data-slot="content"], [data-slot="editor"])
|
|
71
|
-
) {
|
|
72
|
-
min-block-size: 0;
|
|
73
|
-
padding-inline: calc(var(--spacing) * 3);
|
|
74
|
-
padding-block: calc(var(--spacing) * 2);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
:where(
|
|
78
|
-
[data-control-family="code-block-editor"][data-slot="root"]:is([data-density="compact"], [data-variant="command"]) [data-slot="editor"]
|
|
79
|
-
) {
|
|
80
|
-
max-block-size: 320px;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
:where([data-control-family="code-block-editor"][data-slot="floating-frame"]) {
|
|
84
|
-
padding-block-start: calc(var(--spacing) * 5);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
:where(
|
|
88
|
-
[data-control-family="code-block-editor"][data-slot="root"]:is([data-density="compact"], [data-variant="command"])
|
|
89
|
-
[data-slot="floating-frame"]
|
|
90
|
-
) {
|
|
91
|
-
padding-block-start: calc(var(--spacing) * 7);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
:where([data-control-family="button"][data-code-block-editor-floating-copy="true"]) {
|
|
95
|
-
background: oklch(from var(--background) l c h / 0.85);
|
|
96
|
-
box-shadow:
|
|
97
|
-
inset 0 0 0 1px var(--border),
|
|
98
|
-
var(--shadow-sm);
|
|
99
|
-
backdrop-filter: blur(var(--backdrop-blur-popover));
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
@property --cui-code-block-editor-radius {
|
|
104
|
-
syntax: "<length>";
|
|
105
|
-
inherits: true;
|
|
106
|
-
initial-value: 0px;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
@property --cui-code-block-editor-background {
|
|
110
|
-
syntax: "<color>";
|
|
111
|
-
inherits: true;
|
|
112
|
-
initial-value: transparent;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
@property --cui-code-block-editor-border-color {
|
|
116
|
-
syntax: "<color>";
|
|
117
|
-
inherits: true;
|
|
118
|
-
initial-value: transparent;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
@property --cui-code-block-editor-shadow {
|
|
122
|
-
syntax: "*";
|
|
123
|
-
inherits: true;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
@property --cui-code-block-editor-title-foreground {
|
|
127
|
-
syntax: "<color>";
|
|
128
|
-
inherits: true;
|
|
129
|
-
initial-value: transparent;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
@property --cui-code-block-editor-code-background {
|
|
133
|
-
syntax: "<color>";
|
|
134
|
-
inherits: true;
|
|
135
|
-
initial-value: transparent;
|
|
136
|
-
}
|