@elastic/eui 107.0.0 → 107.0.1

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 (32) hide show
  1. package/es/components/badge/beta_badge/beta_badge.js +1 -0
  2. package/es/components/basic_table/basic_table.styles.js +6 -4
  3. package/es/components/code/code_syntax.styles.js +1 -1
  4. package/es/components/icon/icon.js +31 -14
  5. package/es/components/icon/icon_map.js +1 -1
  6. package/es/components/table/table_row.styles.js +3 -3
  7. package/eui.d.ts +1 -1
  8. package/lib/components/badge/beta_badge/beta_badge.js +1 -0
  9. package/lib/components/basic_table/basic_table.styles.js +5 -3
  10. package/lib/components/code/code_syntax.styles.js +1 -1
  11. package/lib/components/icon/icon.js +31 -14
  12. package/lib/components/icon/icon_map.js +1 -1
  13. package/lib/components/table/table_row.styles.js +3 -3
  14. package/optimize/es/components/badge/beta_badge/beta_badge.js +1 -0
  15. package/optimize/es/components/basic_table/basic_table.styles.js +6 -4
  16. package/optimize/es/components/code/code_syntax.styles.js +1 -1
  17. package/optimize/es/components/icon/icon.js +31 -14
  18. package/optimize/es/components/icon/icon_map.js +1 -1
  19. package/optimize/es/components/table/table_row.styles.js +3 -3
  20. package/optimize/lib/components/badge/beta_badge/beta_badge.js +1 -0
  21. package/optimize/lib/components/basic_table/basic_table.styles.js +5 -3
  22. package/optimize/lib/components/code/code_syntax.styles.js +1 -1
  23. package/optimize/lib/components/icon/icon.js +31 -14
  24. package/optimize/lib/components/icon/icon_map.js +1 -1
  25. package/optimize/lib/components/table/table_row.styles.js +3 -3
  26. package/package/eui.d.ts +33359 -0
  27. package/package.json +2 -2
  28. package/test-env/components/badge/beta_badge/beta_badge.js +1 -0
  29. package/test-env/components/basic_table/basic_table.styles.js +5 -3
  30. package/test-env/components/code/code_syntax.styles.js +1 -1
  31. package/test-env/components/icon/icon_map.js +1 -1
  32. package/test-env/components/table/table_row.styles.js +3 -3
@@ -106,6 +106,7 @@ export var EuiBetaBadge = function EuiBetaBadge(_ref) {
106
106
  anchorProps: anchorProps
107
107
  }, ___EmotionJSX("span", _extends({
108
108
  tabIndex: 0,
109
+ role: "button",
109
110
  css: cssStyles,
110
111
  className: classes
111
112
  }, rest), icon || label));
@@ -10,11 +10,13 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
10
10
  */
11
11
 
12
12
  import { css, keyframes } from '@emotion/react';
13
- import { logicalCSS, euiCantAnimate } from '../../global_styling';
13
+ import { logicalCSS, euiCantAnimate, highContrastModeStyles, preventForcedColors } from '../../global_styling';
14
14
  var tableLoadingLine = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n from {\n ", "\n ", "\n }\n\n 20% {\n ", "\n ", "\n }\n\n 80% {\n ", "\n ", "\n }\n\n 100% {\n ", "\n ", "\n }\n"])), logicalCSS('left', 0), logicalCSS('width', 0), logicalCSS('left', 0), logicalCSS('width', '40%'), logicalCSS('left', '60%'), logicalCSS('width', '40%'), logicalCSS('left', '100%'), logicalCSS('width', 0));
15
- export var euiBasicTableBodyLoading = function euiBasicTableBodyLoading(_ref) {
16
- var euiTheme = _ref.euiTheme;
17
- return /*#__PURE__*/css("position:relative;overflow:hidden;&::before{position:absolute;content:'';", logicalCSS('width', '100%'), " ", logicalCSS('height', euiTheme.border.width.thick), " background-color:", euiTheme.colors.primary, ";animation:", tableLoadingLine, " 1s linear infinite;", euiCantAnimate, "{animation-duration:2s;}};label:euiBasicTableBodyLoading;");
15
+ export var euiBasicTableBodyLoading = function euiBasicTableBodyLoading(euiThemeContext) {
16
+ var euiTheme = euiThemeContext.euiTheme;
17
+ return /*#__PURE__*/css("position:relative;overflow:hidden;&::before{position:absolute;content:'';", logicalCSS('width', '100%'), " ", logicalCSS('height', euiTheme.border.width.thick), " background-color:", euiTheme.colors.primary, ";animation:", tableLoadingLine, " 1s linear infinite;", euiCantAnimate, "{animation:none;background:repeating-linear-gradient(\n -45deg,\n ", euiTheme.colors.backgroundBasePlain, ",\n ", euiTheme.colors.backgroundBasePlain, " ", euiTheme.size.xs, ",\n ", euiTheme.colors.primary, " ", euiTheme.size.xs, ",\n ", euiTheme.colors.primary, " ", euiTheme.size.s, "\n );", highContrastModeStyles(euiThemeContext, {
18
+ forced: "\n ".concat(preventForcedColors(euiThemeContext), "\n ")
19
+ }), ";}};label:euiBasicTableBodyLoading;");
18
20
  };
19
21
 
20
22
  // Fix to make the loading indicator position correctly in Safari
@@ -50,7 +50,7 @@ export var euiCodeSyntaxVariables = function euiCodeSyntaxVariables(euiThemeCont
50
50
  selectorClassColor: euiTheme.components.codeSelectorClassColor,
51
51
  selectorIdColor: euiTheme.components.codeSelectorIdColor,
52
52
  get tokensCss() {
53
- 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 }");
53
+ 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.key.atrule,\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 }");
54
54
  }
