@elastic/eui 88.3.0 → 88.4.1

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 (114) hide show
  1. package/dist/eui_theme_dark.css +7 -142
  2. package/dist/eui_theme_dark.min.css +1 -1
  3. package/dist/eui_theme_light.css +7 -142
  4. package/dist/eui_theme_light.min.css +1 -1
  5. package/es/components/basic_table/in_memory_table.js +85 -34
  6. package/es/components/card/card.js +3 -3
  7. package/es/components/combo_box/combo_box.js +16 -4
  8. package/es/components/combo_box/combo_box_input/combo_box_input.js +4 -1
  9. package/es/components/combo_box/combo_box_input/combo_box_pill.js +5 -1
  10. package/es/components/combo_box/combo_box_options_list/combo_box_option.js +2 -0
  11. package/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +62 -13
  12. package/es/components/datagrid/controls/column_selector.js +5 -3
  13. package/es/components/datagrid/controls/column_sorting_draggable.js +4 -1
  14. package/es/components/description_list/description_list_title.js +0 -1
  15. package/es/components/description_list/description_list_title.styles.js +1 -1
  16. package/es/components/drag_and_drop/draggable.js +18 -23
  17. package/es/components/drag_and_drop/draggable.styles.js +56 -0
  18. package/es/components/drag_and_drop/droppable.js +24 -21
  19. package/es/components/drag_and_drop/droppable.styles.js +51 -0
  20. package/es/components/search_bar/search_box.js +54 -88
  21. package/es/components/table/table_pagination/table_pagination.js +1 -0
  22. package/es/components/text_truncate/text_truncate.js +12 -6
  23. package/es/components/text_truncate/text_truncate.styles.js +10 -10
  24. package/es/test/rtl/custom_render.js +1 -1
  25. package/eui.d.ts +480 -420
  26. package/i18ntokens.json +142 -88
  27. package/lib/components/basic_table/in_memory_table.js +85 -34
  28. package/lib/components/card/card.js +3 -3
  29. package/lib/components/combo_box/combo_box.js +16 -4
  30. package/lib/components/combo_box/combo_box_input/combo_box_input.js +4 -1
  31. package/lib/components/combo_box/combo_box_input/combo_box_pill.js +5 -1
  32. package/lib/components/combo_box/combo_box_options_list/combo_box_option.js +2 -0
  33. package/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +62 -13
  34. package/lib/components/datagrid/controls/column_selector.js +4 -2
  35. package/lib/components/datagrid/controls/column_sorting_draggable.js +4 -1
  36. package/lib/components/description_list/description_list_title.js +0 -1
  37. package/lib/components/description_list/description_list_title.styles.js +1 -1
  38. package/lib/components/drag_and_drop/draggable.js +17 -22
  39. package/lib/components/drag_and_drop/draggable.styles.js +62 -0
  40. package/lib/components/drag_and_drop/droppable.js +26 -22
  41. package/lib/components/drag_and_drop/droppable.styles.js +57 -0
  42. package/lib/components/search_bar/search_box.js +61 -93
  43. package/lib/components/table/table_pagination/table_pagination.js +1 -0
  44. package/lib/components/text_truncate/text_truncate.js +10 -4
  45. package/lib/components/text_truncate/text_truncate.styles.js +10 -10
  46. package/lib/test/rtl/custom_render.js +2 -2
  47. package/optimize/es/components/basic_table/in_memory_table.js +62 -34
  48. package/optimize/es/components/card/card.js +3 -3
  49. package/optimize/es/components/combo_box/combo_box.js +6 -4
  50. package/optimize/es/components/combo_box/combo_box_input/combo_box_input.js +2 -1
  51. package/optimize/es/components/combo_box/combo_box_input/combo_box_pill.js +3 -1
  52. package/optimize/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +52 -10
  53. package/optimize/es/components/datagrid/controls/column_selector.js +5 -3
  54. package/optimize/es/components/datagrid/controls/column_sorting_draggable.js +4 -1
  55. package/optimize/es/components/description_list/description_list_title.js +0 -1
  56. package/optimize/es/components/description_list/description_list_title.styles.js +1 -1
  57. package/optimize/es/components/drag_and_drop/draggable.js +17 -22
  58. package/optimize/es/components/drag_and_drop/draggable.styles.js +56 -0
  59. package/optimize/es/components/drag_and_drop/droppable.js +23 -20
  60. package/optimize/es/components/drag_and_drop/droppable.styles.js +51 -0
  61. package/optimize/es/components/search_bar/search_box.js +50 -83
  62. package/optimize/es/components/table/table_pagination/table_pagination.js +1 -0
  63. package/optimize/es/components/text_truncate/text_truncate.js +12 -6
  64. package/optimize/es/components/text_truncate/text_truncate.styles.js +10 -10
  65. package/optimize/es/test/rtl/custom_render.js +1 -1
  66. package/optimize/lib/components/basic_table/in_memory_table.js +62 -34
  67. package/optimize/lib/components/card/card.js +3 -3
  68. package/optimize/lib/components/combo_box/combo_box.js +6 -4
  69. package/optimize/lib/components/combo_box/combo_box_input/combo_box_input.js +2 -1
  70. package/optimize/lib/components/combo_box/combo_box_input/combo_box_pill.js +3 -1
  71. package/optimize/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +52 -10
  72. package/optimize/lib/components/datagrid/controls/column_selector.js +4 -2
  73. package/optimize/lib/components/datagrid/controls/column_sorting_draggable.js +4 -1
  74. package/optimize/lib/components/description_list/description_list_title.js +0 -1
  75. package/optimize/lib/components/description_list/description_list_title.styles.js +1 -1
  76. package/optimize/lib/components/drag_and_drop/draggable.js +16 -21
  77. package/optimize/lib/components/drag_and_drop/draggable.styles.js +62 -0
  78. package/optimize/lib/components/drag_and_drop/droppable.js +25 -21
  79. package/optimize/lib/components/drag_and_drop/droppable.styles.js +57 -0
  80. package/optimize/lib/components/search_bar/search_box.js +57 -89
  81. package/optimize/lib/components/table/table_pagination/table_pagination.js +1 -0
  82. package/optimize/lib/components/text_truncate/text_truncate.js +10 -4
  83. package/optimize/lib/components/text_truncate/text_truncate.styles.js +10 -10
  84. package/optimize/lib/test/rtl/custom_render.js +2 -2
  85. package/package.json +4 -4
  86. package/src/components/combo_box/combo_box_input/_combo_box_pill.scss +0 -1
  87. package/src/components/combo_box/combo_box_options_list/_combo_box_options_list.scss +8 -0
  88. package/src/components/index.scss +0 -1
  89. package/src/themes/amsterdam/overrides/_index.scss +0 -1
  90. package/test-env/components/basic_table/in_memory_table.js +85 -34
  91. package/test-env/components/card/card.js +3 -3
  92. package/test-env/components/combo_box/combo_box.js +16 -4
  93. package/test-env/components/combo_box/combo_box_input/combo_box_input.js +4 -1
  94. package/test-env/components/combo_box/combo_box_input/combo_box_pill.js +5 -1
  95. package/test-env/components/combo_box/combo_box_options_list/combo_box_option.js +2 -0
  96. package/test-env/components/combo_box/combo_box_options_list/combo_box_options_list.js +61 -12
  97. package/test-env/components/datagrid/controls/column_selector.js +4 -2
  98. package/test-env/components/datagrid/controls/column_sorting_draggable.js +4 -1
  99. package/test-env/components/description_list/description_list_title.js +0 -1
  100. package/test-env/components/description_list/description_list_title.styles.js +1 -1
  101. package/test-env/components/drag_and_drop/draggable.js +17 -22
  102. package/test-env/components/drag_and_drop/draggable.styles.js +62 -0
  103. package/test-env/components/drag_and_drop/droppable.js +26 -22
  104. package/test-env/components/drag_and_drop/droppable.styles.js +57 -0
  105. package/test-env/components/search_bar/search_box.js +60 -88
  106. package/test-env/components/table/table_pagination/table_pagination.js +1 -0
  107. package/test-env/components/text_truncate/text_truncate.js +10 -4
  108. package/test-env/components/text_truncate/text_truncate.styles.js +10 -10
  109. package/test-env/test/rtl/custom_render.js +2 -2
  110. package/src/components/drag_and_drop/_draggable.scss +0 -41
  111. package/src/components/drag_and_drop/_droppable.scss +0 -40
  112. package/src/components/drag_and_drop/_index.scss +0 -3
  113. package/src/components/drag_and_drop/_variables.scss +0 -5
  114. package/src/themes/amsterdam/overrides/_description_list.scss +0 -7
