@elastic/eui 121.0.0-snapshot.1788869799640 → 121.0.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 (69) hide show
  1. package/dist/eui-icons.json +10 -10
  2. package/es/components/datagrid/body/cell/data_grid_cell.js +5 -8
  3. package/es/components/datagrid/body/cell/data_grid_cell.styles.js +1 -1
  4. package/es/components/datagrid/body/cell/data_grid_cell_wrapper.js +2 -4
  5. package/es/components/datagrid/body/footer/data_grid_footer_row.js +0 -4
  6. package/es/components/datagrid/body/header/column_resizer.js +87 -74
  7. package/es/components/datagrid/body/header/data_grid_control_header_cell.js +1 -2
  8. package/es/components/datagrid/body/header/data_grid_header_cell.js +0 -1
  9. package/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +3 -9
  10. package/es/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -1
  11. package/es/components/datagrid/controls/keyboard_shortcuts.js +1 -17
  12. package/es/components/datagrid/data_grid.js +0 -2
  13. package/es/components/form/super_select/super_select.js +351 -247
  14. package/eui.d.ts +55 -30
  15. package/i18ntokens.json +205 -277
  16. package/lib/components/datagrid/body/cell/data_grid_cell.js +5 -8
  17. package/lib/components/datagrid/body/cell/data_grid_cell.styles.js +1 -1
  18. package/lib/components/datagrid/body/cell/data_grid_cell_wrapper.js +2 -4
  19. package/lib/components/datagrid/body/footer/data_grid_footer_row.js +0 -4
  20. package/lib/components/datagrid/body/header/column_resizer.js +85 -73
  21. package/lib/components/datagrid/body/header/data_grid_control_header_cell.js +1 -2
  22. package/lib/components/datagrid/body/header/data_grid_header_cell.js +0 -1
  23. package/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +3 -9
  24. package/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -1
  25. package/lib/components/datagrid/controls/keyboard_shortcuts.js +1 -17
  26. package/lib/components/datagrid/data_grid.js +0 -2
  27. package/lib/components/form/super_select/super_select.js +355 -253
  28. package/optimize/es/components/datagrid/body/cell/data_grid_cell.js +4 -5
  29. package/optimize/es/components/datagrid/body/cell/data_grid_cell.styles.js +1 -1
  30. package/optimize/es/components/datagrid/body/cell/data_grid_cell_wrapper.js +2 -4
  31. package/optimize/es/components/datagrid/body/footer/data_grid_footer_row.js +0 -4
  32. package/optimize/es/components/datagrid/body/header/column_resizer.js +81 -69
  33. package/optimize/es/components/datagrid/body/header/data_grid_control_header_cell.js +1 -2
  34. package/optimize/es/components/datagrid/body/header/data_grid_header_cell.js +0 -1
  35. package/optimize/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +3 -7
  36. package/optimize/es/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -1
  37. package/optimize/es/components/datagrid/controls/keyboard_shortcuts.js +1 -17
  38. package/optimize/es/components/datagrid/data_grid.js +0 -2
  39. package/optimize/es/components/form/super_select/super_select.js +265 -242
  40. package/optimize/lib/components/datagrid/body/cell/data_grid_cell.js +4 -5
  41. package/optimize/lib/components/datagrid/body/cell/data_grid_cell.styles.js +1 -1
  42. package/optimize/lib/components/datagrid/body/cell/data_grid_cell_wrapper.js +2 -4
  43. package/optimize/lib/components/datagrid/body/footer/data_grid_footer_row.js +0 -4
  44. package/optimize/lib/components/datagrid/body/header/column_resizer.js +79 -69
  45. package/optimize/lib/components/datagrid/body/header/data_grid_control_header_cell.js +1 -2
  46. package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.js +0 -1
  47. package/optimize/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +3 -7
  48. package/optimize/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -1
  49. package/optimize/lib/components/datagrid/controls/keyboard_shortcuts.js +1 -17
  50. package/optimize/lib/components/datagrid/data_grid.js +0 -2
  51. package/optimize/lib/components/form/super_select/super_select.js +265 -243
  52. package/package.json +7 -8
  53. package/test-env/components/datagrid/body/cell/data_grid_cell.js +5 -8
  54. package/test-env/components/datagrid/body/cell/data_grid_cell.styles.js +1 -1
  55. package/test-env/components/datagrid/body/cell/data_grid_cell_wrapper.js +2 -4
  56. package/test-env/components/datagrid/body/footer/data_grid_footer_row.js +0 -4
  57. package/test-env/components/datagrid/body/header/column_resizer.js +79 -69
  58. package/test-env/components/datagrid/body/header/data_grid_control_header_cell.js +1 -2
  59. package/test-env/components/datagrid/body/header/data_grid_header_cell.js +0 -1
  60. package/test-env/components/datagrid/body/header/data_grid_header_cell_wrapper.js +3 -9
  61. package/test-env/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -1
  62. package/test-env/components/datagrid/controls/keyboard_shortcuts.js +1 -17
  63. package/test-env/components/datagrid/data_grid.js +0 -2
  64. package/test-env/components/form/super_select/super_select.js +345 -243
  65. package/es/components/datagrid/utils/copy_focused_cell.js +0 -34
  66. package/lib/components/datagrid/utils/copy_focused_cell.js +0 -39
  67. package/optimize/es/components/datagrid/utils/copy_focused_cell.js +0 -34
  68. package/optimize/lib/components/datagrid/utils/copy_focused_cell.js +0 -39
  69. package/test-env/components/datagrid/utils/copy_focused_cell.js +0 -16
