@elastic/eui 67.1.4 → 67.1.6

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/button/button_display/_button_display.js +7 -6
  2. package/es/components/button/button_display/_button_display.styles.js +4 -4
  3. package/es/components/button/button_display/_button_display_content.js +6 -9
  4. package/es/components/button/button_display/_button_display_content.styles.js +3 -41
  5. package/es/components/loading/loading_spinner.js +14 -3
  6. package/es/components/loading/loading_spinner.styles.js +11 -7
  7. package/eui.d.ts +3 -8
  8. package/lib/components/button/button_display/_button_display.js +7 -6
  9. package/lib/components/button/button_display/_button_display.styles.js +4 -4
  10. package/lib/components/button/button_display/_button_display_content.js +6 -9
  11. package/lib/components/button/button_display/_button_display_content.styles.js +10 -40
  12. package/lib/components/loading/loading_spinner.js +13 -2
  13. package/lib/components/loading/loading_spinner.styles.js +14 -6
  14. package/optimize/es/components/button/button_display/_button_display.js +6 -5
  15. package/optimize/es/components/button/button_display/_button_display.styles.js +4 -4
  16. package/optimize/es/components/button/button_display/_button_display_content.js +6 -9
  17. package/optimize/es/components/button/button_display/_button_display_content.styles.js +3 -41
  18. package/optimize/es/components/loading/loading_spinner.js +13 -3
  19. package/optimize/es/components/loading/loading_spinner.styles.js +11 -7
  20. package/optimize/lib/components/button/button_display/_button_display.js +7 -6
  21. package/optimize/lib/components/button/button_display/_button_display.styles.js +4 -4
  22. package/optimize/lib/components/button/button_display/_button_display_content.js +6 -9
  23. package/optimize/lib/components/button/button_display/_button_display_content.styles.js +10 -40
  24. package/optimize/lib/components/loading/loading_spinner.js +14 -2
  25. package/optimize/lib/components/loading/loading_spinner.styles.js +14 -6
  26. package/package.json +1 -1
  27. package/test-env/components/button/button_display/_button_display.js +7 -6
  28. package/test-env/components/button/button_display/_button_display.styles.js +4 -4
  29. package/test-env/components/button/button_display/_button_display_content.js +6 -9
  30. package/test-env/components/button/button_display/_button_display_content.styles.js +10 -40
  31. package/test-env/components/loading/loading_spinner.js +14 -2
  32. package/test-env/components/loading/loading_spinner.styles.js +14 -6
@@ -1,13 +1,13 @@
1
1
  var _excluded = ["children", "iconType", "iconSide", "iconSize", "size", "isDisabled", "disabled", "isLoading", "isSelected", "fullWidth", "minWidth", "contentProps", "textProps", "href", "target", "rel", "type", "style"];
2
2
 
3
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
-
5
3
  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; }
6
4
 
7
5
  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; }
8
6
 
9
7
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
10
8
 
9
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
10
+
11
11
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
12
12
 
