@elastic/eui 88.3.0 → 88.4.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 (103) hide show
  1. package/dist/eui_theme_dark.css +0 -142
  2. package/dist/eui_theme_dark.min.css +1 -1
  3. package/dist/eui_theme_light.css +0 -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 +59 -15
  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/test/rtl/custom_render.js +1 -1
  23. package/eui.d.ts +480 -420
  24. package/i18ntokens.json +142 -88
  25. package/lib/components/basic_table/in_memory_table.js +85 -34
  26. package/lib/components/card/card.js +3 -3
  27. package/lib/components/combo_box/combo_box.js +16 -4
  28. package/lib/components/combo_box/combo_box_input/combo_box_input.js +4 -1
  29. package/lib/components/combo_box/combo_box_input/combo_box_pill.js +5 -1
  30. package/lib/components/combo_box/combo_box_options_list/combo_box_option.js +2 -0
  31. package/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +59 -15
  32. package/lib/components/datagrid/controls/column_selector.js +4 -2
  33. package/lib/components/datagrid/controls/column_sorting_draggable.js +4 -1
  34. package/lib/components/description_list/description_list_title.js +0 -1
  35. package/lib/components/description_list/description_list_title.styles.js +1 -1
  36. package/lib/components/drag_and_drop/draggable.js +17 -22
  37. package/lib/components/drag_and_drop/draggable.styles.js +62 -0
  38. package/lib/components/drag_and_drop/droppable.js +26 -22
  39. package/lib/components/drag_and_drop/droppable.styles.js +57 -0
  40. package/lib/components/search_bar/search_box.js +61 -93
  41. package/lib/components/table/table_pagination/table_pagination.js +1 -0
  42. package/lib/test/rtl/custom_render.js +2 -2
  43. package/optimize/es/components/basic_table/in_memory_table.js +62 -34
  44. package/optimize/es/components/card/card.js +3 -3
  45. package/optimize/es/components/combo_box/combo_box.js +6 -4
  46. package/optimize/es/components/combo_box/combo_box_input/combo_box_input.js +2 -1
  47. package/optimize/es/components/combo_box/combo_box_input/combo_box_pill.js +3 -1
  48. package/optimize/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +49 -12
  49. package/optimize/es/components/datagrid/controls/column_selector.js +5 -3
  50. package/optimize/es/components/datagrid/controls/column_sorting_draggable.js +4 -1
  51. package/optimize/es/components/description_list/description_list_title.js +0 -1
  52. package/optimize/es/components/description_list/description_list_title.styles.js +1 -1
  53. package/optimize/es/components/drag_and_drop/draggable.js +17 -22
  54. package/optimize/es/components/drag_and_drop/draggable.styles.js +56 -0
  55. package/optimize/es/components/drag_and_drop/droppable.js +23 -20
  56. package/optimize/es/components/drag_and_drop/droppable.styles.js +51 -0
  57. package/optimize/es/components/search_bar/search_box.js +50 -83
  58. package/optimize/es/components/table/table_pagination/table_pagination.js +1 -0
  59. package/optimize/es/test/rtl/custom_render.js +1 -1
  60. package/optimize/lib/components/basic_table/in_memory_table.js +62 -34
  61. package/optimize/lib/components/card/card.js +3 -3
  62. package/optimize/lib/components/combo_box/combo_box.js +6 -4
  63. package/optimize/lib/components/combo_box/combo_box_input/combo_box_input.js +2 -1
  64. package/optimize/lib/components/combo_box/combo_box_input/combo_box_pill.js +3 -1
  65. package/optimize/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +49 -12
  66. package/optimize/lib/components/datagrid/controls/column_selector.js +4 -2
  67. package/optimize/lib/components/datagrid/controls/column_sorting_draggable.js +4 -1
  68. package/optimize/lib/components/description_list/description_list_title.js +0 -1
  69. package/optimize/lib/components/description_list/description_list_title.styles.js +1 -1
  70. package/optimize/lib/components/drag_and_drop/draggable.js +16 -21
  71. package/optimize/lib/components/drag_and_drop/draggable.styles.js +62 -0
  72. package/optimize/lib/components/drag_and_drop/droppable.js +25 -21
  73. package/optimize/lib/components/drag_and_drop/droppable.styles.js +57 -0
  74. package/optimize/lib/components/search_bar/search_box.js +57 -89
  75. package/optimize/lib/components/table/table_pagination/table_pagination.js +1 -0
  76. package/optimize/lib/test/rtl/custom_render.js +2 -2
  77. package/package.json +4 -4
  78. package/src/components/combo_box/combo_box_input/_combo_box_pill.scss +0 -1
  79. package/src/components/index.scss +0 -1
  80. package/src/themes/amsterdam/overrides/_index.scss +0 -1
  81. package/test-env/components/basic_table/in_memory_table.js +85 -34
  82. package/test-env/components/card/card.js +3 -3
  83. package/test-env/components/combo_box/combo_box.js +16 -4
  84. package/test-env/components/combo_box/combo_box_input/combo_box_input.js +4 -1
  85. package/test-env/components/combo_box/combo_box_input/combo_box_pill.js +5 -1
  86. package/test-env/components/combo_box/combo_box_options_list/combo_box_option.js +2 -0
  87. package/test-env/components/combo_box/combo_box_options_list/combo_box_options_list.js +58 -14
  88. package/test-env/components/datagrid/controls/column_selector.js +4 -2
  89. package/test-env/components/datagrid/controls/column_sorting_draggable.js +4 -1
  90. package/test-env/components/description_list/description_list_title.js +0 -1
  91. package/test-env/components/description_list/description_list_title.styles.js +1 -1
  92. package/test-env/components/drag_and_drop/draggable.js +17 -22
  93. package/test-env/components/drag_and_drop/draggable.styles.js +62 -0
  94. package/test-env/components/drag_and_drop/droppable.js +26 -22
  95. package/test-env/components/drag_and_drop/droppable.styles.js +57 -0
  96. package/test-env/components/search_bar/search_box.js +60 -88
  97. package/test-env/components/table/table_pagination/table_pagination.js +1 -0
  98. package/test-env/test/rtl/custom_render.js +2 -2
  99. package/src/components/drag_and_drop/_draggable.scss +0 -41
  100. package/src/components/drag_and_drop/_droppable.scss +0 -40
  101. package/src/components/drag_and_drop/_index.scss +0 -3
  102. package/src/components/drag_and_drop/_variables.scss +0 -5
  103. package/src/themes/amsterdam/overrides/_description_list.scss +0 -7
