@elastic/eui 122.1.0 → 123.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 (46) hide show
  1. package/dist/eui-icons.json +94 -94
  2. package/es/components/datagrid/body/data_grid_body_virtualized.js +119 -36
  3. package/es/components/datagrid/utils/row_heights.js +4 -1
  4. package/es/components/flyout/flyout.component.js +129 -55
  5. package/es/components/flyout/flyout_menu/action_button.js +15 -21
  6. package/es/components/flyout/flyout_menu/flyout_menu.js +40 -46
  7. package/es/components/flyout/manager/flyout_managed.js +24 -6
  8. package/es/components/form/described_form_group/described_form_group.js +17 -4
  9. package/es/components/tabs/tabbed_content/tabbed_content.js +93 -138
  10. package/es/components/text_truncate/text_truncate.js +9 -4
  11. package/eui.d.ts +32 -58
  12. package/lib/components/datagrid/body/data_grid_body_virtualized.js +119 -36
  13. package/lib/components/datagrid/utils/row_heights.js +4 -1
  14. package/lib/components/flyout/flyout.component.js +134 -62
  15. package/lib/components/flyout/flyout_menu/action_button.js +18 -23
  16. package/lib/components/flyout/flyout_menu/flyout_menu.js +40 -46
  17. package/lib/components/flyout/manager/flyout_managed.js +23 -5
  18. package/lib/components/form/described_form_group/described_form_group.js +19 -3
  19. package/lib/components/tabs/tabbed_content/tabbed_content.js +98 -142
  20. package/lib/components/text_truncate/text_truncate.js +9 -4
  21. package/optimize/es/components/datagrid/body/data_grid_body_virtualized.js +116 -36
  22. package/optimize/es/components/datagrid/utils/row_heights.js +4 -1
  23. package/optimize/es/components/flyout/flyout.component.js +124 -50
  24. package/optimize/es/components/flyout/flyout_menu/action_button.js +14 -21
  25. package/optimize/es/components/flyout/manager/flyout_managed.js +24 -6
  26. package/optimize/es/components/form/described_form_group/described_form_group.js +17 -4
  27. package/optimize/es/components/tabs/tabbed_content/tabbed_content.js +87 -131
  28. package/optimize/es/components/text_truncate/text_truncate.js +4 -3
  29. package/optimize/lib/components/datagrid/body/data_grid_body_virtualized.js +116 -36
  30. package/optimize/lib/components/datagrid/utils/row_heights.js +4 -1
  31. package/optimize/lib/components/flyout/flyout.component.js +123 -49
  32. package/optimize/lib/components/flyout/flyout_menu/action_button.js +14 -22
  33. package/optimize/lib/components/flyout/manager/flyout_managed.js +23 -5
  34. package/optimize/lib/components/form/described_form_group/described_form_group.js +19 -3
  35. package/optimize/lib/components/tabs/tabbed_content/tabbed_content.js +87 -131
  36. package/optimize/lib/components/text_truncate/text_truncate.js +4 -3
  37. package/package.json +2 -2
  38. package/test-env/components/datagrid/body/data_grid_body_virtualized.js +119 -36
  39. package/test-env/components/datagrid/utils/row_heights.js +4 -1
  40. package/test-env/components/flyout/flyout.component.js +123 -49
  41. package/test-env/components/flyout/flyout_menu/action_button.js +14 -22
  42. package/test-env/components/flyout/flyout_menu/flyout_menu.js +40 -46
  43. package/test-env/components/flyout/manager/flyout_managed.js +23 -5
  44. package/test-env/components/form/described_form_group/described_form_group.js +19 -3
  45. package/test-env/components/tabs/tabbed_content/tabbed_content.js +88 -132
  46. package/test-env/components/text_truncate/text_truncate.js +9 -4
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.EuiDescribedFormGroup = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
+ var _react = _interopRequireWildcard(require("react"));
8
9
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
10
  var _classnames = _interopRequireDefault(require("classnames"));
10
11
  var _services = require("../../../services");
@@ -14,7 +15,7 @@ var _flex = require("../../flex");
14
15
  var _eui_form_context = require("../eui_form_context");
15
16
  var _described_form_group = require("./described_form_group.styles");
16
17
  var _react2 = require("@emotion/react");
