@elastic/eui 88.5.4 → 89.0.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 (206) hide show
  1. package/dist/eui_theme_dark.css +26 -526
  2. package/dist/eui_theme_dark.min.css +1 -1
  3. package/dist/eui_theme_light.css +26 -526
  4. package/dist/eui_theme_light.min.css +1 -1
  5. package/es/components/basic_table/basic_table.js +7 -2
  6. package/es/components/basic_table/in_memory_table.js +7 -2
  7. package/es/components/collapsible_nav/collapsible_nav.js +5 -0
  8. package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +4 -2
  9. package/es/components/color_picker/index.js +0 -4
  10. package/es/components/combo_box/combo_box.js +142 -304
  11. package/es/components/combo_box/combo_box_input/combo_box_input.js +0 -13
  12. package/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +34 -118
  13. package/es/components/context_menu/context_menu_panel.js +6 -6
  14. package/es/components/flex/flex_grid.styles.js +1 -1
  15. package/es/components/flex/flex_group.styles.js +1 -1
  16. package/es/components/flyout/flyout.js +32 -33
  17. package/es/components/flyout/flyout.styles.js +13 -3
  18. package/es/components/form/range/dual_range.js +4 -0
  19. package/es/components/form/range/range.js +4 -0
  20. package/es/components/index.js +0 -1
  21. package/es/components/popover/input_popover.js +47 -3
  22. package/es/components/popover/popover.js +2 -2
  23. package/es/components/table/table_row_cell.js +27 -9
  24. package/es/components/text_truncate/index.js +1 -0
  25. package/es/components/text_truncate/text_block_truncate.js +78 -0
  26. package/es/global_styling/reset/global_styles.js +16 -2
  27. package/es/services/accessibility/index.js +0 -3
  28. package/es/services/index.js +1 -1
  29. package/es/test/rtl/component_helpers.d.ts +2 -0
  30. package/es/test/rtl/component_helpers.js +29 -1
  31. package/eui.d.ts +375 -667
  32. package/i18ntokens.json +52 -286
  33. package/lib/components/basic_table/basic_table.js +7 -2
  34. package/lib/components/basic_table/in_memory_table.js +7 -2
  35. package/lib/components/collapsible_nav/collapsible_nav.js +5 -0
  36. package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +4 -2
  37. package/lib/components/color_picker/index.js +0 -7
  38. package/lib/components/combo_box/combo_box.js +141 -303
  39. package/lib/components/combo_box/combo_box_input/combo_box_input.js +0 -13
  40. package/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +34 -118
  41. package/lib/components/context_menu/context_menu_panel.js +5 -5
  42. package/lib/components/flex/flex_grid.styles.js +1 -1
  43. package/lib/components/flex/flex_group.styles.js +1 -1
  44. package/lib/components/flyout/flyout.js +31 -32
  45. package/lib/components/flyout/flyout.styles.js +19 -10
  46. package/lib/components/form/range/dual_range.js +4 -0
  47. package/lib/components/index.js +0 -11
  48. package/lib/components/popover/input_popover.js +48 -3
  49. package/lib/components/popover/popover.js +1 -1
  50. package/lib/components/table/table_row_cell.js +26 -8
  51. package/lib/components/text_truncate/index.js +7 -0
  52. package/lib/components/text_truncate/text_block_truncate.js +85 -0
  53. package/lib/global_styling/reset/global_styles.js +16 -2
  54. package/lib/services/accessibility/index.js +0 -21
  55. package/lib/services/index.js +0 -21
  56. package/lib/test/rtl/component_helpers.d.ts +2 -0
  57. package/lib/test/rtl/component_helpers.js +31 -2
  58. package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +4 -2
  59. package/optimize/es/components/color_picker/index.js +0 -4
  60. package/optimize/es/components/combo_box/combo_box.js +137 -304
  61. package/optimize/es/components/combo_box/combo_box_input/combo_box_input.js +0 -12
  62. package/optimize/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +28 -107
  63. package/optimize/es/components/context_menu/context_menu_panel.js +6 -6
  64. package/optimize/es/components/flex/flex_grid.styles.js +1 -1
  65. package/optimize/es/components/flex/flex_group.styles.js +1 -1
  66. package/optimize/es/components/flyout/flyout.js +32 -33
  67. package/optimize/es/components/flyout/flyout.styles.js +13 -3
  68. package/optimize/es/components/index.js +0 -1
  69. package/optimize/es/components/popover/input_popover.js +43 -3
  70. package/optimize/es/components/popover/popover.js +2 -2
  71. package/optimize/es/components/table/table_row_cell.js +13 -5
  72. package/optimize/es/components/text_truncate/index.js +1 -0
  73. package/optimize/es/components/text_truncate/text_block_truncate.js +58 -0
  74. package/optimize/es/global_styling/reset/global_styles.js +13 -2
  75. package/optimize/es/services/accessibility/index.js +0 -3
  76. package/optimize/es/services/index.js +1 -1
  77. package/optimize/es/test/rtl/component_helpers.d.ts +2 -0
  78. package/optimize/es/test/rtl/component_helpers.js +29 -1
  79. package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +4 -2
  80. package/optimize/lib/components/color_picker/index.js +0 -7
  81. package/optimize/lib/components/combo_box/combo_box.js +136 -303
  82. package/optimize/lib/components/combo_box/combo_box_input/combo_box_input.js +0 -12
  83. package/optimize/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +28 -107
  84. package/optimize/lib/components/context_menu/context_menu_panel.js +5 -5
  85. package/optimize/lib/components/flex/flex_grid.styles.js +1 -1
  86. package/optimize/lib/components/flex/flex_group.styles.js +1 -1
  87. package/optimize/lib/components/flyout/flyout.js +31 -32
  88. package/optimize/lib/components/flyout/flyout.styles.js +19 -10
  89. package/optimize/lib/components/index.js +0 -11
  90. package/optimize/lib/components/popover/input_popover.js +44 -3
  91. package/optimize/lib/components/popover/popover.js +1 -1
  92. package/optimize/lib/components/table/table_row_cell.js +12 -4
  93. package/optimize/lib/components/text_truncate/index.js +7 -0
  94. package/optimize/lib/components/text_truncate/text_block_truncate.js +66 -0
  95. package/optimize/lib/global_styling/reset/global_styles.js +19 -10
  96. package/optimize/lib/services/accessibility/index.js +0 -21
  97. package/optimize/lib/services/index.js +0 -21
  98. package/optimize/lib/test/rtl/component_helpers.d.ts +2 -0
  99. package/optimize/lib/test/rtl/component_helpers.js +31 -2
  100. package/package.json +1 -1
  101. package/src/components/combo_box/combo_box_options_list/_combo_box_options_list.scss +5 -15
  102. package/src/components/context_menu/_context_menu_panel.scss +4 -0
  103. package/src/components/index.scss +0 -1
  104. package/src/global_styling/mixins/_index.scss +0 -1
  105. package/src/global_styling/variables/_index.scss +0 -1
  106. package/src/test/README.md +0 -15
  107. package/src/themes/amsterdam/global_styling/mixins/_index.scss +0 -1
  108. package/test-env/components/basic_table/basic_table.js +7 -2
  109. package/test-env/components/basic_table/in_memory_table.js +7 -2
  110. package/test-env/components/collapsible_nav/collapsible_nav.js +5 -0
  111. package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +4 -2
  112. package/test-env/components/color_picker/index.js +0 -7
  113. package/test-env/components/combo_box/combo_box.js +141 -303
  114. package/test-env/components/combo_box/combo_box_input/combo_box_input.js +0 -13
  115. package/test-env/components/combo_box/combo_box_options_list/combo_box_options_list.js +33 -117
  116. package/test-env/components/context_menu/context_menu_panel.js +5 -5
  117. package/test-env/components/flex/flex_grid.styles.js +1 -1
  118. package/test-env/components/flex/flex_group.styles.js +1 -1
  119. package/test-env/components/flyout/flyout.styles.js +19 -10
  120. package/test-env/components/form/range/dual_range.js +4 -0
  121. package/test-env/components/index.js +0 -11
  122. package/test-env/components/popover/input_popover.js +48 -3
  123. package/test-env/components/popover/popover.js +1 -1
  124. package/test-env/components/table/table_row_cell.js +26 -8
  125. package/test-env/components/text_truncate/index.js +7 -0
  126. package/test-env/components/text_truncate/text_block_truncate.js +82 -0
  127. package/test-env/global_styling/reset/global_styles.js +19 -10
  128. package/test-env/services/accessibility/index.js +0 -21
  129. package/test-env/services/index.js +0 -21
  130. package/test-env/test/rtl/component_helpers.js +31 -2
  131. package/es/components/color_picker/color_stops/color_stop_thumb.js +0 -371
  132. package/es/components/color_picker/color_stops/color_stop_thumb.styles.js +0 -55
  133. package/es/components/color_picker/color_stops/color_stops.js +0 -499
  134. package/es/components/color_picker/color_stops/color_stops.styles.js +0 -61
  135. package/es/components/color_picker/color_stops/index.js +0 -9
  136. package/es/components/color_picker/color_stops/utils.js +0 -95
  137. package/es/components/suggest/index.js +0 -10
  138. package/es/components/suggest/suggest.a11y.js +0 -70
  139. package/es/components/suggest/suggest.js +0 -347
  140. package/es/components/suggest/suggest_item.js +0 -123
  141. package/es/components/suggest/types.js +0 -9
  142. package/es/services/accessibility/accessible_click_keys.js +0 -17
  143. package/es/services/accessibility/cascading_menu_keys.js +0 -28
  144. package/es/services/accessibility/combo_box_keys.js +0 -25
  145. package/lib/components/color_picker/color_stops/color_stop_thumb.js +0 -380
  146. package/lib/components/color_picker/color_stops/color_stop_thumb.styles.js +0 -62
  147. package/lib/components/color_picker/color_stops/color_stops.js +0 -505
  148. package/lib/components/color_picker/color_stops/color_stops.styles.js +0 -67
  149. package/lib/components/color_picker/color_stops/index.js +0 -12
  150. package/lib/components/color_picker/color_stops/utils.js +0 -108
  151. package/lib/components/suggest/index.js +0 -19
  152. package/lib/components/suggest/suggest.a11y.js +0 -73
  153. package/lib/components/suggest/suggest.js +0 -356
  154. package/lib/components/suggest/suggest_item.js +0 -130
  155. package/lib/components/suggest/types.js +0 -16
  156. package/lib/services/accessibility/accessible_click_keys.js +0 -21
  157. package/lib/services/accessibility/cascading_menu_keys.js +0 -35
  158. package/lib/services/accessibility/combo_box_keys.js +0 -32
  159. package/optimize/es/components/color_picker/color_stops/color_stop_thumb.js +0 -329
  160. package/optimize/es/components/color_picker/color_stops/color_stop_thumb.styles.js +0 -55
  161. package/optimize/es/components/color_picker/color_stops/color_stops.js +0 -444
  162. package/optimize/es/components/color_picker/color_stops/color_stops.styles.js +0 -61
  163. package/optimize/es/components/color_picker/color_stops/index.js +0 -9
  164. package/optimize/es/components/color_picker/color_stops/utils.js +0 -90
  165. package/optimize/es/components/suggest/index.js +0 -10
  166. package/optimize/es/components/suggest/suggest.a11y.js +0 -70
  167. package/optimize/es/components/suggest/suggest.js +0 -256
  168. package/optimize/es/components/suggest/suggest_item.js +0 -89
  169. package/optimize/es/components/suggest/types.js +0 -9
  170. package/optimize/es/services/accessibility/accessible_click_keys.js +0 -14
  171. package/optimize/es/services/accessibility/cascading_menu_keys.js +0 -28
  172. package/optimize/es/services/accessibility/combo_box_keys.js +0 -25
  173. package/optimize/lib/components/color_picker/color_stops/color_stop_thumb.js +0 -339
  174. package/optimize/lib/components/color_picker/color_stops/color_stop_thumb.styles.js +0 -62
  175. package/optimize/lib/components/color_picker/color_stops/color_stops.js +0 -451
  176. package/optimize/lib/components/color_picker/color_stops/color_stops.styles.js +0 -67
  177. package/optimize/lib/components/color_picker/color_stops/index.js +0 -12
  178. package/optimize/lib/components/color_picker/color_stops/utils.js +0 -106
  179. package/optimize/lib/components/suggest/index.js +0 -19
  180. package/optimize/lib/components/suggest/suggest.a11y.js +0 -73
  181. package/optimize/lib/components/suggest/suggest.js +0 -266
  182. package/optimize/lib/components/suggest/suggest_item.js +0 -96
  183. package/optimize/lib/components/suggest/types.js +0 -16
  184. package/optimize/lib/services/accessibility/accessible_click_keys.js +0 -20
  185. package/optimize/lib/services/accessibility/cascading_menu_keys.js +0 -35
  186. package/optimize/lib/services/accessibility/combo_box_keys.js +0 -32
  187. package/src/components/suggest/_index.scss +0 -5
  188. package/src/components/suggest/_suggest_input.scss +0 -4
  189. package/src/components/suggest/_suggest_item.scss +0 -103
  190. package/src/components/suggest/_variables.scss +0 -13
  191. package/src/global_styling/mixins/_header.scss +0 -29
  192. package/src/global_styling/variables/_header.scss +0 -3
  193. package/test-env/components/color_picker/color_stops/color_stop_thumb.js +0 -372
  194. package/test-env/components/color_picker/color_stops/color_stop_thumb.styles.js +0 -62
  195. package/test-env/components/color_picker/color_stops/color_stops.js +0 -494
  196. package/test-env/components/color_picker/color_stops/color_stops.styles.js +0 -67
  197. package/test-env/components/color_picker/color_stops/index.js +0 -12
  198. package/test-env/components/color_picker/color_stops/utils.js +0 -106
  199. package/test-env/components/suggest/index.js +0 -19
  200. package/test-env/components/suggest/suggest.a11y.js +0 -73
  201. package/test-env/components/suggest/suggest.js +0 -348
  202. package/test-env/components/suggest/suggest_item.js +0 -129
  203. package/test-env/components/suggest/types.js +0 -16
  204. package/test-env/services/accessibility/accessible_click_keys.js +0 -20
  205. package/test-env/services/accessibility/cascading_menu_keys.js +0 -35
  206. package/test-env/services/accessibility/combo_box_keys.js +0 -32
