@elastic/eui 76.0.2 → 76.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/dist/eui_theme_dark.css +37 -6
  2. package/dist/eui_theme_dark.min.css +1 -1
  3. package/dist/eui_theme_light.css +37 -6
  4. package/dist/eui_theme_light.min.css +1 -1
  5. package/es/components/color_picker/color_palette_picker/color_palette_picker.js +5 -6
  6. package/es/components/datagrid/body/data_grid_body.js +19 -395
  7. package/es/components/datagrid/body/data_grid_body_custom.js +908 -0
  8. package/es/components/datagrid/body/data_grid_body_virtualized.js +1031 -0
  9. package/es/components/datagrid/body/data_grid_cell.js +16 -12
  10. package/es/components/datagrid/body/data_grid_cell_popover.js +32 -12
  11. package/es/components/datagrid/body/data_grid_cell_wrapper.js +132 -0
  12. package/es/components/datagrid/body/header/data_grid_header_row.js +3 -2
  13. package/es/components/datagrid/data_grid.js +21 -5
  14. package/es/components/datagrid/data_grid_types.js +18 -1
  15. package/es/components/datagrid/utils/row_heights.js +111 -31
  16. package/es/components/date_picker/auto_refresh/auto_refresh.js +2 -1
  17. package/es/components/form/range/dual_range.js +14 -7
  18. package/es/components/form/range/range.js +10 -3
  19. package/es/components/form/super_select/super_select.js +21 -18
  20. package/es/components/form/super_select/super_select_control.js +7 -14
  21. package/es/components/selectable/selectable.js +59 -36
  22. package/es/components/selectable/selectable_list/selectable_list.js +1 -1
  23. package/es/components/suggest/suggest.js +3 -10
  24. package/eui.d.ts +253 -146
  25. package/i18ntokens.json +89 -57
  26. package/lib/components/color_picker/color_palette_picker/color_palette_picker.js +5 -6
  27. package/lib/components/datagrid/body/data_grid_body.js +19 -416
  28. package/lib/components/datagrid/body/data_grid_body_custom.js +927 -0
  29. package/lib/components/datagrid/body/data_grid_body_virtualized.js +1059 -0
  30. package/lib/components/datagrid/body/data_grid_cell.js +16 -12
  31. package/lib/components/datagrid/body/data_grid_cell_popover.js +35 -12
  32. package/lib/components/datagrid/body/data_grid_cell_wrapper.js +147 -0
  33. package/lib/components/datagrid/body/header/data_grid_header_row.js +4 -2
  34. package/lib/components/datagrid/data_grid.js +21 -4
  35. package/lib/components/datagrid/data_grid_types.js +22 -1
  36. package/lib/components/datagrid/utils/row_heights.js +116 -33
  37. package/lib/components/date_picker/auto_refresh/auto_refresh.js +2 -1
  38. package/lib/components/form/range/dual_range.js +14 -7
  39. package/lib/components/form/range/range.js +10 -3
  40. package/lib/components/form/super_select/super_select.js +21 -18
  41. package/lib/components/form/super_select/super_select_control.js +7 -16
  42. package/lib/components/selectable/selectable.js +59 -36
  43. package/lib/components/selectable/selectable_list/selectable_list.js +1 -1
  44. package/lib/components/suggest/suggest.js +3 -12
  45. package/optimize/es/components/datagrid/body/data_grid_body.js +17 -387
  46. package/optimize/es/components/datagrid/body/data_grid_body_custom.js +176 -0
  47. package/optimize/es/components/datagrid/body/data_grid_body_virtualized.js +311 -0
  48. package/optimize/es/components/datagrid/body/data_grid_cell.js +12 -9
  49. package/optimize/es/components/datagrid/body/data_grid_cell_popover.js +30 -12
  50. package/optimize/es/components/datagrid/body/data_grid_cell_wrapper.js +127 -0
  51. package/optimize/es/components/datagrid/body/header/data_grid_header_row.js +3 -2
  52. package/optimize/es/components/datagrid/data_grid.js +8 -5
  53. package/optimize/es/components/datagrid/data_grid_types.js +18 -1
  54. package/optimize/es/components/datagrid/utils/row_heights.js +100 -31
  55. package/optimize/es/components/date_picker/auto_refresh/auto_refresh.js +2 -1
  56. package/optimize/es/components/form/range/dual_range.js +14 -7
  57. package/optimize/es/components/form/range/range.js +10 -3
  58. package/optimize/es/components/form/super_select/super_select.js +16 -12
  59. package/optimize/es/components/form/super_select/super_select_control.js +7 -14
  60. package/optimize/es/components/selectable/selectable.js +50 -34
  61. package/optimize/es/components/selectable/selectable_list/selectable_list.js +1 -1
  62. package/optimize/es/components/suggest/suggest.js +3 -10
  63. package/optimize/lib/components/datagrid/body/data_grid_body.js +16 -409
  64. package/optimize/lib/components/datagrid/body/data_grid_body_custom.js +198 -0
  65. package/optimize/lib/components/datagrid/body/data_grid_body_virtualized.js +342 -0
  66. package/optimize/lib/components/datagrid/body/data_grid_cell.js +12 -9
  67. package/optimize/lib/components/datagrid/body/data_grid_cell_popover.js +33 -19
  68. package/optimize/lib/components/datagrid/body/data_grid_cell_wrapper.js +144 -0
  69. package/optimize/lib/components/datagrid/body/header/data_grid_header_row.js +4 -2
  70. package/optimize/lib/components/datagrid/data_grid.js +8 -4
  71. package/optimize/lib/components/datagrid/data_grid_types.js +22 -1
  72. package/optimize/lib/components/datagrid/utils/row_heights.js +103 -37
  73. package/optimize/lib/components/date_picker/auto_refresh/auto_refresh.js +2 -1
  74. package/optimize/lib/components/form/range/dual_range.js +14 -7
  75. package/optimize/lib/components/form/range/range.js +10 -3
  76. package/optimize/lib/components/form/super_select/super_select.js +16 -11
  77. package/optimize/lib/components/form/super_select/super_select_control.js +7 -16
  78. package/optimize/lib/components/selectable/selectable.js +50 -35
  79. package/optimize/lib/components/selectable/selectable_list/selectable_list.js +1 -1
  80. package/optimize/lib/components/suggest/suggest.js +3 -12
  81. package/package.json +1 -1
  82. package/src/components/datagrid/_data_grid.scss +7 -0
  83. package/src/components/datagrid/_data_grid_data_row.scss +1 -0
  84. package/src/components/datagrid/body/footer/_data_grid_footer_row.scss +1 -0
  85. package/src/components/datagrid/body/header/_data_grid_header_row.scss +1 -0
  86. package/src/components/form/super_select/_super_select_control.scss +4 -0
  87. package/src/components/selectable/selectable_list/_selectable_list.scss +10 -3
  88. package/src/themes/amsterdam/global_styling/mixins/_states.scss +17 -8
  89. package/test-env/components/color_picker/color_palette_picker/color_palette_picker.js +5 -6
  90. package/test-env/components/datagrid/body/data_grid_body.js +18 -415
  91. package/test-env/components/datagrid/body/data_grid_body_custom.js +908 -0
  92. package/test-env/components/datagrid/body/data_grid_body_virtualized.js +1057 -0
  93. package/test-env/components/datagrid/body/data_grid_cell.js +16 -12
  94. package/test-env/components/datagrid/body/data_grid_cell_popover.js +33 -19
  95. package/test-env/components/datagrid/body/data_grid_cell_wrapper.js +144 -0
  96. package/test-env/components/datagrid/body/header/data_grid_header_row.js +4 -2
  97. package/test-env/components/datagrid/data_grid.js +21 -4
  98. package/test-env/components/datagrid/data_grid_types.js +22 -1
  99. package/test-env/components/datagrid/utils/row_heights.js +103 -37
  100. package/test-env/components/date_picker/auto_refresh/auto_refresh.js +2 -1
  101. package/test-env/components/form/range/dual_range.js +14 -7
  102. package/test-env/components/form/range/range.js +10 -3
  103. package/test-env/components/form/super_select/super_select.js +21 -17
  104. package/test-env/components/form/super_select/super_select_control.js +7 -16
  105. package/test-env/components/selectable/selectable.js +58 -36
  106. package/test-env/components/selectable/selectable_list/selectable_list.js +1 -1
  107. package/test-env/components/suggest/suggest.js +3 -12
