@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
@@ -25,7 +25,7 @@ import { EuiI18n, useEuiI18n } from '../i18n';
25
25
  import { useMutationObserver } from '../observer/mutation_observer';
26
26
  import { useResizeObserver } from '../observer/resize_observer';
27
27
  import { EuiDataGridBody } from './body';
28
- import { useDataGridColumnSelector, useDataGridColumnSorting, useDataGridDisplaySelector, startingStyles, useDataGridFullScreenSelector, checkOrDefaultToolBarDisplayOptions, EuiDataGridToolbar } from './controls';
28
+ import { useDataGridColumnSelector, useDataGridColumnSorting, useDataGridDisplaySelector, startingStyles, useDataGridFullScreenSelector, useDataGridKeyboardShortcuts, checkOrDefaultToolBarDisplayOptions, EuiDataGridToolbar } from './controls';
29
29
  import { DataGridSortingContext, useSorting } from './utils/sorting';
30
30
  import { DataGridFocusContext, useFocus, createKeyDownHandler, preventTabbing } from './utils/focus';
31
31
  import { useInMemoryValues, EuiDataGridInMemoryRenderer } from './utils/in_memory';
@@ -215,12 +215,15 @@ export var EuiDataGrid = /*#__PURE__*/forwardRef(function (props, ref) {
215
215
  cellPopoverContext = _useCellPopover.cellPopoverContext,
216
216
  cellPopover = _useCellPopover.cellPopover;
217
217
  /**
218
- * Toolbar & fullscreen
218
+ * Toolbar, keyboard shortcuts, & fullscreen
219
219
  */
220
220
 
221
221
 
222
222
  var showToolbar = !!toolbarVisibility;
223
223
 
224
+ var _useDataGridKeyboardS = useDataGridKeyboardShortcuts(),
225
+ keyboardShortcuts = _useDataGridKeyboardS.keyboardShortcuts;
226
+
224
227
  var _useDataGridFullScree = useDataGridFullScreenSelector(),
225
228
  isFullScreen = _useDataGridFullScree.isFullScreen,
226
229
  setIsFullScreen = _useDataGridFullScree.setIsFullScreen,
@@ -309,6 +312,7 @@ export var EuiDataGrid = /*#__PURE__*/forwardRef(function (props, ref) {
309
312
  toolbarVisibility: toolbarVisibility,
310
313
  isFullScreen: isFullScreen,
311
314
  fullScreenSelector: fullScreenSelector,
315
+ keyboardShortcuts: keyboardShortcuts,
312
316
  displaySelector: displaySelector,
313
317
  columnSelector: columnSelector,
314
318
  columnSorting: columnSorting
@@ -255,7 +255,8 @@ export var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
255
255
  locale = _this$props2.locale,
256
256
  timeFormat = _this$props2.timeFormat,
257
257
  utcOffset = _this$props2.utcOffset,
258
- compressed = _this$props2.compressed;
258
+ compressed = _this$props2.compressed,
259
+ onFocus = _this$props2.onFocus;
259
260
 
260
261
  if (showPrettyDuration && !isStartDatePopoverOpen && !isEndDatePopoverOpen) {
261
262
  return ___EmotionJSX(EuiDatePickerRange, {
@@ -270,7 +271,8 @@ export var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
270
271
  }),
271
272
  "data-test-subj": "superDatePickerShowDatesButton",
272
273
  disabled: isDisabled,
273
- onClick: _this.hidePrettyDuration
274
+ onClick: _this.hidePrettyDuration,
275
+ onFocus: onFocus
274
276
  }, ___EmotionJSX(PrettyDuration, {
275
277
  timeFrom: start,
276
278
  timeTo: end,
@@ -303,7 +305,10 @@ export var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
303
305
  isOpen: _this.state.isStartDatePopoverOpen,
304
306
  onPopoverToggle: _this.onStartDatePopoverToggle,
305
307
  onPopoverClose: _this.onStartDatePopoverClose,
306
- timeOptions: timeOptions
308
+ timeOptions: timeOptions,
309
+ buttonProps: {
310
+ onFocus: onFocus
311
+ }
307
312
  }),
308
313
  endDateControl: ___EmotionJSX(EuiDatePopoverButton, {
309
314
  position: "end",
@@ -321,7 +326,10 @@ export var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
321
326
  isOpen: _this.state.isEndDatePopoverOpen,
322
327
  onPopoverToggle: _this.onEndDatePopoverToggle,
323
328
  onPopoverClose: _this.onEndDatePopoverClose,
324
- timeOptions: timeOptions
329
+ timeOptions: timeOptions,
330
+ buttonProps: {
331
+ onFocus: onFocus
332
+ }
325
333
  })
326
334
  });
327
335
  });