@@ -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 = ["children", "className", "closePopover", "disableFocusTrap", "focusTrapProps", "input", "fullWidth", "panelMinWidth", "onPanelResize", "inputRef", "panelRef"];
2
+ var _excluded = ["children", "className", "closePopover", "closeOnScroll", "disableFocusTrap", "focusTrapProps", "input", "fullWidth", "panelMinWidth", "onPanelResize", "inputRef", "panelRef"];
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 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
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; }
@@ -22,7 +22,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
22
22
  * Side Public License, v 1.
23
23
  */
24
24
 
25
- import React, { useState, useEffect, useCallback, useMemo, useRef } from 'react';
25
+ import React, { useState, useEffect, useCallback, useMemo, useRef, createContext } from 'react';
26
26
  import PropTypes from "prop-types";
27
27
  import { css } from '@emotion/react';
28
28
  import classnames from 'classnames';
@@ -34,11 +34,15 @@ import { EuiFocusTrap } from '../focus_trap';
34
34
  import { euiFormVariables } from '../form/form.styles';
35
35
  import { EuiPopover } from './popover';
36
36
  import { jsx as ___EmotionJSX } from "@emotion/react";
37
+ // Used by child components that want to know the parent popover width
38
+ export var EuiInputPopoverWidthContext = /*#__PURE__*/createContext(0);
37
39
  export var EuiInputPopover = function EuiInputPopover(_ref) {
38
40
  var _props$panelProps;
39
41
  var children = _ref.children,
40
42
  className = _ref.className,
41
43
  closePopover = _ref.closePopover,
44
+ _ref$closeOnScroll = _ref.closeOnScroll,
45
+ closeOnScroll = _ref$closeOnScroll === void 0 ? false : _ref$closeOnScroll,
42
46
  _ref$disableFocusTrap = _ref.disableFocusTrap,
43
47
  disableFocusTrap = _ref$disableFocusTrap === void 0 ? false : _ref$disableFocusTrap,
44
48
  focusTrapProps = _ref.focusTrapProps,
@@ -119,6 +123,40 @@ export var EuiInputPopover = function EuiInputPopover(_ref) {
119
123
  }
120
124
  }
