@uipath/apollo-react 3.53.0 → 3.54.0-pr354.029fc6a
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 +45 -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 +41 -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 +8 -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 +8 -4
- package/dist/canvas/components/Toolbox/Toolbox.cjs +140 -2
- package/dist/canvas/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/canvas/components/Toolbox/Toolbox.js +141 -3
- 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");
|
|
@@ -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,21 @@ 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 (index >= 0) listRef.current?.scrollToRow({
|
|
128
|
+
index,
|
|
129
|
+
align: 'auto'
|
|
130
|
+
});
|
|
131
|
+
}, [
|
|
132
|
+
listRef
|
|
133
|
+
]);
|
|
89
134
|
const clearSearch = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
90
135
|
setSearch('');
|
|
91
136
|
setSearchedItems([]);
|
|
92
137
|
setSearchLoading(false);
|
|
93
138
|
setIsSearchingInitialItems(true);
|
|
139
|
+
setActiveIndex(-1);
|
|
94
140
|
}, []);
|
|
95
141
|
const handleSearch = (0, external_react_namespaceObject.useCallback)(async (query)=>{
|
|
96
142
|
if (!query.trim()) {
|
|
@@ -101,6 +147,7 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
101
147
|
return;
|
|
102
148
|
}
|
|
103
149
|
setSearch(query);
|
|
150
|
+
setActiveIndex(-1);
|
|
104
151
|
searchIdRef.current += 1;
|
|
105
152
|
const currentRequestId = searchIdRef.current;
|
|
106
153
|
setSearchLoading(true);
|
|
@@ -121,6 +168,7 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
121
168
|
]);
|
|
122
169
|
const handleBackTransition = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
123
170
|
startTransition('back');
|
|
171
|
+
setActiveIndex(-1);
|
|
124
172
|
const previousState = navigationStack.pop();
|
|
125
173
|
if (previousState) {
|
|
126
174
|
setItems(previousState.data.items);
|
|
@@ -149,6 +197,7 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
149
197
|
setItems(nestedItems);
|
|
150
198
|
setCurrentParentItem(item);
|
|
151
199
|
clearSearch();
|
|
200
|
+
setActiveIndex(-1);
|
|
152
201
|
startTransition('forward');
|
|
153
202
|
setChildrenLoading(false);
|
|
154
203
|
}, [
|
|
@@ -206,6 +255,87 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
206
255
|
}, [
|
|
207
256
|
items
|
|
208
257
|
]);
|
|
258
|
+
const activeDescendantId = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
259
|
+
if (activeIndex < 0) return;
|
|
260
|
+
const renderItem = renderedItems[activeIndex];
|
|
261
|
+
if (renderItem?.type === 'item') return `toolbox-item-${renderItem.item.id}`;
|
|
262
|
+
}, [
|
|
263
|
+
activeIndex,
|
|
264
|
+
renderedItems
|
|
265
|
+
]);
|
|
266
|
+
const handleNavigationKeyDown = (0, external_react_namespaceObject.useCallback)((e)=>{
|
|
267
|
+
if (isTransitioning) return;
|
|
268
|
+
const input = searchInputRef.current;
|
|
269
|
+
const cursorAtStart = input ? 0 === input.selectionStart && 0 === input.selectionEnd : true;
|
|
270
|
+
const cursorAtEnd = input ? input.selectionStart === input.value.length && input.selectionEnd === input.value.length : true;
|
|
271
|
+
switch(e.key){
|
|
272
|
+
case 'ArrowDown':
|
|
273
|
+
e.preventDefault();
|
|
274
|
+
if (-1 === activeIndex) {
|
|
275
|
+
const firstIndex = getFirstSelectableIndex();
|
|
276
|
+
if (-1 !== firstIndex) navigateToIndex(firstIndex);
|
|
277
|
+
} else {
|
|
278
|
+
const nextIndex = getNextSelectableIndex(activeIndex, 1);
|
|
279
|
+
if (-1 !== nextIndex) navigateToIndex(nextIndex);
|
|
280
|
+
}
|
|
281
|
+
break;
|
|
282
|
+
case 'ArrowUp':
|
|
283
|
+
e.preventDefault();
|
|
284
|
+
activeIndex <= 0 || -1 === getNextSelectableIndex(activeIndex, -1) ? navigateToIndex(-1) : navigateToIndex(getNextSelectableIndex(activeIndex, -1));
|
|
285
|
+
break;
|
|
286
|
+
case 'Enter':
|
|
287
|
+
if (activeIndex >= 0) {
|
|
288
|
+
const renderItem = renderedItems[activeIndex];
|
|
289
|
+
if (renderItem?.type === 'item') {
|
|
290
|
+
e.preventDefault();
|
|
291
|
+
handleItemSelect(renderItem.item);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
break;
|
|
295
|
+
case 'ArrowRight':
|
|
296
|
+
if (!cursorAtEnd) break;
|
|
297
|
+
if (activeIndex >= 0) {
|
|
298
|
+
const renderItem = renderedItems[activeIndex];
|
|
299
|
+
if (renderItem?.type === 'item' && renderItem.item.children) {
|
|
300
|
+
e.preventDefault();
|
|
301
|
+
handleItemSelect(renderItem.item);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
break;
|
|
305
|
+
case 'ArrowLeft':
|
|
306
|
+
if (!cursorAtStart) break;
|
|
307
|
+
if (activeIndex >= 0 && navigationStack.canGoBack) {
|
|
308
|
+
e.preventDefault();
|
|
309
|
+
handleBackTransition();
|
|
310
|
+
}
|
|
311
|
+
break;
|
|
312
|
+
case 'Home':
|
|
313
|
+
{
|
|
314
|
+
e.preventDefault();
|
|
315
|
+
const firstIndex = getFirstSelectableIndex();
|
|
316
|
+
if (-1 !== firstIndex) navigateToIndex(firstIndex);
|
|
317
|
+
break;
|
|
318
|
+
}
|
|
319
|
+
case 'End':
|
|
320
|
+
{
|
|
321
|
+
e.preventDefault();
|
|
322
|
+
const lastIndex = getLastSelectableIndex();
|
|
323
|
+
if (-1 !== lastIndex) navigateToIndex(lastIndex);
|
|
324
|
+
break;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}, [
|
|
328
|
+
isTransitioning,
|
|
329
|
+
activeIndex,
|
|
330
|
+
renderedItems,
|
|
331
|
+
navigationStack.canGoBack,
|
|
332
|
+
navigateToIndex,
|
|
333
|
+
handleItemSelect,
|
|
334
|
+
handleBackTransition,
|
|
335
|
+
getNextSelectableIndex,
|
|
336
|
+
getFirstSelectableIndex,
|
|
337
|
+
getLastSelectableIndex
|
|
338
|
+
]);
|
|
209
339
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
210
340
|
const handleKeyDown = (e)=>{
|
|
211
341
|
if ('Escape' === e.key) if (isSearching) {
|
|
@@ -235,6 +365,10 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
235
365
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
236
366
|
ref: containerRef,
|
|
237
367
|
"data-testid": "toolbox-container",
|
|
368
|
+
tabIndex: 0,
|
|
369
|
+
role: "application",
|
|
370
|
+
"aria-activedescendant": activeDescendantId,
|
|
371
|
+
"aria-label": currentParentItem?.name || title,
|
|
238
372
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_layouts_index_cjs_namespaceObject.Column, {
|
|
239
373
|
px: 20,
|
|
240
374
|
py: 12,
|
|
@@ -251,7 +385,9 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
251
385
|
value: search,
|
|
252
386
|
onChange: handleSearch,
|
|
253
387
|
clear: clearSearch,
|
|
254
|
-
placeholder: "Search"
|
|
388
|
+
placeholder: "Search",
|
|
389
|
+
inputRef: searchInputRef,
|
|
390
|
+
onNavigationKeyDown: handleNavigationKeyDown
|
|
255
391
|
}),
|
|
256
392
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_Toolbox_styles_cjs_namespaceObject.AnimatedContainer, {
|
|
257
393
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_Toolbox_styles_cjs_namespaceObject.AnimatedContent, {
|
|
@@ -259,7 +395,9 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
259
395
|
direction: animationDirection,
|
|
260
396
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_ListView_cjs_namespaceObject.ListView, {
|
|
261
397
|
isLoading: childrenLoading || searchLoading || loading,
|
|
262
|
-
items:
|
|
398
|
+
items: displayedItems,
|
|
399
|
+
activeIndex: activeIndex,
|
|
400
|
+
listRef: listRef,
|
|
263
401
|
emptyStateMessage: isSearching ? 'No matching nodes found' : 'No nodes found',
|
|
264
402
|
enableSections: !isSearching,
|
|
265
403
|
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,2CA2ajB"}
|
|
@@ -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,21 @@ 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 (index >= 0) listRef.current?.scrollToRow({
|
|
100
|
+
index,
|
|
101
|
+
align: 'auto'
|
|
102
|
+
});
|
|
103
|
+
}, [
|
|
104
|
+
listRef
|
|
105
|
+
]);
|
|
61
106
|
const clearSearch = useCallback(()=>{
|
|
62
107
|
setSearch('');
|
|
63
108
|
setSearchedItems([]);
|
|
64
109
|
setSearchLoading(false);
|
|
65
110
|
setIsSearchingInitialItems(true);
|
|
111
|
+
setActiveIndex(-1);
|
|
66
112
|
}, []);
|
|
67
113
|
const handleSearch = useCallback(async (query)=>{
|
|
68
114
|
if (!query.trim()) {
|
|
@@ -73,6 +119,7 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
73
119
|
return;
|
|
74
120
|
}
|
|
75
121
|
setSearch(query);
|
|
122
|
+
setActiveIndex(-1);
|
|
76
123
|
searchIdRef.current += 1;
|
|
77
124
|
const currentRequestId = searchIdRef.current;
|
|
78
125
|
setSearchLoading(true);
|
|
@@ -93,6 +140,7 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
93
140
|
]);
|
|
94
141
|
const handleBackTransition = useCallback(()=>{
|
|
95
142
|
startTransition('back');
|
|
143
|
+
setActiveIndex(-1);
|
|
96
144
|
const previousState = navigationStack.pop();
|
|
97
145
|
if (previousState) {
|
|
98
146
|
setItems(previousState.data.items);
|
|
@@ -121,6 +169,7 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
121
169
|
setItems(nestedItems);
|
|
122
170
|
setCurrentParentItem(item);
|
|
123
171
|
clearSearch();
|
|
172
|
+
setActiveIndex(-1);
|
|
124
173
|
startTransition('forward');
|
|
125
174
|
setChildrenLoading(false);
|
|
126
175
|
}, [
|
|
@@ -178,6 +227,87 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
178
227
|
}, [
|
|
179
228
|
items
|
|
180
229
|
]);
|
|
230
|
+
const activeDescendantId = useMemo(()=>{
|
|
231
|
+
if (activeIndex < 0) return;
|
|
232
|
+
const renderItem = renderedItems[activeIndex];
|
|
233
|
+
if (renderItem?.type === 'item') return `toolbox-item-${renderItem.item.id}`;
|
|
234
|
+
}, [
|
|
235
|
+
activeIndex,
|
|
236
|
+
renderedItems
|
|
237
|
+
]);
|
|
238
|
+
const handleNavigationKeyDown = useCallback((e)=>{
|
|
239
|
+
if (isTransitioning) return;
|
|
240
|
+
const input = searchInputRef.current;
|
|
241
|
+
const cursorAtStart = input ? 0 === input.selectionStart && 0 === input.selectionEnd : true;
|
|
242
|
+
const cursorAtEnd = input ? input.selectionStart === input.value.length && input.selectionEnd === input.value.length : true;
|
|
243
|
+
switch(e.key){
|
|
244
|
+
case 'ArrowDown':
|
|
245
|
+
e.preventDefault();
|
|
246
|
+
if (-1 === activeIndex) {
|
|
247
|
+
const firstIndex = getFirstSelectableIndex();
|
|
248
|
+
if (-1 !== firstIndex) navigateToIndex(firstIndex);
|
|
249
|
+
} else {
|
|
250
|
+
const nextIndex = getNextSelectableIndex(activeIndex, 1);
|
|
251
|
+
if (-1 !== nextIndex) navigateToIndex(nextIndex);
|
|
252
|
+
}
|
|
253
|
+
break;
|
|
254
|
+
case 'ArrowUp':
|
|
255
|
+
e.preventDefault();
|
|
256
|
+
activeIndex <= 0 || -1 === getNextSelectableIndex(activeIndex, -1) ? navigateToIndex(-1) : navigateToIndex(getNextSelectableIndex(activeIndex, -1));
|
|
257
|
+
break;
|
|
258
|
+
case 'Enter':
|
|
259
|
+
if (activeIndex >= 0) {
|
|
260
|
+
const renderItem = renderedItems[activeIndex];
|
|
261
|
+
if (renderItem?.type === 'item') {
|
|
262
|
+
e.preventDefault();
|
|
263
|
+
handleItemSelect(renderItem.item);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
break;
|
|
267
|
+
case 'ArrowRight':
|
|
268
|
+
if (!cursorAtEnd) break;
|
|
269
|
+
if (activeIndex >= 0) {
|
|
270
|
+
const renderItem = renderedItems[activeIndex];
|
|
271
|
+
if (renderItem?.type === 'item' && renderItem.item.children) {
|
|
272
|
+
e.preventDefault();
|
|
273
|
+
handleItemSelect(renderItem.item);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
break;
|
|
277
|
+
case 'ArrowLeft':
|
|
278
|
+
if (!cursorAtStart) break;
|
|
279
|
+
if (activeIndex >= 0 && navigationStack.canGoBack) {
|
|
280
|
+
e.preventDefault();
|
|
281
|
+
handleBackTransition();
|
|
282
|
+
}
|
|
283
|
+
break;
|
|
284
|
+
case 'Home':
|
|
285
|
+
{
|
|
286
|
+
e.preventDefault();
|
|
287
|
+
const firstIndex = getFirstSelectableIndex();
|
|
288
|
+
if (-1 !== firstIndex) navigateToIndex(firstIndex);
|
|
289
|
+
break;
|
|
290
|
+
}
|
|
291
|
+
case 'End':
|
|
292
|
+
{
|
|
293
|
+
e.preventDefault();
|
|
294
|
+
const lastIndex = getLastSelectableIndex();
|
|
295
|
+
if (-1 !== lastIndex) navigateToIndex(lastIndex);
|
|
296
|
+
break;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}, [
|
|
300
|
+
isTransitioning,
|
|
301
|
+
activeIndex,
|
|
302
|
+
renderedItems,
|
|
303
|
+
navigationStack.canGoBack,
|
|
304
|
+
navigateToIndex,
|
|
305
|
+
handleItemSelect,
|
|
306
|
+
handleBackTransition,
|
|
307
|
+
getNextSelectableIndex,
|
|
308
|
+
getFirstSelectableIndex,
|
|
309
|
+
getLastSelectableIndex
|
|
310
|
+
]);
|
|
181
311
|
useEffect(()=>{
|
|
182
312
|
const handleKeyDown = (e)=>{
|
|
183
313
|
if ('Escape' === e.key) if (isSearching) {
|
|
@@ -207,6 +337,10 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
207
337
|
return /*#__PURE__*/ jsx("div", {
|
|
208
338
|
ref: containerRef,
|
|
209
339
|
"data-testid": "toolbox-container",
|
|
340
|
+
tabIndex: 0,
|
|
341
|
+
role: "application",
|
|
342
|
+
"aria-activedescendant": activeDescendantId,
|
|
343
|
+
"aria-label": currentParentItem?.name || title,
|
|
210
344
|
children: /*#__PURE__*/ jsxs(Column, {
|
|
211
345
|
px: 20,
|
|
212
346
|
py: 12,
|
|
@@ -223,7 +357,9 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
223
357
|
value: search,
|
|
224
358
|
onChange: handleSearch,
|
|
225
359
|
clear: clearSearch,
|
|
226
|
-
placeholder: "Search"
|
|
360
|
+
placeholder: "Search",
|
|
361
|
+
inputRef: searchInputRef,
|
|
362
|
+
onNavigationKeyDown: handleNavigationKeyDown
|
|
227
363
|
}),
|
|
228
364
|
/*#__PURE__*/ jsx(AnimatedContainer, {
|
|
229
365
|
children: /*#__PURE__*/ jsx(AnimatedContent, {
|
|
@@ -231,7 +367,9 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
|
|
|
231
367
|
direction: animationDirection,
|
|
232
368
|
children: /*#__PURE__*/ jsx(ListView, {
|
|
233
369
|
isLoading: childrenLoading || searchLoading || loading,
|
|
234
|
-
items:
|
|
370
|
+
items: displayedItems,
|
|
371
|
+
activeIndex: activeIndex,
|
|
372
|
+
listRef: listRef,
|
|
235
373
|
emptyStateMessage: isSearching ? 'No matching nodes found' : 'No nodes found',
|
|
236
374
|
enableSections: !isSearching,
|
|
237
375
|
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.029fc6a",
|
|
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",
|