@elastic/eui 101.1.0 → 101.2.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 (79) hide show
  1. package/es/components/badge/badge.styles.js +2 -2
  2. package/es/components/badge/color_utils.js +16 -6
  3. package/es/components/badge/notification_badge/badge_notification.styles.js +1 -1
  4. package/es/components/basic_table/basic_table.js +11 -0
  5. package/es/components/basic_table/in_memory_table.js +11 -0
  6. package/es/components/code/code.styles.js +4 -2
  7. package/es/components/code/code_syntax.styles.js +6 -3
  8. package/es/components/color_picker/color_picker_swatch.js +85 -3
  9. package/es/components/color_picker/color_picker_swatch.styles.js +11 -1
  10. package/es/components/header/header.styles.js +4 -1
  11. package/es/components/panel/panel.styles.js +1 -1
  12. package/es/components/table/table_header_cell.js +9 -0
  13. package/es/components/toast/toast.styles.js +3 -3
  14. package/es/components/tool_tip/icon_tip.js +9 -0
  15. package/es/components/tool_tip/tool_tip.js +18 -4
  16. package/es/components/tool_tip/tool_tip_anchor.js +1 -1
  17. package/es/global_styling/mixins/_button.js +3 -2
  18. package/eui.d.ts +39 -0
  19. package/lib/components/badge/badge.styles.js +2 -2
  20. package/lib/components/badge/color_utils.js +16 -6
  21. package/lib/components/badge/notification_badge/badge_notification.styles.js +1 -1
  22. package/lib/components/basic_table/basic_table.js +11 -0
  23. package/lib/components/basic_table/in_memory_table.js +11 -0
  24. package/lib/components/code/code.styles.js +3 -1
  25. package/lib/components/code/code_syntax.styles.js +6 -3
  26. package/lib/components/color_picker/color_picker_swatch.js +85 -3
  27. package/lib/components/color_picker/color_picker_swatch.styles.js +11 -3
  28. package/lib/components/header/header.styles.js +4 -1
  29. package/lib/components/panel/panel.styles.js +1 -1
  30. package/lib/components/table/table_header_cell.js +9 -0
  31. package/lib/components/toast/toast.styles.js +3 -3
  32. package/lib/components/tool_tip/icon_tip.js +9 -0
  33. package/lib/components/tool_tip/tool_tip.js +18 -4
  34. package/lib/components/tool_tip/tool_tip_anchor.js +1 -1
  35. package/lib/global_styling/mixins/_button.js +3 -2
  36. package/optimize/es/components/badge/badge.styles.js +2 -2
  37. package/optimize/es/components/badge/color_utils.js +16 -6
  38. package/optimize/es/components/badge/notification_badge/badge_notification.styles.js +1 -1
  39. package/optimize/es/components/code/code.styles.js +4 -2
  40. package/optimize/es/components/code/code_syntax.styles.js +6 -3
  41. package/optimize/es/components/color_picker/color_picker_swatch.js +18 -2
  42. package/optimize/es/components/color_picker/color_picker_swatch.styles.js +11 -1
  43. package/optimize/es/components/header/header.styles.js +4 -1
  44. package/optimize/es/components/panel/panel.styles.js +1 -1
  45. package/optimize/es/components/toast/toast.styles.js +3 -3
  46. package/optimize/es/components/tool_tip/tool_tip.js +9 -4
  47. package/optimize/es/components/tool_tip/tool_tip_anchor.js +1 -1
  48. package/optimize/es/global_styling/mixins/_button.js +3 -2
  49. package/optimize/lib/components/badge/badge.styles.js +2 -2
  50. package/optimize/lib/components/badge/color_utils.js +16 -6
  51. package/optimize/lib/components/badge/notification_badge/badge_notification.styles.js +1 -1
  52. package/optimize/lib/components/code/code.styles.js +3 -1
  53. package/optimize/lib/components/code/code_syntax.styles.js +6 -3
  54. package/optimize/lib/components/color_picker/color_picker_swatch.js +18 -2
  55. package/optimize/lib/components/color_picker/color_picker_swatch.styles.js +11 -3
  56. package/optimize/lib/components/header/header.styles.js +4 -1
  57. package/optimize/lib/components/panel/panel.styles.js +1 -1
  58. package/optimize/lib/components/toast/toast.styles.js +3 -3
  59. package/optimize/lib/components/tool_tip/tool_tip.js +9 -4
  60. package/optimize/lib/components/tool_tip/tool_tip_anchor.js +1 -1
  61. package/optimize/lib/global_styling/mixins/_button.js +3 -2
  62. package/package.json +1 -1
  63. package/test-env/components/badge/badge.styles.js +2 -2
  64. package/test-env/components/badge/color_utils.js +16 -6
  65. package/test-env/components/badge/notification_badge/badge_notification.styles.js +1 -1
  66. package/test-env/components/basic_table/basic_table.js +11 -0
  67. package/test-env/components/basic_table/in_memory_table.js +11 -0
  68. package/test-env/components/code/code.styles.js +3 -1
  69. package/test-env/components/code/code_syntax.styles.js +6 -3
  70. package/test-env/components/color_picker/color_picker_swatch.js +85 -3
  71. package/test-env/components/color_picker/color_picker_swatch.styles.js +11 -3
  72. package/test-env/components/header/header.styles.js +4 -1
  73. package/test-env/components/panel/panel.styles.js +1 -1
  74. package/test-env/components/table/table_header_cell.js +9 -0
  75. package/test-env/components/toast/toast.styles.js +3 -3
  76. package/test-env/components/tool_tip/icon_tip.js +9 -0
  77. package/test-env/components/tool_tip/tool_tip.js +18 -4
  78. package/test-env/components/tool_tip/tool_tip_anchor.js +1 -1
  79. package/test-env/global_styling/mixins/_button.js +3 -2
@@ -38,14 +38,14 @@ var euiBadgeStyles = exports.euiBadgeStyles = function euiBadgeStyles(euiThemeCo
38
38
  }), ";", (0, _global_styling.logicalTextAlignCSS)('left'), "color:var(--euiBadgeTextColor, ", badgeColors.default.color, ");background-color:var(\n --euiBadgeBackgroundColor,\n ", badgeColors.default.backgroundColor, "\n );*::selection{color:var(\n --euiBadgeBackgroundColor,\n ", badgeColors.default.backgroundColor, "\n );background-color:var(\n --euiBadgeTextColor,\n ", badgeColors.default.color, "\n );}&:focus-within{", (0, _global_styling.euiFocusRing)(euiThemeContext), ";}&+.euiBadge{", (0, _global_styling.logicalCSS)('margin-left', euiTheme.size.xs), ";};label:euiBadge;"),
39
39
  clickable: /*#__PURE__*/(0, _react.css)("&:not(:disabled){&:hover,&:focus{text-decoration:underline;}}&:focus{", (0, _global_styling.euiFocusRing)(euiThemeContext), ";}&:disabled{cursor:not-allowed;};label:clickable;"),
40
40
  // Colors
41
- default: /*#__PURE__*/(0, _react.css)(setBadgeColorVars(badgeColors.default), ";label:default;"),
41
+ default: /*#__PURE__*/(0, _react.css)(setBadgeColorVars(badgeColors.default), " border-color:", badgeColors.default.borderColor, ";;label:default;"),
42
42
  hollow: /*#__PURE__*/(0, _react.css)(setBadgeColorVars(badgeColors.hollow), " border-color:", badgeColors.hollow.borderColor, ";;label:hollow;"),
43
43
  primary: /*#__PURE__*/(0, _react.css)(setBadgeColorVars(badgeColors.primary), ";label:primary;"),
