@splunk/react-ui 5.8.0 → 5.9.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.
- package/Anchor.js +2 -1
- package/CHANGELOG.md +22 -0
- package/Calendar.js +134 -134
- package/Clickable.js +131 -94
- package/CollapsiblePanel.js +173 -135
- package/ComboBox.js +1 -0
- package/Dropdown.js +27 -18
- package/File.js +35 -35
- package/Menu.js +259 -215
- package/Modal.js +174 -181
- package/Monogram.js +2 -2
- package/Multiselect.js +401 -321
- package/Number.js +2 -1
- package/Search.js +15 -14
- package/SelectBase.js +777 -719
- package/Table.js +116 -119
- package/Text.js +26 -26
- package/docs-llm/Avatar.md +2 -8
- package/docs-llm/Multiselect.md +5 -3
- package/docs-llm/Notifications.md +46 -0
- package/docs-llm/Tree.md +7 -2
- package/docs-llm/llms.txt +6 -2
- package/package.json +4 -4
- package/types/src/Multiselect/Compact.d.ts +8 -3
- package/types/src/Multiselect/Multiselect.d.ts +8 -3
- package/types/src/Multiselect/Normal.d.ts +8 -3
- package/types/src/Multiselect/Option.d.ts +6 -3
- package/types/src/Multiselect/docs/examples/Disabled.d.ts +1 -0
- package/types/src/SelectBase/SelectBase.d.ts +1 -1
package/Multiselect.js
CHANGED
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
Divider: () => /* reexport */ u.Divider,
|
|
65
65
|
Heading: () => /* reexport */ u.Heading,
|
|
66
66
|
Option: () => /* reexport */ h,
|
|
67
|
-
default: () => /* reexport */
|
|
67
|
+
default: () => /* reexport */ cn
|
|
68
68
|
});
|
|
69
69
|
// CONCATENATED MODULE: external "react"
|
|
70
70
|
const r = require("react");
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
compact: i().bool,
|
|
130
130
|
description: i().string,
|
|
131
131
|
descriptionPosition: i().oneOf([ "right", "bottom" ]),
|
|
132
|
-
disabled: i().bool,
|
|
132
|
+
disabled: i().oneOfType([ i().bool, i().oneOf([ "dimmed", "disabled" ]) ]),
|
|
133
133
|
/**
|
|
134
134
|
* @private Undocumented due to limitations in supporting in compact `Multiselect` (see SUI-8286 notes for more info).
|
|
135
135
|
*/
|
|
@@ -243,7 +243,7 @@
|
|
|
243
243
|
defaultPlacement: i().oneOf([ "above", "below", "vertical" ]),
|
|
244
244
|
defaultValues: i().array,
|
|
245
245
|
describedBy: i().string,
|
|
246
|
-
disabled: i().bool,
|
|
246
|
+
disabled: i().oneOfType([ i().bool, i().oneOf([ "dimmed", "disabled" ]) ]),
|
|
247
247
|
elementRef: i().oneOfType([ i().func, i().object ]),
|
|
248
248
|
error: i().bool,
|
|
249
249
|
filter: i().oneOf([ false, true, "controlled" ]),
|
|
@@ -276,11 +276,11 @@
|
|
|
276
276
|
virtualization: i().number
|
|
277
277
|
};
|
|
278
278
|
// TS: not typed controlled/uncontrolled, handled by Multiselect wrapper component
|
|
279
|
-
var
|
|
279
|
+
var V = {};
|
|
280
280
|
var E = (0, d._)("No matches");
|
|
281
|
-
var
|
|
282
|
-
function
|
|
283
|
-
var n = e.allowNewValues, o = e.animateLoading, a = e.append, l = e.children, i = e.controlledFilter, u = e.defaultPlacement, s = u === void 0 ? "vertical" : u, c = e.defaultValues, d = e.describedBy, v = e.disabled, b = e.elementRef, m = e.error, g = e.filter, y = e.footerMessage, h = e.inline, O = e.inputId, w = e.inputRef, S = e.isLoadingOptions, k = e.labelledBy, j = e.loadingMessage,
|
|
281
|
+
var N = (0, d._)("Select...");
|
|
282
|
+
function x(e) {
|
|
283
|
+
var n = e.allowNewValues, o = e.animateLoading, a = e.append, l = e.children, i = e.controlledFilter, u = e.defaultPlacement, s = u === void 0 ? "vertical" : u, c = e.defaultValues, d = e.describedBy, v = e.disabled, b = e.elementRef, m = e.error, g = e.filter, y = e.footerMessage, h = e.inline, O = e.inputId, w = e.inputRef, S = e.isLoadingOptions, k = e.labelledBy, j = e.loadingMessage, x = e.menuStyle, B = x === void 0 ? V : x, R = e.name, I = e.noOptionsMessage, F = I === void 0 ? E : I, q = e.onChange, A = e.onClose, D = e.onFilterChange, L = e.onOpen, T = e.onScroll, _ = e.onScrollBottom, H = e.placeholder, $ = H === void 0 ? N : H, z = e.prepend, K = e.repositionMode, W = e.selectAllAppearance, U = e.showSelectedValuesFirst, G = U === void 0 ? "nextOpen" : U, X = e.tabConfirmsNewValue, J = e.values, Q = e.virtualization, Y = P(e, [ "allowNewValues", "animateLoading", "append", "children", "controlledFilter", "defaultPlacement", "defaultValues", "describedBy", "disabled", "elementRef", "error", "filter", "footerMessage", "inline", "inputId", "inputRef", "isLoadingOptions", "labelledBy", "loadingMessage", "menuStyle", "name", "noOptionsMessage", "onChange", "onClose", "onFilterChange", "onOpen", "onScroll", "onScrollBottom", "placeholder", "prepend", "repositionMode", "selectAllAppearance", "showSelectedValuesFirst", "tabConfirmsNewValue", "values", "virtualization" ]);
|
|
284
284
|
// @docs-props-type CompactPropsBase
|
|
285
285
|
C({
|
|
286
286
|
componentName: "Multiselect",
|
|
@@ -338,9 +338,9 @@
|
|
|
338
338
|
loadingMessage: j,
|
|
339
339
|
menuStyle: B,
|
|
340
340
|
name: R,
|
|
341
|
-
noOptionsMessage:
|
|
342
|
-
onChange:
|
|
343
|
-
onClose:
|
|
341
|
+
noOptionsMessage: F,
|
|
342
|
+
onChange: q,
|
|
343
|
+
onClose: A,
|
|
344
344
|
onFilterChange: D,
|
|
345
345
|
onOpen: L,
|
|
346
346
|
onScroll: T,
|
|
@@ -356,20 +356,20 @@
|
|
|
356
356
|
multiple: true
|
|
357
357
|
}));
|
|
358
358
|
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
/* harmony default export */ const B =
|
|
359
|
+
x.propTypes = j;
|
|
360
|
+
x.Option = h;
|
|
361
|
+
x.Divider = u.Divider;
|
|
362
|
+
x.Heading = u.Heading;
|
|
363
|
+
/* harmony default export */ const B = x;
|
|
364
364
|
// CONCATENATED MODULE: external "lodash/defer"
|
|
365
365
|
const R = require("lodash/defer");
|
|
366
366
|
var I = e.n(R);
|
|
367
367
|
// CONCATENATED MODULE: external "lodash/get"
|
|
368
|
-
const
|
|
369
|
-
var
|
|
368
|
+
const F = require("lodash/get");
|
|
369
|
+
var q = e.n(F);
|
|
370
370
|
// CONCATENATED MODULE: external "lodash/isString"
|
|
371
|
-
const
|
|
372
|
-
var D = e.n(
|
|
371
|
+
const A = require("lodash/isString");
|
|
372
|
+
var D = e.n(A);
|
|
373
373
|
// CONCATENATED MODULE: external "lodash/keys"
|
|
374
374
|
const L = require("lodash/keys");
|
|
375
375
|
var T = e.n(L);
|
|
@@ -454,9 +454,51 @@
|
|
|
454
454
|
de.pick)({
|
|
455
455
|
compact: (0, ae.css)([ "padding-block:2px;" ])
|
|
456
456
|
}), de.variables.focusShadowInset);
|
|
457
|
+
// CONCATENATED MODULE: ./src/utils/disabled.ts
|
|
458
|
+
/**
|
|
459
|
+
* Normalizes the disabled prop and returns both the boolean state and normalized string value.
|
|
460
|
+
* Use this function to ensure consistent handling of disabled prop across components.
|
|
461
|
+
*
|
|
462
|
+
* @param disabled - The disabled prop value
|
|
463
|
+
* @param defaultWhenBooleanTrue - Optional normalization override for disabled={true}
|
|
464
|
+
* @returns Object with isDisabled boolean|undefined and disabledValue string
|
|
465
|
+
*
|
|
466
|
+
* TODO (SUI-8600): `disabled` prop should default to 'dimmed' for data entry components
|
|
467
|
+
*/
|
|
468
|
+
function me(e) {
|
|
469
|
+
var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "dimmed";
|
|
470
|
+
if (e === "dimmed") {
|
|
471
|
+
return {
|
|
472
|
+
isDisabled: true,
|
|
473
|
+
disabledValue: "dimmed"
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
if (e === true) {
|
|
477
|
+
return {
|
|
478
|
+
isDisabled: true,
|
|
479
|
+
disabledValue: n
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
if (e === "disabled") {
|
|
483
|
+
return {
|
|
484
|
+
isDisabled: true,
|
|
485
|
+
disabledValue: "disabled"
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
if (e === false) {
|
|
489
|
+
return {
|
|
490
|
+
isDisabled: false,
|
|
491
|
+
disabledValue: undefined
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
return {
|
|
495
|
+
isDisabled: undefined,
|
|
496
|
+
disabledValue: undefined
|
|
497
|
+
};
|
|
498
|
+
}
|
|
457
499
|
// CONCATENATED MODULE: ./src/utils/ssrDocument.ts
|
|
458
500
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
459
|
-
var
|
|
501
|
+
var ge = {
|
|
460
502
|
body: {
|
|
461
503
|
appendChild: function e() {
|
|
462
504
|
return [];
|
|
@@ -510,12 +552,12 @@
|
|
|
510
552
|
search: ""
|
|
511
553
|
}
|
|
512
554
|
};
|
|
513
|
-
function
|
|
514
|
-
var e = typeof document !== "undefined" ? document :
|
|
555
|
+
function ye() {
|
|
556
|
+
var e = typeof document !== "undefined" ? document : ge;
|
|
515
557
|
return e;
|
|
516
558
|
}
|
|
517
|
-
var
|
|
518
|
-
/* harmony default export */ const
|
|
559
|
+
var he = ye();
|
|
560
|
+
/* harmony default export */ const Oe = /* unused pure expression or super */ null && he;
|
|
519
561
|
// CONCATENATED MODULE: ./src/utils/updateReactRef.ts
|
|
520
562
|
/**
|
|
521
563
|
* Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
|
|
@@ -523,7 +565,7 @@
|
|
|
523
565
|
* @param ref - The React callback or object ref. Can be `null` or `undefined`.
|
|
524
566
|
* @param current - The new value of the ref.
|
|
525
567
|
*/
|
|
526
|
-
function
|
|
568
|
+
function we(e, n) {
|
|
527
569
|
if (e) {
|
|
528
570
|
if (typeof e === "function") {
|
|
529
571
|
e(n);
|
|
@@ -536,16 +578,16 @@
|
|
|
536
578
|
}
|
|
537
579
|
}
|
|
538
580
|
// CONCATENATED MODULE: ./src/Multiselect/Normal.tsx
|
|
539
|
-
function
|
|
581
|
+
function Se(e) {
|
|
540
582
|
"@babel/helpers - typeof";
|
|
541
|
-
return
|
|
583
|
+
return Se = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
|
|
542
584
|
return typeof e;
|
|
543
585
|
} : function(e) {
|
|
544
586
|
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
545
|
-
},
|
|
587
|
+
}, Se(e);
|
|
546
588
|
}
|
|
547
|
-
function
|
|
548
|
-
return
|
|
589
|
+
function Ce() {
|
|
590
|
+
return Ce = Object.assign ? Object.assign.bind() : function(e) {
|
|
549
591
|
for (var n = 1; n < arguments.length; n++) {
|
|
550
592
|
var r = arguments[n];
|
|
551
593
|
for (var t in r) {
|
|
@@ -553,27 +595,27 @@
|
|
|
553
595
|
}
|
|
554
596
|
}
|
|
555
597
|
return e;
|
|
556
|
-
},
|
|
598
|
+
}, Ce.apply(null, arguments);
|
|
557
599
|
}
|
|
558
|
-
function
|
|
559
|
-
return
|
|
600
|
+
function Me(e) {
|
|
601
|
+
return je(e) || ke(e) || Ne(e) || Pe();
|
|
560
602
|
}
|
|
561
|
-
function
|
|
603
|
+
function Pe() {
|
|
562
604
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
563
605
|
}
|
|
564
|
-
function
|
|
606
|
+
function ke(e) {
|
|
565
607
|
if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"]) return Array.from(e);
|
|
566
608
|
}
|
|
567
|
-
function
|
|
609
|
+
function je(e) {
|
|
568
610
|
if (Array.isArray(e)) return xe(e);
|
|
569
611
|
}
|
|
570
|
-
function
|
|
571
|
-
return
|
|
612
|
+
function Ve(e, n) {
|
|
613
|
+
return Re(e) || Be(e, n) || Ne(e, n) || Ee();
|
|
572
614
|
}
|
|
573
|
-
function
|
|
615
|
+
function Ee() {
|
|
574
616
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
575
617
|
}
|
|
576
|
-
function
|
|
618
|
+
function Ne(e, n) {
|
|
577
619
|
if (e) {
|
|
578
620
|
if ("string" == typeof e) return xe(e, n);
|
|
579
621
|
var r = {}.toString.call(e).slice(8, -1);
|
|
@@ -587,7 +629,7 @@
|
|
|
587
629
|
}
|
|
588
630
|
return t;
|
|
589
631
|
}
|
|
590
|
-
function
|
|
632
|
+
function Be(e, n) {
|
|
591
633
|
var r = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
592
634
|
if (null != r) {
|
|
593
635
|
var t, o, a, l, i = [], u = !0, s = !1;
|
|
@@ -609,12 +651,12 @@
|
|
|
609
651
|
return i;
|
|
610
652
|
}
|
|
611
653
|
}
|
|
612
|
-
function
|
|
654
|
+
function Re(e) {
|
|
613
655
|
if (Array.isArray(e)) return e;
|
|
614
656
|
}
|
|
615
|
-
function
|
|
657
|
+
function Ie(e, n) {
|
|
616
658
|
if (null == e) return {};
|
|
617
|
-
var r, t, o =
|
|
659
|
+
var r, t, o = Fe(e, n);
|
|
618
660
|
if (Object.getOwnPropertySymbols) {
|
|
619
661
|
var a = Object.getOwnPropertySymbols(e);
|
|
620
662
|
for (t = 0; t < a.length; t++) {
|
|
@@ -623,7 +665,7 @@
|
|
|
623
665
|
}
|
|
624
666
|
return o;
|
|
625
667
|
}
|
|
626
|
-
function
|
|
668
|
+
function Fe(e, n) {
|
|
627
669
|
if (null == e) return {};
|
|
628
670
|
var r = {};
|
|
629
671
|
for (var t in e) {
|
|
@@ -634,7 +676,7 @@
|
|
|
634
676
|
}
|
|
635
677
|
return r;
|
|
636
678
|
}
|
|
637
|
-
function
|
|
679
|
+
function qe(e, n) {
|
|
638
680
|
var r = Object.keys(e);
|
|
639
681
|
if (Object.getOwnPropertySymbols) {
|
|
640
682
|
var t = Object.getOwnPropertySymbols(e);
|
|
@@ -644,40 +686,40 @@
|
|
|
644
686
|
}
|
|
645
687
|
return r;
|
|
646
688
|
}
|
|
647
|
-
function
|
|
689
|
+
function Ae(e) {
|
|
648
690
|
for (var n = 1; n < arguments.length; n++) {
|
|
649
691
|
var r = null != arguments[n] ? arguments[n] : {};
|
|
650
|
-
n % 2 ?
|
|
651
|
-
|
|
652
|
-
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) :
|
|
692
|
+
n % 2 ? qe(Object(r), !0).forEach((function(n) {
|
|
693
|
+
De(e, n, r[n]);
|
|
694
|
+
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : qe(Object(r)).forEach((function(n) {
|
|
653
695
|
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
|
|
654
696
|
}));
|
|
655
697
|
}
|
|
656
698
|
return e;
|
|
657
699
|
}
|
|
658
|
-
function
|
|
659
|
-
return (n =
|
|
700
|
+
function De(e, n, r) {
|
|
701
|
+
return (n = Le(n)) in e ? Object.defineProperty(e, n, {
|
|
660
702
|
value: r,
|
|
661
703
|
enumerable: !0,
|
|
662
704
|
configurable: !0,
|
|
663
705
|
writable: !0
|
|
664
706
|
}) : e[n] = r, e;
|
|
665
707
|
}
|
|
666
|
-
function
|
|
667
|
-
var n =
|
|
668
|
-
return "symbol" ==
|
|
708
|
+
function Le(e) {
|
|
709
|
+
var n = Te(e, "string");
|
|
710
|
+
return "symbol" == Se(n) ? n : n + "";
|
|
669
711
|
}
|
|
670
|
-
function
|
|
671
|
-
if ("object" !=
|
|
712
|
+
function Te(e, n) {
|
|
713
|
+
if ("object" != Se(e) || !e) return e;
|
|
672
714
|
var r = e[Symbol.toPrimitive];
|
|
673
715
|
if (void 0 !== r) {
|
|
674
716
|
var t = r.call(e, n || "default");
|
|
675
|
-
if ("object" !=
|
|
717
|
+
if ("object" != Se(t)) return t;
|
|
676
718
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
677
719
|
}
|
|
678
720
|
return ("string" === n ? String : Number)(e);
|
|
679
721
|
}
|
|
680
|
-
var
|
|
722
|
+
var _e = {
|
|
681
723
|
allowNewValues: i().bool,
|
|
682
724
|
animateLoading: i().bool,
|
|
683
725
|
append: i().bool,
|
|
@@ -686,7 +728,7 @@
|
|
|
686
728
|
defaultPlacement: i().oneOf([ "above", "below", "vertical" ]),
|
|
687
729
|
defaultValues: i().array,
|
|
688
730
|
describedBy: i().string,
|
|
689
|
-
disabled: i().bool,
|
|
731
|
+
disabled: i().oneOfType([ i().bool, i().oneOf([ "dimmed", "disabled" ]) ]),
|
|
690
732
|
elementRef: i().oneOfType([ i().func, i().object ]),
|
|
691
733
|
error: i().bool,
|
|
692
734
|
footerMessage: i().node,
|
|
@@ -713,27 +755,31 @@
|
|
|
713
755
|
tabConfirmsNewValue: i().bool,
|
|
714
756
|
values: i().array
|
|
715
757
|
};
|
|
716
|
-
var
|
|
758
|
+
var He = H()((function(e) {
|
|
717
759
|
return {
|
|
718
760
|
flexBasis: e,
|
|
719
761
|
width: e
|
|
720
762
|
};
|
|
721
763
|
}));
|
|
722
764
|
// export for testing purpose
|
|
723
|
-
var
|
|
765
|
+
var $e = H()((function(e) {
|
|
724
766
|
var n = e.anchorWidth, r = n === void 0 ? 0 : n, t = e.maxHeight, o = e.menuStyle;
|
|
725
|
-
return
|
|
767
|
+
return Ae({
|
|
726
768
|
maxHeight: t,
|
|
727
769
|
overflow: "auto",
|
|
728
770
|
width: Math.max(r, 200)
|
|
729
771
|
}, o || {});
|
|
730
772
|
}));
|
|
731
773
|
// TS: not typed controlled/uncontrolled, handled by Multiselect wrapper component
|
|
732
|
-
var
|
|
733
|
-
var
|
|
734
|
-
var
|
|
735
|
-
function
|
|
736
|
-
var
|
|
774
|
+
var ze = {};
|
|
775
|
+
var Ke = (0, d._)("No matches");
|
|
776
|
+
var We = (0, d._)("Select...");
|
|
777
|
+
var Ue = function e(n) {
|
|
778
|
+
var r = me(n, "disabled"), t = r.isDisabled;
|
|
779
|
+
return !!t;
|
|
780
|
+
};
|
|
781
|
+
function Ge(e) {
|
|
782
|
+
var n = e.allowNewValues, o = e.animateLoading, l = e.append, i = e.children, u = e.controlledFilter, s = e.defaultPlacement, f = s === void 0 ? "vertical" : s, p = e.defaultValues, v = e.describedBy, b = e.disabled, m = e.elementRef, g = e.error, y = e.footerMessage, O = e.inline, w = e.inputId, S = e.inputRef, C = e.isLoadingOptions, M = e.labelledBy, P = e.loadingMessage, k = e.menuStyle, j = k === void 0 ? ze : k, V = e.name, E = e.noOptionsMessage, N = E === void 0 ? Ke : E, x = e.onChange, B = e.onClose, R = e.onFilterChange, F = e.onScroll, A = e.onScrollBottom, L = e.onOpen, _ = e.placeholder, H = _ === void 0 ? We : _, $ = e.prepend, K = e.required, U = e.repositionMode, X = e.tabConfirmsNewValue, Q = e.values, Z = Ie(e, [ "allowNewValues", "animateLoading", "append", "children", "controlledFilter", "defaultPlacement", "defaultValues", "describedBy", "disabled", "elementRef", "error", "footerMessage", "inline", "inputId", "inputRef", "isLoadingOptions", "labelledBy", "loadingMessage", "menuStyle", "name", "noOptionsMessage", "onChange", "onClose", "onFilterChange", "onScroll", "onScrollBottom", "onOpen", "placeholder", "prepend", "required", "repositionMode", "tabConfirmsNewValue", "values" ]);
|
|
737
783
|
// @docs-props-type NormalPropsBase
|
|
738
784
|
var ae = c()({
|
|
739
785
|
componentName: "Multiselect",
|
|
@@ -744,30 +790,42 @@
|
|
|
744
790
|
valuePropName: "values"
|
|
745
791
|
});
|
|
746
792
|
if (false) {}
|
|
747
|
-
var le = (0, r.useState)(0), ie =
|
|
748
|
-
var ce = (0, r.useState)(null), de =
|
|
749
|
-
var
|
|
750
|
-
var
|
|
751
|
-
var
|
|
752
|
-
var
|
|
753
|
-
var
|
|
754
|
-
var
|
|
755
|
-
var
|
|
756
|
-
var
|
|
757
|
-
|
|
793
|
+
var le = (0, r.useState)(0), ie = Ve(le, 2), ue = ie[0], se = ie[1];
|
|
794
|
+
var ce = (0, r.useState)(null), de = Ve(ce, 2), ge = de[0], he = de[1];
|
|
795
|
+
var Oe = (0, r.useState)(""), Se = Ve(Oe, 2), Pe = Se[0], ke = Se[1];
|
|
796
|
+
var je = (0, r.useState)(false), Ee = Ve(je, 2), Ne = Ee[0], xe = Ee[1];
|
|
797
|
+
var Be = (0, r.useState)(false), Re = Ve(Be, 2), Fe = Re[0], qe = Re[1];
|
|
798
|
+
var De = (0, r.useState)(p || []), Le = Ve(De, 2), Te = Le[0], _e = Le[1];
|
|
799
|
+
var Ge = (0, r.useState)(""), Xe = Ve(Ge, 2), Je = Xe[0], Qe = Xe[1];
|
|
800
|
+
var Ye = ae && Q ? Q : Te;
|
|
801
|
+
var Ze = Ye.indexOf(Pe) >= 0;
|
|
802
|
+
var en = me(b, "disabled"), nn = en.isDisabled, rn = en.disabledValue;
|
|
803
|
+
var tn = (0, r.useMemo)((function() {
|
|
804
|
+
return r.Children.toArray(i);
|
|
805
|
+
}), [ i ]);
|
|
806
|
+
var on = (0, r.useMemo)((function() {
|
|
807
|
+
return tn.filter(r.isValidElement).filter((function(e) {
|
|
808
|
+
return e.type === h;
|
|
809
|
+
}));
|
|
810
|
+
}), [ tn ]);
|
|
811
|
+
var an = (0, r.useMemo)((function() {
|
|
812
|
+
var e = new Map;
|
|
813
|
+
on.forEach((function(n) {
|
|
814
|
+
e.set(n.props.value, n);
|
|
815
|
+
}));
|
|
816
|
+
return [ e ];
|
|
817
|
+
}), [ on ]), ln = Ve(an, 1), un = ln[0];
|
|
818
|
+
var sn = (0, r.useMemo)((function() {
|
|
819
|
+
var e = Ye.slice(0);
|
|
758
820
|
var n = new Set;
|
|
759
821
|
// Map Options to selected values
|
|
760
|
-
if (
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
e[t] = r;
|
|
768
|
-
if (r.props.disabled) {
|
|
769
|
-
n.add(r.props.value);
|
|
770
|
-
}
|
|
822
|
+
if (Ye.length) {
|
|
823
|
+
on.forEach((function(r) {
|
|
824
|
+
var t = Ye.indexOf(r.props.value);
|
|
825
|
+
if (t !== -1) {
|
|
826
|
+
e[t] = r;
|
|
827
|
+
if (Ue(r.props.disabled)) {
|
|
828
|
+
n.add(r.props.value);
|
|
771
829
|
}
|
|
772
830
|
}
|
|
773
831
|
}));
|
|
@@ -776,226 +834,244 @@
|
|
|
776
834
|
selectedItems: e,
|
|
777
835
|
disabledSelectedItems: n
|
|
778
836
|
};
|
|
779
|
-
}), [
|
|
780
|
-
var
|
|
781
|
-
var
|
|
782
|
-
var
|
|
783
|
-
var
|
|
784
|
-
var
|
|
837
|
+
}), [ on, Ye ]), cn = sn.selectedItems, dn = sn.disabledSelectedItems;
|
|
838
|
+
var fn = (0, r.useRef)(null);
|
|
839
|
+
var pn = (0, r.useRef)(null);
|
|
840
|
+
var vn = (0, r.useRef)(undefined);
|
|
841
|
+
var bn = (0, r.useRef)(0);
|
|
842
|
+
var mn = (0, r.useState)((function() {
|
|
785
843
|
return {
|
|
786
844
|
activeItemId: (0, te.createDOMID)("active-item"),
|
|
787
845
|
popoverId: (0, te.createDOMID)("popover")
|
|
788
846
|
};
|
|
789
|
-
})),
|
|
847
|
+
})), gn = Ve(mn, 1), yn = gn[0], hn = yn.activeItemId, On = yn.popoverId;
|
|
790
848
|
(0, r.useEffect)((function() {
|
|
791
849
|
if (ae) {
|
|
792
|
-
|
|
850
|
+
ke("");
|
|
793
851
|
se(0);
|
|
794
852
|
}
|
|
795
853
|
}), [ Q, ae ]);
|
|
796
854
|
// Tracks the prev activeIndex so its known if scrolling is needed in handleActiveOptionMount - can't use usePrevious b/c the value needs wiped on Menu close
|
|
797
855
|
(0, r.useEffect)((function() {
|
|
798
|
-
|
|
856
|
+
pn.current = ue;
|
|
799
857
|
}), [ ue ]);
|
|
800
|
-
var
|
|
858
|
+
var wn = (0, r.useCallback)((function(e) {
|
|
801
859
|
var n = e.resetFilterKeyword;
|
|
802
|
-
if (!
|
|
803
|
-
|
|
860
|
+
if (!Fe) {
|
|
861
|
+
ke((function(e) {
|
|
804
862
|
return n ? "" : e;
|
|
805
863
|
}));
|
|
806
864
|
xe(true);
|
|
807
|
-
|
|
865
|
+
qe(true);
|
|
808
866
|
L === null || L === void 0 ? void 0 : L();
|
|
809
867
|
}
|
|
810
|
-
}), [
|
|
811
|
-
var
|
|
812
|
-
if (
|
|
813
|
-
|
|
868
|
+
}), [ Fe, L ]);
|
|
869
|
+
var Sn = (0, r.useCallback)((function() {
|
|
870
|
+
if (Ne) {
|
|
871
|
+
wn({
|
|
814
872
|
resetFilterKeyword: false
|
|
815
873
|
});
|
|
816
874
|
} else {
|
|
817
875
|
var e;
|
|
818
|
-
(e =
|
|
876
|
+
(e = fn.current) === null || e === void 0 ? void 0 : e.focus();
|
|
819
877
|
}
|
|
820
|
-
}), [
|
|
821
|
-
var
|
|
822
|
-
if (!
|
|
878
|
+
}), [ Ne, wn ]);
|
|
879
|
+
var Cn = (0, r.useCallback)((function(e, n) {
|
|
880
|
+
if (!Fe || nn) {
|
|
823
881
|
return;
|
|
824
882
|
}
|
|
825
|
-
var r = (
|
|
883
|
+
var r = (Ye || []).concat([ n ]);
|
|
826
884
|
if (!ae) {
|
|
827
|
-
|
|
885
|
+
_e(r);
|
|
828
886
|
se(0);
|
|
829
|
-
|
|
830
|
-
|
|
887
|
+
qe(true);
|
|
888
|
+
ke("");
|
|
831
889
|
}
|
|
832
|
-
|
|
890
|
+
x === null || x === void 0 ? void 0 : x(e, {
|
|
833
891
|
values: r,
|
|
834
|
-
name:
|
|
892
|
+
name: V
|
|
835
893
|
});
|
|
836
|
-
}), [
|
|
837
|
-
var
|
|
838
|
-
var r = G()(
|
|
894
|
+
}), [ Fe, nn, Ye, ae, x, V ]);
|
|
895
|
+
var Mn = (0, r.useCallback)((function(e, n) {
|
|
896
|
+
var r = G()(Ye, n);
|
|
839
897
|
if (!ae) {
|
|
840
|
-
|
|
898
|
+
_e(r);
|
|
841
899
|
}
|
|
842
|
-
|
|
900
|
+
x === null || x === void 0 ? void 0 : x(e, {
|
|
843
901
|
values: r,
|
|
844
|
-
name:
|
|
902
|
+
name: V
|
|
845
903
|
});
|
|
846
|
-
}), [
|
|
847
|
-
var
|
|
848
|
-
if (
|
|
849
|
-
|
|
850
|
-
|
|
904
|
+
}), [ Ye, ae, V, x ]);
|
|
905
|
+
var Pn = (0, r.useCallback)((function(e) {
|
|
906
|
+
if (Fe && !C) {
|
|
907
|
+
A === null || A === void 0 ? void 0 : A(e);
|
|
908
|
+
Qe("".concat(bn.current, " options, loading more options"));
|
|
851
909
|
}
|
|
852
|
-
}), [
|
|
853
|
-
var
|
|
910
|
+
}), [ Fe, C, A ]);
|
|
911
|
+
var kn = (0, r.useCallback)((function(e, n) {
|
|
854
912
|
var r = n.value;
|
|
855
913
|
I()((function() {
|
|
856
|
-
return
|
|
914
|
+
return Mn(e, r);
|
|
857
915
|
}));
|
|
858
|
-
}), [
|
|
859
|
-
var
|
|
860
|
-
|
|
916
|
+
}), [ Mn ]);
|
|
917
|
+
var jn = (0, r.useCallback)((function(e) {
|
|
918
|
+
xe(true);
|
|
919
|
+
if (nn) {
|
|
920
|
+
return;
|
|
921
|
+
}
|
|
922
|
+
if (Pe !== "") {
|
|
861
923
|
R === null || R === void 0 ? void 0 : R(e, {
|
|
862
924
|
keyword: ""
|
|
863
925
|
});
|
|
864
926
|
}
|
|
865
|
-
|
|
927
|
+
wn({
|
|
866
928
|
resetFilterKeyword: true
|
|
867
929
|
});
|
|
868
|
-
}), [
|
|
869
|
-
var
|
|
930
|
+
}), [ nn, Pe, R, wn ]);
|
|
931
|
+
var Vn = (0, r.useCallback)((function(e) {
|
|
870
932
|
var n;
|
|
871
|
-
var
|
|
872
|
-
var
|
|
873
|
-
if (
|
|
874
|
-
|
|
875
|
-
|
|
933
|
+
var r = bn.current;
|
|
934
|
+
var t = e.key;
|
|
935
|
+
if (nn) {
|
|
936
|
+
return;
|
|
937
|
+
}
|
|
938
|
+
var o = vn.current === undefined ? undefined : un.get(vn.current);
|
|
939
|
+
var a = Ue(o === null || o === void 0 ? void 0 : o.props.disabled);
|
|
940
|
+
if (t === "Tab" && Fe) {
|
|
941
|
+
if (!a && X && vn.current !== undefined && bn.current <= 1) {
|
|
942
|
+
var l;
|
|
876
943
|
e.preventDefault();
|
|
877
|
-
|
|
878
|
-
(
|
|
944
|
+
Cn(e, vn.current);
|
|
945
|
+
(l = fn.current) === null || l === void 0 ? void 0 : l.focus();
|
|
879
946
|
} else {
|
|
880
|
-
|
|
947
|
+
qe(false);
|
|
881
948
|
}
|
|
882
949
|
}
|
|
883
950
|
if (e.shiftKey || e.metaKey || e.ctrlKey) {
|
|
884
951
|
return;
|
|
885
952
|
}
|
|
886
|
-
if (
|
|
953
|
+
if (t === "End" && Fe) {
|
|
887
954
|
e.preventDefault();
|
|
888
|
-
if (
|
|
889
|
-
se(
|
|
955
|
+
if (r > 0) {
|
|
956
|
+
se(r - 1);
|
|
890
957
|
}
|
|
891
958
|
}
|
|
892
|
-
if (
|
|
959
|
+
if (t === "Home" && Fe) {
|
|
893
960
|
e.preventDefault();
|
|
894
961
|
se(0);
|
|
895
962
|
}
|
|
896
|
-
if (
|
|
963
|
+
if (t === "ArrowDown") {
|
|
897
964
|
e.preventDefault();
|
|
898
|
-
if (
|
|
899
|
-
if (
|
|
965
|
+
if (Fe) {
|
|
966
|
+
if (r > 0) {
|
|
900
967
|
se((function(e) {
|
|
901
|
-
return Math.min(e + 1,
|
|
968
|
+
return Math.min(e + 1, r - 1);
|
|
902
969
|
}));
|
|
903
970
|
}
|
|
904
971
|
} else {
|
|
905
972
|
se(0);
|
|
906
|
-
|
|
973
|
+
qe(true);
|
|
907
974
|
}
|
|
908
|
-
if (i &&
|
|
909
|
-
var
|
|
910
|
-
if (ue ===
|
|
911
|
-
|
|
975
|
+
if (i && A) {
|
|
976
|
+
var u = tn.length - (2 + ((Ye === null || Ye === void 0 ? void 0 : Ye.length) || 0));
|
|
977
|
+
if (ue === u) {
|
|
978
|
+
Pn(e);
|
|
912
979
|
}
|
|
913
980
|
}
|
|
914
981
|
}
|
|
915
|
-
if (
|
|
982
|
+
if (t === "ArrowUp") {
|
|
916
983
|
e.preventDefault();
|
|
917
|
-
if (
|
|
984
|
+
if (Fe) {
|
|
918
985
|
se((function(e) {
|
|
919
986
|
return Math.max(e - 1, 0);
|
|
920
987
|
}));
|
|
921
988
|
} else {
|
|
922
989
|
se(0);
|
|
923
|
-
|
|
990
|
+
qe(true);
|
|
924
991
|
}
|
|
925
992
|
}
|
|
926
|
-
if (
|
|
927
|
-
|
|
993
|
+
if (t === "Enter" && !a && vn.current !== undefined && Fe) {
|
|
994
|
+
e.preventDefault();
|
|
995
|
+
Cn(e, vn.current);
|
|
928
996
|
}
|
|
929
|
-
if (
|
|
930
|
-
var
|
|
931
|
-
for (var
|
|
932
|
-
var
|
|
933
|
-
if (!
|
|
934
|
-
|
|
997
|
+
if (t === "Backspace" && ((n = fn.current) === null || n === void 0 ? void 0 : n.value) === "" && Ye.length) {
|
|
998
|
+
var s;
|
|
999
|
+
for (var c = Ye.length - 1; c >= 0; c -= 1) {
|
|
1000
|
+
var d = Ye[c];
|
|
1001
|
+
if (!dn.has(d)) {
|
|
1002
|
+
s = d;
|
|
935
1003
|
break;
|
|
936
1004
|
}
|
|
937
1005
|
}
|
|
938
|
-
if (
|
|
939
|
-
|
|
1006
|
+
if (s !== undefined) {
|
|
1007
|
+
Mn(e, s);
|
|
940
1008
|
}
|
|
941
1009
|
}
|
|
942
|
-
}), [
|
|
943
|
-
var
|
|
944
|
-
|
|
945
|
-
|
|
1010
|
+
}), [ nn, Fe, Ye, X, Cn, i, un, tn, A, ue, Pn, dn, Mn ]);
|
|
1011
|
+
var En = (0, r.useCallback)((function(e) {
|
|
1012
|
+
ke(e.target.value);
|
|
1013
|
+
qe(true);
|
|
946
1014
|
se(0);
|
|
947
1015
|
R === null || R === void 0 ? void 0 : R(e, {
|
|
948
1016
|
keyword: e.target.value
|
|
949
1017
|
});
|
|
950
1018
|
}), [ R ]);
|
|
951
|
-
var
|
|
1019
|
+
var Nn = (0, r.useCallback)((function(e, n) {
|
|
952
1020
|
var r;
|
|
953
1021
|
var t = n.value;
|
|
954
1022
|
e.stopPropagation();
|
|
955
|
-
|
|
956
|
-
(r =
|
|
957
|
-
}), [
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
1023
|
+
Cn(e, t);
|
|
1024
|
+
(r = fn.current) === null || r === void 0 ? void 0 : r.focus();
|
|
1025
|
+
}), [ Cn ]);
|
|
1026
|
+
// Close when component becomes disabled/dimmed during an open state to prevent further selection
|
|
1027
|
+
(0, r.useEffect)((function() {
|
|
1028
|
+
if (nn && Fe) {
|
|
1029
|
+
qe(false);
|
|
1030
|
+
pn.current = null;
|
|
1031
|
+
B === null || B === void 0 ? void 0 : B();
|
|
1032
|
+
}
|
|
1033
|
+
}), [ nn, Fe, B ]);
|
|
1034
|
+
var xn = (0, r.useCallback)((function(e) {
|
|
1035
|
+
var n = ye();
|
|
1036
|
+
var r = n.getElementById(On);
|
|
961
1037
|
var t = e.relatedTarget || n.activeElement;
|
|
962
1038
|
// IE11 doesn't support relatedTarget but sets activeElement
|
|
963
1039
|
var o = r && t && r.contains(t);
|
|
964
1040
|
// TS: target as Node is an unsafe assumption
|
|
965
|
-
|
|
1041
|
+
ke(o ? Pe : "");
|
|
966
1042
|
xe(false);
|
|
967
|
-
if (!o) {
|
|
1043
|
+
if (!nn && !o) {
|
|
968
1044
|
R === null || R === void 0 ? void 0 : R(e, {
|
|
969
1045
|
keyword: ""
|
|
970
1046
|
});
|
|
971
1047
|
}
|
|
972
|
-
}), [
|
|
973
|
-
var
|
|
1048
|
+
}), [ nn, Pe, R, On ]);
|
|
1049
|
+
var Bn = (0, r.useCallback)((function(e) {
|
|
974
1050
|
var n = e.reason, r = e.event;
|
|
975
|
-
if (n === "escapeKey" || n === "offScreen" || n === "clickAway" && r !== undefined && !(
|
|
976
|
-
|
|
977
|
-
|
|
1051
|
+
if (n === "escapeKey" || n === "offScreen" || n === "clickAway" && r !== undefined && !(ge === null || ge === void 0 ? void 0 : ge.contains(r.target))) {
|
|
1052
|
+
qe(false);
|
|
1053
|
+
pn.current = null;
|
|
978
1054
|
B === null || B === void 0 ? void 0 : B();
|
|
979
1055
|
}
|
|
980
1056
|
if (n === "escapeKey") {
|
|
981
1057
|
var t;
|
|
982
|
-
(t =
|
|
1058
|
+
(t = fn.current) === null || t === void 0 ? void 0 : t.focus();
|
|
983
1059
|
}
|
|
984
|
-
}), [
|
|
985
|
-
var
|
|
986
|
-
|
|
987
|
-
|
|
1060
|
+
}), [ ge, B ]);
|
|
1061
|
+
var Rn = (0, r.useCallback)((function(e) {
|
|
1062
|
+
he(e);
|
|
1063
|
+
we(m, e);
|
|
988
1064
|
}), [ m ]);
|
|
989
|
-
var
|
|
990
|
-
|
|
991
|
-
|
|
1065
|
+
var In = (0, r.useCallback)((function(e) {
|
|
1066
|
+
fn.current = e;
|
|
1067
|
+
we(S, e);
|
|
992
1068
|
}), [ S ]);
|
|
993
|
-
var
|
|
994
|
-
if (
|
|
1069
|
+
var Fn = (0, r.useCallback)((function(e) {
|
|
1070
|
+
if (pn.current !== ue) {
|
|
995
1071
|
(0, oe.scrollIntoViewIfNeeded)(e);
|
|
996
1072
|
}
|
|
997
1073
|
}), [ ue ]);
|
|
998
|
-
var
|
|
1074
|
+
var qn = (0, r.useCallback)((function(e) {
|
|
999
1075
|
// selectedOptions may contain items or unmatched values at this point
|
|
1000
1076
|
return e.map((function(e) {
|
|
1001
1077
|
var n = e;
|
|
@@ -1006,11 +1082,11 @@
|
|
|
1006
1082
|
|
|
1007
1083
|
return t().createElement(be, {
|
|
1008
1084
|
"aria-selected": true,
|
|
1009
|
-
disabled: !!
|
|
1085
|
+
disabled: !!nn || Ue(r.disabled),
|
|
1010
1086
|
icon: a,
|
|
1011
1087
|
key: c.toString(),
|
|
1012
1088
|
"data-test": "selected-option",
|
|
1013
|
-
onRequestRemove:
|
|
1089
|
+
onRequestRemove: kn,
|
|
1014
1090
|
role: "option",
|
|
1015
1091
|
value: c,
|
|
1016
1092
|
appearance: i,
|
|
@@ -1021,16 +1097,16 @@
|
|
|
1021
1097
|
|
|
1022
1098
|
return t().createElement(be, {
|
|
1023
1099
|
"aria-selected": true,
|
|
1024
|
-
disabled:
|
|
1100
|
+
disabled: nn,
|
|
1025
1101
|
key: (0, te.createGUID)(),
|
|
1026
1102
|
"data-test": "selected-option",
|
|
1027
|
-
onRequestRemove:
|
|
1103
|
+
onRequestRemove: kn,
|
|
1028
1104
|
role: "option",
|
|
1029
1105
|
value: n
|
|
1030
1106
|
}, n);
|
|
1031
1107
|
}));
|
|
1032
|
-
}), [
|
|
1033
|
-
var
|
|
1108
|
+
}), [ nn, kn ]);
|
|
1109
|
+
var An = function e(n) {
|
|
1034
1110
|
return n.map((function(e) {
|
|
1035
1111
|
var n = e;
|
|
1036
1112
|
// TS: faking props here
|
|
@@ -1048,17 +1124,17 @@
|
|
|
1048
1124
|
}));
|
|
1049
1125
|
};
|
|
1050
1126
|
// Filter the items
|
|
1051
|
-
var
|
|
1052
|
-
var
|
|
1053
|
-
if (
|
|
1054
|
-
return (0, ne.testPhrase)(e.props.label,
|
|
1127
|
+
var Dn = (0, ne.stringToKeywords)(Pe);
|
|
1128
|
+
var Ln = u ? tn : tn.filter((function(e) {
|
|
1129
|
+
if (q()(e, [ "props", "label" ], false)) {
|
|
1130
|
+
return (0, ne.testPhrase)(e.props.label, Dn);
|
|
1055
1131
|
}
|
|
1056
1132
|
return true;
|
|
1057
1133
|
// Keep all headers and non-interactive options
|
|
1058
1134
|
}));
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
var
|
|
1135
|
+
bn.current = 0;
|
|
1136
|
+
vn.current = undefined;
|
|
1137
|
+
var Tn = r.Children.map(Ln, (function(e, n) {
|
|
1062
1138
|
var t = e.props;
|
|
1063
1139
|
if (!t || !a()(t, "value")) {
|
|
1064
1140
|
// ignore Headings and Dividers
|
|
@@ -1067,22 +1143,22 @@
|
|
|
1067
1143
|
var o = e;
|
|
1068
1144
|
var l = o.props, i = l.children, s = l.label, c = l.matchRanges, d = l.value;
|
|
1069
1145
|
// find out if the search string exactly matches a value
|
|
1070
|
-
if (d ===
|
|
1071
|
-
|
|
1146
|
+
if (d === Pe) {
|
|
1147
|
+
Ze = true;
|
|
1072
1148
|
}
|
|
1073
1149
|
// remove items that are already selected
|
|
1074
|
-
var f =
|
|
1150
|
+
var f = Ye.indexOf(d);
|
|
1075
1151
|
if (f >= 0) {
|
|
1076
1152
|
return null;
|
|
1077
1153
|
}
|
|
1078
1154
|
// highlight matched text
|
|
1079
1155
|
var p = i === undefined || D()(i);
|
|
1080
|
-
var v = p && !u && !c &&
|
|
1156
|
+
var v = p && !u && !c && Dn && (0, ne.keywordLocations)(s, Dn);
|
|
1081
1157
|
// clone item
|
|
1082
1158
|
var b = (0, r.cloneElement)(o, {
|
|
1083
1159
|
// eslint-disable-next-line react/no-array-index-key
|
|
1084
1160
|
key: n,
|
|
1085
|
-
onClick:
|
|
1161
|
+
onClick: Nn,
|
|
1086
1162
|
matchRanges: p && (c || v) || undefined
|
|
1087
1163
|
});
|
|
1088
1164
|
return b;
|
|
@@ -1090,47 +1166,48 @@
|
|
|
1090
1166
|
return e !== null;
|
|
1091
1167
|
})) || [];
|
|
1092
1168
|
// Add the option to add the new value
|
|
1093
|
-
if (n && !
|
|
1094
|
-
|
|
1095
|
-
label: "".concat(
|
|
1169
|
+
if (n && !Ze && Pe) {
|
|
1170
|
+
Tn.unshift( t().createElement(h, {
|
|
1171
|
+
label: "".concat(Pe),
|
|
1096
1172
|
description: (0, d._)("(New value)"),
|
|
1097
1173
|
descriptionPosition: "right",
|
|
1098
|
-
value:
|
|
1174
|
+
value: Pe,
|
|
1099
1175
|
key: "newValue",
|
|
1100
|
-
onClick:
|
|
1176
|
+
onClick: Nn
|
|
1101
1177
|
}));
|
|
1102
1178
|
}
|
|
1103
1179
|
// highlight the selected Item
|
|
1104
|
-
var
|
|
1180
|
+
var _n = r.Children.map(Tn, (function(e) {
|
|
1105
1181
|
var n = e.props;
|
|
1106
1182
|
if (!n || !a()(n, "value")) {
|
|
1107
1183
|
// ignore Headings and Dividers
|
|
1108
1184
|
return e;
|
|
1109
1185
|
}
|
|
1110
1186
|
var t = e;
|
|
1111
|
-
var o = t.props
|
|
1112
|
-
|
|
1187
|
+
var o = t.props.value;
|
|
1188
|
+
var l = me(t.props.disabled, "disabled"), i = l.disabledValue;
|
|
1189
|
+
if (i === "disabled") {
|
|
1113
1190
|
return t;
|
|
1114
1191
|
}
|
|
1115
|
-
var u =
|
|
1116
|
-
|
|
1192
|
+
var u = bn.current === ue;
|
|
1193
|
+
bn.current += 1;
|
|
1117
1194
|
if (!u) {
|
|
1118
1195
|
return t;
|
|
1119
1196
|
}
|
|
1120
|
-
|
|
1197
|
+
vn.current = o;
|
|
1121
1198
|
var s = (0, r.cloneElement)(t, {
|
|
1122
1199
|
active: u,
|
|
1123
|
-
id:
|
|
1200
|
+
id: hn,
|
|
1124
1201
|
elementRef: function e(n) {
|
|
1125
|
-
|
|
1126
|
-
|
|
1202
|
+
Fn(n);
|
|
1203
|
+
we(t.props.elementRef, n);
|
|
1127
1204
|
}
|
|
1128
1205
|
});
|
|
1129
1206
|
return s;
|
|
1130
1207
|
}));
|
|
1131
|
-
var
|
|
1208
|
+
var Hn = function e(n) {
|
|
1132
1209
|
var r = n.anchorWidth, a = n.maxHeight, l = n.placement;
|
|
1133
|
-
var i =
|
|
1210
|
+
var i = $e({
|
|
1134
1211
|
anchorWidth: r,
|
|
1135
1212
|
maxHeight: a,
|
|
1136
1213
|
menuStyle: j
|
|
@@ -1140,106 +1217,109 @@
|
|
|
1140
1217
|
focusMode: "never",
|
|
1141
1218
|
placement: l !== null && l !== void 0 ? l : undefined,
|
|
1142
1219
|
isLoading: C,
|
|
1143
|
-
onScrollBottom:
|
|
1144
|
-
noOptionsMessage:
|
|
1220
|
+
onScrollBottom: A ? Pn : undefined,
|
|
1221
|
+
noOptionsMessage: N,
|
|
1145
1222
|
footerMessage: y,
|
|
1146
1223
|
animateLoading: o,
|
|
1147
1224
|
loadingMessage: P,
|
|
1148
|
-
onScroll:
|
|
1225
|
+
onScroll: F,
|
|
1149
1226
|
style: i
|
|
1150
|
-
},
|
|
1227
|
+
}, _n);
|
|
1151
1228
|
};
|
|
1152
|
-
var
|
|
1153
|
-
var
|
|
1229
|
+
var $n = He("".concat(Pe.length * .8, "em"));
|
|
1230
|
+
var zn = Ae(Ae({}, W()(Z, (function(e, n) {
|
|
1154
1231
|
return n === "role" || n.indexOf("aria-") === 0;
|
|
1155
1232
|
}))), {}, {
|
|
1156
1233
|
"aria-describedby": v,
|
|
1157
1234
|
"aria-labelledby": M,
|
|
1158
1235
|
"aria-invalid": g || undefined
|
|
1159
1236
|
});
|
|
1160
|
-
var
|
|
1237
|
+
var Kn = Ae({}, W()(Z, (function(e, n) {
|
|
1161
1238
|
return n === "aria-label" || n === "aria-describedby";
|
|
1162
1239
|
})));
|
|
1163
1240
|
|
|
1164
|
-
return t().createElement(t().Fragment, null, t().createElement(fe,
|
|
1241
|
+
return t().createElement(t().Fragment, null, t().createElement(fe, Ce({
|
|
1165
1242
|
key: "control",
|
|
1166
1243
|
$append: l,
|
|
1167
|
-
"data-test-values": JSON.stringify(
|
|
1168
|
-
"data-test-disabled":
|
|
1244
|
+
"data-test-values": JSON.stringify(Ye),
|
|
1245
|
+
"data-test-disabled": rn,
|
|
1169
1246
|
inline: O,
|
|
1170
|
-
$hasFocus:
|
|
1171
|
-
}, z().apply(void 0, [ Z ].concat(
|
|
1172
|
-
onClick:
|
|
1173
|
-
$disabled:
|
|
1247
|
+
$hasFocus: Ne
|
|
1248
|
+
}, z().apply(void 0, [ Z ].concat(Me(T()(zn)))), {
|
|
1249
|
+
onClick: nn ? undefined : Sn,
|
|
1250
|
+
$disabled: nn,
|
|
1174
1251
|
$error: g,
|
|
1175
|
-
"data-test-popover-id":
|
|
1176
|
-
$popoverOpen:
|
|
1252
|
+
"data-test-popover-id": On,
|
|
1253
|
+
$popoverOpen: Fe,
|
|
1177
1254
|
$prepend: $,
|
|
1178
1255
|
flex: true,
|
|
1179
|
-
ref:
|
|
1256
|
+
ref: Rn,
|
|
1180
1257
|
role: "group",
|
|
1181
|
-
"aria-disabled":
|
|
1258
|
+
"aria-disabled": nn || undefined,
|
|
1182
1259
|
"aria-labelledby": M
|
|
1183
|
-
},
|
|
1260
|
+
}, Kn), t().createElement(pe, {
|
|
1184
1261
|
role: "listbox",
|
|
1185
1262
|
"aria-invalid": g,
|
|
1186
1263
|
"aria-multiselectable": "true"
|
|
1187
|
-
},
|
|
1264
|
+
}, qn(cn)), t().createElement(ve, Ce({
|
|
1188
1265
|
role: "combobox",
|
|
1189
1266
|
"data-test": "textbox",
|
|
1190
1267
|
id: w,
|
|
1191
|
-
ref:
|
|
1192
|
-
onBlur:
|
|
1193
|
-
onFocus:
|
|
1194
|
-
onChange:
|
|
1195
|
-
onKeyDown:
|
|
1196
|
-
value:
|
|
1268
|
+
ref: In,
|
|
1269
|
+
onBlur: xn,
|
|
1270
|
+
onFocus: jn,
|
|
1271
|
+
onChange: nn ? undefined : En,
|
|
1272
|
+
onKeyDown: nn ? undefined : Vn,
|
|
1273
|
+
value: Pe,
|
|
1197
1274
|
autoCapitalize: "off",
|
|
1198
1275
|
autoComplete: "off",
|
|
1199
1276
|
autoCorrect: "off",
|
|
1200
1277
|
spellCheck: false,
|
|
1201
|
-
|
|
1202
|
-
|
|
1278
|
+
readOnly: !!nn,
|
|
1279
|
+
style: $n,
|
|
1280
|
+
placeholder: Ye.length ? "" : H,
|
|
1203
1281
|
required: K,
|
|
1204
|
-
|
|
1282
|
+
disabled: rn === "disabled",
|
|
1283
|
+
"aria-disabled": rn === "dimmed" || undefined,
|
|
1284
|
+
"aria-activedescendant": Fe && bn.current > 0 ? hn : undefined,
|
|
1205
1285
|
"aria-autocomplete": "list",
|
|
1206
|
-
"aria-controls":
|
|
1207
|
-
"aria-owns":
|
|
1208
|
-
"aria-expanded":
|
|
1286
|
+
"aria-controls": Fe ? On : undefined,
|
|
1287
|
+
"aria-owns": Fe ? On : undefined,
|
|
1288
|
+
"aria-expanded": Fe,
|
|
1209
1289
|
"aria-haspopup": true
|
|
1210
|
-
},
|
|
1211
|
-
open:
|
|
1290
|
+
}, zn)), t().createElement(J(), {
|
|
1291
|
+
open: Fe && !!ge,
|
|
1212
1292
|
autoCloseWhenOffScreen: true,
|
|
1213
|
-
anchor:
|
|
1214
|
-
onRequestClose:
|
|
1293
|
+
anchor: ge,
|
|
1294
|
+
onRequestClose: Bn,
|
|
1215
1295
|
canCoverAnchor: false,
|
|
1216
1296
|
defaultPlacement: f,
|
|
1217
1297
|
repositionMode: U,
|
|
1218
|
-
id:
|
|
1219
|
-
},
|
|
1298
|
+
id: On
|
|
1299
|
+
}, Hn)), t().createElement(ee(), {
|
|
1220
1300
|
role: "status",
|
|
1221
1301
|
"aria-relevant": "text"
|
|
1222
|
-
},
|
|
1302
|
+
}, Je), t().createElement(ee(), {
|
|
1223
1303
|
role: "alert",
|
|
1224
1304
|
"aria-relevant": "additions"
|
|
1225
|
-
},
|
|
1305
|
+
}, An(cn)));
|
|
1226
1306
|
}
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
/* harmony default export */ const
|
|
1307
|
+
Ge.propTypes = _e;
|
|
1308
|
+
Ge.Option = h;
|
|
1309
|
+
Ge.Divider = u.Divider;
|
|
1310
|
+
Ge.Heading = u.Heading;
|
|
1311
|
+
/* harmony default export */ const Xe = Ge;
|
|
1232
1312
|
// CONCATENATED MODULE: ./src/Multiselect/Multiselect.tsx
|
|
1233
|
-
function
|
|
1313
|
+
function Je(e) {
|
|
1234
1314
|
"@babel/helpers - typeof";
|
|
1235
|
-
return
|
|
1315
|
+
return Je = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
|
|
1236
1316
|
return typeof e;
|
|
1237
1317
|
} : function(e) {
|
|
1238
1318
|
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
1239
|
-
},
|
|
1319
|
+
}, Je(e);
|
|
1240
1320
|
}
|
|
1241
|
-
function
|
|
1242
|
-
return
|
|
1321
|
+
function Qe() {
|
|
1322
|
+
return Qe = Object.assign ? Object.assign.bind() : function(e) {
|
|
1243
1323
|
for (var n = 1; n < arguments.length; n++) {
|
|
1244
1324
|
var r = arguments[n];
|
|
1245
1325
|
for (var t in r) {
|
|
@@ -1247,9 +1327,9 @@
|
|
|
1247
1327
|
}
|
|
1248
1328
|
}
|
|
1249
1329
|
return e;
|
|
1250
|
-
},
|
|
1330
|
+
}, Qe.apply(null, arguments);
|
|
1251
1331
|
}
|
|
1252
|
-
function
|
|
1332
|
+
function Ye(e, n) {
|
|
1253
1333
|
var r = Object.keys(e);
|
|
1254
1334
|
if (Object.getOwnPropertySymbols) {
|
|
1255
1335
|
var t = Object.getOwnPropertySymbols(e);
|
|
@@ -1259,42 +1339,42 @@
|
|
|
1259
1339
|
}
|
|
1260
1340
|
return r;
|
|
1261
1341
|
}
|
|
1262
|
-
function
|
|
1342
|
+
function Ze(e) {
|
|
1263
1343
|
for (var n = 1; n < arguments.length; n++) {
|
|
1264
1344
|
var r = null != arguments[n] ? arguments[n] : {};
|
|
1265
|
-
n % 2 ?
|
|
1266
|
-
|
|
1267
|
-
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) :
|
|
1345
|
+
n % 2 ? Ye(Object(r), !0).forEach((function(n) {
|
|
1346
|
+
en(e, n, r[n]);
|
|
1347
|
+
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : Ye(Object(r)).forEach((function(n) {
|
|
1268
1348
|
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
|
|
1269
1349
|
}));
|
|
1270
1350
|
}
|
|
1271
1351
|
return e;
|
|
1272
1352
|
}
|
|
1273
|
-
function
|
|
1274
|
-
return (n =
|
|
1353
|
+
function en(e, n, r) {
|
|
1354
|
+
return (n = nn(n)) in e ? Object.defineProperty(e, n, {
|
|
1275
1355
|
value: r,
|
|
1276
1356
|
enumerable: !0,
|
|
1277
1357
|
configurable: !0,
|
|
1278
1358
|
writable: !0
|
|
1279
1359
|
}) : e[n] = r, e;
|
|
1280
1360
|
}
|
|
1281
|
-
function
|
|
1282
|
-
var n =
|
|
1283
|
-
return "symbol" ==
|
|
1361
|
+
function nn(e) {
|
|
1362
|
+
var n = rn(e, "string");
|
|
1363
|
+
return "symbol" == Je(n) ? n : n + "";
|
|
1284
1364
|
}
|
|
1285
|
-
function
|
|
1286
|
-
if ("object" !=
|
|
1365
|
+
function rn(e, n) {
|
|
1366
|
+
if ("object" != Je(e) || !e) return e;
|
|
1287
1367
|
var r = e[Symbol.toPrimitive];
|
|
1288
1368
|
if (void 0 !== r) {
|
|
1289
1369
|
var t = r.call(e, n || "default");
|
|
1290
|
-
if ("object" !=
|
|
1370
|
+
if ("object" != Je(t)) return t;
|
|
1291
1371
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1292
1372
|
}
|
|
1293
1373
|
return ("string" === n ? String : Number)(e);
|
|
1294
1374
|
}
|
|
1295
|
-
function
|
|
1375
|
+
function tn(e, n) {
|
|
1296
1376
|
if (null == e) return {};
|
|
1297
|
-
var r, t, o =
|
|
1377
|
+
var r, t, o = on(e, n);
|
|
1298
1378
|
if (Object.getOwnPropertySymbols) {
|
|
1299
1379
|
var a = Object.getOwnPropertySymbols(e);
|
|
1300
1380
|
for (t = 0; t < a.length; t++) {
|
|
@@ -1303,7 +1383,7 @@
|
|
|
1303
1383
|
}
|
|
1304
1384
|
return o;
|
|
1305
1385
|
}
|
|
1306
|
-
function
|
|
1386
|
+
function on(e, n) {
|
|
1307
1387
|
if (null == e) return {};
|
|
1308
1388
|
var r = {};
|
|
1309
1389
|
for (var t in e) {
|
|
@@ -1316,7 +1396,7 @@
|
|
|
1316
1396
|
}
|
|
1317
1397
|
/** @public */
|
|
1318
1398
|
/** @public */
|
|
1319
|
-
/** @public */ var
|
|
1399
|
+
/** @public */ var an = {
|
|
1320
1400
|
allowNewValues: i().bool,
|
|
1321
1401
|
animateLoading: i().bool,
|
|
1322
1402
|
append: i().bool,
|
|
@@ -1326,7 +1406,7 @@
|
|
|
1326
1406
|
defaultPlacement: i().oneOf([ "above", "below", "vertical" ]),
|
|
1327
1407
|
defaultValues: i().array,
|
|
1328
1408
|
describedBy: i().string,
|
|
1329
|
-
disabled: i().bool,
|
|
1409
|
+
disabled: i().oneOfType([ i().bool, i().oneOf([ "dimmed", "disabled" ]) ]),
|
|
1330
1410
|
elementRef: i().oneOfType([ i().func, i().object ]),
|
|
1331
1411
|
error: i().bool,
|
|
1332
1412
|
filter: i().oneOf([ false, true, "controlled" ]),
|
|
@@ -1358,10 +1438,10 @@
|
|
|
1358
1438
|
/** @private */
|
|
1359
1439
|
virtualization: i().number
|
|
1360
1440
|
};
|
|
1361
|
-
var
|
|
1362
|
-
var
|
|
1363
|
-
function
|
|
1364
|
-
var n = e.allowNewValues, o = e.animateLoading, a = e.append, l = e.compact, i = e.children, u = e.controlledFilter, s = e.defaultPlacement, d = s === void 0 ? "vertical" : s, f = e.defaultValues, p = e.describedBy, v = e.disabled, b = e.elementRef, m = e.error, g = e.filter, y = e.footerMessage, h = e.inline, O = e.inputId, w = e.inputRef, S = e.isLoadingOptions, C = e.labelledBy, M = e.loadingMessage, P = e.menuStyle, k = e.name, j = e.noOptionsMessage,
|
|
1441
|
+
var ln = (0, d._)("No matches");
|
|
1442
|
+
var un = (0, d._)("Select...");
|
|
1443
|
+
function sn(e) {
|
|
1444
|
+
var n = e.allowNewValues, o = e.animateLoading, a = e.append, l = e.compact, i = e.children, u = e.controlledFilter, s = e.defaultPlacement, d = s === void 0 ? "vertical" : s, f = e.defaultValues, p = e.describedBy, v = e.disabled, b = e.elementRef, m = e.error, g = e.filter, y = e.footerMessage, h = e.inline, O = e.inputId, w = e.inputRef, S = e.isLoadingOptions, C = e.labelledBy, M = e.loadingMessage, P = e.menuStyle, k = e.name, j = e.noOptionsMessage, V = j === void 0 ? ln : j, E = e.onChange, N = e.onClose, x = e.onFilterChange, R = e.onOpen, I = e.onScroll, F = e.onScrollBottom, q = e.placeholder, A = q === void 0 ? un : q, D = e.prepend, L = e.repositionMode, T = L === void 0 ? "flip" : L, _ = e.selectAllAppearance, H = e.showSelectedValuesFirst, $ = e.tabConfirmsNewValue, z = e.values, K = e.virtualization, W = tn(e, [ "allowNewValues", "animateLoading", "append", "compact", "children", "controlledFilter", "defaultPlacement", "defaultValues", "describedBy", "disabled", "elementRef", "error", "filter", "footerMessage", "inline", "inputId", "inputRef", "isLoadingOptions", "labelledBy", "loadingMessage", "menuStyle", "name", "noOptionsMessage", "onChange", "onClose", "onFilterChange", "onOpen", "onScroll", "onScrollBottom", "placeholder", "prepend", "repositionMode", "selectAllAppearance", "showSelectedValuesFirst", "tabConfirmsNewValue", "values", "virtualization" ]);
|
|
1365
1445
|
// @docs-props-type MultiselectPropsBase
|
|
1366
1446
|
var U = c()({
|
|
1367
1447
|
componentName: "Multiselect",
|
|
@@ -1380,7 +1460,7 @@
|
|
|
1380
1460
|
}), [ l, G ]);
|
|
1381
1461
|
// Compact uses Button, which defaults `inline` to true, explicitly pass a boolean to prevent the underlying Button from applying its default.
|
|
1382
1462
|
var X = !!h;
|
|
1383
|
-
var J =
|
|
1463
|
+
var J = Ze({
|
|
1384
1464
|
allowNewValues: n,
|
|
1385
1465
|
animateLoading: o,
|
|
1386
1466
|
append: a,
|
|
@@ -1400,14 +1480,14 @@
|
|
|
1400
1480
|
loadingMessage: M,
|
|
1401
1481
|
menuStyle: P,
|
|
1402
1482
|
name: k,
|
|
1403
|
-
noOptionsMessage:
|
|
1404
|
-
onClose:
|
|
1483
|
+
noOptionsMessage: V,
|
|
1484
|
+
onClose: N,
|
|
1405
1485
|
onChange: E,
|
|
1406
|
-
onFilterChange:
|
|
1486
|
+
onFilterChange: x,
|
|
1407
1487
|
onOpen: R,
|
|
1408
1488
|
onScroll: I,
|
|
1409
|
-
onScrollBottom:
|
|
1410
|
-
placeholder:
|
|
1489
|
+
onScrollBottom: F,
|
|
1490
|
+
placeholder: A,
|
|
1411
1491
|
prepend: D,
|
|
1412
1492
|
repositionMode: T,
|
|
1413
1493
|
showSelectedValuesFirst: H,
|
|
@@ -1435,22 +1515,22 @@
|
|
|
1435
1515
|
};
|
|
1436
1516
|
if (l) {
|
|
1437
1517
|
|
|
1438
|
-
return t().createElement(B,
|
|
1518
|
+
return t().createElement(B, Qe({
|
|
1439
1519
|
"data-test": "multiselect"
|
|
1440
1520
|
}, Z, ee, J));
|
|
1441
1521
|
}
|
|
1442
1522
|
|
|
1443
|
-
return t().createElement(
|
|
1523
|
+
return t().createElement(Xe, Qe({
|
|
1444
1524
|
"data-test": "multiselect"
|
|
1445
1525
|
}, Z, J));
|
|
1446
1526
|
}
|
|
1447
1527
|
// TODO: SUI-3402, this can be removed when ControlGroup no longer needs to inspect componentType
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
/* harmony default export */ const
|
|
1528
|
+
sn.componentType = "Multiselect";
|
|
1529
|
+
sn.Option = h;
|
|
1530
|
+
sn.Heading = u.Heading;
|
|
1531
|
+
sn.Divider = u.Divider;
|
|
1532
|
+
sn.propTypes = an;
|
|
1533
|
+
/* harmony default export */ const cn = sn;
|
|
1454
1534
|
// CONCATENATED MODULE: ./src/Multiselect/index.ts
|
|
1455
1535
|
module.exports = n;
|
|
1456
1536
|
/******/})();
|