@uipath/apollo-react 3.53.0 → 3.54.0-pr354.0df89c3
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/canvas/components/AddNodePanel/AddNodePanel.cjs +21 -8
- package/dist/canvas/components/AddNodePanel/AddNodePanel.d.ts.map +1 -1
- package/dist/canvas/components/AddNodePanel/AddNodePanel.js +11 -8
- package/dist/canvas/components/BaseNode/BaseNode.styles.cjs +4 -52
- package/dist/canvas/components/BaseNode/BaseNode.styles.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/BaseNode.styles.js +2 -50
- package/dist/canvas/components/GroupNode/GroupNode.cjs +147 -75
- package/dist/canvas/components/GroupNode/GroupNode.d.ts.map +1 -1
- package/dist/canvas/components/GroupNode/GroupNode.js +147 -75
- package/dist/canvas/components/GroupNode/GroupNode.stories.cjs +610 -13
- package/dist/canvas/components/GroupNode/GroupNode.stories.d.ts +5 -0
- package/dist/canvas/components/GroupNode/GroupNode.stories.d.ts.map +1 -1
- package/dist/canvas/components/GroupNode/GroupNode.stories.js +589 -7
- package/dist/canvas/components/GroupNode/GroupNode.styles.cjs +6 -2
- package/dist/canvas/components/GroupNode/GroupNode.styles.d.ts +1 -0
- package/dist/canvas/components/GroupNode/GroupNode.styles.d.ts.map +1 -1
- package/dist/canvas/components/GroupNode/GroupNode.styles.js +6 -2
- package/dist/canvas/components/GroupNode/GroupNode.types.d.ts +1 -0
- package/dist/canvas/components/GroupNode/GroupNode.types.d.ts.map +1 -1
- package/dist/canvas/components/GroupNode/GroupNodeConfigContext.cjs +45 -0
- package/dist/canvas/components/GroupNode/GroupNodeConfigContext.d.ts +11 -0
- package/dist/canvas/components/GroupNode/GroupNodeConfigContext.d.ts.map +1 -0
- package/dist/canvas/components/GroupNode/GroupNodeConfigContext.js +8 -0
- package/dist/canvas/components/GroupNode/index.cjs +9 -2
- package/dist/canvas/components/GroupNode/index.d.ts +2 -0
- package/dist/canvas/components/GroupNode/index.d.ts.map +1 -1
- package/dist/canvas/components/GroupNode/index.js +2 -1
- package/dist/canvas/components/Toolbox/ListView.cjs +54 -34
- package/dist/canvas/components/Toolbox/ListView.d.ts +12 -2
- package/dist/canvas/components/Toolbox/ListView.d.ts.map +1 -1
- package/dist/canvas/components/Toolbox/ListView.js +51 -34
- package/dist/canvas/components/Toolbox/ListView.styles.cjs +7 -1
- package/dist/canvas/components/Toolbox/ListView.styles.d.ts.map +1 -1
- package/dist/canvas/components/Toolbox/ListView.styles.js +7 -1
- package/dist/canvas/components/Toolbox/SearchBox.cjs +12 -4
- package/dist/canvas/components/Toolbox/SearchBox.d.ts +3 -0
- package/dist/canvas/components/Toolbox/SearchBox.d.ts.map +1 -1
- package/dist/canvas/components/Toolbox/SearchBox.js +12 -4
- package/dist/canvas/components/Toolbox/Toolbox.cjs +140 -4
- package/dist/canvas/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/canvas/components/Toolbox/Toolbox.js +140 -4
- package/dist/canvas/styles/execution-status.cjs +88 -0
- package/dist/canvas/styles/execution-status.d.ts +8 -0
- package/dist/canvas/styles/execution-status.d.ts.map +1 -0
- package/dist/canvas/styles/execution-status.js +51 -0
- package/package.json +2 -2
|
@@ -30,6 +30,7 @@ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
|
30
30
|
const index_cjs_namespaceObject = require("../../hooks/index.cjs");
|
|
31
31
|
const external_layouts_index_cjs_namespaceObject = require("../../layouts/index.cjs");
|
|
32
32
|
const external_react_namespaceObject = require("react");
|
|
33
|
+
const external_react_window_namespaceObject = require("react-window");
|
|
33
34
|
const external_Header_cjs_namespaceObject = require("./Header.cjs");
|
|
34
35
|
const external_ListView_cjs_namespaceObject = require("./ListView.cjs");
|
|
35
36
|
const external_SearchBox_cjs_namespaceObject = require("./SearchBox.cjs");
|
|
@@ -52,6 +53,22 @@ function findItemById(items, id) {
|
|
|
52
53
|
}
|
|
53
54
|
return null;
|
|
54
55
|
}
|
|
56
|
+
function getNextSelectableIndex(renderedItems, currentIndex, direction) {
|
|
57
|
+
let next = currentIndex + direction;
|
|
58
|
+
while(next >= 0 && next < renderedItems.length){
|
|
59
|
+
if (renderedItems[next]?.type === 'item') return next;
|
|
60
|
+
next += direction;
|
|
61
|
+
}
|
|
62
|
+
return -1;
|
|
63
|
+
}
|
|
64
|
+
function getFirstSelectableIndex(renderedItems) {
|
|
65
|
+
for(let i = 0; i < renderedItems.length; i++)if (renderedItems[i]?.type === 'item') return i;
|
|
66
|
+
return -1;
|
|
67
|
+
}
|
|
68
|
+
function getLastSelectableIndex(renderedItems) {
|
|
69
|
+
for(let i = renderedItems.length - 1; i >= 0; i--)if (renderedItems[i]?.type === 'item') return i;
|
|
70
|
+
return -1;
|
|
71
|
+
}
|
|
55
72
|
function searchLeafItems(items, query) {
|
|
56
73
|
const results = [];
|
|
57
74
|
for (const item of items)if ('function' != typeof item.children) {
|
|
@@ -71,13 +88,23 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
71
88
|
const [isTransitioning, setIsTransitioning] = (0, external_react_namespaceObject.useState)(false);
|
|
72
89
|
const [animationDirection, setAnimationDirection] = (0, external_react_namespaceObject.useState)('forward');
|
|
73
90
|
const navigationStack = (0, index_cjs_namespaceObject.useNavigationStack)();
|
|
91
|
+
const [activeIndex, setActiveIndex] = (0, external_react_namespaceObject.useState)(-1);
|
|
74
92
|
const containerRef = (0, external_react_namespaceObject.useRef)(null);
|
|
75
93
|
const transitionTimeoutRef = (0, external_react_namespaceObject.useRef)(void 0);
|
|
76
94
|
const searchIdRef = (0, external_react_namespaceObject.useRef)(0);
|
|
77
95
|
const initialItemsRef = (0, external_react_namespaceObject.useRef)(initialItems);
|
|
96
|
+
const listRef = (0, external_react_window_namespaceObject.useListRef)(null);
|
|
97
|
+
const listViewRef = (0, external_react_namespaceObject.useRef)(null);
|
|
98
|
+
const searchInputRef = (0, external_react_namespaceObject.useRef)(null);
|
|
78
99
|
const isSearching = (0, external_react_namespaceObject.useMemo)(()=>search.length > 0, [
|
|
79
100
|
search
|
|
80
101
|
]);
|
|
102
|
+
const displayedItems = (0, external_react_namespaceObject.useMemo)(()=>isSearching && !isSearchingInitialItems ? searchedItems : items, [
|
|
103
|
+
isSearching,
|
|
104
|
+
isSearchingInitialItems,
|
|
105
|
+
searchedItems,
|
|
106
|
+
items
|
|
107
|
+
]);
|
|
81
108
|
const startTransition = (0, external_react_namespaceObject.useCallback)((direction)=>{
|
|
82
109
|
if (transitionTimeoutRef.current) clearTimeout(transitionTimeoutRef.current);
|
|
83
110
|
setIsTransitioning(true);
|
|
@@ -86,11 +113,22 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
86
113
|
setIsTransitioning(false);
|
|
87
114
|
}, TRANSITION_DURATION);
|
|
88
115
|
}, []);
|
|
116
|
+
const navigateToIndex = (0, external_react_namespaceObject.useCallback)((index)=>{
|
|
117
|
+
setActiveIndex(index);
|
|
118
|
+
if (-1 === index) return void searchInputRef.current?.focus();
|
|
119
|
+
listRef.current?.scrollToRow({
|
|
120
|
+
index,
|
|
121
|
+
align: 'auto'
|
|
122
|
+
});
|
|
123
|
+
}, [
|
|
124
|
+
listRef
|
|
125
|
+
]);
|
|
89
126
|
const clearSearch = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
90
127
|
setSearch('');
|
|
91
128
|
setSearchedItems([]);
|
|
92
129
|
setSearchLoading(false);
|
|
93
130
|
setIsSearchingInitialItems(true);
|
|
131
|
+
setActiveIndex(-1);
|
|
94
132
|
}, []);
|
|
95
133
|
const handleSearch = (0, external_react_namespaceObject.useCallback)(async (query)=>{
|
|
96
134
|
if (!query.trim()) {
|
|
@@ -101,6 +139,7 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
101
139
|
return;
|
|
102
140
|
}
|
|
103
141
|
setSearch(query);
|
|
142
|
+
setActiveIndex(-1);
|
|
104
143
|
searchIdRef.current += 1;
|
|
105
144
|
const currentRequestId = searchIdRef.current;
|
|
106
145
|
setSearchLoading(true);
|
|
@@ -121,6 +160,7 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
121
160
|
]);
|
|
122
161
|
const handleBackTransition = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
123
162
|
startTransition('back');
|
|
163
|
+
setActiveIndex(-1);
|
|
124
164
|
const previousState = navigationStack.pop();
|
|
125
165
|
if (previousState) {
|
|
126
166
|
setItems(previousState.data.items);
|
|
@@ -149,6 +189,7 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
149
189
|
setItems(nestedItems);
|
|
150
190
|
setCurrentParentItem(item);
|
|
151
191
|
clearSearch();
|
|
192
|
+
setActiveIndex(-1);
|
|
152
193
|
startTransition('forward');
|
|
153
194
|
setChildrenLoading(false);
|
|
154
195
|
}, [
|
|
@@ -206,6 +247,95 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
206
247
|
}, [
|
|
207
248
|
items
|
|
208
249
|
]);
|
|
250
|
+
const activeDescendantId = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
251
|
+
if (activeIndex < 0) return;
|
|
252
|
+
const renderItem = listViewRef.current?.renderedItems[activeIndex];
|
|
253
|
+
if (renderItem?.type === 'item') return `toolbox-item-${renderItem.item.id}`;
|
|
254
|
+
}, [
|
|
255
|
+
activeIndex
|
|
256
|
+
]);
|
|
257
|
+
const handleNavigationKeyDown = (0, external_react_namespaceObject.useCallback)((e)=>{
|
|
258
|
+
if (isTransitioning) return;
|
|
259
|
+
const renderedItems = listViewRef.current?.renderedItems ?? [];
|
|
260
|
+
const navigateDown = ()=>{
|
|
261
|
+
if (-1 === activeIndex) {
|
|
262
|
+
const firstIndex = getFirstSelectableIndex(renderedItems);
|
|
263
|
+
if (-1 !== firstIndex) navigateToIndex(firstIndex);
|
|
264
|
+
} else {
|
|
265
|
+
const nextIndex = getNextSelectableIndex(renderedItems, activeIndex, 1);
|
|
266
|
+
if (-1 !== nextIndex) navigateToIndex(nextIndex);
|
|
267
|
+
else {
|
|
268
|
+
const firstIndex = getFirstSelectableIndex(renderedItems);
|
|
269
|
+
if (-1 !== firstIndex) navigateToIndex(firstIndex);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
const navigateUp = ()=>{
|
|
274
|
+
activeIndex <= 0 || -1 === getNextSelectableIndex(renderedItems, activeIndex, -1) ? navigateToIndex(-1) : navigateToIndex(getNextSelectableIndex(renderedItems, activeIndex, -1));
|
|
275
|
+
};
|
|
276
|
+
switch(e.key){
|
|
277
|
+
case 'ArrowDown':
|
|
278
|
+
e.preventDefault();
|
|
279
|
+
navigateDown();
|
|
280
|
+
break;
|
|
281
|
+
case 'ArrowUp':
|
|
282
|
+
e.preventDefault();
|
|
283
|
+
navigateUp();
|
|
284
|
+
break;
|
|
285
|
+
case 'Enter':
|
|
286
|
+
if (activeIndex >= 0) {
|
|
287
|
+
const renderItem = renderedItems[activeIndex];
|
|
288
|
+
if (renderItem?.type === 'item') {
|
|
289
|
+
e.preventDefault();
|
|
290
|
+
handleItemSelect(renderItem.item);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
break;
|
|
294
|
+
case 'ArrowRight':
|
|
295
|
+
if (activeIndex >= 0) {
|
|
296
|
+
const renderItem = renderedItems[activeIndex];
|
|
297
|
+
if (renderItem?.type === 'item' && renderItem.item.children) {
|
|
298
|
+
e.preventDefault();
|
|
299
|
+
handleItemSelect(renderItem.item);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
break;
|
|
303
|
+
case 'ArrowLeft':
|
|
304
|
+
if (activeIndex >= 0 && navigationStack.canGoBack) {
|
|
305
|
+
e.preventDefault();
|
|
306
|
+
handleBackTransition();
|
|
307
|
+
}
|
|
308
|
+
break;
|
|
309
|
+
case 'Tab':
|
|
310
|
+
e.preventDefault();
|
|
311
|
+
if (e.shiftKey) navigateUp();
|
|
312
|
+
else navigateDown();
|
|
313
|
+
break;
|
|
314
|
+
case 'Home':
|
|
315
|
+
{
|
|
316
|
+
if (-1 === activeIndex) break;
|
|
317
|
+
e.preventDefault();
|
|
318
|
+
const firstIndex = getFirstSelectableIndex(renderedItems);
|
|
319
|
+
if (-1 !== firstIndex) navigateToIndex(firstIndex);
|
|
320
|
+
break;
|
|
321
|
+
}
|
|
322
|
+
case 'End':
|
|
323
|
+
{
|
|
324
|
+
if (-1 === activeIndex) break;
|
|
325
|
+
e.preventDefault();
|
|
326
|
+
const lastIndex = getLastSelectableIndex(renderedItems);
|
|
327
|
+
if (-1 !== lastIndex) navigateToIndex(lastIndex);
|
|
328
|
+
break;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}, [
|
|
332
|
+
isTransitioning,
|
|
333
|
+
activeIndex,
|
|
334
|
+
navigationStack.canGoBack,
|
|
335
|
+
navigateToIndex,
|
|
336
|
+
handleItemSelect,
|
|
337
|
+
handleBackTransition
|
|
338
|
+
]);
|
|
209
339
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
210
340
|
const handleKeyDown = (e)=>{
|
|
211
341
|
if ('Escape' === e.key) if (isSearching) {
|
|
@@ -251,19 +381,25 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
251
381
|
value: search,
|
|
252
382
|
onChange: handleSearch,
|
|
253
383
|
clear: clearSearch,
|
|
254
|
-
placeholder: "Search"
|
|
384
|
+
placeholder: "Search",
|
|
385
|
+
inputRef: searchInputRef,
|
|
386
|
+
onNavigationKeyDown: handleNavigationKeyDown,
|
|
387
|
+
activeDescendantId: activeDescendantId
|
|
255
388
|
}),
|
|
256
389
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_Toolbox_styles_cjs_namespaceObject.AnimatedContainer, {
|
|
257
390
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_Toolbox_styles_cjs_namespaceObject.AnimatedContent, {
|
|
258
391
|
entering: isTransitioning,
|
|
259
392
|
direction: animationDirection,
|
|
260
393
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_ListView_cjs_namespaceObject.ListView, {
|
|
394
|
+
ref: listViewRef,
|
|
261
395
|
isLoading: childrenLoading || searchLoading || loading,
|
|
262
|
-
items:
|
|
396
|
+
items: displayedItems,
|
|
397
|
+
activeIndex: activeIndex,
|
|
398
|
+
listRef: listRef,
|
|
263
399
|
emptyStateMessage: isSearching ? 'No matching nodes found' : 'No nodes found',
|
|
264
|
-
enableSections: !isSearching,
|
|
265
400
|
onItemClick: handleItemSelect,
|
|
266
|
-
onItemHover: onItemHover
|
|
401
|
+
onItemHover: onItemHover,
|
|
402
|
+
enableSections: !isSearching
|
|
267
403
|
})
|
|
268
404
|
})
|
|
269
405
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toolbox.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Toolbox/Toolbox.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Toolbox.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Toolbox/Toolbox.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,QAAQ,EAAkD,MAAM,YAAY,CAAC;AAuC3F,MAAM,MAAM,oBAAoB,CAAC,CAAC,GAAG,GAAG,IAAI,CAC1C,KAAK,EAAE,MAAM,EACb,gBAAgB,EAAE,OAAO,EACzB,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE;IAAE,YAAY,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,KAC5E,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAE5B,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC1D,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IAC1C,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAC;CACpC;AA+CD,wBAAgB,OAAO,CAAC,CAAC,EAAE,EACzB,OAAO,EACP,MAAM,EACN,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,KAAK,EACL,YAAY,EACZ,OAAO,GACR,EAAE,YAAY,CAAC,CAAC,CAAC,2CA0ZjB"}
|
|
@@ -2,6 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useNavigationStack } from "../../hooks/index.js";
|
|
3
3
|
import { Column } from "../../layouts/index.js";
|
|
4
4
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
5
|
+
import { useListRef } from "react-window";
|
|
5
6
|
import { Header } from "./Header.js";
|
|
6
7
|
import { ListView } from "./ListView.js";
|
|
7
8
|
import { SearchBox } from "./SearchBox.js";
|
|
@@ -24,6 +25,22 @@ function findItemById(items, id) {
|
|
|
24
25
|
}
|
|
25
26
|
return null;
|
|
26
27
|
}
|
|
28
|
+
function getNextSelectableIndex(renderedItems, currentIndex, direction) {
|
|
29
|
+
let next = currentIndex + direction;
|
|
30
|
+
while(next >= 0 && next < renderedItems.length){
|
|
31
|
+
if (renderedItems[next]?.type === 'item') return next;
|
|
32
|
+
next += direction;
|
|
33
|
+
}
|
|
34
|
+
return -1;
|
|
35
|
+
}
|
|
36
|
+
function getFirstSelectableIndex(renderedItems) {
|
|
37
|
+
for(let i = 0; i < renderedItems.length; i++)if (renderedItems[i]?.type === 'item') return i;
|
|
38
|
+
return -1;
|
|
39
|
+
}
|
|
40
|
+
function getLastSelectableIndex(renderedItems) {
|
|
41
|
+
for(let i = renderedItems.length - 1; i >= 0; i--)if (renderedItems[i]?.type === 'item') return i;
|
|
42
|
+
return -1;
|
|
43
|
+
}
|
|
27
44
|
function searchLeafItems(items, query) {
|
|
28
45
|
const results = [];
|
|
29
46
|
for (const item of items)if ('function' != typeof item.children) {
|
|
@@ -43,13 +60,23 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
43
60
|
const [isTransitioning, setIsTransitioning] = useState(false);
|
|
44
61
|
const [animationDirection, setAnimationDirection] = useState('forward');
|
|
45
62
|
const navigationStack = useNavigationStack();
|
|
63
|
+
const [activeIndex, setActiveIndex] = useState(-1);
|
|
46
64
|
const containerRef = useRef(null);
|
|
47
65
|
const transitionTimeoutRef = useRef(void 0);
|
|
48
66
|
const searchIdRef = useRef(0);
|
|
49
67
|
const initialItemsRef = useRef(initialItems);
|
|
68
|
+
const listRef = useListRef(null);
|
|
69
|
+
const listViewRef = useRef(null);
|
|
70
|
+
const searchInputRef = useRef(null);
|
|
50
71
|
const isSearching = useMemo(()=>search.length > 0, [
|
|
51
72
|
search
|
|
52
73
|
]);
|
|
74
|
+
const displayedItems = useMemo(()=>isSearching && !isSearchingInitialItems ? searchedItems : items, [
|
|
75
|
+
isSearching,
|
|
76
|
+
isSearchingInitialItems,
|
|
77
|
+
searchedItems,
|
|
78
|
+
items
|
|
79
|
+
]);
|
|
53
80
|
const startTransition = useCallback((direction)=>{
|
|
54
81
|
if (transitionTimeoutRef.current) clearTimeout(transitionTimeoutRef.current);
|
|
55
82
|
setIsTransitioning(true);
|
|
@@ -58,11 +85,22 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
58
85
|
setIsTransitioning(false);
|
|
59
86
|
}, TRANSITION_DURATION);
|
|
60
87
|
}, []);
|
|
88
|
+
const navigateToIndex = useCallback((index)=>{
|
|
89
|
+
setActiveIndex(index);
|
|
90
|
+
if (-1 === index) return void searchInputRef.current?.focus();
|
|
91
|
+
listRef.current?.scrollToRow({
|
|
92
|
+
index,
|
|
93
|
+
align: 'auto'
|
|
94
|
+
});
|
|
95
|
+
}, [
|
|
96
|
+
listRef
|
|
97
|
+
]);
|
|
61
98
|
const clearSearch = useCallback(()=>{
|
|
62
99
|
setSearch('');
|
|
63
100
|
setSearchedItems([]);
|
|
64
101
|
setSearchLoading(false);
|
|
65
102
|
setIsSearchingInitialItems(true);
|
|
103
|
+
setActiveIndex(-1);
|
|
66
104
|
}, []);
|
|
67
105
|
const handleSearch = useCallback(async (query)=>{
|
|
68
106
|
if (!query.trim()) {
|
|
@@ -73,6 +111,7 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
73
111
|
return;
|
|
74
112
|
}
|
|
75
113
|
setSearch(query);
|
|
114
|
+
setActiveIndex(-1);
|
|
76
115
|
searchIdRef.current += 1;
|
|
77
116
|
const currentRequestId = searchIdRef.current;
|
|
78
117
|
setSearchLoading(true);
|
|
@@ -93,6 +132,7 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
93
132
|
]);
|
|
94
133
|
const handleBackTransition = useCallback(()=>{
|
|
95
134
|
startTransition('back');
|
|
135
|
+
setActiveIndex(-1);
|
|
96
136
|
const previousState = navigationStack.pop();
|
|
97
137
|
if (previousState) {
|
|
98
138
|
setItems(previousState.data.items);
|
|
@@ -121,6 +161,7 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
121
161
|
setItems(nestedItems);
|
|
122
162
|
setCurrentParentItem(item);
|
|
123
163
|
clearSearch();
|
|
164
|
+
setActiveIndex(-1);
|
|
124
165
|
startTransition('forward');
|
|
125
166
|
setChildrenLoading(false);
|
|
126
167
|
}, [
|
|
@@ -178,6 +219,95 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
178
219
|
}, [
|
|
179
220
|
items
|
|
180
221
|
]);
|
|
222
|
+
const activeDescendantId = useMemo(()=>{
|
|
223
|
+
if (activeIndex < 0) return;
|
|
224
|
+
const renderItem = listViewRef.current?.renderedItems[activeIndex];
|
|
225
|
+
if (renderItem?.type === 'item') return `toolbox-item-${renderItem.item.id}`;
|
|
226
|
+
}, [
|
|
227
|
+
activeIndex
|
|
228
|
+
]);
|
|
229
|
+
const handleNavigationKeyDown = useCallback((e)=>{
|
|
230
|
+
if (isTransitioning) return;
|
|
231
|
+
const renderedItems = listViewRef.current?.renderedItems ?? [];
|
|
232
|
+
const navigateDown = ()=>{
|
|
233
|
+
if (-1 === activeIndex) {
|
|
234
|
+
const firstIndex = getFirstSelectableIndex(renderedItems);
|
|
235
|
+
if (-1 !== firstIndex) navigateToIndex(firstIndex);
|
|
236
|
+
} else {
|
|
237
|
+
const nextIndex = getNextSelectableIndex(renderedItems, activeIndex, 1);
|
|
238
|
+
if (-1 !== nextIndex) navigateToIndex(nextIndex);
|
|
239
|
+
else {
|
|
240
|
+
const firstIndex = getFirstSelectableIndex(renderedItems);
|
|
241
|
+
if (-1 !== firstIndex) navigateToIndex(firstIndex);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
const navigateUp = ()=>{
|
|
246
|
+
activeIndex <= 0 || -1 === getNextSelectableIndex(renderedItems, activeIndex, -1) ? navigateToIndex(-1) : navigateToIndex(getNextSelectableIndex(renderedItems, activeIndex, -1));
|
|
247
|
+
};
|
|
248
|
+
switch(e.key){
|
|
249
|
+
case 'ArrowDown':
|
|
250
|
+
e.preventDefault();
|
|
251
|
+
navigateDown();
|
|
252
|
+
break;
|
|
253
|
+
case 'ArrowUp':
|
|
254
|
+
e.preventDefault();
|
|
255
|
+
navigateUp();
|
|
256
|
+
break;
|
|
257
|
+
case 'Enter':
|
|
258
|
+
if (activeIndex >= 0) {
|
|
259
|
+
const renderItem = renderedItems[activeIndex];
|
|
260
|
+
if (renderItem?.type === 'item') {
|
|
261
|
+
e.preventDefault();
|
|
262
|
+
handleItemSelect(renderItem.item);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
break;
|
|
266
|
+
case 'ArrowRight':
|
|
267
|
+
if (activeIndex >= 0) {
|
|
268
|
+
const renderItem = renderedItems[activeIndex];
|
|
269
|
+
if (renderItem?.type === 'item' && renderItem.item.children) {
|
|
270
|
+
e.preventDefault();
|
|
271
|
+
handleItemSelect(renderItem.item);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
break;
|
|
275
|
+
case 'ArrowLeft':
|
|
276
|
+
if (activeIndex >= 0 && navigationStack.canGoBack) {
|
|
277
|
+
e.preventDefault();
|
|
278
|
+
handleBackTransition();
|
|
279
|
+
}
|
|
280
|
+
break;
|
|
281
|
+
case 'Tab':
|
|
282
|
+
e.preventDefault();
|
|
283
|
+
if (e.shiftKey) navigateUp();
|
|
284
|
+
else navigateDown();
|
|
285
|
+
break;
|
|
286
|
+
case 'Home':
|
|
287
|
+
{
|
|
288
|
+
if (-1 === activeIndex) break;
|
|
289
|
+
e.preventDefault();
|
|
290
|
+
const firstIndex = getFirstSelectableIndex(renderedItems);
|
|
291
|
+
if (-1 !== firstIndex) navigateToIndex(firstIndex);
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
case 'End':
|
|
295
|
+
{
|
|
296
|
+
if (-1 === activeIndex) break;
|
|
297
|
+
e.preventDefault();
|
|
298
|
+
const lastIndex = getLastSelectableIndex(renderedItems);
|
|
299
|
+
if (-1 !== lastIndex) navigateToIndex(lastIndex);
|
|
300
|
+
break;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}, [
|
|
304
|
+
isTransitioning,
|
|
305
|
+
activeIndex,
|
|
306
|
+
navigationStack.canGoBack,
|
|
307
|
+
navigateToIndex,
|
|
308
|
+
handleItemSelect,
|
|
309
|
+
handleBackTransition
|
|
310
|
+
]);
|
|
181
311
|
useEffect(()=>{
|
|
182
312
|
const handleKeyDown = (e)=>{
|
|
183
313
|
if ('Escape' === e.key) if (isSearching) {
|
|
@@ -223,19 +353,25 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
223
353
|
value: search,
|
|
224
354
|
onChange: handleSearch,
|
|
225
355
|
clear: clearSearch,
|
|
226
|
-
placeholder: "Search"
|
|
356
|
+
placeholder: "Search",
|
|
357
|
+
inputRef: searchInputRef,
|
|
358
|
+
onNavigationKeyDown: handleNavigationKeyDown,
|
|
359
|
+
activeDescendantId: activeDescendantId
|
|
227
360
|
}),
|
|
228
361
|
/*#__PURE__*/ jsx(AnimatedContainer, {
|
|
229
362
|
children: /*#__PURE__*/ jsx(AnimatedContent, {
|
|
230
363
|
entering: isTransitioning,
|
|
231
364
|
direction: animationDirection,
|
|
232
365
|
children: /*#__PURE__*/ jsx(ListView, {
|
|
366
|
+
ref: listViewRef,
|
|
233
367
|
isLoading: childrenLoading || searchLoading || loading,
|
|
234
|
-
items:
|
|
368
|
+
items: displayedItems,
|
|
369
|
+
activeIndex: activeIndex,
|
|
370
|
+
listRef: listRef,
|
|
235
371
|
emptyStateMessage: isSearching ? 'No matching nodes found' : 'No nodes found',
|
|
236
|
-
enableSections: !isSearching,
|
|
237
372
|
onItemClick: handleItemSelect,
|
|
238
|
-
onItemHover: onItemHover
|
|
373
|
+
onItemHover: onItemHover,
|
|
374
|
+
enableSections: !isSearching
|
|
239
375
|
})
|
|
240
376
|
})
|
|
241
377
|
})
|
|
@@ -0,0 +1,88 @@
|
|
|
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
|
+
getExecutionStatusBorder: ()=>getExecutionStatusBorder,
|
|
28
|
+
pulseAnimation: ()=>pulseAnimation
|
|
29
|
+
});
|
|
30
|
+
const react_namespaceObject = require("@emotion/react");
|
|
31
|
+
const pulseAnimation = (cssVar)=>(0, react_namespaceObject.keyframes)`
|
|
32
|
+
0% {
|
|
33
|
+
box-shadow: 0 0 0 0 color-mix(in srgb, var(${cssVar}) 20%, transparent);
|
|
34
|
+
}
|
|
35
|
+
70% {
|
|
36
|
+
box-shadow: 0 0 0 10px color-mix(in srgb, var(${cssVar}) 0%, transparent);
|
|
37
|
+
}
|
|
38
|
+
100% {
|
|
39
|
+
box-shadow: 0 0 0 0 color-mix(in srgb, var(${cssVar}) 0%, transparent);
|
|
40
|
+
}
|
|
41
|
+
`;
|
|
42
|
+
const getExecutionStatusBorder = (executionStatus)=>{
|
|
43
|
+
switch(executionStatus){
|
|
44
|
+
case 'NotExecuted':
|
|
45
|
+
case 'INFO':
|
|
46
|
+
return (0, react_namespaceObject.css)`
|
|
47
|
+
border-color: var(--uix-canvas-border-de-emp);
|
|
48
|
+
`;
|
|
49
|
+
case 'InProgress':
|
|
50
|
+
return (0, react_namespaceObject.css)`
|
|
51
|
+
border-color: var(--uix-canvas-info-icon);
|
|
52
|
+
animation: ${pulseAnimation('--uix-canvas-info-icon')} 2s infinite;
|
|
53
|
+
`;
|
|
54
|
+
case 'Completed':
|
|
55
|
+
return (0, react_namespaceObject.css)`
|
|
56
|
+
border-color: var(--uix-canvas-success-icon);
|
|
57
|
+
`;
|
|
58
|
+
case 'Paused':
|
|
59
|
+
case 'WARNING':
|
|
60
|
+
return (0, react_namespaceObject.css)`
|
|
61
|
+
border-color: var(--uix-canvas-warning-icon);
|
|
62
|
+
animation: ${pulseAnimation('--uix-canvas-warning-icon')} 2s infinite;
|
|
63
|
+
`;
|
|
64
|
+
case 'Cancelled':
|
|
65
|
+
case 'Failed':
|
|
66
|
+
case 'Terminated':
|
|
67
|
+
case 'ERROR':
|
|
68
|
+
case 'CRITICAL':
|
|
69
|
+
return (0, react_namespaceObject.css)`
|
|
70
|
+
border-color: var(--uix-canvas-error-icon);
|
|
71
|
+
background: var(--uix-canvas-error-background);
|
|
72
|
+
animation: ${pulseAnimation('--uix-canvas-error-icon')} 2s infinite;
|
|
73
|
+
`;
|
|
74
|
+
default:
|
|
75
|
+
return (0, react_namespaceObject.css)`
|
|
76
|
+
border-color: var(--uix-canvas-border-de-emp);
|
|
77
|
+
`;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
exports.getExecutionStatusBorder = __webpack_exports__.getExecutionStatusBorder;
|
|
81
|
+
exports.pulseAnimation = __webpack_exports__.pulseAnimation;
|
|
82
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
83
|
+
"getExecutionStatusBorder",
|
|
84
|
+
"pulseAnimation"
|
|
85
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
86
|
+
Object.defineProperty(exports, '__esModule', {
|
|
87
|
+
value: true
|
|
88
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const pulseAnimation: (cssVar: string) => {
|
|
2
|
+
name: string;
|
|
3
|
+
styles: string;
|
|
4
|
+
anim: 1;
|
|
5
|
+
toString: () => string;
|
|
6
|
+
} & string;
|
|
7
|
+
export declare const getExecutionStatusBorder: (executionStatus?: string) => import("@emotion/react").SerializedStyles;
|
|
8
|
+
//# sourceMappingURL=execution-status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution-status.d.ts","sourceRoot":"","sources":["../../../src/canvas/styles/execution-status.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM;;;;;UAU5C,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,kBAAkB,MAAM,8CAwChE,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { css, keyframes } from "@emotion/react";
|
|
2
|
+
const pulseAnimation = (cssVar)=>keyframes`
|
|
3
|
+
0% {
|
|
4
|
+
box-shadow: 0 0 0 0 color-mix(in srgb, var(${cssVar}) 20%, transparent);
|
|
5
|
+
}
|
|
6
|
+
70% {
|
|
7
|
+
box-shadow: 0 0 0 10px color-mix(in srgb, var(${cssVar}) 0%, transparent);
|
|
8
|
+
}
|
|
9
|
+
100% {
|
|
10
|
+
box-shadow: 0 0 0 0 color-mix(in srgb, var(${cssVar}) 0%, transparent);
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
13
|
+
const getExecutionStatusBorder = (executionStatus)=>{
|
|
14
|
+
switch(executionStatus){
|
|
15
|
+
case 'NotExecuted':
|
|
16
|
+
case 'INFO':
|
|
17
|
+
return css`
|
|
18
|
+
border-color: var(--uix-canvas-border-de-emp);
|
|
19
|
+
`;
|
|
20
|
+
case 'InProgress':
|
|
21
|
+
return css`
|
|
22
|
+
border-color: var(--uix-canvas-info-icon);
|
|
23
|
+
animation: ${pulseAnimation('--uix-canvas-info-icon')} 2s infinite;
|
|
24
|
+
`;
|
|
25
|
+
case 'Completed':
|
|
26
|
+
return css`
|
|
27
|
+
border-color: var(--uix-canvas-success-icon);
|
|
28
|
+
`;
|
|
29
|
+
case 'Paused':
|
|
30
|
+
case 'WARNING':
|
|
31
|
+
return css`
|
|
32
|
+
border-color: var(--uix-canvas-warning-icon);
|
|
33
|
+
animation: ${pulseAnimation('--uix-canvas-warning-icon')} 2s infinite;
|
|
34
|
+
`;
|
|
35
|
+
case 'Cancelled':
|
|
36
|
+
case 'Failed':
|
|
37
|
+
case 'Terminated':
|
|
38
|
+
case 'ERROR':
|
|
39
|
+
case 'CRITICAL':
|
|
40
|
+
return css`
|
|
41
|
+
border-color: var(--uix-canvas-error-icon);
|
|
42
|
+
background: var(--uix-canvas-error-background);
|
|
43
|
+
animation: ${pulseAnimation('--uix-canvas-error-icon')} 2s infinite;
|
|
44
|
+
`;
|
|
45
|
+
default:
|
|
46
|
+
return css`
|
|
47
|
+
border-color: var(--uix-canvas-border-de-emp);
|
|
48
|
+
`;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
export { getExecutionStatusBorder, pulseAnimation };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/apollo-react",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.54.0-pr354.0df89c3",
|
|
4
4
|
"description": "Apollo Design System - React component library with Material UI theming",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -201,7 +201,7 @@
|
|
|
201
201
|
"zod": "^4.3.5",
|
|
202
202
|
"zustand": "^5.0.9",
|
|
203
203
|
"@uipath/apollo-core": "5.7.1",
|
|
204
|
-
"@uipath/apollo-wind": "0.
|
|
204
|
+
"@uipath/apollo-wind": "0.15.0"
|
|
205
205
|
},
|
|
206
206
|
"devDependencies": {
|
|
207
207
|
"@lingui/cli": "^5.6.1",
|