@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
@@ -4,19 +4,25 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  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");
7
+ var _react = require("@emotion/react");
9
8
  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
-
9
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
10
+ 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; }
11
+ 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) { _defineProperty(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; }
12
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
14
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /*
15
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
16
+ * or more contributor license agreements. Licensed under the Elastic License
17
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
18
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
19
+ * Side Public License, v 1.
20
+ */
18
21
  var BACKGROUND_COLORS = ['transparent', 'plain', 'subdued', 'accent', 'primary', 'success', 'warning', 'danger'];
19
22
  exports.BACKGROUND_COLORS = BACKGROUND_COLORS;
23
+ /**
24
+ * @returns A single background color with optional alpha transparency
25
+ */
20
26
  var euiBackgroundColor = function euiBackgroundColor(_ref, color) {
21
27
  var euiTheme = _ref.euiTheme,
22
28
  colorMode = _ref.colorMode;
@@ -45,31 +51,52 @@ var euiBackgroundColor = function euiBackgroundColor(_ref, color) {
45
51
  }
46
52
  }
47
53
  };
54
+
55
+ /**
56
+ * @returns An object map of color keys to color values, categorized by
57
+ * opaque (default) vs transparency (hover/focus states) methods.
58
+ * e.g. {
59
+ * opaque: { danger: '#000', success: '#fff', ... },
60
+ * transparent: { danger: 'rgba(0,0,0,0.1)', success: 'rgba(255,255,255,0.1)', ... },
61
+ * }
62
+ */
48
63
  exports.euiBackgroundColor = euiBackgroundColor;
64
+ var _euiBackgroundColorMap = function _euiBackgroundColorMap(euiThemeContext) {
65
+ return {
66
+ opaque: BACKGROUND_COLORS.reduce(function (acc, color) {
67
+ return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, color, euiBackgroundColor(euiThemeContext, color)));
68
+ }, {}),
69
+ transparent: BACKGROUND_COLORS.reduce(function (acc, color) {
70
+ return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, color, euiBackgroundColor(euiThemeContext, color, {
71
+ method: 'transparent'
72
+ })));
73
+ }, {})
74
+ };
75
+ };
49
76
  var useEuiBackgroundColor = function useEuiBackgroundColor(color) {
50
77
  var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
51
78
  method = _ref3.method;
52
- var euiTheme = (0, _services.useEuiTheme)();
53
- return euiBackgroundColor(euiTheme, color, {
54
- method: method
55
- });
79
+ var backgroundColorMap = (0, _services.useEuiMemoizedStyles)(_euiBackgroundColorMap);
80
+ return backgroundColorMap[method || 'opaque'][color];
56
81
  };
82
+
83
+ /**
84
+ * @returns An object map of color keys to CSS,
85
+ * e.g. { danger: css``, success: css``, ... }
86
+ */
57
87
  exports.useEuiBackgroundColor = useEuiBackgroundColor;
88
+ var _euiBackgroundColors = function _euiBackgroundColors(euiThemeContext) {
89
+ return BACKGROUND_COLORS.reduce(function (acc, color) {
90
+ return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, color, /*#__PURE__*/(0, _react.css)("background-color:", euiBackgroundColor(euiThemeContext, color), ";label:", color, ";")));
91
+ }, {});
92
+ };
58
93
  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]);
94
+ return (0, _services.useEuiMemoizedStyles)(_euiBackgroundColors);
72
95
  };
96
+
97
+ /**
98
+ * Border colors
99
+ */
73
100
  exports.useEuiBackgroundColorCSS = useEuiBackgroundColorCSS;
74
101
  var euiBorderColor = function euiBorderColor(_ref4, color) {
75
102
  var euiTheme = _ref4.euiTheme,
@@ -85,20 +112,18 @@ var euiBorderColor = function euiBorderColor(_ref4, color) {
85
112
  return (0, _services.tintOrShade)(euiTheme.colors[color], 0.6, colorMode);
86
113
  }
87
114
  };
115
+
116
+ /**
117
+ * @returns An object map of color keys to CSS,
118
+ * e.g. { danger: css``, success: css``, ... }
119
+ */
88
120
  exports.euiBorderColor = euiBorderColor;
121
+ var _euiBorderColors = function _euiBorderColors(euiThemeContext) {
122
+ return BACKGROUND_COLORS.reduce(function (acc, color) {
123
+ return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, color, /*#__PURE__*/(0, _react.css)("border-color:", euiBorderColor(euiThemeContext, color), ";label:", color, ";")));
124
+ }, {});
125
+ };
89
126
  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]);