44
44
  accent: /*#__PURE__*/(0, _react.css)(setBadgeColorVars(badgeColors.accent), ";label:accent;"),
45
45
  warning: /*#__PURE__*/(0, _react.css)(setBadgeColorVars(badgeColors.warning), ";label:warning;"),
46
46
  danger: /*#__PURE__*/(0, _react.css)(setBadgeColorVars(badgeColors.danger), ";label:danger;"),
47
47
  success: /*#__PURE__*/(0, _react.css)(setBadgeColorVars(badgeColors.success), ";label:success;"),
48
- disabled: /*#__PURE__*/(0, _react.css)(setBadgeColorVars(badgeColors.disabled), "*::selection{color:", euiTheme.colors.emptyShade, ";};label:disabled;"),
48
+ disabled: /*#__PURE__*/(0, _react.css)(setBadgeColorVars(badgeColors.disabled), " border-color:", badgeColors.disabled.borderColor, ";*::selection{color:", euiTheme.colors.emptyShade, ";};label:disabled;"),
49
49
  // Content wrapper
50
50
  euiBadge__content: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)(
51
51
  // Ensure proper height in case of just displaying an icon
@@ -28,7 +28,9 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
28
28
  * Side Public License, v 1.
29
29
  */
30
30
  var euiBadgeColors = exports.euiBadgeColors = function euiBadgeColors(euiThemeContext) {
31
- var euiTheme = euiThemeContext.euiTheme;
31
+ var euiTheme = euiThemeContext.euiTheme,
32
+ highContrastMode = euiThemeContext.highContrastMode;
33
+ var badgeColorsAccentText = getBadgeColors(euiThemeContext, euiTheme.colors.textAccent);
32
34
  return {
33
35
  // Colors shared between buttons and badges
34
36
  primary: (0, _button.euiButtonFillColor)(euiThemeContext, 'primary'),
@@ -37,16 +39,24 @@ var euiBadgeColors = exports.euiBadgeColors = function euiBadgeColors(euiThemeCo
37
39
  danger: (0, _button.euiButtonFillColor)(euiThemeContext, 'danger'),
38
40
  accent: (0, _button.euiButtonFillColor)(euiThemeContext, 'accent'),
39
41
  accentSecondary: (0, _button.euiButtonFillColor)(euiThemeContext, 'accentSecondary'),
40
- disabled: (0, _button.euiButtonColor)(euiThemeContext, 'disabled'),
42
+ disabled: _objectSpread(_objectSpread({}, (0, _button.euiButtonColor)(euiThemeContext, 'disabled')), {}, {
43
+ borderColor: highContrastMode ? euiTheme.colors.textDisabled : ''
44
+ }),
41
45
  // Colors unique to badges
42
- default: getBadgeColors(euiThemeContext, euiTheme.components.badgeBackground),
46
+ default: _objectSpread(_objectSpread({}, getBadgeColors(euiThemeContext, euiTheme.components.badgeBackground)), {}, {
47
+ borderColor: highContrastMode ? euiTheme.border.color : ''
48
+ }),
43
49
  // Hollow has a border and is used for autocompleters and beta badges
44
50
  hollow: _objectSpread(_objectSpread({}, getBadgeColors(euiThemeContext, euiTheme.colors.emptyShade)), {}, {
45
- borderColor: euiTheme.components.badgeBorderColorHollow
51
+ borderColor: highContrastMode ? euiTheme.border.color : euiTheme.components.badgeBorderColorHollow
46
52
  }),
47
53
  // Colors used by beta and notification badges
48
- subdued: getBadgeColors(euiThemeContext, euiTheme.components.badgeBackgroundSubdued),
49
- accentText: getBadgeColors(euiThemeContext, euiTheme.colors.textAccent),
54
+ subdued: _objectSpread(_objectSpread({}, getBadgeColors(euiThemeContext, euiTheme.components.badgeBackgroundSubdued)), {}, {
55
+ borderColor: highContrastMode ? euiTheme.border.color : ''
56
+ }),
57
+ accentText: _objectSpread(_objectSpread({}, badgeColorsAccentText), {}, {
58
+ borderColor: highContrastMode ? badgeColorsAccentText.backgroundColor : ''
59
+ }),
50
60
  accentSecondaryText: getBadgeColors(euiThemeContext, euiTheme.colors.textAccentSecondary)
51
61
  };
52
62
  };
@@ -21,7 +21,7 @@ var euiNotificationBadgeStyles = exports.euiNotificationBadgeStyles = function e
21
21
  var badgeColors = (0, _color_utils.euiBadgeColors)(euiThemeContext);
22
22
  return {
23
23
  euiNotificationBadge: /*#__PURE__*/(0, _react.css)("flex-shrink:0;display:inline-flex;justify-content:center;align-items:center;vertical-align:middle;", (0, _global_styling.logicalCSS)('padding-horizontal', euiTheme.size.xs), " border-radius:", euiTheme.border.radius.small, ";", (0, _high_contrast.highContrastModeStyles)(euiThemeContext, {
24
- forced: "\n border: ".concat(euiTheme.border.thin, ";\n overflow: hidden; /* Fix text clipping */\n ")
24
+ preferred: "\n border: ".concat(euiTheme.border.thin, ";\n overflow: hidden; /* Fix text clipping */\n ")
25
25
  }), " cursor:default;font-size:", (0, _global_styling.euiFontSizeFromScale)('xs', euiTheme), ";font-weight:", euiTheme.font.weight.medium, ";", (0, _global_styling.euiNumberFormat)(euiThemeContext), " text-align:center;", _global_styling.euiCanAnimate, "{transition:all ", euiTheme.animation.fast, " ease-in;};label:euiNotificationBadge;"),
26
26
  // Sizes
27
27
  s: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('height', euiTheme.size.base), " ", (0, _global_styling.logicalCSS)('min-width', euiTheme.size.base), ";;label:s;"),
@@ -1129,6 +1129,15 @@ EuiBasicTable.propTypes = {
1129
1129
  * When nesting an `EuiTooltip` in a scrollable container, `repositionOnScroll` should be `true`
1130
1130
  */
1131
1131
  repositionOnScroll: _propTypes.default.bool,
1132
+ /**
1133
+ * Disables the tooltip content being read by screen readers when focusing the trigger element.
1134
+ * Do not use when the trigger `aria-label` and tooltip `content` can be rephrased to be standalone
1135
+ * information (action & additional information).
1136
+ * Enable this prop only when the trigger has a descriptive label that either duplicates or includes
1137
+ * the tooltip content and would result in repetitive output.
1138
+ * @default false
1139
+ */
1140
+ disableScreenReaderOutput: _propTypes.default.bool,
1132
1141
  /**
1133
1142
  * If supplied, called when mouse movement causes the tool tip to be
1134
1143
  * hidden.
@@ -1244,6 +1253,7 @@ EuiBasicTable.propTypes = {
1244
1253
  title: _propTypes.default.node,
1245
1254
  id: _propTypes.default.string,
1246
1255
  repositionOnScroll: _propTypes.default.bool,
1256
+ disableScreenReaderOutput: _propTypes.default.bool,
1247
1257
  onMouseOut: _propTypes.default.func,
1248
1258
  "aria-label": _propTypes.default.string,
1249
1259
  "data-test-subj": _propTypes.default.string,
@@ -1384,6 +1394,7 @@ EuiBasicTable.propTypes = {
1384
1394
  title: _propTypes.default.node,
1385
1395
  id: _propTypes.default.string,
1386
1396
  repositionOnScroll: _propTypes.default.bool,
1397
+ disableScreenReaderOutput: _propTypes.default.bool,
1387
1398
  onMouseOut: _propTypes.default.func,
1388
1399
  "aria-label": _propTypes.default.string,
1389
1400
  "data-test-subj": _propTypes.default.string,
@@ -622,6 +622,15 @@ EuiInMemoryTable.propTypes = {
622
622
  * When nesting an `EuiTooltip` in a scrollable container, `repositionOnScroll` should be `true`
623
623
  */
624
624
  repositionOnScroll: _propTypes.default.bool,
625
+ /**
626
+ * Disables the tooltip content being read by screen readers when focusing the trigger element.
627
+ * Do not use when the trigger `aria-label` and tooltip `content` can be rephrased to be standalone
628
+ * information (action & additional information).
629
+ * Enable this prop only when the trigger has a descriptive label that either duplicates or includes
630
+ * the tooltip content and would result in repetitive output.
631
+ * @default false
632
+ */
633
+ disableScreenReaderOutput: _propTypes.default.bool,
625
634
  /**
626
635
  * If supplied, called when mouse movement causes the tool tip to be
627
636
  * hidden.
@@ -737,6 +746,7 @@ EuiInMemoryTable.propTypes = {
737
746
  title: _propTypes.default.node,
738
747
  id: _propTypes.default.string,
739
748
  repositionOnScroll: _propTypes.default.bool,
749
+ disableScreenReaderOutput: _propTypes.default.bool,
740
750
  onMouseOut: _propTypes.default.func,
741
751
  "aria-label": _propTypes.default.string,
742
752
  "data-test-subj": _propTypes.default.string,
@@ -877,6 +887,7 @@ EuiInMemoryTable.propTypes = {
877
887
  title: _propTypes.default.node,
878
888
  id: _propTypes.default.string,
879
889
  repositionOnScroll: _propTypes.default.bool,
890
+ disableScreenReaderOutput: _propTypes.default.bool,
880
891
  onMouseOut: _propTypes.default.func,
881
892
  "aria-label": _propTypes.default.string,
882
893
  "data-test-subj": _propTypes.default.string,
@@ -29,7 +29,9 @@ var euiCodeStyles = exports.euiCodeStyles = function euiCodeStyles(euiThemeConte
29
29
  /*
30
30
  * 1. Size the code against the text its embedded within.
31
31
  */
32
- euiCode: /*#__PURE__*/(0, _react.css)("font-family:", euiTheme.font.familyCode, ";font-size:0.9em;", (0, _global_styling.logicalShorthandCSS)('padding', '0.2em 0.5em'), "background:", codeSyntaxVariables.backgroundColor, ";border-radius:", euiTheme.border.radius.small, ";font-weight:", euiTheme.font.weight.bold, ";color:", codeSyntaxVariables.inlineCodeColor, ";", codeSyntaxVariables.tokensCss, " .token.atrule .token.rule,.token.keyword{color:", codeSyntaxVariables.inlineCodeKeywordColor, ";};label:euiCode;"),
32
+ euiCode: /*#__PURE__*/(0, _react.css)("font-family:", euiTheme.font.familyCode, ";font-size:0.9em;", (0, _global_styling.logicalShorthandCSS)('padding', '0.2em 0.5em'), "background-color:", codeSyntaxVariables.backgroundColor, ";", (0, _global_styling.highContrastModeStyles)(euiThemeContext, {
33
+ forced: "\n border: ".concat(euiTheme.border.thin, ";\n ")
34
+ }), " border-radius:", euiTheme.border.radius.small, ";font-weight:", euiTheme.font.weight.bold, ";color:", codeSyntaxVariables.inlineCodeColor, ";", codeSyntaxVariables.tokensCss, " .token.atrule .token.rule,.token.keyword{color:", codeSyntaxVariables.inlineCodeKeywordColor, ";};label:euiCode;"),
33
35
  transparentBackground: _ref
34
36
  };
35
37
  };
@@ -20,9 +20,12 @@ var euiCodeTextColors = exports.euiCodeTextColors = function euiCodeTextColors(_
20
20
  };
21
21
  };
