@uipath/apollo-react 3.53.0 → 3.54.0-pr354.9b2638b
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 +43 -34
- package/dist/canvas/components/Toolbox/ListView.d.ts +7 -2
- package/dist/canvas/components/Toolbox/ListView.d.ts.map +1 -1
- package/dist/canvas/components/Toolbox/ListView.js +39 -33
- 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 +16 -4
- package/dist/canvas/components/Toolbox/SearchBox.d.ts +2 -0
- package/dist/canvas/components/Toolbox/SearchBox.d.ts.map +1 -1
- package/dist/canvas/components/Toolbox/SearchBox.js +17 -5
- package/dist/canvas/components/Toolbox/Toolbox.cjs +127 -9
- package/dist/canvas/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/canvas/components/Toolbox/Toolbox.js +128 -10
- 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 +3 -3
|
@@ -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");
|
|
@@ -71,13 +72,48 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
71
72
|
const [isTransitioning, setIsTransitioning] = (0, external_react_namespaceObject.useState)(false);
|
|
72
73
|
const [animationDirection, setAnimationDirection] = (0, external_react_namespaceObject.useState)('forward');
|
|
73
74
|
const navigationStack = (0, index_cjs_namespaceObject.useNavigationStack)();
|
|
75
|
+
const [activeIndex, setActiveIndex] = (0, external_react_namespaceObject.useState)(-1);
|
|
74
76
|
const containerRef = (0, external_react_namespaceObject.useRef)(null);
|
|
75
77
|
const transitionTimeoutRef = (0, external_react_namespaceObject.useRef)(void 0);
|
|
76
78
|
const searchIdRef = (0, external_react_namespaceObject.useRef)(0);
|
|
77
79
|
const initialItemsRef = (0, external_react_namespaceObject.useRef)(initialItems);
|
|
80
|
+
const listRef = (0, external_react_window_namespaceObject.useListRef)(null);
|
|
81
|
+
const searchInputRef = (0, external_react_namespaceObject.useRef)(null);
|
|
78
82
|
const isSearching = (0, external_react_namespaceObject.useMemo)(()=>search.length > 0, [
|
|
79
83
|
search
|
|
80
84
|
]);
|
|
85
|
+
const displayedItems = (0, external_react_namespaceObject.useMemo)(()=>isSearching && !isSearchingInitialItems ? searchedItems : items, [
|
|
86
|
+
isSearching,
|
|
87
|
+
isSearchingInitialItems,
|
|
88
|
+
searchedItems,
|
|
89
|
+
items
|
|
90
|
+
]);
|
|
91
|
+
const renderedItems = (0, external_react_namespaceObject.useMemo)(()=>(0, external_ListView_cjs_namespaceObject.buildRenderedItems)(displayedItems, !isSearching), [
|
|
92
|
+
displayedItems,
|
|
93
|
+
isSearching
|
|
94
|
+
]);
|
|
95
|
+
const getNextSelectableIndex = (0, external_react_namespaceObject.useCallback)((currentIndex, direction)=>{
|
|
96
|
+
let next = currentIndex + direction;
|
|
97
|
+
while(next >= 0 && next < renderedItems.length){
|
|
98
|
+
if (renderedItems[next]?.type === 'item') return next;
|
|
99
|
+
next += direction;
|
|
100
|
+
}
|
|
101
|
+
return -1;
|
|
102
|
+
}, [
|
|
103
|
+
renderedItems
|
|
104
|
+
]);
|
|
105
|
+
const getFirstSelectableIndex = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
106
|
+
for(let i = 0; i < renderedItems.length; i++)if (renderedItems[i]?.type === 'item') return i;
|
|
107
|
+
return -1;
|
|
108
|
+
}, [
|
|
109
|
+
renderedItems
|
|
110
|
+
]);
|
|
111
|
+
const getLastSelectableIndex = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
112
|
+
for(let i = renderedItems.length - 1; i >= 0; i--)if (renderedItems[i]?.type === 'item') return i;
|
|
113
|
+
return -1;
|
|
114
|
+
}, [
|
|
115
|
+
renderedItems
|
|
116
|
+
]);
|
|
81
117
|
const startTransition = (0, external_react_namespaceObject.useCallback)((direction)=>{
|
|
82
118
|
if (transitionTimeoutRef.current) clearTimeout(transitionTimeoutRef.current);
|
|
83
119
|
setIsTransitioning(true);
|
|
@@ -86,11 +122,22 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
86
122
|
setIsTransitioning(false);
|
|
87
123
|
}, TRANSITION_DURATION);
|
|
88
124
|
}, []);
|
|
125
|
+
const navigateToIndex = (0, external_react_namespaceObject.useCallback)((index)=>{
|
|
126
|
+
setActiveIndex(index);
|
|
127
|
+
if (-1 === index) setTimeout(()=>searchInputRef.current?.focus(), 0);
|
|
128
|
+
else listRef.current?.scrollToRow({
|
|
129
|
+
index,
|
|
130
|
+
align: 'auto'
|
|
131
|
+
});
|
|
132
|
+
}, [
|
|
133
|
+
listRef
|
|
134
|
+
]);
|
|
89
135
|
const clearSearch = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
90
136
|
setSearch('');
|
|
91
137
|
setSearchedItems([]);
|
|
92
138
|
setSearchLoading(false);
|
|
93
139
|
setIsSearchingInitialItems(true);
|
|
140
|
+
setActiveIndex(-1);
|
|
94
141
|
}, []);
|
|
95
142
|
const handleSearch = (0, external_react_namespaceObject.useCallback)(async (query)=>{
|
|
96
143
|
if (!query.trim()) {
|
|
@@ -101,6 +148,7 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
101
148
|
return;
|
|
102
149
|
}
|
|
103
150
|
setSearch(query);
|
|
151
|
+
setActiveIndex(-1);
|
|
104
152
|
searchIdRef.current += 1;
|
|
105
153
|
const currentRequestId = searchIdRef.current;
|
|
106
154
|
setSearchLoading(true);
|
|
@@ -121,6 +169,7 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
121
169
|
]);
|
|
122
170
|
const handleBackTransition = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
123
171
|
startTransition('back');
|
|
172
|
+
setActiveIndex(-1);
|
|
124
173
|
const previousState = navigationStack.pop();
|
|
125
174
|
if (previousState) {
|
|
126
175
|
setItems(previousState.data.items);
|
|
@@ -149,6 +198,7 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
149
198
|
setItems(nestedItems);
|
|
150
199
|
setCurrentParentItem(item);
|
|
151
200
|
clearSearch();
|
|
201
|
+
setActiveIndex(-1);
|
|
152
202
|
startTransition('forward');
|
|
153
203
|
setChildrenLoading(false);
|
|
154
204
|
}, [
|
|
@@ -206,14 +256,70 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
206
256
|
}, [
|
|
207
257
|
items
|
|
208
258
|
]);
|
|
259
|
+
const handleSearchArrowDown = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
260
|
+
if (isTransitioning || 0 === renderedItems.length) return;
|
|
261
|
+
const firstIndex = getFirstSelectableIndex();
|
|
262
|
+
if (-1 !== firstIndex) navigateToIndex(firstIndex);
|
|
263
|
+
}, [
|
|
264
|
+
isTransitioning,
|
|
265
|
+
renderedItems.length,
|
|
266
|
+
getFirstSelectableIndex,
|
|
267
|
+
navigateToIndex
|
|
268
|
+
]);
|
|
209
269
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
210
270
|
const handleKeyDown = (e)=>{
|
|
211
|
-
if ('Escape' === e.key)
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
271
|
+
if ('Escape' === e.key) {
|
|
272
|
+
if (isSearching) {
|
|
273
|
+
searchIdRef.current += 1;
|
|
274
|
+
startTransition('back');
|
|
275
|
+
clearSearch();
|
|
276
|
+
} else if (navigationStack.canGoBack) handleBackTransition();
|
|
277
|
+
else onClose();
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
if (isTransitioning) return;
|
|
281
|
+
const isSearchFocused = document.activeElement === searchInputRef.current;
|
|
282
|
+
if (isSearchFocused) return;
|
|
283
|
+
switch(e.key){
|
|
284
|
+
case 'ArrowDown':
|
|
285
|
+
{
|
|
286
|
+
e.preventDefault();
|
|
287
|
+
const nextIndex = getNextSelectableIndex(activeIndex, 1);
|
|
288
|
+
if (-1 !== nextIndex) navigateToIndex(nextIndex);
|
|
289
|
+
break;
|
|
290
|
+
}
|
|
291
|
+
case 'ArrowUp':
|
|
292
|
+
e.preventDefault();
|
|
293
|
+
if (activeIndex <= 0 || -1 === getNextSelectableIndex(activeIndex, -1)) navigateToIndex(-1);
|
|
294
|
+
else {
|
|
295
|
+
const prevIndex = getNextSelectableIndex(activeIndex, -1);
|
|
296
|
+
navigateToIndex(prevIndex);
|
|
297
|
+
}
|
|
298
|
+
break;
|
|
299
|
+
case 'Enter':
|
|
300
|
+
if (activeIndex >= 0) {
|
|
301
|
+
const renderItem = renderedItems[activeIndex];
|
|
302
|
+
if (renderItem?.type === 'item') {
|
|
303
|
+
e.preventDefault();
|
|
304
|
+
handleItemSelect(renderItem.item);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
break;
|
|
308
|
+
case 'Home':
|
|
309
|
+
{
|
|
310
|
+
e.preventDefault();
|
|
311
|
+
const firstIndex = getFirstSelectableIndex();
|
|
312
|
+
if (-1 !== firstIndex) navigateToIndex(firstIndex);
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
case 'End':
|
|
316
|
+
{
|
|
317
|
+
e.preventDefault();
|
|
318
|
+
const lastIndex = getLastSelectableIndex();
|
|
319
|
+
if (-1 !== lastIndex) navigateToIndex(lastIndex);
|
|
320
|
+
break;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
217
323
|
};
|
|
218
324
|
const handleClickOutside = (e)=>{
|
|
219
325
|
if (containerRef.current && !containerRef.current.contains(e.target)) onClose();
|
|
@@ -226,11 +332,19 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
226
332
|
};
|
|
227
333
|
}, [
|
|
228
334
|
isSearching,
|
|
335
|
+
isTransitioning,
|
|
336
|
+
activeIndex,
|
|
337
|
+
renderedItems,
|
|
229
338
|
navigationStack.canGoBack,
|
|
230
339
|
onClose,
|
|
231
340
|
clearSearch,
|
|
232
341
|
startTransition,
|
|
233
|
-
handleBackTransition
|
|
342
|
+
handleBackTransition,
|
|
343
|
+
handleItemSelect,
|
|
344
|
+
navigateToIndex,
|
|
345
|
+
getNextSelectableIndex,
|
|
346
|
+
getFirstSelectableIndex,
|
|
347
|
+
getLastSelectableIndex
|
|
234
348
|
]);
|
|
235
349
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
236
350
|
ref: containerRef,
|
|
@@ -251,7 +365,9 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
251
365
|
value: search,
|
|
252
366
|
onChange: handleSearch,
|
|
253
367
|
clear: clearSearch,
|
|
254
|
-
placeholder: "Search"
|
|
368
|
+
placeholder: "Search",
|
|
369
|
+
inputRef: searchInputRef,
|
|
370
|
+
onArrowDown: handleSearchArrowDown
|
|
255
371
|
}),
|
|
256
372
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_Toolbox_styles_cjs_namespaceObject.AnimatedContainer, {
|
|
257
373
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_Toolbox_styles_cjs_namespaceObject.AnimatedContent, {
|
|
@@ -259,7 +375,9 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
259
375
|
direction: animationDirection,
|
|
260
376
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_ListView_cjs_namespaceObject.ListView, {
|
|
261
377
|
isLoading: childrenLoading || searchLoading || loading,
|
|
262
|
-
items:
|
|
378
|
+
items: displayedItems,
|
|
379
|
+
activeIndex: activeIndex,
|
|
380
|
+
listRef: listRef,
|
|
263
381
|
emptyStateMessage: isSearching ? 'No matching nodes found' : 'No nodes found',
|
|
264
382
|
enableSections: !isSearching,
|
|
265
383
|
onItemClick: handleItemSelect,
|
|
@@ -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,EAAsB,KAAK,QAAQ,EAAY,MAAM,YAAY,CAAC;AAuCzE,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;AAoBD,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,2CA0YjB"}
|
|
@@ -2,8 +2,9 @@ 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
|
-
import { ListView } from "./ListView.js";
|
|
7
|
+
import { ListView, buildRenderedItems } from "./ListView.js";
|
|
7
8
|
import { SearchBox } from "./SearchBox.js";
|
|
8
9
|
import { AnimatedContainer, AnimatedContent } from "./Toolbox.styles.js";
|
|
9
10
|
const TRANSITION_DURATION = 150;
|
|
@@ -43,13 +44,48 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
43
44
|
const [isTransitioning, setIsTransitioning] = useState(false);
|
|
44
45
|
const [animationDirection, setAnimationDirection] = useState('forward');
|
|
45
46
|
const navigationStack = useNavigationStack();
|
|
47
|
+
const [activeIndex, setActiveIndex] = useState(-1);
|
|
46
48
|
const containerRef = useRef(null);
|
|
47
49
|
const transitionTimeoutRef = useRef(void 0);
|
|
48
50
|
const searchIdRef = useRef(0);
|
|
49
51
|
const initialItemsRef = useRef(initialItems);
|
|
52
|
+
const listRef = useListRef(null);
|
|
53
|
+
const searchInputRef = useRef(null);
|
|
50
54
|
const isSearching = useMemo(()=>search.length > 0, [
|
|
51
55
|
search
|
|
52
56
|
]);
|
|
57
|
+
const displayedItems = useMemo(()=>isSearching && !isSearchingInitialItems ? searchedItems : items, [
|
|
58
|
+
isSearching,
|
|
59
|
+
isSearchingInitialItems,
|
|
60
|
+
searchedItems,
|
|
61
|
+
items
|
|
62
|
+
]);
|
|
63
|
+
const renderedItems = useMemo(()=>buildRenderedItems(displayedItems, !isSearching), [
|
|
64
|
+
displayedItems,
|
|
65
|
+
isSearching
|
|
66
|
+
]);
|
|
67
|
+
const getNextSelectableIndex = useCallback((currentIndex, direction)=>{
|
|
68
|
+
let next = currentIndex + direction;
|
|
69
|
+
while(next >= 0 && next < renderedItems.length){
|
|
70
|
+
if (renderedItems[next]?.type === 'item') return next;
|
|
71
|
+
next += direction;
|
|
72
|
+
}
|
|
73
|
+
return -1;
|
|
74
|
+
}, [
|
|
75
|
+
renderedItems
|
|
76
|
+
]);
|
|
77
|
+
const getFirstSelectableIndex = useCallback(()=>{
|
|
78
|
+
for(let i = 0; i < renderedItems.length; i++)if (renderedItems[i]?.type === 'item') return i;
|
|
79
|
+
return -1;
|
|
80
|
+
}, [
|
|
81
|
+
renderedItems
|
|
82
|
+
]);
|
|
83
|
+
const getLastSelectableIndex = useCallback(()=>{
|
|
84
|
+
for(let i = renderedItems.length - 1; i >= 0; i--)if (renderedItems[i]?.type === 'item') return i;
|
|
85
|
+
return -1;
|
|
86
|
+
}, [
|
|
87
|
+
renderedItems
|
|
88
|
+
]);
|
|
53
89
|
const startTransition = useCallback((direction)=>{
|
|
54
90
|
if (transitionTimeoutRef.current) clearTimeout(transitionTimeoutRef.current);
|
|
55
91
|
setIsTransitioning(true);
|
|
@@ -58,11 +94,22 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
58
94
|
setIsTransitioning(false);
|
|
59
95
|
}, TRANSITION_DURATION);
|
|
60
96
|
}, []);
|
|
97
|
+
const navigateToIndex = useCallback((index)=>{
|
|
98
|
+
setActiveIndex(index);
|
|
99
|
+
if (-1 === index) setTimeout(()=>searchInputRef.current?.focus(), 0);
|
|
100
|
+
else listRef.current?.scrollToRow({
|
|
101
|
+
index,
|
|
102
|
+
align: 'auto'
|
|
103
|
+
});
|
|
104
|
+
}, [
|
|
105
|
+
listRef
|
|
106
|
+
]);
|
|
61
107
|
const clearSearch = useCallback(()=>{
|
|
62
108
|
setSearch('');
|
|
63
109
|
setSearchedItems([]);
|
|
64
110
|
setSearchLoading(false);
|
|
65
111
|
setIsSearchingInitialItems(true);
|
|
112
|
+
setActiveIndex(-1);
|
|
66
113
|
}, []);
|
|
67
114
|
const handleSearch = useCallback(async (query)=>{
|
|
68
115
|
if (!query.trim()) {
|
|
@@ -73,6 +120,7 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
73
120
|
return;
|
|
74
121
|
}
|
|
75
122
|
setSearch(query);
|
|
123
|
+
setActiveIndex(-1);
|
|
76
124
|
searchIdRef.current += 1;
|
|
77
125
|
const currentRequestId = searchIdRef.current;
|
|
78
126
|
setSearchLoading(true);
|
|
@@ -93,6 +141,7 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
93
141
|
]);
|
|
94
142
|
const handleBackTransition = useCallback(()=>{
|
|
95
143
|
startTransition('back');
|
|
144
|
+
setActiveIndex(-1);
|
|
96
145
|
const previousState = navigationStack.pop();
|
|
97
146
|
if (previousState) {
|
|
98
147
|
setItems(previousState.data.items);
|
|
@@ -121,6 +170,7 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
121
170
|
setItems(nestedItems);
|
|
122
171
|
setCurrentParentItem(item);
|
|
123
172
|
clearSearch();
|
|
173
|
+
setActiveIndex(-1);
|
|
124
174
|
startTransition('forward');
|
|
125
175
|
setChildrenLoading(false);
|
|
126
176
|
}, [
|
|
@@ -178,14 +228,70 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
178
228
|
}, [
|
|
179
229
|
items
|
|
180
230
|
]);
|
|
231
|
+
const handleSearchArrowDown = useCallback(()=>{
|
|
232
|
+
if (isTransitioning || 0 === renderedItems.length) return;
|
|
233
|
+
const firstIndex = getFirstSelectableIndex();
|
|
234
|
+
if (-1 !== firstIndex) navigateToIndex(firstIndex);
|
|
235
|
+
}, [
|
|
236
|
+
isTransitioning,
|
|
237
|
+
renderedItems.length,
|
|
238
|
+
getFirstSelectableIndex,
|
|
239
|
+
navigateToIndex
|
|
240
|
+
]);
|
|
181
241
|
useEffect(()=>{
|
|
182
242
|
const handleKeyDown = (e)=>{
|
|
183
|
-
if ('Escape' === e.key)
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
243
|
+
if ('Escape' === e.key) {
|
|
244
|
+
if (isSearching) {
|
|
245
|
+
searchIdRef.current += 1;
|
|
246
|
+
startTransition('back');
|
|
247
|
+
clearSearch();
|
|
248
|
+
} else if (navigationStack.canGoBack) handleBackTransition();
|
|
249
|
+
else onClose();
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
if (isTransitioning) return;
|
|
253
|
+
const isSearchFocused = document.activeElement === searchInputRef.current;
|
|
254
|
+
if (isSearchFocused) return;
|
|
255
|
+
switch(e.key){
|
|
256
|
+
case 'ArrowDown':
|
|
257
|
+
{
|
|
258
|
+
e.preventDefault();
|
|
259
|
+
const nextIndex = getNextSelectableIndex(activeIndex, 1);
|
|
260
|
+
if (-1 !== nextIndex) navigateToIndex(nextIndex);
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
case 'ArrowUp':
|
|
264
|
+
e.preventDefault();
|
|
265
|
+
if (activeIndex <= 0 || -1 === getNextSelectableIndex(activeIndex, -1)) navigateToIndex(-1);
|
|
266
|
+
else {
|
|
267
|
+
const prevIndex = getNextSelectableIndex(activeIndex, -1);
|
|
268
|
+
navigateToIndex(prevIndex);
|
|
269
|
+
}
|
|
270
|
+
break;
|
|
271
|
+
case 'Enter':
|
|
272
|
+
if (activeIndex >= 0) {
|
|
273
|
+
const renderItem = renderedItems[activeIndex];
|
|
274
|
+
if (renderItem?.type === 'item') {
|
|
275
|
+
e.preventDefault();
|
|
276
|
+
handleItemSelect(renderItem.item);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
break;
|
|
280
|
+
case 'Home':
|
|
281
|
+
{
|
|
282
|
+
e.preventDefault();
|
|
283
|
+
const firstIndex = getFirstSelectableIndex();
|
|
284
|
+
if (-1 !== firstIndex) navigateToIndex(firstIndex);
|
|
285
|
+
break;
|
|
286
|
+
}
|
|
287
|
+
case 'End':
|
|
288
|
+
{
|
|
289
|
+
e.preventDefault();
|
|
290
|
+
const lastIndex = getLastSelectableIndex();
|
|
291
|
+
if (-1 !== lastIndex) navigateToIndex(lastIndex);
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
189
295
|
};
|
|
190
296
|
const handleClickOutside = (e)=>{
|
|
191
297
|
if (containerRef.current && !containerRef.current.contains(e.target)) onClose();
|
|
@@ -198,11 +304,19 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
198
304
|
};
|
|
199
305
|
}, [
|
|
200
306
|
isSearching,
|
|
307
|
+
isTransitioning,
|
|
308
|
+
activeIndex,
|
|
309
|
+
renderedItems,
|
|
201
310
|
navigationStack.canGoBack,
|
|
202
311
|
onClose,
|
|
203
312
|
clearSearch,
|
|
204
313
|
startTransition,
|
|
205
|
-
handleBackTransition
|
|
314
|
+
handleBackTransition,
|
|
315
|
+
handleItemSelect,
|
|
316
|
+
navigateToIndex,
|
|
317
|
+
getNextSelectableIndex,
|
|
318
|
+
getFirstSelectableIndex,
|
|
319
|
+
getLastSelectableIndex
|
|
206
320
|
]);
|
|
207
321
|
return /*#__PURE__*/ jsx("div", {
|
|
208
322
|
ref: containerRef,
|
|
@@ -223,7 +337,9 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
223
337
|
value: search,
|
|
224
338
|
onChange: handleSearch,
|
|
225
339
|
clear: clearSearch,
|
|
226
|
-
placeholder: "Search"
|
|
340
|
+
placeholder: "Search",
|
|
341
|
+
inputRef: searchInputRef,
|
|
342
|
+
onArrowDown: handleSearchArrowDown
|
|
227
343
|
}),
|
|
228
344
|
/*#__PURE__*/ jsx(AnimatedContainer, {
|
|
229
345
|
children: /*#__PURE__*/ jsx(AnimatedContent, {
|
|
@@ -231,7 +347,9 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
231
347
|
direction: animationDirection,
|
|
232
348
|
children: /*#__PURE__*/ jsx(ListView, {
|
|
233
349
|
isLoading: childrenLoading || searchLoading || loading,
|
|
234
|
-
items:
|
|
350
|
+
items: displayedItems,
|
|
351
|
+
activeIndex: activeIndex,
|
|
352
|
+
listRef: listRef,
|
|
235
353
|
emptyStateMessage: isSearching ? 'No matching nodes found' : 'No nodes found',
|
|
236
354
|
enableSections: !isSearching,
|
|
237
355
|
onItemClick: handleItemSelect,
|
|
@@ -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.9b2638b",
|
|
4
4
|
"description": "Apollo Design System - React component library with Material UI theming",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -200,8 +200,8 @@
|
|
|
200
200
|
"use-sync-external-store": "^1.2.0",
|
|
201
201
|
"zod": "^4.3.5",
|
|
202
202
|
"zustand": "^5.0.9",
|
|
203
|
-
"@uipath/apollo-
|
|
204
|
-
"@uipath/apollo-
|
|
203
|
+
"@uipath/apollo-wind": "0.15.0",
|
|
204
|
+
"@uipath/apollo-core": "5.7.1"
|
|
205
205
|
},
|
|
206
206
|
"devDependencies": {
|
|
207
207
|
"@lingui/cli": "^5.6.1",
|