@elastic/eui 67.0.0 → 67.1.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 (141) hide show
  1. package/dist/eui_theme_dark.css +0 -98
  2. package/dist/eui_theme_dark.min.css +1 -1
  3. package/dist/eui_theme_light.css +0 -98
  4. package/dist/eui_theme_light.min.css +1 -1
  5. package/es/components/badge/badge.js +84 -78
  6. package/es/components/badge/badge.styles.js +56 -0
  7. package/es/components/basic_table/in_memory_table.js +8 -0
  8. package/es/components/button/button.js +0 -1
  9. package/es/components/button/button_display/_button_display.js +10 -5
  10. package/es/components/button/button_display/_button_display.styles.js +2 -2
  11. package/es/components/button/button_display/_button_display_content.js +5 -3
  12. package/es/components/button/button_display/_button_display_content.styles.js +4 -1
  13. package/es/components/card/card.js +2 -2
  14. package/es/components/card/card.styles.js +5 -2
  15. package/es/components/notification/notification_event.js +1 -1
  16. package/es/components/notification/notification_event_meta.js +1 -1
  17. package/es/components/popover/popover_title.js +2 -2
  18. package/es/components/popover/popover_title.styles.js +18 -6
  19. package/es/components/search_bar/filters/custom_component_filter.js +16 -0
  20. package/es/components/search_bar/filters/filters.js +6 -0
  21. package/es/components/search_bar/query/ast.js +12 -0
  22. package/es/components/search_bar/query/ast_to_es_query_dsl.js +15 -10
  23. package/es/components/search_bar/query/query.js +17 -0
  24. package/es/components/search_bar/search_bar.js +4 -0
  25. package/es/components/search_bar/search_filters.js +4 -0
  26. package/es/components/selectable/selectable_list/selectable_list.js +2 -2
  27. package/es/components/selectable/selectable_list/selectable_list_item.js +2 -2
  28. package/es/services/color/contrast.js +2 -0
  29. package/es/services/index.js +1 -1
  30. package/es/services/theme/context.js +2 -1
  31. package/es/services/theme/hooks.js +27 -1
  32. package/es/services/theme/index.js +1 -1
  33. package/es/services/theme/provider.js +15 -1
  34. package/eui.d.ts +104 -28
  35. package/lib/components/badge/badge.js +92 -80
  36. package/lib/components/badge/badge.styles.js +61 -0
  37. package/lib/components/basic_table/in_memory_table.js +8 -0
  38. package/lib/components/button/button.js +0 -1
  39. package/lib/components/button/button_display/_button_display.js +10 -5
  40. package/lib/components/button/button_display/_button_display.styles.js +2 -2
  41. package/lib/components/button/button_display/_button_display_content.js +9 -4
  42. package/lib/components/button/button_display/_button_display_content.styles.js +4 -1
  43. package/lib/components/card/card.js +2 -2
  44. package/lib/components/card/card.styles.js +5 -2
  45. package/lib/components/notification/notification_event.js +1 -1
  46. package/lib/components/notification/notification_event_meta.js +1 -1
  47. package/lib/components/popover/popover_title.js +2 -2
  48. package/lib/components/popover/popover_title.styles.js +19 -7
  49. package/lib/components/search_bar/filters/custom_component_filter.js +29 -0
  50. package/lib/components/search_bar/filters/filters.js +7 -0
  51. package/lib/components/search_bar/query/ast.js +12 -0
  52. package/lib/components/search_bar/query/ast_to_es_query_dsl.js +16 -11
  53. package/lib/components/search_bar/query/query.js +17 -0
  54. package/lib/components/search_bar/search_bar.js +4 -0
  55. package/lib/components/search_bar/search_filters.js +4 -0
  56. package/lib/components/selectable/selectable_list/selectable_list.js +2 -2
  57. package/lib/components/selectable/selectable_list/selectable_list_item.js +2 -2
  58. package/lib/services/color/contrast.js +6 -1
  59. package/lib/services/index.js +7 -0
  60. package/lib/services/theme/context.js +4 -2
  61. package/lib/services/theme/hooks.js +28 -0
  62. package/lib/services/theme/index.js +12 -0
  63. package/lib/services/theme/provider.js +23 -2
  64. package/optimize/es/components/badge/badge.js +82 -76
  65. package/optimize/es/components/badge/badge.styles.js +56 -0
  66. package/optimize/es/components/basic_table/in_memory_table.js +4 -0
  67. package/optimize/es/components/button/button.js +0 -1
  68. package/optimize/es/components/button/button_display/_button_display.js +8 -3
  69. package/optimize/es/components/button/button_display/_button_display.styles.js +2 -2
  70. package/optimize/es/components/button/button_display/_button_display_content.js +3 -1
  71. package/optimize/es/components/button/button_display/_button_display_content.styles.js +4 -1
  72. package/optimize/es/components/card/card.js +2 -2
  73. package/optimize/es/components/card/card.styles.js +5 -2
  74. package/optimize/es/components/popover/popover_title.js +2 -2
  75. package/optimize/es/components/popover/popover_title.styles.js +18 -6
  76. package/optimize/es/components/search_bar/filters/custom_component_filter.js +16 -0
  77. package/optimize/es/components/search_bar/filters/filters.js +6 -0
  78. package/optimize/es/components/search_bar/query/ast.js +12 -0
  79. package/optimize/es/components/search_bar/query/ast_to_es_query_dsl.js +14 -9
  80. package/optimize/es/components/search_bar/query/query.js +17 -0
  81. package/optimize/es/services/color/contrast.js +2 -0
  82. package/optimize/es/services/index.js +1 -1
  83. package/optimize/es/services/theme/context.js +2 -1
  84. package/optimize/es/services/theme/hooks.js +27 -1
  85. package/optimize/es/services/theme/index.js +1 -1
  86. package/optimize/es/services/theme/provider.js +14 -1
  87. package/optimize/lib/components/badge/badge.js +90 -78
  88. package/optimize/lib/components/badge/badge.styles.js +61 -0
  89. package/optimize/lib/components/basic_table/in_memory_table.js +4 -0
  90. package/optimize/lib/components/button/button.js +0 -1
  91. package/optimize/lib/components/button/button_display/_button_display.js +8 -3
  92. package/optimize/lib/components/button/button_display/_button_display.styles.js +2 -2
  93. package/optimize/lib/components/button/button_display/_button_display_content.js +6 -2
  94. package/optimize/lib/components/button/button_display/_button_display_content.styles.js +4 -1
  95. package/optimize/lib/components/card/card.js +2 -2
  96. package/optimize/lib/components/card/card.styles.js +5 -2
  97. package/optimize/lib/components/popover/popover_title.js +2 -2
  98. package/optimize/lib/components/popover/popover_title.styles.js +19 -7
  99. package/optimize/lib/components/search_bar/filters/custom_component_filter.js +29 -0
  100. package/optimize/lib/components/search_bar/filters/filters.js +7 -0
  101. package/optimize/lib/components/search_bar/query/ast.js +12 -0
  102. package/optimize/lib/components/search_bar/query/ast_to_es_query_dsl.js +16 -11
  103. package/optimize/lib/components/search_bar/query/query.js +17 -0
  104. package/optimize/lib/services/color/contrast.js +5 -1
  105. package/optimize/lib/services/index.js +7 -0
  106. package/optimize/lib/services/theme/context.js +4 -2
  107. package/optimize/lib/services/theme/hooks.js +28 -0
  108. package/optimize/lib/services/theme/index.js +12 -0
  109. package/optimize/lib/services/theme/provider.js +23 -9
  110. package/package.json +5 -5
  111. package/src/components/badge/_index.scss +0 -1
  112. package/test-env/components/badge/badge.js +92 -80
  113. package/test-env/components/badge/badge.styles.js +61 -0
  114. package/test-env/components/basic_table/in_memory_table.js +8 -0
  115. package/test-env/components/button/button.js +0 -1
  116. package/test-env/components/button/button_display/_button_display.js +10 -5
  117. package/test-env/components/button/button_display/_button_display.styles.js +2 -2
  118. package/test-env/components/button/button_display/_button_display_content.js +8 -4
  119. package/test-env/components/button/button_display/_button_display_content.styles.js +4 -1
  120. package/test-env/components/card/card.js +2 -2
  121. package/test-env/components/card/card.styles.js +5 -2
  122. package/test-env/components/notification/notification_event.js +1 -1
  123. package/test-env/components/notification/notification_event_meta.js +1 -1
  124. package/test-env/components/popover/popover_title.js +2 -2
  125. package/test-env/components/popover/popover_title.styles.js +19 -7
  126. package/test-env/components/search_bar/filters/custom_component_filter.js +29 -0
  127. package/test-env/components/search_bar/filters/filters.js +7 -0
  128. package/test-env/components/search_bar/query/ast.js +12 -0
  129. package/test-env/components/search_bar/query/ast_to_es_query_dsl.js +16 -11
  130. package/test-env/components/search_bar/query/query.js +17 -0
  131. package/test-env/components/search_bar/search_bar.js +4 -0
  132. package/test-env/components/search_bar/search_filters.js +4 -0
  133. package/test-env/components/selectable/selectable_list/selectable_list.js +2 -2
  134. package/test-env/components/selectable/selectable_list/selectable_list_item.js +2 -2
  135. package/test-env/services/color/contrast.js +5 -1
  136. package/test-env/services/index.js +7 -0
  137. package/test-env/services/theme/context.js +4 -2
  138. package/test-env/services/theme/hooks.js +28 -0
  139. package/test-env/services/theme/index.js +12 -0
  140. package/test-env/services/theme/provider.js +23 -9
  141. package/src/components/badge/_badge.scss +0 -133
