@uipath/apollo-react 3.55.0-pr356.b109b65 → 3.55.1-pr354.8826816

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.
Files changed (34) hide show
  1. package/dist/canvas/components/AddNodePanel/AddNodePanel.cjs +1 -1
  2. package/dist/canvas/components/AddNodePanel/AddNodePanel.js +1 -1
  3. package/dist/canvas/components/BaseNode/BaseNode.d.ts.map +1 -1
  4. package/dist/canvas/components/BaseNode/BaseNode.styles.d.ts.map +1 -1
  5. package/dist/canvas/components/GroupNode/GroupNode.stories.d.ts.map +1 -1
  6. package/dist/canvas/components/GroupNode/GroupNode.styles.d.ts.map +1 -1
  7. package/dist/canvas/components/StageNode/StageNode.d.ts.map +1 -1
  8. package/dist/canvas/components/StageNode/StageNode.stories.d.ts.map +1 -1
  9. package/dist/canvas/components/StickyNoteNode/StickyNoteNode.cjs +3 -5
  10. package/dist/canvas/components/StickyNoteNode/StickyNoteNode.d.ts.map +1 -1
  11. package/dist/canvas/components/StickyNoteNode/StickyNoteNode.js +3 -5
  12. package/dist/canvas/components/StickyNoteNode/StickyNoteNode.styles.cjs +0 -18
  13. package/dist/canvas/components/StickyNoteNode/StickyNoteNode.styles.d.ts.map +1 -1
  14. package/dist/canvas/components/StickyNoteNode/StickyNoteNode.styles.js +0 -18
  15. package/dist/canvas/components/Toolbox/ListView.cjs +54 -34
  16. package/dist/canvas/components/Toolbox/ListView.d.ts +12 -2
  17. package/dist/canvas/components/Toolbox/ListView.d.ts.map +1 -1
  18. package/dist/canvas/components/Toolbox/ListView.js +51 -34
  19. package/dist/canvas/components/Toolbox/ListView.styles.cjs +7 -1
  20. package/dist/canvas/components/Toolbox/ListView.styles.d.ts.map +1 -1
  21. package/dist/canvas/components/Toolbox/ListView.styles.js +7 -1
  22. package/dist/canvas/components/Toolbox/SearchBox.cjs +12 -4
  23. package/dist/canvas/components/Toolbox/SearchBox.d.ts +3 -0
  24. package/dist/canvas/components/Toolbox/SearchBox.d.ts.map +1 -1
  25. package/dist/canvas/components/Toolbox/SearchBox.js +12 -4
  26. package/dist/canvas/components/Toolbox/Toolbox.cjs +143 -4
  27. package/dist/canvas/components/Toolbox/Toolbox.d.ts.map +1 -1
  28. package/dist/canvas/components/Toolbox/Toolbox.js +143 -4
  29. package/dist/canvas/core/CategoryTree.d.ts.map +1 -1
  30. package/package.json +3 -3
  31. package/dist/canvas/components/StickyNoteNode/StickyNoteNode.utils.cjs +0 -48
  32. package/dist/canvas/components/StickyNoteNode/StickyNoteNode.utils.d.ts +0 -2
  33. package/dist/canvas/components/StickyNoteNode/StickyNoteNode.utils.d.ts.map +0 -1
  34. package/dist/canvas/components/StickyNoteNode/StickyNoteNode.utils.js +0 -14
@@ -3,6 +3,9 @@ interface SearchBoxProps {
3
3
  onChange: (value: string) => void;
4
4
  clear: () => void;
5
5
  placeholder?: string;
6
+ inputRef?: React.RefObject<HTMLInputElement | null>;
7
+ onNavigationKeyDown?: (e: React.KeyboardEvent) => void;
8
+ activeDescendantId?: string;
6
9
  }
7
10
  export declare const SearchBox: import("react").NamedExoticComponent<SearchBoxProps>;
