@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,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;
@@ -248,12 +248,15 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
248
248
  cellPopoverContext = _useCellPopover.cellPopoverContext,
249
249
  cellPopover = _useCellPopover.cellPopover;
250
250
  /**
251
- * Toolbar & fullscreen
251
+ * Toolbar, keyboard shortcuts, & fullscreen
252
252
  */
253
253
 
254
254
 
255
255
  var showToolbar = !!toolbarVisibility;
256
256
 
257
+ var _useDataGridKeyboardS = (0, _controls.useDataGridKeyboardShortcuts)(),
258
+ keyboardShortcuts = _useDataGridKeyboardS.keyboardShortcuts;
259
+
257
260
  var _useDataGridFullScree = (0, _controls.useDataGridFullScreenSelector)(),
258
261
  isFullScreen = _useDataGridFullScree.isFullScreen,
259
262
  setIsFullScreen = _useDataGridFullScree.setIsFullScreen,
@@ -342,6 +345,7 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
342
345
  toolbarVisibility: toolbarVisibility,
343
346
  isFullScreen: isFullScreen,
344
347
  fullScreenSelector: fullScreenSelector,
348
+ keyboardShortcuts: keyboardShortcuts,
345
349
  displaySelector: displaySelector,
346
350
  columnSelector: columnSelector,
347
351
  columnSorting: columnSorting
@@ -1120,6 +1124,12 @@ EuiDataGrid.propTypes = {
1120
1124
  */
1121
1125
  showSortSelector: _propTypes.default.bool,
1122
1126
 
1127
+ /**
1128
+ * Displays a popover listing all keyboard controls and shortcuts for the data grid.
1129
+ * If set to `false`, the toggle will be visually hidden, but still focusable by keyboard and screen reader users.
1130
+ */
1131
+ showKeyboardShortcuts: _propTypes.default.bool,
1132
+
1123
1133
  /**
1124
1134
  * 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.
1125
1135
  */
@@ -269,7 +269,8 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
269
269
  locale = _this$props2.locale,
270
270
  timeFormat = _this$props2.timeFormat,
271
271
  utcOffset = _this$props2.utcOffset,
272
- compressed = _this$props2.compressed;
272
+ compressed = _this$props2.compressed,
273
+ onFocus = _this$props2.onFocus;
273
274
 
274
275
  if (showPrettyDuration && !isStartDatePopoverOpen && !isEndDatePopoverOpen) {
275
276
  return (0, _react2.jsx)(_date_picker_range.EuiDatePickerRange, {
@@ -284,7 +285,8 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
284
285
  }),
285
286
  "data-test-subj": "superDatePickerShowDatesButton",
286
287
  disabled: isDisabled,
287
- onClick: _this.hidePrettyDuration
288
+ onClick: _this.hidePrettyDuration,
289
+ onFocus: onFocus
288
290
  }, (0, _react2.jsx)(_pretty_duration.PrettyDuration, {
289
291
  timeFrom: start,
290
292
  timeTo: end,
@@ -317,7 +319,10 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
317
319
  isOpen: _this.state.isStartDatePopoverOpen,
318
320
  onPopoverToggle: _this.onStartDatePopoverToggle,
319
321
  onPopoverClose: _this.onStartDatePopoverClose,
320
- timeOptions: timeOptions
322
+ timeOptions: timeOptions,
323
+ buttonProps: {
324
+ onFocus: onFocus
325
+ }
321
326
  }),
322
327
  endDateControl: (0, _react2.jsx)(_date_popover_button.EuiDatePopoverButton, {
323
328
  position: "end",
@@ -335,7 +340,10 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
335
340
  isOpen: _this.state.isEndDatePopoverOpen,
336
341
  onPopoverToggle: _this.onEndDatePopoverToggle,
337
342
  onPopoverClose: _this.onEndDatePopoverClose,
338
- timeOptions: timeOptions
343
+ timeOptions: timeOptions,
344
+ buttonProps: {
345
+ onFocus: onFocus
346
+ }
339
347
  })
340
348
  });
341
349
  });
