@primer/react 38.32.0-rc.7fd08e0cc → 38.32.0-rc.85de10233
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/CHANGELOG.md +8 -0
- package/dist/ActionBar/ActionBar.js +130 -424
- package/dist/FilteredActionList/FilteredActionList.js +66 -155
- package/dist/FilteredActionList/useAnnouncements.js +66 -138
- package/dist/LabelGroup/LabelGroup.js +76 -110
- package/dist/Overlay/Overlay.js +45 -169
- package/dist/TextInput/TextInput.js +7 -7
- package/dist/ToggleSwitch/ToggleSwitch.js +167 -186
- package/dist/TreeView/TreeView.js +309 -814
- package/dist/UnderlineNav/UnderlineNav-a06bbc74.css +2 -0
- package/dist/UnderlineNav/UnderlineNav-a06bbc74.css.map +1 -0
- package/dist/UnderlineNav/UnderlineNav.d.ts +5 -0
- package/dist/UnderlineNav/UnderlineNav.js +136 -129
- package/dist/UnderlineNav/UnderlineNav.module.css.js +2 -1
- package/dist/experimental/UnderlinePanels/UnderlinePanels.js +38 -95
- package/dist/hooks/useControllableState.js +3 -3
- package/dist/hooks/useMedia.js +44 -43
- package/dist/internal/components/UnderlineTabbedInterface-25587345.css +2 -0
- package/dist/internal/components/UnderlineTabbedInterface-25587345.css.map +1 -0
- package/dist/internal/components/UnderlineTabbedInterface.module.css.js +1 -1
- package/dist/internal/components/ValidationAnimationContainer.js +40 -34
- package/package.json +3 -1
- package/dist/UnderlineNav/UnderlineNav-47547980.css +0 -2
- package/dist/UnderlineNav/UnderlineNav-47547980.css.map +0 -1
- package/dist/internal/components/UnderlineTabbedInterface-1745a3d6.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-1745a3d6.css.map +0 -1
|
@@ -22,10 +22,9 @@ import { getFirstChildElement, useRovingTabIndex } from "./useRovingTabIndex.js"
|
|
|
22
22
|
import { useTypeahead } from "./useTypeahead.js";
|
|
23
23
|
import { SkeletonAvatar } from "../SkeletonAvatar/SkeletonAvatar.js";
|
|
24
24
|
import { SkeletonText } from "../SkeletonText/SkeletonText.js";
|
|
25
|
-
import { c } from "react-compiler-runtime";
|
|
26
25
|
import { clsx } from "clsx";
|
|
27
26
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
28
|
-
import React, { useEffect } from "react";
|
|
27
|
+
import React, { useCallback, useEffect } from "react";
|
|
29
28
|
import { ChevronDownIcon, ChevronRightIcon, FileDirectoryFillIcon, FileDirectoryOpenFillIcon } from "@primer/octicons-react";
|
|
30
29
|
//#region src/TreeView/TreeView.tsx
|
|
31
30
|
const RootContext = /*#__PURE__*/ React.createContext({
|
|
@@ -46,168 +45,79 @@ const ItemContext = /*#__PURE__*/ React.createContext({
|
|
|
46
45
|
});
|
|
47
46
|
const LoadingPlaceholderContext = /*#__PURE__*/ React.createContext(false);
|
|
48
47
|
const TOGGLE_ICON_SIZE = 12;
|
|
49
|
-
const Root = (
|
|
50
|
-
const $ = c(26);
|
|
51
|
-
const { "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, children, flat, truncate: t1, className, style } = t0;
|
|
52
|
-
const truncate = t1 === void 0 ? true : t1;
|
|
48
|
+
const Root = ({ "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, children, flat, truncate = true, className, style }) => {
|
|
53
49
|
const containerRef = React.useRef(null);
|
|
54
50
|
const mouseDownRef = React.useRef(false);
|
|
55
51
|
const [ariaLiveMessage, setAriaLiveMessage] = React.useState("");
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
$[1] = t3;
|
|
70
|
-
} else t3 = $[1];
|
|
71
|
-
const onMouseDown = t3;
|
|
72
|
-
let t4;
|
|
73
|
-
let t5;
|
|
74
|
-
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
75
|
-
t4 = () => {
|
|
76
|
-
const onMouseUp = function onMouseUp() {
|
|
77
|
-
mouseDownRef.current = false;
|
|
78
|
-
};
|
|
79
|
-
document.addEventListener("mouseup", onMouseUp);
|
|
80
|
-
return () => {
|
|
81
|
-
document.removeEventListener("mouseup", onMouseUp);
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
t5 = [];
|
|
85
|
-
$[2] = t4;
|
|
86
|
-
$[3] = t5;
|
|
87
|
-
} else {
|
|
88
|
-
t4 = $[2];
|
|
89
|
-
t5 = $[3];
|
|
90
|
-
}
|
|
91
|
-
useEffect(t4, t5);
|
|
92
|
-
let t6;
|
|
93
|
-
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
94
|
-
t6 = {
|
|
95
|
-
containerRef,
|
|
96
|
-
mouseDownRef
|
|
97
|
-
};
|
|
98
|
-
$[4] = t6;
|
|
99
|
-
} else t6 = $[4];
|
|
100
|
-
useRovingTabIndex(t6);
|
|
101
|
-
let t7;
|
|
102
|
-
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
103
|
-
t7 = {
|
|
104
|
-
containerRef,
|
|
105
|
-
onFocusChange: _temp
|
|
52
|
+
const announceUpdate = React.useCallback((message) => {
|
|
53
|
+
setAriaLiveMessage(message);
|
|
54
|
+
}, []);
|
|
55
|
+
const onMouseDown = useCallback(() => {
|
|
56
|
+
mouseDownRef.current = true;
|
|
57
|
+
}, []);
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
function onMouseUp() {
|
|
60
|
+
mouseDownRef.current = false;
|
|
61
|
+
}
|
|
62
|
+
document.addEventListener("mouseup", onMouseUp);
|
|
63
|
+
return () => {
|
|
64
|
+
document.removeEventListener("mouseup", onMouseUp);
|
|
106
65
|
};
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
66
|
+
}, []);
|
|
67
|
+
useRovingTabIndex({
|
|
68
|
+
containerRef,
|
|
69
|
+
mouseDownRef
|
|
70
|
+
});
|
|
71
|
+
useTypeahead({
|
|
72
|
+
containerRef,
|
|
73
|
+
onFocusChange: (element) => {
|
|
74
|
+
if (element instanceof HTMLElement) element.focus();
|
|
75
|
+
}
|
|
76
|
+
});
|
|
110
77
|
const pendingScrollRef = React.useRef(null);
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
block: "nearest",
|
|
121
|
-
inline: "nearest"
|
|
122
|
-
});
|
|
78
|
+
const scrollElementIntoView = useCallback((element) => {
|
|
79
|
+
if (!element) return;
|
|
80
|
+
if (pendingScrollRef.current !== null) cancelAnimationFrame(pendingScrollRef.current);
|
|
81
|
+
pendingScrollRef.current = requestAnimationFrame(() => {
|
|
82
|
+
pendingScrollRef.current = null;
|
|
83
|
+
if (!element.isConnected) return;
|
|
84
|
+
element.scrollIntoView({
|
|
85
|
+
block: "nearest",
|
|
86
|
+
inline: "nearest"
|
|
123
87
|
});
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
let t10;
|
|
129
|
-
let t9;
|
|
130
|
-
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
131
|
-
t9 = () => () => {
|
|
88
|
+
});
|
|
89
|
+
}, []);
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
return () => {
|
|
132
92
|
if (pendingScrollRef.current !== null) cancelAnimationFrame(pendingScrollRef.current);
|
|
133
93
|
};
|
|
134
|
-
|
|
135
|
-
$[7] = t10;
|
|
136
|
-
$[8] = t9;
|
|
137
|
-
} else {
|
|
138
|
-
t10 = $[7];
|
|
139
|
-
t9 = $[8];
|
|
140
|
-
}
|
|
141
|
-
useEffect(t9, t10);
|
|
94
|
+
}, []);
|
|
142
95
|
const expandedStateCache = React.useRef(null);
|
|
143
|
-
if (expandedStateCache.current === null)
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
t11 = /* @__PURE__ */ new Map();
|
|
147
|
-
$[9] = t11;
|
|
148
|
-
} else t11 = $[9];
|
|
149
|
-
expandedStateCache.current = t11;
|
|
150
|
-
}
|
|
151
|
-
let t11;
|
|
152
|
-
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
153
|
-
t11 = {
|
|
96
|
+
if (expandedStateCache.current === null) expandedStateCache.current = /* @__PURE__ */ new Map();
|
|
97
|
+
return /*#__PURE__*/ jsx(RootContext.Provider, {
|
|
98
|
+
value: {
|
|
154
99
|
announceUpdate,
|
|
155
100
|
expandedStateCache,
|
|
156
101
|
scrollElementIntoView
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
} else t11 = $[10];
|
|
160
|
-
let t12;
|
|
161
|
-
if ($[11] !== ariaLiveMessage) {
|
|
162
|
-
t12 = /*#__PURE__*/ jsx(VisuallyHidden, { children: /*#__PURE__*/ jsx(AriaStatus, {
|
|
102
|
+
},
|
|
103
|
+
children: /*#__PURE__*/ jsxs(Fragment, { children: [/*#__PURE__*/ jsx(VisuallyHidden, { children: /*#__PURE__*/ jsx(AriaStatus, {
|
|
163
104
|
announceOnShow: true,
|
|
164
105
|
children: ariaLiveMessage
|
|
165
|
-
}) })
|
|
166
|
-
$[11] = ariaLiveMessage;
|
|
167
|
-
$[12] = t12;
|
|
168
|
-
} else t12 = $[12];
|
|
169
|
-
const t13 = truncate || false;
|
|
170
|
-
let t14;
|
|
171
|
-
if ($[13] !== className) {
|
|
172
|
-
t14 = clsx(className, TreeView_module_css_default.TreeViewRootUlStyles);
|
|
173
|
-
$[13] = className;
|
|
174
|
-
$[14] = t14;
|
|
175
|
-
} else t14 = $[14];
|
|
176
|
-
let t15;
|
|
177
|
-
if ($[15] !== ariaLabel || $[16] !== ariaLabelledby || $[17] !== children || $[18] !== flat || $[19] !== style || $[20] !== t13 || $[21] !== t14) {
|
|
178
|
-
t15 = /*#__PURE__*/ jsx("ul", {
|
|
106
|
+
}) }), /*#__PURE__*/ jsx("ul", {
|
|
179
107
|
ref: containerRef,
|
|
180
108
|
role: "tree",
|
|
181
109
|
"aria-label": ariaLabel,
|
|
182
110
|
"aria-labelledby": ariaLabelledby,
|
|
183
111
|
"data-omit-spacer": flat,
|
|
184
|
-
"data-truncate-text":
|
|
112
|
+
"data-truncate-text": truncate || false,
|
|
185
113
|
onMouseDown,
|
|
186
|
-
className:
|
|
114
|
+
className: clsx(className, TreeView_module_css_default.TreeViewRootUlStyles),
|
|
187
115
|
style,
|
|
188
116
|
children
|
|
189
|
-
})
|
|
190
|
-
|
|
191
|
-
$[16] = ariaLabelledby;
|
|
192
|
-
$[17] = children;
|
|
193
|
-
$[18] = flat;
|
|
194
|
-
$[19] = style;
|
|
195
|
-
$[20] = t13;
|
|
196
|
-
$[21] = t14;
|
|
197
|
-
$[22] = t15;
|
|
198
|
-
} else t15 = $[22];
|
|
199
|
-
let t16;
|
|
200
|
-
if ($[23] !== t12 || $[24] !== t15) {
|
|
201
|
-
t16 = /*#__PURE__*/ jsx(RootContext.Provider, {
|
|
202
|
-
value: t11,
|
|
203
|
-
children: /*#__PURE__*/ jsxs(Fragment, { children: [t12, t15] })
|
|
204
|
-
});
|
|
205
|
-
$[23] = t12;
|
|
206
|
-
$[24] = t15;
|
|
207
|
-
$[25] = t16;
|
|
208
|
-
} else t16 = $[25];
|
|
209
|
-
return t16;
|
|
117
|
+
})] })
|
|
118
|
+
});
|
|
210
119
|
};
|
|
120
|
+
Root.displayName = "Root";
|
|
211
121
|
Root.displayName = "TreeView";
|
|
212
122
|
const ItemImpl = fixedForwardRef(({ id: itemId, containIntrinsicSize, current: isCurrentItem = false, defaultExpanded, expanded, onExpandedChange, onSelect, children, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, secondaryActions, as: Component, ...restProps }, ref) => {
|
|
213
123
|
const ItemElement = Component !== null && Component !== void 0 ? Component : "li";
|
|
@@ -390,31 +300,17 @@ const ItemImpl = fixedForwardRef(({ id: itemId, containIntrinsicSize, current: i
|
|
|
390
300
|
});
|
|
391
301
|
const Item = Object.assign(ItemImpl, { displayName: "TreeView.Item" });
|
|
392
302
|
/** Lines to indicate the depth of an item in a TreeView */
|
|
393
|
-
const LevelIndicatorLines = (
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
let t1;
|
|
397
|
-
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
398
|
-
t1 = {
|
|
303
|
+
const LevelIndicatorLines = ({ level }) => {
|
|
304
|
+
return /*#__PURE__*/ jsx("div", {
|
|
305
|
+
style: {
|
|
399
306
|
width: "100%",
|
|
400
307
|
display: "flex"
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
}
|
|
404
|
-
let t2;
|
|
405
|
-
if ($[1] !== level) {
|
|
406
|
-
t2 = /*#__PURE__*/ jsx("div", {
|
|
407
|
-
style: t1,
|
|
408
|
-
children: Array.from({ length: level - 1 }).map(_temp2)
|
|
409
|
-
});
|
|
410
|
-
$[1] = level;
|
|
411
|
-
$[2] = t2;
|
|
412
|
-
} else t2 = $[2];
|
|
413
|
-
return t2;
|
|
308
|
+
},
|
|
309
|
+
children: Array.from({ length: level - 1 }).map((_, index) => /*#__PURE__*/ jsx("div", { className: clsx("PRIVATE_TreeView-item-level-line", TreeView_module_css_default.TreeViewItemLevelLine) }, index))
|
|
310
|
+
});
|
|
414
311
|
};
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
const { count, state, children, "aria-label": ariaLabel } = t0;
|
|
312
|
+
LevelIndicatorLines.displayName = "LevelIndicatorLines";
|
|
313
|
+
const SubTree = ({ count, state, children, "aria-label": ariaLabel }) => {
|
|
418
314
|
const { announceUpdate } = React.useContext(RootContext);
|
|
419
315
|
const { itemId, isExpanded, isSubTreeEmpty, setIsSubTreeEmpty } = React.useContext(ItemContext);
|
|
420
316
|
const loadingItemRef = React.useRef(null);
|
|
@@ -423,151 +319,80 @@ const SubTree = (t0) => {
|
|
|
423
319
|
const [subTreeLabel, setSubTreeLabel] = React.useState("");
|
|
424
320
|
const previousState = usePreviousValue(state);
|
|
425
321
|
const { safeSetTimeout } = useSafeTimeout();
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
if ($[6] !== announceUpdate || $[7] !== itemId || $[8] !== loadingFocused || $[9] !== previousState || $[10] !== safeSetTimeout || $[11] !== state) {
|
|
455
|
-
t3 = () => {
|
|
456
|
-
const parentElement = document.getElementById(itemId);
|
|
457
|
-
if (!parentElement) return;
|
|
458
|
-
setSubTreeLabel(getAccessibleName(parentElement));
|
|
459
|
-
if (previousState === "loading" && state === "done") {
|
|
460
|
-
var _ref$current;
|
|
461
|
-
const parentName = getAccessibleName(parentElement);
|
|
462
|
-
if ((_ref$current = ref.current) !== null && _ref$current !== void 0 && _ref$current.childElementCount) announceUpdate(`${parentName} content loaded`);
|
|
463
|
-
else announceUpdate(`${parentName} is empty`);
|
|
464
|
-
if (loadingFocused) {
|
|
465
|
-
const firstChild = getFirstChildElement(parentElement);
|
|
466
|
-
if (firstChild) safeSetTimeout(() => {
|
|
467
|
-
firstChild.focus();
|
|
468
|
-
});
|
|
469
|
-
else safeSetTimeout(() => {
|
|
470
|
-
parentElement.focus();
|
|
471
|
-
});
|
|
472
|
-
setLoadingFocused(false);
|
|
473
|
-
}
|
|
474
|
-
} else if (state === "loading") announceUpdate(`${getAccessibleName(parentElement)} content loading`);
|
|
475
|
-
};
|
|
476
|
-
t4 = [
|
|
477
|
-
loadingFocused,
|
|
478
|
-
previousState,
|
|
479
|
-
state,
|
|
480
|
-
itemId,
|
|
481
|
-
announceUpdate,
|
|
482
|
-
ref,
|
|
483
|
-
safeSetTimeout
|
|
484
|
-
];
|
|
485
|
-
$[6] = announceUpdate;
|
|
486
|
-
$[7] = itemId;
|
|
487
|
-
$[8] = loadingFocused;
|
|
488
|
-
$[9] = previousState;
|
|
489
|
-
$[10] = safeSetTimeout;
|
|
490
|
-
$[11] = state;
|
|
491
|
-
$[12] = t3;
|
|
492
|
-
$[13] = t4;
|
|
493
|
-
} else {
|
|
494
|
-
t3 = $[12];
|
|
495
|
-
t4 = $[13];
|
|
496
|
-
}
|
|
497
|
-
React.useEffect(t3, t4);
|
|
498
|
-
let t5;
|
|
499
|
-
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
500
|
-
t5 = () => {
|
|
501
|
-
const handleFocus = function handleFocus() {
|
|
502
|
-
setLoadingFocused(true);
|
|
503
|
-
};
|
|
504
|
-
const handleBlur = function handleBlur(event) {
|
|
505
|
-
if (!event.relatedTarget) return;
|
|
322
|
+
React.useEffect(() => {
|
|
323
|
+
if (state === void 0 || state === "done") {
|
|
324
|
+
if (!isSubTreeEmpty && !children) setIsSubTreeEmpty(true);
|
|
325
|
+
else if (isSubTreeEmpty && children) setIsSubTreeEmpty(false);
|
|
326
|
+
}
|
|
327
|
+
}, [
|
|
328
|
+
state,
|
|
329
|
+
isSubTreeEmpty,
|
|
330
|
+
setIsSubTreeEmpty,
|
|
331
|
+
children
|
|
332
|
+
]);
|
|
333
|
+
React.useEffect(() => {
|
|
334
|
+
const parentElement = document.getElementById(itemId);
|
|
335
|
+
if (!parentElement) return;
|
|
336
|
+
setSubTreeLabel(getAccessibleName(parentElement));
|
|
337
|
+
if (previousState === "loading" && state === "done") {
|
|
338
|
+
var _ref$current;
|
|
339
|
+
const parentName = getAccessibleName(parentElement);
|
|
340
|
+
if ((_ref$current = ref.current) !== null && _ref$current !== void 0 && _ref$current.childElementCount) announceUpdate(`${parentName} content loaded`);
|
|
341
|
+
else announceUpdate(`${parentName} is empty`);
|
|
342
|
+
if (loadingFocused) {
|
|
343
|
+
const firstChild = getFirstChildElement(parentElement);
|
|
344
|
+
if (firstChild) safeSetTimeout(() => {
|
|
345
|
+
firstChild.focus();
|
|
346
|
+
});
|
|
347
|
+
else safeSetTimeout(() => {
|
|
348
|
+
parentElement.focus();
|
|
349
|
+
});
|
|
506
350
|
setLoadingFocused(false);
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
351
|
+
}
|
|
352
|
+
} else if (state === "loading") announceUpdate(`${getAccessibleName(parentElement)} content loading`);
|
|
353
|
+
}, [
|
|
354
|
+
loadingFocused,
|
|
355
|
+
previousState,
|
|
356
|
+
state,
|
|
357
|
+
itemId,
|
|
358
|
+
announceUpdate,
|
|
359
|
+
ref,
|
|
360
|
+
safeSetTimeout
|
|
361
|
+
]);
|
|
362
|
+
React.useEffect(() => {
|
|
363
|
+
function handleFocus() {
|
|
364
|
+
setLoadingFocused(true);
|
|
365
|
+
}
|
|
366
|
+
function handleBlur(event) {
|
|
367
|
+
if (!event.relatedTarget) return;
|
|
368
|
+
setLoadingFocused(false);
|
|
369
|
+
}
|
|
370
|
+
const loadingElement = loadingItemRef.current;
|
|
371
|
+
if (!loadingElement) return;
|
|
372
|
+
loadingElement.addEventListener("focus", handleFocus);
|
|
373
|
+
loadingElement.addEventListener("blur", handleBlur);
|
|
374
|
+
return () => {
|
|
375
|
+
loadingElement.removeEventListener("focus", handleFocus);
|
|
376
|
+
loadingElement.removeEventListener("blur", handleBlur);
|
|
516
377
|
};
|
|
517
|
-
|
|
518
|
-
} else t5 = $[14];
|
|
519
|
-
let t6;
|
|
520
|
-
if ($[15] !== state) {
|
|
521
|
-
t6 = [loadingItemRef, state];
|
|
522
|
-
$[15] = state;
|
|
523
|
-
$[16] = t6;
|
|
524
|
-
} else t6 = $[16];
|
|
525
|
-
React.useEffect(t5, t6);
|
|
378
|
+
}, [loadingItemRef, state]);
|
|
526
379
|
if (!isExpanded) return null;
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
380
|
+
return /*#__PURE__*/ jsxs("ul", {
|
|
381
|
+
role: "group",
|
|
382
|
+
style: {
|
|
530
383
|
listStyle: "none",
|
|
531
384
|
padding: 0,
|
|
532
385
|
margin: 0
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
let t9;
|
|
538
|
-
if ($[18] !== children || $[19] !== count || $[20] !== state) {
|
|
539
|
-
t9 = state === "loading" ? /*#__PURE__*/ jsx(LoadingItem, {
|
|
386
|
+
},
|
|
387
|
+
ref,
|
|
388
|
+
"aria-label": ariaLabel || subTreeLabel,
|
|
389
|
+
children: [state === "loading" ? /*#__PURE__*/ jsx(LoadingItem, {
|
|
540
390
|
ref: loadingItemRef,
|
|
541
391
|
count
|
|
542
|
-
}) : children
|
|
543
|
-
|
|
544
|
-
$[19] = count;
|
|
545
|
-
$[20] = state;
|
|
546
|
-
$[21] = t9;
|
|
547
|
-
} else t9 = $[21];
|
|
548
|
-
let t10;
|
|
549
|
-
if ($[22] !== isSubTreeEmpty || $[23] !== state) {
|
|
550
|
-
t10 = isSubTreeEmpty && state !== "loading" ? /*#__PURE__*/ jsx(EmptyItem, {}) : null;
|
|
551
|
-
$[22] = isSubTreeEmpty;
|
|
552
|
-
$[23] = state;
|
|
553
|
-
$[24] = t10;
|
|
554
|
-
} else t10 = $[24];
|
|
555
|
-
let t11;
|
|
556
|
-
if ($[25] !== t10 || $[26] !== t8 || $[27] !== t9) {
|
|
557
|
-
t11 = /*#__PURE__*/ jsxs("ul", {
|
|
558
|
-
role: "group",
|
|
559
|
-
style: t7,
|
|
560
|
-
ref,
|
|
561
|
-
"aria-label": t8,
|
|
562
|
-
children: [t9, t10]
|
|
563
|
-
});
|
|
564
|
-
$[25] = t10;
|
|
565
|
-
$[26] = t8;
|
|
566
|
-
$[27] = t9;
|
|
567
|
-
$[28] = t11;
|
|
568
|
-
} else t11 = $[28];
|
|
569
|
-
return t11;
|
|
392
|
+
}) : children, isSubTreeEmpty && state !== "loading" ? /*#__PURE__*/ jsx(EmptyItem, {}) : null]
|
|
393
|
+
});
|
|
570
394
|
};
|
|
395
|
+
SubTree.displayName = "SubTree";
|
|
571
396
|
SubTree.displayName = "TreeView.SubTree";
|
|
572
397
|
SubTree.__SLOT__ = Symbol("TreeView.SubTree");
|
|
573
398
|
function usePreviousValue(value) {
|
|
@@ -578,516 +403,238 @@ function usePreviousValue(value) {
|
|
|
578
403
|
return ref.current;
|
|
579
404
|
}
|
|
580
405
|
const SkeletonItem = () => {
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
square: true
|
|
589
|
-
}), /*#__PURE__*/ jsx(SkeletonText, { className: TreeView_module_css_default.TreeItemSkeletonTextStyles })]
|
|
590
|
-
});
|
|
591
|
-
$[0] = t0;
|
|
592
|
-
} else t0 = $[0];
|
|
593
|
-
return t0;
|
|
406
|
+
return /*#__PURE__*/ jsxs("span", {
|
|
407
|
+
className: clsx(TreeView_module_css_default.TreeViewSkeletonItemContainerStyle, TreeView_module_css_default.TreeViewItemSkeleton, "PRIVATE_TreeView-item-skeleton"),
|
|
408
|
+
children: [/*#__PURE__*/ jsx(SkeletonAvatar, {
|
|
409
|
+
size: 16,
|
|
410
|
+
square: true
|
|
411
|
+
}), /*#__PURE__*/ jsx(SkeletonText, { className: TreeView_module_css_default.TreeItemSkeletonTextStyles })]
|
|
412
|
+
});
|
|
594
413
|
};
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
const { count } = t0;
|
|
414
|
+
SkeletonItem.displayName = "SkeletonItem";
|
|
415
|
+
const LoadingItem = /*#__PURE__*/ React.forwardRef(({ count }, ref) => {
|
|
598
416
|
const itemId = useId$1();
|
|
599
|
-
if (count) {
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
609
|
-
t3 = clsx("PRIVATE_VisuallyHidden", TreeView_module_css_default.TreeViewVisuallyHidden);
|
|
610
|
-
$[2] = t3;
|
|
611
|
-
} else t3 = $[2];
|
|
612
|
-
let t4;
|
|
613
|
-
if ($[3] !== count) {
|
|
614
|
-
t4 = /*#__PURE__*/ jsxs("div", {
|
|
615
|
-
className: t3,
|
|
417
|
+
if (count) return /*#__PURE__*/ jsx(LoadingPlaceholderContext.Provider, {
|
|
418
|
+
value: true,
|
|
419
|
+
children: /*#__PURE__*/ jsxs(Item, {
|
|
420
|
+
id: itemId,
|
|
421
|
+
ref,
|
|
422
|
+
children: [Array.from({ length: count }).map((_, i) => {
|
|
423
|
+
return /*#__PURE__*/ jsx(SkeletonItem, { "aria-hidden": true }, i);
|
|
424
|
+
}), /*#__PURE__*/ jsxs("div", {
|
|
425
|
+
className: clsx("PRIVATE_VisuallyHidden", TreeView_module_css_default.TreeViewVisuallyHidden),
|
|
616
426
|
children: [
|
|
617
427
|
"Loading ",
|
|
618
428
|
count,
|
|
619
429
|
" items"
|
|
620
430
|
]
|
|
621
|
-
})
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
$[5] = itemId;
|
|
636
|
-
$[6] = t1;
|
|
637
|
-
$[7] = t2;
|
|
638
|
-
$[8] = t4;
|
|
639
|
-
$[9] = t5;
|
|
640
|
-
} else t5 = $[9];
|
|
641
|
-
return t5;
|
|
642
|
-
}
|
|
643
|
-
const t1 = ref;
|
|
644
|
-
let t2;
|
|
645
|
-
let t3;
|
|
646
|
-
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
647
|
-
t2 = /*#__PURE__*/ jsx(LeadingVisual, { children: /*#__PURE__*/ jsx(Spinner, { size: "small" }) });
|
|
648
|
-
t3 = /*#__PURE__*/ jsx(Text_default, {
|
|
649
|
-
className: "fgColor-muted",
|
|
650
|
-
children: "Loading..."
|
|
651
|
-
});
|
|
652
|
-
$[10] = t2;
|
|
653
|
-
$[11] = t3;
|
|
654
|
-
} else {
|
|
655
|
-
t2 = $[10];
|
|
656
|
-
t3 = $[11];
|
|
657
|
-
}
|
|
658
|
-
let t4;
|
|
659
|
-
if ($[12] !== itemId || $[13] !== t1) {
|
|
660
|
-
t4 = /*#__PURE__*/ jsx(LoadingPlaceholderContext.Provider, {
|
|
661
|
-
value: true,
|
|
662
|
-
children: /*#__PURE__*/ jsxs(Item, {
|
|
663
|
-
id: itemId,
|
|
664
|
-
ref: t1,
|
|
665
|
-
children: [t2, t3]
|
|
666
|
-
})
|
|
667
|
-
});
|
|
668
|
-
$[12] = itemId;
|
|
669
|
-
$[13] = t1;
|
|
670
|
-
$[14] = t4;
|
|
671
|
-
} else t4 = $[14];
|
|
672
|
-
return t4;
|
|
431
|
+
})]
|
|
432
|
+
})
|
|
433
|
+
});
|
|
434
|
+
return /*#__PURE__*/ jsx(LoadingPlaceholderContext.Provider, {
|
|
435
|
+
value: true,
|
|
436
|
+
children: /*#__PURE__*/ jsxs(Item, {
|
|
437
|
+
id: itemId,
|
|
438
|
+
ref,
|
|
439
|
+
children: [/*#__PURE__*/ jsx(LeadingVisual, { children: /*#__PURE__*/ jsx(Spinner, { size: "small" }) }), /*#__PURE__*/ jsx(Text_default, {
|
|
440
|
+
className: "fgColor-muted",
|
|
441
|
+
children: "Loading..."
|
|
442
|
+
})]
|
|
443
|
+
})
|
|
444
|
+
});
|
|
673
445
|
});
|
|
674
446
|
const EmptyItem = /*#__PURE__*/ React.forwardRef((props, ref) => {
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
t2 = /*#__PURE__*/ jsx(Text_default, {
|
|
447
|
+
return /*#__PURE__*/ jsx(Item, {
|
|
448
|
+
expanded: null,
|
|
449
|
+
id: useId$1(),
|
|
450
|
+
ref,
|
|
451
|
+
children: /*#__PURE__*/ jsx(Text_default, {
|
|
681
452
|
className: "fgColor-muted",
|
|
682
453
|
children: "No items found"
|
|
683
|
-
})
|
|
684
|
-
|
|
685
|
-
} else t2 = $[0];
|
|
686
|
-
let t3;
|
|
687
|
-
if ($[1] !== t0 || $[2] !== t1) {
|
|
688
|
-
t3 = /*#__PURE__*/ jsx(Item, {
|
|
689
|
-
expanded: null,
|
|
690
|
-
id: t0,
|
|
691
|
-
ref: t1,
|
|
692
|
-
children: t2
|
|
693
|
-
});
|
|
694
|
-
$[1] = t0;
|
|
695
|
-
$[2] = t1;
|
|
696
|
-
$[3] = t3;
|
|
697
|
-
} else t3 = $[3];
|
|
698
|
-
return t3;
|
|
454
|
+
})
|
|
455
|
+
});
|
|
699
456
|
});
|
|
700
457
|
function useSubTree(children) {
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
t0 = React.Children.toArray(children).find(_temp4);
|
|
705
|
-
$[0] = children;
|
|
706
|
-
$[1] = t0;
|
|
707
|
-
} else t0 = $[1];
|
|
708
|
-
const subTree = t0;
|
|
709
|
-
let t1;
|
|
710
|
-
if ($[2] !== children) {
|
|
711
|
-
t1 = React.Children.toArray(children).filter(_temp5);
|
|
712
|
-
$[2] = children;
|
|
713
|
-
$[3] = t1;
|
|
714
|
-
} else t1 = $[3];
|
|
715
|
-
const childrenWithoutSubTree = t1;
|
|
716
|
-
const t2 = Boolean(subTree);
|
|
717
|
-
let t3;
|
|
718
|
-
if ($[4] !== childrenWithoutSubTree || $[5] !== subTree || $[6] !== t2) {
|
|
719
|
-
t3 = {
|
|
458
|
+
return React.useMemo(() => {
|
|
459
|
+
const subTree = React.Children.toArray(children).find((child) => /*#__PURE__*/ React.isValidElement(child) && (child.type === SubTree || isSlot(child, SubTree)));
|
|
460
|
+
return {
|
|
720
461
|
subTree,
|
|
721
|
-
childrenWithoutSubTree,
|
|
722
|
-
hasSubTree:
|
|
462
|
+
childrenWithoutSubTree: React.Children.toArray(children).filter((child) => !(/*#__PURE__*/ React.isValidElement(child) && (child.type === SubTree || isSlot(child, SubTree)))),
|
|
463
|
+
hasSubTree: Boolean(subTree)
|
|
723
464
|
};
|
|
724
|
-
|
|
725
|
-
$[5] = subTree;
|
|
726
|
-
$[6] = t2;
|
|
727
|
-
$[7] = t3;
|
|
728
|
-
} else t3 = $[7];
|
|
729
|
-
return t3;
|
|
730
|
-
}
|
|
731
|
-
function _temp5(child_0) {
|
|
732
|
-
return !(/*#__PURE__*/ React.isValidElement(child_0) && (child_0.type === SubTree || isSlot(child_0, SubTree)));
|
|
733
|
-
}
|
|
734
|
-
function _temp4(child) {
|
|
735
|
-
return /*#__PURE__*/ React.isValidElement(child) && (child.type === SubTree || isSlot(child, SubTree));
|
|
465
|
+
}, [children]);
|
|
736
466
|
}
|
|
737
467
|
const LeadingVisual = (props) => {
|
|
738
|
-
const $ = c(13);
|
|
739
468
|
const { isExpanded, leadingVisualId } = React.useContext(ItemContext);
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
$[3] = t1;
|
|
752
|
-
} else t1 = $[3];
|
|
753
|
-
let t2;
|
|
754
|
-
if ($[4] !== leadingVisualId || $[5] !== props.label) {
|
|
755
|
-
t2 = /*#__PURE__*/ jsx("div", {
|
|
756
|
-
className: t1,
|
|
757
|
-
"aria-hidden": true,
|
|
758
|
-
id: leadingVisualId,
|
|
759
|
-
children: props.label
|
|
760
|
-
});
|
|
761
|
-
$[4] = leadingVisualId;
|
|
762
|
-
$[5] = props.label;
|
|
763
|
-
$[6] = t2;
|
|
764
|
-
} else t2 = $[6];
|
|
765
|
-
let t3;
|
|
766
|
-
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
767
|
-
t3 = clsx("PRIVATE_TreeView-item-visual", TreeView_module_css_default.TreeViewItemVisual);
|
|
768
|
-
$[7] = t3;
|
|
769
|
-
} else t3 = $[7];
|
|
770
|
-
let t4;
|
|
771
|
-
if ($[8] !== children) {
|
|
772
|
-
t4 = /*#__PURE__*/ jsx("div", {
|
|
773
|
-
className: t3,
|
|
774
|
-
"aria-hidden": true,
|
|
775
|
-
children
|
|
776
|
-
});
|
|
777
|
-
$[8] = children;
|
|
778
|
-
$[9] = t4;
|
|
779
|
-
} else t4 = $[9];
|
|
780
|
-
let t5;
|
|
781
|
-
if ($[10] !== t2 || $[11] !== t4) {
|
|
782
|
-
t5 = /*#__PURE__*/ jsxs(Fragment, { children: [t2, t4] });
|
|
783
|
-
$[10] = t2;
|
|
784
|
-
$[11] = t4;
|
|
785
|
-
$[12] = t5;
|
|
786
|
-
} else t5 = $[12];
|
|
787
|
-
return t5;
|
|
469
|
+
const children = typeof props.children === "function" ? props.children({ isExpanded }) : props.children;
|
|
470
|
+
return /*#__PURE__*/ jsxs(Fragment, { children: [/*#__PURE__*/ jsx("div", {
|
|
471
|
+
className: clsx("PRIVATE_VisuallyHidden", TreeView_module_css_default.TreeViewVisuallyHidden),
|
|
472
|
+
"aria-hidden": true,
|
|
473
|
+
id: leadingVisualId,
|
|
474
|
+
children: props.label
|
|
475
|
+
}), /*#__PURE__*/ jsx("div", {
|
|
476
|
+
className: clsx("PRIVATE_TreeView-item-visual", TreeView_module_css_default.TreeViewItemVisual),
|
|
477
|
+
"aria-hidden": true,
|
|
478
|
+
children
|
|
479
|
+
})] });
|
|
788
480
|
};
|
|
789
481
|
LeadingVisual.displayName = "TreeView.LeadingVisual";
|
|
790
482
|
const TrailingVisual = (props) => {
|
|
791
|
-
const $ = c(13);
|
|
792
483
|
const { isExpanded, trailingVisualId } = React.useContext(ItemContext);
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
}
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
$[3] = t1;
|
|
805
|
-
} else t1 = $[3];
|
|
806
|
-
let t2;
|
|
807
|
-
if ($[4] !== props.label || $[5] !== trailingVisualId) {
|
|
808
|
-
t2 = /*#__PURE__*/ jsx("div", {
|
|
809
|
-
className: t1,
|
|
810
|
-
"aria-hidden": true,
|
|
811
|
-
id: trailingVisualId,
|
|
812
|
-
children: props.label
|
|
813
|
-
});
|
|
814
|
-
$[4] = props.label;
|
|
815
|
-
$[5] = trailingVisualId;
|
|
816
|
-
$[6] = t2;
|
|
817
|
-
} else t2 = $[6];
|
|
818
|
-
let t3;
|
|
819
|
-
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
820
|
-
t3 = clsx("PRIVATE_TreeView-item-visual", TreeView_module_css_default.TreeViewItemVisual);
|
|
821
|
-
$[7] = t3;
|
|
822
|
-
} else t3 = $[7];
|
|
823
|
-
let t4;
|
|
824
|
-
if ($[8] !== children) {
|
|
825
|
-
t4 = /*#__PURE__*/ jsx("div", {
|
|
826
|
-
className: t3,
|
|
827
|
-
"aria-hidden": true,
|
|
828
|
-
children
|
|
829
|
-
});
|
|
830
|
-
$[8] = children;
|
|
831
|
-
$[9] = t4;
|
|
832
|
-
} else t4 = $[9];
|
|
833
|
-
let t5;
|
|
834
|
-
if ($[10] !== t2 || $[11] !== t4) {
|
|
835
|
-
t5 = /*#__PURE__*/ jsxs(Fragment, { children: [t2, t4] });
|
|
836
|
-
$[10] = t2;
|
|
837
|
-
$[11] = t4;
|
|
838
|
-
$[12] = t5;
|
|
839
|
-
} else t5 = $[12];
|
|
840
|
-
return t5;
|
|
484
|
+
const children = typeof props.children === "function" ? props.children({ isExpanded }) : props.children;
|
|
485
|
+
return /*#__PURE__*/ jsxs(Fragment, { children: [/*#__PURE__*/ jsx("div", {
|
|
486
|
+
className: clsx("PRIVATE_VisuallyHidden", TreeView_module_css_default.TreeViewVisuallyHidden),
|
|
487
|
+
"aria-hidden": true,
|
|
488
|
+
id: trailingVisualId,
|
|
489
|
+
children: props.label
|
|
490
|
+
}), /*#__PURE__*/ jsx("div", {
|
|
491
|
+
className: clsx("PRIVATE_TreeView-item-visual", TreeView_module_css_default.TreeViewItemVisual),
|
|
492
|
+
"aria-hidden": true,
|
|
493
|
+
children
|
|
494
|
+
})] });
|
|
841
495
|
};
|
|
842
496
|
TrailingVisual.displayName = "TreeView.TrailingVisual";
|
|
843
497
|
const LeadingAction = (props) => {
|
|
844
|
-
const $ = c(12);
|
|
845
498
|
const { isExpanded } = React.useContext(ItemContext);
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
t1 = clsx("PRIVATE_VisuallyHidden", TreeView_module_css_default.TreeViewVisuallyHidden);
|
|
857
|
-
$[3] = t1;
|
|
858
|
-
} else t1 = $[3];
|
|
859
|
-
let t2;
|
|
860
|
-
if ($[4] !== props.label) {
|
|
861
|
-
t2 = /*#__PURE__*/ jsx("div", {
|
|
862
|
-
className: t1,
|
|
863
|
-
"aria-hidden": true,
|
|
864
|
-
children: props.label
|
|
865
|
-
});
|
|
866
|
-
$[4] = props.label;
|
|
867
|
-
$[5] = t2;
|
|
868
|
-
} else t2 = $[5];
|
|
869
|
-
let t3;
|
|
870
|
-
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
871
|
-
t3 = clsx("PRIVATE_TreeView-item-leading-action", TreeView_module_css_default.TreeViewItemLeadingAction);
|
|
872
|
-
$[6] = t3;
|
|
873
|
-
} else t3 = $[6];
|
|
874
|
-
let t4;
|
|
875
|
-
if ($[7] !== children) {
|
|
876
|
-
t4 = /*#__PURE__*/ jsx("div", {
|
|
877
|
-
className: t3,
|
|
878
|
-
"aria-hidden": true,
|
|
879
|
-
children
|
|
880
|
-
});
|
|
881
|
-
$[7] = children;
|
|
882
|
-
$[8] = t4;
|
|
883
|
-
} else t4 = $[8];
|
|
884
|
-
let t5;
|
|
885
|
-
if ($[9] !== t2 || $[10] !== t4) {
|
|
886
|
-
t5 = /*#__PURE__*/ jsxs(Fragment, { children: [t2, t4] });
|
|
887
|
-
$[9] = t2;
|
|
888
|
-
$[10] = t4;
|
|
889
|
-
$[11] = t5;
|
|
890
|
-
} else t5 = $[11];
|
|
891
|
-
return t5;
|
|
499
|
+
const children = typeof props.children === "function" ? props.children({ isExpanded }) : props.children;
|
|
500
|
+
return /*#__PURE__*/ jsxs(Fragment, { children: [/*#__PURE__*/ jsx("div", {
|
|
501
|
+
className: clsx("PRIVATE_VisuallyHidden", TreeView_module_css_default.TreeViewVisuallyHidden),
|
|
502
|
+
"aria-hidden": true,
|
|
503
|
+
children: props.label
|
|
504
|
+
}), /*#__PURE__*/ jsx("div", {
|
|
505
|
+
className: clsx("PRIVATE_TreeView-item-leading-action", TreeView_module_css_default.TreeViewItemLeadingAction),
|
|
506
|
+
"aria-hidden": true,
|
|
507
|
+
children
|
|
508
|
+
})] });
|
|
892
509
|
};
|
|
893
510
|
LeadingAction.displayName = "TreeView.LeadingAction";
|
|
894
511
|
const TrailingAction = (props) => {
|
|
895
|
-
const $ = c(14);
|
|
896
512
|
const { trailingActionId, itemId } = React.useContext(ItemContext);
|
|
897
513
|
const { items, shortcutText } = props;
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
$[2] = trailingActionId;
|
|
912
|
-
$[3] = t1;
|
|
913
|
-
} else t1 = $[3];
|
|
914
|
-
let t2;
|
|
915
|
-
if ($[4] !== itemId || $[5] !== items) {
|
|
916
|
-
let t3;
|
|
917
|
-
if ($[7] !== itemId) {
|
|
918
|
-
t3 = (t4, index) => {
|
|
919
|
-
const { label, onClick, icon, count, className } = t4;
|
|
920
|
-
if (count) return /*#__PURE__*/ jsx(Tooltip, {
|
|
921
|
-
text: label,
|
|
922
|
-
children: /*#__PURE__*/ jsx(ButtonComponent, {
|
|
923
|
-
"aria-label": label,
|
|
924
|
-
leadingVisual: icon,
|
|
925
|
-
variant: "invisible",
|
|
926
|
-
className: clsx(className, TreeView_module_css_default.TreeViewItemTrailingActionButton),
|
|
927
|
-
onClick,
|
|
928
|
-
onKeyDown: () => {
|
|
929
|
-
const parentElement = document.getElementById(itemId);
|
|
930
|
-
parentElement === null || parentElement === void 0 || parentElement.focus();
|
|
931
|
-
},
|
|
932
|
-
tabIndex: -1,
|
|
933
|
-
"aria-hidden": true,
|
|
934
|
-
count
|
|
935
|
-
})
|
|
936
|
-
}, index);
|
|
937
|
-
return /*#__PURE__*/ jsx(IconButton, {
|
|
938
|
-
icon,
|
|
939
|
-
variant: "invisible",
|
|
514
|
+
return /*#__PURE__*/ jsxs(Fragment, { children: [/*#__PURE__*/ jsxs("div", {
|
|
515
|
+
id: trailingActionId,
|
|
516
|
+
className: clsx("PRIVATE_VisuallyHidden", TreeView_module_css_default.TreeViewVisuallyHidden),
|
|
517
|
+
children: ["- ", shortcutText]
|
|
518
|
+
}), /*#__PURE__*/ jsx("div", {
|
|
519
|
+
className: TreeView_module_css_default.TreeViewItemTrailingAction,
|
|
520
|
+
"aria-hidden": true,
|
|
521
|
+
onClick: (event) => event.stopPropagation(),
|
|
522
|
+
onKeyDown: (event) => event.stopPropagation(),
|
|
523
|
+
children: items.map(({ label, onClick, icon, count, className }, index) => {
|
|
524
|
+
if (count) return /*#__PURE__*/ jsx(Tooltip, {
|
|
525
|
+
text: label,
|
|
526
|
+
children: /*#__PURE__*/ jsx(ButtonComponent, {
|
|
940
527
|
"aria-label": label,
|
|
528
|
+
leadingVisual: icon,
|
|
529
|
+
variant: "invisible",
|
|
941
530
|
className: clsx(className, TreeView_module_css_default.TreeViewItemTrailingActionButton),
|
|
942
531
|
onClick,
|
|
532
|
+
onKeyDown: () => {
|
|
533
|
+
const parentElement = document.getElementById(itemId);
|
|
534
|
+
parentElement === null || parentElement === void 0 || parentElement.focus();
|
|
535
|
+
},
|
|
943
536
|
tabIndex: -1,
|
|
944
537
|
"aria-hidden": true,
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
"aria-hidden": true,
|
|
964
|
-
onClick: _temp6,
|
|
965
|
-
onKeyDown: _temp7,
|
|
966
|
-
children: t2
|
|
967
|
-
});
|
|
968
|
-
$[9] = t2;
|
|
969
|
-
$[10] = t3;
|
|
970
|
-
} else t3 = $[10];
|
|
971
|
-
let t4;
|
|
972
|
-
if ($[11] !== t1 || $[12] !== t3) {
|
|
973
|
-
t4 = /*#__PURE__*/ jsxs(Fragment, { children: [t1, t3] });
|
|
974
|
-
$[11] = t1;
|
|
975
|
-
$[12] = t3;
|
|
976
|
-
$[13] = t4;
|
|
977
|
-
} else t4 = $[13];
|
|
978
|
-
return t4;
|
|
538
|
+
count
|
|
539
|
+
})
|
|
540
|
+
}, index);
|
|
541
|
+
return /*#__PURE__*/ jsx(IconButton, {
|
|
542
|
+
icon,
|
|
543
|
+
variant: "invisible",
|
|
544
|
+
"aria-label": label,
|
|
545
|
+
className: clsx(className, TreeView_module_css_default.TreeViewItemTrailingActionButton),
|
|
546
|
+
onClick,
|
|
547
|
+
tabIndex: -1,
|
|
548
|
+
"aria-hidden": true,
|
|
549
|
+
onKeyDown: () => {
|
|
550
|
+
const parentElement = document.getElementById(itemId);
|
|
551
|
+
parentElement === null || parentElement === void 0 || parentElement.focus();
|
|
552
|
+
}
|
|
553
|
+
}, index);
|
|
554
|
+
})
|
|
555
|
+
})] });
|
|
979
556
|
};
|
|
980
557
|
TrailingAction.displayName = "TreeView.TrailingAction";
|
|
981
|
-
const ActionDialog = (
|
|
982
|
-
const $ = c(10);
|
|
983
|
-
const { items, onClose } = t0;
|
|
558
|
+
const ActionDialog = ({ items, onClose }) => {
|
|
984
559
|
const { itemId } = React.useContext(ItemContext);
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
children: t3
|
|
1019
|
-
})
|
|
1020
|
-
});
|
|
1021
|
-
$[7] = t1;
|
|
1022
|
-
$[8] = t3;
|
|
1023
|
-
$[9] = t4;
|
|
1024
|
-
} else t4 = $[9];
|
|
1025
|
-
return t4;
|
|
560
|
+
return /*#__PURE__*/ jsx("div", {
|
|
561
|
+
onClick: (event) => {
|
|
562
|
+
event.stopPropagation();
|
|
563
|
+
},
|
|
564
|
+
onKeyDown: (event) => {
|
|
565
|
+
if ([
|
|
566
|
+
"Backspace",
|
|
567
|
+
"ArrowLeft",
|
|
568
|
+
"ArrowRight",
|
|
569
|
+
"ArrowUp",
|
|
570
|
+
"ArrowDown",
|
|
571
|
+
"Enter"
|
|
572
|
+
].includes(event.key)) event.stopPropagation();
|
|
573
|
+
},
|
|
574
|
+
children: /*#__PURE__*/ jsx(Dialog, {
|
|
575
|
+
title: "Supplemental actions",
|
|
576
|
+
onClose: () => {
|
|
577
|
+
if (onClose) onClose();
|
|
578
|
+
setTimeout(() => {
|
|
579
|
+
const parentElement = document.getElementById(itemId);
|
|
580
|
+
parentElement === null || parentElement === void 0 || parentElement.focus();
|
|
581
|
+
});
|
|
582
|
+
},
|
|
583
|
+
children: /*#__PURE__*/ jsx(ActionList, { children: items.map(({ label, onClick, icon: Icon, count }, index) => /*#__PURE__*/ jsxs(ActionList.Item, {
|
|
584
|
+
onSelect: onClick,
|
|
585
|
+
children: [
|
|
586
|
+
/*#__PURE__*/ jsx(ActionList.LeadingVisual, { children: /*#__PURE__*/ jsx(Icon, {}) }),
|
|
587
|
+
label,
|
|
588
|
+
count ? /*#__PURE__*/ jsxs(ActionList.TrailingVisual, { children: [count, /*#__PURE__*/ jsx(VisuallyHidden, { children: "items" })] }) : null
|
|
589
|
+
]
|
|
590
|
+
}, index)) })
|
|
591
|
+
})
|
|
592
|
+
});
|
|
1026
593
|
};
|
|
594
|
+
ActionDialog.displayName = "ActionDialog";
|
|
1027
595
|
ActionDialog.displayName = "TreeView.ActionDialog";
|
|
1028
596
|
const DirectoryIcon = () => {
|
|
1029
|
-
const $ = c(3);
|
|
1030
597
|
const { isExpanded } = React.useContext(ItemContext);
|
|
1031
598
|
const Icon = isExpanded ? FileDirectoryOpenFillIcon : FileDirectoryFillIcon;
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
} else t0 = $[0];
|
|
1037
|
-
let t1;
|
|
1038
|
-
if ($[1] !== Icon) {
|
|
1039
|
-
t1 = /*#__PURE__*/ jsx("div", {
|
|
1040
|
-
className: t0,
|
|
1041
|
-
children: /*#__PURE__*/ jsx(Icon, {})
|
|
1042
|
-
});
|
|
1043
|
-
$[1] = Icon;
|
|
1044
|
-
$[2] = t1;
|
|
1045
|
-
} else t1 = $[2];
|
|
1046
|
-
return t1;
|
|
599
|
+
return /*#__PURE__*/ jsx("div", {
|
|
600
|
+
className: clsx("PRIVATE_TreeView-directory-icon", TreeView_module_css_default.TreeViewDirectoryIcon),
|
|
601
|
+
children: /*#__PURE__*/ jsx(Icon, {})
|
|
602
|
+
});
|
|
1047
603
|
};
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
const { title: t1, children, onRetry, onDismiss } = t0;
|
|
1051
|
-
const title = t1 === void 0 ? "Error" : t1;
|
|
604
|
+
DirectoryIcon.displayName = "DirectoryIcon";
|
|
605
|
+
const ErrorDialog = ({ title = "Error", children, onRetry, onDismiss }) => {
|
|
1052
606
|
const { itemId, setIsExpanded } = React.useContext(ItemContext);
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
})
|
|
1083
|
-
});
|
|
1084
|
-
$[5] = children;
|
|
1085
|
-
$[6] = t2;
|
|
1086
|
-
$[7] = title;
|
|
1087
|
-
$[8] = t3;
|
|
1088
|
-
} else t3 = $[8];
|
|
1089
|
-
return t3;
|
|
607
|
+
return /*#__PURE__*/ jsx("div", {
|
|
608
|
+
onKeyDown: (event) => {
|
|
609
|
+
if ([
|
|
610
|
+
"Backspace",
|
|
611
|
+
"ArrowLeft",
|
|
612
|
+
"ArrowRight",
|
|
613
|
+
"ArrowUp",
|
|
614
|
+
"ArrowDown",
|
|
615
|
+
"Enter"
|
|
616
|
+
].includes(event.key)) event.stopPropagation();
|
|
617
|
+
},
|
|
618
|
+
children: /*#__PURE__*/ jsx(ConfirmationDialog, {
|
|
619
|
+
title,
|
|
620
|
+
onClose: (gesture) => {
|
|
621
|
+
setTimeout(() => {
|
|
622
|
+
const parentElement = document.getElementById(itemId);
|
|
623
|
+
parentElement === null || parentElement === void 0 || parentElement.focus();
|
|
624
|
+
});
|
|
625
|
+
if (gesture === "confirm") onRetry === null || onRetry === void 0 || onRetry();
|
|
626
|
+
else {
|
|
627
|
+
setIsExpanded(false);
|
|
628
|
+
onDismiss === null || onDismiss === void 0 || onDismiss();
|
|
629
|
+
}
|
|
630
|
+
},
|
|
631
|
+
confirmButtonContent: "Retry",
|
|
632
|
+
cancelButtonContent: "Dismiss",
|
|
633
|
+
children
|
|
634
|
+
})
|
|
635
|
+
});
|
|
1090
636
|
};
|
|
637
|
+
ErrorDialog.displayName = "ErrorDialog";
|
|
1091
638
|
ErrorDialog.displayName = "TreeView.ErrorDialog";
|
|
1092
639
|
const TreeView = Object.assign(Root, {
|
|
1093
640
|
Item,
|
|
@@ -1098,57 +645,5 @@ const TreeView = Object.assign(Root, {
|
|
|
1098
645
|
DirectoryIcon,
|
|
1099
646
|
ErrorDialog
|
|
1100
647
|
});
|
|
1101
|
-
function _temp(element) {
|
|
1102
|
-
if (element instanceof HTMLElement) element.focus();
|
|
1103
|
-
}
|
|
1104
|
-
function _temp2(_, index) {
|
|
1105
|
-
return /*#__PURE__*/ jsx("div", { className: clsx("PRIVATE_TreeView-item-level-line", TreeView_module_css_default.TreeViewItemLevelLine) }, index);
|
|
1106
|
-
}
|
|
1107
|
-
_temp2.displayName = "_temp2";
|
|
1108
|
-
function _temp3(_, i) {
|
|
1109
|
-
return /*#__PURE__*/ jsx(SkeletonItem, { "aria-hidden": true }, i);
|
|
1110
|
-
}
|
|
1111
|
-
_temp3.displayName = "_temp3";
|
|
1112
|
-
function _temp6(event) {
|
|
1113
|
-
return event.stopPropagation();
|
|
1114
|
-
}
|
|
1115
|
-
function _temp7(event_0) {
|
|
1116
|
-
return event_0.stopPropagation();
|
|
1117
|
-
}
|
|
1118
|
-
function _temp8(event) {
|
|
1119
|
-
event.stopPropagation();
|
|
1120
|
-
}
|
|
1121
|
-
function _temp9(event_0) {
|
|
1122
|
-
if ([
|
|
1123
|
-
"Backspace",
|
|
1124
|
-
"ArrowLeft",
|
|
1125
|
-
"ArrowRight",
|
|
1126
|
-
"ArrowUp",
|
|
1127
|
-
"ArrowDown",
|
|
1128
|
-
"Enter"
|
|
1129
|
-
].includes(event_0.key)) event_0.stopPropagation();
|
|
1130
|
-
}
|
|
1131
|
-
function _temp0(t0, index) {
|
|
1132
|
-
const { label, onClick, icon: Icon, count } = t0;
|
|
1133
|
-
return /*#__PURE__*/ jsxs(ActionList.Item, {
|
|
1134
|
-
onSelect: onClick,
|
|
1135
|
-
children: [
|
|
1136
|
-
/*#__PURE__*/ jsx(ActionList.LeadingVisual, { children: /*#__PURE__*/ jsx(Icon, {}) }),
|
|
1137
|
-
label,
|
|
1138
|
-
count ? /*#__PURE__*/ jsxs(ActionList.TrailingVisual, { children: [count, /*#__PURE__*/ jsx(VisuallyHidden, { children: "items" })] }) : null
|
|
1139
|
-
]
|
|
1140
|
-
}, index);
|
|
1141
|
-
}
|
|
1142
|
-
_temp0.displayName = "_temp0";
|
|
1143
|
-
function _temp1(event) {
|
|
1144
|
-
if ([
|
|
1145
|
-
"Backspace",
|
|
1146
|
-
"ArrowLeft",
|
|
1147
|
-
"ArrowRight",
|
|
1148
|
-
"ArrowUp",
|
|
1149
|
-
"ArrowDown",
|
|
1150
|
-
"Enter"
|
|
1151
|
-
].includes(event.key)) event.stopPropagation();
|
|
1152
|
-
}
|
|
1153
648
|
//#endregion
|
|
1154
649
|
export { TreeView };
|