@splunk/react-ui 5.0.0-beta.4 → 5.0.0-beta.5
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/Button.js +3 -1
- package/CHANGELOG.md +4 -1
- package/CHANGELOG.v5.mdx +35 -0
- package/Card.js +163 -162
- package/Chip.js +171 -225
- package/Clickable.js +79 -76
- package/ComboBox.js +1 -1
- package/Date.js +160 -184
- package/DualListbox.js +439 -504
- package/File.js +449 -324
- package/FormRows.js +143 -142
- package/JSONTree.js +496 -521
- package/Layer.js +162 -97
- package/Link.js +20 -13
- package/MIGRATION.v5.mdx +47 -0
- package/Markdown.js +1 -1
- package/Message.js +119 -141
- package/MessageBar.js +109 -168
- package/Multiselect.js +595 -602
- package/Popover.js +194 -190
- package/Progress.js +68 -54
- package/RadioBar.js +4 -1
- package/RadioList.js +67 -65
- package/Resize.js +377 -265
- package/ResultsMenu.js +573 -661
- package/ScrollContainerContext.js +13 -9
- package/Search.js +1 -1
- package/Select.js +206 -199
- package/Slider.js +455 -329
- package/StepBar.js +2 -2
- package/Switch.js +88 -87
- package/TabBar.js +322 -317
- package/TabLayout.js +34 -34
- package/Table.js +548 -525
- package/Text.js +20 -19
- package/TextArea.js +278 -152
- package/Tooltip.js +173 -177
- package/Tree.js +2 -2
- package/Typography.js +30 -28
- package/WaitSpinner.js +6 -11
- package/cypress/support/commands.ts +14 -4
- package/cypress/support/index.d.ts +1 -1
- package/package.json +5 -5
- package/stubs-splunkui.d.ts +0 -4
- package/types/src/Card/Card.d.ts +3 -1
- package/types/src/Card/Header.d.ts +2 -0
- package/types/src/Card/docs/examples/HeadingTitle.d.ts +3 -0
- package/types/src/Clickable/Clickable.d.ts +11 -3
- package/types/src/Link/Link.d.ts +4 -0
- package/types/src/Message/Message.d.ts +1 -1
- package/types/src/MessageBar/MessageBar.d.ts +1 -1
- package/types/src/Multiselect/Multiselect.d.ts +1 -8
- package/types/src/Multiselect/Normal.d.ts +1 -7
- package/types/src/Multiselect/docs/examples/Children.d.ts +2 -9
- package/types/src/Multiselect/docs/examples/Controlled.d.ts +2 -9
- package/types/src/Multiselect/docs/examples/CustomizeSelected.d.ts +2 -9
- package/types/src/Multiselect/docs/examples/Disabled.d.ts +2 -9
- package/types/src/Multiselect/docs/examples/Error.d.ts +2 -9
- package/types/src/Multiselect/docs/examples/Fetching.d.ts +2 -22
- package/types/src/Multiselect/docs/examples/Headings.d.ts +2 -1
- package/types/src/Multiselect/docs/examples/LoadMoreOnScrollBottom.d.ts +2 -25
- package/types/src/Multiselect/docs/examples/NewValues.d.ts +2 -9
- package/types/src/Multiselect/docs/examples/TabInput.d.ts +2 -9
- package/types/src/ResultsMenu/ResultsMenu.d.ts +23 -34
- package/types/src/Select/SelectBase.d.ts +2 -2
- package/types/src/TabBar/TabBar.d.ts +8 -5
- package/types/src/TabBar/TabBarContext.d.ts +1 -1
- package/types/src/TabLayout/TabLayout.d.ts +8 -5
- package/types/src/Typography/Typography.d.ts +27 -22
- package/types/src/Date/Icon.d.ts +0 -3
- package/types/src/TabBar/docs/examples/IconsAbove.d.ts +0 -3
- package/types/src/TabBar/docs/examples/VerticalIconsAbove.d.ts +0 -3
- /package/types/src/TabBar/docs/examples/{IconsLeft.d.ts → Icons.d.ts} +0 -0
- /package/types/src/TabBar/docs/examples/{VerticalIconsLeft.d.ts → VerticalIcons.d.ts} +0 -0
package/Multiselect.js
CHANGED
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
Divider: () => /* reexport */ u.Divider,
|
|
138
138
|
Heading: () => /* reexport */ u.Heading,
|
|
139
139
|
Option: () => /* reexport */ R,
|
|
140
|
-
default: () => /* reexport */
|
|
140
|
+
default: () => /* reexport */ Kr
|
|
141
141
|
});
|
|
142
142
|
// EXTERNAL MODULE: external "react"
|
|
143
143
|
var e = r(9497);
|
|
@@ -270,7 +270,7 @@
|
|
|
270
270
|
};
|
|
271
271
|
/**
|
|
272
272
|
* An option within a `Multiselect`.
|
|
273
|
-
*/ function
|
|
273
|
+
*/ function C(r) {
|
|
274
274
|
var t = r.children, o = r.descriptionPosition, l = o === void 0 ? "bottom" : o, a = r.disabled, i = r.elementRef, c = r.icon, s = r.label, d = r.multiple, f = r.onClick, v = r.role, m = v === void 0 ? "option" : v, y = r.value, g = h(r, [ "children", "descriptionPosition", "disabled", "elementRef", "icon", "label", "multiple", "onClick", "role", "value" ]);
|
|
275
275
|
// @docs-props-type OptionPropsBase
|
|
276
276
|
var O = (0, e.useCallback)((function(e) {
|
|
@@ -281,7 +281,7 @@
|
|
|
281
281
|
}
|
|
282
282
|
}), [ a, f, y ]);
|
|
283
283
|
var S = y.toString();
|
|
284
|
-
var
|
|
284
|
+
var C = b({
|
|
285
285
|
descriptionPosition: l,
|
|
286
286
|
disabled: a ? "disabled" : undefined
|
|
287
287
|
}, g);
|
|
@@ -290,7 +290,7 @@
|
|
|
290
290
|
"data-test-value": y,
|
|
291
291
|
"data-test": "option",
|
|
292
292
|
elementRef: i
|
|
293
|
-
},
|
|
293
|
+
}, C, {
|
|
294
294
|
selectable: true,
|
|
295
295
|
selectableAppearance: d ? "checkbox" : "checkmark",
|
|
296
296
|
startAdornment: c,
|
|
@@ -299,10 +299,10 @@
|
|
|
299
299
|
value: S
|
|
300
300
|
}), t || s);
|
|
301
301
|
}
|
|
302
|
-
|
|
303
|
-
|
|
302
|
+
C.propTypes = S;
|
|
303
|
+
C.type = u.Item;
|
|
304
304
|
// For components to distinguish if their children are Options or Headings/Dividers
|
|
305
|
-
/* harmony default export */ const
|
|
305
|
+
/* harmony default export */ const w = C;
|
|
306
306
|
// CONCATENATED MODULE: ./src/Multiselect/Option.tsx
|
|
307
307
|
function k() {
|
|
308
308
|
return k = Object.assign ? Object.assign.bind() : function(e) {
|
|
@@ -376,7 +376,7 @@
|
|
|
376
376
|
// selectedAppearance, selectedBackgroundColor, and selectedForegroundColor are not used directly by the Option component.
|
|
377
377
|
// They are consumed by the parent component (Multiselect-Normal) to render the Chip, so they are not included in the above prop list.
|
|
378
378
|
|
|
379
|
-
return n().createElement(
|
|
379
|
+
return n().createElement(w, k({
|
|
380
380
|
description: o,
|
|
381
381
|
descriptionPosition: a,
|
|
382
382
|
disabled: i,
|
|
@@ -402,11 +402,11 @@
|
|
|
402
402
|
const I = require("lodash/find");
|
|
403
403
|
var B = r.n(I);
|
|
404
404
|
// CONCATENATED MODULE: external "lodash/forEachRight"
|
|
405
|
-
const
|
|
406
|
-
var
|
|
405
|
+
const T = require("lodash/forEachRight");
|
|
406
|
+
var L = r.n(T);
|
|
407
407
|
// CONCATENATED MODULE: external "lodash/includes"
|
|
408
|
-
const
|
|
409
|
-
var V = r.n(
|
|
408
|
+
const N = require("lodash/includes");
|
|
409
|
+
var V = r.n(N);
|
|
410
410
|
// CONCATENATED MODULE: external "lodash/memoize"
|
|
411
411
|
const q = require("lodash/memoize");
|
|
412
412
|
var D = r.n(q);
|
|
@@ -465,7 +465,7 @@
|
|
|
465
465
|
// When toggle is changed the total count is not displayed anymore so the count is now shown in the Select all menu item
|
|
466
466
|
var s = u ? " (".concat(i === null || i === void 0 ? void 0 : i.toString(), ")") : "";
|
|
467
467
|
|
|
468
|
-
return n().createElement(
|
|
468
|
+
return n().createElement(w, {
|
|
469
469
|
active: r,
|
|
470
470
|
elementRef: t,
|
|
471
471
|
"aria-keyshortcuts": "Control+A",
|
|
@@ -507,11 +507,11 @@
|
|
|
507
507
|
var n = e.$multiple;
|
|
508
508
|
return !n && "flex-grow: 0;";
|
|
509
509
|
}));
|
|
510
|
-
var
|
|
510
|
+
var Ce = be().span.withConfig({
|
|
511
511
|
displayName: "SelectBaseStyles__StyledLinkIcon",
|
|
512
512
|
componentId: "sc-16cj7sk-1"
|
|
513
513
|
})([ "padding-right:", ";" ], Oe.variables.spacingXSmall);
|
|
514
|
-
var
|
|
514
|
+
var we = be().span.withConfig({
|
|
515
515
|
displayName: "SelectBaseStyles__StyledLinkCaret",
|
|
516
516
|
componentId: "sc-16cj7sk-2"
|
|
517
517
|
})([ "padding-left:", ";" ], Oe.variables.spacingXSmall);
|
|
@@ -651,13 +651,15 @@
|
|
|
651
651
|
search: ""
|
|
652
652
|
}
|
|
653
653
|
};
|
|
654
|
-
function
|
|
654
|
+
function Te() {
|
|
655
655
|
var e = typeof document !== "undefined" ? document : Be;
|
|
656
656
|
return e;
|
|
657
657
|
}
|
|
658
|
+
var Le = Te();
|
|
659
|
+
/* harmony default export */ const Ne = /* unused pure expression or super */ null && Le;
|
|
658
660
|
// CONCATENATED MODULE: ./src/utils/ssrWindow.ts
|
|
659
661
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
660
|
-
var
|
|
662
|
+
var Ve = {
|
|
661
663
|
document: Be,
|
|
662
664
|
navigator: {
|
|
663
665
|
userAgent: ""
|
|
@@ -712,10 +714,12 @@
|
|
|
712
714
|
clearTimeout(n);
|
|
713
715
|
}
|
|
714
716
|
};
|
|
715
|
-
function
|
|
716
|
-
var e = typeof window !== "undefined" ? window :
|
|
717
|
+
function qe() {
|
|
718
|
+
var e = typeof window !== "undefined" ? window : Ve;
|
|
717
719
|
return e;
|
|
718
720
|
}
|
|
721
|
+
var De = qe();
|
|
722
|
+
/* harmony default export */ const Fe = /* unused pure expression or super */ null && De;
|
|
719
723
|
// CONCATENATED MODULE: ./src/utils/updateReactRef.ts
|
|
720
724
|
/**
|
|
721
725
|
* Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
|
|
@@ -723,7 +727,7 @@
|
|
|
723
727
|
* @param ref - The React callback or object ref. Can be `null` or `undefined`.
|
|
724
728
|
* @param current - The new value of the ref.
|
|
725
729
|
*/
|
|
726
|
-
function
|
|
730
|
+
function _e(e, n) {
|
|
727
731
|
if (e) {
|
|
728
732
|
if (typeof e === "function") {
|
|
729
733
|
e(n);
|
|
@@ -736,20 +740,20 @@
|
|
|
736
740
|
}
|
|
737
741
|
}
|
|
738
742
|
// CONCATENATED MODULE: ./src/Select/SelectBase.tsx
|
|
739
|
-
function
|
|
740
|
-
return
|
|
743
|
+
function He(e) {
|
|
744
|
+
return $e(e) || ze(e) || Ge(e) || Ke();
|
|
741
745
|
}
|
|
742
|
-
function
|
|
746
|
+
function Ke() {
|
|
743
747
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
744
748
|
}
|
|
745
|
-
function
|
|
749
|
+
function ze(e) {
|
|
746
750
|
if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"]) return Array.from(e);
|
|
747
751
|
}
|
|
748
|
-
function
|
|
749
|
-
if (Array.isArray(e)) return
|
|
752
|
+
function $e(e) {
|
|
753
|
+
if (Array.isArray(e)) return Je(e);
|
|
750
754
|
}
|
|
751
|
-
function
|
|
752
|
-
return
|
|
755
|
+
function We() {
|
|
756
|
+
return We = Object.assign ? Object.assign.bind() : function(e) {
|
|
753
757
|
for (var n = 1; n < arguments.length; n++) {
|
|
754
758
|
var r = arguments[n];
|
|
755
759
|
for (var t in r) {
|
|
@@ -757,29 +761,29 @@
|
|
|
757
761
|
}
|
|
758
762
|
}
|
|
759
763
|
return e;
|
|
760
|
-
},
|
|
764
|
+
}, We.apply(null, arguments);
|
|
761
765
|
}
|
|
762
|
-
function
|
|
763
|
-
return
|
|
766
|
+
function Xe(e, n) {
|
|
767
|
+
return Ye(e) || Qe(e, n) || Ge(e, n) || Ue();
|
|
764
768
|
}
|
|
765
|
-
function
|
|
769
|
+
function Ue() {
|
|
766
770
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
767
771
|
}
|
|
768
|
-
function
|
|
772
|
+
function Ge(e, n) {
|
|
769
773
|
if (e) {
|
|
770
|
-
if ("string" == typeof e) return
|
|
774
|
+
if ("string" == typeof e) return Je(e, n);
|
|
771
775
|
var r = {}.toString.call(e).slice(8, -1);
|
|
772
|
-
return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ?
|
|
776
|
+
return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? Je(e, n) : void 0;
|
|
773
777
|
}
|
|
774
778
|
}
|
|
775
|
-
function
|
|
779
|
+
function Je(e, n) {
|
|
776
780
|
(null == n || n > e.length) && (n = e.length);
|
|
777
781
|
for (var r = 0, t = Array(n); r < n; r++) {
|
|
778
782
|
t[r] = e[r];
|
|
779
783
|
}
|
|
780
784
|
return t;
|
|
781
785
|
}
|
|
782
|
-
function
|
|
786
|
+
function Qe(e, n) {
|
|
783
787
|
var r = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
784
788
|
if (null != r) {
|
|
785
789
|
var t, o, l, a, i = [], u = !0, c = !1;
|
|
@@ -801,12 +805,12 @@
|
|
|
801
805
|
return i;
|
|
802
806
|
}
|
|
803
807
|
}
|
|
804
|
-
function
|
|
808
|
+
function Ye(e) {
|
|
805
809
|
if (Array.isArray(e)) return e;
|
|
806
810
|
}
|
|
807
|
-
function
|
|
811
|
+
function Ze(e, n) {
|
|
808
812
|
if (null == e) return {};
|
|
809
|
-
var r, t, o =
|
|
813
|
+
var r, t, o = en(e, n);
|
|
810
814
|
if (Object.getOwnPropertySymbols) {
|
|
811
815
|
var l = Object.getOwnPropertySymbols(e);
|
|
812
816
|
for (t = 0; t < l.length; t++) {
|
|
@@ -815,7 +819,7 @@
|
|
|
815
819
|
}
|
|
816
820
|
return o;
|
|
817
821
|
}
|
|
818
|
-
function
|
|
822
|
+
function en(e, n) {
|
|
819
823
|
if (null == e) return {};
|
|
820
824
|
var r = {};
|
|
821
825
|
for (var t in e) {
|
|
@@ -826,15 +830,15 @@
|
|
|
826
830
|
}
|
|
827
831
|
return r;
|
|
828
832
|
}
|
|
829
|
-
function
|
|
833
|
+
function nn(e) {
|
|
830
834
|
"@babel/helpers - typeof";
|
|
831
|
-
return
|
|
835
|
+
return nn = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
|
|
832
836
|
return typeof e;
|
|
833
837
|
} : function(e) {
|
|
834
838
|
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
835
|
-
},
|
|
839
|
+
}, nn(e);
|
|
836
840
|
}
|
|
837
|
-
function
|
|
841
|
+
function rn(e, n) {
|
|
838
842
|
var r = Object.keys(e);
|
|
839
843
|
if (Object.getOwnPropertySymbols) {
|
|
840
844
|
var t = Object.getOwnPropertySymbols(e);
|
|
@@ -844,40 +848,40 @@
|
|
|
844
848
|
}
|
|
845
849
|
return r;
|
|
846
850
|
}
|
|
847
|
-
function
|
|
851
|
+
function tn(e) {
|
|
848
852
|
for (var n = 1; n < arguments.length; n++) {
|
|
849
853
|
var r = null != arguments[n] ? arguments[n] : {};
|
|
850
|
-
n % 2 ?
|
|
851
|
-
|
|
852
|
-
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) :
|
|
854
|
+
n % 2 ? rn(Object(r), !0).forEach((function(n) {
|
|
855
|
+
on(e, n, r[n]);
|
|
856
|
+
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : rn(Object(r)).forEach((function(n) {
|
|
853
857
|
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
|
|
854
858
|
}));
|
|
855
859
|
}
|
|
856
860
|
return e;
|
|
857
861
|
}
|
|
858
|
-
function
|
|
859
|
-
return (n =
|
|
862
|
+
function on(e, n, r) {
|
|
863
|
+
return (n = ln(n)) in e ? Object.defineProperty(e, n, {
|
|
860
864
|
value: r,
|
|
861
865
|
enumerable: !0,
|
|
862
866
|
configurable: !0,
|
|
863
867
|
writable: !0
|
|
864
868
|
}) : e[n] = r, e;
|
|
865
869
|
}
|
|
866
|
-
function
|
|
867
|
-
var n =
|
|
868
|
-
return "symbol" ==
|
|
870
|
+
function ln(e) {
|
|
871
|
+
var n = an(e, "string");
|
|
872
|
+
return "symbol" == nn(n) ? n : n + "";
|
|
869
873
|
}
|
|
870
|
-
function
|
|
871
|
-
if ("object" !=
|
|
874
|
+
function an(e, n) {
|
|
875
|
+
if ("object" != nn(e) || !e) return e;
|
|
872
876
|
var r = e[Symbol.toPrimitive];
|
|
873
877
|
if (void 0 !== r) {
|
|
874
878
|
var t = r.call(e, n || "default");
|
|
875
|
-
if ("object" !=
|
|
879
|
+
if ("object" != nn(t)) return t;
|
|
876
880
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
877
881
|
}
|
|
878
882
|
return ("string" === n ? String : Number)(e);
|
|
879
883
|
}
|
|
880
|
-
var
|
|
884
|
+
var un = {
|
|
881
885
|
allowKeyMatching: l().bool,
|
|
882
886
|
allowNewValues: l().bool,
|
|
883
887
|
animateLoading: l().bool,
|
|
@@ -926,51 +930,53 @@
|
|
|
926
930
|
/** @private. */
|
|
927
931
|
virtualization: l().number
|
|
928
932
|
};
|
|
929
|
-
var
|
|
933
|
+
var cn = D()((function(e) {
|
|
930
934
|
return [ e ];
|
|
931
935
|
}));
|
|
932
936
|
// preserve separate widths for single vs. multi mode
|
|
933
|
-
var
|
|
937
|
+
var sn = D()((function(e) {
|
|
934
938
|
var n = e.anchorWidth, r = e.isMultiple, t = e.maxHeight, o = e.menuStyle;
|
|
935
|
-
return r ?
|
|
939
|
+
return r ? tn({
|
|
936
940
|
width: Math.max(n !== null && n !== void 0 ? n : 0, 200),
|
|
937
941
|
maxHeight: t
|
|
938
|
-
}, o) :
|
|
942
|
+
}, o) : tn({
|
|
939
943
|
minWidth: n !== null && n !== void 0 ? n : undefined,
|
|
940
944
|
maxWidth: Math.max(n !== null && n !== void 0 ? n : 0, 300),
|
|
941
945
|
maxHeight: t
|
|
942
946
|
}, o);
|
|
943
947
|
}));
|
|
944
|
-
var
|
|
945
|
-
function
|
|
948
|
+
var dn = [ "clickAway", "escapeKey", "offScreen", "tabKey", "toggleClick" ];
|
|
949
|
+
function fn(e) {
|
|
946
950
|
return e && i()(e.props, "value");
|
|
947
951
|
}
|
|
948
|
-
function
|
|
949
|
-
return "".concat(
|
|
952
|
+
function pn(e, n) {
|
|
953
|
+
return "".concat(nn(e), "-").concat(e, "-").concat(n);
|
|
950
954
|
}
|
|
951
|
-
var
|
|
952
|
-
var
|
|
953
|
-
var
|
|
954
|
-
var
|
|
955
|
-
var
|
|
955
|
+
var vn = [ "append", "error", "prepend" ];
|
|
956
|
+
var bn = (0, d._)("No matches");
|
|
957
|
+
var mn = (0, d._)("Select...");
|
|
958
|
+
var yn = n().createElement(G(), null);
|
|
959
|
+
var gn = function e(r) {
|
|
956
960
|
var t = r.activeItemId, o = r.filterA11yId, l = r.filterKeyword, a = r.hasChildren, i = r.inputId, u = r.inputRef, c = r.menuListboxId, s = r.multiple, f = r.onClearAll, p = r.onSelectAll, v = r.onTextBlur, b = r.onTextChange, m = r.onTextFocus, y = r.onTextKeyDown, g = r.optionSelection, h = r.placement, O = r.selectAllAppearance, S = r.textHasFocus;
|
|
957
|
-
var
|
|
958
|
-
var
|
|
961
|
+
var C = (0, d._)("Select all options".concat(g.current === "all" ? " disabled" : ""));
|
|
962
|
+
var w = (0, d._)("Clear all options".concat(g.current === "none" ? " disabled" : ""));
|
|
959
963
|
// only visually disable these as opposed to fully disabling to avoid losing keyboard focus - see SUI-2731
|
|
960
964
|
var k = n().createElement(Pe, {
|
|
961
965
|
key: "selectAll"
|
|
962
966
|
}, n().createElement(je, {
|
|
963
|
-
|
|
967
|
+
disabled: g.current === "all",
|
|
964
968
|
appearance: "standalone",
|
|
965
|
-
"aria-label":
|
|
969
|
+
"aria-label": C,
|
|
966
970
|
onClick: p,
|
|
967
|
-
"data-test": "select-all"
|
|
971
|
+
"data-test": "select-all",
|
|
972
|
+
tag: "button"
|
|
968
973
|
}, l ? (0, d._)("Select all Matches") : (0, d._)("Select all")), n().createElement(je, {
|
|
969
|
-
|
|
974
|
+
disabled: g.current === "none",
|
|
970
975
|
appearance: "standalone",
|
|
971
|
-
"aria-label":
|
|
976
|
+
"aria-label": w,
|
|
972
977
|
onClick: f,
|
|
973
|
-
"data-test": "clear-all"
|
|
978
|
+
"data-test": "clear-all",
|
|
979
|
+
tag: "button"
|
|
974
980
|
}, l ? (0, d._)("Clear all Matches") : (0, d._)("Clear all")));
|
|
975
981
|
|
|
976
982
|
return n().createElement("div", {
|
|
@@ -1001,10 +1007,10 @@
|
|
|
1001
1007
|
inputRef: u,
|
|
1002
1008
|
inputId: i,
|
|
1003
1009
|
canClear: true,
|
|
1004
|
-
startAdornment:
|
|
1010
|
+
startAdornment: yn
|
|
1005
1011
|
})), s && a && O === "buttongroup" && k, h === "below" && n().createElement(Ee, null));
|
|
1006
1012
|
};
|
|
1007
|
-
var
|
|
1013
|
+
var hn = function e(n) {
|
|
1008
1014
|
var r = n.prefixLabel, t = n.label, o = n.suffixLabel;
|
|
1009
1015
|
var l = t;
|
|
1010
1016
|
if (r) {
|
|
@@ -1015,8 +1021,8 @@
|
|
|
1015
1021
|
}
|
|
1016
1022
|
return l;
|
|
1017
1023
|
};
|
|
1018
|
-
var
|
|
1019
|
-
var o = r.appearance, l = o === void 0 ? "default" : o, a = r.append, i = r.children, u = r.currentValues, c = u === void 0 ? [] : u, s = r.describedBy, f = r.disabled, p = r.elementRef, v = r.error, b = r.inline, m = r.labelText, y = r.labelledBy, g = r.multiple, h = r.onClick, O = r.placeholder, S = r.prefixLabel,
|
|
1024
|
+
var On = n().forwardRef((function(r, t) {
|
|
1025
|
+
var o = r.appearance, l = o === void 0 ? "default" : o, a = r.append, i = r.children, u = r.currentValues, c = u === void 0 ? [] : u, s = r.describedBy, f = r.disabled, p = r.elementRef, v = r.error, b = r.inline, m = r.labelText, y = r.labelledBy, g = r.multiple, h = r.onClick, O = r.placeholder, S = r.prefixLabel, C = r.prepend, w = r.required, k = r.suffixLabel, x = r.toggle, j = r.toggleContent, P = Ze(r, [ "appearance", "append", "children", "currentValues", "describedBy", "disabled", "elementRef", "error", "inline", "labelText", "labelledBy", "multiple", "onClick", "placeholder", "prefixLabel", "prepend", "required", "suffixLabel", "toggle", "toggleContent" ]);
|
|
1020
1026
|
var E;
|
|
1021
1027
|
var R;
|
|
1022
1028
|
var M = [];
|
|
@@ -1024,7 +1030,7 @@
|
|
|
1024
1030
|
var A = e.Children.toArray(i);
|
|
1025
1031
|
var I = c.reduce((function(e, n, r, t) {
|
|
1026
1032
|
var o = B()(A, (function(e) {
|
|
1027
|
-
return
|
|
1033
|
+
return fn(e) && e.props.value === n;
|
|
1028
1034
|
}));
|
|
1029
1035
|
if (o) {
|
|
1030
1036
|
var l = o.props, a = l.children, i = l.icon, u = l.label;
|
|
@@ -1051,12 +1057,12 @@
|
|
|
1051
1057
|
if (R.length > 0) {
|
|
1052
1058
|
// If there's more than one item selected, read out the selected total
|
|
1053
1059
|
// rather than reading out each selected item
|
|
1054
|
-
M =
|
|
1060
|
+
M = hn({
|
|
1055
1061
|
prefixLabel: S,
|
|
1056
1062
|
label: R.length > 1 ? [ "".concat(c.length, " items selected") ] : M,
|
|
1057
1063
|
suffixLabel: k
|
|
1058
1064
|
});
|
|
1059
|
-
R =
|
|
1065
|
+
R = hn({
|
|
1060
1066
|
prefixLabel: S,
|
|
1061
1067
|
label: R,
|
|
1062
1068
|
suffixLabel: k
|
|
@@ -1067,48 +1073,49 @@
|
|
|
1067
1073
|
if (R.length === 0 || !g && R.every((function(e) {
|
|
1068
1074
|
return e === "";
|
|
1069
1075
|
}))) {
|
|
1070
|
-
R =
|
|
1076
|
+
R = cn(O);
|
|
1071
1077
|
M = R;
|
|
1072
1078
|
}
|
|
1073
|
-
var
|
|
1074
|
-
var
|
|
1079
|
+
var T = Object.keys(P).includes("aria-labelledby");
|
|
1080
|
+
var L = tn({
|
|
1075
1081
|
"aria-describedby": s,
|
|
1076
|
-
"aria-label": y ||
|
|
1082
|
+
"aria-label": y || T ? undefined : "".concat(m ? "".concat(m, ", ") : "").concat(M.join("")),
|
|
1077
1083
|
// aria-labelledby takes precedence over aria-label, so existence of both is redundant
|
|
1078
1084
|
"aria-labelledby": y,
|
|
1079
|
-
"aria-required":
|
|
1085
|
+
"aria-required": w,
|
|
1080
1086
|
"data-select-appearance": l,
|
|
1081
1087
|
append: a,
|
|
1082
|
-
prepend:
|
|
1088
|
+
prepend: C,
|
|
1083
1089
|
onClick: h,
|
|
1084
1090
|
role: "combobox",
|
|
1085
|
-
disabled: f,
|
|
1091
|
+
disabled: f ? "disabled" : undefined,
|
|
1086
1092
|
elementRef: p,
|
|
1087
1093
|
error: v,
|
|
1088
1094
|
ref: t
|
|
1089
1095
|
}, P);
|
|
1090
1096
|
if (g) {
|
|
1091
|
-
|
|
1097
|
+
L["data-test-values"] = JSON.stringify(c);
|
|
1092
1098
|
} else {
|
|
1093
|
-
var
|
|
1094
|
-
|
|
1099
|
+
var N = Xe(c, 1), V = N[0];
|
|
1100
|
+
L["data-test-value"] = V;
|
|
1095
1101
|
}
|
|
1096
1102
|
if (x) {
|
|
1097
1103
|
|
|
1098
|
-
return (0, e.cloneElement)(x,
|
|
1104
|
+
return (0, e.cloneElement)(x, L);
|
|
1099
1105
|
}
|
|
1100
1106
|
if (l === "link") {
|
|
1101
1107
|
|
|
1102
|
-
return n().createElement(Z(),
|
|
1108
|
+
return n().createElement(Z(), We({
|
|
1109
|
+
tag: "button",
|
|
1103
1110
|
appearance: "standalone"
|
|
1104
|
-
},
|
|
1111
|
+
}, L, {
|
|
1105
1112
|
"data-select-appearance": "link"
|
|
1106
|
-
}), !!E && n().createElement(
|
|
1113
|
+
}), !!E && n().createElement(Ce, null, E), R || O, n().createElement(we, null, n().createElement(X(), null)));
|
|
1107
1114
|
}
|
|
1108
1115
|
// Using Button's secondary appearance as Select's default appearance.
|
|
1109
1116
|
var q = l === "default" ? "secondary" : l;
|
|
1110
1117
|
|
|
1111
|
-
return n().createElement(Se,
|
|
1118
|
+
return n().createElement(Se, We({}, L, {
|
|
1112
1119
|
$multiple: g,
|
|
1113
1120
|
appearance: q,
|
|
1114
1121
|
label: R,
|
|
@@ -1117,12 +1124,12 @@
|
|
|
1117
1124
|
inline: b,
|
|
1118
1125
|
isMenu: true,
|
|
1119
1126
|
onClick: h
|
|
1120
|
-
}, _()(P,
|
|
1127
|
+
}, _()(P, vn)), !!c.length && g && n().createElement(xe, {
|
|
1121
1128
|
"data-role": "count"
|
|
1122
1129
|
}, "(", c.length, ")"));
|
|
1123
1130
|
}));
|
|
1124
|
-
function
|
|
1125
|
-
var t = r.allowKeyMatching, o = t === void 0 ? true : t, l = r.animateLoading, a = r.appearance, i = a === void 0 ? "default" : a, c = r.append, s = r.allowNewValues, f = r.children, p = r.defaultPlacement, v = p === void 0 ? "vertical" : p, b = r.defaultValues, m = r.describedBy, y = r.disabled, g = r.elementRef, h = r.error, O = r.filter, S = r.footerMessage,
|
|
1131
|
+
function Sn(r) {
|
|
1132
|
+
var t = r.allowKeyMatching, o = t === void 0 ? true : t, l = r.animateLoading, a = r.appearance, i = a === void 0 ? "default" : a, c = r.append, s = r.allowNewValues, f = r.children, p = r.defaultPlacement, v = p === void 0 ? "vertical" : p, b = r.defaultValues, m = r.describedBy, y = r.disabled, g = r.elementRef, h = r.error, O = r.filter, S = r.footerMessage, C = r.inline, k = r.inputId, x = r.inputRef, j = r.isLoadingOptions, P = r.labelledBy, E = r.labelText, R = r.loadingMessage, M = r.menuStyle, A = M === void 0 ? {} : M, I = r.multiple, T = r.name, N = r.noOptionsMessage, q = N === void 0 ? bn : N, D = r.onChange, F = r.onScroll, _ = r.onScrollBottom, H = r.onFilterChange, z = r.onClick, W = r.onClose, X = r.onOpen, U = r.required, G = r.placeholder, J = G === void 0 ? mn : G, Y = r.prefixLabel, Z = r.prepend, re = r.repositionMode, te = re === void 0 ? "flip" : re, oe = r.selectAllAppearance, le = oe === void 0 ? "buttongroup" : oe, ae = r.showSelectedValuesFirst, de = r.suffixLabel, fe = r.tabConfirmsNewValue, ve = r.values, be = r.virtualization, me = r.toggle, ye = r.toggleContent, ge = ye === void 0 ? "optionChildren" : ye, he = Ze(r, [ "allowKeyMatching", "animateLoading", "appearance", "append", "allowNewValues", "children", "defaultPlacement", "defaultValues", "describedBy", "disabled", "elementRef", "error", "filter", "footerMessage", "inline", "inputId", "inputRef", "isLoadingOptions", "labelledBy", "labelText", "loadingMessage", "menuStyle", "multiple", "name", "noOptionsMessage", "onChange", "onScroll", "onScrollBottom", "onFilterChange", "onClick", "onClose", "onOpen", "required", "placeholder", "prefixLabel", "prepend", "repositionMode", "selectAllAppearance", "showSelectedValuesFirst", "suffixLabel", "tabConfirmsNewValue", "values", "virtualization", "toggle", "toggleContent" ]);
|
|
1126
1133
|
// @docs-props-type SelectBasePropsBase
|
|
1127
1134
|
var Oe = (0, Re["default"])({
|
|
1128
1135
|
componentName: "SelectBase",
|
|
@@ -1138,31 +1145,31 @@
|
|
|
1138
1145
|
activeItemId: (0, ce.createDOMID)("active-item"),
|
|
1139
1146
|
menuListboxId: (0, ce.createDOMID)("menu-listbox")
|
|
1140
1147
|
};
|
|
1141
|
-
})),
|
|
1142
|
-
var je = (0, e.useState)(0), Pe =
|
|
1143
|
-
var Be = (0, e.useState)(""),
|
|
1144
|
-
var
|
|
1145
|
-
var
|
|
1146
|
-
var
|
|
1147
|
-
var nn = (0, e.useState)(b || []), rn =
|
|
1148
|
+
})), Ce = Xe(Se, 1), we = Ce[0], ke = we.activeItemId, xe = we.menuListboxId;
|
|
1149
|
+
var je = (0, e.useState)(0), Pe = Xe(je, 2), Ee = Pe[0], Me = Pe[1];
|
|
1150
|
+
var Be = (0, e.useState)(""), Te = Xe(Be, 2), Le = Te[0], Ne = Te[1];
|
|
1151
|
+
var Ve = (0, e.useState)(false), De = Xe(Ve, 2), Fe = De[0], Ke = De[1];
|
|
1152
|
+
var ze = (0, e.useState)(false), $e = Xe(ze, 2), Ue = $e[0], Ge = $e[1];
|
|
1153
|
+
var Je = (0, e.useState)([]), Qe = Xe(Je, 2), Ye = Qe[0], en = Qe[1];
|
|
1154
|
+
var nn = (0, e.useState)(b || []), rn = Xe(nn, 2), tn = rn[0], on = rn[1];
|
|
1148
1155
|
// previous state
|
|
1149
|
-
var
|
|
1156
|
+
var ln = ie()(Ee);
|
|
1150
1157
|
// refs
|
|
1151
|
-
var
|
|
1152
|
-
var
|
|
1153
|
-
var
|
|
1154
|
-
var
|
|
1155
|
-
var
|
|
1156
|
-
var
|
|
1158
|
+
var an = (0, e.useRef)(null);
|
|
1159
|
+
var un = (0, e.useRef)(null);
|
|
1160
|
+
var cn = (0, e.useRef)(null);
|
|
1161
|
+
var vn = (0, e.useRef)([]);
|
|
1162
|
+
var yn = (0, e.useRef)([]);
|
|
1163
|
+
var hn = (0, e.useRef)(ln);
|
|
1157
1164
|
var Sn = (0, e.useRef)();
|
|
1158
|
-
var
|
|
1159
|
-
var
|
|
1165
|
+
var Cn = (0, e.useRef)({});
|
|
1166
|
+
var wn = (0, e.useRef)(0);
|
|
1160
1167
|
var kn = (0, e.useRef)([]);
|
|
1161
1168
|
var xn = (0, e.useRef)(null);
|
|
1162
1169
|
var jn = (0, e.useRef)();
|
|
1163
1170
|
var Pn = (0, e.useRef)(0);
|
|
1164
1171
|
var En = (0, e.useRef)("none");
|
|
1165
|
-
var Rn = (0, e.useState)(O ? (0, ce.createDOMID)("filter") : undefined), Mn =
|
|
1172
|
+
var Rn = (0, e.useState)(O ? (0, ce.createDOMID)("filter") : undefined), Mn = Xe(Rn, 1), An = Mn[0];
|
|
1166
1173
|
(0, e.useEffect)((function() {
|
|
1167
1174
|
if (false) {}
|
|
1168
1175
|
}), [ i, c, h, Z ]);
|
|
@@ -1175,22 +1182,22 @@
|
|
|
1175
1182
|
// in non-multiple mode, don't move values to the top of the list
|
|
1176
1183
|
return I && ae !== "never" ? (e = In()) !== null && e !== void 0 ? e : [] : [];
|
|
1177
1184
|
}), [ In, I, ae ]);
|
|
1178
|
-
var
|
|
1179
|
-
var n =
|
|
1180
|
-
|
|
1185
|
+
var Tn = (0, e.useCallback)((function(e) {
|
|
1186
|
+
var n = Le;
|
|
1187
|
+
Ke(true);
|
|
1181
1188
|
en(Bn());
|
|
1182
1189
|
// SUI-3234: preserve existing behavior difference between <Select> and <Multiselect.Compact>
|
|
1183
1190
|
if (I) {
|
|
1184
|
-
|
|
1191
|
+
Ne("");
|
|
1185
1192
|
}
|
|
1186
|
-
if (n !==
|
|
1193
|
+
if (n !== Le) {
|
|
1187
1194
|
H === null || H === void 0 ? void 0 : H(e, {
|
|
1188
|
-
keyword:
|
|
1195
|
+
keyword: Le
|
|
1189
1196
|
});
|
|
1190
1197
|
}
|
|
1191
|
-
}), [
|
|
1198
|
+
}), [ Le, Bn, I, H ]);
|
|
1192
1199
|
(0, e.useEffect)((function() {
|
|
1193
|
-
if (
|
|
1200
|
+
if (Fe) {
|
|
1194
1201
|
X === null || X === void 0 ? void 0 : X();
|
|
1195
1202
|
if (xn.current && !O) {
|
|
1196
1203
|
xn.current.focus();
|
|
@@ -1199,21 +1206,21 @@
|
|
|
1199
1206
|
Me((e = jn.current) !== null && e !== void 0 ? e : 0);
|
|
1200
1207
|
}
|
|
1201
1208
|
}
|
|
1202
|
-
}), [ X,
|
|
1203
|
-
var
|
|
1204
|
-
|
|
1209
|
+
}), [ X, Fe, Ye, Le, O ]);
|
|
1210
|
+
var Ln = (0, e.useCallback)((function() {
|
|
1211
|
+
Ke(false);
|
|
1205
1212
|
Me(0);
|
|
1206
|
-
|
|
1213
|
+
hn.current = null;
|
|
1207
1214
|
W === null || W === void 0 ? void 0 : W();
|
|
1208
1215
|
}), [ W ]);
|
|
1209
|
-
var
|
|
1216
|
+
var Nn = (0, e.useCallback)((function(e, n) {
|
|
1210
1217
|
var r;
|
|
1211
1218
|
var t = (r = In()) !== null && r !== void 0 ? r : [];
|
|
1212
1219
|
var o = t.indexOf(n);
|
|
1213
1220
|
var l;
|
|
1214
1221
|
if (I) {
|
|
1215
1222
|
if (o >= 0) {
|
|
1216
|
-
l = [].concat(
|
|
1223
|
+
l = [].concat(He(t.slice(0, o)), He(t.slice(o + 1)));
|
|
1217
1224
|
} else {
|
|
1218
1225
|
l = t.concat([ n ]);
|
|
1219
1226
|
}
|
|
@@ -1228,28 +1235,28 @@
|
|
|
1228
1235
|
if (I) {
|
|
1229
1236
|
// in uncontrolled multiple mode, keep the menu open
|
|
1230
1237
|
if (a) {
|
|
1231
|
-
|
|
1238
|
+
Ke(true);
|
|
1232
1239
|
}
|
|
1233
1240
|
} else {
|
|
1234
1241
|
var i;
|
|
1235
1242
|
// non-multiple mode only supports a single selection
|
|
1236
1243
|
// so close the menu once a selection is made
|
|
1237
|
-
|
|
1244
|
+
Ln({
|
|
1238
1245
|
reason: "contentClick"
|
|
1239
1246
|
});
|
|
1240
|
-
(i =
|
|
1247
|
+
(i = an.current) === null || i === void 0 ? void 0 : i.focus();
|
|
1241
1248
|
}
|
|
1242
1249
|
D === null || D === void 0 ? void 0 : D(e, {
|
|
1243
1250
|
values: l,
|
|
1244
|
-
name:
|
|
1251
|
+
name: T,
|
|
1245
1252
|
reason: "valueToggle"
|
|
1246
1253
|
});
|
|
1247
|
-
}), [ In,
|
|
1254
|
+
}), [ In, Ln, Oe, I, T, D ]);
|
|
1248
1255
|
var Vn = function e() {
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
if (
|
|
1252
|
-
clearTimeout(
|
|
1256
|
+
un.current = null;
|
|
1257
|
+
vn.current = [];
|
|
1258
|
+
if (cn.current) {
|
|
1259
|
+
clearTimeout(cn.current);
|
|
1253
1260
|
}
|
|
1254
1261
|
};
|
|
1255
1262
|
var qn = (0, e.useCallback)((function(e) {
|
|
@@ -1261,7 +1268,7 @@
|
|
|
1261
1268
|
var t = (r = In()) !== null && r !== void 0 ? r : [];
|
|
1262
1269
|
var o = K()(t.concat(kn.current));
|
|
1263
1270
|
o = n().Children.toArray(f).filter((function(e) {
|
|
1264
|
-
return
|
|
1271
|
+
return fn(e) && V()(o, e.props.value) && (!e.props.disabled || V()(t, e.props.value));
|
|
1265
1272
|
})).map((function(e) {
|
|
1266
1273
|
return e.props.value;
|
|
1267
1274
|
}));
|
|
@@ -1270,10 +1277,10 @@
|
|
|
1270
1277
|
}
|
|
1271
1278
|
D === null || D === void 0 ? void 0 : D(e, {
|
|
1272
1279
|
values: o,
|
|
1273
|
-
name:
|
|
1280
|
+
name: T,
|
|
1274
1281
|
reason: "selectAll"
|
|
1275
1282
|
});
|
|
1276
|
-
}), [ f, In, Oe, I,
|
|
1283
|
+
}), [ f, In, Oe, I, T, D ]);
|
|
1277
1284
|
var Dn = (0, e.useCallback)((function(e) {
|
|
1278
1285
|
var r;
|
|
1279
1286
|
// this doesn't make sense if we can't select multiple values
|
|
@@ -1281,10 +1288,10 @@
|
|
|
1281
1288
|
return;
|
|
1282
1289
|
}
|
|
1283
1290
|
var t = (r = In()) !== null && r !== void 0 ? r : [];
|
|
1284
|
-
var o = $().apply(void 0, [ t ].concat(
|
|
1291
|
+
var o = $().apply(void 0, [ t ].concat(He(kn.current)));
|
|
1285
1292
|
// this will unselect all selected values unless those values are disabled or hidden by the filter
|
|
1286
1293
|
var l = n().Children.toArray(f).filter((function(e) {
|
|
1287
|
-
return
|
|
1294
|
+
return fn(e) && (V()(t, e.props.value) && e.props.disabled || V()(o, e.props.value));
|
|
1288
1295
|
})).map((function(e) {
|
|
1289
1296
|
return e.props.value;
|
|
1290
1297
|
}));
|
|
@@ -1293,21 +1300,21 @@
|
|
|
1293
1300
|
}
|
|
1294
1301
|
D === null || D === void 0 ? void 0 : D(e, {
|
|
1295
1302
|
values: l,
|
|
1296
|
-
name:
|
|
1303
|
+
name: T,
|
|
1297
1304
|
reason: "clearAll"
|
|
1298
1305
|
});
|
|
1299
|
-
}), [ f, In, Oe, I,
|
|
1306
|
+
}), [ f, In, Oe, I, T, D ]);
|
|
1300
1307
|
var Fn = (0, e.useCallback)((function(e) {
|
|
1301
|
-
if (
|
|
1308
|
+
if (Fe && !j) {
|
|
1302
1309
|
_ === null || _ === void 0 ? void 0 : _(e);
|
|
1303
1310
|
}
|
|
1304
|
-
}), [
|
|
1311
|
+
}), [ Fe, j, _ ]);
|
|
1305
1312
|
var _n = (0, e.useCallback)((function(n) {
|
|
1306
1313
|
var r = (0, se.keycode)(n.nativeEvent);
|
|
1307
1314
|
if (r === "tab") {
|
|
1308
|
-
if (fe && Sn.current &&
|
|
1315
|
+
if (fe && Sn.current && wn.current <= 1) {
|
|
1309
1316
|
n.preventDefault();
|
|
1310
|
-
|
|
1317
|
+
Nn(n, Sn.current);
|
|
1311
1318
|
}
|
|
1312
1319
|
}
|
|
1313
1320
|
if (n.shiftKey || n.metaKey || n.ctrlKey) {
|
|
@@ -1323,7 +1330,7 @@
|
|
|
1323
1330
|
}
|
|
1324
1331
|
if (r === "down") {
|
|
1325
1332
|
n.preventDefault();
|
|
1326
|
-
Me(Math.min(Ee + 1, le === "checkbox" ?
|
|
1333
|
+
Me(Math.min(Ee + 1, le === "checkbox" ? wn.current : wn.current - 1));
|
|
1327
1334
|
if (f && _) {
|
|
1328
1335
|
var t;
|
|
1329
1336
|
var o = e.Children.toArray(f).length - (2 + ((t = In()) !== null && t !== void 0 ? t : []).length);
|
|
@@ -1336,7 +1343,7 @@
|
|
|
1336
1343
|
n.preventDefault();
|
|
1337
1344
|
Me(Math.max(Ee - 1, 0));
|
|
1338
1345
|
}
|
|
1339
|
-
if (r === "enter" && Sn.current &&
|
|
1346
|
+
if (r === "enter" && Sn.current && Fe) {
|
|
1340
1347
|
if (Sn.current === "selectAll") {
|
|
1341
1348
|
if (En.current === "all") {
|
|
1342
1349
|
Dn(n);
|
|
@@ -1345,18 +1352,18 @@
|
|
|
1345
1352
|
}
|
|
1346
1353
|
} else {
|
|
1347
1354
|
n.preventDefault();
|
|
1348
|
-
|
|
1355
|
+
Nn(n, Sn.current);
|
|
1349
1356
|
}
|
|
1350
1357
|
}
|
|
1351
|
-
}), [ Ee, f, In, Dn, Fn, qn, _,
|
|
1358
|
+
}), [ Ee, f, In, Dn, Fn, qn, _, Fe, le, fe, Nn ]);
|
|
1352
1359
|
var Hn = (0, e.useCallback)((function(e, n) {
|
|
1353
1360
|
var r = n.value;
|
|
1354
1361
|
e.preventDefault();
|
|
1355
|
-
if (!
|
|
1362
|
+
if (!Fe) {
|
|
1356
1363
|
return;
|
|
1357
1364
|
}
|
|
1358
|
-
|
|
1359
|
-
}), [
|
|
1365
|
+
Nn(e, r);
|
|
1366
|
+
}), [ Fe, Nn ]);
|
|
1360
1367
|
var Kn = (0, e.useCallback)((function(e, n) {
|
|
1361
1368
|
var r = e.nativeEvent.key;
|
|
1362
1369
|
// Checking for a single character to avoid complications from double-byte languages and emojis.
|
|
@@ -1366,58 +1373,58 @@
|
|
|
1366
1373
|
index: 0,
|
|
1367
1374
|
value: r
|
|
1368
1375
|
};
|
|
1369
|
-
if (!
|
|
1376
|
+
if (!un.current) {
|
|
1370
1377
|
if (r === " ") {
|
|
1371
1378
|
Vn();
|
|
1372
1379
|
return;
|
|
1373
1380
|
}
|
|
1374
|
-
t = Ae(
|
|
1375
|
-
} else if (
|
|
1376
|
-
o.index =
|
|
1377
|
-
t = Ae(
|
|
1381
|
+
t = Ae(yn.current, o);
|
|
1382
|
+
} else if (vn.current.length > 1) {
|
|
1383
|
+
o.index = un.current.index + 1;
|
|
1384
|
+
t = Ae(vn.current, o);
|
|
1378
1385
|
}
|
|
1379
1386
|
if (t.length) {
|
|
1380
1387
|
var l;
|
|
1381
1388
|
var a = 0;
|
|
1382
1389
|
// If the active option is a first character match, cycle to the next matching option.
|
|
1383
1390
|
if (o.index === 0 && t.length > 1) {
|
|
1384
|
-
var i = t.indexOf(
|
|
1391
|
+
var i = t.indexOf(yn.current[n]);
|
|
1385
1392
|
if (i >= 0) {
|
|
1386
1393
|
a = i === t.length - 1 ? 0 : i + 1;
|
|
1387
1394
|
}
|
|
1388
1395
|
}
|
|
1389
1396
|
var u = t[a];
|
|
1390
1397
|
var c = u.value, s = u.label;
|
|
1391
|
-
var d =
|
|
1398
|
+
var d = Cn.current[pn(c, s)];
|
|
1392
1399
|
d === null || d === void 0 ? void 0 : (l = d.focus) === null || l === void 0 ? void 0 : l.call(d);
|
|
1393
1400
|
}
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
if (
|
|
1397
|
-
clearTimeout(
|
|
1401
|
+
vn.current = t;
|
|
1402
|
+
un.current = o;
|
|
1403
|
+
if (cn.current) {
|
|
1404
|
+
clearTimeout(cn.current);
|
|
1398
1405
|
}
|
|
1399
|
-
|
|
1406
|
+
cn.current = setTimeout(Vn, 500);
|
|
1400
1407
|
e.preventDefault();
|
|
1401
1408
|
e.stopPropagation();
|
|
1402
1409
|
}
|
|
1403
1410
|
}), []);
|
|
1404
1411
|
var zn = (0, e.useCallback)((function(e, n) {
|
|
1405
1412
|
var r = n.value;
|
|
1406
|
-
|
|
1407
|
-
|
|
1413
|
+
Ne(r);
|
|
1414
|
+
Ke(true);
|
|
1408
1415
|
Me(0);
|
|
1409
1416
|
H === null || H === void 0 ? void 0 : H(e, {
|
|
1410
1417
|
keyword: r
|
|
1411
1418
|
});
|
|
1412
1419
|
}), [ H ]);
|
|
1413
1420
|
var $n = (0, e.useCallback)((function() {
|
|
1414
|
-
|
|
1421
|
+
Ge(true);
|
|
1415
1422
|
}), []);
|
|
1416
1423
|
var Wn = (0, e.useCallback)((function() {
|
|
1417
|
-
|
|
1424
|
+
Ge(false);
|
|
1418
1425
|
}), []);
|
|
1419
1426
|
var Xn = (0, e.useCallback)((function(e) {
|
|
1420
|
-
if (
|
|
1427
|
+
if (hn.current !== Ee) {
|
|
1421
1428
|
Ie(e);
|
|
1422
1429
|
}
|
|
1423
1430
|
}), [ Ee ]);
|
|
@@ -1426,15 +1433,15 @@
|
|
|
1426
1433
|
xn.current = e;
|
|
1427
1434
|
}
|
|
1428
1435
|
if (e == null) {
|
|
1429
|
-
delete
|
|
1436
|
+
delete Cn.current[n];
|
|
1430
1437
|
} else {
|
|
1431
|
-
|
|
1438
|
+
Cn.current[n] = e;
|
|
1432
1439
|
}
|
|
1433
|
-
}), [
|
|
1440
|
+
}), [ Cn ]);
|
|
1434
1441
|
var Gn = (0, e.useCallback)((function(e) {
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
}), [ g,
|
|
1442
|
+
an.current = e;
|
|
1443
|
+
_e(g, e);
|
|
1444
|
+
}), [ g, an ]);
|
|
1438
1445
|
var Jn = (0, e.useMemo)((function() {
|
|
1439
1446
|
var e;
|
|
1440
1447
|
return (e = In()) !== null && e !== void 0 ? e : [];
|
|
@@ -1442,17 +1449,17 @@
|
|
|
1442
1449
|
var Qn = e.Children.toArray(f);
|
|
1443
1450
|
var Yn = Jn.some((function(e) {
|
|
1444
1451
|
var n = B()(Qn, (function(n) {
|
|
1445
|
-
return
|
|
1452
|
+
return fn(n) && n.props.value === e;
|
|
1446
1453
|
}));
|
|
1447
1454
|
return n && !n.props.disabled;
|
|
1448
1455
|
}));
|
|
1449
|
-
var Zn = ae === "immediately" ? Bn() :
|
|
1456
|
+
var Zn = ae === "immediately" ? Bn() : Ye;
|
|
1450
1457
|
var er = (0, e.useMemo)((function() {
|
|
1451
|
-
|
|
1458
|
+
wn.current = 0;
|
|
1452
1459
|
jn.current = undefined;
|
|
1453
1460
|
Pn.current = 0;
|
|
1454
1461
|
Sn.current = undefined;
|
|
1455
|
-
|
|
1462
|
+
yn.current = [];
|
|
1456
1463
|
var r = function e(n, r) {
|
|
1457
1464
|
return function(e) {
|
|
1458
1465
|
return Un(e, n, r);
|
|
@@ -1465,34 +1472,34 @@
|
|
|
1465
1472
|
var i;
|
|
1466
1473
|
var c = e.Children.toArray(f).reduce((function(c, s, d) {
|
|
1467
1474
|
// ignore Headings and Dividers
|
|
1468
|
-
if (!
|
|
1475
|
+
if (!fn(s)) {
|
|
1469
1476
|
c.push(s);
|
|
1470
1477
|
return c;
|
|
1471
1478
|
}
|
|
1472
1479
|
var f = s.props, p = f.disabled, v = f.hidden, b = f.label, m = f.value;
|
|
1473
1480
|
// Find out if the search string exactly matches a value
|
|
1474
|
-
if (m ===
|
|
1481
|
+
if (m === Le) {
|
|
1475
1482
|
t = true;
|
|
1476
1483
|
}
|
|
1477
1484
|
var y = Jn && Jn.indexOf(m) >= 0;
|
|
1478
1485
|
var g = !!y && !p && !i;
|
|
1479
1486
|
var h = o && !I && !O && !j && !_;
|
|
1480
|
-
var S =
|
|
1481
|
-
var
|
|
1487
|
+
var S = pn(m, b);
|
|
1488
|
+
var C = -1;
|
|
1482
1489
|
if (h && !p && !v) {
|
|
1483
|
-
|
|
1490
|
+
yn.current.push({
|
|
1484
1491
|
label: b,
|
|
1485
1492
|
value: m
|
|
1486
1493
|
});
|
|
1487
|
-
|
|
1494
|
+
C = yn.current.length - 1;
|
|
1488
1495
|
}
|
|
1489
1496
|
// Format the Menu.Item
|
|
1490
|
-
var
|
|
1497
|
+
var w = (0, e.cloneElement)(s, {
|
|
1491
1498
|
elementRef: r(S, g),
|
|
1492
1499
|
key: s.key || d,
|
|
1493
1500
|
onClick: Hn,
|
|
1494
1501
|
onKeyDown: h ? function(e) {
|
|
1495
|
-
return Kn(e,
|
|
1502
|
+
return Kn(e, C);
|
|
1496
1503
|
} : undefined,
|
|
1497
1504
|
selected: y,
|
|
1498
1505
|
multiple: I,
|
|
@@ -1508,21 +1515,21 @@
|
|
|
1508
1515
|
}));
|
|
1509
1516
|
a = true;
|
|
1510
1517
|
}
|
|
1511
|
-
c.splice(l, 0,
|
|
1518
|
+
c.splice(l, 0, w);
|
|
1512
1519
|
l += 1;
|
|
1513
1520
|
} else {
|
|
1514
|
-
c.push(
|
|
1521
|
+
c.push(w);
|
|
1515
1522
|
}
|
|
1516
1523
|
return c;
|
|
1517
1524
|
}), []);
|
|
1518
1525
|
// In multiple mode, add missing items
|
|
1519
1526
|
if (I) {
|
|
1520
|
-
|
|
1527
|
+
L()(Jn, (function(e) {
|
|
1521
1528
|
var o = B()(c, (function(n) {
|
|
1522
|
-
return
|
|
1529
|
+
return fn(n) && n.props && n.props.value === e;
|
|
1523
1530
|
}));
|
|
1524
1531
|
if (!o) {
|
|
1525
|
-
if (e ===
|
|
1532
|
+
if (e === Le) {
|
|
1526
1533
|
t = true;
|
|
1527
1534
|
}
|
|
1528
1535
|
var i = Zn && Zn.indexOf(e) >= 0;
|
|
@@ -1535,8 +1542,8 @@
|
|
|
1535
1542
|
a = true;
|
|
1536
1543
|
}
|
|
1537
1544
|
var d = String(e);
|
|
1538
|
-
var f =
|
|
1539
|
-
c.splice(i ? 0 : s + 1, 0, n().createElement(
|
|
1545
|
+
var f = pn(e, d);
|
|
1546
|
+
c.splice(i ? 0 : s + 1, 0, n().createElement(w, {
|
|
1540
1547
|
elementRef: r(f),
|
|
1541
1548
|
label: d,
|
|
1542
1549
|
value: e,
|
|
@@ -1553,15 +1560,15 @@
|
|
|
1553
1560
|
}
|
|
1554
1561
|
var p = O === "controlled";
|
|
1555
1562
|
// Filter the items
|
|
1556
|
-
var v = (0, ue.stringToKeywords)(
|
|
1563
|
+
var v = (0, ue.stringToKeywords)(Le);
|
|
1557
1564
|
c = p ? c : c.filter((function(e) {
|
|
1558
|
-
if (
|
|
1565
|
+
if (fn(e)) {
|
|
1559
1566
|
return (0, ue.testPhrase)(e.props.label, v);
|
|
1560
1567
|
}
|
|
1561
1568
|
return true;
|
|
1562
1569
|
// Keep all headers and non-interactive options
|
|
1563
1570
|
})).map((function(n) {
|
|
1564
|
-
if (!
|
|
1571
|
+
if (!fn(n)) {
|
|
1565
1572
|
return n;
|
|
1566
1573
|
}
|
|
1567
1574
|
// highlight matched text
|
|
@@ -1572,14 +1579,14 @@
|
|
|
1572
1579
|
});
|
|
1573
1580
|
}));
|
|
1574
1581
|
// Add the option to add the new value
|
|
1575
|
-
if (s && !t &&
|
|
1582
|
+
if (s && !t && Le) {
|
|
1576
1583
|
var b = a ? l + 1 : l;
|
|
1577
|
-
var m = "".concat(
|
|
1578
|
-
var y =
|
|
1579
|
-
c.splice(b, 0, n().createElement(
|
|
1584
|
+
var m = "".concat(Le, " (new value)");
|
|
1585
|
+
var y = pn(Le, m);
|
|
1586
|
+
c.splice(b, 0, n().createElement(w, {
|
|
1580
1587
|
elementRef: r(y),
|
|
1581
1588
|
label: m,
|
|
1582
|
-
value:
|
|
1589
|
+
value: Le,
|
|
1583
1590
|
key: "newValue",
|
|
1584
1591
|
multiple: I,
|
|
1585
1592
|
onClick: Hn
|
|
@@ -1591,7 +1598,7 @@
|
|
|
1591
1598
|
// Highlight the selected Items and remove hidden
|
|
1592
1599
|
c = c.reduce((function(n, r) {
|
|
1593
1600
|
// ignore Dividers & Headings
|
|
1594
|
-
if (!
|
|
1601
|
+
if (!fn(r)) {
|
|
1595
1602
|
n.push(r);
|
|
1596
1603
|
return n;
|
|
1597
1604
|
}
|
|
@@ -1600,11 +1607,11 @@
|
|
|
1600
1607
|
return n;
|
|
1601
1608
|
}
|
|
1602
1609
|
if (r.props.selected && !r.props.disabled && jn.current == null) {
|
|
1603
|
-
jn.current =
|
|
1610
|
+
jn.current = wn.current;
|
|
1604
1611
|
}
|
|
1605
1612
|
var t = g === Ee;
|
|
1606
1613
|
g += 1;
|
|
1607
|
-
|
|
1614
|
+
wn.current += 1;
|
|
1608
1615
|
Pn.current += r.props.selected ? 1 : 0;
|
|
1609
1616
|
if (r.key !== "newValue" && !r.props.disabled && !r.props.selected) {
|
|
1610
1617
|
h = false;
|
|
@@ -1626,15 +1633,15 @@
|
|
|
1626
1633
|
}), []);
|
|
1627
1634
|
En.current = Pn.current === 0 && "none" || h && "all" || "some";
|
|
1628
1635
|
// add select all option
|
|
1629
|
-
if (le === "checkbox" && I &&
|
|
1636
|
+
if (le === "checkbox" && I && wn.current > 0) {
|
|
1630
1637
|
var S;
|
|
1631
1638
|
if (En.current === "all") {
|
|
1632
|
-
if (
|
|
1639
|
+
if (Le === "") {
|
|
1633
1640
|
S = (0, d._)("Clear all");
|
|
1634
1641
|
} else {
|
|
1635
1642
|
S = (0, d._)("Clear all matches");
|
|
1636
1643
|
}
|
|
1637
|
-
} else if (
|
|
1644
|
+
} else if (Le === "") {
|
|
1638
1645
|
S = (0, d._)("Select all");
|
|
1639
1646
|
} else {
|
|
1640
1647
|
S = (0, d._)("Select all matches");
|
|
@@ -1658,16 +1665,16 @@
|
|
|
1658
1665
|
}));
|
|
1659
1666
|
}
|
|
1660
1667
|
kn.current = c.reduce((function(e, n) {
|
|
1661
|
-
if (
|
|
1668
|
+
if (fn(n)) {
|
|
1662
1669
|
e.push(n.props.value);
|
|
1663
1670
|
}
|
|
1664
1671
|
return e;
|
|
1665
1672
|
}), []);
|
|
1666
1673
|
return c;
|
|
1667
|
-
}), [ Ee, ke, o, s, f, Jn, O,
|
|
1674
|
+
}), [ Ee, ke, o, s, f, Jn, O, Le, Xn, Dn, Hn, Kn, Un, qn, j, I, Zn, _, le, Ue, me ]);
|
|
1668
1675
|
var nr = function e(r) {
|
|
1669
1676
|
var t = r.anchorWidth, o = r.maxHeight, a = r.placement;
|
|
1670
|
-
var i =
|
|
1677
|
+
var i = sn({
|
|
1671
1678
|
anchorWidth: t,
|
|
1672
1679
|
isMultiple: I,
|
|
1673
1680
|
maxHeight: o,
|
|
@@ -1676,12 +1683,12 @@
|
|
|
1676
1683
|
var u = Jn.length > 0 && !Yn && !O ? 0 : undefined;
|
|
1677
1684
|
var c = {
|
|
1678
1685
|
"aria-multiselectable": I || undefined,
|
|
1679
|
-
childrenStart: !!O && n().createElement(
|
|
1686
|
+
childrenStart: !!O && n().createElement(gn, {
|
|
1680
1687
|
activeItemId: ke,
|
|
1681
1688
|
filterA11yId: An,
|
|
1682
|
-
filterKeyword:
|
|
1689
|
+
filterKeyword: Le,
|
|
1683
1690
|
hasChildren: er.some((function(e) {
|
|
1684
|
-
return
|
|
1691
|
+
return fn(e);
|
|
1685
1692
|
})),
|
|
1686
1693
|
inputId: k,
|
|
1687
1694
|
inputRef: x,
|
|
@@ -1713,7 +1720,7 @@
|
|
|
1713
1720
|
};
|
|
1714
1721
|
if (be) {
|
|
1715
1722
|
|
|
1716
|
-
return n().createElement(ee.VirtualizedResultsMenu,
|
|
1723
|
+
return n().createElement(ee.VirtualizedResultsMenu, We({
|
|
1717
1724
|
virtualization: be
|
|
1718
1725
|
}, c), er);
|
|
1719
1726
|
}
|
|
@@ -1722,7 +1729,7 @@
|
|
|
1722
1729
|
};
|
|
1723
1730
|
var rr = (0, e.useMemo)((function() {
|
|
1724
1731
|
|
|
1725
|
-
return n().createElement(
|
|
1732
|
+
return n().createElement(On, We({
|
|
1726
1733
|
appearance: i,
|
|
1727
1734
|
append: c,
|
|
1728
1735
|
currentValues: In(),
|
|
@@ -1731,7 +1738,7 @@
|
|
|
1731
1738
|
disabled: y,
|
|
1732
1739
|
elementRef: Gn,
|
|
1733
1740
|
error: h,
|
|
1734
|
-
inline:
|
|
1741
|
+
inline: C,
|
|
1735
1742
|
labelText: E,
|
|
1736
1743
|
labelledBy: P,
|
|
1737
1744
|
multiple: I,
|
|
@@ -1744,33 +1751,33 @@
|
|
|
1744
1751
|
toggle: me,
|
|
1745
1752
|
toggleContent: ge
|
|
1746
1753
|
}, he), f);
|
|
1747
|
-
}), [ i, c, In, I, m, y, h, Gn,
|
|
1754
|
+
}), [ i, c, In, I, m, y, h, Gn, C, E, P, z, J, Y, Z, U, de, me, ge, he, f ]);
|
|
1748
1755
|
|
|
1749
1756
|
return n().createElement(Q(), {
|
|
1750
|
-
closeReasons:
|
|
1757
|
+
closeReasons: dn,
|
|
1751
1758
|
inputId: k,
|
|
1752
1759
|
"aria-labelledby": An,
|
|
1753
1760
|
toggle: rr,
|
|
1754
|
-
onRequestOpen:
|
|
1755
|
-
onRequestClose:
|
|
1756
|
-
open:
|
|
1761
|
+
onRequestOpen: Tn,
|
|
1762
|
+
onRequestClose: Ln,
|
|
1763
|
+
open: Fe,
|
|
1757
1764
|
openWithArrowKeys: true,
|
|
1758
1765
|
repositionMode: te,
|
|
1759
1766
|
defaultPlacement: v,
|
|
1760
|
-
canCoverAnchor:
|
|
1767
|
+
canCoverAnchor: qe().innerHeight < 500,
|
|
1761
1768
|
retainFocus: false,
|
|
1762
1769
|
takeFocus: Jn.length === 0 || Jn.length > 0 && !Yn || !!O
|
|
1763
1770
|
}, nr);
|
|
1764
1771
|
}
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
/* harmony default export */ const
|
|
1772
|
+
Sn.propTypes = un;
|
|
1773
|
+
Sn.componentType = "SelectBase";
|
|
1774
|
+
Sn.Option = w;
|
|
1775
|
+
Sn.Divider = u.Divider;
|
|
1776
|
+
Sn.Heading = u.Heading;
|
|
1777
|
+
/* harmony default export */ const Cn = Sn;
|
|
1771
1778
|
// CONCATENATED MODULE: ./src/Multiselect/Compact.tsx
|
|
1772
|
-
function
|
|
1773
|
-
return
|
|
1779
|
+
function wn() {
|
|
1780
|
+
return wn = Object.assign ? Object.assign.bind() : function(e) {
|
|
1774
1781
|
for (var n = 1; n < arguments.length; n++) {
|
|
1775
1782
|
var r = arguments[n];
|
|
1776
1783
|
for (var t in r) {
|
|
@@ -1778,11 +1785,11 @@
|
|
|
1778
1785
|
}
|
|
1779
1786
|
}
|
|
1780
1787
|
return e;
|
|
1781
|
-
},
|
|
1788
|
+
}, wn.apply(null, arguments);
|
|
1782
1789
|
}
|
|
1783
|
-
function
|
|
1790
|
+
function kn(e, n) {
|
|
1784
1791
|
if (null == e) return {};
|
|
1785
|
-
var r, t, o =
|
|
1792
|
+
var r, t, o = xn(e, n);
|
|
1786
1793
|
if (Object.getOwnPropertySymbols) {
|
|
1787
1794
|
var l = Object.getOwnPropertySymbols(e);
|
|
1788
1795
|
for (t = 0; t < l.length; t++) {
|
|
@@ -1791,7 +1798,7 @@
|
|
|
1791
1798
|
}
|
|
1792
1799
|
return o;
|
|
1793
1800
|
}
|
|
1794
|
-
function
|
|
1801
|
+
function xn(e, n) {
|
|
1795
1802
|
if (null == e) return {};
|
|
1796
1803
|
var r = {};
|
|
1797
1804
|
for (var t in e) {
|
|
@@ -1802,7 +1809,7 @@
|
|
|
1802
1809
|
}
|
|
1803
1810
|
return r;
|
|
1804
1811
|
}
|
|
1805
|
-
var
|
|
1812
|
+
var jn = {
|
|
1806
1813
|
allowNewValues: l().bool,
|
|
1807
1814
|
animateLoading: l().bool,
|
|
1808
1815
|
children: l().node,
|
|
@@ -1840,11 +1847,11 @@
|
|
|
1840
1847
|
virtualization: l().number
|
|
1841
1848
|
};
|
|
1842
1849
|
// TS: not typed controlled/uncontrolled, handled by Multiselect wrapper component
|
|
1843
|
-
var
|
|
1844
|
-
var
|
|
1845
|
-
var
|
|
1846
|
-
function
|
|
1847
|
-
var t = r.allowNewValues, o = r.animateLoading, l = r.children, a = r.controlledFilter, i = r.defaultPlacement, u = i === void 0 ? "vertical" : i, c = r.defaultValues, s = r.describedBy, d = r.disabled, f = r.elementRef, p = r.error, v = r.filter, b = r.footerMessage, m = r.inline, y = r.inputId, g = r.inputRef, h = r.isLoadingOptions, O = r.labelledBy, S = r.loadingMessage,
|
|
1850
|
+
var Pn = {};
|
|
1851
|
+
var En = (0, d._)("No matches");
|
|
1852
|
+
var Rn = (0, d._)("Select...");
|
|
1853
|
+
function Mn(r) {
|
|
1854
|
+
var t = r.allowNewValues, o = r.animateLoading, l = r.children, a = r.controlledFilter, i = r.defaultPlacement, u = i === void 0 ? "vertical" : i, c = r.defaultValues, s = r.describedBy, d = r.disabled, f = r.elementRef, p = r.error, v = r.filter, b = r.footerMessage, m = r.inline, y = r.inputId, g = r.inputRef, h = r.isLoadingOptions, O = r.labelledBy, S = r.loadingMessage, C = r.menuStyle, k = C === void 0 ? Pn : C, x = r.name, j = r.noOptionsMessage, P = j === void 0 ? En : j, E = r.onChange, R = r.onClose, M = r.onFilterChange, A = r.onOpen, I = r.onScroll, B = r.onScrollBottom, T = r.placeholder, L = T === void 0 ? Rn : T, N = r.repositionMode, V = r.selectAllAppearance, q = r.showSelectedValuesFirst, D = q === void 0 ? "nextOpen" : q, F = r.tabConfirmsNewValue, _ = r.values, H = r.virtualization, K = kn(r, [ "allowNewValues", "animateLoading", "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", "repositionMode", "selectAllAppearance", "showSelectedValuesFirst", "tabConfirmsNewValue", "values", "virtualization" ]);
|
|
1848
1855
|
// @docs-props-type CompactPropsBase
|
|
1849
1856
|
if (false) {}
|
|
1850
1857
|
var z = true;
|
|
@@ -1856,11 +1863,11 @@
|
|
|
1856
1863
|
}
|
|
1857
1864
|
var $ = {
|
|
1858
1865
|
children: e.Children.toArray(l).map((function(e) {
|
|
1859
|
-
if (
|
|
1866
|
+
if (fn(e)) {
|
|
1860
1867
|
var r;
|
|
1861
1868
|
var t = (r = e.key) !== null && r !== void 0 ? r : "".concat(e.props.label, "-").concat(e.props.value);
|
|
1862
1869
|
|
|
1863
|
-
return n().createElement(
|
|
1870
|
+
return n().createElement(w, wn({
|
|
1864
1871
|
key: t
|
|
1865
1872
|
}, e.props, {
|
|
1866
1873
|
multiple: true
|
|
@@ -1877,7 +1884,7 @@
|
|
|
1877
1884
|
$.values = _;
|
|
1878
1885
|
}
|
|
1879
1886
|
|
|
1880
|
-
return n().createElement(
|
|
1887
|
+
return n().createElement(Cn, wn({
|
|
1881
1888
|
allowNewValues: t,
|
|
1882
1889
|
animateLoading: o,
|
|
1883
1890
|
describedBy: s,
|
|
@@ -1901,8 +1908,8 @@
|
|
|
1901
1908
|
onOpen: A,
|
|
1902
1909
|
onScroll: I,
|
|
1903
1910
|
onScrollBottom: B,
|
|
1904
|
-
placeholder:
|
|
1905
|
-
repositionMode:
|
|
1911
|
+
placeholder: L,
|
|
1912
|
+
repositionMode: N,
|
|
1906
1913
|
selectAllAppearance: V,
|
|
1907
1914
|
showSelectedValuesFirst: D,
|
|
1908
1915
|
tabConfirmsNewValue: F,
|
|
@@ -1911,45 +1918,45 @@
|
|
|
1911
1918
|
multiple: true
|
|
1912
1919
|
}));
|
|
1913
1920
|
}
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
/* harmony default export */ const
|
|
1921
|
+
Mn.propTypes = jn;
|
|
1922
|
+
Mn.Option = R;
|
|
1923
|
+
Mn.Divider = u.Divider;
|
|
1924
|
+
Mn.Heading = u.Heading;
|
|
1925
|
+
/* harmony default export */ const An = Mn;
|
|
1919
1926
|
// CONCATENATED MODULE: external "lodash/defer"
|
|
1920
|
-
const
|
|
1921
|
-
var
|
|
1927
|
+
const In = require("lodash/defer");
|
|
1928
|
+
var Bn = r.n(In);
|
|
1922
1929
|
// CONCATENATED MODULE: external "lodash/get"
|
|
1923
|
-
const
|
|
1924
|
-
var
|
|
1930
|
+
const Tn = require("lodash/get");
|
|
1931
|
+
var Ln = r.n(Tn);
|
|
1925
1932
|
// CONCATENATED MODULE: external "lodash/isString"
|
|
1926
|
-
const
|
|
1927
|
-
var
|
|
1933
|
+
const Nn = require("lodash/isString");
|
|
1934
|
+
var Vn = r.n(Nn);
|
|
1928
1935
|
// CONCATENATED MODULE: external "lodash/keys"
|
|
1929
|
-
const
|
|
1930
|
-
var
|
|
1936
|
+
const qn = require("lodash/keys");
|
|
1937
|
+
var Dn = r.n(qn);
|
|
1931
1938
|
// CONCATENATED MODULE: external "lodash/last"
|
|
1932
|
-
const
|
|
1933
|
-
var
|
|
1939
|
+
const Fn = require("lodash/last");
|
|
1940
|
+
var _n = r.n(Fn);
|
|
1934
1941
|
// CONCATENATED MODULE: external "lodash/omit"
|
|
1935
|
-
const
|
|
1936
|
-
var
|
|
1942
|
+
const Hn = require("lodash/omit");
|
|
1943
|
+
var Kn = r.n(Hn);
|
|
1937
1944
|
// CONCATENATED MODULE: external "lodash/pickBy"
|
|
1938
|
-
const
|
|
1939
|
-
var
|
|
1945
|
+
const zn = require("lodash/pickBy");
|
|
1946
|
+
var $n = r.n(zn);
|
|
1940
1947
|
// CONCATENATED MODULE: external "@splunk/react-ui/Popover"
|
|
1941
|
-
const
|
|
1942
|
-
var
|
|
1948
|
+
const Wn = require("@splunk/react-ui/Popover");
|
|
1949
|
+
var Xn = r.n(Wn);
|
|
1943
1950
|
// CONCATENATED MODULE: external "@splunk/ui-utils/format"
|
|
1944
|
-
const
|
|
1951
|
+
const Un = require("@splunk/ui-utils/format");
|
|
1945
1952
|
// CONCATENATED MODULE: external "@splunk/react-ui/Box"
|
|
1946
|
-
const
|
|
1947
|
-
var
|
|
1953
|
+
const Gn = require("@splunk/react-ui/Box");
|
|
1954
|
+
var Jn = r.n(Gn);
|
|
1948
1955
|
// CONCATENATED MODULE: external "@splunk/react-ui/Chip"
|
|
1949
|
-
const
|
|
1950
|
-
var
|
|
1956
|
+
const Qn = require("@splunk/react-ui/Chip");
|
|
1957
|
+
var Yn = r.n(Qn);
|
|
1951
1958
|
// CONCATENATED MODULE: ./src/Multiselect/NormalStyles.ts
|
|
1952
|
-
var
|
|
1959
|
+
var Zn = be()(Jn()).withConfig({
|
|
1953
1960
|
displayName: "NormalStyles__StyledBox",
|
|
1954
1961
|
componentId: "sc-1uwwpco-0"
|
|
1955
1962
|
})([ "display:flex;align-items:center;flex-wrap:wrap;gap:", ";border-radius:", ";min-width:200px;min-height:", ";max-height:300px;overflow-y:auto;border:", " solid ", ";padding-inline:", ";background-color:", ";", " ", " ", " ", " ", " &[data-inline]{width:400px;}" ], Oe.variables.spacingXSmall, Oe.variables.borderRadius, Oe.variables.inputHeight, Oe.variables.inputBorderWidth, Oe.variables.interactiveColorBorder, Oe.variables.spacingXSmall, Oe.variables.interactiveColorBackground, (function(e) {
|
|
@@ -1968,37 +1975,32 @@
|
|
|
1968
1975
|
var n = e.$popoverOpen;
|
|
1969
1976
|
return n && (0, ve.css)([ "position:relative;z-index:calc(", " - 2);" ], Oe.variables.zindexFixedNavbar);
|
|
1970
1977
|
}));
|
|
1971
|
-
var
|
|
1978
|
+
var er = be().span.withConfig({
|
|
1972
1979
|
displayName: "NormalStyles__StyledButtonsWrapper",
|
|
1973
1980
|
componentId: "sc-1uwwpco-1"
|
|
1974
1981
|
})([ "display:contents;" ]);
|
|
1975
|
-
var
|
|
1982
|
+
var nr = be().input.withConfig({
|
|
1976
1983
|
displayName: "NormalStyles__StyledInput",
|
|
1977
1984
|
componentId: "sc-1uwwpco-2"
|
|
1978
1985
|
})([ "", ";flex:1 0 auto;max-width:100%;" ], Oe.mixins.reset("block"));
|
|
1979
|
-
var
|
|
1980
|
-
displayName: "NormalStyles__StyledOverlay",
|
|
1981
|
-
componentId: "sc-1uwwpco-3"
|
|
1982
|
-
})([ "", "" ], (function(e) {
|
|
1983
|
-
var n = e.$popoveropen;
|
|
1984
|
-
return n && (0, ve.css)([ "position:fixed;top:0;left:0;width:100%;height:100%;z-index:calc(", " - 2);" ], Oe.variables.zindexFixedNavbar);
|
|
1985
|
-
}));
|
|
1986
|
-
// TODO(SUI-7436): remove the customized style of Chip
|
|
1987
|
-
var Zn = be()(Un()).withConfig({
|
|
1986
|
+
var rr = be()(Yn()).withConfig({
|
|
1988
1987
|
displayName: "NormalStyles__StyledChip",
|
|
1989
|
-
componentId: "sc-1uwwpco-
|
|
1990
|
-
})([ "
|
|
1988
|
+
componentId: "sc-1uwwpco-3"
|
|
1989
|
+
})([ "line-height:1.1429;height:auto;", ";&:not([disabled]):focus{box-shadow:", ";}" ], (0,
|
|
1990
|
+
Oe.pick)({
|
|
1991
|
+
compact: (0, ve.css)([ "padding-block:2px;" ])
|
|
1992
|
+
}), Oe.variables.focusShadowInset);
|
|
1991
1993
|
// CONCATENATED MODULE: ./src/Multiselect/Normal.tsx
|
|
1992
|
-
function
|
|
1994
|
+
function tr(e) {
|
|
1993
1995
|
"@babel/helpers - typeof";
|
|
1994
|
-
return
|
|
1996
|
+
return tr = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
|
|
1995
1997
|
return typeof e;
|
|
1996
1998
|
} : function(e) {
|
|
1997
1999
|
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
1998
|
-
},
|
|
2000
|
+
}, tr(e);
|
|
1999
2001
|
}
|
|
2000
|
-
function
|
|
2001
|
-
return
|
|
2002
|
+
function or() {
|
|
2003
|
+
return or = Object.assign ? Object.assign.bind() : function(e) {
|
|
2002
2004
|
for (var n = 1; n < arguments.length; n++) {
|
|
2003
2005
|
var r = arguments[n];
|
|
2004
2006
|
for (var t in r) {
|
|
@@ -2006,41 +2008,41 @@
|
|
|
2006
2008
|
}
|
|
2007
2009
|
}
|
|
2008
2010
|
return e;
|
|
2009
|
-
},
|
|
2011
|
+
}, or.apply(null, arguments);
|
|
2010
2012
|
}
|
|
2011
|
-
function
|
|
2012
|
-
return
|
|
2013
|
+
function lr(e) {
|
|
2014
|
+
return ur(e) || ir(e) || dr(e) || ar();
|
|
2013
2015
|
}
|
|
2014
|
-
function
|
|
2016
|
+
function ar() {
|
|
2015
2017
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2016
2018
|
}
|
|
2017
|
-
function
|
|
2019
|
+
function ir(e) {
|
|
2018
2020
|
if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"]) return Array.from(e);
|
|
2019
2021
|
}
|
|
2020
|
-
function
|
|
2021
|
-
if (Array.isArray(e)) return
|
|
2022
|
+
function ur(e) {
|
|
2023
|
+
if (Array.isArray(e)) return fr(e);
|
|
2022
2024
|
}
|
|
2023
|
-
function
|
|
2024
|
-
return
|
|
2025
|
+
function cr(e, n) {
|
|
2026
|
+
return vr(e) || pr(e, n) || dr(e, n) || sr();
|
|
2025
2027
|
}
|
|
2026
|
-
function
|
|
2028
|
+
function sr() {
|
|
2027
2029
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2028
2030
|
}
|
|
2029
|
-
function
|
|
2031
|
+
function dr(e, n) {
|
|
2030
2032
|
if (e) {
|
|
2031
|
-
if ("string" == typeof e) return
|
|
2033
|
+
if ("string" == typeof e) return fr(e, n);
|
|
2032
2034
|
var r = {}.toString.call(e).slice(8, -1);
|
|
2033
|
-
return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ?
|
|
2035
|
+
return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? fr(e, n) : void 0;
|
|
2034
2036
|
}
|
|
2035
2037
|
}
|
|
2036
|
-
function
|
|
2038
|
+
function fr(e, n) {
|
|
2037
2039
|
(null == n || n > e.length) && (n = e.length);
|
|
2038
2040
|
for (var r = 0, t = Array(n); r < n; r++) {
|
|
2039
2041
|
t[r] = e[r];
|
|
2040
2042
|
}
|
|
2041
2043
|
return t;
|
|
2042
2044
|
}
|
|
2043
|
-
function
|
|
2045
|
+
function pr(e, n) {
|
|
2044
2046
|
var r = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
2045
2047
|
if (null != r) {
|
|
2046
2048
|
var t, o, l, a, i = [], u = !0, c = !1;
|
|
@@ -2062,12 +2064,12 @@
|
|
|
2062
2064
|
return i;
|
|
2063
2065
|
}
|
|
2064
2066
|
}
|
|
2065
|
-
function
|
|
2067
|
+
function vr(e) {
|
|
2066
2068
|
if (Array.isArray(e)) return e;
|
|
2067
2069
|
}
|
|
2068
|
-
function
|
|
2070
|
+
function br(e, n) {
|
|
2069
2071
|
if (null == e) return {};
|
|
2070
|
-
var r, t, o =
|
|
2072
|
+
var r, t, o = mr(e, n);
|
|
2071
2073
|
if (Object.getOwnPropertySymbols) {
|
|
2072
2074
|
var l = Object.getOwnPropertySymbols(e);
|
|
2073
2075
|
for (t = 0; t < l.length; t++) {
|
|
@@ -2076,7 +2078,7 @@
|
|
|
2076
2078
|
}
|
|
2077
2079
|
return o;
|
|
2078
2080
|
}
|
|
2079
|
-
function
|
|
2081
|
+
function mr(e, n) {
|
|
2080
2082
|
if (null == e) return {};
|
|
2081
2083
|
var r = {};
|
|
2082
2084
|
for (var t in e) {
|
|
@@ -2087,7 +2089,7 @@
|
|
|
2087
2089
|
}
|
|
2088
2090
|
return r;
|
|
2089
2091
|
}
|
|
2090
|
-
function
|
|
2092
|
+
function yr(e, n) {
|
|
2091
2093
|
var r = Object.keys(e);
|
|
2092
2094
|
if (Object.getOwnPropertySymbols) {
|
|
2093
2095
|
var t = Object.getOwnPropertySymbols(e);
|
|
@@ -2097,40 +2099,40 @@
|
|
|
2097
2099
|
}
|
|
2098
2100
|
return r;
|
|
2099
2101
|
}
|
|
2100
|
-
function
|
|
2102
|
+
function gr(e) {
|
|
2101
2103
|
for (var n = 1; n < arguments.length; n++) {
|
|
2102
2104
|
var r = null != arguments[n] ? arguments[n] : {};
|
|
2103
|
-
n % 2 ?
|
|
2104
|
-
|
|
2105
|
-
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) :
|
|
2105
|
+
n % 2 ? yr(Object(r), !0).forEach((function(n) {
|
|
2106
|
+
hr(e, n, r[n]);
|
|
2107
|
+
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : yr(Object(r)).forEach((function(n) {
|
|
2106
2108
|
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
|
|
2107
2109
|
}));
|
|
2108
2110
|
}
|
|
2109
2111
|
return e;
|
|
2110
2112
|
}
|
|
2111
|
-
function
|
|
2112
|
-
return (n =
|
|
2113
|
+
function hr(e, n, r) {
|
|
2114
|
+
return (n = Or(n)) in e ? Object.defineProperty(e, n, {
|
|
2113
2115
|
value: r,
|
|
2114
2116
|
enumerable: !0,
|
|
2115
2117
|
configurable: !0,
|
|
2116
2118
|
writable: !0
|
|
2117
2119
|
}) : e[n] = r, e;
|
|
2118
2120
|
}
|
|
2119
|
-
function
|
|
2120
|
-
var n =
|
|
2121
|
-
return "symbol" ==
|
|
2121
|
+
function Or(e) {
|
|
2122
|
+
var n = Sr(e, "string");
|
|
2123
|
+
return "symbol" == tr(n) ? n : n + "";
|
|
2122
2124
|
}
|
|
2123
|
-
function
|
|
2124
|
-
if ("object" !=
|
|
2125
|
+
function Sr(e, n) {
|
|
2126
|
+
if ("object" != tr(e) || !e) return e;
|
|
2125
2127
|
var r = e[Symbol.toPrimitive];
|
|
2126
2128
|
if (void 0 !== r) {
|
|
2127
2129
|
var t = r.call(e, n || "default");
|
|
2128
|
-
if ("object" !=
|
|
2130
|
+
if ("object" != tr(t)) return t;
|
|
2129
2131
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2130
2132
|
}
|
|
2131
2133
|
return ("string" === n ? String : Number)(e);
|
|
2132
2134
|
}
|
|
2133
|
-
var
|
|
2135
|
+
var Cr = {
|
|
2134
2136
|
allowNewValues: l().bool,
|
|
2135
2137
|
animateLoading: l().bool,
|
|
2136
2138
|
children: l().node,
|
|
@@ -2162,32 +2164,31 @@
|
|
|
2162
2164
|
required: l().bool,
|
|
2163
2165
|
repositionMode: l().oneOf([ "none", "flip" ]),
|
|
2164
2166
|
tabConfirmsNewValue: l().bool,
|
|
2165
|
-
useClickawayOverlay: l().bool,
|
|
2166
2167
|
values: l().array
|
|
2167
2168
|
};
|
|
2168
|
-
var
|
|
2169
|
+
var wr = D()((function(e) {
|
|
2169
2170
|
return {
|
|
2170
2171
|
flexBasis: e,
|
|
2171
2172
|
width: e
|
|
2172
2173
|
};
|
|
2173
2174
|
}));
|
|
2174
2175
|
// export for testing purpose
|
|
2175
|
-
var
|
|
2176
|
+
var kr = D()((function(e) {
|
|
2176
2177
|
var n = e.anchorWidth, r = n === void 0 ? 0 : n, t = e.maxHeight, o = e.menuStyle;
|
|
2177
|
-
return
|
|
2178
|
+
return gr({
|
|
2178
2179
|
maxHeight: t,
|
|
2179
2180
|
overflow: "auto",
|
|
2180
2181
|
width: Math.max(r, 200)
|
|
2181
2182
|
}, o || {});
|
|
2182
2183
|
}));
|
|
2183
2184
|
// TS: not typed controlled/uncontrolled, handled by Multiselect wrapper component
|
|
2184
|
-
var
|
|
2185
|
-
var
|
|
2186
|
-
var
|
|
2187
|
-
function
|
|
2188
|
-
var t = r.allowNewValues, o = r.animateLoading, l = r.children, a = r.controlledFilter, u = r.defaultPlacement, c = u === void 0 ? "vertical" : u, f = r.defaultValues, p = r.describedBy, v = r.disabled, b = r.elementRef, m = r.error, y = r.footerMessage, g = r.inline, h = r.inputId, O = r.inputRef, S = r.isLoadingOptions,
|
|
2185
|
+
var xr = {};
|
|
2186
|
+
var jr = (0, d._)("No matches");
|
|
2187
|
+
var Pr = (0, d._)("Select...");
|
|
2188
|
+
function Er(r) {
|
|
2189
|
+
var t = r.allowNewValues, o = r.animateLoading, l = r.children, a = r.controlledFilter, u = r.defaultPlacement, c = u === void 0 ? "vertical" : u, f = r.defaultValues, p = r.describedBy, v = r.disabled, b = r.elementRef, m = r.error, y = r.footerMessage, g = r.inline, h = r.inputId, O = r.inputRef, S = r.isLoadingOptions, C = r.labelledBy, w = r.loadingMessage, k = r.menuStyle, x = k === void 0 ? xr : k, j = r.name, P = r.noOptionsMessage, E = P === void 0 ? jr : P, M = r.onChange, A = r.onClose, I = r.onFilterChange, B = r.onScroll, T = r.onScrollBottom, L = r.onOpen, N = r.placeholder, V = N === void 0 ? Pr : N, q = r.required, D = r.repositionMode, F = r.tabConfirmsNewValue, _ = r.values, H = br(r, [ "allowNewValues", "animateLoading", "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", "required", "repositionMode", "tabConfirmsNewValue", "values" ]);
|
|
2189
2190
|
// @docs-props-type NormalPropsBase
|
|
2190
|
-
var
|
|
2191
|
+
var K = s()({
|
|
2191
2192
|
componentName: "Multiselect",
|
|
2192
2193
|
/* eslint-disable-next-line prefer-rest-params */
|
|
2193
2194
|
componentProps: arguments[0],
|
|
@@ -2196,215 +2197,215 @@
|
|
|
2196
2197
|
valuePropName: "values"
|
|
2197
2198
|
});
|
|
2198
2199
|
if (false) {}
|
|
2199
|
-
var
|
|
2200
|
-
var
|
|
2201
|
-
var
|
|
2202
|
-
var
|
|
2203
|
-
var
|
|
2204
|
-
var
|
|
2205
|
-
var
|
|
2206
|
-
var
|
|
2207
|
-
var
|
|
2208
|
-
var
|
|
2200
|
+
var z = (0, e.useState)(0), W = cr(z, 2), X = W[0], U = W[1];
|
|
2201
|
+
var G = (0, e.useState)(null), J = cr(G, 2), Q = J[0], Y = J[1];
|
|
2202
|
+
var Z = (0, e.useState)(""), ee = cr(Z, 2), re = ee[0], te = ee[1];
|
|
2203
|
+
var oe = (0, e.useState)(false), ae = cr(oe, 2), ie = ae[0], de = ae[1];
|
|
2204
|
+
var fe = (0, e.useState)(false), pe = cr(fe, 2), ve = pe[0], be = pe[1];
|
|
2205
|
+
var me = (0, e.useState)(f || []), ye = cr(me, 2), ge = ye[0], he = ye[1];
|
|
2206
|
+
var Oe = (0, e.useState)(""), Se = cr(Oe, 2), Ce = Se[0], we = Se[1];
|
|
2207
|
+
var ke = K && _ ? _ : ge;
|
|
2208
|
+
var xe = ke.slice(0);
|
|
2209
|
+
var je = ke.indexOf(re) >= 0;
|
|
2210
|
+
var Pe = (0, e.useRef)(null);
|
|
2209
2211
|
var Ee = (0, e.useRef)(null);
|
|
2210
|
-
var Re = (0, e.useRef)(
|
|
2211
|
-
var Me = (0, e.useRef)(
|
|
2212
|
-
var Ae = (0, e.
|
|
2213
|
-
var Be = (0, e.useState)((function() {
|
|
2212
|
+
var Re = (0, e.useRef)(undefined);
|
|
2213
|
+
var Me = (0, e.useRef)(0);
|
|
2214
|
+
var Ae = (0, e.useState)((function() {
|
|
2214
2215
|
return {
|
|
2215
2216
|
activeItemId: (0, ce.createDOMID)("active-item"),
|
|
2216
2217
|
popoverId: (0, ce.createDOMID)("popover")
|
|
2217
2218
|
};
|
|
2218
|
-
})),
|
|
2219
|
+
})), Be = cr(Ae, 1), Te = Be[0], Le = Te.activeItemId, Ne = Te.popoverId;
|
|
2219
2220
|
(0, e.useEffect)((function() {
|
|
2220
|
-
if (
|
|
2221
|
-
|
|
2222
|
-
|
|
2221
|
+
if (K) {
|
|
2222
|
+
te("");
|
|
2223
|
+
U(0);
|
|
2223
2224
|
}
|
|
2224
|
-
}), [
|
|
2225
|
-
var
|
|
2225
|
+
}), [ _, K ]);
|
|
2226
|
+
var Ve = (0, e.useCallback)((function(e) {
|
|
2226
2227
|
var n = e.resetFilterKeyword;
|
|
2227
|
-
if (!
|
|
2228
|
-
|
|
2228
|
+
if (!ve) {
|
|
2229
|
+
te((function(e) {
|
|
2229
2230
|
return n ? "" : e;
|
|
2230
2231
|
}));
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
}
|
|
2235
|
-
}), [
|
|
2236
|
-
var
|
|
2237
|
-
if (
|
|
2238
|
-
|
|
2232
|
+
de(true);
|
|
2233
|
+
be(true);
|
|
2234
|
+
L === null || L === void 0 ? void 0 : L();
|
|
2235
|
+
}
|
|
2236
|
+
}), [ ve, L ]);
|
|
2237
|
+
var qe = (0, e.useCallback)((function() {
|
|
2238
|
+
if (ie) {
|
|
2239
|
+
Ve({
|
|
2239
2240
|
resetFilterKeyword: false
|
|
2240
2241
|
});
|
|
2241
2242
|
} else {
|
|
2242
2243
|
var e;
|
|
2243
|
-
(e =
|
|
2244
|
+
(e = Pe.current) === null || e === void 0 ? void 0 : e.focus();
|
|
2244
2245
|
}
|
|
2245
|
-
}), [
|
|
2246
|
-
var
|
|
2247
|
-
if (!
|
|
2246
|
+
}), [ ie, Ve ]);
|
|
2247
|
+
var De = (0, e.useCallback)((function(e, n) {
|
|
2248
|
+
if (!ve) {
|
|
2248
2249
|
return;
|
|
2249
2250
|
}
|
|
2250
|
-
var r = (
|
|
2251
|
-
if (!
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2251
|
+
var r = (ke || []).concat([ n ]);
|
|
2252
|
+
if (!K) {
|
|
2253
|
+
he(r);
|
|
2254
|
+
U(0);
|
|
2255
|
+
be(true);
|
|
2256
|
+
te("");
|
|
2256
2257
|
}
|
|
2257
2258
|
M === null || M === void 0 ? void 0 : M(e, {
|
|
2258
2259
|
values: r,
|
|
2259
2260
|
name: j
|
|
2260
2261
|
});
|
|
2261
|
-
}), [
|
|
2262
|
-
var
|
|
2263
|
-
var r = $()(
|
|
2264
|
-
if (!
|
|
2265
|
-
|
|
2262
|
+
}), [ ve, ke, K, M, j ]);
|
|
2263
|
+
var Fe = (0, e.useCallback)((function(e, n) {
|
|
2264
|
+
var r = $()(ke, n);
|
|
2265
|
+
if (!K) {
|
|
2266
|
+
he(r);
|
|
2266
2267
|
}
|
|
2267
2268
|
M === null || M === void 0 ? void 0 : M(e, {
|
|
2268
2269
|
values: r,
|
|
2269
2270
|
name: j
|
|
2270
2271
|
});
|
|
2271
|
-
}), [
|
|
2272
|
-
var
|
|
2273
|
-
if (
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
}
|
|
2277
|
-
}), [
|
|
2278
|
-
var
|
|
2272
|
+
}), [ ke, K, j, M ]);
|
|
2273
|
+
var He = (0, e.useCallback)((function(e) {
|
|
2274
|
+
if (ve && !S) {
|
|
2275
|
+
T === null || T === void 0 ? void 0 : T(e);
|
|
2276
|
+
we("".concat(Me.current, " options, loading more options"));
|
|
2277
|
+
}
|
|
2278
|
+
}), [ ve, S, T ]);
|
|
2279
|
+
var Ke = (0, e.useCallback)((function(e, n) {
|
|
2279
2280
|
var r = n.value;
|
|
2280
|
-
|
|
2281
|
-
return
|
|
2281
|
+
Bn()((function() {
|
|
2282
|
+
return Fe(e, r);
|
|
2282
2283
|
}));
|
|
2283
|
-
}), [
|
|
2284
|
-
var
|
|
2285
|
-
if (
|
|
2284
|
+
}), [ Fe ]);
|
|
2285
|
+
var ze = (0, e.useCallback)((function(e) {
|
|
2286
|
+
if (re !== "") {
|
|
2286
2287
|
I === null || I === void 0 ? void 0 : I(e, {
|
|
2287
2288
|
keyword: ""
|
|
2288
2289
|
});
|
|
2289
2290
|
}
|
|
2290
|
-
|
|
2291
|
+
Ve({
|
|
2291
2292
|
resetFilterKeyword: true
|
|
2292
2293
|
});
|
|
2293
|
-
}), [
|
|
2294
|
-
var
|
|
2294
|
+
}), [ re, I, Ve ]);
|
|
2295
|
+
var $e = (0, e.useCallback)((function(n) {
|
|
2295
2296
|
var r;
|
|
2296
2297
|
var t = (0, se.keycode)(n.nativeEvent);
|
|
2297
|
-
if (t === "tab" &&
|
|
2298
|
-
if (F &&
|
|
2298
|
+
if (t === "tab" && ve) {
|
|
2299
|
+
if (F && Re.current !== undefined && Me.current <= 1) {
|
|
2299
2300
|
var o;
|
|
2300
2301
|
n.preventDefault();
|
|
2301
|
-
|
|
2302
|
-
(o =
|
|
2302
|
+
De(n, Re.current);
|
|
2303
|
+
(o = Pe.current) === null || o === void 0 ? void 0 : o.focus();
|
|
2303
2304
|
} else {
|
|
2304
|
-
|
|
2305
|
+
be(false);
|
|
2305
2306
|
}
|
|
2306
2307
|
}
|
|
2307
2308
|
if (n.shiftKey || n.metaKey || n.ctrlKey) {
|
|
2308
2309
|
return;
|
|
2309
2310
|
}
|
|
2310
|
-
if (t === "end" &&
|
|
2311
|
+
if (t === "end" && ve) {
|
|
2311
2312
|
n.preventDefault();
|
|
2312
|
-
|
|
2313
|
+
U(Me.current - 1);
|
|
2313
2314
|
}
|
|
2314
|
-
if (t === "home" &&
|
|
2315
|
+
if (t === "home" && ve) {
|
|
2315
2316
|
n.preventDefault();
|
|
2316
|
-
|
|
2317
|
+
U(0);
|
|
2317
2318
|
}
|
|
2318
2319
|
if (t === "down") {
|
|
2319
2320
|
n.preventDefault();
|
|
2320
|
-
if (
|
|
2321
|
-
|
|
2322
|
-
return Math.min(e + 1,
|
|
2321
|
+
if (ve) {
|
|
2322
|
+
U((function(e) {
|
|
2323
|
+
return Math.min(e + 1, Me.current - 1);
|
|
2323
2324
|
}));
|
|
2324
2325
|
} else {
|
|
2325
|
-
|
|
2326
|
-
|
|
2326
|
+
U(0);
|
|
2327
|
+
be(true);
|
|
2327
2328
|
}
|
|
2328
|
-
if (l &&
|
|
2329
|
-
var a = e.Children.toArray(l).length - (2 + ((
|
|
2330
|
-
if (
|
|
2331
|
-
|
|
2329
|
+
if (l && T) {
|
|
2330
|
+
var a = e.Children.toArray(l).length - (2 + ((ke === null || ke === void 0 ? void 0 : ke.length) || 0));
|
|
2331
|
+
if (X === a) {
|
|
2332
|
+
He(n);
|
|
2332
2333
|
}
|
|
2333
2334
|
}
|
|
2334
2335
|
}
|
|
2335
2336
|
if (t === "up") {
|
|
2336
2337
|
n.preventDefault();
|
|
2337
|
-
if (
|
|
2338
|
-
|
|
2338
|
+
if (ve) {
|
|
2339
|
+
U((function(e) {
|
|
2339
2340
|
return Math.max(e - 1, 0);
|
|
2340
2341
|
}));
|
|
2341
2342
|
} else {
|
|
2342
|
-
|
|
2343
|
-
|
|
2343
|
+
U(0);
|
|
2344
|
+
be(true);
|
|
2344
2345
|
}
|
|
2345
2346
|
}
|
|
2346
|
-
if (t === "enter" &&
|
|
2347
|
-
|
|
2347
|
+
if (t === "enter" && Re.current !== undefined && ve) {
|
|
2348
|
+
De(n, Re.current);
|
|
2348
2349
|
}
|
|
2349
|
-
if (t === "backspace" && ((r =
|
|
2350
|
-
|
|
2350
|
+
if (t === "backspace" && ((r = Pe.current) === null || r === void 0 ? void 0 : r.value) === "" && ke.length) {
|
|
2351
|
+
Fe(n, _n()(ke));
|
|
2351
2352
|
}
|
|
2352
|
-
}), [
|
|
2353
|
-
var
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2353
|
+
}), [ ve, ke, F, De, l, T, X, He, Fe ]);
|
|
2354
|
+
var We = (0, e.useCallback)((function(e) {
|
|
2355
|
+
te(e.target.value);
|
|
2356
|
+
be(true);
|
|
2357
|
+
U(0);
|
|
2357
2358
|
I === null || I === void 0 ? void 0 : I(e, {
|
|
2358
2359
|
keyword: e.target.value
|
|
2359
2360
|
});
|
|
2360
2361
|
}), [ I ]);
|
|
2361
|
-
var
|
|
2362
|
+
var Xe = (0, e.useCallback)((function(e, n) {
|
|
2362
2363
|
var r;
|
|
2363
2364
|
var t = n.value;
|
|
2364
2365
|
e.stopPropagation();
|
|
2365
|
-
|
|
2366
|
-
(r =
|
|
2367
|
-
}), [
|
|
2368
|
-
var
|
|
2369
|
-
var n = document.getElementById(
|
|
2366
|
+
De(e, t);
|
|
2367
|
+
(r = Pe.current) === null || r === void 0 ? void 0 : r.focus();
|
|
2368
|
+
}), [ De ]);
|
|
2369
|
+
var Ue = (0, e.useCallback)((function(e) {
|
|
2370
|
+
var n = document.getElementById(Ne);
|
|
2370
2371
|
var r = e.relatedTarget || document.activeElement;
|
|
2371
2372
|
// IE11 doesn't support relatedTarget but sets activeElement
|
|
2372
2373
|
var t = n && r && n.contains(r);
|
|
2373
2374
|
// TS: target as Node is an unsafe assumption
|
|
2374
|
-
|
|
2375
|
-
|
|
2375
|
+
te(t ? re : "");
|
|
2376
|
+
de(false);
|
|
2376
2377
|
if (!t) {
|
|
2377
2378
|
I === null || I === void 0 ? void 0 : I(e, {
|
|
2378
2379
|
keyword: ""
|
|
2379
2380
|
});
|
|
2380
2381
|
}
|
|
2381
|
-
}), [
|
|
2382
|
-
var
|
|
2382
|
+
}), [ re, I, Ne ]);
|
|
2383
|
+
var Ge = (0, e.useCallback)((function(e) {
|
|
2383
2384
|
var n = e.reason, r = e.event;
|
|
2384
|
-
if (n === "escapeKey" || n === "offScreen" || n === "clickAway" && r !== undefined && !(
|
|
2385
|
-
|
|
2386
|
-
|
|
2385
|
+
if (n === "escapeKey" || n === "offScreen" || n === "clickAway" && r !== undefined && !(Q === null || Q === void 0 ? void 0 : Q.contains(r.target))) {
|
|
2386
|
+
be(false);
|
|
2387
|
+
Ee.current = null;
|
|
2387
2388
|
A === null || A === void 0 ? void 0 : A();
|
|
2388
2389
|
}
|
|
2389
2390
|
if (n === "escapeKey") {
|
|
2390
2391
|
var t;
|
|
2391
|
-
(t =
|
|
2392
|
+
(t = Pe.current) === null || t === void 0 ? void 0 : t.focus();
|
|
2392
2393
|
}
|
|
2393
|
-
}), [
|
|
2394
|
-
var
|
|
2395
|
-
|
|
2396
|
-
|
|
2394
|
+
}), [ Q, A ]);
|
|
2395
|
+
var Je = (0, e.useCallback)((function(e) {
|
|
2396
|
+
Y(e);
|
|
2397
|
+
_e(b, e);
|
|
2397
2398
|
}), [ b ]);
|
|
2398
|
-
var
|
|
2399
|
-
|
|
2400
|
-
|
|
2399
|
+
var Qe = (0, e.useCallback)((function(e) {
|
|
2400
|
+
Pe.current = e;
|
|
2401
|
+
_e(O, e);
|
|
2401
2402
|
}), [ O ]);
|
|
2402
|
-
var
|
|
2403
|
-
if (
|
|
2403
|
+
var Ye = (0, e.useCallback)((function(e) {
|
|
2404
|
+
if (Ee.current !== X) {
|
|
2404
2405
|
Ie(e);
|
|
2405
2406
|
}
|
|
2406
|
-
}), [
|
|
2407
|
-
var
|
|
2407
|
+
}), [ X ]);
|
|
2408
|
+
var Ze = (0, e.useCallback)((function(e) {
|
|
2408
2409
|
// selectedOptions may contain items or unmatched values at this point
|
|
2409
2410
|
return e.map((function(e) {
|
|
2410
2411
|
var r = e;
|
|
@@ -2413,14 +2414,13 @@
|
|
|
2413
2414
|
if (t != null) {
|
|
2414
2415
|
var o = t.children, l = t.icon, a = t.label, i = t.selectedAppearance, u = t.selectedBackgroundColor, c = t.selectedForegroundColor, s = t.value;
|
|
2415
2416
|
|
|
2416
|
-
|
|
2417
|
-
return n().createElement(Zn, {
|
|
2417
|
+
return n().createElement(rr, {
|
|
2418
2418
|
"aria-selected": true,
|
|
2419
2419
|
disabled: v,
|
|
2420
2420
|
icon: l,
|
|
2421
2421
|
key: s.toString(),
|
|
2422
2422
|
"data-test": "selected-option",
|
|
2423
|
-
onRequestRemove:
|
|
2423
|
+
onRequestRemove: Ke,
|
|
2424
2424
|
role: "option",
|
|
2425
2425
|
value: s,
|
|
2426
2426
|
appearance: i,
|
|
@@ -2429,18 +2429,18 @@
|
|
|
2429
2429
|
}, o || a);
|
|
2430
2430
|
}
|
|
2431
2431
|
|
|
2432
|
-
return n().createElement(
|
|
2432
|
+
return n().createElement(rr, {
|
|
2433
2433
|
"aria-selected": true,
|
|
2434
2434
|
disabled: v,
|
|
2435
2435
|
key: (0, ce.createGUID)(),
|
|
2436
2436
|
"data-test": "selected-option",
|
|
2437
|
-
onRequestRemove:
|
|
2437
|
+
onRequestRemove: Ke,
|
|
2438
2438
|
role: "option",
|
|
2439
2439
|
value: r
|
|
2440
2440
|
}, r);
|
|
2441
2441
|
}));
|
|
2442
|
-
}), [ v,
|
|
2443
|
-
var
|
|
2442
|
+
}), [ v, Ke ]);
|
|
2443
|
+
var en = function e(r) {
|
|
2444
2444
|
return r.map((function(e) {
|
|
2445
2445
|
var r = e;
|
|
2446
2446
|
// TS: faking props here
|
|
@@ -2449,39 +2449,39 @@
|
|
|
2449
2449
|
|
|
2450
2450
|
return n().createElement("span", {
|
|
2451
2451
|
key: t.value.toString()
|
|
2452
|
-
}, t.children || t.label, (0,
|
|
2452
|
+
}, t.children || t.label, (0, Un.sprintf)((0, d._)(" selected")));
|
|
2453
2453
|
}
|
|
2454
2454
|
|
|
2455
2455
|
return n().createElement("span", {
|
|
2456
2456
|
key: (0, ce.createGUID)()
|
|
2457
|
-
}, n().createElement(n().Fragment, null, r, (0,
|
|
2457
|
+
}, n().createElement(n().Fragment, null, r, (0, Un.sprintf)((0, d._)(" selected"))));
|
|
2458
2458
|
}));
|
|
2459
2459
|
};
|
|
2460
2460
|
// Map Options to selected values
|
|
2461
|
-
if (
|
|
2461
|
+
if (ke && ke.length) {
|
|
2462
2462
|
e.Children.toArray(l).filter(e.isValidElement).filter((function(e) {
|
|
2463
2463
|
return e.type === R;
|
|
2464
2464
|
})).forEach((function(e) {
|
|
2465
2465
|
if (e.type === R) {
|
|
2466
|
-
var n =
|
|
2466
|
+
var n = ke.indexOf(e.props.value);
|
|
2467
2467
|
if (n !== -1) {
|
|
2468
|
-
|
|
2468
|
+
xe[n] = e;
|
|
2469
2469
|
}
|
|
2470
2470
|
}
|
|
2471
2471
|
}));
|
|
2472
2472
|
}
|
|
2473
2473
|
// Filter the items
|
|
2474
|
-
var
|
|
2475
|
-
var
|
|
2476
|
-
if (
|
|
2477
|
-
return (0, ue.testPhrase)(e.props.label,
|
|
2474
|
+
var nn = (0, ue.stringToKeywords)(re);
|
|
2475
|
+
var rn = a ? e.Children.toArray(l) : e.Children.toArray(l).filter((function(e) {
|
|
2476
|
+
if (Ln()(e, [ "props", "label" ], false)) {
|
|
2477
|
+
return (0, ue.testPhrase)(e.props.label, nn);
|
|
2478
2478
|
}
|
|
2479
2479
|
return true;
|
|
2480
2480
|
// Keep all headers and non-interactive options
|
|
2481
2481
|
}));
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
var
|
|
2482
|
+
Me.current = 0;
|
|
2483
|
+
Re.current = undefined;
|
|
2484
|
+
var tn = e.Children.map(rn, (function(n, r) {
|
|
2485
2485
|
var t = n.props;
|
|
2486
2486
|
if (!t || !i()(t, "value")) {
|
|
2487
2487
|
// ignore Headings and Dividers
|
|
@@ -2490,22 +2490,22 @@
|
|
|
2490
2490
|
var o = n;
|
|
2491
2491
|
var l = o.props, u = l.children, c = l.label, s = l.matchRanges, d = l.value;
|
|
2492
2492
|
// find out if the search string exactly matches a value
|
|
2493
|
-
if (d ===
|
|
2494
|
-
|
|
2493
|
+
if (d === re) {
|
|
2494
|
+
je = true;
|
|
2495
2495
|
}
|
|
2496
2496
|
// remove items that are already selected
|
|
2497
|
-
var f =
|
|
2497
|
+
var f = ke.indexOf(d);
|
|
2498
2498
|
if (f >= 0) {
|
|
2499
2499
|
return null;
|
|
2500
2500
|
}
|
|
2501
2501
|
// highlight matched text
|
|
2502
|
-
var p = u === undefined ||
|
|
2503
|
-
var v = p && !a && !s &&
|
|
2502
|
+
var p = u === undefined || Vn()(u);
|
|
2503
|
+
var v = p && !a && !s && nn && (0, ue.keywordLocations)(c, nn);
|
|
2504
2504
|
// clone item
|
|
2505
2505
|
var b = (0, e.cloneElement)(o, {
|
|
2506
2506
|
// eslint-disable-next-line react/no-array-index-key
|
|
2507
2507
|
key: r,
|
|
2508
|
-
onClick:
|
|
2508
|
+
onClick: Xe,
|
|
2509
2509
|
matchRanges: p && (s || v) || undefined
|
|
2510
2510
|
});
|
|
2511
2511
|
return b;
|
|
@@ -2513,18 +2513,18 @@
|
|
|
2513
2513
|
return e !== null;
|
|
2514
2514
|
})) || [];
|
|
2515
2515
|
// Add the option to add the new value
|
|
2516
|
-
if (t && !
|
|
2517
|
-
|
|
2518
|
-
label: "".concat(
|
|
2516
|
+
if (t && !je && re) {
|
|
2517
|
+
tn.unshift( n().createElement(R, {
|
|
2518
|
+
label: "".concat(re),
|
|
2519
2519
|
description: (0, d._)("(New value)"),
|
|
2520
2520
|
descriptionPosition: "right",
|
|
2521
|
-
value:
|
|
2521
|
+
value: re,
|
|
2522
2522
|
key: "newValue",
|
|
2523
|
-
onClick:
|
|
2523
|
+
onClick: Xe
|
|
2524
2524
|
}));
|
|
2525
2525
|
}
|
|
2526
2526
|
// highlight the selected Item
|
|
2527
|
-
var
|
|
2527
|
+
var on = e.Children.map(tn, (function(n) {
|
|
2528
2528
|
var r = n.props;
|
|
2529
2529
|
if (!r || !i()(r, "value")) {
|
|
2530
2530
|
// ignore Headings and Dividers
|
|
@@ -2532,27 +2532,27 @@
|
|
|
2532
2532
|
}
|
|
2533
2533
|
var t = n;
|
|
2534
2534
|
var o = t.props, l = o.disabled, a = o.value;
|
|
2535
|
-
var u =
|
|
2536
|
-
|
|
2535
|
+
var u = Me.current === X;
|
|
2536
|
+
Me.current += 1;
|
|
2537
2537
|
if (!u) {
|
|
2538
2538
|
return t;
|
|
2539
2539
|
}
|
|
2540
2540
|
if (!l) {
|
|
2541
|
-
|
|
2541
|
+
Re.current = a;
|
|
2542
2542
|
}
|
|
2543
2543
|
var c = (0, e.cloneElement)(t, {
|
|
2544
2544
|
active: u,
|
|
2545
2545
|
id: Le,
|
|
2546
2546
|
elementRef: function e(n) {
|
|
2547
|
-
|
|
2548
|
-
|
|
2547
|
+
Ye(n);
|
|
2548
|
+
_e(t.props.elementRef, n);
|
|
2549
2549
|
}
|
|
2550
2550
|
});
|
|
2551
2551
|
return c;
|
|
2552
2552
|
}));
|
|
2553
|
-
var
|
|
2553
|
+
var ln = function e(r) {
|
|
2554
2554
|
var t = r.anchorWidth, l = r.maxHeight, a = r.placement;
|
|
2555
|
-
var i =
|
|
2555
|
+
var i = kr({
|
|
2556
2556
|
anchorWidth: t,
|
|
2557
2557
|
maxHeight: l,
|
|
2558
2558
|
menuStyle: x
|
|
@@ -2562,107 +2562,104 @@
|
|
|
2562
2562
|
focusMode: "never",
|
|
2563
2563
|
placement: a !== null && a !== void 0 ? a : undefined,
|
|
2564
2564
|
isLoading: S,
|
|
2565
|
-
onScrollBottom:
|
|
2565
|
+
onScrollBottom: T ? He : undefined,
|
|
2566
2566
|
noOptionsMessage: E,
|
|
2567
2567
|
footerMessage: y,
|
|
2568
2568
|
animateLoading: o,
|
|
2569
|
-
loadingMessage:
|
|
2569
|
+
loadingMessage: w,
|
|
2570
2570
|
onScroll: B,
|
|
2571
2571
|
style: i
|
|
2572
|
-
},
|
|
2572
|
+
}, on);
|
|
2573
2573
|
};
|
|
2574
|
-
var
|
|
2575
|
-
var
|
|
2574
|
+
var an = wr("".concat(re.length * .8, "em"));
|
|
2575
|
+
var un = gr(gr({}, $n()(H, (function(e, n) {
|
|
2576
2576
|
return n === "role" || n.indexOf("aria-") === 0;
|
|
2577
2577
|
}))), {}, {
|
|
2578
2578
|
"aria-describedby": p,
|
|
2579
|
-
"aria-labelledby":
|
|
2579
|
+
"aria-labelledby": C,
|
|
2580
2580
|
"aria-invalid": m || undefined
|
|
2581
2581
|
});
|
|
2582
|
-
var
|
|
2582
|
+
var cn = gr({}, $n()(H, (function(e, n) {
|
|
2583
2583
|
return n === "aria-label" || n === "aria-describedby";
|
|
2584
2584
|
})));
|
|
2585
2585
|
|
|
2586
|
-
return n().createElement(n().Fragment, null, n().createElement(
|
|
2586
|
+
return n().createElement(n().Fragment, null, n().createElement(Zn, or({
|
|
2587
2587
|
key: "control",
|
|
2588
|
-
"data-test-values": JSON.stringify(
|
|
2588
|
+
"data-test-values": JSON.stringify(ke),
|
|
2589
|
+
"data-test-disabled": v ? "disabled" : undefined,
|
|
2589
2590
|
inline: g,
|
|
2590
|
-
$hasFocus:
|
|
2591
|
-
},
|
|
2592
|
-
onClick: v ? undefined :
|
|
2591
|
+
$hasFocus: ie
|
|
2592
|
+
}, Kn().apply(void 0, [ H ].concat(lr(Dn()(un)))), {
|
|
2593
|
+
onClick: v ? undefined : qe,
|
|
2593
2594
|
$disabled: v,
|
|
2594
2595
|
$error: m,
|
|
2595
|
-
"data-test-popover-id":
|
|
2596
|
-
$popoverOpen:
|
|
2596
|
+
"data-test-popover-id": Ne,
|
|
2597
|
+
$popoverOpen: ve,
|
|
2597
2598
|
flex: true,
|
|
2598
|
-
elementRef:
|
|
2599
|
+
elementRef: Je,
|
|
2599
2600
|
role: "group",
|
|
2600
2601
|
"aria-disabled": v || undefined,
|
|
2601
|
-
"aria-labelledby":
|
|
2602
|
-
},
|
|
2602
|
+
"aria-labelledby": C
|
|
2603
|
+
}, cn), n().createElement(er, {
|
|
2603
2604
|
role: "listbox",
|
|
2604
2605
|
"aria-invalid": m,
|
|
2605
2606
|
"aria-multiselectable": "true"
|
|
2606
|
-
},
|
|
2607
|
+
}, Ze(xe)), !v && n().createElement(nr, or({
|
|
2607
2608
|
role: "combobox",
|
|
2608
2609
|
"data-test": "textbox",
|
|
2609
2610
|
id: h,
|
|
2610
|
-
ref:
|
|
2611
|
-
onBlur:
|
|
2612
|
-
onFocus:
|
|
2613
|
-
onChange:
|
|
2614
|
-
onKeyDown:
|
|
2615
|
-
value:
|
|
2611
|
+
ref: Qe,
|
|
2612
|
+
onBlur: Ue,
|
|
2613
|
+
onFocus: ze,
|
|
2614
|
+
onChange: We,
|
|
2615
|
+
onKeyDown: $e,
|
|
2616
|
+
value: re,
|
|
2616
2617
|
autoCapitalize: "off",
|
|
2617
2618
|
autoComplete: "off",
|
|
2618
2619
|
autoCorrect: "off",
|
|
2619
2620
|
spellCheck: false,
|
|
2620
|
-
style:
|
|
2621
|
-
placeholder:
|
|
2621
|
+
style: an,
|
|
2622
|
+
placeholder: ke.length ? "" : V,
|
|
2622
2623
|
required: q,
|
|
2623
|
-
"aria-activedescendant":
|
|
2624
|
+
"aria-activedescendant": ve && Me.current > 0 ? Le : undefined,
|
|
2624
2625
|
"aria-autocomplete": "list",
|
|
2625
|
-
"aria-controls":
|
|
2626
|
-
"aria-owns":
|
|
2627
|
-
"aria-expanded":
|
|
2626
|
+
"aria-controls": ve ? Ne : undefined,
|
|
2627
|
+
"aria-owns": ve ? Ne : undefined,
|
|
2628
|
+
"aria-expanded": ve,
|
|
2628
2629
|
"aria-haspopup": true
|
|
2629
|
-
},
|
|
2630
|
-
open:
|
|
2630
|
+
}, un)), n().createElement(Xn(), {
|
|
2631
|
+
open: ve && !!Q,
|
|
2631
2632
|
autoCloseWhenOffScreen: true,
|
|
2632
|
-
anchor:
|
|
2633
|
-
onRequestClose:
|
|
2633
|
+
anchor: Q,
|
|
2634
|
+
onRequestClose: Ge,
|
|
2634
2635
|
canCoverAnchor: false,
|
|
2635
2636
|
defaultPlacement: c,
|
|
2636
2637
|
repositionMode: D,
|
|
2637
|
-
id:
|
|
2638
|
-
},
|
|
2638
|
+
id: Ne
|
|
2639
|
+
}, ln)), n().createElement(le(), {
|
|
2639
2640
|
role: "status",
|
|
2640
2641
|
"aria-relevant": "text"
|
|
2641
|
-
}, Ce),
|
|
2642
|
-
key: "overlay",
|
|
2643
|
-
$popoveropen: be,
|
|
2644
|
-
"data-test": "overlay"
|
|
2645
|
-
}) : null, n().createElement(le(), {
|
|
2642
|
+
}, Ce), n().createElement(le(), {
|
|
2646
2643
|
role: "alert",
|
|
2647
2644
|
"aria-relevant": "additions"
|
|
2648
|
-
},
|
|
2645
|
+
}, en(xe)));
|
|
2649
2646
|
}
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
/* harmony default export */ const
|
|
2647
|
+
Er.propTypes = Cr;
|
|
2648
|
+
Er.Option = R;
|
|
2649
|
+
Er.Divider = u.Divider;
|
|
2650
|
+
Er.Heading = u.Heading;
|
|
2651
|
+
/* harmony default export */ const Rr = Er;
|
|
2655
2652
|
// CONCATENATED MODULE: ./src/Multiselect/Multiselect.tsx
|
|
2656
|
-
function
|
|
2653
|
+
function Mr(e) {
|
|
2657
2654
|
"@babel/helpers - typeof";
|
|
2658
|
-
return
|
|
2655
|
+
return Mr = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
|
|
2659
2656
|
return typeof e;
|
|
2660
2657
|
} : function(e) {
|
|
2661
2658
|
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
2662
|
-
},
|
|
2659
|
+
}, Mr(e);
|
|
2663
2660
|
}
|
|
2664
|
-
function
|
|
2665
|
-
return
|
|
2661
|
+
function Ar() {
|
|
2662
|
+
return Ar = Object.assign ? Object.assign.bind() : function(e) {
|
|
2666
2663
|
for (var n = 1; n < arguments.length; n++) {
|
|
2667
2664
|
var r = arguments[n];
|
|
2668
2665
|
for (var t in r) {
|
|
@@ -2670,9 +2667,9 @@
|
|
|
2670
2667
|
}
|
|
2671
2668
|
}
|
|
2672
2669
|
return e;
|
|
2673
|
-
},
|
|
2670
|
+
}, Ar.apply(null, arguments);
|
|
2674
2671
|
}
|
|
2675
|
-
function
|
|
2672
|
+
function Ir(e, n) {
|
|
2676
2673
|
var r = Object.keys(e);
|
|
2677
2674
|
if (Object.getOwnPropertySymbols) {
|
|
2678
2675
|
var t = Object.getOwnPropertySymbols(e);
|
|
@@ -2682,42 +2679,42 @@
|
|
|
2682
2679
|
}
|
|
2683
2680
|
return r;
|
|
2684
2681
|
}
|
|
2685
|
-
function
|
|
2682
|
+
function Br(e) {
|
|
2686
2683
|
for (var n = 1; n < arguments.length; n++) {
|
|
2687
2684
|
var r = null != arguments[n] ? arguments[n] : {};
|
|
2688
|
-
n % 2 ?
|
|
2689
|
-
|
|
2690
|
-
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) :
|
|
2685
|
+
n % 2 ? Ir(Object(r), !0).forEach((function(n) {
|
|
2686
|
+
Tr(e, n, r[n]);
|
|
2687
|
+
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : Ir(Object(r)).forEach((function(n) {
|
|
2691
2688
|
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
|
|
2692
2689
|
}));
|
|
2693
2690
|
}
|
|
2694
2691
|
return e;
|
|
2695
2692
|
}
|
|
2696
|
-
function
|
|
2697
|
-
return (n =
|
|
2693
|
+
function Tr(e, n, r) {
|
|
2694
|
+
return (n = Lr(n)) in e ? Object.defineProperty(e, n, {
|
|
2698
2695
|
value: r,
|
|
2699
2696
|
enumerable: !0,
|
|
2700
2697
|
configurable: !0,
|
|
2701
2698
|
writable: !0
|
|
2702
2699
|
}) : e[n] = r, e;
|
|
2703
2700
|
}
|
|
2704
|
-
function
|
|
2705
|
-
var n =
|
|
2706
|
-
return "symbol" ==
|
|
2701
|
+
function Lr(e) {
|
|
2702
|
+
var n = Nr(e, "string");
|
|
2703
|
+
return "symbol" == Mr(n) ? n : n + "";
|
|
2707
2704
|
}
|
|
2708
|
-
function
|
|
2709
|
-
if ("object" !=
|
|
2705
|
+
function Nr(e, n) {
|
|
2706
|
+
if ("object" != Mr(e) || !e) return e;
|
|
2710
2707
|
var r = e[Symbol.toPrimitive];
|
|
2711
2708
|
if (void 0 !== r) {
|
|
2712
2709
|
var t = r.call(e, n || "default");
|
|
2713
|
-
if ("object" !=
|
|
2710
|
+
if ("object" != Mr(t)) return t;
|
|
2714
2711
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2715
2712
|
}
|
|
2716
2713
|
return ("string" === n ? String : Number)(e);
|
|
2717
2714
|
}
|
|
2718
|
-
function
|
|
2715
|
+
function Vr(e, n) {
|
|
2719
2716
|
if (null == e) return {};
|
|
2720
|
-
var r, t, o =
|
|
2717
|
+
var r, t, o = qr(e, n);
|
|
2721
2718
|
if (Object.getOwnPropertySymbols) {
|
|
2722
2719
|
var l = Object.getOwnPropertySymbols(e);
|
|
2723
2720
|
for (t = 0; t < l.length; t++) {
|
|
@@ -2726,7 +2723,7 @@
|
|
|
2726
2723
|
}
|
|
2727
2724
|
return o;
|
|
2728
2725
|
}
|
|
2729
|
-
function
|
|
2726
|
+
function qr(e, n) {
|
|
2730
2727
|
if (null == e) return {};
|
|
2731
2728
|
var r = {};
|
|
2732
2729
|
for (var t in e) {
|
|
@@ -2739,7 +2736,7 @@
|
|
|
2739
2736
|
}
|
|
2740
2737
|
/** @public */
|
|
2741
2738
|
/** @public */
|
|
2742
|
-
/** @public */ var
|
|
2739
|
+
/** @public */ var Dr = {
|
|
2743
2740
|
allowNewValues: l().bool,
|
|
2744
2741
|
animateLoading: l().bool,
|
|
2745
2742
|
children: l().node,
|
|
@@ -2773,17 +2770,16 @@
|
|
|
2773
2770
|
selectAllAppearance: l().oneOf([ "buttongroup", "checkbox" ]),
|
|
2774
2771
|
showSelectedValuesFirst: l().oneOf([ "nextOpen", "immediately", "never" ]),
|
|
2775
2772
|
tabConfirmsNewValue: l().bool,
|
|
2776
|
-
useClickawayOverlay: l().bool,
|
|
2777
2773
|
values: l().array,
|
|
2778
2774
|
/** @private */
|
|
2779
2775
|
virtualization: l().number
|
|
2780
2776
|
};
|
|
2781
|
-
var
|
|
2782
|
-
var
|
|
2783
|
-
function
|
|
2784
|
-
var t = r.allowNewValues, o = r.animateLoading, l = r.compact, a = r.children, i = r.controlledFilter, u = r.defaultPlacement, c = u === void 0 ? "vertical" : u, d = r.defaultValues, f = r.describedBy, p = r.disabled, v = r.elementRef, b = r.error, m = r.filter, y = r.footerMessage, g = r.inline, h = r.inputId, O = r.inputRef, S = r.isLoadingOptions,
|
|
2777
|
+
var Fr = (0, d._)("No matches");
|
|
2778
|
+
var _r = (0, d._)("Select...");
|
|
2779
|
+
function Hr(r) {
|
|
2780
|
+
var t = r.allowNewValues, o = r.animateLoading, l = r.compact, a = r.children, i = r.controlledFilter, u = r.defaultPlacement, c = u === void 0 ? "vertical" : u, d = r.defaultValues, f = r.describedBy, p = r.disabled, v = r.elementRef, b = r.error, m = r.filter, y = r.footerMessage, g = r.inline, h = r.inputId, O = r.inputRef, S = r.isLoadingOptions, C = r.labelledBy, w = r.loadingMessage, k = r.menuStyle, x = r.name, j = r.noOptionsMessage, P = j === void 0 ? Fr : j, E = r.onChange, R = r.onClose, M = r.onFilterChange, A = r.onOpen, I = r.onScroll, B = r.onScrollBottom, T = r.placeholder, L = T === void 0 ? _r : T, N = r.repositionMode, V = N === void 0 ? "flip" : N, q = r.selectAllAppearance, D = r.showSelectedValuesFirst, F = r.tabConfirmsNewValue, _ = r.values, H = r.virtualization, K = Vr(r, [ "allowNewValues", "animateLoading", "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", "repositionMode", "selectAllAppearance", "showSelectedValuesFirst", "tabConfirmsNewValue", "values", "virtualization" ]);
|
|
2785
2781
|
// @docs-props-type MultiselectPropsBase
|
|
2786
|
-
var
|
|
2782
|
+
var z = s()({
|
|
2787
2783
|
componentName: "Multiselect",
|
|
2788
2784
|
/* eslint-disable-next-line prefer-rest-params */
|
|
2789
2785
|
componentProps: arguments[0],
|
|
@@ -2791,16 +2787,16 @@
|
|
|
2791
2787
|
defaultValuePropName: "defaultValues",
|
|
2792
2788
|
valuePropName: "values"
|
|
2793
2789
|
});
|
|
2794
|
-
/* eslint-disable-next-line prefer-rest-params */ var
|
|
2790
|
+
/* eslint-disable-next-line prefer-rest-params */ var $ = arguments[0];
|
|
2795
2791
|
(0, e.useEffect)((function() {
|
|
2796
2792
|
if (l !== true) {
|
|
2797
2793
|
if (false) {}
|
|
2798
2794
|
if (false) {}
|
|
2799
2795
|
}
|
|
2800
|
-
}), [ l,
|
|
2796
|
+
}), [ l, $ ]);
|
|
2801
2797
|
// Compact uses Button, which defaults `inline` to true, explicitly pass a boolean to prevent the underlying Button from applying its default.
|
|
2802
|
-
var
|
|
2803
|
-
var
|
|
2798
|
+
var W = !!g;
|
|
2799
|
+
var X = Br({
|
|
2804
2800
|
allowNewValues: t,
|
|
2805
2801
|
animateLoading: o,
|
|
2806
2802
|
children: a,
|
|
@@ -2811,12 +2807,12 @@
|
|
|
2811
2807
|
elementRef: v,
|
|
2812
2808
|
error: b,
|
|
2813
2809
|
footerMessage: y,
|
|
2814
|
-
inline:
|
|
2810
|
+
inline: W,
|
|
2815
2811
|
inputId: h,
|
|
2816
2812
|
inputRef: O,
|
|
2817
2813
|
isLoadingOptions: S,
|
|
2818
|
-
labelledBy:
|
|
2819
|
-
loadingMessage:
|
|
2814
|
+
labelledBy: C,
|
|
2815
|
+
loadingMessage: w,
|
|
2820
2816
|
menuStyle: k,
|
|
2821
2817
|
name: x,
|
|
2822
2818
|
noOptionsMessage: P,
|
|
@@ -2826,44 +2822,41 @@
|
|
|
2826
2822
|
onOpen: A,
|
|
2827
2823
|
onScroll: I,
|
|
2828
2824
|
onScrollBottom: B,
|
|
2829
|
-
placeholder:
|
|
2825
|
+
placeholder: L,
|
|
2830
2826
|
repositionMode: V,
|
|
2831
2827
|
showSelectedValuesFirst: D,
|
|
2832
2828
|
tabConfirmsNewValue: F,
|
|
2833
|
-
virtualization:
|
|
2834
|
-
},
|
|
2835
|
-
var
|
|
2836
|
-
values:
|
|
2829
|
+
virtualization: H
|
|
2830
|
+
}, K);
|
|
2831
|
+
var U = z ? {
|
|
2832
|
+
values: _
|
|
2837
2833
|
} : {
|
|
2838
2834
|
defaultValues: d
|
|
2839
2835
|
};
|
|
2840
|
-
var
|
|
2836
|
+
var G = {
|
|
2841
2837
|
filter: m,
|
|
2842
2838
|
selectAllAppearance: q,
|
|
2843
2839
|
showSelectedValuesFirst: D,
|
|
2844
|
-
virtualization:
|
|
2845
|
-
};
|
|
2846
|
-
var Q = {
|
|
2847
|
-
useClickawayOverlay: _
|
|
2840
|
+
virtualization: H
|
|
2848
2841
|
};
|
|
2849
2842
|
if (l) {
|
|
2850
2843
|
|
|
2851
|
-
return n().createElement(
|
|
2844
|
+
return n().createElement(An, Ar({
|
|
2852
2845
|
"data-test": "multiselect"
|
|
2853
|
-
},
|
|
2846
|
+
}, U, G, X));
|
|
2854
2847
|
}
|
|
2855
2848
|
|
|
2856
|
-
return n().createElement(
|
|
2849
|
+
return n().createElement(Rr, Ar({
|
|
2857
2850
|
"data-test": "multiselect"
|
|
2858
|
-
},
|
|
2851
|
+
}, U, X));
|
|
2859
2852
|
}
|
|
2860
2853
|
// TODO: SUI-3402, this can be removed when ControlGroup no longer needs to inspect componentType
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
/* harmony default export */ const
|
|
2854
|
+
Hr.componentType = "Multiselect";
|
|
2855
|
+
Hr.Option = R;
|
|
2856
|
+
Hr.Heading = u.Heading;
|
|
2857
|
+
Hr.Divider = u.Divider;
|
|
2858
|
+
Hr.propTypes = Dr;
|
|
2859
|
+
/* harmony default export */ const Kr = Hr;
|
|
2867
2860
|
}) // CONCATENATED MODULE: ./src/Multiselect/index.ts
|
|
2868
2861
|
();
|
|
2869
2862
|
module.exports = t;
|