@elastic/eui 88.5.4 → 89.0.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 +26 -526
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +26 -526
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/basic_table/basic_table.js +7 -2
- package/es/components/basic_table/in_memory_table.js +7 -2
- package/es/components/collapsible_nav/collapsible_nav.js +5 -0
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +4 -2
- package/es/components/color_picker/index.js +0 -4
- package/es/components/combo_box/combo_box.js +142 -304
- package/es/components/combo_box/combo_box_input/combo_box_input.js +0 -13
- package/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +34 -118
- package/es/components/context_menu/context_menu_panel.js +6 -6
- package/es/components/flex/flex_grid.styles.js +1 -1
- package/es/components/flex/flex_group.styles.js +1 -1
- package/es/components/flyout/flyout.js +32 -33
- package/es/components/flyout/flyout.styles.js +13 -3
- package/es/components/form/range/dual_range.js +4 -0
- package/es/components/form/range/range.js +4 -0
- package/es/components/index.js +0 -1
- package/es/components/popover/input_popover.js +47 -3
- package/es/components/popover/popover.js +2 -2
- package/es/components/table/table_row_cell.js +27 -9
- package/es/components/text_truncate/index.js +1 -0
- package/es/components/text_truncate/text_block_truncate.js +78 -0
- package/es/global_styling/reset/global_styles.js +16 -2
- package/es/services/accessibility/index.js +0 -3
- package/es/services/index.js +1 -1
- package/es/test/rtl/component_helpers.d.ts +2 -0
- package/es/test/rtl/component_helpers.js +29 -1
- package/eui.d.ts +375 -667
- package/i18ntokens.json +52 -286
- package/lib/components/basic_table/basic_table.js +7 -2
- package/lib/components/basic_table/in_memory_table.js +7 -2
- package/lib/components/collapsible_nav/collapsible_nav.js +5 -0
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +4 -2
- package/lib/components/color_picker/index.js +0 -7
- package/lib/components/combo_box/combo_box.js +141 -303
- package/lib/components/combo_box/combo_box_input/combo_box_input.js +0 -13
- package/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +34 -118
- package/lib/components/context_menu/context_menu_panel.js +5 -5
- package/lib/components/flex/flex_grid.styles.js +1 -1
- package/lib/components/flex/flex_group.styles.js +1 -1
- package/lib/components/flyout/flyout.js +31 -32
- package/lib/components/flyout/flyout.styles.js +19 -10
- package/lib/components/form/range/dual_range.js +4 -0
- package/lib/components/index.js +0 -11
- package/lib/components/popover/input_popover.js +48 -3
- package/lib/components/popover/popover.js +1 -1
- package/lib/components/table/table_row_cell.js +26 -8
- package/lib/components/text_truncate/index.js +7 -0
- package/lib/components/text_truncate/text_block_truncate.js +85 -0
- package/lib/global_styling/reset/global_styles.js +16 -2
- package/lib/services/accessibility/index.js +0 -21
- package/lib/services/index.js +0 -21
- package/lib/test/rtl/component_helpers.d.ts +2 -0
- package/lib/test/rtl/component_helpers.js +31 -2
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +4 -2
- package/optimize/es/components/color_picker/index.js +0 -4
- package/optimize/es/components/combo_box/combo_box.js +137 -304
- package/optimize/es/components/combo_box/combo_box_input/combo_box_input.js +0 -12
- package/optimize/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +28 -107
- package/optimize/es/components/context_menu/context_menu_panel.js +6 -6
- package/optimize/es/components/flex/flex_grid.styles.js +1 -1
- package/optimize/es/components/flex/flex_group.styles.js +1 -1
- package/optimize/es/components/flyout/flyout.js +32 -33
- package/optimize/es/components/flyout/flyout.styles.js +13 -3
- package/optimize/es/components/index.js +0 -1
- package/optimize/es/components/popover/input_popover.js +43 -3
- package/optimize/es/components/popover/popover.js +2 -2
- package/optimize/es/components/table/table_row_cell.js +13 -5
- package/optimize/es/components/text_truncate/index.js +1 -0
- package/optimize/es/components/text_truncate/text_block_truncate.js +58 -0
- package/optimize/es/global_styling/reset/global_styles.js +13 -2
- package/optimize/es/services/accessibility/index.js +0 -3
- package/optimize/es/services/index.js +1 -1
- package/optimize/es/test/rtl/component_helpers.d.ts +2 -0
- package/optimize/es/test/rtl/component_helpers.js +29 -1
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +4 -2
- package/optimize/lib/components/color_picker/index.js +0 -7
- package/optimize/lib/components/combo_box/combo_box.js +136 -303
- package/optimize/lib/components/combo_box/combo_box_input/combo_box_input.js +0 -12
- package/optimize/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +28 -107
- package/optimize/lib/components/context_menu/context_menu_panel.js +5 -5
- package/optimize/lib/components/flex/flex_grid.styles.js +1 -1
- package/optimize/lib/components/flex/flex_group.styles.js +1 -1
- package/optimize/lib/components/flyout/flyout.js +31 -32
- package/optimize/lib/components/flyout/flyout.styles.js +19 -10
- package/optimize/lib/components/index.js +0 -11
- package/optimize/lib/components/popover/input_popover.js +44 -3
- package/optimize/lib/components/popover/popover.js +1 -1
- package/optimize/lib/components/table/table_row_cell.js +12 -4
- package/optimize/lib/components/text_truncate/index.js +7 -0
- package/optimize/lib/components/text_truncate/text_block_truncate.js +66 -0
- package/optimize/lib/global_styling/reset/global_styles.js +19 -10
- package/optimize/lib/services/accessibility/index.js +0 -21
- package/optimize/lib/services/index.js +0 -21
- package/optimize/lib/test/rtl/component_helpers.d.ts +2 -0
- package/optimize/lib/test/rtl/component_helpers.js +31 -2
- package/package.json +1 -1
- package/src/components/combo_box/combo_box_options_list/_combo_box_options_list.scss +5 -15
- package/src/components/context_menu/_context_menu_panel.scss +4 -0
- package/src/components/index.scss +0 -1
- package/src/global_styling/mixins/_index.scss +0 -1
- package/src/global_styling/variables/_index.scss +0 -1
- package/src/test/README.md +0 -15
- package/src/themes/amsterdam/global_styling/mixins/_index.scss +0 -1
- package/test-env/components/basic_table/basic_table.js +7 -2
- package/test-env/components/basic_table/in_memory_table.js +7 -2
- package/test-env/components/collapsible_nav/collapsible_nav.js +5 -0
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +4 -2
- package/test-env/components/color_picker/index.js +0 -7
- package/test-env/components/combo_box/combo_box.js +141 -303
- package/test-env/components/combo_box/combo_box_input/combo_box_input.js +0 -13
- package/test-env/components/combo_box/combo_box_options_list/combo_box_options_list.js +33 -117
- package/test-env/components/context_menu/context_menu_panel.js +5 -5
- package/test-env/components/flex/flex_grid.styles.js +1 -1
- package/test-env/components/flex/flex_group.styles.js +1 -1
- package/test-env/components/flyout/flyout.styles.js +19 -10
- package/test-env/components/form/range/dual_range.js +4 -0
- package/test-env/components/index.js +0 -11
- package/test-env/components/popover/input_popover.js +48 -3
- package/test-env/components/popover/popover.js +1 -1
- package/test-env/components/table/table_row_cell.js +26 -8
- package/test-env/components/text_truncate/index.js +7 -0
- package/test-env/components/text_truncate/text_block_truncate.js +82 -0
- package/test-env/global_styling/reset/global_styles.js +19 -10
- package/test-env/services/accessibility/index.js +0 -21
- package/test-env/services/index.js +0 -21
- package/test-env/test/rtl/component_helpers.js +31 -2
- package/es/components/color_picker/color_stops/color_stop_thumb.js +0 -371
- package/es/components/color_picker/color_stops/color_stop_thumb.styles.js +0 -55
- package/es/components/color_picker/color_stops/color_stops.js +0 -499
- package/es/components/color_picker/color_stops/color_stops.styles.js +0 -61
- package/es/components/color_picker/color_stops/index.js +0 -9
- package/es/components/color_picker/color_stops/utils.js +0 -95
- package/es/components/suggest/index.js +0 -10
- package/es/components/suggest/suggest.a11y.js +0 -70
- package/es/components/suggest/suggest.js +0 -347
- package/es/components/suggest/suggest_item.js +0 -123
- package/es/components/suggest/types.js +0 -9
- package/es/services/accessibility/accessible_click_keys.js +0 -17
- package/es/services/accessibility/cascading_menu_keys.js +0 -28
- package/es/services/accessibility/combo_box_keys.js +0 -25
- package/lib/components/color_picker/color_stops/color_stop_thumb.js +0 -380
- package/lib/components/color_picker/color_stops/color_stop_thumb.styles.js +0 -62
- package/lib/components/color_picker/color_stops/color_stops.js +0 -505
- package/lib/components/color_picker/color_stops/color_stops.styles.js +0 -67
- package/lib/components/color_picker/color_stops/index.js +0 -12
- package/lib/components/color_picker/color_stops/utils.js +0 -108
- package/lib/components/suggest/index.js +0 -19
- package/lib/components/suggest/suggest.a11y.js +0 -73
- package/lib/components/suggest/suggest.js +0 -356
- package/lib/components/suggest/suggest_item.js +0 -130
- package/lib/components/suggest/types.js +0 -16
- package/lib/services/accessibility/accessible_click_keys.js +0 -21
- package/lib/services/accessibility/cascading_menu_keys.js +0 -35
- package/lib/services/accessibility/combo_box_keys.js +0 -32
- package/optimize/es/components/color_picker/color_stops/color_stop_thumb.js +0 -329
- package/optimize/es/components/color_picker/color_stops/color_stop_thumb.styles.js +0 -55
- package/optimize/es/components/color_picker/color_stops/color_stops.js +0 -444
- package/optimize/es/components/color_picker/color_stops/color_stops.styles.js +0 -61
- package/optimize/es/components/color_picker/color_stops/index.js +0 -9
- package/optimize/es/components/color_picker/color_stops/utils.js +0 -90
- package/optimize/es/components/suggest/index.js +0 -10
- package/optimize/es/components/suggest/suggest.a11y.js +0 -70
- package/optimize/es/components/suggest/suggest.js +0 -256
- package/optimize/es/components/suggest/suggest_item.js +0 -89
- package/optimize/es/components/suggest/types.js +0 -9
- package/optimize/es/services/accessibility/accessible_click_keys.js +0 -14
- package/optimize/es/services/accessibility/cascading_menu_keys.js +0 -28
- package/optimize/es/services/accessibility/combo_box_keys.js +0 -25
- package/optimize/lib/components/color_picker/color_stops/color_stop_thumb.js +0 -339
- package/optimize/lib/components/color_picker/color_stops/color_stop_thumb.styles.js +0 -62
- package/optimize/lib/components/color_picker/color_stops/color_stops.js +0 -451
- package/optimize/lib/components/color_picker/color_stops/color_stops.styles.js +0 -67
- package/optimize/lib/components/color_picker/color_stops/index.js +0 -12
- package/optimize/lib/components/color_picker/color_stops/utils.js +0 -106
- package/optimize/lib/components/suggest/index.js +0 -19
- package/optimize/lib/components/suggest/suggest.a11y.js +0 -73
- package/optimize/lib/components/suggest/suggest.js +0 -266
- package/optimize/lib/components/suggest/suggest_item.js +0 -96
- package/optimize/lib/components/suggest/types.js +0 -16
- package/optimize/lib/services/accessibility/accessible_click_keys.js +0 -20
- package/optimize/lib/services/accessibility/cascading_menu_keys.js +0 -35
- package/optimize/lib/services/accessibility/combo_box_keys.js +0 -32
- package/src/components/suggest/_index.scss +0 -5
- package/src/components/suggest/_suggest_input.scss +0 -4
- package/src/components/suggest/_suggest_item.scss +0 -103
- package/src/components/suggest/_variables.scss +0 -13
- package/src/global_styling/mixins/_header.scss +0 -29
- package/src/global_styling/variables/_header.scss +0 -3
- package/test-env/components/color_picker/color_stops/color_stop_thumb.js +0 -372
- package/test-env/components/color_picker/color_stops/color_stop_thumb.styles.js +0 -62
- package/test-env/components/color_picker/color_stops/color_stops.js +0 -494
- package/test-env/components/color_picker/color_stops/color_stops.styles.js +0 -67
- package/test-env/components/color_picker/color_stops/index.js +0 -12
- package/test-env/components/color_picker/color_stops/utils.js +0 -106
- package/test-env/components/suggest/index.js +0 -19
- package/test-env/components/suggest/suggest.a11y.js +0 -73
- package/test-env/components/suggest/suggest.js +0 -348
- package/test-env/components/suggest/suggest_item.js +0 -129
- package/test-env/components/suggest/types.js +0 -16
- package/test-env/services/accessibility/accessible_click_keys.js +0 -20
- package/test-env/services/accessibility/cascading_menu_keys.js +0 -35
- package/test-env/services/accessibility/combo_box_keys.js +0 -32
|
@@ -19,14 +19,13 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
19
19
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
20
20
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
21
21
|
var _services = require("../../services");
|
|
22
|
-
var _popover = require("
|
|
23
|
-
var _portal = require("../portal");
|
|
22
|
+
var _popover = require("../popover");
|
|
24
23
|
var _i18n = require("../i18n");
|
|
25
24
|
var _matching_options = require("./matching_options");
|
|
26
25
|
var _combo_box_input = require("./combo_box_input/combo_box_input");
|
|
27
26
|
var _combo_box_options_list = require("./combo_box_options_list");
|
|
28
27
|
var _react2 = require("@emotion/react");
|
|
29
|
-
var _excluded = ["data-test-subj", "async", "className", "compressed", "customOptionText", "fullWidth", "id", "inputRef", "isCaseSensitive", "isClearable", "isDisabled", "isInvalid", "isLoading", "noSuggestions", "onBlur", "onChange", "onCreateOption", "onSearchChange", "options", "placeholder", "renderOption", "rowHeight", "selectedOptions", "singleSelection", "prepend", "sortMatchesBy", "delimiter", "append", "autoFocus", "truncationProps", "aria-label", "aria-labelledby"];
|
|
28
|
+
var _excluded = ["data-test-subj", "async", "className", "compressed", "customOptionText", "fullWidth", "id", "inputRef", "isCaseSensitive", "isClearable", "isDisabled", "isInvalid", "isLoading", "noSuggestions", "onBlur", "onChange", "onCreateOption", "onSearchChange", "options", "placeholder", "renderOption", "rowHeight", "selectedOptions", "singleSelection", "prepend", "sortMatchesBy", "delimiter", "append", "autoFocus", "truncationProps", "inputPopoverProps", "aria-label", "aria-labelledby"];
|
|
30
29
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
31
30
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
32
31
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -64,9 +63,6 @@ var EuiComboBox = /*#__PURE__*/function (_Component) {
|
|
|
64
63
|
activeOptionIndex: -1,
|
|
65
64
|
hasFocus: false,
|
|
66
65
|
isListOpen: false,
|
|
67
|
-
listElement: null,
|
|
68
|
-
listPosition: 'bottom',
|
|
69
|
-
listZIndex: undefined,
|
|
70
66
|
matchingOptions: (0, _matching_options.getMatchingOptions)({
|
|
71
67
|
options: _this.props.options,
|
|
72
68
|
selectedOptions: _this.props.selectedOptions,
|
|
@@ -76,118 +72,43 @@ var EuiComboBox = /*#__PURE__*/function (_Component) {
|
|
|
76
72
|
showPrevSelected: Boolean(_this.props.singleSelection),
|
|
77
73
|
sortMatchesBy: _this.props.sortMatchesBy
|
|
78
74
|
}),
|
|
79
|
-
searchValue: initialSearchValue
|
|
80
|
-
width: 0
|
|
75
|
+
searchValue: initialSearchValue
|
|
81
76
|
});
|
|
82
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "_isMounted", false);
|
|
83
77
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "rootId", (0, _services.htmlIdGenerator)());
|
|
84
78
|
// Refs
|
|
85
79
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "comboBoxRefInstance", null);
|
|
86
80
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "comboBoxRefCallback", function (ref) {
|
|
87
81
|
_this.comboBoxRefInstance = ref;
|
|
88
|
-
if (_this.comboBoxRefInstance) {
|
|
89
|
-
var comboBoxBounds = _this.comboBoxRefInstance.getBoundingClientRect();
|
|
90
|
-
_this.setState({
|
|
91
|
-
width: comboBoxBounds.width
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
82
|
});
|
|
95
83
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "searchInputRefInstance", null);
|
|
96
84
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "searchInputRefCallback", function (ref) {
|
|
85
|
+
var _this$props$inputRef, _this$props;
|
|
97
86
|
_this.searchInputRefInstance = ref;
|
|
98
|
-
|
|
87
|
+
(_this$props$inputRef = (_this$props = _this.props).inputRef) === null || _this$props$inputRef === void 0 ? void 0 : _this$props$inputRef.call(_this$props, ref);
|
|
99
88
|
});
|
|
100
89
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "listRefInstance", null);
|
|
101
90
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "listRefCallback", function (ref) {
|
|
102
|
-
if (_this.comboBoxRefInstance) {
|
|
103
|
-
// find the zIndex of the combobox relative to the page body
|
|
104
|
-
// and use that to depth-position the list box
|
|
105
|
-
// adds an extra `100` to provide some defense around neighboring elements' positioning
|
|
106
|
-
var listZIndex = (0, _popover.getElementZIndex)(_this.comboBoxRefInstance, document.body) + 100;
|
|
107
|
-
_this.setState({
|
|
108
|
-
listZIndex: listZIndex
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
91
|
_this.listRefInstance = ref;
|
|
112
92
|
});
|
|
113
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "toggleButtonRefInstance", null);
|
|
114
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "toggleButtonRefCallback", function (ref) {
|
|
115
|
-
_this.toggleButtonRefInstance = ref;
|
|
116
|
-
});
|
|
117
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "optionsRefInstances", []);
|
|
118
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "optionRefCallback", function (index, ref) {
|
|
119
|
-
_this.optionsRefInstances[index] = ref;
|
|
120
|
-
});
|
|
121
93
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "openList", function () {
|
|
122
94
|
_this.setState({
|
|
123
95
|
isListOpen: true
|
|
124
96
|
});
|
|
125
97
|
});
|
|
126
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "closeList", function (
|
|
127
|
-
if (event && event.target === _this.searchInputRefInstance) {
|
|
128
|
-
// really long search values / custom entries triggers a scroll event on the input
|
|
129
|
-
// which the EuiComboBoxOptionsList passes through here
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
98
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "closeList", function () {
|
|
132
99
|
_this.clearActiveOption();
|
|
133
100
|
_this.setState({
|
|
134
|
-
listZIndex: undefined,
|
|
135
101
|
isListOpen: false
|
|
136
102
|
});
|
|
137
103
|
});
|
|
138
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "updatePosition", function () {
|
|
139
|
-
var listElement = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.state.listElement;
|
|
140
|
-
if (!_this._isMounted) {
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
if (!_this.state.isListOpen) {
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
if (!listElement) {
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// it's possible that updateListPosition is called when listElement is becoming visible, but isn't yet
|
|
151
|
-
var listElementBounds = listElement.getBoundingClientRect();
|
|
152
|
-
if (listElementBounds.width === 0 || listElementBounds.height === 0) {
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
if (!_this.comboBoxRefInstance) {
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
var comboBoxBounds = _this.comboBoxRefInstance.getBoundingClientRect();
|
|
159
|
-
var _ref = (0, _services.findPopoverPosition)({
|
|
160
|
-
allowCrossAxis: false,
|
|
161
|
-
anchor: _this.comboBoxRefInstance,
|
|
162
|
-
popover: listElement,
|
|
163
|
-
position: 'bottom'
|
|
164
|
-
}),
|
|
165
|
-
position = _ref.position,
|
|
166
|
-
top = _ref.top;
|
|
167
|
-
if (_this.listRefInstance) {
|
|
168
|
-
_this.listRefInstance.style.top = "".concat(top, "px");
|
|
169
|
-
// listElement doesn't have its width set until after updating the position
|
|
170
|
-
// which means the popover service won't know about the correct width
|
|
171
|
-
// however, we already know where to position the element
|
|
172
|
-
_this.listRefInstance.style.left = "".concat(comboBoxBounds.left + window.pageXOffset, "px");
|
|
173
|
-
_this.listRefInstance.style.width = "".concat(comboBoxBounds.width, "px");
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
// Cache for future calls.
|
|
177
|
-
_this.setState({
|
|
178
|
-
listElement: listElement,
|
|
179
|
-
listPosition: position,
|
|
180
|
-
width: comboBoxBounds.width
|
|
181
|
-
});
|
|
182
|
-
});
|
|
183
104
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "incrementActiveOptionIndex", function (amount) {
|
|
184
105
|
// If there are no options available, do nothing.
|
|
185
106
|
if (!_this.state.matchingOptions.length) {
|
|
186
107
|
return;
|
|
187
108
|
}
|
|
188
|
-
_this.setState(function (
|
|
189
|
-
var activeOptionIndex =
|
|
190
|
-
matchingOptions =
|
|
109
|
+
_this.setState(function (_ref) {
|
|
110
|
+
var activeOptionIndex = _ref.activeOptionIndex,
|
|
111
|
+
matchingOptions = _ref.matchingOptions;
|
|
191
112
|
var nextActiveOptionIndex;
|
|
192
113
|
if (activeOptionIndex < 0) {
|
|
193
114
|
// If this is the beginning of the user's keyboard navigation of the menu, then we'll focus
|
|
@@ -230,12 +151,12 @@ var EuiComboBox = /*#__PURE__*/function (_Component) {
|
|
|
230
151
|
_this.onSearchChange('');
|
|
231
152
|
});
|
|
232
153
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "addCustomOption", function (isContainerBlur, searchValue) {
|
|
233
|
-
var _this$
|
|
234
|
-
isCaseSensitive = _this$
|
|
235
|
-
onCreateOption = _this$
|
|
236
|
-
options = _this$
|
|
237
|
-
selectedOptions = _this$
|
|
238
|
-
singleSelection = _this$
|
|
154
|
+
var _this$props2 = _this.props,
|
|
155
|
+
isCaseSensitive = _this$props2.isCaseSensitive,
|
|
156
|
+
onCreateOption = _this$props2.onCreateOption,
|
|
157
|
+
options = _this$props2.options,
|
|
158
|
+
selectedOptions = _this$props2.selectedOptions,
|
|
159
|
+
singleSelection = _this$props2.singleSelection;
|
|
239
160
|
var matchingOptions = _this.state.matchingOptions;
|
|
240
161
|
if (_this.doesSearchMatchOnlyOption()) {
|
|
241
162
|
_this.onAddOption(matchingOptions[0], isContainerBlur);
|
|
@@ -282,11 +203,11 @@ var EuiComboBox = /*#__PURE__*/function (_Component) {
|
|
|
282
203
|
return normalizedSearchSubject === normalizedSearchValue;
|
|
283
204
|
});
|
|
284
205
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "areAllOptionsSelected", function () {
|
|
285
|
-
var _this$
|
|
286
|
-
options = _this$
|
|
287
|
-
selectedOptions = _this$
|
|
288
|
-
async = _this$
|
|
289
|
-
isCaseSensitive = _this$
|
|
206
|
+
var _this$props3 = _this.props,
|
|
207
|
+
options = _this$props3.options,
|
|
208
|
+
selectedOptions = _this$props3.selectedOptions,
|
|
209
|
+
async = _this$props3.async,
|
|
210
|
+
isCaseSensitive = _this$props3.isCaseSensitive;
|
|
290
211
|
// Assume if this is async then there could be infinite options.
|
|
291
212
|
if (async) {
|
|
292
213
|
return false;
|
|
@@ -297,8 +218,8 @@ var EuiComboBox = /*#__PURE__*/function (_Component) {
|
|
|
297
218
|
});
|
|
298
219
|
});
|
|
299
220
|
var numberOfSelectedOptions = 0;
|
|
300
|
-
selectedOptions.forEach(function (
|
|
301
|
-
var label =
|
|
221
|
+
selectedOptions.forEach(function (_ref2) {
|
|
222
|
+
var label = _ref2.label;
|
|
302
223
|
var trimmedLabel = (0, _matching_options.transformForCaseSensitivity)(label.trim(), isCaseSensitive);
|
|
303
224
|
if (flattenOptions.findIndex(function (option) {
|
|
304
225
|
return option.label === trimmedLabel;
|
|
@@ -307,9 +228,8 @@ var EuiComboBox = /*#__PURE__*/function (_Component) {
|
|
|
307
228
|
return flattenOptions.length === numberOfSelectedOptions;
|
|
308
229
|
});
|
|
309
230
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onComboBoxFocus", function (event) {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
}
|
|
231
|
+
var _this$props$onFocus, _this$props4;
|
|
232
|
+
(_this$props$onFocus = (_this$props4 = _this.props).onFocus) === null || _this$props$onFocus === void 0 ? void 0 : _this$props$onFocus.call(_this$props4, event);
|
|
313
233
|
_this.openList();
|
|
314
234
|
_this.setState({
|
|
315
235
|
hasFocus: true
|
|
@@ -332,10 +252,9 @@ var EuiComboBox = /*#__PURE__*/function (_Component) {
|
|
|
332
252
|
var focusedInOptionsList = relatedTarget && _this.listRefInstance && _this.listRefInstance.contains(relatedTarget);
|
|
333
253
|
var focusedInInput = relatedTarget && _this.comboBoxRefInstance && _this.comboBoxRefInstance.contains(relatedTarget);
|
|
334
254
|
if (!focusedInOptionsList && !focusedInInput) {
|
|
255
|
+
var _this$props$onBlur, _this$props5;
|
|
256
|
+
(_this$props$onBlur = (_this$props5 = _this.props).onBlur) === null || _this$props$onBlur === void 0 ? void 0 : _this$props$onBlur.call(_this$props5, event);
|
|
335
257
|
_this.closeList();
|
|
336
|
-
if (_this.props.onBlur) {
|
|
337
|
-
_this.props.onBlur(event);
|
|
338
|
-
}
|
|
339
258
|
_this.setState({
|
|
340
259
|
hasFocus: false
|
|
341
260
|
});
|
|
@@ -358,7 +277,9 @@ var EuiComboBox = /*#__PURE__*/function (_Component) {
|
|
|
358
277
|
}
|
|
359
278
|
});
|
|
360
279
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onKeyDown", function (event) {
|
|
280
|
+
var _this$props$onKeyDown, _this$props6;
|
|
361
281
|
if (_this.props.isDisabled) return;
|
|
282
|
+
event.persist(); // TODO: Remove once React 16 support is dropped
|
|
362
283
|
switch (event.key) {
|
|
363
284
|
case _services.keys.ARROW_UP:
|
|
364
285
|
event.preventDefault();
|
|
@@ -402,9 +323,7 @@ var EuiComboBox = /*#__PURE__*/function (_Component) {
|
|
|
402
323
|
}
|
|
403
324
|
break;
|
|
404
325
|
default:
|
|
405
|
-
|
|
406
|
-
_this.props.onKeyDown(event);
|
|
407
|
-
}
|
|
326
|
+
(_this$props$onKeyDown = (_this$props6 = _this.props).onKeyDown) === null || _this$props$onKeyDown === void 0 ? void 0 : _this$props$onKeyDown.call(_this$props6, event);
|
|
408
327
|
}
|
|
409
328
|
});
|
|
410
329
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onOptionEnterKey", function (option) {
|
|
@@ -417,21 +336,18 @@ var EuiComboBox = /*#__PURE__*/function (_Component) {
|
|
|
417
336
|
if (addedOption.disabled) {
|
|
418
337
|
return;
|
|
419
338
|
}
|
|
420
|
-
var _this$
|
|
421
|
-
onChange = _this$
|
|
422
|
-
selectedOptions = _this$
|
|
423
|
-
singleSelectionProp = _this$
|
|
339
|
+
var _this$props7 = _this.props,
|
|
340
|
+
onChange = _this$props7.onChange,
|
|
341
|
+
selectedOptions = _this$props7.selectedOptions,
|
|
342
|
+
singleSelectionProp = _this$props7.singleSelection;
|
|
424
343
|
var singleSelection = Boolean(singleSelectionProp);
|
|
425
344
|
var changeOptions = singleSelection ? [addedOption] : selectedOptions.concat(addedOption);
|
|
426
|
-
|
|
427
|
-
onChange(changeOptions);
|
|
428
|
-
}
|
|
345
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(changeOptions);
|
|
429
346
|
_this.clearSearchValue();
|
|
430
347
|
_this.clearActiveOption();
|
|
431
348
|
if (!isContainerBlur) {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
}
|
|
349
|
+
var _this$searchInputRefI2;
|
|
350
|
+
(_this$searchInputRefI2 = _this.searchInputRefInstance) === null || _this$searchInputRefI2 === void 0 ? void 0 : _this$searchInputRefI2.focus();
|
|
435
351
|
}
|
|
436
352
|
if (singleSelection) {
|
|
437
353
|
requestAnimationFrame(function () {
|
|
@@ -444,36 +360,29 @@ var EuiComboBox = /*#__PURE__*/function (_Component) {
|
|
|
444
360
|
}
|
|
445
361
|
});
|
|
446
362
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onRemoveOption", function (removedOption) {
|
|
447
|
-
var _this$
|
|
448
|
-
onChange = _this$
|
|
449
|
-
selectedOptions = _this$
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
}));
|
|
454
|
-
}
|
|
363
|
+
var _this$props8 = _this.props,
|
|
364
|
+
onChange = _this$props8.onChange,
|
|
365
|
+
selectedOptions = _this$props8.selectedOptions;
|
|
366
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(selectedOptions.filter(function (option) {
|
|
367
|
+
return option !== removedOption;
|
|
368
|
+
}));
|
|
455
369
|
_this.clearActiveOption();
|
|
456
370
|
});
|
|
457
371
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "clearSelectedOptions", function () {
|
|
458
|
-
var onChange
|
|
459
|
-
|
|
460
|
-
onChange([]);
|
|
461
|
-
}
|
|
372
|
+
var _this$props$onChange, _this$props9, _this$searchInputRefI3;
|
|
373
|
+
(_this$props$onChange = (_this$props9 = _this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props9, []);
|
|
462
374
|
|
|
463
375
|
// Clicking the clear button will also cause it to disappear. This would result in focus
|
|
464
376
|
// shifting unexpectedly to the body element so we set it to the input which is more reasonable,
|
|
465
|
-
|
|
466
|
-
_this.searchInputRefInstance.focus();
|
|
467
|
-
}
|
|
377
|
+
(_this$searchInputRefI3 = _this.searchInputRefInstance) === null || _this$searchInputRefI3 === void 0 ? void 0 : _this$searchInputRefI3.focus();
|
|
468
378
|
if (!_this.state.isListOpen) {
|
|
469
379
|
_this.openList();
|
|
470
380
|
}
|
|
471
381
|
});
|
|
472
382
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onComboBoxClick", function () {
|
|
383
|
+
var _this$searchInputRefI4;
|
|
473
384
|
// When the user clicks anywhere on the box, enter the interaction state.
|
|
474
|
-
|
|
475
|
-
_this.searchInputRefInstance.focus();
|
|
476
|
-
}
|
|
385
|
+
(_this$searchInputRefI4 = _this.searchInputRefInstance) === null || _this$searchInputRefI4 === void 0 ? void 0 : _this$searchInputRefI4.focus();
|
|
477
386
|
|
|
478
387
|
// If the user does this from a state in which an option has focus, then we need to reset it or clear it.
|
|
479
388
|
if (Boolean(_this.props.singleSelection) && _this.props.selectedOptions.length === 1) {
|
|
@@ -488,25 +397,20 @@ var EuiComboBox = /*#__PURE__*/function (_Component) {
|
|
|
488
397
|
}
|
|
489
398
|
});
|
|
490
399
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onOpenListClick", function () {
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
}
|
|
400
|
+
var _this$searchInputRefI5;
|
|
401
|
+
(_this$searchInputRefI5 = _this.searchInputRefInstance) === null || _this$searchInputRefI5 === void 0 ? void 0 : _this$searchInputRefI5.focus();
|
|
494
402
|
if (!_this.state.isListOpen) {
|
|
495
403
|
_this.openList();
|
|
496
404
|
}
|
|
497
405
|
});
|
|
498
406
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onOptionListScroll", function () {
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
}
|
|
502
|
-
});
|
|
503
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onCloseListClick", function () {
|
|
504
|
-
_this.closeList();
|
|
407
|
+
var _this$searchInputRefI6;
|
|
408
|
+
(_this$searchInputRefI6 = _this.searchInputRefInstance) === null || _this$searchInputRefI6 === void 0 ? void 0 : _this$searchInputRefI6.focus();
|
|
505
409
|
});
|
|
506
410
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onSearchChange", function (searchValue) {
|
|
507
|
-
var _this$
|
|
508
|
-
onSearchChange = _this$
|
|
509
|
-
delimiter = _this$
|
|
411
|
+
var _this$props10 = _this.props,
|
|
412
|
+
onSearchChange = _this$props10.onSearchChange,
|
|
413
|
+
delimiter = _this$props10.delimiter;
|
|
510
414
|
if (onSearchChange) {
|
|
511
415
|
var _hasMatchingOptions = _this.state.matchingOptions.length > 0;
|
|
512
416
|
onSearchChange(searchValue, _hasMatchingOptions);
|
|
@@ -520,126 +424,53 @@ var EuiComboBox = /*#__PURE__*/function (_Component) {
|
|
|
520
424
|
_this.setCustomOptions(false);
|
|
521
425
|
}
|
|
522
426
|
});
|
|
523
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "updateMatchingOptionsIfDifferent", function (newMatchingOptions) {
|
|
524
|
-
var _this$state = _this.state,
|
|
525
|
-
matchingOptions = _this$state.matchingOptions,
|
|
526
|
-
activeOptionIndex = _this$state.activeOptionIndex;
|
|
527
|
-
var _this$props6 = _this.props,
|
|
528
|
-
singleSelection = _this$props6.singleSelection,
|
|
529
|
-
selectedOptions = _this$props6.selectedOptions;
|
|
530
|
-
var areOptionsDifferent = false;
|
|
531
|
-
if (matchingOptions.length !== newMatchingOptions.length) {
|
|
532
|
-
areOptionsDifferent = true;
|
|
533
|
-
} else {
|
|
534
|
-
for (var i = 0; i < matchingOptions.length; i++) {
|
|
535
|
-
if (matchingOptions[i].label !== newMatchingOptions[i].label) {
|
|
536
|
-
areOptionsDifferent = true;
|
|
537
|
-
break;
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
if (areOptionsDifferent) {
|
|
542
|
-
_this.optionsRefInstances = [];
|
|
543
|
-
var nextActiveOptionIndex = activeOptionIndex;
|
|
544
|
-
// ensure that the currently selected single option is active if it is in the matchingOptions
|
|
545
|
-
if (Boolean(singleSelection) && selectedOptions.length === 1) {
|
|
546
|
-
if (newMatchingOptions.includes(selectedOptions[0])) {
|
|
547
|
-
nextActiveOptionIndex = newMatchingOptions.indexOf(selectedOptions[0]);
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
_this.setState({
|
|
551
|
-
matchingOptions: newMatchingOptions,
|
|
552
|
-
activeOptionIndex: nextActiveOptionIndex
|
|
553
|
-
});
|
|
554
|
-
if (!newMatchingOptions.length) {
|
|
555
|
-
// Prevent endless setState -> componentWillUpdate -> setState loop.
|
|
556
|
-
if (_this.hasActiveOption()) {
|
|
557
|
-
_this.clearActiveOption();
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
});
|
|
562
427
|
return _this;
|
|
563
428
|
}
|
|
564
429
|
(0, _createClass2.default)(EuiComboBox, [{
|
|
565
|
-
key: "componentDidMount",
|
|
566
|
-
value: function componentDidMount() {
|
|
567
|
-
this._isMounted = true;
|
|
568
|
-
}
|
|
569
|
-
}, {
|
|
570
|
-
key: "componentDidUpdate",
|
|
571
|
-
value: function componentDidUpdate() {
|
|
572
|
-
var _this$props7 = this.props,
|
|
573
|
-
options = _this$props7.options,
|
|
574
|
-
selectedOptions = _this$props7.selectedOptions,
|
|
575
|
-
singleSelection = _this$props7.singleSelection,
|
|
576
|
-
sortMatchesBy = _this$props7.sortMatchesBy;
|
|
577
|
-
var searchValue = this.state.searchValue;
|
|
578
|
-
|
|
579
|
-
// React 16.3 has a bug (fixed in 16.4) where getDerivedStateFromProps
|
|
580
|
-
// isn't called after a state change, and we track `searchValue` in state
|
|
581
|
-
// instead we need to react to a change in searchValue here
|
|
582
|
-
this.updateMatchingOptionsIfDifferent((0, _matching_options.getMatchingOptions)({
|
|
583
|
-
options: options,
|
|
584
|
-
selectedOptions: selectedOptions,
|
|
585
|
-
searchValue: searchValue,
|
|
586
|
-
isCaseSensitive: this.props.isCaseSensitive,
|
|
587
|
-
isPreFiltered: this.props.async,
|
|
588
|
-
showPrevSelected: Boolean(singleSelection),
|
|
589
|
-
sortMatchesBy: sortMatchesBy
|
|
590
|
-
}));
|
|
591
|
-
}
|
|
592
|
-
}, {
|
|
593
|
-
key: "componentWillUnmount",
|
|
594
|
-
value: function componentWillUnmount() {
|
|
595
|
-
this._isMounted = false;
|
|
596
|
-
}
|
|
597
|
-
}, {
|
|
598
430
|
key: "render",
|
|
599
431
|
value: function render() {
|
|
600
432
|
var _this2 = this;
|
|
601
|
-
var _this$
|
|
602
|
-
dataTestSubj = _this$
|
|
603
|
-
async = _this$
|
|
604
|
-
className = _this$
|
|
605
|
-
compressed = _this$
|
|
606
|
-
customOptionText = _this$
|
|
607
|
-
fullWidth = _this$
|
|
608
|
-
id = _this$
|
|
609
|
-
inputRef = _this$
|
|
610
|
-
isCaseSensitive = _this$
|
|
611
|
-
isClearable = _this$
|
|
612
|
-
isDisabled = _this$
|
|
613
|
-
isInvalid = _this$
|
|
614
|
-
isLoading = _this$
|
|
615
|
-
noSuggestions = _this$
|
|
616
|
-
onBlur = _this$
|
|
617
|
-
onChange = _this$
|
|
618
|
-
onCreateOption = _this$
|
|
619
|
-
onSearchChange = _this$
|
|
620
|
-
options = _this$
|
|
621
|
-
placeholder = _this$
|
|
622
|
-
renderOption = _this$
|
|
623
|
-
rowHeight = _this$
|
|
624
|
-
selectedOptions = _this$
|
|
625
|
-
singleSelection = _this$
|
|
626
|
-
prepend = _this$
|
|
627
|
-
sortMatchesBy = _this$
|
|
628
|
-
delimiter = _this$
|
|
629
|
-
append = _this$
|
|
630
|
-
autoFocus = _this$
|
|
631
|
-
truncationProps = _this$
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
searchValue = _this$
|
|
641
|
-
|
|
642
|
-
matchingOptions = _this$state2.matchingOptions;
|
|
433
|
+
var _this$props11 = this.props,
|
|
434
|
+
dataTestSubj = _this$props11['data-test-subj'],
|
|
435
|
+
async = _this$props11.async,
|
|
436
|
+
className = _this$props11.className,
|
|
437
|
+
compressed = _this$props11.compressed,
|
|
438
|
+
customOptionText = _this$props11.customOptionText,
|
|
439
|
+
fullWidth = _this$props11.fullWidth,
|
|
440
|
+
id = _this$props11.id,
|
|
441
|
+
inputRef = _this$props11.inputRef,
|
|
442
|
+
isCaseSensitive = _this$props11.isCaseSensitive,
|
|
443
|
+
isClearable = _this$props11.isClearable,
|
|
444
|
+
isDisabled = _this$props11.isDisabled,
|
|
445
|
+
isInvalid = _this$props11.isInvalid,
|
|
446
|
+
isLoading = _this$props11.isLoading,
|
|
447
|
+
noSuggestions = _this$props11.noSuggestions,
|
|
448
|
+
onBlur = _this$props11.onBlur,
|
|
449
|
+
onChange = _this$props11.onChange,
|
|
450
|
+
onCreateOption = _this$props11.onCreateOption,
|
|
451
|
+
onSearchChange = _this$props11.onSearchChange,
|
|
452
|
+
options = _this$props11.options,
|
|
453
|
+
placeholder = _this$props11.placeholder,
|
|
454
|
+
renderOption = _this$props11.renderOption,
|
|
455
|
+
rowHeight = _this$props11.rowHeight,
|
|
456
|
+
selectedOptions = _this$props11.selectedOptions,
|
|
457
|
+
singleSelection = _this$props11.singleSelection,
|
|
458
|
+
prepend = _this$props11.prepend,
|
|
459
|
+
sortMatchesBy = _this$props11.sortMatchesBy,
|
|
460
|
+
delimiter = _this$props11.delimiter,
|
|
461
|
+
append = _this$props11.append,
|
|
462
|
+
autoFocus = _this$props11.autoFocus,
|
|
463
|
+
truncationProps = _this$props11.truncationProps,
|
|
464
|
+
inputPopoverProps = _this$props11.inputPopoverProps,
|
|
465
|
+
ariaLabel = _this$props11['aria-label'],
|
|
466
|
+
ariaLabelledby = _this$props11['aria-labelledby'],
|
|
467
|
+
rest = (0, _objectWithoutProperties2.default)(_this$props11, _excluded);
|
|
468
|
+
var _this$state = this.state,
|
|
469
|
+
activeOptionIndex = _this$state.activeOptionIndex,
|
|
470
|
+
hasFocus = _this$state.hasFocus,
|
|
471
|
+
isListOpen = _this$state.isListOpen,
|
|
472
|
+
searchValue = _this$state.searchValue,
|
|
473
|
+
matchingOptions = _this$state.matchingOptions;
|
|
643
474
|
|
|
644
475
|
// Make sure we have a valid ID if users don't pass one as a prop
|
|
645
476
|
var inputId = id !== null && id !== void 0 ? id : this.rootId('_eui-combobox-id');
|
|
@@ -663,12 +494,11 @@ var EuiComboBox = /*#__PURE__*/function (_Component) {
|
|
|
663
494
|
var optionsList;
|
|
664
495
|
if (!noSuggestions && isListOpen) {
|
|
665
496
|
var optionsListDataTestSubj = dataTestSubj ? "".concat(dataTestSubj, "-optionsList") : undefined;
|
|
666
|
-
optionsList = (0, _react2.jsx)(
|
|
497
|
+
optionsList = (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
667
498
|
token: "euiComboBox.listboxAriaLabel",
|
|
668
499
|
default: "Choose from the following options"
|
|
669
500
|
}, function (listboxAriaLabel) {
|
|
670
501
|
return (0, _react2.jsx)(_combo_box_options_list.EuiComboBoxOptionsList, {
|
|
671
|
-
zIndex: _this2.state.listZIndex,
|
|
672
502
|
activeOptionIndex: _this2.state.activeOptionIndex,
|
|
673
503
|
areAllOptionsSelected: _this2.areAllOptionsSelected(),
|
|
674
504
|
customOptionText: customOptionText,
|
|
@@ -683,9 +513,7 @@ var EuiComboBox = /*#__PURE__*/function (_Component) {
|
|
|
683
513
|
onOptionClick: _this2.onOptionClick,
|
|
684
514
|
onOptionEnterKey: _this2.onOptionEnterKey,
|
|
685
515
|
onScroll: _this2.onOptionListScroll,
|
|
686
|
-
optionRef: _this2.optionRefCallback,
|
|
687
516
|
options: options,
|
|
688
|
-
position: listPosition,
|
|
689
517
|
singleSelection: singleSelection,
|
|
690
518
|
renderOption: renderOption,
|
|
691
519
|
rootId: _this2.rootId,
|
|
@@ -693,14 +521,12 @@ var EuiComboBox = /*#__PURE__*/function (_Component) {
|
|
|
693
521
|
scrollToIndex: activeOptionIndex,
|
|
694
522
|
searchValue: searchValue,
|
|
695
523
|
selectedOptions: selectedOptions,
|
|
696
|
-
updatePosition: _this2.updatePosition,
|
|
697
|
-
width: width,
|
|
698
524
|
delimiter: delimiter,
|
|
699
525
|
getSelectedOptionForSearchValue: _matching_options.getSelectedOptionForSearchValue,
|
|
700
526
|
listboxAriaLabel: listboxAriaLabel,
|
|
701
527
|
truncationProps: truncationProps
|
|
702
528
|
});
|
|
703
|
-
})
|
|
529
|
+
});
|
|
704
530
|
}
|
|
705
531
|
return (
|
|
706
532
|
/**
|
|
@@ -716,39 +542,46 @@ var EuiComboBox = /*#__PURE__*/function (_Component) {
|
|
|
716
542
|
onKeyDown: this.onKeyDown,
|
|
717
543
|
onBlur: this.onContainerBlur,
|
|
718
544
|
ref: this.comboBoxRefCallback
|
|
719
|
-
}), (0, _react2.jsx)(
|
|
720
|
-
compressed: compressed,
|
|
721
|
-
focusedOptionId: this.hasActiveOption() ? this.rootId("_option-".concat(this.state.activeOptionIndex)) : undefined,
|
|
545
|
+
}), (0, _react2.jsx)(_popover.EuiInputPopover, (0, _extends2.default)({
|
|
722
546
|
fullWidth: fullWidth,
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
547
|
+
panelPaddingSize: "none",
|
|
548
|
+
disableFocusTrap: true,
|
|
549
|
+
closeOnScroll: true
|
|
550
|
+
}, inputPopoverProps, {
|
|
551
|
+
isOpen: isListOpen,
|
|
552
|
+
closePopover: this.closeList,
|
|
553
|
+
input: (0, _react2.jsx)(_combo_box_input.EuiComboBoxInput, {
|
|
554
|
+
compressed: compressed,
|
|
555
|
+
focusedOptionId: this.hasActiveOption() ? this.rootId("_option-".concat(this.state.activeOptionIndex)) : undefined,
|
|
556
|
+
fullWidth: fullWidth,
|
|
557
|
+
hasSelectedOptions: selectedOptions.length > 0,
|
|
558
|
+
id: inputId,
|
|
559
|
+
inputRef: this.searchInputRefCallback,
|
|
560
|
+
isDisabled: isDisabled,
|
|
561
|
+
isListOpen: isListOpen,
|
|
562
|
+
noIcon: !!noSuggestions,
|
|
563
|
+
onChange: this.onSearchChange,
|
|
564
|
+
onClear: isClearable && !isDisabled ? this.clearSelectedOptions : undefined,
|
|
565
|
+
onClick: this.onComboBoxClick,
|
|
566
|
+
onCloseListClick: this.closeList,
|
|
567
|
+
onFocus: this.onComboBoxFocus,
|
|
568
|
+
onOpenListClick: this.onOpenListClick,
|
|
569
|
+
onRemoveOption: this.onRemoveOption,
|
|
570
|
+
placeholder: placeholder,
|
|
571
|
+
rootId: this.rootId,
|
|
572
|
+
searchValue: searchValue,
|
|
573
|
+
selectedOptions: selectedOptions,
|
|
574
|
+
singleSelection: singleSelection,
|
|
575
|
+
value: value,
|
|
576
|
+
append: singleSelection ? append : undefined,
|
|
577
|
+
prepend: singleSelection ? prepend : undefined,
|
|
578
|
+
isLoading: isLoading,
|
|
579
|
+
isInvalid: markAsInvalid,
|
|
580
|
+
autoFocus: autoFocus,
|
|
581
|
+
"aria-label": ariaLabel,
|
|
582
|
+
"aria-labelledby": ariaLabelledby
|
|
583
|
+
})
|
|
584
|
+
}), optionsList))
|
|
752
585
|
);
|
|
753
586
|
}
|
|
754
587
|
}], [{
|
|
@@ -904,5 +737,10 @@ EuiComboBox.propTypes = {
|
|
|
904
737
|
* text will always take precedence.
|
|
905
738
|
*/
|
|
906
739
|
truncationProps: _propTypes.default.any,
|
|
740
|
+
/**
|
|
741
|
+
* Allows customizing the underlying EuiInputPopover component
|
|
742
|
+
* (except for props that control state).
|
|
743
|
+
*/
|
|
744
|
+
inputPopoverProps: _propTypes.default.any,
|
|
907
745
|
css: _propTypes.default.any
|
|
908
746
|
};
|