@primer/react 0.0.0-20260220144739 → 0.0.0-20260220145222
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 +1 -7
- 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/Button/Button.js +34 -11
- package/dist/Button/IconButton.js +140 -51
- package/dist/Button/LinkButton.js +39 -11
- package/dist/Checkbox/Checkbox.js +163 -55
- package/dist/Dialog/Dialog.js +347 -105
- package/dist/PageLayout/PageLayout.js +1560 -622
- package/dist/UnderlineNav/UnderlineNavItem.js +149 -56
- package/dist/experimental/SelectPanel2/SelectPanel.js +593 -209
- package/dist/hooks/useRefObjectAsForwardedRef.d.ts.map +1 -1
- package/dist/hooks/useRefObjectAsForwardedRef.js +2 -10
- package/dist/hooks/useScrollFlash.d.ts.map +1 -1
- package/dist/hooks/useScrollFlash.js +22 -14
- package/dist/hooks/useSlots.d.ts +6 -50
- package/dist/hooks/useSlots.d.ts.map +1 -1
- package/dist/hooks/useSlots.js +36 -114
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { c } from 'react-compiler-runtime';
|
|
1
2
|
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { AlertIcon,
|
|
3
|
+
import { AlertIcon, XCircleFillIcon, SearchIcon, ArrowLeftIcon, FilterRemoveIcon, XIcon } from '@primer/octicons-react';
|
|
3
4
|
import { ActionListContainerContext } from '../../ActionList/ActionListContainerContext.js';
|
|
4
5
|
import { useSlots } from '../../hooks/useSlots.js';
|
|
5
6
|
import { BaseOverlay, heightMap } from '../../Overlay/Overlay.js';
|
|
@@ -15,14 +16,14 @@ import { useId } from '../../hooks/useId.js';
|
|
|
15
16
|
import { useAnchoredPosition } from '../../hooks/useAnchoredPosition.js';
|
|
16
17
|
import { AriaStatus } from '../../live-region/AriaStatus.js';
|
|
17
18
|
import Octicon from '../../Octicon/Octicon.js';
|
|
18
|
-
import Spinner from '../../Spinner/Spinner.js';
|
|
19
|
-
import { ButtonComponent } from '../../Button/Button.js';
|
|
20
19
|
import TextInput from '../../TextInput/TextInput.js';
|
|
21
|
-
import { IconButton } from '../../Button/IconButton.js';
|
|
22
|
-
import Heading from '../../Heading/Heading.js';
|
|
23
20
|
import { useFormControlForwardedProps } from '../../FormControl/_FormControlContext.js';
|
|
21
|
+
import { ButtonComponent } from '../../Button/Button.js';
|
|
24
22
|
import Link from '../../Link/Link.js';
|
|
25
23
|
import Checkbox from '../../Checkbox/Checkbox.js';
|
|
24
|
+
import { IconButton } from '../../Button/IconButton.js';
|
|
25
|
+
import Heading from '../../Heading/Heading.js';
|
|
26
|
+
import Spinner from '../../Spinner/Spinner.js';
|
|
26
27
|
|
|
27
28
|
const SelectPanelContext = /*#__PURE__*/React.createContext({
|
|
28
29
|
title: '',
|
|
@@ -113,10 +114,10 @@ const Panel = ({
|
|
|
113
114
|
const onInternalClearSelection = () => {
|
|
114
115
|
if (typeof propsOnClearSelection === 'function') propsOnClearSelection();
|
|
115
116
|
};
|
|
116
|
-
const internalAfterSelect =
|
|
117
|
+
const internalAfterSelect = event_0 => {
|
|
117
118
|
if (selectionVariant === 'instant') onInternalSubmit();
|
|
118
|
-
if (
|
|
119
|
-
if (
|
|
119
|
+
if (event_0.type === 'keypress') {
|
|
120
|
+
if (event_0.key === 'Enter') onInternalSubmit();
|
|
120
121
|
}
|
|
121
122
|
};
|
|
122
123
|
|
|
@@ -158,12 +159,12 @@ const Panel = ({
|
|
|
158
159
|
|
|
159
160
|
// Esc handler
|
|
160
161
|
React.useEffect(() => {
|
|
161
|
-
const
|
|
162
|
-
const handler =
|
|
163
|
-
if (
|
|
162
|
+
const dialogEl_0 = dialogRef.current;
|
|
163
|
+
const handler = event_1 => {
|
|
164
|
+
if (event_1.key === 'Escape') onInternalCancel();
|
|
164
165
|
};
|
|
165
|
-
|
|
166
|
-
return () =>
|
|
166
|
+
dialogEl_0 === null || dialogEl_0 === void 0 ? void 0 : dialogEl_0.addEventListener('keydown', handler);
|
|
167
|
+
return () => dialogEl_0 === null || dialogEl_0 === void 0 ? void 0 : dialogEl_0.removeEventListener('keydown', handler);
|
|
167
168
|
}, [onInternalCancel]);
|
|
168
169
|
|
|
169
170
|
// Autofocus hack: React doesn't support autoFocus for dialog: https://github.com/facebook/react/issues/23301
|
|
@@ -217,8 +218,8 @@ const Panel = ({
|
|
|
217
218
|
},
|
|
218
219
|
className: clsx(classes.Overlay, className),
|
|
219
220
|
...props,
|
|
220
|
-
onClick:
|
|
221
|
-
if (
|
|
221
|
+
onClick: event_2 => {
|
|
222
|
+
if (event_2.target === event_2.currentTarget) onClickOutside();
|
|
222
223
|
},
|
|
223
224
|
children: internalOpen && /*#__PURE__*/jsx(Fragment, {
|
|
224
225
|
children: /*#__PURE__*/jsx(SelectPanelContext.Provider, {
|
|
@@ -286,15 +287,40 @@ const SelectPanelButton = /*#__PURE__*/React.forwardRef((props, anchorRef) => {
|
|
|
286
287
|
}
|
|
287
288
|
});
|
|
288
289
|
SelectPanelButton.__SLOT__ = Symbol('SelectPanel.Button');
|
|
289
|
-
const SelectPanelHeader =
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
className
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
290
|
+
const SelectPanelHeader = t0 => {
|
|
291
|
+
const $ = c(42);
|
|
292
|
+
let children;
|
|
293
|
+
let className;
|
|
294
|
+
let onBack;
|
|
295
|
+
let props;
|
|
296
|
+
if ($[0] !== t0) {
|
|
297
|
+
({
|
|
298
|
+
children,
|
|
299
|
+
onBack,
|
|
300
|
+
className,
|
|
301
|
+
...props
|
|
302
|
+
} = t0);
|
|
303
|
+
$[0] = t0;
|
|
304
|
+
$[1] = children;
|
|
305
|
+
$[2] = className;
|
|
306
|
+
$[3] = onBack;
|
|
307
|
+
$[4] = props;
|
|
308
|
+
} else {
|
|
309
|
+
children = $[1];
|
|
310
|
+
className = $[2];
|
|
311
|
+
onBack = $[3];
|
|
312
|
+
props = $[4];
|
|
313
|
+
}
|
|
314
|
+
let t1;
|
|
315
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
316
|
+
t1 = {
|
|
317
|
+
searchInput: SelectPanelSearchInput
|
|
318
|
+
};
|
|
319
|
+
$[5] = t1;
|
|
320
|
+
} else {
|
|
321
|
+
t1 = $[5];
|
|
322
|
+
}
|
|
323
|
+
const [slots, childrenWithoutSlots] = useSlots(children, t1);
|
|
298
324
|
const {
|
|
299
325
|
title,
|
|
300
326
|
description,
|
|
@@ -302,246 +328,604 @@ const SelectPanelHeader = ({
|
|
|
302
328
|
onCancel,
|
|
303
329
|
onClearSelection
|
|
304
330
|
} = React.useContext(SelectPanelContext);
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
331
|
+
let t2;
|
|
332
|
+
if ($[6] !== className) {
|
|
333
|
+
t2 = clsx(classes.Header, className);
|
|
334
|
+
$[6] = className;
|
|
335
|
+
$[7] = t2;
|
|
336
|
+
} else {
|
|
337
|
+
t2 = $[7];
|
|
338
|
+
}
|
|
339
|
+
const t3 = description ? true : undefined;
|
|
340
|
+
const t4 = slots.searchInput ? true : undefined;
|
|
341
|
+
let t5;
|
|
342
|
+
if ($[8] !== onBack) {
|
|
343
|
+
t5 = onBack ? /*#__PURE__*/jsx(IconButton, {
|
|
344
|
+
type: "button",
|
|
345
|
+
variant: "invisible",
|
|
346
|
+
icon: ArrowLeftIcon,
|
|
347
|
+
"aria-label": "Back",
|
|
348
|
+
onClick: () => onBack()
|
|
349
|
+
}) : null;
|
|
350
|
+
$[8] = onBack;
|
|
351
|
+
$[9] = t5;
|
|
352
|
+
} else {
|
|
353
|
+
t5 = $[9];
|
|
354
|
+
}
|
|
355
|
+
const t6 = description ? true : undefined;
|
|
356
|
+
const t7 = onBack ? true : undefined;
|
|
357
|
+
const t8 = `${panelId}--title`;
|
|
358
|
+
let t9;
|
|
359
|
+
if ($[10] !== t8 || $[11] !== title) {
|
|
360
|
+
t9 = /*#__PURE__*/jsx(Heading, {
|
|
361
|
+
as: "h1",
|
|
362
|
+
id: t8,
|
|
363
|
+
className: classes.Title,
|
|
364
|
+
children: title
|
|
365
|
+
});
|
|
366
|
+
$[10] = t8;
|
|
367
|
+
$[11] = title;
|
|
368
|
+
$[12] = t9;
|
|
369
|
+
} else {
|
|
370
|
+
t9 = $[12];
|
|
371
|
+
}
|
|
372
|
+
let t10;
|
|
373
|
+
if ($[13] !== description || $[14] !== panelId) {
|
|
374
|
+
t10 = description ? /*#__PURE__*/jsx("span", {
|
|
375
|
+
id: `${panelId}--description`,
|
|
376
|
+
className: classes.Description,
|
|
377
|
+
children: description
|
|
378
|
+
}) : null;
|
|
379
|
+
$[13] = description;
|
|
380
|
+
$[14] = panelId;
|
|
381
|
+
$[15] = t10;
|
|
382
|
+
} else {
|
|
383
|
+
t10 = $[15];
|
|
384
|
+
}
|
|
385
|
+
let t11;
|
|
386
|
+
if ($[16] !== t10 || $[17] !== t6 || $[18] !== t7 || $[19] !== t9) {
|
|
387
|
+
t11 = /*#__PURE__*/jsxs("div", {
|
|
388
|
+
className: classes.TitleWrapper,
|
|
389
|
+
"data-description": t6,
|
|
390
|
+
"data-on-back": t7,
|
|
391
|
+
children: [t9, t10]
|
|
392
|
+
});
|
|
393
|
+
$[16] = t10;
|
|
394
|
+
$[17] = t6;
|
|
395
|
+
$[18] = t7;
|
|
396
|
+
$[19] = t9;
|
|
397
|
+
$[20] = t11;
|
|
398
|
+
} else {
|
|
399
|
+
t11 = $[20];
|
|
400
|
+
}
|
|
401
|
+
let t12;
|
|
402
|
+
if ($[21] !== t11 || $[22] !== t5) {
|
|
403
|
+
t12 = /*#__PURE__*/jsxs("div", {
|
|
404
|
+
className: classes.FlexBox,
|
|
405
|
+
children: [t5, t11]
|
|
406
|
+
});
|
|
407
|
+
$[21] = t11;
|
|
408
|
+
$[22] = t5;
|
|
409
|
+
$[23] = t12;
|
|
410
|
+
} else {
|
|
411
|
+
t12 = $[23];
|
|
412
|
+
}
|
|
413
|
+
let t13;
|
|
414
|
+
if ($[24] !== onClearSelection) {
|
|
415
|
+
t13 = onClearSelection ? /*#__PURE__*/jsx(IconButton, {
|
|
416
|
+
type: "button",
|
|
417
|
+
variant: "invisible",
|
|
418
|
+
icon: FilterRemoveIcon,
|
|
419
|
+
"aria-label": "Clear selection",
|
|
420
|
+
onClick: onClearSelection
|
|
421
|
+
}) : null;
|
|
422
|
+
$[24] = onClearSelection;
|
|
423
|
+
$[25] = t13;
|
|
424
|
+
} else {
|
|
425
|
+
t13 = $[25];
|
|
426
|
+
}
|
|
427
|
+
let t14;
|
|
428
|
+
if ($[26] !== onCancel) {
|
|
429
|
+
t14 = /*#__PURE__*/jsx(IconButton, {
|
|
430
|
+
type: "button",
|
|
431
|
+
variant: "invisible",
|
|
432
|
+
icon: XIcon,
|
|
433
|
+
"aria-label": "Close",
|
|
434
|
+
onClick: () => onCancel()
|
|
435
|
+
});
|
|
436
|
+
$[26] = onCancel;
|
|
437
|
+
$[27] = t14;
|
|
438
|
+
} else {
|
|
439
|
+
t14 = $[27];
|
|
440
|
+
}
|
|
441
|
+
let t15;
|
|
442
|
+
if ($[28] !== t13 || $[29] !== t14) {
|
|
443
|
+
t15 = /*#__PURE__*/jsxs("div", {
|
|
444
|
+
children: [t13, t14]
|
|
445
|
+
});
|
|
446
|
+
$[28] = t13;
|
|
447
|
+
$[29] = t14;
|
|
448
|
+
$[30] = t15;
|
|
449
|
+
} else {
|
|
450
|
+
t15 = $[30];
|
|
451
|
+
}
|
|
452
|
+
let t16;
|
|
453
|
+
if ($[31] !== t12 || $[32] !== t15 || $[33] !== t3 || $[34] !== t4) {
|
|
454
|
+
t16 = /*#__PURE__*/jsxs("div", {
|
|
309
455
|
className: classes.HeaderContent,
|
|
310
|
-
"data-description":
|
|
311
|
-
"data-search-input":
|
|
312
|
-
children: [
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
icon: FilterRemoveIcon,
|
|
340
|
-
"aria-label": "Clear selection",
|
|
341
|
-
onClick: onClearSelection
|
|
342
|
-
}) : null, /*#__PURE__*/jsx(IconButton, {
|
|
343
|
-
type: "button",
|
|
344
|
-
variant: "invisible",
|
|
345
|
-
icon: XIcon,
|
|
346
|
-
"aria-label": "Close",
|
|
347
|
-
onClick: () => onCancel()
|
|
348
|
-
})]
|
|
349
|
-
})]
|
|
350
|
-
}), slots.searchInput, childrenWithoutSlots]
|
|
351
|
-
});
|
|
456
|
+
"data-description": t3,
|
|
457
|
+
"data-search-input": t4,
|
|
458
|
+
children: [t12, t15]
|
|
459
|
+
});
|
|
460
|
+
$[31] = t12;
|
|
461
|
+
$[32] = t15;
|
|
462
|
+
$[33] = t3;
|
|
463
|
+
$[34] = t4;
|
|
464
|
+
$[35] = t16;
|
|
465
|
+
} else {
|
|
466
|
+
t16 = $[35];
|
|
467
|
+
}
|
|
468
|
+
let t17;
|
|
469
|
+
if ($[36] !== childrenWithoutSlots || $[37] !== props || $[38] !== slots.searchInput || $[39] !== t16 || $[40] !== t2) {
|
|
470
|
+
t17 = /*#__PURE__*/jsxs("div", {
|
|
471
|
+
className: t2,
|
|
472
|
+
...props,
|
|
473
|
+
children: [t16, slots.searchInput, childrenWithoutSlots]
|
|
474
|
+
});
|
|
475
|
+
$[36] = childrenWithoutSlots;
|
|
476
|
+
$[37] = props;
|
|
477
|
+
$[38] = slots.searchInput;
|
|
478
|
+
$[39] = t16;
|
|
479
|
+
$[40] = t2;
|
|
480
|
+
$[41] = t17;
|
|
481
|
+
} else {
|
|
482
|
+
t17 = $[41];
|
|
483
|
+
}
|
|
484
|
+
return t17;
|
|
352
485
|
};
|
|
353
|
-
SelectPanelHeader.displayName = "SelectPanelHeader";
|
|
354
486
|
SelectPanelHeader.__SLOT__ = Symbol('SelectPanel.Header');
|
|
355
|
-
const SelectPanelSearchInput =
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
487
|
+
const SelectPanelSearchInput = t0 => {
|
|
488
|
+
const $ = c(22);
|
|
489
|
+
let className;
|
|
490
|
+
let props;
|
|
491
|
+
let propsOnChange;
|
|
492
|
+
let propsOnKeyDown;
|
|
493
|
+
if ($[0] !== t0) {
|
|
494
|
+
({
|
|
495
|
+
onChange: propsOnChange,
|
|
496
|
+
onKeyDown: propsOnKeyDown,
|
|
497
|
+
className,
|
|
498
|
+
...props
|
|
499
|
+
} = t0);
|
|
500
|
+
$[0] = t0;
|
|
501
|
+
$[1] = className;
|
|
502
|
+
$[2] = props;
|
|
503
|
+
$[3] = propsOnChange;
|
|
504
|
+
$[4] = propsOnKeyDown;
|
|
505
|
+
} else {
|
|
506
|
+
className = $[1];
|
|
507
|
+
props = $[2];
|
|
508
|
+
propsOnChange = $[3];
|
|
509
|
+
propsOnKeyDown = $[4];
|
|
510
|
+
}
|
|
511
|
+
let t1;
|
|
512
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
513
|
+
t1 = /*#__PURE__*/React.createRef();
|
|
514
|
+
$[5] = t1;
|
|
515
|
+
} else {
|
|
516
|
+
t1 = $[5];
|
|
517
|
+
}
|
|
518
|
+
const inputRef = t1;
|
|
363
519
|
const {
|
|
364
520
|
setSearchQuery,
|
|
365
521
|
moveFocusToList
|
|
366
522
|
} = React.useContext(SelectPanelContext);
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
523
|
+
let t2;
|
|
524
|
+
if ($[6] !== propsOnChange || $[7] !== setSearchQuery) {
|
|
525
|
+
t2 = event => {
|
|
526
|
+
if (typeof propsOnChange === "function") {
|
|
527
|
+
propsOnChange(event);
|
|
528
|
+
} else {
|
|
529
|
+
setSearchQuery(event.target.value);
|
|
530
|
+
}
|
|
531
|
+
};
|
|
532
|
+
$[6] = propsOnChange;
|
|
533
|
+
$[7] = setSearchQuery;
|
|
534
|
+
$[8] = t2;
|
|
535
|
+
} else {
|
|
536
|
+
t2 = $[8];
|
|
537
|
+
}
|
|
538
|
+
const internalOnChange = t2;
|
|
539
|
+
let t3;
|
|
540
|
+
if ($[9] !== moveFocusToList || $[10] !== propsOnKeyDown) {
|
|
541
|
+
t3 = event_0 => {
|
|
542
|
+
if (event_0.key === "ArrowDown") {
|
|
543
|
+
event_0.preventDefault();
|
|
544
|
+
moveFocusToList();
|
|
545
|
+
}
|
|
546
|
+
if (typeof propsOnKeyDown === "function") {
|
|
547
|
+
propsOnKeyDown(event_0);
|
|
548
|
+
}
|
|
549
|
+
};
|
|
550
|
+
$[9] = moveFocusToList;
|
|
551
|
+
$[10] = propsOnKeyDown;
|
|
552
|
+
$[11] = t3;
|
|
553
|
+
} else {
|
|
554
|
+
t3 = $[11];
|
|
555
|
+
}
|
|
556
|
+
const internalKeyDown = t3;
|
|
557
|
+
let t4;
|
|
558
|
+
if ($[12] !== propsOnChange) {
|
|
559
|
+
t4 = /*#__PURE__*/jsx(TextInput.Action, {
|
|
385
560
|
icon: XCircleFillIcon,
|
|
386
561
|
"aria-label": "Clear",
|
|
387
562
|
tooltipDirection: "w",
|
|
388
563
|
className: classes.ClearAction,
|
|
389
564
|
onClick: () => {
|
|
390
|
-
if (inputRef.current)
|
|
391
|
-
|
|
392
|
-
|
|
565
|
+
if (inputRef.current) {
|
|
566
|
+
inputRef.current.value = "";
|
|
567
|
+
}
|
|
568
|
+
if (typeof propsOnChange === "function") {
|
|
393
569
|
propsOnChange({
|
|
394
570
|
target: inputRef.current,
|
|
395
571
|
currentTarget: inputRef.current
|
|
396
572
|
});
|
|
397
573
|
}
|
|
398
574
|
}
|
|
399
|
-
})
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
}
|
|
575
|
+
});
|
|
576
|
+
$[12] = propsOnChange;
|
|
577
|
+
$[13] = t4;
|
|
578
|
+
} else {
|
|
579
|
+
t4 = $[13];
|
|
580
|
+
}
|
|
581
|
+
let t5;
|
|
582
|
+
if ($[14] !== className) {
|
|
583
|
+
t5 = clsx(classes.TextInput, className);
|
|
584
|
+
$[14] = className;
|
|
585
|
+
$[15] = t5;
|
|
586
|
+
} else {
|
|
587
|
+
t5 = $[15];
|
|
588
|
+
}
|
|
589
|
+
let t6;
|
|
590
|
+
if ($[16] !== internalKeyDown || $[17] !== internalOnChange || $[18] !== props || $[19] !== t4 || $[20] !== t5) {
|
|
591
|
+
t6 = /*#__PURE__*/jsx(TextInput, {
|
|
592
|
+
ref: inputRef,
|
|
593
|
+
block: true,
|
|
594
|
+
leadingVisual: SearchIcon,
|
|
595
|
+
placeholder: "Search",
|
|
596
|
+
trailingAction: t4,
|
|
597
|
+
className: t5,
|
|
598
|
+
onChange: internalOnChange,
|
|
599
|
+
onKeyDown: internalKeyDown,
|
|
600
|
+
...props
|
|
601
|
+
});
|
|
602
|
+
$[16] = internalKeyDown;
|
|
603
|
+
$[17] = internalOnChange;
|
|
604
|
+
$[18] = props;
|
|
605
|
+
$[19] = t4;
|
|
606
|
+
$[20] = t5;
|
|
607
|
+
$[21] = t6;
|
|
608
|
+
} else {
|
|
609
|
+
t6 = $[21];
|
|
610
|
+
}
|
|
611
|
+
return t6;
|
|
405
612
|
};
|
|
406
|
-
SelectPanelSearchInput.displayName = "SelectPanelSearchInput";
|
|
407
613
|
SelectPanelSearchInput.__SLOT__ = Symbol('SelectPanel.SearchInput');
|
|
408
614
|
const FooterContext = /*#__PURE__*/React.createContext(false);
|
|
409
|
-
const SelectPanelFooter =
|
|
410
|
-
|
|
411
|
-
|
|
615
|
+
const SelectPanelFooter = t0 => {
|
|
616
|
+
const $ = c(13);
|
|
617
|
+
let props;
|
|
618
|
+
if ($[0] !== t0) {
|
|
619
|
+
({
|
|
620
|
+
...props
|
|
621
|
+
} = t0);
|
|
622
|
+
$[0] = t0;
|
|
623
|
+
$[1] = props;
|
|
624
|
+
} else {
|
|
625
|
+
props = $[1];
|
|
626
|
+
}
|
|
412
627
|
const {
|
|
413
628
|
onCancel,
|
|
414
629
|
selectionVariant
|
|
415
630
|
} = React.useContext(SelectPanelContext);
|
|
416
|
-
const hidePrimaryActions = selectionVariant ===
|
|
417
|
-
const buttonSize = useResponsiveValue(responsiveButtonSizes,
|
|
631
|
+
const hidePrimaryActions = selectionVariant === "instant";
|
|
632
|
+
const buttonSize = useResponsiveValue(responsiveButtonSizes, "small");
|
|
418
633
|
if (hidePrimaryActions && !props.children) {
|
|
419
|
-
// nothing to render
|
|
420
|
-
// todo: we can inform them the developer footer will render nothing
|
|
421
634
|
return null;
|
|
422
635
|
}
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
636
|
+
const t1 = hidePrimaryActions || undefined;
|
|
637
|
+
const t2 = hidePrimaryActions || undefined;
|
|
638
|
+
let t3;
|
|
639
|
+
if ($[2] !== props.children || $[3] !== t2) {
|
|
640
|
+
t3 = /*#__PURE__*/jsx("div", {
|
|
641
|
+
className: classes.FooterContent,
|
|
642
|
+
"data-hide-primary-actions": t2,
|
|
643
|
+
children: props.children
|
|
644
|
+
});
|
|
645
|
+
$[2] = props.children;
|
|
646
|
+
$[3] = t2;
|
|
647
|
+
$[4] = t3;
|
|
648
|
+
} else {
|
|
649
|
+
t3 = $[4];
|
|
650
|
+
}
|
|
651
|
+
let t4;
|
|
652
|
+
if ($[5] !== buttonSize || $[6] !== hidePrimaryActions || $[7] !== onCancel) {
|
|
653
|
+
t4 = hidePrimaryActions ? null : /*#__PURE__*/jsxs("div", {
|
|
654
|
+
className: classes.FooterActions,
|
|
655
|
+
children: [/*#__PURE__*/jsx(ButtonComponent, {
|
|
656
|
+
type: "button",
|
|
657
|
+
size: buttonSize,
|
|
658
|
+
onClick: () => onCancel(),
|
|
659
|
+
children: "Cancel"
|
|
660
|
+
}), /*#__PURE__*/jsx(ButtonComponent, {
|
|
661
|
+
type: "submit",
|
|
662
|
+
size: buttonSize,
|
|
663
|
+
variant: "primary",
|
|
664
|
+
children: "Save"
|
|
445
665
|
})]
|
|
446
|
-
})
|
|
447
|
-
|
|
666
|
+
});
|
|
667
|
+
$[5] = buttonSize;
|
|
668
|
+
$[6] = hidePrimaryActions;
|
|
669
|
+
$[7] = onCancel;
|
|
670
|
+
$[8] = t4;
|
|
671
|
+
} else {
|
|
672
|
+
t4 = $[8];
|
|
673
|
+
}
|
|
674
|
+
let t5;
|
|
675
|
+
if ($[9] !== t1 || $[10] !== t3 || $[11] !== t4) {
|
|
676
|
+
t5 = /*#__PURE__*/jsx(FooterContext.Provider, {
|
|
677
|
+
value: true,
|
|
678
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
679
|
+
className: classes.Footer,
|
|
680
|
+
"data-hide-primary-actions": t1,
|
|
681
|
+
children: [t3, t4]
|
|
682
|
+
})
|
|
683
|
+
});
|
|
684
|
+
$[9] = t1;
|
|
685
|
+
$[10] = t3;
|
|
686
|
+
$[11] = t4;
|
|
687
|
+
$[12] = t5;
|
|
688
|
+
} else {
|
|
689
|
+
t5 = $[12];
|
|
690
|
+
}
|
|
691
|
+
return t5;
|
|
448
692
|
};
|
|
449
|
-
SelectPanelFooter.displayName = "SelectPanelFooter";
|
|
450
693
|
SelectPanelFooter.__SLOT__ = Symbol('SelectPanel.Footer');
|
|
451
694
|
const SecondaryButton = props => {
|
|
452
|
-
const
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
695
|
+
const $ = c(3);
|
|
696
|
+
const size = useResponsiveValue(responsiveButtonSizes, "small");
|
|
697
|
+
let t0;
|
|
698
|
+
if ($[0] !== props || $[1] !== size) {
|
|
699
|
+
t0 = /*#__PURE__*/jsx(ButtonComponent, {
|
|
700
|
+
type: "button",
|
|
701
|
+
size: size,
|
|
702
|
+
block: true,
|
|
703
|
+
...props
|
|
704
|
+
});
|
|
705
|
+
$[0] = props;
|
|
706
|
+
$[1] = size;
|
|
707
|
+
$[2] = t0;
|
|
708
|
+
} else {
|
|
709
|
+
t0 = $[2];
|
|
710
|
+
}
|
|
711
|
+
return t0;
|
|
459
712
|
};
|
|
460
|
-
|
|
461
|
-
const
|
|
462
|
-
className
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
713
|
+
const SecondaryLink = t0 => {
|
|
714
|
+
const $ = c(9);
|
|
715
|
+
let className;
|
|
716
|
+
let props;
|
|
717
|
+
if ($[0] !== t0) {
|
|
718
|
+
({
|
|
719
|
+
className,
|
|
720
|
+
...props
|
|
721
|
+
} = t0);
|
|
722
|
+
$[0] = t0;
|
|
723
|
+
$[1] = className;
|
|
724
|
+
$[2] = props;
|
|
725
|
+
} else {
|
|
726
|
+
className = $[1];
|
|
727
|
+
props = $[2];
|
|
728
|
+
}
|
|
729
|
+
const size = useResponsiveValue(responsiveButtonSizes, "small");
|
|
730
|
+
let t1;
|
|
731
|
+
if ($[3] !== className) {
|
|
732
|
+
t1 = clsx(classes.SmallText, className);
|
|
733
|
+
$[3] = className;
|
|
734
|
+
$[4] = t1;
|
|
735
|
+
} else {
|
|
736
|
+
t1 = $[4];
|
|
737
|
+
}
|
|
738
|
+
let t2;
|
|
739
|
+
if ($[5] !== props || $[6] !== size || $[7] !== t1) {
|
|
740
|
+
t2 = /*#__PURE__*/jsx(ButtonComponent, {
|
|
470
741
|
as: Link,
|
|
471
742
|
size: size,
|
|
472
743
|
variant: "invisible",
|
|
473
744
|
block: true,
|
|
474
745
|
...props,
|
|
475
|
-
className:
|
|
746
|
+
className: t1,
|
|
476
747
|
children: props.children
|
|
477
|
-
})
|
|
478
|
-
|
|
748
|
+
});
|
|
749
|
+
$[5] = props;
|
|
750
|
+
$[6] = size;
|
|
751
|
+
$[7] = t1;
|
|
752
|
+
$[8] = t2;
|
|
753
|
+
} else {
|
|
754
|
+
t2 = $[8];
|
|
755
|
+
}
|
|
756
|
+
return t2;
|
|
479
757
|
};
|
|
480
|
-
|
|
481
|
-
const
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
758
|
+
const SecondaryCheckbox = t0 => {
|
|
759
|
+
const $ = c(17);
|
|
760
|
+
let children;
|
|
761
|
+
let className;
|
|
762
|
+
let id;
|
|
763
|
+
let props;
|
|
764
|
+
if ($[0] !== t0) {
|
|
765
|
+
({
|
|
766
|
+
id,
|
|
767
|
+
children,
|
|
768
|
+
className,
|
|
769
|
+
...props
|
|
770
|
+
} = t0);
|
|
771
|
+
$[0] = t0;
|
|
772
|
+
$[1] = children;
|
|
773
|
+
$[2] = className;
|
|
774
|
+
$[3] = id;
|
|
775
|
+
$[4] = props;
|
|
776
|
+
} else {
|
|
777
|
+
children = $[1];
|
|
778
|
+
className = $[2];
|
|
779
|
+
id = $[3];
|
|
780
|
+
props = $[4];
|
|
781
|
+
}
|
|
487
782
|
const checkboxId = useId(id);
|
|
488
783
|
const {
|
|
489
784
|
selectionVariant
|
|
490
785
|
} = React.useContext(SelectPanelContext);
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
className
|
|
496
|
-
|
|
786
|
+
!(selectionVariant !== "instant") ? process.env.NODE_ENV !== "production" ? invariant(false, "Sorry! SelectPanel.SecondaryAction with variant=\"checkbox\" is not allowed inside selectionVariant=\"instant\"") : invariant(false) : void 0;
|
|
787
|
+
let t1;
|
|
788
|
+
if ($[5] !== className) {
|
|
789
|
+
t1 = clsx(classes.Checkbox, className);
|
|
790
|
+
$[5] = className;
|
|
791
|
+
$[6] = t1;
|
|
792
|
+
} else {
|
|
793
|
+
t1 = $[6];
|
|
794
|
+
}
|
|
795
|
+
let t2;
|
|
796
|
+
if ($[7] !== checkboxId || $[8] !== props || $[9] !== t1) {
|
|
797
|
+
t2 = /*#__PURE__*/jsx(Checkbox, {
|
|
497
798
|
id: checkboxId,
|
|
498
|
-
className:
|
|
799
|
+
className: t1,
|
|
499
800
|
...props
|
|
500
|
-
})
|
|
801
|
+
});
|
|
802
|
+
$[7] = checkboxId;
|
|
803
|
+
$[8] = props;
|
|
804
|
+
$[9] = t1;
|
|
805
|
+
$[10] = t2;
|
|
806
|
+
} else {
|
|
807
|
+
t2 = $[10];
|
|
808
|
+
}
|
|
809
|
+
let t3;
|
|
810
|
+
if ($[11] !== checkboxId || $[12] !== children) {
|
|
811
|
+
t3 = /*#__PURE__*/jsx(InputLabel, {
|
|
501
812
|
htmlFor: checkboxId,
|
|
502
813
|
className: classes.SmallText,
|
|
503
814
|
children: children
|
|
504
|
-
})
|
|
505
|
-
|
|
815
|
+
});
|
|
816
|
+
$[11] = checkboxId;
|
|
817
|
+
$[12] = children;
|
|
818
|
+
$[13] = t3;
|
|
819
|
+
} else {
|
|
820
|
+
t3 = $[13];
|
|
821
|
+
}
|
|
822
|
+
let t4;
|
|
823
|
+
if ($[14] !== t2 || $[15] !== t3) {
|
|
824
|
+
t4 = /*#__PURE__*/jsxs("div", {
|
|
825
|
+
className: classes.SecondaryCheckbox,
|
|
826
|
+
children: [t2, t3]
|
|
827
|
+
});
|
|
828
|
+
$[14] = t2;
|
|
829
|
+
$[15] = t3;
|
|
830
|
+
$[16] = t4;
|
|
831
|
+
} else {
|
|
832
|
+
t4 = $[16];
|
|
833
|
+
}
|
|
834
|
+
return t4;
|
|
506
835
|
};
|
|
507
|
-
|
|
508
|
-
const
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
836
|
+
const SelectPanelSecondaryAction = t0 => {
|
|
837
|
+
const $ = c(9);
|
|
838
|
+
let props;
|
|
839
|
+
let variant;
|
|
840
|
+
if ($[0] !== t0) {
|
|
841
|
+
({
|
|
842
|
+
variant,
|
|
843
|
+
...props
|
|
844
|
+
} = t0);
|
|
845
|
+
$[0] = t0;
|
|
846
|
+
$[1] = props;
|
|
847
|
+
$[2] = variant;
|
|
848
|
+
} else {
|
|
849
|
+
props = $[1];
|
|
850
|
+
variant = $[2];
|
|
851
|
+
}
|
|
512
852
|
const insideFooter = React.useContext(FooterContext);
|
|
513
|
-
!insideFooter ? process.env.NODE_ENV !== "production" ? invariant(false,
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
853
|
+
!insideFooter ? process.env.NODE_ENV !== "production" ? invariant(false, "SelectPanel.SecondaryAction is only allowed inside SelectPanel.Footer") : invariant(false) : void 0;
|
|
854
|
+
if (variant === "button") {
|
|
855
|
+
let t1;
|
|
856
|
+
if ($[3] !== props) {
|
|
857
|
+
t1 = /*#__PURE__*/jsx(SecondaryButton, {
|
|
858
|
+
...props
|
|
859
|
+
});
|
|
860
|
+
$[3] = props;
|
|
861
|
+
$[4] = t1;
|
|
862
|
+
} else {
|
|
863
|
+
t1 = $[4];
|
|
864
|
+
}
|
|
865
|
+
return t1;
|
|
866
|
+
} else {
|
|
867
|
+
if (variant === "link") {
|
|
868
|
+
let t1;
|
|
869
|
+
if ($[5] !== props) {
|
|
870
|
+
t1 = /*#__PURE__*/jsx(SecondaryLink, {
|
|
871
|
+
...props
|
|
872
|
+
});
|
|
873
|
+
$[5] = props;
|
|
874
|
+
$[6] = t1;
|
|
875
|
+
} else {
|
|
876
|
+
t1 = $[6];
|
|
877
|
+
}
|
|
878
|
+
return t1;
|
|
879
|
+
} else {
|
|
880
|
+
if (variant === "checkbox") {
|
|
881
|
+
let t1;
|
|
882
|
+
if ($[7] !== props) {
|
|
883
|
+
t1 = /*#__PURE__*/jsx(SecondaryCheckbox, {
|
|
884
|
+
...props
|
|
885
|
+
});
|
|
886
|
+
$[7] = props;
|
|
887
|
+
$[8] = t1;
|
|
888
|
+
} else {
|
|
889
|
+
t1 = $[8];
|
|
890
|
+
}
|
|
891
|
+
return t1;
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
}
|
|
528
895
|
};
|
|
529
|
-
const SelectPanelLoading =
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
896
|
+
const SelectPanelLoading = t0 => {
|
|
897
|
+
const $ = c(3);
|
|
898
|
+
const {
|
|
899
|
+
children: t1
|
|
900
|
+
} = t0;
|
|
901
|
+
const children = t1 === undefined ? "Fetching items..." : t1;
|
|
902
|
+
let t2;
|
|
903
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
904
|
+
t2 = /*#__PURE__*/jsx(Spinner, {
|
|
536
905
|
size: "medium",
|
|
537
906
|
srText: null
|
|
538
|
-
})
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
}
|
|
907
|
+
});
|
|
908
|
+
$[0] = t2;
|
|
909
|
+
} else {
|
|
910
|
+
t2 = $[0];
|
|
911
|
+
}
|
|
912
|
+
let t3;
|
|
913
|
+
if ($[1] !== children) {
|
|
914
|
+
t3 = /*#__PURE__*/jsxs(AriaStatus, {
|
|
915
|
+
announceOnShow: true,
|
|
916
|
+
className: classes.SelectPanelLoading,
|
|
917
|
+
children: [t2, /*#__PURE__*/jsx("span", {
|
|
918
|
+
className: classes.LoadingText,
|
|
919
|
+
children: children
|
|
920
|
+
})]
|
|
921
|
+
});
|
|
922
|
+
$[1] = children;
|
|
923
|
+
$[2] = t3;
|
|
924
|
+
} else {
|
|
925
|
+
t3 = $[2];
|
|
926
|
+
}
|
|
927
|
+
return t3;
|
|
543
928
|
};
|
|
544
|
-
SelectPanelLoading.displayName = "SelectPanelLoading";
|
|
545
929
|
const SelectPanelMessage = ({
|
|
546
930
|
variant = 'warning',
|
|
547
931
|
size = variant === 'empty' ? 'full' : 'inline',
|