22
22
 
23
- // These variables are computationally expensive - do not call them outside `useEuiMemoizedStyles`
23
+ /**
24
+ * These variables are computationally expensive - do not call them outside `useEuiMemoizedStyles`
25
+ */
24
26
  var euiCodeSyntaxVariables = exports.euiCodeSyntaxVariables = function euiCodeSyntaxVariables(euiThemeContext) {
25
- var euiTheme = euiThemeContext.euiTheme;
27
+ var euiTheme = euiThemeContext.euiTheme,
28
+ highContrastMode = euiThemeContext.highContrastMode;
26
29
  var _euiCodeTextColors = euiCodeTextColors(euiThemeContext),
27
30
  backgroundColor = _euiCodeTextColors.backgroundColor,
28
31
  color = _euiCodeTextColors.color;
@@ -52,7 +55,7 @@ var euiCodeSyntaxVariables = exports.euiCodeSyntaxVariables = function euiCodeSy
52
55
  selectorClassColor: euiTheme.components.codeSelectorClassColor,
53
56
  selectorIdColor: euiTheme.components.codeSelectorIdColor,
54
57
  get tokensCss() {
55
- return "\n .token.punctuation:not(.interpolation-punctuation):not([class*='attr-']) {\n opacity: .7;\n }\n\n .token.comment,\n .token.prolog,\n .token.doctype,\n .token.cdata,\n .token.coord,\n .token.blockquote {\n color: ".concat(this.commentColor, ";\n font-style: italic;\n }\n\n .token.selector {\n color: ").concat(this.selectorTagColor, ";\n }\n\n .token.string,\n .token.interpolation,\n .token.interpolation-punctuation,\n .token.doc-comment .token.keyword,\n .token.attr-value,\n .token.url .token.content {\n color: ").concat(this.stringColor, ";\n }\n\n .token.number,\n .token.boolean,\n .token.keyword.nil,\n .token.regex,\n .token.variable,\n .token.unit,\n .token.hexcode,\n .token.attr-name,\n .token.attr-equals {\n color: ").concat(this.numberColor, ";\n }\n\n .token.atrule .token.rule,\n .token.keyword {\n color: ").concat(this.keywordColor, ";\n }\n\n .token.function {\n color: ").concat(this.functionTitleColor, ";\n }\n\n .token.tag {\n color: ").concat(this.tagColor, ";\n }\n\n .token.class-name {\n color: ").concat(this.typeColor, ";\n }\n\n .token.property {\n color: ").concat(this.attributeColor, ";\n }\n\n .token.console,\n .token.list-punctuation,\n .token.url-reference,\n .token.url .token.url {\n color: ").concat(this.symbolColor, ";\n }\n\n .token.paramater {\n color: ").concat(this.paramsColor, ";\n }\n\n .token.meta,\n .token.important {\n color: ").concat(this.metaColor, ";\n }\n\n .token.title {\n color: ").concat(this.titleColor, ";\n }\n\n .token.section {\n color: ").concat(this.sectionColor, ";\n }\n\n .token.prefix.inserted,\n .token.prefix.deleted {\n padding-inline-start: -").concat(euiTheme.size.xs, ";\n margin-inline-start: -").concat(euiTheme.size.xs, ";\n }\n\n .token.prefix.inserted {\n box-shadow: -").concat(euiTheme.size.xs, " 0 ").concat(this.additionColor, ";\n color: ").concat(this.additionColor, ";\n }\n\n .token.prefix.deleted {\n box-shadow: -").concat(euiTheme.size.xs, " 0 ").concat(this.deletionColor, ";\n color: ").concat(this.deletionColor, ";\n }\n\n .token.selector .token.class {\n color: ").concat(this.selectorClassColor, ";\n }\n\n .token.selector .token.id {\n color: ").concat(this.selectorIdColor, ";\n }\n\n .token.italic {\n font-style: italic;\n }\n\n .token.important,\n .token.bold {\n font-weight: ").concat(euiTheme.font.weight.bold, ";\n }\n\n .token.url-reference,\n .token.url .token.url {\n text-decoration: underline;\n }\n\n .token.entity {\n cursor: help;\n }");
58
+ return "\n .token.punctuation:not(.interpolation-punctuation):not([class*='attr-']) {\n opacity: ".concat(highContrastMode ? '1' : '.7', ";\n }\n\n .token.comment,\n .token.prolog,\n .token.doctype,\n .token.cdata,\n .token.coord,\n .token.blockquote {\n color: ").concat(this.commentColor, ";\n font-style: italic;\n }\n\n .token.selector {\n color: ").concat(this.selectorTagColor, ";\n }\n\n .token.string,\n .token.interpolation,\n .token.interpolation-punctuation,\n .token.doc-comment .token.keyword,\n .token.attr-value,\n .token.url .token.content {\n color: ").concat(this.stringColor, ";\n }\n\n .token.number,\n .token.boolean,\n .token.keyword.nil,\n .token.regex,\n .token.variable,\n .token.unit,\n .token.hexcode,\n .token.attr-name,\n .token.attr-equals {\n color: ").concat(this.numberColor, ";\n }\n\n .token.atrule .token.rule,\n .token.keyword {\n color: ").concat(this.keywordColor, ";\n }\n\n .token.function {\n color: ").concat(this.functionTitleColor, ";\n }\n\n .token.tag {\n color: ").concat(this.tagColor, ";\n }\n\n .token.class-name {\n color: ").concat(this.typeColor, ";\n }\n\n .token.property {\n color: ").concat(this.attributeColor, ";\n }\n\n .token.console,\n .token.list-punctuation,\n .token.url-reference,\n .token.url .token.url {\n color: ").concat(this.symbolColor, ";\n }\n\n .token.paramater {\n color: ").concat(this.paramsColor, ";\n }\n\n .token.meta,\n .token.important {\n color: ").concat(this.metaColor, ";\n }\n\n .token.title {\n color: ").concat(this.titleColor, ";\n }\n\n .token.section {\n color: ").concat(this.sectionColor, ";\n }\n\n .token.prefix.inserted,\n .token.prefix.deleted {\n padding-inline-start: -").concat(euiTheme.size.xs, ";\n margin-inline-start: -").concat(euiTheme.size.xs, ";\n }\n\n .token.prefix.inserted {\n box-shadow: -").concat(euiTheme.size.xs, " 0 ").concat(this.additionColor, ";\n color: ").concat(this.additionColor, ";\n }\n\n .token.prefix.deleted {\n box-shadow: -").concat(euiTheme.size.xs, " 0 ").concat(this.deletionColor, ";\n color: ").concat(this.deletionColor, ";\n }\n\n .token.selector .token.class {\n color: ").concat(this.selectorClassColor, ";\n }\n\n .token.selector .token.id {\n color: ").concat(this.selectorIdColor, ";\n }\n\n .token.italic {\n font-style: italic;\n }\n\n .token.important,\n .token.bold {\n font-weight: ").concat(euiTheme.font.weight.bold, ";\n }\n\n .token.url-reference,\n .token.url .token.url {\n text-decoration: underline;\n }\n\n .token.entity {\n cursor: help;\n }");
56
59
  }
57
60
  };
