@primer/react 0.0.0-20260220191813 → 0.0.0-20260220193722

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.
Files changed (93) hide show
  1. package/CHANGELOG.md +26 -2
  2. package/dist/ActionList/ActionList-c04a02d6.css +2 -0
  3. package/dist/ActionList/ActionList-c04a02d6.css.map +1 -0
  4. package/dist/ActionList/ActionList.module.css.js +1 -1
  5. package/dist/ActionList/Item.d.ts.map +1 -1
  6. package/dist/ActionList/Item.js +1 -0
  7. package/dist/Autocomplete/Autocomplete.js +76 -159
  8. package/dist/Autocomplete/AutocompleteMenu.js +128 -333
  9. package/dist/Autocomplete/AutocompleteOverlay.js +49 -130
  10. package/dist/Banner/Banner.js +64 -238
  11. package/dist/Blankslate/{Blankslate-f5a9755a.css → Blankslate-a039d79a.css} +2 -2
  12. package/dist/Blankslate/Blankslate-a039d79a.css.map +1 -0
  13. package/dist/Blankslate/Blankslate.module.css.js +1 -1
  14. package/dist/Button/Button.js +11 -34
  15. package/dist/Button/ButtonBase-c973d463.css +2 -0
  16. package/dist/Button/ButtonBase-c973d463.css.map +1 -0
  17. package/dist/Button/ButtonBase.js +1 -1
  18. package/dist/Button/ButtonBase.module.css.js +1 -1
  19. package/dist/Button/IconButton.js +51 -140
  20. package/dist/Button/LinkButton.js +11 -39
  21. package/dist/Checkbox/Checkbox.js +55 -163
  22. package/dist/Dialog/Dialog.js +105 -347
  23. package/dist/FilteredActionList/FilteredActionList.d.ts +16 -1
  24. package/dist/FilteredActionList/FilteredActionList.d.ts.map +1 -1
  25. package/dist/FilteredActionList/FilteredActionList.js +147 -42
  26. package/dist/PageLayout/PageLayout-06f4c069.css +2 -0
  27. package/dist/PageLayout/PageLayout-06f4c069.css.map +1 -0
  28. package/dist/PageLayout/PageLayout.d.ts +72 -2
  29. package/dist/PageLayout/PageLayout.d.ts.map +1 -1
  30. package/dist/PageLayout/PageLayout.js +750 -1235
  31. package/dist/PageLayout/PageLayout.module.css.js +2 -2
  32. package/dist/PageLayout/usePaneWidth.d.ts +18 -5
  33. package/dist/PageLayout/usePaneWidth.d.ts.map +1 -1
  34. package/dist/PageLayout/usePaneWidth.js +125 -111
  35. package/dist/SelectPanel/SelectPanel.d.ts +1 -1
  36. package/dist/SelectPanel/SelectPanel.d.ts.map +1 -1
  37. package/dist/SelectPanel/SelectPanel.js +3 -1
  38. package/dist/SplitPageLayout/SplitPageLayout.d.ts +4 -1
  39. package/dist/SplitPageLayout/SplitPageLayout.d.ts.map +1 -1
  40. package/dist/SplitPageLayout/SplitPageLayout.js +54 -2
  41. package/dist/Text/Text.d.ts +1 -1
  42. package/dist/Text/Text.d.ts.map +1 -1
  43. package/dist/Text/Text.js +10 -13
  44. package/dist/UnderlineNav/UnderlineNav-4344d9b0.css +2 -0
  45. package/dist/UnderlineNav/UnderlineNav-4344d9b0.css.map +1 -0
  46. package/dist/UnderlineNav/UnderlineNav.d.ts.map +1 -1
  47. package/dist/UnderlineNav/UnderlineNav.js +323 -84
  48. package/dist/UnderlineNav/UnderlineNav.module.css.js +2 -2
  49. package/dist/UnderlineNav/UnderlineNavContext.d.ts +11 -4
  50. package/dist/UnderlineNav/UnderlineNavContext.d.ts.map +1 -1
  51. package/dist/UnderlineNav/UnderlineNavContext.js +3 -2
  52. package/dist/UnderlineNav/UnderlineNavItem-b65e8fd3.css +2 -0
  53. package/dist/UnderlineNav/UnderlineNavItem-b65e8fd3.css.map +1 -0
  54. package/dist/UnderlineNav/UnderlineNavItem.d.ts.map +1 -1
  55. package/dist/UnderlineNav/UnderlineNavItem.js +59 -161
  56. package/dist/UnderlineNav/UnderlineNavItem.module.css.js +1 -1
  57. package/dist/UnderlineNav/styles.d.ts +16 -0
  58. package/dist/UnderlineNav/styles.d.ts.map +1 -0
  59. package/dist/UnderlineNav/styles.js +19 -0
  60. package/dist/experimental/SelectPanel2/SelectPanel.js +209 -593
  61. package/dist/experimental/UnderlinePanels/UnderlinePanels-e4b325b9.css +2 -0
  62. package/dist/experimental/UnderlinePanels/UnderlinePanels-e4b325b9.css.map +1 -0
  63. package/dist/experimental/UnderlinePanels/UnderlinePanels.module.css.js +1 -1
  64. package/dist/hooks/useRefObjectAsForwardedRef.d.ts.map +1 -1
  65. package/dist/hooks/useRefObjectAsForwardedRef.js +10 -2
  66. package/dist/hooks/useScrollFlash.d.ts.map +1 -1
  67. package/dist/hooks/useScrollFlash.js +14 -22
  68. package/dist/hooks/useSlots.d.ts +50 -6
  69. package/dist/hooks/useSlots.d.ts.map +1 -1
  70. package/dist/hooks/useSlots.js +114 -36
  71. package/dist/internal/components/UnderlineTabbedInterface-4197ee28.css +2 -0
  72. package/dist/internal/components/UnderlineTabbedInterface-4197ee28.css.map +1 -0
  73. package/dist/internal/components/UnderlineTabbedInterface.d.ts +1 -0
  74. package/dist/internal/components/UnderlineTabbedInterface.d.ts.map +1 -1
  75. package/dist/internal/components/UnderlineTabbedInterface.js +48 -41
  76. package/dist/internal/components/UnderlineTabbedInterface.module.css.js +1 -1
  77. package/generated/components.json +194 -2
  78. package/package.json +2 -2
  79. package/dist/ActionList/ActionList-f4ac3b54.css +0 -2
  80. package/dist/ActionList/ActionList-f4ac3b54.css.map +0 -1
  81. package/dist/Blankslate/Blankslate-f5a9755a.css.map +0 -1
  82. package/dist/Button/ButtonBase-781fba8b.css +0 -2
  83. package/dist/Button/ButtonBase-781fba8b.css.map +0 -1
  84. package/dist/PageLayout/PageLayout-cb491b47.css +0 -2
  85. package/dist/PageLayout/PageLayout-cb491b47.css.map +0 -1
  86. package/dist/UnderlineNav/UnderlineNav-bec9faaa.css +0 -2
  87. package/dist/UnderlineNav/UnderlineNav-bec9faaa.css.map +0 -1
  88. package/dist/UnderlineNav/UnderlineNavItem-db9dc5d0.css +0 -2
  89. package/dist/UnderlineNav/UnderlineNavItem-db9dc5d0.css.map +0 -1
  90. package/dist/experimental/UnderlinePanels/UnderlinePanels-133b9c25.css +0 -2
  91. package/dist/experimental/UnderlinePanels/UnderlinePanels-133b9c25.css.map +0 -1
  92. package/dist/internal/components/UnderlineTabbedInterface-6bea1152.css +0 -2
  93. package/dist/internal/components/UnderlineTabbedInterface-6bea1152.css.map +0 -1
