@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 () {
|
|
@@ -588,11 +588,11 @@ EuiSelectable.propTypes = {
|
|
|
588
588
|
*/
|
|
589
589
|
key: _propTypes.default.string,
|
|
590
590
|
/**
|
|
591
|
-
* Leave `undefined` to indicate not selected
|
|
592
|
-
* 'on' to indicate inclusion
|
|
593
|
-
* '
|
|
591
|
+
* Leave `undefined` to indicate not selected. Pass a string of
|
|
592
|
+
* 'on' to indicate inclusion, 'off' to indicate exclusion,
|
|
593
|
+
* or 'mixed' to indicate inclusion for some.
|
|
594
594
|
*/
|
|
595
|
-
checked: _propTypes.default.oneOf(["on", "off", undefined]),
|
|
595
|
+
checked: _propTypes.default.oneOf(["on", "off", "mixed", undefined]),
|
|
596
596
|
disabled: _propTypes.default.bool,
|
|
597
597
|
/**
|
|
598
598
|
* Node to add between the selection icon and the label
|
|
@@ -471,11 +471,11 @@ EuiSelectableList.propTypes = {
|
|
|
471
471
|
*/
|
|
472
472
|
key: _propTypes.default.string,
|
|
473
473
|
/**
|
|
474
|
-
* Leave `undefined` to indicate not selected
|
|
475
|
-
* 'on' to indicate inclusion
|
|
476
|
-
* '
|
|
474
|
+
* Leave `undefined` to indicate not selected. Pass a string of
|
|
475
|
+
* 'on' to indicate inclusion, 'off' to indicate exclusion,
|
|
476
|
+
* or 'mixed' to indicate inclusion for some.
|
|
477
477
|
*/
|
|
478
|
-
checked: _propTypes.default.oneOf(["on", "off", undefined]),
|
|
478
|
+
checked: _propTypes.default.oneOf(["on", "off", "mixed", undefined]),
|
|
479
479
|
disabled: _propTypes.default.bool,
|
|
480
480
|
/**
|
|
481
481
|
* Node to add between the selection icon and the label
|
|
@@ -504,7 +504,7 @@ EuiSelectableList.propTypes = {
|
|
|
504
504
|
label: _propTypes.default.string,
|
|
505
505
|
searchableLabel: _propTypes.default.string,
|
|
506
506
|
key: _propTypes.default.string,
|
|
507
|
-
checked: _propTypes.default.oneOf(["on", "off", undefined]),
|
|
507
|
+
checked: _propTypes.default.oneOf(["on", "off", "mixed", undefined]),
|
|
508
508
|
disabled: _propTypes.default.bool,
|
|
509
509
|
prepend: _propTypes.default.node,
|
|
510
510
|
append: _propTypes.default.node,
|
|
@@ -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"));
|
|
@@ -30,18 +31,28 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
30
31
|
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); }; }
|
|
31
32
|
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; } }
|
|
32
33
|
function resolveIconAndColor(checked) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
switch (checked) {
|
|
35
|
+
case 'on':
|
|
36
|
+
return {
|
|
37
|
+
icon: 'check',
|
|
38
|
+
color: 'text'
|
|
39
|
+
};
|
|
40
|
+
case 'off':
|
|
41
|
+
return {
|
|
42
|
+
icon: 'cross',
|
|
43
|
+
color: 'text'
|
|
44
|
+
};
|
|
45
|
+
case 'mixed':
|
|
46
|
+
return {
|
|
47
|
+
icon: 'minus',
|
|
48
|
+
color: 'text'
|
|
49
|
+
};
|
|
50
|
+
case undefined:
|
|
51
|
+
default:
|
|
52
|
+
return {
|
|
53
|
+
icon: 'empty'
|
|
54
|
+
};
|
|
37
55
|
}
|
|
38
|
-
return checked === 'on' ? {
|
|
39
|
-
icon: 'check',
|
|
40
|
-
color: 'text'
|
|
41
|
-
} : {
|
|
42
|
-
icon: 'cross',
|
|
43
|
-
color: 'text'
|
|
44
|
-
};
|
|
45
56
|
}
|
|
46
57
|
var paddingSizeToClassNameMap = {
|
|
47
58
|
none: null,
|
|
@@ -54,8 +65,32 @@ var EuiSelectableListItem = /*#__PURE__*/function (_Component) {
|
|
|
54
65
|
(0, _inherits2.default)(EuiSelectableListItem, _Component);
|
|
55
66
|
var _super = _createSuper(EuiSelectableListItem);
|
|
56
67
|
function EuiSelectableListItem(props) {
|
|
68
|
+
var _this;
|
|
57
69
|
(0, _classCallCheck2.default)(this, EuiSelectableListItem);
|
|
58
|
-
|
|
70
|
+
_this = _super.call(this, props);
|
|
71
|
+
// aria-checked is intended to be used with role="checkbox" but
|
|
72
|
+
// the MDN documentation lists it as a possibility for role="option".
|
|
73
|
+
// See https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-checked
|
|
74
|
+
// and https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/option_role
|
|
75
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isChecked", function (role, checked) {
|
|
76
|
+
var rolesThatCanBeMixed = ['option', 'checkbox', 'menuitemcheckbox'];
|
|
77
|
+
var rolesThatCanBeChecked = [].concat(rolesThatCanBeMixed, ['radio', 'menuitemradio', 'switch']);
|
|
78
|
+
if (!rolesThatCanBeChecked.includes(role)) return undefined;
|
|
79
|
+
switch (checked) {
|
|
80
|
+
case 'on':
|
|
81
|
+
case 'off':
|
|
82
|
+
return true;
|
|
83
|
+
case 'mixed':
|
|
84
|
+
if (rolesThatCanBeMixed.includes(role)) {
|
|
85
|
+
return 'mixed';
|
|
86
|
+
} else {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
default:
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
return _this;
|
|
59
94
|
}
|
|
60
95
|
(0, _createClass2.default)(EuiSelectableListItem, [{
|
|
61
96
|
key: "render",
|
|
@@ -94,41 +129,71 @@ var EuiSelectableListItem = /*#__PURE__*/function (_Component) {
|
|
|
94
129
|
});
|
|
95
130
|
}
|
|
96
131
|
var state;
|
|
97
|
-
var
|
|
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
|
-
|
|
132
|
+
var instructions;
|
|
133
|
+
var screenReaderStrings = {
|
|
134
|
+
checked: {
|
|
135
|
+
state: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
136
|
+
token: "euiSelectableListItem.checkedOption",
|
|
137
|
+
default: "Checked option."
|
|
138
|
+
}),
|
|
139
|
+
instructions: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
140
|
+
token: "euiSelectableListItem.checkOptionInstructions",
|
|
141
|
+
default: "To check this option, press Enter."
|
|
142
|
+
})
|
|
143
|
+
},
|
|
144
|
+
unchecked: {
|
|
145
|
+
instructions: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
146
|
+
token: "euiSelectableListItem.uncheckOptionInstructions",
|
|
147
|
+
default: "To uncheck this option, press Enter."
|
|
148
|
+
})
|
|
149
|
+
},
|
|
150
|
+
excluded: {
|
|
151
|
+
state: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
152
|
+
token: "euiSelectableListItem.excludedOption",
|
|
153
|
+
default: "Excluded option."
|
|
154
|
+
}),
|
|
155
|
+
instructions: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
156
|
+
token: "euiSelectableListItem.excludeOptionInstructions",
|
|
157
|
+
default: "To exclude this option, press Enter."
|
|
158
|
+
})
|
|
159
|
+
},
|
|
160
|
+
mixed: {
|
|
161
|
+
state: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
162
|
+
token: "euiSelectableListItem.mixedOption",
|
|
163
|
+
default: "Mixed (indeterminate) option."
|
|
164
|
+
}),
|
|
165
|
+
instructions: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
166
|
+
token: "euiSelectableListItem.mixedOptionInstructions",
|
|
167
|
+
default: "To check this option for all, press Enter once."
|
|
168
|
+
}),
|
|
169
|
+
uncheckInstructions: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
170
|
+
token: "euiSelectableListItem.mixedOptionUncheckInstructions",
|
|
171
|
+
default: "To uncheck this option for all, press Enter twice."
|
|
172
|
+
}),
|
|
173
|
+
excludeInstructions: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
174
|
+
token: "euiSelectableListItem.mixedOptionExcludeInstructions",
|
|
175
|
+
default: "To exclude this option for all, press Enter twice."
|
|
176
|
+
})
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
switch (checked) {
|
|
180
|
+
case 'on':
|
|
181
|
+
state = screenReaderStrings.checked.state;
|
|
182
|
+
// eslint-disable-next-line no-nested-ternary
|
|
183
|
+
instructions = allowExclusions ? screenReaderStrings.excluded.instructions : searchable ? screenReaderStrings.unchecked.instructions : undefined;
|
|
184
|
+
break;
|
|
185
|
+
case 'off':
|
|
186
|
+
state = screenReaderStrings.excluded.state;
|
|
187
|
+
instructions = screenReaderStrings.unchecked.instructions;
|
|
188
|
+
break;
|
|
189
|
+
case 'mixed':
|
|
190
|
+
state = screenReaderStrings.mixed.state;
|
|
191
|
+
instructions = (0, _react2.jsx)(_react.default.Fragment, null, screenReaderStrings.mixed.instructions, ' ', allowExclusions ? screenReaderStrings.mixed.excludeInstructions : screenReaderStrings.mixed.uncheckInstructions);
|
|
192
|
+
break;
|
|
193
|
+
case undefined:
|
|
194
|
+
default:
|
|
195
|
+
instructions = allowExclusions || searchable ? screenReaderStrings.checked.instructions : undefined;
|
|
196
|
+
break;
|
|
132
197
|
}
|
|
133
198
|
var prependNode;
|
|
134
199
|
if (prepend) {
|
|
@@ -165,22 +230,20 @@ var EuiSelectableListItem = /*#__PURE__*/function (_Component) {
|
|
|
165
230
|
}, append, " ", isFocused && !disabled ? onFocusBadgeNode : null);
|
|
166
231
|
}
|
|
167
232
|
}
|
|
168
|
-
var
|
|
233
|
+
var screenReaderText = (state || instructions) && (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("div", null, state || instructions ? '. ' : null, state, state && instructions ? ' ' : null, instructions));
|
|
169
234
|
return (0, _react2.jsx)("li", (0, _extends2.default)({
|
|
170
235
|
role: role,
|
|
171
|
-
"
|
|
172
|
-
,
|
|
173
|
-
"aria-checked": role === 'option' ? isChecked : undefined // Whether the item is "checked"
|
|
236
|
+
"aria-disabled": disabled,
|
|
237
|
+
"aria-checked": this.isChecked(role, checked) // Whether the item is "checked"
|
|
174
238
|
,
|
|
175
239
|
"aria-selected": !disabled && isFocused // Whether the item has keyboard focus per W3 spec
|
|
176
240
|
,
|
|
177
|
-
className: classes
|
|
178
|
-
"aria-disabled": disabled
|
|
241
|
+
className: classes
|
|
179
242
|
}, rest), (0, _react2.jsx)("span", {
|
|
180
243
|
className: "euiSelectableListItem__content"
|
|
181
244
|
}, optionIcon, prependNode, (0, _react2.jsx)("span", {
|
|
182
245
|
className: textClasses
|
|
183
|
-
}, children,
|
|
246
|
+
}, children, screenReaderText), appendNode));
|
|
184
247
|
}
|
|
185
248
|
}]);
|
|
186
249
|
return EuiSelectableListItem;
|
|
@@ -200,7 +263,7 @@ EuiSelectableListItem.propTypes = {
|
|
|
200
263
|
/**
|
|
201
264
|
* Applies an icon and visual styling to activated items
|
|
202
265
|
*/
|
|
203
|
-
checked: _propTypes.default.oneOf(["on", "off", undefined]),
|
|
266
|
+
checked: _propTypes.default.oneOf(["on", "off", "mixed", undefined]),
|
|
204
267
|
/**
|
|
205
268
|
* Shows icons based on `checked` type
|
|
206
269
|
*/
|
|
@@ -275,8 +338,8 @@ EuiSelectableListItem.propTypes = {
|
|
|
275
338
|
searchable: _propTypes.default.bool,
|
|
276
339
|
/**
|
|
277
340
|
* Attribute applied the option `<li>`.
|
|
278
|
-
* If
|
|
279
|
-
*
|
|
341
|
+
* If set to a role that allows [aria-checked](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-checked),
|
|
342
|
+
* `aria-checked` will be automatically configured.
|
|
280
343
|
*/
|
|
281
344
|
role: _propTypes.default.any,
|
|
282
345
|
/**
|
|
@@ -363,11 +363,11 @@ EuiSelectableTemplateSitewide.propTypes = {
|
|
|
363
363
|
*/
|
|
364
364
|
key: _propTypes.default.string,
|
|
365
365
|
/**
|
|
366
|
-
* Leave `undefined` to indicate not selected
|
|
367
|
-
* 'on' to indicate inclusion
|
|
368
|
-
* '
|
|
366
|
+
* Leave `undefined` to indicate not selected. Pass a string of
|
|
367
|
+
* 'on' to indicate inclusion, 'off' to indicate exclusion,
|
|
368
|
+
* or 'mixed' to indicate inclusion for some.
|
|
369
369
|
*/
|
|
370
|
-
checked: _propTypes.default.oneOf(["on", "off", undefined]),
|
|
370
|
+
checked: _propTypes.default.oneOf(["on", "off", "mixed", undefined]),
|
|
371
371
|
disabled: _propTypes.default.bool,
|
|
372
372
|
/**
|
|
373
373
|
* 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,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;
|