@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
- import _extends from "@babel/runtime/helpers/extends";
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
@@ -44,14 +42,6 @@ export var EuiCommentEvent = function EuiCommentEvent(_ref) {
44
42
  var cssStyles = [styles.euiCommentEvent, styles[type]];
45
43
  var headerStyles = euiCommentEventHeaderStyles(euiTheme);
46
44
  var cssHeaderStyles = [headerStyles.euiCommentEvent__header, eventColor && headerStyles.hasEventColor, isTypeRegular && headerStyles.regular];
47
- var cssHeaderPanelStyles = headerStyles.euiCommentEvent__headerPanel;
48
- var cssHeaderEventIconStyles = headerStyles.euiCommentEvent__headerEventIcon;
49
- var cssHeaderUsernameStyles = headerStyles.euiCommentEvent__headerUsername;
50
- var cssHeaderEventStyles = headerStyles.euiCommentEvent__headerEvent;
51
- var cssHeaderTimestampStyles = headerStyles.euiCommentEvent__headerTimestamp;
52
- var cssHeaderMainStyles = headerStyles.euiCommentEvent__headerMain;
53
- var cssHeaderDataStyles = headerStyles.euiCommentEvent__headerData;
54
- var cssHeaderActionsStyles = headerStyles.euiCommentEvent__headerActions;
55
45
  var bodyStyles = euiCommentEventBodyStyles(euiTheme);
56
46
  var cssBodyStyles = [bodyStyles.euiCommentEvent__body, bodyStyles[type]];
57
47
  var isFigure = isTypeRegular;
@@ -67,36 +57,40 @@ export var EuiCommentEvent = function EuiCommentEvent(_ref) {
67
57
  color: 'transparent',
68
58
  paddingSize: 'none'
69
59
  };
70
-
71
- var eventHeader = ___EmotionJSX(HeaderElement, {
60
+ return ___EmotionJSX(Element, {
61
+ className: classes,
62
+ css: cssStyles,
63
+ "data-type": type
64
+ }, hasEventElements && ___EmotionJSX(HeaderElement, {
65
+ className: "euiCommentEvent__header",
72
66
  css: cssHeaderStyles
73
- }, ___EmotionJSX(EuiPanel, _extends({}, panelProps, {
74
- css: cssHeaderPanelStyles
75
- }), ___EmotionJSX("div", {
76
- css: cssHeaderMainStyles
67
+ }, ___EmotionJSX(EuiPanel, panelProps, ___EmotionJSX("div", {
68
+ className: "euiCommentEvent__headerMain",
69
+ css: headerStyles.euiCommentEvent__headerMain
77
70
  }, ___EmotionJSX("div", {
78
- css: cssHeaderDataStyles
71
+ className: "euiCommentEvent__headerData",
72
+ css: headerStyles.euiCommentEvent__headerData
79
73
  }, eventIcon && ___EmotionJSX(EuiAvatar, {
80
- css: cssHeaderEventIconStyles,
74
+ className: "euiCommentEvent__headerEventIcon",
75
+ css: headerStyles.euiCommentEvent__headerEventIcon,
81
76
  size: "s",
82
77
  iconType: eventIcon,
83
78
  name: eventIconAriaLabel ? eventIconAriaLabel : '',
84
79
  color: "subdued",
85
80
  "aria-hidden": !eventIconAriaLabel
86
81
  }), username && ___EmotionJSX("div", {
87
- css: cssHeaderUsernameStyles
82
+ className: "euiCommentEvent__headerUsername",
83
+ css: headerStyles.euiCommentEvent__headerUsername
88
84
  }, username), event && ___EmotionJSX("div", {
89
- css: cssHeaderEventStyles
85
+ className: "euiCommentEvent__headerEvent",
86
+ css: headerStyles.euiCommentEvent__headerEvent
90
87
  }, event), timestamp && ___EmotionJSX("div", {
91
- css: cssHeaderTimestampStyles
88
+ className: "euiCommentEvent__headerTimestamp"
92
89
  }, ___EmotionJSX("time", null, timestamp))), actions && ___EmotionJSX("div", {
93
- css: cssHeaderActionsStyles
94
- }, actions))));
95
-
96
- return ___EmotionJSX(Element, {
97
- className: classes,
98
- css: cssStyles
99
- }, hasEventElements && eventHeader, children && ___EmotionJSX("div", {
90
+ className: "euiCommentEvent__headerActions",
91
+ css: headerStyles.euiCommentEvent__headerActions
92
+ }, actions)))), children && ___EmotionJSX("div", {
93
+ className: "euiCommentEvent__body",
100
94
  css: cssBodyStyles
101
95
  }, children));
102
96
  };
@@ -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) {
@@ -69,7 +69,9 @@ export var EuiFilterButton = function EuiFilterButton(_ref) {
69
69
  var badgeContent = showBadge && ___EmotionJSX(EuiNotificationBadge, {
70
70
  className: "euiFilterButton__notification",
71
71
  "aria-label": hasActiveFilters ? activeBadgeLabel : availableBadgeLabel,
72
- color: isDisabled || !hasActiveFilters ? 'subdued' : 'accent'
72
+ color: isDisabled || !hasActiveFilters ? 'subdued' : 'accent',
73
+ role: "marquee" // https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/marquee_role
74
+
73
75
  }, badgeCount);
74
76
 
75
77
  var dataText;
@@ -16,9 +16,9 @@ export var EuiImageCaption = /*#__PURE__*/forwardRef(function (_ref, ref) {
16
16
  var euiTheme = useEuiTheme();
17
17
  var styles = euiImageCaptionStyles(euiTheme);
18
18
  var cssStyles = [styles.euiImageCaption, isOnOverlayMask && styles.isOnOverlayMask];
19
- return ___EmotionJSX("figcaption", {
19
+ return caption ? ___EmotionJSX("figcaption", {
20
20
  ref: ref,
21
21
  css: cssStyles
22
- }, caption);
22
+ }, caption) : null;
23
23
  });
24
24
  EuiImageCaption.displayName = 'EuiImageCaption';
@@ -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;"),
@@ -42,10 +42,13 @@ export var EuiPortal = /*#__PURE__*/function (_Component) {
42
42
 
43
43
  _this = _super.call(this, props);
44
44
 
45
- _defineProperty(_assertThisInitialized(_this), "portalNode", void 0);
45
+ _defineProperty(_assertThisInitialized(_this), "portalNode", null);
46
+
47
+ if (typeof window === 'undefined') return _possibleConstructorReturn(_this); // Prevent SSR errors
46
48
 
47
49
  var insert = _this.props.insert;
48
50
  _this.portalNode = document.createElement('div');
51
+ _this.portalNode.dataset.euiportal = 'true';
49
52
 
50
53
  if (insert == null) {
51
54
  // no insertion defined, append to body
@@ -68,7 +71,9 @@ export var EuiPortal = /*#__PURE__*/function (_Component) {
68
71
  }, {
69
72
  key: "componentWillUnmount",
70
73
  value: function componentWillUnmount() {
71
- if (this.portalNode.parentNode) {
74
+ var _this$portalNode;
75
+
76
+ if ((_this$portalNode = this.portalNode) !== null && _this$portalNode !== void 0 && _this$portalNode.parentNode) {
72
77
  this.portalNode.parentNode.removeChild(this.portalNode);
73
78
  }
74
79
 
@@ -84,7 +89,7 @@ export var EuiPortal = /*#__PURE__*/function (_Component) {
84
89
  }, {
85
90
  key: "render",
86
91
  value: function render() {
87
- return /*#__PURE__*/createPortal(this.props.children, this.portalNode);
92
+ return this.portalNode ? /*#__PURE__*/createPortal(this.props.children, this.portalNode) : null;
88
93
  }
89
94
  }]);
90
95
 
@@ -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,71 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+
4
+ /*
5
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
6
+ * or more contributor license agreements. Licensed under the Elastic License
7
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
8
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
9
+ * Side Public License, v 1.
10
+ */
11
+ import { waitFor } from '@testing-library/react';
12
+ /**
13
+ * Ensure the EuiPopover being tested is open/closed before contiuning
14
+ * Note: Because EuiPopover is portalled, we want to query `document`
15
+ * instead of the `container` returned by RTL's render()
16
+ */
17
+
18
+ export var waitForEuiPopoverOpen = /*#__PURE__*/function () {
19
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
20
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
21
+ while (1) {
22
+ switch (_context.prev = _context.next) {
23
+ case 0:
24
+ _context.next = 2;
25
+ return waitFor(function () {
26
+ var openPopover = document.querySelector('[data-popover-open]');
27
+ expect(openPopover).toBeTruthy();
28
+ });
29
+
30
+ case 2:
31
+ return _context.abrupt("return", _context.sent);
32
+
33
+ case 3:
34
+ case "end":
35
+ return _context.stop();
36
+ }
37
+ }
38
+ }, _callee);
39
+ }));
40
+
41
+ return function waitForEuiPopoverOpen() {
42
+ return _ref.apply(this, arguments);
43
+ };
44
+ }();
45
+ export var waitForEuiPopoverClose = /*#__PURE__*/function () {
46
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
47
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
48
+ while (1) {
49
+ switch (_context2.prev = _context2.next) {
50
+ case 0:
51
+ _context2.next = 2;
52
+ return waitFor(function () {
53
+ var openPopover = document.querySelector('[data-popover-open]');
54
+ expect(openPopover).toBeFalsy();
55
+ });
56
+
57
+ case 2:
58
+ return _context2.abrupt("return", _context2.sent);
59
+
60
+ case 3:
61
+ case "end":
62
+ return _context2.stop();
63
+ }
64
+ }
65
+ }, _callee2);
66
+ }));
67
+
68
+ return function waitForEuiPopoverClose() {
69
+ return _ref2.apply(this, arguments);
70
+ };
71
+ }();
@@ -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,48 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["queries"];
4
+
5
+ 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; }
6
+
7
+ 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; }
8
+
9
+ /*
10
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
11
+ * or more contributor license agreements. Licensed under the Elastic License
12
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
13
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
14
+ * Side Public License, v 1.
15
+ */
16
+ import { queries, render, screen, within } from '@testing-library/react';
17
+ import { EuiProvider } from '../../components';
18
+ import * as dataTestSubjQueries from './data_test_subj_queries';
19
+ /**
20
+ * Custom render() fn with EuiProvider and query helpers
21
+ *
22
+ * @see https://testing-library.com/docs/react-testing-library/setup#custom-render
23
+ * @see https://testing-library.com/docs/react-testing-library/setup#add-custom-queries
24
+ */
25
+
26
+ var customRender = function customRender(ui) {
27
+ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
28
+
29
+ var renderQueries = _ref.queries,
30
+ options = _objectWithoutProperties(_ref, _excluded);
31
+
32
+ return render(ui, _objectSpread({
33
+ queries: _objectSpread(_objectSpread(_objectSpread({}, queries), dataTestSubjQueries), renderQueries || {}),
34
+ wrapper: EuiProvider
35
+ }, options));
36
+ };
37
+
38
+ export { customRender as render };
39
+ /**
40
+ * Custom screen util with EUI query helpers
41
+ *
42
+ * @see https://testing-library.com/docs/queries/about/#screen
43
+ * @see https://github.com/testing-library/dom-testing-library/issues/516
44
+ */
45
+
46
+ var customScreen = _objectSpread(_objectSpread({}, screen), within(document.body, dataTestSubjQueries));
47
+
48
+ 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,36 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+
3
+ /*
4
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
5
+ * or more contributor license agreements. Licensed under the Elastic License
6
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
7
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
8
+ * Side Public License, v 1.
9
+ */
10
+ import { queryHelpers, buildQueries } from '@testing-library/react';
11
+
12
+ var queryAllByTestSubject = function queryAllByTestSubject() {
13
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
14
+ args[_key] = arguments[_key];
15
+ }
16
+
17
+ return queryHelpers.queryAllByAttribute.apply(queryHelpers, ['data-test-subj'].concat(args));
18
+ };
19
+
20
+ var getMultipleError = function getMultipleError(_, TestSubjectValue) {
21
+ return "Found multiple elements with the data-test-subj attribute of: ".concat(TestSubjectValue);
22
+ };
23
+
24
+ var getMissingError = function getMissingError(_, TestSubjectValue) {
25
+ return "Unable to find an element with the data-test-subj attribute of: ".concat(TestSubjectValue);
26
+ };
27
+
28
+ var _buildQueries = buildQueries(queryAllByTestSubject, getMultipleError, getMissingError),
29
+ _buildQueries2 = _slicedToArray(_buildQueries, 5),
30
+ queryByTestSubject = _buildQueries2[0],
31
+ getAllByTestSubject = _buildQueries2[1],
32
+ getByTestSubject = _buildQueries2[2],
33
+ findAllByTestSubject = _buildQueries2[3],
34
+ findByTestSubject = _buildQueries2[4];
35
+
36
+ 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';
@@ -7,8 +7,6 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.EuiCommentEvent = void 0;
9
9
 