@@ -1,5 +1,6 @@
1
- var _excluded = ["onChange"],
2
- _excluded2 = ["columns", "loading", "message", "error", "selection", "isSelectable", "hasActions", "compressed", "pagination", "sorting", "itemIdToExpandedRowMap", "itemId", "rowProps", "cellProps", "tableLayout", "items", "search", "onTableChange", "executeQueryOptions", "allowNeutralSort", "childrenBetween"];
1
+ var _excluded = ["schema"],
2
+ _excluded2 = ["onChange"],
3
+ _excluded3 = ["columns", "loading", "message", "error", "selection", "isSelectable", "hasActions", "compressed", "pagination", "sorting", "itemIdToExpandedRowMap", "itemId", "rowProps", "cellProps", "tableLayout", "items", "search", "searchFormat", "onTableChange", "executeQueryOptions", "allowNeutralSort", "childrenBetween"];
3
4
  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); }
4
5
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
5
6
  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; }
@@ -32,7 +33,8 @@ import React, { Component } from 'react';
32
33
  import { EuiBasicTable } from './basic_table';
33
34
  import { isString } from '../../services/predicate';
34
35
  import { Comparators } from '../../services/sort';
35
- import { EuiSearchBar } from '../search_bar';
36
+ import { EuiSearchBar } from '../search_bar/search_bar';
37
+ import { EuiSearchBox } from '../search_bar/search_box';
36
38
  import { EuiSpacer } from '../spacer';
37
39
  import { euiTablePaginationDefaults } from '../table/table_pagination';
38
40
  import { EuiComponentDefaultsContext } from '../provider/component_defaults';
@@ -217,6 +219,15 @@ export var EuiInMemoryTable = /*#__PURE__*/function (_Component) {
217
219
  };
218
220
  });
219
221
  });
