@elastic/eui 72.1.0 → 72.2.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 (56) hide show
  1. package/dist/eui_theme_dark.css +0 -3
  2. package/dist/eui_theme_dark.min.css +1 -1
  3. package/dist/eui_theme_light.css +0 -3
  4. package/dist/eui_theme_light.min.css +1 -1
  5. package/es/components/accordion/accordion.js +1 -1
  6. package/es/components/date_picker/super_date_picker/super_date_picker.js +9 -0
  7. package/es/components/date_picker/super_date_picker/super_update_button.js +8 -0
  8. package/es/components/image/image.js +9 -2
  9. package/es/components/image/image_fullscreen_wrapper.js +3 -1
  10. package/es/components/image/image_wrapper.js +3 -1
  11. package/es/components/markdown_editor/markdown_format.styles.js +2 -5
  12. package/es/components/text/text.styles.js +6 -3
  13. package/es/components/tool_tip/icon_tip.js +8 -0
  14. package/es/components/tool_tip/tool_tip.js +24 -1
  15. package/es/components/tour/tour.styles.js +1 -1
  16. package/eui.d.ts +12 -1
  17. package/lib/components/accordion/accordion.js +1 -1
  18. package/lib/components/date_picker/super_date_picker/super_date_picker.js +9 -0
  19. package/lib/components/date_picker/super_date_picker/super_update_button.js +8 -0
  20. package/lib/components/image/image.js +9 -2
  21. package/lib/components/image/image_fullscreen_wrapper.js +3 -1
  22. package/lib/components/image/image_wrapper.js +3 -1
  23. package/lib/components/markdown_editor/markdown_format.styles.js +1 -4
  24. package/lib/components/text/text.styles.js +5 -2
  25. package/lib/components/tool_tip/icon_tip.js +8 -0
  26. package/lib/components/tool_tip/tool_tip.js +24 -1
  27. package/lib/components/tour/tour.styles.js +1 -1
  28. package/optimize/es/components/accordion/accordion.js +1 -1
  29. package/optimize/es/components/image/image.js +4 -2
  30. package/optimize/es/components/image/image_fullscreen_wrapper.js +3 -1
  31. package/optimize/es/components/image/image_wrapper.js +3 -1
  32. package/optimize/es/components/markdown_editor/markdown_format.styles.js +2 -5
  33. package/optimize/es/components/text/text.styles.js +6 -3
  34. package/optimize/es/components/tool_tip/tool_tip.js +16 -1
  35. package/optimize/es/components/tour/tour.styles.js +1 -1
  36. package/optimize/lib/components/accordion/accordion.js +1 -1
  37. package/optimize/lib/components/image/image.js +4 -2
  38. package/optimize/lib/components/image/image_fullscreen_wrapper.js +3 -1
  39. package/optimize/lib/components/image/image_wrapper.js +3 -1
  40. package/optimize/lib/components/markdown_editor/markdown_format.styles.js +1 -4
  41. package/optimize/lib/components/text/text.styles.js +5 -2
  42. package/optimize/lib/components/tool_tip/tool_tip.js +16 -1
  43. package/optimize/lib/components/tour/tour.styles.js +1 -1
  44. package/package.json +2 -2
  45. package/src/components/markdown_editor/_markdown_format.scss +0 -4
  46. package/test-env/components/accordion/accordion.js +1 -1
  47. package/test-env/components/date_picker/super_date_picker/super_date_picker.js +9 -0
  48. package/test-env/components/date_picker/super_date_picker/super_update_button.js +8 -0
  49. package/test-env/components/image/image.js +9 -2
  50. package/test-env/components/image/image_fullscreen_wrapper.js +3 -1
  51. package/test-env/components/image/image_wrapper.js +3 -1
  52. package/test-env/components/markdown_editor/markdown_format.styles.js +1 -4
  53. package/test-env/components/text/text.styles.js +5 -2
  54. package/test-env/components/tool_tip/icon_tip.js +8 -0
  55. package/test-env/components/tool_tip/tool_tip.js +24 -1
  56. package/test-env/components/tour/tour.styles.js +1 -1
@@ -66,7 +66,10 @@ var euiScaleText = function euiScaleText(euiThemeContext, options) {
66
66
  return x * 2;
67
67
  });
