@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,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.euiModalFooterStyles = void 0;
7
+
8
+ var _react = require("@emotion/react");
9
+
10
+ var _global_styling = require("../../global_styling");
11
+
12
+ /*
13
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
14
+ * or more contributor license agreements. Licensed under the Elastic License
15
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
16
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
17
+ * Side Public License, v 1.
18
+ */
19
+ var euiModalFooterStyles = function euiModalFooterStyles(euiThemeContext) {
20
+ var euiTheme = euiThemeContext.euiTheme;
21
+ return {
22
+ euiModalFooter: /*#__PURE__*/(0, _react.css)("display:flex;justify-content:flex-end;padding-block:", euiTheme.size.base, " ", euiTheme.size.l, ";padding-inline:", euiTheme.size.l, ";flex-grow:0;flex-shrink:0;gap:", euiTheme.size.base, ";", (0, _global_styling.euiBreakpoint)(euiThemeContext, ['xs', 's']), "{background:", euiTheme.colors.lightestShade, ";padding-block:", euiTheme.size.m, ";padding-inline:", euiTheme.size.l, ";justify-content:stretch;gap:", euiTheme.size.s, ";>*{flex:1;}};label:euiModalFooter;")
23
+ };
24
+ };
25
+
26
+ exports.euiModalFooterStyles = euiModalFooterStyles;
@@ -15,6 +15,10 @@ var _react = _interopRequireDefault(require("react"));
15
15
 
16
16
  var _classnames = _interopRequireDefault(require("classnames"));
17
17
 
18
+ var _services = require("../../services");
19
+
20
+ var _modal_header = require("./modal_header.styles");
21
+
18
22
  var _react2 = require("@emotion/react");
19
23
 
20
24
  var _excluded = ["className", "children"];
@@ -24,7 +28,11 @@ var EuiModalHeader = function EuiModalHeader(_ref) {
24
28
  children = _ref.children,
25
29
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
26
30
  var classes = (0, _classnames.default)('euiModalHeader', className);
31
+ var euiTheme = (0, _services.useEuiTheme)();
32
+ var styles = (0, _modal_header.euiModalHeaderStyles)(euiTheme);
33
+ var cssStyles = [styles.euiModalHeader];
27
34
  return (0, _react2.jsx)("div", (0, _extends2.default)({
35
+ css: cssStyles,
28
36
  className: classes
29
37
  }, rest), children);
30
38
  };
@@ -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;
@@ -15,6 +15,8 @@ var _react = _interopRequireDefault(require("react"));
15
15
 
16
16
  var _classnames = _interopRequireDefault(require("classnames"));
17
17
 
18
+ var _title = require("../title");
19
+
18
20
  var _react2 = require("@emotion/react");
19
21
 
20
22
  var _excluded = ["className", "children"];
