@elastic/eui 70.2.3 → 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.
Files changed (143) hide show
  1. package/dist/eui_theme_dark.css +0 -198
  2. package/dist/eui_theme_dark.min.css +1 -1
  3. package/dist/eui_theme_light.css +0 -198
  4. package/dist/eui_theme_light.min.css +1 -1
  5. package/es/components/accessibility/skip_link/skip_link.js +6 -5
  6. package/es/components/badge/beta_badge/beta_badge.js +11 -3
  7. package/es/components/badge/beta_badge/beta_badge.styles.js +25 -4
  8. package/es/components/card/card.js +6 -1
  9. package/es/components/card/card.styles.js +4 -4
  10. package/es/components/date_picker/super_date_picker/super_date_picker.a11y.js +109 -0
  11. package/es/components/flex/flex_group.styles.js +1 -1
  12. package/es/components/flyout/flyout.a11y.js +92 -0
  13. package/es/components/image/image_fullscreen_wrapper.styles.js +3 -11
  14. package/es/components/modal/confirm_modal.js +11 -0
  15. package/es/components/modal/modal.a11y.js +70 -0
  16. package/es/components/modal/modal.js +17 -27
  17. package/es/components/modal/modal.styles.js +23 -0
  18. package/es/components/modal/modal_body.js +8 -0
  19. package/es/components/modal/modal_body.styles.js +16 -0
  20. package/es/components/modal/modal_footer.js +6 -0
  21. package/es/components/modal/modal_footer.styles.js +15 -0
  22. package/es/components/modal/modal_header.js +6 -0
  23. package/es/components/modal/modal_header.styles.js +14 -0
  24. package/es/components/modal/modal_header_title.js +3 -1
  25. package/es/components/page_template/outer/page_outer.js +1 -1
  26. package/es/components/page_template/page_template.js +28 -6
  27. package/es/components/popover/popover.a11y.js +83 -0
  28. package/es/components/search_bar/query/default_syntax.js +2 -1
  29. package/es/components/tabs/tabs.a11y.js +97 -0
  30. package/es/components/tree_view/tree_view.a11y.js +74 -0
  31. package/es/global_styling/utility/animations.js +5 -2
  32. package/eui.d.ts +58 -7
  33. package/i18ntokens.json +2 -2
  34. package/lib/components/accessibility/skip_link/skip_link.js +6 -5
  35. package/lib/components/badge/beta_badge/beta_badge.js +13 -4
  36. package/lib/components/badge/beta_badge/beta_badge.styles.js +25 -4
  37. package/lib/components/card/card.js +6 -1
  38. package/lib/components/card/card.styles.js +4 -4
  39. package/lib/components/date_picker/super_date_picker/super_date_picker.a11y.js +111 -0
  40. package/lib/components/flex/flex_group.styles.js +1 -1
  41. package/lib/components/flyout/flyout.a11y.js +94 -0
  42. package/lib/components/image/image_fullscreen_wrapper.styles.js +9 -10
  43. package/lib/components/modal/confirm_modal.js +13 -0
  44. package/lib/components/modal/modal.a11y.js +73 -0
  45. package/lib/components/modal/modal.js +17 -32
  46. package/lib/components/modal/modal.styles.js +36 -0
  47. package/lib/components/modal/modal_body.js +10 -0
  48. package/lib/components/modal/modal_body.styles.js +27 -0
  49. package/lib/components/modal/modal_footer.js +8 -0
  50. package/lib/components/modal/modal_footer.styles.js +26 -0
  51. package/lib/components/modal/modal_header.js +8 -0
  52. package/lib/components/modal/modal_header.styles.js +24 -0
  53. package/lib/components/modal/modal_header_title.js +4 -1
  54. package/lib/components/page_template/outer/page_outer.js +1 -1
  55. package/lib/components/page_template/page_template.js +32 -10
  56. package/lib/components/popover/popover.a11y.js +86 -0
  57. package/lib/components/search_bar/query/default_syntax.js +2 -1
  58. package/lib/components/tabs/tabs.a11y.js +98 -0
  59. package/lib/components/tree_view/tree_view.a11y.js +80 -0
  60. package/lib/global_styling/utility/animations.js +9 -3
  61. package/optimize/es/components/accessibility/skip_link/skip_link.js +6 -5
  62. package/optimize/es/components/badge/beta_badge/beta_badge.js +5 -2
  63. package/optimize/es/components/badge/beta_badge/beta_badge.styles.js +25 -4
  64. package/optimize/es/components/card/card.styles.js +4 -4
  65. package/optimize/es/components/date_picker/super_date_picker/super_date_picker.a11y.js +98 -0
  66. package/optimize/es/components/flex/flex_group.styles.js +1 -1
  67. package/optimize/es/components/flyout/flyout.a11y.js +77 -0
  68. package/optimize/es/components/image/image_fullscreen_wrapper.styles.js +3 -11
  69. package/optimize/es/components/modal/confirm_modal.js +6 -0
  70. package/optimize/es/components/modal/modal.a11y.js +60 -0
  71. package/optimize/es/components/modal/modal.js +17 -27
  72. package/optimize/es/components/modal/modal.styles.js +23 -0
  73. package/optimize/es/components/modal/modal_body.js +8 -0
  74. package/optimize/es/components/modal/modal_body.styles.js +16 -0
  75. package/optimize/es/components/modal/modal_footer.js +6 -0
  76. package/optimize/es/components/modal/modal_footer.styles.js +15 -0
  77. package/optimize/es/components/modal/modal_header.js +6 -0
  78. package/optimize/es/components/modal/modal_header.styles.js +14 -0
  79. package/optimize/es/components/modal/modal_header_title.js +3 -1
  80. package/optimize/es/components/page_template/page_template.js +5 -3
  81. package/optimize/es/components/popover/popover.a11y.js +73 -0
  82. package/optimize/es/components/search_bar/query/default_syntax.js +2 -1
  83. package/optimize/es/components/tabs/tabs.a11y.js +97 -0
  84. package/optimize/es/components/tree_view/tree_view.a11y.js +74 -0
  85. package/optimize/es/global_styling/utility/animations.js +5 -2
  86. package/optimize/lib/components/accessibility/skip_link/skip_link.js +6 -5
  87. package/optimize/lib/components/badge/beta_badge/beta_badge.js +7 -3
  88. package/optimize/lib/components/badge/beta_badge/beta_badge.styles.js +25 -4
  89. package/optimize/lib/components/card/card.styles.js +4 -4
  90. package/optimize/lib/components/date_picker/super_date_picker/super_date_picker.a11y.js +111 -0
  91. package/optimize/lib/components/flex/flex_group.styles.js +1 -1
  92. package/optimize/lib/components/flyout/flyout.a11y.js +84 -0
  93. package/optimize/lib/components/image/image_fullscreen_wrapper.styles.js +9 -12
  94. package/optimize/lib/components/modal/confirm_modal.js +8 -0
  95. package/optimize/lib/components/modal/modal.a11y.js +73 -0
  96. package/optimize/lib/components/modal/modal.js +17 -31
  97. package/optimize/lib/components/modal/modal.styles.js +36 -0
  98. package/optimize/lib/components/modal/modal_body.js +10 -0
  99. package/optimize/lib/components/modal/modal_body.styles.js +27 -0
  100. package/optimize/lib/components/modal/modal_footer.js +8 -0
  101. package/optimize/lib/components/modal/modal_footer.styles.js +26 -0
  102. package/optimize/lib/components/modal/modal_header.js +8 -0
  103. package/optimize/lib/components/modal/modal_header.styles.js +24 -0
  104. package/optimize/lib/components/modal/modal_header_title.js +4 -1
  105. package/optimize/lib/components/page_template/page_template.js +5 -3
  106. package/optimize/lib/components/popover/popover.a11y.js +86 -0
  107. package/optimize/lib/components/search_bar/query/default_syntax.js +2 -1
  108. package/optimize/lib/components/tabs/tabs.a11y.js +98 -0
  109. package/optimize/lib/components/tree_view/tree_view.a11y.js +80 -0
  110. package/optimize/lib/global_styling/utility/animations.js +9 -3
  111. package/package.json +5 -4
  112. package/src/components/index.scss +0 -1
  113. package/src/themes/amsterdam/overrides/_index.scss +0 -1
  114. package/test-env/components/accessibility/skip_link/skip_link.js +6 -5
  115. package/test-env/components/badge/beta_badge/beta_badge.js +13 -4
  116. package/test-env/components/badge/beta_badge/beta_badge.styles.js +25 -4
  117. package/test-env/components/card/card.js +6 -1
  118. package/test-env/components/card/card.styles.js +4 -4
  119. package/test-env/components/date_picker/super_date_picker/super_date_picker.a11y.js +111 -0
  120. package/test-env/components/flex/flex_group.styles.js +1 -1
  121. package/test-env/components/flyout/flyout.a11y.js +84 -0
  122. package/test-env/components/image/image_fullscreen_wrapper.styles.js +9 -12
  123. package/test-env/components/modal/confirm_modal.js +13 -0
  124. package/test-env/components/modal/modal.a11y.js +73 -0
  125. package/test-env/components/modal/modal.js +17 -31
  126. package/test-env/components/modal/modal.styles.js +36 -0
  127. package/test-env/components/modal/modal_body.js +10 -0
  128. package/test-env/components/modal/modal_body.styles.js +27 -0
  129. package/test-env/components/modal/modal_footer.js +8 -0
  130. package/test-env/components/modal/modal_footer.styles.js +26 -0
  131. package/test-env/components/modal/modal_header.js +8 -0
  132. package/test-env/components/modal/modal_header.styles.js +24 -0
  133. package/test-env/components/modal/modal_header_title.js +4 -1
  134. package/test-env/components/page_template/outer/page_outer.js +1 -1
  135. package/test-env/components/page_template/page_template.js +32 -10
  136. package/test-env/components/popover/popover.a11y.js +86 -0
  137. package/test-env/components/search_bar/query/default_syntax.js +2 -1
  138. package/test-env/components/tabs/tabs.a11y.js +98 -0
  139. package/test-env/components/tree_view/tree_view.a11y.js +80 -0
  140. package/test-env/global_styling/utility/animations.js +9 -3
  141. package/src/components/modal/_index.scss +0 -1
  142. package/src/components/modal/_modal.scss +0 -156
  143. package/src/themes/amsterdam/overrides/_modal.scss +0 -3
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.euiModalHeaderStyles = void 0;
7
+
8
+ var _react = require("@emotion/react");
9
+
10
+ /*
11
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
12
+ * or more contributor license agreements. Licensed under the Elastic License
13
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
14
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
15
+ * Side Public License, v 1.
16
+ */
17
+ var euiModalHeaderStyles = function euiModalHeaderStyles(euiThemeContext) {
18
+ var euiTheme = euiThemeContext.euiTheme;
19
+ return {
20
+ euiModalHeader: /*#__PURE__*/(0, _react.css)("display:flex;justify-content:space-between;align-items:center;padding-inline:", euiTheme.size.l, " ", euiTheme.size.xxl, ";padding-block:", euiTheme.size.l, " ", euiTheme.size.base, ";flex-grow:0;flex-shrink:0;&+.euiModalFooter{padding-block-start:", euiTheme.size.s, ";};label:euiModalHeader;")
21
+ };
22
+ };
23
+
24
+ exports.euiModalHeaderStyles = euiModalHeaderStyles;
@@ -17,6 +17,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
17
17
 