17
- var _excluded = ["children", "className", "gutterSize", "fullWidth", "ratio", "titleSize", "title", "description", "descriptionFlexItemProps", "fieldFlexItemProps"];
18
+ var _excluded = ["children", "className", "gutterSize", "fullWidth", "ratio", "titleSize", "title", "description", "descriptionFlexItemProps", "fieldFlexItemProps", "aria-label", "aria-labelledby"];
18
19
  /*
19
20
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
20
21
  * or more contributor license agreements. Licensed under the Elastic License
@@ -23,6 +24,8 @@ var _excluded = ["children", "className", "gutterSize", "fullWidth", "ratio", "t
23
24
  * Side Public License, v 1.
24
25
  */
25
26
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
27
+ 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); }
28
+ 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; }
26
29
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
27
30
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
28
31
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
@@ -46,7 +49,15 @@ var EuiDescribedFormGroup = exports.EuiDescribedFormGroup = function EuiDescribe
46
49
  description = props.description,
47
50
  descriptionFlexItemProps = props.descriptionFlexItemProps,
48
51
  fieldFlexItemProps = props.fieldFlexItemProps,
52
+ ariaLabel = props['aria-label'],
53
+ ariaLabelledby = props['aria-labelledby'],
49
54
  rest = _objectWithoutProperties(props, _excluded);
55
+ var generatedTitleId = (0, _services.useGeneratedHtmlId)({
56
+ prefix: 'euiDescribedFormGroupTitle'
57
+ });
58
+ // Reuse an `id` already set on the title element, so that consumers
59
+ // referencing it from their own `aria-labelledby` keep working
60
+ var titleId = /*#__PURE__*/(0, _react.isValidElement)(title) && title.props.id || generatedTitleId;
50
61
  var styles = (0, _services.useEuiMemoizedStyles)(_described_form_group.euiDescribedFormGroupStyles);
51
62
  var cssStyles = [styles.euiDescribedFormGroup, fullWidth ? styles.fullWidth : styles.formWidth];
52
63
  var descriptionColumnStyles = [styles.euiDescribedFormGroup__descriptionColumn, descriptionFlexItemProps === null || descriptionFlexItemProps === void 0 ? void 0 : descriptionFlexItemProps.css];
@@ -80,7 +91,11 @@ var EuiDescribedFormGroup = exports.EuiDescribedFormGroup = function EuiDescribe
80
91
  break;
81
92
  }
82
93
  return (0, _react2.jsx)(_flex.EuiFlexGroup, _extends({
83
- role: "group"
94
+ role: "group",
95
+ "aria-label": ariaLabel
96
+ // The title names the group, unless the consumer provides their own label
97
+ ,
98
+ "aria-labelledby": ariaLabelledby !== null && ariaLabelledby !== void 0 ? ariaLabelledby : ariaLabel == null ? titleId : undefined
84
99
  }, rest, {
85
100
  css: cssStyles,
86
101
  className: classes,
@@ -92,6 +107,7 @@ var EuiDescribedFormGroup = exports.EuiDescribedFormGroup = function EuiDescribe
92
107
  css: descriptionColumnStyles,
93
108
  className: (0, _classnames.default)('euiDescribedFormGroup__descriptionColumn', descriptionFlexItemProps === null || descriptionFlexItemProps === void 0 ? void 0 : descriptionFlexItemProps.className)
94
109
  }), (0, _react2.jsx)(_title.EuiTitle, {
110
+ id: titleId,
95
111
  size: titleSize,
96
112
  className: "euiDescribedFormGroup__title"
97
113
  }, title), renderedDescription), (0, _react2.jsx)(_flex.EuiFlexItem, _extends({
@@ -1,39 +1,19 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.EuiTabbedContent = exports.AUTOFOCUS = void 0;
7
8
  var _react = _interopRequireWildcard(require("react"));
8
9
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
- var _services = require("../../../services");
10
10
  var _tabs = require("../tabs");
11
11
  var _tab = require("../tab");
12
+ var _services = require("../../../services");
12
13
  var _react2 = require("@emotion/react");
13
- var _excluded = ["className", "expand", "initialSelectedTab", "onTabClick", "selectedTab", "size", "tabs", "autoFocus"],
14
+ var _excluded = ["autoFocus", "className", "expand", "initialSelectedTab", "onTabClick", "selectedTab", "size", "tabs"],
14
15
  _excluded2 = ["id", "name", "content"];
15
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
- 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); }
17
- 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; }
18
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
19
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
20
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
21
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
22
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
23
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
24
- function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
25
- function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
26
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
27
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
28
- function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
29
- function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
30
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
31
- function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
32
- function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
33
- function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
34
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
35
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
36
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /*
16
+ /*
37
17
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
38
18
  * or more contributor license agreements. Licensed under the Elastic License
39
19
  * 2.0 and the Server Side Public License, v 1; you may not use this file except
@@ -43,129 +23,104 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
43
23
  /**
44
24
  * Marked as const so type is `['initial', 'selected']` instead of `string[]`
45
25
  */
