@elastic/eui 112.0.0 → 112.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 (130) hide show
  1. package/es/components/badge/badge.js +12 -3
  2. package/es/components/badge/badge.styles.js +47 -21
  3. package/es/components/badge/beta_badge/beta_badge.styles.js +2 -2
  4. package/es/components/badge/color_utils.js +20 -7
  5. package/es/components/badge/notification_badge/badge_notification.styles.js +1 -1
  6. package/es/components/button/button.js +2 -1
  7. package/es/components/button/button_empty/button_empty.js +2 -1
  8. package/es/components/context_menu/context_menu.js +20 -7
  9. package/es/components/date_picker/super_date_picker/super_date_picker.js +7 -0
  10. package/es/components/date_picker/super_date_picker/time_window_buttons.js +74 -25
  11. package/es/components/description_list/description_list.js +2 -1
  12. package/es/components/description_list/description_list_description.js +2 -1
  13. package/es/components/description_list/description_list_title.js +2 -1
  14. package/es/components/empty_prompt/empty_prompt.js +2 -1
  15. package/es/components/flex/flex_grid.js +2 -1
  16. package/es/components/flyout/flyout.component.js +31 -26
  17. package/es/components/icon/assets/timeline.js +3 -1
  18. package/es/components/icon/icon.js +2 -1
  19. package/es/components/image/image.js +2 -1
  20. package/es/components/loading/loading_logo.js +2 -1
  21. package/es/components/page/page_section/page_section.js +2 -1
  22. package/es/components/page/page_sidebar/page_sidebar.js +2 -1
  23. package/es/components/page_template/page_template.js +6 -0
  24. package/es/components/panel/panel.js +4 -3
  25. package/es/components/selectable/selectable_list/selectable_list.js +8 -2
  26. package/es/components/selectable/selectable_list/selectable_list_item.js +6 -0
  27. package/eui.d.ts +236 -441
  28. package/i18ntokens.json +803 -749
  29. package/lib/components/badge/badge.js +12 -3
  30. package/lib/components/badge/badge.styles.js +46 -20
  31. package/lib/components/badge/beta_badge/beta_badge.styles.js +2 -2
  32. package/lib/components/badge/color_utils.js +21 -8
  33. package/lib/components/badge/notification_badge/badge_notification.styles.js +1 -1
  34. package/lib/components/button/button.js +2 -1
  35. package/lib/components/button/button_empty/button_empty.js +2 -1
  36. package/lib/components/context_menu/context_menu.js +20 -7
  37. package/lib/components/date_picker/super_date_picker/super_date_picker.js +7 -0
  38. package/lib/components/date_picker/super_date_picker/time_window_buttons.js +75 -26
  39. package/lib/components/description_list/description_list.js +2 -1
  40. package/lib/components/description_list/description_list_description.js +2 -1
  41. package/lib/components/description_list/description_list_title.js +2 -1
  42. package/lib/components/empty_prompt/empty_prompt.js +2 -1
  43. package/lib/components/flex/flex_grid.js +2 -1
  44. package/lib/components/flyout/flyout.component.js +38 -33
  45. package/lib/components/icon/assets/timeline.js +3 -1
  46. package/lib/components/icon/icon.js +2 -1
  47. package/lib/components/icon/svgs/timeline.svg +2 -1
  48. package/lib/components/image/image.js +2 -1
  49. package/lib/components/loading/loading_logo.js +2 -1
  50. package/lib/components/page/page_section/page_section.js +2 -1
  51. package/lib/components/page/page_sidebar/page_sidebar.js +2 -1
  52. package/lib/components/page_template/page_template.js +6 -0
  53. package/lib/components/panel/panel.js +4 -3
  54. package/lib/components/selectable/selectable_list/selectable_list.js +8 -2
  55. package/lib/components/selectable/selectable_list/selectable_list_item.js +6 -0
  56. package/optimize/es/components/badge/badge.js +6 -3
  57. package/optimize/es/components/badge/badge.styles.js +47 -21
  58. package/optimize/es/components/badge/beta_badge/beta_badge.styles.js +2 -2
  59. package/optimize/es/components/badge/color_utils.js +20 -7
  60. package/optimize/es/components/badge/notification_badge/badge_notification.styles.js +1 -1
  61. package/optimize/es/components/button/button.js +2 -1
  62. package/optimize/es/components/button/button_empty/button_empty.js +2 -1
  63. package/optimize/es/components/context_menu/context_menu.js +15 -6
  64. package/optimize/es/components/date_picker/super_date_picker/time_window_buttons.js +74 -25
  65. package/optimize/es/components/description_list/description_list.js +2 -1
  66. package/optimize/es/components/description_list/description_list_description.js +2 -1
  67. package/optimize/es/components/description_list/description_list_title.js +2 -1
  68. package/optimize/es/components/empty_prompt/empty_prompt.js +2 -1
  69. package/optimize/es/components/flex/flex_grid.js +2 -1
  70. package/optimize/es/components/flyout/flyout.component.js +31 -26
  71. package/optimize/es/components/icon/assets/timeline.js +3 -1
  72. package/optimize/es/components/icon/icon.js +2 -1
  73. package/optimize/es/components/image/image.js +2 -1
  74. package/optimize/es/components/loading/loading_logo.js +2 -1
  75. package/optimize/es/components/page/page_section/page_section.js +2 -1
  76. package/optimize/es/components/page/page_sidebar/page_sidebar.js +2 -1
  77. package/optimize/es/components/page_template/page_template.js +6 -0
  78. package/optimize/es/components/panel/panel.js +1 -0
  79. package/optimize/es/components/selectable/selectable_list/selectable_list.js +2 -2
  80. package/optimize/lib/components/badge/badge.js +6 -3
  81. package/optimize/lib/components/badge/badge.styles.js +46 -20
  82. package/optimize/lib/components/badge/beta_badge/beta_badge.styles.js +2 -2
  83. package/optimize/lib/components/badge/color_utils.js +21 -8
  84. package/optimize/lib/components/badge/notification_badge/badge_notification.styles.js +1 -1
  85. package/optimize/lib/components/button/button.js +2 -1
  86. package/optimize/lib/components/button/button_empty/button_empty.js +2 -1
  87. package/optimize/lib/components/context_menu/context_menu.js +15 -6
  88. package/optimize/lib/components/date_picker/super_date_picker/time_window_buttons.js +75 -26
  89. package/optimize/lib/components/description_list/description_list.js +2 -1
  90. package/optimize/lib/components/description_list/description_list_description.js +2 -1
  91. package/optimize/lib/components/description_list/description_list_title.js +2 -1
  92. package/optimize/lib/components/empty_prompt/empty_prompt.js +2 -1
  93. package/optimize/lib/components/flex/flex_grid.js +2 -1
  94. package/optimize/lib/components/flyout/flyout.component.js +38 -33
  95. package/optimize/lib/components/icon/assets/timeline.js +3 -1
  96. package/optimize/lib/components/icon/icon.js +2 -1
  97. package/optimize/lib/components/icon/svgs/timeline.svg +2 -1
  98. package/optimize/lib/components/image/image.js +2 -1
  99. package/optimize/lib/components/loading/loading_logo.js +2 -1
  100. package/optimize/lib/components/page/page_section/page_section.js +2 -1
  101. package/optimize/lib/components/page/page_sidebar/page_sidebar.js +2 -1
  102. package/optimize/lib/components/page_template/page_template.js +6 -0
  103. package/optimize/lib/components/panel/panel.js +1 -0
  104. package/optimize/lib/components/selectable/selectable_list/selectable_list.js +2 -2
  105. package/package.json +3 -3
  106. package/test-env/components/badge/badge.js +12 -3
  107. package/test-env/components/badge/badge.styles.js +46 -20
  108. package/test-env/components/badge/beta_badge/beta_badge.styles.js +2 -2
  109. package/test-env/components/badge/color_utils.js +21 -8
  110. package/test-env/components/badge/notification_badge/badge_notification.styles.js +1 -1
  111. package/test-env/components/button/button.js +2 -1
  112. package/test-env/components/button/button_empty/button_empty.js +2 -1
  113. package/test-env/components/context_menu/context_menu.js +20 -7
  114. package/test-env/components/date_picker/super_date_picker/super_date_picker.js +7 -0
  115. package/test-env/components/date_picker/super_date_picker/time_window_buttons.js +75 -26
  116. package/test-env/components/description_list/description_list.js +2 -1
  117. package/test-env/components/description_list/description_list_description.js +2 -1
  118. package/test-env/components/description_list/description_list_title.js +2 -1
  119. package/test-env/components/empty_prompt/empty_prompt.js +2 -1
  120. package/test-env/components/flex/flex_grid.js +2 -1
  121. package/test-env/components/flyout/flyout.component.js +38 -33
  122. package/test-env/components/icon/assets/timeline.js +3 -1
  123. package/test-env/components/image/image.js +2 -1
  124. package/test-env/components/loading/loading_logo.js +2 -1
  125. package/test-env/components/page/page_section/page_section.js +2 -1
  126. package/test-env/components/page/page_sidebar/page_sidebar.js +2 -1
  127. package/test-env/components/page_template/page_template.js +6 -0
  128. package/test-env/components/panel/panel.js +4 -3
  129. package/test-env/components/selectable/selectable_list/selectable_list.js +8 -2
  130. package/test-env/components/selectable/selectable_list/selectable_list_item.js +6 -0
