@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
@@ -16,18 +16,14 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
16
16
  * Side Public License, v 1.
17
17
  */
18
18
 
19
- import React, { Fragment, cloneElement, useContext } from 'react';
19
+ import React, { useContext } from 'react';
20
20
  import PropTypes from "prop-types";
21
21
  import { Draggable } from '@hello-pangea/dnd';
22
22
  import classNames from 'classnames';
23
+ import { useEuiTheme, cloneElementWithCss } from '../../services';
23
24
  import { EuiDroppableContext } from './droppable';
25
+ import { euiDraggableStyles, euiDraggableItemStyles } from './draggable.styles';
24
26
  import { jsx as ___EmotionJSX } from "@emotion/react";
25
- var spacingToClassNameMap = {
26
- none: null,
27
- s: 'euiDraggable--s',
28
- m: 'euiDraggable--m',
29
- l: 'euiDraggable--l'
30
- };
31
27
  export var EuiDraggable = function EuiDraggable(_ref) {
32
28
  var _ref$customDragHandle = _ref.customDragHandle,
33
29
  customDragHandle = _ref$customDragHandle === void 0 ? false : _ref$customDragHandle,
@@ -49,29 +45,26 @@ export var EuiDraggable = function EuiDraggable(_ref) {
49
45
  rest = _objectWithoutProperties(_ref, _excluded);
50
46
  var _useContext = useContext(EuiDroppableContext),
51
47
  cloneItems = _useContext.cloneItems;
48
+ var euiTheme = useEuiTheme();
49
+ var styles = euiDraggableStyles(euiTheme);
52
50
  return ___EmotionJSX(Draggable, _extends({
53
51
  draggableId: draggableId,
54
52
  index: index,
55
53
  isDragDisabled: isDragDisabled
56
54
  }, rest), function (provided, snapshot, rubric) {
57
55
  var _provided$dragHandleP, _provided$dragHandleP2;
58
- var classes = classNames('euiDraggable', {
59
- 'euiDraggable--hasClone': cloneItems,
60
- 'euiDraggable--hasCustomDragHandle': customDragHandle,
61
- 'euiDraggable--isDragging': snapshot.isDragging,
62
- 'euiDraggable--withoutDropAnimation': isRemovable
63
- }, spacingToClassNameMap[spacing], className);
56
+ var isDragging = snapshot.isDragging;
57
+ var cssStyles = [styles.euiDraggable, cloneItems && !isDragging && styles.hasClone, isDragging && styles.isDragging, isRemovable && styles.isRemovable, styles.spacing[spacing]];
58
+ var classes = classNames('euiDraggable', className);
64
59
  var childClasses = classNames('euiDraggable__item', {
65
- 'euiDraggable__item--hasCustomDragHandle': customDragHandle,
66
- 'euiDraggable__item--isDisabled': isDragDisabled,
67
- 'euiDraggable__item--isDragging': snapshot.isDragging,
68
- 'euiDraggable__item--isDropAnimating': snapshot.isDropAnimating
60
+ 'euiDraggable__item-isDisabled': isDragDisabled
69
61
  });
70
62
  var DraggableElement = typeof children === 'function' ? children(provided, snapshot, rubric) : children;
71
- return ___EmotionJSX(Fragment, null, ___EmotionJSX("div", _extends({}, provided.draggableProps, !customDragHandle ? provided.dragHandleProps : {}, {
63
+ return ___EmotionJSX(React.Fragment, null, ___EmotionJSX("div", _extends({}, provided.draggableProps, !customDragHandle ? provided.dragHandleProps : {}, {
72
64
  ref: provided.innerRef,
73
65
  "data-test-subj": dataTestSubj,
74
66
  className: classes,
67
+ css: cssStyles,
75
68
  style: _objectSpread(_objectSpread({}, style), provided.draggableProps.style)
76
69
  // We use [role="group"] instead of [role="button"] when we expect a nested
77
70
  // interactive element. Screen readers will cue users that this is a container
@@ -82,10 +75,12 @@ export var EuiDraggable = function EuiDraggable(_ref) {
82
75
  // because [role="group"] does not permit or warrant a tab stop
83
76
  ,
84
77
  tabIndex: hasInteractiveChildren ? undefined : (_provided$dragHandleP2 = provided.dragHandleProps) === null || _provided$dragHandleP2 === void 0 ? void 0 : _provided$dragHandleP2.tabIndex
85
- }), /*#__PURE__*/cloneElement(DraggableElement, {
86
- className: classNames(DraggableElement.props.className, childClasses)
87
- })), cloneItems && snapshot.isDragging && ___EmotionJSX("div", {
88
- className: classNames(classes, 'euiDraggable--clone')
78
+ }), cloneElementWithCss(DraggableElement, {
79
+ className: classNames(DraggableElement.props.className, childClasses),
80
+ css: [euiDraggableItemStyles.euiDraggable__item, isDragDisabled && euiDraggableItemStyles.disabled]
81
+ })), cloneItems && isDragging && ___EmotionJSX("div", {
82
+ className: classNames(classes, 'euiDraggable--clone'),
83
+ css: cssStyles
89
84
  }, DraggableElement));
90
85
  });
91
86
  };
@@ -111,7 +106,7 @@ EuiDraggable.propTypes = {
111
106
  /**
112
107
  * Adds padding to the draggable item
113
108
  */
114
- spacing: PropTypes.oneOf(["none", "s", "m", "l"]),
109
+ spacing: PropTypes.any,
115
110
  style: PropTypes.any,
116
111
  "aria-label": PropTypes.string,
117
112
  "data-test-subj": PropTypes.string,
@@ -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
+ };
@@ -14,14 +14,12 @@ import React, { useContext } from 'react';
14
14
  import PropTypes from "prop-types";
15
15
  import { Droppable } from '@hello-pangea/dnd';
16
16
  import classNames from 'classnames';
17
+ import { useEuiTheme } from '../../services';
18
+ import { EuiPanel } from '../panel';
17
19
  import { EuiDragDropContextContext } from './drag_drop_context';
20
+ import { euiDroppableStyles } from './droppable.styles';
18
21
  import { jsx as ___EmotionJSX } from "@emotion/react";
19
- var spacingToClassNameMap = {
20
- none: null,
21
- s: 'euiDroppable--s',
22
- m: 'euiDroppable--m',
23
- l: 'euiDroppable--l'
24
- };
22
+ export var SPACINGS = ['none', 's', 'm', 'l'];
25
23
  export var EuiDroppableContext = /*#__PURE__*/React.createContext({
26
24
  cloneItems: false
27
25
  });
@@ -49,35 +47,40 @@ export var EuiDroppable = function EuiDroppable(_ref) {
49
47
  var _useContext = useContext(EuiDragDropContextContext),
50
48
  isDraggingType = _useContext.isDraggingType;
51
49
  var dropIsDisabled = cloneDraggables ? true : isDropDisabled;
50
+ var euiTheme = useEuiTheme();
51
+ var styles = euiDroppableStyles(euiTheme);
52
52
  return ___EmotionJSX(Droppable, _extends({
53
53
  isDropDisabled: dropIsDisabled,
54
54
  droppableId: droppableId,
55
55
  direction: direction,
56
56
  type: type
57
57
  }, rest), function (provided, snapshot) {
58
+ var isDraggingOver = snapshot.isDraggingOver;
59
+ var PanelOrDiv = withPanel ? EuiPanel : 'div';
60
+ var panelOrDivProps = withPanel ? {
61
+ panelRef: provided.innerRef,
62
+ hasShadow: true,
63
+ paddingSize: 'none'
64
+ } : {
65
+ ref: provided.innerRef
66
+ };
67
+ var cssStyles = [styles.euiDroppable, isDraggingType === type && !dropIsDisabled && styles.isDragging, isDraggingOver && styles.isDraggingOver, grow ? styles.grow : styles.noGrow, styles.spacing[spacing]];
58
68
  var classes = classNames('euiDroppable', {
59
- 'euiDroppable--isDisabled': dropIsDisabled,
60
- 'euiDroppable--isDraggingOver': snapshot.isDraggingOver,
61
- 'euiDroppable--isDraggingType': isDraggingType === type,
62
- 'euiDroppable--withPanel': withPanel,
63
- 'euiDroppable--grow': grow,
64
- 'euiDroppable--noGrow': !grow
65
- }, spacingToClassNameMap[spacing], className);
66
- var placeholderClasses = classNames('euiDroppable__placeholder', {
67
- 'euiDroppable__placeholder--isHidden': cloneDraggables
68
- });
69
+ 'euiDroppable-isDisabled': dropIsDisabled
70
+ }, className);
69
71
  var DroppableElement = typeof children === 'function' ? children(provided, snapshot) : children;
70
- return ___EmotionJSX("div", _extends({}, provided.droppableProps, {
71
- ref: provided.innerRef,
72
+ return ___EmotionJSX(PanelOrDiv, _extends({}, provided.droppableProps, panelOrDivProps, {
72
73
  style: style,
73
74
  "data-test-subj": dataTestSubj,
74
- className: classes
75
+ className: classes,
76
+ css: cssStyles
75
77
  }), ___EmotionJSX(EuiDroppableContext.Provider, {
76
78
  value: {
77
79
  cloneItems: cloneDraggables
78
80
  }
79
81
  }, DroppableElement), ___EmotionJSX("div", {
80
- className: placeholderClasses
82
+ className: "euiDroppable__placeholder",
83
+ hidden: cloneDraggables
81
84
  }, provided.placeholder));
82
85
  });
83
86
  };
@@ -95,7 +98,7 @@ EuiDroppable.propTypes = {
95
98
  /**
96
99
  * Adds padding to the droppable area
97
100
  */
98
- spacing: PropTypes.oneOf(["none", "s", "m", "l"]),
101
+ spacing: PropTypes.any,
99
102
  /**
100
103
  * Adds an EuiPanel style to the droppable area
101
104
  */
@@ -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,21 +1,7 @@
1
- var _excluded = ["query", "incremental", "hint"];
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); }
1
+ var _excluded = ["query", "placeholder", "incremental", "hint"];
3
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); }
4
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; }
5
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; }
6
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
7
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
8
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
9
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
10
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
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 _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
13
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
14
- 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; } }
15
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
16
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
17
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
18
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
19
5
  /*
20
6
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
21
7
  * or more contributor license agreements. Licensed under the Elastic License
@@ -24,90 +10,70 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
24
10
  * Side Public License, v 1.
25
11
  */