55
55
  };
56
56
  };
@@ -1,4 +1,4 @@
1
- var _excluded = ["type", "size", "color", "className", "tabIndex", "title", "onIconLoad", "style", "stylesMemoizer"];
1
+ var _excluded = ["type", "size", "color", "className", "tabIndex", "title", "role", "onIconLoad", "style", "stylesMemoizer", "aria-hidden", "titleId"];
2
2
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
3
3
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
4
4
  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; }
@@ -183,9 +183,12 @@ export var EuiIconClass = /*#__PURE__*/function (_PureComponent) {
183
183
  className = _this$props.className,
184
184
  tabIndex = _this$props.tabIndex,
185
185
  title = _this$props.title,
186
+ role = _this$props.role,
186
187
  onIconLoad = _this$props.onIconLoad,
187
188
  style = _this$props.style,
188
189
  stylesMemoizer = _this$props.stylesMemoizer,
190
+ ariaHidden = _this$props['aria-hidden'],
191
+ titleId = _this$props.titleId,
189
192
  rest = _objectWithoutProperties(_this$props, _excluded);
190
193
  var _this$state = this.state,
191
194
  isLoading = _this$state.isLoading,
@@ -210,41 +213,55 @@ export var EuiIconClass = /*#__PURE__*/function (_PureComponent) {
210
213
  var styles = stylesMemoizer(euiIconStyles);
211
214
  var cssStyles = [styles.euiIcon, styles[size], color && isNamedColor(color) && styles[color], isCustomColor && styles.customColor, isElasticLogoOutline && styles.logoElasticOutline, isAppIcon && !appIconHasColor && styles.app, isLoading && styles.isLoading, !isLoading && neededLoading && styles.isLoaded];
212
215
  var icon = this.state.icon || empty;
216
+ var isAriaHidden = [true, 'true'].includes(ariaHidden !== null && ariaHidden !== void 0 ? ariaHidden : false);
217
+ var isPresentationOnly = !(title || this.props['aria-label'] || this.props['aria-labelledby']) || ['none', 'presentation'].includes(role !== null && role !== void 0 ? role : '') || isAriaHidden;
218
+ var accessibleTitle = isPresentationOnly ? undefined : title;
219
+
220
+ // implicitly set the ARIA role for the icon only if:
221
+ // - The user did NOT provide a `role` prop
222
+ // - `aria-hidden` is NOT true
223
+ // This ensures user-supplied `role` and `aria-hidden` always take precedence.
224
+ // If set, role is:
225
+ // - 'presentation' for decorative icons
226
+ // - 'img' for meaningful icons
227
+ var accessibleRole = function () {
228
+ if (isAriaHidden) return undefined;
229
+ if (isPresentationOnly) return 'presentation';
230
+ return 'img';
231
+ }();
213
232
  if (typeof icon === 'string') {
214
233
  return ___EmotionJSX("img", _extends({
215
- alt: title ? title : '',
234
+ alt: accessibleTitle,
216
235
  src: icon,
217
236
  className: classes,
218
237
  css: cssStyles,
219
238
  style: style,
220
- tabIndex: tabIndex
239
+ tabIndex: tabIndex,
240
+ role: role !== null && role !== void 0 ? role : accessibleRole,
241
+ "aria-hidden": ariaHidden
221
242
  }, rest));
222
243
  } else {
223
244
  var Svg = icon;
224
245
 
225
- // If there is no aria-label, aria-labelledby, or title it gets aria-hidden true
226
- var isAriaHidden = !(this.props['aria-label'] || this.props['aria-labelledby'] || this.props.title);
227
-
228
246
  // If no aria-label or aria-labelledby is provided but there's a title, a titleId is generated
229
247
  // The svg aria-labelledby attribute gets this titleId
230
248
  // The svg title element gets this titleId as an id
231
- var titleId = !this.props['aria-label'] && !this.props['aria-labelledby'] && title ? {
232
- titleId: generateId()
249
+ var accessibleTitleId = !this.props['aria-label'] && !this.props['aria-labelledby'] && title ? {
250
+ titleId: titleId || generateId()
233
251
  } : undefined;
234
252
  return ___EmotionJSX(Svg, _extends({
235
253
  className: classes,
236
254
  style: optionalCustomStyles,
237
255
  css: cssStyles,
238
256
  tabIndex: tabIndex,
239
- role: "img",
240
- title: title
241
- }, titleId, {
257
+ title: accessibleTitle,
258
+ role: role !== null && role !== void 0 ? role : accessibleRole,
259
+ "aria-hidden": ariaHidden
260
+ }, accessibleTitleId, {
242
261
  "data-icon-type": iconTitle,
243
262
  "data-is-loaded": isLoaded || undefined,
244
263
  "data-is-loading": isLoading || undefined
245
- }, rest, {
246
- "aria-hidden": isAriaHidden || rest['aria-hidden']
247
- }));
264
+ }, rest));
248
265
  }
