@elastic/eui 62.0.0 → 62.0.3

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 (70) hide show
  1. package/dist/eui_charts_theme.js +330 -330
  2. package/dist/eui_charts_theme.js.map +1 -1
  3. package/es/components/comment_list/comment_event.js +22 -28
  4. package/es/components/comment_list/comment_event.styles.js +15 -16
  5. package/es/components/filter_group/filter_button.js +3 -1
  6. package/es/components/image/image_caption.js +2 -2
  7. package/es/components/image/image_wrapper.styles.js +1 -1
  8. package/es/components/portal/portal.js +8 -3
  9. package/es/test/rtl/component_helpers.d.ts +7 -0
  10. package/es/test/rtl/component_helpers.js +72 -0
  11. package/es/test/rtl/custom_render.d.ts +74 -0
  12. package/es/test/rtl/custom_render.js +52 -0
  13. package/es/test/rtl/data_test_subj_queries.d.ts +5 -0
  14. package/es/test/rtl/data_test_subj_queries.js +46 -0
  15. package/es/test/rtl/index.d.ts +3 -0
  16. package/es/test/rtl/index.js +10 -0
  17. package/eui.d.ts +88 -6
  18. package/lib/components/comment_list/comment_event.js +29 -26
  19. package/lib/components/comment_list/comment_event.styles.js +15 -16
  20. package/lib/components/filter_group/filter_button.js +3 -1
  21. package/lib/components/image/image_caption.js +2 -2
  22. package/lib/components/image/image_wrapper.styles.js +1 -1
  23. package/lib/components/portal/portal.js +8 -3
  24. package/lib/test/rtl/component_helpers.d.ts +7 -0
  25. package/lib/test/rtl/component_helpers.js +77 -0
  26. package/lib/test/rtl/custom_render.d.ts +74 -0
  27. package/lib/test/rtl/custom_render.js +60 -0
  28. package/lib/test/rtl/data_test_subj_queries.d.ts +5 -0
  29. package/lib/test/rtl/data_test_subj_queries.js +52 -0
  30. package/lib/test/rtl/index.d.ts +3 -0
  31. package/lib/test/rtl/index.js +81 -0
  32. package/optimize/es/components/comment_list/comment_event.js +22 -28
  33. package/optimize/es/components/comment_list/comment_event.styles.js +15 -16
  34. package/optimize/es/components/filter_group/filter_button.js +3 -1
  35. package/optimize/es/components/image/image_caption.js +2 -2
  36. package/optimize/es/components/image/image_wrapper.styles.js +1 -1
  37. package/optimize/es/components/portal/portal.js +8 -3
  38. package/optimize/es/test/rtl/component_helpers.d.ts +7 -0
  39. package/optimize/es/test/rtl/component_helpers.js +71 -0
  40. package/optimize/es/test/rtl/custom_render.d.ts +74 -0
  41. package/optimize/es/test/rtl/custom_render.js +48 -0
  42. package/optimize/es/test/rtl/data_test_subj_queries.d.ts +5 -0
  43. package/optimize/es/test/rtl/data_test_subj_queries.js +36 -0
  44. package/optimize/es/test/rtl/index.d.ts +3 -0
  45. package/optimize/es/test/rtl/index.js +10 -0
  46. package/optimize/lib/components/comment_list/comment_event.js +22 -26
  47. package/optimize/lib/components/comment_list/comment_event.styles.js +15 -16
  48. package/optimize/lib/components/filter_group/filter_button.js +3 -1
  49. package/optimize/lib/components/image/image_caption.js +2 -2
  50. package/optimize/lib/components/image/image_wrapper.styles.js +1 -1
  51. package/optimize/lib/components/portal/portal.js +8 -3
  52. package/optimize/lib/test/rtl/component_helpers.d.ts +7 -0
  53. package/optimize/lib/test/rtl/component_helpers.js +87 -0
  54. package/optimize/lib/test/rtl/custom_render.d.ts +74 -0
  55. package/optimize/lib/test/rtl/custom_render.js +59 -0
  56. package/optimize/lib/test/rtl/data_test_subj_queries.d.ts +5 -0
  57. package/optimize/lib/test/rtl/data_test_subj_queries.js +51 -0
  58. package/optimize/lib/test/rtl/index.d.ts +3 -0
  59. package/optimize/lib/test/rtl/index.js +81 -0
  60. package/package.json +7 -1
  61. package/test-env/components/comment_list/comment_event.js +22 -26
  62. package/test-env/components/comment_list/comment_event.styles.js +15 -16
  63. package/test-env/components/filter_group/filter_button.js +3 -1
  64. package/test-env/components/image/image_caption.js +2 -2
  65. package/test-env/components/image/image_wrapper.styles.js +1 -1
  66. package/test-env/components/portal/portal.js +8 -3
  67. package/test-env/test/rtl/component_helpers.js +87 -0
  68. package/test-env/test/rtl/custom_render.js +59 -0
  69. package/test-env/test/rtl/data_test_subj_queries.js +51 -0
  70. package/test-env/test/rtl/index.js +81 -0