26
12
 
27
- import React, { Component } from 'react';
13
+ import React, { useRef } from 'react';
28
14
  import PropTypes from "prop-types";
15
+ import { useUpdateEffect } from '../../services';
16
+ import { useEuiI18n } from '../i18n';
29
17
  import { EuiFieldSearch } from '../form';
30
18
  import { EuiInputPopover } from '../popover';
31
19
  import { jsx as ___EmotionJSX } from "@emotion/react";
32
- export var EuiSearchBox = /*#__PURE__*/function (_Component) {
33
- _inherits(EuiSearchBox, _Component);
34
- var _super = _createSuper(EuiSearchBox);
35
- function EuiSearchBox() {
36
- var _this;
37
- _classCallCheck(this, EuiSearchBox);
38
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
39
- args[_key] = arguments[_key];
20
+ export var EuiSearchBox = function EuiSearchBox(_ref) {
21
+ var query = _ref.query,
22
+ placeholder = _ref.placeholder,
23
+ incremental = _ref.incremental,
24
+ hint = _ref.hint,
25
+ rest = _objectWithoutProperties(_ref, _excluded);
26
+ var _inputRef = useRef(null);
27
+ useUpdateEffect(function () {
28
+ if (_inputRef.current) {
29
+ _inputRef.current.value = query;
30
+ _inputRef.current.dispatchEvent(new Event('change'));
40
31
  }
41
- _this = _super.call.apply(_super, [this].concat(args));
42
- _defineProperty(_assertThisInitialized(_this), "inputElement", null);
43
- return _this;
44
- }
45
- _createClass(EuiSearchBox, [{
46
- key: "componentDidUpdate",
47
- value: function componentDidUpdate(oldProps) {
48
- if (oldProps.query !== this.props.query && this.inputElement != null) {
49
- this.inputElement.value = this.props.query;
50
- this.inputElement.dispatchEvent(new Event('change'));
51
- }
32
+ }, [query]);
33
+ var defaultPlaceholder = useEuiI18n('euiSearchBox.placeholder', 'Search...');
34
+ var ariaLabelIncremental = useEuiI18n('euiSearchBox.incrementalAriaLabel', 'This is a search bar. As you type, the results lower in the page will automatically filter.');
35
+ var ariaLabelEnter = useEuiI18n('euiSearchBox.ariaLabel', 'This is a search bar. After typing your query, hit enter to filter the results lower in the page.');
36
+ var search = ___EmotionJSX(EuiFieldSearch, _extends({
37
+ inputRef: function inputRef(input) {
38
+ return _inputRef.current = input;
39
+ },
40
+ fullWidth: true,
41
+ defaultValue: query,
42
+ incremental: incremental,
43
+ "aria-label": incremental ? ariaLabelIncremental : ariaLabelEnter,
44
+ placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : defaultPlaceholder,
45
+ onFocus: function onFocus() {
46
+ hint === null || hint === void 0 ? void 0 : hint.setIsVisible(true);
52
47
  }
53
- }, {
54
- key: "render",
55
- value: function render() {
56
- var _this2 = this;
57
- var _this$props = this.props,
58
- query = _this$props.query,
59
- incremental = _this$props.incremental,
60
- hint = _this$props.hint,
61
- rest = _objectWithoutProperties(_this$props, _excluded);
62
- var ariaLabel;
63
- if (incremental) {
64
- ariaLabel = 'This is a search bar. As you type, the results lower in the page will automatically filter.';
65
- } else {
66
- ariaLabel = 'This is a search bar. After typing your query, hit enter to filter the results lower in the page.';
67
- }
68
- var search = ___EmotionJSX(EuiFieldSearch, _extends({
69
- inputRef: function inputRef(input) {
70
- return _this2.inputElement = input;
71
- },
72
- fullWidth: true,
73
- defaultValue: query,
74
- incremental: incremental,
75
- "aria-label": ariaLabel,
76
- onFocus: function onFocus() {
77
- hint === null || hint === void 0 ? void 0 : hint.setIsVisible(true);
78
- }
79
- }, rest));
80
- if (hint) {
81
- return ___EmotionJSX(EuiInputPopover, _extends({
82
- disableFocusTrap: true,
83
- input: search,
84
- isOpen: hint.isVisible,
85
- fullWidth: true,
86
- closePopover: function closePopover() {
87
- hint.setIsVisible(false);
88
- },
89
- panelProps: {
90
- 'aria-live': undefined,
91
- 'aria-modal': undefined,
92
- role: undefined,
93
- tabIndex: -1,
94
- id: hint.id
95
- }
96
- }, hint.popoverProps), hint.content);
48
+ }, rest));
49
+ if (hint) {
50
+ return ___EmotionJSX(EuiInputPopover, _extends({
51
+ disableFocusTrap: true,
52
+ input: search,
53
+ isOpen: hint.isVisible,
54
+ fullWidth: true,
55
+ closePopover: function closePopover() {
56
+ hint.setIsVisible(false);
57
+ },
58
+ panelProps: {
59
+ 'aria-live': undefined,
60
+ 'aria-modal': undefined,
61
+ role: undefined,
62
+ tabIndex: -1,
63
+ id: hint.id
97
64
  }
98
- return search;
99
- }
100
- }]);
101
- return EuiSearchBox;
102
- }(Component);
103
- _defineProperty(EuiSearchBox, "defaultProps", {
104
- placeholder: 'Search...',
105
- incremental: false
106
- });
65
+ }, hint.popoverProps), hint.content);
66
+ }
67
+ return search;
68
+ };
107
69
  EuiSearchBox.propTypes = {
108
70
  query: PropTypes.string.isRequired,
109
71
  // This is optional in EuiFieldSearchProps
110
72
  onSearch: PropTypes.func.isRequired,
73
+ /**
74
+ * @default Search...
75
+ */
76
+ placeholder: PropTypes.string,
111
77
  hint: PropTypes.shape({
112
78
  id: PropTypes.string.isRequired,
113
79
  isVisible: PropTypes.bool.isRequired,
@@ -71,6 +71,7 @@ export var EuiTablePagination = function EuiTablePagination(props) {
71
71
  return ___EmotionJSX(EuiContextMenuItem, {
72
72
  key: itemsPerPageOption,
73
73
  icon: itemsPerPageOption === itemsPerPage ? 'check' : 'empty',
74
+ "aria-current": itemsPerPageOption === itemsPerPage ? 'true' : undefined,
74
75
  onClick: function onClick() {
75
76
  closePopover();
76
77
  onChangeItemsPerPage === null || onChangeItemsPerPage === void 0 ? void 0 : onChangeItemsPerPage(itemsPerPageOption);
@@ -16,7 +16,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
16
16
  */
17
17
 
18
18
  import { queries, render, screen, within } from '@testing-library/react';
19
- import { EuiProvider } from '../../components';
19
+ import { EuiProvider } from '../../components/provider';
20
20
  import * as dataTestSubjQueries from './data_test_subj_queries';
21
21
 
22
22
  /**