@@ -7,8 +7,13 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.EuiSuperSelect = void 0;
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
10
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
12
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
14
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
15
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
16
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
17
  var _react = _interopRequireWildcard(require("react"));
13
18
  var _classnames = _interopRequireDefault(require("classnames"));
14
19
  var _services = require("../../../services");
@@ -19,271 +24,288 @@ var _super_select_control = require("./super_select_control");
19
24
  var _super_select_item = require("./super_select_item");
20
25
  var _super_select = require("./super_select.styles");
21
26
  var _react2 = require("@emotion/react");
22
- var _excluded = ["className", "options", "valueOfSelected", "placeholder", "onChange", "onFocus", "onBlur", "isOpen", "isInvalid", "itemClassName", "fullWidth", "popoverProps", "compressed", "isLoading"],
27
+ var _excluded = ["className", "options", "valueOfSelected", "placeholder", "onChange", "isOpen", "isInvalid", "itemClassName", "fullWidth", "popoverProps", "compressed"],
23
28
  _excluded2 = ["value", "dropdownDisplay", "inputDisplay", "disabled"];
24
- /*
29
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
30
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
31
+ function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
32
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /*
25
33
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
26
34
  * or more contributor license agreements. Licensed under the Elastic License
27
35
  * 2.0 and the Server Side Public License, v 1; you may not use this file except
28
36
  * in compliance with, at your election, the Elastic License 2.0 or the Server
29
37
  * Side Public License, v 1.
30
38
  */