249
266
  }
250
267
  }]);
@@ -501,7 +501,7 @@ export var typeToPathMap = {
501
501
  vulnerabilityManagementApp: 'app_vulnerability_management',
502
502
  warning: 'warning',
503
503
  warningFilled: 'warning',
504
- // NOTE: To be deprecated in favor of `export`
504
+ // NOTE: To be deprecated in favor of `warning`
505
505
  watchesApp: 'app_watches',
506
506
  web: 'web',
507
507
  wordWrap: 'wordWrap',
@@ -47,7 +47,7 @@ export var euiTableRowStyles = function euiTableRowStyles(euiThemeContext) {
47
47
  * Right column styles + border
48
48
  * Used for cell actions and row expander arrow
49
49
  */
50
- hasRightColumn: /*#__PURE__*/css(logicalCSS('padding-right', mobileSizes.actions.width), " &::after{content:'';position:absolute;", logicalCSS('vertical', 0), " ", logicalCSS('right', mobileSizes.actions.width), " ", logicalCSS('border-right', euiTheme.border.thin), ";};label:hasRightColumn;"),
50
+ hasRightColumn: /*#__PURE__*/css(logicalCSS('padding-right', mobileSizes.actions.width), " &::before{content:'';position:absolute;", logicalCSS('vertical', 0), " ", logicalCSS('right', mobileSizes.actions.width), " ", logicalCSS('border-right', euiTheme.border.thin), ";};label:hasRightColumn;"),
51
51
  /**
52
52
  * Bottom of card - expanded rows
53
53
  */
@@ -55,8 +55,8 @@ export var euiTableRowStyles = function euiTableRowStyles(euiThemeContext) {
55
55
  // On mobile, visually move the expanded row to join up with the
56
56
  // preceding table row via negative margins
57
57
  'margin-top', mathWithUnits([cellContentPadding, euiTheme.border.width.thin], function (x, y) {
58
- return (x + y) * -1;
59
- })), logicalCSS('padding-left', cellContentPadding), " ", logicalCSS('border-top', euiTheme.border.thin), " ", logicalCSS('border-top-left-radius', 0), " ", logicalCSS('border-top-right-radius', 0), ">.euiTableRowCell{", logicalCSS('width', '100%'), ";}", expandedAnimationCss, ";;label:expanded;")
58
+ return (x + y * 2) * -1;
59
+ })), logicalCSS('padding-left', cellContentPadding), " ", logicalCSS('border-top', euiTheme.border.thin), " ", logicalCSS('border-top-left-radius', 0), " ", logicalCSS('border-top-right-radius', 0), " &:after{", logicalCSS('border-top', 'none'), ";}clip-path:polygon(-50% 0, 150% 0, 150% 100vh, -50% 100vh);>.euiTableRowCell{", logicalCSS('width', '100%'), ";}", expandedAnimationCss, ";;label:expanded;")
60
60
  }
61
61
  };
62
62
  };
package/eui.d.ts CHANGED
@@ -25418,7 +25418,7 @@ declare module '@elastic/eui/src/components/basic_table/expanded_item_actions' {
25418
25418
  }
25419
25419
  declare module '@elastic/eui/src/components/basic_table/basic_table.styles' {
25420
25420
  import { UseEuiTheme } from '@elastic/eui/src/services';
25421
- export const euiBasicTableBodyLoading: ({ euiTheme }: UseEuiTheme) => import("@emotion/react").SerializedStyles;
25421
+ export const euiBasicTableBodyLoading: (euiThemeContext: UseEuiTheme) => import("@emotion/react").SerializedStyles;
25422
25422
  export const safariLoadingWorkaround: import("@emotion/react").SerializedStyles;
25423
25423
 
25424
25424
  }
@@ -112,6 +112,7 @@ var EuiBetaBadge = exports.EuiBetaBadge = function EuiBetaBadge(_ref) {
112
112
  anchorProps: anchorProps
113
113
  }, (0, _react2.jsx)("span", _extends({
114
114
  tabIndex: 0,
115
+ role: "button",
115
116
  css: cssStyles,
116
117
  className: classes
117
118
  }, rest), icon || label));
@@ -16,9 +16,11 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
16
16
  * Side Public License, v 1.
17
17
  */
18
18
  var tableLoadingLine = (0, _react.keyframes)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n from {\n ", "\n ", "\n }\n\n 20% {\n ", "\n ", "\n }\n\n 80% {\n ", "\n ", "\n }\n\n 100% {\n ", "\n ", "\n }\n"])), (0, _global_styling.logicalCSS)('left', 0), (0, _global_styling.logicalCSS)('width', 0), (0, _global_styling.logicalCSS)('left', 0), (0, _global_styling.logicalCSS)('width', '40%'), (0, _global_styling.logicalCSS)('left', '60%'), (0, _global_styling.logicalCSS)('width', '40%'), (0, _global_styling.logicalCSS)('left', '100%'), (0, _global_styling.logicalCSS)('width', 0));
