@elastic/eui 59.0.1 → 59.2.0-rc1

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 (231) hide show
  1. package/dist/eui_charts_theme.js +330 -330
  2. package/dist/eui_charts_theme.js.map +1 -1
  3. package/dist/eui_theme_dark.css +2 -184
  4. package/dist/eui_theme_dark.json +0 -6
  5. package/dist/eui_theme_dark.json.d.ts +0 -6
  6. package/dist/eui_theme_dark.min.css +1 -1
  7. package/dist/eui_theme_light.css +2 -184
  8. package/dist/eui_theme_light.json +0 -6
  9. package/dist/eui_theme_light.json.d.ts +0 -6
  10. package/dist/eui_theme_light.min.css +1 -1
  11. package/es/components/accessibility/skip_link/skip_link.js +39 -2
  12. package/es/components/accessibility/skip_link/skip_link.styles.js +1 -1
  13. package/es/components/button/{button_content.js → _button_content_deprecated.js} +4 -3
  14. package/es/components/button/button.js +16 -10
  15. package/es/components/button/button_display/_button_display.js +141 -0
  16. package/es/components/button/button_display/_button_display.styles.js +53 -0
  17. package/es/components/button/button_display/_button_display_content.js +100 -0
  18. package/es/components/button/button_display/_button_display_content.styles.js +61 -0
  19. package/es/components/button/button_empty/button_empty.js +3 -2
  20. package/es/components/button/button_group/button_group.js +2 -1
  21. package/es/components/button/button_group/button_group_button.js +3 -2
  22. package/es/components/card/card.js +2 -1
  23. package/es/components/card/card_select.js +2 -1
  24. package/es/components/combo_box/matching_options.js +3 -2
  25. package/es/components/date_picker/auto_refresh/auto_refresh.js +2 -1
  26. package/es/components/facet/facet_button.js +31 -15
  27. package/es/components/facet/facet_button.styles.js +64 -0
  28. package/es/components/facet/facet_group.js +12 -23
  29. package/es/components/facet/facet_group.styles.js +79 -0
  30. package/es/components/header/header_links/header_link.js +2 -1
  31. package/es/components/loading/loading_spinner.js +14 -3
  32. package/es/components/loading/loading_spinner.styles.js +4 -4
  33. package/es/components/notification/notification_event.js +2 -1
  34. package/es/components/pagination/pagination_button.js +2 -1
  35. package/es/components/provider/cache/cache_provider.js +17 -0
  36. package/es/components/provider/cache/index.js +8 -0
  37. package/es/components/provider/index.js +1 -1
  38. package/es/components/provider/provider.js +35 -5
  39. package/es/components/selectable/selectable.js +39 -22
  40. package/es/components/stat/stat.js +28 -35
  41. package/es/components/stat/stat.styles.js +38 -0
  42. package/es/components/timeline/timeline.js +15 -8
  43. package/es/components/timeline/timeline.styles.js +29 -0
  44. package/es/components/timeline/timeline_item.js +4 -16
  45. package/es/components/timeline/timeline_item.styles.js +18 -3
  46. package/es/components/timeline/timeline_item_icon.styles.js +14 -4
  47. package/es/global_styling/functions/logicals.js +2 -2
  48. package/es/global_styling/utility/utility.js +27 -0
  49. package/es/services/theme/hooks.js +2 -2
  50. package/es/services/theme/provider.js +1 -5
  51. package/es/test/emotion-prefix.js +29 -0
  52. package/es/test/index.d.ts +5 -0
  53. package/es/test/index.js +2 -1
  54. package/es/themes/amsterdam/index.js +9 -0
  55. package/es/themes/index.js +2 -1
  56. package/eui.d.ts +290 -52
  57. package/i18ntokens.json +16 -16
  58. package/lib/components/accessibility/skip_link/skip_link.js +39 -2
  59. package/lib/components/accessibility/skip_link/skip_link.styles.js +1 -1
  60. package/lib/components/button/{button_content.js → _button_content_deprecated.js} +6 -5
  61. package/lib/components/button/button.js +19 -13
  62. package/lib/components/button/button_display/_button_display.js +146 -0
  63. package/lib/components/button/button_display/_button_display.styles.js +59 -0
  64. package/lib/components/button/button_display/_button_display_content.js +111 -0
  65. package/lib/components/button/button_display/_button_display_content.styles.js +64 -0
  66. package/lib/components/button/button_empty/button_empty.js +4 -3
  67. package/lib/components/button/button_group/button_group.js +2 -1
  68. package/lib/components/button/button_group/button_group_button.js +3 -2
  69. package/lib/components/card/card.js +2 -1
  70. package/lib/components/card/card_select.js +2 -1
  71. package/lib/components/combo_box/matching_options.js +3 -2
  72. package/lib/components/date_picker/auto_refresh/auto_refresh.js +2 -1
  73. package/lib/components/facet/facet_button.js +35 -15
  74. package/lib/components/facet/facet_button.styles.js +79 -0
  75. package/lib/components/facet/facet_group.js +12 -23
  76. package/lib/components/facet/facet_group.styles.js +82 -0
  77. package/lib/components/header/header_links/header_link.js +2 -1
  78. package/lib/components/loading/loading_spinner.js +14 -3
  79. package/lib/components/loading/loading_spinner.styles.js +4 -4
  80. package/lib/components/notification/notification_event.js +2 -1
  81. package/lib/components/provider/cache/cache_provider.js +29 -0
  82. package/lib/components/provider/cache/index.js +18 -0
  83. package/lib/components/provider/index.js +12 -7
  84. package/lib/components/provider/provider.js +36 -5
  85. package/lib/components/selectable/selectable.js +39 -22
  86. package/lib/components/stat/stat.js +30 -40
  87. package/lib/components/stat/stat.styles.js +45 -0
  88. package/lib/components/timeline/timeline.js +20 -9
  89. package/lib/components/timeline/timeline.styles.js +39 -0
  90. package/lib/components/timeline/timeline_item.js +4 -17
  91. package/lib/components/timeline/timeline_item.styles.js +17 -10
  92. package/lib/components/timeline/timeline_item_icon.styles.js +15 -4
  93. package/lib/global_styling/functions/logicals.js +2 -2
  94. package/lib/global_styling/utility/utility.js +31 -0
  95. package/lib/services/theme/hooks.js +2 -2
  96. package/lib/services/theme/provider.js +3 -6
  97. package/lib/test/emotion-prefix.js +38 -0
  98. package/lib/test/index.d.ts +5 -0
  99. package/lib/test/index.js +23 -1
  100. package/lib/themes/amsterdam/index.js +18 -0
  101. package/lib/themes/index.js +21 -1
  102. package/optimize/es/components/accessibility/skip_link/skip_link.js +23 -1
  103. package/optimize/es/components/accessibility/skip_link/skip_link.styles.js +1 -1
  104. package/optimize/es/components/button/{button_content.js → _button_content_deprecated.js} +1 -1
  105. package/optimize/es/components/button/button.js +13 -8
  106. package/optimize/es/components/button/button_display/_button_display.js +73 -0
  107. package/optimize/es/components/button/button_display/_button_display.styles.js +53 -0
  108. package/optimize/es/components/button/button_display/_button_display_content.js +67 -0
  109. package/optimize/es/components/button/button_display/_button_display_content.styles.js +61 -0
  110. package/optimize/es/components/button/button_empty/button_empty.js +1 -1
  111. package/optimize/es/components/button/button_group/button_group_button.js +1 -1
  112. package/optimize/es/components/combo_box/matching_options.js +3 -2
  113. package/optimize/es/components/facet/facet_button.js +31 -15
  114. package/optimize/es/components/facet/facet_button.styles.js +64 -0
  115. package/optimize/es/components/facet/facet_group.js +10 -21
  116. package/optimize/es/components/facet/facet_group.styles.js +79 -0
  117. package/optimize/es/components/loading/loading_spinner.js +3 -2
  118. package/optimize/es/components/loading/loading_spinner.styles.js +4 -4
  119. package/optimize/es/components/provider/cache/cache_provider.js +17 -0
  120. package/optimize/es/components/provider/cache/index.js +8 -0
  121. package/optimize/es/components/provider/index.js +1 -1
  122. package/optimize/es/components/provider/provider.js +35 -5
  123. package/optimize/es/components/selectable/selectable.js +33 -22
  124. package/optimize/es/components/stat/stat.js +25 -33
  125. package/optimize/es/components/stat/stat.styles.js +38 -0
  126. package/optimize/es/components/timeline/timeline.js +10 -1
  127. package/optimize/es/components/timeline/timeline.styles.js +29 -0
  128. package/optimize/es/components/timeline/timeline_item.js +4 -9
  129. package/optimize/es/components/timeline/timeline_item.styles.js +18 -3
  130. package/optimize/es/components/timeline/timeline_item_icon.styles.js +14 -4
  131. package/optimize/es/global_styling/functions/logicals.js +2 -2
  132. package/optimize/es/global_styling/utility/utility.js +27 -0
  133. package/optimize/es/services/theme/hooks.js +2 -2
  134. package/optimize/es/services/theme/provider.js +1 -5
  135. package/optimize/es/test/emotion-prefix.js +27 -0
  136. package/optimize/es/test/index.d.ts +5 -0
  137. package/optimize/es/test/index.js +2 -1
  138. package/optimize/es/themes/amsterdam/index.js +9 -0
  139. package/optimize/es/themes/index.js +2 -1
  140. package/optimize/lib/components/accessibility/skip_link/skip_link.js +25 -1
  141. package/optimize/lib/components/accessibility/skip_link/skip_link.styles.js +1 -1
  142. package/optimize/lib/components/button/{button_content.js → _button_content_deprecated.js} +3 -3
  143. package/optimize/lib/components/button/button.js +16 -11
  144. package/optimize/lib/components/button/button_display/_button_display.js +79 -0
  145. package/optimize/lib/components/button/button_display/_button_display.styles.js +59 -0
  146. package/optimize/lib/components/button/button_display/_button_display_content.js +78 -0
  147. package/optimize/lib/components/button/button_display/_button_display_content.styles.js +64 -0
  148. package/optimize/lib/components/button/button_empty/button_empty.js +2 -2
  149. package/optimize/lib/components/button/button_group/button_group_button.js +1 -1
  150. package/optimize/lib/components/combo_box/matching_options.js +3 -2
  151. package/optimize/lib/components/facet/facet_button.js +35 -15
  152. package/optimize/lib/components/facet/facet_button.styles.js +79 -0
  153. package/optimize/lib/components/facet/facet_group.js +10 -21
  154. package/optimize/lib/components/facet/facet_group.styles.js +82 -0
  155. package/optimize/lib/components/loading/loading_spinner.js +3 -2
  156. package/optimize/lib/components/loading/loading_spinner.styles.js +4 -4
  157. package/optimize/lib/components/provider/cache/cache_provider.js +29 -0
  158. package/optimize/lib/components/provider/cache/index.js +18 -0
  159. package/optimize/lib/components/provider/index.js +12 -7
  160. package/optimize/lib/components/provider/provider.js +36 -5
  161. package/optimize/lib/components/selectable/selectable.js +33 -22
  162. package/optimize/lib/components/stat/stat.js +27 -37
  163. package/optimize/lib/components/stat/stat.styles.js +47 -0
  164. package/optimize/lib/components/timeline/timeline.js +14 -2
  165. package/optimize/lib/components/timeline/timeline.styles.js +39 -0
  166. package/optimize/lib/components/timeline/timeline_item.js +4 -10
  167. package/optimize/lib/components/timeline/timeline_item.styles.js +17 -10
  168. package/optimize/lib/components/timeline/timeline_item_icon.styles.js +15 -4
  169. package/optimize/lib/global_styling/functions/logicals.js +2 -2
  170. package/optimize/lib/global_styling/utility/utility.js +31 -0
  171. package/optimize/lib/services/theme/hooks.js +2 -2
  172. package/optimize/lib/services/theme/provider.js +3 -6
  173. package/optimize/lib/test/emotion-prefix.js +40 -0
  174. package/optimize/lib/test/index.d.ts +5 -0
  175. package/optimize/lib/test/index.js +23 -1
  176. package/optimize/lib/themes/amsterdam/index.js +18 -0
  177. package/optimize/lib/themes/index.js +21 -1
  178. package/package.json +1 -1
  179. package/src/components/index.scss +0 -2
  180. package/src/components/selectable/selectable_message/_selectable_message.scss +1 -0
  181. package/src/themes/amsterdam/overrides/_index.scss +0 -1
  182. package/test-env/components/accessibility/skip_link/skip_link.js +40 -2
  183. package/test-env/components/accessibility/skip_link/skip_link.styles.js +1 -1
  184. package/test-env/components/button/{button_content.js → _button_content_deprecated.js} +6 -5
  185. package/test-env/components/button/button.js +19 -13
  186. package/test-env/components/button/button_display/_button_display.js +143 -0
  187. package/test-env/components/button/button_display/_button_display.styles.js +59 -0
  188. package/test-env/components/button/button_display/_button_display_content.js +108 -0
  189. package/test-env/components/button/button_display/_button_display_content.styles.js +64 -0
  190. package/test-env/components/button/button_empty/button_empty.js +4 -3
  191. package/test-env/components/button/button_group/button_group.js +2 -1
  192. package/test-env/components/button/button_group/button_group_button.js +3 -2
  193. package/test-env/components/card/card.js +2 -1
  194. package/test-env/components/card/card_select.js +2 -1
  195. package/test-env/components/combo_box/matching_options.js +3 -2
  196. package/test-env/components/date_picker/auto_refresh/auto_refresh.js +2 -1
  197. package/test-env/components/facet/facet_button.js +35 -15
  198. package/test-env/components/facet/facet_button.styles.js +79 -0
  199. package/test-env/components/facet/facet_group.js +12 -23
  200. package/test-env/components/facet/facet_group.styles.js +82 -0
  201. package/test-env/components/header/header_links/header_link.js +2 -1
  202. package/test-env/components/loading/loading_spinner.js +14 -3
  203. package/test-env/components/loading/loading_spinner.styles.js +4 -4
  204. package/test-env/components/notification/notification_event.js +2 -1
  205. package/test-env/components/provider/cache/cache_provider.js +29 -0
  206. package/test-env/components/provider/cache/index.js +18 -0
  207. package/test-env/components/provider/index.js +12 -7
  208. package/test-env/components/provider/provider.js +36 -5
  209. package/test-env/components/selectable/selectable.js +39 -22
  210. package/test-env/components/stat/stat.js +29 -39
  211. package/test-env/components/stat/stat.styles.js +47 -0
  212. package/test-env/components/timeline/timeline.js +19 -9
  213. package/test-env/components/timeline/timeline.styles.js +39 -0
  214. package/test-env/components/timeline/timeline_item.js +4 -17
  215. package/test-env/components/timeline/timeline_item.styles.js +17 -10
  216. package/test-env/components/timeline/timeline_item_icon.styles.js +15 -4
  217. package/test-env/global_styling/functions/logicals.js +2 -2
  218. package/test-env/global_styling/utility/utility.js +31 -0
  219. package/test-env/services/theme/hooks.js +2 -2
  220. package/test-env/services/theme/provider.js +3 -6
  221. package/test-env/test/emotion-prefix.js +40 -0
  222. package/test-env/test/index.js +23 -1
  223. package/test-env/themes/amsterdam/index.js +18 -0
  224. package/test-env/themes/index.js +21 -1
  225. package/src/components/facet/_facet_button.scss +0 -69
  226. package/src/components/facet/_facet_group.scss +0 -24
  227. package/src/components/facet/_index.scss +0 -4
  228. package/src/components/facet/_variables.scss +0 -6
  229. package/src/components/stat/_index.scss +0 -1
  230. package/src/components/stat/_stat.scss +0 -50
  231. package/src/themes/amsterdam/overrides/_facet.scss +0 -10
