@splunk/react-ui 4.32.0 → 4.33.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/Button.js +42 -45
- package/ButtonSimple.js +372 -336
- package/CHANGELOG.md +23 -0
- package/Clickable.js +21 -19
- package/FormRows.js +229 -207
- package/MIGRATION.mdx +23 -0
- package/Menu.js +1 -1
- package/Modal.js +156 -131
- package/Multiselect.js +47 -33
- package/Select.js +236 -220
- package/TabBar.js +1 -1
- package/Text.js +13 -11
- package/package.json +5 -5
- package/types/src/Button/Button.d.ts +4 -4
- package/types/src/ButtonSimple/ButtonSimple.d.ts +8 -6
- package/types/src/ButtonSimple/mixin.d.ts +2 -2
- package/types/src/Clickable/Clickable.d.ts +3 -2
- package/types/src/Date/Date.d.ts +2 -2
- package/types/src/Menu/Item.d.ts +0 -1
- package/types/src/Number/Number.d.ts +2 -2
- package/types/src/Select/Select.d.ts +6 -2
- package/types/src/Select/SelectBase.d.ts +6 -2
- package/types/src/Slider/Slider.d.ts +2 -2
- package/types/src/Text/docs/examples/Basic.d.ts +1 -9
- package/types/src/Text/docs/examples/Error.d.ts +2 -10
- package/types/src/Text/docs/examples/Inline.d.ts +1 -9
- package/types/src/Text/docs/examples/Multiline.d.ts +1 -9
- package/types/src/Text/docs/examples/Password.d.ts +1 -9
- package/types/src/Text/docs/examples/Search.d.ts +1 -9
- package/types/src/Button/docs/examples/prisma/Basic.d.ts +0 -2
- package/types/src/Button/docs/examples/prisma/Block.d.ts +0 -2
- package/types/src/Button/docs/examples/prisma/Disabled.d.ts +0 -2
- package/types/src/Button/docs/examples/prisma/Icons.d.ts +0 -2
- package/types/src/Button/docs/examples/prisma/Menus.d.ts +0 -2
- package/types/src/Button/docs/examples/prisma/To.d.ts +0 -2
- package/types/src/Button/docs/examples/prisma/Truncated.d.ts +0 -2
- /package/types/src/{Button/docs/examples/prisma → Clickable/docs/examples}/Dimmed.d.ts +0 -0
package/Select.js
CHANGED
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
Divider: () => /* reexport */ T.Divider,
|
|
65
65
|
Heading: () => /* reexport */ T.Heading,
|
|
66
66
|
Option: () => /* reexport */ nn,
|
|
67
|
-
default: () => /* reexport */
|
|
67
|
+
default: () => /* reexport */ xn
|
|
68
68
|
});
|
|
69
69
|
// CONCATENATED MODULE: external "react"
|
|
70
70
|
const n = require("react");
|
|
@@ -76,10 +76,10 @@
|
|
|
76
76
|
const a = require("lodash/has");
|
|
77
77
|
var l = e.n(a);
|
|
78
78
|
// CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
|
|
79
|
-
const
|
|
79
|
+
const s = require("@splunk/ui-utils/i18n");
|
|
80
80
|
// CONCATENATED MODULE: external "lodash/castArray"
|
|
81
|
-
const
|
|
82
|
-
var u = e.n(
|
|
81
|
+
const c = require("lodash/castArray");
|
|
82
|
+
var u = e.n(c);
|
|
83
83
|
// CONCATENATED MODULE: external "lodash/find"
|
|
84
84
|
const p = require("lodash/find");
|
|
85
85
|
var f = e.n(p);
|
|
@@ -97,13 +97,13 @@
|
|
|
97
97
|
var O = e.n(g);
|
|
98
98
|
// CONCATENATED MODULE: external "lodash/memoize"
|
|
99
99
|
const S = require("lodash/memoize");
|
|
100
|
-
var
|
|
100
|
+
var x = e.n(S);
|
|
101
101
|
// CONCATENATED MODULE: external "lodash/omit"
|
|
102
|
-
const
|
|
103
|
-
var
|
|
102
|
+
const w = require("lodash/omit");
|
|
103
|
+
var C = e.n(w);
|
|
104
104
|
// CONCATENATED MODULE: external "lodash/pick"
|
|
105
|
-
const
|
|
106
|
-
var I = e.n(
|
|
105
|
+
const k = require("lodash/pick");
|
|
106
|
+
var I = e.n(k);
|
|
107
107
|
// CONCATENATED MODULE: external "lodash/uniq"
|
|
108
108
|
const _ = require("lodash/uniq");
|
|
109
109
|
var A = e.n(_);
|
|
@@ -122,8 +122,8 @@
|
|
|
122
122
|
// CONCATENATED MODULE: external "@splunk/ui-utils/filter"
|
|
123
123
|
const D = require("@splunk/ui-utils/filter");
|
|
124
124
|
// CONCATENATED MODULE: external "@splunk/react-ui/Link"
|
|
125
|
-
const
|
|
126
|
-
var
|
|
125
|
+
const L = require("@splunk/react-ui/Link");
|
|
126
|
+
var q = e.n(L);
|
|
127
127
|
// CONCATENATED MODULE: external "@splunk/react-ui/ResultsMenu"
|
|
128
128
|
const N = require("@splunk/react-ui/ResultsMenu");
|
|
129
129
|
var B = e.n(N);
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
// CONCATENATED MODULE: ./src/Select/icons/Search.tsx
|
|
159
159
|
var ee = function e() {
|
|
160
160
|
var t = (0, U.useSplunkTheme)(), n = t.isEnterprise, o = t.isCompact;
|
|
161
|
-
var i = (0,
|
|
161
|
+
var i = (0, s._)("Search");
|
|
162
162
|
var a = o ? "20px" : "24px";
|
|
163
163
|
var l = n ? r().createElement(X(), {
|
|
164
164
|
role: "presentation",
|
|
@@ -243,12 +243,12 @@
|
|
|
243
243
|
Object.defineProperty(e, r.key, r);
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
|
-
function
|
|
246
|
+
function se(e, t, n) {
|
|
247
247
|
if (t) le(e.prototype, t);
|
|
248
248
|
if (n) le(e, n);
|
|
249
249
|
return e;
|
|
250
250
|
}
|
|
251
|
-
function
|
|
251
|
+
function ce(e, t) {
|
|
252
252
|
if (typeof t !== "function" && t !== null) {
|
|
253
253
|
throw new TypeError("Super expression must either be null or a function");
|
|
254
254
|
}
|
|
@@ -360,7 +360,7 @@
|
|
|
360
360
|
* [PureComponent](https://reactjs.org/docs/react-api.html#reactpurecomponent)
|
|
361
361
|
* so any elements passed to it must also be pure.
|
|
362
362
|
*/ var ge = function(e) {
|
|
363
|
-
|
|
363
|
+
ce(n, e);
|
|
364
364
|
var t = pe(n);
|
|
365
365
|
function n() {
|
|
366
366
|
var e;
|
|
@@ -383,7 +383,7 @@
|
|
|
383
383
|
}));
|
|
384
384
|
return e;
|
|
385
385
|
}
|
|
386
|
-
|
|
386
|
+
se(n, [ {
|
|
387
387
|
key: "scrollIntoViewIfNeeded",
|
|
388
388
|
value: function e() {
|
|
389
389
|
var t;
|
|
@@ -424,13 +424,13 @@
|
|
|
424
424
|
/* harmony default export */ const Oe = ge;
|
|
425
425
|
// CONCATENATED MODULE: external "styled-components"
|
|
426
426
|
const Se = require("styled-components");
|
|
427
|
-
var
|
|
427
|
+
var xe = e.n(Se);
|
|
428
428
|
// CONCATENATED MODULE: external "@splunk/react-ui/Clickable"
|
|
429
|
-
const
|
|
430
|
-
var
|
|
429
|
+
const we = require("@splunk/react-ui/Clickable");
|
|
430
|
+
var Ce = e.n(we);
|
|
431
431
|
// CONCATENATED MODULE: external "@splunk/react-ui/Switch"
|
|
432
|
-
const
|
|
433
|
-
var Ie = e.n(
|
|
432
|
+
const ke = require("@splunk/react-ui/Switch");
|
|
433
|
+
var Ie = e.n(ke);
|
|
434
434
|
// CONCATENATED MODULE: ./src/Menu/ItemStyles.ts
|
|
435
435
|
var _e = (0, Se.css)([ "color:", ";font-size:", ";line-height:", ";overflow:inherit;white-space:inherit;text-overflow:inherit;" ], (0,
|
|
436
436
|
U.pick)({
|
|
@@ -439,15 +439,15 @@
|
|
|
439
439
|
}), U.variables.fontSizeSmall, (0, U.pick)({
|
|
440
440
|
prisma: "16px"
|
|
441
441
|
}));
|
|
442
|
-
var Ae =
|
|
442
|
+
var Ae = xe().span.withConfig({
|
|
443
443
|
displayName: "ItemStyles__StyledItemDescriptionBottom",
|
|
444
444
|
componentId: "sc-4kc053-0"
|
|
445
445
|
})([ "", ";display:block;" ], _e);
|
|
446
|
-
var je =
|
|
446
|
+
var je = xe().span.withConfig({
|
|
447
447
|
displayName: "ItemStyles__StyledItemDescriptionRight",
|
|
448
448
|
componentId: "sc-4kc053-1"
|
|
449
449
|
})([ "", ";float:right;padding-left:", ";max-width:50%;text-align:right;box-sizing:border-box;" ], _e, U.variables.spacing);
|
|
450
|
-
var Ee =
|
|
450
|
+
var Ee = xe().div.withConfig({
|
|
451
451
|
displayName: "ItemStyles__StyledItemSelectedIcon",
|
|
452
452
|
componentId: "sc-4kc053-2"
|
|
453
453
|
})([ "position:absolute;", " color:", ";" ], (0, U.pick)({
|
|
@@ -457,7 +457,7 @@
|
|
|
457
457
|
prisma: U.variables.contentColorActive,
|
|
458
458
|
enterprise: U.variables.accentColorL10
|
|
459
459
|
}));
|
|
460
|
-
var Me =
|
|
460
|
+
var Me = xe().span.withConfig({
|
|
461
461
|
displayName: "ItemStyles__StyledItemIcon",
|
|
462
462
|
componentId: "sc-4kc053-3"
|
|
463
463
|
})([ "flex:0 0 auto;padding-right:", ";min-width:10px;display:inline-block;text-align:center;vertical-align:", ";", "" ], (0,
|
|
@@ -471,7 +471,7 @@
|
|
|
471
471
|
prisma: (0, Se.css)([ "color:", ";display:inline-flex;align-items:center;min-width:20px;min-height:20px;& > svg{width:20px;height:20px;}" ], U.variables.contentColorMuted),
|
|
472
472
|
enterprise: (0, Se.css)([ "transform:translateY(-1px);" ])
|
|
473
473
|
}));
|
|
474
|
-
var Te =
|
|
474
|
+
var Te = xe()(Ce()).withConfig({
|
|
475
475
|
displayName: "ItemStyles__StyledClickable",
|
|
476
476
|
componentId: "sc-4kc053-4"
|
|
477
477
|
})([ "display:block;position:relative;cursor:pointer;color:", ";word-wrap:break-word;max-width:100%;width:100%;padding:", ";", " ", " ", " &:not([disabled]){&:hover{background:", ";", "}&:focus{outline:0;box-shadow:", ";", "}", " ", "}&[disabled]{color:", ";cursor:not-allowed;", ",", "{color:inherit;}", "{cursor:not-allowed;color:", ";}", "}", "" ], (0,
|
|
@@ -553,7 +553,7 @@
|
|
|
553
553
|
Me, U.variables.contentColorActive)
|
|
554
554
|
});
|
|
555
555
|
}));
|
|
556
|
-
var Pe =
|
|
556
|
+
var Pe = xe()(Ie()).withConfig({
|
|
557
557
|
displayName: "ItemStyles__StyledSwitch",
|
|
558
558
|
componentId: "sc-4kc053-5"
|
|
559
559
|
})([ "position:absolute;left:", ";top:", ";" ], (0, U.pick)({
|
|
@@ -566,25 +566,25 @@
|
|
|
566
566
|
compact: "2px"
|
|
567
567
|
}
|
|
568
568
|
}));
|
|
569
|
-
var Ve =
|
|
569
|
+
var Ve = xe().span.withConfig({
|
|
570
570
|
displayName: "ItemStyles__StyledInnerWrapper",
|
|
571
571
|
componentId: "sc-4kc053-6"
|
|
572
572
|
})([ "display:flex;align-items:flex-start;" ]);
|
|
573
|
-
var Re =
|
|
573
|
+
var Re = xe().span.withConfig({
|
|
574
574
|
displayName: "ItemStyles__StyledTitleAndDescriptionWrapper",
|
|
575
575
|
componentId: "sc-4kc053-7"
|
|
576
576
|
})([ "display:flex;flex-wrap:wrap;flex-direction:column;max-width:100%;width:100%;align-self:center;word-break:break-word;white-space:normal;", "" ], (function(e) {
|
|
577
577
|
var t = e.$truncate;
|
|
578
578
|
return t && (0, Se.css)([ "white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" ]);
|
|
579
579
|
}));
|
|
580
|
-
var De =
|
|
580
|
+
var De = xe().div.withConfig({
|
|
581
581
|
displayName: "ItemStyles__StyledLabel",
|
|
582
582
|
componentId: "sc-4kc053-8"
|
|
583
583
|
})([ "overflow:inherit;white-space:inherit;text-overflow:inherit;max-width:100%;min-height:20px;", "" ], (function(e) {
|
|
584
584
|
var t = e.$truncate;
|
|
585
585
|
return t && (0, Se.css)([ "display:block;clear:both;" ]);
|
|
586
586
|
}));
|
|
587
|
-
var
|
|
587
|
+
var Le = xe().span.withConfig({
|
|
588
588
|
displayName: "ItemStyles__StyledMatch",
|
|
589
589
|
componentId: "sc-4kc053-9"
|
|
590
590
|
})([ "border-bottom:1px solid ", ";" ], (0, U.pick)({
|
|
@@ -594,7 +594,7 @@
|
|
|
594
594
|
light: U.variables.gray45
|
|
595
595
|
}
|
|
596
596
|
}));
|
|
597
|
-
var
|
|
597
|
+
var qe = xe().span.withConfig({
|
|
598
598
|
displayName: "ItemStyles__StyledSubmenu",
|
|
599
599
|
componentId: "sc-4kc053-10"
|
|
600
600
|
})([ "float:right;padding-left:", ";color:", ";", "" ], U.variables.spacingSmall, (0,
|
|
@@ -605,11 +605,11 @@
|
|
|
605
605
|
prisma: (0, Se.css)([ "& > svg{width:20px;height:20px;}" ])
|
|
606
606
|
}));
|
|
607
607
|
// CONCATENATED MODULE: ./src/Select/SelectAllOptionStyles.ts
|
|
608
|
-
var Ne =
|
|
608
|
+
var Ne = xe()(De).withConfig({
|
|
609
609
|
displayName: "SelectAllOptionStyles__StyledSelectAllLabel",
|
|
610
610
|
componentId: "y6bn08-0"
|
|
611
611
|
})([ "font-weight:", ";" ], U.variables.fontWeightBold);
|
|
612
|
-
var Be =
|
|
612
|
+
var Be = xe()(Oe).withConfig({
|
|
613
613
|
displayName: "SelectAllOptionStyles__StyledSelectAllOption",
|
|
614
614
|
componentId: "y6bn08-1"
|
|
615
615
|
})([ "padding-inline-start:", ";box-shadow:none;" ], (0, U.pick)({
|
|
@@ -628,9 +628,9 @@
|
|
|
628
628
|
selected: i().oneOf([ false, true, "some" ])
|
|
629
629
|
};
|
|
630
630
|
var Fe = r().forwardRef((function(e, t) {
|
|
631
|
-
var n = e.active, o = e.id, i = e.onClick, a = e.selectAllLabel, l = e.totalCount,
|
|
631
|
+
var n = e.active, o = e.id, i = e.onClick, a = e.selectAllLabel, l = e.totalCount, c = e.changedToggle, u = e.selected;
|
|
632
632
|
// When toggle is changed the total count is not displayed anymore so the count is now shown in the Select all menu item
|
|
633
|
-
var p =
|
|
633
|
+
var p = c ? " (".concat(l === null || l === void 0 ? void 0 : l.toString(), ")") : "";
|
|
634
634
|
|
|
635
635
|
return r().createElement(Be, {
|
|
636
636
|
label: a,
|
|
@@ -649,12 +649,12 @@
|
|
|
649
649
|
key: "main-checkbox",
|
|
650
650
|
value: "main-checkbox",
|
|
651
651
|
appearance: "checkbox",
|
|
652
|
-
"aria-label": !u && (0,
|
|
653
|
-
|
|
652
|
+
"aria-label": !u && (0, s._)("No options selected") || u === "some" && (0, s._)("Some options selected") || (0,
|
|
653
|
+
s._)("All options selected"),
|
|
654
654
|
"data-test": "select-all-switch",
|
|
655
|
-
selectedLabel: u === true ? (0,
|
|
656
|
-
unselectedLabel: u === true ? (0,
|
|
657
|
-
someSelectedLabel: (0,
|
|
655
|
+
selectedLabel: u === true ? (0, s._)("All options selected") : (0, s._)("Option selected"),
|
|
656
|
+
unselectedLabel: u === true ? (0, s._)("No options selected") : (0, s._)("Option unselected"),
|
|
657
|
+
someSelectedLabel: (0, s._)("Some options selected")
|
|
658
658
|
}), r().createElement(je, {
|
|
659
659
|
"data-test": "description"
|
|
660
660
|
}, "".concat(p, " Ctrl-a")), r().createElement(Ve, null, r().createElement(Re, {
|
|
@@ -669,7 +669,7 @@
|
|
|
669
669
|
const $e = require("@splunk/react-ui/Button");
|
|
670
670
|
var ze = e.n($e);
|
|
671
671
|
// CONCATENATED MODULE: ./src/Select/SelectBaseStyles.ts
|
|
672
|
-
var We =
|
|
672
|
+
var We = xe()(ze()).withConfig({
|
|
673
673
|
displayName: "SelectBaseStyles__StyledButton",
|
|
674
674
|
componentId: "sc-16cj7sk-0"
|
|
675
675
|
})([ "&[data-inline]{width:", ";}", "" ], (function(e) {
|
|
@@ -679,22 +679,22 @@
|
|
|
679
679
|
var t = e.$multiple;
|
|
680
680
|
return !t && "flex-grow: 0;";
|
|
681
681
|
}));
|
|
682
|
-
var Ue =
|
|
682
|
+
var Ue = xe().span.withConfig({
|
|
683
683
|
displayName: "SelectBaseStyles__StyledLinkIcon",
|
|
684
684
|
componentId: "sc-16cj7sk-1"
|
|
685
685
|
})([ "padding-right:2px;" ]);
|
|
686
|
-
var Ge =
|
|
686
|
+
var Ge = xe().span.withConfig({
|
|
687
687
|
displayName: "SelectBaseStyles__StyledLinkCaret",
|
|
688
688
|
componentId: "sc-16cj7sk-2"
|
|
689
689
|
})([ "padding-left:2px;" ]);
|
|
690
|
-
var Je =
|
|
690
|
+
var Je = xe().div.withConfig({
|
|
691
691
|
displayName: "SelectBaseStyles__StyledFilter",
|
|
692
692
|
componentId: "sc-16cj7sk-3"
|
|
693
693
|
})([ "padding:", ";min-width:160px;" ], (0, U.pick)({
|
|
694
694
|
enterprise: "8px",
|
|
695
695
|
prisma: "10px 16px"
|
|
696
696
|
}));
|
|
697
|
-
var Qe =
|
|
697
|
+
var Qe = xe().span.withConfig({
|
|
698
698
|
displayName: "SelectBaseStyles__StyledSearchIconWrapper",
|
|
699
699
|
componentId: "sc-16cj7sk-4"
|
|
700
700
|
})([ "color:", ";pointer-events:none;padding:", ";" ], (0, U.pick)({
|
|
@@ -707,21 +707,21 @@
|
|
|
707
707
|
comfortable: "0 8px",
|
|
708
708
|
compact: "0 6px"
|
|
709
709
|
}));
|
|
710
|
-
var Xe =
|
|
710
|
+
var Xe = xe().span.withConfig({
|
|
711
711
|
displayName: "SelectBaseStyles__StyledCount",
|
|
712
712
|
componentId: "sc-16cj7sk-5"
|
|
713
713
|
})([ "padding-right:", ";" ], (0, U.pick)({
|
|
714
714
|
enterprise: U.variables.spacingQuarter,
|
|
715
715
|
prisma: U.variables.spacingXSmall
|
|
716
716
|
}));
|
|
717
|
-
var Ye =
|
|
717
|
+
var Ye = xe()(q()).withConfig({
|
|
718
718
|
displayName: "SelectBaseStyles__StyledControlsLink",
|
|
719
719
|
componentId: "sc-16cj7sk-6"
|
|
720
720
|
})([ "margin-right:20px;", ";" ], (function(e) {
|
|
721
721
|
var t = e.$disabled;
|
|
722
722
|
return t && (0, Se.css)([ "color:", ";" ], U.variables.contentColorDisabled);
|
|
723
723
|
}));
|
|
724
|
-
var Ze =
|
|
724
|
+
var Ze = xe().div.withConfig({
|
|
725
725
|
displayName: "SelectBaseStyles__StyledToggleAllControls",
|
|
726
726
|
componentId: "sc-16cj7sk-7"
|
|
727
727
|
})([ "padding:", ";", "" ], (0, U.pick)({
|
|
@@ -911,12 +911,12 @@
|
|
|
911
911
|
return at.apply(this, arguments);
|
|
912
912
|
}
|
|
913
913
|
function lt(e, t) {
|
|
914
|
-
return ut(e) ||
|
|
914
|
+
return ut(e) || ct(e, t) || dt(e, t) || st();
|
|
915
915
|
}
|
|
916
|
-
function
|
|
916
|
+
function st() {
|
|
917
917
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
918
918
|
}
|
|
919
|
-
function
|
|
919
|
+
function ct(e, t) {
|
|
920
920
|
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(e))) return;
|
|
921
921
|
var n = [];
|
|
922
922
|
var r = true;
|
|
@@ -1008,8 +1008,8 @@
|
|
|
1008
1008
|
};
|
|
1009
1009
|
return St(e, t);
|
|
1010
1010
|
}
|
|
1011
|
-
function
|
|
1012
|
-
var t =
|
|
1011
|
+
function xt(e) {
|
|
1012
|
+
var t = kt();
|
|
1013
1013
|
return function n() {
|
|
1014
1014
|
var r = It(e), o;
|
|
1015
1015
|
if (t) {
|
|
@@ -1018,22 +1018,22 @@
|
|
|
1018
1018
|
} else {
|
|
1019
1019
|
o = r.apply(this, arguments);
|
|
1020
1020
|
}
|
|
1021
|
-
return
|
|
1021
|
+
return wt(this, o);
|
|
1022
1022
|
};
|
|
1023
1023
|
}
|
|
1024
|
-
function
|
|
1024
|
+
function wt(e, t) {
|
|
1025
1025
|
if (t && (_t(t) === "object" || typeof t === "function")) {
|
|
1026
1026
|
return t;
|
|
1027
1027
|
}
|
|
1028
|
-
return
|
|
1028
|
+
return Ct(e);
|
|
1029
1029
|
}
|
|
1030
|
-
function
|
|
1030
|
+
function Ct(e) {
|
|
1031
1031
|
if (e === void 0) {
|
|
1032
1032
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1033
1033
|
}
|
|
1034
1034
|
return e;
|
|
1035
1035
|
}
|
|
1036
|
-
function
|
|
1036
|
+
function kt() {
|
|
1037
1037
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
1038
1038
|
if (Reflect.construct.sham) return false;
|
|
1039
1039
|
if (typeof Proxy === "function") return true;
|
|
@@ -1146,6 +1146,7 @@
|
|
|
1146
1146
|
showSelectedValuesFirst: i().oneOf([ "nextOpen", "immediately", "never" ]),
|
|
1147
1147
|
suffixLabel: i().string,
|
|
1148
1148
|
tabConfirmsNewValue: i().bool,
|
|
1149
|
+
toggleContent: i().oneOf([ "optionChildren", "optionLabel" ]),
|
|
1149
1150
|
values: i().array,
|
|
1150
1151
|
/** @private. */
|
|
1151
1152
|
virtualization: i().number
|
|
@@ -1163,18 +1164,19 @@
|
|
|
1163
1164
|
isLoadingOptions: false,
|
|
1164
1165
|
menuStyle: {},
|
|
1165
1166
|
multiple: false,
|
|
1166
|
-
noOptionsMessage: (0,
|
|
1167
|
-
placeholder: (0,
|
|
1167
|
+
noOptionsMessage: (0, s._)("No matches"),
|
|
1168
|
+
placeholder: (0, s._)("Select..."),
|
|
1168
1169
|
prepend: false,
|
|
1169
1170
|
repositionMode: "flip",
|
|
1170
1171
|
selectAllAppearance: "buttongroup",
|
|
1171
|
-
tabConfirmsNewValue: false
|
|
1172
|
+
tabConfirmsNewValue: false,
|
|
1173
|
+
toggleContent: "optionChildren"
|
|
1172
1174
|
};
|
|
1173
|
-
var Pt =
|
|
1175
|
+
var Pt = x()((function(e) {
|
|
1174
1176
|
return [ e ];
|
|
1175
1177
|
}));
|
|
1176
1178
|
// preserve separate widths for single vs. multi mode
|
|
1177
|
-
var Vt =
|
|
1179
|
+
var Vt = x()((function(e) {
|
|
1178
1180
|
var t = e.anchorWidth, n = e.isMultiple, r = e.maxHeight, o = e.menuStyle;
|
|
1179
1181
|
return n ? jt({
|
|
1180
1182
|
width: Math.max(t !== null && t !== void 0 ? t : 0, 200),
|
|
@@ -1189,12 +1191,12 @@
|
|
|
1189
1191
|
function Dt(e) {
|
|
1190
1192
|
return e && l()(e.props, "value");
|
|
1191
1193
|
}
|
|
1192
|
-
function
|
|
1194
|
+
function Lt(e, t) {
|
|
1193
1195
|
return "".concat(_t(e), "-").concat(e, "-").concat(t);
|
|
1194
1196
|
}
|
|
1195
|
-
var
|
|
1197
|
+
var qt = function(e) {
|
|
1196
1198
|
Ot(o, e);
|
|
1197
|
-
var t =
|
|
1199
|
+
var t = xt(o);
|
|
1198
1200
|
gt(o, null, [ {
|
|
1199
1201
|
key: "validateAppearance",
|
|
1200
1202
|
// @docs-props-type CompactPropsBase
|
|
@@ -1206,41 +1208,41 @@
|
|
|
1206
1208
|
var i;
|
|
1207
1209
|
mt(this, o);
|
|
1208
1210
|
i = t.call(this, e);
|
|
1209
|
-
Et(
|
|
1210
|
-
Et(
|
|
1211
|
-
Et(
|
|
1212
|
-
Et(
|
|
1213
|
-
Et(
|
|
1214
|
-
Et(
|
|
1215
|
-
Et(
|
|
1216
|
-
Et(
|
|
1217
|
-
Et(
|
|
1218
|
-
Et(
|
|
1219
|
-
Et(
|
|
1220
|
-
Et(
|
|
1221
|
-
Et(
|
|
1222
|
-
Et(
|
|
1223
|
-
Et(
|
|
1224
|
-
Et(
|
|
1225
|
-
Et(
|
|
1226
|
-
Et(
|
|
1227
|
-
Et(
|
|
1211
|
+
Et(Ct(i), "activeItemId", void 0);
|
|
1212
|
+
Et(Ct(i), "activeValue", void 0);
|
|
1213
|
+
Et(Ct(i), "availableOptionCount", void 0);
|
|
1214
|
+
Et(Ct(i), "controlledExternally", void 0);
|
|
1215
|
+
Et(Ct(i), "displayedValues", void 0);
|
|
1216
|
+
Et(Ct(i), "dropdown", null);
|
|
1217
|
+
Et(Ct(i), "firstSelectedEnabledOption", null);
|
|
1218
|
+
Et(Ct(i), "firstSelectedOptionIndex", void 0);
|
|
1219
|
+
Et(Ct(i), "menuId", void 0);
|
|
1220
|
+
Et(Ct(i), "menuListboxId", void 0);
|
|
1221
|
+
Et(Ct(i), "previousActiveIndex", null);
|
|
1222
|
+
Et(Ct(i), "selectedOptionCount", void 0);
|
|
1223
|
+
Et(Ct(i), "optionRefsByKey", void 0);
|
|
1224
|
+
Et(Ct(i), "matchCharacter", void 0);
|
|
1225
|
+
Et(Ct(i), "matchTimeout", void 0);
|
|
1226
|
+
Et(Ct(i), "currentMatchOptions", void 0);
|
|
1227
|
+
Et(Ct(i), "availableMatchOptions", void 0);
|
|
1228
|
+
Et(Ct(i), "optionSelection", void 0);
|
|
1229
|
+
Et(Ct(i), "resetMatches", (function() {
|
|
1228
1230
|
i.matchCharacter = null;
|
|
1229
1231
|
i.currentMatchOptions = [];
|
|
1230
1232
|
if (i.matchTimeout) {
|
|
1231
1233
|
clearTimeout(i.matchTimeout);
|
|
1232
1234
|
}
|
|
1233
1235
|
}));
|
|
1234
|
-
Et(
|
|
1236
|
+
Et(Ct(i), "handleSelectAll", (function(e) {
|
|
1235
1237
|
var t, n, o;
|
|
1236
|
-
var a = i.props, l = a.name,
|
|
1238
|
+
var a = i.props, l = a.name, s = a.children, c = a.multiple;
|
|
1237
1239
|
// this doesn't make sense if we can't select multiple values
|
|
1238
|
-
if (!
|
|
1240
|
+
if (!c) {
|
|
1239
1241
|
return;
|
|
1240
1242
|
}
|
|
1241
1243
|
var u = (t = i.getCurrentValues()) !== null && t !== void 0 ? t : [];
|
|
1242
1244
|
var p = A()(u.concat(i.displayedValues));
|
|
1243
|
-
p = r().Children.toArray(
|
|
1245
|
+
p = r().Children.toArray(s).filter((function(e) {
|
|
1244
1246
|
return Dt(e) && b()(p, e.props.value) && (!e.props.disabled || b()(u, e.props.value));
|
|
1245
1247
|
})).map((function(e) {
|
|
1246
1248
|
return e.props.value;
|
|
@@ -1256,17 +1258,17 @@
|
|
|
1256
1258
|
reason: "selectAll"
|
|
1257
1259
|
});
|
|
1258
1260
|
}));
|
|
1259
|
-
Et(
|
|
1261
|
+
Et(Ct(i), "handleClearAll", (function(e) {
|
|
1260
1262
|
var t, n, o;
|
|
1261
|
-
var a = i.props, l = a.name,
|
|
1263
|
+
var a = i.props, l = a.name, s = a.children, c = a.multiple;
|
|
1262
1264
|
// this doesn't make sense if we can't select multiple values
|
|
1263
|
-
if (!
|
|
1265
|
+
if (!c) {
|
|
1264
1266
|
return;
|
|
1265
1267
|
}
|
|
1266
1268
|
var u = (t = i.getCurrentValues()) !== null && t !== void 0 ? t : [];
|
|
1267
1269
|
var p = E().apply(void 0, [ u ].concat(pt(i.displayedValues)));
|
|
1268
1270
|
// this will unselect all selected values unless those values are disabled or hidden by the filter
|
|
1269
|
-
var f = r().Children.toArray(
|
|
1271
|
+
var f = r().Children.toArray(s).filter((function(e) {
|
|
1270
1272
|
return Dt(e) && (b()(u, e.props.value) && e.props.disabled || b()(p, e.props.value));
|
|
1271
1273
|
})).map((function(e) {
|
|
1272
1274
|
return e.props.value;
|
|
@@ -1282,7 +1284,7 @@
|
|
|
1282
1284
|
reason: "clearAll"
|
|
1283
1285
|
});
|
|
1284
1286
|
}));
|
|
1285
|
-
Et(
|
|
1287
|
+
Et(Ct(i), "handleTextKeyDown", (function(e) {
|
|
1286
1288
|
var t = i.props, r = t.children, o = t.onScrollBottom, a = t.tabConfirmsNewValue;
|
|
1287
1289
|
var l = (0, R.keycode)(e.nativeEvent);
|
|
1288
1290
|
if (l === "tab") {
|
|
@@ -1310,9 +1312,9 @@
|
|
|
1310
1312
|
};
|
|
1311
1313
|
}));
|
|
1312
1314
|
if (r && o) {
|
|
1313
|
-
var
|
|
1314
|
-
var
|
|
1315
|
-
if (i.state.activeIndex ===
|
|
1315
|
+
var s;
|
|
1316
|
+
var c = n.Children.toArray(r).length - (2 + ((s = i.getCurrentValues()) !== null && s !== void 0 ? s : []).length);
|
|
1317
|
+
if (i.state.activeIndex === c) {
|
|
1316
1318
|
i.handleScrollBottom(e);
|
|
1317
1319
|
}
|
|
1318
1320
|
}
|
|
@@ -1338,7 +1340,7 @@
|
|
|
1338
1340
|
}
|
|
1339
1341
|
}
|
|
1340
1342
|
}));
|
|
1341
|
-
Et(
|
|
1343
|
+
Et(Ct(i), "handleMenuOptionClick", (function(e, t) {
|
|
1342
1344
|
var n = t.value;
|
|
1343
1345
|
e.preventDefault();
|
|
1344
1346
|
if (!i.state.open) {
|
|
@@ -1346,7 +1348,7 @@
|
|
|
1346
1348
|
}
|
|
1347
1349
|
i.toggleValue(e, n);
|
|
1348
1350
|
}));
|
|
1349
|
-
Et(
|
|
1351
|
+
Et(Ct(i), "handleMenuOptionKeyDown", (function(e, t) {
|
|
1350
1352
|
var n = e.nativeEvent.key;
|
|
1351
1353
|
// Checking for a single character to avoid complications from double-byte languages and emojis.
|
|
1352
1354
|
if (n.length === 1) {
|
|
@@ -1374,11 +1376,11 @@
|
|
|
1374
1376
|
a = l === r.length - 1 ? 0 : l + 1;
|
|
1375
1377
|
}
|
|
1376
1378
|
}
|
|
1377
|
-
var
|
|
1378
|
-
var
|
|
1379
|
-
if (
|
|
1379
|
+
var s = r[a];
|
|
1380
|
+
var c = i.optionRefsByKey[Lt(s.value, s.label)];
|
|
1381
|
+
if (c != null) {
|
|
1380
1382
|
var u;
|
|
1381
|
-
(u =
|
|
1383
|
+
(u = c.focus) === null || u === void 0 ? void 0 : u.call(c);
|
|
1382
1384
|
}
|
|
1383
1385
|
}
|
|
1384
1386
|
i.currentMatchOptions = r;
|
|
@@ -1391,7 +1393,7 @@
|
|
|
1391
1393
|
e.stopPropagation();
|
|
1392
1394
|
}
|
|
1393
1395
|
}));
|
|
1394
|
-
Et(
|
|
1396
|
+
Et(Ct(i), "handleTextChange", (function(e, t) {
|
|
1395
1397
|
var n, r;
|
|
1396
1398
|
var o = t.value;
|
|
1397
1399
|
i.setState({
|
|
@@ -1403,17 +1405,17 @@
|
|
|
1403
1405
|
keyword: o
|
|
1404
1406
|
});
|
|
1405
1407
|
}));
|
|
1406
|
-
Et(
|
|
1408
|
+
Et(Ct(i), "handleTextFocus", (function() {
|
|
1407
1409
|
i.setState({
|
|
1408
1410
|
textHasFocus: true
|
|
1409
1411
|
});
|
|
1410
1412
|
}));
|
|
1411
|
-
Et(
|
|
1413
|
+
Et(Ct(i), "handleTextBlur", (function() {
|
|
1412
1414
|
i.setState({
|
|
1413
1415
|
textHasFocus: false
|
|
1414
1416
|
});
|
|
1415
1417
|
}));
|
|
1416
|
-
Et(
|
|
1418
|
+
Et(Ct(i), "handleRequestOpen", (function(e) {
|
|
1417
1419
|
var t = {
|
|
1418
1420
|
open: true,
|
|
1419
1421
|
topValues: i.getTopValues()
|
|
@@ -1442,7 +1444,7 @@
|
|
|
1442
1444
|
}
|
|
1443
1445
|
}));
|
|
1444
1446
|
}));
|
|
1445
|
-
Et(
|
|
1447
|
+
Et(Ct(i), "handleRequestClose", (function() {
|
|
1446
1448
|
i.setState({
|
|
1447
1449
|
open: false,
|
|
1448
1450
|
activeIndex: 0
|
|
@@ -1452,18 +1454,18 @@
|
|
|
1452
1454
|
(e = (t = i.props).onClose) === null || e === void 0 ? void 0 : e.call(t);
|
|
1453
1455
|
}));
|
|
1454
1456
|
}));
|
|
1455
|
-
Et(
|
|
1457
|
+
Et(Ct(i), "handleScrollBottom", (function(e) {
|
|
1456
1458
|
if (i.state.open && !i.props.isLoadingOptions) {
|
|
1457
1459
|
var t, n;
|
|
1458
1460
|
(t = (n = i.props).onScrollBottom) === null || t === void 0 ? void 0 : t.call(n, e);
|
|
1459
1461
|
}
|
|
1460
1462
|
}));
|
|
1461
|
-
Et(
|
|
1463
|
+
Et(Ct(i), "handleActiveOptionMount", (function(e) {
|
|
1462
1464
|
if (i.previousActiveIndex !== i.state.activeIndex) {
|
|
1463
1465
|
e === null || e === void 0 ? void 0 : e.scrollIntoViewIfNeeded();
|
|
1464
1466
|
}
|
|
1465
1467
|
}));
|
|
1466
|
-
Et(
|
|
1468
|
+
Et(Ct(i), "handleOptionMount", (function(e, t, n) {
|
|
1467
1469
|
if (n) {
|
|
1468
1470
|
i.firstSelectedEnabledOption = e;
|
|
1469
1471
|
}
|
|
@@ -1473,105 +1475,117 @@
|
|
|
1473
1475
|
i.optionRefsByKey[t] = e;
|
|
1474
1476
|
}
|
|
1475
1477
|
}));
|
|
1476
|
-
Et(
|
|
1478
|
+
Et(Ct(i), "createToggle", (function() {
|
|
1477
1479
|
var e;
|
|
1478
|
-
var t = i.props, a = t.toggle, l = t.appearance,
|
|
1479
|
-
var C;
|
|
1480
|
+
var t = i.props, a = t.toggle, l = t.appearance, c = t.children, u = t.describedBy, p = t.disabled, d = t.elementRef, v = t.error, h = t.inline, b = t.labelledBy, m = t.labelText, y = t.multiple, g = t.placeholder, S = t.prefixLabel, x = t.required, w = t.suffixLabel, k = t.toggleContent;
|
|
1480
1481
|
var _;
|
|
1482
|
+
var A;
|
|
1483
|
+
var j = [];
|
|
1481
1484
|
// Generate buttonLabels
|
|
1482
|
-
var
|
|
1483
|
-
var
|
|
1484
|
-
var
|
|
1485
|
-
var o = f()(
|
|
1485
|
+
var E = (e = i.getCurrentValues()) !== null && e !== void 0 ? e : [];
|
|
1486
|
+
var M = n.Children.toArray(c);
|
|
1487
|
+
var T = E.reduce((function(e, t, n, r) {
|
|
1488
|
+
var o = f()(M, (function(e) {
|
|
1486
1489
|
return Dt(e) && e.props.value === t;
|
|
1487
1490
|
}));
|
|
1488
1491
|
if (o) {
|
|
1489
|
-
|
|
1492
|
+
var i = k !== "optionLabel" && o.props.children ? o.props.children : o.props.label;
|
|
1493
|
+
e.push(i);
|
|
1494
|
+
j.push(o.props.label);
|
|
1490
1495
|
// if not in multiple mode, add the icon
|
|
1491
|
-
if (!y &&
|
|
1492
|
-
|
|
1496
|
+
if (!y && E.length === 1) {
|
|
1497
|
+
_ = o.props.icon;
|
|
1493
1498
|
}
|
|
1494
1499
|
} else if (y) {
|
|
1495
1500
|
// only add values that don't match an option in "multiple" mode to preserve old behaviour
|
|
1496
1501
|
e.push(t);
|
|
1502
|
+
j.push(t.toString());
|
|
1497
1503
|
}
|
|
1498
1504
|
if (n < r.length - 1) {
|
|
1499
|
-
e.push((0,
|
|
1505
|
+
e.push((0, s._)(", "));
|
|
1506
|
+
j.push((0, s._)(", "));
|
|
1500
1507
|
}
|
|
1501
1508
|
return e;
|
|
1502
1509
|
}), []);
|
|
1503
|
-
|
|
1510
|
+
A = T;
|
|
1504
1511
|
// only apply prefix / suffix if the label is not empty
|
|
1505
|
-
if (
|
|
1506
|
-
|
|
1512
|
+
if (A.length > 0) {
|
|
1513
|
+
A = i.wrapLabel({
|
|
1507
1514
|
prefixLabel: S,
|
|
1508
|
-
label:
|
|
1509
|
-
suffixLabel:
|
|
1515
|
+
label: A,
|
|
1516
|
+
suffixLabel: w
|
|
1510
1517
|
});
|
|
1511
1518
|
}
|
|
1512
1519
|
// single <Select> behaviour is to show the placeholder if all parts of the the label
|
|
1513
1520
|
// are empty strings so we replicate this behaviour here
|
|
1514
|
-
if (
|
|
1521
|
+
if (A.length === 0 || !y && A.every((function(e) {
|
|
1515
1522
|
return e === "";
|
|
1516
1523
|
}))) {
|
|
1517
|
-
|
|
1524
|
+
A = Pt(g);
|
|
1525
|
+
// placeholder has a default value so will not be undefined
|
|
1526
|
+
j = Pt(g);
|
|
1518
1527
|
}
|
|
1519
|
-
var M = _;
|
|
1520
1528
|
// If there's more than one item selected, read out the selected total
|
|
1521
1529
|
// rather than reading out each selected item
|
|
1522
|
-
if (
|
|
1523
|
-
|
|
1530
|
+
if (A.length > 1) {
|
|
1531
|
+
j = i.wrapLabel({
|
|
1524
1532
|
prefixLabel: S,
|
|
1525
|
-
label: [ "".concat(
|
|
1526
|
-
suffixLabel:
|
|
1533
|
+
label: [ "".concat(E.length, " items selected") ],
|
|
1534
|
+
suffixLabel: w
|
|
1535
|
+
});
|
|
1536
|
+
} else {
|
|
1537
|
+
j = i.wrapLabel({
|
|
1538
|
+
prefixLabel: S,
|
|
1539
|
+
label: j,
|
|
1540
|
+
suffixLabel: w
|
|
1527
1541
|
});
|
|
1528
1542
|
}
|
|
1529
|
-
var
|
|
1543
|
+
var P = jt({
|
|
1530
1544
|
"aria-describedby": u,
|
|
1531
|
-
"aria-label": "".concat(m ? "".concat(m, ", ") : "").concat(
|
|
1545
|
+
"aria-label": "".concat(m ? "".concat(m, ", ") : "").concat(j.join("")),
|
|
1532
1546
|
"aria-labelledby": m ? undefined : b,
|
|
1533
|
-
"aria-required":
|
|
1547
|
+
"aria-required": x,
|
|
1534
1548
|
"data-select-appearance": l,
|
|
1535
1549
|
"data-test": y ? "multiselect" : "select",
|
|
1536
1550
|
disabled: p,
|
|
1537
1551
|
elementRef: d,
|
|
1538
1552
|
error: v
|
|
1539
|
-
},
|
|
1553
|
+
}, C()(i.props, O()(o.propTypes)));
|
|
1540
1554
|
if (y) {
|
|
1541
|
-
|
|
1555
|
+
P["data-test-values"] = JSON.stringify(E);
|
|
1542
1556
|
} else {
|
|
1543
|
-
var
|
|
1544
|
-
|
|
1557
|
+
var V = lt(E, 1), R = V[0];
|
|
1558
|
+
P["data-test-value"] = R;
|
|
1545
1559
|
}
|
|
1546
1560
|
if (a) {
|
|
1547
1561
|
|
|
1548
|
-
return (0, n.cloneElement)(a,
|
|
1562
|
+
return (0, n.cloneElement)(a, P);
|
|
1549
1563
|
}
|
|
1550
1564
|
if (l === "link") {
|
|
1551
1565
|
|
|
1552
|
-
return r().createElement(
|
|
1566
|
+
return r().createElement(q(), at({}, P, {
|
|
1553
1567
|
"data-select-appearance": "link"
|
|
1554
|
-
}), !!
|
|
1568
|
+
}), !!_ && r().createElement(Ue, null, _), A || g, r().createElement(Ge, null, r().createElement(J, null)));
|
|
1555
1569
|
}
|
|
1556
1570
|
|
|
1557
|
-
return r().createElement(We, at({},
|
|
1571
|
+
return r().createElement(We, at({}, P, {
|
|
1558
1572
|
$multiple: y,
|
|
1559
1573
|
appearance: l,
|
|
1560
|
-
label:
|
|
1574
|
+
label: A,
|
|
1561
1575
|
error: v,
|
|
1562
|
-
icon:
|
|
1576
|
+
icon: _,
|
|
1563
1577
|
inline: h,
|
|
1564
1578
|
isMenu: true,
|
|
1565
1579
|
"aria-haspopup": "listbox",
|
|
1566
1580
|
"aria-owns": i.menuId,
|
|
1567
1581
|
onClick: i.props.onClick
|
|
1568
|
-
}, I()(i.props, o.invalidLinkAppearanceProps)), !!
|
|
1582
|
+
}, I()(i.props, o.invalidLinkAppearanceProps)), !!E.length && y && r().createElement(Xe, {
|
|
1569
1583
|
"data-role": "count"
|
|
1570
|
-
}, "(",
|
|
1584
|
+
}, "(", E.length, ")"));
|
|
1571
1585
|
}));
|
|
1572
|
-
Et(
|
|
1586
|
+
Et(Ct(i), "createChildren", (function() {
|
|
1573
1587
|
var e = i.state, t = e.filterKeyword, o = e.textHasFocus, a = e.topValues;
|
|
1574
|
-
var l = i.props,
|
|
1588
|
+
var l = i.props, c = l.allowKeyMatching, u = l.allowNewValues, p = l.filter, d = l.multiple, h = l.selectAllAppearance, b = l.showSelectedValuesFirst, m = l.isLoadingOptions, y = l.onScrollBottom;
|
|
1575
1589
|
var g = i.getCurrentValues();
|
|
1576
1590
|
i.availableOptionCount = 0;
|
|
1577
1591
|
i.firstSelectedOptionIndex = undefined;
|
|
@@ -1580,11 +1594,11 @@
|
|
|
1580
1594
|
i.availableMatchOptions = [];
|
|
1581
1595
|
var O;
|
|
1582
1596
|
var S = 0;
|
|
1583
|
-
var
|
|
1597
|
+
var x = false;
|
|
1584
1598
|
// used to avoid overwriting the selected item ref in multiple mode
|
|
1585
|
-
var
|
|
1586
|
-
var
|
|
1587
|
-
var
|
|
1599
|
+
var w;
|
|
1600
|
+
var C = b === "immediately" ? i.getTopValues() : a;
|
|
1601
|
+
var k = n.Children.toArray(i.props.children).reduce((function(e, t, o) {
|
|
1588
1602
|
// ignore Headings and Dividers
|
|
1589
1603
|
if (!Dt(t)) {
|
|
1590
1604
|
e.push(t);
|
|
@@ -1595,11 +1609,11 @@
|
|
|
1595
1609
|
O = true;
|
|
1596
1610
|
}
|
|
1597
1611
|
var a = g && g.indexOf(t.props.value) >= 0;
|
|
1598
|
-
var l = !!a && !t.props.disabled && !
|
|
1599
|
-
var
|
|
1600
|
-
var u =
|
|
1612
|
+
var l = !!a && !t.props.disabled && !w;
|
|
1613
|
+
var s = c && !d && !p && !m && !y;
|
|
1614
|
+
var u = Lt(t.props.value, t.props.label);
|
|
1601
1615
|
var f = -1;
|
|
1602
|
-
if (
|
|
1616
|
+
if (s && !t.props.disabled && !t.props.hidden) {
|
|
1603
1617
|
i.availableMatchOptions.push({
|
|
1604
1618
|
label: t.props.label,
|
|
1605
1619
|
value: t.props.value
|
|
@@ -1610,7 +1624,7 @@
|
|
|
1610
1624
|
var v = (0, n.cloneElement)(t, {
|
|
1611
1625
|
key: t.key || o,
|
|
1612
1626
|
onClick: i.handleMenuOptionClick,
|
|
1613
|
-
onKeyDown:
|
|
1627
|
+
onKeyDown: s ? function(e) {
|
|
1614
1628
|
return i.handleMenuOptionKeyDown(e, f);
|
|
1615
1629
|
} : undefined,
|
|
1616
1630
|
selected: a,
|
|
@@ -1621,14 +1635,14 @@
|
|
|
1621
1635
|
}
|
|
1622
1636
|
});
|
|
1623
1637
|
if (l) {
|
|
1624
|
-
|
|
1638
|
+
w = true;
|
|
1625
1639
|
}
|
|
1626
|
-
if (
|
|
1640
|
+
if (C && C.indexOf(t.props.value) >= 0) {
|
|
1627
1641
|
if (S === 0) {
|
|
1628
1642
|
e.splice(S, 0, r().createElement(T.Divider, {
|
|
1629
1643
|
key: "topDivider"
|
|
1630
1644
|
}));
|
|
1631
|
-
|
|
1645
|
+
x = true;
|
|
1632
1646
|
}
|
|
1633
1647
|
e.splice(S, 0, v);
|
|
1634
1648
|
S += 1;
|
|
@@ -1640,23 +1654,23 @@
|
|
|
1640
1654
|
// In multiple mode, add missing items
|
|
1641
1655
|
if (d) {
|
|
1642
1656
|
v()(g, (function(e) {
|
|
1643
|
-
var t = f()(
|
|
1657
|
+
var t = f()(k, (function(t) {
|
|
1644
1658
|
return Dt(t) && t.props && t.props.value === e;
|
|
1645
1659
|
}));
|
|
1646
1660
|
if (!t) {
|
|
1647
1661
|
if (e === i.state.filterKeyword) {
|
|
1648
1662
|
O = true;
|
|
1649
1663
|
}
|
|
1650
|
-
var n =
|
|
1651
|
-
var o =
|
|
1664
|
+
var n = C && C.indexOf(e) >= 0;
|
|
1665
|
+
var o = C.length;
|
|
1652
1666
|
if (S === 0) {
|
|
1653
|
-
|
|
1667
|
+
k.splice(0, 0, r().createElement(T.Divider, {
|
|
1654
1668
|
key: "topDivider"
|
|
1655
1669
|
}));
|
|
1656
1670
|
S += 1;
|
|
1657
|
-
|
|
1671
|
+
x = true;
|
|
1658
1672
|
}
|
|
1659
|
-
|
|
1673
|
+
k.splice(n ? 0 : o + 1, 0, r().createElement(Oe, {
|
|
1660
1674
|
label: String(e),
|
|
1661
1675
|
value: e,
|
|
1662
1676
|
key: "missing-value-".concat(e),
|
|
@@ -1673,7 +1687,7 @@
|
|
|
1673
1687
|
var I = p === "controlled";
|
|
1674
1688
|
// Filter the items
|
|
1675
1689
|
var _ = (0, D.stringToKeywords)(t);
|
|
1676
|
-
|
|
1690
|
+
k = I ? k : k.filter((function(e) {
|
|
1677
1691
|
if (Dt(e)) {
|
|
1678
1692
|
return (0, D.testPhrase)(e.props.label, _);
|
|
1679
1693
|
}
|
|
@@ -1692,8 +1706,8 @@
|
|
|
1692
1706
|
}));
|
|
1693
1707
|
// Add the option to add the new value
|
|
1694
1708
|
if (u && !O && t) {
|
|
1695
|
-
var A =
|
|
1696
|
-
|
|
1709
|
+
var A = x ? S + 1 : S;
|
|
1710
|
+
k.splice(A, 0, r().createElement(Oe, {
|
|
1697
1711
|
label: "".concat(t, " (new value)"),
|
|
1698
1712
|
value: t,
|
|
1699
1713
|
key: "newValue",
|
|
@@ -1702,10 +1716,10 @@
|
|
|
1702
1716
|
}));
|
|
1703
1717
|
}
|
|
1704
1718
|
// When selectAll is a menu item, add an offset so that activeItem accounts for the extra selectAll option.
|
|
1705
|
-
var j = h === "checkbox" && d &&
|
|
1719
|
+
var j = h === "checkbox" && d && k.length > 1 ? 1 : 0;
|
|
1706
1720
|
var E = true;
|
|
1707
1721
|
// Highlight the selected Items and remove hidden
|
|
1708
|
-
|
|
1722
|
+
k = k.reduce((function(e, t) {
|
|
1709
1723
|
// ignore Dividers & Headings
|
|
1710
1724
|
if (!Dt(t)) {
|
|
1711
1725
|
e.push(t);
|
|
@@ -1747,19 +1761,19 @@
|
|
|
1747
1761
|
var P;
|
|
1748
1762
|
if (i.optionSelection === "all") {
|
|
1749
1763
|
if (t === "") {
|
|
1750
|
-
P = (0,
|
|
1764
|
+
P = (0, s._)("Clear all");
|
|
1751
1765
|
} else {
|
|
1752
|
-
P = (0,
|
|
1766
|
+
P = (0, s._)("Clear all matches");
|
|
1753
1767
|
}
|
|
1754
1768
|
} else if (t === "") {
|
|
1755
|
-
P = (0,
|
|
1769
|
+
P = (0, s._)("Select all");
|
|
1756
1770
|
} else {
|
|
1757
|
-
P = (0,
|
|
1771
|
+
P = (0, s._)("Select all matches");
|
|
1758
1772
|
}
|
|
1759
1773
|
if (i.state.activeIndex === 0 && o) {
|
|
1760
1774
|
i.activeValue = "selectAll";
|
|
1761
1775
|
}
|
|
1762
|
-
|
|
1776
|
+
k.unshift( r().createElement(He, {
|
|
1763
1777
|
key: "selectAllOption",
|
|
1764
1778
|
selected: i.optionSelection === "all" || i.optionSelection !== "none" && "some",
|
|
1765
1779
|
selectAllLabel: P,
|
|
@@ -1774,15 +1788,15 @@
|
|
|
1774
1788
|
key: "selectAllDivider"
|
|
1775
1789
|
}));
|
|
1776
1790
|
}
|
|
1777
|
-
i.displayedValues =
|
|
1791
|
+
i.displayedValues = k.reduce((function(e, t) {
|
|
1778
1792
|
if (Dt(t)) {
|
|
1779
1793
|
e.push(t.props.value);
|
|
1780
1794
|
}
|
|
1781
1795
|
return e;
|
|
1782
1796
|
}), []);
|
|
1783
|
-
return
|
|
1797
|
+
return k;
|
|
1784
1798
|
}));
|
|
1785
|
-
Et(
|
|
1799
|
+
Et(Ct(i), "wrapLabel", (function(e) {
|
|
1786
1800
|
var t = e.prefixLabel, n = e.label, r = e.suffixLabel;
|
|
1787
1801
|
var o = n;
|
|
1788
1802
|
if (t) {
|
|
@@ -1793,7 +1807,7 @@
|
|
|
1793
1807
|
}
|
|
1794
1808
|
return o;
|
|
1795
1809
|
}));
|
|
1796
|
-
Et(
|
|
1810
|
+
Et(Ct(i), "handleDropdownMount", (function(e) {
|
|
1797
1811
|
i.dropdown = e;
|
|
1798
1812
|
}));
|
|
1799
1813
|
i.state = {
|
|
@@ -1860,7 +1874,7 @@
|
|
|
1860
1874
|
var r, o, i;
|
|
1861
1875
|
var a = (r = this.getCurrentValues()) !== null && r !== void 0 ? r : [];
|
|
1862
1876
|
var l = a.indexOf(n);
|
|
1863
|
-
var
|
|
1877
|
+
var s = this.props, c = s.name, u = s.multiple;
|
|
1864
1878
|
var p;
|
|
1865
1879
|
if (u) {
|
|
1866
1880
|
if (l >= 0) {
|
|
@@ -1895,7 +1909,7 @@
|
|
|
1895
1909
|
}
|
|
1896
1910
|
(o = (i = this.props).onChange) === null || o === void 0 ? void 0 : o.call(i, t, {
|
|
1897
1911
|
values: p,
|
|
1898
|
-
name:
|
|
1912
|
+
name: c,
|
|
1899
1913
|
reason: "valueToggle"
|
|
1900
1914
|
});
|
|
1901
1915
|
}
|
|
@@ -1912,9 +1926,9 @@
|
|
|
1912
1926
|
value: function e(t) {
|
|
1913
1927
|
var n = t.hasChildren, o = t.placement;
|
|
1914
1928
|
var i = this.state.filterKeyword;
|
|
1915
|
-
var a = this.props, l = a.inputId,
|
|
1916
|
-
var f = (0,
|
|
1917
|
-
var d = (0,
|
|
1929
|
+
var a = this.props, l = a.inputId, c = a.inputRef, u = a.multiple, p = a.selectAllAppearance;
|
|
1930
|
+
var f = (0, s._)("Select all options".concat(this.optionSelection === "all" ? " disabled" : ""));
|
|
1931
|
+
var d = (0, s._)("Clear all options".concat(this.optionSelection === "none" ? " disabled" : ""));
|
|
1918
1932
|
// only visually disable these as opposed to fully disabling to avoid losing keyboard focus - see SUI-2731
|
|
1919
1933
|
var v = r().createElement(Ze, {
|
|
1920
1934
|
$placement: o,
|
|
@@ -1924,12 +1938,12 @@
|
|
|
1924
1938
|
"aria-label": f,
|
|
1925
1939
|
onClick: this.handleSelectAll,
|
|
1926
1940
|
"data-test": "select-all"
|
|
1927
|
-
}, i ? (0,
|
|
1941
|
+
}, i ? (0, s._)("Select all Matches") : (0, s._)("Select all")), r().createElement(Ye, {
|
|
1928
1942
|
$disabled: this.optionSelection === "none",
|
|
1929
1943
|
"aria-label": d,
|
|
1930
1944
|
onClick: this.handleClearAll,
|
|
1931
1945
|
"data-test": "clear-all"
|
|
1932
|
-
}, i ? (0,
|
|
1946
|
+
}, i ? (0, s._)("Clear all Matches") : (0, s._)("Clear all")));
|
|
1933
1947
|
return this.hasFilter() && r().createElement("div", {
|
|
1934
1948
|
key: "controls"
|
|
1935
1949
|
}, r().createElement(Je, {
|
|
@@ -1945,13 +1959,13 @@
|
|
|
1945
1959
|
onKeyDown: this.handleTextKeyDown,
|
|
1946
1960
|
onFocus: this.handleTextFocus,
|
|
1947
1961
|
onBlur: this.handleTextBlur,
|
|
1948
|
-
placeholder: (0,
|
|
1962
|
+
placeholder: (0, s._)("filter"),
|
|
1949
1963
|
role: "combobox",
|
|
1950
1964
|
"aria-expanded": "true",
|
|
1951
1965
|
"aria-controls": this.menuListboxId,
|
|
1952
|
-
"aria-label": (0,
|
|
1966
|
+
"aria-label": (0, s._)("Filter"),
|
|
1953
1967
|
"aria-activedescendant": this.state.textHasFocus && n ? this.activeItemId : undefined,
|
|
1954
|
-
inputRef:
|
|
1968
|
+
inputRef: c,
|
|
1955
1969
|
inputId: l,
|
|
1956
1970
|
canClear: true,
|
|
1957
1971
|
startAdornment: r().createElement(Qe, null, r().createElement(te, null))
|
|
@@ -1961,7 +1975,7 @@
|
|
|
1961
1975
|
key: "render",
|
|
1962
1976
|
value: function e() {
|
|
1963
1977
|
var t, o = this;
|
|
1964
|
-
var i = this.props, a = i.children, l = i.defaultPlacement,
|
|
1978
|
+
var i = this.props, a = i.children, l = i.defaultPlacement, s = i.inputId, c = i.multiple, u = i.repositionMode, p = i.virtualization;
|
|
1965
1979
|
var d = this.hasFilter();
|
|
1966
1980
|
var v = (t = this.getCurrentValues()) !== null && t !== void 0 ? t : [];
|
|
1967
1981
|
var h = n.Children.toArray(a);
|
|
@@ -1981,9 +1995,9 @@
|
|
|
1981
1995
|
maxHeight: i,
|
|
1982
1996
|
menuStyle: o.props.menuStyle
|
|
1983
1997
|
});
|
|
1984
|
-
var
|
|
1998
|
+
var s = v.length > 0 && !b && !o.hasFilter() ? 0 : undefined;
|
|
1985
1999
|
var u = jt(jt({
|
|
1986
|
-
"aria-multiselectable":
|
|
2000
|
+
"aria-multiselectable": c || undefined,
|
|
1987
2001
|
childrenStart: o.renderControls({
|
|
1988
2002
|
placement: a,
|
|
1989
2003
|
hasChildren: !!m.length
|
|
@@ -1997,7 +2011,7 @@
|
|
|
1997
2011
|
menuId: o.menuListboxId
|
|
1998
2012
|
}, I()(o.props, "noOptionsMessage", "footerMessage", "animateLoading", "loadingMessage", "onScroll")), {}, {
|
|
1999
2013
|
style: l,
|
|
2000
|
-
tabIndex:
|
|
2014
|
+
tabIndex: s
|
|
2001
2015
|
});
|
|
2002
2016
|
if (p) {
|
|
2003
2017
|
|
|
@@ -2011,7 +2025,7 @@
|
|
|
2011
2025
|
|
|
2012
2026
|
return r().createElement(V(), {
|
|
2013
2027
|
closeReasons: Rt,
|
|
2014
|
-
inputId:
|
|
2028
|
+
inputId: s,
|
|
2015
2029
|
toggle: y,
|
|
2016
2030
|
onRequestOpen: this.handleRequestOpen,
|
|
2017
2031
|
onRequestClose: this.handleRequestClose,
|
|
@@ -2028,13 +2042,13 @@
|
|
|
2028
2042
|
} ]);
|
|
2029
2043
|
return o;
|
|
2030
2044
|
}(n.Component);
|
|
2031
|
-
Et(
|
|
2032
|
-
Et(
|
|
2033
|
-
Et(
|
|
2034
|
-
Et(
|
|
2035
|
-
Et(
|
|
2036
|
-
Et(
|
|
2037
|
-
/* harmony default export */ const Nt =
|
|
2045
|
+
Et(qt, "propTypes", Mt);
|
|
2046
|
+
Et(qt, "defaultProps", Tt);
|
|
2047
|
+
Et(qt, "Option", Oe);
|
|
2048
|
+
Et(qt, "Divider", T.Divider);
|
|
2049
|
+
Et(qt, "Heading", T.Heading);
|
|
2050
|
+
Et(qt, "invalidLinkAppearanceProps", [ "append", "error", "prepend" ]);
|
|
2051
|
+
/* harmony default export */ const Nt = qt;
|
|
2038
2052
|
// CONCATENATED MODULE: ./src/Select/Option.tsx
|
|
2039
2053
|
function Bt(e) {
|
|
2040
2054
|
"@babel/helpers - typeof";
|
|
@@ -2290,12 +2304,12 @@
|
|
|
2290
2304
|
}
|
|
2291
2305
|
return n;
|
|
2292
2306
|
}
|
|
2293
|
-
function
|
|
2307
|
+
function sn(e, t) {
|
|
2294
2308
|
if (!(e instanceof t)) {
|
|
2295
2309
|
throw new TypeError("Cannot call a class as a function");
|
|
2296
2310
|
}
|
|
2297
2311
|
}
|
|
2298
|
-
function
|
|
2312
|
+
function cn(e, t) {
|
|
2299
2313
|
for (var n = 0; n < t.length; n++) {
|
|
2300
2314
|
var r = t[n];
|
|
2301
2315
|
r.enumerable = r.enumerable || false;
|
|
@@ -2305,8 +2319,8 @@
|
|
|
2305
2319
|
}
|
|
2306
2320
|
}
|
|
2307
2321
|
function un(e, t, n) {
|
|
2308
|
-
if (t)
|
|
2309
|
-
if (n)
|
|
2322
|
+
if (t) cn(e.prototype, t);
|
|
2323
|
+
if (n) cn(e, n);
|
|
2310
2324
|
return e;
|
|
2311
2325
|
}
|
|
2312
2326
|
function pn(e, t) {
|
|
@@ -2419,6 +2433,7 @@
|
|
|
2419
2433
|
prefixLabel: i().string,
|
|
2420
2434
|
prepend: i().bool,
|
|
2421
2435
|
suffixLabel: i().string,
|
|
2436
|
+
toggleContent: i().oneOf([ "optionChildren", "optionLabel" ]),
|
|
2422
2437
|
/** @private. */
|
|
2423
2438
|
toggle: i().node,
|
|
2424
2439
|
value: i().oneOfType([ i().string, i().number, i().bool ]),
|
|
@@ -2438,9 +2453,10 @@
|
|
|
2438
2453
|
inline: true,
|
|
2439
2454
|
isLoadingOptions: false,
|
|
2440
2455
|
menuStyle: {},
|
|
2441
|
-
noOptionsMessage: (0,
|
|
2442
|
-
placeholder: (0,
|
|
2443
|
-
prepend: false
|
|
2456
|
+
noOptionsMessage: (0, s._)("No matches"),
|
|
2457
|
+
placeholder: (0, s._)("Select..."),
|
|
2458
|
+
prepend: false,
|
|
2459
|
+
toggleContent: "optionChildren"
|
|
2444
2460
|
};
|
|
2445
2461
|
var Sn = function(e) {
|
|
2446
2462
|
pn(n, e);
|
|
@@ -2448,7 +2464,7 @@
|
|
|
2448
2464
|
// @docs-props-type SelectPropsBase
|
|
2449
2465
|
function n(e) {
|
|
2450
2466
|
var r;
|
|
2451
|
-
|
|
2467
|
+
sn(this, n);
|
|
2452
2468
|
r = t.call(this, e);
|
|
2453
2469
|
var o = {};
|
|
2454
2470
|
// wrap defaultValue in an array once to avoid failing <SelectBase>'s defaultValues comparison check
|
|
@@ -2472,7 +2488,7 @@
|
|
|
2472
2488
|
key: "render",
|
|
2473
2489
|
value: function e() {
|
|
2474
2490
|
var t = this.props, n = t.defaultValue, o = t.onChange, i = t.value, a = an(t, [ "defaultValue", "onChange", "value" ]);
|
|
2475
|
-
var
|
|
2491
|
+
var s = {
|
|
2476
2492
|
onChange: function e(t, n) {
|
|
2477
2493
|
var r = n.name, i = n.values;
|
|
2478
2494
|
o === null || o === void 0 ? void 0 : o(t, {
|
|
@@ -2484,16 +2500,16 @@
|
|
|
2484
2500
|
// using "has" as opposed to a null check to match SelectBase
|
|
2485
2501
|
if (l()(this.props, "value")) {
|
|
2486
2502
|
if (i != null) {
|
|
2487
|
-
|
|
2503
|
+
s.values = [ i ];
|
|
2488
2504
|
} else {
|
|
2489
|
-
|
|
2505
|
+
s.values = [];
|
|
2490
2506
|
}
|
|
2491
2507
|
} else if (this.state.defaultValues != null) {
|
|
2492
2508
|
// using defaultValues from state in order to avoid wrapping defaultValue here
|
|
2493
|
-
|
|
2509
|
+
s.defaultValues = this.state.defaultValues;
|
|
2494
2510
|
}
|
|
2495
2511
|
|
|
2496
|
-
return r().createElement(Nt, on({}, a,
|
|
2512
|
+
return r().createElement(Nt, on({}, a, s, {
|
|
2497
2513
|
multiple: false
|
|
2498
2514
|
}));
|
|
2499
2515
|
}
|
|
@@ -2505,7 +2521,7 @@
|
|
|
2505
2521
|
yn(Sn, "Option", nn);
|
|
2506
2522
|
yn(Sn, "Heading", T.Heading);
|
|
2507
2523
|
yn(Sn, "Divider", T.Divider);
|
|
2508
|
-
/* harmony default export */ const
|
|
2524
|
+
/* harmony default export */ const xn = Sn;
|
|
2509
2525
|
// CONCATENATED MODULE: ./src/Select/index.ts
|
|
2510
2526
|
module.exports = t;
|
|
2511
2527
|
/******/})();
|