@@ -57,6 +57,8 @@ var _range_wrapper = require("./range_wrapper");
57
57
 
58
58
  var _range = require("./range.styles");
59
59
 
60
+ var _i18n = require("../../i18n");
61
+
60
62
  var _react2 = require("@emotion/react");
61
63
 
62
64
  var _excluded = ["className", "compressed", "disabled", "fullWidth", "isLoading", "readOnly", "id", "max", "min", "name", "step", "showLabels", "showInput", "showTicks", "tickInterval", "ticks", "levels", "showRange", "showValue", "valueAppend", "valuePrepend", "onBlur", "onChange", "onFocus", "value", "tabIndex", "isInvalid", "theme"];
@@ -203,6 +205,10 @@ var EuiRangeClass = /*#__PURE__*/function (_Component) {
203
205
  var styles = (0, _range.euiRangeStyles)(theme);
204
206
  var cssStyles = [styles.euiRange, showInput && styles.hasInput];
205
207
  var thumbColor = levels && (0, _range_levels_colors.getLevelColor)(levels, Number(value));
208
+ var sliderScreenReaderInstructions = (0, _react2.jsx)(_i18n.EuiI18n, {
209
+ token: "euiRange.sliderScreenReaderInstructions",
210
+ default: "You are in a custom range slider. Use the Up and Down arrow keys to change the value."
211
+ });
206
212
  var theRange = (0, _react2.jsx)(_range_wrapper.EuiRangeWrapper, {
207
213
  className: classes,
208
214
  css: cssStyles,
@@ -223,7 +229,7 @@ var EuiRangeClass = /*#__PURE__*/function (_Component) {
223
229
  levels: levels,
224
230
  onChange: this.handleOnChange,
225
231
  value: value,
226
- "aria-hidden": showInput === true,
232
+ "aria-hidden": !!showInput,
227
233
  showRange: showRange
228
234
  }, function (trackWidth) {
229
235
  return (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(_range_slider.EuiRangeSlider, (0, _extends2.default)({
@@ -244,7 +250,7 @@ var EuiRangeClass = /*#__PURE__*/function (_Component) {
244
250
  } : undefined,
245
251
  onFocus: showInput === true ? undefined : onFocus,
246
252
  onBlur: showInputOnly ? _this2.onInputBlur : onBlur,
247
- "aria-hidden": showInput === true ? true : false,
253
+ "aria-hidden": !!showInput,
248
254
  thumbColor: thumbColor
249
255
  }, rest)), showRange && _this2.isValid && (0, _react2.jsx)(_range_highlight.EuiRangeHighlight, {
250
256
  showTicks: showTicks,
@@ -277,7 +283,8 @@ var EuiRangeClass = /*#__PURE__*/function (_Component) {
277
283
  fullWidth: fullWidth,
278
284
  isOpen: this.state.isPopoverOpen,
279
285
  closePopover: this.closePopover,
280
- disableFocusTrap: true
286
+ disableFocusTrap: true,
287
+ popoverScreenReaderText: sliderScreenReaderInstructions
281
288
  }, theRange) : undefined;
282
289
  return thePopover ? thePopover : theRange;
283
290
  }
@@ -45,7 +45,7 @@ var _i18n = require("../../i18n");
45
45
 
46
46
  var _react2 = require("@emotion/react");
47
47
 
48
- var _excluded = ["className", "options", "valueOfSelected", "onChange", "isOpen", "isInvalid", "hasDividers", "itemClassName", "itemLayoutAlign", "fullWidth", "popoverProps", "compressed"],
48
+ var _excluded = ["className", "options", "valueOfSelected", "placeholder", "onChange", "isOpen", "isInvalid", "hasDividers", "itemClassName", "itemLayoutAlign", "fullWidth", "popoverProps", "compressed"],
49
49
  _excluded2 = ["value", "dropdownDisplay", "inputDisplay"];
50
50
 
51
51
  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); }
@@ -81,7 +81,6 @@ var EuiSuperSelect = /*#__PURE__*/function (_Component) {
81
81
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "itemNodes", []);
82
82
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "_isMounted", false);
83
83
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "describedById", (0, _services.htmlIdGenerator)('euiSuperSelect_')('_screenreaderDescribeId'));
84
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "labelledById", (0, _services.htmlIdGenerator)('euiSuperSelect_')('_screenreaderLabelId'));
85
84
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
86
85
  isPopoverOpen: _this.props.isOpen || false
