@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,5 +1,5 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
+ var _excluded = ["children", "title", "arrow"];
3
3
  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)."; }
4
4
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
5
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
@@ -10,6 +10,9 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
10
10
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
11
11
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
12
12
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
13
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
14
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
15
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
13
16
  /*
14
17
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
15
18
  * or more contributor license agreements. Licensed under the Elastic License
@@ -22,13 +25,13 @@ import classnames from 'classnames';
22
25
  import PropTypes from "prop-types";
23
26
  import React, { useContext, useState, useRef, useCallback, useMemo, memo } from 'react';
24
27
  import { tabbable } from 'tabbable';
25
- import { keys } from '../../../../services';
28
+ import { keys, useEuiMemoizedStyles } from '../../../../services';
26
29
  import { useGeneratedHtmlId } from '../../../../services/accessibility';
27
- import { EuiScreenReaderOnly } from '../../../accessibility';
28
- import { EuiI18n } from '../../../i18n';
30
+ import { EuiI18n, useEuiI18n } from '../../../i18n';
29
31
  import { EuiIcon } from '../../../icon';
30
32
  import { EuiListGroup } from '../../../list_group';
31
33
  import { EuiPopover } from '../../../popover';
34
+ import { _emptyHoverStyles } from '../../../button/button_icon/button_icon.styles';
32
35
  import { DataGridFocusContext } from '../../utils/focus';
33
36
  import { getColumnActions } from './column_actions';
34
37
  import { EuiDataGridColumnResizer } from './data_grid_column_resizer';
@@ -37,11 +40,12 @@ import { jsx as ___EmotionJSX } from "@emotion/react";
37
40
  var CellContent = function CellContent(_ref) {
38
41
  var children = _ref.children,
39
42
  title = _ref.title,
40
- arrow = _ref.arrow;
41
- return ___EmotionJSX(React.Fragment, null, ___EmotionJSX("div", {
43
+ arrow = _ref.arrow,
44
+ rest = _objectWithoutProperties(_ref, _excluded);
45
+ return ___EmotionJSX(React.Fragment, null, ___EmotionJSX("div", _extends({}, rest, {
42
46
  title: title,
43
47
  className: "euiDataGridHeaderCell__content"
44
- }, children), arrow);
48
+ }), children), arrow);
45
49
  };
46
50
  CellContent.propTypes = {
47
51
  title: PropTypes.string.isRequired,
@@ -71,15 +75,29 @@ export var EuiDataGridHeaderCell = /*#__PURE__*/memo(function (_ref2) {
71
75
  display = column.display,
72
76
  displayAsText = column.displayAsText,
73
77
  displayHeaderCellProps = column.displayHeaderCellProps;
78
+ var title = displayAsText || id;
79
+ var children = display || displayAsText || id;
74
80
  var width = columnWidths[id] || defaultColumnWidth;
75
81
  var columnType = schema[id] ? schema[id].columnType : null;
76
82
  var _useContext = useContext(DataGridFocusContext),
77
83
  setFocusedCell = _useContext.setFocusedCell,
78
84
  focusFirstVisibleInteractiveCell = _useContext.focusFirstVisibleInteractiveCell;
85
+
86
+ /*
87
+ * Column actions
88
+ */
79
89
  var _useState = useState(false),
80
90
  _useState2 = _slicedToArray(_useState, 2),
81
91
  isPopoverOpen = _useState2[0],
82
92
  setIsPopoverOpen = _useState2[1];
93
+ var togglePopover = useCallback(function () {
94
+ setIsPopoverOpen(function (isOpen) {
95
+ return !isOpen;
96
+ });
97
+ }, []);
98
+ var closePopover = useCallback(function () {
99
+ return setIsPopoverOpen(false);
100
+ }, []);
83
101
  var popoverArrowNavigationProps = usePopoverArrowNavigation();
84
102
  var columnActions = useMemo(function () {
85
103
  return getColumnActions({
@@ -98,14 +116,22 @@ export var EuiDataGridHeaderCell = /*#__PURE__*/memo(function (_ref2) {
98
116
  }, [column, columns, schema, schemaDetectors, setVisibleColumns, focusFirstVisibleInteractiveCell, setIsPopoverOpen, sorting, switchColumnPos, setFocusedCell, index]);
99
117
  var showColumnActions = columnActions && columnActions.length > 0;
100
118
  var actionsButtonRef = useRef(null);
101
- var focusActionsButton = useCallback(function () {
119
+ var clickActionsButton = useCallback(function () {
102
120
  var _actionsButtonRef$cur;
103
- (_actionsButtonRef$cur = actionsButtonRef.current) === null || _actionsButtonRef$cur === void 0 || _actionsButtonRef$cur.focus();
121
+ (_actionsButtonRef$cur = actionsButtonRef.current) === null || _actionsButtonRef$cur === void 0 || _actionsButtonRef$cur.click();
104
122
  }, []);
105
123
  var _useState3 = useState(false),
106
124
  _useState4 = _slicedToArray(_useState3, 2),
107
125
  isActionsButtonFocused = _useState4[0],
108
126
  setIsActionsButtonFocused = _useState4[1];
127
+ var actionsButtonAriaLabel = useEuiI18n('euiDataGridHeaderCell.actionsButtonAriaLabel', '{title}. Click to view column header actions.', {
128
+ title: title
129
+ });
130
+ var actionsEnterKeyInstructions = useEuiI18n('euiDataGridHeaderCell.actionsEnterKeyInstructions', "Press the Enter key to view this column's actions");
131
+
132
+ /*
133
+ * Column sorting
134
+ */
109
135
  var _useSortingUtils = useSortingUtils({
110
136
  sorting: sorting,
111
137
  id: id,
@@ -118,13 +144,12 @@ export var EuiDataGridHeaderCell = /*#__PURE__*/memo(function (_ref2) {
118
144
  prefix: 'euiDataGridCellHeader',
119
145
  suffix: 'sorting'
120
146
  });
121
- var actionsAriaId = useGeneratedHtmlId({
122
- prefix: 'euiDataGridCellHeader',
123
- suffix: 'actions'
124
- });
147
+
148
+ /*
149
+ * Rendering
150
+ */
125
151
  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);
126
- var title = displayAsText || id;
127
- var children = display || displayAsText || id;
152
+ var emptyHoverStyles = useEuiMemoizedStyles(_emptyHoverStyles);
128
153
  return ___EmotionJSX(EuiDataGridHeaderCellWrapper, _extends({}, displayHeaderCellProps, {
129
154
  className: classes,
130
155
  id: id,
@@ -132,75 +157,58 @@ export var EuiDataGridHeaderCell = /*#__PURE__*/memo(function (_ref2) {
132
157
  width: width,
133
158
  "aria-sort": ariaSort,
134
159
  hasActionsPopover: showColumnActions,
135
- isActionsButtonFocused: isActionsButtonFocused,
136
- focusActionsButton: focusActionsButton
137
- }), column.isResizable !== false && width != null ? ___EmotionJSX(EuiDataGridColumnResizer, {
138
- columnId: id,
139
- columnWidth: width,
140
- setColumnWidth: setColumnWidth
141
- }) : null, !showColumnActions ? ___EmotionJSX(React.Fragment, null, ___EmotionJSX(CellContent, {
142
- title: title,
143
- arrow: sortingArrow
144
- }, children), sortingScreenReaderText && ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("p", null, sortingScreenReaderText))) : ___EmotionJSX(React.Fragment, null, ___EmotionJSX("button", {
145
- className: "euiDataGridHeaderCell__button",
146
- onClick: function onClick() {
147
- return setIsPopoverOpen(function (isPopoverOpen) {
148
- return !isPopoverOpen;
149
- });
150
- },
151
- onFocus: function onFocus() {
152
- return setIsActionsButtonFocused(true);
153
- },
154
- onBlur: function onBlur() {
155
- return setIsActionsButtonFocused(false);
156
- },
157
- "aria-describedby": "".concat(sortingAriaId, " ").concat(actionsAriaId),
158
- ref: actionsButtonRef,
159
- "data-test-subj": "dataGridHeaderCellActionButton-".concat(id)
160
- }, ___EmotionJSX(CellContent, {
161
- title: title,
162
- arrow: sortingArrow
163
- }, children), ___EmotionJSX(EuiPopover, _extends({
164
- display: "block",
165
- panelPaddingSize: "none",
166
- offset: 7,
167
- anchorPosition: "downRight",
168
- css: _ref3 // Align to right
160
+ openActionsPopover: clickActionsButton,
161
+ "aria-label": displayAsText && "".concat(displayAsText, ", ") // ensure cell text content is read first, if available
169
162
  ,
170
- focusTrapProps: {
171
- // We need to override the default EuiPopover `onClickOutside` since the anchor is separate from the actual button
172
- onClickOutside: function onClickOutside(event) {
173
- var _actionsButtonRef$cur2;
174
- if (((_actionsButtonRef$cur2 = actionsButtonRef.current) === null || _actionsButtonRef$cur2 === void 0 ? void 0 : _actionsButtonRef$cur2.contains(event.target)) === false) {
175
- setIsPopoverOpen(false);
176
- }
177
- }
178
- },
179
- button: ___EmotionJSX("div", {
180
- className: "euiDataGridHeaderCell__icon"
181
- }, ___EmotionJSX(EuiIcon, {
182
- type: "boxesVertical",
183
- size: "s",
184
- color: "text"
185
- })),
186
- isOpen: isPopoverOpen,
187
- closePopover: function closePopover() {
188
- return setIsPopoverOpen(false);
189
- }
190
- }, popoverArrowNavigationProps), ___EmotionJSX(EuiListGroup, {
191
- listItems: columnActions,
192
- gutterSize: "none",
193
- "data-test-subj": "dataGridHeaderCellActionGroup-".concat(id)
194
- }))), ___EmotionJSX("p", {
195
- id: sortingAriaId,
196
- hidden: true
197
- }, sortingScreenReaderText), ___EmotionJSX("p", {
198
- id: actionsAriaId,
199
- hidden: true
200
- }, ___EmotionJSX(EuiI18n, {
201
- token: "euiDataGridHeaderCell.headerActions",
202
- default: "Click to view column header actions"
203
- }))));
163
+ "aria-describedby": sortingAriaId
164
+ }), function (hasFocusTrap) {
165
+ return ___EmotionJSX(React.Fragment, null, column.isResizable !== false && width != null ? ___EmotionJSX(EuiDataGridColumnResizer, {
166
+ columnId: id,
167
+ columnWidth: width,
168
+ setColumnWidth: setColumnWidth
169
+ }) : null, ___EmotionJSX(CellContent, {
170
+ title: title,
171
+ arrow: sortingArrow
172
+ }, children), sortingScreenReaderText && ___EmotionJSX("p", {
173
+ id: sortingAriaId,
174
+ hidden: true
175
+ }, sortingScreenReaderText), showColumnActions && ___EmotionJSX(EuiPopover, _extends({
176
+ display: "block",
177
+ panelPaddingSize: "none",
178
+ offset: 7,
179
+ anchorPosition: "downRight",
180
+ css: _ref3 // Align to right
181
+ ,
182
+ button: ___EmotionJSX("button", {
183
+ ref: actionsButtonRef,
184
+ className: "euiDataGridHeaderCell__button",
185
+ css: emptyHoverStyles.text,
186
+ onClick: togglePopover,
187
+ onFocus: function onFocus() {
188
+ return setIsActionsButtonFocused(true);
189
+ },
190
+ onBlur: function onBlur() {
191
+ return setIsActionsButtonFocused(false);
192
+ },
193
+ "aria-hidden": hasFocusTrap && !isActionsButtonFocused ? 'true' // prevent the actions button from being read on cell focus
194
+ : undefined,
195
+ "aria-label": hasFocusTrap ? actionsButtonAriaLabel : actionsEnterKeyInstructions,
196
+ "data-test-subj": "dataGridHeaderCellActionButton-".concat(id)
197
+ }, ___EmotionJSX("div", {
198
+ className: "euiDataGridHeaderCell__icon"
199
+ }, ___EmotionJSX(EuiIcon, {
200
+ type: "boxesVertical",
201
+ size: "s",
202
+ color: "text"
203
+ }))),
204
+ isOpen: isPopoverOpen,
205
+ closePopover: closePopover
206
+ }, popoverArrowNavigationProps), ___EmotionJSX(EuiListGroup, {
207
+ listItems: columnActions,
208
+ gutterSize: "none",
209
+ "data-test-subj": "dataGridHeaderCellActionGroup-".concat(id)
210
+ })));
211
+ });
204
212
  });
205
213
  EuiDataGridHeaderCell.propTypes = {
206
214
  column: PropTypes.shape({
@@ -217,6 +225,7 @@ EuiDataGridHeaderCell.propTypes = {
217
225
  * This can be used to display a readable column name in column hiding/sorting, where `display` won't be used.
218
226
  * This will also be used as a `title` attribute that will display on mouseover (useful if the display text is being truncated by the column width).
219
227
  * If not passed, `id` will be shown as the column name.
228
+ * Passing this together with `display` is useful to ensure an accessible label is added to the column.
220
229
  */
221
230
  displayAsText: PropTypes.string,
222
231
  /**
@@ -1,4 +1,4 @@
1
- var _excluded = ["id", "index", "width", "className", "children", "hasActionsPopover", "isActionsButtonFocused", "focusActionsButton"];
1
+ var _excluded = ["id", "index", "width", "className", "children", "hasActionsPopover", "openActionsPopover", "aria-label"];
2
2
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
3
  function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
4
4
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -16,9 +16,10 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
16
16
  * Side Public License, v 1.
17
17
  */
18
18
 
19
- import classnames from 'classnames';
20
- import PropTypes from "prop-types";
21
19
  import React, { useContext, useEffect, useState, useCallback } from 'react';
20
+ import PropTypes from "prop-types";
21
+ import classnames from 'classnames';
22
+ import { keys } from '../../../../services';
22
23
  import { DataGridFocusContext } from '../../utils/focus';
23
24
  import { HandleInteractiveChildren } from '../cell/focus_utils';
24
25
 
@@ -35,8 +36,8 @@ export var EuiDataGridHeaderCellWrapper = function EuiDataGridHeaderCellWrapper(
35
36
  className = _ref.className,
36
37
  children = _ref.children,
37
38
  hasActionsPopover = _ref.hasActionsPopover,
38
- isActionsButtonFocused = _ref.isActionsButtonFocused,
39
- focusActionsButton = _ref.focusActionsButton,
39
+ openActionsPopover = _ref.openActionsPopover,
40
+ ariaLabel = _ref['aria-label'],
40
41
  rest = _objectWithoutProperties(_ref, _excluded);
41
42
  var classes = classnames('euiDataGridHeaderCell', className);
42
43
 
@@ -45,16 +46,28 @@ export var EuiDataGridHeaderCellWrapper = function EuiDataGridHeaderCellWrapper(
45
46
  _useState2 = _slicedToArray(_useState, 2),
46
47
  headerEl = _useState2[0],
47
48
  setHeaderEl = _useState2[1];
49
+ var _useState3 = useState(false),
50
+ _useState4 = _slicedToArray(_useState3, 2),
51
+ renderFocusTrap = _useState4[0],
52
+ setRenderFocusTrap = _useState4[1];
53
+ var _useState5 = useState([]),
54
+ _useState6 = _slicedToArray(_useState5, 2),
55
+ interactiveChildren = _useState6[0],
56
+ setInteractiveChildren = _useState6[1];
57
+ useEffect(function () {
58
+ // We're checking for interactive children outside of the default actions button
59
+ setRenderFocusTrap(interactiveChildren.length > (hasActionsPopover ? 1 : 0));
60
+ }, [hasActionsPopover, interactiveChildren]);
48
61
  var _useContext = useContext(DataGridFocusContext),
49
62
  setFocusedCell = _useContext.setFocusedCell,
50
63
  onFocusUpdate = _useContext.onFocusUpdate;
51
64
  var updateCellFocusContext = useCallback(function () {
52
65
  setFocusedCell([index, -1]);
53
66
  }, [index, setFocusedCell]);
54
- var _useState3 = useState(false),
55
- _useState4 = _slicedToArray(_useState3, 2),
56
- isFocused = _useState4[0],
57
- setIsFocused = _useState4[1];
67
+ var _useState7 = useState(false),
68
+ _useState8 = _slicedToArray(_useState7, 2),
69
+ isFocused = _useState8[0],
70
+ setIsFocused = _useState8[1];
58
71
  useEffect(function () {
59
72
  onFocusUpdate([index, -1], function (isFocused) {
60
73
  setIsFocused(isFocused);
@@ -67,18 +80,17 @@ export var EuiDataGridHeaderCellWrapper = function EuiDataGridHeaderCellWrapper(
67
80
  });
68
81
  }, [index, onFocusUpdate, headerEl]);
69
82
 
70
- // For cell headers with actions, auto-focus into the button instead of the cell wrapper div
71
- // The button text is significantly more useful to screen readers (e.g. contains sort order & hints)
72
- var onFocus = useCallback(function (e) {
73
- if (hasActionsPopover && e.target === headerEl) {
74
- focusActionsButton === null || focusActionsButton === void 0 || focusActionsButton();
83
+ // For cell headers with only actions, auto-open the actions popover on enter keypress
84
+ var onKeyDown = useCallback(function (e) {
85
+ if (e.key === keys.ENTER && hasActionsPopover && !renderFocusTrap && e.target === headerEl) {
86
+ openActionsPopover === null || openActionsPopover === void 0 || openActionsPopover();
75
87
  }
76
- }, [hasActionsPopover, focusActionsButton, headerEl]);
88
+ }, [hasActionsPopover, openActionsPopover, renderFocusTrap, headerEl]);
77
89
  return ___EmotionJSX("div", _extends({
78
90
  role: "columnheader",
79
91
  ref: setHeaderEl,
80
- tabIndex: isFocused && !isActionsButtonFocused ? 0 : -1,
81
- onFocus: onFocus,
92
+ tabIndex: isFocused ? 0 : -1,
93
+ onKeyDown: onKeyDown,
82
94
  className: classes,
83
95
  "data-test-subj": "dataGridHeaderCell-".concat(id),
84
96
  "data-gridcell-column-id": id,
@@ -87,19 +99,22 @@ export var EuiDataGridHeaderCellWrapper = function EuiDataGridHeaderCellWrapper(
87
99
  "data-gridcell-visible-row-index": "-1",
88
100
  style: width != null ? {
89
101
  width: "".concat(width, "px")
90
- } : {}
102
+ } : {},
103
+ "aria-label": renderFocusTrap ? ariaLabel : undefined
91
104
  }, rest), ___EmotionJSX(HandleInteractiveChildren, {
92
105
  cellEl: headerEl,
93
106
  updateCellFocusContext: updateCellFocusContext,
94
- renderFocusTrap: !hasActionsPopover
95
- }, children));
107
+ renderFocusTrap: renderFocusTrap,
108
+ onInteractiveChildrenFound: setInteractiveChildren
109
+ }, typeof children === 'function' ? children(renderFocusTrap) : children));
96
110
  };
97
111
  EuiDataGridHeaderCellWrapper.propTypes = {
112
+ children: PropTypes.oneOfType([PropTypes.node.isRequired, PropTypes.func.isRequired]).isRequired,
98
113
  id: PropTypes.string.isRequired,
99
114
  index: PropTypes.number.isRequired,
100
115
  width: PropTypes.oneOfType([PropTypes.number.isRequired, PropTypes.oneOf([null])]),
101
116
  className: PropTypes.string,
117
+ "aria-label": PropTypes.any,
102
118
  hasActionsPopover: PropTypes.bool,
103
- isActionsButtonFocused: PropTypes.bool,
104
- focusActionsButton: PropTypes.func
119
+ openActionsPopover: PropTypes.func
105
120
  };
@@ -274,6 +274,7 @@ DataGridSortingControl.propTypes = {
274
274
  * This can be used to display a readable column name in column hiding/sorting, where `display` won't be used.
275
275
  * This will also be used as a `title` attribute that will display on mouseover (useful if the display text is being truncated by the column width).
276
276
  * If not passed, `id` will be shown as the column name.
277
+ * Passing this together with `display` is useful to ensure an accessible label is added to the column.
277
278
  */
278
279
  displayAsText: PropTypes.string,
279
280
  /**
@@ -212,6 +212,7 @@ describe('EuiDataGrid', function () {
212
212
  cy.checkAxe();
213
213
  });
214
214
  it('has zero violations when the column actions menu is open', function () {
215
+ cy.get('.euiDataGridHeaderCell').first().realHover();
215
216
  cy.get('button.euiDataGridHeaderCell__button').first().realClick();
216
217
  cy.checkAxe();
217
218
  });
@@ -221,6 +222,7 @@ describe('EuiDataGrid', function () {
221
222
  cy.checkAxe();
222
223
  });
223
224
  it('has zero violations on sort and when the columns sorting menu is open', function () {
225
+ cy.get('.euiDataGridHeaderCell').last().realHover();
224
226
  cy.get('button.euiDataGridHeaderCell__button').last().realClick();
225
227
  cy.get('button.euiListGroupItem__button').contains('Sort Alma to Debian').should('exist').realClick();
226
228
  cy.get('div[data-test-subj="dataGridColumnSortingPopover"] button').realClick();
@@ -206,6 +206,7 @@ EuiDataGridInMemoryRenderer.propTypes = {
206
206
  * This can be used to display a readable column name in column hiding/sorting, where `display` won't be used.
207
207
  * This will also be used as a `title` attribute that will display on mouseover (useful if the display text is being truncated by the column width).
208
208
  * If not passed, `id` will be shown as the column name.
209
+ * Passing this together with `display` is useful to ensure an accessible label is added to the column.
209
210
  */
210
211
  displayAsText: PropTypes.string,
211
212
  /**
@@ -1,4 +1,4 @@
1
- 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"];
1
+ 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"];
2
2
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
3
  function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
4
4
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -64,6 +64,7 @@ var unsupportedProps = [
64
64
  export var EuiDatePicker = function EuiDatePicker(_ref) {
65
65
  var _ref$adjustDateOnChan = _ref.adjustDateOnChange,
66
66
  adjustDateOnChange = _ref$adjustDateOnChan === void 0 ? true : _ref$adjustDateOnChan,
67
+ append = _ref.append,
67
68
  calendarClassName = _ref.calendarClassName,
68
69
  className = _ref.className,
69
70
  compressed = _ref.compressed,
@@ -95,6 +96,7 @@ export var EuiDatePicker = function EuiDatePicker(_ref) {
95
96
  popperClassName = _ref.popperClassName,
96
97
  _ref$popoverPlacement = _ref.popoverPlacement,
97
98
  popoverPlacement = _ref$popoverPlacement === void 0 ? 'downLeft' : _ref$popoverPlacement,
99
+ prepend = _ref.prepend,
98
100
  readOnly = _ref.readOnly,
99
101
  selected = _ref.selected,
100
102
  _ref$shadow = _ref.shadow,
@@ -196,21 +198,25 @@ export var EuiDatePicker = function EuiDatePicker(_ref) {
196
198
  return ___EmotionJSX("span", {
197
199
  css: cssStyles,
198
200
  className: classes
199
- }, ___EmotionJSX(EuiFormControlLayout, {
201
+ }, ___EmotionJSX(EuiFormControlLayout, _extends({
200
202
  icon: optionalIcon,
201
- fullWidth: !inline && fullWidth,
202
- compressed: !inline && compressed,
203
203
  clear: selected && onClear ? {
204
204
  onClick: onClear
205
205
  } : undefined,
206
206
  isLoading: isLoading,
207
207
  isInvalid: isInvalid,
208
208
  isDisabled: disabled,
209
- readOnly: readOnly,
210
- isDelimited: inline // Styling shortcut for inline calendars
211
- ,
212
- iconsPosition: inline ? 'static' : undefined
213
- }, control));
209
+ readOnly: readOnly
210
+ }, inline ? {
211
+ isDelimited: true,
212
+ iconsPosition: 'static'
213
+ } : {
214
+ fullWidth: fullWidth,
215
+ compressed: compressed,
216
+ append: append,
217
+ prepend: prepend,
218
+ css: (append || prepend) && styles.inGroup
219
+ }), control));
214
220
  };
215
221
  EuiDatePicker.propTypes = {
216
222
  className: PropTypes.string,
@@ -281,9 +287,25 @@ EuiDatePicker.propTypes = {
281
287
  * **Use [EuiPopover](/#/layout/popover) values**: 'upCenter', 'upLeft', 'upRight', downCenter', 'downLeft', 'downRight', 'leftCenter', 'leftUp', 'leftDown', 'rightCenter', 'rightUp', 'rightDown'.
282
288
  */
283
289
  popoverPlacement: PropTypes.any,
290
+ /**
291
+ * Creates an input group with element(s) coming before the input.
292
+ * `string` | `ReactElement` or an array of these
293
+ *
294
+ * Ignored if `inline` or `controlOnly` are true.
295
+ */
296
+ append: PropTypes.any,
297
+ /**
298
+ * Creates an input group with element(s) coming before the input.
299
+ * `string` | `ReactElement` or an array of these
300
+ *
301
+ * Ignored if `inline` or `controlOnly` are true.
302
+ */
303
+ prepend: PropTypes.any,
284
304
  /**
285
305
  * Completely removes form control layout wrapper and ignores
286
- * iconType. Best used inside EuiFormControlLayoutDelimited.
306
+ * `iconType`, `prepend`, and `append`.
307
+ *
308
+ * Best used inside EuiFormControlLayoutDelimited.
287
309
  */
288
310
  controlOnly: PropTypes.bool
289
311
  };
@@ -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,9 +1,12 @@
1
+ var _excluded = ["exclude"];
1
2
  function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
2
3
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
4
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
4
5
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
5
6
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
7
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
8
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
9
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
7
10
  /*
8
11
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
9
12
  * or more contributor license agreements. Licensed under the Elastic License
@@ -23,29 +26,33 @@ import breaks from 'remark-breaks';
23
26
  import highlight from '../remark/remark_prismjs';
24
27
  import * as MarkdownTooltip from '../markdown_tooltip';
25
28
  import * as MarkdownCheckbox from '../markdown_checkbox';
26
- import { euiMarkdownLinkValidator } from '../markdown_link_validator';
29
+ import { euiMarkdownLinkValidator, DEFAULT_OPTIONS as LINK_VALIDATOR_DEFAULTS } from '../markdown_link_validator';
27
30
  var DEFAULT_PARSING_PLUGINS = {
28
31
  emoji: [emoji, {
29
32
  emoticon: false
30
33
  }],
31
34
  lineBreaks: [breaks, {}],
32
- linkValidator: [euiMarkdownLinkValidator, {
33
- allowRelative: true,
34
- allowProtocols: ['https:', 'http:', 'mailto:']
35
- }],
35
+ linkValidator: [euiMarkdownLinkValidator, LINK_VALIDATOR_DEFAULTS],
36
36
  checkbox: [MarkdownCheckbox.parser, {}],
37
37
  tooltip: [MarkdownTooltip.parser, {}]
38
38
  };
39
39
  export var getDefaultEuiMarkdownParsingPlugins = function getDefaultEuiMarkdownParsingPlugins() {
40
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
41
- exclude = _ref.exclude;
40
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
41
+ var exclude = _ref.exclude,
42
+ parsingConfig = _objectWithoutProperties(_ref, _excluded);
42
43
  var parsingPlugins = [[markdown, {}], [highlight, {}]];
43
44
  Object.entries(DEFAULT_PARSING_PLUGINS).forEach(function (_ref2) {
44
45
  var _ref3 = _slicedToArray(_ref2, 2),
45
46
  pluginName = _ref3[0],
46
47
  plugin = _ref3[1];
48
+ // Check for plugin exclusions
47
49
  if (!(exclude !== null && exclude !== void 0 && exclude.includes(pluginName))) {
48
- parsingPlugins.push(plugin);
50
+ // Check for plugin configuration overrides
51
+ if (pluginName in parsingConfig) {
52
+ parsingPlugins.push([plugin[0], parsingConfig[pluginName]]);
53
+ } else {
54
+ parsingPlugins.push(plugin);
55
+ }
49
56
  }
50
57
  });
51
58
  return parsingPlugins;
@@ -1,3 +1,9 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
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; }
4
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1
7
  /*
2
8
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
9
  * or more contributor license agreements. Licensed under the Elastic License
@@ -9,10 +15,21 @@
9
15
  import { getDefaultEuiMarkdownUiPlugins } from './ui_plugins';
10
16
  import { getDefaultEuiMarkdownParsingPlugins } from './parsing_plugins';
11
17
  import { getDefaultEuiMarkdownProcessingPlugins } from './processing_plugins';
12
- export var getDefaultEuiMarkdownPlugins = function getDefaultEuiMarkdownPlugins(config) {
18
+ export var getDefaultEuiMarkdownPlugins = function getDefaultEuiMarkdownPlugins() {
19
+ var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
20
+ var exclude = config.exclude,
21
+ processingConfig = config.processingConfig,
22
+ parsingConfig = config.parsingConfig,
23
+ uiConfig = config.uiConfig;
13
24
  return {
14
- parsingPlugins: getDefaultEuiMarkdownParsingPlugins(config),
15
- processingPlugins: getDefaultEuiMarkdownProcessingPlugins(config),
16
- uiPlugins: getDefaultEuiMarkdownUiPlugins(config)
25
+ parsingPlugins: getDefaultEuiMarkdownParsingPlugins(_objectSpread({
26
+ exclude: exclude
27
+ }, parsingConfig)),
28
+ processingPlugins: getDefaultEuiMarkdownProcessingPlugins(_objectSpread({
29
+ exclude: exclude
30
+ }, processingConfig)),
31
+ uiPlugins: getDefaultEuiMarkdownUiPlugins(_objectSpread({
32
+ exclude: exclude
33
+ }, uiConfig))
17
34
  };
18
35
  };