18
18
  var _classnames = _interopRequireDefault(require("classnames"));
19
19
 
20
+ var _title = require("../title");
21
+
20
22
  var _react2 = require("@emotion/react");
21
23
 
22
24
  var _excluded = ["className", "children"];
@@ -26,7 +28,8 @@ var EuiModalHeaderTitle = function EuiModalHeaderTitle(_ref) {
26
28
  children = _ref.children,
27
29
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
28
30
  var classes = (0, _classnames.default)('euiModalHeader__title', className);
29
- return (0, _react2.jsx)("div", (0, _extends2.default)({
31
+ return (0, _react2.jsx)(_title.EuiTitle, (0, _extends2.default)({
32
+ size: "m",
30
33
  className: classes
31
34
  }, rest), /*#__PURE__*/_react.default.isValidElement(children) ? children : (0, _react2.jsx)("h1", null, children));
32
35
  };
@@ -56,7 +56,7 @@ _EuiPageOuter.propTypes = {
56
56
  direction: _propTypes.default.oneOf(["row", "column"]),
57
57
 
58
58
  /**
59
- * When direction is `row`, it will flip to `column` when within these breakpoints
59
+ * When direction is `row`, it will flip to `column` when within these breakpoints.
60
60
  */
61
61
  responsive: _propTypes.default.arrayOf(_propTypes.default.any.isRequired),
62
62
  className: _propTypes.default.string,
@@ -39,7 +39,7 @@ var _global_styling = require("../../global_styling");
39
39
 
40
40
  var _react2 = require("@emotion/react");
41
41
 
42
- var _excluded = ["children", "restrictWidth", "paddingSize", "grow", "bottomBorder", "offset", "panelled", "contentBorder", "mainProps", "className", "minHeight", "responsive"];
42
+ var _excluded = ["children", "responsive", "restrictWidth", "paddingSize", "grow", "bottomBorder", "offset", "panelled", "contentBorder", "component", "mainProps", "className", "minHeight"];
43
43
 
44
44
  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); }
45
45
 
@@ -63,6 +63,8 @@ exports.TemplateContext = TemplateContext;
63
63
  */
64
64
  var _EuiPageTemplate = function _EuiPageTemplate(_ref) {
65
65
  var children = _ref.children,
66
+ _ref$responsive = _ref.responsive,
67
+ responsive = _ref$responsive === void 0 ? ['xs', 's'] : _ref$responsive,
66
68
  _ref$restrictWidth = _ref.restrictWidth,
67
69
  restrictWidth = _ref$restrictWidth === void 0 ? true : _ref$restrictWidth,
68
70
  _ref$paddingSize = _ref.paddingSize,
@@ -73,12 +75,11 @@ var _EuiPageTemplate = function _EuiPageTemplate(_ref) {
73
75
  _offset = _ref.offset,
74
76
  panelled = _ref.panelled,
75
77
  contentBorder = _ref.contentBorder,
78
+ component = _ref.component,
76
79
  mainProps = _ref.mainProps,
77
80
  className = _ref.className,
78
81
  _ref$minHeight = _ref.minHeight,
79
82
  minHeight = _ref$minHeight === void 0 ? '460px' : _ref$minHeight,
80
- _ref$responsive = _ref.responsive,
81
- responsive = _ref$responsive === void 0 ? ['xs', 's'] : _ref$responsive,
82
83
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
83
84
 
84
85
  var _useEuiTheme = (0, _services.useEuiTheme)(),
@@ -186,6 +187,7 @@ var _EuiPageTemplate = function _EuiPageTemplate(_ref) {
186
187
  style: pageStyle,
187
188
  className: classes
188
189
  }), sidebar, (0, _react2.jsx)(_inner._EuiPageInner, (0, _extends2.default)({}, mainProps, {
190
+ component: component,
189
191
  id: pageInnerId,
190
192
  border: innerBordered(),
191
193
  panelled: innerPanelled(),
@@ -208,13 +210,27 @@ _EuiPageTemplate.propTypes = {
208
210
  direction: _propTypes.default.oneOf(["row", "column"]),
209
211
 
210
212
  /**
211
- * When direction is `row`, it will flip to `column` when within these breakpoints
213
+ * Decides at which point the main content wrapper will be 100vw.
214
+ */
215
+
216
+ /**
217
+ * When direction is `row`, it will flip to `column` when within these breakpoints.
212
218
  */
213
219
  responsive: _propTypes.default.arrayOf(_propTypes.default.any.isRequired),
214
- className: _propTypes.default.string,
215
- "aria-label": _propTypes.default.string,
216
- "data-test-subj": _propTypes.default.string,
217
- css: _propTypes.default.any,
220
+ className: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.string]),
221
+ "aria-label": _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.string]),
222
+ "data-test-subj": _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.string]),
223
+ css: _propTypes.default.oneOfType([_propTypes.default.any, _propTypes.default.any]),
224
+
225
+ /**
226
+ * Adds a white background and shadow to define the area.
227
+ */
228
+ panelled: _propTypes.default.bool,
229
+
230
+ /**
231
+ * Adjust the overall padding.
232
+ */
233
+ paddingSize: _propTypes.default.any,
218
234
 
219
235
  /**
220
236
  * Sets the max-width of the page,
@@ -235,7 +251,7 @@ _EuiPageTemplate.propTypes = {
235
251
  * Applies a top or left border to the inner contents
236
252
  * to add separation between content and sidebar when a sidebar exists.
237
253
  */
238
- contentBorder: _propTypes.default.bool,
254
+ contentBorder: _propTypes.default.any,
239
255
 
240
256
  /**
241
257
  * Minimum height in which to enforce scrolling
@@ -257,7 +273,13 @@ _EuiPageTemplate.propTypes = {
257
273
  "aria-label": _propTypes.default.string,
258
274
  "data-test-subj": _propTypes.default.string,
259
275
  css: _propTypes.default.any
260
- })
276
+ }),
277
+
278
+ /**
279
+ * Sets which HTML element to render for the `main` content wrapper
280
+ * @default main
281
+ */
282
+ component: _propTypes.default.oneOfType([_propTypes.default.any.isRequired, _propTypes.default.elementType.isRequired])
261
283
  };
