@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
|
@@ -14,7 +14,6 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
14
14
|
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; }
|
|
15
15
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
16
16
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
18
17
|
var options = [{
|
|
19
18
|
label: 'Titan',
|
|
20
19
|
'data-test-subj': 'titanOption'
|
|
@@ -23,27 +22,27 @@ var options = [{
|
|
|
23
22
|
}, {
|
|
24
23
|
label: "Pandora is one of Saturn's moons, named for a Titaness of Greek mythology"
|
|
25
24
|
}];
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}, args), function (list, search) {
|
|
38
|
-
return (0, _react2.jsx)(_react.default.Fragment, null, search, list);
|
|
39
|
-
});
|
|
40
|
-
};
|
|
25
|
+
var excludedOptions = [{
|
|
26
|
+
label: 'Titan',
|
|
27
|
+
'data-test-subj': 'titanOption',
|
|
28
|
+
checked: 'on'
|
|
29
|
+
}, {
|
|
30
|
+
label: 'Enceladus',
|
|
31
|
+
checked: 'off'
|
|
32
|
+
}, {
|
|
33
|
+
label: "Pandora is one of Saturn's moons, named for a Titaness of Greek mythology",
|
|
34
|
+
checked: 'mixed'
|
|
35
|
+
}];
|
|
41
36
|
describe('EuiSelectable', function () {
|
|
42
37
|
describe('with a `searchable` configuration', function () {
|
|
43
38
|
it('has no accessibility errors', function () {
|
|
44
39
|
var onChange = cy.stub();
|
|
45
|
-
cy.realMount((0, _react2.jsx)(
|
|
46
|
-
|
|
40
|
+
cy.realMount((0, _react2.jsx)(_selectable.EuiSelectable, {
|
|
41
|
+
options: options,
|
|
42
|
+
onChange: onChange,
|
|
43
|
+
searchable: true
|
|
44
|
+
}, function (list, search) {
|
|
45
|
+
return (0, _react2.jsx)(_react.default.Fragment, null, search, list);
|
|
47
46
|
}));
|
|
48
47
|
cy.checkAxe();
|
|
49
48
|
});
|
|
@@ -51,9 +50,25 @@ describe('EuiSelectable', function () {
|
|
|
51
50
|
describe('without a `searchable` configuration', function () {
|
|
52
51
|
it('has no accessibility errors', function () {
|
|
53
52
|
var onChange = cy.stub();
|
|
54
|
-
cy.realMount((0, _react2.jsx)(
|
|
53
|
+
cy.realMount((0, _react2.jsx)(_selectable.EuiSelectable, {
|
|
55
54
|
"aria-label": "No search box",
|
|
55
|
+
options: options,
|
|
56
56
|
onChange: onChange
|
|
57
|
+
}, function (list) {
|
|
58
|
+
return (0, _react2.jsx)(_react.default.Fragment, null, list);
|
|
59
|
+
}));
|
|
60
|
+
cy.checkAxe();
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
describe('with excluded and mixed options configuration', function () {
|
|
64
|
+
it('has no accessibility errors', function () {
|
|
65
|
+
var onChange = cy.stub();
|
|
66
|
+
cy.realMount((0, _react2.jsx)(_selectable.EuiSelectable, {
|
|
67
|
+
"aria-label": "Excluded and mixed options",
|
|
68
|
+
options: excludedOptions,
|
|
69
|
+
onChange: onChange
|
|
70
|
+
}, function (list) {
|
|
71
|
+
return (0, _react2.jsx)(_react.default.Fragment, null, list);
|
|
57
72
|
}));
|
|
58
73
|
cy.checkAxe();
|
|
59
74
|
});
|
|
@@ -80,12 +95,13 @@ describe('EuiSelectable', function () {
|
|
|
80
95
|
button: button,
|
|
81
96
|
isOpen: isPopoverOpen,
|
|
82
97
|
closePopover: onClosePopover
|
|
83
|
-
}, (0, _react2.jsx)(
|
|
98
|
+
}, (0, _react2.jsx)(_selectable.EuiSelectable, {
|
|
84
99
|
"aria-label": "With popover",
|
|
85
100
|
options: options,
|
|
86
|
-
onChange: onChange
|
|
87
|
-
|
|
88
|
-
|
|
101
|
+
onChange: onChange,
|
|
102
|
+
searchable: true
|
|
103
|
+
}, function (list, search) {
|
|
104
|
+
return (0, _react2.jsx)(_react.default.Fragment, null, search, list);
|
|
89
105
|
}));
|
|
90
106
|
};
|
|
91
107
|
it('has no accessibility errors', function () {
|
|
@@ -598,11 +598,11 @@ EuiSelectable.propTypes = {
|
|
|
598
598
|
*/
|
|
599
599
|
key: _propTypes.default.string,
|
|
600
600
|
/**
|
|
601
|
-
* Leave `undefined` to indicate not selected
|
|
602
|
-
* 'on' to indicate inclusion
|
|
603
|
-
* '
|
|
601
|
+
* Leave `undefined` to indicate not selected. Pass a string of
|
|
602
|
+
* 'on' to indicate inclusion, 'off' to indicate exclusion,
|
|
603
|
+
* or 'mixed' to indicate inclusion for some.
|
|
604
604
|
*/
|
|
605
|
-
checked: _propTypes.default.oneOf(["on", "off", undefined]),
|
|
605
|
+
checked: _propTypes.default.oneOf(["on", "off", "mixed", undefined]),
|
|
606
606
|
disabled: _propTypes.default.bool,
|
|
607
607
|
/**
|
|
608
608
|
* Node to add between the selection icon and the label
|
|
@@ -476,11 +476,11 @@ EuiSelectableList.propTypes = {
|
|
|
476
476
|
*/
|
|
477
477
|
key: _propTypes.default.string,
|
|
478
478
|
/**
|
|
479
|
-
* Leave `undefined` to indicate not selected
|
|
480
|
-
* 'on' to indicate inclusion
|
|
481
|
-
* '
|
|
479
|
+
* Leave `undefined` to indicate not selected. Pass a string of
|
|
480
|
+
* 'on' to indicate inclusion, 'off' to indicate exclusion,
|
|
481
|
+
* or 'mixed' to indicate inclusion for some.
|
|
482
482
|
*/
|
|
483
|
-
checked: _propTypes.default.oneOf(["on", "off", undefined]),
|
|
483
|
+
checked: _propTypes.default.oneOf(["on", "off", "mixed", undefined]),
|
|
484
484
|
disabled: _propTypes.default.bool,
|
|
485
485
|
/**
|
|
486
486
|
* Node to add between the selection icon and the label
|
|
@@ -509,7 +509,7 @@ EuiSelectableList.propTypes = {
|
|
|
509
509
|
label: _propTypes.default.string,
|
|
510
510
|
searchableLabel: _propTypes.default.string,
|
|
511
511
|
key: _propTypes.default.string,
|
|
512
|
-
checked: _propTypes.default.oneOf(["on", "off", undefined]),
|
|
512
|
+
checked: _propTypes.default.oneOf(["on", "off", "mixed", undefined]),
|
|
513
513
|
disabled: _propTypes.default.bool,
|
|
514
514
|
prepend: _propTypes.default.node,
|
|
515
515
|
append: _propTypes.default.node,
|
|
@@ -36,18 +36,28 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
36
36
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
37
37
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
38
38
|
function resolveIconAndColor(checked) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
switch (checked) {
|
|
40
|
+
case 'on':
|
|
41
|
+
return {
|
|
42
|
+
icon: 'check',
|
|
43
|
+
color: 'text'
|
|
44
|
+
};
|
|
45
|
+
case 'off':
|
|
46
|
+
return {
|
|
47
|
+
icon: 'cross',
|
|
48
|
+
color: 'text'
|
|
49
|
+
};
|
|
50
|
+
case 'mixed':
|
|
51
|
+
return {
|
|
52
|
+
icon: 'minus',
|
|
53
|
+
color: 'text'
|
|
54
|
+
};
|
|
55
|
+
case undefined:
|
|
56
|
+
default:
|
|
57
|
+
return {
|
|
58
|
+
icon: 'empty'
|
|
59
|
+
};
|
|
43
60
|
}
|
|
44
|
-
return checked === 'on' ? {
|
|
45
|
-
icon: 'check',
|
|
46
|
-
color: 'text'
|
|
47
|
-
} : {
|
|
48
|
-
icon: 'cross',
|
|
49
|
-
color: 'text'
|
|
50
|
-
};
|
|
51
61
|
}
|
|
52
62
|
var paddingSizeToClassNameMap = {
|
|
53
63
|
none: null,
|
|
@@ -60,8 +70,32 @@ var EuiSelectableListItem = /*#__PURE__*/function (_Component) {
|
|
|
60
70
|
_inherits(EuiSelectableListItem, _Component);
|
|
61
71
|
var _super = _createSuper(EuiSelectableListItem);
|
|
62
72
|
function EuiSelectableListItem(props) {
|
|
73
|
+
var _this;
|
|
63
74
|
_classCallCheck(this, EuiSelectableListItem);
|
|
64
|
-
|
|
75
|
+
_this = _super.call(this, props);
|
|
76
|
+
// aria-checked is intended to be used with role="checkbox" but
|
|
77
|
+
// the MDN documentation lists it as a possibility for role="option".
|
|
78
|
+
// See https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-checked
|
|
79
|
+
// and https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/option_role
|
|
80
|
+
_defineProperty(_assertThisInitialized(_this), "isChecked", function (role, checked) {
|
|
81
|
+
var rolesThatCanBeMixed = ['option', 'checkbox', 'menuitemcheckbox'];
|
|
82
|
+
var rolesThatCanBeChecked = [].concat(rolesThatCanBeMixed, ['radio', 'menuitemradio', 'switch']);
|
|
83
|
+
if (!rolesThatCanBeChecked.includes(role)) return undefined;
|
|
84
|
+
switch (checked) {
|
|
85
|
+
case 'on':
|
|
86
|
+
case 'off':
|
|
87
|
+
return true;
|
|
88
|
+
case 'mixed':
|
|
89
|
+
if (rolesThatCanBeMixed.includes(role)) {
|
|
90
|
+
return 'mixed';
|
|
91
|
+
} else {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
default:
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
return _this;
|
|
65
99
|
}
|
|
66
100
|
_createClass(EuiSelectableListItem, [{
|
|
67
101
|
key: "render",
|
|
@@ -100,41 +134,71 @@ var EuiSelectableListItem = /*#__PURE__*/function (_Component) {
|
|
|
100
134
|
});
|
|
101
135
|
}
|
|
102
136
|
var state;
|
|
103
|
-
var
|
|
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
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
137
|
+
var instructions;
|
|
138
|
+
var screenReaderStrings = {
|
|
139
|
+
checked: {
|
|
140
|
+
state: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
141
|
+
token: "euiSelectableListItem.checkedOption",
|
|
142
|
+
default: "Checked option."
|
|
143
|
+
}),
|
|
144
|
+
instructions: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
145
|
+
token: "euiSelectableListItem.checkOptionInstructions",
|
|
146
|
+
default: "To check this option, press Enter."
|
|
147
|
+
})
|
|
148
|
+
},
|
|
149
|
+
unchecked: {
|
|
150
|
+
instructions: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
151
|
+
token: "euiSelectableListItem.uncheckOptionInstructions",
|
|
152
|
+
default: "To uncheck this option, press Enter."
|
|
153
|
+
})
|
|
154
|
+
},
|
|
155
|
+
excluded: {
|
|
156
|
+
state: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
157
|
+
token: "euiSelectableListItem.excludedOption",
|
|
158
|
+
default: "Excluded option."
|
|
159
|
+
}),
|
|
160
|
+
instructions: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
161
|
+
token: "euiSelectableListItem.excludeOptionInstructions",
|
|
162
|
+
default: "To exclude this option, press Enter."
|
|
163
|
+
})
|
|
164
|
+
},
|
|
165
|
+
mixed: {
|
|
166
|
+
state: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
167
|
+
token: "euiSelectableListItem.mixedOption",
|
|
168
|
+
default: "Mixed (indeterminate) option."
|
|
169
|
+
}),
|
|
170
|
+
instructions: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
171
|
+
token: "euiSelectableListItem.mixedOptionInstructions",
|
|
172
|
+
default: "To check this option for all, press Enter once."
|
|
173
|
+
}),
|
|
174
|
+
uncheckInstructions: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
175
|
+
token: "euiSelectableListItem.mixedOptionUncheckInstructions",
|
|
176
|
+
default: "To uncheck this option for all, press Enter twice."
|
|
177
|
+
}),
|
|
178
|
+
excludeInstructions: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
179
|
+
token: "euiSelectableListItem.mixedOptionExcludeInstructions",
|
|
180
|
+
default: "To exclude this option for all, press Enter twice."
|
|
181
|
+
})
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
switch (checked) {
|
|
185
|
+
case 'on':
|
|
186
|
+
state = screenReaderStrings.checked.state;
|
|
187
|
+
// eslint-disable-next-line no-nested-ternary
|
|
188
|
+
instructions = allowExclusions ? screenReaderStrings.excluded.instructions : searchable ? screenReaderStrings.unchecked.instructions : undefined;
|
|
189
|
+
break;
|
|
190
|
+
case 'off':
|
|
191
|
+
state = screenReaderStrings.excluded.state;
|
|
192
|
+
instructions = screenReaderStrings.unchecked.instructions;
|
|
193
|
+
break;
|
|
194
|
+
case 'mixed':
|
|
195
|
+
state = screenReaderStrings.mixed.state;
|
|
196
|
+
instructions = (0, _react2.jsx)(_react.default.Fragment, null, screenReaderStrings.mixed.instructions, ' ', allowExclusions ? screenReaderStrings.mixed.excludeInstructions : screenReaderStrings.mixed.uncheckInstructions);
|
|
197
|
+
break;
|
|
198
|
+
case undefined:
|
|
199
|
+
default:
|
|
200
|
+
instructions = allowExclusions || searchable ? screenReaderStrings.checked.instructions : undefined;
|
|
201
|
+
break;
|
|
138
202
|
}
|
|
139
203
|
var prependNode;
|
|
140
204
|
if (prepend) {
|
|
@@ -171,22 +235,20 @@ var EuiSelectableListItem = /*#__PURE__*/function (_Component) {
|
|
|
171
235
|
}, append, " ", isFocused && !disabled ? onFocusBadgeNode : null);
|
|
172
236
|
}
|
|
173
237
|
}
|
|
174
|
-
var
|
|
238
|
+
var screenReaderText = (state || instructions) && (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("div", null, state || instructions ? '. ' : null, state, state && instructions ? ' ' : null, instructions));
|
|
175
239
|
return (0, _react2.jsx)("li", _extends({
|
|
176
240
|
role: role,
|
|
177
|
-
"
|
|
178
|
-
,
|
|
179
|
-
"aria-checked": role === 'option' ? isChecked : undefined // Whether the item is "checked"
|
|
241
|
+
"aria-disabled": disabled,
|
|
242
|
+
"aria-checked": this.isChecked(role, checked) // Whether the item is "checked"
|
|
180
243
|
,
|
|
181
244
|
"aria-selected": !disabled && isFocused // Whether the item has keyboard focus per W3 spec
|
|
182
245
|
,
|
|
183
|
-
className: classes
|
|
184
|
-
"aria-disabled": disabled
|
|
246
|
+
className: classes
|
|
185
247
|
}, rest), (0, _react2.jsx)("span", {
|
|
186
248
|
className: "euiSelectableListItem__content"
|
|
187
249
|
}, optionIcon, prependNode, (0, _react2.jsx)("span", {
|
|
188
250
|
className: textClasses
|
|
189
|
-
}, children,
|
|
251
|
+
}, children, screenReaderText), appendNode));
|
|
190
252
|
}
|
|
191
253
|
}]);
|
|
192
254
|
return EuiSelectableListItem;
|
|
@@ -206,7 +268,7 @@ EuiSelectableListItem.propTypes = {
|
|
|
206
268
|
/**
|
|
207
269
|
* Applies an icon and visual styling to activated items
|
|
208
270
|
*/
|
|
209
|
-
checked: _propTypes.default.oneOf(["on", "off", undefined]),
|
|
271
|
+
checked: _propTypes.default.oneOf(["on", "off", "mixed", undefined]),
|
|
210
272
|
/**
|
|
211
273
|
* Shows icons based on `checked` type
|
|
212
274
|
*/
|
|
@@ -281,8 +343,8 @@ EuiSelectableListItem.propTypes = {
|
|
|
281
343
|
searchable: _propTypes.default.bool,
|
|
282
344
|
/**
|
|
283
345
|
* Attribute applied the option `<li>`.
|
|
284
|
-
* If
|
|
285
|
-
*
|
|
346
|
+
* If set to a role that allows [aria-checked](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-checked),
|
|
347
|
+
* `aria-checked` will be automatically configured.
|
|
286
348
|
*/
|
|
287
349
|
role: _propTypes.default.any,
|
|
288
350
|
/**
|
|
@@ -371,11 +371,11 @@ EuiSelectableTemplateSitewide.propTypes = {
|
|
|
371
371
|
*/
|
|
372
372
|
key: _propTypes.default.string,
|
|
373
373
|
/**
|
|
374
|
-
* Leave `undefined` to indicate not selected
|
|
375
|
-
* 'on' to indicate inclusion
|
|
376
|
-
* '
|
|
374
|
+
* Leave `undefined` to indicate not selected. Pass a string of
|
|
375
|
+
* 'on' to indicate inclusion, 'off' to indicate exclusion,
|
|
376
|
+
* or 'mixed' to indicate inclusion for some.
|
|
377
377
|
*/
|
|
378
|
-
checked: _propTypes.default.oneOf(["on", "off", undefined]),
|
|
378
|
+
checked: _propTypes.default.oneOf(["on", "off", "mixed", undefined]),
|
|
379
379
|
disabled: _propTypes.default.bool,
|
|
380
380
|
/**
|
|
381
381
|
* Node to add between the selection icon and the label
|
|
@@ -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,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.setEuiDevProviderWarning = exports.getEuiDevProviderWarning = exports.EuiThemeProvider = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
var _css = require("@emotion/css");
|
|
9
11
|
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
10
12
|
var _context = require("./context");
|
|
11
13
|
var _utils = require("./utils");
|
|
12
14
|
var _react2 = require("@emotion/react");
|
|
15
|
+
var _excluded = ["cloneElement", "className"];
|
|
13
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
17
|
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); }
|
|
15
18
|
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; }
|
|
19
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
20
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
21
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
16
22
|
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; }
|
|
17
23
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18
24
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -37,7 +43,11 @@ var EuiThemeProvider = function EuiThemeProvider(_ref) {
|
|
|
37
43
|
var _system = _ref.theme,
|
|
38
44
|
_colorMode = _ref.colorMode,
|
|
39
45
|
_modifications = _ref.modify,
|
|
40
|
-
children = _ref.children
|
|
46
|
+
children = _ref.children,
|
|
47
|
+
wrapperProps = _ref.wrapperProps;
|
|
48
|
+
var _useContext = (0, _react.useContext)(_context.EuiNestedThemeContext),
|
|
49
|
+
isGlobalTheme = _useContext.isGlobalTheme,
|
|
50
|
+
bodyColor = _useContext.bodyColor;
|
|
41
51
|
var parentSystem = (0, _react.useContext)(_context.EuiSystemContext);
|
|
42
52
|
var parentModifications = (0, _react.useContext)(_context.EuiModificationsContext);
|
|
43
53
|
var parentColorMode = (0, _react.useContext)(_context.EuiColorModeContext);
|
|
@@ -92,6 +102,37 @@ var EuiThemeProvider = function EuiThemeProvider(_ref) {
|
|
|
92
102
|
setTheme((0, _utils.getComputed)(system, (0, _utils.buildTheme)(modifications, "_".concat(system.key)), colorMode));
|
|
93
103
|
}
|
|
94
104
|
}, [colorMode, system, modifications]);
|
|
105
|
+
var nestedThemeContext = (0, _react.useMemo)(function () {
|
|
106
|
+
return {
|
|
107
|
+
isGlobalTheme: false,
|
|
108
|
+
// The theme that determines the global body styles
|
|
109
|
+
bodyColor: isGlobalTheme ? theme.colors.text : bodyColor,
|
|
110
|
+
hasDifferentColorFromGlobalTheme: isGlobalTheme ? false : bodyColor !== theme.colors.text,
|
|
111
|
+
colorClassName: /*#__PURE__*/(0, _css.css)("label:euiColorMode-", _colorMode, ";color:", theme.colors.text, ";;label:colorClassName;")
|
|
112
|
+
};
|
|
113
|
+
}, [theme, isGlobalTheme, bodyColor, _colorMode]);
|
|
114
|
+
var renderedChildren = (0, _react.useMemo)(function () {
|
|
115
|
+
if (isGlobalTheme) {
|
|
116
|
+
return children; // No wrapper
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
var _ref2 = wrapperProps || {},
|
|
120
|
+
cloneElement = _ref2.cloneElement,
|
|
121
|
+
className = _ref2.className,
|
|
122
|
+
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
123
|
+
var props = _objectSpread(_objectSpread({}, rest), {}, {
|
|
124
|
+
className: (0, _classnames.default)(className, nestedThemeContext.colorClassName)
|
|
125
|
+
});
|
|
126
|
+
if (cloneElement) {
|
|
127
|
+
return /*#__PURE__*/_react.default.cloneElement(children, _objectSpread(_objectSpread({}, props), {}, {
|
|
128
|
+
className: (0, _classnames.default)(children.props.className, props.className)
|
|
129
|
+
}));
|
|
130
|
+
} else {
|
|
131
|
+
return (0, _react2.jsx)("span", _extends({}, props, {
|
|
132
|
+
className: (0, _classnames.default)('euiThemeProvider', props.className)
|
|
133
|
+
}), children);
|
|
134
|
+
}
|
|
135
|
+
}, [isGlobalTheme, nestedThemeContext, wrapperProps, children]);
|
|
95
136
|
return (0, _react2.jsx)(_context.EuiColorModeContext.Provider, {
|
|
96
137
|
value: colorMode
|
|
97
138
|
}, (0, _react2.jsx)(_context.EuiSystemContext.Provider, {
|
|
@@ -100,6 +141,8 @@ var EuiThemeProvider = function EuiThemeProvider(_ref) {
|
|
|
100
141
|
value: modifications
|
|
101
142
|
}, (0, _react2.jsx)(_context.EuiThemeContext.Provider, {
|
|
102
143
|
value: theme
|
|
103
|
-
},
|
|
144
|
+
}, (0, _react2.jsx)(_context.EuiNestedThemeContext.Provider, {
|
|
145
|
+
value: nestedThemeContext
|
|
146
|
+
}, renderedChildren)))));
|
|
104
147
|
};
|
|
105
148
|
exports.EuiThemeProvider = EuiThemeProvider;
|
|
@@ -125,7 +125,10 @@ var _EuiBottomBar = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
125
125
|
export var EuiBottomBar = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
126
126
|
var BottomBar = _EuiBottomBar;
|
|
127
127
|
return ___EmotionJSX(EuiThemeProvider, {
|
|
128
|
-
colorMode: 'dark'
|
|
128
|
+
colorMode: 'dark',
|
|
129
|
+
wrapperProps: {
|
|
130
|
+
cloneElement: true
|
|
131
|
+
}
|
|
129
132
|
}, ___EmotionJSX(BottomBar, _extends({
|
|
130
133
|
ref: ref
|
|
131
134
|
}, props)));
|
|
@@ -17,8 +17,8 @@ export var euiBottomBarStyles = function euiBottomBarStyles(euiThemeContext) {
|
|
|
17
17
|
var euiTheme = euiThemeContext.euiTheme;
|
|
18
18
|
return {
|
|
19
19
|
// Base
|
|
20
|
-
//
|
|
21
|
-
euiBottomBar: /*#__PURE__*/css(euiShadowFlat(euiThemeContext), ";background:", shade(euiTheme.colors.lightestShade, 0.5), ";
|
|
20
|
+
// `color` is inherited from the wrapping `EuiThemeProvider colorMode="dark"`
|
|
21
|
+
euiBottomBar: /*#__PURE__*/css(euiShadowFlat(euiThemeContext), ";background:", shade(euiTheme.colors.lightestShade, 0.5), ";", euiCanAnimate, "{animation:", euiBottomBarAppear, " ", euiTheme.animation.slow, " ", euiTheme.animation.resistance, ";};label:euiBottomBar;"),
|
|
22
22
|
static: /*#__PURE__*/css(";label:static;"),
|
|
23
23
|
fixed: /*#__PURE__*/css("z-index:", Number(euiTheme.levels.header) - 2, ";;label:fixed;"),
|
|
24
24
|
sticky: /*#__PURE__*/css("z-index:", Number(euiTheme.levels.header) - 2, ";;label:sticky;"),
|
|
@@ -49,7 +49,10 @@ export var EuiButton = function EuiButton(props) {
|
|
|
49
49
|
if (_color === 'ghost') {
|
|
50
50
|
// INCEPTION: If `ghost`, re-implement with a wrapping dark mode theme provider
|
|
51
51
|
return ___EmotionJSX(EuiThemeProvider, {
|
|
52
|
-
colorMode: "dark"
|
|
52
|
+
colorMode: "dark",
|
|
53
|
+
wrapperProps: {
|
|
54
|
+
cloneElement: true
|
|
55
|
+
}
|
|
53
56
|
}, ___EmotionJSX(EuiButton, _extends({}, props, {
|
|
54
57
|
color: "text"
|
|
55
58
|
})));
|
|
@@ -78,7 +78,10 @@ export var EuiButtonEmpty = function EuiButtonEmpty(props) {
|
|
|
78
78
|
if (_color === 'ghost') {
|
|
79
79
|
// INCEPTION: If `ghost`, re-implement with a wrapping dark mode theme provider
|
|
80
80
|
return ___EmotionJSX(EuiThemeProvider, {
|
|
81
|
-
colorMode: "dark"
|
|
81
|
+
colorMode: "dark",
|
|
82
|
+
wrapperProps: {
|
|
83
|
+
cloneElement: true
|
|
84
|
+
}
|
|
82
85
|
}, ___EmotionJSX(EuiButtonEmpty, _extends({}, props, {
|
|
83
86
|
color: "text"
|
|
84
87
|
})));
|
|
@@ -80,7 +80,10 @@ export var EuiButtonIcon = function EuiButtonIcon(props) {
|
|
|
80
80
|
if (_color === 'ghost') {
|
|
81
81
|
// INCEPTION: If `ghost`, re-implement with a wrapping dark mode theme provider
|
|
82
82
|
return ___EmotionJSX(EuiThemeProvider, {
|
|
83
|
-
colorMode: "dark"
|
|
83
|
+
colorMode: "dark",
|
|
84
|
+
wrapperProps: {
|
|
85
|
+
cloneElement: true
|
|
86
|
+
}
|
|
84
87
|
}, ___EmotionJSX(EuiButtonIcon, _extends({}, props, {
|
|
85
88
|
color: "text"
|
|
86
89
|
})));
|
|
@@ -233,10 +233,10 @@ describe('EuiFilterGroup multiselect example', function () {
|
|
|
233
233
|
cy.realPress('Tab');
|
|
234
234
|
cy.repeatRealPress('ArrowDown', 3);
|
|
235
235
|
cy.realPress('Enter');
|
|
236
|
-
cy.get('li[aria-selected="true"]').find('span.euiSelectableListItem__text').should('have.text', 'Dmitri Shostakovich -
|
|
236
|
+
cy.get('li[aria-selected="true"]').find('span.euiSelectableListItem__text').should('have.text', 'Dmitri Shostakovich - Checked option. To exclude this option, press Enter.');
|
|
237
237
|
cy.realPress('ArrowDown');
|
|
238
238
|
cy.repeatRealPress('Enter');
|
|
239
|
-
cy.get('li[aria-selected="true"]').find('span.euiSelectableListItem__text').should('have.text', 'Felix Mendelssohn-Bartholdy - Excluded option. To uncheck this option, press
|
|
239
|
+
cy.get('li[aria-selected="true"]').find('span.euiSelectableListItem__text').should('have.text', 'Felix Mendelssohn-Bartholdy - Excluded option. To uncheck this option, press Enter.');
|
|
240
240
|
cy.checkAxe();
|
|
241
241
|
});
|
|
242
242
|
it('has zero violations when filtering by searchbox', function () {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
1
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
4
|
var _excluded = ["className", "children", "headerZindexLocation", "maskRef"];
|
|
@@ -9,11 +10,6 @@ var _excluded = ["className", "children", "headerZindexLocation", "maskRef"];
|
|
|
9
10
|
* Side Public License, v 1.
|
|
10
11
|
*/
|
|
11
12
|
|
|
12
|
-
/**
|
|
13
|
-
* NOTE: We can't test this component because Enzyme doesn't support rendering
|
|
14
|
-
* into portals.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
13
|
import React, { useEffect, useState } from 'react';
|
|
18
14
|
import { cx } from '@emotion/css';
|
|
19
15
|
import { Global } from '@emotion/react';
|
|
@@ -50,11 +46,28 @@ export var EuiOverlayMask = function EuiOverlayMask(_ref) {
|
|
|
50
46
|
});
|
|
51
47
|
}, [overlayMaskNode]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
52
48
|
|
|
49
|
+
// Note: Use `classList.add/remove` instead of setting the entire `className`
|
|
50
|
+
// so as not to override any existing classes set by `EuiPortal`
|
|
53
51
|
useEffect(function () {
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
if (overlayMaskNode) {
|
|
53
|
+
overlayMaskNode.classList.add('euiOverlayMask', cssStyles);
|
|
54
|
+
overlayMaskNode.dataset.relativeToHeader = headerZindexLocation;
|
|
55
|
+
return function () {
|
|
56
|
+
return overlayMaskNode.classList.remove(cssStyles);
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}, [overlayMaskNode, cssStyles, headerZindexLocation]);
|
|
60
|
+
useEffect(function () {
|
|
61
|
+
if (className && overlayMaskNode) {
|
|
62
|
+
var _overlayMaskNode$clas;
|
|
63
|
+
var classNameArgs = className.split(' '); // The `classList` API doesn't support multiple classes in the same string
|
|
64
|
+
(_overlayMaskNode$clas = overlayMaskNode.classList).add.apply(_overlayMaskNode$clas, _toConsumableArray(classNameArgs));
|
|
65
|
+
return function () {
|
|
66
|
+
var _overlayMaskNode$clas2;
|
|
67
|
+
return (_overlayMaskNode$clas2 = overlayMaskNode.classList).remove.apply(_overlayMaskNode$clas2, _toConsumableArray(classNameArgs));
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}, [overlayMaskNode, className]);
|
|
58
71
|
return ___EmotionJSX(EuiPortal, {
|
|
59
72
|
portalRef: combinedMaskRef
|
|
60
73
|
}, ___EmotionJSX(Global, {
|