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