@elastic/eui 72.1.0 → 73.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 (98) hide show
  1. package/CHANGELOG.md +6185 -0
  2. package/dist/eui_theme_dark.css +15 -15
  3. package/dist/eui_theme_dark.min.css +1 -1
  4. package/dist/eui_theme_light.css +15 -15
  5. package/dist/eui_theme_light.min.css +1 -1
  6. package/es/components/accordion/accordion.js +1 -1
  7. package/es/components/datagrid/controls/column_selector.js +23 -7
  8. package/es/components/datagrid/controls/column_sorting_draggable.js +17 -8
  9. package/es/components/datagrid/data_grid.a11y.js +3 -2
  10. package/es/components/date_picker/super_date_picker/super_date_picker.js +9 -0
  11. package/es/components/date_picker/super_date_picker/super_update_button.js +8 -0
  12. package/es/components/image/image.js +9 -2
  13. package/es/components/image/image_fullscreen_wrapper.js +3 -1
  14. package/es/components/image/image_wrapper.js +3 -1
  15. package/es/components/markdown_editor/markdown_format.styles.js +2 -5
  16. package/es/components/notification/notification_event.a11y.js +113 -0
  17. package/es/components/page/page_header/page_header.a11y.js +32 -0
  18. package/es/components/portal/portal.a11y.js +70 -0
  19. package/es/components/text/text.styles.js +6 -3
  20. package/es/components/tool_tip/icon_tip.js +8 -0
  21. package/es/components/tool_tip/tool_tip.js +34 -6
  22. package/es/components/tool_tip/tool_tip_manager.js +42 -0
  23. package/es/components/tour/tour.styles.js +1 -1
  24. package/eui.d.ts +23 -1
  25. package/i18ntokens.json +36 -20
  26. package/lib/components/accordion/accordion.js +1 -1
  27. package/lib/components/datagrid/controls/column_selector.js +21 -6
  28. package/lib/components/datagrid/controls/column_sorting_draggable.js +17 -8
  29. package/lib/components/datagrid/data_grid.a11y.js +3 -2
  30. package/lib/components/date_picker/super_date_picker/super_date_picker.js +9 -0
  31. package/lib/components/date_picker/super_date_picker/super_update_button.js +8 -0
  32. package/lib/components/image/image.js +9 -2
  33. package/lib/components/image/image_fullscreen_wrapper.js +3 -1
  34. package/lib/components/image/image_wrapper.js +3 -1
  35. package/lib/components/markdown_editor/markdown_format.styles.js +1 -4
  36. package/lib/components/notification/notification_event.a11y.js +117 -0
  37. package/lib/components/page/page_header/page_header.a11y.js +40 -0
  38. package/lib/components/portal/portal.a11y.js +73 -0
  39. package/lib/components/text/text.styles.js +5 -2
  40. package/lib/components/tool_tip/icon_tip.js +8 -0
  41. package/lib/components/tool_tip/tool_tip.js +37 -8
  42. package/lib/components/tool_tip/tool_tip_manager.js +50 -0
  43. package/lib/components/tour/tour.styles.js +1 -1
  44. package/optimize/es/components/accordion/accordion.js +1 -1
  45. package/optimize/es/components/datagrid/controls/column_selector.js +22 -7
  46. package/optimize/es/components/datagrid/controls/column_sorting_draggable.js +17 -8
  47. package/optimize/es/components/datagrid/data_grid.a11y.js +3 -2
  48. package/optimize/es/components/image/image.js +4 -2
  49. package/optimize/es/components/image/image_fullscreen_wrapper.js +3 -1
  50. package/optimize/es/components/image/image_wrapper.js +3 -1
  51. package/optimize/es/components/markdown_editor/markdown_format.styles.js +2 -5
  52. package/optimize/es/components/notification/notification_event.a11y.js +103 -0
  53. package/optimize/es/components/page/page_header/page_header.a11y.js +32 -0
  54. package/optimize/es/components/portal/portal.a11y.js +60 -0
  55. package/optimize/es/components/text/text.styles.js +6 -3
  56. package/optimize/es/components/tool_tip/tool_tip.js +26 -6
  57. package/optimize/es/components/tool_tip/tool_tip_manager.js +41 -0
  58. package/optimize/es/components/tour/tour.styles.js +1 -1
  59. package/optimize/lib/components/accordion/accordion.js +1 -1
  60. package/optimize/lib/components/datagrid/controls/column_selector.js +21 -6
  61. package/optimize/lib/components/datagrid/controls/column_sorting_draggable.js +17 -8
  62. package/optimize/lib/components/datagrid/data_grid.a11y.js +3 -2
  63. package/optimize/lib/components/image/image.js +4 -2
  64. package/optimize/lib/components/image/image_fullscreen_wrapper.js +3 -1
  65. package/optimize/lib/components/image/image_wrapper.js +3 -1
  66. package/optimize/lib/components/markdown_editor/markdown_format.styles.js +1 -4
  67. package/optimize/lib/components/notification/notification_event.a11y.js +117 -0
  68. package/optimize/lib/components/page/page_header/page_header.a11y.js +40 -0
  69. package/optimize/lib/components/portal/portal.a11y.js +73 -0
  70. package/optimize/lib/components/text/text.styles.js +5 -2
  71. package/optimize/lib/components/tool_tip/tool_tip.js +29 -8
  72. package/optimize/lib/components/tool_tip/tool_tip_manager.js +49 -0
  73. package/optimize/lib/components/tour/tour.styles.js +1 -1
  74. package/package.json +2 -2
  75. package/src/components/datagrid/controls/_data_grid_column_sorting.scss +14 -13
  76. package/src/components/date_picker/react-datepicker/LICENSE +21 -0
  77. package/src/components/date_picker/react-datepicker/README.md +168 -0
  78. package/src/components/markdown_editor/_markdown_format.scss +0 -4
  79. package/src/services/theme/README.md +153 -0
  80. package/src/test/README.md +59 -0
  81. package/test-env/components/accordion/accordion.js +1 -1
  82. package/test-env/components/datagrid/controls/column_selector.js +21 -6
  83. package/test-env/components/datagrid/controls/column_sorting_draggable.js +17 -8
  84. package/test-env/components/datagrid/data_grid.a11y.js +3 -2
  85. package/test-env/components/date_picker/super_date_picker/super_date_picker.js +9 -0
  86. package/test-env/components/date_picker/super_date_picker/super_update_button.js +8 -0
  87. package/test-env/components/image/image.js +9 -2
  88. package/test-env/components/image/image_fullscreen_wrapper.js +3 -1
  89. package/test-env/components/image/image_wrapper.js +3 -1
  90. package/test-env/components/markdown_editor/markdown_format.styles.js +1 -4
  91. package/test-env/components/notification/notification_event.a11y.js +117 -0
  92. package/test-env/components/page/page_header/page_header.a11y.js +40 -0
  93. package/test-env/components/portal/portal.a11y.js +73 -0
  94. package/test-env/components/text/text.styles.js +5 -2
  95. package/test-env/components/tool_tip/icon_tip.js +8 -0
  96. package/test-env/components/tool_tip/tool_tip.js +37 -8
  97. package/test-env/components/tool_tip/tool_tip_manager.js +49 -0
  98. package/test-env/components/tour/tour.styles.js +1 -1