19
- var euiBasicTableBodyLoading = exports.euiBasicTableBodyLoading = function euiBasicTableBodyLoading(_ref) {
20
- var euiTheme = _ref.euiTheme;
21
- return /*#__PURE__*/(0, _react.css)("position:relative;overflow:hidden;&::before{position:absolute;content:'';", (0, _global_styling.logicalCSS)('width', '100%'), " ", (0, _global_styling.logicalCSS)('height', euiTheme.border.width.thick), " background-color:", euiTheme.colors.primary, ";animation:", tableLoadingLine, " 1s linear infinite;", _global_styling.euiCantAnimate, "{animation-duration:2s;}};label:euiBasicTableBodyLoading;");
19
+ var euiBasicTableBodyLoading = exports.euiBasicTableBodyLoading = function euiBasicTableBodyLoading(euiThemeContext) {
20
+ var euiTheme = euiThemeContext.euiTheme;
21
+ return /*#__PURE__*/(0, _react.css)("position:relative;overflow:hidden;&::before{position:absolute;content:'';", (0, _global_styling.logicalCSS)('width', '100%'), " ", (0, _global_styling.logicalCSS)('height', euiTheme.border.width.thick), " background-color:", euiTheme.colors.primary, ";animation:", tableLoadingLine, " 1s linear infinite;", _global_styling.euiCantAnimate, "{animation:none;background:repeating-linear-gradient(\n -45deg,\n ", euiTheme.colors.backgroundBasePlain, ",\n ", euiTheme.colors.backgroundBasePlain, " ", euiTheme.size.xs, ",\n ", euiTheme.colors.primary, " ", euiTheme.size.xs, ",\n ", euiTheme.colors.primary, " ", euiTheme.size.s, "\n );", (0, _global_styling.highContrastModeStyles)(euiThemeContext, {
22
+ forced: "\n ".concat((0, _global_styling.preventForcedColors)(euiThemeContext), "\n ")
23
+ }), ";}};label:euiBasicTableBodyLoading;");
22
24
  };
23
25
 
24
26
  // Fix to make the loading indicator position correctly in Safari
@@ -56,7 +56,7 @@ var euiCodeSyntaxVariables = exports.euiCodeSyntaxVariables = function euiCodeSy
56
56
  selectorClassColor: euiTheme.components.codeSelectorClassColor,
57
57
  selectorIdColor: euiTheme.components.codeSelectorIdColor,
58
58
  get tokensCss() {
59
- 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 }");
59
+ 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.key.atrule,\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 }");
60
60
  }
61
61
  };
62
62
  };
@@ -21,7 +21,7 @@ var _services = require("../../services");
21
21
  var _named_colors = require("./named_colors");
22
22
  var _icon = require("./icon.styles");
23
23
  var _react3 = require("@emotion/react");
24
- var _excluded = ["type", "size", "color", "className", "tabIndex", "title", "onIconLoad", "style", "stylesMemoizer"];
24
+ var _excluded = ["type", "size", "color", "className", "tabIndex", "title", "role", "onIconLoad", "style", "stylesMemoizer", "aria-hidden", "titleId"];
25
25
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
26
26
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
27
27
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
@@ -201,9 +201,12 @@ var EuiIconClass = exports.EuiIconClass = /*#__PURE__*/function (_PureComponent)
201
201
  className = _this$props.className,
202
202
  tabIndex = _this$props.tabIndex,
203
203
  title = _this$props.title,
204
+ role = _this$props.role,
204
205
  onIconLoad = _this$props.onIconLoad,
205
206
  style = _this$props.style,
206
207
  stylesMemoizer = _this$props.stylesMemoizer,
208
+ ariaHidden = _this$props['aria-hidden'],
209
+ titleId = _this$props.titleId,
207
210
  rest = _objectWithoutProperties(_this$props, _excluded);
208
211
  var _this$state = this.state,
209
212
  isLoading = _this$state.isLoading,
@@ -228,41 +231,55 @@ var EuiIconClass = exports.EuiIconClass = /*#__PURE__*/function (_PureComponent)
228
231
  var styles = stylesMemoizer(_icon.euiIconStyles);
229
232
  var cssStyles = [styles.euiIcon, styles[size], color && (0, _named_colors.isNamedColor)(color) && styles[color], isCustomColor && styles.customColor, isElasticLogoOutline && styles.logoElasticOutline, isAppIcon && !appIconHasColor && styles.app, isLoading && styles.isLoading, !isLoading && neededLoading && styles.isLoaded];
230
233
  var icon = this.state.icon || _empty.icon;