@@ -1,5 +1,3 @@
1
- function _extends() { _extends = Object.assign || 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); }
2
-
3
1
  /*
4
2
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
5
3
  * or more contributor license agreements. Licensed under the Elastic License
@@ -45,14 +43,6 @@ export var EuiCommentEvent = function EuiCommentEvent(_ref) {
45
43
  var cssStyles = [styles.euiCommentEvent, styles[type]];
46
44
  var headerStyles = euiCommentEventHeaderStyles(euiTheme);
47
45
  var cssHeaderStyles = [headerStyles.euiCommentEvent__header, eventColor && headerStyles.hasEventColor, isTypeRegular && headerStyles.regular];
48
- var cssHeaderPanelStyles = headerStyles.euiCommentEvent__headerPanel;
49
- var cssHeaderEventIconStyles = headerStyles.euiCommentEvent__headerEventIcon;
50
- var cssHeaderUsernameStyles = headerStyles.euiCommentEvent__headerUsername;
51
- var cssHeaderEventStyles = headerStyles.euiCommentEvent__headerEvent;
52
- var cssHeaderTimestampStyles = headerStyles.euiCommentEvent__headerTimestamp;
53
- var cssHeaderMainStyles = headerStyles.euiCommentEvent__headerMain;
54
- var cssHeaderDataStyles = headerStyles.euiCommentEvent__headerData;
55
- var cssHeaderActionsStyles = headerStyles.euiCommentEvent__headerActions;
56
46
  var bodyStyles = euiCommentEventBodyStyles(euiTheme);
57
47
  var cssBodyStyles = [bodyStyles.euiCommentEvent__body, bodyStyles[type]];
58
48
  var isFigure = isTypeRegular;
@@ -68,36 +58,40 @@ export var EuiCommentEvent = function EuiCommentEvent(_ref) {
68
58
  color: 'transparent',
69
59
  paddingSize: 'none'
70
60
  };
71
-
72
- var eventHeader = ___EmotionJSX(HeaderElement, {
61
+ return ___EmotionJSX(Element, {
62
+ className: classes,
63
+ css: cssStyles,
64
+ "data-type": type
65
+ }, hasEventElements && ___EmotionJSX(HeaderElement, {
66
+ className: "euiCommentEvent__header",
73
67
  css: cssHeaderStyles
74
- }, ___EmotionJSX(EuiPanel, _extends({}, panelProps, {
75
- css: cssHeaderPanelStyles
76
- }), ___EmotionJSX("div", {
77
- css: cssHeaderMainStyles
68
+ }, ___EmotionJSX(EuiPanel, panelProps, ___EmotionJSX("div", {
69
+ className: "euiCommentEvent__headerMain",
70
+ css: headerStyles.euiCommentEvent__headerMain
78
71
  }, ___EmotionJSX("div", {
79
- css: cssHeaderDataStyles
72
+ className: "euiCommentEvent__headerData",
73
+ css: headerStyles.euiCommentEvent__headerData
80
74
  }, eventIcon && ___EmotionJSX(EuiAvatar, {
81
- css: cssHeaderEventIconStyles,
75
+ className: "euiCommentEvent__headerEventIcon",
76
+ css: headerStyles.euiCommentEvent__headerEventIcon,
82
77
  size: "s",
83
78
  iconType: eventIcon,
84
79
  name: eventIconAriaLabel ? eventIconAriaLabel : '',
85
80
  color: "subdued",
86
81
  "aria-hidden": !eventIconAriaLabel
87
82
  }), username && ___EmotionJSX("div", {
88
- css: cssHeaderUsernameStyles
83
+ className: "euiCommentEvent__headerUsername",
84
+ css: headerStyles.euiCommentEvent__headerUsername
89
85
  }, username), event && ___EmotionJSX("div", {
90
- css: cssHeaderEventStyles
86
+ className: "euiCommentEvent__headerEvent",
87
+ css: headerStyles.euiCommentEvent__headerEvent
91
88
  }, event), timestamp && ___EmotionJSX("div", {
92
- css: cssHeaderTimestampStyles
89
+ className: "euiCommentEvent__headerTimestamp"
93
90
  }, ___EmotionJSX("time", null, timestamp))), actions && ___EmotionJSX("div", {
94
- css: cssHeaderActionsStyles
95
- }, actions))));
96
-
97
- return ___EmotionJSX(Element, {
98
- className: classes,
99
- css: cssStyles
100
- }, hasEventElements && eventHeader, children && ___EmotionJSX("div", {
91
+ className: "euiCommentEvent__headerActions",
92
+ css: headerStyles.euiCommentEvent__headerActions
93
+ }, actions)))), children && ___EmotionJSX("div", {
94
+ className: "euiCommentEvent__body",
101
95
  css: cssBodyStyles
102
96
  }, children));
103
97
  };
@@ -31,20 +31,20 @@ export var euiCommentEventStyles = function euiCommentEventStyles(_ref4) {
31
31
  };
32
32
 
33
33
  var _ref = process.env.NODE_ENV === "production" ? {
34
- name: "bqgcpj-hasEventColor",
35
- styles: "padding:0;label:hasEventColor;"
34
+ name: "ui5tce-euiCommentEvent__headerEvent",
35
+ styles: "align-items:center;display:inline-flex;white-space:pre-wrap;flex-wrap:wrap;label:euiCommentEvent__headerEvent;"
36
36
  } : {
37
- name: "bqgcpj-hasEventColor",
38
- styles: "padding:0;label:hasEventColor;",
37
+ name: "ui5tce-euiCommentEvent__headerEvent",
38
+ styles: "align-items:center;display:inline-flex;white-space:pre-wrap;flex-wrap:wrap;label:euiCommentEvent__headerEvent;",
39
39
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
40
40
  };
41
41
 
42
42
  var _ref2 = process.env.NODE_ENV === "production" ? {
43
- name: "ui5tce-euiCommentEvent__headerEvent",
44
- styles: "align-items:center;display:inline-flex;white-space:pre-wrap;flex-wrap:wrap;label:euiCommentEvent__headerEvent;"
43
+ name: "bqgcpj-hasEventColor",
44
+ styles: "padding:0;label:hasEventColor;"
45
45
  } : {
46
- name: "ui5tce-euiCommentEvent__headerEvent",
47
- styles: "align-items:center;display:inline-flex;white-space:pre-wrap;flex-wrap:wrap;label:euiCommentEvent__headerEvent;",
46
+ name: "bqgcpj-hasEventColor",
47
+ styles: "padding:0;label:hasEventColor;",
48
48
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
49
49
  };
50
50
 
@@ -52,18 +52,17 @@ export var euiCommentEventHeaderStyles = function euiCommentEventHeaderStyles(_r
52
52
  var euiTheme = _ref5.euiTheme;
53
53
  return {
54
54
  euiCommentEvent__header: /*#__PURE__*/css(";label:euiCommentEvent__header;"),
