@elastic/eui 95.6.0 → 95.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eui_theme_dark.css +0 -642
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +0 -642
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/combo_box/combo_box.js +54 -50
- package/es/components/combo_box/combo_box.styles.js +14 -0
- package/es/components/combo_box/combo_box_input/combo_box_input.js +69 -62
- package/es/components/combo_box/combo_box_input/combo_box_input.styles.js +60 -0
- package/es/components/combo_box/combo_box_input/combo_box_pill.js +50 -138
- package/es/components/combo_box/combo_box_input/combo_box_pill.styles.js +25 -0
- package/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +31 -23
- package/es/components/combo_box/combo_box_options_list/combo_box_options_list.styles.js +22 -0
- package/es/components/combo_box/combo_box_options_list/index.js +0 -1
- package/es/components/combo_box/utils.js +26 -3
- package/es/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.styles.js +3 -4
- package/es/components/flyout/flyout.styles.js +3 -3
- package/es/components/form/form.styles.js +16 -8
- package/es/components/list_group/list_group.styles.js +3 -3
- package/es/components/popover/input_popover.js +3 -3
- package/es/components/search_bar/search_bar.styles.js +2 -4
- package/es/components/selectable/selectable.js +9 -8
- package/es/components/selectable/selectable.styles.js +22 -0
- package/es/components/selectable/selectable_list/selectable_list.js +38 -29
- package/es/components/selectable/selectable_list/selectable_list.styles.js +35 -0
- package/es/components/selectable/selectable_list/selectable_list_item.js +18 -17
- package/es/components/selectable/selectable_list/selectable_list_item.styles.js +56 -0
- package/es/components/selectable/selectable_message/selectable_message.js +6 -3
- package/es/components/selectable/selectable_message/selectable_message.styles.js +17 -0
- package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +12 -9
- package/es/components/selectable/selectable_templates/selectable_template_sitewide.styles.js +47 -0
- package/es/components/selectable/selectable_templates/selectable_template_sitewide_option.js +40 -10
- package/es/services/theme/index.js +1 -1
- package/es/services/theme/style_memoization.js +14 -0
- package/eui.d.ts +146 -46
- package/i18ntokens.json +118 -118
- package/lib/components/combo_box/combo_box.js +53 -49
- package/lib/components/combo_box/combo_box.styles.js +20 -0
- package/lib/components/combo_box/combo_box_input/combo_box_input.js +68 -61
- package/lib/components/combo_box/combo_box_input/combo_box_input.styles.js +64 -0
- package/lib/components/combo_box/combo_box_input/combo_box_pill.js +55 -144
- package/lib/components/combo_box/combo_box_input/combo_box_pill.styles.js +31 -0
- package/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +31 -23
- package/lib/components/combo_box/combo_box_options_list/combo_box_options_list.styles.js +28 -0
- package/lib/components/combo_box/combo_box_options_list/index.js +0 -7
- package/lib/components/combo_box/utils.js +29 -9
- package/lib/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.styles.js +2 -3
- package/lib/components/flyout/flyout.styles.js +2 -2
- package/lib/components/form/form.styles.js +16 -9
- package/lib/components/list_group/list_group.styles.js +2 -2
- package/lib/components/popover/input_popover.js +2 -2
- package/lib/components/search_bar/search_bar.styles.js +1 -3
- package/lib/components/selectable/selectable.js +9 -8
- package/lib/components/selectable/selectable.styles.js +26 -0
- package/lib/components/selectable/selectable_list/selectable_list.js +38 -29
- package/lib/components/selectable/selectable_list/selectable_list.styles.js +38 -0
- package/lib/components/selectable/selectable_list/selectable_list_item.js +18 -16
- package/lib/components/selectable/selectable_list/selectable_list_item.styles.js +60 -0
- package/lib/components/selectable/selectable_message/selectable_message.js +6 -3
- package/lib/components/selectable/selectable_message/selectable_message.styles.js +23 -0
- package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +11 -8
- package/lib/components/selectable/selectable_templates/selectable_template_sitewide.styles.js +51 -0
- package/lib/components/selectable/selectable_templates/selectable_template_sitewide_option.js +40 -10
- package/lib/services/theme/index.js +6 -0
- package/lib/services/theme/style_memoization.js +15 -1
- package/optimize/es/components/combo_box/combo_box.js +54 -50
- package/optimize/es/components/combo_box/combo_box.styles.js +14 -0
- package/optimize/es/components/combo_box/combo_box_input/combo_box_input.js +64 -62
- package/optimize/es/components/combo_box/combo_box_input/combo_box_input.styles.js +60 -0
- package/optimize/es/components/combo_box/combo_box_input/combo_box_pill.js +51 -78
- package/optimize/es/components/combo_box/combo_box_input/combo_box_pill.styles.js +25 -0
- package/optimize/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +31 -23
- package/optimize/es/components/combo_box/combo_box_options_list/combo_box_options_list.styles.js +22 -0
- package/optimize/es/components/combo_box/combo_box_options_list/index.js +0 -1
- package/optimize/es/components/combo_box/utils.js +23 -3
- package/optimize/es/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.styles.js +3 -4
- package/optimize/es/components/flyout/flyout.styles.js +3 -3
- package/optimize/es/components/form/form.styles.js +16 -8
- package/optimize/es/components/list_group/list_group.styles.js +3 -3
- package/optimize/es/components/popover/input_popover.js +3 -3
- package/optimize/es/components/search_bar/search_bar.styles.js +2 -4
- package/optimize/es/components/selectable/selectable.js +9 -8
- package/optimize/es/components/selectable/selectable.styles.js +22 -0
- package/optimize/es/components/selectable/selectable_list/selectable_list.js +38 -29
- package/optimize/es/components/selectable/selectable_list/selectable_list.styles.js +35 -0
- package/optimize/es/components/selectable/selectable_list/selectable_list_item.js +18 -14
- package/optimize/es/components/selectable/selectable_list/selectable_list_item.styles.js +56 -0
- package/optimize/es/components/selectable/selectable_message/selectable_message.js +6 -3
- package/optimize/es/components/selectable/selectable_message/selectable_message.styles.js +17 -0
- package/optimize/es/components/selectable/selectable_templates/selectable_template_sitewide.js +12 -9
- package/optimize/es/components/selectable/selectable_templates/selectable_template_sitewide.styles.js +47 -0
- package/optimize/es/components/selectable/selectable_templates/selectable_template_sitewide_option.js +35 -10
- package/optimize/es/services/theme/index.js +1 -1
- package/optimize/es/services/theme/style_memoization.js +14 -0
- package/optimize/lib/components/combo_box/combo_box.js +53 -49
- package/optimize/lib/components/combo_box/combo_box.styles.js +20 -0
- package/optimize/lib/components/combo_box/combo_box_input/combo_box_input.js +63 -61
- package/optimize/lib/components/combo_box/combo_box_input/combo_box_input.styles.js +64 -0
- package/optimize/lib/components/combo_box/combo_box_input/combo_box_pill.js +52 -81
- package/optimize/lib/components/combo_box/combo_box_input/combo_box_pill.styles.js +31 -0
- package/optimize/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +31 -23
- package/optimize/lib/components/combo_box/combo_box_options_list/combo_box_options_list.styles.js +28 -0
- package/optimize/lib/components/combo_box/combo_box_options_list/index.js +0 -7
- package/optimize/lib/components/combo_box/utils.js +26 -9
- package/optimize/lib/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.styles.js +2 -3
- package/optimize/lib/components/flyout/flyout.styles.js +2 -2
- package/optimize/lib/components/form/form.styles.js +16 -9
- package/optimize/lib/components/list_group/list_group.styles.js +2 -2
- package/optimize/lib/components/popover/input_popover.js +2 -2
- package/optimize/lib/components/search_bar/search_bar.styles.js +1 -3
- package/optimize/lib/components/selectable/selectable.js +9 -8
- package/optimize/lib/components/selectable/selectable.styles.js +26 -0
- package/optimize/lib/components/selectable/selectable_list/selectable_list.js +38 -29
- package/optimize/lib/components/selectable/selectable_list/selectable_list.styles.js +38 -0
- package/optimize/lib/components/selectable/selectable_list/selectable_list_item.js +18 -14
- package/optimize/lib/components/selectable/selectable_list/selectable_list_item.styles.js +60 -0
- package/optimize/lib/components/selectable/selectable_message/selectable_message.js +6 -3
- package/optimize/lib/components/selectable/selectable_message/selectable_message.styles.js +23 -0
- package/optimize/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +11 -8
- package/optimize/lib/components/selectable/selectable_templates/selectable_template_sitewide.styles.js +51 -0
- package/optimize/lib/components/selectable/selectable_templates/selectable_template_sitewide_option.js +35 -10
- package/optimize/lib/services/theme/index.js +6 -0
- package/optimize/lib/services/theme/style_memoization.js +15 -1
- package/package.json +1 -1
- package/src/components/index.scss +0 -2
- package/src/themes/amsterdam/overrides/_index.scss +0 -1
- package/test-env/components/combo_box/combo_box.js +53 -49
- package/test-env/components/combo_box/combo_box.styles.js +20 -0
- package/test-env/components/combo_box/combo_box_input/combo_box_input.js +63 -61
- package/test-env/components/combo_box/combo_box_input/combo_box_input.styles.js +64 -0
- package/test-env/components/combo_box/combo_box_input/combo_box_pill.js +51 -135
- package/test-env/components/combo_box/combo_box_input/combo_box_pill.styles.js +31 -0
- package/test-env/components/combo_box/combo_box_options_list/combo_box_options_list.js +31 -23
- package/test-env/components/combo_box/combo_box_options_list/combo_box_options_list.styles.js +28 -0
- package/test-env/components/combo_box/combo_box_options_list/index.js +0 -7
- package/test-env/components/combo_box/utils.js +26 -9
- package/test-env/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.styles.js +2 -3
- package/test-env/components/flyout/flyout.styles.js +2 -2
- package/test-env/components/form/form.styles.js +16 -9
- package/test-env/components/list_group/list_group.styles.js +2 -2
- package/test-env/components/popover/input_popover.js +2 -2
- package/test-env/components/search_bar/search_bar.styles.js +1 -3
- package/test-env/components/selectable/selectable.js +9 -8
- package/test-env/components/selectable/selectable.styles.js +26 -0
- package/test-env/components/selectable/selectable_list/selectable_list.js +38 -29
- package/test-env/components/selectable/selectable_list/selectable_list.styles.js +38 -0
- package/test-env/components/selectable/selectable_list/selectable_list_item.js +18 -14
- package/test-env/components/selectable/selectable_list/selectable_list_item.styles.js +60 -0
- package/test-env/components/selectable/selectable_message/selectable_message.js +6 -3
- package/test-env/components/selectable/selectable_message/selectable_message.styles.js +23 -0
- package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +11 -8
- package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.styles.js +51 -0
- package/test-env/components/selectable/selectable_templates/selectable_template_sitewide_option.js +35 -10
- package/test-env/services/theme/index.js +6 -0
- package/test-env/services/theme/style_memoization.js +15 -1
- package/es/components/combo_box/combo_box_options_list/combo_box_option.js +0 -153
- package/lib/components/combo_box/combo_box_options_list/combo_box_option.js +0 -160
- package/optimize/es/components/combo_box/combo_box_options_list/combo_box_option.js +0 -90
- package/optimize/lib/components/combo_box/combo_box_options_list/combo_box_option.js +0 -98
- package/src/components/combo_box/_combo_box.scss +0 -147
- package/src/components/combo_box/_index.scss +0 -3
- package/src/components/combo_box/combo_box_input/_combo_box_pill.scss +0 -38
- package/src/components/combo_box/combo_box_input/_index.scss +0 -1
- package/src/components/combo_box/combo_box_options_list/_combo_box_option.scss +0 -72
- package/src/components/combo_box/combo_box_options_list/_combo_box_options_list.scss +0 -28
- package/src/components/combo_box/combo_box_options_list/_combo_box_title.scss +0 -12
- package/src/components/combo_box/combo_box_options_list/_index.scss +0 -3
- package/src/components/selectable/_index.scss +0 -5
- package/src/components/selectable/_selectable.scss +0 -8
- package/src/components/selectable/selectable_list/_index.scss +0 -3
- package/src/components/selectable/selectable_list/_selectable_list.scss +0 -38
- package/src/components/selectable/selectable_list/_selectable_list_item.scss +0 -62
- package/src/components/selectable/selectable_list/_variables.scss +0 -2
- package/src/components/selectable/selectable_message/_index.scss +0 -1
- package/src/components/selectable/selectable_message/_selectable_message.scss +0 -19
- package/src/components/selectable/selectable_search/_index.scss +0 -1
- package/src/components/selectable/selectable_search/_selectable_search.scss +0 -3
- package/src/components/selectable/selectable_templates/_index.scss +0 -2
- package/src/components/selectable/selectable_templates/_selectable_template_sitewide_option.scss +0 -39
- package/src/components/selectable/selectable_templates/_variables.scss +0 -26
- package/src/themes/amsterdam/overrides/_combo_box.scss +0 -50
- package/test-env/components/combo_box/combo_box_options_list/combo_box_option.js +0 -154
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.euiComboBoxStyles = void 0;
|
|
7
|
+
var _react = require("@emotion/react");
|
|
8
|
+
var _global_styling = require("../../global_styling");
|
|
9
|
+
/*
|
|
10
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
11
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
12
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
13
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
14
|
+
* Side Public License, v 1.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
var euiComboBoxStyles = exports.euiComboBoxStyles = {
|
|
18
|
+
euiComboBox: /*#__PURE__*/(0, _react.css)("position:relative;", (0, _global_styling.logicalCSS)('width', '100%'), " ", (0, _global_styling.logicalCSS)('height', 'auto'), ";;label:euiComboBox;"),
|
|
19
|
+
fullWidth: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('max-width', '100%'), ";;label:fullWidth;")
|
|
20
|
+
};
|
|
@@ -10,14 +10,20 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
10
10
|
var _services = require("../../../services");
|
|
11
11
|
var _accessibility = require("../../accessibility");
|
|
12
12
|
var _form_control_layout = require("../../form/form_control_layout");
|
|
13
|
-
var _num_icons = require("../../form/form_control_layout/_num_icons");
|
|
14
13
|
var _utils = require("../utils");
|
|
15
14
|
var _combo_box_pill = require("./combo_box_pill");
|
|
15
|
+
var _combo_box_input = require("./combo_box_input.styles");
|
|
16
16
|
var _react2 = require("@emotion/react");
|
|
17
17
|
var _excluded = ["key", "label", "color", "onClick", "append", "prepend", "truncationProps", "toolTipContent", "toolTipProps"];
|
|
18
18
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
19
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
20
20
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
21
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
22
|
+
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."); }
|
|
23
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
24
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
25
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
26
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
21
27
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
22
28
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
23
29
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
@@ -179,6 +185,7 @@ var EuiComboBoxInput = exports.EuiComboBoxInput = /*#__PURE__*/function (_Compon
|
|
|
179
185
|
}, {
|
|
180
186
|
key: "render",
|
|
181
187
|
value: function render() {
|
|
188
|
+
var _this2 = this;
|
|
182
189
|
var _this$props5 = this.props,
|
|
183
190
|
compressed = _this$props5.compressed,
|
|
184
191
|
focusedOptionId = _this$props5.focusedOptionId,
|
|
@@ -223,6 +230,7 @@ var EuiComboBoxInput = exports.EuiComboBoxInput = /*#__PURE__*/function (_Compon
|
|
|
223
230
|
id: removeOptionMessageId
|
|
224
231
|
}, removeOptionMessageContent));
|
|
225
232
|
}
|
|
233
|
+
var isInGroup = singleSelection && (prepend || append);
|
|
226
234
|
var showPlaceholder = placeholder && !(selectedOptions !== null && selectedOptions !== void 0 && selectedOptions.length) && !searchValue;
|
|
227
235
|
var clickProps = {};
|
|
228
236
|
if (!isDisabled && onClear && hasSelectedOptions) {
|
|
@@ -243,68 +251,67 @@ var EuiComboBoxInput = exports.EuiComboBoxInput = /*#__PURE__*/function (_Compon
|
|
|
243
251
|
type: 'arrowDown'
|
|
244
252
|
};
|
|
245
253
|
}
|
|
246
|
-
var
|
|
247
|
-
|
|
248
|
-
clear: !!clickProps.clear,
|
|
249
|
-
isInvalid: isInvalid,
|
|
250
|
-
isLoading: isLoading
|
|
254
|
+
var wrapClasses = (0, _classnames.default)('euiComboBox__inputWrap', {
|
|
255
|
+
'euiComboBox__inputWrap--plainText': this.asPlainText
|
|
251
256
|
});
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
257
|
+
return (0, _react2.jsx)(_services.RenderWithEuiStylesMemoizer, null, function (stylesMemoizer) {
|
|
258
|
+
var styles = stylesMemoizer(_combo_box_input.euiComboBoxInputStyles);
|
|
259
|
+
var cssStyles = [styles.euiComboBoxInputWrapper, !singleSelection && styles.multiSelect, compressed ? styles.compressed : styles.uncompressed].concat(_toConsumableArray(_this2.asPlainText || showPlaceholder ? [styles.plainText.plainText, compressed ? styles.plainText.compressed : styles.plainText.uncompressed] : []), [isDisabled ? styles.disabled : isInvalid ? styles.invalid : isListOpen ? styles.open : undefined, isInGroup && styles.inGroup]);
|
|
260
|
+
var formLayoutStyles = [styles.formLayout.euiComboBox__formControlLayout, !singleSelection && styles.formLayout.multiSelect, isInGroup && !append && styles.formLayout.prependOnly, isInGroup && !prepend && styles.formLayout.appendOnly];
|
|
261
|
+
return (0, _react2.jsx)(_form_control_layout.EuiFormControlLayout, _extends({
|
|
262
|
+
icon: icon
|
|
263
|
+
}, clickProps, {
|
|
264
|
+
inputId: id,
|
|
265
|
+
isLoading: isLoading,
|
|
266
|
+
isInvalid: isInvalid,
|
|
267
|
+
compressed: compressed,
|
|
268
|
+
fullWidth: fullWidth,
|
|
269
|
+
prepend: prepend,
|
|
270
|
+
append: append,
|
|
271
|
+
css: formLayoutStyles
|
|
272
|
+
}), (0, _react2.jsx)("div", {
|
|
273
|
+
css: cssStyles,
|
|
274
|
+
className: wrapClasses,
|
|
275
|
+
"data-test-subj": "comboBoxInput",
|
|
276
|
+
onClick: onClick,
|
|
277
|
+
tabIndex: -1 // becomes onBlur event's relatedTarget, otherwise relatedTarget is null when clicking on this div
|
|
278
|
+
}, _this2.renderPills(), (0, _react2.jsx)(_utils.EuiComboBoxOptionAppendPrepend, {
|
|
279
|
+
option: _this2.asPlainText ? selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions[0] : undefined,
|
|
280
|
+
classNamePrefix: "euiComboBoxPlainTextSelection",
|
|
281
|
+
marginSize: "xxs"
|
|
282
|
+
}, (0, _react2.jsx)("input", {
|
|
283
|
+
"aria-activedescendant": focusedOptionId,
|
|
284
|
+
"aria-autocomplete": "list",
|
|
285
|
+
"aria-controls": isListOpen ? rootId('listbox') : '',
|
|
286
|
+
"aria-expanded": isListOpen,
|
|
287
|
+
"aria-label": ariaLabel,
|
|
288
|
+
"aria-labelledby": ariaLabelledby,
|
|
289
|
+
"aria-invalid": isInvalid,
|
|
290
|
+
css: styles.euiComboBoxInput,
|
|
291
|
+
className: "euiComboBox__input",
|
|
292
|
+
"data-test-subj": "comboBoxSearchInput",
|
|
293
|
+
disabled: isDisabled,
|
|
294
|
+
id: id,
|
|
295
|
+
onBlur: _this2.onBlur,
|
|
296
|
+
onChange: function onChange(event) {
|
|
297
|
+
return _onChange(event.target.value);
|
|
298
|
+
},
|
|
299
|
+
onFocus: _this2.onFocus,
|
|
300
|
+
onKeyDown: _this2.onKeyDown,
|
|
301
|
+
ref: _this2.inputRefCallback,
|
|
302
|
+
role: "combobox",
|
|
303
|
+
style: {
|
|
304
|
+
inlineSize: _this2.asPlainText || showPlaceholder ? '100%' : _this2.state.inputWidth
|
|
305
|
+
},
|
|
306
|
+
placeholder: showPlaceholder ? placeholder : undefined,
|
|
307
|
+
value: _this2.searchValue,
|
|
308
|
+
autoFocus: autoFocus,
|
|
309
|
+
autoComplete: "off"
|
|
310
|
+
// Force the menu to re-open on every input click - only necessary when plain text
|
|
311
|
+
,
|
|
312
|
+
onClick: _this2.asPlainText ? onFocus : undefined // Type shenanigans - event should be mostly the same
|
|
313
|
+
})), removeOptionMessage));
|
|
258
314
|
});
|
|
259
|
-
return (0, _react2.jsx)(_form_control_layout.EuiFormControlLayout, _extends({
|
|
260
|
-
icon: icon
|
|
261
|
-
}, clickProps, {
|
|
262
|
-
inputId: id,
|
|
263
|
-
isLoading: isLoading,
|
|
264
|
-
isInvalid: isInvalid,
|
|
265
|
-
compressed: compressed,
|
|
266
|
-
fullWidth: fullWidth,
|
|
267
|
-
prepend: prepend,
|
|
268
|
-
append: append
|
|
269
|
-
}), (0, _react2.jsx)("div", {
|
|
270
|
-
className: wrapClasses,
|
|
271
|
-
"data-test-subj": "comboBoxInput",
|
|
272
|
-
onClick: onClick,
|
|
273
|
-
tabIndex: -1 // becomes onBlur event's relatedTarget, otherwise relatedTarget is null when clicking on this div
|
|
274
|
-
}, this.renderPills(), (0, _react2.jsx)(_utils.EuiComboBoxOptionAppendPrepend, {
|
|
275
|
-
option: this.asPlainText ? selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions[0] : undefined,
|
|
276
|
-
classNamePrefix: "euiComboBoxPlainTextSelection"
|
|
277
|
-
}, (0, _react2.jsx)("input", {
|
|
278
|
-
"aria-activedescendant": focusedOptionId,
|
|
279
|
-
"aria-autocomplete": "list",
|
|
280
|
-
"aria-controls": isListOpen ? rootId('listbox') : '',
|
|
281
|
-
"aria-expanded": isListOpen,
|
|
282
|
-
"aria-label": ariaLabel,
|
|
283
|
-
"aria-labelledby": ariaLabelledby,
|
|
284
|
-
"aria-invalid": isInvalid,
|
|
285
|
-
className: "euiComboBox__input",
|
|
286
|
-
"data-test-subj": "comboBoxSearchInput",
|
|
287
|
-
disabled: isDisabled,
|
|
288
|
-
id: id,
|
|
289
|
-
onBlur: this.onBlur,
|
|
290
|
-
onChange: function onChange(event) {
|
|
291
|
-
return _onChange(event.target.value);
|
|
292
|
-
},
|
|
293
|
-
onFocus: this.onFocus,
|
|
294
|
-
onKeyDown: this.onKeyDown,
|
|
295
|
-
ref: this.inputRefCallback,
|
|
296
|
-
role: "combobox",
|
|
297
|
-
style: {
|
|
298
|
-
inlineSize: this.asPlainText || showPlaceholder ? '100%' : this.state.inputWidth
|
|
299
|
-
},
|
|
300
|
-
placeholder: showPlaceholder ? placeholder : undefined,
|
|
301
|
-
value: this.searchValue,
|
|
302
|
-
autoFocus: autoFocus,
|
|
303
|
-
autoComplete: "off"
|
|
304
|
-
// Force the menu to re-open on every input click - only necessary when plain text
|
|
305
|
-
,
|
|
306
|
-
onClick: this.asPlainText ? onFocus : undefined // Type shenanigans - event should be mostly the same
|
|
307
|
-
})), removeOptionMessage));
|
|
308
315
|
}
|
|
309
316
|
}]);
|
|
310
317
|
}(_react.Component);
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.euiComboBoxInputStyles = void 0;
|
|
7
|
+
var _react = require("@emotion/react");
|
|
8
|
+
var _global_styling = require("../../../global_styling");
|
|
9
|
+
var _form = require("../../form/form.styles");
|
|
10
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /*
|
|
11
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
12
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
13
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
14
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
15
|
+
* Side Public License, v 1.
|
|
16
|
+
*/
|
|
17
|
+
var _ref = process.env.NODE_ENV === "production" ? {
|
|
18
|
+
name: "kedu1h-plainText",
|
|
19
|
+
styles: "align-items:center;cursor:text;label:plainText;"
|
|
20
|
+
} : {
|
|
21
|
+
name: "kedu1h-plainText",
|
|
22
|
+
styles: "align-items:center;cursor:text;label:plainText;",
|
|
23
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
24
|
+
};
|
|
25
|
+
var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
26
|
+
name: "dkzr1g-multiSelect",
|
|
27
|
+
styles: "flex-wrap:wrap;label:multiSelect;"
|
|
28
|
+
} : {
|
|
29
|
+
name: "dkzr1g-multiSelect",
|
|
30
|
+
styles: "flex-wrap:wrap;label:multiSelect;",
|
|
31
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
32
|
+
};
|
|
33
|
+
var euiComboBoxInputStyles = exports.euiComboBoxInputStyles = function euiComboBoxInputStyles(euiThemeContext) {
|
|
34
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
35
|
+
var formStyles = (0, _form.euiFormControlStyles)(euiThemeContext);
|
|
36
|
+
return {
|
|
37
|
+
// Wrapper which visually mimics a form control
|
|
38
|
+
euiComboBoxInputWrapper: /*#__PURE__*/(0, _react.css)((0, _form.euiFormControlDefaultShadow)(euiThemeContext), " display:flex;;label:euiComboBoxInputWrapper;"),
|
|
39
|
+
multiSelect: _ref2,
|
|
40
|
+
uncompressed: "\n ".concat(formStyles.uncompressed, "\n ").concat((0, _global_styling.logicalCSS)('height', 'auto'), "\n ").concat((0, _global_styling.logicalCSS)('padding-vertical', euiTheme.size.s), "\n ").concat((0, _global_styling.logicalCSS)('padding-left', euiTheme.size.s), "\n column-gap: ").concat(euiTheme.size.s, ";\n row-gap: ").concat(euiTheme.size.xs, ";\n "),
|
|
41
|
+
compressed: /*#__PURE__*/(0, _react.css)(formStyles.compressed, " ", (0, _global_styling.logicalCSS)('height', 'auto'), " ", (0, _global_styling.logicalCSS)('padding-vertical', euiTheme.size.xs), " ", (0, _global_styling.logicalCSS)('padding-left', euiTheme.size.xs), " column-gap:", euiTheme.size.xs, ";row-gap:", euiTheme.size.xxs, ";;label:compressed;"),
|
|
42
|
+
plainText: {
|
|
43
|
+
plainText: _ref,
|
|
44
|
+
compressed: "\n ".concat((0, _global_styling.logicalCSS)('padding-left', euiTheme.size.s), "\n "),
|
|
45
|
+
uncompressed: "\n ".concat((0, _global_styling.logicalCSS)('padding-left', euiTheme.size.m), "\n ")
|
|
46
|
+
},
|
|
47
|
+
invalid: /*#__PURE__*/(0, _react.css)(formStyles.invalid, ";label:invalid;"),
|
|
48
|
+
disabled: /*#__PURE__*/(0, _react.css)(formStyles.disabled, ";label:disabled;"),
|
|
49
|
+
open: /*#__PURE__*/(0, _react.css)(formStyles.focus, ";label:open;"),
|
|
50
|
+
inGroup: /*#__PURE__*/(0, _react.css)(formStyles.inGroup, ";label:inGroup;"),
|
|
51
|
+
// Actual input element, which has variable width depending on its value
|
|
52
|
+
euiComboBoxInput: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('height', euiTheme.size.l), " ", (0, _global_styling.logicalCSS)('min-width', '2px'), " ", (0, _global_styling.logicalCSS)('max-width', '100%'), (0, _form.euiFormControlText)(euiThemeContext), " background:transparent;&:disabled{color:", euiTheme.colors.disabledText, ";}appearance:none!important;border:none!important;box-shadow:none!important;outline:none!important;;label:euiComboBoxInput;"),
|
|
53
|
+
// EuiFormControlLayout overrides
|
|
54
|
+
formLayout: {
|
|
55
|
+
euiComboBox__formControlLayout: /*#__PURE__*/(0, _react.css)(";label:euiComboBox__formControlLayout;"),
|
|
56
|
+
// Allow the form control to expand to any height to accommodate multiple rows of pills
|
|
57
|
+
// TODO: Remove && specificity override once EuiFormControlLayout is on Emotion
|
|
58
|
+
multiSelect: /*#__PURE__*/(0, _react.css)("&&{", (0, _global_styling.logicalCSS)('height', 'auto'), ";};label:multiSelect;"),
|
|
59
|
+
// Fix overflowing input wrapper background
|
|
60
|
+
prependOnly: /*#__PURE__*/(0, _react.css)(".euiFormControlLayout__childrenWrapper{", (0, _global_styling.logicalCSS)('border-top-right-radius', 'inherit'), " ", (0, _global_styling.logicalCSS)('border-bottom-right-radius', 'inherit'), ";};label:prependOnly;"),
|
|
61
|
+
appendOnly: /*#__PURE__*/(0, _react.css)(".euiFormControlLayout__childrenWrapper{", (0, _global_styling.logicalCSS)('border-top-left-radius', 'inherit'), " ", (0, _global_styling.logicalCSS)('border-bottom-left-radius', 'inherit'), ";};label:appendOnly;")
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
};
|
|
@@ -4,166 +4,77 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.EuiComboBoxPill = void 0;
|
|
7
|
-
var _react =
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
8
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
|
+
var _services = require("../../../services");
|
|
10
10
|
var _badge = require("../../badge");
|
|
11
11
|
var _i18n = require("../../i18n");
|
|
12
12
|
var _utils = require("../utils");
|
|
13
|
+
var _combo_box_pill = require("./combo_box_pill.styles");
|
|
13
14
|
var _react2 = require("@emotion/react");
|
|
14
15
|
var _excluded = ["children", "className", "color", "onClick", "onClickAriaLabel", "onClose", "option"];
|
|
15
|
-
|
|
16
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
17
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
19
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
20
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
21
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
|
|
22
|
-
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
23
|
-
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
24
|
-
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
25
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
26
|
-
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
27
|
-
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
28
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
29
|
-
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
30
|
-
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
31
|
-
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
32
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
33
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
34
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /*
|
|
16
|
+
/*
|
|
35
17
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
36
18
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
37
19
|
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
38
20
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
39
21
|
* Side Public License, v 1.
|
|
40
22
|
*/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
var onClickProps = onClick && onClickAriaLabel ? {
|
|
75
|
-
onClick: onClick,
|
|
76
|
-
onClickAriaLabel: onClickAriaLabel
|
|
77
|
-
} : {};
|
|
78
|
-
var content = (0, _react2.jsx)(_utils.EuiComboBoxOptionAppendPrepend, {
|
|
79
|
-
option: option,
|
|
80
|
-
classNamePrefix: "euiComboBoxPill"
|
|
81
|
-
}, (0, _react2.jsx)("span", {
|
|
82
|
-
className: "eui-textTruncate"
|
|
83
|
-
}, children));
|
|
84
|
-
if (onClose) {
|
|
85
|
-
return (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
86
|
-
token: "euiComboBoxPill.removeSelection",
|
|
87
|
-
default: "Remove {children} from selection in this group",
|
|
88
|
-
values: {
|
|
89
|
-
children: children
|
|
90
|
-
}
|
|
91
|
-
}, function (removeSelection) {
|
|
92
|
-
return (0, _react2.jsx)(_badge.EuiBadge, _extends({
|
|
93
|
-
className: classes,
|
|
94
|
-
color: color,
|
|
95
|
-
"data-test-subj": "euiComboBoxPill",
|
|
96
|
-
iconOnClick: _this2.onCloseButtonClick,
|
|
97
|
-
iconOnClickAriaLabel: removeSelection,
|
|
98
|
-
iconSide: "right",
|
|
99
|
-
iconType: "cross",
|
|
100
|
-
title: children
|
|
101
|
-
}, onClickProps, rest), content);
|
|
102
|
-
});
|
|
23
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
24
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
25
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
26
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
|
|
27
|
+
var EuiComboBoxPill = exports.EuiComboBoxPill = function EuiComboBoxPill(_ref) {
|
|
28
|
+
var children = _ref.children,
|
|
29
|
+
className = _ref.className,
|
|
30
|
+
_ref$color = _ref.color,
|
|
31
|
+
color = _ref$color === void 0 ? 'hollow' : _ref$color,
|
|
32
|
+
onClick = _ref.onClick,
|
|
33
|
+
onClickAriaLabel = _ref.onClickAriaLabel,
|
|
34
|
+
onClose = _ref.onClose,
|
|
35
|
+
option = _ref.option,
|
|
36
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
37
|
+
var classes = (0, _classnames.default)('euiComboBoxPill', className);
|
|
38
|
+
var styles = (0, _services.useEuiMemoizedStyles)(_combo_box_pill.euiComboBoxPillStyles);
|
|
39
|
+
var cssStyles = styles.euiComboBoxPill;
|
|
40
|
+
var onClickProps = onClick && onClickAriaLabel ? {
|
|
41
|
+
onClick: onClick,
|
|
42
|
+
onClickAriaLabel: onClickAriaLabel
|
|
43
|
+
} : {};
|
|
44
|
+
var content = (0, _react2.jsx)(_utils.EuiComboBoxOptionAppendPrepend, {
|
|
45
|
+
option: option,
|
|
46
|
+
classNamePrefix: "euiComboBoxPill"
|
|
47
|
+
}, (0, _react2.jsx)("span", {
|
|
48
|
+
className: "eui-textTruncate"
|
|
49
|
+
}, children));
|
|
50
|
+
if (onClose) {
|
|
51
|
+
return (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
52
|
+
token: "euiComboBoxPill.removeSelection",
|
|
53
|
+
default: "Remove {children} from selection in this group",
|
|
54
|
+
values: {
|
|
55
|
+
children: children
|
|
103
56
|
}
|
|
57
|
+
}, function (removeSelection) {
|
|
104
58
|
return (0, _react2.jsx)(_badge.EuiBadge, _extends({
|
|
59
|
+
css: cssStyles,
|
|
105
60
|
className: classes,
|
|
106
61
|
color: color,
|
|
107
62
|
"data-test-subj": "euiComboBoxPill",
|
|
63
|
+
iconOnClick: function iconOnClick() {
|
|
64
|
+
return onClose(option);
|
|
65
|
+
},
|
|
66
|
+
iconOnClickAriaLabel: removeSelection,
|
|
67
|
+
iconSide: "right",
|
|
68
|
+
iconType: "cross",
|
|
108
69
|
title: children
|
|
109
|
-
},
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
color: _propTypes.default.string,
|
|
120
|
-
onClick: _propTypes.default.func,
|
|
121
|
-
onClickAriaLabel: _propTypes.default.any,
|
|
122
|
-
onClose: _propTypes.default.func,
|
|
123
|
-
option: _propTypes.default.shape({
|
|
124
|
-
isGroupLabelOption: _propTypes.default.bool,
|
|
125
|
-
label: _propTypes.default.string.isRequired,
|
|
126
|
-
key: _propTypes.default.string,
|
|
127
|
-
options: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
128
|
-
isGroupLabelOption: _propTypes.default.bool,
|
|
129
|
-
label: _propTypes.default.string.isRequired,
|
|
130
|
-
key: _propTypes.default.string,
|
|
131
|
-
options: _propTypes.default.arrayOf(_propTypes.default.any.isRequired),
|
|
132
|
-
value: _propTypes.default.any,
|
|
133
|
-
prepend: _propTypes.default.node,
|
|
134
|
-
append: _propTypes.default.node,
|
|
135
|
-
truncationProps: _propTypes.default.any,
|
|
136
|
-
/**
|
|
137
|
-
* Optional custom tooltip content for the button
|
|
138
|
-
*/
|
|
139
|
-
toolTipContent: _propTypes.default.node,
|
|
140
|
-
/**
|
|
141
|
-
* Optional props to pass to the underlying **[EuiToolTip](/#/display/tooltip)**
|
|
142
|
-
*/
|
|
143
|
-
toolTipProps: _propTypes.default.any,
|
|
144
|
-
className: _propTypes.default.string,
|
|
145
|
-
"aria-label": _propTypes.default.string,
|
|
146
|
-
"data-test-subj": _propTypes.default.string,
|
|
147
|
-
css: _propTypes.default.any
|
|
148
|
-
}).isRequired),
|
|
149
|
-
value: _propTypes.default.any,
|
|
150
|
-
prepend: _propTypes.default.node,
|
|
151
|
-
append: _propTypes.default.node,
|
|
152
|
-
truncationProps: _propTypes.default.any,
|
|
153
|
-
/**
|
|
154
|
-
* Optional custom tooltip content for the button
|
|
155
|
-
*/
|
|
156
|
-
toolTipContent: _propTypes.default.node,
|
|
157
|
-
/**
|
|
158
|
-
* Optional props to pass to the underlying **[EuiToolTip](/#/display/tooltip)**
|
|
159
|
-
*/
|
|
160
|
-
toolTipProps: _propTypes.default.any,
|
|
161
|
-
className: _propTypes.default.string,
|
|
162
|
-
"aria-label": _propTypes.default.string,
|
|
163
|
-
"data-test-subj": _propTypes.default.string,
|
|
164
|
-
css: _propTypes.default.any
|
|
165
|
-
}).isRequired,
|
|
166
|
-
"aria-label": _propTypes.default.string,
|
|
167
|
-
"data-test-subj": _propTypes.default.string,
|
|
168
|
-
css: _propTypes.default.any
|
|
70
|
+
}, onClickProps, rest), content);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return (0, _react2.jsx)(_badge.EuiBadge, _extends({
|
|
74
|
+
css: cssStyles,
|
|
75
|
+
className: classes,
|
|
76
|
+
color: color,
|
|
77
|
+
"data-test-subj": "euiComboBoxPill",
|
|
78
|
+
title: children
|
|
79
|
+
}, rest, onClickProps), content);
|
|
169
80
|
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.euiComboBoxPillStyles = void 0;
|
|
7
|
+
var _react = require("@emotion/react");
|
|
8
|
+
var _global_styling = require("../../../global_styling");
|
|
9
|
+
/*
|
|
10
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
11
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
12
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
13
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
14
|
+
* Side Public License, v 1.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
var euiComboBoxPillStyles = exports.euiComboBoxPillStyles = function euiComboBoxPillStyles(euiThemeContext) {
|
|
18
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
19
|
+
|
|
20
|
+
// Ensure the input doesn't drop to the next line when the EuiBadge has a very long text
|
|
21
|
+
var pillMaxWidth = "calc(100% - ".concat(euiTheme.size.xxs, " - ").concat(euiTheme.size.base, ")");
|
|
22
|
+
var pillHeight = (0, _global_styling.mathWithUnits)(euiTheme.size.l, function (x) {
|
|
23
|
+
return x - 2;
|
|
24
|
+
});
|
|
25
|
+
var pillLineHeight = (0, _global_styling.mathWithUnits)(pillHeight, function (x) {
|
|
26
|
+
return x - 2;
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
euiComboBoxPill: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('max-width', pillMaxWidth), " ", (0, _global_styling.logicalCSS)('height', pillHeight), " line-height:", pillLineHeight, ";vertical-align:baseline;", (0, _global_styling.logicalCSS)('margin-vertical', '1px'), "&+.euiBadge{", (0, _global_styling.logicalCSS)('margin-left', 0), ";}.euiBadge__text{display:flex;align-items:center;.euiIcon{display:block;}};label:euiComboBoxPill;")
|
|
30
|
+
};
|
|
31
|
+
};
|
|
@@ -8,18 +8,20 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
10
|
var _reactWindow = require("react-window");
|
|
11
|
+
var _services = require("../../../services");
|
|
11
12
|
var _flex = require("../../flex");
|
|
12
13
|
var _highlight = require("../../highlight");
|
|
13
14
|
var _mark = require("../../mark");
|
|
14
15
|
var _text = require("../../text");
|
|
15
16
|
var _loading = require("../../loading");
|
|
16
|
-
var _combo_box_title = require("./combo_box_title");
|
|
17
17
|
var _i18n = require("../../i18n");
|
|
18
18
|
var _filter_select_item = require("../../filter_group/filter_select_item");
|
|
19
19
|
var _badge = require("../../badge");
|
|
20
20
|
var _text_truncate = require("../../text_truncate");
|
|
21
21
|
var _input_popover = require("../../popover/input_popover");
|
|
22
22
|
var _utils = require("../utils");
|
|
23
|
+
var _combo_box_title = require("./combo_box_title");
|
|
24
|
+
var _combo_box_options_list = require("./combo_box_options_list.styles");
|
|
23
25
|
var _react2 = require("@emotion/react");
|
|
24
26
|
var _excluded = ["children"],
|
|
25
27
|
_excluded2 = ["key", "isGroupLabelOption", "label", "value", "prepend", "append", "truncationProps"],
|
|
@@ -134,7 +136,8 @@ var EuiComboBoxOptionsList = exports.EuiComboBoxOptionsList = /*#__PURE__*/funct
|
|
|
134
136
|
className: "euiComboBoxOption__contentWrapper"
|
|
135
137
|
}, (0, _react2.jsx)(_utils.EuiComboBoxOptionAppendPrepend, {
|
|
136
138
|
option: option,
|
|
137
|
-
classNamePrefix: "euiComboBoxOption"
|
|
139
|
+
classNamePrefix: "euiComboBoxOption",
|
|
140
|
+
marginSize: "s"
|
|
138
141
|
}, (0, _react2.jsx)("span", {
|
|
139
142
|
className: "euiComboBoxOption__content"
|
|
140
143
|
}, renderOption ? renderOption(option, searchValue, 'euiComboBoxOption__renderOption') : _this.renderTruncatedOption(label, truncationProps))), optionIsFocused && !optionIsDisabled ? hitEnterBadge : null));
|
|
@@ -192,6 +195,7 @@ var EuiComboBoxOptionsList = exports.EuiComboBoxOptionsList = /*#__PURE__*/funct
|
|
|
192
195
|
}, {
|
|
193
196
|
key: "render",
|
|
194
197
|
value: function render() {
|
|
198
|
+
var _this2 = this;
|
|
195
199
|
var _this$props2 = this.props,
|
|
196
200
|
dataTestSubj = _this$props2['data-test-subj'],
|
|
197
201
|
activeOptionIndex = _this$props2.activeOptionIndex,
|
|
@@ -310,31 +314,35 @@ var EuiComboBoxOptionsList = exports.EuiComboBoxOptionsList = /*#__PURE__*/funct
|
|
|
310
314
|
default: "You've selected all available options"
|
|
311
315
|
}));
|
|
312
316
|
}
|
|
313
|
-
var emptyState = emptyStateContent ? (0, _react2.jsx)(_text.EuiText, {
|
|
314
|
-
size: "xs",
|
|
315
|
-
className: "euiComboBoxOptionsList__empty"
|
|
316
|
-
}, emptyStateContent) : undefined;
|
|
317
317
|
var numVisibleOptions = matchingOptions.length < 7 ? matchingOptions.length : 7;
|
|
318
318
|
var height = numVisibleOptions * (rowHeight + 1); // Add one for the border
|
|
319
319
|
|
|
320
320
|
// bounded by max-height of .euiComboBoxOptionsList
|
|
321
|
-
var boundedHeight = height >
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
321
|
+
var boundedHeight = height > _combo_box_options_list.LIST_MAX_HEIGHT ? _combo_box_options_list.LIST_MAX_HEIGHT : height;
|
|
322
|
+
return (0, _react2.jsx)(_services.RenderWithEuiStylesMemoizer, null, function (stylesMemoizer) {
|
|
323
|
+
var styles = stylesMemoizer(_combo_box_options_list.euiComboBoxOptionListStyles);
|
|
324
|
+
return (0, _react2.jsx)("div", _extends({
|
|
325
|
+
css: styles.euiComboBoxOptionList,
|
|
326
|
+
className: "euiComboBoxOptionsList",
|
|
327
|
+
"data-test-subj": (0, _classnames.default)('comboBoxOptionsList', dataTestSubj),
|
|
328
|
+
ref: listRef
|
|
329
|
+
}, rest), emptyStateContent ? (0, _react2.jsx)(_text.EuiText, {
|
|
330
|
+
size: "xs",
|
|
331
|
+
css: styles.euiComboBoxOptionsList__empty,
|
|
332
|
+
className: "euiComboBoxOptionsList__empty"
|
|
333
|
+
}, emptyStateContent) : (0, _react2.jsx)(_reactWindow.FixedSizeList, {
|
|
334
|
+
css: styles.euiComboBoxOptionList__virtualization,
|
|
335
|
+
className: "euiComboBoxOptionsList__virtualization",
|
|
336
|
+
height: boundedHeight,
|
|
337
|
+
onScroll: onScroll,
|
|
338
|
+
itemCount: matchingOptions.length,
|
|
339
|
+
itemSize: rowHeight,
|
|
340
|
+
itemData: matchingOptions,
|
|
341
|
+
ref: _this2.setListRef,
|
|
342
|
+
innerElementType: _this2.ListInnerElement,
|
|
343
|
+
width: _this2.context
|
|
344
|
+
}, _this2.ListRow));
|
|
345
|
+
});
|
|
338
346
|
}
|
|
339
347
|
}]);
|
|
340
348
|
}(_react.Component);
|