@elastic/eui 59.1.0 → 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 (111) 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 +0 -48
  4. package/dist/eui_theme_dark.min.css +1 -1
  5. package/dist/eui_theme_light.css +0 -48
  6. package/dist/eui_theme_light.min.css +1 -1
  7. package/es/components/combo_box/matching_options.js +3 -2
  8. package/es/components/provider/cache/cache_provider.js +17 -0
  9. package/es/components/provider/cache/index.js +8 -0
  10. package/es/components/provider/index.js +1 -1
  11. package/es/components/provider/provider.js +35 -5
  12. package/es/components/selectable/selectable.js +39 -22
  13. package/es/components/stat/stat.js +28 -35
  14. package/es/components/stat/stat.styles.js +38 -0
  15. package/es/components/timeline/timeline.js +15 -8
  16. package/es/components/timeline/timeline.styles.js +29 -0
  17. package/es/components/timeline/timeline_item.js +4 -16
  18. package/es/components/timeline/timeline_item.styles.js +18 -3
  19. package/es/components/timeline/timeline_item_icon.styles.js +14 -4
  20. package/es/global_styling/functions/logicals.js +2 -2
  21. package/es/global_styling/utility/utility.js +27 -0
  22. package/es/services/theme/hooks.js +2 -2
  23. package/es/services/theme/provider.js +1 -5
  24. package/es/test/emotion-prefix.js +29 -0
  25. package/es/test/index.d.ts +5 -0
  26. package/es/test/index.js +2 -1
  27. package/eui.d.ts +90 -35
  28. package/i18ntokens.json +16 -16
  29. package/lib/components/combo_box/matching_options.js +3 -2
  30. package/lib/components/provider/cache/cache_provider.js +29 -0
  31. package/lib/components/provider/cache/index.js +18 -0
  32. package/lib/components/provider/index.js +12 -7
  33. package/lib/components/provider/provider.js +36 -5
  34. package/lib/components/selectable/selectable.js +39 -22
  35. package/lib/components/stat/stat.js +30 -40
  36. package/lib/components/stat/stat.styles.js +45 -0
  37. package/lib/components/timeline/timeline.js +20 -9
  38. package/lib/components/timeline/timeline.styles.js +39 -0
  39. package/lib/components/timeline/timeline_item.js +4 -17
  40. package/lib/components/timeline/timeline_item.styles.js +17 -10
  41. package/lib/components/timeline/timeline_item_icon.styles.js +15 -4
  42. package/lib/global_styling/functions/logicals.js +2 -2
  43. package/lib/global_styling/utility/utility.js +31 -0
  44. package/lib/services/theme/hooks.js +2 -2
  45. package/lib/services/theme/provider.js +3 -6
  46. package/lib/test/emotion-prefix.js +38 -0
  47. package/lib/test/index.d.ts +5 -0
  48. package/lib/test/index.js +23 -1
  49. package/optimize/es/components/combo_box/matching_options.js +3 -2
  50. package/optimize/es/components/provider/cache/cache_provider.js +17 -0
  51. package/optimize/es/components/provider/cache/index.js +8 -0
  52. package/optimize/es/components/provider/index.js +1 -1
  53. package/optimize/es/components/provider/provider.js +35 -5
  54. package/optimize/es/components/selectable/selectable.js +33 -22
  55. package/optimize/es/components/stat/stat.js +25 -33
  56. package/optimize/es/components/stat/stat.styles.js +38 -0
  57. package/optimize/es/components/timeline/timeline.js +10 -1
  58. package/optimize/es/components/timeline/timeline.styles.js +29 -0
  59. package/optimize/es/components/timeline/timeline_item.js +4 -9
  60. package/optimize/es/components/timeline/timeline_item.styles.js +18 -3
  61. package/optimize/es/components/timeline/timeline_item_icon.styles.js +14 -4
  62. package/optimize/es/global_styling/functions/logicals.js +2 -2
  63. package/optimize/es/global_styling/utility/utility.js +27 -0
  64. package/optimize/es/services/theme/hooks.js +2 -2
  65. package/optimize/es/services/theme/provider.js +1 -5
  66. package/optimize/es/test/emotion-prefix.js +27 -0
  67. package/optimize/es/test/index.d.ts +5 -0
  68. package/optimize/es/test/index.js +2 -1
  69. package/optimize/lib/components/combo_box/matching_options.js +3 -2
  70. package/optimize/lib/components/provider/cache/cache_provider.js +29 -0
  71. package/optimize/lib/components/provider/cache/index.js +18 -0
  72. package/optimize/lib/components/provider/index.js +12 -7
  73. package/optimize/lib/components/provider/provider.js +36 -5
  74. package/optimize/lib/components/selectable/selectable.js +33 -22
  75. package/optimize/lib/components/stat/stat.js +27 -37
  76. package/optimize/lib/components/stat/stat.styles.js +47 -0
  77. package/optimize/lib/components/timeline/timeline.js +14 -2
  78. package/optimize/lib/components/timeline/timeline.styles.js +39 -0
  79. package/optimize/lib/components/timeline/timeline_item.js +4 -10
  80. package/optimize/lib/components/timeline/timeline_item.styles.js +17 -10
  81. package/optimize/lib/components/timeline/timeline_item_icon.styles.js +15 -4
  82. package/optimize/lib/global_styling/functions/logicals.js +2 -2
  83. package/optimize/lib/global_styling/utility/utility.js +31 -0
  84. package/optimize/lib/services/theme/hooks.js +2 -2
  85. package/optimize/lib/services/theme/provider.js +3 -6
  86. package/optimize/lib/test/emotion-prefix.js +40 -0
  87. package/optimize/lib/test/index.d.ts +5 -0
  88. package/optimize/lib/test/index.js +23 -1
  89. package/package.json +1 -1
  90. package/src/components/index.scss +0 -1
  91. package/test-env/components/combo_box/matching_options.js +3 -2
  92. package/test-env/components/provider/cache/cache_provider.js +29 -0
  93. package/test-env/components/provider/cache/index.js +18 -0
  94. package/test-env/components/provider/index.js +12 -7
  95. package/test-env/components/provider/provider.js +36 -5
  96. package/test-env/components/selectable/selectable.js +39 -22
  97. package/test-env/components/stat/stat.js +29 -39
  98. package/test-env/components/stat/stat.styles.js +47 -0
  99. package/test-env/components/timeline/timeline.js +19 -9
  100. package/test-env/components/timeline/timeline.styles.js +39 -0
  101. package/test-env/components/timeline/timeline_item.js +4 -17
  102. package/test-env/components/timeline/timeline_item.styles.js +17 -10
  103. package/test-env/components/timeline/timeline_item_icon.styles.js +15 -4
  104. package/test-env/global_styling/functions/logicals.js +2 -2
  105. package/test-env/global_styling/utility/utility.js +31 -0
  106. package/test-env/services/theme/hooks.js +2 -2
  107. package/test-env/services/theme/provider.js +3 -6
  108. package/test-env/test/emotion-prefix.js +40 -0
  109. package/test-env/test/index.js +23 -1
  110. package/src/components/stat/_index.scss +0 -1
  111. package/src/components/stat/_stat.scss +0 -50