234
+ var isAriaHidden = [true, 'true'].includes(ariaHidden !== null && ariaHidden !== void 0 ? ariaHidden : false);
235
+ var isPresentationOnly = !(title || this.props['aria-label'] || this.props['aria-labelledby']) || ['none', 'presentation'].includes(role !== null && role !== void 0 ? role : '') || isAriaHidden;
236
+ var accessibleTitle = isPresentationOnly ? undefined : title;
237
+
238
+ // implicitly set the ARIA role for the icon only if:
239
+ // - The user did NOT provide a `role` prop
240
+ // - `aria-hidden` is NOT true
241
+ // This ensures user-supplied `role` and `aria-hidden` always take precedence.
242
+ // If set, role is:
243
+ // - 'presentation' for decorative icons
244
+ // - 'img' for meaningful icons
245
+ var accessibleRole = function () {
246
+ if (isAriaHidden) return undefined;
247
+ if (isPresentationOnly) return 'presentation';
248
+ return 'img';
249
+ }();
231
250
  if (typeof icon === 'string') {
232
251
  return (0, _react3.jsx)("img", _extends({
233
- alt: title ? title : '',
252
+ alt: accessibleTitle,
234
253
  src: icon,
235
254
  className: classes,
236
255
  css: cssStyles,
237
256
  style: style,
238
- tabIndex: tabIndex
257
+ tabIndex: tabIndex,
258
+ role: role !== null && role !== void 0 ? role : accessibleRole,
259
+ "aria-hidden": ariaHidden
239
260
  }, rest));
240
261
  } else {
241
262
  var Svg = icon;
242
263
 
243
- // If there is no aria-label, aria-labelledby, or title it gets aria-hidden true
244
- var isAriaHidden = !(this.props['aria-label'] || this.props['aria-labelledby'] || this.props.title);
245
-
246
264
  // If no aria-label or aria-labelledby is provided but there's a title, a titleId is generated
247
265
  // The svg aria-labelledby attribute gets this titleId
248
266
  // The svg title element gets this titleId as an id
249
- var titleId = !this.props['aria-label'] && !this.props['aria-labelledby'] && title ? {
250
- titleId: generateId()
267
+ var accessibleTitleId = !this.props['aria-label'] && !this.props['aria-labelledby'] && title ? {
268
+ titleId: titleId || generateId()
251
269
  } : undefined;
252
270
  return (0, _react3.jsx)(Svg, _extends({
253
271
  className: classes,
254
272
  style: optionalCustomStyles,
255
273
  css: cssStyles,
256
274
  tabIndex: tabIndex,
257
- role: "img",
258
- title: title
259
- }, titleId, {
275
+ title: accessibleTitle,
276
+ role: role !== null && role !== void 0 ? role : accessibleRole,
277
+ "aria-hidden": ariaHidden
278
+ }, accessibleTitleId, {
260
279
  "data-icon-type": iconTitle,
261
280
  "data-is-loaded": isLoaded || undefined,
262
281
  "data-is-loading": isLoading || undefined
263
- }, rest, {
264
- "aria-hidden": isAriaHidden || rest['aria-hidden']
265
- }));
282
+ }, rest));
266
283
  }
267
284
  }
268
285
  }]);
@@ -507,7 +507,7 @@ var typeToPathMap = exports.typeToPathMap = {
507
507
  vulnerabilityManagementApp: 'app_vulnerability_management',
508
508
  warning: 'warning',
509
509
  warningFilled: 'warning',
510
- // NOTE: To be deprecated in favor of `export`
510
+ // NOTE: To be deprecated in favor of `warning`
511
511
  watchesApp: 'app_watches',
512
512
  web: 'web',
513
513
  wordWrap: 'wordWrap',
@@ -52,7 +52,7 @@ var euiTableRowStyles = exports.euiTableRowStyles = function euiTableRowStyles(e
52
52
  * Right column styles + border
53
53
  * Used for cell actions and row expander arrow
54
54
  */
55
- hasRightColumn: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('padding-right', mobileSizes.actions.width), " &::after{content:'';position:absolute;", (0, _global_styling.logicalCSS)('vertical', 0), " ", (0, _global_styling.logicalCSS)('right', mobileSizes.actions.width), " ", (0, _global_styling.logicalCSS)('border-right', euiTheme.border.thin), ";};label:hasRightColumn;"),
55
+ hasRightColumn: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('padding-right', mobileSizes.actions.width), " &::before{content:'';position:absolute;", (0, _global_styling.logicalCSS)('vertical', 0), " ", (0, _global_styling.logicalCSS)('right', mobileSizes.actions.width), " ", (0, _global_styling.logicalCSS)('border-right', euiTheme.border.thin), ";};label:hasRightColumn;"),
56
56
  /**
57
57
  * Bottom of card - expanded rows
58
58
  */
@@ -60,8 +60,8 @@ var euiTableRowStyles = exports.euiTableRowStyles = function euiTableRowStyles(e
60
60
  // On mobile, visually move the expanded row to join up with the
61
61
  // preceding table row via negative margins
62
62
  'margin-top', (0, _global_styling.mathWithUnits)([cellContentPadding, euiTheme.border.width.thin], function (x, y) {
63
- return (x + y) * -1;
64
- })), (0, _global_styling.logicalCSS)('padding-left', cellContentPadding), " ", (0, _global_styling.logicalCSS)('border-top', euiTheme.border.thin), " ", (0, _global_styling.logicalCSS)('border-top-left-radius', 0), " ", (0, _global_styling.logicalCSS)('border-top-right-radius', 0), ">.euiTableRowCell{", (0, _global_styling.logicalCSS)('width', '100%'), ";}", expandedAnimationCss, ";;label:expanded;")
63
+ return (x + y * 2) * -1;
64
+ })), (0, _global_styling.logicalCSS)('padding-left', cellContentPadding), " ", (0, _global_styling.logicalCSS)('border-top', euiTheme.border.thin), " ", (0, _global_styling.logicalCSS)('border-top-left-radius', 0), " ", (0, _global_styling.logicalCSS)('border-top-right-radius', 0), " &:after{", (0, _global_styling.logicalCSS)('border-top', 'none'), ";}clip-path:polygon(-50% 0, 150% 0, 150% 100vh, -50% 100vh);>.euiTableRowCell{", (0, _global_styling.logicalCSS)('width', '100%'), ";}", expandedAnimationCss, ";;label:expanded;")
65
65
  }
