@elastic/eui 90.0.0 → 91.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 (232) hide show
  1. package/dist/eui_charts_theme.js +1 -15
  2. package/dist/eui_charts_theme.js.map +1 -1
  3. package/dist/eui_theme_dark.css +112 -80
  4. package/dist/eui_theme_dark.min.css +1 -1
  5. package/dist/eui_theme_light.css +112 -80
  6. package/dist/eui_theme_light.min.css +1 -1
  7. package/es/components/accordion/accordion.js +13 -2
  8. package/es/components/accordion/accordion_children/accordion_children.js +4 -3
  9. package/es/components/breadcrumbs/breadcrumb.js +5 -5
  10. package/es/components/breadcrumbs/breadcrumbs.js +5 -5
  11. package/es/components/button/button_display/_button_display.js +1 -1
  12. package/es/components/button/button_group/button_group.js +8 -10
  13. package/es/components/button/button_group/button_group_button.js +8 -51
  14. package/es/components/button/button_group/button_group_button.styles.js +2 -12
  15. package/es/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +8 -0
  16. package/es/components/collapsible_nav_beta/collapsible_nav_group/collapsible_nav_group.js +8 -3
  17. package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_group.js +7 -3
  18. package/es/components/combo_box/combo_box.js +7 -5
  19. package/es/components/combo_box/combo_box_input/combo_box_input.js +107 -65
  20. package/es/components/combo_box/combo_box_input/combo_box_pill.js +8 -18
  21. package/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +6 -6
  22. package/es/components/combo_box/utils.js +23 -0
  23. package/es/components/control_bar/control_bar.js +5 -5
  24. package/es/components/datagrid/body/header/data_grid_header_cell.js +1 -1
  25. package/es/components/datagrid/controls/column_selector.js +5 -6
  26. package/es/components/datagrid/controls/column_sorting.js +6 -9
  27. package/es/components/datagrid/controls/display_selector.js +21 -16
  28. package/es/components/datagrid/data_grid.js +3 -864
  29. package/es/components/date_picker/super_date_picker/date_popover/absolute_tab.js +92 -26
  30. package/es/components/date_picker/super_date_picker/date_popover/date_popover_button.js +1 -1
  31. package/es/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +1 -2
  32. package/es/components/date_picker/super_date_picker/super_date_picker.js +19 -0
  33. package/es/components/facet/facet_button.js +1 -1
  34. package/es/components/filter_group/filter_group.styles.js +1 -1
  35. package/es/components/header/header_breadcrumbs/header_breadcrumbs.js +5 -5
  36. package/es/components/header/header_links/header_links.js +5 -5
  37. package/es/components/i18n/i18n.js +1 -0
  38. package/es/components/page/page_header/page_header_content.js +5 -5
  39. package/es/components/popover/input_popover.js +1 -1
  40. package/es/components/popover/popover.js +15 -27
  41. package/es/components/popover/popover_arrow/_popover_arrow.styles.js +2 -4
  42. package/es/components/popover/popover_panel/_popover_panel.js +2 -6
  43. package/es/components/popover/popover_panel/_popover_panel.styles.js +6 -1
  44. package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +13 -11
  45. package/es/components/toast/global_toast_list.js +11 -1
  46. package/es/components/tour/tour_step.js +5 -5
  47. package/es/global_styling/mixins/_states.js +4 -1
  48. package/es/services/color/eui_palettes.js +0 -6
  49. package/es/services/color/index.js +1 -1
  50. package/es/services/hooks/useCombinedRefs.js +16 -9
  51. package/es/services/index.js +1 -2
  52. package/es/test/rtl/component_helpers.d.ts +2 -0
  53. package/es/test/rtl/component_helpers.js +40 -1
  54. package/eui.d.ts +96 -82
  55. package/i18ntokens.json +199 -181
  56. package/lib/components/accordion/accordion.js +13 -2
  57. package/lib/components/accordion/accordion_children/accordion_children.js +4 -3
  58. package/lib/components/breadcrumbs/breadcrumb.js +5 -5
  59. package/lib/components/button/button_display/_button_display.js +1 -1
  60. package/lib/components/button/button_group/button_group.js +7 -9
  61. package/lib/components/button/button_group/button_group_button.js +8 -51
  62. package/lib/components/button/button_group/button_group_button.styles.js +2 -12
  63. package/lib/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +8 -0
  64. package/lib/components/collapsible_nav_beta/collapsible_nav_group/collapsible_nav_group.js +7 -2
  65. package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_group.js +6 -2
  66. package/lib/components/combo_box/combo_box.js +7 -5
  67. package/lib/components/combo_box/combo_box_input/combo_box_input.js +107 -65
  68. package/lib/components/combo_box/combo_box_input/combo_box_pill.js +8 -18
  69. package/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +6 -6
  70. package/lib/components/combo_box/utils.js +31 -0
  71. package/lib/components/datagrid/body/header/data_grid_header_cell.js +1 -1
  72. package/lib/components/datagrid/controls/column_selector.js +5 -6
  73. package/lib/components/datagrid/controls/column_sorting.js +5 -8
  74. package/lib/components/datagrid/controls/display_selector.js +21 -16
  75. package/lib/components/datagrid/data_grid.js +2 -863
  76. package/lib/components/date_picker/super_date_picker/date_popover/absolute_tab.js +91 -26
  77. package/lib/components/date_picker/super_date_picker/date_popover/date_popover_button.js +1 -1
  78. package/lib/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +1 -2
  79. package/lib/components/date_picker/super_date_picker/super_date_picker.js +19 -0
  80. package/lib/components/facet/facet_button.js +1 -1
  81. package/lib/components/filter_group/filter_group.styles.js +1 -1
  82. package/lib/components/i18n/i18n.js +1 -0
  83. package/lib/components/popover/input_popover.js +1 -1
  84. package/lib/components/popover/popover.js +29 -35
  85. package/lib/components/popover/popover_arrow/_popover_arrow.styles.js +1 -3
  86. package/lib/components/popover/popover_panel/_popover_panel.js +2 -1
  87. package/lib/components/popover/popover_panel/_popover_panel.styles.js +6 -1
  88. package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +12 -10
  89. package/lib/components/toast/global_toast_list.js +11 -1
  90. package/lib/global_styling/mixins/_states.js +4 -1
  91. package/lib/services/color/eui_palettes.js +1 -8
  92. package/lib/services/color/index.js +0 -7
  93. package/lib/services/hooks/useCombinedRefs.js +19 -10
  94. package/lib/services/index.js +0 -15
  95. package/lib/test/rtl/component_helpers.d.ts +2 -0
  96. package/lib/test/rtl/component_helpers.js +41 -3
  97. package/optimize/es/components/accordion/accordion.js +5 -2
  98. package/optimize/es/components/accordion/accordion_children/accordion_children.js +4 -3
  99. package/optimize/es/components/button/button_group/button_group.js +7 -8
  100. package/optimize/es/components/button/button_group/button_group_button.js +6 -38
  101. package/optimize/es/components/button/button_group/button_group_button.styles.js +2 -12
  102. package/optimize/es/components/collapsible_nav_beta/collapsible_nav_group/collapsible_nav_group.js +8 -3
  103. package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_group.js +7 -3
  104. package/optimize/es/components/combo_box/combo_box.js +7 -5
  105. package/optimize/es/components/combo_box/combo_box_input/combo_box_input.js +107 -65
  106. package/optimize/es/components/combo_box/combo_box_input/combo_box_pill.js +8 -17
  107. package/optimize/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +6 -6
  108. package/optimize/es/components/combo_box/utils.js +23 -0
  109. package/optimize/es/components/datagrid/body/header/data_grid_header_cell.js +1 -1
  110. package/optimize/es/components/datagrid/controls/column_selector.js +5 -6
  111. package/optimize/es/components/datagrid/controls/column_sorting.js +6 -9
  112. package/optimize/es/components/datagrid/controls/display_selector.js +21 -16
  113. package/optimize/es/components/datagrid/data_grid.js +3 -3
  114. package/optimize/es/components/date_picker/super_date_picker/date_popover/absolute_tab.js +87 -26
  115. package/optimize/es/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +1 -2
  116. package/optimize/es/components/filter_group/filter_group.styles.js +1 -1
  117. package/optimize/es/components/i18n/i18n.js +1 -0
  118. package/optimize/es/components/popover/input_popover.js +1 -1
  119. package/optimize/es/components/popover/popover.js +10 -22
  120. package/optimize/es/components/popover/popover_arrow/_popover_arrow.styles.js +2 -4
  121. package/optimize/es/components/popover/popover_panel/_popover_panel.js +2 -1
  122. package/optimize/es/components/popover/popover_panel/_popover_panel.styles.js +6 -1
  123. package/optimize/es/components/selectable/selectable_templates/selectable_template_sitewide.js +13 -11
  124. package/optimize/es/components/toast/global_toast_list.js +1 -1
  125. package/optimize/es/global_styling/mixins/_states.js +4 -1
  126. package/optimize/es/services/color/eui_palettes.js +0 -6
  127. package/optimize/es/services/color/index.js +1 -1
  128. package/optimize/es/services/hooks/useCombinedRefs.js +16 -9
  129. package/optimize/es/services/index.js +1 -2
  130. package/optimize/es/test/rtl/component_helpers.d.ts +2 -0
  131. package/optimize/es/test/rtl/component_helpers.js +40 -1
  132. package/optimize/lib/components/accordion/accordion.js +5 -2
  133. package/optimize/lib/components/accordion/accordion_children/accordion_children.js +4 -3
  134. package/optimize/lib/components/button/button_group/button_group.js +6 -7
  135. package/optimize/lib/components/button/button_group/button_group_button.js +6 -38
  136. package/optimize/lib/components/button/button_group/button_group_button.styles.js +2 -12
  137. package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_group/collapsible_nav_group.js +7 -2
  138. package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_group.js +6 -2
  139. package/optimize/lib/components/combo_box/combo_box.js +7 -5
  140. package/optimize/lib/components/combo_box/combo_box_input/combo_box_input.js +107 -65
  141. package/optimize/lib/components/combo_box/combo_box_input/combo_box_pill.js +8 -17
  142. package/optimize/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +6 -6
  143. package/optimize/lib/components/combo_box/utils.js +31 -0
  144. package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.js +1 -1
  145. package/optimize/lib/components/datagrid/controls/column_selector.js +5 -6
  146. package/optimize/lib/components/datagrid/controls/column_sorting.js +5 -8
  147. package/optimize/lib/components/datagrid/controls/display_selector.js +21 -16
  148. package/optimize/lib/components/datagrid/data_grid.js +2 -2
  149. package/optimize/lib/components/date_picker/super_date_picker/date_popover/absolute_tab.js +86 -26
  150. package/optimize/lib/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +1 -2
  151. package/optimize/lib/components/filter_group/filter_group.styles.js +1 -1
  152. package/optimize/lib/components/i18n/i18n.js +1 -0
  153. package/optimize/lib/components/popover/input_popover.js +1 -1
  154. package/optimize/lib/components/popover/popover.js +24 -35
  155. package/optimize/lib/components/popover/popover_arrow/_popover_arrow.styles.js +1 -3
  156. package/optimize/lib/components/popover/popover_panel/_popover_panel.js +2 -1
  157. package/optimize/lib/components/popover/popover_panel/_popover_panel.styles.js +6 -1
  158. package/optimize/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +12 -10
  159. package/optimize/lib/components/toast/global_toast_list.js +1 -1
  160. package/optimize/lib/global_styling/mixins/_states.js +4 -1
  161. package/optimize/lib/services/color/eui_palettes.js +1 -8
  162. package/optimize/lib/services/color/index.js +0 -7
  163. package/optimize/lib/services/hooks/useCombinedRefs.js +19 -10
  164. package/optimize/lib/services/index.js +0 -15
  165. package/optimize/lib/test/rtl/component_helpers.d.ts +2 -0
  166. package/optimize/lib/test/rtl/component_helpers.js +41 -3
  167. package/package.json +10 -10
  168. package/src/components/combo_box/_combo_box.scss +46 -14
  169. package/src/components/combo_box/combo_box_input/_combo_box_pill.scss +0 -17
  170. package/src/components/combo_box/combo_box_input/_index.scss +0 -2
  171. package/src/components/datagrid/_data_grid_data_row.scss +1 -2
  172. package/src/components/date_picker/super_date_picker/date_popover/_absolute_tab.scss +21 -0
  173. package/src/components/date_picker/super_date_picker/quick_select_popover/_quick_select_popover.scss +0 -4
  174. package/src/components/form/form_control_layout/_form_control_layout.scss +0 -1
  175. package/src/global_styling/variables/_typography.scss +2 -2
  176. package/test-env/components/accordion/accordion.js +13 -2
  177. package/test-env/components/accordion/accordion_children/accordion_children.js +4 -3
  178. package/test-env/components/breadcrumbs/breadcrumb.js +5 -5
  179. package/test-env/components/button/button_display/_button_display.js +1 -1
  180. package/test-env/components/button/button_group/button_group.js +7 -9
  181. package/test-env/components/button/button_group/button_group_button.js +8 -51
  182. package/test-env/components/button/button_group/button_group_button.styles.js +2 -12
  183. package/test-env/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +8 -0
  184. package/test-env/components/collapsible_nav_beta/collapsible_nav_group/collapsible_nav_group.js +7 -2
  185. package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_group.js +6 -2
  186. package/test-env/components/combo_box/combo_box.js +7 -5
  187. package/test-env/components/combo_box/combo_box_input/combo_box_input.js +107 -65
  188. package/test-env/components/combo_box/combo_box_input/combo_box_pill.js +8 -18
  189. package/test-env/components/combo_box/combo_box_options_list/combo_box_options_list.js +6 -6
  190. package/test-env/components/combo_box/utils.js +31 -0
  191. package/test-env/components/datagrid/body/header/data_grid_header_cell.js +1 -1
  192. package/test-env/components/datagrid/controls/column_selector.js +5 -6
  193. package/test-env/components/datagrid/controls/column_sorting.js +5 -8
  194. package/test-env/components/datagrid/controls/display_selector.js +21 -16
  195. package/test-env/components/datagrid/data_grid.js +2 -863
  196. package/test-env/components/date_picker/super_date_picker/date_popover/absolute_tab.js +86 -26
  197. package/test-env/components/date_picker/super_date_picker/date_popover/date_popover_button.js +1 -1
  198. package/test-env/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +1 -2
  199. package/test-env/components/date_picker/super_date_picker/super_date_picker.js +19 -0
  200. package/test-env/components/facet/facet_button.js +1 -1
  201. package/test-env/components/filter_group/filter_group.styles.js +1 -1
  202. package/test-env/components/i18n/i18n.js +1 -0
  203. package/test-env/components/popover/input_popover.js +1 -1
  204. package/test-env/components/popover/popover.js +29 -35
  205. package/test-env/components/popover/popover_arrow/_popover_arrow.styles.js +1 -3
  206. package/test-env/components/popover/popover_panel/_popover_panel.js +2 -1
  207. package/test-env/components/popover/popover_panel/_popover_panel.styles.js +6 -1
  208. package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +12 -10
  209. package/test-env/components/toast/global_toast_list.js +11 -1
  210. package/test-env/global_styling/mixins/_states.js +4 -1
  211. package/test-env/services/color/eui_palettes.js +1 -8
  212. package/test-env/services/color/index.js +0 -7
  213. package/test-env/services/hooks/useCombinedRefs.js +19 -10
  214. package/test-env/services/index.js +0 -15
  215. package/test-env/test/rtl/component_helpers.js +41 -3
  216. package/es/services/random.js +0 -94
  217. package/es/services/utils.js +0 -25
  218. package/es/test/patch_random.js +0 -18
  219. package/lib/services/random.js +0 -100
  220. package/lib/services/utils.js +0 -35
  221. package/lib/test/patch_random.js +0 -25
  222. package/optimize/es/services/random.js +0 -85
  223. package/optimize/es/services/utils.js +0 -25
  224. package/optimize/es/test/patch_random.js +0 -18
  225. package/optimize/lib/services/random.js +0 -91
  226. package/optimize/lib/services/utils.js +0 -35
  227. package/optimize/lib/test/patch_random.js +0 -25
  228. package/src/components/combo_box/combo_box_input/_combo_box_input.scss +0 -12
  229. package/src/components/combo_box/combo_box_input/_combo_box_placeholder.scss +0 -11
  230. package/test-env/services/random.js +0 -91
  231. package/test-env/services/utils.js +0 -35
  232. package/test-env/test/patch_random.js +0 -25