@@ -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);
@@ -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
@@ -2,6 +2,12 @@ var _excluded = ["children", "className", "description", "isLoading", "reverse",
2
2
 
3
3
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
4
 
5
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
6
+
7
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
8
+
9
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
10
+
5
11
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
6
12
 
7
13
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
@@ -15,31 +21,16 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
15
21
  */
16
22
  import React, { Fragment, createElement } from 'react';
17
23
  import PropTypes from "prop-types";
18
- import { keysOf } from '../common';
19
24
  import classNames from 'classnames';
20
25
  import { EuiText } from '../text';
21
26
  import { EuiTitle } from '../title/title';
22
27
  import { EuiScreenReaderOnly } from '../accessibility';
23
28
  import { EuiI18n } from '../i18n';
29
+ import { useEuiTheme } from '../../services';
30
+ import { euiStatStyles, euiStatTitleStyles } from './stat.styles';
24
31
  import { jsx as ___EmotionJSX } from "@emotion/react";
25
- var colorToClassNameMap = {
26
- default: null,
27
- subdued: 'euiStat__title--subdued',
28
- primary: 'euiStat__title--primary',
29
- success: 'euiStat__title--success',
30
- danger: 'euiStat__title--danger',
31
- accent: 'euiStat__title--accent'
32
- };
33
- export var COLORS = keysOf(colorToClassNameMap);
34
- var textAlignToClassNameMap = {
35
- left: 'euiStat--leftAligned',
36
- center: 'euiStat--centerAligned',
37
- right: 'euiStat--rightAligned'
38
- };
39
- export var isColorClass = function isColorClass(input) {
40
- return colorToClassNameMap.hasOwnProperty(input);
41
- };
42
- export var ALIGNMENTS = keysOf(textAlignToClassNameMap);
32
+ export var COLORS = ['default', 'subdued', 'primary', 'success', 'danger', 'accent'];
33
+ export var ALIGNMENTS = ['left', 'center', 'right'];
43
34
  export var EuiStat = function EuiStat(_ref) {
44
35
  var children = _ref.children,
45
36
  className = _ref.className,
@@ -61,10 +52,10 @@ export var EuiStat = function EuiStat(_ref) {
61
52
  descriptionElement = _ref$descriptionEleme === void 0 ? 'p' : _ref$descriptionEleme,
62
53
  rest = _objectWithoutProperties(_ref, _excluded);
63
54
 
64
- var classes = classNames('euiStat', textAlignToClassNameMap[textAlign], className);
65
- var titleClasses = classNames('euiStat__title', isColorClass(titleColor) ? colorToClassNameMap[titleColor] : null, {
66
- 'euiStat__title-isLoading': isLoading
67
- });
55
+ var euiTheme = useEuiTheme();
56
+ var styles = euiStatStyles();
57
+ var cssStyles = [styles.euiStat, styles[textAlign]];
58
+ var classes = classNames('euiStat', className);
68
59
  var commonProps = {
69
60
  'aria-hidden': true
70
61
  };
@@ -74,20 +65,21 @@ export var EuiStat = function EuiStat(_ref) {
74
65
  className: "euiStat__description"
75
66
  }, /*#__PURE__*/createElement(descriptionElement, commonProps, description));
76
67
 
77
- var titlePropsWithColor = {
78
- 'aria-hidden': true,
68
+ var isNamedTitleColor = COLORS.includes(titleColor);
69
+ var titleStyles = euiStatTitleStyles(euiTheme);
70
+ var titleCssStyles = [titleStyles.euiStat__title, isNamedTitleColor && titleStyles[titleColor], isLoading && titleStyles.isLoading];
71
+ var titleProps = isNamedTitleColor ? commonProps : _objectSpread(_objectSpread({}, commonProps), {}, {
79
72
  style: {
80
- color: "".concat(titleColor)
73
+ color: titleColor
81
74
  }
82
- };
75
+ });
83
76
  var titleChildren = isLoading ? '--' : title;
84
- var titleDisplay = isColorClass(titleColor) ? ___EmotionJSX(EuiTitle, {
85
- size: titleSize,
86
- className: titleClasses
87
- }, /*#__PURE__*/createElement(titleElement, commonProps, titleChildren)) : ___EmotionJSX(EuiTitle, {
77
+
78
+ var titleDisplay = ___EmotionJSX(EuiTitle, {
88
79
  size: titleSize,
89
- className: titleClasses
90
- }, /*#__PURE__*/createElement(titleElement, titlePropsWithColor, titleChildren));
80
+ className: "euiStat__title",
81
+ css: titleCssStyles
82
+ }, /*#__PURE__*/createElement(titleElement, titleProps, titleChildren));
91
83
 
92
84
  var screenReader = ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("p", null, isLoading ? ___EmotionJSX(EuiI18n, {
93
85
  token: "euiStat.loadingText",
@@ -97,6 +89,7 @@ export var EuiStat = function EuiStat(_ref) {
97
89
  var statDisplay = ___EmotionJSX(Fragment, null, !reverse && descriptionDisplay, titleDisplay, reverse && descriptionDisplay, typeof title === 'string' && typeof description === 'string' && screenReader);
98
90
 
99
91
  return ___EmotionJSX("div", _extends({
92
+ css: cssStyles,
100
93
  className: classes
101
94
  }, rest), statDisplay, children);
102
95
  };
@@ -119,7 +112,7 @@ EuiStat.propTypes = {
119
112
  * Flips the order of the description and title
120
113
  */
121
114
  reverse: PropTypes.bool,
122
- textAlign: PropTypes.oneOf(["left", "center", "right"]),
115
+ textAlign: PropTypes.any,
123
116
 
124
117
  /**
125
118
  * The (value) text
@@ -129,7 +122,7 @@ EuiStat.propTypes = {
129
122
  /**
130
123
  * The color of the title text
131
124
  */
132
- titleColor: PropTypes.oneOfType([PropTypes.oneOf(["default", "subdued", "primary", "success", "danger", "accent"]).isRequired, PropTypes.string.isRequired]),
125
+ titleColor: PropTypes.oneOfType([PropTypes.any.isRequired, PropTypes.string.isRequired]),
133
126
 
134
127
  /**
135
128
  * Size of the title. See EuiTitle for options ('s', 'm', 'l'... etc)
@@ -0,0 +1,38 @@
1
+ var _templateObject;
2
+
3
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
4
+
5
+ /*
6
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
7
+ * or more contributor license agreements. Licensed under the Elastic License
8
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
9
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
10
+ * Side Public License, v 1.
11
+ */
12
+ import { css, keyframes } from '@emotion/react';
13
+ import { logicalTextAlignCSS, euiCanAnimate } from '../../global_styling';
14
+ export var euiStatStyles = function euiStatStyles() {
15
+ return {
16
+ euiStat: /*#__PURE__*/css(";label:euiStat;"),
17
+ // Text align
18
+ left: /*#__PURE__*/css(logicalTextAlignCSS('left'), " align-items:flex-start;;label:left;"),
19
+ center: /*#__PURE__*/css(logicalTextAlignCSS('center'), " align-items:center;;label:center;"),
20
+ right: /*#__PURE__*/css(logicalTextAlignCSS('right'), " align-items:flex-end;;label:right;")
21
+ };
22
+ };
23
+ export var euiStatTitleStyles = function euiStatTitleStyles(_ref) {
24
+ var euiTheme = _ref.euiTheme;
25
+ return {
26
+ euiStat__title: /*#__PURE__*/css(";label:euiStat__title;"),
27
+ // Colors
28
+ default: /*#__PURE__*/css("color:", euiTheme.colors.fullShade, ";;label:default;"),
29
+ subdued: /*#__PURE__*/css("color:", euiTheme.colors.subduedText, ";;label:subdued;"),
30
+ primary: /*#__PURE__*/css("color:", euiTheme.colors.primaryText, ";;label:primary;"),
31
+ success: /*#__PURE__*/css("color:", euiTheme.colors.successText, ";;label:success;"),
32
+ danger: /*#__PURE__*/css("color:", euiTheme.colors.dangerText, ";;label:danger;"),
33
+ accent: /*#__PURE__*/css("color:", euiTheme.colors.accentText, ";;label:accent;"),
34
+ // Loading
35
+ isLoading: /*#__PURE__*/css(euiCanAnimate, "{animation:", euiStatPulse, " 1.5s infinite ease-in-out;};label:isLoading;")
36
+ };
37
+ };
38
+ var euiStatPulse = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 0% { opacity: 1; }\n 50% { opacity: .25; }\n 100% { opacity: 1; }\n"])));
@@ -1,4 +1,4 @@
1
- var _excluded = ["className", "items", "children"];
1
+ var _excluded = ["className", "items", "children", "gutterSize"];
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
 
@@ -16,19 +16,28 @@ 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 { useEuiTheme } from '../../services';
19
20
  import { EuiTimelineItem } from './timeline_item';
21
+ import { euiTimelineStyles } from './timeline.styles';
20
22
  import { jsx as ___EmotionJSX } from "@emotion/react";
23
+ export var GUTTER_SIZES = ['m', 'l', 'xl'];
21
24
  export var EuiTimeline = function EuiTimeline(_ref) {
22
25
  var className = _ref.className,
23
26
  _ref$items = _ref.items,
24
27
  items = _ref$items === void 0 ? [] : _ref$items,
25
28
  children = _ref.children,
29
+ _ref$gutterSize = _ref.gutterSize,
30
+ gutterSize = _ref$gutterSize === void 0 ? 'xl' : _ref$gutterSize,
26
31
  rest = _objectWithoutProperties(_ref, _excluded);
27
32
 
28
33
  var classes = classNames('euiTimeline', className);
34
+ var euiTheme = useEuiTheme();
35
+ var styles = euiTimelineStyles(euiTheme);
36
+ var cssStyles = [styles.euiTimeline, styles[gutterSize]];
29
37
  return (// eslint-disable-next-line jsx-a11y/no-redundant-roles
30
38
  ___EmotionJSX("ol", _extends({
31
39
  className: classes,
40
+ css: cssStyles,
32
41
  role: "list"
33
42
  }, rest), items.map(function (item, index) {
34
43
  return ___EmotionJSX(EuiTimelineItem, _extends({
@@ -46,17 +55,15 @@ EuiTimeline.propTypes = {
46
55
  * Vertical alignment of the event with the icon
47
56
  */
48
57
  verticalAlign: PropTypes.any,
49
-
50
- /**
51
- * Sets the HTML element for `EuiTimelineItem`.
52
- * By default, the element renders as a `<li/>`.
53
- * Only change the HTML element when it is not wrapped in a `EuiTimeline` that renders as a `<ol/>`.
54
- */
55
- component: PropTypes.any,
56
58
  className: PropTypes.string,
57
59
  "aria-label": PropTypes.string,
58
60
  "data-test-subj": PropTypes.string
59
61
  }).isRequired),
62
+
63
+ /**
64
+ * Sets the size of the vertical space between each timeline item
65
+ */
66
+ gutterSize: PropTypes.any,
60
67
  className: PropTypes.string,
61
68
  "aria-label": PropTypes.string,
62
69
  "data-test-subj": PropTypes.string
@@ -0,0 +1,29 @@
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 { css } from '@emotion/react';
9
+ import { logicalCSS } from '../../global_styling';
10
+
11
+ var _gutterSizeAdjustment = function _gutterSizeAdjustment(gutterSize) {
12
+ return "\n gap: ".concat(gutterSize, ";\n\n // The vertical line height needs to be adjusted with the gutter size\n [class*='euiTimelineItem-']:not(:last-child) > [class*='euiTimelineItemIcon-']::before {\n ").concat(logicalCSS('height', "calc(100% + ".concat(gutterSize, ")")), ";\n }\n ");
13
+ }; // The vertical line should only appear when the EuiTimelineItem's
14
+ // are wrapped in a EuiTimeline. That's why these styles live here.
15
+
16
+
17
+ var timelineVerticalLine = function timelineVerticalLine(euiTheme) {
18
+ return " \n [class*='euiTimelineItem-'] > [class*='euiTimelineItemIcon-']::before {\n content: '';\n position: absolute;\n ".concat(logicalCSS('top', 0), ";\n ").concat(logicalCSS('width', euiTheme.size.xxs), ";\n background-color: ").concat(euiTheme.colors.lightShade, ";\n }\n\n > [class*='euiTimelineItem-center']:first-child > [class*='euiTimelineItemIcon-']::before {\n ").concat(logicalCSS('top', '50%'), ";\n }\n \n > [class*='euiTimelineItem-center']:last-child:not(:only-child) > [class*='euiTimelineItemIcon-']::before {\n ").concat(logicalCSS('height', '50%'), ";\n }\n ");
19
+ };
20
+
21
+ export var euiTimelineStyles = function euiTimelineStyles(_ref) {
22
+ var euiTheme = _ref.euiTheme;
23
+ return {
24
+ euiTimeline: /*#__PURE__*/css("display:flex;flex-direction:column;", timelineVerticalLine(euiTheme), ";;label:euiTimeline;"),
25
+ m: /*#__PURE__*/css(_gutterSizeAdjustment(euiTheme.size.base), ";label:m;"),
26
+ l: /*#__PURE__*/css(_gutterSizeAdjustment(euiTheme.size.l), ";label:l;"),
27
+ xl: /*#__PURE__*/css(_gutterSizeAdjustment(euiTheme.size.xl), ";label:xl;")
28
+ };
29
+ };
@@ -1,4 +1,4 @@
1
- var _excluded = ["children", "verticalAlign", "icon", "iconAriaLabel", "className", "component"];
1
+ var _excluded = ["children", "verticalAlign", "icon", "iconAriaLabel", "className"];
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
 
@@ -15,7 +15,6 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
15
15
  */
16
16
  import React from 'react';
17
17
  import PropTypes from "prop-types";
18
- import { useEuiTheme } from '../../services';
19
18
  import { EuiTimelineItemEvent } from './timeline_item_event';
20
19
  import { EuiTimelineItemIcon } from './timeline_item_icon';
21
20
  import { euiTimelineItemStyles } from './timeline_item.styles';
@@ -28,15 +27,11 @@ export var EuiTimelineItem = function EuiTimelineItem(_ref) {
28
27
  icon = _ref.icon,
29
28
  iconAriaLabel = _ref.iconAriaLabel,
30
29
  className = _ref.className,
31
- _ref$component = _ref.component,
32
- component = _ref$component === void 0 ? 'li' : _ref$component,
33
30
  rest = _objectWithoutProperties(_ref, _excluded);
34
31
 
35
- var euiTheme = useEuiTheme();
36
- var styles = euiTimelineItemStyles(euiTheme);
37
- var cssStyles = [styles.euiTimelineItem];
38
- var Element = component;
39
- return ___EmotionJSX(Element, _extends({
32
+ var styles = euiTimelineItemStyles();
33
+ var cssStyles = [styles.euiTimelineItem, styles[verticalAlign]];
34
+ return ___EmotionJSX("li", _extends({
40
35
  css: cssStyles
41
36
  }, rest), ___EmotionJSX(EuiTimelineItemIcon, {
42
37
  icon: icon,
@@ -51,13 +46,6 @@ EuiTimelineItem.propTypes = {
51
46
  * Vertical alignment of the event with the icon
52
47
  */
53
48
  verticalAlign: PropTypes.any,
54
-
55
- /**
56
- * Sets the HTML element for `EuiTimelineItem`.
57
- * By default, the element renders as a `<li/>`.
58
- * Only change the HTML element when it is not wrapped in a `EuiTimeline` that renders as a `<ol/>`.
59
- */
60
- component: PropTypes.any,
61
49
  className: PropTypes.string,
62
50
  "aria-label": PropTypes.string,
63
51
  "data-test-subj": PropTypes.string
@@ -1,3 +1,5 @@
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
+
1
3
  /*
2
4
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
5
  * or more contributor license agreements. Licensed under the Elastic License
@@ -6,9 +8,22 @@
6
8
  * Side Public License, v 1.
7
9
  */
8
10
  import { css } from '@emotion/react';
9
- export var euiTimelineItemStyles = function euiTimelineItemStyles(_ref) {
10
- var euiTheme = _ref.euiTheme;
11
+
12
+ var _ref = process.env.NODE_ENV === "production" ? {
13
+ name: "5bggde-euiTimelineItem",
14
+ styles: "display:flex;position:relative;label:euiTimelineItem;"
15
+ } : {
16
+ name: "5bggde-euiTimelineItem",
17
+ styles: "display:flex;position:relative;label:euiTimelineItem;",
18
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
19
+ };
20
+
21
+ export var euiTimelineItemStyles = function euiTimelineItemStyles() {
11
22
  return {
12
- euiTimelineItem: /*#__PURE__*/css("display:flex;&:not(:last-of-type){padding-bottom:", euiTheme.size.xl, ";}&:first-of-type{>[class*='euiTimelineItemIcon-center']::before{top:50%;height:calc(50% + ", euiTheme.size.xl, ");}}&:last-of-type{>[class*='euiTimelineItemIcon']::before{display:none;}&:not(:only-child)>[class*='euiTimelineItemIcon-center']::before{top:0;height:50%;}};label:euiTimelineItem;")
23
+ euiTimelineItem: _ref,
24
+ // Vertical alignments
25
+ // These classes are being targeted in timeline.styles.ts
26
+ top: /*#__PURE__*/css(";label:top;"),
27
+ center: /*#__PURE__*/css(";label:center;")
13
28
  };
14
29
  };
@@ -8,6 +8,7 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
8
8
  * Side Public License, v 1.
9
9
  */
10
10
  import { css } from '@emotion/react';
11
+ import { logicalCSS } from '../../global_styling';
11
12
 
12
13
  var _ref = process.env.NODE_ENV === "production" ? {
13
14
  name: "8391db-center",
@@ -27,11 +28,20 @@ var _ref2 = process.env.NODE_ENV === "production" ? {
27
28
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
28
29
  };
29
30
 
30
- export var euiTimelineItemIconStyles = function euiTimelineItemIconStyles(_ref3) {
31
- var euiTheme = _ref3.euiTheme;
31
+ var _ref3 = process.env.NODE_ENV === "production" ? {
32
+ name: "kuz8oa-euiTimelineItemIcon__content",
33
+ styles: "display:flex;justify-content:center;align-items:center;position:relative;label:euiTimelineItemIcon__content;"
34
+ } : {
35
+ name: "kuz8oa-euiTimelineItemIcon__content",
36
+ styles: "display:flex;justify-content:center;align-items:center;position:relative;label:euiTimelineItemIcon__content;",
37
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
38
+ };
39
+
40
+ export var euiTimelineItemIconStyles = function euiTimelineItemIconStyles(_ref4) {
41
+ var euiTheme = _ref4.euiTheme;
32
42
  return {
33
- euiTimelineItemIcon: /*#__PURE__*/css("display:flex;position:relative;flex-grow:0;margin-right:", euiTheme.size.base, ";&::before{content:'';position:absolute;top:0;left:calc(", euiTheme.size.xxl, " / 2);width:calc(", euiTheme.size.xs, " / 2);height:calc(100% + ", euiTheme.size.xl, ");background-color:", euiTheme.colors.lightShade, ";};label:euiTimelineItemIcon;"),
34
- euiTimelineItemIcon__content: /*#__PURE__*/css("min-width:", euiTheme.size.xxl, ";display:flex;justify-content:center;align-items:center;position:relative;;label:euiTimelineItemIcon__content;"),
43
+ euiTimelineItemIcon: /*#__PURE__*/css("display:flex;position:relative;flex-grow:0;justify-content:center;", logicalCSS('margin-right', euiTheme.size.base), ";;label:euiTimelineItemIcon;"),
44
+ euiTimelineItemIcon__content: _ref3,
35
45
  // Vertical alignments
36
46
  top: _ref2,
37
47
  center: _ref
@@ -46,9 +46,9 @@ var logicalPaddings = {
46
46
  };
47
47
  var logicalPosition = {
48
48
  top: 'inset-block-start',
49
- right: 'inset-inline-start',
49
+ right: 'inset-inline-end',
50
50
  bottom: 'inset-block-end',
51
- left: 'inset-inline-end',
51
+ left: 'inset-inline-start',
52
52
  horizontal: 'inset-block',
53
53
  vertical: 'inset-inline',
54
54
  inset: 'inset'
@@ -0,0 +1,27 @@
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 React from 'react';
11
+ import { Global, css } from '@emotion/react';
12
+ import { jsx as ___EmotionJSX } from "@emotion/react";
13
+
14
+ var _ref = process.env.NODE_ENV === "production" ? {
15
+ name: "bd8dxy-EuiUtilityClasses",
16
+ styles: ".euiYolo{color:coral;};label:EuiUtilityClasses;"
17
+ } : {
18
+ name: "bd8dxy-EuiUtilityClasses",
19
+ styles: ".euiYolo{color:coral;};label:EuiUtilityClasses;",
20
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
21
+ };
22
+
23
+ export var EuiUtilityClasses = function EuiUtilityClasses() {
24
+ return ___EmotionJSX(Global, {
25
+ styles: _ref
26
+ });
27
+ };
@@ -21,7 +21,7 @@ export var useEuiTheme = function useEuiTheme() {
21
21
  };
22
22
  };
23
23
  export var withEuiTheme = function withEuiTheme(Component) {
24
- var componentName = Component.displayName || Component.name || 'Component';
24
+ var componentName = Component.displayName || Component.name || 'ComponentWithTheme';
25
25
 
26
26
  var Render = function Render(props, ref) {
27
27
  var _useEuiTheme = useEuiTheme(),
@@ -40,6 +40,6 @@ export var withEuiTheme = function withEuiTheme(Component) {
40
40
  };
41
41
 
42
42
  var WithEuiTheme = /*#__PURE__*/forwardRef(Render);
43
- WithEuiTheme.displayName = "WithEuiTheme(".concat(componentName, ")");
43
+ WithEuiTheme.displayName = componentName;
44
44
  return WithEuiTheme;
45
45
  };