@primer/react 0.0.0-20260220144011 → 0.0.0-20260220144739
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 +6 -2
- package/dist/Autocomplete/Autocomplete.js +76 -159
- package/dist/Autocomplete/AutocompleteMenu.js +128 -333
- package/dist/Autocomplete/AutocompleteOverlay.js +49 -130
- package/dist/Banner/Banner.js +64 -238
- package/dist/Button/Button.js +11 -34
- package/dist/Button/IconButton.js +51 -140
- package/dist/Button/LinkButton.js +11 -39
- package/dist/Checkbox/Checkbox.js +55 -163
- package/dist/Dialog/Dialog.js +105 -347
- package/dist/PageLayout/PageLayout.js +622 -1560
- package/dist/UnderlineNav/UnderlineNavItem.js +56 -149
- package/dist/experimental/SelectPanel2/SelectPanel.js +209 -593
- package/dist/hooks/useRefObjectAsForwardedRef.d.ts.map +1 -1
- package/dist/hooks/useRefObjectAsForwardedRef.js +10 -2
- package/dist/hooks/useScrollFlash.js +17 -27
- package/dist/hooks/useSlots.d.ts +50 -6
- package/dist/hooks/useSlots.d.ts.map +1 -1
- package/dist/hooks/useSlots.js +114 -36
- package/package.json +1 -1
package/dist/Dialog/Dialog.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { c } from 'react-compiler-runtime';
|
|
2
1
|
import React, { useRef, useState, useCallback, useEffect } from 'react';
|
|
3
2
|
import { IconButton } from '../Button/IconButton.js';
|
|
4
3
|
import { ButtonComponent } from '../Button/Button.js';
|
|
@@ -17,139 +16,58 @@ import { useOnEscapePress } from '../hooks/useOnEscapePress.js';
|
|
|
17
16
|
import { ScrollableRegion } from '../ScrollableRegion/ScrollableRegion.js';
|
|
18
17
|
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
|
|
19
18
|
|
|
20
|
-
const DefaultHeader =
|
|
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
|
-
|
|
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;
|
|
19
|
+
const DefaultHeader = ({
|
|
20
|
+
dialogLabelId,
|
|
21
|
+
title,
|
|
22
|
+
subtitle,
|
|
23
|
+
dialogDescriptionId,
|
|
24
|
+
onClose
|
|
25
|
+
}) => {
|
|
26
|
+
const onCloseClick = useCallback(() => {
|
|
27
|
+
onClose('close-button');
|
|
28
|
+
}, [onClose]);
|
|
29
|
+
return /*#__PURE__*/jsx(Dialog.Header, {
|
|
30
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
31
|
+
className: classes.HeaderInner,
|
|
32
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
33
|
+
className: classes.HeaderContent,
|
|
34
|
+
children: [/*#__PURE__*/jsx(Dialog.Title, {
|
|
35
|
+
id: dialogLabelId,
|
|
36
|
+
children: title !== null && title !== void 0 ? title : 'Dialog'
|
|
37
|
+
}), subtitle && /*#__PURE__*/jsx(Dialog.Subtitle, {
|
|
38
|
+
id: dialogDescriptionId,
|
|
39
|
+
children: subtitle
|
|
40
|
+
})]
|
|
41
|
+
}), /*#__PURE__*/jsx(Dialog.CloseButton, {
|
|
42
|
+
onClose: onCloseClick
|
|
43
|
+
})]
|
|
44
|
+
})
|
|
45
|
+
});
|
|
102
46
|
};
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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;
|
|
47
|
+
DefaultHeader.displayName = "DefaultHeader";
|
|
48
|
+
const DefaultBody = ({
|
|
49
|
+
children
|
|
50
|
+
}) => {
|
|
51
|
+
return /*#__PURE__*/jsx(Dialog.Body, {
|
|
52
|
+
children: children
|
|
53
|
+
});
|
|
119
54
|
};
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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
|
-
}
|
|
55
|
+
DefaultBody.displayName = "DefaultBody";
|
|
56
|
+
const DefaultFooter = ({
|
|
57
|
+
footerButtons
|
|
58
|
+
}) => {
|
|
135
59
|
const {
|
|
136
60
|
containerRef: footerRef
|
|
137
|
-
} = useFocusZone(
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
})
|
|
146
|
-
|
|
147
|
-
$[2] = footerRef;
|
|
148
|
-
$[3] = t2;
|
|
149
|
-
} else {
|
|
150
|
-
t2 = $[3];
|
|
151
|
-
}
|
|
152
|
-
return t2;
|
|
61
|
+
} = useFocusZone({
|
|
62
|
+
bindKeys: FocusKeys.ArrowHorizontal | FocusKeys.Tab,
|
|
63
|
+
focusInStrategy: 'closest'
|
|
64
|
+
});
|
|
65
|
+
return footerButtons ? /*#__PURE__*/jsx(Dialog.Footer, {
|
|
66
|
+
ref: footerRef,
|
|
67
|
+
children: /*#__PURE__*/jsx(Dialog.Buttons, {
|
|
68
|
+
buttons: footerButtons
|
|
69
|
+
})
|
|
70
|
+
}) : null;
|
|
153
71
|
};
|
|
154
72
|
const defaultPosition = {
|
|
155
73
|
narrow: 'center',
|
|
@@ -258,8 +176,8 @@ const _Dialog = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
258
176
|
className: classes.Backdrop,
|
|
259
177
|
...positionDataAttributes,
|
|
260
178
|
onClick: onBackdropClick,
|
|
261
|
-
onMouseDown:
|
|
262
|
-
setLastMouseDownIsBackdrop(
|
|
179
|
+
onMouseDown: e => {
|
|
180
|
+
setLastMouseDownIsBackdrop(e.target === e.currentTarget);
|
|
263
181
|
},
|
|
264
182
|
children: /*#__PURE__*/jsxs("div", {
|
|
265
183
|
ref: dialogRef,
|
|
@@ -282,209 +200,59 @@ const _Dialog = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
282
200
|
});
|
|
283
201
|
});
|
|
284
202
|
_Dialog.displayName = 'Dialog';
|
|
285
|
-
const Header = /*#__PURE__*/React.forwardRef(function Header(
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
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;
|
|
203
|
+
const Header = /*#__PURE__*/React.forwardRef(function Header({
|
|
204
|
+
className,
|
|
205
|
+
...rest
|
|
206
|
+
}, forwardRef) {
|
|
207
|
+
return /*#__PURE__*/jsx("div", {
|
|
208
|
+
ref: forwardRef,
|
|
209
|
+
className: clsx(className, classes.Header),
|
|
210
|
+
...rest
|
|
211
|
+
});
|
|
324
212
|
});
|
|
325
213
|
Header.displayName = 'Dialog.Header';
|
|
326
|
-
const Title = /*#__PURE__*/React.forwardRef(function Title(
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
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;
|
|
214
|
+
const Title = /*#__PURE__*/React.forwardRef(function Title({
|
|
215
|
+
className,
|
|
216
|
+
...rest
|
|
217
|
+
}, forwardRef) {
|
|
218
|
+
return /*#__PURE__*/jsx("h1", {
|
|
219
|
+
ref: forwardRef,
|
|
220
|
+
className: clsx(className, classes.Title),
|
|
221
|
+
...rest
|
|
222
|
+
});
|
|
365
223
|
});
|
|
366
224
|
Title.displayName = 'Dialog.Title';
|
|
367
|
-
const Subtitle = /*#__PURE__*/React.forwardRef(function Subtitle(
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
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;
|
|
225
|
+
const Subtitle = /*#__PURE__*/React.forwardRef(function Subtitle({
|
|
226
|
+
className,
|
|
227
|
+
...rest
|
|
228
|
+
}, forwardRef) {
|
|
229
|
+
return /*#__PURE__*/jsx("h2", {
|
|
230
|
+
ref: forwardRef,
|
|
231
|
+
className: clsx(className, classes.Subtitle),
|
|
232
|
+
...rest
|
|
233
|
+
});
|
|
406
234
|
});
|
|
407
235
|
Subtitle.displayName = 'Dialog.Subtitle';
|
|
408
|
-
const Body = /*#__PURE__*/React.forwardRef(function Body(
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
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;
|
|
236
|
+
const Body = /*#__PURE__*/React.forwardRef(function Body({
|
|
237
|
+
className,
|
|
238
|
+
...rest
|
|
239
|
+
}, forwardRef) {
|
|
240
|
+
return /*#__PURE__*/jsx("div", {
|
|
241
|
+
ref: forwardRef,
|
|
242
|
+
className: clsx(className, classes.Body),
|
|
243
|
+
...rest
|
|
244
|
+
});
|
|
447
245
|
});
|
|
448
246
|
Body.displayName = 'Dialog.Body';
|
|
449
|
-
const Footer = /*#__PURE__*/React.forwardRef(function Footer(
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
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;
|
|
247
|
+
const Footer = /*#__PURE__*/React.forwardRef(function Footer({
|
|
248
|
+
className,
|
|
249
|
+
...rest
|
|
250
|
+
}, forwardRef) {
|
|
251
|
+
return /*#__PURE__*/jsx("div", {
|
|
252
|
+
ref: forwardRef,
|
|
253
|
+
className: clsx(className, classes.Footer),
|
|
254
|
+
...rest
|
|
255
|
+
});
|
|
488
256
|
});
|
|
489
257
|
Footer.displayName = 'Dialog.Footer';
|
|
490
258
|
const Buttons = ({
|
|
@@ -523,27 +291,17 @@ const Buttons = ({
|
|
|
523
291
|
})
|
|
524
292
|
});
|
|
525
293
|
};
|
|
526
|
-
const CloseButton =
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
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;
|
|
294
|
+
const CloseButton = ({
|
|
295
|
+
onClose
|
|
296
|
+
}) => {
|
|
297
|
+
return /*#__PURE__*/jsx(IconButton, {
|
|
298
|
+
icon: XIcon,
|
|
299
|
+
"aria-label": "Close",
|
|
300
|
+
onClick: onClose,
|
|
301
|
+
variant: "invisible"
|
|
302
|
+
});
|
|
545
303
|
};
|
|
546
|
-
|
|
304
|
+
CloseButton.displayName = "CloseButton";
|
|
547
305
|
/**
|
|
548
306
|
* A dialog is a type of overlay that can be used for confirming actions, asking
|
|
549
307
|
* for disambiguation, and presenting small forms. They generally allow the user
|