@elastic/eui 88.0.0 → 88.2.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 (148) hide show
  1. package/dist/eui_charts_theme.js +9 -8
  2. package/dist/eui_charts_theme.js.map +1 -1
  3. package/dist/eui_theme_dark.css +11 -41
  4. package/dist/eui_theme_dark.min.css +1 -1
  5. package/dist/eui_theme_light.css +11 -41
  6. package/dist/eui_theme_light.min.css +1 -1
  7. package/es/components/accordion/accordion.js +34 -9
  8. package/es/components/accordion/accordion.styles.js +29 -9
  9. package/es/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +10 -2
  10. package/es/components/collapsible_nav_beta/collapsible_nav_beta.js +10 -26
  11. package/es/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
  12. package/es/components/datagrid/controls/keyboard_shortcuts.js +1 -0
  13. package/es/components/description_list/description_list.js +40 -3
  14. package/es/components/flyout/flyout.styles.js +1 -1
  15. package/es/components/header/header.js +120 -25
  16. package/es/components/header/header.styles.js +1 -1
  17. package/es/components/index.js +1 -0
  18. package/es/components/markdown_editor/markdown_format.styles.js +3 -6
  19. package/es/components/overlay_mask/overlay_mask.styles.js +1 -1
  20. package/es/components/page/page_sidebar/page_sidebar.js +2 -4
  21. package/es/components/page_template/page_template.js +4 -31
  22. package/es/components/text/text.styles.js +3 -6
  23. package/es/components/text_truncate/index.js +10 -0
  24. package/es/components/text_truncate/text_truncate.js +232 -0
  25. package/es/components/text_truncate/text_truncate.styles.js +49 -0
  26. package/es/components/text_truncate/utils.js +348 -0
  27. package/es/global_styling/functions/typography.js +8 -8
  28. package/es/global_styling/variables/typography.js +1 -1
  29. package/es/services/theme/context.js +3 -1
  30. package/es/services/theme/hooks.js +19 -1
  31. package/es/services/theme/index.js +1 -1
  32. package/es/services/theme/provider.js +37 -8
  33. package/es/themes/amsterdam/global_styling/variables/_typography.js +1 -0
  34. package/eui.d.ts +282 -24
  35. package/i18ntokens.json +112 -112
  36. package/lib/components/accordion/accordion.js +33 -8
  37. package/lib/components/accordion/accordion.styles.js +31 -10
  38. package/lib/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +10 -2
  39. package/lib/components/collapsible_nav_beta/collapsible_nav_beta.js +10 -26
  40. package/lib/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
  41. package/lib/components/datagrid/controls/keyboard_shortcuts.js +1 -0
  42. package/lib/components/description_list/description_list.js +39 -3
  43. package/lib/components/flyout/flyout.styles.js +1 -1
  44. package/lib/components/header/header.js +120 -23
  45. package/lib/components/header/header.styles.js +1 -1
  46. package/lib/components/index.js +11 -0
  47. package/lib/components/markdown_editor/markdown_format.styles.js +3 -6
  48. package/lib/components/overlay_mask/overlay_mask.styles.js +1 -1
  49. package/lib/components/page/page_sidebar/page_sidebar.js +2 -4
  50. package/lib/components/page_template/page_template.js +2 -29
  51. package/lib/components/text/text.styles.js +3 -6
  52. package/lib/components/text_truncate/index.js +25 -0
  53. package/lib/components/text_truncate/text_truncate.js +242 -0
  54. package/lib/components/text_truncate/text_truncate.styles.js +54 -0
  55. package/lib/components/text_truncate/utils.js +352 -0
  56. package/lib/global_styling/functions/typography.js +8 -8
  57. package/lib/global_styling/variables/typography.js +3 -3
  58. package/lib/services/theme/context.js +3 -1
  59. package/lib/services/theme/hooks.js +21 -2
  60. package/lib/services/theme/index.js +6 -0
  61. package/lib/services/theme/provider.js +62 -35
  62. package/lib/themes/amsterdam/global_styling/variables/_typography.js +1 -0
  63. package/optimize/es/components/accordion/accordion.js +19 -7
  64. package/optimize/es/components/accordion/accordion.styles.js +29 -9
  65. package/optimize/es/components/collapsible_nav_beta/collapsible_nav_beta.js +5 -26
  66. package/optimize/es/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
  67. package/optimize/es/components/datagrid/controls/keyboard_shortcuts.js +1 -0
  68. package/optimize/es/components/description_list/description_list.js +22 -2
  69. package/optimize/es/components/flyout/flyout.styles.js +1 -1
  70. package/optimize/es/components/header/header.js +75 -25
  71. package/optimize/es/components/header/header.styles.js +1 -1
  72. package/optimize/es/components/index.js +1 -0
  73. package/optimize/es/components/markdown_editor/markdown_format.styles.js +3 -6
  74. package/optimize/es/components/overlay_mask/overlay_mask.styles.js +1 -1
  75. package/optimize/es/components/page/page_sidebar/page_sidebar.js +2 -4
  76. package/optimize/es/components/page_template/page_template.js +4 -26
  77. package/optimize/es/components/text/text.styles.js +3 -6
  78. package/optimize/es/components/text_truncate/index.js +10 -0
  79. package/optimize/es/components/text_truncate/text_truncate.js +148 -0
  80. package/optimize/es/components/text_truncate/text_truncate.styles.js +49 -0
  81. package/optimize/es/components/text_truncate/utils.js +337 -0
  82. package/optimize/es/global_styling/functions/typography.js +8 -8
  83. package/optimize/es/global_styling/variables/typography.js +1 -1
  84. package/optimize/es/services/theme/context.js +3 -1
  85. package/optimize/es/services/theme/hooks.js +19 -1
  86. package/optimize/es/services/theme/index.js +1 -1
  87. package/optimize/es/services/theme/provider.js +37 -8
  88. package/optimize/es/themes/amsterdam/global_styling/variables/_typography.js +1 -0
  89. package/optimize/lib/components/accordion/accordion.js +18 -6
  90. package/optimize/lib/components/accordion/accordion.styles.js +31 -10
  91. package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_beta.js +5 -26
  92. package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
  93. package/optimize/lib/components/datagrid/controls/keyboard_shortcuts.js +1 -0
  94. package/optimize/lib/components/description_list/description_list.js +22 -2
  95. package/optimize/lib/components/flyout/flyout.styles.js +1 -1
  96. package/optimize/lib/components/header/header.js +77 -24
  97. package/optimize/lib/components/header/header.styles.js +1 -1
  98. package/optimize/lib/components/index.js +11 -0
  99. package/optimize/lib/components/markdown_editor/markdown_format.styles.js +3 -6
  100. package/optimize/lib/components/overlay_mask/overlay_mask.styles.js +1 -1
  101. package/optimize/lib/components/page/page_sidebar/page_sidebar.js +2 -4
  102. package/optimize/lib/components/page_template/page_template.js +2 -24
  103. package/optimize/lib/components/text/text.styles.js +3 -6
  104. package/optimize/lib/components/text_truncate/index.js +25 -0
  105. package/optimize/lib/components/text_truncate/text_truncate.js +158 -0
  106. package/optimize/lib/components/text_truncate/text_truncate.styles.js +54 -0
  107. package/optimize/lib/components/text_truncate/utils.js +342 -0
  108. package/optimize/lib/global_styling/functions/typography.js +8 -8
  109. package/optimize/lib/global_styling/variables/typography.js +3 -3
  110. package/optimize/lib/services/theme/context.js +3 -1
  111. package/optimize/lib/services/theme/hooks.js +21 -2
  112. package/optimize/lib/services/theme/index.js +6 -0
  113. package/optimize/lib/services/theme/provider.js +62 -35
  114. package/optimize/lib/themes/amsterdam/global_styling/variables/_typography.js +1 -0
  115. package/package.json +1 -1
  116. package/src/components/datagrid/_data_grid.scss +13 -2
  117. package/src/components/datagrid/controls/_data_grid_keyboard_shortcuts.scss +1 -7
  118. package/src/components/index.scss +0 -1
  119. package/src/global_styling/mixins/_header.scss +2 -0
  120. package/test-env/components/accordion/accordion.js +28 -8
  121. package/test-env/components/accordion/accordion.styles.js +31 -10
  122. package/test-env/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +10 -2
  123. package/test-env/components/collapsible_nav_beta/collapsible_nav_beta.js +10 -26
  124. package/test-env/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
  125. package/test-env/components/datagrid/controls/keyboard_shortcuts.js +1 -0
  126. package/test-env/components/description_list/description_list.js +37 -3
  127. package/test-env/components/flyout/flyout.styles.js +1 -1
  128. package/test-env/components/header/header.js +113 -23
  129. package/test-env/components/header/header.styles.js +1 -1
  130. package/test-env/components/index.js +11 -0
  131. package/test-env/components/markdown_editor/markdown_format.styles.js +3 -6
  132. package/test-env/components/overlay_mask/overlay_mask.styles.js +1 -1
  133. package/test-env/components/page/page_sidebar/page_sidebar.js +2 -4
  134. package/test-env/components/page_template/page_template.js +2 -24
  135. package/test-env/components/text/text.styles.js +3 -6
  136. package/test-env/components/text_truncate/index.js +25 -0
  137. package/test-env/components/text_truncate/text_truncate.js +236 -0
  138. package/test-env/components/text_truncate/text_truncate.styles.js +54 -0
  139. package/test-env/components/text_truncate/utils.js +342 -0
  140. package/test-env/global_styling/functions/typography.js +8 -8
  141. package/test-env/global_styling/variables/typography.js +3 -3
  142. package/test-env/services/theme/context.js +3 -1
  143. package/test-env/services/theme/hooks.js +21 -2
  144. package/test-env/services/theme/index.js +6 -0
  145. package/test-env/services/theme/provider.js +62 -35
  146. package/test-env/themes/amsterdam/global_styling/variables/_typography.js +1 -0
  147. package/src/components/accordion/_accordion_form.scss +0 -40
  148. package/src/components/accordion/_index.scss +0 -1