121
125
  }, [disableFocusTrap, closePopover, panelPropsOnKeyDown]);
126
+
127
+ /**
128
+ * Optional close on scroll behavior
129
+ */
130
+
131
+ useEffect(function () {
132
+ // When the popover opens, add a scroll listener to the page (& remove it after)
133
+ if (closeOnScroll && panelEl) {
134
+ // Close the popover, but only if the scroll event occurs outside the input or the popover itself
135
+ var closePopoverOnScroll = function closePopoverOnScroll(event) {
136
+ if (!panelEl || !inputEl || !event.target) return;
137
+ var scrollTarget = event.target;
138
+ if (panelEl.contains(scrollTarget) === false && inputEl.contains(scrollTarget) === false) {
139
+ closePopover();
140
+ }
141
+ };
142
+
143
+ // Firefox will trigger a scroll event in many common situations when the options list div is appended
144
+ // to the DOM; in testing it was always within 100ms, but setting a timeout here for 500ms to be safe
145
+ var timeoutId = setTimeout(function () {
146
+ window.addEventListener('scroll', closePopoverOnScroll, {
147
+ passive: true,
148
+ // for better performance as we won't call preventDefault
149
+ capture: true // scroll events don't bubble, they must be captured instead
150
+ });
151
+ }, 500);
152
+ return function () {
153
+ window.removeEventListener('scroll', closePopoverOnScroll, {
154
+ capture: true
155
+ });
156
+ clearTimeout(timeoutId);
157
+ };
158
+ }
159
+ }, [closeOnScroll, closePopover, panelEl, inputEl]);
122
160
  return ___EmotionJSX(EuiPopover, _extends({
123
161
  css: /*#__PURE__*/css(fullWidth ? undefined : logicalCSS('max-width', form.maxWidth), ";label:EuiInputPopover;"),
124
162
  repositionToCrossAxis: false,
@@ -136,7 +174,9 @@ export var EuiInputPopover = function EuiInputPopover(_ref) {
136
174
  }), ___EmotionJSX(EuiFocusTrap, _extends({
137
175
  clickOutsideDisables: true,
138
176
  disabled: disableFocusTrap
139
- }, focusTrapProps), children));
177
+ }, focusTrapProps), ___EmotionJSX(EuiInputPopoverWidthContext.Provider, {
178
+ value: panelWidth
179
+ }, children)));
140
180
  };
