@ctrl-ui/react 0.8.6 → 0.8.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/action-bar.d.ts +15 -7
- package/dist/action-bar.js +39 -19
- package/dist/activity.js +7 -15
- package/dist/audio-recorder.d.ts +14 -4
- package/dist/audio-recorder.js +82 -29
- package/dist/audio-visualizer.js +1 -1
- package/dist/blocks/coding-agent.js +54 -57
- package/dist/blocks/design-canvas-data.d.ts +32 -0
- package/dist/blocks/design-canvas-data.js +100 -0
- package/dist/blocks/design-canvas-inspector.d.ts +8 -0
- package/dist/blocks/design-canvas-inspector.js +238 -0
- package/dist/blocks/design-canvas.d.ts +21 -0
- package/dist/blocks/design-canvas.js +452 -0
- package/dist/blocks/discussion.d.ts +28 -0
- package/dist/blocks/discussion.js +67 -0
- package/dist/blocks/file-explorer-data.d.ts +1 -0
- package/dist/blocks/file-explorer-data.js +4 -1
- package/dist/blocks/file-explorer.d.ts +9 -1
- package/dist/blocks/file-explorer.js +461 -192
- package/dist/blocks/settings.d.ts +2 -1
- package/dist/blocks/settings.js +101 -79
- package/dist/blocks/team-chat.d.ts +12 -0
- package/dist/blocks/team-chat.js +26 -0
- package/dist/blocks/theme-toggle.js +23 -31
- package/dist/chat-composer-attachment.d.ts +12 -3
- package/dist/chat-composer-attachment.js +61 -19
- package/dist/chat-composer-editor/extensions/mention.d.ts +5 -1
- package/dist/chat-composer-editor/extensions/mention.js +58 -27
- package/dist/chat-composer-editor/ghost.js +2 -4
- package/dist/chat-composer-editor/types.d.ts +5 -0
- package/dist/chat-composer-editor.d.ts +1 -1
- package/dist/chat-composer-editor.js +71 -28
- package/dist/chat-composer.d.ts +13 -32
- package/dist/chat-composer.js +54 -13
- package/dist/chat-layout.d.ts +19 -0
- package/dist/chat-layout.js +96 -32
- package/dist/chat-message/social.d.ts +26 -0
- package/dist/chat-message/social.js +122 -0
- package/dist/chat-message.d.ts +28 -29
- package/dist/chat-message.js +106 -25
- package/dist/context.d.ts +2 -2
- package/dist/context.js +38 -23
- package/dist/dynamic-notification-canvas-loop.d.ts +24 -0
- package/dist/dynamic-notification-canvas-loop.js +113 -0
- package/dist/dynamic-notification-glass.js +23 -114
- package/dist/dynamic-notification-liquid.js +14 -118
- package/dist/dynamic-notification.d.ts +16 -8
- package/dist/dynamic-notification.js +85 -22
- package/dist/email/email-brand.d.ts +7 -4
- package/dist/email/email-brand.js +9 -6
- package/dist/email/email-code.d.ts +3 -2
- package/dist/email/email-code.js +11 -9
- package/dist/email/email-footer.d.ts +5 -3
- package/dist/email/email-footer.js +11 -5
- package/dist/email/email.d.ts +31 -9
- package/dist/email/email.js +50 -26
- package/dist/email/templates.d.ts +10 -9
- package/dist/email/templates.js +102 -38
- package/dist/email/theme.js +1 -1
- package/dist/environment-variables.d.ts +4 -2
- package/dist/environment-variables.js +52 -32
- package/dist/filter-bar/context.d.ts +32 -0
- package/dist/filter-bar/context.js +11 -0
- package/dist/filter-bar/editor.d.ts +14 -0
- package/dist/filter-bar/editor.js +216 -0
- package/dist/filter-bar/model.d.ts +10 -0
- package/dist/filter-bar/model.js +57 -0
- package/dist/filter-bar/motion.d.ts +10 -0
- package/dist/filter-bar/motion.js +84 -0
- package/dist/filter-bar/parts.d.ts +19 -0
- package/dist/filter-bar/parts.js +244 -0
- package/dist/filter-bar/types.d.ts +54 -0
- package/dist/filter-bar/types.js +0 -0
- package/dist/filter-bar.d.ts +27 -0
- package/dist/filter-bar.js +310 -0
- package/dist/hooks/use-audio-recorder.js +12 -6
- package/dist/hooks/use-chat-composer.d.ts +21 -7
- package/dist/hooks/use-chat-composer.js +32 -5
- package/dist/hooks/use-chat-message.d.ts +28 -2
- package/dist/hooks/use-chat-message.js +41 -10
- package/dist/hooks/use-chat-thread-scroll.js +43 -7
- package/dist/hooks/use-color-area.d.ts +3 -3
- package/dist/hooks/use-color-area.js +13 -12
- package/dist/hooks/use-copy-to-clipboard.d.ts +2 -1
- package/dist/hooks/use-copy-to-clipboard.js +20 -20
- package/dist/hooks/use-dropzone.d.ts +7 -4
- package/dist/hooks/use-dropzone.js +34 -3
- package/dist/hooks/use-dynamic-notification.d.ts +6 -2
- package/dist/hooks/use-dynamic-notification.js +26 -10
- package/dist/hooks/use-mobile.d.ts +3 -2
- package/dist/hooks/use-mobile.js +8 -4
- package/dist/hooks/use-textarea-trigger-menu.js +2 -1
- package/dist/hooks/use-trigger-menu.d.ts +54 -0
- package/dist/hooks/use-trigger-menu.js +102 -47
- package/dist/hooks/use-user-ask.d.ts +2 -0
- package/dist/hooks/use-user-ask.js +35 -41
- package/dist/inline-attachment.d.ts +6 -2
- package/dist/inline-attachment.js +44 -29
- package/dist/inline-citation.d.ts +12 -5
- package/dist/inline-citation.js +25 -16
- package/dist/knob-contracts/audio-recorder-knobs.d.ts +1 -1
- package/dist/knob-contracts/audio-recorder-knobs.js +2 -1
- package/dist/knob-contracts/audio-visualizer-knobs.d.ts +1 -1
- package/dist/knob-contracts/audio-visualizer-knobs.js +2 -1
- package/dist/knob-contracts/avatar-knobs.d.ts +1 -1
- package/dist/knob-contracts/avatar-knobs.js +6 -1
- package/dist/knob-contracts/badge-knobs.d.ts +1 -1
- package/dist/knob-contracts/badge-knobs.js +2 -1
- package/dist/knob-contracts/breadcrumb-knobs.d.ts +4 -0
- package/dist/knob-contracts/breadcrumb-knobs.js +8 -0
- package/dist/knob-contracts/button-knobs.d.ts +1 -1
- package/dist/knob-contracts/button-knobs.js +1 -0
- package/dist/knob-contracts/chat-layout-knobs.d.ts +1 -1
- package/dist/knob-contracts/chat-layout-knobs.js +2 -1
- package/dist/knob-contracts/chat-message-knobs.d.ts +1 -1
- package/dist/knob-contracts/chat-message-knobs.js +8 -1
- package/dist/knob-contracts/choice-knobs.d.ts +1 -1
- package/dist/knob-contracts/choice-knobs.js +1 -0
- package/dist/knob-contracts/code-diff-knobs.d.ts +1 -1
- package/dist/knob-contracts/code-diff-knobs.js +2 -0
- package/dist/knob-contracts/code-knobs.d.ts +1 -1
- package/dist/knob-contracts/code-knobs.js +2 -1
- package/dist/knob-contracts/collapsible-knobs.d.ts +1 -1
- package/dist/knob-contracts/collapsible-knobs.js +1 -1
- package/dist/knob-contracts/dynamic-notification-knobs.d.ts +1 -1
- package/dist/knob-contracts/dynamic-notification-knobs.js +2 -0
- package/dist/knob-contracts/emoji-picker-knobs.d.ts +4 -0
- package/dist/knob-contracts/emoji-picker-knobs.js +10 -0
- package/dist/knob-contracts/field-knobs.d.ts +1 -1
- package/dist/knob-contracts/field-knobs.js +5 -1
- package/dist/knob-contracts/filter-bar-knobs.d.ts +4 -0
- package/dist/knob-contracts/filter-bar-knobs.js +15 -0
- package/dist/knob-contracts/infinite-canvas-knobs.d.ts +1 -1
- package/dist/knob-contracts/infinite-canvas-knobs.js +3 -0
- package/dist/knob-contracts/markdown-knobs.d.ts +1 -1
- package/dist/knob-contracts/markdown-knobs.js +3 -1
- package/dist/knob-contracts/page-layout-knobs.d.ts +1 -1
- package/dist/knob-contracts/page-layout-knobs.js +4 -1
- package/dist/knob-contracts/popup-knobs.d.ts +1 -1
- package/dist/knob-contracts/popup-knobs.js +28 -0
- package/dist/knob-contracts/range-knobs.d.ts +1 -1
- package/dist/knob-contracts/range-knobs.js +1 -0
- package/dist/knob-contracts/rich-tooltip-knobs.d.ts +1 -1
- package/dist/knob-contracts/rich-tooltip-knobs.js +2 -1
- package/dist/knob-contracts/sidebar-knobs.d.ts +1 -1
- package/dist/knob-contracts/sidebar-knobs.js +27 -2
- package/dist/knob-contracts/spinner-knobs.d.ts +1 -1
- package/dist/knob-contracts/spinner-knobs.js +1 -1
- package/dist/knob-contracts/stepper-knobs.d.ts +1 -1
- package/dist/knob-contracts/stepper-knobs.js +4 -1
- package/dist/knob-contracts/switch-knobs.d.ts +1 -1
- package/dist/knob-contracts/switch-knobs.js +5 -0
- package/dist/knob-contracts/table-of-contents-knobs.d.ts +1 -1
- package/dist/knob-contracts/table-of-contents-knobs.js +4 -5
- package/dist/knob-contracts/tabs-knobs.d.ts +1 -1
- package/dist/knob-contracts/tabs-knobs.js +1 -0
- package/dist/knob-contracts/tree-knobs.d.ts +1 -1
- package/dist/knob-contracts/tree-knobs.js +2 -1
- package/dist/lib/cn.js +0 -4
- package/dist/lib/contrast.d.ts +1 -0
- package/dist/lib/contrast.js +17 -5
- package/dist/lib/dropzone-validation.js +41 -28
- package/dist/lib/env-file.d.ts +1 -1
- package/dist/lib/env-file.js +5 -5
- package/dist/lib/motion.d.ts +4 -0
- package/dist/lib/motion.js +15 -0
- package/dist/lib/trigger-detect.js +6 -8
- package/dist/markdown-block.js +13 -8
- package/dist/popup-parts.d.ts +8 -0
- package/dist/popup-parts.js +43 -0
- package/dist/scripts/contrast-eval.js +5 -4
- package/dist/source-badge.js +3 -1
- package/dist/styles/code.css +0 -2
- package/dist/styles/effects.css +6 -32
- package/dist/styles/index.css +14 -8
- package/dist/styles/recipes/accordion.css +9 -6
- package/dist/styles/recipes/action-bar.css +0 -15
- package/dist/styles/recipes/activity.css +5 -11
- package/dist/styles/recipes/alert.css +4 -4
- package/dist/styles/recipes/audio-recorder.css +15 -3
- package/dist/styles/recipes/audio-visualizer.css +13 -2
- package/dist/styles/recipes/avatar.css +78 -1
- package/dist/styles/recipes/badge.css +14 -4
- package/dist/styles/recipes/breadcrumb.css +77 -0
- package/dist/styles/recipes/button-group.css +6 -8
- package/dist/styles/recipes/button-states.css +66 -0
- package/dist/styles/recipes/button.css +26 -85
- package/dist/styles/recipes/calendar.css +17 -23
- package/dist/styles/recipes/card.css +2 -2
- package/dist/styles/recipes/chat-composer-attachment.css +9 -3
- package/dist/styles/recipes/chat-composer.css +21 -16
- package/dist/styles/recipes/chat-layout.css +64 -2
- package/dist/styles/recipes/chat-message-social.css +123 -0
- package/dist/styles/recipes/chat-message.css +157 -37
- package/dist/styles/recipes/choice.css +25 -21
- package/dist/styles/recipes/code-diff.css +51 -26
- package/dist/styles/recipes/code.css +44 -18
- package/dist/styles/recipes/collapsible.css +43 -1
- package/dist/styles/recipes/color-picker-details.css +3 -4
- package/dist/styles/recipes/color-picker-values.css +9 -8
- package/dist/styles/recipes/color-picker.css +23 -4
- package/dist/styles/recipes/context.css +3 -3
- package/dist/styles/recipes/dockable-panel.css +18 -7
- package/dist/styles/recipes/dropzone.css +7 -8
- package/dist/styles/recipes/dynamic-notification-input.css +8 -5
- package/dist/styles/recipes/dynamic-notification-motion.css +12 -21
- package/dist/styles/recipes/dynamic-notification.css +40 -26
- package/dist/styles/recipes/emoji-picker.css +132 -0
- package/dist/styles/recipes/empty.css +5 -4
- package/dist/styles/recipes/environment-variables.css +4 -15
- package/dist/styles/recipes/field-parts.css +89 -21
- package/dist/styles/recipes/field.css +83 -26
- package/dist/styles/recipes/filter-bar.css +161 -0
- package/dist/styles/recipes/gradient-editor.css +18 -7
- package/dist/styles/recipes/infinite-canvas.css +51 -4
- package/dist/styles/recipes/inline-attachment.css +9 -4
- package/dist/styles/recipes/inline-citation.css +10 -4
- package/dist/styles/recipes/item.css +23 -9
- package/dist/styles/recipes/markdown-block.css +5 -4
- package/dist/styles/recipes/markdown.css +68 -26
- package/dist/styles/recipes/morphing-panel.css +8 -8
- package/dist/styles/recipes/page-layout.css +36 -10
- package/dist/styles/recipes/pagination.css +5 -6
- package/dist/styles/recipes/phone-input.css +12 -8
- package/dist/styles/recipes/popup-controls.css +175 -26
- package/dist/styles/recipes/popup-drawer.css +35 -44
- package/dist/styles/recipes/popup-lists.css +139 -29
- package/dist/styles/recipes/popup-motion.css +4 -45
- package/dist/styles/recipes/popup-toast.css +55 -26
- package/dist/styles/recipes/popup.css +149 -153
- package/dist/styles/recipes/range.css +55 -19
- package/dist/styles/recipes/resizable.css +36 -7
- package/dist/styles/recipes/rich-tooltip.css +24 -34
- package/dist/styles/recipes/scroll-area.css +8 -1
- package/dist/styles/recipes/sidebar-menu.css +149 -34
- package/dist/styles/recipes/sidebar-parts.css +154 -0
- package/dist/styles/recipes/sidebar.css +187 -128
- package/dist/styles/recipes/source-badge.css +1 -1
- package/dist/styles/recipes/spinner.css +12 -1
- package/dist/styles/recipes/stepper.css +31 -13
- package/dist/styles/recipes/switch.css +68 -23
- package/dist/styles/recipes/table-of-contents.css +49 -41
- package/dist/styles/recipes/table.css +14 -10
- package/dist/styles/recipes/tabs.css +38 -12
- package/dist/styles/recipes/task-list.css +7 -14
- package/dist/styles/recipes/thread-rail.css +42 -19
- package/dist/styles/recipes/timeline.css +2 -0
- package/dist/styles/recipes/toolbar.css +27 -25
- package/dist/styles/recipes/track-highlight.css +12 -8
- package/dist/styles/recipes/transcript-divider.css +2 -2
- package/dist/styles/recipes/tree.css +31 -4
- package/dist/styles/recipes/user-ask-details.css +0 -1
- package/dist/styles/recipes/user-ask.css +4 -4
- package/dist/styles/theme.css +287 -107
- package/dist/task-list.d.ts +4 -1
- package/dist/task-list.js +24 -8
- package/dist/thread-rail.d.ts +1 -1
- package/dist/thread-rail.js +61 -19
- package/dist/transcript-divider.js +2 -1
- package/dist/ui/alert.d.ts +3 -1
- package/dist/ui/alert.js +14 -8
- package/dist/ui/autocomplete.js +7 -1
- package/dist/ui/avatar.d.ts +8 -0
- package/dist/ui/avatar.js +23 -3
- package/dist/ui/badge.js +1 -1
- package/dist/ui/breadcrumb.d.ts +27 -0
- package/dist/ui/breadcrumb.js +88 -0
- package/dist/ui/button.d.ts +2 -1
- package/dist/ui/button.js +1 -1
- package/dist/ui/calendar.js +2 -2
- package/dist/ui/card.d.ts +3 -1
- package/dist/ui/card.js +12 -7
- package/dist/ui/checkbox-group.js +1 -1
- package/dist/ui/checkbox.d.ts +2 -0
- package/dist/ui/code-diff.d.ts +1 -1
- package/dist/ui/code-diff.js +71 -27
- package/dist/ui/code.d.ts +5 -3
- package/dist/ui/code.js +27 -28
- package/dist/ui/color-picker.d.ts +5 -2
- package/dist/ui/color-picker.js +84 -36
- package/dist/ui/combobox-disabled-selection.d.ts +1 -2
- package/dist/ui/combobox-disabled-selection.js +7 -8
- package/dist/ui/combobox.d.ts +5 -23
- package/dist/ui/combobox.js +36 -16
- package/dist/ui/command.d.ts +8 -2
- package/dist/ui/command.js +39 -15
- package/dist/ui/context-menu.js +3 -0
- package/dist/ui/dialog.d.ts +2 -1
- package/dist/ui/dialog.js +3 -22
- package/dist/ui/dockable-panel-geometry.d.ts +1 -0
- package/dist/ui/dockable-panel-geometry.js +7 -1
- package/dist/ui/dockable-panel.d.ts +9 -6
- package/dist/ui/dockable-panel.js +81 -33
- package/dist/ui/drawer.d.ts +7 -4
- package/dist/ui/drawer.js +35 -22
- package/dist/ui/dropdown-menu.js +4 -3
- package/dist/ui/dropzone.d.ts +5 -3
- package/dist/ui/dropzone.js +78 -17
- package/dist/ui/emoji-picker.d.ts +18 -0
- package/dist/ui/emoji-picker.js +136 -0
- package/dist/ui/empty.d.ts +3 -1
- package/dist/ui/empty.js +12 -7
- package/dist/ui/field.js +1 -1
- package/dist/ui/gradient-editor.d.ts +1 -1
- package/dist/ui/gradient-editor.js +37 -21
- package/dist/ui/infinite-canvas.d.ts +13 -1
- package/dist/ui/infinite-canvas.js +139 -20
- package/dist/ui/input-group.d.ts +2 -4
- package/dist/ui/input-group.js +13 -14
- package/dist/ui/input-otp.d.ts +1 -1
- package/dist/ui/input-otp.js +32 -15
- package/dist/ui/input.js +11 -2
- package/dist/ui/item.d.ts +2 -1
- package/dist/ui/item.js +11 -7
- package/dist/ui/live-status.d.ts +7 -0
- package/dist/ui/live-status.js +17 -0
- package/dist/ui/markdown-elements.d.ts +6 -0
- package/dist/ui/markdown-elements.js +42 -9
- package/dist/ui/menubar.js +2 -2
- package/dist/ui/morphing-panel.js +2 -1
- package/dist/ui/native-select.d.ts +1 -1
- package/dist/ui/native-select.js +24 -11
- package/dist/ui/number-field.d.ts +1 -1
- package/dist/ui/number-field.js +13 -2
- package/dist/ui/page-layout.d.ts +2 -2
- package/dist/ui/page-layout.js +2 -4
- package/dist/ui/pagination.d.ts +7 -5
- package/dist/ui/pagination.js +19 -13
- package/dist/ui/phone-input.d.ts +1 -0
- package/dist/ui/phone-input.js +56 -58
- package/dist/ui/radio-group.d.ts +3 -0
- package/dist/ui/radio-group.js +11 -1
- package/dist/ui/resizable.d.ts +20 -2
- package/dist/ui/resizable.js +130 -8
- package/dist/ui/responsive-dialog.d.ts +1 -1
- package/dist/ui/responsive-dialog.js +9 -23
- package/dist/ui/rich-tooltip.d.ts +10 -4
- package/dist/ui/rich-tooltip.js +81 -33
- package/dist/ui/scroll-area.d.ts +4 -1
- package/dist/ui/scroll-area.js +44 -28
- package/dist/ui/select.d.ts +2 -1
- package/dist/ui/select.js +57 -32
- package/dist/ui/sidebar-menu.d.ts +5 -1
- package/dist/ui/sidebar-menu.js +31 -33
- package/dist/ui/sidebar-provider.d.ts +10 -1
- package/dist/ui/sidebar-provider.js +38 -13
- package/dist/ui/sidebar-resize-rail.js +7 -3
- package/dist/ui/sidebar.d.ts +11 -6
- package/dist/ui/sidebar.js +46 -23
- package/dist/ui/slider.js +31 -22
- package/dist/ui/spinner.d.ts +3 -2
- package/dist/ui/spinner.js +3 -2
- package/dist/ui/stepper.d.ts +8 -1
- package/dist/ui/stepper.js +74 -25
- package/dist/ui/switch.d.ts +1 -0
- package/dist/ui/table-of-contents.d.ts +5 -4
- package/dist/ui/table-of-contents.js +143 -52
- package/dist/ui/table.js +15 -9
- package/dist/ui/textarea.d.ts +1 -1
- package/dist/ui/textarea.js +20 -9
- package/dist/ui/timeline.d.ts +3 -1
- package/dist/ui/timeline.js +17 -9
- package/dist/ui/toast.d.ts +11 -5
- package/dist/ui/toast.js +100 -54
- package/dist/ui/toggle.d.ts +1 -1
- package/dist/ui/toggle.js +2 -1
- package/dist/ui/toolbar.d.ts +3 -2
- package/dist/ui/toolbar.js +4 -2
- package/dist/ui/tooltip.js +3 -20
- package/dist/ui/tree.js +120 -80
- package/dist/ui/trigger-menu.js +7 -2
- package/dist/user-ask.d.ts +10 -5
- package/dist/user-ask.js +31 -11
- package/package.json +5 -1
- package/dist/hooks/use-keyboard-navigation.d.ts +0 -3
- package/dist/hooks/use-keyboard-navigation.js +0 -22
|
@@ -14,6 +14,10 @@ const DEFAULT_MIN_SCALE = .35;
|
|
|
14
14
|
const DEFAULT_MAX_SCALE = 2.5;
|
|
15
15
|
const KEYBOARD_PAN_STEP = 32;
|
|
16
16
|
const GRID_SIZE = 24;
|
|
17
|
+
const WHEEL_ZOOM_SPEED = .004;
|
|
18
|
+
const MAX_WHEEL_ZOOM_DELTA = 50;
|
|
19
|
+
const CANVAS_KEY_SHORTCUTS = "ArrowLeft ArrowRight ArrowUp ArrowDown + - 0";
|
|
20
|
+
const NOTCHED_WHEEL_DELTA = 40;
|
|
17
21
|
const KEYBOARD_PAN_DIRECTIONS = {
|
|
18
22
|
ArrowLeft: {
|
|
19
23
|
x: -1,
|
|
@@ -32,6 +36,14 @@ const KEYBOARD_PAN_DIRECTIONS = {
|
|
|
32
36
|
y: 1
|
|
33
37
|
}
|
|
34
38
|
};
|
|
39
|
+
const KEYBOARD_ZOOM_FACTORS = {
|
|
40
|
+
"+": 1.15,
|
|
41
|
+
"=": 1.15,
|
|
42
|
+
"-": 1 / 1.15
|
|
43
|
+
};
|
|
44
|
+
function keyboardPanStep(shiftKey) {
|
|
45
|
+
return shiftKey ? 96 : KEYBOARD_PAN_STEP;
|
|
46
|
+
}
|
|
35
47
|
const InfiniteCanvasContext = createContext(null);
|
|
36
48
|
function clampScale(scale, minScale, maxScale) {
|
|
37
49
|
return Math.min(Math.max(scale, minScale), maxScale);
|
|
@@ -45,10 +57,13 @@ function zoomAroundPoint(transform, nextScale, point) {
|
|
|
45
57
|
scale: nextScale
|
|
46
58
|
};
|
|
47
59
|
}
|
|
60
|
+
function wheelDeltaMultiplier(event, viewportHeight) {
|
|
61
|
+
if (event.deltaMode === WheelEvent.DOM_DELTA_LINE) return 16;
|
|
62
|
+
if (event.deltaMode === WheelEvent.DOM_DELTA_PAGE) return viewportHeight;
|
|
63
|
+
return 1;
|
|
64
|
+
}
|
|
48
65
|
function panFromWheel(transform, event, viewportHeight) {
|
|
49
|
-
|
|
50
|
-
if (event.deltaMode === WheelEvent.DOM_DELTA_LINE) deltaMultiplier = 16;
|
|
51
|
-
else if (event.deltaMode === WheelEvent.DOM_DELTA_PAGE) deltaMultiplier = viewportHeight;
|
|
66
|
+
const deltaMultiplier = wheelDeltaMultiplier(event, viewportHeight);
|
|
52
67
|
const horizontalDelta = event.shiftKey && event.deltaX === 0 ? event.deltaY : event.deltaX;
|
|
53
68
|
const verticalDelta = event.shiftKey && event.deltaX === 0 ? 0 : event.deltaY;
|
|
54
69
|
return {
|
|
@@ -62,11 +77,12 @@ function useInfiniteCanvas() {
|
|
|
62
77
|
if (!context) throw new Error("useInfiniteCanvas must be used within InfiniteCanvas");
|
|
63
78
|
return context;
|
|
64
79
|
}
|
|
65
|
-
function InfiniteCanvas({ transform: controlledTransform, defaultTransform = DEFAULT_TRANSFORM, onTransformChange, minScale: minScaleProp = DEFAULT_MIN_SCALE, maxScale: maxScaleProp = DEFAULT_MAX_SCALE, className, children, style, onPointerDown, onPointerMove, onPointerUp, onPointerCancel, onWheel, onKeyDown, "aria-label": ariaLabel = "Infinite canvas", ...props }) {
|
|
80
|
+
function InfiniteCanvas({ transform: controlledTransform, defaultTransform = DEFAULT_TRANSFORM, onTransformChange, minScale: minScaleProp = DEFAULT_MIN_SCALE, maxScale: maxScaleProp = DEFAULT_MAX_SCALE, className, children, style, onPointerDown, onPointerMove, onPointerUp, onPointerCancel, onWheel, onKeyDown, "aria-label": ariaLabel = "Infinite canvas", "aria-keyshortcuts": ariaKeyShortcuts, ...props }) {
|
|
66
81
|
const minScale = Math.max(.1, minScaleProp);
|
|
67
82
|
const maxScale = Math.max(minScale, maxScaleProp);
|
|
68
83
|
const [uncontrolledTransform, setUncontrolledTransform] = useState(defaultTransform);
|
|
69
84
|
const [panning, setPanning] = useState(false);
|
|
85
|
+
const [easing, setEasing] = useState(false);
|
|
70
86
|
const panRef = useRef(null);
|
|
71
87
|
const rootRef = useRef(null);
|
|
72
88
|
const transform = controlledTransform ?? uncontrolledTransform;
|
|
@@ -74,7 +90,8 @@ function InfiniteCanvas({ transform: controlledTransform, defaultTransform = DEF
|
|
|
74
90
|
useEffect(() => {
|
|
75
91
|
transformRef.current = transform;
|
|
76
92
|
}, [transform]);
|
|
77
|
-
function commitTransform(next, reason) {
|
|
93
|
+
function commitTransform(next, reason, eased = reason === "control" || reason === "keyboard") {
|
|
94
|
+
setEasing(eased);
|
|
78
95
|
const bounded = {
|
|
79
96
|
...next,
|
|
80
97
|
scale: clampScale(next.scale, minScale, maxScale)
|
|
@@ -152,7 +169,11 @@ function InfiniteCanvas({ transform: controlledTransform, defaultTransform = DEF
|
|
|
152
169
|
x: event.clientX - bounds.left,
|
|
153
170
|
y: event.clientY - bounds.top
|
|
154
171
|
};
|
|
155
|
-
|
|
172
|
+
const zoomDelta = event.deltaY * wheelDeltaMultiplier(event, root.clientHeight);
|
|
173
|
+
const boundedZoomDelta = Math.min(Math.max(zoomDelta, -50), MAX_WHEEL_ZOOM_DELTA);
|
|
174
|
+
const nextScale = clampScale(currentTransform.scale * Math.exp(-boundedZoomDelta * WHEEL_ZOOM_SPEED), minScale, maxScale);
|
|
175
|
+
const notchedWheel = Math.abs(zoomDelta) >= NOTCHED_WHEEL_DELTA;
|
|
176
|
+
commitTransform(zoomAroundPoint(currentTransform, nextScale, point), "wheel", notchedWheel);
|
|
156
177
|
return;
|
|
157
178
|
}
|
|
158
179
|
commitTransform(panFromWheel(currentTransform, event, root.clientHeight), "wheel");
|
|
@@ -164,23 +185,32 @@ function InfiniteCanvas({ transform: controlledTransform, defaultTransform = DEF
|
|
|
164
185
|
root.addEventListener("wheel", listener, { passive: false });
|
|
165
186
|
return () => root.removeEventListener("wheel", listener);
|
|
166
187
|
}, []);
|
|
167
|
-
function
|
|
168
|
-
|
|
169
|
-
if (event.defaultPrevented) return;
|
|
170
|
-
const currentTransform = transformRef.current;
|
|
171
|
-
const direction = KEYBOARD_PAN_DIRECTIONS[event.key];
|
|
188
|
+
function applyKeyboardCommand(key, shiftKey) {
|
|
189
|
+
const direction = KEYBOARD_PAN_DIRECTIONS[key];
|
|
172
190
|
if (direction) {
|
|
173
|
-
const
|
|
191
|
+
const currentTransform = transformRef.current;
|
|
192
|
+
const panStep = keyboardPanStep(shiftKey);
|
|
174
193
|
commitTransform({
|
|
175
194
|
...currentTransform,
|
|
176
195
|
x: currentTransform.x + direction.x * panStep,
|
|
177
196
|
y: currentTransform.y + direction.y * panStep
|
|
178
197
|
}, "keyboard");
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
198
|
+
return true;
|
|
199
|
+
}
|
|
200
|
+
const zoomFactor = KEYBOARD_ZOOM_FACTORS[key];
|
|
201
|
+
if (zoomFactor) {
|
|
202
|
+
zoomBy(zoomFactor, "keyboard");
|
|
203
|
+
return true;
|
|
204
|
+
}
|
|
205
|
+
if (key !== "0") return false;
|
|
206
|
+
reset("keyboard");
|
|
207
|
+
return true;
|
|
208
|
+
}
|
|
209
|
+
function moveWithKeyboard(event) {
|
|
210
|
+
onKeyDown?.(event);
|
|
211
|
+
if (event.defaultPrevented || event.target !== event.currentTarget) return;
|
|
212
|
+
if (event.ctrlKey || event.metaKey || event.altKey) return;
|
|
213
|
+
if (applyKeyboardCommand(event.key, event.shiftKey)) event.preventDefault();
|
|
184
214
|
}
|
|
185
215
|
const context = {
|
|
186
216
|
transform,
|
|
@@ -203,9 +233,10 @@ function InfiniteCanvas({ transform: controlledTransform, defaultTransform = DEF
|
|
|
203
233
|
"data-control-family": "infinite-canvas",
|
|
204
234
|
"data-slot": "root",
|
|
205
235
|
"data-panning": panning || void 0,
|
|
236
|
+
"data-easing": easing || void 0,
|
|
206
237
|
"aria-label": ariaLabel,
|
|
207
238
|
role: "application",
|
|
208
|
-
"aria-keyshortcuts":
|
|
239
|
+
"aria-keyshortcuts": ariaKeyShortcuts ? `${CANVAS_KEY_SHORTCUTS} ${ariaKeyShortcuts}` : CANVAS_KEY_SHORTCUTS,
|
|
209
240
|
tabIndex: 0,
|
|
210
241
|
className: cn("relative isolate overflow-hidden overscroll-contain touch-none select-none data-panning:cursor-grabbing", className),
|
|
211
242
|
style: canvasStyle,
|
|
@@ -233,6 +264,94 @@ function InfiniteCanvasContent({ className, style, ...props }) {
|
|
|
233
264
|
}
|
|
234
265
|
});
|
|
235
266
|
}
|
|
267
|
+
function InfiniteCanvasItem({ x, y, onPositionChange, movableItemLabel = "Movable item", className, style, onPointerDown, onPointerMove, onPointerUp, onPointerCancel, onKeyDown, ...props }) {
|
|
268
|
+
const { transform } = useInfiniteCanvas();
|
|
269
|
+
const dragRef = useRef(null);
|
|
270
|
+
const [dragging, setDragging] = useState(false);
|
|
271
|
+
function beginDrag(event) {
|
|
272
|
+
onPointerDown?.(event);
|
|
273
|
+
if (event.defaultPrevented || !onPositionChange || !event.isPrimary || event.button !== 0) return;
|
|
274
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
275
|
+
dragRef.current = {
|
|
276
|
+
pointerId: event.pointerId,
|
|
277
|
+
startPointer: {
|
|
278
|
+
x: event.clientX,
|
|
279
|
+
y: event.clientY
|
|
280
|
+
},
|
|
281
|
+
startPosition: {
|
|
282
|
+
x,
|
|
283
|
+
y
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
setDragging(true);
|
|
287
|
+
}
|
|
288
|
+
function updateDrag(event) {
|
|
289
|
+
onPointerMove?.(event);
|
|
290
|
+
const drag = dragRef.current;
|
|
291
|
+
if (event.defaultPrevented || !drag || drag.pointerId !== event.pointerId) return;
|
|
292
|
+
onPositionChange?.({
|
|
293
|
+
x: drag.startPosition.x + (event.clientX - drag.startPointer.x) / transform.scale,
|
|
294
|
+
y: drag.startPosition.y + (event.clientY - drag.startPointer.y) / transform.scale
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
function finishDrag(event) {
|
|
298
|
+
if (dragRef.current?.pointerId !== event.pointerId) return;
|
|
299
|
+
if (event.currentTarget.hasPointerCapture(event.pointerId)) event.currentTarget.releasePointerCapture(event.pointerId);
|
|
300
|
+
dragRef.current = null;
|
|
301
|
+
setDragging(false);
|
|
302
|
+
}
|
|
303
|
+
function endDrag(event) {
|
|
304
|
+
onPointerUp?.(event);
|
|
305
|
+
finishDrag(event);
|
|
306
|
+
}
|
|
307
|
+
function cancelDrag(event) {
|
|
308
|
+
onPointerCancel?.(event);
|
|
309
|
+
finishDrag(event);
|
|
310
|
+
}
|
|
311
|
+
function moveWithKeyboard(event) {
|
|
312
|
+
onKeyDown?.(event);
|
|
313
|
+
if (event.defaultPrevented || !onPositionChange || event.target !== event.currentTarget) return;
|
|
314
|
+
if (event.ctrlKey || event.metaKey || event.altKey) return;
|
|
315
|
+
const direction = KEYBOARD_PAN_DIRECTIONS[event.key];
|
|
316
|
+
if (!direction) return;
|
|
317
|
+
event.preventDefault();
|
|
318
|
+
const step = keyboardPanStep(event.shiftKey) / transform.scale;
|
|
319
|
+
onPositionChange({
|
|
320
|
+
x: x + direction.x * step,
|
|
321
|
+
y: y + direction.y * step
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
return /* @__PURE__ */ jsx("div", {
|
|
325
|
+
...onPositionChange ? {
|
|
326
|
+
role: "group",
|
|
327
|
+
"aria-roledescription": movableItemLabel,
|
|
328
|
+
"aria-keyshortcuts": "ArrowLeft ArrowRight ArrowUp ArrowDown",
|
|
329
|
+
tabIndex: 0,
|
|
330
|
+
onPointerDown: beginDrag,
|
|
331
|
+
onPointerMove: updateDrag,
|
|
332
|
+
onPointerUp: endDrag,
|
|
333
|
+
onPointerCancel: cancelDrag,
|
|
334
|
+
onKeyDown: moveWithKeyboard
|
|
335
|
+
} : {
|
|
336
|
+
onPointerDown,
|
|
337
|
+
onPointerMove,
|
|
338
|
+
onPointerUp,
|
|
339
|
+
onPointerCancel,
|
|
340
|
+
onKeyDown
|
|
341
|
+
},
|
|
342
|
+
...props,
|
|
343
|
+
"data-control-ui": "infinite-canvas",
|
|
344
|
+
"data-control-family": "infinite-canvas",
|
|
345
|
+
"data-slot": "item",
|
|
346
|
+
"data-dragging": dragging || void 0,
|
|
347
|
+
className: cn("absolute", onPositionChange && "cursor-grab touch-none data-dragging:cursor-grabbing", className),
|
|
348
|
+
style: {
|
|
349
|
+
...style,
|
|
350
|
+
left: x,
|
|
351
|
+
top: y
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
}
|
|
236
355
|
function InfiniteCanvasControls({ className, ...props }) {
|
|
237
356
|
const canvas = useInfiniteCanvas();
|
|
238
357
|
const percentage = Math.round(canvas.transform.scale * 100);
|
|
@@ -240,7 +359,7 @@ function InfiniteCanvasControls({ className, ...props }) {
|
|
|
240
359
|
"data-control-ui": "infinite-canvas",
|
|
241
360
|
"data-control-family": "infinite-canvas",
|
|
242
361
|
"data-slot": "controls",
|
|
243
|
-
className: cn("absolute
|
|
362
|
+
className: cn("absolute z-40 flex items-center", className),
|
|
244
363
|
...props,
|
|
245
364
|
children: [
|
|
246
365
|
/* @__PURE__ */ jsx(Button, {
|
|
@@ -276,4 +395,4 @@ function InfiniteCanvasControls({ className, ...props }) {
|
|
|
276
395
|
});
|
|
277
396
|
}
|
|
278
397
|
//#endregion
|
|
279
|
-
export { InfiniteCanvas, InfiniteCanvasContent, InfiniteCanvasControls, useInfiniteCanvas };
|
|
398
|
+
export { InfiniteCanvas, InfiniteCanvasContent, InfiniteCanvasControls, InfiniteCanvasItem, useInfiniteCanvas };
|
package/dist/ui/input-group.d.ts
CHANGED
|
@@ -12,9 +12,7 @@ export type InputGroupProps = Omit<ComponentProps<"div">, "style"> & {
|
|
|
12
12
|
export type InputGroupAddonProps = ComponentProps<"span"> & {
|
|
13
13
|
style?: CSSProperties & FieldKnobStyle;
|
|
14
14
|
};
|
|
15
|
-
export declare function
|
|
15
|
+
export declare function useIsInsideInputGroup(): boolean;
|
|
16
|
+
export declare function InputGroup({ size, className, render, children, ...props }: InputGroupProps): import("react").JSX.Element;
|
|
16
17
|
export declare function InputGroupAddon({ className, ...props }: InputGroupAddonProps): import("react").JSX.Element;
|
|
17
|
-
export declare function InputGroupInput({ className, ...props }: ComponentProps<"input"> & {
|
|
18
|
-
style?: CSSProperties & FieldKnobStyle;
|
|
19
|
-
}): import("react").JSX.Element;
|
|
20
18
|
//#endregion
|
package/dist/ui/input-group.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../lib/cn.js";
|
|
3
|
+
import { createContext, use } from "react";
|
|
3
4
|
import { useRender } from "@base-ui/react/use-render";
|
|
4
5
|
import { jsx } from "react/jsx-runtime";
|
|
5
6
|
//#region src/ui/input-group.tsx
|
|
7
|
+
const InputGroupSurfaceContext = createContext(false);
|
|
8
|
+
function useIsInsideInputGroup() {
|
|
9
|
+
return use(InputGroupSurfaceContext);
|
|
10
|
+
}
|
|
6
11
|
function InputGroup({ size = "md", className, render, children, ...props }) {
|
|
7
12
|
const classes = cn("flex min-w-0 w-full items-center overflow-hidden", className);
|
|
8
|
-
|
|
13
|
+
const group = useRender({
|
|
9
14
|
defaultTagName: "div",
|
|
10
15
|
render,
|
|
11
16
|
props: {
|
|
@@ -19,26 +24,20 @@ function InputGroup({ size = "md", className, render, children, ...props }) {
|
|
|
19
24
|
children
|
|
20
25
|
}
|
|
21
26
|
});
|
|
27
|
+
return /* @__PURE__ */ jsx(InputGroupSurfaceContext, {
|
|
28
|
+
value: true,
|
|
29
|
+
children: group
|
|
30
|
+
});
|
|
22
31
|
}
|
|
23
32
|
function InputGroupAddon({ className, ...props }) {
|
|
24
33
|
return /* @__PURE__ */ jsx("span", {
|
|
34
|
+
...props,
|
|
25
35
|
"data-control-ui": "input-group",
|
|
26
36
|
"data-control-family": "field",
|
|
27
37
|
"data-field-kind": "input-group",
|
|
28
38
|
"data-slot": "addon",
|
|
29
|
-
className: cn("inline-flex shrink-0 items-center", className)
|
|
30
|
-
...props
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
function InputGroupInput({ className, ...props }) {
|
|
34
|
-
return /* @__PURE__ */ jsx("input", {
|
|
35
|
-
"data-control-ui": "input-group",
|
|
36
|
-
"data-control-family": "field",
|
|
37
|
-
"data-field-kind": "input-group",
|
|
38
|
-
"data-slot": "input",
|
|
39
|
-
className: cn("h-full min-w-0 flex-1", className),
|
|
40
|
-
...props
|
|
39
|
+
className: cn("inline-flex shrink-0 items-center", className)
|
|
41
40
|
});
|
|
42
41
|
}
|
|
43
42
|
//#endregion
|
|
44
|
-
export { InputGroup, InputGroupAddon,
|
|
43
|
+
export { InputGroup, InputGroupAddon, useIsInsideInputGroup };
|
package/dist/ui/input-otp.d.ts
CHANGED
|
@@ -33,5 +33,5 @@ export type InputOTPSeparatorProps = ComponentProps<"div"> & {
|
|
|
33
33
|
};
|
|
34
34
|
export declare function InputOTPSlot({ index, length, className, ...props }: InputOTPSlotProps): import("react").JSX.Element;
|
|
35
35
|
export declare function InputOTPSeparator({ className, ...props }: InputOTPSeparatorProps): import("react").JSX.Element;
|
|
36
|
-
export declare function InputOTP({ length, separator, className, children, ...props }: InputOTPProps): import("react").JSX.Element;
|
|
36
|
+
export declare function InputOTP({ length, separator, className, children, "aria-label": ariaLabel, ...props }: InputOTPProps): import("react").JSX.Element;
|
|
37
37
|
//#endregion
|
package/dist/ui/input-otp.js
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../lib/cn.js";
|
|
3
|
-
import { Fragment } from "react";
|
|
3
|
+
import { Fragment, createContext, useContext, useId } from "react";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { OTPField } from "@base-ui/react/otp-field";
|
|
6
6
|
//#region src/ui/input-otp.tsx
|
|
7
|
+
const InputOTPLabelContext = createContext(void 0);
|
|
8
|
+
function slotAriaLabel(index, length) {
|
|
9
|
+
if (index === 0) return void 0;
|
|
10
|
+
return length ? `Character ${index + 1} of ${length}` : `Character ${index + 1}`;
|
|
11
|
+
}
|
|
7
12
|
function InputOTPSlot({ index, length, className, ...props }) {
|
|
13
|
+
const labelId = useContext(InputOTPLabelContext);
|
|
8
14
|
return /* @__PURE__ */ jsx(OTPField.Input, {
|
|
9
15
|
"data-control-ui": "input-otp",
|
|
10
16
|
"data-field-kind": "input-otp",
|
|
11
17
|
"data-slot": "slot",
|
|
12
18
|
"data-control-family": "field",
|
|
13
19
|
"data-control": "true",
|
|
14
|
-
"aria-label":
|
|
20
|
+
"aria-label": slotAriaLabel(index, length),
|
|
21
|
+
"aria-labelledby": index === 0 ? labelId : void 0,
|
|
15
22
|
className: cn("relative flex size-[var(--control-h-md)] items-center justify-center", className),
|
|
16
23
|
...props
|
|
17
24
|
});
|
|
@@ -26,19 +33,29 @@ function InputOTPSeparator({ className, ...props }) {
|
|
|
26
33
|
...props
|
|
27
34
|
});
|
|
28
35
|
}
|
|
29
|
-
function InputOTP({ length = 6, separator = false, className, children, ...props }) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
function InputOTP({ length = 6, separator = false, className, children, "aria-label": ariaLabel, ...props }) {
|
|
37
|
+
const labelId = useId();
|
|
38
|
+
const labelledBy = ariaLabel ? labelId : void 0;
|
|
39
|
+
return /* @__PURE__ */ jsxs(InputOTPLabelContext.Provider, {
|
|
40
|
+
value: labelledBy,
|
|
41
|
+
children: [ariaLabel ? /* @__PURE__ */ jsx("span", {
|
|
42
|
+
id: labelId,
|
|
43
|
+
hidden: true,
|
|
44
|
+
children: ariaLabel
|
|
45
|
+
}) : null, /* @__PURE__ */ jsx(OTPField.Root, {
|
|
46
|
+
"data-control-ui": "input-otp",
|
|
47
|
+
"data-control-family": "field",
|
|
48
|
+
"data-field-kind": "input-otp",
|
|
49
|
+
"data-slot": "root",
|
|
50
|
+
length,
|
|
51
|
+
"aria-labelledby": labelledBy,
|
|
52
|
+
className: cn("flex items-center", className),
|
|
53
|
+
...props,
|
|
54
|
+
children: children ?? Array.from({ length }, (_, index) => `input-otp-slot-${index}`).map((slotKey, index) => /* @__PURE__ */ jsxs(Fragment, { children: [separator && index === Math.ceil(length / 2) ? /* @__PURE__ */ jsx(InputOTPSeparator, {}) : null, /* @__PURE__ */ jsx(InputOTPSlot, {
|
|
55
|
+
index,
|
|
56
|
+
length
|
|
57
|
+
})] }, slotKey))
|
|
58
|
+
})]
|
|
42
59
|
});
|
|
43
60
|
}
|
|
44
61
|
//#endregion
|
package/dist/ui/input.js
CHANGED
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../lib/cn.js";
|
|
3
|
+
import { useIsInsideInputGroup } from "./input-group.js";
|
|
3
4
|
import { jsx } from "react/jsx-runtime";
|
|
4
5
|
import { Input as Input$1 } from "@base-ui/react/input";
|
|
5
6
|
//#region src/ui/input.tsx
|
|
6
7
|
function Input({ size = "md", className, ...props }) {
|
|
8
|
+
if (useIsInsideInputGroup()) return /* @__PURE__ */ jsx(Input$1, {
|
|
9
|
+
...props,
|
|
10
|
+
"data-control-ui": "input-group",
|
|
11
|
+
"data-control-family": "field",
|
|
12
|
+
"data-field-kind": "input-group",
|
|
13
|
+
"data-slot": "input",
|
|
14
|
+
className: cn("h-full min-w-0 flex-1", className)
|
|
15
|
+
});
|
|
7
16
|
return /* @__PURE__ */ jsx(Input$1, {
|
|
17
|
+
...props,
|
|
8
18
|
"data-control-ui": "input",
|
|
9
19
|
"data-slot": "root",
|
|
10
20
|
"data-control-family": "field",
|
|
11
21
|
"data-control": "true",
|
|
12
22
|
"data-size": size,
|
|
13
|
-
className: cn("w-full min-w-0", className)
|
|
14
|
-
...props
|
|
23
|
+
className: cn("w-full min-w-0", className)
|
|
15
24
|
});
|
|
16
25
|
}
|
|
17
26
|
//#endregion
|
package/dist/ui/item.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export type ItemMediaProps = Omit<ComponentProps<"div">, "style"> & {
|
|
|
20
20
|
style?: CSSProperties & ItemKnobStyle;
|
|
21
21
|
};
|
|
22
22
|
export type ItemTitleProps = Omit<ComponentProps<"div">, "style"> & {
|
|
23
|
+
render?: RenderProp<ComponentProps<"div">>;
|
|
23
24
|
style?: CSSProperties & ItemKnobStyle;
|
|
24
25
|
};
|
|
25
26
|
export type ItemGroupProps = ComponentProps<"div"> & {
|
|
@@ -33,7 +34,7 @@ export declare function ItemMedia({ className, ...props }: ItemMediaProps): impo
|
|
|
33
34
|
export declare function ItemContent({ className, ...props }: ComponentProps<"div"> & {
|
|
34
35
|
style?: CSSProperties & ItemKnobStyle;
|
|
35
36
|
}): import("react").JSX.Element;
|
|
36
|
-
export declare function ItemTitle({ className, ...props }: ItemTitleProps): import("react").
|
|
37
|
+
export declare function ItemTitle({ render, className, ...props }: ItemTitleProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
37
38
|
export declare function ItemDescription({ className, ...props }: ItemDescriptionProps): import("react").JSX.Element;
|
|
38
39
|
export declare function ItemActions({ className, ...props }: ComponentProps<"div"> & {
|
|
39
40
|
style?: CSSProperties & ItemKnobStyle;
|
package/dist/ui/item.js
CHANGED
|
@@ -61,13 +61,17 @@ function ItemContent({ className, ...props }) {
|
|
|
61
61
|
...props
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
|
-
function ItemTitle({ className, ...props }) {
|
|
65
|
-
return
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
64
|
+
function ItemTitle({ render, className, ...props }) {
|
|
65
|
+
return useRender({
|
|
66
|
+
defaultTagName: "div",
|
|
67
|
+
render,
|
|
68
|
+
props: {
|
|
69
|
+
...props,
|
|
70
|
+
"data-control-ui": "item",
|
|
71
|
+
"data-control-family": "item",
|
|
72
|
+
"data-slot": "title",
|
|
73
|
+
className: cn("flex w-fit items-center", className)
|
|
74
|
+
}
|
|
71
75
|
});
|
|
72
76
|
}
|
|
73
77
|
function ItemDescription({ className, ...props }) {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
//#region src/ui/live-status.d.ts
|
|
3
|
+
export type LiveStatusProps = Omit<ComponentProps<"span">, "role" | "children"> & {
|
|
4
|
+
message: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function LiveStatus({ message, className, ...props }: LiveStatusProps): import("react").JSX.Element;
|
|
7
|
+
//#endregion
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/ui/live-status.tsx
|
|
4
|
+
function LiveStatus({ message, className, ...props }) {
|
|
5
|
+
return /* @__PURE__ */ jsx("span", {
|
|
6
|
+
...props,
|
|
7
|
+
role: "status",
|
|
8
|
+
"aria-live": "polite",
|
|
9
|
+
"aria-atomic": "true",
|
|
10
|
+
"data-control-ui": "live-status",
|
|
11
|
+
"data-slot": "root",
|
|
12
|
+
className: cn("sr-only", className),
|
|
13
|
+
children: message
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { LiveStatus };
|
|
@@ -17,6 +17,9 @@ export declare function MarkdownCode({ className, children, node: _node, ...prop
|
|
|
17
17
|
export declare function MarkdownH1({ className, node: _node, ...props }: MarkdownElementProps<"h1">): JSX.Element;
|
|
18
18
|
export declare function MarkdownH2({ className, node: _node, ...props }: MarkdownElementProps<"h2">): JSX.Element;
|
|
19
19
|
export declare function MarkdownH3({ className, node: _node, ...props }: MarkdownElementProps<"h3">): JSX.Element;
|
|
20
|
+
export declare function MarkdownH4({ className, node: _node, ...props }: MarkdownElementProps<"h4">): JSX.Element;
|
|
21
|
+
export declare function MarkdownH5({ className, node: _node, ...props }: MarkdownElementProps<"h5">): JSX.Element;
|
|
22
|
+
export declare function MarkdownH6({ className, node: _node, ...props }: MarkdownElementProps<"h6">): JSX.Element;
|
|
20
23
|
export declare function MarkdownP({ className, node: _node, ...props }: MarkdownElementProps<"p">): JSX.Element;
|
|
21
24
|
export declare function MarkdownUl({ className, node: _node, ...props }: MarkdownElementProps<"ul">): JSX.Element;
|
|
22
25
|
export declare function MarkdownOl({ className, node: _node, ...props }: MarkdownElementProps<"ol">): JSX.Element;
|
|
@@ -35,6 +38,9 @@ export declare const markdownComponents: {
|
|
|
35
38
|
h1: typeof MarkdownH1;
|
|
36
39
|
h2: typeof MarkdownH2;
|
|
37
40
|
h3: typeof MarkdownH3;
|
|
41
|
+
h4: typeof MarkdownH4;
|
|
42
|
+
h5: typeof MarkdownH5;
|
|
43
|
+
h6: typeof MarkdownH6;
|
|
38
44
|
p: typeof MarkdownP;
|
|
39
45
|
ul: typeof MarkdownUl;
|
|
40
46
|
ol: typeof MarkdownOl;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { cn } from "../lib/cn.js";
|
|
2
|
+
import { ScrollArea } from "./scroll-area.js";
|
|
2
3
|
import { Code, CodeActions, CodeContent, CodeCopy, CodeHeader, CodeTitle } from "./code.js";
|
|
3
4
|
import { CodeDiff } from "./code-diff.js";
|
|
4
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -73,6 +74,33 @@ function MarkdownH3({ className, node: _node, ...props }) {
|
|
|
73
74
|
...props
|
|
74
75
|
});
|
|
75
76
|
}
|
|
77
|
+
function MarkdownH4({ className, node: _node, ...props }) {
|
|
78
|
+
return /* @__PURE__ */ jsx("h4", {
|
|
79
|
+
"data-control-ui": "markdown",
|
|
80
|
+
"data-control-family": "markdown",
|
|
81
|
+
"data-slot": "h4",
|
|
82
|
+
className,
|
|
83
|
+
...props
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function MarkdownH5({ className, node: _node, ...props }) {
|
|
87
|
+
return /* @__PURE__ */ jsx("h5", {
|
|
88
|
+
"data-control-ui": "markdown",
|
|
89
|
+
"data-control-family": "markdown",
|
|
90
|
+
"data-slot": "h5",
|
|
91
|
+
className,
|
|
92
|
+
...props
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function MarkdownH6({ className, node: _node, ...props }) {
|
|
96
|
+
return /* @__PURE__ */ jsx("h6", {
|
|
97
|
+
"data-control-ui": "markdown",
|
|
98
|
+
"data-control-family": "markdown",
|
|
99
|
+
"data-slot": "h6",
|
|
100
|
+
className,
|
|
101
|
+
...props
|
|
102
|
+
});
|
|
103
|
+
}
|
|
76
104
|
function MarkdownP({ className, node: _node, ...props }) {
|
|
77
105
|
return /* @__PURE__ */ jsx("p", {
|
|
78
106
|
"data-control-ui": "markdown",
|
|
@@ -159,14 +187,16 @@ function MarkdownTable({ className, children, node: _node, ...props }) {
|
|
|
159
187
|
"data-control-ui": "markdown",
|
|
160
188
|
"data-control-family": "markdown",
|
|
161
189
|
"data-slot": "table-scroll",
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
190
|
+
children: /* @__PURE__ */ jsx(ScrollArea, {
|
|
191
|
+
lockAxis: "y",
|
|
192
|
+
children: /* @__PURE__ */ jsx("table", {
|
|
193
|
+
"data-control-ui": "markdown",
|
|
194
|
+
"data-control-family": "markdown",
|
|
195
|
+
"data-slot": "table",
|
|
196
|
+
className: cn("w-full", className),
|
|
197
|
+
...props,
|
|
198
|
+
children
|
|
199
|
+
})
|
|
170
200
|
})
|
|
171
201
|
});
|
|
172
202
|
}
|
|
@@ -194,6 +224,9 @@ const markdownComponents = {
|
|
|
194
224
|
h1: MarkdownH1,
|
|
195
225
|
h2: MarkdownH2,
|
|
196
226
|
h3: MarkdownH3,
|
|
227
|
+
h4: MarkdownH4,
|
|
228
|
+
h5: MarkdownH5,
|
|
229
|
+
h6: MarkdownH6,
|
|
197
230
|
p: MarkdownP,
|
|
198
231
|
ul: MarkdownUl,
|
|
199
232
|
ol: MarkdownOl,
|
|
@@ -208,4 +241,4 @@ const markdownComponents = {
|
|
|
208
241
|
td: MarkdownTd
|
|
209
242
|
};
|
|
210
243
|
//#endregion
|
|
211
|
-
export { MarkdownA, MarkdownBlockquote, MarkdownCode, MarkdownEm, MarkdownH1, MarkdownH2, MarkdownH3, MarkdownHr, MarkdownInlineCode, MarkdownLi, MarkdownOl, MarkdownP, MarkdownPre, MarkdownStrong, MarkdownTable, MarkdownTd, MarkdownTh, MarkdownUl, markdownComponents };
|
|
244
|
+
export { MarkdownA, MarkdownBlockquote, MarkdownCode, MarkdownEm, MarkdownH1, MarkdownH2, MarkdownH3, MarkdownH4, MarkdownH5, MarkdownH6, MarkdownHr, MarkdownInlineCode, MarkdownLi, MarkdownOl, MarkdownP, MarkdownPre, MarkdownStrong, MarkdownTable, MarkdownTd, MarkdownTh, MarkdownUl, markdownComponents };
|
package/dist/ui/menubar.js
CHANGED
|
@@ -43,7 +43,6 @@ function MenubarContent({ className, children, ...props }) {
|
|
|
43
43
|
return /* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(Menu.Positioner, {
|
|
44
44
|
"data-skin": skin.id,
|
|
45
45
|
"data-effects": controlEffectsAttribute(skin.effects),
|
|
46
|
-
side: "bottom",
|
|
47
46
|
align: "start",
|
|
48
47
|
sideOffset: 6,
|
|
49
48
|
className: "z-(--z-popup)",
|
|
@@ -111,6 +110,7 @@ function MenubarShortcut({ className, ...props }) {
|
|
|
111
110
|
"data-slot": "shortcut",
|
|
112
111
|
"data-control-family": "popup",
|
|
113
112
|
"data-popup-part": "shortcut",
|
|
113
|
+
"aria-hidden": "true",
|
|
114
114
|
className: cn(className),
|
|
115
115
|
...props
|
|
116
116
|
});
|
|
@@ -133,6 +133,7 @@ function MenubarSubTrigger({ className, inset = false, children, ...props }) {
|
|
|
133
133
|
"data-popup-kind": "menubar",
|
|
134
134
|
"data-control-family": "popup",
|
|
135
135
|
"data-slot": "sub-trigger-indicator",
|
|
136
|
+
"data-icon-dir": "inline",
|
|
136
137
|
"aria-hidden": "true",
|
|
137
138
|
children: "›"
|
|
138
139
|
})]
|
|
@@ -143,7 +144,6 @@ function MenubarSubContent({ className, children, ...props }) {
|
|
|
143
144
|
return /* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(Menu.Positioner, {
|
|
144
145
|
"data-skin": skin.id,
|
|
145
146
|
"data-effects": controlEffectsAttribute(skin.effects),
|
|
146
|
-
side: "right",
|
|
147
147
|
align: "start",
|
|
148
148
|
sideOffset: -4,
|
|
149
149
|
alignOffset: -5,
|
|
@@ -13,6 +13,7 @@ function MorphingPanelTriggerElement({ triggerProps, open, render, className, ch
|
|
|
13
13
|
props: {
|
|
14
14
|
...triggerProps,
|
|
15
15
|
"data-control-ui": "morphing-panel",
|
|
16
|
+
"data-control-family": "morphing-panel",
|
|
16
17
|
"data-slot": "trigger",
|
|
17
18
|
"data-state": panelState,
|
|
18
19
|
className: cn(triggerProps.className, className),
|
|
@@ -55,7 +56,7 @@ function MorphingPanel({ collapsedSize, expandedSize, className, style, ...props
|
|
|
55
56
|
}
|
|
56
57
|
function MorphingPanelTrigger({ render, className, children, ...props }) {
|
|
57
58
|
return /* @__PURE__ */ jsx(Collapsible.Trigger, {
|
|
58
|
-
className: "group/morphing-panel-trigger absolute top-0
|
|
59
|
+
className: "group/morphing-panel-trigger absolute top-0 end-0 z-10 flex cursor-pointer items-center justify-between data-[state=open]:top-2 data-[state=open]:end-2 data-[state=open]:justify-center [&>svg]:shrink-0",
|
|
59
60
|
...props,
|
|
60
61
|
render: (triggerProps, state) => /* @__PURE__ */ jsx(MorphingPanelTriggerElement, {
|
|
61
62
|
triggerProps,
|
|
@@ -7,5 +7,5 @@ export type NativeSelectProps = Omit<Omit<ComponentProps<"select">, "size">, "st
|
|
|
7
7
|
} & {
|
|
8
8
|
size?: ControlSize;
|
|
9
9
|
};
|
|
10
|
-
export declare function NativeSelect({ size, className, children, ...props }: NativeSelectProps): import("react").JSX.Element;
|
|
10
|
+
export declare function NativeSelect({ ref, id, name, value, defaultValue, disabled, autoFocus, size, className, children, ...props }: NativeSelectProps): import("react").JSX.Element;
|
|
11
11
|
//#endregion
|