@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
@@ -19,14 +19,14 @@ var _react = _interopRequireWildcard(require("react"));
19
19
  var _propTypes = _interopRequireDefault(require("prop-types"));
20
20
  var _classnames = _interopRequireDefault(require("classnames"));
21
21
  var _services = require("../../services");
22
+ var _popover = require("../../services/popover");
22
23
  var _portal = require("../portal");
23
24
  var _i18n = require("../i18n");
24
- var _combo_box_options_list = require("./combo_box_options_list");
25
25
  var _matching_options = require("./matching_options");
26
26
  var _combo_box_input = require("./combo_box_input/combo_box_input");
27
- var _popover = require("../../services/popover");
27
+ var _combo_box_options_list = require("./combo_box_options_list");
28
28
  var _react2 = require("@emotion/react");
29
- 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"];
29
+ 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"];
30
30
  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); }
31
31
  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; }
32
32
  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; }
@@ -640,6 +640,7 @@ var EuiComboBox = /*#__PURE__*/function (_Component) {
640
640
  delimiter = _this$props8.delimiter,
641
641
  append = _this$props8.append,
642
642
  autoFocus = _this$props8.autoFocus,
643
+ truncationProps = _this$props8.truncationProps,
643
644
  ariaLabel = _this$props8['aria-label'],
644
645
  ariaLabelledby = _this$props8['aria-labelledby'],
645
646
  rest = (0, _objectWithoutProperties2.default)(_this$props8, _excluded);
@@ -708,7 +709,8 @@ var EuiComboBox = /*#__PURE__*/function (_Component) {
708
709
  width: width,
709
710
  delimiter: delimiter,
710
711
  getSelectedOptionForSearchValue: _matching_options.getSelectedOptionForSearchValue,
711
- listboxAriaLabel: listboxAriaLabel
712
+ listboxAriaLabel: listboxAriaLabel,
713
+ truncationProps: truncationProps
712
714
  });
713
715
  }));
714
716
  }
@@ -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.default.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.default.any,
908
920
  css: _propTypes.default.any
909
921
  };
@@ -26,7 +26,7 @@ var _form_control_layout = require("../../form/form_control_layout");
26
26
  var _num_icons = require("../../form/form_control_layout/_num_icons");
27
27
  var _combo_box_pill = require("./combo_box_pill");
28
28
  var _react2 = require("@emotion/react");
29
- var _excluded = ["key", "label", "color", "onClick", "append", "prepend"];
29
+ var _excluded = ["key", "label", "color", "onClick", "append", "prepend", "truncationProps"];
30
30
  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); }
31
31
  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; }
32
32
  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); }; }
@@ -157,6 +157,7 @@ var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
157
157
  onClick = option.onClick,
158
158
  append = option.append,
159
159
  prepend = option.prepend,
160
+ truncationProps = option.truncationProps,
160
161
  rest = (0, _objectWithoutProperties2.default)(option, _excluded);
161
162
  var pillOnClose = isDisabled || singleSelection || onClick ? undefined : onRemoveOption;