@@ -1,8 +1,8 @@
1
1
  var _excluded = ["key", "label", "color", "onClick", "append", "prepend", "truncationProps"];
2
+ 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
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); }
3
4
  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
5
  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
- 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); }
6
6
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
7
7
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
8
8
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
@@ -31,6 +31,7 @@ import { keys, CanvasTextUtils } from '../../../services';
31
31
  import { EuiScreenReaderOnly } from '../../accessibility';
32
32
  import { EuiFormControlLayout } from '../../form/form_control_layout';
33
33
  import { getFormControlClassNameForIconCount } from '../../form/form_control_layout/_num_icons';
34
+ import { EuiComboBoxOptionAppendPrepend } from '../utils';
34
35
  import { EuiComboBoxPill } from './combo_box_pill';
35
36
  import { jsx as ___EmotionJSX } from "@emotion/react";
36
37
  export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
@@ -57,6 +58,7 @@ export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
57
58
  });
58
59
  _defineProperty(_assertThisInitialized(_this), "updateInputSize", function (inputValue) {
59
60
  if (!_this.widthUtils) return;
61
+ if (_this.asPlainText) return;
60
62
  _this.widthUtils.setTextToCheck(inputValue);
61
63
  // Canvas has minute subpixel differences in rendering compared to DOM
62
64
  // We'll buffer the input by ~2px just to ensure sufficient width
@@ -82,65 +84,42 @@ export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
82
84
  _defineProperty(_assertThisInitialized(_this), "onKeyDown", function (event) {
83
85
  var _this$props2 = _this.props,
84
86
  searchValue = _this$props2.searchValue,
87
+ hasSelectedOptions = _this$props2.hasSelectedOptions,
85
88
  selectedOptions = _this$props2.selectedOptions,
86
89
  onRemoveOption = _this$props2.onRemoveOption,
87
90
  singleSelection = _this$props2.singleSelection,
88
91
  isListOpen = _this$props2.isListOpen,
89
- onOpenListClick = _this$props2.onOpenListClick;
90
-
91
- // When backspacing from an empty input, delete the last pill option in the list
92
+ onOpenListClick = _this$props2.onOpenListClick,
93
+ onChange = _this$props2.onChange;
92
94
  var searchIsEmpty = !searchValue.length;
93
- var hasPills = selectedOptions.length;
94
- if (event.key === keys.BACKSPACE && searchIsEmpty && hasPills) {
95
- onRemoveOption(selectedOptions[selectedOptions.length - 1]);
96
- if (!!singleSelection && !isListOpen) {
97
- onOpenListClick();
95
+ if (event.key === keys.BACKSPACE) {
96
+ // When backspacing in a plain text combobox, change normally and remove the selection
97
+ if (_this.asPlainText) {
98
+ onChange(event.currentTarget.value);
99
+ if (hasSelectedOptions) {
100
+ onRemoveOption(selectedOptions[selectedOptions.length - 1]);
101
+ }
102
+ }
103
+ // When backspacing from an empty input, delete the last pill option in the list
104
+ else if (searchIsEmpty && hasSelectedOptions) {
105
+ onRemoveOption(selectedOptions[selectedOptions.length - 1]);
106
+ if (!!singleSelection && !isListOpen) {
107
+ onOpenListClick();
108
+ }
98
109
  }
99
110
  }
100
111
  });
101
- return _this;
102
- }
103
- _createClass(EuiComboBoxInput, [{
104
- key: "componentDidUpdate",
105
- value: function componentDidUpdate(prevProps) {
106
- if (prevProps.searchValue !== this.props.searchValue) {
107
- this.updateInputSize(this.props.searchValue);
108
- }
109
- }
110
- }, {
111
- key: "render",
112
- value: function render() {
113
- var _this$props3 = this.props,
114
- compressed = _this$props3.compressed,
115
- focusedOptionId = _this$props3.focusedOptionId,
116
- fullWidth = _this$props3.fullWidth,
117
- hasSelectedOptions = _this$props3.hasSelectedOptions,
118
- id = _this$props3.id,
119
- isDisabled = _this$props3.isDisabled,
120
- isListOpen = _this$props3.isListOpen,
121
- noIcon = _this$props3.noIcon,
122
- _onChange = _this$props3.onChange,
123
- onClear = _this$props3.onClear,
124
- onClick = _this$props3.onClick,
125
- onCloseListClick = _this$props3.onCloseListClick,
126
- onOpenListClick = _this$props3.onOpenListClick,
127
- onRemoveOption = _this$props3.onRemoveOption,
128
- placeholder = _this$props3.placeholder,
129
- rootId = _this$props3.rootId,
130
- searchValue = _this$props3.searchValue,
112
+ _defineProperty(_assertThisInitialized(_this), "renderPills", function () {
113
+ // Don't render a pill for plain text comboboxes - use the input instead
114
+ if (_this.asPlainText) return null;
115
+ // Don't render the single pill selection while searching
116
+ if (_this.props.singleSelection && _this.props.searchValue) return null;
117
+ var _this$props3 = _this.props,
131
118
  selectedOptions = _this$props3.selectedOptions,
132
- singleSelectionProp = _this$props3.singleSelection,
133
- value = _this$props3.value,
134
- prepend = _this$props3.prepend,
135
- append = _this$props3.append,
136
- isLoading = _this$props3.isLoading,
137
- isInvalid = _this$props3.isInvalid,
138
- autoFocus = _this$props3.autoFocus,
139
- ariaLabel = _this$props3['aria-label'],
140
- ariaLabelledby = _this$props3['aria-labelledby'];
141
- var singleSelection = Boolean(singleSelectionProp);
142
- var asPlainText = singleSelectionProp && _typeof(singleSelectionProp) === 'object' && singleSelectionProp.asPlainText || false;
143
- var pills = selectedOptions ? selectedOptions.map(function (option) {
119
+ isDisabled = _this$props3.isDisabled,
120
+ onRemoveOption = _this$props3.onRemoveOption;
121
+ if (!selectedOptions || !selectedOptions.length) return null;
122
+ return selectedOptions.map(function (option) {
144
123
  var key = option.key,
145
124
  label = option.label,
146
125
  color = option.color,
@@ -149,17 +128,77 @@ export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
149
128
  prepend = option.prepend,
150
129
  truncationProps = option.truncationProps,
151
130
  rest = _objectWithoutProperties(option, _excluded);
152
- var pillOnClose = isDisabled || singleSelection || onClick ? undefined : onRemoveOption;
131
+ var pillOnClose = isDisabled || _this.props.singleSelection || onClick ? undefined : onRemoveOption;
153
132
  return ___EmotionJSX(EuiComboBoxPill, _extends({
154
133
  option: option,
155
134
  onClose: pillOnClose,
156
135
  key: key !== null && key !== void 0 ? key : label.toLowerCase(),
157
136
  color: color,
158
137
  onClick: onClick,
159
- onClickAriaLabel: onClick ? 'Change' : undefined,
160
- asPlainText: asPlainText
138
+ onClickAriaLabel: onClick ? 'Change' : undefined
161
139
  }, rest), label);
162
- }) : null;
140
+ });
141
+ });
142
+ return _this;
143
+ }
144
+ _createClass(EuiComboBoxInput, [{
145
+ key: "componentDidUpdate",
146
+ value: function componentDidUpdate(prevProps) {
147
+ if (prevProps.searchValue !== this.props.searchValue) {
148
+ this.updateInputSize(this.props.searchValue);
149
+ }
150
+ }
151
+ }, {
152
+ key: "asPlainText",
153
+ get: function get() {
154
+ var singleSelection = this.props.singleSelection;
155
+ var isSingleSelectionConfig = singleSelection && _typeof(singleSelection) === 'object';
156
+ return !!(isSingleSelectionConfig && singleSelection.asPlainText);
157
+ }
158
+ }, {
159
+ key: "searchValue",
160
+ get: function get() {
161
+ var _this$props4 = this.props,
162
+ searchValue = _this$props4.searchValue,
163
+ selectedOptions = _this$props4.selectedOptions;
164
+ if (this.asPlainText) {
165
+ var _selectedOptions$;
166
+ return searchValue || (selectedOptions === null || selectedOptions === void 0 ? void 0 : (_selectedOptions$ = selectedOptions[0]) === null || _selectedOptions$ === void 0 ? void 0 : _selectedOptions$.label) || '';
167
+ } else {
168
+ return searchValue;
169
+ }
170
+ }
171
+ }, {
172
+ key: "render",
173
+ value: function render() {
174
+ var _this$props5 = this.props,
175
+ compressed = _this$props5.compressed,
176
+ focusedOptionId = _this$props5.focusedOptionId,
177
+ fullWidth = _this$props5.fullWidth,
178
+ hasSelectedOptions = _this$props5.hasSelectedOptions,
179
+ id = _this$props5.id,
180
+ isDisabled = _this$props5.isDisabled,
181
+ isListOpen = _this$props5.isListOpen,
182
+ noIcon = _this$props5.noIcon,
183
+ _onChange = _this$props5.onChange,
184
+ onClear = _this$props5.onClear,
185
+ onClick = _this$props5.onClick,
186
+ onFocus = _this$props5.onFocus,
187
+ onCloseListClick = _this$props5.onCloseListClick,
188
+ onOpenListClick = _this$props5.onOpenListClick,
189
+ placeholder = _this$props5.placeholder,
190
+ rootId = _this$props5.rootId,
191
+ searchValue = _this$props5.searchValue,
192
+ selectedOptions = _this$props5.selectedOptions,
193
+ singleSelection = _this$props5.singleSelection,
194
+ value = _this$props5.value,
195
+ prepend = _this$props5.prepend,
196
+ append = _this$props5.append,
197
+ isLoading = _this$props5.isLoading,
198
+ isInvalid = _this$props5.isInvalid,
199
+ autoFocus = _this$props5.autoFocus,
200
+ ariaLabel = _this$props5['aria-label'],
201
+ ariaLabelledby = _this$props5['aria-labelledby'];
163
202
  var removeOptionMessage;
164
203
  var removeOptionMessageId;
165
204
  if (this.state.hasFocus) {
@@ -176,12 +215,7 @@ export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
176
215
  id: removeOptionMessageId
177
216
  }, removeOptionMessageContent));
178
217
  }
179
- var placeholderMessage;
180
- if (placeholder && selectedOptions && !selectedOptions.length && !searchValue) {
181
- placeholderMessage = ___EmotionJSX("p", {
182
- className: "euiComboBoxPlaceholder"
183
- }, placeholder);
184
- }
218
+ var showPlaceholder = placeholder && !(selectedOptions !== null && selectedOptions !== void 0 && selectedOptions.length) && !searchValue;
185
219
  var clickProps = {};
186
220
  if (!isDisabled && onClear && hasSelectedOptions) {
187
221
  clickProps.clear = {
@@ -211,6 +245,7 @@ export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
211
245
  'euiComboBox__inputWrap--compressed': compressed,
212
246
  'euiComboBox__inputWrap--fullWidth': fullWidth,
213
247
  'euiComboBox__inputWrap--noWrap': singleSelection,
248
+ 'euiComboBox__inputWrap--plainText': this.asPlainText || showPlaceholder,
214
249
  'euiComboBox__inputWrap--inGroup': prepend || append
215
250
  });
216
251
  return ___EmotionJSX(EuiFormControlLayout, _extends({
@@ -228,7 +263,10 @@ export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
228
263
  "data-test-subj": "comboBoxInput",
229
264
  onClick: onClick,
230
265
  tabIndex: -1 // becomes onBlur event's relatedTarget, otherwise relatedTarget is null when clicking on this div
231
- }, !singleSelection || !searchValue ? pills : null, placeholderMessage, ___EmotionJSX("input", {
266
+ }, this.renderPills(), ___EmotionJSX(EuiComboBoxOptionAppendPrepend, {
267
+ option: this.asPlainText ? selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions[0] : undefined,
268
+ classNamePrefix: "euiComboBoxPlainTextSelection"
269
+ }, ___EmotionJSX("input", {
232
270
  "aria-activedescendant": focusedOptionId,
233
271
  "aria-autocomplete": "list",
234
272
  "aria-controls": isListOpen ? rootId('listbox') : '',
@@ -249,11 +287,15 @@ export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
249
287
  ref: this.inputRefCallback,
250
288
  role: "combobox",
251
289
  style: {
252
- inlineSize: this.state.inputWidth
290
+ inlineSize: this.asPlainText || showPlaceholder ? '100%' : this.state.inputWidth
253
291
  },
254
- value: searchValue,
292
+ placeholder: showPlaceholder ? placeholder : undefined,
293
+ value: this.searchValue,
255
294
  autoFocus: autoFocus
256
- }), removeOptionMessage));
295
+ // Force the menu to re-open on every input click - only necessary when plain text
296
+ ,
297
+ onClick: this.asPlainText ? onFocus : undefined // Type shenanigans - event should be mostly the same
298
+ })), removeOptionMessage));
257
299
  }
258
300
  }]);
