@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
|
@@ -44,6 +44,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
44
44
|
DialogContent: ()=>dialog_DialogContent,
|
|
45
45
|
ModalClose: ()=>ModalClose,
|
|
46
46
|
ModalHeader: ()=>ModalHeader,
|
|
47
|
+
DEFAULT_DIALOG_STRINGS: ()=>DEFAULT_DIALOG_STRINGS,
|
|
47
48
|
ModalFooter: ()=>ModalFooter
|
|
48
49
|
});
|
|
49
50
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
@@ -55,6 +56,12 @@ const external_button_cjs_namespaceObject = require("./button.cjs");
|
|
|
55
56
|
const external_portal_container_cjs_namespaceObject = require("./portal-container.cjs");
|
|
56
57
|
const dialog_surface_cjs_namespaceObject = require("../../lib/dialog-surface.cjs");
|
|
57
58
|
const index_cjs_namespaceObject = require("../../lib/index.cjs");
|
|
59
|
+
const DEFAULT_DIALOG_STRINGS = {
|
|
60
|
+
close: 'Close',
|
|
61
|
+
closeTakeover: 'Close modal',
|
|
62
|
+
expand: 'Expand modal',
|
|
63
|
+
collapse: 'Collapse modal'
|
|
64
|
+
};
|
|
58
65
|
function Dialog({ ...props }) {
|
|
59
66
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_dialog_namespaceObject.Root, {
|
|
60
67
|
"data-slot": "dialog",
|
|
@@ -121,11 +128,15 @@ const dialog_DialogOverlay = /*#__PURE__*/ external_react_namespaceObject.forwar
|
|
|
121
128
|
...props
|
|
122
129
|
});
|
|
123
130
|
});
|
|
124
|
-
const dialog_DialogContent = /*#__PURE__*/ external_react_namespaceObject.forwardRef(function({ className, children, showCloseButton = true, container, variant = 'default', headerTitle, headerActions, sidebar, sidebarClassName, expanded: controlledExpanded, defaultExpanded = false, onExpandedChange, closeOnBackdropClick = true, overlayProps, overlayTestId, 'data-expanded': dataExpanded, 'aria-labelledby': ariaLabelledBy, onPointerDownOutside, ...props }, ref) {
|
|
131
|
+
const dialog_DialogContent = /*#__PURE__*/ external_react_namespaceObject.forwardRef(function({ className, children, showCloseButton = true, container, variant = 'default', headerTitle, headerActions, sidebar, sidebarClassName, expanded: controlledExpanded, defaultExpanded = false, onExpandedChange, closeOnBackdropClick = true, overlayProps, overlayTestId, 'data-expanded': dataExpanded, strings, 'aria-labelledby': ariaLabelledBy, onPointerDownOutside, ...props }, ref) {
|
|
125
132
|
const resolvedContainer = (0, external_portal_container_cjs_namespaceObject.useResolvedPortalContainer)(container);
|
|
126
133
|
const [uncontrolledExpanded, setUncontrolledExpanded] = external_react_namespaceObject.useState(defaultExpanded);
|
|
127
134
|
const expanded = controlledExpanded ?? uncontrolledExpanded;
|
|
128
135
|
const isTakeover = 'takeover' === variant;
|
|
136
|
+
const text = {
|
|
137
|
+
...DEFAULT_DIALOG_STRINGS,
|
|
138
|
+
...strings
|
|
139
|
+
};
|
|
129
140
|
const setExpanded = (nextExpanded)=>{
|
|
130
141
|
if (void 0 === controlledExpanded) setUncontrolledExpanded(nextExpanded);
|
|
131
142
|
onExpandedChange?.(nextExpanded);
|
|
@@ -173,8 +184,8 @@ const dialog_DialogContent = /*#__PURE__*/ external_react_namespaceObject.forwar
|
|
|
173
184
|
variant: "ghost",
|
|
174
185
|
size: "xs",
|
|
175
186
|
icon: true,
|
|
176
|
-
"aria-label": expanded ?
|
|
177
|
-
title: expanded ?
|
|
187
|
+
"aria-label": expanded ? text.collapse : text.expand,
|
|
188
|
+
title: expanded ? text.collapse : text.expand,
|
|
178
189
|
onClick: ()=>setExpanded(!expanded),
|
|
179
190
|
children: expanded ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Minimize2, {
|
|
180
191
|
size: 16
|
|
@@ -188,7 +199,7 @@ const dialog_DialogContent = /*#__PURE__*/ external_react_namespaceObject.forwar
|
|
|
188
199
|
variant: "ghost",
|
|
189
200
|
size: "xs",
|
|
190
201
|
icon: true,
|
|
191
|
-
"aria-label":
|
|
202
|
+
"aria-label": text.closeTakeover,
|
|
192
203
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.XIcon, {
|
|
193
204
|
size: 16
|
|
194
205
|
})
|
|
@@ -222,7 +233,7 @@ const dialog_DialogContent = /*#__PURE__*/ external_react_namespaceObject.forwar
|
|
|
222
233
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.XIcon, {}),
|
|
223
234
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
224
235
|
className: "sr-only",
|
|
225
|
-
children:
|
|
236
|
+
children: text.close
|
|
226
237
|
})
|
|
227
238
|
]
|
|
228
239
|
})
|
|
@@ -276,6 +287,7 @@ const ModalOverlay = dialog_DialogOverlay;
|
|
|
276
287
|
const ModalPortal = DialogPortal;
|
|
277
288
|
const ModalTitle = dialog_DialogTitle;
|
|
278
289
|
const ModalTrigger = dialog_DialogTrigger;
|
|
290
|
+
exports.DEFAULT_DIALOG_STRINGS = __webpack_exports__.DEFAULT_DIALOG_STRINGS;
|
|
279
291
|
exports.Dialog = __webpack_exports__.Dialog;
|
|
280
292
|
exports.DialogClose = __webpack_exports__.DialogClose;
|
|
281
293
|
exports.DialogContent = __webpack_exports__.DialogContent;
|
|
@@ -297,6 +309,7 @@ exports.ModalPortal = __webpack_exports__.ModalPortal;
|
|
|
297
309
|
exports.ModalTitle = __webpack_exports__.ModalTitle;
|
|
298
310
|
exports.ModalTrigger = __webpack_exports__.ModalTrigger;
|
|
299
311
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
312
|
+
"DEFAULT_DIALOG_STRINGS",
|
|
300
313
|
"Dialog",
|
|
301
314
|
"DialogClose",
|
|
302
315
|
"DialogContent",
|
|
@@ -2,6 +2,17 @@ import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
|
2
2
|
import { type VariantProps } from 'class-variance-authority';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { type PortalContainerOverride } from './portal-container';
|
|
5
|
+
export interface DialogStrings {
|
|
6
|
+
/** Screen reader label of the default dialog's close button. */
|
|
7
|
+
close: string;
|
|
8
|
+
/** Label of the takeover dialog's close button. */
|
|
9
|
+
closeTakeover: string;
|
|
10
|
+
/** Label of the takeover dialog's button that fills the viewport. */
|
|
11
|
+
expand: string;
|
|
12
|
+
/** Label of the takeover dialog's button that leaves the full viewport. */
|
|
13
|
+
collapse: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const DEFAULT_DIALOG_STRINGS: DialogStrings;
|
|
5
16
|
declare function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
6
17
|
declare const DialogTrigger: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
7
18
|
declare function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -25,6 +36,8 @@ declare const DialogContent: React.ForwardRefExoticComponent<Omit<DialogPrimitiv
|
|
|
25
36
|
overlayProps?: React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>;
|
|
26
37
|
overlayTestId?: string;
|
|
27
38
|
'data-expanded'?: boolean;
|
|
39
|
+
/** Overrides for any subset of the built-in button labels. */
|
|
40
|
+
strings?: Partial<DialogStrings>;
|
|
28
41
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
29
42
|
declare function DialogHeader({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
30
43
|
declare function DialogFooter({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -48,6 +61,8 @@ declare const ModalContent: React.ForwardRefExoticComponent<Omit<DialogPrimitive
|
|
|
48
61
|
overlayProps?: React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>;
|
|
49
62
|
overlayTestId?: string;
|
|
50
63
|
'data-expanded'?: boolean;
|
|
64
|
+
/** Overrides for any subset of the built-in button labels. */
|
|
65
|
+
strings?: Partial<DialogStrings>;
|
|
51
66
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
52
67
|
declare const ModalDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
53
68
|
declare const ModalFooter: typeof DialogFooter;
|
|
@@ -8,6 +8,12 @@ import { Button } from "./button.js";
|
|
|
8
8
|
import { useResolvedPortalContainer } from "./portal-container.js";
|
|
9
9
|
import { dialogSurfaceClassName } from "../../lib/dialog-surface.js";
|
|
10
10
|
import { cn } from "../../lib/index.js";
|
|
11
|
+
const DEFAULT_DIALOG_STRINGS = {
|
|
12
|
+
close: 'Close',
|
|
13
|
+
closeTakeover: 'Close modal',
|
|
14
|
+
expand: 'Expand modal',
|
|
15
|
+
collapse: 'Collapse modal'
|
|
16
|
+
};
|
|
11
17
|
function Dialog({ ...props }) {
|
|
12
18
|
return /*#__PURE__*/ jsx(Root, {
|
|
13
19
|
"data-slot": "dialog",
|
|
@@ -74,11 +80,15 @@ const dialog_DialogOverlay = /*#__PURE__*/ forwardRef(function({ className, ...p
|
|
|
74
80
|
...props
|
|
75
81
|
});
|
|
76
82
|
});
|
|
77
|
-
const dialog_DialogContent = /*#__PURE__*/ forwardRef(function({ className, children, showCloseButton = true, container, variant = 'default', headerTitle, headerActions, sidebar, sidebarClassName, expanded: controlledExpanded, defaultExpanded = false, onExpandedChange, closeOnBackdropClick = true, overlayProps, overlayTestId, 'data-expanded': dataExpanded, 'aria-labelledby': ariaLabelledBy, onPointerDownOutside, ...props }, ref) {
|
|
83
|
+
const dialog_DialogContent = /*#__PURE__*/ forwardRef(function({ className, children, showCloseButton = true, container, variant = 'default', headerTitle, headerActions, sidebar, sidebarClassName, expanded: controlledExpanded, defaultExpanded = false, onExpandedChange, closeOnBackdropClick = true, overlayProps, overlayTestId, 'data-expanded': dataExpanded, strings, 'aria-labelledby': ariaLabelledBy, onPointerDownOutside, ...props }, ref) {
|
|
78
84
|
const resolvedContainer = useResolvedPortalContainer(container);
|
|
79
85
|
const [uncontrolledExpanded, setUncontrolledExpanded] = useState(defaultExpanded);
|
|
80
86
|
const expanded = controlledExpanded ?? uncontrolledExpanded;
|
|
81
87
|
const isTakeover = 'takeover' === variant;
|
|
88
|
+
const text = {
|
|
89
|
+
...DEFAULT_DIALOG_STRINGS,
|
|
90
|
+
...strings
|
|
91
|
+
};
|
|
82
92
|
const setExpanded = (nextExpanded)=>{
|
|
83
93
|
if (void 0 === controlledExpanded) setUncontrolledExpanded(nextExpanded);
|
|
84
94
|
onExpandedChange?.(nextExpanded);
|
|
@@ -126,8 +136,8 @@ const dialog_DialogContent = /*#__PURE__*/ forwardRef(function({ className, chil
|
|
|
126
136
|
variant: "ghost",
|
|
127
137
|
size: "xs",
|
|
128
138
|
icon: true,
|
|
129
|
-
"aria-label": expanded ?
|
|
130
|
-
title: expanded ?
|
|
139
|
+
"aria-label": expanded ? text.collapse : text.expand,
|
|
140
|
+
title: expanded ? text.collapse : text.expand,
|
|
131
141
|
onClick: ()=>setExpanded(!expanded),
|
|
132
142
|
children: expanded ? /*#__PURE__*/ jsx(Minimize2, {
|
|
133
143
|
size: 16
|
|
@@ -141,7 +151,7 @@ const dialog_DialogContent = /*#__PURE__*/ forwardRef(function({ className, chil
|
|
|
141
151
|
variant: "ghost",
|
|
142
152
|
size: "xs",
|
|
143
153
|
icon: true,
|
|
144
|
-
"aria-label":
|
|
154
|
+
"aria-label": text.closeTakeover,
|
|
145
155
|
children: /*#__PURE__*/ jsx(XIcon, {
|
|
146
156
|
size: 16
|
|
147
157
|
})
|
|
@@ -175,7 +185,7 @@ const dialog_DialogContent = /*#__PURE__*/ forwardRef(function({ className, chil
|
|
|
175
185
|
/*#__PURE__*/ jsx(XIcon, {}),
|
|
176
186
|
/*#__PURE__*/ jsx("span", {
|
|
177
187
|
className: "sr-only",
|
|
178
|
-
children:
|
|
188
|
+
children: text.close
|
|
179
189
|
})
|
|
180
190
|
]
|
|
181
191
|
})
|
|
@@ -229,4 +239,4 @@ const ModalOverlay = dialog_DialogOverlay;
|
|
|
229
239
|
const ModalPortal = DialogPortal;
|
|
230
240
|
const ModalTitle = dialog_DialogTitle;
|
|
231
241
|
const ModalTrigger = dialog_DialogTrigger;
|
|
232
|
-
export { Dialog, dialog_DialogClose as DialogClose, dialog_DialogContent as DialogContent, dialog_DialogDescription as DialogDescription, DialogFooter, DialogHeader, dialog_DialogOverlay as DialogOverlay, DialogPortal, dialog_DialogTitle as DialogTitle, dialog_DialogTrigger as DialogTrigger, Modal, ModalClose, ModalContent, ModalDescription, ModalFooter, ModalHeader, ModalOverlay, ModalPortal, ModalTitle, ModalTrigger };
|
|
242
|
+
export { DEFAULT_DIALOG_STRINGS, Dialog, dialog_DialogClose as DialogClose, dialog_DialogContent as DialogContent, dialog_DialogDescription as DialogDescription, DialogFooter, DialogHeader, dialog_DialogOverlay as DialogOverlay, DialogPortal, dialog_DialogTitle as DialogTitle, dialog_DialogTrigger as DialogTrigger, Modal, ModalClose, ModalContent, ModalDescription, ModalFooter, ModalHeader, ModalOverlay, ModalPortal, ModalTitle, ModalTrigger };
|
|
@@ -0,0 +1,269 @@
|
|
|
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
|
+
DisclosureTree: ()=>DisclosureTree
|
|
29
|
+
});
|
|
30
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
31
|
+
const external_lucide_react_namespaceObject = require("lucide-react");
|
|
32
|
+
const external_react_namespaceObject = require("react");
|
|
33
|
+
const external_tooltip_cjs_namespaceObject = require("./tooltip.cjs");
|
|
34
|
+
const index_cjs_namespaceObject = require("../../lib/index.cjs");
|
|
35
|
+
const disclosure_row_cjs_namespaceObject = require("../../lib/disclosure-row.cjs");
|
|
36
|
+
const TreeContext = /*#__PURE__*/ external_react_namespaceObject.createContext(null);
|
|
37
|
+
const isExpandable = (item)=>'function' == typeof item.children ? !!item.expandable : !!item.children?.length;
|
|
38
|
+
const DisclosureTree = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ items, expanded, onExpandedChange, className, onKeyDown, ...props }, ref)=>{
|
|
39
|
+
const [overrides, setOverrides] = external_react_namespaceObject.useState(new Map());
|
|
40
|
+
const [activeId, setActiveId] = external_react_namespaceObject.useState();
|
|
41
|
+
const rows = external_react_namespaceObject.useRef(new Map());
|
|
42
|
+
const built = external_react_namespaceObject.useRef(new WeakMap());
|
|
43
|
+
const childrenOf = external_react_namespaceObject.useCallback((item)=>{
|
|
44
|
+
if ('function' != typeof item.children) return item.children ?? [];
|
|
45
|
+
let children = built.current.get(item);
|
|
46
|
+
if (!children) {
|
|
47
|
+
children = item.children();
|
|
48
|
+
built.current.set(item, children);
|
|
49
|
+
}
|
|
50
|
+
return children;
|
|
51
|
+
}, []);
|
|
52
|
+
const isExpanded = external_react_namespaceObject.useCallback((item)=>isExpandable(item) && (expanded ? expanded.includes(item.id) : overrides.get(item.id) ?? item.defaultExpanded ?? false), [
|
|
53
|
+
expanded,
|
|
54
|
+
overrides
|
|
55
|
+
]);
|
|
56
|
+
const setExpanded = external_react_namespaceObject.useCallback((item, next)=>{
|
|
57
|
+
if (!isExpandable(item) || isExpanded(item) === next) return;
|
|
58
|
+
if (!expanded) setOverrides((previous)=>new Map(previous).set(item.id, next));
|
|
59
|
+
onExpandedChange?.(item.id, next);
|
|
60
|
+
}, [
|
|
61
|
+
expanded,
|
|
62
|
+
isExpanded,
|
|
63
|
+
onExpandedChange
|
|
64
|
+
]);
|
|
65
|
+
const visible = external_react_namespaceObject.useMemo(()=>{
|
|
66
|
+
const list = [];
|
|
67
|
+
const walk = (level, parentId)=>{
|
|
68
|
+
for (const item of level){
|
|
69
|
+
const expandable = isExpandable(item);
|
|
70
|
+
list.push({
|
|
71
|
+
item,
|
|
72
|
+
parentId,
|
|
73
|
+
expandable
|
|
74
|
+
});
|
|
75
|
+
if (expandable && isExpanded(item)) walk(childrenOf(item), item.id);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
walk(items, void 0);
|
|
79
|
+
return list;
|
|
80
|
+
}, [
|
|
81
|
+
items,
|
|
82
|
+
isExpanded,
|
|
83
|
+
childrenOf
|
|
84
|
+
]);
|
|
85
|
+
const tabbableId = visible.some((row)=>row.item.id === activeId) ? activeId : visible[0]?.item.id;
|
|
86
|
+
const focusRow = (id)=>{
|
|
87
|
+
if (void 0 === id) return;
|
|
88
|
+
setActiveId(id);
|
|
89
|
+
rows.current.get(id)?.focus();
|
|
90
|
+
};
|
|
91
|
+
const handleKeyDown = (event)=>{
|
|
92
|
+
onKeyDown?.(event);
|
|
93
|
+
if (event.defaultPrevented) return;
|
|
94
|
+
const id = event.target.dataset.treeItemId;
|
|
95
|
+
const index = visible.findIndex((row)=>row.item.id === id);
|
|
96
|
+
if (index < 0) return;
|
|
97
|
+
const row = visible[index];
|
|
98
|
+
const open = row.expandable && isExpanded(row.item);
|
|
99
|
+
switch(event.key){
|
|
100
|
+
case 'ArrowDown':
|
|
101
|
+
focusRow(visible[index + 1]?.item.id);
|
|
102
|
+
break;
|
|
103
|
+
case 'ArrowUp':
|
|
104
|
+
focusRow(visible[index - 1]?.item.id);
|
|
105
|
+
break;
|
|
106
|
+
case 'Home':
|
|
107
|
+
focusRow(visible[0]?.item.id);
|
|
108
|
+
break;
|
|
109
|
+
case 'End':
|
|
110
|
+
focusRow(visible[visible.length - 1]?.item.id);
|
|
111
|
+
break;
|
|
112
|
+
case 'ArrowRight':
|
|
113
|
+
if (!row.expandable) return;
|
|
114
|
+
if (open) {
|
|
115
|
+
if (visible[index + 1]?.parentId === row.item.id) focusRow(visible[index + 1].item.id);
|
|
116
|
+
} else setExpanded(row.item, true);
|
|
117
|
+
break;
|
|
118
|
+
case 'ArrowLeft':
|
|
119
|
+
if (open) setExpanded(row.item, false);
|
|
120
|
+
else focusRow(row.parentId);
|
|
121
|
+
break;
|
|
122
|
+
case 'Enter':
|
|
123
|
+
case ' ':
|
|
124
|
+
if (!row.expandable) return;
|
|
125
|
+
setExpanded(row.item, !open);
|
|
126
|
+
break;
|
|
127
|
+
default:
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
event.preventDefault();
|
|
131
|
+
};
|
|
132
|
+
const context = external_react_namespaceObject.useMemo(()=>({
|
|
133
|
+
isExpanded,
|
|
134
|
+
toggle: (item)=>setExpanded(item, !isExpanded(item)),
|
|
135
|
+
childrenOf,
|
|
136
|
+
tabbableId,
|
|
137
|
+
setActiveId,
|
|
138
|
+
registerRow: (id, node)=>{
|
|
139
|
+
if (node) rows.current.set(id, node);
|
|
140
|
+
else rows.current.delete(id);
|
|
141
|
+
}
|
|
142
|
+
}), [
|
|
143
|
+
isExpanded,
|
|
144
|
+
setExpanded,
|
|
145
|
+
childrenOf,
|
|
146
|
+
tabbableId
|
|
147
|
+
]);
|
|
148
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(TreeContext.Provider, {
|
|
149
|
+
value: context,
|
|
150
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tooltip_cjs_namespaceObject.TooltipProvider, {
|
|
151
|
+
delayDuration: 300,
|
|
152
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
153
|
+
ref: ref,
|
|
154
|
+
role: "tree",
|
|
155
|
+
"data-slot": "disclosure-tree",
|
|
156
|
+
className: (0, index_cjs_namespaceObject.cn)('flex min-w-0 flex-col', className),
|
|
157
|
+
onKeyDown: handleKeyDown,
|
|
158
|
+
...props,
|
|
159
|
+
children: items.map((item, index)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(DisclosureTreeRow, {
|
|
160
|
+
item: item,
|
|
161
|
+
level: 1,
|
|
162
|
+
position: index + 1,
|
|
163
|
+
setSize: items.length
|
|
164
|
+
}, item.id))
|
|
165
|
+
})
|
|
166
|
+
})
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
DisclosureTree.displayName = 'DisclosureTree';
|
|
170
|
+
function DisclosureTreeRow({ item, level, position, setSize }) {
|
|
171
|
+
const tree = external_react_namespaceObject.useContext(TreeContext);
|
|
172
|
+
if (!tree) throw new Error('DisclosureTreeRow must be used within DisclosureTree');
|
|
173
|
+
const id = external_react_namespaceObject.useId();
|
|
174
|
+
const [tooltipOpen, setTooltipOpen] = external_react_namespaceObject.useState(false);
|
|
175
|
+
const expandable = isExpandable(item);
|
|
176
|
+
const open = tree.isExpanded(item);
|
|
177
|
+
const children = open ? tree.childrenOf(item) : [];
|
|
178
|
+
const labelId = `${id}-label`;
|
|
179
|
+
const descriptionId = `${id}-description`;
|
|
180
|
+
const row = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
181
|
+
"data-slot": "disclosure-tree-row",
|
|
182
|
+
onClick: expandable ? ()=>tree.toggle(item) : void 0,
|
|
183
|
+
className: (0, index_cjs_namespaceObject.cn)(disclosure_row_cjs_namespaceObject.disclosureRowClassName, expandable && 'cursor-pointer hover:text-foreground'),
|
|
184
|
+
children: [
|
|
185
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.ChevronRight, {
|
|
186
|
+
"aria-hidden": "true",
|
|
187
|
+
className: (0, index_cjs_namespaceObject.cn)('size-4 shrink-0 transition-transform motion-reduce:transition-none', open && 'rotate-90', !expandable && 'invisible')
|
|
188
|
+
}),
|
|
189
|
+
null != item.icon && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
190
|
+
"data-slot": "disclosure-tree-icon",
|
|
191
|
+
className: "flex size-4 shrink-0 items-center justify-center [&_svg]:size-4",
|
|
192
|
+
children: item.icon
|
|
193
|
+
}),
|
|
194
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
195
|
+
id: labelId,
|
|
196
|
+
"data-slot": "disclosure-tree-label",
|
|
197
|
+
className: "min-w-0 truncate",
|
|
198
|
+
children: item.label
|
|
199
|
+
}),
|
|
200
|
+
null != item.trailing && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
201
|
+
"data-slot": "disclosure-tree-trailing",
|
|
202
|
+
className: "ml-auto shrink-0 pl-2 text-muted-foreground",
|
|
203
|
+
children: item.trailing
|
|
204
|
+
})
|
|
205
|
+
]
|
|
206
|
+
});
|
|
207
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
208
|
+
ref: (node)=>tree.registerRow(item.id, node),
|
|
209
|
+
role: "treeitem",
|
|
210
|
+
"data-slot": "disclosure-tree-item",
|
|
211
|
+
"data-tree-item-id": item.id,
|
|
212
|
+
"aria-level": level,
|
|
213
|
+
"aria-posinset": position,
|
|
214
|
+
"aria-setsize": setSize,
|
|
215
|
+
"aria-expanded": expandable ? open : void 0,
|
|
216
|
+
"aria-labelledby": labelId,
|
|
217
|
+
"aria-describedby": item.description ? descriptionId : void 0,
|
|
218
|
+
tabIndex: tree.tabbableId === item.id ? 0 : -1,
|
|
219
|
+
onFocus: (event)=>{
|
|
220
|
+
if (event.target !== event.currentTarget) return;
|
|
221
|
+
tree.setActiveId(item.id);
|
|
222
|
+
if (item.description) setTooltipOpen(true);
|
|
223
|
+
},
|
|
224
|
+
onBlur: (event)=>{
|
|
225
|
+
if (event.target === event.currentTarget) setTooltipOpen(false);
|
|
226
|
+
},
|
|
227
|
+
className: "min-w-0 outline-hidden [&:focus-visible>[data-slot=disclosure-tree-row]]:ring-2 [&:focus-visible>[data-slot=disclosure-tree-row]]:ring-ring",
|
|
228
|
+
children: [
|
|
229
|
+
item.description ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_tooltip_cjs_namespaceObject.Tooltip, {
|
|
230
|
+
open: tooltipOpen,
|
|
231
|
+
onOpenChange: setTooltipOpen,
|
|
232
|
+
children: [
|
|
233
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tooltip_cjs_namespaceObject.TooltipTrigger, {
|
|
234
|
+
asChild: true,
|
|
235
|
+
children: row
|
|
236
|
+
}),
|
|
237
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tooltip_cjs_namespaceObject.TooltipPortal, {
|
|
238
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tooltip_cjs_namespaceObject.TooltipContent, {
|
|
239
|
+
align: "start",
|
|
240
|
+
children: item.description
|
|
241
|
+
})
|
|
242
|
+
})
|
|
243
|
+
]
|
|
244
|
+
}) : row,
|
|
245
|
+
item.description && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
246
|
+
id: descriptionId,
|
|
247
|
+
hidden: true,
|
|
248
|
+
children: item.description
|
|
249
|
+
}),
|
|
250
|
+
children.length > 0 && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
251
|
+
role: "group",
|
|
252
|
+
className: "ml-7 flex min-w-0 flex-col",
|
|
253
|
+
children: children.map((child, index)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(DisclosureTreeRow, {
|
|
254
|
+
item: child,
|
|
255
|
+
level: level + 1,
|
|
256
|
+
position: index + 1,
|
|
257
|
+
setSize: children.length
|
|
258
|
+
}, child.id))
|
|
259
|
+
})
|
|
260
|
+
]
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
exports.DisclosureTree = __webpack_exports__.DisclosureTree;
|
|
264
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
265
|
+
"DisclosureTree"
|
|
266
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
267
|
+
Object.defineProperty(exports, '__esModule', {
|
|
268
|
+
value: true
|
|
269
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A read-only ARIA tree of rows that disclose their children, for agent traces and nested results
|
|
4
|
+
* in a chat. Unlike `TreeView`, a file manager with search, selection and menus, it has no toolbar
|
|
5
|
+
* and no built-in copy: just rows with a leading icon, a label, trailing info and an optional
|
|
6
|
+
* tooltip, styled like `ToolCall` sections. One row is in the tab order; arrow keys, Home and End
|
|
7
|
+
* move between rows, Right and Left open, close or move in and out, and Enter or Space toggle.
|
|
8
|
+
*
|
|
9
|
+
* Compact density (Wind's own; Material's tree does not change): inside an ancestor with
|
|
10
|
+
* `data-density="compact"` rows lose 2px of vertical padding (24px to 20px with a 16px line).
|
|
11
|
+
*/
|
|
12
|
+
export interface DisclosureTreeItem {
|
|
13
|
+
/** Unique across the whole tree. */
|
|
14
|
+
id: string;
|
|
15
|
+
label: React.ReactNode;
|
|
16
|
+
/** Leading icon, sized to 16px. */
|
|
17
|
+
icon?: React.ReactNode;
|
|
18
|
+
/** Right-aligned secondary info, such as a duration or count. */
|
|
19
|
+
trailing?: React.ReactNode;
|
|
20
|
+
/** Shown in a tooltip on hover or focus of the row, and read as its accessible description. */
|
|
21
|
+
description?: React.ReactNode;
|
|
22
|
+
/** Open on first render. Ignored when `expanded` is controlled. */
|
|
23
|
+
defaultExpanded?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* The children, or a function that builds them the first time the row opens, so a large trace
|
|
26
|
+
* costs nothing until someone looks. A function needs `expandable`. It runs once per item
|
|
27
|
+
* object, so memoize `items`: new item objects build their children again.
|
|
28
|
+
*/
|
|
29
|
+
children?: readonly DisclosureTreeItem[] | (() => readonly DisclosureTreeItem[]);
|
|
30
|
+
/** Whether the row has children; required when `children` is a function. */
|
|
31
|
+
expandable?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface DisclosureTreeProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
34
|
+
items: readonly DisclosureTreeItem[];
|
|
35
|
+
/**
|
|
36
|
+
* Ids of the open rows, to hold open state outside the tree (it then survives unmounting).
|
|
37
|
+
* Choose controlled or uncontrolled for the tree's lifetime; switching between them is not
|
|
38
|
+
* supported.
|
|
39
|
+
*/
|
|
40
|
+
expanded?: readonly string[];
|
|
41
|
+
/** Called when a row opens or closes, controlled or not. */
|
|
42
|
+
onExpandedChange?: (id: string, expanded: boolean) => void;
|
|
43
|
+
}
|
|
44
|
+
declare const DisclosureTree: React.ForwardRefExoticComponent<DisclosureTreeProps & React.RefAttributes<HTMLDivElement>>;
|
|
45
|
+
export { DisclosureTree };
|