@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
@@ -7,8 +7,8 @@ import _inherits from "@babel/runtime/helpers/inherits";
7
7
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
8
8
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
9
9
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
10
- var _excluded = ["key", "isGroupLabelOption", "label", "value", "prepend", "append"],
11
- _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"];
10
+ var _excluded = ["key", "isGroupLabelOption", "label", "value", "prepend", "append", "truncationProps"],
11
+ _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"];
12
12
  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; }
13
13
  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; }
14
14
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
@@ -26,6 +26,7 @@ import classNames from 'classnames';
26
26
  import { FixedSizeList } from 'react-window';
27
27
  import { EuiFlexGroup, EuiFlexItem } from '../../flex';
28
28
  import { EuiHighlight } from '../../highlight';
29
+ import { EuiMark } from '../../mark';
29
30
  import { EuiText } from '../../text';
30
31
  import { EuiLoadingSpinner } from '../../loading';
31
32
  import { EuiComboBoxTitle } from './combo_box_title';
@@ -33,8 +34,8 @@ import { EuiI18n } from '../../i18n';
33
34
  import { EuiFilterSelectItem } from '../../filter_group/filter_select_item';
34
35
  import { EuiBadge } from '../../badge';
35
36
  import { EuiPopoverPanel } from '../../popover/popover_panel';
37
+ import { EuiTextTruncate } from '../../text_truncate';
36
38
  import { jsx as ___EmotionJSX } from "@emotion/react";