@@ -1,6 +1,5 @@
1
- import { c } from 'react-compiler-runtime';
2
1
  import React, { useState, useEffect } from 'react';
3
- import { AlertIcon, XCircleFillIcon, SearchIcon, ArrowLeftIcon, FilterRemoveIcon, XIcon } from '@primer/octicons-react';
2
+ import { AlertIcon, SearchIcon, XCircleFillIcon, ArrowLeftIcon, FilterRemoveIcon, XIcon } from '@primer/octicons-react';
4
3
  import { ActionListContainerContext } from '../../ActionList/ActionListContainerContext.js';
5
4
  import { useSlots } from '../../hooks/useSlots.js';
6
5
  import { BaseOverlay, heightMap } from '../../Overlay/Overlay.js';
@@ -16,14 +15,14 @@ import { useId } from '../../hooks/useId.js';
16
15
  import { useAnchoredPosition } from '../../hooks/useAnchoredPosition.js';
17
16
  import { AriaStatus } from '../../live-region/AriaStatus.js';
18
17
  import Octicon from '../../Octicon/Octicon.js';
18
+ import Spinner from '../../Spinner/Spinner.js';
19
+ import { ButtonComponent } from '../../Button/Button.js';
19
20
  import TextInput from '../../TextInput/TextInput.js';
21
+ import { IconButton } from '../../Button/IconButton.js';
22
+ import Heading from '../../Heading/Heading.js';
20
23
  import { useFormControlForwardedProps } from '../../FormControl/_FormControlContext.js';
