@elastic/eui 95.9.0 → 95.10.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.
Files changed (101) hide show
  1. package/dist/eui_theme_dark.css +35 -6
  2. package/dist/eui_theme_dark.min.css +1 -1
  3. package/dist/eui_theme_light.css +35 -6
  4. package/dist/eui_theme_light.min.css +1 -1
  5. package/es/components/basic_table/in_memory_table.js +2 -1
  6. package/es/components/datagrid/body/cell/data_grid_cell.js +2 -0
  7. package/es/components/datagrid/body/cell/focus_utils.js +57 -11
  8. package/es/components/datagrid/body/data_grid_body.js +1 -0
  9. package/es/components/datagrid/body/data_grid_body_custom.js +1 -0
  10. package/es/components/datagrid/body/data_grid_body_virtualized.js +1 -0
  11. package/es/components/datagrid/body/header/data_grid_header_cell.js +92 -83
  12. package/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +37 -22
  13. package/es/components/datagrid/controls/column_sorting.js +1 -0
  14. package/es/components/datagrid/data_grid.a11y.js +2 -0
  15. package/es/components/datagrid/utils/in_memory.js +1 -0
  16. package/es/components/date_picker/date_picker.js +32 -10
  17. package/es/components/date_picker/date_picker.styles.js +3 -2
  18. package/es/components/date_picker/date_picker_range.styles.js +1 -1
  19. package/es/components/form/super_select/super_select.styles.js +1 -1
  20. package/es/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +15 -8
  21. package/es/components/markdown_editor/plugins/markdown_default_plugins/plugins.js +21 -4
  22. package/es/components/markdown_editor/plugins/markdown_default_plugins/processing_plugins.js +5 -2
  23. package/es/components/markdown_editor/plugins/markdown_link_validator.js +8 -2
  24. package/es/components/search_bar/filters/field_value_selection_filter.js +171 -152
  25. package/es/components/search_bar/search_bar.js +2 -1
  26. package/es/components/search_bar/search_filters.js +2 -1
  27. package/eui.d.ts +138 -69
  28. package/i18ntokens.json +78 -42
  29. package/lib/components/basic_table/in_memory_table.js +2 -1
  30. package/lib/components/datagrid/body/cell/data_grid_cell.js +2 -0
  31. package/lib/components/datagrid/body/cell/focus_utils.js +58 -12
  32. package/lib/components/datagrid/body/data_grid_body.js +1 -0
  33. package/lib/components/datagrid/body/data_grid_body_custom.js +1 -0
  34. package/lib/components/datagrid/body/data_grid_body_virtualized.js +1 -0
  35. package/lib/components/datagrid/body/header/data_grid_header_cell.js +98 -88
  36. package/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +38 -23
  37. package/lib/components/datagrid/controls/column_sorting.js +1 -0
  38. package/lib/components/datagrid/data_grid.a11y.js +2 -0
  39. package/lib/components/datagrid/utils/in_memory.js +1 -0
  40. package/lib/components/date_picker/date_picker.js +32 -10
  41. package/lib/components/date_picker/date_picker.styles.js +3 -2
  42. package/lib/components/date_picker/date_picker_range.styles.js +1 -1
  43. package/lib/components/form/super_select/super_select.styles.js +1 -1
  44. package/lib/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +26 -17
  45. package/lib/components/markdown_editor/plugins/markdown_default_plugins/plugins.js +21 -6
  46. package/lib/components/markdown_editor/plugins/markdown_default_plugins/processing_plugins.js +5 -2
  47. package/lib/components/markdown_editor/plugins/markdown_link_validator.js +9 -2
  48. package/lib/components/search_bar/filters/field_value_selection_filter.js +170 -151
  49. package/lib/components/search_bar/search_bar.js +2 -1
  50. package/lib/components/search_bar/search_filters.js +2 -1
  51. package/optimize/es/components/datagrid/body/cell/focus_utils.js +55 -10
  52. package/optimize/es/components/datagrid/body/header/data_grid_header_cell.js +90 -83
  53. package/optimize/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +33 -19
  54. package/optimize/es/components/datagrid/data_grid.a11y.js +2 -0
  55. package/optimize/es/components/date_picker/date_picker.js +15 -9
  56. package/optimize/es/components/date_picker/date_picker.styles.js +3 -2
  57. package/optimize/es/components/date_picker/date_picker_range.styles.js +1 -1
  58. package/optimize/es/components/form/super_select/super_select.styles.js +1 -1
  59. package/optimize/es/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +14 -8
  60. package/optimize/es/components/markdown_editor/plugins/markdown_default_plugins/plugins.js +18 -4
  61. package/optimize/es/components/markdown_editor/plugins/markdown_default_plugins/processing_plugins.js +5 -2
  62. package/optimize/es/components/markdown_editor/plugins/markdown_link_validator.js +8 -2
  63. package/optimize/es/components/search_bar/filters/field_value_selection_filter.js +168 -151
  64. package/optimize/lib/components/datagrid/body/cell/focus_utils.js +56 -11
  65. package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.js +92 -84
  66. package/optimize/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +33 -19
  67. package/optimize/lib/components/datagrid/data_grid.a11y.js +2 -0
  68. package/optimize/lib/components/date_picker/date_picker.js +15 -9
  69. package/optimize/lib/components/date_picker/date_picker.styles.js +3 -2
  70. package/optimize/lib/components/date_picker/date_picker_range.styles.js +1 -1
  71. package/optimize/lib/components/form/super_select/super_select.styles.js +1 -1
  72. package/optimize/lib/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +15 -11
  73. package/optimize/lib/components/markdown_editor/plugins/markdown_default_plugins/plugins.js +19 -6
  74. package/optimize/lib/components/markdown_editor/plugins/markdown_default_plugins/processing_plugins.js +5 -2
  75. package/optimize/lib/components/markdown_editor/plugins/markdown_link_validator.js +9 -2
  76. package/optimize/lib/components/search_bar/filters/field_value_selection_filter.js +167 -150
  77. package/package.json +1 -1
  78. package/src/components/datagrid/_data_grid_data_row.scss +5 -0
  79. package/src/components/datagrid/body/header/_data_grid_header_row.scss +27 -5
  80. package/test-env/components/basic_table/in_memory_table.js +2 -1
  81. package/test-env/components/datagrid/body/cell/data_grid_cell.js +2 -0
  82. package/test-env/components/datagrid/body/cell/focus_utils.js +58 -12
  83. package/test-env/components/datagrid/body/data_grid_body.js +1 -0
  84. package/test-env/components/datagrid/body/data_grid_body_custom.js +1 -0
  85. package/test-env/components/datagrid/body/data_grid_body_virtualized.js +1 -0
  86. package/test-env/components/datagrid/body/header/data_grid_header_cell.js +93 -84
  87. package/test-env/components/datagrid/body/header/data_grid_header_cell_wrapper.js +37 -22
  88. package/test-env/components/datagrid/controls/column_sorting.js +1 -0
  89. package/test-env/components/datagrid/data_grid.a11y.js +2 -0
  90. package/test-env/components/datagrid/utils/in_memory.js +1 -0
  91. package/test-env/components/date_picker/date_picker.js +32 -10
  92. package/test-env/components/date_picker/date_picker.styles.js +3 -2
  93. package/test-env/components/date_picker/date_picker_range.styles.js +1 -1
  94. package/test-env/components/form/super_select/super_select.styles.js +1 -1
  95. package/test-env/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +15 -11
  96. package/test-env/components/markdown_editor/plugins/markdown_default_plugins/plugins.js +19 -6
  97. package/test-env/components/markdown_editor/plugins/markdown_default_plugins/processing_plugins.js +5 -2
  98. package/test-env/components/markdown_editor/plugins/markdown_link_validator.js +9 -2
  99. package/test-env/components/search_bar/filters/field_value_selection_filter.js +169 -151
  100. package/test-env/components/search_bar/search_bar.js +2 -1
  101. package/test-env/components/search_bar/search_filters.js +2 -1