141
181
  EuiInputPopover.propTypes = {
142
182
  className: PropTypes.string,
@@ -148,6 +188,10 @@ EuiInputPopover.propTypes = {
148
188
  */
149
189
  anchorPosition: PropTypes.oneOf(["downLeft", "downRight", "downCenter"]),
150
190
  disableFocusTrap: PropTypes.bool,
191
+ /**
192
+ * Allows automatically closing the input popover on page scroll
193
+ */
194
+ closeOnScroll: PropTypes.bool,
151
195
  fullWidth: PropTypes.bool,
152
196
  input: PropTypes.any.isRequired,
153
197
  inputRef: PropTypes.any,
@@ -42,7 +42,7 @@ import React, { Component } from 'react';
42
42
  import classNames from 'classnames';
43
43
  import { focusable } from 'tabbable';
44
44
  import { EuiFocusTrap } from '../focus_trap';
45
- import { cascadingMenuKeys, getTransitionTimings, getWaitDuration, performOnFrame, htmlIdGenerator } from '../../services';
45
+ import { keys, getTransitionTimings, getWaitDuration, performOnFrame, htmlIdGenerator } from '../../services';
46
46
  import { EuiScreenReaderOnly } from '../accessibility';
47
47
  import { EuiPortal } from '../portal';
48
48
  import { EuiMutationObserver } from '../observer/mutation_observer';
@@ -139,7 +139,7 @@ export var EuiPopover = /*#__PURE__*/function (_Component) {
139
139
  }, closingTransitionTime);
140
140
  });
