@elastic/eui 91.3.1 → 92.0.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 (160) hide show
  1. package/dist/eui_charts_theme.js.map +1 -1
  2. package/dist/eui_theme_dark.css +0 -513
  3. package/dist/eui_theme_dark.min.css +1 -1
  4. package/dist/eui_theme_light.css +0 -513
  5. package/dist/eui_theme_light.min.css +1 -1
  6. package/es/components/basic_table/basic_table.js +5 -5
  7. package/es/components/drag_and_drop/drag_and_drop.a11y.js +1 -1
  8. package/es/components/filter_group/filter_button.js +20 -13
  9. package/es/components/filter_group/filter_button.styles.js +11 -20
  10. package/es/components/flyout/flyout.js +4 -4
  11. package/es/components/flyout/flyout_resizable.js +127 -0
  12. package/es/components/flyout/flyout_resizable.styles.js +27 -0
  13. package/es/components/flyout/index.js +2 -1
  14. package/es/components/form/range/dual_range.js +15 -66
  15. package/es/components/form/range/range.js +6 -5
  16. package/es/components/form/range/range_slider.js +28 -22
  17. package/es/components/form/text_area/text_area.js +39 -3
  18. package/es/components/index.js +0 -2
  19. package/es/components/markdown_editor/markdown_editor.js +12 -13
  20. package/es/components/page_template/bottom_bar/page_bottom_bar.js +1 -1
  21. package/es/components/selectable/selectable_list/selectable_list_item.js +1 -1
  22. package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +5 -0
  23. package/es/components/tree_view/tree_view.js +23 -25
  24. package/es/utils/prop_types/is.js +2 -2
  25. package/eui.d.ts +825 -1141
  26. package/i18ntokens.json +68 -338
  27. package/lib/components/basic_table/basic_table.js +5 -5
  28. package/lib/components/drag_and_drop/drag_and_drop.a11y.js +1 -1
  29. package/lib/components/filter_group/filter_button.js +20 -13
  30. package/lib/components/filter_group/filter_button.styles.js +11 -20
  31. package/lib/components/flyout/flyout.js +4 -4
  32. package/lib/components/flyout/flyout_resizable.js +136 -0
  33. package/lib/components/flyout/flyout_resizable.styles.js +32 -0
  34. package/lib/components/flyout/index.js +8 -1
  35. package/lib/components/form/range/dual_range.js +15 -66
  36. package/lib/components/form/range/range.js +6 -5
  37. package/lib/components/form/range/range_slider.js +27 -21
  38. package/lib/components/form/text_area/text_area.js +42 -3
  39. package/lib/components/index.js +0 -22
  40. package/lib/components/markdown_editor/markdown_editor.js +12 -13
  41. package/lib/components/page_template/bottom_bar/page_bottom_bar.js +1 -1
  42. package/lib/components/pagination/pagination_button.js +79 -2
  43. package/lib/components/selectable/selectable_list/selectable_list_item.js +1 -1
  44. package/lib/components/tree_view/tree_view.js +23 -25
  45. package/lib/utils/prop_types/is.js +2 -2
  46. package/optimize/es/components/basic_table/basic_table.js +5 -5
  47. package/optimize/es/components/drag_and_drop/drag_and_drop.a11y.js +1 -1
  48. package/optimize/es/components/filter_group/filter_button.js +20 -13
  49. package/optimize/es/components/filter_group/filter_button.styles.js +11 -20
  50. package/optimize/es/components/flyout/flyout.js +4 -4
  51. package/optimize/es/components/flyout/flyout_resizable.js +121 -0
  52. package/optimize/es/components/flyout/flyout_resizable.styles.js +27 -0
  53. package/optimize/es/components/flyout/index.js +2 -1
  54. package/optimize/es/components/form/range/dual_range.js +15 -66
  55. package/optimize/es/components/form/range/range.js +6 -5
  56. package/optimize/es/components/form/range/range_slider.js +26 -21
  57. package/optimize/es/components/form/text_area/text_area.js +29 -3
  58. package/optimize/es/components/index.js +0 -2
  59. package/optimize/es/components/markdown_editor/markdown_editor.js +12 -13
  60. package/optimize/es/components/page_template/bottom_bar/page_bottom_bar.js +1 -1
  61. package/optimize/es/components/selectable/selectable_list/selectable_list_item.js +1 -1
  62. package/optimize/es/components/tree_view/tree_view.js +23 -25
  63. package/optimize/es/utils/prop_types/is.js +2 -2
  64. package/optimize/lib/components/basic_table/basic_table.js +5 -5
  65. package/optimize/lib/components/drag_and_drop/drag_and_drop.a11y.js +1 -1
  66. package/optimize/lib/components/filter_group/filter_button.js +20 -13
  67. package/optimize/lib/components/filter_group/filter_button.styles.js +11 -20
  68. package/optimize/lib/components/flyout/flyout.js +4 -4
  69. package/optimize/lib/components/flyout/flyout_resizable.js +131 -0
  70. package/optimize/lib/components/flyout/flyout_resizable.styles.js +32 -0
  71. package/optimize/lib/components/flyout/index.js +8 -1
  72. package/optimize/lib/components/form/range/dual_range.js +15 -66
  73. package/optimize/lib/components/form/range/range.js +6 -5
  74. package/optimize/lib/components/form/range/range_slider.js +26 -21
  75. package/optimize/lib/components/form/text_area/text_area.js +32 -3
  76. package/optimize/lib/components/index.js +0 -22
  77. package/optimize/lib/components/markdown_editor/markdown_editor.js +12 -13
  78. package/optimize/lib/components/page_template/bottom_bar/page_bottom_bar.js +1 -1
  79. package/optimize/lib/components/selectable/selectable_list/selectable_list_item.js +1 -1
  80. package/optimize/lib/components/tree_view/tree_view.js +23 -25
  81. package/optimize/lib/utils/prop_types/is.js +2 -2
  82. package/package.json +2 -2
  83. package/src/components/index.scss +0 -2
  84. package/test-env/components/basic_table/basic_table.js +5 -5
  85. package/test-env/components/drag_and_drop/drag_and_drop.a11y.js +1 -1
  86. package/test-env/components/filter_group/filter_button.js +20 -13
  87. package/test-env/components/filter_group/filter_button.styles.js +11 -20
  88. package/test-env/components/flyout/flyout_resizable.js +131 -0
  89. package/test-env/components/flyout/flyout_resizable.styles.js +32 -0
  90. package/test-env/components/flyout/index.js +8 -1
  91. package/test-env/components/form/range/dual_range.js +15 -66
  92. package/test-env/components/form/range/range.js +6 -5
  93. package/test-env/components/form/range/range_slider.js +27 -21
  94. package/test-env/components/form/text_area/text_area.js +42 -3
  95. package/test-env/components/index.js +0 -22
  96. package/test-env/components/markdown_editor/markdown_editor.js +12 -13
  97. package/test-env/components/page_template/bottom_bar/page_bottom_bar.js +1 -1
  98. package/test-env/components/pagination/pagination_button.js +79 -2
  99. package/test-env/components/selectable/selectable_list/selectable_list_item.js +1 -1
  100. package/test-env/components/tree_view/tree_view.js +23 -25
  101. package/test-env/utils/prop_types/is.js +2 -2
  102. package/es/components/control_bar/control_bar.a11y.js +0 -133
  103. package/es/components/control_bar/control_bar.js +0 -609
  104. package/es/components/control_bar/index.js +0 -9
  105. package/es/components/notification/index.js +0 -9
  106. package/es/components/notification/notification_event.a11y.js +0 -104
  107. package/es/components/notification/notification_event.js +0 -288
  108. package/es/components/notification/notification_event_messages.js +0 -79
  109. package/es/components/notification/notification_event_meta.js +0 -148
  110. package/es/components/notification/notification_event_read_button.js +0 -86
  111. package/es/components/notification/notification_event_read_icon.js +0 -77
  112. package/lib/components/control_bar/control_bar.a11y.js +0 -134
  113. package/lib/components/control_bar/control_bar.js +0 -441
  114. package/lib/components/control_bar/index.js +0 -12
  115. package/lib/components/notification/index.js +0 -12
  116. package/lib/components/notification/notification_event.a11y.js +0 -105
  117. package/lib/components/notification/notification_event.js +0 -297
  118. package/lib/components/notification/notification_event_messages.js +0 -88
  119. package/lib/components/notification/notification_event_meta.js +0 -157
  120. package/lib/components/notification/notification_event_read_button.js +0 -93
  121. package/lib/components/notification/notification_event_read_icon.js +0 -64
  122. package/optimize/es/components/control_bar/control_bar.a11y.js +0 -128
  123. package/optimize/es/components/control_bar/control_bar.js +0 -308
  124. package/optimize/es/components/control_bar/index.js +0 -9
  125. package/optimize/es/components/notification/index.js +0 -9
  126. package/optimize/es/components/notification/notification_event.a11y.js +0 -99
  127. package/optimize/es/components/notification/notification_event.js +0 -114
  128. package/optimize/es/components/notification/notification_event_messages.js +0 -63
  129. package/optimize/es/components/notification/notification_event_meta.js +0 -106
  130. package/optimize/es/components/notification/notification_event_read_button.js +0 -44
  131. package/optimize/es/components/notification/notification_event_read_icon.js +0 -44
  132. package/optimize/lib/components/control_bar/control_bar.a11y.js +0 -134
  133. package/optimize/lib/components/control_bar/control_bar.js +0 -301
  134. package/optimize/lib/components/control_bar/index.js +0 -12
  135. package/optimize/lib/components/notification/index.js +0 -12
  136. package/optimize/lib/components/notification/notification_event.a11y.js +0 -105
  137. package/optimize/lib/components/notification/notification_event.js +0 -123
  138. package/optimize/lib/components/notification/notification_event_messages.js +0 -74
  139. package/optimize/lib/components/notification/notification_event_meta.js +0 -117
  140. package/optimize/lib/components/notification/notification_event_read_button.js +0 -51
  141. package/optimize/lib/components/notification/notification_event_read_icon.js +0 -51
  142. package/src/components/control_bar/_control_bar.scss +0 -232
  143. package/src/components/control_bar/_index.scss +0 -2
  144. package/src/components/control_bar/_variables.scss +0 -12
  145. package/src/components/notification/_index.scss +0 -5
  146. package/src/components/notification/_notification_event.scss +0 -40
  147. package/src/components/notification/_notification_event_messages.scss +0 -17
  148. package/src/components/notification/_notification_event_meta.scss +0 -44
  149. package/src/components/notification/_notification_event_read_button.scss +0 -5
  150. package/src/components/notification/_notification_event_read_icon.scss +0 -12
  151. package/test-env/components/control_bar/control_bar.a11y.js +0 -134
  152. package/test-env/components/control_bar/control_bar.js +0 -436
  153. package/test-env/components/control_bar/index.js +0 -12
  154. package/test-env/components/notification/index.js +0 -12
  155. package/test-env/components/notification/notification_event.a11y.js +0 -105
  156. package/test-env/components/notification/notification_event.js +0 -296
  157. package/test-env/components/notification/notification_event_messages.js +0 -85
  158. package/test-env/components/notification/notification_event_meta.js +0 -154
  159. package/test-env/components/notification/notification_event_read_button.js +0 -92
  160. package/test-env/components/notification/notification_event_read_icon.js +0 -63