87
86
  });
@@ -240,6 +239,7 @@ var EuiSuperSelect = /*#__PURE__*/function (_Component) {
240
239
  className = _this$props.className,
241
240
  options = _this$props.options,
242
241
  valueOfSelected = _this$props.valueOfSelected,
242
+ placeholder = _this$props.placeholder,
243
243
  onChange = _this$props.onChange,
244
244
  isOpen = _this$props.isOpen,
245
245
  isInvalid = _this$props.isInvalid,
@@ -258,9 +258,9 @@ var EuiSuperSelect = /*#__PURE__*/function (_Component) {
258
258
  'euiSuperSelect__item--hasDividers': hasDividers
259
259
  }, itemClassName);
260
260
  var button = (0, _react2.jsx)(_super_select_control.EuiSuperSelectControl, (0, _extends2.default)({
261
- screenReaderId: this.labelledById,
262
261
  options: options,
263
262
  value: valueOfSelected,
263
+ placeholder: placeholder,
264
264
  onClick: this.state.isPopoverOpen ? this.closePopover : this.openPopover,
265
265
  onKeyDown: this.onSelectKeyDown,
266
266
  className: buttonClasses,
@@ -303,14 +303,19 @@ var EuiSuperSelect = /*#__PURE__*/function (_Component) {
303
303
  }, (0, _react2.jsx)(_i18n.EuiI18n, {
304
304
  token: "euiSuperSelect.screenReaderAnnouncement",
305
305
  default: "You are in a form selector and must select a single option. Use the Up and Down arrow keys to navigate or Escape to close."
306
- }))), (0, _react2.jsx)("div", {
307
- "aria-labelledby": this.labelledById,
308
- "aria-describedby": this.describedById,
309
- className: "euiSuperSelect__listbox",
310
- role: "listbox",
311
- "aria-activedescendant": valueOfSelected,
312
- tabIndex: 0
313
- }, items));
306
+ }))), (0, _react2.jsx)(_i18n.EuiI18n, {
307
+ token: "euiSuperSelect.ariaLabel",
308
+ default: "Select listbox"
309
+ }, function (ariaLabel) {
310
+ return (0, _react2.jsx)("div", {
311
+ "aria-label": ariaLabel,
312
+ "aria-describedby": _this2.describedById,
313
+ className: "euiSuperSelect__listbox",
314
+ role: "listbox",
315
+ "aria-activedescendant": valueOfSelected,
316
+ tabIndex: 0
317
+ }, items);
318
+ }));
314
319
  }
