@elastic/eui 93.4.0 → 93.5.1-rc.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 (78) hide show
  1. package/dist/eui_theme_dark.css +3 -0
  2. package/dist/eui_theme_dark.min.css +1 -1
  3. package/dist/eui_theme_light.css +3 -0
  4. package/dist/eui_theme_light.min.css +1 -1
  5. package/es/components/header/header_links/header_links.js +10 -2
  6. package/es/components/icon/icon.js +3 -3
  7. package/es/components/panel/panel.js +2 -3
  8. package/es/components/resizable_container/resizable_button.js +2 -3
  9. package/es/components/resizable_container/resizable_collapse_button.js +2 -3
  10. package/es/components/resizable_container/resizable_container.js +1 -2
  11. package/es/components/resizable_container/resizable_container.styles.js +11 -14
  12. package/es/components/resizable_container/resizable_panel.js +6 -8
  13. package/es/components/resizable_container/resizable_panel.styles.js +18 -29
  14. package/es/components/selectable/selectable_list/selectable_list.js +29 -6
  15. package/es/components/tool_tip/icon_tip.js +4 -3
  16. package/es/global_styling/mixins/_color.js +60 -32
  17. package/es/global_styling/mixins/_padding.js +60 -16
  18. package/es/services/theme/style_memoization.js +1 -3
  19. package/eui.d.ts +37 -54
  20. package/i18ntokens.json +38 -20
  21. package/lib/components/header/header_links/header_links.js +10 -2
  22. package/lib/components/icon/icon.js +3 -3
  23. package/lib/components/panel/panel.js +1 -2
  24. package/lib/components/resizable_container/resizable_button.js +1 -2
  25. package/lib/components/resizable_container/resizable_collapse_button.js +1 -2
  26. package/lib/components/resizable_container/resizable_container.js +1 -2
  27. package/lib/components/resizable_container/resizable_container.styles.js +11 -14
  28. package/lib/components/resizable_container/resizable_panel.js +3 -5
  29. package/lib/components/resizable_container/resizable_panel.styles.js +17 -28
  30. package/lib/components/selectable/selectable_list/selectable_list.js +29 -6
  31. package/lib/components/tool_tip/icon_tip.js +4 -3
  32. package/lib/global_styling/mixins/_color.js +65 -40
  33. package/lib/global_styling/mixins/_padding.js +66 -25
  34. package/lib/services/theme/style_memoization.js +1 -3
  35. package/optimize/es/components/header/header_links/header_links.js +3 -2
  36. package/optimize/es/components/icon/icon.js +3 -3
  37. package/optimize/es/components/panel/panel.js +2 -3
  38. package/optimize/es/components/resizable_container/resizable_button.js +2 -3
  39. package/optimize/es/components/resizable_container/resizable_collapse_button.js +2 -3
  40. package/optimize/es/components/resizable_container/resizable_container.js +1 -2
  41. package/optimize/es/components/resizable_container/resizable_container.styles.js +11 -14
  42. package/optimize/es/components/resizable_container/resizable_panel.js +6 -8
  43. package/optimize/es/components/resizable_container/resizable_panel.styles.js +18 -26
  44. package/optimize/es/components/selectable/selectable_list/selectable_list.js +29 -6
  45. package/optimize/es/components/tool_tip/icon_tip.js +4 -3
  46. package/optimize/es/global_styling/mixins/_color.js +57 -32
  47. package/optimize/es/global_styling/mixins/_padding.js +52 -16
  48. package/optimize/es/services/theme/style_memoization.js +1 -3
  49. package/optimize/lib/components/header/header_links/header_links.js +3 -2
  50. package/optimize/lib/components/icon/icon.js +3 -3
  51. package/optimize/lib/components/panel/panel.js +1 -2
  52. package/optimize/lib/components/resizable_container/resizable_button.js +1 -2
  53. package/optimize/lib/components/resizable_container/resizable_collapse_button.js +1 -2
  54. package/optimize/lib/components/resizable_container/resizable_container.js +1 -2
  55. package/optimize/lib/components/resizable_container/resizable_container.styles.js +11 -14
  56. package/optimize/lib/components/resizable_container/resizable_panel.js +3 -5
  57. package/optimize/lib/components/resizable_container/resizable_panel.styles.js +17 -26
  58. package/optimize/lib/components/selectable/selectable_list/selectable_list.js +29 -6
  59. package/optimize/lib/components/tool_tip/icon_tip.js +4 -3
  60. package/optimize/lib/global_styling/mixins/_color.js +63 -40
  61. package/optimize/lib/global_styling/mixins/_padding.js +59 -25
  62. package/optimize/lib/services/theme/style_memoization.js +1 -3
  63. package/package.json +8 -11
  64. package/src/components/form/text_area/_text_area.scss +5 -0
  65. package/src/components/selectable/selectable_list/_selectable_list.scss +2 -0
  66. package/test-env/components/header/header_links/header_links.js +10 -2
  67. package/test-env/components/panel/panel.js +1 -2
  68. package/test-env/components/resizable_container/resizable_button.js +1 -2
  69. package/test-env/components/resizable_container/resizable_collapse_button.js +1 -2
  70. package/test-env/components/resizable_container/resizable_container.js +1 -2
  71. package/test-env/components/resizable_container/resizable_container.styles.js +11 -14
  72. package/test-env/components/resizable_container/resizable_panel.js +3 -5
  73. package/test-env/components/resizable_container/resizable_panel.styles.js +17 -26
  74. package/test-env/components/selectable/selectable_list/selectable_list.js +29 -6
  75. package/test-env/components/tool_tip/icon_tip.js +4 -3
  76. package/test-env/global_styling/mixins/_color.js +63 -40
  77. package/test-env/global_styling/mixins/_padding.js +59 -25
  78. package/test-env/services/theme/style_memoization.js +1 -3
