@splunk/react-ui 4.37.0 → 4.39.0

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 (142) hide show
  1. package/Accordion.js +131 -153
  2. package/Anchor.js +50 -58
  3. package/Animation.js +64 -59
  4. package/AnimationToggle.js +59 -61
  5. package/Box.js +59 -67
  6. package/Breadcrumbs.js +113 -127
  7. package/Button.js +208 -219
  8. package/ButtonGroup.js +41 -49
  9. package/ButtonSimple.js +264 -295
  10. package/CHANGELOG.md +50 -1
  11. package/Calendar.js +353 -414
  12. package/Card.js +183 -243
  13. package/CardLayout.js +86 -83
  14. package/Chip.js +104 -122
  15. package/Clickable.js +180 -198
  16. package/CloseButton.js +52 -60
  17. package/Code.js +24 -31
  18. package/CollapsiblePanel.js +172 -202
  19. package/Color.js +1107 -980
  20. package/ColumnLayout.js +72 -96
  21. package/ComboBox.js +267 -305
  22. package/Concertina.js +406 -454
  23. package/ControlGroup.js +165 -194
  24. package/Date.js +116 -131
  25. package/DefinitionList.js +125 -149
  26. package/Divider.js +81 -79
  27. package/Dropdown.js +226 -237
  28. package/DualListbox.js +150 -186
  29. package/EventListener.js +4 -1
  30. package/File.js +1032 -955
  31. package/FormRows.js +281 -334
  32. package/Heading.js +27 -35
  33. package/Image.js +101 -116
  34. package/JSONTree.js +301 -344
  35. package/Layer.js +118 -126
  36. package/Link.js +141 -159
  37. package/List.js +61 -77
  38. package/MIGRATION.mdx +92 -38
  39. package/Markdown.js +288 -347
  40. package/Menu.js +512 -530
  41. package/Message.js +173 -196
  42. package/MessageBar.js +58 -66
  43. package/Modal.js +241 -290
  44. package/ModalLayer.js +130 -148
  45. package/Monogram.js +138 -138
  46. package/Multiselect.js +1600 -1923
  47. package/Number.js +159 -178
  48. package/Paginator.js +296 -335
  49. package/Paragraph.js +24 -32
  50. package/Popover.js +448 -441
  51. package/Progress.js +65 -75
  52. package/RadioBar.js +301 -303
  53. package/RadioList.js +77 -119
  54. package/Resize.js +105 -127
  55. package/ResultsMenu.js +373 -385
  56. package/ScreenReaderContent.js +130 -94
  57. package/Scroll.js +209 -244
  58. package/Search.js +375 -384
  59. package/Select.js +1076 -1354
  60. package/SidePanel.js +122 -142
  61. package/Slider.js +192 -222
  62. package/SlidingPanels.js +238 -270
  63. package/SplitButton.js +222 -245
  64. package/StaticContent.js +68 -76
  65. package/StepBar.js +206 -205
  66. package/Switch.js +211 -236
  67. package/TabBar.js +222 -258
  68. package/TabLayout.js +114 -139
  69. package/Table.js +2017 -2180
  70. package/Text.js +401 -512
  71. package/TextArea.js +411 -441
  72. package/Tooltip.js +116 -132
  73. package/TransitionOpen.js +160 -178
  74. package/Tree.js +268 -287
  75. package/Typography.js +48 -52
  76. package/WaitSpinner.js +60 -68
  77. package/cypress/support/commands.ts +9 -0
  78. package/cypress/support/index.d.ts +6 -0
  79. package/cypress/tsconfig.cypress.json +1 -0
  80. package/docker-compose.yml +0 -1
  81. package/package.json +17 -17
  82. package/types/src/Button/Button.d.ts +20 -6
  83. package/types/src/ButtonSimple/ButtonSimple.d.ts +2 -2
  84. package/types/src/CollapsiblePanel/CollapsiblePanel.d.ts +1 -1
  85. package/types/src/Color/Color.d.ts +5 -2
  86. package/types/src/Color/Palette.d.ts +6 -2
  87. package/types/src/ComboBox/Option.d.ts +1 -1
  88. package/types/src/ControlGroup/ControlGroup.d.ts +1 -2
  89. package/types/src/Date/Date.d.ts +2 -3
  90. package/types/src/File/File.d.ts +2 -3
  91. package/types/src/File/Retry.d.ts +1 -2
  92. package/types/src/Link/Link.d.ts +3 -4
  93. package/types/src/Menu/Item.d.ts +24 -8
  94. package/types/src/Menu/Menu.d.ts +3 -3
  95. package/types/src/Menu/docs/examples/Adornments.d.ts +2 -0
  96. package/types/src/Menu/docs/examples/SelectableWithAdornments.d.ts +2 -0
  97. package/types/src/ModalLayer/ModalLayer.d.ts +1 -1
  98. package/types/src/Multiselect/Option.d.ts +2 -0
  99. package/types/src/Number/Number.d.ts +3 -3
  100. package/types/src/Popover/Popover.d.ts +3 -4
  101. package/types/src/RadioBar/RadioBar.d.ts +2 -2
  102. package/types/src/ResultsMenu/VirtualizedResultsMenu/VirtualizedResultsMenu.d.ts +1 -1
  103. package/types/src/ScrollContainerContext/ScrollContainerContext.d.ts +2 -2
  104. package/types/src/Search/Option.d.ts +16 -3
  105. package/types/src/Select/Option.d.ts +3 -1
  106. package/types/src/Select/OptionBase.d.ts +7 -5
  107. package/types/src/Select/Select.d.ts +2 -2
  108. package/types/src/Select/SelectAllOption.d.ts +4 -4
  109. package/types/src/Select/SelectBase.d.ts +0 -1
  110. package/types/src/SidePanel/SidePanel.d.ts +1 -1
  111. package/types/src/Slider/Slider.d.ts +2 -3
  112. package/types/src/Slider/docs/examples/Error.d.ts +2 -0
  113. package/types/src/SlidingPanels/SlidingPanels.d.ts +1 -1
  114. package/types/src/StepBar/Step.d.ts +1 -2
  115. package/types/src/TabBar/Tab.d.ts +1 -1
  116. package/types/src/TabBar/TabBar.d.ts +3 -1
  117. package/types/src/TabLayout/TabLayout.d.ts +2 -0
  118. package/types/src/Table/HeadDropdownCell.d.ts +2 -0
  119. package/types/src/Table/Table.d.ts +0 -1
  120. package/types/src/Table/docs/examples/StripeRows.d.ts +2 -0
  121. package/types/src/Text/IconOutlinedHide.d.ts +1 -2
  122. package/types/src/Text/IconOutlinedView.d.ts +1 -2
  123. package/types/src/Text/Text.d.ts +6 -4
  124. package/types/src/Text/docs/examples/Dimmed.d.ts +2 -0
  125. package/types/src/TextArea/TextArea.d.ts +2 -2
  126. package/types/src/Tooltip/Tooltip.d.ts +4 -4
  127. package/types/src/TransitionOpen/TransitionOpen.d.ts +1 -1
  128. package/useForceUpdate.js +30 -32
  129. package/useKeyPress.js +1 -1
  130. package/types/src/Button/docs/examples/Selected.d.ts +0 -2
  131. package/types/src/ButtonGroup/docs/examples/prisma/Basic.d.ts +0 -1
  132. package/types/src/File/docs/examples/prisma/Error.d.ts +0 -1
  133. package/types/src/Menu/docs/examples/Icons.d.ts +0 -2
  134. package/types/src/Menu/docs/examples/SelectableWithIcons.d.ts +0 -2
  135. package/types/src/Slider/docs/examples/prisma/Error.d.ts +0 -2
  136. package/types/src/TabBar/docs/examples/prisma/Context.d.ts +0 -2
  137. package/types/src/TabLayout/docs/examples/prisma/Context.d.ts +0 -2
  138. package/types/src/Table/docs/examples/prisma/Basic.d.ts +0 -2
  139. /package/types/src/Date/docs/examples/{prisma/WithoutCalendar.d.ts → WithoutCalendar.d.ts} +0 -0
  140. /package/types/src/Message/docs/examples/{prisma/Title.d.ts → Title.d.ts} +0 -0
  141. /package/types/src/StepBar/docs/examples/{prisma/Error.d.ts → Error.d.ts} +0 -0
  142. /package/types/src/TabBar/docs/examples/{prisma/Disabled.d.ts → Disabled.d.ts} +0 -0