@@ -42,12 +42,11 @@ export var EuiPageSection = function EuiPageSection(_ref) {
42
42
  var colors = useEuiBackgroundColorCSS();
43
43
  var cssStyles = [styles.euiPageSection, grow && styles.grow, inlinePadding[paddingSize], bottomBorder === 'extended' && styles.border, alignment && styles[alignment], colors[color]];
44
44
  var contentStyles = euiPageSectionContentStyles();
45
- var cssContentStyles = [contentStyles.euiPageSection__content, blockPadding[paddingSize], bottomBorder === true && styles.border, alignment.toLowerCase().includes('center') && contentStyles.center, restrictWidth && contentStyles.restrictWidth];
45
+ var cssContentStyles = [contentStyles.euiPageSection__content, blockPadding[paddingSize], bottomBorder === true && styles.border, alignment.toLowerCase().includes('center') && contentStyles.center, restrictWidth && contentStyles.restrictWidth, (contentProps === null || contentProps === void 0 ? void 0 : contentProps.css) && contentProps.css];
46
46
  return ___EmotionJSX(Component, _extends({
47
47
  css: cssStyles
48
- }, rest), ___EmotionJSX("div", _extends({
49
- css: cssContentStyles
50
- }, contentProps, {
48
+ }, rest), ___EmotionJSX("div", _extends({}, contentProps, {
49
+ css: cssContentStyles,
51
50
  style: widthStyles
52
51
  }), children));
53
52
  };
@@ -0,0 +1,107 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import _extends from "@babel/runtime/helpers/extends";
3
+
4
+ /*
5
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
6
+ * or more contributor license agreements. Licensed under the Elastic License
7
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
8
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
9
+ * Side Public License, v 1.
10
+ */
11
+ /// <reference types="../../../cypress/support"/>
12
+ import React, { useState } from 'react';
13
+ import { EuiButton } from '../button';
14
+ import { EuiPopover } from '../popover';
15
+ import { EuiSelectable } from './selectable';
16
+ import { jsx as ___EmotionJSX } from "@emotion/react";
17
+ var options = [{
18
+ label: 'Titan',
19
+ 'data-test-subj': 'titanOption'
20
+ }, {
21
+ label: 'Enceladus'
22
+ }, {
23
+ label: "Pandora is one of Saturn's moons, named for a Titaness of Greek mythology"
24
+ }];
25
+
26
+ var EuiSelectableListboxOnly = function EuiSelectableListboxOnly(args) {
27
+ return ___EmotionJSX(EuiSelectable, _extends({
28
+ options: options
29
+ }, args), function (list) {
30
+ return ___EmotionJSX(React.Fragment, null, list);
31
+ });
32
+ };
33
+
34
+ var EuiSelectableWithSearchInput = function EuiSelectableWithSearchInput(args) {
35
+ return ___EmotionJSX(EuiSelectable, _extends({
36
+ searchable: true,
37
+ options: options
38
+ }, args), function (list, search) {
39
+ return ___EmotionJSX(React.Fragment, null, search, list);
40
+ });
41
+ };
42
+
43
+ describe('EuiSelectable', function () {
44
+ describe('with a `searchable` configuration', function () {
45
+ it('has no accessibility errors', function () {
46
+ var onChange = cy.stub();
47
+ cy.realMount(___EmotionJSX(EuiSelectableWithSearchInput, {
48
+ onChange: onChange
49
+ }));
50
+ cy.checkAxe();
51
+ });
52
+ });
53
+ describe('without a `searchable` configuration', function () {
54
+ it('has no accessibility errors', function () {
55
+ var onChange = cy.stub();
56
+ cy.realMount(___EmotionJSX(EuiSelectableListboxOnly, {
57
+ "aria-label": "No search box",
58
+ onChange: onChange
59
+ }));
60
+ cy.checkAxe();
61
+ });
62
+ });
63
+ describe('nested in `EuiPopover` component', function () {
64
+ var EuiSelectableNested = function EuiSelectableNested() {
65
+ var _useState = useState(false),
66
+ _useState2 = _slicedToArray(_useState, 2),
67
+ isPopoverOpen = _useState2[0],
68
+ setIsPopoverOpen = _useState2[1];
69
+
70
+ var onChange = function onChange() {};
71
+
72
+ var onClosePopover = function onClosePopover() {};
73
+
74
+ var onButtonClick = function onButtonClick() {
75
+ setIsPopoverOpen(!isPopoverOpen);
76
+ };
77
+
78
+ var button = ___EmotionJSX(EuiButton, {
79
+ iconType: "arrowDown",
80
+ iconSide: "right",
81
+ onClick: onButtonClick
82
+ }, "Show popover");
83
+
84
+ return ___EmotionJSX(EuiPopover, {
85
+ id: "data-cy-popover-1",
86
+ panelPaddingSize: "s",
87
+ button: button,
88
+ isOpen: isPopoverOpen,
89
+ closePopover: onClosePopover
90
+ }, ___EmotionJSX(EuiSelectableWithSearchInput, {
91
+ "aria-label": "With popover",
92
+ options: options,
93
+ onChange: onChange
94
+ }, function (list) {
95
+ return ___EmotionJSX(React.Fragment, null, list);
96
+ }));
97
+ };
98
+
99
+ it('has no accessibility errors', function () {
100
+ cy.realMount(___EmotionJSX(EuiSelectableNested, null));
101
+ cy.get('button').realClick();
102
+ cy.get('li[role=option]').first(); // Make sure the EuiSelectable is rendered before a11y check
103
+
104
+ cy.checkAxe();
105
+ });
106
+ });
107
+ });
@@ -575,25 +575,28 @@ export var EuiSelectable = /*#__PURE__*/function (_Component) {
575
575
  }], [{
576
576
  key: "getDerivedStateFromProps",
577
577
  value: function getDerivedStateFromProps(nextProps, prevState) {
578
+ var _stateUpdate$searchVa;
579
+
578
580
  var options = nextProps.options,
579
581
  isPreFiltered = nextProps.isPreFiltered,
580
582
  searchProps = nextProps.searchProps;
581
583
  var activeOptionIndex = prevState.activeOptionIndex,
582
584
  searchValue = prevState.searchValue;
583
- var matchingOptions = getMatchingOptions(options, searchValue, isPreFiltered);
584
585
  var stateUpdate = {
585
- visibleOptions: matchingOptions,
586
+ searchValue: searchValue,
586
587
  activeOptionIndex: activeOptionIndex
587
588
  };
588
589
 
589
- if (activeOptionIndex != null && activeOptionIndex >= matchingOptions.length) {
590
- stateUpdate.activeOptionIndex = -1;
591
- }
592
-
593
590
  if ((searchProps === null || searchProps === void 0 ? void 0 : searchProps.value) != null && searchProps.value !== searchValue) {
594
591
  stateUpdate.searchValue = searchProps.value;
595
592
  }
596
593
 
594
+ stateUpdate.visibleOptions = getMatchingOptions(options, (_stateUpdate$searchVa = stateUpdate.searchValue) !== null && _stateUpdate$searchVa !== void 0 ? _stateUpdate$searchVa : '', isPreFiltered);
595
+
596
+ if (activeOptionIndex != null && activeOptionIndex >= stateUpdate.visibleOptions.length) {
597
+ stateUpdate.activeOptionIndex = -1;
598
+ }
599
+
597
600
  return stateUpdate;
598
601
  }
599
602
  }]);