162
163
  return (0, _react2.jsx)(_combo_box_pill.EuiComboBoxPill, (0, _extends2.default)({
@@ -302,6 +303,7 @@ EuiComboBoxInput.propTypes = {
302
303
  value: _propTypes.default.any,
303
304
  prepend: _propTypes.default.node,
304
305
  append: _propTypes.default.node,
306
+ truncationProps: _propTypes.default.any,
305
307
  className: _propTypes.default.string,
306
308
  "aria-label": _propTypes.default.string,
307
309
  "data-test-subj": _propTypes.default.string,
@@ -310,6 +312,7 @@ EuiComboBoxInput.propTypes = {
310
312
  value: _propTypes.default.any,
311
313
  prepend: _propTypes.default.node,
312
314
  append: _propTypes.default.node,
315
+ truncationProps: _propTypes.default.any,
313
316
  className: _propTypes.default.string,
314
317
  "aria-label": _propTypes.default.string,
315
318
  "data-test-subj": _propTypes.default.string,
@@ -75,7 +75,9 @@ var EuiComboBoxPill = /*#__PURE__*/function (_Component) {
75
75
  } : {};
76
76
  var content = (0, _react2.jsx)(_react.default.Fragment, null, option.prepend && (0, _react2.jsx)("span", {
77
77
  className: "euiComboBoxPill__prepend"
78
- }, option.prepend), children, option.append && (0, _react2.jsx)("span", {
78
+ }, option.prepend), (0, _react2.jsx)("span", {
79
+ className: "eui-textTruncate"
80
+ }, children), option.append && (0, _react2.jsx)("span", {
79
81
  className: "euiComboBoxPill__append"
80
82
  }, option.append));
81
83
  if (onClose) {
@@ -138,6 +140,7 @@ EuiComboBoxPill.propTypes = {
138
140
  value: _propTypes.default.any,
139
141
  prepend: _propTypes.default.node,
140
142
  append: _propTypes.default.node,
143
+ truncationProps: _propTypes.default.any,
141
144
  className: _propTypes.default.string,
142
145
  "aria-label": _propTypes.default.string,
143
146
  "data-test-subj": _propTypes.default.string,
@@ -146,6 +149,7 @@ EuiComboBoxPill.propTypes = {
146
149
  value: _propTypes.default.any,
147
150
  prepend: _propTypes.default.node,
148
151
  append: _propTypes.default.node,
152
+ truncationProps: _propTypes.default.any,
149
153
  className: _propTypes.default.string,
150
154
  "aria-label": _propTypes.default.string,
151
155
  "data-test-subj": _propTypes.default.string,
@@ -120,6 +120,7 @@ EuiComboBoxOption.propTypes = {
120
120
  value: _propTypes.default.any,
121
121
  prepend: _propTypes.default.node,
122
122
  append: _propTypes.default.node,
123
+ truncationProps: _propTypes.default.any,
123
124
  className: _propTypes.default.string,
124
125
  "aria-label": _propTypes.default.string,
125
126
  "data-test-subj": _propTypes.default.string,
@@ -128,6 +129,7 @@ EuiComboBoxOption.propTypes = {
128
129
  value: _propTypes.default.any,
129
130
  prepend: _propTypes.default.node,
130
131
  append: _propTypes.default.node,
132
+ truncationProps: _propTypes.default.any,
131
133
  className: _propTypes.default.string,
132
134
  "aria-label": _propTypes.default.string,
133
135
  "data-test-subj": _propTypes.default.string,
@@ -21,6 +21,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
21
21
  var _reactWindow = require("react-window");
22
22
  var _flex = require("../../flex");
23
23
  var _highlight = require("../../highlight");
24
+ var _mark = require("../../mark");
24
25
  var _text = require("../../text");
25
26
  var _loading = require("../../loading");
26
27
  var _combo_box_title = require("./combo_box_title");
@@ -28,9 +29,10 @@ var _i18n = require("../../i18n");
28
29
  var _filter_select_item = require("../../filter_group/filter_select_item");
29
30
  var _badge = require("../../badge");
30
31
  var _popover_panel = require("../../popover/popover_panel");
32
+ var _text_truncate = require("../../text_truncate");
31
33
  var _react2 = require("@emotion/react");
32
- var _excluded = ["key", "isGroupLabelOption", "label", "value", "prepend", "append"],
33
- _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"];
34
+ var _excluded = ["key", "isGroupLabelOption", "label", "value", "prepend", "append", "truncationProps"],
35
+ _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"];
34
36
  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); }
35
37
  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; }
36
38
  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; }
@@ -43,7 +45,6 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
43
45
  * in compliance with, at your election, the Elastic License 2.0 or the Server
44
46
  * Side Public License, v 1.
45
47
  */
46
- var OPTION_CONTENT_CLASSNAME = 'euiComboBoxOption__content';
47
48
  var hitEnterBadge = (0, _react2.jsx)(_badge.EuiBadge, {
48
49
  className: "euiComboBoxOption__enterBadge",
49
50
  color: "hollow",
@@ -104,6 +105,7 @@ var EuiComboBoxOptionsList = /*#__PURE__*/function (_Component) {
104
105
  value = option.value,
105
106
  prepend = option.prepend,
106
107
  append = option.append,
108
+ _truncationProps = option.truncationProps,
107
109
  rest = (0, _objectWithoutProperties2.default)(option, _excluded);
108
110
  var _this$props = _this.props,
109
111
  singleSelection = _this$props.singleSelection,
@@ -114,6 +116,8 @@ var EuiComboBoxOptionsList = /*#__PURE__*/function (_Component) {
114
116
  renderOption = _this$props.renderOption,
115
117
  searchValue = _this$props.searchValue,
116
118
  rootId = _this$props.rootId;
119
+ // Individual truncation settings should override component prop
120
+ var truncationProps = _objectSpread(_objectSpread({}, _this.props.truncationProps), _truncationProps);
117
121
  if (isGroupLabelOption) {
118
122
  return (0, _react2.jsx)("div", {
119
123
  key: key !== null && key !== void 0 ? key : label,
@@ -138,22 +142,54 @@ var EuiComboBoxOptionsList = /*#__PURE__*/function (_Component) {
138
142
  isFocused: optionIsFocused,
139
143
  checked: checked,
140
144
  showIcons: singleSelection ? true : false,
141
- id: rootId("_option-".concat(index)),
142
- title: label
145
+ id: rootId("_option-".concat(index))
143
146
  }, rest), (0, _react2.jsx)("span", {
144
147
  className: "euiComboBoxOption__contentWrapper"
145
148
  }, prepend && (0, _react2.jsx)("span", {
146
149
  className: "euiComboBoxOption__prepend"
147
- }, prepend), renderOption ? (0, _react2.jsx)("span", {
148
- className: OPTION_CONTENT_CLASSNAME
149
- }, renderOption(option, searchValue, 'euiComboBoxOption__renderOption')) : (0, _react2.jsx)(_highlight.EuiHighlight, {
150
- search: searchValue,
151
- strict: _this.props.isCaseSensitive,
152
- className: OPTION_CONTENT_CLASSNAME
153
- }, label), append && (0, _react2.jsx)("span", {
150
+ }, prepend), (0, _react2.jsx)("span", {
151
+ className: "euiComboBoxOption__content"
152
+ }, renderOption ? renderOption(option, searchValue, 'euiComboBoxOption__renderOption') : _this.renderTruncatedOption(label, truncationProps)), append && (0, _react2.jsx)("span", {
154
153
  className: "euiComboBoxOption__append"
155
154
  }, append), optionIsFocused && !optionIsDisabled ? hitEnterBadge : null));
156
155
  });
156
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "optionWidth", void 0);
157
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setOptionWidth", function (width) {
158
+ _this.optionWidth = width;
159
+ });
160
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderTruncatedOption", function (text, truncationProps) {
161
+ if (!_this.props.searchValue) {
162
+ return (0, _react2.jsx)(_text_truncate.EuiTextTruncate, (0, _extends2.default)({
163
+ truncation: "end",
164
+ width: _this.optionWidth,
165
+ onResize: _this.setOptionWidth
166
+ }, truncationProps, {
167
+ text: text
168
+ }), function (text) {
169
+ return text;
170
+ });
171
+ }
172
+ var searchValue = _this.props.searchValue.trim();
173
+ var searchPositionStart = _this.props.isCaseSensitive ? text.indexOf(searchValue) : text.toLowerCase().indexOf(searchValue.toLowerCase());
174
+ var searchPositionCenter = searchPositionStart + Math.floor(searchValue.length / 2);
175
+ return (0, _react2.jsx)(_text_truncate.EuiTextTruncate, (0, _extends2.default)({
176
+ width: _this.optionWidth,
177
+ onResize: _this.setOptionWidth
178
+ }, truncationProps, {
179
+ // When searching, don't allow overriding the truncation settings
180
+ truncation: "startEnd",
181
+ truncationPosition: searchPositionCenter,
182
+ text: text
183
+ }), function (text) {
184
+ return (0, _react2.jsx)(_react.default.Fragment, null, text.length >= searchValue.length ? (0, _react2.jsx)(_highlight.EuiHighlight, {
185
+ search: searchValue,
186
+ strict: _this.props.isCaseSensitive
187
+ }, text) :
188
+ // If the available truncated text is shorter than the full search string,
189
+ // just highlight the entire truncated text
190
+ (0, _react2.jsx)(_mark.EuiMark, null, text));
191
+ });
192
+ });
157
193
  return _this;
158
194
  }
159
195
  (0, _createClass2.default)(EuiComboBoxOptionsList, [{
@@ -237,6 +273,7 @@ var EuiComboBoxOptionsList = /*#__PURE__*/function (_Component) {
237
273
  delimiter = _this$props2.delimiter,
238
274
  zIndex = _this$props2.zIndex,
239
275
  style = _this$props2.style,
276
+ truncationProps = _this$props2.truncationProps,
240
277
  listboxAriaLabel = _this$props2.listboxAriaLabel,
241
278
  rest = (0, _objectWithoutProperties2.default)(_this$props2, _excluded2);
242
279
  var emptyStateContent;
@@ -382,7 +419,7 @@ exports.EuiComboBoxOptionsList = EuiComboBoxOptionsList;
382
419
  EuiComboBoxOptionsList.propTypes = {
383
420
  className: _propTypes.default.string,
384
421
  "aria-label": _propTypes.default.string,
385
- "data-test-subj": _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.string.isRequired]),
422
+ "data-test-subj": _propTypes.default.string,
386
423
  css: _propTypes.default.any,
387
424
  activeOptionIndex: _propTypes.default.number,
388
425
  areAllOptionsSelected: _propTypes.default.bool,
@@ -409,6 +446,7 @@ EuiComboBoxOptionsList.propTypes = {
409
446
  value: _propTypes.default.any,
410
447
  prepend: _propTypes.default.node,
411
448
  append: _propTypes.default.node,
449
+ truncationProps: _propTypes.default.any,
412
450
  className: _propTypes.default.string,
413
451
  "aria-label": _propTypes.default.string,
414
452
  "data-test-subj": _propTypes.default.string,
@@ -417,6 +455,7 @@ EuiComboBoxOptionsList.propTypes = {
417
455
  value: _propTypes.default.any,
418
456
  prepend: _propTypes.default.node,
419
457
  append: _propTypes.default.node,
458
+ truncationProps: _propTypes.default.any,
420
459
  className: _propTypes.default.string,
421
460
  "aria-label": _propTypes.default.string,
422
461
  "data-test-subj": _propTypes.default.string,
@@ -443,6 +482,7 @@ EuiComboBoxOptionsList.propTypes = {
443
482
  value: _propTypes.default.any,
444
483
  prepend: _propTypes.default.node,
445
484
  append: _propTypes.default.node,
485
+ truncationProps: _propTypes.default.any,
446
486
  className: _propTypes.default.string,
447
487
  "aria-label": _propTypes.default.string,
448
488
  "data-test-subj": _propTypes.default.string,
@@ -451,6 +491,7 @@ EuiComboBoxOptionsList.propTypes = {
451
491
  value: _propTypes.default.any,
452
492
  prepend: _propTypes.default.node,
453
493
  append: _propTypes.default.node,
494
+ truncationProps: _propTypes.default.any,
454
495
  className: _propTypes.default.string,
455
496
  "aria-label": _propTypes.default.string,
456
497
  "data-test-subj": _propTypes.default.string,
@@ -474,6 +515,7 @@ EuiComboBoxOptionsList.propTypes = {
474
515
  value: _propTypes.default.any,
475
516
  prepend: _propTypes.default.node,
476
517
  append: _propTypes.default.node,
518
+ truncationProps: _propTypes.default.any,
477
519
  className: _propTypes.default.string,
478
520
  "aria-label": _propTypes.default.string,
479
521
  "data-test-subj": _propTypes.default.string,
@@ -482,6 +524,7 @@ EuiComboBoxOptionsList.propTypes = {
482
524
  value: _propTypes.default.any,
483
525
  prepend: _propTypes.default.node,
484
526
  append: _propTypes.default.node,
527
+ truncationProps: _propTypes.default.any,
485
528
  className: _propTypes.default.string,
486
529
  "aria-label": _propTypes.default.string,
487
530
  "data-test-subj": _propTypes.default.string,
@@ -493,5 +536,6 @@ EuiComboBoxOptionsList.propTypes = {
493
536
  asPlainText: _propTypes.default.bool
494
537
  }).isRequired]),
495
538
  delimiter: _propTypes.default.string,
496
- zIndex: _propTypes.default.number
539
+ zIndex: _propTypes.default.number,
540
+ truncationProps: _propTypes.default.any
497
541
  };
@@ -147,7 +147,7 @@ var useDataGridColumnSelector = function useDataGridColumnSelector(availableColu
147
147
  }, (0, _react2.jsx)(_drag_and_drop.EuiDroppable, {
148
148
  droppableId: "columnOrder",
149
149
  isDropDisabled: !isDragEnabled
150
- }, (0, _react2.jsx)(_react.Fragment, null, filteredColumns.map(function (id, index) {
150
+ }, (0, _react2.jsx)(_react.default.Fragment, null, filteredColumns.map(function (id, index) {
151
151
  return (0, _react2.jsx)(_drag_and_drop.EuiDraggable, {
152
152
  key: id,
153
153
  draggableId: id,
@@ -157,7 +157,9 @@ var useDataGridColumnSelector = function useDataGridColumnSelector(availableColu
157
157
  customDragHandle: true
158
158
  }, function (provided, state) {
159
159
  return (0, _react2.jsx)("div", {
160
- className: "euiDataGridColumnSelector__item ".concat(state.isDragging && 'euiDataGridColumnSelector__item-isDragging'),
160
+ className: (0, _classnames.default)('euiDataGridColumnSelector__item', {
161
+ 'euiDataGridColumnSelector__item-isDragging': state.isDragging
162
+ }),
161
163
  "data-test-subj": "dataGridColumnSelectorColumnItem-".concat(id)
162
164
  }, (0, _react2.jsx)(_flex.EuiFlexGroup, {
163
165
  responsive: false,
@@ -10,6 +10,7 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
10
10
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
11
  var _react = _interopRequireDefault(require("react"));
12
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
+ var _classnames = _interopRequireDefault(require("classnames"));
13
14
  var _accessibility = require("../../accessibility");
14
15
  var _button = require("../../button");
15
16
  var _drag_and_drop = require("../../drag_and_drop");
@@ -69,7 +70,9 @@ var EuiDataGridColumnSortingDraggable = function EuiDataGridColumnSortingDraggab
69
70
  customDragHandle: true
70
71
  }, rest), function (provided, state) {
71
72
  return (0, _react2.jsx)("div", {
72
- className: "euiDataGridColumnSorting__item ".concat(state.isDragging && 'euiDataGridColumnSorting__item-isDragging')
73
+ className: (0, _classnames.default)('euiDataGridColumnSorting__item', {
74
+ 'euiDataGridColumnSorting__item-isDragging': state.isDragging
75
+ })
73
76
  }, (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("p", null, (0, _react2.jsx)(_i18n.EuiI18n, {
74
77
  token: "euiColumnSortingDraggable.activeSortLabel",
75
78
  default: "{display} is sorting this data grid",
@@ -43,7 +43,6 @@ var EuiDescriptionListTitle = function EuiDescriptionListTitle(_ref) {
43
43
  switch (type) {
44
44
  case 'inline':
45
45
  conditionalStyles = compressed ? [styles.inlineStyles.compressed] : [styles.inlineStyles.normal];
46
- conditionalStyles.push(styles[rowGutterSize]);
47
46
  break;
48
47
  case 'row':
49
48
  conditionalStyles.push(styles[rowGutterSize]);
@@ -33,7 +33,7 @@ var euiDescriptionListTitleStyles = function euiDescriptionListTitleStyles(euiTh
33
33
  // Inline types
34
34
  inlineStyles: {
35
35
  normal: /*#__PURE__*/(0, _react.css)((0, _global_styling.euiFontSize)(euiThemeContext, 's'), " ", (0, _global_styling.logicalCSS)('padding-vertical', '1px'), " ", (0, _global_styling.logicalCSS)('padding-horizontal', euiTheme.size.xs), ";;label:normal;"),
36
- compressed: /*#__PURE__*/(0, _react.css)((0, _global_styling.euiFontSize)(euiThemeContext, 'xs'), " ", (0, _global_styling.logicalCSS)('padding-vertical', '0'), " ", (0, _global_styling.logicalCSS)('padding-horizontal', euiTheme.size.xs), ";;label:compressed;")
36
+ compressed: /*#__PURE__*/(0, _react.css)("font-size:", (0, _global_styling.euiFontSize)(euiThemeContext, 'xs').fontSize, ";line-height:", euiTheme.font.lineHeightMultiplier, ";", (0, _global_styling.logicalCSS)('padding-vertical', '0'), " ", (0, _global_styling.logicalCSS)('padding-horizontal', euiTheme.size.xs), ";;label:compressed;")
37
37
  },
38
38
  // Alignment
39
39
  right: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalTextAlignCSS)('right'), ";;label:right;"),
@@ -13,7 +13,9 @@ var _react = _interopRequireWildcard(require("react"));
13
13
  var _propTypes = _interopRequireDefault(require("prop-types"));
14
14
  var _dnd = require("@hello-pangea/dnd");
15
15
  var _classnames = _interopRequireDefault(require("classnames"));
16
+ var _services = require("../../services");
16
17
  var _droppable = require("./droppable");
18
+ var _draggable = require("./draggable.styles");
17
19
  var _react2 = require("@emotion/react");
18
20
  var _excluded = ["customDragHandle", "draggableId", "isDragDisabled", "hasInteractiveChildren", "isRemovable", "index", "children", "className", "spacing", "style", "data-test-subj"];
19
21
  /*
@@ -27,12 +29,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
27
29
  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; }
28
30
  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; }
29
31
  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) { (0, _defineProperty2.default)(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; }
30
- var spacingToClassNameMap = {
31
- none: null,
32
- s: 'euiDraggable--s',
33
- m: 'euiDraggable--m',
34
- l: 'euiDraggable--l'
35
- };
36
32
  var EuiDraggable = function EuiDraggable(_ref) {
37
33
  var _ref$customDragHandle = _ref.customDragHandle,
38
34
  customDragHandle = _ref$customDragHandle === void 0 ? false : _ref$customDragHandle,
@@ -54,29 +50,26 @@ var EuiDraggable = function EuiDraggable(_ref) {
54
50
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
55
51
  var _useContext = (0, _react.useContext)(_droppable.EuiDroppableContext),
56
52
  cloneItems = _useContext.cloneItems;
53
+ var euiTheme = (0, _services.useEuiTheme)();
54
+ var styles = (0, _draggable.euiDraggableStyles)(euiTheme);
57
55
  return (0, _react2.jsx)(_dnd.Draggable, (0, _extends2.default)({
58
56
  draggableId: draggableId,
59
57
  index: index,
60
58
  isDragDisabled: isDragDisabled
61
59
  }, rest), function (provided, snapshot, rubric) {
62
60
  var _provided$dragHandleP, _provided$dragHandleP2;
63
- var classes = (0, _classnames.default)('euiDraggable', {
64
- 'euiDraggable--hasClone': cloneItems,
65
- 'euiDraggable--hasCustomDragHandle': customDragHandle,
66
- 'euiDraggable--isDragging': snapshot.isDragging,
67
- 'euiDraggable--withoutDropAnimation': isRemovable
68
- }, spacingToClassNameMap[spacing], className);
61
+ var isDragging = snapshot.isDragging;
62
+ var cssStyles = [styles.euiDraggable, cloneItems && !isDragging && styles.hasClone, isDragging && styles.isDragging, isRemovable && styles.isRemovable, styles.spacing[spacing]];
63
+ var classes = (0, _classnames.default)('euiDraggable', className);
69
64
  var childClasses = (0, _classnames.default)('euiDraggable__item', {
70
- 'euiDraggable__item--hasCustomDragHandle': customDragHandle,
71
- 'euiDraggable__item--isDisabled': isDragDisabled,
72
- 'euiDraggable__item--isDragging': snapshot.isDragging,
73
- 'euiDraggable__item--isDropAnimating': snapshot.isDropAnimating
65
+ 'euiDraggable__item-isDisabled': isDragDisabled
74
66
  });
75
67
  var DraggableElement = typeof children === 'function' ? children(provided, snapshot, rubric) : children;
76
- return (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)("div", (0, _extends2.default)({}, provided.draggableProps, !customDragHandle ? provided.dragHandleProps : {}, {
68
+ return (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)("div", (0, _extends2.default)({}, provided.draggableProps, !customDragHandle ? provided.dragHandleProps : {}, {
77
69
  ref: provided.innerRef,
78
70
  "data-test-subj": dataTestSubj,
79
71
  className: classes,
72
+ css: cssStyles,
80
73
  style: _objectSpread(_objectSpread({}, style), provided.draggableProps.style)
81
74
  // We use [role="group"] instead of [role="button"] when we expect a nested
82
75
  // interactive element. Screen readers will cue users that this is a container
@@ -87,10 +80,12 @@ var EuiDraggable = function EuiDraggable(_ref) {
87
80
  // because [role="group"] does not permit or warrant a tab stop
88
81
  ,
89
82
  tabIndex: hasInteractiveChildren ? undefined : (_provided$dragHandleP2 = provided.dragHandleProps) === null || _provided$dragHandleP2 === void 0 ? void 0 : _provided$dragHandleP2.tabIndex
90
- }), /*#__PURE__*/(0, _react.cloneElement)(DraggableElement, {
91
- className: (0, _classnames.default)(DraggableElement.props.className, childClasses)
92
- })), cloneItems && snapshot.isDragging && (0, _react2.jsx)("div", {
93
- className: (0, _classnames.default)(classes, 'euiDraggable--clone')
83
+ }), (0, _services.cloneElementWithCss)(DraggableElement, {
84
+ className: (0, _classnames.default)(DraggableElement.props.className, childClasses),
85
+ css: [_draggable.euiDraggableItemStyles.euiDraggable__item, isDragDisabled && _draggable.euiDraggableItemStyles.disabled]
86
+ })), cloneItems && isDragging && (0, _react2.jsx)("div", {
87
+ className: (0, _classnames.default)(classes, 'euiDraggable--clone'),
88
+ css: cssStyles
94
89
  }, DraggableElement));
95
90
  });
96
91
  };
@@ -117,7 +112,7 @@ EuiDraggable.propTypes = {
117
112
  /**
118
113
  * Adds padding to the draggable item
119
114
  */
120
- spacing: _propTypes.default.oneOf(["none", "s", "m", "l"]),
115
+ spacing: _propTypes.default.any,
121
116
  style: _propTypes.default.any,
122
117
  "aria-label": _propTypes.default.string,
123
118
  "data-test-subj": _propTypes.default.string,
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.euiDraggableStyles = exports.euiDraggableItemStyles = void 0;
7
+ var _react = require("@emotion/react");
8
+ var _droppable = require("./droppable.styles");
9
+ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /*
10
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
11
+ * or more contributor license agreements. Licensed under the Elastic License
12
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
13
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
14
+ * Side Public License, v 1.
15
+ */
16
+ var _ref = process.env.NODE_ENV === "production" ? {
17
+ name: "1nohugb-isRemovable",
18
+ styles: "transition-duration:0.001s!important;label:isRemovable;"
19
+ } : {
20
+ name: "1nohugb-isRemovable",
21
+ styles: "transition-duration:0.001s!important;label:isRemovable;",
22
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
23
+ };
24
+ var _ref2 = process.env.NODE_ENV === "production" ? {
25
+ name: "1wvdf2m-hasClone",
26
+ styles: "transform:none!important;label:hasClone;"
27
+ } : {
28
+ name: "1wvdf2m-hasClone",
29
+ styles: "transform:none!important;label:hasClone;",
30
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
31
+ };
32
+ var _ref3 = process.env.NODE_ENV === "production" ? {
33
+ name: "oyhf1i-euiDraggable",
34
+ styles: "&:focus{outline:none;&>.euiDraggable__item{outline:auto;}};label:euiDraggable;"
35
+ } : {
36
+ name: "oyhf1i-euiDraggable",
37
+ styles: "&:focus{outline:none;&>.euiDraggable__item{outline:auto;}};label:euiDraggable;",
38
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
39
+ };
40
+ var euiDraggableStyles = function euiDraggableStyles(euiThemeContext) {
41
+ var euiTheme = euiThemeContext.euiTheme;
42
+ return {
43
+ euiDraggable: _ref3,
44
+ isDragging: /*#__PURE__*/(0, _react.css)("z-index:", euiTheme.levels.toast, "!important;;label:isDragging;"),
45
+ hasClone: _ref2,
46
+ isRemovable: _ref,
47
+ spacing: (0, _droppable.sharedSpacingPadding)(euiThemeContext)
48
+ };
49
+ };
50
+ exports.euiDraggableStyles = euiDraggableStyles;
51
+ var euiDraggableItemStyles = {
52
+ euiDraggable__item: /*#__PURE__*/(0, _react.css)(";label:euiDraggable__item;"),
53
+ disabled: process.env.NODE_ENV === "production" ? {
54
+ name: "b86pnw-disabled",
55
+ styles: "cursor:not-allowed;label:disabled;"
56
+ } : {
57
+ name: "b86pnw-disabled",
58
+ styles: "cursor:not-allowed;label:disabled;",
59
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
60
+ }
61
+ };
62
+ exports.euiDraggableItemStyles = euiDraggableItemStyles;
@@ -5,14 +5,17 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.EuiDroppableContext = exports.EuiDroppable = void 0;
8
+ exports.SPACINGS = exports.EuiDroppableContext = exports.EuiDroppable = void 0;
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
10
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
11
  var _react = _interopRequireWildcard(require("react"));
12
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
13
  var _dnd = require("@hello-pangea/dnd");
14
14
  var _classnames = _interopRequireDefault(require("classnames"));
15
+ var _services = require("../../services");
16
+ var _panel = require("../panel");
15
17
  var _drag_drop_context = require("./drag_drop_context");
18
+ var _droppable = require("./droppable.styles");
16
19
  var _react2 = require("@emotion/react");
17
20
  var _excluded = ["droppableId", "direction", "isDropDisabled", "children", "className", "cloneDraggables", "spacing", "style", "type", "withPanel", "grow", "data-test-subj"];
18
21
  /*
@@ -24,12 +27,8 @@ var _excluded = ["droppableId", "direction", "isDropDisabled", "children", "clas
24
27
  */
25
28
  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); }
26
29
  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; }
27
- var spacingToClassNameMap = {
28
- none: null,
29
- s: 'euiDroppable--s',
30
- m: 'euiDroppable--m',
31
- l: 'euiDroppable--l'
32
- };
30
+ var SPACINGS = ['none', 's', 'm', 'l'];
31
+ exports.SPACINGS = SPACINGS;
33
32
  var EuiDroppableContext = /*#__PURE__*/_react.default.createContext({
34
33
  cloneItems: false
35
34
  });
@@ -58,35 +57,40 @@ var EuiDroppable = function EuiDroppable(_ref) {
58
57
  var _useContext = (0, _react.useContext)(_drag_drop_context.EuiDragDropContextContext),
59
58
  isDraggingType = _useContext.isDraggingType;
60
59
  var dropIsDisabled = cloneDraggables ? true : isDropDisabled;
60
+ var euiTheme = (0, _services.useEuiTheme)();
61
+ var styles = (0, _droppable.euiDroppableStyles)(euiTheme);
61
62
  return (0, _react2.jsx)(_dnd.Droppable, (0, _extends2.default)({
62
63
  isDropDisabled: dropIsDisabled,
63
64
  droppableId: droppableId,
64
65
  direction: direction,
65
66
  type: type
66
67
  }, rest), function (provided, snapshot) {
68
+ var isDraggingOver = snapshot.isDraggingOver;
69
+ var PanelOrDiv = withPanel ? _panel.EuiPanel : 'div';
70
+ var panelOrDivProps = withPanel ? {
71
+ panelRef: provided.innerRef,
72
+ hasShadow: true,
73
+ paddingSize: 'none'
74
+ } : {
75
+ ref: provided.innerRef
76
+ };
77
+ var cssStyles = [styles.euiDroppable, isDraggingType === type && !dropIsDisabled && styles.isDragging, isDraggingOver && styles.isDraggingOver, grow ? styles.grow : styles.noGrow, styles.spacing[spacing]];
67
78
  var classes = (0, _classnames.default)('euiDroppable', {
68
- 'euiDroppable--isDisabled': dropIsDisabled,
69
- 'euiDroppable--isDraggingOver': snapshot.isDraggingOver,
70
- 'euiDroppable--isDraggingType': isDraggingType === type,
71
- 'euiDroppable--withPanel': withPanel,
72
- 'euiDroppable--grow': grow,
73
- 'euiDroppable--noGrow': !grow
74
- }, spacingToClassNameMap[spacing], className);
75
- var placeholderClasses = (0, _classnames.default)('euiDroppable__placeholder', {
76
- 'euiDroppable__placeholder--isHidden': cloneDraggables
77
- });
79
+ 'euiDroppable-isDisabled': dropIsDisabled
80
+ }, className);
78
81
  var DroppableElement = typeof children === 'function' ? children(provided, snapshot) : children;
79
- return (0, _react2.jsx)("div", (0, _extends2.default)({}, provided.droppableProps, {
80
- ref: provided.innerRef,
82
+ return (0, _react2.jsx)(PanelOrDiv, (0, _extends2.default)({}, provided.droppableProps, panelOrDivProps, {
81
83
  style: style,
82
84
  "data-test-subj": dataTestSubj,
83
- className: classes
85
+ className: classes,
86
+ css: cssStyles
84
87
  }), (0, _react2.jsx)(EuiDroppableContext.Provider, {
85
88
  value: {
86
89
  cloneItems: cloneDraggables
87
90
  }
88
91
  }, DroppableElement), (0, _react2.jsx)("div", {
89
- className: placeholderClasses
92
+ className: "euiDroppable__placeholder",
93
+ hidden: cloneDraggables
90
94
  }, provided.placeholder));
91
95
  });
92
96
  };
@@ -105,7 +109,7 @@ EuiDroppable.propTypes = {
105
109
  /**
106
110
  * Adds padding to the droppable area
107
111
  */
108
- spacing: _propTypes.default.oneOf(["none", "s", "m", "l"]),
112
+ spacing: _propTypes.default.any,
109
113
  /**
110
114
  * Adds an EuiPanel style to the droppable area
111
115
  */