127
+ return (0, _services.useEuiMemoizedStyles)(_euiBorderColors);
103
128
  };
104
129
  exports.useEuiBorderColorCSS = useEuiBorderColorCSS;
@@ -3,20 +3,33 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.useEuiPaddingSize = exports.useEuiPaddingCSS = exports.euiPaddingSizeCSS = exports.euiPaddingSize = exports.PADDING_SIZES = void 0;
6
+ exports.useEuiPaddingSize = exports.useEuiPaddingCSS = exports.euiPaddingSize = exports.PADDING_SIZES = void 0;
7
7
  var _react = require("@emotion/react");
8
8
  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
-
9
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
10
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
11
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
12
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
13
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
14
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
15
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
+ 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; }
17
+ 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) { _defineProperty(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; }
18
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
19
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
20
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /*
21
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
22
+ * or more contributor license agreements. Licensed under the Elastic License
23
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
24
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
25
+ * Side Public License, v 1.
26
+ */
18
27
  var PADDING_SIZES = ['none', 'xs', 's', 'm', 'l', 'xl'];
19
28
  exports.PADDING_SIZES = PADDING_SIZES;
29
+ /**
30
+ * Get a single padding size
31
+ */
32
+
20
33
  var euiPaddingSize = function euiPaddingSize(_ref, size) {
21
34
  var euiTheme = _ref.euiTheme;
22
35
  switch (size) {
@@ -28,26 +41,54 @@ var euiPaddingSize = function euiPaddingSize(_ref, size) {
28
41
  return euiTheme.size[size];
29
42
  }
30
43
  };
44
+
45
+ /**
46
+ * @returns An object map of padding size keys to padding values,
47
+ * e.g. { s: '8px', m: '16px', ... }
48
+ */
31
49
  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
- };
50
+ var _getEuiPaddingSize = function _getEuiPaddingSize(euiThemeContext) {
51
+ return PADDING_SIZES.reduce(function (stylesAcc, size) {
52
+ return _objectSpread(_objectSpread({}, stylesAcc), {}, _defineProperty({}, size, size === 'none' ? null : euiPaddingSize(euiThemeContext, size)));
53
+ }, {});
42
54
  };
43
- exports.euiPaddingSizeCSS = euiPaddingSizeCSS;
44
55
  var useEuiPaddingSize = function useEuiPaddingSize(size) {
45
- var euiTheme = (0, _theme.useEuiTheme)();
46
- return euiPaddingSize(euiTheme, size);
56
+ var sizes = (0, _theme.useEuiMemoizedStyles)(_getEuiPaddingSize);
57
+ return sizes[size];
47
58
  };
59
+
60
+ /**
61
+ * @returns An object map of all padding sizes for all padding sides properties
62
+ * e.g., {
63
+ * padding: { s: css`padding-size: 8px`, ... }
64
+ * left: { s: css`padding-inline-start: 8px`, ... }
65
+ * }
66
+ */
48
67
  exports.useEuiPaddingSize = useEuiPaddingSize;
68
+ var _euiPaddingSidesAndSizes = function _euiPaddingSidesAndSizes(euiThemeContext) {
69
+ var sizesMap = _getEuiPaddingSize(euiThemeContext);
70
+ // The `_` prefix stops Emotion from applying the function name as a label
71
+ var _generateSizeStyles = function _generateSizeStyles(cssProperty) {
72
+ return Object.fromEntries(Object.entries(sizesMap).map(function (_ref2) {
73
+ var _ref3 = _slicedToArray(_ref2, 2),
74
+ sizeKey = _ref3[0],
75
+ sizeValue = _ref3[1];
76
+ return [sizeKey, sizeValue === null ? null : /*#__PURE__*/(0, _react.css)(cssProperty, ":", sizeValue, ";label:", sizeKey, ";")];
77
+ }));
78
+ };
79
+ var sidesMap = {
80
+ padding: _generateSizeStyles('padding'),
81
+ vertical: _generateSizeStyles('padding-block'),
82
+ top: _generateSizeStyles('padding-block-start'),
83
+ bottom: _generateSizeStyles('padding-block-end'),
84
+ horizontal: _generateSizeStyles('padding-inline'),
85
+ left: _generateSizeStyles('padding-inline-start'),
86
+ right: _generateSizeStyles('padding-inline-end')
87
+ };
88
+ return sidesMap;
89
+ };
49
90
  var useEuiPaddingCSS = function useEuiPaddingCSS(side) {
50
- var euiTheme = (0, _theme.useEuiTheme)();
51
- return euiPaddingSizeCSS(euiTheme, side);
91
+ var memoizedSideMap = (0, _theme.useEuiMemoizedStyles)(_euiPaddingSidesAndSizes);
92
+ return memoizedSideMap[side || 'padding'];
52
93
  };
53
94
  exports.useEuiPaddingCSS = useEuiPaddingCSS;
@@ -23,9 +23,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } /*
23
23
  * 2.0 and the Server Side Public License, v 1; you may not use this file except
24
24
  * in compliance with, at your election, the Elastic License 2.0 or the Server
25
25
  * Side Public License, v 1.
26
- */ // NOTE: We're specifically using a WeakMap instead of a Map in order to allow
27
- // unmounted components to have their styles garbage-collected by the browser
28
- // @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap
26
+ */ // 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
29
27
  var EuiThemeMemoizedStylesContext = /*#__PURE__*/(0, _react.createContext)(new WeakMap());
