@elastic/eui 70.1.0 → 70.2.1

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.
Files changed (116) hide show
  1. package/dist/eui_theme_dark.css +11 -1
  2. package/dist/eui_theme_dark.min.css +1 -1
  3. package/dist/eui_theme_light.css +11 -1
  4. package/dist/eui_theme_light.min.css +1 -1
  5. package/es/components/accessibility/screen_reader_only/screen_reader_only.js +1 -1
  6. package/es/components/accessibility/screen_reader_only/screen_reader_only.styles.js +1 -1
  7. package/es/components/accordion/accordion.a11y.js +35 -0
  8. package/es/components/card/card.js +13 -31
  9. package/es/components/card/card.styles.js +15 -3
  10. package/es/components/card/card_select/card_select.styles.js +4 -4
  11. package/es/components/card/checkable_card/checkable_card.js +3 -2
  12. package/es/components/context_menu/context_menu_panel.a11y.js +34 -0
  13. package/es/components/datagrid/controls/data_grid_toolbar.js +6 -2
  14. package/es/components/datagrid/controls/index.js +1 -0
  15. package/es/components/datagrid/controls/keyboard_shortcuts.js +191 -0
  16. package/es/components/datagrid/data_grid.js +12 -2
  17. package/es/components/date_picker/super_date_picker/super_date_picker.js +22 -4
  18. package/es/components/page/page_section/page_section.js +3 -4
  19. package/es/components/selectable/selectable.a11y.js +118 -0
  20. package/es/components/selectable/selectable.js +9 -6
  21. package/es/components/tabs/tab.js +9 -4
  22. package/es/components/tabs/tab.styles.js +29 -16
  23. package/es/components/tabs/tabbed_content/tabbed_content.js +1 -1
  24. package/es/components/tabs/tabs.js +3 -3
  25. package/es/components/tabs/tabs.styles.js +2 -4
  26. package/es/services/string/to_initials.js +1 -1
  27. package/eui.d.ts +208 -164
  28. package/i18ntokens.json +438 -6
  29. package/lib/components/accessibility/screen_reader_only/screen_reader_only.js +1 -1
  30. package/lib/components/accessibility/screen_reader_only/screen_reader_only.styles.js +1 -1
  31. package/lib/components/accordion/accordion.a11y.js +44 -0
  32. package/lib/components/card/card.js +14 -33
  33. package/lib/components/card/card.styles.js +15 -3
  34. package/lib/components/card/card_select/card_select.styles.js +4 -4
  35. package/lib/components/card/checkable_card/checkable_card.js +3 -2
  36. package/lib/components/context_menu/context_menu_panel.a11y.js +42 -0
  37. package/lib/components/datagrid/controls/data_grid_toolbar.js +7 -2
  38. package/lib/components/datagrid/controls/index.js +8 -0
  39. package/lib/components/datagrid/controls/keyboard_shortcuts.js +208 -0
  40. package/lib/components/datagrid/data_grid.js +11 -1
  41. package/lib/components/date_picker/super_date_picker/super_date_picker.js +22 -4
  42. package/lib/components/page/page_section/page_section.js +3 -4
  43. package/lib/components/selectable/selectable.a11y.js +122 -0
  44. package/lib/components/selectable/selectable.js +9 -6
  45. package/lib/components/tabs/tab.js +9 -4
  46. package/lib/components/tabs/tab.styles.js +29 -16
  47. package/lib/components/tabs/tabbed_content/tabbed_content.js +1 -1
  48. package/lib/components/tabs/tabs.js +3 -3
  49. package/lib/components/tabs/tabs.styles.js +1 -3
  50. package/lib/services/string/to_initials.js +1 -1
  51. package/optimize/es/components/accessibility/screen_reader_only/screen_reader_only.styles.js +1 -1
  52. package/optimize/es/components/accordion/accordion.a11y.js +35 -0
  53. package/optimize/es/components/card/card.js +12 -30
  54. package/optimize/es/components/card/card.styles.js +15 -3
  55. package/optimize/es/components/card/card_select/card_select.styles.js +4 -4
  56. package/optimize/es/components/card/checkable_card/checkable_card.js +3 -2
  57. package/optimize/es/components/context_menu/context_menu_panel.a11y.js +34 -0
  58. package/optimize/es/components/datagrid/controls/data_grid_toolbar.js +6 -2
  59. package/optimize/es/components/datagrid/controls/index.js +1 -0
  60. package/optimize/es/components/datagrid/controls/keyboard_shortcuts.js +181 -0
  61. package/optimize/es/components/datagrid/data_grid.js +6 -2
  62. package/optimize/es/components/date_picker/super_date_picker/super_date_picker.js +12 -4
  63. package/optimize/es/components/page/page_section/page_section.js +3 -4
  64. package/optimize/es/components/selectable/selectable.a11y.js +107 -0
  65. package/optimize/es/components/selectable/selectable.js +9 -6
  66. package/optimize/es/components/tabs/tab.js +9 -4
  67. package/optimize/es/components/tabs/tab.styles.js +29 -16
  68. package/optimize/es/components/tabs/tabs.js +3 -3
  69. package/optimize/es/components/tabs/tabs.styles.js +2 -4
  70. package/optimize/es/services/string/to_initials.js +1 -1
  71. package/optimize/lib/components/accessibility/screen_reader_only/screen_reader_only.styles.js +1 -1
  72. package/optimize/lib/components/accordion/accordion.a11y.js +44 -0
  73. package/optimize/lib/components/card/card.js +13 -32
  74. package/optimize/lib/components/card/card.styles.js +15 -3
  75. package/optimize/lib/components/card/card_select/card_select.styles.js +4 -4
  76. package/optimize/lib/components/card/checkable_card/checkable_card.js +3 -2
  77. package/optimize/lib/components/context_menu/context_menu_panel.a11y.js +42 -0
  78. package/optimize/lib/components/datagrid/controls/data_grid_toolbar.js +7 -2
  79. package/optimize/lib/components/datagrid/controls/index.js +8 -0
  80. package/optimize/lib/components/datagrid/controls/keyboard_shortcuts.js +207 -0
  81. package/optimize/lib/components/datagrid/data_grid.js +5 -1
  82. package/optimize/lib/components/date_picker/super_date_picker/super_date_picker.js +12 -4
  83. package/optimize/lib/components/page/page_section/page_section.js +3 -4
  84. package/optimize/lib/components/selectable/selectable.a11y.js +122 -0
  85. package/optimize/lib/components/selectable/selectable.js +9 -6
  86. package/optimize/lib/components/tabs/tab.js +9 -4
  87. package/optimize/lib/components/tabs/tab.styles.js +29 -16
  88. package/optimize/lib/components/tabs/tabs.js +3 -3
  89. package/optimize/lib/components/tabs/tabs.styles.js +1 -3
  90. package/optimize/lib/services/string/to_initials.js +1 -1
  91. package/package.json +3 -2
  92. package/src/components/datagrid/_index.scss +1 -0
  93. package/src/components/datagrid/controls/_data_grid_keyboard_shortcuts.scss +17 -0
  94. package/src/components/modal/_modal.scss +3 -1
  95. package/test-env/components/accessibility/screen_reader_only/screen_reader_only.js +1 -1
  96. package/test-env/components/accessibility/screen_reader_only/screen_reader_only.styles.js +1 -1
  97. package/test-env/components/accordion/accordion.a11y.js +44 -0
  98. package/test-env/components/card/card.js +14 -33
  99. package/test-env/components/card/card.styles.js +15 -3
  100. package/test-env/components/card/card_select/card_select.styles.js +4 -4
  101. package/test-env/components/card/checkable_card/checkable_card.js +3 -2
  102. package/test-env/components/context_menu/context_menu_panel.a11y.js +42 -0
  103. package/test-env/components/datagrid/controls/data_grid_toolbar.js +7 -2
  104. package/test-env/components/datagrid/controls/index.js +8 -0
  105. package/test-env/components/datagrid/controls/keyboard_shortcuts.js +207 -0
  106. package/test-env/components/datagrid/data_grid.js +11 -1
  107. package/test-env/components/date_picker/super_date_picker/super_date_picker.js +22 -4
  108. package/test-env/components/page/page_section/page_section.js +3 -4
  109. package/test-env/components/selectable/selectable.a11y.js +122 -0
  110. package/test-env/components/selectable/selectable.js +9 -6
  111. package/test-env/components/tabs/tab.js +9 -4
  112. package/test-env/components/tabs/tab.styles.js +29 -16
  113. package/test-env/components/tabs/tabbed_content/tabbed_content.js +1 -1
  114. package/test-env/components/tabs/tabs.js +3 -3
  115. package/test-env/components/tabs/tabs.styles.js +1 -3
  116. package/test-env/services/string/to_initials.js +1 -1
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _react = _interopRequireDefault(require("react"));
6
+
7
+ var _context_menu_item = require("./context_menu_item");
8
+
9
+ var _context_menu_panel = require("./context_menu_panel");
10
+
11
+ var _react2 = require("@emotion/react");
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
+ });
@@ -12,6 +12,8 @@ exports.renderAdditionalControls = renderAdditionalControls;
12
12
 
