@elastic/eui 80.0.0 → 81.0.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_charts_theme.js.map +1 -1
- package/es/components/bottom_bar/bottom_bar.js +4 -1
- package/es/components/bottom_bar/bottom_bar.styles.js +2 -2
- package/es/components/button/button.js +4 -1
- package/es/components/button/button_empty/button_empty.js +4 -1
- package/es/components/button/button_icon/button_icon.js +4 -1
- package/es/components/filter_group/filter_group.a11y.js +2 -2
- package/es/components/overlay_mask/overlay_mask.js +25 -9
- package/es/components/portal/portal.js +17 -0
- package/es/components/selectable/selectable.a11y.js +39 -23
- package/es/components/selectable/selectable.js +4 -4
- package/es/components/selectable/selectable_list/selectable_list.js +5 -5
- package/es/components/selectable/selectable_list/selectable_list_item.js +119 -57
- package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +4 -4
- package/es/services/theme/context.js +7 -1
- package/es/services/theme/index.js +1 -1
- package/es/services/theme/provider.js +47 -4
- package/eui.d.ts +44 -21
- package/i18ntokens.json +88 -52
- package/lib/components/bottom_bar/bottom_bar.js +4 -1
- package/lib/components/bottom_bar/bottom_bar.styles.js +2 -2
- package/lib/components/button/button.js +4 -1
- package/lib/components/button/button_empty/button_empty.js +4 -1
- package/lib/components/button/button_icon/button_icon.js +4 -1
- package/lib/components/filter_group/filter_group.a11y.js +2 -2
- package/lib/components/overlay_mask/overlay_mask.js +25 -4
- package/lib/components/portal/portal.js +17 -0
- package/lib/components/selectable/selectable.a11y.js +39 -23
- package/lib/components/selectable/selectable.js +4 -4
- package/lib/components/selectable/selectable_list/selectable_list.js +5 -5
- package/lib/components/selectable/selectable_list/selectable_list_item.js +119 -57
- package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +4 -4
- package/lib/services/theme/context.js +9 -2
- package/lib/services/theme/index.js +6 -0
- package/lib/services/theme/provider.js +45 -2
- package/optimize/es/components/bottom_bar/bottom_bar.js +4 -1
- package/optimize/es/components/bottom_bar/bottom_bar.styles.js +2 -2
- package/optimize/es/components/button/button.js +4 -1
- package/optimize/es/components/button/button_empty/button_empty.js +4 -1
- package/optimize/es/components/button/button_icon/button_icon.js +4 -1
- package/optimize/es/components/filter_group/filter_group.a11y.js +2 -2
- package/optimize/es/components/overlay_mask/overlay_mask.js +22 -9
- package/optimize/es/components/portal/portal.js +18 -1
- package/optimize/es/components/selectable/selectable.a11y.js +39 -23
- package/optimize/es/components/selectable/selectable_list/selectable_list_item.js +117 -54
- package/optimize/es/services/theme/context.js +7 -1
- package/optimize/es/services/theme/index.js +1 -1
- package/optimize/es/services/theme/provider.js +46 -4
- package/optimize/lib/components/bottom_bar/bottom_bar.js +4 -1
- package/optimize/lib/components/bottom_bar/bottom_bar.styles.js +2 -2
- package/optimize/lib/components/button/button.js +4 -1
- package/optimize/lib/components/button/button_empty/button_empty.js +4 -1
- package/optimize/lib/components/button/button_icon/button_icon.js +4 -1
- package/optimize/lib/components/filter_group/filter_group.a11y.js +2 -2
- package/optimize/lib/components/overlay_mask/overlay_mask.js +22 -4
- package/optimize/lib/components/portal/portal.js +18 -1
- package/optimize/lib/components/selectable/selectable.a11y.js +39 -23
- package/optimize/lib/components/selectable/selectable_list/selectable_list_item.js +117 -54
- package/optimize/lib/services/theme/context.js +9 -2
- package/optimize/lib/services/theme/index.js +6 -0
- package/optimize/lib/services/theme/provider.js +44 -2
- package/package.json +2 -5
- package/test-env/components/bottom_bar/bottom_bar.js +4 -1
- package/test-env/components/bottom_bar/bottom_bar.styles.js +2 -2
- package/test-env/components/button/button.js +4 -1
- package/test-env/components/button/button_empty/button_empty.js +4 -1
- package/test-env/components/button/button_icon/button_icon.js +4 -1
- package/test-env/components/filter_group/filter_group.a11y.js +2 -2
- package/test-env/components/overlay_mask/overlay_mask.js +22 -4
- package/test-env/components/portal/portal.js +17 -0
- package/test-env/components/selectable/selectable.a11y.js +39 -23
- package/test-env/components/selectable/selectable.js +4 -4
- package/test-env/components/selectable/selectable_list/selectable_list.js +5 -5
- package/test-env/components/selectable/selectable_list/selectable_list_item.js +120 -57
- package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +4 -4
- package/test-env/services/theme/context.js +9 -2
- package/test-env/services/theme/index.js +6 -0
- package/test-env/services/theme/provider.js +44 -2
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
5
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
6
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
7
6
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
7
|
var _button = require("../button");
|
|
9
8
|
var _popover = require("../popover");
|
|
@@ -31,27 +30,27 @@ var options = [{
|
|
|
31
30
|
}, {
|
|
32
31
|
label: "Pandora is one of Saturn's moons, named for a Titaness of Greek mythology"
|
|
33
32
|
}];
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}, args), function (list, search) {
|
|
46
|
-
return (0, _react2.jsx)(_react.default.Fragment, null, search, list);
|
|
47
|
-
});
|
|
48
|
-
};
|
|
33
|
+
var excludedOptions = [{
|
|
34
|
+
label: 'Titan',
|
|
35
|
+
'data-test-subj': 'titanOption',
|
|
36
|
+
checked: 'on'
|
|
37
|
+
}, {
|
|
38
|
+
label: 'Enceladus',
|
|
39
|
+
checked: 'off'
|
|
40
|
+
}, {
|
|
41
|
+
label: "Pandora is one of Saturn's moons, named for a Titaness of Greek mythology",
|
|
42
|
+
checked: 'mixed'
|
|
43
|
+
}];
|
|
49
44
|
describe('EuiSelectable', function () {
|
|
50
45
|
describe('with a `searchable` configuration', function () {
|
|
51
46
|
it('has no accessibility errors', function () {
|
|
52
47
|
var onChange = cy.stub();
|
|
53
|
-
cy.realMount((0, _react2.jsx)(
|
|
54
|
-
|
|
48
|
+
cy.realMount((0, _react2.jsx)(_selectable.EuiSelectable, {
|
|
49
|
+
options: options,
|
|
50
|
+
onChange: onChange,
|
|
51
|
+
searchable: true
|
|
52
|
+
}, function (list, search) {
|
|
53
|
+
return (0, _react2.jsx)(_react.default.Fragment, null, search, list);
|
|
55
54
|
}));
|
|
56
55
|
cy.checkAxe();
|
|
57
56
|
});
|
|
@@ -59,9 +58,25 @@ describe('EuiSelectable', function () {
|
|
|
59
58
|
describe('without a `searchable` configuration', function () {
|
|
60
59
|
it('has no accessibility errors', function () {
|
|
61
60
|
var onChange = cy.stub();
|
|
62
|
-
cy.realMount((0, _react2.jsx)(
|
|
61
|
+
cy.realMount((0, _react2.jsx)(_selectable.EuiSelectable, {
|
|
63
62
|
"aria-label": "No search box",
|
|
63
|
+
options: options,
|
|
64
64
|
onChange: onChange
|
|
65
|
+
}, function (list) {
|
|
66
|
+
return (0, _react2.jsx)(_react.default.Fragment, null, list);
|
|
67
|
+
}));
|
|
68
|
+
cy.checkAxe();
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
describe('with excluded and mixed options configuration', function () {
|
|
72
|
+
it('has no accessibility errors', function () {
|
|
73
|
+
var onChange = cy.stub();
|
|
74
|
+
cy.realMount((0, _react2.jsx)(_selectable.EuiSelectable, {
|
|
75
|
+
"aria-label": "Excluded and mixed options",
|
|
76
|
+
options: excludedOptions,
|
|
77
|
+
onChange: onChange
|
|
78
|
+
}, function (list) {
|
|
79
|
+
return (0, _react2.jsx)(_react.default.Fragment, null, list);
|
|
65
80
|
}));
|
|
66
81
|
cy.checkAxe();
|
|
67
82
|
});
|
|
@@ -88,12 +103,13 @@ describe('EuiSelectable', function () {
|
|
|
88
103
|
button: button,
|
|
89
104
|
isOpen: isPopoverOpen,
|
|
90
105
|
closePopover: onClosePopover
|
|
91
|
-
}, (0, _react2.jsx)(
|
|
106
|
+
}, (0, _react2.jsx)(_selectable.EuiSelectable, {
|
|
92
107
|
"aria-label": "With popover",
|
|
93
108
|
options: options,
|
|
94
|
-
onChange: onChange
|
|
95
|
-
|
|
96
|
-
|
|
109
|
+
onChange: onChange,
|
|
110
|
+
searchable: true
|
|
111
|
+
}, function (list, search) {
|
|
112
|
+
return (0, _react2.jsx)(_react.default.Fragment, null, search, list);
|
|
97
113
|
}));
|
|
98
114
|
};
|
|
99
115
|
it('has no accessibility errors', function () {
|
|
@@ -10,6 +10,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
11
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
13
14
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
14
15
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
15
16
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
@@ -29,18 +30,28 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
29
30
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
30
31
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
31
32
|
function resolveIconAndColor(checked) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
switch (checked) {
|
|
34
|
+
case 'on':
|
|
35
|
+
return {
|
|
36
|
+
icon: 'check',
|
|
37
|
+
color: 'text'
|
|
38
|
+
};
|
|
39
|
+
case 'off':
|
|
40
|
+
return {
|
|
41
|
+
icon: 'cross',
|
|
42
|
+
color: 'text'
|
|
43
|
+
};
|
|
44
|
+
case 'mixed':
|
|
45
|
+
return {
|
|
46
|
+
icon: 'minus',
|
|
47
|
+
color: 'text'
|
|
48
|
+
};
|
|
49
|
+
case undefined:
|
|
50
|
+
default:
|
|
51
|
+
return {
|
|
52
|
+
icon: 'empty'
|
|
53
|
+
};
|
|
36
54
|
}
|
|
37
|
-
return checked === 'on' ? {
|
|
38
|
-
icon: 'check',
|
|
39
|
-
color: 'text'
|
|
40
|
-
} : {
|
|
41
|
-
icon: 'cross',
|
|
42
|
-
color: 'text'
|
|
43
|
-
};
|
|
44
55
|
}
|
|
45
56
|
var paddingSizeToClassNameMap = {
|
|
46
57
|
none: null,
|
|
@@ -53,8 +64,32 @@ var EuiSelectableListItem = /*#__PURE__*/function (_Component) {
|
|
|
53
64
|
(0, _inherits2.default)(EuiSelectableListItem, _Component);
|
|
54
65
|
var _super = _createSuper(EuiSelectableListItem);
|
|
55
66
|
function EuiSelectableListItem(props) {
|
|
67
|
+
var _this;
|
|
56
68
|
(0, _classCallCheck2.default)(this, EuiSelectableListItem);
|
|
57
|
-
|
|
69
|
+
_this = _super.call(this, props);
|
|
70
|
+
// aria-checked is intended to be used with role="checkbox" but
|
|
71
|
+
// the MDN documentation lists it as a possibility for role="option".
|
|
72
|
+
// See https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-checked
|
|
73
|
+
// and https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/option_role
|
|
74
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isChecked", function (role, checked) {
|
|
75
|
+
var rolesThatCanBeMixed = ['option', 'checkbox', 'menuitemcheckbox'];
|
|
76
|
+
var rolesThatCanBeChecked = [].concat(rolesThatCanBeMixed, ['radio', 'menuitemradio', 'switch']);
|
|
77
|
+
if (!rolesThatCanBeChecked.includes(role)) return undefined;
|
|
78
|
+
switch (checked) {
|
|
79
|
+
case 'on':
|
|
80
|
+
case 'off':
|
|
81
|
+
return true;
|
|
82
|
+
case 'mixed':
|
|
83
|
+
if (rolesThatCanBeMixed.includes(role)) {
|
|
84
|
+
return 'mixed';
|
|
85
|
+
} else {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
default:
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
return _this;
|
|
58
93
|
}
|
|
59
94
|
(0, _createClass2.default)(EuiSelectableListItem, [{
|
|
60
95
|
key: "render",
|
|
@@ -93,41 +128,71 @@ var EuiSelectableListItem = /*#__PURE__*/function (_Component) {
|
|
|
93
128
|
});
|
|
94
129
|
}
|
|
95
130
|
var state;
|
|
96
|
-
var
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
+
var instructions;
|
|
132
|
+
var screenReaderStrings = {
|
|
133
|
+
checked: {
|
|
134
|
+
state: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
135
|
+
token: "euiSelectableListItem.checkedOption",
|
|
136
|
+
default: "Checked option."
|
|
137
|
+
}),
|
|
138
|
+
instructions: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
139
|
+
token: "euiSelectableListItem.checkOptionInstructions",
|
|
140
|
+
default: "To check this option, press Enter."
|
|
141
|
+
})
|
|
142
|
+
},
|
|
143
|
+
unchecked: {
|
|
144
|
+
instructions: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
145
|
+
token: "euiSelectableListItem.uncheckOptionInstructions",
|
|
146
|
+
default: "To uncheck this option, press Enter."
|
|
147
|
+
})
|
|
148
|
+
},
|
|
149
|
+
excluded: {
|
|
150
|
+
state: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
151
|
+
token: "euiSelectableListItem.excludedOption",
|
|
152
|
+
default: "Excluded option."
|
|
153
|
+
}),
|
|
154
|
+
instructions: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
155
|
+
token: "euiSelectableListItem.excludeOptionInstructions",
|
|
156
|
+
default: "To exclude this option, press Enter."
|
|
157
|
+
})
|
|
158
|
+
},
|
|
159
|
+
mixed: {
|
|
160
|
+
state: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
161
|
+
token: "euiSelectableListItem.mixedOption",
|
|
162
|
+
default: "Mixed (indeterminate) option."
|
|
163
|
+
}),
|
|
164
|
+
instructions: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
165
|
+
token: "euiSelectableListItem.mixedOptionInstructions",
|
|
166
|
+
default: "To check this option for all, press Enter once."
|
|
167
|
+
}),
|
|
168
|
+
uncheckInstructions: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
169
|
+
token: "euiSelectableListItem.mixedOptionUncheckInstructions",
|
|
170
|
+
default: "To uncheck this option for all, press Enter twice."
|
|
171
|
+
}),
|
|
172
|
+
excludeInstructions: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
173
|
+
token: "euiSelectableListItem.mixedOptionExcludeInstructions",
|
|
174
|
+
default: "To exclude this option for all, press Enter twice."
|
|
175
|
+
})
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
switch (checked) {
|
|
179
|
+
case 'on':
|
|
180
|
+
state = screenReaderStrings.checked.state;
|
|
181
|
+
// eslint-disable-next-line no-nested-ternary
|
|
182
|
+
instructions = allowExclusions ? screenReaderStrings.excluded.instructions : searchable ? screenReaderStrings.unchecked.instructions : undefined;
|
|
183
|
+
break;
|
|
184
|
+
case 'off':
|
|
185
|
+
state = screenReaderStrings.excluded.state;
|
|
186
|
+
instructions = screenReaderStrings.unchecked.instructions;
|
|
187
|
+
break;
|
|
188
|
+
case 'mixed':
|
|
189
|
+
state = screenReaderStrings.mixed.state;
|
|
190
|
+
instructions = (0, _react2.jsx)(_react.default.Fragment, null, screenReaderStrings.mixed.instructions, ' ', allowExclusions ? screenReaderStrings.mixed.excludeInstructions : screenReaderStrings.mixed.uncheckInstructions);
|
|
191
|
+
break;
|
|
192
|
+
case undefined:
|
|
193
|
+
default:
|
|
194
|
+
instructions = allowExclusions || searchable ? screenReaderStrings.checked.instructions : undefined;
|
|
195
|
+
break;
|
|
131
196
|
}
|
|
132
197
|
var prependNode;
|
|
133
198
|
if (prepend) {
|
|
@@ -164,22 +229,20 @@ var EuiSelectableListItem = /*#__PURE__*/function (_Component) {
|
|
|
164
229
|
}, append, " ", isFocused && !disabled ? onFocusBadgeNode : null);
|
|
165
230
|
}
|
|
166
231
|
}
|
|
167
|
-
var
|
|
232
|
+
var screenReaderText = (state || instructions) && (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("div", null, state || instructions ? '. ' : null, state, state && instructions ? ' ' : null, instructions));
|
|
168
233
|
return (0, _react2.jsx)("li", (0, _extends2.default)({
|
|
169
234
|
role: role,
|
|
170
|
-
"
|
|
171
|
-
,
|
|
172
|
-
"aria-checked": role === 'option' ? isChecked : undefined // Whether the item is "checked"
|
|
235
|
+
"aria-disabled": disabled,
|
|
236
|
+
"aria-checked": this.isChecked(role, checked) // Whether the item is "checked"
|
|
173
237
|
,
|
|
174
238
|
"aria-selected": !disabled && isFocused // Whether the item has keyboard focus per W3 spec
|
|
175
239
|
,
|
|
176
|
-
className: classes
|
|
177
|
-
"aria-disabled": disabled
|
|
240
|
+
className: classes
|
|
178
241
|
}, rest), (0, _react2.jsx)("span", {
|
|
179
242
|
className: "euiSelectableListItem__content"
|
|
180
243
|
}, optionIcon, prependNode, (0, _react2.jsx)("span", {
|
|
181
244
|
className: textClasses
|
|
182
|
-
}, children,
|
|
245
|
+
}, children, screenReaderText), appendNode));
|
|
183
246
|
}
|
|
184
247
|
}]);
|
|
185
248
|
return EuiSelectableListItem;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.defaultComputedTheme = exports.EuiThemeContext = exports.EuiSystemContext = exports.EuiModificationsContext = exports.EuiColorModeContext = void 0;
|
|
6
|
+
exports.defaultComputedTheme = exports.EuiThemeContext = exports.EuiSystemContext = exports.EuiNestedThemeContext = exports.EuiModificationsContext = exports.EuiColorModeContext = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _theme = require("../../themes/amsterdam/theme");
|
|
9
9
|
var _utils = require("./utils");
|
|
@@ -24,4 +24,11 @@ exports.EuiColorModeContext = EuiColorModeContext;
|
|
|
24
24
|
var defaultComputedTheme = (0, _utils.getComputed)(_theme.EuiThemeAmsterdam, {}, _utils.DEFAULT_COLOR_MODE);
|
|
25
25
|
exports.defaultComputedTheme = defaultComputedTheme;
|
|
26
26
|
var EuiThemeContext = /*#__PURE__*/(0, _react.createContext)(defaultComputedTheme);
|
|
27
|
-
exports.EuiThemeContext = EuiThemeContext;
|
|
27
|
+
exports.EuiThemeContext = EuiThemeContext;
|
|
28
|
+
var EuiNestedThemeContext = /*#__PURE__*/(0, _react.createContext)({
|
|
29
|
+
isGlobalTheme: true,
|
|
30
|
+
hasDifferentColorFromGlobalTheme: false,
|
|
31
|
+
bodyColor: '',
|
|
32
|
+
colorClassName: ''
|
|
33
|
+
});
|
|
34
|
+
exports.EuiNestedThemeContext = EuiNestedThemeContext;
|
|
@@ -27,6 +27,12 @@ Object.defineProperty(exports, "EuiModificationsContext", {
|
|
|
27
27
|
return _context.EuiModificationsContext;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
+
Object.defineProperty(exports, "EuiNestedThemeContext", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function get() {
|
|
33
|
+
return _context.EuiNestedThemeContext;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
30
36
|
Object.defineProperty(exports, "EuiSystemContext", {
|
|
31
37
|
enumerable: true,
|
|
32
38
|
get: function get() {
|
|
@@ -6,13 +6,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.setEuiDevProviderWarning = exports.getEuiDevProviderWarning = exports.EuiThemeProvider = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
12
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
14
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
+
var _css = require("@emotion/css");
|
|
12
16
|
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
13
17
|
var _context = require("./context");
|
|
14
18
|
var _utils = require("./utils");
|
|
15
19
|
var _react2 = require("@emotion/react");
|
|
20
|
+
var _excluded = ["cloneElement", "className"];
|
|
16
21
|
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); }
|
|
17
22
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
18
23
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -30,7 +35,11 @@ var EuiThemeProvider = function EuiThemeProvider(_ref) {
|
|
|
30
35
|
var _system = _ref.theme,
|
|
31
36
|
_colorMode = _ref.colorMode,
|
|
32
37
|
_modifications = _ref.modify,
|
|
33
|
-
children = _ref.children
|
|
38
|
+
children = _ref.children,
|
|
39
|
+
wrapperProps = _ref.wrapperProps;
|
|
40
|
+
var _useContext = (0, _react.useContext)(_context.EuiNestedThemeContext),
|
|
41
|
+
isGlobalTheme = _useContext.isGlobalTheme,
|
|
42
|
+
bodyColor = _useContext.bodyColor;
|
|
34
43
|
var parentSystem = (0, _react.useContext)(_context.EuiSystemContext);
|
|
35
44
|
var parentModifications = (0, _react.useContext)(_context.EuiModificationsContext);
|
|
36
45
|
var parentColorMode = (0, _react.useContext)(_context.EuiColorModeContext);
|
|
@@ -85,6 +94,37 @@ var EuiThemeProvider = function EuiThemeProvider(_ref) {
|
|
|
85
94
|
setTheme((0, _utils.getComputed)(system, (0, _utils.buildTheme)(modifications, "_".concat(system.key)), colorMode));
|
|
86
95
|
}
|
|
87
96
|
}, [colorMode, system, modifications]);
|
|
97
|
+
var nestedThemeContext = (0, _react.useMemo)(function () {
|
|
98
|
+
return {
|
|
99
|
+
isGlobalTheme: false,
|
|
100
|
+
// The theme that determines the global body styles
|
|
101
|
+
bodyColor: isGlobalTheme ? theme.colors.text : bodyColor,
|
|
102
|
+
hasDifferentColorFromGlobalTheme: isGlobalTheme ? false : bodyColor !== theme.colors.text,
|
|
103
|
+
colorClassName: /*#__PURE__*/(0, _css.css)("label:euiColorMode-", _colorMode, ";color:", theme.colors.text, ";;label:colorClassName;")
|
|
104
|
+
};
|
|
105
|
+
}, [theme, isGlobalTheme, bodyColor, _colorMode]);
|
|
106
|
+
var renderedChildren = (0, _react.useMemo)(function () {
|
|
107
|
+
if (isGlobalTheme) {
|
|
108
|
+
return children; // No wrapper
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
var _ref2 = wrapperProps || {},
|
|
112
|
+
cloneElement = _ref2.cloneElement,
|
|
113
|
+
className = _ref2.className,
|
|
114
|
+
rest = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
|
|
115
|
+
var props = _objectSpread(_objectSpread({}, rest), {}, {
|
|
116
|
+
className: (0, _classnames.default)(className, nestedThemeContext.colorClassName)
|
|
117
|
+
});
|
|
118
|
+
if (cloneElement) {
|
|
119
|
+
return /*#__PURE__*/_react.default.cloneElement(children, _objectSpread(_objectSpread({}, props), {}, {
|
|
120
|
+
className: (0, _classnames.default)(children.props.className, props.className)
|
|
121
|
+
}));
|
|
122
|
+
} else {
|
|
123
|
+
return (0, _react2.jsx)("span", (0, _extends2.default)({}, props, {
|
|
124
|
+
className: (0, _classnames.default)('euiThemeProvider', props.className)
|
|
125
|
+
}), children);
|
|
126
|
+
}
|
|
127
|
+
}, [isGlobalTheme, nestedThemeContext, wrapperProps, children]);
|
|
88
128
|
return (0, _react2.jsx)(_context.EuiColorModeContext.Provider, {
|
|
89
129
|
value: colorMode
|
|
90
130
|
}, (0, _react2.jsx)(_context.EuiSystemContext.Provider, {
|
|
@@ -93,6 +133,8 @@ var EuiThemeProvider = function EuiThemeProvider(_ref) {
|
|
|
93
133
|
value: modifications
|
|
94
134
|
}, (0, _react2.jsx)(_context.EuiThemeContext.Provider, {
|
|
95
135
|
value: theme
|
|
96
|
-
},
|
|
136
|
+
}, (0, _react2.jsx)(_context.EuiNestedThemeContext.Provider, {
|
|
137
|
+
value: nestedThemeContext
|
|
138
|
+
}, renderedChildren)))));
|
|
97
139
|
};
|
|
98
140
|
exports.EuiThemeProvider = EuiThemeProvider;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elastic/eui",
|
|
3
3
|
"description": "Elastic UI Component Library",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "81.0.0",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "lib",
|
|
7
7
|
"module": "es",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
],
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@types/chroma-js": "^2.0.0",
|
|
62
|
-
"@types/lodash": "^4.14.
|
|
62
|
+
"@types/lodash": "^4.14.194",
|
|
63
63
|
"@types/numeral": "^0.0.28",
|
|
64
64
|
"@types/react-beautiful-dnd": "^13.1.2",
|
|
65
65
|
"@types/react-input-autosize": "^2.2.1",
|
|
@@ -105,7 +105,6 @@
|
|
|
105
105
|
"@babel/core": "^7.21.3",
|
|
106
106
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
107
107
|
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
|
|
108
|
-
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
109
108
|
"@babel/plugin-transform-async-to-generator": "^7.20.7",
|
|
110
109
|
"@babel/plugin-transform-runtime": "^7.21.0",
|
|
111
110
|
"@babel/preset-env": "^7.20.2",
|
|
@@ -150,12 +149,10 @@
|
|
|
150
149
|
"argparse": "^2.0.1",
|
|
151
150
|
"autoprefixer": "^9.8.6",
|
|
152
151
|
"axe-core": "^4.4.1",
|
|
153
|
-
"babel-core": "7.0.0-bridge.0",
|
|
154
152
|
"babel-eslint": "^10.1.0",
|
|
155
153
|
"babel-jest": "^24.1.0",
|
|
156
154
|
"babel-loader": "^8.1.0",
|
|
157
155
|
"babel-plugin-add-module-exports": "^1.0.2",
|
|
158
|
-
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
159
156
|
"babel-plugin-inline-react-svg": "^1.1.1",
|
|
160
157
|
"babel-plugin-istanbul": "^6.0.0",
|
|
161
158
|
"babel-plugin-pegjs-inline-precompile": "^0.1.1",
|
|
@@ -194,7 +194,10 @@ _EuiBottomBar.propTypes = {
|
|
|
194
194
|
var EuiBottomBar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
195
195
|
var BottomBar = _EuiBottomBar;
|
|
196
196
|
return (0, _react2.jsx)(_provider.EuiThemeProvider, {
|
|
197
|
-
colorMode: 'dark'
|
|
197
|
+
colorMode: 'dark',
|
|
198
|
+
wrapperProps: {
|
|
199
|
+
cloneElement: true
|
|
200
|
+
}
|
|
198
201
|
}, (0, _react2.jsx)(BottomBar, (0, _extends2.default)({
|
|
199
202
|
ref: ref
|
|
200
203
|
}, props)));
|
|
@@ -16,8 +16,8 @@ var euiBottomBarStyles = function euiBottomBarStyles(euiThemeContext) {
|
|
|
16
16
|
var euiTheme = euiThemeContext.euiTheme;
|
|
17
17
|
return {
|
|
18
18
|
// Base
|
|
19
|
-
//
|
|
20
|
-
euiBottomBar: /*#__PURE__*/(0, _react.css)((0, _mixins.euiShadowFlat)(euiThemeContext), ";background:", (0, _services.shade)(euiTheme.colors.lightestShade, 0.5), ";
|
|
19
|
+
// `color` is inherited from the wrapping `EuiThemeProvider colorMode="dark"`
|
|
20
|
+
euiBottomBar: /*#__PURE__*/(0, _react.css)((0, _mixins.euiShadowFlat)(euiThemeContext), ";background:", (0, _services.shade)(euiTheme.colors.lightestShade, 0.5), ";", _global_styling.euiCanAnimate, "{animation:", euiBottomBarAppear, " ", euiTheme.animation.slow, " ", euiTheme.animation.resistance, ";};label:euiBottomBar;"),
|
|
21
21
|
static: /*#__PURE__*/(0, _react.css)(";label:static;"),
|
|
22
22
|
fixed: /*#__PURE__*/(0, _react.css)("z-index:", Number(euiTheme.levels.header) - 2, ";;label:fixed;"),
|
|
23
23
|
sticky: /*#__PURE__*/(0, _react.css)("z-index:", Number(euiTheme.levels.header) - 2, ";;label:sticky;"),
|
|
@@ -54,7 +54,10 @@ var EuiButton = function EuiButton(props) {
|
|
|
54
54
|
if (_color === 'ghost') {
|
|
55
55
|
// INCEPTION: If `ghost`, re-implement with a wrapping dark mode theme provider
|
|
56
56
|
return (0, _react2.jsx)(_services.EuiThemeProvider, {
|
|
57
|
-
colorMode: "dark"
|
|
57
|
+
colorMode: "dark",
|
|
58
|
+
wrapperProps: {
|
|
59
|
+
cloneElement: true
|
|
60
|
+
}
|
|
58
61
|
}, (0, _react2.jsx)(EuiButton, (0, _extends2.default)({}, props, {
|
|
59
62
|
color: "text"
|
|
60
63
|
})));
|
|
@@ -79,7 +79,10 @@ var EuiButtonEmpty = function EuiButtonEmpty(props) {
|
|
|
79
79
|
if (_color === 'ghost') {
|
|
80
80
|
// INCEPTION: If `ghost`, re-implement with a wrapping dark mode theme provider
|
|
81
81
|
return (0, _react2.jsx)(_services.EuiThemeProvider, {
|
|
82
|
-
colorMode: "dark"
|
|
82
|
+
colorMode: "dark",
|
|
83
|
+
wrapperProps: {
|
|
84
|
+
cloneElement: true
|
|
85
|
+
}
|
|
83
86
|
}, (0, _react2.jsx)(EuiButtonEmpty, (0, _extends2.default)({}, props, {
|
|
84
87
|
color: "text"
|
|
85
88
|
})));
|
|
@@ -81,7 +81,10 @@ var EuiButtonIcon = function EuiButtonIcon(props) {
|
|
|
81
81
|
if (_color === 'ghost') {
|
|
82
82
|
// INCEPTION: If `ghost`, re-implement with a wrapping dark mode theme provider
|
|
83
83
|
return (0, _react2.jsx)(_services.EuiThemeProvider, {
|
|
84
|
-
colorMode: "dark"
|
|
84
|
+
colorMode: "dark",
|
|
85
|
+
wrapperProps: {
|
|
86
|
+
cloneElement: true
|
|
87
|
+
}
|
|
85
88
|
}, (0, _react2.jsx)(EuiButtonIcon, (0, _extends2.default)({}, props, {
|
|
86
89
|
color: "text"
|
|
87
90
|
})));
|
|
@@ -239,10 +239,10 @@ describe('EuiFilterGroup multiselect example', function () {
|
|
|
239
239
|
cy.realPress('Tab');
|
|
240
240
|
cy.repeatRealPress('ArrowDown', 3);
|
|
241
241
|
cy.realPress('Enter');
|
|
242
|
-
cy.get('li[aria-selected="true"]').find('span.euiSelectableListItem__text').should('have.text', 'Dmitri Shostakovich -
|
|
242
|
+
cy.get('li[aria-selected="true"]').find('span.euiSelectableListItem__text').should('have.text', 'Dmitri Shostakovich - Checked option. To exclude this option, press Enter.');
|
|
243
243
|
cy.realPress('ArrowDown');
|
|
244
244
|
cy.repeatRealPress('Enter');
|
|
245
|
-
cy.get('li[aria-selected="true"]').find('span.euiSelectableListItem__text').should('have.text', 'Felix Mendelssohn-Bartholdy - Excluded option. To uncheck this option, press
|
|
245
|
+
cy.get('li[aria-selected="true"]').find('span.euiSelectableListItem__text').should('have.text', 'Felix Mendelssohn-Bartholdy - Excluded option. To uncheck this option, press Enter.');
|
|
246
246
|
cy.checkAxe();
|
|
247
247
|
});
|
|
248
248
|
it('has zero violations when filtering by searchbox', function () {
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.EuiOverlayMask = void 0;
|
|
9
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -47,11 +48,28 @@ var EuiOverlayMask = function EuiOverlayMask(_ref) {
|
|
|
47
48
|
});
|
|
48
49
|
}, [overlayMaskNode]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
49
50
|
|
|
51
|
+
// Note: Use `classList.add/remove` instead of setting the entire `className`
|
|
52
|
+
// so as not to override any existing classes set by `EuiPortal`
|
|
50
53
|
(0, _react.useEffect)(function () {
|
|
51
|
-
if (
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
if (overlayMaskNode) {
|
|
55
|
+
overlayMaskNode.classList.add('euiOverlayMask', cssStyles);
|
|
56
|
+
overlayMaskNode.dataset.relativeToHeader = headerZindexLocation;
|
|
57
|
+
return function () {
|
|
58
|
+
return overlayMaskNode.classList.remove(cssStyles);
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}, [overlayMaskNode, cssStyles, headerZindexLocation]);
|
|
62
|
+
(0, _react.useEffect)(function () {
|
|
63
|
+
if (className && overlayMaskNode) {
|
|
64
|
+
var _overlayMaskNode$clas;
|
|
65
|
+
var classNameArgs = className.split(' '); // The `classList` API doesn't support multiple classes in the same string
|
|
66
|
+
(_overlayMaskNode$clas = overlayMaskNode.classList).add.apply(_overlayMaskNode$clas, (0, _toConsumableArray2.default)(classNameArgs));
|
|
67
|
+
return function () {
|
|
68
|
+
var _overlayMaskNode$clas2;
|
|
69
|
+
return (_overlayMaskNode$clas2 = overlayMaskNode.classList).remove.apply(_overlayMaskNode$clas2, (0, _toConsumableArray2.default)(classNameArgs));
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}, [overlayMaskNode, className]);
|
|
55
73
|
return (0, _react2.jsx)(_portal.EuiPortal, {
|
|
56
74
|
portalRef: combinedMaskRef
|
|
57
75
|
}, (0, _react2.jsx)(_react2.Global, {
|
|
@@ -15,6 +15,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
15
15
|
var _react = require("react");
|
|
16
16
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
17
|
var _reactDom = require("react-dom");
|
|
18
|
+
var _services = require("../../services");
|
|
18
19
|
var _common = require("../common");
|
|
19
20
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
20
21
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
@@ -52,6 +53,7 @@ var EuiPortal = /*#__PURE__*/function (_Component) {
|
|
|
52
53
|
(0, _createClass2.default)(EuiPortal, [{
|
|
53
54
|
key: "componentDidMount",
|
|
54
55
|
value: function componentDidMount() {
|
|
56
|
+
this.setThemeColor();
|
|
55
57
|
this.updatePortalRef(this.portalNode);
|
|
56
58
|
}
|
|
57
59
|
}, {
|
|
@@ -63,6 +65,20 @@ var EuiPortal = /*#__PURE__*/function (_Component) {
|
|
|
63
65
|
}
|
|
64
66
|
this.updatePortalRef(null);
|
|
65
67
|
}
|
|
68
|
+
|
|
69
|
+
// Set the inherited color of the portal based on the wrapping EuiThemeProvider
|
|
70
|
+
}, {
|
|
71
|
+
key: "setThemeColor",
|
|
72
|
+
value: function setThemeColor() {
|
|
73
|
+
if (this.portalNode && this.context) {
|
|
74
|
+
var _this$context = this.context,
|
|
75
|
+
hasDifferentColorFromGlobalTheme = _this$context.hasDifferentColorFromGlobalTheme,
|
|
76
|
+
colorClassName = _this$context.colorClassName;
|
|
77
|
+
if (hasDifferentColorFromGlobalTheme && this.props.insert == null) {
|
|
78
|
+
this.portalNode.classList.add(colorClassName);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
66
82
|
}, {
|
|
67
83
|
key: "updatePortalRef",
|
|
68
84
|
value: function updatePortalRef(ref) {
|
|
@@ -79,6 +95,7 @@ var EuiPortal = /*#__PURE__*/function (_Component) {
|
|
|
79
95
|
return EuiPortal;
|
|
80
96
|
}(_react.Component);
|
|
81
97
|
exports.EuiPortal = EuiPortal;
|
|
98
|
+
(0, _defineProperty2.default)(EuiPortal, "contextType", _services.EuiNestedThemeContext);
|
|
82
99
|
EuiPortal.propTypes = {
|
|
83
100
|
/**
|
|
84
101
|
* ReactNode to render as this component's content
|