@@ -29,16 +29,13 @@ var euiScaleMarkdownFormatText = function euiScaleMarkdownFormatText(euiTheme, o
29
29
  var measurement = options.measurement;
30
30
  var lineHeightSize = measurement === 'em' ? "".concat(lineHeight, "em") : lineHeight; // Custom scales
31
31
 
32
- var blockQuoteBorderWidth = (0, _global_styling.mathWithUnits)(fontSize, function (x) {
33
- return x / 4;
34
- });
35
32
  var tablePaddingVertical = (0, _global_styling.mathWithUnits)(fontSize, function (x) {
36
33
  return x / 4;
37
34
  });
38
35
  var tablePaddingHorizontal = (0, _global_styling.mathWithUnits)(fontSize, function (x) {
39
36
  return x / 2;
40
37
  });
41
- return "\n .euiMarkdownFormat__blockquote {\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 .euiCheckbox .euiCheckbox__input ~ .euiCheckbox__label { // Extra specificity necessary to override default checkbox CSS\n font-size: ").concat(fontSize, ";\n ").concat((0, _global_styling.logicalCSS)('padding-left', lineHeightSize), "\n line-height: ").concat(lineHeight, ";\n }\n\n .euiCheckbox + *:not(.euiCheckbox) {\n ").concat((0, _global_styling.logicalCSS)('margin-top', fontSize), "\n }\n\n .euiMarkdownFormat__codeblockWrapper {\n ").concat((0, _global_styling.logicalCSS)('margin-bottom', fontSize), "\n }\n\n .euiMarkdownFormat__table {\n ").concat((0, _global_styling.logicalCSS)('margin-bottom', fontSize), "\n }\n\n .euiMarkdownFormat__table th,\n .euiMarkdownFormat__table td {\n ").concat((0, _global_styling.logicalCSS)('padding-vertical', tablePaddingVertical), "\n ").concat((0, _global_styling.logicalCSS)('padding-horizontal', tablePaddingHorizontal), "\n }\n ");
38
+ return "\n .euiCheckbox .euiCheckbox__input ~ .euiCheckbox__label { // Extra specificity necessary to override default checkbox CSS\n font-size: ".concat(fontSize, ";\n ").concat((0, _global_styling.logicalCSS)('padding-left', lineHeightSize), "\n line-height: ").concat(lineHeight, ";\n }\n\n .euiCheckbox + *:not(.euiCheckbox) {\n ").concat((0, _global_styling.logicalCSS)('margin-top', fontSize), "\n }\n\n .euiMarkdownFormat__codeblockWrapper {\n ").concat((0, _global_styling.logicalCSS)('margin-bottom', fontSize), "\n }\n\n .euiMarkdownFormat__table {\n ").concat((0, _global_styling.logicalCSS)('margin-bottom', fontSize), "\n }\n\n .euiMarkdownFormat__table th,\n .euiMarkdownFormat__table td {\n ").concat((0, _global_styling.logicalCSS)('padding-vertical', tablePaddingVertical), "\n ").concat((0, _global_styling.logicalCSS)('padding-horizontal', tablePaddingHorizontal), "\n }\n ");
42
39
  };