13
13
  var _react = _interopRequireDefault(require("react"));
14
14
 
15
+ var _accessibility = require("../../accessibility");
16
+
15
17
  var _utils = require("../../../utils");
16
18
 
17
19
  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-sub": "dataGridControls"
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, 'showDisplaySelector') ? displaySelector : null, checkOrDefaultToolBarDisplayOptions(toolbarVisibility, 'showFullScreenSelector') ? fullScreenSelector : null));
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,207 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports.useDataGridKeyboardShortcuts = void 0;
11
+
12
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
+
14
+ var _react = _interopRequireWildcard(require("react"));
15
+
16
+ var _services = require("../../../services");
17
+
18
+ var _button = require("../../button");
19
+
20
+ var _tool_tip = require("../../tool_tip");
21
+
22
+ var _popover = require("../../popover");
23
+
24
+ var _description_list = require("../../description_list");
25
+
26
+ var _text = require("../../text");
27
+
28
+ var _i18n = require("../../i18n");
29
+
30
+ var _react2 = require("@emotion/react");
31
+
32
+ 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); }
33
+
34
+ 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; }
35
+
36
+ /*
37
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
38
+ * or more contributor license agreements. Licensed under the Elastic License
39
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
40
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
41
+ * Side Public License, v 1.
42
+ */
43
+ var useDataGridKeyboardShortcuts = function useDataGridKeyboardShortcuts() {
44
+ var _useState = (0, _react.useState)(false),
45
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
46
+ isOpen = _useState2[0],
47
+ setIsOpen = _useState2[1];
48
+
49
+ var title = (0, _i18n.useEuiI18n)('euiKeyboardShortcuts.title', 'Keyboard shortcuts');
50
+ var titleId = (0, _services.useGeneratedHtmlId)();
51
+ var keyboardShortcuts = (0, _react.useMemo)(function () {
52
+ return (0, _react2.jsx)(_popover.EuiPopover, {
53
+ "data-test-subj": "dataGridKeyboardShortcutsPopover",
54
+ isOpen: isOpen,
55
+ closePopover: function closePopover() {
56
+ return setIsOpen(false);
57
+ },
58
+ anchorPosition: "downRight",
59
+ button: (0, _react2.jsx)(_tool_tip.EuiToolTip, {
60
+ content: title,
61
+ delay: "long"
62
+ }, (0, _react2.jsx)(_button.EuiButtonIcon, {
63
+ size: "xs",
64
+ iconType: "keyboard",
65
+ color: "text",
66
+ "data-test-subj": "dataGridKeyboardShortcutsButton",
67
+ onClick: function onClick() {
68
+ return setIsOpen(!isOpen);
69
+ },
70
+ "aria-label": title
71
+ }))
72
+ }, (0, _react2.jsx)(_popover.EuiPopoverTitle, {
73
+ paddingSize: "s"
74
+ }, (0, _react2.jsx)("h2", {
75
+ id: titleId
76
+ }, title)), (0, _react2.jsx)(_text.EuiText, {
77
+ className: "euiDataGrid__keyboardShortcuts",
78
+ size: "xs"
79
+ }, (0, _react2.jsx)(_description_list.EuiDescriptionList, {
80
+ "aria-labelledby": titleId,
81
+ type: "column",
82
+ align: "center",
83
+ compressed: true,
84
+ gutterSize: "s",
85
+ listItems: [{
86
+ title: (0, _react2.jsx)("kbd", null, (0, _react2.jsx)(_i18n.EuiI18n, {
87
+ token: "euiKeyboardShortcuts.upArrowTitle",
88
+ default: "Up arrow"
89
+ })),
90
+ description: (0, _react2.jsx)(_i18n.EuiI18n, {
91
+ token: "euiKeyboardShortcuts.upArrowDescription",
92
+ default: "Move one cell up"
93
+ })
94
+ }, {
95
+ title: (0, _react2.jsx)("kbd", null, (0, _react2.jsx)(_i18n.EuiI18n, {
96
+ token: "euiKeyboardShortcuts.downArrowTitle",
97
+ default: "Down arrow"
98
+ })),
99
+ description: (0, _react2.jsx)(_i18n.EuiI18n, {
100
+ token: "euiKeyboardShortcuts.downArrowDescription",
101
+ default: "Move one cell down"
102
+ })
103
+ }, {
104
+ title: (0, _react2.jsx)("kbd", null, (0, _react2.jsx)(_i18n.EuiI18n, {
105
+ token: "euiKeyboardShortcuts.rightArrowTitle",
106
+ default: "Right arrow"
107
+ })),
108
+ description: (0, _react2.jsx)(_i18n.EuiI18n, {
109
+ token: "euiKeyboardShortcuts.rightArrowDescription",
110
+ default: "Move one cell right"
111
+ })
112
+ }, {
113
+ title: (0, _react2.jsx)("kbd", null, (0, _react2.jsx)(_i18n.EuiI18n, {
114
+ token: "euiKeyboardShortcuts.leftArrowTitle",
115
+ default: "Left arrow"
116
+ })),
117
+ description: (0, _react2.jsx)(_i18n.EuiI18n, {
118
+ token: "euiKeyboardShortcuts.leftArrowDescription",
119
+ default: "Move one cell left"
120
+ })
121
+ }, {
122
+ title: (0, _react2.jsx)("kbd", null, (0, _react2.jsx)(_i18n.EuiI18n, {
123
+ token: "euiKeyboardShortcuts.homeTitle",
124
+ default: "Home"
125
+ })),
126
+ description: (0, _react2.jsx)(_i18n.EuiI18n, {
127
+ token: "euiKeyboardShortcuts.homeDescription",
128
+ default: "Move to the first cell of the current row"
129
+ })
130
+ }, {
131
+ title: (0, _react2.jsx)("kbd", null, (0, _react2.jsx)(_i18n.EuiI18n, {
132
+ token: "euiKeyboardShortcuts.endTitle",
133
+ default: "End"
134
+ })),
135
+ description: (0, _react2.jsx)(_i18n.EuiI18n, {
136
+ token: "euiKeyboardShortcuts.endDescription",
137
+ default: "Move to the last cell of the current row"
138
+ })
139
+ }, {
140
+ title: (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)("kbd", null, (0, _react2.jsx)(_i18n.EuiI18n, {
141
+ token: "euiKeyboardShortcuts.ctrl",
142
+ default: "Ctrl"
143
+ })), ' ', (0, _react2.jsx)("kbd", null, (0, _react2.jsx)(_i18n.EuiI18n, {
144
+ token: "euiKeyboardShortcuts.homeTitle",
145
+ default: "Home"
146
+ }))),
147
+ description: (0, _react2.jsx)(_i18n.EuiI18n, {
148
+ token: "euiKeyboardShortcuts.ctrlHomeDescription",
149
+ default: "Move to the first cell of the current page"
150
+ })
151
+ }, {
152
+ title: (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)("kbd", null, (0, _react2.jsx)(_i18n.EuiI18n, {
153
+ token: "euiKeyboardShortcuts.ctrl",
154
+ default: "Ctrl"
155
+ })), ' ', (0, _react2.jsx)("kbd", null, (0, _react2.jsx)(_i18n.EuiI18n, {
156
+ token: "euiKeyboardShortcuts.endTitle",
157
+ default: "End"
158
+ }))),
159
+ description: (0, _react2.jsx)(_i18n.EuiI18n, {
160
+ token: "euiKeyboardShortcuts.ctrlEndDescription",
161
+ default: "Move to the last cell of the current page"
162
+ })
163
+ }, {
164
+ title: (0, _react2.jsx)("kbd", null, (0, _react2.jsx)(_i18n.EuiI18n, {
165
+ token: "euiKeyboardShortcuts.pageUpTitle",
166
+ default: "Page Up"
167
+ })),
168
+ description: (0, _react2.jsx)(_i18n.EuiI18n, {
169
+ token: "euiKeyboardShortcuts.pageUpDescription",
170
+ default: "Go to the last row of the previous page"
171
+ })
172
+ }, {
173
+ title: (0, _react2.jsx)("kbd", null, (0, _react2.jsx)(_i18n.EuiI18n, {
174
+ token: "euiKeyboardShortcuts.pageDownTitle",
175
+ default: "Page Down"
176
+ })),
177
+ description: (0, _react2.jsx)(_i18n.EuiI18n, {
178
+ token: "euiKeyboardShortcuts.pageDownDescription",
179
+ default: "Go to the first row of the next page"
180
+ })
181
+ }, {
182
+ title: (0, _react2.jsx)("kbd", null, (0, _react2.jsx)(_i18n.EuiI18n, {
183
+ token: "euiKeyboardShortcuts.enterTitle",
184
+ default: "Enter"
185
+ })),
186
+ description: (0, _react2.jsx)(_i18n.EuiI18n, {
187
+ token: "euiKeyboardShortcuts.enterDescription",
188
+ default: "Open cell details and actions"
189
+ })
190
+ }, {
191
+ title: (0, _react2.jsx)("kbd", null, (0, _react2.jsx)(_i18n.EuiI18n, {
192
+ token: "euiKeyboardShortcuts.escapeTitle",
193
+ default: "Escape"
194
+ })),
195
+ description: (0, _react2.jsx)(_i18n.EuiI18n, {
196
+ token: "euiKeyboardShortcuts.escapeDescription",
197
+ default: "Close cell details and actions"
198
+ })
199
+ }]
200
+ })));
201
+ }, [isOpen, title, titleId]);
202
+ return {
203
+ keyboardShortcuts: keyboardShortcuts
204
+ };
205
+ };
206
+
207
+ exports.useDataGridKeyboardShortcuts = useDataGridKeyboardShortcuts;
@@ -246,12 +246,15 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
246
246
  cellPopoverContext = _useCellPopover.cellPopoverContext,