@@ -24,7 +26,8 @@ var EuiModalHeaderTitle = function EuiModalHeaderTitle(_ref) {
24
26
  children = _ref.children,
25
27
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
26
28
  var classes = (0, _classnames.default)('euiModalHeader__title', className);
27
- return (0, _react2.jsx)("div", (0, _extends2.default)({
29
+ return (0, _react2.jsx)(_title.EuiTitle, (0, _extends2.default)({
30
+ size: "m",
28
31
  className: classes
29
32
  }, rest), /*#__PURE__*/_react.default.isValidElement(children) ? children : (0, _react2.jsx)("h1", null, children));
30
33
  };
@@ -37,7 +37,7 @@ var _global_styling = require("../../global_styling");
37
37
 
38
38
  var _react2 = require("@emotion/react");
39
39
 
40
- var _excluded = ["children", "restrictWidth", "paddingSize", "grow", "bottomBorder", "offset", "panelled", "contentBorder", "mainProps", "className", "minHeight", "responsive"];
40
+ var _excluded = ["children", "responsive", "restrictWidth", "paddingSize", "grow", "bottomBorder", "offset", "panelled", "contentBorder", "component", "mainProps", "className", "minHeight"];
41
41
 
42
42
  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); }
43
43
 
@@ -61,6 +61,8 @@ exports.TemplateContext = TemplateContext;
61
61
  */
62
62
  var _EuiPageTemplate = function _EuiPageTemplate(_ref) {
63
63
  var children = _ref.children,
64
+ _ref$responsive = _ref.responsive,
65
+ responsive = _ref$responsive === void 0 ? ['xs', 's'] : _ref$responsive,
64
66
  _ref$restrictWidth = _ref.restrictWidth,
65
67
  restrictWidth = _ref$restrictWidth === void 0 ? true : _ref$restrictWidth,
66
68
  _ref$paddingSize = _ref.paddingSize,
@@ -71,12 +73,11 @@ var _EuiPageTemplate = function _EuiPageTemplate(_ref) {
71
73
  _offset = _ref.offset,
72
74
  panelled = _ref.panelled,
73
75
  contentBorder = _ref.contentBorder,
76
+ component = _ref.component,
74
77
  mainProps = _ref.mainProps,
75
78
  className = _ref.className,
76
79
  _ref$minHeight = _ref.minHeight,
77
80
  minHeight = _ref$minHeight === void 0 ? '460px' : _ref$minHeight,
78
- _ref$responsive = _ref.responsive,
79
- responsive = _ref$responsive === void 0 ? ['xs', 's'] : _ref$responsive,
80
81
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
81
82
 
82
83
  var _useEuiTheme = (0, _services.useEuiTheme)(),
@@ -184,6 +185,7 @@ var _EuiPageTemplate = function _EuiPageTemplate(_ref) {
184
185
  style: pageStyle,
185
186
  className: classes
186
187
  }), sidebar, (0, _react2.jsx)(_inner._EuiPageInner, (0, _extends2.default)({}, mainProps, {
188
+ component: component,
187
189
  id: pageInnerId,
188
190
  border: innerBordered(),
189
191
  panelled: innerPanelled(),
@@ -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;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@elastic/eui",
3
3
  "description": "Elastic UI Component Library",
4
- "version": "70.2.3",
4
+ "version": "70.3.0",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "lib",
7
7
  "module": "es",
8
8
  "types": "eui.d.ts",
9
- "docker_image": "node:16.17.1",
9
+ "docker_image": "node:16.18.1",
10
10
  "sideEffects": [
11
11
  "*.css",
12
12
  "*.scss"
@@ -14,6 +14,7 @@
14
14
  "scripts": {
15
15
  "start": "cross-env BABEL_MODULES=false webpack serve --config=src-docs/webpack.config.js",
16
16
  "test-docker": "node ./scripts/test-docker.js",
17
+ "test-a11y-docker": "node ./scripts/test-a11y-docker.js",
17
18
  "sync-docs": "node ./scripts/docs-sync.js",
18
19
  "build-docs": "cross-env BABEL_MODULES=false cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=4096 webpack --config=src-docs/webpack.config.js",
19
20
  "build": "yarn extract-i18n-strings && node ./scripts/compile-clean.js && node ./scripts/compile-eui.js && yarn compile-scss",
@@ -80,7 +81,7 @@
80
81
  "react-beautiful-dnd": "^13.1.0",
81
82
  "react-dropzone": "^11.5.3",
82
83
  "react-element-to-jsx-string": "^14.3.4",
83
- "react-focus-on": "^3.5.4",
84
+ "react-focus-on": "^3.7.0",
84
85
  "react-input-autosize": "^3.0.0",
85
86
  "react-is": "^17.0.2",
86
87
  "react-virtualized-auto-sizer": "^1.0.6",
@@ -173,7 +174,7 @@
173
174
  "css-loader": "^6.7.1",
174
175
  "cssnano": "^4.1.10",
175
176
  "cypress": "^10.6.0",
176
- "cypress-axe": "^0.14.0",
177
+ "cypress-axe": "^1.0.0",
177
178
  "cypress-plugin-tab": "^1.0.5",
178
179
  "cypress-real-events": "^1.7.0",
179
180
  "dedent": "^0.7.0",
@@ -17,7 +17,6 @@
17
17
  @import 'header/index';
18
18
  @import 'key_pad_menu/index';
19
19
  @import 'markdown_editor/index';
20
- @import 'modal/index';
21
20
  @import 'notification/index';
22
21
  @import 'panel/index';
23
22
  @import 'page/index'; // Page needs to come after Panel for cascade specificity
@@ -12,7 +12,6 @@
12
12
  @import 'hue';
13
13
  @import 'key_pad_menu';
14
14
  @import 'markdown_editor';
15
- @import 'modal';
16
15
  @import 'range';
17
16
  @import 'range_draggable';
18
17
  @import 'range_highlight';
@@ -80,15 +80,16 @@ var EuiSkipLink = function EuiSkipLink(_ref) {
80
80
 
81
81
  setHasValidId(false); // If no valid element via ID is available, use the fallback query selectors
82
82
 
83
- var fallbackEl = document.querySelector(fallbackDestination);
83
+ if (fallbackDestination) {
84
+ var fallbackEl = document.querySelector(fallbackDestination);
84
85
 
85
- if (fallbackEl) {
86
- setDestinationEl(fallbackEl);
86
+ if (fallbackEl) {
87
+ setDestinationEl(fallbackEl);
88
+ }
87
89
  }
88
90
  }, [destinationId, fallbackDestination]);
89
91
  var onClick = (0, _react.useCallback)(function (e) {
90
- if (overrideLinkBehavior || !hasValidId) {
91
- if (!destinationEl) return;
92
+ if ((overrideLinkBehavior || !hasValidId) && destinationEl) {
92
93
  e.preventDefault(); // Scroll to the top of the destination content only if it's ~mostly out of view
93
94
 
94
95
  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
 
@@ -29,11 +29,13 @@ var _beta_badge = require("./beta_badge.styles");
29
29
 
30
30
  var _react2 = require("@emotion/react");
31
31
 
32
- var _excluded = ["className", "label", "color", "tooltipContent", "tooltipPosition", "anchorProps", "title", "iconType", "onClick", "onClickAriaLabel", "href", "rel", "target", "size"];
32
+ var _excluded = ["className", "label", "color", "tooltipContent", "tooltipPosition", "anchorProps", "title", "iconType", "onClick", "onClickAriaLabel", "href", "rel", "target", "size", "alignment"];
33
33
  var COLORS = ['accent', 'subdued', 'hollow'];
34
34
  exports.COLORS = COLORS;
35
35
  var SIZES = ['s', 'm'];
36
36
  exports.SIZES = SIZES;
37
+ var ALIGNMENTS = ['baseline', 'middle'];
38
+ exports.ALIGNMENTS = ALIGNMENTS;
37
39
 
38
40
  var EuiBetaBadge = function EuiBetaBadge(_ref) {
39
41
  var className = _ref.className,
@@ -53,13 +55,15 @@ var EuiBetaBadge = function EuiBetaBadge(_ref) {
53
55
  target = _ref.target,
54
56
  _ref$size = _ref.size,
55
57
  size = _ref$size === void 0 ? 'm' : _ref$size,
58
+ _ref$alignment = _ref.alignment,
59
+ alignment = _ref$alignment === void 0 ? 'baseline' : _ref$alignment,
56
60
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
57
61
  var euiTheme = (0, _services.useEuiTheme)();
58
62
  var singleLetter = !!(typeof label === 'string' && label.length === 1);
59
63
  var isCircular = iconType || singleLetter;
60
64
  var classes = (0, _classnames.default)('euiBetaBadge', className);
61
65
  var styles = (0, _beta_badge.euiBetaBadgeStyles)(euiTheme);
62
- var cssStyles = [styles.euiBetaBadge, styles[color], styles[size], isCircular ? styles.badgeSizes.circle[size] : styles.badgeSizes.default[size]];
66
+ var cssStyles = [styles.euiBetaBadge, styles[color], styles[size], styles[alignment], isCircular ? styles.badgeSizes.circle[size] : styles.badgeSizes.default[size]];
63
67
  var icon;
64
68
 
65
69
  if (iconType) {
@@ -204,5 +208,10 @@ EuiBetaBadge.propTypes = {
204
208
  * Accepts accent, subdued and hollow.
205
209
  */
206
210
  color: _propTypes.default.any,
207
- size: _propTypes.default.any
211
+ size: _propTypes.default.any,
212
+
213
+ /**
214
+ * Sets the `vertical-align` CSS property
215
+ */
216
+ alignment: _propTypes.default.any
208
217
  };
@@ -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;vertical-align:super;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', {
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: _ref
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, _ref2) {
67
- var euiTheme = _ref2.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
  };
@@ -443,7 +443,12 @@ EuiCard.propTypes = {
443
443
  * Accepts accent, subdued and hollow.
444
444
  */
445
445
  color: _propTypes.default.any,
446
- size: _propTypes.default.any
446
+ size: _propTypes.default.any,
447
+
448
+ /**
449
+ * Sets the `vertical-align` CSS property
450
+ */
451
+ alignment: _propTypes.default.any
447
452
  }),
448
453
 
449
454
  /**
@@ -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: "z24364-euiCard__main",
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: "z24364-euiCard__main",
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