@@ -547,6 +555,11 @@ EuiSuperDatePickerInternal.propTypes = {
547
555
  */
548
556
  locale: _propTypes.default.any,
549
557
 
558
+ /**
559
+ * Triggered whenever the EuiSuperDatePicker's dates are focused
560
+ */
561
+ onFocus: _propTypes.default.any,
562
+
550
563
  /**
551
564
  * Callback for when the refresh interval is fired.
552
565
  * EuiSuperDatePicker will only manage a refresh interval timer when onRefresh callback is supplied
@@ -757,6 +770,11 @@ EuiSuperDatePicker.propTypes = {
757
770
  */
758
771
  locale: _propTypes.default.any,
759
772
 
773
+ /**
774
+ * Triggered whenever the EuiSuperDatePicker's dates are focused
775
+ */
776
+ onFocus: _propTypes.default.any,
777
+
760
778
  /**
761
779
  * Callback for when the refresh interval is fired.
762
780
  * EuiSuperDatePicker will only manage a refresh interval timer when onRefresh callback is supplied
@@ -53,12 +53,11 @@ var EuiPageSection = function EuiPageSection(_ref) {
53
53
  var colors = (0, _global_styling.useEuiBackgroundColorCSS)();
54
54
  var cssStyles = [styles.euiPageSection, grow && styles.grow, inlinePadding[paddingSize], bottomBorder === 'extended' && styles.border, alignment && styles[alignment], colors[color]];
55
55
  var contentStyles = (0, _page_section.euiPageSectionContentStyles)();
56
- var cssContentStyles = [contentStyles.euiPageSection__content, blockPadding[paddingSize], bottomBorder === true && styles.border, alignment.toLowerCase().includes('center') && contentStyles.center, restrictWidth && contentStyles.restrictWidth];
56
+ 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];
57
57
  return (0, _react2.jsx)(Component, (0, _extends2.default)({
58
58
  css: cssStyles
59
- }, rest), (0, _react2.jsx)("div", (0, _extends2.default)({
60
- css: cssContentStyles
61
- }, contentProps, {
59
+ }, rest), (0, _react2.jsx)("div", (0, _extends2.default)({}, contentProps, {
60
+ css: cssContentStyles,
62
61
  style: widthStyles
63
62
  }), children));
64
63
  };
@@ -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
+ });
@@ -584,25 +584,28 @@ var EuiSelectable = /*#__PURE__*/function (_Component) {
584
584
  }], [{
585
585
  key: "getDerivedStateFromProps",
586
586
  value: function getDerivedStateFromProps(nextProps, prevState) {
587
+ var _stateUpdate$searchVa;
588
+
587
589
  var options = nextProps.options,
588
590
  isPreFiltered = nextProps.isPreFiltered,
589
591
  searchProps = nextProps.searchProps;
590
592
  var activeOptionIndex = prevState.activeOptionIndex,
591
593
  searchValue = prevState.searchValue;
592
- var matchingOptions = (0, _matching_options.getMatchingOptions)(options, searchValue, isPreFiltered);
593
594
  var stateUpdate = {
594
- visibleOptions: matchingOptions,
595
+ searchValue: searchValue,
595
596
  activeOptionIndex: activeOptionIndex
596
597
  };
597
598
 
598
- if (activeOptionIndex != null && activeOptionIndex >= matchingOptions.length) {
599
- stateUpdate.activeOptionIndex = -1;
600
- }
601
-
602
599
  if ((searchProps === null || searchProps === void 0 ? void 0 : searchProps.value) != null && searchProps.value !== searchValue) {
603
600
  stateUpdate.searchValue = searchProps.value;
604
601
  }
605
602
 
603
+ stateUpdate.visibleOptions = (0, _matching_options.getMatchingOptions)(options, (_stateUpdate$searchVa = stateUpdate.searchValue) !== null && _stateUpdate$searchVa !== void 0 ? _stateUpdate$searchVa : '', isPreFiltered);
604
+
605
+ if (activeOptionIndex != null && activeOptionIndex >= stateUpdate.visibleOptions.length) {
606
+ stateUpdate.activeOptionIndex = -1;
607
+ }
608
+
606
609
  return stateUpdate;
607
610
  }
608
611
  }]);
@@ -37,7 +37,8 @@ var EuiTab = function EuiTab(_ref) {
37
37
  rel = _ref.rel,
38
38
  prepend = _ref.prepend,
39
39
  append = _ref.append,
40
- size = _ref.size,
40
+ _ref$size = _ref.size,
41
+ size = _ref$size === void 0 ? 'm' : _ref$size,
41
42
  expand = _ref.expand,
42
43
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
43
44
  var euiTheme = (0, _services.useEuiTheme)();
@@ -48,11 +49,15 @@ var EuiTab = function EuiTab(_ref) {
48
49
  'euiTab-isSelected': isSelected
49
50
  });
50
51
  var tabStyles = (0, _tab.euiTabStyles)(euiTheme);
51
- var cssTabStyles = [tabStyles.euiTab, expand && tabStyles.expanded, isSelected && tabStyles.selected, disabled && tabStyles.disabled, size && tabStyles[size]];
52
+ var cssTabStyles = [tabStyles.euiTab, expand && tabStyles.expanded, disabled && tabStyles.disabled.disabled, isSelected && (disabled ? tabStyles.disabled.selected : tabStyles.selected)];
52
53
  var tabContentStyles = (0, _tab.euiTabContentStyles)(euiTheme);