247
247
  cellPopover = _useCellPopover.cellPopover;
248
248
  /**
249
- * Toolbar & fullscreen
249
+ * Toolbar, keyboard shortcuts, & fullscreen
250
250
  */
251
251
 
252
252
 
253
253
  var showToolbar = !!toolbarVisibility;
254
254
 
255
+ var _useDataGridKeyboardS = (0, _controls.useDataGridKeyboardShortcuts)(),
256
+ keyboardShortcuts = _useDataGridKeyboardS.keyboardShortcuts;
257
+
255
258
  var _useDataGridFullScree = (0, _controls.useDataGridFullScreenSelector)(),
256
259
  isFullScreen = _useDataGridFullScree.isFullScreen,
257
260
  setIsFullScreen = _useDataGridFullScree.setIsFullScreen,
@@ -340,6 +343,7 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
340
343
  toolbarVisibility: toolbarVisibility,
341
344
  isFullScreen: isFullScreen,
342
345
  fullScreenSelector: fullScreenSelector,
346
+ keyboardShortcuts: keyboardShortcuts,
343
347
  displaySelector: displaySelector,
344
348
  columnSelector: columnSelector,
345
349
  columnSorting: columnSorting
@@ -267,7 +267,8 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
267
267
  locale = _this$props2.locale,