26
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
27
+ 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); }
28
+ 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; }
29
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
30
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
31
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
32
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
33
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
34
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
35
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
36
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
37
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
46
38
  var AUTOFOCUS = exports.AUTOFOCUS = ['initial', 'selected'];
47
- var EuiTabbedContent = exports.EuiTabbedContent = /*#__PURE__*/function (_Component) {
48
- function EuiTabbedContent(props) {
49
- var _this;
50
- _classCallCheck(this, EuiTabbedContent);
51
- _this = _callSuper(this, EuiTabbedContent, [props]);
52
- _defineProperty(_this, "rootId", (0, _services.htmlIdGenerator)()());
53
- _defineProperty(_this, "tabsRef", /*#__PURE__*/(0, _react.createRef)());
54
- _defineProperty(_this, "focusTab", function () {
55
- var targetTab = _this.tabsRef.current.querySelector("#".concat(_this.state.selectedTabId));
56
- targetTab.focus();
57
- });
58
- _defineProperty(_this, "initializeFocus", function () {
59
- if (!_this.state.inFocus && _this.props.autoFocus === 'selected') {
60
- // Must wait for setState to finish before calling `.focus()`
61
- // as the focus call triggers a blur on the first tab
62
- _this.setState({
63
- inFocus: true
64
- }, function () {
65
- _this.focusTab();
66
- });
67
- }
68
- });
69
- _defineProperty(_this, "removeFocus", function (blurEvent) {
70
- // only set inFocus to false if the wrapping div doesn't contain the now-focusing element
71
- var currentTarget = blurEvent.currentTarget;
72
- var relatedTarget = blurEvent.relatedTarget;
73
- if (currentTarget.contains(relatedTarget) === false) {
74
- _this.setState({
75
- inFocus: false
76
- });
77
- }
78
- });
79
- _defineProperty(_this, "onTabClick", function (selectedTab) {
80
- var _this$props = _this.props,
81
- onTabClick = _this$props.onTabClick,
82
- externalSelectedTab = _this$props.selectedTab;
83
- if (onTabClick) {
84
- onTabClick(selectedTab);
85
- }
86
-
87
- // Only track selection state if it's not controlled externally.
88
- if (!externalSelectedTab) {
89
- _this.setState({
90
- selectedTabId: selectedTab.id
91
- }, function () {
92
- _this.focusTab();
93
- });
94
- }
95
- });
96
- var initialSelectedTab = props.initialSelectedTab,
97
- _selectedTab = props.selectedTab,
98
- tabs = props.tabs;
39
+ var EuiTabbedContent = exports.EuiTabbedContent = function EuiTabbedContent(_ref) {
40
+ var _ref$autoFocus = _ref.autoFocus,
41
+ autoFocus = _ref$autoFocus === void 0 ? 'initial' : _ref$autoFocus,
42
+ className = _ref.className,
43
+ expand = _ref.expand,
44
+ initialSelectedTab = _ref.initialSelectedTab,
45
+ onTabClick = _ref.onTabClick,
46
+ externalSelectedTab = _ref.selectedTab,
47
+ size = _ref.size,
48
+ tabs = _ref.tabs,
49
+ rest = _objectWithoutProperties(_ref, _excluded);
50
+ var rootId = (0, _services.useGeneratedHtmlId)();
51
+ var tabsRef = (0, _react.useRef)(null);
52
+ var inFocusRef = (0, _react.useRef)(false);
53
+ var _useState = (0, _react.useState)(function () {
54
+ return externalSelectedTab ? undefined : (initialSelectedTab === null || initialSelectedTab === void 0 ? void 0 : initialSelectedTab.id) || tabs[0].id;
55
+ }),
56
+ _useState2 = _slicedToArray(_useState, 2),
57
+ selectedTabId = _useState2[0],
58
+ setSelectedTabId = _useState2[1];
59
+ var focusTab = function focusTab(id) {
60
+ var _tabsRef$current;
61
+ var targetTab = (_tabsRef$current = tabsRef.current) === null || _tabsRef$current === void 0 ? void 0 : _tabsRef$current.querySelector("#".concat(id));
62
+ targetTab === null || targetTab === void 0 || targetTab.focus();
63
+ };
64
+ var initializeFocus = function initializeFocus() {
65
+ if (!inFocusRef.current && autoFocus === 'selected') {
66
+ inFocusRef.current = true;
67
+ focusTab(selectedTabId);
68
+ }
69
+ };
70
+ var removeFocus = function removeFocus(blurEvent) {
71
+ // only set inFocus to false if the wrapping div doesn't contain the now-focusing element
72
+ var currentTarget = blurEvent.currentTarget;
73
+ var relatedTarget = blurEvent.relatedTarget;
74
+ if (currentTarget.contains(relatedTarget) === false) {
75
+ inFocusRef.current = false;
76
+ }
77
+ };
78
+ var handleTabClick = function handleTabClick(tab) {
79
+ onTabClick === null || onTabClick === void 0 || onTabClick(tab);
99
80
 
100
81
  // Only track selection state if it's not controlled externally.
101
- var selectedTabId;
102
- if (!_selectedTab) {
103
- selectedTabId = (initialSelectedTab === null || initialSelectedTab === void 0 ? void 0 : initialSelectedTab.id) || tabs[0].id;
82
+ if (!externalSelectedTab) {
83
+ setSelectedTabId(tab.id);
84
+ focusTab(tab.id);
104
85
  }
105
- _this.state = {
106
- selectedTabId: selectedTabId,
107
- inFocus: false
108
- };
109
- return _this;
110
- }
111
- _inherits(EuiTabbedContent, _Component);
112
- return _createClass(EuiTabbedContent, [{
113
- key: "render",
114
- value: function render() {
115
- var _this2 = this;
116
- var _this$props2 = this.props,
117
- className = _this$props2.className,
118
- expand = _this$props2.expand,
119
- initialSelectedTab = _this$props2.initialSelectedTab,
120
- onTabClick = _this$props2.onTabClick,
121
- externalSelectedTab = _this$props2.selectedTab,
122
- size = _this$props2.size,
123
- tabs = _this$props2.tabs,
124
- autoFocus = _this$props2.autoFocus,
125
- rest = _objectWithoutProperties(_this$props2, _excluded);
86
+ };
126
87
 
127
- // Allow the consumer to control tab selection.
128
- var selectedTab = externalSelectedTab || tabs.find(function (tab) {
129
- return tab.id === _this2.state.selectedTabId;
130
- }) || tabs[0]; // Fall back to the first tab if a selected tab can't be found
88
+ // Allow the consumer to control tab selection.
89
+ var selectedTab = externalSelectedTab || tabs.find(function (tab) {
90
+ return tab.id === selectedTabId;
91
+ }) || tabs[0]; // Fall back to the first tab if a selected tab can't be found
131
92
 
132
- var selectedTabContent = selectedTab.content,
133
- selectedTabId = selectedTab.id;
134
- return (0, _react2.jsx)("div", _extends({
135
- className: className
136
- }, rest), (0, _react2.jsx)(_tabs.EuiTabs, {
137
- ref: this.tabsRef,
138
- expand: expand,
139
- size: size,
140
- onFocus: this.initializeFocus,
141
- onBlur: this.removeFocus
142
- }, tabs.map(function (tab) {
143
- var id = tab.id,
144
- name = tab.name,
145
- content = tab.content,
146
- tabProps = _objectWithoutProperties(tab, _excluded2);
147
- var props = _objectSpread(_objectSpread({
148
- key: id,
149
- id: id
150
- }, tabProps), {}, {
151
- onClick: function onClick() {
152
- return _this2.onTabClick(tab);
153
- },
154
- isSelected: tab === selectedTab,
155
- 'aria-controls': "".concat(_this2.rootId)
156
- });
157
- return (0, _react2.jsx)(_tab.EuiTab, props, name);
158
- })), (0, _react2.jsx)("div", {
159
- role: "tabpanel",
160
- id: "".concat(this.rootId),
161
- "aria-labelledby": selectedTabId
162
- }, selectedTabContent));
163
- }
164
- }]);
165
- }(_react.Component);
166
- _defineProperty(EuiTabbedContent, "defaultProps", {
167
- autoFocus: 'initial'
168
- });
93
+ var selectedTabContent = selectedTab.content,
94
+ selectedTabContentId = selectedTab.id;
95
+ return (0, _react2.jsx)("div", _extends({
96
+ className: className
97
+ }, rest), (0, _react2.jsx)(_tabs.EuiTabs, {
98
+ ref: tabsRef,
99
+ expand: expand,
100
+ size: size,
101
+ onFocus: initializeFocus,
102
+ onBlur: removeFocus
103
+ }, tabs.map(function (tab) {
104
+ var id = tab.id,
105
+ name = tab.name,
106
+ content = tab.content,
107
+ tabProps = _objectWithoutProperties(tab, _excluded2);
108
+ return (0, _react2.jsx)(_tab.EuiTab, _extends({
109
+ key: id,
110
+ id: id
111
+ }, tabProps, {
112
+ onClick: function onClick() {
113
+ return handleTabClick(tab);
114
+ },
115
+ isSelected: tab === selectedTab,
116
+ "aria-controls": rootId
117
+ }), name);
118
+ })), (0, _react2.jsx)("div", {
119
+ role: "tabpanel",
120
+ id: rootId,
121
+ "aria-labelledby": selectedTabContentId
122
+ }, selectedTabContent));
123
+ };
169
124
  EuiTabbedContent.propTypes = {
170
125
  className: _propTypes.default.string,
171
126
  "aria-label": _propTypes.default.string,
@@ -241,4 +196,5 @@ EuiTabbedContent.propTypes = {
241
196
  "data-test-subj": _propTypes.default.string,
242
197
  css: _propTypes.default.any
243
198
  }).isRequired).isRequired