@@ -1,5 +1,5 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["children", "color", "iconType", "iconSide", "className", "isDisabled", "onClick", "iconOnClick", "onClickAriaLabel", "iconOnClickAriaLabel", "closeButtonProps", "href", "rel", "target", "style"];
2
+ var _excluded = ["children", "color", "fill", "iconType", "iconSide", "className", "isDisabled", "onClick", "iconOnClick", "onClickAriaLabel", "iconOnClickAriaLabel", "closeButtonProps", "href", "rel", "target", "style"];
3
3
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
4
4
  function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
5
5
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -39,6 +39,8 @@ export var EuiBadge = function EuiBadge(_ref) {
39
39
  var children = _ref.children,
40
40
  _ref$color = _ref.color,
41
41
  color = _ref$color === void 0 ? 'default' : _ref$color,
42
+ _ref$fill = _ref.fill,
43
+ fill = _ref$fill === void 0 ? false : _ref$fill,
42
44
  iconType = _ref.iconType,
43
45
  _ref$iconSide = _ref.iconSide,
44
46
  iconSide = _ref$iconSide === void 0 ? 'left' : _ref$iconSide,
@@ -57,6 +59,7 @@ export var EuiBadge = function EuiBadge(_ref) {
57
59
  var isHrefValid = !href || validateHref(href);
58
60
  var isDisabled = _isDisabled || !isHrefValid;
59
61
  var isNamedColor = COLORS.includes(color);
62
+ var isIconOnly = !children && !!iconType;
60
63
  var euiTheme = useEuiTheme();
61
64
  var customColorStyles = useMemo(function () {
62
65
  // Disabled badges should not have custom colors
@@ -82,7 +85,7 @@ export var EuiBadge = function EuiBadge(_ref) {
82
85
  }
83
86
  }, [color, isNamedColor, isDisabled, style, euiTheme]);
84
87
  var styles = useEuiMemoizedStyles(euiBadgeStyles);
85
- var cssStyles = [styles.euiBadge].concat(_toConsumableArray(isDisabled ? [styles.disabled] : [isNamedColor && styles[color], !iconOnClick && (onClick || href) && styles.clickable]));
88
+ var cssStyles = [styles.euiBadge, isIconOnly && styles.iconOnly].concat(_toConsumableArray(isDisabled ? [styles.disabled] : [isNamedColor && fill && styles.colors.fill[color], isNamedColor && !fill && styles.colors.base[color], !iconOnClick && (onClick || href) && styles.clickable]));
86
89
  var textCssStyles = [styles.text.euiBadge__text, (onClick || href) && !isDisabled && styles.text.clickable];
87
90
  var iconCssStyles = [styles.icon.euiBadge__icon, styles.icon[iconSide]];
88
91
  var iconButtonCssStyles = [styles.iconButton.euiBadge__iconButton, styles.iconButton[iconSide]];
@@ -127,7 +130,7 @@ export var EuiBadge = function EuiBadge(_ref) {
127
130
  } else {
128
131
  optionalIcon = ___EmotionJSX(EuiIcon, {
129
132
  type: iconType,
130
- size: children ? 's' : 'm',
133
+ size: "s",
131
134
  className: "euiBadge__icon",
132
135
  css: iconCssStyles,
133
136
  color: "inherit" // forces the icon to inherit its parent color
@@ -207,6 +210,12 @@ EuiBadge.propTypes = {
207
210
  * Accepts either our palette colors (primary, success ..etc) or a hex value `#FFFFFF`, `#000`.
208
211
  */
209
212
  color: PropTypes.oneOfType([PropTypes.any.isRequired, PropTypes.string.isRequired]),
213
+ /**
214
+ * Whether the badge should use filled (more intense) colors.
215
+ * It has no effect when a non-named color is passed to the `color` prop.
216
+ * @default false
217
+ */
218
+ fill: PropTypes.bool,
210
219
  /**
211
220
  * Will override any color passed through the `color` prop.
212
221
  */
@@ -8,7 +8,7 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
8
8
  */
9
9
 
10
10
  import { css } from '@emotion/react';
11
- import { euiFontSize, euiFocusRing, euiTextTruncate, logicalCSS, logicalShorthandCSS, logicalTextAlignCSS, mathWithUnits } from '../../global_styling';
11
+ import { euiFontSize, euiFocusRing, euiTextTruncate, highContrastModeStyles, logicalCSS, logicalShorthandCSS, logicalTextAlignCSS, mathWithUnits } from '../../global_styling';
12
12
  import { euiBadgeColors } from './color_utils';
13
13
  var _ref = process.env.NODE_ENV === "production" ? {
14
14
  name: "1jbvl30-euiBadge__iconButton",
@@ -29,28 +29,54 @@ var _ref2 = process.env.NODE_ENV === "production" ? {
29
29
  export var euiBadgeStyles = function euiBadgeStyles(euiThemeContext) {
30
30
  var euiTheme = euiThemeContext.euiTheme;
31
31
  var badgeColors = euiBadgeColors(euiThemeContext);
32
+ var defaultBadgeColors = badgeColors.fill.default;
32
33
  var setBadgeColorVars = function setBadgeColorVars(colors) {
33
- return "\n --euiBadgeTextColor: ".concat(colors.color, ";\n --euiBadgeBackgroundColor: ").concat(colors.backgroundColor, ";\n ");
34
+ return "\n --euiBadgeTextColor: ".concat(colors.color, ";\n --euiBadgeBackgroundColor: ").concat(colors.backgroundColor, ";\n ").concat(colors.border ? "--euiBadgeBorder: ".concat(colors.border, ";") : '', "\n ");
34
35
  };
36
+ var inlinePadding = mathWithUnits(
37
+ // Account for the (usually transparent) border so that the visual
38
+ // padding is of size s
39
+ [euiTheme.size.s, euiTheme.border.width.thin], function (size, borderWidth) {
40
+ return size - borderWidth;
41
+ });
35
42
  return {
36
- euiBadge: /*#__PURE__*/css("display:inline-block;vertical-align:middle;", logicalShorthandCSS('padding', "0 ".concat(euiTheme.size.s)), " ", logicalCSS('max-width', '100%'), " font-size:", euiFontSize(euiThemeContext, 'xs').fontSize, ";line-height:", mathWithUnits(
43
+ euiBadge: /*#__PURE__*/css("display:inline-block;vertical-align:middle;", logicalShorthandCSS('padding', "0 ".concat(inlinePadding)), " ", logicalCSS('max-width', '100%'), " font-size:", euiFontSize(euiThemeContext, 'xs').fontSize, ";line-height:", mathWithUnits(
37
44
  // Account for the border
38
45
  [euiTheme.size.base, euiTheme.border.width.thin], function (x, y) {
39
46
  return x + y * 2;
40
- }), ";font-weight:", euiTheme.font.weight.medium, ";white-space:nowrap;text-decoration:none;cursor:inherit;border:", euiTheme.border.width.thin, " solid transparent;border-radius:", mathWithUnits(euiTheme.border.radius.medium, function (x) {
41
- return x / 2;
42
- }), ";", logicalTextAlignCSS('left'), "color:var(--euiBadgeTextColor, ", badgeColors.default.color, ");background-color:var(\n --euiBadgeBackgroundColor,\n ", badgeColors.default.backgroundColor, "\n );*::selection{color:var(\n --euiBadgeBackgroundColor,\n ", badgeColors.default.backgroundColor, "\n );background-color:var(\n --euiBadgeTextColor,\n ", badgeColors.default.color, "\n );}&:focus-within{", euiFocusRing(euiThemeContext), ";}&+.euiBadge{", logicalCSS('margin-left', euiTheme.size.xs), ";};label:euiBadge;"),
47
+ }), ";font-weight:", euiTheme.font.weight.medium, ";white-space:nowrap;text-decoration:none;cursor:inherit;border:", euiTheme.border.width.thin, " solid transparent;border-radius:", euiTheme.size.l, ";", logicalTextAlignCSS('left'), "color:var(--euiBadgeTextColor, ", defaultBadgeColors.color, ");background-color:var(\n --euiBadgeBackgroundColor,\n ", defaultBadgeColors.backgroundColor, "\n );", highContrastModeStyles(euiThemeContext, {
48
+ preferred: "border: var(--euiBadgeBorder, ".concat(euiTheme.border.thin, ");")
49
+ }), "*::selection{color:var(\n --euiBadgeBackgroundColor,\n ", defaultBadgeColors.backgroundColor, "\n );background-color:var(--euiBadgeTextColor, ", defaultBadgeColors.color, ");}&:focus-within{", euiFocusRing(euiThemeContext), ";}&+.euiBadge{", logicalCSS('margin-left', euiTheme.size.xs), ";};label:euiBadge;"),
50
+ iconOnly: /*#__PURE__*/css("padding-inline:", mathWithUnits(
51
+ // Account for the border
52
+ [euiTheme.size.xs, euiTheme.border.width.thin], function (size, borderWidth) {
53
+ return size - borderWidth;
54
+ }), ";;label:iconOnly;"),
43
55
  clickable: /*#__PURE__*/css("&:not(:disabled){&:hover,&:focus{text-decoration:underline;}}&:focus{", euiFocusRing(euiThemeContext), ";}&:disabled{cursor:not-allowed;};label:clickable;"),
44
- // Colors
45
- default: /*#__PURE__*/css(setBadgeColorVars(badgeColors.default), " border-color:", badgeColors.default.borderColor, ";;label:default;"),
46
- hollow: /*#__PURE__*/css(setBadgeColorVars(badgeColors.hollow), " border-color:", badgeColors.hollow.borderColor, ";;label:hollow;"),
47
- primary: /*#__PURE__*/css(setBadgeColorVars(badgeColors.primary), ";label:primary;"),
48
- accent: /*#__PURE__*/css(setBadgeColorVars(badgeColors.accent), ";label:accent;"),
49
- neutral: /*#__PURE__*/css(setBadgeColorVars(badgeColors.neutral), ";label:neutral;"),
50
- success: /*#__PURE__*/css(setBadgeColorVars(badgeColors.success), ";label:success;"),
51
- warning: /*#__PURE__*/css(setBadgeColorVars(badgeColors.warning), ";label:warning;"),
52
- risk: /*#__PURE__*/css(setBadgeColorVars(badgeColors.risk), ";label:risk;"),
53
- danger: /*#__PURE__*/css(setBadgeColorVars(badgeColors.danger), ";label:danger;"),
56
+ colors: {
57
+ fill: {
58
+ default: /*#__PURE__*/css(setBadgeColorVars(badgeColors.fill.default), " border-color:", badgeColors.fill.default.borderColor, ";;label:default;"),
59
+ hollow: /*#__PURE__*/css(setBadgeColorVars(badgeColors.hollow), " border-color:", badgeColors.hollow.borderColor, ";;label:hollow;"),
60
+ primary: /*#__PURE__*/css(setBadgeColorVars(badgeColors.fill.primary), ";label:primary;"),
61
+ accent: /*#__PURE__*/css(setBadgeColorVars(badgeColors.fill.accent), ";label:accent;"),
62
+ neutral: /*#__PURE__*/css(setBadgeColorVars(badgeColors.fill.neutral), ";label:neutral;"),
63
+ success: /*#__PURE__*/css(setBadgeColorVars(badgeColors.fill.success), ";label:success;"),
64
+ warning: /*#__PURE__*/css(setBadgeColorVars(badgeColors.fill.warning), ";label:warning;"),
65
+ risk: /*#__PURE__*/css(setBadgeColorVars(badgeColors.fill.risk), ";label:risk;"),
66
+ danger: /*#__PURE__*/css(setBadgeColorVars(badgeColors.fill.danger), ";label:danger;")
67
+ },
68
+ base: {
69
+ default: /*#__PURE__*/css(setBadgeColorVars(badgeColors.base.default), " border-color:", badgeColors.base.default.borderColor, ";;label:default;"),
70
+ hollow: /*#__PURE__*/css(setBadgeColorVars(badgeColors.hollow), " border-color:", badgeColors.hollow.borderColor, ";;label:hollow;"),
71
+ primary: /*#__PURE__*/css(setBadgeColorVars(badgeColors.base.primary), ";label:primary;"),
72
+ accent: /*#__PURE__*/css(setBadgeColorVars(badgeColors.base.accent), ";label:accent;"),
73
+ neutral: /*#__PURE__*/css(setBadgeColorVars(badgeColors.base.neutral), ";label:neutral;"),
74
+ success: /*#__PURE__*/css(setBadgeColorVars(badgeColors.base.success), ";label:success;"),
75
+ warning: /*#__PURE__*/css(setBadgeColorVars(badgeColors.base.warning), ";label:warning;"),
76
+ risk: /*#__PURE__*/css(setBadgeColorVars(badgeColors.base.risk), ";label:risk;"),
77
+ danger: /*#__PURE__*/css(setBadgeColorVars(badgeColors.base.danger), ";label:danger;")
78
+ }
79
+ },
54
80
  disabled: /*#__PURE__*/css(setBadgeColorVars(badgeColors.disabled), " border-color:", badgeColors.disabled.borderColor, ";*::selection{color:", euiTheme.colors.emptyShade, ";};label:disabled;"),
55
81
  // Content wrapper
56
82
  euiBadge__content: /*#__PURE__*/css(logicalCSS(
@@ -60,20 +86,20 @@ export var euiBadgeStyles = function euiBadgeStyles(euiThemeContext) {
60
86
  }))), " display:flex;align-items:center;overflow:hidden;;label:euiBadge__content;"),
61
87
  // Text
62
88
  text: {
63
- euiBadge__text: /*#__PURE__*/css(euiTextTruncate(), " cursor:inherit;;label:euiBadge__text;"),
89
+ euiBadge__text: /*#__PURE__*/css(euiTextTruncate(), " padding-inline:", euiTheme.size.xxs, ";cursor:inherit;;label:euiBadge__text;"),
64
90
  clickable: _ref2
65
91
  },
66
92
  // Icon
67
93
  icon: {
68
94
  euiBadge__icon: /*#__PURE__*/css(";label:euiBadge__icon;"),
69
- right: /*#__PURE__*/css("&:not(:only-child){", logicalCSS('margin-left', euiTheme.size.xs), ";};label:right;"),
70
- left: /*#__PURE__*/css("&:not(:only-child){", logicalCSS('margin-right', euiTheme.size.xs), ";};label:left;")
95
+ right: /*#__PURE__*/css("&:not(:only-child){", logicalCSS('margin-left', euiTheme.size.xxs), ";};label:right;"),
96
+ left: /*#__PURE__*/css("&:not(:only-child){", logicalCSS('margin-right', euiTheme.size.xxs), ";};label:left;")
71
97
  },
72
98
  // Clickable icons (iconOnClick)
73
99
  iconButton: {
74
100
  euiBadge__iconButton: _ref,
75
- right: /*#__PURE__*/css(logicalCSS('margin-left', euiTheme.size.xs), ";;label:right;"),
76
- left: /*#__PURE__*/css(logicalCSS('margin-right', euiTheme.size.xs), ";;label:left;")
101
+ right: /*#__PURE__*/css(logicalCSS('margin-left', euiTheme.size.xxs), ";;label:right;"),
102
+ left: /*#__PURE__*/css(logicalCSS('margin-right', euiTheme.size.xxs), ";;label:left;")
77
103
  },
78
104
  // Used in badges with both onClick & iconOnClick
79
105
  euiBadge__childButton: /*#__PURE__*/css(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;")
@@ -49,10 +49,10 @@ export var euiBetaBadgeStyles = function euiBetaBadgeStyles(euiThemeContext) {
49
49
  color: colorMode === 'DARK' ? euiTheme.colors.ghost : euiTheme.colors.ink
50
50
  }), ";};label:euiBetaBadge;"),
51
51
  // Colors
52
- accent: /*#__PURE__*/css(badgeColors.accent, ";label:accent;"),
52
+ accent: /*#__PURE__*/css(badgeColors.fill.accent, ";label:accent;"),
53
53
  subdued: /*#__PURE__*/css(badgeColors.subdued, ";label:subdued;"),
54
54
  hollow: /*#__PURE__*/css("color:", badgeColors.hollow.color, ";background-color:", badgeColors.hollow.backgroundColor, ";border-color:", badgeColors.hollow.borderColor, ";;label:hollow;"),
55
- warning: /*#__PURE__*/css(badgeColors.warning, ";label:warning;"),
55
+ warning: /*#__PURE__*/css(badgeColors.fill.warning, ";label:warning;"),
56
56
  // Font sizes
57
57
  m: /*#__PURE__*/css("font-size:", euiFontSizeFromScale('xs', euiTheme), ";line-height:", badgeSizes.m, ";;label:m;"),
58
58
  s: /*#__PURE__*/css("font-size:0.7rem;line-height:", badgeSizes.s, ";;label:s;"),
@@ -26,7 +26,7 @@ export var euiBadgeColors = function euiBadgeColors(euiThemeContext) {
26
26
  var euiTheme = euiThemeContext.euiTheme,
27
27
  highContrastMode = euiThemeContext.highContrastMode;
28
28
  var badgeColorsAccentText = getBadgeColors(euiThemeContext, euiTheme.colors.textAccent);
29
- return {
29
+ var fill = {
30
30
  // Colors shared between buttons and badges
31
31
  primary: euiButtonFillColor(euiThemeContext, 'primary'),
32
32
  neutral: euiButtonFillColor(euiThemeContext, 'neutral'),
@@ -35,12 +35,28 @@ export var euiBadgeColors = function euiBadgeColors(euiThemeContext) {
35
35
  risk: euiButtonFillColor(euiThemeContext, 'risk'),
36
36
  danger: euiButtonFillColor(euiThemeContext, 'danger'),
37
37
  accent: euiButtonFillColor(euiThemeContext, 'accent'),
38
- disabled: _objectSpread(_objectSpread({}, euiButtonColor(euiThemeContext, 'disabled')), {}, {
39
- borderColor: highContrastMode ? euiTheme.colors.textDisabled : ''
40
- }),
41
38
  // Colors unique to badges
42
39
  default: _objectSpread(_objectSpread({}, getBadgeColors(euiThemeContext, euiTheme.components.badgeBackground)), {}, {
43
40
  borderColor: highContrastMode ? euiTheme.border.color : ''
41
+ })
42
+ };
43
+ var base = {
44
+ primary: euiButtonColor(euiThemeContext, 'primary'),
45
+ neutral: euiButtonColor(euiThemeContext, 'neutral'),
46
+ success: euiButtonColor(euiThemeContext, 'success'),
47
+ warning: euiButtonColor(euiThemeContext, 'warning'),
48
+ risk: euiButtonColor(euiThemeContext, 'risk'),
49
+ danger: euiButtonColor(euiThemeContext, 'danger'),
50
+ accent: euiButtonColor(euiThemeContext, 'accent'),
51
+ default: _objectSpread(_objectSpread({}, getBadgeColors(euiThemeContext, euiTheme.colors.backgroundLightText)), {}, {
52
+ borderColor: highContrastMode ? euiTheme.border.color : ''
53
+ })
54
+ };
55
+ return {
56
+ fill: fill,
57
+ base: base,
58
+ disabled: _objectSpread(_objectSpread({}, euiButtonColor(euiThemeContext, 'disabled')), {}, {
59
+ borderColor: highContrastMode ? euiTheme.colors.textDisabled : ''
44
60
  }),
45
61
  // Hollow has a border and is used for autocompleters and beta badges
46
62
  hollow: _objectSpread(_objectSpread({}, getBadgeColors(euiThemeContext, euiTheme.colors.emptyShade)), {}, {
@@ -67,9 +83,6 @@ export var getTextColor = function getTextColor(_ref, bgColor) {
67
83
  var textColor = isColorDark.apply(void 0, _toConsumableArray(chroma(bgColor).rgb())) ? euiTheme.colors.ghost : euiTheme.colors.ink;
68
84
  return textColor;
69
85
  };
70
- export var getColorContrast = function getColorContrast(textColor, color) {
71
- return chroma.contrast(textColor, color);
72
- };
73
86
  export var getIsValidColor = function getIsValidColor(color) {
74
87
  return chromaValid(parseColor(color || '') || '');
75
88
  };
@@ -27,7 +27,7 @@ export var euiNotificationBadgeStyles = function euiNotificationBadgeStyles(euiT
27
27
  })), " ", logicalCSS('min-width', euiTheme.size.l), ";;label:m;"),
28
28
  // Colors
29
29
  accent: /*#__PURE__*/css(badgeColors.accentText, ";label:accent;"),
30
- success: /*#__PURE__*/css(badgeColors.success, ";label:success;"),
30
+ success: /*#__PURE__*/css(badgeColors.fill.success, ";label:success;"),
31
31
  subdued: /*#__PURE__*/css(badgeColors.subdued, ";label:subdued;")
32
32
  };
33
33
  };
@@ -139,4 +139,5 @@ EuiButton.propTypes = {
139
139
  }),
140
140
  style: PropTypes.any,
141
141
  type: PropTypes.any
142
- };
142
+ };
143
+ EuiButton.displayName = 'EuiButton';
@@ -216,4 +216,5 @@ EuiButtonEmpty.propTypes = {
216
216
  * Use e.g. when a disabled button should have a tooltip.
217
217
  */
218
218
  hasAriaDisabled: PropTypes.bool
219
- };
219
+ };
220
+ EuiButtonEmpty.displayName = 'EuiButtonEmpty';
@@ -1,6 +1,7 @@
1
1
  var _excluded = ["isSeparator", "key"],
2
2
  _excluded2 = ["panel", "name", "key", "icon", "onClick"],
3
- _excluded3 = ["stylesMemoizer", "panels", "onPanelChange", "className", "initialPanelId", "size"];
3
+ _excluded3 = ["id", "title", "items", "content", "width", "initialFocusedItemIndex", "size"],
4
+ _excluded4 = ["stylesMemoizer", "panels", "onPanelChange", "className", "initialPanelId", "size"];
4
5
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
5
6
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
6
7
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
@@ -253,6 +254,14 @@ export var EuiContextMenuClass = /*#__PURE__*/function (_Component) {
253
254
  if (!panel) {
254
255
  return;
255
256
  }
257
+ var _id = panel.id,
258
+ title = panel.title,
259
+ _items = panel.items,
260
+ content = panel.content,
261
+ _width = panel.width,
262
+ initialFocusedItemIndex = panel.initialFocusedItemIndex,
263
+ _size = panel.size,
264
+ rest = _objectWithoutProperties(panel, _excluded3);
256
265
 
257
266
  // As above, we need to wait for EuiOutsideClickDetector to complete its logic before
258
267
  // re-rendering via showPanel.
@@ -266,22 +275,22 @@ export var EuiContextMenuClass = /*#__PURE__*/function (_Component) {
266
275
  position: 'absolute',
267
276
  label: 'euiContextMenu__panel'
268
277
  };
269
- return ___EmotionJSX(EuiContextMenuPanel, {
278
+ return ___EmotionJSX(EuiContextMenuPanel, _extends({
270
279
  key: panelId,
271
280
  size: this.props.size,
272
281
  css: cssStyles,
273
282
  onHeightChange: transitionType === 'in' ? this.onIncomingPanelHeightChange : undefined,
274
283
  onTransitionComplete: transitionType === 'out' ? this.onOutGoingPanelTransitionComplete : undefined,
275
- title: panel.title,
284
+ title: title,
276
285
  onClose: onClose,
277
286
  transitionType: this.state.isOutgoingPanelVisible ? transitionType : undefined,
278
287
  transitionDirection: this.state.isOutgoingPanelVisible ? this.state.transitionDirection : undefined,
279
288
  items: this.state.idToRenderedItemsMap[panelId],
280
- initialFocusedItemIndex: this.state.isUsingKeyboardToNavigate ? this.state.focusedItemIndex : panel.initialFocusedItemIndex,
289
+ initialFocusedItemIndex: this.state.isUsingKeyboardToNavigate ? this.state.focusedItemIndex : initialFocusedItemIndex,
281
290
  onUseKeyboardToNavigate: this.onUseKeyboardToNavigate,
282
291
  showNextPanel: this.showNextPanel,
283
292
  showPreviousPanel: this.showPreviousPanel
284
- }, panel.content);
293
+ }, rest), content);
285
294
  }
286
295
  }, {
287
296
  key: "render",
@@ -293,7 +302,7 @@ export var EuiContextMenuClass = /*#__PURE__*/function (_Component) {
293
302
  className = _this$props2.className,
294
303
  initialPanelId = _this$props2.initialPanelId,
295
304
  size = _this$props2.size,
296
- rest = _objectWithoutProperties(_this$props2, _excluded3);
305
+ rest = _objectWithoutProperties(_this$props2, _excluded4);
297
306
  var incomingPanel = this.renderPanel(this.state.incomingPanelId, 'in');
298
307
  var outgoingPanel;
299
308
  if (this.state.isOutgoingPanelVisible) {
@@ -367,7 +376,11 @@ EuiContextMenuClass.propTypes = {
367
376
  /**
368
377
  * Alters the size of the items and the title
369
378
  */
370
- size: PropTypes.any
379
+ size: PropTypes.any,
380
+ className: PropTypes.string,
381
+ "aria-label": PropTypes.string,
382
+ "data-test-subj": PropTypes.string,
383
+ css: PropTypes.any
371
384
  }).isRequired),
372
385
  /**
373
386
  * Optional callback that fires on every panel change. Passes back
@@ -679,6 +679,12 @@ EuiSuperDatePickerInternal.propTypes = {
679
679
  * @default true
680
680
  */
681
681
  showZoomOut: PropTypes.bool,
682
+ /**
683
+ * Show button for zooming in.
684
+ * Defaults to false because it's a less common use case
685
+ * @default false
686
+ */
687
+ showZoomIn: PropTypes.bool,
682
688
  /**
683
689
  * Show buttons for shifting the time window forward and backward
684
690
  * @default true
@@ -917,6 +923,7 @@ EuiSuperDatePicker.propTypes = {
917
923
  */
918
924
  showTimeWindowButtons: PropTypes.oneOfType([PropTypes.bool.isRequired, PropTypes.shape({
919
925
  showZoomOut: PropTypes.bool,
926
+ showZoomIn: PropTypes.bool,
920
927
  showShiftArrows: PropTypes.bool,
921
928
  zoomFactor: PropTypes.oneOfType([PropTypes.number.isRequired, PropTypes.string.isRequired])
922
929
  }).isRequired]),
@@ -17,6 +17,7 @@ import { useEuiMemoizedStyles, useGeneratedHtmlId } from '../../../services';
17
17
  import { useEuiI18n } from '../../i18n';
18
18
  import { jsx as ___EmotionJSX } from "@emotion/react";
19
19
  export var ZOOM_FACTOR_DEFAULT = 0.5;
20
+ export var ZOOM_DELTA_FALLBACK_MS = 500;
20
21
  /**
21
22
  * Button group with time window controls for shifting the time window
22
23
  * forwards and backwards, and zooming out.
@@ -29,6 +30,8 @@ export var EuiTimeWindowButtons = function EuiTimeWindowButtons(_ref) {
29
30
  isDisabled = _ref.isDisabled,
30
31
  _ref$showZoomOut = _ref.showZoomOut,
31
32
  showZoomOut = _ref$showZoomOut === void 0 ? true : _ref$showZoomOut,
33
+ _ref$showZoomIn = _ref.showZoomIn,
34
+ showZoomIn = _ref$showZoomIn === void 0 ? false : _ref$showZoomIn,
32
35
  _ref$showShiftArrows = _ref.showShiftArrows,
33
36
  showShiftArrows = _ref$showShiftArrows === void 0 ? true : _ref$showShiftArrows,
34
37
  _ref$zoomFactor = _ref.zoomFactor,
@@ -44,16 +47,29 @@ export var EuiTimeWindowButtons = function EuiTimeWindowButtons(_ref) {
44
47
  isInvalid = _useEuiTimeWindow.isInvalid,
45
48
  stepForward = _useEuiTimeWindow.stepForward,
46
49
  stepBackward = _useEuiTimeWindow.stepBackward,
47
- expandWindow = _useEuiTimeWindow.expandWindow;
50
+ expandWindow = _useEuiTimeWindow.expandWindow,
51
+ shrinkWindow = _useEuiTimeWindow.shrinkWindow,
52
+ isWindowDurationZero = _useEuiTimeWindow.isWindowDurationZero;
53
+ var previousDescription = useEuiI18n('euiTimeWindowButtons.previousDescription', 'Previous {displayInterval}', {
54
+ displayInterval: displayInterval
55
+ });
56
+ var nextDescription = useEuiI18n('euiTimeWindowButtons.nextDescription', 'Next {displayInterval}', {
57
+ displayInterval: displayInterval
58
+ });
48
59
  var invalidShiftDescription = useEuiI18n('euiTimeWindowButtons.invalidShiftLabel', 'Cannot shift invalid time window');
60
+ var invalidZoomInDescription = useEuiI18n('euiTimeWindowButtons.invalidZoomInLabel', 'Cannot zoom in invalid time window');
61
+ var cannotZoomInDescription = useEuiI18n('euiTimeWindowButtons.cannotZoomInLabel', 'Cannot zoom in any further');
49
62
  var invalidZoomOutDescription = useEuiI18n('euiTimeWindowButtons.invalidZoomOutLabel', 'Cannot zoom out invalid time window');
50
63
  var previousId = useGeneratedHtmlId({
51
64
  prefix: 'previous'
52
65
  });
53
66
  var previousLabel = useEuiI18n('euiTimeWindowButtons.previousLabel', 'Previous');
54
- var previousTooltipContent = useEuiI18n('euiTimeWindowButtons.previousDescription', 'Previous {displayInterval}', {
55
- displayInterval: displayInterval
67
+ var previousTooltipContent = isInvalid ? invalidShiftDescription : previousDescription;
68
+ var zoomInId = useGeneratedHtmlId({
69
+ prefix: 'zoom_in'
56
70
  });
71
+ var zoomInLabel = useEuiI18n('euiTimeWindowButtons.zoomInLabel', 'Zoom in');
72
+ var zoomInTooltipContent = isInvalid ? invalidZoomInDescription : isWindowDurationZero ? cannotZoomInDescription : zoomInLabel;
57
73
  var zoomOutId = useGeneratedHtmlId({
58
74
  prefix: 'zoom_out'
59
75
  });
@@ -63,10 +79,8 @@ export var EuiTimeWindowButtons = function EuiTimeWindowButtons(_ref) {
63
79
  prefix: 'next'
64
80
  });
65
81
  var nextLabel = useEuiI18n('euiTimeWindowButtons.nextLabel', 'Next');
66
- var nextTooltipContent = useEuiI18n('euiTimeWindowButtons.nextDescription', 'Next {displayInterval}', {
67
- displayInterval: displayInterval
68
- });
69
- if (!showZoomOut && !showShiftArrows) return null;
82
+ var nextTooltipContent = isInvalid ? invalidShiftDescription : nextDescription;
83
+ if (!showZoomIn && !showZoomOut && !showShiftArrows) return null;
70
84
  return ___EmotionJSX("div", {
71
85
  className: "euiSuperDatePicker__timeWindowButtons",
72
86
  css: [styles.euiButtonGroup__buttons, styles[buttonSize], ";label:EuiTimeWindowButtons;"],
@@ -76,15 +90,30 @@ export var EuiTimeWindowButtons = function EuiTimeWindowButtons(_ref) {
76
90
  "data-test-subj": "timeWindowButtonsPrevious",
77
91
  label: previousLabel,
78
92
  title: "",
79
- toolTipContent: !isDisabled && (isInvalid ? invalidShiftDescription : previousTooltipContent),
93
+ toolTipContent: !isDisabled && previousTooltipContent,
80
94
  color: buttonColor,
81
95
  size: buttonSize,
82
96
  iconType: "arrowLeft",
83
97
  iconSize: iconSize,
84
98
  isIconOnly: true,
85
- isSelected: false,
86
- isDisabled: isDisabled,
99
+ isDisabled: isWindowDurationZero || isDisabled,
87
100
  onClick: stepBackward
101
+ }), showZoomIn && ___EmotionJSX(EuiButtonGroupButton, {
102
+ id: zoomInId,
103
+ "data-test-subj": "timeWindowButtonsZoomIn",
104
+ label: zoomInLabel,
105
+ title: "",
106
+ toolTipContent: !isDisabled && zoomInTooltipContent,
107
+ toolTipProps: {
108
+ disableScreenReaderOutput: zoomInLabel === zoomInTooltipContent
109
+ },
110
+ color: buttonColor,
111
+ size: buttonSize,
112
+ iconType: "magnifyWithPlus",
113
+ iconSize: iconSize,
114
+ isIconOnly: true,
115
+ isDisabled: isWindowDurationZero || isDisabled,
116
+ onClick: shrinkWindow
88
117
  }), showZoomOut && ___EmotionJSX(EuiButtonGroupButton, {
89
118
  id: zoomOutId,
90
119
  "data-test-subj": "timeWindowButtonsZoomOut",
@@ -99,7 +128,6 @@ export var EuiTimeWindowButtons = function EuiTimeWindowButtons(_ref) {
99
128
  iconType: "magnifyWithMinus",
100
129
  iconSize: iconSize,
101
130
  isIconOnly: true,
102
- isSelected: false,
103
131
  isDisabled: isDisabled,
104
132
  onClick: expandWindow
105
133
  }), showShiftArrows && ___EmotionJSX(EuiButtonGroupButton, {
@@ -107,14 +135,13 @@ export var EuiTimeWindowButtons = function EuiTimeWindowButtons(_ref) {
107
135
  "data-test-subj": "timeWindowButtonsNext",
108
136
  label: nextLabel,
109
137
  title: "",
110
- toolTipContent: !isDisabled && (isInvalid ? invalidShiftDescription : nextTooltipContent),
138
+ toolTipContent: !isDisabled && nextTooltipContent,
111
139
  color: buttonColor,
112
140
  size: buttonSize,
113
141
  iconType: "arrowRight",
114
142
  iconSize: iconSize,
115
143
  isIconOnly: true,
116
- isSelected: false,
117
- isDisabled: isDisabled,
144
+ isDisabled: isWindowDurationZero || isDisabled,
118
145
  onClick: stepForward
119
146
  }));
120
147
  };
@@ -129,9 +156,10 @@ export function useEuiTimeWindow(start, end, apply, options) {
129
156
  roundUp: true
130
157
  });
131
158
  var isInvalid = !min || !min.isValid() || !max || !max.isValid();
132
- var windowDuration = isInvalid ? 1 : max.diff(min);
159
+ var windowDuration = isInvalid ? -1 : max.diff(min);
160
+ var isWindowDurationZero = windowDuration === 0;
133
161
  var zoomFactor = getPercentageMultiplier((_options$zoomFactor = options === null || options === void 0 ? void 0 : options.zoomFactor) !== null && _options$zoomFactor !== void 0 ? _options$zoomFactor : ZOOM_FACTOR_DEFAULT);
134
- var zoomAddition = windowDuration * (zoomFactor / 2); // Gets added to each end, that's why it's split in half
162
+ var zoomDelta = windowDuration * (zoomFactor / 2); // Gets added to each end, that's why it's split in half
135
163
  var prettyInterval = usePrettyInterval(false, windowDuration);
136
164
  var displayInterval = isInvalid ? '' : prettyInterval;
137
165
  if (!isInvalid && !isRelativeToNow(start, end) && !isExactMinuteRange(windowDuration)) {
@@ -142,17 +170,19 @@ export function useEuiTimeWindow(start, end, apply, options) {
142
170
  isInvalid: isInvalid,
143
171
  stepForward: stepForward,
144
172
  stepBackward: stepBackward,
145
- expandWindow: expandWindow
173
+ expandWindow: expandWindow,
174
+ shrinkWindow: shrinkWindow,
175
+ isWindowDurationZero: isWindowDurationZero
146
176
  };
147
177
  function stepForward() {
148
- if (isInvalid) return;
178
+ if (isInvalid || isWindowDurationZero) return;
149
179
  apply({
150
180
  start: moment(max).toISOString(),
151
181
  end: moment(max).add(windowDuration, 'ms').toISOString()
152
182
  });
153
183
  }
154
184
  function stepBackward() {
155
- if (isInvalid) return;
185
+ if (isInvalid || isWindowDurationZero) return;
156
186
  apply({
157
187
  start: moment(min).subtract(windowDuration, 'ms').toISOString(),
158
188
  end: moment(min).toISOString()
@@ -160,20 +190,39 @@ export function useEuiTimeWindow(start, end, apply, options) {
160
190
  }
161
191
  function expandWindow() {
162
192
  if (isInvalid) return;
193
+ // when the window is 0 it'll remain 0 unless we help it a little
194
+ var addition = zoomDelta === 0 ? ZOOM_DELTA_FALLBACK_MS : zoomDelta;
163
195
  apply({
164
- start: moment(min).subtract(zoomAddition, 'ms').toISOString(),
165
- end: moment(max).add(zoomAddition, 'ms').toISOString()
196
+ start: moment(min).subtract(addition, 'ms').toISOString(),
197
+ end: moment(max).add(addition, 'ms').toISOString()
198
+ });
199
+ }
200
+ function shrinkWindow() {
201
+ if (isInvalid || isWindowDurationZero) return;
202
+ apply({
203
+ start: moment(min).add(zoomDelta, 'ms').toISOString(),
204
+ end: moment(max).subtract(zoomDelta, 'ms').toISOString()
166
205
  });
167
206
  }
168
207
  }
169
208
 
170
209
  /**
171
- * Get a number out of either 0.2 or "20%"
210
+ * Convert strings with % to a multiplier e.g. "50%" = 0.5
211
+ * Strings without % are returned as-is as number
172
212
  */
173
213
  function getPercentageMultiplier(value) {
174
- var result = typeof value === 'number' ? value : parseFloat(String(value).replace('%', '').trim());
175
- if (isNaN(result)) throw new TypeError('Please provide a valid number or percentage string e.g. "25%"');
176
- return result > 1 ? result / 100 : result;
214
+ if (typeof value === 'string' && value.includes('%')) {
215
+ var parsed = parseFloat(value.replace('%', '').trim());
216
+ if (isNaN(parsed)) {
217
+ throw new TypeError('Invalid percentage string');
218
+ }
219
+ return parsed / 100;
220
+ }
221
+ var result = typeof value === 'number' ? value : parseFloat(String(value));
222
+ if (isNaN(result)) {
223
+ throw new TypeError('Please provide a valid number or percentage string e.g. "25%"');
224
+ }
225
+ return result;
177
226
  }
178
227
 
179
228
  /**
@@ -166,4 +166,5 @@ EuiDescriptionList.propTypes = {
166
166
  * sizing, keywords, and sizing functions](https://css-tricks.com/snippets/css/complete-guide-grid/#aa-special-units-functions).
167
167
  */
168
168
  columnWidths: PropTypes.any
169
- };
169
+ };
170
+ EuiDescriptionList.displayName = 'EuiDescriptionList';
@@ -58,4 +58,5 @@ EuiDescriptionListDescription.propTypes = {
58
58
  "aria-label": PropTypes.string,
59
59
  "data-test-subj": PropTypes.string,
60
60
  css: PropTypes.any
61
- };
61
+ };
62
+ EuiDescriptionListDescription.displayName = 'EuiDescriptionListDescription';
@@ -62,4 +62,5 @@ EuiDescriptionListTitle.propTypes = {
62
62
  "aria-label": PropTypes.string,
63
63
  "data-test-subj": PropTypes.string,
64
64
  css: PropTypes.any
65
- };
65
+ };
66
+ EuiDescriptionListTitle.displayName = 'EuiDescriptionListTitle';
@@ -179,4 +179,5 @@ EuiEmptyPrompt.propTypes = {
179
179
  * Padding applied around the content and footer.
180
180
  */
181
181
  paddingSize: PropTypes.any
182
- };
182
+ };
183
+ EuiEmptyPrompt.displayName = 'EuiEmptyPrompt';
@@ -95,4 +95,5 @@ EuiFlexGrid.propTypes = {
95
95
  * @default div
96
96
  */
97
97
  component: PropTypes.any
98
- };
98
+ };
99
+ EuiFlexGrid.displayName = 'EuiFlexGrid';