@@ -25,7 +25,8 @@ export var EuiTab = function EuiTab(_ref) {
25
25
  rel = _ref.rel,
26
26
  prepend = _ref.prepend,
27
27
  append = _ref.append,
28
- size = _ref.size,
28
+ _ref$size = _ref.size,
29
+ size = _ref$size === void 0 ? 'm' : _ref$size,
29
30
  expand = _ref.expand,
30
31
  rest = _objectWithoutProperties(_ref, _excluded);
31
32
 
@@ -37,13 +38,17 @@ export var EuiTab = function EuiTab(_ref) {
37
38
  'euiTab-isSelected': isSelected
38
39
  });
39
40
  var tabStyles = euiTabStyles(euiTheme);
40
- var cssTabStyles = [tabStyles.euiTab, expand && tabStyles.expanded, isSelected && tabStyles.selected, disabled && tabStyles.disabled, size && tabStyles[size]];
41
+ var cssTabStyles = [tabStyles.euiTab, expand && tabStyles.expanded, disabled && tabStyles.disabled.disabled, isSelected && (disabled ? tabStyles.disabled.selected : tabStyles.selected)];
41
42
  var tabContentStyles = euiTabContentStyles(euiTheme);
42
43
  var cssTabContentStyles = [tabContentStyles.euiTab__content, size && tabContentStyles[size], isSelected && tabContentStyles.selected, disabled && tabContentStyles.disabled];
43
44
 
