@elastic/eui 66.0.0 → 67.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 (196) hide show
  1. package/dist/eui_theme_dark.css +0 -247
  2. package/dist/eui_theme_dark.json +0 -6
  3. package/dist/eui_theme_dark.json.d.ts +0 -6
  4. package/dist/eui_theme_dark.min.css +1 -1
  5. package/dist/eui_theme_light.css +0 -247
  6. package/dist/eui_theme_light.json +0 -6
  7. package/dist/eui_theme_light.json.d.ts +0 -6
  8. package/dist/eui_theme_light.min.css +1 -1
  9. package/es/components/button/button_display/_button_display.js +10 -1
  10. package/es/components/button/button_empty/button_empty.js +10 -1
  11. package/es/components/collapsible_nav/collapsible_nav.js +0 -5
  12. package/es/components/date_picker/auto_refresh/auto_refresh.js +6 -1
  13. package/es/components/date_picker/super_date_picker/date_popover/date_popover_button.js +6 -2
  14. package/es/components/expression/expression.js +12 -2
  15. package/es/components/header/header_links/header_link.js +10 -1
  16. package/es/components/image/image.js +6 -1
  17. package/es/components/image/image_fullscreen_wrapper.js +2 -3
  18. package/es/components/notification/notification_event.js +24 -5
  19. package/es/components/overlay_mask/overlay_mask.js +27 -65
  20. package/es/components/overlay_mask/overlay_mask.styles.js +28 -0
  21. package/es/components/page/page_content/page_content.js +1 -2
  22. package/es/components/page/page_content/page_content_body.js +1 -2
  23. package/es/components/page/page_content/page_content_header.js +1 -2
  24. package/es/components/page/page_content/page_content_header_section.js +1 -2
  25. package/es/components/page/page_section/page_section.js +15 -3
  26. package/es/components/page/page_side_bar/page_side_bar.js +1 -2
  27. package/es/components/page/page_template.js +3 -1
  28. package/es/components/page_template/empty_prompt/page_empty_prompt.js +11 -1
  29. package/es/components/page_template/page_template.js +18 -2
  30. package/es/components/pagination/pagination.js +17 -4
  31. package/es/components/pagination/pagination.styles.js +31 -0
  32. package/es/components/pagination/pagination_button.js +17 -5
  33. package/es/components/pagination/pagination_button.styles.js +30 -0
  34. package/es/components/pagination/pagination_button_arrow.js +5 -0
  35. package/es/components/progress/progress.js +6 -1
  36. package/es/components/provider/cache/cache_provider.js +3 -9
  37. package/es/components/provider/provider.js +25 -2
  38. package/es/components/resizable_container/resizable_panel.js +6 -1
  39. package/es/components/side_nav/side_nav.js +5 -0
  40. package/es/components/suggest/suggest.js +10 -1
  41. package/es/components/tool_tip/tool_tip.js +42 -66
  42. package/es/components/tool_tip/tool_tip.styles.js +107 -0
  43. package/es/components/tool_tip/tool_tip_anchor.js +73 -0
  44. package/es/components/tool_tip/tool_tip_arrow.js +20 -0
  45. package/es/components/tool_tip/tool_tip_popover.js +48 -101
  46. package/es/global_styling/index.js +2 -1
  47. package/es/global_styling/utility/animations.js +13 -0
  48. package/eui.d.ts +128 -51
  49. package/i18ntokens.json +54 -54
  50. package/lib/components/button/button_display/_button_display.js +10 -1
  51. package/lib/components/button/button_empty/button_empty.js +10 -1
  52. package/lib/components/collapsible_nav/collapsible_nav.js +0 -5
  53. package/lib/components/date_picker/auto_refresh/auto_refresh.js +6 -1
  54. package/lib/components/date_picker/super_date_picker/date_popover/date_popover_button.js +6 -1
  55. package/lib/components/expression/expression.js +12 -2
  56. package/lib/components/header/header_links/header_link.js +10 -1
  57. package/lib/components/image/image.js +6 -1
  58. package/lib/components/image/image_fullscreen_wrapper.js +2 -3
  59. package/lib/components/notification/notification_event.js +27 -8
  60. package/lib/components/overlay_mask/overlay_mask.js +27 -65
  61. package/lib/components/overlay_mask/overlay_mask.styles.js +34 -0
  62. package/lib/components/page/page_content/page_content.js +1 -2
  63. package/lib/components/page/page_content/page_content_body.js +1 -2
  64. package/lib/components/page/page_content/page_content_header.js +1 -2
  65. package/lib/components/page/page_content/page_content_header_section.js +1 -2
  66. package/lib/components/page/page_section/page_section.js +15 -3
  67. package/lib/components/page/page_side_bar/page_side_bar.js +1 -2
  68. package/lib/components/page/page_template.js +3 -1
  69. package/lib/components/page_template/empty_prompt/page_empty_prompt.js +11 -1
  70. package/lib/components/page_template/page_template.js +18 -2
  71. package/lib/components/pagination/pagination.js +18 -3
  72. package/lib/components/pagination/pagination.styles.js +34 -0
  73. package/lib/components/pagination/pagination_button.js +9 -4
  74. package/lib/components/pagination/pagination_button.styles.js +45 -0
  75. package/lib/components/pagination/pagination_button_arrow.js +7 -0
  76. package/lib/components/progress/progress.js +6 -1
  77. package/lib/components/provider/cache/cache_provider.js +3 -11
  78. package/lib/components/provider/provider.js +31 -6
  79. package/lib/components/resizable_container/resizable_panel.js +6 -1
  80. package/lib/components/side_nav/side_nav.js +5 -0
  81. package/lib/components/suggest/suggest.js +10 -1
  82. package/lib/components/tool_tip/tool_tip.js +43 -64
  83. package/lib/components/tool_tip/tool_tip.styles.js +123 -0
  84. package/lib/components/tool_tip/tool_tip_anchor.js +87 -0
  85. package/lib/components/tool_tip/tool_tip_arrow.js +28 -0
  86. package/lib/components/tool_tip/tool_tip_popover.js +49 -98
  87. package/lib/global_styling/index.js +13 -0
  88. package/lib/global_styling/utility/animations.js +15 -0
  89. package/optimize/es/components/date_picker/super_date_picker/date_popover/date_popover_button.js +0 -1
  90. package/optimize/es/components/image/image_fullscreen_wrapper.js +2 -3
  91. package/optimize/es/components/notification/notification_event.js +10 -4
  92. package/optimize/es/components/overlay_mask/overlay_mask.js +27 -60
  93. package/optimize/es/components/overlay_mask/overlay_mask.styles.js +28 -0
  94. package/optimize/es/components/page/page_content/page_content.js +1 -2
  95. package/optimize/es/components/page/page_content/page_content_body.js +1 -2
  96. package/optimize/es/components/page/page_content/page_content_header.js +1 -2
  97. package/optimize/es/components/page/page_content/page_content_header_section.js +1 -2
  98. package/optimize/es/components/page/page_section/page_section.js +4 -2
  99. package/optimize/es/components/page/page_side_bar/page_side_bar.js +1 -2
  100. package/optimize/es/components/page/page_template.js +3 -1
  101. package/optimize/es/components/pagination/pagination.js +17 -4
  102. package/optimize/es/components/pagination/pagination.styles.js +31 -0
  103. package/optimize/es/components/pagination/pagination_button.js +7 -4
  104. package/optimize/es/components/pagination/pagination_button.styles.js +30 -0
  105. package/optimize/es/components/pagination/pagination_button_arrow.js +5 -0
  106. package/optimize/es/components/provider/cache/cache_provider.js +3 -9
  107. package/optimize/es/components/provider/provider.js +25 -2
  108. package/optimize/es/components/suggest/suggest.js +4 -1
  109. package/optimize/es/components/tool_tip/tool_tip.js +42 -66
  110. package/optimize/es/components/tool_tip/tool_tip.styles.js +107 -0
  111. package/optimize/es/components/tool_tip/tool_tip_anchor.js +60 -0
  112. package/optimize/es/components/tool_tip/tool_tip_arrow.js +20 -0
  113. package/optimize/es/components/tool_tip/tool_tip_popover.js +46 -87
  114. package/optimize/es/global_styling/index.js +2 -1
  115. package/optimize/es/global_styling/utility/animations.js +13 -0
  116. package/optimize/lib/components/image/image_fullscreen_wrapper.js +2 -3
  117. package/optimize/lib/components/notification/notification_event.js +11 -11
  118. package/optimize/lib/components/overlay_mask/overlay_mask.js +27 -59
  119. package/optimize/lib/components/overlay_mask/overlay_mask.styles.js +34 -0
  120. package/optimize/lib/components/page/page_content/page_content.js +1 -2
  121. package/optimize/lib/components/page/page_content/page_content_body.js +1 -2
  122. package/optimize/lib/components/page/page_content/page_content_header.js +1 -2
  123. package/optimize/lib/components/page/page_content/page_content_header_section.js +1 -2
  124. package/optimize/lib/components/page/page_section/page_section.js +4 -2
  125. package/optimize/lib/components/page/page_side_bar/page_side_bar.js +1 -2
  126. package/optimize/lib/components/page/page_template.js +3 -1
  127. package/optimize/lib/components/pagination/pagination.js +18 -3
  128. package/optimize/lib/components/pagination/pagination.styles.js +34 -0
  129. package/optimize/lib/components/pagination/pagination_button.js +9 -4
  130. package/optimize/lib/components/pagination/pagination_button.styles.js +45 -0
  131. package/optimize/lib/components/pagination/pagination_button_arrow.js +7 -0
  132. package/optimize/lib/components/provider/cache/cache_provider.js +3 -11
  133. package/optimize/lib/components/provider/provider.js +31 -6
  134. package/optimize/lib/components/suggest/suggest.js +4 -1
  135. package/optimize/lib/components/tool_tip/tool_tip.js +42 -64
  136. package/optimize/lib/components/tool_tip/tool_tip.styles.js +125 -0
  137. package/optimize/lib/components/tool_tip/tool_tip_anchor.js +75 -0
  138. package/optimize/lib/components/tool_tip/tool_tip_arrow.js +35 -0
  139. package/optimize/lib/components/tool_tip/tool_tip_popover.js +47 -88
  140. package/optimize/lib/global_styling/index.js +13 -0
  141. package/optimize/lib/global_styling/utility/animations.js +17 -0
  142. package/package.json +2 -2
  143. package/src/components/index.scss +0 -4
  144. package/src/global_styling/mixins/_tool_tip.scss +3 -6
  145. package/src/themes/amsterdam/overrides/_index.scss +0 -2
  146. package/test-env/components/button/button_display/_button_display.js +10 -1
  147. package/test-env/components/button/button_empty/button_empty.js +10 -1
  148. package/test-env/components/collapsible_nav/collapsible_nav.js +0 -5
  149. package/test-env/components/date_picker/auto_refresh/auto_refresh.js +6 -1
  150. package/test-env/components/date_picker/super_date_picker/date_popover/date_popover_button.js +6 -1
  151. package/test-env/components/expression/expression.js +12 -2
  152. package/test-env/components/header/header_links/header_link.js +10 -1
  153. package/test-env/components/image/image.js +6 -1
  154. package/test-env/components/image/image_fullscreen_wrapper.js +2 -3
  155. package/test-env/components/notification/notification_event.js +24 -15
  156. package/test-env/components/overlay_mask/overlay_mask.js +27 -64
  157. package/test-env/components/overlay_mask/overlay_mask.styles.js +34 -0
  158. package/test-env/components/page/page_content/page_content.js +1 -2
  159. package/test-env/components/page/page_content/page_content_body.js +1 -2
  160. package/test-env/components/page/page_content/page_content_header.js +1 -2
  161. package/test-env/components/page/page_content/page_content_header_section.js +1 -2
  162. package/test-env/components/page/page_section/page_section.js +15 -3
  163. package/test-env/components/page/page_side_bar/page_side_bar.js +1 -2
  164. package/test-env/components/page/page_template.js +3 -1
  165. package/test-env/components/page_template/empty_prompt/page_empty_prompt.js +11 -1
  166. package/test-env/components/page_template/page_template.js +18 -2
  167. package/test-env/components/pagination/pagination.js +18 -3
  168. package/test-env/components/pagination/pagination.styles.js +34 -0
  169. package/test-env/components/pagination/pagination_button.js +9 -4
  170. package/test-env/components/pagination/pagination_button.styles.js +45 -0
  171. package/test-env/components/pagination/pagination_button_arrow.js +7 -0
  172. package/test-env/components/progress/progress.js +6 -1
  173. package/test-env/components/provider/cache/cache_provider.js +3 -11
  174. package/test-env/components/provider/provider.js +31 -6
  175. package/test-env/components/resizable_container/resizable_panel.js +6 -1
  176. package/test-env/components/side_nav/side_nav.js +5 -0
  177. package/test-env/components/suggest/suggest.js +10 -1
  178. package/test-env/components/tool_tip/tool_tip.js +42 -64
  179. package/test-env/components/tool_tip/tool_tip.styles.js +125 -0
  180. package/test-env/components/tool_tip/tool_tip_anchor.js +84 -0
  181. package/test-env/components/tool_tip/tool_tip_arrow.js +35 -0
  182. package/test-env/components/tool_tip/tool_tip_popover.js +49 -89
  183. package/test-env/global_styling/index.js +13 -0
  184. package/test-env/global_styling/utility/animations.js +17 -0
  185. package/src/components/call_out/_index.scss +0 -3
  186. package/src/components/call_out/_mixins.scss +0 -23
  187. package/src/components/call_out/_variables.scss +0 -7
  188. package/src/components/overlay_mask/_index.scss +0 -1
  189. package/src/components/overlay_mask/_overlay_mask.scss +0 -33
  190. package/src/components/pagination/_index.scss +0 -2
  191. package/src/components/pagination/_pagination.scss +0 -30
  192. package/src/components/pagination/_pagination_button.scss +0 -37
  193. package/src/components/tool_tip/_index.scss +0 -1
  194. package/src/components/tool_tip/_tool_tip.scss +0 -121
  195. package/src/themes/amsterdam/overrides/_overlay_mask.scss +0 -3
  196. package/src/themes/amsterdam/overrides/_tooltip.scss +0 -7
