@elastic/eui 91.3.1 → 92.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 (160) hide show
  1. package/dist/eui_charts_theme.js.map +1 -1
  2. package/dist/eui_theme_dark.css +0 -513
  3. package/dist/eui_theme_dark.min.css +1 -1
  4. package/dist/eui_theme_light.css +0 -513
  5. package/dist/eui_theme_light.min.css +1 -1
  6. package/es/components/basic_table/basic_table.js +5 -5
  7. package/es/components/drag_and_drop/drag_and_drop.a11y.js +1 -1
  8. package/es/components/filter_group/filter_button.js +20 -13
  9. package/es/components/filter_group/filter_button.styles.js +11 -20
  10. package/es/components/flyout/flyout.js +4 -4
  11. package/es/components/flyout/flyout_resizable.js +127 -0
  12. package/es/components/flyout/flyout_resizable.styles.js +27 -0
  13. package/es/components/flyout/index.js +2 -1
  14. package/es/components/form/range/dual_range.js +15 -66
  15. package/es/components/form/range/range.js +6 -5
  16. package/es/components/form/range/range_slider.js +28 -22
  17. package/es/components/form/text_area/text_area.js +39 -3
  18. package/es/components/index.js +0 -2
  19. package/es/components/markdown_editor/markdown_editor.js +12 -13
  20. package/es/components/page_template/bottom_bar/page_bottom_bar.js +1 -1
  21. package/es/components/selectable/selectable_list/selectable_list_item.js +1 -1
  22. package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +5 -0
  23. package/es/components/tree_view/tree_view.js +23 -25
  24. package/es/utils/prop_types/is.js +2 -2
  25. package/eui.d.ts +825 -1141
  26. package/i18ntokens.json +68 -338
  27. package/lib/components/basic_table/basic_table.js +5 -5
  28. package/lib/components/drag_and_drop/drag_and_drop.a11y.js +1 -1
  29. package/lib/components/filter_group/filter_button.js +20 -13
  30. package/lib/components/filter_group/filter_button.styles.js +11 -20
  31. package/lib/components/flyout/flyout.js +4 -4
  32. package/lib/components/flyout/flyout_resizable.js +136 -0
  33. package/lib/components/flyout/flyout_resizable.styles.js +32 -0
  34. package/lib/components/flyout/index.js +8 -1
  35. package/lib/components/form/range/dual_range.js +15 -66
  36. package/lib/components/form/range/range.js +6 -5
  37. package/lib/components/form/range/range_slider.js +27 -21
  38. package/lib/components/form/text_area/text_area.js +42 -3
  39. package/lib/components/index.js +0 -22
  40. package/lib/components/markdown_editor/markdown_editor.js +12 -13
  41. package/lib/components/page_template/bottom_bar/page_bottom_bar.js +1 -1
  42. package/lib/components/pagination/pagination_button.js +79 -2
  43. package/lib/components/selectable/selectable_list/selectable_list_item.js +1 -1
  44. package/lib/components/tree_view/tree_view.js +23 -25
  45. package/lib/utils/prop_types/is.js +2 -2
  46. package/optimize/es/components/basic_table/basic_table.js +5 -5
  47. package/optimize/es/components/drag_and_drop/drag_and_drop.a11y.js +1 -1
  48. package/optimize/es/components/filter_group/filter_button.js +20 -13
  49. package/optimize/es/components/filter_group/filter_button.styles.js +11 -20
  50. package/optimize/es/components/flyout/flyout.js +4 -4
  51. package/optimize/es/components/flyout/flyout_resizable.js +121 -0
  52. package/optimize/es/components/flyout/flyout_resizable.styles.js +27 -0
  53. package/optimize/es/components/flyout/index.js +2 -1
  54. package/optimize/es/components/form/range/dual_range.js +15 -66
  55. package/optimize/es/components/form/range/range.js +6 -5
  56. package/optimize/es/components/form/range/range_slider.js +26 -21
  57. package/optimize/es/components/form/text_area/text_area.js +29 -3
  58. package/optimize/es/components/index.js +0 -2
  59. package/optimize/es/components/markdown_editor/markdown_editor.js +12 -13
  60. package/optimize/es/components/page_template/bottom_bar/page_bottom_bar.js +1 -1
  61. package/optimize/es/components/selectable/selectable_list/selectable_list_item.js +1 -1
  62. package/optimize/es/components/tree_view/tree_view.js +23 -25
  63. package/optimize/es/utils/prop_types/is.js +2 -2
  64. package/optimize/lib/components/basic_table/basic_table.js +5 -5
  65. package/optimize/lib/components/drag_and_drop/drag_and_drop.a11y.js +1 -1
  66. package/optimize/lib/components/filter_group/filter_button.js +20 -13
  67. package/optimize/lib/components/filter_group/filter_button.styles.js +11 -20
  68. package/optimize/lib/components/flyout/flyout.js +4 -4
  69. package/optimize/lib/components/flyout/flyout_resizable.js +131 -0
  70. package/optimize/lib/components/flyout/flyout_resizable.styles.js +32 -0
  71. package/optimize/lib/components/flyout/index.js +8 -1
  72. package/optimize/lib/components/form/range/dual_range.js +15 -66
  73. package/optimize/lib/components/form/range/range.js +6 -5
  74. package/optimize/lib/components/form/range/range_slider.js +26 -21
  75. package/optimize/lib/components/form/text_area/text_area.js +32 -3
  76. package/optimize/lib/components/index.js +0 -22
  77. package/optimize/lib/components/markdown_editor/markdown_editor.js +12 -13
  78. package/optimize/lib/components/page_template/bottom_bar/page_bottom_bar.js +1 -1
  79. package/optimize/lib/components/selectable/selectable_list/selectable_list_item.js +1 -1
  80. package/optimize/lib/components/tree_view/tree_view.js +23 -25
  81. package/optimize/lib/utils/prop_types/is.js +2 -2
  82. package/package.json +2 -2
  83. package/src/components/index.scss +0 -2
  84. package/test-env/components/basic_table/basic_table.js +5 -5
  85. package/test-env/components/drag_and_drop/drag_and_drop.a11y.js +1 -1
  86. package/test-env/components/filter_group/filter_button.js +20 -13
  87. package/test-env/components/filter_group/filter_button.styles.js +11 -20
  88. package/test-env/components/flyout/flyout_resizable.js +131 -0
  89. package/test-env/components/flyout/flyout_resizable.styles.js +32 -0
  90. package/test-env/components/flyout/index.js +8 -1
  91. package/test-env/components/form/range/dual_range.js +15 -66
  92. package/test-env/components/form/range/range.js +6 -5
  93. package/test-env/components/form/range/range_slider.js +27 -21
  94. package/test-env/components/form/text_area/text_area.js +42 -3
  95. package/test-env/components/index.js +0 -22
  96. package/test-env/components/markdown_editor/markdown_editor.js +12 -13
  97. package/test-env/components/page_template/bottom_bar/page_bottom_bar.js +1 -1
  98. package/test-env/components/pagination/pagination_button.js +79 -2
  99. package/test-env/components/selectable/selectable_list/selectable_list_item.js +1 -1
  100. package/test-env/components/tree_view/tree_view.js +23 -25
  101. package/test-env/utils/prop_types/is.js +2 -2
  102. package/es/components/control_bar/control_bar.a11y.js +0 -133
  103. package/es/components/control_bar/control_bar.js +0 -609
  104. package/es/components/control_bar/index.js +0 -9
  105. package/es/components/notification/index.js +0 -9
  106. package/es/components/notification/notification_event.a11y.js +0 -104
  107. package/es/components/notification/notification_event.js +0 -288
  108. package/es/components/notification/notification_event_messages.js +0 -79
  109. package/es/components/notification/notification_event_meta.js +0 -148
  110. package/es/components/notification/notification_event_read_button.js +0 -86
  111. package/es/components/notification/notification_event_read_icon.js +0 -77
  112. package/lib/components/control_bar/control_bar.a11y.js +0 -134
  113. package/lib/components/control_bar/control_bar.js +0 -441
  114. package/lib/components/control_bar/index.js +0 -12
  115. package/lib/components/notification/index.js +0 -12
  116. package/lib/components/notification/notification_event.a11y.js +0 -105
  117. package/lib/components/notification/notification_event.js +0 -297
  118. package/lib/components/notification/notification_event_messages.js +0 -88
  119. package/lib/components/notification/notification_event_meta.js +0 -157
  120. package/lib/components/notification/notification_event_read_button.js +0 -93
  121. package/lib/components/notification/notification_event_read_icon.js +0 -64
  122. package/optimize/es/components/control_bar/control_bar.a11y.js +0 -128
  123. package/optimize/es/components/control_bar/control_bar.js +0 -308
  124. package/optimize/es/components/control_bar/index.js +0 -9
  125. package/optimize/es/components/notification/index.js +0 -9
  126. package/optimize/es/components/notification/notification_event.a11y.js +0 -99
  127. package/optimize/es/components/notification/notification_event.js +0 -114
  128. package/optimize/es/components/notification/notification_event_messages.js +0 -63
  129. package/optimize/es/components/notification/notification_event_meta.js +0 -106
  130. package/optimize/es/components/notification/notification_event_read_button.js +0 -44
  131. package/optimize/es/components/notification/notification_event_read_icon.js +0 -44
  132. package/optimize/lib/components/control_bar/control_bar.a11y.js +0 -134
  133. package/optimize/lib/components/control_bar/control_bar.js +0 -301
  134. package/optimize/lib/components/control_bar/index.js +0 -12
  135. package/optimize/lib/components/notification/index.js +0 -12
  136. package/optimize/lib/components/notification/notification_event.a11y.js +0 -105
  137. package/optimize/lib/components/notification/notification_event.js +0 -123
  138. package/optimize/lib/components/notification/notification_event_messages.js +0 -74
  139. package/optimize/lib/components/notification/notification_event_meta.js +0 -117
  140. package/optimize/lib/components/notification/notification_event_read_button.js +0 -51
  141. package/optimize/lib/components/notification/notification_event_read_icon.js +0 -51
  142. package/src/components/control_bar/_control_bar.scss +0 -232
  143. package/src/components/control_bar/_index.scss +0 -2
  144. package/src/components/control_bar/_variables.scss +0 -12
  145. package/src/components/notification/_index.scss +0 -5
  146. package/src/components/notification/_notification_event.scss +0 -40
  147. package/src/components/notification/_notification_event_messages.scss +0 -17
  148. package/src/components/notification/_notification_event_meta.scss +0 -44
  149. package/src/components/notification/_notification_event_read_button.scss +0 -5
  150. package/src/components/notification/_notification_event_read_icon.scss +0 -12
  151. package/test-env/components/control_bar/control_bar.a11y.js +0 -134
  152. package/test-env/components/control_bar/control_bar.js +0 -436
  153. package/test-env/components/control_bar/index.js +0 -12
  154. package/test-env/components/notification/index.js +0 -12
  155. package/test-env/components/notification/notification_event.a11y.js +0 -105
  156. package/test-env/components/notification/notification_event.js +0 -296
  157. package/test-env/components/notification/notification_event_messages.js +0 -85
  158. package/test-env/components/notification/notification_event_meta.js +0 -154
  159. package/test-env/components/notification/notification_event_read_button.js +0 -92
  160. package/test-env/components/notification/notification_event_read_icon.js +0 -63