@@ -1,6 +1,13 @@
1
- var _excluded = ["children", "buttonContent", "className", "id", "element", "buttonClassName", "buttonContentClassName", "extraAction", "paddingSize", "initialIsOpen", "arrowDisplay", "forceState", "isLoading", "isLoadingMessage", "isDisabled", "buttonProps", "buttonElement", "arrowProps", "theme"];
1
+ var _excluded = ["children", "buttonContent", "className", "id", "element", "buttonClassName", "buttonContentClassName", "extraAction", "paddingSize", "borders", "initialIsOpen", "arrowDisplay", "forceState", "isLoading", "isLoadingMessage", "isDisabled", "buttonProps", "buttonElement", "arrowProps", "theme"],
2
+ _excluded2 = ["paddingSize", "className", "css"];
2
3
  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); }
3
4
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
5
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
6
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
+ 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); }
8
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
9
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
10
+ 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; }
4
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; }
5
12
  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; }
6
13
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -34,7 +41,7 @@ import { EuiText } from '../text';
34
41
  import { EuiI18n } from '../i18n';
35
42
  import { htmlIdGenerator, withEuiTheme } from '../../services';
36
43
  import { EuiButtonIcon } from '../button';
37
- import { euiAccordionButtonStyles, euiAccordionChildrenStyles, euiAccordionChildWrapperStyles, euiAccordionIconButtonStyles, euiAccordionOptionalActionStyles, euiAccordionSpinnerStyles, euiAccordionTriggerWrapperStyles } from './accordion.styles';
44
+ import { euiAccordionStyles, euiAccordionButtonStyles, euiAccordionChildrenStyles, euiAccordionChildWrapperStyles, euiAccordionIconButtonStyles, euiAccordionOptionalActionStyles, euiAccordionSpinnerStyles, euiAccordionTriggerWrapperStyles } from './accordion.styles';
38
45
  import { logicalCSS } from '../../global_styling';
