@elastic/eui 116.0.0 → 116.1.0-snapshot.1779110362015

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 (70) hide show
  1. package/es/components/accordion/accordion.js +95 -134
  2. package/es/components/basic_table/basic_table.js +6 -0
  3. package/es/components/basic_table/in_memory_table.js +6 -0
  4. package/es/components/color_picker/color_picker_swatch.js +4 -0
  5. package/es/components/context_menu/context_menu_panel.js +2 -2
  6. package/es/components/copy/copy.js +36 -13
  7. package/es/components/datagrid/body/cell/data_grid_cell_popover.js +10 -7
  8. package/es/components/datagrid/data_grid.styles.js +6 -5
  9. package/es/components/focus_trap/focus_trap.js +110 -177
  10. package/es/components/observer/mutation_observer/mutation_observer.js +32 -35
  11. package/es/components/observer/resize_observer/resize_observer.js +46 -60
  12. package/es/components/observer/use_observer.js +62 -0
  13. package/es/components/table/table_header_cell.js +4 -0
  14. package/es/components/tool_tip/icon_tip.js +4 -0
  15. package/es/components/tool_tip/tool_tip.js +8 -2
  16. package/eui.d.ts +26 -69
  17. package/lib/components/accordion/accordion.js +102 -139
  18. package/lib/components/basic_table/basic_table.js +6 -0
  19. package/lib/components/basic_table/in_memory_table.js +6 -0
  20. package/lib/components/color_picker/color_picker_swatch.js +4 -0
  21. package/lib/components/context_menu/context_menu_panel.js +2 -2
  22. package/lib/components/copy/copy.js +35 -12
  23. package/lib/components/datagrid/body/cell/data_grid_cell_popover.js +10 -7
  24. package/lib/components/datagrid/data_grid.styles.js +6 -5
  25. package/lib/components/focus_trap/focus_trap.js +117 -183
  26. package/lib/components/observer/mutation_observer/mutation_observer.js +32 -34
  27. package/lib/components/observer/resize_observer/resize_observer.js +48 -61
  28. package/lib/components/observer/use_observer.js +68 -0
  29. package/lib/components/table/table_header_cell.js +4 -0
  30. package/lib/components/tool_tip/icon_tip.js +4 -0
  31. package/lib/components/tool_tip/tool_tip.js +8 -2
  32. package/optimize/es/components/accordion/accordion.js +88 -126
  33. package/optimize/es/components/context_menu/context_menu_panel.js +2 -2
  34. package/optimize/es/components/copy/copy.js +36 -13
  35. package/optimize/es/components/datagrid/body/cell/data_grid_cell_popover.js +10 -7
  36. package/optimize/es/components/datagrid/data_grid.styles.js +6 -5
  37. package/optimize/es/components/focus_trap/focus_trap.js +103 -122
  38. package/optimize/es/components/observer/mutation_observer/mutation_observer.js +23 -32
  39. package/optimize/es/components/observer/resize_observer/resize_observer.js +38 -54
  40. package/optimize/es/components/observer/use_observer.js +62 -0
  41. package/optimize/es/components/tool_tip/tool_tip.js +4 -2
  42. package/optimize/lib/components/accordion/accordion.js +90 -127
  43. package/optimize/lib/components/context_menu/context_menu_panel.js +2 -2
  44. package/optimize/lib/components/copy/copy.js +35 -12
  45. package/optimize/lib/components/datagrid/body/cell/data_grid_cell_popover.js +10 -7
  46. package/optimize/lib/components/datagrid/data_grid.styles.js +6 -5
  47. package/optimize/lib/components/focus_trap/focus_trap.js +106 -124
  48. package/optimize/lib/components/observer/mutation_observer/mutation_observer.js +23 -32
  49. package/optimize/lib/components/observer/resize_observer/resize_observer.js +40 -54
  50. package/optimize/lib/components/observer/use_observer.js +68 -0
  51. package/optimize/lib/components/tool_tip/tool_tip.js +4 -2
  52. package/package.json +4 -3
  53. package/test-env/components/accordion/accordion.js +92 -129
  54. package/test-env/components/basic_table/basic_table.js +6 -0
  55. package/test-env/components/basic_table/in_memory_table.js +6 -0
  56. package/test-env/components/color_picker/color_picker_swatch.js +4 -0
  57. package/test-env/components/context_menu/context_menu_panel.js +2 -2
  58. package/test-env/components/copy/copy.js +35 -12
  59. package/test-env/components/datagrid/body/cell/data_grid_cell_popover.js +10 -7
  60. package/test-env/components/datagrid/data_grid.styles.js +6 -5
  61. package/test-env/components/observer/mutation_observer/mutation_observer.js +32 -32
  62. package/test-env/components/observer/use_observer.js +68 -0
  63. package/test-env/components/table/table_header_cell.js +4 -0
  64. package/test-env/components/tool_tip/icon_tip.js +4 -0
  65. package/test-env/components/tool_tip/tool_tip.js +8 -2
  66. package/es/components/observer/observer.js +0 -75
  67. package/lib/components/observer/observer.js +0 -79
  68. package/optimize/es/components/observer/observer.js +0 -69
  69. package/optimize/lib/components/observer/observer.js +0 -74
  70. package/test-env/components/observer/observer.js +0 -74