@@ -1,99 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
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
- /// <reference types="cypress" />
11
- /// <reference types="cypress-real-events" />
12
- /// <reference types="../../../cypress/support" />
13
-
14
- import React, { useState } from 'react';
15
- import { EuiContextMenuItem } from '../context_menu';
16
- import { EuiNotificationEvent } from './notification_event';
17
- import { EuiPanel } from '../panel';
18
- import { jsx as ___EmotionJSX } from "@emotion/react";
19
- var NotificationEvent = function NotificationEvent() {
20
- var _useState = useState(false),
21
- _useState2 = _slicedToArray(_useState, 2),
22
- isRead = _useState2[0],
23
- setIsRead = _useState2[1];
24
- var onRead = function onRead(id, isRead) {
25
- setIsRead(!isRead);
26
- };
27
- var onOpenContextMenu = function onOpenContextMenu(id) {
28
- return [___EmotionJSX(EuiContextMenuItem, {
29
- key: "contextMenuItemA",
30
- onClick: function onClick() {
31
- return onRead(id, isRead);
32
- }
33
- }, isRead ? 'Mark as unread' : 'Mark as read'), ___EmotionJSX(EuiContextMenuItem, {
34
- key: "contextMenuItemB",
35
- onClick: function onClick() {}
36
- }, "View messages like this"), ___EmotionJSX(EuiContextMenuItem, {
37
- key: "contextMenuItemC",
38
- onClick: function onClick() {}
39
- }, "Don\u2019t notify me about this")];
40
- };
41
- return ___EmotionJSX(EuiPanel, {
42
- paddingSize: "none",
43
- hasShadow: true,
44
- style: {
45
- maxWidth: '540px'
46
- }
47
- }, ___EmotionJSX(EuiNotificationEvent, {
48
- id: "cy-eui-notification-1",
49
- type: "Report",
50
- iconType: "logoKibana",
51
- iconAriaLabel: "Kibana",
52
- time: "1 min ago",
53
- title: "[Error Monitoring Report] is generated",
54
- primaryAction: "Download",
55
- primaryActionProps: {
56
- iconType: 'download'
57
- },
58
- messages: ['The reported was generated at 17:12:16 GMT+4'],
59
- isRead: isRead,
60
- onRead: onRead,
61
- onOpenContextMenu: onOpenContextMenu,
62
- onClickPrimaryAction: function onClickPrimaryAction() {},
63
- onClickTitle: function onClickTitle() {}
64
- }));
65
- };
66
- describe('EuiNotificationEvent', function () {
67
- beforeEach(function () {
68
- cy.viewport(1024, 768); // medium breakpoint
69
- cy.realMount(___EmotionJSX(NotificationEvent, null));
70
- cy.get('article.euiNotificationEvent').should('exist');
71
- });
72
- describe('Automated accessibility check', function () {
73
- it('has zero violations on first render', function () {
74
- cy.checkAxe();
75
- });
76
- it('has zero violations when popover is open', function () {
77
- cy.get('button[data-test-subj="cy-eui-notification-1-notificationEventMetaButton"]').realClick();
78
- cy.get('div.euiPopover__panel').should('exist');
79
- cy.checkAxe();
80
- });
81
- it('has zero violations after the Mark as read button is clicked', function () {
82
- cy.get('button[data-test-subj="cy-eui-notification-1-notificationEventMetaButton"]').realClick();
83
- cy.get('div.euiPopover__panel').should('exist');
84
- cy.get('div.euiPopover__panel button').first().realClick();
85
- cy.checkAxe();
86
- });
87
- });
88
- describe('Keyboard accessibility', function () {
89
- it('has zero violations when the popover is opened by keyboard', function () {
90
- cy.get('button[data-test-subj="cy-eui-notification-1-notificationEventMetaButton"]').focus();
91
- cy.realPress('Enter');
92
- cy.get('div.euiPopover__panel').should('exist');
93
- cy.checkAxe();
94
- cy.realPress('Escape');
95
- cy.get('div.euiPopover__panel').should('not.exist');
96
- cy.checkAxe();
97
- });
98
- });
99
- });
@@ -1,114 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["id", "type", "severity", "badgeColor", "iconType", "iconAriaLabel", "time", "title", "isRead", "primaryAction", "primaryActionProps", "messages", "onRead", "onOpenContextMenu", "onClickTitle", "onClickPrimaryAction", "headingLevel", "className"];
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
-
12
- import React, { createElement } from 'react';
13
- import classNames from 'classnames';
14
- import { EuiNotificationEventMeta } from './notification_event_meta';
15
- import { EuiNotificationEventMessages } from './notification_event_messages';
16
- import { EuiNotificationEventReadButton } from './notification_event_read_button';
17
- import { EuiButtonEmpty } from '../button';
18
- import { EuiLink } from '../link';
19
- import { useGeneratedHtmlId } from '../../services';
20
- import { EuiNotificationEventReadIcon } from './notification_event_read_icon';
21
-
22
- /**
23
- * @deprecated
24
- */
25
- import { jsx as ___EmotionJSX } from "@emotion/react";
26
- /**
27
- * @deprecated - EuiNotificationEvent is scheduled for deprecation due to low internal usage and high
28
- * maintenance requirements. If necessary, we recommend copying this component into your own application.
29
- *
30
- * The component will be permanently removed in December 2023.
31
- */
32
- export var EuiNotificationEvent = function EuiNotificationEvent(_ref) {
33
- var id = _ref.id,
34
- type = _ref.type,
35
- severity = _ref.severity,
36
- badgeColor = _ref.badgeColor,
37
- iconType = _ref.iconType,
38
- iconAriaLabel = _ref.iconAriaLabel,
39
- time = _ref.time,
40
- title = _ref.title,
41
- isRead = _ref.isRead,
42
- primaryAction = _ref.primaryAction,
43
- primaryActionProps = _ref.primaryActionProps,
44
- messages = _ref.messages,
45
- onRead = _ref.onRead,
46
- onOpenContextMenu = _ref.onOpenContextMenu,
47
- onClickTitle = _ref.onClickTitle,
48
- onClickPrimaryAction = _ref.onClickPrimaryAction,
49
- _ref$headingLevel = _ref.headingLevel,
50
- headingLevel = _ref$headingLevel === void 0 ? 'h2' : _ref$headingLevel,
51
- className = _ref.className,
52
- rest = _objectWithoutProperties(_ref, _excluded);
53
- var classes = classNames('euiNotificationEvent', {
54
- 'euiNotificationEvent--withReadState': typeof isRead === 'boolean'
55
- }, className);
56
- var classesTitle = classNames('euiNotificationEvent__title', {
57
- 'euiNotificationEvent__title--isRead': isRead
58
- });
59
- var randomHeadingId = useGeneratedHtmlId();
60
- var titleProps = {
61
- id: randomHeadingId,
62
- className: classesTitle,
63
- 'data-test-subj': "".concat(id, "-notificationEventTitle")
64
- };
65
- return ___EmotionJSX("article", _extends({
66
- "aria-labelledby": randomHeadingId,
67
- className: classes,
68
- key: id
69
- }, rest), typeof isRead === 'boolean' && ___EmotionJSX("div", {
70
- className: "euiNotificationEvent__readButton"
71
- }, !!onRead ? ___EmotionJSX(EuiNotificationEventReadButton, {
72
- isRead: isRead,
73
- onClick: function onClick() {
74
- return onRead(id, isRead);
75
- },
76
- eventName: title,
77
- id: id
78
- }) : ___EmotionJSX(EuiNotificationEventReadIcon, {
79
- id: id,
80
- isRead: isRead,
81
- eventName: title
82
- })), ___EmotionJSX("div", {
83
- className: "euiNotificationEvent__content"
84
- }, ___EmotionJSX(EuiNotificationEventMeta, {
85
- id: id,
86
- type: type,
87
- severity: severity,
88
- badgeColor: badgeColor,
89
- iconType: iconType,
90
- iconAriaLabel: iconAriaLabel,
91
- time: time,
92
- onOpenContextMenu: onOpenContextMenu ? function () {
93
- return onOpenContextMenu(id);
94
- } : undefined,
95
- eventName: title
96
- }), onClickTitle ? ___EmotionJSX(EuiLink, _extends({
97
- onClick: function onClick() {
98
- return onClickTitle(id);
99
- }
100
- }, titleProps), /*#__PURE__*/createElement(headingLevel, null, title)) : /*#__PURE__*/createElement(headingLevel, titleProps, title), ___EmotionJSX(EuiNotificationEventMessages, {
101
- messages: messages,
102
- eventName: title
103
- }), onClickPrimaryAction && primaryAction && ___EmotionJSX("div", {
104
- className: "euiNotificationEvent__primaryAction"
105
- }, ___EmotionJSX(EuiButtonEmpty, _extends({
106
- flush: "left",
107
- size: "s"
108
- }, primaryActionProps, {
109
- onClick: function onClick() {
110
- return onClickPrimaryAction === null || onClickPrimaryAction === void 0 ? void 0 : onClickPrimaryAction(id);
111
- },
112
- "data-test-subj": "".concat(id, "-notificationEventPrimaryAction")
113
- }), primaryAction))));
114
- };
@@ -1,63 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
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 React, { useState } from 'react';
11
- import { EuiAccordion } from '../accordion';
12
- import { useGeneratedHtmlId } from '../../services';
13
- import { useEuiI18n } from '../i18n';
14
- import { EuiText } from '../text';
15
- import { jsx as ___EmotionJSX } from "@emotion/react";
16
- export var EuiNotificationEventMessages = function EuiNotificationEventMessages(_ref) {
17
- var messages = _ref.messages,
18
- eventName = _ref.eventName;
19
- var _useState = useState(false),
20
- _useState2 = _slicedToArray(_useState, 2),
21
- isOpen = _useState2[0],
22
- setIsOpen = _useState2[1];
23
- var messagesLength = messages.length;
24
- var accordionId = useGeneratedHtmlId({
25
- prefix: 'euiNotificationEventMessagesAccordion'
26
- });
27
- var accordionButtonText = useEuiI18n('euiNotificationEventMessages.accordionButtonText', '+ {messagesLength} more', {
28
- messagesLength: messagesLength - 1
29
- });
30
- var accordionAriaLabelButtonText = useEuiI18n('euiNotificationEventMessages.accordionAriaLabelButtonText', '+ {messagesLength} messages for {eventName}', {
31
- messagesLength: messagesLength - 1,
32
- eventName: eventName
33
- });
34
- var accordionHideText = useEuiI18n('euiNotificationEventMessages.accordionHideText', 'hide');
35
- var buttonContentText = isOpen ? "".concat(accordionButtonText, " (").concat(accordionHideText, ")") : accordionButtonText;
36
- return ___EmotionJSX("div", {
37
- className: "euiNotificationEventMessages"
38
- }, messages && messagesLength === 1 ? ___EmotionJSX(EuiText, {
39
- size: "s",
40
- color: "subdued"
41
- }, ___EmotionJSX("p", null, messages)) : ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiText, {
42
- size: "s",
43
- color: "subdued"
44
- }, ___EmotionJSX("p", null, messages[0])), ___EmotionJSX(EuiAccordion, {
45
- onToggle: setIsOpen,
46
- buttonProps: {
47
- 'aria-label': accordionAriaLabelButtonText
48
- },
49
- id: accordionId,
50
- className: "euiNotificationEventMessages__accordion",
51
- buttonContent: buttonContentText,
52
- buttonClassName: "euiNotificationEventMessages__accordionButton",
53
- arrowDisplay: "none"
54
- }, ___EmotionJSX("div", {
55
- className: "euiNotificationEventMessages__accordionContent"
56
- }, messages.map(function (notification, index) {
57
- return ___EmotionJSX(EuiText, {
58
- size: "s",
59
- key: index,
60
- color: "subdued"
61
- }, ___EmotionJSX("p", null, notification));
62
- }).slice(1)))));
63
- };
@@ -1,106 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
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
-
11
- import React, { useState } from 'react';
12
- import classNames from 'classnames';
13
- import { EuiIcon } from '../icon';
14
- import { EuiBadge } from '../badge';
15
- import { EuiPopover } from '../popover';
16
- import { EuiButtonIcon } from '../button';
17
- import { EuiContextMenuPanel } from '../context_menu';
18
- import { EuiI18n } from '../i18n';
19
- import { useGeneratedHtmlId } from '../../services';
20
- import { jsx as ___EmotionJSX } from "@emotion/react";
21
- export var EuiNotificationEventMeta = function EuiNotificationEventMeta(_ref) {
22
- var id = _ref.id,
23
- iconType = _ref.iconType,
24
- type = _ref.type,
25
- time = _ref.time,
26
- _ref$badgeColor = _ref.badgeColor,
27
- badgeColor = _ref$badgeColor === void 0 ? 'hollow' : _ref$badgeColor,
28
- severity = _ref.severity,
29
- eventName = _ref.eventName,
30
- iconAriaLabel = _ref.iconAriaLabel,
31
- onOpenContextMenu = _ref.onOpenContextMenu;
32
- var _useState = useState(false),
33
- _useState2 = _slicedToArray(_useState, 2),
34
- isPopoverOpen = _useState2[0],
35
- setIsPopoverOpen = _useState2[1];
36
- var classes = classNames('euiNotificationEventMeta', {
37
- 'euiNotificationEventMeta--hasContextMenu': onOpenContextMenu
38
- });
39
- var _useState3 = useState([]),
40
- _useState4 = _slicedToArray(_useState3, 2),
41
- contextMenuItems = _useState4[0],
42
- setContextMenuItems = _useState4[1];
43
- var randomPopoverId = useGeneratedHtmlId();
44
- var ariaAttribute = iconAriaLabel ? {
45
- 'aria-label': iconAriaLabel
46
- } : {
47
- 'aria-hidden': true
48
- };
49
- var onOpenPopover = function onOpenPopover() {
50
- setIsPopoverOpen(!isPopoverOpen);
51
- if (onOpenContextMenu) {
52
- setContextMenuItems(onOpenContextMenu());
53
- }
54
- };
55
- return ___EmotionJSX("div", {
56
- className: classes
57
- }, ___EmotionJSX("div", {
58
- className: "euiNotificationEventMeta__section"
59
- }, iconType && ___EmotionJSX(EuiIcon, _extends({
60
- className: "euiNotificationEventMeta__icon",
61
- type: iconType
62
- }, ariaAttribute)), type && ___EmotionJSX(EuiBadge, {
63
- className: "euiNotificationEventMeta__badge",
64
- color: badgeColor
65
- }, severity ? "".concat(type, ": ").concat(severity) : type)), ___EmotionJSX("div", {
66
- className: "euiNotificationEventMeta__section"
67
- }, ___EmotionJSX("span", {
68
- className: "euiNotificationEventMeta__time"
69
- }, time)), onOpenContextMenu && ___EmotionJSX("div", {
70
- className: "euiNotificationEventMeta__contextMenuWrapper"
71
- }, ___EmotionJSX(EuiPopover, {
72
- id: randomPopoverId,
73
- ownFocus: true,
74
- repositionOnScroll: true,
75
- isOpen: isPopoverOpen,
76
- panelPaddingSize: "none",
77
- anchorPosition: "leftUp",
78
- button: ___EmotionJSX(EuiI18n, {
79
- token: "euiNotificationEventMeta.contextMenuButton",
80
- default: "Menu for {eventName}",
81
- values: {
82
- eventName: eventName
83
- }
84
- }, function (contextMenuButton) {
85
- return ___EmotionJSX(EuiButtonIcon, {
86
- "aria-label": contextMenuButton,
87
- "aria-controls": randomPopoverId,
88
- "aria-expanded": isPopoverOpen,
89
- "aria-haspopup": "true",
90
- iconType: "boxesVertical",
91
- color: "text",
92
- onClick: onOpenPopover,
93
- "data-test-subj": "".concat(id, "-notificationEventMetaButton")
94
- });
95
- }),
96
- closePopover: function closePopover() {
97
- return setIsPopoverOpen(false);
98
- }
99
- }, ___EmotionJSX("div", {
100
- onClick: function onClick() {
101
- return setIsPopoverOpen(false);
102
- }
103
- }, ___EmotionJSX(EuiContextMenuPanel, {
104
- items: contextMenuItems
105
- })))));
106
- };
@@ -1,44 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["id", "isRead", "onClick", "eventName"];
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
-
12
- import React from 'react';
13
- import { EuiButtonIcon } from '../button';
14
- import { useEuiI18n } from '../i18n';
15
- import classNames from 'classnames';
16
- import { jsx as ___EmotionJSX } from "@emotion/react";
17
- export var EuiNotificationEventReadButton = function EuiNotificationEventReadButton(_ref) {
18
- var id = _ref.id,
19
- isRead = _ref.isRead,
20
- onClick = _ref.onClick,
21
- eventName = _ref.eventName,
22
- rest = _objectWithoutProperties(_ref, _excluded);
23
- var classesReadState = classNames('euiNotificationEventReadButton', {
24
- 'euiNotificationEventReadButton--isRead': isRead
25
- });
26
- var markAsReadAria = useEuiI18n('euiNotificationEventReadButton.markAsReadAria', 'Mark {eventName} as read', {
27
- eventName: eventName
28
- });
29
- var markAsUnreadAria = useEuiI18n('euiNotificationEventReadButton.markAsUnreadAria', 'Mark {eventName} as unread', {
30
- eventName: eventName
31
- });
32
- var markAsRead = useEuiI18n('euiNotificationEventReadButton.markAsRead', 'Mark as read');
33
- var markAsUnread = useEuiI18n('euiNotificationEventReadButton.markAsUnread', 'Mark as unread');
34
- var buttonAriaLabel = isRead ? markAsUnreadAria : markAsReadAria;
35
- var buttonTitle = isRead ? markAsUnread : markAsRead;
36
- return ___EmotionJSX(EuiButtonIcon, _extends({
37
- iconType: "dot",
38
- "aria-label": buttonAriaLabel,
39
- title: buttonTitle,
40
- className: classesReadState,
41
- onClick: onClick,
42
- "data-test-subj": "".concat(id, "-notificationEventReadButton")
43
- }, rest));
44
- };
@@ -1,44 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["id", "isRead", "eventName"];
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
-
12
- import React from 'react';
13
- import { useEuiI18n } from '../i18n';
14
- import classNames from 'classnames';
15
- import { EuiIcon } from '../icon';
16
- import { jsx as ___EmotionJSX } from "@emotion/react";
17
- export var EuiNotificationEventReadIcon = function EuiNotificationEventReadIcon(_ref) {
18
- var id = _ref.id,
19
- isRead = _ref.isRead,
20
- eventName = _ref.eventName,
21
- rest = _objectWithoutProperties(_ref, _excluded);
22
- var classesReadState = classNames('euiNotificationEventReadIcon', {
23
- 'euiNotificationEventReadIcon--isRead': isRead
24
- });
25
- var readAria = useEuiI18n('euiNotificationEventReadIcon.readAria', '{eventName} is read', {
26
- eventName: eventName
27
- });
28
- var unreadAria = useEuiI18n('euiNotificationEventReadIcon.unreadAria', '{eventName} is unread', {
29
- eventName: eventName
30
- });
31
- var readTitle = useEuiI18n('euiNotificationEventReadIcon.read', 'Read');
32
- var unreadTitle = useEuiI18n('euiNotificationEventReadIcon.unread', 'Unread');
33
- var iconAriaLabel = isRead ? readAria : unreadAria;
34
- var iconTitle = isRead ? readTitle : unreadTitle;
35
- return ___EmotionJSX("div", {
36
- className: classesReadState
37
- }, ___EmotionJSX(EuiIcon, _extends({
38
- type: "dot",
39
- "aria-label": iconAriaLabel,
40
- title: iconTitle,
41
- color: "primary",
42
- "data-test-subj": "".concat(id, "-notificationEventReadIcon")
43
- }, rest)));
44
- };
@@ -1,134 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
6
- var _react = _interopRequireWildcard(require("react"));
7
- var _button = require("../button");
8
- var _control_bar = require("./control_bar");
9
- var _panel = require("../panel");
10
- var _text = require("../text");
11
- var _react2 = require("@emotion/react");
12
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
- /*
15
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
16
- * or more contributor license agreements. Licensed under the Elastic License
17
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
18
- * in compliance with, at your election, the Elastic License 2.0 or the Server
19
- * Side Public License, v 1.
20
- */
21
-
22
- /// <reference types="cypress" />
23
- /// <reference types="cypress-real-events" />
24
- /// <reference types="../../../cypress/support" />
25
-
26
- var ControlBar = function ControlBar() {
27
- var _useState = (0, _react.useState)(false),
28
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
29
- contentIsVisible = _useState2[0],
30
- setVisibility = _useState2[1];
31
- var _useState3 = (0, _react.useState)(false),
32
- _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
33
- isDisplaying = _useState4[0],
34
- setDisplay = _useState4[1];
35
- var toggleContent = function toggleContent() {
36
- setVisibility(!contentIsVisible);
37
- };
38
- var toggleDisplay = function toggleDisplay() {
39
- setDisplay(!isDisplaying);
40
- setVisibility(false);
41
- };
42
- var codeControls = [{
43
- controlType: 'icon',
44
- id: 'root_icon',
45
- iconType: 'submodule',
46
- 'aria-label': 'Project Root'
47
- }, {
48
- controlType: 'breadcrumbs',
49
- id: 'current_file_path',
50
- breadcrumbs: [{
51
- text: 'src'
52
- }, {
53
- text: 'components'
54
- }]
55
- }, {
56
- controlType: 'spacer'
57
- }, {
58
- controlType: 'icon',
59
- id: 'status_icon',
60
- iconType: 'warning',
61
- color: 'warning',
62
- 'aria-label': 'Repo Status'
63
- }, {
64
- controlType: 'divider'
65
- }, {
66
- controlType: 'icon',
67
- id: 'branch_icon',
68
- iconType: 'branch',
69
- 'aria-label': 'Branch Icon'
70
- }, {
71
- controlType: 'text',
72
- id: 'branch_name',
73
- text: 'some_long_branch'
74
- }, {
75
- controlType: 'divider'
76
- }, {
77
- controlType: 'icon',
78
- id: 'github_icon',
79
- iconType: 'logoGithub',
80
- onClick: function onClick() {},
81
- title: 'Open in Github',
82
- 'aria-label': 'Open in Github'
83
- }, {
84
- controlType: 'divider'
85
- }, {
86
- controlType: 'button',
87
- id: 'open_history_view',
88
- label: contentIsVisible ? 'Hide history' : 'Show history',
89
- color: 'primary',
90
- onClick: toggleContent
91
- }];
92
- var display;
93
- if (isDisplaying) {
94
- display = (0, _react2.jsx)(_control_bar.EuiControlBar, {
95
- controls: codeControls,
96
- showContent: contentIsVisible
97
- }, (0, _react2.jsx)("div", {
98
- style: {
99
- padding: '2rem',
100
- maxWidth: '60rem',
101
- margin: '0 auto'
102
- }
103
- }, (0, _react2.jsx)(_panel.EuiPanel, null, (0, _react2.jsx)(_text.EuiText, null, (0, _react2.jsx)("h1", null, "1984"), (0, _react2.jsx)("h3", null, "By: George Orwell"), (0, _react2.jsx)("p", null, "It was a bright cold day in April, and the clocks were striking thirteen. Winston Smith, his chin nuzzled into his breast in an effort to escape the vile wind, slipped quickly through the glass doors of Victory Mansions, though not quickly enough to prevent a swirl of gritty dust from entering along with him."), (0, _react2.jsx)("p", null, "The hallway smelt of boiled cabbage and old rag mats. At one end of it a coloured poster, too large for indoor display, had been tacked to the wall. It depicted simply an enormous face, more than a metre wide: the face of a man of about forty-five, with a heavy black moustache and ruggedly handsome features. Winston made for the stairs. It was no use trying the lift. Even at the best of times it was seldom working, and at present the electric current was cut off during daylight hours. It was part of the economy drive in preparation for Hate Week. The flat was seven flights up, and Winston, who was thirty-nine and had a varicose ulcer above his right ankle, went slowly, resting several times on the way. On each landing, opposite the lift-shaft, the poster with the enormous face gazed from the wall. It was one of those pictures which are so contrived that the eyes follow you about when you move. BIG BROTHER IS WATCHING YOU, the caption beneath it ran."), (0, _react2.jsx)("p", null, "Inside the flat a fruity voice was reading out a list of figures which had something to do with the production of pig-iron. The voice came from an oblong metal plaque like a dulled mirror which formed part of the surface of the right-hand wall. Winston turned a switch and the voice sank somewhat, though the words were still distinguishable. The instrument (the telescreen, it was called) could be dimmed, but there was no way of shutting it off completely. He moved over to the window: a smallish, frail figure, the meagreness of his body merely emphasized by the blue overalls which were the uniform of the party. His hair was very fair, his face naturally sanguine, his skin roughened by coarse soap and blunt razor blades and the cold of the winter that had just ended.")))));
104
- }
105
- return (0, _react2.jsx)("div", null, (0, _react2.jsx)(_button.EuiButton, {
106
- onClick: toggleDisplay
107
- }, "Toggle example"), display);
108
- };
109
- beforeEach(function () {
110
- cy.viewport(1024, 768);
111
- cy.mount((0, _react2.jsx)(ControlBar, null));
112
- cy.get('section[aria-label="Page level controls"]').should('not.exist');
113
- });
114
- describe('EuiControlBar', function () {
115
- describe('Automated accessibility check', function () {
116
- it('has zero violations on render', function () {
117
- cy.checkAxe();
118
- });
119
- it('has zero violations when control bar is shown', function () {
120
- cy.get('button.euiButton').contains('Toggle example').realClick();
121
- cy.get('section[aria-label="Page level controls"]').should('exist');
122
- cy.checkAxe({
123
- context: 'section[aria-label="Page level controls"]'
124
- });
125
- });
126
- it('has zero violations when control bar is hidden', function () {
127
- cy.get('button.euiButton').contains('Toggle example').realClick();
128
- cy.get('section[aria-label="Page level controls"]').should('exist');
129
- cy.get('button.euiButton').contains('Toggle example').realClick();
130
- cy.get('section[aria-label="Page level controls"]').should('not.exist');
131
- cy.checkAxe();
132
- });
133
- });
134
- });