@@ -98,18 +98,18 @@ export var EuiFlyout = /*#__PURE__*/forwardRef(function (_ref, ref) {
98
98
  */
99
99
  if (isPushed) {
100
100
  if (side === 'right') {
101
- document.body.style.paddingRight = "".concat(dimensions.width, "px");
101
+ document.body.style.paddingInlineEnd = "".concat(dimensions.width, "px");
102
102
  } else if (side === 'left') {
103
- document.body.style.paddingLeft = "".concat(dimensions.width, "px");
103
+ document.body.style.paddingInlineStart = "".concat(dimensions.width, "px");
104
104
  }
105
105
  }
106
106
  return function () {
107
107
  document.body.classList.remove('euiBody--hasFlyout');
108
108
  if (isPushed) {
109
109
  if (side === 'right') {
110
- document.body.style.paddingRight = '';
110
+ document.body.style.paddingInlineEnd = '';
111
111
  } else if (side === 'left') {
112
- document.body.style.paddingLeft = '';
112
+ document.body.style.paddingInlineStart = '';
113
113
  }
114
114
  }
115
115
  };
@@ -0,0 +1,121 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
+ var _excluded = ["size", "maxWidth", "minWidth", "side", "children"];
5
+ /*
6
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
7
+ * or more contributor license agreements. Licensed under the Elastic License
8
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
9
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
10
+ * Side Public License, v 1.
11
+ */
12
+
13
+ import React, { forwardRef, useState, useEffect, useRef, useMemo, useCallback } from 'react';
14
+ import { keys, useCombinedRefs, useEuiTheme } from '../../services';
15
+ import { EuiResizableButton } from '../resizable_container';
16
+ import { EuiFlyout } from './flyout';
17
+ import { euiFlyoutResizableButtonStyles } from './flyout_resizable.styles';
18
+ import { jsx as ___EmotionJSX } from "@emotion/react";
19
+ export var EuiFlyoutResizable = /*#__PURE__*/forwardRef(function (_ref, ref) {
20
+ var size = _ref.size,
21
+ maxWidth = _ref.maxWidth,
22
+ _ref$minWidth = _ref.minWidth,
23
+ minWidth = _ref$minWidth === void 0 ? 200 : _ref$minWidth,
24
+ _ref$side = _ref.side,
25
+ side = _ref$side === void 0 ? 'right' : _ref$side,
26
+ children = _ref.children,
27
+ rest = _objectWithoutProperties(_ref, _excluded);
28
+ var euiTheme = useEuiTheme();
29
+ var styles = euiFlyoutResizableButtonStyles(euiTheme);
30
+ var cssStyles = [styles.euiFlyoutResizableButton, styles[side]];
31
+ var getFlyoutMinMaxWidth = useCallback(function (width) {
32
+ return Math.min(Math.max(width, minWidth), maxWidth || Infinity, window.innerWidth - 20 // Leave some offset
33
+ );
34
+ }, [minWidth, maxWidth]);
35
+ var _useState = useState(0),
36
+ _useState2 = _slicedToArray(_useState, 2),
37
+ flyoutWidth = _useState2[0],
38
+ setFlyoutWidth = _useState2[1];
39
+
40
+ // Must use state for the flyout ref in order for the useEffect to be correctly called after render
41
+ var _useState3 = useState(null),
42
+ _useState4 = _slicedToArray(_useState3, 2),
43
+ flyoutRef = _useState4[0],
44
+ setFlyoutRef = _useState4[1];
45
+ var setRefs = useCombinedRefs([setFlyoutRef, ref]);
46
+ useEffect(function () {
47
+ setFlyoutWidth(flyoutRef ? getFlyoutMinMaxWidth(flyoutRef.offsetWidth) : 0);
48
+ }, [flyoutRef, getFlyoutMinMaxWidth, size]);
49
+
50
+ // Initial numbers to calculate from, on resize drag start
51
+ var initialWidth = useRef(0);
52
+ var initialMouseX = useRef(0);
53
+
54
+ // Account for flyout side and logical property direction
55
+ var direction = useMemo(function () {
56
+ var modifier = side === 'right' ? -1 : 1;
57
+ if (flyoutRef) {
58
+ var languageDirection = window.getComputedStyle(flyoutRef).direction;
59
+ if (languageDirection === 'rtl') modifier *= -1;
60
+ }
61
+ return modifier;
62
+ }, [side, flyoutRef]);
63
+ var onMouseMove = useCallback(function (e) {
64
+ var mouseOffset = getMouseOrTouchX(e) - initialMouseX.current;
65
+ var changedFlyoutWidth = initialWidth.current + mouseOffset * direction;
66
+ setFlyoutWidth(getFlyoutMinMaxWidth(changedFlyoutWidth));
67
+ }, [getFlyoutMinMaxWidth, direction]);
68
+ var onMouseUp = useCallback(function () {
69
+ initialMouseX.current = 0;
70
+ window.removeEventListener('mousemove', onMouseMove);
71
+ window.removeEventListener('mouseup', onMouseUp);
72
+ window.removeEventListener('touchmove', onMouseMove);
73
+ window.removeEventListener('touchend', onMouseUp);
74
+ }, [onMouseMove]);
75
+ var onMouseDown = useCallback(function (e) {
76
+ var _flyoutRef$offsetWidt;
77
+ initialMouseX.current = getMouseOrTouchX(e);
78
+ initialWidth.current = (_flyoutRef$offsetWidt = flyoutRef === null || flyoutRef === void 0 ? void 0 : flyoutRef.offsetWidth) !== null && _flyoutRef$offsetWidt !== void 0 ? _flyoutRef$offsetWidt : 0;
79
+
80
+ // Window event listeners instead of React events are used
81
+ // in case the user's mouse leaves the component
82
+ window.addEventListener('mousemove', onMouseMove);
83
+ window.addEventListener('mouseup', onMouseUp);
84
+ window.addEventListener('touchmove', onMouseMove);
85
+ window.addEventListener('touchend', onMouseUp);
86
+ }, [flyoutRef, onMouseMove, onMouseUp]);
87
+ var onKeyDown = useCallback(function (e) {
88
+ var KEYBOARD_OFFSET = 10;
89
+ switch (e.key) {
90
+ case keys.ARROW_RIGHT:
91
+ e.preventDefault(); // Safari+VO will screen reader navigate off the button otherwise
92
+ setFlyoutWidth(function (flyoutWidth) {
93
+ return getFlyoutMinMaxWidth(flyoutWidth + KEYBOARD_OFFSET * direction);
94
+ });
95
+ break;
96
+ case keys.ARROW_LEFT:
97
+ e.preventDefault(); // Safari+VO will screen reader navigate off the button otherwise
98
+ setFlyoutWidth(function (flyoutWidth) {
99
+ return getFlyoutMinMaxWidth(flyoutWidth - KEYBOARD_OFFSET * direction);
100
+ });
101
+ }
102
+ }, [getFlyoutMinMaxWidth, direction]);
103
+ return ___EmotionJSX(EuiFlyout, _extends({}, rest, {
104
+ size: flyoutWidth || size,
105
+ maxWidth: maxWidth,
106
+ side: side,
107
+ ref: setRefs
108
+ }), ___EmotionJSX(EuiResizableButton, {
109
+ isHorizontal: true,
110
+ css: cssStyles,
111
+ onMouseDown: onMouseDown,
112
+ onTouchStart: onMouseDown,
113
+ onKeyDown: onKeyDown
114
+ }), children);
115
+ });
116
+ EuiFlyoutResizable.displayName = 'EuiFlyoutResizable';
117
+ var getMouseOrTouchX = function getMouseOrTouchX(e) {
118
+ // Some Typescript fooling is needed here
119
+ var x = e.targetTouches ? e.targetTouches[0].pageX : e.pageX;
120
+ return x;
121
+ };
@@ -0,0 +1,27 @@
1
+ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
2
+ /*
3
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
4
+ * or more contributor license agreements. Licensed under the Elastic License
5
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
6
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
7
+ * Side Public License, v 1.
8
+ */
9
+
10
+ import { css } from '@emotion/react';
11
+ import { logicalCSS } from '../../global_styling';
12
+ var _ref = process.env.NODE_ENV === "production" ? {
13
+ name: "6syi0e-euiFlyoutResizableButton",
14
+ styles: "position:absolute;&::before,&::after{background-color:transparent;};label:euiFlyoutResizableButton;"
15
+ } : {
16
+ name: "6syi0e-euiFlyoutResizableButton",
17
+ styles: "position:absolute;&::before,&::after{background-color:transparent;};label:euiFlyoutResizableButton;",
18
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
19
+ };
20
+ export var euiFlyoutResizableButtonStyles = function euiFlyoutResizableButtonStyles(_ref2) {
21
+ var euiTheme = _ref2.euiTheme;
22
+ return {
23
+ euiFlyoutResizableButton: _ref,
24
+ left: /*#__PURE__*/css(logicalCSS('right', "-".concat(euiTheme.border.width.thin)), ";;label:left;"),
25
+ right: /*#__PURE__*/css(logicalCSS('left', "-".concat(euiTheme.border.width.thin)), ";;label:right;")
26
+ };
27
+ };
@@ -10,4 +10,5 @@ export { EuiFlyout } from './flyout';
10
10
  export { EuiFlyoutBody } from './flyout_body';
11
11
  export { EuiFlyoutFooter } from './flyout_footer';
12
12
  export { EuiFlyoutHeader } from './flyout_header';
13
- export { euiFlyoutSlideInRight, euiFlyoutSlideInLeft } from './flyout.styles';
13
+ export { euiFlyoutSlideInRight, euiFlyoutSlideInLeft } from './flyout.styles';
14
+ export { EuiFlyoutResizable } from './flyout_resizable';
@@ -54,38 +54,10 @@ export var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
54
54
  _this = _super.call.apply(_super, [this].concat(args));
55
55
  _defineProperty(_assertThisInitialized(_this), "state", {
56
56
  id: _this.props.id || htmlIdGenerator()(),
57
- rangeSliderRefAvailable: false,
58
57
  isPopoverOpen: false,
59
- rangeWidth: 0,
60
- isVisible: true // used to trigger a rerender if initial element width is 0
58
+ rangeWidth: 0
61
59
  });
62
60
  _defineProperty(_assertThisInitialized(_this), "preventPopoverClose", false);
63
- _defineProperty(_assertThisInitialized(_this), "rangeSliderRef", null);
64
- _defineProperty(_assertThisInitialized(_this), "handleRangeSliderRefUpdate", function (ref) {
65
- _this.rangeSliderRef = ref;
66
- if (ref) {
67
- if (_this.isInPopover) {
68
- // Wait a tick for popover rendering to settle
69
- requestAnimationFrame(function () {
70
- _this.setState({
71
- rangeSliderRefAvailable: true,
72
- rangeWidth: ref.clientWidth
73
- });
74
- });
75
- } else {
76
- // If not in a popover, no need to wait
77
- _this.setState({
78
- rangeSliderRefAvailable: true,
79
- rangeWidth: ref.clientWidth
80
- });
81
- }
82
- } else {
83
- _this.setState({
84
- rangeSliderRefAvailable: false,
85
- rangeWidth: 0
86
- });
87
- }
88
- });
89
61
  _defineProperty(_assertThisInitialized(_this), "leftPosition", 0);
90
62
  _defineProperty(_assertThisInitialized(_this), "dragAcc", 0);
91
63
  _defineProperty(_assertThisInitialized(_this), "_determineInvalidThumbMovement", function (newVal, lower, upper, e) {
@@ -276,14 +248,11 @@ export var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
276
248
  isPopoverOpen: false
277
249
  });
278
250
  });