39
46
  import { jsx as ___EmotionJSX } from "@emotion/react";
40
47
  export var PADDING_SIZES = ['none', 'xs', 's', 'm', 'l', 'xl'];
@@ -163,18 +170,24 @@ export var EuiAccordionClass = /*#__PURE__*/function (_Component) {
163
170
  buttonContentClassName = _this$props3.buttonContentClassName,
164
171
  extraAction = _this$props3.extraAction,
165
172
  paddingSize = _this$props3.paddingSize,
173
+ borders = _this$props3.borders,
166
174
  initialIsOpen = _this$props3.initialIsOpen,
167
175
  arrowDisplay = _this$props3.arrowDisplay,
168
176
  forceState = _this$props3.forceState,
169
177
  isLoading = _this$props3.isLoading,
170
178
  isLoadingMessage = _this$props3.isLoadingMessage,
171
179
  isDisabled = _this$props3.isDisabled,
172
- buttonProps = _this$props3.buttonProps,
180
+ _buttonProps = _this$props3.buttonProps,
173
181
  _this$props3$buttonEl = _this$props3.buttonElement,
174
182
  _ButtonElement = _this$props3$buttonEl === void 0 ? 'button' : _this$props3$buttonEl,
175
183
  arrowProps = _this$props3.arrowProps,
176
184
  theme = _this$props3.theme,
177
185
  rest = _objectWithoutProperties(_this$props3, _excluded);
186
+ var _ref = _buttonProps || {},
187
+ buttonPaddingSize = _ref.paddingSize,
188
+ buttonPropsClassName = _ref.className,
189
+ buttonPropsCss = _ref.css,
190
+ buttonProps = _objectWithoutProperties(_ref, _excluded2);
178
191
 
179
192
  // Force button element to be a legend if the element is a fieldset
180
193
  var ButtonElement = Element === 'fieldset' ? 'legend' : _ButtonElement;
@@ -185,10 +198,12 @@ export var EuiAccordionClass = /*#__PURE__*/function (_Component) {
185
198
  var classes = classNames('euiAccordion', {
186
199
  'euiAccordion-isOpen': this.isOpen
187
200
  }, className);
201
+ var styles = euiAccordionStyles(theme);
202
+ var cssStyles = [styles.euiAccordion, borders !== 'none' && styles.borders.borders, borders !== 'none' && styles.borders[borders]];
188
203
  var childrenClasses = classNames('euiAccordion__children', {
189
204
  'euiAccordion__children-isLoading': isLoading
190
205
  });
191
- var buttonClasses = classNames('euiAccordion__button', buttonClassName, buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.className);
206
+ var buttonClasses = classNames('euiAccordion__button', buttonClassName, buttonPropsClassName);
192
207
  var buttonContentClasses = classNames('euiAccordion__buttonContent', buttonContentClassName);
193
208
  var iconButtonClasses = classNames('euiAccordion__iconButton', {
194
209
  'euiAccordion__iconButton-isOpen': this.isOpen,
@@ -197,7 +212,7 @@ export var EuiAccordionClass = /*#__PURE__*/function (_Component) {
197
212
 
198
213
  // Emotion styles
199
214
  var buttonStyles = euiAccordionButtonStyles(theme);
200
- var cssButtonStyles = [buttonStyles.euiAccordion__button, isDisabled && buttonStyles.disabled, buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.css];
215
+ var cssButtonStyles = [buttonStyles.euiAccordion__button, isDisabled && buttonStyles.disabled].concat(_toConsumableArray(buttonPaddingSize ? [buttonStyles[buttonPaddingSize], arrowDisplay === 'left' && buttonStyles.arrowLeft, arrowDisplay === 'right' && buttonStyles.arrowRight] : []), [buttonPropsCss]);
201
216
  var childrenStyles = euiAccordionChildrenStyles(theme);
202
217
  var cssChildrenStyles = [childrenStyles.euiAccordion__children, isLoading && childrenStyles.isLoading, paddingSize && paddingSize !== 'none' && childrenStyles[paddingSize]];
203
218
  var childWrapperStyles = euiAccordionChildWrapperStyles(theme);
@@ -211,7 +226,7 @@ export var EuiAccordionClass = /*#__PURE__*/function (_Component) {
211
226
  var triggerWrapperStyles = euiAccordionTriggerWrapperStyles();
212
227
  var cssTriggerWrapperStyles = [triggerWrapperStyles.euiAccordion__triggerWrapper];
213
228
  var iconButton;
214
- var buttonId = (_buttonProps$id = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.id) !== null && _buttonProps$id !== void 0 ? _buttonProps$id : this.generatedId;
229
+ var buttonId = (_buttonProps$id = buttonProps.id) !== null && _buttonProps$id !== void 0 ? _buttonProps$id : this.generatedId;
215
230
  if (_arrowDisplay !== 'none') {
216
231
  iconButton = ___EmotionJSX(EuiButtonIcon, _extends({
217
232
  color: "text"
@@ -263,7 +278,8 @@ export var EuiAccordionClass = /*#__PURE__*/function (_Component) {
263
278
  className: buttonContentClasses
264
279
  }, buttonContent));
265
280
  return ___EmotionJSX(Element, _extends({
266
- className: classes
281
+ className: classes,
282
+ css: cssStyles
267
283
  }, rest), ___EmotionJSX("div", {
268
284
  className: "euiAccordion__triggerWrapper",
269
285
  css: cssTriggerWrapperStyles
@@ -294,6 +310,7 @@ export var EuiAccordionClass = /*#__PURE__*/function (_Component) {
294
310
  }(Component);
295
311
  _defineProperty(EuiAccordionClass, "defaultProps", {
296
312
  initialIsOpen: false,
313
+ borders: 'none',
297
314
  paddingSize: 'none',
298
315
  arrowDisplay: 'left',
299
316
  isLoading: false,
@@ -318,13 +335,17 @@ EuiAccordionClass.propTypes = {
318
335
  */
319
336
  buttonClassName: PropTypes.string,
320
337
  /**
321
- * Apply more props to the triggering button
338
+ * Apply more props to the triggering button.
339
+ *
340
+ * Includes optional `paddingSize` prop which allows sizes of `s`, `m`, or `l`.
341
+ * Note: Padding will not be present on the side closest to the accordion arrow.
322
342
  */
323
343
  buttonProps: PropTypes.shape({
324
344
  className: PropTypes.string,
325
345
  "aria-label": PropTypes.string,
326
346
  "data-test-subj": PropTypes.string,
327
- css: PropTypes.any
347
+ css: PropTypes.any,
348
+ paddingSize: PropTypes.oneOf(["s", "m", "l"])
328
349
  }),
329
350
  /**
330
351
  * Class that will apply to the trigger content for the accordion.
@@ -363,6 +384,10 @@ EuiAccordionClass.propTypes = {
363
384
  * Placement of the arrow indicator, or 'none' to hide it.
364
385
  */
365
386
  arrowDisplay: PropTypes.oneOf(["left", "right", "none"]),
387
+ /**
388
+ * Optional border styling. Defaults to 'none'.
389
+ */
390
+ borders: PropTypes.oneOf(["horizontal", "all", "none"]),
366
391
  /**
367
392
  * Control the opening of accordion via prop
368
393
  */
@@ -9,13 +9,33 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
9
9
 
10
10
  import { css } from '@emotion/react';
11
11
  import { euiFontSize, logicals, logicalCSS, logicalTextAlignCSS } from '../../global_styling';
12
+ export var euiAccordionStyles = function euiAccordionStyles(_ref5) {
13
+ var euiTheme = _ref5.euiTheme;
14
+ return {
15
+ euiAccordion: /*#__PURE__*/css(";label:euiAccordion;"),
16
+ // Borders
17
+ borders: {
18
+ // Prevent border repeats
19
+ borders: /*#__PURE__*/css("&+[class*='euiAccordion-borders']{", logicalCSS('border-top', 'none'), ";};label:borders;"),
20
+ horizontal: /*#__PURE__*/css("border-block:", euiTheme.border.thin, ";;label:horizontal;"),
21
+ all: /*#__PURE__*/css("border:", euiTheme.border.thin, ";;label:all;")
22
+ }
23
+ };
24
+ };
12
25
  export var euiAccordionButtonStyles = function euiAccordionButtonStyles(euiThemeContext) {
13
26
  var euiTheme = euiThemeContext.euiTheme;
14
27
  return {
15
28
  euiAccordion__button: /*#__PURE__*/css(euiFontSize(euiThemeContext, 's'), " align-items:center;display:flex;flex-grow:1;line-height:", euiTheme.size.l, ";", logicalTextAlignCSS('left'), " ", logicalCSS('width', '100%'), " &:hover,&:focus{cursor:pointer;text-decoration:underline;};label:euiAccordion__button;"),
16
29
  // Triggering button needs separate `disabled` key because the element that renders may not support `:disabled`;
17
30
  // Hover pseudo selector for specificity
18
- disabled: /*#__PURE__*/css("&,&:hover{cursor:not-allowed;color:", euiTheme.colors.disabledText, ";text-decoration:none;};label:disabled;")
31
+ disabled: /*#__PURE__*/css("&,&:hover{cursor:not-allowed;color:", euiTheme.colors.disabledText, ";text-decoration:none;};label:disabled;"),
32
+ // Optional padding sizes
33
+ s: /*#__PURE__*/css("padding:", euiTheme.size.s, ";;label:s;"),
34
+ m: /*#__PURE__*/css("padding:", euiTheme.size.base, ";;label:m;"),
35
+ l: /*#__PURE__*/css("padding:", euiTheme.size.l, ";;label:l;"),
36
+ // Remove padding from the accordion button on the side that the arrow is on
37
+ arrowLeft: /*#__PURE__*/css(logicalCSS('padding-left', 0), ";;label:arrowLeft;"),
38
+ arrowRight: /*#__PURE__*/css(logicalCSS('padding-left', 0), ";;label:arrowRight;")
19
39
  };
20
40
  };
21
41
  var _ref4 = process.env.NODE_ENV === "production" ? {
@@ -26,8 +46,8 @@ var _ref4 = process.env.NODE_ENV === "production" ? {
26
46
  styles: "align-items:center;display:flex;label:isLoading;",
27
47
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
28
48
  };
29
- export var euiAccordionChildrenStyles = function euiAccordionChildrenStyles(_ref5) {
30
- var euiTheme = _ref5.euiTheme;
49
+ export var euiAccordionChildrenStyles = function euiAccordionChildrenStyles(_ref6) {
50
+ var euiTheme = _ref6.euiTheme;
31
51
  return {
32
52
  euiAccordion__children: /*#__PURE__*/css(";label:euiAccordion__children;"),
33
53
  isLoading: _ref4,
@@ -38,8 +58,8 @@ export var euiAccordionChildrenStyles = function euiAccordionChildrenStyles(_ref
38
58
  xl: /*#__PURE__*/css("padding:", euiTheme.size.xl, ";;label:xl;")
39
59
  };
40
60
  };
41
- export var euiAccordionChildWrapperStyles = function euiAccordionChildWrapperStyles(_ref6) {
42
- var euiTheme = _ref6.euiTheme;
61
+ export var euiAccordionChildWrapperStyles = function euiAccordionChildWrapperStyles(_ref7) {
62
+ var euiTheme = _ref7.euiTheme;
43
63
  return {
44
64
  euiAccordion__childWrapper: /*#__PURE__*/css(logicalCSS('height', 0), " opacity:0;overflow:hidden;transition:", logicals.height, " ", euiTheme.animation.normal, " ", euiTheme.animation.resistance, ",opacity ", euiTheme.animation.normal, " ", euiTheme.animation.resistance, ";visibility:hidden;&:focus{outline:none;};label:euiAccordion__childWrapper;"),
45
65
  isOpen: /*#__PURE__*/css(logicalCSS('height', 'auto'), " opacity:1;visibility:visible;;label:isOpen;")
@@ -53,8 +73,8 @@ var _ref3 = process.env.NODE_ENV === "production" ? {
53
73
  styles: "transform:rotate(\n 90deg\n )!important;label:isOpen;",
54
74
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
55
75
  };
56
- export var euiAccordionIconButtonStyles = function euiAccordionIconButtonStyles(_ref7) {
57
- var euiTheme = _ref7.euiTheme;
76
+ export var euiAccordionIconButtonStyles = function euiAccordionIconButtonStyles(_ref8) {
77
+ var euiTheme = _ref8.euiTheme;
58
78
  return {
59
79
  euiAccordion__iconButton: /*#__PURE__*/css("flex-shrink:0;", logicalCSS('margin-right', euiTheme.size.xs), " transform:rotate(\n 0deg\n )!important;;label:euiAccordion__iconButton;"),
60
80
  isOpen: _ref3,
@@ -74,8 +94,8 @@ export var euiAccordionOptionalActionStyles = function euiAccordionOptionalActio
74
94
  euiAccordion__optionalAction: _ref2
75
95
  };
76
96
  };
77
- export var euiAccordionSpinnerStyles = function euiAccordionSpinnerStyles(_ref8) {
78
- var euiTheme = _ref8.euiTheme;
97
+ export var euiAccordionSpinnerStyles = function euiAccordionSpinnerStyles(_ref9) {
98
+ var euiTheme = _ref9.euiTheme;
79
99
  return {
80
100
  euiAccordion__spinner: /*#__PURE__*/css(logicalCSS('margin-right', euiTheme.size.xs), ";;label:euiAccordion__spinner;")
81
101
  };
@@ -191,13 +191,17 @@ EuiCollapsibleNavGroup.propTypes = {
191
191
  */
192
192
  buttonClassName: PropTypes.string,
193
193
  /**
194
- * Apply more props to the triggering button
194
+ * Apply more props to the triggering button.
195
+ *
196
+ * Includes optional `paddingSize` prop which allows sizes of `s`, `m`, or `l`.
197
+ * Note: Padding will not be present on the side closest to the accordion arrow.
195
198
  */
196
199
  buttonProps: PropTypes.shape({
197
200
  className: PropTypes.string,
198
201
  "aria-label": PropTypes.string,
199
202
  "data-test-subj": PropTypes.string,
200
- css: PropTypes.any
203
+ css: PropTypes.any,
204
+ paddingSize: PropTypes.oneOf(["s", "m", "l"])
201
205
  }),
202
206
  /**
203
207
  * Class that will apply to the trigger content for the accordion.
@@ -236,6 +240,10 @@ EuiCollapsibleNavGroup.propTypes = {
236
240
  * Placement of the arrow indicator, or 'none' to hide it.
237
241
  */
238
242
  arrowDisplay: PropTypes.oneOf(["left", "right", "none"]),
243
+ /**
244
+ * Optional border styling. Defaults to 'none'.
245
+ */
246
+ borders: PropTypes.oneOf(["horizontal", "all", "none"]),
239
247
  /**
240
248
  * Control the opening of accordion via prop
241
249
  */
@@ -1,5 +1,5 @@
1
1
  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); }
2
- var _excluded = ["id", "children", "className", "style", "initialIsCollapsed", "width", "side", "focusTrapProps"];
2
+ var _excluded = ["id", "children", "className", "initialIsCollapsed", "onCollapseToggle", "width", "side", "focusTrapProps"];
3
3
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
5
5
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -30,7 +30,6 @@ import React, { useRef, useMemo, useState, useEffect, useCallback } from 'react'
30
30
  import PropTypes from "prop-types";
31
31
  import classNames from 'classnames';
32
32
  import { useEuiTheme, useGeneratedHtmlId, throttle } from '../../services';
33
- import { mathWithUnits, logicalStyle } from '../../global_styling';
34
33
  import { EuiFlyout } from '../flyout';
35
34
  import { useEuiI18n } from '../i18n';
36
35
  import { euiHeaderVariables } from '../header/header.styles';
@@ -42,9 +41,9 @@ export var EuiCollapsibleNavBeta = function EuiCollapsibleNavBeta(_ref) {
42
41
  var id = _ref.id,
43
42
  children = _ref.children,
44
43
  className = _ref.className,
45
- style = _ref.style,
46
44
  _ref$initialIsCollaps = _ref.initialIsCollapsed,
47
45
  initialIsCollapsed = _ref$initialIsCollaps === void 0 ? false : _ref$initialIsCollaps,
46
+ onCollapseToggle = _ref.onCollapseToggle,
48
47
  _ref$width = _ref.width,
49
48
  _width = _ref$width === void 0 ? 248 : _ref$width,
50
49
  _ref$side = _ref.side,
@@ -63,9 +62,10 @@ export var EuiCollapsibleNavBeta = function EuiCollapsibleNavBeta(_ref) {
63
62
  setIsCollapsed = _useState2[1];
64
63
  var toggleCollapsed = useCallback(function () {
65
64
  return setIsCollapsed(function (isCollapsed) {
65
+ onCollapseToggle === null || onCollapseToggle === void 0 ? void 0 : onCollapseToggle(!isCollapsed);
66
66
  return !isCollapsed;
67
67
  });
68
- }, []);
68
+ }, [onCollapseToggle]);
69
69
  var onClose = useCallback(function () {
70
70
  return setIsCollapsed(true);
71
71
  }, []);
@@ -111,24 +111,6 @@ export var EuiCollapsibleNavBeta = function EuiCollapsibleNavBeta(_ref) {
111
111
  return _width;
112
112
  }, [_width, isOverlayFullWidth, isPush, isCollapsed, headerHeight]);
113
113
 
114
- /**
115
- * Header affordance
116
- */
117
- var _useState7 = useState(false),
118
- _useState8 = _slicedToArray(_useState7, 2),
119
- fixedHeadersCount = _useState8[0],
120
- setFixedHeadersCount = _useState8[1];
121
- useEffect(function () {
122
- setFixedHeadersCount(document.querySelectorAll('.euiHeader[data-fixed-header]').length);
123
- }, []);
124
- var stylesWithHeaderOffset = useMemo(function () {
125
- if (!fixedHeadersCount) return style;
126
- var headersOffset = mathWithUnits(headerHeight, function (x) {
127
- return x * fixedHeadersCount;
128
- });
129
- return _objectSpread(_objectSpread(_objectSpread({}, style), logicalStyle('top', headersOffset)), logicalStyle('height', "calc(100% - ".concat(headersOffset, ")")));
130
- }, [fixedHeadersCount, style, headerHeight]);
131
-
132
114
  /**
133
115
  * Prop setup
134
116
  */
@@ -146,16 +128,13 @@ export var EuiCollapsibleNavBeta = function EuiCollapsibleNavBeta(_ref) {
146
128
  var classes = classNames('euiCollapsibleNav', 'euiCollapsibleNavBeta', className);
147
129
  var styles = euiCollapsibleNavBetaStyles(euiTheme);
148
130
  var cssStyles = [styles.euiCollapsibleNavBeta, styles[side], isPush && styles.isPush, isPush && isCollapsed && styles.isPushCollapsed, isOverlayFullWidth && styles.isOverlayFullWidth];
149
-
150
- // Wait for any fixed headers to be queried before rendering (prevents position jumping)
151
- var flyout = fixedHeadersCount !== false && ___EmotionJSX(EuiFlyout, _extends({
131
+ var flyout = ___EmotionJSX(EuiFlyout, _extends({
152
132
  "aria-label": defaultAriaLabel
153
133
  }, rest, {
154
134
  // EuiCollapsibleNav is significantly less permissive than EuiFlyout
155
135
  id: flyoutID,
156
136
  css: cssStyles,
157
137
  className: classes,
158
- style: stylesWithHeaderOffset,
159
138
  size: width,
160
139
  side: side,
161
140
  focusTrapProps: focusTrapProps,
@@ -202,6 +181,11 @@ EuiCollapsibleNavBeta.propTypes = {
202
181
  * Whether the navigation flyout should default to initially collapsed or expanded
203
182
  */
204
183
  initialIsCollapsed: PropTypes.bool,
184
+ /**
185
+ * Optional callback that fires when the user toggles the nav between
186
+ * collapsed and uncollapsed states
187
+ */
188
+ onCollapseToggle: PropTypes.func,
205
189
  /**
206
190
  * Defaults to 248px wide. The navigation width determines behavior at
207
191
  * various responsive breakpoints.
@@ -10,6 +10,7 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
10
10
  import { css } from '@emotion/react';
11
11
  import { logicalCSS, euiYScroll } from '../../global_styling';
12
12
  import { euiShadowFlat } from '../../themes';
13
+ import { euiHeaderVariables } from '../header/header.styles';
13
14
  var _ref = process.env.NODE_ENV === "production" ? {
14
15
  name: "1adm1dw-isPushCollapsed",
15
16
  styles: "&,.euiFlyoutBody__overflow{scrollbar-width:none;&::-webkit-scrollbar{display:none;}};label:isPushCollapsed;"
@@ -20,8 +21,16 @@ var _ref = process.env.NODE_ENV === "production" ? {
20
21
  };
21
22
  export var euiCollapsibleNavBetaStyles = function euiCollapsibleNavBetaStyles(euiThemeContext) {
22
23
  var euiTheme = euiThemeContext.euiTheme;
24
+
25
+ // At least for serverless, EuiCollapsibleNav is only going to be used with 1
26
+ // fixed header. For those scenarios, we can prevent a minor layout jump on
27
+ // page load by setting the CSS var fallback to the height of a single header
28
+ var defaultHeaderHeight = euiHeaderVariables(euiThemeContext).height;
29
+ var fixedHeaderOffset = "var(--euiFixedHeadersOffset, ".concat(defaultHeaderHeight, ")");
23
30
  return {
24
- euiCollapsibleNavBeta: /*#__PURE__*/css(logicalCSS('padding-bottom', euiTheme.size.xs), euiYScroll(euiThemeContext), ".euiFlyoutBody{", logicalCSS('min-height', '50%'), ";}.euiFlyoutFooter{background-color:", euiTheme.colors.emptyShade, ";", logicalCSS('border-top', euiTheme.border.thin), ";};label:euiCollapsibleNavBeta;"),
31
+ euiCollapsibleNavBeta: /*#__PURE__*/css(logicalCSS('top', fixedHeaderOffset), euiYScroll(euiThemeContext, {
32
+ height: 'inherit'
33
+ }), logicalCSS('padding-bottom', euiTheme.size.xs), ".euiFlyoutBody{", logicalCSS('min-height', '50%'), ";}.euiFlyoutFooter{background-color:", euiTheme.colors.emptyShade, ";", logicalCSS('border-top', euiTheme.border.thin), ";};label:euiCollapsibleNavBeta;"),
25
34
  left: /*#__PURE__*/css(logicalCSS('border-right', euiTheme.border.thin), ";;label:left;"),
26
35
  right: /*#__PURE__*/css(logicalCSS('border-left', euiTheme.border.thin), ";;label:right;"),
27
36
  isPush: /*#__PURE__*/css(euiShadowFlat(euiThemeContext), ";;label:isPush;"),
@@ -59,6 +59,7 @@ export var useDataGridKeyboardShortcuts = function useDataGridKeyboardShortcuts(
59
59
  }, ___EmotionJSX(EuiDescriptionList, {
60
60
  "aria-labelledby": titleId,
61
61
  type: "column",
62
+ columnWidths: [1, 3],
62
63
  align: "center",
63
64
  compressed: true,
64
65
  listItems: [{
@@ -1,5 +1,11 @@
1
- var _excluded = ["align", "children", "className", "compressed", "descriptionProps", "listItems", "textStyle", "titleProps", "type", "rowGutterSize", "columnGutterSize"];
1
+ 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); }
2
+ var _excluded = ["align", "children", "className", "style", "compressed", "descriptionProps", "listItems", "textStyle", "titleProps", "type", "rowGutterSize", "columnGutterSize", "columnWidths"];
2
3
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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
+ 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; }
5
+ 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; }
6
+ 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; }
7
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
8
+ 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); }
3
9
  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; }
4
10
  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; }
5
11
  /*
@@ -24,6 +30,7 @@ export var EuiDescriptionList = function EuiDescriptionList(_ref) {
24
30
  align = _ref$align === void 0 ? 'left' : _ref$align,
25
31
  children = _ref.children,
26
32
  className = _ref.className,
33
+ style = _ref.style,
27
34
  _ref$compressed = _ref.compressed,
28
35
  compressed = _ref$compressed === void 0 ? false : _ref$compressed,
29
36
  descriptionProps = _ref.descriptionProps,
@@ -37,6 +44,7 @@ export var EuiDescriptionList = function EuiDescriptionList(_ref) {
37
44
  rowGutterSize = _ref$rowGutterSize === void 0 ? 's' : _ref$rowGutterSize,
38
45
  _ref$columnGutterSize = _ref.columnGutterSize,
39
46
  columnGutterSize = _ref$columnGutterSize === void 0 ? 's' : _ref$columnGutterSize,
47
+ columnWidths = _ref.columnWidths,
40
48
  rest = _objectWithoutProperties(_ref, _excluded);
41
49
  var showResponsiveColumns = useIsWithinBreakpoints(['xs', 's']);
42
50
  var type = useMemo(function () {
@@ -49,6 +57,20 @@ export var EuiDescriptionList = function EuiDescriptionList(_ref) {
49
57
  var euiTheme = useEuiTheme();
50
58
  var styles = euiDescriptionListStyles(euiTheme);
51
59
  var cssStyles = [styles.euiDescriptionList, styles[type], styles[align], type === 'column' && styles.rowGap[rowGutterSize], type === 'column' && styles.columnGap[columnGutterSize]];
60
+ var inlineStyles = useMemo(function () {
61
+ if (type === 'column' && columnWidths) {
62
+ // Leave string values as is - e.g. if a consumer passes in a specific '200px' or 'minmax()'
63
+ var convertNumbersToFr = function convertNumbersToFr(value) {
64
+ return typeof value === 'number' ? "".concat(value, "fr") : value;
65
+ };
66
+ var titleWidth = convertNumbersToFr(columnWidths[0]);
67
+ var descriptionWidth = convertNumbersToFr(columnWidths[1]);
68
+ return _objectSpread({
69
+ gridTemplateColumns: "".concat(titleWidth, " ").concat(descriptionWidth)
70
+ }, style);
71
+ }
72
+ return style;
73
+ }, [style, type, columnWidths]);
52
74
  var classes = classNames('euiDescriptionList', className);
53
75
  var childrenOrListItems = null;
54
76
  if (listItems) {
@@ -72,7 +94,8 @@ export var EuiDescriptionList = function EuiDescriptionList(_ref) {
72
94
  }
73
95
  }, ___EmotionJSX("dl", _extends({
74
96
  className: classes,
75
- css: cssStyles
97
+ css: cssStyles,
98
+ style: inlineStyles
76
99
  }, rest, {
77
100
  "data-type": _type
78
101
  }), childrenOrListItems));
@@ -130,5 +153,19 @@ EuiDescriptionList.propTypes = {
130
153
  *
131
154
  * Only applies to `column` and `responsiveColumn` types.
132
155
  */
133
- columnGutterSize: PropTypes.any
156
+ columnGutterSize: PropTypes.any,
157
+ /**
158
+ * Allows customizing specific column widths (e.g. `['100px', '200px']`). The first
159
+ * array value applies to the title column, and the second applies to the description column.
160
+ *
161
+ * Passing numbers instead of CSS width strings will use a ratio of widths.
162
+ * For example, [1, 3] will render a description column 3x the width of the title column.
163
+ * In other words, descriptions will have a width of `75%` and titles will have a width of `25%`.
164
+ *
165
+ * Only applies to `column` and `responsiveColumn` types.
166
+ *
167
+ * _Advanced usage note:_ column width strings also accept [CSS grid special units,
168
+ * sizing, keywords, and sizing functions](https://css-tricks.com/snippets/css/complete-guide-grid/#aa-special-units-functions).
169
+ */
170
+ columnWidths: PropTypes.any
134
171
  };
@@ -32,7 +32,7 @@ export var euiFlyoutCloseButtonStyles = function euiFlyoutCloseButtonStyles(euiT
32
32
  export var euiFlyoutStyles = function euiFlyoutStyles(euiThemeContext) {
33
33
  var euiTheme = euiThemeContext.euiTheme;
34
34
  return {
35
- euiFlyout: /*#__PURE__*/css("position:fixed;", logicalCSS('top', 0), " ", logicalCSS('bottom', 0), " ", logicalCSS('height', '100%'), " z-index:", euiTheme.levels.flyout, ";background:", euiTheme.colors.emptyShade, ";display:flex;flex-direction:column;align-items:stretch;&:focus{outline:none;}", euiMaxBreakpoint(euiThemeContext, 'm'), "{", logicalCSS('max-width', '90vw !important'), ";};label:euiFlyout;"),
35
+ euiFlyout: /*#__PURE__*/css("position:fixed;", logicalCSS('bottom', 0), " ", logicalCSS('top', 'var(--euiFixedHeadersOffset, 0)'), " ", logicalCSS('height', 'inherit'), " z-index:", euiTheme.levels.flyout, ";background:", euiTheme.colors.emptyShade, ";display:flex;flex-direction:column;align-items:stretch;&:focus{outline:none;}", euiMaxBreakpoint(euiThemeContext, 'm'), "{", logicalCSS('max-width', '90vw !important'), ";};label:euiFlyout;"),
36
36
  // Flyout sizes
37
37
  s: /*#__PURE__*/css(composeFlyoutSizing(euiThemeContext, 's'), ";;label:s;"),
38
38
  m: /*#__PURE__*/css(composeFlyoutSizing(euiThemeContext, 'm'), ";;label:m;"),