@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
|
@@ -59,12 +59,6 @@ export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
|
|
|
59
59
|
inputWidth: inputWidth
|
|
60
60
|
});
|
|
61
61
|
});
|
|
62
|
-
_defineProperty(_assertThisInitialized(_this), "updatePosition", function () {
|
|
63
|
-
// Wait a beat for the DOM to update, since we depend on DOM elements' bounds.
|
|
64
|
-
requestAnimationFrame(function () {
|
|
65
|
-
_this.props.updatePosition();
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
62
|
_defineProperty(_assertThisInitialized(_this), "onFocus", function (event) {
|
|
69
63
|
_this.props.onFocus(event);
|
|
70
64
|
_this.setState({
|
|
@@ -105,10 +99,6 @@ export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
|
|
|
105
99
|
value: function componentDidUpdate(prevProps) {
|
|
106
100
|
if (prevProps.searchValue !== this.props.searchValue) {
|
|
107
101
|
this.updateInputSize(this.props.searchValue);
|
|
108
|
-
|
|
109
|
-
// We need to update the position of everything if the user enters enough input to change
|
|
110
|
-
// the size of the input.
|
|
111
|
-
this.updatePosition();
|
|
112
102
|
}
|
|
113
103
|
}
|
|
114
104
|
}, {
|
|
@@ -134,7 +124,6 @@ export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
|
|
|
134
124
|
searchValue = _this$props3.searchValue,
|
|
135
125
|
selectedOptions = _this$props3.selectedOptions,
|
|
136
126
|
singleSelectionProp = _this$props3.singleSelection,
|
|
137
|
-
toggleButtonRef = _this$props3.toggleButtonRef,
|
|
138
127
|
value = _this$props3.value,
|
|
139
128
|
prepend = _this$props3.prepend,
|
|
140
129
|
append = _this$props3.append,
|
|
@@ -201,7 +190,6 @@ export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
|
|
|
201
190
|
'data-test-subj': 'comboBoxToggleListButton',
|
|
202
191
|
disabled: isDisabled,
|
|
203
192
|
onClick: isListOpen && !isDisabled ? onCloseListClick : onOpenListClick,
|
|
204
|
-
ref: toggleButtonRef,
|
|
205
193
|
side: 'right',
|
|
206
194
|
tabIndex: -1,
|
|
207
195
|
type: 'arrowDown'
|
|
@@ -7,8 +7,9 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
7
7
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
8
8
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
9
9
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
10
|
-
var _excluded = ["
|
|
11
|
-
_excluded2 = ["
|
|
10
|
+
var _excluded = ["children"],
|
|
11
|
+
_excluded2 = ["key", "isGroupLabelOption", "label", "value", "prepend", "append", "truncationProps"],
|
|
12
|
+
_excluded3 = ["data-test-subj", "activeOptionIndex", "areAllOptionsSelected", "customOptionText", "fullWidth", "getSelectedOptionForSearchValue", "isCaseSensitive", "isLoading", "listRef", "matchingOptions", "onCloseList", "onCreateOption", "onOptionClick", "onOptionEnterKey", "onScroll", "options", "renderOption", "rootId", "rowHeight", "scrollToIndex", "searchValue", "selectedOptions", "singleSelection", "delimiter", "truncationProps", "listboxAriaLabel"];
|
|
12
13
|
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; }
|
|
13
14
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
14
15
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
@@ -33,8 +34,8 @@ import { EuiComboBoxTitle } from './combo_box_title';
|
|
|
33
34
|
import { EuiI18n } from '../../i18n';
|
|
34
35
|
import { EuiFilterSelectItem } from '../../filter_group/filter_select_item';
|
|
35
36
|
import { EuiBadge } from '../../badge';
|
|
36
|
-
import { EuiPopoverPanel } from '../../popover/popover_panel';
|
|
37
37
|
import { EuiTextTruncate } from '../../text_truncate';
|
|
38
|
+
import { EuiInputPopoverWidthContext } from '../../popover/input_popover';
|
|
38
39
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
39
40
|
var hitEnterBadge = ___EmotionJSX(EuiBadge, {
|
|
40
41
|
className: "euiComboBoxOption__enterBadge",
|
|
@@ -52,43 +53,25 @@ export var EuiComboBoxOptionsList = /*#__PURE__*/function (_Component) {
|
|
|
52
53
|
args[_key] = arguments[_key];
|
|
53
54
|
}
|
|
54
55
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
55
|
-
_defineProperty(_assertThisInitialized(_this), "listRefInstance", null);
|
|
56
56
|
_defineProperty(_assertThisInitialized(_this), "listRef", null);
|
|
57
|
-
_defineProperty(_assertThisInitialized(_this), "listBoxRef", null);
|
|
58
|
-
_defineProperty(_assertThisInitialized(_this), "updatePosition", function () {
|
|
59
|
-
// Wait a beat for the DOM to update, since we depend on DOM elements' bounds.
|
|
60
|
-
requestAnimationFrame(function () {
|
|
61
|
-
_this.props.updatePosition(_this.listRefInstance);
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
_defineProperty(_assertThisInitialized(_this), "closeListOnScroll", function (event) {
|
|
65
|
-
// Close the list when a scroll event happens, but not if the scroll happened in the options list.
|
|
66
|
-
// This mirrors Firefox's approach of auto-closing `select` elements onscroll.
|
|
67
|
-
if (_this.listRefInstance && event.target && _this.listRefInstance.contains(event.target) === false) {
|
|
68
|
-
_this.props.onCloseList(event);
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
_defineProperty(_assertThisInitialized(_this), "listRefCallback", function (ref) {
|
|
72
|
-
_this.props.listRef(ref);
|
|
73
|
-
_this.listRefInstance = ref;
|
|
74
|
-
});
|
|
75
57
|
_defineProperty(_assertThisInitialized(_this), "setListRef", function (ref) {
|
|
76
58
|
_this.listRef = ref;
|
|
77
59
|
});
|
|
78
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
60
|
+
_defineProperty(_assertThisInitialized(_this), "ListInnerElement", function (_ref) {
|
|
61
|
+
var children = _ref.children,
|
|
62
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
63
|
+
return ___EmotionJSX("div", _extends({}, rest, {
|
|
64
|
+
"aria-label": _this.props.listboxAriaLabel,
|
|
65
|
+
id: _this.props.rootId('listbox'),
|
|
66
|
+
role: "listbox",
|
|
67
|
+
tabIndex: "0"
|
|
68
|
+
}), children);
|
|
86
69
|
});
|
|
87
|
-
_defineProperty(_assertThisInitialized(_this), "ListRow", function (
|
|
70
|
+
_defineProperty(_assertThisInitialized(_this), "ListRow", function (_ref2) {
|
|
88
71
|
var _option$key;
|
|
89
|
-
var data =
|
|
90
|
-
index =
|
|
91
|
-
style =
|
|
72
|
+
var data = _ref2.data,
|
|
73
|
+
index = _ref2.index,
|
|
74
|
+
style = _ref2.style;
|
|
92
75
|
var option = data[index];
|
|
93
76
|
var key = option.key,
|
|
94
77
|
isGroupLabelOption = option.isGroupLabelOption,
|
|
@@ -97,12 +80,11 @@ export var EuiComboBoxOptionsList = /*#__PURE__*/function (_Component) {
|
|
|
97
80
|
prepend = option.prepend,
|
|
98
81
|
append = option.append,
|
|
99
82
|
_truncationProps = option.truncationProps,
|
|
100
|
-
rest = _objectWithoutProperties(option,
|
|
83
|
+
rest = _objectWithoutProperties(option, _excluded2);
|
|
101
84
|
var _this$props = _this.props,
|
|
102
85
|
singleSelection = _this$props.singleSelection,
|
|
103
86
|
selectedOptions = _this$props.selectedOptions,
|
|
104
87
|
onOptionClick = _this$props.onOptionClick,
|
|
105
|
-
optionRef = _this$props.optionRef,
|
|
106
88
|
activeOptionIndex = _this$props.activeOptionIndex,
|
|
107
89
|
renderOption = _this$props.renderOption,
|
|
108
90
|
searchValue = _this$props.searchValue,
|
|
@@ -130,7 +112,6 @@ export var EuiComboBoxOptionsList = /*#__PURE__*/function (_Component) {
|
|
|
130
112
|
onOptionClick(option);
|
|
131
113
|
}
|
|
132
114
|
},
|
|
133
|
-
ref: optionRef.bind(_assertThisInitialized(_this), index),
|
|
134
115
|
isFocused: optionIsFocused,
|
|
135
116
|
checked: checked,
|
|
136
117
|
showIcons: singleSelection ? true : false,
|
|
@@ -189,51 +170,12 @@ export var EuiComboBoxOptionsList = /*#__PURE__*/function (_Component) {
|
|
|
189
170
|
return _this;
|
|
190
171
|
}
|
|
191
172
|
_createClass(EuiComboBoxOptionsList, [{
|
|
192
|
-
key: "componentDidMount",
|
|
193
|
-
value: function componentDidMount() {
|
|
194
|
-
var _this2 = this;
|
|
195
|
-
// Wait a frame, otherwise moving focus from one combo box to another will result in the class
|
|
196
|
-
// being removed from the body.
|
|
197
|
-
requestAnimationFrame(function () {
|
|
198
|
-
document.body.classList.add('euiBody-hasPortalContent');
|
|
199
|
-
});
|
|
200
|
-
this.updatePosition();
|
|
201
|
-
window.addEventListener('resize', this.updatePosition);
|
|
202
|
-
|
|
203
|
-
// Firefox will trigger a scroll event in many common situations when the options list div is appended
|
|
204
|
-
// to the DOM; in testing it was always within 100ms, but setting a timeout here for 500ms to be safe
|
|
205
|
-
setTimeout(function () {
|
|
206
|
-
window.addEventListener('scroll', _this2.closeListOnScroll, {
|
|
207
|
-
passive: true,
|
|
208
|
-
// for better performance as we won't call preventDefault
|
|
209
|
-
capture: true // scroll events don't bubble, they must be captured instead
|
|
210
|
-
});
|
|
211
|
-
}, 500);
|
|
212
|
-
}
|
|
213
|
-
}, {
|
|
214
173
|
key: "componentDidUpdate",
|
|
215
174
|
value: function componentDidUpdate(prevProps) {
|
|
216
|
-
var options = prevProps.options,
|
|
217
|
-
selectedOptions = prevProps.selectedOptions,
|
|
218
|
-
searchValue = prevProps.searchValue;
|
|
219
|
-
|
|
220
|
-
// We don't compare matchingOptions because that will result in a loop.
|
|
221
|
-
if (searchValue !== this.props.searchValue || options !== this.props.options || selectedOptions !== this.props.selectedOptions) {
|
|
222
|
-
this.updatePosition();
|
|
223
|
-
}
|
|
224
175
|
if (this.listRef && typeof this.props.activeOptionIndex !== 'undefined' && this.props.activeOptionIndex !== prevProps.activeOptionIndex) {
|
|
225
176
|
this.listRef.scrollToItem(this.props.activeOptionIndex, 'auto');
|
|
226
177
|
}
|
|
227
178
|
}
|
|
228
|
-
}, {
|
|
229
|
-
key: "componentWillUnmount",
|
|
230
|
-
value: function componentWillUnmount() {
|
|
231
|
-
document.body.classList.remove('euiBody-hasPortalContent');
|
|
232
|
-
window.removeEventListener('resize', this.updatePosition);
|
|
233
|
-
window.removeEventListener('scroll', this.closeListOnScroll, {
|
|
234
|
-
capture: true
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
179
|
}, {
|
|
238
180
|
key: "render",
|
|
239
181
|
value: function render() {
|
|
@@ -253,10 +195,7 @@ export var EuiComboBoxOptionsList = /*#__PURE__*/function (_Component) {
|
|
|
253
195
|
onOptionClick = _this$props2.onOptionClick,
|
|
254
196
|
onOptionEnterKey = _this$props2.onOptionEnterKey,
|
|
255
197
|
onScroll = _this$props2.onScroll,
|
|
256
|
-
optionRef = _this$props2.optionRef,
|
|
257
198
|
options = _this$props2.options,
|
|
258
|
-
_this$props2$position = _this$props2.position,
|
|
259
|
-
position = _this$props2$position === void 0 ? 'bottom' : _this$props2$position,
|
|
260
199
|
renderOption = _this$props2.renderOption,
|
|
261
200
|
rootId = _this$props2.rootId,
|
|
262
201
|
rowHeight = _this$props2.rowHeight,
|
|
@@ -264,14 +203,10 @@ export var EuiComboBoxOptionsList = /*#__PURE__*/function (_Component) {
|
|
|
264
203
|
searchValue = _this$props2.searchValue,
|
|
265
204
|
selectedOptions = _this$props2.selectedOptions,
|
|
266
205
|
singleSelection = _this$props2.singleSelection,
|
|
267
|
-
updatePosition = _this$props2.updatePosition,
|
|
268
|
-
width = _this$props2.width,
|
|
269
206
|
delimiter = _this$props2.delimiter,
|
|
270
|
-
zIndex = _this$props2.zIndex,
|
|
271
|
-
style = _this$props2.style,
|
|
272
207
|
truncationProps = _this$props2.truncationProps,
|
|
273
208
|
listboxAriaLabel = _this$props2.listboxAriaLabel,
|
|
274
|
-
rest = _objectWithoutProperties(_this$props2,
|
|
209
|
+
rest = _objectWithoutProperties(_this$props2, _excluded3);
|
|
275
210
|
var emptyStateContent;
|
|
276
211
|
if (isLoading) {
|
|
277
212
|
emptyStateContent = ___EmotionJSX(EuiFlexGroup, {
|
|
@@ -368,43 +303,29 @@ export var EuiComboBoxOptionsList = /*#__PURE__*/function (_Component) {
|
|
|
368
303
|
var numVisibleOptions = matchingOptions.length < 7 ? matchingOptions.length : 7;
|
|
369
304
|
var height = numVisibleOptions * (rowHeight + 1); // Add one for the border
|
|
370
305
|
|
|
371
|
-
// bounded by max-height of
|
|
306
|
+
// bounded by max-height of .euiComboBoxOptionsList
|
|
372
307
|
var boundedHeight = height > 200 ? 200 : height;
|
|
373
308
|
var optionsList = ___EmotionJSX(FixedSizeList, {
|
|
309
|
+
className: "euiComboBoxOptionsList__virtualization",
|
|
374
310
|
height: boundedHeight,
|
|
375
311
|
onScroll: onScroll,
|
|
376
312
|
itemCount: matchingOptions.length,
|
|
377
313
|
itemSize: rowHeight,
|
|
378
314
|
itemData: matchingOptions,
|
|
379
315
|
ref: this.setListRef,
|
|
380
|
-
|
|
381
|
-
width:
|
|
316
|
+
innerElementType: this.ListInnerElement,
|
|
317
|
+
width: this.context
|
|
382
318
|
}, this.ListRow);
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
* Reusing the EuiPopover__panel classes to help with consistency/maintenance.
|
|
386
|
-
* But this should really be converted to user the popover component.
|
|
387
|
-
*/
|
|
388
|
-
var classes = classNames('euiComboBoxOptionsList');
|
|
389
|
-
return ___EmotionJSX(EuiPopoverPanel, _extends({
|
|
390
|
-
paddingSize: "none",
|
|
391
|
-
hasShadow: false,
|
|
392
|
-
className: classes,
|
|
393
|
-
panelRef: this.listRefCallback,
|
|
319
|
+
return ___EmotionJSX("div", _extends({
|
|
320
|
+
className: "euiComboBoxOptionsList",
|
|
394
321
|
"data-test-subj": classNames('comboBoxOptionsList', dataTestSubj),
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
}),
|
|
398
|
-
isOpen: true,
|
|
399
|
-
isAttached: true,
|
|
400
|
-
position: position
|
|
401
|
-
}, rest), ___EmotionJSX("div", {
|
|
402
|
-
className: "euiComboBoxOptionsList__rowWrap"
|
|
403
|
-
}, emptyState || optionsList));
|
|
322
|
+
ref: listRef
|
|
323
|
+
}, rest), emptyState || optionsList);
|
|
404
324
|
}
|
|
405
325
|
}]);
|
|
406
326
|
return EuiComboBoxOptionsList;
|
|
407
327
|
}(Component);
|
|
328
|
+
_defineProperty(EuiComboBoxOptionsList, "contextType", EuiInputPopoverWidthContext);
|
|
408
329
|
_defineProperty(EuiComboBoxOptionsList, "defaultProps", {
|
|
409
330
|
'data-test-subj': '',
|
|
410
331
|
rowHeight: 29,
|
|
@@ -24,7 +24,7 @@ import { tabbable } from 'tabbable';
|
|
|
24
24
|
import { keysOf } from '../common';
|
|
25
25
|
import { EuiIcon } from '../icon';
|
|
26
26
|
import { EuiResizeObserver } from '../observer/resize_observer';
|
|
27
|
-
import {
|
|
27
|
+
import { keys } from '../../services';
|
|
28
28
|
import { EuiContextMenuItem } from './context_menu_item';
|
|
29
29
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
30
30
|
var titleSizeToClassNameMap = {
|
|
@@ -99,7 +99,7 @@ export var EuiContextMenuPanel = /*#__PURE__*/function (_Component) {
|
|
|
99
99
|
onClose = _this$props.onClose,
|
|
100
100
|
showPreviousPanel = _this$props.showPreviousPanel;
|
|
101
101
|
if (onClose && (items !== null && items !== void 0 && items.length || document.activeElement === _this.backButton || document.activeElement === _this.panel)) {
|
|
102
|
-
if (event.key ===
|
|
102
|
+
if (event.key === keys.ARROW_LEFT) {
|
|
103
103
|
if (showPreviousPanel) {
|
|
104
104
|
event.preventDefault();
|
|
105
105
|
event.stopPropagation();
|
|
@@ -112,7 +112,7 @@ export var EuiContextMenuPanel = /*#__PURE__*/function (_Component) {
|
|
|
112
112
|
}
|
|
113
113
|
if (items !== null && items !== void 0 && items.length) {
|
|
114
114
|
switch (event.key) {
|
|
115
|
-
case
|
|
115
|
+
case keys.TAB:
|
|
116
116
|
requestAnimationFrame(function () {
|
|
117
117
|
// NOTE: document.activeElement is stale if not wrapped in requestAnimationFrame
|
|
118
118
|
var focusedItemIndex = _this.state.menuItems.indexOf(document.activeElement);
|
|
@@ -123,21 +123,21 @@ export var EuiContextMenuPanel = /*#__PURE__*/function (_Component) {
|
|
|
123
123
|
});
|
|
124
124
|
});
|
|
125
125
|
break;
|
|
126
|
-
case
|
|
126
|
+
case keys.ARROW_UP:
|
|
127
127
|
event.preventDefault();
|
|
128
128
|
_this.focusMenuItem('up');
|
|
129
129
|
if (_this.props.onUseKeyboardToNavigate) {
|
|
130
130
|
_this.props.onUseKeyboardToNavigate();
|
|
131
131
|
}
|
|
132
132
|
break;
|
|
133
|
-
case
|
|
133
|
+
case keys.ARROW_DOWN:
|
|
134
134
|
event.preventDefault();
|
|
135
135
|
_this.focusMenuItem('down');
|
|
136
136
|
if (_this.props.onUseKeyboardToNavigate) {
|
|
137
137
|
_this.props.onUseKeyboardToNavigate();
|
|
138
138
|
}
|
|
139
139
|
break;
|
|
140
|
-
case
|
|
140
|
+
case keys.ARROW_RIGHT:
|
|
141
141
|
if (_this.props.showNextPanel) {
|
|
142
142
|
event.preventDefault();
|
|
143
143
|
_this.props.showNextPanel(onClose && _this.state.focusedItemIndex ? _this.state.focusedItemIndex - 1 // Account for panel title back button
|
|
@@ -111,7 +111,7 @@ export var euiFlexGridStyles = function euiFlexGridStyles(euiThemeContext) {
|
|
|
111
111
|
gutterSizes: {
|
|
112
112
|
none: /*#__PURE__*/css(";label:none;"),
|
|
113
113
|
s: /*#__PURE__*/css("gap:", euiTheme.size.s, ";;label:s;"),
|
|
114
|
-
m: /*#__PURE__*/css("gap:", euiTheme.size.
|
|
114
|
+
m: /*#__PURE__*/css("gap:", euiTheme.size.base, ";;label:m;"),
|
|
115
115
|
l: /*#__PURE__*/css("gap:", euiTheme.size.l, ";;label:l;"),
|
|
116
116
|
xl: /*#__PURE__*/css("gap:", euiTheme.size.xl, ";;label:xl;")
|
|
117
117
|
},
|
|
@@ -155,7 +155,7 @@ export var euiFlexGroupStyles = function euiFlexGroupStyles(euiThemeContext) {
|
|
|
155
155
|
none: /*#__PURE__*/css(";label:none;"),
|
|
156
156
|
xs: /*#__PURE__*/css("gap:", euiTheme.size.xs, ";;label:xs;"),
|
|
157
157
|
s: /*#__PURE__*/css("gap:", euiTheme.size.s, ";;label:s;"),
|
|
158
|
-
m: /*#__PURE__*/css("gap:", euiTheme.size.
|
|
158
|
+
m: /*#__PURE__*/css("gap:", euiTheme.size.base, ";;label:m;"),
|
|
159
159
|
l: /*#__PURE__*/css("gap:", euiTheme.size.l, ";;label:l;"),
|
|
160
160
|
xl: /*#__PURE__*/css("gap:", euiTheme.size.xxl, ";;label:xl;")
|
|
161
161
|
},
|
|
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
4
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
5
5
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
6
|
-
var _excluded = ["className", "children", "as", "hideCloseButton", "closeButtonProps", "closeButtonPosition", "onClose", "ownFocus", "side", "size", "paddingSize", "maxWidth", "style", "maskProps", "type", "outsideClickCloses", "pushMinBreakpoint", "focusTrapProps", "includeFixedHeadersInFocusTrap", "aria-describedby"];
|
|
6
|
+
var _excluded = ["className", "children", "as", "hideCloseButton", "closeButtonProps", "closeButtonPosition", "onClose", "ownFocus", "side", "size", "paddingSize", "maxWidth", "style", "maskProps", "type", "outsideClickCloses", "pushMinBreakpoint", "pushAnimation", "focusTrapProps", "includeFixedHeadersInFocusTrap", "aria-describedby"];
|
|
7
7
|
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; }
|
|
8
8
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
9
9
|
/*
|
|
@@ -14,7 +14,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
14
14
|
* Side Public License, v 1.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import React, { useEffect, useRef, useState, forwardRef } from 'react';
|
|
17
|
+
import React, { useEffect, useRef, useMemo, useCallback, useState, forwardRef } from 'react';
|
|
18
18
|
import classnames from 'classnames';
|
|
19
19
|
import { keys, EuiWindowEvent, useCombinedRefs, useIsWithinMinBreakpoint, useEuiTheme, useGeneratedHtmlId } from '../../services';
|
|
20
20
|
import { logicalStyle } from '../../global_styling';
|
|
@@ -66,8 +66,9 @@ export var EuiFlyout = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
66
66
|
outsideClickCloses = _ref.outsideClickCloses,
|
|
67
67
|
_ref$pushMinBreakpoin = _ref.pushMinBreakpoint,
|
|
68
68
|
pushMinBreakpoint = _ref$pushMinBreakpoin === void 0 ? 'l' : _ref$pushMinBreakpoin,
|
|
69
|
-
_ref$
|
|
70
|
-
|
|
69
|
+
_ref$pushAnimation = _ref.pushAnimation,
|
|
70
|
+
pushAnimation = _ref$pushAnimation === void 0 ? false : _ref$pushAnimation,
|
|
71
|
+
_focusTrapProps = _ref.focusTrapProps,
|
|
71
72
|
_ref$includeFixedHead = _ref.includeFixedHeadersInFocusTrap,
|
|
72
73
|
includeFixedHeadersInFocusTrap = _ref$includeFixedHead === void 0 ? true : _ref$includeFixedHead,
|
|
73
74
|
_ariaDescribedBy = _ref['aria-describedby'],
|
|
@@ -95,18 +96,16 @@ export var EuiFlyout = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
95
96
|
/**
|
|
96
97
|
* Accomodate for the `isPushed` state by adding padding to the body equal to the width of the element
|
|
97
98
|
*/
|
|
98
|
-
if (
|
|
99
|
-
if (
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
document.body.style.paddingLeft = "".concat(dimensions.width, "px");
|
|
104
|
-
}
|
|
99
|
+
if (isPushed) {
|
|
100
|
+
if (side === 'right') {
|
|
101
|
+
document.body.style.paddingRight = "".concat(dimensions.width, "px");
|
|
102
|
+
} else if (side === 'left') {
|
|
103
|
+
document.body.style.paddingLeft = "".concat(dimensions.width, "px");
|
|
105
104
|
}
|
|
106
105
|
}
|
|
107
106
|
return function () {
|
|
108
107
|
document.body.classList.remove('euiBody--hasFlyout');
|
|
109
|
-
if (
|
|
108
|
+
if (isPushed) {
|
|
110
109
|
if (side === 'right') {
|
|
111
110
|
document.body.style.paddingRight = '';
|
|
112
111
|
} else if (side === 'left') {
|
|
@@ -114,38 +113,36 @@ export var EuiFlyout = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
114
113
|
}
|
|
115
114
|
}
|
|
116
115
|
};
|
|
117
|
-
}, [
|
|
116
|
+
}, [side, dimensions, isPushed]);
|
|
118
117
|
|
|
119
118
|
/**
|
|
120
119
|
* ESC key closes flyout (always?)
|
|
121
120
|
*/
|
|
122
|
-
var onKeyDown = function
|
|
121
|
+
var onKeyDown = useCallback(function (event) {
|
|
123
122
|
if (!isPushed && event.key === keys.ESCAPE) {
|
|
124
123
|
event.preventDefault();
|
|
125
124
|
onClose(event);
|
|
126
125
|
}
|
|
127
|
-
};
|
|
126
|
+
}, [onClose, isPushed]);
|
|
128
127
|
|
|
129
128
|
/**
|
|
130
129
|
* Set inline styles
|
|
131
130
|
*/
|
|
132
|
-
var
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
newStyle = _objectSpread(_objectSpread({}, newStyle), logicalStyle('width', size));
|
|
138
|
-
}
|
|
131
|
+
var inlineStyles = useMemo(function () {
|
|
132
|
+
var widthStyle = !isEuiFlyoutSizeNamed(size) && logicalStyle('width', size);
|
|
133
|
+
var maxWidthStyle = typeof maxWidth !== 'boolean' && logicalStyle('max-width', maxWidth);
|
|
134
|
+
return _objectSpread(_objectSpread(_objectSpread({}, style), widthStyle), maxWidthStyle);
|
|
135
|
+
}, [style, maxWidth, size]);
|
|
139
136
|
var euiTheme = useEuiTheme();
|
|
140
137
|
var styles = euiFlyoutStyles(euiTheme);
|
|
141
|
-
var cssStyles = [styles.euiFlyout, styles.paddingSizes[paddingSize], isEuiFlyoutSizeNamed(size) && styles[size], maxWidth === false && styles.noMaxWidth, styles
|
|
138
|
+
var cssStyles = [styles.euiFlyout, styles.paddingSizes[paddingSize], isEuiFlyoutSizeNamed(size) && styles[size], maxWidth === false && styles.noMaxWidth, isPushed ? styles.push.push : styles.overlay, isPushed && styles.push[side], isPushed && !pushAnimation && styles.push.noAnimation, styles[side]];
|
|
142
139
|
var classes = classnames('euiFlyout', className);
|
|
143
|
-
var closeButton
|
|
144
|
-
|
|
140
|
+
var closeButton = useMemo(function () {
|
|
141
|
+
if (hideCloseButton || !onClose) return null;
|
|
145
142
|
var closeButtonClasses = classnames('euiFlyout__closeButton', closeButtonProps === null || closeButtonProps === void 0 ? void 0 : closeButtonProps.className);
|
|
146
143
|
var closeButtonStyles = euiFlyoutCloseButtonStyles(euiTheme);
|
|
147
144
|
var closeButtonCssStyles = [closeButtonStyles.euiFlyout__closeButton, closeButtonStyles[closeButtonPosition], closeButtonPosition === 'outside' && closeButtonStyles.outsideSide[side], closeButtonProps === null || closeButtonProps === void 0 ? void 0 : closeButtonProps.css];
|
|
148
|
-
|
|
145
|
+
return ___EmotionJSX(EuiI18n, {
|
|
149
146
|
token: "euiFlyout.closeAriaLabel",
|
|
150
147
|
default: "Close this dialog"
|
|
151
148
|
}, function (closeAriaLabel) {
|
|
@@ -165,7 +162,7 @@ export var EuiFlyout = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
165
162
|
}
|
|
166
163
|
}));
|
|
167
164
|
});
|
|
168
|
-
}
|
|
165
|
+
}, [onClose, hideCloseButton, closeButtonPosition, closeButtonProps, side, euiTheme]);
|
|
169
166
|
|
|
170
167
|
/*
|
|
171
168
|
* If not disabled, automatically add fixed EuiHeaders as shards
|
|
@@ -195,9 +192,11 @@ export var EuiFlyout = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
195
192
|
});
|
|
196
193
|
}
|
|
197
194
|
}, [includeFixedHeadersInFocusTrap, resizeRef]);
|
|
198
|
-
var focusTrapProps =
|
|
199
|
-
|
|
200
|
-
|
|
195
|
+
var focusTrapProps = useMemo(function () {
|
|
196
|
+
return _objectSpread(_objectSpread({}, _focusTrapProps), {}, {
|
|
197
|
+
shards: [].concat(_toConsumableArray(fixedHeaders), _toConsumableArray((_focusTrapProps === null || _focusTrapProps === void 0 ? void 0 : _focusTrapProps.shards) || []))
|
|
198
|
+
});
|
|
199
|
+
}, [fixedHeaders, _focusTrapProps]);
|
|
201
200
|
|
|
202
201
|
/*
|
|
203
202
|
* Provide meaningful screen reader instructions/details
|
|
@@ -230,7 +229,7 @@ export var EuiFlyout = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
230
229
|
* or if `outsideClickCloses={true}` to close on clicks that target
|
|
231
230
|
* (both mousedown and mouseup) the overlay mask.
|
|
232
231
|
*/
|
|
233
|
-
var onClickOutside = function
|
|
232
|
+
var onClickOutside = useCallback(function (event) {
|
|
234
233
|
// Do not close the flyout for any external click
|
|
235
234
|
if (outsideClickCloses === false) return undefined;
|
|
236
235
|
if (hasOverlayMask) {
|
|
@@ -242,7 +241,7 @@ export var EuiFlyout = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
242
241
|
}
|
|
243
242
|
// Otherwise if ownFocus is false and outsideClickCloses is undefined, outside clicks should not close the flyout
|
|
244
243
|
return undefined;
|
|
245
|
-
};
|
|
244
|
+
}, [onClose, hasOverlayMask, outsideClickCloses]);
|
|
246
245
|
var flyout = ___EmotionJSX(EuiFocusTrap, _extends({
|
|
247
246
|
disabled: isPushed,
|
|
248
247
|
scrollLock: hasOverlayMask,
|
|
@@ -251,7 +250,7 @@ export var EuiFlyout = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
251
250
|
}, focusTrapProps), ___EmotionJSX(Element, _extends({
|
|
252
251
|
className: classes,
|
|
253
252
|
css: cssStyles,
|
|
254
|
-
style:
|
|
253
|
+
style: inlineStyles,
|
|
255
254
|
ref: setRef
|
|
256
255
|
}, rest, {
|
|
257
256
|
role: !isPushed ? 'dialog' : rest.role,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
2
|
var _templateObject, _templateObject2;
|
|
3
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
3
4
|
/*
|
|
4
5
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
5
6
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -29,6 +30,14 @@ export var euiFlyoutCloseButtonStyles = function euiFlyoutCloseButtonStyles(euiT
|
|
|
29
30
|
}
|
|
30
31
|
};
|
|
31
32
|
};
|
|
33
|
+
var _ref = process.env.NODE_ENV === "production" ? {
|
|
34
|
+
name: "yokctr-noAnimation",
|
|
35
|
+
styles: "animation-duration:0s!important;label:noAnimation;"
|
|
36
|
+
} : {
|
|
37
|
+
name: "yokctr-noAnimation",
|
|
38
|
+
styles: "animation-duration:0s!important;label:noAnimation;",
|
|
39
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
40
|
+
};
|
|
32
41
|
export var euiFlyoutStyles = function euiFlyoutStyles(euiThemeContext) {
|
|
33
42
|
var euiTheme = euiThemeContext.euiTheme;
|
|
34
43
|
return {
|
|
@@ -44,10 +53,11 @@ export var euiFlyoutStyles = function euiFlyoutStyles(euiThemeContext) {
|
|
|
44
53
|
left: /*#__PURE__*/css(logicalCSS('left', 0), " clip-path:polygon(0 0, 150% 0, 150% 100%, 0 100%);", euiCanAnimate, "{animation:", euiFlyoutSlideInLeft, " ", euiTheme.animation.normal, " ", euiTheme.animation.resistance, ";};label:left;"),
|
|
45
54
|
// Type
|
|
46
55
|
overlay: /*#__PURE__*/css(euiShadowXLarge(euiThemeContext), ";;label:overlay;"),
|
|
47
|
-
push:
|
|
48
|
-
|
|
56
|
+
push: {
|
|
57
|
+
push: /*#__PURE__*/css("clip-path:none;z-index:", Number(euiTheme.levels.flyout) - 1, ";;label:push;"),
|
|
49
58
|
right: /*#__PURE__*/css(logicalCSS('border-left', euiTheme.border.thick), ";;label:right;"),
|
|
50
|
-
left: /*#__PURE__*/css(logicalCSS('border-right', euiTheme.border.thick), ";;label:left;")
|
|
59
|
+
left: /*#__PURE__*/css(logicalCSS('border-right', euiTheme.border.thick), ";;label:left;"),
|
|
60
|
+
noAnimation: _ref
|
|
51
61
|
},
|
|
52
62
|
// Padding
|
|
53
63
|
paddingSizes: {
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["children", "className", "closePopover", "disableFocusTrap", "focusTrapProps", "input", "fullWidth", "panelMinWidth", "onPanelResize", "inputRef", "panelRef"];
|
|
5
|
+
var _excluded = ["children", "className", "closePopover", "closeOnScroll", "disableFocusTrap", "focusTrapProps", "input", "fullWidth", "panelMinWidth", "onPanelResize", "inputRef", "panelRef"];
|
|
6
6
|
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; }
|
|
7
7
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
8
|
/*
|
|
@@ -13,7 +13,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
13
13
|
* Side Public License, v 1.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
import React, { useState, useEffect, useCallback, useMemo, useRef } from 'react';
|
|
16
|
+
import React, { useState, useEffect, useCallback, useMemo, useRef, createContext } from 'react';
|
|
17
17
|
import { css } from '@emotion/react';
|
|
18
18
|
import classnames from 'classnames';
|
|
19
19
|
import { tabbable } from 'tabbable';
|
|
@@ -24,11 +24,15 @@ import { EuiFocusTrap } from '../focus_trap';
|
|
|
24
24
|
import { euiFormVariables } from '../form/form.styles';
|
|
25
25
|
import { EuiPopover } from './popover';
|
|
26
26
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
27
|
+
// Used by child components that want to know the parent popover width
|
|
28
|
+
export var EuiInputPopoverWidthContext = /*#__PURE__*/createContext(0);
|
|
27
29
|
export var EuiInputPopover = function EuiInputPopover(_ref) {
|
|
28
30
|
var _props$panelProps;
|
|
29
31
|
var children = _ref.children,
|
|
30
32
|
className = _ref.className,
|
|
31
33
|
closePopover = _ref.closePopover,
|
|
34
|
+
_ref$closeOnScroll = _ref.closeOnScroll,
|
|
35
|
+
closeOnScroll = _ref$closeOnScroll === void 0 ? false : _ref$closeOnScroll,
|
|
32
36
|
_ref$disableFocusTrap = _ref.disableFocusTrap,
|
|
33
37
|
disableFocusTrap = _ref$disableFocusTrap === void 0 ? false : _ref$disableFocusTrap,
|
|
34
38
|
focusTrapProps = _ref.focusTrapProps,
|
|
@@ -109,6 +113,40 @@ export var EuiInputPopover = function EuiInputPopover(_ref) {
|
|
|
109
113
|
}
|
|
110
114
|
}
|
|
111
115
|
}, [disableFocusTrap, closePopover, panelPropsOnKeyDown]);
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Optional close on scroll behavior
|
|
119
|
+
*/
|
|
120
|
+
|
|
121
|
+
useEffect(function () {
|
|
122
|
+
// When the popover opens, add a scroll listener to the page (& remove it after)
|
|
123
|
+
if (closeOnScroll && panelEl) {
|
|
124
|
+
// Close the popover, but only if the scroll event occurs outside the input or the popover itself
|
|
125
|
+
var closePopoverOnScroll = function closePopoverOnScroll(event) {
|
|
126
|
+
if (!panelEl || !inputEl || !event.target) return;
|
|
127
|
+
var scrollTarget = event.target;
|
|
128
|
+
if (panelEl.contains(scrollTarget) === false && inputEl.contains(scrollTarget) === false) {
|
|
129
|
+
closePopover();
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
// Firefox will trigger a scroll event in many common situations when the options list div is appended
|
|
134
|
+
// to the DOM; in testing it was always within 100ms, but setting a timeout here for 500ms to be safe
|
|
135
|
+
var timeoutId = setTimeout(function () {
|
|
136
|
+
window.addEventListener('scroll', closePopoverOnScroll, {
|
|
137
|
+
passive: true,
|
|
138
|
+
// for better performance as we won't call preventDefault
|
|
139
|
+
capture: true // scroll events don't bubble, they must be captured instead
|
|
140
|
+
});
|
|
141
|
+
}, 500);
|
|
142
|
+
return function () {
|
|
143
|
+
window.removeEventListener('scroll', closePopoverOnScroll, {
|
|
144
|
+
capture: true
|
|
145
|
+
});
|
|
146
|
+
clearTimeout(timeoutId);
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
}, [closeOnScroll, closePopover, panelEl, inputEl]);
|
|
112
150
|
return ___EmotionJSX(EuiPopover, _extends({
|
|
113
151
|
css: /*#__PURE__*/css(fullWidth ? undefined : logicalCSS('max-width', form.maxWidth), ";label:EuiInputPopover;"),
|
|
114
152
|
repositionToCrossAxis: false,
|
|
@@ -126,7 +164,9 @@ export var EuiInputPopover = function EuiInputPopover(_ref) {
|
|
|
126
164
|
}), ___EmotionJSX(EuiFocusTrap, _extends({
|
|
127
165
|
clickOutsideDisables: true,
|
|
128
166
|
disabled: disableFocusTrap
|
|
129
|
-
}, focusTrapProps),
|
|
167
|
+
}, focusTrapProps), ___EmotionJSX(EuiInputPopoverWidthContext.Provider, {
|
|
168
|
+
value: panelWidth
|
|
169
|
+
}, children)));
|
|
130
170
|
};
|
|
131
171
|
EuiInputPopover.defaultProps = {
|
|
132
172
|
anchorPosition: 'downLeft',
|