@@ -1,22 +1,26 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.useEuiBorderColorCSS = exports.useEuiBackgroundColorCSS = exports.useEuiBackgroundColor = exports.euiBorderColor = exports.euiBackgroundColor = exports.BACKGROUND_COLORS = void 0;
7
- var _react = require("react");
8
- var _react2 = require("@emotion/react");
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _react = require("@emotion/react");
9
10
  var _services = require("../../services");
10
- /*
11
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
12
- * or more contributor license agreements. Licensed under the Elastic License
13
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
14
- * in compliance with, at your election, the Elastic License 2.0 or the Server
15
- * Side Public License, v 1.
16
- */
17
-
11
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
12
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } /*
13
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
14
+ * or more contributor license agreements. Licensed under the Elastic License
15
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
16
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
17
+ * Side Public License, v 1.
18
+ */
18
19
  var BACKGROUND_COLORS = ['transparent', 'plain', 'subdued', 'accent', 'primary', 'success', 'warning', 'danger'];
19
20
  exports.BACKGROUND_COLORS = BACKGROUND_COLORS;
21
+ /**
22
+ * @returns A single background color with optional alpha transparency
23
+ */
20
24
  var euiBackgroundColor = function euiBackgroundColor(_ref, color) {
21
25
  var euiTheme = _ref.euiTheme,
22
26
  colorMode = _ref.colorMode;
@@ -45,31 +49,52 @@ var euiBackgroundColor = function euiBackgroundColor(_ref, color) {
45
49
  }
46
50
  }
47
51
  };
52
+
53
+ /**
54
+ * @returns An object map of color keys to color values, categorized by
55
+ * opaque (default) vs transparency (hover/focus states) methods.
56
+ * e.g. {
57
+ * opaque: { danger: '#000', success: '#fff', ... },
58
+ * transparent: { danger: 'rgba(0,0,0,0.1)', success: 'rgba(255,255,255,0.1)', ... },
59
+ * }
60
+ */
48
61
  exports.euiBackgroundColor = euiBackgroundColor;
62
+ var _euiBackgroundColorMap = function _euiBackgroundColorMap(euiThemeContext) {
63
+ return {
64
+ opaque: BACKGROUND_COLORS.reduce(function (acc, color) {
65
+ return _objectSpread(_objectSpread({}, acc), {}, (0, _defineProperty2.default)({}, color, euiBackgroundColor(euiThemeContext, color)));
66
+ }, {}),
67
+ transparent: BACKGROUND_COLORS.reduce(function (acc, color) {
68
+ return _objectSpread(_objectSpread({}, acc), {}, (0, _defineProperty2.default)({}, color, euiBackgroundColor(euiThemeContext, color, {
69
+ method: 'transparent'
70
+ })));
71
+ }, {})
72
+ };
73
+ };
49
74
  var useEuiBackgroundColor = function useEuiBackgroundColor(color) {
50
75
  var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
51
76
  method = _ref3.method;
52
- var euiTheme = (0, _services.useEuiTheme)();
53
- return euiBackgroundColor(euiTheme, color, {
54
- method: method
55
- });
77
+ var backgroundColorMap = (0, _services.useEuiMemoizedStyles)(_euiBackgroundColorMap);
78
+ return backgroundColorMap[method || 'opaque'][color];
56
79
  };
80
+
81
+ /**
82
+ * @returns An object map of color keys to CSS,
83
+ * e.g. { danger: css``, success: css``, ... }
84
+ */
57
85
  exports.useEuiBackgroundColor = useEuiBackgroundColor;
86
+ var _euiBackgroundColors = function _euiBackgroundColors(euiThemeContext) {
87
+ return BACKGROUND_COLORS.reduce(function (acc, color) {
88
+ return _objectSpread(_objectSpread({}, acc), {}, (0, _defineProperty2.default)({}, color, /*#__PURE__*/(0, _react.css)("background-color:", euiBackgroundColor(euiThemeContext, color), ";label:", color, ";")));
89
+ }, {});
90
+ };
58
91
  var useEuiBackgroundColorCSS = function useEuiBackgroundColorCSS() {
59
- var euiThemeContext = (0, _services.useEuiTheme)();
60
- return (0, _react.useMemo)(function () {
61
- return {
62
- transparent: /*#__PURE__*/(0, _react2.css)("background-color:", euiBackgroundColor(euiThemeContext, 'transparent'), ";;label:transparent;"),
63
- plain: /*#__PURE__*/(0, _react2.css)("background-color:", euiBackgroundColor(euiThemeContext, 'plain'), ";;label:plain;"),
64
- subdued: /*#__PURE__*/(0, _react2.css)("background-color:", euiBackgroundColor(euiThemeContext, 'subdued'), ";;label:subdued;"),
65
- accent: /*#__PURE__*/(0, _react2.css)("background-color:", euiBackgroundColor(euiThemeContext, 'accent'), ";;label:accent;"),
66
- primary: /*#__PURE__*/(0, _react2.css)("background-color:", euiBackgroundColor(euiThemeContext, 'primary'), ";;label:primary;"),
67
- success: /*#__PURE__*/(0, _react2.css)("background-color:", euiBackgroundColor(euiThemeContext, 'success'), ";;label:success;"),
68
- warning: /*#__PURE__*/(0, _react2.css)("background-color:", euiBackgroundColor(euiThemeContext, 'warning'), ";;label:warning;"),
69
- danger: /*#__PURE__*/(0, _react2.css)("background-color:", euiBackgroundColor(euiThemeContext, 'danger'), ";;label:danger;")
70
- };
71
- }, [euiThemeContext]);
92
+ return (0, _services.useEuiMemoizedStyles)(_euiBackgroundColors);
72
93
  };