@@ -1,6 +1,8 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ import _extends from "@babel/runtime/helpers/extends";
4
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
+ var _excluded = ["children", "title", "arrow"];
4
6
  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)."; }
5
7
  /*
6
8
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
@@ -13,13 +15,13 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
13
15
  import classnames from 'classnames';
14
16
  import React, { useContext, useState, useRef, useCallback, useMemo, memo } from 'react';
15
17
  import { tabbable } from 'tabbable';
16
- import { keys } from '../../../../services';
18
+ import { keys, useEuiMemoizedStyles } from '../../../../services';
17
19
  import { useGeneratedHtmlId } from '../../../../services/accessibility';
18
- import { EuiScreenReaderOnly } from '../../../accessibility';
19
- import { EuiI18n } from '../../../i18n';
20
+ import { EuiI18n, useEuiI18n } from '../../../i18n';
20
21
  import { EuiIcon } from '../../../icon';
21
22
  import { EuiListGroup } from '../../../list_group';
22
23
  import { EuiPopover } from '../../../popover';
24
+ import { _emptyHoverStyles } from '../../../button/button_icon/button_icon.styles';
23
25
  import { DataGridFocusContext } from '../../utils/focus';
24
26
  import { getColumnActions } from './column_actions';
25
27
  import { EuiDataGridColumnResizer } from './data_grid_column_resizer';
@@ -28,11 +30,12 @@ import { jsx as ___EmotionJSX } from "@emotion/react";
28
30
  var CellContent = function CellContent(_ref) {
29
31
  var children = _ref.children,
30
32
  title = _ref.title,
31
- arrow = _ref.arrow;
32
- return ___EmotionJSX(React.Fragment, null, ___EmotionJSX("div", {
33
+ arrow = _ref.arrow,
34
+ rest = _objectWithoutProperties(_ref, _excluded);
35
+ return ___EmotionJSX(React.Fragment, null, ___EmotionJSX("div", _extends({}, rest, {
33
36
  title: title,
34
37
  className: "euiDataGridHeaderCell__content"
35
- }, children), arrow);
38
+ }), children), arrow);
36
39
  };
37
40
  var _ref3 = process.env.NODE_ENV === "production" ? {
38
41
  name: "mc0thx-EuiDataGridHeaderCell",
@@ -58,15 +61,29 @@ export var EuiDataGridHeaderCell = /*#__PURE__*/memo(function (_ref2) {
58
61
  display = column.display,
59
62
  displayAsText = column.displayAsText,
60
63
  displayHeaderCellProps = column.displayHeaderCellProps;
64
+ var title = displayAsText || id;
65
+ var children = display || displayAsText || id;
61
66
  var width = columnWidths[id] || defaultColumnWidth;
62
67
  var columnType = schema[id] ? schema[id].columnType : null;
63
68
  var _useContext = useContext(DataGridFocusContext),
64
69
  setFocusedCell = _useContext.setFocusedCell,
65
70
  focusFirstVisibleInteractiveCell = _useContext.focusFirstVisibleInteractiveCell;
71
+
72
+ /*
73
+ * Column actions
74
+ */
66
75
  var _useState = useState(false),
67
76
  _useState2 = _slicedToArray(_useState, 2),
68
77
  isPopoverOpen = _useState2[0],
69
78
  setIsPopoverOpen = _useState2[1];
79
+ var togglePopover = useCallback(function () {
80
+ setIsPopoverOpen(function (isOpen) {
81
+ return !isOpen;
82
+ });
83
+ }, []);
84
+ var closePopover = useCallback(function () {
85
+ return setIsPopoverOpen(false);
86
+ }, []);
70
87
  var popoverArrowNavigationProps = usePopoverArrowNavigation();
71
88
  var columnActions = useMemo(function () {
72
89
  return getColumnActions({
@@ -85,14 +102,22 @@ export var EuiDataGridHeaderCell = /*#__PURE__*/memo(function (_ref2) {
85
102
  }, [column, columns, schema, schemaDetectors, setVisibleColumns, focusFirstVisibleInteractiveCell, setIsPopoverOpen, sorting, switchColumnPos, setFocusedCell, index]);
86
103
  var showColumnActions = columnActions && columnActions.length > 0;
87
104
  var actionsButtonRef = useRef(null);
88
- var focusActionsButton = useCallback(function () {
105
+ var clickActionsButton = useCallback(function () {
89
106
  var _actionsButtonRef$cur;
90
- (_actionsButtonRef$cur = actionsButtonRef.current) === null || _actionsButtonRef$cur === void 0 || _actionsButtonRef$cur.focus();
107
+ (_actionsButtonRef$cur = actionsButtonRef.current) === null || _actionsButtonRef$cur === void 0 || _actionsButtonRef$cur.click();
91
108
  }, []);
92
109
  var _useState3 = useState(false),
93
110
  _useState4 = _slicedToArray(_useState3, 2),
94
111
  isActionsButtonFocused = _useState4[0],
95
112
  setIsActionsButtonFocused = _useState4[1];
113
+ var actionsButtonAriaLabel = useEuiI18n('euiDataGridHeaderCell.actionsButtonAriaLabel', '{title}. Click to view column header actions.', {
114
+ title: title
115
+ });
116
+ var actionsEnterKeyInstructions = useEuiI18n('euiDataGridHeaderCell.actionsEnterKeyInstructions', "Press the Enter key to view this column's actions");
117
+
118
+ /*
119
+ * Column sorting
120
+ */
96
121
  var _useSortingUtils = useSortingUtils({
97
122
  sorting: sorting,
98
123
  id: id,
@@ -105,13 +130,12 @@ export var EuiDataGridHeaderCell = /*#__PURE__*/memo(function (_ref2) {
105
130
  prefix: 'euiDataGridCellHeader',
106
131
  suffix: 'sorting'
107
132
  });
108
- var actionsAriaId = useGeneratedHtmlId({
109
- prefix: 'euiDataGridCellHeader',
110
- suffix: 'actions'
111
- });
133
+
134
+ /*
135
+ * Rendering
136
+ */
112
137
  var classes = classnames(_defineProperty(_defineProperty(_defineProperty({}, "euiDataGridHeaderCell--".concat(columnType), columnType), 'euiDataGridHeaderCell--hasColumnActions', showColumnActions), 'euiDataGridHeaderCell--isActionsPopoverOpen', isPopoverOpen), displayHeaderCellProps === null || displayHeaderCellProps === void 0 ? void 0 : displayHeaderCellProps.className);
113
- var title = displayAsText || id;
114
- var children = display || displayAsText || id;
138
+ var emptyHoverStyles = useEuiMemoizedStyles(_emptyHoverStyles);
115
139
  return ___EmotionJSX(EuiDataGridHeaderCellWrapper, _extends({}, displayHeaderCellProps, {
116
140
  className: classes,
117
141
  id: id,
@@ -119,75 +143,58 @@ export var EuiDataGridHeaderCell = /*#__PURE__*/memo(function (_ref2) {
119
143
  width: width,
120
144
  "aria-sort": ariaSort,
121
145
  hasActionsPopover: showColumnActions,
122
- isActionsButtonFocused: isActionsButtonFocused,
123
- focusActionsButton: focusActionsButton
124
- }), column.isResizable !== false && width != null ? ___EmotionJSX(EuiDataGridColumnResizer, {
125
- columnId: id,
126
- columnWidth: width,
127
- setColumnWidth: setColumnWidth
128
- }) : null, !showColumnActions ? ___EmotionJSX(React.Fragment, null, ___EmotionJSX(CellContent, {
129
- title: title,
130
- arrow: sortingArrow
131
- }, children), sortingScreenReaderText && ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("p", null, sortingScreenReaderText))) : ___EmotionJSX(React.Fragment, null, ___EmotionJSX("button", {
132
- className: "euiDataGridHeaderCell__button",
133
- onClick: function onClick() {
134
- return setIsPopoverOpen(function (isPopoverOpen) {
135
- return !isPopoverOpen;
136
- });
137
- },
138
- onFocus: function onFocus() {
139
- return setIsActionsButtonFocused(true);
140
- },
141
- onBlur: function onBlur() {
142
- return setIsActionsButtonFocused(false);
143
- },
144
- "aria-describedby": "".concat(sortingAriaId, " ").concat(actionsAriaId),
145
- ref: actionsButtonRef,
146
- "data-test-subj": "dataGridHeaderCellActionButton-".concat(id)
147
- }, ___EmotionJSX(CellContent, {
148
- title: title,
149
- arrow: sortingArrow
150
- }, children), ___EmotionJSX(EuiPopover, _extends({
151
- display: "block",
152
- panelPaddingSize: "none",
153
- offset: 7,
154
- anchorPosition: "downRight",
155
- css: _ref3 // Align to right
146
+ openActionsPopover: clickActionsButton,
147
+ "aria-label": displayAsText && "".concat(displayAsText, ", ") // ensure cell text content is read first, if available
156
148
  ,
157
- focusTrapProps: {
158
- // We need to override the default EuiPopover `onClickOutside` since the anchor is separate from the actual button
159
- onClickOutside: function onClickOutside(event) {
160
- var _actionsButtonRef$cur2;
161
- if (((_actionsButtonRef$cur2 = actionsButtonRef.current) === null || _actionsButtonRef$cur2 === void 0 ? void 0 : _actionsButtonRef$cur2.contains(event.target)) === false) {
162
- setIsPopoverOpen(false);
163
- }
164
- }
165
- },
166
- button: ___EmotionJSX("div", {
167
- className: "euiDataGridHeaderCell__icon"
168
- }, ___EmotionJSX(EuiIcon, {
169
- type: "boxesVertical",
170
- size: "s",
171
- color: "text"
172
- })),
173
- isOpen: isPopoverOpen,
174
- closePopover: function closePopover() {
175
- return setIsPopoverOpen(false);
176
- }
177
- }, popoverArrowNavigationProps), ___EmotionJSX(EuiListGroup, {
178
- listItems: columnActions,
179
- gutterSize: "none",
180
- "data-test-subj": "dataGridHeaderCellActionGroup-".concat(id)
181
- }))), ___EmotionJSX("p", {
182
- id: sortingAriaId,
183
- hidden: true
184
- }, sortingScreenReaderText), ___EmotionJSX("p", {
185
- id: actionsAriaId,
186
- hidden: true
187
- }, ___EmotionJSX(EuiI18n, {
188
- token: "euiDataGridHeaderCell.headerActions",
189
- default: "Click to view column header actions"
190
- }))));
149
+ "aria-describedby": sortingAriaId
150
+ }), function (hasFocusTrap) {
151
+ return ___EmotionJSX(React.Fragment, null, column.isResizable !== false && width != null ? ___EmotionJSX(EuiDataGridColumnResizer, {
152
+ columnId: id,
153
+ columnWidth: width,
154
+ setColumnWidth: setColumnWidth
155
+ }) : null, ___EmotionJSX(CellContent, {
156
+ title: title,
157
+ arrow: sortingArrow
158
+ }, children), sortingScreenReaderText && ___EmotionJSX("p", {
159
+ id: sortingAriaId,
160
+ hidden: true
161
+ }, sortingScreenReaderText), showColumnActions && ___EmotionJSX(EuiPopover, _extends({
162
+ display: "block",
163
+ panelPaddingSize: "none",
164
+ offset: 7,
165
+ anchorPosition: "downRight",
166
+ css: _ref3 // Align to right
167
+ ,
168
+ button: ___EmotionJSX("button", {
169
+ ref: actionsButtonRef,
170
+ className: "euiDataGridHeaderCell__button",
171
+ css: emptyHoverStyles.text,
172
+ onClick: togglePopover,
173
+ onFocus: function onFocus() {
174
+ return setIsActionsButtonFocused(true);
175
+ },
176
+ onBlur: function onBlur() {
177
+ return setIsActionsButtonFocused(false);
178
+ },
179
+ "aria-hidden": hasFocusTrap && !isActionsButtonFocused ? 'true' // prevent the actions button from being read on cell focus
180
+ : undefined,
181
+ "aria-label": hasFocusTrap ? actionsButtonAriaLabel : actionsEnterKeyInstructions,
182
+ "data-test-subj": "dataGridHeaderCellActionButton-".concat(id)
183
+ }, ___EmotionJSX("div", {
184
+ className: "euiDataGridHeaderCell__icon"
185
+ }, ___EmotionJSX(EuiIcon, {
186
+ type: "boxesVertical",
187
+ size: "s",
188
+ color: "text"
189
+ }))),
190
+ isOpen: isPopoverOpen,
191
+ closePopover: closePopover
192
+ }, popoverArrowNavigationProps), ___EmotionJSX(EuiListGroup, {
193
+ listItems: columnActions,
194
+ gutterSize: "none",
195
+ "data-test-subj": "dataGridHeaderCellActionGroup-".concat(id)
196
+ })));
197
+ });
191
198
  });
192
199
  EuiDataGridHeaderCell.displayName = 'EuiDataGridHeaderCell';
193
200
 
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["id", "index", "width", "className", "children", "hasActionsPopover", "isActionsButtonFocused", "focusActionsButton"];
4
+ var _excluded = ["id", "index", "width", "className", "children", "hasActionsPopover", "openActionsPopover", "aria-label"];
5
5
  /*
6
6
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
7
7
  * or more contributor license agreements. Licensed under the Elastic License
@@ -10,8 +10,9 @@ var _excluded = ["id", "index", "width", "className", "children", "hasActionsPop
10
10
  * Side Public License, v 1.
11
11
  */
12
12
 
13
- import classnames from 'classnames';
14
13
  import React, { useContext, useEffect, useState, useCallback } from 'react';
14
+ import classnames from 'classnames';
15
+ import { keys } from '../../../../services';
15
16
  import { DataGridFocusContext } from '../../utils/focus';
16
17
  import { HandleInteractiveChildren } from '../cell/focus_utils';
17
18
 
@@ -28,8 +29,8 @@ export var EuiDataGridHeaderCellWrapper = function EuiDataGridHeaderCellWrapper(
28
29
  className = _ref.className,
29
30
  children = _ref.children,
30
31
  hasActionsPopover = _ref.hasActionsPopover,
31
- isActionsButtonFocused = _ref.isActionsButtonFocused,
32
- focusActionsButton = _ref.focusActionsButton,
32
+ openActionsPopover = _ref.openActionsPopover,
33
+ ariaLabel = _ref['aria-label'],
33
34
  rest = _objectWithoutProperties(_ref, _excluded);
34
35
  var classes = classnames('euiDataGridHeaderCell', className);
35
36
 
@@ -38,16 +39,28 @@ export var EuiDataGridHeaderCellWrapper = function EuiDataGridHeaderCellWrapper(
38
39
  _useState2 = _slicedToArray(_useState, 2),
39
40
  headerEl = _useState2[0],
40
41
  setHeaderEl = _useState2[1];
42
+ var _useState3 = useState(false),
43
+ _useState4 = _slicedToArray(_useState3, 2),
44
+ renderFocusTrap = _useState4[0],
45
+ setRenderFocusTrap = _useState4[1];
46
+ var _useState5 = useState([]),
47
+ _useState6 = _slicedToArray(_useState5, 2),
48
+ interactiveChildren = _useState6[0],
49
+ setInteractiveChildren = _useState6[1];
50
+ useEffect(function () {
51
+ // We're checking for interactive children outside of the default actions button
52
+ setRenderFocusTrap(interactiveChildren.length > (hasActionsPopover ? 1 : 0));
53
+ }, [hasActionsPopover, interactiveChildren]);
41
54
  var _useContext = useContext(DataGridFocusContext),
42
55
  setFocusedCell = _useContext.setFocusedCell,
43
56
  onFocusUpdate = _useContext.onFocusUpdate;
44
57
  var updateCellFocusContext = useCallback(function () {
45
58
  setFocusedCell([index, -1]);
46
59
  }, [index, setFocusedCell]);
47
- var _useState3 = useState(false),
48
- _useState4 = _slicedToArray(_useState3, 2),
49
- isFocused = _useState4[0],
50
- setIsFocused = _useState4[1];
60
+ var _useState7 = useState(false),
61
+ _useState8 = _slicedToArray(_useState7, 2),
62
+ isFocused = _useState8[0],
63
+ setIsFocused = _useState8[1];
51
64
  useEffect(function () {
52
65
  onFocusUpdate([index, -1], function (isFocused) {
53
66
  setIsFocused(isFocused);
@@ -60,18 +73,17 @@ export var EuiDataGridHeaderCellWrapper = function EuiDataGridHeaderCellWrapper(
60
73
  });
61
74
  }, [index, onFocusUpdate, headerEl]);
62
75
 
63
- // For cell headers with actions, auto-focus into the button instead of the cell wrapper div
64
- // The button text is significantly more useful to screen readers (e.g. contains sort order & hints)
65
- var onFocus = useCallback(function (e) {
66
- if (hasActionsPopover && e.target === headerEl) {
67
- focusActionsButton === null || focusActionsButton === void 0 || focusActionsButton();
76
+ // For cell headers with only actions, auto-open the actions popover on enter keypress
77
+ var onKeyDown = useCallback(function (e) {
78
+ if (e.key === keys.ENTER && hasActionsPopover && !renderFocusTrap && e.target === headerEl) {
79
+ openActionsPopover === null || openActionsPopover === void 0 || openActionsPopover();
68
80
  }
69
- }, [hasActionsPopover, focusActionsButton, headerEl]);
81
+ }, [hasActionsPopover, openActionsPopover, renderFocusTrap, headerEl]);
70
82
  return ___EmotionJSX("div", _extends({
71
83
  role: "columnheader",
72
84
  ref: setHeaderEl,
73
- tabIndex: isFocused && !isActionsButtonFocused ? 0 : -1,
74
- onFocus: onFocus,
85
+ tabIndex: isFocused ? 0 : -1,
86
+ onKeyDown: onKeyDown,
75
87
  className: classes,
76
88
  "data-test-subj": "dataGridHeaderCell-".concat(id),
77
89
  "data-gridcell-column-id": id,
@@ -80,10 +92,12 @@ export var EuiDataGridHeaderCellWrapper = function EuiDataGridHeaderCellWrapper(
80
92
  "data-gridcell-visible-row-index": "-1",
81
93
  style: width != null ? {
82
94
  width: "".concat(width, "px")
83
- } : {}
95
+ } : {},
96
+ "aria-label": renderFocusTrap ? ariaLabel : undefined
84
97
  }, rest), ___EmotionJSX(HandleInteractiveChildren, {
85
98
  cellEl: headerEl,
86
99
  updateCellFocusContext: updateCellFocusContext,
87
- renderFocusTrap: !hasActionsPopover
88
- }, children));
100
+ renderFocusTrap: renderFocusTrap,
101
+ onInteractiveChildrenFound: setInteractiveChildren
102
+ }, typeof children === 'function' ? children(renderFocusTrap) : children));
89
103
  };
@@ -204,6 +204,7 @@ describe('EuiDataGrid', function () {
204
204
  cy.checkAxe();
205
205
  });
206
206
  it('has zero violations when the column actions menu is open', function () {
207
+ cy.get('.euiDataGridHeaderCell').first().realHover();
207
208
  cy.get('button.euiDataGridHeaderCell__button').first().realClick();
208
209
  cy.checkAxe();
209
210
  });
@@ -213,6 +214,7 @@ describe('EuiDataGrid', function () {
213
214
  cy.checkAxe();
214
215
  });
215
216
  it('has zero violations on sort and when the columns sorting menu is open', function () {
217
+ cy.get('.euiDataGridHeaderCell').last().realHover();
216
218
  cy.get('button.euiDataGridHeaderCell__button').last().realClick();
217
219
  cy.get('button.euiListGroupItem__button').contains('Sort Alma to Debian').should('exist').realClick();
218
220
  cy.get('div[data-test-subj="dataGridColumnSortingPopover"] button').realClick();
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
- var _excluded = ["adjustDateOnChange", "calendarClassName", "className", "compressed", "controlOnly", "customInput", "dateFormat", "dayClassName", "disabled", "excludeDates", "filterDate", "fullWidth", "iconType", "injectTimes", "inline", "inputRef", "isInvalid", "isLoading", "locale", "maxDate", "maxTime", "minDate", "minTime", "onChange", "onClear", "openToDate", "placeholder", "popperClassName", "popoverPlacement", "readOnly", "selected", "shadow", "shouldCloseOnSelect", "showIcon", "showTimeSelect", "showTimeSelectOnly", "timeFormat", "utcOffset"];
5
+ var _excluded = ["adjustDateOnChange", "append", "calendarClassName", "className", "compressed", "controlOnly", "customInput", "dateFormat", "dayClassName", "disabled", "excludeDates", "filterDate", "fullWidth", "iconType", "injectTimes", "inline", "inputRef", "isInvalid", "isLoading", "locale", "maxDate", "maxTime", "minDate", "minTime", "onChange", "onClear", "openToDate", "placeholder", "popperClassName", "popoverPlacement", "prepend", "readOnly", "selected", "shadow", "shouldCloseOnSelect", "showIcon", "showTimeSelect", "showTimeSelectOnly", "timeFormat", "utcOffset"];
6
6
  /*
7
7
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
8
8
  * or more contributor license agreements. Licensed under the Elastic License
@@ -54,6 +54,7 @@ var unsupportedProps = [
54
54
  export var EuiDatePicker = function EuiDatePicker(_ref) {
55
55
  var _ref$adjustDateOnChan = _ref.adjustDateOnChange,
56
56
  adjustDateOnChange = _ref$adjustDateOnChan === void 0 ? true : _ref$adjustDateOnChan,
57
+ append = _ref.append,
57
58
  calendarClassName = _ref.calendarClassName,
58
59
  className = _ref.className,
59
60
  compressed = _ref.compressed,
@@ -85,6 +86,7 @@ export var EuiDatePicker = function EuiDatePicker(_ref) {
85
86
  popperClassName = _ref.popperClassName,
86
87
  _ref$popoverPlacement = _ref.popoverPlacement,
87
88
  popoverPlacement = _ref$popoverPlacement === void 0 ? 'downLeft' : _ref$popoverPlacement,
89
+ prepend = _ref.prepend,
88
90
  readOnly = _ref.readOnly,
89
91
  selected = _ref.selected,
90
92
  _ref$shadow = _ref.shadow,
@@ -186,19 +188,23 @@ export var EuiDatePicker = function EuiDatePicker(_ref) {
186
188
  return ___EmotionJSX("span", {
187
189
  css: cssStyles,
188
190
  className: classes
189
- }, ___EmotionJSX(EuiFormControlLayout, {
191
+ }, ___EmotionJSX(EuiFormControlLayout, _extends({
190
192
  icon: optionalIcon,
191
- fullWidth: !inline && fullWidth,
192
- compressed: !inline && compressed,
193
193
  clear: selected && onClear ? {
194
194
  onClick: onClear
195
195
  } : undefined,
196
196
  isLoading: isLoading,
197
197
  isInvalid: isInvalid,
198
198
  isDisabled: disabled,
199
- readOnly: readOnly,
200
- isDelimited: inline // Styling shortcut for inline calendars
201
- ,
202
- iconsPosition: inline ? 'static' : undefined
203
- }, control));
199
+ readOnly: readOnly
200
+ }, inline ? {
201
+ isDelimited: true,
202
+ iconsPosition: 'static'
203
+ } : {
204
+ fullWidth: fullWidth,
205
+ compressed: compressed,
206
+ append: append,
207
+ prepend: prepend,
208
+ css: (append || prepend) && styles.inGroup
209
+ }), control));
204
210
  };
@@ -24,7 +24,7 @@ export var euiDatePickerStyles = function euiDatePickerStyles(euiThemeContext) {
24
24
  return {
25
25
  euiDatePicker: _ref,
26
26
  inline: {
27
- inline: /*#__PURE__*/css(".euiFormControlLayout{", logicalCSS('height', 'auto'), " ", logicalCSS('width', 'fit-content'), " box-shadow:none;padding:0;}.euiFormControlLayout__childrenWrapper{flex-direction:column;}.euiFormControlLayoutIcons{justify-content:center;", logicalCSS('padding-bottom', euiTheme.size.s), ";};label:inline;"),
27
+ inline: /*#__PURE__*/css(".euiFormControlLayout{", logicalCSS('height', 'auto'), " ", logicalCSS('width', 'fit-content'), " border:none;padding:0;}.euiFormControlLayout__childrenWrapper{flex-direction:column;}.euiFormControlLayoutIcons{justify-content:center;", logicalCSS('padding-bottom', euiTheme.size.s), ";};label:inline;"),
28
28
  // Skip css`` to avoid generating an Emotion className
29
29
  noShadow: "\n .euiFormControlLayout {\n background-color: transparent;\n }\n ",
30
30
  shadow: /*#__PURE__*/css(".euiFormControlLayout{background-color:", euiTheme.colors.emptyShade, ";", euiShadowMedium(euiThemeContext), ";};label:shadow;"),
@@ -35,6 +35,7 @@ export var euiDatePickerStyles = function euiDatePickerStyles(euiThemeContext) {
35
35
  // Should come after shadow CSS to override their background-colors
36
36
  disabled: /*#__PURE__*/css(".euiFormControlLayout{", euiFormControlDisabledStyles(euiThemeContext), ";};label:disabled;"),
37
37
  readOnly: /*#__PURE__*/css(".euiFormControlLayout{", euiFormControlReadOnlyStyles(euiThemeContext), ";};label:readOnly;")
38
- }
38
+ },
39
+ inGroup: /*#__PURE__*/css(".euiFormControlLayout__childrenWrapper{.euiPopover,.react-datepicker__input-container{", logicalCSS('height', '100%'), ";}};label:inGroup;")
39
40
  };
40
41
  };
@@ -32,7 +32,7 @@ export var euiDatePickerRangeInlineStyles = function euiDatePickerRangeInlineSty
32
32
  return "\n display: block;\n container-type: inline-size;\n\n .euiFormControlLayout__childrenWrapper {\n /* Use static px widths for now, since render behavior comes from a third party library */\n @container (max-width: ".concat(datePickerWidth * 2 + delimiterWidth, "px) {\n /* Unset grid display */\n display: block !important;\n\n /* Center and point the default delimiter arrow downwards */\n .euiFormControlLayoutDelimited__delimiter .euiIcon {\n transform: rotate(90deg);\n margin-inline: auto;\n }\n }\n }");
33
33
  };
34
34
  return {
35
- euiDatePickerRangeInline: /*#__PURE__*/css(".euiFormControlLayoutDelimited{", logicalCSS('height', 'auto'), " ", logicalCSS('width', 'fit-content'), " ", logicalCSS('max-width', '100%'), " box-shadow:none;padding:0;.euiFormControlLayout__childrenWrapper{display:grid;grid-template-columns:1fr auto 1fr;grid-template-rows:auto;align-items:stretch;background-color:transparent;}.euiFormControlLayoutIcons{justify-content:center;grid-column:1/span 3;", logicalCSS('height', 'auto'), " ", logicalCSS('padding-bottom', euiTheme.size.s), ";}}.react-datepicker{position:relative;};label:euiDatePickerRangeInline;"),
35
+ euiDatePickerRangeInline: /*#__PURE__*/css(".euiFormControlLayoutDelimited{", logicalCSS('height', 'auto'), " ", logicalCSS('width', 'fit-content'), " ", logicalCSS('max-width', '100%'), " border:none;padding:0;.euiFormControlLayout__childrenWrapper{display:grid;grid-template-columns:1fr auto 1fr;grid-template-rows:auto;align-items:stretch;background-color:transparent;}.euiFormControlLayoutIcons{justify-content:center;grid-column:1/span 3;", logicalCSS('height', 'auto'), " ", logicalCSS('padding-bottom', euiTheme.size.s), ";}}.react-datepicker{position:relative;};label:euiDatePickerRangeInline;"),
36
36
  responsive: /*#__PURE__*/css(containerQuery(268), ";;label:responsive;"),
37
37
  responsiveWithTimeSelect: /*#__PURE__*/css(containerQuery(374), ";;label:responsiveWithTimeSelect;"),
38
38
  shadow: /*#__PURE__*/css(".euiFormControlLayoutDelimited{", euiShadowMedium(euiThemeContext), ";};label:shadow;"),
@@ -40,6 +40,6 @@ export var euiSuperSelectControlStyles = function euiSuperSelectControlStyles(eu
40
40
  // Layout modifiers
41
41
  inGroup: /*#__PURE__*/css(formStyles.inGroup, ";label:inGroup;"),
42
42
  // Children
43
- euiSuperSelect__placeholder: /*#__PURE__*/css("color:", formVariables.controlDisabledColor, ";;label:euiSuperSelect__placeholder;")
43
+ euiSuperSelect__placeholder: /*#__PURE__*/css("color:", formVariables.controlPlaceholderText, ";;label:euiSuperSelect__placeholder;")
44
44
  };
45
45
  };
@@ -1,4 +1,6 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["exclude"];
2
4
  /*
3
5
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
4
6
  * or more contributor license agreements. Licensed under the Elastic License
@@ -18,29 +20,33 @@ import breaks from 'remark-breaks';
18
20
  import highlight from '../remark/remark_prismjs';
19
21
  import * as MarkdownTooltip from '../markdown_tooltip';
20
22
  import * as MarkdownCheckbox from '../markdown_checkbox';
21
- import { euiMarkdownLinkValidator } from '../markdown_link_validator';
23
+ import { euiMarkdownLinkValidator, DEFAULT_OPTIONS as LINK_VALIDATOR_DEFAULTS } from '../markdown_link_validator';
22
24
  var DEFAULT_PARSING_PLUGINS = {
23
25
  emoji: [emoji, {
24
26
  emoticon: false
25
27
  }],
26
28
  lineBreaks: [breaks, {}],
27
- linkValidator: [euiMarkdownLinkValidator, {
28
- allowRelative: true,
29
- allowProtocols: ['https:', 'http:', 'mailto:']
30
- }],
29
+ linkValidator: [euiMarkdownLinkValidator, LINK_VALIDATOR_DEFAULTS],
31
30
  checkbox: [MarkdownCheckbox.parser, {}],
32
31
  tooltip: [MarkdownTooltip.parser, {}]
33
32
  };
34
33
  export var getDefaultEuiMarkdownParsingPlugins = function getDefaultEuiMarkdownParsingPlugins() {
35
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
36
- exclude = _ref.exclude;
34
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
35
+ var exclude = _ref.exclude,
36
+ parsingConfig = _objectWithoutProperties(_ref, _excluded);
37
37
  var parsingPlugins = [[markdown, {}], [highlight, {}]];
38
38
  Object.entries(DEFAULT_PARSING_PLUGINS).forEach(function (_ref2) {
39
39
  var _ref3 = _slicedToArray(_ref2, 2),
40
40
  pluginName = _ref3[0],
41
41
  plugin = _ref3[1];
42
+ // Check for plugin exclusions
42
43
  if (!(exclude !== null && exclude !== void 0 && exclude.includes(pluginName))) {
43
- parsingPlugins.push(plugin);
44
+ // Check for plugin configuration overrides
45
+ if (pluginName in parsingConfig) {
46
+ parsingPlugins.push([plugin[0], parsingConfig[pluginName]]);
47
+ } else {
48
+ parsingPlugins.push(plugin);
49
+ }
44
50
  }
45
51
  });
46
52
  return parsingPlugins;
@@ -1,3 +1,6 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1
4
  /*
2
5
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
6
  * or more contributor license agreements. Licensed under the Elastic License
@@ -9,10 +12,21 @@
9
12
  import { getDefaultEuiMarkdownUiPlugins } from './ui_plugins';
10
13
  import { getDefaultEuiMarkdownParsingPlugins } from './parsing_plugins';
11
14
  import { getDefaultEuiMarkdownProcessingPlugins } from './processing_plugins';
12
- export var getDefaultEuiMarkdownPlugins = function getDefaultEuiMarkdownPlugins(config) {
15
+ export var getDefaultEuiMarkdownPlugins = function getDefaultEuiMarkdownPlugins() {
16
+ var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
17
+ var exclude = config.exclude,
18
+ processingConfig = config.processingConfig,
19
+ parsingConfig = config.parsingConfig,
20
+ uiConfig = config.uiConfig;
13
21
  return {
14
- parsingPlugins: getDefaultEuiMarkdownParsingPlugins(config),
15
- processingPlugins: getDefaultEuiMarkdownProcessingPlugins(config),
16
- uiPlugins: getDefaultEuiMarkdownUiPlugins(config)
22
+ parsingPlugins: getDefaultEuiMarkdownParsingPlugins(_objectSpread({
23
+ exclude: exclude
24
+ }, parsingConfig)),
25
+ processingPlugins: getDefaultEuiMarkdownProcessingPlugins(_objectSpread({
26
+ exclude: exclude
27
+ }, processingConfig)),
28
+ uiPlugins: getDefaultEuiMarkdownUiPlugins(_objectSpread({
29
+ exclude: exclude
30
+ }, uiConfig))
17
31
  };
18
32
  };
@@ -36,7 +36,8 @@ var DEFAULT_COMPONENT_RENDERERS = {
36
36
  };
37
37
  export var getDefaultEuiMarkdownProcessingPlugins = function getDefaultEuiMarkdownProcessingPlugins() {
38
38
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
39
- exclude = _ref.exclude;
39
+ exclude = _ref.exclude,
40
+ linkProps = _ref.linkProps;
40
41
  var componentPluginsWithExclusions = {};
41
42
  Object.entries(DEFAULT_COMPONENT_RENDERERS).forEach(function (_ref2) {
42
43
  var _ref3 = _slicedToArray(_ref2, 2),
@@ -55,7 +56,9 @@ export var getDefaultEuiMarkdownProcessingPlugins = function getDefaultEuiMarkdo
55
56
  createElement: createElement,
56
57
  Fragment: Fragment,
57
58
  components: _objectSpread({
58
- a: EuiLink,
59
+ a: function a(props) {
60
+ return ___EmotionJSX(EuiLink, _extends({}, props, linkProps));
61
+ },
59
62
  code: function code(props) {
60
63
  return (
61
64
  // If there are linebreaks use codeblock, otherwise code
@@ -7,6 +7,10 @@
7
7
  */
8
8
 
9
9
  import visit from 'unist-util-visit';
10
+ export var DEFAULT_OPTIONS = {
11
+ allowRelative: true,
12
+ allowProtocols: ['https:', 'http:', 'mailto:']
13
+ };
10
14
  export function euiMarkdownLinkValidator(options) {
11
15
  return function (ast) {
12
16
  visit(ast, 'link', function (_node) {
@@ -37,8 +41,10 @@ export function mutateLinkToText(node) {
37
41
  return node;
38
42
  }
39
43
  export function validateUrl(url, _ref) {
40
- var allowRelative = _ref.allowRelative,
41
- allowProtocols = _ref.allowProtocols;
44
+ var _ref$allowRelative = _ref.allowRelative,
45
+ allowRelative = _ref$allowRelative === void 0 ? DEFAULT_OPTIONS.allowRelative : _ref$allowRelative,
46
+ _ref$allowProtocols = _ref.allowProtocols,
47
+ allowProtocols = _ref$allowProtocols === void 0 ? DEFAULT_OPTIONS.allowProtocols : _ref$allowProtocols;
42
48
  // relative captures both relative paths `/` and protocols `//`
43
49
  var isRelative = url.startsWith('/');
44
50
  if (isRelative) {