@@ -40,6 +40,11 @@ export var Query = /*#__PURE__*/function () {
40
40
  }
41
41
 
42
42
  _createClass(Query, [{
43
+ key: "hasClauses",
44
+ value: function hasClauses() {
45
+ return this.ast.clauses.length > 0;
46
+ }
47
+ }, {
43
48
  key: "hasSimpleFieldClause",
44
49
  value: function hasSimpleFieldClause(field, value) {
45
50
  return this.ast.hasSimpleFieldClause(field, value);
@@ -99,6 +104,12 @@ export var Query = /*#__PURE__*/function () {
99
104
  var ast = this.ast.removeOrFieldClauses(field);
100
105
  return new Query(ast, this.syntax);
101
106
  }
107
+ }, {
108
+ key: "removeAllClauses",
109
+ value: function removeAllClauses() {
110
+ var ast = this.ast.removeAllClauses();
111
+ return new Query(ast, this.syntax);
112
+ }
102
113
  }, {
103
114
  key: "hasIsClause",
104
115
  value: function hasIsClause(flag) {
@@ -127,6 +138,12 @@ export var Query = /*#__PURE__*/function () {
127
138
  var ast = this.ast.removeIsClause(flag);
128
139
  return new Query(ast, this.syntax);
129
140
  }
141
+ }, {
142
+ key: "removeIsClauses",
143
+ value: function removeIsClauses() {
144
+ var ast = this.ast.removeIsClauses();
145
+ return new Query(ast, this.syntax);
146
+ }
130
147
  /**
131
148
  * Executes this query over the given iterable item and returns
132
149
  * an new array of all items that matched this query. Options:
@@ -10,6 +10,8 @@ import _typeof from "@babel/runtime/helpers/typeof";
10
10
  import chroma from 'chroma-js';
11
11
  import { shade, tint, lightness as getLightness } from './manipulation';
12
12
  import { getOn } from '../theme/utils';
13
+ export var wcagContrastMin = 4.5; // WCAG AA minimum contrast ratio for normal (non-large) text
14
+
13
15
  /**
14
16
  * Creates a new color that meets or exceeds WCAG level AA
15
17
  * @param foreground - Color to manipulate
@@ -11,7 +11,7 @@ export { keys };
11
11
  export { accessibleClickKeys, cascadingMenuKeys, comboBoxKeys, htmlIdGenerator, useGeneratedHtmlId } from './accessibility';
12
12
  export { LEFT_ALIGNMENT, RIGHT_ALIGNMENT, CENTER_ALIGNMENT } from './alignment';
13
13
  export { useIsWithinBreakpoints, useIsWithinMaxBreakpoint, useIsWithinMinBreakpoint, CurrentEuiBreakpointContext, CurrentEuiBreakpointProvider, useCurrentEuiBreakpoint } from './breakpoint';
14
- export { isColorDark, isValidHex, calculateContrast, calculateLuminance, hexToHsv, hexToRgb, hsvToHex, hsvToRgb, rgbToHex, rgbToHsv, VISUALIZATION_COLORS, DEFAULT_VISUALIZATION_COLOR, colorPalette, euiPaletteForLightBackground, euiPaletteForDarkBackground, euiPaletteColorBlind, euiPaletteColorBlindBehindText, euiPaletteForStatus, euiPaletteForTemperature, euiPaletteComplimentary, euiPaletteNegative, euiPalettePositive, euiPaletteCool, euiPaletteWarm, euiPaletteGray, getSteppedGradient, transparentize, tint, shade, tintOrShade, shadeOrTint, saturate, desaturate, lightness, makeHighContrastColor, makeDisabledContrastColor } from './color';
14
+ export { isColorDark, isValidHex, calculateContrast, calculateLuminance, hexToHsv, hexToRgb, hsvToHex, hsvToRgb, rgbToHex, rgbToHsv, VISUALIZATION_COLORS, DEFAULT_VISUALIZATION_COLOR, colorPalette, euiPaletteForLightBackground, euiPaletteForDarkBackground, euiPaletteColorBlind, euiPaletteColorBlindBehindText, euiPaletteForStatus, euiPaletteForTemperature, euiPaletteComplimentary, euiPaletteNegative, euiPalettePositive, euiPaletteCool, euiPaletteWarm, euiPaletteGray, getSteppedGradient, transparentize, tint, shade, tintOrShade, shadeOrTint, saturate, desaturate, lightness, makeHighContrastColor, makeDisabledContrastColor, wcagContrastMin } from './color';
15
15
  export { useColorPickerState, useColorStopsState } from './color_picker';
16
16
  export * from './console';
17
17
  export { copyToClipboard } from './copy_to_clipboard';
@@ -11,4 +11,5 @@ import { DEFAULT_COLOR_MODE, getComputed } from './utils';
11
11
  export var EuiSystemContext = /*#__PURE__*/createContext(EuiThemeAmsterdam);
12
12
  export var EuiModificationsContext = /*#__PURE__*/createContext({});
13
13
  export var EuiColorModeContext = /*#__PURE__*/createContext(DEFAULT_COLOR_MODE);
14
- export var EuiThemeContext = /*#__PURE__*/createContext(getComputed(EuiThemeAmsterdam, {}, DEFAULT_COLOR_MODE));
14
+ export var defaultComputedTheme = getComputed(EuiThemeAmsterdam, {}, DEFAULT_COLOR_MODE);
15
+ export var EuiThemeContext = /*#__PURE__*/createContext(defaultComputedTheme);
@@ -8,12 +8,38 @@ import _extends from "@babel/runtime/helpers/extends";
8
8
  * Side Public License, v 1.
9
9
  */
10
10
  import React, { forwardRef, useContext, useMemo } from 'react';
11
- import { EuiThemeContext, EuiModificationsContext, EuiColorModeContext } from './context';
11
+ import { EuiThemeContext, EuiModificationsContext, EuiColorModeContext, defaultComputedTheme } from './context';
12
+ import { getEuiDevProviderWarning } from './provider';
12
13
  import { jsx as ___EmotionJSX } from "@emotion/react";
14
+ var providerMessage = "`EuiProvider` is missing which can result in negative effects.\nWrap your component in `EuiProvider`: https://ela.st/euiprovider.";
13
15
  export var useEuiTheme = function useEuiTheme() {
14
16
  var theme = useContext(EuiThemeContext);
15
17
  var colorMode = useContext(EuiColorModeContext);
16
18
  var modifications = useContext(EuiModificationsContext);
19
+
20
+ if (process.env.NODE_ENV !== 'production') {
21
+ var isFallback = theme === defaultComputedTheme;
22
+ var warningLevel = getEuiDevProviderWarning();
23
+
24
+ if (isFallback && typeof warningLevel !== 'undefined') {
25
+ switch (warningLevel) {
26
+ case 'log':
27
+ console.log(providerMessage);
28
+ break;
29
+
30
+ case 'warn':
31
+ console.warn(providerMessage);
32
+ break;
33
+
34
+ case 'error':
35
+ throw new Error(providerMessage);
36
+
37
+ default:
38
+ break;
39
+ }
40
+ }
41
+ }
42
+
17
43
  var assembledTheme = useMemo(function () {
18
44
  return {
19
45
  euiTheme: theme,
@@ -7,6 +7,6 @@
7
7
  */
8
8
  export { EuiSystemContext, EuiThemeContext, EuiModificationsContext, EuiColorModeContext } from './context';
9
9
  export { useEuiTheme, withEuiTheme } from './hooks';
10
- export { EuiThemeProvider } from './provider';
10
+ export { EuiThemeProvider, getEuiDevProviderWarning, setEuiDevProviderWarning } from './provider';
11
11
  export { buildTheme, computed, isInverseColorMode, getColorMode, getComputed, getOn, mergeDeep, setOn, Computed } from './utils';
12
12
  export { COLOR_MODES_STANDARD } from './types';
@@ -1,5 +1,10 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
1
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
3
 
4
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
5
+
6
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
7
+
3
8
  /*
4
9
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
5
10
  * or more contributor license agreements. Licensed under the Elastic License
@@ -12,6 +17,13 @@ import isEqual from 'lodash/isEqual';
12
17
  import { EuiSystemContext, EuiThemeContext, EuiModificationsContext, EuiColorModeContext } from './context';
13
18
  import { buildTheme, getColorMode, getComputed, mergeDeep } from './utils';
14
19
  import { jsx as ___EmotionJSX } from "@emotion/react";
20
+ var providerWarning = undefined;
21
+ export var setEuiDevProviderWarning = function setEuiDevProviderWarning(level) {
22
+ return providerWarning = level;
23
+ };
24
+ export var getEuiDevProviderWarning = function getEuiDevProviderWarning() {
25
+ return providerWarning;
26
+ };
15
27
  export var EuiThemeProvider = function EuiThemeProvider(_ref) {
16
28
  var _system = _ref.theme,
17
29
  _colorMode = _ref.colorMode,
@@ -44,7 +56,8 @@ export var EuiThemeProvider = function EuiThemeProvider(_ref) {
44
56
  var prevColorMode = useRef(colorMode);
45
57
  var isParentTheme = useRef(prevSystemKey.current === parentSystem.key && colorMode === parentColorMode && isEqual(parentModifications, modifications));
46
58
 
47
- var _useState7 = useState(isParentTheme.current && Object.keys(parentTheme).length ? parentTheme : getComputed(system, buildTheme(modifications, "_".concat(system.key)), colorMode)),
59
+ var _useState7 = useState(isParentTheme.current && Object.keys(parentTheme).length ? _objectSpread({}, parentTheme) // Intentionally create a new object to break referential equality
60
+ : getComputed(system, buildTheme(modifications, "_".concat(system.key)), colorMode)),
48
61
  _useState8 = _slicedToArray(_useState7, 2),
49
62
  theme = _useState8[0],
50
63
  setTheme = _useState8[1];
@@ -2,6 +2,8 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
 
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
5
7
  Object.defineProperty(exports, "__esModule", {
6
8
  value: true
7
9
  });
@@ -15,14 +17,12 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
15
17
 
16
18
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
17
19
 
18
- var _react = _interopRequireDefault(require("react"));
20
+ var _react = _interopRequireWildcard(require("react"));
19
21
 
20
22
  var _classnames = _interopRequireDefault(require("classnames"));
21
23
 
22
24
  var _chromaJs = _interopRequireDefault(require("chroma-js"));
23
25
 
24
- var _common = require("../common");
25
-
26
26
  var _services = require("../../services");
27
27
 
28
28
  var _inner_text = require("../inner_text");
@@ -33,38 +33,28 @@ var _utils = require("../color_picker/utils");
33
33
 
34
34
  var _href_validator = require("../../services/security/href_validator");
35
35
 
36
+ var _badge = require("./badge.styles");
37
+
36
38
  var _react2 = require("@emotion/react");
37
39
 
38
40
  var _excluded = ["children", "color", "iconType", "iconSide", "className", "isDisabled", "onClick", "iconOnClick", "onClickAriaLabel", "iconOnClickAriaLabel", "closeButtonProps", "href", "rel", "target", "style"];
39
41
 
42
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
43
+
44
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
45
+
40
46
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
41
47
 
42
48
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
43
49
 
44
- // TODO - replace with variables once https://github.com/elastic/eui/issues/2731 is closed
45
- var colorInk = '#000';
46
- var colorGhost = '#fff'; // The color blind palette has some stricter accessibility needs with regards to
50
+ var ICON_SIDES = ['left', 'right'];
51
+ exports.ICON_SIDES = ICON_SIDES;
52
+ var COLORS = ['default', 'hollow', 'primary', 'success', 'accent', 'warning', 'danger'];
53
+ exports.COLORS = COLORS;
54
+ // The color blind palette has some stricter accessibility needs with regards to
47
55
  // charts and contrast. We use the euiPaletteColorBlindBehindText variant here since our
48
56
  // accessibility concerns pertain to foreground (text) and background contrast
49
-
50
57
  var visColors = (0, _services.euiPaletteColorBlindBehindText)();
51
- var colorToHexMap = {
52
- // TODO - replace with variable once https://github.com/elastic/eui/issues/2731 is closed
53
- default: '#d3dae6',
54
- primary: visColors[1],
55
- success: visColors[0],
56
- accent: visColors[2],
57
- warning: visColors[5],
58
- danger: visColors[9]
59
- };
60
- var COLORS = (0, _common.keysOf)(colorToHexMap);
61
- exports.COLORS = COLORS;
62
- var iconSideToClassNameMap = {
63
- left: 'euiBadge--iconLeft',
64
- right: 'euiBadge--iconRight'
65
- };
66
- var ICON_SIDES = (0, _common.keysOf)(iconSideToClassNameMap);
67
- exports.ICON_SIDES = ICON_SIDES;
68
58
 
69
59
  var EuiBadge = function EuiBadge(_ref) {
70
60
  var children = _ref.children,
@@ -85,53 +75,63 @@ var EuiBadge = function EuiBadge(_ref) {
85
75
  target = _ref.target,
86
76
  style = _ref.style,
87
77
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
78
+ var euiTheme = (0, _services.useEuiTheme)();
88
79
  var isHrefValid = !href || (0, _href_validator.validateHref)(href);
89
80
  var isDisabled = _isDisabled || !isHrefValid;
90
- var optionalCustomStyles = style;
91
- var textColor = null; // TODO - replace with variable once https://github.com/elastic/eui/issues/2731 is closed
92
-
93
- var wcagContrastBase = 4.5; // WCAG AA contrast level
94
-
95
- var wcagContrast = null;
96
- var colorHex = null; // Check if a valid color name was provided
97
-
98
- try {
99
- if (COLORS.indexOf(color) > -1) {
100
- // Get the hex equivalent for the provided color name
101
- colorHex = colorToHexMap[color]; // Set dark or light text color based upon best contrast
102
-
103
- textColor = setTextColor(colorHex);
104
- optionalCustomStyles = _objectSpread({
105
- backgroundColor: colorHex,
106
- color: textColor
107
- }, optionalCustomStyles);
108
- } else if (color !== 'hollow') {
109
- // This is a custom color that is neither from the base palette nor hollow
110
- // Let's do our best to ensure that it provides sufficient contrast
111
- // Set dark or light text color based upon best contrast
112
- textColor = setTextColor(color); // Check the contrast
113
-
114
- wcagContrast = getColorContrast(textColor, color);
115
-
116
- if (wcagContrast < wcagContrastBase) {
117
- // It's low contrast, so lets show a warning in the console
118
- console.warn('Warning: ', color, ' badge has low contrast of ', wcagContrast.toFixed(2), '. Should be above ', wcagContrastBase, '.');
81
+ var optionalCustomStyles = (0, _react.useMemo)(function () {
82
+ var colorToHexMap = {
83
+ default: euiTheme.euiTheme.colors.lightShade,
84
+ hollow: '',
85
+ primary: visColors[1],
86
+ success: visColors[0],
87
+ accent: visColors[2],
88
+ warning: visColors[5],
89
+ danger: visColors[9]
90
+ };
91
+ var textColor = null;
92
+ var contrastRatio = null;
93
+ var colorHex = null;
94
+
95
+ try {
96
+ // Check if a valid color name was provided
97
+ if (COLORS.includes(color)) {
98
+ if (color === 'hollow') return style; // hollow uses its own CSS class
99
+ // Get the hex equivalent for the provided color name
100
+
101
+ colorHex = colorToHexMap[color]; // Set dark or light text color based upon best contrast
102
+
103
+ textColor = setTextColor(euiTheme, colorHex);
104
+ return _objectSpread({
105
+ backgroundColor: colorHex,
106
+ color: textColor
107
+ }, style);
108
+ } else {
109
+ // This is a custom color- let's do our best to ensure that it provides sufficient contrast
110
+ // Set dark or light text color based upon best contrast
111
+ textColor = setTextColor(euiTheme, color); // Check the contrast
112
+
113
+ contrastRatio = getColorContrast(textColor, color);
114
+
115
+ if (contrastRatio < _services.wcagContrastMin) {
116
+ // It's low contrast, so lets show a warning in the console
117
+ console.warn('Warning: ', color, ' badge has low contrast of ', contrastRatio.toFixed(2), '. Should be above ', _services.wcagContrastMin, '.');
118
+ }
119
+
120
+ return _objectSpread({
121
+ backgroundColor: color,
122
+ color: textColor
123
+ }, style);
119
124
  }
120
-
121
- optionalCustomStyles = _objectSpread({
122
- backgroundColor: color,
123
- color: textColor
124
- }, optionalCustomStyles);
125
+ } catch (err) {
126
+ handleInvalidColor(color);
125
127
  }
126
- } catch (err) {
127
- handleInvalidColor(color);
128
- }
129
-
130
- var classes = (0, _classnames.default)('euiBadge', {
131
- 'euiBadge-isClickable': (onClick || href) && !iconOnClick,
132
- 'euiBadge-isDisabled': isDisabled,
133
- 'euiBadge--hollow': color === 'hollow'
134
- }, iconSideToClassNameMap[iconSide], className);
128
+ }, [color, style, euiTheme]);
129
+ var styles = (0, _badge.euiBadgeStyles)(euiTheme);
130
+ var cssStyles = [styles.euiBadge, (onClick || href) && !iconOnClick && styles.clickable, isDisabled && styles.disabled, color === 'hollow' && styles.hollow];
131
+ var textCssStyles = [styles.text.euiBadge__text, (onClick || href) && !isDisabled && styles.text.clickable];
132
+ var iconCssStyles = [styles.icon.euiBadge__icon, styles.icon[iconSide]];
133
+ var iconButtonCssStyles = [styles.iconButton.euiBadge__iconButton, styles.iconButton[iconSide]];
134
+ var classes = (0, _classnames.default)('euiBadge', className);
135
135
  var closeClassNames = (0, _classnames.default)('euiBadge__icon', closeButtonProps && closeButtonProps.className);
136
136
  var Element = href && !isDisabled ? 'a' : 'button';
137
137
  var relObj = {};
@@ -161,6 +161,7 @@ var EuiBadge = function EuiBadge(_ref) {
161
161
  optionalIcon = (0, _react2.jsx)("button", {
162
162
  type: "button",
163
163
  className: "euiBadge__iconButton",
164
+ css: iconButtonCssStyles,
164
165
  "aria-label": iconOnClickAriaLabel,
165
166
  disabled: isDisabled,
166
167
  title: iconOnClickAriaLabel,
@@ -169,7 +170,8 @@ var EuiBadge = function EuiBadge(_ref) {
169
170
  type: iconType,
170
171
  size: "s",
171
172
  color: "inherit" // forces the icon to inherit its parent color
172
-
173
+ ,
174
+ css: iconCssStyles
173
175
  }, closeButtonProps, {
174
176
  className: closeClassNames
175
177
  })));
@@ -178,6 +180,7 @@ var EuiBadge = function EuiBadge(_ref) {
178
180
  type: iconType,
179
181
  size: children ? 's' : 'm',
180
182
  className: "euiBadge__icon",
183
+ css: iconCssStyles,
181
184
  color: "inherit" // forces the icon to inherit its parent color
182
185
 
183
186
  });
@@ -189,28 +192,34 @@ var EuiBadge = function EuiBadge(_ref) {
189
192
  }
190
193
 
191
194
  var content = (0, _react2.jsx)("span", {
192
- className: "euiBadge__content"
193
- }, children && (0, _react2.jsx)("span", {
194
- className: "euiBadge__text"
195
- }, children), optionalIcon);
195
+ className: "euiBadge__content",
196
+ css: styles.euiBadge__content
197
+ }, iconSide === 'left' && optionalIcon, children && (0, _react2.jsx)("span", {
198
+ className: "euiBadge__text",
199
+ css: textCssStyles
200
+ }, children), iconSide === 'right' && optionalIcon);
196
201
 
197
202
  if (iconOnClick) {
198
203
  return onClick || href ? (0, _react2.jsx)("span", {
199
204
  className: classes,
205
+ css: cssStyles,
200
206
  style: optionalCustomStyles
201
207
  }, (0, _react2.jsx)("span", {
202
- className: "euiBadge__content"
203
- }, (0, _react2.jsx)(_inner_text.EuiInnerText, null, function (ref, innerText) {
208
+ className: "euiBadge__content",
209
+ css: styles.euiBadge__content
210
+ }, iconSide === 'left' && optionalIcon, (0, _react2.jsx)(_inner_text.EuiInnerText, null, function (ref, innerText) {
204
211
  return (0, _react2.jsx)(Element, (0, _extends2.default)({
205
212
  className: "euiBadge__childButton",
213
+ css: styles.euiBadge__childButton,
206
214
  disabled: isDisabled,
207
215
  "aria-label": onClickAriaLabel,
208
216
  ref: ref,
209
217
  title: innerText
210
218
  }, relObj, rest), children);
211
- }), optionalIcon)) : (0, _react2.jsx)(_inner_text.EuiInnerText, null, function (ref, innerText) {
219
+ }), iconSide === 'right' && optionalIcon)) : (0, _react2.jsx)(_inner_text.EuiInnerText, null, function (ref, innerText) {
212
220
  return (0, _react2.jsx)("span", (0, _extends2.default)({
213
221
  className: classes,
222
+ css: cssStyles,
214
223
  style: optionalCustomStyles,
215
224
  ref: ref,
216
225
  title: innerText
@@ -222,6 +231,7 @@ var EuiBadge = function EuiBadge(_ref) {
222
231
  disabled: isDisabled,
223
232
  "aria-label": onClickAriaLabel,
224
233
  className: classes,
234
+ css: cssStyles,
225
235
  style: optionalCustomStyles,
226
236
  ref: ref,
227
237
  title: innerText
@@ -231,6 +241,7 @@ var EuiBadge = function EuiBadge(_ref) {
231
241
  return (0, _react2.jsx)(_inner_text.EuiInnerText, null, function (ref, innerText) {
232
242
  return (0, _react2.jsx)("span", (0, _extends2.default)({
233
243
  className: classes,
244
+ css: cssStyles,
234
245
  style: optionalCustomStyles,
235
246
  ref: ref,
236
247
  title: innerText
@@ -247,13 +258,14 @@ function getColorContrast(textColor, color) {
247
258
  return contrastValue;
248
259
  }
249
260
 
250
- function setTextColor(bgColor) {
251
- var textColor = _services.isColorDark.apply(void 0, (0, _toConsumableArray2.default)((0, _chromaJs.default)(bgColor).rgb())) ? colorGhost : colorInk;
261
+ function setTextColor(_ref2, bgColor) {
262
+ var euiTheme = _ref2.euiTheme;
263
+ var textColor = _services.isColorDark.apply(void 0, (0, _toConsumableArray2.default)((0, _chromaJs.default)(bgColor).rgb())) ? euiTheme.colors.ghost : euiTheme.colors.ink;
252
264
  return textColor;
253
265
  }
254
266
 
255
267
  function handleInvalidColor(color) {
256
- var isNamedColor = color && COLORS.includes(color) || color === 'hollow';
268
+ var isNamedColor = COLORS.includes(color);
257
269
  var isValidColorString = color && (0, _utils.chromaValid)((0, _utils.parseColor)(color) || '');
258
270
 
259
271
  if (!isNamedColor && !isValidColorString) {
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.euiBadgeStyles = void 0;
7
+
8
+ var _react = require("@emotion/react");
9
+
10
+ var _global_styling = require("../../global_styling");
11
+
12
+ var _mixins = require("../../themes/amsterdam/global_styling/mixins");
13
+
14
+ var _services = require("../../services");
15
+
16
+ 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)."; }
17
+
18
+ var _ref = process.env.NODE_ENV === "production" ? {
19
+ name: "1hw5vc4-clickable",
20
+ styles: "cursor:pointer;label:clickable;"
21
+ } : {
22
+ name: "1hw5vc4-clickable",
23
+ styles: "cursor:pointer;label:clickable;",
24
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
25
+ };
26
+
27
+ var euiBadgeStyles = function euiBadgeStyles(euiThemeContext) {
28
+ var euiTheme = euiThemeContext.euiTheme,
29
+ colorMode = euiThemeContext.colorMode;
30
+ return {
31
+ euiBadge: /*#__PURE__*/(0, _react.css)("display:inline-block;vertical-align:middle;padding:0 ", euiTheme.size.s, ";", (0, _global_styling.logicalCSS)('max-width', '100%'), " font-size:", (0, _global_styling.euiFontSize)(euiThemeContext, 'xs').fontSize, ";line-height:", euiTheme.base + 2, "px;font-weight:", euiTheme.font.weight.medium, ";white-space:nowrap;text-decoration:none;cursor:default;background-color:transparent;border:", euiTheme.border.width.thin, " solid transparent;border-radius:", parseFloat(String(euiTheme.border.radius.medium)) / 2, "px;", (0, _global_styling.logicalTextAlignCSS)('left'), " &:focus-within{", (0, _global_styling.euiFocusRing)(euiThemeContext), ";}&+.euiBadge{", (0, _global_styling.logicalCSS)('margin-left', euiTheme.size.xs), ";};label:euiBadge;"),
32
+ clickable: /*#__PURE__*/(0, _react.css)("&:not(:disabled){&:hover,&:focus{text-decoration:underline;}}&:focus{", (0, _global_styling.euiFocusRing)(euiThemeContext), ";}&:disabled{cursor:not-allowed;};label:clickable;"),
33
+ disabled: /*#__PURE__*/(0, _react.css)("color:", (0, _mixins.euiButtonColor)(euiThemeContext, 'disabled').color, "!important;background-color:", (0, _mixins.euiButtonColor)(euiThemeContext, 'disabled').backgroundColor, "!important;;label:disabled;"),
34
+ // Hollow has a border and is mostly used for autocompleters.
35
+ hollow: /*#__PURE__*/(0, _react.css)("background-color:", euiTheme.colors.emptyShade, ";border-color:", colorMode === 'DARK' ? (0, _services.tint)(euiTheme.border.color, 0.15) : euiTheme.border.color, ";color:", euiTheme.colors.text, ";;label:hollow;"),
36
+ // Content wrapper
37
+ euiBadge__content: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)( // Ensure proper height in case of just displaying an icon
38
+ 'min-height', "".concat(euiTheme.base + parseFloat(String(euiTheme.border.width.thin)) * 2, "px")), " display:flex;align-items:center;overflow:hidden;;label:euiBadge__content;"),
39
+ // Text
40
+ text: {
41
+ euiBadge__text: /*#__PURE__*/(0, _react.css)((0, _global_styling.euiTextTruncate)(), " cursor:inherit;;label:euiBadge__text;"),
42
+ clickable: _ref
43
+ },
44
+ // Icon
45
+ icon: {
46
+ euiBadge__icon: /*#__PURE__*/(0, _react.css)(";label:euiBadge__icon;"),
47
+ right: /*#__PURE__*/(0, _react.css)("&:not(:only-child){", (0, _global_styling.logicalCSS)('margin-left', euiTheme.size.xs), ";};label:right;"),
48
+ left: /*#__PURE__*/(0, _react.css)("&:not(:only-child){", (0, _global_styling.logicalCSS)('margin-right', euiTheme.size.xs), ";};label:left;")
49
+ },
50
+ // Clickable icons (iconOnClick)
51
+ iconButton: {
52
+ euiBadge__iconButton: /*#__PURE__*/(0, _react.css)("font-size:0;&:focus{background-color:", (0, _services.transparentize)(euiTheme.colors.ghost, 0.8), ";color:", euiTheme.colors.ink, ";border-radius:", parseFloat(String(euiTheme.border.radius.small)) / 2, "px;}&:disabled{cursor:not-allowed;}.euiBadge__icon{margin:0!important;};label:euiBadge__iconButton;"),
53
+ right: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('margin-left', euiTheme.size.xs), ";;label:right;"),
54
+ left: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('margin-right', euiTheme.size.xs), ";;label:left;")
55
+ },
56
+ // Used in badges with both onClick & iconOnClick
57
+ euiBadge__childButton: /*#__PURE__*/(0, _react.css)((0, _global_styling.euiTextTruncate)(), " text-align:inherit;font-weight:inherit;line-height:inherit;color:inherit;&:disabled{cursor:not-allowed;}&:not(:disabled){&:hover,&:focus{text-decoration:underline;}};label:euiBadge__childButton;")
58
+ };
59
+ };
60
+
61
+ exports.euiBadgeStyles = euiBadgeStyles;
@@ -540,6 +540,10 @@ var EuiInMemoryTable = /*#__PURE__*/function (_Component) {
540
540
 
541
541
  if (sortName !== prevState.prevProps.sortName || sortDirection !== prevState.prevProps.sortDirection) {
542
542
  updatedPrevState = _objectSpread(_objectSpread({}, updatedPrevState), {}, {
543
+ prevProps: _objectSpread(_objectSpread({}, updatedPrevState.prevProps), {}, {
544
+ sortName: sortName,
545
+ sortDirection: sortDirection
546
+ }),
543
547
  sortName: sortName,
544
548
  sortDirection: sortDirection
545
549
  });
@@ -91,7 +91,6 @@ exports.EuiButton = EuiButton;
91
91
  EuiButton.displayName = 'EuiButton'; // Use defaultProps for simple pass-through props
92
92
 
93
93
  EuiButton.defaultProps = {
94
- minWidth: 112,
95
94
  size: 'm',
96
95
  color: 'primary'
97
96
  };
@@ -30,7 +30,7 @@ var _href_validator = require("../../../services/security/href_validator");
30
30
 
31
31
  var _mixins = require("../../../themes/amsterdam/global_styling/mixins");
32
32
 
33
- var _excluded = ["children", "iconType", "iconSide", "size", "isDisabled", "disabled", "isLoading", "isSelected", "fullWidth", "minWidth", "contentProps", "textProps", "href", "target", "rel", "type"];
33
+ var _excluded = ["children", "iconType", "iconSide", "iconSize", "size", "isDisabled", "disabled", "isLoading", "isSelected", "fullWidth", "minWidth", "contentProps", "textProps", "href", "target", "rel", "type", "style"];
34
34
 
35
35
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
36
36
 
@@ -59,6 +59,7 @@ var EuiButtonDisplay = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref)
59
59
  var children = _ref2.children,
60
60
  iconType = _ref2.iconType,
61
61
  iconSide = _ref2.iconSide,
62
+ iconSize = _ref2.iconSize,
62
63
  _ref2$size = _ref2.size,
63
64
  size = _ref2$size === void 0 ? 'm' : _ref2$size,
64
65
  isDisabled = _ref2.isDisabled,
@@ -74,15 +75,15 @@ var EuiButtonDisplay = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref)
74
75
  rel = _ref2.rel,
75
76
  _ref2$type = _ref2.type,
76
77
  type = _ref2$type === void 0 ? 'button' : _ref2$type,
78
+ style = _ref2.style,
77
79
  rest = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
78
80
  var buttonIsDisabled = isButtonDisabled({
79
81
  href: href,
80
82
  isDisabled: isDisabled || disabled,
81
83
  isLoading: isLoading
82
84
  });
83
- var minWidthPx = typeof minWidth === 'number' ? "".concat(minWidth, "px") : minWidth;
84
85
  var theme = (0, _services.useEuiTheme)();
85
- var styles = (0, _button_display.euiButtonDisplayStyles)(theme, minWidthPx);
86
+ var styles = (0, _button_display.euiButtonDisplayStyles)(theme);
86
87
  var buttonRadiusStyle = (0, _mixins.useEuiButtonRadiusCSS)()[size];
87
88
  var cssStyles = [styles.euiButtonDisplay, styles[size], fullWidth && styles.fullWidth, buttonIsDisabled && styles.isDisabled, buttonRadiusStyle];
88
89
  var innerNode = (0, _react2.jsx)(_button_display_content.EuiButtonDisplayContent, (0, _extends2.default)({
@@ -90,6 +91,7 @@ var EuiButtonDisplay = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref)
90
91
  isDisabled: buttonIsDisabled,
91
92
  iconType: iconType,
92
93
  iconSide: iconSide,
94
+ iconSize: iconSize,
93
95
  textProps: _objectSpread({}, textProps)
94
96
  }, contentProps), children);
95
97
  var element = href && !buttonIsDisabled ? 'a' : 'button';
@@ -118,6 +120,9 @@ var EuiButtonDisplay = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref)
118
120
 
119
121
  return (0, _react2.createElement)(element, _objectSpread(_objectSpread(_objectSpread({
120
122
  css: cssStyles,
123
+ style: minWidth ? _objectSpread(_objectSpread({}, style), {}, {
124
+ minWidth: minWidth
125
+ }) : style,
121
126
  ref: ref
122
127
  }, elementProps), relObj), rest), innerNode);
123
128
  });
