@elastic/eui 70.0.0 → 70.2.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 +11 -180
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +11 -180
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/accessibility/screen_reader_only/screen_reader_only.js +1 -1
- package/es/components/accessibility/screen_reader_only/screen_reader_only.styles.js +1 -1
- package/es/components/accordion/accordion.a11y.js +35 -0
- package/es/components/badge/beta_badge/beta_badge.js +6 -6
- package/es/components/basic_table/in_memory_table.js +8 -0
- package/es/components/button/button_display/_button_display.js +7 -6
- package/es/components/button/button_display/_button_display.styles.js +4 -4
- package/es/components/button/button_display/_button_display_content.js +6 -9
- package/es/components/button/button_display/_button_display_content.styles.js +3 -41
- package/es/components/card/card.js +13 -31
- package/es/components/card/card.styles.js +15 -3
- package/es/components/card/card_select/card_select.styles.js +4 -4
- package/es/components/card/checkable_card/checkable_card.js +3 -2
- package/es/components/context_menu/context_menu_panel.a11y.js +34 -0
- package/es/components/datagrid/controls/column_selector.js +1 -1
- package/es/components/datagrid/controls/column_sorting.js +1 -1
- package/es/components/datagrid/controls/data_grid_toolbar.js +6 -2
- package/es/components/datagrid/controls/index.js +1 -0
- package/es/components/datagrid/controls/keyboard_shortcuts.js +191 -0
- package/es/components/datagrid/data_grid.js +12 -2
- package/es/components/date_picker/super_date_picker/super_date_picker.js +22 -4
- package/es/components/header/header_links/header_links.js +6 -0
- package/es/components/loading/loading_spinner.js +14 -3
- package/es/components/loading/loading_spinner.styles.js +11 -7
- package/es/components/modal/modal.js +17 -2
- package/es/components/page_template/page_template.js +6 -9
- package/es/components/popover/popover.js +13 -3
- package/es/components/popover/popover_arrow/_popover_arrow.js +1 -0
- package/es/components/popover/popover_panel/_popover_panel.js +8 -2
- package/es/components/popover/popover_panel/_popover_panel.styles.js +15 -1
- package/es/components/search_bar/search_bar.js +39 -5
- package/es/components/search_bar/search_box.js +37 -4
- package/es/components/selectable/selectable.a11y.js +118 -0
- package/es/components/selectable/selectable.js +9 -6
- package/es/components/tabs/tab.js +31 -7
- package/es/components/tabs/tab.styles.js +63 -0
- package/es/components/tabs/tabbed_content/tabbed_content.js +17 -1
- package/es/components/tabs/tabs.js +20 -14
- package/es/components/tabs/tabs.styles.js +21 -0
- package/es/components/tour/tour_step.js +6 -0
- package/es/services/string/to_initials.js +1 -1
- package/eui.d.ts +305 -198
- package/i18ntokens.json +442 -10
- package/lib/components/accessibility/screen_reader_only/screen_reader_only.js +1 -1
- package/lib/components/accessibility/screen_reader_only/screen_reader_only.styles.js +1 -1
- package/lib/components/accordion/accordion.a11y.js +44 -0
- package/lib/components/badge/beta_badge/beta_badge.js +6 -10
- package/lib/components/basic_table/in_memory_table.js +8 -0
- package/lib/components/button/button_display/_button_display.js +7 -6
- package/lib/components/button/button_display/_button_display.styles.js +4 -4
- package/lib/components/button/button_display/_button_display_content.js +6 -9
- package/lib/components/button/button_display/_button_display_content.styles.js +10 -40
- package/lib/components/card/card.js +14 -33
- package/lib/components/card/card.styles.js +15 -3
- package/lib/components/card/card_select/card_select.styles.js +4 -4
- package/lib/components/card/checkable_card/checkable_card.js +3 -2
- package/lib/components/context_menu/context_menu_panel.a11y.js +42 -0
- package/lib/components/datagrid/controls/column_selector.js +1 -1
- package/lib/components/datagrid/controls/column_sorting.js +1 -1
- package/lib/components/datagrid/controls/data_grid_toolbar.js +7 -2
- package/lib/components/datagrid/controls/index.js +8 -0
- package/lib/components/datagrid/controls/keyboard_shortcuts.js +208 -0
- package/lib/components/datagrid/data_grid.js +11 -1
- package/lib/components/date_picker/super_date_picker/super_date_picker.js +22 -4
- package/lib/components/header/header_links/header_links.js +6 -0
- package/lib/components/loading/loading_spinner.js +13 -2
- package/lib/components/loading/loading_spinner.styles.js +14 -6
- package/lib/components/modal/modal.js +23 -2
- package/lib/components/page_template/page_template.js +6 -9
- package/lib/components/popover/popover.js +13 -3
- package/lib/components/popover/popover_arrow/_popover_arrow.js +1 -0
- package/lib/components/popover/popover_panel/_popover_panel.js +8 -2
- package/lib/components/popover/popover_panel/_popover_panel.styles.js +16 -1
- package/lib/components/search_bar/search_bar.js +40 -5
- package/lib/components/search_bar/search_box.js +38 -4
- package/lib/components/selectable/selectable.a11y.js +122 -0
- package/lib/components/selectable/selectable.js +9 -6
- package/lib/components/tabs/tab.js +31 -6
- package/lib/components/tabs/tab.styles.js +69 -0
- package/lib/components/tabs/tabbed_content/tabbed_content.js +17 -1
- package/lib/components/tabs/tabs.js +24 -14
- package/lib/components/tabs/tabs.styles.js +32 -0
- package/lib/services/string/to_initials.js +1 -1
- package/optimize/es/components/accessibility/screen_reader_only/screen_reader_only.styles.js +1 -1
- package/optimize/es/components/accordion/accordion.a11y.js +35 -0
- package/optimize/es/components/badge/beta_badge/beta_badge.js +6 -6
- package/optimize/es/components/button/button_display/_button_display.js +6 -5
- package/optimize/es/components/button/button_display/_button_display.styles.js +4 -4
- package/optimize/es/components/button/button_display/_button_display_content.js +6 -9
- package/optimize/es/components/button/button_display/_button_display_content.styles.js +3 -41
- package/optimize/es/components/card/card.js +12 -30
- package/optimize/es/components/card/card.styles.js +15 -3
- package/optimize/es/components/card/card_select/card_select.styles.js +4 -4
- package/optimize/es/components/card/checkable_card/checkable_card.js +3 -2
- package/optimize/es/components/context_menu/context_menu_panel.a11y.js +34 -0
- package/optimize/es/components/datagrid/controls/column_selector.js +1 -1
- package/optimize/es/components/datagrid/controls/column_sorting.js +1 -1
- package/optimize/es/components/datagrid/controls/data_grid_toolbar.js +6 -2
- package/optimize/es/components/datagrid/controls/index.js +1 -0
- package/optimize/es/components/datagrid/controls/keyboard_shortcuts.js +181 -0
- package/optimize/es/components/datagrid/data_grid.js +6 -2
- package/optimize/es/components/date_picker/super_date_picker/super_date_picker.js +12 -4
- package/optimize/es/components/loading/loading_spinner.js +13 -3
- package/optimize/es/components/loading/loading_spinner.styles.js +11 -7
- package/optimize/es/components/modal/modal.js +17 -2
- package/optimize/es/components/page_template/page_template.js +6 -9
- package/optimize/es/components/popover/popover.js +7 -3
- package/optimize/es/components/popover/popover_arrow/_popover_arrow.js +1 -0
- package/optimize/es/components/popover/popover_panel/_popover_panel.js +6 -1
- package/optimize/es/components/popover/popover_panel/_popover_panel.styles.js +15 -1
- package/optimize/es/components/search_bar/search_bar.js +31 -5
- package/optimize/es/components/search_bar/search_box.js +29 -3
- package/optimize/es/components/selectable/selectable.a11y.js +107 -0
- package/optimize/es/components/selectable/selectable.js +9 -6
- package/optimize/es/components/tabs/tab.js +19 -7
- package/optimize/es/components/tabs/tab.styles.js +63 -0
- package/optimize/es/components/tabs/tabs.js +20 -14
- package/optimize/es/components/tabs/tabs.styles.js +21 -0
- package/optimize/es/services/string/to_initials.js +1 -1
- package/optimize/lib/components/accessibility/screen_reader_only/screen_reader_only.styles.js +1 -1
- package/optimize/lib/components/accordion/accordion.a11y.js +44 -0
- package/optimize/lib/components/badge/beta_badge/beta_badge.js +6 -13
- package/optimize/lib/components/button/button_display/_button_display.js +7 -6
- package/optimize/lib/components/button/button_display/_button_display.styles.js +4 -4
- package/optimize/lib/components/button/button_display/_button_display_content.js +6 -9
- package/optimize/lib/components/button/button_display/_button_display_content.styles.js +10 -40
- package/optimize/lib/components/card/card.js +13 -32
- package/optimize/lib/components/card/card.styles.js +15 -3
- package/optimize/lib/components/card/card_select/card_select.styles.js +4 -4
- package/optimize/lib/components/card/checkable_card/checkable_card.js +3 -2
- package/optimize/lib/components/context_menu/context_menu_panel.a11y.js +42 -0
- package/optimize/lib/components/datagrid/controls/column_selector.js +1 -1
- package/optimize/lib/components/datagrid/controls/column_sorting.js +1 -1
- package/optimize/lib/components/datagrid/controls/data_grid_toolbar.js +7 -2
- package/optimize/lib/components/datagrid/controls/index.js +8 -0
- package/optimize/lib/components/datagrid/controls/keyboard_shortcuts.js +207 -0
- package/optimize/lib/components/datagrid/data_grid.js +5 -1
- package/optimize/lib/components/date_picker/super_date_picker/super_date_picker.js +12 -4
- package/optimize/lib/components/loading/loading_spinner.js +14 -2
- package/optimize/lib/components/loading/loading_spinner.styles.js +14 -6
- package/optimize/lib/components/modal/modal.js +22 -2
- package/optimize/lib/components/page_template/page_template.js +6 -9
- package/optimize/lib/components/popover/popover.js +7 -3
- package/optimize/lib/components/popover/popover_arrow/_popover_arrow.js +1 -0
- package/optimize/lib/components/popover/popover_panel/_popover_panel.js +6 -1
- package/optimize/lib/components/popover/popover_panel/_popover_panel.styles.js +16 -1
- package/optimize/lib/components/search_bar/search_bar.js +31 -5
- package/optimize/lib/components/search_bar/search_box.js +30 -3
- package/optimize/lib/components/selectable/selectable.a11y.js +122 -0
- package/optimize/lib/components/selectable/selectable.js +9 -6
- package/optimize/lib/components/tabs/tab.js +19 -6
- package/optimize/lib/components/tabs/tab.styles.js +69 -0
- package/optimize/lib/components/tabs/tabs.js +24 -14
- package/optimize/lib/components/tabs/tabs.styles.js +32 -0
- package/optimize/lib/services/string/to_initials.js +1 -1
- package/package.json +5 -4
- package/src/components/datagrid/_index.scss +1 -0
- package/src/components/datagrid/controls/_data_grid_keyboard_shortcuts.scss +17 -0
- package/src/components/datagrid/controls/_data_grid_toolbar.scss +0 -8
- package/src/components/index.scss +0 -1
- package/src/components/modal/_modal.scss +3 -1
- package/src/themes/amsterdam/overrides/_index.scss +0 -1
- package/test-env/components/accessibility/screen_reader_only/screen_reader_only.js +1 -1
- package/test-env/components/accessibility/screen_reader_only/screen_reader_only.styles.js +1 -1
- package/test-env/components/accordion/accordion.a11y.js +44 -0
- package/test-env/components/badge/beta_badge/beta_badge.js +6 -13
- package/test-env/components/basic_table/in_memory_table.js +8 -0
- package/test-env/components/button/button_display/_button_display.js +7 -6
- package/test-env/components/button/button_display/_button_display.styles.js +4 -4
- package/test-env/components/button/button_display/_button_display_content.js +6 -9
- package/test-env/components/button/button_display/_button_display_content.styles.js +10 -40
- package/test-env/components/card/card.js +14 -33
- package/test-env/components/card/card.styles.js +15 -3
- package/test-env/components/card/card_select/card_select.styles.js +4 -4
- package/test-env/components/card/checkable_card/checkable_card.js +3 -2
- package/test-env/components/context_menu/context_menu_panel.a11y.js +42 -0
- package/test-env/components/datagrid/controls/column_selector.js +1 -1
- package/test-env/components/datagrid/controls/column_sorting.js +1 -1
- package/test-env/components/datagrid/controls/data_grid_toolbar.js +7 -2
- package/test-env/components/datagrid/controls/index.js +8 -0
- package/test-env/components/datagrid/controls/keyboard_shortcuts.js +207 -0
- package/test-env/components/datagrid/data_grid.js +11 -1
- package/test-env/components/date_picker/super_date_picker/super_date_picker.js +22 -4
- package/test-env/components/header/header_links/header_links.js +6 -0
- package/test-env/components/loading/loading_spinner.js +14 -2
- package/test-env/components/loading/loading_spinner.styles.js +14 -6
- package/test-env/components/modal/modal.js +22 -2
- package/test-env/components/page_template/page_template.js +6 -9
- package/test-env/components/popover/popover.js +13 -3
- package/test-env/components/popover/popover_arrow/_popover_arrow.js +1 -0
- package/test-env/components/popover/popover_panel/_popover_panel.js +8 -2
- package/test-env/components/popover/popover_panel/_popover_panel.styles.js +16 -1
- package/test-env/components/search_bar/search_bar.js +39 -5
- package/test-env/components/search_bar/search_box.js +38 -4
- package/test-env/components/selectable/selectable.a11y.js +122 -0
- package/test-env/components/selectable/selectable.js +9 -6
- package/test-env/components/tabs/tab.js +31 -6
- package/test-env/components/tabs/tab.styles.js +69 -0
- package/test-env/components/tabs/tabbed_content/tabbed_content.js +17 -1
- package/test-env/components/tabs/tabs.js +24 -14
- package/test-env/components/tabs/tabs.styles.js +32 -0
- package/test-env/services/string/to_initials.js +1 -1
- package/src/components/tabs/_index.scss +0 -1
- package/src/components/tabs/_tabs.scss +0 -110
- package/src/themes/amsterdam/overrides/_tabs.scss +0 -80
|
@@ -21,15 +21,19 @@ var spinnerSizes = {
|
|
|
21
21
|
xl: 'xl',
|
|
22
22
|
xxl: 'xxl'
|
|
23
23
|
};
|
|
24
|
-
|
|
25
|
-
var spinnerColorsCSS = function spinnerColorsCSS(border, highlight) {
|
|
26
|
-
return "\n border-color: ".concat(highlight, " ").concat(border, " ").concat(border, " ").concat(border, ";\n ");
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export var euiLoadingSpinnerStyles = function euiLoadingSpinnerStyles(_ref, color) {
|
|
24
|
+
export var euiSpinnerBorderColorsCSS = function euiSpinnerBorderColorsCSS(_ref) {
|
|
30
25
|
var euiTheme = _ref.euiTheme;
|
|
26
|
+
var colors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
27
|
+
var _colors$border = colors.border,
|
|
28
|
+
border = _colors$border === void 0 ? euiTheme.colors.lightShade : _colors$border,
|
|
29
|
+
_colors$highlight = colors.highlight,
|
|
30
|
+
highlight = _colors$highlight === void 0 ? euiTheme.colors.primary : _colors$highlight;
|
|
31
|
+
return "".concat(highlight, " ").concat(border, " ").concat(border, " ").concat(border);
|
|
32
|
+
};
|
|
33
|
+
export var euiLoadingSpinnerStyles = function euiLoadingSpinnerStyles(euiThemeContext) {
|
|
34
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
31
35
|
return {
|
|
32
|
-
euiLoadingSpinner: /*#__PURE__*/css("flex-shrink:0;display:inline-block;border-radius:50%;border:", euiTheme.border.thick, ";
|
|
36
|
+
euiLoadingSpinner: /*#__PURE__*/css("flex-shrink:0;display:inline-block;border-radius:50%;border:", euiTheme.border.thick, ";border-color:", euiSpinnerBorderColorsCSS(euiThemeContext), ";", euiCanAnimate, "{animation:", _loadingSpinner, " 0.6s infinite linear;};label:euiLoadingSpinner;"),
|
|
33
37
|
// Sizes
|
|
34
38
|
s: /*#__PURE__*/css(logicalSizeCSS(euiTheme.size[spinnerSizes.s], euiTheme.size[spinnerSizes.s]), " border-width:calc(", euiTheme.border.width.thin, " * 1.5);;label:s;"),
|
|
35
39
|
m: /*#__PURE__*/css(logicalSizeCSS(euiTheme.size[spinnerSizes.m], euiTheme.size[spinnerSizes.m]), " border-width:calc(", euiTheme.border.width.thin, " * 1.5);;label:m;"),
|
|
@@ -14,7 +14,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
14
14
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
15
15
|
* Side Public License, v 1.
|
|
16
16
|
*/
|
|
17
|
-
import React from 'react';
|
|
17
|
+
import React, { useRef, useCallback } from 'react';
|
|
18
18
|
import classnames from 'classnames';
|
|
19
19
|
import { keys } from '../../services';
|
|
20
20
|
import { EuiButtonIcon } from '../button';
|
|
@@ -32,6 +32,19 @@ export var EuiModal = function EuiModal(_ref) {
|
|
|
32
32
|
style = _ref.style,
|
|
33
33
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
34
34
|
|
|
35
|
+
// TODO: Remove this onFocus scroll workaround after react-focus-on supports focusOptions
|
|
36
|
+
// @see https://github.com/elastic/eui/issues/6304
|
|
37
|
+
var bodyScrollTop = useRef(typeof window === 'undefined' ? undefined : window.scrollY // Account for SSR
|
|
38
|
+
);
|
|
39
|
+
var onFocus = useCallback(function () {
|
|
40
|
+
if (bodyScrollTop.current != null) {
|
|
41
|
+
window.scrollTo({
|
|
42
|
+
top: bodyScrollTop.current
|
|
43
|
+
});
|
|
44
|
+
bodyScrollTop.current = undefined; // Unset after first auto focus
|
|
45
|
+
}
|
|
46
|
+
}, []);
|
|
47
|
+
|
|
35
48
|
var onKeyDown = function onKeyDown(event) {
|
|
36
49
|
if (event.key === keys.ESCAPE) {
|
|
37
50
|
event.preventDefault();
|
|
@@ -54,11 +67,13 @@ export var EuiModal = function EuiModal(_ref) {
|
|
|
54
67
|
|
|
55
68
|
var classes = classnames('euiModal', widthClassName, className);
|
|
56
69
|
return ___EmotionJSX(EuiOverlayMask, null, ___EmotionJSX(EuiFocusTrap, {
|
|
57
|
-
initialFocus: initialFocus
|
|
70
|
+
initialFocus: initialFocus,
|
|
71
|
+
scrollLock: true
|
|
58
72
|
}, ___EmotionJSX("div", _extends({
|
|
59
73
|
className: classes,
|
|
60
74
|
onKeyDown: onKeyDown,
|
|
61
75
|
tabIndex: 0,
|
|
76
|
+
onFocus: onFocus,
|
|
62
77
|
style: newStyle || style
|
|
63
78
|
}, rest), ___EmotionJSX(EuiI18n, {
|
|
64
79
|
token: "euiModal.closeModal",
|
|
@@ -132,15 +132,12 @@ export var _EuiPageTemplate = function _EuiPageTemplate(_ref) {
|
|
|
132
132
|
React.Children.toArray(children).forEach(function (child, index) {
|
|
133
133
|
if (! /*#__PURE__*/React.isValidElement(child)) return; // Skip non-components
|
|
134
134
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
sidebar.
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
default:
|
|
143
|
-
sections.push(child);
|
|
135
|
+
if (child.type === EuiPageSidebar || child.props.__EMOTION_TYPE_PLEASE_DO_NOT_USE__ === EuiPageSidebar) {
|
|
136
|
+
sidebar.push( /*#__PURE__*/React.cloneElement(child, _objectSpread(_objectSpread({
|
|
137
|
+
key: "sidebar".concat(index)
|
|
138
|
+
}, getSideBarProps()), child.props)));
|
|
139
|
+
} else {
|
|
140
|
+
sections.push(child);
|
|
144
141
|
}
|
|
145
142
|
});
|
|
146
143
|
|
|
@@ -10,7 +10,7 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
10
10
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
11
11
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
12
12
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
13
|
-
var _excluded = ["anchorClassName", "anchorPosition", "button", "buttonRef", "insert", "isOpen", "ownFocus", "children", "className", "closePopover", "panelClassName", "panelPaddingSize", "panelProps", "panelRef", "panelStyle", "popoverScreenReaderText", "popoverRef", "hasArrow", "arrowChildren", "repositionOnScroll", "zIndex", "attachToAnchor", "display", "offset", "onPositionChange", "onTrapDeactivation", "buffer", "aria-label", "aria-labelledby", "container", "focusTrapProps", "initialFocus", "tabIndex"];
|
|
13
|
+
var _excluded = ["anchorClassName", "anchorPosition", "button", "buttonRef", "insert", "isOpen", "ownFocus", "children", "className", "closePopover", "panelClassName", "panelPaddingSize", "panelProps", "panelRef", "panelStyle", "popoverScreenReaderText", "popoverRef", "hasArrow", "arrowChildren", "repositionOnScroll", "hasDragDrop", "zIndex", "attachToAnchor", "display", "offset", "onPositionChange", "onTrapDeactivation", "buffer", "aria-label", "aria-labelledby", "container", "focusTrapProps", "initialFocus", "tabIndex"];
|
|
14
14
|
|
|
15
15
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
16
16
|
|
|
@@ -382,7 +382,8 @@ export var EuiPopover = /*#__PURE__*/function (_Component) {
|
|
|
382
382
|
}, {
|
|
383
383
|
key: "render",
|
|
384
384
|
value: function render() {
|
|
385
|
-
var
|
|
385
|
+
var _panelProps$tabIndex,
|
|
386
|
+
_this4 = this;
|
|
386
387
|
|
|
387
388
|
var _this$props = this.props,
|
|
388
389
|
anchorClassName = _this$props.anchorClassName,
|
|
@@ -405,6 +406,7 @@ export var EuiPopover = /*#__PURE__*/function (_Component) {
|
|
|
405
406
|
hasArrow = _this$props.hasArrow,
|
|
406
407
|
arrowChildren = _this$props.arrowChildren,
|
|
407
408
|
repositionOnScroll = _this$props.repositionOnScroll,
|
|
409
|
+
hasDragDrop = _this$props.hasDragDrop,
|
|
408
410
|
zIndex = _this$props.zIndex,
|
|
409
411
|
attachToAnchor = _this$props.attachToAnchor,
|
|
410
412
|
display = _this$props.display,
|
|
@@ -417,9 +419,10 @@ export var EuiPopover = /*#__PURE__*/function (_Component) {
|
|
|
417
419
|
container = _this$props.container,
|
|
418
420
|
focusTrapProps = _this$props.focusTrapProps,
|
|
419
421
|
initialFocusProp = _this$props.initialFocus,
|
|
420
|
-
|
|
422
|
+
_tabIndexProp = _this$props.tabIndex,
|
|
421
423
|
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
422
424
|
|
|
425
|
+
var tabIndexProp = (_panelProps$tabIndex = panelProps === null || panelProps === void 0 ? void 0 : panelProps.tabIndex) !== null && _panelProps$tabIndex !== void 0 ? _panelProps$tabIndex : _tabIndexProp;
|
|
423
426
|
var styles = euiPopoverStyles();
|
|
424
427
|
var popoverStyles = [styles.euiPopover, {
|
|
425
428
|
display: display
|
|
@@ -483,6 +486,7 @@ export var EuiPopover = /*#__PURE__*/function (_Component) {
|
|
|
483
486
|
position: this.state.arrowPosition,
|
|
484
487
|
isAttached: attachToAnchor,
|
|
485
488
|
className: classNames(panelClassName, panelProps === null || panelProps === void 0 ? void 0 : panelProps.className),
|
|
489
|
+
hasDragDrop: hasDragDrop,
|
|
486
490
|
hasShadow: false,
|
|
487
491
|
paddingSize: panelPaddingSize,
|
|
488
492
|
tabIndex: tabIndex,
|
|
@@ -23,6 +23,7 @@ export var EuiPopoverArrow = function EuiPopoverArrow(_ref) {
|
|
|
23
23
|
var styles = euiPopoverArrowStyles(euiTheme);
|
|
24
24
|
var cssStyles = [styles.euiPopoverArrow, styles[position]];
|
|
25
25
|
return ___EmotionJSX("div", _extends({
|
|
26
|
+
className: "euiPopover__arrow",
|
|
26
27
|
"data-popover-arrow": position,
|
|
27
28
|
css: cssStyles
|
|
28
29
|
}, rest), children);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["children", "className", "isOpen", "isAttached", "position"];
|
|
4
|
+
var _excluded = ["children", "className", "isOpen", "isAttached", "hasDragDrop", "position"];
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
@@ -29,6 +29,7 @@ export var EuiPopoverPanel = function EuiPopoverPanel(_ref) {
|
|
|
29
29
|
className = _ref.className,
|
|
30
30
|
isOpen = _ref.isOpen,
|
|
31
31
|
isAttached = _ref.isAttached,
|
|
32
|
+
hasDragDrop = _ref.hasDragDrop,
|
|
32
33
|
position = _ref.position,
|
|
33
34
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
34
35
|
|
|
@@ -44,6 +45,10 @@ export var EuiPopoverPanel = function EuiPopoverPanel(_ref) {
|
|
|
44
45
|
panelCSS = [].concat(_toConsumableArray(panelCSS), [isOpen && styles.attached.isOpen, position && styles.attached[position]]);
|
|
45
46
|
}
|
|
46
47
|
|
|
48
|
+
if (hasDragDrop) {
|
|
49
|
+
panelCSS = [].concat(_toConsumableArray(panelCSS), [styles.hasDragDrop.hasDragDrop, position && styles.hasDragDrop[position]]);
|
|
50
|
+
}
|
|
51
|
+
|
|
47
52
|
return ___EmotionJSX(EuiPopoverPanelContext.Provider, {
|
|
48
53
|
value: panelContext
|
|
49
54
|
}, ___EmotionJSX(EuiPanel, _extends({
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { css } from '@emotion/react';
|
|
9
9
|
import { euiShadow, euiShadowFlat, euiShadowMedium } from '../../../themes/amsterdam/global_styling/mixins';
|
|
10
|
+
import { getShadowColor } from '../../../themes/amsterdam/global_styling/functions';
|
|
10
11
|
import { euiCanAnimate, logicalCSS } from '../../../global_styling';
|
|
11
12
|
export var openAnimationTiming = 'slow';
|
|
12
13
|
var translateDistance = 's';
|
|
@@ -17,7 +18,8 @@ var translateDistance = 's';
|
|
|
17
18
|
*/
|
|
18
19
|
|
|
19
20
|
export var euiPopoverPanelStyles = function euiPopoverPanelStyles(euiThemeContext) {
|
|
20
|
-
var euiTheme = euiThemeContext.euiTheme
|
|
21
|
+
var euiTheme = euiThemeContext.euiTheme,
|
|
22
|
+
colorMode = euiThemeContext.colorMode;
|
|
21
23
|
return {
|
|
22
24
|
// Base
|
|
23
25
|
euiPopover__panel: /*#__PURE__*/css("position:absolute;", logicalCSS('min-width', "".concat(euiTheme.base * 7, "px")), ";", logicalCSS('max-width', "calc(100vw - ".concat(euiTheme.size.xl, ")")), ";backface-visibility:hidden;pointer-events:none;opacity:0;transform:translateY(0) translateX(0) translateZ(0);", euiShadowMedium(euiThemeContext, {
|
|
@@ -38,6 +40,18 @@ export var euiPopoverPanelStyles = function euiPopoverPanelStyles(euiThemeContex
|
|
|
38
40
|
// Satisfies TS
|
|
39
41
|
left: /*#__PURE__*/css(";label:left;"),
|
|
40
42
|
right: /*#__PURE__*/css(";label:right;")
|
|
43
|
+
},
|
|
44
|
+
// Overrides for drag & drop contexts within popovers. This is required because
|
|
45
|
+
// the fixed positions of drag and drop don't work inside of transformed elements
|
|
46
|
+
hasDragDrop: {
|
|
47
|
+
hasDragDrop: /*#__PURE__*/css("transform:none;filter:none;", euiShadowMedium(euiThemeContext, {
|
|
48
|
+
property: 'box-shadow'
|
|
49
|
+
}), ";;label:hasDragDrop;"),
|
|
50
|
+
// The offset transforms must be recreated in margins
|
|
51
|
+
top: /*#__PURE__*/css("margin-block-start:", euiTheme.size[translateDistance], ";;label:top;"),
|
|
52
|
+
bottom: /*#__PURE__*/css("margin-block-start:-", euiTheme.size[translateDistance], ";.euiPopover__arrow{filter:drop-shadow(\n 0 -6px 6px ", getShadowColor(euiTheme.colors.shadow, 0.12, colorMode), "\n );};label:bottom;"),
|
|
53
|
+
left: /*#__PURE__*/css("margin-inline-start:", euiTheme.size[translateDistance], ";.euiPopover__arrow{filter:drop-shadow(\n 6px 0 6px ", getShadowColor(euiTheme.colors.shadow, 0.12, colorMode), "\n );};label:left;"),
|
|
54
|
+
right: /*#__PURE__*/css("margin-inline-start:-", euiTheme.size[translateDistance], ";.euiPopover__arrow{filter:drop-shadow(\n -6px 0 6px ", getShadowColor(euiTheme.colors.shadow, 0.12, colorMode), "\n );};label:right;")
|
|
41
55
|
}
|
|
42
56
|
};
|
|
43
57
|
};
|
|
@@ -10,6 +10,10 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
10
10
|
import _typeof from "@babel/runtime/helpers/typeof";
|
|
11
11
|
var _excluded = ["schema"];
|
|
12
12
|
|
|
13
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
14
|
+
|
|
15
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
16
|
+
|
|
13
17
|
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); }; }
|
|
14
18
|
|
|
15
19
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
@@ -22,6 +26,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
22
26
|
* Side Public License, v 1.
|
|
23
27
|
*/
|
|
24
28
|
import React, { Component } from 'react';
|
|
29
|
+
import { htmlIdGenerator } from '../../services/accessibility';
|
|
25
30
|
import { isString } from '../../services/predicate';
|
|
26
31
|
import { EuiFlexGroup, EuiFlexItem } from '../flex';
|
|
27
32
|
import { EuiSearchBox } from './search_box';
|
|
@@ -62,6 +67,8 @@ export var EuiSearchBar = /*#__PURE__*/function (_Component) {
|
|
|
62
67
|
|
|
63
68
|
_this = _super.call(this, props);
|
|
64
69
|
|
|
70
|
+
_defineProperty(_assertThisInitialized(_this), "hintId", htmlIdGenerator('__hint')());
|
|
71
|
+
|
|
65
72
|
_defineProperty(_assertThisInitialized(_this), "onSearch", function (queryText) {
|
|
66
73
|
try {
|
|
67
74
|
var query = parseQuery(queryText, _this.props);
|
|
@@ -118,7 +125,8 @@ export var EuiSearchBar = /*#__PURE__*/function (_Component) {
|
|
|
118
125
|
_this.state = {
|
|
119
126
|
query: _query,
|
|
120
127
|
queryText: _query.text,
|
|
121
|
-
error: null
|
|
128
|
+
error: null,
|
|
129
|
+
isHintVisible: false
|
|
122
130
|
};
|
|
123
131
|
return _this;
|
|
124
132
|
}
|
|
@@ -180,10 +188,15 @@ export var EuiSearchBar = /*#__PURE__*/function (_Component) {
|
|
|
180
188
|
}, {
|
|
181
189
|
key: "render",
|
|
182
190
|
value: function render() {
|
|
191
|
+
var _hint$popoverProps$is,
|
|
192
|
+
_hint$popoverProps,
|
|
193
|
+
_this2 = this;
|
|
194
|
+
|
|
183
195
|
var _this$state = this.state,
|
|
184
196
|
query = _this$state.query,
|
|
185
197
|
queryText = _this$state.queryText,
|
|
186
|
-
error = _this$state.error
|
|
198
|
+
error = _this$state.error,
|
|
199
|
+
isHintVisibleState = _this$state.isHintVisible;
|
|
187
200
|
var _this$props = this.props,
|
|
188
201
|
_this$props$box = _this$props.box;
|
|
189
202
|
_this$props$box = _this$props$box === void 0 ? {
|
|
@@ -194,7 +207,8 @@ export var EuiSearchBar = /*#__PURE__*/function (_Component) {
|
|
|
194
207
|
box = _objectWithoutProperties(_this$props$box, _excluded),
|
|
195
208
|
filters = _this$props.filters,
|
|
196
209
|
toolsLeft = _this$props.toolsLeft,
|
|
197
|
-
toolsRight = _this$props.toolsRight
|
|
210
|
+
toolsRight = _this$props.toolsRight,
|
|
211
|
+
hint = _this$props.hint;
|
|
198
212
|
|
|
199
213
|
var toolsLeftEl = this.renderTools(toolsLeft);
|
|
200
214
|
var filtersBar = !filters ? undefined : ___EmotionJSX(EuiFlexItem, {
|
|
@@ -206,6 +220,7 @@ export var EuiSearchBar = /*#__PURE__*/function (_Component) {
|
|
|
206
220
|
onChange: this.onFiltersChange
|
|
207
221
|
}));
|
|
208
222
|
var toolsRightEl = this.renderTools(toolsRight);
|
|
223
|
+
var isHintVisible = (_hint$popoverProps$is = hint === null || hint === void 0 ? void 0 : (_hint$popoverProps = hint.popoverProps) === null || _hint$popoverProps === void 0 ? void 0 : _hint$popoverProps.isOpen) !== null && _hint$popoverProps$is !== void 0 ? _hint$popoverProps$is : isHintVisibleState;
|
|
209
224
|
return ___EmotionJSX(EuiFlexGroup, {
|
|
210
225
|
gutterSize: "m",
|
|
211
226
|
alignItems: "center",
|
|
@@ -217,7 +232,17 @@ export var EuiSearchBar = /*#__PURE__*/function (_Component) {
|
|
|
217
232
|
query: queryText,
|
|
218
233
|
onSearch: this.onSearch,
|
|
219
234
|
isInvalid: error != null,
|
|
220
|
-
title: error ? error.message : undefined
|
|
235
|
+
title: error ? error.message : undefined,
|
|
236
|
+
"aria-describedby": isHintVisible ? "".concat(this.hintId) : undefined,
|
|
237
|
+
hint: hint ? _objectSpread({
|
|
238
|
+
isVisible: isHintVisible,
|
|
239
|
+
setIsVisible: function setIsVisible(isVisible) {
|
|
240
|
+
_this2.setState({
|
|
241
|
+
isHintVisible: isVisible
|
|
242
|
+
});
|
|
243
|
+
},
|
|
244
|
+
id: this.hintId
|
|
245
|
+
}, hint) : undefined
|
|
221
246
|
}))), filtersBar, toolsRightEl);
|
|
222
247
|
}
|
|
223
248
|
}], [{
|
|
@@ -228,7 +253,8 @@ export var EuiSearchBar = /*#__PURE__*/function (_Component) {
|
|
|
228
253
|
return {
|
|
229
254
|
query: query,
|
|
230
255
|
queryText: query.text,
|
|
231
|
-
error: null
|
|
256
|
+
error: null,
|
|
257
|
+
isHintVisible: prevState.isHintVisible
|
|
232
258
|
};
|
|
233
259
|
}
|
|
234
260
|
|
|
@@ -7,7 +7,7 @@ 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 = ["query", "incremental"];
|
|
10
|
+
var _excluded = ["query", "incremental", "hint"];
|
|
11
11
|
|
|
12
12
|
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); }; }
|
|
13
13
|
|
|
@@ -22,6 +22,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
22
22
|
*/
|
|
23
23
|
import React, { Component } from 'react';
|
|
24
24
|
import { EuiFieldSearch } from '../form';
|
|
25
|
+
import { EuiInputPopover } from '../popover';
|
|
25
26
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
26
27
|
export var EuiSearchBox = /*#__PURE__*/function (_Component) {
|
|
27
28
|
_inherits(EuiSearchBox, _Component);
|
|
@@ -60,6 +61,7 @@ export var EuiSearchBox = /*#__PURE__*/function (_Component) {
|
|
|
60
61
|
var _this$props = this.props,
|
|
61
62
|
query = _this$props.query,
|
|
62
63
|
incremental = _this$props.incremental,
|
|
64
|
+
hint = _this$props.hint,
|
|
63
65
|
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
64
66
|
|
|
65
67
|
var ariaLabel;
|
|
@@ -70,15 +72,39 @@ export var EuiSearchBox = /*#__PURE__*/function (_Component) {
|
|
|
70
72
|
ariaLabel = 'This is a search bar. After typing your query, hit enter to filter the results lower in the page.';
|
|
71
73
|
}
|
|
72
74
|
|
|
73
|
-
|
|
75
|
+
var search = ___EmotionJSX(EuiFieldSearch, _extends({
|
|
74
76
|
inputRef: function inputRef(input) {
|
|
75
77
|
return _this2.inputElement = input;
|
|
76
78
|
},
|
|
77
79
|
fullWidth: true,
|
|
78
80
|
defaultValue: query,
|
|
79
81
|
incremental: incremental,
|
|
80
|
-
"aria-label": ariaLabel
|
|
82
|
+
"aria-label": ariaLabel,
|
|
83
|
+
onFocus: function onFocus() {
|
|
84
|
+
hint === null || hint === void 0 ? void 0 : hint.setIsVisible(true);
|
|
85
|
+
}
|
|
81
86
|
}, rest));
|
|
87
|
+
|
|
88
|
+
if (hint) {
|
|
89
|
+
return ___EmotionJSX(EuiInputPopover, _extends({
|
|
90
|
+
disableFocusTrap: true,
|
|
91
|
+
input: search,
|
|
92
|
+
isOpen: hint.isVisible,
|
|
93
|
+
fullWidth: true,
|
|
94
|
+
closePopover: function closePopover() {
|
|
95
|
+
hint.setIsVisible(false);
|
|
96
|
+
},
|
|
97
|
+
panelProps: {
|
|
98
|
+
'aria-live': undefined,
|
|
99
|
+
'aria-modal': undefined,
|
|
100
|
+
role: undefined,
|
|
101
|
+
tabIndex: -1,
|
|
102
|
+
id: hint.id
|
|
103
|
+
}
|
|
104
|
+
}, hint.popoverProps), hint.content);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return search;
|
|
82
108
|
}
|
|
83
109
|
}]);
|
|
84
110
|
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
6
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
7
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
8
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
9
|
+
* Side Public License, v 1.
|
|
10
|
+
*/
|
|
11
|
+
/// <reference types="../../../cypress/support"/>
|
|
12
|
+
import React, { useState } from 'react';
|
|
13
|
+
import { EuiButton } from '../button';
|
|
14
|
+
import { EuiPopover } from '../popover';
|
|
15
|
+
import { EuiSelectable } from './selectable';
|
|
16
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
17
|
+
var options = [{
|
|
18
|
+
label: 'Titan',
|
|
19
|
+
'data-test-subj': 'titanOption'
|
|
20
|
+
}, {
|
|
21
|
+
label: 'Enceladus'
|
|
22
|
+
}, {
|
|
23
|
+
label: "Pandora is one of Saturn's moons, named for a Titaness of Greek mythology"
|
|
24
|
+
}];
|
|
25
|
+
|
|
26
|
+
var EuiSelectableListboxOnly = function EuiSelectableListboxOnly(args) {
|
|
27
|
+
return ___EmotionJSX(EuiSelectable, _extends({
|
|
28
|
+
options: options
|
|
29
|
+
}, args), function (list) {
|
|
30
|
+
return ___EmotionJSX(React.Fragment, null, list);
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
var EuiSelectableWithSearchInput = function EuiSelectableWithSearchInput(args) {
|
|
35
|
+
return ___EmotionJSX(EuiSelectable, _extends({
|
|
36
|
+
searchable: true,
|
|
37
|
+
options: options
|
|
38
|
+
}, args), function (list, search) {
|
|
39
|
+
return ___EmotionJSX(React.Fragment, null, search, list);
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
describe('EuiSelectable', function () {
|
|
44
|
+
describe('with a `searchable` configuration', function () {
|
|
45
|
+
it('has no accessibility errors', function () {
|
|
46
|
+
var onChange = cy.stub();
|
|
47
|
+
cy.realMount(___EmotionJSX(EuiSelectableWithSearchInput, {
|
|
48
|
+
onChange: onChange
|
|
49
|
+
}));
|
|
50
|
+
cy.checkAxe();
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
describe('without a `searchable` configuration', function () {
|
|
54
|
+
it('has no accessibility errors', function () {
|
|
55
|
+
var onChange = cy.stub();
|
|
56
|
+
cy.realMount(___EmotionJSX(EuiSelectableListboxOnly, {
|
|
57
|
+
"aria-label": "No search box",
|
|
58
|
+
onChange: onChange
|
|
59
|
+
}));
|
|
60
|
+
cy.checkAxe();
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
describe('nested in `EuiPopover` component', function () {
|
|
64
|
+
var EuiSelectableNested = function EuiSelectableNested() {
|
|
65
|
+
var _useState = useState(false),
|
|
66
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
67
|
+
isPopoverOpen = _useState2[0],
|
|
68
|
+
setIsPopoverOpen = _useState2[1];
|
|
69
|
+
|
|
70
|
+
var onChange = function onChange() {};
|
|
71
|
+
|
|
72
|
+
var onClosePopover = function onClosePopover() {};
|
|
73
|
+
|
|
74
|
+
var onButtonClick = function onButtonClick() {
|
|
75
|
+
setIsPopoverOpen(!isPopoverOpen);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
var button = ___EmotionJSX(EuiButton, {
|
|
79
|
+
iconType: "arrowDown",
|
|
80
|
+
iconSide: "right",
|
|
81
|
+
onClick: onButtonClick
|
|
82
|
+
}, "Show popover");
|
|
83
|
+
|
|
84
|
+
return ___EmotionJSX(EuiPopover, {
|
|
85
|
+
id: "data-cy-popover-1",
|
|
86
|
+
panelPaddingSize: "s",
|
|
87
|
+
button: button,
|
|
88
|
+
isOpen: isPopoverOpen,
|
|
89
|
+
closePopover: onClosePopover
|
|
90
|
+
}, ___EmotionJSX(EuiSelectableWithSearchInput, {
|
|
91
|
+
"aria-label": "With popover",
|
|
92
|
+
options: options,
|
|
93
|
+
onChange: onChange
|
|
94
|
+
}, function (list) {
|
|
95
|
+
return ___EmotionJSX(React.Fragment, null, list);
|
|
96
|
+
}));
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
it('has no accessibility errors', function () {
|
|
100
|
+
cy.realMount(___EmotionJSX(EuiSelectableNested, null));
|
|
101
|
+
cy.get('button').realClick();
|
|
102
|
+
cy.get('li[role=option]').first(); // Make sure the EuiSelectable is rendered before a11y check
|
|
103
|
+
|
|
104
|
+
cy.checkAxe();
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
});
|
|
@@ -575,25 +575,28 @@ export var EuiSelectable = /*#__PURE__*/function (_Component) {
|
|
|
575
575
|
}], [{
|
|
576
576
|
key: "getDerivedStateFromProps",
|
|
577
577
|
value: function getDerivedStateFromProps(nextProps, prevState) {
|
|
578
|
+
var _stateUpdate$searchVa;
|
|
579
|
+
|
|
578
580
|
var options = nextProps.options,
|
|
579
581
|
isPreFiltered = nextProps.isPreFiltered,
|
|
580
582
|
searchProps = nextProps.searchProps;
|
|
581
583
|
var activeOptionIndex = prevState.activeOptionIndex,
|
|
582
584
|
searchValue = prevState.searchValue;
|
|
583
|
-
var matchingOptions = getMatchingOptions(options, searchValue, isPreFiltered);
|
|
584
585
|
var stateUpdate = {
|
|
585
|
-
|
|
586
|
+
searchValue: searchValue,
|
|
586
587
|
activeOptionIndex: activeOptionIndex
|
|
587
588
|
};
|
|
588
589
|
|
|
589
|
-
if (activeOptionIndex != null && activeOptionIndex >= matchingOptions.length) {
|
|
590
|
-
stateUpdate.activeOptionIndex = -1;
|
|
591
|
-
}
|
|
592
|
-
|
|
593
590
|
if ((searchProps === null || searchProps === void 0 ? void 0 : searchProps.value) != null && searchProps.value !== searchValue) {
|
|
594
591
|
stateUpdate.searchValue = searchProps.value;
|
|
595
592
|
}
|
|
596
593
|
|
|
594
|
+
stateUpdate.visibleOptions = getMatchingOptions(options, (_stateUpdate$searchVa = stateUpdate.searchValue) !== null && _stateUpdate$searchVa !== void 0 ? _stateUpdate$searchVa : '', isPreFiltered);
|
|
595
|
+
|
|
596
|
+
if (activeOptionIndex != null && activeOptionIndex >= stateUpdate.visibleOptions.length) {
|
|
597
|
+
stateUpdate.activeOptionIndex = -1;
|
|
598
|
+
}
|
|
599
|
+
|
|
597
600
|
return stateUpdate;
|
|
598
601
|
}
|
|
599
602
|
}]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["isSelected", "children", "className", "disabled", "href", "target", "rel", "prepend", "append"];
|
|
3
|
+
var _excluded = ["isSelected", "children", "className", "disabled", "href", "target", "rel", "prepend", "append", "size", "expand"];
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
6
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
@@ -11,8 +11,9 @@ var _excluded = ["isSelected", "children", "className", "disabled", "href", "tar
|
|
|
11
11
|
*/
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import classNames from 'classnames';
|
|
14
|
-
import { getSecureRelForTarget } from '../../services';
|
|
14
|
+
import { getSecureRelForTarget, useEuiTheme } from '../../services';
|
|
15
15
|
import { validateHref } from '../../services/security/href_validator';
|
|
16
|
+
import { euiTabStyles, euiTabContentStyles } from './tab.styles';
|
|
16
17
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
17
18
|
export var EuiTab = function EuiTab(_ref) {
|
|
18
19
|
var isSelected = _ref.isSelected,
|
|
@@ -24,14 +25,21 @@ export var EuiTab = function EuiTab(_ref) {
|
|
|
24
25
|
rel = _ref.rel,
|
|
25
26
|
prepend = _ref.prepend,
|
|
26
27
|
append = _ref.append,
|
|
28
|
+
size = _ref.size,
|
|
29
|
+
expand = _ref.expand,
|
|
27
30
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
28
31
|
|
|
32
|
+
var euiTheme = useEuiTheme();
|
|
29
33
|
var isHrefValid = !href || validateHref(href);
|
|
30
|
-
var disabled = _disabled || !isHrefValid;
|
|
34
|
+
var disabled = _disabled || !isHrefValid; // Keep CSS classnames for reference
|
|
35
|
+
|
|
31
36
|
var classes = classNames('euiTab', className, {
|
|
32
|
-
'euiTab-isSelected': isSelected
|
|
33
|
-
'euiTab-isDisabled': disabled
|
|
37
|
+
'euiTab-isSelected': isSelected
|
|
34
38
|
});
|
|
39
|
+
var tabStyles = euiTabStyles(euiTheme);
|
|
40
|
+
var cssTabStyles = [tabStyles.euiTab, expand && tabStyles.expanded, disabled && tabStyles.disabled.disabled, isSelected && (disabled ? tabStyles.disabled.selected : tabStyles.selected)];
|
|
41
|
+
var tabContentStyles = euiTabContentStyles(euiTheme);
|
|
42
|
+
var cssTabContentStyles = [tabContentStyles.euiTab__content, size && tabContentStyles[size], isSelected && tabContentStyles.selected, disabled && tabContentStyles.disabled];
|
|
35
43
|
|
|
36
44
|
var prependNode = prepend && ___EmotionJSX("span", {
|
|
37
45
|
className: "euiTab__prepend"
|
|
@@ -53,11 +61,13 @@ export var EuiTab = function EuiTab(_ref) {
|
|
|
53
61
|
role: "tab",
|
|
54
62
|
"aria-selected": !!isSelected,
|
|
55
63
|
className: classes,
|
|
64
|
+
css: cssTabStyles,
|
|
56
65
|
href: href,
|
|
57
66
|
target: target,
|
|
58
67
|
rel: secureRel
|
|
59
68
|
}, rest), prependNode, ___EmotionJSX("span", {
|
|
60
|
-
className: "euiTab__content"
|
|
69
|
+
className: "euiTab__content",
|
|
70
|
+
css: cssTabContentStyles
|
|
61
71
|
}, children), appendNode);
|
|
62
72
|
}
|
|
63
73
|
|
|
@@ -66,8 +76,10 @@ export var EuiTab = function EuiTab(_ref) {
|
|
|
66
76
|
"aria-selected": !!isSelected,
|
|
67
77
|
type: "button",
|
|
68
78
|
className: classes,
|
|
79
|
+
css: cssTabStyles,
|
|
69
80
|
disabled: disabled
|
|
70
81
|
}, rest), prependNode, ___EmotionJSX("span", {
|
|
71
|
-
className: "euiTab__content"
|
|
82
|
+
className: "euiTab__content",
|
|
83
|
+
css: cssTabContentStyles
|
|
72
84
|
}, children), appendNode);
|
|
73
85
|
};
|