68
68
  var headingMarginBottom = marginSize;
69
- return "\n font-size: ".concat(fontSize, ";\n line-height: ").concat(lineHeight, ";\n\n h1 {\n font-size: ").concat(headings.h1.fontSize, ";\n line-height: ").concat(headings.h1.lineHeight, ";\n }\n h1:not(:last-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-bottom', headingMarginBottom), "\n }\n\n h2 {\n font-size: ").concat(headings.h2.fontSize, ";\n line-height: ").concat(headings.h2.lineHeight, ";\n\n &:not(:first-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-bottom', headingMarginBottom), "\n }\n }\n\n h3 {\n font-size: ").concat(headings.h3.fontSize, ";\n line-height: ").concat(headings.h3.lineHeight, ";\n\n &:not(:first-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-bottom', headingMarginBottom), "\n }\n }\n\n h4 {\n font-size: ").concat(headings.h4.fontSize, ";\n line-height: ").concat(headings.h4.lineHeight, ";\n\n &:not(:first-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-bottom', headingMarginBottom), "\n }\n }\n\n h5 {\n font-size: ").concat(headings.h5.fontSize, ";\n line-height: ").concat(headings.h5.lineHeight, ";\n\n &:not(:first-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-bottom', headingMarginBottom), "\n }\n }\n\n h6 {\n font-size: ").concat(headings.h6.fontSize, ";\n line-height: ").concat(headings.h6.lineHeight, ";\n\n &:not(:first-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-bottom', headingMarginBottom), "\n }\n }\n\n p,\n ul,\n ol,\n dl,\n blockquote,\n img,\n pre {\n ").concat((0, _global_styling.logicalCSS)('margin-bottom', lineHeightSize), "\n }\n\n ul,\n ol {\n ").concat((0, _global_styling.logicalCSS)('margin-left', lineHeightSize), "\n }\n \n blockquote {\n font-size: ").concat(fontSize, ";\n padding: ").concat(lineHeightSize, ";\n }\n\n dd + dt {\n ").concat((0, _global_styling.logicalCSS)('margin-top', fontSize), "\n }\n\n dt,\n .eui-definitionListReverse dd {\n font-size: ").concat(fontSize, ";\n line-height: ").concat(lineHeight, ";\n }\n\n .eui-definitionListReverse dt {\n font-size: ").concat((0, _global_styling.euiFontSize)(euiThemeContext, 'xs', options).fontSize, ";\n color: ").concat(euiTheme.colors.text, ";\n }\n\n small {\n font-size: ").concat((0, _global_styling.euiFontSize)(euiThemeContext, 's', options).fontSize, ";\n }\n\n pre:not(.euiCodeBlock__pre) {\n padding: ").concat(lineHeightSize, ";\n }\n\n code:not(.euiCode):not(.euiCodeBlock__code) {\n font-size: .9em; // 90% of parent font size\n }\n ").concat( // when textSize is 'm', the 'kbd' element gets a line between the text and the border-bottom
69
+ var blockQuoteBorderWidth = (0, _global_styling.mathWithUnits)(fontSize, function (x) {
70
+ return x / 4;
71
+ });
72
+ return "\n font-size: ".concat(fontSize, ";\n line-height: ").concat(lineHeight, ";\n\n h1 {\n font-size: ").concat(headings.h1.fontSize, ";\n line-height: ").concat(headings.h1.lineHeight, ";\n }\n h1:not(:last-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-bottom', headingMarginBottom), "\n }\n\n h2 {\n font-size: ").concat(headings.h2.fontSize, ";\n line-height: ").concat(headings.h2.lineHeight, ";\n\n &:not(:first-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-bottom', headingMarginBottom), "\n }\n }\n\n h3 {\n font-size: ").concat(headings.h3.fontSize, ";\n line-height: ").concat(headings.h3.lineHeight, ";\n\n &:not(:first-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-bottom', headingMarginBottom), "\n }\n }\n\n h4 {\n font-size: ").concat(headings.h4.fontSize, ";\n line-height: ").concat(headings.h4.lineHeight, ";\n\n &:not(:first-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-bottom', headingMarginBottom), "\n }\n }\n\n h5 {\n font-size: ").concat(headings.h5.fontSize, ";\n line-height: ").concat(headings.h5.lineHeight, ";\n\n &:not(:first-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-bottom', headingMarginBottom), "\n }\n }\n\n h6 {\n font-size: ").concat(headings.h6.fontSize, ";\n line-height: ").concat(headings.h6.lineHeight, ";\n\n &:not(:first-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-bottom', headingMarginBottom), "\n }\n }\n\n p,\n ul,\n ol,\n dl,\n blockquote,\n img,\n pre {\n ").concat((0, _global_styling.logicalCSS)('margin-bottom', lineHeightSize), "\n }\n\n ul,\n ol {\n ").concat((0, _global_styling.logicalCSS)('margin-left', lineHeightSize), "\n }\n \n blockquote {\n font-size: ").concat(fontSize, ";\n ").concat((0, _global_styling.logicalShorthandCSS)('padding', "0 ".concat(fontSize)), "\n ").concat((0, _global_styling.logicalCSS)('border-left-width', blockQuoteBorderWidth), "\n ").concat((0, _global_styling.logicalCSS)('margin-bottom', fontSize), "\n }\n\n dd + dt {\n ").concat((0, _global_styling.logicalCSS)('margin-top', fontSize), "\n }\n\n dt,\n .eui-definitionListReverse dd {\n font-size: ").concat(fontSize, ";\n line-height: ").concat(lineHeight, ";\n }\n\n .eui-definitionListReverse dt {\n font-size: ").concat((0, _global_styling.euiFontSize)(euiThemeContext, 'xs', options).fontSize, ";\n color: ").concat(euiTheme.colors.text, ";\n }\n\n small {\n font-size: ").concat((0, _global_styling.euiFontSize)(euiThemeContext, 's', options).fontSize, ";\n }\n\n pre:not(.euiCodeBlock__pre) {\n padding: ").concat(lineHeightSize, ";\n }\n\n code:not(.euiCode):not(.euiCodeBlock__code) {\n font-size: .9em; // 90% of parent font size\n }\n ").concat( // when textSize is 'm', the 'kbd' element gets a line between the text and the border-bottom
70
73
  _customScale === 'm' ? "\n kbd {\n ".concat((0, _global_styling.logicalCSS)('padding-bottom', euiTheme.size.xs), "\n // ensures when only one character the shape looks like a square\n ").concat((0, _global_styling.logicalCSS)('min-width', euiTheme.size.l), "\n ").concat((0, _global_styling.logicalTextAlignCSS)('center'), "\n }\n \n kbd::after {\n content: '';\n ").concat((0, _global_styling.logicalCSS)('border-bottom', "".concat(euiTheme.border.width.thin, " solid ").concat(euiTheme.colors.text)), "\n position: absolute;\n ").concat((0, _global_styling.logicalCSS)('bottom', euiTheme.size.xxs), "\n ").concat((0, _global_styling.logicalCSS)('left', 0), "\n ").concat((0, _global_styling.logicalCSS)('width', '100%'), "\n }") : '', "\n ");
