@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.
- package/CHANGELOG.md +6185 -0
- package/dist/eui_theme_dark.css +15 -12
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +15 -12
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/datagrid/controls/column_selector.js +23 -7
- package/es/components/datagrid/controls/column_sorting_draggable.js +17 -8
- package/es/components/datagrid/data_grid.a11y.js +3 -2
- package/es/components/notification/notification_event.a11y.js +113 -0
- package/es/components/page/page_header/page_header.a11y.js +32 -0
- package/es/components/portal/portal.a11y.js +70 -0
- package/es/components/tool_tip/tool_tip.js +10 -5
- package/es/components/tool_tip/tool_tip_manager.js +42 -0
- package/eui.d.ts +11 -0
- package/i18ntokens.json +36 -20
- package/lib/components/datagrid/controls/column_selector.js +21 -6
- package/lib/components/datagrid/controls/column_sorting_draggable.js +17 -8
- package/lib/components/datagrid/data_grid.a11y.js +3 -2
- package/lib/components/notification/notification_event.a11y.js +117 -0
- package/lib/components/page/page_header/page_header.a11y.js +40 -0
- package/lib/components/portal/portal.a11y.js +73 -0
- package/lib/components/tool_tip/tool_tip.js +13 -7
- package/lib/components/tool_tip/tool_tip_manager.js +50 -0
- package/optimize/es/components/datagrid/controls/column_selector.js +22 -7
- package/optimize/es/components/datagrid/controls/column_sorting_draggable.js +17 -8
- package/optimize/es/components/datagrid/data_grid.a11y.js +3 -2
- package/optimize/es/components/notification/notification_event.a11y.js +103 -0
- package/optimize/es/components/page/page_header/page_header.a11y.js +32 -0
- package/optimize/es/components/portal/portal.a11y.js +60 -0
- package/optimize/es/components/tool_tip/tool_tip.js +10 -5
- package/optimize/es/components/tool_tip/tool_tip_manager.js +41 -0
- package/optimize/lib/components/datagrid/controls/column_selector.js +21 -6
- package/optimize/lib/components/datagrid/controls/column_sorting_draggable.js +17 -8
- package/optimize/lib/components/datagrid/data_grid.a11y.js +3 -2
- package/optimize/lib/components/notification/notification_event.a11y.js +117 -0
- package/optimize/lib/components/page/page_header/page_header.a11y.js +40 -0
- package/optimize/lib/components/portal/portal.a11y.js +73 -0
- package/optimize/lib/components/tool_tip/tool_tip.js +13 -7
- package/optimize/lib/components/tool_tip/tool_tip_manager.js +49 -0
- package/package.json +1 -1
- package/src/components/datagrid/controls/_data_grid_column_sorting.scss +14 -13
- package/src/components/date_picker/react-datepicker/LICENSE +21 -0
- package/src/components/date_picker/react-datepicker/README.md +168 -0
- package/src/services/theme/README.md +153 -0
- package/src/test/README.md +59 -0
- package/test-env/components/datagrid/controls/column_selector.js +21 -6
- package/test-env/components/datagrid/controls/column_sorting_draggable.js +17 -8
- package/test-env/components/datagrid/data_grid.a11y.js +3 -2
- package/test-env/components/notification/notification_event.a11y.js +117 -0
- package/test-env/components/page/page_header/page_header.a11y.js +40 -0
- package/test-env/components/portal/portal.a11y.js +73 -0
- package/test-env/components/tool_tip/tool_tip.js +13 -7
- package/test-env/components/tool_tip/tool_tip_manager.js +49 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
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
|
+
/// <reference types="../../../cypress/support"/>
|
|
11
|
+
import React, { useState } from 'react';
|
|
12
|
+
import { EuiContextMenuItem } from '../context_menu';
|
|
13
|
+
import { EuiNotificationEvent } from './notification_event';
|
|
14
|
+
import { EuiPanel } from '../panel';
|
|
15
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
16
|
+
|
|
17
|
+
var NotificationEvent = function NotificationEvent() {
|
|
18
|
+
var _useState = useState(false),
|
|
19
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
20
|
+
isRead = _useState2[0],
|
|
21
|
+
setIsRead = _useState2[1];
|
|
22
|
+
|
|
23
|
+
var onRead = function onRead(id, isRead) {
|
|
24
|
+
setIsRead(!isRead);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
var onOpenContextMenu = function onOpenContextMenu(id) {
|
|
28
|
+
return [___EmotionJSX(EuiContextMenuItem, {
|
|
29
|
+
key: "contextMenuItemA",
|
|
30
|
+
onClick: function onClick() {
|
|
31
|
+
return onRead(id, isRead);
|
|
32
|
+
}
|
|
33
|
+
}, isRead ? 'Mark as unread' : 'Mark as read'), ___EmotionJSX(EuiContextMenuItem, {
|
|
34
|
+
key: "contextMenuItemB",
|
|
35
|
+
onClick: function onClick() {}
|
|
36
|
+
}, "View messages like this"), ___EmotionJSX(EuiContextMenuItem, {
|
|
37
|
+
key: "contextMenuItemC",
|
|
38
|
+
onClick: function onClick() {}
|
|
39
|
+
}, "Don\u2019t notify me about this")];
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
return ___EmotionJSX(EuiPanel, {
|
|
43
|
+
paddingSize: "none",
|
|
44
|
+
hasShadow: true,
|
|
45
|
+
style: {
|
|
46
|
+
maxWidth: '540px'
|
|
47
|
+
}
|
|
48
|
+
}, ___EmotionJSX(EuiNotificationEvent, {
|
|
49
|
+
id: "cy-eui-notification-1",
|
|
50
|
+
type: "Report",
|
|
51
|
+
iconType: "logoKibana",
|
|
52
|
+
iconAriaLabel: "Kibana",
|
|
53
|
+
time: "1 min ago",
|
|
54
|
+
title: "[Error Monitoring Report] is generated",
|
|
55
|
+
primaryAction: "Download",
|
|
56
|
+
primaryActionProps: {
|
|
57
|
+
iconType: 'download'
|
|
58
|
+
},
|
|
59
|
+
messages: ['The reported was generated at 17:12:16 GMT+4'],
|
|
60
|
+
isRead: isRead,
|
|
61
|
+
onRead: onRead,
|
|
62
|
+
onOpenContextMenu: onOpenContextMenu,
|
|
63
|
+
onClickPrimaryAction: function onClickPrimaryAction() {},
|
|
64
|
+
onClickTitle: function onClickTitle() {}
|
|
65
|
+
}));
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
describe('EuiNotificationEvent', function () {
|
|
69
|
+
beforeEach(function () {
|
|
70
|
+
cy.viewport(1024, 768); // medium breakpoint
|
|
71
|
+
|
|
72
|
+
cy.realMount(___EmotionJSX(NotificationEvent, null));
|
|
73
|
+
cy.get('article.euiNotificationEvent').should('exist');
|
|
74
|
+
});
|
|
75
|
+
describe('Automated accessibility check', function () {
|
|
76
|
+
it('has zero violations on first render', function () {
|
|
77
|
+
cy.checkAxe();
|
|
78
|
+
});
|
|
79
|
+
it('has zero violations when popover is open', function () {
|
|
80
|
+
cy.get('button[data-test-subj="cy-eui-notification-1-notificationEventMetaButton"]').realClick();
|
|
81
|
+
cy.get('div.euiPopover__panel').should('exist');
|
|
82
|
+
cy.checkAxe();
|
|
83
|
+
});
|
|
84
|
+
it('has zero violations after the Mark as read button is clicked', function () {
|
|
85
|
+
cy.get('button[data-test-subj="cy-eui-notification-1-notificationEventMetaButton"]').realClick();
|
|
86
|
+
cy.get('div.euiPopover__panel').should('exist');
|
|
87
|
+
cy.get('div.euiPopover__panel button').first().realClick();
|
|
88
|
+
cy.checkAxe();
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
describe('Keyboard accessibility', function () {
|
|
92
|
+
it('has zero violations when the popover is opened by keyboard', function () {
|
|
93
|
+
cy.repeatRealPress('Tab');
|
|
94
|
+
cy.get('button[data-test-subj="cy-eui-notification-1-notificationEventMetaButton"]').should('have.focus');
|
|
95
|
+
cy.realPress('Enter');
|
|
96
|
+
cy.get('div.euiPopover__panel').should('exist');
|
|
97
|
+
cy.checkAxe();
|
|
98
|
+
cy.realPress('Escape');
|
|
99
|
+
cy.get('div.euiPopover__panel').should('not.exist');
|
|
100
|
+
cy.checkAxe();
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
/// <reference types="../../../../cypress/support"/>
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { EuiButton } from '../../button';
|
|
11
|
+
import { EuiPageHeader } from './page_header';
|
|
12
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
13
|
+
describe('EuiPageHeader', function () {
|
|
14
|
+
beforeEach(function () {
|
|
15
|
+
cy.viewport(1024, 768); // medium breakpoint
|
|
16
|
+
|
|
17
|
+
cy.realMount(___EmotionJSX(EuiPageHeader, {
|
|
18
|
+
pageTitle: "Page title",
|
|
19
|
+
iconType: "logoKibana",
|
|
20
|
+
description: "This description should be describing the current page as depicted by the page title. It will never extend beneath the right side content.",
|
|
21
|
+
rightSideItems: [___EmotionJSX(EuiButton, {
|
|
22
|
+
fill: true
|
|
23
|
+
}, "Add something"), ___EmotionJSX(EuiButton, null, "Do something")]
|
|
24
|
+
}));
|
|
25
|
+
cy.get('h1.euiTitle').should('exist');
|
|
26
|
+
});
|
|
27
|
+
describe('Automated accessibility check', function () {
|
|
28
|
+
it('has zero violations on first render', function () {
|
|
29
|
+
cy.checkAxe();
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
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
|
+
/// <reference types="../../../cypress/support"/>
|
|
11
|
+
import React, { useState } from 'react';
|
|
12
|
+
import { EuiButton } from '../button';
|
|
13
|
+
import { EuiPortal } from './portal';
|
|
14
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
15
|
+
|
|
16
|
+
var Portal = function Portal() {
|
|
17
|
+
var _useState = useState(false),
|
|
18
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
19
|
+
isPortalVisible = _useState2[0],
|
|
20
|
+
setIsPortalVisible = _useState2[1];
|
|
21
|
+
|
|
22
|
+
var togglePortal = function togglePortal() {
|
|
23
|
+
setIsPortalVisible(!isPortalVisible);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
var closePortal = function closePortal() {
|
|
27
|
+
setIsPortalVisible(false);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
var customPortal;
|
|
31
|
+
|
|
32
|
+
if (isPortalVisible) {
|
|
33
|
+
customPortal = ___EmotionJSX(EuiPortal, null, ___EmotionJSX("div", null, "This is the portal. Click anywhere to close."), ___EmotionJSX(EuiButton, {
|
|
34
|
+
onClick: closePortal
|
|
35
|
+
}, "Close portal"));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return ___EmotionJSX("div", null, ___EmotionJSX(EuiButton, {
|
|
39
|
+
onClick: togglePortal
|
|
40
|
+
}, "View guide"), customPortal);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
describe('EuiPortal', function () {
|
|
44
|
+
beforeEach(function () {
|
|
45
|
+
cy.viewport(1024, 768); // medium breakpoint
|
|
46
|
+
|
|
47
|
+
cy.realMount(___EmotionJSX(Portal, null));
|
|
48
|
+
cy.get('div[data-relative-to-header="above"]').should('not.exist');
|
|
49
|
+
});
|
|
50
|
+
describe('Automated accessibility check', function () {
|
|
51
|
+
it('has zero violations on first render', function () {
|
|
52
|
+
cy.checkAxe();
|
|
53
|
+
});
|
|
54
|
+
it('has zero violations after the portal is activated', function () {
|
|
55
|
+
cy.get('button[type="button"]').contains('View guide').realClick();
|
|
56
|
+
cy.get('div[data-euiportal="true"]').should('exist');
|
|
57
|
+
cy.checkAxe();
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
});
|
|
@@ -23,13 +23,14 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
23
23
|
import React, { Component } from 'react';
|
|
24
24
|
import classNames from 'classnames';
|
|
25
25
|
import { keysOf } from '../common';
|
|
26
|
+
import { findPopoverPosition, htmlIdGenerator } from '../../services';
|
|
27
|
+
import { enqueueStateChange } from '../../services/react';
|
|
28
|
+
import { EuiResizeObserver } from '../observer/resize_observer';
|
|
26
29
|
import { EuiPortal } from '../portal';
|
|
30
|
+
import { EuiToolTipPopover } from './tool_tip_popover';
|
|
27
31
|
import { EuiToolTipAnchor } from './tool_tip_anchor';
|
|
28
32
|
import { EuiToolTipArrow } from './tool_tip_arrow';
|
|
29
|
-
import {
|
|
30
|
-
import { enqueueStateChange } from '../../services/react';
|
|
31
|
-
import { findPopoverPosition, htmlIdGenerator } from '../../services';
|
|
32
|
-
import { EuiResizeObserver } from '../observer/resize_observer';
|
|
33
|
+
import { toolTipManager } from './tool_tip_manager';
|
|
33
34
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
34
35
|
var positionsToClassNameMap = {
|
|
35
36
|
top: 'euiToolTip--top',
|
|
@@ -124,9 +125,11 @@ export var EuiToolTip = /*#__PURE__*/function (_Component) {
|
|
|
124
125
|
if (!_this.timeoutId) {
|
|
125
126
|
_this.timeoutId = setTimeout(function () {
|
|
126
127
|
enqueueStateChange(function () {
|
|
127
|
-
|
|
128
|
+
_this.setState({
|
|
128
129
|
visible: true
|
|
129
130
|
});
|
|
131
|
+
|
|
132
|
+
toolTipManager.registerTooltip(_this.hideToolTip);
|
|
130
133
|
});
|
|
131
134
|
}, delayToMsMap[_this.props.delay]);
|
|
132
135
|
}
|
|
@@ -187,6 +190,8 @@ export var EuiToolTip = /*#__PURE__*/function (_Component) {
|
|
|
187
190
|
toolTipStyles: DEFAULT_TOOLTIP_STYLES,
|
|
188
191
|
arrowStyles: undefined
|
|
189
192
|
});
|
|
193
|
+
|
|
194
|
+
toolTipManager.deregisterToolTip(_this.hideToolTip);
|
|
190
195
|
}
|
|
191
196
|
});
|
|
192
197
|
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
6
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
7
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
8
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
9
|
+
* Side Public License, v 1.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Manager utility that ensures only one tooltip is visible at a time
|
|
14
|
+
*
|
|
15
|
+
* UX rationale (primarily for mouse-only users):
|
|
16
|
+
* @see https://github.com/elastic/kibana/issues/144482
|
|
17
|
+
* @see https://github.com/elastic/eui/issues/5883
|
|
18
|
+
*/
|
|
19
|
+
var ToolTipManager = function ToolTipManager() {
|
|
20
|
+
var _this = this;
|
|
21
|
+
|
|
22
|
+
_classCallCheck(this, ToolTipManager);
|
|
23
|
+
|
|
24
|
+
_defineProperty(this, "toolTipsToHide", new Set());
|
|
25
|
+
|
|
26
|
+
_defineProperty(this, "registerTooltip", function (hideCallback) {
|
|
27
|
+
_this.toolTipsToHide.forEach(function (hide) {
|
|
28
|
+
return hide();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
_this.toolTipsToHide.clear();
|
|
32
|
+
|
|
33
|
+
_this.toolTipsToHide.add(hideCallback);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
_defineProperty(this, "deregisterToolTip", function (hideCallback) {
|
|
37
|
+
_this.toolTipsToHide.delete(hideCallback);
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export var toolTipManager = new ToolTipManager();
|
|
@@ -11,6 +11,8 @@ exports.useDataGridColumnSelector = void 0;
|
|
|
11
11
|
|
|
12
12
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
13
|
|
|
14
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
|
+
|
|
14
16
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
17
|
|
|
16
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -107,6 +109,7 @@ var useDataGridColumnSelector = function useDataGridColumnSelector(availableColu
|
|
|
107
109
|
}, [sortedColumns, columnSearchText, displayValues]);
|
|
108
110
|
var isDragEnabled = allowColumnReorder && columnSearchText.length === 0; // only allow drag-and-drop when not filtering columns
|
|
109
111
|
|
|
112
|
+
var dragHandleAriaLabel = (0, _i18n.useEuiI18n)('euiColumnSelector.dragHandleAriaLabel', 'Drag handle');
|
|
110
113
|
var buttonText = (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
111
114
|
token: "euiColumnSelector.button",
|
|
112
115
|
default: "Columns"
|
|
@@ -179,18 +182,23 @@ var useDataGridColumnSelector = function useDataGridColumnSelector(availableColu
|
|
|
179
182
|
key: id,
|
|
180
183
|
draggableId: id,
|
|
181
184
|
index: index,
|
|
182
|
-
isDragDisabled: !isDragEnabled
|
|
185
|
+
isDragDisabled: !isDragEnabled,
|
|
186
|
+
hasInteractiveChildren: true,
|
|
187
|
+
customDragHandle: true
|
|
183
188
|
}, function (provided, state) {
|
|
184
189
|
return (0, _react2.jsx)("div", {
|
|
185
190
|
className: "euiDataGridColumnSelector__item ".concat(state.isDragging && 'euiDataGridColumnSelector__item-isDragging'),
|
|
186
191
|
"data-test-subj": "dataGridColumnSelectorColumnItem-".concat(id)
|
|
187
192
|
}, (0, _react2.jsx)(_flex.EuiFlexGroup, {
|
|
188
193
|
responsive: false,
|
|
189
|
-
gutterSize: "
|
|
194
|
+
gutterSize: "s",
|
|
190
195
|
alignItems: "center"
|
|
191
|
-
},
|
|
196
|
+
}, allowColumnHiding && (0, _react2.jsx)(_flex.EuiFlexItem, {
|
|
197
|
+
grow: false
|
|
198
|
+
}, (0, _react2.jsx)(_form.EuiSwitch, {
|
|
192
199
|
name: id,
|
|
193
200
|
label: displayValues[id] || id,
|
|
201
|
+
showLabel: false,
|
|
194
202
|
checked: visibleColumnIds.has(id),
|
|
195
203
|
compressed: true,
|
|
196
204
|
className: "euiSwitch--mini",
|
|
@@ -202,11 +210,18 @@ var useDataGridColumnSelector = function useDataGridColumnSelector(availableColu
|
|
|
202
210
|
setVisibleColumns(nextVisibleColumns);
|
|
203
211
|
},
|
|
204
212
|
"data-test-subj": "dataGridColumnSelectorToggleColumnVisibility-".concat(id)
|
|
205
|
-
})
|
|
213
|
+
})), (0, _react2.jsx)(_flex.EuiFlexItem // This extra column name flex item affords the column more grabbable real estate
|
|
214
|
+
// for mouse users, while hiding repetition for keyboard/screen reader users
|
|
215
|
+
, (0, _extends2.default)({}, provided.dragHandleProps, {
|
|
216
|
+
"aria-hidden": true,
|
|
217
|
+
tabIndex: -1
|
|
218
|
+
}), (0, _react2.jsx)("span", {
|
|
206
219
|
className: "euiDataGridColumnSelector__itemLabel"
|
|
207
|
-
}, id)), isDragEnabled && (0, _react2.jsx)(_flex.EuiFlexItem, {
|
|
220
|
+
}, displayValues[id] || id)), isDragEnabled && (0, _react2.jsx)(_flex.EuiFlexItem, (0, _extends2.default)({
|
|
208
221
|
grow: false
|
|
209
|
-
},
|
|
222
|
+
}, provided.dragHandleProps, {
|
|
223
|
+
"aria-label": dragHandleAriaLabel
|
|
224
|
+
}), (0, _react2.jsx)(_icon.EuiIcon, {
|
|
210
225
|
type: "grab",
|
|
211
226
|
color: "subdued"
|
|
212
227
|
}))));
|
|
@@ -73,7 +73,9 @@ var EuiDataGridColumnSortingDraggable = function EuiDataGridColumnSortingDraggab
|
|
|
73
73
|
var dragHandleAriaLabel = (0, _i18n.useEuiI18n)('euiColumnSortingDraggable.dragHandleAriaLabel', 'Drag handle');
|
|
74
74
|
return (0, _react2.jsx)(_drag_and_drop.EuiDraggable, (0, _extends2.default)({
|
|
75
75
|
draggableId: id,
|
|
76
|
-
index: index
|
|
76
|
+
index: index,
|
|
77
|
+
hasInteractiveChildren: true,
|
|
78
|
+
customDragHandle: true
|
|
77
79
|
}, rest), function (provided, state) {
|
|
78
80
|
return (0, _react2.jsx)("div", {
|
|
79
81
|
className: "euiDataGridColumnSorting__item ".concat(state.isDragging && 'euiDataGridColumnSorting__item-isDragging')
|
|
@@ -114,18 +116,25 @@ var EuiDataGridColumnSortingDraggable = function EuiDataGridColumnSortingDraggab
|
|
|
114
116
|
sorting.onSort(nextColumns);
|
|
115
117
|
}
|
|
116
118
|
});
|
|
117
|
-
})), (0, _react2.jsx)(_flex.EuiFlexItem, {
|
|
119
|
+
})), (0, _react2.jsx)(_flex.EuiFlexItem, (0, _extends2.default)({
|
|
120
|
+
className: "euiDataGridColumnSorting__name" // This extra column name flex item affords the column more grabbable real estate
|
|
121
|
+
// for mouse users, while hiding repetition for keyboard/screen reader users
|
|
122
|
+
|
|
123
|
+
}, provided.dragHandleProps, {
|
|
124
|
+
tabIndex: -1,
|
|
125
|
+
"aria-hidden": true
|
|
126
|
+
}), (0, _react2.jsx)(_flex.EuiFlexGroup, {
|
|
127
|
+
gutterSize: "xs",
|
|
128
|
+
alignItems: "center",
|
|
129
|
+
responsive: false
|
|
130
|
+
}, (0, _react2.jsx)(_flex.EuiFlexItem, {
|
|
118
131
|
grow: false
|
|
119
132
|
}, (0, _react2.jsx)(_token.EuiToken, {
|
|
120
133
|
color: schemaDetails != null ? schemaDetails.color : undefined,
|
|
121
134
|
iconType: schemaDetails != null ? schemaDetails.icon : 'tokenString'
|
|
122
|
-
})), (0, _react2.jsx)(_flex.EuiFlexItem, {
|
|
123
|
-
"aria-hidden": true
|
|
124
|
-
}, (0, _react2.jsx)(_text.EuiText, {
|
|
135
|
+
})), (0, _react2.jsx)(_flex.EuiFlexItem, null, (0, _react2.jsx)(_text.EuiText, {
|
|
125
136
|
size: "xs"
|
|
126
|
-
}, (0, _react2.jsx)("p", null, display))), (0, _react2.jsx)(_flex.EuiFlexItem, {
|
|
127
|
-
className: "euiDataGridColumnSorting__orderButtons"
|
|
128
|
-
}, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
137
|
+
}, (0, _react2.jsx)("p", null, display))))), (0, _react2.jsx)(_flex.EuiFlexItem, null, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
129
138
|
token: "euiColumnSortingDraggable.toggleLegend",
|
|
130
139
|
default: "Select sorting method for {display}",
|
|
131
140
|
values: {
|
|
@@ -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
|
|
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
|
|
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
|
+
});
|