66
66
  };
67
67
  };
@@ -104,6 +104,7 @@ export var EuiBetaBadge = function EuiBetaBadge(_ref) {
104
104
  anchorProps: anchorProps
105
105
  }, ___EmotionJSX("span", _extends({
106
106
  tabIndex: 0,
107
+ role: "button",
107
108
  css: cssStyles,
108
109
  className: classes
109
110
  }, rest), icon || label));
@@ -10,11 +10,13 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
10
10
  */
11
11
 
12
12
  import { css, keyframes } from '@emotion/react';
13
- import { logicalCSS, euiCantAnimate } from '../../global_styling';
13
+ import { logicalCSS, euiCantAnimate, highContrastModeStyles, preventForcedColors } from '../../global_styling';
14
14
  var tableLoadingLine = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n from {\n ", "\n ", "\n }\n\n 20% {\n ", "\n ", "\n }\n\n 80% {\n ", "\n ", "\n }\n\n 100% {\n ", "\n ", "\n }\n"])), logicalCSS('left', 0), logicalCSS('width', 0), logicalCSS('left', 0), logicalCSS('width', '40%'), logicalCSS('left', '60%'), logicalCSS('width', '40%'), logicalCSS('left', '100%'), logicalCSS('width', 0));
15
- export var euiBasicTableBodyLoading = function euiBasicTableBodyLoading(_ref) {
16
- var euiTheme = _ref.euiTheme;
17
- return /*#__PURE__*/css("position:relative;overflow:hidden;&::before{position:absolute;content:'';", logicalCSS('width', '100%'), " ", logicalCSS('height', euiTheme.border.width.thick), " background-color:", euiTheme.colors.primary, ";animation:", tableLoadingLine, " 1s linear infinite;", euiCantAnimate, "{animation-duration:2s;}};label:euiBasicTableBodyLoading;");
15
+ export var euiBasicTableBodyLoading = function euiBasicTableBodyLoading(euiThemeContext) {
16
+ var euiTheme = euiThemeContext.euiTheme;
17
+ return /*#__PURE__*/css("position:relative;overflow:hidden;&::before{position:absolute;content:'';", logicalCSS('width', '100%'), " ", logicalCSS('height', euiTheme.border.width.thick), " background-color:", euiTheme.colors.primary, ";animation:", tableLoadingLine, " 1s linear infinite;", euiCantAnimate, "{animation:none;background:repeating-linear-gradient(\n -45deg,\n ", euiTheme.colors.backgroundBasePlain, ",\n ", euiTheme.colors.backgroundBasePlain, " ", euiTheme.size.xs, ",\n ", euiTheme.colors.primary, " ", euiTheme.size.xs, ",\n ", euiTheme.colors.primary, " ", euiTheme.size.s, "\n );", highContrastModeStyles(euiThemeContext, {
18
+ forced: "\n ".concat(preventForcedColors(euiThemeContext), "\n ")
19
+ }), ";}};label:euiBasicTableBodyLoading;");
18
20
  };
19
21
 
20
22
  // Fix to make the loading indicator position correctly in Safari
@@ -50,7 +50,7 @@ export var euiCodeSyntaxVariables = function euiCodeSyntaxVariables(euiThemeCont
50
50
  selectorClassColor: euiTheme.components.codeSelectorClassColor,
51
51
  selectorIdColor: euiTheme.components.codeSelectorIdColor,
52
52
  get tokensCss() {
53
- 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 }");
53
+ 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.key.atrule,\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 }");
54
54
  }
55
55
  };
56
56
  };
@@ -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 = ["type", "size", "color", "className", "tabIndex", "title", "onIconLoad", "style", "stylesMemoizer"];
9
+ var _excluded = ["type", "size", "color", "className", "tabIndex", "title", "role", "onIconLoad", "style", "stylesMemoizer", "aria-hidden", "titleId"];
10
10
  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; }
11
11
  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; }