244
- };
199
+ };
200
+ EuiTabbedContent.displayName = 'EuiTabbedContent';
@@ -15,7 +15,7 @@ var _utils = require("./utils");
15
15
  var _text_truncate = require("./text_truncate.styles");
16
16
  var _react2 = require("@emotion/react");
17
17
  var _excluded = ["width", "onResize"],
18
- _excluded2 = ["width", "children", "text", "truncation", "truncationOffset", "truncationPosition", "ellipsis", "calculationDelayMs", "containerRef", "className"],
18
+ _excluded2 = ["width", "children", "text", "truncation", "truncationOffset", "truncationPosition", "ellipsis", "calculationDelayMs", "containerRef", "className", "toolTipProps"],
19
19
  _excluded3 = ["onResize"];
20
20
  /*
21
21
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
@@ -114,7 +114,11 @@ EuiTextTruncate.propTypes = {
114
114
  * fonts are done loading or layout is done shifting or settling. Adding a delay
115
115
  * may help resolve any rendering issues.
116
116
  */
117
- calculationDelayMs: _propTypes.default.number
117
+ calculationDelayMs: _propTypes.default.number,
118
+ /**
119
+ * Placement of the tooltip that shows the full text while truncating.
120
+ */
121
+ toolTipProps: _propTypes.default.any
118
122
  };
