@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.
Files changed (58) hide show
  1. package/es/components/avatar/avatar.js +2 -0
  2. package/es/components/badge/badge.js +5 -7
  3. package/es/components/basic_table/basic_table.js +6 -0
  4. package/es/components/basic_table/in_memory_table.js +6 -0
  5. package/es/components/color_picker/color_picker_swatch.js +4 -0
  6. package/es/components/datagrid/data_grid.styles.js +1 -1
  7. package/es/components/date_picker/super_date_picker/quick_select_popover/quick_select.js +4 -4
  8. package/es/components/date_picker/super_date_picker/super_date_picker.styles.js +1 -1
  9. package/es/components/modal/modal.js +16 -5
  10. package/es/components/table/table_header_cell.js +4 -0
  11. package/es/components/tool_tip/icon_tip.js +4 -0
  12. package/es/components/tool_tip/tool_tip.js +8 -2
  13. package/es/services/color/contrast.js +11 -0
  14. package/eui.d.ts +129 -121
  15. package/i18ntokens.json +2305 -2287
  16. package/lib/components/avatar/avatar.js +2 -0
  17. package/lib/components/badge/badge.js +3 -5
  18. package/lib/components/basic_table/basic_table.js +6 -0
  19. package/lib/components/basic_table/in_memory_table.js +6 -0
  20. package/lib/components/color_picker/color_picker_swatch.js +4 -0
  21. package/lib/components/datagrid/data_grid.styles.js +1 -1
  22. package/lib/components/date_picker/super_date_picker/quick_select_popover/quick_select.js +4 -4
  23. package/lib/components/date_picker/super_date_picker/super_date_picker.styles.js +1 -1
  24. package/lib/components/modal/modal.js +15 -4
  25. package/lib/components/table/table_header_cell.js +4 -0
  26. package/lib/components/tool_tip/icon_tip.js +4 -0
  27. package/lib/components/tool_tip/tool_tip.js +9 -3
  28. package/lib/services/color/contrast.js +12 -1
  29. package/optimize/es/components/avatar/avatar.js +2 -0
  30. package/optimize/es/components/badge/badge.js +5 -7
  31. package/optimize/es/components/datagrid/data_grid.styles.js +1 -1
  32. package/optimize/es/components/date_picker/super_date_picker/quick_select_popover/quick_select.js +4 -4
  33. package/optimize/es/components/date_picker/super_date_picker/super_date_picker.styles.js +1 -1
  34. package/optimize/es/components/modal/modal.js +16 -5
  35. package/optimize/es/components/tool_tip/tool_tip.js +4 -2
  36. package/optimize/es/services/color/contrast.js +11 -0
  37. package/optimize/lib/components/avatar/avatar.js +2 -0
  38. package/optimize/lib/components/badge/badge.js +3 -5
  39. package/optimize/lib/components/datagrid/data_grid.styles.js +1 -1
  40. package/optimize/lib/components/date_picker/super_date_picker/quick_select_popover/quick_select.js +4 -4
  41. package/optimize/lib/components/date_picker/super_date_picker/super_date_picker.styles.js +1 -1
  42. package/optimize/lib/components/modal/modal.js +15 -4
  43. package/optimize/lib/components/tool_tip/tool_tip.js +5 -3
  44. package/optimize/lib/services/color/contrast.js +12 -1
  45. package/package.json +1 -1
  46. package/test-env/components/avatar/avatar.js +2 -0
  47. package/test-env/components/badge/badge.js +3 -5
  48. package/test-env/components/basic_table/basic_table.js +6 -0
  49. package/test-env/components/basic_table/in_memory_table.js +6 -0
  50. package/test-env/components/color_picker/color_picker_swatch.js +4 -0
  51. package/test-env/components/datagrid/data_grid.styles.js +1 -1
  52. package/test-env/components/date_picker/super_date_picker/quick_select_popover/quick_select.js +4 -4
  53. package/test-env/components/date_picker/super_date_picker/super_date_picker.styles.js +1 -1
  54. package/test-env/components/modal/modal.js +15 -4
  55. package/test-env/components/table/table_header_cell.js +4 -0
  56. package/test-env/components/tool_tip/icon_tip.js +4 -0
  57. package/test-env/components/tool_tip/tool_tip.js +9 -3
  58. package/test-env/services/color/contrast.js +12 -1
@@ -8,6 +8,7 @@ exports.checkValidColor = exports.TYPES = exports.SIZES = exports.EuiAvatar = ex
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
  var _propTypes = _interopRequireDefault(require("prop-types"));
10
10
  var _classnames = _interopRequireDefault(require("classnames"));
11
+ var _contrast = require("../../services/color/contrast");
11
12
  var _color = require("../../services/color");
12
13
  var _services = require("../../services");
13
14
  var _icon = require("../icon");