@@ -32,11 +32,11 @@ var _ref = process.env.NODE_ENV === "production" ? {
32
32
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
33
33
  };
34
34
 
35
- var euiButtonDisplayStyles = function euiButtonDisplayStyles(euiThemeContext, minWidth) {
35
+ var euiButtonDisplayStyles = function euiButtonDisplayStyles(euiThemeContext) {
36
36
  var euiTheme = euiThemeContext.euiTheme;
37
37
  return {
38
38
  // Base
39
- euiButtonDisplay: /*#__PURE__*/(0, _react.css)(euiButtonBaseCSS(), ";", minWidth && (0, _global_styling.logicalCSS)('min-width', minWidth), ";font-weight:", euiTheme.font.weight.medium, ";padding:0 ", euiTheme.size.m, ";&:hover:not(:disabled),&:focus{text-decoration:underline;};label:euiButtonDisplay;"),
39
+ euiButtonDisplay: /*#__PURE__*/(0, _react.css)(euiButtonBaseCSS(), ";", (0, _global_styling.logicalCSS)('min-width', "".concat(euiTheme.base * 7, "px")), " font-weight:", euiTheme.font.weight.medium, ";padding:0 ", euiTheme.size.m, ";&:hover:not(:disabled),&:focus{text-decoration:underline;};label:euiButtonDisplay;"),
40
40
  // States
41
41
  isDisabled: _ref,
42
42
  fullWidth: /*#__PURE__*/(0, _react.css)("display:block;", (0, _global_styling.logicalCSS)('width', '100%'), ";;label:fullWidth;"),
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.EuiButtonDisplayContent = void 0;
8
+ exports.ICON_SIZES = exports.ICON_SIDES = exports.EuiButtonDisplayContent = void 0;
9
9
 
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
11
 
@@ -26,6 +26,10 @@ var _classnames = _interopRequireDefault(require("classnames"));
26
26
  var _react2 = require("@emotion/react");
27
27
 
28
28
  var _excluded = ["children", "textProps", "isLoading", "isDisabled", "iconType", "iconSize", "iconSide"];
29
+ var ICON_SIZES = ['s', 'm'];
30
+ exports.ICON_SIZES = ICON_SIZES;
31
+ var ICON_SIDES = ['left', 'right'];
32
+ exports.ICON_SIDES = ICON_SIDES;
29
33
 
30
34
  var EuiButtonDisplayContent = function EuiButtonDisplayContent(_ref) {
31
35
  var children = _ref.children,
@@ -43,7 +47,7 @@ var EuiButtonDisplayContent = function EuiButtonDisplayContent(_ref) {
43
47
  var styles = (0, _button_display_content.euiButtonDisplayContentStyles)(theme);
44
48
  var cssStyles = [styles.euiButtonDisplayContent, iconSide && styles[iconSide]];
45
49
  var cssSpinnerStyles = [styles.euiButtonDisplayContent__spinner];
46
- var cssIconStyles = [styles.euiButtonDisplayContent__icon]; // Add an icon to the button if one exists.
50
+ var cssIconStyles = [styles.euiButtonDisplayContent__icon, iconSize && styles[iconSize]]; // Add an icon to the button if one exists.
47
51
 
48
52
  var icon; // When the button is disabled the text gets gray
49
53
  // and in some buttons the background gets a light gray
@@ -47,7 +47,10 @@ var euiButtonDisplayContentStyles = function euiButtonDisplayContentStyles(_ref4
47
47
  left: /*#__PURE__*/(0, _react.css)(";label:left;"),
48
48
  right: _ref3,
49
49
  euiButtonDisplayContent__spinner: _ref2,
50
- euiButtonDisplayContent__icon: _ref
50
+ euiButtonDisplayContent__icon: _ref,
51
+ // Icon size
52
+ s: /*#__PURE__*/(0, _react.css)(";label:s;"),
53
+ m: /*#__PURE__*/(0, _react.css)(";label:m;")
51
54
  };
52
55
  };
53
56