43
40
  /**
44
41
  * Styles
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
7
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
8
+
9
+ var _react = _interopRequireWildcard(require("react"));
10
+
11
+ var _context_menu = require("../context_menu");
12
+
13
+ var _notification_event = require("./notification_event");
14
+
15
+ var _panel = require("../panel");
16
+
17
+ var _react2 = require("@emotion/react");
18
+
19
+ 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); }
20
+
21
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
22
+
23
+ /*
24
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
25
+ * or more contributor license agreements. Licensed under the Elastic License
26
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
27
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
28
+ * Side Public License, v 1.
29
+ */
30
+ /// <reference types="../../../cypress/support"/>
31
+ var NotificationEvent = function NotificationEvent() {
32
+ var _useState = (0, _react.useState)(false),
33
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
34
+ isRead = _useState2[0],
35
+ setIsRead = _useState2[1];
36
+
37
+ var onRead = function onRead(id, isRead) {
38
+ setIsRead(!isRead);
39
+ };
40
+
41
+ var onOpenContextMenu = function onOpenContextMenu(id) {
42
+ return [(0, _react2.jsx)(_context_menu.EuiContextMenuItem, {
43
+ key: "contextMenuItemA",
44
+ onClick: function onClick() {
45
+ return onRead(id, isRead);
46
+ }
47
+ }, isRead ? 'Mark as unread' : 'Mark as read'), (0, _react2.jsx)(_context_menu.EuiContextMenuItem, {
48
+ key: "contextMenuItemB",
49
+ onClick: function onClick() {}
50
+ }, "View messages like this"), (0, _react2.jsx)(_context_menu.EuiContextMenuItem, {
51
+ key: "contextMenuItemC",
52
+ onClick: function onClick() {}
53
+ }, "Don\u2019t notify me about this")];
54
+ };
55
+
56
+ return (0, _react2.jsx)(_panel.EuiPanel, {
57
+ paddingSize: "none",
58
+ hasShadow: true,
59
+ style: {
60
+ maxWidth: '540px'
61
+ }
62
+ }, (0, _react2.jsx)(_notification_event.EuiNotificationEvent, {
63
+ id: "cy-eui-notification-1",
64
+ type: "Report",
65
+ iconType: "logoKibana",
66
+ iconAriaLabel: "Kibana",
67
+ time: "1 min ago",
68
+ title: "[Error Monitoring Report] is generated",
69
+ primaryAction: "Download",
70
+ primaryActionProps: {
71
+ iconType: 'download'
72
+ },
73
+ messages: ['The reported was generated at 17:12:16 GMT+4'],
74
+ isRead: isRead,
75
+ onRead: onRead,
76
+ onOpenContextMenu: onOpenContextMenu,
77
+ onClickPrimaryAction: function onClickPrimaryAction() {},
78
+ onClickTitle: function onClickTitle() {}
79
+ }));
80
+ };
81
+
82
+ describe('EuiNotificationEvent', function () {
83
+ beforeEach(function () {
84
+ cy.viewport(1024, 768); // medium breakpoint
85
+
86
+ cy.realMount((0, _react2.jsx)(NotificationEvent, null));
87
+ cy.get('article.euiNotificationEvent').should('exist');
88
+ });
89
+ describe('Automated accessibility check', function () {
90
+ it('has zero violations on first render', function () {
91
+ cy.checkAxe();
92
+ });
93
+ it('has zero violations when popover is open', function () {
94
+ cy.get('button[data-test-subj="cy-eui-notification-1-notificationEventMetaButton"]').realClick();
95
+ cy.get('div.euiPopover__panel').should('exist');
96
+ cy.checkAxe();
97
+ });
98
+ it('has zero violations after the Mark as read button is clicked', function () {
99
+ cy.get('button[data-test-subj="cy-eui-notification-1-notificationEventMetaButton"]').realClick();
100
+ cy.get('div.euiPopover__panel').should('exist');
101
+ cy.get('div.euiPopover__panel button').first().realClick();
102
+ cy.checkAxe();
103
+ });
104
+ });
105
+ describe('Keyboard accessibility', function () {
106
+ it('has zero violations when the popover is opened by keyboard', function () {
107
+ cy.repeatRealPress('Tab');
108
+ cy.get('button[data-test-subj="cy-eui-notification-1-notificationEventMetaButton"]').should('have.focus');
109
+ cy.realPress('Enter');
110
+ cy.get('div.euiPopover__panel').should('exist');
111
+ cy.checkAxe();
112
+ cy.realPress('Escape');
113
+ cy.get('div.euiPopover__panel').should('not.exist');
114
+ cy.checkAxe();
115
+ });
116
+ });
117
+ });
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _react = _interopRequireDefault(require("react"));
6
+
7
+ var _button = require("../../button");
8
+
9
+ var _page_header = require("./page_header");
10
+
11
+ var _react2 = require("@emotion/react");
12
+
13
+ /*
14
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
15
+ * or more contributor license agreements. Licensed under the Elastic License
16
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
17
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
18
+ * Side Public License, v 1.
19
+ */
20
+ /// <reference types="../../../../cypress/support"/>
21
+ describe('EuiPageHeader', function () {
22
+ beforeEach(function () {
23
+ cy.viewport(1024, 768); // medium breakpoint
24
+
25
+ cy.realMount((0, _react2.jsx)(_page_header.EuiPageHeader, {
26
+ pageTitle: "Page title",
27
+ iconType: "logoKibana",
28
+ description: "This description should be describing the current page as depicted by the page title. It will never extend beneath the right side content.",
29
+ rightSideItems: [(0, _react2.jsx)(_button.EuiButton, {
30
+ fill: true
31
+ }, "Add something"), (0, _react2.jsx)(_button.EuiButton, null, "Do something")]
32
+ }));
33
+ cy.get('h1.euiTitle').should('exist');
34
+ });
35
+ describe('Automated accessibility check', function () {
36
+ it('has zero violations on first render', function () {
37
+ cy.checkAxe();
38
+ });
39
+ });
40
+ });
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
7
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
8
+
9
+ var _react = _interopRequireWildcard(require("react"));
10
+
11
+ var _button = require("../button");
12
+
13
+ var _portal = require("./portal");
14
+
15
+ var _react2 = require("@emotion/react");
16
+
17
+ 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); }
18
+
19
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
20
+
21
+ /*
22
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
23
+ * or more contributor license agreements. Licensed under the Elastic License
24
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
25
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
26
+ * Side Public License, v 1.
27
+ */
28
+ /// <reference types="../../../cypress/support"/>
29
+ var Portal = function Portal() {
30
+ var _useState = (0, _react.useState)(false),
31
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
32
+ isPortalVisible = _useState2[0],
33
+ setIsPortalVisible = _useState2[1];
34
+
35
+ var togglePortal = function togglePortal() {
36
+ setIsPortalVisible(!isPortalVisible);
37
+ };
38
+
39
+ var closePortal = function closePortal() {
40
+ setIsPortalVisible(false);
41
+ };
42
+
43
+ var customPortal;
44
+
45
+ if (isPortalVisible) {
46
+ customPortal = (0, _react2.jsx)(_portal.EuiPortal, null, (0, _react2.jsx)("div", null, "This is the portal. Click anywhere to close."), (0, _react2.jsx)(_button.EuiButton, {
47
+ onClick: closePortal
48
+ }, "Close portal"));
49
+ }
50
+
51
+ return (0, _react2.jsx)("div", null, (0, _react2.jsx)(_button.EuiButton, {
52
+ onClick: togglePortal
53
+ }, "View guide"), customPortal);
54
+ };
55
+
56
+ describe('EuiPortal', function () {
57
+ beforeEach(function () {
58
+ cy.viewport(1024, 768); // medium breakpoint
59
+
60
+ cy.realMount((0, _react2.jsx)(Portal, null));
61
+ cy.get('div[data-relative-to-header="above"]').should('not.exist');
62
+ });
63
+ describe('Automated accessibility check', function () {
64
+ it('has zero violations on first render', function () {
65
+ cy.checkAxe();
66
+ });
67
+ it('has zero violations after the portal is activated', function () {
68
+ cy.get('button[type="button"]').contains('View guide').realClick();
69
+ cy.get('div[data-euiportal="true"]').should('exist');
70
+ cy.checkAxe();
71
+ });
72
+ });
73
+ });
@@ -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.
@@ -35,23 +35,25 @@ var _classnames = _interopRequireDefault(require("classnames"));
35
35
 