315
320
  }]);
316
321
  return EuiSuperSelect;
@@ -17,19 +17,15 @@ var _react = _interopRequireWildcard(require("react"));
17
17
 
18
18
  var _classnames = _interopRequireDefault(require("classnames"));
19
19
 
20
- var _accessibility = require("../../accessibility");
21
-
22
20
  var _form_control_layout = require("../form_control_layout");
23
21
 
24
- var _i18n = require("../../i18n");
25
-
26
22
  var _num_icons = require("../form_control_layout/_num_icons");
27
23
 
28
24
  var _eui_form_context = require("../eui_form_context");
29
25
 
30
26
  var _react2 = require("@emotion/react");
31
27
 
32
- var _excluded = ["className", "options", "id", "name", "fullWidth", "isLoading", "isInvalid", "readOnly", "defaultValue", "compressed", "value", "prepend", "append", "screenReaderId", "disabled"];
28
+ var _excluded = ["className", "options", "id", "name", "fullWidth", "isLoading", "isInvalid", "readOnly", "defaultValue", "compressed", "value", "placeholder", "prepend", "append", "disabled"];
33
29
 
34
30
  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); }
35
31
 
@@ -55,9 +51,9 @@ var EuiSuperSelectControl = function EuiSuperSelectControl(props) {
55
51
  _props$compressed = props.compressed,
56
52
  compressed = _props$compressed === void 0 ? false : _props$compressed,
57
53
  value = props.value,
54
+ placeholder = props.placeholder,
58
55
  prepend = props.prepend,
59
56
  append = props.append,
60
- screenReaderId = props.screenReaderId,
61
57
  disabled = props.disabled,
62
58
  rest = (0, _objectWithoutProperties2.default)(props, _excluded);
63
59
  var numIconsClass = (0, _num_icons.getFormControlClassNameForIconCount)({
@@ -89,6 +85,7 @@ var EuiSuperSelectControl = function EuiSuperSelectControl(props) {
89
85
  selectedValue = selectedOption ? selectedOption.inputDisplay : selectedValue;
90
86
  }
91
87
 
88
+ var showPlaceholder = !!placeholder && !selectedValue;
92
89
  return (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)("input", {
93
90
  type: "hidden",
94
91
  id: id,
@@ -106,22 +103,16 @@ var EuiSuperSelectControl = function EuiSuperSelectControl(props) {
106
103
  compressed: compressed,
107
104
  prepend: prepend,
108
105
  append: append
109
- }, (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("span", {
110
- id: screenReaderId
111
- }, (0, _react2.jsx)(_i18n.EuiI18n, {
112
- token: "euiSuperSelectControl.selectAnOption",
113
- default: "Select an option: {selectedValue}, is selected",
114
- values: {
115
- selectedValue: selectedValue
116
- }
117
- }))), (0, _react2.jsx)("button", (0, _extends2.default)({
106
+ }, (0, _react2.jsx)("button", (0, _extends2.default)({
118
107
  type: "button",
119
108
  className: classes,
120
109
  "aria-haspopup": "listbox",
121
110
  disabled: disabled || readOnly // @ts-ignore Using as a selector only for mixin use
122
111
  ,
123
112
  readOnly: readOnly
124
- }, rest), selectedValue)));
113
+ }, rest), showPlaceholder ? (0, _react2.jsx)("span", {
114
+ className: "euiSuperSelectControl__placeholder"
115
+ }, placeholder) : selectedValue)));
125
116
  };
126
117
 
127
118
  exports.EuiSuperSelectControl = EuiSuperSelectControl;
@@ -9,10 +9,10 @@ Object.defineProperty(exports, "__esModule", {
9
9
  });
10
10
  exports.EuiSelectable = void 0;
11
11
 
12
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
-
14
12
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
15
13
 
14
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
15
+
16
16
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
17
17
 
18
18
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
@@ -53,7 +53,7 @@ var _i18n = require("../i18n");
53
53
 
54
54
  var _react2 = require("@emotion/react");
55
55
 
