@elastic/eui 70.1.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 -1
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +11 -1
- 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/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/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/selectable/selectable.a11y.js +118 -0
- package/es/components/selectable/selectable.js +9 -6
- package/es/components/tabs/tab.js +7 -3
- package/es/components/tabs/tab.styles.js +29 -16
- package/es/components/tabs/tabbed_content/tabbed_content.js +1 -1
- package/es/components/tabs/tabs.js +3 -3
- package/es/components/tabs/tabs.styles.js +2 -4
- package/es/services/string/to_initials.js +1 -1
- package/eui.d.ts +208 -164
- package/i18ntokens.json +438 -6
- 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/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/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/selectable/selectable.a11y.js +122 -0
- package/lib/components/selectable/selectable.js +9 -6
- package/lib/components/tabs/tab.js +7 -3
- package/lib/components/tabs/tab.styles.js +29 -16
- package/lib/components/tabs/tabbed_content/tabbed_content.js +1 -1
- package/lib/components/tabs/tabs.js +3 -3
- package/lib/components/tabs/tabs.styles.js +1 -3
- 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/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/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/selectable/selectable.a11y.js +107 -0
- package/optimize/es/components/selectable/selectable.js +9 -6
- package/optimize/es/components/tabs/tab.js +7 -3
- package/optimize/es/components/tabs/tab.styles.js +29 -16
- package/optimize/es/components/tabs/tabs.js +3 -3
- package/optimize/es/components/tabs/tabs.styles.js +2 -4
- 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/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/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/selectable/selectable.a11y.js +122 -0
- package/optimize/lib/components/selectable/selectable.js +9 -6
- package/optimize/lib/components/tabs/tab.js +7 -3
- package/optimize/lib/components/tabs/tab.styles.js +29 -16
- package/optimize/lib/components/tabs/tabs.js +3 -3
- package/optimize/lib/components/tabs/tabs.styles.js +1 -3
- package/optimize/lib/services/string/to_initials.js +1 -1
- package/package.json +3 -2
- package/src/components/datagrid/_index.scss +1 -0
- package/src/components/datagrid/controls/_data_grid_keyboard_shortcuts.scss +17 -0
- package/src/components/modal/_modal.scss +3 -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/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/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/selectable/selectable.a11y.js +122 -0
- package/test-env/components/selectable/selectable.js +9 -6
- package/test-env/components/tabs/tab.js +7 -3
- package/test-env/components/tabs/tab.styles.js +29 -16
- package/test-env/components/tabs/tabbed_content/tabbed_content.js +1 -1
- package/test-env/components/tabs/tabs.js +3 -3
- package/test-env/components/tabs/tabs.styles.js +1 -3
- package/test-env/services/string/to_initials.js +1 -1
|
@@ -10,11 +10,11 @@ var _react = require("@emotion/react");
|
|
|
10
10
|
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
11
11
|
|
|
12
12
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
13
|
-
name: "
|
|
14
|
-
styles: "transform:none!important;label:euiCardSelect;"
|
|
13
|
+
name: "aogl4-euiCardSelect",
|
|
14
|
+
styles: "transform:none!important;align-self:flex-end;label:euiCardSelect;"
|
|
15
15
|
} : {
|
|
16
|
-
name: "
|
|
17
|
-
styles: "transform:none!important;label:euiCardSelect;",
|
|
16
|
+
name: "aogl4-euiCardSelect",
|
|
17
|
+
styles: "transform:none!important;align-self:flex-end;label:euiCardSelect;",
|
|
18
18
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -23,7 +23,7 @@ var _checkable_card = require("./checkable_card.styles");
|
|
|
23
23
|
|
|
24
24
|
var _react2 = require("@emotion/react");
|
|
25
25
|
|
|
26
|
-
var _excluded = ["children", "className", "checkableType", "label", "checked", "disabled", "hasShadow", "hasBorder"];
|
|
26
|
+
var _excluded = ["children", "className", "css", "checkableType", "label", "checked", "disabled", "hasShadow", "hasBorder"];
|
|
27
27
|
|
|
28
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
29
|
|
|
@@ -40,6 +40,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
40
40
|
var EuiCheckableCard = function EuiCheckableCard(_ref) {
|
|
41
41
|
var children = _ref.children,
|
|
42
42
|
className = _ref.className,
|
|
43
|
+
css = _ref.css,
|
|
43
44
|
_ref$checkableType = _ref.checkableType,
|
|
44
45
|
checkableType = _ref$checkableType === void 0 ? 'radio' : _ref$checkableType,
|
|
45
46
|
label = _ref.label,
|
|
@@ -52,7 +53,7 @@ var EuiCheckableCard = function EuiCheckableCard(_ref) {
|
|
|
52
53
|
|
|
53
54
|
var euiThemeContext = (0, _services.useEuiTheme)();
|
|
54
55
|
var styles = (0, _checkable_card.euiCheckableCardStyles)(euiThemeContext);
|
|
55
|
-
var baseStyles = [styles.euiCheckableCard, checked && !disabled && styles.isChecked];
|
|
56
|
+
var baseStyles = [styles.euiCheckableCard, checked && !disabled && styles.isChecked, css];
|
|
56
57
|
var labelStyles = [styles.label.euiCheckableCard__label, disabled && styles.label.isDisabled];
|
|
57
58
|
var childStyles = [styles.euiCheckableCard__children];
|
|
58
59
|
var id = rest.id;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _react = _interopRequireDefault(require("react"));
|
|
4
|
+
|
|
5
|
+
var _context_menu_item = require("./context_menu_item");
|
|
6
|
+
|
|
7
|
+
var _context_menu_panel = require("./context_menu_panel");
|
|
8
|
+
|
|
9
|
+
var _react2 = require("@emotion/react");
|
|
10
|
+
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
|
|
13
|
+
/*
|
|
14
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
15
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
16
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
17
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
18
|
+
* Side Public License, v 1.
|
|
19
|
+
*/
|
|
20
|
+
/// <reference types="../../../cypress/support"/>
|
|
21
|
+
var items = [(0, _react2.jsx)(_context_menu_item.EuiContextMenuItem, {
|
|
22
|
+
key: "A",
|
|
23
|
+
"data-test-subj": "itemA"
|
|
24
|
+
}, "Option A"), (0, _react2.jsx)(_context_menu_item.EuiContextMenuItem, {
|
|
25
|
+
key: "B",
|
|
26
|
+
"data-test-subj": "itemB"
|
|
27
|
+
}, "Option B"), (0, _react2.jsx)(_context_menu_item.EuiContextMenuItem, {
|
|
28
|
+
key: "C",
|
|
29
|
+
"data-test-subj": "itemC"
|
|
30
|
+
}, "Option C")];
|
|
31
|
+
describe('EuiContextMenuPanel', function () {
|
|
32
|
+
describe('Automated accessibility check', function () {
|
|
33
|
+
it('has zero violations', function () {
|
|
34
|
+
var showNextPanelHandler = cy.stub();
|
|
35
|
+
cy.mount((0, _react2.jsx)(_context_menu_panel.EuiContextMenuPanel, {
|
|
36
|
+
items: items,
|
|
37
|
+
showNextPanel: showNextPanelHandler
|
|
38
|
+
}));
|
|
39
|
+
cy.checkAxe();
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -10,6 +10,8 @@ exports.renderAdditionalControls = renderAdditionalControls;
|
|
|
10
10
|
|
|
11
11
|
var _react = _interopRequireDefault(require("react"));
|
|
12
12
|
|
|
13
|
+
var _accessibility = require("../../accessibility");
|
|
14
|
+
|
|
13
15
|
var _utils = require("../../../utils");
|
|
14
16
|
|
|
15
17
|
var _react2 = require("@emotion/react");
|
|
@@ -33,6 +35,7 @@ var EuiDataGridToolbar = function EuiDataGridToolbar(_ref) {
|
|
|
33
35
|
toolbarVisibility = _ref.toolbarVisibility,
|
|
34
36
|
isFullScreen = _ref.isFullScreen,
|
|
35
37
|
fullScreenSelector = _ref.fullScreenSelector,
|
|
38
|
+
keyboardShortcuts = _ref.keyboardShortcuts,
|
|
36
39
|
displaySelector = _ref.displaySelector,
|
|
37
40
|
columnSelector = _ref.columnSelector,
|
|
38
41
|
columnSorting = _ref.columnSorting;
|
|
@@ -40,12 +43,14 @@ var EuiDataGridToolbar = function EuiDataGridToolbar(_ref) {
|
|
|
40
43
|
var hasRoomForGridControls = _utils.IS_JEST_ENVIRONMENT ? true : gridWidth > minSizeForControls || isFullScreen;
|
|
41
44
|
return (0, _react2.jsx)("div", {
|
|
42
45
|
className: "euiDataGrid__controls",
|
|
43
|
-
"data-test-
|
|
46
|
+
"data-test-subj": "dataGridControls"
|
|
44
47
|
}, hasRoomForGridControls && (0, _react2.jsx)("div", {
|
|
45
48
|
className: "euiDataGrid__leftControls"
|
|
46
49
|
}, renderAdditionalControls(toolbarVisibility, 'left.prepend'), checkOrDefaultToolBarDisplayOptions(toolbarVisibility, 'showColumnSelector') ? columnSelector : null, checkOrDefaultToolBarDisplayOptions(toolbarVisibility, 'showSortSelector') ? columnSorting : null, renderAdditionalControls(toolbarVisibility, 'left.append')), (0, _react2.jsx)("div", {
|
|
47
50
|
className: "euiDataGrid__rightControls"
|
|
48
|
-
}, renderAdditionalControls(toolbarVisibility, 'right'), checkOrDefaultToolBarDisplayOptions(toolbarVisibility, '
|
|
51
|
+
}, renderAdditionalControls(toolbarVisibility, 'right'), checkOrDefaultToolBarDisplayOptions(toolbarVisibility, 'showKeyboardShortcuts') ? keyboardShortcuts : (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, {
|
|
52
|
+
showOnFocus: true
|
|
53
|
+
}, (0, _react2.jsx)("span", null, keyboardShortcuts)), checkOrDefaultToolBarDisplayOptions(toolbarVisibility, 'showDisplaySelector') ? displaySelector : null, checkOrDefaultToolBarDisplayOptions(toolbarVisibility, 'showFullScreenSelector') ? fullScreenSelector : null));
|
|
49
54
|
};
|
|
50
55
|
/**
|
|
51
56
|
* Toolbar utilities
|
|
@@ -45,6 +45,12 @@ Object.defineProperty(exports, "useDataGridFullScreenSelector", {
|
|
|
45
45
|
return _fullscreen_selector.useDataGridFullScreenSelector;
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
|
+
Object.defineProperty(exports, "useDataGridKeyboardShortcuts", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function get() {
|
|
51
|
+
return _keyboard_shortcuts.useDataGridKeyboardShortcuts;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
48
54
|
|
|
49
55
|
var _column_selector = require("./column_selector");
|
|
50
56
|
|
|
@@ -52,6 +58,8 @@ var _column_sorting = require("./column_sorting");
|
|
|
52
58
|
|
|
53
59
|
var _display_selector = require("./display_selector");
|
|
54
60
|
|
|
61
|
+
var _keyboard_shortcuts = require("./keyboard_shortcuts");
|
|
62
|
+
|
|
55
63
|
var _fullscreen_selector = require("./fullscreen_selector");
|
|
56
64
|
|
|
57
65
|
var _data_grid_toolbar = require("./data_grid_toolbar");
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.useDataGridKeyboardShortcuts = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _services = require("../../../services");
|
|
13
|
+
|
|
14
|
+
var _button = require("../../button");
|
|
15
|
+
|
|
16
|
+
var _tool_tip = require("../../tool_tip");
|
|
17
|
+
|
|
18
|
+
var _popover = require("../../popover");
|
|
19
|
+
|
|
20
|
+
var _description_list = require("../../description_list");
|
|
21
|
+
|
|
22
|
+
var _text = require("../../text");
|
|
23
|
+
|
|
24
|
+
var _i18n = require("../../i18n");
|
|
25
|
+
|
|
26
|
+
var _react2 = require("@emotion/react");
|
|
27
|
+
|
|
28
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
|
+
|
|
30
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
|
+
|
|
32
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
33
|
+
|
|
34
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
35
|
+
|
|
36
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
37
|
+
|
|
38
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
39
|
+
|
|
40
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
41
|
+
|
|
42
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
43
|
+
|
|
44
|
+
var useDataGridKeyboardShortcuts = function useDataGridKeyboardShortcuts() {
|
|
45
|
+
var _useState = (0, _react.useState)(false),
|
|
46
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
47
|
+
isOpen = _useState2[0],
|
|
48
|
+
setIsOpen = _useState2[1];
|
|
49
|
+
|
|
50
|
+
var title = (0, _i18n.useEuiI18n)('euiKeyboardShortcuts.title', 'Keyboard shortcuts');
|
|
51
|
+
var titleId = (0, _services.useGeneratedHtmlId)();
|
|
52
|
+
var keyboardShortcuts = (0, _react.useMemo)(function () {
|
|
53
|
+
return (0, _react2.jsx)(_popover.EuiPopover, {
|
|
54
|
+
"data-test-subj": "dataGridKeyboardShortcutsPopover",
|
|
55
|
+
isOpen: isOpen,
|
|
56
|
+
closePopover: function closePopover() {
|
|
57
|
+
return setIsOpen(false);
|
|
58
|
+
},
|
|
59
|
+
anchorPosition: "downRight",
|
|
60
|
+
button: (0, _react2.jsx)(_tool_tip.EuiToolTip, {
|
|
61
|
+
content: title,
|
|
62
|
+
delay: "long"
|
|
63
|
+
}, (0, _react2.jsx)(_button.EuiButtonIcon, {
|
|
64
|
+
size: "xs",
|
|
65
|
+
iconType: "keyboard",
|
|
66
|
+
color: "text",
|
|
67
|
+
"data-test-subj": "dataGridKeyboardShortcutsButton",
|
|
68
|
+
onClick: function onClick() {
|
|
69
|
+
return setIsOpen(!isOpen);
|
|
70
|
+
},
|
|
71
|
+
"aria-label": title
|
|
72
|
+
}))
|
|
73
|
+
}, (0, _react2.jsx)(_popover.EuiPopoverTitle, {
|
|
74
|
+
paddingSize: "s"
|
|
75
|
+
}, (0, _react2.jsx)("h2", {
|
|
76
|
+
id: titleId
|
|
77
|
+
}, title)), (0, _react2.jsx)(_text.EuiText, {
|
|
78
|
+
className: "euiDataGrid__keyboardShortcuts",
|
|
79
|
+
size: "xs"
|
|
80
|
+
}, (0, _react2.jsx)(_description_list.EuiDescriptionList, {
|
|
81
|
+
"aria-labelledby": titleId,
|
|
82
|
+
type: "column",
|
|
83
|
+
align: "center",
|
|
84
|
+
compressed: true,
|
|
85
|
+
gutterSize: "s",
|
|
86
|
+
listItems: [{
|
|
87
|
+
title: (0, _react2.jsx)("kbd", null, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
88
|
+
token: "euiKeyboardShortcuts.upArrowTitle",
|
|
89
|
+
default: "Up arrow"
|
|
90
|
+
})),
|
|
91
|
+
description: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
92
|
+
token: "euiKeyboardShortcuts.upArrowDescription",
|
|
93
|
+
default: "Move one cell up"
|
|
94
|
+
})
|
|
95
|
+
}, {
|
|
96
|
+
title: (0, _react2.jsx)("kbd", null, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
97
|
+
token: "euiKeyboardShortcuts.downArrowTitle",
|
|
98
|
+
default: "Down arrow"
|
|
99
|
+
})),
|
|
100
|
+
description: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
101
|
+
token: "euiKeyboardShortcuts.downArrowDescription",
|
|
102
|
+
default: "Move one cell down"
|
|
103
|
+
})
|
|
104
|
+
}, {
|
|
105
|
+
title: (0, _react2.jsx)("kbd", null, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
106
|
+
token: "euiKeyboardShortcuts.rightArrowTitle",
|
|
107
|
+
default: "Right arrow"
|
|
108
|
+
})),
|
|
109
|
+
description: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
110
|
+
token: "euiKeyboardShortcuts.rightArrowDescription",
|
|
111
|
+
default: "Move one cell right"
|
|
112
|
+
})
|
|
113
|
+
}, {
|
|
114
|
+
title: (0, _react2.jsx)("kbd", null, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
115
|
+
token: "euiKeyboardShortcuts.leftArrowTitle",
|
|
116
|
+
default: "Left arrow"
|
|
117
|
+
})),
|
|
118
|
+
description: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
119
|
+
token: "euiKeyboardShortcuts.leftArrowDescription",
|
|
120
|
+
default: "Move one cell left"
|
|
121
|
+
})
|
|
122
|
+
}, {
|
|
123
|
+
title: (0, _react2.jsx)("kbd", null, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
124
|
+
token: "euiKeyboardShortcuts.homeTitle",
|
|
125
|
+
default: "Home"
|
|
126
|
+
})),
|
|
127
|
+
description: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
128
|
+
token: "euiKeyboardShortcuts.homeDescription",
|
|
129
|
+
default: "Move to the first cell of the current row"
|
|
130
|
+
})
|
|
131
|
+
}, {
|
|
132
|
+
title: (0, _react2.jsx)("kbd", null, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
133
|
+
token: "euiKeyboardShortcuts.endTitle",
|
|
134
|
+
default: "End"
|
|
135
|
+
})),
|
|
136
|
+
description: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
137
|
+
token: "euiKeyboardShortcuts.endDescription",
|
|
138
|
+
default: "Move to the last cell of the current row"
|
|
139
|
+
})
|
|
140
|
+
}, {
|
|
141
|
+
title: (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)("kbd", null, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
142
|
+
token: "euiKeyboardShortcuts.ctrl",
|
|
143
|
+
default: "Ctrl"
|
|
144
|
+
})), ' ', (0, _react2.jsx)("kbd", null, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
145
|
+
token: "euiKeyboardShortcuts.homeTitle",
|
|
146
|
+
default: "Home"
|
|
147
|
+
}))),
|
|
148
|
+
description: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
149
|
+
token: "euiKeyboardShortcuts.ctrlHomeDescription",
|
|
150
|
+
default: "Move to the first cell of the current page"
|
|
151
|
+
})
|
|
152
|
+
}, {
|
|
153
|
+
title: (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)("kbd", null, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
154
|
+
token: "euiKeyboardShortcuts.ctrl",
|
|
155
|
+
default: "Ctrl"
|
|
156
|
+
})), ' ', (0, _react2.jsx)("kbd", null, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
157
|
+
token: "euiKeyboardShortcuts.endTitle",
|
|
158
|
+
default: "End"
|
|
159
|
+
}))),
|
|
160
|
+
description: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
161
|
+
token: "euiKeyboardShortcuts.ctrlEndDescription",
|
|
162
|
+
default: "Move to the last cell of the current page"
|
|
163
|
+
})
|
|
164
|
+
}, {
|
|
165
|
+
title: (0, _react2.jsx)("kbd", null, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
166
|
+
token: "euiKeyboardShortcuts.pageUpTitle",
|
|
167
|
+
default: "Page Up"
|
|
168
|
+
})),
|
|
169
|
+
description: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
170
|
+
token: "euiKeyboardShortcuts.pageUpDescription",
|
|
171
|
+
default: "Go to the last row of the previous page"
|
|
172
|
+
})
|
|
173
|
+
}, {
|
|
174
|
+
title: (0, _react2.jsx)("kbd", null, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
175
|
+
token: "euiKeyboardShortcuts.pageDownTitle",
|
|
176
|
+
default: "Page Down"
|
|
177
|
+
})),
|
|
178
|
+
description: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
179
|
+
token: "euiKeyboardShortcuts.pageDownDescription",
|
|
180
|
+
default: "Go to the first row of the next page"
|
|
181
|
+
})
|
|
182
|
+
}, {
|
|
183
|
+
title: (0, _react2.jsx)("kbd", null, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
184
|
+
token: "euiKeyboardShortcuts.enterTitle",
|
|
185
|
+
default: "Enter"
|
|
186
|
+
})),
|
|
187
|
+
description: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
188
|
+
token: "euiKeyboardShortcuts.enterDescription",
|
|
189
|
+
default: "Open cell details and actions"
|
|
190
|
+
})
|
|
191
|
+
}, {
|
|
192
|
+
title: (0, _react2.jsx)("kbd", null, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
193
|
+
token: "euiKeyboardShortcuts.escapeTitle",
|
|
194
|
+
default: "Escape"
|
|
195
|
+
})),
|
|
196
|
+
description: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
197
|
+
token: "euiKeyboardShortcuts.escapeDescription",
|
|
198
|
+
default: "Close cell details and actions"
|
|
199
|
+
})
|
|
200
|
+
}]
|
|
201
|
+
})));
|
|
202
|
+
}, [isOpen, title, titleId]);
|
|
203
|
+
return {
|
|
204
|
+
keyboardShortcuts: keyboardShortcuts
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
exports.useDataGridKeyboardShortcuts = useDataGridKeyboardShortcuts;
|
|
@@ -267,12 +267,15 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
267
267
|
cellPopoverContext = _useCellPopover.cellPopoverContext,
|
|
268
268
|
cellPopover = _useCellPopover.cellPopover;
|
|
269
269
|
/**
|
|
270
|
-
* Toolbar & fullscreen
|
|
270
|
+
* Toolbar, keyboard shortcuts, & fullscreen
|
|
271
271
|
*/
|
|
272
272
|
|
|
273
273
|
|
|
274
274
|
var showToolbar = !!toolbarVisibility;
|
|
275
275
|
|
|
276
|
+
var _useDataGridKeyboardS = (0, _controls.useDataGridKeyboardShortcuts)(),
|
|
277
|
+
keyboardShortcuts = _useDataGridKeyboardS.keyboardShortcuts;
|
|
278
|
+
|
|
276
279
|
var _useDataGridFullScree = (0, _controls.useDataGridFullScreenSelector)(),
|
|
277
280
|
isFullScreen = _useDataGridFullScree.isFullScreen,
|
|
278
281
|
setIsFullScreen = _useDataGridFullScree.setIsFullScreen,
|
|
@@ -361,6 +364,7 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
361
364
|
toolbarVisibility: toolbarVisibility,
|
|
362
365
|
isFullScreen: isFullScreen,
|
|
363
366
|
fullScreenSelector: fullScreenSelector,
|
|
367
|
+
keyboardShortcuts: keyboardShortcuts,
|
|
364
368
|
displaySelector: displaySelector,
|
|
365
369
|
columnSelector: columnSelector,
|
|
366
370
|
columnSorting: columnSorting
|
|
@@ -1139,6 +1143,12 @@ EuiDataGrid.propTypes = {
|
|
|
1139
1143
|
*/
|
|
1140
1144
|
showSortSelector: _propTypes.default.bool,
|
|
1141
1145
|
|
|
1146
|
+
/**
|
|
1147
|
+
* Displays a popover listing all keyboard controls and shortcuts for the data grid.
|
|
1148
|
+
* If set to `false`, the toggle will be visually hidden, but still focusable by keyboard and screen reader users.
|
|
1149
|
+
*/
|
|
1150
|
+
showKeyboardShortcuts: _propTypes.default.bool,
|
|
1151
|
+
|
|
1142
1152
|
/**
|
|
1143
1153
|
* Allows user to be able to fullscreen the data grid. If set to `false` make sure your grid fits within a large enough panel to still show the other controls.
|
|
1144
1154
|
*/
|
|
@@ -292,7 +292,8 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
292
292
|
locale = _this$props2.locale,
|
|
293
293
|
timeFormat = _this$props2.timeFormat,
|
|
294
294
|
utcOffset = _this$props2.utcOffset,
|
|
295
|
-
compressed = _this$props2.compressed
|
|
295
|
+
compressed = _this$props2.compressed,
|
|
296
|
+
onFocus = _this$props2.onFocus;
|
|
296
297
|
|
|
297
298
|
if (showPrettyDuration && !isStartDatePopoverOpen && !isEndDatePopoverOpen) {
|
|
298
299
|
return (0, _react2.jsx)(_date_picker_range.EuiDatePickerRange, {
|
|
@@ -307,7 +308,8 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
307
308
|
}),
|
|
308
309
|
"data-test-subj": "superDatePickerShowDatesButton",
|
|
309
310
|
disabled: isDisabled,
|
|
310
|
-
onClick: _this.hidePrettyDuration
|
|
311
|
+
onClick: _this.hidePrettyDuration,
|
|
312
|
+
onFocus: onFocus
|
|
311
313
|
}, (0, _react2.jsx)(_pretty_duration.PrettyDuration, {
|
|
312
314
|
timeFrom: start,
|
|
313
315
|
timeTo: end,
|
|
@@ -340,7 +342,10 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
340
342
|
isOpen: _this.state.isStartDatePopoverOpen,
|
|
341
343
|
onPopoverToggle: _this.onStartDatePopoverToggle,
|
|
342
344
|
onPopoverClose: _this.onStartDatePopoverClose,
|
|
343
|
-
timeOptions: timeOptions
|
|
345
|
+
timeOptions: timeOptions,
|
|
346
|
+
buttonProps: {
|
|
347
|
+
onFocus: onFocus
|
|
348
|
+
}
|
|
344
349
|
}),
|
|
345
350
|
endDateControl: (0, _react2.jsx)(_date_popover_button.EuiDatePopoverButton, {
|
|
346
351
|
position: "end",
|
|
@@ -358,7 +363,10 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
358
363
|
isOpen: _this.state.isEndDatePopoverOpen,
|
|
359
364
|
onPopoverToggle: _this.onEndDatePopoverToggle,
|
|
360
365
|
onPopoverClose: _this.onEndDatePopoverClose,
|
|
361
|
-
timeOptions: timeOptions
|
|
366
|
+
timeOptions: timeOptions,
|
|
367
|
+
buttonProps: {
|
|
368
|
+
onFocus: onFocus
|
|
369
|
+
}
|
|
362
370
|
})
|
|
363
371
|
});
|
|
364
372
|
});
|
|
@@ -576,6 +584,11 @@ EuiSuperDatePickerInternal.propTypes = {
|
|
|
576
584
|
*/
|
|
577
585
|
locale: _propTypes.default.any,
|
|
578
586
|
|
|
587
|
+
/**
|
|
588
|
+
* Triggered whenever the EuiSuperDatePicker's dates are focused
|
|
589
|
+
*/
|
|
590
|
+
onFocus: _propTypes.default.any,
|
|
591
|
+
|
|
579
592
|
/**
|
|
580
593
|
* Callback for when the refresh interval is fired.
|
|
581
594
|
* EuiSuperDatePicker will only manage a refresh interval timer when onRefresh callback is supplied
|
|
@@ -786,6 +799,11 @@ EuiSuperDatePicker.propTypes = {
|
|
|
786
799
|
*/
|
|
787
800
|
locale: _propTypes.default.any,
|
|
788
801
|
|
|
802
|
+
/**
|
|
803
|
+
* Triggered whenever the EuiSuperDatePicker's dates are focused
|
|
804
|
+
*/
|
|
805
|
+
onFocus: _propTypes.default.any,
|
|
806
|
+
|
|
789
807
|
/**
|
|
790
808
|
* Callback for when the refresh interval is fired.
|
|
791
809
|
* EuiSuperDatePicker will only manage a refresh interval timer when onRefresh callback is supplied
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
+
|
|
7
|
+
var _button = require("../button");
|
|
8
|
+
|
|
9
|
+
var _popover = require("../popover");
|
|
10
|
+
|
|
11
|
+
var _selectable = require("./selectable");
|
|
12
|
+
|
|
13
|
+
var _react2 = require("@emotion/react");
|
|
14
|
+
|
|
15
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
|
+
|
|
17
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
18
|
+
|
|
19
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
20
|
+
|
|
21
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
22
|
+
|
|
23
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
24
|
+
|
|
25
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
26
|
+
|
|
27
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
28
|
+
|
|
29
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
30
|
+
|
|
31
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
32
|
+
|
|
33
|
+
var options = [{
|
|
34
|
+
label: 'Titan',
|
|
35
|
+
'data-test-subj': 'titanOption'
|
|
36
|
+
}, {
|
|
37
|
+
label: 'Enceladus'
|
|
38
|
+
}, {
|
|
39
|
+
label: "Pandora is one of Saturn's moons, named for a Titaness of Greek mythology"
|
|
40
|
+
}];
|
|
41
|
+
|
|
42
|
+
var EuiSelectableListboxOnly = function EuiSelectableListboxOnly(args) {
|
|
43
|
+
return (0, _react2.jsx)(_selectable.EuiSelectable, _extends({
|
|
44
|
+
options: options
|
|
45
|
+
}, args), function (list) {
|
|
46
|
+
return (0, _react2.jsx)(_react.default.Fragment, null, list);
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
var EuiSelectableWithSearchInput = function EuiSelectableWithSearchInput(args) {
|
|
51
|
+
return (0, _react2.jsx)(_selectable.EuiSelectable, _extends({
|
|
52
|
+
searchable: true,
|
|
53
|
+
options: options
|
|
54
|
+
}, args), function (list, search) {
|
|
55
|
+
return (0, _react2.jsx)(_react.default.Fragment, null, search, list);
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
describe('EuiSelectable', function () {
|
|
60
|
+
describe('with a `searchable` configuration', function () {
|
|
61
|
+
it('has no accessibility errors', function () {
|
|
62
|
+
var onChange = cy.stub();
|
|
63
|
+
cy.realMount((0, _react2.jsx)(EuiSelectableWithSearchInput, {
|
|
64
|
+
onChange: onChange
|
|
65
|
+
}));
|
|
66
|
+
cy.checkAxe();
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
describe('without a `searchable` configuration', function () {
|
|
70
|
+
it('has no accessibility errors', function () {
|
|
71
|
+
var onChange = cy.stub();
|
|
72
|
+
cy.realMount((0, _react2.jsx)(EuiSelectableListboxOnly, {
|
|
73
|
+
"aria-label": "No search box",
|
|
74
|
+
onChange: onChange
|
|
75
|
+
}));
|
|
76
|
+
cy.checkAxe();
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
describe('nested in `EuiPopover` component', function () {
|
|
80
|
+
var EuiSelectableNested = function EuiSelectableNested() {
|
|
81
|
+
var _useState = (0, _react.useState)(false),
|
|
82
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
83
|
+
isPopoverOpen = _useState2[0],
|
|
84
|
+
setIsPopoverOpen = _useState2[1];
|
|
85
|
+
|
|
86
|
+
var onChange = function onChange() {};
|
|
87
|
+
|
|
88
|
+
var onClosePopover = function onClosePopover() {};
|
|
89
|
+
|
|
90
|
+
var onButtonClick = function onButtonClick() {
|
|
91
|
+
setIsPopoverOpen(!isPopoverOpen);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
var button = (0, _react2.jsx)(_button.EuiButton, {
|
|
95
|
+
iconType: "arrowDown",
|
|
96
|
+
iconSide: "right",
|
|
97
|
+
onClick: onButtonClick
|
|
98
|
+
}, "Show popover");
|
|
99
|
+
return (0, _react2.jsx)(_popover.EuiPopover, {
|
|
100
|
+
id: "data-cy-popover-1",
|
|
101
|
+
panelPaddingSize: "s",
|
|
102
|
+
button: button,
|
|
103
|
+
isOpen: isPopoverOpen,
|
|
104
|
+
closePopover: onClosePopover
|
|
105
|
+
}, (0, _react2.jsx)(EuiSelectableWithSearchInput, {
|
|
106
|
+
"aria-label": "With popover",
|
|
107
|
+
options: options,
|
|
108
|
+
onChange: onChange
|
|
109
|
+
}, function (list) {
|
|
110
|
+
return (0, _react2.jsx)(_react.default.Fragment, null, list);
|
|
111
|
+
}));
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
it('has no accessibility errors', function () {
|
|
115
|
+
cy.realMount((0, _react2.jsx)(EuiSelectableNested, null));
|
|
116
|
+
cy.get('button').realClick();
|
|
117
|
+
cy.get('li[role=option]').first(); // Make sure the EuiSelectable is rendered before a11y check
|
|
118
|
+
|
|
119
|
+
cy.checkAxe();
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
});
|
|
@@ -619,25 +619,28 @@ var EuiSelectable = /*#__PURE__*/function (_Component) {
|
|
|
619
619
|
}], [{
|
|
620
620
|
key: "getDerivedStateFromProps",
|
|
621
621
|
value: function getDerivedStateFromProps(nextProps, prevState) {
|
|
622
|
+
var _stateUpdate$searchVa;
|
|
623
|
+
|
|
622
624
|
var options = nextProps.options,
|
|
623
625
|
isPreFiltered = nextProps.isPreFiltered,
|
|
624
626
|
searchProps = nextProps.searchProps;
|
|
625
627
|
var activeOptionIndex = prevState.activeOptionIndex,
|
|
626
628
|
searchValue = prevState.searchValue;
|
|
627
|
-
var matchingOptions = (0, _matching_options.getMatchingOptions)(options, searchValue, isPreFiltered);
|
|
628
629
|
var stateUpdate = {
|
|
629
|
-
|
|
630
|
+
searchValue: searchValue,
|
|
630
631
|
activeOptionIndex: activeOptionIndex
|
|
631
632
|
};
|
|
632
633
|
|
|
633
|
-
if (activeOptionIndex != null && activeOptionIndex >= matchingOptions.length) {
|
|
634
|
-
stateUpdate.activeOptionIndex = -1;
|
|
635
|
-
}
|
|
636
|
-
|
|
637
634
|
if ((searchProps === null || searchProps === void 0 ? void 0 : searchProps.value) != null && searchProps.value !== searchValue) {
|
|
638
635
|
stateUpdate.searchValue = searchProps.value;
|
|
639
636
|
}
|
|
640
637
|
|
|
638
|
+
stateUpdate.visibleOptions = (0, _matching_options.getMatchingOptions)(options, (_stateUpdate$searchVa = stateUpdate.searchValue) !== null && _stateUpdate$searchVa !== void 0 ? _stateUpdate$searchVa : '', isPreFiltered);
|
|
639
|
+
|
|
640
|
+
if (activeOptionIndex != null && activeOptionIndex >= stateUpdate.visibleOptions.length) {
|
|
641
|
+
stateUpdate.activeOptionIndex = -1;
|
|
642
|
+
}
|
|
643
|
+
|
|
641
644
|
return stateUpdate;
|
|
642
645
|
}
|
|
643
646
|
}]);
|
|
@@ -51,11 +51,15 @@ var EuiTab = function EuiTab(_ref) {
|
|
|
51
51
|
'euiTab-isSelected': isSelected
|
|
52
52
|
});
|
|
53
53
|
var tabStyles = (0, _tab.euiTabStyles)(euiTheme);
|
|
54
|
-
var cssTabStyles = [tabStyles.euiTab, expand && tabStyles.expanded,
|
|
54
|
+
var cssTabStyles = [tabStyles.euiTab, expand && tabStyles.expanded, disabled && tabStyles.disabled.disabled, isSelected && (disabled ? tabStyles.disabled.selected : tabStyles.selected)];
|
|
55
55
|
var tabContentStyles = (0, _tab.euiTabContentStyles)(euiTheme);
|
|
56
56
|
var cssTabContentStyles = [tabContentStyles.euiTab__content, size && tabContentStyles[size], isSelected && tabContentStyles.selected, disabled && tabContentStyles.disabled];
|
|
57
|
-
var prependNode = prepend && (0, _react2.jsx)("span",
|
|
58
|
-
|
|
57
|
+
var prependNode = prepend && (0, _react2.jsx)("span", {
|
|
58
|
+
className: "euiTab__prepend"
|
|
59
|
+
}, prepend);
|
|
60
|
+
var appendNode = append && (0, _react2.jsx)("span", {
|
|
61
|
+
className: "euiTab__append"
|
|
62
|
+
}, append); // <a> elements don't respect the `disabled` attribute. So if we're disabled, we'll just pretend
|
|
59
63
|
// this is a button and piggyback off its disabled styles.
|
|
60
64
|
|
|
61
65
|
if (href && !disabled) {
|