94
+
95
+ /**
96
+ * Border colors
97
+ */
73
98
  exports.useEuiBackgroundColorCSS = useEuiBackgroundColorCSS;
74
99
  var euiBorderColor = function euiBorderColor(_ref4, color) {
75
100
  var euiTheme = _ref4.euiTheme,
@@ -85,20 +110,18 @@ var euiBorderColor = function euiBorderColor(_ref4, color) {
85
110
  return (0, _services.tintOrShade)(euiTheme.colors[color], 0.6, colorMode);
86
111
  }
87
112
  };
113
+
114
+ /**
115
+ * @returns An object map of color keys to CSS,
116
+ * e.g. { danger: css``, success: css``, ... }
117
+ */
88
118
  exports.euiBorderColor = euiBorderColor;
119
+ var _euiBorderColors = function _euiBorderColors(euiThemeContext) {
120
+ return BACKGROUND_COLORS.reduce(function (acc, color) {
121
+ return _objectSpread(_objectSpread({}, acc), {}, (0, _defineProperty2.default)({}, color, /*#__PURE__*/(0, _react.css)("border-color:", euiBorderColor(euiThemeContext, color), ";label:", color, ";")));
122
+ }, {});
123
+ };
89
124
  var useEuiBorderColorCSS = function useEuiBorderColorCSS() {
90
- var euiThemeContext = (0, _services.useEuiTheme)();
91
- return (0, _react.useMemo)(function () {
92
- return {
93
- transparent: /*#__PURE__*/(0, _react2.css)("border-color:", euiBorderColor(euiThemeContext, 'transparent'), ";;label:transparent;"),
94
- plain: /*#__PURE__*/(0, _react2.css)("border-color:", euiBorderColor(euiThemeContext, 'plain'), ";;label:plain;"),
95
- subdued: /*#__PURE__*/(0, _react2.css)("border-color:", euiBorderColor(euiThemeContext, 'subdued'), ";;label:subdued;"),
96
- accent: /*#__PURE__*/(0, _react2.css)("border-color:", euiBorderColor(euiThemeContext, 'accent'), ";;label:accent;"),
97
- primary: /*#__PURE__*/(0, _react2.css)("border-color:", euiBorderColor(euiThemeContext, 'primary'), ";;label:primary;"),
98
- success: /*#__PURE__*/(0, _react2.css)("border-color:", euiBorderColor(euiThemeContext, 'success'), ";;label:success;"),
99
- warning: /*#__PURE__*/(0, _react2.css)("border-color:", euiBorderColor(euiThemeContext, 'warning'), ";;label:warning;"),
100
- danger: /*#__PURE__*/(0, _react2.css)("border-color:", euiBorderColor(euiThemeContext, 'danger'), ";;label:danger;")
101
- };
102
- }, [euiThemeContext]);
125
+ return (0, _services.useEuiMemoizedStyles)(_euiBorderColors);
103
126
  };
104
127
  exports.useEuiBorderColorCSS = useEuiBorderColorCSS;
@@ -1,22 +1,28 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
- exports.useEuiPaddingSize = exports.useEuiPaddingCSS = exports.euiPaddingSizeCSS = exports.euiPaddingSize = exports.PADDING_SIZES = void 0;
7
+ exports.useEuiPaddingSize = exports.useEuiPaddingCSS = exports.euiPaddingSize = exports.PADDING_SIZES = void 0;
8
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
7
10
  var _react = require("@emotion/react");
8
11
  var _theme = require("../../services/theme");
9
- var _functions = require("../functions");
10
- /*
11
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
12
- * or more contributor license agreements. Licensed under the Elastic License
13
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
14
- * in compliance with, at your election, the Elastic License 2.0 or the Server
15
- * Side Public License, v 1.
16
- */
17
-
12
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
13
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } /*
14
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
15
+ * or more contributor license agreements. Licensed under the Elastic License
16
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
17
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
18
+ * Side Public License, v 1.
19
+ */
18
20
  var PADDING_SIZES = ['none', 'xs', 's', 'm', 'l', 'xl'];
19
21
  exports.PADDING_SIZES = PADDING_SIZES;