@@ -1,15 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
- import _createClass from "@babel/runtime/helpers/createClass";
5
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
6
- import _inherits from "@babel/runtime/helpers/inherits";
7
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
8
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
9
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
10
- var _excluded = ["query", "incremental", "hint"];
11
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
12
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
3
+ var _excluded = ["query", "placeholder", "incremental", "hint"];
13
4
  /*
14
5
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
15
6
  * or more contributor license agreements. Licensed under the Elastic License
@@ -18,82 +9,58 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
18
9
  * Side Public License, v 1.
19
10
  */
20
11
 
21
- import React, { Component } from 'react';
12
+ import React, { useRef } from 'react';
13
+ import { useUpdateEffect } from '../../services';
14
+ import { useEuiI18n } from '../i18n';
22
15
  import { EuiFieldSearch } from '../form';
23
16
  import { EuiInputPopover } from '../popover';
24
17
  import { jsx as ___EmotionJSX } from "@emotion/react";
25
- export var EuiSearchBox = /*#__PURE__*/function (_Component) {
26
- _inherits(EuiSearchBox, _Component);
27
- var _super = _createSuper(EuiSearchBox);
28
- function EuiSearchBox() {
29
- var _this;
30
- _classCallCheck(this, EuiSearchBox);
31
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
32
- args[_key] = arguments[_key];
18
+ export var EuiSearchBox = function EuiSearchBox(_ref) {
19
+ var query = _ref.query,
20
+ placeholder = _ref.placeholder,
21
+ incremental = _ref.incremental,
22
+ hint = _ref.hint,
23
+ rest = _objectWithoutProperties(_ref, _excluded);
24
+ var _inputRef = useRef(null);
25
+ useUpdateEffect(function () {
26
+ if (_inputRef.current) {
27
+ _inputRef.current.value = query;
28
+ _inputRef.current.dispatchEvent(new Event('change'));
33
29
  }
34
- _this = _super.call.apply(_super, [this].concat(args));
35
- _defineProperty(_assertThisInitialized(_this), "inputElement", null);
36
- return _this;
37
- }
38
- _createClass(EuiSearchBox, [{
39
- key: "componentDidUpdate",
40
- value: function componentDidUpdate(oldProps) {
41
- if (oldProps.query !== this.props.query && this.inputElement != null) {
42
- this.inputElement.value = this.props.query;
43
- this.inputElement.dispatchEvent(new Event('change'));
44
- }
30
+ }, [query]);
31
+ var defaultPlaceholder = useEuiI18n('euiSearchBox.placeholder', 'Search...');
32
+ var ariaLabelIncremental = useEuiI18n('euiSearchBox.incrementalAriaLabel', 'This is a search bar. As you type, the results lower in the page will automatically filter.');
33
+ var ariaLabelEnter = useEuiI18n('euiSearchBox.ariaLabel', 'This is a search bar. After typing your query, hit enter to filter the results lower in the page.');
34
+ var search = ___EmotionJSX(EuiFieldSearch, _extends({
35
+ inputRef: function inputRef(input) {
36
+ return _inputRef.current = input;
37
+ },
38
+ fullWidth: true,
39
+ defaultValue: query,
40
+ incremental: incremental,
41
+ "aria-label": incremental ? ariaLabelIncremental : ariaLabelEnter,
42
+ placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : defaultPlaceholder,
43
+ onFocus: function onFocus() {
44
+ hint === null || hint === void 0 ? void 0 : hint.setIsVisible(true);
45
45
  }
46
- }, {
47
- key: "render",
48
- value: function render() {
49
- var _this2 = this;
50
- var _this$props = this.props,
51
- query = _this$props.query,
52
- incremental = _this$props.incremental,
53
- hint = _this$props.hint,
54
- rest = _objectWithoutProperties(_this$props, _excluded);
55
- var ariaLabel;
56
- if (incremental) {
57
- ariaLabel = 'This is a search bar. As you type, the results lower in the page will automatically filter.';
58
- } else {
59
- ariaLabel = 'This is a search bar. After typing your query, hit enter to filter the results lower in the page.';
60
- }
61
- var search = ___EmotionJSX(EuiFieldSearch, _extends({
62
- inputRef: function inputRef(input) {
63
- return _this2.inputElement = input;
64
- },
65
- fullWidth: true,
66
- defaultValue: query,
67
- incremental: incremental,
68
- "aria-label": ariaLabel,
69
- onFocus: function onFocus() {
70
- hint === null || hint === void 0 ? void 0 : hint.setIsVisible(true);
71
- }
72
- }, rest));
73
- if (hint) {
74
- return ___EmotionJSX(EuiInputPopover, _extends({
75
- disableFocusTrap: true,
76
- input: search,
77
- isOpen: hint.isVisible,
78
- fullWidth: true,
79
- closePopover: function closePopover() {
80
- hint.setIsVisible(false);
81
- },
82
- panelProps: {
83
- 'aria-live': undefined,
84
- 'aria-modal': undefined,
85
- role: undefined,
86
- tabIndex: -1,
87
- id: hint.id
88
- }
89
- }, hint.popoverProps), hint.content);
46
+ }, rest));
47
+ if (hint) {
48
+ return ___EmotionJSX(EuiInputPopover, _extends({
49
+ disableFocusTrap: true,
50
+ input: search,
51
+ isOpen: hint.isVisible,
52
+ fullWidth: true,
53
+ closePopover: function closePopover() {
54
+ hint.setIsVisible(false);
55
+ },
56
+ panelProps: {
57
+ 'aria-live': undefined,
58
+ 'aria-modal': undefined,
59
+ role: undefined,
60
+ tabIndex: -1,
61
+ id: hint.id
90
62
  }
91
- return search;
92
- }
93
- }]);
94
- return EuiSearchBox;
95
- }(Component);
96
- _defineProperty(EuiSearchBox, "defaultProps", {
97
- placeholder: 'Search...',
98
- incremental: false
99
- });
63
+ }, hint.popoverProps), hint.content);
64
+ }
65
+ return search;
66
+ };
@@ -64,6 +64,7 @@ export var EuiTablePagination = function EuiTablePagination(props) {
64
64
  return ___EmotionJSX(EuiContextMenuItem, {
65
65
  key: itemsPerPageOption,
66
66
  icon: itemsPerPageOption === itemsPerPage ? 'check' : 'empty',
67
+ "aria-current": itemsPerPageOption === itemsPerPage ? 'true' : undefined,
67
68
  onClick: function onClick() {
68
69
  closePopover();
69
70
  onChangeItemsPerPage === null || onChangeItemsPerPage === void 0 ? void 0 : onChangeItemsPerPage(itemsPerPageOption);
@@ -2,7 +2,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
4
  var _excluded = ["width"],
5
- _excluded2 = ["width", "children", "text", "truncation", "truncationOffset", "truncationPosition", "ellipsis", "containerRef", "measurementRenderAPI"],
5
+ _excluded2 = ["width", "children", "text", "truncation", "truncationOffset", "truncationPosition", "ellipsis", "containerRef", "measurementRenderAPI", "className"],
6
6
  _excluded3 = ["onResize"];
7
7
  /*
8
8
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
@@ -13,10 +13,11 @@ var _excluded = ["width"],
13
13
  */
14
14
 
15
15
  import React, { useState, useMemo, useCallback } from 'react';
16
+ import classNames from 'classnames';
16
17
  import { useCombinedRefs } from '../../services';
17
18
  import { EuiResizeObserver } from '../observer/resize_observer';
18
19
  import { TruncationUtilsWithDOM, TruncationUtilsWithCanvas } from './utils';
19
- import { euiTextTruncateStyles } from './text_truncate.styles';
20
+ import { euiTextTruncateStyles as styles } from './text_truncate.styles';
20
21
  import { jsx as ___EmotionJSX } from "@emotion/react";
21
22
  var TRUNCATION_TYPES = ['end', 'start', 'startEnd', 'middle'];
22
23
  export var EuiTextTruncate = function EuiTextTruncate(_ref) {
@@ -40,6 +41,7 @@ var EuiTextTruncateWithWidth = function EuiTextTruncateWithWidth(_ref2) {
40
41
  containerRef = _ref2.containerRef,
41
42
  _ref2$measurementRend = _ref2.measurementRenderAPI,
42
43
  measurementRenderAPI = _ref2$measurementRend === void 0 ? 'dom' : _ref2$measurementRend,
44
+ className = _ref2.className,
43
45
  rest = _objectWithoutProperties(_ref2, _excluded2);
44
46
  // Note: This needs to be a state and not a ref to trigger a rerender on mount
45
47
  var _useState = useState(null),
@@ -111,19 +113,23 @@ var EuiTextTruncateWithWidth = function EuiTextTruncateWithWidth(_ref2) {
111
113
  }, [width, text, truncation, truncationOffset, truncationPosition, ellipsis, containerEl, measurementRenderAPI]);
112
114
  var isTruncating = truncatedText !== text;
113
115
  return ___EmotionJSX("div", _extends({
114
- css: euiTextTruncateStyles.euiTextTruncate,
116
+ className: classNames('euiTextTruncate', className),
117
+ css: styles.euiTextTruncate,
115
118
  ref: refs,
116
119
  title: isTruncating ? text : undefined
117
120
  }, rest), isTruncating ? ___EmotionJSX(React.Fragment, null, ___EmotionJSX("span", {
118
- css: euiTextTruncateStyles.truncatedText,
121
+ className: "euiTextTruncate__truncatedText",
122
+ css: styles.euiTextTruncate__truncatedText,
119
123
  "aria-hidden": true,
120
124
  "data-test-subj": "truncatedText"
121
125
  }, children ? children(truncatedText) : truncatedText), ___EmotionJSX("span", {
122
- css: euiTextTruncateStyles.fullText,
126
+ className: "euiTextTruncate__fullText",
127
+ css: styles.euiTextTruncate__fullText,
123
128
  "data-test-subj": "fullText"
124
129
  }, text)) : ___EmotionJSX("span", {
130
+ className: "euiTextTruncate__fullText",
125
131
  "data-test-subj": "fullText"
126
- }, text));
132
+ }, children ? children(text) : text));
127
133
  };
128
134
  var EuiTextTruncateWithResizeObserver = function EuiTextTruncateWithResizeObserver(_ref3) {
129
135
  var _onResize = _ref3.onResize,
@@ -28,22 +28,22 @@ export var euiTextTruncateStyles = {
28
28
  * and there'll be no need for the entire component at that point 🙏
29
29
  */
30
30
  // Makes the truncated text unselectable/un-clickable
31
- truncatedText: process.env.NODE_ENV === "production" ? {
32
- name: "1dore6v-truncatedText",
33
- styles: "user-select:none;pointer-events:none;label:truncatedText;"
31
+ euiTextTruncate__truncatedText: process.env.NODE_ENV === "production" ? {
32
+ name: "1sjxkb1-euiTextTruncate__truncatedText",
33
+ styles: "user-select:none;pointer-events:none;label:euiTextTruncate__truncatedText;"
34
34
  } : {
35
- name: "1dore6v-truncatedText",
36
- styles: "user-select:none;pointer-events:none;label:truncatedText;",
35
+ name: "1sjxkb1-euiTextTruncate__truncatedText",
36
+ styles: "user-select:none;pointer-events:none;label:euiTextTruncate__truncatedText;",
37
37
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
38
38
  },
39
39
  // Positions the full text on top of the truncated text (so that clicking targets it)
40
40
  // and gives it a color opacity of 0 so that it's not actually visible
41
- fullText: process.env.NODE_ENV === "production" ? {
42
- name: "1kxt4rj-fullText",
43
- styles: "position:absolute;inset:0;overflow:hidden;color:rgba(0, 0, 0, 0);@supports (-webkit-hyphens: none){text-overflow:ellipsis;};label:fullText;"
41
+ euiTextTruncate__fullText: process.env.NODE_ENV === "production" ? {
42
+ name: "19c9gqi-euiTextTruncate__fullText",
43
+ styles: "position:absolute;inset:0;overflow:hidden;color:rgba(0, 0, 0, 0);@supports (-webkit-hyphens: none){text-overflow:ellipsis;};label:euiTextTruncate__fullText;"
44
44
  } : {
45
- name: "1kxt4rj-fullText",
46
- styles: "position:absolute;inset:0;overflow:hidden;color:rgba(0, 0, 0, 0);@supports (-webkit-hyphens: none){text-overflow:ellipsis;};label:fullText;",
45
+ name: "19c9gqi-euiTextTruncate__fullText",
46
+ styles: "position:absolute;inset:0;overflow:hidden;color:rgba(0, 0, 0, 0);@supports (-webkit-hyphens: none){text-overflow:ellipsis;};label:euiTextTruncate__fullText;",
47
47
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
48
48
  }
49
49
  };
@@ -12,7 +12,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
12
12
  */
13
13
 
14
14
  import { queries, render, screen, within } from '@testing-library/react';
15
- import { EuiProvider } from '../../components';
15
+ import { EuiProvider } from '../../components/provider';
16
16
  import * as dataTestSubjQueries from './data_test_subj_queries';
17
17
 
18
18
  /**
@@ -19,13 +19,15 @@ var _react = _interopRequireWildcard(require("react"));
19
19
  var _basic_table = require("./basic_table");
20
20
  var _predicate = require("../../services/predicate");
21
21
  var _sort2 = require("../../services/sort");
22
- var _search_bar = require("../search_bar");
22
+ var _search_bar = require("../search_bar/search_bar");
23
+ var _search_box = require("../search_bar/search_box");
23
24
  var _spacer = require("../spacer");
24
25
  var _table_pagination = require("../table/table_pagination");
25
26
  var _component_defaults = require("../provider/component_defaults");
26
27
  var _react2 = require("@emotion/react");
27
- var _excluded = ["onChange"],
28
- _excluded2 = ["columns", "loading", "message", "error", "selection", "isSelectable", "hasActions", "compressed", "pagination", "sorting", "itemIdToExpandedRowMap", "itemId", "rowProps", "cellProps", "tableLayout", "items", "search", "onTableChange", "executeQueryOptions", "allowNeutralSort", "childrenBetween"];
28
+ var _excluded = ["schema"],
29
+ _excluded2 = ["onChange"],
30
+ _excluded3 = ["columns", "loading", "message", "error", "selection", "isSelectable", "hasActions", "compressed", "pagination", "sorting", "itemIdToExpandedRowMap", "itemId", "rowProps", "cellProps", "tableLayout", "items", "search", "searchFormat", "onTableChange", "executeQueryOptions", "allowNeutralSort", "childrenBetween"];
29
31
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
30
32
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
31
33
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
@@ -218,6 +220,15 @@ var EuiInMemoryTable = /*#__PURE__*/function (_Component) {
218
220
  };
219
221
  });
220
222
  });
223
+ // Alternative to onQueryChange - allows consumers to specify they want the
224
+ // search bar to ignore EQL syntax and only use the searchbar for plain text
225
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onPlainTextSearch", function (searchValue) {
226
+ var escapedQueryText = searchValue.replace(/["\\]/g, '\\$&');
227
+ var finalQuery = "\"".concat(escapedQueryText, "\"");
228
+ _this.setState({
229
+ query: _search_bar.EuiSearchBar.Query.parse(finalQuery)
230
+ });
231
+ });
221
232
  var columns = props.columns,
222
233
  _search = props.search,
223
234
  _pagination = props.pagination,
@@ -261,12 +272,26 @@ var EuiInMemoryTable = /*#__PURE__*/function (_Component) {
261
272
  }, {
262
273
  key: "renderSearchBar",
263
274
  value: function renderSearchBar() {
264
- var search = this.props.search;
265
- if (search) {
275
+ var _this$props = this.props,
276
+ search = _this$props.search,
277
+ searchFormat = _this$props.searchFormat;
278
+ if (!search) return;
279
+ var searchBar;
280
+ if (searchFormat === 'text') {
281
+ var _searchBoxProps = (search === null || search === void 0 ? void 0 : search.box) || {}; // Work around | boolean type
282
+ var schema = _searchBoxProps.schema,
283
+ searchBoxProps = (0, _objectWithoutProperties2.default)(_searchBoxProps, _excluded); // Destructure `schema` so it doesn't get rendered to DOM
284
+
285
+ searchBar = (0, _react2.jsx)(_search_box.EuiSearchBox, (0, _extends2.default)({
286
+ query: "" // Unused, passed to satisfy Typescript
287
+ }, searchBoxProps, {
288
+ onSearch: this.onPlainTextSearch
289
+ }));
290
+ } else {
266
291
  var searchBarProps = {};
267
292
  if (isEuiSearchBarProps(search)) {
268
293
  var onChange = search.onChange,
269
- _searchBarProps = (0, _objectWithoutProperties2.default)(search, _excluded);
294
+ _searchBarProps = (0, _objectWithoutProperties2.default)(search, _excluded2);
270
295
  searchBarProps = _searchBarProps;
271
296
  if (searchBarProps.box && searchBarProps.box.schema === true) {
272
297
  searchBarProps.box = _objectSpread(_objectSpread({}, searchBarProps.box), {}, {
@@ -274,12 +299,13 @@ var EuiInMemoryTable = /*#__PURE__*/function (_Component) {
274
299
  });
275
300
  }
276
301
  }
277
- return (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(_search_bar.EuiSearchBar, (0, _extends2.default)({
302
+ searchBar = (0, _react2.jsx)(_search_bar.EuiSearchBar, (0, _extends2.default)({
278
303
  onChange: this.onQueryChange
279
- }, searchBarProps)), (0, _react2.jsx)(_spacer.EuiSpacer, {
280
- size: "l"
281
- }));
304
+ }, searchBarProps));
282
305
  }
306
+ return (0, _react2.jsx)(_react.default.Fragment, null, searchBar, (0, _react2.jsx)(_spacer.EuiSpacer, {
307
+ size: "l"
308
+ }));
283
309
  }
284
310
  }, {
285
311
  key: "resolveSearchSchema",
@@ -356,29 +382,30 @@ var EuiInMemoryTable = /*#__PURE__*/function (_Component) {
356
382
  }, {
357
383
  key: "render",
358
384
  value: function render() {
359
- var _this$props = this.props,
360
- columns = _this$props.columns,
361
- loading = _this$props.loading,
362
- message = _this$props.message,
363
- error = _this$props.error,
364
- selection = _this$props.selection,
365
- isSelectable = _this$props.isSelectable,
366
- hasActions = _this$props.hasActions,
367
- compressed = _this$props.compressed,
368
- hasPagination = _this$props.pagination,
369
- hasSorting = _this$props.sorting,
370
- itemIdToExpandedRowMap = _this$props.itemIdToExpandedRowMap,
371
- itemId = _this$props.itemId,
372
- rowProps = _this$props.rowProps,
373
- cellProps = _this$props.cellProps,
374
- tableLayout = _this$props.tableLayout,
375
- _unuseditems = _this$props.items,
376
- search = _this$props.search,
377
- onTableChange = _this$props.onTableChange,
378
- executeQueryOptions = _this$props.executeQueryOptions,
379
- allowNeutralSort = _this$props.allowNeutralSort,
380
- childrenBetween = _this$props.childrenBetween,
381
- rest = (0, _objectWithoutProperties2.default)(_this$props, _excluded2);
385
+ var _this$props2 = this.props,
386
+ columns = _this$props2.columns,
387
+ loading = _this$props2.loading,
388
+ message = _this$props2.message,
389
+ error = _this$props2.error,
390
+ selection = _this$props2.selection,
391
+ isSelectable = _this$props2.isSelectable,
392
+ hasActions = _this$props2.hasActions,
393
+ compressed = _this$props2.compressed,
394
+ hasPagination = _this$props2.pagination,
395
+ hasSorting = _this$props2.sorting,
396
+ itemIdToExpandedRowMap = _this$props2.itemIdToExpandedRowMap,
397
+ itemId = _this$props2.itemId,
398
+ rowProps = _this$props2.rowProps,
399
+ cellProps = _this$props2.cellProps,
400
+ tableLayout = _this$props2.tableLayout,
401
+ _unuseditems = _this$props2.items,
402
+ search = _this$props2.search,
403
+ searchFormat = _this$props2.searchFormat,
404
+ onTableChange = _this$props2.onTableChange,
405
+ executeQueryOptions = _this$props2.executeQueryOptions,
406
+ allowNeutralSort = _this$props2.allowNeutralSort,
407
+ childrenBetween = _this$props2.childrenBetween,
408
+ rest = (0, _objectWithoutProperties2.default)(_this$props2, _excluded3);
382
409
  var _this$state3 = this.state,
383
410
  pageIndex = _this$state3.pageIndex,
384
411
  pageSize = _this$state3.pageSize,
@@ -502,5 +529,6 @@ exports.EuiInMemoryTable = EuiInMemoryTable;
502
529
  (0, _defineProperty2.default)(EuiInMemoryTable, "contextType", _component_defaults.EuiComponentDefaultsContext);
503
530
  (0, _defineProperty2.default)(EuiInMemoryTable, "defaultProps", {
504
531
  responsive: true,
505
- tableLayout: 'fixed'
532
+ tableLayout: 'fixed',
533
+ searchFormat: 'eql'
506
534
  });
@@ -12,14 +12,14 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
12
12
  var _react = _interopRequireWildcard(require("react"));
13
13
  var _classnames = _interopRequireDefault(require("classnames"));
14
14
  var _services = require("../../services");
15
+ var _accessibility = require("../../services/accessibility");
16
+ var _href_validator = require("../../services/security/href_validator");
15
17
  var _text = require("../text");
16
18
  var _title = require("../title");
17
19
  var _beta_badge = require("../badge/beta_badge");
18
- var _card_select = require("./card_select");
19
- var _accessibility = require("../../services/accessibility");
20
- var _href_validator = require("../../services/security/href_validator");
21
20
  var _panel = require("../panel");
22
21
  var _spacer = require("../spacer");
22
+ var _card_select = require("./card_select");
23
23
  var _card = require("./card.styles");
24
24
  var _react2 = require("@emotion/react");
25
25
  var _excluded = ["className", "description", "isDisabled", "title", "titleElement", "titleSize", "icon", "image", "children", "footer", "onClick", "href", "rel", "target", "textAlign", "betaBadgeProps", "layout", "selectable", "display", "paddingSize"],
@@ -18,14 +18,14 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
18
18
  var _react = _interopRequireWildcard(require("react"));
19
19
  var _classnames = _interopRequireDefault(require("classnames"));
20
20
  var _services = require("../../services");
21
+ var _popover = require("../../services/popover");
21
22
  var _portal = require("../portal");
22
23
  var _i18n = require("../i18n");
23
- var _combo_box_options_list = require("./combo_box_options_list");
24
24
  var _matching_options = require("./matching_options");
25
25
  var _combo_box_input = require("./combo_box_input/combo_box_input");
26
- var _popover = require("../../services/popover");
26
+ var _combo_box_options_list = require("./combo_box_options_list");
27
27
  var _react2 = require("@emotion/react");
28
- var _excluded = ["data-test-subj", "async", "className", "compressed", "customOptionText", "fullWidth", "id", "inputRef", "isCaseSensitive", "isClearable", "isDisabled", "isInvalid", "isLoading", "noSuggestions", "onBlur", "onChange", "onCreateOption", "onSearchChange", "options", "placeholder", "renderOption", "rowHeight", "selectedOptions", "singleSelection", "prepend", "sortMatchesBy", "delimiter", "append", "autoFocus", "aria-label", "aria-labelledby"];
28
+ var _excluded = ["data-test-subj", "async", "className", "compressed", "customOptionText", "fullWidth", "id", "inputRef", "isCaseSensitive", "isClearable", "isDisabled", "isInvalid", "isLoading", "noSuggestions", "onBlur", "onChange", "onCreateOption", "onSearchChange", "options", "placeholder", "renderOption", "rowHeight", "selectedOptions", "singleSelection", "prepend", "sortMatchesBy", "delimiter", "append", "autoFocus", "truncationProps", "aria-label", "aria-labelledby"];
29
29
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
30
30
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
31
31
  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; }
@@ -639,6 +639,7 @@ var EuiComboBox = /*#__PURE__*/function (_Component) {
639
639
  delimiter = _this$props8.delimiter,
640
640
  append = _this$props8.append,
641
641
  autoFocus = _this$props8.autoFocus,
642
+ truncationProps = _this$props8.truncationProps,
642
643
  ariaLabel = _this$props8['aria-label'],
643
644
  ariaLabelledby = _this$props8['aria-labelledby'],
644
645
  rest = (0, _objectWithoutProperties2.default)(_this$props8, _excluded);
@@ -707,7 +708,8 @@ var EuiComboBox = /*#__PURE__*/function (_Component) {
707
708
  width: width,
708
709
  delimiter: delimiter,
709
710
  getSelectedOptionForSearchValue: _matching_options.getSelectedOptionForSearchValue,
710
- listboxAriaLabel: listboxAriaLabel
711
+ listboxAriaLabel: listboxAriaLabel,
712
+ truncationProps: truncationProps
711
713
  });
712
714
  }));
713
715
  }
@@ -25,7 +25,7 @@ var _form_control_layout = require("../../form/form_control_layout");
25
25
  var _num_icons = require("../../form/form_control_layout/_num_icons");
26
26
  var _combo_box_pill = require("./combo_box_pill");
27
27
  var _react2 = require("@emotion/react");
28
- var _excluded = ["key", "label", "color", "onClick", "append", "prepend"];
28
+ var _excluded = ["key", "label", "color", "onClick", "append", "prepend", "truncationProps"];
29
29
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
30
30
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
31
31
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
@@ -156,6 +156,7 @@ var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
156
156
  onClick = option.onClick,
157
157
  append = option.append,
158
158
  prepend = option.prepend,
159
+ truncationProps = option.truncationProps,
159
160
  rest = (0, _objectWithoutProperties2.default)(option, _excluded);
160
161
  var pillOnClose = isDisabled || singleSelection || onClick ? undefined : onRemoveOption;
161
162
  return (0, _react2.jsx)(_combo_box_pill.EuiComboBoxPill, (0, _extends2.default)({
@@ -74,7 +74,9 @@ var EuiComboBoxPill = /*#__PURE__*/function (_Component) {
74
74
  } : {};
75
75
  var content = (0, _react2.jsx)(_react.default.Fragment, null, option.prepend && (0, _react2.jsx)("span", {
76
76
  className: "euiComboBoxPill__prepend"
77
- }, option.prepend), children, option.append && (0, _react2.jsx)("span", {
77
+ }, option.prepend), (0, _react2.jsx)("span", {
78
+ className: "eui-textTruncate"
79
+ }, children), option.append && (0, _react2.jsx)("span", {
78
80
  className: "euiComboBoxPill__append"
79
81
  }, option.append));
80
82
  if (onClose) {
@@ -20,6 +20,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
20
20
  var _reactWindow = require("react-window");
21
21
  var _flex = require("../../flex");
22
22
  var _highlight = require("../../highlight");
23
+ var _mark = require("../../mark");
23
24
  var _text = require("../../text");
24
25
  var _loading = require("../../loading");
25
26
  var _combo_box_title = require("./combo_box_title");
@@ -27,9 +28,10 @@ var _i18n = require("../../i18n");
27
28
  var _filter_select_item = require("../../filter_group/filter_select_item");
28
29
  var _badge = require("../../badge");
29
30
  var _popover_panel = require("../../popover/popover_panel");
31
+ var _text_truncate = require("../../text_truncate");
30
32
  var _react2 = require("@emotion/react");
31
- var _excluded = ["key", "isGroupLabelOption", "label", "value", "prepend", "append"],
32
- _excluded2 = ["data-test-subj", "activeOptionIndex", "areAllOptionsSelected", "customOptionText", "fullWidth", "getSelectedOptionForSearchValue", "isCaseSensitive", "isLoading", "listRef", "matchingOptions", "onCloseList", "onCreateOption", "onOptionClick", "onOptionEnterKey", "onScroll", "optionRef", "options", "position", "renderOption", "rootId", "rowHeight", "scrollToIndex", "searchValue", "selectedOptions", "singleSelection", "updatePosition", "width", "delimiter", "zIndex", "style", "listboxAriaLabel"];
33
+ var _excluded = ["key", "isGroupLabelOption", "label", "value", "prepend", "append", "truncationProps"],
34
+ _excluded2 = ["data-test-subj", "activeOptionIndex", "areAllOptionsSelected", "customOptionText", "fullWidth", "getSelectedOptionForSearchValue", "isCaseSensitive", "isLoading", "listRef", "matchingOptions", "onCloseList", "onCreateOption", "onOptionClick", "onOptionEnterKey", "onScroll", "optionRef", "options", "position", "renderOption", "rootId", "rowHeight", "scrollToIndex", "searchValue", "selectedOptions", "singleSelection", "updatePosition", "width", "delimiter", "zIndex", "style", "truncationProps", "listboxAriaLabel"];
33
35
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
34
36
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
35
37
  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; }
@@ -42,7 +44,6 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
42
44
  * in compliance with, at your election, the Elastic License 2.0 or the Server
43
45
  * Side Public License, v 1.
44
46
  */
45
- var OPTION_CONTENT_CLASSNAME = 'euiComboBoxOption__content';
46
47
  var hitEnterBadge = (0, _react2.jsx)(_badge.EuiBadge, {
47
48
  className: "euiComboBoxOption__enterBadge",
48
49
  color: "hollow",
@@ -103,6 +104,7 @@ var EuiComboBoxOptionsList = /*#__PURE__*/function (_Component) {
103
104
  value = option.value,
104
105
  prepend = option.prepend,
105
106
  append = option.append,
107
+ _truncationProps = option.truncationProps,
106
108
  rest = (0, _objectWithoutProperties2.default)(option, _excluded);
107
109
  var _this$props = _this.props,
108
110
  singleSelection = _this$props.singleSelection,
@@ -113,6 +115,9 @@ var EuiComboBoxOptionsList = /*#__PURE__*/function (_Component) {
113
115
  renderOption = _this$props.renderOption,
114
116
  searchValue = _this$props.searchValue,
115
117
  rootId = _this$props.rootId;
118
+ var hasTruncationProps = _this.props.truncationProps || _truncationProps;
119
+ var truncationProps = hasTruncationProps ? // Individual truncation settings should override component prop
120
+ _objectSpread(_objectSpread({}, _this.props.truncationProps), _truncationProps) : undefined;
116
121
  if (isGroupLabelOption) {
117
122
  return (0, _react2.jsx)("div", {
118
123
  key: key !== null && key !== void 0 ? key : label,
@@ -143,16 +148,52 @@ var EuiComboBoxOptionsList = /*#__PURE__*/function (_Component) {
143
148
  className: "euiComboBoxOption__contentWrapper"
144
149
  }, prepend && (0, _react2.jsx)("span", {
145
150
  className: "euiComboBoxOption__prepend"
146
- }, prepend), renderOption ? (0, _react2.jsx)("span", {
147
- className: OPTION_CONTENT_CLASSNAME
148
- }, renderOption(option, searchValue, 'euiComboBoxOption__renderOption')) : (0, _react2.jsx)(_highlight.EuiHighlight, {
149
- search: searchValue,
150
- strict: _this.props.isCaseSensitive,
151
- className: OPTION_CONTENT_CLASSNAME
152
- }, label), append && (0, _react2.jsx)("span", {
151
+ }, prepend), (0, _react2.jsx)("span", {
152
+ className: "euiComboBoxOption__content"
153
+ }, renderOption ? renderOption(option, searchValue, 'euiComboBoxOption__renderOption') : _this.renderTruncatedOption(label, truncationProps)), append && (0, _react2.jsx)("span", {
153
154
  className: "euiComboBoxOption__append"
154
155
  }, append), optionIsFocused && !optionIsDisabled ? hitEnterBadge : null));
155
156
  });
157
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "optionWidth", void 0);
158
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setOptionWidth", function (width) {
159
+ _this.optionWidth = width;
160
+ });
161
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderTruncatedOption", function (text, truncationProps) {
162
+ var searchValue = _this.props.searchValue.trim();
163
+ if (!truncationProps && !searchValue) {
164
+ // Default to CSS text-overflow
165
+ return text;
166
+ }
167
+ if (!searchValue) {
168
+ return (0, _react2.jsx)(_text_truncate.EuiTextTruncate, (0, _extends2.default)({
169
+ width: _this.optionWidth,
170
+ onResize: _this.setOptionWidth
171
+ }, truncationProps, {
172
+ text: text
173
+ }), function (text) {
174
+ return text;
175
+ });
176
+ }
177
+ var searchPositionStart = _this.props.isCaseSensitive ? text.indexOf(searchValue) : text.toLowerCase().indexOf(searchValue.toLowerCase());
178
+ var searchPositionCenter = searchPositionStart + Math.floor(searchValue.length / 2);
179
+ return (0, _react2.jsx)(_text_truncate.EuiTextTruncate, (0, _extends2.default)({
180
+ width: _this.optionWidth,
181
+ onResize: _this.setOptionWidth
182
+ }, truncationProps, {
183
+ // When searching, don't allow overriding the truncation settings
184
+ truncation: "startEnd",
185
+ truncationPosition: searchPositionCenter,
186
+ text: text
187
+ }), function (text) {
188
+ return (0, _react2.jsx)(_react.default.Fragment, null, text.length >= searchValue.length ? (0, _react2.jsx)(_highlight.EuiHighlight, {
189
+ search: searchValue,
190
+ strict: _this.props.isCaseSensitive
191
+ }, text) :
192
+ // If the available truncated text is shorter than the full search string,
193
+ // just highlight the entire truncated text
194
+ (0, _react2.jsx)(_mark.EuiMark, null, text));
195
+ });
196
+ });
156
197
  return _this;
157
198
  }
158
199
  (0, _createClass2.default)(EuiComboBoxOptionsList, [{
@@ -236,6 +277,7 @@ var EuiComboBoxOptionsList = /*#__PURE__*/function (_Component) {
236
277
  delimiter = _this$props2.delimiter,
237
278
  zIndex = _this$props2.zIndex,
238
279
  style = _this$props2.style,
280
+ truncationProps = _this$props2.truncationProps,
239
281
  listboxAriaLabel = _this$props2.listboxAriaLabel,
240
282
  rest = (0, _objectWithoutProperties2.default)(_this$props2, _excluded2);
241
283
  var emptyStateContent;