@elastic/eui 70.1.0 → 70.2.1

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 (116) hide show
  1. package/dist/eui_theme_dark.css +11 -1
  2. package/dist/eui_theme_dark.min.css +1 -1
  3. package/dist/eui_theme_light.css +11 -1
  4. package/dist/eui_theme_light.min.css +1 -1
  5. package/es/components/accessibility/screen_reader_only/screen_reader_only.js +1 -1
  6. package/es/components/accessibility/screen_reader_only/screen_reader_only.styles.js +1 -1
  7. package/es/components/accordion/accordion.a11y.js +35 -0
  8. package/es/components/card/card.js +13 -31
  9. package/es/components/card/card.styles.js +15 -3
  10. package/es/components/card/card_select/card_select.styles.js +4 -4
  11. package/es/components/card/checkable_card/checkable_card.js +3 -2
  12. package/es/components/context_menu/context_menu_panel.a11y.js +34 -0
  13. package/es/components/datagrid/controls/data_grid_toolbar.js +6 -2
  14. package/es/components/datagrid/controls/index.js +1 -0
  15. package/es/components/datagrid/controls/keyboard_shortcuts.js +191 -0
  16. package/es/components/datagrid/data_grid.js +12 -2
  17. package/es/components/date_picker/super_date_picker/super_date_picker.js +22 -4
  18. package/es/components/page/page_section/page_section.js +3 -4
  19. package/es/components/selectable/selectable.a11y.js +118 -0
  20. package/es/components/selectable/selectable.js +9 -6
  21. package/es/components/tabs/tab.js +9 -4
  22. package/es/components/tabs/tab.styles.js +29 -16
  23. package/es/components/tabs/tabbed_content/tabbed_content.js +1 -1
  24. package/es/components/tabs/tabs.js +3 -3
  25. package/es/components/tabs/tabs.styles.js +2 -4
  26. package/es/services/string/to_initials.js +1 -1
  27. package/eui.d.ts +208 -164
  28. package/i18ntokens.json +438 -6
  29. package/lib/components/accessibility/screen_reader_only/screen_reader_only.js +1 -1
  30. package/lib/components/accessibility/screen_reader_only/screen_reader_only.styles.js +1 -1
  31. package/lib/components/accordion/accordion.a11y.js +44 -0
  32. package/lib/components/card/card.js +14 -33
  33. package/lib/components/card/card.styles.js +15 -3
  34. package/lib/components/card/card_select/card_select.styles.js +4 -4
  35. package/lib/components/card/checkable_card/checkable_card.js +3 -2
  36. package/lib/components/context_menu/context_menu_panel.a11y.js +42 -0
  37. package/lib/components/datagrid/controls/data_grid_toolbar.js +7 -2
  38. package/lib/components/datagrid/controls/index.js +8 -0
  39. package/lib/components/datagrid/controls/keyboard_shortcuts.js +208 -0
  40. package/lib/components/datagrid/data_grid.js +11 -1
  41. package/lib/components/date_picker/super_date_picker/super_date_picker.js +22 -4
  42. package/lib/components/page/page_section/page_section.js +3 -4
  43. package/lib/components/selectable/selectable.a11y.js +122 -0
  44. package/lib/components/selectable/selectable.js +9 -6
  45. package/lib/components/tabs/tab.js +9 -4
  46. package/lib/components/tabs/tab.styles.js +29 -16
  47. package/lib/components/tabs/tabbed_content/tabbed_content.js +1 -1
  48. package/lib/components/tabs/tabs.js +3 -3
  49. package/lib/components/tabs/tabs.styles.js +1 -3
  50. package/lib/services/string/to_initials.js +1 -1
  51. package/optimize/es/components/accessibility/screen_reader_only/screen_reader_only.styles.js +1 -1
  52. package/optimize/es/components/accordion/accordion.a11y.js +35 -0
  53. package/optimize/es/components/card/card.js +12 -30
  54. package/optimize/es/components/card/card.styles.js +15 -3
  55. package/optimize/es/components/card/card_select/card_select.styles.js +4 -4
  56. package/optimize/es/components/card/checkable_card/checkable_card.js +3 -2
  57. package/optimize/es/components/context_menu/context_menu_panel.a11y.js +34 -0
  58. package/optimize/es/components/datagrid/controls/data_grid_toolbar.js +6 -2
  59. package/optimize/es/components/datagrid/controls/index.js +1 -0
  60. package/optimize/es/components/datagrid/controls/keyboard_shortcuts.js +181 -0
  61. package/optimize/es/components/datagrid/data_grid.js +6 -2
  62. package/optimize/es/components/date_picker/super_date_picker/super_date_picker.js +12 -4
  63. package/optimize/es/components/page/page_section/page_section.js +3 -4
  64. package/optimize/es/components/selectable/selectable.a11y.js +107 -0
  65. package/optimize/es/components/selectable/selectable.js +9 -6
  66. package/optimize/es/components/tabs/tab.js +9 -4
  67. package/optimize/es/components/tabs/tab.styles.js +29 -16
  68. package/optimize/es/components/tabs/tabs.js +3 -3
  69. package/optimize/es/components/tabs/tabs.styles.js +2 -4
  70. package/optimize/es/services/string/to_initials.js +1 -1
  71. package/optimize/lib/components/accessibility/screen_reader_only/screen_reader_only.styles.js +1 -1
  72. package/optimize/lib/components/accordion/accordion.a11y.js +44 -0
  73. package/optimize/lib/components/card/card.js +13 -32
  74. package/optimize/lib/components/card/card.styles.js +15 -3
  75. package/optimize/lib/components/card/card_select/card_select.styles.js +4 -4
  76. package/optimize/lib/components/card/checkable_card/checkable_card.js +3 -2
  77. package/optimize/lib/components/context_menu/context_menu_panel.a11y.js +42 -0
  78. package/optimize/lib/components/datagrid/controls/data_grid_toolbar.js +7 -2
  79. package/optimize/lib/components/datagrid/controls/index.js +8 -0
  80. package/optimize/lib/components/datagrid/controls/keyboard_shortcuts.js +207 -0
  81. package/optimize/lib/components/datagrid/data_grid.js +5 -1
  82. package/optimize/lib/components/date_picker/super_date_picker/super_date_picker.js +12 -4
  83. package/optimize/lib/components/page/page_section/page_section.js +3 -4
  84. package/optimize/lib/components/selectable/selectable.a11y.js +122 -0
  85. package/optimize/lib/components/selectable/selectable.js +9 -6
  86. package/optimize/lib/components/tabs/tab.js +9 -4
  87. package/optimize/lib/components/tabs/tab.styles.js +29 -16
  88. package/optimize/lib/components/tabs/tabs.js +3 -3
  89. package/optimize/lib/components/tabs/tabs.styles.js +1 -3
  90. package/optimize/lib/services/string/to_initials.js +1 -1
  91. package/package.json +3 -2
  92. package/src/components/datagrid/_index.scss +1 -0
  93. package/src/components/datagrid/controls/_data_grid_keyboard_shortcuts.scss +17 -0
  94. package/src/components/modal/_modal.scss +3 -1
  95. package/test-env/components/accessibility/screen_reader_only/screen_reader_only.js +1 -1
  96. package/test-env/components/accessibility/screen_reader_only/screen_reader_only.styles.js +1 -1
  97. package/test-env/components/accordion/accordion.a11y.js +44 -0
  98. package/test-env/components/card/card.js +14 -33
  99. package/test-env/components/card/card.styles.js +15 -3
  100. package/test-env/components/card/card_select/card_select.styles.js +4 -4
  101. package/test-env/components/card/checkable_card/checkable_card.js +3 -2
  102. package/test-env/components/context_menu/context_menu_panel.a11y.js +42 -0
  103. package/test-env/components/datagrid/controls/data_grid_toolbar.js +7 -2
  104. package/test-env/components/datagrid/controls/index.js +8 -0
  105. package/test-env/components/datagrid/controls/keyboard_shortcuts.js +207 -0
  106. package/test-env/components/datagrid/data_grid.js +11 -1
  107. package/test-env/components/date_picker/super_date_picker/super_date_picker.js +22 -4
  108. package/test-env/components/page/page_section/page_section.js +3 -4
  109. package/test-env/components/selectable/selectable.a11y.js +122 -0
  110. package/test-env/components/selectable/selectable.js +9 -6
  111. package/test-env/components/tabs/tab.js +9 -4
  112. package/test-env/components/tabs/tab.styles.js +29 -16
  113. package/test-env/components/tabs/tabbed_content/tabbed_content.js +1 -1
  114. package/test-env/components/tabs/tabs.js +3 -3
  115. package/test-env/components/tabs/tabs.styles.js +1 -3
  116. package/test-env/services/string/to_initials.js +1 -1
