@elastic/eui 70.2.4 → 70.3.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/dist/eui_theme_dark.css +0 -198
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +0 -198
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/accessibility/skip_link/skip_link.js +6 -5
- package/es/components/badge/beta_badge/beta_badge.js +11 -3
- package/es/components/badge/beta_badge/beta_badge.styles.js +25 -4
- package/es/components/card/card.js +6 -1
- package/es/components/card/card.styles.js +4 -4
- package/es/components/date_picker/super_date_picker/super_date_picker.a11y.js +109 -0
- package/es/components/flyout/flyout.a11y.js +92 -0
- package/es/components/image/image_fullscreen_wrapper.styles.js +3 -11
- package/es/components/modal/confirm_modal.js +11 -0
- package/es/components/modal/modal.a11y.js +70 -0
- package/es/components/modal/modal.js +17 -27
- package/es/components/modal/modal.styles.js +23 -0
- package/es/components/modal/modal_body.js +8 -0
- package/es/components/modal/modal_body.styles.js +16 -0
- package/es/components/modal/modal_footer.js +6 -0
- package/es/components/modal/modal_footer.styles.js +15 -0
- package/es/components/modal/modal_header.js +6 -0
- package/es/components/modal/modal_header.styles.js +14 -0
- package/es/components/modal/modal_header_title.js +3 -1
- package/es/components/page_template/outer/page_outer.js +1 -1
- package/es/components/page_template/page_template.js +28 -6
- package/es/components/popover/popover.a11y.js +83 -0
- package/es/components/search_bar/query/default_syntax.js +2 -1
- package/es/components/tabs/tabs.a11y.js +97 -0
- package/es/components/tree_view/tree_view.a11y.js +74 -0
- package/es/global_styling/utility/animations.js +5 -2
- package/eui.d.ts +58 -7
- package/i18ntokens.json +2 -2
- package/lib/components/accessibility/skip_link/skip_link.js +6 -5
- package/lib/components/badge/beta_badge/beta_badge.js +13 -4
- package/lib/components/badge/beta_badge/beta_badge.styles.js +25 -4
- package/lib/components/card/card.js +6 -1
- package/lib/components/card/card.styles.js +4 -4
- package/lib/components/date_picker/super_date_picker/super_date_picker.a11y.js +111 -0
- package/lib/components/flyout/flyout.a11y.js +94 -0
- package/lib/components/image/image_fullscreen_wrapper.styles.js +9 -10
- package/lib/components/modal/confirm_modal.js +13 -0
- package/lib/components/modal/modal.a11y.js +73 -0
- package/lib/components/modal/modal.js +17 -32
- package/lib/components/modal/modal.styles.js +36 -0
- package/lib/components/modal/modal_body.js +10 -0
- package/lib/components/modal/modal_body.styles.js +27 -0
- package/lib/components/modal/modal_footer.js +8 -0
- package/lib/components/modal/modal_footer.styles.js +26 -0
- package/lib/components/modal/modal_header.js +8 -0
- package/lib/components/modal/modal_header.styles.js +24 -0
- package/lib/components/modal/modal_header_title.js +4 -1
- package/lib/components/page_template/outer/page_outer.js +1 -1
- package/lib/components/page_template/page_template.js +32 -10
- package/lib/components/popover/popover.a11y.js +86 -0
- package/lib/components/search_bar/query/default_syntax.js +2 -1
- package/lib/components/tabs/tabs.a11y.js +98 -0
- package/lib/components/tree_view/tree_view.a11y.js +80 -0
- package/lib/global_styling/utility/animations.js +9 -3
- package/optimize/es/components/accessibility/skip_link/skip_link.js +6 -5
- package/optimize/es/components/badge/beta_badge/beta_badge.js +5 -2
- package/optimize/es/components/badge/beta_badge/beta_badge.styles.js +25 -4
- package/optimize/es/components/card/card.styles.js +4 -4
- package/optimize/es/components/date_picker/super_date_picker/super_date_picker.a11y.js +98 -0
- package/optimize/es/components/flyout/flyout.a11y.js +77 -0
- package/optimize/es/components/image/image_fullscreen_wrapper.styles.js +3 -11
- package/optimize/es/components/modal/confirm_modal.js +6 -0
- package/optimize/es/components/modal/modal.a11y.js +60 -0
- package/optimize/es/components/modal/modal.js +17 -27
- package/optimize/es/components/modal/modal.styles.js +23 -0
- package/optimize/es/components/modal/modal_body.js +8 -0
- package/optimize/es/components/modal/modal_body.styles.js +16 -0
- package/optimize/es/components/modal/modal_footer.js +6 -0
- package/optimize/es/components/modal/modal_footer.styles.js +15 -0
- package/optimize/es/components/modal/modal_header.js +6 -0
- package/optimize/es/components/modal/modal_header.styles.js +14 -0
- package/optimize/es/components/modal/modal_header_title.js +3 -1
- package/optimize/es/components/page_template/page_template.js +5 -3
- package/optimize/es/components/popover/popover.a11y.js +73 -0
- package/optimize/es/components/search_bar/query/default_syntax.js +2 -1
- package/optimize/es/components/tabs/tabs.a11y.js +97 -0
- package/optimize/es/components/tree_view/tree_view.a11y.js +74 -0
- package/optimize/es/global_styling/utility/animations.js +5 -2
- package/optimize/lib/components/accessibility/skip_link/skip_link.js +6 -5
- package/optimize/lib/components/badge/beta_badge/beta_badge.js +7 -3
- package/optimize/lib/components/badge/beta_badge/beta_badge.styles.js +25 -4
- package/optimize/lib/components/card/card.styles.js +4 -4
- package/optimize/lib/components/date_picker/super_date_picker/super_date_picker.a11y.js +111 -0
- package/optimize/lib/components/flyout/flyout.a11y.js +84 -0
- package/optimize/lib/components/image/image_fullscreen_wrapper.styles.js +9 -12
- package/optimize/lib/components/modal/confirm_modal.js +8 -0
- package/optimize/lib/components/modal/modal.a11y.js +73 -0
- package/optimize/lib/components/modal/modal.js +17 -31
- package/optimize/lib/components/modal/modal.styles.js +36 -0
- package/optimize/lib/components/modal/modal_body.js +10 -0
- package/optimize/lib/components/modal/modal_body.styles.js +27 -0
- package/optimize/lib/components/modal/modal_footer.js +8 -0
- package/optimize/lib/components/modal/modal_footer.styles.js +26 -0
- package/optimize/lib/components/modal/modal_header.js +8 -0
- package/optimize/lib/components/modal/modal_header.styles.js +24 -0
- package/optimize/lib/components/modal/modal_header_title.js +4 -1
- package/optimize/lib/components/page_template/page_template.js +5 -3
- package/optimize/lib/components/popover/popover.a11y.js +86 -0
- package/optimize/lib/components/search_bar/query/default_syntax.js +2 -1
- package/optimize/lib/components/tabs/tabs.a11y.js +98 -0
- package/optimize/lib/components/tree_view/tree_view.a11y.js +80 -0
- package/optimize/lib/global_styling/utility/animations.js +9 -3
- package/package.json +5 -4
- package/src/components/index.scss +0 -1
- package/src/themes/amsterdam/overrides/_index.scss +0 -1
- package/test-env/components/accessibility/skip_link/skip_link.js +6 -5
- package/test-env/components/badge/beta_badge/beta_badge.js +13 -4
- package/test-env/components/badge/beta_badge/beta_badge.styles.js +25 -4
- package/test-env/components/card/card.js +6 -1
- package/test-env/components/card/card.styles.js +4 -4
- package/test-env/components/date_picker/super_date_picker/super_date_picker.a11y.js +111 -0
- package/test-env/components/flyout/flyout.a11y.js +84 -0
- package/test-env/components/image/image_fullscreen_wrapper.styles.js +9 -12
- package/test-env/components/modal/confirm_modal.js +13 -0
- package/test-env/components/modal/modal.a11y.js +73 -0
- package/test-env/components/modal/modal.js +17 -31
- package/test-env/components/modal/modal.styles.js +36 -0
- package/test-env/components/modal/modal_body.js +10 -0
- package/test-env/components/modal/modal_body.styles.js +27 -0
- package/test-env/components/modal/modal_footer.js +8 -0
- package/test-env/components/modal/modal_footer.styles.js +26 -0
- package/test-env/components/modal/modal_header.js +8 -0
- package/test-env/components/modal/modal_header.styles.js +24 -0
- package/test-env/components/modal/modal_header_title.js +4 -1
- package/test-env/components/page_template/outer/page_outer.js +1 -1
- package/test-env/components/page_template/page_template.js +32 -10
- package/test-env/components/popover/popover.a11y.js +86 -0
- package/test-env/components/search_bar/query/default_syntax.js +2 -1
- package/test-env/components/tabs/tabs.a11y.js +98 -0
- package/test-env/components/tree_view/tree_view.a11y.js +80 -0
- package/test-env/global_styling/utility/animations.js +9 -3
- package/src/components/modal/_index.scss +0 -1
- package/src/components/modal/_modal.scss +0 -156
- package/src/themes/amsterdam/overrides/_modal.scss +0 -3
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["children", "restrictWidth", "paddingSize", "grow", "bottomBorder", "offset", "panelled", "contentBorder", "
|
|
5
|
+
var _excluded = ["children", "responsive", "restrictWidth", "paddingSize", "grow", "bottomBorder", "offset", "panelled", "contentBorder", "component", "mainProps", "className", "minHeight"];
|
|
6
6
|
|
|
7
7
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
8
8
|
|
|
@@ -38,6 +38,8 @@ export var TemplateContext = /*#__PURE__*/createContext({
|
|
|
38
38
|
*/
|
|
39
39
|
export var _EuiPageTemplate = function _EuiPageTemplate(_ref) {
|
|
40
40
|
var children = _ref.children,
|
|
41
|
+
_ref$responsive = _ref.responsive,
|
|
42
|
+
responsive = _ref$responsive === void 0 ? ['xs', 's'] : _ref$responsive,
|
|
41
43
|
_ref$restrictWidth = _ref.restrictWidth,
|
|
42
44
|
restrictWidth = _ref$restrictWidth === void 0 ? true : _ref$restrictWidth,
|
|
43
45
|
_ref$paddingSize = _ref.paddingSize,
|
|
@@ -48,12 +50,11 @@ export var _EuiPageTemplate = function _EuiPageTemplate(_ref) {
|
|
|
48
50
|
_offset = _ref.offset,
|
|
49
51
|
panelled = _ref.panelled,
|
|
50
52
|
contentBorder = _ref.contentBorder,
|
|
53
|
+
component = _ref.component,
|
|
51
54
|
mainProps = _ref.mainProps,
|
|
52
55
|
className = _ref.className,
|
|
53
56
|
_ref$minHeight = _ref.minHeight,
|
|
54
57
|
minHeight = _ref$minHeight === void 0 ? '460px' : _ref$minHeight,
|
|
55
|
-
_ref$responsive = _ref.responsive,
|
|
56
|
-
responsive = _ref$responsive === void 0 ? ['xs', 's'] : _ref$responsive,
|
|
57
58
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
58
59
|
|
|
59
60
|
var _useEuiTheme = useEuiTheme(),
|
|
@@ -161,6 +162,7 @@ export var _EuiPageTemplate = function _EuiPageTemplate(_ref) {
|
|
|
161
162
|
style: pageStyle,
|
|
162
163
|
className: classes
|
|
163
164
|
}), sidebar, ___EmotionJSX(EuiPageInner, _extends({}, mainProps, {
|
|
165
|
+
component: component,
|
|
164
166
|
id: pageInnerId,
|
|
165
167
|
border: innerBordered(),
|
|
166
168
|
panelled: innerPanelled(),
|
|
@@ -0,0 +1,73 @@
|
|
|
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 { EuiPopover } from './popover';
|
|
13
|
+
import { EuiButtonEmpty } from '../button';
|
|
14
|
+
import { EuiText } from '../text';
|
|
15
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
16
|
+
|
|
17
|
+
var Popover = function Popover() {
|
|
18
|
+
var _useState = useState(false),
|
|
19
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
20
|
+
isPopoverOpen = _useState2[0],
|
|
21
|
+
setIsPopoverOpen = _useState2[1];
|
|
22
|
+
|
|
23
|
+
var onButtonClick = function onButtonClick() {
|
|
24
|
+
return setIsPopoverOpen(function (isPopoverOpen) {
|
|
25
|
+
return !isPopoverOpen;
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
var closePopover = function closePopover() {
|
|
30
|
+
return setIsPopoverOpen(false);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
var button = ___EmotionJSX(EuiButtonEmpty, {
|
|
34
|
+
iconType: "documentation",
|
|
35
|
+
iconSide: "right",
|
|
36
|
+
onClick: onButtonClick
|
|
37
|
+
}, "How it works");
|
|
38
|
+
|
|
39
|
+
var popoverProps = {
|
|
40
|
+
button: button,
|
|
41
|
+
isOpen: isPopoverOpen,
|
|
42
|
+
closePopover: closePopover
|
|
43
|
+
};
|
|
44
|
+
return ___EmotionJSX(EuiPopover, popoverProps, ___EmotionJSX(EuiText, {
|
|
45
|
+
style: {
|
|
46
|
+
width: 300
|
|
47
|
+
}
|
|
48
|
+
}, ___EmotionJSX("p", null, "Popover content that\u2019s wider than the default width")));
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
beforeEach(function () {
|
|
52
|
+
cy.mount(___EmotionJSX(Popover, null));
|
|
53
|
+
cy.get('div.euiPopover__panel').should('not.exist');
|
|
54
|
+
});
|
|
55
|
+
describe('EuiPopover', function () {
|
|
56
|
+
describe('Automated accessibility check', function () {
|
|
57
|
+
it('has zero violations on render', function () {
|
|
58
|
+
cy.checkAxe();
|
|
59
|
+
});
|
|
60
|
+
it('has zero violations when popover is opened', function () {
|
|
61
|
+
cy.get('button.euiButtonEmpty').click();
|
|
62
|
+
cy.get('div.euiPopover__panel').should('exist');
|
|
63
|
+
cy.checkAxe();
|
|
64
|
+
});
|
|
65
|
+
it('has zero violations when popover is closed', function () {
|
|
66
|
+
cy.get('button.euiButtonEmpty').click();
|
|
67
|
+
cy.get('div.euiPopover__panel').should('exist');
|
|
68
|
+
cy.get('button.euiButtonEmpty').click();
|
|
69
|
+
cy.get('div.euiPopover__panel').should('not.exist');
|
|
70
|
+
cy.checkAxe();
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
});
|
|
@@ -3500,7 +3500,8 @@ var printValue = function printValue(value, options) {
|
|
|
3500
3500
|
return value.toString();
|
|
3501
3501
|
}
|
|
3502
3502
|
|
|
3503
|
-
if (value.length === 0 || value.match(
|
|
3503
|
+
if (value.length === 0 || value.match(/[^\w\-_*:()"/\\]/) || // Escape spaces and special characters not used as syntax identifiers
|
|
3504
|
+
value.toLowerCase() === 'or') {
|
|
3504
3505
|
return "\"".concat(escapePhraseValue(value), "\"");
|
|
3505
3506
|
}
|
|
3506
3507
|
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
9
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
10
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
11
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
12
|
+
* Side Public License, v 1.
|
|
13
|
+
*/
|
|
14
|
+
/// <reference types="../../../cypress/support"/>
|
|
15
|
+
import React from 'react';
|
|
16
|
+
import { EuiTabbedContent } from './tabbed_content';
|
|
17
|
+
import { EuiSpacer } from '../spacer';
|
|
18
|
+
import { EuiText } from '../text';
|
|
19
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
20
|
+
var tabs = [{
|
|
21
|
+
id: 'cobalt--id',
|
|
22
|
+
name: 'Cobalt',
|
|
23
|
+
content: ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiSpacer, null), ___EmotionJSX(EuiText, null, ___EmotionJSX("p", null, "Cobalt is a chemical element with symbol Co and atomic number 27. Like nickel, cobalt is found in the Earth\u2019s crust only in chemically combined form, save for small deposits found in alloys of natural meteoric iron. The free element, produced by reductive smelting, is a hard, lustrous, silver-gray metal.")))
|
|
24
|
+
}, {
|
|
25
|
+
id: 'dextrose--id',
|
|
26
|
+
name: 'Dextrose',
|
|
27
|
+
content: ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiSpacer, null), ___EmotionJSX(EuiText, null, ___EmotionJSX("p", null, "Intravenous sugar solution, also known as dextrose solution, is a mixture of dextrose (glucose) and water. It is used to treat low blood sugar or water loss without electrolyte loss.")))
|
|
28
|
+
}, {
|
|
29
|
+
id: 'hydrogen--id',
|
|
30
|
+
name: 'Hydrogen',
|
|
31
|
+
content: ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiSpacer, null), ___EmotionJSX(EuiText, null, ___EmotionJSX("p", null, "Hydrogen is a chemical element with symbol H and atomic number 1. With a standard atomic weight of 1.008, hydrogen is the lightest element on the periodic table")))
|
|
32
|
+
}, {
|
|
33
|
+
id: 'monosodium_glutammate--id',
|
|
34
|
+
name: 'Monosodium Glutamate',
|
|
35
|
+
content: ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiSpacer, null), ___EmotionJSX(EuiText, null, ___EmotionJSX("p", null, "Monosodium glutamate (MSG, also known as sodium glutamate) is the sodium salt of glutamic acid, one of the most abundant naturally occurring non-essential amino acids. Monosodium glutamate is found naturally in tomatoes, cheese and other foods.")))
|
|
36
|
+
}];
|
|
37
|
+
var defaultTabProps = {
|
|
38
|
+
tabs: tabs,
|
|
39
|
+
initialSelectedTab: tabs[0],
|
|
40
|
+
autoFocus: 'selected',
|
|
41
|
+
onTabClick: function onTabClick() {}
|
|
42
|
+
};
|
|
43
|
+
describe('EuiTabs', function () {
|
|
44
|
+
describe('Automated accessibility check', function () {
|
|
45
|
+
it('has zero violations with default props', function () {
|
|
46
|
+
cy.mount(___EmotionJSX(EuiTabbedContent, defaultTabProps));
|
|
47
|
+
cy.get('div.euiTabs').should('exist');
|
|
48
|
+
cy.checkAxe();
|
|
49
|
+
});
|
|
50
|
+
it('has zero violations with second tab open on render', function () {
|
|
51
|
+
var secondSelectedTab = _objectSpread(_objectSpread({}, defaultTabProps), {}, {
|
|
52
|
+
initialSelectedTab: tabs[1]
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
cy.mount(___EmotionJSX(EuiTabbedContent, secondSelectedTab));
|
|
56
|
+
cy.get('div.euiTabs').should('exist');
|
|
57
|
+
cy.checkAxe();
|
|
58
|
+
});
|
|
59
|
+
it('has zero violations with third tab open on render', function () {
|
|
60
|
+
var thirdSelectedTab = _objectSpread(_objectSpread({}, defaultTabProps), {}, {
|
|
61
|
+
initialSelectedTab: tabs[2]
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
cy.mount(___EmotionJSX(EuiTabbedContent, thirdSelectedTab));
|
|
65
|
+
cy.get('div.euiTabs').should('exist');
|
|
66
|
+
cy.checkAxe();
|
|
67
|
+
});
|
|
68
|
+
it('has zero violations with last tab open on render', function () {
|
|
69
|
+
var lastSelectedTab = _objectSpread(_objectSpread({}, defaultTabProps), {}, {
|
|
70
|
+
initialSelectedTab: tabs[3]
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
cy.mount(___EmotionJSX(EuiTabbedContent, lastSelectedTab));
|
|
74
|
+
cy.get('div.euiTabs').should('exist');
|
|
75
|
+
cy.checkAxe();
|
|
76
|
+
});
|
|
77
|
+
it('has zero violations with all tabs disabled except first', function () {
|
|
78
|
+
var disabledTabs = tabs.map(function (tab, i) {
|
|
79
|
+
if (i === 0) {
|
|
80
|
+
return tab;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return _objectSpread(_objectSpread({}, tab), {}, {
|
|
84
|
+
disabled: true
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
var disabledTabProps = _objectSpread(_objectSpread({}, defaultTabProps), {}, {
|
|
89
|
+
tabs: disabledTabs
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
cy.mount(___EmotionJSX(EuiTabbedContent, disabledTabProps));
|
|
93
|
+
cy.get('div.euiTabs').should('exist');
|
|
94
|
+
cy.checkAxe();
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
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 { EuiTreeView } from './tree_view';
|
|
11
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
12
|
+
|
|
13
|
+
var TreeView = function TreeView() {
|
|
14
|
+
var items = [{
|
|
15
|
+
label: 'Item One',
|
|
16
|
+
id: 'item_one',
|
|
17
|
+
isExpanded: true,
|
|
18
|
+
children: [{
|
|
19
|
+
label: 'Item A',
|
|
20
|
+
id: 'item_a'
|
|
21
|
+
}, {
|
|
22
|
+
label: 'Item B',
|
|
23
|
+
id: 'item_b',
|
|
24
|
+
children: [{
|
|
25
|
+
label: 'A Cloud',
|
|
26
|
+
id: 'item_cloud'
|
|
27
|
+
}, {
|
|
28
|
+
label: "I'm a Bug",
|
|
29
|
+
id: 'item_bug',
|
|
30
|
+
className: 'classForBug'
|
|
31
|
+
}]
|
|
32
|
+
}, {
|
|
33
|
+
label: 'Item C',
|
|
34
|
+
id: 'item_c',
|
|
35
|
+
children: [{
|
|
36
|
+
label: 'Another Cloud',
|
|
37
|
+
id: 'item_cloud2'
|
|
38
|
+
}, {
|
|
39
|
+
label: 'Another Bug',
|
|
40
|
+
id: 'item_bug2'
|
|
41
|
+
}]
|
|
42
|
+
}]
|
|
43
|
+
}, {
|
|
44
|
+
label: 'Item Two',
|
|
45
|
+
id: 'item_two'
|
|
46
|
+
}];
|
|
47
|
+
var defaultTreeViewProps = {
|
|
48
|
+
items: items,
|
|
49
|
+
'aria-label': 'Sample folder tree'
|
|
50
|
+
};
|
|
51
|
+
return ___EmotionJSX("div", {
|
|
52
|
+
style: {
|
|
53
|
+
width: '20rem'
|
|
54
|
+
}
|
|
55
|
+
}, ___EmotionJSX(EuiTreeView, defaultTreeViewProps));
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
describe('EuiTreeView', function () {
|
|
59
|
+
describe('Automated accessibility check', function () {
|
|
60
|
+
it('has zero violations on first render', function () {
|
|
61
|
+
cy.mount(___EmotionJSX(TreeView, null));
|
|
62
|
+
cy.get('div.euiTreeView__wrapper').should('exist');
|
|
63
|
+
cy.checkAxe();
|
|
64
|
+
});
|
|
65
|
+
it('has zero violations with a nested child expanded', function () {
|
|
66
|
+
cy.mount(___EmotionJSX(TreeView, null));
|
|
67
|
+
cy.get('div.euiTreeView__wrapper').should('exist');
|
|
68
|
+
cy.get('button#item_b').realClick();
|
|
69
|
+
cy.get('button#item_b').should('have.attr', 'aria-expanded', 'true');
|
|
70
|
+
cy.get('li.euiTreeView__node').contains('A Cloud').should('exist');
|
|
71
|
+
cy.checkAxe();
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
2
|
|
|
3
|
-
var _templateObject;
|
|
3
|
+
var _templateObject, _templateObject2;
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
6
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
@@ -10,4 +10,7 @@ var _templateObject;
|
|
|
10
10
|
* Side Public License, v 1.
|
|
11
11
|
*/
|
|
12
12
|
import { keyframes } from '@emotion/react';
|
|
13
|
-
export var euiAnimFadeIn = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 0% {\n opacity: 0;\n }\n\n 100% {\n opacity: 1;\n }\n"])));
|
|
13
|
+
export var euiAnimFadeIn = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 0% {\n opacity: 0;\n }\n\n 100% {\n opacity: 1;\n }\n"])));
|
|
14
|
+
export var euiAnimSlideInUp = function euiAnimSlideInUp(size) {
|
|
15
|
+
return keyframes(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n 0% {\n opacity: 0;\n transform: translateY(", ");\n }\n\n 100% {\n opacity: 1;\n transform: translateY(0);\n }\n"])), size);
|
|
16
|
+
};
|
|
@@ -78,15 +78,16 @@ var EuiSkipLink = function EuiSkipLink(_ref) {
|
|
|
78
78
|
|
|
79
79
|
setHasValidId(false); // If no valid element via ID is available, use the fallback query selectors
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
if (fallbackDestination) {
|
|
82
|
+
var fallbackEl = document.querySelector(fallbackDestination);
|
|
82
83
|
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
if (fallbackEl) {
|
|
85
|
+
setDestinationEl(fallbackEl);
|
|
86
|
+
}
|
|
85
87
|
}
|
|
86
88
|
}, [destinationId, fallbackDestination]);
|
|
87
89
|
var onClick = (0, _react.useCallback)(function (e) {
|
|
88
|
-
if (overrideLinkBehavior || !hasValidId) {
|
|
89
|
-
if (!destinationEl) return;
|
|
90
|
+
if ((overrideLinkBehavior || !hasValidId) && destinationEl) {
|
|
90
91
|
e.preventDefault(); // Scroll to the top of the destination content only if it's ~mostly out of view
|
|
91
92
|
|
|
92
93
|
var destinationY = destinationEl.getBoundingClientRect().top;
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.SIZES = exports.EuiBetaBadge = exports.COLORS = void 0;
|
|
8
|
+
exports.SIZES = exports.EuiBetaBadge = exports.COLORS = exports.ALIGNMENTS = void 0;
|
|
9
9
|
|
|
10
10
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
11
|
|
|
@@ -27,11 +27,13 @@ var _beta_badge = require("./beta_badge.styles");
|
|
|
27
27
|
|
|
28
28
|
var _react2 = require("@emotion/react");
|
|
29
29
|
|
|
30
|
-
var _excluded = ["className", "label", "color", "tooltipContent", "tooltipPosition", "anchorProps", "title", "iconType", "onClick", "onClickAriaLabel", "href", "rel", "target", "size"];
|
|
30
|
+
var _excluded = ["className", "label", "color", "tooltipContent", "tooltipPosition", "anchorProps", "title", "iconType", "onClick", "onClickAriaLabel", "href", "rel", "target", "size", "alignment"];
|
|
31
31
|
var COLORS = ['accent', 'subdued', 'hollow'];
|
|
32
32
|
exports.COLORS = COLORS;
|
|
33
33
|
var SIZES = ['s', 'm'];
|
|
34
34
|
exports.SIZES = SIZES;
|
|
35
|
+
var ALIGNMENTS = ['baseline', 'middle'];
|
|
36
|
+
exports.ALIGNMENTS = ALIGNMENTS;
|
|
35
37
|
|
|
36
38
|
var EuiBetaBadge = function EuiBetaBadge(_ref) {
|
|
37
39
|
var className = _ref.className,
|
|
@@ -51,13 +53,15 @@ var EuiBetaBadge = function EuiBetaBadge(_ref) {
|
|
|
51
53
|
target = _ref.target,
|
|
52
54
|
_ref$size = _ref.size,
|
|
53
55
|
size = _ref$size === void 0 ? 'm' : _ref$size,
|
|
56
|
+
_ref$alignment = _ref.alignment,
|
|
57
|
+
alignment = _ref$alignment === void 0 ? 'baseline' : _ref$alignment,
|
|
54
58
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
55
59
|
var euiTheme = (0, _services.useEuiTheme)();
|
|
56
60
|
var singleLetter = !!(typeof label === 'string' && label.length === 1);
|
|
57
61
|
var isCircular = iconType || singleLetter;
|
|
58
62
|
var classes = (0, _classnames.default)('euiBetaBadge', className);
|
|
59
63
|
var styles = (0, _beta_badge.euiBetaBadgeStyles)(euiTheme);
|
|
60
|
-
var cssStyles = [styles.euiBetaBadge, styles[color], styles[size], isCircular ? styles.badgeSizes.circle[size] : styles.badgeSizes.default[size]];
|
|
64
|
+
var cssStyles = [styles.euiBetaBadge, styles[color], styles[size], styles[alignment], isCircular ? styles.badgeSizes.circle[size] : styles.badgeSizes.default[size]];
|
|
61
65
|
var icon;
|
|
62
66
|
|
|
63
67
|
if (iconType) {
|
|
@@ -18,6 +18,24 @@ var _services = require("../../../services");
|
|
|
18
18
|
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
19
19
|
|
|
20
20
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
21
|
+
name: "l1nme7-middle",
|
|
22
|
+
styles: "vertical-align:middle;label:middle;"
|
|
23
|
+
} : {
|
|
24
|
+
name: "l1nme7-middle",
|
|
25
|
+
styles: "vertical-align:middle;label:middle;",
|
|
26
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
30
|
+
name: "19hexhy-baseline",
|
|
31
|
+
styles: "vertical-align:baseline;label:baseline;"
|
|
32
|
+
} : {
|
|
33
|
+
name: "19hexhy-baseline",
|
|
34
|
+
styles: "vertical-align:baseline;label:baseline;",
|
|
35
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
var _ref3 = process.env.NODE_ENV === "production" ? {
|
|
21
39
|
name: "pzpqqg-euiBetaBadge__icon",
|
|
22
40
|
styles: "position:relative;transform:translate(0, -1px);label:euiBetaBadge__icon;"
|
|
23
41
|
} : {
|
|
@@ -30,7 +48,7 @@ var euiBetaBadgeStyles = function euiBetaBadgeStyles(euiThemeContext) {
|
|
|
30
48
|
var euiTheme = euiThemeContext.euiTheme,
|
|
31
49
|
colorMode = euiThemeContext.colorMode;
|
|
32
50
|
return {
|
|
33
|
-
euiBetaBadge: /*#__PURE__*/(0, _react.css)("display:inline-block;
|
|
51
|
+
euiBetaBadge: /*#__PURE__*/(0, _react.css)("display:inline-block;border-radius:", euiTheme.size.l, ";cursor:default;font-weight:", euiTheme.font.weight.bold, ";text-transform:uppercase;letter-spacing:0.05em;text-align:center;", (0, _global_styling.euiTextTruncate)(), " &:focus{", (0, _global_styling.euiFocusRing)(euiThemeContext, 'outset', {
|
|
34
52
|
color: colorMode === 'DARK' ? euiTheme.colors.ghost : euiTheme.colors.ink
|
|
35
53
|
}), ";};label:euiBetaBadge;"),
|
|
36
54
|
// Colors
|
|
@@ -56,15 +74,18 @@ var euiBetaBadgeStyles = function euiBetaBadgeStyles(euiThemeContext) {
|
|
|
56
74
|
})), "\n ")
|
|
57
75
|
}
|
|
58
76
|
},
|
|
59
|
-
euiBetaBadge__icon:
|
|
77
|
+
euiBetaBadge__icon: _ref3,
|
|
78
|
+
// Alignments
|
|
79
|
+
baseline: _ref2,
|
|
80
|
+
middle: _ref
|
|
60
81
|
};
|
|
61
82
|
}; // Util for detecting text color based on badge bg color
|
|
62
83
|
|
|
63
84
|
|
|
64
85
|
exports.euiBetaBadgeStyles = euiBetaBadgeStyles;
|
|
65
86
|
|
|
66
|
-
var getBadgeColors = function getBadgeColors(backgroundColor,
|
|
67
|
-
var euiTheme =
|
|
87
|
+
var getBadgeColors = function getBadgeColors(backgroundColor, _ref4) {
|
|
88
|
+
var euiTheme = _ref4.euiTheme;
|
|
68
89
|
var textColor = _services.isColorDark.apply(void 0, (0, _toConsumableArray2.default)((0, _services.hexToRgb)(backgroundColor))) ? euiTheme.colors.ghost : euiTheme.colors.ink;
|
|
69
90
|
return "\n background-color: ".concat(backgroundColor, ";\n color: ").concat(textColor, ";\n ");
|
|
70
91
|
};
|
|
@@ -58,11 +58,11 @@ var _ref5 = process.env.NODE_ENV === "production" ? {
|
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
var _ref6 = process.env.NODE_ENV === "production" ? {
|
|
61
|
-
name: "
|
|
62
|
-
styles: "display:flex;label:euiCard__main;"
|
|
61
|
+
name: "31kq8f-euiCard__main",
|
|
62
|
+
styles: "display:flex;inline-size:100%;label:euiCard__main;"
|
|
63
63
|
} : {
|
|
64
|
-
name: "
|
|
65
|
-
styles: "display:flex;label:euiCard__main;",
|
|
64
|
+
name: "31kq8f-euiCard__main",
|
|
65
|
+
styles: "display:flex;inline-size:100%;label:euiCard__main;",
|
|
66
66
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
67
67
|
};
|
|
68
68
|
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
8
|
+
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
+
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
|
|
13
|
+
var _super_date_picker = require("./super_date_picker");
|
|
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 SuperDatePicker = function SuperDatePicker() {
|
|
30
|
+
var _useState = (0, _react.useState)(false),
|
|
31
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
32
|
+
isLoading = _useState2[0],
|
|
33
|
+
setIsLoading = _useState2[1];
|
|
34
|
+
|
|
35
|
+
var _useState3 = (0, _react.useState)(true),
|
|
36
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 1),
|
|
37
|
+
showUpdateButton = _useState4[0];
|
|
38
|
+
|
|
39
|
+
var _useState5 = (0, _react.useState)('now-30m'),
|
|
40
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
41
|
+
start = _useState6[0],
|
|
42
|
+
setStart = _useState6[1];
|
|
43
|
+
|
|
44
|
+
var _useState7 = (0, _react.useState)('now'),
|
|
45
|
+
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
46
|
+
end = _useState8[0],
|
|
47
|
+
setEnd = _useState8[1];
|
|
48
|
+
|
|
49
|
+
var _useState9 = (0, _react.useState)(true),
|
|
50
|
+
_useState10 = (0, _slicedToArray2.default)(_useState9, 1),
|
|
51
|
+
showFill = _useState10[0];
|
|
52
|
+
|
|
53
|
+
var onTimeChange = function onTimeChange(_ref) {
|
|
54
|
+
var start = _ref.start,
|
|
55
|
+
end = _ref.end;
|
|
56
|
+
setStart(start);
|
|
57
|
+
setEnd(end);
|
|
58
|
+
setIsLoading(true);
|
|
59
|
+
startLoading();
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
var startLoading = function startLoading() {
|
|
63
|
+
setTimeout(stopLoading, 1000);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
var stopLoading = function stopLoading() {
|
|
67
|
+
setIsLoading(false);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
var datepickerProps = {
|
|
71
|
+
isLoading: isLoading,
|
|
72
|
+
start: start,
|
|
73
|
+
end: end,
|
|
74
|
+
onTimeChange: onTimeChange,
|
|
75
|
+
showUpdateButton: showUpdateButton
|
|
76
|
+
};
|
|
77
|
+
return (0, _react2.jsx)(_super_date_picker.EuiSuperDatePicker, (0, _extends2.default)({}, datepickerProps, {
|
|
78
|
+
updateButtonProps: {
|
|
79
|
+
fill: showFill
|
|
80
|
+
}
|
|
81
|
+
}));
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
beforeEach(function () {
|
|
85
|
+
cy.mount((0, _react2.jsx)(SuperDatePicker, null));
|
|
86
|
+
cy.get('div.euiSuperDatePicker__flexWrapper').should('exist');
|
|
87
|
+
});
|
|
88
|
+
describe('EuiSuperDatePicker', function () {
|
|
89
|
+
describe('Automated accessibility check', function () {
|
|
90
|
+
it('has zero violations on render', function () {
|
|
91
|
+
cy.checkAxe();
|
|
92
|
+
});
|
|
93
|
+
it('has zero violations when quick select menu is open', function () {
|
|
94
|
+
cy.get('button.euiFormControlLayout__prepend').click();
|
|
95
|
+
cy.get('div.euiPanel').contains('Quick select').should('exist');
|
|
96
|
+
cy.checkAxe();
|
|
97
|
+
});
|
|
98
|
+
it('has zero violations when start / end date menus are open', function () {
|
|
99
|
+
cy.get('button.euiSuperDatePicker__prettyFormat').click();
|
|
100
|
+
cy.get('div.euiDatePopoverContent').should('exist');
|
|
101
|
+
cy.checkAxe();
|
|
102
|
+
cy.get('button.euiDatePopoverButton--start').click();
|
|
103
|
+
cy.get('button.euiDatePopoverButton--end').click();
|
|
104
|
+
cy.get('div.euiDatePopoverContent').should('exist');
|
|
105
|
+
cy.checkAxe();
|
|
106
|
+
cy.get('button.euiDatePopoverButton--end').click();
|
|
107
|
+
cy.get('div.euiDatePopoverContent').should('not.exist');
|
|
108
|
+
cy.checkAxe();
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
8
|
+
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
+
|
|
11
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
12
|
+
|
|
13
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
14
|
+
|
|
15
|
+
var _flyout = require("./flyout");
|
|
16
|
+
|
|
17
|
+
var _button = require("../button");
|
|
18
|
+
|
|
19
|
+
var _react2 = require("@emotion/react");
|
|
20
|
+
|
|
21
|
+
var _excluded = ["children"];
|
|
22
|
+
|
|
23
|
+
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); }
|
|
24
|
+
|
|
25
|
+
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; }
|
|
26
|
+
|
|
27
|
+
var childrenDefault = (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)("button", {
|
|
28
|
+
"data-test-subj": "itemA"
|
|
29
|
+
}, "Item A"), (0, _react2.jsx)("button", {
|
|
30
|
+
"data-test-subj": "itemB"
|
|
31
|
+
}, "Item B"), (0, _react2.jsx)("button", {
|
|
32
|
+
"data-test-subj": "itemC"
|
|
33
|
+
}, "Item C"), (0, _react2.jsx)("input", {
|
|
34
|
+
"data-test-subj": "itemD"
|
|
35
|
+
}));
|
|
36
|
+
|
|
37
|
+
var Flyout = function Flyout(_ref) {
|
|
38
|
+
var _ref$children = _ref.children,
|
|
39
|
+
children = _ref$children === void 0 ? childrenDefault : _ref$children,
|
|
40
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
41
|
+
|
|
42
|
+
var _useState = (0, _react.useState)(false),
|
|
43
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
44
|
+
isOpen = _useState2[0],
|
|
45
|
+
setIsOpen = _useState2[1];
|
|
46
|
+
|
|
47
|
+
var onButtonClick = function onButtonClick() {
|
|
48
|
+
return setIsOpen(!isOpen);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
var button = (0, _react2.jsx)(_button.EuiButtonEmpty, {
|
|
52
|
+
onClick: onButtonClick
|
|
53
|
+
}, "Toggle flyout");
|
|
54
|
+
return (0, _react2.jsx)("div", null, button, isOpen ? (0, _react2.jsx)(_flyout.EuiFlyout, (0, _extends2.default)({
|
|
55
|
+
"data-test-subj": "flyoutSpec",
|
|
56
|
+
onClose: function onClose() {
|
|
57
|
+
return setIsOpen(false);
|
|
58
|
+
}
|
|
59
|
+
}, rest), children) : null);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
beforeEach(function () {
|
|
63
|
+
cy.mount((0, _react2.jsx)(Flyout, null));
|
|
64
|
+
cy.get('div.euiFlyout').should('not.exist');
|
|
65
|
+
});
|
|
66
|
+
describe('EuiFlyout', function () {
|
|
67
|
+
describe('Automated accessibility check', function () {
|
|
68
|
+
it('has zero violations on render', function () {
|
|
69
|
+
cy.checkAxe();
|
|
70
|
+
});
|
|
71
|
+
it('has zero violations when flyout is opened', function () {
|
|
72
|
+
cy.get('button.euiButtonEmpty').click();
|
|
73
|
+
cy.get('div.euiFlyout').should('exist');
|
|
74
|
+
cy.checkAxe();
|
|
75
|
+
});
|
|
76
|
+
it('has zero violations when flyout is closed', function () {
|
|
77
|
+
cy.get('button.euiButtonEmpty').click();
|
|
78
|
+
cy.get('div.euiFlyout').should('exist');
|
|
79
|
+
cy.get('button.euiFlyout__closeButton').click();
|
|
80
|
+
cy.get('div.euiFlyout').should('not.exist');
|
|
81
|
+
cy.checkAxe();
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
});
|