@ctrl-ui/react 0.8.7 → 0.8.9
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 +39 -39
- package/dist/blocks/design-canvas.d.ts +5 -1
- package/dist/blocks/design-canvas.js +198 -92
- 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 +4 -1
- package/dist/chat-composer-attachment.js +35 -10
- package/dist/chat-composer-editor/extensions/mention.d.ts +5 -1
- package/dist/chat-composer-editor/extensions/mention.js +59 -28
- 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 +57 -30
- package/dist/chat-composer.d.ts +13 -32
- package/dist/chat-composer.js +52 -12
- package/dist/chat-layout.d.ts +19 -0
- package/dist/chat-layout.js +91 -40
- 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/editor.js +20 -8
- package/dist/filter-bar/model.d.ts +1 -0
- package/dist/filter-bar/model.js +10 -1
- package/dist/filter-bar/motion.js +4 -4
- package/dist/filter-bar/parts.js +19 -8
- package/dist/filter-bar/types.d.ts +1 -0
- package/dist/filter-bar.js +19 -13
- package/dist/hooks/use-audio-recorder.js +12 -6
- package/dist/hooks/use-chat-composer.d.ts +19 -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-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 +36 -15
- 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-message-knobs.d.ts +1 -1
- package/dist/knob-contracts/chat-message-knobs.js +8 -1
- 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/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 +1 -1
- package/dist/knob-contracts/filter-bar-knobs.js +1 -2
- 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 +2 -1
- package/dist/knob-contracts/popup-knobs.d.ts +1 -1
- package/dist/knob-contracts/popup-knobs.js +27 -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 +2 -1
- 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 +2 -1
- package/dist/popup-parts.d.ts +8 -0
- package/dist/popup-parts.js +43 -0
- 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 +10 -5
- 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 +5 -7
- package/dist/styles/recipes/button-states.css +66 -0
- package/dist/styles/recipes/button.css +24 -83
- 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 +7 -10
- package/dist/styles/recipes/chat-layout.css +35 -0
- 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 +18 -21
- package/dist/styles/recipes/code-diff.css +46 -33
- package/dist/styles/recipes/code.css +36 -16
- package/dist/styles/recipes/collapsible.css +7 -2
- 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 +11 -2
- package/dist/styles/recipes/context.css +3 -3
- package/dist/styles/recipes/dockable-panel.css +7 -4
- 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 +30 -24
- package/dist/styles/recipes/field.css +61 -26
- package/dist/styles/recipes/filter-bar.css +18 -31
- package/dist/styles/recipes/gradient-editor.css +18 -7
- package/dist/styles/recipes/infinite-canvas.css +0 -1
- package/dist/styles/recipes/inline-attachment.css +3 -3
- 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 +20 -12
- package/dist/styles/recipes/pagination.css +4 -5
- package/dist/styles/recipes/phone-input.css +12 -8
- package/dist/styles/recipes/popup-controls.css +166 -33
- package/dist/styles/recipes/popup-drawer.css +3 -14
- package/dist/styles/recipes/popup-lists.css +128 -27
- package/dist/styles/recipes/popup-motion.css +4 -45
- package/dist/styles/recipes/popup-toast.css +55 -26
- package/dist/styles/recipes/popup.css +139 -141
- package/dist/styles/recipes/range.css +54 -18
- package/dist/styles/recipes/resizable.css +2 -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 +166 -34
- package/dist/styles/recipes/sidebar-parts.css +192 -0
- package/dist/styles/recipes/sidebar.css +188 -128
- package/dist/styles/recipes/source-badge.css +1 -1
- package/dist/styles/recipes/spinner.css +8 -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 +9 -1
- package/dist/styles/recipes/table.css +14 -10
- package/dist/styles/recipes/tabs.css +17 -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 +10 -7
- 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 +37 -16
- 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 +3 -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.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 +26 -27
- 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 -9
- package/dist/ui/combobox.js +13 -5
- package/dist/ui/command.d.ts +8 -2
- package/dist/ui/command.js +30 -14
- 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 +63 -23
- package/dist/ui/dropdown-menu.js +4 -3
- package/dist/ui/dropzone.d.ts +2 -2
- package/dist/ui/dropzone.js +75 -16
- 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/gradient-editor.d.ts +1 -1
- package/dist/ui/gradient-editor.js +37 -21
- package/dist/ui/infinite-canvas.d.ts +3 -2
- package/dist/ui/infinite-canvas.js +63 -19
- package/dist/ui/input-group.d.ts +0 -3
- package/dist/ui/input-group.js +3 -13
- package/dist/ui/input-otp.d.ts +1 -1
- package/dist/ui/input-otp.js +32 -15
- package/dist/ui/input.js +4 -4
- 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 +31 -1
- 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/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 +2 -0
- package/dist/ui/resizable.d.ts +3 -2
- package/dist/ui/resizable.js +5 -3
- package/dist/ui/responsive-dialog.d.ts +1 -1
- package/dist/ui/responsive-dialog.js +4 -21
- package/dist/ui/rich-tooltip.d.ts +10 -4
- package/dist/ui/rich-tooltip.js +81 -33
- package/dist/ui/scroll-area.d.ts +1 -1
- package/dist/ui/scroll-area.js +43 -28
- package/dist/ui/sidebar-menu.d.ts +5 -1
- package/dist/ui/sidebar-menu.js +34 -34
- 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 +48 -24
- 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 +2 -2
- package/dist/ui/table-of-contents.js +20 -8
- package/dist/ui/table.js +4 -2
- 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/toolbar.d.ts +2 -1
- package/dist/ui/toolbar.js +3 -1
- package/dist/ui/tooltip.js +3 -20
- package/dist/ui/tree.js +120 -80
- package/dist/ui/trigger-menu.js +1 -0
- 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
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { ChevronRight, MoreHorizontal } from "lucide-react";
|
|
5
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
6
|
+
//#region src/ui/breadcrumb.tsx
|
|
7
|
+
function Breadcrumb({ className, ...props }) {
|
|
8
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
9
|
+
"aria-label": "Breadcrumb",
|
|
10
|
+
"data-control-ui": "breadcrumb",
|
|
11
|
+
"data-control-family": "breadcrumb",
|
|
12
|
+
"data-slot": "root",
|
|
13
|
+
className,
|
|
14
|
+
...props
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function BreadcrumbList({ className, ...props }) {
|
|
18
|
+
return /* @__PURE__ */ jsx("ol", {
|
|
19
|
+
"data-control-ui": "breadcrumb",
|
|
20
|
+
"data-control-family": "breadcrumb",
|
|
21
|
+
"data-slot": "list",
|
|
22
|
+
className: cn("flex flex-wrap items-center break-words", className),
|
|
23
|
+
...props
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function BreadcrumbItem({ className, ...props }) {
|
|
27
|
+
return /* @__PURE__ */ jsx("li", {
|
|
28
|
+
"data-control-ui": "breadcrumb",
|
|
29
|
+
"data-control-family": "breadcrumb",
|
|
30
|
+
"data-slot": "item",
|
|
31
|
+
className: cn("inline-flex items-center", className),
|
|
32
|
+
...props
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function BreadcrumbLink({ render, className, children, ...props }) {
|
|
36
|
+
return useRender({
|
|
37
|
+
defaultTagName: "a",
|
|
38
|
+
render,
|
|
39
|
+
props: {
|
|
40
|
+
...props,
|
|
41
|
+
"data-control-ui": "breadcrumb",
|
|
42
|
+
"data-control-family": "breadcrumb",
|
|
43
|
+
"data-slot": "link",
|
|
44
|
+
className,
|
|
45
|
+
children
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function BreadcrumbPage({ className, ...props }) {
|
|
50
|
+
return /* @__PURE__ */ jsx("span", {
|
|
51
|
+
"data-control-ui": "breadcrumb",
|
|
52
|
+
"data-control-family": "breadcrumb",
|
|
53
|
+
"data-slot": "page",
|
|
54
|
+
"aria-current": "page",
|
|
55
|
+
className,
|
|
56
|
+
...props
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function BreadcrumbSeparator({ children, className, ...props }) {
|
|
60
|
+
return /* @__PURE__ */ jsx("li", {
|
|
61
|
+
"data-control-ui": "breadcrumb",
|
|
62
|
+
"data-control-family": "breadcrumb",
|
|
63
|
+
"data-slot": "separator",
|
|
64
|
+
role: "presentation",
|
|
65
|
+
"aria-hidden": "true",
|
|
66
|
+
className: cn("[&>svg]:size-3.5", className),
|
|
67
|
+
...props,
|
|
68
|
+
children: children ?? /* @__PURE__ */ jsx(ChevronRight, { "data-icon-dir": "inline" })
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function BreadcrumbEllipsis({ label = "Show hidden breadcrumbs", className, ...props }) {
|
|
72
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
73
|
+
"data-control-ui": "breadcrumb",
|
|
74
|
+
"data-control-family": "breadcrumb",
|
|
75
|
+
"data-slot": "ellipsis",
|
|
76
|
+
className: cn("flex items-center justify-center", className),
|
|
77
|
+
...props,
|
|
78
|
+
children: [/* @__PURE__ */ jsx(MoreHorizontal, {
|
|
79
|
+
"aria-hidden": "true",
|
|
80
|
+
className: "size-4"
|
|
81
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
82
|
+
className: "sr-only",
|
|
83
|
+
children: label
|
|
84
|
+
})]
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
88
|
+
export { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator };
|
package/dist/ui/button.d.ts
CHANGED
|
@@ -23,12 +23,13 @@ export type ButtonProps = ComponentProps<"button"> & ButtonAppearanceProps & {
|
|
|
23
23
|
disabled: boolean;
|
|
24
24
|
}>;
|
|
25
25
|
nativeButton?: boolean;
|
|
26
|
+
focusableWhenDisabled?: boolean;
|
|
26
27
|
};
|
|
27
28
|
export type ButtonLinkProps = ComponentProps<"a"> & ButtonAppearanceProps & {
|
|
28
29
|
render?: RenderProp<ComponentProps<"a">>;
|
|
29
30
|
};
|
|
30
31
|
export type ButtonLabelProps = ComponentProps<"label"> & ButtonAppearanceProps;
|
|
31
|
-
export declare const buttonStructureClasses = "
|
|
32
|
+
export declare const buttonStructureClasses = "isolate inline-flex shrink-0 items-center justify-center overflow-visible whitespace-nowrap";
|
|
32
33
|
export declare const buttonTrackStructureClasses = "data-[track=hover]:relative data-[track=hover]:isolate [&_[data-track-item]]:[isolation:auto]";
|
|
33
34
|
export declare const buttonContentClasses = "relative z-[1] inline-flex min-w-0 items-center justify-center gap-[inherit]";
|
|
34
35
|
export declare function Button({ variant, size, tone, active, iconOnly, shape, type, disabled, render, nativeButton, className, children, ...props }: ButtonProps): import("react").JSX.Element;
|
package/dist/ui/button.js
CHANGED
|
@@ -9,7 +9,7 @@ import { useRender } from "@base-ui/react/use-render";
|
|
|
9
9
|
//#region src/ui/button.tsx
|
|
10
10
|
const ButtonTrackContext = createContext(false);
|
|
11
11
|
const buttonShapes = ["default", "circle"];
|
|
12
|
-
const buttonStructureClasses = "
|
|
12
|
+
const buttonStructureClasses = "isolate inline-flex shrink-0 items-center justify-center overflow-visible whitespace-nowrap";
|
|
13
13
|
const buttonTrackStructureClasses = "data-[track=hover]:relative data-[track=hover]:isolate [&_[data-track-item]]:[isolation:auto]";
|
|
14
14
|
const buttonContentClasses = "relative z-[1] inline-flex min-w-0 items-center justify-center gap-[inherit]";
|
|
15
15
|
function wrapButtonText(children) {
|
package/dist/ui/calendar.js
CHANGED
|
@@ -4,8 +4,8 @@ import { useEffect, useRef } from "react";
|
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import { CaptionLabel, Day, DayPicker, Month, MonthCaption, MonthGrid, Months, Nav, Weekday } from "react-day-picker";
|
|
6
6
|
//#region src/ui/calendar.tsx
|
|
7
|
-
const dayButtonClasses = "flex w-full items-center justify-center disabled:pointer-events-none";
|
|
8
|
-
const navButtonClasses = "inline-flex items-center justify-center disabled:pointer-events-none";
|
|
7
|
+
const dayButtonClasses = "flex w-full items-center justify-center disabled:pointer-events-none aria-disabled:pointer-events-none";
|
|
8
|
+
const navButtonClasses = "inline-flex items-center justify-center disabled:pointer-events-none aria-disabled:pointer-events-none";
|
|
9
9
|
const chevronPathByOrientation = {
|
|
10
10
|
left: "M10 3 5.5 8 10 13",
|
|
11
11
|
right: "M6 3 10.5 8 6 13",
|
package/dist/ui/card.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { RenderProp } from "../control-props.js";
|
|
1
2
|
import { CardKnobStyle } from "../knob-contracts/card-knobs.js";
|
|
2
3
|
import { CSSProperties, ComponentProps } from "react";
|
|
3
4
|
//#region src/ui/card.d.ts
|
|
@@ -11,6 +12,7 @@ export type CardHeaderProps = ComponentProps<"div"> & {
|
|
|
11
12
|
style?: CSSProperties & CardKnobStyle;
|
|
12
13
|
};
|
|
13
14
|
export type CardTitleProps = Omit<ComponentProps<"div">, "style"> & {
|
|
15
|
+
render?: RenderProp<ComponentProps<"div">>;
|
|
14
16
|
style?: CSSProperties & CardKnobStyle;
|
|
15
17
|
};
|
|
16
18
|
export type CardDescriptionProps = ComponentProps<"div"> & {
|
|
@@ -27,7 +29,7 @@ export type CardFooterProps = ComponentProps<"div"> & {
|
|
|
27
29
|
};
|
|
28
30
|
export declare function Card({ variant, className, ...props }: CardProps): import("react").JSX.Element;
|
|
29
31
|
export declare function CardHeader({ className, ...props }: CardHeaderProps): import("react").JSX.Element;
|
|
30
|
-
export declare function CardTitle({
|
|
32
|
+
export declare function CardTitle({ render, ...props }: CardTitleProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
31
33
|
export declare function CardDescription({ className, ...props }: CardDescriptionProps): import("react").JSX.Element;
|
|
32
34
|
export declare function CardAction({ className, ...props }: CardActionProps): import("react").JSX.Element;
|
|
33
35
|
export declare function CardContent({ className, ...props }: CardContentProps): import("react").JSX.Element;
|
package/dist/ui/card.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { cn } from "../lib/cn.js";
|
|
2
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
3
5
|
//#region src/ui/card.tsx
|
|
4
6
|
function Card({ variant = "default", className, ...props }) {
|
|
5
7
|
return /* @__PURE__ */ jsx("div", {
|
|
@@ -21,13 +23,16 @@ function CardHeader({ className, ...props }) {
|
|
|
21
23
|
...props
|
|
22
24
|
});
|
|
23
25
|
}
|
|
24
|
-
function CardTitle({
|
|
25
|
-
return
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
function CardTitle({ render, ...props }) {
|
|
27
|
+
return useRender({
|
|
28
|
+
defaultTagName: "div",
|
|
29
|
+
render,
|
|
30
|
+
props: {
|
|
31
|
+
...props,
|
|
32
|
+
"data-control-ui": "card",
|
|
33
|
+
"data-control-family": "card",
|
|
34
|
+
"data-slot": "title"
|
|
35
|
+
}
|
|
31
36
|
});
|
|
32
37
|
}
|
|
33
38
|
function CardDescription({ className, ...props }) {
|
package/dist/ui/checkbox.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export type CheckboxProps = Omit<{
|
|
|
15
15
|
className?: string;
|
|
16
16
|
"aria-label"?: string;
|
|
17
17
|
"aria-labelledby"?: string;
|
|
18
|
+
"aria-describedby"?: string;
|
|
19
|
+
"aria-invalid"?: boolean | "true" | "false";
|
|
18
20
|
}, "style"> & {
|
|
19
21
|
style?: CSSProperties & ChoiceKnobStyle;
|
|
20
22
|
};
|
package/dist/ui/code-diff.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { CodeCopyProps, CodeOverflow } from "./code.js";
|
|
|
3
3
|
import { CSSProperties, ComponentProps, ReactNode } from "react";
|
|
4
4
|
//#region src/ui/code-diff.d.ts
|
|
5
5
|
export type DiffStyle = "unified" | "split";
|
|
6
|
-
export type DiffIndicators = "classic" | "bars"
|
|
6
|
+
export type DiffIndicators = "classic" | "bars";
|
|
7
7
|
export type DiffLineKind = "word" | "char" | "none";
|
|
8
8
|
export type CodeDiffProps = Omit<ComponentProps<"figure">, "children" | "style"> & {
|
|
9
9
|
patch?: string;
|
package/dist/ui/code-diff.js
CHANGED
|
@@ -7,6 +7,7 @@ import { buildDiffFromFiles, buildDiffFromPatch, diffRunEnd } from "../lib/diff.
|
|
|
7
7
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
10
|
+
import { flushSync } from "react-dom";
|
|
10
11
|
//#region src/ui/code-diff.tsx
|
|
11
12
|
const ESTIMATED_ROW_HEIGHT = 20;
|
|
12
13
|
const VIRTUALIZE_THRESHOLD = 150;
|
|
@@ -116,9 +117,12 @@ function expandedContext(file, gapIndex) {
|
|
|
116
117
|
}
|
|
117
118
|
return lines;
|
|
118
119
|
}
|
|
120
|
+
function expandedRowId(gapIndex, line) {
|
|
121
|
+
return `exp-${gapIndex}-${line.oldNo ?? line.newNo ?? 0}`;
|
|
122
|
+
}
|
|
119
123
|
function gapRows(file, hunk, gapIndex, diffStyle, expanded) {
|
|
120
124
|
if (!(gapIndex > 0 || hunk.collapsedBefore > 0)) return [];
|
|
121
|
-
if (expanded.has(gapIndex) && !file.isPartial) return expandedContext(file, gapIndex).map((line) => rowForLine(diffStyle, line,
|
|
125
|
+
if (expanded.has(gapIndex) && !file.isPartial) return expandedContext(file, gapIndex).map((line) => rowForLine(diffStyle, line, expandedRowId(gapIndex, line)));
|
|
122
126
|
const label = hunk.header ?? `@@ -${hunk.oldStart},${hunk.oldCount} +${hunk.newStart},${hunk.newCount} @@`;
|
|
123
127
|
return [{
|
|
124
128
|
kind: "separator",
|
|
@@ -217,8 +221,7 @@ function Gutter({ children, type }) {
|
|
|
217
221
|
children
|
|
218
222
|
});
|
|
219
223
|
}
|
|
220
|
-
function Marker({ type
|
|
221
|
-
if (indicators !== "classic") return null;
|
|
224
|
+
function Marker({ type }) {
|
|
222
225
|
return /* @__PURE__ */ jsx("span", {
|
|
223
226
|
"data-control-ui": "code-diff",
|
|
224
227
|
"data-control-family": "code-diff",
|
|
@@ -247,10 +250,7 @@ function UnifiedRow({ line, tokens, indicators, overflow }) {
|
|
|
247
250
|
type: line.type,
|
|
248
251
|
children: line.newNo ?? ""
|
|
249
252
|
}),
|
|
250
|
-
/* @__PURE__ */ jsx(Marker, {
|
|
251
|
-
type: line.type,
|
|
252
|
-
indicators
|
|
253
|
-
}),
|
|
253
|
+
/* @__PURE__ */ jsx(Marker, { type: line.type }),
|
|
254
254
|
/* @__PURE__ */ jsx(DiffCode, {
|
|
255
255
|
line,
|
|
256
256
|
tokens,
|
|
@@ -282,10 +282,7 @@ function SplitHalf({ line, tokens, indicators, overflow, side }) {
|
|
|
282
282
|
type: line.type,
|
|
283
283
|
children: side === "left" ? line.oldNo ?? "" : line.newNo ?? ""
|
|
284
284
|
}),
|
|
285
|
-
/* @__PURE__ */ jsx(Marker, {
|
|
286
|
-
type: line.type,
|
|
287
|
-
indicators
|
|
288
|
-
}),
|
|
285
|
+
/* @__PURE__ */ jsx(Marker, { type: line.type }),
|
|
289
286
|
/* @__PURE__ */ jsx(DiffCode, {
|
|
290
287
|
line,
|
|
291
288
|
tokens,
|
|
@@ -303,17 +300,34 @@ function DiffStats({ additions, deletions }) {
|
|
|
303
300
|
"data-control-family": "code-diff",
|
|
304
301
|
"data-slot": "stat",
|
|
305
302
|
className: "flex items-center",
|
|
306
|
-
children: [
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
303
|
+
children: [
|
|
304
|
+
/* @__PURE__ */ jsxs("span", {
|
|
305
|
+
"data-control-ui": "code-diff",
|
|
306
|
+
"data-control-family": "code-diff",
|
|
307
|
+
"data-slot": "stat-additions",
|
|
308
|
+
"aria-hidden": "true",
|
|
309
|
+
children: ["+", additions]
|
|
310
|
+
}),
|
|
311
|
+
/* @__PURE__ */ jsxs("span", {
|
|
312
|
+
"data-control-ui": "code-diff",
|
|
313
|
+
"data-control-family": "code-diff",
|
|
314
|
+
"data-slot": "stat-deletions",
|
|
315
|
+
"aria-hidden": "true",
|
|
316
|
+
children: ["−", deletions]
|
|
317
|
+
}),
|
|
318
|
+
/* @__PURE__ */ jsxs("span", {
|
|
319
|
+
className: "sr-only",
|
|
320
|
+
children: [
|
|
321
|
+
additions,
|
|
322
|
+
" ",
|
|
323
|
+
additions === 1 ? "addition" : "additions",
|
|
324
|
+
", ",
|
|
325
|
+
deletions,
|
|
326
|
+
" ",
|
|
327
|
+
deletions === 1 ? "deletion" : "deletions"
|
|
328
|
+
]
|
|
329
|
+
})
|
|
330
|
+
]
|
|
317
331
|
});
|
|
318
332
|
}
|
|
319
333
|
function lineDescription(label, line, number) {
|
|
@@ -345,6 +359,7 @@ function fileIdentity(file) {
|
|
|
345
359
|
}
|
|
346
360
|
function CodeDiffFileSection({ file, lang, diffStyle, diffIndicators, overflow, maxHeight, showFileHeader }) {
|
|
347
361
|
const [expanded, setExpanded] = useState(() => /* @__PURE__ */ new Set());
|
|
362
|
+
const [revealedRowId, setRevealedRowId] = useState(null);
|
|
348
363
|
const texts = useMemo(() => sideTexts(file), [file]);
|
|
349
364
|
const tokens = useSideTokens(texts.old, texts.new, lang, Boolean(lang));
|
|
350
365
|
const rows = useMemo(() => buildRows(file, diffStyle, expanded), [
|
|
@@ -353,6 +368,7 @@ function CodeDiffFileSection({ file, lang, diffStyle, diffIndicators, overflow,
|
|
|
353
368
|
expanded
|
|
354
369
|
]);
|
|
355
370
|
const scrollRef = useRef(null);
|
|
371
|
+
const revealedRowRef = useRef(null);
|
|
356
372
|
const shouldVirtualize = rows.length > VIRTUALIZE_THRESHOLD;
|
|
357
373
|
const virtualizer = useVirtualizer({
|
|
358
374
|
count: rows.length,
|
|
@@ -362,7 +378,25 @@ function CodeDiffFileSection({ file, lang, diffStyle, diffIndicators, overflow,
|
|
|
362
378
|
enabled: shouldVirtualize
|
|
363
379
|
});
|
|
364
380
|
function expandGap(gapIndex) {
|
|
365
|
-
|
|
381
|
+
const firstLine = expandedContext(file, gapIndex)[0];
|
|
382
|
+
flushSync(() => {
|
|
383
|
+
setExpanded((current) => new Set(current).add(gapIndex));
|
|
384
|
+
setRevealedRowId(firstLine ? expandedRowId(gapIndex, firstLine) : null);
|
|
385
|
+
});
|
|
386
|
+
revealedRowRef.current?.focus();
|
|
387
|
+
}
|
|
388
|
+
function rowFrameProps(id) {
|
|
389
|
+
if (id !== revealedRowId) return {};
|
|
390
|
+
return {
|
|
391
|
+
tabIndex: -1,
|
|
392
|
+
"data-control-ui": "code-diff",
|
|
393
|
+
"data-control-family": "code-diff",
|
|
394
|
+
"data-slot": "revealed-row"
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
function measureRevealedRow(node) {
|
|
398
|
+
revealedRowRef.current = node;
|
|
399
|
+
virtualizer.measureElement(node);
|
|
366
400
|
}
|
|
367
401
|
const gridClassName = overflow === "scroll" ? "w-max min-w-full" : "w-full";
|
|
368
402
|
function renderRow(row) {
|
|
@@ -388,6 +422,7 @@ function CodeDiffFileSection({ file, lang, diffStyle, diffIndicators, overflow,
|
|
|
388
422
|
"data-control-ui": "code-diff",
|
|
389
423
|
"data-control-family": "code-diff",
|
|
390
424
|
"data-slot": "expander-label",
|
|
425
|
+
title: row.label,
|
|
391
426
|
className: "truncate",
|
|
392
427
|
children: row.label
|
|
393
428
|
})]
|
|
@@ -433,6 +468,7 @@ function CodeDiffFileSection({ file, lang, diffStyle, diffIndicators, overflow,
|
|
|
433
468
|
"data-control-ui": "code-diff",
|
|
434
469
|
"data-control-family": "code-diff",
|
|
435
470
|
"data-slot": "file-title",
|
|
471
|
+
title: fileTitle(file),
|
|
436
472
|
className: "min-w-0 truncate",
|
|
437
473
|
children: fileTitle(file)
|
|
438
474
|
}), /* @__PURE__ */ jsx(DiffStats, {
|
|
@@ -449,7 +485,7 @@ function CodeDiffFileSection({ file, lang, diffStyle, diffIndicators, overflow,
|
|
|
449
485
|
}),
|
|
450
486
|
/* @__PURE__ */ jsx(ScrollArea, {
|
|
451
487
|
maxHeight,
|
|
452
|
-
|
|
488
|
+
"aria-label": fileTitle(file),
|
|
453
489
|
viewportProps: {
|
|
454
490
|
"data-control-ui": "code-diff",
|
|
455
491
|
"data-control-family": "code-diff",
|
|
@@ -466,8 +502,9 @@ function CodeDiffFileSection({ file, lang, diffStyle, diffIndicators, overflow,
|
|
|
466
502
|
const row = rows[item.index];
|
|
467
503
|
if (!row) return null;
|
|
468
504
|
return /* @__PURE__ */ jsx("div", {
|
|
469
|
-
ref: virtualizer.measureElement,
|
|
505
|
+
ref: row.id === revealedRowId ? measureRevealedRow : virtualizer.measureElement,
|
|
470
506
|
"data-index": item.index,
|
|
507
|
+
...rowFrameProps(row.id),
|
|
471
508
|
style: {
|
|
472
509
|
position: "absolute",
|
|
473
510
|
top: 0,
|
|
@@ -480,7 +517,11 @@ function CodeDiffFileSection({ file, lang, diffStyle, diffIndicators, overflow,
|
|
|
480
517
|
})
|
|
481
518
|
}) : /* @__PURE__ */ jsx("div", {
|
|
482
519
|
className: gridClassName,
|
|
483
|
-
children: rows.map((row) => /* @__PURE__ */ jsx("div", {
|
|
520
|
+
children: rows.map((row) => /* @__PURE__ */ jsx("div", {
|
|
521
|
+
ref: row.id === revealedRowId ? revealedRowRef : void 0,
|
|
522
|
+
...rowFrameProps(row.id),
|
|
523
|
+
children: renderRow(row)
|
|
524
|
+
}, row.id))
|
|
484
525
|
})
|
|
485
526
|
})
|
|
486
527
|
]
|
|
@@ -499,11 +540,13 @@ function CodeDiff({ patch, oldText, newText, lang, name, diffStyle = "unified",
|
|
|
499
540
|
const deletions = files.reduce((total, file) => total + file.deletions, 0);
|
|
500
541
|
const copyValue = patch ?? newText ?? "";
|
|
501
542
|
const firstFile = files[0];
|
|
543
|
+
const title = files.length === 1 && firstFile ? fileTitle(firstFile) : `${files.length} files`;
|
|
502
544
|
return /* @__PURE__ */ jsxs("figure", {
|
|
503
545
|
"data-control-ui": "code-diff",
|
|
504
546
|
"data-control-family": "code-diff",
|
|
505
547
|
"data-slot": "root",
|
|
506
548
|
"data-surface": "panel",
|
|
549
|
+
dir: "ltr",
|
|
507
550
|
"data-diff-style": diffStyle,
|
|
508
551
|
"data-file-count": files.length,
|
|
509
552
|
"data-header": header ? "true" : void 0,
|
|
@@ -519,8 +562,9 @@ function CodeDiff({ patch, oldText, newText, lang, name, diffStyle = "unified",
|
|
|
519
562
|
"data-control-ui": "code-diff",
|
|
520
563
|
"data-control-family": "code-diff",
|
|
521
564
|
"data-slot": "title",
|
|
565
|
+
title,
|
|
522
566
|
className: "min-w-0 truncate",
|
|
523
|
-
children:
|
|
567
|
+
children: title
|
|
524
568
|
}), /* @__PURE__ */ jsxs("div", {
|
|
525
569
|
"data-control-ui": "code-diff",
|
|
526
570
|
"data-control-family": "code-diff",
|
package/dist/ui/code.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export declare function CodeHeader({ className, ...props }: CodeHeaderProps): im
|
|
|
23
23
|
export type CodeTitleProps = Omit<ComponentProps<"span">, "style"> & {
|
|
24
24
|
style?: CSSProperties & CodeKnobStyle;
|
|
25
25
|
};
|
|
26
|
-
export declare function CodeTitle({ className, ...props }: CodeTitleProps): import("react").JSX.Element;
|
|
26
|
+
export declare function CodeTitle({ className, children, ...props }: CodeTitleProps): import("react").JSX.Element;
|
|
27
27
|
export type CodeActionsProps = ComponentProps<"div"> & {
|
|
28
28
|
style?: CSSProperties & CodeKnobStyle;
|
|
29
29
|
};
|
|
@@ -33,8 +33,9 @@ export type CodeCopyProps = Omit<ComponentProps<typeof Button>, "children" | "on
|
|
|
33
33
|
children?: ReactNode;
|
|
34
34
|
copiedLabel?: ReactNode;
|
|
35
35
|
copiedAriaLabel?: string;
|
|
36
|
+
copyFailedLabel?: string;
|
|
36
37
|
};
|
|
37
|
-
export declare function CodeCopy({ value, copiedLabel, copiedAriaLabel, children, className, "aria-label": ariaLabel, ...props }: CodeCopyProps): import("react").JSX.Element;
|
|
38
|
+
export declare function CodeCopy({ value, copiedLabel, copiedAriaLabel, copyFailedLabel, children, className, "aria-label": ariaLabel, ...props }: CodeCopyProps): import("react").JSX.Element;
|
|
38
39
|
export type CodeFloatingCopyProps = Omit<CodeCopyProps, "children" | "copiedLabel">;
|
|
39
40
|
export declare function CodeFloatingCopy({ className, ...props }: CodeFloatingCopyProps): import("react").JSX.Element;
|
|
40
41
|
export declare function useCodeTokens({ code, lang, tokens, highlight }: {
|
|
@@ -50,6 +51,7 @@ export declare function CodeTokenLine({ tokens, plain }: {
|
|
|
50
51
|
export type CodeContentProps = Omit<ComponentProps<"div">, "children" | "style"> & {
|
|
51
52
|
code: string;
|
|
52
53
|
lang?: string;
|
|
54
|
+
fileName?: string;
|
|
53
55
|
tokens?: CodeTokenLines | null;
|
|
54
56
|
highlight?: CodeHighlight;
|
|
55
57
|
showLineNumbers?: boolean;
|
|
@@ -59,7 +61,7 @@ export type CodeContentProps = Omit<ComponentProps<"div">, "children" | "style">
|
|
|
59
61
|
virtualize?: boolean;
|
|
60
62
|
style?: CSSProperties & CodeKnobStyle;
|
|
61
63
|
};
|
|
62
|
-
export declare function CodeContent({ code, lang, tokens, highlight, showLineNumbers, startLine, highlightLines, maxHeight, virtualize, className, ref, style, ...props }: CodeContentProps): import("react").JSX.Element;
|
|
64
|
+
export declare function CodeContent({ code, lang, fileName, tokens, highlight, showLineNumbers, startLine, highlightLines, maxHeight, virtualize, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, ref, style, ...props }: CodeContentProps): import("react").JSX.Element;
|
|
63
65
|
export type CodeEditableProps = Omit<ComponentProps<"textarea">, "defaultValue" | "value" | "style"> & {
|
|
64
66
|
value?: string;
|
|
65
67
|
defaultValue?: string;
|
package/dist/ui/code.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../lib/cn.js";
|
|
3
3
|
import { Button } from "./button.js";
|
|
4
|
+
import { LiveStatus } from "./live-status.js";
|
|
4
5
|
import { useCopyToClipboard } from "../hooks/use-copy-to-clipboard.js";
|
|
5
6
|
import { highlightToTokens } from "../lib/code-tokens.js";
|
|
6
7
|
import { ScrollArea } from "./scroll-area.js";
|
|
@@ -36,6 +37,7 @@ function Code({ overflow = "scroll", chrome = "standalone", density = "default",
|
|
|
36
37
|
"data-control-family": "code",
|
|
37
38
|
"data-slot": "root",
|
|
38
39
|
"data-surface": "panel",
|
|
40
|
+
dir: "ltr",
|
|
39
41
|
"data-chrome": chrome,
|
|
40
42
|
"data-density": density,
|
|
41
43
|
"data-header": hasHeader ? "true" : void 0,
|
|
@@ -54,13 +56,15 @@ function CodeHeader({ className, ...props }) {
|
|
|
54
56
|
...props
|
|
55
57
|
});
|
|
56
58
|
}
|
|
57
|
-
function CodeTitle({ className, ...props }) {
|
|
59
|
+
function CodeTitle({ className, children, ...props }) {
|
|
58
60
|
return /* @__PURE__ */ jsx("span", {
|
|
59
61
|
"data-control-ui": "code",
|
|
60
62
|
"data-control-family": "code",
|
|
61
63
|
"data-slot": "title",
|
|
64
|
+
title: typeof children === "string" ? children : void 0,
|
|
62
65
|
className: cn("block min-w-0 truncate", className),
|
|
63
|
-
...props
|
|
66
|
+
...props,
|
|
67
|
+
children
|
|
64
68
|
});
|
|
65
69
|
}
|
|
66
70
|
function CodeActions({ className, ...props }) {
|
|
@@ -72,34 +76,39 @@ function CodeActions({ className, ...props }) {
|
|
|
72
76
|
...props
|
|
73
77
|
});
|
|
74
78
|
}
|
|
75
|
-
function
|
|
76
|
-
|
|
79
|
+
function copyStatusMessage(status, copiedMessage, failedMessage) {
|
|
80
|
+
if (status === "copied") return copiedMessage;
|
|
81
|
+
if (status === "failed") return failedMessage;
|
|
82
|
+
return "";
|
|
83
|
+
}
|
|
84
|
+
function CodeCopy({ value, copiedLabel, copiedAriaLabel = "Copied to clipboard", copyFailedLabel = "Couldn't copy. Select the text and copy it manually.", children, className, "aria-label": ariaLabel, ...props }) {
|
|
85
|
+
const { status, handleCopy } = useCopyToClipboard({ text: value });
|
|
77
86
|
const isIconOnly = children === void 0;
|
|
78
87
|
const label = ariaLabel ?? (isIconOnly ? "Copy code" : void 0);
|
|
79
88
|
const copied = copiedLabel ?? (isIconOnly ? /* @__PURE__ */ jsx(CheckIcon, {
|
|
80
89
|
"aria-hidden": "true",
|
|
81
90
|
className: "size-3.5"
|
|
82
91
|
}) : "Copied");
|
|
92
|
+
const liveStatus = /* @__PURE__ */ jsx(LiveStatus, { message: copyStatusMessage(status, copiedAriaLabel, copyFailedLabel) });
|
|
83
93
|
const button = /* @__PURE__ */ jsx(Button, {
|
|
84
94
|
type: "button",
|
|
85
95
|
variant: "quiet",
|
|
86
96
|
size: "xs",
|
|
87
|
-
"aria-
|
|
88
|
-
"aria-label": label && isCopied ? copiedAriaLabel : label,
|
|
97
|
+
"aria-label": label,
|
|
89
98
|
"data-code-copy": isIconOnly ? "true" : void 0,
|
|
90
99
|
className,
|
|
91
100
|
...props,
|
|
92
101
|
onClick: handleCopy,
|
|
93
|
-
children:
|
|
102
|
+
children: status === "copied" ? copied : children ?? /* @__PURE__ */ jsx(CopyIcon, {
|
|
94
103
|
"aria-hidden": "true",
|
|
95
104
|
className: "size-3.5"
|
|
96
105
|
})
|
|
97
106
|
});
|
|
98
|
-
if (!isIconOnly) return button;
|
|
99
|
-
return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: button }), /* @__PURE__ */ jsx(TooltipContent, {
|
|
100
|
-
side: "
|
|
101
|
-
children: label
|
|
102
|
-
})] });
|
|
107
|
+
if (!isIconOnly) return /* @__PURE__ */ jsxs(Fragment$1, { children: [button, liveStatus] });
|
|
108
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: button }), /* @__PURE__ */ jsx(TooltipContent, {
|
|
109
|
+
side: "inline-start",
|
|
110
|
+
children: status === "copied" ? copiedAriaLabel : label
|
|
111
|
+
})] }), liveStatus] });
|
|
103
112
|
}
|
|
104
113
|
function CodeFloatingCopy({ className, ...props }) {
|
|
105
114
|
return /* @__PURE__ */ jsx(CodeCopy, {
|
|
@@ -175,8 +184,9 @@ function CodeRow({ index, number, tokens, plain, overflow, showLineNumbers, high
|
|
|
175
184
|
})]
|
|
176
185
|
});
|
|
177
186
|
}
|
|
178
|
-
function CodeContent({ code, lang, tokens, highlight = "auto", showLineNumbers = false, startLine = 1, highlightLines, maxHeight = "32rem", virtualize, className, ref, style, ...props }) {
|
|
187
|
+
function CodeContent({ code, lang, fileName, tokens, highlight = "auto", showLineNumbers = false, startLine = 1, highlightLines, maxHeight = "32rem", virtualize, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, ref, style, ...props }) {
|
|
179
188
|
const { density, overflow, hasHeader, copy } = useCodeContext();
|
|
189
|
+
const regionLabel = ariaLabelledby ? ariaLabel : ariaLabel ?? fileName ?? (lang ? `${lang} code` : "Code");
|
|
180
190
|
const resolvedTokens = useCodeTokens({
|
|
181
191
|
code,
|
|
182
192
|
lang,
|
|
@@ -193,7 +203,6 @@ function CodeContent({ code, lang, tokens, highlight = "auto", showLineNumbers =
|
|
|
193
203
|
else if (ref) ref.current = node;
|
|
194
204
|
}
|
|
195
205
|
const shouldVirtualize = virtualize ?? plainLines.length > MAX_STATIC_CODE_LINES;
|
|
196
|
-
const useScrollArea = density !== "compact" || overflow !== "wrap";
|
|
197
206
|
const virtualizer = useVirtualizer({
|
|
198
207
|
count: plainLines.length,
|
|
199
208
|
getScrollElement: () => scrollRef.current,
|
|
@@ -254,8 +263,10 @@ function CodeContent({ code, lang, tokens, highlight = "auto", showLineNumbers =
|
|
|
254
263
|
highlighted: highlightedLineNumbers.has(startLine + index)
|
|
255
264
|
}, index))
|
|
256
265
|
});
|
|
257
|
-
const content =
|
|
266
|
+
const content = /* @__PURE__ */ jsx(ScrollArea, {
|
|
258
267
|
maxHeight,
|
|
268
|
+
"aria-label": regionLabel,
|
|
269
|
+
"aria-labelledby": ariaLabelledby,
|
|
259
270
|
viewportClassName: className,
|
|
260
271
|
viewportProps: {
|
|
261
272
|
...props,
|
|
@@ -266,18 +277,6 @@ function CodeContent({ code, lang, tokens, highlight = "auto", showLineNumbers =
|
|
|
266
277
|
},
|
|
267
278
|
viewportRef: setScrollElement,
|
|
268
279
|
children: grid
|
|
269
|
-
}) : /* @__PURE__ */ jsx("div", {
|
|
270
|
-
ref: setScrollElement,
|
|
271
|
-
"data-control-ui": "code",
|
|
272
|
-
"data-control-family": "code",
|
|
273
|
-
"data-slot": "content",
|
|
274
|
-
className: cn("overflow-auto", className),
|
|
275
|
-
style: {
|
|
276
|
-
...style,
|
|
277
|
-
maxHeight
|
|
278
|
-
},
|
|
279
|
-
...props,
|
|
280
|
-
children: grid
|
|
281
280
|
});
|
|
282
281
|
if (hasHeader || !copy) return content;
|
|
283
282
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -55,6 +55,7 @@ export type ColorPickerInputProps = Omit<Omit<ComponentProps<"input">, "value" |
|
|
|
55
55
|
style?: CSSProperties & ColorPickerKnobStyle;
|
|
56
56
|
} & {
|
|
57
57
|
size?: ControlSize;
|
|
58
|
+
invalidLabel?: string;
|
|
58
59
|
};
|
|
59
60
|
export type ColorPickerFormatSelectProps = {
|
|
60
61
|
formats?: ColorFormat[];
|
|
@@ -94,6 +95,8 @@ export type ColorPickerContrastProps = Omit<Omit<ComponentProps<"div">, "childre
|
|
|
94
95
|
style?: CSSProperties & ColorPickerKnobStyle;
|
|
95
96
|
} & {
|
|
96
97
|
background?: string;
|
|
98
|
+
passLabel?: string;
|
|
99
|
+
failLabel?: string;
|
|
97
100
|
};
|
|
98
101
|
export type ColorPickerOutputProps = Omit<Omit<ComponentProps<"div">, "children">, "style"> & {
|
|
99
102
|
style?: CSSProperties & ColorPickerKnobStyle;
|
|
@@ -112,7 +115,7 @@ export declare function ColorPickerAreaThumb({ className, ...props }: ColorPicke
|
|
|
112
115
|
export declare function ColorPickerHue({ className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }: ColorPickerHueProps): import("react").JSX.Element;
|
|
113
116
|
export declare function ColorPickerAlpha({ className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }: ColorPickerAlphaProps): import("react").JSX.Element | null;
|
|
114
117
|
export declare function ColorPickerWheel({ className, style, ...props }: ColorPickerWheelProps): import("react").JSX.Element;
|
|
115
|
-
export declare function ColorPickerInput({ size, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }: ColorPickerInputProps): import("react").JSX.Element;
|
|
118
|
+
export declare function ColorPickerInput({ size, className, invalidLabel, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, onFocus, onBlur, onKeyDown, ...props }: ColorPickerInputProps): import("react").JSX.Element;
|
|
116
119
|
export declare function ColorPickerFormatSelect({ formats, size, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, style }: ColorPickerFormatSelectProps): import("react").JSX.Element;
|
|
117
120
|
export declare function ColorPickerChannels({ className, children, ...props }: ColorPickerChannelsProps): import("react").JSX.Element;
|
|
118
121
|
export declare function ColorPickerChannel({ channel, label, className, "aria-label": ariaLabel, ...props }: ColorPickerChannelProps): import("react").JSX.Element | null;
|
|
@@ -131,6 +134,6 @@ export declare function ColorPickerEyeDropper({ className, children, ...props }:
|
|
|
131
134
|
export declare function ColorPickerSwatches({ colors, label, className, children, ...props }: ColorPickerSwatchesProps): import("react").JSX.Element;
|
|
132
135
|
export declare function ColorPickerSwatch({ color, className, "aria-label": ariaLabel, ...props }: ColorPickerSwatchProps): import("react").JSX.Element;
|
|
133
136
|
export declare function ColorPickerSwatchAdd({ onAdd, className, children, ...props }: ColorPickerSwatchAddProps): import("react").JSX.Element;
|
|
134
|
-
export declare function ColorPickerContrast({ background, className, ...props }: ColorPickerContrastProps): import("react").JSX.Element | null;
|
|
137
|
+
export declare function ColorPickerContrast({ background, passLabel, failLabel, className, ...props }: ColorPickerContrastProps): import("react").JSX.Element | null;
|
|
135
138
|
export declare function ColorPickerOutput({ className, children, renderValue, ...props }: ColorPickerOutputProps): import("react").JSX.Element;
|
|
136
139
|
//#endregion
|