@@ -91,6 +92,7 @@ var EuiAvatar = exports.EuiAvatar = function EuiAvatar(_ref) {
91
92
  checkValidColor(color);
92
93
  var assignedColor = color || visColors[Math.floor(name.length % visColors.length)];
93
94
  var textColor = _color.isColorDark.apply(void 0, _toConsumableArray((0, _color.hexToRgb)(assignedColor))) ? '#FFFFFF' : '#000000';
95
+ (0, _contrast.warnIfContrastBelowMin)(textColor, assignedColor, _contrast.wcagContrastMin);
94
96
  return {
95
97
  backgroundColor: assignedColor,
96
98
  color: textColor
@@ -13,6 +13,7 @@ var _href_validator = require("../../services/security/href_validator");
13
13
  var _inner_text = require("../inner_text");
14
14
  var _icon = require("../icon");
15
15
  var _color_utils = require("./color_utils");
16
+ var _contrast = require("../../services/color/contrast");
16
17
  var _badge = require("./badge.styles");
17
18
  var _react2 = require("@emotion/react");
18
19
  var _excluded = ["children", "color", "iconType", "iconSide", "className", "isDisabled", "onClick", "iconOnClick", "onClickAriaLabel", "iconOnClickAriaLabel", "closeButtonProps", "href", "rel", "target", "style"];
@@ -76,11 +77,8 @@ var EuiBadge = exports.EuiBadge = function EuiBadge(_ref) {
76
77
  // Set dark or light text color based upon best contrast
77
78
  var textColor = (0, _color_utils.getTextColor)(euiTheme, color);
78
79
 
79
- // Check the contrast ratio. If it's low contrast, emit a console awrning
80
- var contrastRatio = (0, _color_utils.getColorContrast)(textColor, color);
81
- if (contrastRatio < _services.wcagContrastMin) {
82
- console.warn("Warning: ".concat(color, " badge has a low contrast of ").concat(contrastRatio.toFixed(2), ". Should be above ").concat(_services.wcagContrastMin, "."));
83
- }
80
+ // Emit a warning if contrast is below WCAG threshold (centralized util)
81
+ (0, _contrast.warnIfContrastBelowMin)(textColor, color, _contrast.wcagContrastMin);
84
82
  return _objectSpread({
85
83
  '--euiBadgeBackgroundColor': color,
86
84
  '--euiBadgeTextColor': textColor
@@ -1143,6 +1143,10 @@ EuiBasicTable.propTypes = {
1143
1143
  * hidden.
1144
1144
  */
1145
1145
  onMouseOut: _propTypes.default.func,
1146
+ /**
1147
+ * Offset in pixels from the anchor. Defaults to 16.
1148
+ */
1149
+ offset: _propTypes.default.number,
1146
1150
  "aria-label": _propTypes.default.string,
1147
1151
  "data-test-subj": _propTypes.default.string,
1148
1152
  css: _propTypes.default.any,
@@ -1258,6 +1262,7 @@ EuiBasicTable.propTypes = {
1258
1262
  repositionOnScroll: _propTypes.default.bool,
1259
1263
  disableScreenReaderOutput: _propTypes.default.bool,
1260
1264
  onMouseOut: _propTypes.default.func,
1265
+ offset: _propTypes.default.number,
1261
1266
  "aria-label": _propTypes.default.string,
1262
1267
  "data-test-subj": _propTypes.default.string,
1263
1268
  css: _propTypes.default.any,
@@ -1399,6 +1404,7 @@ EuiBasicTable.propTypes = {
1399
1404
  repositionOnScroll: _propTypes.default.bool,
1400
1405
  disableScreenReaderOutput: _propTypes.default.bool,
1401
1406
  onMouseOut: _propTypes.default.func,
1407
+ offset: _propTypes.default.number,
1402
1408
  "aria-label": _propTypes.default.string,
1403
1409
  "data-test-subj": _propTypes.default.string,
1404
1410
  css: _propTypes.default.any,
@@ -637,6 +637,10 @@ EuiInMemoryTable.propTypes = {
637
637
  * hidden.
638
638
  */
639
639
  onMouseOut: _propTypes.default.func,
640
+ /**
641
+ * Offset in pixels from the anchor. Defaults to 16.
642
+ */
643
+ offset: _propTypes.default.number,
640
644
  "aria-label": _propTypes.default.string,
641
645
  "data-test-subj": _propTypes.default.string,
642
646
  css: _propTypes.default.any,
@@ -752,6 +756,7 @@ EuiInMemoryTable.propTypes = {
752
756
  repositionOnScroll: _propTypes.default.bool,
753
757
  disableScreenReaderOutput: _propTypes.default.bool,
754
758
  onMouseOut: _propTypes.default.func,
759
+ offset: _propTypes.default.number,
755
760
  "aria-label": _propTypes.default.string,
756
761
  "data-test-subj": _propTypes.default.string,
757
762
  css: _propTypes.default.any,
@@ -893,6 +898,7 @@ EuiInMemoryTable.propTypes = {
893
898
  repositionOnScroll: _propTypes.default.bool,
894
899
  disableScreenReaderOutput: _propTypes.default.bool,
895
900
  onMouseOut: _propTypes.default.func,
901
+ offset: _propTypes.default.number,
896
902
  "aria-label": _propTypes.default.string,
897
903
  "data-test-subj": _propTypes.default.string,
898
904
  css: _propTypes.default.any,
@@ -141,6 +141,10 @@ EuiColorPickerSwatch.propTypes = {
141
141
  * hidden.
142
142
  */
143
143
  onMouseOut: _propTypes.default.func,
144
+ /**
145
+ * Offset in pixels from the anchor. Defaults to 16.
146
+ */
147
+ offset: _propTypes.default.number,
144
148
  "aria-label": _propTypes.default.string,
145
149
  "data-test-subj": _propTypes.default.string,
146
150
  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(&:not(.euiDataGrid--stripes) .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(&:not(.euiDataGrid--stripes) .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;"),
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, {
@@ -126,8 +126,8 @@ var EuiQuickSelect = exports.EuiQuickSelect = /*#__PURE__*/function (_Component)
126
126
  max = _this$getBounds.max;
127
127
  var diff = max.diff(min);
128
128
  _this.props.applyTime({
129
- start: (0, _moment.default)(max).add(1, 'ms').toISOString(),
130
- end: (0, _moment.default)(max).add(diff + 1, 'ms').toISOString(),
129
+ start: (0, _moment.default)(max).toISOString(),
130
+ end: (0, _moment.default)(max).add(diff, 'ms').toISOString(),
131
131
  keepPopoverOpen: true
132
132
  });
133
133
  });
@@ -137,8 +137,8 @@ var EuiQuickSelect = exports.EuiQuickSelect = /*#__PURE__*/function (_Component)
137
137
  max = _this$getBounds2.max;
138
138
  var diff = max.diff(min);
139
139
  _this.props.applyTime({
140
- start: (0, _moment.default)(min).subtract(diff + 1, 'ms').toISOString(),
141
- end: (0, _moment.default)(min).subtract(1, 'ms').toISOString(),
140
+ start: (0, _moment.default)(min).subtract(diff, 'ms').toISOString(),
141
+ end: (0, _moment.default)(min).toISOString(),
142
142
  keepPopoverOpen: true
143
143
  });
144
144
  });
@@ -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;"),
@@ -15,8 +15,9 @@ var _focus_trap = require("../focus_trap");
15
15
  var _overlay_mask = require("../overlay_mask");
16
16
  var _i18n = require("../i18n");
17
17
  var _modal = require("./modal.styles");
18
+ var _accessibility = require("../accessibility");
18
19
  var _react2 = require("@emotion/react");
19
- var _excluded = ["className", "children", "initialFocus", "onClose", "maxWidth", "role", "style", "focusTrapProps"];
20
+ var _excluded = ["className", "children", "initialFocus", "onClose", "maxWidth", "role", "style", "focusTrapProps", "aria-describedby"];
20
21
  /*
21
22
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
22
23
  * or more contributor license agreements. Licensed under the Elastic License
@@ -44,6 +45,7 @@ var EuiModal = exports.EuiModal = function EuiModal(_ref) {
44
45
  role = _ref$role === void 0 ? 'dialog' : _ref$role,
45
46
  style = _ref.style,
46
47
  focusTrapProps = _ref.focusTrapProps,
48
+ _ariaDescribedBy = _ref['aria-describedby'],
47
49
  rest = _objectWithoutProperties(_ref, _excluded);
48
50
  var onKeyDown = function onKeyDown(event) {
49
51
  if (event.key === _services.keys.ESCAPE) {
@@ -65,6 +67,14 @@ var EuiModal = exports.EuiModal = function EuiModal(_ref) {
65
67
  var styles = (0, _modal.euiModalStyles)(euiTheme);
66
68
  var cssStyles = [styles.euiModal, maxWidth === true && styles.defaultMaxWidth];
67
69
  var cssCloseIconStyles = [styles.euiModal__closeIcon];
70
+ var descriptionId = (0, _services.useGeneratedHtmlId)();
71
+ var ariaDescribedBy = (0, _classnames.default)(descriptionId, _ariaDescribedBy);
72
+ var screenReaderDescription = (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("p", {
73
+ id: descriptionId
74
+ }, (0, _react2.jsx)(_i18n.EuiI18n, {
75
+ token: "euiModal.screenReaderModalDialog",
76
+ default: "You are in a modal dialog. Press Escape or tap/click outside the dialog on the shadowed overlay to close."
77
+ })));
68
78
  return (0, _react2.jsx)(_overlay_mask.EuiOverlayMask, null, (0, _react2.jsx)(_focus_trap.EuiFocusTrap, _extends({}, focusTrapProps, {
69
79
  initialFocus: initialFocus,
70
80
  scrollLock: true,
@@ -76,8 +86,9 @@ var EuiModal = exports.EuiModal = function EuiModal(_ref) {
76
86
  tabIndex: 0,
77
87
  style: newStyle,
78
88
  role: role,
79
- "aria-modal": true
80
- }, rest), (0, _react2.jsx)(_i18n.EuiI18n, {
89
+ "aria-modal": true,
90
+ "aria-describedby": ariaDescribedBy
91
+ }, rest), children, screenReaderDescription, (0, _react2.jsx)(_i18n.EuiI18n, {
81
92
  token: "euiModal.closeModal",
82
93
  default: "Closes this modal window"
83
94
  }, function (closeModal) {
@@ -89,7 +100,7 @@ var EuiModal = exports.EuiModal = function EuiModal(_ref) {
89
100
  color: "text",
90
101
  "aria-label": closeModal
91
102
  });
92
- }), children)));
103
+ }))));
93
104
  };
94
105
  EuiModal.propTypes = {
95
106
  className: _propTypes.default.string,
@@ -230,6 +230,10 @@ EuiTableHeaderCell.propTypes = {
230
230
  * hidden.
231
231
  */
232
232
  onMouseOut: _propTypes.default.func,
233
+ /**
234
+ * Offset in pixels from the anchor. Defaults to 16.
235
+ */
236
+ offset: _propTypes.default.number,
233
237
  "aria-label": _propTypes.default.string,
234
238
  "data-test-subj": _propTypes.default.string,
235
239
  css: _propTypes.default.any,
@@ -101,6 +101,10 @@ EuiIconTip.propTypes = {
101
101
  * hidden.
102
102
  */
103
103
  onMouseOut: _propTypes.default.func,
104
+ /**
105
+ * Offset in pixels from the anchor. Defaults to 16.
106
+ */
107
+ offset: _propTypes.default.number,
104
108
  /**
105
109
  * Explain what this icon means for screen readers.
106
110
  */
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.POSITIONS = exports.EuiToolTip = void 0;
6
+ exports.POSITIONS = exports.EuiToolTip = exports.DEFAULT_TOOLTIP_OFFSET = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _classnames = _interopRequireDefault(require("classnames"));
@@ -45,6 +45,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
45
45
  */
46
46
  var POSITIONS = exports.POSITIONS = ['top', 'right', 'bottom', 'left'];
47
47
  var DISPLAYS = ['inlineBlock', 'block'];
48
+ var DEFAULT_TOOLTIP_OFFSET = exports.DEFAULT_TOOLTIP_OFFSET = 16;
48
49
  var delayToMsMap = {
49
50
  regular: 250,
50
51
  long: 250 * 5
@@ -119,7 +120,9 @@ var EuiToolTip = exports.EuiToolTip = /*#__PURE__*/function (_Component) {
119
120
  }
120
121
  });
121
122
  _defineProperty(_this, "positionToolTip", function () {
123
+ var _this$props$offset;
122
124
  var requestedPosition = _this.props.position;
125
+ var offset = (_this$props$offset = _this.props.offset) !== null && _this$props$offset !== void 0 ? _this$props$offset : DEFAULT_TOOLTIP_OFFSET;
123
126
  if (!_this.anchor || !_this.popover) {
124
127
  return;
125
128
  }
@@ -127,8 +130,7 @@ var EuiToolTip = exports.EuiToolTip = /*#__PURE__*/function (_Component) {
127
130
  anchor: _this.anchor,
128
131
  popover: _this.popover,
129
132
  position: requestedPosition,
130
- offset: 16,
131
- // offset popover 16px from the anchor
133
+ offset: offset,
132
134
  arrowConfig: {
133
135
  arrowWidth: 12,
134
136
  arrowBuffer: 4
@@ -375,6 +377,10 @@ EuiToolTip.propTypes = {
375
377
  * hidden.
376
378
  */
377
379
  onMouseOut: _propTypes.default.func,
380
+ /**
381
+ * Offset in pixels from the anchor. Defaults to 16.
382
+ */
383
+ offset: _propTypes.default.number,
378
384
  "aria-label": _propTypes.default.string,
379
385
  "data-test-subj": _propTypes.default.string,
380
386
  css: _propTypes.default.any
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.wcagContrastMin = exports.makeHighContrastColor = exports.makeDisabledContrastColor = void 0;
6
+ exports.wcagContrastMin = exports.warnIfContrastBelowMin = exports.makeHighContrastColor = exports.makeDisabledContrastColor = exports.getColorContrast = void 0;
7
7
  var _chromaJs = _interopRequireDefault(require("chroma-js"));
8
8
  var _manipulation = require("./manipulation");
9
9
  var _utils = require("../theme/utils");
@@ -15,6 +15,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
15
15
  * in compliance with, at your election, the Elastic License 2.0 or the Server
16
16
  * Side Public License, v 1.
17
17
  */
18
+ var getColorContrast = exports.getColorContrast = function getColorContrast(textColor, backgroundColor) {
19
+ return _chromaJs.default.contrast(textColor, backgroundColor);
20
+ };
18
21
  var wcagContrastMin = exports.wcagContrastMin = 4.5; // WCAG AA minimum contrast ratio for normal (non-large) text
19
22
 
20
23
  /**
@@ -73,4 +76,12 @@ var makeDisabledContrastColor = exports.makeDisabledContrastColor = function mak
73
76
  return function (themeOrBackground) {
74
77
  return makeHighContrastColor(color, ratio)(themeOrBackground);
75
78
  };
79
+ };
80
+ var warnIfContrastBelowMin = exports.warnIfContrastBelowMin = function warnIfContrastBelowMin(textColor, backgroundColor) {
81
+ var min = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : wcagContrastMin;
82
+ var ratio = getColorContrast(textColor, backgroundColor);
83
+ if (ratio < min) {
84
+ // eslint-disable-next-line no-console
85
+ console.warn("Warning: ".concat(backgroundColor, " background with ").concat(textColor, " text has a low contrast of ").concat(ratio.toFixed(2), ". Should be above ").concat(min, "."));
86
+ }
76
87
  };
@@ -16,6 +16,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
16
16
 
17
17
  import React, { useMemo } from 'react';
18
18
  import classNames from 'classnames';
19
+ import { warnIfContrastBelowMin, wcagContrastMin } from '../../services/color/contrast';
19
20
  import { isColorDark, hexToRgb, isValidHex, useEuiPaletteColorBlindBehindText } from '../../services/color';
20
21
  import { toInitials, useEuiMemoizedStyles, useEuiTheme } from '../../services';
21
22
  import { EuiIcon } from '../icon';
@@ -73,6 +74,7 @@ export var EuiAvatar = function EuiAvatar(_ref) {
73
74
  checkValidColor(color);
74
75
  var assignedColor = color || visColors[Math.floor(name.length % visColors.length)];
75
76
  var textColor = isColorDark.apply(void 0, _toConsumableArray(hexToRgb(assignedColor))) ? '#FFFFFF' : '#000000';
77
+ warnIfContrastBelowMin(textColor, assignedColor, wcagContrastMin);
76
78
  return {
77
79
  backgroundColor: assignedColor,
78
80
  color: textColor
@@ -15,11 +15,12 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
15
15
 
16
16
  import React, { useMemo } from 'react';
17
17
  import classNames from 'classnames';
18
- import { useEuiTheme, useEuiMemoizedStyles, getSecureRelForTarget, wcagContrastMin } from '../../services';
18
+ import { useEuiTheme, useEuiMemoizedStyles, getSecureRelForTarget } from '../../services';
19
19
  import { validateHref } from '../../services/security/href_validator';
20
20
  import { EuiInnerText } from '../inner_text';
21
21
  import { EuiIcon } from '../icon';
22
- import { getTextColor, getColorContrast, getIsValidColor } from './color_utils';
22
+ import { getTextColor, getIsValidColor } from './color_utils';
23
+ import { warnIfContrastBelowMin, wcagContrastMin } from '../../services/color/contrast';
23
24
  import { euiBadgeStyles } from './badge.styles';
24
25
  import { jsx as ___EmotionJSX } from "@emotion/react";
25
26
  export var ICON_SIDES = ['left', 'right'];
@@ -58,11 +59,8 @@ export var EuiBadge = function EuiBadge(_ref) {
58
59
  // Set dark or light text color based upon best contrast
59
60
  var textColor = getTextColor(euiTheme, color);
60
61
 
61
- // Check the contrast ratio. If it's low contrast, emit a console awrning
62
- var contrastRatio = getColorContrast(textColor, color);
63
- if (contrastRatio < wcagContrastMin) {
64
- console.warn("Warning: ".concat(color, " badge has a low contrast of ").concat(contrastRatio.toFixed(2), ". Should be above ").concat(wcagContrastMin, "."));
65
- }
62
+ // Emit a warning if contrast is below WCAG threshold (centralized util)
63
+ warnIfContrastBelowMin(textColor, color, wcagContrastMin);
66
64
  return _objectSpread({
67
65
  '--euiBadgeBackgroundColor': color,
68
66
  '--euiBadgeTextColor': textColor
@@ -52,7 +52,7 @@ export var euiDataGridStyles = function euiDataGridStyles(euiThemeContext) {
52
52
  };
53
53
  var border = "".concat(euiTheme.border.width.thin, " solid ").concat(borderColors.default);
54
54
  return {
55
- euiDataGrid: /*#__PURE__*/css("display:flex;flex-direction:column;align-items:stretch;", logicalCSS('height', '100%'), " overflow:hidden;*:where(& .euiDataGridRow){background-color:", euiTheme.components.dataGridRowBackground, ";}*:where(&.euiDataGrid--rowHoverHighlight .euiDataGridRow:hover){background-color:", euiTheme.components.dataGridRowBackgroundHover, ";}*:where(&:not(.euiDataGrid--stripes) .euiDataGridRow--selected){background-color:", euiTheme.components.dataGridRowBackgroundSelect, ";}*:where(& .euiDataGridRow--marked){background-color:", euiTheme.components.dataGridRowBackgroundMarked, ";.euiDataGridRowCell.euiDataGridRowCell{", outlineSelectors.marked, "{", euiDataGridCellOutlineStyles(euiThemeContext).markedStyles, ";}}}*:where(&:not(.euiDataGrid--stripes) .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;"),
55
+ euiDataGrid: /*#__PURE__*/css("display:flex;flex-direction:column;align-items:stretch;", 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, "{", 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;"),
56
56
  cellPadding: {
57
57
  cellPadding: function cellPadding(size) {
58
58
  return /*#__PURE__*/css(".euiDataGridHeaderCell,.euiDataGridRowCell__content{padding:", _cellPadding[size], ";}.euiDataGridRowCell__content--lineCountHeight,.euiDataGridRowCell__content--autoBelowLineCountHeight{", highContrastModeStyles(euiThemeContext, {
@@ -112,8 +112,8 @@ export var EuiQuickSelect = /*#__PURE__*/function (_Component) {
112
112
  max = _this$getBounds.max;
113
113
  var diff = max.diff(min);
114
114
  _this.props.applyTime({
115
- start: moment(max).add(1, 'ms').toISOString(),
116
- end: moment(max).add(diff + 1, 'ms').toISOString(),
115
+ start: moment(max).toISOString(),
116
+ end: moment(max).add(diff, 'ms').toISOString(),
117
117
  keepPopoverOpen: true
118
118
  });
119
119
  });
@@ -123,8 +123,8 @@ export var EuiQuickSelect = /*#__PURE__*/function (_Component) {
123
123
  max = _this$getBounds2.max;
124
124
  var diff = max.diff(min);
125
125
  _this.props.applyTime({
126
- start: moment(min).subtract(diff + 1, 'ms').toISOString(),
127
- end: moment(min).subtract(1, 'ms').toISOString(),
126
+ start: moment(min).subtract(diff, 'ms').toISOString(),
127
+ end: moment(min).toISOString(),
128
128
  keepPopoverOpen: true
129
129
  });
130
130
  });
@@ -75,7 +75,7 @@ export var euiSuperDatePickerStyles = function euiSuperDatePickerStyles(euiTheme
75
75
  full: "\n label: isAutoRefreshOnly;\n display: block;\n "
76
76
  },
77
77
  // isQuickSelectOnly forces `width` to be `auto`
78
- isQuickSelectOnly: /*#__PURE__*/css(logicalCSS('min-width', 0), ".euiFormControlLayout__prepend{", logicalCSS('max-width', 'none'), ";};label:isQuickSelectOnly;"),
78
+ isQuickSelectOnly: /*#__PURE__*/css(logicalCSS('min-width', 0), ".euiFormControlLayout__prepend{", logicalCSS('max-width', 'none'), ";}.euiFormControlLayoutDelimited__delimiter:first-child{", logicalCSS('padding-horizontal', 0), ";};label:isQuickSelectOnly;"),
79
79
  euiSuperDatePicker__range: _ref,
80
80
  euiSuperDatePicker__rangeInput: /*#__PURE__*/css("flex-grow:1;", logicalCSS('width', 'auto'), " overflow:hidden;;label:euiSuperDatePicker__rangeInput;"),
81
81
  euiSuperDatePicker__prettyFormat: /*#__PURE__*/css(_buttonStyles(euiThemeContext), " text-align:start;", isRefreshVariant && prettyFormatStyles, ";;label:euiSuperDatePicker__prettyFormat;"),
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["className", "children", "initialFocus", "onClose", "maxWidth", "role", "style", "focusTrapProps"];
4
+ var _excluded = ["className", "children", "initialFocus", "onClose", "maxWidth", "role", "style", "focusTrapProps", "aria-describedby"];
5
5
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
6
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
7
  /*
@@ -14,13 +14,14 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
14
14
 
15
15
  import React from 'react';
16
16
  import classnames from 'classnames';
17
- import { keys, useEuiTheme } from '../../services';
17
+ import { keys, useEuiTheme, useGeneratedHtmlId } from '../../services';
18
18
  import { isDOMNode } from '../../utils';
19
19
  import { EuiButtonIcon } from '../button';
20
20
  import { EuiFocusTrap } from '../focus_trap';
21
21
  import { EuiOverlayMask } from '../overlay_mask';
22
22
  import { EuiI18n } from '../i18n';
23
23
  import { euiModalStyles } from './modal.styles';
24
+ import { EuiScreenReaderOnly } from '../accessibility';
24
25
  import { jsx as ___EmotionJSX } from "@emotion/react";
25
26
  export var EuiModal = function EuiModal(_ref) {
26
27
  var className = _ref.className,
@@ -33,6 +34,7 @@ export var EuiModal = function EuiModal(_ref) {
33
34
  role = _ref$role === void 0 ? 'dialog' : _ref$role,
34
35
  style = _ref.style,
35
36
  focusTrapProps = _ref.focusTrapProps,
37
+ _ariaDescribedBy = _ref['aria-describedby'],
36
38
  rest = _objectWithoutProperties(_ref, _excluded);
37
39
  var onKeyDown = function onKeyDown(event) {
38
40
  if (event.key === keys.ESCAPE) {
@@ -54,6 +56,14 @@ export var EuiModal = function EuiModal(_ref) {
54
56
  var styles = euiModalStyles(euiTheme);
55
57
  var cssStyles = [styles.euiModal, maxWidth === true && styles.defaultMaxWidth];
56
58
  var cssCloseIconStyles = [styles.euiModal__closeIcon];
59
+ var descriptionId = useGeneratedHtmlId();
60
+ var ariaDescribedBy = classnames(descriptionId, _ariaDescribedBy);
61
+ var screenReaderDescription = ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("p", {
62
+ id: descriptionId
63
+ }, ___EmotionJSX(EuiI18n, {
64
+ token: "euiModal.screenReaderModalDialog",
65
+ default: "You are in a modal dialog. Press Escape or tap/click outside the dialog on the shadowed overlay to close."
66
+ })));
57
67
  return ___EmotionJSX(EuiOverlayMask, null, ___EmotionJSX(EuiFocusTrap, _extends({}, focusTrapProps, {
58
68
  initialFocus: initialFocus,
59
69
  scrollLock: true,
@@ -65,8 +75,9 @@ export var EuiModal = function EuiModal(_ref) {
65
75
  tabIndex: 0,
66
76
  style: newStyle,
67
77
  role: role,
68
- "aria-modal": true
69
- }, rest), ___EmotionJSX(EuiI18n, {
78
+ "aria-modal": true,
79
+ "aria-describedby": ariaDescribedBy
80
+ }, rest), children, screenReaderDescription, ___EmotionJSX(EuiI18n, {
70
81
  token: "euiModal.closeModal",
71
82
  default: "Closes this modal window"
72
83
  }, function (closeModal) {
@@ -78,5 +89,5 @@ export var EuiModal = function EuiModal(_ref) {
78
89
  color: "text",
79
90
  "aria-label": closeModal
80
91
  });
81
- }), children)));
92
+ }))));
82
93
  };
@@ -30,6 +30,7 @@ import { toolTipManager } from './tool_tip_manager';
30
30
  import { jsx as ___EmotionJSX } from "@emotion/react";
31
31
  export var POSITIONS = ['top', 'right', 'bottom', 'left'];
32
32
  var DISPLAYS = ['inlineBlock', 'block'];
33
+ export var DEFAULT_TOOLTIP_OFFSET = 16;
33
34
  var delayToMsMap = {
34
35
  regular: 250,
35
36
  long: 250 * 5
@@ -104,7 +105,9 @@ export var EuiToolTip = /*#__PURE__*/function (_Component) {
104
105
  }
105
106
  });
106
107
  _defineProperty(_this, "positionToolTip", function () {
108
+ var _this$props$offset;
107
109
  var requestedPosition = _this.props.position;
110
+ var offset = (_this$props$offset = _this.props.offset) !== null && _this$props$offset !== void 0 ? _this$props$offset : DEFAULT_TOOLTIP_OFFSET;
108
111
  if (!_this.anchor || !_this.popover) {
109
112
  return;
110
113
  }
@@ -112,8 +115,7 @@ export var EuiToolTip = /*#__PURE__*/function (_Component) {
112
115
  anchor: _this.anchor,
113
116
  popover: _this.popover,
114
117
  position: requestedPosition,
115
- offset: 16,
116
- // offset popover 16px from the anchor
118
+ offset: offset,
117
119
  arrowConfig: {
118
120
  arrowWidth: 12,
119
121
  arrowBuffer: 4
@@ -10,6 +10,9 @@ import _typeof from "@babel/runtime/helpers/typeof";
10
10
  import chroma from 'chroma-js';
11
11
  import { shade, tint, lightness as getLightness } from './manipulation';
12
12
  import { getOn } from '../theme/utils';
13
+ export var getColorContrast = function getColorContrast(textColor, backgroundColor) {
14
+ return chroma.contrast(textColor, backgroundColor);
15
+ };
13
16
  export var wcagContrastMin = 4.5; // WCAG AA minimum contrast ratio for normal (non-large) text
14
17
 
15
18
  /**
@@ -68,4 +71,12 @@ export var makeDisabledContrastColor = function makeDisabledContrastColor(color)
68
71
  return function (themeOrBackground) {
69
72
  return makeHighContrastColor(color, ratio)(themeOrBackground);
70
73
  };
74
+ };
75
+ export var warnIfContrastBelowMin = function warnIfContrastBelowMin(textColor, backgroundColor) {
76
+ var min = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : wcagContrastMin;
77
+ var ratio = getColorContrast(textColor, backgroundColor);
78
+ if (ratio < min) {
79
+ // eslint-disable-next-line no-console
80
+ console.warn("Warning: ".concat(backgroundColor, " background with ").concat(textColor, " text has a low contrast of ").concat(ratio.toFixed(2), ". Should be above ").concat(min, "."));
81
+ }
71
82
  };
@@ -12,6 +12,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
12
12
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
13
13
  var _react = _interopRequireWildcard(require("react"));
14
14
  var _classnames = _interopRequireDefault(require("classnames"));
15
+ var _contrast = require("../../services/color/contrast");
15
16
  var _color = require("../../services/color");
16
17
  var _services = require("../../services");
17
18
  var _icon = require("../icon");
@@ -82,6 +83,7 @@ var EuiAvatar = exports.EuiAvatar = function EuiAvatar(_ref) {
82
83
  checkValidColor(color);
83
84
  var assignedColor = color || visColors[Math.floor(name.length % visColors.length)];
84
85
  var textColor = _color.isColorDark.apply(void 0, (0, _toConsumableArray2.default)((0, _color.hexToRgb)(assignedColor))) ? '#FFFFFF' : '#000000';
86
+ (0, _contrast.warnIfContrastBelowMin)(textColor, assignedColor, _contrast.wcagContrastMin);
85
87
  return {
86
88
  backgroundColor: assignedColor,
87
89
  color: textColor
@@ -17,6 +17,7 @@ var _href_validator = require("../../services/security/href_validator");
17
17
  var _inner_text = require("../inner_text");
18
18
  var _icon = require("../icon");
19
19
  var _color_utils = require("./color_utils");
20
+ var _contrast = require("../../services/color/contrast");
20
21
  var _badge = require("./badge.styles");
21
22
  var _react2 = require("@emotion/react");
22
23
  var _excluded = ["children", "color", "iconType", "iconSide", "className", "isDisabled", "onClick", "iconOnClick", "onClickAriaLabel", "iconOnClickAriaLabel", "closeButtonProps", "href", "rel", "target", "style"];
@@ -67,11 +68,8 @@ var EuiBadge = exports.EuiBadge = function EuiBadge(_ref) {
67
68
  // Set dark or light text color based upon best contrast
68
69
  var textColor = (0, _color_utils.getTextColor)(euiTheme, color);
69
70
 
70
- // Check the contrast ratio. If it's low contrast, emit a console awrning
71
- var contrastRatio = (0, _color_utils.getColorContrast)(textColor, color);
72
- if (contrastRatio < _services.wcagContrastMin) {
73
- console.warn("Warning: ".concat(color, " badge has a low contrast of ").concat(contrastRatio.toFixed(2), ". Should be above ").concat(_services.wcagContrastMin, "."));
74
- }
71
+ // Emit a warning if contrast is below WCAG threshold (centralized util)
72
+ (0, _contrast.warnIfContrastBelowMin)(textColor, color, _contrast.wcagContrastMin);
75
73
  return _objectSpread({
76
74
  '--euiBadgeBackgroundColor': color,
77
75
  '--euiBadgeTextColor': textColor
@@ -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(&:not(.euiDataGrid--stripes) .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(&:not(.euiDataGrid--stripes) .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;"),
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, {
@@ -120,8 +120,8 @@ var EuiQuickSelect = exports.EuiQuickSelect = /*#__PURE__*/function (_Component)
120
120
  max = _this$getBounds.max;
121
121
  var diff = max.diff(min);
122
122
  _this.props.applyTime({
123
- start: (0, _moment.default)(max).add(1, 'ms').toISOString(),
124
- end: (0, _moment.default)(max).add(diff + 1, 'ms').toISOString(),
123
+ start: (0, _moment.default)(max).toISOString(),
124
+ end: (0, _moment.default)(max).add(diff, 'ms').toISOString(),
125
125
  keepPopoverOpen: true
126
126
  });
127
127
  });
@@ -131,8 +131,8 @@ var EuiQuickSelect = exports.EuiQuickSelect = /*#__PURE__*/function (_Component)
131
131
  max = _this$getBounds2.max;
132
132
  var diff = max.diff(min);
133
133
  _this.props.applyTime({
134
- start: (0, _moment.default)(min).subtract(diff + 1, 'ms').toISOString(),
135
- end: (0, _moment.default)(min).subtract(1, 'ms').toISOString(),
134
+ start: (0, _moment.default)(min).subtract(diff, 'ms').toISOString(),
135
+ end: (0, _moment.default)(min).toISOString(),
136
136
  keepPopoverOpen: true
137
137
  });
138
138
  });