37
- var OPTION_CONTENT_CLASSNAME = 'euiComboBoxOption__content';
38
39
  var hitEnterBadge = ___EmotionJSX(EuiBadge, {
39
40
  className: "euiComboBoxOption__enterBadge",
40
41
  color: "hollow",
@@ -95,6 +96,7 @@ export var EuiComboBoxOptionsList = /*#__PURE__*/function (_Component) {
95
96
  value = option.value,
96
97
  prepend = option.prepend,
97
98
  append = option.append,
99
+ _truncationProps = option.truncationProps,
98
100
  rest = _objectWithoutProperties(option, _excluded);
99
101
  var _this$props = _this.props,
100
102
  singleSelection = _this$props.singleSelection,
@@ -105,6 +107,8 @@ export var EuiComboBoxOptionsList = /*#__PURE__*/function (_Component) {
105
107
  renderOption = _this$props.renderOption,
106
108
  searchValue = _this$props.searchValue,
107
109
  rootId = _this$props.rootId;
110
+ // Individual truncation settings should override component prop
111
+ var truncationProps = _objectSpread(_objectSpread({}, _this.props.truncationProps), _truncationProps);
108
112
  if (isGroupLabelOption) {
109
113
  return ___EmotionJSX("div", {
110
114
  key: key !== null && key !== void 0 ? key : label,
@@ -129,22 +133,54 @@ export var EuiComboBoxOptionsList = /*#__PURE__*/function (_Component) {
129
133
  isFocused: optionIsFocused,
130
134
  checked: checked,
131
135
  showIcons: singleSelection ? true : false,
132
- id: rootId("_option-".concat(index)),
133
- title: label
136
+ id: rootId("_option-".concat(index))
134
137
  }, rest), ___EmotionJSX("span", {
135
138
  className: "euiComboBoxOption__contentWrapper"
136
139
  }, prepend && ___EmotionJSX("span", {
137
140
  className: "euiComboBoxOption__prepend"
138
- }, prepend), renderOption ? ___EmotionJSX("span", {
139
- className: OPTION_CONTENT_CLASSNAME
140
- }, renderOption(option, searchValue, 'euiComboBoxOption__renderOption')) : ___EmotionJSX(EuiHighlight, {
141
- search: searchValue,
142
- strict: _this.props.isCaseSensitive,
143
- className: OPTION_CONTENT_CLASSNAME
144
- }, label), append && ___EmotionJSX("span", {
141
+ }, prepend), ___EmotionJSX("span", {
142
+ className: "euiComboBoxOption__content"
143
+ }, renderOption ? renderOption(option, searchValue, 'euiComboBoxOption__renderOption') : _this.renderTruncatedOption(label, truncationProps)), append && ___EmotionJSX("span", {
145
144
  className: "euiComboBoxOption__append"
146
145
  }, append), optionIsFocused && !optionIsDisabled ? hitEnterBadge : null));
147
146
  });
147
+ _defineProperty(_assertThisInitialized(_this), "optionWidth", void 0);
148
+ _defineProperty(_assertThisInitialized(_this), "setOptionWidth", function (width) {
149
+ _this.optionWidth = width;
150
+ });
151
+ _defineProperty(_assertThisInitialized(_this), "renderTruncatedOption", function (text, truncationProps) {
152
+ if (!_this.props.searchValue) {
153
+ return ___EmotionJSX(EuiTextTruncate, _extends({
154
+ truncation: "end",
155
+ width: _this.optionWidth,
156
+ onResize: _this.setOptionWidth
157
+ }, truncationProps, {
158
+ text: text
159
+ }), function (text) {
160
+ return text;
161
+ });
162
+ }
163
+ var searchValue = _this.props.searchValue.trim();
164
+ var searchPositionStart = _this.props.isCaseSensitive ? text.indexOf(searchValue) : text.toLowerCase().indexOf(searchValue.toLowerCase());
165
+ var searchPositionCenter = searchPositionStart + Math.floor(searchValue.length / 2);
166
+ return ___EmotionJSX(EuiTextTruncate, _extends({
167
+ width: _this.optionWidth,
168
+ onResize: _this.setOptionWidth
169
+ }, truncationProps, {
170
+ // When searching, don't allow overriding the truncation settings
171
+ truncation: "startEnd",
172
+ truncationPosition: searchPositionCenter,
173
+ text: text
174
+ }), function (text) {
175
+ return ___EmotionJSX(React.Fragment, null, text.length >= searchValue.length ? ___EmotionJSX(EuiHighlight, {
176
+ search: searchValue,
177
+ strict: _this.props.isCaseSensitive
178
+ }, text) :
179
+ // If the available truncated text is shorter than the full search string,
180
+ // just highlight the entire truncated text
181
+ ___EmotionJSX(EuiMark, null, text));
182
+ });
183
+ });
148
184
  return _this;
149
185
  }
150
186
  _createClass(EuiComboBoxOptionsList, [{
@@ -228,6 +264,7 @@ export var EuiComboBoxOptionsList = /*#__PURE__*/function (_Component) {
228
264
  delimiter = _this$props2.delimiter,
229
265
  zIndex = _this$props2.zIndex,
230
266
  style = _this$props2.style,
267
+ truncationProps = _this$props2.truncationProps,
231
268
  listboxAriaLabel = _this$props2.listboxAriaLabel,
232
269
  rest = _objectWithoutProperties(_this$props2, _excluded2);
233
270
  var emptyStateContent;
@@ -9,7 +9,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
9
9
  * Side Public License, v 1.
10
10
  */
11
11
 
12
- import React, { Fragment, useState, useMemo, useCallback } from 'react';
12
+ import React, { useState, useMemo, useCallback } from 'react';
13
13
  import classNames from 'classnames';
14
14
  import { EuiPopover, EuiPopoverFooter, EuiPopoverTitle } from '../../popover';
15
15
  import { EuiI18n, useEuiI18n } from '../../i18n';
@@ -137,7 +137,7 @@ export var useDataGridColumnSelector = function useDataGridColumnSelector(availa
137
137
  }, ___EmotionJSX(EuiDroppable, {
138
138
  droppableId: "columnOrder",
139
139
  isDropDisabled: !isDragEnabled
140
- }, ___EmotionJSX(Fragment, null, filteredColumns.map(function (id, index) {
140
+ }, ___EmotionJSX(React.Fragment, null, filteredColumns.map(function (id, index) {
141
141
  return ___EmotionJSX(EuiDraggable, {
142
142
  key: id,
143
143
  draggableId: id,
@@ -147,7 +147,9 @@ export var useDataGridColumnSelector = function useDataGridColumnSelector(availa
147
147
  customDragHandle: true
148
148
  }, function (provided, state) {
149
149
  return ___EmotionJSX("div", {
150
- className: "euiDataGridColumnSelector__item ".concat(state.isDragging && 'euiDataGridColumnSelector__item-isDragging'),
150
+ className: classNames('euiDataGridColumnSelector__item', {
151
+ 'euiDataGridColumnSelector__item-isDragging': state.isDragging
152
+ }),
151
153
  "data-test-subj": "dataGridColumnSelectorColumnItem-".concat(id)
152
154
  }, ___EmotionJSX(EuiFlexGroup, {
153
155
  responsive: false,
@@ -11,6 +11,7 @@ var _excluded = ["id", "display", "direction", "index", "sorting", "schema", "sc
11
11
  */
12
12
 
13
13
  import React from 'react';
14
+ import classNames from 'classnames';
14
15
  import { EuiScreenReaderOnly } from '../../accessibility';
15
16
  import { EuiButtonGroup, EuiButtonIcon } from '../../button';
16
17
  import { EuiDraggable } from '../../drag_and_drop';
@@ -60,7 +61,9 @@ export var EuiDataGridColumnSortingDraggable = function EuiDataGridColumnSorting
60
61
  customDragHandle: true
61
62
  }, rest), function (provided, state) {
62
63
  return ___EmotionJSX("div", {
63
- className: "euiDataGridColumnSorting__item ".concat(state.isDragging && 'euiDataGridColumnSorting__item-isDragging')
64
+ className: classNames('euiDataGridColumnSorting__item', {
65
+ 'euiDataGridColumnSorting__item-isDragging': state.isDragging
66
+ })
64
67
  }, ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("p", null, ___EmotionJSX(EuiI18n, {
65
68
  token: "euiColumnSortingDraggable.activeSortLabel",
66
69
  default: "{display} is sorting this data grid",
@@ -34,7 +34,6 @@ export var EuiDescriptionListTitle = function EuiDescriptionListTitle(_ref) {
34
34
  switch (type) {
35
35
  case 'inline':
36
36
  conditionalStyles = compressed ? [styles.inlineStyles.compressed] : [styles.inlineStyles.normal];
37
- conditionalStyles.push(styles[rowGutterSize]);
38
37
  break;
39
38
  case 'row':
40
39
  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;"),
@@ -12,17 +12,13 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
12
12
  * Side Public License, v 1.
13
13
  */
14
14
 
15
- import React, { Fragment, cloneElement, useContext } from 'react';
15
+ import React, { useContext } from 'react';
16
16
  import { Draggable } from '@hello-pangea/dnd';
17
17
  import classNames from 'classnames';
18
+ import { useEuiTheme, cloneElementWithCss } from '../../services';
18
19
  import { EuiDroppableContext } from './droppable';
20
+ import { euiDraggableStyles, euiDraggableItemStyles } from './draggable.styles';
19
21
  import { jsx as ___EmotionJSX } from "@emotion/react";
20
- var spacingToClassNameMap = {
21
- none: null,
22
- s: 'euiDraggable--s',
23
- m: 'euiDraggable--m',
24
- l: 'euiDraggable--l'
25
- };
26
22
  export var EuiDraggable = function EuiDraggable(_ref) {
27
23
  var _ref$customDragHandle = _ref.customDragHandle,
28
24
  customDragHandle = _ref$customDragHandle === void 0 ? false : _ref$customDragHandle,
@@ -44,29 +40,26 @@ export var EuiDraggable = function EuiDraggable(_ref) {
44
40
  rest = _objectWithoutProperties(_ref, _excluded);
45
41
  var _useContext = useContext(EuiDroppableContext),
46
42
  cloneItems = _useContext.cloneItems;
43
+ var euiTheme = useEuiTheme();
44
+ var styles = euiDraggableStyles(euiTheme);
47
45
  return ___EmotionJSX(Draggable, _extends({
48
46
  draggableId: draggableId,
49
47
  index: index,
50
48
  isDragDisabled: isDragDisabled
51
49
  }, rest), function (provided, snapshot, rubric) {
52
50
  var _provided$dragHandleP, _provided$dragHandleP2;
53
- var classes = classNames('euiDraggable', {
54
- 'euiDraggable--hasClone': cloneItems,
55
- 'euiDraggable--hasCustomDragHandle': customDragHandle,
56
- 'euiDraggable--isDragging': snapshot.isDragging,
57
- 'euiDraggable--withoutDropAnimation': isRemovable
58
- }, spacingToClassNameMap[spacing], className);
51
+ var isDragging = snapshot.isDragging;
52
+ var cssStyles = [styles.euiDraggable, cloneItems && !isDragging && styles.hasClone, isDragging && styles.isDragging, isRemovable && styles.isRemovable, styles.spacing[spacing]];
53
+ var classes = classNames('euiDraggable', className);
59
54
  var childClasses = classNames('euiDraggable__item', {
60
- 'euiDraggable__item--hasCustomDragHandle': customDragHandle,
61
- 'euiDraggable__item--isDisabled': isDragDisabled,
62
- 'euiDraggable__item--isDragging': snapshot.isDragging,
63
- 'euiDraggable__item--isDropAnimating': snapshot.isDropAnimating
55
+ 'euiDraggable__item-isDisabled': isDragDisabled
64
56
  });
65
57
  var DraggableElement = typeof children === 'function' ? children(provided, snapshot, rubric) : children;
66
- return ___EmotionJSX(Fragment, null, ___EmotionJSX("div", _extends({}, provided.draggableProps, !customDragHandle ? provided.dragHandleProps : {}, {
58
+ return ___EmotionJSX(React.Fragment, null, ___EmotionJSX("div", _extends({}, provided.draggableProps, !customDragHandle ? provided.dragHandleProps : {}, {
67
59
  ref: provided.innerRef,
68
60
  "data-test-subj": dataTestSubj,
69
61
  className: classes,
62
+ css: cssStyles,
70
63
  style: _objectSpread(_objectSpread({}, style), provided.draggableProps.style)
71
64
  // We use [role="group"] instead of [role="button"] when we expect a nested
72
65
  // interactive element. Screen readers will cue users that this is a container
@@ -77,10 +70,12 @@ export var EuiDraggable = function EuiDraggable(_ref) {
77
70
  // because [role="group"] does not permit or warrant a tab stop
78
71
  ,
79
72
  tabIndex: hasInteractiveChildren ? undefined : (_provided$dragHandleP2 = provided.dragHandleProps) === null || _provided$dragHandleP2 === void 0 ? void 0 : _provided$dragHandleP2.tabIndex
80
- }), /*#__PURE__*/cloneElement(DraggableElement, {
81
- className: classNames(DraggableElement.props.className, childClasses)
82
- })), cloneItems && snapshot.isDragging && ___EmotionJSX("div", {
83
- className: classNames(classes, 'euiDraggable--clone')
73
+ }), cloneElementWithCss(DraggableElement, {
74
+ className: classNames(DraggableElement.props.className, childClasses),
75
+ css: [euiDraggableItemStyles.euiDraggable__item, isDragDisabled && euiDraggableItemStyles.disabled]
76
+ })), cloneItems && isDragging && ___EmotionJSX("div", {
77
+ className: classNames(classes, 'euiDraggable--clone'),
78
+ css: cssStyles
84
79
  }, DraggableElement));
85
80
  });
86
81
  };
@@ -0,0 +1,56 @@
1
+ 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)."; }
2
+ /*
3
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
4
+ * or more contributor license agreements. Licensed under the Elastic License
5
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
6
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
7
+ * Side Public License, v 1.
8
+ */
9
+
10
+ import { css } from '@emotion/react';
11
+ import { sharedSpacingPadding } from './droppable.styles';
12
+ var _ref = process.env.NODE_ENV === "production" ? {
13
+ name: "1nohugb-isRemovable",
14
+ styles: "transition-duration:0.001s!important;label:isRemovable;"
15
+ } : {
16
+ name: "1nohugb-isRemovable",
17
+ styles: "transition-duration:0.001s!important;label:isRemovable;",
18
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
19
+ };
20
+ var _ref2 = process.env.NODE_ENV === "production" ? {
21
+ name: "1wvdf2m-hasClone",
22
+ styles: "transform:none!important;label:hasClone;"
23
+ } : {
24
+ name: "1wvdf2m-hasClone",
25
+ styles: "transform:none!important;label:hasClone;",
26
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
27
+ };
28
+ var _ref3 = process.env.NODE_ENV === "production" ? {
29
+ name: "oyhf1i-euiDraggable",
30
+ styles: "&:focus{outline:none;&>.euiDraggable__item{outline:auto;}};label:euiDraggable;"
31
+ } : {
32
+ name: "oyhf1i-euiDraggable",
33
+ styles: "&:focus{outline:none;&>.euiDraggable__item{outline:auto;}};label:euiDraggable;",
34
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
35
+ };
36
+ export var euiDraggableStyles = function euiDraggableStyles(euiThemeContext) {
37
+ var euiTheme = euiThemeContext.euiTheme;
38
+ return {
39
+ euiDraggable: _ref3,
40
+ isDragging: /*#__PURE__*/css("z-index:", euiTheme.levels.toast, "!important;;label:isDragging;"),
41
+ hasClone: _ref2,
42
+ isRemovable: _ref,
43
+ spacing: sharedSpacingPadding(euiThemeContext)
44
+ };
45
+ };
46
+ export var euiDraggableItemStyles = {
47
+ euiDraggable__item: /*#__PURE__*/css(";label:euiDraggable__item;"),
48
+ disabled: process.env.NODE_ENV === "production" ? {
49
+ name: "b86pnw-disabled",
50
+ styles: "cursor:not-allowed;label:disabled;"
51
+ } : {
52
+ name: "b86pnw-disabled",
53
+ styles: "cursor:not-allowed;label:disabled;",
54
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
55
+ }
56
+ };
@@ -12,14 +12,12 @@ var _excluded = ["droppableId", "direction", "isDropDisabled", "children", "clas
12
12
  import React, { useContext } from 'react';
13
13
  import { Droppable } from '@hello-pangea/dnd';
14
14
  import classNames from 'classnames';
15
+ import { useEuiTheme } from '../../services';
16
+ import { EuiPanel } from '../panel';
15
17
  import { EuiDragDropContextContext } from './drag_drop_context';
18
+ import { euiDroppableStyles } from './droppable.styles';
16
19
  import { jsx as ___EmotionJSX } from "@emotion/react";
17
- var spacingToClassNameMap = {
18
- none: null,
19
- s: 'euiDroppable--s',
20
- m: 'euiDroppable--m',
21
- l: 'euiDroppable--l'
22
- };
20
+ export var SPACINGS = ['none', 's', 'm', 'l'];
23
21
  export var EuiDroppableContext = /*#__PURE__*/React.createContext({
24
22
  cloneItems: false
25
23
  });
@@ -47,35 +45,40 @@ export var EuiDroppable = function EuiDroppable(_ref) {
47
45
  var _useContext = useContext(EuiDragDropContextContext),
48
46
  isDraggingType = _useContext.isDraggingType;
49
47
  var dropIsDisabled = cloneDraggables ? true : isDropDisabled;
48
+ var euiTheme = useEuiTheme();
49
+ var styles = euiDroppableStyles(euiTheme);
50
50
  return ___EmotionJSX(Droppable, _extends({
51
51
  isDropDisabled: dropIsDisabled,
52
52
  droppableId: droppableId,
53
53
  direction: direction,
54
54
  type: type
55
55
  }, rest), function (provided, snapshot) {
56
+ var isDraggingOver = snapshot.isDraggingOver;
57
+ var PanelOrDiv = withPanel ? EuiPanel : 'div';
58
+ var panelOrDivProps = withPanel ? {
59
+ panelRef: provided.innerRef,
60
+ hasShadow: true,
61
+ paddingSize: 'none'
62
+ } : {
63
+ ref: provided.innerRef
64
+ };
65
+ var cssStyles = [styles.euiDroppable, isDraggingType === type && !dropIsDisabled && styles.isDragging, isDraggingOver && styles.isDraggingOver, grow ? styles.grow : styles.noGrow, styles.spacing[spacing]];
56
66
  var classes = classNames('euiDroppable', {
57
- 'euiDroppable--isDisabled': dropIsDisabled,
58
- 'euiDroppable--isDraggingOver': snapshot.isDraggingOver,
59
- 'euiDroppable--isDraggingType': isDraggingType === type,
60
- 'euiDroppable--withPanel': withPanel,
61
- 'euiDroppable--grow': grow,
62
- 'euiDroppable--noGrow': !grow
63
- }, spacingToClassNameMap[spacing], className);
64
- var placeholderClasses = classNames('euiDroppable__placeholder', {
65
- 'euiDroppable__placeholder--isHidden': cloneDraggables
66
- });
67
+ 'euiDroppable-isDisabled': dropIsDisabled
68
+ }, className);
67
69
  var DroppableElement = typeof children === 'function' ? children(provided, snapshot) : children;
68
- return ___EmotionJSX("div", _extends({}, provided.droppableProps, {
69
- ref: provided.innerRef,
70
+ return ___EmotionJSX(PanelOrDiv, _extends({}, provided.droppableProps, panelOrDivProps, {
70
71
  style: style,
71
72
  "data-test-subj": dataTestSubj,
72
- className: classes
73
+ className: classes,
74
+ css: cssStyles
73
75
  }), ___EmotionJSX(EuiDroppableContext.Provider, {
74
76
  value: {
75
77
  cloneItems: cloneDraggables
76
78
  }
77
79
  }, DroppableElement), ___EmotionJSX("div", {
78
- className: placeholderClasses
80
+ className: "euiDroppable__placeholder",
81
+ hidden: cloneDraggables
79
82
  }, provided.placeholder));
80
83
  });
81
84
  };
@@ -0,0 +1,51 @@
1
+ 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)."; }
2
+ /*
3
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
4
+ * or more contributor license agreements. Licensed under the Elastic License
5
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
6
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
7
+ * Side Public License, v 1.
8
+ */
9
+
10
+ import { css } from '@emotion/react';
11
+ import { transparentize } from '../../services';
12
+ import { euiCanAnimate } from '../../global_styling';
13
+ var _ref = process.env.NODE_ENV === "production" ? {
14
+ name: "jkp921-noGrow",
15
+ styles: "flex-grow:0;label:noGrow;"
16
+ } : {
17
+ name: "jkp921-noGrow",
18
+ styles: "flex-grow:0;label:noGrow;",
19
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
20
+ };
21
+ var _ref2 = process.env.NODE_ENV === "production" ? {
22
+ name: "122lw0e-grow",
23
+ styles: "flex-grow:1;label:grow;"
24
+ } : {
25
+ name: "122lw0e-grow",
26
+ styles: "flex-grow:1;label:grow;",
27
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
28
+ };
29
+ export var euiDroppableStyles = function euiDroppableStyles(euiThemeContext) {
30
+ var euiTheme = euiThemeContext.euiTheme;
31
+ var droppableColor = euiTheme.colors.success;
32
+ return {
33
+ euiDroppable: /*#__PURE__*/css(euiCanAnimate, "{transition:background-color ", euiTheme.animation.slow, " ease;};label:euiDroppable;"),
34
+ isDragging: /*#__PURE__*/css("background-color:", transparentize(droppableColor, 0.1), ";;label:isDragging;"),
35
+ isDraggingOver: /*#__PURE__*/css("background-color:", transparentize(droppableColor, 0.25), ";;label:isDraggingOver;"),
36
+ grow: _ref2,
37
+ noGrow: _ref,
38
+ spacing: sharedSpacingPadding(euiThemeContext)
39
+ };
40
+ };
41
+
42
+ // Droppable and draggable components both have the same shared spacing/padding values
43
+ export var sharedSpacingPadding = function sharedSpacingPadding(_ref3) {
44
+ var euiTheme = _ref3.euiTheme;
45
+ return {
46
+ none: null,
47
+ s: /*#__PURE__*/css("padding:", euiTheme.size.xxs, ";;label:s;"),
48
+ m: /*#__PURE__*/css("padding:", euiTheme.size.xs, ";;label:m;"),
49
+ l: /*#__PURE__*/css("padding:", euiTheme.size.s, ";;label:l;")
50
+ };
51
+ };
@@ -1,15 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
- import _createClass from "@babel/runtime/helpers/createClass";
5
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
6
- import _inherits from "@babel/runtime/helpers/inherits";
7
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
8
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
9
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
10
- var _excluded = ["query", "incremental", "hint"];
11
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
12
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
3
+ var _excluded = ["query", "placeholder", "incremental", "hint"];
13
4
  /*
14
5
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
15
6
  * or more contributor license agreements. Licensed under the Elastic License
@@ -18,82 +9,58 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
18
9
  * Side Public License, v 1.
19
10
  */
20
11
 
21
- import React, { Component } from 'react';
12
+ import React, { useRef } from 'react';
13
+ import { useUpdateEffect } from '../../services';
14
+ import { useEuiI18n } from '../i18n';
22
15
  import { EuiFieldSearch } from '../form';
23
16
  import { EuiInputPopover } from '../popover';
24
17
  import { jsx as ___EmotionJSX } from "@emotion/react";
25
- export var EuiSearchBox = /*#__PURE__*/function (_Component) {
26
- _inherits(EuiSearchBox, _Component);
27
- var _super = _createSuper(EuiSearchBox);
28
- function EuiSearchBox() {
29
- var _this;
30
- _classCallCheck(this, EuiSearchBox);
31
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
32
- args[_key] = arguments[_key];
18
+ export var EuiSearchBox = function EuiSearchBox(_ref) {
19
+ var query = _ref.query,
20
+ placeholder = _ref.placeholder,
21
+ incremental = _ref.incremental,
22
+ hint = _ref.hint,
23
+ rest = _objectWithoutProperties(_ref, _excluded);
24
+ var _inputRef = useRef(null);
25
+ useUpdateEffect(function () {
26
+ if (_inputRef.current) {
27
+ _inputRef.current.value = query;
28
+ _inputRef.current.dispatchEvent(new Event('change'));
33
29
  }
34
- _this = _super.call.apply(_super, [this].concat(args));
35
- _defineProperty(_assertThisInitialized(_this), "inputElement", null);
36
- return _this;
37
- }
38
- _createClass(EuiSearchBox, [{
39
- key: "componentDidUpdate",
40
- value: function componentDidUpdate(oldProps) {
41
- if (oldProps.query !== this.props.query && this.inputElement != null) {
42
- this.inputElement.value = this.props.query;
43
- this.inputElement.dispatchEvent(new Event('change'));
44
- }
30
+ }, [query]);
31
+ var defaultPlaceholder = useEuiI18n('euiSearchBox.placeholder', 'Search...');
32
+ var ariaLabelIncremental = useEuiI18n('euiSearchBox.incrementalAriaLabel', 'This is a search bar. As you type, the results lower in the page will automatically filter.');
33
+ var ariaLabelEnter = useEuiI18n('euiSearchBox.ariaLabel', 'This is a search bar. After typing your query, hit enter to filter the results lower in the page.');
34
+ var search = ___EmotionJSX(EuiFieldSearch, _extends({
35
+ inputRef: function inputRef(input) {
36
+ return _inputRef.current = input;
37
+ },
38
+ fullWidth: true,
39
+ defaultValue: query,
40
+ incremental: incremental,
41
+ "aria-label": incremental ? ariaLabelIncremental : ariaLabelEnter,
42
+ placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : defaultPlaceholder,
43
+ onFocus: function onFocus() {
44
+ hint === null || hint === void 0 ? void 0 : hint.setIsVisible(true);
45
45
  }
46
- }, {
47
- key: "render",
48
- value: function render() {
49
- var _this2 = this;
50
- var _this$props = this.props,
51
- query = _this$props.query,
52
- incremental = _this$props.incremental,
53
- hint = _this$props.hint,
54
- rest = _objectWithoutProperties(_this$props, _excluded);
55
- var ariaLabel;
56
- if (incremental) {
57
- ariaLabel = 'This is a search bar. As you type, the results lower in the page will automatically filter.';
58
- } else {
59
- ariaLabel = 'This is a search bar. After typing your query, hit enter to filter the results lower in the page.';
60
- }
61
- var search = ___EmotionJSX(EuiFieldSearch, _extends({
62
- inputRef: function inputRef(input) {
63
- return _this2.inputElement = input;
64
- },
65
- fullWidth: true,
66
- defaultValue: query,
67
- incremental: incremental,
68
- "aria-label": ariaLabel,
69
- onFocus: function onFocus() {
70
- hint === null || hint === void 0 ? void 0 : hint.setIsVisible(true);
71
- }
72
- }, rest));
73
- if (hint) {
74
- return ___EmotionJSX(EuiInputPopover, _extends({
75
- disableFocusTrap: true,
76
- input: search,
77
- isOpen: hint.isVisible,
78
- fullWidth: true,
79
- closePopover: function closePopover() {
80
- hint.setIsVisible(false);
81
- },
82
- panelProps: {
83
- 'aria-live': undefined,
84
- 'aria-modal': undefined,
85
- role: undefined,
86
- tabIndex: -1,
87
- id: hint.id
88
- }
89
- }, hint.popoverProps), hint.content);
46
+ }, rest));
47
+ if (hint) {
48
+ return ___EmotionJSX(EuiInputPopover, _extends({
49
+ disableFocusTrap: true,
50
+ input: search,
51
+ isOpen: hint.isVisible,
52
+ fullWidth: true,
53
+ closePopover: function closePopover() {
54
+ hint.setIsVisible(false);
55
+ },
56
+ panelProps: {
57
+ 'aria-live': undefined,
58
+ 'aria-modal': undefined,
59
+ role: undefined,
60
+ tabIndex: -1,
61
+ id: hint.id
90
62
  }
91
- return search;
92
- }
93
- }]);
94
- return EuiSearchBox;
95
- }(Component);
96
- _defineProperty(EuiSearchBox, "defaultProps", {
97
- placeholder: 'Search...',
98
- incremental: false
99
- });
63
+ }, hint.popoverProps), hint.content);
64
+ }
65
+ return search;
66
+ };
@@ -64,6 +64,7 @@ export var EuiTablePagination = function EuiTablePagination(props) {
64
64
  return ___EmotionJSX(EuiContextMenuItem, {
65
65
  key: itemsPerPageOption,
66
66
  icon: itemsPerPageOption === itemsPerPage ? 'check' : 'empty',
67
+ "aria-current": itemsPerPageOption === itemsPerPage ? 'true' : undefined,
67
68
  onClick: function onClick() {
68
69
  closePopover();
69
70
  onChangeItemsPerPage === null || onChangeItemsPerPage === void 0 ? void 0 : onChangeItemsPerPage(itemsPerPageOption);
@@ -12,7 +12,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
12
12
  */
13
13
 
14
14
  import { queries, render, screen, within } from '@testing-library/react';
15
- import { EuiProvider } from '../../components';
15
+ import { EuiProvider } from '../../components/provider';
16
16
  import * as dataTestSubjQueries from './data_test_subj_queries';
17
17
 
18
18
  /**