@splunk/react-ui 5.0.0 → 5.1.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/Accordion.js +59 -59
- package/Avatar.js +20 -20
- package/Breadcrumbs.js +46 -46
- package/Button.js +24 -24
- package/CHANGELOG.md +21 -2
- package/Calendar.js +69 -69
- package/Card.js +68 -68
- package/Chip.js +16 -16
- package/Clickable.js +29 -29
- package/Code.js +654 -519
- package/CollapsiblePanel.js +112 -112
- package/Color.js +107 -107
- package/ColumnLayout.js +35 -35
- package/ComboBox.js +190 -206
- package/ControlGroup.js +128 -120
- package/Date.js +148 -146
- package/DefinitionList.js +26 -26
- package/DualListbox.js +701 -717
- package/File.js +403 -403
- package/FormRows.js +66 -63
- package/Image.js +15 -15
- package/JSONTree.js +458 -357
- package/Layer.js +60 -72
- package/Markdown.js +66 -66
- package/Menu.js +44 -44
- package/Modal.js +49 -49
- package/ModalLayer.js +6 -6
- package/Monogram.js +16 -16
- package/Multiselect.js +622 -624
- package/Number.js +100 -100
- package/Paginator.js +7 -7
- package/Popover.js +453 -407
- package/Progress.js +12 -12
- package/Prose.js +6 -6
- package/RadioBar.js +180 -166
- package/RadioList.js +80 -79
- package/ResultsMenu.js +15 -15
- package/Scroll.js +50 -50
- package/Search.js +148 -164
- package/Select.js +668 -670
- package/Slider.js +30 -30
- package/SlidingPanels.js +24 -24
- package/SplitButton.js +50 -50
- package/StepBar.js +100 -100
- package/Switch.js +45 -45
- package/TabBar.js +196 -196
- package/TabLayout.js +16 -16
- package/Table.js +1207 -1193
- package/Text.js +65 -65
- package/TextArea.js +108 -93
- package/Tooltip.js +203 -197
- package/Tree.js +464 -366
- package/package.json +6 -6
- package/stubs-dependencies.d.ts +0 -70
- package/stubs-splunkui.d.ts +4 -0
- package/types/src/Code/Code.d.ts +17 -1
- package/types/src/Code/LineHighlights.d.ts +11 -0
- package/types/src/Code/LineNumbers.d.ts +6 -0
- package/types/src/Code/docs/examples/LineHighlights.d.ts +3 -0
- package/types/src/Code/docs/examples/LineNumbers.d.ts +3 -0
- package/types/src/Code/docs/examples/LineNumbersCustomStart.d.ts +3 -0
- package/types/src/Date/Date.d.ts +6 -1
- package/types/src/DefinitionList/DefinitionList.d.ts +6 -6
- package/types/src/FormRows/FormRows.d.ts +1 -1
- package/types/src/JSONTree/JSONTreeItem.d.ts +5 -2
- package/types/src/Markdown/Markdown.d.ts +1 -1
- package/types/src/Markdown/renderers/MarkdownBlockquote.d.ts +1 -1
- package/types/src/Markdown/renderers/MarkdownCodeBlock.d.ts +1 -1
- package/types/src/Markdown/renderers/index.d.ts +1 -1
- package/types/src/Popover/Popover.d.ts +1 -1
- package/types/src/RadioBar/Option.d.ts +1 -1
- package/types/src/RadioBar/RadioBar.d.ts +13 -6
- package/types/src/RadioBar/RadioBarContext.d.ts +4 -2
- package/types/src/RadioList/RadioList.d.ts +2 -1
- package/types/src/ScreenReaderContent/docs/examples/SkipLink.d.ts +3 -0
- package/types/src/Scroll/Inner.d.ts +1 -1
- package/types/src/Select/Option.d.ts +1 -1
- package/types/src/Select/Select.d.ts +1 -1
- package/types/src/Slider/docs/examples/Controlled.d.ts +1 -1
- package/types/src/TabLayout/Panel.d.ts +0 -1
- package/types/src/Table/Head.d.ts +1 -0
- package/types/src/Table/HeadCell.d.ts +2 -3
- package/types/src/Table/HeadDropdownCell.d.ts +2 -2
- package/types/src/Table/HeadInner.d.ts +4 -4
- package/types/src/Table/KeyboardSensor.d.ts +1 -1
- package/types/src/Table/RowDragCell.d.ts +1 -1
- package/types/src/Tooltip/Tooltip.d.ts +10 -5
- package/types/src/Tree/Item.d.ts +63 -0
- package/types/src/Tree/Tree.d.ts +13 -6
- package/types/src/Tree/TreeContext.d.ts +1 -1
- package/types/src/Tree/index.d.ts +1 -1
- package/types/src/useControlled/useControlled.d.ts +3 -1
- package/useControlled.js +29 -13
- package/types/src/Tree/TreeItem.d.ts +0 -44
package/Multiselect.js
CHANGED
|
@@ -2,18 +2,33 @@
|
|
|
2
2
|
// webpackBootstrap
|
|
3
3
|
/******/ "use strict";
|
|
4
4
|
/******/ var e = {
|
|
5
|
-
/***/
|
|
5
|
+
/***/ 3639:
|
|
6
6
|
/***/ (e, n, r) => {
|
|
7
7
|
// EXPORTS
|
|
8
8
|
r.d(n, {
|
|
9
|
-
default: () => /* reexport */
|
|
9
|
+
default: () => /* reexport */ s
|
|
10
10
|
});
|
|
11
|
+
// UNUSED EXPORTS: isAllowedType, isPrimitive
|
|
11
12
|
// EXTERNAL MODULE: external "react"
|
|
12
13
|
var t = r(9497);
|
|
14
|
+
// CONCATENATED MODULE: external "lodash/isEqual"
|
|
15
|
+
const o = require("lodash/isEqual");
|
|
13
16
|
// EXTERNAL MODULE: external "lodash/has"
|
|
14
|
-
var
|
|
15
|
-
var
|
|
17
|
+
var l = r(5919);
|
|
18
|
+
var a = r.n(l);
|
|
16
19
|
// CONCATENATED MODULE: ./src/useControlled/useControlled.tsx
|
|
20
|
+
function i(e) {
|
|
21
|
+
return e === null || e === undefined || typeof e === "boolean" || typeof e === "string" || typeof e === "number";
|
|
22
|
+
}
|
|
23
|
+
function u(e) {
|
|
24
|
+
if (i(e)) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
if (Array.isArray(e)) {
|
|
28
|
+
return e.every(i);
|
|
29
|
+
}
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
17
32
|
/**
|
|
18
33
|
* This is a private component not intended for use outside @splunk/react-ui
|
|
19
34
|
*
|
|
@@ -23,10 +38,9 @@
|
|
|
23
38
|
* are not happening.
|
|
24
39
|
*
|
|
25
40
|
* Return the controlled state of the component.
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
var
|
|
29
|
-
var s = (0, t.useRef)(l()(n, c));
|
|
41
|
+
*/ function c(e) {
|
|
42
|
+
var n = e.componentProps, r = e.componentName, o = r === void 0 ? "this component" : r, l = e.defaultValuePropName, i = l === void 0 ? "defaultValue" : l, u = e.valuePropName, c = u === void 0 ? "value" : u;
|
|
43
|
+
var s = (0, t.useRef)(a()(n, c));
|
|
30
44
|
var d = (0, t.useRef)(n[i]);
|
|
31
45
|
(0, t.useEffect)((function() {
|
|
32
46
|
if (false) {}
|
|
@@ -34,10 +48,11 @@
|
|
|
34
48
|
(0, t.useEffect)((function() {
|
|
35
49
|
if (false) {}
|
|
36
50
|
if (false) {}
|
|
51
|
+
if (false) {}
|
|
37
52
|
}), [ o, n, i, c ]);
|
|
38
53
|
return s.current;
|
|
39
54
|
}
|
|
40
|
-
/* harmony default export */ const
|
|
55
|
+
/* harmony default export */ const s = c;
|
|
41
56
|
} // CONCATENATED MODULE: ./src/useControlled/index.ts
|
|
42
57
|
/***/ ,
|
|
43
58
|
/***/ 5919:
|
|
@@ -137,16 +152,16 @@
|
|
|
137
152
|
Divider: () => /* reexport */ u.Divider,
|
|
138
153
|
Heading: () => /* reexport */ u.Heading,
|
|
139
154
|
Option: () => /* reexport */ M,
|
|
140
|
-
default: () => /* reexport */
|
|
155
|
+
default: () => /* reexport */ Kr
|
|
141
156
|
});
|
|
142
157
|
// EXTERNAL MODULE: external "react"
|
|
143
158
|
var e = r(9497);
|
|
144
159
|
var n = r.n(e);
|
|
145
|
-
// CONCATENATED MODULE: external "prop-types"
|
|
146
|
-
const o = require("prop-types");
|
|
147
|
-
var l = r.n(o);
|
|
148
160
|
// EXTERNAL MODULE: external "lodash/has"
|
|
149
|
-
var
|
|
161
|
+
var o = r(5919);
|
|
162
|
+
var l = r.n(o);
|
|
163
|
+
// CONCATENATED MODULE: external "prop-types"
|
|
164
|
+
const a = require("prop-types");
|
|
150
165
|
var i = r.n(a);
|
|
151
166
|
// CONCATENATED MODULE: external "@splunk/react-ui/Menu"
|
|
152
167
|
const u = require("@splunk/react-ui/Menu");
|
|
@@ -197,18 +212,18 @@
|
|
|
197
212
|
return e;
|
|
198
213
|
}
|
|
199
214
|
function m(e, n, r) {
|
|
200
|
-
return (n =
|
|
215
|
+
return (n = y(n)) in e ? Object.defineProperty(e, n, {
|
|
201
216
|
value: r,
|
|
202
217
|
enumerable: !0,
|
|
203
218
|
configurable: !0,
|
|
204
219
|
writable: !0
|
|
205
220
|
}) : e[n] = r, e;
|
|
206
221
|
}
|
|
207
|
-
function
|
|
208
|
-
var n =
|
|
222
|
+
function y(e) {
|
|
223
|
+
var n = g(e, "string");
|
|
209
224
|
return "symbol" == f(n) ? n : n + "";
|
|
210
225
|
}
|
|
211
|
-
function
|
|
226
|
+
function g(e, n) {
|
|
212
227
|
if ("object" != f(e) || !e) return e;
|
|
213
228
|
var r = e[Symbol.toPrimitive];
|
|
214
229
|
if (void 0 !== r) {
|
|
@@ -242,52 +257,52 @@
|
|
|
242
257
|
}
|
|
243
258
|
var S = {
|
|
244
259
|
/** @private */
|
|
245
|
-
active:
|
|
246
|
-
children:
|
|
247
|
-
description:
|
|
248
|
-
descriptionPosition:
|
|
249
|
-
disabled:
|
|
250
|
-
elementRef:
|
|
251
|
-
hidden:
|
|
252
|
-
icon:
|
|
253
|
-
label:
|
|
260
|
+
active: i().bool,
|
|
261
|
+
children: i().node,
|
|
262
|
+
description: i().string,
|
|
263
|
+
descriptionPosition: i().oneOf([ "right", "bottom" ]),
|
|
264
|
+
disabled: i().bool,
|
|
265
|
+
elementRef: i().oneOfType([ i().func, i().object ]),
|
|
266
|
+
hidden: i().bool,
|
|
267
|
+
icon: i().node,
|
|
268
|
+
label: i().string.isRequired,
|
|
254
269
|
/**
|
|
255
270
|
* @private Passed down from <BaseSelect>
|
|
256
271
|
*/
|
|
257
|
-
multiple:
|
|
258
|
-
matchRanges:
|
|
259
|
-
start:
|
|
260
|
-
end:
|
|
272
|
+
multiple: i().bool,
|
|
273
|
+
matchRanges: i().arrayOf(i().shape({
|
|
274
|
+
start: i().number.isRequired,
|
|
275
|
+
end: i().number.isRequired
|
|
261
276
|
})),
|
|
262
277
|
/** @private */
|
|
263
|
-
onClick:
|
|
278
|
+
onClick: i().func,
|
|
264
279
|
/** @private */
|
|
265
|
-
role:
|
|
280
|
+
role: i().oneOf([ "menuitemcheckbox", "option" ]),
|
|
266
281
|
/** @private */
|
|
267
|
-
selected:
|
|
268
|
-
truncate:
|
|
269
|
-
value:
|
|
282
|
+
selected: i().oneOfType([ i().bool, i().oneOf([ "some" ]) ]),
|
|
283
|
+
truncate: i().bool,
|
|
284
|
+
value: i().oneOfType([ i().string, i().number, i().bool ]).isRequired
|
|
270
285
|
};
|
|
271
286
|
/**
|
|
272
287
|
* An option within a `Multiselect`.
|
|
273
288
|
*/ function w(r) {
|
|
274
|
-
var t = r.children, o = r.descriptionPosition, l = o === void 0 ? "bottom" : o, a = r.disabled, i = r.elementRef, c = r.icon, s = r.label, d = r.multiple, f = r.onClick, v = r.role, m = v === void 0 ? "option" : v,
|
|
289
|
+
var t = r.children, o = r.descriptionPosition, l = o === void 0 ? "bottom" : o, a = r.disabled, i = r.elementRef, c = r.icon, s = r.label, d = r.multiple, f = r.onClick, v = r.role, m = v === void 0 ? "option" : v, y = r.value, g = h(r, [ "children", "descriptionPosition", "disabled", "elementRef", "icon", "label", "multiple", "onClick", "role", "value" ]);
|
|
275
290
|
// @docs-props-type OptionPropsBase
|
|
276
291
|
var O = (0, e.useCallback)((function(e) {
|
|
277
292
|
if (!a) {
|
|
278
293
|
f === null || f === void 0 ? void 0 : f(e, {
|
|
279
|
-
value:
|
|
294
|
+
value: y
|
|
280
295
|
});
|
|
281
296
|
}
|
|
282
|
-
}), [ a, f,
|
|
283
|
-
var S =
|
|
297
|
+
}), [ a, f, y ]);
|
|
298
|
+
var S = y.toString();
|
|
284
299
|
var w = b({
|
|
285
300
|
descriptionPosition: l,
|
|
286
301
|
disabled: a ? "disabled" : undefined
|
|
287
|
-
},
|
|
302
|
+
}, g);
|
|
288
303
|
|
|
289
304
|
return n().createElement(u.Item, p({
|
|
290
|
-
"data-test-value":
|
|
305
|
+
"data-test-value": y,
|
|
291
306
|
"data-test": "option",
|
|
292
307
|
elementRef: i
|
|
293
308
|
}, w, {
|
|
@@ -339,39 +354,39 @@
|
|
|
339
354
|
}
|
|
340
355
|
var P = {
|
|
341
356
|
/** @private */
|
|
342
|
-
active:
|
|
343
|
-
children:
|
|
357
|
+
active: i().bool,
|
|
358
|
+
children: i().node,
|
|
344
359
|
/**
|
|
345
360
|
* @private this is passed down from Multiselect.
|
|
346
361
|
*/
|
|
347
|
-
compact:
|
|
348
|
-
description:
|
|
349
|
-
descriptionPosition:
|
|
350
|
-
disabled:
|
|
351
|
-
elementRef:
|
|
352
|
-
hidden:
|
|
353
|
-
icon:
|
|
354
|
-
label:
|
|
355
|
-
matchRanges:
|
|
356
|
-
start:
|
|
357
|
-
end:
|
|
362
|
+
compact: i().bool,
|
|
363
|
+
description: i().string,
|
|
364
|
+
descriptionPosition: i().oneOf([ "right", "bottom" ]),
|
|
365
|
+
disabled: i().bool,
|
|
366
|
+
elementRef: i().oneOfType([ i().func, i().object ]),
|
|
367
|
+
hidden: i().bool,
|
|
368
|
+
icon: i().node,
|
|
369
|
+
label: i().string.isRequired,
|
|
370
|
+
matchRanges: i().arrayOf(i().shape({
|
|
371
|
+
start: i().number.isRequired,
|
|
372
|
+
end: i().number.isRequired
|
|
358
373
|
})),
|
|
359
374
|
/** @private */
|
|
360
|
-
onClick:
|
|
375
|
+
onClick: i().func,
|
|
361
376
|
/** @private */
|
|
362
|
-
role:
|
|
377
|
+
role: i().oneOf([ "menuitemcheckbox", "option" ]),
|
|
363
378
|
/** @private */
|
|
364
|
-
selected:
|
|
365
|
-
selectedAppearance:
|
|
366
|
-
selectedBackgroundColor:
|
|
367
|
-
selectedForegroundColor:
|
|
368
|
-
truncate:
|
|
369
|
-
value:
|
|
379
|
+
selected: i().bool,
|
|
380
|
+
selectedAppearance: i().oneOf([ "info", "success", "warning", "error" ]),
|
|
381
|
+
selectedBackgroundColor: i().string,
|
|
382
|
+
selectedForegroundColor: i().string,
|
|
383
|
+
truncate: i().bool,
|
|
384
|
+
value: i().oneOfType([ i().string, i().number, i().bool ]).isRequired
|
|
370
385
|
};
|
|
371
386
|
/**
|
|
372
387
|
* An option within a `Multiselect`.
|
|
373
388
|
*/ function E(e) {
|
|
374
|
-
var r = e.compact, t = e.children, o = e.description, l = e.descriptionPosition, a = l === void 0 ? "bottom" : l, i = e.disabled, u = e.elementRef, c = e.hidden, s = e.icon, d = e.label, f = e.matchRanges, p = e.role, v = e.selected, b = e.truncate, m = e.value,
|
|
389
|
+
var r = e.compact, t = e.children, o = e.description, l = e.descriptionPosition, a = l === void 0 ? "bottom" : l, i = e.disabled, u = e.elementRef, c = e.hidden, s = e.icon, d = e.label, f = e.matchRanges, p = e.role, v = e.selected, b = e.truncate, m = e.value, y = x(e, [ "compact", "children", "description", "descriptionPosition", "disabled", "elementRef", "hidden", "icon", "label", "matchRanges", "role", "selected", "truncate", "value" ]);
|
|
375
390
|
// @docs-props-type OptionPropsBase
|
|
376
391
|
// selectedAppearance, selectedBackgroundColor, and selectedForegroundColor are not used directly by the Option component.
|
|
377
392
|
// They are consumed by the parent component (Multiselect-Normal) to render the Chip, so they are not included in the above prop list.
|
|
@@ -389,7 +404,7 @@
|
|
|
389
404
|
selected: v,
|
|
390
405
|
truncate: b,
|
|
391
406
|
value: m
|
|
392
|
-
},
|
|
407
|
+
}, y, {
|
|
393
408
|
multiple: r
|
|
394
409
|
}), t || d);
|
|
395
410
|
}
|
|
@@ -402,20 +417,20 @@
|
|
|
402
417
|
const I = require("lodash/find");
|
|
403
418
|
var B = r.n(I);
|
|
404
419
|
// CONCATENATED MODULE: external "lodash/forEachRight"
|
|
405
|
-
const
|
|
406
|
-
var L = r.n(
|
|
420
|
+
const N = require("lodash/forEachRight");
|
|
421
|
+
var L = r.n(N);
|
|
407
422
|
// CONCATENATED MODULE: external "lodash/includes"
|
|
408
|
-
const
|
|
409
|
-
var
|
|
423
|
+
const V = require("lodash/includes");
|
|
424
|
+
var q = r.n(V);
|
|
410
425
|
// CONCATENATED MODULE: external "lodash/memoize"
|
|
411
426
|
const D = require("lodash/memoize");
|
|
412
|
-
var
|
|
427
|
+
var T = r.n(D);
|
|
413
428
|
// CONCATENATED MODULE: external "lodash/pick"
|
|
414
429
|
const F = require("lodash/pick");
|
|
415
430
|
var _ = r.n(F);
|
|
416
431
|
// CONCATENATED MODULE: external "lodash/uniq"
|
|
417
|
-
const
|
|
418
|
-
var
|
|
432
|
+
const K = require("lodash/uniq");
|
|
433
|
+
var H = r.n(K);
|
|
419
434
|
// CONCATENATED MODULE: external "lodash/without"
|
|
420
435
|
const z = require("lodash/without");
|
|
421
436
|
var $ = r.n(z);
|
|
@@ -434,11 +449,11 @@
|
|
|
434
449
|
// CONCATENATED MODULE: external "@splunk/react-ui/ResultsMenu"
|
|
435
450
|
const ee = require("@splunk/react-ui/ResultsMenu");
|
|
436
451
|
var ne = r.n(ee);
|
|
437
|
-
// CONCATENATED MODULE: external "@splunk/react-ui/Text"
|
|
438
|
-
const re = require("@splunk/react-ui/Text");
|
|
439
|
-
var te = r.n(re);
|
|
440
452
|
// CONCATENATED MODULE: external "@splunk/react-ui/ScreenReaderContent"
|
|
441
|
-
const
|
|
453
|
+
const re = require("@splunk/react-ui/ScreenReaderContent");
|
|
454
|
+
var te = r.n(re);
|
|
455
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/Text"
|
|
456
|
+
const oe = require("@splunk/react-ui/Text");
|
|
442
457
|
var le = r.n(oe);
|
|
443
458
|
// CONCATENATED MODULE: external "@splunk/react-ui/usePrevious"
|
|
444
459
|
const ae = require("@splunk/react-ui/usePrevious");
|
|
@@ -447,18 +462,20 @@
|
|
|
447
462
|
const ue = require("@splunk/ui-utils/filter");
|
|
448
463
|
// CONCATENATED MODULE: external "@splunk/ui-utils/id"
|
|
449
464
|
const ce = require("@splunk/ui-utils/id");
|
|
465
|
+
// CONCATENATED MODULE: external "@splunk/ui-utils/scroll"
|
|
466
|
+
const se = require("@splunk/ui-utils/scroll");
|
|
450
467
|
// CONCATENATED MODULE: ./src/Select/SelectAllOption.tsx
|
|
451
|
-
var
|
|
452
|
-
active:
|
|
453
|
-
changedToggle:
|
|
454
|
-
elementRef:
|
|
455
|
-
id:
|
|
456
|
-
onClick:
|
|
457
|
-
selectAllLabel:
|
|
458
|
-
selected:
|
|
459
|
-
totalCount:
|
|
468
|
+
var de = {
|
|
469
|
+
active: i().bool,
|
|
470
|
+
changedToggle: i().bool,
|
|
471
|
+
elementRef: i().oneOfType([ i().func, i().object ]),
|
|
472
|
+
id: i().string,
|
|
473
|
+
onClick: i().func,
|
|
474
|
+
selectAllLabel: i().string,
|
|
475
|
+
selected: i().oneOfType([ i().bool, i().oneOf([ "some" ]) ]),
|
|
476
|
+
totalCount: i().number
|
|
460
477
|
};
|
|
461
|
-
function
|
|
478
|
+
function fe(e) {
|
|
462
479
|
var r = e.active, t = e.elementRef, o = e.id, l = e.onClick, a = e.selectAllLabel, i = e.totalCount, u = e.changedToggle, c = e.selected;
|
|
463
480
|
// When toggle is changed the total count is not displayed anymore so the count is now shown in the Select all menu item
|
|
464
481
|
var s = u ? " (".concat(i === null || i === void 0 ? void 0 : i.toString(), ")") : "";
|
|
@@ -481,21 +498,21 @@
|
|
|
481
498
|
value: "selectAll"
|
|
482
499
|
});
|
|
483
500
|
}
|
|
484
|
-
|
|
485
|
-
/* harmony default export */ const
|
|
501
|
+
fe.propTypes = de;
|
|
502
|
+
/* harmony default export */ const pe = fe;
|
|
486
503
|
// CONCATENATED MODULE: external "styled-components"
|
|
487
|
-
const
|
|
488
|
-
var
|
|
504
|
+
const ve = require("styled-components");
|
|
505
|
+
var be = r.n(ve);
|
|
489
506
|
// CONCATENATED MODULE: external "@splunk/react-ui/Button"
|
|
490
|
-
const
|
|
491
|
-
var
|
|
507
|
+
const me = require("@splunk/react-ui/Button");
|
|
508
|
+
var ye = r.n(me);
|
|
492
509
|
// CONCATENATED MODULE: external "@splunk/react-ui/Divider"
|
|
493
510
|
const ge = require("@splunk/react-ui/Divider");
|
|
494
|
-
var
|
|
511
|
+
var he = r.n(ge);
|
|
495
512
|
// CONCATENATED MODULE: external "@splunk/themes"
|
|
496
|
-
const
|
|
513
|
+
const Oe = require("@splunk/themes");
|
|
497
514
|
// CONCATENATED MODULE: ./src/Select/SelectBaseStyles.ts
|
|
498
|
-
var
|
|
515
|
+
var Se = be()(ye()).withConfig({
|
|
499
516
|
displayName: "SelectBaseStyles__StyledButton",
|
|
500
517
|
componentId: "sc-16cj7sk-0"
|
|
501
518
|
})([ "&[data-inline]{width:", ";}", "" ], (function(e) {
|
|
@@ -505,52 +522,52 @@
|
|
|
505
522
|
var n = e.$multiple;
|
|
506
523
|
return !n && "flex-grow: 0;";
|
|
507
524
|
}));
|
|
508
|
-
var
|
|
525
|
+
var we = be().span.withConfig({
|
|
509
526
|
displayName: "SelectBaseStyles__StyledLinkIcon",
|
|
510
527
|
componentId: "sc-16cj7sk-1"
|
|
511
|
-
})([ "padding-right:", ";" ],
|
|
512
|
-
var
|
|
528
|
+
})([ "padding-right:", ";" ], Oe.variables.spacingXSmall);
|
|
529
|
+
var Ce = be().span.withConfig({
|
|
513
530
|
displayName: "SelectBaseStyles__StyledLinkCaret",
|
|
514
531
|
componentId: "sc-16cj7sk-2"
|
|
515
|
-
})([ "padding-left:", ";" ],
|
|
516
|
-
var
|
|
532
|
+
})([ "padding-left:", ";" ], Oe.variables.spacingXSmall);
|
|
533
|
+
var ke = be().div.withConfig({
|
|
517
534
|
displayName: "SelectBaseStyles__StyledFilter",
|
|
518
535
|
componentId: "sc-16cj7sk-3"
|
|
519
|
-
})([ "padding:", " ", " ", ";min-width:160px;" ],
|
|
520
|
-
var
|
|
536
|
+
})([ "padding:", " ", " ", ";min-width:160px;" ], Oe.variables.spacingLarge, Oe.variables.spacingLarge, Oe.variables.spacingSmall);
|
|
537
|
+
var xe = be().span.withConfig({
|
|
521
538
|
displayName: "SelectBaseStyles__StyledCount",
|
|
522
539
|
componentId: "sc-16cj7sk-4"
|
|
523
|
-
})([ "padding-right:", ";" ],
|
|
524
|
-
var
|
|
540
|
+
})([ "padding-right:", ";" ], Oe.variables.spacingXSmall);
|
|
541
|
+
var je = be()(Z()).withConfig({
|
|
525
542
|
displayName: "SelectBaseStyles__StyledControlsLink",
|
|
526
543
|
componentId: "sc-16cj7sk-5"
|
|
527
544
|
})([ "", ";" ], (function(e) {
|
|
528
545
|
var n = e.$disabled;
|
|
529
|
-
return n && (0,
|
|
546
|
+
return n && (0, ve.css)([ "color:", ";" ], Oe.variables.contentColorDisabled);
|
|
530
547
|
}));
|
|
531
|
-
var
|
|
548
|
+
var Pe = be().div.withConfig({
|
|
532
549
|
displayName: "SelectBaseStyles__StyledToggleAllControls",
|
|
533
550
|
componentId: "sc-16cj7sk-6"
|
|
534
|
-
})([ "", ";gap:", ";padding:", " ", " ", ";" ],
|
|
535
|
-
var
|
|
551
|
+
})([ "", ";gap:", ";padding:", " ", " ", ";" ], Oe.mixins.reset("flex"), Oe.variables.spacingMedium, Oe.variables.spacingXSmall, Oe.variables.spacingLarge, Oe.variables.spacingSmall);
|
|
552
|
+
var Ee = be()(he()).withConfig({
|
|
536
553
|
displayName: "SelectBaseStyles__StyledControlsDivider",
|
|
537
554
|
componentId: "sc-16cj7sk-7"
|
|
538
|
-
})([ "border-color:", ";" ],
|
|
539
|
-
// EXTERNAL MODULE: ./src/useControlled/index.ts +
|
|
540
|
-
var
|
|
555
|
+
})([ "border-color:", ";" ], Oe.variables.borderColor);
|
|
556
|
+
// EXTERNAL MODULE: ./src/useControlled/index.ts + 2 modules
|
|
557
|
+
var Me = r(3639);
|
|
541
558
|
// CONCATENATED MODULE: ./src/utils/fuzzyMatch.ts
|
|
542
559
|
// A utility for matching keyboard characters to list values
|
|
543
|
-
var
|
|
560
|
+
var Re = function e(n, r) {
|
|
544
561
|
return n ? n.label.charAt(r).toLowerCase() : "";
|
|
545
562
|
};
|
|
546
|
-
var
|
|
563
|
+
var Ae = function e(n, r) {
|
|
547
564
|
if (!n.length) {
|
|
548
565
|
return n;
|
|
549
566
|
}
|
|
550
567
|
var t = null;
|
|
551
568
|
var o = false;
|
|
552
569
|
var l = n.filter((function(e) {
|
|
553
|
-
var n =
|
|
570
|
+
var n = Re(e, r.index);
|
|
554
571
|
if (n === r.value) {
|
|
555
572
|
o = true;
|
|
556
573
|
return true;
|
|
@@ -558,7 +575,7 @@
|
|
|
558
575
|
// If we haven't found a match yet, keep track of the next closest match.
|
|
559
576
|
// Secondary matching looks for the closest character of a higher value, and failing that, closest of a lower value.
|
|
560
577
|
if (!o) {
|
|
561
|
-
var l =
|
|
578
|
+
var l = Re(t, r.index);
|
|
562
579
|
if (!l) {
|
|
563
580
|
t = e;
|
|
564
581
|
} else if (n > r.value) {
|
|
@@ -575,24 +592,6 @@
|
|
|
575
592
|
}));
|
|
576
593
|
return l.length === 0 && t ? [ t ] : l;
|
|
577
594
|
};
|
|
578
|
-
// CONCATENATED MODULE: ./src/utils/scrollIntoViewIfNeeded.ts
|
|
579
|
-
// A utility that attempts to move an element into view by scrolling it's derived parent.
|
|
580
|
-
var Ae = function e(n) {
|
|
581
|
-
if (!n) {
|
|
582
|
-
return;
|
|
583
|
-
}
|
|
584
|
-
var r = n.offsetParent;
|
|
585
|
-
if (!r) {
|
|
586
|
-
return;
|
|
587
|
-
}
|
|
588
|
-
// Below the bottom of the container.
|
|
589
|
-
if (r.scrollTop + r.clientHeight < n.offsetTop + n.clientHeight) {
|
|
590
|
-
r.scrollTop = n.offsetTop + n.clientHeight - r.clientHeight;
|
|
591
|
-
// Above the top of the container.
|
|
592
|
-
} else if (r.scrollTop > n.offsetTop) {
|
|
593
|
-
r.scrollTop = n.offsetTop;
|
|
594
|
-
}
|
|
595
|
-
};
|
|
596
595
|
// CONCATENATED MODULE: ./src/utils/ssrDocument.ts
|
|
597
596
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
598
597
|
var Ie = {
|
|
@@ -653,11 +652,11 @@
|
|
|
653
652
|
var e = typeof document !== "undefined" ? document : Ie;
|
|
654
653
|
return e;
|
|
655
654
|
}
|
|
656
|
-
var
|
|
657
|
-
/* harmony default export */ const Le = /* unused pure expression or super */ null &&
|
|
655
|
+
var Ne = Be();
|
|
656
|
+
/* harmony default export */ const Le = /* unused pure expression or super */ null && Ne;
|
|
658
657
|
// CONCATENATED MODULE: ./src/utils/ssrWindow.ts
|
|
659
658
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
660
|
-
var
|
|
659
|
+
var Ve = {
|
|
661
660
|
document: Ie,
|
|
662
661
|
navigator: {
|
|
663
662
|
userAgent: ""
|
|
@@ -712,12 +711,12 @@
|
|
|
712
711
|
clearTimeout(n);
|
|
713
712
|
}
|
|
714
713
|
};
|
|
715
|
-
function
|
|
716
|
-
var e = typeof window !== "undefined" ? window :
|
|
714
|
+
function qe() {
|
|
715
|
+
var e = typeof window !== "undefined" ? window : Ve;
|
|
717
716
|
return e;
|
|
718
717
|
}
|
|
719
|
-
var De =
|
|
720
|
-
/* harmony default export */ const
|
|
718
|
+
var De = qe();
|
|
719
|
+
/* harmony default export */ const Te = /* unused pure expression or super */ null && De;
|
|
721
720
|
// CONCATENATED MODULE: ./src/utils/updateReactRef.ts
|
|
722
721
|
/**
|
|
723
722
|
* Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
|
|
@@ -739,12 +738,12 @@
|
|
|
739
738
|
}
|
|
740
739
|
// CONCATENATED MODULE: ./src/Select/SelectBase.tsx
|
|
741
740
|
function _e(e) {
|
|
742
|
-
return ze(e) ||
|
|
741
|
+
return ze(e) || He(e) || Xe(e) || Ke();
|
|
743
742
|
}
|
|
744
|
-
function
|
|
743
|
+
function Ke() {
|
|
745
744
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
746
745
|
}
|
|
747
|
-
function
|
|
746
|
+
function He(e) {
|
|
748
747
|
if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"]) return Array.from(e);
|
|
749
748
|
}
|
|
750
749
|
function ze(e) {
|
|
@@ -880,59 +879,59 @@
|
|
|
880
879
|
return ("string" === n ? String : Number)(e);
|
|
881
880
|
}
|
|
882
881
|
var an = {
|
|
883
|
-
allowKeyMatching:
|
|
884
|
-
allowNewValues:
|
|
885
|
-
animateLoading:
|
|
886
|
-
appearance:
|
|
887
|
-
append:
|
|
888
|
-
children:
|
|
889
|
-
defaultPlacement:
|
|
890
|
-
defaultValues:
|
|
891
|
-
describedBy:
|
|
892
|
-
disabled:
|
|
893
|
-
elementRef:
|
|
894
|
-
error:
|
|
895
|
-
filter:
|
|
896
|
-
footerMessage:
|
|
897
|
-
inline:
|
|
898
|
-
inputId:
|
|
899
|
-
inputRef:
|
|
900
|
-
isLoadingOptions:
|
|
901
|
-
labelledBy:
|
|
902
|
-
labelText:
|
|
903
|
-
loadingMessage:
|
|
904
|
-
menuStyle:
|
|
905
|
-
multiple:
|
|
906
|
-
name:
|
|
907
|
-
noOptionsMessage:
|
|
908
|
-
onChange:
|
|
909
|
-
onClick:
|
|
910
|
-
onClose:
|
|
911
|
-
onFilterChange:
|
|
912
|
-
onOpen:
|
|
913
|
-
onScroll:
|
|
914
|
-
onScrollBottom:
|
|
882
|
+
allowKeyMatching: i().bool,
|
|
883
|
+
allowNewValues: i().bool,
|
|
884
|
+
animateLoading: i().bool,
|
|
885
|
+
appearance: i().oneOf([ "default", "link", "subtle" ]),
|
|
886
|
+
append: i().bool,
|
|
887
|
+
children: i().node,
|
|
888
|
+
defaultPlacement: i().oneOf([ "above", "below", "vertical" ]),
|
|
889
|
+
defaultValues: i().array,
|
|
890
|
+
describedBy: i().string,
|
|
891
|
+
disabled: i().bool,
|
|
892
|
+
elementRef: i().oneOfType([ i().func, i().object ]),
|
|
893
|
+
error: i().bool,
|
|
894
|
+
filter: i().oneOf([ false, true, "controlled" ]),
|
|
895
|
+
footerMessage: i().node,
|
|
896
|
+
inline: i().bool,
|
|
897
|
+
inputId: i().string,
|
|
898
|
+
inputRef: i().oneOfType([ i().func, i().object ]),
|
|
899
|
+
isLoadingOptions: i().bool,
|
|
900
|
+
labelledBy: i().string,
|
|
901
|
+
labelText: i().string,
|
|
902
|
+
loadingMessage: i().node,
|
|
903
|
+
menuStyle: i().object,
|
|
904
|
+
multiple: i().bool,
|
|
905
|
+
name: i().string,
|
|
906
|
+
noOptionsMessage: i().node,
|
|
907
|
+
onChange: i().func,
|
|
908
|
+
onClick: i().func,
|
|
909
|
+
onClose: i().func,
|
|
910
|
+
onFilterChange: i().func,
|
|
911
|
+
onOpen: i().func,
|
|
912
|
+
onScroll: i().func,
|
|
913
|
+
onScrollBottom: i().func,
|
|
915
914
|
/** @private. */
|
|
916
|
-
required:
|
|
917
|
-
placeholder:
|
|
918
|
-
prefixLabel:
|
|
919
|
-
prepend:
|
|
920
|
-
repositionMode:
|
|
921
|
-
selectAllAppearance:
|
|
922
|
-
showSelectedValuesFirst:
|
|
923
|
-
suffixLabel:
|
|
924
|
-
tabConfirmsNewValue:
|
|
925
|
-
toggle:
|
|
926
|
-
toggleContent:
|
|
927
|
-
values:
|
|
915
|
+
required: i().bool,
|
|
916
|
+
placeholder: i().string,
|
|
917
|
+
prefixLabel: i().string,
|
|
918
|
+
prepend: i().bool,
|
|
919
|
+
repositionMode: i().oneOf([ "none", "flip" ]),
|
|
920
|
+
selectAllAppearance: i().oneOf([ "buttongroup", "checkbox" ]),
|
|
921
|
+
showSelectedValuesFirst: i().oneOf([ "nextOpen", "immediately", "never" ]),
|
|
922
|
+
suffixLabel: i().string,
|
|
923
|
+
tabConfirmsNewValue: i().bool,
|
|
924
|
+
toggle: i().node,
|
|
925
|
+
toggleContent: i().oneOf([ "optionChildren", "optionLabel" ]),
|
|
926
|
+
values: i().array,
|
|
928
927
|
/** @private. */
|
|
929
|
-
virtualization:
|
|
928
|
+
virtualization: i().number
|
|
930
929
|
};
|
|
931
|
-
var un =
|
|
930
|
+
var un = T()((function(e) {
|
|
932
931
|
return [ e ];
|
|
933
932
|
}));
|
|
934
933
|
// preserve separate widths for single vs. multi mode
|
|
935
|
-
var cn =
|
|
934
|
+
var cn = T()((function(e) {
|
|
936
935
|
var n = e.anchorWidth, r = e.isMultiple, t = e.maxHeight, o = e.menuStyle;
|
|
937
936
|
return r ? rn({
|
|
938
937
|
width: Math.max(n !== null && n !== void 0 ? n : 0, 200),
|
|
@@ -945,7 +944,7 @@
|
|
|
945
944
|
}));
|
|
946
945
|
var sn = [ "clickAway", "escapeKey", "offScreen", "tabKey", "toggleClick" ];
|
|
947
946
|
function dn(e) {
|
|
948
|
-
return e &&
|
|
947
|
+
return e && l()(e.props, "value");
|
|
949
948
|
}
|
|
950
949
|
function fn(e, n) {
|
|
951
950
|
return "".concat(en(e), "-").concat(e, "-").concat(n);
|
|
@@ -954,22 +953,22 @@
|
|
|
954
953
|
var vn = (0, d._)("No matches");
|
|
955
954
|
var bn = (0, d._)("Select...");
|
|
956
955
|
var mn = n().createElement(G(), null);
|
|
957
|
-
var
|
|
958
|
-
var t = r.activeItemId, o = r.filterA11yId, l = r.filterKeyword, a = r.hasChildren, i = r.inputId, u = r.inputRef, c = r.menuListboxId, s = r.multiple, f = r.onClearAll, p = r.onSelectAll, v = r.onTextBlur, b = r.onTextChange, m = r.onTextFocus,
|
|
959
|
-
var w = (0, d._)("Select all options".concat(
|
|
960
|
-
var C = (0, d._)("Clear all options".concat(
|
|
956
|
+
var yn = function e(r) {
|
|
957
|
+
var t = r.activeItemId, o = r.filterA11yId, l = r.filterKeyword, a = r.hasChildren, i = r.inputId, u = r.inputRef, c = r.menuListboxId, s = r.multiple, f = r.onClearAll, p = r.onSelectAll, v = r.onTextBlur, b = r.onTextChange, m = r.onTextFocus, y = r.onTextKeyDown, g = r.optionSelection, h = r.placement, O = r.selectAllAppearance, S = r.textHasFocus;
|
|
958
|
+
var w = (0, d._)("Select all options".concat(g.current === "all" ? " disabled" : ""));
|
|
959
|
+
var C = (0, d._)("Clear all options".concat(g.current === "none" ? " disabled" : ""));
|
|
961
960
|
// only visually disable these as opposed to fully disabling to avoid losing keyboard focus - see SUI-2731
|
|
962
|
-
var k = n().createElement(
|
|
961
|
+
var k = n().createElement(Pe, {
|
|
963
962
|
key: "selectAll"
|
|
964
|
-
}, n().createElement(
|
|
965
|
-
disabled:
|
|
963
|
+
}, n().createElement(je, {
|
|
964
|
+
disabled: g.current === "all",
|
|
966
965
|
appearance: "standalone",
|
|
967
966
|
"aria-label": w,
|
|
968
967
|
onClick: p,
|
|
969
968
|
"data-test": "select-all",
|
|
970
969
|
tag: "button"
|
|
971
|
-
}, l ? (0, d._)("Select all Matches") : (0, d._)("Select all")), n().createElement(
|
|
972
|
-
disabled:
|
|
970
|
+
}, l ? (0, d._)("Select all Matches") : (0, d._)("Select all")), n().createElement(je, {
|
|
971
|
+
disabled: g.current === "none",
|
|
973
972
|
appearance: "standalone",
|
|
974
973
|
"aria-label": C,
|
|
975
974
|
onClick: f,
|
|
@@ -979,19 +978,19 @@
|
|
|
979
978
|
|
|
980
979
|
return n().createElement("div", {
|
|
981
980
|
key: "controls"
|
|
982
|
-
}, o && n().createElement(
|
|
981
|
+
}, o && n().createElement(te(), {
|
|
983
982
|
id: o
|
|
984
|
-
}, (0, d._)("Type to filter")), h === "above" && n().createElement(
|
|
983
|
+
}, (0, d._)("Type to filter")), h === "above" && n().createElement(Ee, null), n().createElement(ke, {
|
|
985
984
|
key: "filter",
|
|
986
985
|
"data-test": "filter"
|
|
987
|
-
}, n().createElement(
|
|
986
|
+
}, n().createElement(le(), {
|
|
988
987
|
value: l,
|
|
989
988
|
autoCapitalize: "off",
|
|
990
989
|
autoComplete: "off",
|
|
991
990
|
autoCorrect: "off",
|
|
992
991
|
spellCheck: false,
|
|
993
992
|
onChange: b,
|
|
994
|
-
onKeyDown:
|
|
993
|
+
onKeyDown: y,
|
|
995
994
|
onFocus: m,
|
|
996
995
|
onBlur: v,
|
|
997
996
|
placeholder: (0, d._)("filter"),
|
|
@@ -1006,9 +1005,9 @@
|
|
|
1006
1005
|
inputId: i,
|
|
1007
1006
|
canClear: true,
|
|
1008
1007
|
startAdornment: mn
|
|
1009
|
-
})), s && a && O === "buttongroup" && k, h === "below" && n().createElement(
|
|
1008
|
+
})), s && a && O === "buttongroup" && k, h === "below" && n().createElement(Ee, null));
|
|
1010
1009
|
};
|
|
1011
|
-
var
|
|
1010
|
+
var gn = function e(n) {
|
|
1012
1011
|
var r = n.prefixLabel, t = n.label, o = n.suffixLabel;
|
|
1013
1012
|
var l = t;
|
|
1014
1013
|
if (r) {
|
|
@@ -1020,7 +1019,7 @@
|
|
|
1020
1019
|
return l;
|
|
1021
1020
|
};
|
|
1022
1021
|
var hn = n().forwardRef((function(r, t) {
|
|
1023
|
-
var o = r.appearance, l = o === void 0 ? "default" : o, a = r.append, i = r.children, u = r.currentValues, c = u === void 0 ? [] : u, s = r.describedBy, f = r.disabled, p = r.elementRef, v = r.error, b = r.inline, m = r.labelText,
|
|
1022
|
+
var o = r.appearance, l = o === void 0 ? "default" : o, a = r.append, i = r.children, u = r.currentValues, c = u === void 0 ? [] : u, s = r.describedBy, f = r.disabled, p = r.elementRef, v = r.error, b = r.inline, m = r.labelText, y = r.labelledBy, g = r.multiple, h = r.onClick, O = r.placeholder, S = r.prefixLabel, w = r.prepend, C = r.required, k = r.suffixLabel, x = r.toggle, j = r.toggleContent, P = Ye(r, [ "appearance", "append", "children", "currentValues", "describedBy", "disabled", "elementRef", "error", "inline", "labelText", "labelledBy", "multiple", "onClick", "placeholder", "prefixLabel", "prepend", "required", "suffixLabel", "toggle", "toggleContent" ]);
|
|
1024
1023
|
var E;
|
|
1025
1024
|
var M;
|
|
1026
1025
|
var R = [];
|
|
@@ -1036,10 +1035,10 @@
|
|
|
1036
1035
|
e.push(s);
|
|
1037
1036
|
R.push(u);
|
|
1038
1037
|
// if not in multiple mode, add the icon
|
|
1039
|
-
if (!
|
|
1038
|
+
if (!g && c.length === 1) {
|
|
1040
1039
|
E = i;
|
|
1041
1040
|
}
|
|
1042
|
-
} else if (
|
|
1041
|
+
} else if (g) {
|
|
1043
1042
|
// only add values that don't match an option in "multiple" mode to preserve old behaviour
|
|
1044
1043
|
e.push(n);
|
|
1045
1044
|
R.push(n.toString());
|
|
@@ -1055,12 +1054,12 @@
|
|
|
1055
1054
|
if (M.length > 0) {
|
|
1056
1055
|
// If there's more than one item selected, read out the selected total
|
|
1057
1056
|
// rather than reading out each selected item
|
|
1058
|
-
R =
|
|
1057
|
+
R = gn({
|
|
1059
1058
|
prefixLabel: S,
|
|
1060
1059
|
label: M.length > 1 ? [ "".concat(c.length, " items selected") ] : R,
|
|
1061
1060
|
suffixLabel: k
|
|
1062
1061
|
});
|
|
1063
|
-
M =
|
|
1062
|
+
M = gn({
|
|
1064
1063
|
prefixLabel: S,
|
|
1065
1064
|
label: M,
|
|
1066
1065
|
suffixLabel: k
|
|
@@ -1068,18 +1067,18 @@
|
|
|
1068
1067
|
}
|
|
1069
1068
|
// single <Select> behaviour is to show the placeholder if all parts of the label
|
|
1070
1069
|
// are empty strings so we replicate this behaviour here
|
|
1071
|
-
if (M.length === 0 || !
|
|
1070
|
+
if (M.length === 0 || !g && M.every((function(e) {
|
|
1072
1071
|
return e === "";
|
|
1073
1072
|
}))) {
|
|
1074
1073
|
M = un(O);
|
|
1075
1074
|
R = M;
|
|
1076
1075
|
}
|
|
1077
|
-
var
|
|
1076
|
+
var N = Object.keys(P).includes("aria-labelledby");
|
|
1078
1077
|
var L = rn({
|
|
1079
1078
|
"aria-describedby": s,
|
|
1080
|
-
"aria-label":
|
|
1079
|
+
"aria-label": y || N ? undefined : "".concat(m ? "".concat(m, ", ") : "").concat(R.join("")),
|
|
1081
1080
|
// aria-labelledby takes precedence over aria-label, so existence of both is redundant
|
|
1082
|
-
"aria-labelledby":
|
|
1081
|
+
"aria-labelledby": y,
|
|
1083
1082
|
"aria-required": C,
|
|
1084
1083
|
"data-select-appearance": l,
|
|
1085
1084
|
append: a,
|
|
@@ -1091,11 +1090,11 @@
|
|
|
1091
1090
|
error: v,
|
|
1092
1091
|
ref: t
|
|
1093
1092
|
}, P);
|
|
1094
|
-
if (
|
|
1093
|
+
if (g) {
|
|
1095
1094
|
L["data-test-values"] = JSON.stringify(c);
|
|
1096
1095
|
} else {
|
|
1097
|
-
var
|
|
1098
|
-
L["data-test-value"] =
|
|
1096
|
+
var V = We(c, 1), q = V[0];
|
|
1097
|
+
L["data-test-value"] = q;
|
|
1099
1098
|
}
|
|
1100
1099
|
if (x) {
|
|
1101
1100
|
|
|
@@ -1108,13 +1107,13 @@
|
|
|
1108
1107
|
appearance: "standalone"
|
|
1109
1108
|
}, L, {
|
|
1110
1109
|
"data-select-appearance": "link"
|
|
1111
|
-
}), !!E && n().createElement(
|
|
1110
|
+
}), !!E && n().createElement(we, null, E), M || O, n().createElement(Ce, null, n().createElement(U(), null)));
|
|
1112
1111
|
}
|
|
1113
1112
|
// Using Button's secondary appearance as Select's default appearance.
|
|
1114
1113
|
var D = l === "default" ? "secondary" : l;
|
|
1115
1114
|
|
|
1116
|
-
return n().createElement(
|
|
1117
|
-
$multiple:
|
|
1115
|
+
return n().createElement(Se, $e({}, L, {
|
|
1116
|
+
$multiple: g,
|
|
1118
1117
|
appearance: D,
|
|
1119
1118
|
label: M,
|
|
1120
1119
|
error: v,
|
|
@@ -1122,14 +1121,14 @@
|
|
|
1122
1121
|
inline: b,
|
|
1123
1122
|
isMenu: true,
|
|
1124
1123
|
onClick: h
|
|
1125
|
-
}, _()(P, pn)), !!c.length &&
|
|
1124
|
+
}, _()(P, pn)), !!c.length && g && n().createElement(xe, {
|
|
1126
1125
|
"data-role": "count"
|
|
1127
1126
|
}, "(", c.length, ")"));
|
|
1128
1127
|
}));
|
|
1129
1128
|
function On(r) {
|
|
1130
|
-
var t = r.allowKeyMatching, o = t === void 0 ? true : t, l = r.animateLoading, a = r.appearance, i = a === void 0 ? "default" : a, c = r.append, s = r.allowNewValues, f = r.children, p = r.defaultPlacement, v = p === void 0 ? "vertical" : p, b = r.defaultValues, m = r.describedBy,
|
|
1129
|
+
var t = r.allowKeyMatching, o = t === void 0 ? true : t, l = r.animateLoading, a = r.appearance, i = a === void 0 ? "default" : a, c = r.append, s = r.allowNewValues, f = r.children, p = r.defaultPlacement, v = p === void 0 ? "vertical" : p, b = r.defaultValues, m = r.describedBy, y = r.disabled, g = r.elementRef, h = r.error, O = r.filter, S = r.footerMessage, w = r.inline, k = r.inputId, x = r.inputRef, j = r.isLoadingOptions, P = r.labelledBy, E = r.labelText, M = r.loadingMessage, R = r.menuStyle, A = R === void 0 ? {} : R, I = r.multiple, N = r.name, V = r.noOptionsMessage, D = V === void 0 ? vn : V, T = r.onChange, F = r.onScroll, _ = r.onScrollBottom, K = r.onFilterChange, z = r.onClick, W = r.onClose, U = r.onOpen, X = r.required, G = r.placeholder, J = G === void 0 ? bn : G, Y = r.prefixLabel, Z = r.prepend, re = r.repositionMode, te = re === void 0 ? "flip" : re, oe = r.selectAllAppearance, le = oe === void 0 ? "buttongroup" : oe, ae = r.showSelectedValuesFirst, de = r.suffixLabel, fe = r.tabConfirmsNewValue, ve = r.values, be = r.virtualization, me = r.toggle, ye = r.toggleContent, ge = ye === void 0 ? "optionChildren" : ye, he = Ye(r, [ "allowKeyMatching", "animateLoading", "appearance", "append", "allowNewValues", "children", "defaultPlacement", "defaultValues", "describedBy", "disabled", "elementRef", "error", "filter", "footerMessage", "inline", "inputId", "inputRef", "isLoadingOptions", "labelledBy", "labelText", "loadingMessage", "menuStyle", "multiple", "name", "noOptionsMessage", "onChange", "onScroll", "onScrollBottom", "onFilterChange", "onClick", "onClose", "onOpen", "required", "placeholder", "prefixLabel", "prepend", "repositionMode", "selectAllAppearance", "showSelectedValuesFirst", "suffixLabel", "tabConfirmsNewValue", "values", "virtualization", "toggle", "toggleContent" ]);
|
|
1131
1130
|
// @docs-props-type SelectBasePropsBase
|
|
1132
|
-
var
|
|
1131
|
+
var Oe = (0, Me["default"])({
|
|
1133
1132
|
componentName: "SelectBase",
|
|
1134
1133
|
/* eslint-disable-next-line prefer-rest-params */
|
|
1135
1134
|
componentProps: arguments[0],
|
|
@@ -1138,27 +1137,27 @@
|
|
|
1138
1137
|
valuePropName: "values"
|
|
1139
1138
|
});
|
|
1140
1139
|
// states
|
|
1141
|
-
var
|
|
1140
|
+
var Se = (0, e.useState)((function() {
|
|
1142
1141
|
return {
|
|
1143
1142
|
activeItemId: (0, ce.createDOMID)("active-item"),
|
|
1144
1143
|
menuListboxId: (0, ce.createDOMID)("menu-listbox")
|
|
1145
1144
|
};
|
|
1146
|
-
})),
|
|
1147
|
-
var
|
|
1148
|
-
var Ie = (0, e.useState)(""), Be = We(Ie, 2),
|
|
1149
|
-
var
|
|
1150
|
-
var
|
|
1145
|
+
})), we = We(Se, 1), Ce = we[0], ke = Ce.activeItemId, xe = Ce.menuListboxId;
|
|
1146
|
+
var je = (0, e.useState)(0), Pe = We(je, 2), Ee = Pe[0], Re = Pe[1];
|
|
1147
|
+
var Ie = (0, e.useState)(""), Be = We(Ie, 2), Ne = Be[0], Le = Be[1];
|
|
1148
|
+
var Ve = (0, e.useState)(false), De = We(Ve, 2), Te = De[0], Ke = De[1];
|
|
1149
|
+
var He = (0, e.useState)(false), ze = We(He, 2), Ue = ze[0], Xe = ze[1];
|
|
1151
1150
|
var Ge = (0, e.useState)([]), Je = We(Ge, 2), Qe = Je[0], Ze = Je[1];
|
|
1152
1151
|
var en = (0, e.useState)(b || []), nn = We(en, 2), rn = nn[0], tn = nn[1];
|
|
1153
1152
|
// previous state
|
|
1154
|
-
var on = ie()(
|
|
1153
|
+
var on = ie()(Ee);
|
|
1155
1154
|
// refs
|
|
1156
1155
|
var ln = (0, e.useRef)(null);
|
|
1157
1156
|
var an = (0, e.useRef)(null);
|
|
1158
1157
|
var un = (0, e.useRef)(null);
|
|
1159
1158
|
var pn = (0, e.useRef)([]);
|
|
1160
1159
|
var mn = (0, e.useRef)([]);
|
|
1161
|
-
var
|
|
1160
|
+
var gn = (0, e.useRef)(on);
|
|
1162
1161
|
var On = (0, e.useRef)();
|
|
1163
1162
|
var Sn = (0, e.useRef)({});
|
|
1164
1163
|
var wn = (0, e.useRef)(0);
|
|
@@ -1172,43 +1171,43 @@
|
|
|
1172
1171
|
if (false) {}
|
|
1173
1172
|
}), [ i, c, h, Z ]);
|
|
1174
1173
|
var An = (0, e.useCallback)((function() {
|
|
1175
|
-
var e =
|
|
1174
|
+
var e = Oe ? ve : rn;
|
|
1176
1175
|
return I || e == null ? e : e.slice(0, 1);
|
|
1177
|
-
}), [
|
|
1176
|
+
}), [ Oe, I, ve, rn ]);
|
|
1178
1177
|
var In = (0, e.useCallback)((function() {
|
|
1179
1178
|
var e;
|
|
1180
1179
|
// in non-multiple mode, don't move values to the top of the list
|
|
1181
1180
|
return I && ae !== "never" ? (e = An()) !== null && e !== void 0 ? e : [] : [];
|
|
1182
1181
|
}), [ An, I, ae ]);
|
|
1183
1182
|
var Bn = (0, e.useCallback)((function(e) {
|
|
1184
|
-
var n =
|
|
1185
|
-
|
|
1183
|
+
var n = Ne;
|
|
1184
|
+
Ke(true);
|
|
1186
1185
|
Ze(In());
|
|
1187
1186
|
// SUI-3234: preserve existing behavior difference between <Select> and <Multiselect.Compact>
|
|
1188
1187
|
if (I) {
|
|
1189
1188
|
Le("");
|
|
1190
1189
|
}
|
|
1191
|
-
if (n !==
|
|
1192
|
-
|
|
1193
|
-
keyword:
|
|
1190
|
+
if (n !== Ne) {
|
|
1191
|
+
K === null || K === void 0 ? void 0 : K(e, {
|
|
1192
|
+
keyword: Ne
|
|
1194
1193
|
});
|
|
1195
1194
|
}
|
|
1196
|
-
}), [
|
|
1195
|
+
}), [ Ne, In, I, K ]);
|
|
1197
1196
|
(0, e.useEffect)((function() {
|
|
1198
|
-
if (
|
|
1197
|
+
if (Te) {
|
|
1199
1198
|
U === null || U === void 0 ? void 0 : U();
|
|
1200
1199
|
if (kn.current && !O) {
|
|
1201
1200
|
kn.current.focus();
|
|
1202
1201
|
} else {
|
|
1203
1202
|
var e;
|
|
1204
|
-
|
|
1203
|
+
Re((e = xn.current) !== null && e !== void 0 ? e : 0);
|
|
1205
1204
|
}
|
|
1206
1205
|
}
|
|
1207
|
-
}), [ U,
|
|
1208
|
-
var
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1206
|
+
}), [ U, Te, Qe, Ne, O ]);
|
|
1207
|
+
var Nn = (0, e.useCallback)((function() {
|
|
1208
|
+
Ke(false);
|
|
1209
|
+
Re(0);
|
|
1210
|
+
gn.current = null;
|
|
1212
1211
|
W === null || W === void 0 ? void 0 : W();
|
|
1213
1212
|
}), [ W ]);
|
|
1214
1213
|
var Ln = (0, e.useCallback)((function(e, n) {
|
|
@@ -1226,59 +1225,59 @@
|
|
|
1226
1225
|
// non-multiple mode must always have a value
|
|
1227
1226
|
l = [ n ];
|
|
1228
1227
|
}
|
|
1229
|
-
var a = !
|
|
1228
|
+
var a = !Oe;
|
|
1230
1229
|
if (a) {
|
|
1231
1230
|
tn(l);
|
|
1232
1231
|
}
|
|
1233
1232
|
if (I) {
|
|
1234
1233
|
// in uncontrolled multiple mode, keep the menu open
|
|
1235
1234
|
if (a) {
|
|
1236
|
-
|
|
1235
|
+
Ke(true);
|
|
1237
1236
|
}
|
|
1238
1237
|
} else {
|
|
1239
1238
|
var i;
|
|
1240
1239
|
// non-multiple mode only supports a single selection
|
|
1241
1240
|
// so close the menu once a selection is made
|
|
1242
|
-
|
|
1241
|
+
Nn({
|
|
1243
1242
|
reason: "contentClick"
|
|
1244
1243
|
});
|
|
1245
1244
|
(i = ln.current) === null || i === void 0 ? void 0 : i.focus();
|
|
1246
1245
|
}
|
|
1247
|
-
|
|
1246
|
+
T === null || T === void 0 ? void 0 : T(e, {
|
|
1248
1247
|
values: l,
|
|
1249
|
-
name:
|
|
1248
|
+
name: N,
|
|
1250
1249
|
reason: "valueToggle"
|
|
1251
1250
|
});
|
|
1252
|
-
}), [ An,
|
|
1253
|
-
var
|
|
1251
|
+
}), [ An, Nn, Oe, I, N, T ]);
|
|
1252
|
+
var Vn = function e() {
|
|
1254
1253
|
an.current = null;
|
|
1255
1254
|
pn.current = [];
|
|
1256
1255
|
if (un.current) {
|
|
1257
1256
|
clearTimeout(un.current);
|
|
1258
1257
|
}
|
|
1259
1258
|
};
|
|
1260
|
-
var
|
|
1259
|
+
var qn = (0, e.useCallback)((function(e) {
|
|
1261
1260
|
var r;
|
|
1262
1261
|
// this doesn't make sense if we can't select multiple values
|
|
1263
1262
|
if (!I) {
|
|
1264
1263
|
return;
|
|
1265
1264
|
}
|
|
1266
1265
|
var t = (r = An()) !== null && r !== void 0 ? r : [];
|
|
1267
|
-
var o =
|
|
1266
|
+
var o = H()(t.concat(Cn.current));
|
|
1268
1267
|
o = n().Children.toArray(f).filter((function(e) {
|
|
1269
|
-
return dn(e) &&
|
|
1268
|
+
return dn(e) && q()(o, e.props.value) && (!e.props.disabled || q()(t, e.props.value));
|
|
1270
1269
|
})).map((function(e) {
|
|
1271
1270
|
return e.props.value;
|
|
1272
1271
|
}));
|
|
1273
|
-
if (!
|
|
1272
|
+
if (!Oe) {
|
|
1274
1273
|
tn(o);
|
|
1275
1274
|
}
|
|
1276
|
-
|
|
1275
|
+
T === null || T === void 0 ? void 0 : T(e, {
|
|
1277
1276
|
values: o,
|
|
1278
|
-
name:
|
|
1277
|
+
name: N,
|
|
1279
1278
|
reason: "selectAll"
|
|
1280
1279
|
});
|
|
1281
|
-
}), [ f, An,
|
|
1280
|
+
}), [ f, An, Oe, I, N, T ]);
|
|
1282
1281
|
var Dn = (0, e.useCallback)((function(e) {
|
|
1283
1282
|
var r;
|
|
1284
1283
|
// this doesn't make sense if we can't select multiple values
|
|
@@ -1289,28 +1288,28 @@
|
|
|
1289
1288
|
var o = $().apply(void 0, [ t ].concat(_e(Cn.current)));
|
|
1290
1289
|
// this will unselect all selected values unless those values are disabled or hidden by the filter
|
|
1291
1290
|
var l = n().Children.toArray(f).filter((function(e) {
|
|
1292
|
-
return dn(e) && (
|
|
1291
|
+
return dn(e) && (q()(t, e.props.value) && e.props.disabled || q()(o, e.props.value));
|
|
1293
1292
|
})).map((function(e) {
|
|
1294
1293
|
return e.props.value;
|
|
1295
1294
|
}));
|
|
1296
|
-
if (!
|
|
1295
|
+
if (!Oe) {
|
|
1297
1296
|
tn(l);
|
|
1298
1297
|
}
|
|
1299
|
-
|
|
1298
|
+
T === null || T === void 0 ? void 0 : T(e, {
|
|
1300
1299
|
values: l,
|
|
1301
|
-
name:
|
|
1300
|
+
name: N,
|
|
1302
1301
|
reason: "clearAll"
|
|
1303
1302
|
});
|
|
1304
|
-
}), [ f, An,
|
|
1305
|
-
var
|
|
1306
|
-
if (
|
|
1303
|
+
}), [ f, An, Oe, I, N, T ]);
|
|
1304
|
+
var Tn = (0, e.useCallback)((function(e) {
|
|
1305
|
+
if (Te && !j) {
|
|
1307
1306
|
_ === null || _ === void 0 ? void 0 : _(e);
|
|
1308
1307
|
}
|
|
1309
|
-
}), [
|
|
1308
|
+
}), [ Te, j, _ ]);
|
|
1310
1309
|
var Fn = (0, e.useCallback)((function(n) {
|
|
1311
1310
|
var r = n.key;
|
|
1312
1311
|
if (r === "Tab") {
|
|
1313
|
-
if (
|
|
1312
|
+
if (fe && On.current && wn.current <= 1) {
|
|
1314
1313
|
n.preventDefault();
|
|
1315
1314
|
Ln(n, On.current);
|
|
1316
1315
|
}
|
|
@@ -1321,48 +1320,48 @@
|
|
|
1321
1320
|
if (Pn.current === "all") {
|
|
1322
1321
|
Dn(n);
|
|
1323
1322
|
} else {
|
|
1324
|
-
|
|
1323
|
+
qn(n);
|
|
1325
1324
|
}
|
|
1326
1325
|
}
|
|
1327
1326
|
return;
|
|
1328
1327
|
}
|
|
1329
1328
|
if (r === "ArrowDown") {
|
|
1330
1329
|
n.preventDefault();
|
|
1331
|
-
|
|
1330
|
+
Re(Math.min(Ee + 1, le === "checkbox" ? wn.current : wn.current - 1));
|
|
1332
1331
|
if (f && _) {
|
|
1333
1332
|
var t;
|
|
1334
1333
|
var o = e.Children.toArray(f).length - (2 + ((t = An()) !== null && t !== void 0 ? t : []).length);
|
|
1335
|
-
if (
|
|
1336
|
-
|
|
1334
|
+
if (Ee === o) {
|
|
1335
|
+
Tn(n);
|
|
1337
1336
|
}
|
|
1338
1337
|
}
|
|
1339
1338
|
}
|
|
1340
1339
|
if (r === "ArrowUp") {
|
|
1341
1340
|
n.preventDefault();
|
|
1342
|
-
|
|
1341
|
+
Re(Math.max(Ee - 1, 0));
|
|
1343
1342
|
}
|
|
1344
|
-
if (r === "Enter" && On.current &&
|
|
1343
|
+
if (r === "Enter" && On.current && Te) {
|
|
1345
1344
|
if (On.current === "selectAll") {
|
|
1346
1345
|
if (Pn.current === "all") {
|
|
1347
1346
|
Dn(n);
|
|
1348
1347
|
} else {
|
|
1349
|
-
|
|
1348
|
+
qn(n);
|
|
1350
1349
|
}
|
|
1351
1350
|
} else {
|
|
1352
1351
|
n.preventDefault();
|
|
1353
1352
|
Ln(n, On.current);
|
|
1354
1353
|
}
|
|
1355
1354
|
}
|
|
1356
|
-
}), [
|
|
1355
|
+
}), [ Ee, f, An, Dn, Tn, qn, _, Te, le, fe, Ln ]);
|
|
1357
1356
|
var _n = (0, e.useCallback)((function(e, n) {
|
|
1358
1357
|
var r = n.value;
|
|
1359
1358
|
e.preventDefault();
|
|
1360
|
-
if (!
|
|
1359
|
+
if (!Te) {
|
|
1361
1360
|
return;
|
|
1362
1361
|
}
|
|
1363
1362
|
Ln(e, r);
|
|
1364
|
-
}), [
|
|
1365
|
-
var
|
|
1363
|
+
}), [ Te, Ln ]);
|
|
1364
|
+
var Kn = (0, e.useCallback)((function(e, n) {
|
|
1366
1365
|
var r = e.nativeEvent.key;
|
|
1367
1366
|
// Checking for a single character to avoid complications from double-byte languages and emojis.
|
|
1368
1367
|
if (r.length === 1) {
|
|
@@ -1373,13 +1372,13 @@
|
|
|
1373
1372
|
};
|
|
1374
1373
|
if (!an.current) {
|
|
1375
1374
|
if (r === " ") {
|
|
1376
|
-
|
|
1375
|
+
Vn();
|
|
1377
1376
|
return;
|
|
1378
1377
|
}
|
|
1379
|
-
t =
|
|
1378
|
+
t = Ae(mn.current, o);
|
|
1380
1379
|
} else if (pn.current.length > 1) {
|
|
1381
1380
|
o.index = an.current.index + 1;
|
|
1382
|
-
t =
|
|
1381
|
+
t = Ae(pn.current, o);
|
|
1383
1382
|
}
|
|
1384
1383
|
if (t.length) {
|
|
1385
1384
|
var l;
|
|
@@ -1401,20 +1400,20 @@
|
|
|
1401
1400
|
if (un.current) {
|
|
1402
1401
|
clearTimeout(un.current);
|
|
1403
1402
|
}
|
|
1404
|
-
un.current = setTimeout(
|
|
1403
|
+
un.current = setTimeout(Vn, 500);
|
|
1405
1404
|
e.preventDefault();
|
|
1406
1405
|
e.stopPropagation();
|
|
1407
1406
|
}
|
|
1408
1407
|
}), []);
|
|
1409
|
-
var
|
|
1408
|
+
var Hn = (0, e.useCallback)((function(e, n) {
|
|
1410
1409
|
var r = n.value;
|
|
1411
1410
|
Le(r);
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1411
|
+
Ke(true);
|
|
1412
|
+
Re(0);
|
|
1413
|
+
K === null || K === void 0 ? void 0 : K(e, {
|
|
1415
1414
|
keyword: r
|
|
1416
1415
|
});
|
|
1417
|
-
}), [
|
|
1416
|
+
}), [ K ]);
|
|
1418
1417
|
var zn = (0, e.useCallback)((function() {
|
|
1419
1418
|
Xe(true);
|
|
1420
1419
|
}), []);
|
|
@@ -1422,10 +1421,10 @@
|
|
|
1422
1421
|
Xe(false);
|
|
1423
1422
|
}), []);
|
|
1424
1423
|
var Wn = (0, e.useCallback)((function(e) {
|
|
1425
|
-
if (
|
|
1426
|
-
|
|
1424
|
+
if (gn.current !== Ee) {
|
|
1425
|
+
(0, se.scrollIntoViewIfNeeded)(e);
|
|
1427
1426
|
}
|
|
1428
|
-
}), [
|
|
1427
|
+
}), [ Ee ]);
|
|
1429
1428
|
var Un = (0, e.useCallback)((function(e, n, r) {
|
|
1430
1429
|
if (r) {
|
|
1431
1430
|
kn.current = e;
|
|
@@ -1438,8 +1437,8 @@
|
|
|
1438
1437
|
}), [ Sn ]);
|
|
1439
1438
|
var Xn = (0, e.useCallback)((function(e) {
|
|
1440
1439
|
ln.current = e;
|
|
1441
|
-
Fe(
|
|
1442
|
-
}), [
|
|
1440
|
+
Fe(g, e);
|
|
1441
|
+
}), [ g, ln ]);
|
|
1443
1442
|
var Gn = (0, e.useMemo)((function() {
|
|
1444
1443
|
var e;
|
|
1445
1444
|
return (e = An()) !== null && e !== void 0 ? e : [];
|
|
@@ -1476,11 +1475,11 @@
|
|
|
1476
1475
|
}
|
|
1477
1476
|
var f = s.props, p = f.disabled, v = f.hidden, b = f.label, m = f.value;
|
|
1478
1477
|
// Find out if the search string exactly matches a value
|
|
1479
|
-
if (m ===
|
|
1478
|
+
if (m === Ne) {
|
|
1480
1479
|
t = true;
|
|
1481
1480
|
}
|
|
1482
|
-
var
|
|
1483
|
-
var
|
|
1481
|
+
var y = Gn && Gn.indexOf(m) >= 0;
|
|
1482
|
+
var g = !!y && !p && !i;
|
|
1484
1483
|
var h = o && !I && !O && !j && !_;
|
|
1485
1484
|
var S = fn(m, b);
|
|
1486
1485
|
var w = -1;
|
|
@@ -1493,17 +1492,17 @@
|
|
|
1493
1492
|
}
|
|
1494
1493
|
// Format the Menu.Item
|
|
1495
1494
|
var C = (0, e.cloneElement)(s, {
|
|
1496
|
-
elementRef: r(S,
|
|
1495
|
+
elementRef: r(S, g),
|
|
1497
1496
|
key: s.key || d,
|
|
1498
1497
|
onClick: _n,
|
|
1499
1498
|
onKeyDown: h ? function(e) {
|
|
1500
|
-
return
|
|
1499
|
+
return Kn(e, w);
|
|
1501
1500
|
} : undefined,
|
|
1502
|
-
selected:
|
|
1501
|
+
selected: y,
|
|
1503
1502
|
multiple: I,
|
|
1504
1503
|
role: "option"
|
|
1505
1504
|
});
|
|
1506
|
-
if (
|
|
1505
|
+
if (g) {
|
|
1507
1506
|
i = true;
|
|
1508
1507
|
}
|
|
1509
1508
|
if (Yn && Yn.indexOf(m) >= 0) {
|
|
@@ -1527,7 +1526,7 @@
|
|
|
1527
1526
|
return dn(n) && n.props && n.props.value === e;
|
|
1528
1527
|
}));
|
|
1529
1528
|
if (!o) {
|
|
1530
|
-
if (e ===
|
|
1529
|
+
if (e === Ne) {
|
|
1531
1530
|
t = true;
|
|
1532
1531
|
}
|
|
1533
1532
|
var i = Yn && Yn.indexOf(e) >= 0;
|
|
@@ -1558,7 +1557,7 @@
|
|
|
1558
1557
|
}
|
|
1559
1558
|
var p = O === "controlled";
|
|
1560
1559
|
// Filter the items
|
|
1561
|
-
var v = (0, ue.stringToKeywords)(
|
|
1560
|
+
var v = (0, ue.stringToKeywords)(Ne);
|
|
1562
1561
|
c = p ? c : c.filter((function(e) {
|
|
1563
1562
|
if (dn(e)) {
|
|
1564
1563
|
return (0, ue.testPhrase)(e.props.label, v);
|
|
@@ -1577,21 +1576,21 @@
|
|
|
1577
1576
|
});
|
|
1578
1577
|
}));
|
|
1579
1578
|
// Add the option to add the new value
|
|
1580
|
-
if (s && !t &&
|
|
1579
|
+
if (s && !t && Ne) {
|
|
1581
1580
|
var b = a ? l + 1 : l;
|
|
1582
|
-
var m = "".concat(
|
|
1583
|
-
var
|
|
1581
|
+
var m = "".concat(Ne, " (new value)");
|
|
1582
|
+
var y = fn(Ne, m);
|
|
1584
1583
|
c.splice(b, 0, n().createElement(C, {
|
|
1585
|
-
elementRef: r(
|
|
1584
|
+
elementRef: r(y),
|
|
1586
1585
|
label: m,
|
|
1587
|
-
value:
|
|
1586
|
+
value: Ne,
|
|
1588
1587
|
key: "newValue",
|
|
1589
1588
|
multiple: I,
|
|
1590
1589
|
onClick: _n
|
|
1591
1590
|
}));
|
|
1592
1591
|
}
|
|
1593
1592
|
// When selectAll is a menu item, add an offset so that activeItem accounts for the extra selectAll option.
|
|
1594
|
-
var
|
|
1593
|
+
var g = le === "checkbox" && I && c.length > 1 ? 1 : 0;
|
|
1595
1594
|
var h = true;
|
|
1596
1595
|
// Highlight the selected Items and remove hidden
|
|
1597
1596
|
c = c.reduce((function(n, r) {
|
|
@@ -1607,8 +1606,8 @@
|
|
|
1607
1606
|
if (r.props.selected && !r.props.disabled && xn.current == null) {
|
|
1608
1607
|
xn.current = wn.current;
|
|
1609
1608
|
}
|
|
1610
|
-
var t =
|
|
1611
|
-
|
|
1609
|
+
var t = g === Ee;
|
|
1610
|
+
g += 1;
|
|
1612
1611
|
wn.current += 1;
|
|
1613
1612
|
jn.current += r.props.selected ? 1 : 0;
|
|
1614
1613
|
if (r.key !== "newValue" && !r.props.disabled && !r.props.selected) {
|
|
@@ -1624,7 +1623,7 @@
|
|
|
1624
1623
|
var o = (0, e.cloneElement)(r, {
|
|
1625
1624
|
active: t,
|
|
1626
1625
|
elementRef: Wn,
|
|
1627
|
-
id:
|
|
1626
|
+
id: ke
|
|
1628
1627
|
});
|
|
1629
1628
|
n.push(o);
|
|
1630
1629
|
return n;
|
|
@@ -1634,26 +1633,26 @@
|
|
|
1634
1633
|
if (le === "checkbox" && I && wn.current > 0) {
|
|
1635
1634
|
var S;
|
|
1636
1635
|
if (Pn.current === "all") {
|
|
1637
|
-
if (
|
|
1636
|
+
if (Ne === "") {
|
|
1638
1637
|
S = (0, d._)("Clear all");
|
|
1639
1638
|
} else {
|
|
1640
1639
|
S = (0, d._)("Clear all matches");
|
|
1641
1640
|
}
|
|
1642
|
-
} else if (
|
|
1641
|
+
} else if (Ne === "") {
|
|
1643
1642
|
S = (0, d._)("Select all");
|
|
1644
1643
|
} else {
|
|
1645
1644
|
S = (0, d._)("Select all matches");
|
|
1646
1645
|
}
|
|
1647
|
-
if (
|
|
1646
|
+
if (Ee === 0 && Ue) {
|
|
1648
1647
|
On.current = "selectAll";
|
|
1649
1648
|
}
|
|
1650
|
-
c.unshift( n().createElement(
|
|
1649
|
+
c.unshift( n().createElement(pe, {
|
|
1651
1650
|
key: "select-all-option",
|
|
1652
|
-
active:
|
|
1653
|
-
changedToggle: !!
|
|
1651
|
+
active: Ee === 0,
|
|
1652
|
+
changedToggle: !!me,
|
|
1654
1653
|
elementRef: Wn,
|
|
1655
|
-
id:
|
|
1656
|
-
onClick: Pn.current === "all" ? Dn :
|
|
1654
|
+
id: Ee === 0 ? ke : undefined,
|
|
1655
|
+
onClick: Pn.current === "all" ? Dn : qn,
|
|
1657
1656
|
selectAllLabel: S,
|
|
1658
1657
|
selected: Pn.current === "all" || Pn.current !== "none" && "some",
|
|
1659
1658
|
totalCount: Gn.length,
|
|
@@ -1669,7 +1668,7 @@
|
|
|
1669
1668
|
return e;
|
|
1670
1669
|
}), []);
|
|
1671
1670
|
return c;
|
|
1672
|
-
}), [
|
|
1671
|
+
}), [ Ee, ke, o, s, f, Gn, O, Ne, Wn, Dn, _n, Kn, Un, qn, j, I, Yn, _, le, Ue, me ]);
|
|
1673
1672
|
var er = function e(r) {
|
|
1674
1673
|
var t = r.anchorWidth, o = r.maxHeight, a = r.placement, i = r.toggleId;
|
|
1675
1674
|
var u = cn({
|
|
@@ -1681,21 +1680,21 @@
|
|
|
1681
1680
|
var c = Gn.length > 0 && !Qn && !O ? 0 : undefined;
|
|
1682
1681
|
var s = {
|
|
1683
1682
|
"aria-multiselectable": I || undefined,
|
|
1684
|
-
childrenStart: !!O && n().createElement(
|
|
1685
|
-
activeItemId:
|
|
1683
|
+
childrenStart: !!O && n().createElement(yn, {
|
|
1684
|
+
activeItemId: ke,
|
|
1686
1685
|
filterA11yId: Rn,
|
|
1687
|
-
filterKeyword:
|
|
1686
|
+
filterKeyword: Ne,
|
|
1688
1687
|
hasChildren: Zn.some((function(e) {
|
|
1689
1688
|
return dn(e);
|
|
1690
1689
|
})),
|
|
1691
1690
|
inputId: k,
|
|
1692
1691
|
inputRef: x,
|
|
1693
|
-
menuListboxId:
|
|
1692
|
+
menuListboxId: xe,
|
|
1694
1693
|
multiple: I,
|
|
1695
1694
|
onClearAll: Dn,
|
|
1696
|
-
onSelectAll:
|
|
1695
|
+
onSelectAll: qn,
|
|
1697
1696
|
onTextBlur: $n,
|
|
1698
|
-
onTextChange:
|
|
1697
|
+
onTextChange: Hn,
|
|
1699
1698
|
onTextFocus: zn,
|
|
1700
1699
|
onTextKeyDown: Fn,
|
|
1701
1700
|
optionSelection: Pn,
|
|
@@ -1707,8 +1706,8 @@
|
|
|
1707
1706
|
isLoading: j,
|
|
1708
1707
|
labelledBy: "".concat(Rn !== null && Rn !== void 0 ? Rn : "", " ").concat(i !== null && i !== void 0 ? i : "").trim(),
|
|
1709
1708
|
// NVDA ignores aria-labelledby attribute on popover, but reads it on menu
|
|
1710
|
-
menuId:
|
|
1711
|
-
onScrollBottom: _ ?
|
|
1709
|
+
menuId: xe,
|
|
1710
|
+
onScrollBottom: _ ? Tn : undefined,
|
|
1712
1711
|
placement: a !== null && a !== void 0 ? a : undefined,
|
|
1713
1712
|
noOptionsMessage: D,
|
|
1714
1713
|
footerMessage: S,
|
|
@@ -1718,10 +1717,10 @@
|
|
|
1718
1717
|
style: u,
|
|
1719
1718
|
tabIndex: c
|
|
1720
1719
|
};
|
|
1721
|
-
if (
|
|
1720
|
+
if (be) {
|
|
1722
1721
|
|
|
1723
1722
|
return n().createElement(ee.VirtualizedResultsMenu, $e({
|
|
1724
|
-
virtualization:
|
|
1723
|
+
virtualization: be
|
|
1725
1724
|
}, s), Zn);
|
|
1726
1725
|
}
|
|
1727
1726
|
|
|
@@ -1735,7 +1734,7 @@
|
|
|
1735
1734
|
currentValues: An(),
|
|
1736
1735
|
"data-test": I ? "multiselect" : "select",
|
|
1737
1736
|
describedBy: m,
|
|
1738
|
-
disabled:
|
|
1737
|
+
disabled: y,
|
|
1739
1738
|
elementRef: Xn,
|
|
1740
1739
|
error: h,
|
|
1741
1740
|
inline: w,
|
|
@@ -1747,11 +1746,11 @@
|
|
|
1747
1746
|
prefixLabel: Y,
|
|
1748
1747
|
prepend: Z,
|
|
1749
1748
|
required: X,
|
|
1750
|
-
suffixLabel:
|
|
1751
|
-
toggle:
|
|
1749
|
+
suffixLabel: de,
|
|
1750
|
+
toggle: me,
|
|
1752
1751
|
toggleContent: ge
|
|
1753
|
-
},
|
|
1754
|
-
}), [ i, c, An, I, m,
|
|
1752
|
+
}, he), f);
|
|
1753
|
+
}), [ i, c, An, I, m, y, h, Xn, w, E, P, z, J, Y, Z, X, de, me, ge, he, f ]);
|
|
1755
1754
|
|
|
1756
1755
|
return n().createElement(Q(), {
|
|
1757
1756
|
closeReasons: sn,
|
|
@@ -1759,12 +1758,12 @@
|
|
|
1759
1758
|
"aria-labelledby": Rn,
|
|
1760
1759
|
toggle: nr,
|
|
1761
1760
|
onRequestOpen: Bn,
|
|
1762
|
-
onRequestClose:
|
|
1763
|
-
open:
|
|
1761
|
+
onRequestClose: Nn,
|
|
1762
|
+
open: Te,
|
|
1764
1763
|
openWithArrowKeys: true,
|
|
1765
1764
|
repositionMode: te,
|
|
1766
1765
|
defaultPlacement: v,
|
|
1767
|
-
canCoverAnchor:
|
|
1766
|
+
canCoverAnchor: qe().innerHeight < 500,
|
|
1768
1767
|
retainFocus: false,
|
|
1769
1768
|
takeFocus: Gn.length === 0 || Gn.length > 0 && !Qn || !!O
|
|
1770
1769
|
}, er);
|
|
@@ -1810,48 +1809,48 @@
|
|
|
1810
1809
|
return r;
|
|
1811
1810
|
}
|
|
1812
1811
|
var xn = {
|
|
1813
|
-
allowNewValues:
|
|
1814
|
-
animateLoading:
|
|
1815
|
-
children:
|
|
1816
|
-
controlledFilter:
|
|
1817
|
-
defaultPlacement:
|
|
1818
|
-
defaultValues:
|
|
1819
|
-
describedBy:
|
|
1820
|
-
disabled:
|
|
1821
|
-
elementRef:
|
|
1822
|
-
error:
|
|
1823
|
-
filter:
|
|
1824
|
-
footerMessage:
|
|
1825
|
-
inline:
|
|
1826
|
-
inputId:
|
|
1827
|
-
inputRef:
|
|
1828
|
-
isLoadingOptions:
|
|
1829
|
-
labelledBy:
|
|
1830
|
-
loadingMessage:
|
|
1831
|
-
menuStyle:
|
|
1832
|
-
name:
|
|
1833
|
-
noOptionsMessage:
|
|
1834
|
-
onChange:
|
|
1835
|
-
onClose:
|
|
1836
|
-
onFilterChange:
|
|
1837
|
-
onOpen:
|
|
1838
|
-
onScroll:
|
|
1839
|
-
onScrollBottom:
|
|
1840
|
-
placeholder:
|
|
1841
|
-
repositionMode:
|
|
1842
|
-
selectAllAppearance:
|
|
1843
|
-
showSelectedValuesFirst:
|
|
1844
|
-
tabConfirmsNewValue:
|
|
1845
|
-
values:
|
|
1812
|
+
allowNewValues: i().bool,
|
|
1813
|
+
animateLoading: i().bool,
|
|
1814
|
+
children: i().node,
|
|
1815
|
+
controlledFilter: i().bool,
|
|
1816
|
+
defaultPlacement: i().oneOf([ "above", "below", "vertical" ]),
|
|
1817
|
+
defaultValues: i().array,
|
|
1818
|
+
describedBy: i().string,
|
|
1819
|
+
disabled: i().bool,
|
|
1820
|
+
elementRef: i().oneOfType([ i().func, i().object ]),
|
|
1821
|
+
error: i().bool,
|
|
1822
|
+
filter: i().oneOf([ false, true, "controlled" ]),
|
|
1823
|
+
footerMessage: i().node,
|
|
1824
|
+
inline: i().bool,
|
|
1825
|
+
inputId: i().string,
|
|
1826
|
+
inputRef: i().oneOfType([ i().func, i().object ]),
|
|
1827
|
+
isLoadingOptions: i().bool,
|
|
1828
|
+
labelledBy: i().string,
|
|
1829
|
+
loadingMessage: i().node,
|
|
1830
|
+
menuStyle: i().object,
|
|
1831
|
+
name: i().string,
|
|
1832
|
+
noOptionsMessage: i().node,
|
|
1833
|
+
onChange: i().func,
|
|
1834
|
+
onClose: i().func,
|
|
1835
|
+
onFilterChange: i().func,
|
|
1836
|
+
onOpen: i().func,
|
|
1837
|
+
onScroll: i().func,
|
|
1838
|
+
onScrollBottom: i().func,
|
|
1839
|
+
placeholder: i().string,
|
|
1840
|
+
repositionMode: i().oneOf([ "none", "flip" ]),
|
|
1841
|
+
selectAllAppearance: i().oneOf([ "buttongroup", "checkbox" ]),
|
|
1842
|
+
showSelectedValuesFirst: i().oneOf([ "nextOpen", "immediately", "never" ]),
|
|
1843
|
+
tabConfirmsNewValue: i().bool,
|
|
1844
|
+
values: i().array,
|
|
1846
1845
|
/** @private */
|
|
1847
|
-
virtualization:
|
|
1846
|
+
virtualization: i().number
|
|
1848
1847
|
};
|
|
1849
1848
|
// TS: not typed controlled/uncontrolled, handled by Multiselect wrapper component
|
|
1850
1849
|
var jn = {};
|
|
1851
1850
|
var Pn = (0, d._)("No matches");
|
|
1852
1851
|
var En = (0, d._)("Select...");
|
|
1853
1852
|
function Mn(r) {
|
|
1854
|
-
var t = r.allowNewValues, o = r.animateLoading, l = r.children, a = r.controlledFilter, i = r.defaultPlacement, u = i === void 0 ? "vertical" : i, c = r.defaultValues, s = r.describedBy, d = r.disabled, f = r.elementRef, p = r.error, v = r.filter, b = r.footerMessage, m = r.inline,
|
|
1853
|
+
var t = r.allowNewValues, o = r.animateLoading, l = r.children, a = r.controlledFilter, i = r.defaultPlacement, u = i === void 0 ? "vertical" : i, c = r.defaultValues, s = r.describedBy, d = r.disabled, f = r.elementRef, p = r.error, v = r.filter, b = r.footerMessage, m = r.inline, y = r.inputId, g = r.inputRef, h = r.isLoadingOptions, O = r.labelledBy, S = r.loadingMessage, w = r.menuStyle, k = w === void 0 ? jn : w, x = r.name, j = r.noOptionsMessage, P = j === void 0 ? Pn : j, E = r.onChange, M = r.onClose, R = r.onFilterChange, A = r.onOpen, I = r.onScroll, B = r.onScrollBottom, N = r.placeholder, L = N === void 0 ? En : N, V = r.repositionMode, q = r.selectAllAppearance, D = r.showSelectedValuesFirst, T = D === void 0 ? "nextOpen" : D, F = r.tabConfirmsNewValue, _ = r.values, K = r.virtualization, H = Cn(r, [ "allowNewValues", "animateLoading", "children", "controlledFilter", "defaultPlacement", "defaultValues", "describedBy", "disabled", "elementRef", "error", "filter", "footerMessage", "inline", "inputId", "inputRef", "isLoadingOptions", "labelledBy", "loadingMessage", "menuStyle", "name", "noOptionsMessage", "onChange", "onClose", "onFilterChange", "onOpen", "onScroll", "onScrollBottom", "placeholder", "repositionMode", "selectAllAppearance", "showSelectedValuesFirst", "tabConfirmsNewValue", "values", "virtualization" ]);
|
|
1855
1854
|
// @docs-props-type CompactPropsBase
|
|
1856
1855
|
if (false) {}
|
|
1857
1856
|
var z = true;
|
|
@@ -1894,8 +1893,8 @@
|
|
|
1894
1893
|
error: p,
|
|
1895
1894
|
footerMessage: b,
|
|
1896
1895
|
inline: m,
|
|
1897
|
-
inputId:
|
|
1898
|
-
inputRef:
|
|
1896
|
+
inputId: y,
|
|
1897
|
+
inputRef: g,
|
|
1899
1898
|
isLoadingOptions: h,
|
|
1900
1899
|
labelledBy: O,
|
|
1901
1900
|
loadingMessage: S,
|
|
@@ -1909,12 +1908,12 @@
|
|
|
1909
1908
|
onScroll: I,
|
|
1910
1909
|
onScrollBottom: B,
|
|
1911
1910
|
placeholder: L,
|
|
1912
|
-
repositionMode:
|
|
1913
|
-
selectAllAppearance:
|
|
1914
|
-
showSelectedValuesFirst:
|
|
1911
|
+
repositionMode: V,
|
|
1912
|
+
selectAllAppearance: q,
|
|
1913
|
+
showSelectedValuesFirst: T,
|
|
1915
1914
|
tabConfirmsNewValue: F,
|
|
1916
|
-
virtualization:
|
|
1917
|
-
},
|
|
1915
|
+
virtualization: K
|
|
1916
|
+
}, H, $, {
|
|
1918
1917
|
multiple: true
|
|
1919
1918
|
}));
|
|
1920
1919
|
}
|
|
@@ -1928,22 +1927,22 @@
|
|
|
1928
1927
|
var In = r.n(An);
|
|
1929
1928
|
// CONCATENATED MODULE: external "lodash/get"
|
|
1930
1929
|
const Bn = require("lodash/get");
|
|
1931
|
-
var
|
|
1930
|
+
var Nn = r.n(Bn);
|
|
1932
1931
|
// CONCATENATED MODULE: external "lodash/isString"
|
|
1933
1932
|
const Ln = require("lodash/isString");
|
|
1934
|
-
var
|
|
1933
|
+
var Vn = r.n(Ln);
|
|
1935
1934
|
// CONCATENATED MODULE: external "lodash/keys"
|
|
1936
|
-
const
|
|
1937
|
-
var Dn = r.n(
|
|
1935
|
+
const qn = require("lodash/keys");
|
|
1936
|
+
var Dn = r.n(qn);
|
|
1938
1937
|
// CONCATENATED MODULE: external "lodash/last"
|
|
1939
|
-
const
|
|
1940
|
-
var Fn = r.n(
|
|
1938
|
+
const Tn = require("lodash/last");
|
|
1939
|
+
var Fn = r.n(Tn);
|
|
1941
1940
|
// CONCATENATED MODULE: external "lodash/omit"
|
|
1942
1941
|
const _n = require("lodash/omit");
|
|
1943
|
-
var
|
|
1942
|
+
var Kn = r.n(_n);
|
|
1944
1943
|
// CONCATENATED MODULE: external "lodash/pickBy"
|
|
1945
|
-
const
|
|
1946
|
-
var zn = r.n(
|
|
1944
|
+
const Hn = require("lodash/pickBy");
|
|
1945
|
+
var zn = r.n(Hn);
|
|
1947
1946
|
// CONCATENATED MODULE: external "@splunk/react-ui/Popover"
|
|
1948
1947
|
const $n = require("@splunk/react-ui/Popover");
|
|
1949
1948
|
var Wn = r.n($n);
|
|
@@ -1956,40 +1955,40 @@
|
|
|
1956
1955
|
const Jn = require("@splunk/react-ui/Chip");
|
|
1957
1956
|
var Qn = r.n(Jn);
|
|
1958
1957
|
// CONCATENATED MODULE: ./src/Multiselect/NormalStyles.ts
|
|
1959
|
-
var Yn =
|
|
1958
|
+
var Yn = be()(Gn()).withConfig({
|
|
1960
1959
|
displayName: "NormalStyles__StyledBox",
|
|
1961
1960
|
componentId: "sc-1uwwpco-0"
|
|
1962
|
-
})([ "display:flex;align-items:center;flex-wrap:wrap;gap:", ";border-radius:", ";min-width:200px;min-height:", ";max-height:300px;overflow-y:auto;border:", " solid ", ";padding-inline:", ";background-color:", ";", " ", " ", " ", " ", " &[data-inline]{width:400px;}" ],
|
|
1961
|
+
})([ "display:flex;align-items:center;flex-wrap:wrap;gap:", ";border-radius:", ";min-width:200px;min-height:", ";max-height:300px;overflow-y:auto;border:", " solid ", ";padding-inline:", ";background-color:", ";", " ", " ", " ", " ", " &[data-inline]{width:400px;}" ], Oe.variables.spacingXSmall, Oe.variables.borderRadius, Oe.variables.inputHeight, Oe.variables.inputBorderWidth, Oe.variables.interactiveColorBorder, Oe.variables.spacingXSmall, Oe.variables.interactiveColorBackground, (function(e) {
|
|
1963
1962
|
var n = e.$hasFocus;
|
|
1964
|
-
return n && (0,
|
|
1963
|
+
return n && (0, ve.css)([ "box-shadow:", ";" ], Oe.variables.focusShadow);
|
|
1965
1964
|
}), (function(e) {
|
|
1966
1965
|
var n = e.$error;
|
|
1967
|
-
return n && (0,
|
|
1966
|
+
return n && (0, ve.css)([ "border-color:", ";&:hover:not([disabled]){border-color:", ";}" ], Oe.variables.interactiveColorAccentError, Oe.variables.interactiveColorAccentErrorStrong);
|
|
1968
1967
|
}), (function(e) {
|
|
1969
1968
|
var n = e.$disabled;
|
|
1970
|
-
return n && (0,
|
|
1969
|
+
return n && (0, ve.css)([ "border-color:", ";background-color:", ";cursor:not-allowed;" ], Oe.variables.interactiveColorBorderDisabled, Oe.variables.interactiveColorBackgroundDisabled);
|
|
1971
1970
|
}), (function(e) {
|
|
1972
1971
|
var n = e.$disabled, r = e.$hasFocus;
|
|
1973
|
-
return !n && !r && (0,
|
|
1972
|
+
return !n && !r && (0, ve.css)([ "&:hover{border-color:", ";}" ], Oe.variables.interactiveColorBorderHover);
|
|
1974
1973
|
}), (function(e) {
|
|
1975
1974
|
var n = e.$popoverOpen;
|
|
1976
|
-
return n && (0,
|
|
1975
|
+
return n && (0, ve.css)([ "position:relative;z-index:calc(", " - 2);" ], Oe.variables.zindexFixedNavbar);
|
|
1977
1976
|
}));
|
|
1978
|
-
var Zn =
|
|
1977
|
+
var Zn = be().span.withConfig({
|
|
1979
1978
|
displayName: "NormalStyles__StyledButtonsWrapper",
|
|
1980
1979
|
componentId: "sc-1uwwpco-1"
|
|
1981
1980
|
})([ "display:contents;" ]);
|
|
1982
|
-
var er =
|
|
1981
|
+
var er = be().input.withConfig({
|
|
1983
1982
|
displayName: "NormalStyles__StyledInput",
|
|
1984
1983
|
componentId: "sc-1uwwpco-2"
|
|
1985
|
-
})([ "", ";flex:1 0 auto;max-width:100%;" ],
|
|
1986
|
-
var nr =
|
|
1984
|
+
})([ "", ";flex:1 0 auto;max-width:100%;" ], Oe.mixins.reset("block"));
|
|
1985
|
+
var nr = be()(Qn()).withConfig({
|
|
1987
1986
|
displayName: "NormalStyles__StyledChip",
|
|
1988
1987
|
componentId: "sc-1uwwpco-3"
|
|
1989
1988
|
})([ "line-height:1.1429;height:auto;", ";&:not([disabled]):focus{box-shadow:", ";}" ], (0,
|
|
1990
|
-
|
|
1991
|
-
compact: (0,
|
|
1992
|
-
}),
|
|
1989
|
+
Oe.pick)({
|
|
1990
|
+
compact: (0, ve.css)([ "padding-block:2px;" ])
|
|
1991
|
+
}), Oe.variables.focusShadowInset);
|
|
1993
1992
|
// CONCATENATED MODULE: ./src/Multiselect/Normal.tsx
|
|
1994
1993
|
function rr(e) {
|
|
1995
1994
|
"@babel/helpers - typeof";
|
|
@@ -2099,18 +2098,18 @@
|
|
|
2099
2098
|
}
|
|
2100
2099
|
return r;
|
|
2101
2100
|
}
|
|
2102
|
-
function
|
|
2101
|
+
function yr(e) {
|
|
2103
2102
|
for (var n = 1; n < arguments.length; n++) {
|
|
2104
2103
|
var r = null != arguments[n] ? arguments[n] : {};
|
|
2105
2104
|
n % 2 ? mr(Object(r), !0).forEach((function(n) {
|
|
2106
|
-
|
|
2105
|
+
gr(e, n, r[n]);
|
|
2107
2106
|
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : mr(Object(r)).forEach((function(n) {
|
|
2108
2107
|
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
|
|
2109
2108
|
}));
|
|
2110
2109
|
}
|
|
2111
2110
|
return e;
|
|
2112
2111
|
}
|
|
2113
|
-
function
|
|
2112
|
+
function gr(e, n, r) {
|
|
2114
2113
|
return (n = hr(n)) in e ? Object.defineProperty(e, n, {
|
|
2115
2114
|
value: r,
|
|
2116
2115
|
enumerable: !0,
|
|
@@ -2133,49 +2132,49 @@
|
|
|
2133
2132
|
return ("string" === n ? String : Number)(e);
|
|
2134
2133
|
}
|
|
2135
2134
|
var Sr = {
|
|
2136
|
-
allowNewValues:
|
|
2137
|
-
animateLoading:
|
|
2138
|
-
children:
|
|
2139
|
-
controlledFilter:
|
|
2140
|
-
defaultPlacement:
|
|
2141
|
-
defaultValues:
|
|
2142
|
-
describedBy:
|
|
2143
|
-
disabled:
|
|
2144
|
-
elementRef:
|
|
2145
|
-
error:
|
|
2146
|
-
footerMessage:
|
|
2147
|
-
inline:
|
|
2148
|
-
inputId:
|
|
2149
|
-
inputRef:
|
|
2150
|
-
isLoadingOptions:
|
|
2151
|
-
labelledBy:
|
|
2152
|
-
loadingMessage:
|
|
2153
|
-
menuStyle:
|
|
2154
|
-
name:
|
|
2155
|
-
noOptionsMessage:
|
|
2156
|
-
onChange:
|
|
2157
|
-
onClose:
|
|
2158
|
-
onFilterChange:
|
|
2159
|
-
onOpen:
|
|
2160
|
-
onScroll:
|
|
2161
|
-
onScrollBottom:
|
|
2162
|
-
placeholder:
|
|
2135
|
+
allowNewValues: i().bool,
|
|
2136
|
+
animateLoading: i().bool,
|
|
2137
|
+
children: i().node,
|
|
2138
|
+
controlledFilter: i().bool,
|
|
2139
|
+
defaultPlacement: i().oneOf([ "above", "below", "vertical" ]),
|
|
2140
|
+
defaultValues: i().array,
|
|
2141
|
+
describedBy: i().string,
|
|
2142
|
+
disabled: i().bool,
|
|
2143
|
+
elementRef: i().oneOfType([ i().func, i().object ]),
|
|
2144
|
+
error: i().bool,
|
|
2145
|
+
footerMessage: i().node,
|
|
2146
|
+
inline: i().bool,
|
|
2147
|
+
inputId: i().string,
|
|
2148
|
+
inputRef: i().oneOfType([ i().func, i().object ]),
|
|
2149
|
+
isLoadingOptions: i().bool,
|
|
2150
|
+
labelledBy: i().string,
|
|
2151
|
+
loadingMessage: i().node,
|
|
2152
|
+
menuStyle: i().object,
|
|
2153
|
+
name: i().string,
|
|
2154
|
+
noOptionsMessage: i().node,
|
|
2155
|
+
onChange: i().func,
|
|
2156
|
+
onClose: i().func,
|
|
2157
|
+
onFilterChange: i().func,
|
|
2158
|
+
onOpen: i().func,
|
|
2159
|
+
onScroll: i().func,
|
|
2160
|
+
onScrollBottom: i().func,
|
|
2161
|
+
placeholder: i().string,
|
|
2163
2162
|
/** @private. */
|
|
2164
|
-
required:
|
|
2165
|
-
repositionMode:
|
|
2166
|
-
tabConfirmsNewValue:
|
|
2167
|
-
values:
|
|
2163
|
+
required: i().bool,
|
|
2164
|
+
repositionMode: i().oneOf([ "none", "flip" ]),
|
|
2165
|
+
tabConfirmsNewValue: i().bool,
|
|
2166
|
+
values: i().array
|
|
2168
2167
|
};
|
|
2169
|
-
var wr =
|
|
2168
|
+
var wr = T()((function(e) {
|
|
2170
2169
|
return {
|
|
2171
2170
|
flexBasis: e,
|
|
2172
2171
|
width: e
|
|
2173
2172
|
};
|
|
2174
2173
|
}));
|
|
2175
2174
|
// export for testing purpose
|
|
2176
|
-
var Cr =
|
|
2175
|
+
var Cr = T()((function(e) {
|
|
2177
2176
|
var n = e.anchorWidth, r = n === void 0 ? 0 : n, t = e.maxHeight, o = e.menuStyle;
|
|
2178
|
-
return
|
|
2177
|
+
return yr({
|
|
2179
2178
|
maxHeight: t,
|
|
2180
2179
|
overflow: "auto",
|
|
2181
2180
|
width: Math.max(r, 200)
|
|
@@ -2186,9 +2185,9 @@
|
|
|
2186
2185
|
var xr = (0, d._)("No matches");
|
|
2187
2186
|
var jr = (0, d._)("Select...");
|
|
2188
2187
|
function Pr(r) {
|
|
2189
|
-
var t = r.allowNewValues, o = r.animateLoading,
|
|
2188
|
+
var t = r.allowNewValues, o = r.animateLoading, a = r.children, i = r.controlledFilter, u = r.defaultPlacement, c = u === void 0 ? "vertical" : u, f = r.defaultValues, p = r.describedBy, v = r.disabled, b = r.elementRef, m = r.error, y = r.footerMessage, g = r.inline, h = r.inputId, O = r.inputRef, S = r.isLoadingOptions, w = r.labelledBy, C = r.loadingMessage, k = r.menuStyle, x = k === void 0 ? kr : k, j = r.name, P = r.noOptionsMessage, E = P === void 0 ? xr : P, R = r.onChange, A = r.onClose, I = r.onFilterChange, B = r.onScroll, N = r.onScrollBottom, L = r.onOpen, V = r.placeholder, q = V === void 0 ? jr : V, D = r.required, T = r.repositionMode, F = r.tabConfirmsNewValue, _ = r.values, K = vr(r, [ "allowNewValues", "animateLoading", "children", "controlledFilter", "defaultPlacement", "defaultValues", "describedBy", "disabled", "elementRef", "error", "footerMessage", "inline", "inputId", "inputRef", "isLoadingOptions", "labelledBy", "loadingMessage", "menuStyle", "name", "noOptionsMessage", "onChange", "onClose", "onFilterChange", "onScroll", "onScrollBottom", "onOpen", "placeholder", "required", "repositionMode", "tabConfirmsNewValue", "values" ]);
|
|
2190
2189
|
// @docs-props-type NormalPropsBase
|
|
2191
|
-
var
|
|
2190
|
+
var H = s()({
|
|
2192
2191
|
componentName: "Multiselect",
|
|
2193
2192
|
/* eslint-disable-next-line prefer-rest-params */
|
|
2194
2193
|
componentProps: arguments[0],
|
|
@@ -2199,165 +2198,165 @@
|
|
|
2199
2198
|
if (false) {}
|
|
2200
2199
|
var z = (0, e.useState)(0), W = ur(z, 2), U = W[0], X = W[1];
|
|
2201
2200
|
var G = (0, e.useState)(null), J = ur(G, 2), Q = J[0], Y = J[1];
|
|
2202
|
-
var Z = (0, e.useState)(""), ee = ur(Z, 2), re = ee[0],
|
|
2203
|
-
var
|
|
2204
|
-
var
|
|
2205
|
-
var
|
|
2206
|
-
var
|
|
2207
|
-
var
|
|
2208
|
-
var
|
|
2209
|
-
var
|
|
2210
|
-
var je = (0, e.useRef)(null);
|
|
2201
|
+
var Z = (0, e.useState)(""), ee = ur(Z, 2), re = ee[0], oe = ee[1];
|
|
2202
|
+
var le = (0, e.useState)(false), ae = ur(le, 2), ie = ae[0], de = ae[1];
|
|
2203
|
+
var fe = (0, e.useState)(false), pe = ur(fe, 2), ve = pe[0], be = pe[1];
|
|
2204
|
+
var me = (0, e.useState)(f || []), ye = ur(me, 2), ge = ye[0], he = ye[1];
|
|
2205
|
+
var Oe = (0, e.useState)(""), Se = ur(Oe, 2), we = Se[0], Ce = Se[1];
|
|
2206
|
+
var ke = H && _ ? _ : ge;
|
|
2207
|
+
var xe = ke.slice(0);
|
|
2208
|
+
var je = ke.indexOf(re) >= 0;
|
|
2211
2209
|
var Pe = (0, e.useRef)(null);
|
|
2212
|
-
var Ee = (0, e.useRef)(
|
|
2213
|
-
var Me = (0, e.useRef)(
|
|
2214
|
-
var Re = (0, e.
|
|
2210
|
+
var Ee = (0, e.useRef)(null);
|
|
2211
|
+
var Me = (0, e.useRef)(undefined);
|
|
2212
|
+
var Re = (0, e.useRef)(0);
|
|
2213
|
+
var Ae = (0, e.useState)((function() {
|
|
2215
2214
|
return {
|
|
2216
2215
|
activeItemId: (0, ce.createDOMID)("active-item"),
|
|
2217
2216
|
popoverId: (0, ce.createDOMID)("popover")
|
|
2218
2217
|
};
|
|
2219
|
-
})), Ie = ur(
|
|
2218
|
+
})), Ie = ur(Ae, 1), Be = Ie[0], Ne = Be.activeItemId, Le = Be.popoverId;
|
|
2220
2219
|
(0, e.useEffect)((function() {
|
|
2221
|
-
if (
|
|
2222
|
-
|
|
2220
|
+
if (H) {
|
|
2221
|
+
oe("");
|
|
2223
2222
|
X(0);
|
|
2224
2223
|
}
|
|
2225
|
-
}), [ _,
|
|
2224
|
+
}), [ _, H ]);
|
|
2226
2225
|
// Tracks the prev activeIndex so its known if scrolling is needed in handleActiveOptionMount - can't use usePrevious b/c the value needs wiped on Menu close
|
|
2227
2226
|
(0, e.useEffect)((function() {
|
|
2228
|
-
|
|
2227
|
+
Ee.current = U;
|
|
2229
2228
|
}), [ U ]);
|
|
2230
|
-
var
|
|
2229
|
+
var Ve = (0, e.useCallback)((function(e) {
|
|
2231
2230
|
var n = e.resetFilterKeyword;
|
|
2232
|
-
if (!
|
|
2233
|
-
|
|
2231
|
+
if (!ve) {
|
|
2232
|
+
oe((function(e) {
|
|
2234
2233
|
return n ? "" : e;
|
|
2235
2234
|
}));
|
|
2236
|
-
|
|
2237
|
-
|
|
2235
|
+
de(true);
|
|
2236
|
+
be(true);
|
|
2238
2237
|
L === null || L === void 0 ? void 0 : L();
|
|
2239
2238
|
}
|
|
2240
|
-
}), [
|
|
2241
|
-
var
|
|
2239
|
+
}), [ ve, L ]);
|
|
2240
|
+
var qe = (0, e.useCallback)((function() {
|
|
2242
2241
|
if (ie) {
|
|
2243
|
-
|
|
2242
|
+
Ve({
|
|
2244
2243
|
resetFilterKeyword: false
|
|
2245
2244
|
});
|
|
2246
2245
|
} else {
|
|
2247
2246
|
var e;
|
|
2248
|
-
(e =
|
|
2247
|
+
(e = Pe.current) === null || e === void 0 ? void 0 : e.focus();
|
|
2249
2248
|
}
|
|
2250
|
-
}), [ ie,
|
|
2249
|
+
}), [ ie, Ve ]);
|
|
2251
2250
|
var De = (0, e.useCallback)((function(e, n) {
|
|
2252
|
-
if (!
|
|
2251
|
+
if (!ve) {
|
|
2253
2252
|
return;
|
|
2254
2253
|
}
|
|
2255
|
-
var r = (
|
|
2256
|
-
if (!
|
|
2257
|
-
|
|
2254
|
+
var r = (ke || []).concat([ n ]);
|
|
2255
|
+
if (!H) {
|
|
2256
|
+
he(r);
|
|
2258
2257
|
X(0);
|
|
2259
|
-
|
|
2260
|
-
|
|
2258
|
+
be(true);
|
|
2259
|
+
oe("");
|
|
2261
2260
|
}
|
|
2262
2261
|
R === null || R === void 0 ? void 0 : R(e, {
|
|
2263
2262
|
values: r,
|
|
2264
2263
|
name: j
|
|
2265
2264
|
});
|
|
2266
|
-
}), [
|
|
2267
|
-
var
|
|
2268
|
-
var r = $()(
|
|
2269
|
-
if (!
|
|
2270
|
-
|
|
2265
|
+
}), [ ve, ke, H, R, j ]);
|
|
2266
|
+
var Te = (0, e.useCallback)((function(e, n) {
|
|
2267
|
+
var r = $()(ke, n);
|
|
2268
|
+
if (!H) {
|
|
2269
|
+
he(r);
|
|
2271
2270
|
}
|
|
2272
2271
|
R === null || R === void 0 ? void 0 : R(e, {
|
|
2273
2272
|
values: r,
|
|
2274
2273
|
name: j
|
|
2275
2274
|
});
|
|
2276
|
-
}), [
|
|
2275
|
+
}), [ ke, H, j, R ]);
|
|
2277
2276
|
var _e = (0, e.useCallback)((function(e) {
|
|
2278
|
-
if (
|
|
2279
|
-
|
|
2280
|
-
|
|
2277
|
+
if (ve && !S) {
|
|
2278
|
+
N === null || N === void 0 ? void 0 : N(e);
|
|
2279
|
+
Ce("".concat(Re.current, " options, loading more options"));
|
|
2281
2280
|
}
|
|
2282
|
-
}), [
|
|
2283
|
-
var
|
|
2281
|
+
}), [ ve, S, N ]);
|
|
2282
|
+
var Ke = (0, e.useCallback)((function(e, n) {
|
|
2284
2283
|
var r = n.value;
|
|
2285
2284
|
In()((function() {
|
|
2286
|
-
return
|
|
2285
|
+
return Te(e, r);
|
|
2287
2286
|
}));
|
|
2288
|
-
}), [
|
|
2289
|
-
var
|
|
2287
|
+
}), [ Te ]);
|
|
2288
|
+
var He = (0, e.useCallback)((function(e) {
|
|
2290
2289
|
if (re !== "") {
|
|
2291
2290
|
I === null || I === void 0 ? void 0 : I(e, {
|
|
2292
2291
|
keyword: ""
|
|
2293
2292
|
});
|
|
2294
2293
|
}
|
|
2295
|
-
|
|
2294
|
+
Ve({
|
|
2296
2295
|
resetFilterKeyword: true
|
|
2297
2296
|
});
|
|
2298
|
-
}), [ re, I,
|
|
2297
|
+
}), [ re, I, Ve ]);
|
|
2299
2298
|
var ze = (0, e.useCallback)((function(n) {
|
|
2300
2299
|
var r;
|
|
2301
2300
|
var t = n.key;
|
|
2302
|
-
if (t === "Tab" &&
|
|
2303
|
-
if (F &&
|
|
2301
|
+
if (t === "Tab" && ve) {
|
|
2302
|
+
if (F && Me.current !== undefined && Re.current <= 1) {
|
|
2304
2303
|
var o;
|
|
2305
2304
|
n.preventDefault();
|
|
2306
|
-
De(n,
|
|
2307
|
-
(o =
|
|
2305
|
+
De(n, Me.current);
|
|
2306
|
+
(o = Pe.current) === null || o === void 0 ? void 0 : o.focus();
|
|
2308
2307
|
} else {
|
|
2309
|
-
|
|
2308
|
+
be(false);
|
|
2310
2309
|
}
|
|
2311
2310
|
}
|
|
2312
2311
|
if (n.shiftKey || n.metaKey || n.ctrlKey) {
|
|
2313
2312
|
return;
|
|
2314
2313
|
}
|
|
2315
|
-
if (t === "End" &&
|
|
2314
|
+
if (t === "End" && ve) {
|
|
2316
2315
|
n.preventDefault();
|
|
2317
|
-
X(
|
|
2316
|
+
X(Re.current - 1);
|
|
2318
2317
|
}
|
|
2319
|
-
if (t === "Home" &&
|
|
2318
|
+
if (t === "Home" && ve) {
|
|
2320
2319
|
n.preventDefault();
|
|
2321
2320
|
X(0);
|
|
2322
2321
|
}
|
|
2323
2322
|
if (t === "ArrowDown") {
|
|
2324
2323
|
n.preventDefault();
|
|
2325
|
-
if (
|
|
2324
|
+
if (ve) {
|
|
2326
2325
|
X((function(e) {
|
|
2327
|
-
return Math.min(e + 1,
|
|
2326
|
+
return Math.min(e + 1, Re.current - 1);
|
|
2328
2327
|
}));
|
|
2329
2328
|
} else {
|
|
2330
2329
|
X(0);
|
|
2331
|
-
|
|
2330
|
+
be(true);
|
|
2332
2331
|
}
|
|
2333
|
-
if (
|
|
2334
|
-
var
|
|
2335
|
-
if (U ===
|
|
2332
|
+
if (a && N) {
|
|
2333
|
+
var l = e.Children.toArray(a).length - (2 + ((ke === null || ke === void 0 ? void 0 : ke.length) || 0));
|
|
2334
|
+
if (U === l) {
|
|
2336
2335
|
_e(n);
|
|
2337
2336
|
}
|
|
2338
2337
|
}
|
|
2339
2338
|
}
|
|
2340
2339
|
if (t === "ArrowUp") {
|
|
2341
2340
|
n.preventDefault();
|
|
2342
|
-
if (
|
|
2341
|
+
if (ve) {
|
|
2343
2342
|
X((function(e) {
|
|
2344
2343
|
return Math.max(e - 1, 0);
|
|
2345
2344
|
}));
|
|
2346
2345
|
} else {
|
|
2347
2346
|
X(0);
|
|
2348
|
-
|
|
2347
|
+
be(true);
|
|
2349
2348
|
}
|
|
2350
2349
|
}
|
|
2351
|
-
if (t === "Enter" &&
|
|
2352
|
-
De(n,
|
|
2350
|
+
if (t === "Enter" && Me.current !== undefined && ve) {
|
|
2351
|
+
De(n, Me.current);
|
|
2353
2352
|
}
|
|
2354
|
-
if (t === "Backspace" && ((r =
|
|
2355
|
-
|
|
2353
|
+
if (t === "Backspace" && ((r = Pe.current) === null || r === void 0 ? void 0 : r.value) === "" && ke.length) {
|
|
2354
|
+
Te(n, Fn()(ke));
|
|
2356
2355
|
}
|
|
2357
|
-
}), [
|
|
2356
|
+
}), [ ve, ke, F, De, a, N, U, _e, Te ]);
|
|
2358
2357
|
var $e = (0, e.useCallback)((function(e) {
|
|
2359
|
-
|
|
2360
|
-
|
|
2358
|
+
oe(e.target.value);
|
|
2359
|
+
be(true);
|
|
2361
2360
|
X(0);
|
|
2362
2361
|
I === null || I === void 0 ? void 0 : I(e, {
|
|
2363
2362
|
keyword: e.target.value
|
|
@@ -2368,7 +2367,7 @@
|
|
|
2368
2367
|
var t = n.value;
|
|
2369
2368
|
e.stopPropagation();
|
|
2370
2369
|
De(e, t);
|
|
2371
|
-
(r =
|
|
2370
|
+
(r = Pe.current) === null || r === void 0 ? void 0 : r.focus();
|
|
2372
2371
|
}), [ De ]);
|
|
2373
2372
|
var Ue = (0, e.useCallback)((function(e) {
|
|
2374
2373
|
var n = document.getElementById(Le);
|
|
@@ -2376,8 +2375,8 @@
|
|
|
2376
2375
|
// IE11 doesn't support relatedTarget but sets activeElement
|
|
2377
2376
|
var t = n && r && n.contains(r);
|
|
2378
2377
|
// TS: target as Node is an unsafe assumption
|
|
2379
|
-
|
|
2380
|
-
|
|
2378
|
+
oe(t ? re : "");
|
|
2379
|
+
de(false);
|
|
2381
2380
|
if (!t) {
|
|
2382
2381
|
I === null || I === void 0 ? void 0 : I(e, {
|
|
2383
2382
|
keyword: ""
|
|
@@ -2387,13 +2386,13 @@
|
|
|
2387
2386
|
var Xe = (0, e.useCallback)((function(e) {
|
|
2388
2387
|
var n = e.reason, r = e.event;
|
|
2389
2388
|
if (n === "escapeKey" || n === "offScreen" || n === "clickAway" && r !== undefined && !(Q === null || Q === void 0 ? void 0 : Q.contains(r.target))) {
|
|
2390
|
-
|
|
2391
|
-
|
|
2389
|
+
be(false);
|
|
2390
|
+
Ee.current = null;
|
|
2392
2391
|
A === null || A === void 0 ? void 0 : A();
|
|
2393
2392
|
}
|
|
2394
2393
|
if (n === "escapeKey") {
|
|
2395
2394
|
var t;
|
|
2396
|
-
(t =
|
|
2395
|
+
(t = Pe.current) === null || t === void 0 ? void 0 : t.focus();
|
|
2397
2396
|
}
|
|
2398
2397
|
}), [ Q, A ]);
|
|
2399
2398
|
var Ge = (0, e.useCallback)((function(e) {
|
|
@@ -2401,12 +2400,12 @@
|
|
|
2401
2400
|
Fe(b, e);
|
|
2402
2401
|
}), [ b ]);
|
|
2403
2402
|
var Je = (0, e.useCallback)((function(e) {
|
|
2404
|
-
|
|
2403
|
+
Pe.current = e;
|
|
2405
2404
|
Fe(O, e);
|
|
2406
2405
|
}), [ O ]);
|
|
2407
2406
|
var Qe = (0, e.useCallback)((function(e) {
|
|
2408
|
-
if (
|
|
2409
|
-
|
|
2407
|
+
if (Ee.current !== U) {
|
|
2408
|
+
(0, se.scrollIntoViewIfNeeded)(e);
|
|
2410
2409
|
}
|
|
2411
2410
|
}), [ U ]);
|
|
2412
2411
|
var Ye = (0, e.useCallback)((function(e) {
|
|
@@ -2424,7 +2423,7 @@
|
|
|
2424
2423
|
icon: l,
|
|
2425
2424
|
key: s.toString(),
|
|
2426
2425
|
"data-test": "selected-option",
|
|
2427
|
-
onRequestRemove:
|
|
2426
|
+
onRequestRemove: Ke,
|
|
2428
2427
|
role: "option",
|
|
2429
2428
|
value: s,
|
|
2430
2429
|
appearance: i,
|
|
@@ -2438,12 +2437,12 @@
|
|
|
2438
2437
|
disabled: v,
|
|
2439
2438
|
key: (0, ce.createGUID)(),
|
|
2440
2439
|
"data-test": "selected-option",
|
|
2441
|
-
onRequestRemove:
|
|
2440
|
+
onRequestRemove: Ke,
|
|
2442
2441
|
role: "option",
|
|
2443
2442
|
value: r
|
|
2444
2443
|
}, r);
|
|
2445
2444
|
}));
|
|
2446
|
-
}), [ v,
|
|
2445
|
+
}), [ v, Ke ]);
|
|
2447
2446
|
var Ze = function e(r) {
|
|
2448
2447
|
return r.map((function(e) {
|
|
2449
2448
|
var r = e;
|
|
@@ -2462,49 +2461,49 @@
|
|
|
2462
2461
|
}));
|
|
2463
2462
|
};
|
|
2464
2463
|
// Map Options to selected values
|
|
2465
|
-
if (
|
|
2466
|
-
e.Children.toArray(
|
|
2464
|
+
if (ke && ke.length) {
|
|
2465
|
+
e.Children.toArray(a).filter(e.isValidElement).filter((function(e) {
|
|
2467
2466
|
return e.type === M;
|
|
2468
2467
|
})).forEach((function(e) {
|
|
2469
2468
|
if (e.type === M) {
|
|
2470
|
-
var n =
|
|
2469
|
+
var n = ke.indexOf(e.props.value);
|
|
2471
2470
|
if (n !== -1) {
|
|
2472
|
-
|
|
2471
|
+
xe[n] = e;
|
|
2473
2472
|
}
|
|
2474
2473
|
}
|
|
2475
2474
|
}));
|
|
2476
2475
|
}
|
|
2477
2476
|
// Filter the items
|
|
2478
2477
|
var en = (0, ue.stringToKeywords)(re);
|
|
2479
|
-
var nn =
|
|
2480
|
-
if (
|
|
2478
|
+
var nn = i ? e.Children.toArray(a) : e.Children.toArray(a).filter((function(e) {
|
|
2479
|
+
if (Nn()(e, [ "props", "label" ], false)) {
|
|
2481
2480
|
return (0, ue.testPhrase)(e.props.label, en);
|
|
2482
2481
|
}
|
|
2483
2482
|
return true;
|
|
2484
2483
|
// Keep all headers and non-interactive options
|
|
2485
2484
|
}));
|
|
2486
|
-
|
|
2487
|
-
|
|
2485
|
+
Re.current = 0;
|
|
2486
|
+
Me.current = undefined;
|
|
2488
2487
|
var rn = e.Children.map(nn, (function(n, r) {
|
|
2489
2488
|
var t = n.props;
|
|
2490
|
-
if (!t || !
|
|
2489
|
+
if (!t || !l()(t, "value")) {
|
|
2491
2490
|
// ignore Headings and Dividers
|
|
2492
2491
|
return n;
|
|
2493
2492
|
}
|
|
2494
2493
|
var o = n;
|
|
2495
|
-
var
|
|
2494
|
+
var a = o.props, u = a.children, c = a.label, s = a.matchRanges, d = a.value;
|
|
2496
2495
|
// find out if the search string exactly matches a value
|
|
2497
2496
|
if (d === re) {
|
|
2498
|
-
|
|
2497
|
+
je = true;
|
|
2499
2498
|
}
|
|
2500
2499
|
// remove items that are already selected
|
|
2501
|
-
var f =
|
|
2500
|
+
var f = ke.indexOf(d);
|
|
2502
2501
|
if (f >= 0) {
|
|
2503
2502
|
return null;
|
|
2504
2503
|
}
|
|
2505
2504
|
// highlight matched text
|
|
2506
|
-
var p = u === undefined ||
|
|
2507
|
-
var v = p && !
|
|
2505
|
+
var p = u === undefined || Vn()(u);
|
|
2506
|
+
var v = p && !i && !s && en && (0, ue.keywordLocations)(c, en);
|
|
2508
2507
|
// clone item
|
|
2509
2508
|
var b = (0, e.cloneElement)(o, {
|
|
2510
2509
|
// eslint-disable-next-line react/no-array-index-key
|
|
@@ -2517,7 +2516,7 @@
|
|
|
2517
2516
|
return e !== null;
|
|
2518
2517
|
})) || [];
|
|
2519
2518
|
// Add the option to add the new value
|
|
2520
|
-
if (t && !
|
|
2519
|
+
if (t && !je && re) {
|
|
2521
2520
|
rn.unshift( n().createElement(M, {
|
|
2522
2521
|
label: "".concat(re),
|
|
2523
2522
|
description: (0, d._)("(New value)"),
|
|
@@ -2530,23 +2529,23 @@
|
|
|
2530
2529
|
// highlight the selected Item
|
|
2531
2530
|
var tn = e.Children.map(rn, (function(n) {
|
|
2532
2531
|
var r = n.props;
|
|
2533
|
-
if (!r || !
|
|
2532
|
+
if (!r || !l()(r, "value")) {
|
|
2534
2533
|
// ignore Headings and Dividers
|
|
2535
2534
|
return n;
|
|
2536
2535
|
}
|
|
2537
2536
|
var t = n;
|
|
2538
|
-
var o = t.props,
|
|
2539
|
-
var u =
|
|
2540
|
-
|
|
2537
|
+
var o = t.props, a = o.disabled, i = o.value;
|
|
2538
|
+
var u = Re.current === U;
|
|
2539
|
+
Re.current += 1;
|
|
2541
2540
|
if (!u) {
|
|
2542
2541
|
return t;
|
|
2543
2542
|
}
|
|
2544
|
-
if (!
|
|
2545
|
-
|
|
2543
|
+
if (!a) {
|
|
2544
|
+
Me.current = i;
|
|
2546
2545
|
}
|
|
2547
2546
|
var c = (0, e.cloneElement)(t, {
|
|
2548
2547
|
active: u,
|
|
2549
|
-
id:
|
|
2548
|
+
id: Ne,
|
|
2550
2549
|
elementRef: function e(n) {
|
|
2551
2550
|
Qe(n);
|
|
2552
2551
|
Fe(t.props.elementRef, n);
|
|
@@ -2566,9 +2565,9 @@
|
|
|
2566
2565
|
focusMode: "never",
|
|
2567
2566
|
placement: a !== null && a !== void 0 ? a : undefined,
|
|
2568
2567
|
isLoading: S,
|
|
2569
|
-
onScrollBottom:
|
|
2568
|
+
onScrollBottom: N ? _e : undefined,
|
|
2570
2569
|
noOptionsMessage: E,
|
|
2571
|
-
footerMessage:
|
|
2570
|
+
footerMessage: y,
|
|
2572
2571
|
animateLoading: o,
|
|
2573
2572
|
loadingMessage: C,
|
|
2574
2573
|
onScroll: B,
|
|
@@ -2576,29 +2575,29 @@
|
|
|
2576
2575
|
}, tn);
|
|
2577
2576
|
};
|
|
2578
2577
|
var ln = wr("".concat(re.length * .8, "em"));
|
|
2579
|
-
var an =
|
|
2578
|
+
var an = yr(yr({}, zn()(K, (function(e, n) {
|
|
2580
2579
|
return n === "role" || n.indexOf("aria-") === 0;
|
|
2581
2580
|
}))), {}, {
|
|
2582
2581
|
"aria-describedby": p,
|
|
2583
2582
|
"aria-labelledby": w,
|
|
2584
2583
|
"aria-invalid": m || undefined
|
|
2585
2584
|
});
|
|
2586
|
-
var un =
|
|
2585
|
+
var un = yr({}, zn()(K, (function(e, n) {
|
|
2587
2586
|
return n === "aria-label" || n === "aria-describedby";
|
|
2588
2587
|
})));
|
|
2589
2588
|
|
|
2590
2589
|
return n().createElement(n().Fragment, null, n().createElement(Yn, tr({
|
|
2591
2590
|
key: "control",
|
|
2592
|
-
"data-test-values": JSON.stringify(
|
|
2591
|
+
"data-test-values": JSON.stringify(ke),
|
|
2593
2592
|
"data-test-disabled": v ? "disabled" : undefined,
|
|
2594
|
-
inline:
|
|
2593
|
+
inline: g,
|
|
2595
2594
|
$hasFocus: ie
|
|
2596
|
-
},
|
|
2597
|
-
onClick: v ? undefined :
|
|
2595
|
+
}, Kn().apply(void 0, [ K ].concat(or(Dn()(an)))), {
|
|
2596
|
+
onClick: v ? undefined : qe,
|
|
2598
2597
|
$disabled: v,
|
|
2599
2598
|
$error: m,
|
|
2600
2599
|
"data-test-popover-id": Le,
|
|
2601
|
-
$popoverOpen:
|
|
2600
|
+
$popoverOpen: ve,
|
|
2602
2601
|
flex: true,
|
|
2603
2602
|
elementRef: Ge,
|
|
2604
2603
|
role: "group",
|
|
@@ -2608,13 +2607,13 @@
|
|
|
2608
2607
|
role: "listbox",
|
|
2609
2608
|
"aria-invalid": m,
|
|
2610
2609
|
"aria-multiselectable": "true"
|
|
2611
|
-
}, Ye(
|
|
2610
|
+
}, Ye(xe)), !v && n().createElement(er, tr({
|
|
2612
2611
|
role: "combobox",
|
|
2613
2612
|
"data-test": "textbox",
|
|
2614
2613
|
id: h,
|
|
2615
2614
|
ref: Je,
|
|
2616
2615
|
onBlur: Ue,
|
|
2617
|
-
onFocus:
|
|
2616
|
+
onFocus: He,
|
|
2618
2617
|
onChange: $e,
|
|
2619
2618
|
onKeyDown: ze,
|
|
2620
2619
|
value: re,
|
|
@@ -2623,30 +2622,30 @@
|
|
|
2623
2622
|
autoCorrect: "off",
|
|
2624
2623
|
spellCheck: false,
|
|
2625
2624
|
style: ln,
|
|
2626
|
-
placeholder:
|
|
2625
|
+
placeholder: ke.length ? "" : q,
|
|
2627
2626
|
required: D,
|
|
2628
|
-
"aria-activedescendant":
|
|
2627
|
+
"aria-activedescendant": ve && Re.current > 0 ? Ne : undefined,
|
|
2629
2628
|
"aria-autocomplete": "list",
|
|
2630
|
-
"aria-controls":
|
|
2631
|
-
"aria-owns":
|
|
2632
|
-
"aria-expanded":
|
|
2629
|
+
"aria-controls": ve ? Le : undefined,
|
|
2630
|
+
"aria-owns": ve ? Le : undefined,
|
|
2631
|
+
"aria-expanded": ve,
|
|
2633
2632
|
"aria-haspopup": true
|
|
2634
2633
|
}, an)), n().createElement(Wn(), {
|
|
2635
|
-
open:
|
|
2634
|
+
open: ve && !!Q,
|
|
2636
2635
|
autoCloseWhenOffScreen: true,
|
|
2637
2636
|
anchor: Q,
|
|
2638
2637
|
onRequestClose: Xe,
|
|
2639
2638
|
canCoverAnchor: false,
|
|
2640
2639
|
defaultPlacement: c,
|
|
2641
|
-
repositionMode:
|
|
2640
|
+
repositionMode: T,
|
|
2642
2641
|
id: Le
|
|
2643
|
-
}, on)), n().createElement(
|
|
2642
|
+
}, on)), n().createElement(te(), {
|
|
2644
2643
|
role: "status",
|
|
2645
2644
|
"aria-relevant": "text"
|
|
2646
|
-
},
|
|
2645
|
+
}, we), n().createElement(te(), {
|
|
2647
2646
|
role: "alert",
|
|
2648
2647
|
"aria-relevant": "additions"
|
|
2649
|
-
}, Ze(
|
|
2648
|
+
}, Ze(xe)));
|
|
2650
2649
|
}
|
|
2651
2650
|
Pr.propTypes = Sr;
|
|
2652
2651
|
Pr.Option = M;
|
|
@@ -2695,14 +2694,14 @@
|
|
|
2695
2694
|
return e;
|
|
2696
2695
|
}
|
|
2697
2696
|
function Br(e, n, r) {
|
|
2698
|
-
return (n =
|
|
2697
|
+
return (n = Nr(n)) in e ? Object.defineProperty(e, n, {
|
|
2699
2698
|
value: r,
|
|
2700
2699
|
enumerable: !0,
|
|
2701
2700
|
configurable: !0,
|
|
2702
2701
|
writable: !0
|
|
2703
2702
|
}) : e[n] = r, e;
|
|
2704
2703
|
}
|
|
2705
|
-
function
|
|
2704
|
+
function Nr(e) {
|
|
2706
2705
|
var n = Lr(e, "string");
|
|
2707
2706
|
return "symbol" == Mr(n) ? n : n + "";
|
|
2708
2707
|
}
|
|
@@ -2716,9 +2715,9 @@
|
|
|
2716
2715
|
}
|
|
2717
2716
|
return ("string" === n ? String : Number)(e);
|
|
2718
2717
|
}
|
|
2719
|
-
function
|
|
2718
|
+
function Vr(e, n) {
|
|
2720
2719
|
if (null == e) return {};
|
|
2721
|
-
var r, t, o =
|
|
2720
|
+
var r, t, o = qr(e, n);
|
|
2722
2721
|
if (Object.getOwnPropertySymbols) {
|
|
2723
2722
|
var l = Object.getOwnPropertySymbols(e);
|
|
2724
2723
|
for (t = 0; t < l.length; t++) {
|
|
@@ -2727,7 +2726,7 @@
|
|
|
2727
2726
|
}
|
|
2728
2727
|
return o;
|
|
2729
2728
|
}
|
|
2730
|
-
function
|
|
2729
|
+
function qr(e, n) {
|
|
2731
2730
|
if (null == e) return {};
|
|
2732
2731
|
var r = {};
|
|
2733
2732
|
for (var t in e) {
|
|
@@ -2741,47 +2740,47 @@
|
|
|
2741
2740
|
/** @public */
|
|
2742
2741
|
/** @public */
|
|
2743
2742
|
/** @public */ var Dr = {
|
|
2744
|
-
allowNewValues:
|
|
2745
|
-
animateLoading:
|
|
2746
|
-
children:
|
|
2747
|
-
compact:
|
|
2748
|
-
controlledFilter:
|
|
2749
|
-
defaultPlacement:
|
|
2750
|
-
defaultValues:
|
|
2751
|
-
describedBy:
|
|
2752
|
-
disabled:
|
|
2753
|
-
elementRef:
|
|
2754
|
-
error:
|
|
2755
|
-
filter:
|
|
2756
|
-
footerMessage:
|
|
2757
|
-
inline:
|
|
2758
|
-
inputId:
|
|
2759
|
-
inputRef:
|
|
2760
|
-
isLoadingOptions:
|
|
2761
|
-
labelledBy:
|
|
2762
|
-
loadingMessage:
|
|
2763
|
-
menuStyle:
|
|
2764
|
-
name:
|
|
2765
|
-
noOptionsMessage:
|
|
2766
|
-
onChange:
|
|
2767
|
-
onClose:
|
|
2768
|
-
onFilterChange:
|
|
2769
|
-
onOpen:
|
|
2770
|
-
onScroll:
|
|
2771
|
-
onScrollBottom:
|
|
2772
|
-
placeholder:
|
|
2773
|
-
repositionMode:
|
|
2774
|
-
selectAllAppearance:
|
|
2775
|
-
showSelectedValuesFirst:
|
|
2776
|
-
tabConfirmsNewValue:
|
|
2777
|
-
values:
|
|
2743
|
+
allowNewValues: i().bool,
|
|
2744
|
+
animateLoading: i().bool,
|
|
2745
|
+
children: i().node,
|
|
2746
|
+
compact: i().bool,
|
|
2747
|
+
controlledFilter: i().bool,
|
|
2748
|
+
defaultPlacement: i().oneOf([ "above", "below", "vertical" ]),
|
|
2749
|
+
defaultValues: i().array,
|
|
2750
|
+
describedBy: i().string,
|
|
2751
|
+
disabled: i().bool,
|
|
2752
|
+
elementRef: i().oneOfType([ i().func, i().object ]),
|
|
2753
|
+
error: i().bool,
|
|
2754
|
+
filter: i().oneOf([ false, true, "controlled" ]),
|
|
2755
|
+
footerMessage: i().node,
|
|
2756
|
+
inline: i().bool,
|
|
2757
|
+
inputId: i().string,
|
|
2758
|
+
inputRef: i().oneOfType([ i().func, i().object ]),
|
|
2759
|
+
isLoadingOptions: i().bool,
|
|
2760
|
+
labelledBy: i().string,
|
|
2761
|
+
loadingMessage: i().node,
|
|
2762
|
+
menuStyle: i().object,
|
|
2763
|
+
name: i().string,
|
|
2764
|
+
noOptionsMessage: i().node,
|
|
2765
|
+
onChange: i().func,
|
|
2766
|
+
onClose: i().func,
|
|
2767
|
+
onFilterChange: i().func,
|
|
2768
|
+
onOpen: i().func,
|
|
2769
|
+
onScroll: i().func,
|
|
2770
|
+
onScrollBottom: i().func,
|
|
2771
|
+
placeholder: i().string,
|
|
2772
|
+
repositionMode: i().oneOf([ "none", "flip" ]),
|
|
2773
|
+
selectAllAppearance: i().oneOf([ "buttongroup", "checkbox" ]),
|
|
2774
|
+
showSelectedValuesFirst: i().oneOf([ "nextOpen", "immediately", "never" ]),
|
|
2775
|
+
tabConfirmsNewValue: i().bool,
|
|
2776
|
+
values: i().array,
|
|
2778
2777
|
/** @private */
|
|
2779
|
-
virtualization:
|
|
2778
|
+
virtualization: i().number
|
|
2780
2779
|
};
|
|
2781
|
-
var
|
|
2780
|
+
var Tr = (0, d._)("No matches");
|
|
2782
2781
|
var Fr = (0, d._)("Select...");
|
|
2783
2782
|
function _r(r) {
|
|
2784
|
-
var t = r.allowNewValues, o = r.animateLoading, l = r.compact, a = r.children, i = r.controlledFilter, u = r.defaultPlacement, c = u === void 0 ? "vertical" : u, d = r.defaultValues, f = r.describedBy, p = r.disabled, v = r.elementRef, b = r.error, m = r.filter,
|
|
2783
|
+
var t = r.allowNewValues, o = r.animateLoading, l = r.compact, a = r.children, i = r.controlledFilter, u = r.defaultPlacement, c = u === void 0 ? "vertical" : u, d = r.defaultValues, f = r.describedBy, p = r.disabled, v = r.elementRef, b = r.error, m = r.filter, y = r.footerMessage, g = r.inline, h = r.inputId, O = r.inputRef, S = r.isLoadingOptions, w = r.labelledBy, C = r.loadingMessage, k = r.menuStyle, x = r.name, j = r.noOptionsMessage, P = j === void 0 ? Tr : j, E = r.onChange, M = r.onClose, R = r.onFilterChange, A = r.onOpen, I = r.onScroll, B = r.onScrollBottom, N = r.placeholder, L = N === void 0 ? Fr : N, V = r.repositionMode, q = V === void 0 ? "flip" : V, D = r.selectAllAppearance, T = r.showSelectedValuesFirst, F = r.tabConfirmsNewValue, _ = r.values, K = r.virtualization, H = Vr(r, [ "allowNewValues", "animateLoading", "compact", "children", "controlledFilter", "defaultPlacement", "defaultValues", "describedBy", "disabled", "elementRef", "error", "filter", "footerMessage", "inline", "inputId", "inputRef", "isLoadingOptions", "labelledBy", "loadingMessage", "menuStyle", "name", "noOptionsMessage", "onChange", "onClose", "onFilterChange", "onOpen", "onScroll", "onScrollBottom", "placeholder", "repositionMode", "selectAllAppearance", "showSelectedValuesFirst", "tabConfirmsNewValue", "values", "virtualization" ]);
|
|
2785
2784
|
// @docs-props-type MultiselectPropsBase
|
|
2786
2785
|
var z = s()({
|
|
2787
2786
|
componentName: "Multiselect",
|
|
@@ -2799,7 +2798,7 @@
|
|
|
2799
2798
|
}
|
|
2800
2799
|
}), [ l, $ ]);
|
|
2801
2800
|
// Compact uses Button, which defaults `inline` to true, explicitly pass a boolean to prevent the underlying Button from applying its default.
|
|
2802
|
-
var W = !!
|
|
2801
|
+
var W = !!g;
|
|
2803
2802
|
var U = Ir({
|
|
2804
2803
|
allowNewValues: t,
|
|
2805
2804
|
animateLoading: o,
|
|
@@ -2810,7 +2809,7 @@
|
|
|
2810
2809
|
disabled: p,
|
|
2811
2810
|
elementRef: v,
|
|
2812
2811
|
error: b,
|
|
2813
|
-
footerMessage:
|
|
2812
|
+
footerMessage: y,
|
|
2814
2813
|
inline: W,
|
|
2815
2814
|
inputId: h,
|
|
2816
2815
|
inputRef: O,
|
|
@@ -2827,13 +2826,12 @@
|
|
|
2827
2826
|
onScroll: I,
|
|
2828
2827
|
onScrollBottom: B,
|
|
2829
2828
|
placeholder: L,
|
|
2830
|
-
repositionMode:
|
|
2831
|
-
showSelectedValuesFirst:
|
|
2829
|
+
repositionMode: q,
|
|
2830
|
+
showSelectedValuesFirst: T,
|
|
2832
2831
|
tabConfirmsNewValue: F,
|
|
2833
|
-
virtualization:
|
|
2834
|
-
},
|
|
2835
|
-
|
|
2836
|
-
var X = (0, e.useMemo)((function() {
|
|
2832
|
+
virtualization: K
|
|
2833
|
+
}, H);
|
|
2834
|
+
var X = (0, e.useMemo)((function() {
|
|
2837
2835
|
return {
|
|
2838
2836
|
defaultValues: d
|
|
2839
2837
|
};
|
|
@@ -2849,8 +2847,8 @@
|
|
|
2849
2847
|
var Q = {
|
|
2850
2848
|
filter: m,
|
|
2851
2849
|
selectAllAppearance: D,
|
|
2852
|
-
showSelectedValuesFirst:
|
|
2853
|
-
virtualization:
|
|
2850
|
+
showSelectedValuesFirst: T,
|
|
2851
|
+
virtualization: K
|
|
2854
2852
|
};
|
|
2855
2853
|
if (l) {
|
|
2856
2854
|
|
|
@@ -2869,7 +2867,7 @@
|
|
|
2869
2867
|
_r.Heading = u.Heading;
|
|
2870
2868
|
_r.Divider = u.Divider;
|
|
2871
2869
|
_r.propTypes = Dr;
|
|
2872
|
-
/* harmony default export */ const
|
|
2870
|
+
/* harmony default export */ const Kr = _r;
|
|
2873
2871
|
}) // CONCATENATED MODULE: ./src/Multiselect/index.ts
|
|
2874
2872
|
();
|
|
2875
2873
|
module.exports = t;
|