222
+ // Alternative to onQueryChange - allows consumers to specify they want the
223
+ // search bar to ignore EQL syntax and only use the searchbar for plain text
224
+ _defineProperty(_assertThisInitialized(_this), "onPlainTextSearch", function (searchValue) {
225
+ var escapedQueryText = searchValue.replace(/["\\]/g, '\\$&');
226
+ var finalQuery = "\"".concat(escapedQueryText, "\"");
227
+ _this.setState({
228
+ query: EuiSearchBar.Query.parse(finalQuery)
229
+ });
230
+ });
220
231
  var columns = props.columns,
221
232
  _search = props.search,
222
233
  _pagination = props.pagination,
@@ -260,12 +271,26 @@ export var EuiInMemoryTable = /*#__PURE__*/function (_Component) {
260
271
  }, {
261
272
  key: "renderSearchBar",
262
273
  value: function renderSearchBar() {
263
- var search = this.props.search;
264
- if (search) {
274
+ var _this$props = this.props,
275
+ search = _this$props.search,
276
+ searchFormat = _this$props.searchFormat;
277
+ if (!search) return;
278
+ var searchBar;
279
+ if (searchFormat === 'text') {
280
+ var _searchBoxProps = (search === null || search === void 0 ? void 0 : search.box) || {}; // Work around | boolean type
281
+ var schema = _searchBoxProps.schema,
282
+ searchBoxProps = _objectWithoutProperties(_searchBoxProps, _excluded); // Destructure `schema` so it doesn't get rendered to DOM
283
+
284
+ searchBar = ___EmotionJSX(EuiSearchBox, _extends({
285
+ query: "" // Unused, passed to satisfy Typescript
286
+ }, searchBoxProps, {
287
+ onSearch: this.onPlainTextSearch
288
+ }));
289
+ } else {
265
290
  var searchBarProps = {};
266
291
  if (isEuiSearchBarProps(search)) {
267
292
  var onChange = search.onChange,
268
- _searchBarProps = _objectWithoutProperties(search, _excluded);
293
+ _searchBarProps = _objectWithoutProperties(search, _excluded2);
269
294
  searchBarProps = _searchBarProps;
270
295
  if (searchBarProps.box && searchBarProps.box.schema === true) {
271
296
  searchBarProps.box = _objectSpread(_objectSpread({}, searchBarProps.box), {}, {
@@ -273,12 +298,13 @@ export var EuiInMemoryTable = /*#__PURE__*/function (_Component) {
273
298
  });
274
299
  }
275
300
  }
276
- return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiSearchBar, _extends({
301
+ searchBar = ___EmotionJSX(EuiSearchBar, _extends({
277
302
  onChange: this.onQueryChange
278
- }, searchBarProps)), ___EmotionJSX(EuiSpacer, {
279
- size: "l"
280
- }));
303
+ }, searchBarProps));
281
304
  }
305
+ return ___EmotionJSX(React.Fragment, null, searchBar, ___EmotionJSX(EuiSpacer, {
306
+ size: "l"
307
+ }));
282
308
  }
283
309
  }, {
284
310
  key: "resolveSearchSchema",
@@ -355,29 +381,30 @@ export var EuiInMemoryTable = /*#__PURE__*/function (_Component) {
355
381
  }, {
356
382
  key: "render",
357
383
  value: function render() {
358
- var _this$props = this.props,
359
- columns = _this$props.columns,
360
- loading = _this$props.loading,
361
- message = _this$props.message,
362
- error = _this$props.error,
363
- selection = _this$props.selection,
364
- isSelectable = _this$props.isSelectable,
365
- hasActions = _this$props.hasActions,
366
- compressed = _this$props.compressed,
367
- hasPagination = _this$props.pagination,
368
- hasSorting = _this$props.sorting,
369
- itemIdToExpandedRowMap = _this$props.itemIdToExpandedRowMap,
370
- itemId = _this$props.itemId,
371
- rowProps = _this$props.rowProps,
372
- cellProps = _this$props.cellProps,
373
- tableLayout = _this$props.tableLayout,
374
- _unuseditems = _this$props.items,
375
- search = _this$props.search,
376
- onTableChange = _this$props.onTableChange,
377
- executeQueryOptions = _this$props.executeQueryOptions,
378
- allowNeutralSort = _this$props.allowNeutralSort,
379
- childrenBetween = _this$props.childrenBetween,
380
- rest = _objectWithoutProperties(_this$props, _excluded2);
384
+ var _this$props2 = this.props,
385
+ columns = _this$props2.columns,
386
+ loading = _this$props2.loading,
387
+ message = _this$props2.message,
388
+ error = _this$props2.error,
389
+ selection = _this$props2.selection,
390
+ isSelectable = _this$props2.isSelectable,
391
+ hasActions = _this$props2.hasActions,
392
+ compressed = _this$props2.compressed,
393
+ hasPagination = _this$props2.pagination,
394
+ hasSorting = _this$props2.sorting,
395
+ itemIdToExpandedRowMap = _this$props2.itemIdToExpandedRowMap,
396
+ itemId = _this$props2.itemId,
397
+ rowProps = _this$props2.rowProps,
398
+ cellProps = _this$props2.cellProps,
399
+ tableLayout = _this$props2.tableLayout,
400
+ _unuseditems = _this$props2.items,
401
+ search = _this$props2.search,
402
+ searchFormat = _this$props2.searchFormat,
403
+ onTableChange = _this$props2.onTableChange,
404
+ executeQueryOptions = _this$props2.executeQueryOptions,
405
+ allowNeutralSort = _this$props2.allowNeutralSort,
406
+ childrenBetween = _this$props2.childrenBetween,
407
+ rest = _objectWithoutProperties(_this$props2, _excluded3);
381
408
  var _this$state3 = this.state,
382
409
  pageIndex = _this$state3.pageIndex,
383
410
  pageSize = _this$state3.pageSize,
@@ -500,7 +527,8 @@ export var EuiInMemoryTable = /*#__PURE__*/function (_Component) {
500
527
  _defineProperty(EuiInMemoryTable, "contextType", EuiComponentDefaultsContext);
501
528
  _defineProperty(EuiInMemoryTable, "defaultProps", {
502
529
  responsive: true,
503
- tableLayout: 'fixed'
530
+ tableLayout: 'fixed',
531
+ searchFormat: 'eql'
504
532
  });
505
533
  EuiInMemoryTable.propTypes = {
506
534
  className: PropTypes.string,
@@ -989,6 +1017,29 @@ EuiInMemoryTable.propTypes = {
989
1017
  "data-test-subj": PropTypes.string,
990
1018
  css: PropTypes.any
991
1019
  }).isRequired]),
1020
+ /**
1021
+ * By default, tables use `eql` format for search which allows using advanced filters.
1022
+ *
1023
+ * However, certain special characters (such as quotes, parentheses, and colons)
1024
+ * are reserved for EQL syntax and will error if used.
1025
+ * If your table does not require filter search and instead requires searching for certain
1026
+ * symbols, use a plain `text` search format instead (note that filters will be ignored
1027
+ * in this format).
1028
+ *
1029
+ * @default "eql"
1030
+ */
1031
+ /**
1032
+ * By default, tables use `eql` format for search which allows using advanced filters.
1033
+ *
1034
+ * However, certain special characters (such as quotes, parentheses, and colons)
1035
+ * are reserved for EQL syntax and will error if used.
1036
+ * If your table does not require filter search and instead requires searching for certain
1037
+ * symbols, use a plain `text` search format instead (note that filters will be ignored
1038
+ * in this format).
1039
+ *
1040
+ * @default "eql"
1041
+ */
1042
+ searchFormat: PropTypes.oneOf(["eql", "text"]),
992
1043
  /**
993
1044
  * Configures #Pagination
994
1045
  */
@@ -21,14 +21,14 @@ import React, { isValidElement } from 'react';
21
21
  import PropTypes from "prop-types";
22
22
  import classNames from 'classnames';
23
23
  import { getSecureRelForTarget, useEuiTheme, cloneElementWithCss } from '../../services';
24
+ import { useGeneratedHtmlId } from '../../services/accessibility';
25
+ import { validateHref } from '../../services/security/href_validator';
24
26
  import { EuiText } from '../text';
25
27
  import { EuiTitle } from '../title';
26
28
  import { EuiBetaBadge } from '../badge/beta_badge';
27
- import { EuiCardSelect } from './card_select';
28
- import { useGeneratedHtmlId } from '../../services/accessibility';
29
- import { validateHref } from '../../services/security/href_validator';
30
29
  import { EuiPanel } from '../panel';
31
30
  import { EuiSpacer } from '../spacer';
31
+ import { EuiCardSelect } from './card_select';
32
32
  import { euiCardBetaBadgeStyles, euiCardStyles, euiCardTextStyles } from './card.styles';
33
33
  import { jsx as ___EmotionJSX } from "@emotion/react";
34
34
  export var ALIGNMENTS = ['left', 'center', 'right'];
@@ -1,4 +1,4 @@
1
- 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"];
1
+ 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"];
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; }
@@ -34,12 +34,12 @@ import React, { Component } from 'react';
34
34
  import PropTypes from "prop-types";
35
35
  import classNames from 'classnames';
36
36
  import { findPopoverPosition, htmlIdGenerator, keys } from '../../services';
37
+ import { getElementZIndex } from '../../services/popover';
37
38
  import { EuiPortal } from '../portal';
38
39
  import { EuiI18n } from '../i18n';
39
- import { EuiComboBoxOptionsList } from './combo_box_options_list';
40
40
  import { getMatchingOptions, flattenOptionGroups, getSelectedOptionForSearchValue, transformForCaseSensitivity } from './matching_options';
41
41
  import { EuiComboBoxInput } from './combo_box_input/combo_box_input';
42
- import { getElementZIndex } from '../../services/popover';
42
+ import { EuiComboBoxOptionsList } from './combo_box_options_list';
43
43
 
44
44
  /**
45
45
  * Because of how TypeScript's LibraryManagedAttributes is designed to handle defaultProps (https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-0.html#support-for-defaultprops-in-jsx)
@@ -641,6 +641,7 @@ export var EuiComboBox = /*#__PURE__*/function (_Component) {
641
641
  delimiter = _this$props8.delimiter,
642
642
  append = _this$props8.append,
643
643
  autoFocus = _this$props8.autoFocus,
644
+ truncationProps = _this$props8.truncationProps,
644
645
  ariaLabel = _this$props8['aria-label'],
645
646
  ariaLabelledby = _this$props8['aria-labelledby'],
646
647
  rest = _objectWithoutProperties(_this$props8, _excluded);
@@ -709,7 +710,8 @@ export var EuiComboBox = /*#__PURE__*/function (_Component) {
709
710
  width: width,
710
711
  delimiter: delimiter,
711
712
  getSelectedOptionForSearchValue: getSelectedOptionForSearchValue,
712
- listboxAriaLabel: listboxAriaLabel
713
+ listboxAriaLabel: listboxAriaLabel,
714
+ truncationProps: truncationProps
713
715
  });
714
716
  }));