119
123
  var EuiTextTruncateWithWidth = function EuiTextTruncateWithWidth(_ref2) {
120
124
  var width = _ref2.width,
@@ -130,6 +134,7 @@ var EuiTextTruncateWithWidth = function EuiTextTruncateWithWidth(_ref2) {
130
134
  calculationDelayMs = _ref2.calculationDelayMs,
131
135
  containerRef = _ref2.containerRef,
132
136
  className = _ref2.className,
137
+ toolTipProps = _ref2.toolTipProps,
133
138
  rest = _objectWithoutProperties(_ref2, _excluded2);
134
139
  // Note: This needs to be a state and not a ref to trigger a rerender on mount
135
140
  var _useState = (0, _react.useState)(null),
@@ -231,11 +236,11 @@ var EuiTextTruncateWithWidth = function EuiTextTruncateWithWidth(_ref2) {
231
236
  className: "euiTextTruncate__fullText",
232
237
  "data-test-subj": "fullText"
233
238
  }, children ? children(text) : text));
234
- return isTruncating ? (0, _react2.jsx)(_tool_tip.EuiToolTip, {
239
+ return isTruncating ? (0, _react2.jsx)(_tool_tip.EuiToolTip, _extends({
235
240
  content: text,
236
241
  disableScreenReaderOutput: true,
237
242
  display: "block"
238
- }, content) : content;
243
+ }, toolTipProps), content) : content;
239
244
  };
