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