58
61
  };
@@ -12,8 +12,9 @@ var _services = require("../../services");
12
12
  var _i18n = require("../i18n");
13
13
  var _utils = require("./utils");
14
14
  var _color_picker_swatch = require("./color_picker_swatch.styles");
15
+ var _tool_tip = require("../tool_tip");
15
16
  var _react2 = require("@emotion/react");
16
- var _excluded = ["className", "color", "style"];
17
+ var _excluded = ["className", "color", "style", "toolTipProps", "showToolTip"];
17
18
  /*
18
19
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
19
20
  * or more contributor license agreements. Licensed under the Elastic License
@@ -33,9 +34,13 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
33
34
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
34
35
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
35
36
  var EuiColorPickerSwatch = exports.EuiColorPickerSwatch = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
37
+ var _toolTipProps$anchorP;
36
38
  var className = _ref.className,
37
39
  color = _ref.color,
38
40
  style = _ref.style,
41
+ toolTipProps = _ref.toolTipProps,
42
+ _ref$showToolTip = _ref.showToolTip,
43
+ showToolTip = _ref$showToolTip === void 0 ? true : _ref$showToolTip,
39
44
  rest = _objectWithoutProperties(_ref, _excluded);
40
45
  var classes = (0, _classnames.default)('euiColorPickerSwatch', className);
41
46
  var styles = (0, _services.useEuiMemoizedStyles)(_color_picker_swatch.euiColorPickerSwatchStyles);
@@ -48,7 +53,7 @@ var EuiColorPickerSwatch = exports.EuiColorPickerSwatch = /*#__PURE__*/(0, _reac
48
53
  var ariaLabel = (0, _i18n.useEuiI18n)('euiColorPickerSwatch.ariaLabel', 'Select {color} as the color', {
49
54
  color: color
50
55
  });
51
- return (0, _react2.jsx)("button", _extends({
56
+ var element = (0, _react2.jsx)("button", _extends({
52
57
  type: "button",
53
58
  css: styles.euiColorPickerSwatch,
54
59
  className: classes,
@@ -58,12 +63,89 @@ var EuiColorPickerSwatch = exports.EuiColorPickerSwatch = /*#__PURE__*/(0, _reac
58
63
  background: background
59
64
  }, style)
60
65
  }, rest));
66
+ return showToolTip ? (0, _react2.jsx)(_tool_tip.EuiToolTip, _extends({
67
+ content: color
68
+ }, toolTipProps, {
69
+ anchorProps: _objectSpread(_objectSpread({}, toolTipProps === null || toolTipProps === void 0 ? void 0 : toolTipProps.anchorProps), {}, {
70
+ css: [toolTipProps === null || toolTipProps === void 0 || (_toolTipProps$anchorP = toolTipProps.anchorProps) === null || _toolTipProps$anchorP === void 0 ? void 0 : _toolTipProps$anchorP.css, styles.tooltip]
71
+ })
72
+ // since the button already has a descriptive `ariaLabel` we can disable
73
+ // the tooltip content from being read additionally by screen readers
74
+ ,
75
+ disableScreenReaderOutput: true
76
+ }), element) : element;
61
77
  });
62
78
  EuiColorPickerSwatch.propTypes = {
63
79
  className: _propTypes.default.string,
64
80
  "aria-label": _propTypes.default.string,
65
81
  "data-test-subj": _propTypes.default.string,
66
82
  css: _propTypes.default.any,
67
- color: _propTypes.default.string
83
+ color: _propTypes.default.string,
84
+ /**
85
+ * renders a tooltip with the color value to provide a visual text alternative
86
+ * @default true
87
+ */
88
+ showToolTip: _propTypes.default.bool,
89
+ /** Additional props for the EuiToolip when `showToolTip={true}` */toolTipProps: _propTypes.default.shape({
90
+ /**
91
+ * Passes onto the span wrapping the trigger.
92
+ */
93
+ anchorClassName: _propTypes.default.string,
94
+ /**
95
+ * Passes onto the span wrapping the trigger.
96
+ */
97
+ anchorProps: _propTypes.default.shape({
98
+ className: _propTypes.default.string,
99
+ "aria-label": _propTypes.default.string,
100
+ "data-test-subj": _propTypes.default.string,
101
+ css: _propTypes.default.any
102
+ }),
103
+ /**
104
+ * Passes onto the tooltip itself, not the trigger.
105
+ */
106
+ className: _propTypes.default.string,
107
+ /**
108
+ * The main content of your tooltip.
109
+ */
110
+ content: _propTypes.default.node,
111
+ /**
112
+ * Common display alternatives for the anchor wrapper
113
+ */
114
+ display: _propTypes.default.any,
115
+ /**
116
+ * An optional title for your tooltip.
117
+ */
118
+ title: _propTypes.default.node,
119
+ /**
120
+ * Unless you provide one, this will be randomly generated.
121
+ */
122
+ id: _propTypes.default.string,
123
+ /**
124
+ * When `true`, the tooltip's position is re-calculated when the user
125
+ * scrolls. This supports having fixed-position tooltip anchors.
126
+ *
127
+ * When nesting an `EuiTooltip` in a scrollable container, `repositionOnScroll` should be `true`
128
+ */
129
+ repositionOnScroll: _propTypes.default.bool,
130
+ /**
131
+ * Disables the tooltip content being read by screen readers when focusing the trigger element.
132
+ * Do not use when the trigger `aria-label` and tooltip `content` can be rephrased to be standalone
133
+ * information (action & additional information).
134
+ * Enable this prop only when the trigger has a descriptive label that either duplicates or includes
135
+ * the tooltip content and would result in repetitive output.
136
+ * @default false
137
+ */
138
+ disableScreenReaderOutput: _propTypes.default.bool,
139
+ /**
140
+ * If supplied, called when mouse movement causes the tool tip to be
141
+ * hidden.
142
+ */
143
+ onMouseOut: _propTypes.default.func,
144
+ "aria-label": _propTypes.default.string,
145
+ "data-test-subj": _propTypes.default.string,
146
+ css: _propTypes.default.any,
147
+ delay: _propTypes.default.any,
148
+ position: _propTypes.default.any
149
+ })
68
150
  };
69
151
  EuiColorPickerSwatch.displayName = 'EuiColorPickerSwatch';
@@ -8,14 +8,21 @@ var _react = require("@emotion/react");
8
8
  var _services = require("../../services");
9
9
  var _global_styling = require("../../global_styling");
10
10
  var _high_contrast = require("../../global_styling/functions/high_contrast");
11
- /*
11
+ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /*
12
12
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
13
13
  * or more contributor license agreements. Licensed under the Elastic License
14
14
  * 2.0 and the Server Side Public License, v 1; you may not use this file except
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
-
18
+ var _ref = process.env.NODE_ENV === "production" ? {
19
+ name: "164u3xw-tooltip",
20
+ styles: "display:inline-flex;label:tooltip;"
21
+ } : {
22
+ name: "164u3xw-tooltip",
23
+ styles: "display:inline-flex;label:tooltip;",
24
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
25
+ };
19
26
  var euiColorPickerSwatchStyles = exports.euiColorPickerSwatchStyles = function euiColorPickerSwatchStyles(euiThemeContext) {
20
27
  var euiTheme = euiThemeContext.euiTheme;
21
28
  return {
@@ -25,6 +32,7 @@ var euiColorPickerSwatchStyles = exports.euiColorPickerSwatchStyles = function e
25
32
  none: "\n border: ".concat(euiTheme.border.width.thin, " solid\n ").concat(euiTheme.colors.borderBaseFormsColorSwatch, ";\n box-shadow: inset 0 0 0 ").concat(euiTheme.border.width.thin, "\n ").concat((0, _services.transparentize)(euiTheme.colors.emptyShade, 0.05), ";\n "),
26
33
  preferred: "border: ".concat(euiTheme.border.thin, ";"),
27
34
  forced: (0, _high_contrast.preventForcedColors)(euiThemeContext)
28
- }), " cursor:pointer;&:disabled{cursor:default;}&:focus{", (0, _global_styling.euiOutline)(euiThemeContext, 'center'), ";};label:euiColorPickerSwatch;")
35
+ }), " cursor:pointer;&:disabled{cursor:default;}&:focus{", (0, _global_styling.euiOutline)(euiThemeContext, 'center'), ";};label:euiColorPickerSwatch;"),
36
+ tooltip: _ref
29
37
  };
30
38
  };
@@ -64,5 +64,8 @@ var euiHeaderDarkStyles = function euiHeaderDarkStyles(euiThemeContext) {
64
64
  borderColor: euiTheme.components.headerDarkSearchBorderColor,
65
65
  placeholderColor: (0, _services.makeHighContrastColor)(controlPlaceholderText, 8)(backgroundColor)
66
66
  };
67
- return "\n background-color: ".concat(backgroundColor, ";\n\n .euiHeaderLogo__text,\n .euiHeaderLink,\n .euiHeaderSectionItemButton {\n color: ").concat(euiTheme.colors.ghost, ";\n }\n\n .euiHeaderLink-isActive {\n color: ").concat((0, _services.makeHighContrastColor)(euiTheme.colors.primary)(backgroundColor), ";\n }\n\n .euiHeaderLogo,\n .euiHeaderLink,\n .euiHeaderSectionItemButton {\n &:focus {\n background-color: ").concat(euiTheme.components.headerDarkSectionItemBackgroundFocus, ";\n }\n }\n\n .euiHeaderSectionItemButton__notification--badge {\n box-shadow: 0 0 0 ").concat(euiTheme.border.width.thin, " ").concat(backgroundColor, ";\n }\n\n .euiHeaderSectionItemButton__notification--dot {\n stroke: ").concat(backgroundColor, ";\n }\n\n .euiSelectableTemplateSitewide .euiFormControlLayout {\n background-color: transparent;\n\n input {\n box-shadow: inset 0 0 0 ").concat(euiTheme.border.width.thin, " ").concat(selectableSitewide.borderColor, ";\n }\n\n &--group {\n border-color: ").concat(highContrastMode ? euiTheme.border.color : euiTheme.components.headerDarkSearchBorderColor, ";\n\n input {\n box-shadow: none;\n }\n }\n\n &:not(:focus-within) {\n /* Increase contrast of filled text to be more than placeholder text */\n color: ").concat(selectableSitewide.color, ";\n\n input {\n /* Increase contrast of placeholder text */\n &::placeholder {\n color: ").concat(selectableSitewide.placeholderColor, ";\n }\n\n /* Inherit color from form control layout */\n color: inherit;\n background-color: transparent;\n }\n\n .euiFormControlLayout__append,\n .euiFormControlLayout__prepend {\n background-color: transparent;\n }\n\n .euiFormLabel {\n color: inherit;\n }\n }\n }\n ");
67
+ return "\n background-color: ".concat(backgroundColor, ";\n\n .euiHeaderLogo__text,\n .euiHeaderLink,\n .euiHeaderSectionItemButton {\n color: ").concat(euiTheme.colors.ghost, ";\n }\n\n .euiHeaderLink-isActive {\n color: ").concat((0, _services.makeHighContrastColor)(euiTheme.colors.primary)(backgroundColor), ";\n }\n\n .euiHeaderLogo,\n .euiHeaderLink,\n .euiHeaderSectionItemButton {\n &:focus {\n background-color: ").concat(euiTheme.components.headerDarkSectionItemBackgroundFocus, ";\n }\n }\n\n .euiHeaderSectionItemButton__notification--badge {\n box-shadow: 0 0 0 ").concat(euiTheme.border.width.thin, " ").concat(backgroundColor, ";\n }\n\n .euiHeaderSectionItemButton__notification--dot {\n stroke: ").concat(backgroundColor, ";\n }\n\n .euiSelectableTemplateSitewide .euiFormControlLayout {\n background-color: transparent;\n\n input {\n box-shadow: inset 0 0 0 ").concat(euiTheme.border.width.thin, " ").concat(selectableSitewide.borderColor, ";\n }\n\n &--group {\n border-color: ").concat(
68
+ // the header is in a faux dark mode, we can't rely on color
69
+ // switch tokens as they'd be in the wrong color mode
70
+ highContrastMode ? euiTheme.colors.plainLight : euiTheme.components.headerDarkSearchBorderColor, ";\n\n input {\n box-shadow: none;\n }\n }\n\n &__append {\n border-color: ").concat(highContrastMode ? euiTheme.colors.plainLight : '', "\n }\n\n &:not(:focus-within) {\n /* Increase contrast of filled text to be more than placeholder text */\n color: ").concat(selectableSitewide.color, ";\n\n input {\n /* Increase contrast of placeholder text */\n &::placeholder {\n color: ").concat(selectableSitewide.placeholderColor, ";\n }\n\n /* Inherit color from form control layout */\n color: inherit;\n background-color: transparent;\n }\n\n .euiFormControlLayout__append,\n .euiFormControlLayout__prepend {\n background-color: transparent;\n }\n\n .euiFormLabel {\n color: inherit;\n }\n }\n }\n ");
68
71
  };