36
36
  var _common = require("../common");
37
37
 
38
- var _portal = require("../portal");
38
+ var _services = require("../../services");
39
39
 
40
- var _tool_tip_anchor = require("./tool_tip_anchor");
40
+ var _react2 = require("../../services/react");
41
41
 
42
- var _tool_tip_arrow = require("./tool_tip_arrow");
42
+ var _resize_observer = require("../observer/resize_observer");
43
+
44
+ var _portal = require("../portal");
43
45
 
44
46
  var _tool_tip_popover = require("./tool_tip_popover");
45
47
 
46
- var _react2 = require("../../services/react");
48
+ var _tool_tip_anchor = require("./tool_tip_anchor");
47
49
 
48
- var _services = require("../../services");
50
+ var _tool_tip_arrow = require("./tool_tip_arrow");
49
51
 
50
- var _resize_observer = require("../observer/resize_observer");
52
+ var _tool_tip_manager = require("./tool_tip_manager");
51
53
 
52
54
  var _react3 = require("@emotion/react");
53
55
 
54
- var _excluded = ["children", "className", "anchorClassName", "anchorProps", "content", "title", "delay", "display"];
56
+ var _excluded = ["children", "className", "anchorClassName", "anchorProps", "content", "title", "delay", "display", "repositionOnScroll"];
55
57
 