141
141
  _defineProperty(_assertThisInitialized(_this), "onKeyDown", function (event) {
142
- if (event.key === cascadingMenuKeys.ESCAPE) {
142
+ if (event.key === keys.ESCAPE) {
143
143
  _this.onEscapeKey(event);
144
144
  }
145
145
  });
@@ -16,10 +16,12 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
16
16
  * Side Public License, v 1.
17
17
  */
18
18
 
19
- import React, { Fragment } from 'react';
19
+ import React, { useCallback } from 'react';
20
20
  import PropTypes from "prop-types";
21
21
  import classNames from 'classnames';
22
22
  import { LEFT_ALIGNMENT, RIGHT_ALIGNMENT, CENTER_ALIGNMENT, useIsWithinBreakpoints } from '../../services';
23
+ import { isObject } from '../../services/predicate';
24
+ import { EuiTextBlockTruncate } from '../text_truncate';
23
25
  import { resolveWidthAsStyle } from './utils';
24
26
  import { jsx as ___EmotionJSX } from "@emotion/react";
25
27
  export var EuiTableRowCell = function EuiTableRowCell(_ref) {
@@ -54,7 +56,7 @@ export var EuiTableRowCell = function EuiTableRowCell(_ref) {
54
56
  'euiTableCellContent--alignRight': align === RIGHT_ALIGNMENT,
55
57
  'euiTableCellContent--alignCenter': align === CENTER_ALIGNMENT,
56
58
  'euiTableCellContent--showOnHover': showOnHover,
57
- 'euiTableCellContent--truncateText': truncateText,
59
+ 'euiTableCellContent--truncateText': truncateText === true,
58
60
  // We're doing this rigamarole instead of creating `euiTableCellContent--textOnly` for BWC
59
61
  // purposes for the time-being.
60
62
  'euiTableCellContent--overflowingContent': textOnly !== true
@@ -74,7 +76,7 @@ export var EuiTableRowCell = function EuiTableRowCell(_ref) {
74
76
  });
75
77
  var widthValue = useIsWithinBreakpoints(['xs', 's']) && mobileOptions.width ? mobileOptions.width : width;
76
78
  var styleObj = resolveWidthAsStyle(style, widthValue);
77
- function modifyChildren(children) {
79
+ var modifyChildren = useCallback(function (children) {
78
80
  var modifiedChildren = children;
79
81
  if (textOnly === true) {
80
82
  modifiedChildren = ___EmotionJSX("span", {
@@ -87,8 +89,14 @@ export var EuiTableRowCell = function EuiTableRowCell(_ref) {
87
89
  });
88
90
  });
89
91
  }
92
+ if (isObject(truncateText) && truncateText.lines) {
93
+ modifiedChildren = ___EmotionJSX(EuiTextBlockTruncate, {
94
+ lines: truncateText.lines,
95
+ cloneElement: true
96
+ }, modifiedChildren);
97
+ }
90
98
  return modifiedChildren;
91
- }
99
+ }, [childClasses, textOnly, truncateText]);
92
100
  var childrenNode = modifyChildren(children);
93
101
  var hideForMobileClasses = 'euiTableRowCell--hideForMobile';
94
102
  var showForMobileClasses = 'euiTableRowCell--hideForDesktop';
@@ -108,7 +116,7 @@ export var EuiTableRowCell = function EuiTableRowCell(_ref) {
108
116
  className: cellClasses
109
117
  }, sharedProps), mobileOptions.header && ___EmotionJSX("div", {
110
118
  className: "euiTableRowCell__mobileHeader ".concat(showForMobileClasses)
111
- }, mobileOptions.header), mobileOptions.render ? ___EmotionJSX(Fragment, null, ___EmotionJSX("div", {
119
+ }, mobileOptions.header), mobileOptions.render ? ___EmotionJSX(React.Fragment, null, ___EmotionJSX("div", {
112
120
  className: "".concat(mobileContentClasses, " ").concat(showForMobileClasses)
113
121
  }, modifyChildren(mobileOptions.render)), ___EmotionJSX("div", {
114
122
  className: "".concat(contentClasses, " ").concat(hideForMobileClasses)
@@ -184,9 +192,14 @@ EuiTableRowCell.propTypes = {
184
192
  */
185
193
  textOnly: PropTypes.bool,
186
194
  /**
187
- * Don't allow line breaks within cells
195
+ * Indicates whether this column should truncate overflowing text content.
196
+ * - Set to `true` to enable single-line truncation.
197
+ * - To enable multi-line truncation, use a configuration object with `lines`
198
+ * set to a number of lines to truncate to.
188
199
  */
189
- truncateText: PropTypes.bool
200
+ truncateText: PropTypes.oneOfType([PropTypes.bool.isRequired, PropTypes.shape({
201
+ lines: PropTypes.number.isRequired
202
+ }).isRequired])
190
203
  }),
191
204
  /**
192
205
  * Horizontal alignment of the text in the cell
@@ -202,8 +215,13 @@ EuiTableRowCell.propTypes = {
202
215
  */
203
216
  textOnly: PropTypes.bool,
204
217
  /**
205
- * Don't allow line breaks within cells
218
+ * Indicates whether this column should truncate overflowing text content.
219
+ * - Set to `true` to enable single-line truncation.
220
+ * - To enable multi-line truncation, use a configuration object with `lines`
221
+ * set to a number of lines to truncate to.
206
222
  */
207
- truncateText: PropTypes.bool,
223
+ truncateText: PropTypes.oneOfType([PropTypes.bool.isRequired, PropTypes.shape({
224
+ lines: PropTypes.number.isRequired
225
+ }).isRequired]),
208
226
  width: PropTypes.any
209
227
  };
@@ -7,4 +7,5 @@
7
7
  */
8
8
 
9
9
  export { EuiTextTruncate } from './text_truncate';
10
+ export { EuiTextBlockTruncate } from './text_block_truncate';
10
11
  export { TruncationUtils } from './utils';
@@ -0,0 +1,78 @@
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 = ["children", "className", "style", "lines", "cloneElement"];
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); }
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; }
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; }
11
+ 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)."; }
12
+ import PropTypes from "prop-types";
13
+ /*
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
+ */
20
+
21
+ import React, { isValidElement, useMemo } from 'react';
22
+ import { css } from '@emotion/react';
23
+ import classNames from 'classnames';
24
+ import { cloneElementWithCss } from '../../services';
25
+ import { jsx as ___EmotionJSX } from "@emotion/react";
26
+ var styles = {
27
+ euiTextBlockTruncate: process.env.NODE_ENV === "production" ? {
28
+ name: "1cfm3ge-euiTextBlockTruncate",
29
+ styles: "display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:0;overflow:hidden;label:euiTextBlockTruncate;"
30
+ } : {
31
+ name: "1cfm3ge-euiTextBlockTruncate",
32
+ styles: "display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:0;overflow:hidden;label:euiTextBlockTruncate;",
33
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
34
+ }
35
+ };
36
+ export var EuiTextBlockTruncate = function EuiTextBlockTruncate(_ref) {
37
+ var children = _ref.children,
38
+ className = _ref.className,
39
+ style = _ref.style,
40
+ lines = _ref.lines,
41
+ cloneElement = _ref.cloneElement,
42
+ rest = _objectWithoutProperties(_ref, _excluded);
43
+ var classes = classNames('euiTextBlockTruncate', className);
44
+ var cssStyles = styles.euiTextBlockTruncate;
45
+ var inlineStyles = useMemo(function () {
46
+ return _objectSpread({
47
+ WebkitLineClamp: lines
48
+ }, style);
49
+ }, [lines, style]);
50
+ if ( /*#__PURE__*/isValidElement(children) && cloneElement) {
51
+ return cloneElementWithCss(children, {
52
+ css: cssStyles,
53
+ style: _objectSpread(_objectSpread({}, children.props.style), inlineStyles),
54
+ className: classNames(children.props.className, classes)
55
+ });
56
+ } else {
57
+ return ___EmotionJSX("div", _extends({
58
+ className: classes,
59
+ css: cssStyles,
60
+ style: inlineStyles
61
+ }, rest), children);
62
+ }
63
+ };
64
+ EuiTextBlockTruncate.propTypes = {
65
+ className: PropTypes.string,
66
+ "aria-label": PropTypes.string,
67
+ "data-test-subj": PropTypes.string,
68
+ css: PropTypes.any,
69
+ /**
70
+ * Number of lines of text to truncate to
71
+ */
72
+ lines: PropTypes.number.isRequired,
73
+ /**
74
+ * Applies styling to the child element instead of rendering a parent wrapper `div`.
75
+ * Can only be used when wrapping a *single* child element/tag, and not raw text.
76
+ */
77
+ cloneElement: PropTypes.bool
78
+ };
@@ -1,3 +1,9 @@
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
+ 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
+ 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; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ 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); }
1
7
  function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