12
12
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
@@ -175,9 +175,12 @@ export var EuiIconClass = /*#__PURE__*/function (_PureComponent) {
175
175
  className = _this$props.className,
176
176
  tabIndex = _this$props.tabIndex,
177
177
  title = _this$props.title,
178
+ role = _this$props.role,
178
179
  onIconLoad = _this$props.onIconLoad,
179
180
  style = _this$props.style,
180
181
  stylesMemoizer = _this$props.stylesMemoizer,
182
+ ariaHidden = _this$props['aria-hidden'],
183
+ titleId = _this$props.titleId,
181
184
  rest = _objectWithoutProperties(_this$props, _excluded);
182
185
  var _this$state = this.state,
183
186
  isLoading = _this$state.isLoading,
@@ -202,41 +205,55 @@ export var EuiIconClass = /*#__PURE__*/function (_PureComponent) {
202
205
  var styles = stylesMemoizer(euiIconStyles);
203
206
  var cssStyles = [styles.euiIcon, styles[size], color && isNamedColor(color) && styles[color], isCustomColor && styles.customColor, isElasticLogoOutline && styles.logoElasticOutline, isAppIcon && !appIconHasColor && styles.app, isLoading && styles.isLoading, !isLoading && neededLoading && styles.isLoaded];
204
207
  var icon = this.state.icon || empty;
208
+ var isAriaHidden = [true, 'true'].includes(ariaHidden !== null && ariaHidden !== void 0 ? ariaHidden : false);
209
+ var isPresentationOnly = !(title || this.props['aria-label'] || this.props['aria-labelledby']) || ['none', 'presentation'].includes(role !== null && role !== void 0 ? role : '') || isAriaHidden;
210
+ var accessibleTitle = isPresentationOnly ? undefined : title;
211
+
212
+ // implicitly set the ARIA role for the icon only if:
213
+ // - The user did NOT provide a `role` prop
214
+ // - `aria-hidden` is NOT true
215
+ // This ensures user-supplied `role` and `aria-hidden` always take precedence.
216
+ // If set, role is:
217
+ // - 'presentation' for decorative icons
218
+ // - 'img' for meaningful icons
219
+ var accessibleRole = function () {
220
+ if (isAriaHidden) return undefined;
221
+ if (isPresentationOnly) return 'presentation';
222
+ return 'img';
223
+ }();
205
224
  if (typeof icon === 'string') {
206
225
  return ___EmotionJSX("img", _extends({
207
- alt: title ? title : '',
226
+ alt: accessibleTitle,
208
227
  src: icon,
209
228
  className: classes,
210
229
  css: cssStyles,
211
230
  style: style,
212
- tabIndex: tabIndex
231
+ tabIndex: tabIndex,
232
+ role: role !== null && role !== void 0 ? role : accessibleRole,
233
+ "aria-hidden": ariaHidden
213
234
  }, rest));
214
235
  } else {
215
236
  var Svg = icon;
216
237
 
217
- // If there is no aria-label, aria-labelledby, or title it gets aria-hidden true
218
- var isAriaHidden = !(this.props['aria-label'] || this.props['aria-labelledby'] || this.props.title);
219
-
220
238
  // If no aria-label or aria-labelledby is provided but there's a title, a titleId is generated
221
239
  // The svg aria-labelledby attribute gets this titleId
222
240
  // The svg title element gets this titleId as an id
223
- var titleId = !this.props['aria-label'] && !this.props['aria-labelledby'] && title ? {
224
- titleId: generateId()
241
+ var accessibleTitleId = !this.props['aria-label'] && !this.props['aria-labelledby'] && title ? {
242
+ titleId: titleId || generateId()
225
243
  } : undefined;
226
244
  return ___EmotionJSX(Svg, _extends({
227
245
  className: classes,
228
246
  style: optionalCustomStyles,
229
247
  css: cssStyles,
230
248
  tabIndex: tabIndex,
231
- role: "img",
232
- title: title
233
- }, titleId, {
249
+ title: accessibleTitle,
250
+ role: role !== null && role !== void 0 ? role : accessibleRole,
251
+ "aria-hidden": ariaHidden
252
+ }, accessibleTitleId, {
234
253
  "data-icon-type": iconTitle,
235
254
  "data-is-loaded": isLoaded || undefined,
236
255
  "data-is-loading": isLoading || undefined
237
- }, rest, {
238
- "aria-hidden": isAriaHidden || rest['aria-hidden']
239
- }));
256
+ }, rest));
240
257
  }
241
258
  }
242
259
  }]);
@@ -501,7 +501,7 @@ export var typeToPathMap = {
501
501
  vulnerabilityManagementApp: 'app_vulnerability_management',
502
502
  warning: 'warning',
503
503
  warningFilled: 'warning',
504
- // NOTE: To be deprecated in favor of `export`
504
+ // NOTE: To be deprecated in favor of `warning`
505
505
  watchesApp: 'app_watches',
506
506
  web: 'web',
507
507
  wordWrap: 'wordWrap',
@@ -47,7 +47,7 @@ export var euiTableRowStyles = function euiTableRowStyles(euiThemeContext) {
47
47
  * Right column styles + border
48
48
  * Used for cell actions and row expander arrow
49
49
  */
50
- hasRightColumn: /*#__PURE__*/css(logicalCSS('padding-right', mobileSizes.actions.width), " &::after{content:'';position:absolute;", logicalCSS('vertical', 0), " ", logicalCSS('right', mobileSizes.actions.width), " ", logicalCSS('border-right', euiTheme.border.thin), ";};label:hasRightColumn;"),
50
+ hasRightColumn: /*#__PURE__*/css(logicalCSS('padding-right', mobileSizes.actions.width), " &::before{content:'';position:absolute;", logicalCSS('vertical', 0), " ", logicalCSS('right', mobileSizes.actions.width), " ", logicalCSS('border-right', euiTheme.border.thin), ";};label:hasRightColumn;"),
51
51
  /**
52
52
  * Bottom of card - expanded rows
53
53
  */
@@ -55,8 +55,8 @@ export var euiTableRowStyles = function euiTableRowStyles(euiThemeContext) {
55
55
  // On mobile, visually move the expanded row to join up with the
56
56
  // preceding table row via negative margins
57
57
  'margin-top', mathWithUnits([cellContentPadding, euiTheme.border.width.thin], function (x, y) {
58
- return (x + y) * -1;
59
- })), logicalCSS('padding-left', cellContentPadding), " ", logicalCSS('border-top', euiTheme.border.thin), " ", logicalCSS('border-top-left-radius', 0), " ", logicalCSS('border-top-right-radius', 0), ">.euiTableRowCell{", logicalCSS('width', '100%'), ";}", expandedAnimationCss, ";;label:expanded;")
58
+ return (x + y * 2) * -1;
59
+ })), logicalCSS('padding-left', cellContentPadding), " ", logicalCSS('border-top', euiTheme.border.thin), " ", logicalCSS('border-top-left-radius', 0), " ", logicalCSS('border-top-right-radius', 0), " &:after{", logicalCSS('border-top', 'none'), ";}clip-path:polygon(-50% 0, 150% 0, 150% 100vh, -50% 100vh);>.euiTableRowCell{", logicalCSS('width', '100%'), ";}", expandedAnimationCss, ";;label:expanded;")
60
60
  }
