@splunk/react-ui 4.21.1 → 4.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -1
- package/Code.js +0 -1
- package/Color.js +238 -235
- package/ComboBox.js +195 -183
- package/Menu.js +100 -101
- package/Multiselect.js +655 -641
- package/RadioBar.js +91 -67
- package/ResultsMenu.js +107 -122
- package/Search.js +258 -246
- package/Select.js +461 -457
- package/Slider.js +87 -76
- package/TabBar.js +99 -84
- package/Table.js +805 -673
- package/package.json +5 -5
- package/types/src/Color/Color.d.ts +0 -1
- package/types/src/RadioBar/RadioBar.d.ts +1 -0
- package/types/src/ResultsMenu/ResultsMenu.d.ts +0 -2
- package/types/src/Select/docs/examples/Icons.d.ts +1 -9
- package/types/src/Slider/Slider.d.ts +1 -0
- package/types/src/TabBar/Tab.d.ts +10 -1
- package/types/src/TabBar/TabBar.d.ts +4 -2
- package/types/src/Table/Head.d.ts +7 -3
- package/types/src/Table/Table.d.ts +3 -2
- package/types/src/Table/TableContext.d.ts +2 -0
- package/Code.js.LICENSE.txt +0 -8
package/Select.js
CHANGED
|
@@ -71,10 +71,10 @@
|
|
|
71
71
|
var r = e.n(n);
|
|
72
72
|
// CONCATENATED MODULE: external "prop-types"
|
|
73
73
|
const o = require("prop-types");
|
|
74
|
-
var
|
|
74
|
+
var i = e.n(o);
|
|
75
75
|
// CONCATENATED MODULE: external "lodash/has"
|
|
76
|
-
const
|
|
77
|
-
var l = e.n(
|
|
76
|
+
const a = require("lodash/has");
|
|
77
|
+
var l = e.n(a);
|
|
78
78
|
// CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
|
|
79
79
|
const c = require("@splunk/ui-utils/i18n");
|
|
80
80
|
// CONCATENATED MODULE: external "lodash/castArray"
|
|
@@ -90,8 +90,8 @@
|
|
|
90
90
|
const h = require("lodash/includes");
|
|
91
91
|
var b = e.n(h);
|
|
92
92
|
// CONCATENATED MODULE: external "lodash/isUndefined"
|
|
93
|
-
const
|
|
94
|
-
var
|
|
93
|
+
const m = require("lodash/isUndefined");
|
|
94
|
+
var y = e.n(m);
|
|
95
95
|
// CONCATENATED MODULE: external "lodash/keys"
|
|
96
96
|
const g = require("lodash/keys");
|
|
97
97
|
var O = e.n(g);
|
|
@@ -100,10 +100,10 @@
|
|
|
100
100
|
var w = e.n(S);
|
|
101
101
|
// CONCATENATED MODULE: external "lodash/omit"
|
|
102
102
|
const k = require("lodash/omit");
|
|
103
|
-
var
|
|
103
|
+
var x = e.n(k);
|
|
104
104
|
// CONCATENATED MODULE: external "lodash/pick"
|
|
105
|
-
const
|
|
106
|
-
var I = e.n(
|
|
105
|
+
const C = require("lodash/pick");
|
|
106
|
+
var I = e.n(C);
|
|
107
107
|
// CONCATENATED MODULE: external "lodash/uniq"
|
|
108
108
|
const _ = require("lodash/uniq");
|
|
109
109
|
var A = e.n(_);
|
|
@@ -158,18 +158,18 @@
|
|
|
158
158
|
// CONCATENATED MODULE: ./src/Select/icons/Search.tsx
|
|
159
159
|
var ee = function e() {
|
|
160
160
|
var t = (0, U.useSplunkTheme)(), n = t.isEnterprise, o = t.isCompact;
|
|
161
|
-
var
|
|
162
|
-
var
|
|
161
|
+
var i = (0, c._)("Search");
|
|
162
|
+
var a = o ? "20px" : "24px";
|
|
163
163
|
var l = n ? r().createElement(X(), {
|
|
164
164
|
role: "presentation",
|
|
165
165
|
size: "16px",
|
|
166
|
-
screenReaderText:
|
|
166
|
+
screenReaderText: i,
|
|
167
167
|
hideDefaultTooltip: true
|
|
168
168
|
}) : r().createElement(Z(), {
|
|
169
169
|
role: "presentation",
|
|
170
|
-
"aria-label":
|
|
171
|
-
width:
|
|
172
|
-
height:
|
|
170
|
+
"aria-label": i,
|
|
171
|
+
width: a,
|
|
172
|
+
height: a
|
|
173
173
|
});
|
|
174
174
|
return l;
|
|
175
175
|
};
|
|
@@ -204,12 +204,12 @@
|
|
|
204
204
|
}
|
|
205
205
|
function oe(e, t) {
|
|
206
206
|
if (e == null) return {};
|
|
207
|
-
var n =
|
|
207
|
+
var n = ie(e, t);
|
|
208
208
|
var r, o;
|
|
209
209
|
if (Object.getOwnPropertySymbols) {
|
|
210
|
-
var
|
|
211
|
-
for (o = 0; o <
|
|
212
|
-
r =
|
|
210
|
+
var i = Object.getOwnPropertySymbols(e);
|
|
211
|
+
for (o = 0; o < i.length; o++) {
|
|
212
|
+
r = i[o];
|
|
213
213
|
if (t.indexOf(r) >= 0) continue;
|
|
214
214
|
if (!Object.prototype.propertyIsEnumerable.call(e, r)) continue;
|
|
215
215
|
n[r] = e[r];
|
|
@@ -217,19 +217,19 @@
|
|
|
217
217
|
}
|
|
218
218
|
return n;
|
|
219
219
|
}
|
|
220
|
-
function
|
|
220
|
+
function ie(e, t) {
|
|
221
221
|
if (e == null) return {};
|
|
222
222
|
var n = {};
|
|
223
223
|
var r = Object.keys(e);
|
|
224
|
-
var o,
|
|
225
|
-
for (
|
|
226
|
-
o = r[
|
|
224
|
+
var o, i;
|
|
225
|
+
for (i = 0; i < r.length; i++) {
|
|
226
|
+
o = r[i];
|
|
227
227
|
if (t.indexOf(o) >= 0) continue;
|
|
228
228
|
n[o] = e[o];
|
|
229
229
|
}
|
|
230
230
|
return n;
|
|
231
231
|
}
|
|
232
|
-
function
|
|
232
|
+
function ae(e, t) {
|
|
233
233
|
if (!(e instanceof t)) {
|
|
234
234
|
throw new TypeError("Cannot call a class as a function");
|
|
235
235
|
}
|
|
@@ -273,8 +273,8 @@
|
|
|
273
273
|
return function n() {
|
|
274
274
|
var r = he(e), o;
|
|
275
275
|
if (t) {
|
|
276
|
-
var
|
|
277
|
-
o = Reflect.construct(r, arguments,
|
|
276
|
+
var i = he(this).constructor;
|
|
277
|
+
o = Reflect.construct(r, arguments, i);
|
|
278
278
|
} else {
|
|
279
279
|
o = r.apply(this, arguments);
|
|
280
280
|
}
|
|
@@ -323,32 +323,32 @@
|
|
|
323
323
|
}
|
|
324
324
|
return e;
|
|
325
325
|
}
|
|
326
|
-
var
|
|
326
|
+
var me = {
|
|
327
327
|
/** @private */
|
|
328
|
-
active:
|
|
329
|
-
children:
|
|
330
|
-
description:
|
|
331
|
-
descriptionPosition:
|
|
332
|
-
disabled:
|
|
333
|
-
hidden:
|
|
334
|
-
icon:
|
|
335
|
-
label:
|
|
328
|
+
active: i().bool,
|
|
329
|
+
children: i().node,
|
|
330
|
+
description: i().string,
|
|
331
|
+
descriptionPosition: i().oneOf([ "right", "bottom" ]),
|
|
332
|
+
disabled: i().bool,
|
|
333
|
+
hidden: i().bool,
|
|
334
|
+
icon: i().node,
|
|
335
|
+
label: i().string.isRequired,
|
|
336
336
|
/**
|
|
337
337
|
* @private Passed down from <BaseSelect>
|
|
338
338
|
*/
|
|
339
|
-
multiple:
|
|
340
|
-
matchRanges:
|
|
341
|
-
start:
|
|
342
|
-
end:
|
|
339
|
+
multiple: i().bool,
|
|
340
|
+
matchRanges: i().arrayOf(i().shape({
|
|
341
|
+
start: i().number.isRequired,
|
|
342
|
+
end: i().number.isRequired
|
|
343
343
|
})),
|
|
344
344
|
/** @private */
|
|
345
|
-
onClick:
|
|
345
|
+
onClick: i().func,
|
|
346
346
|
/** @private */
|
|
347
|
-
selected:
|
|
348
|
-
truncate:
|
|
349
|
-
value:
|
|
347
|
+
selected: i().bool,
|
|
348
|
+
truncate: i().bool,
|
|
349
|
+
value: i().oneOfType([ i().string, i().number, i().bool ]).isRequired
|
|
350
350
|
};
|
|
351
|
-
var
|
|
351
|
+
var ye = {
|
|
352
352
|
descriptionPosition: "bottom",
|
|
353
353
|
disabled: false,
|
|
354
354
|
multiple: false,
|
|
@@ -364,15 +364,15 @@
|
|
|
364
364
|
var t = pe(n);
|
|
365
365
|
function n() {
|
|
366
366
|
var e;
|
|
367
|
-
|
|
368
|
-
for (var r = arguments.length, o = new Array(r),
|
|
369
|
-
o[
|
|
367
|
+
ae(this, n);
|
|
368
|
+
for (var r = arguments.length, o = new Array(r), i = 0; i < r; i++) {
|
|
369
|
+
o[i] = arguments[i];
|
|
370
370
|
}
|
|
371
371
|
e = t.call.apply(t, [ this ].concat(o));
|
|
372
372
|
be(de(e), "c", null);
|
|
373
373
|
be(de(e), "handleClick", (function(t) {
|
|
374
|
-
var n = e.props, r = n.onClick, o = n.value,
|
|
375
|
-
if (!
|
|
374
|
+
var n = e.props, r = n.onClick, o = n.value, i = n.disabled;
|
|
375
|
+
if (!i) {
|
|
376
376
|
r === null || r === void 0 ? void 0 : r(t, {
|
|
377
377
|
value: o
|
|
378
378
|
});
|
|
@@ -400,7 +400,7 @@
|
|
|
400
400
|
}, {
|
|
401
401
|
key: "render",
|
|
402
402
|
value: function e() {
|
|
403
|
-
var t = this.props, n = t.value, o = t.children,
|
|
403
|
+
var t = this.props, n = t.value, o = t.children, i = t.label, a = t.multiple, l = oe(t, [ "value", "children", "label", "multiple" ]);
|
|
404
404
|
|
|
405
405
|
return r().createElement(T.Item, re({
|
|
406
406
|
"aria-selected": this.props.selected,
|
|
@@ -409,17 +409,17 @@
|
|
|
409
409
|
ref: this.handleMount
|
|
410
410
|
}, l, {
|
|
411
411
|
selectable: true,
|
|
412
|
-
selectableAppearance:
|
|
412
|
+
selectableAppearance: a ? "checkbox" : undefined,
|
|
413
413
|
onClick: this.handleClick,
|
|
414
414
|
role: "option",
|
|
415
415
|
value: n.toString()
|
|
416
|
-
}), o ||
|
|
416
|
+
}), o || i);
|
|
417
417
|
}
|
|
418
418
|
} ]);
|
|
419
419
|
return n;
|
|
420
420
|
}(n.PureComponent);
|
|
421
|
-
be(ge, "propTypes",
|
|
422
|
-
be(ge, "defaultProps",
|
|
421
|
+
be(ge, "propTypes", me);
|
|
422
|
+
be(ge, "defaultProps", ye);
|
|
423
423
|
be(ge, "type", T.Item);
|
|
424
424
|
/* harmony default export */ const Oe = ge;
|
|
425
425
|
// CONCATENATED MODULE: external "styled-components"
|
|
@@ -427,10 +427,10 @@
|
|
|
427
427
|
var we = e.n(Se);
|
|
428
428
|
// CONCATENATED MODULE: external "@splunk/react-ui/Clickable"
|
|
429
429
|
const ke = require("@splunk/react-ui/Clickable");
|
|
430
|
-
var
|
|
430
|
+
var xe = e.n(ke);
|
|
431
431
|
// CONCATENATED MODULE: external "@splunk/react-ui/Switch"
|
|
432
|
-
const
|
|
433
|
-
var Ie = e.n(
|
|
432
|
+
const Ce = require("@splunk/react-ui/Switch");
|
|
433
|
+
var Ie = e.n(Ce);
|
|
434
434
|
// CONCATENATED MODULE: ./src/Menu/ItemStyles.ts
|
|
435
435
|
var _e = (0, Se.css)([ "color:", ";font-size:", ";line-height:", ";overflow:inherit;white-space:inherit;text-overflow:inherit;" ], (0,
|
|
436
436
|
U.pick)({
|
|
@@ -471,7 +471,7 @@
|
|
|
471
471
|
prisma: (0, Se.css)([ "color:", ";display:inline-flex;align-items:center;min-width:20px;min-height:20px;& > svg{width:20px;height:20px;}" ], U.variables.contentColorMuted),
|
|
472
472
|
enterprise: (0, Se.css)([ "transform:translateY(-1px);" ])
|
|
473
473
|
}));
|
|
474
|
-
var Te = we()(
|
|
474
|
+
var Te = we()(xe()).withConfig({
|
|
475
475
|
displayName: "ItemStyles__StyledClickable",
|
|
476
476
|
componentId: "sc-4kc053-4"
|
|
477
477
|
})([ "display:block;position:relative;cursor:pointer;color:", ";word-wrap:break-word;max-width:100%;width:100%;padding:", ";", " ", " ", " &:not([disabled]){&:hover{background:", ";", "}&:focus{outline:0;box-shadow:", ";", "}", " ", "}&[disabled]{color:", ";cursor:not-allowed;", ",", "{color:inherit;}", "{cursor:not-allowed;color:", ";}", "}", "" ], (0,
|
|
@@ -597,10 +597,12 @@
|
|
|
597
597
|
var Le = we().span.withConfig({
|
|
598
598
|
displayName: "ItemStyles__StyledSubmenu",
|
|
599
599
|
componentId: "sc-4kc053-10"
|
|
600
|
-
})([ "float:right;padding-left:", ";color:", ";" ], U.variables.spacingSmall, (0,
|
|
600
|
+
})([ "float:right;padding-left:", ";color:", ";", "" ], U.variables.spacingSmall, (0,
|
|
601
601
|
U.pick)({
|
|
602
602
|
prisma: "inherit",
|
|
603
603
|
enterprise: U.variables.textGray
|
|
604
|
+
}), (0, U.pick)({
|
|
605
|
+
prisma: (0, Se.css)([ "& > svg{width:20px;height:20px;}" ])
|
|
604
606
|
}));
|
|
605
607
|
// CONCATENATED MODULE: ./src/Select/SelectAllOptionStyles.ts
|
|
606
608
|
var Ne = we()(De).withConfig({
|
|
@@ -616,25 +618,25 @@
|
|
|
616
618
|
}));
|
|
617
619
|
// CONCATENATED MODULE: ./src/Select/SelectAllOption.tsx
|
|
618
620
|
var Ke = {
|
|
619
|
-
active:
|
|
620
|
-
elementRef:
|
|
621
|
-
id:
|
|
622
|
-
onClick:
|
|
623
|
-
selectAllLabel:
|
|
624
|
-
totalCount:
|
|
625
|
-
changedToggle:
|
|
626
|
-
selected:
|
|
621
|
+
active: i().bool,
|
|
622
|
+
elementRef: i().oneOfType([ i().func, i().object ]),
|
|
623
|
+
id: i().string,
|
|
624
|
+
onClick: i().func,
|
|
625
|
+
selectAllLabel: i().string,
|
|
626
|
+
totalCount: i().number,
|
|
627
|
+
changedToggle: i().bool,
|
|
628
|
+
selected: i().oneOf([ false, true, "some" ])
|
|
627
629
|
};
|
|
628
630
|
var Fe = r().forwardRef((function(e, t) {
|
|
629
|
-
var n = e.active, o = e.id,
|
|
631
|
+
var n = e.active, o = e.id, i = e.onClick, a = e.selectAllLabel, l = e.totalCount, s = e.changedToggle, u = e.selected;
|
|
630
632
|
// When toggle is changed the total count is not displayed anymore so the count is now shown in the Select All menu item
|
|
631
633
|
var p = s ? " (".concat(l === null || l === void 0 ? void 0 : l.toString(), ")") : "";
|
|
632
634
|
|
|
633
635
|
return r().createElement(Be, {
|
|
634
|
-
label:
|
|
636
|
+
label: a,
|
|
635
637
|
value: "selectAll",
|
|
636
638
|
key: "selectAll",
|
|
637
|
-
onClick:
|
|
639
|
+
onClick: i,
|
|
638
640
|
"data-test": "select-all",
|
|
639
641
|
"aria-keyshortcuts": "Control+A",
|
|
640
642
|
id: o,
|
|
@@ -659,7 +661,7 @@
|
|
|
659
661
|
$truncate: false
|
|
660
662
|
}, r().createElement(Ne, {
|
|
661
663
|
$truncate: false
|
|
662
|
-
},
|
|
664
|
+
}, a))));
|
|
663
665
|
}));
|
|
664
666
|
Fe.propTypes = Ke;
|
|
665
667
|
/* harmony default export */ const $e = Fe;
|
|
@@ -746,7 +748,7 @@
|
|
|
746
748
|
}
|
|
747
749
|
var r = null;
|
|
748
750
|
var o = false;
|
|
749
|
-
var
|
|
751
|
+
var i = t.filter((function(e) {
|
|
750
752
|
var t = et(e, n.index);
|
|
751
753
|
if (t === n.value) {
|
|
752
754
|
o = true;
|
|
@@ -755,22 +757,22 @@
|
|
|
755
757
|
// If we haven't found a match yet, keep track of the next closest match.
|
|
756
758
|
// Secondary matching looks for the closest character of a higher value, and failing that, closest of a lower value.
|
|
757
759
|
if (!o) {
|
|
758
|
-
var
|
|
759
|
-
if (!
|
|
760
|
+
var i = et(r, n.index);
|
|
761
|
+
if (!i) {
|
|
760
762
|
r = e;
|
|
761
763
|
} else if (t > n.value) {
|
|
762
|
-
if (
|
|
764
|
+
if (i < n.value) {
|
|
763
765
|
r = e;
|
|
764
|
-
} else if (
|
|
766
|
+
} else if (i > t) {
|
|
765
767
|
r = e;
|
|
766
768
|
}
|
|
767
|
-
} else if (t >
|
|
769
|
+
} else if (t > i) {
|
|
768
770
|
r = e;
|
|
769
771
|
}
|
|
770
772
|
}
|
|
771
773
|
return false;
|
|
772
774
|
}));
|
|
773
|
-
return
|
|
775
|
+
return i.length === 0 && r ? [ r ] : i;
|
|
774
776
|
};
|
|
775
777
|
// CONCATENATED MODULE: ./src/utils/ssrDocument.ts
|
|
776
778
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
@@ -889,13 +891,13 @@
|
|
|
889
891
|
clearTimeout(t);
|
|
890
892
|
}
|
|
891
893
|
};
|
|
892
|
-
function
|
|
894
|
+
function it() {
|
|
893
895
|
var e = typeof window !== "undefined" ? window : ot;
|
|
894
896
|
return e;
|
|
895
897
|
}
|
|
896
898
|
// CONCATENATED MODULE: ./src/Select/SelectBase.tsx
|
|
897
|
-
function
|
|
898
|
-
|
|
899
|
+
function at() {
|
|
900
|
+
at = Object.assign || function(e) {
|
|
899
901
|
for (var t = 1; t < arguments.length; t++) {
|
|
900
902
|
var n = arguments[t];
|
|
901
903
|
for (var r in n) {
|
|
@@ -906,7 +908,7 @@
|
|
|
906
908
|
}
|
|
907
909
|
return e;
|
|
908
910
|
};
|
|
909
|
-
return
|
|
911
|
+
return at.apply(this, arguments);
|
|
910
912
|
}
|
|
911
913
|
function lt(e, t) {
|
|
912
914
|
return ut(e) || st(e, t) || dt(e, t) || ct();
|
|
@@ -919,20 +921,20 @@
|
|
|
919
921
|
var n = [];
|
|
920
922
|
var r = true;
|
|
921
923
|
var o = false;
|
|
922
|
-
var
|
|
924
|
+
var i = undefined;
|
|
923
925
|
try {
|
|
924
|
-
for (var
|
|
926
|
+
for (var a = e[Symbol.iterator](), l; !(r = (l = a.next()).done); r = true) {
|
|
925
927
|
n.push(l.value);
|
|
926
928
|
if (t && n.length === t) break;
|
|
927
929
|
}
|
|
928
930
|
} catch (e) {
|
|
929
931
|
o = true;
|
|
930
|
-
|
|
932
|
+
i = e;
|
|
931
933
|
} finally {
|
|
932
934
|
try {
|
|
933
|
-
if (!r &&
|
|
935
|
+
if (!r && a["return"] != null) a["return"]();
|
|
934
936
|
} finally {
|
|
935
|
-
if (o) throw
|
|
937
|
+
if (o) throw i;
|
|
936
938
|
}
|
|
937
939
|
}
|
|
938
940
|
return n;
|
|
@@ -967,12 +969,12 @@
|
|
|
967
969
|
}
|
|
968
970
|
return r;
|
|
969
971
|
}
|
|
970
|
-
function
|
|
972
|
+
function mt(e, t) {
|
|
971
973
|
if (!(e instanceof t)) {
|
|
972
974
|
throw new TypeError("Cannot call a class as a function");
|
|
973
975
|
}
|
|
974
976
|
}
|
|
975
|
-
function
|
|
977
|
+
function yt(e, t) {
|
|
976
978
|
for (var n = 0; n < t.length; n++) {
|
|
977
979
|
var r = t[n];
|
|
978
980
|
r.enumerable = r.enumerable || false;
|
|
@@ -982,8 +984,8 @@
|
|
|
982
984
|
}
|
|
983
985
|
}
|
|
984
986
|
function gt(e, t, n) {
|
|
985
|
-
if (t)
|
|
986
|
-
if (n)
|
|
987
|
+
if (t) yt(e.prototype, t);
|
|
988
|
+
if (n) yt(e, n);
|
|
987
989
|
return e;
|
|
988
990
|
}
|
|
989
991
|
function Ot(e, t) {
|
|
@@ -1007,12 +1009,12 @@
|
|
|
1007
1009
|
return St(e, t);
|
|
1008
1010
|
}
|
|
1009
1011
|
function wt(e) {
|
|
1010
|
-
var t =
|
|
1012
|
+
var t = Ct();
|
|
1011
1013
|
return function n() {
|
|
1012
1014
|
var r = It(e), o;
|
|
1013
1015
|
if (t) {
|
|
1014
|
-
var
|
|
1015
|
-
o = Reflect.construct(r, arguments,
|
|
1016
|
+
var i = It(this).constructor;
|
|
1017
|
+
o = Reflect.construct(r, arguments, i);
|
|
1016
1018
|
} else {
|
|
1017
1019
|
o = r.apply(this, arguments);
|
|
1018
1020
|
}
|
|
@@ -1023,15 +1025,15 @@
|
|
|
1023
1025
|
if (t && (_t(t) === "object" || typeof t === "function")) {
|
|
1024
1026
|
return t;
|
|
1025
1027
|
}
|
|
1026
|
-
return
|
|
1028
|
+
return xt(e);
|
|
1027
1029
|
}
|
|
1028
|
-
function
|
|
1030
|
+
function xt(e) {
|
|
1029
1031
|
if (e === void 0) {
|
|
1030
1032
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1031
1033
|
}
|
|
1032
1034
|
return e;
|
|
1033
1035
|
}
|
|
1034
|
-
function
|
|
1036
|
+
function Ct() {
|
|
1035
1037
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
1036
1038
|
if (Reflect.construct.sham) return false;
|
|
1037
1039
|
if (typeof Proxy === "function") return true;
|
|
@@ -1103,48 +1105,48 @@
|
|
|
1103
1105
|
return e;
|
|
1104
1106
|
}
|
|
1105
1107
|
var Mt = {
|
|
1106
|
-
allowKeyMatching:
|
|
1107
|
-
allowNewValues:
|
|
1108
|
-
animateLoading:
|
|
1109
|
-
appearance:
|
|
1110
|
-
append:
|
|
1111
|
-
children:
|
|
1112
|
-
defaultPlacement:
|
|
1113
|
-
defaultValues:
|
|
1114
|
-
describedBy:
|
|
1115
|
-
disabled:
|
|
1116
|
-
elementRef:
|
|
1117
|
-
error:
|
|
1118
|
-
filter:
|
|
1119
|
-
footerMessage:
|
|
1120
|
-
inline:
|
|
1121
|
-
inputId:
|
|
1122
|
-
inputRef:
|
|
1123
|
-
isLoadingOptions:
|
|
1124
|
-
labelledBy:
|
|
1125
|
-
labelText:
|
|
1126
|
-
loadingMessage:
|
|
1127
|
-
menuStyle:
|
|
1128
|
-
multiple:
|
|
1129
|
-
name:
|
|
1130
|
-
noOptionsMessage:
|
|
1131
|
-
onChange:
|
|
1132
|
-
onClose:
|
|
1133
|
-
onFilterChange:
|
|
1134
|
-
onOpen:
|
|
1135
|
-
onScroll:
|
|
1136
|
-
onScrollBottom:
|
|
1108
|
+
allowKeyMatching: i().bool,
|
|
1109
|
+
allowNewValues: i().bool,
|
|
1110
|
+
animateLoading: i().bool,
|
|
1111
|
+
appearance: i().oneOf([ "default", "link", "primary", "pill", "toggle", "flat" ]),
|
|
1112
|
+
append: i().bool,
|
|
1113
|
+
children: i().node,
|
|
1114
|
+
defaultPlacement: i().oneOf([ "above", "below", "vertical" ]),
|
|
1115
|
+
defaultValues: i().array,
|
|
1116
|
+
describedBy: i().string,
|
|
1117
|
+
disabled: i().bool,
|
|
1118
|
+
elementRef: i().oneOfType([ i().func, i().object ]),
|
|
1119
|
+
error: i().bool,
|
|
1120
|
+
filter: i().oneOf([ false, true, "controlled" ]),
|
|
1121
|
+
footerMessage: i().node,
|
|
1122
|
+
inline: i().bool,
|
|
1123
|
+
inputId: i().string,
|
|
1124
|
+
inputRef: i().oneOfType([ i().func, i().object ]),
|
|
1125
|
+
isLoadingOptions: i().bool,
|
|
1126
|
+
labelledBy: i().string,
|
|
1127
|
+
labelText: i().string,
|
|
1128
|
+
loadingMessage: i().node,
|
|
1129
|
+
menuStyle: i().object,
|
|
1130
|
+
multiple: i().bool,
|
|
1131
|
+
name: i().string,
|
|
1132
|
+
noOptionsMessage: i().node,
|
|
1133
|
+
onChange: i().func,
|
|
1134
|
+
onClose: i().func,
|
|
1135
|
+
onFilterChange: i().func,
|
|
1136
|
+
onOpen: i().func,
|
|
1137
|
+
onScroll: i().func,
|
|
1138
|
+
onScrollBottom: i().func,
|
|
1137
1139
|
/** @private. */
|
|
1138
|
-
required:
|
|
1139
|
-
placeholder:
|
|
1140
|
-
prefixLabel:
|
|
1141
|
-
prepend:
|
|
1142
|
-
repositionMode:
|
|
1143
|
-
selectAllAppearance:
|
|
1144
|
-
showSelectedValuesFirst:
|
|
1145
|
-
suffixLabel:
|
|
1146
|
-
tabConfirmsNewValue:
|
|
1147
|
-
values:
|
|
1140
|
+
required: i().bool,
|
|
1141
|
+
placeholder: i().string,
|
|
1142
|
+
prefixLabel: i().string,
|
|
1143
|
+
prepend: i().bool,
|
|
1144
|
+
repositionMode: i().oneOf([ "none", "flip" ]),
|
|
1145
|
+
selectAllAppearance: i().oneOf([ "buttongroup", "checkbox" ]),
|
|
1146
|
+
showSelectedValuesFirst: i().oneOf([ "nextOpen", "immediately", "never" ]),
|
|
1147
|
+
suffixLabel: i().string,
|
|
1148
|
+
tabConfirmsNewValue: i().bool,
|
|
1149
|
+
values: i().array
|
|
1148
1150
|
};
|
|
1149
1151
|
var Tt = {
|
|
1150
1152
|
allowKeyMatching: true,
|
|
@@ -1171,13 +1173,15 @@
|
|
|
1171
1173
|
}));
|
|
1172
1174
|
// preserve separate widths for single vs. multi mode
|
|
1173
1175
|
var Vt = w()((function(e) {
|
|
1174
|
-
var t = e.anchorWidth, n = e.isMultiple, r = e.menuStyle;
|
|
1176
|
+
var t = e.anchorWidth, n = e.isMultiple, r = e.maxHeight, o = e.menuStyle;
|
|
1175
1177
|
return n ? jt({
|
|
1176
|
-
width: Math.max(t !== null && t !== void 0 ? t : 0, 200)
|
|
1177
|
-
|
|
1178
|
+
width: Math.max(t !== null && t !== void 0 ? t : 0, 200),
|
|
1179
|
+
maxHeight: r
|
|
1180
|
+
}, o) : jt({
|
|
1178
1181
|
minWidth: t !== null && t !== void 0 ? t : undefined,
|
|
1179
|
-
maxWidth: Math.max(t !== null && t !== void 0 ? t : 0, 300)
|
|
1180
|
-
|
|
1182
|
+
maxWidth: Math.max(t !== null && t !== void 0 ? t : 0, 300),
|
|
1183
|
+
maxHeight: r
|
|
1184
|
+
}, o);
|
|
1181
1185
|
}));
|
|
1182
1186
|
var Rt = [ "clickAway", "escapeKey", "offScreen", "tabKey", "toggleClick" ];
|
|
1183
1187
|
function Dt(e) {
|
|
@@ -1197,149 +1201,149 @@
|
|
|
1197
1201
|
}
|
|
1198
1202
|
} ]);
|
|
1199
1203
|
function o(e) {
|
|
1200
|
-
var
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
Et(
|
|
1204
|
-
Et(
|
|
1205
|
-
Et(
|
|
1206
|
-
Et(
|
|
1207
|
-
Et(
|
|
1208
|
-
Et(
|
|
1209
|
-
Et(
|
|
1210
|
-
Et(
|
|
1211
|
-
Et(
|
|
1212
|
-
Et(
|
|
1213
|
-
Et(
|
|
1214
|
-
Et(
|
|
1215
|
-
Et(
|
|
1216
|
-
Et(
|
|
1217
|
-
Et(
|
|
1218
|
-
Et(
|
|
1219
|
-
Et(
|
|
1220
|
-
Et(
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
if (
|
|
1224
|
-
clearTimeout(
|
|
1204
|
+
var i;
|
|
1205
|
+
mt(this, o);
|
|
1206
|
+
i = t.call(this, e);
|
|
1207
|
+
Et(xt(i), "activeItemId", void 0);
|
|
1208
|
+
Et(xt(i), "activeValue", void 0);
|
|
1209
|
+
Et(xt(i), "availableOptionCount", void 0);
|
|
1210
|
+
Et(xt(i), "controlledExternally", void 0);
|
|
1211
|
+
Et(xt(i), "displayedValues", void 0);
|
|
1212
|
+
Et(xt(i), "dropdown", null);
|
|
1213
|
+
Et(xt(i), "firstSelectedEnabledOption", null);
|
|
1214
|
+
Et(xt(i), "firstSelectedOptionIndex", void 0);
|
|
1215
|
+
Et(xt(i), "menuId", void 0);
|
|
1216
|
+
Et(xt(i), "previousActiveIndex", null);
|
|
1217
|
+
Et(xt(i), "selectedOptionCount", void 0);
|
|
1218
|
+
Et(xt(i), "optionRefsByKey", void 0);
|
|
1219
|
+
Et(xt(i), "matchCharacter", void 0);
|
|
1220
|
+
Et(xt(i), "matchTimeout", void 0);
|
|
1221
|
+
Et(xt(i), "currentMatchOptions", void 0);
|
|
1222
|
+
Et(xt(i), "availableMatchOptions", void 0);
|
|
1223
|
+
Et(xt(i), "optionSelection", void 0);
|
|
1224
|
+
Et(xt(i), "resetMatches", (function() {
|
|
1225
|
+
i.matchCharacter = null;
|
|
1226
|
+
i.currentMatchOptions = [];
|
|
1227
|
+
if (i.matchTimeout) {
|
|
1228
|
+
clearTimeout(i.matchTimeout);
|
|
1225
1229
|
}
|
|
1226
1230
|
}));
|
|
1227
|
-
Et(
|
|
1231
|
+
Et(xt(i), "handleSelectAll", (function(e) {
|
|
1228
1232
|
var t, n, o;
|
|
1229
|
-
var
|
|
1233
|
+
var a = i.props, l = a.name, c = a.children, s = a.multiple;
|
|
1230
1234
|
// this doesn't make sense if we can't select multiple values
|
|
1231
1235
|
if (!s) {
|
|
1232
1236
|
return;
|
|
1233
1237
|
}
|
|
1234
|
-
var u = (t =
|
|
1235
|
-
var p = A()(u.concat(
|
|
1238
|
+
var u = (t = i.getCurrentValues()) !== null && t !== void 0 ? t : [];
|
|
1239
|
+
var p = A()(u.concat(i.displayedValues));
|
|
1236
1240
|
p = r().Children.toArray(c).filter((function(e) {
|
|
1237
1241
|
return Dt(e) && b()(p, e.props.value) && (!e.props.disabled || b()(u, e.props.value));
|
|
1238
1242
|
})).map((function(e) {
|
|
1239
1243
|
return e.props.value;
|
|
1240
1244
|
}));
|
|
1241
|
-
if (!
|
|
1242
|
-
|
|
1245
|
+
if (!i.isControlled()) {
|
|
1246
|
+
i.setState({
|
|
1243
1247
|
values: p
|
|
1244
1248
|
});
|
|
1245
1249
|
}
|
|
1246
|
-
(n = (o =
|
|
1250
|
+
(n = (o = i.props).onChange) === null || n === void 0 ? void 0 : n.call(o, e, {
|
|
1247
1251
|
values: p,
|
|
1248
1252
|
name: l,
|
|
1249
1253
|
reason: "selectAll"
|
|
1250
1254
|
});
|
|
1251
1255
|
}));
|
|
1252
|
-
Et(
|
|
1256
|
+
Et(xt(i), "handleClearAll", (function(e) {
|
|
1253
1257
|
var t, n, o;
|
|
1254
|
-
var
|
|
1258
|
+
var a = i.props, l = a.name, c = a.children, s = a.multiple;
|
|
1255
1259
|
// this doesn't make sense if we can't select multiple values
|
|
1256
1260
|
if (!s) {
|
|
1257
1261
|
return;
|
|
1258
1262
|
}
|
|
1259
|
-
var u = (t =
|
|
1260
|
-
var p = E().apply(void 0, [ u ].concat(pt(
|
|
1263
|
+
var u = (t = i.getCurrentValues()) !== null && t !== void 0 ? t : [];
|
|
1264
|
+
var p = E().apply(void 0, [ u ].concat(pt(i.displayedValues)));
|
|
1261
1265
|
// this will unselect all selected values unless those values are disabled or hidden by the filter
|
|
1262
1266
|
var f = r().Children.toArray(c).filter((function(e) {
|
|
1263
1267
|
return Dt(e) && (b()(u, e.props.value) && e.props.disabled || b()(p, e.props.value));
|
|
1264
1268
|
})).map((function(e) {
|
|
1265
1269
|
return e.props.value;
|
|
1266
1270
|
}));
|
|
1267
|
-
if (!
|
|
1268
|
-
|
|
1271
|
+
if (!i.isControlled()) {
|
|
1272
|
+
i.setState({
|
|
1269
1273
|
values: f
|
|
1270
1274
|
});
|
|
1271
1275
|
}
|
|
1272
|
-
(n = (o =
|
|
1276
|
+
(n = (o = i.props).onChange) === null || n === void 0 ? void 0 : n.call(o, e, {
|
|
1273
1277
|
values: f,
|
|
1274
1278
|
name: l,
|
|
1275
1279
|
reason: "clearAll"
|
|
1276
1280
|
});
|
|
1277
1281
|
}));
|
|
1278
|
-
Et(
|
|
1279
|
-
var t =
|
|
1282
|
+
Et(xt(i), "handleTextKeyDown", (function(e) {
|
|
1283
|
+
var t = i.props, r = t.children, o = t.onScrollBottom, a = t.tabConfirmsNewValue;
|
|
1280
1284
|
var l = (0, R.keycode)(e.nativeEvent);
|
|
1281
1285
|
if (l === "tab") {
|
|
1282
|
-
if (
|
|
1286
|
+
if (a && !y()(i.activeValue) && i.availableOptionCount <= 1) {
|
|
1283
1287
|
e.preventDefault();
|
|
1284
|
-
|
|
1288
|
+
i.toggleValue(e, i.activeValue);
|
|
1285
1289
|
}
|
|
1286
1290
|
}
|
|
1287
1291
|
if (e.shiftKey || e.metaKey || e.ctrlKey) {
|
|
1288
1292
|
if (l === "a" && (e.ctrlKey || e.metaKey)) {
|
|
1289
1293
|
// handle control + A
|
|
1290
|
-
if (
|
|
1291
|
-
|
|
1294
|
+
if (i.optionSelection === "all") {
|
|
1295
|
+
i.handleClearAll(e);
|
|
1292
1296
|
} else {
|
|
1293
|
-
|
|
1297
|
+
i.handleSelectAll(e);
|
|
1294
1298
|
}
|
|
1295
1299
|
}
|
|
1296
1300
|
return;
|
|
1297
1301
|
}
|
|
1298
1302
|
if (l === "down") {
|
|
1299
1303
|
e.preventDefault();
|
|
1300
|
-
|
|
1304
|
+
i.setState((function(e) {
|
|
1301
1305
|
return {
|
|
1302
|
-
activeIndex: Math.min(e.activeIndex + 1,
|
|
1306
|
+
activeIndex: Math.min(e.activeIndex + 1, i.props.selectAllAppearance === "checkbox" ? i.availableOptionCount : i.availableOptionCount - 1)
|
|
1303
1307
|
};
|
|
1304
1308
|
}));
|
|
1305
1309
|
if (r && o) {
|
|
1306
1310
|
var c;
|
|
1307
|
-
var s = n.Children.toArray(r).length - (2 + ((c =
|
|
1308
|
-
if (
|
|
1309
|
-
|
|
1311
|
+
var s = n.Children.toArray(r).length - (2 + ((c = i.getCurrentValues()) !== null && c !== void 0 ? c : []).length);
|
|
1312
|
+
if (i.state.activeIndex === s) {
|
|
1313
|
+
i.handleScrollBottom(e);
|
|
1310
1314
|
}
|
|
1311
1315
|
}
|
|
1312
1316
|
}
|
|
1313
1317
|
if (l === "up") {
|
|
1314
1318
|
e.preventDefault();
|
|
1315
|
-
|
|
1319
|
+
i.setState((function(e) {
|
|
1316
1320
|
return {
|
|
1317
1321
|
activeIndex: Math.max(e.activeIndex - 1, 0)
|
|
1318
1322
|
};
|
|
1319
1323
|
}));
|
|
1320
1324
|
}
|
|
1321
|
-
if (l === "enter" && !
|
|
1322
|
-
if (
|
|
1323
|
-
if (
|
|
1324
|
-
|
|
1325
|
+
if (l === "enter" && !y()(i.activeValue) && i.state.open) {
|
|
1326
|
+
if (i.activeValue === "selectAll") {
|
|
1327
|
+
if (i.optionSelection === "all") {
|
|
1328
|
+
i.handleClearAll(e);
|
|
1325
1329
|
} else {
|
|
1326
|
-
|
|
1330
|
+
i.handleSelectAll(e);
|
|
1327
1331
|
}
|
|
1328
1332
|
} else {
|
|
1329
1333
|
e.preventDefault();
|
|
1330
|
-
|
|
1334
|
+
i.toggleValue(e, i.activeValue);
|
|
1331
1335
|
}
|
|
1332
1336
|
}
|
|
1333
1337
|
}));
|
|
1334
|
-
Et(
|
|
1338
|
+
Et(xt(i), "handleMenuOptionClick", (function(e, t) {
|
|
1335
1339
|
var n = t.value;
|
|
1336
1340
|
e.preventDefault();
|
|
1337
|
-
if (!
|
|
1341
|
+
if (!i.state.open) {
|
|
1338
1342
|
return;
|
|
1339
1343
|
}
|
|
1340
|
-
|
|
1344
|
+
i.toggleValue(e, n);
|
|
1341
1345
|
}));
|
|
1342
|
-
Et(
|
|
1346
|
+
Et(xt(i), "handleMenuOptionKeyDown", (function(e, t) {
|
|
1343
1347
|
var n = e.nativeEvent.key;
|
|
1344
1348
|
// Checking for a single character to avoid complications from double-byte languages and emojis.
|
|
1345
1349
|
if (n.length === 1) {
|
|
@@ -1348,131 +1352,131 @@
|
|
|
1348
1352
|
index: 0,
|
|
1349
1353
|
value: n
|
|
1350
1354
|
};
|
|
1351
|
-
if (!
|
|
1355
|
+
if (!i.matchCharacter) {
|
|
1352
1356
|
if (n === " ") {
|
|
1353
|
-
|
|
1357
|
+
i.resetMatches();
|
|
1354
1358
|
return;
|
|
1355
1359
|
}
|
|
1356
|
-
r = tt(
|
|
1357
|
-
} else if (
|
|
1358
|
-
o.index =
|
|
1359
|
-
r = tt(
|
|
1360
|
+
r = tt(i.availableMatchOptions, o);
|
|
1361
|
+
} else if (i.currentMatchOptions.length > 1) {
|
|
1362
|
+
o.index = i.matchCharacter.index + 1;
|
|
1363
|
+
r = tt(i.currentMatchOptions, o);
|
|
1360
1364
|
}
|
|
1361
1365
|
if (r.length) {
|
|
1362
|
-
var
|
|
1366
|
+
var a = 0;
|
|
1363
1367
|
// If the active option is a first character match, cycle to the next matching option.
|
|
1364
1368
|
if (o.index === 0 && r.length > 1) {
|
|
1365
|
-
var l = r.indexOf(
|
|
1369
|
+
var l = r.indexOf(i.availableMatchOptions[t]);
|
|
1366
1370
|
if (l >= 0) {
|
|
1367
|
-
|
|
1371
|
+
a = l === r.length - 1 ? 0 : l + 1;
|
|
1368
1372
|
}
|
|
1369
1373
|
}
|
|
1370
|
-
var c = r[
|
|
1371
|
-
var s =
|
|
1374
|
+
var c = r[a];
|
|
1375
|
+
var s = i.optionRefsByKey[qt(c.value, c.label)];
|
|
1372
1376
|
if (s != null) {
|
|
1373
1377
|
var u;
|
|
1374
1378
|
(u = s.focus) === null || u === void 0 ? void 0 : u.call(s);
|
|
1375
1379
|
}
|
|
1376
1380
|
}
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
if (
|
|
1380
|
-
clearTimeout(
|
|
1381
|
+
i.currentMatchOptions = r;
|
|
1382
|
+
i.matchCharacter = o;
|
|
1383
|
+
if (i.matchTimeout) {
|
|
1384
|
+
clearTimeout(i.matchTimeout);
|
|
1381
1385
|
}
|
|
1382
|
-
|
|
1386
|
+
i.matchTimeout = setTimeout(i.resetMatches, 500);
|
|
1383
1387
|
e.preventDefault();
|
|
1384
1388
|
e.stopPropagation();
|
|
1385
1389
|
}
|
|
1386
1390
|
}));
|
|
1387
|
-
Et(
|
|
1391
|
+
Et(xt(i), "handleTextChange", (function(e, t) {
|
|
1388
1392
|
var n, r;
|
|
1389
1393
|
var o = t.value;
|
|
1390
|
-
|
|
1394
|
+
i.setState({
|
|
1391
1395
|
filterKeyword: o,
|
|
1392
1396
|
open: true,
|
|
1393
1397
|
activeIndex: 0
|
|
1394
1398
|
});
|
|
1395
|
-
(n = (r =
|
|
1399
|
+
(n = (r = i.props).onFilterChange) === null || n === void 0 ? void 0 : n.call(r, e, {
|
|
1396
1400
|
keyword: o
|
|
1397
1401
|
});
|
|
1398
1402
|
}));
|
|
1399
|
-
Et(
|
|
1400
|
-
|
|
1403
|
+
Et(xt(i), "handleTextFocus", (function() {
|
|
1404
|
+
i.setState({
|
|
1401
1405
|
textHasFocus: true
|
|
1402
1406
|
});
|
|
1403
1407
|
}));
|
|
1404
|
-
Et(
|
|
1405
|
-
|
|
1408
|
+
Et(xt(i), "handleTextBlur", (function() {
|
|
1409
|
+
i.setState({
|
|
1406
1410
|
textHasFocus: false
|
|
1407
1411
|
});
|
|
1408
1412
|
}));
|
|
1409
|
-
Et(
|
|
1413
|
+
Et(xt(i), "handleRequestOpen", (function(e) {
|
|
1410
1414
|
var t = {
|
|
1411
1415
|
open: true,
|
|
1412
|
-
topValues:
|
|
1416
|
+
topValues: i.getTopValues()
|
|
1413
1417
|
};
|
|
1414
1418
|
// SUI-3234: preserve existing behavior difference between <Select> and <Multiselect.Compact>
|
|
1415
|
-
if (
|
|
1419
|
+
if (i.props.multiple) {
|
|
1416
1420
|
t.filterKeyword = "";
|
|
1417
1421
|
}
|
|
1418
|
-
var n =
|
|
1419
|
-
|
|
1422
|
+
var n = i.state.filterKeyword;
|
|
1423
|
+
i.setState(t, (function() {
|
|
1420
1424
|
var t, r;
|
|
1421
|
-
(t = (r =
|
|
1422
|
-
if (
|
|
1423
|
-
|
|
1425
|
+
(t = (r = i.props).onOpen) === null || t === void 0 ? void 0 : t.call(r);
|
|
1426
|
+
if (i.firstSelectedEnabledOption && !i.hasFilter()) {
|
|
1427
|
+
i.firstSelectedEnabledOption.focus();
|
|
1424
1428
|
} else {
|
|
1425
1429
|
var o;
|
|
1426
|
-
|
|
1427
|
-
activeIndex: (o =
|
|
1430
|
+
i.setState({
|
|
1431
|
+
activeIndex: (o = i.firstSelectedOptionIndex) !== null && o !== void 0 ? o : 0
|
|
1428
1432
|
});
|
|
1429
1433
|
}
|
|
1430
|
-
if (n !==
|
|
1431
|
-
var
|
|
1432
|
-
(
|
|
1433
|
-
keyword:
|
|
1434
|
+
if (n !== i.state.filterKeyword) {
|
|
1435
|
+
var a, l;
|
|
1436
|
+
(a = (l = i.props).onFilterChange) === null || a === void 0 ? void 0 : a.call(l, e, {
|
|
1437
|
+
keyword: i.state.filterKeyword
|
|
1434
1438
|
});
|
|
1435
1439
|
}
|
|
1436
1440
|
}));
|
|
1437
1441
|
}));
|
|
1438
|
-
Et(
|
|
1439
|
-
|
|
1442
|
+
Et(xt(i), "handleRequestClose", (function() {
|
|
1443
|
+
i.setState({
|
|
1440
1444
|
open: false,
|
|
1441
1445
|
activeIndex: 0
|
|
1442
1446
|
}, (function() {
|
|
1443
1447
|
var e, t;
|
|
1444
|
-
|
|
1445
|
-
(e = (t =
|
|
1448
|
+
i.previousActiveIndex = null;
|
|
1449
|
+
(e = (t = i.props).onClose) === null || e === void 0 ? void 0 : e.call(t);
|
|
1446
1450
|
}));
|
|
1447
1451
|
}));
|
|
1448
|
-
Et(
|
|
1449
|
-
if (
|
|
1452
|
+
Et(xt(i), "handleScrollBottom", (function(e) {
|
|
1453
|
+
if (i.state.open && !i.props.isLoadingOptions) {
|
|
1450
1454
|
var t, n;
|
|
1451
|
-
(t = (n =
|
|
1455
|
+
(t = (n = i.props).onScrollBottom) === null || t === void 0 ? void 0 : t.call(n, e);
|
|
1452
1456
|
}
|
|
1453
1457
|
}));
|
|
1454
|
-
Et(
|
|
1455
|
-
if (
|
|
1458
|
+
Et(xt(i), "handleActiveOptionMount", (function(e) {
|
|
1459
|
+
if (i.previousActiveIndex !== i.state.activeIndex) {
|
|
1456
1460
|
e === null || e === void 0 ? void 0 : e.scrollIntoViewIfNeeded();
|
|
1457
1461
|
}
|
|
1458
1462
|
}));
|
|
1459
|
-
Et(
|
|
1463
|
+
Et(xt(i), "handleOptionMount", (function(e, t, n) {
|
|
1460
1464
|
if (n) {
|
|
1461
|
-
|
|
1465
|
+
i.firstSelectedEnabledOption = e;
|
|
1462
1466
|
}
|
|
1463
1467
|
if (e == null) {
|
|
1464
|
-
delete
|
|
1468
|
+
delete i.optionRefsByKey[t];
|
|
1465
1469
|
} else {
|
|
1466
|
-
|
|
1470
|
+
i.optionRefsByKey[t] = e;
|
|
1467
1471
|
}
|
|
1468
1472
|
}));
|
|
1469
|
-
Et(
|
|
1473
|
+
Et(xt(i), "createToggle", (function() {
|
|
1470
1474
|
var e;
|
|
1471
|
-
var t =
|
|
1472
|
-
var
|
|
1475
|
+
var t = i.props, a = t.toggle, l = t.appearance, s = t.children, u = t.describedBy, p = t.disabled, d = t.elementRef, v = t.error, h = t.inline, b = t.labelledBy, m = t.labelText, y = t.multiple, g = t.placeholder, S = t.prefixLabel, w = t.required, k = t.suffixLabel;
|
|
1476
|
+
var C;
|
|
1473
1477
|
var _;
|
|
1474
1478
|
// Generate buttonLabels
|
|
1475
|
-
var A = (e =
|
|
1479
|
+
var A = (e = i.getCurrentValues()) !== null && e !== void 0 ? e : [];
|
|
1476
1480
|
var j = n.Children.toArray(s);
|
|
1477
1481
|
var E = A.reduce((function(e, t, n, r) {
|
|
1478
1482
|
var o = f()(j, (function(e) {
|
|
@@ -1481,10 +1485,10 @@
|
|
|
1481
1485
|
if (o) {
|
|
1482
1486
|
e.push(o.props.children || o.props.label);
|
|
1483
1487
|
// if not in multiple mode, add the icon
|
|
1484
|
-
if (!
|
|
1485
|
-
|
|
1488
|
+
if (!y && A.length === 1) {
|
|
1489
|
+
C = o.props.icon;
|
|
1486
1490
|
}
|
|
1487
|
-
} else if (
|
|
1491
|
+
} else if (y) {
|
|
1488
1492
|
// only add values that don't match an option in "multiple" mode to preserve old behaviour
|
|
1489
1493
|
e.push(t);
|
|
1490
1494
|
}
|
|
@@ -1496,7 +1500,7 @@
|
|
|
1496
1500
|
_ = E;
|
|
1497
1501
|
// only apply prefix / suffix if the label is not empty
|
|
1498
1502
|
if (_.length > 0) {
|
|
1499
|
-
_ =
|
|
1503
|
+
_ = i.wrapLabel({
|
|
1500
1504
|
prefixLabel: S,
|
|
1501
1505
|
label: _,
|
|
1502
1506
|
suffixLabel: k
|
|
@@ -1504,7 +1508,7 @@
|
|
|
1504
1508
|
}
|
|
1505
1509
|
// single <Select> behaviour is to show the placeholder if all parts of the the label
|
|
1506
1510
|
// are empty strings so we replicate this behaviour here
|
|
1507
|
-
if (_.length === 0 || !
|
|
1511
|
+
if (_.length === 0 || !y && _.every((function(e) {
|
|
1508
1512
|
return e === "";
|
|
1509
1513
|
}))) {
|
|
1510
1514
|
_ = Pt(g);
|
|
@@ -1513,7 +1517,7 @@
|
|
|
1513
1517
|
// If there's more than one item selected, read out the selected total
|
|
1514
1518
|
// rather than reading out each selected item
|
|
1515
1519
|
if (_.length > 1) {
|
|
1516
|
-
M =
|
|
1520
|
+
M = i.wrapLabel({
|
|
1517
1521
|
prefixLabel: S,
|
|
1518
1522
|
label: [ "".concat(A.length, " items selected") ],
|
|
1519
1523
|
suffixLabel: k
|
|
@@ -1521,103 +1525,103 @@
|
|
|
1521
1525
|
}
|
|
1522
1526
|
var T = jt({
|
|
1523
1527
|
"aria-describedby": u,
|
|
1524
|
-
"aria-label": "".concat(
|
|
1525
|
-
"aria-labelledby":
|
|
1526
|
-
"aria-multiselectable":
|
|
1528
|
+
"aria-label": "".concat(m ? "".concat(m, ", ") : "").concat(M),
|
|
1529
|
+
"aria-labelledby": m ? undefined : b,
|
|
1530
|
+
"aria-multiselectable": y || undefined,
|
|
1527
1531
|
"aria-required": w,
|
|
1528
1532
|
"data-select-appearance": l,
|
|
1529
|
-
"data-test":
|
|
1533
|
+
"data-test": y ? "multiselect" : "select",
|
|
1530
1534
|
disabled: p,
|
|
1531
1535
|
elementRef: d,
|
|
1532
1536
|
error: v
|
|
1533
|
-
},
|
|
1534
|
-
if (
|
|
1537
|
+
}, x()(i.props, O()(o.propTypes)));
|
|
1538
|
+
if (y) {
|
|
1535
1539
|
T["data-test-values"] = JSON.stringify(A);
|
|
1536
1540
|
} else {
|
|
1537
1541
|
var P = lt(A, 1), V = P[0];
|
|
1538
1542
|
T["data-test-value"] = V;
|
|
1539
1543
|
}
|
|
1540
|
-
if (
|
|
1544
|
+
if (a) {
|
|
1541
1545
|
|
|
1542
|
-
return (0, n.cloneElement)(
|
|
1546
|
+
return (0, n.cloneElement)(a, T);
|
|
1543
1547
|
}
|
|
1544
1548
|
if (l === "link") {
|
|
1545
1549
|
|
|
1546
|
-
return r().createElement(L(),
|
|
1550
|
+
return r().createElement(L(), at({}, T, {
|
|
1547
1551
|
"data-select-appearance": "link"
|
|
1548
|
-
}), !!
|
|
1552
|
+
}), !!C && r().createElement(Ue, null, C), _ || g, r().createElement(Ge, null, r().createElement(J, null)));
|
|
1549
1553
|
}
|
|
1550
1554
|
|
|
1551
|
-
return r().createElement(ze,
|
|
1552
|
-
$multiple:
|
|
1555
|
+
return r().createElement(ze, at({}, T, {
|
|
1556
|
+
$multiple: y,
|
|
1553
1557
|
appearance: l,
|
|
1554
1558
|
label: _,
|
|
1555
1559
|
error: v,
|
|
1556
|
-
icon:
|
|
1560
|
+
icon: C,
|
|
1557
1561
|
inline: h,
|
|
1558
1562
|
isMenu: true,
|
|
1559
1563
|
"aria-haspopup": "listbox",
|
|
1560
|
-
"aria-owns":
|
|
1561
|
-
onClick:
|
|
1562
|
-
}, I()(
|
|
1564
|
+
"aria-owns": i.menuId,
|
|
1565
|
+
onClick: i.props.onClick
|
|
1566
|
+
}, I()(i.props, o.invalidLinkAppearanceProps)), !!A.length && y && r().createElement(Xe, {
|
|
1563
1567
|
"data-role": "count"
|
|
1564
1568
|
}, "(", A.length, ")"));
|
|
1565
1569
|
}));
|
|
1566
|
-
Et(
|
|
1567
|
-
var e =
|
|
1568
|
-
var l =
|
|
1569
|
-
var g =
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1570
|
+
Et(xt(i), "createChildren", (function() {
|
|
1571
|
+
var e = i.state, t = e.filterKeyword, o = e.textHasFocus, a = e.topValues;
|
|
1572
|
+
var l = i.props, s = l.allowKeyMatching, u = l.allowNewValues, p = l.filter, d = l.multiple, h = l.selectAllAppearance, b = l.showSelectedValuesFirst, m = l.isLoadingOptions, y = l.onScrollBottom;
|
|
1573
|
+
var g = i.getCurrentValues();
|
|
1574
|
+
i.availableOptionCount = 0;
|
|
1575
|
+
i.firstSelectedOptionIndex = undefined;
|
|
1576
|
+
i.selectedOptionCount = 0;
|
|
1577
|
+
i.activeValue = undefined;
|
|
1578
|
+
i.availableMatchOptions = [];
|
|
1575
1579
|
var O;
|
|
1576
1580
|
var S = 0;
|
|
1577
1581
|
var w = false;
|
|
1578
1582
|
// used to avoid overwriting the selected item ref in multiple mode
|
|
1579
1583
|
var k;
|
|
1580
|
-
var
|
|
1581
|
-
var
|
|
1584
|
+
var x = b === "immediately" ? i.getTopValues() : a;
|
|
1585
|
+
var C = n.Children.toArray(i.props.children).reduce((function(e, t, o) {
|
|
1582
1586
|
// ignore Headings and Dividers
|
|
1583
1587
|
if (!Dt(t)) {
|
|
1584
1588
|
e.push(t);
|
|
1585
1589
|
return e;
|
|
1586
1590
|
}
|
|
1587
1591
|
// Find out if the search string exactly matches a value
|
|
1588
|
-
if (t.props.value ===
|
|
1592
|
+
if (t.props.value === i.state.filterKeyword) {
|
|
1589
1593
|
O = true;
|
|
1590
1594
|
}
|
|
1591
|
-
var
|
|
1592
|
-
var l = !!
|
|
1593
|
-
var c = s && !d && !p && !
|
|
1595
|
+
var a = g && g.indexOf(t.props.value) >= 0;
|
|
1596
|
+
var l = !!a && !t.props.disabled && !k;
|
|
1597
|
+
var c = s && !d && !p && !m && !y;
|
|
1594
1598
|
var u = qt(t.props.value, t.props.label);
|
|
1595
1599
|
var f = -1;
|
|
1596
1600
|
if (c && !t.props.disabled && !t.props.hidden) {
|
|
1597
|
-
|
|
1601
|
+
i.availableMatchOptions.push({
|
|
1598
1602
|
label: t.props.label,
|
|
1599
1603
|
value: t.props.value
|
|
1600
1604
|
});
|
|
1601
|
-
f =
|
|
1605
|
+
f = i.availableMatchOptions.length - 1;
|
|
1602
1606
|
}
|
|
1603
1607
|
// Format the Menu.Item
|
|
1604
1608
|
var v = (0, n.cloneElement)(t, {
|
|
1605
1609
|
key: t.key || o,
|
|
1606
|
-
onClick:
|
|
1610
|
+
onClick: i.handleMenuOptionClick,
|
|
1607
1611
|
onKeyDown: c ? function(e) {
|
|
1608
|
-
return
|
|
1612
|
+
return i.handleMenuOptionKeyDown(e, f);
|
|
1609
1613
|
} : undefined,
|
|
1610
|
-
selected:
|
|
1614
|
+
selected: a,
|
|
1611
1615
|
multiple: d,
|
|
1612
1616
|
role: "option",
|
|
1613
1617
|
ref: function e(t) {
|
|
1614
|
-
return
|
|
1618
|
+
return i.handleOptionMount(t, u, l);
|
|
1615
1619
|
}
|
|
1616
1620
|
});
|
|
1617
1621
|
if (l) {
|
|
1618
1622
|
k = true;
|
|
1619
1623
|
}
|
|
1620
|
-
if (
|
|
1624
|
+
if (x && x.indexOf(t.props.value) >= 0) {
|
|
1621
1625
|
if (S === 0) {
|
|
1622
1626
|
e.splice(S, 0, r().createElement(T.Divider, {
|
|
1623
1627
|
key: "topDivider"
|
|
@@ -1634,27 +1638,27 @@
|
|
|
1634
1638
|
// In multiple mode, add missing items
|
|
1635
1639
|
if (d) {
|
|
1636
1640
|
v()(g, (function(e) {
|
|
1637
|
-
var t = f()(
|
|
1641
|
+
var t = f()(C, (function(t) {
|
|
1638
1642
|
return Dt(t) && t.props && t.props.value === e;
|
|
1639
1643
|
}));
|
|
1640
1644
|
if (!t) {
|
|
1641
|
-
if (e ===
|
|
1645
|
+
if (e === i.state.filterKeyword) {
|
|
1642
1646
|
O = true;
|
|
1643
1647
|
}
|
|
1644
|
-
var n =
|
|
1645
|
-
var o =
|
|
1648
|
+
var n = x && x.indexOf(e) >= 0;
|
|
1649
|
+
var o = x.length;
|
|
1646
1650
|
if (S === 0) {
|
|
1647
|
-
|
|
1651
|
+
C.splice(0, 0, r().createElement(T.Divider, {
|
|
1648
1652
|
key: "topDivider"
|
|
1649
1653
|
}));
|
|
1650
1654
|
S += 1;
|
|
1651
1655
|
w = true;
|
|
1652
1656
|
}
|
|
1653
|
-
|
|
1657
|
+
C.splice(n ? 0 : o + 1, 0, r().createElement(Oe, {
|
|
1654
1658
|
label: String(e),
|
|
1655
1659
|
value: e,
|
|
1656
1660
|
key: "missing-value-".concat(e),
|
|
1657
|
-
onClick:
|
|
1661
|
+
onClick: i.handleMenuOptionClick,
|
|
1658
1662
|
multiple: d,
|
|
1659
1663
|
selected: true
|
|
1660
1664
|
}));
|
|
@@ -1667,7 +1671,7 @@
|
|
|
1667
1671
|
var I = p === "controlled";
|
|
1668
1672
|
// Filter the items
|
|
1669
1673
|
var _ = (0, D.stringToKeywords)(t);
|
|
1670
|
-
|
|
1674
|
+
C = I ? C : C.filter((function(e) {
|
|
1671
1675
|
if (Dt(e)) {
|
|
1672
1676
|
return (0, D.testPhrase)(e.props.label, _);
|
|
1673
1677
|
}
|
|
@@ -1687,19 +1691,19 @@
|
|
|
1687
1691
|
// Add the option to add the new value
|
|
1688
1692
|
if (u && !O && t) {
|
|
1689
1693
|
var A = w ? S + 1 : S;
|
|
1690
|
-
|
|
1694
|
+
C.splice(A, 0, r().createElement(Oe, {
|
|
1691
1695
|
label: "".concat(t, " (new value)"),
|
|
1692
1696
|
value: t,
|
|
1693
1697
|
key: "newValue",
|
|
1694
1698
|
multiple: d,
|
|
1695
|
-
onClick:
|
|
1699
|
+
onClick: i.handleMenuOptionClick
|
|
1696
1700
|
}));
|
|
1697
1701
|
}
|
|
1698
1702
|
// When selectAll is a menu item, add an offset so that activeItem accounts for the extra selectAll option.
|
|
1699
|
-
var j = h === "checkbox" && d &&
|
|
1703
|
+
var j = h === "checkbox" && d && C.length > 1 ? 1 : 0;
|
|
1700
1704
|
var E = true;
|
|
1701
1705
|
// Highlight the selected Items and remove hidden
|
|
1702
|
-
|
|
1706
|
+
C = C.reduce((function(e, t) {
|
|
1703
1707
|
// ignore Dividers & Headings
|
|
1704
1708
|
if (!Dt(t)) {
|
|
1705
1709
|
e.push(t);
|
|
@@ -1709,13 +1713,13 @@
|
|
|
1709
1713
|
if (t.props && t.props.hidden) {
|
|
1710
1714
|
return e;
|
|
1711
1715
|
}
|
|
1712
|
-
if (t.props.selected && !t.props.disabled &&
|
|
1713
|
-
|
|
1716
|
+
if (t.props.selected && !t.props.disabled && i.firstSelectedOptionIndex == null) {
|
|
1717
|
+
i.firstSelectedOptionIndex = i.availableOptionCount;
|
|
1714
1718
|
}
|
|
1715
|
-
var r = j ===
|
|
1719
|
+
var r = j === i.state.activeIndex;
|
|
1716
1720
|
j += 1;
|
|
1717
|
-
|
|
1718
|
-
|
|
1721
|
+
i.availableOptionCount += 1;
|
|
1722
|
+
i.selectedOptionCount += t.props.selected ? 1 : 0;
|
|
1719
1723
|
if (t.key !== "newValue" && !t.props.disabled && !t.props.selected) {
|
|
1720
1724
|
E = false;
|
|
1721
1725
|
}
|
|
@@ -1724,22 +1728,22 @@
|
|
|
1724
1728
|
return e;
|
|
1725
1729
|
}
|
|
1726
1730
|
if (!t.props.disabled) {
|
|
1727
|
-
|
|
1731
|
+
i.activeValue = t.props.value;
|
|
1728
1732
|
}
|
|
1729
|
-
var
|
|
1733
|
+
var a = (0, n.cloneElement)(t, {
|
|
1730
1734
|
active: r,
|
|
1731
|
-
id:
|
|
1732
|
-
ref:
|
|
1735
|
+
id: i.activeItemId,
|
|
1736
|
+
ref: i.handleActiveOptionMount
|
|
1733
1737
|
});
|
|
1734
|
-
e.push(
|
|
1738
|
+
e.push(a);
|
|
1735
1739
|
return e;
|
|
1736
1740
|
}), []);
|
|
1737
|
-
|
|
1741
|
+
i.optionSelection = i.selectedOptionCount === 0 && "none" || E && "all" || "some";
|
|
1738
1742
|
// add select all option
|
|
1739
|
-
if (h === "checkbox" && d &&
|
|
1743
|
+
if (h === "checkbox" && d && i.availableOptionCount > 0) {
|
|
1740
1744
|
var M;
|
|
1741
1745
|
var P;
|
|
1742
|
-
if (
|
|
1746
|
+
if (i.optionSelection === "all") {
|
|
1743
1747
|
if (t === "") {
|
|
1744
1748
|
P = (0, c._)("Clear all");
|
|
1745
1749
|
} else {
|
|
@@ -1750,33 +1754,33 @@
|
|
|
1750
1754
|
} else {
|
|
1751
1755
|
P = (0, c._)("Select all matches");
|
|
1752
1756
|
}
|
|
1753
|
-
if (
|
|
1754
|
-
|
|
1757
|
+
if (i.state.activeIndex === 0 && o) {
|
|
1758
|
+
i.activeValue = "selectAll";
|
|
1755
1759
|
}
|
|
1756
|
-
|
|
1760
|
+
C.unshift( r().createElement($e, {
|
|
1757
1761
|
key: "selectAllOption",
|
|
1758
|
-
selected:
|
|
1762
|
+
selected: i.optionSelection === "all" || i.optionSelection !== "none" && "some",
|
|
1759
1763
|
selectAllLabel: P,
|
|
1760
|
-
totalCount: (M =
|
|
1761
|
-
changedToggle: !!
|
|
1762
|
-
onClick:
|
|
1763
|
-
id:
|
|
1764
|
-
active:
|
|
1765
|
-
ref:
|
|
1764
|
+
totalCount: (M = i.getCurrentValues()) === null || M === void 0 ? void 0 : M.length,
|
|
1765
|
+
changedToggle: !!i.props.toggle,
|
|
1766
|
+
onClick: i.optionSelection === "all" ? i.handleClearAll : i.handleSelectAll,
|
|
1767
|
+
id: i.state.activeIndex === 0 ? i.activeItemId : undefined,
|
|
1768
|
+
active: i.state.activeIndex === 0,
|
|
1769
|
+
ref: i.handleActiveOptionMount,
|
|
1766
1770
|
tabIndex: -1
|
|
1767
1771
|
}), r().createElement(T.Divider, {
|
|
1768
1772
|
key: "selectAllDivider"
|
|
1769
1773
|
}));
|
|
1770
1774
|
}
|
|
1771
|
-
|
|
1775
|
+
i.displayedValues = C.reduce((function(e, t) {
|
|
1772
1776
|
if (Dt(t)) {
|
|
1773
1777
|
e.push(t.props.value);
|
|
1774
1778
|
}
|
|
1775
1779
|
return e;
|
|
1776
1780
|
}), []);
|
|
1777
|
-
return
|
|
1781
|
+
return C;
|
|
1778
1782
|
}));
|
|
1779
|
-
Et(
|
|
1783
|
+
Et(xt(i), "wrapLabel", (function(e) {
|
|
1780
1784
|
var t = e.prefixLabel, n = e.label, r = e.suffixLabel;
|
|
1781
1785
|
var o = n;
|
|
1782
1786
|
if (t) {
|
|
@@ -1787,10 +1791,10 @@
|
|
|
1787
1791
|
}
|
|
1788
1792
|
return o;
|
|
1789
1793
|
}));
|
|
1790
|
-
Et(
|
|
1791
|
-
|
|
1794
|
+
Et(xt(i), "handleDropdownMount", (function(e) {
|
|
1795
|
+
i.dropdown = e;
|
|
1792
1796
|
}));
|
|
1793
|
-
|
|
1797
|
+
i.state = {
|
|
1794
1798
|
activeIndex: 0,
|
|
1795
1799
|
filterKeyword: "",
|
|
1796
1800
|
open: false,
|
|
@@ -1798,23 +1802,23 @@
|
|
|
1798
1802
|
topValues: [],
|
|
1799
1803
|
values: e.defaultValues || []
|
|
1800
1804
|
};
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1805
|
+
i.controlledExternally = l()(e, "values");
|
|
1806
|
+
i.displayedValues = [];
|
|
1807
|
+
i.availableOptionCount = 0;
|
|
1808
|
+
i.firstSelectedOptionIndex = undefined;
|
|
1809
|
+
i.selectedOptionCount = 0;
|
|
1810
|
+
i.matchCharacter = null;
|
|
1811
|
+
i.matchTimeout = null;
|
|
1812
|
+
i.currentMatchOptions = [];
|
|
1813
|
+
i.availableMatchOptions = [];
|
|
1814
|
+
i.optionRefsByKey = {};
|
|
1815
|
+
i.optionSelection = "none";
|
|
1812
1816
|
if (false) {}
|
|
1813
1817
|
if (false) {}
|
|
1814
1818
|
o.validateAppearance(e);
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
return
|
|
1819
|
+
i.menuId = (0, M.createDOMID)("menu");
|
|
1820
|
+
i.activeItemId = (0, M.createDOMID)("active-item");
|
|
1821
|
+
return i;
|
|
1818
1822
|
}
|
|
1819
1823
|
gt(o, [ {
|
|
1820
1824
|
key: "componentDidUpdate",
|
|
@@ -1850,16 +1854,16 @@
|
|
|
1850
1854
|
}, {
|
|
1851
1855
|
key: "toggleValue",
|
|
1852
1856
|
value: function e(t, n) {
|
|
1853
|
-
var r, o,
|
|
1854
|
-
var
|
|
1855
|
-
var l =
|
|
1857
|
+
var r, o, i;
|
|
1858
|
+
var a = (r = this.getCurrentValues()) !== null && r !== void 0 ? r : [];
|
|
1859
|
+
var l = a.indexOf(n);
|
|
1856
1860
|
var c = this.props, s = c.name, u = c.multiple;
|
|
1857
1861
|
var p;
|
|
1858
1862
|
if (u) {
|
|
1859
1863
|
if (l >= 0) {
|
|
1860
|
-
p = [].concat(pt(
|
|
1864
|
+
p = [].concat(pt(a.slice(0, l)), pt(a.slice(l + 1)));
|
|
1861
1865
|
} else {
|
|
1862
|
-
p =
|
|
1866
|
+
p = a.concat([ n ]);
|
|
1863
1867
|
}
|
|
1864
1868
|
} else {
|
|
1865
1869
|
// non-multiple mode must always have a value
|
|
@@ -1886,7 +1890,7 @@
|
|
|
1886
1890
|
});
|
|
1887
1891
|
this.focus();
|
|
1888
1892
|
}
|
|
1889
|
-
(o = (
|
|
1893
|
+
(o = (i = this.props).onChange) === null || o === void 0 ? void 0 : o.call(i, t, {
|
|
1890
1894
|
values: p,
|
|
1891
1895
|
name: s,
|
|
1892
1896
|
reason: "valueToggle"
|
|
@@ -1904,8 +1908,8 @@
|
|
|
1904
1908
|
key: "renderControls",
|
|
1905
1909
|
value: function e(t) {
|
|
1906
1910
|
var n = t.hasChildren, o = t.placement;
|
|
1907
|
-
var
|
|
1908
|
-
var
|
|
1911
|
+
var i = this.state.filterKeyword;
|
|
1912
|
+
var a = this.props, l = a.inputId, s = a.inputRef, u = a.multiple, p = a.selectAllAppearance;
|
|
1909
1913
|
var f = (0, c._)("Select all options".concat(this.optionSelection === "all" ? " disabled" : ""));
|
|
1910
1914
|
var d = (0, c._)("Clear all options".concat(this.optionSelection === "none" ? " disabled" : ""));
|
|
1911
1915
|
// only visually disable these as opposed to fully disabling to avoid losing keyboard focus - see SUI-2731
|
|
@@ -1917,19 +1921,19 @@
|
|
|
1917
1921
|
"aria-label": f,
|
|
1918
1922
|
onClick: this.handleSelectAll,
|
|
1919
1923
|
"data-test": "select-all"
|
|
1920
|
-
},
|
|
1924
|
+
}, i ? (0, c._)("Select All Matches") : (0, c._)("Select All")), r().createElement(Ye, {
|
|
1921
1925
|
$disabled: this.optionSelection === "none",
|
|
1922
1926
|
"aria-label": d,
|
|
1923
1927
|
onClick: this.handleClearAll,
|
|
1924
1928
|
"data-test": "clear-all"
|
|
1925
|
-
},
|
|
1929
|
+
}, i ? (0, c._)("Clear All Matches") : (0, c._)("Clear All")));
|
|
1926
1930
|
return this.hasFilter() && r().createElement("div", {
|
|
1927
1931
|
key: "controls"
|
|
1928
1932
|
}, r().createElement(Je, {
|
|
1929
1933
|
key: "filter",
|
|
1930
1934
|
"data-test": "filter"
|
|
1931
1935
|
}, r().createElement(F(), {
|
|
1932
|
-
value:
|
|
1936
|
+
value: i,
|
|
1933
1937
|
autoCapitalize: "off",
|
|
1934
1938
|
autoComplete: "off",
|
|
1935
1939
|
autoCorrect: "off",
|
|
@@ -1953,10 +1957,10 @@
|
|
|
1953
1957
|
key: "render",
|
|
1954
1958
|
value: function e() {
|
|
1955
1959
|
var t, o = this;
|
|
1956
|
-
var
|
|
1960
|
+
var i = this.props, a = i.children, l = i.defaultPlacement, c = i.inputId, s = i.multiple, u = i.repositionMode;
|
|
1957
1961
|
var p = this.hasFilter();
|
|
1958
1962
|
var d = (t = this.getCurrentValues()) !== null && t !== void 0 ? t : [];
|
|
1959
|
-
var v = n.Children.toArray(
|
|
1963
|
+
var v = n.Children.toArray(a);
|
|
1960
1964
|
var h = d.some((function(e) {
|
|
1961
1965
|
var t = f()(v, (function(t) {
|
|
1962
1966
|
return Dt(t) && t.props.value === e;
|
|
@@ -1964,25 +1968,25 @@
|
|
|
1964
1968
|
return t && !t.props.disabled;
|
|
1965
1969
|
}));
|
|
1966
1970
|
var b = this.createChildren();
|
|
1967
|
-
var
|
|
1968
|
-
var
|
|
1969
|
-
var n = t.anchorWidth,
|
|
1971
|
+
var m = this.createToggle();
|
|
1972
|
+
var y = function e(t) {
|
|
1973
|
+
var n = t.anchorWidth, i = t.maxHeight, a = t.placement;
|
|
1970
1974
|
var l = Vt({
|
|
1971
1975
|
anchorWidth: n,
|
|
1972
1976
|
isMultiple: o.props.multiple,
|
|
1977
|
+
maxHeight: i,
|
|
1973
1978
|
menuStyle: o.props.menuStyle
|
|
1974
1979
|
});
|
|
1975
1980
|
var c = d.length > 0 && !h && !o.hasFilter() ? 0 : undefined;
|
|
1976
1981
|
|
|
1977
|
-
return r().createElement(B(),
|
|
1982
|
+
return r().createElement(B(), at({
|
|
1978
1983
|
"aria-multiselectable": s || undefined,
|
|
1979
1984
|
childrenStart: o.renderControls({
|
|
1980
|
-
placement:
|
|
1985
|
+
placement: a,
|
|
1981
1986
|
hasChildren: !!b.length
|
|
1982
1987
|
}),
|
|
1983
1988
|
controlledExternally: o.hasFilter(),
|
|
1984
|
-
placement:
|
|
1985
|
-
maxHeight: a !== null && a !== void 0 ? a : undefined,
|
|
1989
|
+
placement: a !== null && a !== void 0 ? a : undefined,
|
|
1986
1990
|
onScrollBottom: o.props.onScrollBottom ? o.handleScrollBottom : undefined,
|
|
1987
1991
|
"data-test": "results-menu",
|
|
1988
1992
|
isLoading: o.props.isLoadingOptions,
|
|
@@ -1996,18 +2000,18 @@
|
|
|
1996
2000
|
return r().createElement(V(), {
|
|
1997
2001
|
closeReasons: Rt,
|
|
1998
2002
|
inputId: c,
|
|
1999
|
-
toggle:
|
|
2003
|
+
toggle: m,
|
|
2000
2004
|
onRequestOpen: this.handleRequestOpen,
|
|
2001
2005
|
onRequestClose: this.handleRequestClose,
|
|
2002
2006
|
open: this.state.open,
|
|
2003
2007
|
openWithArrowKeys: true,
|
|
2004
2008
|
repositionMode: u,
|
|
2005
2009
|
defaultPlacement: p ? l : undefined,
|
|
2006
|
-
canCoverAnchor:
|
|
2010
|
+
canCoverAnchor: it().innerHeight < 500,
|
|
2007
2011
|
ref: this.handleDropdownMount,
|
|
2008
2012
|
retainFocus: false,
|
|
2009
2013
|
takeFocus: d.length === 0 || d.length > 0 && !h || !!p
|
|
2010
|
-
},
|
|
2014
|
+
}, y);
|
|
2011
2015
|
}
|
|
2012
2016
|
} ]);
|
|
2013
2017
|
return o;
|
|
@@ -2091,8 +2095,8 @@
|
|
|
2091
2095
|
return function n() {
|
|
2092
2096
|
var r = Xt(e), o;
|
|
2093
2097
|
if (t) {
|
|
2094
|
-
var
|
|
2095
|
-
o = Reflect.construct(r, arguments,
|
|
2098
|
+
var i = Xt(this).constructor;
|
|
2099
|
+
o = Reflect.construct(r, arguments, i);
|
|
2096
2100
|
} else {
|
|
2097
2101
|
o = r.apply(this, arguments);
|
|
2098
2102
|
}
|
|
@@ -2143,24 +2147,24 @@
|
|
|
2143
2147
|
}
|
|
2144
2148
|
var Zt = {
|
|
2145
2149
|
/** @private */
|
|
2146
|
-
active:
|
|
2147
|
-
children:
|
|
2148
|
-
description:
|
|
2149
|
-
descriptionPosition:
|
|
2150
|
-
disabled:
|
|
2151
|
-
hidden:
|
|
2152
|
-
icon:
|
|
2153
|
-
label:
|
|
2154
|
-
matchRanges:
|
|
2155
|
-
start:
|
|
2156
|
-
end:
|
|
2150
|
+
active: i().bool,
|
|
2151
|
+
children: i().node,
|
|
2152
|
+
description: i().string,
|
|
2153
|
+
descriptionPosition: i().oneOf([ "right", "bottom" ]),
|
|
2154
|
+
disabled: i().bool,
|
|
2155
|
+
hidden: i().bool,
|
|
2156
|
+
icon: i().node,
|
|
2157
|
+
label: i().string.isRequired,
|
|
2158
|
+
matchRanges: i().arrayOf(i().shape({
|
|
2159
|
+
start: i().number.isRequired,
|
|
2160
|
+
end: i().number.isRequired
|
|
2157
2161
|
})),
|
|
2158
2162
|
/** @private */
|
|
2159
|
-
onClick:
|
|
2163
|
+
onClick: i().func,
|
|
2160
2164
|
/** @private */
|
|
2161
|
-
selected:
|
|
2162
|
-
truncate:
|
|
2163
|
-
value:
|
|
2165
|
+
selected: i().bool,
|
|
2166
|
+
truncate: i().bool,
|
|
2167
|
+
value: i().oneOfType([ i().string, i().number, i().bool ]).isRequired
|
|
2164
2168
|
};
|
|
2165
2169
|
var en = {
|
|
2166
2170
|
active: false,
|
|
@@ -2180,8 +2184,8 @@
|
|
|
2180
2184
|
function n() {
|
|
2181
2185
|
var e;
|
|
2182
2186
|
Ft(this, n);
|
|
2183
|
-
for (var r = arguments.length, o = new Array(r),
|
|
2184
|
-
o[
|
|
2187
|
+
for (var r = arguments.length, o = new Array(r), i = 0; i < r; i++) {
|
|
2188
|
+
o[i] = arguments[i];
|
|
2185
2189
|
}
|
|
2186
2190
|
e = t.call.apply(t, [ this ].concat(o));
|
|
2187
2191
|
Yt(Jt(e), "c", null);
|
|
@@ -2252,9 +2256,9 @@
|
|
|
2252
2256
|
var n = ln(e, t);
|
|
2253
2257
|
var r, o;
|
|
2254
2258
|
if (Object.getOwnPropertySymbols) {
|
|
2255
|
-
var
|
|
2256
|
-
for (o = 0; o <
|
|
2257
|
-
r =
|
|
2259
|
+
var i = Object.getOwnPropertySymbols(e);
|
|
2260
|
+
for (o = 0; o < i.length; o++) {
|
|
2261
|
+
r = i[o];
|
|
2258
2262
|
if (t.indexOf(r) >= 0) continue;
|
|
2259
2263
|
if (!Object.prototype.propertyIsEnumerable.call(e, r)) continue;
|
|
2260
2264
|
n[r] = e[r];
|
|
@@ -2266,9 +2270,9 @@
|
|
|
2266
2270
|
if (e == null) return {};
|
|
2267
2271
|
var n = {};
|
|
2268
2272
|
var r = Object.keys(e);
|
|
2269
|
-
var o,
|
|
2270
|
-
for (
|
|
2271
|
-
o = r[
|
|
2273
|
+
var o, i;
|
|
2274
|
+
for (i = 0; i < r.length; i++) {
|
|
2275
|
+
o = r[i];
|
|
2272
2276
|
if (t.indexOf(o) >= 0) continue;
|
|
2273
2277
|
n[o] = e[o];
|
|
2274
2278
|
}
|
|
@@ -2316,10 +2320,10 @@
|
|
|
2316
2320
|
function dn(e) {
|
|
2317
2321
|
var t = bn();
|
|
2318
2322
|
return function n() {
|
|
2319
|
-
var r =
|
|
2323
|
+
var r = mn(e), o;
|
|
2320
2324
|
if (t) {
|
|
2321
|
-
var
|
|
2322
|
-
o = Reflect.construct(r, arguments,
|
|
2325
|
+
var i = mn(this).constructor;
|
|
2326
|
+
o = Reflect.construct(r, arguments, i);
|
|
2323
2327
|
} else {
|
|
2324
2328
|
o = r.apply(this, arguments);
|
|
2325
2329
|
}
|
|
@@ -2349,13 +2353,13 @@
|
|
|
2349
2353
|
return false;
|
|
2350
2354
|
}
|
|
2351
2355
|
}
|
|
2352
|
-
function
|
|
2353
|
-
|
|
2356
|
+
function mn(e) {
|
|
2357
|
+
mn = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
|
|
2354
2358
|
return t.__proto__ || Object.getPrototypeOf(t);
|
|
2355
2359
|
};
|
|
2356
|
-
return
|
|
2360
|
+
return mn(e);
|
|
2357
2361
|
}
|
|
2358
|
-
function
|
|
2362
|
+
function yn(e, t, n) {
|
|
2359
2363
|
if (t in e) {
|
|
2360
2364
|
Object.defineProperty(e, t, {
|
|
2361
2365
|
value: n,
|
|
@@ -2370,40 +2374,40 @@
|
|
|
2370
2374
|
}
|
|
2371
2375
|
/* eslint-disable max-classes-per-file */
|
|
2372
2376
|
/** @public */ var gn = {
|
|
2373
|
-
allowKeyMatching:
|
|
2374
|
-
animateLoading:
|
|
2375
|
-
appearance:
|
|
2376
|
-
append:
|
|
2377
|
-
children:
|
|
2378
|
-
defaultPlacement:
|
|
2379
|
-
defaultValue:
|
|
2380
|
-
describedBy:
|
|
2381
|
-
disabled:
|
|
2382
|
-
elementRef:
|
|
2383
|
-
error:
|
|
2384
|
-
filter:
|
|
2385
|
-
footerMessage:
|
|
2386
|
-
inline:
|
|
2387
|
-
inputId:
|
|
2388
|
-
inputRef:
|
|
2389
|
-
isLoadingOptions:
|
|
2390
|
-
labelledBy:
|
|
2391
|
-
labelText:
|
|
2392
|
-
loadingMessage:
|
|
2393
|
-
menuStyle:
|
|
2394
|
-
name:
|
|
2395
|
-
noOptionsMessage:
|
|
2396
|
-
onChange:
|
|
2397
|
-
onClose:
|
|
2398
|
-
onFilterChange:
|
|
2399
|
-
onOpen:
|
|
2400
|
-
onScroll:
|
|
2401
|
-
onScrollBottom:
|
|
2402
|
-
placeholder:
|
|
2403
|
-
prefixLabel:
|
|
2404
|
-
prepend:
|
|
2405
|
-
suffixLabel:
|
|
2406
|
-
value:
|
|
2377
|
+
allowKeyMatching: i().bool,
|
|
2378
|
+
animateLoading: i().bool,
|
|
2379
|
+
appearance: i().oneOf([ "default", "link", "primary", "pill", "toggle", "flat" ]),
|
|
2380
|
+
append: i().bool,
|
|
2381
|
+
children: i().node,
|
|
2382
|
+
defaultPlacement: i().oneOf([ "above", "below", "vertical" ]),
|
|
2383
|
+
defaultValue: i().oneOfType([ i().string, i().number, i().bool ]),
|
|
2384
|
+
describedBy: i().string,
|
|
2385
|
+
disabled: i().bool,
|
|
2386
|
+
elementRef: i().oneOfType([ i().func, i().object ]),
|
|
2387
|
+
error: i().bool,
|
|
2388
|
+
filter: i().oneOf([ false, true, "controlled" ]),
|
|
2389
|
+
footerMessage: i().node,
|
|
2390
|
+
inline: i().bool,
|
|
2391
|
+
inputId: i().string,
|
|
2392
|
+
inputRef: i().oneOfType([ i().func, i().object ]),
|
|
2393
|
+
isLoadingOptions: i().bool,
|
|
2394
|
+
labelledBy: i().string,
|
|
2395
|
+
labelText: i().string,
|
|
2396
|
+
loadingMessage: i().node,
|
|
2397
|
+
menuStyle: i().object,
|
|
2398
|
+
name: i().string,
|
|
2399
|
+
noOptionsMessage: i().node,
|
|
2400
|
+
onChange: i().func,
|
|
2401
|
+
onClose: i().func,
|
|
2402
|
+
onFilterChange: i().func,
|
|
2403
|
+
onOpen: i().func,
|
|
2404
|
+
onScroll: i().func,
|
|
2405
|
+
onScrollBottom: i().func,
|
|
2406
|
+
placeholder: i().string,
|
|
2407
|
+
prefixLabel: i().string,
|
|
2408
|
+
prepend: i().bool,
|
|
2409
|
+
suffixLabel: i().string,
|
|
2410
|
+
value: i().oneOfType([ i().string, i().number, i().bool ])
|
|
2407
2411
|
};
|
|
2408
2412
|
var On = {
|
|
2409
2413
|
allowKeyMatching: true,
|
|
@@ -2451,20 +2455,20 @@
|
|
|
2451
2455
|
}, {
|
|
2452
2456
|
key: "render",
|
|
2453
2457
|
value: function e() {
|
|
2454
|
-
var t = this.props, n = t.defaultValue, o = t.onChange,
|
|
2458
|
+
var t = this.props, n = t.defaultValue, o = t.onChange, i = t.value, a = an(t, [ "defaultValue", "onChange", "value" ]);
|
|
2455
2459
|
var c = {
|
|
2456
2460
|
onChange: function e(t, n) {
|
|
2457
|
-
var r = n.name,
|
|
2461
|
+
var r = n.name, i = n.values;
|
|
2458
2462
|
o === null || o === void 0 ? void 0 : o(t, {
|
|
2459
2463
|
name: r,
|
|
2460
|
-
value:
|
|
2464
|
+
value: i[0]
|
|
2461
2465
|
});
|
|
2462
2466
|
}
|
|
2463
2467
|
};
|
|
2464
2468
|
// using "has" as opposed to a null check to match SelectBase
|
|
2465
2469
|
if (l()(this.props, "value")) {
|
|
2466
|
-
if (
|
|
2467
|
-
c.values = [
|
|
2470
|
+
if (i != null) {
|
|
2471
|
+
c.values = [ i ];
|
|
2468
2472
|
} else {
|
|
2469
2473
|
c.values = [];
|
|
2470
2474
|
}
|
|
@@ -2473,18 +2477,18 @@
|
|
|
2473
2477
|
c.defaultValues = this.state.defaultValues;
|
|
2474
2478
|
}
|
|
2475
2479
|
|
|
2476
|
-
return r().createElement(Nt, on({},
|
|
2480
|
+
return r().createElement(Nt, on({}, a, c, {
|
|
2477
2481
|
multiple: false
|
|
2478
2482
|
}));
|
|
2479
2483
|
}
|
|
2480
2484
|
} ]);
|
|
2481
2485
|
return n;
|
|
2482
2486
|
}(n.Component);
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2487
|
+
yn(Sn, "propTypes", gn);
|
|
2488
|
+
yn(Sn, "defaultProps", On);
|
|
2489
|
+
yn(Sn, "Option", nn);
|
|
2490
|
+
yn(Sn, "Heading", T.Heading);
|
|
2491
|
+
yn(Sn, "Divider", T.Divider);
|
|
2488
2492
|
/* harmony default export */ const wn = Sn;
|
|
2489
2493
|
// CONCATENATED MODULE: ./src/Select/index.ts
|
|
2490
2494
|
module.exports = t;
|