13
13
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
@@ -45,7 +45,8 @@ export function isButtonDisabled(_ref) {
45
45
  export var EuiButtonDisplay = /*#__PURE__*/forwardRef(function (_ref2, ref) {
46
46
  var children = _ref2.children,
47
47
  iconType = _ref2.iconType,
48
- iconSide = _ref2.iconSide,
48
+ _ref2$iconSide = _ref2.iconSide,
49
+ iconSide = _ref2$iconSide === void 0 ? 'left' : _ref2$iconSide,
49
50
  iconSize = _ref2.iconSize,
50
51
  _ref2$size = _ref2.size,
51
52
  size = _ref2$size === void 0 ? 'm' : _ref2$size,
@@ -81,7 +82,7 @@ export var EuiButtonDisplay = /*#__PURE__*/forwardRef(function (_ref2, ref) {
81
82
  iconType: iconType,
82
83
  iconSide: iconSide,
83
84
  iconSize: iconSize,
84
- textProps: _objectSpread({}, textProps)
85
+ textProps: textProps
85
86
  }, contentProps), children);
86
87
 
87
88
  var element = href && !buttonIsDisabled ? 'a' : 'button';
@@ -110,8 +111,8 @@ export var EuiButtonDisplay = /*#__PURE__*/forwardRef(function (_ref2, ref) {
110
111
 
111
112
  return createElement(element, _objectSpread(_objectSpread(_objectSpread({
112
113
  css: cssStyles,
113
- style: minWidth ? _objectSpread(_objectSpread({}, style), {}, {
114
- minWidth: minWidth
114
+ style: minWidth != null ? _objectSpread(_objectSpread({}, style), {}, {
115
+ minInlineSize: minWidth
115
116
  }) : style,
116
117
  ref: ref
117
118
  }, elementProps), relObj), rest), innerNode);
@@ -20,11 +20,11 @@ var _buttonSize = function _buttonSize(size) {
20
20
  };
21
21
 
22
22
  var _ref = process.env.NODE_ENV === "production" ? {
23
- name: "vifhyf-isDisabled",
24
- styles: "pointer-events:none;cursor:not-allowed;label:isDisabled;"
23
+ name: "8595p9-isDisabled",
24
+ styles: "cursor:not-allowed;label:isDisabled;"
25
25
  } : {
26
- name: "vifhyf-isDisabled",
27
- styles: "pointer-events:none;cursor:not-allowed;label:isDisabled;",
26
+ name: "8595p9-isDisabled",
27
+ styles: "cursor:not-allowed;label:isDisabled;",
28
28
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
29
29
  };
30
30
 
@@ -33,14 +33,13 @@ export var EuiButtonDisplayContent = function EuiButtonDisplayContent(_ref) {
33
33
  iconType = _ref.iconType,
34
34
  _ref$iconSize = _ref.iconSize,
35
35
  iconSize = _ref$iconSize === void 0 ? 'm' : _ref$iconSize,
36
- iconSide = _ref.iconSide,
36
+ _ref$iconSide = _ref.iconSide,
37
+ iconSide = _ref$iconSide === void 0 ? 'left' : _ref$iconSide,
37
38
  contentProps = _objectWithoutProperties(_ref, _excluded);
38
39
 
39
40
  var theme = useEuiTheme();
40
41
  var styles = euiButtonDisplayContentStyles(theme);
41
- var cssStyles = [styles.euiButtonDisplayContent, iconSide && styles[iconSide]];
42
- var cssSpinnerStyles = [styles.euiButtonDisplayContent__spinner];
43
- var cssIconStyles = [styles.euiButtonDisplayContent__icon, iconSize && styles[iconSize]]; // Add an icon to the button if one exists.
42
+ var cssStyles = [styles.euiButtonDisplayContent]; // Add an icon to the button if one exists.
44
43
 
45
44
  var icon; // When the button is disabled the text gets gray
46
45
  // and in some buttons the background gets a light gray
@@ -49,18 +48,16 @@ export var EuiButtonDisplayContent = function EuiButtonDisplayContent(_ref) {
49
48
  // are always visible. The default spinner color could be very light.
50
49
 
51
50
  var loadingSpinnerColor = isDisabled ? {
52
- border: 'currentColor'
51
+ border: 'currentcolor'
53
52
  } : undefined;
54
53
 
55
54
  if (isLoading) {
56
55
  icon = ___EmotionJSX(EuiLoadingSpinner, {
57
- css: cssSpinnerStyles,
58
56
  size: iconSize,
59
57
  color: loadingSpinnerColor
60
58
  });
61
59
  } else if (iconType) {
62
60
  icon = ___EmotionJSX(EuiIcon, {
63
- css: cssIconStyles,
64
61
  type: iconType,
65
62
  size: iconSize,
66
63
  color: "inherit" // forces the icon to inherit its parent color
@@ -71,9 +68,9 @@ export var EuiButtonDisplayContent = function EuiButtonDisplayContent(_ref) {
71
68
  var isText = typeof children === 'string';
72
69
  return ___EmotionJSX("span", _extends({
73
70
  css: cssStyles
74
- }, contentProps), icon, isText ? ___EmotionJSX("span", _extends({}, textProps, {
71
+ }, contentProps), iconSide === 'left' && icon, isText || textProps ? ___EmotionJSX("span", _extends({}, textProps, {
75
72
  className: classNames('eui-textTruncate', textProps === null || textProps === void 0 ? void 0 : textProps.className)
76
- }), children) : children);
73
+ }), children) : children, iconSide === 'right' && icon);
77
74
  };
78
75
  EuiButtonDisplayContent.propTypes = {
79
76
  /**
@@ -1,5 +1,3 @@
1
- function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
2
-
3
1
  /*
4
2
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
5
3
  * or more contributor license agreements. Licensed under the Elastic License
@@ -9,46 +7,10 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
9
7
  */
10
8
  import { css } from '@emotion/react';
11
9
  import { logicalCSS } from '../../../global_styling';
12
-
13
- var _ref = process.env.NODE_ENV === "production" ? {
14
- name: "gtg6j-euiButtonDisplayContent__icon",
15
- styles: "flex-shrink:0;label:euiButtonDisplayContent__icon;"
16
- } : {
17
- name: "gtg6j-euiButtonDisplayContent__icon",
18
- styles: "flex-shrink:0;label:euiButtonDisplayContent__icon;",
19
- toString: _EMOTION_STRINGIFIED_CSS_ERROR__
20
- };
21
-
22
- var _ref2 = process.env.NODE_ENV === "production" ? {
23
- name: "10wlo76-euiButtonDisplayContent__spinner",
24
- styles: "flex-shrink:0;label:euiButtonDisplayContent__spinner;"
25
- } : {
26
- name: "10wlo76-euiButtonDisplayContent__spinner",
27
- styles: "flex-shrink:0;label:euiButtonDisplayContent__spinner;",
28
- toString: _EMOTION_STRINGIFIED_CSS_ERROR__
29
- };
30
-
31
- var _ref3 = process.env.NODE_ENV === "production" ? {
32
- name: "qfl6yj-right",
33
- styles: "flex-direction:row-reverse;label:right;"
34
- } : {
35
- name: "qfl6yj-right",
36
- styles: "flex-direction:row-reverse;label:right;",
37
- toString: _EMOTION_STRINGIFIED_CSS_ERROR__
38
- };
39
-
40
- export var euiButtonDisplayContentStyles = function euiButtonDisplayContentStyles(_ref4) {
41
- var euiTheme = _ref4.euiTheme;
10
+ export var euiButtonDisplayContentStyles = function euiButtonDisplayContentStyles(_ref) {
11
+ var euiTheme = _ref.euiTheme;
42
12
  return {
43
13
  // Base
44
- euiButtonDisplayContent: /*#__PURE__*/css(logicalCSS('height', '100%'), ";", logicalCSS('width', '100%'), ";display:flex;justify-content:center;align-items:center;vertical-align:middle;gap:", euiTheme.size.s, ";;label:euiButtonDisplayContent;"),
45
- // Icon side
46
- left: /*#__PURE__*/css(";label:left;"),
47
- right: _ref3,
48
- euiButtonDisplayContent__spinner: _ref2,
49
- euiButtonDisplayContent__icon: _ref,
50
- // Icon size
51
- s: /*#__PURE__*/css(";label:s;"),
52
- m: /*#__PURE__*/css(";label:m;")
14
+ euiButtonDisplayContent: /*#__PURE__*/css(logicalCSS('height', '100%'), ";", logicalCSS('width', '100%'), ";display:flex;justify-content:center;align-items:center;vertical-align:middle;gap:", euiTheme.size.s, ";;label:euiButtonDisplayContent;")
53
15
  };
54
16
  };
@@ -1,7 +1,13 @@
1
- var _excluded = ["size", "className", "aria-label", "color"];
1
+ var _excluded = ["size", "className", "aria-label", "color", "style"];
2
2
 
3
3
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
4
 
5
+ 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; }
6
+
7
+ 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; }
8
+
9
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
10
+
5
11
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
6
12
 
7
13
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
@@ -18,7 +24,7 @@ import PropTypes from "prop-types";
18
24
  import classNames from 'classnames';
19
25
  import { useEuiTheme } from '../..//services';
20
26
  import { useLoadingAriaLabel } from './_loading_strings';
21
- import { euiLoadingSpinnerStyles } from './loading_spinner.styles';
27
+ import { euiLoadingSpinnerStyles, euiSpinnerBorderColorsCSS } from './loading_spinner.styles';
22
28
  import { jsx as ___EmotionJSX } from "@emotion/react";
23
29
  export var SIZES = ['s', 'm', 'l', 'xl', 'xxl'];
24
30
  export var EuiLoadingSpinner = function EuiLoadingSpinner(_ref) {
@@ -27,16 +33,21 @@ export var EuiLoadingSpinner = function EuiLoadingSpinner(_ref) {
27
33
  className = _ref.className,
28
34
  ariaLabel = _ref['aria-label'],
29
35
  color = _ref.color,
36
+ style = _ref.style,
30
37
  rest = _objectWithoutProperties(_ref, _excluded);
31
38
 
32
39
  var euiTheme = useEuiTheme();
33
- var styles = euiLoadingSpinnerStyles(euiTheme, color);
40
+ var styles = euiLoadingSpinnerStyles(euiTheme);
34
41
  var cssStyles = [styles.euiLoadingSpinner, styles[size]];
35
42
  var classes = classNames('euiLoadingSpinner', className);
36
43
  var defaultLabel = useLoadingAriaLabel();
44
+ var customColorStyle = color ? _objectSpread(_objectSpread({}, style), {}, {
45
+ borderColor: euiSpinnerBorderColorsCSS(euiTheme, color)
46
+ }) : style;
37
47
  return ___EmotionJSX("span", _extends({
38
48
  className: classes,
39
49
  css: cssStyles,
50
+ style: customColorStyle,
40
51
  role: "progressbar",
41
52
  "aria-label": ariaLabel || defaultLabel
42
53
  }, rest));
@@ -21,15 +21,19 @@ var spinnerSizes = {
21
21
  xl: 'xl',
22
22
  xxl: 'xxl'
23
23
  };
24
-
25
- var spinnerColorsCSS = function spinnerColorsCSS(border, highlight) {
26
- return "\n border-color: ".concat(highlight, " ").concat(border, " ").concat(border, " ").concat(border, ";\n ");
27
- };
28
-
29
- export var euiLoadingSpinnerStyles = function euiLoadingSpinnerStyles(_ref, color) {
24
+ export var euiSpinnerBorderColorsCSS = function euiSpinnerBorderColorsCSS(_ref) {
30
25
  var euiTheme = _ref.euiTheme;
26
+ var colors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
27
+ var _colors$border = colors.border,
28
+ border = _colors$border === void 0 ? euiTheme.colors.lightShade : _colors$border,
29
+ _colors$highlight = colors.highlight,
30
+ highlight = _colors$highlight === void 0 ? euiTheme.colors.primary : _colors$highlight;
31
+ return "".concat(highlight, " ").concat(border, " ").concat(border, " ").concat(border);
32
+ };
33
+ export var euiLoadingSpinnerStyles = function euiLoadingSpinnerStyles(euiThemeContext) {
34
+ var euiTheme = euiThemeContext.euiTheme;
31
35
  return {
32
- euiLoadingSpinner: /*#__PURE__*/css("flex-shrink:0;display:inline-block;border-radius:50%;border:", euiTheme.border.thick, ";", spinnerColorsCSS((color === null || color === void 0 ? void 0 : color.border) || euiTheme.colors.lightShade, (color === null || color === void 0 ? void 0 : color.highlight) || euiTheme.colors.primary), ";", euiCanAnimate, "{animation:", _loadingSpinner, " 0.6s infinite linear;};label:euiLoadingSpinner;"),
36
+ euiLoadingSpinner: /*#__PURE__*/css("flex-shrink:0;display:inline-block;border-radius:50%;border:", euiTheme.border.thick, ";border-color:", euiSpinnerBorderColorsCSS(euiThemeContext), ";", euiCanAnimate, "{animation:", _loadingSpinner, " 0.6s infinite linear;};label:euiLoadingSpinner;"),
33
37
  // Sizes
34
38
  s: /*#__PURE__*/css(logicalSizeCSS(euiTheme.size[spinnerSizes.s], euiTheme.size[spinnerSizes.s]), " border-width:calc(", euiTheme.border.width.thin, " * 1.5);;label:s;"),
35
39
  m: /*#__PURE__*/css(logicalSizeCSS(euiTheme.size[spinnerSizes.m], euiTheme.size[spinnerSizes.m]), " border-width:calc(", euiTheme.border.width.thin, " * 1.5);;label:m;"),
package/eui.d.ts CHANGED
@@ -1701,8 +1701,9 @@ declare module '@elastic/eui/src/components/loading/loading_content' {
1701
1701
  }
1702
1702
  declare module '@elastic/eui/src/components/loading/loading_spinner.styles' {
1703
1703
  import { UseEuiTheme } from '@elastic/eui/src/services';
1704
- import { EuiLoadingSpinnerProps } from '@elastic/eui/src/components/loading/loading_spinner';
1705
- export const euiLoadingSpinnerStyles: ({ euiTheme }: UseEuiTheme, color?: EuiLoadingSpinnerProps['color']) => {
1704
+ import { EuiLoadingSpinnerColor } from '@elastic/eui/src/components/loading/loading_spinner';
1705
+ export const euiSpinnerBorderColorsCSS: ({ euiTheme }: UseEuiTheme, colors?: EuiLoadingSpinnerColor) => string;
1706
+ export const euiLoadingSpinnerStyles: (euiThemeContext: UseEuiTheme) => {
1706
1707
  euiLoadingSpinner: import("@emotion/utils").SerializedStyles;
1707
1708
  s: import("@emotion/utils").SerializedStyles;
1708
1709
  m: import("@emotion/utils").SerializedStyles;
@@ -1900,12 +1901,6 @@ declare module '@elastic/eui/src/components/button/button_display/_button_displa
1900
1901
  import { UseEuiTheme } from '@elastic/eui/src/services';
1901
1902
  export const euiButtonDisplayContentStyles: ({ euiTheme }: UseEuiTheme) => {
1902
1903
  euiButtonDisplayContent: import("@emotion/utils").SerializedStyles;
1903
- left: import("@emotion/utils").SerializedStyles;
1904
- right: import("@emotion/utils").SerializedStyles;
1905
- euiButtonDisplayContent__spinner: import("@emotion/utils").SerializedStyles;
1906
- euiButtonDisplayContent__icon: import("@emotion/utils").SerializedStyles;
1907
- s: import("@emotion/utils").SerializedStyles;
1908
- m: import("@emotion/utils").SerializedStyles;
1909
1904
  };
1910
1905
 
1911
1906
  }
@@ -32,14 +32,14 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
32
32
 
33
33
  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; }
34
34
 
35
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
36
-
37
35
  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; }
38
36
 
39
37
  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; }
40
38
 
41
39
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
42
40
 
41
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
42
+
43
43
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
44
44
 
45
45
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
@@ -62,7 +62,8 @@ function isButtonDisabled(_ref) {
62
62
  var EuiButtonDisplay = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
63
63
  var children = _ref2.children,
64
64
  iconType = _ref2.iconType,
65
- iconSide = _ref2.iconSide,
65
+ _ref2$iconSide = _ref2.iconSide,
66
+ iconSide = _ref2$iconSide === void 0 ? 'left' : _ref2$iconSide,
66
67
  iconSize = _ref2.iconSize,
67
68
  _ref2$size = _ref2.size,
68
69
  size = _ref2$size === void 0 ? 'm' : _ref2$size,
@@ -97,7 +98,7 @@ var EuiButtonDisplay = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref)
97
98
  iconType: iconType,
98
99
  iconSide: iconSide,
99
100
  iconSize: iconSize,
100
- textProps: _objectSpread({}, textProps)
101
+ textProps: textProps
101
102
  }, contentProps), children);
102
103
  var element = href && !buttonIsDisabled ? 'a' : 'button';
103
104
  var elementProps = {}; // Element-specific attributes
@@ -125,8 +126,8 @@ var EuiButtonDisplay = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref)
125
126
 
126
127
  return (0, _react2.createElement)(element, _objectSpread(_objectSpread(_objectSpread({
127
128
  css: cssStyles,
128
- style: minWidth ? _objectSpread(_objectSpread({}, style), {}, {
129
- minWidth: minWidth
129
+ style: minWidth != null ? _objectSpread(_objectSpread({}, style), {}, {
130
+ minInlineSize: minWidth
130
131
  }) : style,
131
132
  ref: ref
132
133
  }, elementProps), relObj), rest), innerNode);
@@ -24,11 +24,11 @@ var _buttonSize = function _buttonSize(size) {
24
24
  };
25
25
 
26
26
  var _ref = process.env.NODE_ENV === "production" ? {
27
- name: "vifhyf-isDisabled",
28
- styles: "pointer-events:none;cursor:not-allowed;label:isDisabled;"
27
+ name: "8595p9-isDisabled",
28
+ styles: "cursor:not-allowed;label:isDisabled;"
29
29
  } : {
30
- name: "vifhyf-isDisabled",
31
- styles: "pointer-events:none;cursor:not-allowed;label:isDisabled;",
30
+ name: "8595p9-isDisabled",
31
+ styles: "cursor:not-allowed;label:isDisabled;",
32
32
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
33
33
  };
34
34
 
@@ -46,14 +46,13 @@ var EuiButtonDisplayContent = function EuiButtonDisplayContent(_ref) {
46
46
  iconType = _ref.iconType,
47
47
  _ref$iconSize = _ref.iconSize,
48
48
  iconSize = _ref$iconSize === void 0 ? 'm' : _ref$iconSize,
49
- iconSide = _ref.iconSide,
49
+ _ref$iconSide = _ref.iconSide,
50
+ iconSide = _ref$iconSide === void 0 ? 'left' : _ref$iconSide,
50
51
  contentProps = _objectWithoutProperties(_ref, _excluded);
51
52
 
52
53
  var theme = (0, _services.useEuiTheme)();
53
54
  var styles = (0, _button_display_content.euiButtonDisplayContentStyles)(theme);
54
- var cssStyles = [styles.euiButtonDisplayContent, iconSide && styles[iconSide]];
55
- var cssSpinnerStyles = [styles.euiButtonDisplayContent__spinner];
56
- var cssIconStyles = [styles.euiButtonDisplayContent__icon, iconSize && styles[iconSize]]; // Add an icon to the button if one exists.
55
+ var cssStyles = [styles.euiButtonDisplayContent]; // Add an icon to the button if one exists.
57
56
 
58
57
  var icon; // When the button is disabled the text gets gray
59
58
  // and in some buttons the background gets a light gray
@@ -62,18 +61,16 @@ var EuiButtonDisplayContent = function EuiButtonDisplayContent(_ref) {
62
61
  // are always visible. The default spinner color could be very light.
63
62
 
64
63
  var loadingSpinnerColor = isDisabled ? {
65
- border: 'currentColor'
64
+ border: 'currentcolor'
66
65
  } : undefined;
67
66
 
68
67
  if (isLoading) {
69
68
  icon = (0, _react2.jsx)(_loading.EuiLoadingSpinner, {
70
- css: cssSpinnerStyles,
71
69
  size: iconSize,
72
70
  color: loadingSpinnerColor
73
71
  });
74
72
  } else if (iconType) {
75
73
  icon = (0, _react2.jsx)(_icon.EuiIcon, {
76
- css: cssIconStyles,
77
74
  type: iconType,
78
75
  size: iconSize,
79
76
  color: "inherit" // forces the icon to inherit its parent color
@@ -84,9 +81,9 @@ var EuiButtonDisplayContent = function EuiButtonDisplayContent(_ref) {
84
81
  var isText = typeof children === 'string';
85
82
  return (0, _react2.jsx)("span", _extends({
86
83
  css: cssStyles
87
- }, contentProps), icon, isText ? (0, _react2.jsx)("span", _extends({}, textProps, {
84
+ }, contentProps), iconSide === 'left' && icon, isText || textProps ? (0, _react2.jsx)("span", _extends({}, textProps, {
88
85
  className: (0, _classnames.default)('eui-textTruncate', textProps === null || textProps === void 0 ? void 0 : textProps.className)
89
- }), children) : children);
86
+ }), children) : children, iconSide === 'right' && icon);
90
87
  };
91
88
 
92
89
  exports.EuiButtonDisplayContent = EuiButtonDisplayContent;
@@ -9,48 +9,18 @@ var _react = require("@emotion/react");
9
9
 
10
10
  var _global_styling = require("../../../global_styling");
11
11
 
12
- 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)."; }
13
-
14
- var _ref = process.env.NODE_ENV === "production" ? {
15
- name: "gtg6j-euiButtonDisplayContent__icon",
16
- styles: "flex-shrink:0;label:euiButtonDisplayContent__icon;"
17
- } : {
18
- name: "gtg6j-euiButtonDisplayContent__icon",
19
- styles: "flex-shrink:0;label:euiButtonDisplayContent__icon;",
20
- toString: _EMOTION_STRINGIFIED_CSS_ERROR__
21
- };
22
-
23
- var _ref2 = process.env.NODE_ENV === "production" ? {
24
- name: "10wlo76-euiButtonDisplayContent__spinner",
25
- styles: "flex-shrink:0;label:euiButtonDisplayContent__spinner;"
26
- } : {
27
- name: "10wlo76-euiButtonDisplayContent__spinner",
28
- styles: "flex-shrink:0;label:euiButtonDisplayContent__spinner;",
29
- toString: _EMOTION_STRINGIFIED_CSS_ERROR__
30
- };
31
-
32
- var _ref3 = process.env.NODE_ENV === "production" ? {
33
- name: "qfl6yj-right",
34
- styles: "flex-direction:row-reverse;label:right;"
35
- } : {
36
- name: "qfl6yj-right",
37
- styles: "flex-direction:row-reverse;label:right;",
38
- toString: _EMOTION_STRINGIFIED_CSS_ERROR__
39
- };
40
-
41
- var euiButtonDisplayContentStyles = function euiButtonDisplayContentStyles(_ref4) {
42
- var euiTheme = _ref4.euiTheme;
12
+ /*
13
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
14
+ * or more contributor license agreements. Licensed under the Elastic License
15
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
16
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
17
+ * Side Public License, v 1.
18
+ */
19
+ var euiButtonDisplayContentStyles = function euiButtonDisplayContentStyles(_ref) {
20
+ var euiTheme = _ref.euiTheme;
43
21
  return {
44
22
  // Base
45
- euiButtonDisplayContent: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('height', '100%'), ";", (0, _global_styling.logicalCSS)('width', '100%'), ";display:flex;justify-content:center;align-items:center;vertical-align:middle;gap:", euiTheme.size.s, ";;label:euiButtonDisplayContent;"),
46
- // Icon side
47
- left: /*#__PURE__*/(0, _react.css)(";label:left;"),
48
- right: _ref3,
49
- euiButtonDisplayContent__spinner: _ref2,
50
- euiButtonDisplayContent__icon: _ref,
51
- // Icon size
52
- s: /*#__PURE__*/(0, _react.css)(";label:s;"),
53
- m: /*#__PURE__*/(0, _react.css)(";label:m;")
23
+ euiButtonDisplayContent: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('height', '100%'), ";", (0, _global_styling.logicalCSS)('width', '100%'), ";display:flex;justify-content:center;align-items:center;vertical-align:middle;gap:", euiTheme.size.s, ";;label:euiButtonDisplayContent;")
54
24
  };
55
25
  };
56
26
 
@@ -19,12 +19,18 @@ var _loading_spinner = require("./loading_spinner.styles");
19
19
 
20
20
  var _react2 = require("@emotion/react");
21
21
 
22
- var _excluded = ["size", "className", "aria-label", "color"];
22
+ var _excluded = ["size", "className", "aria-label", "color", "style"];
23
23
 
24
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
25
 
26
26
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
27
27
 
28
+ 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; }
29
+
30
+ 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; }
31
+
32
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
33
+
28
34
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
29
35
 
30
36
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
@@ -38,16 +44,21 @@ var EuiLoadingSpinner = function EuiLoadingSpinner(_ref) {
38
44
  className = _ref.className,
39
45
  ariaLabel = _ref['aria-label'],
40
46
  color = _ref.color,
47
+ style = _ref.style,
41
48
  rest = _objectWithoutProperties(_ref, _excluded);
42
49
 
43
50
  var euiTheme = (0, _services.useEuiTheme)();
44
- var styles = (0, _loading_spinner.euiLoadingSpinnerStyles)(euiTheme, color);
51
+ var styles = (0, _loading_spinner.euiLoadingSpinnerStyles)(euiTheme);
45
52
  var cssStyles = [styles.euiLoadingSpinner, styles[size]];
46
53
  var classes = (0, _classnames.default)('euiLoadingSpinner', className);
47
54
  var defaultLabel = (0, _loading_strings.useLoadingAriaLabel)();
55
+ var customColorStyle = color ? _objectSpread(_objectSpread({}, style), {}, {
56
+ borderColor: (0, _loading_spinner.euiSpinnerBorderColorsCSS)(euiTheme, color)
57
+ }) : style;
48
58
  return (0, _react2.jsx)("span", _extends({
49
59
  className: classes,
50
60
  css: cssStyles,
61
+ style: customColorStyle,
51
62
  role: "progressbar",
52
63
  "aria-label": ariaLabel || defaultLabel
53
64
  }, rest));
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.euiLoadingSpinnerStyles = void 0;
6
+ exports.euiSpinnerBorderColorsCSS = exports.euiLoadingSpinnerStyles = void 0;
7
7
 
8
8
  var _react = require("@emotion/react");
9
9
 
@@ -23,14 +23,22 @@ var spinnerSizes = {
23
23
  xxl: 'xxl'
24
24
  };
25
25
 
26
- var spinnerColorsCSS = function spinnerColorsCSS(border, highlight) {
27
- return "\n border-color: ".concat(highlight, " ").concat(border, " ").concat(border, " ").concat(border, ";\n ");
26
+ var euiSpinnerBorderColorsCSS = function euiSpinnerBorderColorsCSS(_ref) {
27
+ var euiTheme = _ref.euiTheme;
28
+ var colors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
29
+ var _colors$border = colors.border,
30
+ border = _colors$border === void 0 ? euiTheme.colors.lightShade : _colors$border,
31
+ _colors$highlight = colors.highlight,
32
+ highlight = _colors$highlight === void 0 ? euiTheme.colors.primary : _colors$highlight;
33
+ return "".concat(highlight, " ").concat(border, " ").concat(border, " ").concat(border);
28
34
  };
29
35
 
30
- var euiLoadingSpinnerStyles = function euiLoadingSpinnerStyles(_ref, color) {
31
- var euiTheme = _ref.euiTheme;
36
+ exports.euiSpinnerBorderColorsCSS = euiSpinnerBorderColorsCSS;
37
+
38
+ var euiLoadingSpinnerStyles = function euiLoadingSpinnerStyles(euiThemeContext) {
39
+ var euiTheme = euiThemeContext.euiTheme;
32
40
  return {
33
- euiLoadingSpinner: /*#__PURE__*/(0, _react.css)("flex-shrink:0;display:inline-block;border-radius:50%;border:", euiTheme.border.thick, ";", spinnerColorsCSS((color === null || color === void 0 ? void 0 : color.border) || euiTheme.colors.lightShade, (color === null || color === void 0 ? void 0 : color.highlight) || euiTheme.colors.primary), ";", _global_styling.euiCanAnimate, "{animation:", _loadingSpinner, " 0.6s infinite linear;};label:euiLoadingSpinner;"),
41
+ euiLoadingSpinner: /*#__PURE__*/(0, _react.css)("flex-shrink:0;display:inline-block;border-radius:50%;border:", euiTheme.border.thick, ";border-color:", euiSpinnerBorderColorsCSS(euiThemeContext), ";", _global_styling.euiCanAnimate, "{animation:", _loadingSpinner, " 0.6s infinite linear;};label:euiLoadingSpinner;"),
34
42
  // Sizes
35
43
  s: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalSizeCSS)(euiTheme.size[spinnerSizes.s], euiTheme.size[spinnerSizes.s]), " border-width:calc(", euiTheme.border.width.thin, " * 1.5);;label:s;"),
36
44
  m: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalSizeCSS)(euiTheme.size[spinnerSizes.m], euiTheme.size[spinnerSizes.m]), " border-width:calc(", euiTheme.border.width.thin, " * 1.5);;label:m;"),
@@ -1,5 +1,5 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _extends from "@babel/runtime/helpers/extends";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
4
  var _excluded = ["children", "iconType", "iconSide", "iconSize", "size", "isDisabled", "disabled", "isLoading", "isSelected", "fullWidth", "minWidth", "contentProps", "textProps", "href", "target", "rel", "type", "style"];
5
5
 
@@ -39,7 +39,8 @@ export function isButtonDisabled(_ref) {
39
39
  export var EuiButtonDisplay = /*#__PURE__*/forwardRef(function (_ref2, ref) {
40
40
  var children = _ref2.children,
41
41
  iconType = _ref2.iconType,
42
- iconSide = _ref2.iconSide,
42
+ _ref2$iconSide = _ref2.iconSide,
43
+ iconSide = _ref2$iconSide === void 0 ? 'left' : _ref2$iconSide,
43
44
  iconSize = _ref2.iconSize,
44
45
  _ref2$size = _ref2.size,
45
46
  size = _ref2$size === void 0 ? 'm' : _ref2$size,
@@ -75,7 +76,7 @@ export var EuiButtonDisplay = /*#__PURE__*/forwardRef(function (_ref2, ref) {
75
76
  iconType: iconType,
76
77
  iconSide: iconSide,
77
78
  iconSize: iconSize,
78
- textProps: _objectSpread({}, textProps)
79
+ textProps: textProps
79
80
  }, contentProps), children);
80
81
 
81
82
  var element = href && !buttonIsDisabled ? 'a' : 'button';
@@ -104,8 +105,8 @@ export var EuiButtonDisplay = /*#__PURE__*/forwardRef(function (_ref2, ref) {
104
105
 
105
106
  return createElement(element, _objectSpread(_objectSpread(_objectSpread({
106
107
  css: cssStyles,
107
- style: minWidth ? _objectSpread(_objectSpread({}, style), {}, {
108
- minWidth: minWidth
108
+ style: minWidth != null ? _objectSpread(_objectSpread({}, style), {}, {
109
+ minInlineSize: minWidth
109
110
  }) : style,
110
111
  ref: ref
111
112
  }, elementProps), relObj), rest), innerNode);
@@ -20,11 +20,11 @@ var _buttonSize = function _buttonSize(size) {
20
20
  };
21
21
 
22
22
  var _ref = process.env.NODE_ENV === "production" ? {
23
- name: "vifhyf-isDisabled",
24
- styles: "pointer-events:none;cursor:not-allowed;label:isDisabled;"
23
+ name: "8595p9-isDisabled",
24
+ styles: "cursor:not-allowed;label:isDisabled;"
25
25
  } : {
26
- name: "vifhyf-isDisabled",
27
- styles: "pointer-events:none;cursor:not-allowed;label:isDisabled;",
26
+ name: "8595p9-isDisabled",
27
+ styles: "cursor:not-allowed;label:isDisabled;",
28
28
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
29
29
  };
30
30