715
717
  }
@@ -905,5 +907,15 @@ EuiComboBox.propTypes = {
905
907
  * supplied by `aria-label` or from [EuiFormRow](/#/forms/form-layouts).
906
908
  */
907
909
  "aria-labelledby": PropTypes.string,
910
+ /**
911
+ * By default, EuiComboBox will truncate option labels at the end of
912
+ * the string. You can use pass in a custom truncation configuration that
913
+ * accepts any prop that [EuiTextTruncate](/#/utilities/text-truncate) prop
914
+ * except for `text` and `children`.
915
+ *
916
+ * Note: when searching, custom truncation props are ignored. The highlighted search
917
+ * text will always take precedence.
918
+ */
919
+ truncationProps: PropTypes.any,
908
920
  css: PropTypes.any
909
921
  };
@@ -1,4 +1,4 @@
1
- var _excluded = ["key", "label", "color", "onClick", "append", "prepend"];
1
+ var _excluded = ["key", "label", "color", "onClick", "append", "prepend", "truncationProps"];
2
2
  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
3
  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
4
  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; }
@@ -154,6 +154,7 @@ export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
154
154
  onClick = option.onClick,
155
155
  append = option.append,
156
156
  prepend = option.prepend,
157
+ truncationProps = option.truncationProps,
157
158
  rest = _objectWithoutProperties(option, _excluded);
