@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
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
- exports.useRowHeightUtils = exports.useDefaultRowHeight = exports.cellPaddingsMap = exports.RowHeightUtils = exports.DEFAULT_ROW_HEIGHT = exports.AUTO_HEIGHT = void 0;
8
+ exports.useRowHeightUtils = exports.useDefaultRowHeight = exports.cellPaddingsMap = exports.RowHeightVirtualizationUtils = exports.RowHeightUtils = exports.DEFAULT_ROW_HEIGHT = exports.AUTO_HEIGHT = void 0;
7
9
 
8
10
  var _react = require("react");
9
11
 
@@ -21,6 +23,24 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
21
23
 
22
24
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
23
25
 
26
+ function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
27
+
28
+ function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
29
+
30
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
31
+
32
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
33
+
34
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
35
+
36
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
37
+
38
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
39
+
40
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
41
+
42
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
43
+
24
44
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
25
45
 
26
46
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -54,16 +74,11 @@ var DEFAULT_ROW_HEIGHT = 34;
54
74
  exports.DEFAULT_ROW_HEIGHT = DEFAULT_ROW_HEIGHT;
55
75
 
56
76
  var RowHeightUtils = /*#__PURE__*/function () {
57
- function RowHeightUtils(gridRef, outerGridElementRef, gridItemsRenderedRef, rerenderGridBodyRef) {
77
+ function RowHeightUtils() {
58
78
  var _this = this;
59
79
 
60
80
  _classCallCheck(this, RowHeightUtils);
61
81
 
62
- this.gridRef = gridRef;
63
- this.outerGridElementRef = outerGridElementRef;
64
- this.gridItemsRenderedRef = gridItemsRenderedRef;
65
- this.rerenderGridBodyRef = rerenderGridBodyRef;
66
-
67
82
  _defineProperty(this, "styles", {
68
83
  paddingTop: 0,
69
84
  paddingBottom: 0
@@ -95,10 +110,6 @@ var RowHeightUtils = /*#__PURE__*/function () {
95
110
  });
96
111
 
97
112
  _defineProperty(this, "heightsCache", new Map());
98
-
99
- _defineProperty(this, "timerId", void 0);
100
-
101
- _defineProperty(this, "lastUpdatedRow", Infinity);
102
113
  }
103
114
 
104
115
  _createClass(RowHeightUtils, [{
@@ -184,6 +195,11 @@ var RowHeightUtils = /*#__PURE__*/function () {
184
195
 
185
196
  return false;
186
197
  }
198
+ /**
199
+ * Heights cache utils
200
+ * This cache is primarily used by auto heights & secondarily used by lineCount row overrides
201
+ */
202
+
187
203
  }, {
188
204
  key: "getRowHeight",
189
205
  value: function getRowHeight(rowIndex) {
@@ -196,23 +212,20 @@ var RowHeightUtils = /*#__PURE__*/function () {
196
212
  }, {
197
213
  key: "setRowHeight",
198
214
  value: function setRowHeight(rowIndex, colId) {
199
- var _this$rerenderGridBod, _this$rerenderGridBod2;
200
-
201
215
  var height = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_ROW_HEIGHT;
202
- var visibleRowIndex = arguments.length > 3 ? arguments[3] : undefined;
216
+
217
+ var _visibleRowIndex = arguments.length > 3 ? arguments[3] : undefined;
218
+
203
219
  var rowHeights = this.heightsCache.get(rowIndex) || new Map();
204
220
  var adaptedHeight = Math.ceil(height + this.styles.paddingTop + this.styles.paddingBottom);
205
221
 
206
222
  if (rowHeights.get(colId) === adaptedHeight) {
207
- return;
223
+ return false;
224
+ } else {
225
+ rowHeights.set(colId, adaptedHeight);
226
+ this.heightsCache.set(rowIndex, rowHeights);
227
+ return true;
208
228
  }
209
-
210
- rowHeights.set(colId, adaptedHeight);
211
- this.heightsCache.set(rowIndex, rowHeights);
212
- this.resetRow(visibleRowIndex); // When an auto row height is updated, force a re-render
213
- // of the grid body to update the unconstrained height
214
-
215
- (_this$rerenderGridBod = (_this$rerenderGridBod2 = this.rerenderGridBodyRef).current) === null || _this$rerenderGridBod === void 0 ? void 0 : _this$rerenderGridBod.call(_this$rerenderGridBod2);
216
229
  }
217
230
  }, {
218
231
  key: "pruneHiddenColumnHeights",
@@ -231,22 +244,87 @@ var RowHeightUtils = /*#__PURE__*/function () {
231
244
  }
232
245
  });
233
246
  });
247
+ return didModify;
248
+ }
249
+ }]);
250
+
251
+ return RowHeightUtils;
252
+ }();
253
+ /**
254
+ * Row height utils with virtualization library-specific APIs
255
+ */
256
+
257
+
258
+ exports.RowHeightUtils = RowHeightUtils;
259
+
260
+ var RowHeightVirtualizationUtils = /*#__PURE__*/function (_RowHeightUtils) {
261
+ _inherits(RowHeightVirtualizationUtils, _RowHeightUtils);
262
+
263
+ var _super = _createSuper(RowHeightVirtualizationUtils);
264
+
265
+ function RowHeightVirtualizationUtils(gridRef, outerGridElementRef, gridItemsRenderedRef, rerenderGridBodyRef) {
266
+ var _this2;
267
+
268
+ _classCallCheck(this, RowHeightVirtualizationUtils);
269
+
270
+ _this2 = _super.call(this);
271
+ _this2.gridRef = gridRef;
272
+ _this2.outerGridElementRef = outerGridElementRef;
273
+ _this2.gridItemsRenderedRef = gridItemsRenderedRef;
274
+ _this2.rerenderGridBodyRef = rerenderGridBodyRef;
275
+
276
+ _defineProperty(_assertThisInitialized(_this2), "timerId", void 0);
277
+
278
+ _defineProperty(_assertThisInitialized(_this2), "lastUpdatedRow", Infinity);
279
+
280
+ return _this2;
281
+ }
282
+ /**
283
+ * Virtualization workarounds for auto height rows
284
+ */
285
+
286
+
287
+ _createClass(RowHeightVirtualizationUtils, [{
288
+ key: "setRowHeight",
289
+ value: function setRowHeight(rowIndex, colId) {
290
+ var height = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_ROW_HEIGHT;
291
+ var visibleRowIndex = arguments.length > 3 ? arguments[3] : undefined;
292
+
293
+ var didModify = _get(_getPrototypeOf(RowHeightVirtualizationUtils.prototype), "setRowHeight", this).call(this, rowIndex, colId, height, visibleRowIndex); // When an auto row height is updated, force a re-render
294
+ // of the grid body to update the unconstrained height
295
+
296
+
297
+ if (didModify) {
298
+ var _this$rerenderGridBod, _this$rerenderGridBod2;
299
+
300
+ (_this$rerenderGridBod = (_this$rerenderGridBod2 = this.rerenderGridBodyRef).current) === null || _this$rerenderGridBod === void 0 ? void 0 : _this$rerenderGridBod.call(_this$rerenderGridBod2);
301
+ this.resetRow(visibleRowIndex);
302
+ }
303
+
304
+ return didModify; // Mostly just here for typing
305
+ }
306
+ }, {
307
+ key: "pruneHiddenColumnHeights",
308
+ value: function pruneHiddenColumnHeights(visibleColumns) {
309
+ var didModify = _get(_getPrototypeOf(RowHeightVirtualizationUtils.prototype), "pruneHiddenColumnHeights", this).call(this, visibleColumns);
234
310
 
235
311
  if (didModify) {
236
312
  this.resetRow(0);
237
313
  }
314
+
315
+ return didModify; // Mostly just here for typing
238
316
  }
239
317
  }, {
240
318
  key: "resetRow",
241
319
  value: function resetRow(visibleRowIndex) {
242
- var _this2 = this;
320
+ var _this3 = this;
243
321
 
244
322
  // save the first row index of batch, reassigning it only
245
323
  // if this visible row index less than lastUpdatedRow
246
324
  this.lastUpdatedRow = Math.min(this.lastUpdatedRow, visibleRowIndex);
247
325
  clearTimeout(this.timerId);
248
326
  this.timerId = window.setTimeout(function () {
249
- return _this2.resetGrid();
327
+ return _this3.resetGrid();
250
328
  }, 0);
251
329
  }
252
330
  }, {
@@ -284,27 +362,32 @@ var RowHeightUtils = /*#__PURE__*/function () {
284
362
  }
285
363
  }]);
286
364
 
287
- return RowHeightUtils;
288
- }();
365
+ return RowHeightVirtualizationUtils;
366
+ }(RowHeightUtils);
289
367
  /**
290
368
  * Hook for instantiating RowHeightUtils, setting internal class vars,
291
369
  * and setting up various row-height-related side effects
292
370
  */