@@ -27,7 +27,7 @@ var euiPanelBorderStyles = exports.euiPanelBorderStyles = function euiPanelBorde
27
27
  euiTheme.colors.borderBaseFloating is enough then */
28
28
  var hasVisibleBorder = hasFloatingBorder && colorMode === 'DARK';
29
29
  return (0, _high_contrast.highContrastModeStyles)(euiThemeContext, {
30
- none: "\n /* Using a pseudo element for the border instead of floating border only \n because the transparent border might otherwise be visible with arbitrary \n full-width/height content in light mode. */\n &::before {\n content: '';\n position: absolute;\n /* ensure to keep on top of flush content */\n z-index: 1;\n inset: 0;\n border: ".concat(euiTheme.border.width.thin, " solid\n ").concat((borderColor !== null && borderColor !== void 0 ? borderColor : hasVisibleBorder) ? euiTheme.border.color : euiTheme.colors.borderBaseFloating, ";\n border-radius: inherit;\n pointer-events: none;\n }\n "),
30
+ none: "\n /* Using a pseudo element for the border instead of floating border only \n because the transparent border might otherwise be visible with arbitrary \n full-width/height content in light mode. */\n &::after {\n content: '';\n position: absolute;\n /* ensure to keep on top of flush content */\n z-index: 0;\n inset: 0;\n border: ".concat(euiTheme.border.width.thin, " solid\n ").concat((borderColor !== null && borderColor !== void 0 ? borderColor : hasVisibleBorder) ? euiTheme.border.color : euiTheme.colors.borderBaseFloating, ";\n border-radius: inherit;\n pointer-events: none;\n }\n "),
31
31
  preferred: "\n border: ".concat(euiTheme.border.thin, ";\n ")
32
32
  });