2
8
  /*
3
9
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
@@ -37,12 +43,20 @@ export var EuiGlobalStyles = function EuiGlobalStyles(_ref) {
37
43
  * This font reset sets all our base font/typography related properties
38
44
  * that are needed to override browser-specific element settings.
39
45
  */
40
- var fontReset = "\n font-family: ".concat(font.family, ";\n font-size: ", "".concat(font.scale[font.body.scale] * base, "px"), ";\n line-height: ").concat(base / (font.scale[font.body.scale] * base), ";\n font-weight: ").concat(font.weight[font.body.weight], ";\n ");
46
+ var fontBodyScale = font.scale[font.body.scale];
47
+ var fontReset = {
48
+ fontFamily: font.family,
49
+ fontSize: "".concat(font.defaultUnits === 'px' ? fontBodyScale * base : fontBodyScale).concat(font.defaultUnits),
50
+ lineHeight: base / (fontBodyScale * base),
51
+ fontWeight: font.weight[font.body.weight]
52
+ };
41
53
 
42
54
  /**
43
55
  * Final styles
44
56
  */
45
- var styles = /*#__PURE__*/css(reset, " html{", scrollbarStyles, " ", fontReset, " text-size-adjust:100%;font-kerning:normal;", logicalCSS('height', '100%'), " background-color:", colors.body, ";color:", colors.text, ";}code,pre,kbd,samp{font-family:", font.familyCode, ";}input,textarea,select{", fontReset, ";}select:disabled{opacity:1;}button{font-family:", font.family, ";}em{font-style:italic;}strong{font-weight:", font.weight.bold, ";}*:focus{", euiFocusRing(euiThemeContext), ";}::selection{background:", transparentize(colors.primary, colorMode === 'LIGHT' ? 0.1 : 0.2), ";}a{color:", colors.primaryText, ";&,&:hover,&:focus{text-decoration:none;}}.euiBody-hasPortalContent{position:relative;};label:styles;");
57
+ var styles = /*#__PURE__*/css(reset, " html{", scrollbarStyles, " ", fontReset, " text-size-adjust:100%;font-kerning:normal;", logicalCSS('height', '100%'), " background-color:", colors.body, ";color:", colors.text, ";}code,pre,kbd,samp{font-family:", font.familyCode, ";}input,textarea,select{", _objectSpread(_objectSpread({}, fontReset), {}, {
58
+ fontSize: '1rem' // Inherit from html root
59
+ }), ";}select:disabled{opacity:1;}button{font-family:", font.family, ";}em{font-style:italic;}strong{font-weight:", font.weight.bold, ";}*:focus{", euiFocusRing(euiThemeContext), ";}::selection{background:", transparentize(colors.primary, colorMode === 'LIGHT' ? 0.1 : 0.2), ";}a{color:", colors.primaryText, ";&,&:hover,&:focus{text-decoration:none;}}.euiBody-hasPortalContent{position:relative;};label:styles;");
46
60
  return ___EmotionJSX(Global, {
47
61
  styles: styles
48
62
  });
