@splunk/react-ui 4.1.0 → 4.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Accordion.js +4 -4
- package/Anchor.js +2 -2
- package/Animation.js +26 -35
- package/AnimationToggle.js +2 -2
- package/Box.js +2 -2
- package/Button.js +22 -22
- package/ButtonGroup.js +2 -2
- package/ButtonSimple.js +12 -6
- package/CHANGELOG.md +69 -2
- package/Calendar.js +23 -23
- package/Card.js +15 -15
- package/CardLayout.js +2 -2
- package/Chip.js +13 -13
- package/Clickable.js +4 -4
- package/CloseButton.js +8 -8
- package/Code.js +1279 -1120
- package/CollapsiblePanel.js +11 -11
- package/Color.js +111 -172
- package/ColumnLayout.js +6 -6
- package/ComboBox.js +63 -30
- package/Concertina.js +2 -2
- package/ControlGroup.js +61 -20
- package/Date.js +66 -29
- package/DefinitionList.js +2 -2
- package/Dropdown.js +6 -6
- package/FetchOptions.js +8 -8
- package/File.js +87 -72
- package/FormRows.js +219 -331
- package/Heading.js +2 -2
- package/Image.js +15 -15
- package/JSONTree.js +63 -20
- package/Layer.js +8 -8
- package/Link.js +13 -13
- package/List.js +2 -2
- package/Markdown.js +19 -19
- package/Menu.js +315 -230
- package/Message.js +19 -19
- package/Modal.js +22 -11
- package/ModalLayer.js +25 -11
- package/Monogram.js +7 -7
- package/Multiselect.js +1931 -1057
- package/Number.js +40 -27
- package/Paginator.js +67 -49
- package/Paragraph.js +2 -2
- package/Popover.js +62 -35
- package/Progress.js +9 -21
- package/RadioBar.js +6 -6
- package/RadioList.js +2 -2
- package/ResultsMenu.js +18 -10
- package/ScreenReaderContent.js +2 -2
- package/Scroll.js +37 -19
- package/ScrollContainerContext.js +2 -2
- package/Select.js +1309 -562
- package/SidePanel.js +22 -17
- package/Slider.js +8 -8
- package/SlidingPanels.js +63 -47
- package/StaticContent.js +2 -2
- package/StepBar.js +8 -8
- package/Switch.js +20 -11
- package/TabBar.js +54 -40
- package/TabLayout.js +4 -4
- package/Table.js +148 -85
- package/Text.js +474 -356
- package/Tooltip.js +6 -6
- package/TransitionOpen.js +26 -24
- package/WaitSpinner.js +4 -4
- package/package.json +8 -7
- package/stubs-splunkui.d.ts +1 -0
- package/types/src/Accordion/Accordion.d.ts +2 -2
- package/types/src/Animation/Animation.d.ts +6 -5
- package/types/src/Button/Button.d.ts +2 -2
- package/types/src/ButtonSimple/ButtonSimple.d.ts +5 -5
- package/types/src/Calendar/DateTable.d.ts +1 -0
- package/types/src/Calendar/MonthHeader.d.ts +2 -2
- package/types/src/CollapsiblePanel/CollapsiblePanel.d.ts +1 -2
- package/types/src/Color/Color.d.ts +5 -4
- package/types/src/Color/Swatch.d.ts +4 -15
- package/types/src/ComboBox/ComboBox.d.ts +2 -2
- package/types/src/ControlGroup/ControlGroup.d.ts +7 -2
- package/types/src/ControlGroup/ControlGroupContext.d.ts +15 -0
- package/types/src/Date/Date.d.ts +7 -5
- package/types/src/Date/Icon.d.ts +1 -0
- package/types/src/Dropdown/Dropdown.d.ts +1 -1
- package/types/src/File/File.d.ts +2 -2
- package/types/src/File/FileContext.d.ts +9 -0
- package/types/src/File/Icon.d.ts +1 -0
- package/types/src/File/IconCloud.d.ts +1 -0
- package/types/src/File/Item.d.ts +5 -10
- package/types/src/File/PaperClip.d.ts +1 -0
- package/types/src/File/Retry.d.ts +1 -0
- package/types/src/File/Trash.d.ts +1 -0
- package/types/src/FormRows/FormRows.d.ts +11 -69
- package/types/src/FormRows/FormRowsContext.d.ts +9 -0
- package/types/src/FormRows/Row.d.ts +7 -20
- package/types/src/JSONTree/JSONTree.d.ts +14 -2
- package/types/src/JSONTree/TreeNode.d.ts +4 -1
- package/types/src/Menu/Divider.d.ts +1 -0
- package/types/src/Menu/Heading.d.ts +3 -1
- package/types/src/Menu/Item.d.ts +22 -6
- package/types/src/Menu/Menu.d.ts +17 -18
- package/types/src/Menu/MenuContext.d.ts +6 -0
- package/types/src/Menu/index.d.ts +1 -0
- package/types/src/Multiselect/Compact.d.ts +7 -26
- package/types/src/Multiselect/Multiselect.d.ts +7 -2
- package/types/src/Multiselect/Normal.d.ts +8 -2
- package/types/src/Multiselect/Option.d.ts +4 -1
- package/types/src/Number/IncrementIcon.d.ts +1 -0
- package/types/src/Number/Number.d.ts +4 -4
- package/types/src/Paginator/PageSeparator.d.ts +3 -0
- package/types/src/Popover/Popover.d.ts +5 -5
- package/types/src/Popover/PopoverContext.d.ts +6 -0
- package/types/src/Popover/index.d.ts +1 -0
- package/types/src/RadioBar/RadioBar.d.ts +5 -5
- package/types/src/RadioList/RadioListContext.d.ts +1 -0
- package/types/src/ResultsMenu/ResultsMenu.d.ts +4 -0
- package/types/src/Scroll/Inner.d.ts +4 -3
- package/types/src/Scroll/Scroll.d.ts +1 -1
- package/types/src/Select/Option.d.ts +2 -5
- package/types/src/Select/OptionBase.d.ts +94 -0
- package/types/src/Select/Select.d.ts +12 -37
- package/types/src/Select/SelectBase.d.ts +221 -0
- package/types/src/SidePanel/SidePanel.d.ts +4 -0
- package/types/src/Slider/Slider.d.ts +4 -4
- package/types/src/SlidingPanels/SlidingPanels.d.ts +0 -1
- package/types/src/Switch/CheckIcon.d.ts +1 -0
- package/types/src/Switch/Switch.d.ts +3 -7
- package/types/src/TabBar/Tab.d.ts +4 -1
- package/types/src/TabLayout/TabLayout.d.ts +2 -2
- package/types/src/Table/DragHandle.d.ts +1 -0
- package/types/src/Table/Head.d.ts +2 -0
- package/types/src/Table/HeadCell.d.ts +2 -2
- package/types/src/Table/HeadDropdownCell.d.ts +1 -1
- package/types/src/Table/HeadExpandRowsIcon.d.ts +1 -0
- package/types/src/Table/HeadInner.d.ts +3 -3
- package/types/src/Table/Table.d.ts +7 -3
- package/types/src/Table/Toggle.d.ts +1 -0
- package/types/src/Text/IconOutlinedHide.d.ts +1 -0
- package/types/src/Text/IconOutlinedView.d.ts +1 -0
- package/types/src/Text/Text.d.ts +28 -12
- package/types/src/Tooltip/InfoIcon.d.ts +1 -0
- package/types/src/Tooltip/Tooltip.d.ts +3 -3
- package/types/src/icons/Alert.d.ts +1 -0
- package/types/src/icons/AlertFilled.d.ts +1 -0
- package/types/src/icons/CaretDown.d.ts +1 -0
- package/types/src/icons/CaretRight.d.ts +1 -0
- package/types/src/icons/Check.d.ts +1 -0
- package/types/src/icons/ChevronDown.d.ts +1 -0
- package/types/src/icons/ChevronLeft.d.ts +1 -0
- package/types/src/icons/ChevronRight.d.ts +1 -0
- package/types/src/icons/CrossMark.d.ts +1 -0
- package/types/src/icons/External.d.ts +1 -0
- package/types/src/icons/InfoFilled.d.ts +1 -0
- package/types/src/icons/More.d.ts +1 -0
- package/types/src/icons/MoreVertical.d.ts +1 -0
- package/types/src/icons/Plus.d.ts +1 -0
- package/types/src/icons/SVG.d.ts +1 -0
- package/types/src/icons/Search.d.ts +1 -0
- package/types/src/icons/SortedDown.d.ts +1 -0
- package/types/src/icons/SortedUp.d.ts +1 -0
- package/types/src/icons/Success.d.ts +1 -0
- package/types/src/icons/SuccessFilled.d.ts +1 -0
- package/types/src/icons/WarningFilled.d.ts +1 -0
- package/types/src/utils/types.d.ts +1 -0
package/Multiselect.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 = 118);
|
|
86
86
|
/******/ })
|
|
87
87
|
/************************************************************************/
|
|
88
88
|
/******/ ({
|
|
@@ -108,7 +108,7 @@ module.exports = require("@splunk/ui-utils/id");
|
|
|
108
108
|
|
|
109
109
|
/***/ }),
|
|
110
110
|
|
|
111
|
-
/***/
|
|
111
|
+
/***/ 118:
|
|
112
112
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
113
113
|
|
|
114
114
|
"use strict";
|
|
@@ -138,30 +138,8 @@ var i18n_ = __webpack_require__(5);
|
|
|
138
138
|
// EXTERNAL MODULE: external "@splunk/react-ui/Menu"
|
|
139
139
|
var Menu_ = __webpack_require__(13);
|
|
140
140
|
|
|
141
|
-
// EXTERNAL MODULE:
|
|
142
|
-
var
|
|
143
|
-
|
|
144
|
-
// EXTERNAL MODULE: external "@splunk/ui-utils/id"
|
|
145
|
-
var id_ = __webpack_require__(10);
|
|
146
|
-
|
|
147
|
-
// EXTERNAL MODULE: external "@splunk/ui-utils/keyboard"
|
|
148
|
-
var keyboard_ = __webpack_require__(9);
|
|
149
|
-
|
|
150
|
-
// EXTERNAL MODULE: external "@splunk/react-ui/Dropdown"
|
|
151
|
-
var Dropdown_ = __webpack_require__(16);
|
|
152
|
-
var Dropdown_default = /*#__PURE__*/__webpack_require__.n(Dropdown_);
|
|
153
|
-
|
|
154
|
-
// EXTERNAL MODULE: external "@splunk/react-ui/Link"
|
|
155
|
-
var Link_ = __webpack_require__(32);
|
|
156
|
-
var Link_default = /*#__PURE__*/__webpack_require__.n(Link_);
|
|
157
|
-
|
|
158
|
-
// EXTERNAL MODULE: external "@splunk/react-ui/ResultsMenu"
|
|
159
|
-
var ResultsMenu_ = __webpack_require__(35);
|
|
160
|
-
var ResultsMenu_default = /*#__PURE__*/__webpack_require__.n(ResultsMenu_);
|
|
161
|
-
|
|
162
|
-
// EXTERNAL MODULE: external "@splunk/react-ui/Text"
|
|
163
|
-
var Text_ = __webpack_require__(24);
|
|
164
|
-
var Text_default = /*#__PURE__*/__webpack_require__.n(Text_);
|
|
141
|
+
// EXTERNAL MODULE: ./src/Select/OptionBase.tsx
|
|
142
|
+
var OptionBase = __webpack_require__(28);
|
|
165
143
|
|
|
166
144
|
// CONCATENATED MODULE: ./src/Multiselect/Option.tsx
|
|
167
145
|
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); }
|
|
@@ -259,19 +237,6 @@ var Option_Option = /*#__PURE__*/function (_PureComponent) {
|
|
|
259
237
|
|
|
260
238
|
_defineProperty(_assertThisInitialized(_this), "c", null);
|
|
261
239
|
|
|
262
|
-
_defineProperty(_assertThisInitialized(_this), "handleClick", function (e) {
|
|
263
|
-
var _this$props = _this.props,
|
|
264
|
-
onClick = _this$props.onClick,
|
|
265
|
-
value = _this$props.value,
|
|
266
|
-
disabled = _this$props.disabled;
|
|
267
|
-
|
|
268
|
-
if (!disabled) {
|
|
269
|
-
onClick === null || onClick === void 0 ? void 0 : onClick(e, {
|
|
270
|
-
value: value
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
});
|
|
274
|
-
|
|
275
240
|
_defineProperty(_assertThisInitialized(_this), "handleMount", function (c) {
|
|
276
241
|
_this.c = c;
|
|
277
242
|
});
|
|
@@ -286,31 +251,28 @@ var Option_Option = /*#__PURE__*/function (_PureComponent) {
|
|
|
286
251
|
|
|
287
252
|
(_this$c = this.c) === null || _this$c === void 0 ? void 0 : _this$c.scrollIntoViewIfNeeded();
|
|
288
253
|
}
|
|
254
|
+
/**
|
|
255
|
+
* Place focus on the button.
|
|
256
|
+
*/
|
|
257
|
+
|
|
258
|
+
}, {
|
|
259
|
+
key: "focus",
|
|
260
|
+
value: function focus() {
|
|
261
|
+
var _this$c2;
|
|
262
|
+
|
|
263
|
+
(_this$c2 = this.c) === null || _this$c2 === void 0 ? void 0 : _this$c2.focus();
|
|
264
|
+
}
|
|
289
265
|
}, {
|
|
290
266
|
key: "render",
|
|
291
267
|
value: function render() {
|
|
292
|
-
var _this$
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
compact = _this$props2.compact,
|
|
296
|
-
label = _this$props2.label,
|
|
297
|
-
otherProps = _objectWithoutProperties(_this$props2, ["value", "children", "compact", "label"]);
|
|
268
|
+
var _this$props = this.props,
|
|
269
|
+
compact = _this$props.compact,
|
|
270
|
+
otherProps = _objectWithoutProperties(_this$props, ["compact"]);
|
|
298
271
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
return /*#__PURE__*/external_react_default.a.createElement(Menu_["Item"], _extends({
|
|
302
|
-
"data-test-value": value,
|
|
303
|
-
"data-test": "option",
|
|
272
|
+
return /*#__PURE__*/external_react_default.a.createElement(OptionBase["a" /* default */], _extends({}, otherProps, {
|
|
273
|
+
multiple: compact,
|
|
304
274
|
ref: this.handleMount
|
|
305
|
-
},
|
|
306
|
-
onClick: this.handleClick,
|
|
307
|
-
selectable: compact,
|
|
308
|
-
selectableAppearance: compact ? 'checkbox' : undefined // ariaProps contains the required attributes
|
|
309
|
-
// eslint-disable-next-line jsx-a11y/role-has-required-aria-props
|
|
310
|
-
,
|
|
311
|
-
role: "option",
|
|
312
|
-
value: value.toString()
|
|
313
|
-
}, ariaProps), children || label);
|
|
275
|
+
}), this.props.children || this.props.label);
|
|
314
276
|
}
|
|
315
277
|
}]);
|
|
316
278
|
|
|
@@ -322,85 +284,17 @@ _defineProperty(Option_Option, "propTypes", propTypes);
|
|
|
322
284
|
_defineProperty(Option_Option, "defaultProps", defaultProps);
|
|
323
285
|
|
|
324
286
|
/* harmony default export */ var Multiselect_Option = (Option_Option);
|
|
325
|
-
// EXTERNAL MODULE:
|
|
326
|
-
var
|
|
327
|
-
var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_);
|
|
328
|
-
|
|
329
|
-
// EXTERNAL MODULE: external "@splunk/react-ui/Button"
|
|
330
|
-
var Button_ = __webpack_require__(17);
|
|
331
|
-
var Button_default = /*#__PURE__*/__webpack_require__.n(Button_);
|
|
332
|
-
|
|
333
|
-
// EXTERNAL MODULE: external "@splunk/themes"
|
|
334
|
-
var themes_ = __webpack_require__(0);
|
|
335
|
-
|
|
336
|
-
// CONCATENATED MODULE: ./src/Multiselect/CompactStyles.ts
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
var StyledButton = external_styled_components_default()(Button_default.a).withConfig({
|
|
341
|
-
displayName: "CompactStyles__StyledButton",
|
|
342
|
-
componentId: "sc-1ebm9az-0"
|
|
343
|
-
})(["&[data-inline]{width:400px;}"]);
|
|
344
|
-
var StyledFilter = external_styled_components_default.a.div.withConfig({
|
|
345
|
-
displayName: "CompactStyles__StyledFilter",
|
|
346
|
-
componentId: "sc-1ebm9az-1"
|
|
347
|
-
})(["padding:", ";min-width:160px;", ""], Object(themes_["pick"])({
|
|
348
|
-
enterprise: '8px',
|
|
349
|
-
prisma: '10px 16px'
|
|
350
|
-
}), Object(themes_["pickVariant"])('$placement', {
|
|
351
|
-
above: {
|
|
352
|
-
enterprise: Object(external_styled_components_["css"])(["border-top:", ";"], themes_["variables"].border),
|
|
353
|
-
prisma: Object(external_styled_components_["css"])(["border-top:1px solid ", ";"], themes_["variables"].neutral200)
|
|
354
|
-
},
|
|
355
|
-
below: {
|
|
356
|
-
enterprise: Object(external_styled_components_["css"])(["border-bottom:", ";"], themes_["variables"].border),
|
|
357
|
-
prisma: Object(external_styled_components_["css"])(["border-bottom:1px solid ", ";"], themes_["variables"].neutral200)
|
|
358
|
-
}
|
|
359
|
-
}));
|
|
360
|
-
var StyledCount = external_styled_components_default.a.span.withConfig({
|
|
361
|
-
displayName: "CompactStyles__StyledCount",
|
|
362
|
-
componentId: "sc-1ebm9az-2"
|
|
363
|
-
})(["padding-right:", ";"], Object(themes_["pick"])({
|
|
364
|
-
enterprise: themes_["variables"].spacingQuarter,
|
|
365
|
-
prisma: themes_["variables"].spacingXSmall
|
|
366
|
-
}));
|
|
367
|
-
var StyledToggleAllControls = external_styled_components_default.a.div.withConfig({
|
|
368
|
-
displayName: "CompactStyles__StyledToggleAllControls",
|
|
369
|
-
componentId: "sc-1ebm9az-3"
|
|
370
|
-
})(["padding:", ";", ""], Object(themes_["pick"])({
|
|
371
|
-
enterprise: "5px 8px",
|
|
372
|
-
prisma: '10px 16px'
|
|
373
|
-
}), Object(themes_["pickVariant"])('$placement', {
|
|
374
|
-
above: {
|
|
375
|
-
enterprise: Object(external_styled_components_["css"])(["border-top:", ";"], themes_["variables"].border),
|
|
376
|
-
prisma: Object(external_styled_components_["css"])(["border-top:1px solid ", ";"], themes_["variables"].neutral200)
|
|
377
|
-
},
|
|
378
|
-
below: {
|
|
379
|
-
enterprise: Object(external_styled_components_["css"])(["border-bottom:", ";"], themes_["variables"].border),
|
|
380
|
-
prisma: Object(external_styled_components_["css"])(["border-bottom:1px solid ", ";"], themes_["variables"].neutral200)
|
|
381
|
-
}
|
|
382
|
-
}));
|
|
287
|
+
// EXTERNAL MODULE: ./src/Select/SelectBase.tsx + 1 modules
|
|
288
|
+
var SelectBase = __webpack_require__(42);
|
|
383
289
|
|
|
384
290
|
// CONCATENATED MODULE: ./src/Multiselect/Compact.tsx
|
|
385
291
|
function Compact_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Compact_typeof = function _typeof(obj) { return typeof obj; }; } else { Compact_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Compact_typeof(obj); }
|
|
386
292
|
|
|
387
|
-
function Compact_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = Compact_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
388
|
-
|
|
389
|
-
function Compact_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
390
|
-
|
|
391
293
|
function Compact_extends() { Compact_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Compact_extends.apply(this, arguments); }
|
|
392
294
|
|
|
393
|
-
function
|
|
394
|
-
|
|
395
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
396
|
-
|
|
397
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
398
|
-
|
|
399
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
|
400
|
-
|
|
401
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
295
|
+
function Compact_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = Compact_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
402
296
|
|
|
403
|
-
function
|
|
297
|
+
function Compact_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
404
298
|
|
|
405
299
|
function Compact_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
406
300
|
|
|
@@ -431,13 +325,6 @@ function Compact_defineProperty(obj, key, value) { if (key in obj) { Object.defi
|
|
|
431
325
|
|
|
432
326
|
|
|
433
327
|
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
328
|
var Compact_propTypes = {
|
|
442
329
|
allowNewValues: external_prop_types_default.a.bool,
|
|
443
330
|
animateLoading: external_prop_types_default.a.bool,
|
|
@@ -451,6 +338,7 @@ var Compact_propTypes = {
|
|
|
451
338
|
error: external_prop_types_default.a.bool,
|
|
452
339
|
footerMessage: external_prop_types_default.a.node,
|
|
453
340
|
inline: external_prop_types_default.a.bool,
|
|
341
|
+
inputId: external_prop_types_default.a.string,
|
|
454
342
|
inputRef: external_prop_types_default.a.oneOfType([external_prop_types_default.a.func, external_prop_types_default.a.object]),
|
|
455
343
|
isLoadingOptions: external_prop_types_default.a.bool,
|
|
456
344
|
labelledBy: external_prop_types_default.a.string,
|
|
@@ -480,702 +368,230 @@ var Compact_defaultProps = {
|
|
|
480
368
|
tabConfirmsNewValue: false
|
|
481
369
|
}; // TS: not typed controlled/uncontrolled, handled by Multiselect wrapper component
|
|
482
370
|
|
|
483
|
-
function isOption(child) {
|
|
484
|
-
return child && Object(external_lodash_["has"])(child.props, 'value');
|
|
485
|
-
}
|
|
486
|
-
|
|
487
371
|
var Compact_Compact = /*#__PURE__*/function (_Component) {
|
|
488
372
|
Compact_inherits(Compact, _Component);
|
|
489
373
|
|
|
490
374
|
var _super = Compact_createSuper(Compact);
|
|
491
375
|
|
|
492
|
-
|
|
493
|
-
function Compact(props) {
|
|
494
|
-
var _this;
|
|
495
|
-
|
|
376
|
+
function Compact() {
|
|
496
377
|
Compact_classCallCheck(this, Compact);
|
|
497
378
|
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
Compact_defineProperty(Compact_assertThisInitialized(_this), "controlledExternally", void 0);
|
|
501
|
-
|
|
502
|
-
Compact_defineProperty(Compact_assertThisInitialized(_this), "activeItemId", void 0);
|
|
503
|
-
|
|
504
|
-
Compact_defineProperty(Compact_assertThisInitialized(_this), "displayedValues", void 0);
|
|
505
|
-
|
|
506
|
-
Compact_defineProperty(Compact_assertThisInitialized(_this), "activeValue", void 0);
|
|
507
|
-
|
|
508
|
-
Compact_defineProperty(Compact_assertThisInitialized(_this), "availableOptionCount", void 0);
|
|
509
|
-
|
|
510
|
-
Compact_defineProperty(Compact_assertThisInitialized(_this), "selectedOptionCount", void 0);
|
|
511
|
-
|
|
512
|
-
Compact_defineProperty(Compact_assertThisInitialized(_this), "handleSelectAll", function (e) {
|
|
513
|
-
var _this$getCurrentValue, _this$props$onChange, _this$props2;
|
|
379
|
+
return _super.apply(this, arguments);
|
|
380
|
+
}
|
|
514
381
|
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
382
|
+
Compact_createClass(Compact, [{
|
|
383
|
+
key: "render",
|
|
384
|
+
// @docs-props-type CompactPropsBase
|
|
385
|
+
value: function render() {
|
|
386
|
+
var _this$props = this.props,
|
|
387
|
+
defaultValues = _this$props.defaultValues,
|
|
388
|
+
children = _this$props.children,
|
|
389
|
+
controlledFilter = _this$props.controlledFilter,
|
|
390
|
+
values = _this$props.values,
|
|
391
|
+
otherProps = Compact_objectWithoutProperties(_this$props, ["defaultValues", "children", "controlledFilter", "values"]);
|
|
392
|
+
|
|
393
|
+
var convertedProps = {
|
|
394
|
+
children: external_react_["Children"].toArray(children).map(function (item) {
|
|
395
|
+
if (Object(SelectBase["d" /* isOption */])(item)) {
|
|
396
|
+
return /*#__PURE__*/external_react_default.a.createElement(OptionBase["a" /* default */], Compact_extends({}, item.props, {
|
|
397
|
+
multiple: true
|
|
398
|
+
}));
|
|
399
|
+
}
|
|
519
400
|
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
return child.props.value;
|
|
525
|
-
});
|
|
401
|
+
return item;
|
|
402
|
+
}),
|
|
403
|
+
filter: controlledFilter ? 'controlled' : true
|
|
404
|
+
};
|
|
526
405
|
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
});
|
|
406
|
+
if (defaultValues != null) {
|
|
407
|
+
convertedProps.defaultValues = defaultValues;
|
|
530
408
|
}
|
|
531
409
|
|
|
532
|
-
|
|
533
|
-
values
|
|
534
|
-
|
|
535
|
-
});
|
|
536
|
-
});
|
|
410
|
+
if (values != null) {
|
|
411
|
+
convertedProps.values = values;
|
|
412
|
+
}
|
|
537
413
|
|
|
538
|
-
|
|
539
|
-
|
|
414
|
+
return /*#__PURE__*/external_react_default.a.createElement(SelectBase["c" /* default */], Compact_extends({}, otherProps, convertedProps, {
|
|
415
|
+
multiple: true
|
|
416
|
+
}));
|
|
417
|
+
}
|
|
418
|
+
}]);
|
|
540
419
|
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
var name = _this.props.name;
|
|
420
|
+
return Compact;
|
|
421
|
+
}(external_react_["Component"]);
|
|
544
422
|
|
|
545
|
-
|
|
546
|
-
_this.setState({
|
|
547
|
-
values: values
|
|
548
|
-
});
|
|
549
|
-
}
|
|
423
|
+
Compact_defineProperty(Compact_Compact, "propTypes", Compact_propTypes);
|
|
550
424
|
|
|
551
|
-
|
|
552
|
-
values: values,
|
|
553
|
-
name: name
|
|
554
|
-
});
|
|
555
|
-
});
|
|
425
|
+
Compact_defineProperty(Compact_Compact, "defaultProps", Compact_defaultProps);
|
|
556
426
|
|
|
557
|
-
|
|
558
|
-
var _this$props4 = _this.props,
|
|
559
|
-
children = _this$props4.children,
|
|
560
|
-
onScrollBottom = _this$props4.onScrollBottom,
|
|
561
|
-
tabConfirmsNewValue = _this$props4.tabConfirmsNewValue;
|
|
562
|
-
var eventKeyCode = Object(keyboard_["keycode"])(e.nativeEvent);
|
|
427
|
+
Compact_defineProperty(Compact_Compact, "Option", Multiselect_Option);
|
|
563
428
|
|
|
564
|
-
|
|
565
|
-
e.preventDefault();
|
|
429
|
+
Compact_defineProperty(Compact_Compact, "Divider", Menu_["Divider"]);
|
|
566
430
|
|
|
567
|
-
|
|
568
|
-
_this.toggleValue(e, _this.activeValue);
|
|
569
|
-
}
|
|
570
|
-
}
|
|
431
|
+
Compact_defineProperty(Compact_Compact, "Heading", Menu_["Heading"]);
|
|
571
432
|
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
433
|
+
/* harmony default export */ var Multiselect_Compact = (Compact_Compact);
|
|
434
|
+
// EXTERNAL MODULE: external "@splunk/ui-utils/filter"
|
|
435
|
+
var filter_ = __webpack_require__(23);
|
|
575
436
|
|
|
576
|
-
|
|
577
|
-
|
|
437
|
+
// EXTERNAL MODULE: external "@splunk/ui-utils/id"
|
|
438
|
+
var id_ = __webpack_require__(10);
|
|
578
439
|
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
activeIndex: Math.min(state.activeIndex + 1, _this.availableOptionCount - 1)
|
|
582
|
-
};
|
|
583
|
-
});
|
|
440
|
+
// EXTERNAL MODULE: external "@splunk/ui-utils/keyboard"
|
|
441
|
+
var keyboard_ = __webpack_require__(9);
|
|
584
442
|
|
|
585
|
-
|
|
586
|
-
|
|
443
|
+
// EXTERNAL MODULE: external "@splunk/react-ui/Chip"
|
|
444
|
+
var Chip_ = __webpack_require__(89);
|
|
445
|
+
var Chip_default = /*#__PURE__*/__webpack_require__.n(Chip_);
|
|
587
446
|
|
|
588
|
-
|
|
447
|
+
// EXTERNAL MODULE: external "@splunk/react-ui/ResultsMenu"
|
|
448
|
+
var ResultsMenu_ = __webpack_require__(39);
|
|
449
|
+
var ResultsMenu_default = /*#__PURE__*/__webpack_require__.n(ResultsMenu_);
|
|
589
450
|
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
}
|
|
594
|
-
}
|
|
451
|
+
// EXTERNAL MODULE: external "@splunk/react-ui/Popover"
|
|
452
|
+
var Popover_ = __webpack_require__(17);
|
|
453
|
+
var Popover_default = /*#__PURE__*/__webpack_require__.n(Popover_);
|
|
595
454
|
|
|
596
|
-
|
|
597
|
-
|
|
455
|
+
// EXTERNAL MODULE: external "@splunk/react-ui/ScreenReaderContent"
|
|
456
|
+
var ScreenReaderContent_ = __webpack_require__(14);
|
|
457
|
+
var ScreenReaderContent_default = /*#__PURE__*/__webpack_require__.n(ScreenReaderContent_);
|
|
598
458
|
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
};
|
|
603
|
-
});
|
|
604
|
-
}
|
|
459
|
+
// EXTERNAL MODULE: external "styled-components"
|
|
460
|
+
var external_styled_components_ = __webpack_require__(3);
|
|
461
|
+
var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_);
|
|
605
462
|
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
});
|
|
463
|
+
// EXTERNAL MODULE: external "@splunk/react-ui/Box"
|
|
464
|
+
var Box_ = __webpack_require__(8);
|
|
465
|
+
var Box_default = /*#__PURE__*/__webpack_require__.n(Box_);
|
|
610
466
|
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
e.preventDefault();
|
|
467
|
+
// EXTERNAL MODULE: external "@splunk/themes"
|
|
468
|
+
var themes_ = __webpack_require__(0);
|
|
614
469
|
|
|
615
|
-
|
|
616
|
-
});
|
|
470
|
+
// CONCATENATED MODULE: ./src/Multiselect/NormalStyles.ts
|
|
617
471
|
|
|
618
|
-
Compact_defineProperty(Compact_assertThisInitialized(_this), "handleTextChange", function (e, _ref2) {
|
|
619
|
-
var _this$props$onFilterC, _this$props5;
|
|
620
472
|
|
|
621
|
-
var value = _ref2.value;
|
|
622
473
|
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
474
|
+
var StyledBox = external_styled_components_default()(Box_default.a).withConfig({
|
|
475
|
+
displayName: "NormalStyles__StyledBox",
|
|
476
|
+
componentId: "sc-1uwwpco-0"
|
|
477
|
+
})(["border-radius:", ";align-items:flex-start;flex-wrap:wrap;min-height:", ";max-height:300px;overflow-y:auto;border:1px solid ", ";padding:", ";", " ", " ", " ", " ", " &[data-inline]{width:400px;}[data-inline='true'] + &{margin-left:", "}"], themes_["variables"].borderRadius, themes_["variables"].inputHeight, Object(themes_["pick"])({
|
|
478
|
+
enterprise: {
|
|
479
|
+
light: themes_["variables"].gray60,
|
|
480
|
+
dark: themes_["variables"].borderColor
|
|
481
|
+
},
|
|
482
|
+
prisma: themes_["variables"].interactiveColorBorder
|
|
483
|
+
}), Object(themes_["pick"])({
|
|
484
|
+
enterprise: '2px 0 0 2px',
|
|
485
|
+
prisma: '2px'
|
|
486
|
+
}), Object(themes_["pick"])({
|
|
487
|
+
enterprise: {
|
|
488
|
+
light: Object(external_styled_components_["css"])(["background-color:", ";"], themes_["variables"].white),
|
|
489
|
+
dark: Object(external_styled_components_["css"])(["background-color:", ";"], themes_["variables"].gray22)
|
|
490
|
+
}
|
|
491
|
+
}), function (_ref) {
|
|
492
|
+
var $hasfocus = _ref.$hasfocus;
|
|
493
|
+
return $hasfocus && Object(themes_["pick"])({
|
|
494
|
+
enterprise: Object(external_styled_components_["css"])(["box-shadow:", ";"], themes_["variables"].focusShadow),
|
|
495
|
+
prisma: Object(external_styled_components_["css"])(["border-color:", ";"], themes_["variables"].focusColor)
|
|
496
|
+
});
|
|
497
|
+
}, function (_ref2) {
|
|
498
|
+
var $error = _ref2.$error;
|
|
499
|
+
return $error && Object(external_styled_components_["css"])(["border-color:", ";color:", ";"], themes_["variables"].accentColorNegative, themes_["variables"].accentColorNegative);
|
|
500
|
+
}, function (_ref3) {
|
|
501
|
+
var $disabled = _ref3.$disabled,
|
|
502
|
+
$hasfocus = _ref3.$hasfocus;
|
|
503
|
+
return $disabled ? Object(themes_["pick"])({
|
|
504
|
+
enterprise: {
|
|
505
|
+
light: Object(external_styled_components_["css"])(["background-color:", ";cursor:not-allowed;"], themes_["variables"].gray96),
|
|
506
|
+
dark: Object(external_styled_components_["css"])(["background-color:", ";border-color:", ";cursor:not-allowed;"], themes_["variables"].gray22, themes_["variables"].gray30)
|
|
507
|
+
},
|
|
508
|
+
prisma: Object(external_styled_components_["css"])(["border-color:", ";cursor:not-allowed;"], themes_["variables"].interactiveColorBorderDisabled)
|
|
509
|
+
}) : !$hasfocus && Object(external_styled_components_["css"])(["&:hover{border-color:", ";}"], Object(themes_["pick"])({
|
|
510
|
+
enterprise: themes_["variables"].borderColor,
|
|
511
|
+
prisma: themes_["variables"].interactiveColorBorderHover
|
|
512
|
+
}));
|
|
513
|
+
}, function (_ref4) {
|
|
514
|
+
var $popoverOpen = _ref4.$popoverOpen;
|
|
515
|
+
return $popoverOpen && Object(external_styled_components_["css"])(["position:relative;z-index:calc(", " - 2);"], themes_["variables"].zindexFixedNavbar);
|
|
516
|
+
}, Object(themes_["pick"])({
|
|
517
|
+
enterprise: themes_["variables"].spacingHalf,
|
|
518
|
+
prisma: themes_["variables"].spacingSmall
|
|
519
|
+
}));
|
|
520
|
+
var StyledInputWrapper = external_styled_components_default.a.div.withConfig({
|
|
521
|
+
displayName: "NormalStyles__StyledInputWrapper",
|
|
522
|
+
componentId: "sc-1uwwpco-1"
|
|
523
|
+
})(["flex:1 0 auto;max-width:100%;"]);
|
|
524
|
+
var StyledInput = external_styled_components_default.a.input.withConfig({
|
|
525
|
+
displayName: "NormalStyles__StyledInput",
|
|
526
|
+
componentId: "sc-1uwwpco-2"
|
|
527
|
+
})(["", ";min-width:100%;max-width:100%;line-height:12px;", ""], themes_["mixins"].reset('block'), Object(themes_["pick"])({
|
|
528
|
+
enterprise: {
|
|
529
|
+
comfortable: Object(external_styled_components_["css"])(["padding:", ";"], themes_["variables"].spacingQuarter),
|
|
530
|
+
compact: Object(external_styled_components_["css"])(["padding:3px;"])
|
|
531
|
+
},
|
|
532
|
+
prisma: {
|
|
533
|
+
comfortable: Object(external_styled_components_["css"])(["padding:7px 10px;"]),
|
|
534
|
+
compact: Object(external_styled_components_["css"])(["padding:3px;"])
|
|
535
|
+
}
|
|
536
|
+
}));
|
|
537
|
+
var StyledOverlay = external_styled_components_default.a.div.withConfig({
|
|
538
|
+
displayName: "NormalStyles__StyledOverlay",
|
|
539
|
+
componentId: "sc-1uwwpco-3"
|
|
540
|
+
})(["", ""], function (_ref5) {
|
|
541
|
+
var $popoveropen = _ref5.$popoveropen;
|
|
542
|
+
return $popoveropen && Object(external_styled_components_["css"])(["position:fixed;top:0;left:0;width:100%;height:100%;z-index:calc(", " - 2);"], themes_["variables"].zindexFixedNavbar);
|
|
543
|
+
});
|
|
656
544
|
|
|
657
|
-
|
|
658
|
-
|
|
545
|
+
// EXTERNAL MODULE: ./src/utils/updateReactRef.ts
|
|
546
|
+
var updateReactRef = __webpack_require__(12);
|
|
659
547
|
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
});
|
|
663
|
-
});
|
|
548
|
+
// CONCATENATED MODULE: ./src/Multiselect/Normal.tsx
|
|
549
|
+
function Normal_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Normal_typeof = function _typeof(obj) { return typeof obj; }; } else { Normal_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Normal_typeof(obj); }
|
|
664
550
|
|
|
665
|
-
|
|
666
|
-
_this.setState({
|
|
667
|
-
open: false
|
|
668
|
-
}, function () {
|
|
669
|
-
var _this$props$onClose, _this$props8;
|
|
551
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
670
552
|
|
|
671
|
-
|
|
672
|
-
});
|
|
673
|
-
});
|
|
553
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
674
554
|
|
|
675
|
-
|
|
676
|
-
if (_this.state.open && !_this.props.isLoadingOptions) {
|
|
677
|
-
var _this$props$onScrollB, _this$props9;
|
|
555
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
678
556
|
|
|
679
|
-
|
|
680
|
-
}
|
|
681
|
-
});
|
|
557
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
|
682
558
|
|
|
683
|
-
|
|
684
|
-
c === null || c === void 0 ? void 0 : c.scrollIntoViewIfNeeded();
|
|
685
|
-
});
|
|
559
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
686
560
|
|
|
687
|
-
|
|
688
|
-
var anchorWidth = _ref3.anchorWidth,
|
|
689
|
-
maxHeight = _ref3.maxHeight,
|
|
690
|
-
placement = _ref3.placement;
|
|
691
|
-
var _this$state = _this.state,
|
|
692
|
-
filterKeyword = _this$state.filterKeyword,
|
|
693
|
-
textHasFocus = _this$state.textHasFocus,
|
|
694
|
-
topValues = _this$state.topValues;
|
|
695
|
-
var _this$props10 = _this.props,
|
|
696
|
-
allowNewValues = _this$props10.allowNewValues,
|
|
697
|
-
controlledFilter = _this$props10.controlledFilter;
|
|
561
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
698
562
|
|
|
699
|
-
|
|
563
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
700
564
|
|
|
701
|
-
|
|
702
|
-
_this.selectedOptionCount = 0;
|
|
703
|
-
_this.activeValue = undefined;
|
|
704
|
-
var foundExactMatch;
|
|
705
|
-
var childrenTopCount = 0;
|
|
706
|
-
var children = external_react_["Children"].toArray(_this.props.children).reduce(function (acc, item, i) {
|
|
707
|
-
// ignore Headings and Dividers
|
|
708
|
-
if (!isOption(item)) {
|
|
709
|
-
acc.push(item);
|
|
710
|
-
return acc;
|
|
711
|
-
} // Find out if the search string exactly matches a value
|
|
565
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Normal_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
712
566
|
|
|
567
|
+
function Normal_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = Normal_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
713
568
|
|
|
714
|
-
|
|
715
|
-
foundExactMatch = true;
|
|
716
|
-
} // Format the Menu.Item
|
|
569
|
+
function Normal_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
717
570
|
|
|
571
|
+
function Normal_extends() { Normal_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Normal_extends.apply(this, arguments); }
|
|
718
572
|
|
|
719
|
-
|
|
720
|
-
key: item.key || i,
|
|
721
|
-
onClick: _this.handleMenuOptionClick,
|
|
722
|
-
selected: currentValues && currentValues.indexOf(item.props.value) >= 0,
|
|
723
|
-
compact: true,
|
|
724
|
-
role: 'option'
|
|
725
|
-
}); // Move previously selected items to the top section
|
|
573
|
+
function Normal_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
726
574
|
|
|
727
|
-
|
|
728
|
-
if (childrenTopCount === 0) {
|
|
729
|
-
acc.splice(childrenTopCount, 0, /*#__PURE__*/external_react_default.a.createElement(Menu_["Divider"], {
|
|
730
|
-
key: "topDivider"
|
|
731
|
-
}));
|
|
732
|
-
}
|
|
575
|
+
function Normal_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
733
576
|
|
|
734
|
-
|
|
735
|
-
childrenTopCount += 1;
|
|
736
|
-
} else {
|
|
737
|
-
acc.push(clonedItem);
|
|
738
|
-
}
|
|
577
|
+
function Normal_createClass(Constructor, protoProps, staticProps) { if (protoProps) Normal_defineProperties(Constructor.prototype, protoProps); if (staticProps) Normal_defineProperties(Constructor, staticProps); return Constructor; }
|
|
739
578
|
|
|
740
|
-
|
|
741
|
-
}, []); // Add missing items
|
|
579
|
+
function Normal_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) Normal_setPrototypeOf(subClass, superClass); }
|
|
742
580
|
|
|
743
|
-
|
|
744
|
-
var matchedItem = Object(external_lodash_["find"])(children, function (item) {
|
|
745
|
-
return isOption(item) && item.props && item.props.value === value;
|
|
746
|
-
});
|
|
581
|
+
function Normal_setPrototypeOf(o, p) { Normal_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Normal_setPrototypeOf(o, p); }
|
|
747
582
|
|
|
748
|
-
|
|
749
|
-
if (value === _this.state.filterKeyword) {
|
|
750
|
-
foundExactMatch = true;
|
|
751
|
-
}
|
|
583
|
+
function Normal_createSuper(Derived) { var hasNativeReflectConstruct = Normal_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Normal_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Normal_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Normal_possibleConstructorReturn(this, result); }; }
|
|
752
584
|
|
|
753
|
-
|
|
754
|
-
children.splice(isTopValue ? 0 : childrenTopCount + 1, 0, /*#__PURE__*/external_react_default.a.createElement(Multiselect_Option, {
|
|
755
|
-
label: String(value),
|
|
756
|
-
value: value,
|
|
757
|
-
key: "missing-value-".concat(value),
|
|
758
|
-
onClick: _this.handleMenuOptionClick,
|
|
759
|
-
compact: true,
|
|
760
|
-
selected: true
|
|
761
|
-
}));
|
|
762
|
-
|
|
763
|
-
if (isTopValue) {
|
|
764
|
-
childrenTopCount += 1;
|
|
765
|
-
}
|
|
766
|
-
}
|
|
767
|
-
}); // Filter the items
|
|
585
|
+
function Normal_possibleConstructorReturn(self, call) { if (call && (Normal_typeof(call) === "object" || typeof call === "function")) { return call; } return Normal_assertThisInitialized(self); }
|
|
768
586
|
|
|
769
|
-
|
|
770
|
-
children = controlledFilter ? children : children.filter(function (option) {
|
|
771
|
-
if (isOption(option)) {
|
|
772
|
-
return Object(filter_["testPhrase"])(option.props.label, keywords);
|
|
773
|
-
}
|
|
587
|
+
function Normal_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
774
588
|
|
|
775
|
-
|
|
776
|
-
}) // highlight the matched text
|
|
777
|
-
.map(function (option) {
|
|
778
|
-
if (!isOption(option)) {
|
|
779
|
-
return option;
|
|
780
|
-
} // highlight matched text
|
|
589
|
+
function Normal_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
781
590
|
|
|
591
|
+
function Normal_getPrototypeOf(o) { Normal_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Normal_getPrototypeOf(o); }
|
|
782
592
|
|
|
783
|
-
|
|
784
|
-
return /*#__PURE__*/Object(external_react_["cloneElement"])(option, {
|
|
785
|
-
matchRanges: matchRanges || undefined
|
|
786
|
-
});
|
|
787
|
-
}); // Add the option to add the new value
|
|
593
|
+
function Normal_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
788
594
|
|
|
789
|
-
if (allowNewValues && !foundExactMatch && filterKeyword) {
|
|
790
|
-
children.splice(childrenTopCount, 0, /*#__PURE__*/external_react_default.a.createElement(Multiselect_Option, {
|
|
791
|
-
label: "".concat(filterKeyword, " (new value)"),
|
|
792
|
-
value: filterKeyword,
|
|
793
|
-
key: "newValue",
|
|
794
|
-
compact: true,
|
|
795
|
-
onClick: _this.handleMenuOptionClick
|
|
796
|
-
}));
|
|
797
|
-
} // Highlight the selected Items and remove hidden
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
children = children.reduce(function (acc, item) {
|
|
801
|
-
// ignore Dividers & Headings
|
|
802
|
-
if (!isOption(item)) {
|
|
803
|
-
acc.push(item);
|
|
804
|
-
return acc;
|
|
805
|
-
} // Ignore any hidden items
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
if (item.props && item.props.hidden) {
|
|
809
|
-
return acc;
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
var active = _this.availableOptionCount === _this.state.activeIndex;
|
|
813
|
-
_this.availableOptionCount += 1;
|
|
814
|
-
_this.selectedOptionCount += item.props.selected ? 1 : 0;
|
|
815
|
-
|
|
816
|
-
if (!active || !textHasFocus) {
|
|
817
|
-
acc.push(item);
|
|
818
|
-
return acc;
|
|
819
|
-
}
|
|
820
|
-
|
|
821
|
-
if (!item.props.disabled) {
|
|
822
|
-
_this.activeValue = item.props.value;
|
|
823
|
-
}
|
|
824
|
-
|
|
825
|
-
var clonedItem = /*#__PURE__*/Object(external_react_["cloneElement"])(item, {
|
|
826
|
-
active: active,
|
|
827
|
-
id: _this.activeItemId,
|
|
828
|
-
ref: _this.handleActiveOptionMount
|
|
829
|
-
});
|
|
830
|
-
acc.push(clonedItem);
|
|
831
|
-
return acc;
|
|
832
|
-
}, []);
|
|
833
|
-
_this.displayedValues = children.reduce(function (acc, item) {
|
|
834
|
-
if (isOption(item)) {
|
|
835
|
-
acc.push(item.props.value);
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
return acc;
|
|
839
|
-
}, []);
|
|
840
|
-
return /*#__PURE__*/external_react_default.a.createElement(ResultsMenu_default.a, Compact_extends({
|
|
841
|
-
childrenStart: _this.renderControls({
|
|
842
|
-
placement: placement,
|
|
843
|
-
hasChildren: !!children.length
|
|
844
|
-
}),
|
|
845
|
-
placement: placement !== null && placement !== void 0 ? placement : undefined,
|
|
846
|
-
maxHeight: maxHeight !== null && maxHeight !== void 0 ? maxHeight : undefined,
|
|
847
|
-
onScrollBottom: _this.props.onScrollBottom ? _this.handleScrollBottom : undefined,
|
|
848
|
-
"data-test": "results-menu",
|
|
849
|
-
isLoading: _this.props.isLoadingOptions
|
|
850
|
-
}, Object(external_lodash_["pick"])(_this.props, 'noOptionsMessage', 'footerMessage', 'animateLoading', 'loadingMessage'), {
|
|
851
|
-
style: Object(external_lodash_["extend"])({
|
|
852
|
-
width: Math.max(anchorWidth !== null && anchorWidth !== void 0 ? anchorWidth : 0, 200)
|
|
853
|
-
}, _this.props.menuStyle)
|
|
854
|
-
}), children);
|
|
855
|
-
});
|
|
856
|
-
|
|
857
|
-
_this.state = {
|
|
858
|
-
activeIndex: 0,
|
|
859
|
-
filterKeyword: '',
|
|
860
|
-
open: false,
|
|
861
|
-
textHasFocus: false,
|
|
862
|
-
topValues: [],
|
|
863
|
-
values: props.defaultValues || []
|
|
864
|
-
};
|
|
865
|
-
_this.controlledExternally = Object(external_lodash_["has"])(props, 'values');
|
|
866
|
-
_this.displayedValues = [];
|
|
867
|
-
_this.availableOptionCount = 0;
|
|
868
|
-
_this.selectedOptionCount = 0;
|
|
869
|
-
|
|
870
|
-
if (false) {}
|
|
871
|
-
|
|
872
|
-
if (false) {}
|
|
873
|
-
|
|
874
|
-
_this.activeItemId = Object(id_["createDOMID"])('active-item');
|
|
875
|
-
return _this;
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
Compact_createClass(Compact, [{
|
|
879
|
-
key: "componentDidUpdate",
|
|
880
|
-
value: function componentDidUpdate(prevProps) {
|
|
881
|
-
if (false) {}
|
|
882
|
-
|
|
883
|
-
if (false) {}
|
|
884
|
-
}
|
|
885
|
-
}, {
|
|
886
|
-
key: "getCurrentValues",
|
|
887
|
-
value: function getCurrentValues() {
|
|
888
|
-
return this.isControlled() ? this.props.values : this.state.values;
|
|
889
|
-
}
|
|
890
|
-
}, {
|
|
891
|
-
key: "isControlled",
|
|
892
|
-
value: function isControlled() {
|
|
893
|
-
return this.controlledExternally;
|
|
894
|
-
}
|
|
895
|
-
}, {
|
|
896
|
-
key: "toggleValue",
|
|
897
|
-
value: function toggleValue(e, value) {
|
|
898
|
-
var _this$getCurrentValue4, _this$props$onChange3, _this$props11;
|
|
899
|
-
|
|
900
|
-
var values = (_this$getCurrentValue4 = this.getCurrentValues()) !== null && _this$getCurrentValue4 !== void 0 ? _this$getCurrentValue4 : [];
|
|
901
|
-
var currentIndex = values.indexOf(value);
|
|
902
|
-
var name = this.props.name;
|
|
903
|
-
var newValues;
|
|
904
|
-
|
|
905
|
-
if (currentIndex >= 0) {
|
|
906
|
-
newValues = [].concat(_toConsumableArray(values.slice(0, currentIndex)), _toConsumableArray(values.slice(currentIndex + 1)));
|
|
907
|
-
} else {
|
|
908
|
-
newValues = values.concat([value]);
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
if (!this.isControlled()) {
|
|
912
|
-
this.setState({
|
|
913
|
-
values: newValues,
|
|
914
|
-
open: true
|
|
915
|
-
});
|
|
916
|
-
}
|
|
917
|
-
|
|
918
|
-
(_this$props$onChange3 = (_this$props11 = this.props).onChange) === null || _this$props$onChange3 === void 0 ? void 0 : _this$props$onChange3.call(_this$props11, e, {
|
|
919
|
-
values: newValues,
|
|
920
|
-
name: name
|
|
921
|
-
});
|
|
922
|
-
}
|
|
923
|
-
}, {
|
|
924
|
-
key: "renderControls",
|
|
925
|
-
value: function renderControls(_ref4) {
|
|
926
|
-
var hasChildren = _ref4.hasChildren,
|
|
927
|
-
placement = _ref4.placement;
|
|
928
|
-
var selectControls = /*#__PURE__*/external_react_default.a.createElement(StyledToggleAllControls, {
|
|
929
|
-
$placement: placement,
|
|
930
|
-
key: "selectAll"
|
|
931
|
-
}, /*#__PURE__*/external_react_default.a.createElement(Link_default.a, {
|
|
932
|
-
onClick: this.handleSelectAll,
|
|
933
|
-
disabled: !(this.availableOptionCount - this.selectedOptionCount),
|
|
934
|
-
"data-test": "select-all",
|
|
935
|
-
style: {
|
|
936
|
-
marginRight: 20
|
|
937
|
-
}
|
|
938
|
-
}, this.state.filterKeyword ? Object(i18n_["_"])('Select All Matches') : Object(i18n_["_"])('Select All')), /*#__PURE__*/external_react_default.a.createElement(Link_default.a, {
|
|
939
|
-
onClick: this.handleClearAll,
|
|
940
|
-
disabled: !this.selectedOptionCount,
|
|
941
|
-
"data-test": "clear-all"
|
|
942
|
-
}, this.state.filterKeyword ? Object(i18n_["_"])('Clear All Matches') : Object(i18n_["_"])('Clear All')));
|
|
943
|
-
/* eslint-disable jsx-a11y/tabindex-no-positive */
|
|
944
|
-
|
|
945
|
-
return /*#__PURE__*/external_react_default.a.createElement("div", {
|
|
946
|
-
key: "controls"
|
|
947
|
-
}, placement === 'above' && hasChildren && selectControls, /*#__PURE__*/external_react_default.a.createElement(StyledFilter, {
|
|
948
|
-
key: "filter",
|
|
949
|
-
"data-test": "filter",
|
|
950
|
-
$placement: placement
|
|
951
|
-
}, /*#__PURE__*/external_react_default.a.createElement(Text_default.a, {
|
|
952
|
-
value: this.state.filterKeyword,
|
|
953
|
-
appearance: "search",
|
|
954
|
-
autoCapitalize: "off",
|
|
955
|
-
autoComplete: "off",
|
|
956
|
-
autoCorrect: "off",
|
|
957
|
-
spellCheck: false,
|
|
958
|
-
onChange: this.handleTextChange,
|
|
959
|
-
onKeyDown: this.handleTextKeyDown,
|
|
960
|
-
onFocus: this.handleTextFocus,
|
|
961
|
-
onBlur: this.handleTextBlur,
|
|
962
|
-
placeholder: Object(i18n_["_"])('filter'),
|
|
963
|
-
tabIndex: 1,
|
|
964
|
-
"aria-label": Object(i18n_["_"])('Filter'),
|
|
965
|
-
"aria-activedescendant": this.activeItemId,
|
|
966
|
-
inputRef: this.props.inputRef
|
|
967
|
-
})), placement !== 'above' && hasChildren && selectControls);
|
|
968
|
-
/* eslint-enable jsx-a11y/tabindex-no-positive */
|
|
969
|
-
}
|
|
970
|
-
}, {
|
|
971
|
-
key: "render",
|
|
972
|
-
value: function render() {
|
|
973
|
-
var _this$getCurrentValue5;
|
|
974
|
-
|
|
975
|
-
var _this$props12 = this.props,
|
|
976
|
-
children = _this$props12.children,
|
|
977
|
-
defaultPlacement = _this$props12.defaultPlacement,
|
|
978
|
-
describedBy = _this$props12.describedBy,
|
|
979
|
-
disabled = _this$props12.disabled,
|
|
980
|
-
error = _this$props12.error,
|
|
981
|
-
inline = _this$props12.inline,
|
|
982
|
-
labelledBy = _this$props12.labelledBy,
|
|
983
|
-
placeholder = _this$props12.placeholder,
|
|
984
|
-
otherProps = Compact_objectWithoutProperties(_this$props12, ["children", "defaultPlacement", "describedBy", "disabled", "error", "inline", "labelledBy", "placeholder"]); // Generate buttonLabels
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
var childrenArray = external_react_["Children"].toArray(children);
|
|
988
|
-
var currentValues = (_this$getCurrentValue5 = this.getCurrentValues()) !== null && _this$getCurrentValue5 !== void 0 ? _this$getCurrentValue5 : [];
|
|
989
|
-
var buttonLabel = currentValues.reduce(function (acc, value, index, orig) {
|
|
990
|
-
var matchedItem = Object(external_lodash_["find"])(childrenArray, function (item) {
|
|
991
|
-
return isOption(item) && item.props.value === value;
|
|
992
|
-
});
|
|
993
|
-
|
|
994
|
-
if (matchedItem) {
|
|
995
|
-
acc.push(matchedItem.props.children || matchedItem.props.label);
|
|
996
|
-
} else {
|
|
997
|
-
acc.push(value);
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
|
-
if (index < orig.length - 1) {
|
|
1001
|
-
acc.push(Object(i18n_["_"])(', '));
|
|
1002
|
-
}
|
|
1003
|
-
|
|
1004
|
-
return acc;
|
|
1005
|
-
}, []);
|
|
1006
|
-
var toggle = /*#__PURE__*/external_react_default.a.createElement(StyledButton, Compact_extends({
|
|
1007
|
-
appearance: "toggle",
|
|
1008
|
-
"data-test-values": JSON.stringify(currentValues),
|
|
1009
|
-
label: buttonLabel.length > 0 ? buttonLabel : placeholder,
|
|
1010
|
-
error: error,
|
|
1011
|
-
inline: inline,
|
|
1012
|
-
disabled: disabled || undefined,
|
|
1013
|
-
isMenu: true,
|
|
1014
|
-
role: "listbox",
|
|
1015
|
-
"aria-labelledby": labelledBy,
|
|
1016
|
-
"aria-describedby": describedBy,
|
|
1017
|
-
"aria-multiselectable": "true" // @ts-expect-error - accept inconsistency with Button
|
|
1018
|
-
,
|
|
1019
|
-
onClick: this.props.onClick
|
|
1020
|
-
}, Object(external_lodash_["omit"])(otherProps, 'allowNewValues', 'animateLoading', 'controlledFilter', 'defaultValues', 'footerMessage', 'inputRef', 'isLoadingOptions', 'menuStyle', 'noOptionsMessage', 'onChange', 'onClick', 'onFilterChange', 'onScrollBottom', 'onOpen', 'onClose', 'values', 'useClickawayOverlay')), !!currentValues.length && /*#__PURE__*/external_react_default.a.createElement(StyledCount, {
|
|
1021
|
-
"data-role": "count"
|
|
1022
|
-
}, "(", currentValues.length, ")"));
|
|
1023
|
-
return /*#__PURE__*/external_react_default.a.createElement(Dropdown_default.a, {
|
|
1024
|
-
closeReasons: ['clickAway', 'escapeKey', 'offScreen', 'toggleClick'],
|
|
1025
|
-
toggle: toggle,
|
|
1026
|
-
onRequestOpen: this.handleRequestOpen,
|
|
1027
|
-
onRequestClose: this.handleRequestClose,
|
|
1028
|
-
open: this.state.open,
|
|
1029
|
-
repositionMode: "flip",
|
|
1030
|
-
defaultPlacement: defaultPlacement,
|
|
1031
|
-
canCoverAnchor: window.innerHeight < 500
|
|
1032
|
-
}, this.renderMenu);
|
|
1033
|
-
}
|
|
1034
|
-
}]);
|
|
1035
|
-
|
|
1036
|
-
return Compact;
|
|
1037
|
-
}(external_react_["Component"]);
|
|
1038
|
-
|
|
1039
|
-
Compact_defineProperty(Compact_Compact, "propTypes", Compact_propTypes);
|
|
1040
|
-
|
|
1041
|
-
Compact_defineProperty(Compact_Compact, "defaultProps", Compact_defaultProps);
|
|
1042
|
-
|
|
1043
|
-
Compact_defineProperty(Compact_Compact, "Option", Multiselect_Option);
|
|
1044
|
-
|
|
1045
|
-
Compact_defineProperty(Compact_Compact, "Divider", Menu_["Divider"]);
|
|
1046
|
-
|
|
1047
|
-
Compact_defineProperty(Compact_Compact, "Heading", Menu_["Heading"]);
|
|
1048
|
-
|
|
1049
|
-
/* harmony default export */ var Multiselect_Compact = (Compact_Compact);
|
|
1050
|
-
// EXTERNAL MODULE: external "@splunk/react-ui/Chip"
|
|
1051
|
-
var Chip_ = __webpack_require__(87);
|
|
1052
|
-
var Chip_default = /*#__PURE__*/__webpack_require__.n(Chip_);
|
|
1053
|
-
|
|
1054
|
-
// EXTERNAL MODULE: external "@splunk/react-ui/Popover"
|
|
1055
|
-
var Popover_ = __webpack_require__(18);
|
|
1056
|
-
var Popover_default = /*#__PURE__*/__webpack_require__.n(Popover_);
|
|
1057
|
-
|
|
1058
|
-
// EXTERNAL MODULE: external "@splunk/react-ui/Box"
|
|
1059
|
-
var Box_ = __webpack_require__(8);
|
|
1060
|
-
var Box_default = /*#__PURE__*/__webpack_require__.n(Box_);
|
|
1061
|
-
|
|
1062
|
-
// CONCATENATED MODULE: ./src/Multiselect/NormalStyles.ts
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
var StyledBox = external_styled_components_default()(Box_default.a).withConfig({
|
|
1067
|
-
displayName: "NormalStyles__StyledBox",
|
|
1068
|
-
componentId: "sc-1uwwpco-0"
|
|
1069
|
-
})(["border-radius:", ";align-items:flex-start;flex-wrap:wrap;min-height:", ";max-height:300px;overflow-y:auto;", ";", " ", " ", " ", " ", " &[data-inline]{width:400px;}[data-inline='true'] + &{margin-left:", "}"], themes_["variables"].borderRadius, themes_["variables"].inputHeight, Object(themes_["pick"])({
|
|
1070
|
-
enterprise: Object(external_styled_components_["css"])(["border:", ";padding:2px 0 0 2px;"], themes_["variables"].border),
|
|
1071
|
-
prisma: Object(external_styled_components_["css"])(["border:1px solid ", ";padding:2px;"], themes_["variables"].interactiveColorBorder)
|
|
1072
|
-
}), Object(themes_["pick"])({
|
|
1073
|
-
enterprise: {
|
|
1074
|
-
light: Object(external_styled_components_["css"])(["background-color:", ";"], themes_["variables"].white),
|
|
1075
|
-
dark: Object(external_styled_components_["css"])(["background-color:", ";"], themes_["variables"].gray22)
|
|
1076
|
-
}
|
|
1077
|
-
}), function (_ref) {
|
|
1078
|
-
var $hasfocus = _ref.$hasfocus;
|
|
1079
|
-
return $hasfocus && Object(themes_["pick"])({
|
|
1080
|
-
enterprise: Object(external_styled_components_["css"])(["box-shadow:", ";"], themes_["variables"].focusShadow),
|
|
1081
|
-
prisma: Object(external_styled_components_["css"])(["border-color:", ";"], themes_["variables"].focusColor)
|
|
1082
|
-
});
|
|
1083
|
-
}, function (_ref2) {
|
|
1084
|
-
var $error = _ref2.$error;
|
|
1085
|
-
return $error && Object(external_styled_components_["css"])(["border-color:", ";color:", ";"], themes_["variables"].accentColorNegative, themes_["variables"].accentColorNegative);
|
|
1086
|
-
}, function (_ref3) {
|
|
1087
|
-
var $disabled = _ref3.$disabled;
|
|
1088
|
-
return $disabled ? Object(themes_["pick"])({
|
|
1089
|
-
enterprise: {
|
|
1090
|
-
light: Object(external_styled_components_["css"])(["background-color:", ";cursor:not-allowed;"], themes_["variables"].gray96),
|
|
1091
|
-
dark: Object(external_styled_components_["css"])(["background-color:", ";border-color:", ";cursor:not-allowed;"], themes_["variables"].gray22, themes_["variables"].gray30)
|
|
1092
|
-
},
|
|
1093
|
-
prisma: Object(external_styled_components_["css"])(["border-color:", ";cursor:not-allowed;"], themes_["variables"].interactiveColorBorderDisabled)
|
|
1094
|
-
}) : Object(external_styled_components_["css"])(["&:hover{border-color:", ";}"], Object(themes_["pick"])({
|
|
1095
|
-
enterprise: themes_["variables"].borderColor,
|
|
1096
|
-
prisma: themes_["variables"].interactiveColorBorderHover
|
|
1097
|
-
}));
|
|
1098
|
-
}, function (_ref4) {
|
|
1099
|
-
var $popoverOpen = _ref4.$popoverOpen;
|
|
1100
|
-
return $popoverOpen && Object(external_styled_components_["css"])(["position:relative;z-index:calc(", " - 2);"], themes_["variables"].zindexFixedNavbar);
|
|
1101
|
-
}, Object(themes_["pick"])({
|
|
1102
|
-
enterprise: themes_["variables"].spacingHalf,
|
|
1103
|
-
prisma: themes_["variables"].spacingSmall
|
|
1104
|
-
}));
|
|
1105
|
-
var StyledInputWrapper = external_styled_components_default.a.div.withConfig({
|
|
1106
|
-
displayName: "NormalStyles__StyledInputWrapper",
|
|
1107
|
-
componentId: "sc-1uwwpco-1"
|
|
1108
|
-
})(["flex:1 0 auto;max-width:100%;"]);
|
|
1109
|
-
var StyledInput = external_styled_components_default.a.input.withConfig({
|
|
1110
|
-
displayName: "NormalStyles__StyledInput",
|
|
1111
|
-
componentId: "sc-1uwwpco-2"
|
|
1112
|
-
})(["", ";min-width:100%;max-width:100%;line-height:12px;", ""], themes_["mixins"].reset('block'), Object(themes_["pick"])({
|
|
1113
|
-
enterprise: {
|
|
1114
|
-
comfortable: Object(external_styled_components_["css"])(["padding:", ";"], themes_["variables"].spacingQuarter),
|
|
1115
|
-
compact: Object(external_styled_components_["css"])(["padding:3px;"])
|
|
1116
|
-
},
|
|
1117
|
-
prisma: {
|
|
1118
|
-
comfortable: Object(external_styled_components_["css"])(["padding:7px 10px;"]),
|
|
1119
|
-
compact: Object(external_styled_components_["css"])(["padding:3px;"])
|
|
1120
|
-
}
|
|
1121
|
-
}));
|
|
1122
|
-
var StyledOverlay = external_styled_components_default.a.div.withConfig({
|
|
1123
|
-
displayName: "NormalStyles__StyledOverlay",
|
|
1124
|
-
componentId: "sc-1uwwpco-3"
|
|
1125
|
-
})(["", ""], function (_ref5) {
|
|
1126
|
-
var $popoveropen = _ref5.$popoveropen;
|
|
1127
|
-
return $popoveropen && Object(external_styled_components_["css"])(["position:fixed;top:0;left:0;width:100%;height:100%;z-index:calc(", " - 2);"], themes_["variables"].zindexFixedNavbar);
|
|
1128
|
-
});
|
|
1129
|
-
|
|
1130
|
-
// EXTERNAL MODULE: ./src/utils/updateReactRef.ts
|
|
1131
|
-
var updateReactRef = __webpack_require__(12);
|
|
1132
|
-
|
|
1133
|
-
// CONCATENATED MODULE: ./src/Multiselect/Normal.tsx
|
|
1134
|
-
function Normal_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Normal_typeof = function _typeof(obj) { return typeof obj; }; } else { Normal_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Normal_typeof(obj); }
|
|
1135
|
-
|
|
1136
|
-
function Normal_toConsumableArray(arr) { return Normal_arrayWithoutHoles(arr) || Normal_iterableToArray(arr) || Normal_unsupportedIterableToArray(arr) || Normal_nonIterableSpread(); }
|
|
1137
|
-
|
|
1138
|
-
function Normal_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
1139
|
-
|
|
1140
|
-
function Normal_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return Normal_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Normal_arrayLikeToArray(o, minLen); }
|
|
1141
|
-
|
|
1142
|
-
function Normal_iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
|
1143
|
-
|
|
1144
|
-
function Normal_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return Normal_arrayLikeToArray(arr); }
|
|
1145
|
-
|
|
1146
|
-
function Normal_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
1147
|
-
|
|
1148
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
1149
|
-
|
|
1150
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Normal_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1151
|
-
|
|
1152
|
-
function Normal_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = Normal_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
1153
|
-
|
|
1154
|
-
function Normal_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
1155
|
-
|
|
1156
|
-
function Normal_extends() { Normal_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Normal_extends.apply(this, arguments); }
|
|
1157
|
-
|
|
1158
|
-
function Normal_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1159
|
-
|
|
1160
|
-
function Normal_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
1161
|
-
|
|
1162
|
-
function Normal_createClass(Constructor, protoProps, staticProps) { if (protoProps) Normal_defineProperties(Constructor.prototype, protoProps); if (staticProps) Normal_defineProperties(Constructor, staticProps); return Constructor; }
|
|
1163
|
-
|
|
1164
|
-
function Normal_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) Normal_setPrototypeOf(subClass, superClass); }
|
|
1165
|
-
|
|
1166
|
-
function Normal_setPrototypeOf(o, p) { Normal_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Normal_setPrototypeOf(o, p); }
|
|
1167
|
-
|
|
1168
|
-
function Normal_createSuper(Derived) { var hasNativeReflectConstruct = Normal_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Normal_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Normal_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Normal_possibleConstructorReturn(this, result); }; }
|
|
1169
|
-
|
|
1170
|
-
function Normal_possibleConstructorReturn(self, call) { if (call && (Normal_typeof(call) === "object" || typeof call === "function")) { return call; } return Normal_assertThisInitialized(self); }
|
|
1171
|
-
|
|
1172
|
-
function Normal_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
1173
|
-
|
|
1174
|
-
function Normal_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
1175
|
-
|
|
1176
|
-
function Normal_getPrototypeOf(o) { Normal_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Normal_getPrototypeOf(o); }
|
|
1177
|
-
|
|
1178
|
-
function Normal_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1179
595
|
|
|
1180
596
|
|
|
1181
597
|
|
|
@@ -1204,6 +620,7 @@ var Normal_propTypes = {
|
|
|
1204
620
|
error: external_prop_types_default.a.bool,
|
|
1205
621
|
footerMessage: external_prop_types_default.a.node,
|
|
1206
622
|
inline: external_prop_types_default.a.bool,
|
|
623
|
+
inputId: external_prop_types_default.a.string,
|
|
1207
624
|
inputRef: external_prop_types_default.a.oneOfType([external_prop_types_default.a.func, external_prop_types_default.a.object]),
|
|
1208
625
|
isLoadingOptions: external_prop_types_default.a.bool,
|
|
1209
626
|
labelledBy: external_prop_types_default.a.string,
|
|
@@ -1324,13 +741,29 @@ var Normal_Normal = /*#__PURE__*/function (_Component) {
|
|
|
1324
741
|
return;
|
|
1325
742
|
}
|
|
1326
743
|
|
|
1327
|
-
if (eventKeyCode === '
|
|
744
|
+
if (eventKeyCode === 'end' && _this.state.open) {
|
|
1328
745
|
e.preventDefault();
|
|
1329
746
|
|
|
1330
|
-
|
|
1331
|
-
_this.
|
|
1332
|
-
|
|
1333
|
-
|
|
747
|
+
_this.setState({
|
|
748
|
+
activeIndex: _this.availableOptionCount - 1
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
if (eventKeyCode === 'home' && _this.state.open) {
|
|
753
|
+
e.preventDefault();
|
|
754
|
+
|
|
755
|
+
_this.setState({
|
|
756
|
+
activeIndex: 0
|
|
757
|
+
});
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
if (eventKeyCode === 'down') {
|
|
761
|
+
e.preventDefault();
|
|
762
|
+
|
|
763
|
+
if (_this.state.open) {
|
|
764
|
+
_this.setState(function (state) {
|
|
765
|
+
return {
|
|
766
|
+
activeIndex: Math.min(state.activeIndex + 1, _this.availableOptionCount - 1)
|
|
1334
767
|
};
|
|
1335
768
|
});
|
|
1336
769
|
} else {
|
|
@@ -1452,6 +885,10 @@ var Normal_Normal = /*#__PURE__*/function (_Component) {
|
|
|
1452
885
|
var _this$props$onScrollB, _this$props7;
|
|
1453
886
|
|
|
1454
887
|
(_this$props$onScrollB = (_this$props7 = _this.props).onScrollBottom) === null || _this$props$onScrollB === void 0 ? void 0 : _this$props$onScrollB.call(_this$props7);
|
|
888
|
+
|
|
889
|
+
_this.setState({
|
|
890
|
+
loadingMoreMessage: "".concat(_this.availableOptionCount, " options, loading more options")
|
|
891
|
+
});
|
|
1455
892
|
}
|
|
1456
893
|
});
|
|
1457
894
|
|
|
@@ -1477,6 +914,7 @@ var Normal_Normal = /*#__PURE__*/function (_Component) {
|
|
|
1477
914
|
maxHeight = _ref4.maxHeight,
|
|
1478
915
|
placement = _ref4.placement;
|
|
1479
916
|
return /*#__PURE__*/external_react_default.a.createElement(ResultsMenu_default.a, Normal_extends({
|
|
917
|
+
controlledExternally: true,
|
|
1480
918
|
placement: placement !== null && placement !== void 0 ? placement : undefined,
|
|
1481
919
|
maxHeight: maxHeight !== null && maxHeight !== void 0 ? maxHeight : undefined,
|
|
1482
920
|
isLoading: _this.props.isLoadingOptions,
|
|
@@ -1494,7 +932,8 @@ var Normal_Normal = /*#__PURE__*/function (_Component) {
|
|
|
1494
932
|
filterKeyword: '',
|
|
1495
933
|
hasFocus: false,
|
|
1496
934
|
open: false,
|
|
1497
|
-
values: props.defaultValues || []
|
|
935
|
+
values: props.defaultValues || [],
|
|
936
|
+
loadingMoreMessage: ''
|
|
1498
937
|
};
|
|
1499
938
|
_this.availableOptionCount = 0;
|
|
1500
939
|
_this.children = [];
|
|
@@ -1625,10 +1064,11 @@ var Normal_Normal = /*#__PURE__*/function (_Component) {
|
|
|
1625
1064
|
disabled = _this$props10.disabled,
|
|
1626
1065
|
error = _this$props10.error,
|
|
1627
1066
|
inline = _this$props10.inline,
|
|
1067
|
+
inputId = _this$props10.inputId,
|
|
1628
1068
|
labelledBy = _this$props10.labelledBy,
|
|
1629
1069
|
placeholder = _this$props10.placeholder,
|
|
1630
1070
|
useClickawayOverlay = _this$props10.useClickawayOverlay,
|
|
1631
|
-
otherProps = Normal_objectWithoutProperties(_this$props10, ["allowNewValues", "children", "controlledFilter", "defaultPlacement", "describedBy", "disabled", "error", "inline", "labelledBy", "placeholder", "useClickawayOverlay"]);
|
|
1071
|
+
otherProps = Normal_objectWithoutProperties(_this$props10, ["allowNewValues", "children", "controlledFilter", "defaultPlacement", "describedBy", "disabled", "error", "inline", "inputId", "labelledBy", "placeholder", "useClickawayOverlay"]);
|
|
1632
1072
|
|
|
1633
1073
|
var ariaProps = _objectSpread(_objectSpread({}, Object(external_lodash_["pickBy"])(otherProps, function (val, key) {
|
|
1634
1074
|
return key === 'role' || key.indexOf('aria-') === 0;
|
|
@@ -1674,388 +1114,1822 @@ var Normal_Normal = /*#__PURE__*/function (_Component) {
|
|
|
1674
1114
|
return childrenItem;
|
|
1675
1115
|
}
|
|
1676
1116
|
|
|
1677
|
-
var item = childrenItem; // find out if the search string exactly matches a value
|
|
1117
|
+
var item = childrenItem; // find out if the search string exactly matches a value
|
|
1118
|
+
|
|
1119
|
+
if (item.props.value === _this3.state.filterKeyword) {
|
|
1120
|
+
foundExactMatch = true;
|
|
1121
|
+
} // remove items that are already selected
|
|
1122
|
+
|
|
1123
|
+
|
|
1124
|
+
var selectedIndex = currentValues.indexOf(item.props.value);
|
|
1125
|
+
|
|
1126
|
+
if (selectedIndex >= 0) {
|
|
1127
|
+
return null;
|
|
1128
|
+
} // highlight matched text
|
|
1129
|
+
|
|
1130
|
+
|
|
1131
|
+
var _item$props = item.props,
|
|
1132
|
+
itemChildren = _item$props.children,
|
|
1133
|
+
label = _item$props.label,
|
|
1134
|
+
matchRanges = _item$props.matchRanges;
|
|
1135
|
+
var itemSupportsMatchRanges = itemChildren === undefined || Object(external_lodash_["isString"])(itemChildren);
|
|
1136
|
+
var matchRangesCalc = itemSupportsMatchRanges && !controlledFilter && !matchRanges && keywords && Object(filter_["keywordLocations"])(label, keywords); // clone item
|
|
1137
|
+
|
|
1138
|
+
var clonedItem = /*#__PURE__*/Object(external_react_["cloneElement"])(item, {
|
|
1139
|
+
key: i,
|
|
1140
|
+
onClick: _this3.handleMenuOptionClick,
|
|
1141
|
+
matchRanges: itemSupportsMatchRanges && (matchRanges || matchRangesCalc) || undefined
|
|
1142
|
+
});
|
|
1143
|
+
return clonedItem;
|
|
1144
|
+
}).filter(function (item) {
|
|
1145
|
+
return item !== null;
|
|
1146
|
+
}); // Add the option to add the new value
|
|
1147
|
+
|
|
1148
|
+
if (allowNewValues && !foundExactMatch && this.state.filterKeyword) {
|
|
1149
|
+
this.children.unshift( /*#__PURE__*/external_react_default.a.createElement(Multiselect_Option, {
|
|
1150
|
+
label: "".concat(this.state.filterKeyword, " (new value)"),
|
|
1151
|
+
value: this.state.filterKeyword,
|
|
1152
|
+
key: "newValue",
|
|
1153
|
+
onClick: this.handleMenuOptionClick
|
|
1154
|
+
}));
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
if (this.state.open) {
|
|
1158
|
+
// highlight the selected Item
|
|
1159
|
+
this.children = external_react_["Children"].map(this.children, function (childrenItem) {
|
|
1160
|
+
if (!childrenItem.props || !Object(external_lodash_["has"])(childrenItem.props, 'value')) {
|
|
1161
|
+
// ignore Headings and Dividers
|
|
1162
|
+
return childrenItem;
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
var item = childrenItem;
|
|
1166
|
+
var active = _this3.availableOptionCount === _this3.state.activeIndex;
|
|
1167
|
+
_this3.availableOptionCount += 1;
|
|
1168
|
+
|
|
1169
|
+
if (!active) {
|
|
1170
|
+
return item;
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
if (!item.props.disabled) {
|
|
1174
|
+
_this3.activeValue = item.props.value;
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
var clonedItem = /*#__PURE__*/Object(external_react_["cloneElement"])(item, {
|
|
1178
|
+
active: active,
|
|
1179
|
+
id: _this3.activeItemId,
|
|
1180
|
+
ref: _this3.handleActiveOptionMount
|
|
1181
|
+
});
|
|
1182
|
+
return clonedItem;
|
|
1183
|
+
});
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
var inputWidth = "".concat(this.state.filterKeyword.length * 0.8, "em");
|
|
1187
|
+
return [/*#__PURE__*/external_react_default.a.createElement(StyledBox, Normal_extends({
|
|
1188
|
+
key: "control",
|
|
1189
|
+
"data-test-values": JSON.stringify(currentValues),
|
|
1190
|
+
inline: inline,
|
|
1191
|
+
$hasfocus: this.state.hasFocus
|
|
1192
|
+
}, external_lodash_["omit"].apply(void 0, [otherProps, 'animateLoading', 'controlledFilter', 'defaultValues', 'footerMessage', 'inputRef', 'isLoadingOptions', 'labelledBy', 'menuStyle', 'noOptionsMessage', 'onChange', 'onFilterChange', 'onScrollBottom', 'onClose', 'onOpen', 'values', 'useClickawayOverlay'].concat(_toConsumableArray(Object(external_lodash_["keys"])(ariaProps)))), {
|
|
1193
|
+
onClick: disabled ? undefined : this.handleClick,
|
|
1194
|
+
$disabled: disabled,
|
|
1195
|
+
$error: error,
|
|
1196
|
+
"data-test-popover-id": this.popoverId,
|
|
1197
|
+
$popoverOpen: this.state.open,
|
|
1198
|
+
flex: true,
|
|
1199
|
+
elementRef: this.handleMount,
|
|
1200
|
+
role: "listbox",
|
|
1201
|
+
"aria-disabled": disabled || undefined
|
|
1202
|
+
}), /*#__PURE__*/external_react_default.a.createElement(ScreenReaderContent_default.a, {
|
|
1203
|
+
role: "status",
|
|
1204
|
+
"aria-live": "polite"
|
|
1205
|
+
}, this.state.loadingMoreMessage), this.renderButtons(selectedItems), !disabled && /*#__PURE__*/external_react_default.a.createElement(StyledInputWrapper, {
|
|
1206
|
+
role: "combobox",
|
|
1207
|
+
"aria-owns": this.state.open ? this.popoverId : undefined,
|
|
1208
|
+
"aria-haspopup": true,
|
|
1209
|
+
"aria-expanded": this.state.open
|
|
1210
|
+
}, /*#__PURE__*/external_react_default.a.createElement(StyledInput, Normal_extends({
|
|
1211
|
+
"data-test": "textbox",
|
|
1212
|
+
id: inputId,
|
|
1213
|
+
ref: this.handleInputMount,
|
|
1214
|
+
onBlur: this.handleInputBlur,
|
|
1215
|
+
onFocus: this.handleInputFocus,
|
|
1216
|
+
onChange: this.handleInputChange,
|
|
1217
|
+
onKeyDown: this.handleInputKeyDown,
|
|
1218
|
+
value: this.state.filterKeyword,
|
|
1219
|
+
autoCapitalize: "off",
|
|
1220
|
+
autoComplete: "off",
|
|
1221
|
+
autoCorrect: "off",
|
|
1222
|
+
spellCheck: false,
|
|
1223
|
+
"aria-autocomplete": "list",
|
|
1224
|
+
style: {
|
|
1225
|
+
flexBasis: inputWidth,
|
|
1226
|
+
width: inputWidth
|
|
1227
|
+
},
|
|
1228
|
+
placeholder: currentValues.length ? '' : placeholder,
|
|
1229
|
+
"aria-activedescendant": this.state.open && this.availableOptionCount > 0 ? this.activeItemId : undefined,
|
|
1230
|
+
"aria-controls": this.state.open ? this.popoverId : undefined
|
|
1231
|
+
}, ariaProps))), !disabled && /*#__PURE__*/external_react_default.a.createElement(Popover_default.a, {
|
|
1232
|
+
open: this.state.open && !!this.state.el,
|
|
1233
|
+
autoCloseWhenOffScreen: true,
|
|
1234
|
+
anchor: this.state.el,
|
|
1235
|
+
onRequestClose: this.handleRequestClose,
|
|
1236
|
+
canCoverAnchor: false,
|
|
1237
|
+
defaultPlacement: defaultPlacement,
|
|
1238
|
+
repositionMode: "flip",
|
|
1239
|
+
id: this.popoverId
|
|
1240
|
+
}, this.renderMenu)), useClickawayOverlay && this.state.open ? /*#__PURE__*/external_react_default.a.createElement(StyledOverlay, {
|
|
1241
|
+
key: "overlay",
|
|
1242
|
+
$popoveropen: this.state.open,
|
|
1243
|
+
"data-test": "overlay"
|
|
1244
|
+
}) : null];
|
|
1245
|
+
}
|
|
1246
|
+
}]);
|
|
1247
|
+
|
|
1248
|
+
return Normal;
|
|
1249
|
+
}(external_react_["Component"]);
|
|
1250
|
+
|
|
1251
|
+
Normal_defineProperty(Normal_Normal, "propTypes", Normal_propTypes);
|
|
1252
|
+
|
|
1253
|
+
Normal_defineProperty(Normal_Normal, "defaultProps", Normal_defaultProps);
|
|
1254
|
+
|
|
1255
|
+
Normal_defineProperty(Normal_Normal, "Option", Multiselect_Option);
|
|
1256
|
+
|
|
1257
|
+
Normal_defineProperty(Normal_Normal, "Divider", Menu_["Divider"]);
|
|
1258
|
+
|
|
1259
|
+
Normal_defineProperty(Normal_Normal, "Heading", Menu_["Heading"]);
|
|
1260
|
+
|
|
1261
|
+
/* harmony default export */ var Multiselect_Normal = (Normal_Normal);
|
|
1262
|
+
// CONCATENATED MODULE: ./src/Multiselect/Multiselect.tsx
|
|
1263
|
+
function Multiselect_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Multiselect_typeof = function _typeof(obj) { return typeof obj; }; } else { Multiselect_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Multiselect_typeof(obj); }
|
|
1264
|
+
|
|
1265
|
+
function Multiselect_extends() { Multiselect_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Multiselect_extends.apply(this, arguments); }
|
|
1266
|
+
|
|
1267
|
+
function Multiselect_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1268
|
+
|
|
1269
|
+
function Multiselect_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
1270
|
+
|
|
1271
|
+
function Multiselect_createClass(Constructor, protoProps, staticProps) { if (protoProps) Multiselect_defineProperties(Constructor.prototype, protoProps); if (staticProps) Multiselect_defineProperties(Constructor, staticProps); return Constructor; }
|
|
1272
|
+
|
|
1273
|
+
function Multiselect_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) Multiselect_setPrototypeOf(subClass, superClass); }
|
|
1274
|
+
|
|
1275
|
+
function Multiselect_setPrototypeOf(o, p) { Multiselect_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Multiselect_setPrototypeOf(o, p); }
|
|
1276
|
+
|
|
1277
|
+
function Multiselect_createSuper(Derived) { var hasNativeReflectConstruct = Multiselect_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Multiselect_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Multiselect_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Multiselect_possibleConstructorReturn(this, result); }; }
|
|
1278
|
+
|
|
1279
|
+
function Multiselect_possibleConstructorReturn(self, call) { if (call && (Multiselect_typeof(call) === "object" || typeof call === "function")) { return call; } return Multiselect_assertThisInitialized(self); }
|
|
1280
|
+
|
|
1281
|
+
function Multiselect_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
1282
|
+
|
|
1283
|
+
function Multiselect_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
1284
|
+
|
|
1285
|
+
function Multiselect_getPrototypeOf(o) { Multiselect_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Multiselect_getPrototypeOf(o); }
|
|
1286
|
+
|
|
1287
|
+
function Multiselect_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1288
|
+
|
|
1289
|
+
|
|
1290
|
+
|
|
1291
|
+
|
|
1292
|
+
|
|
1293
|
+
|
|
1294
|
+
|
|
1295
|
+
|
|
1296
|
+
|
|
1297
|
+
var Multiselect_propTypes = {
|
|
1298
|
+
allowNewValues: external_prop_types_default.a.bool,
|
|
1299
|
+
animateLoading: external_prop_types_default.a.bool,
|
|
1300
|
+
children: external_prop_types_default.a.node,
|
|
1301
|
+
compact: external_prop_types_default.a.bool,
|
|
1302
|
+
controlledFilter: external_prop_types_default.a.bool,
|
|
1303
|
+
defaultPlacement: external_prop_types_default.a.oneOf(['above', 'below', 'vertical']),
|
|
1304
|
+
defaultValues: external_prop_types_default.a.array,
|
|
1305
|
+
describedBy: external_prop_types_default.a.string,
|
|
1306
|
+
disabled: external_prop_types_default.a.bool,
|
|
1307
|
+
elementRef: external_prop_types_default.a.oneOfType([external_prop_types_default.a.func, external_prop_types_default.a.object]),
|
|
1308
|
+
error: external_prop_types_default.a.bool,
|
|
1309
|
+
footerMessage: external_prop_types_default.a.node,
|
|
1310
|
+
inline: external_prop_types_default.a.bool,
|
|
1311
|
+
inputId: external_prop_types_default.a.string,
|
|
1312
|
+
inputRef: external_prop_types_default.a.oneOfType([external_prop_types_default.a.func, external_prop_types_default.a.object]),
|
|
1313
|
+
isLoadingOptions: external_prop_types_default.a.bool,
|
|
1314
|
+
labelledBy: external_prop_types_default.a.string,
|
|
1315
|
+
loadingMessage: external_prop_types_default.a.node,
|
|
1316
|
+
menuStyle: external_prop_types_default.a.object,
|
|
1317
|
+
name: external_prop_types_default.a.string,
|
|
1318
|
+
noOptionsMessage: external_prop_types_default.a.node,
|
|
1319
|
+
onChange: external_prop_types_default.a.func,
|
|
1320
|
+
onClose: external_prop_types_default.a.func,
|
|
1321
|
+
onFilterChange: external_prop_types_default.a.func,
|
|
1322
|
+
onOpen: external_prop_types_default.a.func,
|
|
1323
|
+
onScrollBottom: external_prop_types_default.a.func,
|
|
1324
|
+
placeholder: external_prop_types_default.a.string,
|
|
1325
|
+
tabConfirmsNewValue: external_prop_types_default.a.bool,
|
|
1326
|
+
useClickawayOverlay: external_prop_types_default.a.bool,
|
|
1327
|
+
values: external_prop_types_default.a.array
|
|
1328
|
+
};
|
|
1329
|
+
var Multiselect_defaultProps = {
|
|
1330
|
+
allowNewValues: false,
|
|
1331
|
+
animateLoading: false,
|
|
1332
|
+
compact: false,
|
|
1333
|
+
defaultPlacement: 'vertical',
|
|
1334
|
+
disabled: false,
|
|
1335
|
+
inline: false,
|
|
1336
|
+
isLoadingOptions: false,
|
|
1337
|
+
menuStyle: {},
|
|
1338
|
+
noOptionsMessage: Object(i18n_["_"])('No matches'),
|
|
1339
|
+
placeholder: Object(i18n_["_"])('Select...'),
|
|
1340
|
+
tabConfirmsNewValue: false,
|
|
1341
|
+
useClickawayOverlay: false
|
|
1342
|
+
};
|
|
1343
|
+
|
|
1344
|
+
function isCompact(props) {
|
|
1345
|
+
return props && props.compact === true;
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
var Multiselect_Multiselect = /*#__PURE__*/function (_Component) {
|
|
1349
|
+
Multiselect_inherits(Multiselect, _Component);
|
|
1350
|
+
|
|
1351
|
+
var _super = Multiselect_createSuper(Multiselect);
|
|
1352
|
+
|
|
1353
|
+
function Multiselect() {
|
|
1354
|
+
Multiselect_classCallCheck(this, Multiselect);
|
|
1355
|
+
|
|
1356
|
+
return _super.apply(this, arguments);
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
Multiselect_createClass(Multiselect, [{
|
|
1360
|
+
key: "render",
|
|
1361
|
+
// @docs-props-type MultiselectPropsBase
|
|
1362
|
+
value: function render() {
|
|
1363
|
+
if (isCompact(this.props)) {
|
|
1364
|
+
return /*#__PURE__*/external_react_default.a.createElement(Multiselect_Compact, Multiselect_extends({
|
|
1365
|
+
"data-test": "multiselect"
|
|
1366
|
+
}, Object(external_lodash_["omit"])(this.props, 'compact')));
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
return /*#__PURE__*/external_react_default.a.createElement(Multiselect_Normal, Multiselect_extends({
|
|
1370
|
+
"data-test": "multiselect"
|
|
1371
|
+
}, Object(external_lodash_["omit"])(this.props, 'compact')));
|
|
1372
|
+
}
|
|
1373
|
+
}]);
|
|
1374
|
+
|
|
1375
|
+
return Multiselect;
|
|
1376
|
+
}(external_react_["Component"]);
|
|
1377
|
+
|
|
1378
|
+
Multiselect_defineProperty(Multiselect_Multiselect, "propTypes", Multiselect_propTypes);
|
|
1379
|
+
|
|
1380
|
+
Multiselect_defineProperty(Multiselect_Multiselect, "defaultProps", Multiselect_defaultProps);
|
|
1381
|
+
|
|
1382
|
+
Multiselect_defineProperty(Multiselect_Multiselect, "Option", Multiselect_Option);
|
|
1383
|
+
|
|
1384
|
+
Multiselect_defineProperty(Multiselect_Multiselect, "Heading", Menu_["Heading"]);
|
|
1385
|
+
|
|
1386
|
+
Multiselect_defineProperty(Multiselect_Multiselect, "Divider", Menu_["Divider"]);
|
|
1387
|
+
|
|
1388
|
+
/* harmony default export */ var src_Multiselect_Multiselect = (Multiselect_Multiselect);
|
|
1389
|
+
|
|
1390
|
+
// CONCATENATED MODULE: ./src/Multiselect/index.ts
|
|
1391
|
+
|
|
1392
|
+
|
|
1393
|
+
|
|
1394
|
+
/***/ }),
|
|
1395
|
+
|
|
1396
|
+
/***/ 12:
|
|
1397
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1398
|
+
|
|
1399
|
+
"use strict";
|
|
1400
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return updateReactRef; });
|
|
1401
|
+
/**
|
|
1402
|
+
* Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
|
|
1403
|
+
*
|
|
1404
|
+
* @param ref - The React callback or object ref. Can be `null` or `undefined`.
|
|
1405
|
+
* @param current - The new value of the ref.
|
|
1406
|
+
*/
|
|
1407
|
+
function updateReactRef(ref, current) {
|
|
1408
|
+
if (ref) {
|
|
1409
|
+
if (typeof ref === 'function') {
|
|
1410
|
+
ref(current);
|
|
1411
|
+
} else {
|
|
1412
|
+
// the public signature of this util uses React.Ref<T> to mirror the way React types refs.
|
|
1413
|
+
// the intention here is to signal "we will take care of setting 'current', not you".
|
|
1414
|
+
ref.current = current; // eslint-disable-line no-param-reassign
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
|
|
1420
|
+
|
|
1421
|
+
/***/ }),
|
|
1422
|
+
|
|
1423
|
+
/***/ 13:
|
|
1424
|
+
/***/ (function(module, exports) {
|
|
1425
|
+
|
|
1426
|
+
module.exports = require("@splunk/react-ui/Menu");
|
|
1427
|
+
|
|
1428
|
+
/***/ }),
|
|
1429
|
+
|
|
1430
|
+
/***/ 14:
|
|
1431
|
+
/***/ (function(module, exports) {
|
|
1432
|
+
|
|
1433
|
+
module.exports = require("@splunk/react-ui/ScreenReaderContent");
|
|
1434
|
+
|
|
1435
|
+
/***/ }),
|
|
1436
|
+
|
|
1437
|
+
/***/ 16:
|
|
1438
|
+
/***/ (function(module, exports) {
|
|
1439
|
+
|
|
1440
|
+
module.exports = require("@splunk/react-ui/Button");
|
|
1441
|
+
|
|
1442
|
+
/***/ }),
|
|
1443
|
+
|
|
1444
|
+
/***/ 17:
|
|
1445
|
+
/***/ (function(module, exports) {
|
|
1446
|
+
|
|
1447
|
+
module.exports = require("@splunk/react-ui/Popover");
|
|
1448
|
+
|
|
1449
|
+
/***/ }),
|
|
1450
|
+
|
|
1451
|
+
/***/ 19:
|
|
1452
|
+
/***/ (function(module, exports) {
|
|
1453
|
+
|
|
1454
|
+
module.exports = require("@splunk/react-ui/Dropdown");
|
|
1455
|
+
|
|
1456
|
+
/***/ }),
|
|
1457
|
+
|
|
1458
|
+
/***/ 2:
|
|
1459
|
+
/***/ (function(module, exports) {
|
|
1460
|
+
|
|
1461
|
+
module.exports = require("react");
|
|
1462
|
+
|
|
1463
|
+
/***/ }),
|
|
1464
|
+
|
|
1465
|
+
/***/ 23:
|
|
1466
|
+
/***/ (function(module, exports) {
|
|
1467
|
+
|
|
1468
|
+
module.exports = require("@splunk/ui-utils/filter");
|
|
1469
|
+
|
|
1470
|
+
/***/ }),
|
|
1471
|
+
|
|
1472
|
+
/***/ 26:
|
|
1473
|
+
/***/ (function(module, exports) {
|
|
1474
|
+
|
|
1475
|
+
module.exports = require("@splunk/react-ui/Text");
|
|
1476
|
+
|
|
1477
|
+
/***/ }),
|
|
1478
|
+
|
|
1479
|
+
/***/ 28:
|
|
1480
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1481
|
+
|
|
1482
|
+
"use strict";
|
|
1483
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
|
1484
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
1485
|
+
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
|
|
1486
|
+
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
|
|
1487
|
+
/* harmony import */ var _splunk_react_ui_Menu__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(13);
|
|
1488
|
+
/* harmony import */ var _splunk_react_ui_Menu__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_splunk_react_ui_Menu__WEBPACK_IMPORTED_MODULE_2__);
|
|
1489
|
+
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); }
|
|
1490
|
+
|
|
1491
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
1492
|
+
|
|
1493
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
1494
|
+
|
|
1495
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
1496
|
+
|
|
1497
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1498
|
+
|
|
1499
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
1500
|
+
|
|
1501
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
1502
|
+
|
|
1503
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
1504
|
+
|
|
1505
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
1506
|
+
|
|
1507
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
1508
|
+
|
|
1509
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
1510
|
+
|
|
1511
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
1512
|
+
|
|
1513
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
1514
|
+
|
|
1515
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
1516
|
+
|
|
1517
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1518
|
+
|
|
1519
|
+
|
|
1520
|
+
|
|
1521
|
+
|
|
1522
|
+
var propTypes = {
|
|
1523
|
+
/** @private */
|
|
1524
|
+
active: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool,
|
|
1525
|
+
children: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.node,
|
|
1526
|
+
description: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string,
|
|
1527
|
+
descriptionPosition: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.oneOf(['right', 'bottom']),
|
|
1528
|
+
disabled: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool,
|
|
1529
|
+
hidden: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool,
|
|
1530
|
+
icon: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.node,
|
|
1531
|
+
label: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string.isRequired,
|
|
1532
|
+
|
|
1533
|
+
/**
|
|
1534
|
+
* @private Passed down from <BaseSelect>
|
|
1535
|
+
*/
|
|
1536
|
+
multiple: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool,
|
|
1537
|
+
matchRanges: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.arrayOf(prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.shape({
|
|
1538
|
+
start: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.number.isRequired,
|
|
1539
|
+
end: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.number.isRequired
|
|
1540
|
+
})),
|
|
1541
|
+
|
|
1542
|
+
/** @private */
|
|
1543
|
+
onClick: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.func,
|
|
1544
|
+
|
|
1545
|
+
/** @private */
|
|
1546
|
+
selected: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool,
|
|
1547
|
+
truncate: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool,
|
|
1548
|
+
value: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string, prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.number, prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool]).isRequired
|
|
1549
|
+
};
|
|
1550
|
+
var defaultProps = {
|
|
1551
|
+
descriptionPosition: 'bottom',
|
|
1552
|
+
disabled: false,
|
|
1553
|
+
multiple: false,
|
|
1554
|
+
selected: false,
|
|
1555
|
+
truncate: false
|
|
1556
|
+
};
|
|
1557
|
+
|
|
1558
|
+
/**
|
|
1559
|
+
* An option within a `Multiselect`. This inherits from
|
|
1560
|
+
* [PureComponent](https://reactjs.org/docs/react-api.html#reactpurecomponent)
|
|
1561
|
+
* so any elements passed to it must also be pure.
|
|
1562
|
+
*/
|
|
1563
|
+
var Option = /*#__PURE__*/function (_PureComponent) {
|
|
1564
|
+
_inherits(Option, _PureComponent);
|
|
1565
|
+
|
|
1566
|
+
var _super = _createSuper(Option);
|
|
1567
|
+
|
|
1568
|
+
function Option() {
|
|
1569
|
+
var _this;
|
|
1570
|
+
|
|
1571
|
+
_classCallCheck(this, Option);
|
|
1572
|
+
|
|
1573
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1574
|
+
args[_key] = arguments[_key];
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
1578
|
+
|
|
1579
|
+
_defineProperty(_assertThisInitialized(_this), "c", null);
|
|
1580
|
+
|
|
1581
|
+
_defineProperty(_assertThisInitialized(_this), "handleClick", function (e) {
|
|
1582
|
+
var _this$props = _this.props,
|
|
1583
|
+
onClick = _this$props.onClick,
|
|
1584
|
+
value = _this$props.value,
|
|
1585
|
+
disabled = _this$props.disabled;
|
|
1586
|
+
|
|
1587
|
+
if (!disabled) {
|
|
1588
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e, {
|
|
1589
|
+
value: value
|
|
1590
|
+
});
|
|
1591
|
+
}
|
|
1592
|
+
});
|
|
1593
|
+
|
|
1594
|
+
_defineProperty(_assertThisInitialized(_this), "handleMount", function (c) {
|
|
1595
|
+
_this.c = c;
|
|
1596
|
+
});
|
|
1597
|
+
|
|
1598
|
+
return _this;
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
_createClass(Option, [{
|
|
1602
|
+
key: "scrollIntoViewIfNeeded",
|
|
1603
|
+
value: function scrollIntoViewIfNeeded() {
|
|
1604
|
+
var _this$c;
|
|
1605
|
+
|
|
1606
|
+
(_this$c = this.c) === null || _this$c === void 0 ? void 0 : _this$c.scrollIntoViewIfNeeded();
|
|
1607
|
+
}
|
|
1608
|
+
/**
|
|
1609
|
+
* Place focus on the button.
|
|
1610
|
+
*/
|
|
1611
|
+
|
|
1612
|
+
}, {
|
|
1613
|
+
key: "focus",
|
|
1614
|
+
value: function focus() {
|
|
1615
|
+
var _this$c2;
|
|
1616
|
+
|
|
1617
|
+
(_this$c2 = this.c) === null || _this$c2 === void 0 ? void 0 : _this$c2.focus();
|
|
1618
|
+
}
|
|
1619
|
+
}, {
|
|
1620
|
+
key: "render",
|
|
1621
|
+
value: function render() {
|
|
1622
|
+
var _this$props2 = this.props,
|
|
1623
|
+
value = _this$props2.value,
|
|
1624
|
+
children = _this$props2.children,
|
|
1625
|
+
label = _this$props2.label,
|
|
1626
|
+
multiple = _this$props2.multiple,
|
|
1627
|
+
otherProps = _objectWithoutProperties(_this$props2, ["value", "children", "label", "multiple"]);
|
|
1628
|
+
|
|
1629
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_splunk_react_ui_Menu__WEBPACK_IMPORTED_MODULE_2__["Item"], _extends({
|
|
1630
|
+
"aria-selected": this.props.selected,
|
|
1631
|
+
"data-test-value": value,
|
|
1632
|
+
"data-test": "option",
|
|
1633
|
+
ref: this.handleMount
|
|
1634
|
+
}, otherProps, {
|
|
1635
|
+
selectable: true,
|
|
1636
|
+
selectableAppearance: multiple ? 'checkbox' : undefined,
|
|
1637
|
+
onClick: this.handleClick,
|
|
1638
|
+
role: "option",
|
|
1639
|
+
value: value.toString()
|
|
1640
|
+
}), children || label);
|
|
1641
|
+
}
|
|
1642
|
+
}]);
|
|
1643
|
+
|
|
1644
|
+
return Option;
|
|
1645
|
+
}(react__WEBPACK_IMPORTED_MODULE_0__["PureComponent"]);
|
|
1646
|
+
|
|
1647
|
+
_defineProperty(Option, "propTypes", propTypes);
|
|
1648
|
+
|
|
1649
|
+
_defineProperty(Option, "defaultProps", defaultProps);
|
|
1650
|
+
|
|
1651
|
+
/* harmony default export */ __webpack_exports__["a"] = (Option);
|
|
1652
|
+
|
|
1653
|
+
/***/ }),
|
|
1654
|
+
|
|
1655
|
+
/***/ 29:
|
|
1656
|
+
/***/ (function(module, exports) {
|
|
1657
|
+
|
|
1658
|
+
module.exports = require("@splunk/react-ui/Link");
|
|
1659
|
+
|
|
1660
|
+
/***/ }),
|
|
1661
|
+
|
|
1662
|
+
/***/ 3:
|
|
1663
|
+
/***/ (function(module, exports) {
|
|
1664
|
+
|
|
1665
|
+
module.exports = require("styled-components");
|
|
1666
|
+
|
|
1667
|
+
/***/ }),
|
|
1668
|
+
|
|
1669
|
+
/***/ 36:
|
|
1670
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1671
|
+
|
|
1672
|
+
"use strict";
|
|
1673
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CaretDown; });
|
|
1674
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
|
1675
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
1676
|
+
/* harmony import */ var _splunk_react_icons_Caret__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(37);
|
|
1677
|
+
/* harmony import */ var _splunk_react_icons_Caret__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_splunk_react_icons_Caret__WEBPACK_IMPORTED_MODULE_1__);
|
|
1678
|
+
/* harmony import */ var _ThemedIcon__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7);
|
|
1679
|
+
/* harmony import */ var _SVG__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6);
|
|
1680
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
1681
|
+
|
|
1682
|
+
|
|
1683
|
+
|
|
1684
|
+
|
|
1685
|
+
|
|
1686
|
+
|
|
1687
|
+
function Prisma24(_ref) {
|
|
1688
|
+
var otherProps = _extends({}, _ref);
|
|
1689
|
+
|
|
1690
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_SVG__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"], _extends({
|
|
1691
|
+
viewBox: "0 0 24 24"
|
|
1692
|
+
}, otherProps), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("path", {
|
|
1693
|
+
d: "M7.2788 9.00002C6.84609 9.00002 6.61768 9.51239 6.90691 9.83423L11.4078 14.8426C11.6065 15.0637 11.953 15.0636 12.1517 14.8425L16.6499 9.8341C16.939 9.51223 16.7106 9 16.2779 9L7.2788 9.00002Z",
|
|
1694
|
+
fill: "currentColor"
|
|
1695
|
+
}));
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
function CaretDown(props) {
|
|
1699
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_ThemedIcon__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"], _extends({
|
|
1700
|
+
Enterprise: _splunk_react_icons_Caret__WEBPACK_IMPORTED_MODULE_1___default.a,
|
|
1701
|
+
Prisma24: Prisma24
|
|
1702
|
+
}, props));
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1705
|
+
/***/ }),
|
|
1706
|
+
|
|
1707
|
+
/***/ 37:
|
|
1708
|
+
/***/ (function(module, exports) {
|
|
1709
|
+
|
|
1710
|
+
module.exports = require("@splunk/react-icons/Caret");
|
|
1711
|
+
|
|
1712
|
+
/***/ }),
|
|
1713
|
+
|
|
1714
|
+
/***/ 39:
|
|
1715
|
+
/***/ (function(module, exports) {
|
|
1716
|
+
|
|
1717
|
+
module.exports = require("@splunk/react-ui/ResultsMenu");
|
|
1718
|
+
|
|
1719
|
+
/***/ }),
|
|
1720
|
+
|
|
1721
|
+
/***/ 4:
|
|
1722
|
+
/***/ (function(module, exports) {
|
|
1723
|
+
|
|
1724
|
+
module.exports = require("lodash");
|
|
1725
|
+
|
|
1726
|
+
/***/ }),
|
|
1727
|
+
|
|
1728
|
+
/***/ 42:
|
|
1729
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1730
|
+
|
|
1731
|
+
"use strict";
|
|
1732
|
+
|
|
1733
|
+
// EXPORTS
|
|
1734
|
+
__webpack_require__.d(__webpack_exports__, "a", function() { return /* reexport */ Menu_["Divider"]; });
|
|
1735
|
+
__webpack_require__.d(__webpack_exports__, "b", function() { return /* reexport */ Menu_["Heading"]; });
|
|
1736
|
+
__webpack_require__.d(__webpack_exports__, "d", function() { return /* binding */ isOption; });
|
|
1737
|
+
|
|
1738
|
+
// UNUSED EXPORTS: Option
|
|
1739
|
+
|
|
1740
|
+
// EXTERNAL MODULE: external "react"
|
|
1741
|
+
var external_react_ = __webpack_require__(2);
|
|
1742
|
+
var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
|
|
1743
|
+
|
|
1744
|
+
// EXTERNAL MODULE: external "prop-types"
|
|
1745
|
+
var external_prop_types_ = __webpack_require__(1);
|
|
1746
|
+
var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_);
|
|
1747
|
+
|
|
1748
|
+
// EXTERNAL MODULE: external "lodash"
|
|
1749
|
+
var external_lodash_ = __webpack_require__(4);
|
|
1750
|
+
|
|
1751
|
+
// EXTERNAL MODULE: external "@splunk/ui-utils/filter"
|
|
1752
|
+
var filter_ = __webpack_require__(23);
|
|
1753
|
+
|
|
1754
|
+
// EXTERNAL MODULE: external "@splunk/ui-utils/id"
|
|
1755
|
+
var id_ = __webpack_require__(10);
|
|
1756
|
+
|
|
1757
|
+
// EXTERNAL MODULE: external "@splunk/ui-utils/i18n"
|
|
1758
|
+
var i18n_ = __webpack_require__(5);
|
|
1759
|
+
|
|
1760
|
+
// EXTERNAL MODULE: external "@splunk/ui-utils/keyboard"
|
|
1761
|
+
var keyboard_ = __webpack_require__(9);
|
|
1762
|
+
|
|
1763
|
+
// EXTERNAL MODULE: external "@splunk/react-ui/Dropdown"
|
|
1764
|
+
var Dropdown_ = __webpack_require__(19);
|
|
1765
|
+
var Dropdown_default = /*#__PURE__*/__webpack_require__.n(Dropdown_);
|
|
1766
|
+
|
|
1767
|
+
// EXTERNAL MODULE: external "@splunk/react-ui/Link"
|
|
1768
|
+
var Link_ = __webpack_require__(29);
|
|
1769
|
+
var Link_default = /*#__PURE__*/__webpack_require__.n(Link_);
|
|
1770
|
+
|
|
1771
|
+
// EXTERNAL MODULE: external "@splunk/react-ui/Menu"
|
|
1772
|
+
var Menu_ = __webpack_require__(13);
|
|
1773
|
+
|
|
1774
|
+
// EXTERNAL MODULE: external "@splunk/react-ui/ResultsMenu"
|
|
1775
|
+
var ResultsMenu_ = __webpack_require__(39);
|
|
1776
|
+
var ResultsMenu_default = /*#__PURE__*/__webpack_require__.n(ResultsMenu_);
|
|
1777
|
+
|
|
1778
|
+
// EXTERNAL MODULE: external "@splunk/react-ui/Text"
|
|
1779
|
+
var Text_ = __webpack_require__(26);
|
|
1780
|
+
var Text_default = /*#__PURE__*/__webpack_require__.n(Text_);
|
|
1781
|
+
|
|
1782
|
+
// EXTERNAL MODULE: ./src/icons/CaretDown.tsx
|
|
1783
|
+
var CaretDown = __webpack_require__(36);
|
|
1784
|
+
|
|
1785
|
+
// EXTERNAL MODULE: ./src/Select/OptionBase.tsx
|
|
1786
|
+
var OptionBase = __webpack_require__(28);
|
|
1787
|
+
|
|
1788
|
+
// EXTERNAL MODULE: external "styled-components"
|
|
1789
|
+
var external_styled_components_ = __webpack_require__(3);
|
|
1790
|
+
var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_);
|
|
1791
|
+
|
|
1792
|
+
// EXTERNAL MODULE: external "@splunk/react-ui/Button"
|
|
1793
|
+
var Button_ = __webpack_require__(16);
|
|
1794
|
+
var Button_default = /*#__PURE__*/__webpack_require__.n(Button_);
|
|
1795
|
+
|
|
1796
|
+
// EXTERNAL MODULE: external "@splunk/themes"
|
|
1797
|
+
var themes_ = __webpack_require__(0);
|
|
1798
|
+
|
|
1799
|
+
// CONCATENATED MODULE: ./src/Select/SelectBaseStyles.ts
|
|
1800
|
+
|
|
1801
|
+
|
|
1802
|
+
|
|
1803
|
+
|
|
1804
|
+
var StyledButton = external_styled_components_default()(Button_default.a).withConfig({
|
|
1805
|
+
displayName: "SelectBaseStyles__StyledButton",
|
|
1806
|
+
componentId: "sc-16cj7sk-0"
|
|
1807
|
+
})(["&[data-inline]{width:", ";}", ""], function (_ref) {
|
|
1808
|
+
var $multiple = _ref.$multiple;
|
|
1809
|
+
return $multiple ? '400px' : 'auto';
|
|
1810
|
+
}, function (_ref2) {
|
|
1811
|
+
var $multiple = _ref2.$multiple;
|
|
1812
|
+
return !$multiple && 'flex-grow: 0;';
|
|
1813
|
+
});
|
|
1814
|
+
var StyledLinkIcon = external_styled_components_default.a.span.withConfig({
|
|
1815
|
+
displayName: "SelectBaseStyles__StyledLinkIcon",
|
|
1816
|
+
componentId: "sc-16cj7sk-1"
|
|
1817
|
+
})(["padding-right:2px;"]);
|
|
1818
|
+
var StyledLinkCaret = external_styled_components_default.a.span.withConfig({
|
|
1819
|
+
displayName: "SelectBaseStyles__StyledLinkCaret",
|
|
1820
|
+
componentId: "sc-16cj7sk-2"
|
|
1821
|
+
})(["padding-left:2px;"]);
|
|
1822
|
+
var StyledFilter = external_styled_components_default.a.div.withConfig({
|
|
1823
|
+
displayName: "SelectBaseStyles__StyledFilter",
|
|
1824
|
+
componentId: "sc-16cj7sk-3"
|
|
1825
|
+
})(["padding:", ";min-width:160px;"], Object(themes_["pick"])({
|
|
1826
|
+
enterprise: '8px',
|
|
1827
|
+
prisma: '10px 16px'
|
|
1828
|
+
}));
|
|
1829
|
+
var StyledCount = external_styled_components_default.a.span.withConfig({
|
|
1830
|
+
displayName: "SelectBaseStyles__StyledCount",
|
|
1831
|
+
componentId: "sc-16cj7sk-4"
|
|
1832
|
+
})(["padding-right:", ";"], Object(themes_["pick"])({
|
|
1833
|
+
enterprise: themes_["variables"].spacingQuarter,
|
|
1834
|
+
prisma: themes_["variables"].spacingXSmall
|
|
1835
|
+
}));
|
|
1836
|
+
var StyledControlsLink = external_styled_components_default()(Link_default.a).withConfig({
|
|
1837
|
+
displayName: "SelectBaseStyles__StyledControlsLink",
|
|
1838
|
+
componentId: "sc-16cj7sk-5"
|
|
1839
|
+
})(["", ";"], function (_ref3) {
|
|
1840
|
+
var $disabled = _ref3.$disabled;
|
|
1841
|
+
return $disabled && Object(external_styled_components_["css"])(["color:", ";"], themes_["variables"].contentColorDisabled);
|
|
1842
|
+
});
|
|
1843
|
+
var StyledToggleAllControls = external_styled_components_default.a.div.withConfig({
|
|
1844
|
+
displayName: "SelectBaseStyles__StyledToggleAllControls",
|
|
1845
|
+
componentId: "sc-16cj7sk-6"
|
|
1846
|
+
})(["padding:", ";", ""], Object(themes_["pick"])({
|
|
1847
|
+
enterprise: "5px 8px",
|
|
1848
|
+
prisma: '10px 16px'
|
|
1849
|
+
}), Object(themes_["pickVariant"])('$placement', {
|
|
1850
|
+
above: {
|
|
1851
|
+
enterprise: Object(external_styled_components_["css"])(["border-top:", ";"], themes_["variables"].border),
|
|
1852
|
+
prisma: Object(external_styled_components_["css"])(["border-top:1px solid ", ";"], themes_["variables"].neutral200)
|
|
1853
|
+
},
|
|
1854
|
+
below: {
|
|
1855
|
+
enterprise: Object(external_styled_components_["css"])(["border-bottom:", ";"], themes_["variables"].border),
|
|
1856
|
+
prisma: Object(external_styled_components_["css"])(["border-bottom:1px solid ", ";"], themes_["variables"].neutral200)
|
|
1857
|
+
}
|
|
1858
|
+
}));
|
|
1859
|
+
|
|
1860
|
+
// CONCATENATED MODULE: ./src/Select/SelectBase.tsx
|
|
1861
|
+
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); }
|
|
1862
|
+
|
|
1863
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
1864
|
+
|
|
1865
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
1866
|
+
|
|
1867
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
1868
|
+
|
|
1869
|
+
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
1870
|
+
|
|
1871
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
1872
|
+
|
|
1873
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
1874
|
+
|
|
1875
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1876
|
+
|
|
1877
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
1878
|
+
|
|
1879
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
1880
|
+
|
|
1881
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
1882
|
+
|
|
1883
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
|
1884
|
+
|
|
1885
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
1886
|
+
|
|
1887
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
1888
|
+
|
|
1889
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1890
|
+
|
|
1891
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
1892
|
+
|
|
1893
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
1894
|
+
|
|
1895
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
1896
|
+
|
|
1897
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
1898
|
+
|
|
1899
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
1900
|
+
|
|
1901
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
1902
|
+
|
|
1903
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
1904
|
+
|
|
1905
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
1906
|
+
|
|
1907
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
1908
|
+
|
|
1909
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1910
|
+
|
|
1911
|
+
|
|
1912
|
+
|
|
1913
|
+
|
|
1914
|
+
|
|
1915
|
+
|
|
1916
|
+
|
|
1917
|
+
|
|
1918
|
+
|
|
1919
|
+
|
|
1920
|
+
|
|
1921
|
+
|
|
1922
|
+
|
|
1923
|
+
|
|
1924
|
+
|
|
1925
|
+
|
|
1926
|
+
var propTypes = {
|
|
1927
|
+
allowNewValues: external_prop_types_default.a.bool,
|
|
1928
|
+
animateLoading: external_prop_types_default.a.bool,
|
|
1929
|
+
appearance: external_prop_types_default.a.oneOf(['default', 'link', 'primary', 'pill', 'toggle', 'flat']),
|
|
1930
|
+
append: external_prop_types_default.a.bool,
|
|
1931
|
+
children: external_prop_types_default.a.node,
|
|
1932
|
+
defaultPlacement: external_prop_types_default.a.oneOf(['above', 'below', 'vertical']),
|
|
1933
|
+
defaultValues: external_prop_types_default.a.array,
|
|
1934
|
+
describedBy: external_prop_types_default.a.string,
|
|
1935
|
+
disabled: external_prop_types_default.a.bool,
|
|
1936
|
+
elementRef: external_prop_types_default.a.oneOfType([external_prop_types_default.a.func, external_prop_types_default.a.object]),
|
|
1937
|
+
error: external_prop_types_default.a.bool,
|
|
1938
|
+
filter: external_prop_types_default.a.oneOf([false, true, 'controlled']),
|
|
1939
|
+
footerMessage: external_prop_types_default.a.node,
|
|
1940
|
+
inline: external_prop_types_default.a.bool,
|
|
1941
|
+
inputId: external_prop_types_default.a.string,
|
|
1942
|
+
inputRef: external_prop_types_default.a.oneOfType([external_prop_types_default.a.func, external_prop_types_default.a.object]),
|
|
1943
|
+
isLoadingOptions: external_prop_types_default.a.bool,
|
|
1944
|
+
labelledBy: external_prop_types_default.a.string,
|
|
1945
|
+
labelText: external_prop_types_default.a.string,
|
|
1946
|
+
loadingMessage: external_prop_types_default.a.node,
|
|
1947
|
+
menuStyle: external_prop_types_default.a.object,
|
|
1948
|
+
multiple: external_prop_types_default.a.bool,
|
|
1949
|
+
name: external_prop_types_default.a.string,
|
|
1950
|
+
noOptionsMessage: external_prop_types_default.a.node,
|
|
1951
|
+
onChange: external_prop_types_default.a.func,
|
|
1952
|
+
onClose: external_prop_types_default.a.func,
|
|
1953
|
+
onFilterChange: external_prop_types_default.a.func,
|
|
1954
|
+
onOpen: external_prop_types_default.a.func,
|
|
1955
|
+
onScrollBottom: external_prop_types_default.a.func,
|
|
1956
|
+
placeholder: external_prop_types_default.a.string,
|
|
1957
|
+
prefixLabel: external_prop_types_default.a.string,
|
|
1958
|
+
prepend: external_prop_types_default.a.bool,
|
|
1959
|
+
suffixLabel: external_prop_types_default.a.string,
|
|
1960
|
+
tabConfirmsNewValue: external_prop_types_default.a.bool,
|
|
1961
|
+
values: external_prop_types_default.a.array
|
|
1962
|
+
};
|
|
1963
|
+
var defaultProps = {
|
|
1964
|
+
allowNewValues: false,
|
|
1965
|
+
animateLoading: false,
|
|
1966
|
+
appearance: 'toggle',
|
|
1967
|
+
append: false,
|
|
1968
|
+
defaultPlacement: 'vertical',
|
|
1969
|
+
disabled: false,
|
|
1970
|
+
filter: false,
|
|
1971
|
+
inline: false,
|
|
1972
|
+
isLoadingOptions: false,
|
|
1973
|
+
menuStyle: {},
|
|
1974
|
+
multiple: false,
|
|
1975
|
+
noOptionsMessage: Object(i18n_["_"])('No matches'),
|
|
1976
|
+
placeholder: Object(i18n_["_"])('Select...'),
|
|
1977
|
+
prepend: false,
|
|
1978
|
+
tabConfirmsNewValue: false
|
|
1979
|
+
};
|
|
1980
|
+
|
|
1981
|
+
function isOption(child) {
|
|
1982
|
+
return child && Object(external_lodash_["has"])(child.props, 'value');
|
|
1983
|
+
}
|
|
1984
|
+
|
|
1985
|
+
var SelectBase_SelectBase = /*#__PURE__*/function (_Component) {
|
|
1986
|
+
_inherits(SelectBase, _Component);
|
|
1987
|
+
|
|
1988
|
+
var _super = _createSuper(SelectBase);
|
|
1989
|
+
|
|
1990
|
+
_createClass(SelectBase, null, [{
|
|
1991
|
+
key: "validateAppearance",
|
|
1992
|
+
// @docs-props-type CompactPropsBase
|
|
1993
|
+
value: function validateAppearance(props) {
|
|
1994
|
+
if (false) {}
|
|
1995
|
+
}
|
|
1996
|
+
}]);
|
|
1997
|
+
|
|
1998
|
+
function SelectBase(props) {
|
|
1999
|
+
var _this;
|
|
2000
|
+
|
|
2001
|
+
_classCallCheck(this, SelectBase);
|
|
2002
|
+
|
|
2003
|
+
_this = _super.call(this, props);
|
|
2004
|
+
|
|
2005
|
+
_defineProperty(_assertThisInitialized(_this), "activeItemId", void 0);
|
|
2006
|
+
|
|
2007
|
+
_defineProperty(_assertThisInitialized(_this), "activeValue", void 0);
|
|
2008
|
+
|
|
2009
|
+
_defineProperty(_assertThisInitialized(_this), "availableOptionCount", void 0);
|
|
2010
|
+
|
|
2011
|
+
_defineProperty(_assertThisInitialized(_this), "controlledExternally", void 0);
|
|
2012
|
+
|
|
2013
|
+
_defineProperty(_assertThisInitialized(_this), "displayedValues", void 0);
|
|
2014
|
+
|
|
2015
|
+
_defineProperty(_assertThisInitialized(_this), "dropdown", null);
|
|
2016
|
+
|
|
2017
|
+
_defineProperty(_assertThisInitialized(_this), "firstSelectedOption", null);
|
|
2018
|
+
|
|
2019
|
+
_defineProperty(_assertThisInitialized(_this), "firstSelectedOptionIndex", void 0);
|
|
2020
|
+
|
|
2021
|
+
_defineProperty(_assertThisInitialized(_this), "menuId", void 0);
|
|
2022
|
+
|
|
2023
|
+
_defineProperty(_assertThisInitialized(_this), "selectedOptionCount", void 0);
|
|
2024
|
+
|
|
2025
|
+
_defineProperty(_assertThisInitialized(_this), "handleSelectAll", function (e) {
|
|
2026
|
+
var _this$getCurrentValue, _this$props$onChange, _this$props2;
|
|
2027
|
+
|
|
2028
|
+
var _this$props = _this.props,
|
|
2029
|
+
name = _this$props.name,
|
|
2030
|
+
children = _this$props.children,
|
|
2031
|
+
multiple = _this$props.multiple; // this doesn't make sense if we can't select multiple values
|
|
2032
|
+
|
|
2033
|
+
if (!multiple) {
|
|
2034
|
+
return;
|
|
2035
|
+
}
|
|
2036
|
+
|
|
2037
|
+
var values = Object(external_lodash_["uniq"])(((_this$getCurrentValue = _this.getCurrentValues()) !== null && _this$getCurrentValue !== void 0 ? _this$getCurrentValue : []).concat(_this.displayedValues));
|
|
2038
|
+
|
|
2039
|
+
if (!_this.isControlled()) {
|
|
2040
|
+
values = external_react_default.a.Children.toArray(children).filter(function (child) {
|
|
2041
|
+
return isOption(child) && Object(external_lodash_["includes"])(values, child.props.value) && !child.props.disabled;
|
|
2042
|
+
}).map(function (child) {
|
|
2043
|
+
return child.props.value;
|
|
2044
|
+
});
|
|
2045
|
+
|
|
2046
|
+
_this.setState({
|
|
2047
|
+
values: values
|
|
2048
|
+
});
|
|
2049
|
+
}
|
|
2050
|
+
|
|
2051
|
+
(_this$props$onChange = (_this$props2 = _this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props2, e, {
|
|
2052
|
+
values: values,
|
|
2053
|
+
name: name
|
|
2054
|
+
});
|
|
2055
|
+
});
|
|
2056
|
+
|
|
2057
|
+
_defineProperty(_assertThisInitialized(_this), "handleClearAll", function (e) {
|
|
2058
|
+
var _this$props$onChange2, _this$props3;
|
|
2059
|
+
|
|
2060
|
+
// this doesn't make sense if we can't select multiple values
|
|
2061
|
+
if (!_this.props.multiple) {
|
|
2062
|
+
return;
|
|
2063
|
+
} // Clear the filtered items, items when filtering. Else clear all the items.
|
|
2064
|
+
|
|
2065
|
+
|
|
2066
|
+
var values = _this.state.filterKeyword ? external_lodash_["without"].apply(void 0, [_this.getCurrentValues()].concat(_toConsumableArray(_this.displayedValues))) : [];
|
|
2067
|
+
var name = _this.props.name;
|
|
2068
|
+
|
|
2069
|
+
if (!_this.isControlled()) {
|
|
2070
|
+
_this.setState({
|
|
2071
|
+
values: values
|
|
2072
|
+
});
|
|
2073
|
+
}
|
|
2074
|
+
|
|
2075
|
+
(_this$props$onChange2 = (_this$props3 = _this.props).onChange) === null || _this$props$onChange2 === void 0 ? void 0 : _this$props$onChange2.call(_this$props3, e, {
|
|
2076
|
+
values: values,
|
|
2077
|
+
name: name
|
|
2078
|
+
});
|
|
2079
|
+
});
|
|
2080
|
+
|
|
2081
|
+
_defineProperty(_assertThisInitialized(_this), "handleTextKeyDown", function (e) {
|
|
2082
|
+
var _this$props4 = _this.props,
|
|
2083
|
+
children = _this$props4.children,
|
|
2084
|
+
onScrollBottom = _this$props4.onScrollBottom,
|
|
2085
|
+
tabConfirmsNewValue = _this$props4.tabConfirmsNewValue;
|
|
2086
|
+
var eventKeyCode = Object(keyboard_["keycode"])(e.nativeEvent);
|
|
2087
|
+
|
|
2088
|
+
if (eventKeyCode === 'tab') {
|
|
2089
|
+
if (tabConfirmsNewValue && !Object(external_lodash_["isUndefined"])(_this.activeValue) && _this.availableOptionCount <= 1) {
|
|
2090
|
+
e.preventDefault();
|
|
2091
|
+
|
|
2092
|
+
_this.toggleValue(e, _this.activeValue);
|
|
2093
|
+
}
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2096
|
+
if (e.shiftKey || e.metaKey || e.ctrlKey) {
|
|
2097
|
+
return;
|
|
2098
|
+
}
|
|
2099
|
+
|
|
2100
|
+
if (eventKeyCode === 'down') {
|
|
2101
|
+
e.preventDefault();
|
|
2102
|
+
|
|
2103
|
+
_this.setState(function (state) {
|
|
2104
|
+
return {
|
|
2105
|
+
activeIndex: Math.min(state.activeIndex + 1, _this.availableOptionCount - 1)
|
|
2106
|
+
};
|
|
2107
|
+
});
|
|
2108
|
+
|
|
2109
|
+
if (children && onScrollBottom) {
|
|
2110
|
+
var _this$getCurrentValue2;
|
|
2111
|
+
|
|
2112
|
+
var beforeLastChild = external_react_["Children"].toArray(children).length - (2 + ((_this$getCurrentValue2 = _this.getCurrentValues()) !== null && _this$getCurrentValue2 !== void 0 ? _this$getCurrentValue2 : []).length);
|
|
2113
|
+
|
|
2114
|
+
if (_this.state.activeIndex === beforeLastChild) {
|
|
2115
|
+
onScrollBottom();
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
if (eventKeyCode === 'up') {
|
|
2121
|
+
e.preventDefault();
|
|
2122
|
+
|
|
2123
|
+
_this.setState(function (state) {
|
|
2124
|
+
return {
|
|
2125
|
+
activeIndex: Math.max(state.activeIndex - 1, 0)
|
|
2126
|
+
};
|
|
2127
|
+
});
|
|
2128
|
+
}
|
|
2129
|
+
|
|
2130
|
+
if (eventKeyCode === 'enter' && !Object(external_lodash_["isUndefined"])(_this.activeValue) && _this.state.open) {
|
|
2131
|
+
e.preventDefault();
|
|
2132
|
+
|
|
2133
|
+
_this.toggleValue(e, _this.activeValue);
|
|
2134
|
+
}
|
|
2135
|
+
});
|
|
2136
|
+
|
|
2137
|
+
_defineProperty(_assertThisInitialized(_this), "handleMenuOptionClick", function (e, _ref) {
|
|
2138
|
+
var value = _ref.value;
|
|
2139
|
+
e.preventDefault();
|
|
2140
|
+
|
|
2141
|
+
_this.toggleValue(e, value);
|
|
2142
|
+
});
|
|
2143
|
+
|
|
2144
|
+
_defineProperty(_assertThisInitialized(_this), "handleTextChange", function (e, _ref2) {
|
|
2145
|
+
var _this$props$onFilterC, _this$props5;
|
|
2146
|
+
|
|
2147
|
+
var value = _ref2.value;
|
|
2148
|
+
|
|
2149
|
+
_this.setState({
|
|
2150
|
+
filterKeyword: value,
|
|
2151
|
+
open: true,
|
|
2152
|
+
activeIndex: 0
|
|
2153
|
+
});
|
|
2154
|
+
|
|
2155
|
+
(_this$props$onFilterC = (_this$props5 = _this.props).onFilterChange) === null || _this$props$onFilterC === void 0 ? void 0 : _this$props$onFilterC.call(_this$props5, e, {
|
|
2156
|
+
keyword: value
|
|
2157
|
+
});
|
|
2158
|
+
});
|
|
2159
|
+
|
|
2160
|
+
_defineProperty(_assertThisInitialized(_this), "handleTextFocus", function () {
|
|
2161
|
+
_this.setState({
|
|
2162
|
+
textHasFocus: true
|
|
2163
|
+
});
|
|
2164
|
+
});
|
|
2165
|
+
|
|
2166
|
+
_defineProperty(_assertThisInitialized(_this), "handleTextBlur", function () {
|
|
2167
|
+
_this.setState({
|
|
2168
|
+
textHasFocus: false
|
|
2169
|
+
});
|
|
2170
|
+
});
|
|
2171
|
+
|
|
2172
|
+
_defineProperty(_assertThisInitialized(_this), "handleRequestOpen", function (e) {
|
|
2173
|
+
var _this$getCurrentValue3, _this$props$onFilterC2, _this$props7;
|
|
2174
|
+
|
|
2175
|
+
var multiple = _this.props.multiple;
|
|
2176
|
+
|
|
2177
|
+
_this.setState({
|
|
2178
|
+
open: true,
|
|
2179
|
+
// in non-multiple mode, don't move values to the top of the list
|
|
2180
|
+
topValues: multiple ? (_this$getCurrentValue3 = _this.getCurrentValues()) !== null && _this$getCurrentValue3 !== void 0 ? _this$getCurrentValue3 : [] : []
|
|
2181
|
+
}, function () {
|
|
2182
|
+
var _this$props$onOpen, _this$props6;
|
|
2183
|
+
|
|
2184
|
+
(_this$props$onOpen = (_this$props6 = _this.props).onOpen) === null || _this$props$onOpen === void 0 ? void 0 : _this$props$onOpen.call(_this$props6);
|
|
2185
|
+
|
|
2186
|
+
if (_this.firstSelectedOption && !_this.hasFilter()) {
|
|
2187
|
+
_this.firstSelectedOption.focus();
|
|
2188
|
+
} else {
|
|
2189
|
+
var _this$firstSelectedOp;
|
|
2190
|
+
|
|
2191
|
+
_this.setState({
|
|
2192
|
+
activeIndex: (_this$firstSelectedOp = _this.firstSelectedOptionIndex) !== null && _this$firstSelectedOp !== void 0 ? _this$firstSelectedOp : 0
|
|
2193
|
+
});
|
|
2194
|
+
}
|
|
2195
|
+
});
|
|
2196
|
+
|
|
2197
|
+
(_this$props$onFilterC2 = (_this$props7 = _this.props).onFilterChange) === null || _this$props$onFilterC2 === void 0 ? void 0 : _this$props$onFilterC2.call(_this$props7, e, {
|
|
2198
|
+
keyword: ''
|
|
2199
|
+
});
|
|
2200
|
+
});
|
|
2201
|
+
|
|
2202
|
+
_defineProperty(_assertThisInitialized(_this), "handleRequestClose", function () {
|
|
2203
|
+
_this.setState({
|
|
2204
|
+
open: false,
|
|
2205
|
+
activeIndex: 0
|
|
2206
|
+
}, function () {
|
|
2207
|
+
var _this$props$onClose, _this$props8;
|
|
2208
|
+
|
|
2209
|
+
(_this$props$onClose = (_this$props8 = _this.props).onClose) === null || _this$props$onClose === void 0 ? void 0 : _this$props$onClose.call(_this$props8);
|
|
2210
|
+
});
|
|
2211
|
+
});
|
|
2212
|
+
|
|
2213
|
+
_defineProperty(_assertThisInitialized(_this), "handleScrollBottom", function () {
|
|
2214
|
+
if (_this.state.open && !_this.props.isLoadingOptions) {
|
|
2215
|
+
var _this$props$onScrollB, _this$props9;
|
|
2216
|
+
|
|
2217
|
+
(_this$props$onScrollB = (_this$props9 = _this.props).onScrollBottom) === null || _this$props$onScrollB === void 0 ? void 0 : _this$props$onScrollB.call(_this$props9);
|
|
2218
|
+
}
|
|
2219
|
+
});
|
|
2220
|
+
|
|
2221
|
+
_defineProperty(_assertThisInitialized(_this), "handleActiveOptionMount", function (c) {
|
|
2222
|
+
c === null || c === void 0 ? void 0 : c.scrollIntoViewIfNeeded();
|
|
2223
|
+
});
|
|
2224
|
+
|
|
2225
|
+
_defineProperty(_assertThisInitialized(_this), "handleSelectedItemMount", function (c) {
|
|
2226
|
+
_this.firstSelectedOption = c;
|
|
2227
|
+
});
|
|
2228
|
+
|
|
2229
|
+
_defineProperty(_assertThisInitialized(_this), "createChildren", function () {
|
|
2230
|
+
var _this$state = _this.state,
|
|
2231
|
+
filterKeyword = _this$state.filterKeyword,
|
|
2232
|
+
textHasFocus = _this$state.textHasFocus,
|
|
2233
|
+
topValues = _this$state.topValues;
|
|
2234
|
+
var _this$props10 = _this.props,
|
|
2235
|
+
allowNewValues = _this$props10.allowNewValues,
|
|
2236
|
+
filter = _this$props10.filter,
|
|
2237
|
+
multiple = _this$props10.multiple;
|
|
2238
|
+
|
|
2239
|
+
var currentValues = _this.getCurrentValues();
|
|
2240
|
+
|
|
2241
|
+
_this.availableOptionCount = 0;
|
|
2242
|
+
_this.firstSelectedOptionIndex = undefined;
|
|
2243
|
+
_this.selectedOptionCount = 0;
|
|
2244
|
+
_this.activeValue = undefined;
|
|
2245
|
+
var foundExactMatch;
|
|
2246
|
+
var childrenTopCount = 0;
|
|
2247
|
+
var hasDivider = false; // used to avoid overwriting the selected item ref in multiple mode
|
|
2248
|
+
|
|
2249
|
+
var foundSelected;
|
|
2250
|
+
var children = external_react_["Children"].toArray(_this.props.children).reduce(function (acc, item, i) {
|
|
2251
|
+
// ignore Headings and Dividers
|
|
2252
|
+
if (!isOption(item)) {
|
|
2253
|
+
acc.push(item);
|
|
2254
|
+
return acc;
|
|
2255
|
+
} // Find out if the search string exactly matches a value
|
|
2256
|
+
|
|
1678
2257
|
|
|
1679
|
-
if (item.props.value ===
|
|
2258
|
+
if (item.props.value === _this.state.filterKeyword) {
|
|
1680
2259
|
foundExactMatch = true;
|
|
1681
|
-
}
|
|
2260
|
+
}
|
|
1682
2261
|
|
|
2262
|
+
var selected = currentValues && currentValues.indexOf(item.props.value) >= 0; // Format the Menu.Item
|
|
1683
2263
|
|
|
1684
|
-
var
|
|
2264
|
+
var clonedItem = /*#__PURE__*/Object(external_react_["cloneElement"])(item, {
|
|
2265
|
+
key: item.key || i,
|
|
2266
|
+
onClick: _this.handleMenuOptionClick,
|
|
2267
|
+
selected: selected,
|
|
2268
|
+
multiple: multiple,
|
|
2269
|
+
role: 'option',
|
|
2270
|
+
ref: selected && !foundSelected ? _this.handleSelectedItemMount : undefined
|
|
2271
|
+
});
|
|
1685
2272
|
|
|
1686
|
-
if (
|
|
1687
|
-
|
|
1688
|
-
}
|
|
2273
|
+
if (selected) {
|
|
2274
|
+
foundSelected = true;
|
|
2275
|
+
}
|
|
1689
2276
|
|
|
2277
|
+
if (topValues && topValues.indexOf(item.props.value) >= 0) {
|
|
2278
|
+
if (childrenTopCount === 0) {
|
|
2279
|
+
acc.splice(childrenTopCount, 0, /*#__PURE__*/external_react_default.a.createElement(Menu_["Divider"], {
|
|
2280
|
+
key: "topDivider"
|
|
2281
|
+
}));
|
|
2282
|
+
hasDivider = true;
|
|
2283
|
+
}
|
|
1690
2284
|
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
var matchRangesCalc = itemSupportsMatchRanges && !controlledFilter && !matchRanges && keywords && Object(filter_["keywordLocations"])(label, keywords); // clone item
|
|
2285
|
+
acc.splice(childrenTopCount, 0, clonedItem);
|
|
2286
|
+
childrenTopCount += 1;
|
|
2287
|
+
} else {
|
|
2288
|
+
acc.push(clonedItem);
|
|
2289
|
+
}
|
|
1697
2290
|
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
onClick: _this3.handleMenuOptionClick,
|
|
1701
|
-
matchRanges: itemSupportsMatchRanges && (matchRanges || matchRangesCalc) || undefined
|
|
1702
|
-
});
|
|
1703
|
-
return clonedItem;
|
|
1704
|
-
}).filter(function (item) {
|
|
1705
|
-
return item !== null;
|
|
1706
|
-
}); // Add the option to add the new value
|
|
2291
|
+
return acc;
|
|
2292
|
+
}, []); // In multiple mode, add missing items
|
|
1707
2293
|
|
|
1708
|
-
if (
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
onClick: this.handleMenuOptionClick
|
|
1714
|
-
}));
|
|
1715
|
-
}
|
|
2294
|
+
if (multiple) {
|
|
2295
|
+
Object(external_lodash_["forEachRight"])(currentValues, function (value) {
|
|
2296
|
+
var matchedItem = Object(external_lodash_["find"])(children, function (item) {
|
|
2297
|
+
return isOption(item) && item.props && item.props.value === value;
|
|
2298
|
+
});
|
|
1716
2299
|
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
// ignore Headings and Dividers
|
|
1722
|
-
return childrenItem;
|
|
1723
|
-
}
|
|
2300
|
+
if (!matchedItem) {
|
|
2301
|
+
if (value === _this.state.filterKeyword) {
|
|
2302
|
+
foundExactMatch = true;
|
|
2303
|
+
}
|
|
1724
2304
|
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
_this3.availableOptionCount += 1;
|
|
2305
|
+
var isTopValue = topValues && topValues.indexOf(value) >= 0;
|
|
2306
|
+
var topLength = topValues.length;
|
|
1728
2307
|
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
2308
|
+
if (childrenTopCount === 0) {
|
|
2309
|
+
children.splice(0, 0, /*#__PURE__*/external_react_default.a.createElement(Menu_["Divider"], {
|
|
2310
|
+
key: "topDivider"
|
|
2311
|
+
}));
|
|
2312
|
+
childrenTopCount += 1;
|
|
2313
|
+
hasDivider = true;
|
|
2314
|
+
}
|
|
1732
2315
|
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
2316
|
+
children.splice(isTopValue ? 0 : topLength + 1, 0, /*#__PURE__*/external_react_default.a.createElement(OptionBase["a" /* default */], {
|
|
2317
|
+
label: String(value),
|
|
2318
|
+
value: value,
|
|
2319
|
+
key: "missing-value-".concat(value),
|
|
2320
|
+
onClick: _this.handleMenuOptionClick,
|
|
2321
|
+
multiple: multiple,
|
|
2322
|
+
selected: true
|
|
2323
|
+
}));
|
|
1736
2324
|
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
});
|
|
1742
|
-
return clonedItem;
|
|
2325
|
+
if (isTopValue) {
|
|
2326
|
+
childrenTopCount += 1;
|
|
2327
|
+
}
|
|
2328
|
+
}
|
|
1743
2329
|
});
|
|
1744
2330
|
}
|
|
1745
2331
|
|
|
1746
|
-
var
|
|
1747
|
-
return [/*#__PURE__*/external_react_default.a.createElement(StyledBox, Normal_extends({
|
|
1748
|
-
key: "control",
|
|
1749
|
-
"data-test-values": JSON.stringify(currentValues),
|
|
1750
|
-
inline: inline,
|
|
1751
|
-
$hasfocus: this.state.hasFocus
|
|
1752
|
-
}, external_lodash_["omit"].apply(void 0, [otherProps, 'animateLoading', 'controlledFilter', 'defaultValues', 'footerMessage', 'inputRef', 'isLoadingOptions', 'labelledBy', 'menuStyle', 'noOptionsMessage', 'onChange', 'onFilterChange', 'onScrollBottom', 'onClose', 'onOpen', 'values', 'useClickawayOverlay'].concat(Normal_toConsumableArray(Object(external_lodash_["keys"])(ariaProps)))), {
|
|
1753
|
-
onClick: disabled ? undefined : this.handleClick,
|
|
1754
|
-
$disabled: disabled,
|
|
1755
|
-
$error: error,
|
|
1756
|
-
"data-test-popover-id": this.popoverId,
|
|
1757
|
-
$popoverOpen: this.state.open,
|
|
1758
|
-
flex: true,
|
|
1759
|
-
elementRef: this.handleMount,
|
|
1760
|
-
role: "listbox",
|
|
1761
|
-
"aria-disabled": disabled || undefined
|
|
1762
|
-
}), this.renderButtons(selectedItems), !disabled && /*#__PURE__*/external_react_default.a.createElement(StyledInputWrapper, {
|
|
1763
|
-
role: "combobox",
|
|
1764
|
-
"aria-owns": this.state.open ? this.popoverId : undefined,
|
|
1765
|
-
"aria-haspopup": true,
|
|
1766
|
-
"aria-expanded": this.state.open
|
|
1767
|
-
}, /*#__PURE__*/external_react_default.a.createElement(StyledInput, Normal_extends({
|
|
1768
|
-
"data-test": "textbox",
|
|
1769
|
-
ref: this.handleInputMount,
|
|
1770
|
-
onBlur: this.handleInputBlur,
|
|
1771
|
-
onFocus: this.handleInputFocus,
|
|
1772
|
-
onChange: this.handleInputChange,
|
|
1773
|
-
onKeyDown: this.handleInputKeyDown,
|
|
1774
|
-
value: this.state.filterKeyword,
|
|
1775
|
-
autoCapitalize: "off",
|
|
1776
|
-
autoComplete: "off",
|
|
1777
|
-
autoCorrect: "off",
|
|
1778
|
-
spellCheck: false,
|
|
1779
|
-
"aria-autocomplete": "list",
|
|
1780
|
-
style: {
|
|
1781
|
-
flexBasis: inputWidth,
|
|
1782
|
-
width: inputWidth
|
|
1783
|
-
},
|
|
1784
|
-
placeholder: currentValues.length ? '' : placeholder,
|
|
1785
|
-
"aria-activedescendant": this.state.open && this.availableOptionCount > 0 ? this.activeItemId : undefined,
|
|
1786
|
-
"aria-controls": this.state.open ? this.popoverId : undefined
|
|
1787
|
-
}, ariaProps))), !disabled && /*#__PURE__*/external_react_default.a.createElement(Popover_default.a, {
|
|
1788
|
-
open: this.state.open && !!this.state.el,
|
|
1789
|
-
autoCloseWhenOffScreen: true,
|
|
1790
|
-
anchor: this.state.el,
|
|
1791
|
-
onRequestClose: this.handleRequestClose,
|
|
1792
|
-
canCoverAnchor: false,
|
|
1793
|
-
defaultPlacement: defaultPlacement,
|
|
1794
|
-
repositionMode: "flip",
|
|
1795
|
-
id: this.popoverId
|
|
1796
|
-
}, this.renderMenu)), useClickawayOverlay && this.state.open ? /*#__PURE__*/external_react_default.a.createElement(StyledOverlay, {
|
|
1797
|
-
key: "overlay",
|
|
1798
|
-
$popoveropen: this.state.open,
|
|
1799
|
-
"data-test": "overlay"
|
|
1800
|
-
}) : null];
|
|
1801
|
-
}
|
|
1802
|
-
}]);
|
|
2332
|
+
var controlledFilter = filter === 'controlled'; // Filter the items
|
|
1803
2333
|
|
|
1804
|
-
|
|
1805
|
-
|
|
2334
|
+
var keywords = Object(filter_["stringToKeywords"])(filterKeyword);
|
|
2335
|
+
children = controlledFilter ? children : children.filter(function (option) {
|
|
2336
|
+
if (isOption(option)) {
|
|
2337
|
+
return Object(filter_["testPhrase"])(option.props.label, keywords);
|
|
2338
|
+
}
|
|
1806
2339
|
|
|
1807
|
-
|
|
2340
|
+
return true; // Keep all headers and non-interactive options
|
|
2341
|
+
}) // highlight the matched text
|
|
2342
|
+
.map(function (option) {
|
|
2343
|
+
if (!isOption(option)) {
|
|
2344
|
+
return option;
|
|
2345
|
+
} // highlight matched text
|
|
1808
2346
|
|
|
1809
|
-
Normal_defineProperty(Normal_Normal, "defaultProps", Normal_defaultProps);
|
|
1810
2347
|
|
|
1811
|
-
|
|
2348
|
+
var matchRanges = keywords && Object(filter_["keywordLocations"])(option.props.label, keywords);
|
|
2349
|
+
return /*#__PURE__*/Object(external_react_["cloneElement"])(option, {
|
|
2350
|
+
matchRanges: matchRanges || undefined
|
|
2351
|
+
});
|
|
2352
|
+
}); // Add the option to add the new value
|
|
1812
2353
|
|
|
1813
|
-
|
|
2354
|
+
if (allowNewValues && !foundExactMatch && filterKeyword) {
|
|
2355
|
+
var insertIndex = hasDivider ? childrenTopCount + 1 : childrenTopCount;
|
|
2356
|
+
children.splice(insertIndex, 0, /*#__PURE__*/external_react_default.a.createElement(OptionBase["a" /* default */], {
|
|
2357
|
+
label: "".concat(filterKeyword, " (new value)"),
|
|
2358
|
+
value: filterKeyword,
|
|
2359
|
+
key: "newValue",
|
|
2360
|
+
multiple: multiple,
|
|
2361
|
+
onClick: _this.handleMenuOptionClick
|
|
2362
|
+
}));
|
|
2363
|
+
} // Highlight the selected Items and remove hidden
|
|
1814
2364
|
|
|
1815
|
-
Normal_defineProperty(Normal_Normal, "Heading", Menu_["Heading"]);
|
|
1816
2365
|
|
|
1817
|
-
|
|
1818
|
-
//
|
|
1819
|
-
|
|
2366
|
+
children = children.reduce(function (acc, item) {
|
|
2367
|
+
// ignore Dividers & Headings
|
|
2368
|
+
if (!isOption(item)) {
|
|
2369
|
+
acc.push(item);
|
|
2370
|
+
return acc;
|
|
2371
|
+
} // Ignore any hidden items
|
|
1820
2372
|
|
|
1821
|
-
function Multiselect_extends() { Multiselect_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Multiselect_extends.apply(this, arguments); }
|
|
1822
2373
|
|
|
1823
|
-
|
|
2374
|
+
if (item.props && item.props.hidden) {
|
|
2375
|
+
return acc;
|
|
2376
|
+
}
|
|
1824
2377
|
|
|
1825
|
-
|
|
2378
|
+
if (item.props.selected && !item.props.disabled && _this.firstSelectedOptionIndex == null) {
|
|
2379
|
+
_this.firstSelectedOptionIndex = _this.availableOptionCount;
|
|
2380
|
+
}
|
|
1826
2381
|
|
|
1827
|
-
|
|
2382
|
+
var active = _this.availableOptionCount === _this.state.activeIndex;
|
|
2383
|
+
_this.availableOptionCount += 1;
|
|
2384
|
+
_this.selectedOptionCount += item.props.selected ? 1 : 0;
|
|
1828
2385
|
|
|
1829
|
-
|
|
2386
|
+
if (!active || !textHasFocus) {
|
|
2387
|
+
acc.push(item);
|
|
2388
|
+
return acc;
|
|
2389
|
+
}
|
|
1830
2390
|
|
|
1831
|
-
|
|
2391
|
+
if (!item.props.disabled) {
|
|
2392
|
+
_this.activeValue = item.props.value;
|
|
2393
|
+
}
|
|
1832
2394
|
|
|
1833
|
-
|
|
2395
|
+
var clonedItem = /*#__PURE__*/Object(external_react_["cloneElement"])(item, {
|
|
2396
|
+
active: active,
|
|
2397
|
+
id: _this.activeItemId,
|
|
2398
|
+
ref: _this.handleActiveOptionMount
|
|
2399
|
+
});
|
|
2400
|
+
acc.push(clonedItem);
|
|
2401
|
+
return acc;
|
|
2402
|
+
}, []);
|
|
2403
|
+
_this.displayedValues = children.reduce(function (acc, item) {
|
|
2404
|
+
if (isOption(item)) {
|
|
2405
|
+
acc.push(item.props.value);
|
|
2406
|
+
}
|
|
1834
2407
|
|
|
1835
|
-
|
|
2408
|
+
return acc;
|
|
2409
|
+
}, []);
|
|
2410
|
+
return children;
|
|
2411
|
+
});
|
|
1836
2412
|
|
|
1837
|
-
|
|
2413
|
+
_defineProperty(_assertThisInitialized(_this), "wrapLabel", function (_ref3) {
|
|
2414
|
+
var prefixLabel = _ref3.prefixLabel,
|
|
2415
|
+
label = _ref3.label,
|
|
2416
|
+
suffixLabel = _ref3.suffixLabel;
|
|
2417
|
+
var wrappedLabel = label;
|
|
1838
2418
|
|
|
1839
|
-
|
|
2419
|
+
if (prefixLabel) {
|
|
2420
|
+
wrappedLabel = ["".concat(prefixLabel, ": ")].concat(wrappedLabel);
|
|
2421
|
+
}
|
|
1840
2422
|
|
|
1841
|
-
|
|
2423
|
+
if (suffixLabel) {
|
|
2424
|
+
wrappedLabel = Object(external_lodash_["castArray"])(wrappedLabel).concat(" ".concat(suffixLabel));
|
|
2425
|
+
}
|
|
1842
2426
|
|
|
1843
|
-
|
|
2427
|
+
return wrappedLabel;
|
|
2428
|
+
});
|
|
2429
|
+
|
|
2430
|
+
_this.state = {
|
|
2431
|
+
activeIndex: 0,
|
|
2432
|
+
filterKeyword: '',
|
|
2433
|
+
open: false,
|
|
2434
|
+
textHasFocus: false,
|
|
2435
|
+
topValues: [],
|
|
2436
|
+
values: props.defaultValues || []
|
|
2437
|
+
};
|
|
2438
|
+
_this.controlledExternally = Object(external_lodash_["has"])(props, 'values');
|
|
2439
|
+
_this.displayedValues = [];
|
|
2440
|
+
_this.availableOptionCount = 0;
|
|
2441
|
+
_this.firstSelectedOptionIndex = undefined;
|
|
2442
|
+
_this.selectedOptionCount = 0;
|
|
1844
2443
|
|
|
2444
|
+
if (false) {}
|
|
1845
2445
|
|
|
2446
|
+
if (false) {}
|
|
1846
2447
|
|
|
2448
|
+
SelectBase.validateAppearance(props);
|
|
2449
|
+
_this.menuId = Object(id_["createDOMID"])('menu');
|
|
2450
|
+
_this.activeItemId = Object(id_["createDOMID"])('active-item');
|
|
2451
|
+
return _this;
|
|
2452
|
+
}
|
|
1847
2453
|
|
|
2454
|
+
_createClass(SelectBase, [{
|
|
2455
|
+
key: "componentDidUpdate",
|
|
2456
|
+
value: function componentDidUpdate(prevProps) {
|
|
2457
|
+
if (false) {}
|
|
1848
2458
|
|
|
2459
|
+
if (false) {}
|
|
1849
2460
|
|
|
2461
|
+
SelectBase.validateAppearance(this.props);
|
|
2462
|
+
}
|
|
2463
|
+
}, {
|
|
2464
|
+
key: "getCurrentValues",
|
|
2465
|
+
value: function getCurrentValues() {
|
|
2466
|
+
var values = this.isControlled() ? this.props.values : this.state.values;
|
|
2467
|
+
return this.props.multiple || values == null ? values : values.slice(0, 1);
|
|
2468
|
+
}
|
|
2469
|
+
}, {
|
|
2470
|
+
key: "isControlled",
|
|
2471
|
+
value: function isControlled() {
|
|
2472
|
+
return this.controlledExternally;
|
|
2473
|
+
}
|
|
2474
|
+
}, {
|
|
2475
|
+
key: "hasFilter",
|
|
2476
|
+
value: function hasFilter() {
|
|
2477
|
+
return !!this.props.filter;
|
|
2478
|
+
}
|
|
2479
|
+
}, {
|
|
2480
|
+
key: "toggleValue",
|
|
2481
|
+
value: function toggleValue(e, value) {
|
|
2482
|
+
var _this$getCurrentValue4, _this$props$onChange3, _this$props12;
|
|
1850
2483
|
|
|
2484
|
+
var values = (_this$getCurrentValue4 = this.getCurrentValues()) !== null && _this$getCurrentValue4 !== void 0 ? _this$getCurrentValue4 : [];
|
|
2485
|
+
var currentIndex = values.indexOf(value);
|
|
2486
|
+
var _this$props11 = this.props,
|
|
2487
|
+
name = _this$props11.name,
|
|
2488
|
+
multiple = _this$props11.multiple;
|
|
2489
|
+
var newValues;
|
|
1851
2490
|
|
|
2491
|
+
if (multiple) {
|
|
2492
|
+
if (currentIndex >= 0) {
|
|
2493
|
+
newValues = [].concat(_toConsumableArray(values.slice(0, currentIndex)), _toConsumableArray(values.slice(currentIndex + 1)));
|
|
2494
|
+
} else {
|
|
2495
|
+
newValues = values.concat([value]);
|
|
2496
|
+
}
|
|
2497
|
+
} else {
|
|
2498
|
+
// non-multiple mode must always have a value
|
|
2499
|
+
newValues = [value];
|
|
2500
|
+
}
|
|
1852
2501
|
|
|
1853
|
-
var
|
|
1854
|
-
allowNewValues: external_prop_types_default.a.bool,
|
|
1855
|
-
animateLoading: external_prop_types_default.a.bool,
|
|
1856
|
-
children: external_prop_types_default.a.node,
|
|
1857
|
-
compact: external_prop_types_default.a.bool,
|
|
1858
|
-
controlledFilter: external_prop_types_default.a.bool,
|
|
1859
|
-
defaultPlacement: external_prop_types_default.a.oneOf(['above', 'below', 'vertical']),
|
|
1860
|
-
defaultValues: external_prop_types_default.a.array,
|
|
1861
|
-
describedBy: external_prop_types_default.a.string,
|
|
1862
|
-
disabled: external_prop_types_default.a.bool,
|
|
1863
|
-
elementRef: external_prop_types_default.a.oneOfType([external_prop_types_default.a.func, external_prop_types_default.a.object]),
|
|
1864
|
-
error: external_prop_types_default.a.bool,
|
|
1865
|
-
footerMessage: external_prop_types_default.a.node,
|
|
1866
|
-
inline: external_prop_types_default.a.bool,
|
|
1867
|
-
inputRef: external_prop_types_default.a.oneOfType([external_prop_types_default.a.func, external_prop_types_default.a.object]),
|
|
1868
|
-
isLoadingOptions: external_prop_types_default.a.bool,
|
|
1869
|
-
labelledBy: external_prop_types_default.a.string,
|
|
1870
|
-
loadingMessage: external_prop_types_default.a.node,
|
|
1871
|
-
menuStyle: external_prop_types_default.a.object,
|
|
1872
|
-
name: external_prop_types_default.a.string,
|
|
1873
|
-
noOptionsMessage: external_prop_types_default.a.node,
|
|
1874
|
-
onChange: external_prop_types_default.a.func,
|
|
1875
|
-
onClose: external_prop_types_default.a.func,
|
|
1876
|
-
onFilterChange: external_prop_types_default.a.func,
|
|
1877
|
-
onOpen: external_prop_types_default.a.func,
|
|
1878
|
-
onScrollBottom: external_prop_types_default.a.func,
|
|
1879
|
-
placeholder: external_prop_types_default.a.string,
|
|
1880
|
-
tabConfirmsNewValue: external_prop_types_default.a.bool,
|
|
1881
|
-
useClickawayOverlay: external_prop_types_default.a.bool,
|
|
1882
|
-
values: external_prop_types_default.a.array
|
|
1883
|
-
};
|
|
1884
|
-
var Multiselect_defaultProps = {
|
|
1885
|
-
allowNewValues: false,
|
|
1886
|
-
animateLoading: false,
|
|
1887
|
-
compact: false,
|
|
1888
|
-
defaultPlacement: 'vertical',
|
|
1889
|
-
disabled: false,
|
|
1890
|
-
inline: false,
|
|
1891
|
-
isLoadingOptions: false,
|
|
1892
|
-
menuStyle: {},
|
|
1893
|
-
noOptionsMessage: Object(i18n_["_"])('No matches'),
|
|
1894
|
-
placeholder: Object(i18n_["_"])('Select...'),
|
|
1895
|
-
tabConfirmsNewValue: false,
|
|
1896
|
-
useClickawayOverlay: false
|
|
1897
|
-
};
|
|
2502
|
+
var uncontrolled = !this.isControlled();
|
|
1898
2503
|
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
2504
|
+
if (uncontrolled) {
|
|
2505
|
+
this.setState({
|
|
2506
|
+
values: newValues
|
|
2507
|
+
});
|
|
2508
|
+
}
|
|
1902
2509
|
|
|
1903
|
-
|
|
1904
|
-
|
|
2510
|
+
if (multiple) {
|
|
2511
|
+
// in uncontrolled multiple mode, keep the menu open
|
|
2512
|
+
if (uncontrolled) {
|
|
2513
|
+
this.setState({
|
|
2514
|
+
open: true
|
|
2515
|
+
});
|
|
2516
|
+
}
|
|
2517
|
+
} else {
|
|
2518
|
+
// non-multiple mode only supports a single selection
|
|
2519
|
+
// so close the menu once a selection is made
|
|
2520
|
+
this.handleRequestClose({
|
|
2521
|
+
reason: 'contentClick'
|
|
2522
|
+
});
|
|
2523
|
+
this.focus();
|
|
2524
|
+
}
|
|
1905
2525
|
|
|
1906
|
-
|
|
2526
|
+
(_this$props$onChange3 = (_this$props12 = this.props).onChange) === null || _this$props$onChange3 === void 0 ? void 0 : _this$props$onChange3.call(_this$props12, e, {
|
|
2527
|
+
values: newValues,
|
|
2528
|
+
name: name
|
|
2529
|
+
});
|
|
2530
|
+
}
|
|
2531
|
+
/**
|
|
2532
|
+
* Place focus on the toggle.
|
|
2533
|
+
*/
|
|
1907
2534
|
|
|
1908
|
-
|
|
1909
|
-
|
|
2535
|
+
}, {
|
|
2536
|
+
key: "focus",
|
|
2537
|
+
value: function focus() {
|
|
2538
|
+
var _this$dropdown;
|
|
1910
2539
|
|
|
1911
|
-
|
|
1912
|
-
|
|
2540
|
+
(_this$dropdown = this.dropdown) === null || _this$dropdown === void 0 ? void 0 : _this$dropdown.focus();
|
|
2541
|
+
}
|
|
2542
|
+
}, {
|
|
2543
|
+
key: "renderControls",
|
|
2544
|
+
value: function renderControls(_ref4) {
|
|
2545
|
+
var hasChildren = _ref4.hasChildren,
|
|
2546
|
+
placement = _ref4.placement;
|
|
2547
|
+
var filterKeyword = this.state.filterKeyword;
|
|
2548
|
+
var _this$props13 = this.props,
|
|
2549
|
+
inputId = _this$props13.inputId,
|
|
2550
|
+
inputRef = _this$props13.inputRef,
|
|
2551
|
+
multiple = _this$props13.multiple; // only visually disable these as opposed to fully disabling to avoid losing keyboard focus - see SUI-2731
|
|
1913
2552
|
|
|
1914
|
-
|
|
2553
|
+
var selectControls = /*#__PURE__*/external_react_default.a.createElement(StyledToggleAllControls, {
|
|
2554
|
+
$placement: placement,
|
|
2555
|
+
key: "selectAll"
|
|
2556
|
+
}, /*#__PURE__*/external_react_default.a.createElement(StyledControlsLink, {
|
|
2557
|
+
$disabled: !(this.availableOptionCount - this.selectedOptionCount),
|
|
2558
|
+
onClick: this.handleSelectAll,
|
|
2559
|
+
"data-test": "select-all",
|
|
2560
|
+
style: {
|
|
2561
|
+
marginRight: 20
|
|
2562
|
+
}
|
|
2563
|
+
}, filterKeyword ? Object(i18n_["_"])('Select All Matches') : Object(i18n_["_"])('Select All')), /*#__PURE__*/external_react_default.a.createElement(StyledControlsLink, {
|
|
2564
|
+
$disabled: !this.selectedOptionCount,
|
|
2565
|
+
onClick: this.handleClearAll,
|
|
2566
|
+
"data-test": "clear-all"
|
|
2567
|
+
}, filterKeyword ? Object(i18n_["_"])('Clear All Matches') : Object(i18n_["_"])('Clear All')));
|
|
2568
|
+
return this.hasFilter() && /*#__PURE__*/external_react_default.a.createElement("div", {
|
|
2569
|
+
key: "controls"
|
|
2570
|
+
}, /*#__PURE__*/external_react_default.a.createElement(StyledFilter, {
|
|
2571
|
+
key: "filter",
|
|
2572
|
+
"data-test": "filter"
|
|
2573
|
+
}, /*#__PURE__*/external_react_default.a.createElement(Text_default.a, {
|
|
2574
|
+
value: filterKeyword,
|
|
2575
|
+
appearance: "search",
|
|
2576
|
+
autoCapitalize: "off",
|
|
2577
|
+
autoComplete: "off",
|
|
2578
|
+
autoCorrect: "off",
|
|
2579
|
+
spellCheck: false,
|
|
2580
|
+
onChange: this.handleTextChange,
|
|
2581
|
+
onKeyDown: this.handleTextKeyDown,
|
|
2582
|
+
onFocus: this.handleTextFocus,
|
|
2583
|
+
onBlur: this.handleTextBlur,
|
|
2584
|
+
placeholder: Object(i18n_["_"])('filter'),
|
|
2585
|
+
role: "combobox",
|
|
2586
|
+
"aria-expanded": "true",
|
|
2587
|
+
"aria-label": Object(i18n_["_"])('Filter'),
|
|
2588
|
+
"aria-activedescendant": this.activeItemId,
|
|
2589
|
+
"aria-controls": this.menuId,
|
|
2590
|
+
inputRef: inputRef,
|
|
2591
|
+
inputId: inputId
|
|
2592
|
+
})), multiple && hasChildren && selectControls);
|
|
2593
|
+
}
|
|
2594
|
+
}, {
|
|
1915
2595
|
key: "render",
|
|
1916
|
-
// @docs-props-type MultiselectPropsBase
|
|
1917
2596
|
value: function render() {
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
2597
|
+
var _this$getCurrentValue5,
|
|
2598
|
+
_this2 = this;
|
|
2599
|
+
|
|
2600
|
+
var _this$props14 = this.props,
|
|
2601
|
+
appearance = _this$props14.appearance,
|
|
2602
|
+
children = _this$props14.children,
|
|
2603
|
+
defaultPlacement = _this$props14.defaultPlacement,
|
|
2604
|
+
describedBy = _this$props14.describedBy,
|
|
2605
|
+
disabled = _this$props14.disabled,
|
|
2606
|
+
elementRef = _this$props14.elementRef,
|
|
2607
|
+
error = _this$props14.error,
|
|
2608
|
+
inline = _this$props14.inline,
|
|
2609
|
+
inputId = _this$props14.inputId,
|
|
2610
|
+
labelledBy = _this$props14.labelledBy,
|
|
2611
|
+
labelText = _this$props14.labelText,
|
|
2612
|
+
multiple = _this$props14.multiple,
|
|
2613
|
+
placeholder = _this$props14.placeholder,
|
|
2614
|
+
prefixLabel = _this$props14.prefixLabel,
|
|
2615
|
+
suffixLabel = _this$props14.suffixLabel;
|
|
2616
|
+
var icon;
|
|
2617
|
+
var label;
|
|
2618
|
+
var filterEnabled = this.hasFilter();
|
|
2619
|
+
var isAnyValueSelected = false; // Generate buttonLabels
|
|
1923
2620
|
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
2621
|
+
var childrenArray = external_react_["Children"].toArray(children);
|
|
2622
|
+
var currentValues = (_this$getCurrentValue5 = this.getCurrentValues()) !== null && _this$getCurrentValue5 !== void 0 ? _this$getCurrentValue5 : [];
|
|
2623
|
+
var valuesLabel = currentValues.reduce(function (acc, value, index, orig) {
|
|
2624
|
+
var matchedItem = Object(external_lodash_["find"])(childrenArray, function (item) {
|
|
2625
|
+
return isOption(item) && item.props.value === value;
|
|
2626
|
+
});
|
|
1929
2627
|
|
|
1930
|
-
|
|
1931
|
-
|
|
2628
|
+
if (matchedItem) {
|
|
2629
|
+
acc.push(matchedItem.props.children || matchedItem.props.label); // if not in multiple mode, add the icon
|
|
1932
2630
|
|
|
1933
|
-
|
|
2631
|
+
if (!multiple && currentValues.length === 1) {
|
|
2632
|
+
icon = matchedItem.props.icon;
|
|
2633
|
+
}
|
|
2634
|
+
} else if (multiple) {
|
|
2635
|
+
// only add values that don't match an option in "multiple" mode to preserve old behaviour
|
|
2636
|
+
acc.push(value);
|
|
2637
|
+
}
|
|
1934
2638
|
|
|
1935
|
-
|
|
2639
|
+
if (index < orig.length - 1) {
|
|
2640
|
+
acc.push(Object(i18n_["_"])(', '));
|
|
2641
|
+
}
|
|
1936
2642
|
|
|
1937
|
-
|
|
2643
|
+
return acc;
|
|
2644
|
+
}, []);
|
|
2645
|
+
label = valuesLabel; // only apply prefix / suffix if the label is not empty
|
|
2646
|
+
|
|
2647
|
+
if (label.length > 0) {
|
|
2648
|
+
isAnyValueSelected = true;
|
|
2649
|
+
label = this.wrapLabel({
|
|
2650
|
+
prefixLabel: prefixLabel,
|
|
2651
|
+
label: label,
|
|
2652
|
+
suffixLabel: suffixLabel
|
|
2653
|
+
});
|
|
2654
|
+
} // single <Select> behaviour is to show the placeholder if all parts of the the label
|
|
2655
|
+
// are empty strings so we replicate this behaviour here
|
|
1938
2656
|
|
|
1939
|
-
Multiselect_defineProperty(Multiselect_Multiselect, "Heading", Menu_["Heading"]);
|
|
1940
2657
|
|
|
1941
|
-
|
|
2658
|
+
if (label.length === 0 || !multiple && label.every(function (labelNode) {
|
|
2659
|
+
return labelNode === '';
|
|
2660
|
+
})) {
|
|
2661
|
+
label = [placeholder];
|
|
2662
|
+
}
|
|
1942
2663
|
|
|
1943
|
-
|
|
2664
|
+
var ariaLabel = label; // If there's more than one item selected, read out the selected total
|
|
2665
|
+
// rather than reading out each selected item
|
|
1944
2666
|
|
|
1945
|
-
|
|
2667
|
+
if (label.length > 1) {
|
|
2668
|
+
ariaLabel = this.wrapLabel({
|
|
2669
|
+
prefixLabel: prefixLabel,
|
|
2670
|
+
label: ["".concat(currentValues.length, " items selected")],
|
|
2671
|
+
suffixLabel: suffixLabel
|
|
2672
|
+
});
|
|
2673
|
+
}
|
|
1946
2674
|
|
|
2675
|
+
var finalChildren = this.createChildren();
|
|
1947
2676
|
|
|
2677
|
+
var commonProps = _objectSpread({
|
|
2678
|
+
'aria-describedby': describedBy,
|
|
2679
|
+
'aria-label': "".concat(labelText ? "".concat(labelText, ", ") : '').concat(ariaLabel),
|
|
2680
|
+
'aria-labelledby': labelText ? undefined : labelledBy,
|
|
2681
|
+
'aria-multiselectable': multiple,
|
|
2682
|
+
'data-select-appearance': appearance,
|
|
2683
|
+
'data-test': multiple ? 'multiselect' : 'select',
|
|
2684
|
+
disabled: disabled,
|
|
2685
|
+
elementRef: elementRef,
|
|
2686
|
+
error: error
|
|
2687
|
+
}, Object(external_lodash_["omit"])(this.props, Object(external_lodash_["keys"])(SelectBase.propTypes)));
|
|
2688
|
+
|
|
2689
|
+
if (multiple) {
|
|
2690
|
+
commonProps['data-test-values'] = JSON.stringify(currentValues);
|
|
2691
|
+
} else {
|
|
2692
|
+
var _currentValues = _slicedToArray(currentValues, 1),
|
|
2693
|
+
dataTestValue = _currentValues[0];
|
|
1948
2694
|
|
|
1949
|
-
|
|
2695
|
+
commonProps['data-test-value'] = dataTestValue;
|
|
2696
|
+
}
|
|
1950
2697
|
|
|
1951
|
-
|
|
1952
|
-
|
|
2698
|
+
var toggle = appearance === 'link' ? /*#__PURE__*/external_react_default.a.createElement(Link_default.a, _extends({}, commonProps, {
|
|
2699
|
+
"data-select-appearance": "link"
|
|
2700
|
+
}), !!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 */], {
|
|
2701
|
+
enterpriseSize: 0.5,
|
|
2702
|
+
prismaSize: "small"
|
|
2703
|
+
}))) : /*#__PURE__*/external_react_default.a.createElement(StyledButton, _extends({}, commonProps, {
|
|
2704
|
+
$multiple: multiple,
|
|
2705
|
+
appearance: appearance,
|
|
2706
|
+
label: label,
|
|
2707
|
+
error: error,
|
|
2708
|
+
icon: icon,
|
|
2709
|
+
inline: inline,
|
|
2710
|
+
isMenu: true,
|
|
2711
|
+
role: "listbox" // @ts-expect-error - accept inconsistency with Button
|
|
2712
|
+
,
|
|
2713
|
+
onClick: this.props.onClick
|
|
2714
|
+
}, Object(external_lodash_["pick"])(this.props, SelectBase.invalidLinkAppearanceProps)), !!currentValues.length && multiple && /*#__PURE__*/external_react_default.a.createElement(StyledCount, {
|
|
2715
|
+
"data-role": "count"
|
|
2716
|
+
}, "(", currentValues.length, ")"));
|
|
1953
2717
|
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
2718
|
+
var createMenu = function createMenu(_ref5) {
|
|
2719
|
+
var anchorWidth = _ref5.anchorWidth,
|
|
2720
|
+
maxHeight = _ref5.maxHeight,
|
|
2721
|
+
placement = _ref5.placement;
|
|
2722
|
+
// preserve separate widths for single vs. multi mode
|
|
2723
|
+
var internalMenuStyle = _this2.props.multiple ? {
|
|
2724
|
+
width: Math.max(anchorWidth !== null && anchorWidth !== void 0 ? anchorWidth : 0, 200)
|
|
2725
|
+
} : {
|
|
2726
|
+
minWidth: anchorWidth !== null && anchorWidth !== void 0 ? anchorWidth : undefined,
|
|
2727
|
+
maxWidth: Math.max(anchorWidth !== null && anchorWidth !== void 0 ? anchorWidth : 0, 300)
|
|
2728
|
+
};
|
|
2729
|
+
return /*#__PURE__*/external_react_default.a.createElement(ResultsMenu_default.a, _extends({
|
|
2730
|
+
"aria-multiselectable": multiple,
|
|
2731
|
+
childrenStart: _this2.renderControls({
|
|
2732
|
+
placement: placement,
|
|
2733
|
+
hasChildren: !!finalChildren.length
|
|
2734
|
+
}),
|
|
2735
|
+
controlledExternally: _this2.hasFilter(),
|
|
2736
|
+
placement: placement !== null && placement !== void 0 ? placement : undefined,
|
|
2737
|
+
maxHeight: maxHeight !== null && maxHeight !== void 0 ? maxHeight : undefined,
|
|
2738
|
+
onScrollBottom: _this2.props.onScrollBottom ? _this2.handleScrollBottom : undefined,
|
|
2739
|
+
"data-test": "results-menu",
|
|
2740
|
+
isLoading: _this2.props.isLoadingOptions,
|
|
2741
|
+
id: _this2.menuId
|
|
2742
|
+
}, Object(external_lodash_["pick"])(_this2.props, 'noOptionsMessage', 'footerMessage', 'animateLoading', 'loadingMessage'), {
|
|
2743
|
+
style: _objectSpread(_objectSpread({}, internalMenuStyle), _this2.props.menuStyle)
|
|
2744
|
+
}), finalChildren);
|
|
2745
|
+
};
|
|
2746
|
+
|
|
2747
|
+
return /*#__PURE__*/external_react_default.a.createElement(Dropdown_default.a, {
|
|
2748
|
+
closeReasons: ['clickAway', 'escapeKey', 'offScreen', 'tabKey', 'toggleClick'],
|
|
2749
|
+
inputId: inputId,
|
|
2750
|
+
toggle: toggle,
|
|
2751
|
+
onRequestOpen: this.handleRequestOpen,
|
|
2752
|
+
onRequestClose: this.handleRequestClose,
|
|
2753
|
+
open: this.state.open,
|
|
2754
|
+
repositionMode: "flip",
|
|
2755
|
+
defaultPlacement: filterEnabled ? defaultPlacement : undefined,
|
|
2756
|
+
canCoverAnchor: window.innerHeight < 500,
|
|
2757
|
+
ref: function ref(c) {
|
|
2758
|
+
_this2.dropdown = c;
|
|
2759
|
+
},
|
|
2760
|
+
retainFocus: false,
|
|
2761
|
+
takeFocus: !isAnyValueSelected || !!filterEnabled
|
|
2762
|
+
}, createMenu);
|
|
1970
2763
|
}
|
|
1971
|
-
}
|
|
1972
|
-
}
|
|
2764
|
+
}]);
|
|
1973
2765
|
|
|
2766
|
+
return SelectBase;
|
|
2767
|
+
}(external_react_["Component"]);
|
|
1974
2768
|
|
|
2769
|
+
_defineProperty(SelectBase_SelectBase, "propTypes", propTypes);
|
|
1975
2770
|
|
|
1976
|
-
|
|
2771
|
+
_defineProperty(SelectBase_SelectBase, "defaultProps", defaultProps);
|
|
1977
2772
|
|
|
1978
|
-
|
|
1979
|
-
/***/ (function(module, exports) {
|
|
2773
|
+
_defineProperty(SelectBase_SelectBase, "Option", OptionBase["a" /* default */]);
|
|
1980
2774
|
|
|
1981
|
-
|
|
2775
|
+
_defineProperty(SelectBase_SelectBase, "Divider", Menu_["Divider"]);
|
|
1982
2776
|
|
|
1983
|
-
|
|
2777
|
+
_defineProperty(SelectBase_SelectBase, "Heading", Menu_["Heading"]);
|
|
1984
2778
|
|
|
1985
|
-
|
|
1986
|
-
|
|
2779
|
+
_defineProperty(SelectBase_SelectBase, "invalidLinkAppearanceProps", ['append', 'error', 'prepend']);
|
|
2780
|
+
|
|
2781
|
+
/* harmony default export */ var Select_SelectBase = __webpack_exports__["c"] = (SelectBase_SelectBase);
|
|
1987
2782
|
|
|
1988
|
-
module.exports = require("@splunk/react-ui/Dropdown");
|
|
1989
2783
|
|
|
1990
2784
|
/***/ }),
|
|
1991
2785
|
|
|
1992
|
-
/***/
|
|
2786
|
+
/***/ 5:
|
|
1993
2787
|
/***/ (function(module, exports) {
|
|
1994
2788
|
|
|
1995
|
-
module.exports = require("@splunk/
|
|
2789
|
+
module.exports = require("@splunk/ui-utils/i18n");
|
|
1996
2790
|
|
|
1997
2791
|
/***/ }),
|
|
1998
2792
|
|
|
1999
|
-
/***/
|
|
2000
|
-
/***/ (function(module,
|
|
2793
|
+
/***/ 6:
|
|
2794
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
2001
2795
|
|
|
2002
|
-
|
|
2796
|
+
"use strict";
|
|
2797
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SVG; });
|
|
2798
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
|
2799
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
2800
|
+
/* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3);
|
|
2801
|
+
/* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(styled_components__WEBPACK_IMPORTED_MODULE_1__);
|
|
2802
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2003
2803
|
|
|
2004
|
-
/***/ }),
|
|
2005
2804
|
|
|
2006
|
-
/***/ 2:
|
|
2007
|
-
/***/ (function(module, exports) {
|
|
2008
2805
|
|
|
2009
|
-
|
|
2806
|
+
var Styled = styled_components__WEBPACK_IMPORTED_MODULE_1___default.a.svg.withConfig({
|
|
2807
|
+
displayName: "SVG__Styled",
|
|
2808
|
+
componentId: "sc-1bz0ryh-0"
|
|
2809
|
+
})(["flex:0 0 auto;"]);
|
|
2810
|
+
function SVG(props) {
|
|
2811
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(Styled, _extends({
|
|
2812
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
2813
|
+
}, props));
|
|
2814
|
+
}
|
|
2010
2815
|
|
|
2011
2816
|
/***/ }),
|
|
2012
2817
|
|
|
2013
|
-
/***/
|
|
2014
|
-
/***/ (function(module,
|
|
2015
|
-
|
|
2016
|
-
module.exports = require("@splunk/ui-utils/filter");
|
|
2818
|
+
/***/ 7:
|
|
2819
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
2017
2820
|
|
|
2018
|
-
|
|
2821
|
+
"use strict";
|
|
2822
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Icon; });
|
|
2823
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
|
2824
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
2825
|
+
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
|
|
2826
|
+
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);
|
|
2827
|
+
/* harmony import */ var _splunk_themes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(0);
|
|
2828
|
+
/* harmony import */ var _splunk_themes__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_splunk_themes__WEBPACK_IMPORTED_MODULE_2__);
|
|
2829
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
2019
2830
|
|
|
2020
|
-
|
|
2021
|
-
/***/ (function(module, exports) {
|
|
2831
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
2022
2832
|
|
|
2023
|
-
|
|
2833
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2024
2834
|
|
|
2025
|
-
|
|
2835
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2026
2836
|
|
|
2027
|
-
|
|
2028
|
-
/***/ (function(module, exports) {
|
|
2837
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
2029
2838
|
|
|
2030
|
-
|
|
2839
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
2031
2840
|
|
|
2032
|
-
/***/ }),
|
|
2033
2841
|
|
|
2034
|
-
/***/ 32:
|
|
2035
|
-
/***/ (function(module, exports) {
|
|
2036
2842
|
|
|
2037
|
-
module.exports = require("@splunk/react-ui/Link");
|
|
2038
2843
|
|
|
2039
|
-
|
|
2844
|
+
var inlineStyles = {
|
|
2845
|
+
display: 'inline-block',
|
|
2846
|
+
flex: '0 0 auto',
|
|
2847
|
+
overflow: 'visible',
|
|
2848
|
+
verticalAlign: 'middle'
|
|
2849
|
+
};
|
|
2850
|
+
var blockStyles = {
|
|
2851
|
+
display: 'block',
|
|
2852
|
+
flex: '0 0 auto',
|
|
2853
|
+
margin: '0 auto',
|
|
2854
|
+
overflow: 'visible'
|
|
2855
|
+
};
|
|
2856
|
+
var propTypes = {
|
|
2857
|
+
Enterprise: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.func,
|
|
2858
|
+
enterpriseSize: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.number, prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string]),
|
|
2859
|
+
enterpriseWidth: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.number, prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string]),
|
|
2860
|
+
enterpriseHeight: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.number, prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string]),
|
|
2861
|
+
Prisma24: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.func.isRequired,
|
|
2862
|
+
Prisma20: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.func,
|
|
2863
|
+
Prisma16: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.func,
|
|
2864
|
+
prismaSize: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.oneOf(['medium', 'small']),
|
|
2865
|
+
inline: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool,
|
|
2866
|
+
screenReaderText: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.string
|
|
2867
|
+
};
|
|
2868
|
+
var defaultProps = {
|
|
2869
|
+
inline: true,
|
|
2870
|
+
prismaSize: 'medium'
|
|
2871
|
+
};
|
|
2872
|
+
function Icon(_ref) {
|
|
2873
|
+
var Enterprise = _ref.Enterprise,
|
|
2874
|
+
Prisma24 = _ref.Prisma24,
|
|
2875
|
+
Prisma20 = _ref.Prisma20,
|
|
2876
|
+
Prisma16 = _ref.Prisma16,
|
|
2877
|
+
prismaSize = _ref.prismaSize,
|
|
2878
|
+
inline = _ref.inline,
|
|
2879
|
+
enterpriseSize = _ref.enterpriseSize,
|
|
2880
|
+
enterpriseWidth = _ref.enterpriseWidth,
|
|
2881
|
+
enterpriseHeight = _ref.enterpriseHeight,
|
|
2882
|
+
screenReaderText = _ref.screenReaderText,
|
|
2883
|
+
otherProps = _objectWithoutProperties(_ref, ["Enterprise", "Prisma24", "Prisma20", "Prisma16", "prismaSize", "inline", "enterpriseSize", "enterpriseWidth", "enterpriseHeight", "screenReaderText"]);
|
|
2884
|
+
|
|
2885
|
+
var _useSplunkTheme = Object(_splunk_themes__WEBPACK_IMPORTED_MODULE_2__["useSplunkTheme"])(),
|
|
2886
|
+
family = _useSplunkTheme.family,
|
|
2887
|
+
density = _useSplunkTheme.density; // Enterprise - all variants
|
|
2888
|
+
|
|
2889
|
+
|
|
2890
|
+
if (family === 'enterprise') {
|
|
2891
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(Enterprise, _extends({
|
|
2892
|
+
size: enterpriseSize,
|
|
2893
|
+
width: enterpriseWidth,
|
|
2894
|
+
height: enterpriseHeight,
|
|
2895
|
+
screenReaderText: screenReaderText || null,
|
|
2896
|
+
hideDefaultTooltip: true,
|
|
2897
|
+
inline: inline
|
|
2898
|
+
}, otherProps));
|
|
2899
|
+
}
|
|
2040
2900
|
|
|
2041
|
-
|
|
2042
|
-
|
|
2901
|
+
var prismaProps = _objectSpread({
|
|
2902
|
+
'aria-label': screenReaderText,
|
|
2903
|
+
style: inline ? inlineStyles : blockStyles
|
|
2904
|
+
}, otherProps); // Prisma - small+compact, small+comfortable
|
|
2043
2905
|
|
|
2044
|
-
module.exports = require("@splunk/react-ui/ResultsMenu");
|
|
2045
2906
|
|
|
2046
|
-
|
|
2907
|
+
if (prismaSize === 'small') {
|
|
2908
|
+
var SVG = Prisma16 || Prisma24;
|
|
2909
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(SVG, _extends({
|
|
2910
|
+
width: "16",
|
|
2911
|
+
height: "16"
|
|
2912
|
+
}, prismaProps));
|
|
2913
|
+
} // Prisma - medium+compact
|
|
2047
2914
|
|
|
2048
|
-
/***/ 4:
|
|
2049
|
-
/***/ (function(module, exports) {
|
|
2050
2915
|
|
|
2051
|
-
|
|
2916
|
+
if (density === 'compact') {
|
|
2917
|
+
var _SVG = Prisma20 || Prisma24;
|
|
2052
2918
|
|
|
2053
|
-
|
|
2919
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_SVG, _extends({
|
|
2920
|
+
width: "20",
|
|
2921
|
+
height: "20"
|
|
2922
|
+
}, prismaProps));
|
|
2923
|
+
} // Prisma - medium+comfortable
|
|
2054
2924
|
|
|
2055
|
-
/***/ 5:
|
|
2056
|
-
/***/ (function(module, exports) {
|
|
2057
2925
|
|
|
2058
|
-
|
|
2926
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(Prisma24, _extends({
|
|
2927
|
+
width: "24",
|
|
2928
|
+
height: "24"
|
|
2929
|
+
}, prismaProps));
|
|
2930
|
+
}
|
|
2931
|
+
Icon.propTypes = propTypes;
|
|
2932
|
+
Icon.defaultProps = defaultProps;
|
|
2059
2933
|
|
|
2060
2934
|
/***/ }),
|
|
2061
2935
|
|
|
@@ -2066,7 +2940,7 @@ module.exports = require("@splunk/react-ui/Box");
|
|
|
2066
2940
|
|
|
2067
2941
|
/***/ }),
|
|
2068
2942
|
|
|
2069
|
-
/***/
|
|
2943
|
+
/***/ 89:
|
|
2070
2944
|
/***/ (function(module, exports) {
|
|
2071
2945
|
|
|
2072
2946
|
module.exports = require("@splunk/react-ui/Chip");
|