@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
@@ -28,14 +28,13 @@ export var EuiButtonDisplayContent = function EuiButtonDisplayContent(_ref) {
28
28
  iconType = _ref.iconType,
29
29
  _ref$iconSize = _ref.iconSize,
30
30
  iconSize = _ref$iconSize === void 0 ? 'm' : _ref$iconSize,
31
- iconSide = _ref.iconSide,
31
+ _ref$iconSide = _ref.iconSide,
32
+ iconSide = _ref$iconSide === void 0 ? 'left' : _ref$iconSide,
32
33
  contentProps = _objectWithoutProperties(_ref, _excluded);
33
34
 
34
35
  var theme = useEuiTheme();
35
36
  var styles = euiButtonDisplayContentStyles(theme);
36
- var cssStyles = [styles.euiButtonDisplayContent, iconSide && styles[iconSide]];
37
- var cssSpinnerStyles = [styles.euiButtonDisplayContent__spinner];
38
- var cssIconStyles = [styles.euiButtonDisplayContent__icon, iconSize && styles[iconSize]]; // Add an icon to the button if one exists.
37
+ var cssStyles = [styles.euiButtonDisplayContent]; // Add an icon to the button if one exists.
39
38
 
40
39
  var icon; // When the button is disabled the text gets gray
41
40
  // and in some buttons the background gets a light gray
@@ -44,18 +43,16 @@ export var EuiButtonDisplayContent = function EuiButtonDisplayContent(_ref) {
44
43
  // are always visible. The default spinner color could be very light.
45
44
 
46
45
  var loadingSpinnerColor = isDisabled ? {
47
- border: 'currentColor'
46
+ border: 'currentcolor'
48
47
  } : undefined;
49
48
 
50
49
  if (isLoading) {
51
50
  icon = ___EmotionJSX(EuiLoadingSpinner, {
52
- css: cssSpinnerStyles,
53
51
  size: iconSize,
54
52
  color: loadingSpinnerColor
55
53
  });
56
54
  } else if (iconType) {
57
55
  icon = ___EmotionJSX(EuiIcon, {
58
- css: cssIconStyles,
59
56
  type: iconType,
60
57
  size: iconSize,
61
58
  color: "inherit" // forces the icon to inherit its parent color
@@ -66,7 +63,7 @@ export var EuiButtonDisplayContent = function EuiButtonDisplayContent(_ref) {
66
63
  var isText = typeof children === 'string';
67
64
  return ___EmotionJSX("span", _extends({
68
65
  css: cssStyles
69
- }, contentProps), icon, isText ? ___EmotionJSX("span", _extends({}, textProps, {
66
+ }, contentProps), iconSide === 'left' && icon, isText || textProps ? ___EmotionJSX("span", _extends({}, textProps, {
70
67
  className: classNames('eui-textTruncate', textProps === null || textProps === void 0 ? void 0 : textProps.className)
71
- }), children) : children);
68
+ }), children) : children, iconSide === 'right' && icon);
72
69
  };
@@ -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,6 +1,11 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["size", "className", "aria-label", "color"];
4
+ var _excluded = ["size", "className", "aria-label", "color", "style"];
5
+
6
+ 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; }
7
+
8
+ 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; }
4
9
 