@@ -0,0 +1,30 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
5
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
6
+ * Side Public License, v 1.
7
+ */
8
+ import { css } from '@emotion/react';
9
+ import { logicalCSS, logicalTextAlignCSS, euiFontSize } from '../../global_styling';
10
+ import { euiButtonEmptyColor } from '../../themes/amsterdam/global_styling/mixins';
11
+ export var euiPaginationButtonStyles = function euiPaginationButtonStyles(euiThemeContext) {
12
+ var euiTheme = euiThemeContext.euiTheme;
13
+ var fontSizeS = euiFontSize(euiThemeContext, 's');
14
+ var halfSizeM = parseInt(euiTheme.size.m.replace('px', '')) / 2;
15
+ var disabled = euiButtonEmptyColor(euiThemeContext, 'disabled'); // && to increase specificity. Can likely be removed once EuiButtonEmpty has been converted.
16
+
17
+ return {
18
+ // Base
19
+ euiPaginationButton: /*#__PURE__*/css("&&{", fontSizeS, ";padding:0;", logicalTextAlignCSS('center'), " border-radius:", euiTheme.border.radius.medium, ";outline-offset:-", euiTheme.focus.width, ";};label:euiPaginationButton;"),
20
+ // States
21
+ isActive: /*#__PURE__*/css("&&{font-weight:", euiTheme.font.weight.bold, ";color:", euiTheme.colors.primary, ";.euiButtonEmpty__content{cursor:default;}&&,&&:hover{text-decoration:underline;}};label:isActive;"),
22
+ isPlaceholder: /*#__PURE__*/css("&&{align-items:baseline;color:", disabled.color, ";", fontSizeS, ";", logicalCSS('padding-top', "".concat(halfSizeM, "px")), ";", logicalCSS('padding-bottom', 0), ";", logicalCSS('padding-horizontal', euiTheme.size.s), ";", logicalCSS('height', euiTheme.size.l), ";};label:isPlaceholder;")
23
+ };
24
+ };
25
+ export var euiPaginationButtonArrowStyles = function euiPaginationButtonArrowStyles(_ref) {
26
+ var euiTheme = _ref.euiTheme;
27
+ return {
28
+ euiPaginationArrowButton: /*#__PURE__*/css("outline-offset:-", euiTheme.focus.width, ";;label:euiPaginationArrowButton;")
29
+ };
30
+ };
@@ -12,6 +12,8 @@ import classNames from 'classnames';
12
12
  import { EuiButtonIcon } from '../button/button_icon';