22
+ /**
23
+ * Get a single padding size
24
+ */
25
+
20
26
  var euiPaddingSize = function euiPaddingSize(_ref, size) {
21
27
  var euiTheme = _ref.euiTheme;
22
28
  switch (size) {
@@ -28,26 +34,54 @@ var euiPaddingSize = function euiPaddingSize(_ref, size) {
28
34
  return euiTheme.size[size];
29
35
  }
30
36
  };
37
+
38
+ /**
39
+ * @returns An object map of padding size keys to padding values,
40
+ * e.g. { s: '8px', m: '16px', ... }
41
+ */
31
42
  exports.euiPaddingSize = euiPaddingSize;
32
- var euiPaddingSizeCSS = function euiPaddingSizeCSS(euiThemeContext, side) {
33
- var property = side ? "padding-".concat(_functions.logicalSide[side]) : 'padding';
34
- return {
35
- none: null,
36
- xs: /*#__PURE__*/(0, _react.css)(property, ":", euiPaddingSize(euiThemeContext, 'xs'), ";;label:xs;"),
37
- s: /*#__PURE__*/(0, _react.css)(property, ":", euiPaddingSize(euiThemeContext, 's'), ";;label:s;"),
38
- m: /*#__PURE__*/(0, _react.css)(property, ":", euiPaddingSize(euiThemeContext, 'm'), ";;label:m;"),
39
- l: /*#__PURE__*/(0, _react.css)(property, ":", euiPaddingSize(euiThemeContext, 'l'), ";;label:l;"),
40
- xl: /*#__PURE__*/(0, _react.css)(property, ":", euiPaddingSize(euiThemeContext, 'xl'), ";;label:xl;")
41
- };
43
+ var _getEuiPaddingSize = function _getEuiPaddingSize(euiThemeContext) {
44
+ return PADDING_SIZES.reduce(function (stylesAcc, size) {
45
+ return _objectSpread(_objectSpread({}, stylesAcc), {}, (0, _defineProperty2.default)({}, size, size === 'none' ? null : euiPaddingSize(euiThemeContext, size)));
46
+ }, {});
42
47
  };
43
- exports.euiPaddingSizeCSS = euiPaddingSizeCSS;
44
48
  var useEuiPaddingSize = function useEuiPaddingSize(size) {
45
- var euiTheme = (0, _theme.useEuiTheme)();
46
- return euiPaddingSize(euiTheme, size);
49
+ var sizes = (0, _theme.useEuiMemoizedStyles)(_getEuiPaddingSize);
50
+ return sizes[size];
47
51
  };
52
+
53
+ /**
54
+ * @returns An object map of all padding sizes for all padding sides properties
55
+ * e.g., {
56
+ * padding: { s: css`padding-size: 8px`, ... }
57
+ * left: { s: css`padding-inline-start: 8px`, ... }
58
+ * }
59
+ */
48
60
  exports.useEuiPaddingSize = useEuiPaddingSize;
61
+ var _euiPaddingSidesAndSizes = function _euiPaddingSidesAndSizes(euiThemeContext) {
62
+ var sizesMap = _getEuiPaddingSize(euiThemeContext);
63
+ // The `_` prefix stops Emotion from applying the function name as a label
64
+ var _generateSizeStyles = function _generateSizeStyles(cssProperty) {
65
+ return Object.fromEntries(Object.entries(sizesMap).map(function (_ref2) {
66
+ var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
67
+ sizeKey = _ref3[0],
68
+ sizeValue = _ref3[1];
69
+ return [sizeKey, sizeValue === null ? null : /*#__PURE__*/(0, _react.css)(cssProperty, ":", sizeValue, ";label:", sizeKey, ";")];
70
+ }));
71
+ };
72
+ var sidesMap = {
73
+ padding: _generateSizeStyles('padding'),
74
+ vertical: _generateSizeStyles('padding-block'),
75
+ top: _generateSizeStyles('padding-block-start'),
76
+ bottom: _generateSizeStyles('padding-block-end'),
77
+ horizontal: _generateSizeStyles('padding-inline'),
78
+ left: _generateSizeStyles('padding-inline-start'),
79
+ right: _generateSizeStyles('padding-inline-end')
80
+ };
81
+ return sidesMap;
82
+ };
49
83
  var useEuiPaddingCSS = function useEuiPaddingCSS(side) {
50
- var euiTheme = (0, _theme.useEuiTheme)();
51
- return euiPaddingSizeCSS(euiTheme, side);
84
+ var memoizedSideMap = (0, _theme.useEuiMemoizedStyles)(_euiPaddingSidesAndSizes);
85
+ return memoizedSideMap[side || 'padding'];
52
86
  };
53
87
  exports.useEuiPaddingCSS = useEuiPaddingCSS;
@@ -22,9 +22,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
22
22
  * Side Public License, v 1.
23
23
  */
24
24
 
25
- // NOTE: We're specifically using a WeakMap instead of a Map in order to allow
26
- // unmounted components to have their styles garbage-collected by the browser
27
- // @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap
25
+ // Typically an object of serialized css`` styles, but can have any amount of nesting, so it's not worth it to try and strictly type this
28
26
 
29
27
  var EuiThemeMemoizedStylesContext = /*#__PURE__*/(0, _react.createContext)(new WeakMap());
30
28
  exports.EuiThemeMemoizedStylesContext = EuiThemeMemoizedStylesContext;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@elastic/eui",
3
3
  "description": "Elastic UI Component Library",
4
- "version": "93.4.0",
4
+ "version": "93.5.1-rc.0",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "lib",
7
7
  "module": "es",
@@ -59,24 +59,23 @@
59
59
  ],
60
60
  "dependencies": {
61
61
  "@hello-pangea/dnd": "^16.3.0",
62
- "@types/lodash": "^4.14.198",
63
- "@types/numeral": "^2.0.2",
64
- "@types/react-window": "^1.8.5",
65
- "@types/refractor": "^3.0.2",
66
- "@types/resize-observer-browser": "^0.1.7",
62
+ "@types/lodash": "^4.14.202",
63
+ "@types/numeral": "^2.0.5",
64
+ "@types/react-window": "^1.8.8",
65
+ "@types/refractor": "^3.4.0",
67
66
  "chroma-js": "^2.4.2",
68
- "classnames": "^2.3.2",
67
+ "classnames": "^2.5.1",
69
68
  "lodash": "^4.17.21",
70
69
  "mdast-util-to-hast": "^10.2.0",
71
70
  "numeral": "^2.0.6",
72
- "prop-types": "^15.6.0",
71
+ "prop-types": "^15.8.1",
73
72
  "react-dropzone": "^11.7.1",
74
73
  "react-element-to-jsx-string": "^15.0.0",
75
74
  "react-focus-on": "^3.9.1",
76
75
  "react-is": "^17.0.2",
77
76
  "react-remove-scroll-bar": "^2.3.4",
78
77
  "react-virtualized-auto-sizer": "^1.0.20",
79
- "react-window": "^1.8.9",
78
+ "react-window": "^1.8.10",
80
79
  "refractor": "^3.6.0",
81
80
  "rehype-raw": "^5.1.0",
82
81
  "rehype-react": "^6.2.1",
@@ -213,7 +212,6 @@
213
212
  "pre-push": "^0.1.4",
214
213
  "prettier": "^2.8.8",
215
214
  "process": "^0.11.10",
216
- "prop-types": "^15.6.0",
217
215
  "raw-loader": "^4.0.1",
218
216
  "react": "^18.2.0",
219
217
  "react-16": "npm:react@^16.14.0",
@@ -258,7 +256,6 @@
258
256
  "@types/react": "^16.9 || ^17.0 || ^18.0",
259
257
  "@types/react-dom": "^16.9 || ^17.0 || ^18.0",
260
258
  "moment": "^2.13.0",
261
- "prop-types": "^15.5.0",
262
259
  "react": "^16.12 || ^17.0 || ^18.0",
263
260
  "react-dom": "^16.12 || ^17.0 || ^18.0",
264
261
  "typescript": "~4.5.3"
@@ -2,6 +2,11 @@
2
2
  @include euiFormControlStyle;
3
3
  line-height: $euiLineHeight; // give more spacing between multiple lines
4
4
 
5
+ // <textarea>s default to `inline-block`, which causes an extra 2-3px of
6
+ // unnecessary height within its parent `block` form control wrapper.
7
+ // @see https://stackoverflow.com/a/27536461/4294462
8
+ display: block;
9
+
5
10
  // Textareas have their own sizing
6
11
  &,
7
12
  &--compressed {
@@ -20,6 +20,8 @@
20
20
  .euiSelectableList__list {
21
21
  @include euiOverflowShadow;
22
22
  @include euiScrollBar;
23
+ overflow: auto;
24
+ position: relative; // Chrome/Edge loses its mind without this and doesn't render `mask-image` correctly
23
25
 
24
26
  &:focus,
25
27
  & > ul:focus {
@@ -82,6 +82,7 @@ var EuiHeaderLinks = function EuiHeaderLinks(_ref) {
82
82
  size: "m"
83
83
  }));
84
84
  });
85
+ var renderedChildren = typeof children === 'function' ? children(closeMenu) : children;
85
86
  return (0, _react2.jsx)(_i18n.EuiI18n, {
86
87
  token: "euiHeaderLinks.appNavigation",
87
88
  default: "App menu"
@@ -95,7 +96,7 @@ var EuiHeaderLinks = function EuiHeaderLinks(_ref) {
95
96
  }, (0, _react2.jsx)("div", {
96
97
  className: "euiHeaderLinks__list",
97
98
  css: [styles.euiHeaderLinks__list, styles.gutterSizes[gutterSize], ";label:EuiHeaderLinks;"]
98
- }, children)), (0, _react2.jsx)(_responsive.EuiShowFor, {
99
+ }, renderedChildren)), (0, _react2.jsx)(_responsive.EuiShowFor, {
99
100
  sizes: popoverBreakpoints
100
101
  }, (0, _react2.jsx)(_popover.EuiPopover, (0, _extends2.default)({
101
102
  button: button,
@@ -107,7 +108,7 @@ var EuiHeaderLinks = function EuiHeaderLinks(_ref) {
107
108
  }, popoverProps), (0, _react2.jsx)("div", {
108
109
  className: "euiHeaderLinks__mobileList",
109
110
  css: styles.euiHeaderLinks__mobileList
110
- }, children))));
111
+ }, renderedChildren))));
111
112
  });
