@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
@@ -14,9 +14,12 @@ export var euiCodeTextColors = function euiCodeTextColors(_ref) {
14
14
  };
15
15
  };
16
16
 
17
- // These variables are computationally expensive - do not call them outside `useEuiMemoizedStyles`
17
+ /**
18
+ * These variables are computationally expensive - do not call them outside `useEuiMemoizedStyles`
19
+ */
18
20
  export var euiCodeSyntaxVariables = function euiCodeSyntaxVariables(euiThemeContext) {
19
- var euiTheme = euiThemeContext.euiTheme;
21
+ var euiTheme = euiThemeContext.euiTheme,
22
+ highContrastMode = euiThemeContext.highContrastMode;
20
23
  var _euiCodeTextColors = euiCodeTextColors(euiThemeContext),
21
24
  backgroundColor = _euiCodeTextColors.backgroundColor,
22
25
  color = _euiCodeTextColors.color;
@@ -46,7 +49,7 @@ export var euiCodeSyntaxVariables = function euiCodeSyntaxVariables(euiThemeCont
46
49
  selectorClassColor: euiTheme.components.codeSelectorClassColor,
47
50
  selectorIdColor: euiTheme.components.codeSelectorIdColor,
48
51
  get tokensCss() {
49
- 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 }");
52
+ 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 }");
50
53
  }
51
54
  };
52
55
  };