30
28
  exports.EuiThemeMemoizedStylesContext = EuiThemeMemoizedStylesContext;
31
29
  var EuiThemeMemoizedStylesProvider = function EuiThemeMemoizedStylesProvider(_ref) {
@@ -71,6 +71,7 @@ export var EuiHeaderLinks = function EuiHeaderLinks(_ref) {
71
71
  size: "m"
72
72
  }));
73
73
  });
74
+ var renderedChildren = typeof children === 'function' ? children(closeMenu) : children;
74
75
  return ___EmotionJSX(EuiI18n, {
75
76
  token: "euiHeaderLinks.appNavigation",
76
77
  default: "App menu"
@@ -84,7 +85,7 @@ export var EuiHeaderLinks = function EuiHeaderLinks(_ref) {
84
85
  }, ___EmotionJSX("div", {
85
86
  className: "euiHeaderLinks__list",
86
87
  css: [styles.euiHeaderLinks__list, styles.gutterSizes[gutterSize], ";label:EuiHeaderLinks;"]
87
- }, children)), ___EmotionJSX(EuiShowFor, {
88
+ }, renderedChildren)), ___EmotionJSX(EuiShowFor, {
88
89
  sizes: popoverBreakpoints
89
90
  }, ___EmotionJSX(EuiPopover, _extends({
90
91
  button: button,
@@ -96,6 +97,6 @@ export var EuiHeaderLinks = function EuiHeaderLinks(_ref) {
96
97
  }, popoverProps), ___EmotionJSX("div", {
97
98
  className: "euiHeaderLinks__mobileList",
98
99
  css: styles.euiHeaderLinks__mobileList
99
- }, children))));
100
+ }, renderedChildren))));
100
101
  });
101
102
  };
@@ -216,8 +216,8 @@ export var EuiIconClass = /*#__PURE__*/function (_PureComponent) {
216
216
  } else {
217
217
  var Svg = icon;
218
218
 
219
- // If it's an empty icon, or if there is no aria-label, aria-labelledby, or title it gets aria-hidden true
220
- var isAriaHidden = icon === empty || !(this.props['aria-label'] || this.props['aria-labelledby'] || this.props.title);
219
+ // If there is no aria-label, aria-labelledby, or title it gets aria-hidden true
220
+ var isAriaHidden = !(this.props['aria-label'] || this.props['aria-labelledby'] || this.props.title);
221
221
 
222
222
  // If no aria-label or aria-labelledby is provided but there's a title, a titleId is generated
223
223
  // The svg aria-labelledby attribute gets this titleId
@@ -237,7 +237,7 @@ export var EuiIconClass = /*#__PURE__*/function (_PureComponent) {
237
237
  "data-is-loaded": isLoaded || undefined,
238
238
  "data-is-loading": isLoading || undefined
239
239
  }, rest, {
240
- "aria-hidden": isAriaHidden || undefined
240
+ "aria-hidden": isAriaHidden || rest['aria-hidden']
241
241
  }));
242
242
  }
243
243
  }