279
- _defineProperty(_assertThisInitialized(_this), "onResize", function (width) {
280
- var _this$props$inputPopo, _this$props$inputPopo2;
281
- if (_this.rangeSliderRef) {
282
- _this.setState({
283
- rangeWidth: _this.rangeSliderRef.clientWidth
284
- });
285
- }
286
- (_this$props$inputPopo = _this.props.inputPopoverProps) === null || _this$props$inputPopo === void 0 ? void 0 : (_this$props$inputPopo2 = _this$props$inputPopo.onPanelResize) === null || _this$props$inputPopo2 === void 0 ? void 0 : _this$props$inputPopo2.call(_this$props$inputPopo, width);
251
+ _defineProperty(_assertThisInitialized(_this), "setRangeWidth", function (_ref) {
252
+ var width = _ref.width;
253
+ _this.setState({
254
+ rangeWidth: width
255
+ });
287
256
  });
288
257
  _defineProperty(_assertThisInitialized(_this), "getNearestStep", function (value) {
289
258
  var min = _this.props.min;
@@ -306,7 +275,7 @@ export var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
306
275
  var delta = _this.leftPosition - x;
307
276
  _this.leftPosition = x;
308
277
  _this.dragAcc = _this.dragAcc + delta;
309
- var percentageOfArea = _this.dragAcc / _this.rangeSliderRef.clientWidth;
278
+ var percentageOfArea = _this.dragAcc / _this.state.rangeWidth;
310
279
  var percentageOfRange = percentageOfArea * (max - min);
311
280
  var newLower = _this.getNearestStep(lowerValue - percentageOfRange);
312
281
  var newUpper = _this.getNearestStep(upperValue - percentageOfRange);
@@ -350,32 +319,12 @@ export var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
350
319
  get: function get() {
351
320
  return this.lowerValueIsValid && this.upperValueIsValid;
352
321
  }
353
- }, {
354
- key: "componentDidMount",
355
- value: function componentDidMount() {
356
- var _this$rangeSliderRef;
357
- if (((_this$rangeSliderRef = this.rangeSliderRef) === null || _this$rangeSliderRef === void 0 ? void 0 : _this$rangeSliderRef.clientWidth) === 0) {
358
- this.setState({
359
- isVisible: false
360
- });
361
- }
362
- }
363
- }, {
364
- key: "componentDidUpdate",
365
- value: function componentDidUpdate() {
366
- var _this$rangeSliderRef2;
367
- if ((_this$rangeSliderRef2 = this.rangeSliderRef) !== null && _this$rangeSliderRef2 !== void 0 && _this$rangeSliderRef2.clientWidth && !this.state.isVisible) {
368
- this.setState({
369
- isVisible: true
370
- });
371
- }
372
- }
373
322
  }, {
374
323
  key: "render",
375
324
  value: function render() {
376
325
  var _this2 = this;
377
- var _ref = this.context,
378
- defaultFullWidth = _ref.defaultFullWidth;
326
+ var _ref2 = this.context,
327
+ defaultFullWidth = _ref2.defaultFullWidth;
379
328
  var _this$props = this.props,
380
329
  className = _this$props.className,
381
330
  customCss = _this$props.css,
@@ -531,10 +480,10 @@ export var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
531
480
  var classes = classNames('euiDualRange', className);
532
481
  var dualRangeStyles = euiDualRangeStyles();
533
482
  var cssStyles = [dualRangeStyles.euiDualRange, customCss];
534
- var leftThumbPosition = this.state.rangeSliderRefAvailable ? this.calculateThumbPositionStyle(Number(this.lowerValue) || min, this.state.rangeWidth) : {
483
+ var leftThumbPosition = this.state.rangeWidth ? this.calculateThumbPositionStyle(Number(this.lowerValue) || min, this.state.rangeWidth) : {
535
484
  left: '0'
536
485
  };
537
- var rightThumbPosition = this.state.rangeSliderRefAvailable ? this.calculateThumbPositionStyle(Number(this.upperValue) || max, this.state.rangeWidth) : {
486
+ var rightThumbPosition = this.state.rangeWidth ? this.calculateThumbPositionStyle(Number(this.upperValue) || max, this.state.rangeWidth) : {
538
487
  left: '0'
539
488
  };
540
489
  var leftThumbColor = levels && getLevelColor(levels, Number(this.lowerValue));
@@ -578,7 +527,6 @@ export var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
578
527
  }, ___EmotionJSX(EuiRangeSlider, _extends({
579
528
  className: "euiDualRange__slider",
580
529
  css: dualRangeStyles.euiDualRange__slider,
581
- ref: this.handleRangeSliderRefUpdate,
582
530
  id: id,
583
531
  name: name,
584
532
  min: min,
@@ -592,7 +540,9 @@ export var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
592
540
  showRange: showRange,
593
541
  onFocus: _onFocus,
594
542
  onBlur: _onBlur
595
- }, rest)), this.state.rangeSliderRefAvailable && ___EmotionJSX(React.Fragment, null, isDraggable && this.isValid && ___EmotionJSX(EuiRangeDraggable, {
543
+ }, rest, {
544
+ onResize: this.setRangeWidth
545
+ })), isDraggable && this.isValid && ___EmotionJSX(EuiRangeDraggable, {
596
546
  min: min,
597
547
  max: max,
598
548
  value: [this.lowerValue, this.upperValue],
@@ -632,7 +582,7 @@ export var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
632
582
  style: logicalStyles(rightThumbStyles),
633
583
  "aria-describedby": showInputOnly ? undefined : this.props['aria-describedby'],
634
584
  "aria-label": showInputOnly ? undefined : this.props['aria-label']
635
- })), showRange && this.isValid && ___EmotionJSX(EuiRangeHighlight, {
585
+ }), showRange && this.isValid && ___EmotionJSX(EuiRangeHighlight, {
636
586
  showTicks: showTicks,
637
587
  min: Number(min),
638
588
  max: Number(max),
@@ -664,7 +614,6 @@ export var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
664
614
  isOpen: this.state.isPopoverOpen,
665
615
  closePopover: this.closePopover,
666
616
  disableFocusTrap: true,
667
- onPanelResize: this.onResize,
668
617
  popoverScreenReaderText: dualSliderScreenReaderInstructions
669
618
  }), theRange) : undefined;
670
619
  return thePopover || theRange;
@@ -57,9 +57,10 @@ export var EuiRangeClass = /*#__PURE__*/function (_Component) {
57
57
  _this.props.onChange(e, isValid);
58
58
  }
59
59
  });
60
- _defineProperty(_assertThisInitialized(_this), "rangeSliderRef", function (ref) {
60
+ _defineProperty(_assertThisInitialized(_this), "setTrackWidth", function (_ref) {
61
+ var width = _ref.width;
61
62
  _this.setState({
62
- trackWidth: (ref === null || ref === void 0 ? void 0 : ref.clientWidth) || 0
63
+ trackWidth: width
63
64
  });
64
65
  });
65
66
  _defineProperty(_assertThisInitialized(_this), "onInputFocus", function (e) {
@@ -103,8 +104,8 @@ export var EuiRangeClass = /*#__PURE__*/function (_Component) {
103
104
  key: "render",
104
105
  value: function render() {
105
106
  var _this2 = this;
106
- var _ref = this.context,
107
- defaultFullWidth = _ref.defaultFullWidth;
107
+ var _ref2 = this.context,
108
+ defaultFullWidth = _ref2.defaultFullWidth;
108
109
  var _this$props = this.props,
109
110
  className = _this$props.className,
110
111
  compressed = _this$props.compressed,
@@ -210,7 +211,7 @@ export var EuiRangeClass = /*#__PURE__*/function (_Component) {
210
211
  "aria-hidden": !!showInput,
211
212
  thumbColor: thumbColor
212
213
  }, rest, {
213
- ref: this.rangeSliderRef
214
+ onResize: this.setTrackWidth
214
215
  })), showRange && this.isValid && ___EmotionJSX(EuiRangeHighlight, {
215
216
  showTicks: showTicks,
216
217
  min: Number(min),
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["className", "disabled", "id", "max", "min", "name", "step", "onChange", "tabIndex", "value", "style", "showTicks", "showRange", "thumbColor"];
4
+ var _excluded = ["className", "disabled", "id", "max", "min", "name", "step", "onChange", "tabIndex", "value", "style", "showTicks", "showRange", "thumbColor", "onResize"];
5
5
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
6
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7
7
  /*
@@ -12,14 +12,15 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
12
12
  * Side Public License, v 1.
13
13
  */
14
14
 
15
- import React, { forwardRef, useMemo } from 'react';
15
+ import React, { useMemo } from 'react';
16
16
  import classNames from 'classnames';
17
17
  import { useEuiTheme } from '../../../services';
18
18
  import { logicalStyles } from '../../../global_styling';
19
+ import { EuiResizeObserver } from '../../observer/resize_observer';
19
20
  import { euiRangeLevelColor } from './range_levels_colors';
20
21
  import { euiRangeSliderStyles, euiRangeSliderThumbStyles } from './range_slider.styles';
21
22
  import { jsx as ___EmotionJSX } from "@emotion/react";
22
- export var EuiRangeSlider = /*#__PURE__*/forwardRef(function (_ref, ref) {
23
+ export var EuiRangeSlider = function EuiRangeSlider(_ref) {
23
24
  var className = _ref.className,
24
25
  disabled = _ref.disabled,
25
26
  id = _ref.id,
@@ -34,6 +35,7 @@ export var EuiRangeSlider = /*#__PURE__*/forwardRef(function (_ref, ref) {
34
35
  showTicks = _ref.showTicks,
35
36
  showRange = _ref.showRange,
36
37
  thumbColor = _ref.thumbColor,
38
+ onResize = _ref.onResize,
37
39
  rest = _objectWithoutProperties(_ref, _excluded);
38
40
  var classes = classNames('euiRangeSlider', className);
39
41
  var euiTheme = useEuiTheme();
@@ -45,21 +47,24 @@ export var EuiRangeSlider = /*#__PURE__*/forwardRef(function (_ref, ref) {
45
47
  color: thumbColor && euiRangeLevelColor(thumbColor, euiTheme.euiTheme)
46
48
  }, style));
47
49
  }, [thumbColor, euiTheme, style]);
48
- return ___EmotionJSX("input", _extends({
49
- ref: ref,
50
- type: "range",
51
- id: id,
52
- name: name,
53
- className: classes,
54
- css: cssStyles,
55
- min: min,
56
- max: max,
57
- step: step,
58
- value: value,
59
- disabled: disabled,
60
- onChange: onChange,
61
- style: sliderStyle,
62
- tabIndex: tabIndex
63
- }, rest));
64
- });
65
- EuiRangeSlider.displayName = 'EuiRangeSlider';
50
+ return ___EmotionJSX(EuiResizeObserver, {
51
+ onResize: onResize
52
+ }, function (resizeRef) {
53
+ return ___EmotionJSX("input", _extends({
54
+ ref: resizeRef,
55
+ type: "range",
56
+ id: id,
57
+ name: name,
58
+ className: classes,
59
+ css: cssStyles,
60
+ min: min,
61
+ max: max,
62
+ step: step,
63
+ value: value,
64
+ disabled: disabled,
65
+ onChange: onChange,
66
+ style: sliderStyle,
67
+ tabIndex: tabIndex
68
+ }, rest));
69
+ });
70
+ };
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["children", "className", "compressed", "fullWidth", "id", "inputRef", "isLoading", "isInvalid", "name", "placeholder", "resize", "rows"];
3
+ var _excluded = ["children", "className", "compressed", "fullWidth", "id", "icon", "inputRef", "isLoading", "isInvalid", "isClearable", "name", "placeholder", "resize", "rows"];
4
4
  /*
5
5
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
6
6
  * or more contributor license agreements. Licensed under the Elastic License
@@ -9,8 +9,9 @@ var _excluded = ["children", "className", "compressed", "fullWidth", "id", "inpu
9
9
  * Side Public License, v 1.
10
10
  */
11
11
 
12
- import React from 'react';
12
+ import React, { useRef, useMemo } from 'react';
13
13
  import classNames from 'classnames';
14
+ import { useCombinedRefs } from '../../../services';
14
15
  import { EuiFormControlLayout } from '../form_control_layout';
15
16
  import { EuiValidatableControl } from '../validatable_control';
16
17
  import { useFormContext } from '../eui_form_context';
@@ -31,9 +32,11 @@ export var EuiTextArea = function EuiTextArea(props) {
31
32
  _props$fullWidth = props.fullWidth,
32
33
  fullWidth = _props$fullWidth === void 0 ? defaultFullWidth : _props$fullWidth,
33
34
  id = props.id,
35
+ icon = props.icon,
34
36
  inputRef = props.inputRef,
35
37
  isLoading = props.isLoading,
36
38
  isInvalid = props.isInvalid,
39
+ isClearable = props.isClearable,
37
40
  name = props.name,
38
41
  placeholder = props.placeholder,
39
42
  _props$resize = props.resize,
@@ -52,10 +55,33 @@ export var EuiTextArea = function EuiTextArea(props) {
52
55
  } else {
53
56
  definedRows = 6;
54
57
  }
58
+ var ref = useRef(null);
59
+ var refs = useCombinedRefs([ref, inputRef]);
60
+ var clear = useMemo(function () {
61
+ if (isClearable) {
62
+ return {
63
+ onClick: function onClick() {
64
+ if (ref.current) {
65
+ ref.current.value = '';
66
+ var event = new Event('input', {
67
+ bubbles: true,
68
+ cancelable: false
69
+ });
70
+ ref.current.dispatchEvent(event);
71
+ ref.current.focus(); // set focus back to the textarea
72
+ }
73
+ },
74
+
75
+ 'data-test-subj': 'clearTextAreaButton'
76
+ };
77
+ }
78
+ }, [isClearable]);
55
79
  return ___EmotionJSX(EuiFormControlLayout, {
56
80
  fullWidth: fullWidth,
57
81
  isLoading: isLoading,
58
82
  isInvalid: isInvalid,
83
+ clear: clear,
84
+ icon: icon,
59
85
  className: "euiFormControlLayout--euiTextArea"
60
86
  }, ___EmotionJSX(EuiValidatableControl, {
61
87
  isInvalid: isInvalid
@@ -65,7 +91,7 @@ export var EuiTextArea = function EuiTextArea(props) {
65
91
  rows: definedRows,
66
92
  name: name,
67
93
  id: id,
68
- ref: inputRef,
94
+ ref: refs,
69
95
  placeholder: placeholder
70
96
  }), children)));
71
97
  };
@@ -26,7 +26,6 @@ export * from './combo_box';
26
26
  export * from './comment_list';
27
27
  export * from './context';
28
28
  export * from './context_menu';
29
- export * from './control_bar';
30
29
  export * from './copy';
31
30
  export * from './datagrid';
32
31
  export * from './date_picker';
@@ -60,7 +59,6 @@ export * from './markdown_editor';
60
59
  export * from './mark';
61
60
  export * from './modal';
62
61
  export * from './observer/mutation_observer';
63
- export * from './notification';
64
62
  export * from './outside_click_detector';
65
63
  export * from './overlay_mask';
66
64
  export * from './page';
@@ -258,20 +258,19 @@ export var EuiMarkdownEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
258
258
  setEditorToolbarHeight(editorToolbarRef.current.offsetHeight);
259
259
  }, [setEditorToolbarHeight]);
260
260
  useEffect(function () {
261
- if (isPreviewing && autoExpandPreview && height !== 'full') {
262
- if (previewRef.current.scrollHeight > currentHeight) {
263
- // scrollHeight does not include the border or margin
264
- // so we ask for the computed value for those,
265
- // which is always in pixels because getComputedValue
266
- // returns the resolved values
267
- var elementComputedStyle = window.getComputedStyle(previewRef.current);
268
- var borderWidth = parseFloat(elementComputedStyle.borderTopWidth) + parseFloat(elementComputedStyle.borderBottomWidth);
269
- var marginWidth = parseFloat(elementComputedStyle.marginTop) + parseFloat(elementComputedStyle.marginBottom);
261
+ if (height === 'full' || currentHeight === 'full') return;
262
+ if (isPreviewing && autoExpandPreview && previewRef.current.scrollHeight > currentHeight) {
263
+ // scrollHeight does not include the border or margin
264
+ // so we ask for the computed value for those,
265
+ // which is always in pixels because getComputedValue
266
+ // returns the resolved values
267
+ var elementComputedStyle = window.getComputedStyle(previewRef.current);
268
+ var borderWidth = parseFloat(elementComputedStyle.borderTopWidth) + parseFloat(elementComputedStyle.borderBottomWidth);
269
+ var marginWidth = parseFloat(elementComputedStyle.marginTop) + parseFloat(elementComputedStyle.marginBottom);
270
270
 
271
- // then add an extra pixel for safety and because the scrollHeight value is rounded
272
- var extraHeight = borderWidth + marginWidth + 1;
273
- setCurrentHeight(previewRef.current.scrollHeight + extraHeight);
274
- }
271
+ // then add an extra pixel for safety and because the scrollHeight value is rounded
272
+ var extraHeight = borderWidth + marginWidth + 1;
273
+ setCurrentHeight(previewRef.current.scrollHeight + extraHeight);
275
274
  }
276
275
  }, [currentHeight, isPreviewing, height, autoExpandPreview]);
277
276
  var previewHeight = height === 'full' ? "calc(100% - ".concat(editorFooterHeight, "px)") : currentHeight;
@@ -55,7 +55,7 @@ export var _EuiPageBottomBar = function _EuiPageBottomBar(_ref2) {
55
55
  // Hide the overflow in case of larger flex margins than padding
56
56
  ,
57
57
  css: _ref
58
- // Using unknown here because of the possible conflict with overriding props and position `sticky`
58
+ // Using object here because of the possible conflict with overriding props and position `sticky`
59
59
  }, rest), ___EmotionJSX(EuiPageSection, {
60
60
  paddingSize: paddingSize,
61
61
  restrictWidth: restrictWidth
@@ -208,7 +208,7 @@ export var EuiSelectableListItem = /*#__PURE__*/function (_Component) {
208
208
  onFocusBadgeNode = ___EmotionJSX(EuiBadge, _extends({
209
209
  className: "euiSelectableListItem__onFocusBadge"
210
210
  }, defaultOnFocusBadgeProps));
211
- } else if (!!onFocusBadge && onFocusBadge !== false) {
211
+ } else if (typeof onFocusBadge !== 'boolean' && !!onFocusBadge) {
212
212
  var _children = onFocusBadge.children,
213
213
  _className = onFocusBadge.className,
214
214
  restBadgeProps = _objectWithoutProperties(onFocusBadge, _excluded2);
@@ -42,34 +42,12 @@ var displayToClassNameMap = {
42
42
  export var EuiTreeView = /*#__PURE__*/function (_Component) {
43
43
  _inherits(EuiTreeView, _Component);
44
44
  var _super = _createSuper(EuiTreeView);
45
- function EuiTreeView() {
45
+ function EuiTreeView(props, context) {
46
46
  var _this;
47
47
  _classCallCheck(this, EuiTreeView);
48
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
49
- args[_key] = arguments[_key];
50
- }
51
- _this = _super.call.apply(_super, [this].concat(args));
48
+ _this = _super.call(this, props, context);
52
49
  _defineProperty(_assertThisInitialized(_this), "treeIdGenerator", htmlIdGenerator('euiTreeView'));
53
- _defineProperty(_assertThisInitialized(_this), "isNested", !!_this.context);
54
- _defineProperty(_assertThisInitialized(_this), "state", {
55
- openItems: _this.props.expandByDefault ? _this.props.items.map(function (_ref) {
56
- var id = _ref.id,
57
- children = _ref.children;
58
- return children ? id : null;
59
- }).filter(function (x) {
60
- return x != null;
61
- }) : _this.props.items.map(function (_ref2) {
62
- var id = _ref2.id,
63
- children = _ref2.children,
64
- isExpanded = _ref2.isExpanded;
65
- return children && isExpanded ? id : null;
66
- }).filter(function (x) {
67
- return x != null;
68
- }),
69
- activeItem: '',
70
- treeID: getTreeId(_this.props.id, _this.context, _this.treeIdGenerator),
71
- expandChildNodes: _this.props.expandByDefault || false
72
- });
50
+ _defineProperty(_assertThisInitialized(_this), "isNested", void 0);
73
51
  _defineProperty(_assertThisInitialized(_this), "buttonRef", []);
74
52
  _defineProperty(_assertThisInitialized(_this), "setButtonRef", function (ref, index) {
75
53
  _this.buttonRef[index] = ref;
@@ -164,6 +142,26 @@ export var EuiTreeView = /*#__PURE__*/function (_Component) {
164
142
  _this.buttonRef[index].focus();
165
143
  }
166
144
  });
145
+ _this.isNested = !!_this.context;
146
+ _this.state = {
147
+ openItems: _this.props.expandByDefault ? _this.props.items.map(function (_ref) {
148
+ var id = _ref.id,
149
+ children = _ref.children;
150
+ return children ? id : null;
151
+ }).filter(function (x) {
152
+ return x != null;
153
+ }) : _this.props.items.map(function (_ref2) {
154
+ var id = _ref2.id,
155
+ children = _ref2.children,
156
+ isExpanded = _ref2.isExpanded;
157
+ return children && isExpanded ? id : null;
158
+ }).filter(function (x) {
159
+ return x != null;
160
+ }),
161
+ activeItem: '',
162
+ treeID: getTreeId(_this.props.id, context, _this.treeIdGenerator),
163
+ expandChildNodes: _this.props.expandByDefault || false
164
+ };
167
165
  return _this;
168
166
  }
169
167
  _createClass(EuiTreeView, [{