10
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
-
12
10
  var _react = _interopRequireDefault(require("react"));
13
11
 
14
12
  var _services = require("../../services");
@@ -60,14 +58,6 @@ var EuiCommentEvent = function EuiCommentEvent(_ref) {
60
58
  var cssStyles = [styles.euiCommentEvent, styles[type]];
61
59
  var headerStyles = (0, _comment_event.euiCommentEventHeaderStyles)(euiTheme);
62
60
  var cssHeaderStyles = [headerStyles.euiCommentEvent__header, eventColor && headerStyles.hasEventColor, isTypeRegular && headerStyles.regular];
63
- var cssHeaderPanelStyles = headerStyles.euiCommentEvent__headerPanel;
64
- var cssHeaderEventIconStyles = headerStyles.euiCommentEvent__headerEventIcon;
65
- var cssHeaderUsernameStyles = headerStyles.euiCommentEvent__headerUsername;
66
- var cssHeaderEventStyles = headerStyles.euiCommentEvent__headerEvent;
67
- var cssHeaderTimestampStyles = headerStyles.euiCommentEvent__headerTimestamp;
68
- var cssHeaderMainStyles = headerStyles.euiCommentEvent__headerMain;
69
- var cssHeaderDataStyles = headerStyles.euiCommentEvent__headerData;
70
- var cssHeaderActionsStyles = headerStyles.euiCommentEvent__headerActions;
71
61
  var bodyStyles = (0, _comment_event.euiCommentEventBodyStyles)(euiTheme);
72
62
  var cssBodyStyles = [bodyStyles.euiCommentEvent__body, bodyStyles[type]];
73
63
  var isFigure = isTypeRegular;
@@ -83,34 +73,40 @@ var EuiCommentEvent = function EuiCommentEvent(_ref) {
83
73
  color: 'transparent',
84
74
  paddingSize: 'none'
85
75
  };
86
- var eventHeader = (0, _react2.jsx)(HeaderElement, {
76
+ return (0, _react2.jsx)(Element, {
77
+ className: classes,
78
+ css: cssStyles,
79
+ "data-type": type
80
+ }, hasEventElements && (0, _react2.jsx)(HeaderElement, {
81
+ className: "euiCommentEvent__header",
87
82
  css: cssHeaderStyles
88
- }, (0, _react2.jsx)(_panel.EuiPanel, (0, _extends2.default)({}, panelProps, {
89
- css: cssHeaderPanelStyles
90
- }), (0, _react2.jsx)("div", {
91
- css: cssHeaderMainStyles
83
+ }, (0, _react2.jsx)(_panel.EuiPanel, panelProps, (0, _react2.jsx)("div", {
84
+ className: "euiCommentEvent__headerMain",
85
+ css: headerStyles.euiCommentEvent__headerMain
92
86
  }, (0, _react2.jsx)("div", {
93
- css: cssHeaderDataStyles
87
+ className: "euiCommentEvent__headerData",
88
+ css: headerStyles.euiCommentEvent__headerData
94
89
  }, eventIcon && (0, _react2.jsx)(_avatar.EuiAvatar, {
95
- css: cssHeaderEventIconStyles,
90
+ className: "euiCommentEvent__headerEventIcon",
91
+ css: headerStyles.euiCommentEvent__headerEventIcon,
96
92
  size: "s",
97
93
  iconType: eventIcon,
98
94
  name: eventIconAriaLabel ? eventIconAriaLabel : '',
99
95
  color: "subdued",
100
96
  "aria-hidden": !eventIconAriaLabel
101
97
  }), username && (0, _react2.jsx)("div", {
102
- css: cssHeaderUsernameStyles
98
+ className: "euiCommentEvent__headerUsername",
99
+ css: headerStyles.euiCommentEvent__headerUsername
103
100
  }, username), event && (0, _react2.jsx)("div", {
104
- css: cssHeaderEventStyles
101
+ className: "euiCommentEvent__headerEvent",
102
+ css: headerStyles.euiCommentEvent__headerEvent
105
103
  }, event), timestamp && (0, _react2.jsx)("div", {
106
- css: cssHeaderTimestampStyles
104
+ className: "euiCommentEvent__headerTimestamp"
107
105
  }, (0, _react2.jsx)("time", null, timestamp))), actions && (0, _react2.jsx)("div", {
108
- css: cssHeaderActionsStyles
109
- }, actions))));
110
- return (0, _react2.jsx)(Element, {
111
- className: classes,
112
- css: cssStyles
113
- }, hasEventElements && eventHeader, children && (0, _react2.jsx)("div", {
106
+ className: "euiCommentEvent__headerActions",
107
+ css: headerStyles.euiCommentEvent__headerActions
108
+ }, actions)))), children && (0, _react2.jsx)("div", {
109
+ className: "euiCommentEvent__body",
114
110
  css: cssBodyStyles
115
111
  }, children));
116
112
  };
@@ -34,20 +34,20 @@ var euiCommentEventStyles = function euiCommentEventStyles(_ref4) {
34
34
  exports.euiCommentEventStyles = euiCommentEventStyles;
35
35
 
36
36
  var _ref = process.env.NODE_ENV === "production" ? {
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
  } : {
40
- name: "bqgcpj-hasEventColor",
41
- styles: "padding:0;label:hasEventColor;",
40
+ name: "ui5tce-euiCommentEvent__headerEvent",
41
+ styles: "align-items:center;display:inline-flex;white-space:pre-wrap;flex-wrap:wrap;label:euiCommentEvent__headerEvent;",
42
42
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
43
43
  };
44
44
 
45
45
  var _ref2 = process.env.NODE_ENV === "production" ? {
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
  } : {
49
- name: "ui5tce-euiCommentEvent__headerEvent",
50
- styles: "align-items:center;display:inline-flex;white-space:pre-wrap;flex-wrap:wrap;label:euiCommentEvent__headerEvent;",
49
+ name: "bqgcpj-hasEventColor",
50
+ styles: "padding:0;label:hasEventColor;",
51
51
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
52
52
  };
53
53
 
@@ -55,18 +55,17 @@ var euiCommentEventHeaderStyles = function euiCommentEventHeaderStyles(_ref5) {
55
55
  var euiTheme = _ref5.euiTheme;
56
56
  return {
57
57
  euiCommentEvent__header: /*#__PURE__*/(0, _react.css)(";label:euiCommentEvent__header;"),
58
- euiCommentEvent__headerPanel: /*#__PURE__*/(0, _react.css)(";label:euiCommentEvent__headerPanel;"),
58
+ // types
59
+ regular: /*#__PURE__*/(0, _react.css)("background:", euiTheme.colors.lightestShade, ";border-bottom:", euiTheme.border.thin, ";padding:", euiTheme.size.s, ";;label:regular;"),
60
+ // variants
61
+ hasEventColor: _ref2,
62
+ // Children
59
63
  euiCommentEvent__headerMain: /*#__PURE__*/(0, _react.css)("display:flex;flex:1;gap:", euiTheme.size.s, ";;label:euiCommentEvent__headerMain;"),
60
64
  euiCommentEvent__headerData: /*#__PURE__*/(0, _react.css)("display:flex;flex:1;align-items:center;flex-wrap:wrap;gap:", euiTheme.size.xs, ";;label:euiCommentEvent__headerData;"),
61
65
  euiCommentEvent__headerEventIcon: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('margin-right', euiTheme.size.xs), ";;label:euiCommentEvent__headerEventIcon;"),
62
66
  euiCommentEvent__headerUsername: /*#__PURE__*/(0, _react.css)("font-weight:", euiTheme.font.weight.semiBold, ";;label:euiCommentEvent__headerUsername;"),
63
- euiCommentEvent__headerEvent: _ref2,
64
- euiCommentEvent__headerTimestamp: /*#__PURE__*/(0, _react.css)(";label:euiCommentEvent__headerTimestamp;"),
65
- euiCommentEvent__headerActions: /*#__PURE__*/(0, _react.css)("display:flex;flex-wrap:wrap;gap:", euiTheme.size.xs, ";;label:euiCommentEvent__headerActions;"),
66
- // types
67
- regular: /*#__PURE__*/(0, _react.css)("background:", euiTheme.colors.lightestShade, ";border-bottom:", euiTheme.border.thin, ";padding:", euiTheme.size.s, ";;label:regular;"),
68
- // variants
69
- hasEventColor: _ref
67
+ euiCommentEvent__headerEvent: _ref,
68
+ euiCommentEvent__headerActions: /*#__PURE__*/(0, _react.css)("display:flex;flex-wrap:wrap;gap:", euiTheme.size.xs, ";;label:euiCommentEvent__headerActions;")
70
69
  };
71
70
  };
72
71
 
@@ -86,7 +86,9 @@ var EuiFilterButton = function EuiFilterButton(_ref) {
86
86
  var badgeContent = showBadge && (0, _react2.jsx)(_notification_badge.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
  var dataText;
92
94
 
@@ -33,10 +33,10 @@ var EuiImageCaption = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
33
33
  var euiTheme = (0, _services.useEuiTheme)();
34
34
  var styles = (0, _image_caption.euiImageCaptionStyles)(euiTheme);
35
35
  var cssStyles = [styles.euiImageCaption, isOnOverlayMask && styles.isOnOverlayMask];
36
- return (0, _react2.jsx)("figcaption", {
36
+ return caption ? (0, _react2.jsx)("figcaption", {
37
37
  ref: ref,
38
38
  css: cssStyles
39
- }, caption);
39
+ }, caption) : null;
40
40
  });
41
41
  exports.EuiImageCaption = EuiImageCaption;
42
42
  EuiImageCaption.displayName = 'EuiImageCaption';