55
- euiCommentEvent__headerPanel: /*#__PURE__*/css(";label:euiCommentEvent__headerPanel;"),
55
+ // types
56
+ regular: /*#__PURE__*/css("background:", euiTheme.colors.lightestShade, ";border-bottom:", euiTheme.border.thin, ";padding:", euiTheme.size.s, ";;label:regular;"),
57
+ // variants
58
+ hasEventColor: _ref2,
59
+ // Children
56
60
  euiCommentEvent__headerMain: /*#__PURE__*/css("display:flex;flex:1;gap:", euiTheme.size.s, ";;label:euiCommentEvent__headerMain;"),
57
61
  euiCommentEvent__headerData: /*#__PURE__*/css("display:flex;flex:1;align-items:center;flex-wrap:wrap;gap:", euiTheme.size.xs, ";;label:euiCommentEvent__headerData;"),
58
62
  euiCommentEvent__headerEventIcon: /*#__PURE__*/css(logicalCSS('margin-right', euiTheme.size.xs), ";;label:euiCommentEvent__headerEventIcon;"),
59
63
  euiCommentEvent__headerUsername: /*#__PURE__*/css("font-weight:", euiTheme.font.weight.semiBold, ";;label:euiCommentEvent__headerUsername;"),
60
- euiCommentEvent__headerEvent: _ref2,
61
- euiCommentEvent__headerTimestamp: /*#__PURE__*/css(";label:euiCommentEvent__headerTimestamp;"),
62
- euiCommentEvent__headerActions: /*#__PURE__*/css("display:flex;flex-wrap:wrap;gap:", euiTheme.size.xs, ";;label:euiCommentEvent__headerActions;"),
63
- // types
64
- regular: /*#__PURE__*/css("background:", euiTheme.colors.lightestShade, ";border-bottom:", euiTheme.border.thin, ";padding:", euiTheme.size.s, ";;label:regular;"),
65
- // variants
66
- hasEventColor: _ref
64
+ euiCommentEvent__headerEvent: _ref,
65
+ euiCommentEvent__headerActions: /*#__PURE__*/css("display:flex;flex-wrap:wrap;gap:", euiTheme.size.xs, ";;label:euiCommentEvent__headerActions;")
67
66
  };
68
67
  };