@@ -116,7 +116,8 @@ EuiCardSelect.propTypes = {
116
116
  iconSide: PropTypes.oneOf(["left", "right"]),
117
117
 
118
118
  /**
119
- * Object of props passed to the <span/> wrapping the content's text/children only (not icon)
119
+ * Object of props passed to the <span/> wrapping the content's text (only if the children is a `string`)
120
+ * It doesn't apply to the icon.
120
121
  */
121
122
  textProps: PropTypes.shape({
122
123
  className: PropTypes.string,
@@ -20,7 +20,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
20
20
  export var flattenOptionGroups = function flattenOptionGroups(optionsOrGroups) {
21
21
  return optionsOrGroups.reduce(function (options, optionOrGroup) {
22
22
  if (optionOrGroup.options) {
23
- options.push.apply(options, _toConsumableArray(optionOrGroup.options));
23
+ options = options.concat(optionOrGroup.options);
24
24
  } else {
25
25
  options.push(optionOrGroup);
26
26
  }
@@ -78,8 +78,9 @@ export var getMatchingOptions = function getMatchingOptions(options, selectedOpt
78
78
  label: option.label,
79
79
  isGroupLabelOption: true
80
80
  }); // Add matching options for group
81
+ // use concat over spreading to support large arrays - https://mathiasbynens.be/demo/javascript-argument-count
81
82
 
82
- matchingOptions.push.apply(matchingOptions, matchingOptionsForGroup);
83
+ matchingOptions = matchingOptions.concat(matchingOptionsForGroup);
83
84
  }
84
85
  } else {
85
86
  collectMatchingOption(matchingOptions, option, selectedOptions, normalizedSearchValue, isPreFiltered, showPrevSelected);
@@ -205,7 +205,8 @@ EuiAutoRefreshButton.propTypes = {
205
205
  contentProps: PropTypes.any,
206
206
 
207
207
  /**
208
- * Object of props passed to the <span/> wrapping the content's text/children only (not icon)
208
+ * Object of props passed to the <span/> wrapping the content's text (only if the children is a `string`)
209
+ * It doesn't apply to the icon.
209
210
  */
210
211
  textProps: PropTypes.shape({
211
212
  className: PropTypes.string,
@@ -19,6 +19,10 @@ import classNames from 'classnames';
19
19
  import { EuiNotificationBadge } from '../badge';
20
20
  import { EuiLoadingSpinner } from '../loading';
21
21
  import { EuiInnerText } from '../inner_text';
22
+ import { cloneElementWithCss } from '../../services/theme/clone_element';
23
+ import { useEuiTheme } from '../../services';
24
+ import { euiFacetButtonStyles, euiFacetButtonTextStyles, euiFacetButtonIconStyles, euiFacetButtonQuantityStyles, euiFacetButtonLoadingSpinnerStyles } from './facet_button.styles';
25
+ import { EuiButtonDisplay } from '../button/button_display/_button_display';
22
26
  import { jsx as ___EmotionJSX } from "@emotion/react";
23
27
  export var EuiFacetButton = function EuiFacetButton(_ref) {
24
28
  var children = _ref.children,
@@ -36,20 +40,30 @@ export var EuiFacetButton = function EuiFacetButton(_ref) {
36
40
 
37
41
  // If in the loading state, force disabled to true
38
42
  isDisabled = isLoading ? true : isDisabled;
39
- var classes = classNames('euiFacetButton', {
40
- 'euiFacetButton--isSelected': isSelected,
41
- 'euiFacetButton--unSelected': !isSelected
42
- }, className); // Add quantity number if provided or loading indicator
43
+ var selection = isSelected ? 'isSelected' : 'unSelected';
44
+ var classes = classNames('euiFacetButton', className);
45
+ var theme = useEuiTheme();
46
+ var styles = euiFacetButtonStyles(theme);
47
+ var cssStyles = [styles.euiFacetButton];
48
+ var textStyles = euiFacetButtonTextStyles(theme);
49
+ var cssTextStyles = [textStyles.euiFacetButton__text, textStyles[selection]];
50
+ var quantityStyles = euiFacetButtonQuantityStyles();
51
+ var cssQuantityStyles = [quantityStyles.euiFacetButton__quantity, isDisabled && quantityStyles.isDisabled];
52
+ var iconStyles = euiFacetButtonIconStyles();
53
+ var cssIconStyles = [iconStyles.euiFacetButton__icon, isDisabled && quantityStyles.isDisabled];
54
+ var loadingSpinnerStyles = euiFacetButtonLoadingSpinnerStyles();
55
+ var cssLoadingSpinnerStyles = [loadingSpinnerStyles.euiFacetButton__loadingSpinner]; // Add quantity number if provided or loading indicator
43
56
 
44
57
  var buttonQuantity;
45
58
 
46
59
  if (isLoading) {
47
60
  buttonQuantity = ___EmotionJSX(EuiLoadingSpinner, {
48
- className: "euiFacetButton__spinner",
61
+ css: cssLoadingSpinnerStyles,
49
62
  size: "m"
50
63
  });
51
64
  } else if (typeof quantity === 'number') {
52
65
  buttonQuantity = ___EmotionJSX(EuiNotificationBadge, {
66
+ css: cssQuantityStyles,
53
67
  className: "euiFacetButton__quantity",
54
68
  size: "m",
55
69
  color: !isSelected || isDisabled ? 'subdued' : 'accent'
@@ -60,25 +74,27 @@ export var EuiFacetButton = function EuiFacetButton(_ref) {
60
74
  var buttonIcon;
61
75
 
62
76
  if ( /*#__PURE__*/React.isValidElement(icon)) {
63
- buttonIcon = /*#__PURE__*/React.cloneElement(icon, {
64
- className: classNames(icon.props.className, 'euiFacetButton__icon')
77
+ buttonIcon = cloneElementWithCss(icon, {
78
+ css: cssIconStyles,
79
+ className: 'euiFacetButton__icon'
65
80
  });
66
81
  }
67
82
 
68
83
  return ___EmotionJSX(EuiInnerText, null, function (ref, innerText) {
69
- return ___EmotionJSX("button", _extends({
84
+ return ___EmotionJSX(EuiButtonDisplay, _extends({
70
85
  className: classes,
71
- disabled: isDisabled,
72
- type: "button",
86
+ css: cssStyles,
87
+ element: "button",
88
+ isDisabled: isDisabled,
73
89
  ref: buttonRef,
74
- title: rest['aria-label'] || innerText
75
- }, rest), ___EmotionJSX("span", {
76
- className: "euiFacetButton__content"
77
- }, buttonIcon, ___EmotionJSX("span", {
90
+ title: rest['aria-label'] || innerText,
91
+ size: "s"
92
+ }, rest), buttonIcon, ___EmotionJSX("span", {
93
+ css: cssTextStyles,
78
94
  className: "euiFacetButton__text",
79
95
  "data-text": innerText,
80
96
  ref: ref
81
- }, children), buttonQuantity));
97
+ }, children), buttonQuantity);
82
98
  });
83
99
  };
84
100
  EuiFacetButton.propTypes = {
@@ -0,0 +1,64 @@
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
+ /*
4
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
5
+ * or more contributor license agreements. Licensed under the Elastic License
6
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
7
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
8
+ * Side Public License, v 1.
9
+ */
10
+ import { css } from '@emotion/react';
11
+ import { euiTextTruncate, euiTextShift, logicalTextAlignCSS } from '../../global_styling';
12
+ import { euiLinkFocusCSS } from '../link/link.styles';
13
+ export var euiFacetButtonStyles = function euiFacetButtonStyles(_ref3) {
14
+ var euiTheme = _ref3.euiTheme;
15
+ return {
16
+ // Base
17
+ euiFacetButton: /*#__PURE__*/css(logicalTextAlignCSS('left'), ";&:hover,&:focus{&:not(:disabled) [class*='euiFacetButton__text']{text-decoration:underline;}}&:focus:not(:disabled) [class*='euiFacetButton__text']{", euiLinkFocusCSS(euiTheme), ";}&:disabled{color:", euiTheme.colors.disabledText, ";pointer-events:none;&:hover,&:focus{text-decoration:none;}};label:euiFacetButton;")
18
+ };
19
+ };
20
+ export var euiFacetButtonTextStyles = function euiFacetButtonTextStyles(_ref4) {
21
+ var euiTheme = _ref4.euiTheme;
22
+ return {
23
+ euiFacetButton__text: /*#__PURE__*/css(euiTextShift('bold', 'data-text', euiTheme), " ", euiTextTruncate(), " flex-grow:1;;label:euiFacetButton__text;"),
24
+ isSelected: /*#__PURE__*/css("font-weight:", euiTheme.font.weight.bold, ";;label:isSelected;"),
25
+ unSelected: /*#__PURE__*/css(";label:unSelected;")
26
+ };
27
+ };
28
+
29
+ var _ref2 = process.env.NODE_ENV === "production" ? {
30
+ name: "mpq8zy-isDisabled",
31
+ styles: "opacity:0.5;label:isDisabled;"
32
+ } : {
33
+ name: "mpq8zy-isDisabled",
34
+ styles: "opacity:0.5;label:isDisabled;",
35
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
36
+ };
37
+
38
+ export var euiFacetButtonIconStyles = function euiFacetButtonIconStyles() {
39
+ return {
40
+ euiFacetButton__icon: /*#__PURE__*/css(";label:euiFacetButton__icon;"),
41
+ isDisabled: _ref2
42
+ };
43
+ };
44
+ export var euiFacetButtonLoadingSpinnerStyles = function euiFacetButtonLoadingSpinnerStyles() {
45
+ return {
46
+ euiFacetButton__loadingSpinner: /*#__PURE__*/css(";label:euiFacetButton__loadingSpinner;")
47
+ };
48
+ };
49
+
50
+ var _ref = process.env.NODE_ENV === "production" ? {
51
+ name: "mpq8zy-isDisabled",
52
+ styles: "opacity:0.5;label:isDisabled;"
53
+ } : {
54
+ name: "mpq8zy-isDisabled",
55
+ styles: "opacity:0.5;label:isDisabled;",
56
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
57
+ };
58
+
59
+ export var euiFacetButtonQuantityStyles = function euiFacetButtonQuantityStyles() {
60
+ return {
61
+ euiFacetButton__quantity: /*#__PURE__*/css(";label:euiFacetButton__quantity;"),
62
+ isDisabled: _ref
63
+ };
64
+ };
@@ -16,21 +16,11 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
16
16
  import React from 'react';
17
17
  import PropTypes from "prop-types";
18
18
  import classNames from 'classnames';
19
- import { keysOf } from '../common';
20
- import { EuiFlexGroup } from '../flex';
19
+ import { useEuiTheme } from '../../services';
20
+ import { euiFacetGroupStyles } from './facet_group.styles';
21
21
  import { jsx as ___EmotionJSX } from "@emotion/react";
22
- var layoutToClassNameMap = {
23
- vertical: 'euiFacetGroup--vertical',
24
- horizontal: 'euiFacetGroup--horizontal'
25
- };
26
- export var LAYOUTS = keysOf(layoutToClassNameMap);
27
- var gutterSizeToClassNameMap = {
28
- none: 'euiFacetGroup--gutterNone',
29
- s: 'euiFacetGroup--gutterSmall',
30
- m: 'euiFacetGroup--gutterMedium',
31
- l: 'euiFacetGroup--gutterLarge'
32
- };
33
- export var GUTTER_SIZES = keysOf(gutterSizeToClassNameMap);
22
+ export var LAYOUTS = ['vertical', 'horizontal'];
23
+ export var GUTTER_SIZES = ['none', 's', 'm', 'l'];
34
24
  export var EuiFacetGroup = function EuiFacetGroup(_ref) {
35
25
  var children = _ref.children,
36
26
  className = _ref.className,
@@ -40,14 +30,13 @@ export var EuiFacetGroup = function EuiFacetGroup(_ref) {
40
30
  gutterSize = _ref$gutterSize === void 0 ? 'm' : _ref$gutterSize,
41
31
  rest = _objectWithoutProperties(_ref, _excluded);
42
32
 
43
- var classes = classNames('euiFacetGroup', layoutToClassNameMap[layout], gutterSizeToClassNameMap[gutterSize], className);
44
- var direction = layout === 'vertical' ? 'column' : 'row';
45
- var wrap = layout === 'vertical' ? false : true;
46
- return ___EmotionJSX(EuiFlexGroup, _extends({
33
+ var theme = useEuiTheme();
34
+ var styles = euiFacetGroupStyles(theme, layout);
35
+ var cssStyles = [styles.euiFacetGroup, styles[gutterSize], styles[layout]];
36
+ var classes = classNames('euiFacetGroup', className);
37
+ return ___EmotionJSX("div", _extends({
47
38
  className: classes,
48
- direction: direction,
49
- wrap: wrap,
50
- gutterSize: "none"
39
+ css: cssStyles
51
40
  }, rest), children);
52
41
  };
53
42
  EuiFacetGroup.propTypes = {
@@ -58,11 +47,11 @@ EuiFacetGroup.propTypes = {
58
47
  /**
59
48
  * Vertically in a column, or horizontally in one wrapping line
60
49
  */
61
- layout: PropTypes.oneOf(["vertical", "horizontal"]),
50
+ layout: PropTypes.any,
62
51
 
63
52
  /**
64
53
  * Distance between facet buttons.
65
54
  * Horizontal layout always adds more distance horizontally between buttons.
66
55
  */
67
- gutterSize: PropTypes.oneOf(["none", "s", "m", "l"])
56
+ gutterSize: PropTypes.any
68
57
  };
@@ -0,0 +1,79 @@
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
+ /*
4
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
5
+ * or more contributor license agreements. Licensed under the Elastic License
6
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
7
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
8
+ * Side Public License, v 1.
9
+ */
10
+ import { css } from '@emotion/react';
11
+ import { useEuiTheme } from '../../services';
12
+
13
+ var _facetGroupGutterSize = function _facetGroupGutterSize(_ref4) {
14
+ var gutterSize = _ref4.gutterSize,
15
+ layout = _ref4.layout;
16
+
17
+ var _useEuiTheme = useEuiTheme(),
18
+ euiTheme = _useEuiTheme.euiTheme;
19
+
20
+ var isHorizontalLayout = layout === 'horizontal';
21
+ var gutterHorizontal = "calc(".concat(euiTheme.size.m, " + ").concat(gutterSize, ")");
22
+ var gutterVertical = gutterSize;
23
+ return isHorizontalLayout ? "gap: ".concat(gutterVertical, " ").concat(gutterHorizontal, ";") : "gap: ".concat(gutterVertical, " 0;");
24
+ };
25
+
26
+ var _ref = process.env.NODE_ENV === "production" ? {
27
+ name: "omnk2l-vertical",
28
+ styles: "flex-direction:column;label:vertical;"
29
+ } : {
30
+ name: "omnk2l-vertical",
31
+ styles: "flex-direction:column;label:vertical;",
32
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
33
+ };
34
+
35
+ var _ref2 = process.env.NODE_ENV === "production" ? {
36
+ name: "envaaw-horizontal",
37
+ styles: "flex-direction:row;flex-wrap:wrap;label:horizontal;"
38
+ } : {
39
+ name: "envaaw-horizontal",
40
+ styles: "flex-direction:row;flex-wrap:wrap;label:horizontal;",
41
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
42
+ };
43
+
44
+ var _ref3 = process.env.NODE_ENV === "production" ? {
45
+ name: "1g68sie-euiFacetGroup",
46
+ styles: "display:flex;flex-grow:1;label:euiFacetGroup;"
47
+ } : {
48
+ name: "1g68sie-euiFacetGroup",
49
+ styles: "display:flex;flex-grow:1;label:euiFacetGroup;",
50
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
51
+ };
52
+
53
+ export var euiFacetGroupStyles = function euiFacetGroupStyles(_ref5, layout) {
54
+ var euiTheme = _ref5.euiTheme;
55
+ return {
56
+ // Base
57
+ euiFacetGroup: _ref3,
58
+ // Gutter sizes
59
+ none: /*#__PURE__*/css(_facetGroupGutterSize({
60
+ gutterSize: '0',
61
+ layout: layout
62
+ }), ";label:none;"),
63
+ s: /*#__PURE__*/css(_facetGroupGutterSize({
64
+ gutterSize: euiTheme.size.xs,
65
+ layout: layout
66
+ }), ";label:s;"),
67
+ m: /*#__PURE__*/css(_facetGroupGutterSize({
68
+ gutterSize: euiTheme.size.s,
69
+ layout: layout
70
+ }), ";label:m;"),
71
+ l: /*#__PURE__*/css(_facetGroupGutterSize({
72
+ gutterSize: euiTheme.size.m,
73
+ layout: layout
74
+ }), ";label:l;"),
75
+ // layouts
76
+ horizontal: _ref2,
77
+ vertical: _ref
78
+ };
79
+ };
@@ -111,7 +111,8 @@ EuiHeaderLink.propTypes = {
111
111
  iconSide: PropTypes.oneOf(["left", "right"]),
112
112
 
113
113
  /**
114
- * Object of props passed to the <span/> wrapping the content's text/children only (not icon)
114
+ * Object of props passed to the <span/> wrapping the content's text (only if the children is a `string`)
115
+ * It doesn't apply to the icon.
115
116
  */
116
117
  textProps: PropTypes.shape({
117
118
  className: PropTypes.string,
@@ -1,4 +1,4 @@
1
- var _excluded = ["size", "className", "aria-label"];
1
+ var _excluded = ["size", "className", "aria-label", "color"];
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
 
@@ -26,10 +26,11 @@ export var EuiLoadingSpinner = function EuiLoadingSpinner(_ref) {
26
26
  size = _ref$size === void 0 ? 'm' : _ref$size,
27
27
  className = _ref.className,
28
28
  ariaLabel = _ref['aria-label'],
29
+ color = _ref.color,
29
30
  rest = _objectWithoutProperties(_ref, _excluded);
30
31
 
31
32
  var euiTheme = useEuiTheme();
32
- var styles = euiLoadingSpinnerStyles(euiTheme);
33
+ var styles = euiLoadingSpinnerStyles(euiTheme, color);
33
34
  var cssStyles = [styles.euiLoadingSpinner, styles[size]];
34
35
  var classes = classNames('euiLoadingSpinner', className);
35
36
  var defaultLabel = useLoadingAriaLabel();
@@ -44,5 +45,15 @@ EuiLoadingSpinner.propTypes = {
44
45
  className: PropTypes.string,
45
46
  "aria-label": PropTypes.string,
46
47
  "data-test-subj": PropTypes.string,
47
- size: PropTypes.any
48
+ size: PropTypes.any,
49
+
50
+ /**
51
+ * Sets the color of the border and highlight.
52
+ * Each key accepts any valid CSS color value as a `string`
53
+ * See #EuiLoadingSpinnerColor
54
+ */
55
+ color: PropTypes.shape({
56
+ border: PropTypes.any,
57
+ highlight: PropTypes.any
58
+ })
48
59
  };
@@ -22,14 +22,14 @@ var spinnerSizes = {
22
22
  xxl: 'xxl'
23
23
  };
24
24
 
25
- var spinnerColors = function spinnerColors(main, highlight) {
26
- return "".concat(highlight, " ").concat(main, " ").concat(main, " ").concat(main);
25
+ var spinnerColorsCSS = function spinnerColorsCSS(border, highlight) {
26
+ return "\n border-color: ".concat(highlight, " ").concat(border, " ").concat(border, " ").concat(border, ";\n ");
27
27
  };
28
28
 
29
- export var euiLoadingSpinnerStyles = function euiLoadingSpinnerStyles(_ref) {
29
+ export var euiLoadingSpinnerStyles = function euiLoadingSpinnerStyles(_ref, color) {
30
30
  var euiTheme = _ref.euiTheme;
31
31
  return {
32
- euiLoadingSpinner: /*#__PURE__*/css("flex-shrink:0;display:inline-block;border-radius:50%;border:", euiTheme.border.thick, ";border-color:", spinnerColors(euiTheme.border.color, euiTheme.colors.primary), ";", euiCanAnimate, "{animation:", _loadingSpinner, " 0.6s infinite linear;};label:euiLoadingSpinner;"),
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;"),
33
33
  // Sizes
34
34
  s: /*#__PURE__*/css("width:", euiTheme.size[spinnerSizes.s], ";height:", euiTheme.size[spinnerSizes.s], ";border-width:calc(", euiTheme.border.width.thin, " * 1.5);;label:s;"),
35
35
  m: /*#__PURE__*/css("width:", euiTheme.size[spinnerSizes.m], ";height:", euiTheme.size[spinnerSizes.m], ";border-width:calc(", euiTheme.border.width.thin, " * 1.5);;label:m;"),
@@ -254,7 +254,8 @@ EuiNotificationEvent.propTypes = {
254
254
  iconSide: PropTypes.oneOf(["left", "right"]),
255
255
 
256
256
  /**
257
- * Object of props passed to the <span/> wrapping the content's text/children only (not icon)
257
+ * Object of props passed to the <span/> wrapping the content's text (only if the children is a `string`)
258
+ * It doesn't apply to the icon.
258
259
  */
259
260
  textProps: PropTypes.shape({
260
261
  className: PropTypes.string,
@@ -144,7 +144,8 @@ EuiPaginationButton.propTypes = {
144
144
  iconSide: PropTypes.oneOf(["left", "right"]),
145
145
 
146
146
  /**
147
- * Object of props passed to the <span/> wrapping the content's text/children only (not icon)
147
+ * Object of props passed to the <span/> wrapping the content's text (only if the children is a `string`)
148
+ * It doesn't apply to the icon.
148
149
  */
149
150
  textProps: PropTypes.shape({
150
151
  className: PropTypes.string,
@@ -0,0 +1,17 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
5
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
6
+ * Side Public License, v 1.
7
+ */
8
+ import React from 'react';
9
+ import { CacheProvider } from '@emotion/react';
10
+ import { jsx as ___EmotionJSX } from "@emotion/react";
11
+ export var EuiCacheProvider = function EuiCacheProvider(_ref) {
12
+ var cache = _ref.cache,
13
+ children = _ref.children;
14
+ return children && cache ? ___EmotionJSX(CacheProvider, {
15
+ value: cache
16
+ }, children) : ___EmotionJSX(React.Fragment, null, children);
17
+ };
@@ -0,0 +1,8 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
5
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
6
+ * Side Public License, v 1.
7
+ */
8
+ export * from './cache_provider';
@@ -5,4 +5,4 @@
5
5
  * in compliance with, at your election, the Elastic License 2.0 or the Server
6
6
  * Side Public License, v 1.
7
7
  */
8
- export { EuiProvider } from './provider';
8
+ export * from './provider';
@@ -7,22 +7,52 @@
7
7
  */
8
8
  import React from 'react';
9
9
  import { EuiGlobalStyles } from '../../global_styling/reset/global_styles';
10
+ import { EuiUtilityClasses } from '../../global_styling/utility/utility';
10
11
  import { EuiThemeProvider } from '../../services';
11
12
  import { EuiThemeAmsterdam } from '../../themes';
13
+ import { EuiCacheProvider } from './cache';
12
14
  import { jsx as ___EmotionJSX } from "@emotion/react";
15
+
16
+ var isEmotionCacheObject = function isEmotionCacheObject(obj) {
17
+ return obj.hasOwnProperty('key');
18
+ };
19
+
13
20
  export var EuiProvider = function EuiProvider(_ref) {
14
21
  var cache = _ref.cache,
15
22
  _ref$theme = _ref.theme,
16
23
  theme = _ref$theme === void 0 ? EuiThemeAmsterdam : _ref$theme,
17
24
  _ref$globalStyles = _ref.globalStyles,
18
- GlobalStyles = _ref$globalStyles === void 0 ? EuiGlobalStyles : _ref$globalStyles,
25
+ Globals = _ref$globalStyles === void 0 ? EuiGlobalStyles : _ref$globalStyles,
26
+ _ref$utilityClasses = _ref.utilityClasses,
27
+ Utilities = _ref$utilityClasses === void 0 ? EuiUtilityClasses : _ref$utilityClasses,
19
28
  colorMode = _ref.colorMode,
20
29
  modify = _ref.modify,
21
30
  children = _ref.children;
22
- return ___EmotionJSX(EuiThemeProvider, {
31
+ var defaultCache;
32
+ var globalCache;
33
+ var utilityCache;
34
+
35
+ if (cache) {
36
+ if (isEmotionCacheObject(cache)) {
37
+ defaultCache = cache;
38
+ } else {
39
+ defaultCache = cache.default;
40
+ globalCache = cache.global;
41
+ utilityCache = cache.utility;
42
+ }
43
+ }
44
+
45
+ return ___EmotionJSX(EuiCacheProvider, {
46
+ cache: defaultCache
47
+ }, ___EmotionJSX(EuiThemeProvider, {
23
48
  theme: theme !== null && theme !== void 0 ? theme : undefined,
24
49
  colorMode: colorMode,
25
- modify: modify,
26
- cache: cache
27
- }, theme !== null && GlobalStyles !== false ? ___EmotionJSX(GlobalStyles, null) : null, children);
50
+ modify: modify
51
+ }, theme && ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiCacheProvider, {
52
+ cache: globalCache,
53
+ children: Globals && ___EmotionJSX(Globals, null)
54
+ }), ___EmotionJSX(EuiCacheProvider, {
55
+ cache: utilityCache,
56
+ children: Utilities && ___EmotionJSX(Utilities, null)
57
+ })), children));
28
58
  };
@@ -1,6 +1,6 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2
2
 
3
- var _excluded = ["children", "className", "options", "onChange", "searchable", "searchProps", "singleSelection", "isLoading", "listProps", "renderOption", "height", "allowExclusions", "aria-label", "aria-describedby", "loadingMessage", "noMatchesMessage", "emptyMessage", "errorMessage", "isPreFiltered"],
3
+ var _excluded = ["children", "className", "options", "onChange", "onActiveOptionChange", "searchable", "searchProps", "singleSelection", "isLoading", "listProps", "renderOption", "height", "allowExclusions", "aria-label", "aria-describedby", "loadingMessage", "noMatchesMessage", "emptyMessage", "errorMessage", "isPreFiltered"],
4
4
  _excluded2 = ["aria-label", "aria-describedby", "onChange", "defaultValue", "inputRef"],
5
5
  _excluded3 = ["aria-label", "aria-describedby", "isVirtualized", "rowHeight"];
6
6
 
@@ -337,31 +337,42 @@ export var EuiSelectable = /*#__PURE__*/function (_Component) {
337
337
  }
338
338
 
339
339
  _createClass(EuiSelectable, [{
340
+ key: "componentDidUpdate",
341
+ value: function componentDidUpdate(prevProps, prevState) {
342
+ if (prevState.activeOptionIndex !== this.state.activeOptionIndex) {
343
+ var _this$props$onActiveO, _this$props2;
344
+
345
+ var activeOption = this.state.activeOptionIndex != null ? this.state.visibleOptions[this.state.activeOptionIndex] : null;
346
+ (_this$props$onActiveO = (_this$props2 = this.props).onActiveOptionChange) === null || _this$props$onActiveO === void 0 ? void 0 : _this$props$onActiveO.call(_this$props2, activeOption);
347
+ }
348
+ }
349
+ }, {
340
350
  key: "render",
341
351
  value: function render() {
342
352
  var _this2 = this;
343
353
 
344
- var _this$props2 = this.props,
345
- children = _this$props2.children,
346
- className = _this$props2.className,
347
- options = _this$props2.options,
348
- onChange = _this$props2.onChange,
349
- searchable = _this$props2.searchable,
350
- searchProps = _this$props2.searchProps,
351
- singleSelection = _this$props2.singleSelection,
352
- isLoading = _this$props2.isLoading,
353
- listProps = _this$props2.listProps,
354
- renderOption = _this$props2.renderOption,
355
- height = _this$props2.height,
356
- allowExclusions = _this$props2.allowExclusions,
357
- ariaLabel = _this$props2['aria-label'],
358
- ariaDescribedby = _this$props2['aria-describedby'],
359
- loadingMessage = _this$props2.loadingMessage,
360
- noMatchesMessage = _this$props2.noMatchesMessage,
361
- emptyMessage = _this$props2.emptyMessage,
362
- errorMessage = _this$props2.errorMessage,
363
- isPreFiltered = _this$props2.isPreFiltered,
364
- rest = _objectWithoutProperties(_this$props2, _excluded);
354
+ var _this$props3 = this.props,
355
+ children = _this$props3.children,
356
+ className = _this$props3.className,
357
+ options = _this$props3.options,
358
+ onChange = _this$props3.onChange,
359
+ onActiveOptionChange = _this$props3.onActiveOptionChange,
360
+ searchable = _this$props3.searchable,
361
+ searchProps = _this$props3.searchProps,
362
+ singleSelection = _this$props3.singleSelection,
363
+ isLoading = _this$props3.isLoading,
364
+ listProps = _this$props3.listProps,
365
+ renderOption = _this$props3.renderOption,
366
+ height = _this$props3.height,
367
+ allowExclusions = _this$props3.allowExclusions,
368
+ ariaLabel = _this$props3['aria-label'],
369
+ ariaDescribedby = _this$props3['aria-describedby'],
370
+ loadingMessage = _this$props3.loadingMessage,
371
+ noMatchesMessage = _this$props3.noMatchesMessage,
372
+ emptyMessage = _this$props3.emptyMessage,
373
+ errorMessage = _this$props3.errorMessage,
374
+ isPreFiltered = _this$props3.isPreFiltered,
375
+ rest = _objectWithoutProperties(_this$props3, _excluded);
365
376
 
366
377
  var _this$state = this.state,
367
378
  searchValue = _this$state.searchValue,
@@ -710,6 +721,12 @@ EuiSelectable.propTypes = {
710
721
  */
711
722
  onChange: PropTypes.func,
712
723
 
724
+ /**
725
+ * Passes back the current active option whenever the user changes the currently
726
+ * highlighted option via keyboard navigation or searching.
727
+ */
728
+ onActiveOptionChange: PropTypes.func,
729
+
713
730
  /**
714
731
  * Sets the single selection policy of
715
732
  * `false`: allows multiple selection