@elastic/eui 106.4.0 → 106.5.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/es/components/avatar/avatar.js +2 -0
- package/es/components/badge/badge.js +5 -7
- package/es/components/basic_table/basic_table.js +6 -0
- package/es/components/basic_table/in_memory_table.js +6 -0
- package/es/components/color_picker/color_picker_swatch.js +4 -0
- package/es/components/datagrid/data_grid.styles.js +1 -1
- package/es/components/date_picker/super_date_picker/quick_select_popover/quick_select.js +4 -4
- package/es/components/date_picker/super_date_picker/super_date_picker.styles.js +1 -1
- package/es/components/modal/modal.js +16 -5
- package/es/components/table/table_header_cell.js +4 -0
- package/es/components/tool_tip/icon_tip.js +4 -0
- package/es/components/tool_tip/tool_tip.js +8 -2
- package/es/services/color/contrast.js +11 -0
- package/eui.d.ts +129 -121
- package/i18ntokens.json +2305 -2287
- package/lib/components/avatar/avatar.js +2 -0
- package/lib/components/badge/badge.js +3 -5
- package/lib/components/basic_table/basic_table.js +6 -0
- package/lib/components/basic_table/in_memory_table.js +6 -0
- package/lib/components/color_picker/color_picker_swatch.js +4 -0
- package/lib/components/datagrid/data_grid.styles.js +1 -1
- package/lib/components/date_picker/super_date_picker/quick_select_popover/quick_select.js +4 -4
- package/lib/components/date_picker/super_date_picker/super_date_picker.styles.js +1 -1
- package/lib/components/modal/modal.js +15 -4
- package/lib/components/table/table_header_cell.js +4 -0
- package/lib/components/tool_tip/icon_tip.js +4 -0
- package/lib/components/tool_tip/tool_tip.js +9 -3
- package/lib/services/color/contrast.js +12 -1
- package/optimize/es/components/avatar/avatar.js +2 -0
- package/optimize/es/components/badge/badge.js +5 -7
- package/optimize/es/components/datagrid/data_grid.styles.js +1 -1
- package/optimize/es/components/date_picker/super_date_picker/quick_select_popover/quick_select.js +4 -4
- package/optimize/es/components/date_picker/super_date_picker/super_date_picker.styles.js +1 -1
- package/optimize/es/components/modal/modal.js +16 -5
- package/optimize/es/components/tool_tip/tool_tip.js +4 -2
- package/optimize/es/services/color/contrast.js +11 -0
- package/optimize/lib/components/avatar/avatar.js +2 -0
- package/optimize/lib/components/badge/badge.js +3 -5
- package/optimize/lib/components/datagrid/data_grid.styles.js +1 -1
- package/optimize/lib/components/date_picker/super_date_picker/quick_select_popover/quick_select.js +4 -4
- package/optimize/lib/components/date_picker/super_date_picker/super_date_picker.styles.js +1 -1
- package/optimize/lib/components/modal/modal.js +15 -4
- package/optimize/lib/components/tool_tip/tool_tip.js +5 -3
- package/optimize/lib/services/color/contrast.js +12 -1
- package/package.json +1 -1
- package/test-env/components/avatar/avatar.js +2 -0
- package/test-env/components/badge/badge.js +3 -5
- package/test-env/components/basic_table/basic_table.js +6 -0
- package/test-env/components/basic_table/in_memory_table.js +6 -0
- package/test-env/components/color_picker/color_picker_swatch.js +4 -0
- package/test-env/components/datagrid/data_grid.styles.js +1 -1
- package/test-env/components/date_picker/super_date_picker/quick_select_popover/quick_select.js +4 -4
- package/test-env/components/date_picker/super_date_picker/super_date_picker.styles.js +1 -1
- package/test-env/components/modal/modal.js +15 -4
- package/test-env/components/table/table_header_cell.js +4 -0
- package/test-env/components/tool_tip/icon_tip.js +4 -0
- package/test-env/components/tool_tip/tool_tip.js +9 -3
- package/test-env/services/color/contrast.js +12 -1
|
@@ -79,7 +79,7 @@ var euiSuperDatePickerStyles = exports.euiSuperDatePickerStyles = function euiSu
|
|
|
79
79
|
full: "\n label: isAutoRefreshOnly;\n display: block;\n "
|
|
80
80
|
},
|
|
81
81
|
// isQuickSelectOnly forces `width` to be `auto`
|
|
82
|
-
isQuickSelectOnly: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('min-width', 0), ".euiFormControlLayout__prepend{", (0, _global_styling.logicalCSS)('max-width', 'none'), ";};label:isQuickSelectOnly;"),
|
|
82
|
+
isQuickSelectOnly: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('min-width', 0), ".euiFormControlLayout__prepend{", (0, _global_styling.logicalCSS)('max-width', 'none'), ";}.euiFormControlLayoutDelimited__delimiter:first-child{", (0, _global_styling.logicalCSS)('padding-horizontal', 0), ";};label:isQuickSelectOnly;"),
|
|
83
83
|
euiSuperDatePicker__range: _ref,
|
|
84
84
|
euiSuperDatePicker__rangeInput: /*#__PURE__*/(0, _react.css)("flex-grow:1;", (0, _global_styling.logicalCSS)('width', 'auto'), " overflow:hidden;;label:euiSuperDatePicker__rangeInput;"),
|
|
85
85
|
euiSuperDatePicker__prettyFormat: /*#__PURE__*/(0, _react.css)(_buttonStyles(euiThemeContext), " text-align:start;", isRefreshVariant && prettyFormatStyles, ";;label:euiSuperDatePicker__prettyFormat;"),
|
|
@@ -17,8 +17,9 @@ var _focus_trap = require("../focus_trap");
|
|
|
17
17
|
var _overlay_mask = require("../overlay_mask");
|
|
18
18
|
var _i18n = require("../i18n");
|
|
19
19
|
var _modal = require("./modal.styles");
|
|
20
|
+
var _accessibility = require("../accessibility");
|
|
20
21
|
var _react2 = require("@emotion/react");
|
|
21
|
-
var _excluded = ["className", "children", "initialFocus", "onClose", "maxWidth", "role", "style", "focusTrapProps"];
|
|
22
|
+
var _excluded = ["className", "children", "initialFocus", "onClose", "maxWidth", "role", "style", "focusTrapProps", "aria-describedby"];
|
|
22
23
|
/*
|
|
23
24
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
24
25
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -39,6 +40,7 @@ var EuiModal = exports.EuiModal = function EuiModal(_ref) {
|
|
|
39
40
|
role = _ref$role === void 0 ? 'dialog' : _ref$role,
|
|
40
41
|
style = _ref.style,
|
|
41
42
|
focusTrapProps = _ref.focusTrapProps,
|
|
43
|
+
_ariaDescribedBy = _ref['aria-describedby'],
|
|
42
44
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
43
45
|
var onKeyDown = function onKeyDown(event) {
|
|
44
46
|
if (event.key === _services.keys.ESCAPE) {
|
|
@@ -60,6 +62,14 @@ var EuiModal = exports.EuiModal = function EuiModal(_ref) {
|
|
|
60
62
|
var styles = (0, _modal.euiModalStyles)(euiTheme);
|
|
61
63
|
var cssStyles = [styles.euiModal, maxWidth === true && styles.defaultMaxWidth];
|
|
62
64
|
var cssCloseIconStyles = [styles.euiModal__closeIcon];
|
|
65
|
+
var descriptionId = (0, _services.useGeneratedHtmlId)();
|
|
66
|
+
var ariaDescribedBy = (0, _classnames.default)(descriptionId, _ariaDescribedBy);
|
|
67
|
+
var screenReaderDescription = (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("p", {
|
|
68
|
+
id: descriptionId
|
|
69
|
+
}, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
70
|
+
token: "euiModal.screenReaderModalDialog",
|
|
71
|
+
default: "You are in a modal dialog. Press Escape or tap/click outside the dialog on the shadowed overlay to close."
|
|
72
|
+
})));
|
|
63
73
|
return (0, _react2.jsx)(_overlay_mask.EuiOverlayMask, null, (0, _react2.jsx)(_focus_trap.EuiFocusTrap, (0, _extends2.default)({}, focusTrapProps, {
|
|
64
74
|
initialFocus: initialFocus,
|
|
65
75
|
scrollLock: true,
|
|
@@ -71,8 +81,9 @@ var EuiModal = exports.EuiModal = function EuiModal(_ref) {
|
|
|
71
81
|
tabIndex: 0,
|
|
72
82
|
style: newStyle,
|
|
73
83
|
role: role,
|
|
74
|
-
"aria-modal": true
|
|
75
|
-
|
|
84
|
+
"aria-modal": true,
|
|
85
|
+
"aria-describedby": ariaDescribedBy
|
|
86
|
+
}, rest), children, screenReaderDescription, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
76
87
|
token: "euiModal.closeModal",
|
|
77
88
|
default: "Closes this modal window"
|
|
78
89
|
}, function (closeModal) {
|
|
@@ -84,5 +95,5 @@ var EuiModal = exports.EuiModal = function EuiModal(_ref) {
|
|
|
84
95
|
color: "text",
|
|
85
96
|
"aria-label": closeModal
|
|
86
97
|
});
|
|
87
|
-
})
|
|
98
|
+
}))));
|
|
88
99
|
};
|
|
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.POSITIONS = exports.EuiToolTip = void 0;
|
|
8
|
+
exports.POSITIONS = exports.EuiToolTip = exports.DEFAULT_TOOLTIP_OFFSET = void 0;
|
|
9
9
|
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"));
|
|
@@ -38,6 +38,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
38
38
|
*/
|
|
39
39
|
var POSITIONS = exports.POSITIONS = ['top', 'right', 'bottom', 'left'];
|
|
40
40
|
var DISPLAYS = ['inlineBlock', 'block'];
|
|
41
|
+
var DEFAULT_TOOLTIP_OFFSET = exports.DEFAULT_TOOLTIP_OFFSET = 16;
|
|
41
42
|
var delayToMsMap = {
|
|
42
43
|
regular: 250,
|
|
43
44
|
long: 250 * 5
|
|
@@ -112,7 +113,9 @@ var EuiToolTip = exports.EuiToolTip = /*#__PURE__*/function (_Component) {
|
|
|
112
113
|
}
|
|
113
114
|
});
|
|
114
115
|
(0, _defineProperty2.default)(_this, "positionToolTip", function () {
|
|
116
|
+
var _this$props$offset;
|
|
115
117
|
var requestedPosition = _this.props.position;
|
|
118
|
+
var offset = (_this$props$offset = _this.props.offset) !== null && _this$props$offset !== void 0 ? _this$props$offset : DEFAULT_TOOLTIP_OFFSET;
|
|
116
119
|
if (!_this.anchor || !_this.popover) {
|
|
117
120
|
return;
|
|
118
121
|
}
|
|
@@ -120,8 +123,7 @@ var EuiToolTip = exports.EuiToolTip = /*#__PURE__*/function (_Component) {
|
|
|
120
123
|
anchor: _this.anchor,
|
|
121
124
|
popover: _this.popover,
|
|
122
125
|
position: requestedPosition,
|
|
123
|
-
offset:
|
|
124
|
-
// offset popover 16px from the anchor
|
|
126
|
+
offset: offset,
|
|
125
127
|
arrowConfig: {
|
|
126
128
|
arrowWidth: 12,
|
|
127
129
|
arrowBuffer: 4
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.wcagContrastMin = exports.makeHighContrastColor = exports.makeDisabledContrastColor = void 0;
|
|
7
|
+
exports.wcagContrastMin = exports.warnIfContrastBelowMin = exports.makeHighContrastColor = exports.makeDisabledContrastColor = exports.getColorContrast = void 0;
|
|
8
8
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
9
|
var _chromaJs = _interopRequireDefault(require("chroma-js"));
|
|
10
10
|
var _manipulation = require("./manipulation");
|
|
@@ -17,6 +17,9 @@ var _utils = require("../theme/utils");
|
|
|
17
17
|
* Side Public License, v 1.
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
+
var getColorContrast = exports.getColorContrast = function getColorContrast(textColor, backgroundColor) {
|
|
21
|
+
return _chromaJs.default.contrast(textColor, backgroundColor);
|
|
22
|
+
};
|
|
20
23
|
var wcagContrastMin = exports.wcagContrastMin = 4.5; // WCAG AA minimum contrast ratio for normal (non-large) text
|
|
21
24
|
|
|
22
25
|
/**
|
|
@@ -75,4 +78,12 @@ var makeDisabledContrastColor = exports.makeDisabledContrastColor = function mak
|
|
|
75
78
|
return function (themeOrBackground) {
|
|
76
79
|
return makeHighContrastColor(color, ratio)(themeOrBackground);
|
|
77
80
|
};
|
|
81
|
+
};
|
|
82
|
+
var warnIfContrastBelowMin = exports.warnIfContrastBelowMin = function warnIfContrastBelowMin(textColor, backgroundColor) {
|
|
83
|
+
var min = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : wcagContrastMin;
|
|
84
|
+
var ratio = getColorContrast(textColor, backgroundColor);
|
|
85
|
+
if (ratio < min) {
|
|
86
|
+
// eslint-disable-next-line no-console
|
|
87
|
+
console.warn("Warning: ".concat(backgroundColor, " background with ").concat(textColor, " text has a low contrast of ").concat(ratio.toFixed(2), ". Should be above ").concat(min, "."));
|
|
88
|
+
}
|
|
78
89
|
};
|
package/package.json
CHANGED
|
@@ -13,6 +13,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
13
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
14
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
15
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
16
|
+
var _contrast = require("../../services/color/contrast");
|
|
16
17
|
var _color = require("../../services/color");
|
|
17
18
|
var _services = require("../../services");
|
|
18
19
|
var _icon = require("../icon");
|
|
@@ -83,6 +84,7 @@ var EuiAvatar = exports.EuiAvatar = function EuiAvatar(_ref) {
|
|
|
83
84
|
checkValidColor(color);
|
|
84
85
|
var assignedColor = color || visColors[Math.floor(name.length % visColors.length)];
|
|
85
86
|
var textColor = _color.isColorDark.apply(void 0, (0, _toConsumableArray2.default)((0, _color.hexToRgb)(assignedColor))) ? '#FFFFFF' : '#000000';
|
|
87
|
+
(0, _contrast.warnIfContrastBelowMin)(textColor, assignedColor, _contrast.wcagContrastMin);
|
|
86
88
|
return {
|
|
87
89
|
backgroundColor: assignedColor,
|
|
88
90
|
color: textColor
|
|
@@ -18,6 +18,7 @@ var _href_validator = require("../../services/security/href_validator");
|
|
|
18
18
|
var _inner_text = require("../inner_text");
|
|
19
19
|
var _icon = require("../icon");
|
|
20
20
|
var _color_utils = require("./color_utils");
|
|
21
|
+
var _contrast = require("../../services/color/contrast");
|
|
21
22
|
var _badge = require("./badge.styles");
|
|
22
23
|
var _react2 = require("@emotion/react");
|
|
23
24
|
var _excluded = ["children", "color", "iconType", "iconSide", "className", "isDisabled", "onClick", "iconOnClick", "onClickAriaLabel", "iconOnClickAriaLabel", "closeButtonProps", "href", "rel", "target", "style"];
|
|
@@ -68,11 +69,8 @@ var EuiBadge = exports.EuiBadge = function EuiBadge(_ref) {
|
|
|
68
69
|
// Set dark or light text color based upon best contrast
|
|
69
70
|
var textColor = (0, _color_utils.getTextColor)(euiTheme, color);
|
|
70
71
|
|
|
71
|
-
//
|
|
72
|
-
|
|
73
|
-
if (contrastRatio < _services.wcagContrastMin) {
|
|
74
|
-
console.warn("Warning: ".concat(color, " badge has a low contrast of ").concat(contrastRatio.toFixed(2), ". Should be above ").concat(_services.wcagContrastMin, "."));
|
|
75
|
-
}
|
|
72
|
+
// Emit a warning if contrast is below WCAG threshold (centralized util)
|
|
73
|
+
(0, _contrast.warnIfContrastBelowMin)(textColor, color, _contrast.wcagContrastMin);
|
|
76
74
|
return _objectSpread({
|
|
77
75
|
'--euiBadgeBackgroundColor': color,
|
|
78
76
|
'--euiBadgeTextColor': textColor
|
|
@@ -1129,6 +1129,10 @@ EuiBasicTable.propTypes = {
|
|
|
1129
1129
|
* hidden.
|
|
1130
1130
|
*/
|
|
1131
1131
|
onMouseOut: _propTypes.default.func,
|
|
1132
|
+
/**
|
|
1133
|
+
* Offset in pixels from the anchor. Defaults to 16.
|
|
1134
|
+
*/
|
|
1135
|
+
offset: _propTypes.default.number,
|
|
1132
1136
|
"aria-label": _propTypes.default.string,
|
|
1133
1137
|
"data-test-subj": _propTypes.default.string,
|
|
1134
1138
|
css: _propTypes.default.any,
|
|
@@ -1244,6 +1248,7 @@ EuiBasicTable.propTypes = {
|
|
|
1244
1248
|
repositionOnScroll: _propTypes.default.bool,
|
|
1245
1249
|
disableScreenReaderOutput: _propTypes.default.bool,
|
|
1246
1250
|
onMouseOut: _propTypes.default.func,
|
|
1251
|
+
offset: _propTypes.default.number,
|
|
1247
1252
|
"aria-label": _propTypes.default.string,
|
|
1248
1253
|
"data-test-subj": _propTypes.default.string,
|
|
1249
1254
|
css: _propTypes.default.any,
|
|
@@ -1385,6 +1390,7 @@ EuiBasicTable.propTypes = {
|
|
|
1385
1390
|
repositionOnScroll: _propTypes.default.bool,
|
|
1386
1391
|
disableScreenReaderOutput: _propTypes.default.bool,
|
|
1387
1392
|
onMouseOut: _propTypes.default.func,
|
|
1393
|
+
offset: _propTypes.default.number,
|
|
1388
1394
|
"aria-label": _propTypes.default.string,
|
|
1389
1395
|
"data-test-subj": _propTypes.default.string,
|
|
1390
1396
|
css: _propTypes.default.any,
|
|
@@ -631,6 +631,10 @@ EuiInMemoryTable.propTypes = {
|
|
|
631
631
|
* hidden.
|
|
632
632
|
*/
|
|
633
633
|
onMouseOut: _propTypes.default.func,
|
|
634
|
+
/**
|
|
635
|
+
* Offset in pixels from the anchor. Defaults to 16.
|
|
636
|
+
*/
|
|
637
|
+
offset: _propTypes.default.number,
|
|
634
638
|
"aria-label": _propTypes.default.string,
|
|
635
639
|
"data-test-subj": _propTypes.default.string,
|
|
636
640
|
css: _propTypes.default.any,
|
|
@@ -746,6 +750,7 @@ EuiInMemoryTable.propTypes = {
|
|
|
746
750
|
repositionOnScroll: _propTypes.default.bool,
|
|
747
751
|
disableScreenReaderOutput: _propTypes.default.bool,
|
|
748
752
|
onMouseOut: _propTypes.default.func,
|
|
753
|
+
offset: _propTypes.default.number,
|
|
749
754
|
"aria-label": _propTypes.default.string,
|
|
750
755
|
"data-test-subj": _propTypes.default.string,
|
|
751
756
|
css: _propTypes.default.any,
|
|
@@ -887,6 +892,7 @@ EuiInMemoryTable.propTypes = {
|
|
|
887
892
|
repositionOnScroll: _propTypes.default.bool,
|
|
888
893
|
disableScreenReaderOutput: _propTypes.default.bool,
|
|
889
894
|
onMouseOut: _propTypes.default.func,
|
|
895
|
+
offset: _propTypes.default.number,
|
|
890
896
|
"aria-label": _propTypes.default.string,
|
|
891
897
|
"data-test-subj": _propTypes.default.string,
|
|
892
898
|
css: _propTypes.default.any,
|
|
@@ -138,6 +138,10 @@ EuiColorPickerSwatch.propTypes = {
|
|
|
138
138
|
* hidden.
|
|
139
139
|
*/
|
|
140
140
|
onMouseOut: _propTypes.default.func,
|
|
141
|
+
/**
|
|
142
|
+
* Offset in pixels from the anchor. Defaults to 16.
|
|
143
|
+
*/
|
|
144
|
+
offset: _propTypes.default.number,
|
|
141
145
|
"aria-label": _propTypes.default.string,
|
|
142
146
|
"data-test-subj": _propTypes.default.string,
|
|
143
147
|
css: _propTypes.default.any,
|
|
@@ -58,7 +58,7 @@ var euiDataGridStyles = exports.euiDataGridStyles = function euiDataGridStyles(e
|
|
|
58
58
|
};
|
|
59
59
|
var border = "".concat(euiTheme.border.width.thin, " solid ").concat(borderColors.default);
|
|
60
60
|
return {
|
|
61
|
-
euiDataGrid: /*#__PURE__*/(0, _react.css)("display:flex;flex-direction:column;align-items:stretch;", (0, _global_styling.logicalCSS)('height', '100%'), " overflow:hidden;*:where(& .euiDataGridRow){background-color:", euiTheme.components.dataGridRowBackground, ";}*:where(&.euiDataGrid--rowHoverHighlight .euiDataGridRow:hover){background-color:", euiTheme.components.dataGridRowBackgroundHover, ";}*:where(
|
|
61
|
+
euiDataGrid: /*#__PURE__*/(0, _react.css)("display:flex;flex-direction:column;align-items:stretch;", (0, _global_styling.logicalCSS)('height', '100%'), " overflow:hidden;*:where(& .euiDataGridRow){background-color:", euiTheme.components.dataGridRowBackground, ";}*:where(&.euiDataGrid--rowHoverHighlight .euiDataGridRow:hover){background-color:", euiTheme.components.dataGridRowBackgroundHover, ";}*:where(& .euiDataGridRow--selected){background-color:", euiTheme.components.dataGridRowBackgroundSelect, ";}*:where(& .euiDataGridRow--marked){background-color:", euiTheme.components.dataGridRowBackgroundMarked, ";.euiDataGridRowCell.euiDataGridRowCell{", outlineSelectors.marked, "{", (0, _data_grid_cell.euiDataGridCellOutlineStyles)(euiThemeContext).markedStyles, ";}}}*:where(&.euiDataGrid--rowHoverHighlight .euiDataGridRow--marked){&:hover{background-color:", euiTheme.components.dataGridRowBackgroundMarkedHover, ";}}*:where(\n &.euiDataGrid--rowHoverHighlight .euiDataGridRow--selected:hover\n ){background-color:", euiTheme.components.dataGridRowBackgroundSelectHover, ";}*:where(&.euiDataGrid--stripes .euiDataGridRow){background-color:", euiTheme.components.dataGridRowStripesBackground, ";}*:where(&.euiDataGrid--stripes .euiDataGridRow--striped){background-color:", euiTheme.components.dataGridRowStripesBackgroundStriped, ";}*:where(\n &.euiDataGrid--stripes.euiDataGrid--rowHoverHighlight\n .euiDataGridRow:hover\n ){background-color:", euiTheme.components.dataGridRowStripesBackgroundHover, ";}*:where(\n &.euiDataGrid--stripes.euiDataGrid--rowHoverHighlight\n .euiDataGridRow--striped:hover\n ){background-color:", euiTheme.components.dataGridRowStripesBackgroundStripedHover, ";}*:where(&.euiDataGrid--stripes .euiDataGridRow--selected){background-color:", euiTheme.components.dataGridRowStripesBackgroundSelect, ";}*:where(&.euiDataGrid--stripes .euiDataGridRow--marked){background-color:", euiTheme.components.dataGridRowBackgroundMarked, ";}*:where(\n &.euiDataGrid--stripes.euiDataGrid--rowHoverHighlight\n .euiDataGridRow--selected:hover\n ){background-color:", euiTheme.components.dataGridRowStripesBackgroundSelectHover, ";}*:where(&.euiDataGrid--rowHoverHighlight .euiDataGridRow)::before{content:'';position:absolute;z-index:-1;pointer-events:none;inset:0;background-color:", euiTheme.components.dataGridRowBackground, ";};label:euiDataGrid;"),
|
|
62
62
|
cellPadding: {
|
|
63
63
|
cellPadding: function cellPadding(size) {
|
|
64
64
|
return /*#__PURE__*/(0, _react.css)(".euiDataGridHeaderCell,.euiDataGridRowCell__content{padding:", _cellPadding[size], ";}.euiDataGridRowCell__content--lineCountHeight,.euiDataGridRowCell__content--autoBelowLineCountHeight{", (0, _high_contrast.highContrastModeStyles)(euiThemeContext, {
|
package/test-env/components/date_picker/super_date_picker/quick_select_popover/quick_select.js
CHANGED
|
@@ -121,8 +121,8 @@ var EuiQuickSelect = exports.EuiQuickSelect = /*#__PURE__*/function (_Component)
|
|
|
121
121
|
max = _this$getBounds.max;
|
|
122
122
|
var diff = max.diff(min);
|
|
123
123
|
_this.props.applyTime({
|
|
124
|
-
start: (0, _moment.default)(max).
|
|
125
|
-
end: (0, _moment.default)(max).add(diff
|
|
124
|
+
start: (0, _moment.default)(max).toISOString(),
|
|
125
|
+
end: (0, _moment.default)(max).add(diff, 'ms').toISOString(),
|
|
126
126
|
keepPopoverOpen: true
|
|
127
127
|
});
|
|
128
128
|
});
|
|
@@ -132,8 +132,8 @@ var EuiQuickSelect = exports.EuiQuickSelect = /*#__PURE__*/function (_Component)
|
|
|
132
132
|
max = _this$getBounds2.max;
|
|
133
133
|
var diff = max.diff(min);
|
|
134
134
|
_this.props.applyTime({
|
|
135
|
-
start: (0, _moment.default)(min).subtract(diff
|
|
136
|
-
end: (0, _moment.default)(min).
|
|
135
|
+
start: (0, _moment.default)(min).subtract(diff, 'ms').toISOString(),
|
|
136
|
+
end: (0, _moment.default)(min).toISOString(),
|
|
137
137
|
keepPopoverOpen: true
|
|
138
138
|
});
|
|
139
139
|
});
|
|
@@ -79,7 +79,7 @@ var euiSuperDatePickerStyles = exports.euiSuperDatePickerStyles = function euiSu
|
|
|
79
79
|
full: "\n label: isAutoRefreshOnly;\n display: block;\n "
|
|
80
80
|
},
|
|
81
81
|
// isQuickSelectOnly forces `width` to be `auto`
|
|
82
|
-
isQuickSelectOnly: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('min-width', 0), ".euiFormControlLayout__prepend{", (0, _global_styling.logicalCSS)('max-width', 'none'), ";};label:isQuickSelectOnly;"),
|
|
82
|
+
isQuickSelectOnly: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('min-width', 0), ".euiFormControlLayout__prepend{", (0, _global_styling.logicalCSS)('max-width', 'none'), ";}.euiFormControlLayoutDelimited__delimiter:first-child{", (0, _global_styling.logicalCSS)('padding-horizontal', 0), ";};label:isQuickSelectOnly;"),
|
|
83
83
|
euiSuperDatePicker__range: _ref,
|
|
84
84
|
euiSuperDatePicker__rangeInput: /*#__PURE__*/(0, _react.css)("flex-grow:1;", (0, _global_styling.logicalCSS)('width', 'auto'), " overflow:hidden;;label:euiSuperDatePicker__rangeInput;"),
|
|
85
85
|
euiSuperDatePicker__prettyFormat: /*#__PURE__*/(0, _react.css)(_buttonStyles(euiThemeContext), " text-align:start;", isRefreshVariant && prettyFormatStyles, ";;label:euiSuperDatePicker__prettyFormat;"),
|
|
@@ -18,8 +18,9 @@ var _focus_trap = require("../focus_trap");
|
|
|
18
18
|
var _overlay_mask = require("../overlay_mask");
|
|
19
19
|
var _i18n = require("../i18n");
|
|
20
20
|
var _modal = require("./modal.styles");
|
|
21
|
+
var _accessibility = require("../accessibility");
|
|
21
22
|
var _react2 = require("@emotion/react");
|
|
22
|
-
var _excluded = ["className", "children", "initialFocus", "onClose", "maxWidth", "role", "style", "focusTrapProps"];
|
|
23
|
+
var _excluded = ["className", "children", "initialFocus", "onClose", "maxWidth", "role", "style", "focusTrapProps", "aria-describedby"];
|
|
23
24
|
/*
|
|
24
25
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
25
26
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -40,6 +41,7 @@ var EuiModal = exports.EuiModal = function EuiModal(_ref) {
|
|
|
40
41
|
role = _ref$role === void 0 ? 'dialog' : _ref$role,
|
|
41
42
|
style = _ref.style,
|
|
42
43
|
focusTrapProps = _ref.focusTrapProps,
|
|
44
|
+
_ariaDescribedBy = _ref['aria-describedby'],
|
|
43
45
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
44
46
|
var onKeyDown = function onKeyDown(event) {
|
|
45
47
|
if (event.key === _services.keys.ESCAPE) {
|
|
@@ -61,6 +63,14 @@ var EuiModal = exports.EuiModal = function EuiModal(_ref) {
|
|
|
61
63
|
var styles = (0, _modal.euiModalStyles)(euiTheme);
|
|
62
64
|
var cssStyles = [styles.euiModal, maxWidth === true && styles.defaultMaxWidth];
|
|
63
65
|
var cssCloseIconStyles = [styles.euiModal__closeIcon];
|
|
66
|
+
var descriptionId = (0, _services.useGeneratedHtmlId)();
|
|
67
|
+
var ariaDescribedBy = (0, _classnames.default)(descriptionId, _ariaDescribedBy);
|
|
68
|
+
var screenReaderDescription = (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("p", {
|
|
69
|
+
id: descriptionId
|
|
70
|
+
}, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
71
|
+
token: "euiModal.screenReaderModalDialog",
|
|
72
|
+
default: "You are in a modal dialog. Press Escape or tap/click outside the dialog on the shadowed overlay to close."
|
|
73
|
+
})));
|
|
64
74
|
return (0, _react2.jsx)(_overlay_mask.EuiOverlayMask, null, (0, _react2.jsx)(_focus_trap.EuiFocusTrap, (0, _extends2.default)({}, focusTrapProps, {
|
|
65
75
|
initialFocus: initialFocus,
|
|
66
76
|
scrollLock: true,
|
|
@@ -72,8 +82,9 @@ var EuiModal = exports.EuiModal = function EuiModal(_ref) {
|
|
|
72
82
|
tabIndex: 0,
|
|
73
83
|
style: newStyle,
|
|
74
84
|
role: role,
|
|
75
|
-
"aria-modal": true
|
|
76
|
-
|
|
85
|
+
"aria-modal": true,
|
|
86
|
+
"aria-describedby": ariaDescribedBy
|
|
87
|
+
}, rest), children, screenReaderDescription, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
77
88
|
token: "euiModal.closeModal",
|
|
78
89
|
default: "Closes this modal window"
|
|
79
90
|
}, function (closeModal) {
|
|
@@ -85,7 +96,7 @@ var EuiModal = exports.EuiModal = function EuiModal(_ref) {
|
|
|
85
96
|
color: "text",
|
|
86
97
|
"aria-label": closeModal
|
|
87
98
|
});
|
|
88
|
-
})
|
|
99
|
+
}))));
|
|
89
100
|
};
|
|
90
101
|
EuiModal.propTypes = {
|
|
91
102
|
className: _propTypes.default.string,
|
|
@@ -226,6 +226,10 @@ EuiTableHeaderCell.propTypes = {
|
|
|
226
226
|
* hidden.
|
|
227
227
|
*/
|
|
228
228
|
onMouseOut: _propTypes.default.func,
|
|
229
|
+
/**
|
|
230
|
+
* Offset in pixels from the anchor. Defaults to 16.
|
|
231
|
+
*/
|
|
232
|
+
offset: _propTypes.default.number,
|
|
229
233
|
"aria-label": _propTypes.default.string,
|
|
230
234
|
"data-test-subj": _propTypes.default.string,
|
|
231
235
|
css: _propTypes.default.any,
|
|
@@ -100,6 +100,10 @@ EuiIconTip.propTypes = {
|
|
|
100
100
|
* hidden.
|
|
101
101
|
*/
|
|
102
102
|
onMouseOut: _propTypes.default.func,
|
|
103
|
+
/**
|
|
104
|
+
* Offset in pixels from the anchor. Defaults to 16.
|
|
105
|
+
*/
|
|
106
|
+
offset: _propTypes.default.number,
|
|
103
107
|
/**
|
|
104
108
|
* Explain what this icon means for screen readers.
|
|
105
109
|
*/
|
|
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.POSITIONS = exports.EuiToolTip = void 0;
|
|
8
|
+
exports.POSITIONS = exports.EuiToolTip = exports.DEFAULT_TOOLTIP_OFFSET = void 0;
|
|
9
9
|
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"));
|
|
@@ -39,6 +39,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
39
39
|
*/
|
|
40
40
|
var POSITIONS = exports.POSITIONS = ['top', 'right', 'bottom', 'left'];
|
|
41
41
|
var DISPLAYS = ['inlineBlock', 'block'];
|
|
42
|
+
var DEFAULT_TOOLTIP_OFFSET = exports.DEFAULT_TOOLTIP_OFFSET = 16;
|
|
42
43
|
var delayToMsMap = {
|
|
43
44
|
regular: 250,
|
|
44
45
|
long: 250 * 5
|
|
@@ -113,7 +114,9 @@ var EuiToolTip = exports.EuiToolTip = /*#__PURE__*/function (_Component) {
|
|
|
113
114
|
}
|
|
114
115
|
});
|
|
115
116
|
(0, _defineProperty2.default)(_this, "positionToolTip", function () {
|
|
117
|
+
var _this$props$offset;
|
|
116
118
|
var requestedPosition = _this.props.position;
|
|
119
|
+
var offset = (_this$props$offset = _this.props.offset) !== null && _this$props$offset !== void 0 ? _this$props$offset : DEFAULT_TOOLTIP_OFFSET;
|
|
117
120
|
if (!_this.anchor || !_this.popover) {
|
|
118
121
|
return;
|
|
119
122
|
}
|
|
@@ -121,8 +124,7 @@ var EuiToolTip = exports.EuiToolTip = /*#__PURE__*/function (_Component) {
|
|
|
121
124
|
anchor: _this.anchor,
|
|
122
125
|
popover: _this.popover,
|
|
123
126
|
position: requestedPosition,
|
|
124
|
-
offset:
|
|
125
|
-
// offset popover 16px from the anchor
|
|
127
|
+
offset: offset,
|
|
126
128
|
arrowConfig: {
|
|
127
129
|
arrowWidth: 12,
|
|
128
130
|
arrowBuffer: 4
|
|
@@ -369,6 +371,10 @@ EuiToolTip.propTypes = {
|
|
|
369
371
|
* hidden.
|
|
370
372
|
*/
|
|
371
373
|
onMouseOut: _propTypes.default.func,
|
|
374
|
+
/**
|
|
375
|
+
* Offset in pixels from the anchor. Defaults to 16.
|
|
376
|
+
*/
|
|
377
|
+
offset: _propTypes.default.number,
|
|
372
378
|
"aria-label": _propTypes.default.string,
|
|
373
379
|
"data-test-subj": _propTypes.default.string,
|
|
374
380
|
css: _propTypes.default.any
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.wcagContrastMin = exports.makeHighContrastColor = exports.makeDisabledContrastColor = void 0;
|
|
7
|
+
exports.wcagContrastMin = exports.warnIfContrastBelowMin = exports.makeHighContrastColor = exports.makeDisabledContrastColor = exports.getColorContrast = void 0;
|
|
8
8
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
9
|
var _chromaJs = _interopRequireDefault(require("chroma-js"));
|
|
10
10
|
var _manipulation = require("./manipulation");
|
|
@@ -17,6 +17,9 @@ var _utils = require("../theme/utils");
|
|
|
17
17
|
* Side Public License, v 1.
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
+
var getColorContrast = exports.getColorContrast = function getColorContrast(textColor, backgroundColor) {
|
|
21
|
+
return _chromaJs.default.contrast(textColor, backgroundColor);
|
|
22
|
+
};
|
|
20
23
|
var wcagContrastMin = exports.wcagContrastMin = 4.5; // WCAG AA minimum contrast ratio for normal (non-large) text
|
|
21
24
|
|
|
22
25
|
/**
|
|
@@ -75,4 +78,12 @@ var makeDisabledContrastColor = exports.makeDisabledContrastColor = function mak
|
|
|
75
78
|
return function (themeOrBackground) {
|
|
76
79
|
return makeHighContrastColor(color, ratio)(themeOrBackground);
|
|
77
80
|
};
|
|
81
|
+
};
|
|
82
|
+
var warnIfContrastBelowMin = exports.warnIfContrastBelowMin = function warnIfContrastBelowMin(textColor, backgroundColor) {
|
|
83
|
+
var min = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : wcagContrastMin;
|
|
84
|
+
var ratio = getColorContrast(textColor, backgroundColor);
|
|
85
|
+
if (ratio < min) {
|
|
86
|
+
// eslint-disable-next-line no-console
|
|
87
|
+
console.warn("Warning: ".concat(backgroundColor, " background with ").concat(textColor, " text has a low contrast of ").concat(ratio.toFixed(2), ". Should be above ").concat(min, "."));
|
|
88
|
+
}
|
|
78
89
|
};
|