259
301
  return EuiComboBoxInput;
@@ -1,4 +1,4 @@
1
- var _excluded = ["asPlainText", "children", "className", "color", "onClick", "onClickAriaLabel", "onClose", "option"];
1
+ var _excluded = ["children", "className", "color", "onClick", "onClickAriaLabel", "onClose", "option"];
2
2
  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
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 _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; }
@@ -29,6 +29,7 @@ import PropTypes from "prop-types";
29
29
  import classNames from 'classnames';
30
30
  import { EuiBadge } from '../../badge';
31
31
  import { EuiI18n } from '../../i18n';
32
+ import { EuiComboBoxOptionAppendPrepend } from '../utils';
32
33
  import { jsx as ___EmotionJSX } from "@emotion/react";
33
34
  export var EuiComboBoxPill = /*#__PURE__*/function (_Component) {
34
35
  _inherits(EuiComboBoxPill, _Component);
@@ -55,7 +56,6 @@ export var EuiComboBoxPill = /*#__PURE__*/function (_Component) {
55
56
  value: function render() {
56
57
  var _this2 = this;
57
58
  var _this$props2 = this.props,
58
- asPlainText = _this$props2.asPlainText,
59
59
  children = _this$props2.children,
60
60
  className = _this$props2.className,
61
61
  color = _this$props2.color,
@@ -64,20 +64,17 @@ export var EuiComboBoxPill = /*#__PURE__*/function (_Component) {
64
64
  onClose = _this$props2.onClose,
65
65
  option = _this$props2.option,
66
66
  rest = _objectWithoutProperties(_this$props2, _excluded);
67
- var classes = classNames('euiComboBoxPill', {
68
- 'euiComboBoxPill--plainText': asPlainText
69
- }, className);
67
+ var classes = classNames('euiComboBoxPill', className);
70
68
  var onClickProps = onClick && onClickAriaLabel ? {
71
69
  onClick: onClick,
72
70
  onClickAriaLabel: onClickAriaLabel
73
71
  } : {};
74
- var content = ___EmotionJSX(React.Fragment, null, option.prepend && ___EmotionJSX("span", {
75
- className: "euiComboBoxPill__prepend"
76
- }, option.prepend), ___EmotionJSX("span", {
72
+ var content = ___EmotionJSX(EuiComboBoxOptionAppendPrepend, {
73
+ option: option,
74
+ classNamePrefix: "euiComboBoxPill"
75
+ }, ___EmotionJSX("span", {
77
76
  className: "eui-textTruncate"
78
- }, children), option.append && ___EmotionJSX("span", {
79
- className: "euiComboBoxPill__append"
80
- }, option.append));
77
+ }, children));
81
78
  if (onClose) {
82
79
  return ___EmotionJSX(EuiI18n, {
83
80
  token: "euiComboBoxPill.removeSelection",
@@ -98,12 +95,6 @@ export var EuiComboBoxPill = /*#__PURE__*/function (_Component) {
98
95
  }, onClickProps, rest), content);
99
96
  });
100
97
  }
101
- if (asPlainText) {
102
- return ___EmotionJSX("span", _extends({
103
- className: classes,
104
- "data-test-subj": "euiComboBoxPill"
105
- }, rest), content);
106
- }
107
98
  return ___EmotionJSX(EuiBadge, _extends({
108
99
  className: classes,
109
100
  color: color,
@@ -118,7 +109,6 @@ _defineProperty(EuiComboBoxPill, "defaultProps", {
118
109
  color: 'hollow'
119
110
  });
120
111
  EuiComboBoxPill.propTypes = {
121
- asPlainText: PropTypes.bool,
122
112
  children: PropTypes.string,
123
113
  className: PropTypes.string,
124
114
  color: PropTypes.string,
@@ -43,6 +43,7 @@ import { EuiFilterSelectItem } from '../../filter_group/filter_select_item';
43
43
  import { EuiBadge } from '../../badge';
44
44
  import { EuiTextTruncate } from '../../text_truncate';
45
45
  import { EuiInputPopoverWidthContext } from '../../popover/input_popover';
46
+ import { EuiComboBoxOptionAppendPrepend } from '../utils';
46
47
  import { jsx as ___EmotionJSX } from "@emotion/react";
47
48
  var hitEnterBadge = ___EmotionJSX(EuiBadge, {
48
49
  className: "euiComboBoxOption__enterBadge",
@@ -126,13 +127,12 @@ export var EuiComboBoxOptionsList = /*#__PURE__*/function (_Component) {
126
127
  title: label
127
128
  }, rest), ___EmotionJSX("span", {
128
129
  className: "euiComboBoxOption__contentWrapper"
129
- }, prepend && ___EmotionJSX("span", {
130
- className: "euiComboBoxOption__prepend"
131
- }, prepend), ___EmotionJSX("span", {
130
+ }, ___EmotionJSX(EuiComboBoxOptionAppendPrepend, {
131
+ option: option,
132
+ classNamePrefix: "euiComboBoxOption"
133
+ }, ___EmotionJSX("span", {
132
134
  className: "euiComboBoxOption__content"
133
- }, renderOption ? renderOption(option, searchValue, 'euiComboBoxOption__renderOption') : _this.renderTruncatedOption(label, truncationProps)), append && ___EmotionJSX("span", {
134
- className: "euiComboBoxOption__append"
135
- }, append), optionIsFocused && !optionIsDisabled ? hitEnterBadge : null));
135
+ }, renderOption ? renderOption(option, searchValue, 'euiComboBoxOption__renderOption') : _this.renderTruncatedOption(label, truncationProps))), optionIsFocused && !optionIsDisabled ? hitEnterBadge : null));
136
136
  });
137
137
  _defineProperty(_assertThisInitialized(_this), "optionWidth", void 0);
138
138
  _defineProperty(_assertThisInitialized(_this), "setOptionWidth", function (width) {
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
5
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
6
+ * Side Public License, v 1.
7
+ */
8
+
9
+ import React from 'react';
10
+ import { jsx as ___EmotionJSX } from "@emotion/react";
11
+ /**
12
+ * DRY util for rendering an option with its prepend and append properties
13
+ */
14
+ export var EuiComboBoxOptionAppendPrepend = function EuiComboBoxOptionAppendPrepend(_ref) {
15
+ var children = _ref.children,
16
+ option = _ref.option,
17
+ classNamePrefix = _ref.classNamePrefix;
18
+ return ___EmotionJSX(React.Fragment, null, (option === null || option === void 0 ? void 0 : option.prepend) && ___EmotionJSX("span", {
19
+ className: "".concat(classNamePrefix, "__prepend")
20
+ }, option.prepend), children, (option === null || option === void 0 ? void 0 : option.append) && ___EmotionJSX("span", {
21
+ className: "".concat(classNamePrefix, "__append")
22
+ }, option.append));
23
+ };
@@ -399,6 +399,8 @@ EuiControlBar.propTypes = {
399
399
  popoverProps: PropTypes.shape({
400
400
  /**
401
401
  * Class name passed to the direct parent of the button
402
+ *
403
+ * @deprecated Use `className` instead
402
404
  */
403
405
  anchorClassName: PropTypes.string,
404
406
  /**
@@ -410,6 +412,9 @@ EuiControlBar.propTypes = {
410
412
  * Intended for use with inputs as anchors, e.g. EuiInputPopover
411
413
  */
412
414
  attachToAnchor: PropTypes.bool,
415
+ /**
416
+ * @deprecated Use `popoverRef` instead
417
+ */
413
418
  buttonRef: PropTypes.any,
414
419
  /**
415
420
  * Restrict the popover's position within this element
@@ -478,11 +483,6 @@ EuiControlBar.propTypes = {
478
483
  */
479
484
  grow: PropTypes.bool,
480
485
  panelRef: PropTypes.any,
481
- /**
482
- * Background color of the panel;
483
- * Usually a lightened form of the brand colors
484
- */
485
- color: PropTypes.any,
486
486
  className: PropTypes.string,
487
487
  "aria-label": PropTypes.string,
488
488
  "data-test-subj": PropTypes.string,
@@ -108,7 +108,7 @@ export var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
108
108
  title: displayAsText || id
109
109
  }, display || displayAsText || id), sortingScreenReaderText && ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("p", null, sortingScreenReaderText))) : ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiPopover, _extends({
110
110
  className: "eui-fullWidth",
111
- anchorClassName: "eui-fullWidth",
111
+ display: "block",
112
112
  panelPaddingSize: "none",
113
113
  offset: 7,
114
114
  button: ___EmotionJSX("button", {
@@ -121,7 +121,7 @@ export var useDataGridColumnSelector = function useDataGridColumnSelector(availa
121
121
  return setIsOpen(!isOpen);
122
122
  }
123
123
  }, buttonText)
124
- }, ___EmotionJSX("div", null, allowColumnHiding && ___EmotionJSX(EuiPopoverTitle, null, ___EmotionJSX(EuiI18n, {
124
+ }, allowColumnHiding && ___EmotionJSX(EuiPopoverTitle, null, ___EmotionJSX(EuiI18n, {
125
125
  tokens: ['euiColumnSelector.search', 'euiColumnSelector.searchcolumns'],
126
126
  defaults: ['Search', 'Search columns']
127
127
  }, function (_ref3) {
@@ -138,13 +138,12 @@ export var useDataGridColumnSelector = function useDataGridColumnSelector(availa
138
138
  },
139
139
  "data-test-subj": "dataGridColumnSelectorSearch"
140
140
  });
141
- })), ___EmotionJSX("div", {
142
- className: "euiDataGrid__controlScroll"
143
- }, ___EmotionJSX(EuiDragDropContext, {
141
+ })), ___EmotionJSX(EuiDragDropContext, {
144
142
  onDragEnd: onDragEnd
145
143
  }, ___EmotionJSX(EuiDroppable, {
146
144
  droppableId: "columnOrder",
147
- isDropDisabled: !isDragEnabled
145
+ isDropDisabled: !isDragEnabled,
146
+ className: "euiDataGrid__controlScroll"
148
147
  }, ___EmotionJSX(React.Fragment, null, filteredColumns.map(function (id, index) {
149
148
  return ___EmotionJSX(EuiDraggable, {
150
149
  key: id,
@@ -197,7 +196,7 @@ export var useDataGridColumnSelector = function useDataGridColumnSelector(availa
197
196
  color: "subdued"
198
197
  }))));
199
198
  });
200
- })))))), allowColumnHiding && ___EmotionJSX(EuiPopoverFooter, null, ___EmotionJSX(EuiFlexGroup, {
199
+ })))), allowColumnHiding && ___EmotionJSX(EuiPopoverFooter, null, ___EmotionJSX(EuiFlexGroup, {
201
200
  gutterSize: "s",
202
201
  responsive: false,
203
202
  justifyContent: "spaceBetween"
@@ -17,7 +17,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
17
  */
18
18
 
19
19
  import classNames from 'classnames';
20
- import React, { Fragment, useEffect, useState } from 'react';
20
+ import React, { useEffect, useState } from 'react';
21
21
  import { EuiButtonEmpty } from '../../button';
22
22
  import { EuiDragDropContext, euiDragDropReorder, EuiDroppable } from '../../drag_and_drop';
23
23
  import { EuiFlexGroup, EuiFlexItem } from '../../flex';
@@ -128,15 +128,12 @@ export var useDataGridColumnSorting = function useDataGridColumnSorting(columns,
128
128
  return setIsOpen(!isOpen);
129
129
  }
130
130
  }, sorting.columns.length > 0 ? sortingButtonTextActive : sortingButtonText)
131
- }, sorting.columns.length > 0 ? ___EmotionJSX("div", {
132
- role: "region",
133
- "aria-live": "assertive",
134
- className: "euiDataGrid__controlScroll"
135
- }, ___EmotionJSX(EuiDragDropContext, {
131
+ }, sorting.columns.length > 0 ? ___EmotionJSX(EuiDragDropContext, {
136
132
  onDragEnd: onDragEnd
137
133
  }, ___EmotionJSX(EuiDroppable, {
138
- droppableId: "columnSorting"
139
- }, ___EmotionJSX(Fragment, null, sorting.columns.map(function (_ref6, index) {
134
+ droppableId: "columnSorting",
135
+ className: "euiDataGrid__controlScroll"
136
+ }, ___EmotionJSX(React.Fragment, null, sorting.columns.map(function (_ref6, index) {
140
137
  var id = _ref6.id,
141
138
  direction = _ref6.direction;
142
139
  return ___EmotionJSX(EuiDataGridColumnSortingDraggable, {
@@ -149,7 +146,7 @@ export var useDataGridColumnSorting = function useDataGridColumnSorting(columns,
149
146
  schema: schema,
150
147
  schemaDetectors: schemaDetectors
151
148
  });
152
- }))))) : ___EmotionJSX(EuiText, {
149
+ })))) : ___EmotionJSX(EuiText, {
153
150
  size: "s",
154
151
  color: "subdued"
155
152
  }, ___EmotionJSX("p", {
@@ -81,6 +81,7 @@ var convertRowHeightsOptionsToSelection = function convertRowHeightsOptionsToSel
81
81
  }
82
82
  return rowHeightButtonOptions[0];
83
83
  };
84
+ var defaultLineCountValue = String(2);
84
85
  export var useDataGridDisplaySelector = function useDataGridDisplaySelector(showDisplaySelector, initialStyles, initialRowHeightsOptions) {
85
86
  var _showDisplaySelector$, _rowHeightsOptions$de2;
86
87
  var _useState = useState(false),
@@ -108,10 +109,10 @@ export var useDataGridDisplaySelector = function useDataGridDisplaySelector(show
108
109
  }, []);
109
110
 
110
111
  // Row height logic
111
- var _useState7 = useState(2),
112
+ var _useState7 = useState(defaultLineCountValue),
112
113
  _useState8 = _slicedToArray(_useState7, 2),
113
- lineCount = _useState8[0],
114
- setLineCount = _useState8[1];
114
+ lineCountInput = _useState8[0],
115
+ setLineCountInput = _useState8[1];
115
116
  var setRowHeight = useCallback(function (option) {
116
117
  var rowHeightsOptions = {
117
118
  rowHeights: {} // Unset all row-specific heights
@@ -121,25 +122,27 @@ export var useDataGridDisplaySelector = function useDataGridDisplaySelector(show
121
122
  rowHeightsOptions.defaultHeight = 'auto';
122
123
  } else if (option === 'lineCount') {
123
124
  rowHeightsOptions.defaultHeight = {
124
- lineCount: lineCount
125
+ lineCount: Number(lineCountInput)
125
126
  };
126
127
  } else {
127
128
  rowHeightsOptions.defaultHeight = undefined;
128
129
  }
129
130
  setUserRowHeightsOptions(rowHeightsOptions);
130
- }, [lineCount]);
131
+ }, [lineCountInput]);
131
132
  var setLineCountHeight = useCallback(function (event) {
133
+ setLineCountInput(event.currentTarget.value);
132
134
  var newLineCount = Number(event.currentTarget.value);
133
- if (newLineCount < 1) return; // Don't let users set a 0 or negative line count
134
135
 
135
- setLineCount(newLineCount);
136
- setUserRowHeightsOptions({
137
- rowHeights: {},
138
- // Unset all row-specific line counts
139
- defaultHeight: {
140
- lineCount: newLineCount
141
- }
142
- });
136
+ // Don't let users set a 0 or negative line count
137
+ if (newLineCount > 0) {
138
+ setUserRowHeightsOptions({
139
+ rowHeights: {},
140
+ // Unset all row-specific line counts
141
+ defaultHeight: {
142
+ lineCount: newLineCount
143
+ }
144
+ });
145
+ }
143
146
  }, []);
144
147
 
145
148
  // Merge the developer-specified configurations with user overrides
@@ -159,8 +162,9 @@ export var useDataGridDisplaySelector = function useDataGridDisplaySelector(show
159
162
  }, [rowHeightsOptions]);