268
268
  timeFormat = _this$props2.timeFormat,
269
269
  utcOffset = _this$props2.utcOffset,
270
- compressed = _this$props2.compressed;
270
+ compressed = _this$props2.compressed,
271
+ onFocus = _this$props2.onFocus;
271
272
 
272
273
  if (showPrettyDuration && !isStartDatePopoverOpen && !isEndDatePopoverOpen) {
273
274
  return (0, _react2.jsx)(_date_picker_range.EuiDatePickerRange, {
@@ -282,7 +283,8 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
282
283
  }),
283
284
  "data-test-subj": "superDatePickerShowDatesButton",
284
285
  disabled: isDisabled,
285
- onClick: _this.hidePrettyDuration
286
+ onClick: _this.hidePrettyDuration,
287
+ onFocus: onFocus
286
288
  }, (0, _react2.jsx)(_pretty_duration.PrettyDuration, {
287
289
  timeFrom: start,
288
290
  timeTo: end,
@@ -315,7 +317,10 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
315
317
  isOpen: _this.state.isStartDatePopoverOpen,
316
318
  onPopoverToggle: _this.onStartDatePopoverToggle,
317
319
  onPopoverClose: _this.onStartDatePopoverClose,
318
- timeOptions: timeOptions
320
+ timeOptions: timeOptions,
321
+ buttonProps: {
322
+ onFocus: onFocus
323
+ }
319
324
  }),
