@primer/react 0.0.0-20260223174439 → 0.0.0-20260223175050
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 +3 -5
- package/dist/Autocomplete/Autocomplete.js +159 -76
- package/dist/Autocomplete/AutocompleteMenu.js +333 -128
- package/dist/Autocomplete/AutocompleteOverlay.js +130 -49
- package/dist/Banner/Banner.js +238 -64
- package/dist/Checkbox/Checkbox.js +163 -55
- package/dist/Dialog/Dialog.js +347 -105
- package/dist/PageLayout/PageLayout.js +1560 -622
- package/dist/SelectPanel/SelectPanel.d.ts.map +1 -1
- package/dist/SelectPanel/SelectPanel.js +32 -82
- package/dist/TreeView/useRovingTabIndex.d.ts +14 -0
- package/dist/TreeView/useRovingTabIndex.d.ts.map +1 -1
- package/dist/TreeView/useRovingTabIndex.js +94 -16
- package/dist/UnderlineNav/UnderlineNavItem.js +149 -56
- package/dist/experimental/SelectPanel2/SelectPanel.js +593 -209
- package/dist/hooks/useScrollFlash.js +27 -17
- package/package.json +1 -1
package/dist/Dialog/Dialog.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { c } from 'react-compiler-runtime';
|
|
1
2
|
import React, { useRef, useState, useCallback, useEffect } from 'react';
|
|
2
3
|
import { IconButton } from '../Button/IconButton.js';
|
|
3
4
|
import { ButtonComponent } from '../Button/Button.js';
|
|
@@ -16,58 +17,139 @@ import { useOnEscapePress } from '../hooks/useOnEscapePress.js';
|
|
|
16
17
|
import { ScrollableRegion } from '../ScrollableRegion/ScrollableRegion.js';
|
|
17
18
|
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
|
|
18
19
|
|
|
19
|
-
const DefaultHeader =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
20
|
+
const DefaultHeader = t0 => {
|
|
21
|
+
const $ = c(16);
|
|
22
|
+
const {
|
|
23
|
+
dialogLabelId,
|
|
24
|
+
title,
|
|
25
|
+
subtitle,
|
|
26
|
+
dialogDescriptionId,
|
|
27
|
+
onClose
|
|
28
|
+
} = t0;
|
|
29
|
+
let t1;
|
|
30
|
+
if ($[0] !== onClose) {
|
|
31
|
+
t1 = () => {
|
|
32
|
+
onClose("close-button");
|
|
33
|
+
};
|
|
34
|
+
$[0] = onClose;
|
|
35
|
+
$[1] = t1;
|
|
36
|
+
} else {
|
|
37
|
+
t1 = $[1];
|
|
38
|
+
}
|
|
39
|
+
const onCloseClick = t1;
|
|
40
|
+
const t2 = title !== null && title !== void 0 ? title : "Dialog";
|
|
41
|
+
let t3;
|
|
42
|
+
if ($[2] !== dialogLabelId || $[3] !== t2) {
|
|
43
|
+
t3 = /*#__PURE__*/jsx(Dialog.Title, {
|
|
44
|
+
id: dialogLabelId,
|
|
45
|
+
children: t2
|
|
46
|
+
});
|
|
47
|
+
$[2] = dialogLabelId;
|
|
48
|
+
$[3] = t2;
|
|
49
|
+
$[4] = t3;
|
|
50
|
+
} else {
|
|
51
|
+
t3 = $[4];
|
|
52
|
+
}
|
|
53
|
+
let t4;
|
|
54
|
+
if ($[5] !== dialogDescriptionId || $[6] !== subtitle) {
|
|
55
|
+
t4 = subtitle && /*#__PURE__*/jsx(Dialog.Subtitle, {
|
|
56
|
+
id: dialogDescriptionId,
|
|
57
|
+
children: subtitle
|
|
58
|
+
});
|
|
59
|
+
$[5] = dialogDescriptionId;
|
|
60
|
+
$[6] = subtitle;
|
|
61
|
+
$[7] = t4;
|
|
62
|
+
} else {
|
|
63
|
+
t4 = $[7];
|
|
64
|
+
}
|
|
65
|
+
let t5;
|
|
66
|
+
if ($[8] !== t3 || $[9] !== t4) {
|
|
67
|
+
t5 = /*#__PURE__*/jsxs("div", {
|
|
68
|
+
className: classes.HeaderContent,
|
|
69
|
+
children: [t3, t4]
|
|
70
|
+
});
|
|
71
|
+
$[8] = t3;
|
|
72
|
+
$[9] = t4;
|
|
73
|
+
$[10] = t5;
|
|
74
|
+
} else {
|
|
75
|
+
t5 = $[10];
|
|
76
|
+
}
|
|
77
|
+
let t6;
|
|
78
|
+
if ($[11] !== onCloseClick) {
|
|
79
|
+
t6 = /*#__PURE__*/jsx(Dialog.CloseButton, {
|
|
80
|
+
onClose: onCloseClick
|
|
81
|
+
});
|
|
82
|
+
$[11] = onCloseClick;
|
|
83
|
+
$[12] = t6;
|
|
84
|
+
} else {
|
|
85
|
+
t6 = $[12];
|
|
86
|
+
}
|
|
87
|
+
let t7;
|
|
88
|
+
if ($[13] !== t5 || $[14] !== t6) {
|
|
89
|
+
t7 = /*#__PURE__*/jsx(Dialog.Header, {
|
|
90
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
91
|
+
className: classes.HeaderInner,
|
|
92
|
+
children: [t5, t6]
|
|
93
|
+
})
|
|
94
|
+
});
|
|
95
|
+
$[13] = t5;
|
|
96
|
+
$[14] = t6;
|
|
97
|
+
$[15] = t7;
|
|
98
|
+
} else {
|
|
99
|
+
t7 = $[15];
|
|
100
|
+
}
|
|
101
|
+
return t7;
|
|
46
102
|
};
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
103
|
+
const DefaultBody = t0 => {
|
|
104
|
+
const $ = c(2);
|
|
105
|
+
const {
|
|
106
|
+
children
|
|
107
|
+
} = t0;
|
|
108
|
+
let t1;
|
|
109
|
+
if ($[0] !== children) {
|
|
110
|
+
t1 = /*#__PURE__*/jsx(Dialog.Body, {
|
|
111
|
+
children: children
|
|
112
|
+
});
|
|
113
|
+
$[0] = children;
|
|
114
|
+
$[1] = t1;
|
|
115
|
+
} else {
|
|
116
|
+
t1 = $[1];
|
|
117
|
+
}
|
|
118
|
+
return t1;
|
|
54
119
|
};
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
120
|
+
const DefaultFooter = t0 => {
|
|
121
|
+
const $ = c(4);
|
|
122
|
+
const {
|
|
123
|
+
footerButtons
|
|
124
|
+
} = t0;
|
|
125
|
+
let t1;
|
|
126
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
127
|
+
t1 = {
|
|
128
|
+
bindKeys: FocusKeys.ArrowHorizontal | FocusKeys.Tab,
|
|
129
|
+
focusInStrategy: "closest"
|
|
130
|
+
};
|
|
131
|
+
$[0] = t1;
|
|
132
|
+
} else {
|
|
133
|
+
t1 = $[0];
|
|
134
|
+
}
|
|
59
135
|
const {
|
|
60
136
|
containerRef: footerRef
|
|
61
|
-
} = useFocusZone(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
})
|
|
70
|
-
|
|
137
|
+
} = useFocusZone(t1);
|
|
138
|
+
let t2;
|
|
139
|
+
if ($[1] !== footerButtons || $[2] !== footerRef) {
|
|
140
|
+
t2 = footerButtons ? /*#__PURE__*/jsx(Dialog.Footer, {
|
|
141
|
+
ref: footerRef,
|
|
142
|
+
children: /*#__PURE__*/jsx(Dialog.Buttons, {
|
|
143
|
+
buttons: footerButtons
|
|
144
|
+
})
|
|
145
|
+
}) : null;
|
|
146
|
+
$[1] = footerButtons;
|
|
147
|
+
$[2] = footerRef;
|
|
148
|
+
$[3] = t2;
|
|
149
|
+
} else {
|
|
150
|
+
t2 = $[3];
|
|
151
|
+
}
|
|
152
|
+
return t2;
|
|
71
153
|
};
|
|
72
154
|
const defaultPosition = {
|
|
73
155
|
narrow: 'center',
|
|
@@ -176,8 +258,8 @@ const _Dialog = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
176
258
|
className: classes.Backdrop,
|
|
177
259
|
...positionDataAttributes,
|
|
178
260
|
onClick: onBackdropClick,
|
|
179
|
-
onMouseDown:
|
|
180
|
-
setLastMouseDownIsBackdrop(
|
|
261
|
+
onMouseDown: e_0 => {
|
|
262
|
+
setLastMouseDownIsBackdrop(e_0.target === e_0.currentTarget);
|
|
181
263
|
},
|
|
182
264
|
children: /*#__PURE__*/jsxs("div", {
|
|
183
265
|
ref: dialogRef,
|
|
@@ -200,59 +282,209 @@ const _Dialog = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
200
282
|
});
|
|
201
283
|
});
|
|
202
284
|
_Dialog.displayName = 'Dialog';
|
|
203
|
-
const Header = /*#__PURE__*/React.forwardRef(function Header({
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
285
|
+
const Header = /*#__PURE__*/React.forwardRef(function Header(t0, forwardRef) {
|
|
286
|
+
const $ = c(9);
|
|
287
|
+
let className;
|
|
288
|
+
let rest;
|
|
289
|
+
if ($[0] !== t0) {
|
|
290
|
+
({
|
|
291
|
+
className,
|
|
292
|
+
...rest
|
|
293
|
+
} = t0);
|
|
294
|
+
$[0] = t0;
|
|
295
|
+
$[1] = className;
|
|
296
|
+
$[2] = rest;
|
|
297
|
+
} else {
|
|
298
|
+
className = $[1];
|
|
299
|
+
rest = $[2];
|
|
300
|
+
}
|
|
301
|
+
let t1;
|
|
302
|
+
if ($[3] !== className) {
|
|
303
|
+
t1 = clsx(className, classes.Header);
|
|
304
|
+
$[3] = className;
|
|
305
|
+
$[4] = t1;
|
|
306
|
+
} else {
|
|
307
|
+
t1 = $[4];
|
|
308
|
+
}
|
|
309
|
+
let t2;
|
|
310
|
+
if ($[5] !== forwardRef || $[6] !== rest || $[7] !== t1) {
|
|
311
|
+
t2 = /*#__PURE__*/jsx("div", {
|
|
312
|
+
ref: forwardRef,
|
|
313
|
+
className: t1,
|
|
314
|
+
...rest
|
|
315
|
+
});
|
|
316
|
+
$[5] = forwardRef;
|
|
317
|
+
$[6] = rest;
|
|
318
|
+
$[7] = t1;
|
|
319
|
+
$[8] = t2;
|
|
320
|
+
} else {
|
|
321
|
+
t2 = $[8];
|
|
322
|
+
}
|
|
323
|
+
return t2;
|
|
212
324
|
});
|
|
213
325
|
Header.displayName = 'Dialog.Header';
|
|
214
|
-
const Title = /*#__PURE__*/React.forwardRef(function Title({
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
326
|
+
const Title = /*#__PURE__*/React.forwardRef(function Title(t0, forwardRef) {
|
|
327
|
+
const $ = c(9);
|
|
328
|
+
let className;
|
|
329
|
+
let rest;
|
|
330
|
+
if ($[0] !== t0) {
|
|
331
|
+
({
|
|
332
|
+
className,
|
|
333
|
+
...rest
|
|
334
|
+
} = t0);
|
|
335
|
+
$[0] = t0;
|
|
336
|
+
$[1] = className;
|
|
337
|
+
$[2] = rest;
|
|
338
|
+
} else {
|
|
339
|
+
className = $[1];
|
|
340
|
+
rest = $[2];
|
|
341
|
+
}
|
|
342
|
+
let t1;
|
|
343
|
+
if ($[3] !== className) {
|
|
344
|
+
t1 = clsx(className, classes.Title);
|
|
345
|
+
$[3] = className;
|
|
346
|
+
$[4] = t1;
|
|
347
|
+
} else {
|
|
348
|
+
t1 = $[4];
|
|
349
|
+
}
|
|
350
|
+
let t2;
|
|
351
|
+
if ($[5] !== forwardRef || $[6] !== rest || $[7] !== t1) {
|
|
352
|
+
t2 = /*#__PURE__*/jsx("h1", {
|
|
353
|
+
ref: forwardRef,
|
|
354
|
+
className: t1,
|
|
355
|
+
...rest
|
|
356
|
+
});
|
|
357
|
+
$[5] = forwardRef;
|
|
358
|
+
$[6] = rest;
|
|
359
|
+
$[7] = t1;
|
|
360
|
+
$[8] = t2;
|
|
361
|
+
} else {
|
|
362
|
+
t2 = $[8];
|
|
363
|
+
}
|
|
364
|
+
return t2;
|
|
223
365
|
});
|
|
224
366
|
Title.displayName = 'Dialog.Title';
|
|
225
|
-
const Subtitle = /*#__PURE__*/React.forwardRef(function Subtitle({
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
367
|
+
const Subtitle = /*#__PURE__*/React.forwardRef(function Subtitle(t0, forwardRef) {
|
|
368
|
+
const $ = c(9);
|
|
369
|
+
let className;
|
|
370
|
+
let rest;
|
|
371
|
+
if ($[0] !== t0) {
|
|
372
|
+
({
|
|
373
|
+
className,
|
|
374
|
+
...rest
|
|
375
|
+
} = t0);
|
|
376
|
+
$[0] = t0;
|
|
377
|
+
$[1] = className;
|
|
378
|
+
$[2] = rest;
|
|
379
|
+
} else {
|
|
380
|
+
className = $[1];
|
|
381
|
+
rest = $[2];
|
|
382
|
+
}
|
|
383
|
+
let t1;
|
|
384
|
+
if ($[3] !== className) {
|
|
385
|
+
t1 = clsx(className, classes.Subtitle);
|
|
386
|
+
$[3] = className;
|
|
387
|
+
$[4] = t1;
|
|
388
|
+
} else {
|
|
389
|
+
t1 = $[4];
|
|
390
|
+
}
|
|
391
|
+
let t2;
|
|
392
|
+
if ($[5] !== forwardRef || $[6] !== rest || $[7] !== t1) {
|
|
393
|
+
t2 = /*#__PURE__*/jsx("h2", {
|
|
394
|
+
ref: forwardRef,
|
|
395
|
+
className: t1,
|
|
396
|
+
...rest
|
|
397
|
+
});
|
|
398
|
+
$[5] = forwardRef;
|
|
399
|
+
$[6] = rest;
|
|
400
|
+
$[7] = t1;
|
|
401
|
+
$[8] = t2;
|
|
402
|
+
} else {
|
|
403
|
+
t2 = $[8];
|
|
404
|
+
}
|
|
405
|
+
return t2;
|
|
234
406
|
});
|
|
235
407
|
Subtitle.displayName = 'Dialog.Subtitle';
|
|
236
|
-
const Body = /*#__PURE__*/React.forwardRef(function Body({
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
408
|
+
const Body = /*#__PURE__*/React.forwardRef(function Body(t0, forwardRef) {
|
|
409
|
+
const $ = c(9);
|
|
410
|
+
let className;
|
|
411
|
+
let rest;
|
|
412
|
+
if ($[0] !== t0) {
|
|
413
|
+
({
|
|
414
|
+
className,
|
|
415
|
+
...rest
|
|
416
|
+
} = t0);
|
|
417
|
+
$[0] = t0;
|
|
418
|
+
$[1] = className;
|
|
419
|
+
$[2] = rest;
|
|
420
|
+
} else {
|
|
421
|
+
className = $[1];
|
|
422
|
+
rest = $[2];
|
|
423
|
+
}
|
|
424
|
+
let t1;
|
|
425
|
+
if ($[3] !== className) {
|
|
426
|
+
t1 = clsx(className, classes.Body);
|
|
427
|
+
$[3] = className;
|
|
428
|
+
$[4] = t1;
|
|
429
|
+
} else {
|
|
430
|
+
t1 = $[4];
|
|
431
|
+
}
|
|
432
|
+
let t2;
|
|
433
|
+
if ($[5] !== forwardRef || $[6] !== rest || $[7] !== t1) {
|
|
434
|
+
t2 = /*#__PURE__*/jsx("div", {
|
|
435
|
+
ref: forwardRef,
|
|
436
|
+
className: t1,
|
|
437
|
+
...rest
|
|
438
|
+
});
|
|
439
|
+
$[5] = forwardRef;
|
|
440
|
+
$[6] = rest;
|
|
441
|
+
$[7] = t1;
|
|
442
|
+
$[8] = t2;
|
|
443
|
+
} else {
|
|
444
|
+
t2 = $[8];
|
|
445
|
+
}
|
|
446
|
+
return t2;
|
|
245
447
|
});
|
|
246
448
|
Body.displayName = 'Dialog.Body';
|
|
247
|
-
const Footer = /*#__PURE__*/React.forwardRef(function Footer({
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
449
|
+
const Footer = /*#__PURE__*/React.forwardRef(function Footer(t0, forwardRef) {
|
|
450
|
+
const $ = c(9);
|
|
451
|
+
let className;
|
|
452
|
+
let rest;
|
|
453
|
+
if ($[0] !== t0) {
|
|
454
|
+
({
|
|
455
|
+
className,
|
|
456
|
+
...rest
|
|
457
|
+
} = t0);
|
|
458
|
+
$[0] = t0;
|
|
459
|
+
$[1] = className;
|
|
460
|
+
$[2] = rest;
|
|
461
|
+
} else {
|
|
462
|
+
className = $[1];
|
|
463
|
+
rest = $[2];
|
|
464
|
+
}
|
|
465
|
+
let t1;
|
|
466
|
+
if ($[3] !== className) {
|
|
467
|
+
t1 = clsx(className, classes.Footer);
|
|
468
|
+
$[3] = className;
|
|
469
|
+
$[4] = t1;
|
|
470
|
+
} else {
|
|
471
|
+
t1 = $[4];
|
|
472
|
+
}
|
|
473
|
+
let t2;
|
|
474
|
+
if ($[5] !== forwardRef || $[6] !== rest || $[7] !== t1) {
|
|
475
|
+
t2 = /*#__PURE__*/jsx("div", {
|
|
476
|
+
ref: forwardRef,
|
|
477
|
+
className: t1,
|
|
478
|
+
...rest
|
|
479
|
+
});
|
|
480
|
+
$[5] = forwardRef;
|
|
481
|
+
$[6] = rest;
|
|
482
|
+
$[7] = t1;
|
|
483
|
+
$[8] = t2;
|
|
484
|
+
} else {
|
|
485
|
+
t2 = $[8];
|
|
486
|
+
}
|
|
487
|
+
return t2;
|
|
256
488
|
});
|
|
257
489
|
Footer.displayName = 'Dialog.Footer';
|
|
258
490
|
const Buttons = ({
|
|
@@ -291,17 +523,27 @@ const Buttons = ({
|
|
|
291
523
|
})
|
|
292
524
|
});
|
|
293
525
|
};
|
|
294
|
-
const CloseButton =
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
526
|
+
const CloseButton = t0 => {
|
|
527
|
+
const $ = c(2);
|
|
528
|
+
const {
|
|
529
|
+
onClose
|
|
530
|
+
} = t0;
|
|
531
|
+
let t1;
|
|
532
|
+
if ($[0] !== onClose) {
|
|
533
|
+
t1 = /*#__PURE__*/jsx(IconButton, {
|
|
534
|
+
icon: XIcon,
|
|
535
|
+
"aria-label": "Close",
|
|
536
|
+
onClick: onClose,
|
|
537
|
+
variant: "invisible"
|
|
538
|
+
});
|
|
539
|
+
$[0] = onClose;
|
|
540
|
+
$[1] = t1;
|
|
541
|
+
} else {
|
|
542
|
+
t1 = $[1];
|
|
543
|
+
}
|
|
544
|
+
return t1;
|
|
303
545
|
};
|
|
304
|
-
|
|
546
|
+
|
|
305
547
|
/**
|
|
306
548
|
* A dialog is a type of overlay that can be used for confirming actions, asking
|
|
307
549
|
* for disambiguation, and presenting small forms. They generally allow the user
|