@uipath/apollo-wind 2.72.2 → 2.73.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ui/alert-dialog.cjs +1 -1
- package/dist/components/ui/alert-dialog.js +1 -1
- package/dist/components/ui/attachment.cjs +40 -8
- package/dist/components/ui/attachment.d.ts +11 -1
- package/dist/components/ui/attachment.js +43 -11
- package/dist/components/ui/bubble.cjs +1 -1
- package/dist/components/ui/bubble.d.ts +6 -0
- package/dist/components/ui/bubble.js +1 -1
- package/dist/components/ui/chat-composer.cjs +8 -2
- package/dist/components/ui/chat-composer.d.ts +6 -0
- package/dist/components/ui/chat-composer.js +9 -3
- package/dist/components/ui/citation.cjs +5 -3
- package/dist/components/ui/citation.d.ts +6 -0
- package/dist/components/ui/citation.js +5 -3
- package/dist/components/ui/code-block.cjs +6 -6
- package/dist/components/ui/code-block.d.ts +6 -0
- package/dist/components/ui/code-block.js +6 -6
- package/dist/components/ui/context-menu.cjs +2 -2
- package/dist/components/ui/context-menu.js +2 -2
- package/dist/components/ui/dialog.cjs +18 -5
- package/dist/components/ui/dialog.d.ts +15 -0
- package/dist/components/ui/dialog.js +16 -6
- package/dist/components/ui/disclosure-tree.cjs +269 -0
- package/dist/components/ui/disclosure-tree.d.ts +45 -0
- package/dist/components/ui/disclosure-tree.js +235 -0
- package/dist/components/ui/dropdown-menu.cjs +2 -2
- package/dist/components/ui/dropdown-menu.js +2 -2
- package/dist/components/ui/dropzone-overlay.cjs +21 -5
- package/dist/components/ui/dropzone-overlay.d.ts +12 -1
- package/dist/components/ui/dropzone-overlay.js +21 -5
- package/dist/components/ui/empty-state.cjs +28 -10
- package/dist/components/ui/empty-state.d.ts +9 -0
- package/dist/components/ui/empty-state.js +30 -12
- package/dist/components/ui/hover-card.cjs +1 -1
- package/dist/components/ui/hover-card.js +1 -1
- package/dist/components/ui/index.cjs +221 -208
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/ui/index.js +1 -0
- package/dist/components/ui/markdown.cjs +129 -22
- package/dist/components/ui/markdown.d.ts +23 -4
- package/dist/components/ui/markdown.js +129 -22
- package/dist/components/ui/message-actions.cjs +1 -1
- package/dist/components/ui/message-actions.d.ts +3 -0
- package/dist/components/ui/message-actions.js +1 -1
- package/dist/components/ui/message.cjs +4 -4
- package/dist/components/ui/message.d.ts +7 -0
- package/dist/components/ui/message.js +4 -4
- package/dist/components/ui/popover.cjs +1 -1
- package/dist/components/ui/popover.js +1 -1
- package/dist/components/ui/search.cjs +16 -5
- package/dist/components/ui/search.d.ts +9 -0
- package/dist/components/ui/search.js +13 -5
- package/dist/components/ui/select.cjs +1 -1
- package/dist/components/ui/select.js +1 -1
- package/dist/components/ui/sheet.cjs +12 -2
- package/dist/components/ui/sheet.d.ts +7 -0
- package/dist/components/ui/sheet.js +10 -3
- package/dist/components/ui/sources.cjs +1 -1
- package/dist/components/ui/sources.d.ts +6 -0
- package/dist/components/ui/sources.js +1 -1
- package/dist/components/ui/thinking-indicator.cjs +5 -3
- package/dist/components/ui/thinking-indicator.d.ts +6 -0
- package/dist/components/ui/thinking-indicator.js +5 -3
- package/dist/components/ui/tool-call.cjs +10 -7
- package/dist/components/ui/tool-call.d.ts +6 -0
- package/dist/components/ui/tool-call.js +10 -7
- package/dist/components/ui/tooltip.cjs +1 -1
- package/dist/components/ui/tooltip.js +1 -1
- package/dist/index.cjs +14 -1
- package/dist/index.d.ts +10 -6
- package/dist/index.js +5 -4
- package/dist/lib/disclosure-row.cjs +36 -0
- package/dist/lib/disclosure-row.d.ts +1 -0
- package/dist/lib/disclosure-row.js +2 -0
- package/dist/lib/use-ancestor-density.cjs +65 -0
- package/dist/lib/use-ancestor-density.d.ts +8 -0
- package/dist/lib/use-ancestor-density.js +31 -0
- package/dist/styles.css +681 -12
- package/dist/tailwind.utilities.css +173 -0
- package/package.json +1 -1
|
@@ -76,7 +76,7 @@ const AlertDialogContent = /*#__PURE__*/ external_react_namespaceObject.forwardR
|
|
|
76
76
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_alert_dialog_namespaceObject.Content, {
|
|
77
77
|
ref: ref,
|
|
78
78
|
"data-slot": "alert-dialog-content",
|
|
79
|
-
className: (0, index_cjs_namespaceObject.cn)(dialog_surface_cjs_namespaceObject.dialogSurfaceClassName, 'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 rounded-2xl p-6 duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95
|
|
79
|
+
className: (0, index_cjs_namespaceObject.cn)(dialog_surface_cjs_namespaceObject.dialogSurfaceClassName, 'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 rounded-2xl p-6 duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 origin-center', className),
|
|
80
80
|
...props
|
|
81
81
|
})
|
|
82
82
|
]
|
|
@@ -38,7 +38,7 @@ const AlertDialogContent = /*#__PURE__*/ forwardRef(({ className, container, ...
|
|
|
38
38
|
/*#__PURE__*/ jsx(Content, {
|
|
39
39
|
ref: ref,
|
|
40
40
|
"data-slot": "alert-dialog-content",
|
|
41
|
-
className: cn(dialogSurfaceClassName, 'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 rounded-2xl p-6 duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95
|
|
41
|
+
className: cn(dialogSurfaceClassName, 'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 rounded-2xl p-6 duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 origin-center', className),
|
|
42
42
|
...props
|
|
43
43
|
})
|
|
44
44
|
]
|
|
@@ -40,13 +40,14 @@ const react_slot_namespaceObject = require("@radix-ui/react-slot");
|
|
|
40
40
|
const external_class_variance_authority_namespaceObject = require("class-variance-authority");
|
|
41
41
|
const external_react_namespaceObject = require("react");
|
|
42
42
|
const external_button_cjs_namespaceObject = require("./button.cjs");
|
|
43
|
+
const external_tooltip_cjs_namespaceObject = require("./tooltip.cjs");
|
|
43
44
|
const index_cjs_namespaceObject = require("../../lib/index.cjs");
|
|
44
45
|
const attachmentVariants = (0, external_class_variance_authority_namespaceObject.cva)('group/attachment relative flex w-fit max-w-full min-w-0 shrink-0 flex-wrap rounded-xl border bg-card text-card-foreground transition-colors focus-within:ring-1 focus-within:ring-ring/50 has-[>a,>button]:hover:bg-muted/50 data-[state=error]:border-destructive/30 data-[state=idle]:border-dashed', {
|
|
45
46
|
variants: {
|
|
46
47
|
size: {
|
|
47
|
-
default: 'gap-2 text-sm has-data-[slot=attachment-content]:px-2.5 has-data-[slot=attachment-content]:py-2 has-data-[slot=attachment-media]:p-2',
|
|
48
|
-
sm: 'gap-2.5 text-xs has-data-[slot=attachment-content]:px-2 has-data-[slot=attachment-content]:py-1.5 has-data-[slot=attachment-media]:p-1.5',
|
|
49
|
-
xs: 'gap-1.5 rounded-lg text-xs has-data-[slot=attachment-content]:px-1.5 has-data-[slot=attachment-content]:py-1 has-data-[slot=attachment-media]:p-1'
|
|
48
|
+
default: 'gap-2 text-sm has-data-[slot=attachment-content]:px-2.5 has-data-[slot=attachment-content]:py-2 has-data-[slot=attachment-media]:p-2 in-data-[density=compact]:has-data-[slot=attachment-content]:py-1.5 in-data-[density=compact]:has-data-[slot=attachment-media]:p-1.5',
|
|
49
|
+
sm: 'gap-2.5 text-xs has-data-[slot=attachment-content]:px-2 has-data-[slot=attachment-content]:py-1.5 has-data-[slot=attachment-media]:p-1.5 in-data-[density=compact]:has-data-[slot=attachment-content]:py-1 in-data-[density=compact]:has-data-[slot=attachment-media]:p-1',
|
|
50
|
+
xs: 'gap-1.5 rounded-lg text-xs has-data-[slot=attachment-content]:px-1.5 has-data-[slot=attachment-content]:py-1 has-data-[slot=attachment-media]:p-1 in-data-[density=compact]:has-data-[slot=attachment-content]:py-0.5 in-data-[density=compact]:has-data-[slot=attachment-media]:p-0.5'
|
|
50
51
|
},
|
|
51
52
|
orientation: {
|
|
52
53
|
horizontal: 'min-w-40 items-center',
|
|
@@ -71,7 +72,7 @@ const Attachment = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ cl
|
|
|
71
72
|
...props
|
|
72
73
|
}));
|
|
73
74
|
Attachment.displayName = 'Attachment';
|
|
74
|
-
const attachmentMediaVariants = (0, external_class_variance_authority_namespaceObject.cva)("relative flex aspect-square w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted text-foreground group-data-[orientation=vertical]/attachment:w-full group-data-[size=sm]/attachment:w-8 group-data-[size=xs]/attachment:w-7 group-data-[size=xs]/attachment:rounded-md group-data-[state=error]/attachment:bg-destructive/10 group-data-[state=error]/attachment:text-destructive [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 group-data-[orientation=vertical]/attachment:[&_svg:not([class*='size-'])]:size-6 group-data-[size=xs]/attachment:[&_svg:not([class*='size-'])]:size-3.5", {
|
|
75
|
+
const attachmentMediaVariants = (0, external_class_variance_authority_namespaceObject.cva)("relative flex aspect-square w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted text-foreground group-data-[orientation=vertical]/attachment:w-full group-data-[size=sm]/attachment:w-8 group-data-[size=xs]/attachment:w-7 in-data-[density=compact]:w-8 in-data-[density=compact]:group-data-[size=sm]/attachment:w-7 in-data-[density=compact]:group-data-[size=xs]/attachment:w-6 group-data-[size=xs]/attachment:rounded-md group-data-[state=error]/attachment:bg-destructive/10 group-data-[state=error]/attachment:text-destructive [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 group-data-[orientation=vertical]/attachment:[&_svg:not([class*='size-'])]:size-6 group-data-[size=xs]/attachment:[&_svg:not([class*='size-'])]:size-3.5", {
|
|
75
76
|
variants: {
|
|
76
77
|
variant: {
|
|
77
78
|
icon: '',
|
|
@@ -99,12 +100,43 @@ const AttachmentContent = /*#__PURE__*/ external_react_namespaceObject.forwardRe
|
|
|
99
100
|
...props
|
|
100
101
|
}));
|
|
101
102
|
AttachmentContent.displayName = 'AttachmentContent';
|
|
102
|
-
const AttachmentTitle = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, ...props }, ref)
|
|
103
|
-
|
|
103
|
+
const AttachmentTitle = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, truncationTooltip = true, children, ...props }, ref)=>{
|
|
104
|
+
const local = external_react_namespaceObject.useRef(null);
|
|
105
|
+
const setRef = external_react_namespaceObject.useMemo(()=>(0, index_cjs_namespaceObject.composeRefs)(ref, local), [
|
|
106
|
+
ref
|
|
107
|
+
]);
|
|
108
|
+
const [open, setOpen] = external_react_namespaceObject.useState(false);
|
|
109
|
+
const title = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
110
|
+
ref: setRef,
|
|
104
111
|
"data-slot": "attachment-title",
|
|
105
112
|
className: (0, index_cjs_namespaceObject.cn)('block max-w-full min-w-0 truncate font-medium group-data-[state=processing]/attachment:shimmer group-data-[state=uploading]/attachment:shimmer', className),
|
|
106
|
-
...props
|
|
107
|
-
|
|
113
|
+
...props,
|
|
114
|
+
children: children
|
|
115
|
+
});
|
|
116
|
+
if (!truncationTooltip) return title;
|
|
117
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tooltip_cjs_namespaceObject.TooltipProvider, {
|
|
118
|
+
delayDuration: 300,
|
|
119
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_tooltip_cjs_namespaceObject.Tooltip, {
|
|
120
|
+
open: open,
|
|
121
|
+
onOpenChange: (next)=>{
|
|
122
|
+
const node = local.current;
|
|
123
|
+
setOpen(next && !!node && node.scrollWidth > node.clientWidth);
|
|
124
|
+
},
|
|
125
|
+
children: [
|
|
126
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tooltip_cjs_namespaceObject.TooltipTrigger, {
|
|
127
|
+
asChild: true,
|
|
128
|
+
children: title
|
|
129
|
+
}),
|
|
130
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tooltip_cjs_namespaceObject.TooltipPortal, {
|
|
131
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tooltip_cjs_namespaceObject.TooltipContent, {
|
|
132
|
+
className: "max-w-80 break-all",
|
|
133
|
+
children: children
|
|
134
|
+
})
|
|
135
|
+
})
|
|
136
|
+
]
|
|
137
|
+
})
|
|
138
|
+
});
|
|
139
|
+
});
|
|
108
140
|
AttachmentTitle.displayName = 'AttachmentTitle';
|
|
109
141
|
const AttachmentDescription = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
110
142
|
ref: ref,
|
|
@@ -6,6 +6,11 @@ import { type ButtonProps } from './button';
|
|
|
6
6
|
* components. `state` drives the chrome: `idle` is a dashed placeholder, `uploading` and
|
|
7
7
|
* `processing` shimmer the title, `error` tints it. `AttachmentGroup` scrolls a row of them with
|
|
8
8
|
* faded edges.
|
|
9
|
+
*
|
|
10
|
+
* Compact density (Wind's own; Material's chips do not change): inside an ancestor with
|
|
11
|
+
* `data-density="compact"` every size steps its padding and media down one notch (an `xs` chip
|
|
12
|
+
* with a title goes from 38px to 30px tall); the type stays, so names remain legible. The padding
|
|
13
|
+
* classes are `has-*` variants, so a host override needs the same variant, as before.
|
|
9
14
|
*/
|
|
10
15
|
declare const attachmentVariants: (props?: ({
|
|
11
16
|
size?: "default" | "sm" | "xs" | null | undefined;
|
|
@@ -23,7 +28,12 @@ export interface AttachmentMediaProps extends React.HTMLAttributes<HTMLDivElemen
|
|
|
23
28
|
}
|
|
24
29
|
declare const AttachmentMedia: React.ForwardRefExoticComponent<AttachmentMediaProps & React.RefAttributes<HTMLDivElement>>;
|
|
25
30
|
declare const AttachmentContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
26
|
-
|
|
31
|
+
export interface AttachmentTitleProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
32
|
+
/** Show the full title in a tooltip on hover when it is cut off. On by default. */
|
|
33
|
+
truncationTooltip?: boolean;
|
|
34
|
+
}
|
|
35
|
+
/** The file name, cut off with an ellipsis. A cut-off name shows in full in a tooltip on hover. */
|
|
36
|
+
declare const AttachmentTitle: React.ForwardRefExoticComponent<AttachmentTitleProps & React.RefAttributes<HTMLSpanElement>>;
|
|
27
37
|
declare const AttachmentDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLSpanElement> & React.RefAttributes<HTMLSpanElement>>;
|
|
28
38
|
declare const AttachmentActions: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
29
39
|
export interface AttachmentActionProps extends ButtonProps {
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Slot } from "@radix-ui/react-slot";
|
|
3
3
|
import { cva } from "class-variance-authority";
|
|
4
|
-
import { forwardRef } from "react";
|
|
4
|
+
import { forwardRef, useMemo, useRef, useState } from "react";
|
|
5
5
|
import { Button } from "./button.js";
|
|
6
|
-
import {
|
|
6
|
+
import { Tooltip, TooltipContent, TooltipPortal, TooltipProvider, TooltipTrigger } from "./tooltip.js";
|
|
7
|
+
import { cn, composeRefs } from "../../lib/index.js";
|
|
7
8
|
const attachmentVariants = cva('group/attachment relative flex w-fit max-w-full min-w-0 shrink-0 flex-wrap rounded-xl border bg-card text-card-foreground transition-colors focus-within:ring-1 focus-within:ring-ring/50 has-[>a,>button]:hover:bg-muted/50 data-[state=error]:border-destructive/30 data-[state=idle]:border-dashed', {
|
|
8
9
|
variants: {
|
|
9
10
|
size: {
|
|
10
|
-
default: 'gap-2 text-sm has-data-[slot=attachment-content]:px-2.5 has-data-[slot=attachment-content]:py-2 has-data-[slot=attachment-media]:p-2',
|
|
11
|
-
sm: 'gap-2.5 text-xs has-data-[slot=attachment-content]:px-2 has-data-[slot=attachment-content]:py-1.5 has-data-[slot=attachment-media]:p-1.5',
|
|
12
|
-
xs: 'gap-1.5 rounded-lg text-xs has-data-[slot=attachment-content]:px-1.5 has-data-[slot=attachment-content]:py-1 has-data-[slot=attachment-media]:p-1'
|
|
11
|
+
default: 'gap-2 text-sm has-data-[slot=attachment-content]:px-2.5 has-data-[slot=attachment-content]:py-2 has-data-[slot=attachment-media]:p-2 in-data-[density=compact]:has-data-[slot=attachment-content]:py-1.5 in-data-[density=compact]:has-data-[slot=attachment-media]:p-1.5',
|
|
12
|
+
sm: 'gap-2.5 text-xs has-data-[slot=attachment-content]:px-2 has-data-[slot=attachment-content]:py-1.5 has-data-[slot=attachment-media]:p-1.5 in-data-[density=compact]:has-data-[slot=attachment-content]:py-1 in-data-[density=compact]:has-data-[slot=attachment-media]:p-1',
|
|
13
|
+
xs: 'gap-1.5 rounded-lg text-xs has-data-[slot=attachment-content]:px-1.5 has-data-[slot=attachment-content]:py-1 has-data-[slot=attachment-media]:p-1 in-data-[density=compact]:has-data-[slot=attachment-content]:py-0.5 in-data-[density=compact]:has-data-[slot=attachment-media]:p-0.5'
|
|
13
14
|
},
|
|
14
15
|
orientation: {
|
|
15
16
|
horizontal: 'min-w-40 items-center',
|
|
@@ -34,7 +35,7 @@ const Attachment = /*#__PURE__*/ forwardRef(({ className, state = 'done', size =
|
|
|
34
35
|
...props
|
|
35
36
|
}));
|
|
36
37
|
Attachment.displayName = 'Attachment';
|
|
37
|
-
const attachmentMediaVariants = cva("relative flex aspect-square w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted text-foreground group-data-[orientation=vertical]/attachment:w-full group-data-[size=sm]/attachment:w-8 group-data-[size=xs]/attachment:w-7 group-data-[size=xs]/attachment:rounded-md group-data-[state=error]/attachment:bg-destructive/10 group-data-[state=error]/attachment:text-destructive [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 group-data-[orientation=vertical]/attachment:[&_svg:not([class*='size-'])]:size-6 group-data-[size=xs]/attachment:[&_svg:not([class*='size-'])]:size-3.5", {
|
|
38
|
+
const attachmentMediaVariants = cva("relative flex aspect-square w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted text-foreground group-data-[orientation=vertical]/attachment:w-full group-data-[size=sm]/attachment:w-8 group-data-[size=xs]/attachment:w-7 in-data-[density=compact]:w-8 in-data-[density=compact]:group-data-[size=sm]/attachment:w-7 in-data-[density=compact]:group-data-[size=xs]/attachment:w-6 group-data-[size=xs]/attachment:rounded-md group-data-[state=error]/attachment:bg-destructive/10 group-data-[state=error]/attachment:text-destructive [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 group-data-[orientation=vertical]/attachment:[&_svg:not([class*='size-'])]:size-6 group-data-[size=xs]/attachment:[&_svg:not([class*='size-'])]:size-3.5", {
|
|
38
39
|
variants: {
|
|
39
40
|
variant: {
|
|
40
41
|
icon: '',
|
|
@@ -62,12 +63,43 @@ const AttachmentContent = /*#__PURE__*/ forwardRef(({ className, ...props }, ref
|
|
|
62
63
|
...props
|
|
63
64
|
}));
|
|
64
65
|
AttachmentContent.displayName = 'AttachmentContent';
|
|
65
|
-
const AttachmentTitle = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)
|
|
66
|
-
|
|
66
|
+
const AttachmentTitle = /*#__PURE__*/ forwardRef(({ className, truncationTooltip = true, children, ...props }, ref)=>{
|
|
67
|
+
const local = useRef(null);
|
|
68
|
+
const setRef = useMemo(()=>composeRefs(ref, local), [
|
|
69
|
+
ref
|
|
70
|
+
]);
|
|
71
|
+
const [open, setOpen] = useState(false);
|
|
72
|
+
const title = /*#__PURE__*/ jsx("span", {
|
|
73
|
+
ref: setRef,
|
|
67
74
|
"data-slot": "attachment-title",
|
|
68
75
|
className: cn('block max-w-full min-w-0 truncate font-medium group-data-[state=processing]/attachment:shimmer group-data-[state=uploading]/attachment:shimmer', className),
|
|
69
|
-
...props
|
|
70
|
-
|
|
76
|
+
...props,
|
|
77
|
+
children: children
|
|
78
|
+
});
|
|
79
|
+
if (!truncationTooltip) return title;
|
|
80
|
+
return /*#__PURE__*/ jsx(TooltipProvider, {
|
|
81
|
+
delayDuration: 300,
|
|
82
|
+
children: /*#__PURE__*/ jsxs(Tooltip, {
|
|
83
|
+
open: open,
|
|
84
|
+
onOpenChange: (next)=>{
|
|
85
|
+
const node = local.current;
|
|
86
|
+
setOpen(next && !!node && node.scrollWidth > node.clientWidth);
|
|
87
|
+
},
|
|
88
|
+
children: [
|
|
89
|
+
/*#__PURE__*/ jsx(TooltipTrigger, {
|
|
90
|
+
asChild: true,
|
|
91
|
+
children: title
|
|
92
|
+
}),
|
|
93
|
+
/*#__PURE__*/ jsx(TooltipPortal, {
|
|
94
|
+
children: /*#__PURE__*/ jsx(TooltipContent, {
|
|
95
|
+
className: "max-w-80 break-all",
|
|
96
|
+
children: children
|
|
97
|
+
})
|
|
98
|
+
})
|
|
99
|
+
]
|
|
100
|
+
})
|
|
101
|
+
});
|
|
102
|
+
});
|
|
71
103
|
AttachmentTitle.displayName = 'AttachmentTitle';
|
|
72
104
|
const AttachmentDescription = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx("span", {
|
|
73
105
|
ref: ref,
|
|
@@ -73,7 +73,7 @@ const BubbleContent = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({
|
|
|
73
73
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Comp, {
|
|
74
74
|
ref: ref,
|
|
75
75
|
"data-slot": "bubble-content",
|
|
76
|
-
className: (0, index_cjs_namespaceObject.cn)('w-fit max-w-full min-w-0 overflow-hidden rounded-xl border border-transparent px-
|
|
76
|
+
className: (0, index_cjs_namespaceObject.cn)('w-fit max-w-full min-w-0 overflow-hidden rounded-xl border border-transparent px-(--bubble-padding-x,0.75rem) py-(--bubble-padding-y,0.5rem) text-(length:--bubble-font-size,0.875rem) leading-(--bubble-leading,1.625) break-words group-data-[align=end]/bubble:self-end in-data-[density=compact]:[--bubble-font-size:0.75rem] in-data-[density=compact]:[--bubble-leading:1.5] in-data-[density=compact]:[--bubble-padding-x:0.625rem] in-data-[density=compact]:[--bubble-padding-y:0.375rem]', className),
|
|
77
77
|
...props
|
|
78
78
|
});
|
|
79
79
|
});
|
|
@@ -4,6 +4,12 @@ import * as React from 'react';
|
|
|
4
4
|
* The surface of a chat message, ported from shadcn/ui's chat components. `Bubble` positions and
|
|
5
5
|
* colours; `BubbleContent` is the padded box the text lives in, so a bubble can also carry
|
|
6
6
|
* reactions or actions outside that box. Use inside `MessageContent`, or standalone with `align`.
|
|
7
|
+
*
|
|
8
|
+
* Compact density: inside an ancestor with `data-density="compact"` the text drops to 12px, as
|
|
9
|
+
* Material's does, and the padding tightens to 10px by 6px (Wind's own; Material keeps it).
|
|
10
|
+
* There is no prop: the host opts in by setting the attribute (the Wind chat sets it on its root).
|
|
11
|
+
* Compact sets CSS variables the base classes read, so a host className on the root wins in
|
|
12
|
+
* both densities.
|
|
7
13
|
*/
|
|
8
14
|
declare const BubbleGroup: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
9
15
|
declare const bubbleVariants: (props?: ({
|
|
@@ -41,7 +41,7 @@ const BubbleContent = /*#__PURE__*/ forwardRef(({ asChild = false, className, ..
|
|
|
41
41
|
return /*#__PURE__*/ jsx(Comp, {
|
|
42
42
|
ref: ref,
|
|
43
43
|
"data-slot": "bubble-content",
|
|
44
|
-
className: cn('w-fit max-w-full min-w-0 overflow-hidden rounded-xl border border-transparent px-
|
|
44
|
+
className: cn('w-fit max-w-full min-w-0 overflow-hidden rounded-xl border border-transparent px-(--bubble-padding-x,0.75rem) py-(--bubble-padding-y,0.5rem) text-(length:--bubble-font-size,0.875rem) leading-(--bubble-leading,1.625) break-words group-data-[align=end]/bubble:self-end in-data-[density=compact]:[--bubble-font-size:0.75rem] in-data-[density=compact]:[--bubble-leading:1.5] in-data-[density=compact]:[--bubble-padding-x:0.625rem] in-data-[density=compact]:[--bubble-padding-y:0.375rem]', className),
|
|
45
45
|
...props
|
|
46
46
|
});
|
|
47
47
|
});
|
|
@@ -44,6 +44,7 @@ const external_class_variance_authority_namespaceObject = require("class-varianc
|
|
|
44
44
|
const external_lucide_react_namespaceObject = require("lucide-react");
|
|
45
45
|
const external_react_namespaceObject = require("react");
|
|
46
46
|
const index_cjs_namespaceObject = require("../../lib/index.cjs");
|
|
47
|
+
const use_ancestor_density_cjs_namespaceObject = require("../../lib/use-ancestor-density.cjs");
|
|
47
48
|
const external_attachment_cjs_namespaceObject = require("./attachment.cjs");
|
|
48
49
|
const external_button_cjs_namespaceObject = require("./button.cjs");
|
|
49
50
|
const external_file_validation_cjs_namespaceObject = require("./file-validation.cjs");
|
|
@@ -79,7 +80,12 @@ const chatComposerVariants = (0, external_class_variance_authority_namespaceObje
|
|
|
79
80
|
});
|
|
80
81
|
const NO_ATTACHMENTS = [];
|
|
81
82
|
const ChatComposer = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, children, value: valueProp, defaultValue, onValueChange, onSubmit, status = 'idle', onStop, disabled = false, submitDisabled = false, density, attachments = NO_ATTACHMENTS, onRemoveAttachment, strings, ...props }, ref)=>{
|
|
82
|
-
const
|
|
83
|
+
const formRef = external_react_namespaceObject.useRef(null);
|
|
84
|
+
const setFormRef = external_react_namespaceObject.useMemo(()=>(0, index_cjs_namespaceObject.composeRefs)(ref, formRef), [
|
|
85
|
+
ref
|
|
86
|
+
]);
|
|
87
|
+
const ancestorDensity = (0, use_ancestor_density_cjs_namespaceObject.useAncestorDensity)(formRef, null == density);
|
|
88
|
+
const resolvedDensity = density ?? ancestorDensity ?? 'comfortable';
|
|
83
89
|
const controlled = void 0 !== valueProp;
|
|
84
90
|
const [uncontrolledValue, setUncontrolledValue] = external_react_namespaceObject.useState(defaultValue ?? '');
|
|
85
91
|
const value = controlled ? valueProp : uncontrolledValue;
|
|
@@ -152,7 +158,7 @@ const ChatComposer = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({
|
|
|
152
158
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ChatComposerContext.Provider, {
|
|
153
159
|
value: context,
|
|
154
160
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("form", {
|
|
155
|
-
ref:
|
|
161
|
+
ref: setFormRef,
|
|
156
162
|
"data-slot": "chat-composer",
|
|
157
163
|
"data-status": status,
|
|
158
164
|
"data-density": resolvedDensity,
|
|
@@ -25,6 +25,12 @@ import { type InputGroupProps, type InputGroupTextareaProps } from './input-grou
|
|
|
25
25
|
*
|
|
26
26
|
* Enter sends and Shift+Enter starts a new line. While `status` is `streaming` the submit button
|
|
27
27
|
* becomes a stop button and Enter does not send.
|
|
28
|
+
*
|
|
29
|
+
* Density: `density="compact"` gives a one-row textarea and tighter spacing. Without the prop the
|
|
30
|
+
* composer is compact while any ancestor has `data-density="compact"`, as the other chat
|
|
31
|
+
* primitives are, so it is compact inside a compact chat panel. The prop always wins. That
|
|
32
|
+
* ancestor is watched for changes; one that only gains the attribute later is picked up on the
|
|
33
|
+
* composer's next render.
|
|
28
34
|
*/
|
|
29
35
|
export interface ChatComposerStrings {
|
|
30
36
|
/** Accessible name of the textarea. */
|
|
@@ -3,7 +3,8 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { cva } from "class-variance-authority";
|
|
4
4
|
import { ArrowUp, CircleAlert, FileText, Paperclip, Square, TriangleAlert, X } from "lucide-react";
|
|
5
5
|
import { createContext, forwardRef, useCallback, useContext, useMemo, useRef, useState } from "react";
|
|
6
|
-
import { cn } from "../../lib/index.js";
|
|
6
|
+
import { cn, composeRefs } from "../../lib/index.js";
|
|
7
|
+
import { useAncestorDensity } from "../../lib/use-ancestor-density.js";
|
|
7
8
|
import { Attachment, AttachmentAction, AttachmentActions, AttachmentContent, AttachmentDescription, AttachmentGroup, AttachmentMedia, AttachmentTitle } from "./attachment.js";
|
|
8
9
|
import { Button } from "./button.js";
|
|
9
10
|
import { validateFiles } from "./file-validation.js";
|
|
@@ -39,7 +40,12 @@ const chatComposerVariants = cva('flex w-full min-w-0 flex-col', {
|
|
|
39
40
|
});
|
|
40
41
|
const NO_ATTACHMENTS = [];
|
|
41
42
|
const ChatComposer = /*#__PURE__*/ forwardRef(({ className, children, value: valueProp, defaultValue, onValueChange, onSubmit, status = 'idle', onStop, disabled = false, submitDisabled = false, density, attachments = NO_ATTACHMENTS, onRemoveAttachment, strings, ...props }, ref)=>{
|
|
42
|
-
const
|
|
43
|
+
const formRef = useRef(null);
|
|
44
|
+
const setFormRef = useMemo(()=>composeRefs(ref, formRef), [
|
|
45
|
+
ref
|
|
46
|
+
]);
|
|
47
|
+
const ancestorDensity = useAncestorDensity(formRef, null == density);
|
|
48
|
+
const resolvedDensity = density ?? ancestorDensity ?? 'comfortable';
|
|
43
49
|
const controlled = void 0 !== valueProp;
|
|
44
50
|
const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue ?? '');
|
|
45
51
|
const value = controlled ? valueProp : uncontrolledValue;
|
|
@@ -112,7 +118,7 @@ const ChatComposer = /*#__PURE__*/ forwardRef(({ className, children, value: val
|
|
|
112
118
|
return /*#__PURE__*/ jsx(ChatComposerContext.Provider, {
|
|
113
119
|
value: context,
|
|
114
120
|
children: /*#__PURE__*/ jsxs("form", {
|
|
115
|
-
ref:
|
|
121
|
+
ref: setFormRef,
|
|
116
122
|
"data-slot": "chat-composer",
|
|
117
123
|
"data-status": status,
|
|
118
124
|
"data-density": resolvedDensity,
|
|
@@ -40,7 +40,7 @@ const DEFAULT_CITATION_STRINGS = {
|
|
|
40
40
|
const citationVariants = (0, external_class_variance_authority_namespaceObject.cva)('mx-0.5 inline-flex cursor-pointer items-center justify-center rounded-full bg-muted align-text-top font-medium leading-none text-muted-foreground tabular-nums transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring data-[state=open]:bg-accent data-[state=open]:text-accent-foreground', {
|
|
41
41
|
variants: {
|
|
42
42
|
size: {
|
|
43
|
-
default: 'h-
|
|
43
|
+
default: 'h-(--citation-size,1.125rem) min-w-(--citation-size,1.125rem) px-(--citation-padding,0.375rem) text-(length:--citation-font-size,11px)',
|
|
44
44
|
sm: 'h-4 min-w-4 px-1 text-[10px]',
|
|
45
45
|
lg: 'h-5 min-w-5 px-1.5 text-xs'
|
|
46
46
|
}
|
|
@@ -49,7 +49,8 @@ const citationVariants = (0, external_class_variance_authority_namespaceObject.c
|
|
|
49
49
|
size: 'default'
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
|
-
const
|
|
52
|
+
const COMPACT_CITATION_CLASSES = 'in-data-[density=compact]:[--citation-size:1rem] in-data-[density=compact]:[--citation-padding:0.25rem] in-data-[density=compact]:[--citation-font-size:10px]';
|
|
53
|
+
const Citation = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, size: sizeProp, index, title, snippet, source, href, onSelect, onClick, onFocus, onBlur, onPointerEnter, onPointerLeave, preview = true, previewSide = 'top', onActiveChange, strings, 'aria-label': ariaLabel, children, ...props }, ref)=>{
|
|
53
54
|
const text = {
|
|
54
55
|
...DEFAULT_CITATION_STRINGS,
|
|
55
56
|
...strings
|
|
@@ -82,6 +83,7 @@ const Citation = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ clas
|
|
|
82
83
|
external_react_namespaceObject.useEffect(()=>()=>{
|
|
83
84
|
if (active.current) onActiveChangeRef.current?.(false);
|
|
84
85
|
}, []);
|
|
86
|
+
const size = sizeProp ?? 'default';
|
|
85
87
|
const name = ariaLabel ?? text.label(String(index), title || void 0);
|
|
86
88
|
const hasPreview = preview && Boolean(title || snippet || source);
|
|
87
89
|
const button = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
@@ -92,7 +94,7 @@ const Citation = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ clas
|
|
|
92
94
|
"aria-label": name,
|
|
93
95
|
className: (0, index_cjs_namespaceObject.cn)(citationVariants({
|
|
94
96
|
size
|
|
95
|
-
}), className),
|
|
97
|
+
}), null == sizeProp && COMPACT_CITATION_CLASSES, className),
|
|
96
98
|
onClick: (event)=>{
|
|
97
99
|
onClick?.(event);
|
|
98
100
|
if (hasPreview) {
|
|
@@ -6,6 +6,12 @@ import { HoverCardContent } from './hover-card';
|
|
|
6
6
|
* not navigate on its own: `onSelect` receives the citation and the event, so a host can run its
|
|
7
7
|
* `citation-click` pre-hook and decide whether to open `href`. The payload drops an `href` that is
|
|
8
8
|
* not http(s), mailto, tel or relative, so it is safe to open.
|
|
9
|
+
*
|
|
10
|
+
* Compact density: without a `size`, inside an ancestor with `data-density="compact"` it takes
|
|
11
|
+
* the `sm` look (10px, Material's compact citation). An explicit `size` always wins.
|
|
12
|
+
* There is no prop: the host opts in by setting the attribute (the Wind chat sets it on its root).
|
|
13
|
+
* Compact sets CSS variables the base classes read, so a host className on the root wins in
|
|
14
|
+
* both densities.
|
|
9
15
|
*/
|
|
10
16
|
export interface CitationData {
|
|
11
17
|
/** The source number, usually 1-based. Shown in the pill unless `children` are given. */
|
|
@@ -10,7 +10,7 @@ const DEFAULT_CITATION_STRINGS = {
|
|
|
10
10
|
const citationVariants = cva('mx-0.5 inline-flex cursor-pointer items-center justify-center rounded-full bg-muted align-text-top font-medium leading-none text-muted-foreground tabular-nums transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring data-[state=open]:bg-accent data-[state=open]:text-accent-foreground', {
|
|
11
11
|
variants: {
|
|
12
12
|
size: {
|
|
13
|
-
default: 'h-
|
|
13
|
+
default: 'h-(--citation-size,1.125rem) min-w-(--citation-size,1.125rem) px-(--citation-padding,0.375rem) text-(length:--citation-font-size,11px)',
|
|
14
14
|
sm: 'h-4 min-w-4 px-1 text-[10px]',
|
|
15
15
|
lg: 'h-5 min-w-5 px-1.5 text-xs'
|
|
16
16
|
}
|
|
@@ -19,7 +19,8 @@ const citationVariants = cva('mx-0.5 inline-flex cursor-pointer items-center jus
|
|
|
19
19
|
size: 'default'
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
-
const
|
|
22
|
+
const COMPACT_CITATION_CLASSES = 'in-data-[density=compact]:[--citation-size:1rem] in-data-[density=compact]:[--citation-padding:0.25rem] in-data-[density=compact]:[--citation-font-size:10px]';
|
|
23
|
+
const Citation = /*#__PURE__*/ forwardRef(({ className, size: sizeProp, index, title, snippet, source, href, onSelect, onClick, onFocus, onBlur, onPointerEnter, onPointerLeave, preview = true, previewSide = 'top', onActiveChange, strings, 'aria-label': ariaLabel, children, ...props }, ref)=>{
|
|
23
24
|
const text = {
|
|
24
25
|
...DEFAULT_CITATION_STRINGS,
|
|
25
26
|
...strings
|
|
@@ -52,6 +53,7 @@ const Citation = /*#__PURE__*/ forwardRef(({ className, size = 'default', index,
|
|
|
52
53
|
useEffect(()=>()=>{
|
|
53
54
|
if (active.current) onActiveChangeRef.current?.(false);
|
|
54
55
|
}, []);
|
|
56
|
+
const size = sizeProp ?? 'default';
|
|
55
57
|
const name = ariaLabel ?? text.label(String(index), title || void 0);
|
|
56
58
|
const hasPreview = preview && Boolean(title || snippet || source);
|
|
57
59
|
const button = /*#__PURE__*/ jsx("button", {
|
|
@@ -62,7 +64,7 @@ const Citation = /*#__PURE__*/ forwardRef(({ className, size = 'default', index,
|
|
|
62
64
|
"aria-label": name,
|
|
63
65
|
className: cn(citationVariants({
|
|
64
66
|
size
|
|
65
|
-
}), className),
|
|
67
|
+
}), null == sizeProp && COMPACT_CITATION_CLASSES, className),
|
|
66
68
|
onClick: (event)=>{
|
|
67
69
|
onClick?.(event);
|
|
68
70
|
if (hasPreview) {
|
|
@@ -149,8 +149,8 @@ const codeBlockTheme = {
|
|
|
149
149
|
color: token('rest'),
|
|
150
150
|
background: 'none',
|
|
151
151
|
fontFamily: 'var(--font-mono)',
|
|
152
|
-
fontSize: '0.8125rem',
|
|
153
|
-
lineHeight: 1.6,
|
|
152
|
+
fontSize: 'var(--code-block-font-size, 0.8125rem)',
|
|
153
|
+
lineHeight: 'var(--code-block-line-height, 1.6)',
|
|
154
154
|
margin: 0,
|
|
155
155
|
padding: '0.75rem 1rem',
|
|
156
156
|
overflow: 'auto',
|
|
@@ -285,7 +285,7 @@ const CodeBlockHeader = /*#__PURE__*/ external_react_namespaceObject.forwardRef(
|
|
|
285
285
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
286
286
|
ref: ref,
|
|
287
287
|
"data-slot": "code-block-header",
|
|
288
|
-
className: (0, index_cjs_namespaceObject.cn)('flex items-center justify-between gap-2 border-b border-border-subtle py-
|
|
288
|
+
className: (0, index_cjs_namespaceObject.cn)('flex items-center justify-between gap-2 border-b border-border-subtle py-(--code-block-header-py,0.25rem) pr-1 pl-(--code-block-header-pl,1rem) in-data-[density=compact]:[--code-block-header-py:0.125rem] in-data-[density=compact]:[--code-block-header-pl:0.75rem] in-data-[density=compact]:[&_button]:size-6 in-data-[density=compact]:[&_button_svg]:size-3.5', className),
|
|
289
289
|
...props,
|
|
290
290
|
children: [
|
|
291
291
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
@@ -336,14 +336,14 @@ const code_block_CodeBlockBody = /*#__PURE__*/ external_react_namespaceObject.me
|
|
|
336
336
|
children: code
|
|
337
337
|
});
|
|
338
338
|
});
|
|
339
|
-
const CodeBlock = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ code, language, wrap = false, showLineNumbers = false, hideHeader = false, actions, strings, className, ...props }, ref)=>{
|
|
339
|
+
const CodeBlock = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ code, language, wrap = false, showLineNumbers = false, hideHeader = false, actions, body, strings, className, ...props }, ref)=>{
|
|
340
340
|
const source = code.replace(/\n$/, '');
|
|
341
341
|
const resolved = resolveLanguage(language);
|
|
342
342
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
343
343
|
ref: ref,
|
|
344
344
|
"data-slot": "code-block",
|
|
345
345
|
"data-language": resolved ?? 'text',
|
|
346
|
-
className: (0, index_cjs_namespaceObject.cn)('min-w-0 overflow-hidden rounded-lg border border-border-subtle bg-surface-overlay text-foreground', className),
|
|
346
|
+
className: (0, index_cjs_namespaceObject.cn)('min-w-0 overflow-hidden rounded-lg border border-border-subtle bg-surface-overlay text-foreground in-data-[density=compact]:[--code-block-font-size:0.75rem] in-data-[density=compact]:[--code-block-line-height:1.5]', className),
|
|
347
347
|
...props,
|
|
348
348
|
children: [
|
|
349
349
|
!hideHeader && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(CodeBlockHeader, {
|
|
@@ -352,7 +352,7 @@ const CodeBlock = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ cod
|
|
|
352
352
|
strings: strings,
|
|
353
353
|
children: actions
|
|
354
354
|
}),
|
|
355
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(code_block_CodeBlockBody, {
|
|
355
|
+
null != body && false !== body ? body : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(code_block_CodeBlockBody, {
|
|
356
356
|
code: source,
|
|
357
357
|
language: resolved,
|
|
358
358
|
wrap: wrap,
|
|
@@ -32,6 +32,12 @@ export interface CodeBlockProps extends Omit<React.HTMLAttributes<HTMLDivElement
|
|
|
32
32
|
hideHeader?: boolean;
|
|
33
33
|
/** Extra header actions, such as preview or expand, placed before the copy button. */
|
|
34
34
|
actions?: React.ReactNode;
|
|
35
|
+
/**
|
|
36
|
+
* Shown instead of the highlighted source, for example a preview of it toggled from `actions`.
|
|
37
|
+
* The header and its copy button stay and still copy `code`. `undefined`, `null` and `false`
|
|
38
|
+
* keep the source, so `body={preview && <Preview />}` works.
|
|
39
|
+
*/
|
|
40
|
+
body?: React.ReactNode;
|
|
35
41
|
strings?: Partial<CodeBlockStrings>;
|
|
36
42
|
}
|
|
37
43
|
declare const CodeBlock: React.ForwardRefExoticComponent<CodeBlockProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -91,8 +91,8 @@ const codeBlockTheme = {
|
|
|
91
91
|
color: token('rest'),
|
|
92
92
|
background: 'none',
|
|
93
93
|
fontFamily: 'var(--font-mono)',
|
|
94
|
-
fontSize: '0.8125rem',
|
|
95
|
-
lineHeight: 1.6,
|
|
94
|
+
fontSize: 'var(--code-block-font-size, 0.8125rem)',
|
|
95
|
+
lineHeight: 'var(--code-block-line-height, 1.6)',
|
|
96
96
|
margin: 0,
|
|
97
97
|
padding: '0.75rem 1rem',
|
|
98
98
|
overflow: 'auto',
|
|
@@ -227,7 +227,7 @@ const CodeBlockHeader = /*#__PURE__*/ forwardRef(({ code, language, strings, cla
|
|
|
227
227
|
return /*#__PURE__*/ jsxs("div", {
|
|
228
228
|
ref: ref,
|
|
229
229
|
"data-slot": "code-block-header",
|
|
230
|
-
className: cn('flex items-center justify-between gap-2 border-b border-border-subtle py-
|
|
230
|
+
className: cn('flex items-center justify-between gap-2 border-b border-border-subtle py-(--code-block-header-py,0.25rem) pr-1 pl-(--code-block-header-pl,1rem) in-data-[density=compact]:[--code-block-header-py:0.125rem] in-data-[density=compact]:[--code-block-header-pl:0.75rem] in-data-[density=compact]:[&_button]:size-6 in-data-[density=compact]:[&_button_svg]:size-3.5', className),
|
|
231
231
|
...props,
|
|
232
232
|
children: [
|
|
233
233
|
/*#__PURE__*/ jsx("span", {
|
|
@@ -278,14 +278,14 @@ const code_block_CodeBlockBody = /*#__PURE__*/ memo(function({ code, language, w
|
|
|
278
278
|
children: code
|
|
279
279
|
});
|
|
280
280
|
});
|
|
281
|
-
const CodeBlock = /*#__PURE__*/ forwardRef(({ code, language, wrap = false, showLineNumbers = false, hideHeader = false, actions, strings, className, ...props }, ref)=>{
|
|
281
|
+
const CodeBlock = /*#__PURE__*/ forwardRef(({ code, language, wrap = false, showLineNumbers = false, hideHeader = false, actions, body, strings, className, ...props }, ref)=>{
|
|
282
282
|
const source = code.replace(/\n$/, '');
|
|
283
283
|
const resolved = resolveLanguage(language);
|
|
284
284
|
return /*#__PURE__*/ jsxs("div", {
|
|
285
285
|
ref: ref,
|
|
286
286
|
"data-slot": "code-block",
|
|
287
287
|
"data-language": resolved ?? 'text',
|
|
288
|
-
className: cn('min-w-0 overflow-hidden rounded-lg border border-border-subtle bg-surface-overlay text-foreground', className),
|
|
288
|
+
className: cn('min-w-0 overflow-hidden rounded-lg border border-border-subtle bg-surface-overlay text-foreground in-data-[density=compact]:[--code-block-font-size:0.75rem] in-data-[density=compact]:[--code-block-line-height:1.5]', className),
|
|
289
289
|
...props,
|
|
290
290
|
children: [
|
|
291
291
|
!hideHeader && /*#__PURE__*/ jsx(CodeBlockHeader, {
|
|
@@ -294,7 +294,7 @@ const CodeBlock = /*#__PURE__*/ forwardRef(({ code, language, wrap = false, show
|
|
|
294
294
|
strings: strings,
|
|
295
295
|
children: actions
|
|
296
296
|
}),
|
|
297
|
-
/*#__PURE__*/ jsx(code_block_CodeBlockBody, {
|
|
297
|
+
null != body && false !== body ? body : /*#__PURE__*/ jsx(code_block_CodeBlockBody, {
|
|
298
298
|
code: source,
|
|
299
299
|
language: resolved,
|
|
300
300
|
wrap: wrap,
|
|
@@ -96,7 +96,7 @@ ContextMenuSubTrigger.displayName = react_context_menu_namespaceObject.SubTrigge
|
|
|
96
96
|
const ContextMenuSubContent = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_context_menu_namespaceObject.SubContent, {
|
|
97
97
|
ref: ref,
|
|
98
98
|
"data-slot": "context-menu-sub-content",
|
|
99
|
-
className: (0, index_cjs_namespaceObject.cn)('z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md future:rounded-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-
|
|
99
|
+
className: (0, index_cjs_namespaceObject.cn)('z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md future:rounded-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-context-menu-content-transform-origin)', className),
|
|
100
100
|
...props
|
|
101
101
|
}));
|
|
102
102
|
ContextMenuSubContent.displayName = react_context_menu_namespaceObject.SubContent.displayName;
|
|
@@ -107,7 +107,7 @@ const ContextMenuContent = /*#__PURE__*/ external_react_namespaceObject.forwardR
|
|
|
107
107
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_context_menu_namespaceObject.Content, {
|
|
108
108
|
ref: ref,
|
|
109
109
|
"data-slot": "context-menu-content",
|
|
110
|
-
className: (0, index_cjs_namespaceObject.cn)('z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md future:rounded-lg animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-
|
|
110
|
+
className: (0, index_cjs_namespaceObject.cn)('z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md future:rounded-lg animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-context-menu-content-transform-origin)', className),
|
|
111
111
|
...props
|
|
112
112
|
})
|
|
113
113
|
});
|
|
@@ -54,7 +54,7 @@ ContextMenuSubTrigger.displayName = SubTrigger.displayName;
|
|
|
54
54
|
const ContextMenuSubContent = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(SubContent, {
|
|
55
55
|
ref: ref,
|
|
56
56
|
"data-slot": "context-menu-sub-content",
|
|
57
|
-
className: cn('z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md future:rounded-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-
|
|
57
|
+
className: cn('z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md future:rounded-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-context-menu-content-transform-origin)', className),
|
|
58
58
|
...props
|
|
59
59
|
}));
|
|
60
60
|
ContextMenuSubContent.displayName = SubContent.displayName;
|
|
@@ -65,7 +65,7 @@ const ContextMenuContent = /*#__PURE__*/ forwardRef(({ className, container, ...
|
|
|
65
65
|
children: /*#__PURE__*/ jsx(Content, {
|
|
66
66
|
ref: ref,
|
|
67
67
|
"data-slot": "context-menu-content",
|
|
68
|
-
className: cn('z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md future:rounded-lg animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-
|
|
68
|
+
className: cn('z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md future:rounded-lg animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-context-menu-content-transform-origin)', className),
|
|
69
69
|
...props
|
|
70
70
|
})
|
|
71
71
|
});
|