@uipath/apollo-wind 2.69.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/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 +280 -214
- package/dist/components/ui/index.d.ts +6 -0
- package/dist/components/ui/index.js +6 -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/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/index.cjs +117 -6
- package/dist/index.d.ts +12 -0
- package/dist/index.js +7 -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 +157 -35
- package/package.json +1 -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
|
@@ -32,6 +32,7 @@ const external_lucide_react_namespaceObject = require("lucide-react");
|
|
|
32
32
|
const external_react_namespaceObject = require("react");
|
|
33
33
|
const external_button_cjs_namespaceObject = require("./button.cjs");
|
|
34
34
|
const index_cjs_namespaceObject = require("../../lib/index.cjs");
|
|
35
|
+
const external_file_validation_cjs_namespaceObject = require("./file-validation.cjs");
|
|
35
36
|
const external_form_field_cjs_namespaceObject = require("./form-field.cjs");
|
|
36
37
|
const file_upload_FileUpload = /*#__PURE__*/ external_react_namespaceObject.forwardRef(function({ id, ariaLabel, onFilesChange, accept, multiple = false, disabled = false, maxSize, className, showPreview = false, errors, onBlur, error, errorId, 'aria-invalid': ariaInvalid, 'aria-describedby': ariaDescribedBy, 'aria-errormessage': ariaErrorMessage }, ref) {
|
|
37
38
|
const generatedId = external_react_namespaceObject.useId();
|
|
@@ -47,31 +48,18 @@ const file_upload_FileUpload = /*#__PURE__*/ external_react_namespaceObject.forw
|
|
|
47
48
|
const [fileErrors, setFileErrors] = external_react_namespaceObject.useState(new Map());
|
|
48
49
|
const [previews, setPreviews] = external_react_namespaceObject.useState([]);
|
|
49
50
|
const inputRef = external_react_namespaceObject.useRef(null);
|
|
50
|
-
const isFileTypeAccepted = (file)=>{
|
|
51
|
-
if (!accept) return true;
|
|
52
|
-
const acceptedTypes = accept.split(',').map((type)=>type.trim().toLowerCase());
|
|
53
|
-
for (const acceptedType of acceptedTypes)if (acceptedType.endsWith('/*')) {
|
|
54
|
-
const baseType = acceptedType.slice(0, -2);
|
|
55
|
-
if (file.type.toLowerCase().startsWith(baseType)) return true;
|
|
56
|
-
} else if (acceptedType.includes('/')) {
|
|
57
|
-
if (file.type.toLowerCase() === acceptedType) return true;
|
|
58
|
-
} else if (acceptedType.startsWith('.')) {
|
|
59
|
-
if (file.name.toLowerCase().endsWith(acceptedType)) return true;
|
|
60
|
-
}
|
|
61
|
-
return false;
|
|
62
|
-
};
|
|
63
51
|
const validateFiles = (fileList, startIndex, existingErrors)=>{
|
|
64
52
|
const validFiles = [];
|
|
65
53
|
const errors = multiple ? new Map(existingErrors) : new Map();
|
|
66
54
|
for (const file of fileList){
|
|
67
55
|
const fileIndex = startIndex + validFiles.length;
|
|
68
|
-
if (!isFileTypeAccepted(file)) {
|
|
56
|
+
if (!(0, external_file_validation_cjs_namespaceObject.isFileTypeAccepted)(file, accept)) {
|
|
69
57
|
errors.set(fileIndex, 'File type not accepted');
|
|
70
58
|
validFiles.push(file);
|
|
71
59
|
continue;
|
|
72
60
|
}
|
|
73
61
|
if (maxSize && file.size > maxSize) {
|
|
74
|
-
errors.set(fileIndex, `Exceeds maximum size of ${formatFileSize(maxSize)}`);
|
|
62
|
+
errors.set(fileIndex, `Exceeds maximum size of ${(0, external_file_validation_cjs_namespaceObject.formatFileSize)(maxSize)}`);
|
|
75
63
|
validFiles.push(file);
|
|
76
64
|
continue;
|
|
77
65
|
}
|
|
@@ -157,18 +145,6 @@ const file_upload_FileUpload = /*#__PURE__*/ external_react_namespaceObject.forw
|
|
|
157
145
|
const handleClick = ()=>{
|
|
158
146
|
if (!disabled) inputRef.current?.click();
|
|
159
147
|
};
|
|
160
|
-
const formatFileSize = (bytes)=>{
|
|
161
|
-
if (0 === bytes) return '0 Bytes';
|
|
162
|
-
const k = 1024;
|
|
163
|
-
const sizes = [
|
|
164
|
-
'Bytes',
|
|
165
|
-
'KB',
|
|
166
|
-
'MB',
|
|
167
|
-
'GB'
|
|
168
|
-
];
|
|
169
|
-
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
170
|
-
return `${Math.round(bytes / k ** i * 100) / 100} ${sizes[i]}`;
|
|
171
|
-
};
|
|
172
148
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("fieldset", {
|
|
173
149
|
ref: ref,
|
|
174
150
|
"data-slot": "file-upload",
|
|
@@ -233,7 +209,7 @@ const file_upload_FileUpload = /*#__PURE__*/ external_react_namespaceObject.forw
|
|
|
233
209
|
className: "text-xs text-muted-foreground future:text-foreground-muted",
|
|
234
210
|
children: [
|
|
235
211
|
"Max size: ",
|
|
236
|
-
formatFileSize(maxSize)
|
|
212
|
+
(0, external_file_validation_cjs_namespaceObject.formatFileSize)(maxSize)
|
|
237
213
|
]
|
|
238
214
|
})
|
|
239
215
|
]
|
|
@@ -269,7 +245,7 @@ const file_upload_FileUpload = /*#__PURE__*/ external_react_namespaceObject.forw
|
|
|
269
245
|
}),
|
|
270
246
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("p", {
|
|
271
247
|
className: "text-xs text-muted-foreground",
|
|
272
|
-
children: formatFileSize(file.size)
|
|
248
|
+
children: (0, external_file_validation_cjs_namespaceObject.formatFileSize)(file.size)
|
|
273
249
|
})
|
|
274
250
|
]
|
|
275
251
|
})
|
|
@@ -4,6 +4,7 @@ import { Upload, X } from "lucide-react";
|
|
|
4
4
|
import { forwardRef, useId, useRef, useState } from "react";
|
|
5
5
|
import { Button } from "./button.js";
|
|
6
6
|
import { cn } from "../../lib/index.js";
|
|
7
|
+
import { formatFileSize, isFileTypeAccepted } from "./file-validation.js";
|
|
7
8
|
import { FormFieldError } from "./form-field.js";
|
|
8
9
|
const file_upload_FileUpload = /*#__PURE__*/ forwardRef(function({ id, ariaLabel, onFilesChange, accept, multiple = false, disabled = false, maxSize, className, showPreview = false, errors, onBlur, error, errorId, 'aria-invalid': ariaInvalid, 'aria-describedby': ariaDescribedBy, 'aria-errormessage': ariaErrorMessage }, ref) {
|
|
9
10
|
const generatedId = useId();
|
|
@@ -19,25 +20,12 @@ const file_upload_FileUpload = /*#__PURE__*/ forwardRef(function({ id, ariaLabel
|
|
|
19
20
|
const [fileErrors, setFileErrors] = useState(new Map());
|
|
20
21
|
const [previews, setPreviews] = useState([]);
|
|
21
22
|
const inputRef = useRef(null);
|
|
22
|
-
const isFileTypeAccepted = (file)=>{
|
|
23
|
-
if (!accept) return true;
|
|
24
|
-
const acceptedTypes = accept.split(',').map((type)=>type.trim().toLowerCase());
|
|
25
|
-
for (const acceptedType of acceptedTypes)if (acceptedType.endsWith('/*')) {
|
|
26
|
-
const baseType = acceptedType.slice(0, -2);
|
|
27
|
-
if (file.type.toLowerCase().startsWith(baseType)) return true;
|
|
28
|
-
} else if (acceptedType.includes('/')) {
|
|
29
|
-
if (file.type.toLowerCase() === acceptedType) return true;
|
|
30
|
-
} else if (acceptedType.startsWith('.')) {
|
|
31
|
-
if (file.name.toLowerCase().endsWith(acceptedType)) return true;
|
|
32
|
-
}
|
|
33
|
-
return false;
|
|
34
|
-
};
|
|
35
23
|
const validateFiles = (fileList, startIndex, existingErrors)=>{
|
|
36
24
|
const validFiles = [];
|
|
37
25
|
const errors = multiple ? new Map(existingErrors) : new Map();
|
|
38
26
|
for (const file of fileList){
|
|
39
27
|
const fileIndex = startIndex + validFiles.length;
|
|
40
|
-
if (!isFileTypeAccepted(file)) {
|
|
28
|
+
if (!isFileTypeAccepted(file, accept)) {
|
|
41
29
|
errors.set(fileIndex, 'File type not accepted');
|
|
42
30
|
validFiles.push(file);
|
|
43
31
|
continue;
|
|
@@ -129,18 +117,6 @@ const file_upload_FileUpload = /*#__PURE__*/ forwardRef(function({ id, ariaLabel
|
|
|
129
117
|
const handleClick = ()=>{
|
|
130
118
|
if (!disabled) inputRef.current?.click();
|
|
131
119
|
};
|
|
132
|
-
const formatFileSize = (bytes)=>{
|
|
133
|
-
if (0 === bytes) return '0 Bytes';
|
|
134
|
-
const k = 1024;
|
|
135
|
-
const sizes = [
|
|
136
|
-
'Bytes',
|
|
137
|
-
'KB',
|
|
138
|
-
'MB',
|
|
139
|
-
'GB'
|
|
140
|
-
];
|
|
141
|
-
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
142
|
-
return `${Math.round(bytes / k ** i * 100) / 100} ${sizes[i]}`;
|
|
143
|
-
};
|
|
144
120
|
return /*#__PURE__*/ jsxs("fieldset", {
|
|
145
121
|
ref: ref,
|
|
146
122
|
"data-slot": "file-upload",
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
formatFileSize: ()=>formatFileSize,
|
|
28
|
+
isFileTypeAccepted: ()=>isFileTypeAccepted,
|
|
29
|
+
validateFiles: ()=>validateFiles
|
|
30
|
+
});
|
|
31
|
+
function acceptEntries(accept) {
|
|
32
|
+
const list = Array.isArray(accept) ? accept : accept.split(',');
|
|
33
|
+
return list.map((entry)=>entry.trim().toLowerCase()).filter(Boolean);
|
|
34
|
+
}
|
|
35
|
+
function isFileTypeAccepted(file, accept) {
|
|
36
|
+
if (!accept) return true;
|
|
37
|
+
const entries = acceptEntries(accept);
|
|
38
|
+
if (0 === entries.length) return true;
|
|
39
|
+
const type = file.type.toLowerCase();
|
|
40
|
+
const name = file.name.toLowerCase();
|
|
41
|
+
return entries.some((entry)=>{
|
|
42
|
+
if (entry.endsWith('/*')) return type.startsWith(entry.slice(0, -1));
|
|
43
|
+
if (entry.includes('/')) return type === entry;
|
|
44
|
+
if (entry.startsWith('.')) return name.endsWith(entry);
|
|
45
|
+
return false;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function validateFiles(files, { accept, maxSize, maxFiles } = {}) {
|
|
49
|
+
const accepted = [];
|
|
50
|
+
const rejected = [];
|
|
51
|
+
for (const file of files)if (isFileTypeAccepted(file, accept)) if (void 0 !== maxSize && file.size > maxSize) rejected.push({
|
|
52
|
+
file,
|
|
53
|
+
reason: 'size'
|
|
54
|
+
});
|
|
55
|
+
else if (void 0 !== maxFiles && accepted.length >= maxFiles) rejected.push({
|
|
56
|
+
file,
|
|
57
|
+
reason: 'count'
|
|
58
|
+
});
|
|
59
|
+
else accepted.push(file);
|
|
60
|
+
else rejected.push({
|
|
61
|
+
file,
|
|
62
|
+
reason: 'type'
|
|
63
|
+
});
|
|
64
|
+
return {
|
|
65
|
+
accepted,
|
|
66
|
+
rejected
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function formatFileSize(bytes) {
|
|
70
|
+
if (0 === bytes) return '0 Bytes';
|
|
71
|
+
const k = 1024;
|
|
72
|
+
const sizes = [
|
|
73
|
+
'Bytes',
|
|
74
|
+
'KB',
|
|
75
|
+
'MB',
|
|
76
|
+
'GB'
|
|
77
|
+
];
|
|
78
|
+
const i = Math.min(Math.floor(Math.log(bytes) / Math.log(k)), sizes.length - 1);
|
|
79
|
+
return `${Math.round(bytes / k ** i * 100) / 100} ${sizes[i]}`;
|
|
80
|
+
}
|
|
81
|
+
exports.formatFileSize = __webpack_exports__.formatFileSize;
|
|
82
|
+
exports.isFileTypeAccepted = __webpack_exports__.isFileTypeAccepted;
|
|
83
|
+
exports.validateFiles = __webpack_exports__.validateFiles;
|
|
84
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
85
|
+
"formatFileSize",
|
|
86
|
+
"isFileTypeAccepted",
|
|
87
|
+
"validateFiles"
|
|
88
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
89
|
+
Object.defineProperty(exports, '__esModule', {
|
|
90
|
+
value: true
|
|
91
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File checks shared by FileUpload, ChatComposerAttachButton and DropzoneOverlay. `accept` matches
|
|
3
|
+
* MIME wildcards (`image/*`), exact MIME types (`image/png`) and extensions (`.pdf`).
|
|
4
|
+
*/
|
|
5
|
+
export type FileRejectionReason = 'type' | 'size' | 'count';
|
|
6
|
+
export interface FileRejection {
|
|
7
|
+
file: File;
|
|
8
|
+
reason: FileRejectionReason;
|
|
9
|
+
}
|
|
10
|
+
export interface FileValidationOptions {
|
|
11
|
+
/** A comma-separated `accept` string, or a list of its entries. Omit to accept any type. */
|
|
12
|
+
accept?: string | string[];
|
|
13
|
+
/** Largest accepted size, in bytes. */
|
|
14
|
+
maxSize?: number;
|
|
15
|
+
/** Most files accepted in one batch; the rest are rejected with `count`. */
|
|
16
|
+
maxFiles?: number;
|
|
17
|
+
}
|
|
18
|
+
export declare function isFileTypeAccepted(file: File, accept?: string | string[]): boolean;
|
|
19
|
+
/** Splits a batch into accepted files and rejections, checking type, then size, then count. */
|
|
20
|
+
export declare function validateFiles(files: File[], { accept, maxSize, maxFiles }?: FileValidationOptions): {
|
|
21
|
+
accepted: File[];
|
|
22
|
+
rejected: FileRejection[];
|
|
23
|
+
};
|
|
24
|
+
export declare function formatFileSize(bytes: number): string;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
function acceptEntries(accept) {
|
|
2
|
+
const list = Array.isArray(accept) ? accept : accept.split(',');
|
|
3
|
+
return list.map((entry)=>entry.trim().toLowerCase()).filter(Boolean);
|
|
4
|
+
}
|
|
5
|
+
function isFileTypeAccepted(file, accept) {
|
|
6
|
+
if (!accept) return true;
|
|
7
|
+
const entries = acceptEntries(accept);
|
|
8
|
+
if (0 === entries.length) return true;
|
|
9
|
+
const type = file.type.toLowerCase();
|
|
10
|
+
const name = file.name.toLowerCase();
|
|
11
|
+
return entries.some((entry)=>{
|
|
12
|
+
if (entry.endsWith('/*')) return type.startsWith(entry.slice(0, -1));
|
|
13
|
+
if (entry.includes('/')) return type === entry;
|
|
14
|
+
if (entry.startsWith('.')) return name.endsWith(entry);
|
|
15
|
+
return false;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function validateFiles(files, { accept, maxSize, maxFiles } = {}) {
|
|
19
|
+
const accepted = [];
|
|
20
|
+
const rejected = [];
|
|
21
|
+
for (const file of files)if (isFileTypeAccepted(file, accept)) if (void 0 !== maxSize && file.size > maxSize) rejected.push({
|
|
22
|
+
file,
|
|
23
|
+
reason: 'size'
|
|
24
|
+
});
|
|
25
|
+
else if (void 0 !== maxFiles && accepted.length >= maxFiles) rejected.push({
|
|
26
|
+
file,
|
|
27
|
+
reason: 'count'
|
|
28
|
+
});
|
|
29
|
+
else accepted.push(file);
|
|
30
|
+
else rejected.push({
|
|
31
|
+
file,
|
|
32
|
+
reason: 'type'
|
|
33
|
+
});
|
|
34
|
+
return {
|
|
35
|
+
accepted,
|
|
36
|
+
rejected
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function formatFileSize(bytes) {
|
|
40
|
+
if (0 === bytes) return '0 Bytes';
|
|
41
|
+
const k = 1024;
|
|
42
|
+
const sizes = [
|
|
43
|
+
'Bytes',
|
|
44
|
+
'KB',
|
|
45
|
+
'MB',
|
|
46
|
+
'GB'
|
|
47
|
+
];
|
|
48
|
+
const i = Math.min(Math.floor(Math.log(bytes) / Math.log(k)), sizes.length - 1);
|
|
49
|
+
return `${Math.round(bytes / k ** i * 100) / 100} ${sizes[i]}`;
|
|
50
|
+
}
|
|
51
|
+
export { formatFileSize, isFileTypeAccepted, validateFiles };
|
|
@@ -31,6 +31,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
31
31
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
32
32
|
const react_hover_card_namespaceObject = require("@radix-ui/react-hover-card");
|
|
33
33
|
const external_react_namespaceObject = require("react");
|
|
34
|
+
const external_portal_container_cjs_namespaceObject = require("./portal-container.cjs");
|
|
34
35
|
const index_cjs_namespaceObject = require("../../lib/index.cjs");
|
|
35
36
|
const HoverCard = (props)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_hover_card_namespaceObject.Root, {
|
|
36
37
|
"data-slot": "hover-card",
|
|
@@ -43,14 +44,20 @@ const HoverCardTrigger = /*#__PURE__*/ external_react_namespaceObject.forwardRef
|
|
|
43
44
|
...props
|
|
44
45
|
}));
|
|
45
46
|
HoverCardTrigger.displayName = react_hover_card_namespaceObject.Trigger.displayName;
|
|
46
|
-
const HoverCardContent = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, align = 'center', sideOffset = 4, ...props }, ref)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
const HoverCardContent = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, align = 'center', sideOffset = 4, container, ...props }, ref)=>{
|
|
48
|
+
const resolvedContainer = (0, external_portal_container_cjs_namespaceObject.useResolvedPortalContainer)(container);
|
|
49
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_hover_card_namespaceObject.Portal, {
|
|
50
|
+
container: resolvedContainer,
|
|
51
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_hover_card_namespaceObject.Content, {
|
|
52
|
+
ref: ref,
|
|
53
|
+
"data-slot": "hover-card-content",
|
|
54
|
+
align: align,
|
|
55
|
+
sideOffset: sideOffset,
|
|
56
|
+
className: (0, index_cjs_namespaceObject.cn)('z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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-hover-card-content-transform-origin]', className),
|
|
57
|
+
...props
|
|
58
|
+
})
|
|
59
|
+
});
|
|
60
|
+
});
|
|
54
61
|
HoverCardContent.displayName = react_hover_card_namespaceObject.Content.displayName;
|
|
55
62
|
exports.HoverCard = __webpack_exports__.HoverCard;
|
|
56
63
|
exports.HoverCardContent = __webpack_exports__.HoverCardContent;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import * as HoverCardPrimitive from '@radix-ui/react-hover-card';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import { type PortalContainerOverride } from './portal-container';
|
|
3
4
|
declare const HoverCard: {
|
|
4
5
|
(props: React.ComponentPropsWithoutRef<typeof HoverCardPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
5
6
|
displayName: string;
|
|
6
7
|
};
|
|
7
8
|
declare const HoverCardTrigger: React.ForwardRefExoticComponent<Omit<HoverCardPrimitive.HoverCardTriggerProps & React.RefAttributes<HTMLAnchorElement>, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
|
|
8
|
-
declare const HoverCardContent: React.ForwardRefExoticComponent<Omit<HoverCardPrimitive.HoverCardContentProps & React.RefAttributes<HTMLDivElement>, "ref"> &
|
|
9
|
+
declare const HoverCardContent: React.ForwardRefExoticComponent<Omit<HoverCardPrimitive.HoverCardContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
10
|
+
container?: PortalContainerOverride;
|
|
11
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
9
12
|
export { HoverCard, HoverCardTrigger, HoverCardContent };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Content, Root, Trigger } from "@radix-ui/react-hover-card";
|
|
2
|
+
import { Content, Portal, Root, Trigger } from "@radix-ui/react-hover-card";
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
|
+
import { useResolvedPortalContainer } from "./portal-container.js";
|
|
4
5
|
import { cn } from "../../lib/index.js";
|
|
5
6
|
const HoverCard = (props)=>/*#__PURE__*/ jsx(Root, {
|
|
6
7
|
"data-slot": "hover-card",
|
|
@@ -13,13 +14,19 @@ const HoverCardTrigger = /*#__PURE__*/ forwardRef((props, ref)=>/*#__PURE__*/ js
|
|
|
13
14
|
...props
|
|
14
15
|
}));
|
|
15
16
|
HoverCardTrigger.displayName = Trigger.displayName;
|
|
16
|
-
const HoverCardContent = /*#__PURE__*/ forwardRef(({ className, align = 'center', sideOffset = 4, ...props }, ref)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
const HoverCardContent = /*#__PURE__*/ forwardRef(({ className, align = 'center', sideOffset = 4, container, ...props }, ref)=>{
|
|
18
|
+
const resolvedContainer = useResolvedPortalContainer(container);
|
|
19
|
+
return /*#__PURE__*/ jsx(Portal, {
|
|
20
|
+
container: resolvedContainer,
|
|
21
|
+
children: /*#__PURE__*/ jsx(Content, {
|
|
22
|
+
ref: ref,
|
|
23
|
+
"data-slot": "hover-card-content",
|
|
24
|
+
align: align,
|
|
25
|
+
sideOffset: sideOffset,
|
|
26
|
+
className: cn('z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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-hover-card-content-transform-origin]', className),
|
|
27
|
+
...props
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
});
|
|
24
31
|
HoverCardContent.displayName = Content.displayName;
|
|
25
32
|
export { HoverCard, HoverCardContent, HoverCardTrigger };
|