69
68
  export var euiCommentEventBodyStyles = function euiCommentEventBodyStyles(_ref6) {
@@ -86,7 +86,9 @@ export var EuiFilterButton = function EuiFilterButton(_ref) {
86
86
  var badgeContent = showBadge && ___EmotionJSX(EuiNotificationBadge, {
87
87
  className: "euiFilterButton__notification",
88
88
  "aria-label": hasActiveFilters ? activeBadgeLabel : availableBadgeLabel,
89
- color: isDisabled || !hasActiveFilters ? 'subdued' : 'accent'
89
+ color: isDisabled || !hasActiveFilters ? 'subdued' : 'accent',
90
+ role: "marquee" // https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/marquee_role
91
+
90
92
  }, badgeCount);
91
93
 
92
94
  var dataText;
@@ -17,10 +17,10 @@ export var EuiImageCaption = /*#__PURE__*/forwardRef(function (_ref, ref) {
17
17
  var euiTheme = useEuiTheme();
18
18
  var styles = euiImageCaptionStyles(euiTheme);
19
19
  var cssStyles = [styles.euiImageCaption, isOnOverlayMask && styles.isOnOverlayMask];
20
- return ___EmotionJSX("figcaption", {
20
+ return caption ? ___EmotionJSX("figcaption", {
21
21
  ref: ref,
22
22
  css: cssStyles
23
- }, caption);
23
+ }, caption) : null;
24
24
  });
25
25
  EuiImageCaption.propTypes = {
26
26
  isOnOverlayMask: PropTypes.bool
@@ -23,7 +23,7 @@ export var euiImageWrapperStyles = function euiImageWrapperStyles(euiThemeContex
23
23
  var euiTheme = euiThemeContext.euiTheme;
24
24
  return {
25
25
  // Base
26
- euiImageWrapper: /*#__PURE__*/css("display:table;", logicalCSS('max-width', '100%'), " ", logicalTextAlignCSS('center'), ";line-height:0;flex-shrink:0;;label:euiImageWrapper;"),
26
+ euiImageWrapper: /*#__PURE__*/css("display:inline-block;", logicalCSS('max-width', '100%'), " ", logicalTextAlignCSS('center'), ";line-height:0;flex-shrink:0;;label:euiImageWrapper;"),
27
27
  allowFullScreen: _ref,
28
28
  // Margins
29
29
  s: /*#__PURE__*/css("margin:", euiTheme.size.s, ";;label:s;"),
@@ -55,10 +55,13 @@ export var EuiPortal = /*#__PURE__*/function (_Component) {
55
55
 
56
56
  _this = _super.call(this, props);
57
57
 
58
- _defineProperty(_assertThisInitialized(_this), "portalNode", void 0);
58
+ _defineProperty(_assertThisInitialized(_this), "portalNode", null);
59
+
60
+ if (typeof window === 'undefined') return _possibleConstructorReturn(_this); // Prevent SSR errors
59
61
 
60
62
  var insert = _this.props.insert;
61
63
  _this.portalNode = document.createElement('div');
64
+ _this.portalNode.dataset.euiportal = 'true';
62
65
 
63
66
  if (insert == null) {
64
67
  // no insertion defined, append to body
@@ -81,7 +84,9 @@ export var EuiPortal = /*#__PURE__*/function (_Component) {
81
84
  }, {
82
85
  key: "componentWillUnmount",
83
86
  value: function componentWillUnmount() {
84
- if (this.portalNode.parentNode) {
87
+ var _this$portalNode;
88
+
89
+ if ((_this$portalNode = this.portalNode) !== null && _this$portalNode !== void 0 && _this$portalNode.parentNode) {
85
90
  this.portalNode.parentNode.removeChild(this.portalNode);
86
91
  }
87
92
 
@@ -97,7 +102,7 @@ export var EuiPortal = /*#__PURE__*/function (_Component) {
97
102
  }, {
98
103
  key: "render",
99
104
  value: function render() {
100
- return /*#__PURE__*/createPortal(this.props.children, this.portalNode);
105
+ return this.portalNode ? /*#__PURE__*/createPortal(this.props.children, this.portalNode) : null;
101
106
  }
102
107
  }]);
103
108
 
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Ensure the EuiPopover being tested is open/closed before contiuning
3
+ * Note: Because EuiPopover is portalled, we want to query `document`
4
+ * instead of the `container` returned by RTL's render()
5
+ */
6
+ export declare const waitForEuiPopoverOpen: () => Promise<void>;
7
+ export declare const waitForEuiPopoverClose: () => Promise<void>;
@@ -0,0 +1,72 @@
1
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
2
+
3
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
4
+
5
+ /*
6
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
7
+ * or more contributor license agreements. Licensed under the Elastic License
8
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
9
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
10
+ * Side Public License, v 1.
11
+ */
12
+ import { waitFor } from '@testing-library/react';
13
+ /**
14
+ * Ensure the EuiPopover being tested is open/closed before contiuning
15
+ * Note: Because EuiPopover is portalled, we want to query `document`
16
+ * instead of the `container` returned by RTL's render()
17
+ */
18
+
19
+ export var waitForEuiPopoverOpen = /*#__PURE__*/function () {
20
+ var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
21
+ return regeneratorRuntime.wrap(function _callee$(_context) {
22
+ while (1) {
23
+ switch (_context.prev = _context.next) {
24
+ case 0:
25
+ _context.next = 2;
26
+ return waitFor(function () {
27
+ var openPopover = document.querySelector('[data-popover-open]');
28
+ expect(openPopover).toBeTruthy();
29
+ });
30
+
31
+ case 2:
32
+ return _context.abrupt("return", _context.sent);
33
+
34
+ case 3:
35
+ case "end":
36
+ return _context.stop();
37
+ }
38
+ }
39
+ }, _callee);
40
+ }));
41
+
42
+ return function waitForEuiPopoverOpen() {
43
+ return _ref.apply(this, arguments);
44
+ };
45
+ }();
46
+ export var waitForEuiPopoverClose = /*#__PURE__*/function () {
47
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
48
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
49
+ while (1) {
50
+ switch (_context2.prev = _context2.next) {
51
+ case 0:
52
+ _context2.next = 2;
53
+ return waitFor(function () {
54
+ var openPopover = document.querySelector('[data-popover-open]');
55
+ expect(openPopover).toBeFalsy();
56
+ });
57
+
58
+ case 2:
59
+ return _context2.abrupt("return", _context2.sent);
60
+
61
+ case 3:
62
+ case "end":
63
+ return _context2.stop();
64
+ }
65
+ }
66
+ }, _callee2);
67
+ }));
68
+
69
+ return function waitForEuiPopoverClose() {
70
+ return _ref2.apply(this, arguments);
71
+ };
72
+ }();
@@ -0,0 +1,74 @@
1
+ import { ReactElement } from 'react';
2
+ import { queries, RenderOptions, Screen } from '@testing-library/react';
3
+ import * as dataTestSubjQueries from './data_test_subj_queries';
4
+ /**
5
+ * Custom render() fn with EuiProvider and query helpers
6
+ *
7
+ * @see https://testing-library.com/docs/react-testing-library/setup#custom-render
8
+ * @see https://testing-library.com/docs/react-testing-library/setup#add-custom-queries
9
+ */
10
+ declare const customRender: (ui: ReactElement, { queries: renderQueries, ...options }?: RenderOptions) => import("@testing-library/react").RenderResult<{
11
+ getByLabelText: typeof queries.getByLabelText;
12
+ getAllByLabelText: typeof queries.getAllByLabelText;
13
+ queryByLabelText: typeof queries.queryByLabelText;
14
+ queryAllByLabelText: typeof queries.queryAllByLabelText;
15
+ findByLabelText: typeof queries.findByLabelText;
16
+ findAllByLabelText: typeof queries.findAllByLabelText;
17
+ getByPlaceholderText: typeof queries.getByPlaceholderText;
18
+ getAllByPlaceholderText: typeof queries.getAllByPlaceholderText;
19
+ queryByPlaceholderText: typeof queries.queryByPlaceholderText;
20
+ queryAllByPlaceholderText: typeof queries.queryAllByPlaceholderText;
21
+ findByPlaceholderText: typeof queries.findByPlaceholderText;
22
+ findAllByPlaceholderText: typeof queries.findAllByPlaceholderText;
23
+ getByText: typeof queries.getByText;
24
+ getAllByText: typeof queries.getAllByText;
25
+ queryByText: typeof queries.queryByText;
26
+ queryAllByText: typeof queries.queryAllByText;
27
+ findByText: typeof queries.findByText;
28
+ findAllByText: typeof queries.findAllByText;
29
+ getByAltText: typeof queries.getByAltText;
30
+ getAllByAltText: typeof queries.getAllByAltText;
31
+ queryByAltText: typeof queries.queryByAltText;
32
+ queryAllByAltText: typeof queries.queryAllByAltText;
33
+ findByAltText: typeof queries.findByAltText;
34
+ findAllByAltText: typeof queries.findAllByAltText;
35
+ getByTitle: typeof queries.getByTitle;
36
+ getAllByTitle: typeof queries.getAllByTitle;
37
+ queryByTitle: typeof queries.queryByTitle;
38
+ queryAllByTitle: typeof queries.queryAllByTitle;
39
+ findByTitle: typeof queries.findByTitle;
40
+ findAllByTitle: typeof queries.findAllByTitle;
41
+ getByDisplayValue: typeof queries.getByDisplayValue;
42
+ getAllByDisplayValue: typeof queries.getAllByDisplayValue;
43
+ queryByDisplayValue: typeof queries.queryByDisplayValue;
44
+ queryAllByDisplayValue: typeof queries.queryAllByDisplayValue;
45
+ findByDisplayValue: typeof queries.findByDisplayValue;
46
+ findAllByDisplayValue: typeof queries.findAllByDisplayValue;
47
+ getByRole: typeof queries.getByRole;
48
+ getAllByRole: typeof queries.getAllByRole;
49
+ queryByRole: typeof queries.queryByRole;
50
+ queryAllByRole: typeof queries.queryAllByRole;
51
+ findByRole: typeof queries.findByRole;
52
+ findAllByRole: typeof queries.findAllByRole;
53
+ getByTestId: typeof queries.getByTestId;
54
+ getAllByTestId: typeof queries.getAllByTestId;
55
+ queryByTestId: typeof queries.queryByTestId;
56
+ queryAllByTestId: typeof queries.queryAllByTestId;
57
+ findByTestId: typeof queries.findByTestId;
58
+ findAllByTestId: typeof queries.findAllByTestId;
59
+ queryByTestSubject: import("@testing-library/react").QueryBy<[import("@testing-library/react").Matcher]>;
60
+ queryAllByTestSubject: (container: HTMLElement, id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
61
+ getByTestSubject: import("@testing-library/react").GetBy<[import("@testing-library/react").Matcher]>;
62
+ getAllByTestSubject: import("@testing-library/react").GetAllBy<[import("@testing-library/react").Matcher]>;
63
+ findAllByTestSubject: import("@testing-library/react").FindAllBy<[import("@testing-library/react").Matcher]>;
64
+ findByTestSubject: import("@testing-library/react").FindBy<[import("@testing-library/react").Matcher]>;
65
+ }, HTMLElement, HTMLElement>;
66
+ export { customRender as render };
67
+ /**
68
+ * Custom screen util with EUI query helpers
69
+ *
70
+ * @see https://testing-library.com/docs/queries/about/#screen
71
+ * @see https://github.com/testing-library/dom-testing-library/issues/516
72
+ */
73
+ declare const customScreen: Screen<typeof queries & typeof dataTestSubjQueries>;
74
+ export { customScreen as screen };
@@ -0,0 +1,52 @@
1
+ var _excluded = ["queries"];
2
+
3
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
4
+
5
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
6
+
7
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
+
9
+ 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; }
10
+
11
+ 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; }
12
+
13
+ /*
14
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
15
+ * or more contributor license agreements. Licensed under the Elastic License
16
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
17
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
18
+ * Side Public License, v 1.
19
+ */
20
+ import { queries, render, screen, within } from '@testing-library/react';
21
+ import { EuiProvider } from '../../components';
22
+ import * as dataTestSubjQueries from './data_test_subj_queries';
23
+ /**
24
+ * Custom render() fn with EuiProvider and query helpers
25
+ *
26
+ * @see https://testing-library.com/docs/react-testing-library/setup#custom-render
27
+ * @see https://testing-library.com/docs/react-testing-library/setup#add-custom-queries
28
+ */
29
+
30
+ var customRender = function customRender(ui) {
31
+ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
32
+
33
+ var renderQueries = _ref.queries,
34
+ options = _objectWithoutProperties(_ref, _excluded);
35
+
36
+ return render(ui, _objectSpread({
37
+ queries: _objectSpread(_objectSpread(_objectSpread({}, queries), dataTestSubjQueries), renderQueries || {}),
38
+ wrapper: EuiProvider
39
+ }, options));
40
+ };
41
+
42
+ export { customRender as render };
43
+ /**
44
+ * Custom screen util with EUI query helpers
45
+ *
46
+ * @see https://testing-library.com/docs/queries/about/#screen
47
+ * @see https://github.com/testing-library/dom-testing-library/issues/516
48
+ */
49
+
50
+ var customScreen = _objectSpread(_objectSpread({}, screen), within(document.body, dataTestSubjQueries));
51
+
52
+ export { customScreen as screen };
@@ -0,0 +1,5 @@
1
+ import type { Matcher, MatcherOptions } from '@testing-library/react';
2
+ import { queryHelpers } from '@testing-library/react';
3
+ declare const queryAllByTestSubject: (container: HTMLElement, id: Matcher, options?: MatcherOptions | undefined) => HTMLElement[];
4
+ declare const queryByTestSubject: queryHelpers.QueryBy<[Matcher]>, getAllByTestSubject: queryHelpers.GetAllBy<[Matcher]>, getByTestSubject: queryHelpers.GetBy<[Matcher]>, findAllByTestSubject: queryHelpers.FindAllBy<[Matcher]>, findByTestSubject: queryHelpers.FindBy<[Matcher]>;
5
+ export { queryByTestSubject, queryAllByTestSubject, getByTestSubject, getAllByTestSubject, findAllByTestSubject, findByTestSubject, };
@@ -0,0 +1,46 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+
3
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
+
7
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
8
+
9
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
+
11
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+
13
+ /*
14
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
15
+ * or more contributor license agreements. Licensed under the Elastic License
16
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
17
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
18
+ * Side Public License, v 1.
19
+ */
20
+ import { queryHelpers, buildQueries } from '@testing-library/react';
21
+
22
+ var queryAllByTestSubject = function queryAllByTestSubject() {
23
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
24
+ args[_key] = arguments[_key];
25
+ }
26
+
27
+ return queryHelpers.queryAllByAttribute.apply(queryHelpers, ['data-test-subj'].concat(args));
28
+ };
29
+
30
+ var getMultipleError = function getMultipleError(_, TestSubjectValue) {
31
+ return "Found multiple elements with the data-test-subj attribute of: ".concat(TestSubjectValue);
32
+ };
33
+
34
+ var getMissingError = function getMissingError(_, TestSubjectValue) {
35
+ return "Unable to find an element with the data-test-subj attribute of: ".concat(TestSubjectValue);
36
+ };
37
+
38
+ var _buildQueries = buildQueries(queryAllByTestSubject, getMultipleError, getMissingError),
39
+ _buildQueries2 = _slicedToArray(_buildQueries, 5),
40
+ queryByTestSubject = _buildQueries2[0],
41
+ getAllByTestSubject = _buildQueries2[1],
42
+ getByTestSubject = _buildQueries2[2],
43
+ findAllByTestSubject = _buildQueries2[3],
44
+ findByTestSubject = _buildQueries2[4];
45
+
46
+ export { queryByTestSubject, queryAllByTestSubject, getByTestSubject, getAllByTestSubject, findAllByTestSubject, findByTestSubject };
@@ -0,0 +1,3 @@
1
+ export * from './component_helpers';
2
+ export { queryByTestSubject, queryAllByTestSubject, getByTestSubject, getAllByTestSubject, findAllByTestSubject, findByTestSubject, } from './data_test_subj_queries';
3
+ export { render, screen } from './custom_render';
@@ -0,0 +1,10 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
5
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
6
+ * Side Public License, v 1.
7
+ */
8
+ export * from './component_helpers';
9
+ export { queryByTestSubject, queryAllByTestSubject, getByTestSubject, getAllByTestSubject, findAllByTestSubject, findByTestSubject } from './data_test_subj_queries';
10
+ export { render, screen } from './custom_render';
package/eui.d.ts CHANGED
@@ -4630,12 +4630,12 @@ declare module '@elastic/eui/src/components/portal/portal' {
4630
4630
  portalRef?: (ref: HTMLDivElement | null) => void;
4631
4631
  }