293
371
 
294
372
 
295
- exports.RowHeightUtils = RowHeightUtils;
373
+ exports.RowHeightVirtualizationUtils = RowHeightVirtualizationUtils;
296
374
 
297
375
  var useRowHeightUtils = function useRowHeightUtils(_ref2) {
298
- var gridRef = _ref2.gridRef,
299
- outerGridElementRef = _ref2.outerGridElementRef,
300
- gridItemsRenderedRef = _ref2.gridItemsRenderedRef,
376
+ var virtualization = _ref2.virtualization,
377
+ rowHeightsOptions = _ref2.rowHeightsOptions,
301
378
  gridStyles = _ref2.gridStyles,
302
- columns = _ref2.columns,
303
- rowHeightsOptions = _ref2.rowHeightsOptions;
379
+ columns = _ref2.columns;
304
380
  var forceRenderRef = (0, _services.useLatest)((0, _services.useForceRender)());
305
381
 
306
382
  var _useState = (0, _react.useState)(function () {
307
- return new RowHeightUtils(gridRef, outerGridElementRef, gridItemsRenderedRef, forceRenderRef);
383
+ if (virtualization) {
384
+ var _gridRef = virtualization.gridRef,
385
+ _outerGridElementRef = virtualization.outerGridElementRef,
386
+ _gridItemsRenderedRef = virtualization.gridItemsRenderedRef;
387
+ return new RowHeightVirtualizationUtils(_gridRef, _outerGridElementRef, _gridItemsRenderedRef, forceRenderRef);
388
+ } else {
389
+ return new RowHeightUtils();
390
+ }
308
391
  }),
309
392
  _useState2 = _slicedToArray(_useState, 1),
310
393
  rowHeightUtils = _useState2[0]; // Forces a rerender whenever the row heights change, as this can cause the
@@ -178,7 +178,8 @@ var EuiAutoRefreshButton = function EuiAutoRefreshButton(_ref2) {
178
178
  isOpen: isPopoverOpen,
179
179
  closePopover: function closePopover() {
180
180
  setIsPopoverOpen(false);
181
- }
181
+ },
182
+ popoverScreenReaderText: isPaused ? autoRefeshLabelOff : autoRefeshLabelOn
182
183
  }, (0, _react2.jsx)(_refresh_interval.EuiRefreshInterval, {
183
184
  onRefreshChange: onRefreshChange,
184
185
  isPaused: isPaused,
@@ -49,6 +49,8 @@ var _range = require("./range.styles");
49
49
 
50
50
  var _dual_range = require("./dual_range.styles");
51
51
 
52
+ var _i18n = require("../../i18n");
53
+
52
54
  var _react2 = require("@emotion/react");
53
55
 
54
56
  var _excluded = ["className", "css", "compressed", "disabled", "fullWidth", "isLoading", "readOnly", "id", "max", "min", "name", "step", "showLabels", "showInput", "showTicks", "tickInterval", "ticks", "levels", "onBlur", "onChange", "onFocus", "showRange", "value", "isInvalid", "append", "prepend", "minInputProps", "maxInputProps", "isDraggable", "theme"];
@@ -598,6 +600,10 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
598
600
  var rightThumbStyles = rightThumbColor ? _objectSpread(_objectSpread({}, rightThumbPosition), {}, {
599
601
  backgroundColor: (0, _range_levels_colors.euiRangeLevelColor)(rightThumbColor, theme.euiTheme)
600
602
  }) : rightThumbPosition;
603
+ var dualSliderScreenReaderInstructions = (0, _react2.jsx)(_i18n.EuiI18n, {
604
+ token: "euiDualRange.sliderScreenReaderInstructions",
605
+ default: "You are in a custom range slider. Use the Up and Down arrow keys to change the minimum value. Press Tab to interact with the maximum value."
606
+ });
601
607
  var theRange = (0, _react2.jsx)(_range_wrapper.EuiRangeWrapper, {
602
608
  css: cssStyles,
603
609
  className: classes,
@@ -653,8 +659,8 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
653
659
  onFocus: _this2.onThumbFocus,
654
660
  onBlur: _this2.onThumbBlur,
655
661
  onKeyDown: _this2.handleDraggableKeyDown,
656
- "aria-describedby": _this2.props['aria-describedby'],
657
- "aria-label": _this2.props['aria-label']
662
+ "aria-describedby": showInputOnly ? undefined : _this2.props['aria-describedby'],
663
+ "aria-label": showInputOnly ? undefined : _this2.props['aria-label']
658
664
  }), (0, _react2.jsx)(_range_thumb.EuiRangeThumb, {
659
665
  min: min,
660
666
  max: Number(_this2.upperValue),
@@ -666,8 +672,8 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
666
672
  onFocus: _this2.onThumbFocus,
667
673
  onBlur: _this2.onThumbBlur,
668
674
  style: (0, _global_styling.logicalStyles)(leftThumbStyles),
669
- "aria-describedby": _this2.props['aria-describedby'],
670
- "aria-label": _this2.props['aria-label']
675
+ "aria-describedby": showInputOnly ? undefined : _this2.props['aria-describedby'],
676
+ "aria-label": showInputOnly ? undefined : _this2.props['aria-label']
671
677
  }), (0, _react2.jsx)(_range_thumb.EuiRangeThumb, {
672
678
  min: Number(_this2.lowerValue),
673
679
  max: max,
@@ -679,8 +685,8 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
679
685
  onFocus: _this2.onThumbFocus,
680
686
  onBlur: _this2.onThumbBlur,
681
687
  style: (0, _global_styling.logicalStyles)(rightThumbStyles),
682
- "aria-describedby": _this2.props['aria-describedby'],
683
- "aria-label": _this2.props['aria-label']
688
+ "aria-describedby": showInputOnly ? undefined : _this2.props['aria-describedby'],
689
+ "aria-label": showInputOnly ? undefined : _this2.props['aria-label']
684
690
  })), showRange && _this2.isValid && (0, _react2.jsx)(_range_highlight.EuiRangeHighlight, {
685
691
  showTicks: showTicks,
686
692
  min: Number(min),
@@ -713,7 +719,8 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
713
719
  isOpen: this.state.isPopoverOpen,
714
720
  closePopover: this.closePopover,
715
721
  disableFocusTrap: true,
716
- onPanelResize: this.onResize
722
+ onPanelResize: this.onResize,
723
+ popoverScreenReaderText: dualSliderScreenReaderInstructions
717
724
  }, theRange) : undefined;
718
725
  return thePopover || theRange;
719
726
  }