@@ -6,7 +6,4 @@
6
6
  * Side Public License, v 1.
7
7
  */
8
8
 
9
- export { accessibleClickKeys } from './accessible_click_keys';
10
- export { cascadingMenuKeys } from './cascading_menu_keys';
11
- export { comboBoxKeys } from './combo_box_keys';
12
9
  export { htmlIdGenerator, useGeneratedHtmlId } from './html_id_generator';
@@ -8,7 +8,7 @@
8
8
 
9
9
  // Export all keys under a `keys` named variable
10
10
  import * as keys from './keys';
11
- export { accessibleClickKeys, cascadingMenuKeys, comboBoxKeys, htmlIdGenerator, useGeneratedHtmlId } from './accessibility';
11
+ export { htmlIdGenerator, useGeneratedHtmlId } from './accessibility';
12
12
  export { CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT } from './alignment';
13
13
  export { CurrentEuiBreakpointContext, CurrentEuiBreakpointProvider, useCurrentEuiBreakpoint, useIsWithinBreakpoints, useIsWithinMaxBreakpoint, useIsWithinMinBreakpoint } from './breakpoint';
14
14
  export { CanvasTextUtils } from './canvas';
@@ -8,3 +8,5 @@ export declare const waitForEuiPopoverClose: () => Promise<void>;
8
8
 