262
284
 
263
285
  var _EuiPageSection = function _EuiPageSection(props) {
@@ -0,0 +1,86 @@
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 _popover = require("./popover");
12
+
13
+ var _button = require("../button");
14
+
15
+ var _text = require("../text");
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 Popover = function Popover() {
32
+ var _useState = (0, _react.useState)(false),
33
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
34
+ isPopoverOpen = _useState2[0],
35
+ setIsPopoverOpen = _useState2[1];
36
+
37
+ var onButtonClick = function onButtonClick() {
38
+ return setIsPopoverOpen(function (isPopoverOpen) {
39
+ return !isPopoverOpen;
40
+ });
41
+ };
42
+
43
+ var closePopover = function closePopover() {
44
+ return setIsPopoverOpen(false);
45
+ };
46
+
47
+ var button = (0, _react2.jsx)(_button.EuiButtonEmpty, {
48
+ iconType: "documentation",
49
+ iconSide: "right",
50
+ onClick: onButtonClick
51
+ }, "How it works");
52
+ var popoverProps = {
53
+ button: button,
54
+ isOpen: isPopoverOpen,
55
+ closePopover: closePopover
56
+ };
57
+ return (0, _react2.jsx)(_popover.EuiPopover, popoverProps, (0, _react2.jsx)(_text.EuiText, {
58
+ style: {
59
+ width: 300
60
+ }
61
+ }, (0, _react2.jsx)("p", null, "Popover content that\u2019s wider than the default width")));
62
+ };
63
+
64
+ beforeEach(function () {
65
+ cy.mount((0, _react2.jsx)(Popover, null));
66
+ cy.get('div.euiPopover__panel').should('not.exist');
67
+ });
68
+ describe('EuiPopover', function () {
69
+ describe('Automated accessibility check', function () {
70
+ it('has zero violations on render', function () {
71
+ cy.checkAxe();
72
+ });
73
+ it('has zero violations when popover is opened', function () {
74
+ cy.get('button.euiButtonEmpty').click();
75
+ cy.get('div.euiPopover__panel').should('exist');
76
+ cy.checkAxe();
77
+ });
78
+ it('has zero violations when popover is closed', function () {
79
+ cy.get('button.euiButtonEmpty').click();
80
+ cy.get('div.euiPopover__panel').should('exist');
81
+ cy.get('button.euiButtonEmpty').click();
82
+ cy.get('div.euiPopover__panel').should('not.exist');
83
+ cy.checkAxe();
84
+ });
85
+ });
86
+ });
@@ -3506,7 +3506,8 @@ var printValue = function printValue(value, options) {
3506
3506
  return value.toString();
3507
3507
  }
3508
3508
 
3509
- if (value.length === 0 || value.match(/\s/) || value.toLowerCase() === 'or') {
3509
+ if (value.length === 0 || value.match(/[^\w\-_*:()"/\\]/) || // Escape spaces and special characters not used as syntax identifiers
3510
+ value.toLowerCase() === 'or') {
3510
3511
  return "\"".concat(escapePhraseValue(value), "\"");
3511
3512
  }
3512
3513
 
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
6
+
7
+ var _react = _interopRequireDefault(require("react"));
8
+
9
+ var _tabbed_content = require("./tabbed_content");
10
+
11
+ var _spacer = require("../spacer");
12
+
13
+ var _text = require("../text");
14
+
15
+ var _react2 = require("@emotion/react");
16
+
17
+ 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; }
18
+
19
+ 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) { (0, _defineProperty2.default)(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; }
20
+
21
+ var tabs = [{
22
+ id: 'cobalt--id',
23
+ name: 'Cobalt',
24
+ content: (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(_spacer.EuiSpacer, null), (0, _react2.jsx)(_text.EuiText, null, (0, _react2.jsx)("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.")))
25
+ }, {
26
+ id: 'dextrose--id',
27
+ name: 'Dextrose',
28
+ content: (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(_spacer.EuiSpacer, null), (0, _react2.jsx)(_text.EuiText, null, (0, _react2.jsx)("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.")))
29
+ }, {
30
+ id: 'hydrogen--id',
31
+ name: 'Hydrogen',
32
+ content: (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(_spacer.EuiSpacer, null), (0, _react2.jsx)(_text.EuiText, null, (0, _react2.jsx)("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")))
33
+ }, {
34
+ id: 'monosodium_glutammate--id',
35
+ name: 'Monosodium Glutamate',
36
+ content: (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(_spacer.EuiSpacer, null), (0, _react2.jsx)(_text.EuiText, null, (0, _react2.jsx)("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.")))
37
+ }];
38
+ var defaultTabProps = {
39
+ tabs: tabs,
40
+ initialSelectedTab: tabs[0],
41
+ autoFocus: 'selected',
42
+ onTabClick: function onTabClick() {}
43
+ };
44
+ describe('EuiTabs', function () {
45
+ describe('Automated accessibility check', function () {
46
+ it('has zero violations with default props', function () {
47
+ cy.mount((0, _react2.jsx)(_tabbed_content.EuiTabbedContent, defaultTabProps));
48
+ cy.get('div.euiTabs').should('exist');
49
+ cy.checkAxe();
50
+ });
51
+ it('has zero violations with second tab open on render', function () {
52
+ var secondSelectedTab = _objectSpread(_objectSpread({}, defaultTabProps), {}, {
53
+ initialSelectedTab: tabs[1]
54
+ });
55
+
56
+ cy.mount((0, _react2.jsx)(_tabbed_content.EuiTabbedContent, secondSelectedTab));
57
+ cy.get('div.euiTabs').should('exist');
58
+ cy.checkAxe();
59
+ });
60
+ it('has zero violations with third tab open on render', function () {
61
+ var thirdSelectedTab = _objectSpread(_objectSpread({}, defaultTabProps), {}, {
62
+ initialSelectedTab: tabs[2]
63
+ });
64
+
65
+ cy.mount((0, _react2.jsx)(_tabbed_content.EuiTabbedContent, thirdSelectedTab));
66
+ cy.get('div.euiTabs').should('exist');
67
+ cy.checkAxe();
68
+ });
69
+ it('has zero violations with last tab open on render', function () {
70
+ var lastSelectedTab = _objectSpread(_objectSpread({}, defaultTabProps), {}, {
71
+ initialSelectedTab: tabs[3]
72
+ });
73
+
74
+ cy.mount((0, _react2.jsx)(_tabbed_content.EuiTabbedContent, lastSelectedTab));
75
+ cy.get('div.euiTabs').should('exist');
76
+ cy.checkAxe();
77
+ });
78
+ it('has zero violations with all tabs disabled except first', function () {
79
+ var disabledTabs = tabs.map(function (tab, i) {
80
+ if (i === 0) {
81
+ return tab;
82
+ }
83
+
84
+ return _objectSpread(_objectSpread({}, tab), {}, {
85
+ disabled: true
86
+ });
87
+ });
88
+
89
+ var disabledTabProps = _objectSpread(_objectSpread({}, defaultTabProps), {}, {
90
+ tabs: disabledTabs
91
+ });
92
+
93
+ cy.mount((0, _react2.jsx)(_tabbed_content.EuiTabbedContent, disabledTabProps));
94
+ cy.get('div.euiTabs').should('exist');
95
+ cy.checkAxe();
96
+ });
97
+ });
98
+ });
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _react = _interopRequireDefault(require("react"));
6
+
7
+ var _tree_view = require("./tree_view");
8
+
9
+ var _react2 = require("@emotion/react");
10
+
11
+ /*
12
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
13
+ * or more contributor license agreements. Licensed under the Elastic License
14
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
15
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
16
+ * Side Public License, v 1.
17
+ */
18
+ /// <reference types="../../../cypress/support"/>
19
+ var TreeView = function TreeView() {
20
+ var items = [{
21
+ label: 'Item One',
22
+ id: 'item_one',
23
+ isExpanded: true,
24
+ children: [{
25
+ label: 'Item A',
26
+ id: 'item_a'
27
+ }, {
28
+ label: 'Item B',
29
+ id: 'item_b',
30
+ children: [{
31
+ label: 'A Cloud',
32
+ id: 'item_cloud'
33
+ }, {
34
+ label: "I'm a Bug",
35
+ id: 'item_bug',
36
+ className: 'classForBug'
37
+ }]
38
+ }, {
39
+ label: 'Item C',
40
+ id: 'item_c',
41
+ children: [{
42
+ label: 'Another Cloud',
43
+ id: 'item_cloud2'
44
+ }, {
45
+ label: 'Another Bug',
46
+ id: 'item_bug2'
47
+ }]
48
+ }]
49
+ }, {
50
+ label: 'Item Two',
51
+ id: 'item_two'
52
+ }];
53
+ var defaultTreeViewProps = {
54
+ items: items,
55
+ 'aria-label': 'Sample folder tree'
56
+ };
57
+ return (0, _react2.jsx)("div", {
58
+ style: {
59
+ width: '20rem'
60
+ }
61
+ }, (0, _react2.jsx)(_tree_view.EuiTreeView, defaultTreeViewProps));
62
+ };
63
+
64
+ describe('EuiTreeView', function () {
65
+ describe('Automated accessibility check', function () {
66
+ it('has zero violations on first render', function () {
67
+ cy.mount((0, _react2.jsx)(TreeView, null));
68
+ cy.get('div.euiTreeView__wrapper').should('exist');
69
+ cy.checkAxe();
70
+ });
71
+ it('has zero violations with a nested child expanded', function () {
72
+ cy.mount((0, _react2.jsx)(TreeView, null));
73
+ cy.get('div.euiTreeView__wrapper').should('exist');
74
+ cy.get('button#item_b').realClick();
75
+ cy.get('button#item_b').should('have.attr', 'aria-expanded', 'true');
76
+ cy.get('li.euiTreeView__node').contains('A Cloud').should('exist');
77
+ cy.checkAxe();
78
+ });
79
+ });
80
+ });
@@ -5,13 +5,19 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.euiAnimFadeIn = void 0;
8
+ exports.euiAnimSlideInUp = exports.euiAnimFadeIn = void 0;
9
9
 
10
10
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
11
 
12
12
  var _react = require("@emotion/react");
13
13
 
14
- var _templateObject;
14
+ var _templateObject, _templateObject2;
15
15
 
16
16
  var euiAnimFadeIn = (0, _react.keyframes)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n 0% {\n opacity: 0;\n }\n\n 100% {\n opacity: 1;\n }\n"])));
17
- exports.euiAnimFadeIn = euiAnimFadeIn;
17
+ exports.euiAnimFadeIn = euiAnimFadeIn;
18
+
19
+ var euiAnimSlideInUp = function euiAnimSlideInUp(size) {
20
+ return (0, _react.keyframes)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n 0% {\n opacity: 0;\n transform: translateY(", ");\n }\n\n 100% {\n opacity: 1;\n transform: translateY(0);\n }\n"])), size);
21
+ };
22
+
23
+ exports.euiAnimSlideInUp = euiAnimSlideInUp;
@@ -1 +0,0 @@
1
- @import 'modal';
@@ -1,156 +0,0 @@
1
- .euiModal {
2
- border: $euiBorderThin;
3
- // This mixin overwrites some of the border above
4
- @include euiBottomShadowLarge; // sass-lint:disable-line mixins-before-declarations
5
- display: flex;
6
- flex-direction: column;
7
- max-height: 75vh; // We overflow the modal body based off this
8
-
9
- // TODO: Consider restoring this once https://bugs.chromium.org/p/chromium/issues/detail?id=1229700 is resolved
10
- // overflow: hidden; Ensure long, non-breaking text doesn't expand beyond the modal bounds
11
-
12
- position: relative;
13
- background-color: $euiColorEmptyShade;
14
- border-radius: $euiBorderRadius;
15
- z-index: $euiZModal;
16
- min-width: $euiFormMaxWidth;
17
- animation: euiModal $euiAnimSpeedSlow $euiAnimSlightBounce;
18
- max-width: calc(100vw - #{$euiSize});
19
-
20
- // Remove the outline from the focusable container
21
- &:focus {
22
- outline: none;
23
- }
24
- }
25
-
26
- .euiModal--maxWidth-default {
27
- // Sass and CSS's versions of `min` collide here, so we use all uppercase to ensure the CSS version is used
28
- // https://css-tricks.com/when-sass-and-new-css-features-collide/#the-solution
29
- // sass-lint:disable-block function-name-format
30
- max-width: MIN(#{map-get($euiBreakpoints, 'm')}, calc(100vw - #{$euiSize}));
31
- }
32
-
33
- .euiModal--confirmation {
34
- min-width: $euiFormMaxWidth;
35
- }
36
-
37
- .euiModalHeader {
38
- display: flex;
39
- justify-content: space-between;
40
- align-items: center;
41
- padding: $euiSizeL $euiSizeXXL $euiSize $euiSizeL;
42
- flex-grow: 0;
43
- flex-shrink: 0;
44
- }
45
-
46
- .euiModalHeader__title {
47
- @include euiTitle('m');
48
- }
49
-
50
- .euiModalBody {
51
- flex-grow: 1;
52
- overflow: hidden;
53
- // The below fixes scroll on Chrome and Safari
54
- display: flex;
55
- flex-direction: column;
56
-
57
- .euiModalBody__overflow {
58
- @include euiYScrollWithShadows;
59
- padding: $euiSizeS $euiSizeL;
60
- }
61
- }
62
-
63
- .euiModalFooter {
64
- display: flex;
65
- justify-content: flex-end;
66
- padding: $euiSize $euiSizeL $euiSizeL;
67
- flex-grow: 0;
68
- flex-shrink: 0; // ensure the height of the footer is based off its contents and doesn't squish
69
-
70
- > * + * {
71
- margin-left: $euiSize;
72
- }
73
- }
74
-
75
- // If a body doesn't exist, remove some extra padding from footer
76
- .euiModalHeader + .euiModalFooter {
77
- padding-top: $euiSizeS;
78
- }
79
-
80
- // If a footer doesn't exist (body is the last element) add padding to the bottom
81
- .euiModalBody:last-of-type .euiModalBody__overflow {
82
- padding-bottom: $euiSizeL;
83
- }
84
-
85
-
86
- // The actual size of the X button in pixels is a bit fuzzy because of all the
87
- // button padding so there is some pixel pushing here.
88
- .euiModal__closeIcon {
89
- background-color: transparentize($euiColorEmptyShade, .1);
90
- position: absolute;
91
- right: $euiSizeXS;
92
- top: $euiSizeXS;
93
- z-index: 3;
94
- }
95
-
96
- @keyframes euiModal {
97
- 0% {
98
- opacity: 0;
99
- transform: translateY($euiSizeXL);
100
- }
101
-
102
- 100% {
103
- opacity: 1;
104
- transform: translateY(0);
105
- }
106
- }
107
-
108
- // On mobile we fix modals as a takeover.
109
- @include euiBreakpoint('xs', 's') {
110
- .euiModal {
111
- // sass-lint:disable-block no-important
112
- position: fixed;
113
- width: 100vw !important;
114
- max-width: none !important;
115
- min-width: 0 !important;
116
- max-height: 100vh;
117
- left: 0;
118
- right: 0;
119
- bottom: 0;
120
- top: 0;
121
- border-radius: 0;
122
- border: none;
123
-
124
- &.euiModal--confirmation {
125
- @include euiBottomShadowLarge($reverse: true);
126
- top: auto;
127
- }
128
- }
129
-
130
- .euiModalHeader {
131
- width: 100%;
132
- }
133
-
134
- .euiModalFooter {
135
- width: 100%;
136
- background: $euiColorLightestShade;
137
- padding: $euiSizeM $euiSizeL !important; // sass-lint:disable-line no-important
138
- justify-content: stretch;
139
-
140
- > * {
141
- flex: 1;
142
-
143
- + * {
144
- margin-left: 0;
145
- }
146
- }
147
- }
148
-
149
- .euiModalBody {
150
- width: 100%;
151
-
152
- .euiModalBody__overflow {
153
- padding-bottom: $euiSizeL;
154
- }
155
- }
156
- }
@@ -1,3 +0,0 @@
1
- .euiModal {
2
- border: none;
3
- }