package/DualListbox.js CHANGED
@@ -95,27 +95,24 @@
95
95
  * Defaults to `'{}'`.
96
96
  * @public
97
97
  */
98
- var h = n().createContext({});
99
- /* harmony default export */ const g = h;
98
+ var g = n().createContext({});
99
+ /* harmony default export */ const h = g;
100
100
  // CONCATENATED MODULE: ./src/DualListbox/ScreenReaderWrapper.tsx
101
101
  function y() {
102
- y = Object.assign || function(e) {
102
+ return y = Object.assign ? Object.assign.bind() : function(e) {
103
103
  for (var r = 1; r < arguments.length; r++) {
104
104
  var t = arguments[r];
105
105
  for (var n in t) {
106
- if (Object.prototype.hasOwnProperty.call(t, n)) {
107
- e[n] = t[n];
108
- }
106
+ ({}).hasOwnProperty.call(t, n) && (e[n] = t[n]);
109
107
  }
110
108
  }
111
109
  return e;
112
- };
113
- return y.apply(this, arguments);
110
+ }, y.apply(null, arguments);
114
111
  }
115
112
  function k(e) {
116
113
  var r = y({}, e);
117
114
  var a = p()();
118
- var i = (0, t.useContext)(g);
115
+ var i = (0, t.useContext)(h);
119
116
  var l = i.getScreenReaderMessage, o = i.updateScreenReaderRefreshHook;
120
117
  (0, t.useEffect)((function() {
121
118
  o === null || o === void 0 ? void 0 : o(a);
@@ -181,10 +178,10 @@
181
178
  if (!t) {
182
179
  return;
183
180
  }
184
- // Below the bottom of the container.
181
+ // Below the bottom of the container.
185
182
  if (t.scrollTop + t.clientHeight < r.offsetTop + r.clientHeight) {
186
183
  t.scrollTop = r.offsetTop + r.clientHeight - t.clientHeight;
187
- // Above the top of the container.
184
+ // Above the top of the container.
188
185
  } else if (t.scrollTop > r.offsetTop) {
189
186
  t.scrollTop = r.offsetTop;
190
187
  }
@@ -206,7 +203,7 @@
206
203
  a = true;
207
204
  return true;
208
205
  }
209
- // If we haven't found a match yet, keep track of the next closest match.
206
+ // If we haven't found a match yet, keep track of the next closest match.
210
207
  // Secondary matching looks for the closest character of a higher value, and failing that, closest of a lower value.
211
208
  if (!a) {
212
209
  var i = R(n, t.index);
@@ -237,7 +234,7 @@
237
234
  /* harmony default export */ const L = I;
238
235
  // CONCATENATED MODULE: external "@splunk/react-ui/Tooltip"
239
236
  const q = require("@splunk/react-ui/Tooltip");
240
- var j = e.n(q);
237
+ var P = e.n(q);
241
238
  // CONCATENATED MODULE: external "styled-components"
242
239
  const _ = require("styled-components");
243
240
  var D = e.n(_);
@@ -245,9 +242,9 @@
245
242
  const N = require("@splunk/themes");
246
243
  // CONCATENATED MODULE: external "@splunk/react-ui/Clickable"
247
244
  const V = require("@splunk/react-ui/Clickable");
248
- var P = e.n(V);
245
+ var j = e.n(V);
249
246
  // CONCATENATED MODULE: ./src/DualListbox/ToolbarButtonStyles.ts
250
- var H = D()(P()).withConfig({
247
+ var H = D()(j()).withConfig({
251
248
  displayName: "ToolbarButtonStyles__StyledClickable",
252
249
  componentId: "k7zksz-0"
253
250
  })([ "", " border:", ";border-radius:", ";box-sizing:border-box;cursor:pointer;flex-grow:1;font-weight:", ";line-height:", ";min-height:", ";min-width:", ";max-width:100%;", ";position:relative;text-align:center;text-decoration:none;vertical-align:middle;white-space:nowrap;width:", ";&:active{transition:none;}&:focus{box-shadow:", ";}&:focus,&:hover{z-index:3;}", ";" ], N.mixins.reset("block"), (0,
@@ -304,43 +301,35 @@
304
301
  }));
305
302
  // CONCATENATED MODULE: ./src/DualListbox/ToolbarButton.tsx
306
303
  function B() {
307
- B = Object.assign || function(e) {
304
+ return B = Object.assign ? Object.assign.bind() : function(e) {
308
305
  for (var r = 1; r < arguments.length; r++) {
309
306
  var t = arguments[r];
310
307
  for (var n in t) {
311
- if (Object.prototype.hasOwnProperty.call(t, n)) {
312
- e[n] = t[n];
313
- }
308
+ ({}).hasOwnProperty.call(t, n) && (e[n] = t[n]);
314
309
  }
315
310
  }
316
311
  return e;
317
- };
318
- return B.apply(this, arguments);
312
+ }, B.apply(null, arguments);
319
313
  }
320
314
  function M(e, r) {
321
- if (e == null) return {};
322
- var t = A(e, r);
323
- var n, a;
315
+ if (null == e) return {};
316
+ var t, n, a = A(e, r);
324
317
  if (Object.getOwnPropertySymbols) {
325
318
  var i = Object.getOwnPropertySymbols(e);
326
- for (a = 0; a < i.length; a++) {
327
- n = i[a];
328
- if (r.indexOf(n) >= 0) continue;
329
- if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
330
- t[n] = e[n];
319
+ for (n = 0; n < i.length; n++) {
320
+ t = i[n], r.includes(t) || {}.propertyIsEnumerable.call(e, t) && (a[t] = e[t]);
331
321
  }
332
322
  }
333
- return t;
323
+ return a;
334
324
  }
335
325
  function A(e, r) {
336
- if (e == null) return {};
326
+ if (null == e) return {};
337
327
  var t = {};
338
- var n = Object.keys(e);
339
- var a, i;
340
- for (i = 0; i < n.length; i++) {
341
- a = n[i];
342
- if (r.indexOf(a) >= 0) continue;
343
- t[a] = e[a];
328
+ for (var n in e) {
329
+ if ({}.hasOwnProperty.call(e, n)) {
330
+ if (r.includes(n)) continue;
331
+ t[n] = e[n];
332
+ }
344
333
  }
345
334
  return t;
346
335
  }
@@ -369,9 +358,9 @@
369
358
  if (!d) {
370
359
  return null;
371
360
  }
372
- var h = d(l), g = h.disabled;
361
+ var g = d(l), h = g.disabled;
373
362
 
374
- return n().createElement(j(), {
363
+ return n().createElement(P(), {
375
364
  defaultPlacement: u,
376
365
  content: n().createElement("span", {
377
366
  "aria-hidden": true
@@ -379,10 +368,10 @@
379
368
  }, n().createElement(H, B({
380
369
  "aria-label": r,
381
370
  "aria-keyshortcuts": a,
382
- "aria-disabled": g || undefined,
371
+ "aria-disabled": h || undefined,
383
372
  "data-test": "toolbar-button",
384
- $disabled: g,
385
- onClick: !g ? m : undefined
373
+ $disabled: h,
374
+ onClick: !h ? m : undefined
386
375
  }, c), n().createElement(T, null, i)));
387
376
  }
388
377
  $.propsTypes = K;
@@ -435,43 +424,35 @@
435
424
  /* harmony default export */ const Q = J;
436
425
  // CONCATENATED MODULE: ./src/DualListbox/Option.tsx
437
426
  function Y() {
438
- Y = Object.assign || function(e) {
427
+ return Y = Object.assign ? Object.assign.bind() : function(e) {
439
428
  for (var r = 1; r < arguments.length; r++) {
440
429
  var t = arguments[r];
441
430
  for (var n in t) {
442
- if (Object.prototype.hasOwnProperty.call(t, n)) {
443
- e[n] = t[n];
444
- }
431
+ ({}).hasOwnProperty.call(t, n) && (e[n] = t[n]);
445
432
  }
446
433
  }
447
434
  return e;
448
- };
449
- return Y.apply(this, arguments);
435
+ }, Y.apply(null, arguments);
450
436
  }
451
437
  function Z(e, r) {
452
- if (e == null) return {};
453
- var t = ee(e, r);
454
- var n, a;
438
+ if (null == e) return {};
439
+ var t, n, a = ee(e, r);
455
440
  if (Object.getOwnPropertySymbols) {
456
441
  var i = Object.getOwnPropertySymbols(e);
457
- for (a = 0; a < i.length; a++) {
458
- n = i[a];
459
- if (r.indexOf(n) >= 0) continue;
460
- if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
461
- t[n] = e[n];
442
+ for (n = 0; n < i.length; n++) {
443
+ t = i[n], r.includes(t) || {}.propertyIsEnumerable.call(e, t) && (a[t] = e[t]);
462
444
  }
463
445
  }
464
- return t;
446
+ return a;
465
447
  }
466
448
  function ee(e, r) {
467
- if (e == null) return {};
449
+ if (null == e) return {};
468
450
  var t = {};
469
- var n = Object.keys(e);
470
- var a, i;
471
- for (i = 0; i < n.length; i++) {
472
- a = n[i];
473
- if (r.indexOf(a) >= 0) continue;
474
- t[a] = e[a];
451
+ for (var n in e) {
452
+ if ({}.hasOwnProperty.call(e, n)) {
453
+ if (r.includes(n)) continue;
454
+ t[n] = e[n];
455
+ }
475
456
  }
476
457
  return t;
477
458
  }
@@ -501,18 +482,18 @@
501
482
  if (!v) {
502
483
  return null;
503
484
  }
504
- var m = v(l), h = m.active, g = m.selected;
505
- var y = !!(f ? i : g);
485
+ var m = v(l), g = m.active, h = m.selected;
486
+ var y = !!(f ? i : h);
506
487
 
507
488
  return n().createElement(W, Y({
508
489
  "aria-selected": y,
509
490
  "data-test": "option",
510
491
  "data-test-value": l,
511
- "data-test-active": h,
492
+ "data-test-active": g,
512
493
  id: r,
513
494
  onClick: b,
514
495
  role: "option",
515
- $active: h,
496
+ $active: g,
516
497
  $selected: y
517
498
  }, o), n().createElement(X, {
518
499
  interactive: false,
@@ -554,17 +535,17 @@
554
535
  var s = (0, t.useContext)(Q);
555
536
  var v = p()();
556
537
  var f = (0, t.useRef)((0, ae.createDOMID)("switch"));
557
- var b = s.updateLabelRefreshHookByName, h = s.getLabelState;
538
+ var b = s.updateLabelRefreshHookByName, g = s.getLabelState;
558
539
  (0, t.useEffect)((function() {
559
540
  b === null || b === void 0 ? void 0 : b(o, v);
560
541
  return function() {
561
542
  return b === null || b === void 0 ? void 0 : b(o);
562
543
  };
563
544
  }), [ o, b, v ]);
564
- if (!h) {
545
+ if (!g) {
565
546
  return null;
566
547
  }
567
- var g = h(), y = g.disabled, k = g.selected, C = g.selectedValueCount, x = g.valueCount;
548
+ var h = g(), y = h.disabled, k = h.selected, C = h.selectedValueCount, x = h.valueCount;
568
549
 
569
550
  return n().createElement(oe, {
570
551
  $columnNumber: a
@@ -604,43 +585,35 @@
604
585
  }));
605
586
  // CONCATENATED MODULE: ./src/DualListbox/Listbox.tsx
606
587
  function de() {
607
- de = Object.assign || function(e) {
588
+ return de = Object.assign ? Object.assign.bind() : function(e) {
608
589
  for (var r = 1; r < arguments.length; r++) {
609
590
  var t = arguments[r];
610
591
  for (var n in t) {
611
- if (Object.prototype.hasOwnProperty.call(t, n)) {
612
- e[n] = t[n];
613
- }
592
+ ({}).hasOwnProperty.call(t, n) && (e[n] = t[n]);
614
593
  }
615
594
  }
616
595
  return e;
617
- };
618
- return de.apply(this, arguments);
596
+ }, de.apply(null, arguments);
619
597
  }
620
598
  function fe(e, r) {
621
- if (e == null) return {};
622
- var t = pe(e, r);
623
- var n, a;
599
+ if (null == e) return {};
600
+ var t, n, a = pe(e, r);
624
601
  if (Object.getOwnPropertySymbols) {
625
602
  var i = Object.getOwnPropertySymbols(e);
626
- for (a = 0; a < i.length; a++) {
627
- n = i[a];
628
- if (r.indexOf(n) >= 0) continue;
629
- if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
630
- t[n] = e[n];
603
+ for (n = 0; n < i.length; n++) {
604
+ t = i[n], r.includes(t) || {}.propertyIsEnumerable.call(e, t) && (a[t] = e[t]);
631
605
  }
632
606
  }
633
- return t;
607
+ return a;
634
608
  }
635
609
  function pe(e, r) {
636
- if (e == null) return {};
610
+ if (null == e) return {};
637
611
  var t = {};
638
- var n = Object.keys(e);
639
- var a, i;
640
- for (i = 0; i < n.length; i++) {
641
- a = n[i];
642
- if (r.indexOf(a) >= 0) continue;
643
- t[a] = e[a];
612
+ for (var n in e) {
613
+ if ({}.hasOwnProperty.call(e, n)) {
614
+ if (r.includes(n)) continue;
615
+ t[n] = e[n];
616
+ }
644
617
  }
645
618
  return t;
646
619
  }
@@ -658,7 +631,7 @@
658
631
  var r = e.children, a = e.elementRef, i = e.index, l = e.label, o = e.name, u = e.onClick, c = e.onKeyDown, s = e.onSelectAllClick, v = fe(e, [ "children", "elementRef", "index", "label", "name", "onClick", "onKeyDown", "onSelectAllClick" ]);
659
632
  var d = (0, t.useRef)((0, ae.createDOMID)("label"));
660
633
  var f = (0, t.useRef)((0, ae.createDOMID)("listbox"));
661
- var p = (0, t.useContext)(g), b = p.controlled, m = p.getSelectedStateForValue, h = p.getActiveValue, y = p.getSelectedValueCount, k = p.getValueCount, C = p.updateLabelRefreshHookByName, x = p.updateOptionRefreshHookByValue;
634
+ var p = (0, t.useContext)(h), b = p.controlled, m = p.getSelectedStateForValue, g = p.getActiveValue, y = p.getSelectedValueCount, k = p.getValueCount, C = p.updateLabelRefreshHookByName, x = p.updateOptionRefreshHookByValue;
662
635
  var S = (0, t.useCallback)((function(e, r) {
663
636
  var t = r.value;
664
637
  u === null || u === void 0 ? void 0 : u(e, {
@@ -668,10 +641,10 @@
668
641
  }), [ o, u ]);
669
642
  var w = (0, t.useCallback)((function(e) {
670
643
  return {
671
- active: (h === null || h === void 0 ? void 0 : h(o)) === e,
644
+ active: (g === null || g === void 0 ? void 0 : g(o)) === e,
672
645
  selected: !!(m === null || m === void 0 ? void 0 : m(e))
673
646
  };
674
- }), [ o, h, m ]);
647
+ }), [ o, g, m ]);
675
648
  var O = (0, t.useCallback)((function() {
676
649
  var e = (k === null || k === void 0 ? void 0 : k(o)) || 0;
677
650
  var r = (y === null || y === void 0 ? void 0 : y(o)) || 0;
@@ -739,10 +712,10 @@
739
712
  }, v), r));
740
713
  }
741
714
  me.propTypes = be;
742
- /* harmony default export */ const he = me;
715
+ /* harmony default export */ const ge = me;
743
716
  // CONCATENATED MODULE: external "@splunk/react-ui/Box"
744
- const ge = require("@splunk/react-ui/Box");
745
- var ye = e.n(ge);
717
+ const he = require("@splunk/react-ui/Box");
718
+ var ye = e.n(he);
746
719
  // CONCATENATED MODULE: ./src/DualListbox/DualListboxStyles.ts
747
720
  var ke = D()(ye()).withConfig({
748
721
  displayName: "DualListboxStyles__StyledBox",
@@ -760,18 +733,15 @@
760
733
  })([ "&::before{content:'';grid-column:headers;grid-row:lists;}align-items:center;display:flex;flex-direction:column;gap:", ";grid-column:actions;grid-row:lists;justify-content:center;" ], N.variables.spacingSmall);
761
734
  // CONCATENATED MODULE: ./src/DualListbox/DualListbox.tsx
762
735
  function xe() {
763
- xe = Object.assign || function(e) {
736
+ return xe = Object.assign ? Object.assign.bind() : function(e) {
764
737
  for (var r = 1; r < arguments.length; r++) {
765
738
  var t = arguments[r];
766
739
  for (var n in t) {
767
- if (Object.prototype.hasOwnProperty.call(t, n)) {
768
- e[n] = t[n];
769
- }
740
+ ({}).hasOwnProperty.call(t, n) && (e[n] = t[n]);
770
741
  }
771
742
  }
772
743
  return e;
773
- };
774
- return xe.apply(this, arguments);
744
+ }, xe.apply(null, arguments);
775
745
  }
776
746
  function Se(e, r) {
777
747
  return Ie(e) || Ee(e, r) || Oe(e, r) || we();
@@ -780,74 +750,68 @@
780
750
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
781
751
  }
782
752
  function Oe(e, r) {
783
- if (!e) return;
784
- if (typeof e === "string") return Re(e, r);
785
- var t = Object.prototype.toString.call(e).slice(8, -1);
786
- if (t === "Object" && e.constructor) t = e.constructor.name;
787
- if (t === "Map" || t === "Set") return Array.from(e);
788
- if (t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)) return Re(e, r);
753
+ if (e) {
754
+ if ("string" == typeof e) return Re(e, r);
755
+ var t = {}.toString.call(e).slice(8, -1);
756
+ return "Object" === t && e.constructor && (t = e.constructor.name), "Map" === t || "Set" === t ? Array.from(e) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? Re(e, r) : void 0;
757
+ }
789
758
  }
790
759
  function Re(e, r) {
791
- if (r == null || r > e.length) r = e.length;
792
- for (var t = 0, n = new Array(r); t < r; t++) {
760
+ (null == r || r > e.length) && (r = e.length);
761
+ for (var t = 0, n = Array(r); t < r; t++) {
793
762
  n[t] = e[t];
794
763
  }
795
764
  return n;
796
765
  }
797
766
  function Ee(e, r) {
798
- if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(e))) return;
799
- var t = [];
800
- var n = true;
801
- var a = false;
802
- var i = undefined;
803
- try {
804
- for (var l = e[Symbol.iterator](), o; !(n = (o = l.next()).done); n = true) {
805
- t.push(o.value);
806
- if (r && t.length === r) break;
807
- }
808
- } catch (e) {
809
- a = true;
810
- i = e;
811
- } finally {
767
+ var t = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
768
+ if (null != t) {
769
+ var n, a, i, l, o = [], u = !0, c = !1;
812
770
  try {
813
- if (!n && l["return"] != null) l["return"]();
771
+ if (i = (t = t.call(e)).next, 0 === r) {
772
+ if (Object(t) !== t) return;
773
+ u = !1;
774
+ } else for (;!(u = (n = i.call(t)).done) && (o.push(n.value), o.length !== r); u = !0) {
775
+ }
776
+ } catch (e) {
777
+ c = !0, a = e;
814
778
  } finally {
815
- if (a) throw i;
779
+ try {
780
+ if (!u && null != t["return"] && (l = t["return"](), Object(l) !== l)) return;
781
+ } finally {
782
+ if (c) throw a;
783
+ }
816
784
  }
785
+ return o;
817
786
  }
818
- return t;
819
787
  }
820
788
  function Ie(e) {
821
789
  if (Array.isArray(e)) return e;
822
790
  }
823
791
  function Le(e, r) {
824
- if (e == null) return {};
825
- var t = qe(e, r);
826
- var n, a;
792
+ if (null == e) return {};
793
+ var t, n, a = qe(e, r);
827
794
  if (Object.getOwnPropertySymbols) {
828
795
  var i = Object.getOwnPropertySymbols(e);
829
- for (a = 0; a < i.length; a++) {
830
- n = i[a];
831
- if (r.indexOf(n) >= 0) continue;
832
- if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
833
- t[n] = e[n];
796
+ for (n = 0; n < i.length; n++) {
797
+ t = i[n], r.includes(t) || {}.propertyIsEnumerable.call(e, t) && (a[t] = e[t]);
834
798
  }
835
799
  }
836
- return t;
800
+ return a;
837
801
  }
838
802
  function qe(e, r) {
839
- if (e == null) return {};
803
+ if (null == e) return {};
840
804
  var t = {};
841
- var n = Object.keys(e);
842
- var a, i;
843
- for (i = 0; i < n.length; i++) {
844
- a = n[i];
845
- if (r.indexOf(a) >= 0) continue;
846
- t[a] = e[a];
805
+ for (var n in e) {
806
+ if ({}.hasOwnProperty.call(e, n)) {
807
+ if (r.includes(n)) continue;
808
+ t[n] = e[n];
809
+ }
847
810
  }
848
811
  return t;
849
812
  }
850
- /** @public */ var je = {
813
+ /** @public */
814
+ /** @public */ var Pe = {
851
815
  children: i().node,
852
816
  controlled: i().bool,
853
817
  fill: i().bool,
@@ -861,60 +825,60 @@
861
825
  };
862
826
  function _e(e) {
863
827
  var r, a, i, u;
864
- var s = e.children, f = e.controlled, b = f === void 0 ? false : f, m = e.fill, h = m === void 0 ? false : m, y = e.inline, k = y === void 0 ? false : y, R = e.onChange, I = e.onSelect, q = e.lists, j = Le(e, [ "children", "controlled", "fill", "inline", "onChange", "onSelect", "lists" ]);
828
+ var s = e.children, f = e.controlled, b = f === void 0 ? false : f, m = e.fill, g = m === void 0 ? false : m, y = e.inline, k = y === void 0 ? false : y, R = e.onChange, I = e.onSelect, q = e.lists, P = Le(e, [ "children", "controlled", "fill", "inline", "onChange", "onSelect", "lists" ]);
865
829
  // @docs-props-type DualListboxPropsBase
866
830
  var _ = p()();
867
831
  var D = (0, t.useRef)(false);
868
832
  (0, t.useEffect)((function() {
869
833
  D.current = true;
870
834
  }), []);
871
- // TODO: Implement shared isControlled hook (SUI-5283).
835
+ // TODO: Implement shared isControlled hook (SUI-5283).
872
836
  var N = (0, t.useRef)(b);
873
- // List One "Available" Refs
837
+ // List One "Available" Refs
874
838
  var V = (0, t.useRef)([]);
875
- var P = (0, t.useRef)([]);
839
+ var j = (0, t.useRef)([]);
876
840
  var H = (0, t.useRef)();
877
841
  var T = (0, t.useRef)(null);
878
842
  var B = (0, t.useRef)([]);
879
- // List Two "Selected" Refs
843
+ // List Two "Selected" Refs
880
844
  var M = (0, t.useRef)([]);
881
845
  var A = (0, t.useRef)([]);
882
846
  var K = (0, t.useRef)();
883
847
  var $ = (0, t.useRef)(null);
884
848
  var z = (0, t.useRef)([]);
885
- // Refresh Hook Stores, used to render indivual elements when uncontrolled
849
+ // Refresh Hook Stores, used to render indivual elements when uncontrolled
886
850
  var U = (0, t.useRef)({});
887
851
  var W = (0, t.useRef)({});
888
852
  var X = (0, t.useRef)({});
889
853
  var G = (0, t.useRef)();
890
- // Activity Values Refs
854
+ // Activity Values Refs
891
855
  var J = (0, t.useRef)();
892
856
  var Q = (0, t.useRef)({});
893
857
  var Y = (0, t.useRef)({});
894
858
  var Z = (0, t.useRef)({});
895
859
  var ee = (0, t.useRef)(0);
896
- // Key Match Refs
860
+ // Key Match Refs
897
861
  var re = (0, t.useRef)();
898
862
  var te = (0, t.useRef)();
899
863
  var ne = (0, t.useRef)([]);
900
864
  if (false) {}
901
865
  if (false) {}
902
866
  if (false) {}
903
- // Unpack names and labels instead of relying on `lists` being a consistent reference
867
+ // Unpack names and labels instead of relying on `lists` being a consistent reference
904
868
  var ae = (r = q[0]) === null || r === void 0 ? void 0 : r.name;
905
869
  var ie = (a = q[1]) === null || a === void 0 ? void 0 : a.name;
906
870
  var le = (i = q[0]) === null || i === void 0 ? void 0 : i.label;
907
871
  var oe = (u = q[1]) === null || u === void 0 ? void 0 : u.label;
908
- // Copy previous state for uncontrolled render so it's not voided by following value reset
872
+ // Copy previous state for uncontrolled render so it's not voided by following value reset
909
873
  var ue = new Set(M.current);
910
- // This ensures we recapture the indexes after batch moves, but will be refactored when sorting is implemented (SUI-5270).
874
+ // This ensures we recapture the indexes after batch moves, but will be refactored when sorting is implemented (SUI-5270).
911
875
  V.current = [];
912
876
  M.current = [];
913
877
  B.current = [];
914
878
  z.current = [];
915
- // Clean the data stores before we copy the references into listData
879
+ // Clean the data stores before we copy the references into listData
916
880
  if (!D.current || N.current) {
917
- P.current = [];
881
+ j.current = [];
918
882
  A.current = [];
919
883
  Q.current = {};
920
884
  Z.current = {};
@@ -924,7 +888,7 @@
924
888
  options: [],
925
889
  matchOptions: B.current,
926
890
  values: V.current,
927
- selectedValues: P.current,
891
+ selectedValues: j.current,
928
892
  activeValue: H.current,
929
893
  activeFound: !H.current
930
894
  }, {
@@ -940,7 +904,7 @@
940
904
  var r = e.props, t = r.value, n = r.label;
941
905
  var a = e.props.listName === ie;
942
906
  var i = ce[a ? 1 : 0];
943
- // Ensure the active value is found on controlled renders
907
+ // Ensure the active value is found on controlled renders
944
908
  if (!i.activeFound && i.activeValue === t) {
945
909
  i.activeFound = true;
946
910
  }
@@ -984,13 +948,13 @@
984
948
  }), [ ae ]);
985
949
  var de = (0, t.useCallback)((function(e, r) {
986
950
  if (e === ae) {
987
- P.current = r;
951
+ j.current = r;
988
952
  } else {
989
953
  A.current = r;
990
954
  }
991
955
  }), [ ae ]);
992
956
  var fe = (0, t.useCallback)((function(e) {
993
- return e === ae ? P.current : A.current;
957
+ return e === ae ? j.current : A.current;
994
958
  }), [ ae ]);
995
959
  var pe = (0, t.useCallback)((function(e) {
996
960
  return fe(e).length;
@@ -1001,7 +965,7 @@
1001
965
  var me = (0, t.useCallback)((function(e) {
1002
966
  return Q.current[e];
1003
967
  }), []);
1004
- var ge = (0, t.useCallback)((function(e, r) {
968
+ var he = (0, t.useCallback)((function(e, r) {
1005
969
  if (e === ae) {
1006
970
  V.current = r;
1007
971
  } else {
@@ -1042,7 +1006,7 @@
1042
1006
  clearTimeout(te.current);
1043
1007
  }
1044
1008
  }), []);
1045
- var je = (0, t.useCallback)((function(e) {
1009
+ var Pe = (0, t.useCallback)((function(e) {
1046
1010
  G.current = e;
1047
1011
  }), []);
1048
1012
  var _e = (0, t.useCallback)((function(e, r) {
@@ -1072,7 +1036,7 @@
1072
1036
  (r = (t = X.current)[e]) === null || r === void 0 ? void 0 : r.call(t);
1073
1037
  }
1074
1038
  }), []);
1075
- var Pe = (0, t.useCallback)((function(e) {
1039
+ var je = (0, t.useCallback)((function(e) {
1076
1040
  if (e) {
1077
1041
  var r, t;
1078
1042
  (r = (t = W.current)[e]) === null || r === void 0 ? void 0 : r.call(t);
@@ -1086,10 +1050,10 @@
1086
1050
  }), []);
1087
1051
  var Te = (0, t.useCallback)((function(e) {
1088
1052
  Ie();
1089
- Pe(e);
1053
+ je(e);
1090
1054
  He(ae);
1091
1055
  He(ie);
1092
- }), [ Ie, He, Pe, ae, ie ]);
1056
+ }), [ Ie, He, je, ae, ie ]);
1093
1057
  var Be = (0, t.useCallback)((function(e, r) {
1094
1058
  var t = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1095
1059
  var n = e === ae ? T.current : $.current;
@@ -1108,7 +1072,7 @@
1108
1072
  Ve(a);
1109
1073
  }
1110
1074
  var i = r ? Y.current[r] : "";
1111
- // update listbox via dom to avoid render + child render
1075
+ // update listbox via dom to avoid render + child render
1112
1076
  n.setAttribute("aria-activedescendant", i);
1113
1077
  if (!t && i.length > 0) {
1114
1078
  var l = n.querySelector("#".concat(i));
@@ -1186,7 +1150,7 @@
1186
1150
  listName: t
1187
1151
  });
1188
1152
  }), [ ye, I, de, Te, Ve ]);
1189
- // handleMoveValues does not update the active value of the source, keyboard and mouse differ, only the target active value is updated
1153
+ // handleMoveValues does not update the active value of the source, keyboard and mouse differ, only the target active value is updated
1190
1154
  var $e = (0, t.useCallback)((function(e, r, t) {
1191
1155
  var n = ye(r);
1192
1156
  var a = fe(r);
@@ -1205,18 +1169,18 @@
1205
1169
  count: a.length,
1206
1170
  listLabel: t === ae ? le : oe
1207
1171
  });
1208
- // These new values do not perserve sort position, may need to be refactored with sort logic (SUI-5270).
1172
+ // These new values do not perserve sort position, may need to be refactored with sort logic (SUI-5270).
1209
1173
  var s = i ? [] : S(n, a);
1210
1174
  var v = o.concat(a);
1211
1175
  if (!N.current) {
1212
1176
  a.forEach((function(e) {
1213
1177
  Q.current[e] = false;
1214
1178
  }));
1215
- ge(t, v);
1216
- ge(r, s);
1179
+ he(t, v);
1180
+ he(r, s);
1217
1181
  de(r, []);
1218
1182
  J.current = c;
1219
- // move is a batch update, force a full render, no internal update needed
1183
+ // move is a batch update, force a full render, no internal update needed
1220
1184
  _();
1221
1185
  }
1222
1186
  var f = {
@@ -1230,7 +1194,7 @@
1230
1194
  };
1231
1195
  e.preventDefault();
1232
1196
  R === null || R === void 0 ? void 0 : R(e, f);
1233
- }), [ _, ve, Oe, fe, ye, R, de, ge, Be, ae, le, oe ]);
1197
+ }), [ _, ve, Oe, fe, ye, R, de, he, Be, ae, le, oe ]);
1234
1198
  var Fe = (0, t.useCallback)((function(e, r) {
1235
1199
  var t = r.name;
1236
1200
  var n = Oe(t);
@@ -1263,7 +1227,7 @@
1263
1227
  var We = (0, t.useCallback)((function(e, r) {
1264
1228
  var t = e.nativeEvent.key;
1265
1229
  var n = Re(r);
1266
- // Checking for a single character to avoid complications from double-byte languages and emojis.
1230
+ // Checking for a single character to avoid complications from double-byte languages and emojis.
1267
1231
  if (t.length === 1) {
1268
1232
  var a = [];
1269
1233
  var i = {
@@ -1282,7 +1246,7 @@
1282
1246
  }
1283
1247
  if (a.length) {
1284
1248
  var l = 0;
1285
- // If the active option is a first character match, cycle to the next matching option.
1249
+ // If the active option is a first character match, cycle to the next matching option.
1286
1250
  if (i.index === 0 && a.length > 1) {
1287
1251
  var o = ve(r);
1288
1252
  if (o) {
@@ -1447,9 +1411,9 @@
1447
1411
  getValueCount: we,
1448
1412
  updateLabelRefreshHookByName: De,
1449
1413
  updateOptionRefreshHookByValue: _e,
1450
- updateScreenReaderRefreshHook: je
1414
+ updateScreenReaderRefreshHook: Pe
1451
1415
  };
1452
- }), [ ve, be, me, pe, we, De, _e, je ]);
1416
+ }), [ ve, be, me, pe, we, De, _e, Pe ]);
1453
1417
  if (N.current && !ce[0].activeFound) {
1454
1418
  // listOne active value wasn't found, likely the result of a controlled state reset
1455
1419
  // update interal values, skip the render it will be caught in batch
@@ -1463,11 +1427,11 @@
1463
1427
 
1464
1428
  return n().createElement(ke, xe({
1465
1429
  "data-test": "dual-listbox",
1466
- $inline: h ? false : k,
1467
- $fill: h
1468
- }, j), n().createElement(g.Provider, {
1430
+ $inline: g ? false : k,
1431
+ $fill: g
1432
+ }, P), n().createElement(h.Provider, {
1469
1433
  value: Je
1470
- }, n().createElement(he, {
1434
+ }, n().createElement(ge, {
1471
1435
  index: 0,
1472
1436
  elementRef: T,
1473
1437
  label: le,
@@ -1507,7 +1471,7 @@
1507
1471
  listLabel: le
1508
1472
  }),
1509
1473
  tooltipPlacement: "right"
1510
- }))), n().createElement(he, {
1474
+ }))), n().createElement(ge, {
1511
1475
  index: 1,
1512
1476
  elementRef: $,
1513
1477
  label: oe,
@@ -1517,7 +1481,7 @@
1517
1481
  onSelectAllClick: Ue
1518
1482
  }, ce[1].options), n().createElement(C, null)));
1519
1483
  }
1520
- _e.propTypes = je;
1484
+ _e.propTypes = Pe;
1521
1485
  _e.Option = ne;
1522
1486
  /* harmony default export */ const De = _e;
1523
1487
  // CONCATENATED MODULE: ./src/DualListbox/index.ts