160
163
  useEffect(function () {
161
164
  var _rowHeightsOptions$de;
165
+ setLineCountInput(
162
166
  // @ts-ignore - optional chaining operator handles types & cases that aren't lineCount
163
- setLineCount((rowHeightsOptions === null || rowHeightsOptions === void 0 ? void 0 : (_rowHeightsOptions$de = rowHeightsOptions.defaultHeight) === null || _rowHeightsOptions$de === void 0 ? void 0 : _rowHeightsOptions$de.lineCount) || 2);
167
+ (rowHeightsOptions === null || rowHeightsOptions === void 0 ? void 0 : (_rowHeightsOptions$de = rowHeightsOptions.defaultHeight) === null || _rowHeightsOptions$de === void 0 ? void 0 : _rowHeightsOptions$de.lineCount) || defaultLineCountValue);
164
168
  // @ts-ignore - same as above
165
169
  }, [rowHeightsOptions === null || rowHeightsOptions === void 0 ? void 0 : (_rowHeightsOptions$de2 = rowHeightsOptions.defaultHeight) === null || _rowHeightsOptions$de2 === void 0 ? void 0 : _rowHeightsOptions$de2.lineCount]);
166
170
 
@@ -292,7 +296,8 @@ export var useDataGridDisplaySelector = function useDataGridDisplaySelector(show
292
296
  min: 1,
293
297
  max: 20,
294
298
  step: 1,
295
- value: lineCount,
299
+ required: true,
300
+ value: lineCountInput,
296
301
  onChange: setLineCountHeight,
297
302
  "data-test-subj": "lineCountNumber"
298
303
  })));