31
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
32
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
33
39
  var ShiftDirection = /*#__PURE__*/function (ShiftDirection) {
34
40
  ShiftDirection["BACK"] = "back";
35
41
  ShiftDirection["FORWARD"] = "forward";
36
42
  return ShiftDirection;
37
- }(ShiftDirection || {}); // Runs synchronously on the client before paint, so the mount flag is always
38
- // set before an interaction can schedule the deferred focus in `openPopover`.
39
- var useMountEffect = typeof document === 'undefined' ? _react.useEffect : _react.useLayoutEffect;
40
- var EuiSuperSelectInner = function EuiSuperSelectInner(_ref, ref) {
41
- var _options$currentIndex;
42
- var className = _ref.className,
43
- options = _ref.options,
44
- valueOfSelected = _ref.valueOfSelected,
45
- placeholder = _ref.placeholder,
46
- onChange = _ref.onChange,
47
- onFocus = _ref.onFocus,
48
- onBlur = _ref.onBlur,
49
- isOpen = _ref.isOpen,
50
- _ref$isInvalid = _ref.isInvalid,
51
- isInvalid = _ref$isInvalid === void 0 ? false : _ref$isInvalid,
52
- itemClassName = _ref.itemClassName,
53
- _ref$fullWidth = _ref.fullWidth,
54
- fullWidth = _ref$fullWidth === void 0 ? false : _ref$fullWidth,
55
- popoverProps = _ref.popoverProps,
56
- _ref$compressed = _ref.compressed,
57
- compressed = _ref$compressed === void 0 ? false : _ref$compressed,
58
- _ref$isLoading = _ref.isLoading,
59
- isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
60
- rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
61
- var styles = (0, _services.useEuiMemoizedStyles)(_super_select.euiSuperSelectStyles);
62
- var itemNodes = (0, _react.useRef)([]);
63
- var isMounted = (0, _react.useRef)(false);
64
- var controlButtonRef = (0, _react.useRef)(null);
65
- var _useState = (0, _react.useState)(function () {
66
- return (0, _services.htmlIdGenerator)('euiSuperSelect_')('_screenreaderDescribeId');
67
- }),
68
- _useState2 = (0, _slicedToArray2.default)(_useState, 1),
69
- describedById = _useState2[0];
70
- var _useState3 = (0, _react.useState)(isOpen || false),
71
- _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
72
- isPopoverOpen = _useState4[0],
73
- setIsPopoverOpen = _useState4[1];
74
- var _useState5 = (0, _react.useState)(0),
75
- _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
76
- currentIndex = _useState6[0],
77
- setCurrentIndex = _useState6[1];
78
- var setItemNode = function setItemNode(node, index) {
79
- itemNodes.current[index] = node;
80
- };
81
- var focusItemAt = (0, _react.useCallback)(function (index) {
82
- var _itemNodes$current$in;
83
- (_itemNodes$current$in = itemNodes.current[index]) === null || _itemNodes$current$in === void 0 || _itemNodes$current$in.focus();
84
- }, []);
85
- var openPopover = (0, _react.useCallback)(function () {
86
- var indexOfSelected = options.findIndex(function (option) {
87
- return (option === null || option === void 0 ? void 0 : option.value) === valueOfSelected;
43
+ }(ShiftDirection || {});
44
+ var EuiSuperSelect = exports.EuiSuperSelect = /*#__PURE__*/function (_Component) {
45
+ function EuiSuperSelect() {
46
+ var _this;
47
+ (0, _classCallCheck2.default)(this, EuiSuperSelect);
48
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
49
+ args[_key] = arguments[_key];
50
+ }
51
+ _this = _callSuper(this, EuiSuperSelect, [].concat(args));
52
+ (0, _defineProperty2.default)(_this, "itemNodes", []);
53
+ (0, _defineProperty2.default)(_this, "_isMounted", false);
54
+ (0, _defineProperty2.default)(_this, "controlButtonRef", /*#__PURE__*/(0, _react.createRef)());
55
+ (0, _defineProperty2.default)(_this, "describedById", (0, _services.htmlIdGenerator)('euiSuperSelect_')('_screenreaderDescribeId'));
56
+ (0, _defineProperty2.default)(_this, "state", {
57
+ isPopoverOpen: _this.props.isOpen || false,
58
+ currentIndex: 0
59
+ });
60
+ (0, _defineProperty2.default)(_this, "setItemNode", function (node, index) {
61
+ _this.itemNodes[index] = node;
88
62
  });
89
- var candidateIndex = valueOfSelected != null && indexOfSelected >= 0 ? indexOfSelected : 0;
90
- var initialIndex = candidateIndex;
63
+ (0, _defineProperty2.default)(_this, "openPopover", function () {
64
+ var _this$props = _this.props,
65
+ options = _this$props.options,
66
+ valueOfSelected = _this$props.valueOfSelected;
67
+ var indexOfSelected = options.findIndex(function (option) {
68
+ return (option === null || option === void 0 ? void 0 : option.value) === valueOfSelected;
69
+ });
70
+ var candidateIndex = valueOfSelected != null && indexOfSelected >= 0 ? indexOfSelected : 0;
71
+ var initialIndex = candidateIndex;
91
72
 
92
- // If the item is disabled, find the first focusable item going forward
93
- while (initialIndex < options.length && (_options$initialIndex = options[initialIndex]) !== null && _options$initialIndex !== void 0 && _options$initialIndex.disabled) {
94
- var _options$initialIndex;
95
- initialIndex++;
96
- }
97
- if (initialIndex >= options.length) {
98
- initialIndex = candidateIndex;
99
- }
100
- setIsPopoverOpen(options.length > 0);
101
- setCurrentIndex(initialIndex);
102
- requestAnimationFrame(function () {
73
+ // If the item is disabled, find the first focusable item going forward
74
+ while (initialIndex < options.length && (_options$initialIndex = options[initialIndex]) !== null && _options$initialIndex !== void 0 && _options$initialIndex.disabled) {
75
+ var _options$initialIndex;
76
+ initialIndex++;
77
+ }
78
+ if (initialIndex >= options.length) {
79
+ initialIndex = candidateIndex;
80
+ }
81
+ _this.setState({
82
+ isPopoverOpen: options.length > 0,
83
+ currentIndex: initialIndex
84
+ });
103
85
  requestAnimationFrame(function () {
104
- if (!isMounted.current) {
105
- return;
106
- }
107
- focusItemAt(initialIndex);
108
- if (onFocus) {
109
- onFocus();
110
- }
86
+ requestAnimationFrame(function () {
87
+ if (!_this._isMounted) {
88
+ return;
89
+ }
90
+ _this.focusItemAt(initialIndex);
91
+ if (_this.props.onFocus) {
92
+ _this.props.onFocus();
93
+ }
94
+ });
111
95
  });
112
96
  });
113
- }, [options, valueOfSelected, onFocus, focusItemAt]);
114
- var closePopover = (0, _react.useCallback)(function () {
115
- setIsPopoverOpen(false);
116
- setCurrentIndex(-1);
97
+ (0, _defineProperty2.default)(_this, "closePopover", function () {
98
+ _this.setState({
99
+ isPopoverOpen: false,
100
+ currentIndex: -1
101
+ });
117
102
 
118
- // Refocus back to the toggling control button on popover close
119
- requestAnimationFrame(function () {
120
- var _controlButtonRef$cur;
121
- (_controlButtonRef$cur = controlButtonRef.current) === null || _controlButtonRef$cur === void 0 || _controlButtonRef$cur.focus();
103
+ // Refocus back to the toggling control button on popover close
104
+ requestAnimationFrame(function () {
105
+ var _this$controlButtonRe;
106
+ (_this$controlButtonRe = _this.controlButtonRef.current) === null || _this$controlButtonRe === void 0 || _this$controlButtonRe.focus();
107
+ });
108
+ if (_this.props.onBlur) {
109
+ _this.props.onBlur();
110
+ }
122
111
  });
123
- if (onBlur) {
124
- onBlur();
125
- }
126
- }, [onBlur]);
127
- (0, _react.useImperativeHandle)(ref, function () {
128
- return {
129
- openPopover: openPopover,
130
- closePopover: closePopover
131
- };
132
- }, [openPopover, closePopover]);
133
- var itemClicked = function itemClicked(value) {
134
- closePopover();
135
- if (onChange) {
136
- onChange(value);
137
- }
138
- };
139
- var onSelectKeyDown = function onSelectKeyDown(event) {
140
- // Mimic the ways native `<select>`s can be opened via keypress
141
- if (event.key === _services.keys.ARROW_UP || event.key === _services.keys.ARROW_DOWN || event.key === _services.keys.SPACE) {
142
- event.preventDefault();
143
- event.stopPropagation();
144
- openPopover();
145
- }
146
- };
147
- var onItemKeyDown = function onItemKeyDown(event) {
148
- switch (event.key) {
149
- case _services.keys.ESCAPE:
150
- // close the popover and prevent ancestors from handling
151
- event.preventDefault();
152
- event.stopPropagation();
153
- closePopover();
154
- break;
155
- case _services.keys.TAB:
156
- // Mimic native `<select>` behavior, which selects an item on tab press
157
- event.preventDefault();
158
- event.stopPropagation();
159
- event.target.click();
160
- break;
161
- case _services.keys.ARROW_UP:
162
- event.preventDefault();
163
- event.stopPropagation();
164
- shiftFocus(ShiftDirection.BACK);
165
- break;
166
- case _services.keys.ARROW_DOWN:
112
+ (0, _defineProperty2.default)(_this, "itemClicked", function (value) {
113
+ _this.closePopover();
114
+ if (_this.props.onChange) {
115
+ _this.props.onChange(value);
116
+ }
117
+ });
118
+ (0, _defineProperty2.default)(_this, "onSelectKeyDown", function (event) {
119
+ // Mimic the ways native `<select>`s can be opened via keypress
120
+ if (event.key === _services.keys.ARROW_UP || event.key === _services.keys.ARROW_DOWN || event.key === _services.keys.SPACE) {
167
121
  event.preventDefault();
168
122
  event.stopPropagation();
169
- shiftFocus(ShiftDirection.FORWARD);
170
- break;
123
+ _this.openPopover();
124
+ }
125
+ });
126
+ (0, _defineProperty2.default)(_this, "onItemKeyDown", function (event) {
127
+ switch (event.key) {
128
+ case _services.keys.ESCAPE:
129
+ // close the popover and prevent ancestors from handling
130
+ event.preventDefault();
131
+ event.stopPropagation();
132
+ _this.closePopover();
133
+ break;
134
+ case _services.keys.TAB:
135
+ // Mimic native `<select>` behavior, which selects an item on tab press
136
+ event.preventDefault();
137
+ event.stopPropagation();
138
+ event.target.click();
139
+ break;
140
+ case _services.keys.ARROW_UP:
141
+ event.preventDefault();
142
+ event.stopPropagation();
143
+ _this.shiftFocus(ShiftDirection.BACK);
144
+ break;
145
+ case _services.keys.ARROW_DOWN:
146
+ event.preventDefault();
147
+ event.stopPropagation();
148
+ _this.shiftFocus(ShiftDirection.FORWARD);
149
+ break;
150
+ }
151
+ });
152
+ return _this;
153
+ }
154
+ (0, _inherits2.default)(EuiSuperSelect, _Component);
155
+ return (0, _createClass2.default)(EuiSuperSelect, [{
156
+ key: "componentDidMount",
157
+ value: function componentDidMount() {
158
+ this._isMounted = true;
159
+ if (this.props.isOpen) {
160
+ this.openPopover();
161
+ }
171
162
  }
172
- };
173
- var shiftFocus = function shiftFocus(direction) {
174
- if (currentIndex === -1) {
175
- // somehow the select options has lost focus
176
- focusItemAt(0);
177
- setCurrentIndex(0);
178
- return;
163
+ }, {
164
+ key: "componentWillUnmount",
165
+ value: function componentWillUnmount() {
166
+ this._isMounted = false;
179
167
  }
180
-
181
- // Note: this component purposely does not cycle arrow key navigation
182
- // to match native <select> elements
183
- var step = direction === ShiftDirection.BACK ? -1 : 1;
184
- var nextIndex = currentIndex + step;
185
- while (nextIndex >= 0 && nextIndex < options.length) {
186
- var _options$nextIndex;
187
- if (!((_options$nextIndex = options[nextIndex]) !== null && _options$nextIndex !== void 0 && _options$nextIndex.disabled)) {
188
- focusItemAt(nextIndex);
189
- setCurrentIndex(nextIndex);
168
+ }, {
169
+ key: "focusItemAt",
170
+ value: function focusItemAt(index) {
171
+ var _this$itemNodes$index;
172
+ (_this$itemNodes$index = this.itemNodes[index]) === null || _this$itemNodes$index === void 0 || _this$itemNodes$index.focus();
173
+ }
174
+ }, {
175
+ key: "shiftFocus",
176
+ value: function shiftFocus(direction) {
177
+ var options = this.props.options;
178
+ var currentIndex = this.state.currentIndex;
179
+ if (currentIndex === -1) {
180
+ // somehow the select options has lost focus
181
+ this.focusItemAt(0);
182
+ this.setState({
183
+ currentIndex: 0
184
+ });
190
185
  return;
191
186
  }
192
- nextIndex += step;
187
+
188
+ // Note: this component purposely does not cycle arrow key navigation
189
+ // to match native <select> elements
190
+ var step = direction === ShiftDirection.BACK ? -1 : 1;
191
+ var nextIndex = currentIndex + step;
192
+ while (nextIndex >= 0 && nextIndex < options.length) {
193
+ var _options$nextIndex;
194
+ if (!((_options$nextIndex = options[nextIndex]) !== null && _options$nextIndex !== void 0 && _options$nextIndex.disabled)) {
195
+ this.focusItemAt(nextIndex);
196
+ this.setState({
197
+ currentIndex: nextIndex
198
+ });
199
+ return;
200
+ }
201
+ nextIndex += step;
202
+ }
193
203
  }
194
- };
195
- useMountEffect(function () {
196
- isMounted.current = true;
197
- if (isOpen) {
198
- openPopover();
204
+ }, {
205
+ key: "render",
206
+ value: function render() {
207
+ var _this2 = this,
208
+ _options$this$state$c;
209
+ var _this$props2 = this.props,
210
+ className = _this$props2.className,
211
+ options = _this$props2.options,
212
+ valueOfSelected = _this$props2.valueOfSelected,
213
+ placeholder = _this$props2.placeholder,
214
+ onChange = _this$props2.onChange,
215
+ isOpen = _this$props2.isOpen,
216
+ isInvalid = _this$props2.isInvalid,
217
+ itemClassName = _this$props2.itemClassName,
218
+ fullWidth = _this$props2.fullWidth,
219
+ popoverProps = _this$props2.popoverProps,
220
+ compressed = _this$props2.compressed,
221
+ rest = (0, _objectWithoutProperties2.default)(_this$props2, _excluded);
222
+ var popoverClasses = (0, _classnames.default)('euiSuperSelect', popoverProps === null || popoverProps === void 0 ? void 0 : popoverProps.className);
223
+ var button = (0, _react2.jsx)(_super_select_control.EuiSuperSelectControl, (0, _extends2.default)({
224
+ options: options,
225
+ value: valueOfSelected,
226
+ placeholder: placeholder,
227
+ onClick: this.state.isPopoverOpen ? this.closePopover : this.openPopover,
228
+ onKeyDown: this.onSelectKeyDown,
229
+ className: className,
230
+ fullWidth: fullWidth,
231
+ isInvalid: isInvalid,
232
+ compressed: compressed
233
+ }, rest, {
234
+ buttonRef: this.controlButtonRef,
235
+ isDropdownOpen: this.state.isPopoverOpen
236
+ }));
237
+ var items = options.map(function (option, index) {
238
+ var value = option.value,
239
+ dropdownDisplay = option.dropdownDisplay,
240
+ inputDisplay = option.inputDisplay,
241
+ disabled = option.disabled,
242
+ optionRest = (0, _objectWithoutProperties2.default)(option, _excluded2);
243
+ if (value == null) return;
244
+ return (0, _react2.jsx)(_super_select_item.EuiSuperSelectItem, (0, _extends2.default)({
245
+ key: index
246
+ /* NOTE: This should rather use "li" to align select-like behavior. But the current
247
+ implementation relies on the interactive and focusable item for the navigation.
248
+ This will require additional refactoring to adjust but we might want to decide first
249
+ if the effort is worth it, considering the unification plans for selection components
250
+ as part of OneSelect (https://github.com/elastic/eui/issues/8808).
251
+ */,
252
+ element: "button",
253
+ id: String(value),
254
+ className: itemClassName,
255
+ checked: valueOfSelected === value ? 'on' : undefined,
256
+ isSelected: valueOfSelected === value,
257
+ isFocused: _this2.state.currentIndex === index,
258
+ isSingleSelection: true,
259
+ isDisabled: disabled,
260
+ textWrap: "wrap",
261
+ onClick: function onClick() {
262
+ return _this2.itemClicked(value);
263
+ },
264
+ onKeyDown: _this2.onItemKeyDown,
265
+ ref: function ref(node) {
266
+ return _this2.setItemNode(node, index);
267
+ },
268
+ "aria-selected": valueOfSelected === value
269
+ }, optionRest), dropdownDisplay || inputDisplay);
270
+ });
271
+ var ariaActiveDescendant = ((_options$this$state$c = options[this.state.currentIndex]) === null || _options$this$state$c === void 0 ? void 0 : _options$this$state$c.value) != null ? String(options[this.state.currentIndex].value) : undefined;
272
+ return (0, _react2.jsx)(_services.RenderWithEuiStylesMemoizer, null, function (stylesMemoizer) {
273
+ var styles = stylesMemoizer(_super_select.euiSuperSelectStyles);
274
+ return (0, _react2.jsx)(_popover.EuiInputPopover, (0, _extends2.default)({
275
+ closePopover: _this2.closePopover,
276
+ panelPaddingSize: "none"
277
+ }, popoverProps, {
278
+ className: popoverClasses,
279
+ isOpen: isOpen || _this2.state.isPopoverOpen,
280
+ input: button,
281
+ fullWidth: fullWidth,
282
+ disableFocusTrap: true // This component handles its own focus manually
283
+ }), (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("p", {
284
+ id: _this2.describedById
285
+ }, (0, _react2.jsx)(_i18n.EuiI18n, {
286
+ token: "euiSuperSelect.screenReaderAnnouncement",
287
+ 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."
288
+ }))), (0, _react2.jsx)(_i18n.EuiI18n, {
289
+ token: "euiSuperSelect.ariaLabel",
290
+ default: "Select listbox"
291
+ }, function (ariaLabel) {
292
+ return (0, _react2.jsx)("div", {
293
+ "aria-label": ariaLabel,
294
+ "aria-describedby": _this2.describedById,
295
+ css: styles.euiSuperSelect__listbox,
296
+ className: "euiSuperSelect__listbox eui-scrollBar",
297
+ role: "listbox",
298
+ "aria-activedescendant": ariaActiveDescendant,
299
+ tabIndex: 0
300
+ }, items);
301
+ }));
302
+ });
199
303
  }
200
- return function () {
201
- isMounted.current = false;
202
- };
203
- // The class lifecycle this replaces only ran when the component mounted.
204
- // eslint-disable-next-line react-hooks/exhaustive-deps
205
- }, []);
206
- var popoverClasses = (0, _classnames.default)('euiSuperSelect', popoverProps === null || popoverProps === void 0 ? void 0 : popoverProps.className);
207
- var button = (0, _react2.jsx)(_super_select_control.EuiSuperSelectControl, (0, _extends2.default)({
208
- options: options,
209
- value: valueOfSelected,
210
- placeholder: placeholder,
211
- onClick: isPopoverOpen ? closePopover : openPopover,
212
- onKeyDown: onSelectKeyDown,
213
- onFocus: onFocus,
214
- onBlur: onBlur,
215
- className: className,
216
- fullWidth: fullWidth,
217
- isInvalid: isInvalid,
218
- compressed: compressed,
219
- isLoading: isLoading
220
- }, rest, {
221
- buttonRef: controlButtonRef,
222
- isDropdownOpen: isPopoverOpen
223
- }));
224
- var items = options.map(function (option, index) {
225
- var value = option.value,
226
- dropdownDisplay = option.dropdownDisplay,
227
- inputDisplay = option.inputDisplay,
228
- disabled = option.disabled,
229
- optionRest = (0, _objectWithoutProperties2.default)(option, _excluded2);
230
- if (value == null) return;
231
- return (0, _react2.jsx)(_super_select_item.EuiSuperSelectItem, (0, _extends2.default)({
232
- key: index
233
- /* NOTE: This should rather use "li" to align select-like behavior. But the current
234
- implementation relies on the interactive and focusable item for the navigation.
235
- This will require additional refactoring to adjust but we might want to decide first
236
- if the effort is worth it, considering the unification plans for selection components
237
- as part of OneSelect (https://github.com/elastic/eui/issues/8808).
238
- */,
239
- element: "button",
240
- id: String(value),
241
- className: itemClassName,
242
- checked: valueOfSelected === value ? 'on' : undefined,
243
- isSelected: valueOfSelected === value,
244
- isFocused: currentIndex === index,
245
- isSingleSelection: true,
246
- isDisabled: disabled,
247
- textWrap: "wrap",
248
- onClick: function onClick() {
249
- return itemClicked(value);
250
- },
251
- onKeyDown: onItemKeyDown,
252
- ref: function ref(node) {
253
- return setItemNode(node, index);
254
- },
255
- "aria-selected": valueOfSelected === value
256
- }, optionRest), dropdownDisplay || inputDisplay);
257
- });
258
- var ariaActiveDescendant = ((_options$currentIndex = options[currentIndex]) === null || _options$currentIndex === void 0 ? void 0 : _options$currentIndex.value) != null ? String(options[currentIndex].value) : undefined;
259
- return (0, _react2.jsx)(_popover.EuiInputPopover, (0, _extends2.default)({
260
- closePopover: closePopover,
261
- panelPaddingSize: "none"
262
- }, popoverProps, {
263
- className: popoverClasses,
264
- isOpen: isOpen || isPopoverOpen,
265
- input: button,
266
- fullWidth: fullWidth,
267
- disableFocusTrap: true // This component handles its own focus manually
268
- }), (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("p", {
269
- id: describedById
270
- }, (0, _react2.jsx)(_i18n.EuiI18n, {
271
- token: "euiSuperSelect.screenReaderAnnouncement",
272
- 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."
273
- }))), (0, _react2.jsx)(_i18n.EuiI18n, {
274
- token: "euiSuperSelect.ariaLabel",
275
- default: "Select listbox"
276
- }, function (ariaLabel) {
277
- return (0, _react2.jsx)("div", {
278
- "aria-label": ariaLabel,
279
- "aria-describedby": describedById,
280
- css: styles.euiSuperSelect__listbox,
281
- className: "euiSuperSelect__listbox eui-scrollBar",
282
- role: "listbox",
283
- "aria-activedescendant": ariaActiveDescendant,
284
- tabIndex: 0
285
- }, items);
286
- }));
287
- };
288
- var EuiSuperSelect = exports.EuiSuperSelect = /*#__PURE__*/(0, _react.forwardRef)(EuiSuperSelectInner);
289
- EuiSuperSelect.displayName = 'EuiSuperSelect';
304
+ }]);
305
+ }(_react.Component);
306
+ (0, _defineProperty2.default)(EuiSuperSelect, "defaultProps", {
307
+ fullWidth: false,
308
+ compressed: false,
309
+ isInvalid: false,
310
+ isLoading: false
311
+ });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@elastic/eui",
3
3
  "description": "Elastic UI Component Library",
4
- "version": "121.0.0-snapshot.1788869799640",
4
+ "version": "121.0.0",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "lib",
7
7
  "module": "es",
@@ -55,7 +55,7 @@
55
55
  "directory": "packages/eui"
56
56
  },
57
57
  "dependencies": {
58
- "@elastic/eui-theme-common": "10.0.0-snapshot.1788869799640",
58
+ "@elastic/eui-theme-common": "10.0.0",
59
59
  "@elastic/prismjs-esql": "^4.13.0",
60
60
  "@hello-pangea/dnd": "^16.6.0",
61
61
  "@types/lodash": "^4.14.202",
@@ -110,9 +110,9 @@
110
110
  "@cypress/react18": "^2.0.0",
111
111
  "@cypress/webpack-dev-server": "^1.7.0",
112
112
  "@elastic/datemath": "^5.0.3",
113
- "@elastic/eslint-plugin-eui": "3.0.0-snapshot.1788869799640",
114
- "@elastic/eui-illustrations": "1.0.2-snapshot.1788869799640",
115
- "@elastic/eui-theme-borealis": "8.0.0-snapshot.1788869799640",
113
+ "@elastic/eslint-plugin-eui": "3.0.0",
114
+ "@elastic/eui-illustrations": "1.0.2",
115
+ "@elastic/eui-theme-borealis": "8.0.0",
116
116
  "@emotion/babel-plugin": "^11.11.0",
117
117
  "@emotion/babel-preset-css-prop": "^11.11.0",
118
118
  "@emotion/cache": "^11.11.0",
@@ -231,7 +231,7 @@
231
231
  },
232
232
  "peerDependencies": {
233
233
  "@elastic/datemath": "^5.0.2",
234
- "@elastic/eui-theme-borealis": "8.0.0-snapshot.1788869799640",
234
+ "@elastic/eui-theme-borealis": "8.0.0",
235
235
  "@emotion/css": "11.x",
236
236
  "@emotion/react": "11.x",
237
237
  "@types/react": "^17.0 || ^18.0",
@@ -255,6 +255,5 @@
255
255
  ],
256
256
  "installConfig": {
257
257
  "hoistingLimits": "workspaces"
258
- },
259
- "stableVersion": "121.0.0"
258
+ }
260
259
  }
@@ -32,7 +32,7 @@ var _focus_utils = require("./focus_utils");
32
32
  var _data_grid_cell = require("./data_grid_cell.styles");
33
33
  var _react2 = require("@emotion/react");
34
34
  var _excluded = ["renderCellValue", "cellContext", "column", "setCellContentsRef", "rowIndex", "colIndex", "rowHeightsOptions", "rowHeightUtils", "isControlColumn"],
35
- _excluded2 = ["width", "popoverContext", "interactiveCellId", "columnType", "className", "column", "style", "rowHeightUtils", "rowHeightsOptions", "rowManager", "pagination", "isLastCopyColumn"],
35
+ _excluded2 = ["width", "popoverContext", "interactiveCellId", "columnType", "className", "column", "style", "rowHeightUtils", "rowHeightsOptions", "rowManager", "pagination"],
36
36
  _excluded3 = ["isExpandable", "style", "className", "data-test-subj"],
37
37
  _excluded4 = ["columnId", "columnIndex", "rowIndex", "visibleRowIndex"];
38
38
  /*
@@ -657,7 +657,6 @@ EuiDataGridCellContent.propTypes = {
657
657
  */
658
658
  onChange: _propTypes.default.func
659
659
  }).isRequired,
660
- isLastCopyColumn: _propTypes.default.bool,
661
660
  setCellProps: _propTypes.default.func.isRequired,
662
661
  setCellContentsRef: _propTypes.default.func.isRequired,
663
662
  isExpanded: _propTypes.default.bool.isRequired,
@@ -997,8 +996,6 @@ var EuiDataGridCell = exports.EuiDataGridCell = /*#__PURE__*/function (_Componen
997
996
  rowHeightsOptions = _this$props9.rowHeightsOptions,
998
997
  rowManager = _this$props9.rowManager,
999
998
  pagination = _this$props9.pagination,
1000
- _this$props9$isLastCo = _this$props9.isLastCopyColumn,
1001
- isLastCopyColumn = _this$props9$isLastCo === void 0 ? false : _this$props9$isLastCo,
1002
999
  rest = (0, _objectWithoutProperties2.default)(_this$props9, _excluded2);
1003
1000
  var rowIndex = rest.rowIndex,
1004
1001
  visibleRowIndex = rest.visibleRowIndex,
@@ -1010,6 +1007,7 @@ var EuiDataGridCell = exports.EuiDataGridCell = /*#__PURE__*/function (_Componen
1010
1007
 
1011
1008
  // classNames set by EuiDataGridCellWrapper
1012
1009
  var isControlColumn = cellClasses.includes('euiDataGridRowCell--controlColumn');
1010
+ var isLastColumn = cellClasses.includes('euiDataGridRowCell--lastColumn');
1013
1011
  var ariaRowIndex = pagination ? visibleRowIndex + 1 + pagination.pageSize * pagination.pageIndex : visibleRowIndex + 1;
1014
1012
  var _this$state$cellProps2 = this.state.cellProps,
1015
1013
  _ = _this$state$cellProps2.isExpandable,
@@ -1049,7 +1047,7 @@ var EuiDataGridCell = exports.EuiDataGridCell = /*#__PURE__*/function (_Componen
1049
1047
  onKeyDown: this.handleCellKeyDown,
1050
1048
  onMouseEnter: this.onMouseEnter,
1051
1049
  onMouseLeave: this.onMouseLeave
1052
- }), isControlColumn && _services.tabularCopyMarkers.hiddenNoCopyBoundary, (0, _react2.jsx)(_focus_utils.HandleInteractiveChildren, {
1050
+ }), (0, _react2.jsx)(_focus_utils.HandleInteractiveChildren, {
1053
1051
  cellEl: this.cellRef.current,
1054
1052
  updateCellFocusContext: this.updateCellFocusContext,
1055
1053
  renderFocusTrap: !isExpandable
@@ -1065,7 +1063,7 @@ var EuiDataGridCell = exports.EuiDataGridCell = /*#__PURE__*/function (_Componen
1065
1063
  isControlColumn: isControlColumn,
1066
1064
  rowIndex: rowIndex,
1067
1065
  colIndex: colIndex
1068
- }))), isControlColumn ? _services.tabularCopyMarkers.hiddenNoCopyBoundary : isLastCopyColumn ? _services.tabularCopyMarkers.hiddenNewline : _services.tabularCopyMarkers.hiddenTab, this.state.isFocused && (0, _react2.jsx)(CellScreenReaderDescription, {
1066
+ }))), isLastColumn ? _services.tabularCopyMarkers.hiddenNewline : _services.tabularCopyMarkers.hiddenTab, this.state.isFocused && (0, _react2.jsx)(CellScreenReaderDescription, {
1069
1067
  columnName: (column === null || column === void 0 ? void 0 : column.displayAsText) || this.props.columnId,
1070
1068
  columnIndex: colIndex + 1,
1071
1069
  rowIndex: ariaRowIndex,
@@ -1555,8 +1553,7 @@ EuiDataGridCell.propTypes = {
1555
1553
  * Can be used for, e.g. storing user `gridStyle` in a local storage object.
1556
1554
  */
1557
1555
  onChange: _propTypes.default.func
1558
- }).isRequired,
1559
- isLastCopyColumn: _propTypes.default.bool
1556
+ }).isRequired
1560
1557
  };
1561
1558
  var RenderCellInRow = /*#__PURE__*/(0, _react.memo)(function (_ref2) {
1562
1559
  var row = _ref2.row,