56
- var _excluded = ["children", "className", "options", "onChange", "onActiveOptionChange", "searchable", "searchProps", "singleSelection", "isLoading", "listProps", "renderOption", "height", "allowExclusions", "aria-label", "aria-describedby", "loadingMessage", "noMatchesMessage", "emptyMessage", "errorMessage", "isPreFiltered"],
56
+ var _excluded = ["children", "className", "options", "onChange", "onActiveOptionChange", "searchable", "searchProps", "singleSelection", "isLoading", "listProps", "renderOption", "height", "allowExclusions", "aria-label", "aria-describedby", "loadingMessage", "noMatchesMessage", "emptyMessage", "errorMessage", "selectableScreenReaderText", "isPreFiltered"],
57
57
  _excluded2 = ["aria-label", "aria-describedby", "onChange", "defaultValue", "inputRef"],
58
58
  _excluded3 = ["aria-label", "aria-describedby", "isVirtualized", "rowHeight"];
59
59
 
@@ -88,13 +88,22 @@ var EuiSelectable = /*#__PURE__*/function (_Component) {
88
88
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "rootId", void 0);
89
89
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "messageContentId", void 0);
90
90
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "listId", void 0);
91
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isFocusOnSearchOrListBox", function (target) {
92
+ var _this$optionsListRef$, _this$optionsListRef$2;
93
+
94
+ var searchHasFocus = _this.props.searchable && target === _this.inputRef;
95
+ var listBox = (_this$optionsListRef$ = _this.optionsListRef.current) === null || _this$optionsListRef$ === void 0 ? void 0 : (_this$optionsListRef$2 = _this$optionsListRef$.listBoxRef) === null || _this$optionsListRef$2 === void 0 ? void 0 : _this$optionsListRef$2.parentElement;
96
+ var listBoxContainsFocus = target instanceof Node && (listBox === null || listBox === void 0 ? void 0 : listBox.contains(target));
97
+ var listBoxHasFocus = target === listBox || listBoxContainsFocus;
98
+ return searchHasFocus || listBoxHasFocus;
99
+ });
91
100
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onMouseDown", function () {
92
101
  // Bypass onFocus when a click event originates from this.containerRef.
93
102
  // Prevents onFocus from scrolling away from a clicked option and negating the selection event.
94
103
  // https://github.com/elastic/eui/issues/4147
95
104
  _this.preventOnFocus = true;
96
105
  });
97
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onFocus", function () {
106
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onFocus", function (event) {
98
107
  if (_this.preventOnFocus) {
99
108
  _this.preventOnFocus = false;
100
109
  return;
@@ -104,6 +113,10 @@ var EuiSelectable = /*#__PURE__*/function (_Component) {
104
113
  return;
105
114
  }
106
115
 
116
+ if (event && !_this.isFocusOnSearchOrListBox(event.target)) {
117
+ return;
118
+ }
119
+
107
120
  var firstSelected = _this.state.visibleOptions.findIndex(function (option) {
108
121
  return option.checked && !option.disabled && !option.isGroupLabel;
109
122
  });
@@ -123,7 +136,19 @@ var EuiSelectable = /*#__PURE__*/function (_Component) {
123
136
  }
124
137
  });
125
138
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onKeyDown", function (event) {
126
- var optionsList = _this.optionsListRef.current;
139
+ var optionsList = _this.optionsListRef.current; // Check if the user is interacting with something other than the
140
+ // searchbox or selection list. If so, the user may be attempting to
141
+ // interact with the search clear button or a totally custom button,
142
+ // and listbox keyboard navigation/selection should not be triggered.
143
+
144
+ if (!_this.isFocusOnSearchOrListBox(event.target)) {
145
+ _this.setState({
146
+ activeOptionIndex: undefined,
147
+ isFocused: false
148
+ });
149
+
150
+ return;
151
+ }
127
152
 