@@ -12,7 +12,7 @@ var _excluded = ["children", "className", "paddingSize", "borderRadius", "color"
12
12
 
13
13
  import React from 'react';
14
14
  import classNames from 'classnames';
15
- import { useEuiTheme } from '../../services';
15
+ import { useEuiMemoizedStyles } from '../../services';
16
16
  import { useEuiBackgroundColorCSS, useEuiPaddingCSS, BACKGROUND_COLORS, PADDING_SIZES } from '../../global_styling';
17
17
  import { keysOf } from '../common';
18
18
  import { euiPanelStyles } from './panel.styles';
@@ -48,11 +48,10 @@ export var EuiPanel = function EuiPanel(_ref) {
48
48
  panelRef = _ref.panelRef,
49
49
  element = _ref.element,
50
50
  rest = _objectWithoutProperties(_ref, _excluded);
51
- var euiTheme = useEuiTheme();
52
51
  // Shadows are only allowed when there's a white background (plain)
53
52
  var canHaveShadow = !hasBorder && color === 'plain';
54
53
  var canHaveBorder = color === 'plain' || color === 'transparent';
55
- var styles = euiPanelStyles(euiTheme);
54
+ var styles = useEuiMemoizedStyles(euiPanelStyles);
56
55
  var cssStyles = [styles.euiPanel, grow && styles.grow, styles.radius[borderRadius], useEuiPaddingCSS()[paddingSize], useEuiBackgroundColorCSS()[color], canHaveShadow && hasShadow === true && styles.hasShadow, canHaveBorder && hasBorder === true && styles.hasBorder, rest.onClick && styles.isClickable];
57
56
  var classes = classNames('euiPanel', "euiPanel--".concat(color), _defineProperty({}, "euiPanel--".concat(paddingSizeToClassNameMap[paddingSize]), paddingSizeToClassNameMap[paddingSize]), className);
58
57
  if (rest.onClick && element !== 'div') {
@@ -14,7 +14,7 @@ var _excluded = ["isHorizontal", "indicator", "alignIndicator", "className"],
14
14
  import React, { useCallback, useMemo, useRef, forwardRef } from 'react';
15
15
  import classNames from 'classnames';
16
16
  import { EuiI18n } from '../i18n';
17
- import { useEuiTheme, useGeneratedHtmlId } from '../../services';
17
+ import { useEuiMemoizedStyles, useGeneratedHtmlId } from '../../services';
18
18
  import { useEuiResizableContainerContext } from './context';
19
19
  import { euiResizableButtonStyles } from './resizable_button.styles';
20
20
  import { jsx as ___EmotionJSX } from "@emotion/react";
@@ -32,8 +32,7 @@ export var EuiResizableButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
32
32
  rest = _objectWithoutProperties(_ref, _excluded);
33
33
  var classes = classNames('euiResizableButton', className);
34
34
  var resizeDirection = isHorizontal ? 'horizontal' : 'vertical';
35
- var euiTheme = useEuiTheme();
36
- var styles = euiResizableButtonStyles(euiTheme);
35
+ var styles = useEuiMemoizedStyles(euiResizableButtonStyles);
37
36
  var cssStyles = [styles.euiResizableButton, styles[indicator], styles["".concat(indicator, "Direction")][resizeDirection], styles[resizeDirection], indicator === 'handle' && styles.alignIndicator[alignIndicator]];
38
37
  return ___EmotionJSX(EuiI18n, {
39
38
  tokens: ['euiResizableButton.horizontalResizerAriaLabel', 'euiResizableButton.verticalResizerAriaLabel'],
@@ -12,7 +12,7 @@ var _excluded = ["className", "externalPosition", "internalPosition", "direction
12
12
 
13
13
  import React from 'react';
14
14
  import classNames from 'classnames';
15
- import { useEuiTheme } from '../../services';
15
+ import { useEuiMemoizedStyles } from '../../services';
16
16
  import { EuiButtonIcon } from '../button';
17
17
  import { euiScreenReaderOnlyStyles } from '../accessibility/screen_reader_only/screen_reader_only.styles';
18
18
  import { euiResizableCollapseButtonStyles } from './resizable_collapse_button.styles';
@@ -31,8 +31,7 @@ export var EuiResizableCollapseButton = function EuiResizableCollapseButton(_ref
31
31
  var isHorizontal = direction === 'horizontal';
32
32
  var showOnFocus = !isCollapsed && !isVisible;
33
33
  var screenReaderOnlyStyles = euiScreenReaderOnlyStyles(showOnFocus).euiScreenReaderOnly;
34
- var euiTheme = useEuiTheme();
35
- var styles = euiResizableCollapseButtonStyles(euiTheme);
34
+ var styles = useEuiMemoizedStyles(euiResizableCollapseButtonStyles);
36
35
  var collapsedStyles = [styles.collapsed.collapsed, styles.collapsed[direction], styles.collapsed["".concat(direction, "Positions")][internalPosition]];
37
36
  var collapsibleStyles = [styles.collapsible.collapsible, styles.collapsible[direction][externalPosition], styles.collapsible[direction][internalPosition]];
38
37
  var cssStyles = [styles.euiResizableCollapseButton, showOnFocus && screenReaderOnlyStyles].concat(_toConsumableArray(isCollapsed ? collapsedStyles : collapsibleStyles));
@@ -21,7 +21,7 @@ import { EuiResizableContainerContextProvider } from './context';
21
21
  import { euiResizableButtonWithControls } from './resizable_button';
22
22
  import { euiResizablePanelWithControls, getModeType } from './resizable_panel';
23
23
  import { useContainerCallbacks, getPosition } from './helpers';
24
- import { euiResizableContainerStyles } from './resizable_container.styles';
24
+ import { euiResizableContainerStyles as styles } from './resizable_container.styles';
25
25
  import { jsx as ___EmotionJSX } from "@emotion/react";
26
26
  var initialState = {
27
27
  isDragging: false,
@@ -49,7 +49,6 @@ export var EuiResizableContainer = function EuiResizableContainer(_ref) {
49
49
  var containerRef = useRef(null);
50
50
  var isHorizontal = direction === 'horizontal';
51
51
  var classes = classNames('euiResizableContainer', className);
52
- var styles = euiResizableContainerStyles();
53
52
  var cssStyles = [styles.euiResizableContainer, styles[direction]];
54
53
  var _useContainerCallback = useContainerCallbacks({
55
54
  initialState: _objectSpread(_objectSpread({}, initialState), {}, {
@@ -9,18 +9,15 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
9
9
 
10
10
  import { css } from '@emotion/react';
11
11
  import { logicalCSS } from '../../global_styling';
12
- var _ref = process.env.NODE_ENV === "production" ? {
13
- name: "omnk2l-vertical",
14
- styles: "flex-direction:column;label:vertical;"
15
- } : {
16
- name: "omnk2l-vertical",
17
- styles: "flex-direction:column;label:vertical;",
18
- toString: _EMOTION_STRINGIFIED_CSS_ERROR__
19
- };
20
- export var euiResizableContainerStyles = function euiResizableContainerStyles() {
21
- return {
22
- euiResizableContainer: /*#__PURE__*/css("display:flex;", logicalCSS('width', '100%'), ";;label:euiResizableContainer;"),
23
- horizontal: /*#__PURE__*/css(";label:horizontal;"),
24
- vertical: _ref
25
- };
12
+ export var euiResizableContainerStyles = {
13
+ euiResizableContainer: /*#__PURE__*/css("display:flex;", logicalCSS('width', '100%'), ";;label:euiResizableContainer;"),
14
+ horizontal: /*#__PURE__*/css(";label:horizontal;"),
15
+ vertical: process.env.NODE_ENV === "production" ? {
16
+ name: "omnk2l-vertical",
17
+ styles: "flex-direction:column;label:vertical;"
18
+ } : {
19
+ name: "omnk2l-vertical",
20
+ styles: "flex-direction:column;label:vertical;",
21
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
22
+ }
26
23
  };
@@ -15,13 +15,13 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
15
15
 
16
16
  import React, { useEffect, useMemo, useRef } from 'react';
17
17
  import classNames from 'classnames';
18
- import { useGeneratedHtmlId, useEuiTheme } from '../../services';
19
- import { logicalSizeStyle, euiPaddingSize } from '../../global_styling';
18
+ import { useGeneratedHtmlId, useEuiMemoizedStyles } from '../../services';
19
+ import { logicalSizeStyle, useEuiPaddingSize, useEuiPaddingCSS } from '../../global_styling';
20
20
  import { useEuiResizableContainerContext } from './context';
21
21
  import { EuiPanel } from '../panel';
22
22
  import { useEuiI18n } from '../i18n';
23
23
  import { EuiResizableCollapseButton } from './resizable_collapse_button';
24
- import { euiResizablePanelStyles, euiResizablePanelContentStyles } from './resizable_panel.styles';
24
+ import { euiResizablePanelStyles as styles, euiResizablePanelContentStyles } from './resizable_panel.styles';
25
25
  import { jsx as ___EmotionJSX } from "@emotion/react";
26
26
  var defaultToggleOptions = {
27
27
  className: null,
@@ -133,15 +133,13 @@ export var EuiResizablePanel = function EuiResizablePanel(_ref) {
133
133
  return direction;
134
134
  }, [isCollapsed, isCollapsible, position, panels, panelId]);
135
135
  var axis = isHorizontal ? 'horizontal' : 'vertical';
136
- var euiTheme = useEuiTheme();
137
- var styles = euiResizablePanelStyles(euiTheme);
138
- var cssStyles = [styles.euiResizablePanel, isCollapsed && styles.collapsed, styles.paddingSizes[wrapperPadding], wrapperProps === null || wrapperProps === void 0 ? void 0 : wrapperProps.css];
139
- var contentStyles = euiResizablePanelContentStyles(euiTheme);
136
+ var cssStyles = [styles.euiResizablePanel, isCollapsed && styles.collapsed, useEuiPaddingCSS()[wrapperPadding], wrapperProps === null || wrapperProps === void 0 ? void 0 : wrapperProps.css];
137
+ var contentStyles = useEuiMemoizedStyles(euiResizablePanelContentStyles);
140
138
  var contentCssStyles = [contentStyles.euiResizablePanel__content, scrollable && contentStyles.scrollable, isCollapsed && contentStyles.collapsedChildren, isCollapsed && !isCollapsible && contentStyles[axis].collapsed, isCollapsible && contentStyles[axis].hasCollapsibleButton];
141
139
  var classes = classNames('euiResizablePanel', wrapperProps === null || wrapperProps === void 0 ? void 0 : wrapperProps.className);
142
140
  var panelClasses = classNames('euiResizablePanel__content', className);
143
141
  var inlineStyles = _objectSpread(_objectSpread({}, wrapperProps === null || wrapperProps === void 0 ? void 0 : wrapperProps.style), isHorizontal ? logicalSizeStyle("".concat(size || innerSize, "%"), 'auto') : logicalSizeStyle('100%', "".concat(size || innerSize, "%")));
144
- var padding = euiPaddingSize(euiTheme, paddingSize) || '0px';
142
+ var padding = useEuiPaddingSize(paddingSize) || '0px';
145
143
  useEffect(function () {
146
144
  if (!registration) return;
147
145
  var initSize = size !== null && size !== void 0 ? size : initialSize || 0;
@@ -1,6 +1,3 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- 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; }
3
- 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) { _defineProperty(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; }
4
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)."; }
5
2
  /*
6
3
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
@@ -11,29 +8,24 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
11
8
  */
12
9
 
13
10
  import { css } from '@emotion/react';
14
- import { logicalCSS, logicalCSSWithFallback, euiScrollBarStyles, euiPaddingSizeCSS } from '../../global_styling';
15
- var _ref2 = process.env.NODE_ENV === "production" ? {
16
- name: "11qmbh3-collapsed",
17
- styles: "overflow:hidden;label:collapsed;"
18
- } : {
19
- name: "11qmbh3-collapsed",
20
- styles: "overflow:hidden;label:collapsed;",
21
- toString: _EMOTION_STRINGIFIED_CSS_ERROR__
22
- };
23
- var _ref3 = process.env.NODE_ENV === "production" ? {
24
- name: "15ifdgc-euiResizablePanel",
25
- styles: "position:relative;label:euiResizablePanel;"
26
- } : {
27
- name: "15ifdgc-euiResizablePanel",
28
- styles: "position:relative;label:euiResizablePanel;",
29
- toString: _EMOTION_STRINGIFIED_CSS_ERROR__
30
- };
31
- export var euiResizablePanelStyles = function euiResizablePanelStyles(euiThemeContext) {
32
- return {
33
- euiResizablePanel: _ref3,
34
- collapsed: _ref2,
35
- paddingSizes: _objectSpread({}, euiPaddingSizeCSS(euiThemeContext))
36
- };
11
+ import { logicalCSS, logicalCSSWithFallback, euiScrollBarStyles } from '../../global_styling';
12
+ export var euiResizablePanelStyles = {
13
+ euiResizablePanel: process.env.NODE_ENV === "production" ? {
14
+ name: "15ifdgc-euiResizablePanel",
15
+ styles: "position:relative;label:euiResizablePanel;"
16
+ } : {
17
+ name: "15ifdgc-euiResizablePanel",
18
+ styles: "position:relative;label:euiResizablePanel;",
19
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
20
+ },
21
+ collapsed: process.env.NODE_ENV === "production" ? {
22
+ name: "11qmbh3-collapsed",
23
+ styles: "overflow:hidden;label:collapsed;"
24
+ } : {
25
+ name: "11qmbh3-collapsed",
26
+ styles: "overflow:hidden;label:collapsed;",
27
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
28
+ }
37
29
  };
38
30
  var _ref = process.env.NODE_ENV === "production" ? {
39
31
  name: "597kt8-collapsedChildren",
@@ -415,14 +415,33 @@ export var EuiSelectableList = /*#__PURE__*/function (_Component) {
415
415
  key: "componentDidUpdate",
416
416
  value: function componentDidUpdate(prevProps) {
417
417
  var _this$props9 = this.props,
418
+ isVirtualized = _this$props9.isVirtualized,
418
419
  activeOptionIndex = _this$props9.activeOptionIndex,
419
420
  visibleOptions = _this$props9.visibleOptions,
420
421
  options = _this$props9.options;
421
- if (this.listBoxRef && this.props.searchable !== true) {
422
- this.listBoxRef.setAttribute('aria-activedescendant', "".concat(this.props.makeOptionId(activeOptionIndex)));
423
- }
424
- if (this.listRef && typeof activeOptionIndex !== 'undefined') {
425
- this.listRef.scrollToItem(activeOptionIndex, 'auto');
422
+ if (prevProps.activeOptionIndex !== activeOptionIndex) {
423
+ var makeOptionId = this.props.makeOptionId;
424
+ if (this.listBoxRef && this.props.searchable !== true) {
425
+ this.listBoxRef.setAttribute('aria-activedescendant', makeOptionId(activeOptionIndex));
426
+ }
427
+ if (typeof activeOptionIndex !== 'undefined') {
428
+ if (isVirtualized) {
429
+ var _this$listRef;
430
+ (_this$listRef = this.listRef) === null || _this$listRef === void 0 ? void 0 : _this$listRef.scrollToItem(activeOptionIndex, 'auto');
431
+ } else {
432
+ var _this$listBoxRef;
433
+ var activeOptionId = "#".concat(makeOptionId(activeOptionIndex));
434
+ var activeOptionEl = (_this$listBoxRef = this.listBoxRef) === null || _this$listBoxRef === void 0 ? void 0 : _this$listBoxRef.querySelector(activeOptionId);
435
+ if (activeOptionEl) {
436
+ var _activeOptionEl$scrol;
437
+ // TODO: we can remove scrollIntoView's conditional chaining once jsdom stubs it
438
+ // @see https://github.com/jsdom/jsdom/issues/1695
439
+ (_activeOptionEl$scrol = activeOptionEl.scrollIntoView) === null || _activeOptionEl$scrol === void 0 ? void 0 : _activeOptionEl$scrol.call(activeOptionEl, {
440
+ block: 'nearest'
441
+ });
442
+ }
443
+ }
444
+ }
426
445
  }
427
446
  if (prevProps.visibleOptions !== visibleOptions || prevProps.options !== options) {
428
447
  var optionArray = visibleOptions || options;
@@ -465,14 +484,18 @@ export var EuiSelectableList = /*#__PURE__*/function (_Component) {
465
484
  textWrap = _this$props10.textWrap,
466
485
  truncationProps = _this$props10.truncationProps,
467
486
  rest = _objectWithoutProperties(_this$props10, _excluded3);
487
+ var heightIsFull = forcedHeight === 'full';
468
488
  var classes = classNames('euiSelectableList', {
469
- 'euiSelectableList-fullHeight': forcedHeight === 'full',
489
+ 'euiSelectableList-fullHeight': heightIsFull,
470
490
  'euiSelectableList-bordered': bordered
471
491
  }, className);
472
492
  return ___EmotionJSX("div", _extends({
473
493
  className: classes
474
494
  }, rest), isVirtualized ? this.renderVirtualizedList() : ___EmotionJSX("div", {
475
495
  className: "euiSelectableList__list",
496
+ style: !heightIsFull ? {
497
+ blockSize: forcedHeight
498
+ } : undefined,
476
499
  ref: this.removeScrollableTabStop
477
500
  }, ___EmotionJSX("ul", {
478
501
  ref: this.setListBoxRef