4632
4632
  export class EuiPortal extends Component<EuiPortalProps> {
4633
- portalNode: HTMLDivElement;
4633
+ portalNode: HTMLDivElement | null;
4634
4634
  constructor(props: EuiPortalProps);
4635
4635
  componentDidMount(): void;
4636
4636
  componentWillUnmount(): void;
4637
4637
  updatePortalRef(ref: HTMLDivElement | null): void;
4638
- render(): import("react").ReactPortal;
4638
+ render(): import("react").ReactPortal | null;
4639
4639
  }
4640
4640
  export {};
4641
4641
 
@@ -9285,16 +9285,14 @@ declare module '@elastic/eui/src/components/comment_list/comment_event.styles' {
9285
9285
  };
9286
9286
  export const euiCommentEventHeaderStyles: ({ euiTheme }: UseEuiTheme) => {
9287
9287
  euiCommentEvent__header: import("@emotion/utils").SerializedStyles;
9288
- euiCommentEvent__headerPanel: import("@emotion/utils").SerializedStyles;
9288
+ regular: import("@emotion/utils").SerializedStyles;
9289
+ hasEventColor: import("@emotion/utils").SerializedStyles;
9289
9290
  euiCommentEvent__headerMain: import("@emotion/utils").SerializedStyles;
9290
9291
  euiCommentEvent__headerData: import("@emotion/utils").SerializedStyles;
9291
9292
  euiCommentEvent__headerEventIcon: import("@emotion/utils").SerializedStyles;
9292
9293
  euiCommentEvent__headerUsername: import("@emotion/utils").SerializedStyles;
9293
9294
  euiCommentEvent__headerEvent: import("@emotion/utils").SerializedStyles;
9294
- euiCommentEvent__headerTimestamp: import("@emotion/utils").SerializedStyles;
9295
9295
  euiCommentEvent__headerActions: import("@emotion/utils").SerializedStyles;
9296
- regular: import("@emotion/utils").SerializedStyles;
9297
- hasEventColor: import("@emotion/utils").SerializedStyles;
9298
9296
  };
