@uipath/apollo-wind 2.68.0 → 2.70.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/custom/chat-first-experience.cjs +3 -3
- package/dist/components/custom/chat-first-experience.js +3 -3
- package/dist/components/custom/demo-composer.cjs +80 -0
- package/dist/components/custom/demo-composer.d.ts +11 -0
- package/dist/components/custom/demo-composer.js +46 -0
- package/dist/components/custom/panel-flow.cjs +2 -2
- package/dist/components/custom/panel-flow.js +2 -2
- package/dist/components/ui/chat-composer.cjs +429 -0
- package/dist/components/ui/chat-composer.d.ts +157 -0
- package/dist/components/ui/chat-composer.js +359 -0
- package/dist/components/ui/citation.cjs +188 -0
- package/dist/components/ui/citation.d.ts +42 -0
- package/dist/components/ui/citation.js +148 -0
- package/dist/components/ui/code-block.cjs +375 -0
- package/dist/components/ui/code-block.d.ts +38 -0
- package/dist/components/ui/code-block.js +307 -0
- package/dist/components/ui/dropzone-overlay.cjs +142 -0
- package/dist/components/ui/dropzone-overlay.d.ts +27 -0
- package/dist/components/ui/dropzone-overlay.js +105 -0
- package/dist/components/ui/file-upload.cjs +5 -29
- package/dist/components/ui/file-upload.js +2 -26
- package/dist/components/ui/file-validation.cjs +91 -0
- package/dist/components/ui/file-validation.d.ts +24 -0
- package/dist/components/ui/file-validation.js +51 -0
- package/dist/components/ui/hover-card.cjs +15 -8
- package/dist/components/ui/hover-card.d.ts +4 -1
- package/dist/components/ui/hover-card.js +16 -9
- package/dist/components/ui/index.cjs +330 -198
- package/dist/components/ui/index.d.ts +12 -0
- package/dist/components/ui/index.js +12 -0
- package/dist/components/ui/input-group.cjs +1 -1
- package/dist/components/ui/input-group.d.ts +2 -1
- package/dist/components/ui/input-group.js +1 -1
- package/dist/components/ui/json-tree-view/JsonTree.cjs +2 -2
- package/dist/components/ui/json-tree-view/JsonTree.js +1 -1
- package/dist/components/ui/json-tree-view/index.cjs +26 -23
- package/dist/components/ui/json-tree-view/index.d.ts +2 -2
- package/dist/components/ui/json-tree-view/index.js +2 -2
- package/dist/components/ui/live-region.cjs +106 -0
- package/dist/components/ui/live-region.d.ts +31 -0
- package/dist/components/ui/live-region.js +72 -0
- package/dist/components/ui/loading-dots.cjs +95 -0
- package/dist/components/ui/loading-dots.d.ts +21 -0
- package/dist/components/ui/loading-dots.js +55 -0
- package/dist/components/ui/markdown.cjs +428 -0
- package/dist/components/ui/markdown.d.ts +55 -0
- package/dist/components/ui/markdown.js +378 -0
- package/dist/components/ui/message-actions.cjs +302 -0
- package/dist/components/ui/message-actions.d.ts +102 -0
- package/dist/components/ui/message-actions.js +241 -0
- package/dist/components/ui/message.cjs +1 -1
- package/dist/components/ui/message.d.ts +2 -0
- package/dist/components/ui/message.js +1 -1
- package/dist/components/ui/sources.cjs +175 -0
- package/dist/components/ui/sources.d.ts +44 -0
- package/dist/components/ui/sources.js +132 -0
- package/dist/components/ui/thinking-indicator.cjs +146 -0
- package/dist/components/ui/thinking-indicator.d.ts +38 -0
- package/dist/components/ui/thinking-indicator.js +106 -0
- package/dist/components/ui/tool-call.cjs +359 -0
- package/dist/components/ui/tool-call.d.ts +75 -0
- package/dist/components/ui/tool-call.js +301 -0
- package/dist/index.cjs +433 -253
- package/dist/index.d.ts +24 -0
- package/dist/index.js +13 -1
- package/dist/lib/index.cjs +8 -1
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +2 -1
- package/dist/lib/url.cjs +54 -0
- package/dist/lib/url.d.ts +8 -0
- package/dist/lib/url.js +17 -0
- package/dist/styles.css +363 -35
- package/dist/tailwind.utilities.css +21 -0
- package/package.json +7 -1
- package/dist/components/custom/chat-composer.cjs +0 -134
- package/dist/components/custom/chat-composer.d.ts +0 -14
- package/dist/components/custom/chat-composer.js +0 -100
- /package/dist/{components/ui/json-tree-view → lib}/clipboard.cjs +0 -0
- /package/dist/{components/ui/json-tree-view → lib}/clipboard.d.ts +0 -0
- /package/dist/{components/ui/json-tree-view → lib}/clipboard.js +0 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __webpack_require__ = {};
|
|
4
|
+
(()=>{
|
|
5
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
6
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: definition[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.r = (exports1)=>{
|
|
17
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
18
|
+
value: 'Module'
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
21
|
+
value: true
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
})();
|
|
25
|
+
var __webpack_exports__ = {};
|
|
26
|
+
__webpack_require__.r(__webpack_exports__);
|
|
27
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
28
|
+
Citation: ()=>Citation,
|
|
29
|
+
citationVariants: ()=>citationVariants,
|
|
30
|
+
DEFAULT_CITATION_STRINGS: ()=>DEFAULT_CITATION_STRINGS
|
|
31
|
+
});
|
|
32
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
33
|
+
const external_class_variance_authority_namespaceObject = require("class-variance-authority");
|
|
34
|
+
const external_react_namespaceObject = require("react");
|
|
35
|
+
const index_cjs_namespaceObject = require("../../lib/index.cjs");
|
|
36
|
+
const external_hover_card_cjs_namespaceObject = require("./hover-card.cjs");
|
|
37
|
+
const DEFAULT_CITATION_STRINGS = {
|
|
38
|
+
label: (index, title)=>title ? `Citation ${index}: ${title}` : `Citation ${index}`
|
|
39
|
+
};
|
|
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
|
+
variants: {
|
|
42
|
+
size: {
|
|
43
|
+
default: 'h-4.5 min-w-4.5 px-1.5 text-[11px]',
|
|
44
|
+
sm: 'h-4 min-w-4 px-1 text-[10px]',
|
|
45
|
+
lg: 'h-5 min-w-5 px-1.5 text-xs'
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
defaultVariants: {
|
|
49
|
+
size: 'default'
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
const Citation = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, size = 'default', index, title, snippet, source, href, onSelect, onClick, onFocus, onBlur, onPointerEnter, onPointerLeave, preview = true, previewSide = 'top', onActiveChange, strings, 'aria-label': ariaLabel, children, ...props }, ref)=>{
|
|
53
|
+
const text = {
|
|
54
|
+
...DEFAULT_CITATION_STRINGS,
|
|
55
|
+
...strings
|
|
56
|
+
};
|
|
57
|
+
const [open, setOpen] = external_react_namespaceObject.useState(false);
|
|
58
|
+
const activity = external_react_namespaceObject.useRef({
|
|
59
|
+
hovered: false,
|
|
60
|
+
focused: false,
|
|
61
|
+
previewOpen: false
|
|
62
|
+
});
|
|
63
|
+
const active = external_react_namespaceObject.useRef(false);
|
|
64
|
+
const onActiveChangeRef = external_react_namespaceObject.useRef(onActiveChange);
|
|
65
|
+
onActiveChangeRef.current = onActiveChange;
|
|
66
|
+
const updateActivity = (patch)=>{
|
|
67
|
+
Object.assign(activity.current, patch);
|
|
68
|
+
const { hovered, focused, previewOpen } = activity.current;
|
|
69
|
+
const next = hovered || focused || previewOpen;
|
|
70
|
+
if (next === active.current) return;
|
|
71
|
+
active.current = next;
|
|
72
|
+
onActiveChangeRef.current?.(next);
|
|
73
|
+
};
|
|
74
|
+
const dismissed = external_react_namespaceObject.useRef(false);
|
|
75
|
+
const setPreviewOpen = (next)=>{
|
|
76
|
+
if (next && dismissed.current) return;
|
|
77
|
+
setOpen(next);
|
|
78
|
+
updateActivity({
|
|
79
|
+
previewOpen: next
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
external_react_namespaceObject.useEffect(()=>()=>{
|
|
83
|
+
if (active.current) onActiveChangeRef.current?.(false);
|
|
84
|
+
}, []);
|
|
85
|
+
const name = ariaLabel ?? text.label(String(index), title || void 0);
|
|
86
|
+
const hasPreview = preview && Boolean(title || snippet || source);
|
|
87
|
+
const button = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
88
|
+
ref: ref,
|
|
89
|
+
type: "button",
|
|
90
|
+
"data-slot": "citation",
|
|
91
|
+
"data-size": size,
|
|
92
|
+
"aria-label": name,
|
|
93
|
+
className: (0, index_cjs_namespaceObject.cn)(citationVariants({
|
|
94
|
+
size
|
|
95
|
+
}), className),
|
|
96
|
+
onClick: (event)=>{
|
|
97
|
+
onClick?.(event);
|
|
98
|
+
if (hasPreview) {
|
|
99
|
+
dismissed.current = true;
|
|
100
|
+
setPreviewOpen(false);
|
|
101
|
+
}
|
|
102
|
+
if (!event.defaultPrevented) onSelect?.({
|
|
103
|
+
index,
|
|
104
|
+
title,
|
|
105
|
+
snippet,
|
|
106
|
+
source,
|
|
107
|
+
href: (0, index_cjs_namespaceObject.safeHref)(href)
|
|
108
|
+
}, event);
|
|
109
|
+
},
|
|
110
|
+
onFocus: (event)=>{
|
|
111
|
+
onFocus?.(event);
|
|
112
|
+
if (!event.currentTarget.matches(':focus-visible')) return;
|
|
113
|
+
updateActivity({
|
|
114
|
+
focused: true
|
|
115
|
+
});
|
|
116
|
+
if (hasPreview) setPreviewOpen(true);
|
|
117
|
+
},
|
|
118
|
+
onBlur: (event)=>{
|
|
119
|
+
onBlur?.(event);
|
|
120
|
+
dismissed.current = false;
|
|
121
|
+
updateActivity({
|
|
122
|
+
focused: false
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
onPointerEnter: (event)=>{
|
|
126
|
+
onPointerEnter?.(event);
|
|
127
|
+
updateActivity({
|
|
128
|
+
hovered: true
|
|
129
|
+
});
|
|
130
|
+
},
|
|
131
|
+
onPointerLeave: (event)=>{
|
|
132
|
+
onPointerLeave?.(event);
|
|
133
|
+
dismissed.current = false;
|
|
134
|
+
updateActivity({
|
|
135
|
+
hovered: false
|
|
136
|
+
});
|
|
137
|
+
},
|
|
138
|
+
...props,
|
|
139
|
+
children: children ?? index
|
|
140
|
+
});
|
|
141
|
+
if (!hasPreview) return button;
|
|
142
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_hover_card_cjs_namespaceObject.HoverCard, {
|
|
143
|
+
open: open,
|
|
144
|
+
onOpenChange: setPreviewOpen,
|
|
145
|
+
openDelay: 300,
|
|
146
|
+
closeDelay: 150,
|
|
147
|
+
children: [
|
|
148
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_hover_card_cjs_namespaceObject.HoverCardTrigger, {
|
|
149
|
+
asChild: true,
|
|
150
|
+
children: button
|
|
151
|
+
}),
|
|
152
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_hover_card_cjs_namespaceObject.HoverCardContent, {
|
|
153
|
+
"data-slot": "citation-preview",
|
|
154
|
+
side: previewSide,
|
|
155
|
+
className: "flex w-72 flex-col gap-1 p-3 text-sm",
|
|
156
|
+
children: [
|
|
157
|
+
source && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
158
|
+
"data-slot": "citation-source",
|
|
159
|
+
className: "truncate text-xs text-muted-foreground",
|
|
160
|
+
children: source
|
|
161
|
+
}),
|
|
162
|
+
title && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
163
|
+
"data-slot": "citation-title",
|
|
164
|
+
className: "line-clamp-2 font-medium",
|
|
165
|
+
children: title
|
|
166
|
+
}),
|
|
167
|
+
snippet && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
168
|
+
"data-slot": "citation-snippet",
|
|
169
|
+
className: "line-clamp-3 text-xs leading-relaxed text-muted-foreground",
|
|
170
|
+
children: snippet
|
|
171
|
+
})
|
|
172
|
+
]
|
|
173
|
+
})
|
|
174
|
+
]
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
Citation.displayName = 'Citation';
|
|
178
|
+
exports.Citation = __webpack_exports__.Citation;
|
|
179
|
+
exports.DEFAULT_CITATION_STRINGS = __webpack_exports__.DEFAULT_CITATION_STRINGS;
|
|
180
|
+
exports.citationVariants = __webpack_exports__.citationVariants;
|
|
181
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
182
|
+
"Citation",
|
|
183
|
+
"DEFAULT_CITATION_STRINGS",
|
|
184
|
+
"citationVariants"
|
|
185
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
186
|
+
Object.defineProperty(exports, '__esModule', {
|
|
187
|
+
value: true
|
|
188
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { HoverCardContent } from './hover-card';
|
|
4
|
+
/**
|
|
5
|
+
* An inline citation marker for chat prose, with a hover and focus preview of the source. It does
|
|
6
|
+
* not navigate on its own: `onSelect` receives the citation and the event, so a host can run its
|
|
7
|
+
* `citation-click` pre-hook and decide whether to open `href`. The payload drops an `href` that is
|
|
8
|
+
* not http(s), mailto, tel or relative, so it is safe to open.
|
|
9
|
+
*/
|
|
10
|
+
export interface CitationData {
|
|
11
|
+
/** The source number, usually 1-based. Shown in the pill unless `children` are given. */
|
|
12
|
+
index: number | string;
|
|
13
|
+
title?: string;
|
|
14
|
+
snippet?: string;
|
|
15
|
+
/** Where it came from: a domain, a file name or a page reference. */
|
|
16
|
+
source?: string;
|
|
17
|
+
href?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface CitationStrings {
|
|
20
|
+
/** Accessible name of the pill. */
|
|
21
|
+
label: (index: string, title?: string) => string;
|
|
22
|
+
}
|
|
23
|
+
export declare const DEFAULT_CITATION_STRINGS: CitationStrings;
|
|
24
|
+
declare const citationVariants: (props?: ({
|
|
25
|
+
size?: "default" | "lg" | "sm" | null | undefined;
|
|
26
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
27
|
+
export interface CitationProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onSelect' | 'title'>, CitationData, VariantProps<typeof citationVariants> {
|
|
28
|
+
onSelect?: (citation: CitationData, event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
29
|
+
/** Set false to skip the preview card even when there is content for it. */
|
|
30
|
+
preview?: boolean;
|
|
31
|
+
previewSide?: React.ComponentPropsWithoutRef<typeof HoverCardContent>['side'];
|
|
32
|
+
/**
|
|
33
|
+
* Called when the citation becomes active or inactive, so a host can mark the cited text. It
|
|
34
|
+
* activates at once on hover or keyboard focus, and deactivates once neither applies and its
|
|
35
|
+
* preview, if shown, has closed. The preview's close delay means one citation can deactivate after the next
|
|
36
|
+
* activates. Also called with `false` if it unmounts active.
|
|
37
|
+
*/
|
|
38
|
+
onActiveChange?: (active: boolean) => void;
|
|
39
|
+
strings?: Partial<CitationStrings>;
|
|
40
|
+
}
|
|
41
|
+
declare const Citation: React.ForwardRefExoticComponent<CitationProps & React.RefAttributes<HTMLButtonElement>>;
|
|
42
|
+
export { Citation, citationVariants };
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { forwardRef, useEffect, useRef, useState } from "react";
|
|
5
|
+
import { cn, safeHref } from "../../lib/index.js";
|
|
6
|
+
import { HoverCard, HoverCardContent, HoverCardTrigger } from "./hover-card.js";
|
|
7
|
+
const DEFAULT_CITATION_STRINGS = {
|
|
8
|
+
label: (index, title)=>title ? `Citation ${index}: ${title}` : `Citation ${index}`
|
|
9
|
+
};
|
|
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
|
+
variants: {
|
|
12
|
+
size: {
|
|
13
|
+
default: 'h-4.5 min-w-4.5 px-1.5 text-[11px]',
|
|
14
|
+
sm: 'h-4 min-w-4 px-1 text-[10px]',
|
|
15
|
+
lg: 'h-5 min-w-5 px-1.5 text-xs'
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
size: 'default'
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const Citation = /*#__PURE__*/ forwardRef(({ className, size = 'default', index, title, snippet, source, href, onSelect, onClick, onFocus, onBlur, onPointerEnter, onPointerLeave, preview = true, previewSide = 'top', onActiveChange, strings, 'aria-label': ariaLabel, children, ...props }, ref)=>{
|
|
23
|
+
const text = {
|
|
24
|
+
...DEFAULT_CITATION_STRINGS,
|
|
25
|
+
...strings
|
|
26
|
+
};
|
|
27
|
+
const [open, setOpen] = useState(false);
|
|
28
|
+
const activity = useRef({
|
|
29
|
+
hovered: false,
|
|
30
|
+
focused: false,
|
|
31
|
+
previewOpen: false
|
|
32
|
+
});
|
|
33
|
+
const active = useRef(false);
|
|
34
|
+
const onActiveChangeRef = useRef(onActiveChange);
|
|
35
|
+
onActiveChangeRef.current = onActiveChange;
|
|
36
|
+
const updateActivity = (patch)=>{
|
|
37
|
+
Object.assign(activity.current, patch);
|
|
38
|
+
const { hovered, focused, previewOpen } = activity.current;
|
|
39
|
+
const next = hovered || focused || previewOpen;
|
|
40
|
+
if (next === active.current) return;
|
|
41
|
+
active.current = next;
|
|
42
|
+
onActiveChangeRef.current?.(next);
|
|
43
|
+
};
|
|
44
|
+
const dismissed = useRef(false);
|
|
45
|
+
const setPreviewOpen = (next)=>{
|
|
46
|
+
if (next && dismissed.current) return;
|
|
47
|
+
setOpen(next);
|
|
48
|
+
updateActivity({
|
|
49
|
+
previewOpen: next
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
useEffect(()=>()=>{
|
|
53
|
+
if (active.current) onActiveChangeRef.current?.(false);
|
|
54
|
+
}, []);
|
|
55
|
+
const name = ariaLabel ?? text.label(String(index), title || void 0);
|
|
56
|
+
const hasPreview = preview && Boolean(title || snippet || source);
|
|
57
|
+
const button = /*#__PURE__*/ jsx("button", {
|
|
58
|
+
ref: ref,
|
|
59
|
+
type: "button",
|
|
60
|
+
"data-slot": "citation",
|
|
61
|
+
"data-size": size,
|
|
62
|
+
"aria-label": name,
|
|
63
|
+
className: cn(citationVariants({
|
|
64
|
+
size
|
|
65
|
+
}), className),
|
|
66
|
+
onClick: (event)=>{
|
|
67
|
+
onClick?.(event);
|
|
68
|
+
if (hasPreview) {
|
|
69
|
+
dismissed.current = true;
|
|
70
|
+
setPreviewOpen(false);
|
|
71
|
+
}
|
|
72
|
+
if (!event.defaultPrevented) onSelect?.({
|
|
73
|
+
index,
|
|
74
|
+
title,
|
|
75
|
+
snippet,
|
|
76
|
+
source,
|
|
77
|
+
href: safeHref(href)
|
|
78
|
+
}, event);
|
|
79
|
+
},
|
|
80
|
+
onFocus: (event)=>{
|
|
81
|
+
onFocus?.(event);
|
|
82
|
+
if (!event.currentTarget.matches(':focus-visible')) return;
|
|
83
|
+
updateActivity({
|
|
84
|
+
focused: true
|
|
85
|
+
});
|
|
86
|
+
if (hasPreview) setPreviewOpen(true);
|
|
87
|
+
},
|
|
88
|
+
onBlur: (event)=>{
|
|
89
|
+
onBlur?.(event);
|
|
90
|
+
dismissed.current = false;
|
|
91
|
+
updateActivity({
|
|
92
|
+
focused: false
|
|
93
|
+
});
|
|
94
|
+
},
|
|
95
|
+
onPointerEnter: (event)=>{
|
|
96
|
+
onPointerEnter?.(event);
|
|
97
|
+
updateActivity({
|
|
98
|
+
hovered: true
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
onPointerLeave: (event)=>{
|
|
102
|
+
onPointerLeave?.(event);
|
|
103
|
+
dismissed.current = false;
|
|
104
|
+
updateActivity({
|
|
105
|
+
hovered: false
|
|
106
|
+
});
|
|
107
|
+
},
|
|
108
|
+
...props,
|
|
109
|
+
children: children ?? index
|
|
110
|
+
});
|
|
111
|
+
if (!hasPreview) return button;
|
|
112
|
+
return /*#__PURE__*/ jsxs(HoverCard, {
|
|
113
|
+
open: open,
|
|
114
|
+
onOpenChange: setPreviewOpen,
|
|
115
|
+
openDelay: 300,
|
|
116
|
+
closeDelay: 150,
|
|
117
|
+
children: [
|
|
118
|
+
/*#__PURE__*/ jsx(HoverCardTrigger, {
|
|
119
|
+
asChild: true,
|
|
120
|
+
children: button
|
|
121
|
+
}),
|
|
122
|
+
/*#__PURE__*/ jsxs(HoverCardContent, {
|
|
123
|
+
"data-slot": "citation-preview",
|
|
124
|
+
side: previewSide,
|
|
125
|
+
className: "flex w-72 flex-col gap-1 p-3 text-sm",
|
|
126
|
+
children: [
|
|
127
|
+
source && /*#__PURE__*/ jsx("span", {
|
|
128
|
+
"data-slot": "citation-source",
|
|
129
|
+
className: "truncate text-xs text-muted-foreground",
|
|
130
|
+
children: source
|
|
131
|
+
}),
|
|
132
|
+
title && /*#__PURE__*/ jsx("span", {
|
|
133
|
+
"data-slot": "citation-title",
|
|
134
|
+
className: "line-clamp-2 font-medium",
|
|
135
|
+
children: title
|
|
136
|
+
}),
|
|
137
|
+
snippet && /*#__PURE__*/ jsx("span", {
|
|
138
|
+
"data-slot": "citation-snippet",
|
|
139
|
+
className: "line-clamp-3 text-xs leading-relaxed text-muted-foreground",
|
|
140
|
+
children: snippet
|
|
141
|
+
})
|
|
142
|
+
]
|
|
143
|
+
})
|
|
144
|
+
]
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
Citation.displayName = 'Citation';
|
|
148
|
+
export { Citation, DEFAULT_CITATION_STRINGS, citationVariants };
|