13
13
  import { keysOf } from '../common';
14
14
  import { useEuiI18n } from '../i18n';
15
+ import { useEuiTheme } from '../../services';
16
+ import { euiPaginationButtonArrowStyles } from './pagination_button.styles';
15
17
  import { jsx as ___EmotionJSX } from "@emotion/react";
16
18
  var typeToIconTypeMap = {
17
19
  first: 'arrowStart',
@@ -26,6 +28,8 @@ export var EuiPaginationButtonArrow = function EuiPaginationButtonArrow(_ref) {
26
28
  disabled = _ref.disabled,
27
29
  ariaControls = _ref.ariaControls,
28
30
  onClick = _ref.onClick;
31
+ var euiTheme = useEuiTheme();
32
+ var styles = euiPaginationButtonArrowStyles(euiTheme);
29
33
  var labels = {
30
34
  first: useEuiI18n('euiPaginationButtonArrow.firstPage', 'First page'),
31
35
  previous: useEuiI18n('euiPaginationButtonArrow.previousPage', 'Previous page'),
@@ -40,6 +44,7 @@ export var EuiPaginationButtonArrow = function EuiPaginationButtonArrow(_ref) {
40
44
  }
41
45
 
42
46
  return ___EmotionJSX(EuiButtonIcon, _extends({
47
+ css: styles.euiPaginationArrowButton,
43
48
  className: classNames('euiPaginationArrowButton', className),
44
49
  color: "text",
45
50
  "aria-label": labels[type],
@@ -6,18 +6,12 @@
6
6
  * Side Public License, v 1.
7
7
  */
8
8
  import React from 'react';
9
- import createCache from '@emotion/cache';
10
9
  import { CacheProvider } from '@emotion/react';
11
10
  import { jsx as ___EmotionJSX } from "@emotion/react";
12
- var defaultCache = createCache({
13
- key: 'css'
14
- });
15
- defaultCache.compat = true;
16
11
  export var EuiCacheProvider = function EuiCacheProvider(_ref) {
17
- var _ref$cache = _ref.cache,
18
- cache = _ref$cache === void 0 ? defaultCache : _ref$cache,
12
+ var cache = _ref.cache,
19
13
  children = _ref.children;
20
- return ___EmotionJSX(CacheProvider, {
14
+ return children && cache ? ___EmotionJSX(CacheProvider, {
21
15
  value: cache
22
- }, children);
16
+ }, children) : ___EmotionJSX(React.Fragment, null, children);
23
17
  };
@@ -6,6 +6,7 @@
6
6
  * Side Public License, v 1.
7
7
  */
8
8
  import React from 'react';
9
+ import createCache from '@emotion/cache';
9
10
  import { EuiGlobalStyles } from '../../global_styling/reset/global_styles';
10
11
  import { EuiUtilityClasses } from '../../global_styling/utility/utility';
11
12
  import { EuiThemeProvider, CurrentEuiBreakpointProvider } from '../../services';
@@ -17,8 +18,15 @@ var isEmotionCacheObject = function isEmotionCacheObject(obj) {
17
18
  return obj.hasOwnProperty('key');
18
19
  };
19
20
 
21
+ var fallbackCache = createCache({
22
+ key: 'css'
23
+ });
24
+ fallbackCache.compat = true;
20
25
  export var EuiProvider = function EuiProvider(_ref) {
21
- var cache = _ref.cache,
26
+ var _defaultCache;
27
+
28
+ var _ref$cache = _ref.cache,
29
+ cache = _ref$cache === void 0 ? fallbackCache : _ref$cache,
22
30
  _ref$theme = _ref.theme,
23
31
  theme = _ref$theme === void 0 ? EuiThemeAmsterdam : _ref$theme,
24
32
  _ref$globalStyles = _ref.globalStyles,
@@ -34,16 +42,31 @@ export var EuiProvider = function EuiProvider(_ref) {
34
42
 
35
43
  if (cache) {
36
44
  if (isEmotionCacheObject(cache)) {
45
+ cache.compat = true;
37
46
  defaultCache = cache;
38
47
  } else {
48
+ if (cache.default) {
49
+ cache.default.compat = true;
50
+ }
51
+
39
52
  defaultCache = cache.default;
53
+
54
+ if (cache.global) {
55
+ cache.global.compat = true;
56
+ }
57
+
40
58
  globalCache = cache.global;
59
+
60
+ if (cache.utility) {
61
+ cache.utility.compat = true;
62
+ }
63
+
41
64
  utilityCache = cache.utility;
42
65
  }
43
66
  }
44
67
 
45
68
  return ___EmotionJSX(EuiCacheProvider, {
46
- cache: defaultCache
69
+ cache: (_defaultCache = defaultCache) !== null && _defaultCache !== void 0 ? _defaultCache : fallbackCache
47
70
  }, ___EmotionJSX(EuiThemeProvider, {
48
71
  theme: theme !== null && theme !== void 0 ? theme : undefined,
49
72
  colorMode: colorMode,
@@ -1,7 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["onItemClick", "onBlur", "onFocus", "onInput", "onSearch", "status", "append", "tooltipContent", "suggestions", "id", "aria-label", "aria-labelledby", "isVirtualized", "fullWidth", "maxHeight"];
4
+ var _excluded = ["onItemClick", "onBlur", "onFocus", "onInput", "onSearch", "status", "append", "tooltipContent", "suggestions", "id", "aria-label", "aria-labelledby", "isPreFiltered", "isVirtualized", "fullWidth", "maxHeight"];
5
5
 
6
6
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
7
7
 
@@ -56,6 +56,8 @@ export var EuiSuggest = function EuiSuggest(_ref) {
56
56
  id = _ref.id,
57
57
  ariaLabel = _ref['aria-label'],
58
58
  labelId = _ref['aria-labelledby'],
59
+ _ref$isPreFiltered = _ref.isPreFiltered,
60
+ isPreFiltered = _ref$isPreFiltered === void 0 ? false : _ref$isPreFiltered,
59
61
  _ref$isVirtualized = _ref.isVirtualized,
60
62
  isVirtualized = _ref$isVirtualized === void 0 ? false : _ref$isVirtualized,
61
63
  _ref$fullWidth = _ref.fullWidth,
@@ -222,6 +224,7 @@ export var EuiSuggest = function EuiSuggest(_ref) {
222
224
  isVirtualized: isVirtualized
223
225
  },
224
226
  searchable: true,
227
+ isPreFiltered: isPreFiltered,
225
228
  searchProps: _objectSpread({
226
229
  id: id,
227
230
  append: appendArray.length ? appendArray : undefined,
@@ -9,10 +9,6 @@ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
9
9
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
10
10
  var _excluded = ["children", "className", "anchorClassName", "anchorProps", "content", "title", "delay", "display"];
11
11
 
12
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
13
-
14
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
15
-
16
12
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
17
13
 
18
14
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
@@ -24,10 +20,12 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
24
20
  * in compliance with, at your election, the Elastic License 2.0 or the Server
25
21
  * Side Public License, v 1.
26
22
  */
27
- import React, { Component, cloneElement, Fragment } from 'react';
23
+ import React, { Component } from 'react';
28
24
  import classNames from 'classnames';
29
25
  import { keysOf } from '../common';
30
26
  import { EuiPortal } from '../portal';
27
+ import { EuiToolTipAnchor } from './tool_tip_anchor';
28
+ import { EuiToolTipArrow } from './tool_tip_arrow';
31
29
  import { EuiToolTipPopover } from './tool_tip_popover';
32
30
  import { enqueueStateChange } from '../../services/react';
33
31
  import { findPopoverPosition, htmlIdGenerator } from '../../services';
@@ -114,16 +112,12 @@ export var EuiToolTip = /*#__PURE__*/function (_Component) {
114
112
  }
115
113
  });
116
114
 
115
+ _defineProperty(_assertThisInitialized(_this), "setAnchorRef", function (ref) {
116
+ return _this.anchor = ref;
117
+ });
118
+
117
119
  _defineProperty(_assertThisInitialized(_this), "setPopoverRef", function (ref) {
118
- _this.popover = ref; // if the popover has been unmounted, clear
119
- // any previous knowledge about its size
120
-
121
- if (ref == null) {
122
- _this.setState({
123
- toolTipStyles: DEFAULT_TOOLTIP_STYLES,
124
- arrowStyles: undefined
125
- });
126
- }
120
+ return _this.popover = ref;
127
121
  });
128
122
 
129
123
  _defineProperty(_assertThisInitialized(_this), "showToolTip", function () {
@@ -189,7 +183,9 @@ export var EuiToolTip = /*#__PURE__*/function (_Component) {
189
183
  enqueueStateChange(function () {
190
184
  if (_this._isMounted) {
191
185
  _this.setState({
192
- visible: false
186
+ visible: false,
187
+ toolTipStyles: DEFAULT_TOOLTIP_STYLES,
188
+ arrowStyles: undefined
193
189
  });
194
190
  }
195
191
  });
@@ -249,8 +245,6 @@ export var EuiToolTip = /*#__PURE__*/function (_Component) {
249
245
  }, {
250
246
  key: "render",
251
247
  value: function render() {
252
- var _this2 = this;
253
-
254
248
  var _this$props = this.props,
255
249
  children = _this$props.children,
256
250
  className = _this$props.className,
@@ -266,57 +260,39 @@ export var EuiToolTip = /*#__PURE__*/function (_Component) {
266
260
  arrowStyles = _this$state.arrowStyles,
267
261
  id = _this$state.id,
268
262
  toolTipStyles = _this$state.toolTipStyles,
269
- visible = _this$state.visible;
263
+ visible = _this$state.visible,
264
+ calculatedPosition = _this$state.calculatedPosition;
270
265
  var classes = classNames('euiToolTip', positionsToClassNameMap[this.state.calculatedPosition], className);
271
- var anchorClasses = classNames('euiToolTipAnchor', display ? displayToClassNameMap[display] : null, anchorClassName, anchorProps === null || anchorProps === void 0 ? void 0 : anchorProps.className);
272
- var tooltip;
273
-
274
- if (visible && (content || title)) {
275
- tooltip = ___EmotionJSX(EuiPortal, null, ___EmotionJSX(EuiToolTipPopover, _extends({
276
- className: classes,
277
- style: toolTipStyles,
278
- positionToolTip: this.positionToolTip,
279
- popoverRef: this.setPopoverRef,
280
- title: title,
281
- id: id,
282
- role: "tooltip"
283
- }, rest), ___EmotionJSX("div", {
284
- style: arrowStyles,
285
- className: "euiToolTip__arrow"
286
- }), ___EmotionJSX(EuiResizeObserver, {
287
- onResize: this.positionToolTip
288
- }, function (resizeRef) {
289
- return ___EmotionJSX("div", {
290
- ref: resizeRef
291
- }, content);
292
- })));
293
- }
294
-
295
- var anchor = // eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
296
- ___EmotionJSX("span", _extends({
297
- ref: function ref(anchor) {
298
- return _this2.anchor = anchor;
299
- }
300
- }, anchorProps, {
301
- className: anchorClasses,
266
+ var anchorClasses = classNames(anchorClassName, anchorProps === null || anchorProps === void 0 ? void 0 : anchorProps.className);
267
+ return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiToolTipAnchor, _extends({}, anchorProps, {
268
+ ref: this.setAnchorRef,
269
+ onBlur: this.onBlur,
270
+ onFocus: this.onFocus,
302
271
  onMouseOver: this.showToolTip,
303
- onMouseOut: this.onMouseOut
304
- }), /*#__PURE__*/cloneElement(children, _objectSpread({
305
- onFocus: function onFocus(e) {
306
- _this2.onFocus();
307
-
308
- children.props.onFocus && children.props.onFocus(e);
309
- },
310
- onBlur: function onBlur(e) {
311
- _this2.onBlur();
312
-
313
- children.props.onBlur && children.props.onBlur(e);
314
- }
315
- }, visible && {
316
- 'aria-describedby': this.state.id
317
- })));
318
-
319
- return ___EmotionJSX(Fragment, null, anchor, tooltip);
272
+ onMouseOut: this.onMouseOut,
273
+ id: this.state.id,
274
+ className: anchorClasses,
275
+ display: display,
276
+ isVisible: visible
277
+ }), children), visible && (content || title) && ___EmotionJSX(EuiPortal, null, ___EmotionJSX(EuiToolTipPopover, _extends({
278
+ className: classes,
279
+ style: toolTipStyles,
280
+ positionToolTip: this.positionToolTip,
281
+ popoverRef: this.setPopoverRef,
282
+ title: title,
283
+ id: id,
284
+ role: "tooltip",
285
+ calculatedPosition: calculatedPosition
286
+ }, rest), ___EmotionJSX(EuiToolTipArrow, {
287
+ style: arrowStyles,
288
+ className: "euiToolTip__arrow"
289
+ }), ___EmotionJSX(EuiResizeObserver, {
290
+ onResize: this.positionToolTip
291
+ }, function (resizeRef) {
292
+ return ___EmotionJSX("div", {
293
+ ref: resizeRef
294
+ }, content);
295
+ }))));
320
296
  }
321
297
  }]);
322
298
 
@@ -0,0 +1,107 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+
3
+ var _templateObject, _templateObject2;
4
+
5
+ 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)."; }
6
+
7
+ /*
8
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
9
+ * or more contributor license agreements. Licensed under the Elastic License
10
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
11
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
12
+ * Side Public License, v 1.
13
+ */
14
+ import { css, keyframes } from '@emotion/react';
15
+ import { logicalCSS, logicalSizeCSS, euiFontSize } from '../../global_styling';
16
+ import { COLOR_MODES_STANDARD, tint, shade } from '../../services';
17
+ import { euiShadow } from '../../themes/amsterdam';
18
+ export var euiToolTipBackgroundColor = function euiToolTipBackgroundColor(euiTheme, colorMode) {
19
+ return colorMode === COLOR_MODES_STANDARD.dark ? shade(euiTheme.colors.emptyShade, 1) : tint(euiTheme.colors.fullShade, 0.25);
20
+ };
21
+ export var euiToolTipBorderColor = function euiToolTipBorderColor(euiTheme, colorMode) {
22
+ return colorMode === COLOR_MODES_STANDARD.dark ? shade(euiTheme.colors.fullShade, 0.8) : tint(euiTheme.colors.fullShade, 0.35);
23
+ };
24
+
25
+ var euiToolTipAnimationVertical = function euiToolTipAnimationVertical(size) {
26
+ return keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 0% {\n opacity: 0;\n transform: translateY(", ");\n }\n\n 100% {\n opacity: 1;\n transform: translateY(0);\n }\n"])), size);
27
+ };
28
+
29
+ var euiToolTipAnimationHorizontal = function euiToolTipAnimationHorizontal(size) {
30
+ return keyframes(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n 0% {\n opacity: 0;\n transform: translateX(", ");\n }\n\n 100% {\n opacity: 1;\n transform: translateX(0);\n }\n"])), size);
31
+ };
32
+
33
+ export var euiToolTipStyles = function euiToolTipStyles(euiThemeContext) {
34
+ var euiTheme = euiThemeContext.euiTheme,
35
+ colorMode = euiThemeContext.colorMode;
36
+ var animationTiming = "".concat(euiTheme.animation.slow, " ease-out 0s forwards");
37
+ /*
38
+ * 1. Shift arrow 1px more than half its size to account for border radius
39
+ */
40
+
41
+ var arrowSize = euiTheme.size.m;
42
+ var arrowSizeInt = parseInt(arrowSize, 10);
43
+ var arrowPlusSize = "".concat((arrowSizeInt / 2 + 1) * -1, "px");
44
+ /* 1 */
45
+
46
+ var arrowMinusSize = "".concat((arrowSizeInt / 2 - 1) * -1, "px");
47
+ /* 1 */
48
+
49
+ return {
50
+ // Base
51
+ euiToolTip: /*#__PURE__*/css(euiShadow(euiThemeContext), ";border-radius:", euiTheme.border.radius.medium, ";background-color:", euiToolTipBackgroundColor(euiTheme, colorMode), ";color:", euiTheme.colors.ghost, ";z-index:", euiTheme.levels.toast, ";", logicalCSS('max-width', '256px'), " overflow-wrap:break-word;padding:", euiTheme.size.s, ";", euiFontSize(euiThemeContext, 's'), ";position:absolute;[class*='euiHorizontalRule']{background-color:", euiToolTipBorderColor(euiTheme, colorMode), ";};label:euiToolTip;"),
52
+ // Sizes
53
+ s: /*#__PURE__*/css(euiFontSize(euiThemeContext, 'xs'), ";;label:s;"),
54
+ // Positions
55
+ top: /*#__PURE__*/css("animation:", euiToolTipAnimationVertical("-".concat(euiTheme.size.base)), " ", animationTiming, ";;label:top;"),
56
+ bottom: /*#__PURE__*/css("animation:", euiToolTipAnimationVertical(euiTheme.size.base), " ", animationTiming, ";[class*='euiToolTip__arrow']{transform:translateY(", arrowMinusSize, ") rotateZ(45deg);};label:bottom;"),
57
+ left: /*#__PURE__*/css("animation:", euiToolTipAnimationHorizontal("-".concat(euiTheme.size.base)), " ", animationTiming, ";[class*='euiToolTip__arrow']{transform:translateX(", arrowPlusSize, ") rotateZ(45deg);};label:left;"),
58
+ right: /*#__PURE__*/css("animation:", euiToolTipAnimationHorizontal(euiTheme.size.base), " ", animationTiming, ";[class*='euiToolTip__arrow']{transform:translateX(", arrowMinusSize, ") rotateZ(45deg);};label:right;"),
59
+ // Elements
60
+ euiToolTip__arrow: /*#__PURE__*/css("content:'';position:absolute;transform-origin:center;border-radius:2px;background-color:", euiToolTipBackgroundColor(euiTheme, colorMode), ";", logicalSizeCSS(arrowSize, arrowSize), ";transform:translateY(", arrowPlusSize, ") rotateZ(45deg);;label:euiToolTip__arrow;")
61
+ };
62
+ };
63
+ export var euiToolTipPopoverStyles = function euiToolTipPopoverStyles(_ref4) {
64
+ var euiTheme = _ref4.euiTheme,
65
+ colorMode = _ref4.colorMode;
66
+ return {
67
+ // Elements
68
+ euiToolTip__title: /*#__PURE__*/css("font-weight:", euiTheme.font.weight.bold, ";", logicalCSS('border-bottom', "solid ".concat(euiTheme.border.width.thin, " ").concat(euiToolTipBorderColor(euiTheme, colorMode))), ";", logicalCSS('padding-bottom', euiTheme.size.xs), ";", logicalCSS('margin-bottom', euiTheme.size.xs), ";;label:euiToolTip__title;")
69
+ };
70
+ };
71
+
72
+ var _ref = process.env.NODE_ENV === "production" ? {
73
+ name: "fzilnk-inlineBlock",
74
+ styles: "display:inline-block;label:inlineBlock;"
75
+ } : {
76
+ name: "fzilnk-inlineBlock",
77
+ styles: "display:inline-block;label:inlineBlock;",
78
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
79
+ };
80
+
81
+ var _ref2 = process.env.NODE_ENV === "production" ? {
82
+ name: "14aceuy-block",
83
+ styles: "display:block;label:block;"
84
+ } : {
85
+ name: "14aceuy-block",
86
+ styles: "display:block;label:block;",
87
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
88
+ };
89
+
90
+ var _ref3 = process.env.NODE_ENV === "production" ? {
91
+ name: "1s3i3p5-euiToolTipAnchor",
92
+ styles: "*[disabled]{pointer-events:none;};label:euiToolTipAnchor;"
93
+ } : {
94
+ name: "1s3i3p5-euiToolTipAnchor",
95
+ styles: "*[disabled]{pointer-events:none;};label:euiToolTipAnchor;",
96
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
97
+ };
98
+
99
+ export var euiToolTipAnchorStyles = function euiToolTipAnchorStyles() {
100
+ return {
101
+ // Elements
102
+ euiToolTipAnchor: _ref3,
103
+ // Variants
104
+ block: _ref2,
105
+ inlineBlock: _ref
106
+ };
107
+ };
@@ -0,0 +1,60 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
+ var _excluded = ["onBlur", "onFocus", "onMouseOver", "onMouseOut", "id", "className", "children", "display", "isVisible"];
5
+
6
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
7
+
8
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
9
+
10
+ /*
11
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
12
+ * or more contributor license agreements. Licensed under the Elastic License
13
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
14
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
15
+ * Side Public License, v 1.
16
+ */
17
+ import React, { cloneElement, forwardRef } from 'react';
18
+ import classNames from 'classnames';
19
+ import { euiToolTipAnchorStyles } from './tool_tip.styles';
20
+ import { jsx as ___EmotionJSX } from "@emotion/react";
21
+ export var EuiToolTipAnchor = /*#__PURE__*/forwardRef(function (_ref, ref) {
22
+ var _onBlur = _ref.onBlur,
23
+ _onFocus = _ref.onFocus,
24
+ onMouseOver = _ref.onMouseOver,
25
+ onMouseOut = _ref.onMouseOut,
26
+ id = _ref.id,
27
+ className = _ref.className,
28
+ children = _ref.children,
29
+ display = _ref.display,
30
+ isVisible = _ref.isVisible,
31
+ rest = _objectWithoutProperties(_ref, _excluded);
32
+
33
+ var anchorCss = euiToolTipAnchorStyles();
34
+ var cssStyles = [anchorCss.euiToolTipAnchor, anchorCss[display]];
35
+ var classes = classNames('euiToolTipAnchor', className);
36
+ return (// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
37
+ ___EmotionJSX("span", _extends({
38
+ ref: ref
39
+ }, rest, {
40
+ css: cssStyles,
41
+ className: classes,
42
+ onMouseOver: onMouseOver,
43
+ onMouseOut: onMouseOut
44
+ }), /*#__PURE__*/cloneElement(children, _objectSpread({
45
+ onFocus: function onFocus(e) {
46
+ _onFocus();
47
+
48
+ children.props.onFocus && children.props.onFocus(e);
49
+ },
50
+ onBlur: function onBlur(e) {
51
+ _onBlur();
52
+
53
+ children.props.onBlur && children.props.onBlur(e);
54
+ }
55
+ }, isVisible && {
56
+ 'aria-describedby': id
57
+ })))
58
+ );
59
+ });
60
+ EuiToolTipAnchor.displayName = 'EuiToolTipAnchor';
@@ -0,0 +1,20 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+
3
+ /*
4
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
5
+ * or more contributor license agreements. Licensed under the Elastic License
6
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
7
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
8
+ * Side Public License, v 1.
9
+ */
10
+ import React from 'react';
11
+ import { useEuiTheme } from '../../services';
12
+ import { euiToolTipStyles } from './tool_tip.styles';
13
+ import { jsx as ___EmotionJSX } from "@emotion/react";
14
+ export var EuiToolTipArrow = function EuiToolTipArrow(props) {
15
+ var euiTheme = useEuiTheme();
16
+ var toolTipCss = euiToolTipStyles(euiTheme);
17
+ return ___EmotionJSX("div", _extends({
18
+ css: [toolTipCss.euiToolTip__arrow, ";label:EuiToolTipArrow;"]
19
+ }, props));
20
+ };