128
153
  switch (event.key) {
129
154
  case _services.keys.ARROW_UP:
@@ -148,20 +173,10 @@ var EuiSelectable = /*#__PURE__*/function (_Component) {
148
173
  case _services.keys.ENTER:
149
174
  case _services.keys.SPACE:
150
175
  if (_this.props.searchable) {
151
- var _this$optionsListRef$, _this$optionsListRef$2;
152
-
153
176
  // For searchable instances, SPACE is reserved as a character for filtering
154
177
  // via the input box, and as such only ENTER will toggle selection.
155
178
  if (event.target === _this.inputRef && event.key === _services.keys.SPACE) {
156
179
  return;
157
- } // Check if the user is interacting with something other than the
158
- // searchbox or selection list. If not, the user is attempting to
159
- // interact with an internal button such as the clear button,
160
- // and the event should not be altered.
161
-
162
-
163
- if (!(event.target === _this.inputRef || event.target === ((_this$optionsListRef$ = _this.optionsListRef.current) === null || _this$optionsListRef$ === void 0 ? void 0 : (_this$optionsListRef$2 = _this$optionsListRef$.listBoxRef) === null || _this$optionsListRef$2 === void 0 ? void 0 : _this$optionsListRef$2.parentElement))) {
164
- return;
165
180
  }
166
181
  }
167
182
 
@@ -249,10 +264,8 @@ var EuiSelectable = /*#__PURE__*/function (_Component) {
249
264
  (_this$props$searchPro = _this.props.searchProps) === null || _this$props$searchPro === void 0 ? void 0 : (_this$props$searchPro2 = _this$props$searchPro.onChange) === null || _this$props$searchPro2 === void 0 ? void 0 : _this$props$searchPro2.call(_this$props$searchPro, searchValue, visibleOptions);
250
265
  });
251
266
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onContainerBlur", function (e) {
252
- var _e$relatedTarget, _e$relatedTarget$firs;
253
-
254
267
  // Ignore blur events when moving from search to option to avoid activeOptionIndex conflicts
255
- if (((_e$relatedTarget = e.relatedTarget) === null || _e$relatedTarget === void 0 ? void 0 : (_e$relatedTarget$firs = _e$relatedTarget.firstChild) === null || _e$relatedTarget$firs === void 0 ? void 0 : _e$relatedTarget$firs.id) === _this.listId) {
268
+ if (_this.isFocusOnSearchOrListBox(e.relatedTarget)) {
256
269
  return;
257
270
  }
258
271
 
@@ -355,6 +368,7 @@ var EuiSelectable = /*#__PURE__*/function (_Component) {
355
368
  noMatchesMessage = _this$props3.noMatchesMessage,
356
369
  emptyMessage = _this$props3.emptyMessage,
357
370
  errorMessage = _this$props3.errorMessage,
371
+ selectableScreenReaderText = _this$props3.selectableScreenReaderText,
358
372
  isPreFiltered = _this$props3.isPreFiltered,
359
373
  rest = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
360
374
  var _this$state = this.state,
@@ -489,10 +503,15 @@ var EuiSelectable = /*#__PURE__*/function (_Component) {
489
503
  var searchAccessibleName = getAccessibleName(searchProps, this.messageContentId);
490
504
  var searchHasAccessibleName = Boolean(Object.keys(searchAccessibleName).length);
491
505
  var search = searchable ? (0, _react2.jsx)(_i18n.EuiI18n, {
492
- token: "euiSelectable.placeholderName",
493
- default: "Filter options"
494
- }, function (placeholderName) {
495
- return (0, _react2.jsx)(_selectable_search.EuiSelectableSearch, (0, _extends2.default)({
506
+ tokens: ['euiSelectable.screenReaderInstructions', 'euiSelectable.placeholderName'],
507
+ defaults: ['Use the Up and Down arrow keys to move focus over options. Press Enter to select. Press Escape to collapse options.', 'Filter options']
508
+ }, function (_ref4) {
509
+ var _ref5 = (0, _slicedToArray2.default)(_ref4, 2),
510
+ screenReaderInstructions = _ref5[0],
511
+ placeholderName = _ref5[1];
512
+
513
+ return (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(_selectable_search.EuiSelectableSearch, (0, _extends2.default)({
514
+ "aria-describedby": listAriaDescribedbyId,
496
515
  key: "listSearch",
497
516
  options: options,
498
517
  value: searchValue,
@@ -511,15 +530,17 @@ var EuiSelectable = /*#__PURE__*/function (_Component) {
511
530
  }
512
531
  }, searchHasAccessibleName ? searchAccessibleName : {
513
532
  'aria-label': placeholderName
514
- }, cleanedSearchProps));
533
+ }, cleanedSearchProps)), (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("p", {
534
+ id: listAriaDescribedbyId
535
+ }, selectableScreenReaderText, " ", screenReaderInstructions)));
515
536
  }) : undefined;
516
537
  var resultsLength = visibleOptions.filter(function (option) {
517
538
  return !option.disabled;
518
539
  }).length;
519
540
  var listScreenReaderStatus = searchable && (0, _react2.jsx)(_i18n.EuiI18n, {
520
541
  token: "euiSelectable.searchResults",
521
- default: function _default(_ref4) {
522
- var resultsLength = _ref4.resultsLength;
542
+ default: function _default(_ref6) {
543
+ var resultsLength = _ref6.resultsLength;
523
544
  return "".concat(resultsLength, " result").concat(resultsLength === 1 ? '' : 's', " available");
524
545
  },
525
546
  values: {
@@ -530,18 +551,12 @@ var EuiSelectable = /*#__PURE__*/function (_Component) {
530
551
  var listAccessibleName = getAccessibleName(listProps, listAriaDescribedbyId);
531
552
  var listHasAccessibleName = Boolean(Object.keys(listAccessibleName).length);
532
553
  var list = (0, _react2.jsx)(_i18n.EuiI18n, {
533
- tokens: ['euiSelectable.screenReaderInstructions', 'euiSelectable.placeholderName'],
534
- defaults: ['Use up and down arrows to move focus over options. Enter to select. Escape to collapse options.', 'Filter options']
535
- }, function (_ref5) {
536
- var _ref6 = (0, _slicedToArray2.default)(_ref5, 2),
537
- placeholderName = _ref6[0],
538
- screenReaderInstructions = _ref6[1];
539
-
554
+ token: "euiSelectable.placeholderName",
555
+ default: "Filter options"
556
+ }, function (placeholderName) {
540
557
  return (0, _react2.jsx)(_react.default.Fragment, null, searchable && (0, _react2.jsx)(_accessibility.EuiScreenReaderLive, {
541
558
  isActive: messageContent != null || activeOptionIndex != null
542
- }, messageContent || listScreenReaderStatus), (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("p", {
543
- id: listAriaDescribedbyId
544
- }, screenReaderInstructions)), messageContent ? (0, _react2.jsx)(_selectable_message.EuiSelectableMessage, {
559
+ }, messageContent || listScreenReaderStatus), messageContent ? (0, _react2.jsx)(_selectable_message.EuiSelectableMessage, {
545
560
  "data-test-subj": "euiSelectableMessage",
546
561
  id: _this2.messageContentId,
547
562
  bordered: listProps && listProps.bordered
@@ -112,7 +112,7 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
112
112
  }
113
113
 
114
114
  if (typeof ariaDescribedby === 'string') {
115
- ref.setAttribute('aria-labelledby', ariaDescribedby);
115
+ ref.setAttribute('aria-describedby', ariaDescribedby);
116
116
  }
117
117
  }
118
118
  });
@@ -19,10 +19,6 @@ var _react = _interopRequireWildcard(require("react"));
19
19
 
20
20
  var _classnames = _interopRequireDefault(require("classnames"));
21
21
 
22
- var _services = require("../../services");
23
-
24
- var _accessibility = require("../accessibility");
25
-
26
22
  var _icon = require("../icon");
27
23
 
28
24
  var _i18n = require("../i18n");
@@ -135,14 +131,11 @@ var EuiSuggest = function EuiSuggest(_ref) {
135
131
  var searchOnChange = function searchOnChange(value) {
136
132
  onSearch === null || onSearch === void 0 ? void 0 : onSearch(value);
137
133
  };
138
-
139
- var inputDescribedbyId = (0, _services.useGeneratedHtmlId)({
140
- prefix: id
141
- });
142
134
  /**
143
135
  * Status
144
136
  */
145
137
 
138
+
146
139
  var icon = '';
147
140
  var color = '';
148
141
 
@@ -231,6 +224,7 @@ var EuiSuggest = function EuiSuggest(_ref) {
231
224
  }
232
225
  }, [onItemClick, suggestions]);
233
226
  return (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(_selectable.EuiSelectable, {
227
+ selectableScreenReaderText: stateMessage,
234
228
  singleSelection: true,
235
229
  height: isVirtualized ? undefined : 'full',
236
230
  options: suggestionList,
@@ -255,7 +249,6 @@ var EuiSuggest = function EuiSuggest(_ref) {
255
249
  onBlur: searchOnBlur,
256
250
  onInput: searchOnInput,
257
251
  onChange: searchOnChange,
258
- 'aria-describedby': inputDescribedbyId,
259
252
  'aria-label': ariaLabel,
260
253
  'aria-labelledby': labelId
261
254
  }, rest)
@@ -279,9 +272,7 @@ var EuiSuggest = function EuiSuggest(_ref) {
279
272
  },
280
273
  className: "eui-yScroll"
281
274
  }, list));
282
- }), (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("p", {
283
- id: inputDescribedbyId
284
- }, stateMessage)));
275
+ }));
285
276
  };
286
277
 
287
278
  exports.EuiSuggest = EuiSuggest;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@elastic/eui",
3
3
  "description": "Elastic UI Component Library",
4
- "version": "76.0.2",
4
+ "version": "76.2.0",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "lib",
7
7
  "module": "es",
@@ -35,6 +35,13 @@
35
35
  font-feature-settings: 'tnum' 1; // Tabular numbers
36
36
  }