158
159
  var pillOnClose = isDisabled || singleSelection || onClick ? undefined : onRemoveOption;
159
160
  return ___EmotionJSX(EuiComboBoxPill, _extends({
@@ -298,6 +299,7 @@ EuiComboBoxInput.propTypes = {
298
299
  value: PropTypes.any,
299
300
  prepend: PropTypes.node,
300
301
  append: PropTypes.node,
302
+ truncationProps: PropTypes.any,
301
303
  className: PropTypes.string,
302
304
  "aria-label": PropTypes.string,
303
305
  "data-test-subj": PropTypes.string,
@@ -306,6 +308,7 @@ EuiComboBoxInput.propTypes = {
306
308
  value: PropTypes.any,
307
309
  prepend: PropTypes.node,
308
310
  append: PropTypes.node,
311
+ truncationProps: PropTypes.any,
309
312
  className: PropTypes.string,
310
313
  "aria-label": PropTypes.string,
311
314
  "data-test-subj": PropTypes.string,
@@ -73,7 +73,9 @@ export var EuiComboBoxPill = /*#__PURE__*/function (_Component) {
73
73
  } : {};
74
74
  var content = ___EmotionJSX(React.Fragment, null, option.prepend && ___EmotionJSX("span", {
75
75
  className: "euiComboBoxPill__prepend"
76
- }, option.prepend), children, option.append && ___EmotionJSX("span", {
76
+ }, option.prepend), ___EmotionJSX("span", {
77
+ className: "eui-textTruncate"
78
+ }, children), option.append && ___EmotionJSX("span", {
77
79
  className: "euiComboBoxPill__append"
78
80
  }, option.append));
79
81
  if (onClose) {
@@ -135,6 +137,7 @@ EuiComboBoxPill.propTypes = {
135
137
  value: PropTypes.any,
136
138
  prepend: PropTypes.node,
137
139
  append: PropTypes.node,
140
+ truncationProps: PropTypes.any,
138
141
  className: PropTypes.string,
139
142
  "aria-label": PropTypes.string,
140
143
  "data-test-subj": PropTypes.string,
@@ -143,6 +146,7 @@ EuiComboBoxPill.propTypes = {
143
146
  value: PropTypes.any,
144
147
  prepend: PropTypes.node,
145
148
  append: PropTypes.node,
149
+ truncationProps: PropTypes.any,
146
150
  className: PropTypes.string,
147
151
  "aria-label": PropTypes.string,
148
152
  "data-test-subj": PropTypes.string,
@@ -117,6 +117,7 @@ EuiComboBoxOption.propTypes = {
117
117
  value: PropTypes.any,
118
118
  prepend: PropTypes.node,
119
119
  append: PropTypes.node,
120
+ truncationProps: PropTypes.any,
120
121
  className: PropTypes.string,
121
122
  "aria-label": PropTypes.string,
122
123
  "data-test-subj": PropTypes.string,
@@ -125,6 +126,7 @@ EuiComboBoxOption.propTypes = {
125
126
  value: PropTypes.any,
126
127
  prepend: PropTypes.node,
127
128
  append: PropTypes.node,
129
+ truncationProps: PropTypes.any,
128
130
  className: PropTypes.string,
129
131
  "aria-label": PropTypes.string,
130
132
  "data-test-subj": PropTypes.string,
@@ -1,9 +1,9 @@
1
- var _excluded = ["key", "isGroupLabelOption", "label", "value", "prepend", "append"],
2
- _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"];
1
+ var _excluded = ["key", "isGroupLabelOption", "label", "value", "prepend", "append", "truncationProps"],
2
+ _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"];
3
3
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
5
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
6
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
- function _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); }
7
7
  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; }
8
8
  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; }
9
9
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -33,6 +33,7 @@ import classNames from 'classnames';
33
33
  import { FixedSizeList } from 'react-window';
34
34
  import { EuiFlexGroup, EuiFlexItem } from '../../flex';
35
35
  import { EuiHighlight } from '../../highlight';
36
+ import { EuiMark } from '../../mark';
36
37
  import { EuiText } from '../../text';
37
38
  import { EuiLoadingSpinner } from '../../loading';
38
39
  import { EuiComboBoxTitle } from './combo_box_title';
@@ -40,8 +41,8 @@ import { EuiI18n } from '../../i18n';
40
41
  import { EuiFilterSelectItem } from '../../filter_group/filter_select_item';
41
42
  import { EuiBadge } from '../../badge';
42
43
  import { EuiPopoverPanel } from '../../popover/popover_panel';
44
+ import { EuiTextTruncate } from '../../text_truncate';
43
45
  import { jsx as ___EmotionJSX } from "@emotion/react";
44
- var OPTION_CONTENT_CLASSNAME = 'euiComboBoxOption__content';
45
46
  var hitEnterBadge = ___EmotionJSX(EuiBadge, {
46
47
  className: "euiComboBoxOption__enterBadge",
47
48
  color: "hollow",
@@ -102,6 +103,7 @@ export var EuiComboBoxOptionsList = /*#__PURE__*/function (_Component) {
102
103
  value = option.value,
103
104
  prepend = option.prepend,
104
105
  append = option.append,
106
+ _truncationProps = option.truncationProps,
105
107
  rest = _objectWithoutProperties(option, _excluded);
106
108
  var _this$props = _this.props,
107
109
  singleSelection = _this$props.singleSelection,
@@ -112,6 +114,8 @@ export var EuiComboBoxOptionsList = /*#__PURE__*/function (_Component) {
112
114
  renderOption = _this$props.renderOption,
113
115
  searchValue = _this$props.searchValue,
114
116
  rootId = _this$props.rootId;
117
+ // Individual truncation settings should override component prop
118
+ var truncationProps = _objectSpread(_objectSpread({}, _this.props.truncationProps), _truncationProps);
115
119
  if (isGroupLabelOption) {
116
120
  return ___EmotionJSX("div", {
117
121
  key: key !== null && key !== void 0 ? key : label,
@@ -136,22 +140,54 @@ export var EuiComboBoxOptionsList = /*#__PURE__*/function (_Component) {
136
140
  isFocused: optionIsFocused,
137
141
  checked: checked,
138
142
  showIcons: singleSelection ? true : false,
139
- id: rootId("_option-".concat(index)),
140
- title: label
143
+ id: rootId("_option-".concat(index))
141
144
  }, rest), ___EmotionJSX("span", {
142
145
  className: "euiComboBoxOption__contentWrapper"
143
146
  }, prepend && ___EmotionJSX("span", {
144
147
  className: "euiComboBoxOption__prepend"
145
- }, prepend), renderOption ? ___EmotionJSX("span", {
146
- className: OPTION_CONTENT_CLASSNAME
147
- }, renderOption(option, searchValue, 'euiComboBoxOption__renderOption')) : ___EmotionJSX(EuiHighlight, {
148
- search: searchValue,
149
- strict: _this.props.isCaseSensitive,
150
- className: OPTION_CONTENT_CLASSNAME
151
- }, label), append && ___EmotionJSX("span", {
148
+ }, prepend), ___EmotionJSX("span", {
149
+ className: "euiComboBoxOption__content"
150
+ }, renderOption ? renderOption(option, searchValue, 'euiComboBoxOption__renderOption') : _this.renderTruncatedOption(label, truncationProps)), append && ___EmotionJSX("span", {
152
151
  className: "euiComboBoxOption__append"
153
152
  }, append), optionIsFocused && !optionIsDisabled ? hitEnterBadge : null));
154
153
  });
154
+ _defineProperty(_assertThisInitialized(_this), "optionWidth", void 0);
155
+ _defineProperty(_assertThisInitialized(_this), "setOptionWidth", function (width) {
156
+ _this.optionWidth = width;
157
+ });
158
+ _defineProperty(_assertThisInitialized(_this), "renderTruncatedOption", function (text, truncationProps) {
159
+ if (!_this.props.searchValue) {
160
+ return ___EmotionJSX(EuiTextTruncate, _extends({
161
+ truncation: "end",
162
+ width: _this.optionWidth,
163
+ onResize: _this.setOptionWidth
164
+ }, truncationProps, {
165
+ text: text
166
+ }), function (text) {
167
+ return text;
168
+ });
169
+ }
170
+ var searchValue = _this.props.searchValue.trim();
171
+ var searchPositionStart = _this.props.isCaseSensitive ? text.indexOf(searchValue) : text.toLowerCase().indexOf(searchValue.toLowerCase());
172
+ var searchPositionCenter = searchPositionStart + Math.floor(searchValue.length / 2);
173
+ return ___EmotionJSX(EuiTextTruncate, _extends({
174
+ width: _this.optionWidth,
175
+ onResize: _this.setOptionWidth
176
+ }, truncationProps, {
177
+ // When searching, don't allow overriding the truncation settings
178
+ truncation: "startEnd",
179
+ truncationPosition: searchPositionCenter,
180
+ text: text
181
+ }), function (text) {
182
+ return ___EmotionJSX(React.Fragment, null, text.length >= searchValue.length ? ___EmotionJSX(EuiHighlight, {
183
+ search: searchValue,
184
+ strict: _this.props.isCaseSensitive
185
+ }, text) :
186
+ // If the available truncated text is shorter than the full search string,
187
+ // just highlight the entire truncated text
188
+ ___EmotionJSX(EuiMark, null, text));
189
+ });
190
+ });
155
191
  return _this;
156
192
  }
157
193
  _createClass(EuiComboBoxOptionsList, [{
@@ -235,6 +271,7 @@ export var EuiComboBoxOptionsList = /*#__PURE__*/function (_Component) {
235
271
  delimiter = _this$props2.delimiter,
236
272
  zIndex = _this$props2.zIndex,
237
273
  style = _this$props2.style,
274
+ truncationProps = _this$props2.truncationProps,
238
275
  listboxAriaLabel = _this$props2.listboxAriaLabel,
239
276
  rest = _objectWithoutProperties(_this$props2, _excluded2);
240
277
  var emptyStateContent;
@@ -379,7 +416,7 @@ _defineProperty(EuiComboBoxOptionsList, "defaultProps", {
379
416
  EuiComboBoxOptionsList.propTypes = {
380
417
  className: PropTypes.string,
381
418
  "aria-label": PropTypes.string,
382
- "data-test-subj": PropTypes.oneOfType([PropTypes.string, PropTypes.string.isRequired]),
419
+ "data-test-subj": PropTypes.string,
383
420
  css: PropTypes.any,
384
421
  activeOptionIndex: PropTypes.number,
385
422
  areAllOptionsSelected: PropTypes.bool,
@@ -406,6 +443,7 @@ EuiComboBoxOptionsList.propTypes = {
406
443
  value: PropTypes.any,
407
444
  prepend: PropTypes.node,
408
445
  append: PropTypes.node,
446
+ truncationProps: PropTypes.any,
409
447
  className: PropTypes.string,
410
448
  "aria-label": PropTypes.string,
411
449
  "data-test-subj": PropTypes.string,
@@ -414,6 +452,7 @@ EuiComboBoxOptionsList.propTypes = {
414
452
  value: PropTypes.any,
415
453
  prepend: PropTypes.node,
416
454
  append: PropTypes.node,
455
+ truncationProps: PropTypes.any,
417
456
  className: PropTypes.string,
418
457
  "aria-label": PropTypes.string,
419
458
  "data-test-subj": PropTypes.string,
@@ -440,6 +479,7 @@ EuiComboBoxOptionsList.propTypes = {
440
479
  value: PropTypes.any,
441
480
  prepend: PropTypes.node,
442
481
  append: PropTypes.node,
482
+ truncationProps: PropTypes.any,
443
483
  className: PropTypes.string,
444
484
  "aria-label": PropTypes.string,
445
485
  "data-test-subj": PropTypes.string,
@@ -448,6 +488,7 @@ EuiComboBoxOptionsList.propTypes = {
448
488
  value: PropTypes.any,
449
489
  prepend: PropTypes.node,
450
490
  append: PropTypes.node,
491
+ truncationProps: PropTypes.any,
451
492
  className: PropTypes.string,
452
493
  "aria-label": PropTypes.string,
453
494
  "data-test-subj": PropTypes.string,
@@ -471,6 +512,7 @@ EuiComboBoxOptionsList.propTypes = {
471
512
  value: PropTypes.any,
472
513
  prepend: PropTypes.node,
473
514
  append: PropTypes.node,
515
+ truncationProps: PropTypes.any,
474
516
  className: PropTypes.string,
475
517
  "aria-label": PropTypes.string,
476
518
  "data-test-subj": PropTypes.string,
@@ -479,6 +521,7 @@ EuiComboBoxOptionsList.propTypes = {
479
521
  value: PropTypes.any,
480
522
  prepend: PropTypes.node,
481
523
  append: PropTypes.node,
524
+ truncationProps: PropTypes.any,
482
525
  className: PropTypes.string,
483
526
  "aria-label": PropTypes.string,
484
527
  "data-test-subj": PropTypes.string,
@@ -490,5 +533,6 @@ EuiComboBoxOptionsList.propTypes = {
490
533
  asPlainText: PropTypes.bool
491
534
  }).isRequired]),
492
535
  delimiter: PropTypes.string,
493
- zIndex: PropTypes.number
536
+ zIndex: PropTypes.number,
537
+ truncationProps: PropTypes.any
494
538
  };
@@ -17,7 +17,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
17
  * Side Public License, v 1.
18
18
  */
19
19
 
20
- import React, { Fragment, useState, useMemo, useCallback } from 'react';
20
+ import React, { useState, useMemo, useCallback } from 'react';
21
21
  import classNames from 'classnames';
22
22
  import { EuiPopover, EuiPopoverFooter, EuiPopoverTitle } from '../../popover';
23
23
  import { EuiI18n, useEuiI18n } from '../../i18n';
@@ -145,7 +145,7 @@ export var useDataGridColumnSelector = function useDataGridColumnSelector(availa
145
145
  }, ___EmotionJSX(EuiDroppable, {
146
146
  droppableId: "columnOrder",
147
147
  isDropDisabled: !isDragEnabled
148
- }, ___EmotionJSX(Fragment, null, filteredColumns.map(function (id, index) {
148
+ }, ___EmotionJSX(React.Fragment, null, filteredColumns.map(function (id, index) {
149
149
  return ___EmotionJSX(EuiDraggable, {
150
150
  key: id,
151
151
  draggableId: id,
@@ -155,7 +155,9 @@ export var useDataGridColumnSelector = function useDataGridColumnSelector(availa
155
155
  customDragHandle: true
156
156
  }, function (provided, state) {
157
157
  return ___EmotionJSX("div", {
158
- className: "euiDataGridColumnSelector__item ".concat(state.isDragging && 'euiDataGridColumnSelector__item-isDragging'),
158
+ className: classNames('euiDataGridColumnSelector__item', {
159
+ 'euiDataGridColumnSelector__item-isDragging': state.isDragging
160
+ }),
159
161
  "data-test-subj": "dataGridColumnSelectorColumnItem-".concat(id)
160
162
  }, ___EmotionJSX(EuiFlexGroup, {
161
163
  responsive: false,
@@ -18,6 +18,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
18
18
 
19
19
  import React from 'react';
20
20
  import PropTypes from "prop-types";
21
+ import classNames from 'classnames';
21
22
  import { EuiScreenReaderOnly } from '../../accessibility';
22
23
  import { EuiButtonGroup, EuiButtonIcon } from '../../button';
23
24
  import { EuiDraggable } from '../../drag_and_drop';
@@ -67,7 +68,9 @@ export var EuiDataGridColumnSortingDraggable = function EuiDataGridColumnSorting
67
68
  customDragHandle: true
68
69
  }, rest), function (provided, state) {
69
70
  return ___EmotionJSX("div", {
70
- className: "euiDataGridColumnSorting__item ".concat(state.isDragging && 'euiDataGridColumnSorting__item-isDragging')
71
+ className: classNames('euiDataGridColumnSorting__item', {
72
+ 'euiDataGridColumnSorting__item-isDragging': state.isDragging
73
+ })
71
74
  }, ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("p", null, ___EmotionJSX(EuiI18n, {
72
75
  token: "euiColumnSortingDraggable.activeSortLabel",
73
76
  default: "{display} is sorting this data grid",
@@ -41,7 +41,6 @@ export var EuiDescriptionListTitle = function EuiDescriptionListTitle(_ref) {
41
41
  switch (type) {
42
42
  case 'inline':
43
43
  conditionalStyles = compressed ? [styles.inlineStyles.compressed] : [styles.inlineStyles.normal];
44
- conditionalStyles.push(styles[rowGutterSize]);
45
44
  break;
46
45
  case 'row':
47
46
  conditionalStyles.push(styles[rowGutterSize]);
@@ -27,7 +27,7 @@ export var euiDescriptionListTitleStyles = function euiDescriptionListTitleStyle
27
27
  // Inline types
28
28
  inlineStyles: {
29
29
  normal: /*#__PURE__*/css(euiFontSize(euiThemeContext, 's'), " ", logicalCSS('padding-vertical', '1px'), " ", logicalCSS('padding-horizontal', euiTheme.size.xs), ";;label:normal;"),
30
- compressed: /*#__PURE__*/css(euiFontSize(euiThemeContext, 'xs'), " ", logicalCSS('padding-vertical', '0'), " ", logicalCSS('padding-horizontal', euiTheme.size.xs), ";;label:compressed;")
30
+ compressed: /*#__PURE__*/css("font-size:", euiFontSize(euiThemeContext, 'xs').fontSize, ";line-height:", euiTheme.font.lineHeightMultiplier, ";", logicalCSS('padding-vertical', '0'), " ", logicalCSS('padding-horizontal', euiTheme.size.xs), ";;label:compressed;")
31
31
  },
32
32
  // Alignment
33
33
  right: /*#__PURE__*/css(logicalTextAlignCSS('right'), ";;label:right;"),