@elastic/eui 72.2.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 (53) hide show
  1. package/CHANGELOG.md +6185 -0
  2. package/dist/eui_theme_dark.css +15 -12
  3. package/dist/eui_theme_dark.min.css +1 -1
  4. package/dist/eui_theme_light.css +15 -12
  5. package/dist/eui_theme_light.min.css +1 -1
  6. package/es/components/datagrid/controls/column_selector.js +23 -7
  7. package/es/components/datagrid/controls/column_sorting_draggable.js +17 -8
  8. package/es/components/datagrid/data_grid.a11y.js +3 -2
  9. package/es/components/notification/notification_event.a11y.js +113 -0
  10. package/es/components/page/page_header/page_header.a11y.js +32 -0
  11. package/es/components/portal/portal.a11y.js +70 -0
  12. package/es/components/tool_tip/tool_tip.js +10 -5
  13. package/es/components/tool_tip/tool_tip_manager.js +42 -0
  14. package/eui.d.ts +11 -0
  15. package/i18ntokens.json +36 -20
  16. package/lib/components/datagrid/controls/column_selector.js +21 -6
  17. package/lib/components/datagrid/controls/column_sorting_draggable.js +17 -8
  18. package/lib/components/datagrid/data_grid.a11y.js +3 -2
  19. package/lib/components/notification/notification_event.a11y.js +117 -0
  20. package/lib/components/page/page_header/page_header.a11y.js +40 -0
  21. package/lib/components/portal/portal.a11y.js +73 -0
  22. package/lib/components/tool_tip/tool_tip.js +13 -7
  23. package/lib/components/tool_tip/tool_tip_manager.js +50 -0
  24. package/optimize/es/components/datagrid/controls/column_selector.js +22 -7
  25. package/optimize/es/components/datagrid/controls/column_sorting_draggable.js +17 -8
  26. package/optimize/es/components/datagrid/data_grid.a11y.js +3 -2
  27. package/optimize/es/components/notification/notification_event.a11y.js +103 -0
  28. package/optimize/es/components/page/page_header/page_header.a11y.js +32 -0
  29. package/optimize/es/components/portal/portal.a11y.js +60 -0
  30. package/optimize/es/components/tool_tip/tool_tip.js +10 -5
  31. package/optimize/es/components/tool_tip/tool_tip_manager.js +41 -0
  32. package/optimize/lib/components/datagrid/controls/column_selector.js +21 -6
  33. package/optimize/lib/components/datagrid/controls/column_sorting_draggable.js +17 -8
  34. package/optimize/lib/components/datagrid/data_grid.a11y.js +3 -2
  35. package/optimize/lib/components/notification/notification_event.a11y.js +117 -0
  36. package/optimize/lib/components/page/page_header/page_header.a11y.js +40 -0
  37. package/optimize/lib/components/portal/portal.a11y.js +73 -0
  38. package/optimize/lib/components/tool_tip/tool_tip.js +13 -7
  39. package/optimize/lib/components/tool_tip/tool_tip_manager.js +49 -0
  40. package/package.json +1 -1
  41. package/src/components/datagrid/controls/_data_grid_column_sorting.scss +14 -13
  42. package/src/components/date_picker/react-datepicker/LICENSE +21 -0
  43. package/src/components/date_picker/react-datepicker/README.md +168 -0
  44. package/src/services/theme/README.md +153 -0
  45. package/src/test/README.md +59 -0
  46. package/test-env/components/datagrid/controls/column_selector.js +21 -6
  47. package/test-env/components/datagrid/controls/column_sorting_draggable.js +17 -8
  48. package/test-env/components/datagrid/data_grid.a11y.js +3 -2
  49. package/test-env/components/notification/notification_event.a11y.js +117 -0
  50. package/test-env/components/page/page_header/page_header.a11y.js +40 -0
  51. package/test-env/components/portal/portal.a11y.js +73 -0
  52. package/test-env/components/tool_tip/tool_tip.js +13 -7
  53. package/test-env/components/tool_tip/tool_tip_manager.js +49 -0
@@ -181,7 +181,7 @@ describe('EuiDataGrid', function () {
181
181
  it('has zero violations on first render', function () {
182
182
  cy.checkAxe();
183
183
  });
184
- it('has zero violations when the columns reorder menu is open', function () {
184
+ it('has zero violations when the columns visibility menu is open', function () {
185
185
  cy.get('button[data-test-subj="dataGridColumnSelectorButton"]').realClick();
186
186
  cy.checkAxe();
187
187
  });
@@ -234,9 +234,10 @@ describe('EuiDataGrid', function () {
234
234
  cy.get('div[data-gridcell-visible-row-index="0"][data-gridcell-column-index="1"]').find('button.euiButtonIcon').last().realClick();
235
235
  cy.checkAxe();
236
236
  });
237
- it('has zero violations when the Favorite Distro column has been sorted', function () {
237
+ it('has zero violations on sort and when the columns sorting menu is open', function () {
238
238
  cy.get('button.euiDataGridHeaderCell__button').last().realClick();
239
239
  cy.get('button.euiListGroupItem__button').contains('Sort Alma to Debian').should('exist').realClick();
240
+ cy.get('button[data-test-subj="dataGridColumnSortingPopover"]').realClick();
240
241
  cy.checkAxe();
241
242
  });
242
243
  it('has zero violations when fullscreen is open', function () {
@@ -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
+ });
@@ -35,19 +35,21 @@ 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
 
@@ -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
  });
@@ -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;