9
9
  export declare const waitForEuiToolTipVisible: () => Promise<void>;
10
10
  export declare const waitForEuiToolTipHidden: () => Promise<void>;
11
+
12
+ export declare const showEuiComboBoxOptions: () => Promise<void>;
@@ -11,7 +11,8 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
11
11
  */
12
12
 
13
13
  import '@testing-library/jest-dom';
14
- import { waitFor } from '@testing-library/react';
14
+ import { waitFor, fireEvent } from '@testing-library/react';
15
+ import { screen } from './custom_render';
15
16
 
16
17
  /**
17
18
  * Ensure the EuiPopover being tested is open/closed before continuing
@@ -112,4 +113,31 @@ export var waitForEuiToolTipHidden = /*#__PURE__*/function () {
112
113
  return function waitForEuiToolTipHidden() {
113
114
  return _ref4.apply(this, arguments);
114
115
  };
116
+ }();
117
+
118
+ /**
119
+ * Doot doo
120
+ */
121
+ export var showEuiComboBoxOptions = /*#__PURE__*/function () {
122
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
123
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
124
+ while (1) switch (_context5.prev = _context5.next) {
125
+ case 0:
126
+ fireEvent.click(screen.getByTestSubject('comboBoxToggleListButton'));
127
+ _context5.next = 3;
128
+ return waitForEuiPopoverOpen();
129
+ case 3:
130
+ _context5.next = 5;
131
+ return waitFor(function () {
132
+ expect(screen.getByRole('listbox')).toBeInTheDocument();
133
+ });
134
+ case 5:
135
+ case "end":
136
+ return _context5.stop();
137
+ }
138
+ }, _callee5);
139
+ }));
140
+ return function showEuiComboBoxOptions() {
141
+ return _ref5.apply(this, arguments);
142
+ };
115
143
  }();