320
325
  endDateControl: (0, _react2.jsx)(_date_popover_button.EuiDatePopoverButton, {
321
326
  position: "end",
@@ -333,7 +338,10 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
333
338
  isOpen: _this.state.isEndDatePopoverOpen,
334
339
  onPopoverToggle: _this.onEndDatePopoverToggle,
335
340
  onPopoverClose: _this.onEndDatePopoverClose,
336
- timeOptions: timeOptions
341
+ timeOptions: timeOptions,
342
+ buttonProps: {
343
+ onFocus: onFocus
344
+ }
337
345
  })
338
346
  });
339
347
  });
@@ -51,12 +51,11 @@ var EuiPageSection = function EuiPageSection(_ref) {
51
51
  var colors = (0, _global_styling.useEuiBackgroundColorCSS)();
52
52
  var cssStyles = [styles.euiPageSection, grow && styles.grow, inlinePadding[paddingSize], bottomBorder === 'extended' && styles.border, alignment && styles[alignment], colors[color]];
53
53
  var contentStyles = (0, _page_section.euiPageSectionContentStyles)();
54
- var cssContentStyles = [contentStyles.euiPageSection__content, blockPadding[paddingSize], bottomBorder === true && styles.border, alignment.toLowerCase().includes('center') && contentStyles.center, restrictWidth && contentStyles.restrictWidth];
54
+ var cssContentStyles = [contentStyles.euiPageSection__content, blockPadding[paddingSize], bottomBorder === true && styles.border, alignment.toLowerCase().includes('center') && contentStyles.center, restrictWidth && contentStyles.restrictWidth, (contentProps === null || contentProps === void 0 ? void 0 : contentProps.css) && contentProps.css];
55
55
  return (0, _react2.jsx)(Component, (0, _extends2.default)({
56
56
  css: cssStyles
57
- }, rest), (0, _react2.jsx)("div", (0, _extends2.default)({
58
- css: cssContentStyles
59
- }, contentProps, {
57
+ }, rest), (0, _react2.jsx)("div", (0, _extends2.default)({}, contentProps, {
58
+ css: cssContentStyles,
60
59
  style: widthStyles
61
60
  }), children));
62
61
  };
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
7
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
8
+
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+
11
+ var _react = _interopRequireWildcard(require("react"));
12
+
13
+ var _button = require("../button");
14
+
15
+ var _popover = require("../popover");
16
+
17
+ var _selectable = require("./selectable");
18
+
19
+ var _react2 = require("@emotion/react");
20
+
21
+ 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); }
22
+
23
+ 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; }
24
+
25
+ /*
26
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
27
+ * or more contributor license agreements. Licensed under the Elastic License
28
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
29
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
30
+ * Side Public License, v 1.
31
+ */
32
+ /// <reference types="../../../cypress/support"/>
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, (0, _extends2.default)({
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, (0, _extends2.default)({
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 = (0, _slicedToArray2.default)(_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
+ });
@@ -582,25 +582,28 @@ var EuiSelectable = /*#__PURE__*/function (_Component) {
582
582
  }], [{
583
583
  key: "getDerivedStateFromProps",
584
584
  value: function getDerivedStateFromProps(nextProps, prevState) {
585
+ var _stateUpdate$searchVa;
586
+
585
587
  var options = nextProps.options,
586
588
  isPreFiltered = nextProps.isPreFiltered,
587
589
  searchProps = nextProps.searchProps;
588
590
  var activeOptionIndex = prevState.activeOptionIndex,
589
591
  searchValue = prevState.searchValue;
590
- var matchingOptions = (0, _matching_options.getMatchingOptions)(options, searchValue, isPreFiltered);
591
592
  var stateUpdate = {
592
- visibleOptions: matchingOptions,
593
+ searchValue: searchValue,
593
594
  activeOptionIndex: activeOptionIndex
594
595
  };
595
596
 
596
- if (activeOptionIndex != null && activeOptionIndex >= matchingOptions.length) {
597
- stateUpdate.activeOptionIndex = -1;
598
- }
599
-
600
597
  if ((searchProps === null || searchProps === void 0 ? void 0 : searchProps.value) != null && searchProps.value !== searchValue) {
601
598
  stateUpdate.searchValue = searchProps.value;
602
599
  }
603
600
 
601
+ stateUpdate.visibleOptions = (0, _matching_options.getMatchingOptions)(options, (_stateUpdate$searchVa = stateUpdate.searchValue) !== null && _stateUpdate$searchVa !== void 0 ? _stateUpdate$searchVa : '', isPreFiltered);
602
+
603
+ if (activeOptionIndex != null && activeOptionIndex >= stateUpdate.visibleOptions.length) {
604
+ stateUpdate.activeOptionIndex = -1;
605
+ }
606
+
604
607
  return stateUpdate;
605
608
  }
606
609
  }]);
@@ -35,7 +35,8 @@ var EuiTab = function EuiTab(_ref) {
35
35
  rel = _ref.rel,
36
36
  prepend = _ref.prepend,
37
37
  append = _ref.append,
38
- size = _ref.size,
38
+ _ref$size = _ref.size,
39
+ size = _ref$size === void 0 ? 'm' : _ref$size,
39
40
  expand = _ref.expand,
40
41
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
41
42
  var euiTheme = (0, _services.useEuiTheme)();
@@ -46,11 +47,15 @@ var EuiTab = function EuiTab(_ref) {
46
47
  'euiTab-isSelected': isSelected
47
48
  });
48
49
  var tabStyles = (0, _tab.euiTabStyles)(euiTheme);
49
- var cssTabStyles = [tabStyles.euiTab, expand && tabStyles.expanded, isSelected && tabStyles.selected, disabled && tabStyles.disabled, size && tabStyles[size]];
50
+ var cssTabStyles = [tabStyles.euiTab, expand && tabStyles.expanded, disabled && tabStyles.disabled.disabled, isSelected && (disabled ? tabStyles.disabled.selected : tabStyles.selected)];
50
51
  var tabContentStyles = (0, _tab.euiTabContentStyles)(euiTheme);
51
52
  var cssTabContentStyles = [tabContentStyles.euiTab__content, size && tabContentStyles[size], isSelected && tabContentStyles.selected, disabled && tabContentStyles.disabled];
52
- var prependNode = prepend && (0, _react2.jsx)("span", null, prepend);
53
- var appendNode = append && (0, _react2.jsx)("span", null, append); // <a> elements don't respect the `disabled` attribute. So if we're disabled, we'll just pretend
53
+ var prependNode = prepend && (0, _react2.jsx)("span", {
54
+ className: "euiTab__prepend"
55
+ }, prepend);
56
+ var appendNode = append && (0, _react2.jsx)("span", {
57
+ className: "euiTab__append"
58
+ }, append); // <a> elements don't respect the `disabled` attribute. So if we're disabled, we'll just pretend
54
59
  // this is a button and piggyback off its disabled styles.
55
60
 
56
61
  if (href && !disabled) {
@@ -7,11 +7,13 @@ exports.euiTabStyles = exports.euiTabContentStyles = void 0;
7
7
 
8
8
  var _react = require("@emotion/react");
9
9
 
10
+ var _global_styling = require("../../global_styling");
11
+
10
12
  var _title = require("../title/title.styles");
11
13
 
12
14
  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)."; }
13
15
 
14
- var _ref = process.env.NODE_ENV === "production" ? {
16
+ var _ref2 = process.env.NODE_ENV === "production" ? {
15
17
  name: "10tso78-expanded",
16
18
  styles: "flex-basis:0%;flex-grow:1;justify-content:center;label:expanded;"
17
19
  } : {
@@ -20,36 +22,47 @@ var _ref = process.env.NODE_ENV === "production" ? {
20
22
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
21
23
  };
22
24
 
23
- var euiTabStyles = function euiTabStyles(_ref2) {
24
- var euiTheme = _ref2.euiTheme;
25
+ var euiTabStyles = function euiTabStyles(_ref3) {
26
+ var euiTheme = _ref3.euiTheme;
25
27
  return {
26
- euiTab: /*#__PURE__*/(0, _react.css)("display:flex;cursor:pointer;flex-direction:row;align-items:center;font-weight:", euiTheme.font.weight.semiBold, ";gap:", euiTheme.size.s, ";&:focus{background-color:transparent;outline-offset:-", euiTheme.focus.width, ";};label:euiTab;"),
27
- // sizes
28
- s: /*#__PURE__*/(0, _react.css)("padding:0 ", euiTheme.size.xs, ";;label:s;"),
29
- m: /*#__PURE__*/(0, _react.css)("padding:0 ", euiTheme.size.xs, ";;label:m;"),
30
- l: /*#__PURE__*/(0, _react.css)("padding:0 ", euiTheme.size.xs, ";;label:l;"),
31
- xl: /*#__PURE__*/(0, _react.css)("padding:", euiTheme.size.s, " ", euiTheme.size.xs, ";;label:xl;"),
28
+ euiTab: /*#__PURE__*/(0, _react.css)("display:flex;cursor:pointer;flex-direction:row;align-items:center;font-weight:", euiTheme.font.weight.semiBold, ";gap:", euiTheme.size.s, ";", (0, _global_styling.logicalCSS)('padding-vertical', 0), " ", (0, _global_styling.logicalCSS)('padding-horizontal', euiTheme.size.xs), " &:focus{background-color:transparent;outline-offset:-", euiTheme.focus.width, ";};label:euiTab;"),
32
29
  // variations
33
- expanded: _ref,
34
- selected: /*#__PURE__*/(0, _react.css)("box-shadow:inset 0 calc(", euiTheme.border.width.thick, " * -1) 0 ", euiTheme.colors.primary, ";;label:selected;"),
35
- disabled: /*#__PURE__*/(0, _react.css)("cursor:not-allowed;color:", euiTheme.colors.disabledText, ";.euiTab.euiTab__isSelected{box-shadow:inset 0 calc(", euiTheme.border.width.thick, " * -1) 0 ", euiTheme.colors.disabledText, ";};label:disabled;")
30
+ expanded: _ref2,
31
+ selected: /*#__PURE__*/(0, _react.css)("box-shadow:inset 0 -", euiTheme.border.width.thick, " 0 ", euiTheme.colors.primary, ";;label:selected;"),
32
+ disabled: {
33
+ disabled: /*#__PURE__*/(0, _react.css)("cursor:not-allowed;color:", euiTheme.colors.disabledText, ";;label:disabled;"),
34
+ selected: /*#__PURE__*/(0, _react.css)("box-shadow:inset 0 -", euiTheme.border.width.thick, " 0 ", euiTheme.colors.disabledText, ";;label:selected;")
35
+ }
36
36
  };
37
37
  };
38
38
 
39
39
  exports.euiTabStyles = euiTabStyles;
40
40
 
41
+ var _ref = process.env.NODE_ENV === "production" ? {
42
+ name: "1yhgei9-euiTab__content",
43
+ styles: "&:hover{text-decoration:none;};label:euiTab__content;"
44
+ } : {
45
+ name: "1yhgei9-euiTab__content",
46
+ styles: "&:hover{text-decoration:none;};label:euiTab__content;",
47
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
48
+ };
49
+
41
50
  var euiTabContentStyles = function euiTabContentStyles(euiThemeContext) {
42
51
  var euiTheme = euiThemeContext.euiTheme;
43
52
  return {
44
- euiTab__content: /*#__PURE__*/(0, _react.css)("color:", euiTheme.colors.disabledText, ";&:hover{text-decoration:none;};label:euiTab__content;"),
53
+ euiTab__content: _ref,
45
54
  // sizes
46
55
  s: /*#__PURE__*/(0, _react.css)((0, _title.euiTitle)(euiThemeContext, 'xxxs'), ";line-height:", euiTheme.size.xl, ";;label:s;"),
47
56
  m: /*#__PURE__*/(0, _react.css)((0, _title.euiTitle)(euiThemeContext, 'xxs'), ";line-height:", euiTheme.size.xxl, ";;label:m;"),
48
- l: /*#__PURE__*/(0, _react.css)((0, _title.euiTitle)(euiThemeContext, 'xs'), ";line-height:calc(", euiTheme.size.xl, " + ", euiTheme.size.s, ");;label:l;"),
49
- xl: /*#__PURE__*/(0, _react.css)((0, _title.euiTitle)(euiThemeContext, 's'), ";line-height:calc(", euiTheme.size.xxxl, " + ", euiTheme.size.s, ");;label:xl;"),
57
+ l: /*#__PURE__*/(0, _react.css)((0, _title.euiTitle)(euiThemeContext, 'xs'), ";line-height:", (0, _global_styling.mathWithUnits)([euiTheme.size.xl, euiTheme.size.s], function (x, y) {
58
+ return x + y;
59
+ }), ";;label:l;"),
60
+ xl: /*#__PURE__*/(0, _react.css)((0, _title.euiTitle)(euiThemeContext, 's'), ";line-height:", (0, _global_styling.mathWithUnits)([euiTheme.size.xxxl, euiTheme.size.s], function (x, y) {
61
+ return x + y;
62
+ }), ";;label:xl;"),
50
63
  // variations
51
64
  selected: /*#__PURE__*/(0, _react.css)("color:", euiTheme.colors.primaryText, ";;label:selected;"),
52
- disabled: /*#__PURE__*/(0, _react.css)("color:", euiTheme.colors.disabledText, ";&:hover{text-decoration:none;};label:disabled;")
65
+ disabled: /*#__PURE__*/(0, _react.css)("color:", euiTheme.colors.disabledText, ";;label:disabled;")
53
66
  };
54
67
  };
55
68