@splunk/react-ui 4.21.0 → 4.21.1
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/Accordion.js +425 -325
- package/Anchor.js +147 -117
- package/Animation.js +142 -94
- package/AnimationToggle.js +197 -193
- package/Box.js +145 -118
- package/Breadcrumbs.js +288 -206
- package/Button.js +488 -465
- package/ButtonGroup.js +160 -128
- package/ButtonSimple.js +543 -462
- package/CHANGELOG.md +7 -2
- package/Calendar.js +1111 -1001
- package/Card.js +771 -598
- package/CardLayout.js +205 -147
- package/Chip.js +509 -488
- package/Clickable.js +414 -352
- package/CloseButton.js +165 -142
- package/Code.js +1808 -2084
- package/Code.js.LICENSE.txt +8 -0
- package/CollapsiblePanel.js +586 -519
- package/Color.js +1066 -1069
- package/ColumnLayout.js +402 -363
- package/ComboBox.js +891 -794
- package/Concertina.js +997 -802
- package/ControlGroup.js +687 -594
- package/Date.js +567 -547
- package/DefinitionList.js +308 -234
- package/Divider.js +149 -118
- package/Dropdown.js +459 -416
- package/DualListbox.js +1479 -1541
- package/EventListener.js +94 -97
- package/File.js +1051 -969
- package/FormRows.js +883 -696
- package/Heading.js +216 -193
- package/Image.js +446 -402
- package/JSONTree.js +690 -551
- package/Layer.js +437 -410
- package/Link.js +336 -255
- package/List.js +213 -161
- package/Markdown.js +509 -487
- package/Menu.js +1105 -1056
- package/Message.js +475 -441
- package/MessageBar.js +387 -373
- package/Modal.js +810 -634
- package/ModalLayer.js +326 -243
- package/Monogram.js +308 -276
- package/Multiselect.js +3550 -3364
- package/Number.js +729 -687
- package/Paginator.js +510 -449
- package/Paragraph.js +145 -112
- package/Popover.js +1459 -1432
- package/Progress.js +301 -246
- package/RadioBar.js +610 -527
- package/RadioList.js +483 -444
- package/Resize.js +530 -489
- package/ResultsMenu.js +494 -455
- package/ScreenReaderContent.js +142 -111
- package/Scroll.js +595 -456
- package/ScrollContainerContext.js +197 -206
- package/Search.js +744 -650
- package/Select.js +2442 -2345
- package/SidePanel.js +390 -284
- package/Slider.js +669 -676
- package/SlidingPanels.js +639 -503
- package/SplitButton.js +464 -367
- package/StaticContent.js +161 -133
- package/StepBar.js +386 -358
- package/Switch.js +710 -640
- package/TabBar.js +726 -680
- package/TabLayout.js +406 -322
- package/Table.js +4842 -4616
- package/Text.js +1170 -1138
- package/TextArea.js +1102 -1090
- package/Tooltip.js +624 -581
- package/TransitionOpen.js +489 -422
- package/Typography.js +176 -153
- package/WaitSpinner.js +230 -206
- package/package.json +5 -5
- package/types/src/JSONTree/JSONTreeContext.d.ts +7 -0
- package/types/src/JSONTree/TreeNode.d.ts +5 -0
- package/useForceUpdate.js +112 -82
- package/useKeyPress.js +74 -71
- package/usePrevious.js +65 -65
- package/useRovingFocus.js +122 -138
package/Select.js
CHANGED
|
@@ -1,2394 +1,2491 @@
|
|
|
1
|
-
/******/ (() => {
|
|
2
|
-
|
|
3
|
-
/******/
|
|
4
|
-
/******/
|
|
5
|
-
/******/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/******/
|
|
9
|
-
/******/
|
|
10
|
-
/******/
|
|
11
|
-
/******/
|
|
12
|
-
/******/
|
|
13
|
-
/******/
|
|
14
|
-
/******/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/******/
|
|
20
|
-
/******/
|
|
21
|
-
/******/
|
|
22
|
-
/******/
|
|
23
|
-
/******/
|
|
24
|
-
/******/
|
|
25
|
-
/******/
|
|
26
|
-
/******/
|
|
27
|
-
/******/
|
|
28
|
-
/******/
|
|
29
|
-
/******/
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/******/
|
|
34
|
-
/******/
|
|
35
|
-
/******/
|
|
36
|
-
/******/
|
|
37
|
-
/******/
|
|
38
|
-
/******/
|
|
39
|
-
/******/
|
|
40
|
-
/******/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
/******/
|
|
44
|
-
/******/
|
|
45
|
-
/******/
|
|
46
|
-
/******/
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
var
|
|
83
|
-
|
|
84
|
-
const
|
|
85
|
-
var
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
var
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
var
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
var
|
|
95
|
-
|
|
96
|
-
const
|
|
97
|
-
var
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
var
|
|
101
|
-
|
|
102
|
-
const
|
|
103
|
-
var
|
|
104
|
-
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
const
|
|
126
|
-
var
|
|
127
|
-
|
|
128
|
-
const
|
|
129
|
-
var
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
var
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
1
|
+
/******/ (() => {
|
|
2
|
+
// webpackBootstrap
|
|
3
|
+
/******/ "use strict";
|
|
4
|
+
/******/ // The require scope
|
|
5
|
+
/******/ var e = {};
|
|
6
|
+
/******/
|
|
7
|
+
/************************************************************************/
|
|
8
|
+
/******/ /* webpack/runtime/compat get default export */
|
|
9
|
+
/******/ (() => {
|
|
10
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
11
|
+
/******/ e.n = t => {
|
|
12
|
+
/******/ var n = t && t.__esModule ?
|
|
13
|
+
/******/ () => t["default"]
|
|
14
|
+
/******/ : () => t
|
|
15
|
+
/******/;
|
|
16
|
+
e.d(n, {
|
|
17
|
+
a: n
|
|
18
|
+
});
|
|
19
|
+
/******/ return n;
|
|
20
|
+
/******/ };
|
|
21
|
+
/******/ })();
|
|
22
|
+
/******/
|
|
23
|
+
/******/ /* webpack/runtime/define property getters */
|
|
24
|
+
/******/ (() => {
|
|
25
|
+
/******/ // define getter functions for harmony exports
|
|
26
|
+
/******/ e.d = (t, n) => {
|
|
27
|
+
/******/ for (var r in n) {
|
|
28
|
+
/******/ if (e.o(n, r) && !e.o(t, r)) {
|
|
29
|
+
/******/ Object.defineProperty(t, r, {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: n[r]
|
|
32
|
+
});
|
|
33
|
+
/******/ }
|
|
34
|
+
/******/ }
|
|
35
|
+
/******/ };
|
|
36
|
+
/******/ })();
|
|
37
|
+
/******/
|
|
38
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
39
|
+
/******/ (() => {
|
|
40
|
+
/******/ e.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t)
|
|
41
|
+
/******/;
|
|
42
|
+
})();
|
|
43
|
+
/******/
|
|
44
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
45
|
+
/******/ (() => {
|
|
46
|
+
/******/ // define __esModule on exports
|
|
47
|
+
/******/ e.r = e => {
|
|
48
|
+
/******/ if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
|
|
49
|
+
/******/ Object.defineProperty(e, Symbol.toStringTag, {
|
|
50
|
+
value: "Module"
|
|
51
|
+
});
|
|
52
|
+
/******/ }
|
|
53
|
+
/******/ Object.defineProperty(e, "__esModule", {
|
|
54
|
+
value: true
|
|
55
|
+
});
|
|
56
|
+
/******/ };
|
|
57
|
+
/******/ })();
|
|
58
|
+
/******/
|
|
59
|
+
/************************************************************************/ var t = {};
|
|
60
|
+
// ESM COMPAT FLAG
|
|
61
|
+
e.r(t);
|
|
62
|
+
// EXPORTS
|
|
63
|
+
e.d(t, {
|
|
64
|
+
Divider: () => /* reexport */ T.Divider,
|
|
65
|
+
Heading: () => /* reexport */ T.Heading,
|
|
66
|
+
Option: () => /* reexport */ nn,
|
|
67
|
+
default: () => /* reexport */ wn
|
|
68
|
+
});
|
|
69
|
+
// CONCATENATED MODULE: external "react"
|
|
70
|
+
const n = require("react");
|
|
71
|
+
var r = e.n(n);
|
|
72
|
+
// CONCATENATED MODULE: external "prop-types"
|
|
73
|
+
const o = require("prop-types");
|
|
74
|
+
var a = e.n(o);
|
|
75
|
+
// CONCATENATED MODULE: external "lodash/has"
|
|
76
|
+
const i = require("lodash/has");
|
|
77
|
+
var l = e.n(i);
|
|
78
|
+
// CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
|
|
79
|
+
const c = require("@splunk/ui-utils/i18n");
|
|
80
|
+
// CONCATENATED MODULE: external "lodash/castArray"
|
|
81
|
+
const s = require("lodash/castArray");
|
|
82
|
+
var u = e.n(s);
|
|
83
|
+
// CONCATENATED MODULE: external "lodash/find"
|
|
84
|
+
const p = require("lodash/find");
|
|
85
|
+
var f = e.n(p);
|
|
86
|
+
// CONCATENATED MODULE: external "lodash/forEachRight"
|
|
87
|
+
const d = require("lodash/forEachRight");
|
|
88
|
+
var v = e.n(d);
|
|
89
|
+
// CONCATENATED MODULE: external "lodash/includes"
|
|
90
|
+
const h = require("lodash/includes");
|
|
91
|
+
var b = e.n(h);
|
|
92
|
+
// CONCATENATED MODULE: external "lodash/isUndefined"
|
|
93
|
+
const y = require("lodash/isUndefined");
|
|
94
|
+
var m = e.n(y);
|
|
95
|
+
// CONCATENATED MODULE: external "lodash/keys"
|
|
96
|
+
const g = require("lodash/keys");
|
|
97
|
+
var O = e.n(g);
|
|
98
|
+
// CONCATENATED MODULE: external "lodash/memoize"
|
|
99
|
+
const S = require("lodash/memoize");
|
|
100
|
+
var w = e.n(S);
|
|
101
|
+
// CONCATENATED MODULE: external "lodash/omit"
|
|
102
|
+
const k = require("lodash/omit");
|
|
103
|
+
var C = e.n(k);
|
|
104
|
+
// CONCATENATED MODULE: external "lodash/pick"
|
|
105
|
+
const x = require("lodash/pick");
|
|
106
|
+
var I = e.n(x);
|
|
107
|
+
// CONCATENATED MODULE: external "lodash/uniq"
|
|
108
|
+
const _ = require("lodash/uniq");
|
|
109
|
+
var A = e.n(_);
|
|
110
|
+
// CONCATENATED MODULE: external "lodash/without"
|
|
111
|
+
const j = require("lodash/without");
|
|
112
|
+
var E = e.n(j);
|
|
113
|
+
// CONCATENATED MODULE: external "@splunk/ui-utils/id"
|
|
114
|
+
const M = require("@splunk/ui-utils/id");
|
|
115
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/Menu"
|
|
116
|
+
const T = require("@splunk/react-ui/Menu");
|
|
117
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/Dropdown"
|
|
118
|
+
const P = require("@splunk/react-ui/Dropdown");
|
|
119
|
+
var V = e.n(P);
|
|
120
|
+
// CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
|
|
121
|
+
const R = require("@splunk/ui-utils/keyboard");
|
|
122
|
+
// CONCATENATED MODULE: external "@splunk/ui-utils/filter"
|
|
123
|
+
const D = require("@splunk/ui-utils/filter");
|
|
124
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/Link"
|
|
125
|
+
const q = require("@splunk/react-ui/Link");
|
|
126
|
+
var L = e.n(q);
|
|
127
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/ResultsMenu"
|
|
128
|
+
const N = require("@splunk/react-ui/ResultsMenu");
|
|
129
|
+
var B = e.n(N);
|
|
130
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/Text"
|
|
131
|
+
const K = require("@splunk/react-ui/Text");
|
|
132
|
+
var F = e.n(K);
|
|
133
|
+
// CONCATENATED MODULE: external "@splunk/react-icons/CaretSmallDown"
|
|
134
|
+
const $ = require("@splunk/react-icons/CaretSmallDown");
|
|
135
|
+
var H = e.n($);
|
|
136
|
+
// CONCATENATED MODULE: external "@splunk/react-icons/enterprise/Caret"
|
|
137
|
+
const W = require("@splunk/react-icons/enterprise/Caret");
|
|
138
|
+
var z = e.n(W);
|
|
139
|
+
// CONCATENATED MODULE: external "@splunk/themes"
|
|
140
|
+
const U = require("@splunk/themes");
|
|
141
|
+
// CONCATENATED MODULE: ./src/Select/icons/CaretSmallDown.tsx
|
|
142
|
+
var G = function e() {
|
|
143
|
+
var t = (0, U.useSplunkTheme)(), n = t.isEnterprise;
|
|
144
|
+
var o = n ? r().createElement(z(), {
|
|
145
|
+
screenReaderText: null,
|
|
146
|
+
hideDefaultTooltip: true,
|
|
147
|
+
size: .5
|
|
148
|
+
}) : r().createElement(H(), null);
|
|
149
|
+
return o;
|
|
150
|
+
};
|
|
151
|
+
/* harmony default export */ const J = G;
|
|
152
|
+
// CONCATENATED MODULE: external "@splunk/react-icons/enterprise/Search"
|
|
153
|
+
const Q = require("@splunk/react-icons/enterprise/Search");
|
|
154
|
+
var X = e.n(Q);
|
|
155
|
+
// CONCATENATED MODULE: external "@splunk/react-icons/Magnifier"
|
|
156
|
+
const Y = require("@splunk/react-icons/Magnifier");
|
|
157
|
+
var Z = e.n(Y);
|
|
158
|
+
// CONCATENATED MODULE: ./src/Select/icons/Search.tsx
|
|
159
|
+
var ee = function e() {
|
|
160
|
+
var t = (0, U.useSplunkTheme)(), n = t.isEnterprise, o = t.isCompact;
|
|
161
|
+
var a = (0, c._)("Search");
|
|
162
|
+
var i = o ? "20px" : "24px";
|
|
163
|
+
var l = n ? r().createElement(X(), {
|
|
164
|
+
role: "presentation",
|
|
165
|
+
size: "16px",
|
|
166
|
+
screenReaderText: a,
|
|
167
|
+
hideDefaultTooltip: true
|
|
168
|
+
}) : r().createElement(Z(), {
|
|
169
|
+
role: "presentation",
|
|
170
|
+
"aria-label": a,
|
|
171
|
+
width: i,
|
|
172
|
+
height: i
|
|
173
|
+
});
|
|
174
|
+
return l;
|
|
175
|
+
};
|
|
176
|
+
/* harmony default export */ const te = ee;
|
|
177
|
+
// CONCATENATED MODULE: ./src/Select/OptionBase.tsx
|
|
178
|
+
function ne(e) {
|
|
179
|
+
"@babel/helpers - typeof";
|
|
180
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
181
|
+
ne = function e(t) {
|
|
182
|
+
return typeof t;
|
|
183
|
+
};
|
|
184
|
+
} else {
|
|
185
|
+
ne = function e(t) {
|
|
186
|
+
return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
return ne(e);
|
|
190
|
+
}
|
|
191
|
+
function re() {
|
|
192
|
+
re = Object.assign || function(e) {
|
|
193
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
194
|
+
var n = arguments[t];
|
|
195
|
+
for (var r in n) {
|
|
196
|
+
if (Object.prototype.hasOwnProperty.call(n, r)) {
|
|
197
|
+
e[r] = n[r];
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return e;
|
|
202
|
+
};
|
|
203
|
+
return re.apply(this, arguments);
|
|
204
|
+
}
|
|
205
|
+
function oe(e, t) {
|
|
206
|
+
if (e == null) return {};
|
|
207
|
+
var n = ae(e, t);
|
|
208
|
+
var r, o;
|
|
209
|
+
if (Object.getOwnPropertySymbols) {
|
|
210
|
+
var a = Object.getOwnPropertySymbols(e);
|
|
211
|
+
for (o = 0; o < a.length; o++) {
|
|
212
|
+
r = a[o];
|
|
213
|
+
if (t.indexOf(r) >= 0) continue;
|
|
214
|
+
if (!Object.prototype.propertyIsEnumerable.call(e, r)) continue;
|
|
215
|
+
n[r] = e[r];
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return n;
|
|
219
|
+
}
|
|
220
|
+
function ae(e, t) {
|
|
221
|
+
if (e == null) return {};
|
|
222
|
+
var n = {};
|
|
223
|
+
var r = Object.keys(e);
|
|
224
|
+
var o, a;
|
|
225
|
+
for (a = 0; a < r.length; a++) {
|
|
226
|
+
o = r[a];
|
|
227
|
+
if (t.indexOf(o) >= 0) continue;
|
|
228
|
+
n[o] = e[o];
|
|
229
|
+
}
|
|
230
|
+
return n;
|
|
231
|
+
}
|
|
232
|
+
function ie(e, t) {
|
|
233
|
+
if (!(e instanceof t)) {
|
|
234
|
+
throw new TypeError("Cannot call a class as a function");
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
function le(e, t) {
|
|
238
|
+
for (var n = 0; n < t.length; n++) {
|
|
239
|
+
var r = t[n];
|
|
240
|
+
r.enumerable = r.enumerable || false;
|
|
241
|
+
r.configurable = true;
|
|
242
|
+
if ("value" in r) r.writable = true;
|
|
243
|
+
Object.defineProperty(e, r.key, r);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
function ce(e, t, n) {
|
|
247
|
+
if (t) le(e.prototype, t);
|
|
248
|
+
if (n) le(e, n);
|
|
249
|
+
return e;
|
|
250
|
+
}
|
|
251
|
+
function se(e, t) {
|
|
252
|
+
if (typeof t !== "function" && t !== null) {
|
|
253
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
254
|
+
}
|
|
255
|
+
e.prototype = Object.create(t && t.prototype, {
|
|
256
|
+
constructor: {
|
|
257
|
+
value: e,
|
|
258
|
+
writable: true,
|
|
259
|
+
configurable: true
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
if (t) ue(e, t);
|
|
263
|
+
}
|
|
264
|
+
function ue(e, t) {
|
|
265
|
+
ue = Object.setPrototypeOf || function e(t, n) {
|
|
266
|
+
t.__proto__ = n;
|
|
267
|
+
return t;
|
|
268
|
+
};
|
|
269
|
+
return ue(e, t);
|
|
270
|
+
}
|
|
271
|
+
function pe(e) {
|
|
272
|
+
var t = ve();
|
|
273
|
+
return function n() {
|
|
274
|
+
var r = he(e), o;
|
|
275
|
+
if (t) {
|
|
276
|
+
var a = he(this).constructor;
|
|
277
|
+
o = Reflect.construct(r, arguments, a);
|
|
278
|
+
} else {
|
|
279
|
+
o = r.apply(this, arguments);
|
|
280
|
+
}
|
|
281
|
+
return fe(this, o);
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
function fe(e, t) {
|
|
285
|
+
if (t && (ne(t) === "object" || typeof t === "function")) {
|
|
286
|
+
return t;
|
|
287
|
+
}
|
|
288
|
+
return de(e);
|
|
289
|
+
}
|
|
290
|
+
function de(e) {
|
|
291
|
+
if (e === void 0) {
|
|
292
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
293
|
+
}
|
|
294
|
+
return e;
|
|
295
|
+
}
|
|
296
|
+
function ve() {
|
|
297
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
298
|
+
if (Reflect.construct.sham) return false;
|
|
299
|
+
if (typeof Proxy === "function") return true;
|
|
300
|
+
try {
|
|
301
|
+
Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
|
|
302
|
+
return true;
|
|
303
|
+
} catch (e) {
|
|
304
|
+
return false;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
function he(e) {
|
|
308
|
+
he = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
|
|
309
|
+
return t.__proto__ || Object.getPrototypeOf(t);
|
|
310
|
+
};
|
|
311
|
+
return he(e);
|
|
312
|
+
}
|
|
313
|
+
function be(e, t, n) {
|
|
314
|
+
if (t in e) {
|
|
315
|
+
Object.defineProperty(e, t, {
|
|
316
|
+
value: n,
|
|
317
|
+
enumerable: true,
|
|
318
|
+
configurable: true,
|
|
319
|
+
writable: true
|
|
320
|
+
});
|
|
321
|
+
} else {
|
|
322
|
+
e[t] = n;
|
|
323
|
+
}
|
|
324
|
+
return e;
|
|
325
|
+
}
|
|
326
|
+
var ye = {
|
|
327
|
+
/** @private */
|
|
328
|
+
active: a().bool,
|
|
329
|
+
children: a().node,
|
|
330
|
+
description: a().string,
|
|
331
|
+
descriptionPosition: a().oneOf([ "right", "bottom" ]),
|
|
332
|
+
disabled: a().bool,
|
|
333
|
+
hidden: a().bool,
|
|
334
|
+
icon: a().node,
|
|
335
|
+
label: a().string.isRequired,
|
|
336
|
+
/**
|
|
233
337
|
* @private Passed down from <BaseSelect>
|
|
234
338
|
*/
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
};
|
|
256
|
-
|
|
257
|
-
/**
|
|
339
|
+
multiple: a().bool,
|
|
340
|
+
matchRanges: a().arrayOf(a().shape({
|
|
341
|
+
start: a().number.isRequired,
|
|
342
|
+
end: a().number.isRequired
|
|
343
|
+
})),
|
|
344
|
+
/** @private */
|
|
345
|
+
onClick: a().func,
|
|
346
|
+
/** @private */
|
|
347
|
+
selected: a().bool,
|
|
348
|
+
truncate: a().bool,
|
|
349
|
+
value: a().oneOfType([ a().string, a().number, a().bool ]).isRequired
|
|
350
|
+
};
|
|
351
|
+
var me = {
|
|
352
|
+
descriptionPosition: "bottom",
|
|
353
|
+
disabled: false,
|
|
354
|
+
multiple: false,
|
|
355
|
+
selected: false,
|
|
356
|
+
truncate: false
|
|
357
|
+
};
|
|
358
|
+
/**
|
|
258
359
|
* An option within a `Multiselect`. This inherits from
|
|
259
360
|
* [PureComponent](https://reactjs.org/docs/react-api.html#reactpurecomponent)
|
|
260
361
|
* so any elements passed to it must also be pure.
|
|
261
|
-
*/
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
_defineProperty(_assertThisInitialized(_this), "handleMount", function (c) {
|
|
294
|
-
_this.c = c;
|
|
295
|
-
});
|
|
296
|
-
|
|
297
|
-
return _this;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
_createClass(Option, [{
|
|
301
|
-
key: "scrollIntoViewIfNeeded",
|
|
302
|
-
value: function scrollIntoViewIfNeeded() {
|
|
303
|
-
var _this$c;
|
|
304
|
-
|
|
305
|
-
(_this$c = this.c) === null || _this$c === void 0 ? void 0 : _this$c.scrollIntoViewIfNeeded();
|
|
306
|
-
}
|
|
307
|
-
/**
|
|
362
|
+
*/ var ge = function(e) {
|
|
363
|
+
se(n, e);
|
|
364
|
+
var t = pe(n);
|
|
365
|
+
function n() {
|
|
366
|
+
var e;
|
|
367
|
+
ie(this, n);
|
|
368
|
+
for (var r = arguments.length, o = new Array(r), a = 0; a < r; a++) {
|
|
369
|
+
o[a] = arguments[a];
|
|
370
|
+
}
|
|
371
|
+
e = t.call.apply(t, [ this ].concat(o));
|
|
372
|
+
be(de(e), "c", null);
|
|
373
|
+
be(de(e), "handleClick", (function(t) {
|
|
374
|
+
var n = e.props, r = n.onClick, o = n.value, a = n.disabled;
|
|
375
|
+
if (!a) {
|
|
376
|
+
r === null || r === void 0 ? void 0 : r(t, {
|
|
377
|
+
value: o
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
}));
|
|
381
|
+
be(de(e), "handleMount", (function(t) {
|
|
382
|
+
e.c = t;
|
|
383
|
+
}));
|
|
384
|
+
return e;
|
|
385
|
+
}
|
|
386
|
+
ce(n, [ {
|
|
387
|
+
key: "scrollIntoViewIfNeeded",
|
|
388
|
+
value: function e() {
|
|
389
|
+
var t;
|
|
390
|
+
(t = this.c) === null || t === void 0 ? void 0 : t.scrollIntoViewIfNeeded();
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
308
393
|
* Place focus on the button.
|
|
309
|
-
*/
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
var
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
prisma: 'initial',
|
|
399
|
-
enterprise: 'middle'
|
|
400
|
-
}), (0,themes_namespaceObject.pick)({
|
|
401
|
-
prisma: (0,external_styled_components_namespaceObject.css)(["color:", ";display:inline-flex;align-items:center;min-width:20px;min-height:20px;& > svg{width:20px;height:20px;}"], themes_namespaceObject.variables.contentColorMuted),
|
|
402
|
-
enterprise: (0,external_styled_components_namespaceObject.css)(["transform:translateY(-1px);"])
|
|
403
|
-
}));
|
|
404
|
-
var StyledClickable = external_styled_components_default()((Clickable_default())).withConfig({
|
|
405
|
-
displayName: "ItemStyles__StyledClickable",
|
|
406
|
-
componentId: "sc-4kc053-4"
|
|
407
|
-
})(["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,themes_namespaceObject.pick)({
|
|
408
|
-
prisma: themes_namespaceObject.variables.contentColorActive,
|
|
409
|
-
enterprise: {
|
|
410
|
-
dark: themes_namespaceObject.variables.gray96,
|
|
411
|
-
light: themes_namespaceObject.variables.gray22
|
|
412
|
-
}
|
|
413
|
-
}), (0,themes_namespaceObject.pick)({
|
|
414
|
-
prisma: {
|
|
415
|
-
comfortable: '10px 16px',
|
|
416
|
-
compact: '6px 16px'
|
|
417
|
-
},
|
|
418
|
-
enterprise: '6px 10px'
|
|
419
|
-
}), function (_ref) {
|
|
420
|
-
var $isSelectable = _ref.$isSelectable,
|
|
421
|
-
$selectableAppearance = _ref.$selectableAppearance;
|
|
422
|
-
return $isSelectable && (0,themes_namespaceObject.pick)({
|
|
423
|
-
prisma: (0,external_styled_components_namespaceObject.css)(["padding-right:44px;", ""], function () {
|
|
424
|
-
return $selectableAppearance === 'checkbox' && 'padding-left: 42px;';
|
|
425
|
-
}),
|
|
426
|
-
enterprise: (0,external_styled_components_namespaceObject.css)(["padding-right:10px;padding-left:", ";"], function () {
|
|
427
|
-
return $selectableAppearance === 'checkbox' ? '32px' : '28px';
|
|
428
|
-
})
|
|
429
|
-
});
|
|
430
|
-
}, function (_ref2) {
|
|
431
|
-
var $active = _ref2.$active,
|
|
432
|
-
$preventFocus = _ref2.$preventFocus;
|
|
433
|
-
return $active && !$preventFocus && (0,external_styled_components_namespaceObject.css)(["box-shadow:", ";"], themes_namespaceObject.variables.focusShadowInset);
|
|
434
|
-
}, function (_ref3) {
|
|
435
|
-
var $active = _ref3.$active;
|
|
436
|
-
return $active && (0,external_styled_components_namespaceObject.css)(["background:", ";font-weight:", ";"], (0,themes_namespaceObject.pick)({
|
|
437
|
-
enterprise: {
|
|
438
|
-
light: themes_namespaceObject.variables.gray92,
|
|
439
|
-
dark: themes_namespaceObject.variables.gray22
|
|
440
|
-
},
|
|
441
|
-
prisma: themes_namespaceObject.variables.neutral100
|
|
442
|
-
}), themes_namespaceObject.variables.fontWeightBold);
|
|
443
|
-
}, (0,themes_namespaceObject.pick)({
|
|
444
|
-
prisma: themes_namespaceObject.variables.interactiveColorOverlayHover,
|
|
445
|
-
enterprise: themes_namespaceObject.variables.backgroundColorHover
|
|
446
|
-
}), function (_ref4) {
|
|
447
|
-
var $selected = _ref4.$selected;
|
|
448
|
-
return $selected && (0,themes_namespaceObject.pick)({
|
|
449
|
-
prisma: (0,external_styled_components_namespaceObject.css)(["background:", ";"], themes_namespaceObject.mixins.overlayColors(themes_namespaceObject.variables.interactiveColorOverlaySelected, themes_namespaceObject.variables.interactiveColorOverlayHover))
|
|
450
|
-
});
|
|
451
|
-
}, themes_namespaceObject.variables.focusShadowInset, (0,themes_namespaceObject.pick)({
|
|
452
|
-
prisma: (0,external_styled_components_namespaceObject.css)(["background:", ";"], themes_namespaceObject.variables.interactiveColorOverlayHover)
|
|
453
|
-
}), (0,themes_namespaceObject.pick)({
|
|
454
|
-
prisma: (0,external_styled_components_namespaceObject.css)(["&:active{background:", ";}"], themes_namespaceObject.variables.interactiveColorOverlayActive)
|
|
455
|
-
}), function (_ref5) {
|
|
456
|
-
var $selected = _ref5.$selected;
|
|
457
|
-
return $selected && (0,themes_namespaceObject.pick)({
|
|
458
|
-
prisma: (0,external_styled_components_namespaceObject.css)(["background:", ";&:active{background:", ";}"], themes_namespaceObject.variables.interactiveColorOverlaySelected, themes_namespaceObject.mixins.overlayColors(themes_namespaceObject.variables.interactiveColorOverlaySelected, themes_namespaceObject.variables.interactiveColorOverlayActive))
|
|
459
|
-
});
|
|
460
|
-
}, (0,themes_namespaceObject.pick)({
|
|
461
|
-
enterprise: {
|
|
462
|
-
light: themes_namespaceObject.variables.gray45,
|
|
463
|
-
dark: themes_namespaceObject.variables.contentColorDisabled
|
|
464
|
-
},
|
|
465
|
-
prisma: themes_namespaceObject.variables.contentColorDisabled
|
|
466
|
-
}),
|
|
467
|
-
/* sc-sel */
|
|
468
|
-
StyledItemDescriptionBottom,
|
|
469
|
-
/* sc-sel */
|
|
470
|
-
StyledItemDescriptionRight,
|
|
471
|
-
/* sc-sel */
|
|
472
|
-
StyledItemSelectedIcon, (0,themes_namespaceObject.pick)({
|
|
473
|
-
prisma: themes_namespaceObject.variables.contentColorDisabled,
|
|
474
|
-
enterprise: themes_namespaceObject.variables.gray80
|
|
475
|
-
}), (0,themes_namespaceObject.pick)({
|
|
476
|
-
prisma: (0,external_styled_components_namespaceObject.css)(["& > * > ", "{color:", ";}"],
|
|
477
|
-
/* sc-sel */
|
|
478
|
-
StyledItemIcon, themes_namespaceObject.variables.contentColorDisabled)
|
|
479
|
-
}), function (_ref6) {
|
|
480
|
-
var $selected = _ref6.$selected;
|
|
481
|
-
return $selected && (0,themes_namespaceObject.pick)({
|
|
482
|
-
prisma: (0,external_styled_components_namespaceObject.css)(["", "{color:", ";}"],
|
|
483
|
-
/* sc-sel */
|
|
484
|
-
StyledItemIcon, themes_namespaceObject.variables.contentColorActive)
|
|
485
|
-
});
|
|
486
|
-
});
|
|
487
|
-
var StyledSwitch = external_styled_components_default()((Switch_default())).withConfig({
|
|
488
|
-
displayName: "ItemStyles__StyledSwitch",
|
|
489
|
-
componentId: "sc-4kc053-5"
|
|
490
|
-
})(["position:absolute;left:", ";top:", ";"], (0,themes_namespaceObject.pick)({
|
|
491
|
-
prisma: '16px',
|
|
492
|
-
enterprise: '8px'
|
|
493
|
-
}), (0,themes_namespaceObject.pick)({
|
|
494
|
-
prisma: '0px',
|
|
495
|
-
enterprise: {
|
|
496
|
-
comfortable: '-1px',
|
|
497
|
-
compact: '2px'
|
|
498
|
-
}
|
|
499
|
-
}));
|
|
500
|
-
var StyledInnerWrapper = external_styled_components_default().span.withConfig({
|
|
501
|
-
displayName: "ItemStyles__StyledInnerWrapper",
|
|
502
|
-
componentId: "sc-4kc053-6"
|
|
503
|
-
})(["display:flex;align-items:flex-start;"]);
|
|
504
|
-
var StyledTitleAndDescriptionWrapper = external_styled_components_default().span.withConfig({
|
|
505
|
-
displayName: "ItemStyles__StyledTitleAndDescriptionWrapper",
|
|
506
|
-
componentId: "sc-4kc053-7"
|
|
507
|
-
})(["max-width:100%;width:100%;align-self:center;word-break:break-word;white-space:normal;", ""], function (_ref7) {
|
|
508
|
-
var $truncate = _ref7.$truncate;
|
|
509
|
-
return $truncate && (0,external_styled_components_namespaceObject.css)(["white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"]);
|
|
510
|
-
});
|
|
511
|
-
var StyledLabel = external_styled_components_default().div.withConfig({
|
|
512
|
-
displayName: "ItemStyles__StyledLabel",
|
|
513
|
-
componentId: "sc-4kc053-8"
|
|
514
|
-
})(["overflow:inherit;white-space:inherit;text-overflow:inherit;max-width:100%;min-height:20px;", ""], function (_ref8) {
|
|
515
|
-
var $truncate = _ref8.$truncate;
|
|
516
|
-
return $truncate && (0,external_styled_components_namespaceObject.css)(["display:block;clear:both;"]);
|
|
517
|
-
});
|
|
518
|
-
var StyledMatch = external_styled_components_default().span.withConfig({
|
|
519
|
-
displayName: "ItemStyles__StyledMatch",
|
|
520
|
-
componentId: "sc-4kc053-9"
|
|
521
|
-
})(["border-bottom:1px solid ", ";"], (0,themes_namespaceObject.pick)({
|
|
522
|
-
prisma: themes_namespaceObject.variables.contentColorActive,
|
|
523
|
-
enterprise: {
|
|
524
|
-
dark: themes_namespaceObject.variables.gray96,
|
|
525
|
-
light: themes_namespaceObject.variables.gray45
|
|
526
|
-
}
|
|
527
|
-
}));
|
|
528
|
-
var StyledSubmenu = external_styled_components_default().span.withConfig({
|
|
529
|
-
displayName: "ItemStyles__StyledSubmenu",
|
|
530
|
-
componentId: "sc-4kc053-10"
|
|
531
|
-
})(["float:right;padding-left:", ";color:", ";"], themes_namespaceObject.variables.spacingSmall, (0,themes_namespaceObject.pick)({
|
|
532
|
-
prisma: 'inherit',
|
|
533
|
-
enterprise: themes_namespaceObject.variables.textGray
|
|
534
|
-
}));
|
|
535
|
-
|
|
536
|
-
;// CONCATENATED MODULE: ./src/Select/SelectAllOptionStyles.ts
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
var StyledSelectAllLabel = external_styled_components_default()(StyledLabel).withConfig({
|
|
542
|
-
displayName: "SelectAllOptionStyles__StyledSelectAllLabel",
|
|
543
|
-
componentId: "y6bn08-0"
|
|
544
|
-
})(["font-weight:", ";"], themes_namespaceObject.variables.fontWeightBold);
|
|
545
|
-
var StyledSelectAllOption = external_styled_components_default()(OptionBase).withConfig({
|
|
546
|
-
displayName: "SelectAllOptionStyles__StyledSelectAllOption",
|
|
547
|
-
componentId: "y6bn08-1"
|
|
548
|
-
})(["padding-inline-start:", ";box-shadow:none;"], (0,themes_namespaceObject.pick)({
|
|
549
|
-
prisma: '42px;',
|
|
550
|
-
enterprise: '32px;'
|
|
551
|
-
}));
|
|
552
|
-
|
|
553
|
-
;// CONCATENATED MODULE: ./src/Select/SelectAllOption.tsx
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
var SelectAllOption_propTypes = {
|
|
559
|
-
active: (external_prop_types_default()).bool,
|
|
560
|
-
elementRef: external_prop_types_default().oneOfType([(external_prop_types_default()).func, (external_prop_types_default()).object]),
|
|
561
|
-
id: (external_prop_types_default()).string,
|
|
562
|
-
onClick: (external_prop_types_default()).func,
|
|
563
|
-
selectAllLabel: (external_prop_types_default()).string,
|
|
564
|
-
totalCount: (external_prop_types_default()).number,
|
|
565
|
-
changedToggle: (external_prop_types_default()).bool,
|
|
566
|
-
selected: external_prop_types_default().oneOf([false, true, 'some'])
|
|
567
|
-
};
|
|
568
|
-
var SelectAllOption = /*#__PURE__*/external_react_default().forwardRef(function (_ref, ref) {
|
|
569
|
-
var active = _ref.active,
|
|
570
|
-
id = _ref.id,
|
|
571
|
-
onClick = _ref.onClick,
|
|
572
|
-
selectAllLabel = _ref.selectAllLabel,
|
|
573
|
-
totalCount = _ref.totalCount,
|
|
574
|
-
changedToggle = _ref.changedToggle,
|
|
575
|
-
selected = _ref.selected;
|
|
576
|
-
// When toggle is changed the total count is not displayed anymore so the count is now shown in the Select All menu item
|
|
577
|
-
var totalCountDisplay = changedToggle ? " (".concat(totalCount === null || totalCount === void 0 ? void 0 : totalCount.toString(), ")") : '';
|
|
578
|
-
return /*#__PURE__*/external_react_default().createElement(StyledSelectAllOption, {
|
|
579
|
-
label: selectAllLabel,
|
|
580
|
-
value: "selectAll",
|
|
581
|
-
key: "selectAll",
|
|
582
|
-
onClick: onClick,
|
|
583
|
-
"data-test": "select-all",
|
|
584
|
-
"aria-keyshortcuts": "Control+A",
|
|
585
|
-
id: id,
|
|
586
|
-
active: active,
|
|
587
|
-
ref: ref,
|
|
588
|
-
tabIndex: -1
|
|
589
|
-
}, /*#__PURE__*/external_react_default().createElement(StyledSwitch, {
|
|
590
|
-
interactive: false,
|
|
591
|
-
selected: selected === 'some' && 'some' || selected,
|
|
592
|
-
key: "main-checkbox",
|
|
593
|
-
value: "main-checkbox",
|
|
594
|
-
appearance: "checkbox",
|
|
595
|
-
"aria-label": !selected && (0,i18n_namespaceObject._)('No options selected') || selected === 'some' && (0,i18n_namespaceObject._)('Some options selected') || (0,i18n_namespaceObject._)('All options selected'),
|
|
596
|
-
"data-test": "select-all-switch",
|
|
597
|
-
selectedLabel: selected === true ? (0,i18n_namespaceObject._)('All options selected') : (0,i18n_namespaceObject._)('Option selected'),
|
|
598
|
-
unselectedLabel: selected === true ? (0,i18n_namespaceObject._)('No options selected') : (0,i18n_namespaceObject._)('Option unselected'),
|
|
599
|
-
someSelectedLabel: (0,i18n_namespaceObject._)('Some options selected')
|
|
600
|
-
}), /*#__PURE__*/external_react_default().createElement(StyledItemDescriptionRight, {
|
|
601
|
-
"data-test": "description"
|
|
602
|
-
}, "".concat(totalCountDisplay, " Ctrl-a")), /*#__PURE__*/external_react_default().createElement(StyledInnerWrapper, null, /*#__PURE__*/external_react_default().createElement(StyledTitleAndDescriptionWrapper, {
|
|
603
|
-
$truncate: false
|
|
604
|
-
}, /*#__PURE__*/external_react_default().createElement(StyledSelectAllLabel, {
|
|
605
|
-
$truncate: false
|
|
606
|
-
}, selectAllLabel))));
|
|
607
|
-
});
|
|
608
|
-
SelectAllOption.propTypes = SelectAllOption_propTypes;
|
|
609
|
-
/* harmony default export */ const Select_SelectAllOption = (SelectAllOption);
|
|
610
|
-
;// CONCATENATED MODULE: external "@splunk/react-ui/Button"
|
|
611
|
-
const Button_namespaceObject = require("@splunk/react-ui/Button");
|
|
612
|
-
var Button_default = /*#__PURE__*/__webpack_require__.n(Button_namespaceObject);
|
|
613
|
-
;// CONCATENATED MODULE: ./src/Select/SelectBaseStyles.ts
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
var StyledButton = external_styled_components_default()((Button_default())).withConfig({
|
|
619
|
-
displayName: "SelectBaseStyles__StyledButton",
|
|
620
|
-
componentId: "sc-16cj7sk-0"
|
|
621
|
-
})(["&[data-inline]{width:", ";}", ""], function (_ref) {
|
|
622
|
-
var $multiple = _ref.$multiple;
|
|
623
|
-
return $multiple ? '400px' : 'auto';
|
|
624
|
-
}, function (_ref2) {
|
|
625
|
-
var $multiple = _ref2.$multiple;
|
|
626
|
-
return !$multiple && 'flex-grow: 0;';
|
|
627
|
-
});
|
|
628
|
-
var StyledLinkIcon = external_styled_components_default().span.withConfig({
|
|
629
|
-
displayName: "SelectBaseStyles__StyledLinkIcon",
|
|
630
|
-
componentId: "sc-16cj7sk-1"
|
|
631
|
-
})(["padding-right:2px;"]);
|
|
632
|
-
var StyledLinkCaret = external_styled_components_default().span.withConfig({
|
|
633
|
-
displayName: "SelectBaseStyles__StyledLinkCaret",
|
|
634
|
-
componentId: "sc-16cj7sk-2"
|
|
635
|
-
})(["padding-left:2px;"]);
|
|
636
|
-
var StyledFilter = external_styled_components_default().div.withConfig({
|
|
637
|
-
displayName: "SelectBaseStyles__StyledFilter",
|
|
638
|
-
componentId: "sc-16cj7sk-3"
|
|
639
|
-
})(["padding:", ";min-width:160px;"], (0,themes_namespaceObject.pick)({
|
|
640
|
-
enterprise: '8px',
|
|
641
|
-
prisma: '10px 16px'
|
|
642
|
-
}));
|
|
643
|
-
var StyledSearchIconWrapper = external_styled_components_default().span.withConfig({
|
|
644
|
-
displayName: "SelectBaseStyles__StyledSearchIconWrapper",
|
|
645
|
-
componentId: "sc-16cj7sk-4"
|
|
646
|
-
})(["color:", ";pointer-events:none;padding:", ";"], (0,themes_namespaceObject.pick)({
|
|
647
|
-
enterprise: {
|
|
648
|
-
light: themes_namespaceObject.variables.gray60,
|
|
649
|
-
dark: themes_namespaceObject.variables.white
|
|
650
|
-
},
|
|
651
|
-
prisma: themes_namespaceObject.variables.contentColorMuted
|
|
652
|
-
}), (0,themes_namespaceObject.pick)({
|
|
653
|
-
comfortable: '0 8px',
|
|
654
|
-
compact: '0 6px'
|
|
655
|
-
}));
|
|
656
|
-
var StyledCount = external_styled_components_default().span.withConfig({
|
|
657
|
-
displayName: "SelectBaseStyles__StyledCount",
|
|
658
|
-
componentId: "sc-16cj7sk-5"
|
|
659
|
-
})(["padding-right:", ";"], (0,themes_namespaceObject.pick)({
|
|
660
|
-
enterprise: themes_namespaceObject.variables.spacingQuarter,
|
|
661
|
-
prisma: themes_namespaceObject.variables.spacingXSmall
|
|
662
|
-
}));
|
|
663
|
-
var StyledControlsLink = external_styled_components_default()((Link_default())).withConfig({
|
|
664
|
-
displayName: "SelectBaseStyles__StyledControlsLink",
|
|
665
|
-
componentId: "sc-16cj7sk-6"
|
|
666
|
-
})(["margin-right:20px;", ";"], function (_ref3) {
|
|
667
|
-
var $disabled = _ref3.$disabled;
|
|
668
|
-
return $disabled && (0,external_styled_components_namespaceObject.css)(["color:", ";"], themes_namespaceObject.variables.contentColorDisabled);
|
|
669
|
-
});
|
|
670
|
-
var StyledToggleAllControls = external_styled_components_default().div.withConfig({
|
|
671
|
-
displayName: "SelectBaseStyles__StyledToggleAllControls",
|
|
672
|
-
componentId: "sc-16cj7sk-7"
|
|
673
|
-
})(["padding:", ";", ""], (0,themes_namespaceObject.pick)({
|
|
674
|
-
enterprise: "5px 8px",
|
|
675
|
-
prisma: '10px 16px'
|
|
676
|
-
}), (0,themes_namespaceObject.pickVariant)('$placement', {
|
|
677
|
-
above: {
|
|
678
|
-
enterprise: (0,external_styled_components_namespaceObject.css)(["border-top:", ";"], themes_namespaceObject.variables.border),
|
|
679
|
-
prisma: (0,external_styled_components_namespaceObject.css)(["border-top:1px solid ", ";"], themes_namespaceObject.variables.neutral200)
|
|
680
|
-
},
|
|
681
|
-
below: {
|
|
682
|
-
enterprise: (0,external_styled_components_namespaceObject.css)(["border-bottom:", ";"], themes_namespaceObject.variables.border),
|
|
683
|
-
prisma: (0,external_styled_components_namespaceObject.css)(["border-bottom:1px solid ", ";"], themes_namespaceObject.variables.neutral200)
|
|
684
|
-
}
|
|
685
|
-
}));
|
|
686
|
-
|
|
687
|
-
;// CONCATENATED MODULE: ./src/utils/fuzzyMatch.ts
|
|
688
|
-
// A utility for matching keyboard characters to list values
|
|
689
|
-
var charFromMatchOption = function charFromMatchOption(option, charIndex) {
|
|
690
|
-
return option ? option.label.charAt(charIndex).toLowerCase() : '';
|
|
691
|
-
};
|
|
692
|
-
|
|
693
|
-
var fuzzyMatch = function fuzzyMatch(options, matchChar) {
|
|
694
|
-
if (!options.length) {
|
|
695
|
-
return options;
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
var defaultMatch = null;
|
|
699
|
-
var hasMatch = false;
|
|
700
|
-
var matches = options.filter(function (option) {
|
|
701
|
-
var characterValue = charFromMatchOption(option, matchChar.index);
|
|
702
|
-
|
|
703
|
-
if (characterValue === matchChar.value) {
|
|
704
|
-
hasMatch = true;
|
|
705
|
-
return true;
|
|
706
|
-
} // If we haven't found a match yet, keep track of the next closest match.
|
|
707
|
-
// Secondary matching looks for the closest character of a higher value, and failing that, closest of a lower value.
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
if (!hasMatch) {
|
|
711
|
-
var defaultValue = charFromMatchOption(defaultMatch, matchChar.index);
|
|
712
|
-
|
|
713
|
-
if (!defaultValue) {
|
|
714
|
-
defaultMatch = option;
|
|
715
|
-
} else if (characterValue > matchChar.value) {
|
|
716
|
-
if (defaultValue < matchChar.value) {
|
|
717
|
-
defaultMatch = option;
|
|
718
|
-
} else if (defaultValue > characterValue) {
|
|
719
|
-
defaultMatch = option;
|
|
394
|
+
*/ }, {
|
|
395
|
+
key: "focus",
|
|
396
|
+
value: function e() {
|
|
397
|
+
var t;
|
|
398
|
+
(t = this.c) === null || t === void 0 ? void 0 : t.focus();
|
|
399
|
+
}
|
|
400
|
+
}, {
|
|
401
|
+
key: "render",
|
|
402
|
+
value: function e() {
|
|
403
|
+
var t = this.props, n = t.value, o = t.children, a = t.label, i = t.multiple, l = oe(t, [ "value", "children", "label", "multiple" ]);
|
|
404
|
+
|
|
405
|
+
return r().createElement(T.Item, re({
|
|
406
|
+
"aria-selected": this.props.selected,
|
|
407
|
+
"data-test-value": n,
|
|
408
|
+
"data-test": "option",
|
|
409
|
+
ref: this.handleMount
|
|
410
|
+
}, l, {
|
|
411
|
+
selectable: true,
|
|
412
|
+
selectableAppearance: i ? "checkbox" : undefined,
|
|
413
|
+
onClick: this.handleClick,
|
|
414
|
+
role: "option",
|
|
415
|
+
value: n.toString()
|
|
416
|
+
}), o || a);
|
|
417
|
+
}
|
|
418
|
+
} ]);
|
|
419
|
+
return n;
|
|
420
|
+
}(n.PureComponent);
|
|
421
|
+
be(ge, "propTypes", ye);
|
|
422
|
+
be(ge, "defaultProps", me);
|
|
423
|
+
be(ge, "type", T.Item);
|
|
424
|
+
/* harmony default export */ const Oe = ge;
|
|
425
|
+
// CONCATENATED MODULE: external "styled-components"
|
|
426
|
+
const Se = require("styled-components");
|
|
427
|
+
var we = e.n(Se);
|
|
428
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/Clickable"
|
|
429
|
+
const ke = require("@splunk/react-ui/Clickable");
|
|
430
|
+
var Ce = e.n(ke);
|
|
431
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/Switch"
|
|
432
|
+
const xe = require("@splunk/react-ui/Switch");
|
|
433
|
+
var Ie = e.n(xe);
|
|
434
|
+
// CONCATENATED MODULE: ./src/Menu/ItemStyles.ts
|
|
435
|
+
var _e = (0, Se.css)([ "color:", ";font-size:", ";line-height:", ";overflow:inherit;white-space:inherit;text-overflow:inherit;" ], (0,
|
|
436
|
+
U.pick)({
|
|
437
|
+
prisma: U.variables.contentColorDefault,
|
|
438
|
+
enterprise: U.variables.textGray
|
|
439
|
+
}), U.variables.fontSizeSmall, (0, U.pick)({
|
|
440
|
+
prisma: "16px"
|
|
441
|
+
}));
|
|
442
|
+
var Ae = we().span.withConfig({
|
|
443
|
+
displayName: "ItemStyles__StyledItemDescriptionBottom",
|
|
444
|
+
componentId: "sc-4kc053-0"
|
|
445
|
+
})([ "", ";display:block;" ], _e);
|
|
446
|
+
var je = we().span.withConfig({
|
|
447
|
+
displayName: "ItemStyles__StyledItemDescriptionRight",
|
|
448
|
+
componentId: "sc-4kc053-1"
|
|
449
|
+
})([ "", ";float:right;padding-left:", ";max-width:50%;text-align:right;box-sizing:border-box;" ], _e, U.variables.spacing);
|
|
450
|
+
var Ee = we().div.withConfig({
|
|
451
|
+
displayName: "ItemStyles__StyledItemSelectedIcon",
|
|
452
|
+
componentId: "sc-4kc053-2"
|
|
453
|
+
})([ "position:absolute;", " color:", ";" ], (0, U.pick)({
|
|
454
|
+
prisma: (0, Se.css)([ "right:16px;" ]),
|
|
455
|
+
enterprise: (0, Se.css)([ "top:5px;right:3px;left:8px;" ])
|
|
456
|
+
}), (0, U.pick)({
|
|
457
|
+
prisma: U.variables.contentColorActive,
|
|
458
|
+
enterprise: U.variables.accentColorL10
|
|
459
|
+
}));
|
|
460
|
+
var Me = we().span.withConfig({
|
|
461
|
+
displayName: "ItemStyles__StyledItemIcon",
|
|
462
|
+
componentId: "sc-4kc053-3"
|
|
463
|
+
})([ "flex:0 0 auto;padding-right:", ";min-width:10px;display:inline-block;text-align:center;vertical-align:", ";", "" ], (0,
|
|
464
|
+
U.pick)({
|
|
465
|
+
prisma: "8px",
|
|
466
|
+
enterprise: "3px"
|
|
467
|
+
}), (0, U.pick)({
|
|
468
|
+
prisma: "initial",
|
|
469
|
+
enterprise: "middle"
|
|
470
|
+
}), (0, U.pick)({
|
|
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
|
+
enterprise: (0, Se.css)([ "transform:translateY(-1px);" ])
|
|
473
|
+
}));
|
|
474
|
+
var Te = we()(Ce()).withConfig({
|
|
475
|
+
displayName: "ItemStyles__StyledClickable",
|
|
476
|
+
componentId: "sc-4kc053-4"
|
|
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,
|
|
478
|
+
U.pick)({
|
|
479
|
+
prisma: U.variables.contentColorActive,
|
|
480
|
+
enterprise: {
|
|
481
|
+
dark: U.variables.gray96,
|
|
482
|
+
light: U.variables.gray22
|
|
720
483
|
}
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
appendChild: function appendChild() {
|
|
737
|
-
return [];
|
|
738
|
-
}
|
|
739
|
-
},
|
|
740
|
-
addEventListener: function addEventListener() {},
|
|
741
|
-
removeEventListener: function removeEventListener() {},
|
|
742
|
-
activeElement: {
|
|
743
|
-
blur: function blur() {},
|
|
744
|
-
nodeName: ''
|
|
745
|
-
},
|
|
746
|
-
querySelector: function querySelector() {
|
|
747
|
-
return null;
|
|
748
|
-
},
|
|
749
|
-
querySelectorAll: function querySelectorAll() {
|
|
750
|
-
return [];
|
|
751
|
-
},
|
|
752
|
-
getElementById: function getElementById() {
|
|
753
|
-
return null;
|
|
754
|
-
},
|
|
755
|
-
createEvent: function createEvent() {
|
|
756
|
-
return {
|
|
757
|
-
initEvent: function initEvent() {}
|
|
758
|
-
};
|
|
759
|
-
},
|
|
760
|
-
createElement: function createElement() {
|
|
761
|
-
return {
|
|
762
|
-
children: [],
|
|
763
|
-
childNodes: [],
|
|
764
|
-
style: {},
|
|
765
|
-
setAttribute: function setAttribute() {},
|
|
766
|
-
getElementsByTagName: function getElementsByTagName() {
|
|
767
|
-
return [];
|
|
768
|
-
}
|
|
769
|
-
};
|
|
770
|
-
},
|
|
771
|
-
createElementNS: function createElementNS() {
|
|
772
|
-
return {};
|
|
773
|
-
},
|
|
774
|
-
importNode: function importNode() {
|
|
775
|
-
return null;
|
|
776
|
-
},
|
|
777
|
-
location: {
|
|
778
|
-
hash: '',
|
|
779
|
-
host: '',
|
|
780
|
-
hostname: '',
|
|
781
|
-
href: '',
|
|
782
|
-
origin: '',
|
|
783
|
-
pathname: '',
|
|
784
|
-
protocol: '',
|
|
785
|
-
search: ''
|
|
786
|
-
}
|
|
787
|
-
};
|
|
788
|
-
|
|
789
|
-
function getDocument() {
|
|
790
|
-
var doc = typeof document !== 'undefined' ? document : ssrDocument;
|
|
791
|
-
return doc;
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
;// CONCATENATED MODULE: ./src/utils/ssrWindow.ts
|
|
796
|
-
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
797
|
-
|
|
798
|
-
var ssrWindow = {
|
|
799
|
-
document: ssrDocument,
|
|
800
|
-
navigator: {
|
|
801
|
-
userAgent: ''
|
|
802
|
-
},
|
|
803
|
-
location: {
|
|
804
|
-
hash: '',
|
|
805
|
-
host: '',
|
|
806
|
-
hostname: '',
|
|
807
|
-
href: '',
|
|
808
|
-
origin: '',
|
|
809
|
-
pathname: '',
|
|
810
|
-
protocol: '',
|
|
811
|
-
search: ''
|
|
812
|
-
},
|
|
813
|
-
history: {
|
|
814
|
-
replaceState: function replaceState() {},
|
|
815
|
-
pushState: function pushState() {},
|
|
816
|
-
go: function go() {},
|
|
817
|
-
back: function back() {}
|
|
818
|
-
},
|
|
819
|
-
CustomEvent: function CustomEvent() {
|
|
820
|
-
return this;
|
|
821
|
-
},
|
|
822
|
-
addEventListener: function addEventListener() {},
|
|
823
|
-
removeEventListener: function removeEventListener() {},
|
|
824
|
-
getComputedStyle: function getComputedStyle() {
|
|
825
|
-
return {
|
|
826
|
-
getPropertyValue: function getPropertyValue() {
|
|
827
|
-
return '';
|
|
828
|
-
}
|
|
829
|
-
};
|
|
830
|
-
},
|
|
831
|
-
Image: function Image() {},
|
|
832
|
-
Date: function Date() {},
|
|
833
|
-
screen: {},
|
|
834
|
-
setTimeout: function setTimeout() {},
|
|
835
|
-
clearTimeout: function clearTimeout() {},
|
|
836
|
-
matchMedia: function matchMedia() {
|
|
837
|
-
return {};
|
|
838
|
-
},
|
|
839
|
-
requestAnimationFrame: function requestAnimationFrame(callback) {
|
|
840
|
-
if (typeof setTimeout === 'undefined') {
|
|
841
|
-
callback();
|
|
842
|
-
return null;
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
return setTimeout(callback, 0);
|
|
846
|
-
},
|
|
847
|
-
cancelAnimationFrame: function cancelAnimationFrame(id) {
|
|
848
|
-
if (typeof setTimeout === 'undefined') {
|
|
849
|
-
return;
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
clearTimeout(id);
|
|
853
|
-
}
|
|
854
|
-
};
|
|
855
|
-
|
|
856
|
-
function getWindow() {
|
|
857
|
-
var win = typeof window !== 'undefined' ? window : ssrWindow;
|
|
858
|
-
return win;
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
;// CONCATENATED MODULE: ./src/Select/SelectBase.tsx
|
|
863
|
-
function SelectBase_extends() { SelectBase_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return SelectBase_extends.apply(this, arguments); }
|
|
864
|
-
|
|
865
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
866
|
-
|
|
867
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
868
|
-
|
|
869
|
-
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
870
|
-
|
|
871
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
872
|
-
|
|
873
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
874
|
-
|
|
875
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
876
|
-
|
|
877
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
878
|
-
|
|
879
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
|
880
|
-
|
|
881
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
882
|
-
|
|
883
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
884
|
-
|
|
885
|
-
function SelectBase_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
886
|
-
|
|
887
|
-
function SelectBase_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
888
|
-
|
|
889
|
-
function SelectBase_createClass(Constructor, protoProps, staticProps) { if (protoProps) SelectBase_defineProperties(Constructor.prototype, protoProps); if (staticProps) SelectBase_defineProperties(Constructor, staticProps); return Constructor; }
|
|
890
|
-
|
|
891
|
-
function SelectBase_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) SelectBase_setPrototypeOf(subClass, superClass); }
|
|
892
|
-
|
|
893
|
-
function SelectBase_setPrototypeOf(o, p) { SelectBase_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return SelectBase_setPrototypeOf(o, p); }
|
|
894
|
-
|
|
895
|
-
function SelectBase_createSuper(Derived) { var hasNativeReflectConstruct = SelectBase_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = SelectBase_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = SelectBase_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return SelectBase_possibleConstructorReturn(this, result); }; }
|
|
896
|
-
|
|
897
|
-
function SelectBase_possibleConstructorReturn(self, call) { if (call && (SelectBase_typeof(call) === "object" || typeof call === "function")) { return call; } return SelectBase_assertThisInitialized(self); }
|
|
898
|
-
|
|
899
|
-
function SelectBase_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
900
|
-
|
|
901
|
-
function SelectBase_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
902
|
-
|
|
903
|
-
function SelectBase_getPrototypeOf(o) { SelectBase_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return SelectBase_getPrototypeOf(o); }
|
|
904
|
-
|
|
905
|
-
function SelectBase_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { SelectBase_typeof = function _typeof(obj) { return typeof obj; }; } else { SelectBase_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return SelectBase_typeof(obj); }
|
|
906
|
-
|
|
907
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
908
|
-
|
|
909
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { SelectBase_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
910
|
-
|
|
911
|
-
function SelectBase_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
var SelectBase_propTypes = {
|
|
944
|
-
allowKeyMatching: (external_prop_types_default()).bool,
|
|
945
|
-
allowNewValues: (external_prop_types_default()).bool,
|
|
946
|
-
animateLoading: (external_prop_types_default()).bool,
|
|
947
|
-
appearance: external_prop_types_default().oneOf(['default', 'link', 'primary', 'pill', 'toggle', 'flat']),
|
|
948
|
-
append: (external_prop_types_default()).bool,
|
|
949
|
-
children: (external_prop_types_default()).node,
|
|
950
|
-
defaultPlacement: external_prop_types_default().oneOf(['above', 'below', 'vertical']),
|
|
951
|
-
defaultValues: (external_prop_types_default()).array,
|
|
952
|
-
describedBy: (external_prop_types_default()).string,
|
|
953
|
-
disabled: (external_prop_types_default()).bool,
|
|
954
|
-
elementRef: external_prop_types_default().oneOfType([(external_prop_types_default()).func, (external_prop_types_default()).object]),
|
|
955
|
-
error: (external_prop_types_default()).bool,
|
|
956
|
-
filter: external_prop_types_default().oneOf([false, true, 'controlled']),
|
|
957
|
-
footerMessage: (external_prop_types_default()).node,
|
|
958
|
-
inline: (external_prop_types_default()).bool,
|
|
959
|
-
inputId: (external_prop_types_default()).string,
|
|
960
|
-
inputRef: external_prop_types_default().oneOfType([(external_prop_types_default()).func, (external_prop_types_default()).object]),
|
|
961
|
-
isLoadingOptions: (external_prop_types_default()).bool,
|
|
962
|
-
labelledBy: (external_prop_types_default()).string,
|
|
963
|
-
labelText: (external_prop_types_default()).string,
|
|
964
|
-
loadingMessage: (external_prop_types_default()).node,
|
|
965
|
-
menuStyle: (external_prop_types_default()).object,
|
|
966
|
-
multiple: (external_prop_types_default()).bool,
|
|
967
|
-
name: (external_prop_types_default()).string,
|
|
968
|
-
noOptionsMessage: (external_prop_types_default()).node,
|
|
969
|
-
onChange: (external_prop_types_default()).func,
|
|
970
|
-
onClose: (external_prop_types_default()).func,
|
|
971
|
-
onFilterChange: (external_prop_types_default()).func,
|
|
972
|
-
onOpen: (external_prop_types_default()).func,
|
|
973
|
-
onScroll: (external_prop_types_default()).func,
|
|
974
|
-
onScrollBottom: (external_prop_types_default()).func,
|
|
975
|
-
|
|
976
|
-
/** @private. */
|
|
977
|
-
required: (external_prop_types_default()).bool,
|
|
978
|
-
placeholder: (external_prop_types_default()).string,
|
|
979
|
-
prefixLabel: (external_prop_types_default()).string,
|
|
980
|
-
prepend: (external_prop_types_default()).bool,
|
|
981
|
-
repositionMode: external_prop_types_default().oneOf(['none', 'flip']),
|
|
982
|
-
selectAllAppearance: external_prop_types_default().oneOf(['buttongroup', 'checkbox']),
|
|
983
|
-
showSelectedValuesFirst: external_prop_types_default().oneOf(['nextOpen', 'immediately', 'never']),
|
|
984
|
-
suffixLabel: (external_prop_types_default()).string,
|
|
985
|
-
tabConfirmsNewValue: (external_prop_types_default()).bool,
|
|
986
|
-
values: (external_prop_types_default()).array
|
|
987
|
-
};
|
|
988
|
-
var SelectBase_defaultProps = {
|
|
989
|
-
allowKeyMatching: true,
|
|
990
|
-
allowNewValues: false,
|
|
991
|
-
animateLoading: false,
|
|
992
|
-
appearance: 'toggle',
|
|
993
|
-
append: false,
|
|
994
|
-
defaultPlacement: 'vertical',
|
|
995
|
-
disabled: false,
|
|
996
|
-
filter: false,
|
|
997
|
-
inline: false,
|
|
998
|
-
isLoadingOptions: false,
|
|
999
|
-
menuStyle: {},
|
|
1000
|
-
multiple: false,
|
|
1001
|
-
noOptionsMessage: (0,i18n_namespaceObject._)('No matches'),
|
|
1002
|
-
placeholder: (0,i18n_namespaceObject._)('Select...'),
|
|
1003
|
-
prepend: false,
|
|
1004
|
-
repositionMode: 'flip',
|
|
1005
|
-
selectAllAppearance: 'buttongroup',
|
|
1006
|
-
tabConfirmsNewValue: false
|
|
1007
|
-
};
|
|
1008
|
-
var getLabelFromPlaceholder = memoize_default()(function (placeholder) {
|
|
1009
|
-
return [placeholder];
|
|
1010
|
-
}); // preserve separate widths for single vs. multi mode
|
|
1011
|
-
|
|
1012
|
-
var getInlineMenuStyle = memoize_default()(function (_ref) {
|
|
1013
|
-
var anchorWidth = _ref.anchorWidth,
|
|
1014
|
-
isMultiple = _ref.isMultiple,
|
|
1015
|
-
menuStyle = _ref.menuStyle;
|
|
1016
|
-
return isMultiple ? _objectSpread({
|
|
1017
|
-
width: Math.max(anchorWidth !== null && anchorWidth !== void 0 ? anchorWidth : 0, 200)
|
|
1018
|
-
}, menuStyle) : _objectSpread({
|
|
1019
|
-
minWidth: anchorWidth !== null && anchorWidth !== void 0 ? anchorWidth : undefined,
|
|
1020
|
-
maxWidth: Math.max(anchorWidth !== null && anchorWidth !== void 0 ? anchorWidth : 0, 300)
|
|
1021
|
-
}, menuStyle);
|
|
1022
|
-
});
|
|
1023
|
-
var dropdownCloseReasons = ['clickAway', 'escapeKey', 'offScreen', 'tabKey', 'toggleClick'];
|
|
1024
|
-
|
|
1025
|
-
function isOption(child) {
|
|
1026
|
-
return child && has_default()(child.props, 'value');
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1029
|
-
function itemKeyFromValueLabel(value, label) {
|
|
1030
|
-
return "".concat(SelectBase_typeof(value), "-").concat(value, "-").concat(label);
|
|
1031
|
-
}
|
|
1032
|
-
|
|
1033
|
-
var SelectBase = /*#__PURE__*/function (_Component) {
|
|
1034
|
-
SelectBase_inherits(SelectBase, _Component);
|
|
1035
|
-
|
|
1036
|
-
var _super = SelectBase_createSuper(SelectBase);
|
|
1037
|
-
|
|
1038
|
-
SelectBase_createClass(SelectBase, null, [{
|
|
1039
|
-
key: "validateAppearance",
|
|
1040
|
-
// @docs-props-type CompactPropsBase
|
|
1041
|
-
value: function validateAppearance(props) {
|
|
1042
|
-
if (false) {}
|
|
1043
|
-
}
|
|
1044
|
-
}]);
|
|
1045
|
-
|
|
1046
|
-
function SelectBase(props) {
|
|
1047
|
-
var _this;
|
|
1048
|
-
|
|
1049
|
-
SelectBase_classCallCheck(this, SelectBase);
|
|
1050
|
-
|
|
1051
|
-
_this = _super.call(this, props);
|
|
1052
|
-
|
|
1053
|
-
SelectBase_defineProperty(SelectBase_assertThisInitialized(_this), "activeItemId", void 0);
|
|
1054
|
-
|
|
1055
|
-
SelectBase_defineProperty(SelectBase_assertThisInitialized(_this), "activeValue", void 0);
|
|
1056
|
-
|
|
1057
|
-
SelectBase_defineProperty(SelectBase_assertThisInitialized(_this), "availableOptionCount", void 0);
|
|
1058
|
-
|
|
1059
|
-
SelectBase_defineProperty(SelectBase_assertThisInitialized(_this), "controlledExternally", void 0);
|
|
1060
|
-
|
|
1061
|
-
SelectBase_defineProperty(SelectBase_assertThisInitialized(_this), "displayedValues", void 0);
|
|
1062
|
-
|
|
1063
|
-
SelectBase_defineProperty(SelectBase_assertThisInitialized(_this), "dropdown", null);
|
|
1064
|
-
|
|
1065
|
-
SelectBase_defineProperty(SelectBase_assertThisInitialized(_this), "firstSelectedEnabledOption", null);
|
|
1066
|
-
|
|
1067
|
-
SelectBase_defineProperty(SelectBase_assertThisInitialized(_this), "firstSelectedOptionIndex", void 0);
|
|
1068
|
-
|
|
1069
|
-
SelectBase_defineProperty(SelectBase_assertThisInitialized(_this), "menuId", void 0);
|
|
1070
|
-
|
|
1071
|
-
SelectBase_defineProperty(SelectBase_assertThisInitialized(_this), "previousActiveIndex", null);
|
|
1072
|
-
|
|
1073
|
-
SelectBase_defineProperty(SelectBase_assertThisInitialized(_this), "selectedOptionCount", void 0);
|
|
1074
|
-
|
|
1075
|
-
SelectBase_defineProperty(SelectBase_assertThisInitialized(_this), "optionRefsByKey", void 0);
|
|
1076
|
-
|
|
1077
|
-
SelectBase_defineProperty(SelectBase_assertThisInitialized(_this), "matchCharacter", void 0);
|
|
1078
|
-
|
|
1079
|
-
SelectBase_defineProperty(SelectBase_assertThisInitialized(_this), "matchTimeout", void 0);
|
|
1080
|
-
|
|
1081
|
-
SelectBase_defineProperty(SelectBase_assertThisInitialized(_this), "currentMatchOptions", void 0);
|
|
1082
|
-
|
|
1083
|
-
SelectBase_defineProperty(SelectBase_assertThisInitialized(_this), "availableMatchOptions", void 0);
|
|
1084
|
-
|
|
1085
|
-
SelectBase_defineProperty(SelectBase_assertThisInitialized(_this), "optionSelection", void 0);
|
|
1086
|
-
|
|
1087
|
-
SelectBase_defineProperty(SelectBase_assertThisInitialized(_this), "resetMatches", function () {
|
|
1088
|
-
_this.matchCharacter = null;
|
|
1089
|
-
_this.currentMatchOptions = [];
|
|
1090
|
-
|
|
1091
|
-
if (_this.matchTimeout) {
|
|
1092
|
-
clearTimeout(_this.matchTimeout);
|
|
1093
|
-
}
|
|
1094
|
-
});
|
|
1095
|
-
|
|
1096
|
-
SelectBase_defineProperty(SelectBase_assertThisInitialized(_this), "handleSelectAll", function (e) {
|
|
1097
|
-
var _this$getCurrentValue, _this$props$onChange, _this$props2;
|
|
1098
|
-
|
|
1099
|
-
var _this$props = _this.props,
|
|
1100
|
-
name = _this$props.name,
|
|
1101
|
-
children = _this$props.children,
|
|
1102
|
-
multiple = _this$props.multiple; // this doesn't make sense if we can't select multiple values
|
|
1103
|
-
|
|
1104
|
-
if (!multiple) {
|
|
1105
|
-
return;
|
|
1106
|
-
}
|
|
1107
|
-
|
|
1108
|
-
var currentValues = (_this$getCurrentValue = _this.getCurrentValues()) !== null && _this$getCurrentValue !== void 0 ? _this$getCurrentValue : [];
|
|
1109
|
-
var values = uniq_default()(currentValues.concat(_this.displayedValues));
|
|
1110
|
-
values = external_react_default().Children.toArray(children).filter(function (child) {
|
|
1111
|
-
return isOption(child) && includes_default()(values, child.props.value) && (!child.props.disabled || includes_default()(currentValues, child.props.value));
|
|
1112
|
-
}).map(function (child) {
|
|
1113
|
-
return child.props.value;
|
|
1114
|
-
});
|
|
1115
|
-
|
|
1116
|
-
if (!_this.isControlled()) {
|
|
1117
|
-
_this.setState({
|
|
1118
|
-
values: values
|
|
484
|
+
}), (0, U.pick)({
|
|
485
|
+
prisma: {
|
|
486
|
+
comfortable: "10px 16px",
|
|
487
|
+
compact: "6px 16px"
|
|
488
|
+
},
|
|
489
|
+
enterprise: "6px 10px"
|
|
490
|
+
}), (function(e) {
|
|
491
|
+
var t = e.$isSelectable, n = e.$selectableAppearance;
|
|
492
|
+
return t && (0, U.pick)({
|
|
493
|
+
prisma: (0, Se.css)([ "padding-right:44px;", "" ], (function() {
|
|
494
|
+
return n === "checkbox" && "padding-left: 42px;";
|
|
495
|
+
})),
|
|
496
|
+
enterprise: (0, Se.css)([ "padding-right:10px;padding-left:", ";" ], (function() {
|
|
497
|
+
return n === "checkbox" ? "32px" : "28px";
|
|
498
|
+
}))
|
|
1119
499
|
});
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
}
|
|
1140
|
-
|
|
1141
|
-
var currentValues = (_this$getCurrentValue2 = _this.getCurrentValues()) !== null && _this$getCurrentValue2 !== void 0 ? _this$getCurrentValue2 : [];
|
|
1142
|
-
var hiddenCurrentValues = without_default().apply(void 0, [currentValues].concat(_toConsumableArray(_this.displayedValues))); // this will unselect all selected values unless those values are disabled or hidden by the filter
|
|
1143
|
-
|
|
1144
|
-
var values = external_react_default().Children.toArray(children).filter(function (child) {
|
|
1145
|
-
return isOption(child) && (includes_default()(currentValues, child.props.value) && child.props.disabled || includes_default()(hiddenCurrentValues, child.props.value));
|
|
1146
|
-
}).map(function (child) {
|
|
1147
|
-
return child.props.value;
|
|
1148
|
-
});
|
|
1149
|
-
|
|
1150
|
-
if (!_this.isControlled()) {
|
|
1151
|
-
_this.setState({
|
|
1152
|
-
values: values
|
|
500
|
+
}), (function(e) {
|
|
501
|
+
var t = e.$active, n = e.$preventFocus;
|
|
502
|
+
return t && !n && (0, Se.css)([ "box-shadow:", ";" ], U.variables.focusShadowInset);
|
|
503
|
+
}), (function(e) {
|
|
504
|
+
var t = e.$active;
|
|
505
|
+
return t && (0, Se.css)([ "background:", ";font-weight:", ";" ], (0, U.pick)({
|
|
506
|
+
enterprise: {
|
|
507
|
+
light: U.variables.gray92,
|
|
508
|
+
dark: U.variables.gray22
|
|
509
|
+
},
|
|
510
|
+
prisma: U.variables.neutral100
|
|
511
|
+
}), U.variables.fontWeightBold);
|
|
512
|
+
}), (0, U.pick)({
|
|
513
|
+
prisma: U.variables.interactiveColorOverlayHover,
|
|
514
|
+
enterprise: U.variables.backgroundColorHover
|
|
515
|
+
}), (function(e) {
|
|
516
|
+
var t = e.$selected;
|
|
517
|
+
return t && (0, U.pick)({
|
|
518
|
+
prisma: (0, Se.css)([ "background:", ";" ], U.mixins.overlayColors(U.variables.interactiveColorOverlaySelected, U.variables.interactiveColorOverlayHover))
|
|
1153
519
|
});
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
520
|
+
}), U.variables.focusShadowInset, (0, U.pick)({
|
|
521
|
+
prisma: (0, Se.css)([ "background:", ";" ], U.variables.interactiveColorOverlayHover)
|
|
522
|
+
}), (0, U.pick)({
|
|
523
|
+
prisma: (0, Se.css)([ "&:active{background:", ";}" ], U.variables.interactiveColorOverlayActive)
|
|
524
|
+
}), (function(e) {
|
|
525
|
+
var t = e.$selected;
|
|
526
|
+
return t && (0, U.pick)({
|
|
527
|
+
prisma: (0, Se.css)([ "background:", ";&:active{background:", ";}" ], U.variables.interactiveColorOverlaySelected, U.mixins.overlayColors(U.variables.interactiveColorOverlaySelected, U.variables.interactiveColorOverlayActive))
|
|
528
|
+
});
|
|
529
|
+
}), (0, U.pick)({
|
|
530
|
+
enterprise: {
|
|
531
|
+
light: U.variables.gray45,
|
|
532
|
+
dark: U.variables.contentColorDisabled
|
|
533
|
+
},
|
|
534
|
+
prisma: U.variables.contentColorDisabled
|
|
535
|
+
}),
|
|
536
|
+
/* sc-sel */
|
|
537
|
+
Ae,
|
|
538
|
+
/* sc-sel */
|
|
539
|
+
je,
|
|
540
|
+
/* sc-sel */
|
|
541
|
+
Ee, (0, U.pick)({
|
|
542
|
+
prisma: U.variables.contentColorDisabled,
|
|
543
|
+
enterprise: U.variables.gray80
|
|
544
|
+
}), (0, U.pick)({
|
|
545
|
+
prisma: (0, Se.css)([ "& > * > ", "{color:", ";}" ],
|
|
546
|
+
/* sc-sel */
|
|
547
|
+
Me, U.variables.contentColorDisabled)
|
|
548
|
+
}), (function(e) {
|
|
549
|
+
var t = e.$selected;
|
|
550
|
+
return t && (0, U.pick)({
|
|
551
|
+
prisma: (0, Se.css)([ "", "{color:", ";}" ],
|
|
552
|
+
/* sc-sel */
|
|
553
|
+
Me, U.variables.contentColorActive)
|
|
554
|
+
});
|
|
555
|
+
}));
|
|
556
|
+
var Pe = we()(Ie()).withConfig({
|
|
557
|
+
displayName: "ItemStyles__StyledSwitch",
|
|
558
|
+
componentId: "sc-4kc053-5"
|
|
559
|
+
})([ "position:absolute;left:", ";top:", ";" ], (0, U.pick)({
|
|
560
|
+
prisma: "16px",
|
|
561
|
+
enterprise: "8px"
|
|
562
|
+
}), (0, U.pick)({
|
|
563
|
+
prisma: "0px",
|
|
564
|
+
enterprise: {
|
|
565
|
+
comfortable: "-1px",
|
|
566
|
+
compact: "2px"
|
|
1175
567
|
}
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
568
|
+
}));
|
|
569
|
+
var Ve = we().span.withConfig({
|
|
570
|
+
displayName: "ItemStyles__StyledInnerWrapper",
|
|
571
|
+
componentId: "sc-4kc053-6"
|
|
572
|
+
})([ "display:flex;align-items:flex-start;" ]);
|
|
573
|
+
var Re = we().span.withConfig({
|
|
574
|
+
displayName: "ItemStyles__StyledTitleAndDescriptionWrapper",
|
|
575
|
+
componentId: "sc-4kc053-7"
|
|
576
|
+
})([ "max-width:100%;width:100%;align-self:center;word-break:break-word;white-space:normal;", "" ], (function(e) {
|
|
577
|
+
var t = e.$truncate;
|
|
578
|
+
return t && (0, Se.css)([ "white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" ]);
|
|
579
|
+
}));
|
|
580
|
+
var De = we().div.withConfig({
|
|
581
|
+
displayName: "ItemStyles__StyledLabel",
|
|
582
|
+
componentId: "sc-4kc053-8"
|
|
583
|
+
})([ "overflow:inherit;white-space:inherit;text-overflow:inherit;max-width:100%;min-height:20px;", "" ], (function(e) {
|
|
584
|
+
var t = e.$truncate;
|
|
585
|
+
return t && (0, Se.css)([ "display:block;clear:both;" ]);
|
|
586
|
+
}));
|
|
587
|
+
var qe = we().span.withConfig({
|
|
588
|
+
displayName: "ItemStyles__StyledMatch",
|
|
589
|
+
componentId: "sc-4kc053-9"
|
|
590
|
+
})([ "border-bottom:1px solid ", ";" ], (0, U.pick)({
|
|
591
|
+
prisma: U.variables.contentColorActive,
|
|
592
|
+
enterprise: {
|
|
593
|
+
dark: U.variables.gray96,
|
|
594
|
+
light: U.variables.gray45
|
|
1186
595
|
}
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
596
|
+
}));
|
|
597
|
+
var Le = we().span.withConfig({
|
|
598
|
+
displayName: "ItemStyles__StyledSubmenu",
|
|
599
|
+
componentId: "sc-4kc053-10"
|
|
600
|
+
})([ "float:right;padding-left:", ";color:", ";" ], U.variables.spacingSmall, (0,
|
|
601
|
+
U.pick)({
|
|
602
|
+
prisma: "inherit",
|
|
603
|
+
enterprise: U.variables.textGray
|
|
604
|
+
}));
|
|
605
|
+
// CONCATENATED MODULE: ./src/Select/SelectAllOptionStyles.ts
|
|
606
|
+
var Ne = we()(De).withConfig({
|
|
607
|
+
displayName: "SelectAllOptionStyles__StyledSelectAllLabel",
|
|
608
|
+
componentId: "y6bn08-0"
|
|
609
|
+
})([ "font-weight:", ";" ], U.variables.fontWeightBold);
|
|
610
|
+
var Be = we()(Oe).withConfig({
|
|
611
|
+
displayName: "SelectAllOptionStyles__StyledSelectAllOption",
|
|
612
|
+
componentId: "y6bn08-1"
|
|
613
|
+
})([ "padding-inline-start:", ";box-shadow:none;" ], (0, U.pick)({
|
|
614
|
+
prisma: "42px;",
|
|
615
|
+
enterprise: "32px;"
|
|
616
|
+
}));
|
|
617
|
+
// CONCATENATED MODULE: ./src/Select/SelectAllOption.tsx
|
|
618
|
+
var Ke = {
|
|
619
|
+
active: a().bool,
|
|
620
|
+
elementRef: a().oneOfType([ a().func, a().object ]),
|
|
621
|
+
id: a().string,
|
|
622
|
+
onClick: a().func,
|
|
623
|
+
selectAllLabel: a().string,
|
|
624
|
+
totalCount: a().number,
|
|
625
|
+
changedToggle: a().bool,
|
|
626
|
+
selected: a().oneOf([ false, true, "some" ])
|
|
627
|
+
};
|
|
628
|
+
var Fe = r().forwardRef((function(e, t) {
|
|
629
|
+
var n = e.active, o = e.id, a = e.onClick, i = e.selectAllLabel, l = e.totalCount, s = e.changedToggle, u = e.selected;
|
|
630
|
+
// When toggle is changed the total count is not displayed anymore so the count is now shown in the Select All menu item
|
|
631
|
+
var p = s ? " (".concat(l === null || l === void 0 ? void 0 : l.toString(), ")") : "";
|
|
632
|
+
|
|
633
|
+
return r().createElement(Be, {
|
|
634
|
+
label: i,
|
|
635
|
+
value: "selectAll",
|
|
636
|
+
key: "selectAll",
|
|
637
|
+
onClick: a,
|
|
638
|
+
"data-test": "select-all",
|
|
639
|
+
"aria-keyshortcuts": "Control+A",
|
|
640
|
+
id: o,
|
|
641
|
+
active: n,
|
|
642
|
+
ref: t,
|
|
643
|
+
tabIndex: -1
|
|
644
|
+
}, r().createElement(Pe, {
|
|
645
|
+
interactive: false,
|
|
646
|
+
selected: u === "some" && "some" || u,
|
|
647
|
+
key: "main-checkbox",
|
|
648
|
+
value: "main-checkbox",
|
|
649
|
+
appearance: "checkbox",
|
|
650
|
+
"aria-label": !u && (0, c._)("No options selected") || u === "some" && (0, c._)("Some options selected") || (0,
|
|
651
|
+
c._)("All options selected"),
|
|
652
|
+
"data-test": "select-all-switch",
|
|
653
|
+
selectedLabel: u === true ? (0, c._)("All options selected") : (0, c._)("Option selected"),
|
|
654
|
+
unselectedLabel: u === true ? (0, c._)("No options selected") : (0, c._)("Option unselected"),
|
|
655
|
+
someSelectedLabel: (0, c._)("Some options selected")
|
|
656
|
+
}), r().createElement(je, {
|
|
657
|
+
"data-test": "description"
|
|
658
|
+
}, "".concat(p, " Ctrl-a")), r().createElement(Ve, null, r().createElement(Re, {
|
|
659
|
+
$truncate: false
|
|
660
|
+
}, r().createElement(Ne, {
|
|
661
|
+
$truncate: false
|
|
662
|
+
}, i))));
|
|
663
|
+
}));
|
|
664
|
+
Fe.propTypes = Ke;
|
|
665
|
+
/* harmony default export */ const $e = Fe;
|
|
666
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/Button"
|
|
667
|
+
const He = require("@splunk/react-ui/Button");
|
|
668
|
+
var We = e.n(He);
|
|
669
|
+
// CONCATENATED MODULE: ./src/Select/SelectBaseStyles.ts
|
|
670
|
+
var ze = we()(We()).withConfig({
|
|
671
|
+
displayName: "SelectBaseStyles__StyledButton",
|
|
672
|
+
componentId: "sc-16cj7sk-0"
|
|
673
|
+
})([ "&[data-inline]{width:", ";}", "" ], (function(e) {
|
|
674
|
+
var t = e.$multiple;
|
|
675
|
+
return t ? "400px" : "auto";
|
|
676
|
+
}), (function(e) {
|
|
677
|
+
var t = e.$multiple;
|
|
678
|
+
return !t && "flex-grow: 0;";
|
|
679
|
+
}));
|
|
680
|
+
var Ue = we().span.withConfig({
|
|
681
|
+
displayName: "SelectBaseStyles__StyledLinkIcon",
|
|
682
|
+
componentId: "sc-16cj7sk-1"
|
|
683
|
+
})([ "padding-right:2px;" ]);
|
|
684
|
+
var Ge = we().span.withConfig({
|
|
685
|
+
displayName: "SelectBaseStyles__StyledLinkCaret",
|
|
686
|
+
componentId: "sc-16cj7sk-2"
|
|
687
|
+
})([ "padding-left:2px;" ]);
|
|
688
|
+
var Je = we().div.withConfig({
|
|
689
|
+
displayName: "SelectBaseStyles__StyledFilter",
|
|
690
|
+
componentId: "sc-16cj7sk-3"
|
|
691
|
+
})([ "padding:", ";min-width:160px;" ], (0, U.pick)({
|
|
692
|
+
enterprise: "8px",
|
|
693
|
+
prisma: "10px 16px"
|
|
694
|
+
}));
|
|
695
|
+
var Qe = we().span.withConfig({
|
|
696
|
+
displayName: "SelectBaseStyles__StyledSearchIconWrapper",
|
|
697
|
+
componentId: "sc-16cj7sk-4"
|
|
698
|
+
})([ "color:", ";pointer-events:none;padding:", ";" ], (0, U.pick)({
|
|
699
|
+
enterprise: {
|
|
700
|
+
light: U.variables.gray60,
|
|
701
|
+
dark: U.variables.white
|
|
702
|
+
},
|
|
703
|
+
prisma: U.variables.contentColorMuted
|
|
704
|
+
}), (0, U.pick)({
|
|
705
|
+
comfortable: "0 8px",
|
|
706
|
+
compact: "0 6px"
|
|
707
|
+
}));
|
|
708
|
+
var Xe = we().span.withConfig({
|
|
709
|
+
displayName: "SelectBaseStyles__StyledCount",
|
|
710
|
+
componentId: "sc-16cj7sk-5"
|
|
711
|
+
})([ "padding-right:", ";" ], (0, U.pick)({
|
|
712
|
+
enterprise: U.variables.spacingQuarter,
|
|
713
|
+
prisma: U.variables.spacingXSmall
|
|
714
|
+
}));
|
|
715
|
+
var Ye = we()(L()).withConfig({
|
|
716
|
+
displayName: "SelectBaseStyles__StyledControlsLink",
|
|
717
|
+
componentId: "sc-16cj7sk-6"
|
|
718
|
+
})([ "margin-right:20px;", ";" ], (function(e) {
|
|
719
|
+
var t = e.$disabled;
|
|
720
|
+
return t && (0, Se.css)([ "color:", ";" ], U.variables.contentColorDisabled);
|
|
721
|
+
}));
|
|
722
|
+
var Ze = we().div.withConfig({
|
|
723
|
+
displayName: "SelectBaseStyles__StyledToggleAllControls",
|
|
724
|
+
componentId: "sc-16cj7sk-7"
|
|
725
|
+
})([ "padding:", ";", "" ], (0, U.pick)({
|
|
726
|
+
enterprise: "5px 8px",
|
|
727
|
+
prisma: "10px 16px"
|
|
728
|
+
}), (0, U.pickVariant)("$placement", {
|
|
729
|
+
above: {
|
|
730
|
+
enterprise: (0, Se.css)([ "border-top:", ";" ], U.variables.border),
|
|
731
|
+
prisma: (0, Se.css)([ "border-top:1px solid ", ";" ], U.variables.neutral200)
|
|
732
|
+
},
|
|
733
|
+
below: {
|
|
734
|
+
enterprise: (0, Se.css)([ "border-bottom:", ";" ], U.variables.border),
|
|
735
|
+
prisma: (0, Se.css)([ "border-bottom:1px solid ", ";" ], U.variables.neutral200)
|
|
1208
736
|
}
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
});
|
|
1219
|
-
}
|
|
1220
|
-
|
|
1221
|
-
if (eventKeyCode === 'enter' && !isUndefined_default()(_this.activeValue) && _this.state.open) {
|
|
1222
|
-
if (_this.activeValue === 'selectAll') {
|
|
1223
|
-
if (_this.optionSelection === 'all') {
|
|
1224
|
-
_this.handleClearAll(e);
|
|
1225
|
-
} else {
|
|
1226
|
-
_this.handleSelectAll(e);
|
|
1227
|
-
}
|
|
1228
|
-
} else {
|
|
1229
|
-
e.preventDefault();
|
|
1230
|
-
|
|
1231
|
-
_this.toggleValue(e, _this.activeValue);
|
|
737
|
+
}));
|
|
738
|
+
// CONCATENATED MODULE: ./src/utils/fuzzyMatch.ts
|
|
739
|
+
// A utility for matching keyboard characters to list values
|
|
740
|
+
var et = function e(t, n) {
|
|
741
|
+
return t ? t.label.charAt(n).toLowerCase() : "";
|
|
742
|
+
};
|
|
743
|
+
var tt = function e(t, n) {
|
|
744
|
+
if (!t.length) {
|
|
745
|
+
return t;
|
|
1232
746
|
}
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
747
|
+
var r = null;
|
|
748
|
+
var o = false;
|
|
749
|
+
var a = t.filter((function(e) {
|
|
750
|
+
var t = et(e, n.index);
|
|
751
|
+
if (t === n.value) {
|
|
752
|
+
o = true;
|
|
753
|
+
return true;
|
|
754
|
+
}
|
|
755
|
+
// If we haven't found a match yet, keep track of the next closest match.
|
|
756
|
+
// Secondary matching looks for the closest character of a higher value, and failing that, closest of a lower value.
|
|
757
|
+
if (!o) {
|
|
758
|
+
var a = et(r, n.index);
|
|
759
|
+
if (!a) {
|
|
760
|
+
r = e;
|
|
761
|
+
} else if (t > n.value) {
|
|
762
|
+
if (a < n.value) {
|
|
763
|
+
r = e;
|
|
764
|
+
} else if (a > t) {
|
|
765
|
+
r = e;
|
|
766
|
+
}
|
|
767
|
+
} else if (t > a) {
|
|
768
|
+
r = e;
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
return false;
|
|
772
|
+
}));
|
|
773
|
+
return a.length === 0 && r ? [ r ] : a;
|
|
774
|
+
};
|
|
775
|
+
// CONCATENATED MODULE: ./src/utils/ssrDocument.ts
|
|
776
|
+
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
777
|
+
var nt = {
|
|
778
|
+
body: {
|
|
779
|
+
appendChild: function e() {
|
|
780
|
+
return [];
|
|
781
|
+
}
|
|
782
|
+
},
|
|
783
|
+
addEventListener: function e() {},
|
|
784
|
+
removeEventListener: function e() {},
|
|
785
|
+
activeElement: {
|
|
786
|
+
blur: function e() {},
|
|
787
|
+
nodeName: ""
|
|
788
|
+
},
|
|
789
|
+
querySelector: function e() {
|
|
790
|
+
return null;
|
|
791
|
+
},
|
|
792
|
+
querySelectorAll: function e() {
|
|
793
|
+
return [];
|
|
794
|
+
},
|
|
795
|
+
getElementById: function e() {
|
|
796
|
+
return null;
|
|
797
|
+
},
|
|
798
|
+
createEvent: function e() {
|
|
799
|
+
return {
|
|
800
|
+
initEvent: function e() {}
|
|
801
|
+
};
|
|
802
|
+
},
|
|
803
|
+
createElement: function e() {
|
|
804
|
+
return {
|
|
805
|
+
children: [],
|
|
806
|
+
childNodes: [],
|
|
807
|
+
style: {},
|
|
808
|
+
setAttribute: function e() {},
|
|
809
|
+
getElementsByTagName: function e() {
|
|
810
|
+
return [];
|
|
811
|
+
}
|
|
812
|
+
};
|
|
813
|
+
},
|
|
814
|
+
createElementNS: function e() {
|
|
815
|
+
return {};
|
|
816
|
+
},
|
|
817
|
+
importNode: function e() {
|
|
818
|
+
return null;
|
|
819
|
+
},
|
|
820
|
+
location: {
|
|
821
|
+
hash: "",
|
|
822
|
+
host: "",
|
|
823
|
+
hostname: "",
|
|
824
|
+
href: "",
|
|
825
|
+
origin: "",
|
|
826
|
+
pathname: "",
|
|
827
|
+
protocol: "",
|
|
828
|
+
search: ""
|
|
1268
829
|
}
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
830
|
+
};
|
|
831
|
+
function rt() {
|
|
832
|
+
var e = typeof document !== "undefined" ? document : nt;
|
|
833
|
+
return e;
|
|
834
|
+
}
|
|
835
|
+
// CONCATENATED MODULE: ./src/utils/ssrWindow.ts
|
|
836
|
+
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
837
|
+
var ot = {
|
|
838
|
+
document: nt,
|
|
839
|
+
navigator: {
|
|
840
|
+
userAgent: ""
|
|
841
|
+
},
|
|
842
|
+
location: {
|
|
843
|
+
hash: "",
|
|
844
|
+
host: "",
|
|
845
|
+
hostname: "",
|
|
846
|
+
href: "",
|
|
847
|
+
origin: "",
|
|
848
|
+
pathname: "",
|
|
849
|
+
protocol: "",
|
|
850
|
+
search: ""
|
|
851
|
+
},
|
|
852
|
+
history: {
|
|
853
|
+
replaceState: function e() {},
|
|
854
|
+
pushState: function e() {},
|
|
855
|
+
go: function e() {},
|
|
856
|
+
back: function e() {}
|
|
857
|
+
},
|
|
858
|
+
CustomEvent: function e() {
|
|
859
|
+
return this;
|
|
860
|
+
},
|
|
861
|
+
addEventListener: function e() {},
|
|
862
|
+
removeEventListener: function e() {},
|
|
863
|
+
getComputedStyle: function e() {
|
|
864
|
+
return {
|
|
865
|
+
getPropertyValue: function e() {
|
|
866
|
+
return "";
|
|
867
|
+
}
|
|
868
|
+
};
|
|
869
|
+
},
|
|
870
|
+
Image: function e() {},
|
|
871
|
+
Date: function e() {},
|
|
872
|
+
screen: {},
|
|
873
|
+
setTimeout: function e() {},
|
|
874
|
+
clearTimeout: function e() {},
|
|
875
|
+
matchMedia: function e() {
|
|
876
|
+
return {};
|
|
877
|
+
},
|
|
878
|
+
requestAnimationFrame: function e(t) {
|
|
879
|
+
if (typeof setTimeout === "undefined") {
|
|
880
|
+
t();
|
|
881
|
+
return null;
|
|
1278
882
|
}
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
var _optionToFocusRef$foc;
|
|
1287
|
-
|
|
1288
|
-
(_optionToFocusRef$foc = optionToFocusRef.focus) === null || _optionToFocusRef$foc === void 0 ? void 0 : _optionToFocusRef$foc.call(optionToFocusRef);
|
|
1289
|
-
}
|
|
883
|
+
return setTimeout(t, 0);
|
|
884
|
+
},
|
|
885
|
+
cancelAnimationFrame: function e(t) {
|
|
886
|
+
if (typeof setTimeout === "undefined") {
|
|
887
|
+
return;
|
|
888
|
+
}
|
|
889
|
+
clearTimeout(t);
|
|
1290
890
|
}
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
891
|
+
};
|
|
892
|
+
function at() {
|
|
893
|
+
var e = typeof window !== "undefined" ? window : ot;
|
|
894
|
+
return e;
|
|
895
|
+
}
|
|
896
|
+
// CONCATENATED MODULE: ./src/Select/SelectBase.tsx
|
|
897
|
+
function it() {
|
|
898
|
+
it = Object.assign || function(e) {
|
|
899
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
900
|
+
var n = arguments[t];
|
|
901
|
+
for (var r in n) {
|
|
902
|
+
if (Object.prototype.hasOwnProperty.call(n, r)) {
|
|
903
|
+
e[r] = n[r];
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
return e;
|
|
908
|
+
};
|
|
909
|
+
return it.apply(this, arguments);
|
|
910
|
+
}
|
|
911
|
+
function lt(e, t) {
|
|
912
|
+
return ut(e) || st(e, t) || dt(e, t) || ct();
|
|
913
|
+
}
|
|
914
|
+
function ct() {
|
|
915
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
916
|
+
}
|
|
917
|
+
function st(e, t) {
|
|
918
|
+
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(e))) return;
|
|
919
|
+
var n = [];
|
|
920
|
+
var r = true;
|
|
921
|
+
var o = false;
|
|
922
|
+
var a = undefined;
|
|
923
|
+
try {
|
|
924
|
+
for (var i = e[Symbol.iterator](), l; !(r = (l = i.next()).done); r = true) {
|
|
925
|
+
n.push(l.value);
|
|
926
|
+
if (t && n.length === t) break;
|
|
927
|
+
}
|
|
928
|
+
} catch (e) {
|
|
929
|
+
o = true;
|
|
930
|
+
a = e;
|
|
931
|
+
} finally {
|
|
932
|
+
try {
|
|
933
|
+
if (!r && i["return"] != null) i["return"]();
|
|
934
|
+
} finally {
|
|
935
|
+
if (o) throw a;
|
|
936
|
+
}
|
|
1297
937
|
}
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
}
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
SelectBase_defineProperty(SelectBase_assertThisInitialized(_this), "handleTextBlur", function () {
|
|
1328
|
-
_this.setState({
|
|
1329
|
-
textHasFocus: false
|
|
1330
|
-
});
|
|
1331
|
-
});
|
|
1332
|
-
|
|
1333
|
-
SelectBase_defineProperty(SelectBase_assertThisInitialized(_this), "handleRequestOpen", function (e) {
|
|
1334
|
-
var newState = {
|
|
1335
|
-
open: true,
|
|
1336
|
-
topValues: _this.getTopValues()
|
|
1337
|
-
}; // SUI-3234: preserve existing behavior difference between <Select> and <Multiselect.Compact>
|
|
1338
|
-
|
|
1339
|
-
if (_this.props.multiple) {
|
|
1340
|
-
newState.filterKeyword = '';
|
|
1341
|
-
}
|
|
1342
|
-
|
|
1343
|
-
var oldFilterKeyword = _this.state.filterKeyword;
|
|
1344
|
-
|
|
1345
|
-
_this.setState(newState, function () {
|
|
1346
|
-
var _this$props$onOpen, _this$props7;
|
|
1347
|
-
|
|
1348
|
-
(_this$props$onOpen = (_this$props7 = _this.props).onOpen) === null || _this$props$onOpen === void 0 ? void 0 : _this$props$onOpen.call(_this$props7);
|
|
1349
|
-
|
|
1350
|
-
if (_this.firstSelectedEnabledOption && !_this.hasFilter()) {
|
|
1351
|
-
_this.firstSelectedEnabledOption.focus();
|
|
1352
|
-
} else {
|
|
1353
|
-
var _this$firstSelectedOp;
|
|
1354
|
-
|
|
1355
|
-
_this.setState({
|
|
1356
|
-
activeIndex: (_this$firstSelectedOp = _this.firstSelectedOptionIndex) !== null && _this$firstSelectedOp !== void 0 ? _this$firstSelectedOp : 0
|
|
1357
|
-
});
|
|
938
|
+
return n;
|
|
939
|
+
}
|
|
940
|
+
function ut(e) {
|
|
941
|
+
if (Array.isArray(e)) return e;
|
|
942
|
+
}
|
|
943
|
+
function pt(e) {
|
|
944
|
+
return ht(e) || vt(e) || dt(e) || ft();
|
|
945
|
+
}
|
|
946
|
+
function ft() {
|
|
947
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
948
|
+
}
|
|
949
|
+
function dt(e, t) {
|
|
950
|
+
if (!e) return;
|
|
951
|
+
if (typeof e === "string") return bt(e, t);
|
|
952
|
+
var n = Object.prototype.toString.call(e).slice(8, -1);
|
|
953
|
+
if (n === "Object" && e.constructor) n = e.constructor.name;
|
|
954
|
+
if (n === "Map" || n === "Set") return Array.from(e);
|
|
955
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return bt(e, t);
|
|
956
|
+
}
|
|
957
|
+
function vt(e) {
|
|
958
|
+
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(e)) return Array.from(e);
|
|
959
|
+
}
|
|
960
|
+
function ht(e) {
|
|
961
|
+
if (Array.isArray(e)) return bt(e);
|
|
962
|
+
}
|
|
963
|
+
function bt(e, t) {
|
|
964
|
+
if (t == null || t > e.length) t = e.length;
|
|
965
|
+
for (var n = 0, r = new Array(t); n < t; n++) {
|
|
966
|
+
r[n] = e[n];
|
|
1358
967
|
}
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
keyword: _this.state.filterKeyword
|
|
1365
|
-
});
|
|
968
|
+
return r;
|
|
969
|
+
}
|
|
970
|
+
function yt(e, t) {
|
|
971
|
+
if (!(e instanceof t)) {
|
|
972
|
+
throw new TypeError("Cannot call a class as a function");
|
|
1366
973
|
}
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
var _this$props$onClose, _this$props9;
|
|
1376
|
-
|
|
1377
|
-
_this.previousActiveIndex = null;
|
|
1378
|
-
(_this$props$onClose = (_this$props9 = _this.props).onClose) === null || _this$props$onClose === void 0 ? void 0 : _this$props$onClose.call(_this$props9);
|
|
1379
|
-
});
|
|
1380
|
-
});
|
|
1381
|
-
|
|
1382
|
-
SelectBase_defineProperty(SelectBase_assertThisInitialized(_this), "handleScrollBottom", function (e) {
|
|
1383
|
-
if (_this.state.open && !_this.props.isLoadingOptions) {
|
|
1384
|
-
var _this$props$onScrollB, _this$props10;
|
|
1385
|
-
|
|
1386
|
-
(_this$props$onScrollB = (_this$props10 = _this.props).onScrollBottom) === null || _this$props$onScrollB === void 0 ? void 0 : _this$props$onScrollB.call(_this$props10, e);
|
|
1387
|
-
}
|
|
1388
|
-
});
|
|
1389
|
-
|
|
1390
|
-
SelectBase_defineProperty(SelectBase_assertThisInitialized(_this), "handleActiveOptionMount", function (c) {
|
|
1391
|
-
if (_this.previousActiveIndex !== _this.state.activeIndex) {
|
|
1392
|
-
c === null || c === void 0 ? void 0 : c.scrollIntoViewIfNeeded();
|
|
1393
|
-
}
|
|
1394
|
-
});
|
|
1395
|
-
|
|
1396
|
-
SelectBase_defineProperty(SelectBase_assertThisInitialized(_this), "handleOptionMount", function (c, itemKey, isFirst) {
|
|
1397
|
-
if (isFirst) {
|
|
1398
|
-
_this.firstSelectedEnabledOption = c;
|
|
1399
|
-
}
|
|
1400
|
-
|
|
1401
|
-
if (c == null) {
|
|
1402
|
-
delete _this.optionRefsByKey[itemKey];
|
|
1403
|
-
} else {
|
|
1404
|
-
_this.optionRefsByKey[itemKey] = c;
|
|
1405
|
-
}
|
|
1406
|
-
});
|
|
1407
|
-
|
|
1408
|
-
SelectBase_defineProperty(SelectBase_assertThisInitialized(_this), "createToggle", function () {
|
|
1409
|
-
var _this$getCurrentValue4;
|
|
1410
|
-
|
|
1411
|
-
var _this$props11 = _this.props,
|
|
1412
|
-
toggle = _this$props11.toggle,
|
|
1413
|
-
appearance = _this$props11.appearance,
|
|
1414
|
-
children = _this$props11.children,
|
|
1415
|
-
describedBy = _this$props11.describedBy,
|
|
1416
|
-
disabled = _this$props11.disabled,
|
|
1417
|
-
elementRef = _this$props11.elementRef,
|
|
1418
|
-
error = _this$props11.error,
|
|
1419
|
-
inline = _this$props11.inline,
|
|
1420
|
-
labelledBy = _this$props11.labelledBy,
|
|
1421
|
-
labelText = _this$props11.labelText,
|
|
1422
|
-
multiple = _this$props11.multiple,
|
|
1423
|
-
placeholder = _this$props11.placeholder,
|
|
1424
|
-
prefixLabel = _this$props11.prefixLabel,
|
|
1425
|
-
required = _this$props11.required,
|
|
1426
|
-
suffixLabel = _this$props11.suffixLabel;
|
|
1427
|
-
var icon;
|
|
1428
|
-
var label; // Generate buttonLabels
|
|
1429
|
-
|
|
1430
|
-
var currentValues = (_this$getCurrentValue4 = _this.getCurrentValues()) !== null && _this$getCurrentValue4 !== void 0 ? _this$getCurrentValue4 : [];
|
|
1431
|
-
var childrenArray = external_react_namespaceObject.Children.toArray(children);
|
|
1432
|
-
var valuesLabel = currentValues.reduce(function (acc, value, index, orig) {
|
|
1433
|
-
var matchedItem = find_default()(childrenArray, function (item) {
|
|
1434
|
-
return isOption(item) && item.props.value === value;
|
|
1435
|
-
});
|
|
1436
|
-
|
|
1437
|
-
if (matchedItem) {
|
|
1438
|
-
acc.push(matchedItem.props.children || matchedItem.props.label); // if not in multiple mode, add the icon
|
|
1439
|
-
|
|
1440
|
-
if (!multiple && currentValues.length === 1) {
|
|
1441
|
-
icon = matchedItem.props.icon;
|
|
1442
|
-
}
|
|
1443
|
-
} else if (multiple) {
|
|
1444
|
-
// only add values that don't match an option in "multiple" mode to preserve old behaviour
|
|
1445
|
-
acc.push(value);
|
|
974
|
+
}
|
|
975
|
+
function mt(e, t) {
|
|
976
|
+
for (var n = 0; n < t.length; n++) {
|
|
977
|
+
var r = t[n];
|
|
978
|
+
r.enumerable = r.enumerable || false;
|
|
979
|
+
r.configurable = true;
|
|
980
|
+
if ("value" in r) r.writable = true;
|
|
981
|
+
Object.defineProperty(e, r.key, r);
|
|
1446
982
|
}
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
983
|
+
}
|
|
984
|
+
function gt(e, t, n) {
|
|
985
|
+
if (t) mt(e.prototype, t);
|
|
986
|
+
if (n) mt(e, n);
|
|
987
|
+
return e;
|
|
988
|
+
}
|
|
989
|
+
function Ot(e, t) {
|
|
990
|
+
if (typeof t !== "function" && t !== null) {
|
|
991
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
1450
992
|
}
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
label = _this.wrapLabel({
|
|
1458
|
-
prefixLabel: prefixLabel,
|
|
1459
|
-
label: label,
|
|
1460
|
-
suffixLabel: suffixLabel
|
|
1461
|
-
});
|
|
1462
|
-
} // single <Select> behaviour is to show the placeholder if all parts of the the label
|
|
1463
|
-
// are empty strings so we replicate this behaviour here
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
if (label.length === 0 || !multiple && label.every(function (labelNode) {
|
|
1467
|
-
return labelNode === '';
|
|
1468
|
-
})) {
|
|
1469
|
-
label = getLabelFromPlaceholder(placeholder);
|
|
1470
|
-
}
|
|
1471
|
-
|
|
1472
|
-
var ariaLabel = label; // If there's more than one item selected, read out the selected total
|
|
1473
|
-
// rather than reading out each selected item
|
|
1474
|
-
|
|
1475
|
-
if (label.length > 1) {
|
|
1476
|
-
ariaLabel = _this.wrapLabel({
|
|
1477
|
-
prefixLabel: prefixLabel,
|
|
1478
|
-
label: ["".concat(currentValues.length, " items selected")],
|
|
1479
|
-
suffixLabel: suffixLabel
|
|
993
|
+
e.prototype = Object.create(t && t.prototype, {
|
|
994
|
+
constructor: {
|
|
995
|
+
value: e,
|
|
996
|
+
writable: true,
|
|
997
|
+
configurable: true
|
|
998
|
+
}
|
|
1480
999
|
});
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
return /*#__PURE__*/(0,external_react_namespaceObject.cloneElement)(toggle, commonProps);
|
|
1507
|
-
}
|
|
1508
|
-
|
|
1509
|
-
if (appearance === 'link') {
|
|
1510
|
-
return /*#__PURE__*/external_react_default().createElement((Link_default()), SelectBase_extends({}, commonProps, {
|
|
1511
|
-
"data-select-appearance": "link"
|
|
1512
|
-
}), !!icon && /*#__PURE__*/external_react_default().createElement(StyledLinkIcon, null, icon), label || placeholder, /*#__PURE__*/external_react_default().createElement(StyledLinkCaret, null, /*#__PURE__*/external_react_default().createElement(CaretSmallDown, null)));
|
|
1513
|
-
}
|
|
1514
|
-
|
|
1515
|
-
return /*#__PURE__*/external_react_default().createElement(StyledButton, SelectBase_extends({}, commonProps, {
|
|
1516
|
-
$multiple: multiple,
|
|
1517
|
-
appearance: appearance,
|
|
1518
|
-
label: label,
|
|
1519
|
-
error: error,
|
|
1520
|
-
icon: icon,
|
|
1521
|
-
inline: inline,
|
|
1522
|
-
isMenu: true,
|
|
1523
|
-
"aria-haspopup": "listbox",
|
|
1524
|
-
"aria-owns": _this.menuId // @ts-expect-error - accept inconsistency with Button
|
|
1525
|
-
,
|
|
1526
|
-
onClick: _this.props.onClick
|
|
1527
|
-
}, pick_default()(_this.props, SelectBase.invalidLinkAppearanceProps)), !!currentValues.length && multiple && /*#__PURE__*/external_react_default().createElement(StyledCount, {
|
|
1528
|
-
"data-role": "count"
|
|
1529
|
-
}, "(", currentValues.length, ")"));
|
|
1530
|
-
});
|
|
1531
|
-
|
|
1532
|
-
SelectBase_defineProperty(SelectBase_assertThisInitialized(_this), "createChildren", function () {
|
|
1533
|
-
var _this$state = _this.state,
|
|
1534
|
-
filterKeyword = _this$state.filterKeyword,
|
|
1535
|
-
textHasFocus = _this$state.textHasFocus,
|
|
1536
|
-
topValuesState = _this$state.topValues;
|
|
1537
|
-
var _this$props12 = _this.props,
|
|
1538
|
-
allowKeyMatching = _this$props12.allowKeyMatching,
|
|
1539
|
-
allowNewValues = _this$props12.allowNewValues,
|
|
1540
|
-
filter = _this$props12.filter,
|
|
1541
|
-
multiple = _this$props12.multiple,
|
|
1542
|
-
selectAllAppearance = _this$props12.selectAllAppearance,
|
|
1543
|
-
showSelectedValuesFirst = _this$props12.showSelectedValuesFirst,
|
|
1544
|
-
isLoadingOptions = _this$props12.isLoadingOptions,
|
|
1545
|
-
onScrollBottom = _this$props12.onScrollBottom;
|
|
1546
|
-
|
|
1547
|
-
var currentValues = _this.getCurrentValues();
|
|
1548
|
-
|
|
1549
|
-
_this.availableOptionCount = 0;
|
|
1550
|
-
_this.firstSelectedOptionIndex = undefined;
|
|
1551
|
-
_this.selectedOptionCount = 0;
|
|
1552
|
-
_this.activeValue = undefined;
|
|
1553
|
-
_this.availableMatchOptions = [];
|
|
1554
|
-
var foundExactMatch;
|
|
1555
|
-
var childrenTopCount = 0;
|
|
1556
|
-
var hasDivider = false; // used to avoid overwriting the selected item ref in multiple mode
|
|
1557
|
-
|
|
1558
|
-
var foundSelectedAndEnabled;
|
|
1559
|
-
var topValues = showSelectedValuesFirst === 'immediately' ? _this.getTopValues() : topValuesState;
|
|
1560
|
-
var children = external_react_namespaceObject.Children.toArray(_this.props.children).reduce(function (acc, item, i) {
|
|
1561
|
-
// ignore Headings and Dividers
|
|
1562
|
-
if (!isOption(item)) {
|
|
1563
|
-
acc.push(item);
|
|
1564
|
-
return acc;
|
|
1565
|
-
} // Find out if the search string exactly matches a value
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
if (item.props.value === _this.state.filterKeyword) {
|
|
1569
|
-
foundExactMatch = true;
|
|
1000
|
+
if (t) St(e, t);
|
|
1001
|
+
}
|
|
1002
|
+
function St(e, t) {
|
|
1003
|
+
St = Object.setPrototypeOf || function e(t, n) {
|
|
1004
|
+
t.__proto__ = n;
|
|
1005
|
+
return t;
|
|
1006
|
+
};
|
|
1007
|
+
return St(e, t);
|
|
1008
|
+
}
|
|
1009
|
+
function wt(e) {
|
|
1010
|
+
var t = xt();
|
|
1011
|
+
return function n() {
|
|
1012
|
+
var r = It(e), o;
|
|
1013
|
+
if (t) {
|
|
1014
|
+
var a = It(this).constructor;
|
|
1015
|
+
o = Reflect.construct(r, arguments, a);
|
|
1016
|
+
} else {
|
|
1017
|
+
o = r.apply(this, arguments);
|
|
1018
|
+
}
|
|
1019
|
+
return kt(this, o);
|
|
1020
|
+
};
|
|
1021
|
+
}
|
|
1022
|
+
function kt(e, t) {
|
|
1023
|
+
if (t && (_t(t) === "object" || typeof t === "function")) {
|
|
1024
|
+
return t;
|
|
1570
1025
|
}
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
var filterIndex = -1;
|
|
1577
|
-
|
|
1578
|
-
if (useMatchOptions && !item.props.disabled && !item.props.hidden) {
|
|
1579
|
-
_this.availableMatchOptions.push({
|
|
1580
|
-
label: item.props.label,
|
|
1581
|
-
value: item.props.value
|
|
1582
|
-
});
|
|
1583
|
-
|
|
1584
|
-
filterIndex = _this.availableMatchOptions.length - 1;
|
|
1585
|
-
} // Format the Menu.Item
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
var clonedItem = /*#__PURE__*/(0,external_react_namespaceObject.cloneElement)(item, {
|
|
1589
|
-
key: item.key || i,
|
|
1590
|
-
onClick: _this.handleMenuOptionClick,
|
|
1591
|
-
onKeyDown: useMatchOptions ? function (e) {
|
|
1592
|
-
return _this.handleMenuOptionKeyDown(e, filterIndex);
|
|
1593
|
-
} : undefined,
|
|
1594
|
-
selected: selected,
|
|
1595
|
-
multiple: multiple,
|
|
1596
|
-
role: 'option',
|
|
1597
|
-
ref: function ref(element) {
|
|
1598
|
-
return _this.handleOptionMount(element, itemKey, isFirstSelectedAndEnabled);
|
|
1599
|
-
}
|
|
1600
|
-
});
|
|
1601
|
-
|
|
1602
|
-
if (isFirstSelectedAndEnabled) {
|
|
1603
|
-
foundSelectedAndEnabled = true;
|
|
1026
|
+
return Ct(e);
|
|
1027
|
+
}
|
|
1028
|
+
function Ct(e) {
|
|
1029
|
+
if (e === void 0) {
|
|
1030
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1604
1031
|
}
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1032
|
+
return e;
|
|
1033
|
+
}
|
|
1034
|
+
function xt() {
|
|
1035
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
1036
|
+
if (Reflect.construct.sham) return false;
|
|
1037
|
+
if (typeof Proxy === "function") return true;
|
|
1038
|
+
try {
|
|
1039
|
+
Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
|
|
1040
|
+
return true;
|
|
1041
|
+
} catch (e) {
|
|
1042
|
+
return false;
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
function It(e) {
|
|
1046
|
+
It = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
|
|
1047
|
+
return t.__proto__ || Object.getPrototypeOf(t);
|
|
1048
|
+
};
|
|
1049
|
+
return It(e);
|
|
1050
|
+
}
|
|
1051
|
+
function _t(e) {
|
|
1052
|
+
"@babel/helpers - typeof";
|
|
1053
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
1054
|
+
_t = function e(t) {
|
|
1055
|
+
return typeof t;
|
|
1056
|
+
};
|
|
1616
1057
|
} else {
|
|
1617
|
-
|
|
1058
|
+
_t = function e(t) {
|
|
1059
|
+
return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1060
|
+
};
|
|
1618
1061
|
}
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
});
|
|
1628
|
-
|
|
1629
|
-
if (!matchedItem) {
|
|
1630
|
-
if (value === _this.state.filterKeyword) {
|
|
1631
|
-
foundExactMatch = true;
|
|
1632
|
-
}
|
|
1633
|
-
|
|
1634
|
-
var isTopValue = topValues && topValues.indexOf(value) >= 0;
|
|
1635
|
-
var topLength = topValues.length;
|
|
1636
|
-
|
|
1637
|
-
if (childrenTopCount === 0) {
|
|
1638
|
-
children.splice(0, 0, /*#__PURE__*/external_react_default().createElement(Menu_namespaceObject.Divider, {
|
|
1639
|
-
key: "topDivider"
|
|
1640
|
-
}));
|
|
1641
|
-
childrenTopCount += 1;
|
|
1642
|
-
hasDivider = true;
|
|
1643
|
-
}
|
|
1644
|
-
|
|
1645
|
-
children.splice(isTopValue ? 0 : topLength + 1, 0, /*#__PURE__*/external_react_default().createElement(OptionBase, {
|
|
1646
|
-
label: String(value),
|
|
1647
|
-
value: value,
|
|
1648
|
-
key: "missing-value-".concat(value),
|
|
1649
|
-
onClick: _this.handleMenuOptionClick,
|
|
1650
|
-
multiple: multiple,
|
|
1651
|
-
selected: true
|
|
1062
|
+
return _t(e);
|
|
1063
|
+
}
|
|
1064
|
+
function At(e, t) {
|
|
1065
|
+
var n = Object.keys(e);
|
|
1066
|
+
if (Object.getOwnPropertySymbols) {
|
|
1067
|
+
var r = Object.getOwnPropertySymbols(e);
|
|
1068
|
+
if (t) r = r.filter((function(t) {
|
|
1069
|
+
return Object.getOwnPropertyDescriptor(e, t).enumerable;
|
|
1652
1070
|
}));
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1071
|
+
n.push.apply(n, r);
|
|
1072
|
+
}
|
|
1073
|
+
return n;
|
|
1074
|
+
}
|
|
1075
|
+
function jt(e) {
|
|
1076
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
1077
|
+
var n = arguments[t] != null ? arguments[t] : {};
|
|
1078
|
+
if (t % 2) {
|
|
1079
|
+
At(Object(n), true).forEach((function(t) {
|
|
1080
|
+
Et(e, t, n[t]);
|
|
1081
|
+
}));
|
|
1082
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
1083
|
+
Object.defineProperties(e, Object.getOwnPropertyDescriptors(n));
|
|
1084
|
+
} else {
|
|
1085
|
+
At(Object(n)).forEach((function(t) {
|
|
1086
|
+
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
|
|
1087
|
+
}));
|
|
1656
1088
|
}
|
|
1657
|
-
}
|
|
1658
|
-
});
|
|
1659
|
-
}
|
|
1660
|
-
|
|
1661
|
-
var controlledFilter = filter === 'controlled'; // Filter the items
|
|
1662
|
-
|
|
1663
|
-
var keywords = (0,filter_namespaceObject.stringToKeywords)(filterKeyword);
|
|
1664
|
-
children = controlledFilter ? children : children.filter(function (option) {
|
|
1665
|
-
if (isOption(option)) {
|
|
1666
|
-
return (0,filter_namespaceObject.testPhrase)(option.props.label, keywords);
|
|
1667
1089
|
}
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
});
|
|
1681
|
-
}); // Add the option to add the new value
|
|
1682
|
-
|
|
1683
|
-
if (allowNewValues && !foundExactMatch && filterKeyword) {
|
|
1684
|
-
var insertIndex = hasDivider ? childrenTopCount + 1 : childrenTopCount;
|
|
1685
|
-
children.splice(insertIndex, 0, /*#__PURE__*/external_react_default().createElement(OptionBase, {
|
|
1686
|
-
label: "".concat(filterKeyword, " (new value)"),
|
|
1687
|
-
value: filterKeyword,
|
|
1688
|
-
key: "newValue",
|
|
1689
|
-
multiple: multiple,
|
|
1690
|
-
onClick: _this.handleMenuOptionClick
|
|
1691
|
-
}));
|
|
1692
|
-
} // When selectAll is a menu item, add an offset so that activeItem accounts for the extra selectAll option.
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
var totalOptionCount = selectAllAppearance === 'checkbox' && multiple && children.length > 1 ? 1 : 0;
|
|
1696
|
-
var allOptionsSelected = true; // Highlight the selected Items and remove hidden
|
|
1697
|
-
|
|
1698
|
-
children = children.reduce(function (acc, item) {
|
|
1699
|
-
// ignore Dividers & Headings
|
|
1700
|
-
if (!isOption(item)) {
|
|
1701
|
-
acc.push(item);
|
|
1702
|
-
return acc;
|
|
1703
|
-
} // Ignore any hidden items
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
if (item.props && item.props.hidden) {
|
|
1707
|
-
return acc;
|
|
1090
|
+
return e;
|
|
1091
|
+
}
|
|
1092
|
+
function Et(e, t, n) {
|
|
1093
|
+
if (t in e) {
|
|
1094
|
+
Object.defineProperty(e, t, {
|
|
1095
|
+
value: n,
|
|
1096
|
+
enumerable: true,
|
|
1097
|
+
configurable: true,
|
|
1098
|
+
writable: true
|
|
1099
|
+
});
|
|
1100
|
+
} else {
|
|
1101
|
+
e[t] = n;
|
|
1708
1102
|
}
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1103
|
+
return e;
|
|
1104
|
+
}
|
|
1105
|
+
var Mt = {
|
|
1106
|
+
allowKeyMatching: a().bool,
|
|
1107
|
+
allowNewValues: a().bool,
|
|
1108
|
+
animateLoading: a().bool,
|
|
1109
|
+
appearance: a().oneOf([ "default", "link", "primary", "pill", "toggle", "flat" ]),
|
|
1110
|
+
append: a().bool,
|
|
1111
|
+
children: a().node,
|
|
1112
|
+
defaultPlacement: a().oneOf([ "above", "below", "vertical" ]),
|
|
1113
|
+
defaultValues: a().array,
|
|
1114
|
+
describedBy: a().string,
|
|
1115
|
+
disabled: a().bool,
|
|
1116
|
+
elementRef: a().oneOfType([ a().func, a().object ]),
|
|
1117
|
+
error: a().bool,
|
|
1118
|
+
filter: a().oneOf([ false, true, "controlled" ]),
|
|
1119
|
+
footerMessage: a().node,
|
|
1120
|
+
inline: a().bool,
|
|
1121
|
+
inputId: a().string,
|
|
1122
|
+
inputRef: a().oneOfType([ a().func, a().object ]),
|
|
1123
|
+
isLoadingOptions: a().bool,
|
|
1124
|
+
labelledBy: a().string,
|
|
1125
|
+
labelText: a().string,
|
|
1126
|
+
loadingMessage: a().node,
|
|
1127
|
+
menuStyle: a().object,
|
|
1128
|
+
multiple: a().bool,
|
|
1129
|
+
name: a().string,
|
|
1130
|
+
noOptionsMessage: a().node,
|
|
1131
|
+
onChange: a().func,
|
|
1132
|
+
onClose: a().func,
|
|
1133
|
+
onFilterChange: a().func,
|
|
1134
|
+
onOpen: a().func,
|
|
1135
|
+
onScroll: a().func,
|
|
1136
|
+
onScrollBottom: a().func,
|
|
1137
|
+
/** @private. */
|
|
1138
|
+
required: a().bool,
|
|
1139
|
+
placeholder: a().string,
|
|
1140
|
+
prefixLabel: a().string,
|
|
1141
|
+
prepend: a().bool,
|
|
1142
|
+
repositionMode: a().oneOf([ "none", "flip" ]),
|
|
1143
|
+
selectAllAppearance: a().oneOf([ "buttongroup", "checkbox" ]),
|
|
1144
|
+
showSelectedValuesFirst: a().oneOf([ "nextOpen", "immediately", "never" ]),
|
|
1145
|
+
suffixLabel: a().string,
|
|
1146
|
+
tabConfirmsNewValue: a().bool,
|
|
1147
|
+
values: a().array
|
|
1148
|
+
};
|
|
1149
|
+
var Tt = {
|
|
1150
|
+
allowKeyMatching: true,
|
|
1151
|
+
allowNewValues: false,
|
|
1152
|
+
animateLoading: false,
|
|
1153
|
+
appearance: "toggle",
|
|
1154
|
+
append: false,
|
|
1155
|
+
defaultPlacement: "vertical",
|
|
1156
|
+
disabled: false,
|
|
1157
|
+
filter: false,
|
|
1158
|
+
inline: false,
|
|
1159
|
+
isLoadingOptions: false,
|
|
1160
|
+
menuStyle: {},
|
|
1161
|
+
multiple: false,
|
|
1162
|
+
noOptionsMessage: (0, c._)("No matches"),
|
|
1163
|
+
placeholder: (0, c._)("Select..."),
|
|
1164
|
+
prepend: false,
|
|
1165
|
+
repositionMode: "flip",
|
|
1166
|
+
selectAllAppearance: "buttongroup",
|
|
1167
|
+
tabConfirmsNewValue: false
|
|
1168
|
+
};
|
|
1169
|
+
var Pt = w()((function(e) {
|
|
1170
|
+
return [ e ];
|
|
1171
|
+
}));
|
|
1172
|
+
// preserve separate widths for single vs. multi mode
|
|
1173
|
+
var Vt = w()((function(e) {
|
|
1174
|
+
var t = e.anchorWidth, n = e.isMultiple, r = e.menuStyle;
|
|
1175
|
+
return n ? jt({
|
|
1176
|
+
width: Math.max(t !== null && t !== void 0 ? t : 0, 200)
|
|
1177
|
+
}, r) : jt({
|
|
1178
|
+
minWidth: t !== null && t !== void 0 ? t : undefined,
|
|
1179
|
+
maxWidth: Math.max(t !== null && t !== void 0 ? t : 0, 300)
|
|
1180
|
+
}, r);
|
|
1181
|
+
}));
|
|
1182
|
+
var Rt = [ "clickAway", "escapeKey", "offScreen", "tabKey", "toggleClick" ];
|
|
1183
|
+
function Dt(e) {
|
|
1184
|
+
return e && l()(e.props, "value");
|
|
1185
|
+
}
|
|
1186
|
+
function qt(e, t) {
|
|
1187
|
+
return "".concat(_t(e), "-").concat(e, "-").concat(t);
|
|
1188
|
+
}
|
|
1189
|
+
var Lt = function(e) {
|
|
1190
|
+
Ot(o, e);
|
|
1191
|
+
var t = wt(o);
|
|
1192
|
+
gt(o, null, [ {
|
|
1193
|
+
key: "validateAppearance",
|
|
1194
|
+
// @docs-props-type CompactPropsBase
|
|
1195
|
+
value: function e(t) {
|
|
1196
|
+
if (false) {}
|
|
1197
|
+
}
|
|
1198
|
+
} ]);
|
|
1199
|
+
function o(e) {
|
|
1200
|
+
var a;
|
|
1201
|
+
yt(this, o);
|
|
1202
|
+
a = t.call(this, e);
|
|
1203
|
+
Et(Ct(a), "activeItemId", void 0);
|
|
1204
|
+
Et(Ct(a), "activeValue", void 0);
|
|
1205
|
+
Et(Ct(a), "availableOptionCount", void 0);
|
|
1206
|
+
Et(Ct(a), "controlledExternally", void 0);
|
|
1207
|
+
Et(Ct(a), "displayedValues", void 0);
|
|
1208
|
+
Et(Ct(a), "dropdown", null);
|
|
1209
|
+
Et(Ct(a), "firstSelectedEnabledOption", null);
|
|
1210
|
+
Et(Ct(a), "firstSelectedOptionIndex", void 0);
|
|
1211
|
+
Et(Ct(a), "menuId", void 0);
|
|
1212
|
+
Et(Ct(a), "previousActiveIndex", null);
|
|
1213
|
+
Et(Ct(a), "selectedOptionCount", void 0);
|
|
1214
|
+
Et(Ct(a), "optionRefsByKey", void 0);
|
|
1215
|
+
Et(Ct(a), "matchCharacter", void 0);
|
|
1216
|
+
Et(Ct(a), "matchTimeout", void 0);
|
|
1217
|
+
Et(Ct(a), "currentMatchOptions", void 0);
|
|
1218
|
+
Et(Ct(a), "availableMatchOptions", void 0);
|
|
1219
|
+
Et(Ct(a), "optionSelection", void 0);
|
|
1220
|
+
Et(Ct(a), "resetMatches", (function() {
|
|
1221
|
+
a.matchCharacter = null;
|
|
1222
|
+
a.currentMatchOptions = [];
|
|
1223
|
+
if (a.matchTimeout) {
|
|
1224
|
+
clearTimeout(a.matchTimeout);
|
|
1225
|
+
}
|
|
1226
|
+
}));
|
|
1227
|
+
Et(Ct(a), "handleSelectAll", (function(e) {
|
|
1228
|
+
var t, n, o;
|
|
1229
|
+
var i = a.props, l = i.name, c = i.children, s = i.multiple;
|
|
1230
|
+
// this doesn't make sense if we can't select multiple values
|
|
1231
|
+
if (!s) {
|
|
1232
|
+
return;
|
|
1233
|
+
}
|
|
1234
|
+
var u = (t = a.getCurrentValues()) !== null && t !== void 0 ? t : [];
|
|
1235
|
+
var p = A()(u.concat(a.displayedValues));
|
|
1236
|
+
p = r().Children.toArray(c).filter((function(e) {
|
|
1237
|
+
return Dt(e) && b()(p, e.props.value) && (!e.props.disabled || b()(u, e.props.value));
|
|
1238
|
+
})).map((function(e) {
|
|
1239
|
+
return e.props.value;
|
|
1240
|
+
}));
|
|
1241
|
+
if (!a.isControlled()) {
|
|
1242
|
+
a.setState({
|
|
1243
|
+
values: p
|
|
1244
|
+
});
|
|
1245
|
+
}
|
|
1246
|
+
(n = (o = a.props).onChange) === null || n === void 0 ? void 0 : n.call(o, e, {
|
|
1247
|
+
values: p,
|
|
1248
|
+
name: l,
|
|
1249
|
+
reason: "selectAll"
|
|
1250
|
+
});
|
|
1251
|
+
}));
|
|
1252
|
+
Et(Ct(a), "handleClearAll", (function(e) {
|
|
1253
|
+
var t, n, o;
|
|
1254
|
+
var i = a.props, l = i.name, c = i.children, s = i.multiple;
|
|
1255
|
+
// this doesn't make sense if we can't select multiple values
|
|
1256
|
+
if (!s) {
|
|
1257
|
+
return;
|
|
1258
|
+
}
|
|
1259
|
+
var u = (t = a.getCurrentValues()) !== null && t !== void 0 ? t : [];
|
|
1260
|
+
var p = E().apply(void 0, [ u ].concat(pt(a.displayedValues)));
|
|
1261
|
+
// this will unselect all selected values unless those values are disabled or hidden by the filter
|
|
1262
|
+
var f = r().Children.toArray(c).filter((function(e) {
|
|
1263
|
+
return Dt(e) && (b()(u, e.props.value) && e.props.disabled || b()(p, e.props.value));
|
|
1264
|
+
})).map((function(e) {
|
|
1265
|
+
return e.props.value;
|
|
1266
|
+
}));
|
|
1267
|
+
if (!a.isControlled()) {
|
|
1268
|
+
a.setState({
|
|
1269
|
+
values: f
|
|
1270
|
+
});
|
|
1271
|
+
}
|
|
1272
|
+
(n = (o = a.props).onChange) === null || n === void 0 ? void 0 : n.call(o, e, {
|
|
1273
|
+
values: f,
|
|
1274
|
+
name: l,
|
|
1275
|
+
reason: "clearAll"
|
|
1276
|
+
});
|
|
1277
|
+
}));
|
|
1278
|
+
Et(Ct(a), "handleTextKeyDown", (function(e) {
|
|
1279
|
+
var t = a.props, r = t.children, o = t.onScrollBottom, i = t.tabConfirmsNewValue;
|
|
1280
|
+
var l = (0, R.keycode)(e.nativeEvent);
|
|
1281
|
+
if (l === "tab") {
|
|
1282
|
+
if (i && !m()(a.activeValue) && a.availableOptionCount <= 1) {
|
|
1283
|
+
e.preventDefault();
|
|
1284
|
+
a.toggleValue(e, a.activeValue);
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
if (e.shiftKey || e.metaKey || e.ctrlKey) {
|
|
1288
|
+
if (l === "a" && (e.ctrlKey || e.metaKey)) {
|
|
1289
|
+
// handle control + A
|
|
1290
|
+
if (a.optionSelection === "all") {
|
|
1291
|
+
a.handleClearAll(e);
|
|
1292
|
+
} else {
|
|
1293
|
+
a.handleSelectAll(e);
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
return;
|
|
1297
|
+
}
|
|
1298
|
+
if (l === "down") {
|
|
1299
|
+
e.preventDefault();
|
|
1300
|
+
a.setState((function(e) {
|
|
1301
|
+
return {
|
|
1302
|
+
activeIndex: Math.min(e.activeIndex + 1, a.props.selectAllAppearance === "checkbox" ? a.availableOptionCount : a.availableOptionCount - 1)
|
|
1303
|
+
};
|
|
1304
|
+
}));
|
|
1305
|
+
if (r && o) {
|
|
1306
|
+
var c;
|
|
1307
|
+
var s = n.Children.toArray(r).length - (2 + ((c = a.getCurrentValues()) !== null && c !== void 0 ? c : []).length);
|
|
1308
|
+
if (a.state.activeIndex === s) {
|
|
1309
|
+
a.handleScrollBottom(e);
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
if (l === "up") {
|
|
1314
|
+
e.preventDefault();
|
|
1315
|
+
a.setState((function(e) {
|
|
1316
|
+
return {
|
|
1317
|
+
activeIndex: Math.max(e.activeIndex - 1, 0)
|
|
1318
|
+
};
|
|
1319
|
+
}));
|
|
1320
|
+
}
|
|
1321
|
+
if (l === "enter" && !m()(a.activeValue) && a.state.open) {
|
|
1322
|
+
if (a.activeValue === "selectAll") {
|
|
1323
|
+
if (a.optionSelection === "all") {
|
|
1324
|
+
a.handleClearAll(e);
|
|
1325
|
+
} else {
|
|
1326
|
+
a.handleSelectAll(e);
|
|
1327
|
+
}
|
|
1328
|
+
} else {
|
|
1329
|
+
e.preventDefault();
|
|
1330
|
+
a.toggleValue(e, a.activeValue);
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
}));
|
|
1334
|
+
Et(Ct(a), "handleMenuOptionClick", (function(e, t) {
|
|
1335
|
+
var n = t.value;
|
|
1336
|
+
e.preventDefault();
|
|
1337
|
+
if (!a.state.open) {
|
|
1338
|
+
return;
|
|
1339
|
+
}
|
|
1340
|
+
a.toggleValue(e, n);
|
|
1341
|
+
}));
|
|
1342
|
+
Et(Ct(a), "handleMenuOptionKeyDown", (function(e, t) {
|
|
1343
|
+
var n = e.nativeEvent.key;
|
|
1344
|
+
// Checking for a single character to avoid complications from double-byte languages and emojis.
|
|
1345
|
+
if (n.length === 1) {
|
|
1346
|
+
var r = [];
|
|
1347
|
+
var o = {
|
|
1348
|
+
index: 0,
|
|
1349
|
+
value: n
|
|
1350
|
+
};
|
|
1351
|
+
if (!a.matchCharacter) {
|
|
1352
|
+
if (n === " ") {
|
|
1353
|
+
a.resetMatches();
|
|
1354
|
+
return;
|
|
1355
|
+
}
|
|
1356
|
+
r = tt(a.availableMatchOptions, o);
|
|
1357
|
+
} else if (a.currentMatchOptions.length > 1) {
|
|
1358
|
+
o.index = a.matchCharacter.index + 1;
|
|
1359
|
+
r = tt(a.currentMatchOptions, o);
|
|
1360
|
+
}
|
|
1361
|
+
if (r.length) {
|
|
1362
|
+
var i = 0;
|
|
1363
|
+
// If the active option is a first character match, cycle to the next matching option.
|
|
1364
|
+
if (o.index === 0 && r.length > 1) {
|
|
1365
|
+
var l = r.indexOf(a.availableMatchOptions[t]);
|
|
1366
|
+
if (l >= 0) {
|
|
1367
|
+
i = l === r.length - 1 ? 0 : l + 1;
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
var c = r[i];
|
|
1371
|
+
var s = a.optionRefsByKey[qt(c.value, c.label)];
|
|
1372
|
+
if (s != null) {
|
|
1373
|
+
var u;
|
|
1374
|
+
(u = s.focus) === null || u === void 0 ? void 0 : u.call(s);
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
a.currentMatchOptions = r;
|
|
1378
|
+
a.matchCharacter = o;
|
|
1379
|
+
if (a.matchTimeout) {
|
|
1380
|
+
clearTimeout(a.matchTimeout);
|
|
1381
|
+
}
|
|
1382
|
+
a.matchTimeout = setTimeout(a.resetMatches, 500);
|
|
1383
|
+
e.preventDefault();
|
|
1384
|
+
e.stopPropagation();
|
|
1385
|
+
}
|
|
1386
|
+
}));
|
|
1387
|
+
Et(Ct(a), "handleTextChange", (function(e, t) {
|
|
1388
|
+
var n, r;
|
|
1389
|
+
var o = t.value;
|
|
1390
|
+
a.setState({
|
|
1391
|
+
filterKeyword: o,
|
|
1392
|
+
open: true,
|
|
1393
|
+
activeIndex: 0
|
|
1394
|
+
});
|
|
1395
|
+
(n = (r = a.props).onFilterChange) === null || n === void 0 ? void 0 : n.call(r, e, {
|
|
1396
|
+
keyword: o
|
|
1397
|
+
});
|
|
1398
|
+
}));
|
|
1399
|
+
Et(Ct(a), "handleTextFocus", (function() {
|
|
1400
|
+
a.setState({
|
|
1401
|
+
textHasFocus: true
|
|
1402
|
+
});
|
|
1403
|
+
}));
|
|
1404
|
+
Et(Ct(a), "handleTextBlur", (function() {
|
|
1405
|
+
a.setState({
|
|
1406
|
+
textHasFocus: false
|
|
1407
|
+
});
|
|
1408
|
+
}));
|
|
1409
|
+
Et(Ct(a), "handleRequestOpen", (function(e) {
|
|
1410
|
+
var t = {
|
|
1411
|
+
open: true,
|
|
1412
|
+
topValues: a.getTopValues()
|
|
1413
|
+
};
|
|
1414
|
+
// SUI-3234: preserve existing behavior difference between <Select> and <Multiselect.Compact>
|
|
1415
|
+
if (a.props.multiple) {
|
|
1416
|
+
t.filterKeyword = "";
|
|
1417
|
+
}
|
|
1418
|
+
var n = a.state.filterKeyword;
|
|
1419
|
+
a.setState(t, (function() {
|
|
1420
|
+
var t, r;
|
|
1421
|
+
(t = (r = a.props).onOpen) === null || t === void 0 ? void 0 : t.call(r);
|
|
1422
|
+
if (a.firstSelectedEnabledOption && !a.hasFilter()) {
|
|
1423
|
+
a.firstSelectedEnabledOption.focus();
|
|
1424
|
+
} else {
|
|
1425
|
+
var o;
|
|
1426
|
+
a.setState({
|
|
1427
|
+
activeIndex: (o = a.firstSelectedOptionIndex) !== null && o !== void 0 ? o : 0
|
|
1428
|
+
});
|
|
1429
|
+
}
|
|
1430
|
+
if (n !== a.state.filterKeyword) {
|
|
1431
|
+
var i, l;
|
|
1432
|
+
(i = (l = a.props).onFilterChange) === null || i === void 0 ? void 0 : i.call(l, e, {
|
|
1433
|
+
keyword: a.state.filterKeyword
|
|
1434
|
+
});
|
|
1435
|
+
}
|
|
1436
|
+
}));
|
|
1437
|
+
}));
|
|
1438
|
+
Et(Ct(a), "handleRequestClose", (function() {
|
|
1439
|
+
a.setState({
|
|
1440
|
+
open: false,
|
|
1441
|
+
activeIndex: 0
|
|
1442
|
+
}, (function() {
|
|
1443
|
+
var e, t;
|
|
1444
|
+
a.previousActiveIndex = null;
|
|
1445
|
+
(e = (t = a.props).onClose) === null || e === void 0 ? void 0 : e.call(t);
|
|
1446
|
+
}));
|
|
1447
|
+
}));
|
|
1448
|
+
Et(Ct(a), "handleScrollBottom", (function(e) {
|
|
1449
|
+
if (a.state.open && !a.props.isLoadingOptions) {
|
|
1450
|
+
var t, n;
|
|
1451
|
+
(t = (n = a.props).onScrollBottom) === null || t === void 0 ? void 0 : t.call(n, e);
|
|
1452
|
+
}
|
|
1453
|
+
}));
|
|
1454
|
+
Et(Ct(a), "handleActiveOptionMount", (function(e) {
|
|
1455
|
+
if (a.previousActiveIndex !== a.state.activeIndex) {
|
|
1456
|
+
e === null || e === void 0 ? void 0 : e.scrollIntoViewIfNeeded();
|
|
1457
|
+
}
|
|
1458
|
+
}));
|
|
1459
|
+
Et(Ct(a), "handleOptionMount", (function(e, t, n) {
|
|
1460
|
+
if (n) {
|
|
1461
|
+
a.firstSelectedEnabledOption = e;
|
|
1462
|
+
}
|
|
1463
|
+
if (e == null) {
|
|
1464
|
+
delete a.optionRefsByKey[t];
|
|
1465
|
+
} else {
|
|
1466
|
+
a.optionRefsByKey[t] = e;
|
|
1467
|
+
}
|
|
1468
|
+
}));
|
|
1469
|
+
Et(Ct(a), "createToggle", (function() {
|
|
1470
|
+
var e;
|
|
1471
|
+
var t = a.props, i = t.toggle, l = t.appearance, s = t.children, u = t.describedBy, p = t.disabled, d = t.elementRef, v = t.error, h = t.inline, b = t.labelledBy, y = t.labelText, m = t.multiple, g = t.placeholder, S = t.prefixLabel, w = t.required, k = t.suffixLabel;
|
|
1472
|
+
var x;
|
|
1473
|
+
var _;
|
|
1474
|
+
// Generate buttonLabels
|
|
1475
|
+
var A = (e = a.getCurrentValues()) !== null && e !== void 0 ? e : [];
|
|
1476
|
+
var j = n.Children.toArray(s);
|
|
1477
|
+
var E = A.reduce((function(e, t, n, r) {
|
|
1478
|
+
var o = f()(j, (function(e) {
|
|
1479
|
+
return Dt(e) && e.props.value === t;
|
|
1480
|
+
}));
|
|
1481
|
+
if (o) {
|
|
1482
|
+
e.push(o.props.children || o.props.label);
|
|
1483
|
+
// if not in multiple mode, add the icon
|
|
1484
|
+
if (!m && A.length === 1) {
|
|
1485
|
+
x = o.props.icon;
|
|
1486
|
+
}
|
|
1487
|
+
} else if (m) {
|
|
1488
|
+
// only add values that don't match an option in "multiple" mode to preserve old behaviour
|
|
1489
|
+
e.push(t);
|
|
1490
|
+
}
|
|
1491
|
+
if (n < r.length - 1) {
|
|
1492
|
+
e.push((0, c._)(", "));
|
|
1493
|
+
}
|
|
1494
|
+
return e;
|
|
1495
|
+
}), []);
|
|
1496
|
+
_ = E;
|
|
1497
|
+
// only apply prefix / suffix if the label is not empty
|
|
1498
|
+
if (_.length > 0) {
|
|
1499
|
+
_ = a.wrapLabel({
|
|
1500
|
+
prefixLabel: S,
|
|
1501
|
+
label: _,
|
|
1502
|
+
suffixLabel: k
|
|
1503
|
+
});
|
|
1504
|
+
}
|
|
1505
|
+
// single <Select> behaviour is to show the placeholder if all parts of the the label
|
|
1506
|
+
// are empty strings so we replicate this behaviour here
|
|
1507
|
+
if (_.length === 0 || !m && _.every((function(e) {
|
|
1508
|
+
return e === "";
|
|
1509
|
+
}))) {
|
|
1510
|
+
_ = Pt(g);
|
|
1511
|
+
}
|
|
1512
|
+
var M = _;
|
|
1513
|
+
// If there's more than one item selected, read out the selected total
|
|
1514
|
+
// rather than reading out each selected item
|
|
1515
|
+
if (_.length > 1) {
|
|
1516
|
+
M = a.wrapLabel({
|
|
1517
|
+
prefixLabel: S,
|
|
1518
|
+
label: [ "".concat(A.length, " items selected") ],
|
|
1519
|
+
suffixLabel: k
|
|
1520
|
+
});
|
|
1521
|
+
}
|
|
1522
|
+
var T = jt({
|
|
1523
|
+
"aria-describedby": u,
|
|
1524
|
+
"aria-label": "".concat(y ? "".concat(y, ", ") : "").concat(M),
|
|
1525
|
+
"aria-labelledby": y ? undefined : b,
|
|
1526
|
+
"aria-multiselectable": m || undefined,
|
|
1527
|
+
"aria-required": w,
|
|
1528
|
+
"data-select-appearance": l,
|
|
1529
|
+
"data-test": m ? "multiselect" : "select",
|
|
1530
|
+
disabled: p,
|
|
1531
|
+
elementRef: d,
|
|
1532
|
+
error: v
|
|
1533
|
+
}, C()(a.props, O()(o.propTypes)));
|
|
1534
|
+
if (m) {
|
|
1535
|
+
T["data-test-values"] = JSON.stringify(A);
|
|
1536
|
+
} else {
|
|
1537
|
+
var P = lt(A, 1), V = P[0];
|
|
1538
|
+
T["data-test-value"] = V;
|
|
1539
|
+
}
|
|
1540
|
+
if (i) {
|
|
1541
|
+
|
|
1542
|
+
return (0, n.cloneElement)(i, T);
|
|
1543
|
+
}
|
|
1544
|
+
if (l === "link") {
|
|
1545
|
+
|
|
1546
|
+
return r().createElement(L(), it({}, T, {
|
|
1547
|
+
"data-select-appearance": "link"
|
|
1548
|
+
}), !!x && r().createElement(Ue, null, x), _ || g, r().createElement(Ge, null, r().createElement(J, null)));
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
return r().createElement(ze, it({}, T, {
|
|
1552
|
+
$multiple: m,
|
|
1553
|
+
appearance: l,
|
|
1554
|
+
label: _,
|
|
1555
|
+
error: v,
|
|
1556
|
+
icon: x,
|
|
1557
|
+
inline: h,
|
|
1558
|
+
isMenu: true,
|
|
1559
|
+
"aria-haspopup": "listbox",
|
|
1560
|
+
"aria-owns": a.menuId,
|
|
1561
|
+
onClick: a.props.onClick
|
|
1562
|
+
}, I()(a.props, o.invalidLinkAppearanceProps)), !!A.length && m && r().createElement(Xe, {
|
|
1563
|
+
"data-role": "count"
|
|
1564
|
+
}, "(", A.length, ")"));
|
|
1565
|
+
}));
|
|
1566
|
+
Et(Ct(a), "createChildren", (function() {
|
|
1567
|
+
var e = a.state, t = e.filterKeyword, o = e.textHasFocus, i = e.topValues;
|
|
1568
|
+
var l = a.props, s = l.allowKeyMatching, u = l.allowNewValues, p = l.filter, d = l.multiple, h = l.selectAllAppearance, b = l.showSelectedValuesFirst, y = l.isLoadingOptions, m = l.onScrollBottom;
|
|
1569
|
+
var g = a.getCurrentValues();
|
|
1570
|
+
a.availableOptionCount = 0;
|
|
1571
|
+
a.firstSelectedOptionIndex = undefined;
|
|
1572
|
+
a.selectedOptionCount = 0;
|
|
1573
|
+
a.activeValue = undefined;
|
|
1574
|
+
a.availableMatchOptions = [];
|
|
1575
|
+
var O;
|
|
1576
|
+
var S = 0;
|
|
1577
|
+
var w = false;
|
|
1578
|
+
// used to avoid overwriting the selected item ref in multiple mode
|
|
1579
|
+
var k;
|
|
1580
|
+
var C = b === "immediately" ? a.getTopValues() : i;
|
|
1581
|
+
var x = n.Children.toArray(a.props.children).reduce((function(e, t, o) {
|
|
1582
|
+
// ignore Headings and Dividers
|
|
1583
|
+
if (!Dt(t)) {
|
|
1584
|
+
e.push(t);
|
|
1585
|
+
return e;
|
|
1586
|
+
}
|
|
1587
|
+
// Find out if the search string exactly matches a value
|
|
1588
|
+
if (t.props.value === a.state.filterKeyword) {
|
|
1589
|
+
O = true;
|
|
1590
|
+
}
|
|
1591
|
+
var i = g && g.indexOf(t.props.value) >= 0;
|
|
1592
|
+
var l = !!i && !t.props.disabled && !k;
|
|
1593
|
+
var c = s && !d && !p && !y && !m;
|
|
1594
|
+
var u = qt(t.props.value, t.props.label);
|
|
1595
|
+
var f = -1;
|
|
1596
|
+
if (c && !t.props.disabled && !t.props.hidden) {
|
|
1597
|
+
a.availableMatchOptions.push({
|
|
1598
|
+
label: t.props.label,
|
|
1599
|
+
value: t.props.value
|
|
1600
|
+
});
|
|
1601
|
+
f = a.availableMatchOptions.length - 1;
|
|
1602
|
+
}
|
|
1603
|
+
// Format the Menu.Item
|
|
1604
|
+
var v = (0, n.cloneElement)(t, {
|
|
1605
|
+
key: t.key || o,
|
|
1606
|
+
onClick: a.handleMenuOptionClick,
|
|
1607
|
+
onKeyDown: c ? function(e) {
|
|
1608
|
+
return a.handleMenuOptionKeyDown(e, f);
|
|
1609
|
+
} : undefined,
|
|
1610
|
+
selected: i,
|
|
1611
|
+
multiple: d,
|
|
1612
|
+
role: "option",
|
|
1613
|
+
ref: function e(t) {
|
|
1614
|
+
return a.handleOptionMount(t, u, l);
|
|
1615
|
+
}
|
|
1616
|
+
});
|
|
1617
|
+
if (l) {
|
|
1618
|
+
k = true;
|
|
1619
|
+
}
|
|
1620
|
+
if (C && C.indexOf(t.props.value) >= 0) {
|
|
1621
|
+
if (S === 0) {
|
|
1622
|
+
e.splice(S, 0, r().createElement(T.Divider, {
|
|
1623
|
+
key: "topDivider"
|
|
1624
|
+
}));
|
|
1625
|
+
w = true;
|
|
1626
|
+
}
|
|
1627
|
+
e.splice(S, 0, v);
|
|
1628
|
+
S += 1;
|
|
1629
|
+
} else {
|
|
1630
|
+
e.push(v);
|
|
1631
|
+
}
|
|
1632
|
+
return e;
|
|
1633
|
+
}), []);
|
|
1634
|
+
// In multiple mode, add missing items
|
|
1635
|
+
if (d) {
|
|
1636
|
+
v()(g, (function(e) {
|
|
1637
|
+
var t = f()(x, (function(t) {
|
|
1638
|
+
return Dt(t) && t.props && t.props.value === e;
|
|
1639
|
+
}));
|
|
1640
|
+
if (!t) {
|
|
1641
|
+
if (e === a.state.filterKeyword) {
|
|
1642
|
+
O = true;
|
|
1643
|
+
}
|
|
1644
|
+
var n = C && C.indexOf(e) >= 0;
|
|
1645
|
+
var o = C.length;
|
|
1646
|
+
if (S === 0) {
|
|
1647
|
+
x.splice(0, 0, r().createElement(T.Divider, {
|
|
1648
|
+
key: "topDivider"
|
|
1649
|
+
}));
|
|
1650
|
+
S += 1;
|
|
1651
|
+
w = true;
|
|
1652
|
+
}
|
|
1653
|
+
x.splice(n ? 0 : o + 1, 0, r().createElement(Oe, {
|
|
1654
|
+
label: String(e),
|
|
1655
|
+
value: e,
|
|
1656
|
+
key: "missing-value-".concat(e),
|
|
1657
|
+
onClick: a.handleMenuOptionClick,
|
|
1658
|
+
multiple: d,
|
|
1659
|
+
selected: true
|
|
1660
|
+
}));
|
|
1661
|
+
if (n) {
|
|
1662
|
+
S += 1;
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
}));
|
|
1666
|
+
}
|
|
1667
|
+
var I = p === "controlled";
|
|
1668
|
+
// Filter the items
|
|
1669
|
+
var _ = (0, D.stringToKeywords)(t);
|
|
1670
|
+
x = I ? x : x.filter((function(e) {
|
|
1671
|
+
if (Dt(e)) {
|
|
1672
|
+
return (0, D.testPhrase)(e.props.label, _);
|
|
1673
|
+
}
|
|
1674
|
+
return true;
|
|
1675
|
+
// Keep all headers and non-interactive options
|
|
1676
|
+
})).map((function(e) {
|
|
1677
|
+
if (!Dt(e)) {
|
|
1678
|
+
return e;
|
|
1679
|
+
}
|
|
1680
|
+
// highlight matched text
|
|
1681
|
+
var t = _ && (0, D.keywordLocations)(e.props.label, _);
|
|
1682
|
+
|
|
1683
|
+
return (0, n.cloneElement)(e, {
|
|
1684
|
+
matchRanges: t || undefined
|
|
1685
|
+
});
|
|
1686
|
+
}));
|
|
1687
|
+
// Add the option to add the new value
|
|
1688
|
+
if (u && !O && t) {
|
|
1689
|
+
var A = w ? S + 1 : S;
|
|
1690
|
+
x.splice(A, 0, r().createElement(Oe, {
|
|
1691
|
+
label: "".concat(t, " (new value)"),
|
|
1692
|
+
value: t,
|
|
1693
|
+
key: "newValue",
|
|
1694
|
+
multiple: d,
|
|
1695
|
+
onClick: a.handleMenuOptionClick
|
|
1696
|
+
}));
|
|
1697
|
+
}
|
|
1698
|
+
// When selectAll is a menu item, add an offset so that activeItem accounts for the extra selectAll option.
|
|
1699
|
+
var j = h === "checkbox" && d && x.length > 1 ? 1 : 0;
|
|
1700
|
+
var E = true;
|
|
1701
|
+
// Highlight the selected Items and remove hidden
|
|
1702
|
+
x = x.reduce((function(e, t) {
|
|
1703
|
+
// ignore Dividers & Headings
|
|
1704
|
+
if (!Dt(t)) {
|
|
1705
|
+
e.push(t);
|
|
1706
|
+
return e;
|
|
1707
|
+
}
|
|
1708
|
+
// Ignore any hidden items
|
|
1709
|
+
if (t.props && t.props.hidden) {
|
|
1710
|
+
return e;
|
|
1711
|
+
}
|
|
1712
|
+
if (t.props.selected && !t.props.disabled && a.firstSelectedOptionIndex == null) {
|
|
1713
|
+
a.firstSelectedOptionIndex = a.availableOptionCount;
|
|
1714
|
+
}
|
|
1715
|
+
var r = j === a.state.activeIndex;
|
|
1716
|
+
j += 1;
|
|
1717
|
+
a.availableOptionCount += 1;
|
|
1718
|
+
a.selectedOptionCount += t.props.selected ? 1 : 0;
|
|
1719
|
+
if (t.key !== "newValue" && !t.props.disabled && !t.props.selected) {
|
|
1720
|
+
E = false;
|
|
1721
|
+
}
|
|
1722
|
+
if (!r || !o) {
|
|
1723
|
+
e.push(t);
|
|
1724
|
+
return e;
|
|
1725
|
+
}
|
|
1726
|
+
if (!t.props.disabled) {
|
|
1727
|
+
a.activeValue = t.props.value;
|
|
1728
|
+
}
|
|
1729
|
+
var i = (0, n.cloneElement)(t, {
|
|
1730
|
+
active: r,
|
|
1731
|
+
id: a.activeItemId,
|
|
1732
|
+
ref: a.handleActiveOptionMount
|
|
1733
|
+
});
|
|
1734
|
+
e.push(i);
|
|
1735
|
+
return e;
|
|
1736
|
+
}), []);
|
|
1737
|
+
a.optionSelection = a.selectedOptionCount === 0 && "none" || E && "all" || "some";
|
|
1738
|
+
// add select all option
|
|
1739
|
+
if (h === "checkbox" && d && a.availableOptionCount > 0) {
|
|
1740
|
+
var M;
|
|
1741
|
+
var P;
|
|
1742
|
+
if (a.optionSelection === "all") {
|
|
1743
|
+
if (t === "") {
|
|
1744
|
+
P = (0, c._)("Clear all");
|
|
1745
|
+
} else {
|
|
1746
|
+
P = (0, c._)("Clear all matches");
|
|
1747
|
+
}
|
|
1748
|
+
} else if (t === "") {
|
|
1749
|
+
P = (0, c._)("Select all");
|
|
1750
|
+
} else {
|
|
1751
|
+
P = (0, c._)("Select all matches");
|
|
1752
|
+
}
|
|
1753
|
+
if (a.state.activeIndex === 0 && o) {
|
|
1754
|
+
a.activeValue = "selectAll";
|
|
1755
|
+
}
|
|
1756
|
+
x.unshift( r().createElement($e, {
|
|
1757
|
+
key: "selectAllOption",
|
|
1758
|
+
selected: a.optionSelection === "all" || a.optionSelection !== "none" && "some",
|
|
1759
|
+
selectAllLabel: P,
|
|
1760
|
+
totalCount: (M = a.getCurrentValues()) === null || M === void 0 ? void 0 : M.length,
|
|
1761
|
+
changedToggle: !!a.props.toggle,
|
|
1762
|
+
onClick: a.optionSelection === "all" ? a.handleClearAll : a.handleSelectAll,
|
|
1763
|
+
id: a.state.activeIndex === 0 ? a.activeItemId : undefined,
|
|
1764
|
+
active: a.state.activeIndex === 0,
|
|
1765
|
+
ref: a.handleActiveOptionMount,
|
|
1766
|
+
tabIndex: -1
|
|
1767
|
+
}), r().createElement(T.Divider, {
|
|
1768
|
+
key: "selectAllDivider"
|
|
1769
|
+
}));
|
|
1770
|
+
}
|
|
1771
|
+
a.displayedValues = x.reduce((function(e, t) {
|
|
1772
|
+
if (Dt(t)) {
|
|
1773
|
+
e.push(t.props.value);
|
|
1774
|
+
}
|
|
1775
|
+
return e;
|
|
1776
|
+
}), []);
|
|
1777
|
+
return x;
|
|
1778
|
+
}));
|
|
1779
|
+
Et(Ct(a), "wrapLabel", (function(e) {
|
|
1780
|
+
var t = e.prefixLabel, n = e.label, r = e.suffixLabel;
|
|
1781
|
+
var o = n;
|
|
1782
|
+
if (t) {
|
|
1783
|
+
o = [ "".concat(t, ": ") ].concat(o);
|
|
1784
|
+
}
|
|
1785
|
+
if (r) {
|
|
1786
|
+
o = u()(o).concat(" ".concat(r));
|
|
1787
|
+
}
|
|
1788
|
+
return o;
|
|
1789
|
+
}));
|
|
1790
|
+
Et(Ct(a), "handleDropdownMount", (function(e) {
|
|
1791
|
+
a.dropdown = e;
|
|
1792
|
+
}));
|
|
1793
|
+
a.state = {
|
|
1794
|
+
activeIndex: 0,
|
|
1795
|
+
filterKeyword: "",
|
|
1796
|
+
open: false,
|
|
1797
|
+
textHasFocus: false,
|
|
1798
|
+
topValues: [],
|
|
1799
|
+
values: e.defaultValues || []
|
|
1800
|
+
};
|
|
1801
|
+
a.controlledExternally = l()(e, "values");
|
|
1802
|
+
a.displayedValues = [];
|
|
1803
|
+
a.availableOptionCount = 0;
|
|
1804
|
+
a.firstSelectedOptionIndex = undefined;
|
|
1805
|
+
a.selectedOptionCount = 0;
|
|
1806
|
+
a.matchCharacter = null;
|
|
1807
|
+
a.matchTimeout = null;
|
|
1808
|
+
a.currentMatchOptions = [];
|
|
1809
|
+
a.availableMatchOptions = [];
|
|
1810
|
+
a.optionRefsByKey = {};
|
|
1811
|
+
a.optionSelection = "none";
|
|
1812
|
+
if (false) {}
|
|
1813
|
+
if (false) {}
|
|
1814
|
+
o.validateAppearance(e);
|
|
1815
|
+
a.menuId = (0, M.createDOMID)("menu");
|
|
1816
|
+
a.activeItemId = (0, M.createDOMID)("active-item");
|
|
1817
|
+
return a;
|
|
1818
|
+
}
|
|
1819
|
+
gt(o, [ {
|
|
1820
|
+
key: "componentDidUpdate",
|
|
1821
|
+
value: function e(t, n) {
|
|
1822
|
+
if (false) {}
|
|
1823
|
+
if (false) {}
|
|
1824
|
+
o.validateAppearance(this.props);
|
|
1825
|
+
this.previousActiveIndex = n.activeIndex;
|
|
1826
|
+
}
|
|
1827
|
+
}, {
|
|
1828
|
+
key: "getCurrentValues",
|
|
1829
|
+
value: function e() {
|
|
1830
|
+
var t = this.isControlled() ? this.props.values : this.state.values;
|
|
1831
|
+
return this.props.multiple || t == null ? t : t.slice(0, 1);
|
|
1832
|
+
}
|
|
1833
|
+
}, {
|
|
1834
|
+
key: "getTopValues",
|
|
1835
|
+
value: function e() {
|
|
1836
|
+
var t;
|
|
1837
|
+
// in non-multiple mode, don't move values to the top of the list
|
|
1838
|
+
return this.props.multiple && this.props.showSelectedValuesFirst !== "never" ? (t = this.getCurrentValues()) !== null && t !== void 0 ? t : [] : [];
|
|
1839
|
+
}
|
|
1840
|
+
}, {
|
|
1841
|
+
key: "isControlled",
|
|
1842
|
+
value: function e() {
|
|
1843
|
+
return this.controlledExternally;
|
|
1844
|
+
}
|
|
1845
|
+
}, {
|
|
1846
|
+
key: "hasFilter",
|
|
1847
|
+
value: function e() {
|
|
1848
|
+
return !!this.props.filter;
|
|
1849
|
+
}
|
|
1850
|
+
}, {
|
|
1851
|
+
key: "toggleValue",
|
|
1852
|
+
value: function e(t, n) {
|
|
1853
|
+
var r, o, a;
|
|
1854
|
+
var i = (r = this.getCurrentValues()) !== null && r !== void 0 ? r : [];
|
|
1855
|
+
var l = i.indexOf(n);
|
|
1856
|
+
var c = this.props, s = c.name, u = c.multiple;
|
|
1857
|
+
var p;
|
|
1858
|
+
if (u) {
|
|
1859
|
+
if (l >= 0) {
|
|
1860
|
+
p = [].concat(pt(i.slice(0, l)), pt(i.slice(l + 1)));
|
|
1861
|
+
} else {
|
|
1862
|
+
p = i.concat([ n ]);
|
|
1863
|
+
}
|
|
1864
|
+
} else {
|
|
1865
|
+
// non-multiple mode must always have a value
|
|
1866
|
+
p = [ n ];
|
|
1867
|
+
}
|
|
1868
|
+
var f = !this.isControlled();
|
|
1869
|
+
if (f) {
|
|
1870
|
+
this.setState({
|
|
1871
|
+
values: p
|
|
1872
|
+
});
|
|
1873
|
+
}
|
|
1874
|
+
if (u) {
|
|
1875
|
+
// in uncontrolled multiple mode, keep the menu open
|
|
1876
|
+
if (f) {
|
|
1877
|
+
this.setState({
|
|
1878
|
+
open: true
|
|
1879
|
+
});
|
|
1880
|
+
}
|
|
1881
|
+
} else {
|
|
1882
|
+
// non-multiple mode only supports a single selection
|
|
1883
|
+
// so close the menu once a selection is made
|
|
1884
|
+
this.handleRequestClose({
|
|
1885
|
+
reason: "contentClick"
|
|
1886
|
+
});
|
|
1887
|
+
this.focus();
|
|
1888
|
+
}
|
|
1889
|
+
(o = (a = this.props).onChange) === null || o === void 0 ? void 0 : o.call(a, t, {
|
|
1890
|
+
values: p,
|
|
1891
|
+
name: s,
|
|
1892
|
+
reason: "valueToggle"
|
|
1893
|
+
});
|
|
1894
|
+
}
|
|
1895
|
+
/**
|
|
1896
|
+
* Place focus on the toggle.
|
|
1897
|
+
*/ }, {
|
|
1898
|
+
key: "focus",
|
|
1899
|
+
value: function e() {
|
|
1900
|
+
var t;
|
|
1901
|
+
(t = this.dropdown) === null || t === void 0 ? void 0 : t.focus();
|
|
1902
|
+
}
|
|
1903
|
+
}, {
|
|
1904
|
+
key: "renderControls",
|
|
1905
|
+
value: function e(t) {
|
|
1906
|
+
var n = t.hasChildren, o = t.placement;
|
|
1907
|
+
var a = this.state.filterKeyword;
|
|
1908
|
+
var i = this.props, l = i.inputId, s = i.inputRef, u = i.multiple, p = i.selectAllAppearance;
|
|
1909
|
+
var f = (0, c._)("Select all options".concat(this.optionSelection === "all" ? " disabled" : ""));
|
|
1910
|
+
var d = (0, c._)("Clear all options".concat(this.optionSelection === "none" ? " disabled" : ""));
|
|
1911
|
+
// only visually disable these as opposed to fully disabling to avoid losing keyboard focus - see SUI-2731
|
|
1912
|
+
var v = r().createElement(Ze, {
|
|
1913
|
+
$placement: o,
|
|
1914
|
+
key: "selectAll"
|
|
1915
|
+
}, r().createElement(Ye, {
|
|
1916
|
+
$disabled: this.optionSelection === "all",
|
|
1917
|
+
"aria-label": f,
|
|
1918
|
+
onClick: this.handleSelectAll,
|
|
1919
|
+
"data-test": "select-all"
|
|
1920
|
+
}, a ? (0, c._)("Select All Matches") : (0, c._)("Select All")), r().createElement(Ye, {
|
|
1921
|
+
$disabled: this.optionSelection === "none",
|
|
1922
|
+
"aria-label": d,
|
|
1923
|
+
onClick: this.handleClearAll,
|
|
1924
|
+
"data-test": "clear-all"
|
|
1925
|
+
}, a ? (0, c._)("Clear All Matches") : (0, c._)("Clear All")));
|
|
1926
|
+
return this.hasFilter() && r().createElement("div", {
|
|
1927
|
+
key: "controls"
|
|
1928
|
+
}, r().createElement(Je, {
|
|
1929
|
+
key: "filter",
|
|
1930
|
+
"data-test": "filter"
|
|
1931
|
+
}, r().createElement(F(), {
|
|
1932
|
+
value: a,
|
|
1933
|
+
autoCapitalize: "off",
|
|
1934
|
+
autoComplete: "off",
|
|
1935
|
+
autoCorrect: "off",
|
|
1936
|
+
spellCheck: false,
|
|
1937
|
+
onChange: this.handleTextChange,
|
|
1938
|
+
onKeyDown: this.handleTextKeyDown,
|
|
1939
|
+
onFocus: this.handleTextFocus,
|
|
1940
|
+
onBlur: this.handleTextBlur,
|
|
1941
|
+
placeholder: (0, c._)("filter"),
|
|
1942
|
+
role: "combobox",
|
|
1943
|
+
"aria-expanded": "true",
|
|
1944
|
+
"aria-label": (0, c._)("Filter"),
|
|
1945
|
+
"aria-activedescendant": this.activeItemId,
|
|
1946
|
+
inputRef: s,
|
|
1947
|
+
inputId: l,
|
|
1948
|
+
canClear: true,
|
|
1949
|
+
startAdornment: r().createElement(Qe, null, r().createElement(te, null))
|
|
1950
|
+
})), u && n && p === "buttongroup" && v);
|
|
1951
|
+
}
|
|
1952
|
+
}, {
|
|
1953
|
+
key: "render",
|
|
1954
|
+
value: function e() {
|
|
1955
|
+
var t, o = this;
|
|
1956
|
+
var a = this.props, i = a.children, l = a.defaultPlacement, c = a.inputId, s = a.multiple, u = a.repositionMode;
|
|
1957
|
+
var p = this.hasFilter();
|
|
1958
|
+
var d = (t = this.getCurrentValues()) !== null && t !== void 0 ? t : [];
|
|
1959
|
+
var v = n.Children.toArray(i);
|
|
1960
|
+
var h = d.some((function(e) {
|
|
1961
|
+
var t = f()(v, (function(t) {
|
|
1962
|
+
return Dt(t) && t.props.value === e;
|
|
1963
|
+
}));
|
|
1964
|
+
return t && !t.props.disabled;
|
|
1965
|
+
}));
|
|
1966
|
+
var b = this.createChildren();
|
|
1967
|
+
var y = this.createToggle();
|
|
1968
|
+
var m = function e(t) {
|
|
1969
|
+
var n = t.anchorWidth, a = t.maxHeight, i = t.placement;
|
|
1970
|
+
var l = Vt({
|
|
1971
|
+
anchorWidth: n,
|
|
1972
|
+
isMultiple: o.props.multiple,
|
|
1973
|
+
menuStyle: o.props.menuStyle
|
|
1974
|
+
});
|
|
1975
|
+
var c = d.length > 0 && !h && !o.hasFilter() ? 0 : undefined;
|
|
1976
|
+
|
|
1977
|
+
return r().createElement(B(), it({
|
|
1978
|
+
"aria-multiselectable": s || undefined,
|
|
1979
|
+
childrenStart: o.renderControls({
|
|
1980
|
+
placement: i,
|
|
1981
|
+
hasChildren: !!b.length
|
|
1982
|
+
}),
|
|
1983
|
+
controlledExternally: o.hasFilter(),
|
|
1984
|
+
placement: i !== null && i !== void 0 ? i : undefined,
|
|
1985
|
+
maxHeight: a !== null && a !== void 0 ? a : undefined,
|
|
1986
|
+
onScrollBottom: o.props.onScrollBottom ? o.handleScrollBottom : undefined,
|
|
1987
|
+
"data-test": "results-menu",
|
|
1988
|
+
isLoading: o.props.isLoadingOptions,
|
|
1989
|
+
id: o.menuId
|
|
1990
|
+
}, I()(o.props, "noOptionsMessage", "footerMessage", "animateLoading", "loadingMessage", "onScroll"), {
|
|
1991
|
+
style: l,
|
|
1992
|
+
tabIndex: c
|
|
1993
|
+
}), b);
|
|
1994
|
+
};
|
|
1995
|
+
|
|
1996
|
+
return r().createElement(V(), {
|
|
1997
|
+
closeReasons: Rt,
|
|
1998
|
+
inputId: c,
|
|
1999
|
+
toggle: y,
|
|
2000
|
+
onRequestOpen: this.handleRequestOpen,
|
|
2001
|
+
onRequestClose: this.handleRequestClose,
|
|
2002
|
+
open: this.state.open,
|
|
2003
|
+
openWithArrowKeys: true,
|
|
2004
|
+
repositionMode: u,
|
|
2005
|
+
defaultPlacement: p ? l : undefined,
|
|
2006
|
+
canCoverAnchor: at().innerHeight < 500,
|
|
2007
|
+
ref: this.handleDropdownMount,
|
|
2008
|
+
retainFocus: false,
|
|
2009
|
+
takeFocus: d.length === 0 || d.length > 0 && !h || !!p
|
|
2010
|
+
}, m);
|
|
2011
|
+
}
|
|
2012
|
+
} ]);
|
|
2013
|
+
return o;
|
|
2014
|
+
}(n.Component);
|
|
2015
|
+
Et(Lt, "propTypes", Mt);
|
|
2016
|
+
Et(Lt, "defaultProps", Tt);
|
|
2017
|
+
Et(Lt, "Option", Oe);
|
|
2018
|
+
Et(Lt, "Divider", T.Divider);
|
|
2019
|
+
Et(Lt, "Heading", T.Heading);
|
|
2020
|
+
Et(Lt, "invalidLinkAppearanceProps", [ "append", "error", "prepend" ]);
|
|
2021
|
+
/* harmony default export */ const Nt = Lt;
|
|
2022
|
+
// CONCATENATED MODULE: ./src/Select/Option.tsx
|
|
2023
|
+
function Bt(e) {
|
|
2024
|
+
"@babel/helpers - typeof";
|
|
2025
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
2026
|
+
Bt = function e(t) {
|
|
2027
|
+
return typeof t;
|
|
2028
|
+
};
|
|
2029
|
+
} else {
|
|
2030
|
+
Bt = function e(t) {
|
|
2031
|
+
return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
2032
|
+
};
|
|
1712
2033
|
}
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
2034
|
+
return Bt(e);
|
|
2035
|
+
}
|
|
2036
|
+
function Kt() {
|
|
2037
|
+
Kt = Object.assign || function(e) {
|
|
2038
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
2039
|
+
var n = arguments[t];
|
|
2040
|
+
for (var r in n) {
|
|
2041
|
+
if (Object.prototype.hasOwnProperty.call(n, r)) {
|
|
2042
|
+
e[r] = n[r];
|
|
2043
|
+
}
|
|
2044
|
+
}
|
|
2045
|
+
}
|
|
2046
|
+
return e;
|
|
2047
|
+
};
|
|
2048
|
+
return Kt.apply(this, arguments);
|
|
2049
|
+
}
|
|
2050
|
+
function Ft(e, t) {
|
|
2051
|
+
if (!(e instanceof t)) {
|
|
2052
|
+
throw new TypeError("Cannot call a class as a function");
|
|
1721
2053
|
}
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
2054
|
+
}
|
|
2055
|
+
function $t(e, t) {
|
|
2056
|
+
for (var n = 0; n < t.length; n++) {
|
|
2057
|
+
var r = t[n];
|
|
2058
|
+
r.enumerable = r.enumerable || false;
|
|
2059
|
+
r.configurable = true;
|
|
2060
|
+
if ("value" in r) r.writable = true;
|
|
2061
|
+
Object.defineProperty(e, r.key, r);
|
|
1726
2062
|
}
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
2063
|
+
}
|
|
2064
|
+
function Ht(e, t, n) {
|
|
2065
|
+
if (t) $t(e.prototype, t);
|
|
2066
|
+
if (n) $t(e, n);
|
|
2067
|
+
return e;
|
|
2068
|
+
}
|
|
2069
|
+
function Wt(e, t) {
|
|
2070
|
+
if (typeof t !== "function" && t !== null) {
|
|
2071
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
1730
2072
|
}
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
2073
|
+
e.prototype = Object.create(t && t.prototype, {
|
|
2074
|
+
constructor: {
|
|
2075
|
+
value: e,
|
|
2076
|
+
writable: true,
|
|
2077
|
+
configurable: true
|
|
2078
|
+
}
|
|
1736
2079
|
});
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
2080
|
+
if (t) zt(e, t);
|
|
2081
|
+
}
|
|
2082
|
+
function zt(e, t) {
|
|
2083
|
+
zt = Object.setPrototypeOf || function e(t, n) {
|
|
2084
|
+
t.__proto__ = n;
|
|
2085
|
+
return t;
|
|
2086
|
+
};
|
|
2087
|
+
return zt(e, t);
|
|
2088
|
+
}
|
|
2089
|
+
function Ut(e) {
|
|
2090
|
+
var t = Qt();
|
|
2091
|
+
return function n() {
|
|
2092
|
+
var r = Xt(e), o;
|
|
2093
|
+
if (t) {
|
|
2094
|
+
var a = Xt(this).constructor;
|
|
2095
|
+
o = Reflect.construct(r, arguments, a);
|
|
2096
|
+
} else {
|
|
2097
|
+
o = r.apply(this, arguments);
|
|
2098
|
+
}
|
|
2099
|
+
return Gt(this, o);
|
|
2100
|
+
};
|
|
2101
|
+
}
|
|
2102
|
+
function Gt(e, t) {
|
|
2103
|
+
if (t && (Bt(t) === "object" || typeof t === "function")) {
|
|
2104
|
+
return t;
|
|
1757
2105
|
}
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
2106
|
+
return Jt(e);
|
|
2107
|
+
}
|
|
2108
|
+
function Jt(e) {
|
|
2109
|
+
if (e === void 0) {
|
|
2110
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1761
2111
|
}
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
tabIndex: -1
|
|
1774
|
-
}), /*#__PURE__*/external_react_default().createElement(Menu_namespaceObject.Divider, {
|
|
1775
|
-
key: "selectAllDivider"
|
|
1776
|
-
}));
|
|
1777
|
-
}
|
|
1778
|
-
|
|
1779
|
-
_this.displayedValues = children.reduce(function (acc, item) {
|
|
1780
|
-
if (isOption(item)) {
|
|
1781
|
-
acc.push(item.props.value);
|
|
2112
|
+
return e;
|
|
2113
|
+
}
|
|
2114
|
+
function Qt() {
|
|
2115
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
2116
|
+
if (Reflect.construct.sham) return false;
|
|
2117
|
+
if (typeof Proxy === "function") return true;
|
|
2118
|
+
try {
|
|
2119
|
+
Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
|
|
2120
|
+
return true;
|
|
2121
|
+
} catch (e) {
|
|
2122
|
+
return false;
|
|
1782
2123
|
}
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
if (suffixLabel) {
|
|
1800
|
-
wrappedLabel = castArray_default()(wrappedLabel).concat(" ".concat(suffixLabel));
|
|
1801
|
-
}
|
|
1802
|
-
|
|
1803
|
-
return wrappedLabel;
|
|
1804
|
-
});
|
|
1805
|
-
|
|
1806
|
-
SelectBase_defineProperty(SelectBase_assertThisInitialized(_this), "handleDropdownMount", function (c) {
|
|
1807
|
-
_this.dropdown = c;
|
|
1808
|
-
});
|
|
1809
|
-
|
|
1810
|
-
_this.state = {
|
|
1811
|
-
activeIndex: 0,
|
|
1812
|
-
filterKeyword: '',
|
|
1813
|
-
open: false,
|
|
1814
|
-
textHasFocus: false,
|
|
1815
|
-
topValues: [],
|
|
1816
|
-
values: props.defaultValues || []
|
|
1817
|
-
};
|
|
1818
|
-
_this.controlledExternally = has_default()(props, 'values');
|
|
1819
|
-
_this.displayedValues = [];
|
|
1820
|
-
_this.availableOptionCount = 0;
|
|
1821
|
-
_this.firstSelectedOptionIndex = undefined;
|
|
1822
|
-
_this.selectedOptionCount = 0;
|
|
1823
|
-
_this.matchCharacter = null;
|
|
1824
|
-
_this.matchTimeout = null;
|
|
1825
|
-
_this.currentMatchOptions = [];
|
|
1826
|
-
_this.availableMatchOptions = [];
|
|
1827
|
-
_this.optionRefsByKey = {};
|
|
1828
|
-
_this.optionSelection = 'none';
|
|
1829
|
-
|
|
1830
|
-
if (false) {}
|
|
1831
|
-
|
|
1832
|
-
if (false) {}
|
|
1833
|
-
|
|
1834
|
-
SelectBase.validateAppearance(props);
|
|
1835
|
-
_this.menuId = (0,id_namespaceObject.createDOMID)('menu');
|
|
1836
|
-
_this.activeItemId = (0,id_namespaceObject.createDOMID)('active-item');
|
|
1837
|
-
return _this;
|
|
1838
|
-
}
|
|
1839
|
-
|
|
1840
|
-
SelectBase_createClass(SelectBase, [{
|
|
1841
|
-
key: "componentDidUpdate",
|
|
1842
|
-
value: function componentDidUpdate(prevProps, prevState) {
|
|
1843
|
-
if (false) {}
|
|
1844
|
-
|
|
1845
|
-
if (false) {}
|
|
1846
|
-
|
|
1847
|
-
SelectBase.validateAppearance(this.props);
|
|
1848
|
-
this.previousActiveIndex = prevState.activeIndex;
|
|
1849
|
-
}
|
|
1850
|
-
}, {
|
|
1851
|
-
key: "getCurrentValues",
|
|
1852
|
-
value: function getCurrentValues() {
|
|
1853
|
-
var values = this.isControlled() ? this.props.values : this.state.values;
|
|
1854
|
-
return this.props.multiple || values == null ? values : values.slice(0, 1);
|
|
1855
|
-
}
|
|
1856
|
-
}, {
|
|
1857
|
-
key: "getTopValues",
|
|
1858
|
-
value: function getTopValues() {
|
|
1859
|
-
var _this$getCurrentValue6;
|
|
1860
|
-
|
|
1861
|
-
// in non-multiple mode, don't move values to the top of the list
|
|
1862
|
-
return this.props.multiple && this.props.showSelectedValuesFirst !== 'never' ? (_this$getCurrentValue6 = this.getCurrentValues()) !== null && _this$getCurrentValue6 !== void 0 ? _this$getCurrentValue6 : [] : [];
|
|
1863
|
-
}
|
|
1864
|
-
}, {
|
|
1865
|
-
key: "isControlled",
|
|
1866
|
-
value: function isControlled() {
|
|
1867
|
-
return this.controlledExternally;
|
|
1868
|
-
}
|
|
1869
|
-
}, {
|
|
1870
|
-
key: "hasFilter",
|
|
1871
|
-
value: function hasFilter() {
|
|
1872
|
-
return !!this.props.filter;
|
|
1873
|
-
}
|
|
1874
|
-
}, {
|
|
1875
|
-
key: "toggleValue",
|
|
1876
|
-
value: function toggleValue(e, value) {
|
|
1877
|
-
var _this$getCurrentValue7, _this$props$onChange3, _this$props14;
|
|
1878
|
-
|
|
1879
|
-
var values = (_this$getCurrentValue7 = this.getCurrentValues()) !== null && _this$getCurrentValue7 !== void 0 ? _this$getCurrentValue7 : [];
|
|
1880
|
-
var currentIndex = values.indexOf(value);
|
|
1881
|
-
var _this$props13 = this.props,
|
|
1882
|
-
name = _this$props13.name,
|
|
1883
|
-
multiple = _this$props13.multiple;
|
|
1884
|
-
var newValues;
|
|
1885
|
-
|
|
1886
|
-
if (multiple) {
|
|
1887
|
-
if (currentIndex >= 0) {
|
|
1888
|
-
newValues = [].concat(_toConsumableArray(values.slice(0, currentIndex)), _toConsumableArray(values.slice(currentIndex + 1)));
|
|
2124
|
+
}
|
|
2125
|
+
function Xt(e) {
|
|
2126
|
+
Xt = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
|
|
2127
|
+
return t.__proto__ || Object.getPrototypeOf(t);
|
|
2128
|
+
};
|
|
2129
|
+
return Xt(e);
|
|
2130
|
+
}
|
|
2131
|
+
function Yt(e, t, n) {
|
|
2132
|
+
if (t in e) {
|
|
2133
|
+
Object.defineProperty(e, t, {
|
|
2134
|
+
value: n,
|
|
2135
|
+
enumerable: true,
|
|
2136
|
+
configurable: true,
|
|
2137
|
+
writable: true
|
|
2138
|
+
});
|
|
1889
2139
|
} else {
|
|
1890
|
-
|
|
2140
|
+
e[t] = n;
|
|
1891
2141
|
}
|
|
1892
|
-
|
|
1893
|
-
// non-multiple mode must always have a value
|
|
1894
|
-
newValues = [value];
|
|
1895
|
-
}
|
|
1896
|
-
|
|
1897
|
-
var uncontrolled = !this.isControlled();
|
|
1898
|
-
|
|
1899
|
-
if (uncontrolled) {
|
|
1900
|
-
this.setState({
|
|
1901
|
-
values: newValues
|
|
1902
|
-
});
|
|
1903
|
-
}
|
|
1904
|
-
|
|
1905
|
-
if (multiple) {
|
|
1906
|
-
// in uncontrolled multiple mode, keep the menu open
|
|
1907
|
-
if (uncontrolled) {
|
|
1908
|
-
this.setState({
|
|
1909
|
-
open: true
|
|
1910
|
-
});
|
|
1911
|
-
}
|
|
1912
|
-
} else {
|
|
1913
|
-
// non-multiple mode only supports a single selection
|
|
1914
|
-
// so close the menu once a selection is made
|
|
1915
|
-
this.handleRequestClose({
|
|
1916
|
-
reason: 'contentClick'
|
|
1917
|
-
});
|
|
1918
|
-
this.focus();
|
|
1919
|
-
}
|
|
1920
|
-
|
|
1921
|
-
(_this$props$onChange3 = (_this$props14 = this.props).onChange) === null || _this$props$onChange3 === void 0 ? void 0 : _this$props$onChange3.call(_this$props14, e, {
|
|
1922
|
-
values: newValues,
|
|
1923
|
-
name: name,
|
|
1924
|
-
reason: 'valueToggle'
|
|
1925
|
-
});
|
|
2142
|
+
return e;
|
|
1926
2143
|
}
|
|
2144
|
+
var Zt = {
|
|
2145
|
+
/** @private */
|
|
2146
|
+
active: a().bool,
|
|
2147
|
+
children: a().node,
|
|
2148
|
+
description: a().string,
|
|
2149
|
+
descriptionPosition: a().oneOf([ "right", "bottom" ]),
|
|
2150
|
+
disabled: a().bool,
|
|
2151
|
+
hidden: a().bool,
|
|
2152
|
+
icon: a().node,
|
|
2153
|
+
label: a().string.isRequired,
|
|
2154
|
+
matchRanges: a().arrayOf(a().shape({
|
|
2155
|
+
start: a().number.isRequired,
|
|
2156
|
+
end: a().number.isRequired
|
|
2157
|
+
})),
|
|
2158
|
+
/** @private */
|
|
2159
|
+
onClick: a().func,
|
|
2160
|
+
/** @private */
|
|
2161
|
+
selected: a().bool,
|
|
2162
|
+
truncate: a().bool,
|
|
2163
|
+
value: a().oneOfType([ a().string, a().number, a().bool ]).isRequired
|
|
2164
|
+
};
|
|
2165
|
+
var en = {
|
|
2166
|
+
active: false,
|
|
2167
|
+
descriptionPosition: "bottom",
|
|
2168
|
+
disabled: false,
|
|
2169
|
+
hidden: false,
|
|
2170
|
+
selected: false,
|
|
2171
|
+
truncate: false
|
|
2172
|
+
};
|
|
1927
2173
|
/**
|
|
1928
|
-
* Place focus on the toggle.
|
|
1929
|
-
*/
|
|
1930
|
-
|
|
1931
|
-
}, {
|
|
1932
|
-
key: "focus",
|
|
1933
|
-
value: function focus() {
|
|
1934
|
-
var _this$dropdown;
|
|
1935
|
-
|
|
1936
|
-
(_this$dropdown = this.dropdown) === null || _this$dropdown === void 0 ? void 0 : _this$dropdown.focus();
|
|
1937
|
-
}
|
|
1938
|
-
}, {
|
|
1939
|
-
key: "renderControls",
|
|
1940
|
-
value: function renderControls(_ref5) {
|
|
1941
|
-
var hasChildren = _ref5.hasChildren,
|
|
1942
|
-
placement = _ref5.placement;
|
|
1943
|
-
var filterKeyword = this.state.filterKeyword;
|
|
1944
|
-
var _this$props15 = this.props,
|
|
1945
|
-
inputId = _this$props15.inputId,
|
|
1946
|
-
inputRef = _this$props15.inputRef,
|
|
1947
|
-
multiple = _this$props15.multiple,
|
|
1948
|
-
selectAllAppearance = _this$props15.selectAllAppearance;
|
|
1949
|
-
|
|
1950
|
-
var selectAllLabel = (0,i18n_namespaceObject._)("Select all options".concat(this.optionSelection === 'all' ? ' disabled' : ''));
|
|
1951
|
-
|
|
1952
|
-
var clearAllLabel = (0,i18n_namespaceObject._)("Clear all options".concat(this.optionSelection === 'none' ? ' disabled' : '')); // only visually disable these as opposed to fully disabling to avoid losing keyboard focus - see SUI-2731
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
var selectControls = /*#__PURE__*/external_react_default().createElement(StyledToggleAllControls, {
|
|
1956
|
-
$placement: placement,
|
|
1957
|
-
key: "selectAll"
|
|
1958
|
-
}, /*#__PURE__*/external_react_default().createElement(StyledControlsLink, {
|
|
1959
|
-
$disabled: this.optionSelection === 'all',
|
|
1960
|
-
"aria-label": selectAllLabel,
|
|
1961
|
-
onClick: this.handleSelectAll,
|
|
1962
|
-
"data-test": "select-all"
|
|
1963
|
-
}, filterKeyword ? (0,i18n_namespaceObject._)('Select All Matches') : (0,i18n_namespaceObject._)('Select All')), /*#__PURE__*/external_react_default().createElement(StyledControlsLink, {
|
|
1964
|
-
$disabled: this.optionSelection === 'none',
|
|
1965
|
-
"aria-label": clearAllLabel,
|
|
1966
|
-
onClick: this.handleClearAll,
|
|
1967
|
-
"data-test": "clear-all"
|
|
1968
|
-
}, filterKeyword ? (0,i18n_namespaceObject._)('Clear All Matches') : (0,i18n_namespaceObject._)('Clear All')));
|
|
1969
|
-
return this.hasFilter() && /*#__PURE__*/external_react_default().createElement("div", {
|
|
1970
|
-
key: "controls"
|
|
1971
|
-
}, /*#__PURE__*/external_react_default().createElement(StyledFilter, {
|
|
1972
|
-
key: "filter",
|
|
1973
|
-
"data-test": "filter"
|
|
1974
|
-
}, /*#__PURE__*/external_react_default().createElement((Text_default()), {
|
|
1975
|
-
value: filterKeyword,
|
|
1976
|
-
autoCapitalize: "off",
|
|
1977
|
-
autoComplete: "off",
|
|
1978
|
-
autoCorrect: "off",
|
|
1979
|
-
spellCheck: false,
|
|
1980
|
-
onChange: this.handleTextChange,
|
|
1981
|
-
onKeyDown: this.handleTextKeyDown,
|
|
1982
|
-
onFocus: this.handleTextFocus,
|
|
1983
|
-
onBlur: this.handleTextBlur,
|
|
1984
|
-
placeholder: (0,i18n_namespaceObject._)('filter'),
|
|
1985
|
-
role: "combobox",
|
|
1986
|
-
"aria-expanded": "true",
|
|
1987
|
-
"aria-label": (0,i18n_namespaceObject._)('Filter'),
|
|
1988
|
-
"aria-activedescendant": this.activeItemId,
|
|
1989
|
-
inputRef: inputRef,
|
|
1990
|
-
inputId: inputId,
|
|
1991
|
-
canClear: true,
|
|
1992
|
-
startAdornment: /*#__PURE__*/external_react_default().createElement(StyledSearchIconWrapper, null, /*#__PURE__*/external_react_default().createElement(icons_Search, null))
|
|
1993
|
-
})), multiple && hasChildren && selectAllAppearance === 'buttongroup' && selectControls);
|
|
1994
|
-
}
|
|
1995
|
-
}, {
|
|
1996
|
-
key: "render",
|
|
1997
|
-
value: function render() {
|
|
1998
|
-
var _this$getCurrentValue8,
|
|
1999
|
-
_this2 = this;
|
|
2000
|
-
|
|
2001
|
-
var _this$props16 = this.props,
|
|
2002
|
-
children = _this$props16.children,
|
|
2003
|
-
defaultPlacement = _this$props16.defaultPlacement,
|
|
2004
|
-
inputId = _this$props16.inputId,
|
|
2005
|
-
multiple = _this$props16.multiple,
|
|
2006
|
-
repositionMode = _this$props16.repositionMode;
|
|
2007
|
-
var filterEnabled = this.hasFilter();
|
|
2008
|
-
var currentValues = (_this$getCurrentValue8 = this.getCurrentValues()) !== null && _this$getCurrentValue8 !== void 0 ? _this$getCurrentValue8 : [];
|
|
2009
|
-
var childrenArray = external_react_namespaceObject.Children.toArray(children);
|
|
2010
|
-
var isAnyValueSelected = currentValues.some(function (value) {
|
|
2011
|
-
var matchedItem = find_default()(childrenArray, function (item) {
|
|
2012
|
-
return isOption(item) && item.props.value === value;
|
|
2013
|
-
});
|
|
2014
|
-
return matchedItem && !matchedItem.props.disabled;
|
|
2015
|
-
});
|
|
2016
|
-
var finalChildren = this.createChildren();
|
|
2017
|
-
var toggle = this.createToggle();
|
|
2018
|
-
|
|
2019
|
-
var createMenu = function createMenu(_ref6) {
|
|
2020
|
-
var anchorWidth = _ref6.anchorWidth,
|
|
2021
|
-
maxHeight = _ref6.maxHeight,
|
|
2022
|
-
placement = _ref6.placement;
|
|
2023
|
-
var internalMenuStyle = getInlineMenuStyle({
|
|
2024
|
-
anchorWidth: anchorWidth,
|
|
2025
|
-
isMultiple: _this2.props.multiple,
|
|
2026
|
-
menuStyle: _this2.props.menuStyle
|
|
2027
|
-
});
|
|
2028
|
-
var tabIndex = currentValues.length > 0 && !isAnyValueSelected && !_this2.hasFilter() ? 0 : undefined;
|
|
2029
|
-
return /*#__PURE__*/external_react_default().createElement((ResultsMenu_default()), SelectBase_extends({
|
|
2030
|
-
"aria-multiselectable": multiple || undefined,
|
|
2031
|
-
childrenStart: _this2.renderControls({
|
|
2032
|
-
placement: placement,
|
|
2033
|
-
hasChildren: !!finalChildren.length
|
|
2034
|
-
}),
|
|
2035
|
-
controlledExternally: _this2.hasFilter(),
|
|
2036
|
-
placement: placement !== null && placement !== void 0 ? placement : undefined,
|
|
2037
|
-
maxHeight: maxHeight !== null && maxHeight !== void 0 ? maxHeight : undefined,
|
|
2038
|
-
onScrollBottom: _this2.props.onScrollBottom ? _this2.handleScrollBottom : undefined,
|
|
2039
|
-
"data-test": "results-menu",
|
|
2040
|
-
isLoading: _this2.props.isLoadingOptions,
|
|
2041
|
-
id: _this2.menuId
|
|
2042
|
-
}, pick_default()(_this2.props, 'noOptionsMessage', 'footerMessage', 'animateLoading', 'loadingMessage', 'onScroll'), {
|
|
2043
|
-
style: internalMenuStyle,
|
|
2044
|
-
tabIndex: tabIndex
|
|
2045
|
-
}), finalChildren);
|
|
2046
|
-
};
|
|
2047
|
-
|
|
2048
|
-
return /*#__PURE__*/external_react_default().createElement((Dropdown_default()), {
|
|
2049
|
-
closeReasons: dropdownCloseReasons,
|
|
2050
|
-
inputId: inputId,
|
|
2051
|
-
toggle: toggle,
|
|
2052
|
-
onRequestOpen: this.handleRequestOpen,
|
|
2053
|
-
onRequestClose: this.handleRequestClose,
|
|
2054
|
-
open: this.state.open,
|
|
2055
|
-
openWithArrowKeys: true,
|
|
2056
|
-
repositionMode: repositionMode,
|
|
2057
|
-
defaultPlacement: filterEnabled ? defaultPlacement : undefined,
|
|
2058
|
-
canCoverAnchor: getWindow().innerHeight < 500,
|
|
2059
|
-
ref: this.handleDropdownMount,
|
|
2060
|
-
retainFocus: false,
|
|
2061
|
-
takeFocus: currentValues.length === 0 || currentValues.length > 0 && !isAnyValueSelected || !!filterEnabled
|
|
2062
|
-
}, createMenu);
|
|
2063
|
-
}
|
|
2064
|
-
}]);
|
|
2065
|
-
|
|
2066
|
-
return SelectBase;
|
|
2067
|
-
}(external_react_namespaceObject.Component);
|
|
2068
|
-
|
|
2069
|
-
SelectBase_defineProperty(SelectBase, "propTypes", SelectBase_propTypes);
|
|
2070
|
-
|
|
2071
|
-
SelectBase_defineProperty(SelectBase, "defaultProps", SelectBase_defaultProps);
|
|
2072
|
-
|
|
2073
|
-
SelectBase_defineProperty(SelectBase, "Option", OptionBase);
|
|
2074
|
-
|
|
2075
|
-
SelectBase_defineProperty(SelectBase, "Divider", Menu_namespaceObject.Divider);
|
|
2076
|
-
|
|
2077
|
-
SelectBase_defineProperty(SelectBase, "Heading", Menu_namespaceObject.Heading);
|
|
2078
|
-
|
|
2079
|
-
SelectBase_defineProperty(SelectBase, "invalidLinkAppearanceProps", ['append', 'error', 'prepend']);
|
|
2080
|
-
|
|
2081
|
-
/* harmony default export */ const Select_SelectBase = (SelectBase);
|
|
2082
|
-
|
|
2083
|
-
;// CONCATENATED MODULE: ./src/Select/Option.tsx
|
|
2084
|
-
function Option_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Option_typeof = function _typeof(obj) { return typeof obj; }; } else { Option_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Option_typeof(obj); }
|
|
2085
|
-
|
|
2086
|
-
function Option_extends() { Option_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Option_extends.apply(this, arguments); }
|
|
2087
|
-
|
|
2088
|
-
function Option_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2089
|
-
|
|
2090
|
-
function Option_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
2091
|
-
|
|
2092
|
-
function Option_createClass(Constructor, protoProps, staticProps) { if (protoProps) Option_defineProperties(Constructor.prototype, protoProps); if (staticProps) Option_defineProperties(Constructor, staticProps); return Constructor; }
|
|
2093
|
-
|
|
2094
|
-
function Option_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) Option_setPrototypeOf(subClass, superClass); }
|
|
2095
|
-
|
|
2096
|
-
function Option_setPrototypeOf(o, p) { Option_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Option_setPrototypeOf(o, p); }
|
|
2097
|
-
|
|
2098
|
-
function Option_createSuper(Derived) { var hasNativeReflectConstruct = Option_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Option_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Option_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Option_possibleConstructorReturn(this, result); }; }
|
|
2099
|
-
|
|
2100
|
-
function Option_possibleConstructorReturn(self, call) { if (call && (Option_typeof(call) === "object" || typeof call === "function")) { return call; } return Option_assertThisInitialized(self); }
|
|
2101
|
-
|
|
2102
|
-
function Option_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
2103
|
-
|
|
2104
|
-
function Option_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
2105
|
-
|
|
2106
|
-
function Option_getPrototypeOf(o) { Option_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Option_getPrototypeOf(o); }
|
|
2107
|
-
|
|
2108
|
-
function Option_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
var Option_propTypes = {
|
|
2114
|
-
/** @private */
|
|
2115
|
-
active: (external_prop_types_default()).bool,
|
|
2116
|
-
children: (external_prop_types_default()).node,
|
|
2117
|
-
description: (external_prop_types_default()).string,
|
|
2118
|
-
descriptionPosition: external_prop_types_default().oneOf(['right', 'bottom']),
|
|
2119
|
-
disabled: (external_prop_types_default()).bool,
|
|
2120
|
-
hidden: (external_prop_types_default()).bool,
|
|
2121
|
-
icon: (external_prop_types_default()).node,
|
|
2122
|
-
label: (external_prop_types_default()).string.isRequired,
|
|
2123
|
-
matchRanges: external_prop_types_default().arrayOf(external_prop_types_default().shape({
|
|
2124
|
-
start: (external_prop_types_default()).number.isRequired,
|
|
2125
|
-
end: (external_prop_types_default()).number.isRequired
|
|
2126
|
-
})),
|
|
2127
|
-
|
|
2128
|
-
/** @private */
|
|
2129
|
-
onClick: (external_prop_types_default()).func,
|
|
2130
|
-
|
|
2131
|
-
/** @private */
|
|
2132
|
-
selected: (external_prop_types_default()).bool,
|
|
2133
|
-
truncate: (external_prop_types_default()).bool,
|
|
2134
|
-
value: external_prop_types_default().oneOfType([(external_prop_types_default()).string, (external_prop_types_default()).number, (external_prop_types_default()).bool]).isRequired
|
|
2135
|
-
};
|
|
2136
|
-
var Option_defaultProps = {
|
|
2137
|
-
active: false,
|
|
2138
|
-
descriptionPosition: 'bottom',
|
|
2139
|
-
disabled: false,
|
|
2140
|
-
hidden: false,
|
|
2141
|
-
selected: false,
|
|
2142
|
-
truncate: false
|
|
2143
|
-
};
|
|
2144
|
-
|
|
2145
|
-
/**
|
|
2146
2174
|
* An option within a `Select`. This inherits from
|
|
2147
2175
|
* [PureComponent](https://reactjs.org/docs/react-api.html#reactpurecomponent)
|
|
2148
2176
|
* so any elements passed to it must also be pure.
|
|
2149
|
-
*/
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
return _this;
|
|
2173
|
-
}
|
|
2174
|
-
|
|
2175
|
-
Option_createClass(Option, [{
|
|
2176
|
-
key: "scrollIntoViewIfNeeded",
|
|
2177
|
-
value: function scrollIntoViewIfNeeded() {
|
|
2178
|
-
var _this$c;
|
|
2179
|
-
|
|
2180
|
-
(_this$c = this.c) === null || _this$c === void 0 ? void 0 : _this$c.scrollIntoViewIfNeeded();
|
|
2181
|
-
}
|
|
2182
|
-
/**
|
|
2177
|
+
*/ var tn = function(e) {
|
|
2178
|
+
Wt(n, e);
|
|
2179
|
+
var t = Ut(n);
|
|
2180
|
+
function n() {
|
|
2181
|
+
var e;
|
|
2182
|
+
Ft(this, n);
|
|
2183
|
+
for (var r = arguments.length, o = new Array(r), a = 0; a < r; a++) {
|
|
2184
|
+
o[a] = arguments[a];
|
|
2185
|
+
}
|
|
2186
|
+
e = t.call.apply(t, [ this ].concat(o));
|
|
2187
|
+
Yt(Jt(e), "c", null);
|
|
2188
|
+
Yt(Jt(e), "handleMount", (function(t) {
|
|
2189
|
+
e.c = t;
|
|
2190
|
+
}));
|
|
2191
|
+
return e;
|
|
2192
|
+
}
|
|
2193
|
+
Ht(n, [ {
|
|
2194
|
+
key: "scrollIntoViewIfNeeded",
|
|
2195
|
+
value: function e() {
|
|
2196
|
+
var t;
|
|
2197
|
+
(t = this.c) === null || t === void 0 ? void 0 : t.scrollIntoViewIfNeeded();
|
|
2198
|
+
}
|
|
2199
|
+
/**
|
|
2183
2200
|
* Place focus on the button.
|
|
2184
|
-
*/
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
/** @public */
|
|
2250
|
-
|
|
2251
|
-
var Select_propTypes = {
|
|
2252
|
-
allowKeyMatching: (external_prop_types_default()).bool,
|
|
2253
|
-
animateLoading: (external_prop_types_default()).bool,
|
|
2254
|
-
appearance: external_prop_types_default().oneOf(['default', 'link', 'primary', 'pill', 'toggle', 'flat']),
|
|
2255
|
-
append: (external_prop_types_default()).bool,
|
|
2256
|
-
children: (external_prop_types_default()).node,
|
|
2257
|
-
defaultPlacement: external_prop_types_default().oneOf(['above', 'below', 'vertical']),
|
|
2258
|
-
defaultValue: external_prop_types_default().oneOfType([(external_prop_types_default()).string, (external_prop_types_default()).number, (external_prop_types_default()).bool]),
|
|
2259
|
-
describedBy: (external_prop_types_default()).string,
|
|
2260
|
-
disabled: (external_prop_types_default()).bool,
|
|
2261
|
-
elementRef: external_prop_types_default().oneOfType([(external_prop_types_default()).func, (external_prop_types_default()).object]),
|
|
2262
|
-
error: (external_prop_types_default()).bool,
|
|
2263
|
-
filter: external_prop_types_default().oneOf([false, true, 'controlled']),
|
|
2264
|
-
footerMessage: (external_prop_types_default()).node,
|
|
2265
|
-
inline: (external_prop_types_default()).bool,
|
|
2266
|
-
inputId: (external_prop_types_default()).string,
|
|
2267
|
-
inputRef: external_prop_types_default().oneOfType([(external_prop_types_default()).func, (external_prop_types_default()).object]),
|
|
2268
|
-
isLoadingOptions: (external_prop_types_default()).bool,
|
|
2269
|
-
labelledBy: (external_prop_types_default()).string,
|
|
2270
|
-
labelText: (external_prop_types_default()).string,
|
|
2271
|
-
loadingMessage: (external_prop_types_default()).node,
|
|
2272
|
-
menuStyle: (external_prop_types_default()).object,
|
|
2273
|
-
name: (external_prop_types_default()).string,
|
|
2274
|
-
noOptionsMessage: (external_prop_types_default()).node,
|
|
2275
|
-
onChange: (external_prop_types_default()).func,
|
|
2276
|
-
onClose: (external_prop_types_default()).func,
|
|
2277
|
-
onFilterChange: (external_prop_types_default()).func,
|
|
2278
|
-
onOpen: (external_prop_types_default()).func,
|
|
2279
|
-
onScroll: (external_prop_types_default()).func,
|
|
2280
|
-
onScrollBottom: (external_prop_types_default()).func,
|
|
2281
|
-
placeholder: (external_prop_types_default()).string,
|
|
2282
|
-
prefixLabel: (external_prop_types_default()).string,
|
|
2283
|
-
prepend: (external_prop_types_default()).bool,
|
|
2284
|
-
suffixLabel: (external_prop_types_default()).string,
|
|
2285
|
-
value: external_prop_types_default().oneOfType([(external_prop_types_default()).string, (external_prop_types_default()).number, (external_prop_types_default()).bool])
|
|
2286
|
-
};
|
|
2287
|
-
var Select_defaultProps = {
|
|
2288
|
-
allowKeyMatching: true,
|
|
2289
|
-
animateLoading: false,
|
|
2290
|
-
appearance: 'toggle',
|
|
2291
|
-
append: false,
|
|
2292
|
-
children: [],
|
|
2293
|
-
defaultPlacement: 'vertical',
|
|
2294
|
-
disabled: false,
|
|
2295
|
-
error: false,
|
|
2296
|
-
filter: false,
|
|
2297
|
-
inline: true,
|
|
2298
|
-
isLoadingOptions: false,
|
|
2299
|
-
menuStyle: {},
|
|
2300
|
-
noOptionsMessage: (0,i18n_namespaceObject._)('No matches'),
|
|
2301
|
-
placeholder: (0,i18n_namespaceObject._)('Select...'),
|
|
2302
|
-
prepend: false
|
|
2303
|
-
};
|
|
2304
|
-
|
|
2305
|
-
var Select = /*#__PURE__*/function (_Component) {
|
|
2306
|
-
Select_inherits(Select, _Component);
|
|
2307
|
-
|
|
2308
|
-
var _super = Select_createSuper(Select);
|
|
2309
|
-
|
|
2310
|
-
// @docs-props-type SelectPropsBase
|
|
2311
|
-
function Select(props) {
|
|
2312
|
-
var _this;
|
|
2313
|
-
|
|
2314
|
-
Select_classCallCheck(this, Select);
|
|
2315
|
-
|
|
2316
|
-
_this = _super.call(this, props);
|
|
2317
|
-
var state = {}; // wrap defaultValue in an array once to avoid failing <SelectBase>'s defaultValues comparison check
|
|
2318
|
-
// using "has" to make sure that pre-4.3 behavior is preserved if a user explicitly passes "null" or "undefined"
|
|
2319
|
-
|
|
2320
|
-
if (has_default()(props, 'defaultValue')) {
|
|
2321
|
-
if (props.defaultValue != null) {
|
|
2322
|
-
state.defaultValues = [props.defaultValue];
|
|
2323
|
-
} else {
|
|
2324
|
-
state.defaultValues = [];
|
|
2325
|
-
}
|
|
2326
|
-
}
|
|
2327
|
-
|
|
2328
|
-
_this.state = state;
|
|
2329
|
-
return _this;
|
|
2330
|
-
}
|
|
2331
|
-
|
|
2332
|
-
Select_createClass(Select, [{
|
|
2333
|
-
key: "componentDidUpdate",
|
|
2334
|
-
value: function componentDidUpdate(prevProps) {
|
|
2335
|
-
if (false) {}
|
|
2336
|
-
}
|
|
2337
|
-
}, {
|
|
2338
|
-
key: "render",
|
|
2339
|
-
value: function render() {
|
|
2340
|
-
var _this$props = this.props,
|
|
2341
|
-
defaultValue = _this$props.defaultValue,
|
|
2342
|
-
_onChange = _this$props.onChange,
|
|
2343
|
-
value = _this$props.value,
|
|
2344
|
-
otherProps = Select_objectWithoutProperties(_this$props, ["defaultValue", "onChange", "value"]);
|
|
2345
|
-
|
|
2346
|
-
var convertedProps = {
|
|
2347
|
-
onChange: function onChange(e, _ref) {
|
|
2348
|
-
var name = _ref.name,
|
|
2349
|
-
values = _ref.values;
|
|
2350
|
-
_onChange === null || _onChange === void 0 ? void 0 : _onChange(e, {
|
|
2351
|
-
name: name,
|
|
2352
|
-
value: values[0]
|
|
2353
|
-
});
|
|
2201
|
+
*/ }, {
|
|
2202
|
+
key: "focus",
|
|
2203
|
+
value: function e() {
|
|
2204
|
+
var t;
|
|
2205
|
+
(t = this.c) === null || t === void 0 ? void 0 : t.focus();
|
|
2206
|
+
}
|
|
2207
|
+
}, {
|
|
2208
|
+
key: "render",
|
|
2209
|
+
value: function e() {
|
|
2210
|
+
|
|
2211
|
+
return r().createElement(Oe, Kt({}, this.props, {
|
|
2212
|
+
multiple: false,
|
|
2213
|
+
ref: this.handleMount
|
|
2214
|
+
}), this.props.children || this.props.label);
|
|
2215
|
+
}
|
|
2216
|
+
} ]);
|
|
2217
|
+
return n;
|
|
2218
|
+
}(n.PureComponent);
|
|
2219
|
+
Yt(tn, "propTypes", Zt);
|
|
2220
|
+
Yt(tn, "defaultProps", en);
|
|
2221
|
+
/* harmony default export */ const nn = tn;
|
|
2222
|
+
// CONCATENATED MODULE: ./src/Select/Select.tsx
|
|
2223
|
+
function rn(e) {
|
|
2224
|
+
"@babel/helpers - typeof";
|
|
2225
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
2226
|
+
rn = function e(t) {
|
|
2227
|
+
return typeof t;
|
|
2228
|
+
};
|
|
2229
|
+
} else {
|
|
2230
|
+
rn = function e(t) {
|
|
2231
|
+
return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
2232
|
+
};
|
|
2233
|
+
}
|
|
2234
|
+
return rn(e);
|
|
2235
|
+
}
|
|
2236
|
+
function on() {
|
|
2237
|
+
on = Object.assign || function(e) {
|
|
2238
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
2239
|
+
var n = arguments[t];
|
|
2240
|
+
for (var r in n) {
|
|
2241
|
+
if (Object.prototype.hasOwnProperty.call(n, r)) {
|
|
2242
|
+
e[r] = n[r];
|
|
2243
|
+
}
|
|
2244
|
+
}
|
|
2245
|
+
}
|
|
2246
|
+
return e;
|
|
2247
|
+
};
|
|
2248
|
+
return on.apply(this, arguments);
|
|
2249
|
+
}
|
|
2250
|
+
function an(e, t) {
|
|
2251
|
+
if (e == null) return {};
|
|
2252
|
+
var n = ln(e, t);
|
|
2253
|
+
var r, o;
|
|
2254
|
+
if (Object.getOwnPropertySymbols) {
|
|
2255
|
+
var a = Object.getOwnPropertySymbols(e);
|
|
2256
|
+
for (o = 0; o < a.length; o++) {
|
|
2257
|
+
r = a[o];
|
|
2258
|
+
if (t.indexOf(r) >= 0) continue;
|
|
2259
|
+
if (!Object.prototype.propertyIsEnumerable.call(e, r)) continue;
|
|
2260
|
+
n[r] = e[r];
|
|
2261
|
+
}
|
|
2354
2262
|
}
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
if (
|
|
2359
|
-
|
|
2263
|
+
return n;
|
|
2264
|
+
}
|
|
2265
|
+
function ln(e, t) {
|
|
2266
|
+
if (e == null) return {};
|
|
2267
|
+
var n = {};
|
|
2268
|
+
var r = Object.keys(e);
|
|
2269
|
+
var o, a;
|
|
2270
|
+
for (a = 0; a < r.length; a++) {
|
|
2271
|
+
o = r[a];
|
|
2272
|
+
if (t.indexOf(o) >= 0) continue;
|
|
2273
|
+
n[o] = e[o];
|
|
2274
|
+
}
|
|
2275
|
+
return n;
|
|
2276
|
+
}
|
|
2277
|
+
function cn(e, t) {
|
|
2278
|
+
if (!(e instanceof t)) {
|
|
2279
|
+
throw new TypeError("Cannot call a class as a function");
|
|
2280
|
+
}
|
|
2281
|
+
}
|
|
2282
|
+
function sn(e, t) {
|
|
2283
|
+
for (var n = 0; n < t.length; n++) {
|
|
2284
|
+
var r = t[n];
|
|
2285
|
+
r.enumerable = r.enumerable || false;
|
|
2286
|
+
r.configurable = true;
|
|
2287
|
+
if ("value" in r) r.writable = true;
|
|
2288
|
+
Object.defineProperty(e, r.key, r);
|
|
2289
|
+
}
|
|
2290
|
+
}
|
|
2291
|
+
function un(e, t, n) {
|
|
2292
|
+
if (t) sn(e.prototype, t);
|
|
2293
|
+
if (n) sn(e, n);
|
|
2294
|
+
return e;
|
|
2295
|
+
}
|
|
2296
|
+
function pn(e, t) {
|
|
2297
|
+
if (typeof t !== "function" && t !== null) {
|
|
2298
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
2299
|
+
}
|
|
2300
|
+
e.prototype = Object.create(t && t.prototype, {
|
|
2301
|
+
constructor: {
|
|
2302
|
+
value: e,
|
|
2303
|
+
writable: true,
|
|
2304
|
+
configurable: true
|
|
2305
|
+
}
|
|
2306
|
+
});
|
|
2307
|
+
if (t) fn(e, t);
|
|
2308
|
+
}
|
|
2309
|
+
function fn(e, t) {
|
|
2310
|
+
fn = Object.setPrototypeOf || function e(t, n) {
|
|
2311
|
+
t.__proto__ = n;
|
|
2312
|
+
return t;
|
|
2313
|
+
};
|
|
2314
|
+
return fn(e, t);
|
|
2315
|
+
}
|
|
2316
|
+
function dn(e) {
|
|
2317
|
+
var t = bn();
|
|
2318
|
+
return function n() {
|
|
2319
|
+
var r = yn(e), o;
|
|
2320
|
+
if (t) {
|
|
2321
|
+
var a = yn(this).constructor;
|
|
2322
|
+
o = Reflect.construct(r, arguments, a);
|
|
2323
|
+
} else {
|
|
2324
|
+
o = r.apply(this, arguments);
|
|
2325
|
+
}
|
|
2326
|
+
return vn(this, o);
|
|
2327
|
+
};
|
|
2328
|
+
}
|
|
2329
|
+
function vn(e, t) {
|
|
2330
|
+
if (t && (rn(t) === "object" || typeof t === "function")) {
|
|
2331
|
+
return t;
|
|
2332
|
+
}
|
|
2333
|
+
return hn(e);
|
|
2334
|
+
}
|
|
2335
|
+
function hn(e) {
|
|
2336
|
+
if (e === void 0) {
|
|
2337
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
2338
|
+
}
|
|
2339
|
+
return e;
|
|
2340
|
+
}
|
|
2341
|
+
function bn() {
|
|
2342
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
2343
|
+
if (Reflect.construct.sham) return false;
|
|
2344
|
+
if (typeof Proxy === "function") return true;
|
|
2345
|
+
try {
|
|
2346
|
+
Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
|
|
2347
|
+
return true;
|
|
2348
|
+
} catch (e) {
|
|
2349
|
+
return false;
|
|
2350
|
+
}
|
|
2351
|
+
}
|
|
2352
|
+
function yn(e) {
|
|
2353
|
+
yn = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
|
|
2354
|
+
return t.__proto__ || Object.getPrototypeOf(t);
|
|
2355
|
+
};
|
|
2356
|
+
return yn(e);
|
|
2357
|
+
}
|
|
2358
|
+
function mn(e, t, n) {
|
|
2359
|
+
if (t in e) {
|
|
2360
|
+
Object.defineProperty(e, t, {
|
|
2361
|
+
value: n,
|
|
2362
|
+
enumerable: true,
|
|
2363
|
+
configurable: true,
|
|
2364
|
+
writable: true
|
|
2365
|
+
});
|
|
2360
2366
|
} else {
|
|
2361
|
-
|
|
2367
|
+
e[t] = n;
|
|
2368
|
+
}
|
|
2369
|
+
return e;
|
|
2370
|
+
}
|
|
2371
|
+
/* eslint-disable max-classes-per-file */
|
|
2372
|
+
/** @public */ var gn = {
|
|
2373
|
+
allowKeyMatching: a().bool,
|
|
2374
|
+
animateLoading: a().bool,
|
|
2375
|
+
appearance: a().oneOf([ "default", "link", "primary", "pill", "toggle", "flat" ]),
|
|
2376
|
+
append: a().bool,
|
|
2377
|
+
children: a().node,
|
|
2378
|
+
defaultPlacement: a().oneOf([ "above", "below", "vertical" ]),
|
|
2379
|
+
defaultValue: a().oneOfType([ a().string, a().number, a().bool ]),
|
|
2380
|
+
describedBy: a().string,
|
|
2381
|
+
disabled: a().bool,
|
|
2382
|
+
elementRef: a().oneOfType([ a().func, a().object ]),
|
|
2383
|
+
error: a().bool,
|
|
2384
|
+
filter: a().oneOf([ false, true, "controlled" ]),
|
|
2385
|
+
footerMessage: a().node,
|
|
2386
|
+
inline: a().bool,
|
|
2387
|
+
inputId: a().string,
|
|
2388
|
+
inputRef: a().oneOfType([ a().func, a().object ]),
|
|
2389
|
+
isLoadingOptions: a().bool,
|
|
2390
|
+
labelledBy: a().string,
|
|
2391
|
+
labelText: a().string,
|
|
2392
|
+
loadingMessage: a().node,
|
|
2393
|
+
menuStyle: a().object,
|
|
2394
|
+
name: a().string,
|
|
2395
|
+
noOptionsMessage: a().node,
|
|
2396
|
+
onChange: a().func,
|
|
2397
|
+
onClose: a().func,
|
|
2398
|
+
onFilterChange: a().func,
|
|
2399
|
+
onOpen: a().func,
|
|
2400
|
+
onScroll: a().func,
|
|
2401
|
+
onScrollBottom: a().func,
|
|
2402
|
+
placeholder: a().string,
|
|
2403
|
+
prefixLabel: a().string,
|
|
2404
|
+
prepend: a().bool,
|
|
2405
|
+
suffixLabel: a().string,
|
|
2406
|
+
value: a().oneOfType([ a().string, a().number, a().bool ])
|
|
2407
|
+
};
|
|
2408
|
+
var On = {
|
|
2409
|
+
allowKeyMatching: true,
|
|
2410
|
+
animateLoading: false,
|
|
2411
|
+
appearance: "toggle",
|
|
2412
|
+
append: false,
|
|
2413
|
+
children: [],
|
|
2414
|
+
defaultPlacement: "vertical",
|
|
2415
|
+
disabled: false,
|
|
2416
|
+
error: false,
|
|
2417
|
+
filter: false,
|
|
2418
|
+
inline: true,
|
|
2419
|
+
isLoadingOptions: false,
|
|
2420
|
+
menuStyle: {},
|
|
2421
|
+
noOptionsMessage: (0, c._)("No matches"),
|
|
2422
|
+
placeholder: (0, c._)("Select..."),
|
|
2423
|
+
prepend: false
|
|
2424
|
+
};
|
|
2425
|
+
var Sn = function(e) {
|
|
2426
|
+
pn(n, e);
|
|
2427
|
+
var t = dn(n);
|
|
2428
|
+
// @docs-props-type SelectPropsBase
|
|
2429
|
+
function n(e) {
|
|
2430
|
+
var r;
|
|
2431
|
+
cn(this, n);
|
|
2432
|
+
r = t.call(this, e);
|
|
2433
|
+
var o = {};
|
|
2434
|
+
// wrap defaultValue in an array once to avoid failing <SelectBase>'s defaultValues comparison check
|
|
2435
|
+
// using "has" to make sure that pre-4.3 behavior is preserved if a user explicitly passes "null" or "undefined"
|
|
2436
|
+
if (l()(e, "defaultValue")) {
|
|
2437
|
+
if (e.defaultValue != null) {
|
|
2438
|
+
o.defaultValues = [ e.defaultValue ];
|
|
2439
|
+
} else {
|
|
2440
|
+
o.defaultValues = [];
|
|
2441
|
+
}
|
|
2442
|
+
}
|
|
2443
|
+
r.state = o;
|
|
2444
|
+
return r;
|
|
2362
2445
|
}
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2446
|
+
un(n, [ {
|
|
2447
|
+
key: "componentDidUpdate",
|
|
2448
|
+
value: function e(t) {
|
|
2449
|
+
if (false) {}
|
|
2450
|
+
}
|
|
2451
|
+
}, {
|
|
2452
|
+
key: "render",
|
|
2453
|
+
value: function e() {
|
|
2454
|
+
var t = this.props, n = t.defaultValue, o = t.onChange, a = t.value, i = an(t, [ "defaultValue", "onChange", "value" ]);
|
|
2455
|
+
var c = {
|
|
2456
|
+
onChange: function e(t, n) {
|
|
2457
|
+
var r = n.name, a = n.values;
|
|
2458
|
+
o === null || o === void 0 ? void 0 : o(t, {
|
|
2459
|
+
name: r,
|
|
2460
|
+
value: a[0]
|
|
2461
|
+
});
|
|
2462
|
+
}
|
|
2463
|
+
};
|
|
2464
|
+
// using "has" as opposed to a null check to match SelectBase
|
|
2465
|
+
if (l()(this.props, "value")) {
|
|
2466
|
+
if (a != null) {
|
|
2467
|
+
c.values = [ a ];
|
|
2468
|
+
} else {
|
|
2469
|
+
c.values = [];
|
|
2470
|
+
}
|
|
2471
|
+
} else if (this.state.defaultValues != null) {
|
|
2472
|
+
// using defaultValues from state in order to avoid wrapping defaultValue here
|
|
2473
|
+
c.defaultValues = this.state.defaultValues;
|
|
2474
|
+
}
|
|
2475
|
+
|
|
2476
|
+
return r().createElement(Nt, on({}, i, c, {
|
|
2477
|
+
multiple: false
|
|
2478
|
+
}));
|
|
2479
|
+
}
|
|
2480
|
+
} ]);
|
|
2481
|
+
return n;
|
|
2482
|
+
}(n.Component);
|
|
2483
|
+
mn(Sn, "propTypes", gn);
|
|
2484
|
+
mn(Sn, "defaultProps", On);
|
|
2485
|
+
mn(Sn, "Option", nn);
|
|
2486
|
+
mn(Sn, "Heading", T.Heading);
|
|
2487
|
+
mn(Sn, "Divider", T.Divider);
|
|
2488
|
+
/* harmony default export */ const wn = Sn;
|
|
2489
|
+
// CONCATENATED MODULE: ./src/Select/index.ts
|
|
2490
|
+
module.exports = t;
|
|
2491
|
+
/******/})();
|