44
- var prependNode = prepend && ___EmotionJSX("span", null, prepend);
45
+ var prependNode = prepend && ___EmotionJSX("span", {
46
+ className: "euiTab__prepend"
47
+ }, prepend);
45
48
 
46
- var appendNode = append && ___EmotionJSX("span", null, append); // <a> elements don't respect the `disabled` attribute. So if we're disabled, we'll just pretend
49
+ var appendNode = append && ___EmotionJSX("span", {
50
+ className: "euiTab__append"
51
+ }, append); // <a> elements don't respect the `disabled` attribute. So if we're disabled, we'll just pretend
47
52
  // this is a button and piggyback off its disabled styles.
48
53
 
49
54
 
@@ -8,9 +8,10 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
8
8
  * Side Public License, v 1.
9
9
  */
10
10
  import { css } from '@emotion/react';
11
+ import { logicalCSS, mathWithUnits } from '../../global_styling';
11
12
  import { euiTitle } from '../title/title.styles';
12
13
 
13
- var _ref = process.env.NODE_ENV === "production" ? {
14
+ var _ref2 = process.env.NODE_ENV === "production" ? {
14
15
  name: "10tso78-expanded",
15
16
  styles: "flex-basis:0%;flex-grow:1;justify-content:center;label:expanded;"
16
17
  } : {
@@ -19,32 +20,44 @@ var _ref = process.env.NODE_ENV === "production" ? {
19
20
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
20
21
  };
21
22
 
22
- export var euiTabStyles = function euiTabStyles(_ref2) {
23
- var euiTheme = _ref2.euiTheme;
23
+ export var euiTabStyles = function euiTabStyles(_ref3) {
24
+ var euiTheme = _ref3.euiTheme;
24
25
  return {
25
- euiTab: /*#__PURE__*/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;"),
26
- // sizes
27
- s: /*#__PURE__*/css("padding:0 ", euiTheme.size.xs, ";;label:s;"),
28
- m: /*#__PURE__*/css("padding:0 ", euiTheme.size.xs, ";;label:m;"),
29
- l: /*#__PURE__*/css("padding:0 ", euiTheme.size.xs, ";;label:l;"),
30
- xl: /*#__PURE__*/css("padding:", euiTheme.size.s, " ", euiTheme.size.xs, ";;label:xl;"),
26
+ euiTab: /*#__PURE__*/css("display:flex;cursor:pointer;flex-direction:row;align-items:center;font-weight:", euiTheme.font.weight.semiBold, ";gap:", euiTheme.size.s, ";", logicalCSS('padding-vertical', 0), " ", logicalCSS('padding-horizontal', euiTheme.size.xs), " &:focus{background-color:transparent;outline-offset:-", euiTheme.focus.width, ";};label:euiTab;"),
31
27
  // variations
32
- expanded: _ref,
33
- selected: /*#__PURE__*/css("box-shadow:inset 0 calc(", euiTheme.border.width.thick, " * -1) 0 ", euiTheme.colors.primary, ";;label:selected;"),
34
- disabled: /*#__PURE__*/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;")
28
+ expanded: _ref2,
29
+ selected: /*#__PURE__*/css("box-shadow:inset 0 -", euiTheme.border.width.thick, " 0 ", euiTheme.colors.primary, ";;label:selected;"),
30
+ disabled: {
31
+ disabled: /*#__PURE__*/css("cursor:not-allowed;color:", euiTheme.colors.disabledText, ";;label:disabled;"),
32
+ selected: /*#__PURE__*/css("box-shadow:inset 0 -", euiTheme.border.width.thick, " 0 ", euiTheme.colors.disabledText, ";;label:selected;")
33
+ }
35
34
  };
36
35
  };
36
+
37
+ var _ref = process.env.NODE_ENV === "production" ? {
38
+ name: "1yhgei9-euiTab__content",
39
+ styles: "&:hover{text-decoration:none;};label:euiTab__content;"
40
+ } : {
41
+ name: "1yhgei9-euiTab__content",
42
+ styles: "&:hover{text-decoration:none;};label:euiTab__content;",
43
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
44
+ };
45
+
37
46
  export var euiTabContentStyles = function euiTabContentStyles(euiThemeContext) {
38
47
  var euiTheme = euiThemeContext.euiTheme;
39
48
  return {
40
- euiTab__content: /*#__PURE__*/css("color:", euiTheme.colors.disabledText, ";&:hover{text-decoration:none;};label:euiTab__content;"),
49
+ euiTab__content: _ref,
41
50
  // sizes
42
51
  s: /*#__PURE__*/css(euiTitle(euiThemeContext, 'xxxs'), ";line-height:", euiTheme.size.xl, ";;label:s;"),
43
52
  m: /*#__PURE__*/css(euiTitle(euiThemeContext, 'xxs'), ";line-height:", euiTheme.size.xxl, ";;label:m;"),
44
- l: /*#__PURE__*/css(euiTitle(euiThemeContext, 'xs'), ";line-height:calc(", euiTheme.size.xl, " + ", euiTheme.size.s, ");;label:l;"),
45
- xl: /*#__PURE__*/css(euiTitle(euiThemeContext, 's'), ";line-height:calc(", euiTheme.size.xxxl, " + ", euiTheme.size.s, ");;label:xl;"),
53
+ l: /*#__PURE__*/css(euiTitle(euiThemeContext, 'xs'), ";line-height:", mathWithUnits([euiTheme.size.xl, euiTheme.size.s], function (x, y) {
54
+ return x + y;
55
+ }), ";;label:l;"),
56
+ xl: /*#__PURE__*/css(euiTitle(euiThemeContext, 's'), ";line-height:", mathWithUnits([euiTheme.size.xxxl, euiTheme.size.s], function (x, y) {
57
+ return x + y;
58
+ }), ";;label:xl;"),
46
59
  // variations
47
60
  selected: /*#__PURE__*/css("color:", euiTheme.colors.primaryText, ";;label:selected;"),
48
- disabled: /*#__PURE__*/css("color:", euiTheme.colors.disabledText, ";&:hover{text-decoration:none;};label:disabled;")
61
+ disabled: /*#__PURE__*/css("color:", euiTheme.colors.disabledText, ";;label:disabled;")
49
62
  };
50
63
  };
@@ -29,8 +29,8 @@ export var EuiTabs = /*#__PURE__*/forwardRef(function (_ref, ref) {
29
29
 
30
30
  var euiTheme = useEuiTheme();
31
31
  var classes = classNames('euiTabs', className);
32
- var tabsStyles = euiTabsStyles(euiTheme);
33
- var computedStyles = [tabsStyles.euiTabs, tabsStyles[size], bottomBorder && tabsStyles.bottomBorder];
32
+ var styles = euiTabsStyles(euiTheme);
33
+ var cssStyles = [styles.euiTabs, styles[size], bottomBorder && styles.bottomBorder];
34
34
  var tabItems = React.Children.map(children, function (child) {
35
35
  if ( /*#__PURE__*/React.isValidElement(child)) {
36
36
  return cloneElementWithCss(child, {
@@ -43,7 +43,7 @@ export var EuiTabs = /*#__PURE__*/forwardRef(function (_ref, ref) {
43
43
  return ___EmotionJSX("div", _extends({
44
44
  ref: ref,
45
45
  className: classes,
46
- css: computedStyles
46
+ css: cssStyles
47
47
  }, children && {
48
48
  role: 'tablist'
49
49
  }, rest), tabItems);
@@ -6,14 +6,12 @@
6
6
  * Side Public License, v 1.
7
7
  */
8
8
  import { css } from '@emotion/react';
9
- import { logicalCSS, logicalCSSWithFallback, mathWithUnits } from '../../global_styling';
9
+ import { logicalCSS, logicalCSSWithFallback } from '../../global_styling';
10
10
  export var euiTabsStyles = function euiTabsStyles(euiThemeContext) {
11
11
  var euiTheme = euiThemeContext.euiTheme;
12
12
  return {
13
13
  euiTabs: /*#__PURE__*/css("display:flex;", logicalCSS('max-width', '100%'), ";", logicalCSSWithFallback('overflow-x', 'auto'), ";", logicalCSSWithFallback('overflow-y', 'hidden'), ";position:relative;flex-shrink:0;;label:euiTabs;"),
14
- bottomBorder: /*#__PURE__*/css("box-shadow:inset 0 ", mathWithUnits(euiTheme.border.width.thin, function (x) {
15
- return x * -1;
16
- }), " 0 ", euiTheme.border.color, ";;label:bottomBorder;"),
14
+ bottomBorder: /*#__PURE__*/css("box-shadow:inset 0 -", euiTheme.border.width.thin, " 0 ", euiTheme.border.color, ";;label:bottomBorder;"),
17
15
  // sizes
18
16
  s: /*#__PURE__*/css("gap:", euiTheme.size.m, ";;label:s;"),
19
17
  m: /*#__PURE__*/css("gap:", euiTheme.size.base, ";;label:m;"),
@@ -22,7 +22,7 @@
22
22
  export var MAX_INITIALS = 2;
23
23
  export function toInitials(name, initialsLength, initials) {
24
24
  // Calculate the number of initials to show, maxing out at MAX_INITIALS
25
- var calculatedInitialsLength = initials ? initials.split(' ').length : name.split(' ').length;
25
+ var calculatedInitialsLength = initials ? initials.split('').length : name.split(' ').length;
26
26
  calculatedInitialsLength = calculatedInitialsLength > MAX_INITIALS ? MAX_INITIALS : calculatedInitialsLength; // Check if initialsLength was passed and set to calculated, unless greater than MAX_INITIALS
27
27
 
28
28
  if (initialsLength) {
@@ -33,7 +33,7 @@ exports.euiScreenReaderOnly = euiScreenReaderOnly;
33
33
 
34
34
  var euiScreenReaderOnlyStyles = function euiScreenReaderOnlyStyles(showOnFocus) {
35
35
  return {
36
- euiScreenReaderOnly: showOnFocus ? /*#__PURE__*/(0, _react.css)("&:not(:focus):not(:active){", euiScreenReaderOnly(), ";};label:euiScreenReaderOnly;") : /*#__PURE__*/(0, _react.css)(euiScreenReaderOnly(), ";label:euiScreenReaderOnly;")
36
+ euiScreenReaderOnly: showOnFocus ? /*#__PURE__*/(0, _react.css)("&:not(:focus):not(:active):not(:focus-within){", euiScreenReaderOnly(), ";};label:euiScreenReaderOnly;") : /*#__PURE__*/(0, _react.css)(euiScreenReaderOnly(), ";label:euiScreenReaderOnly;")
37
37
  };
38
38
  };
39
39
 
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _react = _interopRequireDefault(require("react"));
6
+
7
+ var _index = require("./index");
8
+
9
+ var _panel = require("../../components/panel");
10
+
11
+ var _services = require("../../services");
12
+
13
+ var _react2 = require("@emotion/react");
14
+
15
+ /*
16
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
17
+ * or more contributor license agreements. Licensed under the Elastic License
18
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
19
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
20
+ * Side Public License, v 1.
21
+ */
22
+ /// <reference types="../../../cypress/support"/>
23
+ var baseProps = {
24
+ buttonContent: 'Click me to toggle',
25
+ id: (0, _services.htmlIdGenerator)()(),
26
+ initialIsOpen: false
27
+ };
28
+ var noArrow = {
29
+ arrowDisplay: 'none'
30
+ };
31
+ var noArrowProps = Object.assign(baseProps, noArrow);
32
+ describe('EuiAccordion', function () {
33
+ describe('Automated accessibility check', function () {
34
+ it('has zero violations when expanded', function () {
35
+ cy.mount((0, _react2.jsx)(_index.EuiAccordion, noArrowProps, (0, _react2.jsx)(_panel.EuiPanel, {
36
+ color: "subdued"
37
+ }, "Any content inside of ", (0, _react2.jsx)("strong", null, "EuiAccordion"), " will appear here. We will include ", (0, _react2.jsx)("a", {
38
+ href: "#"
39
+ }, "a link"), " to confirm focus.")));
40
+ cy.get('button.euiAccordion__button').click();
41
+ cy.checkAxe();
42
+ });
43
+ });
44
+ });
@@ -7,7 +7,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
7
7
  Object.defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
10
- exports.LAYOUT_ALIGNMENTS = exports.EuiCard = exports.ALIGNMENTS = void 0;
10
+ exports.EuiCard = exports.ALIGNMENTS = void 0;
11
11
 
12
12
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
13
 
@@ -19,10 +19,10 @@ var _react = _interopRequireWildcard(require("react"));
19
19
 
20
20
  var _classnames = _interopRequireDefault(require("classnames"));
21
21
 
22
- var _common = require("../common");
23
-
24
22
  var _services = require("../../services");
25
23
 
24
+ var _clone_element = require("../../services/theme/clone_element");
25
+
26
26
  var _text = require("../text");
27
27
 
28
28
  var _title = require("../title");
@@ -54,23 +54,8 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
54
54
 
55
55
  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; }
56
56
 
57
- var textAlignToClassNameMap = {
58
- left: 'euiCard--leftAligned',
59
- center: 'euiCard--centerAligned',
60
- right: 'euiCard--rightAligned'
61
- };
62
- var ALIGNMENTS = (0, _common.keysOf)(textAlignToClassNameMap);
57
+ var ALIGNMENTS = ['left', 'center', 'right'];
63
58
  exports.ALIGNMENTS = ALIGNMENTS;
64
- var layoutToClassNameMap = {
65
- vertical: '',
66
- horizontal: 'euiCard--horizontal'
67
- };
68
- var LAYOUT_ALIGNMENTS = (0, _common.keysOf)(layoutToClassNameMap);
69
- /**
70
- * Certain props are only allowed when the layout is vertical
71
- */
72
-
73
- exports.LAYOUT_ALIGNMENTS = LAYOUT_ALIGNMENTS;
74
59
 
75
60
  var EuiCard = function EuiCard(_ref) {
76
61
  var className = _ref.className,
@@ -105,8 +90,9 @@ var EuiCard = function EuiCard(_ref) {
105
90
  var euiThemeContext = (0, _services.useEuiTheme)();
106
91
  var styles = (0, _card.euiCardStyles)(euiThemeContext, paddingSize);
107
92
  var cardStyles = [styles.card.euiCard, // Text alignment should always be left when horizontal
108
- styles.card.aligned[layout === 'horizontal' ? 'left' : textAlign], styles.card.layout[layout], isDisabled && styles.card.disabled];
93
+ styles.card.aligned[layout === 'horizontal' ? 'left' : textAlign], isDisabled && styles.card.disabled];
109
94
  var contentStyles = [styles.content.euiCard__content, styles.content.layout[layout]];
95
+ var mainStyles = [styles.main.euiCard__main, styles.main.layout[layout]];
110
96
  var textStyles = (0, _card.euiCardTextStyles)(euiThemeContext);
111
97
  var textCSS = [textStyles.euiCard__text, // Text alignment should always be left when horizontal
112
98
  textStyles.aligned[layout === 'horizontal' ? 'left' : textAlign], isClickable && textStyles.interactive, isDisabled && textStyles.disabled];
@@ -130,15 +116,7 @@ var EuiCard = function EuiCard(_ref) {
130
116
  }
131
117
  }
132
118
 
133
- var selectableColorClass = selectable ? "euiCard--isSelectable--".concat((0, _card_select.euiCardSelectableColor)(selectable.color, selectable.isSelected)) : undefined;
134
- var classes = (0, _classnames.default)('euiCard', textAlignToClassNameMap[textAlign], layoutToClassNameMap[layout], {
135
- 'euiCard--isClickable': isClickable,
136
- 'euiCard--hasBetaBadge': betaBadgeProps === null || betaBadgeProps === void 0 ? void 0 : betaBadgeProps.label,
137
- 'euiCard--hasIcon': icon,
138
- 'euiCard--isSelectable': selectable,
139
- 'euiCard-isSelected': selectable === null || selectable === void 0 ? void 0 : selectable.isSelected,
140
- 'euiCard-isDisabled': isDisabled
141
- }, selectableColorClass, className);
119
+ var classes = (0, _classnames.default)('euiCard', className);
142
120
  var ariaId = (0, _accessibility.useGeneratedHtmlId)();
143
121
  var ariaDesc = description ? "".concat(ariaId, "Description") : '';
144
122
  /**
@@ -166,7 +144,7 @@ var EuiCard = function EuiCard(_ref) {
166
144
 
167
145
  if (icon) {
168
146
  var iconStyles = [styles.icon.euiCard__icon, styles.icon.layout[layout], imageNode && styles.icon.withImage];
169
- iconNode = /*#__PURE__*/_react.default.cloneElement(icon, {
147
+ iconNode = (0, _clone_element.cloneElementWithCss)(icon, {
170
148
  className: (0, _classnames.default)(icon.props.className, 'euiCard__icon'),
171
149
  css: iconStyles
172
150
  });
@@ -320,14 +298,17 @@ var EuiCard = function EuiCard(_ref) {
320
298
  hasShadow: isDisabled || display ? false : true,
321
299
  hasBorder: display ? false : undefined,
322
300
  paddingSize: paddingSize
323
- }, rest), optionalCardTop, (0, _react2.jsx)("div", {
301
+ }, rest), (0, _react2.jsx)("div", {
302
+ className: "euiCard__main",
303
+ css: mainStyles
304
+ }, optionalCardTop, (0, _react2.jsx)("div", {
324
305
  className: "euiCard__content",
325
306
  css: contentStyles
326
307
  }, (0, _react2.jsx)(_title.EuiTitle, {
327
308
  id: "".concat(ariaId, "Title"),
328
309
  className: "euiCard__title",
329
310
  size: titleSize
330
- }, (0, _react2.jsx)(TitleElement, null, theTitle)), optionalDescription, optionalChildren), optionalBetaBadge, optionalFooter, optionalSelectButton);
311
+ }, (0, _react2.jsx)(TitleElement, null, theTitle)), optionalDescription, optionalChildren), optionalBetaBadge, optionalFooter), optionalSelectButton);
331
312
  };
332
313
 
333
314
  exports.EuiCard = EuiCard;
@@ -57,6 +57,15 @@ var _ref5 = process.env.NODE_ENV === "production" ? {
57
57
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
58
58
  };
59
59
 
60
+ var _ref6 = process.env.NODE_ENV === "production" ? {
61
+ name: "z24364-euiCard__main",
62
+ styles: "display:flex;label:euiCard__main;"
63
+ } : {
64
+ name: "z24364-euiCard__main",
65
+ styles: "display:flex;label:euiCard__main;",
66
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
67
+ };
68
+
60
69
  var euiCardStyles = function euiCardStyles(euiThemeContext, paddingSize) {
61
70
  var euiTheme = euiThemeContext.euiTheme;
62
71
  var paddingAmount = (0, _global_styling.euiPaddingSize)(euiThemeContext, paddingSize);
@@ -64,17 +73,20 @@ var euiCardStyles = function euiCardStyles(euiThemeContext, paddingSize) {
64
73
  var halfSpacing = (0, _global_styling.euiPaddingSize)(euiThemeContext, halfPaddingKey);
65
74
  return {
66
75
  card: {
67
- euiCard: /*#__PURE__*/(0, _react.css)("display:flex;&:has([class*='euiCard__text'][class*='-interactive']:focus:focus-visible){outline:", euiTheme.focus.width, " solid currentColor;};label:euiCard;"),
76
+ euiCard: /*#__PURE__*/(0, _react.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;"),
68
77
  aligned: {
69
78
  center: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalTextAlignCSS)('center'), ";align-items:center;;label:center;"),
70
79
  left: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalTextAlignCSS)('left'), ";align-items:flex-start;;label:left;"),
71
80
  right: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalTextAlignCSS)('right'), ";align-items:flex-end;;label:right;")
72
81
  },
82
+ disabled: /*#__PURE__*/(0, _react.css)("cursor:not-allowed;background-color:", (0, _mixins.euiButtonColor)(euiThemeContext, 'disabled'), ";color:", euiTheme.colors.disabledText, ";;label:disabled;")
83
+ },
84
+ main: {
85
+ euiCard__main: _ref6,
73
86
  layout: {
74
87
  vertical: _ref5,
75
88
  horizontal: _ref4
76
- },
77
- disabled: /*#__PURE__*/(0, _react.css)("cursor:not-allowed;background-color:", (0, _mixins.euiButtonColor)(euiThemeContext, 'disabled'), ";color:", euiTheme.colors.disabledText, ";;label:disabled;")
89
+ }
78
90
  },
79
91
  content: {
80
92
  euiCard__content: _ref3,
@@ -10,11 +10,11 @@ var _react = require("@emotion/react");
10
10
  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)."; }
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
 
@@ -27,7 +27,7 @@ var _checkable_card = require("./checkable_card.styles");
27
27
 
28
28
  var _react2 = require("@emotion/react");
29
29
 
30
- var _excluded = ["children", "className", "checkableType", "label", "checked", "disabled", "hasShadow", "hasBorder"];
30
+ var _excluded = ["children", "className", "css", "checkableType", "label", "checked", "disabled", "hasShadow", "hasBorder"];
31
31
 
32
32
  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); }
33
33
 
@@ -36,6 +36,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
36
36
  var EuiCheckableCard = function EuiCheckableCard(_ref) {
37
37
  var children = _ref.children,
38
38
  className = _ref.className,
39
+ css = _ref.css,
39
40
  _ref$checkableType = _ref.checkableType,
40
41
  checkableType = _ref$checkableType === void 0 ? 'radio' : _ref$checkableType,
41
42
  label = _ref.label,
@@ -47,7 +48,7 @@ var EuiCheckableCard = function EuiCheckableCard(_ref) {
47
48
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
48
49
  var euiThemeContext = (0, _services.useEuiTheme)();
49
50
  var styles = (0, _checkable_card.euiCheckableCardStyles)(euiThemeContext);
50
- var baseStyles = [styles.euiCheckableCard, checked && !disabled && styles.isChecked];
51
+ var baseStyles = [styles.euiCheckableCard, checked && !disabled && styles.isChecked, css];
51
52
  var labelStyles = [styles.label.euiCheckableCard__label, disabled && styles.label.isDisabled];
52
53
  var childStyles = [styles.euiCheckableCard__children];
53
54
  var id = rest.id;