37
37
 
38
+ .euiDataGrid__customRenderBody {
39
+ @include euiScrollBar($euiColorDarkShade, $euiColorEmptyShade);
40
+ height: 100%;
41
+ width: 100%;
42
+ overflow: auto;
43
+ }
44
+
38
45
  .euiDataGrid__pagination {
39
46
  z-index: 2; // Sits above the content above it
40
47
  padding-top: $euiSizeXS;
@@ -24,6 +24,7 @@
24
24
  }
25
25
 
26
26
  &:focus {
27
+ position: relative;
27
28
  @include euiDataGridCellFocus;
28
29
  }
29
30
 
@@ -1,5 +1,6 @@
1
1
  .euiDataGridFooter {
2
2
  display: flex;
3
+ width: fit-content;
3
4
  }
4
5
 
5
6
  @include euiDataGridFooterCell {
@@ -4,6 +4,7 @@
4
4
  background: $euiColorEmptyShade;
5
5
  position: sticky;
6
6
  top: 0;
7
+ width: fit-content;
7
8
  }
8
9
 
9
10
  @include euiDataGridHeaderCell {
@@ -26,6 +26,10 @@
26
26
  padding-bottom: 0; /* 1 */
27
27
  }
28
28
 
29
+ &__placeholder {
30
+ @include euiFormControlDisabledTextStyle;
31
+ }
32
+
29
33
  &.euiSuperSelect--isOpen__button { // since this is a button, we also want the visual indicator of active when options are shown
30
34
  @include euiFormControlFocusStyle;
31
35
  }