71
74
  };
72
75
  /**
@@ -77,7 +80,7 @@ var euiScaleText = function euiScaleText(euiThemeContext, options) {
77
80
  var euiTextStyles = function euiTextStyles(euiThemeContext) {
78
81
  var euiTheme = euiThemeContext.euiTheme;
79
82
  return {
80
- euiText: /*#__PURE__*/(0, _react.css)(euiText(euiTheme, true), ";clear:both;a:not([class]){", (0, _link.euiLinkCSS)(euiThemeContext), ";}img{display:block;", (0, _global_styling.logicalCSS)('max-width', '100%'), ";}ul{list-style:disc;}ol{list-style:decimal;}blockquote:not(.euiMarkdownFormat__blockquote){position:relative;", (0, _global_styling.logicalTextAlignCSS)('center'), " ", (0, _global_styling.logicalCSS)('margin-horizontal', 'auto'), " font-family:", euiTheme.font.familySerif, ";font-style:italic;letter-spacing:normal;p:last-child{", (0, _global_styling.logicalCSS)('margin-bottom', '0'), ";}&:before,&:after{position:absolute;content:'';", (0, _global_styling.logicalCSS)('height', euiTheme.border.width.thick), " ", (0, _global_styling.logicalCSS)('width', '50%'), " ", (0, _global_styling.logicalCSS)('left', '25%'), " ", (0, _global_styling.logicalCSS)('right', '25%'), " background:", euiTheme.colors.darkShade, ";}&:before{", (0, _global_styling.logicalCSS)('top', '0'), ";}&:after{", (0, _global_styling.logicalCSS)('bottom', '0'), ";}}h1{", (0, _title.euiTitle)(euiThemeContext, 'l'), ";}h2{", (0, _title.euiTitle)(euiThemeContext, 'm'), ";}h3{", (0, _title.euiTitle)(euiThemeContext, 's'), ";}h4,dt{", (0, _title.euiTitle)(euiThemeContext, 'xs'), ";}h5{", (0, _title.euiTitle)(euiThemeContext, 'xxs'), ";}h6{", (0, _title.euiTitle)(euiThemeContext, 'xxxs'), " text-transform:uppercase;}h1,h2,h3,h4,h5,h6,dt{color:inherit;}pre:not(.euiCodeBlock__pre){white-space:pre-wrap;background:", (0, _global_styling.euiBackgroundColor)(euiThemeContext, 'subdued'), ";color:", euiTheme.colors.text, ";}pre:not(.euiCodeBlock__pre),pre:not(.euiCodeBlock__pre) code{display:block;}>:last-child{", (0, _global_styling.logicalCSS)('margin-bottom', '0 !important'), ";}kbd{position:relative;display:inline-block;", (0, _global_styling.logicalCSS)('padding-vertical', euiTheme.size.xxs), " ", (0, _global_styling.logicalCSS)('padding-horizontal', euiTheme.size.xs), " line-height:1;border:", euiTheme.border.width.thin, " solid ", euiTheme.colors.text, ";border-radius:", (0, _global_styling.mathWithUnits)(euiTheme.border.radius.small, function (x) {
83
+ euiText: /*#__PURE__*/(0, _react.css)(euiText(euiTheme, true), ";clear:both;a:not([class]){", (0, _link.euiLinkCSS)(euiThemeContext), ";}img{display:block;", (0, _global_styling.logicalCSS)('max-width', '100%'), ";}ul{list-style:disc;}ol{list-style:decimal;}blockquote{border-inline-start-color:", euiTheme.border.color, ";border-inline-start-style:solid;}blockquote:not(.euiMarkdownFormat__blockquote){color:", euiTheme.colors.subduedText, ";}h1{", (0, _title.euiTitle)(euiThemeContext, 'l'), ";}h2{", (0, _title.euiTitle)(euiThemeContext, 'm'), ";}h3{", (0, _title.euiTitle)(euiThemeContext, 's'), ";}h4,dt{", (0, _title.euiTitle)(euiThemeContext, 'xs'), ";}h5{", (0, _title.euiTitle)(euiThemeContext, 'xxs'), ";}h6{", (0, _title.euiTitle)(euiThemeContext, 'xxxs'), " text-transform:uppercase;}h1,h2,h3,h4,h5,h6,dt{color:inherit;}pre:not(.euiCodeBlock__pre){white-space:pre-wrap;background:", (0, _global_styling.euiBackgroundColor)(euiThemeContext, 'subdued'), ";color:", euiTheme.colors.text, ";}pre:not(.euiCodeBlock__pre),pre:not(.euiCodeBlock__pre) code{display:block;}>:last-child{", (0, _global_styling.logicalCSS)('margin-bottom', '0 !important'), ";}kbd{position:relative;display:inline-block;", (0, _global_styling.logicalCSS)('padding-vertical', euiTheme.size.xxs), " ", (0, _global_styling.logicalCSS)('padding-horizontal', euiTheme.size.xs), " line-height:1;border:", euiTheme.border.width.thin, " solid ", euiTheme.colors.text, ";border-radius:", (0, _global_styling.mathWithUnits)(euiTheme.border.radius.small, function (x) {
81
84
  return x / 2;
82
85
  }), ";};label:euiText;"),
83
86
  constrainedWidth: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('max-width', euiTextConstrainedMaxWidth), ";;label:constrainedWidth;"),
@@ -90,6 +90,14 @@ EuiIconTip.propTypes = {
90
90
  */
91
91
  id: _propTypes.default.string,
92
92
 
93
+ /**
94
+ * When `true`, the tooltip's position is re-calculated when the user
95
+ * scrolls. This supports having fixed-position tooltip anchors.
96
+ *
97
+ * When nesting an `EuiTooltip` in a scrollable container, `repositionOnScroll` should be `true`
98
+ */
99
+ repositionOnScroll: _propTypes.default.bool,
100
+
93
101
  /**
94
102
  * If supplied, called when mouse movement causes the tool tip to be
95
103
  * hidden.
@@ -51,7 +51,7 @@ var _resize_observer = require("../observer/resize_observer");
51
51
 
52
52
  var _react3 = require("@emotion/react");
53
53
 
54
- var _excluded = ["children", "className", "anchorClassName", "anchorProps", "content", "title", "delay", "display"];
54
+ var _excluded = ["children", "className", "anchorClassName", "anchorProps", "content", "title", "delay", "display", "repositionOnScroll"];
55
55
 
56
56
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
57
57
 
@@ -244,18 +244,32 @@ var EuiToolTip = /*#__PURE__*/function (_Component) {
244
244
  key: "componentDidMount",
245
245
  value: function componentDidMount() {
246
246
  this._isMounted = true;
247
+
248
+ if (this.props.repositionOnScroll) {
249
+ window.addEventListener('scroll', this.positionToolTip, true);
250
+ }
247
251
  }
248
252
  }, {
249
253
  key: "componentWillUnmount",
250
254
  value: function componentWillUnmount() {
251
255
  this.clearAnimationTimeout();
252
256
  this._isMounted = false;
257
+ window.removeEventListener('scroll', this.positionToolTip, true);
253
258
  }
254
259
  }, {
255
260
  key: "componentDidUpdate",
256
261
  value: function componentDidUpdate(prevProps, prevState) {
257
262
  if (prevState.visible === false && this.state.visible === true) {
258
263
  requestAnimationFrame(this.testAnchor);
264
+ } // update scroll listener
265
+
266
+
267
+ if (prevProps.repositionOnScroll !== this.props.repositionOnScroll) {
268
+ if (this.props.repositionOnScroll) {
269
+ window.addEventListener('scroll', this.positionToolTip, true);
270
+ } else {
271
+ window.removeEventListener('scroll', this.positionToolTip, true);
272
+ }
259
273
  }
260
274
  }
261
275
  }, {
@@ -270,6 +284,7 @@ var EuiToolTip = /*#__PURE__*/function (_Component) {
270
284
  title = _this$props.title,
271
285
  delay = _this$props.delay,
272
286
  display = _this$props.display,
287
+ repositionOnScroll = _this$props.repositionOnScroll,
273
288
  rest = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
274
289
  var _this$state = this.state,
275
290
  arrowStyles = _this$state.arrowStyles,
@@ -376,6 +391,14 @@ EuiToolTip.propTypes = {
376
391
  */
377
392
  position: _propTypes.default.oneOf(["top", "right", "bottom", "left"]).isRequired,
378
393
 
394
+ /**
395
+ * When `true`, the tooltip's position is re-calculated when the user
396
+ * scrolls. This supports having fixed-position tooltip anchors.
397
+ *
398
+ * When nesting an `EuiTooltip` in a scrollable container, `repositionOnScroll` should be `true`
399
+ */
400
+ repositionOnScroll: _propTypes.default.bool,
401
+
379
402
  /**
380
403
  * If supplied, called when mouse movement causes the tool tip to be
381
404
  * hidden.
@@ -67,7 +67,7 @@ var euiTourHeaderStyles = function euiTourHeaderStyles(_ref3) {
67
67
  euiTourHeader: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('border-bottom', 'none'), ";", (0, _global_styling.logicalCSS)('margin-bottom', euiTheme.size.s), ";;label:euiTourHeader;"),
68
68
  // Elements
69
69
  euiTourHeader__title: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('margin-top', 0), ";;label:euiTourHeader__title;"),
70
- euiTourHeader__subtitle: /*#__PURE__*/(0, _react.css)("color:", euiTheme.colors.subduedText, ";;label:euiTourHeader__subtitle;")
70
+ euiTourHeader__subtitle: /*#__PURE__*/(0, _react.css)("color:", euiTheme.colors.subduedText, ";padding-block-end:", euiTheme.size.xs, ";;label:euiTourHeader__subtitle;")
71
71
  };
72
72
  };
73
73