21
- import { ButtonComponent } from '../../Button/Button.js';
22
24
  import Link from '../../Link/Link.js';
23
25
  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';
27
26
 
28
27
  const SelectPanelContext = /*#__PURE__*/React.createContext({
29
28
  title: '',
@@ -114,10 +113,10 @@ const Panel = ({
114
113
  const onInternalClearSelection = () => {
115
114
  if (typeof propsOnClearSelection === 'function') propsOnClearSelection();
116
115
  };
117
- const internalAfterSelect = event_0 => {
116
+ const internalAfterSelect = event => {
118
117
  if (selectionVariant === 'instant') onInternalSubmit();
119
- if (event_0.type === 'keypress') {
120
- if (event_0.key === 'Enter') onInternalSubmit();
118
+ if (event.type === 'keypress') {
119
+ if (event.key === 'Enter') onInternalSubmit();
121
120
  }
122
121
  };
123
122
 
@@ -159,12 +158,12 @@ const Panel = ({
159
158
 
160
159
  // Esc handler
161
160
  React.useEffect(() => {
162
- const dialogEl_0 = dialogRef.current;
163
- const handler = event_1 => {
164
- if (event_1.key === 'Escape') onInternalCancel();
161
+ const dialogEl = dialogRef.current;
162
+ const handler = event => {
163
+ if (event.key === 'Escape') onInternalCancel();
165
164
  };
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);
165
+ dialogEl === null || dialogEl === void 0 ? void 0 : dialogEl.addEventListener('keydown', handler);
166
+ return () => dialogEl === null || dialogEl === void 0 ? void 0 : dialogEl.removeEventListener('keydown', handler);
168
167
  }, [onInternalCancel]);
169
168
 
170
169
  // Autofocus hack: React doesn't support autoFocus for dialog: https://github.com/facebook/react/issues/23301
@@ -218,8 +217,8 @@ const Panel = ({
218
217
  },
219
218
  className: clsx(classes.Overlay, className),
220
219
  ...props,
221
- onClick: event_2 => {
222
- if (event_2.target === event_2.currentTarget) onClickOutside();
220
+ onClick: event => {
221
+ if (event.target === event.currentTarget) onClickOutside();
223
222
  },
224
223
  children: internalOpen && /*#__PURE__*/jsx(Fragment, {
225
224
  children: /*#__PURE__*/jsx(SelectPanelContext.Provider, {
@@ -287,40 +286,15 @@ const SelectPanelButton = /*#__PURE__*/React.forwardRef((props, anchorRef) => {
287
286
  }
288
287
  });
289
288
  SelectPanelButton.__SLOT__ = Symbol('SelectPanel.Button');
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);
289
+ const SelectPanelHeader = ({
290
+ children,
291
+ onBack,
292
+ className,
293
+ ...props
294
+ }) => {
295
+ const [slots, childrenWithoutSlots] = useSlots(children, {
296
+ searchInput: SelectPanelSearchInput
297
+ });
324
298
  const {
325
299
  title,
326
300
  description,
@@ -328,604 +302,246 @@ const SelectPanelHeader = t0 => {
328
302
  onCancel,
329
303
  onClearSelection
330
304
  } = React.useContext(SelectPanelContext);
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", {
305
+ return /*#__PURE__*/jsxs("div", {
306
+ className: clsx(classes.Header, className),
307
+ ...props,
308
+ children: [/*#__PURE__*/jsxs("div", {
455
309
  className: classes.HeaderContent,
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;
310
+ "data-description": description ? true : undefined,
311
+ "data-search-input": slots.searchInput ? true : undefined,
312
+ children: [/*#__PURE__*/jsxs("div", {
313
+ className: classes.FlexBox,
314
+ children: [onBack ? /*#__PURE__*/jsx(IconButton, {
315
+ type: "button",
316
+ variant: "invisible",
317
+ icon: ArrowLeftIcon,
318
+ "aria-label": "Back",
319
+ onClick: () => onBack()
320
+ }) : null, /*#__PURE__*/jsxs("div", {
321
+ className: classes.TitleWrapper,
322
+ "data-description": description ? true : undefined,
323
+ "data-on-back": onBack ? true : undefined,
324
+ children: [/*#__PURE__*/jsx(Heading, {
325
+ as: "h1",
326
+ id: `${panelId}--title`,
327
+ className: classes.Title,
328
+ children: title
329
+ }), description ? /*#__PURE__*/jsx("span", {
330
+ id: `${panelId}--description`,
331
+ className: classes.Description,
332
+ children: description
333
+ }) : null]
334
+ })]
335
+ }), /*#__PURE__*/jsxs("div", {
336
+ children: [onClearSelection ? /*#__PURE__*/jsx(IconButton, {
337
+ type: "button",
338
+ variant: "invisible",
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
+ });
485
352
  };
353
+ SelectPanelHeader.displayName = "SelectPanelHeader";
486
354
  SelectPanelHeader.__SLOT__ = Symbol('SelectPanel.Header');
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;
355
+ const SelectPanelSearchInput = ({
356
+ onChange: propsOnChange,
357
+ onKeyDown: propsOnKeyDown,
358
+ className,
359
+ ...props
360
+ }) => {
361
+ // TODO: use forwardedRef
362
+ const inputRef = /*#__PURE__*/React.createRef();
519
363
  const {
520
364
  setSearchQuery,
521
365
  moveFocusToList
522
366
  } = React.useContext(SelectPanelContext);
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, {
367
+ const internalOnChange = event => {
368
+ // If props.onChange is given, the application controls search,
369
+ // otherwise the component does
370
+ if (typeof propsOnChange === 'function') propsOnChange(event);else setSearchQuery(event.target.value);
371
+ };
372
+ const internalKeyDown = event => {
373
+ if (event.key === 'ArrowDown') {
374
+ event.preventDefault(); // prevent scroll
375
+ moveFocusToList();
376
+ }
377
+ if (typeof propsOnKeyDown === 'function') propsOnKeyDown(event);
378
+ };
379
+ return /*#__PURE__*/jsx(TextInput, {
380
+ ref: inputRef,
381
+ block: true,
382
+ leadingVisual: SearchIcon,
383
+ placeholder: "Search",
384
+ trailingAction: /*#__PURE__*/jsx(TextInput.Action, {
560
385
  icon: XCircleFillIcon,
561
386
  "aria-label": "Clear",
562
387
  tooltipDirection: "w",
563
388
  className: classes.ClearAction,
564
389
  onClick: () => {
565
- if (inputRef.current) {
566
- inputRef.current.value = "";
567
- }
568
- if (typeof propsOnChange === "function") {
390
+ if (inputRef.current) inputRef.current.value = '';
391
+ if (typeof propsOnChange === 'function') {
392
+ // @ts-ignore TODO this is a hacky solution to clear
569
393
  propsOnChange({
570
394
  target: inputRef.current,
571
395
  currentTarget: inputRef.current
572
396
  });
573
397
  }
574
398
  }
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;
399
+ }),
400
+ className: clsx(classes.TextInput, className),
401
+ onChange: internalOnChange,
402
+ onKeyDown: internalKeyDown,
403
+ ...props
404
+ });
612
405
  };
406
+ SelectPanelSearchInput.displayName = "SelectPanelSearchInput";
613
407
  SelectPanelSearchInput.__SLOT__ = Symbol('SelectPanel.SearchInput');
614
408
  const FooterContext = /*#__PURE__*/React.createContext(false);
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
- }
409
+ const SelectPanelFooter = ({
410
+ ...props
411
+ }) => {
627
412
  const {
628
413
  onCancel,
629
414
  selectionVariant
630
415
  } = React.useContext(SelectPanelContext);
631
- const hidePrimaryActions = selectionVariant === "instant";
632
- const buttonSize = useResponsiveValue(responsiveButtonSizes, "small");
416
+ const hidePrimaryActions = selectionVariant === 'instant';
417
+ const buttonSize = useResponsiveValue(responsiveButtonSizes, 'small');
633
418
  if (hidePrimaryActions && !props.children) {
419
+ // nothing to render
420
+ // todo: we can inform them the developer footer will render nothing
634
421
  return null;
635
422
  }
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"
423
+ return /*#__PURE__*/jsx(FooterContext.Provider, {
424
+ value: true,
425
+ children: /*#__PURE__*/jsxs("div", {
426
+ className: classes.Footer,
427
+ "data-hide-primary-actions": hidePrimaryActions || undefined,
428
+ children: [/*#__PURE__*/jsx("div", {
429
+ className: classes.FooterContent,
430
+ "data-hide-primary-actions": hidePrimaryActions || undefined,
431
+ children: props.children
432
+ }), hidePrimaryActions ? null : /*#__PURE__*/jsxs("div", {
433
+ className: classes.FooterActions,
434
+ children: [/*#__PURE__*/jsx(ButtonComponent, {
435
+ type: "button",
436
+ size: buttonSize,
437
+ onClick: () => onCancel(),
438
+ children: "Cancel"
439
+ }), /*#__PURE__*/jsx(ButtonComponent, {
440
+ type: "submit",
441
+ size: buttonSize,
442
+ variant: "primary",
443
+ children: "Save"
444
+ })]
665
445
  })]
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;
446
+ })
447
+ });
692
448
  };
449
+ SelectPanelFooter.displayName = "SelectPanelFooter";
693
450
  SelectPanelFooter.__SLOT__ = Symbol('SelectPanel.Footer');
694
451
  const SecondaryButton = props => {
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;
452
+ const size = useResponsiveValue(responsiveButtonSizes, 'small');
453
+ return /*#__PURE__*/jsx(ButtonComponent, {
454
+ type: "button",
455
+ size: size,
456
+ block: true,
457
+ ...props
458
+ });
712
459
  };
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, {
460
+ SecondaryButton.displayName = "SecondaryButton";
461
+ const SecondaryLink = ({
462
+ className,
463
+ ...props
464
+ }) => {
465
+ const size = useResponsiveValue(responsiveButtonSizes, 'small');
466
+ return (
467
+ /*#__PURE__*/
468
+ // @ts-ignore TODO: is as prop is not recognised by button?
469
+ jsx(ButtonComponent, {
741
470
  as: Link,
742
471
  size: size,
743
472
  variant: "invisible",
744
473
  block: true,
745
474
  ...props,
746
- className: t1,
475
+ className: clsx(classes.SmallText, className),
747
476
  children: props.children
748
- });
749
- $[5] = props;
750
- $[6] = size;
751
- $[7] = t1;
752
- $[8] = t2;
753
- } else {
754
- t2 = $[8];
755
- }
756
- return t2;
477
+ })
478
+ );
757
479
  };
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
- }
480
+ SecondaryLink.displayName = "SecondaryLink";
481
+ const SecondaryCheckbox = ({
482
+ id,
483
+ children,
484
+ className,
485
+ ...props
486
+ }) => {
782
487
  const checkboxId = useId(id);
783
488
  const {
784
489
  selectionVariant
785
490
  } = React.useContext(SelectPanelContext);
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, {
491
+
492
+ // Checkbox should not be used with instant selection
493
+ !(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;
494
+ return /*#__PURE__*/jsxs("div", {
495
+ className: classes.SecondaryCheckbox,
496
+ children: [/*#__PURE__*/jsx(Checkbox, {
798
497
  id: checkboxId,
799
- className: t1,
498
+ className: clsx(classes.Checkbox, className),
800
499
  ...props
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, {
500
+ }), /*#__PURE__*/jsx(InputLabel, {
812
501
  htmlFor: checkboxId,
813
502
  className: classes.SmallText,
814
503
  children: children
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;
504
+ })]
505
+ });
835
506
  };
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
- }
507
+ SecondaryCheckbox.displayName = "SecondaryCheckbox";
508
+ const SelectPanelSecondaryAction = ({
509
+ variant,
510
+ ...props
511
+ }) => {
852
512
  const insideFooter = React.useContext(FooterContext);
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
- }
513
+ !insideFooter ? process.env.NODE_ENV !== "production" ? invariant(false, 'SelectPanel.SecondaryAction is only allowed inside SelectPanel.Footer') : invariant(false) : void 0;
514
+
515
+ // @ts-ignore TODO
516
+ if (variant === 'button') return /*#__PURE__*/jsx(SecondaryButton, {
517
+ ...props
518
+ });
519
+ // @ts-ignore TODO
520
+ else if (variant === 'link') return /*#__PURE__*/jsx(SecondaryLink, {
521
+ ...props
522
+ });
523
+ // @ts-ignore TODO
524
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
525
+ else if (variant === 'checkbox') return /*#__PURE__*/jsx(SecondaryCheckbox, {
526
+ ...props
527
+ });
895
528
  };
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, {
529
+ const SelectPanelLoading = ({
530
+ children = 'Fetching items...'
531
+ }) => {
532
+ return /*#__PURE__*/jsxs(AriaStatus, {
533
+ announceOnShow: true,
534
+ className: classes.SelectPanelLoading,
535
+ children: [/*#__PURE__*/jsx(Spinner, {
905
536
  size: "medium",
906
537
  srText: null
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;
538
+ }), /*#__PURE__*/jsx("span", {
539
+ className: classes.LoadingText,
540
+ children: children
541
+ })]
542
+ });
928
543
  };
544
+ SelectPanelLoading.displayName = "SelectPanelLoading";
929
545
  const SelectPanelMessage = ({
930
546
  variant = 'warning',
931
547
  size = variant === 'empty' ? 'full' : 'inline',