@elastic/eui 70.1.0 → 70.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eui_theme_dark.css +11 -1
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +11 -1
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/accessibility/screen_reader_only/screen_reader_only.js +1 -1
- package/es/components/accessibility/screen_reader_only/screen_reader_only.styles.js +1 -1
- package/es/components/accordion/accordion.a11y.js +35 -0
- package/es/components/card/card.js +13 -31
- package/es/components/card/card.styles.js +15 -3
- package/es/components/card/card_select/card_select.styles.js +4 -4
- package/es/components/card/checkable_card/checkable_card.js +3 -2
- package/es/components/context_menu/context_menu_panel.a11y.js +34 -0
- package/es/components/datagrid/controls/data_grid_toolbar.js +6 -2
- package/es/components/datagrid/controls/index.js +1 -0
- package/es/components/datagrid/controls/keyboard_shortcuts.js +191 -0
- package/es/components/datagrid/data_grid.js +12 -2
- package/es/components/date_picker/super_date_picker/super_date_picker.js +22 -4
- package/es/components/selectable/selectable.a11y.js +118 -0
- package/es/components/selectable/selectable.js +9 -6
- package/es/components/tabs/tab.js +7 -3
- package/es/components/tabs/tab.styles.js +29 -16
- package/es/components/tabs/tabbed_content/tabbed_content.js +1 -1
- package/es/components/tabs/tabs.js +3 -3
- package/es/components/tabs/tabs.styles.js +2 -4
- package/es/services/string/to_initials.js +1 -1
- package/eui.d.ts +208 -164
- package/i18ntokens.json +438 -6
- package/lib/components/accessibility/screen_reader_only/screen_reader_only.js +1 -1
- package/lib/components/accessibility/screen_reader_only/screen_reader_only.styles.js +1 -1
- package/lib/components/accordion/accordion.a11y.js +44 -0
- package/lib/components/card/card.js +14 -33
- package/lib/components/card/card.styles.js +15 -3
- package/lib/components/card/card_select/card_select.styles.js +4 -4
- package/lib/components/card/checkable_card/checkable_card.js +3 -2
- package/lib/components/context_menu/context_menu_panel.a11y.js +42 -0
- package/lib/components/datagrid/controls/data_grid_toolbar.js +7 -2
- package/lib/components/datagrid/controls/index.js +8 -0
- package/lib/components/datagrid/controls/keyboard_shortcuts.js +208 -0
- package/lib/components/datagrid/data_grid.js +11 -1
- package/lib/components/date_picker/super_date_picker/super_date_picker.js +22 -4
- package/lib/components/selectable/selectable.a11y.js +122 -0
- package/lib/components/selectable/selectable.js +9 -6
- package/lib/components/tabs/tab.js +7 -3
- package/lib/components/tabs/tab.styles.js +29 -16
- package/lib/components/tabs/tabbed_content/tabbed_content.js +1 -1
- package/lib/components/tabs/tabs.js +3 -3
- package/lib/components/tabs/tabs.styles.js +1 -3
- package/lib/services/string/to_initials.js +1 -1
- package/optimize/es/components/accessibility/screen_reader_only/screen_reader_only.styles.js +1 -1
- package/optimize/es/components/accordion/accordion.a11y.js +35 -0
- package/optimize/es/components/card/card.js +12 -30
- package/optimize/es/components/card/card.styles.js +15 -3
- package/optimize/es/components/card/card_select/card_select.styles.js +4 -4
- package/optimize/es/components/card/checkable_card/checkable_card.js +3 -2
- package/optimize/es/components/context_menu/context_menu_panel.a11y.js +34 -0
- package/optimize/es/components/datagrid/controls/data_grid_toolbar.js +6 -2
- package/optimize/es/components/datagrid/controls/index.js +1 -0
- package/optimize/es/components/datagrid/controls/keyboard_shortcuts.js +181 -0
- package/optimize/es/components/datagrid/data_grid.js +6 -2
- package/optimize/es/components/date_picker/super_date_picker/super_date_picker.js +12 -4
- package/optimize/es/components/selectable/selectable.a11y.js +107 -0
- package/optimize/es/components/selectable/selectable.js +9 -6
- package/optimize/es/components/tabs/tab.js +7 -3
- package/optimize/es/components/tabs/tab.styles.js +29 -16
- package/optimize/es/components/tabs/tabs.js +3 -3
- package/optimize/es/components/tabs/tabs.styles.js +2 -4
- package/optimize/es/services/string/to_initials.js +1 -1
- package/optimize/lib/components/accessibility/screen_reader_only/screen_reader_only.styles.js +1 -1
- package/optimize/lib/components/accordion/accordion.a11y.js +44 -0
- package/optimize/lib/components/card/card.js +13 -32
- package/optimize/lib/components/card/card.styles.js +15 -3
- package/optimize/lib/components/card/card_select/card_select.styles.js +4 -4
- package/optimize/lib/components/card/checkable_card/checkable_card.js +3 -2
- package/optimize/lib/components/context_menu/context_menu_panel.a11y.js +42 -0
- package/optimize/lib/components/datagrid/controls/data_grid_toolbar.js +7 -2
- package/optimize/lib/components/datagrid/controls/index.js +8 -0
- package/optimize/lib/components/datagrid/controls/keyboard_shortcuts.js +207 -0
- package/optimize/lib/components/datagrid/data_grid.js +5 -1
- package/optimize/lib/components/date_picker/super_date_picker/super_date_picker.js +12 -4
- package/optimize/lib/components/selectable/selectable.a11y.js +122 -0
- package/optimize/lib/components/selectable/selectable.js +9 -6
- package/optimize/lib/components/tabs/tab.js +7 -3
- package/optimize/lib/components/tabs/tab.styles.js +29 -16
- package/optimize/lib/components/tabs/tabs.js +3 -3
- package/optimize/lib/components/tabs/tabs.styles.js +1 -3
- package/optimize/lib/services/string/to_initials.js +1 -1
- package/package.json +3 -2
- package/src/components/datagrid/_index.scss +1 -0
- package/src/components/datagrid/controls/_data_grid_keyboard_shortcuts.scss +17 -0
- package/src/components/modal/_modal.scss +3 -1
- package/test-env/components/accessibility/screen_reader_only/screen_reader_only.js +1 -1
- package/test-env/components/accessibility/screen_reader_only/screen_reader_only.styles.js +1 -1
- package/test-env/components/accordion/accordion.a11y.js +44 -0
- package/test-env/components/card/card.js +14 -33
- package/test-env/components/card/card.styles.js +15 -3
- package/test-env/components/card/card_select/card_select.styles.js +4 -4
- package/test-env/components/card/checkable_card/checkable_card.js +3 -2
- package/test-env/components/context_menu/context_menu_panel.a11y.js +42 -0
- package/test-env/components/datagrid/controls/data_grid_toolbar.js +7 -2
- package/test-env/components/datagrid/controls/index.js +8 -0
- package/test-env/components/datagrid/controls/keyboard_shortcuts.js +207 -0
- package/test-env/components/datagrid/data_grid.js +11 -1
- package/test-env/components/date_picker/super_date_picker/super_date_picker.js +22 -4
- package/test-env/components/selectable/selectable.a11y.js +122 -0
- package/test-env/components/selectable/selectable.js +9 -6
- package/test-env/components/tabs/tab.js +7 -3
- package/test-env/components/tabs/tab.styles.js +29 -16
- package/test-env/components/tabs/tabbed_content/tabbed_content.js +1 -1
- package/test-env/components/tabs/tabs.js +3 -3
- package/test-env/components/tabs/tabs.styles.js +1 -3
- package/test-env/services/string/to_initials.js +1 -1
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8
|
+
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
|
+
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
|
|
13
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
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
|
+
import React, { useState } from 'react';
|
|
24
|
+
import { EuiButton } from '../button';
|
|
25
|
+
import { EuiPopover } from '../popover';
|
|
26
|
+
import { EuiSelectable } from './selectable';
|
|
27
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
28
|
+
var options = [{
|
|
29
|
+
label: 'Titan',
|
|
30
|
+
'data-test-subj': 'titanOption'
|
|
31
|
+
}, {
|
|
32
|
+
label: 'Enceladus'
|
|
33
|
+
}, {
|
|
34
|
+
label: "Pandora is one of Saturn's moons, named for a Titaness of Greek mythology"
|
|
35
|
+
}];
|
|
36
|
+
|
|
37
|
+
var EuiSelectableListboxOnly = function EuiSelectableListboxOnly(args) {
|
|
38
|
+
return ___EmotionJSX(EuiSelectable, _extends({
|
|
39
|
+
options: options
|
|
40
|
+
}, args), function (list) {
|
|
41
|
+
return ___EmotionJSX(React.Fragment, null, list);
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
var EuiSelectableWithSearchInput = function EuiSelectableWithSearchInput(args) {
|
|
46
|
+
return ___EmotionJSX(EuiSelectable, _extends({
|
|
47
|
+
searchable: true,
|
|
48
|
+
options: options
|
|
49
|
+
}, args), function (list, search) {
|
|
50
|
+
return ___EmotionJSX(React.Fragment, null, search, list);
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
describe('EuiSelectable', function () {
|
|
55
|
+
describe('with a `searchable` configuration', function () {
|
|
56
|
+
it('has no accessibility errors', function () {
|
|
57
|
+
var onChange = cy.stub();
|
|
58
|
+
cy.realMount(___EmotionJSX(EuiSelectableWithSearchInput, {
|
|
59
|
+
onChange: onChange
|
|
60
|
+
}));
|
|
61
|
+
cy.checkAxe();
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
describe('without a `searchable` configuration', function () {
|
|
65
|
+
it('has no accessibility errors', function () {
|
|
66
|
+
var onChange = cy.stub();
|
|
67
|
+
cy.realMount(___EmotionJSX(EuiSelectableListboxOnly, {
|
|
68
|
+
"aria-label": "No search box",
|
|
69
|
+
onChange: onChange
|
|
70
|
+
}));
|
|
71
|
+
cy.checkAxe();
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
describe('nested in `EuiPopover` component', function () {
|
|
75
|
+
var EuiSelectableNested = function EuiSelectableNested() {
|
|
76
|
+
var _useState = useState(false),
|
|
77
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
78
|
+
isPopoverOpen = _useState2[0],
|
|
79
|
+
setIsPopoverOpen = _useState2[1];
|
|
80
|
+
|
|
81
|
+
var onChange = function onChange() {};
|
|
82
|
+
|
|
83
|
+
var onClosePopover = function onClosePopover() {};
|
|
84
|
+
|
|
85
|
+
var onButtonClick = function onButtonClick() {
|
|
86
|
+
setIsPopoverOpen(!isPopoverOpen);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
var button = ___EmotionJSX(EuiButton, {
|
|
90
|
+
iconType: "arrowDown",
|
|
91
|
+
iconSide: "right",
|
|
92
|
+
onClick: onButtonClick
|
|
93
|
+
}, "Show popover");
|
|
94
|
+
|
|
95
|
+
return ___EmotionJSX(EuiPopover, {
|
|
96
|
+
id: "data-cy-popover-1",
|
|
97
|
+
panelPaddingSize: "s",
|
|
98
|
+
button: button,
|
|
99
|
+
isOpen: isPopoverOpen,
|
|
100
|
+
closePopover: onClosePopover
|
|
101
|
+
}, ___EmotionJSX(EuiSelectableWithSearchInput, {
|
|
102
|
+
"aria-label": "With popover",
|
|
103
|
+
options: options,
|
|
104
|
+
onChange: onChange
|
|
105
|
+
}, function (list) {
|
|
106
|
+
return ___EmotionJSX(React.Fragment, null, list);
|
|
107
|
+
}));
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
it('has no accessibility errors', function () {
|
|
111
|
+
cy.realMount(___EmotionJSX(EuiSelectableNested, null));
|
|
112
|
+
cy.get('button').realClick();
|
|
113
|
+
cy.get('li[role=option]').first(); // Make sure the EuiSelectable is rendered before a11y check
|
|
114
|
+
|
|
115
|
+
cy.checkAxe();
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
});
|
|
@@ -604,25 +604,28 @@ export var EuiSelectable = /*#__PURE__*/function (_Component) {
|
|
|
604
604
|
}], [{
|
|
605
605
|
key: "getDerivedStateFromProps",
|
|
606
606
|
value: function getDerivedStateFromProps(nextProps, prevState) {
|
|
607
|
+
var _stateUpdate$searchVa;
|
|
608
|
+
|
|
607
609
|
var options = nextProps.options,
|
|
608
610
|
isPreFiltered = nextProps.isPreFiltered,
|
|
609
611
|
searchProps = nextProps.searchProps;
|
|
610
612
|
var activeOptionIndex = prevState.activeOptionIndex,
|
|
611
613
|
searchValue = prevState.searchValue;
|
|
612
|
-
var matchingOptions = getMatchingOptions(options, searchValue, isPreFiltered);
|
|
613
614
|
var stateUpdate = {
|
|
614
|
-
|
|
615
|
+
searchValue: searchValue,
|
|
615
616
|
activeOptionIndex: activeOptionIndex
|
|
616
617
|
};
|
|
617
618
|
|
|
618
|
-
if (activeOptionIndex != null && activeOptionIndex >= matchingOptions.length) {
|
|
619
|
-
stateUpdate.activeOptionIndex = -1;
|
|
620
|
-
}
|
|
621
|
-
|
|
622
619
|
if ((searchProps === null || searchProps === void 0 ? void 0 : searchProps.value) != null && searchProps.value !== searchValue) {
|
|
623
620
|
stateUpdate.searchValue = searchProps.value;
|
|
624
621
|
}
|
|
625
622
|
|
|
623
|
+
stateUpdate.visibleOptions = getMatchingOptions(options, (_stateUpdate$searchVa = stateUpdate.searchValue) !== null && _stateUpdate$searchVa !== void 0 ? _stateUpdate$searchVa : '', isPreFiltered);
|
|
624
|
+
|
|
625
|
+
if (activeOptionIndex != null && activeOptionIndex >= stateUpdate.visibleOptions.length) {
|
|
626
|
+
stateUpdate.activeOptionIndex = -1;
|
|
627
|
+
}
|
|
628
|
+
|
|
626
629
|
return stateUpdate;
|
|
627
630
|
}
|
|
628
631
|
}]);
|
|
@@ -42,13 +42,17 @@ export var EuiTab = function EuiTab(_ref) {
|
|
|
42
42
|
'euiTab-isSelected': isSelected
|
|
43
43
|
});
|
|
44
44
|
var tabStyles = euiTabStyles(euiTheme);
|
|
45
|
-
var cssTabStyles = [tabStyles.euiTab, expand && tabStyles.expanded,
|
|
45
|
+
var cssTabStyles = [tabStyles.euiTab, expand && tabStyles.expanded, disabled && tabStyles.disabled.disabled, isSelected && (disabled ? tabStyles.disabled.selected : tabStyles.selected)];
|
|
46
46
|
var tabContentStyles = euiTabContentStyles(euiTheme);
|
|
47
47
|
var cssTabContentStyles = [tabContentStyles.euiTab__content, size && tabContentStyles[size], isSelected && tabContentStyles.selected, disabled && tabContentStyles.disabled];
|
|
48
48
|
|
|
49
|
-
var prependNode = prepend && ___EmotionJSX("span",
|
|
49
|
+
var prependNode = prepend && ___EmotionJSX("span", {
|
|
50
|
+
className: "euiTab__prepend"
|
|
51
|
+
}, prepend);
|
|
50
52
|
|
|
51
|
-
var appendNode = append && ___EmotionJSX("span",
|
|
53
|
+
var appendNode = append && ___EmotionJSX("span", {
|
|
54
|
+
className: "euiTab__append"
|
|
55
|
+
}, append); // <a> elements don't respect the `disabled` attribute. So if we're disabled, we'll just pretend
|
|
52
56
|
// this is a button and piggyback off its disabled styles.
|
|
53
57
|
|
|
54
58
|
|
|
@@ -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
|
|
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(
|
|
23
|
-
var 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, "
|
|
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:
|
|
33
|
-
selected: /*#__PURE__*/css("box-shadow:inset 0
|
|
34
|
-
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:
|
|
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:
|
|
45
|
-
|
|
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, "
|
|
61
|
+
disabled: /*#__PURE__*/css("color:", euiTheme.colors.disabledText, ";;label:disabled;")
|
|
49
62
|
};
|
|
50
63
|
};
|
|
@@ -276,7 +276,7 @@ EuiTabbedContent.propTypes = {
|
|
|
276
276
|
"data-test-subj": PropTypes.string,
|
|
277
277
|
css: PropTypes.any
|
|
278
278
|
}),
|
|
279
|
-
size: PropTypes.
|
|
279
|
+
size: PropTypes.any,
|
|
280
280
|
|
|
281
281
|
/**
|
|
282
282
|
* Each tab needs id and content properties, so we can associate it with its panel for accessibility.
|
|
@@ -33,8 +33,8 @@ export var EuiTabs = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
33
33
|
|
|
34
34
|
var euiTheme = useEuiTheme();
|
|
35
35
|
var classes = classNames('euiTabs', className);
|
|
36
|
-
var
|
|
37
|
-
var
|
|
36
|
+
var styles = euiTabsStyles(euiTheme);
|
|
37
|
+
var cssStyles = [styles.euiTabs, styles[size], bottomBorder && styles.bottomBorder];
|
|
38
38
|
var tabItems = React.Children.map(children, function (child) {
|
|
39
39
|
if ( /*#__PURE__*/React.isValidElement(child)) {
|
|
40
40
|
return cloneElementWithCss(child, {
|
|
@@ -47,7 +47,7 @@ export var EuiTabs = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
47
47
|
return ___EmotionJSX("div", _extends({
|
|
48
48
|
ref: ref,
|
|
49
49
|
className: classes,
|
|
50
|
-
css:
|
|
50
|
+
css: cssStyles
|
|
51
51
|
}, children && {
|
|
52
52
|
role: 'tablist'
|
|
53
53
|
}, 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
|
|
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 ",
|
|
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('
|
|
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) {
|