9299
9297
  export const euiCommentEventBodyStyles: ({ euiTheme }: UseEuiTheme) => {
9300
9298
  euiCommentEvent__body: import("@emotion/utils").SerializedStyles;
@@ -23441,6 +23439,90 @@ declare module 'mdast-util-to-hast/lib/all' {
23441
23439
  const all: (h: H, node: Node) => Node[];
23442
23440
  export = all;
23443
23441
  }
23442
+ declare module '@elastic/eui/src/test/rtl/component_helpers' {
23443
+ /**
23444
+ * Ensure the EuiPopover being tested is open/closed before contiuning
23445
+ * Note: Because EuiPopover is portalled, we want to query `document`
23446
+ * instead of the `container` returned by RTL's render()
23447
+ */
23448
+ export const waitForEuiPopoverOpen: () => Promise<void>;
23449
+ export const waitForEuiPopoverClose: () => Promise<void>;
23450
+
23451
+ }
23452
+ declare module '@elastic/eui/src/test/rtl/data_test_subj_queries' {
23453
+ import { queryHelpers, Matcher, MatcherOptions } from '@testing-library/react'; const queryAllByTestSubject: (container: HTMLElement, id: Matcher, options?: MatcherOptions | undefined) => HTMLElement[]; const queryByTestSubject: queryHelpers.QueryBy<[Matcher]>, getAllByTestSubject: queryHelpers.GetAllBy<[Matcher]>, getByTestSubject: queryHelpers.GetBy<[Matcher]>, findAllByTestSubject: queryHelpers.FindAllBy<[Matcher]>, findByTestSubject: queryHelpers.FindBy<[Matcher]>;
23454
+ export { queryByTestSubject, queryAllByTestSubject, getByTestSubject, getAllByTestSubject, findAllByTestSubject, findByTestSubject, };
23455
+
23456
+ }
23457
+ declare module '@elastic/eui/src/test/rtl/custom_render' {
23458
+ import { ReactElement } from 'react';
23459
+ import { queries, RenderOptions, Screen } from '@testing-library/react';
23460
+ import * as dataTestSubjQueries from '@elastic/eui/src/test/rtl/data_test_subj_queries'; const customRender: (ui: ReactElement, { queries: renderQueries, ...options }?: RenderOptions) => import("@testing-library/react").RenderResult<{
23461
+ getByLabelText: typeof queries.getByLabelText;
23462
+ getAllByLabelText: typeof queries.getAllByLabelText;
23463
+ queryByLabelText: typeof queries.queryByLabelText;
23464
+ queryAllByLabelText: typeof queries.queryAllByLabelText;
23465
+ findByLabelText: typeof queries.findByLabelText;
23466
+ findAllByLabelText: typeof queries.findAllByLabelText;
23467
+ getByPlaceholderText: typeof queries.getByPlaceholderText;
23468
+ getAllByPlaceholderText: typeof queries.getAllByPlaceholderText;
23469
+ queryByPlaceholderText: typeof queries.queryByPlaceholderText;
23470
+ queryAllByPlaceholderText: typeof queries.queryAllByPlaceholderText;
23471
+ findByPlaceholderText: typeof queries.findByPlaceholderText;
23472
+ findAllByPlaceholderText: typeof queries.findAllByPlaceholderText;
23473
+ getByText: typeof queries.getByText;
23474
+ getAllByText: typeof queries.getAllByText;
23475
+ queryByText: typeof queries.queryByText;
23476
+ queryAllByText: typeof queries.queryAllByText;
23477
+ findByText: typeof queries.findByText;
23478
+ findAllByText: typeof queries.findAllByText;
23479
+ getByAltText: typeof queries.getByAltText;
23480
+ getAllByAltText: typeof queries.getAllByAltText;
23481
+ queryByAltText: typeof queries.queryByAltText;
23482
+ queryAllByAltText: typeof queries.queryAllByAltText;
23483
+ findByAltText: typeof queries.findByAltText;
23484
+ findAllByAltText: typeof queries.findAllByAltText;
23485
+ getByTitle: typeof queries.getByTitle;
23486
+ getAllByTitle: typeof queries.getAllByTitle;
23487
+ queryByTitle: typeof queries.queryByTitle;
23488
+ queryAllByTitle: typeof queries.queryAllByTitle;
23489
+ findByTitle: typeof queries.findByTitle;
23490
+ findAllByTitle: typeof queries.findAllByTitle;
23491
+ getByDisplayValue: typeof queries.getByDisplayValue;
23492
+ getAllByDisplayValue: typeof queries.getAllByDisplayValue;
23493
+ queryByDisplayValue: typeof queries.queryByDisplayValue;
23494
+ queryAllByDisplayValue: typeof queries.queryAllByDisplayValue;
23495
+ findByDisplayValue: typeof queries.findByDisplayValue;
23496
+ findAllByDisplayValue: typeof queries.findAllByDisplayValue;
23497
+ getByRole: typeof queries.getByRole;
23498
+ getAllByRole: typeof queries.getAllByRole;
23499
+ queryByRole: typeof queries.queryByRole;
23500
+ queryAllByRole: typeof queries.queryAllByRole;
23501
+ findByRole: typeof queries.findByRole;
23502
+ findAllByRole: typeof queries.findAllByRole;
23503
+ getByTestId: typeof queries.getByTestId;
23504
+ getAllByTestId: typeof queries.getAllByTestId;
23505
+ queryByTestId: typeof queries.queryByTestId;
23506
+ queryAllByTestId: typeof queries.queryAllByTestId;
23507
+ findByTestId: typeof queries.findByTestId;
23508
+ findAllByTestId: typeof queries.findAllByTestId;
23509
+ queryByTestSubject: import("@testing-library/react").QueryBy<[import("@testing-library/react").Matcher]>;
23510
+ queryAllByTestSubject: (container: HTMLElement, id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
23511
+ getByTestSubject: import("@testing-library/react").GetBy<[import("@testing-library/react").Matcher]>;
23512
+ getAllByTestSubject: import("@testing-library/react").GetAllBy<[import("@testing-library/react").Matcher]>;
23513
+ findAllByTestSubject: import("@testing-library/react").FindAllBy<[import("@testing-library/react").Matcher]>;
23514
+ findByTestSubject: import("@testing-library/react").FindBy<[import("@testing-library/react").Matcher]>;
23515
+ }, HTMLElement, HTMLElement>;
23516
+ export { customRender as render }; const customScreen: Screen<typeof queries & typeof dataTestSubjQueries>;
23517
+ export { customScreen as screen };
23518
+
23519
+ }
23520
+ declare module '@elastic/eui/src/test/rtl' {
23521
+ export * from '@elastic/eui/src/test/rtl/component_helpers';
23522
+ export { queryByTestSubject, queryAllByTestSubject, getByTestSubject, getAllByTestSubject, findAllByTestSubject, findByTestSubject, } from '@elastic/eui/src/test/rtl/data_test_subj_queries';
23523
+ export { render, screen } from '@elastic/eui/src/test/rtl/custom_render';
23524
+
23525
+ }
23444
23526
  declare module '@elastic/eui/src/components/table/mobile' {
23445
23527
  export { EuiTableHeaderMobile } from '@elastic/eui/src/components/table/mobile/table_header_mobile';
23446
23528
  export type { EuiTableSortMobileProps } from '@elastic/eui/src/components/table/mobile/table_sort_mobile';