@primer/react 0.0.0-20260610121450 → 0.0.0-20260610122713
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 +55 -3
- package/dist/ActionList/ActionList-1940009e.css +2 -0
- package/dist/ActionList/ActionList-1940009e.css.map +1 -0
- package/dist/ActionList/ActionList.module.css.js +2 -2
- package/dist/ActionList/Item.d.ts.map +1 -1
- package/dist/ActionList/Item.js +125 -118
- package/dist/ActionList/TrailingAction.d.ts.map +1 -1
- package/dist/ActionList/TrailingAction.js +1 -0
- package/dist/ActionList/Visuals.js +6 -4
- package/dist/AnchoredOverlay/{AnchoredOverlay-a367c798.css → AnchoredOverlay-83281f45.css} +1 -1
- package/dist/AnchoredOverlay/AnchoredOverlay-83281f45.css.map +1 -0
- package/dist/AnchoredOverlay/AnchoredOverlay.module.css.js +1 -1
- package/dist/Autocomplete/AutocompleteInput.d.ts.map +1 -1
- package/dist/Autocomplete/AutocompleteInput.js +14 -2
- package/dist/Card/Card-59b77d05.css +2 -0
- package/dist/Card/Card-59b77d05.css.map +1 -0
- package/dist/Card/Card.d.ts +18 -0
- package/dist/Card/Card.d.ts.map +1 -1
- package/dist/Card/Card.js +165 -154
- package/dist/Card/Card.module.css.js +1 -1
- package/dist/Card/index.d.ts +2 -0
- package/dist/Card/index.d.ts.map +1 -1
- package/dist/Dialog/Dialog.d.ts +1 -0
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +16 -2
- package/dist/FeatureFlags/DefaultFeatureFlags.d.ts.map +1 -1
- package/dist/FeatureFlags/DefaultFeatureFlags.js +2 -1
- package/dist/InlineMessage/InlineMessage-cd1e4c93.css +2 -0
- package/dist/InlineMessage/InlineMessage-cd1e4c93.css.map +1 -0
- package/dist/InlineMessage/InlineMessage.d.ts +1 -1
- package/dist/InlineMessage/InlineMessage.d.ts.map +1 -1
- package/dist/InlineMessage/InlineMessage.js +34 -19
- package/dist/InlineMessage/InlineMessage.module.css.js +1 -1
- package/dist/KeybindingHint/KeybindingHint.d.ts +6 -1
- package/dist/KeybindingHint/KeybindingHint.d.ts.map +1 -1
- package/dist/KeybindingHint/KeybindingHint.js +6 -2
- package/dist/KeybindingHint/components/Chord.d.ts +2 -1
- package/dist/KeybindingHint/components/Chord.d.ts.map +1 -1
- package/dist/KeybindingHint/components/Chord.js +1 -1
- package/dist/KeybindingHint/components/Key.js +10 -10
- package/dist/KeybindingHint/components/Sequence.d.ts +2 -1
- package/dist/KeybindingHint/components/Sequence.d.ts.map +1 -1
- package/dist/KeybindingHint/components/Sequence.js +2 -2
- package/dist/KeybindingHint/key-names.d.ts +4 -3
- package/dist/KeybindingHint/key-names.d.ts.map +1 -1
- package/dist/KeybindingHint/key-names.js +15 -14
- package/dist/KeybindingHint/platform.d.ts +22 -0
- package/dist/KeybindingHint/platform.d.ts.map +1 -0
- package/dist/KeybindingHint/platform.js +61 -0
- package/dist/PageHeader/PageHeader.d.ts.map +1 -1
- package/dist/PageHeader/PageHeader.js +6 -0
- package/dist/PageLayout/PageLayout.d.ts +24 -6
- package/dist/PageLayout/PageLayout.d.ts.map +1 -1
- package/dist/PageLayout/PageLayout.js +16 -2
- package/dist/Pagehead/Pagehead.js +1 -0
- package/dist/Popover/Popover.d.ts.map +1 -1
- package/dist/Popover/Popover.js +2 -0
- package/dist/Portal/Portal.d.ts.map +1 -1
- package/dist/Portal/Portal.js +1 -0
- package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBar.js +2 -0
- package/dist/Text/{Text-ca7603b7.css → Text-d649cda5.css} +2 -2
- package/dist/Text/Text-d649cda5.css.map +1 -0
- package/dist/Text/Text.d.ts +3 -0
- package/dist/Text/Text.d.ts.map +1 -1
- package/dist/Text/Text.js +20 -14
- package/dist/Text/Text.module.css.js +1 -1
- package/dist/Timeline/Timeline-ff81db92.css +2 -0
- package/dist/Timeline/Timeline-ff81db92.css.map +1 -0
- package/dist/Timeline/Timeline.d.ts +9 -8
- package/dist/Timeline/Timeline.d.ts.map +1 -1
- package/dist/Timeline/Timeline.js +156 -61
- package/dist/Timeline/Timeline.module.css.js +1 -1
- package/dist/TooltipV2/Tooltip.d.ts.map +1 -1
- package/dist/TooltipV2/Tooltip.js +3 -3
- package/dist/TreeView/TreeView-1bf45a33.css +2 -0
- package/dist/TreeView/TreeView-1bf45a33.css.map +1 -0
- package/dist/TreeView/TreeView.d.ts.map +1 -1
- package/dist/TreeView/TreeView.js +25 -12
- package/dist/TreeView/TreeView.module.css.js +2 -2
- package/generated/components.json +57 -10
- package/package.json +9 -9
- package/dist/ActionList/ActionList-2a35a40c.css +0 -2
- package/dist/ActionList/ActionList-2a35a40c.css.map +0 -1
- package/dist/AnchoredOverlay/AnchoredOverlay-a367c798.css.map +0 -1
- package/dist/Card/Card-d8a02dd9.css +0 -2
- package/dist/Card/Card-d8a02dd9.css.map +0 -1
- package/dist/InlineMessage/InlineMessage-80d97643.css +0 -2
- package/dist/InlineMessage/InlineMessage-80d97643.css.map +0 -1
- package/dist/Text/Text-ca7603b7.css.map +0 -1
- package/dist/Timeline/Timeline-0c88f21b.css +0 -2
- package/dist/Timeline/Timeline-0c88f21b.css.map +0 -1
- package/dist/TreeView/TreeView-0fe09f34.css +0 -2
- package/dist/TreeView/TreeView-0fe09f34.css.map +0 -1
- package/dist/hooks/useIsMacOS.js +0 -32
|
@@ -3,6 +3,7 @@ import { clsx } from 'clsx';
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import classes from './Timeline.module.css.js';
|
|
5
5
|
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
import { useFeatureFlag } from '../FeatureFlags/useFeatureFlag.js';
|
|
6
7
|
|
|
7
8
|
function resolveClipSidebar(clipSidebar) {
|
|
8
9
|
if (clipSidebar === true || clipSidebar === 'both') return 'both';
|
|
@@ -10,7 +11,7 @@ function resolveClipSidebar(clipSidebar) {
|
|
|
10
11
|
return undefined;
|
|
11
12
|
}
|
|
12
13
|
const Timeline = /*#__PURE__*/React.forwardRef((t0, forwardRef) => {
|
|
13
|
-
const $ = c(
|
|
14
|
+
const $ = c(20);
|
|
14
15
|
let className;
|
|
15
16
|
let clipSidebar;
|
|
16
17
|
let props;
|
|
@@ -29,6 +30,7 @@ const Timeline = /*#__PURE__*/React.forwardRef((t0, forwardRef) => {
|
|
|
29
30
|
clipSidebar = $[2];
|
|
30
31
|
props = $[3];
|
|
31
32
|
}
|
|
33
|
+
const useListSemantics = useFeatureFlag("primer_react_timeline_list_semantics");
|
|
32
34
|
let t1;
|
|
33
35
|
if ($[4] !== clipSidebar) {
|
|
34
36
|
t1 = resolveClipSidebar(clipSidebar);
|
|
@@ -38,31 +40,62 @@ const Timeline = /*#__PURE__*/React.forwardRef((t0, forwardRef) => {
|
|
|
38
40
|
t1 = $[5];
|
|
39
41
|
}
|
|
40
42
|
const resolvedClipSidebar = t1;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
if (useListSemantics) {
|
|
44
|
+
let t2;
|
|
45
|
+
if ($[6] !== className) {
|
|
46
|
+
t2 = clsx(className, classes.Timeline);
|
|
47
|
+
$[6] = className;
|
|
48
|
+
$[7] = t2;
|
|
49
|
+
} else {
|
|
50
|
+
t2 = $[7];
|
|
51
|
+
}
|
|
52
|
+
const t3 = forwardRef;
|
|
53
|
+
let t4;
|
|
54
|
+
if ($[8] !== props || $[9] !== resolvedClipSidebar || $[10] !== t2 || $[11] !== t3) {
|
|
55
|
+
t4 = /*#__PURE__*/jsx("ol", {
|
|
56
|
+
...props,
|
|
57
|
+
role: "list",
|
|
58
|
+
className: t2,
|
|
59
|
+
ref: t3,
|
|
60
|
+
"data-clip-sidebar": resolvedClipSidebar
|
|
61
|
+
});
|
|
62
|
+
$[8] = props;
|
|
63
|
+
$[9] = resolvedClipSidebar;
|
|
64
|
+
$[10] = t2;
|
|
65
|
+
$[11] = t3;
|
|
66
|
+
$[12] = t4;
|
|
67
|
+
} else {
|
|
68
|
+
t4 = $[12];
|
|
69
|
+
}
|
|
70
|
+
return t4;
|
|
48
71
|
}
|
|
72
|
+
const t2 = props;
|
|
49
73
|
let t3;
|
|
50
|
-
if ($[
|
|
51
|
-
t3 =
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
74
|
+
if ($[13] !== className) {
|
|
75
|
+
t3 = clsx(className, classes.Timeline);
|
|
76
|
+
$[13] = className;
|
|
77
|
+
$[14] = t3;
|
|
78
|
+
} else {
|
|
79
|
+
t3 = $[14];
|
|
80
|
+
}
|
|
81
|
+
const t4 = forwardRef;
|
|
82
|
+
let t5;
|
|
83
|
+
if ($[15] !== resolvedClipSidebar || $[16] !== t2 || $[17] !== t3 || $[18] !== t4) {
|
|
84
|
+
t5 = /*#__PURE__*/jsx("div", {
|
|
85
|
+
...t2,
|
|
86
|
+
className: t3,
|
|
87
|
+
ref: t4,
|
|
55
88
|
"data-clip-sidebar": resolvedClipSidebar
|
|
56
89
|
});
|
|
57
|
-
$[
|
|
58
|
-
$[
|
|
59
|
-
$[
|
|
60
|
-
$[
|
|
61
|
-
$[
|
|
90
|
+
$[15] = resolvedClipSidebar;
|
|
91
|
+
$[16] = t2;
|
|
92
|
+
$[17] = t3;
|
|
93
|
+
$[18] = t4;
|
|
94
|
+
$[19] = t5;
|
|
62
95
|
} else {
|
|
63
|
-
|
|
96
|
+
t5 = $[19];
|
|
64
97
|
}
|
|
65
|
-
return
|
|
98
|
+
return t5;
|
|
66
99
|
});
|
|
67
100
|
Timeline.displayName = 'Timeline';
|
|
68
101
|
|
|
@@ -71,7 +104,7 @@ Timeline.displayName = 'Timeline';
|
|
|
71
104
|
*/
|
|
72
105
|
|
|
73
106
|
const TimelineItem = /*#__PURE__*/React.forwardRef((t0, forwardRef) => {
|
|
74
|
-
const $ = c(
|
|
107
|
+
const $ = c(18);
|
|
75
108
|
let className;
|
|
76
109
|
let condensed;
|
|
77
110
|
let props;
|
|
@@ -90,32 +123,64 @@ const TimelineItem = /*#__PURE__*/React.forwardRef((t0, forwardRef) => {
|
|
|
90
123
|
condensed = $[2];
|
|
91
124
|
props = $[3];
|
|
92
125
|
}
|
|
93
|
-
|
|
94
|
-
if (
|
|
95
|
-
t1
|
|
96
|
-
$[4]
|
|
97
|
-
|
|
126
|
+
const useListSemantics = useFeatureFlag("primer_react_timeline_list_semantics");
|
|
127
|
+
if (useListSemantics) {
|
|
128
|
+
let t1;
|
|
129
|
+
if ($[4] !== className) {
|
|
130
|
+
t1 = clsx(className, "Timeline-Item", classes.TimelineItem);
|
|
131
|
+
$[4] = className;
|
|
132
|
+
$[5] = t1;
|
|
133
|
+
} else {
|
|
134
|
+
t1 = $[5];
|
|
135
|
+
}
|
|
136
|
+
const t2 = forwardRef;
|
|
137
|
+
const t3 = condensed ? "" : undefined;
|
|
138
|
+
let t4;
|
|
139
|
+
if ($[6] !== props || $[7] !== t1 || $[8] !== t2 || $[9] !== t3) {
|
|
140
|
+
t4 = /*#__PURE__*/jsx("li", {
|
|
141
|
+
...props,
|
|
142
|
+
className: t1,
|
|
143
|
+
ref: t2,
|
|
144
|
+
"data-condensed": t3
|
|
145
|
+
});
|
|
146
|
+
$[6] = props;
|
|
147
|
+
$[7] = t1;
|
|
148
|
+
$[8] = t2;
|
|
149
|
+
$[9] = t3;
|
|
150
|
+
$[10] = t4;
|
|
151
|
+
} else {
|
|
152
|
+
t4 = $[10];
|
|
153
|
+
}
|
|
154
|
+
return t4;
|
|
155
|
+
}
|
|
156
|
+
const t1 = props;
|
|
157
|
+
let t2;
|
|
158
|
+
if ($[11] !== className) {
|
|
159
|
+
t2 = clsx(className, "Timeline-Item", classes.TimelineItem);
|
|
160
|
+
$[11] = className;
|
|
161
|
+
$[12] = t2;
|
|
98
162
|
} else {
|
|
99
|
-
|
|
163
|
+
t2 = $[12];
|
|
100
164
|
}
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
165
|
+
const t3 = forwardRef;
|
|
166
|
+
const t4 = condensed ? "" : undefined;
|
|
167
|
+
let t5;
|
|
168
|
+
if ($[13] !== t1 || $[14] !== t2 || $[15] !== t3 || $[16] !== t4) {
|
|
169
|
+
t5 = /*#__PURE__*/jsx("div", {
|
|
170
|
+
...t1,
|
|
171
|
+
className: t2,
|
|
172
|
+
ref: t3,
|
|
173
|
+
"data-condensed": t4
|
|
109
174
|
});
|
|
110
|
-
$[
|
|
111
|
-
$[
|
|
112
|
-
$[
|
|
113
|
-
$[
|
|
114
|
-
$[
|
|
175
|
+
$[13] = t1;
|
|
176
|
+
$[14] = t2;
|
|
177
|
+
$[15] = t3;
|
|
178
|
+
$[16] = t4;
|
|
179
|
+
$[17] = t5;
|
|
115
180
|
} else {
|
|
116
|
-
|
|
181
|
+
t5 = $[17];
|
|
117
182
|
}
|
|
118
|
-
return
|
|
183
|
+
return t5;
|
|
119
184
|
});
|
|
120
185
|
TimelineItem.displayName = 'TimelineItem';
|
|
121
186
|
const TimelineBadge = t0 => {
|
|
@@ -208,7 +273,7 @@ const TimelineBody = /*#__PURE__*/React.forwardRef((t0, forwardRef) => {
|
|
|
208
273
|
});
|
|
209
274
|
TimelineBody.displayName = 'TimelineBody';
|
|
210
275
|
const TimelineBreak = /*#__PURE__*/React.forwardRef((t0, forwardRef) => {
|
|
211
|
-
const $ = c(
|
|
276
|
+
const $ = c(15);
|
|
212
277
|
let className;
|
|
213
278
|
let props;
|
|
214
279
|
if ($[0] !== t0) {
|
|
@@ -223,29 +288,59 @@ const TimelineBreak = /*#__PURE__*/React.forwardRef((t0, forwardRef) => {
|
|
|
223
288
|
className = $[1];
|
|
224
289
|
props = $[2];
|
|
225
290
|
}
|
|
226
|
-
|
|
227
|
-
if (
|
|
228
|
-
t1
|
|
229
|
-
$[3]
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
291
|
+
const useListSemantics = useFeatureFlag("primer_react_timeline_list_semantics");
|
|
292
|
+
if (useListSemantics) {
|
|
293
|
+
let t1;
|
|
294
|
+
if ($[3] !== className) {
|
|
295
|
+
t1 = clsx(className, classes.TimelineBreak);
|
|
296
|
+
$[3] = className;
|
|
297
|
+
$[4] = t1;
|
|
298
|
+
} else {
|
|
299
|
+
t1 = $[4];
|
|
300
|
+
}
|
|
301
|
+
const t2 = forwardRef;
|
|
302
|
+
let t3;
|
|
303
|
+
if ($[5] !== props || $[6] !== t1 || $[7] !== t2) {
|
|
304
|
+
t3 = /*#__PURE__*/jsx("li", {
|
|
305
|
+
...props,
|
|
306
|
+
className: t1,
|
|
307
|
+
ref: t2,
|
|
308
|
+
role: "presentation"
|
|
309
|
+
});
|
|
310
|
+
$[5] = props;
|
|
311
|
+
$[6] = t1;
|
|
312
|
+
$[7] = t2;
|
|
313
|
+
$[8] = t3;
|
|
314
|
+
} else {
|
|
315
|
+
t3 = $[8];
|
|
316
|
+
}
|
|
317
|
+
return t3;
|
|
233
318
|
}
|
|
319
|
+
const t1 = props;
|
|
234
320
|
let t2;
|
|
235
|
-
if ($[
|
|
236
|
-
t2 =
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
321
|
+
if ($[9] !== className) {
|
|
322
|
+
t2 = clsx(className, classes.TimelineBreak);
|
|
323
|
+
$[9] = className;
|
|
324
|
+
$[10] = t2;
|
|
325
|
+
} else {
|
|
326
|
+
t2 = $[10];
|
|
327
|
+
}
|
|
328
|
+
const t3 = forwardRef;
|
|
329
|
+
let t4;
|
|
330
|
+
if ($[11] !== t1 || $[12] !== t2 || $[13] !== t3) {
|
|
331
|
+
t4 = /*#__PURE__*/jsx("div", {
|
|
332
|
+
...t1,
|
|
333
|
+
className: t2,
|
|
334
|
+
ref: t3
|
|
240
335
|
});
|
|
241
|
-
$[
|
|
242
|
-
$[
|
|
243
|
-
$[
|
|
244
|
-
$[
|
|
336
|
+
$[11] = t1;
|
|
337
|
+
$[12] = t2;
|
|
338
|
+
$[13] = t3;
|
|
339
|
+
$[14] = t4;
|
|
245
340
|
} else {
|
|
246
|
-
|
|
341
|
+
t4 = $[14];
|
|
247
342
|
}
|
|
248
|
-
return
|
|
343
|
+
return t4;
|
|
249
344
|
});
|
|
250
345
|
TimelineBreak.displayName = 'TimelineBreak';
|
|
251
346
|
const TimelineActions = /*#__PURE__*/React.forwardRef((t0, forwardRef) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import './Timeline-
|
|
1
|
+
import './Timeline-ff81db92.css';
|
|
2
2
|
|
|
3
3
|
var classes = {"Timeline":"prc-Timeline-Timeline-awSoC","TimelineItem":"prc-Timeline-TimelineItem-QwDVH","TimelineItemAvatar":"prc-Timeline-TimelineItemAvatar-4zO8f","TimelineBadge":"prc-Timeline-TimelineBadge-u0qSm","TimelineBadgeWrapper":"prc-Timeline-TimelineBadgeWrapper-SZw4k","TimelineBody":"prc-Timeline-TimelineBody-tjOtb","TimelineBreak":"prc-Timeline-TimelineBreak-X8eti","TimelineItemActions":"prc-Timeline-TimelineItemActions-56Y7h"};
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../src/TooltipV2/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiD,KAAK,yBAAyB,EAAC,MAAM,OAAO,CAAA;AAS3G,OAAO,EAAoD,KAAK,mBAAmB,EAAC,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../src/TooltipV2/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiD,KAAK,yBAAyB,EAAC,MAAM,OAAO,CAAA;AAS3G,OAAO,EAAoD,KAAK,mBAAmB,EAAC,MAAM,mBAAmB,CAAA;AAI7G,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAA;AAE9C,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,CAAA;AAChF,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,iBAAiB,CAAC;IACjD,SAAS,CAAC,EAAE,gBAAgB,CAAA;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,OAAO,GAAG,aAAa,CAAA;IAC9B,cAAc,CAAC,EAAE,mBAAmB,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAA;IACjF;;;;;OAKG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAA;IACnC;;;;;;;;OAQG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAA;CACjC,CAAC,GACA,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAA;AAiEnC,eAAO,MAAM,cAAc;gBAAoC,MAAM;EAAM,CAAA;AAI3E,eAAO,MAAM,OAAO,EAAE,yBAAyB,CAC7C,KAAK,CAAC,eAAe,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,CACvE,GACC,UAkSD,CAAA"}
|
|
@@ -5,13 +5,13 @@ import { getAnchoredPosition } from '@primer/behaviors';
|
|
|
5
5
|
import { isSupported, apply } from '@oddbird/popover-polyfill/fn';
|
|
6
6
|
import { clsx } from 'clsx';
|
|
7
7
|
import classes from './Tooltip.module.css.js';
|
|
8
|
+
import { usePlatform } from '../KeybindingHint/platform.js';
|
|
8
9
|
import VisuallyHidden from '../_VisuallyHidden.js';
|
|
9
10
|
import useSafeTimeout from '../hooks/useSafeTimeout.js';
|
|
10
11
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
11
12
|
import { useId } from '../hooks/useId.js';
|
|
12
13
|
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
|
|
13
14
|
import { useOnEscapePress } from '../hooks/useOnEscapePress.js';
|
|
14
|
-
import { useIsMacOS } from '../hooks/useIsMacOS.js';
|
|
15
15
|
import { getAccessibleKeybindingHintString, KeybindingHint } from '../KeybindingHint/KeybindingHint.js';
|
|
16
16
|
|
|
17
17
|
// map tooltip direction to anchoredPosition props
|
|
@@ -195,7 +195,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(({
|
|
|
195
195
|
closeTooltip();
|
|
196
196
|
}
|
|
197
197
|
}, [isPopoverOpen]);
|
|
198
|
-
const
|
|
198
|
+
const platform = usePlatform();
|
|
199
199
|
const hasAriaLabel = 'aria-label' in rest;
|
|
200
200
|
|
|
201
201
|
// Normalize keybindingHint to an array for uniform rendering
|
|
@@ -290,7 +290,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(({
|
|
|
290
290
|
children: [/*#__PURE__*/jsxs("span", {
|
|
291
291
|
id: hasAriaLabel ? undefined : tooltipId,
|
|
292
292
|
children: [text, /*#__PURE__*/jsxs(VisuallyHidden, {
|
|
293
|
-
children: ["(", keybindingHints.map(hint => getAccessibleKeybindingHintString(hint,
|
|
293
|
+
children: ["(", keybindingHints.map(hint => getAccessibleKeybindingHintString(hint, platform)).join(' or '), ")"]
|
|
294
294
|
})]
|
|
295
295
|
}), /*#__PURE__*/jsx("span", {
|
|
296
296
|
className: clsx(classes.KeybindingHintContainer, text && classes.HasTextBefore, keybindingHints.length > 1 && classes.HasMultipleHints),
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
.prc-TreeView-TreeViewRootUlStyles-Mzrmj{list-style:none;margin:0;padding:0}.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItem-Ter5f{outline:none;overflow-clip-margin:var(--base-size-8,.5rem)}:is(.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItem-Ter5f):focus-visible>div,:is(.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItem-Ter5f).focus-visible>div{box-shadow:var(--boxShadow-thick,inset 0 0 0 .125rem) var(--fgColor-accent,#0969da)}@media (forced-colors:active){:is(.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItem-Ter5f):focus-visible>div,:is(.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItem-Ter5f).focus-visible>div{outline:2px solid HighlightText;outline-offset:-2px}}[data-has-leading-action]:is(.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItem-Ter5f){--has-leading-action:1}.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItemContainer-z6qqQ{--level:1;--toggle-width:1rem;--min-item-height:2rem;border-radius:var(--borderRadius-medium,.375rem);color:var(--fgColor-default,#1f2328);cursor:pointer;display:grid;font-size:var(--text-body-size-medium,.875rem);grid-template-areas:"spacer leadingAction toggle content trailingAction";grid-template-columns:var(--spacer-width) var(--leading-action-width) var(--toggle-width) 1fr auto;overflow-clip-margin:var(--base-size-8,.5rem);position:relative;width:100%;--leading-action-width:calc(var(--has-leading-action, 0)*1.5rem);--spacer-width:calc((var(--level) - 1)*(var(--toggle-width)/2))}:is(.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItemContainer-z6qqQ):hover{background-color:var(--control-transparent-bgColor-hover,#818b981a)}@media (forced-colors:active){:is(.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItemContainer-z6qqQ):hover{outline:2px solid transparent;outline-offset:-2px}}@media (pointer:coarse){.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItemContainer-z6qqQ{--toggle-width:1.5rem;--min-item-height:2.75rem}}.prc-TreeView-TreeViewRootUlStyles-Mzrmj:where([data-omit-spacer=true]) .prc-TreeView-TreeViewItemContainer-z6qqQ{grid-template-columns:0 0 0 1fr auto}.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItem-Ter5f:where([data-loading])>.prc-TreeView-TreeViewItemContainer-z6qqQ:hover{background-color:transparent;cursor:default}@media (forced-colors:active){.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItem-Ter5f:where([data-loading])>.prc-TreeView-TreeViewItemContainer-z6qqQ:hover{outline:none}}.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItem-Ter5f[aria-current=true]>.prc-TreeView-TreeViewItemContainer-z6qqQ{background-color:var(--control-transparent-bgColor-selected,#818b9826)}:is(.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItem-Ter5f[aria-current=true]>.prc-TreeView-TreeViewItemContainer-z6qqQ):after{background-color:var(--fgColor-accent,#0969da);border-radius:var(--borderRadius-medium,.375rem);content:"";height:1.5rem;left:calc(var(--base-size-8,.5rem)*-1);position:absolute;top:calc(50% - var(--base-size-12,.75rem));width:.25rem}@media (forced-colors:active){:is(.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItem-Ter5f[aria-current=true]>.prc-TreeView-TreeViewItemContainer-z6qqQ):after{background-color:HighlightText}}.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItemToggle-hq3Xq{align-items:flex-start;color:var(--fgColor-muted,#59636e);display:flex;grid-area:toggle;height:100%;justify-content:center;padding-top:calc(var(--min-item-height)/2 - var(--base-size-12,.75rem)/2)}.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItemToggleHover-H9tbt:hover{background-color:var(--control-transparent-bgColor-hover,#818b981a)}.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItemToggleEnd-nWt9I{border-bottom-left-radius:var(--borderRadius-medium,.375rem);border-top-left-radius:var(--borderRadius-medium,.375rem)}.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItemContent-RKsCI{display:flex;gap:var(--stack-gap-condensed,.5rem);grid-area:content;height:100%;line-height:var(--custom-line-height,var(--text-body-lineHeight-medium,1.4285));padding:0 var(--base-size-8,.5rem);padding-bottom:calc((var(--min-item-height) - var(--custom-line-height, 1.3rem))/2);padding-top:calc((var(--min-item-height) - var(--custom-line-height, 1.3rem))/2)}.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItemContentText-FFaKp{flex:1 1 auto;width:0}.prc-TreeView-TreeViewRootUlStyles-Mzrmj:where([data-truncate-text=true]) .prc-TreeView-TreeViewItemContentText-FFaKp{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.prc-TreeView-TreeViewRootUlStyles-Mzrmj:where([data-truncate-text=false]) .prc-TreeView-TreeViewItemContentText-FFaKp{word-break:break-word}.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItemVisual-naWzj{align-items:center;color:var(--fgColor-muted,#59636e);display:flex;height:var(--custom-line-height,1.3rem)}.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItemLeadingAction-vmOIV{color:var(--fgColor-muted,#59636e);display:flex;grid-area:leadingAction}:is(.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItemLeadingAction-vmOIV)>button{flex-shrink:1}.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItemTrailingAction-h9M5g{color:var(--fgColor-muted,#59636e);display:flex;grid-area:trailingAction}.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItemTrailingActionButton-pCTdP{flex-shrink:1}.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewItemLevelLine-F-0-2{border-right:var(--borderWidth-thin,.0625rem) solid;border-color:var(--tree-line-color,var(--borderColor-muted,#d1d9e0b3));height:100%;width:100%}@media (hover:hover){.prc-TreeView-TreeViewRootUlStyles-Mzrmj{--tree-line-color:transparent}.prc-TreeView-TreeViewRootUlStyles-Mzrmj:focus-within,.prc-TreeView-TreeViewRootUlStyles-Mzrmj:hover{--tree-line-color:var(--borderColor-muted,#d1d9e0b3)}}.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewDirectoryIcon-yP1oY{color:var(--treeViewItem-leadingVisual-iconColor-rest,#54aeff);display:grid}.prc-TreeView-TreeViewRootUlStyles-Mzrmj .prc-TreeView-TreeViewVisuallyHidden-1N8xK{height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;clip:rect(0,0,0,0);border-width:0;white-space:nowrap}.prc-TreeView-TreeViewSkeletonItemContainerStyle-lKqwd{align-items:center;column-gap:.5rem;display:flex;height:2rem}@media (pointer:coarse){.prc-TreeView-TreeViewSkeletonItemContainerStyle-lKqwd{height:2.75rem}}.prc-TreeView-TreeViewSkeletonItemContainerStyle-lKqwd:nth-of-type(5n+1){--tree-item-loading-width:67%}.prc-TreeView-TreeViewSkeletonItemContainerStyle-lKqwd:nth-of-type(5n+2){--tree-item-loading-width:47%}.prc-TreeView-TreeViewSkeletonItemContainerStyle-lKqwd:nth-of-type(5n+3){--tree-item-loading-width:73%}.prc-TreeView-TreeViewSkeletonItemContainerStyle-lKqwd:nth-of-type(5n+4){--tree-item-loading-width:64%}.prc-TreeView-TreeViewSkeletonItemContainerStyle-lKqwd:nth-of-type(5n+5){--tree-item-loading-width:50%}.prc-TreeView-TreeItemSkeletonTextStyles-8VJ-g{width:var(--tree-item-loading-width,67%)}
|
|
2
|
+
/*# sourceMappingURL=TreeView-1bf45a33.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/TreeView/TreeView.module.css.js"],"names":[],"mappings":"AAAA,yCAGE,eAAgB,CADhB,QAAS,CADT,SA8PF,CA7OE,0EAQE,YAAa,CADb,6CAgBF,CAbE,kMAEE,mFAMF,CAJE,8BAJF,kMAKI,+BAAgC,CAChC,mBAEJ,CADE,CAGF,wGACE,sBACF,CAGF,mFACE,SAAU,CACV,mBAAoB,CACpB,sBA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F,CACF,CAEA,mFAEE,8DAAuD,CADvD,YAEF,CAEA,oFAGE,UAAW,CAGX,WAAY,CACZ,eAAgB,CAHhB,SAAU,CAHV,iBAAkB,CAClB,SAAU,CAOV,kBAAsB,CAEtB,cAAe,CADf,kBAEF,CAGF,uDAEE,kBAAmB,CACnB,gBAAkB,CAFlB,YAAa,CAGb,WAyBF,CAvBE,wBANF,uDAOI,cAsBJ,CArBE,CAEA,yEACE,6BACF,CAEA,yEACE,6BACF,CAEA,yEACE,6BACF,CAEA,yEACE,6BACF,CAEA,yEACE,6BACF,CAGF,+CACE,wCACF","file":"TreeView-1bf45a33.css","sourcesContent":[".TreeViewRootUlStyles {\n padding: 0;\n margin: 0;\n list-style: none;\n\n /*\n * WARNING: This is a performance optimization.\n *\n * We define styles for the tree items at the root level of the tree\n * to avoid recomputing the styles for each item when the tree updates.\n * We're sacrificing maintainability for performance because TreeView\n * needs to be performant enough to handle large trees (thousands of items).\n *\n * This is intended to be a temporary solution until we can improve the\n * performance of our styling patterns.\n *\n * Do NOT copy this pattern without understanding the tradeoffs.\n */\n .TreeViewItem {\n /*\n * `overflow-clip-margin` extends the paint clip edge by 8px so the current-item indicator\n * (positioned at `left: -8px` of the row container) remains visible when a consumer applies\n * `contain: paint` (or `contain: strict`, or `content-visibility: auto`) to this `<li>`. Has\n * no effect when no paint containment is active, so default rendering is unchanged.\n */\n overflow-clip-margin: var(--base-size-8);\n outline: none;\n\n &:focus-visible > div,\n &:global(.focus-visible) > div {\n box-shadow: var(--boxShadow-thick) var(--fgColor-accent);\n\n @media (forced-colors: active) {\n outline: 2px solid HighlightText;\n outline-offset: -2px;\n }\n }\n\n &[data-has-leading-action] {\n --has-leading-action: 1;\n }\n }\n\n .TreeViewItemContainer {\n --level: 1;\n --toggle-width: 1rem;\n --min-item-height: 2rem;\n\n position: relative;\n display: grid;\n width: 100%;\n /*\n * Mirrors the `overflow-clip-margin` on `.TreeViewItem` so the indicator also stays\n * visible when `containIntrinsicSize` is set on this row (which sets\n * `content-visibility: auto` on this container and implies paint containment).\n */\n overflow-clip-margin: var(--base-size-8);\n font-size: var(--text-body-size-medium);\n color: var(--fgColor-default);\n cursor: pointer;\n border-radius: var(--borderRadius-medium);\n grid-template-columns: var(--spacer-width) var(--leading-action-width) var(--toggle-width) 1fr auto;\n grid-template-areas: 'spacer leadingAction toggle content trailingAction';\n\n --leading-action-width: calc(var(--has-leading-action, 0) * 1.5rem);\n --spacer-width: calc(calc(var(--level) - 1) * (var(--toggle-width) / 2));\n\n &:hover {\n background-color: var(--control-transparent-bgColor-hover);\n\n @media (forced-colors: active) {\n outline: 2px solid transparent;\n outline-offset: -2px;\n }\n }\n\n @media (pointer: coarse) {\n --toggle-width: 1.5rem;\n --min-item-height: 2.75rem;\n }\n }\n\n &:where([data-omit-spacer='true']) .TreeViewItemContainer {\n grid-template-columns: 0 0 0 1fr auto;\n }\n\n /*\n * Suppress hover affordances on rows being used as skeleton loading placeholders.\n * Marked positively via `data-loading` from `LoadingItem` so we avoid the broad\n * invalidation cost of `:has(.TreeViewItemSkeleton)` across every row in large trees.\n */\n .TreeViewItem:where([data-loading]) > .TreeViewItemContainer:hover {\n cursor: default;\n background-color: transparent;\n\n @media (forced-colors: active) {\n outline: none;\n }\n }\n\n .TreeViewItem[aria-current='true'] > .TreeViewItemContainer {\n background-color: var(--control-transparent-bgColor-selected);\n\n /* Current item indicator */\n /* stylelint-disable-next-line selector-max-specificity */\n &::after {\n position: absolute;\n top: calc(50% - var(--base-size-12));\n left: calc(-1 * var(--base-size-8));\n width: 0.25rem;\n height: 1.5rem;\n content: '';\n\n /*\n * Use fgColor accent for consistency across all themes. Using the \"correct\" variable,\n * --bgColor-accent-emphasis, causes vrt failures for dark high contrast mode\n */\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--fgColor-accent);\n border-radius: var(--borderRadius-medium);\n\n @media (forced-colors: active) {\n background-color: HighlightText;\n }\n }\n }\n\n .TreeViewItemToggle {\n display: flex;\n height: 100%;\n\n /* The toggle should appear vertically centered for single-line items, but remain at the top for items that wrap\n across more lines. */\n /* stylelint-disable-next-line primer/spacing */\n padding-top: calc(var(--min-item-height) / 2 - var(--base-size-12) / 2);\n color: var(--fgColor-muted);\n grid-area: toggle;\n justify-content: center;\n align-items: flex-start;\n }\n\n .TreeViewItemToggleHover:hover {\n background-color: var(--control-transparent-bgColor-hover);\n }\n\n .TreeViewItemToggleEnd {\n border-top-left-radius: var(--borderRadius-medium);\n border-bottom-left-radius: var(--borderRadius-medium);\n }\n\n .TreeViewItemContent {\n display: flex;\n height: 100%;\n padding: 0 var(--base-size-8);\n\n /* The dynamic top and bottom padding to maintain the minimum item height for single line items */\n /* stylelint-disable-next-line primer/spacing */\n padding-top: calc((var(--min-item-height) - var(--custom-line-height, 1.3rem)) / 2);\n /* stylelint-disable-next-line primer/spacing */\n padding-bottom: calc((var(--min-item-height) - var(--custom-line-height, 1.3rem)) / 2);\n line-height: var(--custom-line-height, var(--text-body-lineHeight-medium, 1.4285));\n grid-area: content;\n gap: var(--stack-gap-condensed);\n }\n\n .TreeViewItemContentText {\n flex: 1 1 auto;\n width: 0;\n }\n\n &:where([data-truncate-text='true']) .TreeViewItemContentText {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n &:where([data-truncate-text='false']) .TreeViewItemContentText {\n /* stylelint-disable-next-line declaration-property-value-keyword-no-deprecated */\n word-break: break-word;\n }\n\n .TreeViewItemVisual {\n display: flex;\n\n /* The visual icons should appear vertically centered for single-line items, but remain at the top for items that wrap\n across more lines. */\n height: var(--custom-line-height, 1.3rem);\n color: var(--fgColor-muted);\n align-items: center;\n }\n\n .TreeViewItemLeadingAction {\n display: flex;\n color: var(--fgColor-muted);\n grid-area: leadingAction;\n\n & > button {\n flex-shrink: 1;\n }\n }\n\n .TreeViewItemTrailingAction {\n display: flex;\n color: var(--fgColor-muted);\n grid-area: trailingAction;\n }\n\n .TreeViewItemTrailingActionButton {\n flex-shrink: 1;\n }\n\n .TreeViewItemLevelLine {\n width: 100%;\n height: 100%;\n border-right: var(--borderWidth-thin) solid;\n\n /*\n * `--tree-line-color` is set on the root `<ul>` and inherited down. On coarse pointers it\n * stays unset and falls back to `muted` (lines always visible). On hover-capable devices it\n * is initialized to `transparent` on the root and flipped to `muted` while the tree is\n * hovered or focused, so the browser only has to propagate a single inherited custom\n * property instead of re-matching `.TreeViewItemLevelLine` descendant selectors on every\n * hover/focus change inside large trees.\n */\n /* stylelint-disable-next-line primer/colors -- private custom property, defaults to a Primer token */\n border-color: var(--tree-line-color, var(--borderColor-muted));\n }\n\n @media (hover: hover) {\n --tree-line-color: transparent;\n\n &:hover,\n &:focus-within {\n --tree-line-color: var(--borderColor-muted);\n }\n }\n\n .TreeViewDirectoryIcon {\n display: grid;\n color: var(--treeViewItem-leadingVisual-iconColor-rest);\n }\n\n .TreeViewVisuallyHidden {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n /* stylelint-disable-next-line primer/spacing */\n margin: -1px;\n overflow: hidden;\n /* stylelint-disable-next-line property-no-deprecated */\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n }\n}\n\n.TreeViewSkeletonItemContainerStyle {\n display: flex;\n align-items: center;\n column-gap: 0.5rem;\n height: 2rem;\n\n @media (pointer: coarse) {\n height: 2.75rem;\n }\n\n &:nth-of-type(5n + 1) {\n --tree-item-loading-width: 67%;\n }\n\n &:nth-of-type(5n + 2) {\n --tree-item-loading-width: 47%;\n }\n\n &:nth-of-type(5n + 3) {\n --tree-item-loading-width: 73%;\n }\n\n &:nth-of-type(5n + 4) {\n --tree-item-loading-width: 64%;\n }\n\n &:nth-of-type(5n + 5) {\n --tree-item-loading-width: 50%;\n }\n}\n\n.TreeItemSkeletonTextStyles {\n width: var(--tree-item-loading-width, 67%);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeView.d.ts","sourceRoot":"","sources":["../../src/TreeView/TreeView.tsx"],"names":[],"mappings":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CACrB,CAAA;AAwED,MAAM,MAAM,wBAAwB,GAAG;IACrC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;CACvB,CAAA;AA4CD,eAAO,MAAM,QAAQ;;;;;;;;CAQnB,CAAA"}
|
|
@@ -15,9 +15,9 @@ import { useTypeahead } from './useTypeahead.js';
|
|
|
15
15
|
import { IconButton } from '../Button/IconButton.js';
|
|
16
16
|
import { ButtonComponent } from '../Button/Button.js';
|
|
17
17
|
import { ActionList } from '../ActionList/index.js';
|
|
18
|
+
import { usePlatform } from '../KeybindingHint/platform.js';
|
|
18
19
|
import { isSlot } from '../utils/is-slot.js';
|
|
19
20
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
20
|
-
import { useIsMacOS } from '../hooks/useIsMacOS.js';
|
|
21
21
|
import { AriaStatus } from '../live-region/AriaStatus.js';
|
|
22
22
|
import Spinner from '../Spinner/Spinner.js';
|
|
23
23
|
import { Tooltip } from '../TooltipV2/Tooltip.js';
|
|
@@ -46,6 +46,11 @@ const ItemContext = /*#__PURE__*/React.createContext({
|
|
|
46
46
|
trailingActionId: ''
|
|
47
47
|
});
|
|
48
48
|
|
|
49
|
+
// Module-private channel from LoadingItem to the Item it renders. Lets us mark the placeholder
|
|
50
|
+
// row with `data-loading` (used by CSS to suppress hover affordances) without exposing an
|
|
51
|
+
// internal-only prop on the public TreeViewItemProps API.
|
|
52
|
+
const LoadingPlaceholderContext = /*#__PURE__*/React.createContext(false);
|
|
53
|
+
|
|
49
54
|
// ----------------------------------------------------------------------------
|
|
50
55
|
// TreeView
|
|
51
56
|
|
|
@@ -303,6 +308,7 @@ const Item = /*#__PURE__*/React.forwardRef(({
|
|
|
303
308
|
const {
|
|
304
309
|
level
|
|
305
310
|
} = React.useContext(ItemContext);
|
|
311
|
+
const isLoadingPlaceholder = React.useContext(LoadingPlaceholderContext);
|
|
306
312
|
const {
|
|
307
313
|
hasSubTree,
|
|
308
314
|
subTree,
|
|
@@ -311,7 +317,7 @@ const Item = /*#__PURE__*/React.forwardRef(({
|
|
|
311
317
|
const [isSubTreeEmpty, setIsSubTreeEmpty] = React.useState(!hasSubTree);
|
|
312
318
|
const [actionCommandPressed, setActionCommandPressed] = React.useState(false);
|
|
313
319
|
const [isFocused, setIsFocused] = React.useState(false);
|
|
314
|
-
const
|
|
320
|
+
const platform = usePlatform();
|
|
315
321
|
|
|
316
322
|
// Set the expanded state and cache it
|
|
317
323
|
const setIsExpandedWithCache = React.useCallback(
|
|
@@ -372,8 +378,8 @@ const Item = /*#__PURE__*/React.forwardRef(({
|
|
|
372
378
|
}
|
|
373
379
|
}, [onSelect, setIsExpandedWithCache, toggle, activateActionsDialog]);
|
|
374
380
|
const ariaDescribedByIds = [slots.leadingVisual ? leadingVisualId : null, slots.trailingVisual ? trailingVisualId : null].filter(Boolean);
|
|
375
|
-
const shortcut = `Shift+${
|
|
376
|
-
const trailingActionShortcutText = `Press (${getAccessibleKeybindingHintString(shortcut,
|
|
381
|
+
const shortcut = `Shift+${platform === 'apple' ? 'Meta' : 'Control'}+U`;
|
|
382
|
+
const trailingActionShortcutText = `Press (${getAccessibleKeybindingHintString(shortcut, platform)}) for more actions.`;
|
|
377
383
|
return /*#__PURE__*/jsx(ItemContext.Provider, {
|
|
378
384
|
value: {
|
|
379
385
|
itemId,
|
|
@@ -400,6 +406,7 @@ const Item = /*#__PURE__*/React.forwardRef(({
|
|
|
400
406
|
"aria-current": isCurrentItem ? 'true' : undefined,
|
|
401
407
|
"aria-selected": isFocused ? 'true' : 'false',
|
|
402
408
|
"data-has-leading-action": slots.leadingAction ? true : undefined,
|
|
409
|
+
"data-loading": isLoadingPlaceholder ? true : undefined,
|
|
403
410
|
onKeyDown: handleKeyDown,
|
|
404
411
|
onFocus: event_1 => {
|
|
405
412
|
// Defer scroll to the next animation frame so that rapid keyboard
|
|
@@ -778,10 +785,13 @@ const LoadingItem = /*#__PURE__*/React.forwardRef((t0, ref) => {
|
|
|
778
785
|
}
|
|
779
786
|
let t4;
|
|
780
787
|
if ($[5] !== itemId || $[6] !== ref || $[7] !== t1 || $[8] !== t3) {
|
|
781
|
-
t4 = /*#__PURE__*/
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
788
|
+
t4 = /*#__PURE__*/jsx(LoadingPlaceholderContext.Provider, {
|
|
789
|
+
value: true,
|
|
790
|
+
children: /*#__PURE__*/jsxs(Item, {
|
|
791
|
+
id: itemId,
|
|
792
|
+
ref: ref,
|
|
793
|
+
children: [t1, t3]
|
|
794
|
+
})
|
|
785
795
|
});
|
|
786
796
|
$[5] = itemId;
|
|
787
797
|
$[6] = ref;
|
|
@@ -813,10 +823,13 @@ const LoadingItem = /*#__PURE__*/React.forwardRef((t0, ref) => {
|
|
|
813
823
|
}
|
|
814
824
|
let t3;
|
|
815
825
|
if ($[12] !== itemId || $[13] !== ref) {
|
|
816
|
-
t3 = /*#__PURE__*/
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
826
|
+
t3 = /*#__PURE__*/jsx(LoadingPlaceholderContext.Provider, {
|
|
827
|
+
value: true,
|
|
828
|
+
children: /*#__PURE__*/jsxs(Item, {
|
|
829
|
+
id: itemId,
|
|
830
|
+
ref: ref,
|
|
831
|
+
children: [t1, t2]
|
|
832
|
+
})
|
|
820
833
|
});
|
|
821
834
|
$[12] = itemId;
|
|
822
835
|
$[13] = ref;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import './TreeView-
|
|
1
|
+
import './TreeView-1bf45a33.css';
|
|
2
2
|
|
|
3
|
-
var classes = {"TreeViewRootUlStyles":"prc-TreeView-TreeViewRootUlStyles-Mzrmj","TreeViewItem":"prc-TreeView-TreeViewItem-Ter5f","TreeViewItemContainer":"prc-TreeView-TreeViewItemContainer-z6qqQ","
|
|
3
|
+
var classes = {"TreeViewRootUlStyles":"prc-TreeView-TreeViewRootUlStyles-Mzrmj","TreeViewItem":"prc-TreeView-TreeViewItem-Ter5f","TreeViewItemContainer":"prc-TreeView-TreeViewItemContainer-z6qqQ","TreeViewItemToggle":"prc-TreeView-TreeViewItemToggle-hq3Xq","TreeViewItemToggleHover":"prc-TreeView-TreeViewItemToggleHover-H9tbt","TreeViewItemToggleEnd":"prc-TreeView-TreeViewItemToggleEnd-nWt9I","TreeViewItemContent":"prc-TreeView-TreeViewItemContent-RKsCI","TreeViewItemContentText":"prc-TreeView-TreeViewItemContentText-FFaKp","TreeViewItemVisual":"prc-TreeView-TreeViewItemVisual-naWzj","TreeViewItemLeadingAction":"prc-TreeView-TreeViewItemLeadingAction-vmOIV","TreeViewItemTrailingAction":"prc-TreeView-TreeViewItemTrailingAction-h9M5g","TreeViewItemTrailingActionButton":"prc-TreeView-TreeViewItemTrailingActionButton-pCTdP","TreeViewItemLevelLine":"prc-TreeView-TreeViewItemLevelLine-F-0-2","TreeViewDirectoryIcon":"prc-TreeView-TreeViewDirectoryIcon-yP1oY","TreeViewVisuallyHidden":"prc-TreeView-TreeViewVisuallyHidden-1N8xK","TreeViewSkeletonItemContainerStyle":"prc-TreeView-TreeViewSkeletonItemContainerStyle-lKqwd","TreeItemSkeletonTextStyles":"prc-TreeView-TreeItemSkeletonTextStyles-8VJ-g"};
|
|
4
4
|
|
|
5
5
|
export { classes as default };
|