@@ -39,6 +39,8 @@ var _range_wrapper = require("./range_wrapper");
39
39
 
40
40
  var _range = require("./range.styles");
41
41
 
42
+ var _i18n = require("../../i18n");
43
+
42
44
  var _react2 = require("@emotion/react");
43
45
 
44
46
  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"];
@@ -220,6 +222,10 @@ var EuiRangeClass = /*#__PURE__*/function (_Component) {
220
222
  var styles = (0, _range.euiRangeStyles)(theme);
221
223
  var cssStyles = [styles.euiRange, showInput && styles.hasInput];
222
224
  var thumbColor = levels && (0, _range_levels_colors.getLevelColor)(levels, Number(value));
225
+ var sliderScreenReaderInstructions = (0, _react2.jsx)(_i18n.EuiI18n, {
226
+ token: "euiRange.sliderScreenReaderInstructions",
227
+ default: "You are in a custom range slider. Use the Up and Down arrow keys to change the value."
228
+ });
223
229
  var theRange = (0, _react2.jsx)(_range_wrapper.EuiRangeWrapper, {
224
230
  className: classes,
225
231
  css: cssStyles,
@@ -240,7 +246,7 @@ var EuiRangeClass = /*#__PURE__*/function (_Component) {
240
246
  levels: levels,
241
247
  onChange: this.handleOnChange,
242
248
  value: value,
243
- "aria-hidden": showInput === true,
249
+ "aria-hidden": !!showInput,
244
250
  showRange: showRange
245
251
  }, function (trackWidth) {
246
252
  return (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(_range_slider.EuiRangeSlider, _extends({
@@ -261,7 +267,7 @@ var EuiRangeClass = /*#__PURE__*/function (_Component) {
261
267
  } : undefined,
262
268
  onFocus: showInput === true ? undefined : onFocus,
263
269
  onBlur: showInputOnly ? _this2.onInputBlur : onBlur,
264
- "aria-hidden": showInput === true ? true : false,
270
+ "aria-hidden": !!showInput,
265
271
  thumbColor: thumbColor
266
272
  }, rest)), showRange && _this2.isValid && (0, _react2.jsx)(_range_highlight.EuiRangeHighlight, {
267
273
  showTicks: showTicks,
@@ -294,7 +300,8 @@ var EuiRangeClass = /*#__PURE__*/function (_Component) {
294
300
  fullWidth: fullWidth,
295
301
  isOpen: this.state.isPopoverOpen,
296
302
  closePopover: this.closePopover,
297
- disableFocusTrap: true
303
+ disableFocusTrap: true,
304
+ popoverScreenReaderText: sliderScreenReaderInstructions
298
305
  }, theRange) : undefined;
299
306
  return thePopover ? thePopover : theRange;
300
307
  }
@@ -27,7 +27,7 @@ var _i18n = require("../../i18n");
27
27
 
28
28
  var _react2 = require("@emotion/react");
29
29
 
30
- var _excluded = ["className", "options", "valueOfSelected", "onChange", "isOpen", "isInvalid", "hasDividers", "itemClassName", "itemLayoutAlign", "fullWidth", "popoverProps", "compressed"],
30
+ var _excluded = ["className", "options", "valueOfSelected", "placeholder", "onChange", "isOpen", "isInvalid", "hasDividers", "itemClassName", "itemLayoutAlign", "fullWidth", "popoverProps", "compressed"],
31
31
  _excluded2 = ["value", "dropdownDisplay", "inputDisplay"];
32
32
 
33
33
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -93,8 +93,6 @@ var EuiSuperSelect = /*#__PURE__*/function (_Component) {
93
93
 
94
94
  _defineProperty(_assertThisInitialized(_this), "describedById", (0, _services.htmlIdGenerator)('euiSuperSelect_')('_screenreaderDescribeId'));
95
95
 
96
- _defineProperty(_assertThisInitialized(_this), "labelledById", (0, _services.htmlIdGenerator)('euiSuperSelect_')('_screenreaderLabelId'));
97
-
98
96
  _defineProperty(_assertThisInitialized(_this), "state", {
99
97
  isPopoverOpen: _this.props.isOpen || false
100
98
  });
@@ -260,6 +258,7 @@ var EuiSuperSelect = /*#__PURE__*/function (_Component) {
260
258
  className = _this$props.className,
261
259
  options = _this$props.options,
262
260
  valueOfSelected = _this$props.valueOfSelected,
261
+ placeholder = _this$props.placeholder,
263
262
  onChange = _this$props.onChange,
264
263
  isOpen = _this$props.isOpen,
265
264
  isInvalid = _this$props.isInvalid,
@@ -279,9 +278,9 @@ var EuiSuperSelect = /*#__PURE__*/function (_Component) {
279
278
  'euiSuperSelect__item--hasDividers': hasDividers
280
279
  }, itemClassName);
281
280
  var button = (0, _react2.jsx)(_super_select_control.EuiSuperSelectControl, _extends({
282
- screenReaderId: this.labelledById,
283
281
  options: options,
284
282
  value: valueOfSelected,
283
+ placeholder: placeholder,
285
284
  onClick: this.state.isPopoverOpen ? this.closePopover : this.openPopover,
286
285
  onKeyDown: this.onSelectKeyDown,
287
286
  className: buttonClasses,
@@ -325,14 +324,19 @@ var EuiSuperSelect = /*#__PURE__*/function (_Component) {
325
324
  }, (0, _react2.jsx)(_i18n.EuiI18n, {
326
325
  token: "euiSuperSelect.screenReaderAnnouncement",
327
326
  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."
328
- }))), (0, _react2.jsx)("div", {
329
- "aria-labelledby": this.labelledById,
330
- "aria-describedby": this.describedById,
331
- className: "euiSuperSelect__listbox",
332
- role: "listbox",
333
- "aria-activedescendant": valueOfSelected,
334
- tabIndex: 0
335
- }, items));
327
+ }))), (0, _react2.jsx)(_i18n.EuiI18n, {
328
+ token: "euiSuperSelect.ariaLabel",
329
+ default: "Select listbox"
330
+ }, function (ariaLabel) {
331
+ return (0, _react2.jsx)("div", {
332
+ "aria-label": ariaLabel,
333
+ "aria-describedby": _this2.describedById,
334
+ className: "euiSuperSelect__listbox",
335
+ role: "listbox",
336
+ "aria-activedescendant": valueOfSelected,
337
+ tabIndex: 0
338
+ }, items);
339
+ }));
336
340
  }