240
245
  EuiTextTruncateWithWidth.propTypes = {
241
246
  width: _propTypes.default.number.isRequired,
@@ -1,7 +1,8 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
- var _excluded = ["children", "style"];
4
+ var _excluded = ["children", "style"],
5
+ _excluded2 = ["onScroll"];
5
6
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
7
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
8
  /*
@@ -76,40 +77,93 @@ var InnerElement = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref2, r
76
77
  }, rest), headerRow, children), footerRow);
77
78
  }));
78
79
  InnerElement.displayName = 'EuiDataGridInnerElement';
79
- export var EuiDataGridBodyVirtualized = /*#__PURE__*/memo(function (_ref3) {
80
- var leadingControlColumns = _ref3.leadingControlColumns,
81
- trailingControlColumns = _ref3.trailingControlColumns,
82
- columns = _ref3.columns,
83
- visibleColCount = _ref3.visibleColCount,
84
- schema = _ref3.schema,
85
- schemaDetectors = _ref3.schemaDetectors,
86
- rowCount = _ref3.rowCount,
87
- _ref3$visibleRows = _ref3.visibleRows,
88
- startRow = _ref3$visibleRows.startRow,
89
- endRow = _ref3$visibleRows.endRow,
90
- visibleRowCount = _ref3$visibleRows.visibleRowCount,
91
- renderCellValue = _ref3.renderCellValue,
92
- cellContext = _ref3.cellContext,
93
- renderCellPopover = _ref3.renderCellPopover,
94
- renderFooterCellValue = _ref3.renderFooterCellValue,
95
- interactiveCellId = _ref3.interactiveCellId,
96
- pagination = _ref3.pagination,
97
- sorting = _ref3.sorting,
98
- setVisibleColumns = _ref3.setVisibleColumns,
99
- switchColumnPos = _ref3.switchColumnPos,
100
- onColumnResize = _ref3.onColumnResize,
101
- rowHeightsOptions = _ref3.rowHeightsOptions,
102
- virtualizationOptions = _ref3.virtualizationOptions,
103
- isFullScreen = _ref3.isFullScreen,
104
- gridStyles = _ref3.gridStyles,
105
- gridWidth = _ref3.gridWidth,
106
- gridRef = _ref3.gridRef,
107
- gridItemsRendered = _ref3.gridItemsRendered,
108
- wrapperRef = _ref3.wrapperRef,
109
- className = _ref3.className,
110
- canDragAndDropColumns = _ref3.canDragAndDropColumns,
111
- _ref3$showHeader = _ref3.showHeader,
112
- showHeader = _ref3$showHeader === void 0 ? true : _ref3$showHeader;
80
+ var DataGridOuterElementContext = /*#__PURE__*/createContext({
81
+ scrollPositionRef: {
82
+ current: null
83
+ }
84
+ });
85
+ var clampScrollOffset = function clampScrollOffset(offset, max) {
86
+ return Math.max(0, Math.min(offset, max));
87
+ };
88
+ var OuterElement = /*#__PURE__*/forwardRef(function (_ref3, ref) {
89
+ var onScroll = _ref3.onScroll,
90
+ rest = _objectWithoutProperties(_ref3, _excluded2);
91
+ var _useContext2 = useContext(DataGridOuterElementContext),
92
+ _useContext2$outerEle = _useContext2.outerElementType,
93
+ Element = _useContext2$outerEle === void 0 ? 'div' : _useContext2$outerEle,
94
+ direction = _useContext2.direction,
95
+ scrollPositionRef = _useContext2.scrollPositionRef;
96
+
97
+ // react-window compares the raw scroll offsets against its own clamped
98
+ // offsets, and flags the grid as scrolling (setting `pointer-events: none`
99
+ // on the inner element) whenever they differ. Firefox can report a
100
+ // `scrollTop` above the maximum at fractional device pixel ratios, which
101
+ // makes every scroll event at the bottom of the grid look like a scroll,
102
+ // so hovered cells lose the pointer and tooltips repeatedly open and close.
103
+ var onScrollIfMoved = useCallback(function (event) {
104
+ if (direction !== 'rtl') {
105
+ var _event$currentTarget = event.currentTarget,
106
+ scrollTop = _event$currentTarget.scrollTop,
107
+ scrollLeft = _event$currentTarget.scrollLeft,
108
+ scrollHeight = _event$currentTarget.scrollHeight,
109
+ scrollWidth = _event$currentTarget.scrollWidth,
110
+ clientHeight = _event$currentTarget.clientHeight,
111
+ clientWidth = _event$currentTarget.clientWidth;
112
+ var scrollPosition = {
113
+ scrollTop: clampScrollOffset(scrollTop, scrollHeight - clientHeight),
114
+ scrollLeft: clampScrollOffset(scrollLeft, scrollWidth - clientWidth)
115
+ };
116
+ var previousScrollPosition = scrollPositionRef.current;
117
+ if (previousScrollPosition && scrollPosition.scrollTop === previousScrollPosition.scrollTop && scrollPosition.scrollLeft === previousScrollPosition.scrollLeft) {
118
+ return;
119
+ }
120
+ // react-window may not have rendered the previous event's position
121
+ // yet, so the ref must reflect every forwarded event, not only the
122
+ // positions react-window reports back through its `onScroll` prop.
123
+ scrollPositionRef.current = scrollPosition;
124
+ }
125
+ onScroll(event);
126
+ }, [onScroll, direction, scrollPositionRef]);
127
+ return ___EmotionJSX(Element, _extends({
128
+ ref: ref,
129
+ onScroll: onScrollIfMoved
130
+ }, rest));
131
+ });
132
+ OuterElement.displayName = 'EuiDataGridOuterElement';
133
+ export var EuiDataGridBodyVirtualized = /*#__PURE__*/memo(function (_ref4) {
134
+ var leadingControlColumns = _ref4.leadingControlColumns,
135
+ trailingControlColumns = _ref4.trailingControlColumns,
136
+ columns = _ref4.columns,
137
+ visibleColCount = _ref4.visibleColCount,
138
+ schema = _ref4.schema,
139
+ schemaDetectors = _ref4.schemaDetectors,
140
+ rowCount = _ref4.rowCount,
141
+ _ref4$visibleRows = _ref4.visibleRows,
142
+ startRow = _ref4$visibleRows.startRow,
143
+ endRow = _ref4$visibleRows.endRow,
144
+ visibleRowCount = _ref4$visibleRows.visibleRowCount,
145
+ renderCellValue = _ref4.renderCellValue,
146
+ cellContext = _ref4.cellContext,
147
+ renderCellPopover = _ref4.renderCellPopover,
148
+ renderFooterCellValue = _ref4.renderFooterCellValue,
149
+ interactiveCellId = _ref4.interactiveCellId,
150
+ pagination = _ref4.pagination,
151
+ sorting = _ref4.sorting,
152
+ setVisibleColumns = _ref4.setVisibleColumns,
153
+ switchColumnPos = _ref4.switchColumnPos,
154
+ onColumnResize = _ref4.onColumnResize,
155
+ rowHeightsOptions = _ref4.rowHeightsOptions,
156
+ virtualizationOptions = _ref4.virtualizationOptions,
157
+ isFullScreen = _ref4.isFullScreen,
158
+ gridStyles = _ref4.gridStyles,
159
+ gridWidth = _ref4.gridWidth,
160
+ gridRef = _ref4.gridRef,
161
+ gridItemsRendered = _ref4.gridItemsRendered,
162
+ wrapperRef = _ref4.wrapperRef,
163
+ className = _ref4.className,
164
+ canDragAndDropColumns = _ref4.canDragAndDropColumns,
165
+ _ref4$showHeader = _ref4.showHeader,
166
+ showHeader = _ref4$showHeader === void 0 ? true : _ref4$showHeader;
113
167
  /**
114
168
  * Grid refs & observers
115
169
  */
@@ -305,7 +359,30 @@ export var EuiDataGridBodyVirtualized = /*#__PURE__*/memo(function (_ref3) {
305
359
  footerRow: footerRow
306
360
  };
307
361
  }, [headerRowHeight, headerRow, footerRow, showHeader]);
362
+ var scrollPositionRef = useRef(null);
363
+ var outerElementContextValue = useMemo(function () {
364
+ return {
365
+ outerElementType: virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : virtualizationOptions.outerElementType,
366
+ direction: virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : virtualizationOptions.direction,
367
+ scrollPositionRef: scrollPositionRef
368
+ };
369
+ }, [virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : virtualizationOptions.outerElementType, virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : virtualizationOptions.direction]);
308
370
  var onScroll = useCallback(function (args) {
371
+ var element = outerGridRef.current;
372
+ // `scrollTo` reports the requested offset, which can sit past the
373
+ // end. Storing that would replace the clamped position already
374
+ // taken from the DOM. Leave the ref unchanged instead of writing
375
+ // the clamped value: a scroll event that has not arrived yet still
376
+ // differs from the previous position and is forwarded.
377
+ var topInRange = element == null || args.scrollTop === clampScrollOffset(args.scrollTop, element.scrollHeight - element.clientHeight);
378
+ var leftInRange = element == null || args.scrollLeft === clampScrollOffset(args.scrollLeft, element.scrollWidth - element.clientWidth);
379
+ if (topInRange && leftInRange) {
380
+ scrollPositionRef.current = {
381
+ scrollTop: args.scrollTop,
382
+ scrollLeft: args.scrollLeft
383
+ };
384
+ }
385
+
309
386
  // check only if a callback is passed
310
387
  if (typeof (virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : virtualizationOptions.onScroll) !== 'function') return;
311
388
  var enhancedArgs = _objectSpread(_objectSpread({}, args), {}, {
@@ -349,10 +426,13 @@ export var EuiDataGridBodyVirtualized = /*#__PURE__*/memo(function (_ref3) {
349
426
  }, [outerGridRef, virtualizationOptions]);
350
427
  return IS_JEST_ENVIRONMENT || finalWidth > 0 ? ___EmotionJSX(DataGridWrapperRowsContext.Provider, {
351
428
  value: rowWrapperContextValue
429
+ }, ___EmotionJSX(DataGridOuterElementContext.Provider, {
430
+ value: outerElementContextValue
352
431
  }, ___EmotionJSX(Grid, _extends({}, virtualizationOptions, {
353
432
  ref: gridRef,
354
433
  className: classNames('euiDataGrid__virtualized', className, virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : virtualizationOptions.className),
355
434
  onItemsRendered: onItemsRendered,
435
+ outerElementType: OuterElement,
356
436
  innerElementType: InnerElement,
357
437
  outerRef: outerGridRef,
358
438
  innerRef: innerGridRef,
@@ -364,6 +444,6 @@ export var EuiDataGridBodyVirtualized = /*#__PURE__*/memo(function (_ref3) {
364
444
  itemData: itemData,
365
445
  rowCount: IS_JEST_ENVIRONMENT || headerRowHeight > 0 || showHeader === false && innerGridRef.current ? visibleRowCount : 0,
366
446
  onScroll: onScroll
367
- }), Cell), scrollBorderOverlay) : null;
447
+ }), Cell)), scrollBorderOverlay) : null;
368
448
  });
369
449
  EuiDataGridBodyVirtualized.displayName = 'EuiDataGridBodyVirtualized';
@@ -295,7 +295,10 @@ export var useRowHeightUtils = function useRowHeightUtils(_ref3) {
295
295
  if (forceRenderRef.current == null) {
296
296
  return;
297
297
  }
298
- requestAnimationFrame(forceRenderRef.current);
298
+ var frameId = requestAnimationFrame(forceRenderRef.current);
299
+ return function () {
300
+ return cancelAnimationFrame(frameId);
301
+ };
299
302
  }, [// Effects that should cause rerendering
300
303
  rowHeightsOptions === null || rowHeightsOptions === void 0 ? void 0 : rowHeightsOptions.defaultHeight, rowHeightsOptions === null || rowHeightsOptions === void 0 ? void 0 : rowHeightsOptions.rowHeights,
301
304
  // Dependencies