61
61
  };
62
62
  };
@@ -110,6 +110,7 @@ var EuiBetaBadge = exports.EuiBetaBadge = function EuiBetaBadge(_ref) {
110
110
  anchorProps: anchorProps
111
111
  }, (0, _react2.jsx)("span", (0, _extends2.default)({
112
112
  tabIndex: 0,
113
+ role: "button",
113
114
  css: cssStyles,
114
115
  className: classes
115
116
  }, rest), icon || label));
@@ -17,9 +17,11 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
17
17
  * Side Public License, v 1.
18
18
  */
19
19
  var tableLoadingLine = (0, _react.keyframes)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n from {\n ", "\n ", "\n }\n\n 20% {\n ", "\n ", "\n }\n\n 80% {\n ", "\n ", "\n }\n\n 100% {\n ", "\n ", "\n }\n"])), (0, _global_styling.logicalCSS)('left', 0), (0, _global_styling.logicalCSS)('width', 0), (0, _global_styling.logicalCSS)('left', 0), (0, _global_styling.logicalCSS)('width', '40%'), (0, _global_styling.logicalCSS)('left', '60%'), (0, _global_styling.logicalCSS)('width', '40%'), (0, _global_styling.logicalCSS)('left', '100%'), (0, _global_styling.logicalCSS)('width', 0));
20
- var euiBasicTableBodyLoading = exports.euiBasicTableBodyLoading = function euiBasicTableBodyLoading(_ref) {
21
- var euiTheme = _ref.euiTheme;
22
- return /*#__PURE__*/(0, _react.css)("position:relative;overflow:hidden;&::before{position:absolute;content:'';", (0, _global_styling.logicalCSS)('width', '100%'), " ", (0, _global_styling.logicalCSS)('height', euiTheme.border.width.thick), " background-color:", euiTheme.colors.primary, ";animation:", tableLoadingLine, " 1s linear infinite;", _global_styling.euiCantAnimate, "{animation-duration:2s;}};label:euiBasicTableBodyLoading;");
20
+ var euiBasicTableBodyLoading = exports.euiBasicTableBodyLoading = function euiBasicTableBodyLoading(euiThemeContext) {
21
+ var euiTheme = euiThemeContext.euiTheme;
22
+ return /*#__PURE__*/(0, _react.css)("position:relative;overflow:hidden;&::before{position:absolute;content:'';", (0, _global_styling.logicalCSS)('width', '100%'), " ", (0, _global_styling.logicalCSS)('height', euiTheme.border.width.thick), " background-color:", euiTheme.colors.primary, ";animation:", tableLoadingLine, " 1s linear infinite;", _global_styling.euiCantAnimate, "{animation:none;background:repeating-linear-gradient(\n -45deg,\n ", euiTheme.colors.backgroundBasePlain, ",\n ", euiTheme.colors.backgroundBasePlain, " ", euiTheme.size.xs, ",\n ", euiTheme.colors.primary, " ", euiTheme.size.xs, ",\n ", euiTheme.colors.primary, " ", euiTheme.size.s, "\n );", (0, _global_styling.highContrastModeStyles)(euiThemeContext, {
23
+ forced: "\n ".concat((0, _global_styling.preventForcedColors)(euiThemeContext), "\n ")
24
+ }), ";}};label:euiBasicTableBodyLoading;");
23
25
  };
24
26
 
25
27
  // Fix to make the loading indicator position correctly in Safari
@@ -56,7 +56,7 @@ var euiCodeSyntaxVariables = exports.euiCodeSyntaxVariables = function euiCodeSy
56
56
  selectorClassColor: euiTheme.components.codeSelectorClassColor,
57
57
  selectorIdColor: euiTheme.components.codeSelectorIdColor,
58
58
  get tokensCss() {
59
- 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 }");
59
+ 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.key.atrule,\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 }");
60
60
  }
61
61
  };
62
62
  };