33
33
  };
@@ -198,6 +198,15 @@ EuiTableHeaderCell.propTypes = {
198
198
  * When nesting an `EuiTooltip` in a scrollable container, `repositionOnScroll` should be `true`
199
199
  */
200
200
  repositionOnScroll: _propTypes.default.bool,
201
+ /**
202
+ * Disables the tooltip content being read by screen readers when focusing the trigger element.
203
+ * Do not use when the trigger `aria-label` and tooltip `content` can be rephrased to be standalone
204
+ * information (action & additional information).
205
+ * Enable this prop only when the trigger has a descriptive label that either duplicates or includes
206
+ * the tooltip content and would result in repetitive output.
207
+ * @default false
208
+ */
209
+ disableScreenReaderOutput: _propTypes.default.bool,
201
210
  /**
202
211
  * If supplied, called when mouse movement causes the tool tip to be
203
212
  * hidden.
@@ -22,7 +22,7 @@ var euiToastStyles = exports.euiToastStyles = function euiToastStyles(euiThemeCo
22
22
  var euiTheme = euiThemeContext.euiTheme,
23
23
  highContrastMode = euiThemeContext.highContrastMode;
24
24
  var highlightStyles = function highlightStyles(color, width) {
25
- return "\n &:after {\n content: '';\n position: absolute;\n /* ensure highlight border is on top of panel border */\n z-index: 1;\n inset: 0;\n border-radius: inherit;\n ".concat((0, _global_styling.logicalCSS)('border-top', "".concat(width, " solid ").concat(color)), "\n pointer-events: none;\n }\n ");
25
+ return "\n &:before {\n content: '';\n position: absolute;\n /* ensure highlight border is on top of panel border */\n z-index: 1;\n inset: 0;\n border-radius: inherit;\n ".concat((0, _global_styling.logicalCSS)('border-top', "".concat(width, " solid ").concat(color)), "\n pointer-events: none;\n }\n ");
26
26
  };
27
27
  return {
28
28
  // Base
@@ -42,11 +42,11 @@ var euiToastStyles = exports.euiToastStyles = function euiToastStyles(euiThemeCo
42
42
  }) : euiTheme.border.width.thick;