337
341
  }]);
338
342
 
@@ -379,6 +383,11 @@ EuiSuperSelect.propTypes = {
379
383
  readOnly: _propTypes.default.bool,
380
384
  name: _propTypes.default.string,
381
385
 
386
+ /**
387
+ * Placeholder to display when the current selected value is empty.
388
+ */
389
+ placeholder: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.node]),
390
+
382
391
  /**
383
392
  * Creates an input group with element(s) coming before input.
384
393
  * `string` | `ReactElement` or an array of these
@@ -391,12 +400,6 @@ EuiSuperSelect.propTypes = {
391
400
  */
392
401
  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]),
393
402
 
394
- /**
395
- * Creates a semantic label ID for the `div[role="listbox"]` that's opened on click or keypress.
396
- * __Generated and passed down by `EuiSuperSelect`.__
397
- */
398
- screenReaderId: _propTypes.default.string,
399
-
400
403
  /**
401
404
  * Pass an array of options that must at least include:
402
405
  * `value`: storing unique value of item,
@@ -11,19 +11,15 @@ var _react = _interopRequireWildcard(require("react"));
11
11
 
12
12
  var _classnames = _interopRequireDefault(require("classnames"));
13
13
 
14
- var _accessibility = require("../../accessibility");
15
-
16
14
  var _form_control_layout = require("../form_control_layout");
17
15
 
18
- var _i18n = require("../../i18n");
19
-
20
16
  var _num_icons = require("../form_control_layout/_num_icons");
21
17
 
22
18
  var _eui_form_context = require("../eui_form_context");
23
19
 
24
20
  var _react2 = require("@emotion/react");
25
21
 
26
- var _excluded = ["className", "options", "id", "name", "fullWidth", "isLoading", "isInvalid", "readOnly", "defaultValue", "compressed", "value", "prepend", "append", "screenReaderId", "disabled"];
22
+ var _excluded = ["className", "options", "id", "name", "fullWidth", "isLoading", "isInvalid", "readOnly", "defaultValue", "compressed", "value", "placeholder", "prepend", "append", "disabled"];
27
23
 
28
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
25
 
@@ -57,9 +53,9 @@ var EuiSuperSelectControl = function EuiSuperSelectControl(props) {
57
53
  _props$compressed = props.compressed,
58
54
  compressed = _props$compressed === void 0 ? false : _props$compressed,
59
55
  value = props.value,
56
+ placeholder = props.placeholder,
60
57
  prepend = props.prepend,
61
58
  append = props.append,
62
- screenReaderId = props.screenReaderId,
63
59
  disabled = props.disabled,
64
60
  rest = _objectWithoutProperties(props, _excluded);
65
61
 
@@ -92,6 +88,7 @@ var EuiSuperSelectControl = function EuiSuperSelectControl(props) {
92
88
  selectedValue = selectedOption ? selectedOption.inputDisplay : selectedValue;
93
89
  }
94
90
 
91
+ var showPlaceholder = !!placeholder && !selectedValue;
95
92
  return (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)("input", {
96
93
  type: "hidden",
97
94
  id: id,
@@ -109,22 +106,16 @@ var EuiSuperSelectControl = function EuiSuperSelectControl(props) {
109
106
  compressed: compressed,
110
107
  prepend: prepend,
111
108
  append: append
112
- }, (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("span", {
113
- id: screenReaderId
114
- }, (0, _react2.jsx)(_i18n.EuiI18n, {
115
- token: "euiSuperSelectControl.selectAnOption",
116
- default: "Select an option: {selectedValue}, is selected",
117
- values: {
118
- selectedValue: selectedValue
119
- }
120
- }))), (0, _react2.jsx)("button", _extends({
109
+ }, (0, _react2.jsx)("button", _extends({
121
110
  type: "button",
122
111
  className: classes,
123
112
  "aria-haspopup": "listbox",
124
113
  disabled: disabled || readOnly // @ts-ignore Using as a selector only for mixin use
125
114
  ,
126
115
  readOnly: readOnly
127
- }, rest), selectedValue)));
116
+ }, rest), showPlaceholder ? (0, _react2.jsx)("span", {
117
+ className: "euiSuperSelectControl__placeholder"
118
+ }, placeholder) : selectedValue)));
128
119
  };
129
120
 
130
121
  exports.EuiSuperSelectControl = EuiSuperSelectControl;