@@ -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", "color", "style"];
4
+ var _excluded = ["className", "color", "style", "toolTipProps", "showToolTip"];
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
  /*
@@ -18,11 +18,16 @@ import { useEuiMemoizedStyles } from '../../services';
18
18
  import { useEuiI18n } from '../i18n';
19
19
  import { getChromaColor } from './utils';
20
20
  import { euiColorPickerSwatchStyles } from './color_picker_swatch.styles';
21
+ import { EuiToolTip } from '../tool_tip';
21
22
  import { jsx as ___EmotionJSX } from "@emotion/react";
22
23
  export var EuiColorPickerSwatch = /*#__PURE__*/forwardRef(function (_ref, ref) {
24
+ var _toolTipProps$anchorP;
23
25
  var className = _ref.className,
24
26
  color = _ref.color,
25
27
  style = _ref.style,
28
+ toolTipProps = _ref.toolTipProps,
29
+ _ref$showToolTip = _ref.showToolTip,
30
+ showToolTip = _ref$showToolTip === void 0 ? true : _ref$showToolTip,
26
31
  rest = _objectWithoutProperties(_ref, _excluded);
27
32
  var classes = classNames('euiColorPickerSwatch', className);
28
33
  var styles = useEuiMemoizedStyles(euiColorPickerSwatchStyles);
@@ -35,7 +40,7 @@ export var EuiColorPickerSwatch = /*#__PURE__*/forwardRef(function (_ref, ref) {
35
40
  var ariaLabel = useEuiI18n('euiColorPickerSwatch.ariaLabel', 'Select {color} as the color', {
36
41
  color: color
37
42
  });
38
- return ___EmotionJSX("button", _extends({
43
+ var element = ___EmotionJSX("button", _extends({
39
44
  type: "button",
40
45
  css: styles.euiColorPickerSwatch,
41
46
  className: classes,
@@ -45,5 +50,16 @@ export var EuiColorPickerSwatch = /*#__PURE__*/forwardRef(function (_ref, ref) {
45
50
  background: background
46
51
  }, style)
47
52
  }, rest));
53
+ return showToolTip ? ___EmotionJSX(EuiToolTip, _extends({
54
+ content: color
55
+ }, toolTipProps, {
56
+ anchorProps: _objectSpread(_objectSpread({}, toolTipProps === null || toolTipProps === void 0 ? void 0 : toolTipProps.anchorProps), {}, {
57
+ css: [toolTipProps === null || toolTipProps === void 0 || (_toolTipProps$anchorP = toolTipProps.anchorProps) === null || _toolTipProps$anchorP === void 0 ? void 0 : _toolTipProps$anchorP.css, styles.tooltip]
58
+ })
59
+ // since the button already has a descriptive `ariaLabel` we can disable
60
+ // the tooltip content from being read additionally by screen readers
61
+ ,
62
+ disableScreenReaderOutput: true
63
+ }), element) : element;
48
64
  });
49
65
  EuiColorPickerSwatch.displayName = 'EuiColorPickerSwatch';
@@ -1,3 +1,4 @@
1
+ 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)."; }
1
2
  /*
2
3
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
4
  * or more contributor license agreements. Licensed under the Elastic License
@@ -10,6 +11,14 @@ import { css } from '@emotion/react';
10
11
  import { transparentize } from '../../services';
11
12
  import { logicalSizeCSS, mathWithUnits, euiOutline } from '../../global_styling';
12
13
  import { highContrastModeStyles, preventForcedColors } from '../../global_styling/functions/high_contrast';
14
+ var _ref = process.env.NODE_ENV === "production" ? {
15
+ name: "164u3xw-tooltip",
16
+ styles: "display:inline-flex;label:tooltip;"
17
+ } : {
18
+ name: "164u3xw-tooltip",
19
+ styles: "display:inline-flex;label:tooltip;",
20
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
21
+ };
13
22
  export var euiColorPickerSwatchStyles = function euiColorPickerSwatchStyles(euiThemeContext) {
14
23
  var euiTheme = euiThemeContext.euiTheme;
15
24
  return {
@@ -19,6 +28,7 @@ export var euiColorPickerSwatchStyles = function euiColorPickerSwatchStyles(euiT
19
28
  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(transparentize(euiTheme.colors.emptyShade, 0.05), ";\n "),
20
29
  preferred: "border: ".concat(euiTheme.border.thin, ";"),
21
30
  forced: preventForcedColors(euiThemeContext)
22
- }), " cursor:pointer;&:disabled{cursor:default;}&:focus{", euiOutline(euiThemeContext, 'center'), ";};label:euiColorPickerSwatch;")
31
+ }), " cursor:pointer;&:disabled{cursor:default;}&:focus{", euiOutline(euiThemeContext, 'center'), ";};label:euiColorPickerSwatch;"),
32
+ tooltip: _ref
23
33
  };
24
34
  };
@@ -57,5 +57,8 @@ var euiHeaderDarkStyles = function euiHeaderDarkStyles(euiThemeContext) {
57
57
  borderColor: euiTheme.components.headerDarkSearchBorderColor,
58
58
  placeholderColor: makeHighContrastColor(controlPlaceholderText, 8)(backgroundColor)
59
59
  };
60
- 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(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 ");
60
+ 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(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(
61
+ // the header is in a faux dark mode, we can't rely on color
62
+ // switch tokens as they'd be in the wrong color mode
63
+ 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 ");
61
64
  };
@@ -23,7 +23,7 @@ export var euiPanelBorderStyles = function euiPanelBorderStyles(euiThemeContext,
23
23
  euiTheme.colors.borderBaseFloating is enough then */
24
24
  var hasVisibleBorder = hasFloatingBorder && colorMode === 'DARK';
25
25
  return highContrastModeStyles(euiThemeContext, {
26
- 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 "),
26
+ 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 "),
27
27
  preferred: "\n border: ".concat(euiTheme.border.thin, ";\n ")
28
28
  });
29
29
  };
@@ -16,7 +16,7 @@ export var euiToastStyles = function euiToastStyles(euiThemeContext) {
16
16
  var euiTheme = euiThemeContext.euiTheme,
17
17
  highContrastMode = euiThemeContext.highContrastMode;
18
18
  var highlightStyles = function highlightStyles(color, width) {
19
- 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(logicalCSS('border-top', "".concat(width, " solid ").concat(color)), "\n pointer-events: none;\n }\n ");
19
+ 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(logicalCSS('border-top', "".concat(width, " solid ").concat(color)), "\n pointer-events: none;\n }\n ");
20
20
  };
21
21
  return {
22
22
  // Base
@@ -36,11 +36,11 @@ export var euiToastStyles = function euiToastStyles(euiThemeContext) {
36
36
  }) : euiTheme.border.width.thick;
37
37
  return highContrastModeStyles(euiThemeContext, {
38
38
  none: highlightStyles(color, borderWidth),
39
- preferred: "\n ".concat(highlightStyles(color, borderWidth), "\n \n &::after {\n ").concat(logicalCSS('width', "calc(100% + ".concat(mathWithUnits(euiTheme.border.width.thin, function (x) {
39
+ preferred: "\n ".concat(highlightStyles(color, borderWidth), "\n \n &::before {\n ").concat(logicalCSS('width', "calc(100% + ".concat(mathWithUnits(euiTheme.border.width.thin, function (x) {
40
40
  return x * 2;
41
41
  }), ")")), "\n ").concat(logicalCSS('margin-top', "-".concat(euiTheme.border.width.thin)), "\n ").concat(logicalCSS('margin-left', "-".concat(euiTheme.border.width.thin)), "\n }\n "),
42
42
  // 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
43
- forced: "\n overflow: hidden;\n\n &::after {\n content: '';\n position: absolute;\n ".concat(logicalCSS('top', 0), "\n ").concat(logicalCSS('horizontal', 0), "\n ").concat(logicalCSS('height', borderWidth), "\n background-color: ").concat(color, ";\n ").concat(preventForcedColors(euiThemeContext), "\n pointer-events: none;\n }\n ")
43
+ forced: "\n overflow: hidden;\n\n &::before {\n content: '';\n position: absolute;\n ".concat(logicalCSS('top', 0), "\n ").concat(logicalCSS('horizontal', 0), "\n ").concat(logicalCSS('height', borderWidth), "\n background-color: ").concat(color, ";\n ").concat(preventForcedColors(euiThemeContext), "\n pointer-events: none;\n }\n ")
44
44
  });
45
45
  },
46
46
  get primary() {
@@ -6,7 +6,7 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
6
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
7
  import _inherits from "@babel/runtime/helpers/inherits";
8
8
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
- var _excluded = ["children", "className", "anchorClassName", "anchorProps", "content", "title", "delay", "display", "repositionOnScroll"];
9
+ var _excluded = ["children", "className", "anchorClassName", "anchorProps", "content", "title", "delay", "display", "repositionOnScroll", "disableScreenReaderOutput"];
10
10
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
11
11
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
12
12
  /*
@@ -237,6 +237,8 @@ export var EuiToolTip = /*#__PURE__*/function (_Component) {
237
237
  delay = _this$props.delay,
238
238
  display = _this$props.display,
239
239
  repositionOnScroll = _this$props.repositionOnScroll,
240
+ _this$props$disableSc = _this$props.disableScreenReaderOutput,
241
+ disableScreenReaderOutput = _this$props$disableSc === void 0 ? false : _this$props$disableSc,
240
242
  rest = _objectWithoutProperties(_this$props, _excluded);
241
243
  var _this$state = this.state,
242
244
  arrowStyles = _this$state.arrowStyles,
@@ -252,8 +254,10 @@ export var EuiToolTip = /*#__PURE__*/function (_Component) {
252
254
  onFocus: this.onFocus,
253
255
  onKeyDown: this.onEscapeKey,
254
256
  onMouseOver: this.showToolTip,
255
- onMouseOut: this.onMouseOut,
256
- id: id,
257
+ onMouseOut: this.onMouseOut
258
+ // `id` defines if the trigger and tooltip are automatically linked via `aria-describedby`.
259
+ ,
260
+ id: !disableScreenReaderOutput ? id : undefined,
257
261
  className: anchorClasses,
258
262
  display: display,
259
263
  isVisible: visible
@@ -283,5 +287,6 @@ export var EuiToolTip = /*#__PURE__*/function (_Component) {
283
287
  _defineProperty(EuiToolTip, "defaultProps", {
284
288
  position: 'top',
285
289
  delay: 'regular',
286
- display: 'inlineBlock'
290
+ display: 'inlineBlock',
291
+ disableScreenReaderOutput: false
287
292
  });
@@ -45,7 +45,7 @@ export var EuiToolTipAnchor = /*#__PURE__*/forwardRef(function (_ref, ref) {
45
45
  _onBlur();
46
46
  children.props.onBlur && children.props.onBlur(e);
47
47
  },
48
- 'aria-describedby': isVisible ? classNames(id, children.props['aria-describedby']) : children.props['aria-describedby']
48
+ 'aria-describedby': isVisible && id ? classNames(id, children.props['aria-describedby']) : children.props['aria-describedby']
49
49
  }))
50
50
  );
51
51
  });
@@ -41,10 +41,11 @@ export var euiButtonColor = function euiButtonColor(euiThemeContext, color) {
41
41
  * @returns Style object `{ backgroundColor, color }`
42
42
  */
43
43
  export var euiButtonFillColor = function euiButtonFillColor(euiThemeContext, color) {
44
- var euiTheme = euiThemeContext.euiTheme;
44
+ var euiTheme = euiThemeContext.euiTheme,
45
+ highContrastMode = euiThemeContext.highContrastMode;
45
46
  var backgroundTokenName = getTokenName('backgroundFilled', color);
46
47
  var textColorTokenName = getTokenName('textColorFilled', color);
47
- var foreground = euiTheme.components.buttons[textColorTokenName];
48
+ var foreground = highContrastMode ? color === 'warning' ? euiTheme.colors.ink : euiTheme.colors.textInverse : euiTheme.components.buttons[textColorTokenName];
48
49
  var background = euiTheme.components.buttons[backgroundTokenName];
49
50
  return _objectSpread({
50
51
  color: foreground,
@@ -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
@@ -20,7 +20,9 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
20
20
  * Side Public License, v 1.
21
21
  */
22
22
  var euiBadgeColors = exports.euiBadgeColors = function euiBadgeColors(euiThemeContext) {
23
- var euiTheme = euiThemeContext.euiTheme;
23
+ var euiTheme = euiThemeContext.euiTheme,
24
+ highContrastMode = euiThemeContext.highContrastMode;
25
+ var badgeColorsAccentText = getBadgeColors(euiThemeContext, euiTheme.colors.textAccent);
24
26
  return {
25
27
  // Colors shared between buttons and badges
26
28
  primary: (0, _button.euiButtonFillColor)(euiThemeContext, 'primary'),
@@ -29,16 +31,24 @@ var euiBadgeColors = exports.euiBadgeColors = function euiBadgeColors(euiThemeCo
29
31
  danger: (0, _button.euiButtonFillColor)(euiThemeContext, 'danger'),
30
32
  accent: (0, _button.euiButtonFillColor)(euiThemeContext, 'accent'),
31
33
  accentSecondary: (0, _button.euiButtonFillColor)(euiThemeContext, 'accentSecondary'),
32
- disabled: (0, _button.euiButtonColor)(euiThemeContext, 'disabled'),
34
+ disabled: _objectSpread(_objectSpread({}, (0, _button.euiButtonColor)(euiThemeContext, 'disabled')), {}, {
35
+ borderColor: highContrastMode ? euiTheme.colors.textDisabled : ''
36
+ }),
33
37
  // Colors unique to badges
34
- default: getBadgeColors(euiThemeContext, euiTheme.components.badgeBackground),
38
+ default: _objectSpread(_objectSpread({}, getBadgeColors(euiThemeContext, euiTheme.components.badgeBackground)), {}, {
39
+ borderColor: highContrastMode ? euiTheme.border.color : ''
40
+ }),
35
41
  // Hollow has a border and is used for autocompleters and beta badges
36
42
  hollow: _objectSpread(_objectSpread({}, getBadgeColors(euiThemeContext, euiTheme.colors.emptyShade)), {}, {
37
- borderColor: euiTheme.components.badgeBorderColorHollow
43
+ borderColor: highContrastMode ? euiTheme.border.color : euiTheme.components.badgeBorderColorHollow
38
44
  }),
39
45
  // Colors used by beta and notification badges
40
- subdued: getBadgeColors(euiThemeContext, euiTheme.components.badgeBackgroundSubdued),
41
- accentText: getBadgeColors(euiThemeContext, euiTheme.colors.textAccent),
46
+ subdued: _objectSpread(_objectSpread({}, getBadgeColors(euiThemeContext, euiTheme.components.badgeBackgroundSubdued)), {}, {
47
+ borderColor: highContrastMode ? euiTheme.border.color : ''
48
+ }),
49
+ accentText: _objectSpread(_objectSpread({}, badgeColorsAccentText), {}, {
50
+ borderColor: highContrastMode ? badgeColorsAccentText.backgroundColor : ''
51
+ }),
42
52
  accentSecondaryText: getBadgeColors(euiThemeContext, euiTheme.colors.textAccentSecondary)
43
53
  };
44
54
  };
@@ -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;"),
@@ -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
  };
@@ -15,8 +15,9 @@ var _services = require("../../services");
15
15
  var _i18n = require("../i18n");
16
16
  var _utils = require("./utils");
17
17
  var _color_picker_swatch = require("./color_picker_swatch.styles");
18
+ var _tool_tip = require("../tool_tip");
18
19
  var _react2 = require("@emotion/react");
19
- var _excluded = ["className", "color", "style"];
20
+ var _excluded = ["className", "color", "style", "toolTipProps", "showToolTip"];
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
@@ -29,9 +30,13 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
29
30
  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; }
30
31
  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) { (0, _defineProperty2.default)(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; }
31
32
  var EuiColorPickerSwatch = exports.EuiColorPickerSwatch = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
33
+ var _toolTipProps$anchorP;
32
34
  var className = _ref.className,
33
35
  color = _ref.color,
34
36
  style = _ref.style,
37
+ toolTipProps = _ref.toolTipProps,
38
+ _ref$showToolTip = _ref.showToolTip,
39
+ showToolTip = _ref$showToolTip === void 0 ? true : _ref$showToolTip,
35
40
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
36
41
  var classes = (0, _classnames.default)('euiColorPickerSwatch', className);
37
42
  var styles = (0, _services.useEuiMemoizedStyles)(_color_picker_swatch.euiColorPickerSwatchStyles);
@@ -44,7 +49,7 @@ var EuiColorPickerSwatch = exports.EuiColorPickerSwatch = /*#__PURE__*/(0, _reac
44
49
  var ariaLabel = (0, _i18n.useEuiI18n)('euiColorPickerSwatch.ariaLabel', 'Select {color} as the color', {
45
50
  color: color
46
51
  });
47
- return (0, _react2.jsx)("button", (0, _extends2.default)({
52
+ var element = (0, _react2.jsx)("button", (0, _extends2.default)({
48
53
  type: "button",
49
54
  css: styles.euiColorPickerSwatch,
50
55
  className: classes,
@@ -54,5 +59,16 @@ var EuiColorPickerSwatch = exports.EuiColorPickerSwatch = /*#__PURE__*/(0, _reac
54
59
  background: background
55
60
  }, style)
56
61
  }, rest));
62
+ return showToolTip ? (0, _react2.jsx)(_tool_tip.EuiToolTip, (0, _extends2.default)({
63
+ content: color
64
+ }, toolTipProps, {
65
+ anchorProps: _objectSpread(_objectSpread({}, toolTipProps === null || toolTipProps === void 0 ? void 0 : toolTipProps.anchorProps), {}, {
66
+ css: [toolTipProps === null || toolTipProps === void 0 || (_toolTipProps$anchorP = toolTipProps.anchorProps) === null || _toolTipProps$anchorP === void 0 ? void 0 : _toolTipProps$anchorP.css, styles.tooltip]
67
+ })
68
+ // since the button already has a descriptive `ariaLabel` we can disable
69
+ // the tooltip content from being read additionally by screen readers
70
+ ,
71
+ disableScreenReaderOutput: true
72
+ }), element) : element;
57
73
  });
58
74
  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
  };
@@ -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() {
@@ -25,7 +25,7 @@ var _tool_tip_anchor = require("./tool_tip_anchor");
25
25
  var _tool_tip_arrow = require("./tool_tip_arrow");
26
26
  var _tool_tip_manager = require("./tool_tip_manager");
27
27
  var _react3 = require("@emotion/react");
28
- var _excluded = ["children", "className", "anchorClassName", "anchorProps", "content", "title", "delay", "display", "repositionOnScroll"];
28
+ var _excluded = ["children", "className", "anchorClassName", "anchorProps", "content", "title", "delay", "display", "repositionOnScroll", "disableScreenReaderOutput"];
29
29
  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); }
30
30
  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; }
31
31
  function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
@@ -245,6 +245,8 @@ var EuiToolTip = exports.EuiToolTip = /*#__PURE__*/function (_Component) {
245
245
  delay = _this$props.delay,
246
246
  display = _this$props.display,
247
247
  repositionOnScroll = _this$props.repositionOnScroll,
248
+ _this$props$disableSc = _this$props.disableScreenReaderOutput,
249
+ disableScreenReaderOutput = _this$props$disableSc === void 0 ? false : _this$props$disableSc,
248
250
  rest = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
249
251
  var _this$state = this.state,
250
252
  arrowStyles = _this$state.arrowStyles,
@@ -260,8 +262,10 @@ var EuiToolTip = exports.EuiToolTip = /*#__PURE__*/function (_Component) {
260
262
  onFocus: this.onFocus,
261
263
  onKeyDown: this.onEscapeKey,
262
264
  onMouseOver: this.showToolTip,
263
- onMouseOut: this.onMouseOut,
264
- id: id,
265
+ onMouseOut: this.onMouseOut
266
+ // `id` defines if the trigger and tooltip are automatically linked via `aria-describedby`.
267
+ ,
268
+ id: !disableScreenReaderOutput ? id : undefined,
265
269
  className: anchorClasses,
266
270
  display: display,
267
271
  isVisible: visible
@@ -291,5 +295,6 @@ var EuiToolTip = exports.EuiToolTip = /*#__PURE__*/function (_Component) {
291
295
  (0, _defineProperty2.default)(EuiToolTip, "defaultProps", {
292
296
  position: 'top',
293
297
  delay: 'regular',
294
- display: 'inlineBlock'
298
+ display: 'inlineBlock',
299
+ disableScreenReaderOutput: false
295
300
  });
@@ -54,7 +54,7 @@ var EuiToolTipAnchor = exports.EuiToolTipAnchor = /*#__PURE__*/(0, _react.forwar
54
54
  _onBlur();
55
55
  children.props.onBlur && children.props.onBlur(e);
56
56
  },
57
- 'aria-describedby': isVisible ? (0, _classnames.default)(id, children.props['aria-describedby']) : children.props['aria-describedby']
57
+ 'aria-describedby': isVisible && id ? (0, _classnames.default)(id, children.props['aria-describedby']) : children.props['aria-describedby']
58
58
  }))
59
59
  );
60
60
  });
@@ -46,10 +46,11 @@ var euiButtonColor = exports.euiButtonColor = function euiButtonColor(euiThemeCo
46
46
  * @returns Style object `{ backgroundColor, color }`
47
47
  */
48
48
  var euiButtonFillColor = exports.euiButtonFillColor = function euiButtonFillColor(euiThemeContext, color) {
49
- var euiTheme = euiThemeContext.euiTheme;
49
+ var euiTheme = euiThemeContext.euiTheme,
50
+ highContrastMode = euiThemeContext.highContrastMode;
50
51
  var backgroundTokenName = (0, _euiThemeCommon.getTokenName)('backgroundFilled', color);
51
52
  var textColorTokenName = (0, _euiThemeCommon.getTokenName)('textColorFilled', color);
52
- var foreground = euiTheme.components.buttons[textColorTokenName];
53
+ var foreground = highContrastMode ? color === 'warning' ? euiTheme.colors.ink : euiTheme.colors.textInverse : euiTheme.components.buttons[textColorTokenName];
53
54
  var background = euiTheme.components.buttons[backgroundTokenName];
54
55
  return _objectSpread({
55
56
  color: foreground,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@elastic/eui",
3
3
  "description": "Elastic UI Component Library",
4
- "version": "101.1.0",
4
+ "version": "101.2.0",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "lib",
7
7
  "module": "es",