@splunk/react-ui 5.0.0-beta.5 → 5.0.0-rc.2
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/ButtonSimple.js +92 -168
- package/{CHANGELOG.v5.mdx → CHANGELOG.v5.md} +43 -0
- package/Calendar.js +148 -151
- package/Card.js +139 -139
- package/Code.js +197 -167
- package/CollapsiblePanel.js +172 -164
- package/Color.js +584 -506
- package/ComboBox.js +51 -51
- package/ControlGroup.js +132 -127
- package/Date.js +137 -150
- package/Dropdown.js +97 -96
- package/DualListbox.js +468 -469
- package/FetchOptions.d.ts +2 -2
- package/FormRows.js +158 -157
- package/JSONTree.js +354 -360
- package/{MIGRATION.mdx → MIGRATION.md} +13 -43
- package/{MIGRATION.v5.mdx → MIGRATION.v5.md} +67 -1
- package/Markdown.js +3 -4
- package/Menu.js +194 -195
- package/Modal.js +18 -18
- package/ModalLayer.js +171 -217
- package/Multiselect.js +785 -778
- package/Number.js +103 -102
- package/Popover.js +48 -46
- package/RadioBar.js +144 -146
- package/Resize.js +149 -151
- package/ResultsMenu.js +112 -114
- package/Search.js +49 -49
- package/Select.js +455 -457
- package/Slider.js +328 -331
- package/Switch.js +251 -178
- package/TabBar.js +277 -280
- package/Table.js +1212 -1178
- package/Text.js +45 -46
- package/Tooltip.js +192 -189
- package/Tree.js +177 -188
- package/package.json +10 -9
- package/types/src/Code/Code.d.ts +1 -1
- package/types/src/Color/Color.d.ts +2 -2
- package/types/src/ControlGroup/ControlGroup.d.ts +1 -2
- package/types/src/Dropdown/Dropdown.d.ts +5 -2
- package/types/src/Layer/Layer.d.ts +2 -1
- package/types/src/Layer/index.d.ts +1 -0
- package/types/src/ModalLayer/ModalLayer.d.ts +16 -21
- package/types/src/Number/Number.d.ts +1 -1
- package/types/src/Popover/Popover.d.ts +5 -2
- package/types/src/Table/HeadCell.d.ts +6 -1
- package/types/src/Table/HeadInner.d.ts +3 -1
- package/types/src/Tooltip/Tooltip.d.ts +7 -7
- package/types/src/fixtures/useFetchOptions.d.ts +33 -0
- package/useRovingFocus.js +20 -23
- package/types/src/fixtures/FetchOptions.d.ts +0 -76
package/ResultsMenu.js
CHANGED
|
@@ -180,7 +180,7 @@
|
|
|
180
180
|
n.r(t);
|
|
181
181
|
// EXPORTS
|
|
182
182
|
n.d(t, {
|
|
183
|
-
VirtualizedResultsMenu: () => /* reexport */
|
|
183
|
+
VirtualizedResultsMenu: () => /* reexport */ ke,
|
|
184
184
|
default: () => /* reexport */ F
|
|
185
185
|
});
|
|
186
186
|
// EXTERNAL MODULE: external "react"
|
|
@@ -268,12 +268,12 @@
|
|
|
268
268
|
}, C.apply(null, arguments);
|
|
269
269
|
}
|
|
270
270
|
function j(e, r) {
|
|
271
|
-
return x(e) || P(e, r) ||
|
|
271
|
+
return x(e) || P(e, r) || k(e, r) || R();
|
|
272
272
|
}
|
|
273
|
-
function
|
|
273
|
+
function R() {
|
|
274
274
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
275
275
|
}
|
|
276
|
-
function
|
|
276
|
+
function k(e, r) {
|
|
277
277
|
if (e) {
|
|
278
278
|
if ("string" == typeof e) return I(e, r);
|
|
279
279
|
var n = {}.toString.call(e).slice(8, -1);
|
|
@@ -355,7 +355,7 @@
|
|
|
355
355
|
var N = 400;
|
|
356
356
|
var D = 28;
|
|
357
357
|
function H(n) {
|
|
358
|
-
var t = n.animateLoading, o = n["aria-multiselectable"], a = n.children, i = n.childrenStart, c = n.elementRef, s = n.focusMode, f = n.footerMessage, v = n.isLoading, d = n.loadingMessage, m = d === void 0 ? _ : d, p = n.menuId,
|
|
358
|
+
var t = n.animateLoading, o = n["aria-multiselectable"], a = n.children, i = n.childrenStart, c = n.elementRef, s = n.focusMode, f = n.footerMessage, v = n.isLoading, d = n.loadingMessage, m = d === void 0 ? _ : d, p = n.menuId, R = n.noOptionsMessage, k = R === void 0 ? q : R, I = n.onScroll, P = n.onScrollBottom, x = n.placement, A = n.style, L = n.tabIndex, H = T(n, [ "animateLoading", "aria-multiselectable", "children", "childrenStart", "elementRef", "focusMode", "footerMessage", "isLoading", "loadingMessage", "menuId", "noOptionsMessage", "onScroll", "onScrollBottom", "placement", "style", "tabIndex" ]);
|
|
359
359
|
// @docs-props-type ResultsMenuPropsBase
|
|
360
360
|
var F = (0, e.useState)(undefined), U = j(F, 2), z = U[0], B = U[1];
|
|
361
361
|
var V = (0, e.useState)(null), K = j(V, 2), W = K[0], $ = K[1];
|
|
@@ -437,7 +437,7 @@
|
|
|
437
437
|
height: le ? ee * D : 0
|
|
438
438
|
};
|
|
439
439
|
}), [ le, ee ]);
|
|
440
|
-
var Oe = !he && !!
|
|
440
|
+
var Oe = !he && !!k && !v;
|
|
441
441
|
var we = (0, e.useCallback)((function() {
|
|
442
442
|
return {
|
|
443
443
|
role: "listbox",
|
|
@@ -475,7 +475,7 @@
|
|
|
475
475
|
}, Oe && r().createElement(S, {
|
|
476
476
|
"data-test": "no-results-message",
|
|
477
477
|
disabled: true
|
|
478
|
-
},
|
|
478
|
+
}, k), a, P && !Se &&
|
|
479
479
|
|
|
480
480
|
// Bottom spacer fills in the space of new items being loaded by using the minimum possible height x menuItems.
|
|
481
481
|
r().createElement("div", {
|
|
@@ -483,20 +483,18 @@
|
|
|
483
483
|
style: Ee
|
|
484
484
|
}), v && r().createElement(h, null, t && r().createElement(E, null), r().createElement(O, null, m)))), r().createElement(M["default"], {
|
|
485
485
|
"aria-live": "polite"
|
|
486
|
-
}, Oe &&
|
|
486
|
+
}, Oe && k), x !== "above" && Me(), x === "above" && i);
|
|
487
487
|
}
|
|
488
488
|
H.propTypes = L;
|
|
489
489
|
/* harmony default export */ const F = H;
|
|
490
490
|
// CONCATENATED MODULE: external "lodash/omit"
|
|
491
491
|
const U = require("lodash/omit");
|
|
492
492
|
var z = n.n(U);
|
|
493
|
-
// CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
|
|
494
|
-
const B = require("@splunk/ui-utils/keyboard");
|
|
495
493
|
// CONCATENATED MODULE: external "@splunk/ui-utils/focus"
|
|
496
|
-
const
|
|
494
|
+
const B = require("@splunk/ui-utils/focus");
|
|
497
495
|
// CONCATENATED MODULE: ./src/ResultsMenu/VirtualizedResultsMenu/groupChildren.ts
|
|
498
496
|
// Cheap(er than processing potentially thousands of array elements) memoization
|
|
499
|
-
var
|
|
497
|
+
var V = {
|
|
500
498
|
result: []
|
|
501
499
|
};
|
|
502
500
|
/**
|
|
@@ -513,18 +511,18 @@
|
|
|
513
511
|
* @param {number} groupSize The size of each group to be created
|
|
514
512
|
* @returns A 2d array where each inner-array is a group of size `groupSize` of children
|
|
515
513
|
* and the order of the `children` received equals the order of the flattened result
|
|
516
|
-
*/ var
|
|
517
|
-
if (
|
|
518
|
-
return
|
|
514
|
+
*/ var K = function r(n, t) {
|
|
515
|
+
if (V.children === n && V.groupSize === t) {
|
|
516
|
+
return V.result;
|
|
519
517
|
}
|
|
520
|
-
|
|
521
|
-
|
|
518
|
+
V.children = n;
|
|
519
|
+
V.groupSize = t;
|
|
522
520
|
if (t <= 1) {
|
|
523
521
|
if (false) {}
|
|
524
522
|
// don't break in non-__DEV__ and return one big group
|
|
525
|
-
|
|
523
|
+
V.result = [ e.Children.toArray(n) ];
|
|
526
524
|
} else {
|
|
527
|
-
|
|
525
|
+
V.result = e.Children.toArray(n).reduce((function(e, r, n) {
|
|
528
526
|
var o = Math.floor(n / t);
|
|
529
527
|
if (!Array.isArray(e[o])) {
|
|
530
528
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -534,18 +532,18 @@
|
|
|
534
532
|
return e;
|
|
535
533
|
}), []);
|
|
536
534
|
}
|
|
537
|
-
return
|
|
535
|
+
return V.result;
|
|
538
536
|
};
|
|
539
537
|
// CONCATENATED MODULE: external "@splunk/ui-utils/id"
|
|
540
|
-
const
|
|
538
|
+
const W = require("@splunk/ui-utils/id");
|
|
541
539
|
// CONCATENATED MODULE: ./src/ResultsMenu/VirtualizedResultsMenu/VirtualizedItem.ts
|
|
542
540
|
// This wrapper should only be used with Menu.Item/derivatives thereof, so omitting Heading/Divider is fine
|
|
543
|
-
var
|
|
541
|
+
var $ = {
|
|
544
542
|
children: a().node,
|
|
545
543
|
onMount: a().func.isRequired,
|
|
546
544
|
onUnmount: a().func.isRequired
|
|
547
545
|
};
|
|
548
|
-
/** @private Used by `VirtualizedResultsMenu` */ var
|
|
546
|
+
/** @private Used by `VirtualizedResultsMenu` */ var G = r().forwardRef((function(r, n) {
|
|
549
547
|
var t = r.children, o = r.onMount, a = r.onUnmount;
|
|
550
548
|
var i = (0, e.useRef)(null);
|
|
551
549
|
(0, e.useEffect)((function() {
|
|
@@ -572,8 +570,8 @@
|
|
|
572
570
|
}
|
|
573
571
|
});
|
|
574
572
|
}));
|
|
575
|
-
|
|
576
|
-
|
|
573
|
+
G.propTypes = $;
|
|
574
|
+
G.as = "Item";
|
|
577
575
|
// CONCATENATED MODULE: ./src/ResultsMenu/VirtualizedResultsMenu/injectVirtualizedItem.tsx
|
|
578
576
|
/**
|
|
579
577
|
* Find the index of an array element which is nearest to targetIndex and is a Menu.Item component
|
|
@@ -581,7 +579,7 @@
|
|
|
581
579
|
* @param {Number} targetIndex The target index. This is the ideal value to return.
|
|
582
580
|
* @returns The index in the array of the nearest `Menu.Item` component to `targetIndex`, or -1 if no element is a `Menu.Item` component
|
|
583
581
|
*/
|
|
584
|
-
var
|
|
582
|
+
var X = function e(r, n) {
|
|
585
583
|
var t = -1;
|
|
586
584
|
var o = -1;
|
|
587
585
|
r.forEach((function(e, r) {
|
|
@@ -601,19 +599,19 @@
|
|
|
601
599
|
* with a VirtualizedItem instance.
|
|
602
600
|
* - If `trackFirstElement` the **FIRST** non-divider/heading item will also be replaced.
|
|
603
601
|
* - If `trackLastElement` the **LAST** non-divider/heading item will also be replaced.
|
|
604
|
-
*/ var
|
|
602
|
+
*/ var J = function e(n, t, o) {
|
|
605
603
|
var a = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}, i = a.trackFirstElement, u = a.trackLastElement;
|
|
606
604
|
if (!Array.isArray(n)) {
|
|
607
605
|
return [];
|
|
608
606
|
}
|
|
609
|
-
var l =
|
|
610
|
-
var c = i &&
|
|
611
|
-
var s = u &&
|
|
607
|
+
var l = X(n, Math.floor(n.length / 2));
|
|
608
|
+
var c = i && X(n, 0);
|
|
609
|
+
var s = u && X(n, n.length - 1);
|
|
612
610
|
return n.map((function(e, n) {
|
|
613
611
|
if (n === l || n === c || n === s) {
|
|
614
612
|
|
|
615
|
-
return r().createElement(
|
|
616
|
-
key: (0,
|
|
613
|
+
return r().createElement(G, {
|
|
614
|
+
key: (0, W.createGUID)(),
|
|
617
615
|
onMount: t,
|
|
618
616
|
onUnmount: o
|
|
619
617
|
}, e);
|
|
@@ -622,16 +620,16 @@
|
|
|
622
620
|
}));
|
|
623
621
|
};
|
|
624
622
|
// CONCATENATED MODULE: ./src/ResultsMenu/VirtualizedResultsMenu/VirtualizedResultsMenu.tsx
|
|
625
|
-
function
|
|
623
|
+
function Q(e) {
|
|
626
624
|
"@babel/helpers - typeof";
|
|
627
|
-
return
|
|
625
|
+
return Q = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
|
|
628
626
|
return typeof e;
|
|
629
627
|
} : function(e) {
|
|
630
628
|
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
631
|
-
},
|
|
629
|
+
}, Q(e);
|
|
632
630
|
}
|
|
633
|
-
function
|
|
634
|
-
return
|
|
631
|
+
function Y() {
|
|
632
|
+
return Y = Object.assign ? Object.assign.bind() : function(e) {
|
|
635
633
|
for (var r = 1; r < arguments.length; r++) {
|
|
636
634
|
var n = arguments[r];
|
|
637
635
|
for (var t in n) {
|
|
@@ -639,41 +637,41 @@
|
|
|
639
637
|
}
|
|
640
638
|
}
|
|
641
639
|
return e;
|
|
642
|
-
},
|
|
640
|
+
}, Y.apply(null, arguments);
|
|
643
641
|
}
|
|
644
|
-
function
|
|
645
|
-
return
|
|
642
|
+
function Z(e) {
|
|
643
|
+
return ne(e) || re(e) || ae(e) || ee();
|
|
646
644
|
}
|
|
647
|
-
function
|
|
645
|
+
function ee() {
|
|
648
646
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
649
647
|
}
|
|
650
|
-
function
|
|
648
|
+
function re(e) {
|
|
651
649
|
if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"]) return Array.from(e);
|
|
652
650
|
}
|
|
653
|
-
function
|
|
654
|
-
if (Array.isArray(e)) return
|
|
651
|
+
function ne(e) {
|
|
652
|
+
if (Array.isArray(e)) return ie(e);
|
|
655
653
|
}
|
|
656
|
-
function
|
|
657
|
-
return
|
|
654
|
+
function te(e, r) {
|
|
655
|
+
return le(e) || ue(e, r) || ae(e, r) || oe();
|
|
658
656
|
}
|
|
659
|
-
function
|
|
657
|
+
function oe() {
|
|
660
658
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
661
659
|
}
|
|
662
|
-
function
|
|
660
|
+
function ae(e, r) {
|
|
663
661
|
if (e) {
|
|
664
|
-
if ("string" == typeof e) return
|
|
662
|
+
if ("string" == typeof e) return ie(e, r);
|
|
665
663
|
var n = {}.toString.call(e).slice(8, -1);
|
|
666
|
-
return "Object" === n && e.constructor && (n = e.constructor.name), "Map" === n || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ?
|
|
664
|
+
return "Object" === n && e.constructor && (n = e.constructor.name), "Map" === n || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? ie(e, r) : void 0;
|
|
667
665
|
}
|
|
668
666
|
}
|
|
669
|
-
function
|
|
667
|
+
function ie(e, r) {
|
|
670
668
|
(null == r || r > e.length) && (r = e.length);
|
|
671
669
|
for (var n = 0, t = Array(r); n < r; n++) {
|
|
672
670
|
t[n] = e[n];
|
|
673
671
|
}
|
|
674
672
|
return t;
|
|
675
673
|
}
|
|
676
|
-
function
|
|
674
|
+
function ue(e, r) {
|
|
677
675
|
var n = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
678
676
|
if (null != n) {
|
|
679
677
|
var t, o, a, i, u = [], l = !0, c = !1;
|
|
@@ -695,12 +693,12 @@
|
|
|
695
693
|
return u;
|
|
696
694
|
}
|
|
697
695
|
}
|
|
698
|
-
function
|
|
696
|
+
function le(e) {
|
|
699
697
|
if (Array.isArray(e)) return e;
|
|
700
698
|
}
|
|
701
|
-
function
|
|
699
|
+
function ce(e, r) {
|
|
702
700
|
if (null == e) return {};
|
|
703
|
-
var n, t, o =
|
|
701
|
+
var n, t, o = se(e, r);
|
|
704
702
|
if (Object.getOwnPropertySymbols) {
|
|
705
703
|
var a = Object.getOwnPropertySymbols(e);
|
|
706
704
|
for (t = 0; t < a.length; t++) {
|
|
@@ -709,7 +707,7 @@
|
|
|
709
707
|
}
|
|
710
708
|
return o;
|
|
711
709
|
}
|
|
712
|
-
function
|
|
710
|
+
function se(e, r) {
|
|
713
711
|
if (null == e) return {};
|
|
714
712
|
var n = {};
|
|
715
713
|
for (var t in e) {
|
|
@@ -720,7 +718,7 @@
|
|
|
720
718
|
}
|
|
721
719
|
return n;
|
|
722
720
|
}
|
|
723
|
-
function
|
|
721
|
+
function fe(e, r) {
|
|
724
722
|
var n = Object.keys(e);
|
|
725
723
|
if (Object.getOwnPropertySymbols) {
|
|
726
724
|
var t = Object.getOwnPropertySymbols(e);
|
|
@@ -730,44 +728,44 @@
|
|
|
730
728
|
}
|
|
731
729
|
return n;
|
|
732
730
|
}
|
|
733
|
-
function
|
|
731
|
+
function ve(e) {
|
|
734
732
|
for (var r = 1; r < arguments.length; r++) {
|
|
735
733
|
var n = null != arguments[r] ? arguments[r] : {};
|
|
736
|
-
r % 2 ?
|
|
737
|
-
|
|
738
|
-
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) :
|
|
734
|
+
r % 2 ? fe(Object(n), !0).forEach((function(r) {
|
|
735
|
+
de(e, r, n[r]);
|
|
736
|
+
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : fe(Object(n)).forEach((function(r) {
|
|
739
737
|
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(n, r));
|
|
740
738
|
}));
|
|
741
739
|
}
|
|
742
740
|
return e;
|
|
743
741
|
}
|
|
744
|
-
function
|
|
745
|
-
return (r =
|
|
742
|
+
function de(e, r, n) {
|
|
743
|
+
return (r = me(r)) in e ? Object.defineProperty(e, r, {
|
|
746
744
|
value: n,
|
|
747
745
|
enumerable: !0,
|
|
748
746
|
configurable: !0,
|
|
749
747
|
writable: !0
|
|
750
748
|
}) : e[r] = n, e;
|
|
751
749
|
}
|
|
752
|
-
function
|
|
753
|
-
var r =
|
|
754
|
-
return "symbol" ==
|
|
750
|
+
function me(e) {
|
|
751
|
+
var r = pe(e, "string");
|
|
752
|
+
return "symbol" == Q(r) ? r : r + "";
|
|
755
753
|
}
|
|
756
|
-
function
|
|
757
|
-
if ("object" !=
|
|
754
|
+
function pe(e, r) {
|
|
755
|
+
if ("object" != Q(e) || !e) return e;
|
|
758
756
|
var n = e[Symbol.toPrimitive];
|
|
759
757
|
if (void 0 !== n) {
|
|
760
758
|
var t = n.call(e, r || "default");
|
|
761
|
-
if ("object" !=
|
|
759
|
+
if ("object" != Q(t)) return t;
|
|
762
760
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
763
761
|
}
|
|
764
762
|
return ("string" === r ? String : Number)(e);
|
|
765
763
|
}
|
|
766
764
|
// TODO(SUI-5920): add transitions to this component in React 18
|
|
767
|
-
var
|
|
765
|
+
var be = ve(ve({}, z()(L, "onDownKeyPress", "onEndKeyPress", "onHomeKeyPress", "onUpKeyPress")), {}, {
|
|
768
766
|
virtualization: a().number
|
|
769
767
|
});
|
|
770
|
-
var
|
|
768
|
+
var ye = [];
|
|
771
769
|
/**
|
|
772
770
|
* A wrapper for `ResultsMenu` which virtualizes the `children`. The received `children` array will be split into **"panes"** each with `virtualization` entries
|
|
773
771
|
* and, at any given time, 3 or fewer of these panes will be rendered in the DOM.
|
|
@@ -786,28 +784,28 @@
|
|
|
786
784
|
* @throws in `__DEV__` when `virtualization` is too small as compared to the menu height (`virtualization` must be greater than the number of visible items in the rendered menu)
|
|
787
785
|
* @throws in `__DEV__` when `virtualization` is less than or equal to 1 (`virtualization` must be ≥ 2)
|
|
788
786
|
* @throws in `__DEV__` when `virtualization` is changed during the lifecycle of the `VirtualizedResultsMenu` component
|
|
789
|
-
*/ function
|
|
790
|
-
var t = n.virtualization, o = t === void 0 ? 2 : t, a = n.elementRef, i = n.children, u = n.focusMode, l = u === void 0 ? "normal" : u, c =
|
|
787
|
+
*/ function ge(n) {
|
|
788
|
+
var t = n.virtualization, o = t === void 0 ? 2 : t, a = n.elementRef, i = n.children, u = n.focusMode, l = u === void 0 ? "normal" : u, c = ce(n, [ "virtualization", "elementRef", "children", "focusMode" ]);
|
|
791
789
|
// @docs-props-type VirtualizedResultsMenuPropsBase
|
|
792
790
|
var s = (0, e.useRef)(o);
|
|
793
791
|
// If a user tries to set virtualization to a value smaller than the number of options
|
|
794
792
|
// visible at a given moment then the menu will flicker endlessly. This state is set in
|
|
795
793
|
// the IntersectionObserver to fix the issue, but in `__DEV__` an error is thrown.
|
|
796
|
-
var f = (0, e.useState)(o), v =
|
|
794
|
+
var f = (0, e.useState)(o), v = te(f, 2), d = v[0], m = v[1];
|
|
797
795
|
// these refs keep track of whether we need to focus the first/last
|
|
798
796
|
// element after the next render
|
|
799
797
|
var p = (0, e.useRef)(false);
|
|
800
798
|
var b = (0, e.useRef)(false);
|
|
801
799
|
var y = (0, e.useRef)(i);
|
|
802
|
-
// this code makes the "
|
|
800
|
+
// this code makes the "Home" and "End" keys work by injecting
|
|
803
801
|
// an elementRef callback function into the first and last item
|
|
804
802
|
// that will attempt to focus the first/last item if appropriate
|
|
805
803
|
// we need to do this because if we call focus() right after changePane()
|
|
806
804
|
// the new pane won't be in the DOM yet, so the wrong element will end up focused
|
|
807
805
|
(0, e.useMemo)((function() {
|
|
808
806
|
var r = e.Children.toArray(i);
|
|
809
|
-
var n =
|
|
810
|
-
var t =
|
|
807
|
+
var n = X(r, 0);
|
|
808
|
+
var t = X(r, r.length - 1);
|
|
811
809
|
y.current = r.map((function(r, o) {
|
|
812
810
|
var a = r;
|
|
813
811
|
if (o === n) {
|
|
@@ -839,8 +837,8 @@
|
|
|
839
837
|
// `useRef` will recompute its initial value every render cycle.
|
|
840
838
|
// To avoid the array processing we can provide an initialization function to useState and init the ref with the result
|
|
841
839
|
var h = (0, e.useState)((function() {
|
|
842
|
-
return
|
|
843
|
-
})), S =
|
|
840
|
+
return K(g, d);
|
|
841
|
+
})), S = te(h, 1), E = S[0];
|
|
844
842
|
// NOSONAR
|
|
845
843
|
// `windowPanes` is an array of arrays, each of length `virtualization`. Each "pane" is just a subset of
|
|
846
844
|
// `children` which will be rendered in a chunk, and at most 3 of these panes will render at any given time.
|
|
@@ -850,8 +848,8 @@
|
|
|
850
848
|
// An IntersectionObserver is used to detect when pane changes are needed.
|
|
851
849
|
// When loadPrevPaneRef or loadNextPaneRef entries intersect the menu, the currentPaneId will be updated.
|
|
852
850
|
var j = (0, e.useRef)();
|
|
853
|
-
var
|
|
854
|
-
var
|
|
851
|
+
var R = (0, e.useRef)(ye);
|
|
852
|
+
var k = (0, e.useRef)(ye);
|
|
855
853
|
var I = (0, e.useCallback)((function() {
|
|
856
854
|
var e;
|
|
857
855
|
var r = O.current, n = r === void 0 ? [] : r;
|
|
@@ -876,23 +874,23 @@
|
|
|
876
874
|
if (!r) {
|
|
877
875
|
return;
|
|
878
876
|
}
|
|
879
|
-
var t =
|
|
877
|
+
var t = k.current.indexOf(r);
|
|
880
878
|
if (t >= 0) {
|
|
881
|
-
|
|
879
|
+
k.current.splice(t, 1);
|
|
882
880
|
}
|
|
883
|
-
var o =
|
|
881
|
+
var o = R.current.indexOf(r);
|
|
884
882
|
if (o) {
|
|
885
|
-
|
|
883
|
+
R.current.splice(o, 1);
|
|
886
884
|
}
|
|
887
885
|
(n = j.current) === null || n === void 0 ? void 0 : n.unobserve(r);
|
|
888
886
|
};
|
|
889
|
-
return [].concat(
|
|
887
|
+
return [].concat(Z(J(n[t - 1], o(k), a, {
|
|
890
888
|
trackFirstElement: true
|
|
891
|
-
})),
|
|
889
|
+
})), Z((e = n[t]) !== null && e !== void 0 ? e : []), Z(J(n[t + 1], o(R), a, {
|
|
892
890
|
trackLastElement: true
|
|
893
891
|
})));
|
|
894
892
|
}), []);
|
|
895
|
-
var P = (0, e.useState)(I), x =
|
|
893
|
+
var P = (0, e.useState)(I), x = te(P, 2), T = x[0], A = x[1];
|
|
896
894
|
var L = (0, e.useCallback)((function(e) {
|
|
897
895
|
var r = M.current;
|
|
898
896
|
M.current = Math.max(0, Math.min(e, O.current.length - 1));
|
|
@@ -912,8 +910,8 @@
|
|
|
912
910
|
if (!e) {
|
|
913
911
|
return;
|
|
914
912
|
}
|
|
915
|
-
R.current = [];
|
|
916
913
|
k.current = [];
|
|
914
|
+
R.current = [];
|
|
917
915
|
// Run the observation flow
|
|
918
916
|
j.current = new IntersectionObserver((function(r) {
|
|
919
917
|
var n;
|
|
@@ -940,10 +938,10 @@
|
|
|
940
938
|
// don't process if the pane changed or the entry isn't intersecting
|
|
941
939
|
return;
|
|
942
940
|
}
|
|
943
|
-
if (
|
|
941
|
+
if (k.current.includes(e.target)) {
|
|
944
942
|
i = true;
|
|
945
943
|
L(t - 1);
|
|
946
|
-
} else if (
|
|
944
|
+
} else if (R.current.includes(e.target)) {
|
|
947
945
|
i = true;
|
|
948
946
|
L(t + 1);
|
|
949
947
|
}
|
|
@@ -958,13 +956,13 @@
|
|
|
958
956
|
return;
|
|
959
957
|
}
|
|
960
958
|
e.preventDefault();
|
|
961
|
-
var n =
|
|
962
|
-
if (n === "
|
|
959
|
+
var n = e.key;
|
|
960
|
+
if (n === "Home") {
|
|
963
961
|
var t = M.current === 0;
|
|
964
962
|
if (t) {
|
|
965
963
|
var o;
|
|
966
964
|
// if the first pane is already rendered, find the first element and focus it
|
|
967
|
-
var a = (0,
|
|
965
|
+
var a = (0, B.getSortedTabbableElements)(r, {
|
|
968
966
|
ignoreTabIndex: true
|
|
969
967
|
});
|
|
970
968
|
var i = a[0];
|
|
@@ -978,12 +976,12 @@
|
|
|
978
976
|
return;
|
|
979
977
|
}
|
|
980
978
|
var u = O.current.length - 1;
|
|
981
|
-
if (n === "
|
|
979
|
+
if (n === "End") {
|
|
982
980
|
var l = M.current === u;
|
|
983
981
|
if (l) {
|
|
984
982
|
var c;
|
|
985
983
|
// if the last pane is already rendered, find the first element and focus it
|
|
986
|
-
var s = (0,
|
|
984
|
+
var s = (0, B.getSortedTabbableElements)(r, {
|
|
987
985
|
ignoreTabIndex: true
|
|
988
986
|
});
|
|
989
987
|
var f = s[s.length - 1];
|
|
@@ -996,14 +994,14 @@
|
|
|
996
994
|
}
|
|
997
995
|
return;
|
|
998
996
|
}
|
|
999
|
-
var v = (0,
|
|
997
|
+
var v = (0, B.getSortedTabbableElements)(r, {
|
|
1000
998
|
ignoreTabIndex: true
|
|
1001
999
|
});
|
|
1002
1000
|
var d = (e === null || e === void 0 ? void 0 : e.target) instanceof Element ? e.target : null;
|
|
1003
1001
|
var m = r === null || r === void 0 ? void 0 : r.querySelector(":focus");
|
|
1004
1002
|
var y = d || m;
|
|
1005
1003
|
var g = y ? v.indexOf(y) : -1;
|
|
1006
|
-
(0,
|
|
1004
|
+
(0, B.handleFocus)(n, v, g, {
|
|
1007
1005
|
enableLoop: false,
|
|
1008
1006
|
// VirtualizedResultsMenu does not support looping focus
|
|
1009
1007
|
orientation: "vertical",
|
|
@@ -1018,7 +1016,7 @@
|
|
|
1018
1016
|
}));
|
|
1019
1017
|
}), [ o ]);
|
|
1020
1018
|
(0, e.useEffect)((function() {
|
|
1021
|
-
O.current =
|
|
1019
|
+
O.current = K(g, d);
|
|
1022
1020
|
A(I);
|
|
1023
1021
|
}), [ g, d, I ]);
|
|
1024
1022
|
(0, e.useEffect)((function() {
|
|
@@ -1040,15 +1038,15 @@
|
|
|
1040
1038
|
};
|
|
1041
1039
|
}), [ q, l ]);
|
|
1042
1040
|
|
|
1043
|
-
return r().createElement(F,
|
|
1041
|
+
return r().createElement(F, Y({
|
|
1044
1042
|
elementRef: _,
|
|
1045
1043
|
focusMode: l
|
|
1046
1044
|
}, c), T);
|
|
1047
1045
|
}
|
|
1048
|
-
|
|
1046
|
+
ge.propTypes = be;
|
|
1049
1047
|
// CONCATENATED MODULE: ./src/utils/ssrDocument.ts
|
|
1050
1048
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
1051
|
-
var
|
|
1049
|
+
var he = {
|
|
1052
1050
|
body: {
|
|
1053
1051
|
appendChild: function e() {
|
|
1054
1052
|
return [];
|
|
@@ -1102,16 +1100,16 @@
|
|
|
1102
1100
|
search: ""
|
|
1103
1101
|
}
|
|
1104
1102
|
};
|
|
1105
|
-
function
|
|
1106
|
-
var e = typeof document !== "undefined" ? document :
|
|
1103
|
+
function Se() {
|
|
1104
|
+
var e = typeof document !== "undefined" ? document : he;
|
|
1107
1105
|
return e;
|
|
1108
1106
|
}
|
|
1109
|
-
var
|
|
1110
|
-
/* harmony default export */ const
|
|
1107
|
+
var Ee = Se();
|
|
1108
|
+
/* harmony default export */ const Oe = /* unused pure expression or super */ null && Ee;
|
|
1111
1109
|
// CONCATENATED MODULE: ./src/utils/ssrWindow.ts
|
|
1112
1110
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
1113
|
-
var
|
|
1114
|
-
document:
|
|
1111
|
+
var we = {
|
|
1112
|
+
document: he,
|
|
1115
1113
|
navigator: {
|
|
1116
1114
|
userAgent: ""
|
|
1117
1115
|
},
|
|
@@ -1165,16 +1163,16 @@
|
|
|
1165
1163
|
clearTimeout(r);
|
|
1166
1164
|
}
|
|
1167
1165
|
};
|
|
1168
|
-
function
|
|
1169
|
-
var e = typeof window !== "undefined" ? window :
|
|
1166
|
+
function Me() {
|
|
1167
|
+
var e = typeof window !== "undefined" ? window : we;
|
|
1170
1168
|
return e;
|
|
1171
1169
|
}
|
|
1172
|
-
var
|
|
1173
|
-
/* harmony default export */ const
|
|
1170
|
+
var Ce = Me();
|
|
1171
|
+
/* harmony default export */ const je = /* unused pure expression or super */ null && Ce;
|
|
1174
1172
|
// CONCATENATED MODULE: ./src/ResultsMenu/VirtualizedResultsMenu/index.ts
|
|
1175
1173
|
// In environments without IntersectionObserver support this should just export ResultsMenu
|
|
1176
|
-
var Re = "IntersectionObserver" in
|
|
1177
|
-
/* harmony default export */ const
|
|
1174
|
+
var Re = "IntersectionObserver" in Me() ? ge : F;
|
|
1175
|
+
/* harmony default export */ const ke = Re;
|
|
1178
1176
|
}) // CONCATENATED MODULE: ./src/ResultsMenu/index.ts
|
|
1179
1177
|
();
|
|
1180
1178
|
module.exports = t;
|