@@ -39,7 +39,8 @@ var EuiTab = function EuiTab(_ref) {
39
39
  rel = _ref.rel,
40
40
  prepend = _ref.prepend,
41
41
  append = _ref.append,
42
- size = _ref.size,
42
+ _ref$size = _ref.size,
43
+ size = _ref$size === void 0 ? 'm' : _ref$size,
43
44
  expand = _ref.expand,
44
45
  rest = _objectWithoutProperties(_ref, _excluded);
45
46
 
@@ -51,11 +52,15 @@ var EuiTab = function EuiTab(_ref) {
51
52
  'euiTab-isSelected': isSelected
52
53
  });
53
54
  var tabStyles = (0, _tab.euiTabStyles)(euiTheme);
54
- var cssTabStyles = [tabStyles.euiTab, expand && tabStyles.expanded, isSelected && tabStyles.selected, disabled && tabStyles.disabled, size && tabStyles[size]];
55
+ var cssTabStyles = [tabStyles.euiTab, expand && tabStyles.expanded, disabled && tabStyles.disabled.disabled, isSelected && (disabled ? tabStyles.disabled.selected : tabStyles.selected)];
55
56
  var tabContentStyles = (0, _tab.euiTabContentStyles)(euiTheme);
56
57
  var cssTabContentStyles = [tabContentStyles.euiTab__content, size && tabContentStyles[size], isSelected && tabContentStyles.selected, disabled && tabContentStyles.disabled];
57
- var prependNode = prepend && (0, _react2.jsx)("span", null, prepend);
58
- var appendNode = append && (0, _react2.jsx)("span", null, append); // <a> elements don't respect the `disabled` attribute. So if we're disabled, we'll just pretend
58
+ var prependNode = prepend && (0, _react2.jsx)("span", {
59
+ className: "euiTab__prepend"
60
+ }, prepend);
61
+ var appendNode = append && (0, _react2.jsx)("span", {
62
+ className: "euiTab__append"
63
+ }, append); // <a> elements don't respect the `disabled` attribute. So if we're disabled, we'll just pretend
59
64
  // this is a button and piggyback off its disabled styles.
60
65
 
61
66
  if (href && !disabled) {
@@ -7,11 +7,13 @@ exports.euiTabStyles = exports.euiTabContentStyles = void 0;
7
7
 
8
8
  var _react = require("@emotion/react");
9
9
 
10
+ var _global_styling = require("../../global_styling");
11
+
10
12
  var _title = require("../title/title.styles");
11
13
 
12
14
  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)."; }
13
15
 
