@splunk/react-ui 5.8.0 → 5.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Anchor.js +2 -1
- package/CHANGELOG.md +22 -0
- package/Calendar.js +134 -134
- package/Clickable.js +131 -94
- package/CollapsiblePanel.js +173 -135
- package/ComboBox.js +1 -0
- package/Dropdown.js +27 -18
- package/File.js +35 -35
- package/Menu.js +259 -215
- package/Modal.js +174 -181
- package/Monogram.js +2 -2
- package/Multiselect.js +401 -321
- package/Number.js +2 -1
- package/Search.js +15 -14
- package/SelectBase.js +777 -719
- package/Table.js +116 -119
- package/Text.js +26 -26
- package/docs-llm/Avatar.md +2 -8
- package/docs-llm/Multiselect.md +5 -3
- package/docs-llm/Notifications.md +46 -0
- package/docs-llm/Tree.md +7 -2
- package/docs-llm/llms.txt +6 -2
- package/package.json +4 -4
- package/types/src/Multiselect/Compact.d.ts +8 -3
- package/types/src/Multiselect/Multiselect.d.ts +8 -3
- package/types/src/Multiselect/Normal.d.ts +8 -3
- package/types/src/Multiselect/Option.d.ts +6 -3
- package/types/src/Multiselect/docs/examples/Disabled.d.ts +1 -0
- package/types/src/SelectBase/SelectBase.d.ts +1 -1
package/SelectBase.js
CHANGED
|
@@ -9,26 +9,26 @@
|
|
|
9
9
|
/******/ (() => {
|
|
10
10
|
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
11
11
|
/******/ e.n = r => {
|
|
12
|
-
/******/ var
|
|
12
|
+
/******/ var n = r && r.__esModule ?
|
|
13
13
|
/******/ () => r["default"]
|
|
14
14
|
/******/ : () => r
|
|
15
15
|
/******/;
|
|
16
|
-
e.d(
|
|
17
|
-
a:
|
|
16
|
+
e.d(n, {
|
|
17
|
+
a: n
|
|
18
18
|
});
|
|
19
|
-
/******/ return
|
|
19
|
+
/******/ return n;
|
|
20
20
|
/******/ };
|
|
21
21
|
/******/ })();
|
|
22
22
|
/******/
|
|
23
23
|
/******/ /* webpack/runtime/define property getters */
|
|
24
24
|
/******/ (() => {
|
|
25
25
|
/******/ // define getter functions for harmony exports
|
|
26
|
-
/******/ e.d = (r,
|
|
27
|
-
/******/ for (var
|
|
28
|
-
/******/ if (e.o(
|
|
29
|
-
/******/ Object.defineProperty(r,
|
|
26
|
+
/******/ e.d = (r, n) => {
|
|
27
|
+
/******/ for (var t in n) {
|
|
28
|
+
/******/ if (e.o(n, t) && !e.o(r, t)) {
|
|
29
|
+
/******/ Object.defineProperty(r, t, {
|
|
30
30
|
enumerable: true,
|
|
31
|
-
get: t
|
|
31
|
+
get: n[t]
|
|
32
32
|
});
|
|
33
33
|
/******/ }
|
|
34
34
|
/******/ }
|
|
@@ -61,23 +61,23 @@
|
|
|
61
61
|
e.r(r);
|
|
62
62
|
// EXPORTS
|
|
63
63
|
e.d(r, {
|
|
64
|
-
Controls: () => /* reexport */
|
|
64
|
+
Controls: () => /* reexport */ dr,
|
|
65
65
|
Divider: () => /* reexport */ w.Divider,
|
|
66
66
|
Heading: () => /* reexport */ w.Heading,
|
|
67
|
-
Option: () => /* reexport */
|
|
67
|
+
Option: () => /* reexport */ J,
|
|
68
68
|
SelectAllOption: () => /* reexport */ oe,
|
|
69
|
-
default: () => /* reexport */
|
|
70
|
-
isOption: () => /* reexport */
|
|
69
|
+
default: () => /* reexport */ gr,
|
|
70
|
+
isOption: () => /* reexport */ lr
|
|
71
71
|
});
|
|
72
72
|
// CONCATENATED MODULE: external "react"
|
|
73
|
-
const
|
|
74
|
-
var
|
|
73
|
+
const n = require("react");
|
|
74
|
+
var t = e.n(n);
|
|
75
75
|
// CONCATENATED MODULE: external "lodash/castArray"
|
|
76
76
|
const l = require("lodash/castArray");
|
|
77
77
|
var a = e.n(l);
|
|
78
78
|
// CONCATENATED MODULE: external "lodash/has"
|
|
79
|
-
const
|
|
80
|
-
var
|
|
79
|
+
const i = require("lodash/has");
|
|
80
|
+
var o = e.n(i);
|
|
81
81
|
// CONCATENATED MODULE: external "lodash/memoize"
|
|
82
82
|
const u = require("lodash/memoize");
|
|
83
83
|
var c = e.n(u);
|
|
@@ -115,101 +115,143 @@
|
|
|
115
115
|
var L = e.n(A);
|
|
116
116
|
// CONCATENATED MODULE: external "@splunk/react-ui/usePrevious"
|
|
117
117
|
const I = require("@splunk/react-ui/usePrevious");
|
|
118
|
-
var
|
|
118
|
+
var D = e.n(I);
|
|
119
119
|
// CONCATENATED MODULE: external "@splunk/ui-utils/filter"
|
|
120
|
-
const
|
|
120
|
+
const R = require("@splunk/ui-utils/filter");
|
|
121
121
|
// CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
|
|
122
|
-
const
|
|
122
|
+
const M = require("@splunk/ui-utils/i18n");
|
|
123
123
|
// CONCATENATED MODULE: external "@splunk/ui-utils/id"
|
|
124
|
-
const
|
|
124
|
+
const T = require("@splunk/ui-utils/id");
|
|
125
125
|
// CONCATENATED MODULE: external "@splunk/ui-utils/scroll"
|
|
126
|
-
const
|
|
127
|
-
// CONCATENATED MODULE: ./src/
|
|
126
|
+
const q = require("@splunk/ui-utils/scroll");
|
|
127
|
+
// CONCATENATED MODULE: ./src/utils/disabled.ts
|
|
128
|
+
/**
|
|
129
|
+
* Normalizes the disabled prop and returns both the boolean state and normalized string value.
|
|
130
|
+
* Use this function to ensure consistent handling of disabled prop across components.
|
|
131
|
+
*
|
|
132
|
+
* @param disabled - The disabled prop value
|
|
133
|
+
* @param defaultWhenBooleanTrue - Optional normalization override for disabled={true}
|
|
134
|
+
* @returns Object with isDisabled boolean|undefined and disabledValue string
|
|
135
|
+
*
|
|
136
|
+
* TODO (SUI-8600): `disabled` prop should default to 'dimmed' for data entry components
|
|
137
|
+
*/
|
|
128
138
|
function _(e) {
|
|
139
|
+
var r = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "dimmed";
|
|
140
|
+
if (e === "dimmed") {
|
|
141
|
+
return {
|
|
142
|
+
isDisabled: true,
|
|
143
|
+
disabledValue: "dimmed"
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
if (e === true) {
|
|
147
|
+
return {
|
|
148
|
+
isDisabled: true,
|
|
149
|
+
disabledValue: r
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
if (e === "disabled") {
|
|
153
|
+
return {
|
|
154
|
+
isDisabled: true,
|
|
155
|
+
disabledValue: "disabled"
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
if (e === false) {
|
|
159
|
+
return {
|
|
160
|
+
isDisabled: false,
|
|
161
|
+
disabledValue: undefined
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
return {
|
|
165
|
+
isDisabled: undefined,
|
|
166
|
+
disabledValue: undefined
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
// CONCATENATED MODULE: ./src/SelectBase/OptionBase.tsx
|
|
170
|
+
function B(e) {
|
|
129
171
|
"@babel/helpers - typeof";
|
|
130
|
-
return
|
|
172
|
+
return B = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
|
|
131
173
|
return typeof e;
|
|
132
174
|
} : function(e) {
|
|
133
175
|
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
134
|
-
},
|
|
176
|
+
}, B(e);
|
|
135
177
|
}
|
|
136
|
-
function
|
|
137
|
-
return
|
|
178
|
+
function V() {
|
|
179
|
+
return V = Object.assign ? Object.assign.bind() : function(e) {
|
|
138
180
|
for (var r = 1; r < arguments.length; r++) {
|
|
139
|
-
var
|
|
140
|
-
for (var
|
|
141
|
-
({}).hasOwnProperty.call(
|
|
181
|
+
var n = arguments[r];
|
|
182
|
+
for (var t in n) {
|
|
183
|
+
({}).hasOwnProperty.call(n, t) && (e[t] = n[t]);
|
|
142
184
|
}
|
|
143
185
|
}
|
|
144
186
|
return e;
|
|
145
|
-
},
|
|
187
|
+
}, V.apply(null, arguments);
|
|
146
188
|
}
|
|
147
189
|
function N(e, r) {
|
|
148
|
-
var
|
|
190
|
+
var n = Object.keys(e);
|
|
149
191
|
if (Object.getOwnPropertySymbols) {
|
|
150
|
-
var
|
|
151
|
-
r && (
|
|
192
|
+
var t = Object.getOwnPropertySymbols(e);
|
|
193
|
+
r && (t = t.filter((function(r) {
|
|
152
194
|
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
153
|
-
}))),
|
|
195
|
+
}))), n.push.apply(n, t);
|
|
154
196
|
}
|
|
155
|
-
return
|
|
197
|
+
return n;
|
|
156
198
|
}
|
|
157
|
-
function
|
|
199
|
+
function F(e) {
|
|
158
200
|
for (var r = 1; r < arguments.length; r++) {
|
|
159
|
-
var
|
|
160
|
-
r % 2 ? N(Object(
|
|
161
|
-
|
|
162
|
-
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(
|
|
163
|
-
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(
|
|
201
|
+
var n = null != arguments[r] ? arguments[r] : {};
|
|
202
|
+
r % 2 ? N(Object(n), !0).forEach((function(r) {
|
|
203
|
+
K(e, r, n[r]);
|
|
204
|
+
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : N(Object(n)).forEach((function(r) {
|
|
205
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(n, r));
|
|
164
206
|
}));
|
|
165
207
|
}
|
|
166
208
|
return e;
|
|
167
209
|
}
|
|
168
|
-
function
|
|
169
|
-
return (r =
|
|
170
|
-
value:
|
|
210
|
+
function K(e, r, n) {
|
|
211
|
+
return (r = H(r)) in e ? Object.defineProperty(e, r, {
|
|
212
|
+
value: n,
|
|
171
213
|
enumerable: !0,
|
|
172
214
|
configurable: !0,
|
|
173
215
|
writable: !0
|
|
174
|
-
}) : e[r] =
|
|
216
|
+
}) : e[r] = n, e;
|
|
175
217
|
}
|
|
176
|
-
function
|
|
177
|
-
var r =
|
|
178
|
-
return "symbol" ==
|
|
218
|
+
function H(e) {
|
|
219
|
+
var r = z(e, "string");
|
|
220
|
+
return "symbol" == B(r) ? r : r + "";
|
|
179
221
|
}
|
|
180
|
-
function
|
|
181
|
-
if ("object" !=
|
|
182
|
-
var
|
|
183
|
-
if (void 0 !==
|
|
184
|
-
var
|
|
185
|
-
if ("object" !=
|
|
222
|
+
function z(e, r) {
|
|
223
|
+
if ("object" != B(e) || !e) return e;
|
|
224
|
+
var n = e[Symbol.toPrimitive];
|
|
225
|
+
if (void 0 !== n) {
|
|
226
|
+
var t = n.call(e, r || "default");
|
|
227
|
+
if ("object" != B(t)) return t;
|
|
186
228
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
187
229
|
}
|
|
188
230
|
return ("string" === r ? String : Number)(e);
|
|
189
231
|
}
|
|
190
|
-
function
|
|
232
|
+
function W(e, r) {
|
|
191
233
|
if (null == e) return {};
|
|
192
|
-
var
|
|
234
|
+
var n, t, l = $(e, r);
|
|
193
235
|
if (Object.getOwnPropertySymbols) {
|
|
194
236
|
var a = Object.getOwnPropertySymbols(e);
|
|
195
|
-
for (
|
|
196
|
-
|
|
237
|
+
for (t = 0; t < a.length; t++) {
|
|
238
|
+
n = a[t], -1 === r.indexOf(n) && {}.propertyIsEnumerable.call(e, n) && (l[n] = e[n]);
|
|
197
239
|
}
|
|
198
240
|
}
|
|
199
241
|
return l;
|
|
200
242
|
}
|
|
201
|
-
function
|
|
243
|
+
function $(e, r) {
|
|
202
244
|
if (null == e) return {};
|
|
203
|
-
var
|
|
204
|
-
for (var
|
|
205
|
-
if ({}.hasOwnProperty.call(e,
|
|
206
|
-
if (-1 !== r.indexOf(
|
|
207
|
-
t
|
|
245
|
+
var n = {};
|
|
246
|
+
for (var t in e) {
|
|
247
|
+
if ({}.hasOwnProperty.call(e, t)) {
|
|
248
|
+
if (-1 !== r.indexOf(t)) continue;
|
|
249
|
+
n[t] = e[t];
|
|
208
250
|
}
|
|
209
251
|
}
|
|
210
|
-
return
|
|
252
|
+
return n;
|
|
211
253
|
}
|
|
212
|
-
var
|
|
254
|
+
var X = {
|
|
213
255
|
/** @private */
|
|
214
256
|
active: p().bool,
|
|
215
257
|
children: p().node,
|
|
@@ -240,147 +282,141 @@
|
|
|
240
282
|
};
|
|
241
283
|
/**
|
|
242
284
|
* An option within a `Multiselect`.
|
|
243
|
-
*/ function
|
|
244
|
-
var r = e.children, l = e.descriptionPosition, a = l === void 0 ? "bottom" : l,
|
|
285
|
+
*/ function U(e) {
|
|
286
|
+
var r = e.children, l = e.descriptionPosition, a = l === void 0 ? "bottom" : l, i = e.disabled, o = e.elementRef, u = e.endAdornment, c = e.icon, s = e.label, f = e.multiple, d = e.onClick, p = e.role, v = p === void 0 ? "option" : p, b = e.value, m = W(e, [ "children", "descriptionPosition", "disabled", "elementRef", "endAdornment", "icon", "label", "multiple", "onClick", "role", "value" ]);
|
|
245
287
|
// @docs-props-type OptionPropsBase
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
y = "dimmed";
|
|
250
|
-
} else if (o === true || o === "disabled") {
|
|
251
|
-
y = "disabled";
|
|
252
|
-
}
|
|
253
|
-
var g = (0, t.useCallback)((function(e) {
|
|
254
|
-
if (!y) {
|
|
288
|
+
var y = _(i, "disabled"), g = y.isDisabled, h = y.disabledValue;
|
|
289
|
+
var S = (0, n.useCallback)((function(e) {
|
|
290
|
+
if (!g) {
|
|
255
291
|
d === null || d === void 0 ? void 0 : d(e, {
|
|
256
292
|
value: b
|
|
257
293
|
});
|
|
258
294
|
}
|
|
259
|
-
}), [
|
|
260
|
-
var
|
|
261
|
-
var
|
|
295
|
+
}), [ g, d, b ]);
|
|
296
|
+
var O = b.toString();
|
|
297
|
+
var C = F({
|
|
262
298
|
descriptionPosition: a,
|
|
263
|
-
disabled:
|
|
264
|
-
"data-test-disabled":
|
|
299
|
+
disabled: h,
|
|
300
|
+
"data-test-disabled": h
|
|
265
301
|
}, m);
|
|
266
302
|
|
|
267
|
-
return
|
|
303
|
+
return t().createElement(w.Item, V({
|
|
268
304
|
"data-test-value": b,
|
|
269
305
|
"data-test": "option",
|
|
270
|
-
elementRef:
|
|
306
|
+
elementRef: o,
|
|
271
307
|
endAdornment: u
|
|
272
|
-
},
|
|
308
|
+
}, C, {
|
|
273
309
|
selectable: true,
|
|
274
310
|
selectableAppearance: f ? "checkbox" : "checkmark",
|
|
275
311
|
startAdornment: c,
|
|
276
|
-
onClick:
|
|
312
|
+
onClick: S,
|
|
277
313
|
role: v,
|
|
278
|
-
value:
|
|
314
|
+
value: O
|
|
279
315
|
}), r || s);
|
|
280
316
|
}
|
|
281
|
-
|
|
282
|
-
|
|
317
|
+
U.propTypes = X;
|
|
318
|
+
U.type = w.Item;
|
|
283
319
|
// For components to distinguish if their children are Options or Headings/Dividers
|
|
284
|
-
/* harmony default export */ const
|
|
320
|
+
/* harmony default export */ const J = U;
|
|
285
321
|
// CONCATENATED MODULE: ./src/SelectBase/SelectAllOption.tsx
|
|
286
|
-
function
|
|
322
|
+
function G(e) {
|
|
287
323
|
"@babel/helpers - typeof";
|
|
288
|
-
return
|
|
324
|
+
return G = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
|
|
289
325
|
return typeof e;
|
|
290
326
|
} : function(e) {
|
|
291
327
|
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
292
|
-
},
|
|
328
|
+
}, G(e);
|
|
293
329
|
}
|
|
294
|
-
function
|
|
295
|
-
return
|
|
330
|
+
function Q() {
|
|
331
|
+
return Q = Object.assign ? Object.assign.bind() : function(e) {
|
|
296
332
|
for (var r = 1; r < arguments.length; r++) {
|
|
297
|
-
var
|
|
298
|
-
for (var
|
|
299
|
-
({}).hasOwnProperty.call(
|
|
333
|
+
var n = arguments[r];
|
|
334
|
+
for (var t in n) {
|
|
335
|
+
({}).hasOwnProperty.call(n, t) && (e[t] = n[t]);
|
|
300
336
|
}
|
|
301
337
|
}
|
|
302
338
|
return e;
|
|
303
|
-
},
|
|
339
|
+
}, Q.apply(null, arguments);
|
|
304
340
|
}
|
|
305
|
-
function
|
|
341
|
+
function Y(e, r) {
|
|
306
342
|
if (null == e) return {};
|
|
307
|
-
var
|
|
343
|
+
var n, t, l = Z(e, r);
|
|
308
344
|
if (Object.getOwnPropertySymbols) {
|
|
309
345
|
var a = Object.getOwnPropertySymbols(e);
|
|
310
|
-
for (
|
|
311
|
-
|
|
346
|
+
for (t = 0; t < a.length; t++) {
|
|
347
|
+
n = a[t], -1 === r.indexOf(n) && {}.propertyIsEnumerable.call(e, n) && (l[n] = e[n]);
|
|
312
348
|
}
|
|
313
349
|
}
|
|
314
350
|
return l;
|
|
315
351
|
}
|
|
316
|
-
function
|
|
352
|
+
function Z(e, r) {
|
|
317
353
|
if (null == e) return {};
|
|
318
|
-
var
|
|
319
|
-
for (var
|
|
320
|
-
if ({}.hasOwnProperty.call(e,
|
|
321
|
-
if (-1 !== r.indexOf(
|
|
322
|
-
t
|
|
354
|
+
var n = {};
|
|
355
|
+
for (var t in e) {
|
|
356
|
+
if ({}.hasOwnProperty.call(e, t)) {
|
|
357
|
+
if (-1 !== r.indexOf(t)) continue;
|
|
358
|
+
n[t] = e[t];
|
|
323
359
|
}
|
|
324
360
|
}
|
|
325
|
-
return
|
|
361
|
+
return n;
|
|
326
362
|
}
|
|
327
|
-
function
|
|
328
|
-
var
|
|
363
|
+
function ee(e, r) {
|
|
364
|
+
var n = Object.keys(e);
|
|
329
365
|
if (Object.getOwnPropertySymbols) {
|
|
330
|
-
var
|
|
331
|
-
r && (
|
|
366
|
+
var t = Object.getOwnPropertySymbols(e);
|
|
367
|
+
r && (t = t.filter((function(r) {
|
|
332
368
|
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
333
|
-
}))),
|
|
369
|
+
}))), n.push.apply(n, t);
|
|
334
370
|
}
|
|
335
|
-
return
|
|
371
|
+
return n;
|
|
336
372
|
}
|
|
337
|
-
function
|
|
373
|
+
function re(e) {
|
|
338
374
|
for (var r = 1; r < arguments.length; r++) {
|
|
339
|
-
var
|
|
340
|
-
r % 2 ?
|
|
341
|
-
|
|
342
|
-
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(
|
|
343
|
-
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(
|
|
375
|
+
var n = null != arguments[r] ? arguments[r] : {};
|
|
376
|
+
r % 2 ? ee(Object(n), !0).forEach((function(r) {
|
|
377
|
+
ne(e, r, n[r]);
|
|
378
|
+
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : ee(Object(n)).forEach((function(r) {
|
|
379
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(n, r));
|
|
344
380
|
}));
|
|
345
381
|
}
|
|
346
382
|
return e;
|
|
347
383
|
}
|
|
348
|
-
function
|
|
384
|
+
function ne(e, r, n) {
|
|
349
385
|
return (r = te(r)) in e ? Object.defineProperty(e, r, {
|
|
350
|
-
value:
|
|
386
|
+
value: n,
|
|
351
387
|
enumerable: !0,
|
|
352
388
|
configurable: !0,
|
|
353
389
|
writable: !0
|
|
354
|
-
}) : e[r] =
|
|
390
|
+
}) : e[r] = n, e;
|
|
355
391
|
}
|
|
356
392
|
function te(e) {
|
|
357
|
-
var r =
|
|
358
|
-
return "symbol" ==
|
|
393
|
+
var r = le(e, "string");
|
|
394
|
+
return "symbol" == G(r) ? r : r + "";
|
|
359
395
|
}
|
|
360
|
-
function
|
|
361
|
-
if ("object" !=
|
|
362
|
-
var
|
|
363
|
-
if (void 0 !==
|
|
364
|
-
var
|
|
365
|
-
if ("object" !=
|
|
396
|
+
function le(e, r) {
|
|
397
|
+
if ("object" != G(e) || !e) return e;
|
|
398
|
+
var n = e[Symbol.toPrimitive];
|
|
399
|
+
if (void 0 !== n) {
|
|
400
|
+
var t = n.call(e, r || "default");
|
|
401
|
+
if ("object" != G(t)) return t;
|
|
366
402
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
367
403
|
}
|
|
368
404
|
return ("string" === r ? String : Number)(e);
|
|
369
405
|
}
|
|
370
|
-
var
|
|
406
|
+
var ae = re(re({}, J.propTypes), {}, {
|
|
371
407
|
totalCount: p().number,
|
|
372
408
|
// unlike OptionBase, there's a default value for this prop
|
|
373
409
|
value: p().string
|
|
374
410
|
});
|
|
375
|
-
function
|
|
376
|
-
var r = e.active,
|
|
411
|
+
function ie(e) {
|
|
412
|
+
var r = e.active, n = e.elementRef, l = e.id, a = e.label, i = e.onClick, o = e.selected, u = e.totalCount, c = e.value, s = c === void 0 ? "selectAll" : c, f = Y(e, [ "active", "elementRef", "id", "label", "onClick", "selected", "totalCount", "value" ]);
|
|
377
413
|
// @docs-props-type SelectAllOptionPropsBase
|
|
378
414
|
// When toggle is changed the total count is not displayed anymore so the count is now shown in the Select all menu item
|
|
379
415
|
var d = u != null ? " (".concat(u === null || u === void 0 ? void 0 : u.toString(), ")") : "";
|
|
380
416
|
|
|
381
|
-
return
|
|
417
|
+
return t().createElement(J, Q({
|
|
382
418
|
active: r,
|
|
383
|
-
elementRef:
|
|
419
|
+
elementRef: n,
|
|
384
420
|
"aria-keyshortcuts": "Control+A",
|
|
385
421
|
"data-test": "select-all",
|
|
386
422
|
description: "".concat(d, " Ctrl-a"),
|
|
@@ -389,27 +425,27 @@
|
|
|
389
425
|
key: "selectAll",
|
|
390
426
|
multiple: true,
|
|
391
427
|
label: a,
|
|
392
|
-
onClick:
|
|
393
|
-
selected:
|
|
428
|
+
onClick: i,
|
|
429
|
+
selected: o,
|
|
394
430
|
role: "menuitemcheckbox",
|
|
395
431
|
value: s
|
|
396
432
|
}, f));
|
|
397
433
|
}
|
|
398
|
-
|
|
399
|
-
/* harmony default export */ const oe =
|
|
434
|
+
ie.propTypes = ae;
|
|
435
|
+
/* harmony default export */ const oe = ie;
|
|
400
436
|
// CONCATENATED MODULE: external "styled-components"
|
|
401
|
-
const
|
|
402
|
-
var
|
|
437
|
+
const ue = require("styled-components");
|
|
438
|
+
var ce = e.n(ue);
|
|
403
439
|
// CONCATENATED MODULE: external "@splunk/react-ui/Button"
|
|
404
|
-
const
|
|
405
|
-
var
|
|
440
|
+
const se = require("@splunk/react-ui/Button");
|
|
441
|
+
var fe = e.n(se);
|
|
406
442
|
// CONCATENATED MODULE: external "@splunk/react-ui/Divider"
|
|
407
|
-
const
|
|
408
|
-
var
|
|
443
|
+
const de = require("@splunk/react-ui/Divider");
|
|
444
|
+
var pe = e.n(de);
|
|
409
445
|
// CONCATENATED MODULE: external "@splunk/themes"
|
|
410
|
-
const
|
|
446
|
+
const ve = require("@splunk/themes");
|
|
411
447
|
// CONCATENATED MODULE: ./src/SelectBase/SelectBaseStyles.ts
|
|
412
|
-
var
|
|
448
|
+
var be = ce()(fe()).withConfig({
|
|
413
449
|
displayName: "SelectBaseStyles__StyledButton",
|
|
414
450
|
componentId: "sc-1lmonqb-0"
|
|
415
451
|
})([ "&[data-inline]{width:", ";}", "" ], (function(e) {
|
|
@@ -419,77 +455,77 @@
|
|
|
419
455
|
var r = e.$multiple;
|
|
420
456
|
return !r && "flex-grow: 0;";
|
|
421
457
|
}));
|
|
422
|
-
var
|
|
458
|
+
var me = ce().span.withConfig({
|
|
423
459
|
displayName: "SelectBaseStyles__StyledLinkIcon",
|
|
424
460
|
componentId: "sc-1lmonqb-1"
|
|
425
|
-
})([ "padding-right:", ";" ],
|
|
426
|
-
var
|
|
461
|
+
})([ "padding-right:", ";" ], ve.variables.spacingXSmall);
|
|
462
|
+
var ye = ce().span.withConfig({
|
|
427
463
|
displayName: "SelectBaseStyles__StyledLinkCaret",
|
|
428
464
|
componentId: "sc-1lmonqb-2"
|
|
429
|
-
})([ "padding-left:", ";" ],
|
|
430
|
-
var
|
|
465
|
+
})([ "padding-left:", ";" ], ve.variables.spacingXSmall);
|
|
466
|
+
var ge = ce().div.withConfig({
|
|
431
467
|
displayName: "SelectBaseStyles__StyledFilter",
|
|
432
468
|
componentId: "sc-1lmonqb-3"
|
|
433
|
-
})([ "padding:", " ", " ", ";min-width:160px;" ],
|
|
434
|
-
var
|
|
469
|
+
})([ "padding:", " ", " ", ";min-width:160px;" ], ve.variables.spacingLarge, ve.variables.spacingLarge, ve.variables.spacingSmall);
|
|
470
|
+
var he = ce().span.withConfig({
|
|
435
471
|
displayName: "SelectBaseStyles__StyledCount",
|
|
436
472
|
componentId: "sc-1lmonqb-4"
|
|
437
|
-
})([ "padding-right:", ";" ],
|
|
438
|
-
var
|
|
473
|
+
})([ "padding-right:", ";" ], ve.variables.spacingXSmall);
|
|
474
|
+
var Se = ce()(O()).withConfig({
|
|
439
475
|
displayName: "SelectBaseStyles__StyledControlsLink",
|
|
440
476
|
componentId: "sc-1lmonqb-5"
|
|
441
477
|
})([ "", ";" ], (function(e) {
|
|
442
478
|
var r = e.$disabled;
|
|
443
|
-
return r && (0,
|
|
479
|
+
return r && (0, ue.css)([ "color:", ";" ], ve.variables.contentColorDisabled);
|
|
444
480
|
}));
|
|
445
|
-
var
|
|
481
|
+
var Oe = ce().div.withConfig({
|
|
446
482
|
displayName: "SelectBaseStyles__StyledToggleAllControls",
|
|
447
483
|
componentId: "sc-1lmonqb-6"
|
|
448
|
-
})([ "", ";gap:", ";padding:", " ", " ", ";" ],
|
|
449
|
-
var
|
|
484
|
+
})([ "", ";gap:", ";padding:", " ", " ", ";" ], ve.mixins.reset("flex"), ve.variables.spacingMedium, ve.variables.spacingXSmall, ve.variables.spacingLarge, ve.variables.spacingSmall);
|
|
485
|
+
var we = ce()(pe()).withConfig({
|
|
450
486
|
displayName: "SelectBaseStyles__StyledControlsDivider",
|
|
451
487
|
componentId: "sc-1lmonqb-7"
|
|
452
|
-
})([ "border-color:", ";" ],
|
|
488
|
+
})([ "border-color:", ";" ], ve.variables.borderColor);
|
|
453
489
|
// CONCATENATED MODULE: ./src/utils/fuzzyMatch.ts
|
|
454
490
|
// A utility for matching keyboard characters to list values
|
|
455
|
-
var
|
|
456
|
-
return r ? r.label.charAt(
|
|
491
|
+
var Ce = function e(r, n) {
|
|
492
|
+
return r ? r.label.charAt(n).toLowerCase() : "";
|
|
457
493
|
};
|
|
458
|
-
var
|
|
494
|
+
var ke = function e(r, n) {
|
|
459
495
|
if (!r.length) {
|
|
460
496
|
return r;
|
|
461
497
|
}
|
|
462
|
-
var
|
|
498
|
+
var t = null;
|
|
463
499
|
var l = false;
|
|
464
500
|
var a = r.filter((function(e) {
|
|
465
|
-
var r =
|
|
466
|
-
if (r ===
|
|
501
|
+
var r = Ce(e, n.index);
|
|
502
|
+
if (r === n.value) {
|
|
467
503
|
l = true;
|
|
468
504
|
return true;
|
|
469
505
|
}
|
|
470
506
|
// If we haven't found a match yet, keep track of the next closest match.
|
|
471
507
|
// Secondary matching looks for the closest character of a higher value, and failing that, closest of a lower value.
|
|
472
508
|
if (!l) {
|
|
473
|
-
var a =
|
|
509
|
+
var a = Ce(t, n.index);
|
|
474
510
|
if (!a) {
|
|
475
|
-
|
|
476
|
-
} else if (r >
|
|
477
|
-
if (a <
|
|
478
|
-
|
|
511
|
+
t = e;
|
|
512
|
+
} else if (r > n.value) {
|
|
513
|
+
if (a < n.value) {
|
|
514
|
+
t = e;
|
|
479
515
|
} else if (a > r) {
|
|
480
|
-
|
|
516
|
+
t = e;
|
|
481
517
|
}
|
|
482
518
|
} else if (r > a) {
|
|
483
|
-
|
|
519
|
+
t = e;
|
|
484
520
|
}
|
|
485
521
|
}
|
|
486
522
|
return false;
|
|
487
523
|
}));
|
|
488
|
-
return a.length === 0 &&
|
|
524
|
+
return a.length === 0 && t ? [ t ] : a;
|
|
489
525
|
};
|
|
490
526
|
// CONCATENATED MODULE: ./src/utils/ssrDocument.ts
|
|
491
527
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
492
|
-
var
|
|
528
|
+
var xe = {
|
|
493
529
|
body: {
|
|
494
530
|
appendChild: function e() {
|
|
495
531
|
return [];
|
|
@@ -543,16 +579,16 @@
|
|
|
543
579
|
search: ""
|
|
544
580
|
}
|
|
545
581
|
};
|
|
546
|
-
function
|
|
547
|
-
var e = typeof document !== "undefined" ? document :
|
|
582
|
+
function je() {
|
|
583
|
+
var e = typeof document !== "undefined" ? document : xe;
|
|
548
584
|
return e;
|
|
549
585
|
}
|
|
550
|
-
var
|
|
551
|
-
/* harmony default export */ const
|
|
586
|
+
var Ee = je();
|
|
587
|
+
/* harmony default export */ const Pe = /* unused pure expression or super */ null && Ee;
|
|
552
588
|
// CONCATENATED MODULE: ./src/utils/ssrWindow.ts
|
|
553
589
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
554
|
-
var
|
|
555
|
-
document:
|
|
590
|
+
var Ae = {
|
|
591
|
+
document: xe,
|
|
556
592
|
navigator: {
|
|
557
593
|
userAgent: ""
|
|
558
594
|
},
|
|
@@ -606,12 +642,12 @@
|
|
|
606
642
|
clearTimeout(r);
|
|
607
643
|
}
|
|
608
644
|
};
|
|
609
|
-
function
|
|
610
|
-
var e = typeof window !== "undefined" ? window :
|
|
645
|
+
function Le() {
|
|
646
|
+
var e = typeof window !== "undefined" ? window : Ae;
|
|
611
647
|
return e;
|
|
612
648
|
}
|
|
613
|
-
var
|
|
614
|
-
/* harmony default export */ const
|
|
649
|
+
var Ie = Le();
|
|
650
|
+
/* harmony default export */ const De = /* unused pure expression or super */ null && Ie;
|
|
615
651
|
// CONCATENATED MODULE: ./src/utils/updateReactRef.ts
|
|
616
652
|
/**
|
|
617
653
|
* Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
|
|
@@ -633,7 +669,7 @@
|
|
|
633
669
|
}
|
|
634
670
|
// CONCATENATED MODULE: ./src/SelectBase/SelectBase.tsx
|
|
635
671
|
function Me(e) {
|
|
636
|
-
return
|
|
672
|
+
return _e(e) || qe(e) || Fe(e) || Te();
|
|
637
673
|
}
|
|
638
674
|
function Te() {
|
|
639
675
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
@@ -641,142 +677,143 @@
|
|
|
641
677
|
function qe(e) {
|
|
642
678
|
if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"]) return Array.from(e);
|
|
643
679
|
}
|
|
644
|
-
function
|
|
645
|
-
if (Array.isArray(e)) return
|
|
680
|
+
function _e(e) {
|
|
681
|
+
if (Array.isArray(e)) return Ke(e);
|
|
646
682
|
}
|
|
647
|
-
function
|
|
648
|
-
return
|
|
683
|
+
function Be() {
|
|
684
|
+
return Be = Object.assign ? Object.assign.bind() : function(e) {
|
|
649
685
|
for (var r = 1; r < arguments.length; r++) {
|
|
650
|
-
var
|
|
651
|
-
for (var
|
|
652
|
-
({}).hasOwnProperty.call(
|
|
686
|
+
var n = arguments[r];
|
|
687
|
+
for (var t in n) {
|
|
688
|
+
({}).hasOwnProperty.call(n, t) && (e[t] = n[t]);
|
|
653
689
|
}
|
|
654
690
|
}
|
|
655
691
|
return e;
|
|
656
|
-
},
|
|
692
|
+
}, Be.apply(null, arguments);
|
|
657
693
|
}
|
|
658
|
-
function
|
|
659
|
-
return
|
|
694
|
+
function Ve(e, r) {
|
|
695
|
+
return ze(e) || He(e, r) || Fe(e, r) || Ne();
|
|
660
696
|
}
|
|
661
697
|
function Ne() {
|
|
662
698
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
663
699
|
}
|
|
664
|
-
function
|
|
700
|
+
function Fe(e, r) {
|
|
665
701
|
if (e) {
|
|
666
|
-
if ("string" == typeof e) return
|
|
667
|
-
var
|
|
668
|
-
return "Object" ===
|
|
702
|
+
if ("string" == typeof e) return Ke(e, r);
|
|
703
|
+
var n = {}.toString.call(e).slice(8, -1);
|
|
704
|
+
return "Object" === n && e.constructor && (n = e.constructor.name), "Map" === n || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? Ke(e, r) : void 0;
|
|
669
705
|
}
|
|
670
706
|
}
|
|
671
|
-
function
|
|
707
|
+
function Ke(e, r) {
|
|
672
708
|
(null == r || r > e.length) && (r = e.length);
|
|
673
|
-
for (var
|
|
674
|
-
n
|
|
709
|
+
for (var n = 0, t = Array(r); n < r; n++) {
|
|
710
|
+
t[n] = e[n];
|
|
675
711
|
}
|
|
676
|
-
return
|
|
712
|
+
return t;
|
|
677
713
|
}
|
|
678
|
-
function
|
|
679
|
-
var
|
|
680
|
-
if (null !=
|
|
681
|
-
var
|
|
714
|
+
function He(e, r) {
|
|
715
|
+
var n = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
716
|
+
if (null != n) {
|
|
717
|
+
var t, l, a, i, o = [], u = !0, c = !1;
|
|
682
718
|
try {
|
|
683
|
-
if (a = (
|
|
684
|
-
if (Object(
|
|
719
|
+
if (a = (n = n.call(e)).next, 0 === r) {
|
|
720
|
+
if (Object(n) !== n) return;
|
|
685
721
|
u = !1;
|
|
686
|
-
} else for (;!(u = (
|
|
722
|
+
} else for (;!(u = (t = a.call(n)).done) && (o.push(t.value), o.length !== r); u = !0) {
|
|
687
723
|
}
|
|
688
724
|
} catch (e) {
|
|
689
725
|
c = !0, l = e;
|
|
690
726
|
} finally {
|
|
691
727
|
try {
|
|
692
|
-
if (!u && null !=
|
|
728
|
+
if (!u && null != n["return"] && (i = n["return"](), Object(i) !== i)) return;
|
|
693
729
|
} finally {
|
|
694
730
|
if (c) throw l;
|
|
695
731
|
}
|
|
696
732
|
}
|
|
697
|
-
return
|
|
733
|
+
return o;
|
|
698
734
|
}
|
|
699
735
|
}
|
|
700
|
-
function
|
|
736
|
+
function ze(e) {
|
|
701
737
|
if (Array.isArray(e)) return e;
|
|
702
738
|
}
|
|
703
|
-
function
|
|
739
|
+
function We(e, r) {
|
|
704
740
|
if (null == e) return {};
|
|
705
|
-
var
|
|
741
|
+
var n, t, l = $e(e, r);
|
|
706
742
|
if (Object.getOwnPropertySymbols) {
|
|
707
743
|
var a = Object.getOwnPropertySymbols(e);
|
|
708
|
-
for (
|
|
709
|
-
|
|
744
|
+
for (t = 0; t < a.length; t++) {
|
|
745
|
+
n = a[t], -1 === r.indexOf(n) && {}.propertyIsEnumerable.call(e, n) && (l[n] = e[n]);
|
|
710
746
|
}
|
|
711
747
|
}
|
|
712
748
|
return l;
|
|
713
749
|
}
|
|
714
|
-
function
|
|
750
|
+
function $e(e, r) {
|
|
715
751
|
if (null == e) return {};
|
|
716
|
-
var
|
|
717
|
-
for (var
|
|
718
|
-
if ({}.hasOwnProperty.call(e,
|
|
719
|
-
if (-1 !== r.indexOf(
|
|
720
|
-
t
|
|
752
|
+
var n = {};
|
|
753
|
+
for (var t in e) {
|
|
754
|
+
if ({}.hasOwnProperty.call(e, t)) {
|
|
755
|
+
if (-1 !== r.indexOf(t)) continue;
|
|
756
|
+
n[t] = e[t];
|
|
721
757
|
}
|
|
722
758
|
}
|
|
723
|
-
return
|
|
759
|
+
return n;
|
|
724
760
|
}
|
|
725
|
-
function
|
|
761
|
+
function Xe(e) {
|
|
726
762
|
"@babel/helpers - typeof";
|
|
727
|
-
return
|
|
763
|
+
return Xe = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
|
|
728
764
|
return typeof e;
|
|
729
765
|
} : function(e) {
|
|
730
766
|
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
731
|
-
},
|
|
767
|
+
}, Xe(e);
|
|
732
768
|
}
|
|
733
|
-
function
|
|
734
|
-
var
|
|
769
|
+
function Ue(e, r) {
|
|
770
|
+
var n = Object.keys(e);
|
|
735
771
|
if (Object.getOwnPropertySymbols) {
|
|
736
|
-
var
|
|
737
|
-
r && (
|
|
772
|
+
var t = Object.getOwnPropertySymbols(e);
|
|
773
|
+
r && (t = t.filter((function(r) {
|
|
738
774
|
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
739
|
-
}))),
|
|
775
|
+
}))), n.push.apply(n, t);
|
|
740
776
|
}
|
|
741
|
-
return
|
|
777
|
+
return n;
|
|
742
778
|
}
|
|
743
|
-
function
|
|
779
|
+
function Je(e) {
|
|
744
780
|
for (var r = 1; r < arguments.length; r++) {
|
|
745
|
-
var
|
|
746
|
-
r % 2 ?
|
|
747
|
-
|
|
748
|
-
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(
|
|
749
|
-
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(
|
|
781
|
+
var n = null != arguments[r] ? arguments[r] : {};
|
|
782
|
+
r % 2 ? Ue(Object(n), !0).forEach((function(r) {
|
|
783
|
+
Ge(e, r, n[r]);
|
|
784
|
+
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : Ue(Object(n)).forEach((function(r) {
|
|
785
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(n, r));
|
|
750
786
|
}));
|
|
751
787
|
}
|
|
752
788
|
return e;
|
|
753
789
|
}
|
|
754
|
-
function
|
|
755
|
-
return (r =
|
|
756
|
-
value:
|
|
790
|
+
function Ge(e, r, n) {
|
|
791
|
+
return (r = Qe(r)) in e ? Object.defineProperty(e, r, {
|
|
792
|
+
value: n,
|
|
757
793
|
enumerable: !0,
|
|
758
794
|
configurable: !0,
|
|
759
795
|
writable: !0
|
|
760
|
-
}) : e[r] =
|
|
796
|
+
}) : e[r] = n, e;
|
|
761
797
|
}
|
|
762
|
-
function
|
|
763
|
-
var r =
|
|
764
|
-
return "symbol" ==
|
|
798
|
+
function Qe(e) {
|
|
799
|
+
var r = Ye(e, "string");
|
|
800
|
+
return "symbol" == Xe(r) ? r : r + "";
|
|
765
801
|
}
|
|
766
|
-
function
|
|
767
|
-
if ("object" !=
|
|
768
|
-
var
|
|
769
|
-
if (void 0 !==
|
|
770
|
-
var
|
|
771
|
-
if ("object" !=
|
|
802
|
+
function Ye(e, r) {
|
|
803
|
+
if ("object" != Xe(e) || !e) return e;
|
|
804
|
+
var n = e[Symbol.toPrimitive];
|
|
805
|
+
if (void 0 !== n) {
|
|
806
|
+
var t = n.call(e, r || "default");
|
|
807
|
+
if ("object" != Xe(t)) return t;
|
|
772
808
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
773
809
|
}
|
|
774
810
|
return ("string" === r ? String : Number)(e);
|
|
775
811
|
}
|
|
776
|
-
var
|
|
777
|
-
|
|
812
|
+
var Ze = function e(r) {
|
|
813
|
+
var n = _(r, "disabled"), t = n.isDisabled;
|
|
814
|
+
return !!t;
|
|
778
815
|
};
|
|
779
|
-
var
|
|
816
|
+
var er = {
|
|
780
817
|
allowKeyMatching: p().bool,
|
|
781
818
|
allowNewValues: p().bool,
|
|
782
819
|
animateLoading: p().bool,
|
|
@@ -827,65 +864,65 @@
|
|
|
827
864
|
/** @private. */
|
|
828
865
|
virtualization: p().number
|
|
829
866
|
};
|
|
830
|
-
var
|
|
867
|
+
var rr = c()((function(e) {
|
|
831
868
|
return [ e ];
|
|
832
869
|
}));
|
|
833
870
|
// preserve separate widths for single vs. multi mode
|
|
834
|
-
var
|
|
835
|
-
var r = e.anchorWidth,
|
|
836
|
-
return
|
|
871
|
+
var nr = c()((function(e) {
|
|
872
|
+
var r = e.anchorWidth, n = e.isMultiple, t = e.maxHeight, l = e.menuStyle;
|
|
873
|
+
return n ? Je({
|
|
837
874
|
width: Math.max(r !== null && r !== void 0 ? r : 0, 200),
|
|
838
|
-
maxHeight:
|
|
839
|
-
}, l) :
|
|
875
|
+
maxHeight: t
|
|
876
|
+
}, l) : Je({
|
|
840
877
|
minWidth: r !== null && r !== void 0 ? r : undefined,
|
|
841
878
|
maxWidth: Math.max(r !== null && r !== void 0 ? r : 0, 300),
|
|
842
|
-
maxHeight:
|
|
879
|
+
maxHeight: t
|
|
843
880
|
}, l);
|
|
844
881
|
}));
|
|
845
882
|
var tr = [ "clickAway", "escapeKey", "offScreen", "tabKey", "toggleClick" ];
|
|
846
|
-
function
|
|
847
|
-
return e &&
|
|
883
|
+
function lr(e) {
|
|
884
|
+
return e && o()(e.props, "value");
|
|
848
885
|
}
|
|
849
|
-
function
|
|
850
|
-
return "".concat(
|
|
886
|
+
function ar(e, r) {
|
|
887
|
+
return "".concat(Xe(e), "-").concat(e, "-").concat(r);
|
|
851
888
|
}
|
|
852
|
-
var
|
|
853
|
-
var or = (0,
|
|
854
|
-
var
|
|
855
|
-
var
|
|
856
|
-
var
|
|
857
|
-
var
|
|
858
|
-
var
|
|
859
|
-
var
|
|
860
|
-
var O = (0,
|
|
861
|
-
var w = (0,
|
|
889
|
+
var ir = [ "append", "error", "prepend" ];
|
|
890
|
+
var or = (0, M._)("No matches");
|
|
891
|
+
var ur = (0, M._)("Select...");
|
|
892
|
+
var cr = 30;
|
|
893
|
+
var sr = {};
|
|
894
|
+
var fr = t().createElement(y(), null);
|
|
895
|
+
var dr = function e(r) {
|
|
896
|
+
var n = r.activeItemId, l = r.filterA11yId, a = r.filterKeyword, i = r.hasChildren, o = r.inputId, u = r.inputRef, c = r.menuListboxId, s = r.multiple, f = r.onClearAll, d = r.onSelectAll, p = r.onTextBlur, v = r.onTextChange, b = r.onTextFocus, m = r.onTextKeyDown, y = r.optionSelection, g = r.placement, h = r.selectAllAppearance, S = r.textHasFocus;
|
|
897
|
+
var O = (0, M._)("Select all options".concat(y.current === "all" ? " disabled" : ""));
|
|
898
|
+
var w = (0, M._)("Clear all options".concat(y.current === "none" ? " disabled" : ""));
|
|
862
899
|
// only visually disable these as opposed to fully disabling to avoid losing keyboard focus - see SUI-2731
|
|
863
|
-
var C =
|
|
900
|
+
var C = t().createElement(Oe, {
|
|
864
901
|
key: "selectAll"
|
|
865
|
-
},
|
|
902
|
+
}, t().createElement(Se, {
|
|
866
903
|
disabled: y.current === "all",
|
|
867
904
|
appearance: "standalone",
|
|
868
905
|
"aria-label": O,
|
|
869
906
|
onClick: d,
|
|
870
907
|
"data-test": "select-all",
|
|
871
908
|
tag: "button"
|
|
872
|
-
}, a ? (0,
|
|
909
|
+
}, a ? (0, M._)("Select all Matches") : (0, M._)("Select all")), t().createElement(Se, {
|
|
873
910
|
disabled: y.current === "none",
|
|
874
911
|
appearance: "standalone",
|
|
875
912
|
"aria-label": w,
|
|
876
913
|
onClick: f,
|
|
877
914
|
"data-test": "clear-all",
|
|
878
915
|
tag: "button"
|
|
879
|
-
}, a ? (0,
|
|
916
|
+
}, a ? (0, M._)("Clear all Matches") : (0, M._)("Clear all")));
|
|
880
917
|
|
|
881
|
-
return
|
|
918
|
+
return t().createElement("div", {
|
|
882
919
|
key: "controls"
|
|
883
|
-
}, l &&
|
|
920
|
+
}, l && t().createElement(j(), {
|
|
884
921
|
id: l
|
|
885
|
-
}, (0,
|
|
922
|
+
}, (0, M._)("Type to filter")), g === "above" && t().createElement(we, null), t().createElement(ge, {
|
|
886
923
|
key: "filter",
|
|
887
924
|
"data-test": "filter"
|
|
888
|
-
},
|
|
925
|
+
}, t().createElement(P(), {
|
|
889
926
|
value: a,
|
|
890
927
|
autoCapitalize: "off",
|
|
891
928
|
autoComplete: "off",
|
|
@@ -895,88 +932,88 @@
|
|
|
895
932
|
onKeyDown: m,
|
|
896
933
|
onFocus: b,
|
|
897
934
|
onBlur: p,
|
|
898
|
-
placeholder: (0,
|
|
935
|
+
placeholder: (0, M._)("Filter"),
|
|
899
936
|
role: "combobox",
|
|
900
937
|
"aria-expanded": "true",
|
|
901
938
|
"aria-controls": c,
|
|
902
|
-
"aria-owns": S &&
|
|
903
|
-
"aria-label": (0,
|
|
939
|
+
"aria-owns": S && i ? n : undefined,
|
|
940
|
+
"aria-label": (0, M._)("Filter"),
|
|
904
941
|
"aria-autocomplete": "list",
|
|
905
|
-
"aria-activedescendant": S &&
|
|
942
|
+
"aria-activedescendant": S && i ? n : undefined,
|
|
906
943
|
inputRef: u,
|
|
907
|
-
inputId:
|
|
944
|
+
inputId: o,
|
|
908
945
|
canClear: true,
|
|
909
|
-
startAdornment:
|
|
910
|
-
})), s &&
|
|
946
|
+
startAdornment: fr
|
|
947
|
+
})), s && i && h === "buttongroup" && C, g === "below" && t().createElement(we, null));
|
|
911
948
|
};
|
|
912
|
-
var
|
|
913
|
-
var
|
|
914
|
-
var
|
|
915
|
-
if (
|
|
916
|
-
|
|
949
|
+
var pr = function e(r) {
|
|
950
|
+
var n = r.prefixLabel, t = r.label, l = r.suffixLabel;
|
|
951
|
+
var i = t;
|
|
952
|
+
if (n) {
|
|
953
|
+
i = [ "".concat(n, ": ") ].concat(i);
|
|
917
954
|
}
|
|
918
955
|
if (l) {
|
|
919
|
-
|
|
956
|
+
i = a()(i).concat(" ".concat(l));
|
|
920
957
|
}
|
|
921
|
-
return
|
|
958
|
+
return i;
|
|
922
959
|
};
|
|
923
|
-
var
|
|
924
|
-
var
|
|
925
|
-
var l = e.appearance, a = l === void 0 ? "default" : l,
|
|
926
|
-
var
|
|
927
|
-
var e =
|
|
960
|
+
var vr = [];
|
|
961
|
+
var br = t().forwardRef((function(e, r) {
|
|
962
|
+
var l = e.appearance, a = l === void 0 ? "default" : l, i = e.append, o = e.children, u = e.currentValues, c = u === void 0 ? vr : u, s = e.describedBy, d = e.disabled, p = e.elementRef, v = e.error, m = e.inline, y = e.labelText, g = e.labelledBy, h = e.multiple, S = e.onClick, w = e.placeholder, C = e.prefixLabel, k = e.prepend, x = e.required, j = e.suffixLabel, E = e.toggle, P = e.toggleContent, A = e.maxLabelItems, L = A === void 0 ? cr : A, I = We(e, [ "appearance", "append", "children", "currentValues", "describedBy", "disabled", "elementRef", "error", "inline", "labelText", "labelledBy", "multiple", "onClick", "placeholder", "prefixLabel", "prepend", "required", "suffixLabel", "toggle", "toggleContent", "maxLabelItems" ]);
|
|
963
|
+
var D = (0, n.useMemo)((function() {
|
|
964
|
+
var e = n.Children.toArray(o);
|
|
928
965
|
var r = new Map;
|
|
929
|
-
for (var
|
|
930
|
-
var l = e[
|
|
931
|
-
if (
|
|
966
|
+
for (var t = 0; t < e.length; t += 1) {
|
|
967
|
+
var l = e[t];
|
|
968
|
+
if (lr(l)) {
|
|
932
969
|
r.set(l.props.value, l);
|
|
933
970
|
}
|
|
934
971
|
}
|
|
935
972
|
return r;
|
|
936
|
-
}), [
|
|
937
|
-
var
|
|
973
|
+
}), [ o ]);
|
|
974
|
+
var R = (0, n.useMemo)((function() {
|
|
938
975
|
var e = {
|
|
939
976
|
icon: null,
|
|
940
977
|
label: [],
|
|
941
978
|
ariaLabel: []
|
|
942
979
|
};
|
|
943
980
|
var r = h && c.length > L ? Math.max(1, L) : c.length;
|
|
944
|
-
for (var
|
|
945
|
-
var
|
|
946
|
-
var l =
|
|
981
|
+
for (var n = 0; n < r; n += 1) {
|
|
982
|
+
var t = c[n];
|
|
983
|
+
var l = D.get(t);
|
|
947
984
|
if (l) {
|
|
948
|
-
var a = l.props,
|
|
949
|
-
var s = P !== "optionLabel" &&
|
|
985
|
+
var a = l.props, i = a.children, o = a.icon, u = a.label;
|
|
986
|
+
var s = P !== "optionLabel" && i ? i : u;
|
|
950
987
|
e.label.push(s);
|
|
951
988
|
e.ariaLabel.push(u);
|
|
952
989
|
// if not in multiple mode, add the icon
|
|
953
990
|
if (!h && c.length === 1) {
|
|
954
|
-
e.icon =
|
|
991
|
+
e.icon = o;
|
|
955
992
|
}
|
|
956
993
|
} else if (h) {
|
|
957
994
|
// only add values that don't match an option in "multiple" mode to preserve old behaviour
|
|
958
|
-
e.label.push(
|
|
959
|
-
e.ariaLabel.push(
|
|
995
|
+
e.label.push(t);
|
|
996
|
+
e.ariaLabel.push(t.toString());
|
|
960
997
|
}
|
|
961
|
-
if (
|
|
962
|
-
e.label.push((0,
|
|
963
|
-
e.ariaLabel.push((0,
|
|
998
|
+
if (n < r - 1) {
|
|
999
|
+
e.label.push((0, M._)(", "));
|
|
1000
|
+
e.ariaLabel.push((0, M._)(", "));
|
|
964
1001
|
}
|
|
965
1002
|
}
|
|
966
1003
|
if (h && c.length > r && e.label.length) {
|
|
967
1004
|
// add visual ellipsis to ensure truncation is shown
|
|
968
|
-
e.label.push((0,
|
|
1005
|
+
e.label.push((0, M._)("..."));
|
|
969
1006
|
}
|
|
970
1007
|
// only apply prefix / suffix if the label is not empty
|
|
971
1008
|
if (e.label.length > 0) {
|
|
972
1009
|
// If there's more than one item selected, read out the selected total
|
|
973
1010
|
// rather than reading out each selected item
|
|
974
|
-
e.ariaLabel =
|
|
1011
|
+
e.ariaLabel = pr({
|
|
975
1012
|
prefixLabel: C,
|
|
976
1013
|
label: e.label.length > 1 ? [ "".concat(c.length, " items selected") ] : e.ariaLabel,
|
|
977
1014
|
suffixLabel: j
|
|
978
1015
|
});
|
|
979
|
-
e.label =
|
|
1016
|
+
e.label = pr({
|
|
980
1017
|
prefixLabel: C,
|
|
981
1018
|
label: e.label,
|
|
982
1019
|
suffixLabel: j
|
|
@@ -987,83 +1024,77 @@
|
|
|
987
1024
|
if (!e.label.length || !h && e.label.every((function(e) {
|
|
988
1025
|
return e === "";
|
|
989
1026
|
}))) {
|
|
990
|
-
e.label =
|
|
1027
|
+
e.label = rr(w);
|
|
991
1028
|
e.ariaLabel = e.label;
|
|
992
1029
|
}
|
|
993
1030
|
return e;
|
|
994
|
-
}), [ c, L, h,
|
|
995
|
-
var
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
if (d === "dimmed") {
|
|
999
|
-
N = "dimmed";
|
|
1000
|
-
} else if (d === true || d === "disabled") {
|
|
1001
|
-
N = "disabled";
|
|
1002
|
-
}
|
|
1003
|
-
var V = Ue({
|
|
1031
|
+
}), [ c, L, h, D, w, C, j, P ]), T = R.label, q = R.ariaLabel, B = R.icon;
|
|
1032
|
+
var V = "aria-labelledby" in I;
|
|
1033
|
+
var N = _(d, "disabled"), F = N.disabledValue;
|
|
1034
|
+
var K = Je({
|
|
1004
1035
|
"aria-describedby": s,
|
|
1005
1036
|
"aria-disabled": d === "dimmed" || undefined,
|
|
1006
|
-
"aria-label": g ||
|
|
1037
|
+
"aria-label": g || V ? undefined : "".concat(y ? "".concat(y, ", ") : "").concat(q.join("")),
|
|
1007
1038
|
// aria-labelledby takes precedence over aria-label, so existence of both is redundant
|
|
1008
1039
|
"aria-labelledby": g,
|
|
1009
1040
|
"aria-required": x,
|
|
1010
1041
|
"data-select-appearance": a,
|
|
1011
|
-
append:
|
|
1042
|
+
append: i,
|
|
1012
1043
|
prepend: k,
|
|
1013
1044
|
onClick: S,
|
|
1014
1045
|
role: "combobox",
|
|
1015
|
-
disabled: a === "link" ? d === true || d === "disabled" :
|
|
1046
|
+
disabled: a === "link" ? d === true || d === "disabled" : F,
|
|
1016
1047
|
elementRef: p,
|
|
1017
1048
|
error: v,
|
|
1018
1049
|
ref: r
|
|
1019
1050
|
}, I);
|
|
1020
1051
|
if (h) {
|
|
1021
|
-
|
|
1052
|
+
K["data-test-values"] = JSON.stringify(c);
|
|
1022
1053
|
} else {
|
|
1023
|
-
var
|
|
1024
|
-
|
|
1054
|
+
var H = Ve(c, 1), z = H[0];
|
|
1055
|
+
K["data-test-value"] = z;
|
|
1025
1056
|
}
|
|
1026
|
-
|
|
1057
|
+
K["data-test-disabled"] = F;
|
|
1027
1058
|
if (E) {
|
|
1028
1059
|
|
|
1029
|
-
return (0,
|
|
1060
|
+
return (0, n.cloneElement)(E, K);
|
|
1030
1061
|
}
|
|
1031
1062
|
if (a === "link") {
|
|
1032
1063
|
|
|
1033
|
-
return
|
|
1064
|
+
return t().createElement(O(), Be({
|
|
1034
1065
|
tag: "button",
|
|
1035
1066
|
appearance: "standalone"
|
|
1036
|
-
},
|
|
1067
|
+
}, K, {
|
|
1037
1068
|
"data-select-appearance": "link"
|
|
1038
|
-
}), !!
|
|
1069
|
+
}), !!B && t().createElement(me, null, B), T || w, t().createElement(ye, null, t().createElement(b(), null)));
|
|
1039
1070
|
}
|
|
1040
1071
|
// Using Button's secondary appearance as Select's default appearance.
|
|
1041
|
-
var
|
|
1072
|
+
var W = a === "default" ? "secondary" : a;
|
|
1042
1073
|
|
|
1043
|
-
return
|
|
1074
|
+
return t().createElement(be, Be({}, K, {
|
|
1044
1075
|
$multiple: h,
|
|
1045
|
-
appearance:
|
|
1046
|
-
label:
|
|
1076
|
+
appearance: W,
|
|
1077
|
+
label: T,
|
|
1047
1078
|
error: v,
|
|
1048
|
-
icon:
|
|
1079
|
+
icon: B,
|
|
1049
1080
|
inline: m,
|
|
1050
1081
|
isMenu: true,
|
|
1051
1082
|
onClick: S
|
|
1052
|
-
}, f()(I,
|
|
1083
|
+
}, f()(I, ir)), !!c.length && h && t().createElement(he, {
|
|
1053
1084
|
"data-role": "count"
|
|
1054
1085
|
}, "(", c.length, ")"));
|
|
1055
1086
|
}));
|
|
1056
|
-
function
|
|
1057
|
-
var r = e.currentValues,
|
|
1058
|
-
if (
|
|
1087
|
+
function mr(e) {
|
|
1088
|
+
var r = e.currentValues, n = e.multiple;
|
|
1089
|
+
if (n || !(r === null || r === void 0 ? void 0 : r.length)) {
|
|
1059
1090
|
return r !== null && r !== void 0 ? r : [];
|
|
1060
1091
|
}
|
|
1061
1092
|
return [ r[0] ];
|
|
1062
1093
|
}
|
|
1063
|
-
function
|
|
1064
|
-
var r = e.allowKeyMatching, l = r === void 0 ? true : r, a = e.animateLoading,
|
|
1094
|
+
function yr(e) {
|
|
1095
|
+
var r = e.allowKeyMatching, l = r === void 0 ? true : r, a = e.animateLoading, i = e.appearance, o = i === void 0 ? "default" : i, u = e.append, c = e.allowNewValues, s = e.children, f = e.defaultPlacement, d = f === void 0 ? "vertical" : f, p = e.defaultValues, v = e.describedBy, b = e.disabled, m = e.elementRef, y = e.error, g = e.filter, S = e.footerMessage, O = e.inline, x = e.inputId, j = e.inputRef, E = e.isLoadingOptions, P = e.labelledBy, A = e.labelText, I = e.loadingMessage, B = e.menuStyle, V = B === void 0 ? sr : B, N = e.multiple, F = e.name, K = e.noOptionsMessage, H = K === void 0 ? or : K, z = e.onChange, W = e.onScroll, $ = e.onScrollBottom, X = e.onFilterChange, U = e.onClick, G = e.onClose, Q = e.onOpen, Y = e.required, Z = e.placeholder, ee = Z === void 0 ? ur : Z, re = e.prefixLabel, ne = e.prepend, te = e.repositionMode, le = te === void 0 ? "flip" : te, ae = e.selectAllAppearance, ie = ae === void 0 ? "buttongroup" : ae, ue = e.showSelectedValuesFirst, ce = e.suffixLabel, se = e.tabConfirmsNewValue, fe = e.values, de = e.virtualization, pe = e.toggle, ve = e.toggleContent, be = ve === void 0 ? "optionChildren" : ve, me = e.maxLabelItems, ye = me === void 0 ? cr : me, ge = We(e, [ "allowKeyMatching", "animateLoading", "appearance", "append", "allowNewValues", "children", "defaultPlacement", "defaultValues", "describedBy", "disabled", "elementRef", "error", "filter", "footerMessage", "inline", "inputId", "inputRef", "isLoadingOptions", "labelledBy", "labelText", "loadingMessage", "menuStyle", "multiple", "name", "noOptionsMessage", "onChange", "onScroll", "onScrollBottom", "onFilterChange", "onClick", "onClose", "onOpen", "required", "placeholder", "prefixLabel", "prepend", "repositionMode", "selectAllAppearance", "showSelectedValuesFirst", "suffixLabel", "tabConfirmsNewValue", "values", "virtualization", "toggle", "toggleContent", "maxLabelItems" ]);
|
|
1065
1096
|
// @docs-props-type SelectBasePropsBase
|
|
1066
|
-
var
|
|
1097
|
+
var he = L()({
|
|
1067
1098
|
componentName: "SelectBase",
|
|
1068
1099
|
/* eslint-disable-next-line prefer-rest-params */
|
|
1069
1100
|
componentProps: arguments[0],
|
|
@@ -1072,381 +1103,408 @@
|
|
|
1072
1103
|
valuePropName: "values"
|
|
1073
1104
|
});
|
|
1074
1105
|
// states
|
|
1075
|
-
var
|
|
1106
|
+
var Se = (0, n.useState)((function() {
|
|
1076
1107
|
return {
|
|
1077
|
-
activeItemId: (0,
|
|
1078
|
-
menuListboxId: (0,
|
|
1108
|
+
activeItemId: (0, T.createDOMID)("active-item"),
|
|
1109
|
+
menuListboxId: (0, T.createDOMID)("menu-listbox")
|
|
1079
1110
|
};
|
|
1080
|
-
})),
|
|
1081
|
-
var
|
|
1082
|
-
var
|
|
1083
|
-
var
|
|
1084
|
-
var
|
|
1085
|
-
var
|
|
1086
|
-
var
|
|
1111
|
+
})), Oe = Ve(Se, 1), we = Oe[0], Ce = we.activeItemId, xe = we.menuListboxId;
|
|
1112
|
+
var je = (0, n.useState)(0), Ee = Ve(je, 2), Pe = Ee[0], Ae = Ee[1];
|
|
1113
|
+
var Ie = (0, n.useState)(""), De = Ve(Ie, 2), Te = De[0], qe = De[1];
|
|
1114
|
+
var _e = (0, n.useState)(false), Ne = Ve(_e, 2), Fe = Ne[0], Ke = Ne[1];
|
|
1115
|
+
var He = (0, n.useState)(false), ze = Ve(He, 2), $e = ze[0], Xe = ze[1];
|
|
1116
|
+
var Ue = (0, n.useState)([]), Je = Ve(Ue, 2), Ge = Je[0], Qe = Je[1];
|
|
1117
|
+
var Ye = (0, n.useState)(p || []), er = Ve(Ye, 2), rr = er[0], ir = er[1];
|
|
1087
1118
|
// previous state
|
|
1088
|
-
var
|
|
1119
|
+
var fr = D()(Pe);
|
|
1089
1120
|
// refs
|
|
1090
|
-
var
|
|
1091
|
-
var
|
|
1092
|
-
var
|
|
1093
|
-
var
|
|
1094
|
-
var
|
|
1095
|
-
var
|
|
1096
|
-
var
|
|
1097
|
-
var
|
|
1098
|
-
var
|
|
1099
|
-
var
|
|
1100
|
-
var
|
|
1101
|
-
var
|
|
1102
|
-
var
|
|
1103
|
-
var
|
|
1104
|
-
var
|
|
1105
|
-
var
|
|
1106
|
-
(0,
|
|
1121
|
+
var pr = (0, n.useRef)(null);
|
|
1122
|
+
var vr = (0, n.useRef)(null);
|
|
1123
|
+
var yr = (0, n.useRef)(null);
|
|
1124
|
+
var gr = (0, n.useRef)([]);
|
|
1125
|
+
var hr = (0, n.useRef)([]);
|
|
1126
|
+
var Sr = (0, n.useRef)(fr);
|
|
1127
|
+
var Or = (0, n.useRef)();
|
|
1128
|
+
var wr = (0, n.useRef)({});
|
|
1129
|
+
var Cr = (0, n.useRef)(0);
|
|
1130
|
+
var kr = (0, n.useRef)([]);
|
|
1131
|
+
var xr = (0, n.useRef)(null);
|
|
1132
|
+
var jr = (0, n.useRef)();
|
|
1133
|
+
var Er = (0, n.useRef)(0);
|
|
1134
|
+
var Pr = (0, n.useRef)("none");
|
|
1135
|
+
var Ar = (0, n.useState)(g ? (0, T.createDOMID)("filter") : undefined), Lr = Ve(Ar, 1), Ir = Lr[0];
|
|
1136
|
+
var Dr = _(b, "disabled"), Rr = Dr.isDisabled;
|
|
1137
|
+
(0, n.useEffect)((function() {
|
|
1107
1138
|
if (false) {}
|
|
1108
|
-
}), [
|
|
1109
|
-
var
|
|
1110
|
-
var e =
|
|
1139
|
+
}), [ o, u, y, ne ]);
|
|
1140
|
+
var Mr = (0, n.useMemo)((function() {
|
|
1141
|
+
var e = t().Children.toArray(s);
|
|
1111
1142
|
var r = new Map;
|
|
1112
|
-
for (var
|
|
1113
|
-
var l = e[
|
|
1114
|
-
if (
|
|
1143
|
+
for (var n = 0; n < e.length; n += 1) {
|
|
1144
|
+
var l = e[n];
|
|
1145
|
+
if (lr(l)) {
|
|
1115
1146
|
r.set(l.props.value, l);
|
|
1116
1147
|
}
|
|
1117
1148
|
}
|
|
1118
1149
|
return [ e, r ];
|
|
1119
|
-
}), [ s ]),
|
|
1120
|
-
var
|
|
1121
|
-
currentValues:
|
|
1150
|
+
}), [ s ]), Tr = Ve(Mr, 2), qr = Tr[0], _r = Tr[1];
|
|
1151
|
+
var Br = mr({
|
|
1152
|
+
currentValues: he ? fe : rr,
|
|
1122
1153
|
multiple: N
|
|
1123
1154
|
});
|
|
1124
1155
|
// mutable object reference to currentValues to permit idempotent callbacks
|
|
1125
|
-
var
|
|
1126
|
-
|
|
1127
|
-
var
|
|
1156
|
+
var Vr = (0, n.useRef)(null);
|
|
1157
|
+
Vr.current = Br;
|
|
1158
|
+
var Nr = (0, n.useCallback)((function() {
|
|
1128
1159
|
// in non-multiple mode, don't move values to the top of the list
|
|
1129
|
-
return N &&
|
|
1130
|
-
}), [ N,
|
|
1131
|
-
var
|
|
1132
|
-
if (
|
|
1160
|
+
return N && ue !== "never" ? Vr.current : [];
|
|
1161
|
+
}), [ N, ue ]);
|
|
1162
|
+
var Fr = (0, n.useCallback)((function(e) {
|
|
1163
|
+
if (Rr) {
|
|
1133
1164
|
return;
|
|
1134
1165
|
}
|
|
1135
1166
|
var r = Te;
|
|
1136
|
-
|
|
1137
|
-
|
|
1167
|
+
Ke(true);
|
|
1168
|
+
Qe(Nr());
|
|
1138
1169
|
// SUI-3234: preserve existing behavior difference between <Select> and <Multiselect.Compact>
|
|
1139
1170
|
if (N) {
|
|
1140
1171
|
qe("");
|
|
1141
1172
|
}
|
|
1142
1173
|
if (r !== Te) {
|
|
1143
|
-
|
|
1174
|
+
X === null || X === void 0 ? void 0 : X(e, {
|
|
1144
1175
|
keyword: Te
|
|
1145
1176
|
});
|
|
1146
1177
|
}
|
|
1147
|
-
}), [
|
|
1148
|
-
(0,
|
|
1149
|
-
if (
|
|
1150
|
-
|
|
1151
|
-
if (
|
|
1152
|
-
|
|
1178
|
+
}), [ Rr, Te, Nr, N, X ]);
|
|
1179
|
+
(0, n.useEffect)((function() {
|
|
1180
|
+
if (Fe) {
|
|
1181
|
+
Q === null || Q === void 0 ? void 0 : Q();
|
|
1182
|
+
if (xr.current && !g) {
|
|
1183
|
+
xr.current.focus();
|
|
1153
1184
|
} else {
|
|
1154
1185
|
var e;
|
|
1155
|
-
|
|
1186
|
+
Ae((e = jr.current) !== null && e !== void 0 ? e : 0);
|
|
1156
1187
|
}
|
|
1157
1188
|
}
|
|
1158
|
-
}), [
|
|
1159
|
-
var
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
}), [
|
|
1165
|
-
var
|
|
1166
|
-
|
|
1167
|
-
|
|
1189
|
+
}), [ Q, Fe, Ge, Te, g ]);
|
|
1190
|
+
var Kr = (0, n.useCallback)((function() {
|
|
1191
|
+
Ke(false);
|
|
1192
|
+
Ae(0);
|
|
1193
|
+
Sr.current = null;
|
|
1194
|
+
G === null || G === void 0 ? void 0 : G();
|
|
1195
|
+
}), [ G ]);
|
|
1196
|
+
var Hr = (0, n.useCallback)((function() {
|
|
1197
|
+
Kr();
|
|
1198
|
+
}), [ Kr ]);
|
|
1199
|
+
var zr = (0, n.useCallback)((function(e, r) {
|
|
1200
|
+
if (Rr) {
|
|
1201
|
+
return;
|
|
1202
|
+
}
|
|
1203
|
+
var n = new Set(Vr.current);
|
|
1204
|
+
var t;
|
|
1168
1205
|
if (N) {
|
|
1169
|
-
if (
|
|
1170
|
-
|
|
1206
|
+
if (n.has(r)) {
|
|
1207
|
+
n["delete"](r);
|
|
1171
1208
|
} else {
|
|
1172
|
-
|
|
1209
|
+
n.add(r);
|
|
1173
1210
|
}
|
|
1174
|
-
|
|
1211
|
+
t = Array.from(n);
|
|
1175
1212
|
} else {
|
|
1176
1213
|
// non-multiple mode must always have a value
|
|
1177
|
-
|
|
1214
|
+
t = [ r ];
|
|
1178
1215
|
}
|
|
1179
|
-
var l = !
|
|
1216
|
+
var l = !he;
|
|
1180
1217
|
if (l) {
|
|
1181
|
-
|
|
1218
|
+
ir(t);
|
|
1182
1219
|
}
|
|
1183
1220
|
if (N) {
|
|
1184
1221
|
// in uncontrolled multiple mode, keep the menu open
|
|
1185
1222
|
if (l) {
|
|
1186
|
-
|
|
1223
|
+
Ke(true);
|
|
1187
1224
|
}
|
|
1188
1225
|
} else {
|
|
1189
1226
|
var a;
|
|
1190
1227
|
// non-multiple mode only supports a single selection
|
|
1191
1228
|
// so close the menu once a selection is made
|
|
1192
|
-
|
|
1229
|
+
Hr({
|
|
1193
1230
|
reason: "contentClick"
|
|
1194
1231
|
});
|
|
1195
|
-
(a =
|
|
1232
|
+
(a = pr.current) === null || a === void 0 ? void 0 : a.focus();
|
|
1196
1233
|
}
|
|
1197
|
-
|
|
1198
|
-
values:
|
|
1199
|
-
name:
|
|
1234
|
+
z === null || z === void 0 ? void 0 : z(e, {
|
|
1235
|
+
values: t,
|
|
1236
|
+
name: F,
|
|
1200
1237
|
reason: "valueToggle"
|
|
1201
1238
|
});
|
|
1202
|
-
}), [
|
|
1203
|
-
var
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
if (
|
|
1207
|
-
clearTimeout(
|
|
1239
|
+
}), [ Hr, he, Rr, N, F, z ]);
|
|
1240
|
+
var Wr = function e() {
|
|
1241
|
+
vr.current = null;
|
|
1242
|
+
gr.current = [];
|
|
1243
|
+
if (yr.current) {
|
|
1244
|
+
clearTimeout(yr.current);
|
|
1208
1245
|
}
|
|
1209
1246
|
};
|
|
1210
|
-
var
|
|
1247
|
+
var $r = (0, n.useCallback)((function(e) {
|
|
1248
|
+
if (Rr) {
|
|
1249
|
+
return;
|
|
1250
|
+
}
|
|
1211
1251
|
// this doesn't make sense if we can't select multiple values
|
|
1212
|
-
|
|
1252
|
+
if (!N) {
|
|
1213
1253
|
return;
|
|
1214
1254
|
}
|
|
1215
|
-
var r =
|
|
1216
|
-
var
|
|
1217
|
-
var
|
|
1255
|
+
var r = Vr.current;
|
|
1256
|
+
var n = new Set(r);
|
|
1257
|
+
var t = new Set([].concat(Me(r), Me(kr.current)));
|
|
1218
1258
|
// to keep track of custom values we create a copy of selected values and remove
|
|
1219
1259
|
// items as they are accounted for in children, leaving only custom values
|
|
1220
|
-
var l = new Set(
|
|
1260
|
+
var l = new Set(t);
|
|
1221
1261
|
var a = new Set;
|
|
1222
|
-
|
|
1223
|
-
if (
|
|
1262
|
+
qr.forEach((function(e) {
|
|
1263
|
+
if (lr(e)) {
|
|
1224
1264
|
// this value is being represented in children so it is not custom
|
|
1225
1265
|
l["delete"](e.props.value);
|
|
1226
|
-
var r =
|
|
1227
|
-
if (
|
|
1266
|
+
var r = Ze(e.props.disabled);
|
|
1267
|
+
if (t.has(e.props.value) && (!r || n.has(e.props.value))) {
|
|
1228
1268
|
a.add(e.props.value);
|
|
1229
1269
|
}
|
|
1230
1270
|
}
|
|
1231
1271
|
}));
|
|
1232
|
-
var
|
|
1233
|
-
if (!
|
|
1234
|
-
|
|
1272
|
+
var i = [].concat(Me(Array.from(l)), Me(Array.from(a)));
|
|
1273
|
+
if (!he) {
|
|
1274
|
+
ir(i);
|
|
1235
1275
|
}
|
|
1236
|
-
|
|
1237
|
-
values:
|
|
1238
|
-
name:
|
|
1276
|
+
z === null || z === void 0 ? void 0 : z(e, {
|
|
1277
|
+
values: i,
|
|
1278
|
+
name: F,
|
|
1239
1279
|
reason: "selectAll"
|
|
1240
1280
|
});
|
|
1241
|
-
}), [
|
|
1242
|
-
var
|
|
1281
|
+
}), [ qr, he, Rr, N, F, z ]);
|
|
1282
|
+
var Xr = (0, n.useCallback)((function(e) {
|
|
1283
|
+
if (Rr) {
|
|
1284
|
+
return;
|
|
1285
|
+
}
|
|
1243
1286
|
// this doesn't make sense if we can't select multiple values
|
|
1244
|
-
|
|
1287
|
+
if (!N) {
|
|
1245
1288
|
return;
|
|
1246
1289
|
}
|
|
1247
|
-
var r = new Set(
|
|
1290
|
+
var r = new Set(Vr.current);
|
|
1248
1291
|
// Preserve hidden values only when "Clear matches" semantics apply
|
|
1249
|
-
var
|
|
1250
|
-
var
|
|
1251
|
-
if (
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1292
|
+
var n = Te !== "";
|
|
1293
|
+
var t = new Set;
|
|
1294
|
+
if (n) {
|
|
1295
|
+
t = new Set(Vr.current);
|
|
1296
|
+
kr.current.forEach((function(e) {
|
|
1297
|
+
t["delete"](e);
|
|
1255
1298
|
}));
|
|
1256
1299
|
}
|
|
1257
1300
|
var l = new Set;
|
|
1258
|
-
for (var a = 0; a <
|
|
1259
|
-
var
|
|
1301
|
+
for (var a = 0; a < qr.length; a += 1) {
|
|
1302
|
+
var i = qr[a];
|
|
1260
1303
|
// this will unselect all selected values unless those values are disabled or hidden by the filter
|
|
1261
|
-
if (
|
|
1262
|
-
var
|
|
1263
|
-
if (r.has(
|
|
1264
|
-
l.add(
|
|
1304
|
+
if (lr(i)) {
|
|
1305
|
+
var o = Ze(i.props.disabled);
|
|
1306
|
+
if (r.has(i.props.value) && o || t.has(i.props.value)) {
|
|
1307
|
+
l.add(i.props.value);
|
|
1265
1308
|
}
|
|
1266
1309
|
}
|
|
1267
1310
|
}
|
|
1268
1311
|
var u = Array.from(l);
|
|
1269
|
-
if (!
|
|
1270
|
-
|
|
1312
|
+
if (!he) {
|
|
1313
|
+
ir(u);
|
|
1271
1314
|
}
|
|
1272
|
-
|
|
1315
|
+
z === null || z === void 0 ? void 0 : z(e, {
|
|
1273
1316
|
values: u,
|
|
1274
|
-
name:
|
|
1317
|
+
name: F,
|
|
1275
1318
|
reason: "clearAll"
|
|
1276
1319
|
});
|
|
1277
|
-
}), [
|
|
1278
|
-
var
|
|
1279
|
-
if (
|
|
1280
|
-
|
|
1320
|
+
}), [ qr, Te, he, Rr, N, F, z ]);
|
|
1321
|
+
var Ur = (0, n.useCallback)((function(e) {
|
|
1322
|
+
if (Fe && !E) {
|
|
1323
|
+
$ === null || $ === void 0 ? void 0 : $(e);
|
|
1281
1324
|
}
|
|
1282
|
-
}), [
|
|
1283
|
-
var
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
var
|
|
1288
|
-
|
|
1289
|
-
|
|
1325
|
+
}), [ Fe, E, $ ]);
|
|
1326
|
+
var Jr = (0, n.useCallback)((function(e) {
|
|
1327
|
+
if (Rr) {
|
|
1328
|
+
return;
|
|
1329
|
+
}
|
|
1330
|
+
var r = Cr.current;
|
|
1331
|
+
var t = e.key;
|
|
1332
|
+
var l = Or.current !== null && Or.current !== undefined ? _r.get(Or.current) : undefined;
|
|
1333
|
+
var a = Ze(l === null || l === void 0 ? void 0 : l.props.disabled);
|
|
1334
|
+
if (t === "Tab") {
|
|
1335
|
+
if (se && Or.current && Cr.current <= 1) {
|
|
1290
1336
|
if (!a) {
|
|
1291
1337
|
e.preventDefault();
|
|
1292
|
-
|
|
1338
|
+
zr(e, Or.current);
|
|
1293
1339
|
}
|
|
1294
1340
|
}
|
|
1295
1341
|
}
|
|
1296
1342
|
if (e.shiftKey || e.metaKey || e.ctrlKey) {
|
|
1297
|
-
if (
|
|
1343
|
+
if (t === "a" && (e.ctrlKey || e.metaKey)) {
|
|
1298
1344
|
// handle control + A
|
|
1299
|
-
if (
|
|
1300
|
-
|
|
1345
|
+
if (Pr.current === "all") {
|
|
1346
|
+
Xr(e);
|
|
1301
1347
|
} else {
|
|
1302
|
-
|
|
1348
|
+
$r(e);
|
|
1303
1349
|
}
|
|
1304
1350
|
}
|
|
1305
1351
|
return;
|
|
1306
1352
|
}
|
|
1307
|
-
if (
|
|
1353
|
+
if (t === "ArrowDown") {
|
|
1308
1354
|
e.preventDefault();
|
|
1309
|
-
var
|
|
1310
|
-
if (
|
|
1311
|
-
|
|
1355
|
+
var i = ie === "checkbox" ? r : r - 1;
|
|
1356
|
+
if (i >= 0) {
|
|
1357
|
+
Ae(Math.min(Pe + 1, i));
|
|
1312
1358
|
}
|
|
1313
|
-
if (s &&
|
|
1314
|
-
var
|
|
1315
|
-
if (
|
|
1316
|
-
|
|
1359
|
+
if (s && $) {
|
|
1360
|
+
var o = n.Children.toArray(s).length - (2 + Vr.current.length);
|
|
1361
|
+
if (Pe === o) {
|
|
1362
|
+
Ur(e);
|
|
1317
1363
|
}
|
|
1318
1364
|
}
|
|
1319
1365
|
}
|
|
1320
|
-
if (
|
|
1366
|
+
if (t === "ArrowUp") {
|
|
1321
1367
|
e.preventDefault();
|
|
1322
|
-
|
|
1368
|
+
Ae(Math.max(Pe - 1, 0));
|
|
1323
1369
|
}
|
|
1324
|
-
if (
|
|
1325
|
-
if (
|
|
1326
|
-
if (
|
|
1327
|
-
|
|
1370
|
+
if (t === "Enter" && Or.current && Fe) {
|
|
1371
|
+
if (Or.current === "selectAll") {
|
|
1372
|
+
if (Pr.current === "all") {
|
|
1373
|
+
Xr(e);
|
|
1328
1374
|
} else {
|
|
1329
|
-
|
|
1375
|
+
$r(e);
|
|
1330
1376
|
}
|
|
1331
1377
|
} else if (!a) {
|
|
1332
1378
|
e.preventDefault();
|
|
1333
|
-
|
|
1379
|
+
zr(e, Or.current);
|
|
1334
1380
|
}
|
|
1335
1381
|
}
|
|
1336
|
-
}), [
|
|
1337
|
-
var
|
|
1338
|
-
var
|
|
1382
|
+
}), [ Pe, s, Xr, Ur, $r, Rr, _r, $, Fe, ie, se, zr ]);
|
|
1383
|
+
var Gr = (0, n.useCallback)((function(e, r) {
|
|
1384
|
+
var n = r.value;
|
|
1385
|
+
if (Rr) {
|
|
1386
|
+
return;
|
|
1387
|
+
}
|
|
1339
1388
|
e.preventDefault();
|
|
1340
|
-
if (!
|
|
1389
|
+
if (!Fe) {
|
|
1341
1390
|
return;
|
|
1342
1391
|
}
|
|
1343
|
-
|
|
1344
|
-
}), [
|
|
1345
|
-
var
|
|
1346
|
-
var
|
|
1392
|
+
zr(e, n);
|
|
1393
|
+
}), [ Rr, Fe, zr ]);
|
|
1394
|
+
var Qr = (0, n.useCallback)((function(e, r) {
|
|
1395
|
+
var n = e.nativeEvent.key;
|
|
1347
1396
|
// Checking for a single character to avoid complications from double-byte languages and emojis.
|
|
1348
|
-
if (
|
|
1349
|
-
var
|
|
1397
|
+
if (n.length === 1) {
|
|
1398
|
+
var t = [];
|
|
1350
1399
|
var l = {
|
|
1351
1400
|
index: 0,
|
|
1352
|
-
value:
|
|
1401
|
+
value: n
|
|
1353
1402
|
};
|
|
1354
|
-
if (!
|
|
1355
|
-
if (
|
|
1356
|
-
|
|
1403
|
+
if (!vr.current) {
|
|
1404
|
+
if (n === " ") {
|
|
1405
|
+
Wr();
|
|
1357
1406
|
return;
|
|
1358
1407
|
}
|
|
1359
|
-
|
|
1360
|
-
} else if (
|
|
1361
|
-
l.index =
|
|
1362
|
-
|
|
1408
|
+
t = ke(hr.current, l);
|
|
1409
|
+
} else if (gr.current.length > 1) {
|
|
1410
|
+
l.index = vr.current.index + 1;
|
|
1411
|
+
t = ke(gr.current, l);
|
|
1363
1412
|
}
|
|
1364
|
-
if (
|
|
1413
|
+
if (t.length) {
|
|
1365
1414
|
var a;
|
|
1366
|
-
var
|
|
1415
|
+
var i = 0;
|
|
1367
1416
|
// If the active option is a first character match, cycle to the next matching option.
|
|
1368
|
-
if (l.index === 0 &&
|
|
1369
|
-
var
|
|
1370
|
-
if (
|
|
1371
|
-
|
|
1417
|
+
if (l.index === 0 && t.length > 1) {
|
|
1418
|
+
var o = t.indexOf(hr.current[r]);
|
|
1419
|
+
if (o >= 0) {
|
|
1420
|
+
i = o === t.length - 1 ? 0 : o + 1;
|
|
1372
1421
|
}
|
|
1373
1422
|
}
|
|
1374
|
-
var u =
|
|
1423
|
+
var u = t[i];
|
|
1375
1424
|
var c = u.value, s = u.label;
|
|
1376
|
-
var f =
|
|
1425
|
+
var f = wr.current[ar(c, s)];
|
|
1377
1426
|
f === null || f === void 0 ? void 0 : (a = f.focus) === null || a === void 0 ? void 0 : a.call(f);
|
|
1378
1427
|
}
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
if (
|
|
1382
|
-
clearTimeout(
|
|
1428
|
+
gr.current = t;
|
|
1429
|
+
vr.current = l;
|
|
1430
|
+
if (yr.current) {
|
|
1431
|
+
clearTimeout(yr.current);
|
|
1383
1432
|
}
|
|
1384
|
-
|
|
1433
|
+
yr.current = setTimeout(Wr, 500);
|
|
1385
1434
|
e.preventDefault();
|
|
1386
1435
|
e.stopPropagation();
|
|
1387
1436
|
}
|
|
1388
1437
|
}), []);
|
|
1389
|
-
var
|
|
1390
|
-
var
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1438
|
+
var Yr = (0, n.useCallback)((function(e, r) {
|
|
1439
|
+
var n = r.value;
|
|
1440
|
+
if (Rr) {
|
|
1441
|
+
return;
|
|
1442
|
+
}
|
|
1443
|
+
qe(n);
|
|
1444
|
+
Ke(true);
|
|
1445
|
+
Ae(0);
|
|
1446
|
+
X === null || X === void 0 ? void 0 : X(e, {
|
|
1447
|
+
keyword: n
|
|
1396
1448
|
});
|
|
1397
|
-
}), [
|
|
1398
|
-
var
|
|
1399
|
-
|
|
1449
|
+
}), [ Rr, X ]);
|
|
1450
|
+
var Zr = (0, n.useCallback)((function() {
|
|
1451
|
+
Xe(true);
|
|
1400
1452
|
}), []);
|
|
1401
|
-
var
|
|
1402
|
-
|
|
1453
|
+
var en = (0, n.useCallback)((function() {
|
|
1454
|
+
Xe(false);
|
|
1403
1455
|
}), []);
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1456
|
+
// Close when component becomes disabled/dimmed during an expanded state to prevent further selection
|
|
1457
|
+
(0, n.useEffect)((function() {
|
|
1458
|
+
if (Rr && Fe) {
|
|
1459
|
+
Kr();
|
|
1407
1460
|
}
|
|
1408
|
-
}), [
|
|
1409
|
-
var
|
|
1410
|
-
if (
|
|
1411
|
-
|
|
1461
|
+
}), [ Rr, Fe, Kr ]);
|
|
1462
|
+
var rn = (0, n.useCallback)((function(e) {
|
|
1463
|
+
if (Sr.current !== Pe) {
|
|
1464
|
+
(0, q.scrollIntoViewIfNeeded)(e);
|
|
1465
|
+
}
|
|
1466
|
+
}), [ Pe ]);
|
|
1467
|
+
var nn = (0, n.useCallback)((function(e, r, n) {
|
|
1468
|
+
if (n) {
|
|
1469
|
+
xr.current = e;
|
|
1412
1470
|
}
|
|
1413
1471
|
if (e == null) {
|
|
1414
|
-
delete
|
|
1472
|
+
delete wr.current[r];
|
|
1415
1473
|
} else {
|
|
1416
|
-
|
|
1474
|
+
wr.current[r] = e;
|
|
1417
1475
|
}
|
|
1418
|
-
}), [
|
|
1419
|
-
var
|
|
1420
|
-
|
|
1476
|
+
}), [ wr ]);
|
|
1477
|
+
var tn = (0, n.useCallback)((function(e) {
|
|
1478
|
+
pr.current = e;
|
|
1421
1479
|
Re(m, e);
|
|
1422
|
-
}), [ m,
|
|
1423
|
-
var
|
|
1424
|
-
var r =
|
|
1425
|
-
var
|
|
1426
|
-
return r && !
|
|
1480
|
+
}), [ m, pr ]);
|
|
1481
|
+
var ln = Br.some((function(e) {
|
|
1482
|
+
var r = _r.get(e);
|
|
1483
|
+
var n = Ze(r === null || r === void 0 ? void 0 : r.props.disabled);
|
|
1484
|
+
return r && !n;
|
|
1427
1485
|
}));
|
|
1428
|
-
var
|
|
1429
|
-
var
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
var e = function e(r,
|
|
1486
|
+
var an = ue === "immediately" ? Nr() : Ge;
|
|
1487
|
+
var on = (0, n.useMemo)((function() {
|
|
1488
|
+
Cr.current = 0;
|
|
1489
|
+
jr.current = undefined;
|
|
1490
|
+
Er.current = 0;
|
|
1491
|
+
Or.current = undefined;
|
|
1492
|
+
hr.current = [];
|
|
1493
|
+
var e = function e(r, n) {
|
|
1436
1494
|
return function(e) {
|
|
1437
|
-
return
|
|
1495
|
+
return nn(e, r, n);
|
|
1438
1496
|
};
|
|
1439
1497
|
};
|
|
1440
1498
|
var r;
|
|
1441
1499
|
var a = 0;
|
|
1442
|
-
var
|
|
1500
|
+
var i = false;
|
|
1443
1501
|
// used to avoid overwriting the selected item ref in multiple mode
|
|
1444
|
-
var
|
|
1445
|
-
var u = new Set(
|
|
1446
|
-
var s = new Set(
|
|
1447
|
-
var f =
|
|
1502
|
+
var o;
|
|
1503
|
+
var u = new Set(Br);
|
|
1504
|
+
var s = new Set(an !== null && an !== void 0 ? an : []);
|
|
1505
|
+
var f = qr.reduce((function(c, f, d) {
|
|
1448
1506
|
// ignore Headings and Dividers
|
|
1449
|
-
if (!
|
|
1507
|
+
if (!lr(f)) {
|
|
1450
1508
|
c.push(f);
|
|
1451
1509
|
return c;
|
|
1452
1510
|
}
|
|
@@ -1456,38 +1514,38 @@
|
|
|
1456
1514
|
r = true;
|
|
1457
1515
|
}
|
|
1458
1516
|
var h = u.has(y);
|
|
1459
|
-
var S = !!h && v !== true && v !== "disabled" && !
|
|
1460
|
-
var O = l && !N && !g && !E &&
|
|
1461
|
-
var C =
|
|
1517
|
+
var S = !!h && v !== true && v !== "disabled" && !o;
|
|
1518
|
+
var O = l && !N && !g && !E && !$;
|
|
1519
|
+
var C = ar(y, m);
|
|
1462
1520
|
var k = -1;
|
|
1463
1521
|
if (O && v !== true && v !== "disabled" && !b) {
|
|
1464
|
-
|
|
1522
|
+
hr.current.push({
|
|
1465
1523
|
label: m,
|
|
1466
1524
|
value: y
|
|
1467
1525
|
});
|
|
1468
|
-
k =
|
|
1526
|
+
k = hr.current.length - 1;
|
|
1469
1527
|
}
|
|
1470
1528
|
// Format the Menu.Item
|
|
1471
|
-
var x = (0,
|
|
1529
|
+
var x = (0, n.cloneElement)(f, {
|
|
1472
1530
|
elementRef: e(C, S),
|
|
1473
1531
|
key: f.key || d,
|
|
1474
|
-
onClick:
|
|
1532
|
+
onClick: Gr,
|
|
1475
1533
|
onKeyDown: O ? function(e) {
|
|
1476
|
-
return
|
|
1534
|
+
return Qr(e, k);
|
|
1477
1535
|
} : undefined,
|
|
1478
1536
|
selected: h,
|
|
1479
1537
|
multiple: N,
|
|
1480
1538
|
role: "option"
|
|
1481
1539
|
});
|
|
1482
1540
|
if (S) {
|
|
1483
|
-
|
|
1541
|
+
o = true;
|
|
1484
1542
|
}
|
|
1485
1543
|
if (s.has(y)) {
|
|
1486
1544
|
if (a === 0) {
|
|
1487
|
-
c.splice(a, 0,
|
|
1545
|
+
c.splice(a, 0, t().createElement(w.Divider, {
|
|
1488
1546
|
key: "topDivider"
|
|
1489
1547
|
}));
|
|
1490
|
-
|
|
1548
|
+
i = true;
|
|
1491
1549
|
}
|
|
1492
1550
|
c.splice(a, 0, x);
|
|
1493
1551
|
a += 1;
|
|
@@ -1498,30 +1556,30 @@
|
|
|
1498
1556
|
}), []);
|
|
1499
1557
|
// In multiple mode, add missing items
|
|
1500
1558
|
if (N) {
|
|
1501
|
-
for (var d =
|
|
1502
|
-
var p =
|
|
1503
|
-
var v =
|
|
1559
|
+
for (var d = Br.length - 1; d >= 0; d -= 1) {
|
|
1560
|
+
var p = Br[d];
|
|
1561
|
+
var v = _r.get(p);
|
|
1504
1562
|
if (!v) {
|
|
1505
1563
|
if (p === Te) {
|
|
1506
1564
|
r = true;
|
|
1507
1565
|
}
|
|
1508
1566
|
var b = s.has(p);
|
|
1509
|
-
var m =
|
|
1567
|
+
var m = an.length;
|
|
1510
1568
|
if (a === 0) {
|
|
1511
|
-
f.splice(0, 0,
|
|
1569
|
+
f.splice(0, 0, t().createElement(w.Divider, {
|
|
1512
1570
|
key: "topDivider"
|
|
1513
1571
|
}));
|
|
1514
1572
|
a += 1;
|
|
1515
|
-
|
|
1573
|
+
i = true;
|
|
1516
1574
|
}
|
|
1517
1575
|
var y = String(p);
|
|
1518
|
-
var h =
|
|
1519
|
-
f.splice(b ? 0 : m + 1, 0,
|
|
1576
|
+
var h = ar(p, y);
|
|
1577
|
+
f.splice(b ? 0 : m + 1, 0, t().createElement(J, {
|
|
1520
1578
|
elementRef: e(h),
|
|
1521
1579
|
label: y,
|
|
1522
1580
|
value: p,
|
|
1523
1581
|
key: "missing-value-".concat(p),
|
|
1524
|
-
onClick:
|
|
1582
|
+
onClick: Gr,
|
|
1525
1583
|
multiple: N,
|
|
1526
1584
|
selected: true
|
|
1527
1585
|
}));
|
|
@@ -1533,45 +1591,45 @@
|
|
|
1533
1591
|
}
|
|
1534
1592
|
var S = g === "controlled";
|
|
1535
1593
|
// Filter the items
|
|
1536
|
-
var O = (0,
|
|
1594
|
+
var O = (0, R.stringToKeywords)(Te);
|
|
1537
1595
|
f = S ? f : f.filter((function(e) {
|
|
1538
|
-
if (
|
|
1539
|
-
return (0,
|
|
1596
|
+
if (lr(e)) {
|
|
1597
|
+
return (0, R.testPhrase)(e.props.label, O);
|
|
1540
1598
|
}
|
|
1541
1599
|
return true;
|
|
1542
1600
|
// Keep all headers and non-interactive options
|
|
1543
1601
|
})).map((function(e) {
|
|
1544
|
-
if (!
|
|
1602
|
+
if (!lr(e)) {
|
|
1545
1603
|
return e;
|
|
1546
1604
|
}
|
|
1547
1605
|
// highlight matched text
|
|
1548
|
-
var r = O && (0,
|
|
1606
|
+
var r = O && (0, R.keywordLocations)(e.props.label, O);
|
|
1549
1607
|
|
|
1550
|
-
return (0,
|
|
1608
|
+
return (0, n.cloneElement)(e, {
|
|
1551
1609
|
matchRanges: r || undefined
|
|
1552
1610
|
});
|
|
1553
1611
|
}));
|
|
1554
1612
|
// Add the option to add the new value
|
|
1555
1613
|
if (c && !r && Te) {
|
|
1556
|
-
var C =
|
|
1614
|
+
var C = i ? a + 1 : a;
|
|
1557
1615
|
var k = "".concat(Te, " (new value)");
|
|
1558
|
-
var x =
|
|
1559
|
-
f.splice(C, 0,
|
|
1616
|
+
var x = ar(Te, k);
|
|
1617
|
+
f.splice(C, 0, t().createElement(J, {
|
|
1560
1618
|
elementRef: e(x),
|
|
1561
1619
|
label: k,
|
|
1562
1620
|
value: Te,
|
|
1563
1621
|
key: "newValue",
|
|
1564
1622
|
multiple: N,
|
|
1565
|
-
onClick:
|
|
1623
|
+
onClick: Gr
|
|
1566
1624
|
}));
|
|
1567
1625
|
}
|
|
1568
1626
|
// When selectAll is a menu item, add an offset so that activeItem accounts for the extra selectAll option.
|
|
1569
|
-
var j =
|
|
1627
|
+
var j = ie === "checkbox" && N && f.length > 1 ? 1 : 0;
|
|
1570
1628
|
var P = true;
|
|
1571
1629
|
// Highlight the selected Items and remove hidden
|
|
1572
1630
|
f = f.reduce((function(e, r) {
|
|
1573
1631
|
// ignore Dividers & Headings
|
|
1574
|
-
if (!
|
|
1632
|
+
if (!lr(r)) {
|
|
1575
1633
|
e.push(r);
|
|
1576
1634
|
return e;
|
|
1577
1635
|
}
|
|
@@ -1579,182 +1637,182 @@
|
|
|
1579
1637
|
if (r.props && r.props.hidden) {
|
|
1580
1638
|
return e;
|
|
1581
1639
|
}
|
|
1582
|
-
if (r.props.selected && r.props.disabled !== true && r.props.disabled !== "disabled" &&
|
|
1583
|
-
|
|
1640
|
+
if (r.props.selected && r.props.disabled !== true && r.props.disabled !== "disabled" && jr.current == null) {
|
|
1641
|
+
jr.current = Cr.current;
|
|
1584
1642
|
}
|
|
1585
|
-
var
|
|
1586
|
-
if (
|
|
1643
|
+
var t = r.props.disabled;
|
|
1644
|
+
if (t === true || t === "disabled") {
|
|
1587
1645
|
e.push(r);
|
|
1588
1646
|
return e;
|
|
1589
1647
|
}
|
|
1590
|
-
var l = j ===
|
|
1648
|
+
var l = j === Pe;
|
|
1591
1649
|
j += 1;
|
|
1592
|
-
|
|
1650
|
+
Cr.current += 1;
|
|
1593
1651
|
// Dimmed Options can receive focus but are not selectable
|
|
1594
|
-
|
|
1595
|
-
if (r.key !== "newValue" &&
|
|
1652
|
+
Er.current += r.props.selected && t !== "dimmed" ? 1 : 0;
|
|
1653
|
+
if (r.key !== "newValue" && t !== "dimmed" && !r.props.selected) {
|
|
1596
1654
|
P = false;
|
|
1597
1655
|
}
|
|
1598
|
-
if (!l ||
|
|
1656
|
+
if (!l || !$e) {
|
|
1599
1657
|
e.push(r);
|
|
1600
1658
|
return e;
|
|
1601
1659
|
}
|
|
1602
|
-
|
|
1603
|
-
var a = (0,
|
|
1660
|
+
Or.current = r.props.value;
|
|
1661
|
+
var a = (0, n.cloneElement)(r, {
|
|
1604
1662
|
active: l,
|
|
1605
|
-
elementRef:
|
|
1606
|
-
id:
|
|
1663
|
+
elementRef: rn,
|
|
1664
|
+
id: Ce
|
|
1607
1665
|
});
|
|
1608
1666
|
e.push(a);
|
|
1609
1667
|
return e;
|
|
1610
1668
|
}), []);
|
|
1611
|
-
|
|
1669
|
+
Pr.current = Er.current === 0 && "none" || P && "all" || "some";
|
|
1612
1670
|
// add select all option
|
|
1613
|
-
if (
|
|
1614
|
-
var A =
|
|
1671
|
+
if (ie === "checkbox" && N && Cr.current > 0) {
|
|
1672
|
+
var A = Pe === 0 && !!g;
|
|
1615
1673
|
var L;
|
|
1616
|
-
if (
|
|
1674
|
+
if (Pr.current === "all") {
|
|
1617
1675
|
if (Te === "") {
|
|
1618
|
-
L = (0,
|
|
1676
|
+
L = (0, M._)("Clear all");
|
|
1619
1677
|
} else {
|
|
1620
|
-
L = (0,
|
|
1678
|
+
L = (0, M._)("Clear all matches");
|
|
1621
1679
|
}
|
|
1622
1680
|
} else if (Te === "") {
|
|
1623
|
-
L = (0,
|
|
1681
|
+
L = (0, M._)("Select all");
|
|
1624
1682
|
} else {
|
|
1625
|
-
L = (0,
|
|
1683
|
+
L = (0, M._)("Select all matches");
|
|
1626
1684
|
}
|
|
1627
1685
|
if (A) {
|
|
1628
|
-
|
|
1686
|
+
Or.current = "selectAll";
|
|
1629
1687
|
}
|
|
1630
|
-
f.unshift(
|
|
1688
|
+
f.unshift( t().createElement(oe, {
|
|
1631
1689
|
key: "select-all-option",
|
|
1632
1690
|
active: A,
|
|
1633
|
-
elementRef:
|
|
1634
|
-
id: A ?
|
|
1635
|
-
onClick:
|
|
1691
|
+
elementRef: rn,
|
|
1692
|
+
id: A ? Ce : undefined,
|
|
1693
|
+
onClick: Pr.current === "all" ? Xr : $r,
|
|
1636
1694
|
label: L,
|
|
1637
|
-
selected:
|
|
1638
|
-
totalCount: !!
|
|
1695
|
+
selected: Pr.current === "all" || Pr.current !== "none" && "some",
|
|
1696
|
+
totalCount: !!pe && Br.length || undefined,
|
|
1639
1697
|
tabIndex: g ? -1 : undefined
|
|
1640
|
-
}),
|
|
1698
|
+
}), t().createElement(w.Divider, {
|
|
1641
1699
|
key: "selectAllDivider"
|
|
1642
1700
|
}));
|
|
1643
1701
|
}
|
|
1644
|
-
|
|
1645
|
-
if (
|
|
1702
|
+
kr.current = f.reduce((function(e, r) {
|
|
1703
|
+
if (lr(r)) {
|
|
1646
1704
|
e.push(r.props.value);
|
|
1647
1705
|
}
|
|
1648
1706
|
return e;
|
|
1649
1707
|
}), []);
|
|
1650
1708
|
return f;
|
|
1651
|
-
}), [
|
|
1652
|
-
var
|
|
1653
|
-
var
|
|
1654
|
-
var u =
|
|
1655
|
-
anchorWidth:
|
|
1709
|
+
}), [ Pe, Ce, l, c, qr, _r, Br, g, Te, rn, Xr, Gr, Qr, nn, $r, E, N, an, $, ie, $e, pe ]);
|
|
1710
|
+
var un = function e(r) {
|
|
1711
|
+
var n = r.anchorWidth, l = r.maxHeight, i = r.placement, o = r.toggleId;
|
|
1712
|
+
var u = nr({
|
|
1713
|
+
anchorWidth: n,
|
|
1656
1714
|
isMultiple: N,
|
|
1657
1715
|
maxHeight: l,
|
|
1658
|
-
menuStyle:
|
|
1716
|
+
menuStyle: V
|
|
1659
1717
|
});
|
|
1660
|
-
var c =
|
|
1718
|
+
var c = Br.length > 0 && !ln && !g ? 0 : undefined;
|
|
1661
1719
|
var s = {
|
|
1662
1720
|
"aria-multiselectable": N || undefined,
|
|
1663
|
-
childrenStart: !!g &&
|
|
1664
|
-
activeItemId:
|
|
1665
|
-
filterA11yId:
|
|
1721
|
+
childrenStart: !!g && t().createElement(dr, {
|
|
1722
|
+
activeItemId: Ce,
|
|
1723
|
+
filterA11yId: Ir,
|
|
1666
1724
|
filterKeyword: Te,
|
|
1667
|
-
hasChildren:
|
|
1668
|
-
return
|
|
1725
|
+
hasChildren: on.some((function(e) {
|
|
1726
|
+
return lr(e);
|
|
1669
1727
|
})),
|
|
1670
1728
|
inputId: x,
|
|
1671
1729
|
inputRef: j,
|
|
1672
|
-
menuListboxId:
|
|
1730
|
+
menuListboxId: xe,
|
|
1673
1731
|
multiple: N,
|
|
1674
|
-
onClearAll:
|
|
1675
|
-
onSelectAll:
|
|
1676
|
-
onTextBlur:
|
|
1677
|
-
onTextChange:
|
|
1678
|
-
onTextFocus:
|
|
1679
|
-
onTextKeyDown:
|
|
1680
|
-
optionSelection:
|
|
1681
|
-
placement:
|
|
1682
|
-
selectAllAppearance:
|
|
1683
|
-
textHasFocus:
|
|
1732
|
+
onClearAll: Xr,
|
|
1733
|
+
onSelectAll: $r,
|
|
1734
|
+
onTextBlur: en,
|
|
1735
|
+
onTextChange: Yr,
|
|
1736
|
+
onTextFocus: Zr,
|
|
1737
|
+
onTextKeyDown: Jr,
|
|
1738
|
+
optionSelection: Pr,
|
|
1739
|
+
placement: i,
|
|
1740
|
+
selectAllAppearance: ie,
|
|
1741
|
+
textHasFocus: $e
|
|
1684
1742
|
}),
|
|
1685
1743
|
focusMode: g ? "never" : undefined,
|
|
1686
1744
|
isLoading: E,
|
|
1687
|
-
labelledBy: "".concat(
|
|
1745
|
+
labelledBy: "".concat(Ir !== null && Ir !== void 0 ? Ir : "", " ").concat(o !== null && o !== void 0 ? o : "").trim(),
|
|
1688
1746
|
// NVDA ignores aria-labelledby attribute on popover, but reads it on menu
|
|
1689
|
-
menuId:
|
|
1690
|
-
onScrollBottom:
|
|
1691
|
-
placement:
|
|
1692
|
-
noOptionsMessage:
|
|
1747
|
+
menuId: xe,
|
|
1748
|
+
onScrollBottom: $ ? Ur : undefined,
|
|
1749
|
+
placement: i !== null && i !== void 0 ? i : undefined,
|
|
1750
|
+
noOptionsMessage: H,
|
|
1693
1751
|
footerMessage: S,
|
|
1694
1752
|
animateLoading: a,
|
|
1695
1753
|
loadingMessage: I,
|
|
1696
|
-
onScroll:
|
|
1754
|
+
onScroll: W,
|
|
1697
1755
|
style: u,
|
|
1698
1756
|
tabIndex: c
|
|
1699
1757
|
};
|
|
1700
|
-
if (
|
|
1758
|
+
if (de) {
|
|
1701
1759
|
|
|
1702
|
-
return
|
|
1703
|
-
virtualization:
|
|
1704
|
-
}, s),
|
|
1760
|
+
return t().createElement(C.VirtualizedResultsMenu, Be({
|
|
1761
|
+
virtualization: de
|
|
1762
|
+
}, s), on);
|
|
1705
1763
|
}
|
|
1706
1764
|
|
|
1707
|
-
return
|
|
1765
|
+
return t().createElement(k(), s, on);
|
|
1708
1766
|
};
|
|
1709
|
-
var
|
|
1767
|
+
var cn = (0, n.useMemo)((function() {
|
|
1710
1768
|
|
|
1711
|
-
return
|
|
1712
|
-
appearance:
|
|
1769
|
+
return t().createElement(br, Be({
|
|
1770
|
+
appearance: o,
|
|
1713
1771
|
append: u,
|
|
1714
|
-
currentValues:
|
|
1772
|
+
currentValues: Br,
|
|
1715
1773
|
"data-test": N ? "multiselect" : "select",
|
|
1716
1774
|
describedBy: v,
|
|
1717
1775
|
disabled: b,
|
|
1718
|
-
elementRef:
|
|
1776
|
+
elementRef: tn,
|
|
1719
1777
|
error: y,
|
|
1720
1778
|
inline: O,
|
|
1721
1779
|
labelText: A,
|
|
1722
1780
|
labelledBy: P,
|
|
1723
1781
|
multiple: N,
|
|
1724
|
-
onClick:
|
|
1725
|
-
placeholder:
|
|
1726
|
-
prefixLabel:
|
|
1727
|
-
prepend:
|
|
1728
|
-
required:
|
|
1729
|
-
suffixLabel:
|
|
1730
|
-
toggle:
|
|
1731
|
-
toggleContent:
|
|
1732
|
-
maxLabelItems:
|
|
1733
|
-
},
|
|
1734
|
-
}), [
|
|
1782
|
+
onClick: Rr ? undefined : U,
|
|
1783
|
+
placeholder: ee,
|
|
1784
|
+
prefixLabel: re,
|
|
1785
|
+
prepend: ne,
|
|
1786
|
+
required: Y,
|
|
1787
|
+
suffixLabel: ce,
|
|
1788
|
+
toggle: pe,
|
|
1789
|
+
toggleContent: be,
|
|
1790
|
+
maxLabelItems: ye
|
|
1791
|
+
}, ge), s);
|
|
1792
|
+
}), [ o, u, Br, N, v, b, tn, y, O, A, P, Rr, U, ee, re, ne, Y, ce, pe, be, ye, ge, s ]);
|
|
1735
1793
|
|
|
1736
|
-
return
|
|
1794
|
+
return t().createElement(h(), {
|
|
1737
1795
|
closeReasons: tr,
|
|
1738
1796
|
inputId: x,
|
|
1739
|
-
"aria-labelledby":
|
|
1740
|
-
toggle:
|
|
1741
|
-
onRequestOpen:
|
|
1742
|
-
onRequestClose:
|
|
1743
|
-
open:
|
|
1744
|
-
openWithArrowKeys: !
|
|
1745
|
-
repositionMode:
|
|
1797
|
+
"aria-labelledby": Ir,
|
|
1798
|
+
toggle: cn,
|
|
1799
|
+
onRequestOpen: Fr,
|
|
1800
|
+
onRequestClose: Hr,
|
|
1801
|
+
open: Fe,
|
|
1802
|
+
openWithArrowKeys: !Rr,
|
|
1803
|
+
repositionMode: le,
|
|
1746
1804
|
defaultPlacement: d,
|
|
1747
|
-
canCoverAnchor:
|
|
1805
|
+
canCoverAnchor: Le().innerHeight < 500,
|
|
1748
1806
|
retainFocus: false,
|
|
1749
|
-
takeFocus:
|
|
1750
|
-
},
|
|
1807
|
+
takeFocus: Br.length === 0 || Br.length > 0 && !ln || !!g
|
|
1808
|
+
}, un);
|
|
1751
1809
|
}
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
/* harmony default export */ const
|
|
1810
|
+
yr.propTypes = er;
|
|
1811
|
+
yr.componentType = "SelectBase";
|
|
1812
|
+
yr.Option = J;
|
|
1813
|
+
yr.Divider = w.Divider;
|
|
1814
|
+
yr.Heading = w.Heading;
|
|
1815
|
+
/* harmony default export */ const gr = yr;
|
|
1758
1816
|
// CONCATENATED MODULE: ./src/SelectBase/index.ts
|
|
1759
1817
|
module.exports = r;
|
|
1760
1818
|
/******/})();
|