112
113
  };
113
114
  exports.EuiHeaderLinks = EuiHeaderLinks;
@@ -116,6 +117,13 @@ EuiHeaderLinks.propTypes = {
116
117
  "aria-label": _propTypes.default.string,
117
118
  "data-test-subj": _propTypes.default.string,
118
119
  css: _propTypes.default.any,
120
+ /**
121
+ * Takes any rendered node(s), typically of `EuiHeaderLink`s.
122
+ *
123
+ * Optionally takes a render function that will pass a callback allowing you
124
+ * to close the mobile popover from within your popover content.
125
+ */
126
+ children: _propTypes.default.oneOfType([_propTypes.default.node.isRequired, _propTypes.default.func.isRequired]),
119
127
  /**
120
128
  * Spacing between direct children
121
129
  */
@@ -58,11 +58,10 @@ var EuiPanel = function EuiPanel(_ref) {
58
58
  panelRef = _ref.panelRef,
59
59
  element = _ref.element,
60
60
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
61
- var euiTheme = (0, _services.useEuiTheme)();
62
61
  // Shadows are only allowed when there's a white background (plain)
63
62
  var canHaveShadow = !hasBorder && color === 'plain';
64
63
  var canHaveBorder = color === 'plain' || color === 'transparent';
65
- var styles = (0, _panel.euiPanelStyles)(euiTheme);
64
+ var styles = (0, _services.useEuiMemoizedStyles)(_panel.euiPanelStyles);
66
65
  var cssStyles = [styles.euiPanel, grow && styles.grow, styles.radius[borderRadius], (0, _global_styling.useEuiPaddingCSS)()[paddingSize], (0, _global_styling.useEuiBackgroundColorCSS)()[color], canHaveShadow && hasShadow === true && styles.hasShadow, canHaveBorder && hasBorder === true && styles.hasBorder, rest.onClick && styles.isClickable];
67
66
  var classes = (0, _classnames.default)('euiPanel', "euiPanel--".concat(color), (0, _defineProperty2.default)({}, "euiPanel--".concat(paddingSizeToClassNameMap[paddingSize]), paddingSizeToClassNameMap[paddingSize]), className);
68
67
  if (rest.onClick && element !== 'div') {
@@ -42,8 +42,7 @@ var EuiResizableButton = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref
42
42
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
43
43
  var classes = (0, _classnames.default)('euiResizableButton', className);
44
44
  var resizeDirection = isHorizontal ? 'horizontal' : 'vertical';
45
- var euiTheme = (0, _services.useEuiTheme)();
46
- var styles = (0, _resizable_button.euiResizableButtonStyles)(euiTheme);
45
+ var styles = (0, _services.useEuiMemoizedStyles)(_resizable_button.euiResizableButtonStyles);
47
46
  var cssStyles = [styles.euiResizableButton, styles[indicator], styles["".concat(indicator, "Direction")][resizeDirection], styles[resizeDirection], indicator === 'handle' && styles.alignIndicator[alignIndicator]];
48
47
  return (0, _react2.jsx)(_i18n.EuiI18n, {
49
48
  tokens: ['euiResizableButton.horizontalResizerAriaLabel', 'euiResizableButton.verticalResizerAriaLabel'],
@@ -38,8 +38,7 @@ var EuiResizableCollapseButton = function EuiResizableCollapseButton(_ref) {
38
38
  var isHorizontal = direction === 'horizontal';
39
39
  var showOnFocus = !isCollapsed && !isVisible;
40
40
  var screenReaderOnlyStyles = (0, _screen_reader_only.euiScreenReaderOnlyStyles)(showOnFocus).euiScreenReaderOnly;
41
- var euiTheme = (0, _services.useEuiTheme)();
42
- var styles = (0, _resizable_collapse_button.euiResizableCollapseButtonStyles)(euiTheme);
41
+ var styles = (0, _services.useEuiMemoizedStyles)(_resizable_collapse_button.euiResizableCollapseButtonStyles);
43
42
  var collapsedStyles = [styles.collapsed.collapsed, styles.collapsed[direction], styles.collapsed["".concat(direction, "Positions")][internalPosition]];
44
43
  var collapsibleStyles = [styles.collapsible.collapsible, styles.collapsible[direction][externalPosition], styles.collapsible[direction][internalPosition]];
45
44
  var cssStyles = [styles.euiResizableCollapseButton, showOnFocus && screenReaderOnlyStyles].concat((0, _toConsumableArray2.default)(isCollapsed ? collapsedStyles : collapsibleStyles));
@@ -59,8 +59,7 @@ var EuiResizableContainer = function EuiResizableContainer(_ref) {
59
59
  var containerRef = (0, _react.useRef)(null);
60
60
  var isHorizontal = direction === 'horizontal';
61
61
  var classes = (0, _classnames.default)('euiResizableContainer', className);
62
- var styles = (0, _resizable_container.euiResizableContainerStyles)();
63
- var cssStyles = [styles.euiResizableContainer, styles[direction]];
62
+ var cssStyles = [_resizable_container.euiResizableContainerStyles.euiResizableContainer, _resizable_container.euiResizableContainerStyles[direction]];
64
63
  var _useContainerCallback = (0, _helpers.useContainerCallbacks)({
65
64
  initialState: _objectSpread(_objectSpread({}, initialState), {}, {
66
65
  isHorizontal: isHorizontal
@@ -13,19 +13,16 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
13
13
  * in compliance with, at your election, the Elastic License 2.0 or the Server
14
14
  * Side Public License, v 1.
15
15
  */
16
- var _ref = process.env.NODE_ENV === "production" ? {
17
- name: "omnk2l-vertical",
18
- styles: "flex-direction:column;label:vertical;"
19
- } : {
20
- name: "omnk2l-vertical",
21
- styles: "flex-direction:column;label:vertical;",
22
- toString: _EMOTION_STRINGIFIED_CSS_ERROR__
23
- };
24
- var euiResizableContainerStyles = function euiResizableContainerStyles() {
25
- return {
26
- euiResizableContainer: /*#__PURE__*/(0, _react.css)("display:flex;", (0, _global_styling.logicalCSS)('width', '100%'), ";;label:euiResizableContainer;"),
27
- horizontal: /*#__PURE__*/(0, _react.css)(";label:horizontal;"),
28
- vertical: _ref
29
- };
16
+ var euiResizableContainerStyles = {
17
+ euiResizableContainer: /*#__PURE__*/(0, _react.css)("display:flex;", (0, _global_styling.logicalCSS)('width', '100%'), ";;label:euiResizableContainer;"),
18
+ horizontal: /*#__PURE__*/(0, _react.css)(";label:horizontal;"),
19
+ vertical: process.env.NODE_ENV === "production" ? {
20
+ name: "omnk2l-vertical",
21
+ styles: "flex-direction:column;label:vertical;"
22
+ } : {
23
+ name: "omnk2l-vertical",
24
+ styles: "flex-direction:column;label:vertical;",
25
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
26
+ }
30
27
  };
31
28
  exports.euiResizableContainerStyles = euiResizableContainerStyles;
@@ -146,15 +146,13 @@ var EuiResizablePanel = function EuiResizablePanel(_ref) {
146
146
  return direction;
147
147
  }, [isCollapsed, isCollapsible, position, panels, panelId]);
148
148
  var axis = isHorizontal ? 'horizontal' : 'vertical';
149
- var euiTheme = (0, _services.useEuiTheme)();
150
- var styles = (0, _resizable_panel.euiResizablePanelStyles)(euiTheme);
151
- var cssStyles = [styles.euiResizablePanel, isCollapsed && styles.collapsed, styles.paddingSizes[wrapperPadding], wrapperProps === null || wrapperProps === void 0 ? void 0 : wrapperProps.css];
152
- var contentStyles = (0, _resizable_panel.euiResizablePanelContentStyles)(euiTheme);
149
+ var cssStyles = [_resizable_panel.euiResizablePanelStyles.euiResizablePanel, isCollapsed && _resizable_panel.euiResizablePanelStyles.collapsed, (0, _global_styling.useEuiPaddingCSS)()[wrapperPadding], wrapperProps === null || wrapperProps === void 0 ? void 0 : wrapperProps.css];
150
+ var contentStyles = (0, _services.useEuiMemoizedStyles)(_resizable_panel.euiResizablePanelContentStyles);
153
151
  var contentCssStyles = [contentStyles.euiResizablePanel__content, scrollable && contentStyles.scrollable, isCollapsed && contentStyles.collapsedChildren, isCollapsed && !isCollapsible && contentStyles[axis].collapsed, isCollapsible && contentStyles[axis].hasCollapsibleButton];
154
152
  var classes = (0, _classnames.default)('euiResizablePanel', wrapperProps === null || wrapperProps === void 0 ? void 0 : wrapperProps.className);
155
153
  var panelClasses = (0, _classnames.default)('euiResizablePanel__content', className);
156
154
  var inlineStyles = _objectSpread(_objectSpread({}, wrapperProps === null || wrapperProps === void 0 ? void 0 : wrapperProps.style), isHorizontal ? (0, _global_styling.logicalSizeStyle)("".concat(size || innerSize, "%"), 'auto') : (0, _global_styling.logicalSizeStyle)('100%', "".concat(size || innerSize, "%")));
157
- var padding = (0, _global_styling.euiPaddingSize)(euiTheme, paddingSize) || '0px';
155
+ var padding = (0, _global_styling.useEuiPaddingSize)(paddingSize) || '0px';
158
156
  (0, _react.useEffect)(function () {
159
157
  if (!registration) return;
160
158
  var initSize = size !== null && size !== void 0 ? size : initialSize || 0;
@@ -1,15 +1,11 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.euiResizablePanelStyles = exports.euiResizablePanelContentStyles = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
7
  var _react = require("@emotion/react");
10
8
  var _global_styling = require("../../global_styling");
11
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
12
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
13
9
  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)."; } /*
14
10
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
15
11
  * or more contributor license agreements. Licensed under the Elastic License
@@ -17,28 +13,23 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
17
13
  * in compliance with, at your election, the Elastic License 2.0 or the Server
18
14
  * Side Public License, v 1.
19
15
  */
20
- var _ref2 = process.env.NODE_ENV === "production" ? {
21
- name: "11qmbh3-collapsed",
22
- styles: "overflow:hidden;label:collapsed;"
23
- } : {
24
- name: "11qmbh3-collapsed",
25
- styles: "overflow:hidden;label:collapsed;",
26
- toString: _EMOTION_STRINGIFIED_CSS_ERROR__
27
- };
28
- var _ref3 = process.env.NODE_ENV === "production" ? {
29
- name: "15ifdgc-euiResizablePanel",
30
- styles: "position:relative;label:euiResizablePanel;"
31
- } : {
32
- name: "15ifdgc-euiResizablePanel",
33
- styles: "position:relative;label:euiResizablePanel;",
34
- toString: _EMOTION_STRINGIFIED_CSS_ERROR__
35
- };
36
- var euiResizablePanelStyles = function euiResizablePanelStyles(euiThemeContext) {
37
- return {
38
- euiResizablePanel: _ref3,
39
- collapsed: _ref2,
40
- paddingSizes: _objectSpread({}, (0, _global_styling.euiPaddingSizeCSS)(euiThemeContext))
41
- };
16
+ var euiResizablePanelStyles = {
17
+ euiResizablePanel: process.env.NODE_ENV === "production" ? {
18
+ name: "15ifdgc-euiResizablePanel",
19
+ styles: "position:relative;label:euiResizablePanel;"
20
+ } : {
21
+ name: "15ifdgc-euiResizablePanel",
22
+ styles: "position:relative;label:euiResizablePanel;",
23
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
24
+ },
25
+ collapsed: process.env.NODE_ENV === "production" ? {
26
+ name: "11qmbh3-collapsed",
27
+ styles: "overflow:hidden;label:collapsed;"
28
+ } : {
29
+ name: "11qmbh3-collapsed",
30
+ styles: "overflow:hidden;label:collapsed;",
31
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
32
+ }
42
33
  };
43
34
  exports.euiResizablePanelStyles = euiResizablePanelStyles;
44
35
  var _ref = process.env.NODE_ENV === "production" ? {
@@ -422,14 +422,33 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
422
422
  key: "componentDidUpdate",
423
423
  value: function componentDidUpdate(prevProps) {
424
424
  var _this$props9 = this.props,
425
+ isVirtualized = _this$props9.isVirtualized,
425
426
  activeOptionIndex = _this$props9.activeOptionIndex,
426
427
  visibleOptions = _this$props9.visibleOptions,
427
428
  options = _this$props9.options;
428
- if (this.listBoxRef && this.props.searchable !== true) {
429
- this.listBoxRef.setAttribute('aria-activedescendant', "".concat(this.props.makeOptionId(activeOptionIndex)));
430
- }
431
- if (this.listRef && typeof activeOptionIndex !== 'undefined') {
432
- this.listRef.scrollToItem(activeOptionIndex, 'auto');
429
+ if (prevProps.activeOptionIndex !== activeOptionIndex) {
430
+ var makeOptionId = this.props.makeOptionId;
431
+ if (this.listBoxRef && this.props.searchable !== true) {
432
+ this.listBoxRef.setAttribute('aria-activedescendant', makeOptionId(activeOptionIndex));
433
+ }
434
+ if (typeof activeOptionIndex !== 'undefined') {
435
+ if (isVirtualized) {
436
+ var _this$listRef;
437
+ (_this$listRef = this.listRef) === null || _this$listRef === void 0 ? void 0 : _this$listRef.scrollToItem(activeOptionIndex, 'auto');
438
+ } else {
439
+ var _this$listBoxRef;
440
+ var activeOptionId = "#".concat(makeOptionId(activeOptionIndex));
441
+ var activeOptionEl = (_this$listBoxRef = this.listBoxRef) === null || _this$listBoxRef === void 0 ? void 0 : _this$listBoxRef.querySelector(activeOptionId);
442
+ if (activeOptionEl) {
443
+ var _activeOptionEl$scrol;
444
+ // TODO: we can remove scrollIntoView's conditional chaining once jsdom stubs it
445
+ // @see https://github.com/jsdom/jsdom/issues/1695
446
+ (_activeOptionEl$scrol = activeOptionEl.scrollIntoView) === null || _activeOptionEl$scrol === void 0 ? void 0 : _activeOptionEl$scrol.call(activeOptionEl, {
447
+ block: 'nearest'
448
+ });
449
+ }
450
+ }
451
+ }
433
452
  }
434
453
  if (prevProps.visibleOptions !== visibleOptions || prevProps.options !== options) {
435
454
  var optionArray = visibleOptions || options;
@@ -472,14 +491,18 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
472
491
  textWrap = _this$props10.textWrap,
473
492
  truncationProps = _this$props10.truncationProps,
474
493
  rest = (0, _objectWithoutProperties2.default)(_this$props10, _excluded3);
494
+ var heightIsFull = forcedHeight === 'full';
475
495
  var classes = (0, _classnames.default)('euiSelectableList', {
476
- 'euiSelectableList-fullHeight': forcedHeight === 'full',
496
+ 'euiSelectableList-fullHeight': heightIsFull,
477
497
  'euiSelectableList-bordered': bordered
478
498
  }, className);
479
499
  return (0, _react2.jsx)("div", (0, _extends2.default)({
480
500
  className: classes
481
501
  }, rest), isVirtualized ? this.renderVirtualizedList() : (0, _react2.jsx)("div", {
482
502
  className: "euiSelectableList__list",
503
+ style: !heightIsFull ? {
504
+ blockSize: forcedHeight
505
+ } : undefined,
483
506
  ref: this.removeScrollableTabStop
484
507
  }, (0, _react2.jsx)("ul", {
485
508
  ref: this.setListBoxRef