43
43
  return (0, _high_contrast.highContrastModeStyles)(euiThemeContext, {
44
44
  none: highlightStyles(color, borderWidth),
45
- preferred: "\n ".concat(highlightStyles(color, borderWidth), "\n \n &::after {\n ").concat((0, _global_styling.logicalCSS)('width', "calc(100% + ".concat((0, _euiThemeCommon.mathWithUnits)(euiTheme.border.width.thin, function (x) {
45
+ preferred: "\n ".concat(highlightStyles(color, borderWidth), "\n \n &::before {\n ").concat((0, _global_styling.logicalCSS)('width', "calc(100% + ".concat((0, _euiThemeCommon.mathWithUnits)(euiTheme.border.width.thin, function (x) {
46
46
  return x * 2;
47
47
  }), ")")), "\n ").concat((0, _global_styling.logicalCSS)('margin-top', "-".concat(euiTheme.border.width.thin)), "\n ").concat((0, _global_styling.logicalCSS)('margin-left', "-".concat(euiTheme.border.width.thin)), "\n }\n "),
48
48
  // Windows high contrast mode ignores/overrides border colors, which have semantic meaning here. To get around this, we'll use a pseudo element that ignores forced colors
49
- forced: "\n overflow: hidden;\n\n &::after {\n content: '';\n position: absolute;\n ".concat((0, _global_styling.logicalCSS)('top', 0), "\n ").concat((0, _global_styling.logicalCSS)('horizontal', 0), "\n ").concat((0, _global_styling.logicalCSS)('height', borderWidth), "\n background-color: ").concat(color, ";\n ").concat((0, _high_contrast.preventForcedColors)(euiThemeContext), "\n pointer-events: none;\n }\n ")
49
+ forced: "\n overflow: hidden;\n\n &::before {\n content: '';\n position: absolute;\n ".concat((0, _global_styling.logicalCSS)('top', 0), "\n ").concat((0, _global_styling.logicalCSS)('horizontal', 0), "\n ").concat((0, _global_styling.logicalCSS)('height', borderWidth), "\n background-color: ").concat(color, ";\n ").concat((0, _high_contrast.preventForcedColors)(euiThemeContext), "\n pointer-events: none;\n }\n ")
50
50
  });
51
51
  },
52
52
  get primary() {
@@ -87,6 +87,15 @@ EuiIconTip.propTypes = {
87
87
  * When nesting an `EuiTooltip` in a scrollable container, `repositionOnScroll` should be `true`
88
88
  */
89
89
  repositionOnScroll: _propTypes.default.bool,
90
+ /**
91
+ * Disables the tooltip content being read by screen readers when focusing the trigger element.
92
+ * Do not use when the trigger `aria-label` and tooltip `content` can be rephrased to be standalone
93
+ * information (action & additional information).
94
+ * Enable this prop only when the trigger has a descriptive label that either duplicates or includes
95
+ * the tooltip content and would result in repetitive output.
96
+ * @default false
97
+ */
98
+ disableScreenReaderOutput: _propTypes.default.bool,
90
99
  /**
91
100
  * If supplied, called when mouse movement causes the tool tip to be
92
101
  * hidden.
@@ -16,7 +16,7 @@ var _tool_tip_anchor = require("./tool_tip_anchor");
16
16
  var _tool_tip_arrow = require("./tool_tip_arrow");
17
17
  var _tool_tip_manager = require("./tool_tip_manager");
18
18
  var _react3 = require("@emotion/react");
19
- var _excluded = ["children", "className", "anchorClassName", "anchorProps", "content", "title", "delay", "display", "repositionOnScroll"];
19
+ var _excluded = ["children", "className", "anchorClassName", "anchorProps", "content", "title", "delay", "display", "repositionOnScroll", "disableScreenReaderOutput"];
20
20
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
21
21
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
22
22
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -252,6 +252,8 @@ var EuiToolTip = exports.EuiToolTip = /*#__PURE__*/function (_Component) {
252
252
  delay = _this$props.delay,
253
253
  display = _this$props.display,
254
254
  repositionOnScroll = _this$props.repositionOnScroll,
255
+ _this$props$disableSc = _this$props.disableScreenReaderOutput,
256
+ disableScreenReaderOutput = _this$props$disableSc === void 0 ? false : _this$props$disableSc,
255
257
  rest = _objectWithoutProperties(_this$props, _excluded);
256
258
  var _this$state = this.state,
257
259
  arrowStyles = _this$state.arrowStyles,
@@ -267,8 +269,10 @@ var EuiToolTip = exports.EuiToolTip = /*#__PURE__*/function (_Component) {
267
269
  onFocus: this.onFocus,
268
270
  onKeyDown: this.onEscapeKey,
269
271
  onMouseOver: this.showToolTip,
270
- onMouseOut: this.onMouseOut,
271
- id: id,
272
+ onMouseOut: this.onMouseOut
273
+ // `id` defines if the trigger and tooltip are automatically linked via `aria-describedby`.
274
+ ,
275
+ id: !disableScreenReaderOutput ? id : undefined,
272
276
  className: anchorClasses,
273
277
  display: display,
274
278
  isVisible: visible
@@ -298,7 +302,8 @@ var EuiToolTip = exports.EuiToolTip = /*#__PURE__*/function (_Component) {
298
302
  _defineProperty(EuiToolTip, "defaultProps", {
299
303
  position: 'top',
300
304
  delay: 'regular',
301
- display: 'inlineBlock'
305
+ display: 'inlineBlock',
306
+ disableScreenReaderOutput: false
302
307
  });
303
308
  EuiToolTip.propTypes = {
304
309
  /**
@@ -353,6 +358,15 @@ EuiToolTip.propTypes = {
353
358
  * When nesting an `EuiTooltip` in a scrollable container, `repositionOnScroll` should be `true`
354
359
  */
355
360
  repositionOnScroll: _propTypes.default.bool,
361
+ /**
362
+ * Disables the tooltip content being read by screen readers when focusing the trigger element.
363
+ * Do not use when the trigger `aria-label` and tooltip `content` can be rephrased to be standalone
364
+ * information (action & additional information).
365
+ * Enable this prop only when the trigger has a descriptive label that either duplicates or includes
366
+ * the tooltip content and would result in repetitive output.
367
+ * @default false
368
+ */
369
+ disableScreenReaderOutput: _propTypes.default.bool,
356
370
  /**
357
371
  * If supplied, called when mouse movement causes the tool tip to be
358
372
  * hidden.
@@ -56,7 +56,7 @@ var EuiToolTipAnchor = exports.EuiToolTipAnchor = /*#__PURE__*/(0, _react.forwar
56
56
  _onBlur();
57
57
  children.props.onBlur && children.props.onBlur(e);
58
58
  },
59
- 'aria-describedby': isVisible ? (0, _classnames.default)(id, children.props['aria-describedby']) : children.props['aria-describedby']
59
+ 'aria-describedby': isVisible && id ? (0, _classnames.default)(id, children.props['aria-describedby']) : children.props['aria-describedby']
60
60
  }))
61
61
  );
62
62
  });
@@ -48,10 +48,11 @@ var euiButtonColor = exports.euiButtonColor = function euiButtonColor(euiThemeCo
48
48
  * @returns Style object `{ backgroundColor, color }`
49
49
  */
50
50
  var euiButtonFillColor = exports.euiButtonFillColor = function euiButtonFillColor(euiThemeContext, color) {
51
- var euiTheme = euiThemeContext.euiTheme;
51
+ var euiTheme = euiThemeContext.euiTheme,
52
+ highContrastMode = euiThemeContext.highContrastMode;
52
53
  var backgroundTokenName = (0, _euiThemeCommon.getTokenName)('backgroundFilled', color);
53
54
  var textColorTokenName = (0, _euiThemeCommon.getTokenName)('textColorFilled', color);
54
- var foreground = euiTheme.components.buttons[textColorTokenName];
55
+ var foreground = highContrastMode ? color === 'warning' ? euiTheme.colors.ink : euiTheme.colors.textInverse : euiTheme.components.buttons[textColorTokenName];
55
56
  var background = euiTheme.components.buttons[backgroundTokenName];
56
57
  return _objectSpread({
57
58
  color: foreground,
@@ -34,14 +34,14 @@ export var euiBadgeStyles = function euiBadgeStyles(euiThemeContext) {
34
34
  }), ";", logicalTextAlignCSS('left'), "color:var(--euiBadgeTextColor, ", badgeColors.default.color, ");background-color:var(\n --euiBadgeBackgroundColor,\n ", badgeColors.default.backgroundColor, "\n );*::selection{color:var(\n --euiBadgeBackgroundColor,\n ", badgeColors.default.backgroundColor, "\n );background-color:var(\n --euiBadgeTextColor,\n ", badgeColors.default.color, "\n );}&:focus-within{", euiFocusRing(euiThemeContext), ";}&+.euiBadge{", logicalCSS('margin-left', euiTheme.size.xs), ";};label:euiBadge;"),
35
35
  clickable: /*#__PURE__*/css("&:not(:disabled){&:hover,&:focus{text-decoration:underline;}}&:focus{", euiFocusRing(euiThemeContext), ";}&:disabled{cursor:not-allowed;};label:clickable;"),
36
36
  // Colors
37
- default: /*#__PURE__*/css(setBadgeColorVars(badgeColors.default), ";label:default;"),
37
+ default: /*#__PURE__*/css(setBadgeColorVars(badgeColors.default), " border-color:", badgeColors.default.borderColor, ";;label:default;"),
38
38
  hollow: /*#__PURE__*/css(setBadgeColorVars(badgeColors.hollow), " border-color:", badgeColors.hollow.borderColor, ";;label:hollow;"),
39
39
  primary: /*#__PURE__*/css(setBadgeColorVars(badgeColors.primary), ";label:primary;"),
40
40
  accent: /*#__PURE__*/css(setBadgeColorVars(badgeColors.accent), ";label:accent;"),
41
41
  warning: /*#__PURE__*/css(setBadgeColorVars(badgeColors.warning), ";label:warning;"),
42
42
  danger: /*#__PURE__*/css(setBadgeColorVars(badgeColors.danger), ";label:danger;"),
43
43
  success: /*#__PURE__*/css(setBadgeColorVars(badgeColors.success), ";label:success;"),
44
- disabled: /*#__PURE__*/css(setBadgeColorVars(badgeColors.disabled), "*::selection{color:", euiTheme.colors.emptyShade, ";};label:disabled;"),
44
+ disabled: /*#__PURE__*/css(setBadgeColorVars(badgeColors.disabled), " border-color:", badgeColors.disabled.borderColor, ";*::selection{color:", euiTheme.colors.emptyShade, ";};label:disabled;"),
45
45
  // Content wrapper
46
46
  euiBadge__content: /*#__PURE__*/css(logicalCSS(
47
47
  // Ensure proper height in case of just displaying an icon
@@ -15,7 +15,9 @@ import { isColorDark } from '../../services';
15
15
  import { euiButtonColor, euiButtonFillColor } from '../../global_styling/mixins/_button';
16
16
  import { chromaValid, parseColor } from '../color_picker/utils';
17
17
  export var euiBadgeColors = function euiBadgeColors(euiThemeContext) {
18
- var euiTheme = euiThemeContext.euiTheme;
18
+ var euiTheme = euiThemeContext.euiTheme,
19
+ highContrastMode = euiThemeContext.highContrastMode;
20
+ var badgeColorsAccentText = getBadgeColors(euiThemeContext, euiTheme.colors.textAccent);
19
21
  return {
20
22
  // Colors shared between buttons and badges
21
23
  primary: euiButtonFillColor(euiThemeContext, 'primary'),
@@ -24,16 +26,24 @@ export var euiBadgeColors = function euiBadgeColors(euiThemeContext) {
24
26
  danger: euiButtonFillColor(euiThemeContext, 'danger'),
25
27
  accent: euiButtonFillColor(euiThemeContext, 'accent'),
26
28
  accentSecondary: euiButtonFillColor(euiThemeContext, 'accentSecondary'),
27
- disabled: euiButtonColor(euiThemeContext, 'disabled'),
29
+ disabled: _objectSpread(_objectSpread({}, euiButtonColor(euiThemeContext, 'disabled')), {}, {
30
+ borderColor: highContrastMode ? euiTheme.colors.textDisabled : ''
31
+ }),
28
32
  // Colors unique to badges
29
- default: getBadgeColors(euiThemeContext, euiTheme.components.badgeBackground),
33
+ default: _objectSpread(_objectSpread({}, getBadgeColors(euiThemeContext, euiTheme.components.badgeBackground)), {}, {
34
+ borderColor: highContrastMode ? euiTheme.border.color : ''
35
+ }),
30
36
  // Hollow has a border and is used for autocompleters and beta badges
31
37
  hollow: _objectSpread(_objectSpread({}, getBadgeColors(euiThemeContext, euiTheme.colors.emptyShade)), {}, {
32
- borderColor: euiTheme.components.badgeBorderColorHollow
38
+ borderColor: highContrastMode ? euiTheme.border.color : euiTheme.components.badgeBorderColorHollow
33
39
  }),
34
40
  // Colors used by beta and notification badges
35
- subdued: getBadgeColors(euiThemeContext, euiTheme.components.badgeBackgroundSubdued),
36
- accentText: getBadgeColors(euiThemeContext, euiTheme.colors.textAccent),
41
+ subdued: _objectSpread(_objectSpread({}, getBadgeColors(euiThemeContext, euiTheme.components.badgeBackgroundSubdued)), {}, {
42
+ borderColor: highContrastMode ? euiTheme.border.color : ''
43
+ }),
44
+ accentText: _objectSpread(_objectSpread({}, badgeColorsAccentText), {}, {
45
+ borderColor: highContrastMode ? badgeColorsAccentText.backgroundColor : ''
46
+ }),
37
47
  accentSecondaryText: getBadgeColors(euiThemeContext, euiTheme.colors.textAccentSecondary)
38
48
  };
39
49
  };
@@ -15,7 +15,7 @@ export var euiNotificationBadgeStyles = function euiNotificationBadgeStyles(euiT
15
15
  var badgeColors = euiBadgeColors(euiThemeContext);
16
16
  return {
17
17
  euiNotificationBadge: /*#__PURE__*/css("flex-shrink:0;display:inline-flex;justify-content:center;align-items:center;vertical-align:middle;", logicalCSS('padding-horizontal', euiTheme.size.xs), " border-radius:", euiTheme.border.radius.small, ";", highContrastModeStyles(euiThemeContext, {
18
- forced: "\n border: ".concat(euiTheme.border.thin, ";\n overflow: hidden; /* Fix text clipping */\n ")
18
+ preferred: "\n border: ".concat(euiTheme.border.thin, ";\n overflow: hidden; /* Fix text clipping */\n ")
19
19
  }), " cursor:default;font-size:", euiFontSizeFromScale('xs', euiTheme), ";font-weight:", euiTheme.font.weight.medium, ";", euiNumberFormat(euiThemeContext), " text-align:center;", euiCanAnimate, "{transition:all ", euiTheme.animation.fast, " ease-in;};label:euiNotificationBadge;"),
20
20
  // Sizes
21
21
  s: /*#__PURE__*/css(logicalCSS('height', euiTheme.size.base), " ", logicalCSS('min-width', euiTheme.size.base), ";;label:s;"),
@@ -8,7 +8,7 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
8
8
  */
9
9
 
10
10
  import { css } from '@emotion/react';
11
- import { logicalShorthandCSS } from '../../global_styling';
11
+ import { highContrastModeStyles, logicalShorthandCSS } from '../../global_styling';
12
12
  import { euiCodeSyntaxVariables } from './code_syntax.styles';
13
13
  var _ref = process.env.NODE_ENV === "production" ? {
14
14
  name: "gfiv3z-transparentBackground",
@@ -25,7 +25,9 @@ export var euiCodeStyles = function euiCodeStyles(euiThemeContext) {
25
25
  /*
26
26
  * 1. Size the code against the text its embedded within.
27
27
  */
28
- euiCode: /*#__PURE__*/css("font-family:", euiTheme.font.familyCode, ";font-size:0.9em;", logicalShorthandCSS('padding', '0.2em 0.5em'), "background:", codeSyntaxVariables.backgroundColor, ";border-radius:", euiTheme.border.radius.small, ";font-weight:", euiTheme.font.weight.bold, ";color:", codeSyntaxVariables.inlineCodeColor, ";", codeSyntaxVariables.tokensCss, " .token.atrule .token.rule,.token.keyword{color:", codeSyntaxVariables.inlineCodeKeywordColor, ";};label:euiCode;"),
28
+ euiCode: /*#__PURE__*/css("font-family:", euiTheme.font.familyCode, ";font-size:0.9em;", logicalShorthandCSS('padding', '0.2em 0.5em'), "background-color:", codeSyntaxVariables.backgroundColor, ";", highContrastModeStyles(euiThemeContext, {
29
+ forced: "\n border: ".concat(euiTheme.border.thin, ";\n ")
30
+ }), " border-radius:", euiTheme.border.radius.small, ";font-weight:", euiTheme.font.weight.bold, ";color:", codeSyntaxVariables.inlineCodeColor, ";", codeSyntaxVariables.tokensCss, " .token.atrule .token.rule,.token.keyword{color:", codeSyntaxVariables.inlineCodeKeywordColor, ";};label:euiCode;"),
29
31
  transparentBackground: _ref
30
32
  };
31
33
  };