8
11
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"SearchBox.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Toolbox/SearchBox.tsx"],"names":[],"mappings":"AAKA,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,SAAS,sDAuCpB,CAAC"}
1
+ {"version":3,"file":"SearchBox.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Toolbox/SearchBox.tsx"],"names":[],"mappings":"AAKA,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;IACpD,mBAAmB,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,aAAa,KAAK,IAAI,CAAC;IACvD,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,eAAO,MAAM,SAAS,sDAgDpB,CAAC"}
@@ -3,11 +3,14 @@ import { cx } from "../../utils/index.js";
3
3
  import { ApIcon } from "../../../material/components/index.js";
4
4
  import { memo, useEffect, useRef } from "react";
5
5
  import { StyledSearchForm } from "./SearchBox.styles.js";
6
- const SearchBox_SearchBox = /*#__PURE__*/ memo(function({ value, onChange, clear, placeholder = 'Search...' }) {
7
- const inputRef = useRef(null);
6
+ const SearchBox_SearchBox = /*#__PURE__*/ memo(function({ value, onChange, clear, placeholder = 'Search...', inputRef: externalInputRef, onNavigationKeyDown, activeDescendantId }) {
7
+ const internalRef = useRef(null);
8
+ const inputRef = externalInputRef ?? internalRef;
8
9
  useEffect(()=>{
9
10
  inputRef.current?.focus();
10
- }, []);
11
+ }, [
12
+ inputRef
13
+ ]);
11
14
  return /*#__PURE__*/ jsx(StyledSearchForm, {
12
15
  autoComplete: "off",
13
16
  className: "searchbox-form",
@@ -28,10 +31,15 @@ const SearchBox_SearchBox = /*#__PURE__*/ memo(function({ value, onChange, clear
28
31
  ref: inputRef,
29
32
  autoComplete: "off",
30
33
  type: "text",
34
+ role: "combobox",
35
+ "aria-controls": "toolbox-listbox",
36
+ "aria-expanded": true,
31
37
  className: "searchbox-input",
32
38
  placeholder: placeholder,
33
39
  value: value,
34
- onChange: (e)=>onChange(e.target.value)
40
+ onChange: (e)=>onChange(e.target.value),
41
+ onKeyDown: onNavigationKeyDown,
42
+ "aria-activedescendant": activeDescendantId
35
43
  }),
36
44
  value && /*#__PURE__*/ jsx("button", {
37
45
  type: "button",
@@ -30,11 +30,13 @@ 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");
36
37
  const external_Toolbox_styles_cjs_namespaceObject = require("./Toolbox.styles.cjs");
37
38
  const TRANSITION_DURATION = 150;
39
+ const SEARCH_BAR_INDEX = -1;
38
40
  function findItemById(items, id) {
39
41
  const queue = [
40
42
  ...items
@@ -52,6 +54,23 @@ function findItemById(items, id) {
52
54
  }
53
55
  return null;
54
56
  }
57
+ function getNextSelectableIndex(renderedItems, currentIndex, direction) {
58
+ const numericDirection = 'up' === direction ? -1 : 1;
59
+ let next = currentIndex + numericDirection;
60
+ while(next >= 0 && next < renderedItems.length){
61
+ if (renderedItems[next]?.type === 'item') return next;
62
+ next += numericDirection;
63
+ }
64
+ return SEARCH_BAR_INDEX;
65
+ }
66
+ function getFirstSelectableIndex(renderedItems) {
67
+ for(let i = 0; i < renderedItems.length; i++)if (renderedItems[i]?.type === 'item') return i;
68
+ return SEARCH_BAR_INDEX;
69
+ }
70
+ function getLastSelectableIndex(renderedItems) {
71
+ for(let i = renderedItems.length - 1; i >= 0; i--)if (renderedItems[i]?.type === 'item') return i;
72
+ return SEARCH_BAR_INDEX;
73
+ }
55
74
  function searchLeafItems(items, query) {
56
75
  const results = [];
57
76
  for (const item of items)if ('function' != typeof item.children) {
@@ -71,13 +90,23 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
71
90
  const [isTransitioning, setIsTransitioning] = (0, external_react_namespaceObject.useState)(false);
72
91
  const [animationDirection, setAnimationDirection] = (0, external_react_namespaceObject.useState)('forward');
73
92
  const navigationStack = (0, index_cjs_namespaceObject.useNavigationStack)();
93
+ const [activeIndex, setActiveIndex] = (0, external_react_namespaceObject.useState)(SEARCH_BAR_INDEX);
74
94
  const containerRef = (0, external_react_namespaceObject.useRef)(null);
75
95
  const transitionTimeoutRef = (0, external_react_namespaceObject.useRef)(void 0);
76
96
  const searchIdRef = (0, external_react_namespaceObject.useRef)(0);
77
97
  const initialItemsRef = (0, external_react_namespaceObject.useRef)(initialItems);
98
+ const listRef = (0, external_react_window_namespaceObject.useListRef)(null);
99
+ const listViewRef = (0, external_react_namespaceObject.useRef)(null);
100
+ const searchInputRef = (0, external_react_namespaceObject.useRef)(null);
78
101
  const isSearching = (0, external_react_namespaceObject.useMemo)(()=>search.length > 0, [
79
102
  search
80
103
  ]);
104
+ const displayedItems = (0, external_react_namespaceObject.useMemo)(()=>isSearching && !isSearchingInitialItems ? searchedItems : items, [
105
+ isSearching,
106
+ isSearchingInitialItems,
107
+ searchedItems,
108
+ items
109
+ ]);
81
110
  const startTransition = (0, external_react_namespaceObject.useCallback)((direction)=>{
82
111
  if (transitionTimeoutRef.current) clearTimeout(transitionTimeoutRef.current);
83
112
  setIsTransitioning(true);
@@ -86,11 +115,22 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
86
115
  setIsTransitioning(false);
87
116
  }, TRANSITION_DURATION);
88
117
  }, []);
118
+ const navigateToIndex = (0, external_react_namespaceObject.useCallback)((index)=>{
119
+ setActiveIndex(index);
120
+ if (index === SEARCH_BAR_INDEX) return void searchInputRef.current?.focus();
121
+ listRef.current?.scrollToRow({
122
+ index,
123
+ align: 'auto'
124
+ });
125
+ }, [
126
+ listRef
127
+ ]);
89
128
  const clearSearch = (0, external_react_namespaceObject.useCallback)(()=>{
90
129
  setSearch('');
91
130
  setSearchedItems([]);
92
131
  setSearchLoading(false);
93
132
  setIsSearchingInitialItems(true);
133
+ setActiveIndex(SEARCH_BAR_INDEX);
94
134
  }, []);
95
135
  const handleSearch = (0, external_react_namespaceObject.useCallback)(async (query)=>{
96
136
  if (!query.trim()) {
@@ -101,6 +141,7 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
101
141
  return;
102
142
  }
103
143
  setSearch(query);
144
+ setActiveIndex(SEARCH_BAR_INDEX);
104
145
  searchIdRef.current += 1;
105
146
  const currentRequestId = searchIdRef.current;
106
147
  setSearchLoading(true);
@@ -121,6 +162,7 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
121
162
  ]);
122
163
  const handleBackTransition = (0, external_react_namespaceObject.useCallback)(()=>{
123
164
  startTransition('back');
165
+ setActiveIndex(SEARCH_BAR_INDEX);
124
166
  const previousState = navigationStack.pop();
125
167
  if (previousState) {
126
168
  setItems(previousState.data.items);
@@ -149,6 +191,7 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
149
191
  setItems(nestedItems);
150
192
  setCurrentParentItem(item);
151
193
  clearSearch();
194
+ setActiveIndex(SEARCH_BAR_INDEX);
152
195
  startTransition('forward');
153
196
  setChildrenLoading(false);
154
197
  }, [
@@ -206,6 +249,96 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
206
249
  }, [
207
250
  items
208
251
  ]);
252
+ const activeDescendantId = (0, external_react_namespaceObject.useMemo)(()=>{
253
+ if (activeIndex < 0) return;
254
+ const renderItem = listViewRef.current?.renderedItems[activeIndex];
255
+ if (renderItem?.type === 'item') return `toolbox-item-${renderItem.item.id}`;
256
+ }, [
257
+ activeIndex
258
+ ]);
259
+ const handleNavigationKeyDown = (0, external_react_namespaceObject.useCallback)((e)=>{
260
+ if (isTransitioning) return;
261
+ const renderedItems = listViewRef.current?.renderedItems ?? [];
262
+ const navigateDown = ()=>{
263
+ if (activeIndex === SEARCH_BAR_INDEX) {
264
+ const firstIndex = getFirstSelectableIndex(renderedItems);
265
+ if (firstIndex !== SEARCH_BAR_INDEX) navigateToIndex(firstIndex);
266
+ } else {
267
+ const nextIndex = getNextSelectableIndex(renderedItems, activeIndex, 'down');
268
+ if (nextIndex !== SEARCH_BAR_INDEX) navigateToIndex(nextIndex);
269
+ else {
270
+ const firstIndex = getFirstSelectableIndex(renderedItems);
271
+ if (firstIndex !== SEARCH_BAR_INDEX) navigateToIndex(firstIndex);
272
+ }
273
+ }
274
+ };
275
+ const navigateUp = ()=>{
276
+ navigateToIndex(getNextSelectableIndex(renderedItems, activeIndex, 'up'));
277
+ };
278
+ switch(e.key){
279
+ case 'ArrowDown':
280
+ e.preventDefault();
281
+ navigateDown();
282
+ break;
283
+ case 'ArrowUp':
284
+ e.preventDefault();
285
+ navigateUp();
286
+ break;
287
+ case 'Enter':
288
+ {
289
+ if (activeIndex === SEARCH_BAR_INDEX) break;
290
+ const renderItem = renderedItems[activeIndex];
291
+ if (renderItem?.type === 'item') {
292
+ e.preventDefault();
293
+ handleItemSelect(renderItem.item);
294
+ }
295
+ break;
296
+ }
297
+ case 'ArrowRight':
298
+ {
299
+ const renderItem = renderedItems[activeIndex];
300
+ if (renderItem?.type === 'item' && renderItem.item.children) {
301
+ e.preventDefault();
302
+ handleItemSelect(renderItem.item);
303
+ }
304
+ break;
305
+ }
306
+ case 'ArrowLeft':
307
+ if (!navigationStack.canGoBack || activeIndex === SEARCH_BAR_INDEX && search.length > 0) return;
308
+ e.preventDefault();
309
+ handleBackTransition();
310
+ break;
311
+ case 'Tab':
312
+ e.preventDefault();
313
+ if (e.shiftKey) navigateUp();
314
+ else navigateDown();
315
+ break;
316
+ case 'Home':
317
+ {
318
+ if (activeIndex === SEARCH_BAR_INDEX) break;
319
+ e.preventDefault();
320
+ const firstIndex = getFirstSelectableIndex(renderedItems);
321
+ if (firstIndex !== SEARCH_BAR_INDEX) navigateToIndex(firstIndex);
322
+ break;
323
+ }
324
+ case 'End':
325
+ {
326
+ if (activeIndex === SEARCH_BAR_INDEX) break;
327
+ e.preventDefault();
328
+ const lastIndex = getLastSelectableIndex(renderedItems);
329
+ if (lastIndex !== SEARCH_BAR_INDEX) navigateToIndex(lastIndex);
330
+ break;
331
+ }
332
+ }
333
+ }, [
334
+ search,
335
+ isTransitioning,
336
+ activeIndex,
337
+ navigationStack.canGoBack,
338
+ navigateToIndex,
339
+ handleItemSelect,
340
+ handleBackTransition
341
+ ]);
209
342
  (0, external_react_namespaceObject.useEffect)(()=>{
210
343
  const handleKeyDown = (e)=>{
211
344
  if ('Escape' === e.key) if (isSearching) {
@@ -251,19 +384,25 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
251
384
  value: search,
252
385
  onChange: handleSearch,
253
386
  clear: clearSearch,
254
- placeholder: "Search"
387
+ placeholder: "Search",
388
+ inputRef: searchInputRef,
389
+ onNavigationKeyDown: handleNavigationKeyDown,
390
+ activeDescendantId: activeDescendantId
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, {
258
394
  entering: isTransitioning,
259
395
  direction: animationDirection,
260
396
  children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_ListView_cjs_namespaceObject.ListView, {
397
+ ref: listViewRef,
261
398
  isLoading: childrenLoading || searchLoading || loading,
262
- items: isSearching && !isSearchingInitialItems ? searchedItems : items,
399
+ items: displayedItems,
400
+ activeIndex: activeIndex,
401
+ listRef: listRef,
263
402
  emptyStateMessage: isSearching ? 'No matching nodes found' : 'No nodes found',
264
- enableSections: !isSearching,
265
403
  onItemClick: handleItemSelect,
266
- onItemHover: onItemHover
404
+ onItemHover: onItemHover,
405
+ enableSections: !isSearching
267
406
  })
268
407
  })
269
408
  })
@@ -1 +1 @@
1
- {"version":3,"file":"Toolbox.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Toolbox/Toolbox.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AAM,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;AAgDD,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,2CAsZjB"}
@@ -2,11 +2,13 @@ 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";
8
9
  import { AnimatedContainer, AnimatedContent } from "./Toolbox.styles.js";
9
10
  const TRANSITION_DURATION = 150;
11
+ const SEARCH_BAR_INDEX = -1;
10
12
  function findItemById(items, id) {
11
13
  const queue = [
12
14
  ...items
@@ -24,6 +26,23 @@ function findItemById(items, id) {
24
26
  }
25
27
  return null;
26
28
  }
29
+ function getNextSelectableIndex(renderedItems, currentIndex, direction) {
30
+ const numericDirection = 'up' === direction ? -1 : 1;
31
+ let next = currentIndex + numericDirection;
32
+ while(next >= 0 && next < renderedItems.length){
33
+ if (renderedItems[next]?.type === 'item') return next;
34
+ next += numericDirection;
35
+ }
36
+ return SEARCH_BAR_INDEX;
37
+ }
38
+ function getFirstSelectableIndex(renderedItems) {
39
+ for(let i = 0; i < renderedItems.length; i++)if (renderedItems[i]?.type === 'item') return i;
40
+ return SEARCH_BAR_INDEX;
41
+ }
42
+ function getLastSelectableIndex(renderedItems) {
43
+ for(let i = renderedItems.length - 1; i >= 0; i--)if (renderedItems[i]?.type === 'item') return i;
44
+ return SEARCH_BAR_INDEX;
45
+ }
27
46
  function searchLeafItems(items, query) {
28
47
  const results = [];
29
48
  for (const item of items)if ('function' != typeof item.children) {
@@ -43,13 +62,23 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
43
62
  const [isTransitioning, setIsTransitioning] = useState(false);
44
63
  const [animationDirection, setAnimationDirection] = useState('forward');
45
64
  const navigationStack = useNavigationStack();
65
+ const [activeIndex, setActiveIndex] = useState(SEARCH_BAR_INDEX);
46
66
  const containerRef = useRef(null);
47
67
  const transitionTimeoutRef = useRef(void 0);
48
68
  const searchIdRef = useRef(0);
49
69
  const initialItemsRef = useRef(initialItems);
70
+ const listRef = useListRef(null);
71
+ const listViewRef = useRef(null);
72
+ const searchInputRef = useRef(null);
50
73
  const isSearching = useMemo(()=>search.length > 0, [
51
74
  search
52
75
  ]);
76
+ const displayedItems = useMemo(()=>isSearching && !isSearchingInitialItems ? searchedItems : items, [
77
+ isSearching,
78
+ isSearchingInitialItems,
79
+ searchedItems,
80
+ items
81
+ ]);
53
82
  const startTransition = useCallback((direction)=>{
54
83
  if (transitionTimeoutRef.current) clearTimeout(transitionTimeoutRef.current);
55
84
  setIsTransitioning(true);
@@ -58,11 +87,22 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
58
87
  setIsTransitioning(false);
59
88
  }, TRANSITION_DURATION);
60
89
  }, []);
90
+ const navigateToIndex = useCallback((index)=>{
91
+ setActiveIndex(index);
92
+ if (index === SEARCH_BAR_INDEX) return void searchInputRef.current?.focus();
93
+ listRef.current?.scrollToRow({
94
+ index,
95
+ align: 'auto'
96
+ });
97
+ }, [
98
+ listRef
99
+ ]);
61
100
  const clearSearch = useCallback(()=>{
62
101
  setSearch('');
63
102
  setSearchedItems([]);
64
103
  setSearchLoading(false);
65
104
  setIsSearchingInitialItems(true);
105
+ setActiveIndex(SEARCH_BAR_INDEX);
66
106
  }, []);
67
107
  const handleSearch = useCallback(async (query)=>{
68
108
  if (!query.trim()) {
@@ -73,6 +113,7 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
73
113
  return;
74
114
  }
75
115
  setSearch(query);
116
+ setActiveIndex(SEARCH_BAR_INDEX);
76
117
  searchIdRef.current += 1;
77
118
  const currentRequestId = searchIdRef.current;
78
119
  setSearchLoading(true);
@@ -93,6 +134,7 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
93
134
  ]);
94
135
  const handleBackTransition = useCallback(()=>{
95
136
  startTransition('back');
137
+ setActiveIndex(SEARCH_BAR_INDEX);
96
138
  const previousState = navigationStack.pop();
97
139
  if (previousState) {
98
140
  setItems(previousState.data.items);
@@ -121,6 +163,7 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
121
163
  setItems(nestedItems);
122
164
  setCurrentParentItem(item);
123
165
  clearSearch();
166
+ setActiveIndex(SEARCH_BAR_INDEX);
124
167
  startTransition('forward');
125
168
  setChildrenLoading(false);
126
169
  }, [
@@ -178,6 +221,96 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
178
221
  }, [
179
222
  items
180
223
  ]);
224
+ const activeDescendantId = useMemo(()=>{
225
+ if (activeIndex < 0) return;
226
+ const renderItem = listViewRef.current?.renderedItems[activeIndex];
227
+ if (renderItem?.type === 'item') return `toolbox-item-${renderItem.item.id}`;
228
+ }, [
229
+ activeIndex
230
+ ]);
231
+ const handleNavigationKeyDown = useCallback((e)=>{
232
+ if (isTransitioning) return;
233
+ const renderedItems = listViewRef.current?.renderedItems ?? [];
234
+ const navigateDown = ()=>{
235
+ if (activeIndex === SEARCH_BAR_INDEX) {
236
+ const firstIndex = getFirstSelectableIndex(renderedItems);
237
+ if (firstIndex !== SEARCH_BAR_INDEX) navigateToIndex(firstIndex);
238
+ } else {
239
+ const nextIndex = getNextSelectableIndex(renderedItems, activeIndex, 'down');
240
+ if (nextIndex !== SEARCH_BAR_INDEX) navigateToIndex(nextIndex);
241
+ else {
242
+ const firstIndex = getFirstSelectableIndex(renderedItems);
243
+ if (firstIndex !== SEARCH_BAR_INDEX) navigateToIndex(firstIndex);
244
+ }
245
+ }
246
+ };
247
+ const navigateUp = ()=>{
248
+ navigateToIndex(getNextSelectableIndex(renderedItems, activeIndex, 'up'));
249
+ };
250
+ switch(e.key){
251
+ case 'ArrowDown':
252
+ e.preventDefault();
253
+ navigateDown();
254
+ break;
255
+ case 'ArrowUp':
256
+ e.preventDefault();
257
+ navigateUp();
258
+ break;
259
+ case 'Enter':
260
+ {
261
+ if (activeIndex === SEARCH_BAR_INDEX) break;
262
+ const renderItem = renderedItems[activeIndex];
263
+ if (renderItem?.type === 'item') {
264
+ e.preventDefault();
265
+ handleItemSelect(renderItem.item);
266
+ }
267
+ break;
268
+ }
269
+ case 'ArrowRight':
270
+ {
271
+ const renderItem = renderedItems[activeIndex];
272
+ if (renderItem?.type === 'item' && renderItem.item.children) {
273
+ e.preventDefault();
274
+ handleItemSelect(renderItem.item);
275
+ }
276
+ break;
277
+ }
278
+ case 'ArrowLeft':
279
+ if (!navigationStack.canGoBack || activeIndex === SEARCH_BAR_INDEX && search.length > 0) return;
280
+ e.preventDefault();
281
+ handleBackTransition();
282
+ break;
283
+ case 'Tab':
284
+ e.preventDefault();
285
+ if (e.shiftKey) navigateUp();
286
+ else navigateDown();
287
+ break;
288
+ case 'Home':
289
+ {
290
+ if (activeIndex === SEARCH_BAR_INDEX) break;
291
+ e.preventDefault();
292
+ const firstIndex = getFirstSelectableIndex(renderedItems);
293
+ if (firstIndex !== SEARCH_BAR_INDEX) navigateToIndex(firstIndex);
294
+ break;
295
+ }
296
+ case 'End':
297
+ {
298
+ if (activeIndex === SEARCH_BAR_INDEX) break;
299
+ e.preventDefault();
300
+ const lastIndex = getLastSelectableIndex(renderedItems);
301
+ if (lastIndex !== SEARCH_BAR_INDEX) navigateToIndex(lastIndex);
302
+ break;
303
+ }
304
+ }
305
+ }, [
306
+ search,
307
+ isTransitioning,
308
+ activeIndex,
309
+ navigationStack.canGoBack,
310
+ navigateToIndex,
311
+ handleItemSelect,
312
+ handleBackTransition
313
+ ]);
181
314
  useEffect(()=>{
182
315
  const handleKeyDown = (e)=>{
183
316
  if ('Escape' === e.key) if (isSearching) {
@@ -223,19 +356,25 @@ function Toolbox({ onClose, onBack, onItemSelect, onSearch, onItemHover, title,
223
356
  value: search,
224
357
  onChange: handleSearch,
225
358
  clear: clearSearch,
226
- placeholder: "Search"
359
+ placeholder: "Search",
360
+ inputRef: searchInputRef,
361
+ onNavigationKeyDown: handleNavigationKeyDown,
362
+ activeDescendantId: activeDescendantId
227
363
  }),
228
364
  /*#__PURE__*/ jsx(AnimatedContainer, {
229
365
  children: /*#__PURE__*/ jsx(AnimatedContent, {
230
366
  entering: isTransitioning,
231
367
  direction: animationDirection,
232
368
  children: /*#__PURE__*/ jsx(ListView, {
369
+ ref: listViewRef,
233
370
  isLoading: childrenLoading || searchLoading || loading,
234
- items: isSearching && !isSearchingInitialItems ? searchedItems : items,
371
+ items: displayedItems,
372
+ activeIndex: activeIndex,
373
+ listRef: listRef,
235
374
  emptyStateMessage: isSearching ? 'No matching nodes found' : 'No nodes found',
236
- enableSections: !isSearching,
237
375
  onItemClick: handleItemSelect,
238
- onItemHover: onItemHover
376
+ onItemHover: onItemHover,
377
+ enableSections: !isSearching
239
378
  })
240
379
  })
241
380
  })
@@ -1 +1 @@
1
- {"version":3,"file":"CategoryTree.d.ts","sourceRoot":"","sources":["../../../src/canvas/core/CategoryTree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAKhF,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB;IACxD,gBAAgB,EAAE,gBAAgB,EAAE,CAAC;IACrC,KAAK,EAAE,YAAY,EAAE,CAAC;CACvB;AAKD,MAAM,WAAW,yBAAyB;IAExC,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,gBAAgB,KAAK,OAAO,CAAC;IAEzD,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC;CAC9C;AAMD,MAAM,WAAW,mBAAmB;IAMlC,4BAA4B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;IAO1D,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC3C;AA8BD,qBAAa,YAAY;IACvB,OAAO,CAAC,cAAc,CAAqB;IAC3C,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,WAAW,CAAgC;gBAQvC,UAAU,EAAE,gBAAgB,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE;IAYjE,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAmBxE,MAAM,CAAC,YAAY,CAAC,cAAc,EAAE,gBAAgB,EAAE,EAAE,SAAS,EAA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,6 @@
1
1
  {
2
2
  "name": "@uipath/apollo-react",
3
- "version": "3.55.0-pr356.b109b65",
3
+ "version": "3.55.1-pr354.8826816",
4
4
  "description": "Apollo Design System - React component library with Material UI theming",
5
5
  "repository": {
6
6
  "type": "git",
@@ -184,7 +184,7 @@
184
184
  "lodash": "^4.17.23",
185
185
  "lucide-react": "^0.555.0",
186
186
  "luxon": "^3.7.1",
187
- "mermaid": "^11.12.2",
187
+ "mermaid": "^11.13.0",
188
188
  "motion": "^12.23.12",
189
189
  "react-dropzone": "^14.3.8",
190
190
  "react-focus-lock": "^2.13.7",
@@ -201,7 +201,7 @@
201
201
  "zod": "^4.3.5",
202
202
  "zustand": "^5.0.9",
203
203
  "@uipath/apollo-core": "5.7.3",
204
- "@uipath/apollo-wind": "0.15.3"
204
+ "@uipath/apollo-wind": "1.0.1"
205
205
  },
206
206
  "devDependencies": {
207
207
  "@lingui/cli": "^5.6.1",
@@ -1,48 +0,0 @@
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
- preserveNewlines: ()=>preserveNewlines
28
- });
29
- const preserveNewlines = (markdown)=>{
30
- const codeBlocks = [];
31
- let result = markdown.replace(/```[\s\S]*?```/g, (m)=>{
32
- codeBlocks.push(m);
33
- return `\n%%CODE_BLOCK_${codeBlocks.length - 1}%%\n`;
34
- });
35
- result = result.replace(/\n{3,}/g, (match)=>{
36
- const extraBreaks = match.length - 2;
37
- return `\n\n${'&nbsp;\n\n'.repeat(extraBreaks)}`;
38
- });
39
- result = result.replace(/%%CODE_BLOCK_(\d+)%%/g, (_, i)=>codeBlocks[Number(i)] ?? '');
40
- return result;
41
- };
42
- exports.preserveNewlines = __webpack_exports__.preserveNewlines;
43
- for(var __rspack_i in __webpack_exports__)if (-1 === [
44
- "preserveNewlines"
45
- ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
46
- Object.defineProperty(exports, '__esModule', {
47
- value: true
48
- });
@@ -1,2 +0,0 @@
1
- export declare const preserveNewlines: (markdown: string) => string;
2
- //# sourceMappingURL=StickyNoteNode.utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StickyNoteNode.utils.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/StickyNoteNode/StickyNoteNode.utils.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,GAAI,UAAU,MAAM,KAAG,MAqBnD,CAAC"}
@@ -1,14 +0,0 @@
1
- const preserveNewlines = (markdown)=>{
2
- const codeBlocks = [];
3
- let result = markdown.replace(/```[\s\S]*?```/g, (m)=>{
4
- codeBlocks.push(m);
5
- return `\n%%CODE_BLOCK_${codeBlocks.length - 1}%%\n`;
6
- });
7
- result = result.replace(/\n{3,}/g, (match)=>{
8
- const extraBreaks = match.length - 2;
9
- return `\n\n${'&nbsp;\n\n'.repeat(extraBreaks)}`;
10
- });
11
- result = result.replace(/%%CODE_BLOCK_(\d+)%%/g, (_, i)=>codeBlocks[Number(i)] ?? '');
12
- return result;
13
- };
14
- export { preserveNewlines };