14
- var _ref = process.env.NODE_ENV === "production" ? {
16
+ var _ref2 = process.env.NODE_ENV === "production" ? {
15
17
  name: "10tso78-expanded",
16
18
  styles: "flex-basis:0%;flex-grow:1;justify-content:center;label:expanded;"
17
19
  } : {
@@ -20,36 +22,47 @@ var _ref = process.env.NODE_ENV === "production" ? {
20
22
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
21
23
  };
22
24
 
23
- var euiTabStyles = function euiTabStyles(_ref2) {
24
- var euiTheme = _ref2.euiTheme;
25
+ var euiTabStyles = function euiTabStyles(_ref3) {
26
+ var euiTheme = _ref3.euiTheme;
25
27
  return {
26
- euiTab: /*#__PURE__*/(0, _react.css)("display:flex;cursor:pointer;flex-direction:row;align-items:center;font-weight:", euiTheme.font.weight.semiBold, ";gap:", euiTheme.size.s, ";&:focus{background-color:transparent;outline-offset:-", euiTheme.focus.width, ";};label:euiTab;"),
27
- // sizes
28
- s: /*#__PURE__*/(0, _react.css)("padding:0 ", euiTheme.size.xs, ";;label:s;"),
29
- m: /*#__PURE__*/(0, _react.css)("padding:0 ", euiTheme.size.xs, ";;label:m;"),
30
- l: /*#__PURE__*/(0, _react.css)("padding:0 ", euiTheme.size.xs, ";;label:l;"),
31
- xl: /*#__PURE__*/(0, _react.css)("padding:", euiTheme.size.s, " ", euiTheme.size.xs, ";;label:xl;"),
28
+ euiTab: /*#__PURE__*/(0, _react.css)("display:flex;cursor:pointer;flex-direction:row;align-items:center;font-weight:", euiTheme.font.weight.semiBold, ";gap:", euiTheme.size.s, ";", (0, _global_styling.logicalCSS)('padding-vertical', 0), " ", (0, _global_styling.logicalCSS)('padding-horizontal', euiTheme.size.xs), " &:focus{background-color:transparent;outline-offset:-", euiTheme.focus.width, ";};label:euiTab;"),
32
29
  // variations
33
- expanded: _ref,
34
- selected: /*#__PURE__*/(0, _react.css)("box-shadow:inset 0 calc(", euiTheme.border.width.thick, " * -1) 0 ", euiTheme.colors.primary, ";;label:selected;"),
35
- disabled: /*#__PURE__*/(0, _react.css)("cursor:not-allowed;color:", euiTheme.colors.disabledText, ";.euiTab.euiTab__isSelected{box-shadow:inset 0 calc(", euiTheme.border.width.thick, " * -1) 0 ", euiTheme.colors.disabledText, ";};label:disabled;")
30
+ expanded: _ref2,
31
+ selected: /*#__PURE__*/(0, _react.css)("box-shadow:inset 0 -", euiTheme.border.width.thick, " 0 ", euiTheme.colors.primary, ";;label:selected;"),
32
+ disabled: {
33
+ disabled: /*#__PURE__*/(0, _react.css)("cursor:not-allowed;color:", euiTheme.colors.disabledText, ";;label:disabled;"),
34
+ selected: /*#__PURE__*/(0, _react.css)("box-shadow:inset 0 -", euiTheme.border.width.thick, " 0 ", euiTheme.colors.disabledText, ";;label:selected;")
35
+ }
36
36
  };
37
37
  };
38
38
 
39
39
  exports.euiTabStyles = euiTabStyles;
40
40
 
41
+ var _ref = process.env.NODE_ENV === "production" ? {
42
+ name: "1yhgei9-euiTab__content",
43
+ styles: "&:hover{text-decoration:none;};label:euiTab__content;"
44
+ } : {
45
+ name: "1yhgei9-euiTab__content",
46
+ styles: "&:hover{text-decoration:none;};label:euiTab__content;",
47
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
48
+ };
49
+
41
50
  var euiTabContentStyles = function euiTabContentStyles(euiThemeContext) {
42
51
  var euiTheme = euiThemeContext.euiTheme;
43
52
  return {
44
- euiTab__content: /*#__PURE__*/(0, _react.css)("color:", euiTheme.colors.disabledText, ";&:hover{text-decoration:none;};label:euiTab__content;"),
53
+ euiTab__content: _ref,
45
54
  // sizes
46
55
  s: /*#__PURE__*/(0, _react.css)((0, _title.euiTitle)(euiThemeContext, 'xxxs'), ";line-height:", euiTheme.size.xl, ";;label:s;"),
47
56
  m: /*#__PURE__*/(0, _react.css)((0, _title.euiTitle)(euiThemeContext, 'xxs'), ";line-height:", euiTheme.size.xxl, ";;label:m;"),
48
- l: /*#__PURE__*/(0, _react.css)((0, _title.euiTitle)(euiThemeContext, 'xs'), ";line-height:calc(", euiTheme.size.xl, " + ", euiTheme.size.s, ");;label:l;"),
49
- xl: /*#__PURE__*/(0, _react.css)((0, _title.euiTitle)(euiThemeContext, 's'), ";line-height:calc(", euiTheme.size.xxxl, " + ", euiTheme.size.s, ");;label:xl;"),
57
+ l: /*#__PURE__*/(0, _react.css)((0, _title.euiTitle)(euiThemeContext, 'xs'), ";line-height:", (0, _global_styling.mathWithUnits)([euiTheme.size.xl, euiTheme.size.s], function (x, y) {
58
+ return x + y;
59
+ }), ";;label:l;"),
60
+ xl: /*#__PURE__*/(0, _react.css)((0, _title.euiTitle)(euiThemeContext, 's'), ";line-height:", (0, _global_styling.mathWithUnits)([euiTheme.size.xxxl, euiTheme.size.s], function (x, y) {
61
+ return x + y;
62
+ }), ";;label:xl;"),
50
63
  // variations
51
64
  selected: /*#__PURE__*/(0, _react.css)("color:", euiTheme.colors.primaryText, ";;label:selected;"),
52
- disabled: /*#__PURE__*/(0, _react.css)("color:", euiTheme.colors.disabledText, ";&:hover{text-decoration:none;};label:disabled;")
65
+ disabled: /*#__PURE__*/(0, _react.css)("color:", euiTheme.colors.disabledText, ";;label:disabled;")
53
66
  };
54
67
  };
55
68
 
@@ -291,7 +291,7 @@ EuiTabbedContent.propTypes = {
291
291
  "data-test-subj": _propTypes.default.string,
292
292
  css: _propTypes.default.any
293
293
  }),
294
- size: _propTypes.default.oneOf(["s", "m", "l", "xl"]),
294
+ size: _propTypes.default.any,
295
295
 
296
296
  /**
297
297
  * Each tab needs id and content properties, so we can associate it with its panel for accessibility.
@@ -48,8 +48,8 @@ var EuiTabs = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
48
48
 
49
49
  var euiTheme = (0, _services.useEuiTheme)();
50
50
  var classes = (0, _classnames.default)('euiTabs', className);
51
- var tabsStyles = (0, _tabs.euiTabsStyles)(euiTheme);
52
- var computedStyles = [tabsStyles.euiTabs, tabsStyles[size], bottomBorder && tabsStyles.bottomBorder];
51
+ var styles = (0, _tabs.euiTabsStyles)(euiTheme);
52
+ var cssStyles = [styles.euiTabs, styles[size], bottomBorder && styles.bottomBorder];
53
53
 
54
54
  var tabItems = _react.default.Children.map(children, function (child) {
55
55
  if ( /*#__PURE__*/_react.default.isValidElement(child)) {
@@ -64,7 +64,7 @@ var EuiTabs = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
64
64
  return (0, _react2.jsx)("div", _extends({
65
65
  ref: ref,
66
66
  className: classes,
67
- css: computedStyles
67
+ css: cssStyles
68
68
  }, children && {
69
69
  role: 'tablist'
70
70
  }, rest), tabItems);
@@ -20,9 +20,7 @@ var euiTabsStyles = function euiTabsStyles(euiThemeContext) {
20
20
  var euiTheme = euiThemeContext.euiTheme;
21
21
  return {
22
22
  euiTabs: /*#__PURE__*/(0, _react.css)("display:flex;", (0, _global_styling.logicalCSS)('max-width', '100%'), ";", (0, _global_styling.logicalCSSWithFallback)('overflow-x', 'auto'), ";", (0, _global_styling.logicalCSSWithFallback)('overflow-y', 'hidden'), ";position:relative;flex-shrink:0;;label:euiTabs;"),
23
- bottomBorder: /*#__PURE__*/(0, _react.css)("box-shadow:inset 0 ", (0, _global_styling.mathWithUnits)(euiTheme.border.width.thin, function (x) {
24
- return x * -1;
25
- }), " 0 ", euiTheme.border.color, ";;label:bottomBorder;"),
23
+ bottomBorder: /*#__PURE__*/(0, _react.css)("box-shadow:inset 0 -", euiTheme.border.width.thin, " 0 ", euiTheme.border.color, ";;label:bottomBorder;"),
26
24
  // sizes
27
25
  s: /*#__PURE__*/(0, _react.css)("gap:", euiTheme.size.m, ";;label:s;"),
28
26
  m: /*#__PURE__*/(0, _react.css)("gap:", euiTheme.size.base, ";;label:m;"),
@@ -32,7 +32,7 @@ exports.MAX_INITIALS = MAX_INITIALS;
32
32
 
33
33
  function toInitials(name, initialsLength, initials) {
34
34
  // Calculate the number of initials to show, maxing out at MAX_INITIALS
35
- var calculatedInitialsLength = initials ? initials.split(' ').length : name.split(' ').length;
35
+ var calculatedInitialsLength = initials ? initials.split('').length : name.split(' ').length;
36
36
  calculatedInitialsLength = calculatedInitialsLength > MAX_INITIALS ? MAX_INITIALS : calculatedInitialsLength; // Check if initialsLength was passed and set to calculated, unless greater than MAX_INITIALS
37
37
 
38
38
  if (initialsLength) {
@@ -21,6 +21,6 @@ export var euiScreenReaderOnly = function euiScreenReaderOnly() {
21
21
 
22
22
  export var euiScreenReaderOnlyStyles = function euiScreenReaderOnlyStyles(showOnFocus) {
23
23
  return {
24
- euiScreenReaderOnly: showOnFocus ? /*#__PURE__*/css("&:not(:focus):not(:active){", euiScreenReaderOnly(), ";};label:euiScreenReaderOnly;") : /*#__PURE__*/css(euiScreenReaderOnly(), ";label:euiScreenReaderOnly;")
24
+ euiScreenReaderOnly: showOnFocus ? /*#__PURE__*/css("&:not(:focus):not(:active):not(:focus-within){", euiScreenReaderOnly(), ";};label:euiScreenReaderOnly;") : /*#__PURE__*/css(euiScreenReaderOnly(), ";label:euiScreenReaderOnly;")
25
25
  };
26
26
  };
@@ -0,0 +1,35 @@
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 { EuiAccordion } from './index';
11
+ import { EuiPanel } from '../../components/panel';
12
+ import { htmlIdGenerator } from '../../services';
13
+ import { jsx as ___EmotionJSX } from "@emotion/react";
14
+ var baseProps = {
15
+ buttonContent: 'Click me to toggle',
16
+ id: htmlIdGenerator()(),
17
+ initialIsOpen: false
18
+ };
19
+ var noArrow = {
20
+ arrowDisplay: 'none'
21
+ };
22
+ var noArrowProps = Object.assign(baseProps, noArrow);
23
+ describe('EuiAccordion', function () {
24
+ describe('Automated accessibility check', function () {
25
+ it('has zero violations when expanded', function () {
26
+ cy.mount(___EmotionJSX(EuiAccordion, noArrowProps, ___EmotionJSX(EuiPanel, {
27
+ color: "subdued"
28
+ }, "Any content inside of ", ___EmotionJSX("strong", null, "EuiAccordion"), " will appear here. We will include ", ___EmotionJSX("a", {
29
+ href: "#"
30
+ }, "a link"), " to confirm focus.")));
31
+ cy.get('button.euiAccordion__button').click();
32
+ cy.checkAxe();
33
+ });
34
+ });
35
+ });
@@ -17,33 +17,19 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
17
17
  */
18
18
  import React, { isValidElement } from 'react';
19
19
  import classNames from 'classnames';
20
- import { keysOf } from '../common';
21
20
  import { getSecureRelForTarget, useEuiTheme } from '../../services';
21
+ import { cloneElementWithCss } from '../../services/theme/clone_element';
22
22
  import { EuiText } from '../text';
23
23
  import { EuiTitle } from '../title';
24
24
  import { EuiBetaBadge } from '../badge/beta_badge';
25
- import { EuiCardSelect, euiCardSelectableColor } from './card_select';
25
+ import { EuiCardSelect } from './card_select';
26
26
  import { useGeneratedHtmlId } from '../../services/accessibility';
27
27
  import { validateHref } from '../../services/security/href_validator';
28
28
  import { EuiPanel } from '../panel';
29
29
  import { EuiSpacer } from '../spacer';
30
30
  import { euiCardBetaBadgeStyles, euiCardStyles, euiCardTextStyles } from './card.styles';
31
31
  import { jsx as ___EmotionJSX } from "@emotion/react";
32
- var textAlignToClassNameMap = {
33
- left: 'euiCard--leftAligned',
34
- center: 'euiCard--centerAligned',
35
- right: 'euiCard--rightAligned'
36
- };
37
- export var ALIGNMENTS = keysOf(textAlignToClassNameMap);
38
- var layoutToClassNameMap = {
39
- vertical: '',
40
- horizontal: 'euiCard--horizontal'
41
- };
42
- export var LAYOUT_ALIGNMENTS = keysOf(layoutToClassNameMap);
43
- /**
44
- * Certain props are only allowed when the layout is vertical
45
- */
46
-
32
+ export var ALIGNMENTS = ['left', 'center', 'right'];
47
33
  export var EuiCard = function EuiCard(_ref) {
48
34
  var className = _ref.className,
49
35
  description = _ref.description,
@@ -78,8 +64,9 @@ export var EuiCard = function EuiCard(_ref) {
78
64
  var euiThemeContext = useEuiTheme();
79
65
  var styles = euiCardStyles(euiThemeContext, paddingSize);
80
66
  var cardStyles = [styles.card.euiCard, // Text alignment should always be left when horizontal
81
- styles.card.aligned[layout === 'horizontal' ? 'left' : textAlign], styles.card.layout[layout], isDisabled && styles.card.disabled];
67
+ styles.card.aligned[layout === 'horizontal' ? 'left' : textAlign], isDisabled && styles.card.disabled];
82
68
  var contentStyles = [styles.content.euiCard__content, styles.content.layout[layout]];
69
+ var mainStyles = [styles.main.euiCard__main, styles.main.layout[layout]];
83
70
  var textStyles = euiCardTextStyles(euiThemeContext);
84
71
  var textCSS = [textStyles.euiCard__text, // Text alignment should always be left when horizontal
85
72
  textStyles.aligned[layout === 'horizontal' ? 'left' : textAlign], isClickable && textStyles.interactive, isDisabled && textStyles.disabled];
@@ -103,15 +90,7 @@ export var EuiCard = function EuiCard(_ref) {
103
90
  }
104
91
  }
105
92
 
106
- var selectableColorClass = selectable ? "euiCard--isSelectable--".concat(euiCardSelectableColor(selectable.color, selectable.isSelected)) : undefined;
107
- var classes = classNames('euiCard', textAlignToClassNameMap[textAlign], layoutToClassNameMap[layout], {
108
- 'euiCard--isClickable': isClickable,
109
- 'euiCard--hasBetaBadge': betaBadgeProps === null || betaBadgeProps === void 0 ? void 0 : betaBadgeProps.label,
110
- 'euiCard--hasIcon': icon,
111
- 'euiCard--isSelectable': selectable,
112
- 'euiCard-isSelected': selectable === null || selectable === void 0 ? void 0 : selectable.isSelected,
113
- 'euiCard-isDisabled': isDisabled
114
- }, selectableColorClass, className);
93
+ var classes = classNames('euiCard', className);
115
94
  var ariaId = useGeneratedHtmlId();
116
95
  var ariaDesc = description ? "".concat(ariaId, "Description") : '';
117
96
  /**
@@ -139,7 +118,7 @@ export var EuiCard = function EuiCard(_ref) {
139
118
 
140
119
  if (icon) {
141
120
  var iconStyles = [styles.icon.euiCard__icon, styles.icon.layout[layout], imageNode && styles.icon.withImage];
142
- iconNode = /*#__PURE__*/React.cloneElement(icon, {
121
+ iconNode = cloneElementWithCss(icon, {
143
122
  className: classNames(icon.props.className, 'euiCard__icon'),
144
123
  css: iconStyles
145
124
  });
@@ -295,12 +274,15 @@ export var EuiCard = function EuiCard(_ref) {
295
274
  hasShadow: isDisabled || display ? false : true,
296
275
  hasBorder: display ? false : undefined,
297
276
  paddingSize: paddingSize
298
- }, rest), optionalCardTop, ___EmotionJSX("div", {
277
+ }, rest), ___EmotionJSX("div", {
278
+ className: "euiCard__main",
279
+ css: mainStyles
280
+ }, optionalCardTop, ___EmotionJSX("div", {
299
281
  className: "euiCard__content",
300
282
  css: contentStyles
301
283
  }, ___EmotionJSX(EuiTitle, {
302
284
  id: "".concat(ariaId, "Title"),
303
285
  className: "euiCard__title",
304
286
  size: titleSize
305
- }, ___EmotionJSX(TitleElement, null, theTitle)), optionalDescription, optionalChildren), optionalBetaBadge, optionalFooter, optionalSelectButton);
287
+ }, ___EmotionJSX(TitleElement, null, theTitle)), optionalDescription, optionalChildren), optionalBetaBadge, optionalFooter), optionalSelectButton);
306
288
  };
@@ -54,6 +54,15 @@ var _ref5 = process.env.NODE_ENV === "production" ? {
54
54
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
55
55
  };
56
56
 
57
+ var _ref6 = process.env.NODE_ENV === "production" ? {
58
+ name: "z24364-euiCard__main",
59
+ styles: "display:flex;label:euiCard__main;"
60
+ } : {
61
+ name: "z24364-euiCard__main",
62
+ styles: "display:flex;label:euiCard__main;",
63
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
64
+ };
65
+
57
66
  export var euiCardStyles = function euiCardStyles(euiThemeContext, paddingSize) {
58
67
  var euiTheme = euiThemeContext.euiTheme;
59
68
  var paddingAmount = euiPaddingSize(euiThemeContext, paddingSize);
@@ -61,17 +70,20 @@ export var euiCardStyles = function euiCardStyles(euiThemeContext, paddingSize)
61
70
  var halfSpacing = euiPaddingSize(euiThemeContext, halfPaddingKey);
62
71
  return {
63
72
  card: {
64
- euiCard: /*#__PURE__*/css("display:flex;&:has([class*='euiCard__text'][class*='-interactive']:focus:focus-visible){outline:", euiTheme.focus.width, " solid currentColor;};label:euiCard;"),
73
+ euiCard: /*#__PURE__*/css("display:flex;align-items:flex-start;justify-content:space-between;flex-direction:column;&:has([class*='euiCard__text'][class*='-interactive']:focus:focus-visible){outline:", euiTheme.focus.width, " solid currentColor;};label:euiCard;"),
65
74
  aligned: {
66
75
  center: /*#__PURE__*/css(logicalTextAlignCSS('center'), ";align-items:center;;label:center;"),
67
76
  left: /*#__PURE__*/css(logicalTextAlignCSS('left'), ";align-items:flex-start;;label:left;"),
68
77
  right: /*#__PURE__*/css(logicalTextAlignCSS('right'), ";align-items:flex-end;;label:right;")
69
78
  },
79
+ disabled: /*#__PURE__*/css("cursor:not-allowed;background-color:", euiButtonColor(euiThemeContext, 'disabled'), ";color:", euiTheme.colors.disabledText, ";;label:disabled;")
80
+ },
81
+ main: {
82
+ euiCard__main: _ref6,
70
83
  layout: {
71
84
  vertical: _ref5,
72
85
  horizontal: _ref4
73
- },
74
- disabled: /*#__PURE__*/css("cursor:not-allowed;background-color:", euiButtonColor(euiThemeContext, 'disabled'), ";color:", euiTheme.colors.disabledText, ";;label:disabled;")
86
+ }
75
87
  },
76
88
  content: {
77
89
  euiCard__content: _ref3,
@@ -10,11 +10,11 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
10
10
  import { css } from '@emotion/react';
11
11
 
12
12
  var _ref = process.env.NODE_ENV === "production" ? {
13
- name: "g3lgnd-euiCardSelect",
14
- styles: "transform:none!important;label:euiCardSelect;"
13
+ name: "aogl4-euiCardSelect",
14
+ styles: "transform:none!important;align-self:flex-end;label:euiCardSelect;"
15
15
  } : {
16
- name: "g3lgnd-euiCardSelect",
17
- styles: "transform:none!important;label:euiCardSelect;",
16
+ name: "aogl4-euiCardSelect",
17
+ styles: "transform:none!important;align-self:flex-end;label:euiCardSelect;",
18
18
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
19
19
  };
20
20
 
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["children", "className", "checkableType", "label", "checked", "disabled", "hasShadow", "hasBorder"];
3
+ var _excluded = ["children", "className", "css", "checkableType", "label", "checked", "disabled", "hasShadow", "hasBorder"];
4
4
 
5
5
  /*
6
6
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
@@ -19,6 +19,7 @@ import { jsx as ___EmotionJSX } from "@emotion/react";
19
19
  export var EuiCheckableCard = function EuiCheckableCard(_ref) {
20
20
  var children = _ref.children,
21
21
  className = _ref.className,
22
+ css = _ref.css,
22
23
  _ref$checkableType = _ref.checkableType,
23
24
  checkableType = _ref$checkableType === void 0 ? 'radio' : _ref$checkableType,
24
25
  label = _ref.label,
@@ -31,7 +32,7 @@ export var EuiCheckableCard = function EuiCheckableCard(_ref) {
31
32
 
32
33
  var euiThemeContext = useEuiTheme();
33
34
  var styles = euiCheckableCardStyles(euiThemeContext);
34
- var baseStyles = [styles.euiCheckableCard, checked && !disabled && styles.isChecked];
35
+ var baseStyles = [styles.euiCheckableCard, checked && !disabled && styles.isChecked, css];
35
36
  var labelStyles = [styles.label.euiCheckableCard__label, disabled && styles.label.isDisabled];
36
37
  var childStyles = [styles.euiCheckableCard__children];
37
38
  var id = rest.id;
@@ -0,0 +1,34 @@
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 { EuiContextMenuItem } from './context_menu_item';
11
+ import { EuiContextMenuPanel } from './context_menu_panel';
12
+ import { jsx as ___EmotionJSX } from "@emotion/react";
13
+ var items = [___EmotionJSX(EuiContextMenuItem, {
14
+ key: "A",
15
+ "data-test-subj": "itemA"
16
+ }, "Option A"), ___EmotionJSX(EuiContextMenuItem, {
17
+ key: "B",
18
+ "data-test-subj": "itemB"
19
+ }, "Option B"), ___EmotionJSX(EuiContextMenuItem, {
20
+ key: "C",
21
+ "data-test-subj": "itemC"
22
+ }, "Option C")];
23
+ describe('EuiContextMenuPanel', function () {
24
+ describe('Automated accessibility check', function () {
25
+ it('has zero violations', function () {
26
+ var showNextPanelHandler = cy.stub();
27
+ cy.mount(___EmotionJSX(EuiContextMenuPanel, {
28
+ items: items,
29
+ showNextPanel: showNextPanelHandler
30
+ }));
31
+ cy.checkAxe();
32
+ });
33
+ });
34
+ });
@@ -6,6 +6,7 @@
6
6
  * Side Public License, v 1.
7
7
  */
8
8
  import React from 'react';
9
+ import { EuiScreenReaderOnly } from '../../accessibility';
9
10
  import { IS_JEST_ENVIRONMENT } from '../../../utils'; // When below this number the grid only shows the right control icon buttons
10
11
 
11
12
  import { jsx as ___EmotionJSX } from "@emotion/react";
@@ -17,6 +18,7 @@ export var EuiDataGridToolbar = function EuiDataGridToolbar(_ref) {
17
18
  toolbarVisibility = _ref.toolbarVisibility,
18
19
  isFullScreen = _ref.isFullScreen,
19
20
  fullScreenSelector = _ref.fullScreenSelector,
21
+ keyboardShortcuts = _ref.keyboardShortcuts,
20
22
  displaySelector = _ref.displaySelector,
21
23
  columnSelector = _ref.columnSelector,
22
24
  columnSorting = _ref.columnSorting;
@@ -24,12 +26,14 @@ export var EuiDataGridToolbar = function EuiDataGridToolbar(_ref) {
24
26
  var hasRoomForGridControls = IS_JEST_ENVIRONMENT ? true : gridWidth > minSizeForControls || isFullScreen;
25
27
  return ___EmotionJSX("div", {
26
28
  className: "euiDataGrid__controls",
27
- "data-test-sub": "dataGridControls"
29
+ "data-test-subj": "dataGridControls"
28
30
  }, hasRoomForGridControls && ___EmotionJSX("div", {
29
31
  className: "euiDataGrid__leftControls"
30
32
  }, renderAdditionalControls(toolbarVisibility, 'left.prepend'), checkOrDefaultToolBarDisplayOptions(toolbarVisibility, 'showColumnSelector') ? columnSelector : null, checkOrDefaultToolBarDisplayOptions(toolbarVisibility, 'showSortSelector') ? columnSorting : null, renderAdditionalControls(toolbarVisibility, 'left.append')), ___EmotionJSX("div", {
31
33
  className: "euiDataGrid__rightControls"
32
- }, renderAdditionalControls(toolbarVisibility, 'right'), checkOrDefaultToolBarDisplayOptions(toolbarVisibility, 'showDisplaySelector') ? displaySelector : null, checkOrDefaultToolBarDisplayOptions(toolbarVisibility, 'showFullScreenSelector') ? fullScreenSelector : null));
34
+ }, renderAdditionalControls(toolbarVisibility, 'right'), checkOrDefaultToolBarDisplayOptions(toolbarVisibility, 'showKeyboardShortcuts') ? keyboardShortcuts : ___EmotionJSX(EuiScreenReaderOnly, {
35
+ showOnFocus: true
36
+ }, ___EmotionJSX("span", null, keyboardShortcuts)), checkOrDefaultToolBarDisplayOptions(toolbarVisibility, 'showDisplaySelector') ? displaySelector : null, checkOrDefaultToolBarDisplayOptions(toolbarVisibility, 'showFullScreenSelector') ? fullScreenSelector : null));
33
37
  };
34
38
  /**
35
39
  * Toolbar utilities
@@ -8,5 +8,6 @@
8
8
  export { useDataGridColumnSelector } from './column_selector';
9
9
  export { useDataGridColumnSorting } from './column_sorting';
10
10
  export { useDataGridDisplaySelector, startingStyles } from './display_selector';
11
+ export { useDataGridKeyboardShortcuts } from './keyboard_shortcuts';
11
12
  export { useDataGridFullScreenSelector } from './fullscreen_selector';
12
13
  export { checkOrDefaultToolBarDisplayOptions, EuiDataGridToolbar } from './data_grid_toolbar';
@@ -0,0 +1,181 @@
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
+ import React, { useState, useMemo } from 'react';
11
+ import { useGeneratedHtmlId } from '../../../services';
12
+ import { EuiButtonIcon } from '../../button';
13
+ import { EuiToolTip } from '../../tool_tip';
14
+ import { EuiPopover, EuiPopoverTitle } from '../../popover';
15
+ import { EuiDescriptionList } from '../../description_list';
16
+ import { EuiText } from '../../text';
17
+ import { useEuiI18n, EuiI18n } from '../../i18n';
18
+ import { jsx as ___EmotionJSX } from "@emotion/react";
19
+ export var useDataGridKeyboardShortcuts = function useDataGridKeyboardShortcuts() {
20
+ var _useState = useState(false),
21
+ _useState2 = _slicedToArray(_useState, 2),
22
+ isOpen = _useState2[0],
23
+ setIsOpen = _useState2[1];
24
+
25
+ var title = useEuiI18n('euiKeyboardShortcuts.title', 'Keyboard shortcuts');
26
+ var titleId = useGeneratedHtmlId();
27
+ var keyboardShortcuts = useMemo(function () {
28
+ return ___EmotionJSX(EuiPopover, {
29
+ "data-test-subj": "dataGridKeyboardShortcutsPopover",
30
+ isOpen: isOpen,
31
+ closePopover: function closePopover() {
32
+ return setIsOpen(false);
33
+ },
34
+ anchorPosition: "downRight",
35
+ button: ___EmotionJSX(EuiToolTip, {
36
+ content: title,
37
+ delay: "long"
38
+ }, ___EmotionJSX(EuiButtonIcon, {
39
+ size: "xs",
40
+ iconType: "keyboard",
41
+ color: "text",
42
+ "data-test-subj": "dataGridKeyboardShortcutsButton",
43
+ onClick: function onClick() {
44
+ return setIsOpen(!isOpen);
45
+ },
46
+ "aria-label": title
47
+ }))
48
+ }, ___EmotionJSX(EuiPopoverTitle, {
49
+ paddingSize: "s"
50
+ }, ___EmotionJSX("h2", {
51
+ id: titleId
52
+ }, title)), ___EmotionJSX(EuiText, {
53
+ className: "euiDataGrid__keyboardShortcuts",
54
+ size: "xs"
55
+ }, ___EmotionJSX(EuiDescriptionList, {
56
+ "aria-labelledby": titleId,
57
+ type: "column",
58
+ align: "center",
59
+ compressed: true,
60
+ gutterSize: "s",
61
+ listItems: [{
62
+ title: ___EmotionJSX("kbd", null, ___EmotionJSX(EuiI18n, {
63
+ token: "euiKeyboardShortcuts.upArrowTitle",
64
+ default: "Up arrow"
65
+ })),
66
+ description: ___EmotionJSX(EuiI18n, {
67
+ token: "euiKeyboardShortcuts.upArrowDescription",
68
+ default: "Move one cell up"
69
+ })
70
+ }, {
71
+ title: ___EmotionJSX("kbd", null, ___EmotionJSX(EuiI18n, {
72
+ token: "euiKeyboardShortcuts.downArrowTitle",
73
+ default: "Down arrow"
74
+ })),
75
+ description: ___EmotionJSX(EuiI18n, {
76
+ token: "euiKeyboardShortcuts.downArrowDescription",
77
+ default: "Move one cell down"
78
+ })
79
+ }, {
80
+ title: ___EmotionJSX("kbd", null, ___EmotionJSX(EuiI18n, {
81
+ token: "euiKeyboardShortcuts.rightArrowTitle",
82
+ default: "Right arrow"
83
+ })),
84
+ description: ___EmotionJSX(EuiI18n, {
85
+ token: "euiKeyboardShortcuts.rightArrowDescription",
86
+ default: "Move one cell right"
87
+ })
88
+ }, {
89
+ title: ___EmotionJSX("kbd", null, ___EmotionJSX(EuiI18n, {
90
+ token: "euiKeyboardShortcuts.leftArrowTitle",
91
+ default: "Left arrow"
92
+ })),
93
+ description: ___EmotionJSX(EuiI18n, {
94
+ token: "euiKeyboardShortcuts.leftArrowDescription",
95
+ default: "Move one cell left"
96
+ })
97
+ }, {
98
+ title: ___EmotionJSX("kbd", null, ___EmotionJSX(EuiI18n, {
99
+ token: "euiKeyboardShortcuts.homeTitle",
100
+ default: "Home"
101
+ })),
102
+ description: ___EmotionJSX(EuiI18n, {
103
+ token: "euiKeyboardShortcuts.homeDescription",
104
+ default: "Move to the first cell of the current row"
105
+ })
106
+ }, {
107
+ title: ___EmotionJSX("kbd", null, ___EmotionJSX(EuiI18n, {
108
+ token: "euiKeyboardShortcuts.endTitle",
109
+ default: "End"
110
+ })),
111
+ description: ___EmotionJSX(EuiI18n, {
112
+ token: "euiKeyboardShortcuts.endDescription",
113
+ default: "Move to the last cell of the current row"
114
+ })
115
+ }, {
116
+ title: ___EmotionJSX(React.Fragment, null, ___EmotionJSX("kbd", null, ___EmotionJSX(EuiI18n, {
117
+ token: "euiKeyboardShortcuts.ctrl",
118
+ default: "Ctrl"
119
+ })), ' ', ___EmotionJSX("kbd", null, ___EmotionJSX(EuiI18n, {
120
+ token: "euiKeyboardShortcuts.homeTitle",
121
+ default: "Home"
122
+ }))),
123
+ description: ___EmotionJSX(EuiI18n, {
124
+ token: "euiKeyboardShortcuts.ctrlHomeDescription",
125
+ default: "Move to the first cell of the current page"
126
+ })
127
+ }, {
128
+ title: ___EmotionJSX(React.Fragment, null, ___EmotionJSX("kbd", null, ___EmotionJSX(EuiI18n, {
129
+ token: "euiKeyboardShortcuts.ctrl",
130
+ default: "Ctrl"
131
+ })), ' ', ___EmotionJSX("kbd", null, ___EmotionJSX(EuiI18n, {
132
+ token: "euiKeyboardShortcuts.endTitle",
133
+ default: "End"
134
+ }))),
135
+ description: ___EmotionJSX(EuiI18n, {
136
+ token: "euiKeyboardShortcuts.ctrlEndDescription",
137
+ default: "Move to the last cell of the current page"
138
+ })
139
+ }, {
140
+ title: ___EmotionJSX("kbd", null, ___EmotionJSX(EuiI18n, {
141
+ token: "euiKeyboardShortcuts.pageUpTitle",
142
+ default: "Page Up"
143
+ })),
144
+ description: ___EmotionJSX(EuiI18n, {
145
+ token: "euiKeyboardShortcuts.pageUpDescription",
146
+ default: "Go to the last row of the previous page"
147
+ })
148
+ }, {
149
+ title: ___EmotionJSX("kbd", null, ___EmotionJSX(EuiI18n, {
150
+ token: "euiKeyboardShortcuts.pageDownTitle",
151
+ default: "Page Down"
152
+ })),
153
+ description: ___EmotionJSX(EuiI18n, {
154
+ token: "euiKeyboardShortcuts.pageDownDescription",
155
+ default: "Go to the first row of the next page"
156
+ })
157
+ }, {
158
+ title: ___EmotionJSX("kbd", null, ___EmotionJSX(EuiI18n, {
159
+ token: "euiKeyboardShortcuts.enterTitle",
160
+ default: "Enter"
161
+ })),
162
+ description: ___EmotionJSX(EuiI18n, {
163
+ token: "euiKeyboardShortcuts.enterDescription",
164
+ default: "Open cell details and actions"
165
+ })
166
+ }, {
167
+ title: ___EmotionJSX("kbd", null, ___EmotionJSX(EuiI18n, {
168
+ token: "euiKeyboardShortcuts.escapeTitle",
169
+ default: "Escape"
170
+ })),
171
+ description: ___EmotionJSX(EuiI18n, {
172
+ token: "euiKeyboardShortcuts.escapeDescription",
173
+ default: "Close cell details and actions"
174
+ })
175
+ }]
176
+ })));
177
+ }, [isOpen, title, titleId]);
178
+ return {
179
+ keyboardShortcuts: keyboardShortcuts
180
+ };
181
+ };