@@ -238,6 +238,10 @@ EuiTableHeaderCell.propTypes = {
238
238
  * hidden.
239
239
  */
240
240
  onMouseOut: _propTypes.default.func,
241
+ /**
242
+ * If supplied, called when the trigger loses focus.
243
+ */
244
+ onBlur: _propTypes.default.func,
241
245
  /**
242
246
  * Offset in pixels from the anchor. Defaults to 16.
243
247
  */
@@ -98,6 +98,10 @@ EuiIconTip.propTypes = {
98
98
  * hidden.
99
99
  */
100
100
  onMouseOut: _propTypes.default.func,
101
+ /**
102
+ * If supplied, called when the trigger loses focus.
103
+ */
104
+ onBlur: _propTypes.default.func,
101
105
  /**
102
106
  * Offset in pixels from the anchor. Defaults to 16.
103
107
  */
@@ -22,7 +22,7 @@ var _tool_tip_anchor = require("./tool_tip_anchor");
22
22
  var _tool_tip_arrow = require("./tool_tip_arrow");
23
23
  var _tool_tip_manager = require("./tool_tip_manager");
24
24
  var _react2 = require("@emotion/react");
25
- var _excluded = ["children", "className", "anchorClassName", "anchorProps", "content", "title", "display", "repositionOnScroll", "disableScreenReaderOutput", "position", "offset", "id", "onMouseOut"];
25
+ var _excluded = ["children", "className", "anchorClassName", "anchorProps", "content", "title", "display", "repositionOnScroll", "disableScreenReaderOutput", "position", "offset", "id", "onMouseOut", "onBlur"];
26
26
  /*
27
27
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
28
28
  * or more contributor license agreements. Licensed under the Elastic License
@@ -76,6 +76,7 @@ var EuiToolTip = exports.EuiToolTip = /*#__PURE__*/(0, _react.forwardRef)(functi
76
76
  offset = _ref.offset,
77
77
  idProp = _ref.id,
78
78
  onMouseOutProp = _ref.onMouseOut,
79
+ onBlurProp = _ref.onBlur,
79
80
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
80
81
  var componentDefaultsContext = (0, _react.useContext)(_component_defaults.EuiComponentDefaultsContext);
81
82
  var _useState = (0, _react.useState)(false),
@@ -222,7 +223,8 @@ var EuiToolTip = exports.EuiToolTip = /*#__PURE__*/(0, _react.forwardRef)(functi
222
223
  var onBlur = (0, _react.useCallback)(function () {
223
224
  setHasFocus(false);
224
225
  hideToolTip();
225
- }, [hideToolTip]);
226
+ onBlurProp === null || onBlurProp === void 0 || onBlurProp();
227
+ }, [hideToolTip, onBlurProp]);
226
228
  var onEscapeKey = (0, _react.useCallback)(function (event) {
227
229
  if (event.key === _services.keys.ESCAPE) {
228
230
  // when the tooltip is only visual, we don't want it to add an additional key stop
@@ -344,6 +346,10 @@ EuiToolTip.propTypes = {
344
346
  * hidden.
345
347
  */
346
348
  onMouseOut: _propTypes.default.func,
349
+ /**
350
+ * If supplied, called when the trigger loses focus.
351
+ */
352
+ onBlur: _propTypes.default.func,
347
353
  /**
348
354
  * Offset in pixels from the anchor. Defaults to 16.
349
355
  */
@@ -1,75 +0,0 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
3
- 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); } }
4
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
5
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
6
- 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); }
7
- function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
8
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
9
- function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
10
- 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); }
11
- function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
12
- 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; }
13
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
14
- 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); }
15
- /*
16
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
17
- * or more contributor license agreements. Licensed under the Elastic License
18
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
19
- * in compliance with, at your election, the Elastic License 2.0 or the Server
20
- * Side Public License, v 1.
21
- */
22
-
23
- import { Component } from 'react';
24
- export var EuiObserver = /*#__PURE__*/function (_Component) {
25
- function EuiObserver() {
26
- var _this;
27
- _classCallCheck(this, EuiObserver);
28
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
29
- args[_key] = arguments[_key];
30
- }
31
- _this = _callSuper(this, EuiObserver, [].concat(args));
32
- _defineProperty(_this, "name", 'EuiObserver');
33
- _defineProperty(_this, "childNode", null);
34
- _defineProperty(_this, "observer", null);
35
- _defineProperty(_this, "updateChildNode", function (ref) {
36
- if (_this.childNode === ref) return; // node hasn't changed
37
-
38
- // if there's an existing observer disconnect it
39
- if (_this.observer != null) {
40
- _this.observer.disconnect();
41
- _this.observer = null;
42
- }
43
- _this.childNode = ref;
44
- if (_this.childNode != null) {
45
- _this.beginObserve();
46
- }
47
- });
48
- _defineProperty(_this, "beginObserve", function () {
49
- throw new Error('EuiObserver has no default observation method');
50
- });
51
- return _this;
52
- }
53
- _inherits(EuiObserver, _Component);
54
- return _createClass(EuiObserver, [{
55
- key: "componentDidMount",
56
- value: function componentDidMount() {
57
- if (this.childNode == null) {
58
- throw new Error("".concat(this.name, " did not receive a ref"));
59
- }
60
- }
61
- }, {
62
- key: "componentWillUnmount",
63
- value: function componentWillUnmount() {
64
- if (this.observer != null) {
65
- this.observer.disconnect();
66
- }
67
- }
68
- }, {
69
- key: "render",
70
- value: function render() {
71
- var props = this.props;
72
- return props.children(this.updateChildNode);
73
- }
74
- }]);
75
- }(Component);
@@ -1,79 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.EuiObserver = void 0;
7
- var _react = require("react");
8
- 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); }
9
- function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
10
- 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); } }
11
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
12
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
13
- 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); }
14
- function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
15
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
16
- function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
17
- 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); }
18
- function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
19
- 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; }
20
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
21
- 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); } /*
22
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
23
- * or more contributor license agreements. Licensed under the Elastic License
24
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
25
- * in compliance with, at your election, the Elastic License 2.0 or the Server
26
- * Side Public License, v 1.
27
- */
28
- var EuiObserver = exports.EuiObserver = /*#__PURE__*/function (_Component) {
29
- function EuiObserver() {
30
- var _this;
31
- _classCallCheck(this, EuiObserver);
32
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
33
- args[_key] = arguments[_key];
34
- }
35
- _this = _callSuper(this, EuiObserver, [].concat(args));
36
- _defineProperty(_this, "name", 'EuiObserver');
37
- _defineProperty(_this, "childNode", null);
38
- _defineProperty(_this, "observer", null);
39
- _defineProperty(_this, "updateChildNode", function (ref) {
40
- if (_this.childNode === ref) return; // node hasn't changed
41
-
42
- // if there's an existing observer disconnect it
43
- if (_this.observer != null) {
44
- _this.observer.disconnect();
45
- _this.observer = null;
46
- }
47
- _this.childNode = ref;
48
- if (_this.childNode != null) {
49
- _this.beginObserve();
50
- }
51
- });
52
- _defineProperty(_this, "beginObserve", function () {
53
- throw new Error('EuiObserver has no default observation method');
54
- });
55
- return _this;
56
- }
57
- _inherits(EuiObserver, _Component);
58
- return _createClass(EuiObserver, [{
59
- key: "componentDidMount",
60
- value: function componentDidMount() {
61
- if (this.childNode == null) {
62
- throw new Error("".concat(this.name, " did not receive a ref"));
63
- }
64
- }
65
- }, {
66
- key: "componentWillUnmount",
67
- value: function componentWillUnmount() {
68
- if (this.observer != null) {
69
- this.observer.disconnect();
70
- }
71
- }
72
- }, {
73
- key: "render",
74
- value: function render() {
75
- var props = this.props;
76
- return props.children(this.updateChildNode);
77
- }
78
- }]);
79
- }(_react.Component);
@@ -1,69 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
4
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
5
- import _inherits from "@babel/runtime/helpers/inherits";
6
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
7
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
8
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
9
- /*
10
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
11
- * or more contributor license agreements. Licensed under the Elastic License
12
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
13
- * in compliance with, at your election, the Elastic License 2.0 or the Server
14
- * Side Public License, v 1.
15
- */
16
-
17
- import { Component } from 'react';
18
- export var EuiObserver = /*#__PURE__*/function (_Component) {
19
- function EuiObserver() {
20
- var _this;
21
- _classCallCheck(this, EuiObserver);
22
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
23
- args[_key] = arguments[_key];
24
- }
25
- _this = _callSuper(this, EuiObserver, [].concat(args));
26
- _defineProperty(_this, "name", 'EuiObserver');
27
- _defineProperty(_this, "childNode", null);
28
- _defineProperty(_this, "observer", null);
29
- _defineProperty(_this, "updateChildNode", function (ref) {
30
- if (_this.childNode === ref) return; // node hasn't changed
31
-
32
- // if there's an existing observer disconnect it
33
- if (_this.observer != null) {
34
- _this.observer.disconnect();
35
- _this.observer = null;
36
- }
37
- _this.childNode = ref;
38
- if (_this.childNode != null) {
39
- _this.beginObserve();
40
- }
41
- });
42
- _defineProperty(_this, "beginObserve", function () {
43
- throw new Error('EuiObserver has no default observation method');
44
- });
45
- return _this;
46
- }
47
- _inherits(EuiObserver, _Component);
48
- return _createClass(EuiObserver, [{
49
- key: "componentDidMount",
50
- value: function componentDidMount() {
51
- if (this.childNode == null) {
52
- throw new Error("".concat(this.name, " did not receive a ref"));
53
- }
54
- }
55
- }, {
56
- key: "componentWillUnmount",
57
- value: function componentWillUnmount() {
58
- if (this.observer != null) {
59
- this.observer.disconnect();
60
- }
61
- }
62
- }, {
63
- key: "render",
64
- value: function render() {
65
- var props = this.props;
66
- return props.children(this.updateChildNode);
67
- }
68
- }]);
69
- }(Component);
@@ -1,74 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.EuiObserver = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
11
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
12
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
13
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
- var _react = require("react");
15
- 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)); }
16
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /*
17
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
18
- * or more contributor license agreements. Licensed under the Elastic License
19
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
20
- * in compliance with, at your election, the Elastic License 2.0 or the Server
21
- * Side Public License, v 1.
22
- */
23
- var EuiObserver = exports.EuiObserver = /*#__PURE__*/function (_Component) {
24
- function EuiObserver() {
25
- var _this;
26
- (0, _classCallCheck2.default)(this, EuiObserver);
27
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
28
- args[_key] = arguments[_key];
29
- }
30
- _this = _callSuper(this, EuiObserver, [].concat(args));
31
- (0, _defineProperty2.default)(_this, "name", 'EuiObserver');
32
- (0, _defineProperty2.default)(_this, "childNode", null);
33
- (0, _defineProperty2.default)(_this, "observer", null);
34
- (0, _defineProperty2.default)(_this, "updateChildNode", function (ref) {
35
- if (_this.childNode === ref) return; // node hasn't changed
36
-
37
- // if there's an existing observer disconnect it
38
- if (_this.observer != null) {
39
- _this.observer.disconnect();
40
- _this.observer = null;
41
- }
42
- _this.childNode = ref;
43
- if (_this.childNode != null) {
44
- _this.beginObserve();
45
- }
46
- });
47
- (0, _defineProperty2.default)(_this, "beginObserve", function () {
48
- throw new Error('EuiObserver has no default observation method');
49
- });
50
- return _this;
51
- }
52
- (0, _inherits2.default)(EuiObserver, _Component);
53
- return (0, _createClass2.default)(EuiObserver, [{
54
- key: "componentDidMount",
55
- value: function componentDidMount() {
56
- if (this.childNode == null) {
57
- throw new Error("".concat(this.name, " did not receive a ref"));
58
- }
59
- }
60
- }, {
61
- key: "componentWillUnmount",
62
- value: function componentWillUnmount() {
63
- if (this.observer != null) {
64
- this.observer.disconnect();
65
- }
66
- }
67
- }, {
68
- key: "render",
69
- value: function render() {
70
- var props = this.props;
71
- return props.children(this.updateChildNode);
72
- }
73
- }]);
74
- }(_react.Component);
@@ -1,74 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.EuiObserver = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
11
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
12
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
13
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
- var _react = require("react");
15
- 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)); }
16
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /*
17
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
18
- * or more contributor license agreements. Licensed under the Elastic License
19
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
20
- * in compliance with, at your election, the Elastic License 2.0 or the Server
21
- * Side Public License, v 1.
22
- */
23
- var EuiObserver = exports.EuiObserver = /*#__PURE__*/function (_Component) {
24
- function EuiObserver() {
25
- var _this;
26
- (0, _classCallCheck2.default)(this, EuiObserver);
27
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
28
- args[_key] = arguments[_key];
29
- }
30
- _this = _callSuper(this, EuiObserver, [].concat(args));
31
- (0, _defineProperty2.default)(_this, "name", 'EuiObserver');
32
- (0, _defineProperty2.default)(_this, "childNode", null);
33
- (0, _defineProperty2.default)(_this, "observer", null);
34
- (0, _defineProperty2.default)(_this, "updateChildNode", function (ref) {
35
- if (_this.childNode === ref) return; // node hasn't changed
36
-
37
- // if there's an existing observer disconnect it
38
- if (_this.observer != null) {
39
- _this.observer.disconnect();
40
- _this.observer = null;
41
- }
42
- _this.childNode = ref;
43
- if (_this.childNode != null) {
44
- _this.beginObserve();
45
- }
46
- });
47
- (0, _defineProperty2.default)(_this, "beginObserve", function () {
48
- throw new Error('EuiObserver has no default observation method');
49
- });
50
- return _this;
51
- }
52
- (0, _inherits2.default)(EuiObserver, _Component);
53
- return (0, _createClass2.default)(EuiObserver, [{
54
- key: "componentDidMount",
55
- value: function componentDidMount() {
56
- if (this.childNode == null) {
57
- throw new Error("".concat(this.name, " did not receive a ref"));
58
- }
59
- }
60
- }, {
61
- key: "componentWillUnmount",
62
- value: function componentWillUnmount() {
63
- if (this.observer != null) {
64
- this.observer.disconnect();
65
- }
66
- }
67
- }, {
68
- key: "render",
69
- value: function render() {
70
- var props = this.props;
71
- return props.children(this.updateChildNode);
72
- }
73
- }]);
74
- }(_react.Component);