5
10
  /*
6
11
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
@@ -13,7 +18,7 @@ import React from 'react';
13
18
  import classNames from 'classnames';
14
19
  import { useEuiTheme } from '../..//services';
15
20
  import { useLoadingAriaLabel } from './_loading_strings';
16
- import { euiLoadingSpinnerStyles } from './loading_spinner.styles';
21
+ import { euiLoadingSpinnerStyles, euiSpinnerBorderColorsCSS } from './loading_spinner.styles';
17
22
  import { jsx as ___EmotionJSX } from "@emotion/react";
18
23
  export var SIZES = ['s', 'm', 'l', 'xl', 'xxl'];
19
24
  export var EuiLoadingSpinner = function EuiLoadingSpinner(_ref) {
@@ -22,16 +27,21 @@ export var EuiLoadingSpinner = function EuiLoadingSpinner(_ref) {
22
27
  className = _ref.className,
23
28
  ariaLabel = _ref['aria-label'],
24
29
  color = _ref.color,
30
+ style = _ref.style,
25
31
  rest = _objectWithoutProperties(_ref, _excluded);
26
32
 
27
33
  var euiTheme = useEuiTheme();
28
- var styles = euiLoadingSpinnerStyles(euiTheme, color);
34
+ var styles = euiLoadingSpinnerStyles(euiTheme);
29
35
  var cssStyles = [styles.euiLoadingSpinner, styles[size]];
30
36
  var classes = classNames('euiLoadingSpinner', className);
31
37
  var defaultLabel = useLoadingAriaLabel();
38
+ var customColorStyle = color ? _objectSpread(_objectSpread({}, style), {}, {
39
+ borderColor: euiSpinnerBorderColorsCSS(euiTheme, color)
40
+ }) : style;
32
41
  return ___EmotionJSX("span", _extends({
33
42
  className: classes,
34
43
  css: cssStyles,
44
+ style: customColorStyle,
35
45
  role: "progressbar",
36
46
  "aria-label": ariaLabel || defaultLabel
37
47
  }, 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;"),
@@ -10,10 +10,10 @@ Object.defineProperty(exports, "__esModule", {
10
10
  exports.EuiButtonDisplay = void 0;
11
11
  exports.isButtonDisabled = isButtonDisabled;
12
12
 
13
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
14
-
15
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
14
 
15
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
16
+
17
17
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
18
18
 
19
19
  var _react = _interopRequireWildcard(require("react"));
@@ -58,7 +58,8 @@ function isButtonDisabled(_ref) {
58
58
  var EuiButtonDisplay = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
59
59
  var children = _ref2.children,
60
60
  iconType = _ref2.iconType,
61
- iconSide = _ref2.iconSide,
61
+ _ref2$iconSide = _ref2.iconSide,
62
+ iconSide = _ref2$iconSide === void 0 ? 'left' : _ref2$iconSide,
62
63
  iconSize = _ref2.iconSize,
63
64
  _ref2$size = _ref2.size,
64
65
  size = _ref2$size === void 0 ? 'm' : _ref2$size,
@@ -92,7 +93,7 @@ var EuiButtonDisplay = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref)
92
93
  iconType: iconType,
93
94
  iconSide: iconSide,
94
95
  iconSize: iconSize,
95
- textProps: _objectSpread({}, textProps)
96
+ textProps: textProps
96
97
  }, contentProps), children);
97
98
  var element = href && !buttonIsDisabled ? 'a' : 'button';
98
99
  var elementProps = {}; // Element-specific attributes
@@ -120,8 +121,8 @@ var EuiButtonDisplay = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref)
120
121
 
121
122
  return (0, _react2.createElement)(element, _objectSpread(_objectSpread(_objectSpread({
122
123
  css: cssStyles,
123
- style: minWidth ? _objectSpread(_objectSpread({}, style), {}, {
124
- minWidth: minWidth
124
+ style: minWidth != null ? _objectSpread(_objectSpread({}, style), {}, {
125
+ minInlineSize: minWidth
125
126
  }) : style,
126
127
  ref: ref
127
128
  }, 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
 
@@ -41,13 +41,12 @@ var EuiButtonDisplayContent = function EuiButtonDisplayContent(_ref) {
41
41
  iconType = _ref.iconType,
42
42
  _ref$iconSize = _ref.iconSize,
43
43
  iconSize = _ref$iconSize === void 0 ? 'm' : _ref$iconSize,
44
- iconSide = _ref.iconSide,
44
+ _ref$iconSide = _ref.iconSide,
45
+ iconSide = _ref$iconSide === void 0 ? 'left' : _ref$iconSide,
45
46
  contentProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
46
47
  var theme = (0, _services.useEuiTheme)();
47
48
  var styles = (0, _button_display_content.euiButtonDisplayContentStyles)(theme);
48
- var cssStyles = [styles.euiButtonDisplayContent, iconSide && styles[iconSide]];
49
- var cssSpinnerStyles = [styles.euiButtonDisplayContent__spinner];
50
- var cssIconStyles = [styles.euiButtonDisplayContent__icon, iconSize && styles[iconSize]]; // Add an icon to the button if one exists.
49
+ var cssStyles = [styles.euiButtonDisplayContent]; // Add an icon to the button if one exists.
51
50
 
52
51
  var icon; // When the button is disabled the text gets gray
53
52
  // and in some buttons the background gets a light gray
@@ -56,18 +55,16 @@ var EuiButtonDisplayContent = function EuiButtonDisplayContent(_ref) {
56
55
  // are always visible. The default spinner color could be very light.
57
56
 
58
57
  var loadingSpinnerColor = isDisabled ? {
59
- border: 'currentColor'
58
+ border: 'currentcolor'
60
59
  } : undefined;
61
60
 
62
61
  if (isLoading) {
63
62
  icon = (0, _react2.jsx)(_loading.EuiLoadingSpinner, {
64
- css: cssSpinnerStyles,
65
63
  size: iconSize,
66
64
  color: loadingSpinnerColor
67
65
  });
68
66
  } else if (iconType) {
69
67
  icon = (0, _react2.jsx)(_icon.EuiIcon, {
70
- css: cssIconStyles,
71
68
  type: iconType,
72
69
  size: iconSize,
73
70
  color: "inherit" // forces the icon to inherit its parent color
@@ -78,9 +75,9 @@ var EuiButtonDisplayContent = function EuiButtonDisplayContent(_ref) {
78
75
  var isText = typeof children === 'string';
79
76
  return (0, _react2.jsx)("span", (0, _extends2.default)({
80
77
  css: cssStyles
81
- }, contentProps), icon, isText ? (0, _react2.jsx)("span", (0, _extends2.default)({}, textProps, {
78
+ }, contentProps), iconSide === 'left' && icon, isText || textProps ? (0, _react2.jsx)("span", (0, _extends2.default)({}, textProps, {
82
79
  className: (0, _classnames.default)('eui-textTruncate', textProps === null || textProps === void 0 ? void 0 : textProps.className)
83
- }), children) : children);
80
+ }), children) : children, iconSide === 'right' && icon);
84
81
  };
85
82
 
86
83
  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
 
@@ -9,6 +9,8 @@ exports.SIZES = exports.EuiLoadingSpinner = void 0;
9
9
 
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
11
 
12
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
+
12
14
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
13
15
 
14
16
  var _react = _interopRequireDefault(require("react"));
@@ -23,7 +25,12 @@ var _loading_spinner = require("./loading_spinner.styles");
23
25
 
24
26
  var _react2 = require("@emotion/react");
25
27
 
26
- var _excluded = ["size", "className", "aria-label", "color"];
28
+ var _excluded = ["size", "className", "aria-label", "color", "style"];
29
+
30
+ 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; }
31
+
32
+ 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; }
33
+
27
34
  var SIZES = ['s', 'm', 'l', 'xl', 'xxl'];
28
35
  exports.SIZES = SIZES;
29
36
 
@@ -33,15 +40,20 @@ var EuiLoadingSpinner = function EuiLoadingSpinner(_ref) {
33
40
  className = _ref.className,
34
41
  ariaLabel = _ref['aria-label'],
35
42
  color = _ref.color,
43
+ style = _ref.style,
36
44
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
37
45
  var euiTheme = (0, _services.useEuiTheme)();
38
- var styles = (0, _loading_spinner.euiLoadingSpinnerStyles)(euiTheme, color);
46
+ var styles = (0, _loading_spinner.euiLoadingSpinnerStyles)(euiTheme);
39
47
  var cssStyles = [styles.euiLoadingSpinner, styles[size]];
40
48
  var classes = (0, _classnames.default)('euiLoadingSpinner', className);
41
49
  var defaultLabel = (0, _loading_strings.useLoadingAriaLabel)();
50
+ var customColorStyle = color ? _objectSpread(_objectSpread({}, style), {}, {
51
+ borderColor: (0, _loading_spinner.euiSpinnerBorderColorsCSS)(euiTheme, color)
52
+ }) : style;
42
53
  return (0, _react2.jsx)("span", (0, _extends2.default)({
43
54
  className: classes,
44
55
  css: cssStyles,
56
+ style: customColorStyle,
45
57
  role: "progressbar",
46
58
  "aria-label": ariaLabel || defaultLabel
47
59
  }, rest));
@@ -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.euiLoadingSpinnerStyles = void 0;
8
+ exports.euiSpinnerBorderColorsCSS = exports.euiLoadingSpinnerStyles = void 0;
9
9
 
10
10
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
11
 
@@ -25,14 +25,22 @@ var spinnerSizes = {
25
25
  xxl: 'xxl'
26
26
  };
27
27
 
28
- var spinnerColorsCSS = function spinnerColorsCSS(border, highlight) {
29
- return "\n border-color: ".concat(highlight, " ").concat(border, " ").concat(border, " ").concat(border, ";\n ");
28
+ var euiSpinnerBorderColorsCSS = function euiSpinnerBorderColorsCSS(_ref) {
29
+ var euiTheme = _ref.euiTheme;
30
+ var colors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
31
+ var _colors$border = colors.border,
32
+ border = _colors$border === void 0 ? euiTheme.colors.lightShade : _colors$border,
33
+ _colors$highlight = colors.highlight,
34
+ highlight = _colors$highlight === void 0 ? euiTheme.colors.primary : _colors$highlight;
35
+ return "".concat(highlight, " ").concat(border, " ").concat(border, " ").concat(border);
30
36
  };
31
37
 
32
- var euiLoadingSpinnerStyles = function euiLoadingSpinnerStyles(_ref, color) {
33
- var euiTheme = _ref.euiTheme;
38
+ exports.euiSpinnerBorderColorsCSS = euiSpinnerBorderColorsCSS;
39
+
40
+ var euiLoadingSpinnerStyles = function euiLoadingSpinnerStyles(euiThemeContext) {
41
+ var euiTheme = euiThemeContext.euiTheme;
34
42
  return {
35
- 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;"),
43
+ 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;"),
36
44
  // Sizes
37
45
  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;"),
38
46
  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;"),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@elastic/eui",
3
3
  "description": "Elastic UI Component Library",
4
- "version": "67.1.4",
4
+ "version": "67.1.6",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "lib",
7
7
  "module": "es",
@@ -10,10 +10,10 @@ Object.defineProperty(exports, "__esModule", {
10
10
  exports.EuiButtonDisplay = void 0;
11
11
  exports.isButtonDisabled = isButtonDisabled;
12
12
 
13
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
14
-
15
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
14
 
15
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
16
+
17
17
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
18
18
 
19
19
  var _react = _interopRequireWildcard(require("react"));
@@ -60,7 +60,8 @@ function isButtonDisabled(_ref) {
60
60
  var EuiButtonDisplay = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
61
61
  var children = _ref2.children,
62
62
  iconType = _ref2.iconType,
63
- iconSide = _ref2.iconSide,
63
+ _ref2$iconSide = _ref2.iconSide,
64
+ iconSide = _ref2$iconSide === void 0 ? 'left' : _ref2$iconSide,
64
65
  iconSize = _ref2.iconSize,
65
66
  _ref2$size = _ref2.size,
66
67
  size = _ref2$size === void 0 ? 'm' : _ref2$size,
@@ -94,7 +95,7 @@ var EuiButtonDisplay = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref)
94
95
  iconType: iconType,
95
96
  iconSide: iconSide,
96
97
  iconSize: iconSize,
97
- textProps: _objectSpread({}, textProps)
98
+ textProps: textProps
98
99
  }, contentProps), children);
99
100
  var element = href && !buttonIsDisabled ? 'a' : 'button';
100
101
  var elementProps = {}; // Element-specific attributes
@@ -122,8 +123,8 @@ var EuiButtonDisplay = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref)
122
123
 
123
124
  return (0, _react2.createElement)(element, _objectSpread(_objectSpread(_objectSpread({
124
125
  css: cssStyles,
125
- style: minWidth ? _objectSpread(_objectSpread({}, style), {}, {
126
- minWidth: minWidth
126
+ style: minWidth != null ? _objectSpread(_objectSpread({}, style), {}, {
127
+ minInlineSize: minWidth
127
128
  }) : style,
128
129
  ref: ref
129
130
  }, 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
 
@@ -43,13 +43,12 @@ var EuiButtonDisplayContent = function EuiButtonDisplayContent(_ref) {
43
43
  iconType = _ref.iconType,
44
44
  _ref$iconSize = _ref.iconSize,
45
45
  iconSize = _ref$iconSize === void 0 ? 'm' : _ref$iconSize,
46
- iconSide = _ref.iconSide,
46
+ _ref$iconSide = _ref.iconSide,
47
+ iconSide = _ref$iconSide === void 0 ? 'left' : _ref$iconSide,
47
48
  contentProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
48
49
  var theme = (0, _services.useEuiTheme)();
49
50
  var styles = (0, _button_display_content.euiButtonDisplayContentStyles)(theme);
50
- var cssStyles = [styles.euiButtonDisplayContent, iconSide && styles[iconSide]];
51
- var cssSpinnerStyles = [styles.euiButtonDisplayContent__spinner];
52
- var cssIconStyles = [styles.euiButtonDisplayContent__icon, iconSize && styles[iconSize]]; // Add an icon to the button if one exists.
51
+ var cssStyles = [styles.euiButtonDisplayContent]; // Add an icon to the button if one exists.
53
52
 
54
53
  var icon; // When the button is disabled the text gets gray
55
54
  // and in some buttons the background gets a light gray
@@ -58,18 +57,16 @@ var EuiButtonDisplayContent = function EuiButtonDisplayContent(_ref) {
58
57
  // are always visible. The default spinner color could be very light.
59
58
 
60
59
  var loadingSpinnerColor = isDisabled ? {
61
- border: 'currentColor'
60
+ border: 'currentcolor'
62
61
  } : undefined;
63
62
 
64
63
  if (isLoading) {
65
64
  icon = (0, _react2.jsx)(_loading.EuiLoadingSpinner, {
66
- css: cssSpinnerStyles,
67
65
  size: iconSize,
68
66
  color: loadingSpinnerColor
69
67
  });
70
68
  } else if (iconType) {
71
69
  icon = (0, _react2.jsx)(_icon.EuiIcon, {
72
- css: cssIconStyles,
73
70
  type: iconType,
74
71
  size: iconSize,
75
72
  color: "inherit" // forces the icon to inherit its parent color
@@ -80,9 +77,9 @@ var EuiButtonDisplayContent = function EuiButtonDisplayContent(_ref) {
80
77
  var isText = typeof children === 'string';
81
78
  return (0, _react2.jsx)("span", (0, _extends2.default)({
82
79
  css: cssStyles
83
- }, contentProps), icon, isText ? (0, _react2.jsx)("span", (0, _extends2.default)({}, textProps, {
80
+ }, contentProps), iconSide === 'left' && icon, isText || textProps ? (0, _react2.jsx)("span", (0, _extends2.default)({}, textProps, {
84
81
  className: (0, _classnames.default)('eui-textTruncate', textProps === null || textProps === void 0 ? void 0 : textProps.className)
85
- }), children) : children);
82
+ }), children) : children, iconSide === 'right' && icon);
86
83
  };
87
84
 
88
85
  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