@@ -1,10 +1,12 @@
1
- // Expand height of list via flex box
2
1
  .euiSelectableList {
3
- &:focus-within {
4
- @include euiFocusRing;
2
+ // NOTE: This is currently only visible on supported browsers (all except FF)
3
+ // which is (unfortunately) better than always displaying the focus ring to mouse users
4
+ &:has(:focus-visible) {
5
+ @include euiFocusRing(null, $euiFocusRingSize / 2, false);
5
6
  }
6
7
  }
7
8
 
9
+ // Expand height of list via flex box
8
10
  .euiSelectableList-fullHeight {
9
11
  flex-grow: 1;
10
12
  }
@@ -18,6 +20,11 @@
18
20
  .euiSelectableList__list {
19
21
  @include euiOverflowShadow;
20
22
  @include euiScrollBar;
23
+
24
+ &:focus,
25
+ & > ul:focus {
26
+ outline: none; // Focus outline handled by parent .euiSelectableList
27
+ }
21
28
  }
22
29
 
23
30
  .euiSelectableList__groupLabel {
@@ -3,22 +3,31 @@
3
3
  // This re-uses the same faux focus ring mixin, but adjusts the outline instead
4
4
  // @param {size} Old param from default theme that won't be used, so it should always be `null`
5
5
  // @param {offset} Accepts a specific number or 'inner' or 'outer' to adjust outline position
6
- @mixin euiFocusRing($size: null, $offset: false) {
6
+ // @param {includeFocusVisible} Allows turning off :not:focus-visible selector (which can interfere with some manual usages)
7
+ @mixin euiFocusRing($size: null, $offset: false, $focusVisibleSelectors: true) {
7
8
  // Safari & Firefox
8
9
  outline: $euiFocusRingSize solid currentColor;
9
10
 
10
- // Chrome
11
- &:focus-visible {
12
- outline-style: auto;
13
- }
11
+ @if ($focusVisibleSelectors) {
12
+ // Chrome
13
+ &:focus-visible {
14
+ outline-style: auto;
15
+ }
14
16
 
15
- &:not(:focus-visible) {
16
- outline: none;
17
+ &:not(:focus-visible) {
18
+ outline: none;
19
+ }
20
+ } @else {
21
+ outline-style: auto;
17
22
  }
18
23
 
19
24
  // Adjusting position with offset
20
25
  @if (type-of($offset) == number) {
21
- outline-offset: #{$offset}px;
26
+ @if (unitless($offset)) {
27
+ outline-offset: #{$offset}px;
28
+ } @else {
29
+ outline-offset: #{$offset};
30
+ }
22
31
  } @else if ($offset == 'inner') {
23
32
  outline-offset: -$euiFocusRingSize;
24
33
  } @else if ($offset == 'outer') {
@@ -129,6 +129,11 @@ EuiColorPalettePicker.propTypes = {
129
129
  readOnly: _propTypes.default.bool,
130
130
  name: _propTypes.default.string,
131
131
 
132
+ /**
133
+ * Placeholder to display when the current selected value is empty.
134
+ */
135
+ placeholder: _propTypes.default.node,
136
+
132
137
  /**
133
138
  * Creates an input group with element(s) coming before input.
134
139
  * `string` | `ReactElement` or an array of these
@@ -140,12 +145,6 @@ EuiColorPalettePicker.propTypes = {
140
145
  * `string` | `ReactElement` or an array of these
141
146
  */
142
147
  append: _propTypes.default.oneOfType([_propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.element.isRequired]).isRequired, _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.element.isRequired]).isRequired).isRequired]),
143
-
144
- /**
145
- * Creates a semantic label ID for the `div[role="listbox"]` that's opened on click or keypress.
146
- * __Generated and passed down by `EuiSuperSelect`.__
147
- */
148
- screenReaderId: _propTypes.default.string,
149
148
  valueOfSelected: _propTypes.default.any,
150
149
 
151
150
  /**