@splunk/react-ui 4.14.0 → 4.16.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/.dockerignore +2 -0
- package/Accordion.js +41 -16
- package/Anchor.js +9 -9
- package/Animation.js +6 -6
- package/AnimationToggle.js +2 -2
- package/Box.js +9 -9
- package/Button.js +54 -51
- package/ButtonGroup.js +9 -9
- package/ButtonSimple.js +68 -64
- package/CHANGELOG.md +46 -0
- package/Calendar.js +124 -106
- package/Card.js +68 -68
- package/CardLayout.js +9 -9
- package/Chip.js +22 -22
- package/Clickable.js +38 -14
- package/CloseButton.js +23 -23
- package/Code.js +484 -436
- package/CollapsiblePanel.js +59 -34
- package/Color.js +297 -187
- package/ColumnLayout.js +18 -17
- package/ComboBox.js +81 -32
- package/Concertina.js +88 -27
- package/ControlGroup.js +81 -24
- package/Date.js +54 -36
- package/DefinitionList.js +14 -8
- package/Divider.d.ts +2 -0
- package/Divider.js +9 -9
- package/Dockerfile.enterprise.storybook +7 -0
- package/Dockerfile.prisma.storybook +7 -0
- package/Dockerfile.visual +10 -0
- package/Dropdown.js +78 -18
- package/EventListener.js +17 -17
- package/File.js +108 -46
- package/FormRows.js +38 -37
- package/Heading.js +83 -55
- package/Image.js +63 -38
- package/JSONTree.js +106 -21
- package/Layer.js +59 -34
- package/Link.js +17 -17
- package/List.js +3 -3
- package/MIGRATION.md +21 -0
- package/Markdown.js +71 -65
- package/Menu.js +155 -121
- package/Message.js +129 -129
- package/MessageBar.js +136 -136
- package/Modal.js +57 -32
- package/ModalLayer.js +15 -15
- package/Monogram.js +18 -17
- package/Multiselect.js +2807 -2310
- package/Number.js +74 -37
- package/Paginator.js +96 -83
- package/Paragraph.js +10 -10
- package/Popover.js +191 -54
- package/Progress.js +23 -22
- package/RadioBar.js +32 -14
- package/RadioList.js +17 -11
- package/Resize.js +33 -20
- package/ResultsMenu.js +36 -23
- package/ScreenReaderContent.js +9 -9
- package/Scroll.js +51 -26
- package/ScrollContainerContext.js +48 -48
- package/Search.js +68 -31
- package/Select.js +501 -204
- package/SidePanel.js +37 -24
- package/Slider.js +54 -24
- package/SlidingPanels.js +52 -14
- package/SplitButton.js +23 -22
- package/StaticContent.js +9 -9
- package/StepBar.js +22 -22
- package/Switch.js +18 -13
- package/TabBar.js +22 -22
- package/TabLayout.js +46 -18
- package/Table.js +424 -166
- package/Text.js +91 -49
- package/TextArea.d.ts +2 -0
- package/TextArea.js +127 -49
- package/Tooltip.js +236 -59
- package/TransitionOpen.js +39 -26
- package/Typography.d.ts +2 -0
- package/Typography.js +18 -17
- package/WaitSpinner.js +15 -15
- package/docker-compose.yml +42 -0
- package/package.json +13 -12
- package/test-runner-jest.config.js +11 -6
- package/types/src/Accordion/AccordionContext.d.ts +1 -0
- package/types/src/Button/Button.d.ts +5 -2
- package/types/src/Button/docs/examples/Basic.d.ts +2 -2
- package/types/src/Button/docs/examples/Selected.d.ts +2 -2
- package/types/src/ButtonGroup/ButtonGroupContext.d.ts +1 -0
- package/types/src/ButtonSimple/ButtonSimple.d.ts +10 -11
- package/types/src/Calendar/Calendar.d.ts +2 -0
- package/types/src/CardLayout/CardLayoutContext.d.ts +1 -0
- package/types/src/Concertina/ConcertinaContext.d.ts +1 -0
- package/types/src/ControlGroup/ControlGroup.d.ts +15 -8
- package/types/src/ControlGroup/docs/examples/HelpWithErrorText.d.ts +2 -0
- package/types/src/ControlGroup/docs/examples/Required.d.ts +2 -0
- package/types/src/File/File.d.ts +4 -2
- package/types/src/File/FileContext.d.ts +1 -0
- package/types/src/FormRows/FormRowsContext.d.ts +1 -0
- package/types/src/Markdown/renderers/MarkdownLink.d.ts +1 -1
- package/types/src/Menu/MenuContext.d.ts +1 -0
- package/types/src/Modal/ModalContext.d.ts +1 -0
- package/types/src/Multiselect/Compact.d.ts +14 -1
- package/types/src/Multiselect/Multiselect.d.ts +15 -1
- package/types/src/Multiselect/Normal.d.ts +2 -0
- package/types/src/Popover/Popover.d.ts +25 -5
- package/types/src/Popover/PopoverContext.d.ts +1 -0
- package/types/src/RadioBar/RadioBar.d.ts +5 -3
- package/types/src/RadioBar/RadioBarContext.d.ts +1 -0
- package/types/src/RadioList/RadioList.d.ts +5 -1
- package/types/src/RadioList/RadioListContext.d.ts +1 -0
- package/types/src/Select/Select.d.ts +3 -1
- package/types/src/Select/SelectBase.d.ts +14 -0
- package/types/src/Slider/Slider.d.ts +5 -3
- package/types/src/StepBar/StepBarContext.d.ts +1 -0
- package/types/src/Switch/Switch.d.ts +2 -0
- package/types/src/TabBar/TabBarContext.d.ts +1 -0
- package/types/src/TabLayout/Panel.d.ts +3 -0
- package/types/src/TabLayout/TabLayout.d.ts +2 -0
- package/types/src/Table/Body.d.ts +2 -0
- package/types/src/Table/Head.d.ts +2 -0
- package/types/src/Table/Row.d.ts +11 -3
- package/types/src/Table/Table.d.ts +5 -3
- package/types/src/Table/TableContext.d.ts +1 -0
- package/types/src/Text/Text.d.ts +5 -3
- package/types/src/TextArea/TextArea.d.ts +5 -3
- package/types/src/Tooltip/Tooltip.d.ts +16 -4
- package/types/src/Typography/Typography.d.ts +1 -1
- package/types/src/useForceUpdate/useForceUpdate.d.ts +1 -0
- package/useForceUpdate.js +9 -9
- package/useKeyPress.js +2 -2
- package/usePrevious.js +9 -9
- package/.storybook-visual/config/snapshotResolver.js +0 -29
- package/.storybook-visual/main.js +0 -22
- package/.storybook-visual/preview.jsx +0 -31
- package/.storybook-visual/scripts/test.sh +0 -108
- package/.storybook-visual/test-runner.js +0 -108
package/Select.js
CHANGED
|
@@ -82,7 +82,7 @@ module.exports =
|
|
|
82
82
|
/******/
|
|
83
83
|
/******/
|
|
84
84
|
/******/ // Load entry module and return exports
|
|
85
|
-
/******/ return __webpack_require__(__webpack_require__.s =
|
|
85
|
+
/******/ return __webpack_require__(__webpack_require__.s = 225);
|
|
86
86
|
/******/ })
|
|
87
87
|
/************************************************************************/
|
|
88
88
|
/******/ ({
|
|
@@ -101,28 +101,146 @@ module.exports = require("prop-types");
|
|
|
101
101
|
|
|
102
102
|
/***/ }),
|
|
103
103
|
|
|
104
|
+
/***/ 10:
|
|
105
|
+
/***/ (function(module, exports) {
|
|
106
|
+
|
|
107
|
+
module.exports = require("lodash/keys");
|
|
108
|
+
|
|
109
|
+
/***/ }),
|
|
110
|
+
|
|
111
|
+
/***/ 104:
|
|
112
|
+
/***/ (function(module, exports) {
|
|
113
|
+
|
|
114
|
+
module.exports = require("lodash/forEachRight");
|
|
115
|
+
|
|
116
|
+
/***/ }),
|
|
117
|
+
|
|
118
|
+
/***/ 105:
|
|
119
|
+
/***/ (function(module, exports) {
|
|
120
|
+
|
|
121
|
+
module.exports = require("lodash/uniq");
|
|
122
|
+
|
|
123
|
+
/***/ }),
|
|
124
|
+
|
|
104
125
|
/***/ 11:
|
|
105
126
|
/***/ (function(module, exports) {
|
|
106
127
|
|
|
107
|
-
module.exports = require("
|
|
128
|
+
module.exports = require("lodash/has");
|
|
108
129
|
|
|
109
130
|
/***/ }),
|
|
110
131
|
|
|
111
132
|
/***/ 13:
|
|
112
133
|
/***/ (function(module, exports) {
|
|
113
134
|
|
|
135
|
+
module.exports = require("@splunk/ui-utils/id");
|
|
136
|
+
|
|
137
|
+
/***/ }),
|
|
138
|
+
|
|
139
|
+
/***/ 15:
|
|
140
|
+
/***/ (function(module, exports) {
|
|
141
|
+
|
|
114
142
|
module.exports = require("@splunk/react-ui/Menu");
|
|
115
143
|
|
|
116
144
|
/***/ }),
|
|
117
145
|
|
|
118
|
-
/***/
|
|
146
|
+
/***/ 18:
|
|
147
|
+
/***/ (function(module, exports) {
|
|
148
|
+
|
|
149
|
+
module.exports = require("lodash/includes");
|
|
150
|
+
|
|
151
|
+
/***/ }),
|
|
152
|
+
|
|
153
|
+
/***/ 19:
|
|
119
154
|
/***/ (function(module, exports) {
|
|
120
155
|
|
|
121
156
|
module.exports = require("@splunk/react-ui/Button");
|
|
122
157
|
|
|
123
158
|
/***/ }),
|
|
124
159
|
|
|
125
|
-
/***/
|
|
160
|
+
/***/ 2:
|
|
161
|
+
/***/ (function(module, exports) {
|
|
162
|
+
|
|
163
|
+
module.exports = require("react");
|
|
164
|
+
|
|
165
|
+
/***/ }),
|
|
166
|
+
|
|
167
|
+
/***/ 20:
|
|
168
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
169
|
+
|
|
170
|
+
"use strict";
|
|
171
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getWindow; });
|
|
172
|
+
/* unused harmony export ssrWindow */
|
|
173
|
+
/* harmony import */ var _ssrDocument__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(28);
|
|
174
|
+
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
175
|
+
|
|
176
|
+
var ssrWindow = {
|
|
177
|
+
document: _ssrDocument__WEBPACK_IMPORTED_MODULE_0__[/* ssrDocument */ "b"],
|
|
178
|
+
navigator: {
|
|
179
|
+
userAgent: ''
|
|
180
|
+
},
|
|
181
|
+
location: {
|
|
182
|
+
hash: '',
|
|
183
|
+
host: '',
|
|
184
|
+
hostname: '',
|
|
185
|
+
href: '',
|
|
186
|
+
origin: '',
|
|
187
|
+
pathname: '',
|
|
188
|
+
protocol: '',
|
|
189
|
+
search: ''
|
|
190
|
+
},
|
|
191
|
+
history: {
|
|
192
|
+
replaceState: function replaceState() {},
|
|
193
|
+
pushState: function pushState() {},
|
|
194
|
+
go: function go() {},
|
|
195
|
+
back: function back() {}
|
|
196
|
+
},
|
|
197
|
+
CustomEvent: function CustomEvent() {
|
|
198
|
+
return this;
|
|
199
|
+
},
|
|
200
|
+
addEventListener: function addEventListener() {},
|
|
201
|
+
removeEventListener: function removeEventListener() {},
|
|
202
|
+
getComputedStyle: function getComputedStyle() {
|
|
203
|
+
return {
|
|
204
|
+
getPropertyValue: function getPropertyValue() {
|
|
205
|
+
return '';
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
},
|
|
209
|
+
Image: function Image() {},
|
|
210
|
+
Date: function Date() {},
|
|
211
|
+
screen: {},
|
|
212
|
+
setTimeout: function setTimeout() {},
|
|
213
|
+
clearTimeout: function clearTimeout() {},
|
|
214
|
+
matchMedia: function matchMedia() {
|
|
215
|
+
return {};
|
|
216
|
+
},
|
|
217
|
+
requestAnimationFrame: function requestAnimationFrame(callback) {
|
|
218
|
+
if (typeof setTimeout === 'undefined') {
|
|
219
|
+
callback();
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
return setTimeout(callback, 0);
|
|
224
|
+
},
|
|
225
|
+
cancelAnimationFrame: function cancelAnimationFrame(id) {
|
|
226
|
+
if (typeof setTimeout === 'undefined') {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
clearTimeout(id);
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
function getWindow() {
|
|
235
|
+
var win = typeof window !== 'undefined' ? window : ssrWindow;
|
|
236
|
+
return win;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
/***/ }),
|
|
242
|
+
|
|
243
|
+
/***/ 225:
|
|
126
244
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
127
245
|
|
|
128
246
|
"use strict";
|
|
@@ -143,17 +261,18 @@ var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_)
|
|
|
143
261
|
var external_prop_types_ = __webpack_require__(1);
|
|
144
262
|
var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_);
|
|
145
263
|
|
|
146
|
-
// EXTERNAL MODULE: external "lodash"
|
|
147
|
-
var
|
|
264
|
+
// EXTERNAL MODULE: external "lodash/has"
|
|
265
|
+
var has_ = __webpack_require__(11);
|
|
266
|
+
var has_default = /*#__PURE__*/__webpack_require__.n(has_);
|
|
148
267
|
|
|
149
268
|
// EXTERNAL MODULE: external "@splunk/ui-utils/i18n"
|
|
150
|
-
var i18n_ = __webpack_require__(
|
|
269
|
+
var i18n_ = __webpack_require__(4);
|
|
151
270
|
|
|
152
271
|
// EXTERNAL MODULE: ./src/Select/SelectBase.tsx + 2 modules
|
|
153
|
-
var SelectBase = __webpack_require__(
|
|
272
|
+
var SelectBase = __webpack_require__(59);
|
|
154
273
|
|
|
155
274
|
// EXTERNAL MODULE: ./src/Select/OptionBase.tsx
|
|
156
|
-
var OptionBase = __webpack_require__(
|
|
275
|
+
var OptionBase = __webpack_require__(38);
|
|
157
276
|
|
|
158
277
|
// CONCATENATED MODULE: ./src/Select/Option.tsx
|
|
159
278
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
@@ -392,7 +511,7 @@ var Select_Select = /*#__PURE__*/function (_Component) {
|
|
|
392
511
|
var state = {}; // wrap defaultValue in an array once to avoid failing <SelectBase>'s defaultValues comparison check
|
|
393
512
|
// using "has" to make sure that pre-4.3 behavior is preserved if a user explicitly passes "null" or "undefined"
|
|
394
513
|
|
|
395
|
-
if (
|
|
514
|
+
if (has_default()(props, 'defaultValue')) {
|
|
396
515
|
if (props.defaultValue != null) {
|
|
397
516
|
state.defaultValues = [props.defaultValue];
|
|
398
517
|
} else {
|
|
@@ -429,7 +548,7 @@ var Select_Select = /*#__PURE__*/function (_Component) {
|
|
|
429
548
|
}
|
|
430
549
|
}; // using "has" as opposed to a null check to match SelectBase
|
|
431
550
|
|
|
432
|
-
if (
|
|
551
|
+
if (has_default()(this.props, 'value')) {
|
|
433
552
|
if (value != null) {
|
|
434
553
|
convertedProps.values = [value];
|
|
435
554
|
} else {
|
|
@@ -467,42 +586,113 @@ Select_defineProperty(Select_Select, "Divider", SelectBase["a" /* Divider */]);
|
|
|
467
586
|
|
|
468
587
|
/***/ }),
|
|
469
588
|
|
|
470
|
-
/***/
|
|
589
|
+
/***/ 24:
|
|
471
590
|
/***/ (function(module, exports) {
|
|
472
591
|
|
|
473
|
-
module.exports = require("react");
|
|
592
|
+
module.exports = require("@splunk/react-ui/Dropdown");
|
|
474
593
|
|
|
475
594
|
/***/ }),
|
|
476
595
|
|
|
477
|
-
/***/
|
|
596
|
+
/***/ 28:
|
|
597
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
598
|
+
|
|
599
|
+
"use strict";
|
|
600
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getDocument; });
|
|
601
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return ssrDocument; });
|
|
602
|
+
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
603
|
+
var ssrDocument = {
|
|
604
|
+
body: {
|
|
605
|
+
appendChild: function appendChild() {
|
|
606
|
+
return [];
|
|
607
|
+
}
|
|
608
|
+
},
|
|
609
|
+
addEventListener: function addEventListener() {},
|
|
610
|
+
removeEventListener: function removeEventListener() {},
|
|
611
|
+
activeElement: {
|
|
612
|
+
blur: function blur() {},
|
|
613
|
+
nodeName: ''
|
|
614
|
+
},
|
|
615
|
+
querySelector: function querySelector() {
|
|
616
|
+
return null;
|
|
617
|
+
},
|
|
618
|
+
querySelectorAll: function querySelectorAll() {
|
|
619
|
+
return [];
|
|
620
|
+
},
|
|
621
|
+
getElementById: function getElementById() {
|
|
622
|
+
return null;
|
|
623
|
+
},
|
|
624
|
+
createEvent: function createEvent() {
|
|
625
|
+
return {
|
|
626
|
+
initEvent: function initEvent() {}
|
|
627
|
+
};
|
|
628
|
+
},
|
|
629
|
+
createElement: function createElement() {
|
|
630
|
+
return {
|
|
631
|
+
children: [],
|
|
632
|
+
childNodes: [],
|
|
633
|
+
style: {},
|
|
634
|
+
setAttribute: function setAttribute() {},
|
|
635
|
+
getElementsByTagName: function getElementsByTagName() {
|
|
636
|
+
return [];
|
|
637
|
+
}
|
|
638
|
+
};
|
|
639
|
+
},
|
|
640
|
+
createElementNS: function createElementNS() {
|
|
641
|
+
return {};
|
|
642
|
+
},
|
|
643
|
+
importNode: function importNode() {
|
|
644
|
+
return null;
|
|
645
|
+
},
|
|
646
|
+
location: {
|
|
647
|
+
hash: '',
|
|
648
|
+
host: '',
|
|
649
|
+
hostname: '',
|
|
650
|
+
href: '',
|
|
651
|
+
origin: '',
|
|
652
|
+
pathname: '',
|
|
653
|
+
protocol: '',
|
|
654
|
+
search: ''
|
|
655
|
+
}
|
|
656
|
+
};
|
|
657
|
+
|
|
658
|
+
function getDocument() {
|
|
659
|
+
var doc = typeof document !== 'undefined' ? document : ssrDocument;
|
|
660
|
+
return doc;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
|
|
664
|
+
|
|
665
|
+
/***/ }),
|
|
666
|
+
|
|
667
|
+
/***/ 3:
|
|
478
668
|
/***/ (function(module, exports) {
|
|
479
669
|
|
|
480
|
-
module.exports = require("
|
|
670
|
+
module.exports = require("styled-components");
|
|
481
671
|
|
|
482
672
|
/***/ }),
|
|
483
673
|
|
|
484
|
-
/***/
|
|
674
|
+
/***/ 30:
|
|
485
675
|
/***/ (function(module, exports) {
|
|
486
676
|
|
|
487
677
|
module.exports = require("@splunk/react-ui/Text");
|
|
488
678
|
|
|
489
679
|
/***/ }),
|
|
490
680
|
|
|
491
|
-
/***/
|
|
681
|
+
/***/ 33:
|
|
492
682
|
/***/ (function(module, exports) {
|
|
493
683
|
|
|
494
684
|
module.exports = require("@splunk/ui-utils/filter");
|
|
495
685
|
|
|
496
686
|
/***/ }),
|
|
497
687
|
|
|
498
|
-
/***/
|
|
688
|
+
/***/ 34:
|
|
499
689
|
/***/ (function(module, exports) {
|
|
500
690
|
|
|
501
|
-
module.exports = require("
|
|
691
|
+
module.exports = require("lodash/pick");
|
|
502
692
|
|
|
503
693
|
/***/ }),
|
|
504
694
|
|
|
505
|
-
/***/
|
|
695
|
+
/***/ 38:
|
|
506
696
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
507
697
|
|
|
508
698
|
"use strict";
|
|
@@ -510,7 +700,7 @@ module.exports = require("styled-components");
|
|
|
510
700
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
511
701
|
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
|
|
512
702
|
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
|
|
513
|
-
/* harmony import */ var _splunk_react_ui_Menu__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(
|
|
703
|
+
/* harmony import */ var _splunk_react_ui_Menu__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(15);
|
|
514
704
|
/* harmony import */ var _splunk_react_ui_Menu__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_splunk_react_ui_Menu__WEBPACK_IMPORTED_MODULE_2__);
|
|
515
705
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
516
706
|
|
|
@@ -678,14 +868,14 @@ _defineProperty(Option, "defaultProps", defaultProps);
|
|
|
678
868
|
|
|
679
869
|
/***/ }),
|
|
680
870
|
|
|
681
|
-
/***/
|
|
871
|
+
/***/ 39:
|
|
682
872
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
683
873
|
|
|
684
874
|
"use strict";
|
|
685
875
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Search; });
|
|
686
876
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
|
687
877
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
688
|
-
/* harmony import */ var _splunk_react_icons_Search__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
878
|
+
/* harmony import */ var _splunk_react_icons_Search__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(56);
|
|
689
879
|
/* harmony import */ var _splunk_react_icons_Search__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_splunk_react_icons_Search__WEBPACK_IMPORTED_MODULE_1__);
|
|
690
880
|
/* harmony import */ var _ThemedIcon__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7);
|
|
691
881
|
/* harmony import */ var _SVG__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6);
|
|
@@ -728,35 +918,56 @@ function Search(props) {
|
|
|
728
918
|
|
|
729
919
|
/***/ }),
|
|
730
920
|
|
|
731
|
-
/***/
|
|
921
|
+
/***/ 4:
|
|
922
|
+
/***/ (function(module, exports) {
|
|
923
|
+
|
|
924
|
+
module.exports = require("@splunk/ui-utils/i18n");
|
|
925
|
+
|
|
926
|
+
/***/ }),
|
|
927
|
+
|
|
928
|
+
/***/ 41:
|
|
929
|
+
/***/ (function(module, exports) {
|
|
930
|
+
|
|
931
|
+
module.exports = require("lodash/isUndefined");
|
|
932
|
+
|
|
933
|
+
/***/ }),
|
|
934
|
+
|
|
935
|
+
/***/ 42:
|
|
732
936
|
/***/ (function(module, exports) {
|
|
733
937
|
|
|
734
938
|
module.exports = require("@splunk/react-ui/Link");
|
|
735
939
|
|
|
736
940
|
/***/ }),
|
|
737
941
|
|
|
738
|
-
/***/
|
|
942
|
+
/***/ 46:
|
|
739
943
|
/***/ (function(module, exports) {
|
|
740
944
|
|
|
741
945
|
module.exports = require("@splunk/react-ui/ResultsMenu");
|
|
742
946
|
|
|
743
947
|
/***/ }),
|
|
744
948
|
|
|
745
|
-
/***/
|
|
949
|
+
/***/ 5:
|
|
746
950
|
/***/ (function(module, exports) {
|
|
747
951
|
|
|
748
|
-
module.exports = require("lodash");
|
|
952
|
+
module.exports = require("lodash/omit");
|
|
749
953
|
|
|
750
954
|
/***/ }),
|
|
751
955
|
|
|
752
|
-
/***/
|
|
956
|
+
/***/ 51:
|
|
957
|
+
/***/ (function(module, exports) {
|
|
958
|
+
|
|
959
|
+
module.exports = require("lodash/find");
|
|
960
|
+
|
|
961
|
+
/***/ }),
|
|
962
|
+
|
|
963
|
+
/***/ 52:
|
|
753
964
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
754
965
|
|
|
755
966
|
"use strict";
|
|
756
967
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CaretDown; });
|
|
757
968
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
|
758
969
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
759
|
-
/* harmony import */ var _splunk_react_icons_Caret__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
970
|
+
/* harmony import */ var _splunk_react_icons_Caret__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(53);
|
|
760
971
|
/* harmony import */ var _splunk_react_icons_Caret__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_splunk_react_icons_Caret__WEBPACK_IMPORTED_MODULE_1__);
|
|
761
972
|
/* harmony import */ var _ThemedIcon__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7);
|
|
762
973
|
/* harmony import */ var _SVG__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6);
|
|
@@ -787,21 +998,28 @@ function CaretDown(props) {
|
|
|
787
998
|
|
|
788
999
|
/***/ }),
|
|
789
1000
|
|
|
790
|
-
/***/
|
|
1001
|
+
/***/ 53:
|
|
791
1002
|
/***/ (function(module, exports) {
|
|
792
1003
|
|
|
793
1004
|
module.exports = require("@splunk/react-icons/Caret");
|
|
794
1005
|
|
|
795
1006
|
/***/ }),
|
|
796
1007
|
|
|
797
|
-
/***/
|
|
1008
|
+
/***/ 56:
|
|
798
1009
|
/***/ (function(module, exports) {
|
|
799
1010
|
|
|
800
1011
|
module.exports = require("@splunk/react-icons/Search");
|
|
801
1012
|
|
|
802
1013
|
/***/ }),
|
|
803
1014
|
|
|
804
|
-
/***/
|
|
1015
|
+
/***/ 58:
|
|
1016
|
+
/***/ (function(module, exports) {
|
|
1017
|
+
|
|
1018
|
+
module.exports = require("lodash/without");
|
|
1019
|
+
|
|
1020
|
+
/***/ }),
|
|
1021
|
+
|
|
1022
|
+
/***/ 59:
|
|
805
1023
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
806
1024
|
|
|
807
1025
|
"use strict";
|
|
@@ -821,55 +1039,96 @@ var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_)
|
|
|
821
1039
|
var external_prop_types_ = __webpack_require__(1);
|
|
822
1040
|
var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_);
|
|
823
1041
|
|
|
824
|
-
// EXTERNAL MODULE: external "lodash"
|
|
825
|
-
var
|
|
1042
|
+
// EXTERNAL MODULE: external "lodash/castArray"
|
|
1043
|
+
var castArray_ = __webpack_require__(62);
|
|
1044
|
+
var castArray_default = /*#__PURE__*/__webpack_require__.n(castArray_);
|
|
1045
|
+
|
|
1046
|
+
// EXTERNAL MODULE: external "lodash/find"
|
|
1047
|
+
var find_ = __webpack_require__(51);
|
|
1048
|
+
var find_default = /*#__PURE__*/__webpack_require__.n(find_);
|
|
1049
|
+
|
|
1050
|
+
// EXTERNAL MODULE: external "lodash/forEachRight"
|
|
1051
|
+
var forEachRight_ = __webpack_require__(104);
|
|
1052
|
+
var forEachRight_default = /*#__PURE__*/__webpack_require__.n(forEachRight_);
|
|
1053
|
+
|
|
1054
|
+
// EXTERNAL MODULE: external "lodash/has"
|
|
1055
|
+
var has_ = __webpack_require__(11);
|
|
1056
|
+
var has_default = /*#__PURE__*/__webpack_require__.n(has_);
|
|
1057
|
+
|
|
1058
|
+
// EXTERNAL MODULE: external "lodash/includes"
|
|
1059
|
+
var includes_ = __webpack_require__(18);
|
|
1060
|
+
var includes_default = /*#__PURE__*/__webpack_require__.n(includes_);
|
|
1061
|
+
|
|
1062
|
+
// EXTERNAL MODULE: external "lodash/isUndefined"
|
|
1063
|
+
var isUndefined_ = __webpack_require__(41);
|
|
1064
|
+
var isUndefined_default = /*#__PURE__*/__webpack_require__.n(isUndefined_);
|
|
1065
|
+
|
|
1066
|
+
// EXTERNAL MODULE: external "lodash/keys"
|
|
1067
|
+
var keys_ = __webpack_require__(10);
|
|
1068
|
+
var keys_default = /*#__PURE__*/__webpack_require__.n(keys_);
|
|
1069
|
+
|
|
1070
|
+
// EXTERNAL MODULE: external "lodash/omit"
|
|
1071
|
+
var omit_ = __webpack_require__(5);
|
|
1072
|
+
var omit_default = /*#__PURE__*/__webpack_require__.n(omit_);
|
|
1073
|
+
|
|
1074
|
+
// EXTERNAL MODULE: external "lodash/pick"
|
|
1075
|
+
var pick_ = __webpack_require__(34);
|
|
1076
|
+
var pick_default = /*#__PURE__*/__webpack_require__.n(pick_);
|
|
1077
|
+
|
|
1078
|
+
// EXTERNAL MODULE: external "lodash/uniq"
|
|
1079
|
+
var uniq_ = __webpack_require__(105);
|
|
1080
|
+
var uniq_default = /*#__PURE__*/__webpack_require__.n(uniq_);
|
|
1081
|
+
|
|
1082
|
+
// EXTERNAL MODULE: external "lodash/without"
|
|
1083
|
+
var without_ = __webpack_require__(58);
|
|
1084
|
+
var without_default = /*#__PURE__*/__webpack_require__.n(without_);
|
|
826
1085
|
|
|
827
1086
|
// EXTERNAL MODULE: external "@splunk/ui-utils/filter"
|
|
828
|
-
var filter_ = __webpack_require__(
|
|
1087
|
+
var filter_ = __webpack_require__(33);
|
|
829
1088
|
|
|
830
1089
|
// EXTERNAL MODULE: external "@splunk/ui-utils/id"
|
|
831
|
-
var id_ = __webpack_require__(
|
|
1090
|
+
var id_ = __webpack_require__(13);
|
|
832
1091
|
|
|
833
1092
|
// EXTERNAL MODULE: external "@splunk/ui-utils/i18n"
|
|
834
|
-
var i18n_ = __webpack_require__(
|
|
1093
|
+
var i18n_ = __webpack_require__(4);
|
|
835
1094
|
|
|
836
1095
|
// EXTERNAL MODULE: external "@splunk/ui-utils/keyboard"
|
|
837
1096
|
var keyboard_ = __webpack_require__(9);
|
|
838
1097
|
|
|
839
1098
|
// EXTERNAL MODULE: external "@splunk/react-ui/Dropdown"
|
|
840
|
-
var Dropdown_ = __webpack_require__(
|
|
1099
|
+
var Dropdown_ = __webpack_require__(24);
|
|
841
1100
|
var Dropdown_default = /*#__PURE__*/__webpack_require__.n(Dropdown_);
|
|
842
1101
|
|
|
843
1102
|
// EXTERNAL MODULE: external "@splunk/react-ui/Link"
|
|
844
|
-
var Link_ = __webpack_require__(
|
|
1103
|
+
var Link_ = __webpack_require__(42);
|
|
845
1104
|
var Link_default = /*#__PURE__*/__webpack_require__.n(Link_);
|
|
846
1105
|
|
|
847
1106
|
// EXTERNAL MODULE: external "@splunk/react-ui/Menu"
|
|
848
|
-
var Menu_ = __webpack_require__(
|
|
1107
|
+
var Menu_ = __webpack_require__(15);
|
|
849
1108
|
|
|
850
1109
|
// EXTERNAL MODULE: external "@splunk/react-ui/ResultsMenu"
|
|
851
|
-
var ResultsMenu_ = __webpack_require__(
|
|
1110
|
+
var ResultsMenu_ = __webpack_require__(46);
|
|
852
1111
|
var ResultsMenu_default = /*#__PURE__*/__webpack_require__.n(ResultsMenu_);
|
|
853
1112
|
|
|
854
1113
|
// EXTERNAL MODULE: external "@splunk/react-ui/Text"
|
|
855
|
-
var Text_ = __webpack_require__(
|
|
1114
|
+
var Text_ = __webpack_require__(30);
|
|
856
1115
|
var Text_default = /*#__PURE__*/__webpack_require__.n(Text_);
|
|
857
1116
|
|
|
858
1117
|
// EXTERNAL MODULE: ./src/icons/CaretDown.tsx
|
|
859
|
-
var CaretDown = __webpack_require__(
|
|
1118
|
+
var CaretDown = __webpack_require__(52);
|
|
860
1119
|
|
|
861
1120
|
// EXTERNAL MODULE: ./src/icons/Search.tsx
|
|
862
|
-
var Search = __webpack_require__(
|
|
1121
|
+
var Search = __webpack_require__(39);
|
|
863
1122
|
|
|
864
1123
|
// EXTERNAL MODULE: ./src/Select/OptionBase.tsx
|
|
865
|
-
var OptionBase = __webpack_require__(
|
|
1124
|
+
var OptionBase = __webpack_require__(38);
|
|
866
1125
|
|
|
867
1126
|
// EXTERNAL MODULE: external "styled-components"
|
|
868
1127
|
var external_styled_components_ = __webpack_require__(3);
|
|
869
1128
|
var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_);
|
|
870
1129
|
|
|
871
1130
|
// EXTERNAL MODULE: external "@splunk/react-ui/Button"
|
|
872
|
-
var Button_ = __webpack_require__(
|
|
1131
|
+
var Button_ = __webpack_require__(19);
|
|
873
1132
|
var Button_default = /*#__PURE__*/__webpack_require__.n(Button_);
|
|
874
1133
|
|
|
875
1134
|
// EXTERNAL MODULE: external "@splunk/themes"
|
|
@@ -993,6 +1252,9 @@ var fuzzyMatch = function fuzzyMatch(options, matchChar) {
|
|
|
993
1252
|
};
|
|
994
1253
|
|
|
995
1254
|
|
|
1255
|
+
// EXTERNAL MODULE: ./src/utils/ssrWindow.ts
|
|
1256
|
+
var ssrWindow = __webpack_require__(20);
|
|
1257
|
+
|
|
996
1258
|
// CONCATENATED MODULE: ./src/Select/SelectBase.tsx
|
|
997
1259
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
998
1260
|
|
|
@@ -1052,6 +1314,17 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
1052
1314
|
|
|
1053
1315
|
|
|
1054
1316
|
|
|
1317
|
+
|
|
1318
|
+
|
|
1319
|
+
|
|
1320
|
+
|
|
1321
|
+
|
|
1322
|
+
|
|
1323
|
+
|
|
1324
|
+
|
|
1325
|
+
|
|
1326
|
+
|
|
1327
|
+
|
|
1055
1328
|
|
|
1056
1329
|
|
|
1057
1330
|
|
|
@@ -1093,6 +1366,9 @@ var propTypes = {
|
|
|
1093
1366
|
onOpen: external_prop_types_default.a.func,
|
|
1094
1367
|
onScroll: external_prop_types_default.a.func,
|
|
1095
1368
|
onScrollBottom: external_prop_types_default.a.func,
|
|
1369
|
+
|
|
1370
|
+
/** @private. */
|
|
1371
|
+
required: external_prop_types_default.a.bool,
|
|
1096
1372
|
placeholder: external_prop_types_default.a.string,
|
|
1097
1373
|
prefixLabel: external_prop_types_default.a.string,
|
|
1098
1374
|
prepend: external_prop_types_default.a.bool,
|
|
@@ -1123,7 +1399,7 @@ var defaultProps = {
|
|
|
1123
1399
|
};
|
|
1124
1400
|
|
|
1125
1401
|
function isOption(child) {
|
|
1126
|
-
return child &&
|
|
1402
|
+
return child && has_default()(child.props, 'value');
|
|
1127
1403
|
}
|
|
1128
1404
|
|
|
1129
1405
|
var SelectBase_SelectBase = /*#__PURE__*/function (_Component) {
|
|
@@ -1200,9 +1476,9 @@ var SelectBase_SelectBase = /*#__PURE__*/function (_Component) {
|
|
|
1200
1476
|
}
|
|
1201
1477
|
|
|
1202
1478
|
var currentValues = (_this$getCurrentValue = _this.getCurrentValues()) !== null && _this$getCurrentValue !== void 0 ? _this$getCurrentValue : [];
|
|
1203
|
-
var values =
|
|
1479
|
+
var values = uniq_default()(currentValues.concat(_this.displayedValues));
|
|
1204
1480
|
values = external_react_default.a.Children.toArray(children).filter(function (child) {
|
|
1205
|
-
return isOption(child) &&
|
|
1481
|
+
return isOption(child) && includes_default()(values, child.props.value) && (!child.props.disabled || includes_default()(currentValues, child.props.value));
|
|
1206
1482
|
}).map(function (child) {
|
|
1207
1483
|
return child.props.value;
|
|
1208
1484
|
});
|
|
@@ -1232,10 +1508,10 @@ var SelectBase_SelectBase = /*#__PURE__*/function (_Component) {
|
|
|
1232
1508
|
}
|
|
1233
1509
|
|
|
1234
1510
|
var currentValues = (_this$getCurrentValue2 = _this.getCurrentValues()) !== null && _this$getCurrentValue2 !== void 0 ? _this$getCurrentValue2 : [];
|
|
1235
|
-
var hiddenCurrentValues =
|
|
1511
|
+
var hiddenCurrentValues = without_default.a.apply(void 0, [currentValues].concat(_toConsumableArray(_this.displayedValues))); // this will unselect all selected values unless those values are disabled or hidden by the filter
|
|
1236
1512
|
|
|
1237
1513
|
var values = external_react_default.a.Children.toArray(children).filter(function (child) {
|
|
1238
|
-
return isOption(child) && (
|
|
1514
|
+
return isOption(child) && (includes_default()(currentValues, child.props.value) && child.props.disabled || includes_default()(hiddenCurrentValues, child.props.value));
|
|
1239
1515
|
}).map(function (child) {
|
|
1240
1516
|
return child.props.value;
|
|
1241
1517
|
});
|
|
@@ -1260,7 +1536,7 @@ var SelectBase_SelectBase = /*#__PURE__*/function (_Component) {
|
|
|
1260
1536
|
var eventKeyCode = Object(keyboard_["keycode"])(e.nativeEvent);
|
|
1261
1537
|
|
|
1262
1538
|
if (eventKeyCode === 'tab') {
|
|
1263
|
-
if (tabConfirmsNewValue && !
|
|
1539
|
+
if (tabConfirmsNewValue && !isUndefined_default()(_this.activeValue) && _this.availableOptionCount <= 1) {
|
|
1264
1540
|
e.preventDefault();
|
|
1265
1541
|
|
|
1266
1542
|
_this.toggleValue(e, _this.activeValue);
|
|
@@ -1301,7 +1577,7 @@ var SelectBase_SelectBase = /*#__PURE__*/function (_Component) {
|
|
|
1301
1577
|
});
|
|
1302
1578
|
}
|
|
1303
1579
|
|
|
1304
|
-
if (eventKeyCode === 'enter' && !
|
|
1580
|
+
if (eventKeyCode === 'enter' && !isUndefined_default()(_this.activeValue) && _this.state.open) {
|
|
1305
1581
|
e.preventDefault();
|
|
1306
1582
|
|
|
1307
1583
|
_this.toggleValue(e, _this.activeValue);
|
|
@@ -1478,19 +1754,145 @@ var SelectBase_SelectBase = /*#__PURE__*/function (_Component) {
|
|
|
1478
1754
|
}
|
|
1479
1755
|
});
|
|
1480
1756
|
|
|
1757
|
+
_defineProperty(_assertThisInitialized(_this), "createToggle", function () {
|
|
1758
|
+
var _this$getCurrentValue4;
|
|
1759
|
+
|
|
1760
|
+
var _this$props11 = _this.props,
|
|
1761
|
+
toggle = _this$props11.toggle,
|
|
1762
|
+
appearance = _this$props11.appearance,
|
|
1763
|
+
children = _this$props11.children,
|
|
1764
|
+
describedBy = _this$props11.describedBy,
|
|
1765
|
+
disabled = _this$props11.disabled,
|
|
1766
|
+
elementRef = _this$props11.elementRef,
|
|
1767
|
+
error = _this$props11.error,
|
|
1768
|
+
inline = _this$props11.inline,
|
|
1769
|
+
labelledBy = _this$props11.labelledBy,
|
|
1770
|
+
labelText = _this$props11.labelText,
|
|
1771
|
+
multiple = _this$props11.multiple,
|
|
1772
|
+
placeholder = _this$props11.placeholder,
|
|
1773
|
+
prefixLabel = _this$props11.prefixLabel,
|
|
1774
|
+
required = _this$props11.required,
|
|
1775
|
+
suffixLabel = _this$props11.suffixLabel;
|
|
1776
|
+
var icon;
|
|
1777
|
+
var label; // Generate buttonLabels
|
|
1778
|
+
|
|
1779
|
+
var currentValues = (_this$getCurrentValue4 = _this.getCurrentValues()) !== null && _this$getCurrentValue4 !== void 0 ? _this$getCurrentValue4 : [];
|
|
1780
|
+
var childrenArray = external_react_["Children"].toArray(children);
|
|
1781
|
+
var valuesLabel = currentValues.reduce(function (acc, value, index, orig) {
|
|
1782
|
+
var matchedItem = find_default()(childrenArray, function (item) {
|
|
1783
|
+
return isOption(item) && item.props.value === value;
|
|
1784
|
+
});
|
|
1785
|
+
|
|
1786
|
+
if (matchedItem) {
|
|
1787
|
+
acc.push(matchedItem.props.children || matchedItem.props.label); // if not in multiple mode, add the icon
|
|
1788
|
+
|
|
1789
|
+
if (!multiple && currentValues.length === 1) {
|
|
1790
|
+
icon = matchedItem.props.icon;
|
|
1791
|
+
}
|
|
1792
|
+
} else if (multiple) {
|
|
1793
|
+
// only add values that don't match an option in "multiple" mode to preserve old behaviour
|
|
1794
|
+
acc.push(value);
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
if (index < orig.length - 1) {
|
|
1798
|
+
acc.push(Object(i18n_["_"])(', '));
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
return acc;
|
|
1802
|
+
}, []);
|
|
1803
|
+
label = valuesLabel; // only apply prefix / suffix if the label is not empty
|
|
1804
|
+
|
|
1805
|
+
if (label.length > 0) {
|
|
1806
|
+
label = _this.wrapLabel({
|
|
1807
|
+
prefixLabel: prefixLabel,
|
|
1808
|
+
label: label,
|
|
1809
|
+
suffixLabel: suffixLabel
|
|
1810
|
+
});
|
|
1811
|
+
} // single <Select> behaviour is to show the placeholder if all parts of the the label
|
|
1812
|
+
// are empty strings so we replicate this behaviour here
|
|
1813
|
+
|
|
1814
|
+
|
|
1815
|
+
if (label.length === 0 || !multiple && label.every(function (labelNode) {
|
|
1816
|
+
return labelNode === '';
|
|
1817
|
+
})) {
|
|
1818
|
+
label = [placeholder];
|
|
1819
|
+
}
|
|
1820
|
+
|
|
1821
|
+
var ariaLabel = label; // If there's more than one item selected, read out the selected total
|
|
1822
|
+
// rather than reading out each selected item
|
|
1823
|
+
|
|
1824
|
+
if (label.length > 1) {
|
|
1825
|
+
ariaLabel = _this.wrapLabel({
|
|
1826
|
+
prefixLabel: prefixLabel,
|
|
1827
|
+
label: ["".concat(currentValues.length, " items selected")],
|
|
1828
|
+
suffixLabel: suffixLabel
|
|
1829
|
+
});
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1832
|
+
var commonProps = _objectSpread({
|
|
1833
|
+
'aria-describedby': describedBy,
|
|
1834
|
+
'aria-label': "".concat(labelText ? "".concat(labelText, ", ") : '').concat(ariaLabel),
|
|
1835
|
+
'aria-labelledby': labelText ? undefined : labelledBy,
|
|
1836
|
+
'aria-multiselectable': multiple,
|
|
1837
|
+
'aria-required': required,
|
|
1838
|
+
'data-select-appearance': appearance,
|
|
1839
|
+
'data-test': multiple ? 'multiselect' : 'select',
|
|
1840
|
+
disabled: disabled,
|
|
1841
|
+
elementRef: elementRef,
|
|
1842
|
+
error: error
|
|
1843
|
+
}, omit_default()(_this.props, keys_default()(SelectBase.propTypes)));
|
|
1844
|
+
|
|
1845
|
+
if (multiple) {
|
|
1846
|
+
commonProps['data-test-values'] = JSON.stringify(currentValues);
|
|
1847
|
+
} else {
|
|
1848
|
+
var _currentValues = _slicedToArray(currentValues, 1),
|
|
1849
|
+
dataTestValue = _currentValues[0];
|
|
1850
|
+
|
|
1851
|
+
commonProps['data-test-value'] = dataTestValue;
|
|
1852
|
+
}
|
|
1853
|
+
|
|
1854
|
+
if (toggle) {
|
|
1855
|
+
return /*#__PURE__*/Object(external_react_["cloneElement"])(toggle, commonProps);
|
|
1856
|
+
}
|
|
1857
|
+
|
|
1858
|
+
if (appearance === 'link') {
|
|
1859
|
+
return /*#__PURE__*/external_react_default.a.createElement(Link_default.a, _extends({}, commonProps, {
|
|
1860
|
+
"data-select-appearance": "link"
|
|
1861
|
+
}), !!icon && /*#__PURE__*/external_react_default.a.createElement(StyledLinkIcon, null, icon), label || placeholder, /*#__PURE__*/external_react_default.a.createElement(StyledLinkCaret, null, /*#__PURE__*/external_react_default.a.createElement(CaretDown["a" /* default */], {
|
|
1862
|
+
enterpriseSize: 0.5,
|
|
1863
|
+
prismaSize: "small"
|
|
1864
|
+
})));
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
return /*#__PURE__*/external_react_default.a.createElement(StyledButton, _extends({}, commonProps, {
|
|
1868
|
+
$multiple: multiple,
|
|
1869
|
+
appearance: appearance,
|
|
1870
|
+
label: label,
|
|
1871
|
+
error: error,
|
|
1872
|
+
icon: icon,
|
|
1873
|
+
inline: inline,
|
|
1874
|
+
isMenu: true,
|
|
1875
|
+
role: "listbox" // @ts-expect-error - accept inconsistency with Button
|
|
1876
|
+
,
|
|
1877
|
+
onClick: _this.props.onClick
|
|
1878
|
+
}, pick_default()(_this.props, SelectBase.invalidLinkAppearanceProps)), !!currentValues.length && multiple && /*#__PURE__*/external_react_default.a.createElement(StyledCount, {
|
|
1879
|
+
"data-role": "count"
|
|
1880
|
+
}, "(", currentValues.length, ")"));
|
|
1881
|
+
});
|
|
1882
|
+
|
|
1481
1883
|
_defineProperty(_assertThisInitialized(_this), "createChildren", function () {
|
|
1482
1884
|
var _this$state = _this.state,
|
|
1483
1885
|
filterKeyword = _this$state.filterKeyword,
|
|
1484
1886
|
textHasFocus = _this$state.textHasFocus,
|
|
1485
1887
|
topValuesState = _this$state.topValues;
|
|
1486
|
-
var _this$
|
|
1487
|
-
allowKeyMatching = _this$
|
|
1488
|
-
allowNewValues = _this$
|
|
1489
|
-
filter = _this$
|
|
1490
|
-
multiple = _this$
|
|
1491
|
-
showSelectedValuesFirst = _this$
|
|
1492
|
-
isLoadingOptions = _this$
|
|
1493
|
-
onScrollBottom = _this$
|
|
1888
|
+
var _this$props12 = _this.props,
|
|
1889
|
+
allowKeyMatching = _this$props12.allowKeyMatching,
|
|
1890
|
+
allowNewValues = _this$props12.allowNewValues,
|
|
1891
|
+
filter = _this$props12.filter,
|
|
1892
|
+
multiple = _this$props12.multiple,
|
|
1893
|
+
showSelectedValuesFirst = _this$props12.showSelectedValuesFirst,
|
|
1894
|
+
isLoadingOptions = _this$props12.isLoadingOptions,
|
|
1895
|
+
onScrollBottom = _this$props12.onScrollBottom;
|
|
1494
1896
|
|
|
1495
1897
|
var currentValues = _this.getCurrentValues();
|
|
1496
1898
|
|
|
@@ -1570,8 +1972,8 @@ var SelectBase_SelectBase = /*#__PURE__*/function (_Component) {
|
|
|
1570
1972
|
}, []); // In multiple mode, add missing items
|
|
1571
1973
|
|
|
1572
1974
|
if (multiple) {
|
|
1573
|
-
|
|
1574
|
-
var matchedItem =
|
|
1975
|
+
forEachRight_default()(currentValues, function (value) {
|
|
1976
|
+
var matchedItem = find_default()(children, function (item) {
|
|
1575
1977
|
return isOption(item) && item.props && item.props.value === value;
|
|
1576
1978
|
});
|
|
1577
1979
|
|
|
@@ -1699,7 +2101,7 @@ var SelectBase_SelectBase = /*#__PURE__*/function (_Component) {
|
|
|
1699
2101
|
}
|
|
1700
2102
|
|
|
1701
2103
|
if (suffixLabel) {
|
|
1702
|
-
wrappedLabel =
|
|
2104
|
+
wrappedLabel = castArray_default()(wrappedLabel).concat(" ".concat(suffixLabel));
|
|
1703
2105
|
}
|
|
1704
2106
|
|
|
1705
2107
|
return wrappedLabel;
|
|
@@ -1713,7 +2115,7 @@ var SelectBase_SelectBase = /*#__PURE__*/function (_Component) {
|
|
|
1713
2115
|
topValues: [],
|
|
1714
2116
|
values: props.defaultValues || []
|
|
1715
2117
|
};
|
|
1716
|
-
_this.controlledExternally =
|
|
2118
|
+
_this.controlledExternally = has_default()(props, 'values');
|
|
1717
2119
|
_this.displayedValues = [];
|
|
1718
2120
|
_this.availableOptionCount = 0;
|
|
1719
2121
|
_this.firstSelectedOptionIndex = undefined;
|
|
@@ -1753,10 +2155,10 @@ var SelectBase_SelectBase = /*#__PURE__*/function (_Component) {
|
|
|
1753
2155
|
}, {
|
|
1754
2156
|
key: "getTopValues",
|
|
1755
2157
|
value: function getTopValues() {
|
|
1756
|
-
var _this$
|
|
2158
|
+
var _this$getCurrentValue5;
|
|
1757
2159
|
|
|
1758
2160
|
// in non-multiple mode, don't move values to the top of the list
|
|
1759
|
-
return this.props.multiple && this.props.showSelectedValuesFirst !== 'never' ? (_this$
|
|
2161
|
+
return this.props.multiple && this.props.showSelectedValuesFirst !== 'never' ? (_this$getCurrentValue5 = this.getCurrentValues()) !== null && _this$getCurrentValue5 !== void 0 ? _this$getCurrentValue5 : [] : [];
|
|
1760
2162
|
}
|
|
1761
2163
|
}, {
|
|
1762
2164
|
key: "isControlled",
|
|
@@ -1771,13 +2173,13 @@ var SelectBase_SelectBase = /*#__PURE__*/function (_Component) {
|
|
|
1771
2173
|
}, {
|
|
1772
2174
|
key: "toggleValue",
|
|
1773
2175
|
value: function toggleValue(e, value) {
|
|
1774
|
-
var _this$
|
|
2176
|
+
var _this$getCurrentValue6, _this$props$onChange3, _this$props14;
|
|
1775
2177
|
|
|
1776
|
-
var values = (_this$
|
|
2178
|
+
var values = (_this$getCurrentValue6 = this.getCurrentValues()) !== null && _this$getCurrentValue6 !== void 0 ? _this$getCurrentValue6 : [];
|
|
1777
2179
|
var currentIndex = values.indexOf(value);
|
|
1778
|
-
var _this$
|
|
1779
|
-
name = _this$
|
|
1780
|
-
multiple = _this$
|
|
2180
|
+
var _this$props13 = this.props,
|
|
2181
|
+
name = _this$props13.name,
|
|
2182
|
+
multiple = _this$props13.multiple;
|
|
1781
2183
|
var newValues;
|
|
1782
2184
|
|
|
1783
2185
|
if (multiple) {
|
|
@@ -1815,7 +2217,7 @@ var SelectBase_SelectBase = /*#__PURE__*/function (_Component) {
|
|
|
1815
2217
|
this.focus();
|
|
1816
2218
|
}
|
|
1817
2219
|
|
|
1818
|
-
(_this$props$onChange3 = (_this$
|
|
2220
|
+
(_this$props$onChange3 = (_this$props14 = this.props).onChange) === null || _this$props$onChange3 === void 0 ? void 0 : _this$props$onChange3.call(_this$props14, e, {
|
|
1819
2221
|
values: newValues,
|
|
1820
2222
|
name: name
|
|
1821
2223
|
});
|
|
@@ -1837,10 +2239,10 @@ var SelectBase_SelectBase = /*#__PURE__*/function (_Component) {
|
|
|
1837
2239
|
var hasChildren = _ref4.hasChildren,
|
|
1838
2240
|
placement = _ref4.placement;
|
|
1839
2241
|
var filterKeyword = this.state.filterKeyword;
|
|
1840
|
-
var _this$
|
|
1841
|
-
inputId = _this$
|
|
1842
|
-
inputRef = _this$
|
|
1843
|
-
multiple = _this$
|
|
2242
|
+
var _this$props15 = this.props,
|
|
2243
|
+
inputId = _this$props15.inputId,
|
|
2244
|
+
inputRef = _this$props15.inputRef,
|
|
2245
|
+
multiple = _this$props15.multiple; // only visually disable these as opposed to fully disabling to avoid losing keyboard focus - see SUI-2731
|
|
1844
2246
|
|
|
1845
2247
|
var selectControls = /*#__PURE__*/external_react_default.a.createElement(StyledToggleAllControls, {
|
|
1846
2248
|
$placement: placement,
|
|
@@ -1892,131 +2294,26 @@ var SelectBase_SelectBase = /*#__PURE__*/function (_Component) {
|
|
|
1892
2294
|
}, {
|
|
1893
2295
|
key: "render",
|
|
1894
2296
|
value: function render() {
|
|
1895
|
-
var _this$
|
|
2297
|
+
var _this$getCurrentValue7,
|
|
1896
2298
|
_this2 = this;
|
|
1897
2299
|
|
|
1898
|
-
var _this$
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
elementRef = _this$props15.elementRef,
|
|
1905
|
-
error = _this$props15.error,
|
|
1906
|
-
inline = _this$props15.inline,
|
|
1907
|
-
inputId = _this$props15.inputId,
|
|
1908
|
-
labelledBy = _this$props15.labelledBy,
|
|
1909
|
-
labelText = _this$props15.labelText,
|
|
1910
|
-
multiple = _this$props15.multiple,
|
|
1911
|
-
placeholder = _this$props15.placeholder,
|
|
1912
|
-
prefixLabel = _this$props15.prefixLabel,
|
|
1913
|
-
repositionMode = _this$props15.repositionMode,
|
|
1914
|
-
suffixLabel = _this$props15.suffixLabel;
|
|
1915
|
-
var icon;
|
|
1916
|
-
var label;
|
|
2300
|
+
var _this$props16 = this.props,
|
|
2301
|
+
children = _this$props16.children,
|
|
2302
|
+
defaultPlacement = _this$props16.defaultPlacement,
|
|
2303
|
+
inputId = _this$props16.inputId,
|
|
2304
|
+
multiple = _this$props16.multiple,
|
|
2305
|
+
repositionMode = _this$props16.repositionMode;
|
|
1917
2306
|
var filterEnabled = this.hasFilter();
|
|
1918
|
-
var
|
|
1919
|
-
|
|
2307
|
+
var currentValues = (_this$getCurrentValue7 = this.getCurrentValues()) !== null && _this$getCurrentValue7 !== void 0 ? _this$getCurrentValue7 : [];
|
|
1920
2308
|
var childrenArray = external_react_["Children"].toArray(children);
|
|
1921
|
-
var
|
|
1922
|
-
|
|
1923
|
-
var matchedItem = Object(external_lodash_["find"])(childrenArray, function (item) {
|
|
2309
|
+
var isAnyValueSelected = currentValues.some(function (value) {
|
|
2310
|
+
var matchedItem = find_default()(childrenArray, function (item) {
|
|
1924
2311
|
return isOption(item) && item.props.value === value;
|
|
1925
2312
|
});
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
acc.push(matchedItem.props.children || matchedItem.props.label);
|
|
1929
|
-
|
|
1930
|
-
if (!matchedItem.props.disabled) {
|
|
1931
|
-
isAnyValueSelected = true;
|
|
1932
|
-
} // if not in multiple mode, add the icon
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
if (!multiple && currentValues.length === 1) {
|
|
1936
|
-
icon = matchedItem.props.icon;
|
|
1937
|
-
}
|
|
1938
|
-
} else if (multiple) {
|
|
1939
|
-
// only add values that don't match an option in "multiple" mode to preserve old behaviour
|
|
1940
|
-
acc.push(value);
|
|
1941
|
-
}
|
|
1942
|
-
|
|
1943
|
-
if (index < orig.length - 1) {
|
|
1944
|
-
acc.push(Object(i18n_["_"])(', '));
|
|
1945
|
-
}
|
|
1946
|
-
|
|
1947
|
-
return acc;
|
|
1948
|
-
}, []);
|
|
1949
|
-
label = valuesLabel; // only apply prefix / suffix if the label is not empty
|
|
1950
|
-
|
|
1951
|
-
if (label.length > 0) {
|
|
1952
|
-
label = this.wrapLabel({
|
|
1953
|
-
prefixLabel: prefixLabel,
|
|
1954
|
-
label: label,
|
|
1955
|
-
suffixLabel: suffixLabel
|
|
1956
|
-
});
|
|
1957
|
-
} // single <Select> behaviour is to show the placeholder if all parts of the the label
|
|
1958
|
-
// are empty strings so we replicate this behaviour here
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
if (label.length === 0 || !multiple && label.every(function (labelNode) {
|
|
1962
|
-
return labelNode === '';
|
|
1963
|
-
})) {
|
|
1964
|
-
label = [placeholder];
|
|
1965
|
-
}
|
|
1966
|
-
|
|
1967
|
-
var ariaLabel = label; // If there's more than one item selected, read out the selected total
|
|
1968
|
-
// rather than reading out each selected item
|
|
1969
|
-
|
|
1970
|
-
if (label.length > 1) {
|
|
1971
|
-
ariaLabel = this.wrapLabel({
|
|
1972
|
-
prefixLabel: prefixLabel,
|
|
1973
|
-
label: ["".concat(currentValues.length, " items selected")],
|
|
1974
|
-
suffixLabel: suffixLabel
|
|
1975
|
-
});
|
|
1976
|
-
}
|
|
1977
|
-
|
|
2313
|
+
return matchedItem && !matchedItem.props.disabled;
|
|
2314
|
+
});
|
|
1978
2315
|
var finalChildren = this.createChildren();
|
|
1979
|
-
|
|
1980
|
-
var commonProps = _objectSpread({
|
|
1981
|
-
'aria-describedby': describedBy,
|
|
1982
|
-
'aria-label': "".concat(labelText ? "".concat(labelText, ", ") : '').concat(ariaLabel),
|
|
1983
|
-
'aria-labelledby': labelText ? undefined : labelledBy,
|
|
1984
|
-
'aria-multiselectable': multiple,
|
|
1985
|
-
'data-select-appearance': appearance,
|
|
1986
|
-
'data-test': multiple ? 'multiselect' : 'select',
|
|
1987
|
-
disabled: disabled,
|
|
1988
|
-
elementRef: elementRef,
|
|
1989
|
-
error: error
|
|
1990
|
-
}, Object(external_lodash_["omit"])(this.props, Object(external_lodash_["keys"])(SelectBase.propTypes)));
|
|
1991
|
-
|
|
1992
|
-
if (multiple) {
|
|
1993
|
-
commonProps['data-test-values'] = JSON.stringify(currentValues);
|
|
1994
|
-
} else {
|
|
1995
|
-
var _currentValues = _slicedToArray(currentValues, 1),
|
|
1996
|
-
dataTestValue = _currentValues[0];
|
|
1997
|
-
|
|
1998
|
-
commonProps['data-test-value'] = dataTestValue;
|
|
1999
|
-
}
|
|
2000
|
-
|
|
2001
|
-
var toggle = appearance === 'link' ? /*#__PURE__*/external_react_default.a.createElement(Link_default.a, _extends({}, commonProps, {
|
|
2002
|
-
"data-select-appearance": "link"
|
|
2003
|
-
}), !!icon && /*#__PURE__*/external_react_default.a.createElement(StyledLinkIcon, null, icon), label || placeholder, /*#__PURE__*/external_react_default.a.createElement(StyledLinkCaret, null, /*#__PURE__*/external_react_default.a.createElement(CaretDown["a" /* default */], {
|
|
2004
|
-
enterpriseSize: 0.5,
|
|
2005
|
-
prismaSize: "small"
|
|
2006
|
-
}))) : /*#__PURE__*/external_react_default.a.createElement(StyledButton, _extends({}, commonProps, {
|
|
2007
|
-
$multiple: multiple,
|
|
2008
|
-
appearance: appearance,
|
|
2009
|
-
label: label,
|
|
2010
|
-
error: error,
|
|
2011
|
-
icon: icon,
|
|
2012
|
-
inline: inline,
|
|
2013
|
-
isMenu: true,
|
|
2014
|
-
role: "listbox" // @ts-expect-error - accept inconsistency with Button
|
|
2015
|
-
,
|
|
2016
|
-
onClick: this.props.onClick
|
|
2017
|
-
}, Object(external_lodash_["pick"])(this.props, SelectBase.invalidLinkAppearanceProps)), !!currentValues.length && multiple && /*#__PURE__*/external_react_default.a.createElement(StyledCount, {
|
|
2018
|
-
"data-role": "count"
|
|
2019
|
-
}, "(", currentValues.length, ")"));
|
|
2316
|
+
var toggle = this.createToggle();
|
|
2020
2317
|
|
|
2021
2318
|
var createMenu = function createMenu(_ref5) {
|
|
2022
2319
|
var anchorWidth = _ref5.anchorWidth,
|
|
@@ -2042,7 +2339,7 @@ var SelectBase_SelectBase = /*#__PURE__*/function (_Component) {
|
|
|
2042
2339
|
"data-test": "results-menu",
|
|
2043
2340
|
isLoading: _this2.props.isLoadingOptions,
|
|
2044
2341
|
id: _this2.menuId
|
|
2045
|
-
},
|
|
2342
|
+
}, pick_default()(_this2.props, 'noOptionsMessage', 'footerMessage', 'animateLoading', 'loadingMessage', 'onScroll'), {
|
|
2046
2343
|
style: _objectSpread(_objectSpread({}, internalMenuStyle), _this2.props.menuStyle),
|
|
2047
2344
|
tabIndex: currentValues.length > 0 && !isAnyValueSelected ? 0 : undefined
|
|
2048
2345
|
}), finalChildren);
|
|
@@ -2057,7 +2354,7 @@ var SelectBase_SelectBase = /*#__PURE__*/function (_Component) {
|
|
|
2057
2354
|
open: this.state.open,
|
|
2058
2355
|
repositionMode: repositionMode,
|
|
2059
2356
|
defaultPlacement: filterEnabled ? defaultPlacement : undefined,
|
|
2060
|
-
canCoverAnchor:
|
|
2357
|
+
canCoverAnchor: Object(ssrWindow["a" /* getWindow */])().innerHeight < 500,
|
|
2061
2358
|
ref: function ref(c) {
|
|
2062
2359
|
_this2.dropdown = c;
|
|
2063
2360
|
},
|
|
@@ -2085,13 +2382,6 @@ _defineProperty(SelectBase_SelectBase, "invalidLinkAppearanceProps", ['append',
|
|
|
2085
2382
|
/* harmony default export */ var Select_SelectBase = __webpack_exports__["c"] = (SelectBase_SelectBase);
|
|
2086
2383
|
|
|
2087
2384
|
|
|
2088
|
-
/***/ }),
|
|
2089
|
-
|
|
2090
|
-
/***/ 5:
|
|
2091
|
-
/***/ (function(module, exports) {
|
|
2092
|
-
|
|
2093
|
-
module.exports = require("@splunk/ui-utils/i18n");
|
|
2094
|
-
|
|
2095
2385
|
/***/ }),
|
|
2096
2386
|
|
|
2097
2387
|
/***/ 6:
|
|
@@ -2119,6 +2409,13 @@ function SVG(props) {
|
|
|
2119
2409
|
|
|
2120
2410
|
/***/ }),
|
|
2121
2411
|
|
|
2412
|
+
/***/ 62:
|
|
2413
|
+
/***/ (function(module, exports) {
|
|
2414
|
+
|
|
2415
|
+
module.exports = require("lodash/castArray");
|
|
2416
|
+
|
|
2417
|
+
/***/ }),
|
|
2418
|
+
|
|
2122
2419
|
/***/ 7:
|
|
2123
2420
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
2124
2421
|
|