56
58
  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
59
 
@@ -146,9 +148,11 @@ var EuiToolTip = /*#__PURE__*/function (_Component) {
146
148
  if (!_this.timeoutId) {
147
149
  _this.timeoutId = setTimeout(function () {
148
150
  (0, _react2.enqueueStateChange)(function () {
149
- return _this.setState({
151
+ _this.setState({
150
152
  visible: true
151
153
  });
154
+
155
+ _tool_tip_manager.toolTipManager.registerTooltip(_this.hideToolTip);
152
156
  });
153
157
  }, delayToMsMap[_this.props.delay]);
154
158
  }
@@ -207,6 +211,8 @@ var EuiToolTip = /*#__PURE__*/function (_Component) {
207
211
  toolTipStyles: DEFAULT_TOOLTIP_STYLES,
208
212
  arrowStyles: undefined
209
213
  });
214
+
215
+ _tool_tip_manager.toolTipManager.deregisterToolTip(_this.hideToolTip);
210
216
  }
211
217
  });
212
218
  });
@@ -244,18 +250,32 @@ var EuiToolTip = /*#__PURE__*/function (_Component) {
244
250
  key: "componentDidMount",
245
251
  value: function componentDidMount() {
246
252
  this._isMounted = true;
253
+
254
+ if (this.props.repositionOnScroll) {
255
+ window.addEventListener('scroll', this.positionToolTip, true);
256
+ }
247
257
  }
248
258
  }, {
249
259
  key: "componentWillUnmount",
250
260
  value: function componentWillUnmount() {
251
261
  this.clearAnimationTimeout();
252
262
  this._isMounted = false;
263
+ window.removeEventListener('scroll', this.positionToolTip, true);
253
264
  }
254
265
  }, {
255
266
  key: "componentDidUpdate",
256
267
  value: function componentDidUpdate(prevProps, prevState) {
257
268
  if (prevState.visible === false && this.state.visible === true) {
258
269
  requestAnimationFrame(this.testAnchor);
270
+ } // update scroll listener
271
+
272
+
273
+ if (prevProps.repositionOnScroll !== this.props.repositionOnScroll) {
274
+ if (this.props.repositionOnScroll) {
275
+ window.addEventListener('scroll', this.positionToolTip, true);
276
+ } else {
277
+ window.removeEventListener('scroll', this.positionToolTip, true);
278
+ }
259
279
  }
260
280
  }
261
281
  }, {
@@ -270,6 +290,7 @@ var EuiToolTip = /*#__PURE__*/function (_Component) {
270
290
  title = _this$props.title,
271
291
  delay = _this$props.delay,
272
292
  display = _this$props.display,
293
+ repositionOnScroll = _this$props.repositionOnScroll,
273
294
  rest = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
274
295
  var _this$state = this.state,
275
296
  arrowStyles = _this$state.arrowStyles,
@@ -376,6 +397,14 @@ EuiToolTip.propTypes = {
376
397
  */
377
398
  position: _propTypes.default.oneOf(["top", "right", "bottom", "left"]).isRequired,
378
399
 
400
+ /**
401
+ * When `true`, the tooltip's position is re-calculated when the user
402
+ * scrolls. This supports having fixed-position tooltip anchors.
403
+ *
404
+ * When nesting an `EuiTooltip` in a scrollable container, `repositionOnScroll` should be `true`
405
+ */
406
+ repositionOnScroll: _propTypes.default.bool,
407
+
379
408
  /**
380
409
  * If supplied, called when mouse movement causes the tool tip to be
381
410
  * hidden.
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.toolTipManager = void 0;
9
+
10
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
+
12
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
+
14
+ /*
15
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
16
+ * or more contributor license agreements. Licensed under the Elastic License
17
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
18
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
19
+ * Side Public License, v 1.
20
+ */
21
+
22
+ /**
23
+ * Manager utility that ensures only one tooltip is visible at a time
24
+ *
25
+ * UX rationale (primarily for mouse-only users):
26
+ * @see https://github.com/elastic/kibana/issues/144482
27
+ * @see https://github.com/elastic/eui/issues/5883
28
+ */
29
+ var ToolTipManager = function ToolTipManager() {
30
+ var _this = this;
31
+
32
+ (0, _classCallCheck2.default)(this, ToolTipManager);
33
+ (0, _defineProperty2.default)(this, "toolTipsToHide", new Set());
34
+ (0, _defineProperty2.default)(this, "registerTooltip", function (hideCallback) {
35
+ _this.toolTipsToHide.forEach(function (hide) {
36
+ return hide();
37
+ });
38
+
39
+ _this.toolTipsToHide.clear();
40
+
41
+ _this.toolTipsToHide.add(hideCallback);
42
+ });
43
+ (0, _defineProperty2.default)(this, "deregisterToolTip", function (hideCallback) {
44
+ _this.toolTipsToHide.delete(hideCallback);
45
+ });
46
+ };
47
+
48
+ var toolTipManager = new ToolTipManager();
49
+ exports.toolTipManager = toolTipManager;
@@ -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