53
54
  var cssTabContentStyles = [tabContentStyles.euiTab__content, size && tabContentStyles[size], isSelected && tabContentStyles.selected, disabled && tabContentStyles.disabled];
54
- var prependNode = prepend && (0, _react2.jsx)("span", null, prepend);
55
- 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
55
+ var prependNode = prepend && (0, _react2.jsx)("span", {
56
+ className: "euiTab__prepend"
57
+ }, prepend);
58
+ var appendNode = append && (0, _react2.jsx)("span", {
59
+ className: "euiTab__append"
60
+ }, append); // <a> elements don't respect the `disabled` attribute. So if we're disabled, we'll just pretend
56
61
  // this is a button and piggyback off its disabled styles.
57
62
 
58
63
  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
 
@@ -273,7 +273,7 @@ EuiTabbedContent.propTypes = {
273
273
  "data-test-subj": _propTypes.default.string,
274
274
  css: _propTypes.default.any
275
275
  }),
276
- size: _propTypes.default.oneOf(["s", "m", "l", "xl"]),
276
+ size: _propTypes.default.any,
277
277
 
278
278
  /**
279
279
  * Each tab needs id and content properties, so we can associate it with its panel for accessibility.
@@ -45,8 +45,8 @@ var EuiTabs = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
45
45
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
46
46
  var euiTheme = (0, _services.useEuiTheme)();
47
47
  var classes = (0, _classnames.default)('euiTabs', className);
48
- var tabsStyles = (0, _tabs.euiTabsStyles)(euiTheme);
49
- var computedStyles = [tabsStyles.euiTabs, tabsStyles[size], bottomBorder && tabsStyles.bottomBorder];
48
+ var styles = (0, _tabs.euiTabsStyles)(euiTheme);
49
+ var cssStyles = [styles.euiTabs, styles[size], bottomBorder && styles.bottomBorder];
50
50
 
51
51
  var tabItems = _react.default.Children.map(children, function (child) {
52
52
  if ( /*#__PURE__*/_react.default.isValidElement(child)) {
@@ -61,7 +61,7 @@ var EuiTabs = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
61
61
  return (0, _react2.jsx)("div", (0, _extends2.default)({
62
62
  ref: ref,
63
63
  className: classes,
64
- css: computedStyles
64
+ css: cssStyles
65
65
  }, children && {
66
66
  role: 'tablist'
67
67
  }, rest), tabItems);
@@ -20,9 +20,7 @@ var euiTabsStyles = function euiTabsStyles(euiThemeContext) {
20
20
  var euiTheme = euiThemeContext.euiTheme;
21
21
  return {
22
22
  euiTabs: /*#__PURE__*/(0, _react.css)("display:flex;", (0, _global_styling.logicalCSS)('max-width', '100%'), ";", (0, _global_styling.logicalCSSWithFallback)('overflow-x', 'auto'), ";", (0, _global_styling.logicalCSSWithFallback)('overflow-y', 'hidden'), ";position:relative;flex-shrink:0;;label:euiTabs;"),
23
- bottomBorder: /*#__PURE__*/(0, _react.css)("box-shadow:inset 0 ", (0, _global_styling.mathWithUnits)(euiTheme.border.width.thin, function (x) {
24
- return x * -1;
25
- }), " 0 ", euiTheme.border.color, ";;label:bottomBorder;"),
23
+ bottomBorder: /*#__PURE__*/(0, _react.css)("box-shadow:inset 0 -", euiTheme.border.width.thin, " 0 ", euiTheme.border.color, ";;label:bottomBorder;"),
26
24
  // sizes
27
25
  s: /*#__PURE__*/(0, _react.css)("gap:", euiTheme.size.m, ";;label:s;"),
28
26
  m: /*#__PURE__*/(0, _react.css)("gap:", euiTheme.size.base, ";;label:m;"),
@@ -32,7 +32,7 @@ exports.MAX_INITIALS = MAX_INITIALS;
32
32
 
33
33
  function toInitials(name, initialsLength, initials) {
34
34
  // Calculate the number of initials to show, maxing out at MAX_INITIALS
35
- var calculatedInitialsLength = initials ? initials.split(' ').length : name.split(' ').length;
35
+ var calculatedInitialsLength = initials ? initials.split('').length : name.split(' ').length;
36
36
  calculatedInitialsLength = calculatedInitialsLength > MAX_INITIALS ? MAX_INITIALS : calculatedInitialsLength; // Check if initialsLength was passed and set to calculated, unless greater than MAX_INITIALS
37
37
 
38
38
  if (initialsLength) {