@elastic/eui 116.3.1 → 116.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/es/components/banner/banner.js +1 -2
  2. package/es/components/banner/banner.styles.js +1 -1
  3. package/es/components/basic_table/basic_table.js +35 -5
  4. package/es/components/basic_table/basic_table.styles.js +19 -1
  5. package/es/components/basic_table/in_memory_table.js +17 -0
  6. package/es/components/basic_table/index.js +2 -1
  7. package/es/components/basic_table/pagination_bar.js +19 -4
  8. package/es/components/basic_table/pagination_bar.styles.js +21 -0
  9. package/es/components/basic_table/panel.styles.js +14 -0
  10. package/es/components/basic_table/use_panel_props.js +28 -0
  11. package/es/components/date_picker/auto_refresh/refresh_interval.js +176 -229
  12. package/es/components/flyout/flyout.component.js +10 -6
  13. package/es/components/flyout/flyout_menu.js +122 -19
  14. package/es/components/flyout/flyout_menu.styles.js +2 -1
  15. package/es/components/flyout/manager/actions.js +20 -0
  16. package/es/components/flyout/manager/flyout_child.js +23 -1
  17. package/es/components/flyout/manager/flyout_managed.js +65 -19
  18. package/es/components/flyout/manager/hooks.js +1 -1
  19. package/es/components/flyout/manager/index.js +2 -2
  20. package/es/components/flyout/manager/reducer.js +32 -8
  21. package/es/components/flyout/manager/selectors.js +8 -2
  22. package/es/components/flyout/manager/store.js +35 -2
  23. package/es/components/flyout/use_flyout_menu.js +2 -2
  24. package/es/components/form/form_control_layout/form_control_layout_icons.js +95 -143
  25. package/es/components/notification_icon/assets/info_fill.js +34 -0
  26. package/es/components/notification_icon/assets/warning_static.js +40 -0
  27. package/es/components/notification_icon/notification_icon.js +87 -0
  28. package/es/components/notification_icon/notification_icon.styles.js +22 -0
  29. package/es/components/table/mobile/table_sort_mobile.js +64 -103
  30. package/es/components/toast/global_toast_list.js +132 -6
  31. package/es/components/toast/global_toast_list.styles.js +31 -7
  32. package/es/components/toast/toast.js +242 -47
  33. package/es/components/toast/toast.styles.js +35 -47
  34. package/es/components/toast/toast_action.js +34 -0
  35. package/es/components/toast/types.js +9 -0
  36. package/es/components/tool_tip/tool_tip.js +3 -3
  37. package/eui.d.ts +1203 -971
  38. package/i18ntokens.json +1582 -1546
  39. package/lib/components/banner/banner.js +1 -2
  40. package/lib/components/banner/banner.styles.js +1 -1
  41. package/lib/components/basic_table/basic_table.js +34 -4
  42. package/lib/components/basic_table/basic_table.styles.js +19 -1
  43. package/lib/components/basic_table/in_memory_table.js +17 -0
  44. package/lib/components/basic_table/index.js +8 -1
  45. package/lib/components/basic_table/pagination_bar.js +19 -4
  46. package/lib/components/basic_table/pagination_bar.styles.js +26 -0
  47. package/lib/components/basic_table/panel.styles.js +20 -0
  48. package/lib/components/basic_table/use_panel_props.js +33 -0
  49. package/lib/components/date_picker/auto_refresh/refresh_interval.js +175 -229
  50. package/lib/components/flyout/flyout.component.js +10 -6
  51. package/lib/components/flyout/flyout_menu.js +120 -19
  52. package/lib/components/flyout/flyout_menu.styles.js +2 -1
  53. package/lib/components/flyout/manager/actions.js +21 -1
  54. package/lib/components/flyout/manager/flyout_child.js +23 -1
  55. package/lib/components/flyout/manager/flyout_managed.js +41 -17
  56. package/lib/components/flyout/manager/hooks.js +6 -0
  57. package/lib/components/flyout/manager/index.js +12 -0
  58. package/lib/components/flyout/manager/reducer.js +31 -7
  59. package/lib/components/flyout/manager/selectors.js +9 -3
  60. package/lib/components/flyout/manager/store.js +34 -1
  61. package/lib/components/flyout/use_flyout_menu.js +2 -2
  62. package/lib/components/form/form_control_layout/form_control_layout_icons.js +95 -145
  63. package/lib/components/notification_icon/assets/info_fill.js +41 -0
  64. package/lib/components/notification_icon/assets/warning_static.js +47 -0
  65. package/lib/components/notification_icon/notification_icon.js +93 -0
  66. package/lib/components/notification_icon/notification_icon.styles.js +28 -0
  67. package/lib/components/notification_icon/svgs/info_fill.svg +3 -0
  68. package/lib/components/notification_icon/svgs/warning_static.svg +5 -0
  69. package/lib/components/table/mobile/table_sort_mobile.js +71 -108
  70. package/lib/components/toast/global_toast_list.js +132 -6
  71. package/lib/components/toast/global_toast_list.styles.js +31 -8
  72. package/lib/components/toast/toast.js +244 -47
  73. package/lib/components/toast/toast.styles.js +32 -45
  74. package/lib/components/toast/toast_action.js +40 -0
  75. package/lib/components/toast/types.js +15 -0
  76. package/lib/components/tool_tip/tool_tip.js +2 -2
  77. package/optimize/es/components/banner/banner.js +1 -2
  78. package/optimize/es/components/banner/banner.styles.js +1 -1
  79. package/optimize/es/components/basic_table/basic_table.js +18 -5
  80. package/optimize/es/components/basic_table/basic_table.styles.js +19 -1
  81. package/optimize/es/components/basic_table/index.js +2 -1
  82. package/optimize/es/components/basic_table/pagination_bar.js +19 -4
  83. package/optimize/es/components/basic_table/pagination_bar.styles.js +21 -0
  84. package/optimize/es/components/basic_table/panel.styles.js +14 -0
  85. package/optimize/es/components/basic_table/use_panel_props.js +28 -0
  86. package/optimize/es/components/date_picker/auto_refresh/refresh_interval.js +172 -196
  87. package/optimize/es/components/flyout/flyout.component.js +10 -6
  88. package/optimize/es/components/flyout/flyout_menu.js +99 -18
  89. package/optimize/es/components/flyout/flyout_menu.styles.js +2 -1
  90. package/optimize/es/components/flyout/manager/actions.js +20 -0
  91. package/optimize/es/components/flyout/manager/flyout_managed.js +42 -18
  92. package/optimize/es/components/flyout/manager/hooks.js +1 -1
  93. package/optimize/es/components/flyout/manager/index.js +2 -2
  94. package/optimize/es/components/flyout/manager/reducer.js +32 -8
  95. package/optimize/es/components/flyout/manager/selectors.js +8 -2
  96. package/optimize/es/components/flyout/manager/store.js +35 -2
  97. package/optimize/es/components/flyout/use_flyout_menu.js +2 -2
  98. package/optimize/es/components/form/form_control_layout/form_control_layout_icons.js +96 -115
  99. package/optimize/es/components/notification_icon/assets/info_fill.js +33 -0
  100. package/optimize/es/components/notification_icon/assets/warning_static.js +39 -0
  101. package/optimize/es/components/notification_icon/notification_icon.js +77 -0
  102. package/optimize/es/components/notification_icon/notification_icon.styles.js +22 -0
  103. package/optimize/es/components/table/mobile/table_sort_mobile.js +59 -82
  104. package/optimize/es/components/toast/global_toast_list.js +31 -6
  105. package/optimize/es/components/toast/global_toast_list.styles.js +31 -7
  106. package/optimize/es/components/toast/toast.js +143 -47
  107. package/optimize/es/components/toast/toast.styles.js +35 -47
  108. package/optimize/es/components/toast/toast_action.js +33 -0
  109. package/optimize/es/components/toast/types.js +9 -0
  110. package/optimize/es/components/tool_tip/tool_tip.js +3 -3
  111. package/optimize/lib/components/banner/banner.js +1 -2
  112. package/optimize/lib/components/banner/banner.styles.js +1 -1
  113. package/optimize/lib/components/basic_table/basic_table.js +17 -4
  114. package/optimize/lib/components/basic_table/basic_table.styles.js +19 -1
  115. package/optimize/lib/components/basic_table/index.js +8 -1
  116. package/optimize/lib/components/basic_table/pagination_bar.js +19 -4
  117. package/optimize/lib/components/basic_table/pagination_bar.styles.js +26 -0
  118. package/optimize/lib/components/basic_table/panel.styles.js +20 -0
  119. package/optimize/lib/components/basic_table/use_panel_props.js +33 -0
  120. package/optimize/lib/components/date_picker/auto_refresh/refresh_interval.js +170 -194
  121. package/optimize/lib/components/flyout/flyout.component.js +10 -6
  122. package/optimize/lib/components/flyout/flyout_menu.js +98 -18
  123. package/optimize/lib/components/flyout/flyout_menu.styles.js +2 -1
  124. package/optimize/lib/components/flyout/manager/actions.js +21 -1
  125. package/optimize/lib/components/flyout/manager/flyout_managed.js +41 -17
  126. package/optimize/lib/components/flyout/manager/hooks.js +6 -0
  127. package/optimize/lib/components/flyout/manager/index.js +12 -0
  128. package/optimize/lib/components/flyout/manager/reducer.js +31 -7
  129. package/optimize/lib/components/flyout/manager/selectors.js +9 -3
  130. package/optimize/lib/components/flyout/manager/store.js +34 -1
  131. package/optimize/lib/components/flyout/use_flyout_menu.js +2 -2
  132. package/optimize/lib/components/form/form_control_layout/form_control_layout_icons.js +96 -117
  133. package/optimize/lib/components/notification_icon/assets/info_fill.js +41 -0
  134. package/optimize/lib/components/notification_icon/assets/warning_static.js +47 -0
  135. package/optimize/lib/components/notification_icon/notification_icon.js +83 -0
  136. package/optimize/lib/components/notification_icon/notification_icon.styles.js +28 -0
  137. package/optimize/lib/components/notification_icon/svgs/info_fill.svg +3 -0
  138. package/optimize/lib/components/notification_icon/svgs/warning_static.svg +5 -0
  139. package/optimize/lib/components/table/mobile/table_sort_mobile.js +61 -83
  140. package/optimize/lib/components/toast/global_toast_list.js +31 -6
  141. package/optimize/lib/components/toast/global_toast_list.styles.js +30 -7
  142. package/optimize/lib/components/toast/toast.js +146 -47
  143. package/optimize/lib/components/toast/toast.styles.js +33 -45
  144. package/optimize/lib/components/toast/toast_action.js +39 -0
  145. package/optimize/lib/components/toast/types.js +15 -0
  146. package/optimize/lib/components/tool_tip/tool_tip.js +2 -2
  147. package/package.json +7 -5
  148. package/test-env/components/banner/banner.js +1 -2
  149. package/test-env/components/banner/banner.styles.js +1 -1
  150. package/test-env/components/basic_table/basic_table.js +34 -4
  151. package/test-env/components/basic_table/basic_table.styles.js +19 -1
  152. package/test-env/components/basic_table/in_memory_table.js +17 -0
  153. package/test-env/components/basic_table/index.js +8 -1
  154. package/test-env/components/basic_table/pagination_bar.js +19 -4
  155. package/test-env/components/basic_table/pagination_bar.styles.js +26 -0
  156. package/test-env/components/basic_table/panel.styles.js +20 -0
  157. package/test-env/components/basic_table/use_panel_props.js +33 -0
  158. package/test-env/components/date_picker/auto_refresh/refresh_interval.js +170 -220
  159. package/test-env/components/flyout/flyout.component.js +10 -6
  160. package/test-env/components/flyout/flyout_menu.js +121 -19
  161. package/test-env/components/flyout/flyout_menu.styles.js +2 -1
  162. package/test-env/components/flyout/manager/actions.js +21 -1
  163. package/test-env/components/flyout/manager/flyout_child.js +23 -1
  164. package/test-env/components/flyout/manager/flyout_managed.js +41 -17
  165. package/test-env/components/flyout/manager/hooks.js +6 -0
  166. package/test-env/components/flyout/manager/index.js +12 -0
  167. package/test-env/components/flyout/manager/reducer.js +31 -7
  168. package/test-env/components/flyout/manager/selectors.js +9 -3
  169. package/test-env/components/flyout/manager/store.js +34 -1
  170. package/test-env/components/flyout/use_flyout_menu.js +2 -2
  171. package/test-env/components/form/form_control_layout/form_control_layout_icons.js +95 -139
  172. package/test-env/components/notification_icon/assets/info_fill.js +41 -0
  173. package/test-env/components/notification_icon/assets/warning_static.js +47 -0
  174. package/test-env/components/notification_icon/notification_icon.js +46 -0
  175. package/test-env/components/notification_icon/notification_icon.styles.js +28 -0
  176. package/test-env/components/table/mobile/table_sort_mobile.js +61 -98
  177. package/test-env/components/toast/global_toast_list.js +132 -6
  178. package/test-env/components/toast/global_toast_list.styles.js +30 -7
  179. package/test-env/components/toast/toast.js +242 -47
  180. package/test-env/components/toast/toast.styles.js +33 -45
  181. package/test-env/components/toast/toast_action.js +39 -0
  182. package/test-env/components/toast/types.js +15 -0
  183. package/test-env/components/tool_tip/tool_tip.js +2 -2
@@ -1,14 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
4
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
5
- import _createClass from "@babel/runtime/helpers/createClass";
6
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
- import _inherits from "@babel/runtime/helpers/inherits";
9
4
  var _excluded = ["ref", "side"];
10
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
11
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
12
5
  /*
13
6
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
14
7
  * or more contributor license agreements. Licensed under the Elastic License
@@ -17,8 +10,8 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
17
10
  * Side Public License, v 1.
18
11
  */
19
12
 
20
- import React, { Component } from 'react';
21
- import { RenderWithEuiStylesMemoizer } from '../../../services';
13
+ import React from 'react';
14
+ import { useEuiTheme } from '../../../services';
22
15
  import { EuiIcon } from '../../icon';
23
16
  import { EuiLoadingSpinner } from '../../loading';
24
17
  import { EuiFormControlLayoutClearButton } from './form_control_layout_clear_button';
@@ -29,111 +22,99 @@ export var ICON_SIDES = ['left', 'right'];
29
22
  export var isIconShape = function isIconShape(icon) {
30
23
  return !!icon && icon.hasOwnProperty('type');
31
24
  };
32
- export var EuiFormControlLayoutIcons = /*#__PURE__*/function (_Component) {
33
- function EuiFormControlLayoutIcons() {
34
- _classCallCheck(this, EuiFormControlLayoutIcons);
35
- return _callSuper(this, EuiFormControlLayoutIcons, arguments);
25
+ export var EuiFormControlLayoutIcons = function EuiFormControlLayoutIcons(_ref) {
26
+ var _ref$side = _ref.side,
27
+ side = _ref$side === void 0 ? 'left' : _ref$side,
28
+ _ref$iconsPosition = _ref.iconsPosition,
29
+ iconsPosition = _ref$iconsPosition === void 0 ? 'absolute' : _ref$iconsPosition,
30
+ compressed = _ref.compressed,
31
+ isDisabled = _ref.isDisabled,
32
+ icon = _ref.icon,
33
+ clear = _ref.clear,
34
+ isLoading = _ref.isLoading,
35
+ isInvalid = _ref.isInvalid,
36
+ isDropdown = _ref.isDropdown;
37
+ var euiThemeContext = useEuiTheme();
38
+ var styles = euiFormControlLayoutIconsStyles(euiThemeContext);
39
+ var cssStyles = [styles.euiFormControlLayoutIcons, compressed ? styles.compressed : styles.uncompressed].concat(_toConsumableArray(iconsPosition === 'absolute' ? [styles.position.absolute.absolute, compressed ? styles.position.absolute.compressed[side] : styles.position.absolute.uncompressed[side]] : [styles.position.static.static, compressed ? styles.position.static.compressed : styles.position.static.uncompressed]), [isDisabled && styles.disabled]);
40
+ return ___EmotionJSX("div", {
41
+ css: cssStyles,
42
+ className: "euiFormControlLayoutIcons"
43
+ }, ___EmotionJSX(ClearButton, {
44
+ clear: clear,
45
+ isDisabled: isDisabled
46
+ }), ___EmotionJSX(LoadingSpinner, {
47
+ isLoading: isLoading
48
+ }), ___EmotionJSX(InvalidIcon, {
49
+ isInvalid: isInvalid
50
+ }), ___EmotionJSX(CustomIcon, {
51
+ icon: icon,
52
+ isDisabled: isDisabled
53
+ }), ___EmotionJSX(DropdownIcon, {
54
+ isDropdown: isDropdown,
55
+ isDisabled: isDisabled
56
+ }));
57
+ };
58
+ var CustomIcon = function CustomIcon(_ref2) {
59
+ var icon = _ref2.icon,
60
+ isDisabled = _ref2.isDisabled;
61
+ if (!icon) {
62
+ return null;
36
63
  }
37
- _inherits(EuiFormControlLayoutIcons, _Component);
38
- return _createClass(EuiFormControlLayoutIcons, [{
39
- key: "render",
40
- value: function render() {
41
- var _this$props = this.props,
42
- _this$props$side = _this$props.side,
43
- side = _this$props$side === void 0 ? 'left' : _this$props$side,
44
- _this$props$iconsPosi = _this$props.iconsPosition,
45
- iconsPosition = _this$props$iconsPosi === void 0 ? 'absolute' : _this$props$iconsPosi,
46
- compressed = _this$props.compressed,
47
- isDisabled = _this$props.isDisabled;
48
- var customIcon = this.renderCustomIcon();
49
- var loadingSpinner = this.renderLoadingSpinner();
50
- var clearButton = this.renderClearButton();
51
- var invalidIcon = this.renderInvalidIcon();
52
- var dropdownIcon = this.renderDropdownIcon();
53
- return ___EmotionJSX(RenderWithEuiStylesMemoizer, null, function (stylesMemoizer) {
54
- var styles = stylesMemoizer(euiFormControlLayoutIconsStyles);
55
- var cssStyles = [styles.euiFormControlLayoutIcons, compressed ? styles.compressed : styles.uncompressed].concat(_toConsumableArray(iconsPosition === 'absolute' ? [styles.position.absolute.absolute, compressed ? styles.position.absolute.compressed[side] : styles.position.absolute.uncompressed[side]] : [styles.position.static.static, compressed ? styles.position.static.compressed : styles.position.static.uncompressed]), [isDisabled && styles.disabled]);
56
- return ___EmotionJSX("div", {
57
- css: cssStyles,
58
- className: "euiFormControlLayoutIcons"
59
- }, clearButton, loadingSpinner, invalidIcon, customIcon, dropdownIcon);
60
- });
61
- }
62
- }, {
63
- key: "renderCustomIcon",
64
- value: function renderCustomIcon() {
65
- var _this$props2 = this.props,
66
- icon = _this$props2.icon,
67
- isDisabled = _this$props2.isDisabled;
68
- if (!icon) {
69
- return null;
70
- }
71
64
 
72
- // Normalize the icon to an object if it's a string.
73
- var iconProps = isIconShape(icon) ? icon : {
74
- type: icon
75
- };
76
- var iconRef = iconProps.ref,
77
- side = iconProps.side,
78
- iconRest = _objectWithoutProperties(iconProps, _excluded);
79
- return ___EmotionJSX(EuiFormControlLayoutCustomIcon, _extends({
80
- size: "m",
81
- disabled: isDisabled,
82
- iconRef: iconRef
83
- }, iconRest));
84
- }
85
- }, {
86
- key: "renderDropdownIcon",
87
- value: function renderDropdownIcon() {
88
- var _this$props3 = this.props,
89
- isDropdown = _this$props3.isDropdown,
90
- isDisabled = _this$props3.isDisabled;
91
- if (!isDropdown) {
92
- return null;
93
- }
94
- return ___EmotionJSX(EuiFormControlLayoutCustomIcon, {
95
- size: "m",
96
- disabled: isDisabled,
97
- type: "chevronSingleDown"
98
- });
99
- }
100
- }, {
101
- key: "renderLoadingSpinner",
102
- value: function renderLoadingSpinner() {
103
- var isLoading = this.props.isLoading;
104
- if (!isLoading) {
105
- return null;
106
- }
107
- return ___EmotionJSX(EuiLoadingSpinner, {
108
- size: "m"
109
- });
110
- }
111
- }, {
112
- key: "renderClearButton",
113
- value: function renderClearButton() {
114
- var _this$props4 = this.props,
115
- clear = _this$props4.clear,
116
- isDisabled = _this$props4.isDisabled;
117
- if (!clear) {
118
- return null;
119
- }
120
- return ___EmotionJSX(EuiFormControlLayoutClearButton, _extends({
121
- size: "m",
122
- disabled: isDisabled
123
- }, clear));
124
- }
125
- }, {
126
- key: "renderInvalidIcon",
127
- value: function renderInvalidIcon() {
128
- var isInvalid = this.props.isInvalid;
129
- if (!isInvalid) {
130
- return null;
131
- }
132
- return ___EmotionJSX(EuiIcon, {
133
- size: "m",
134
- color: "danger",
135
- type: "warning"
136
- });
137
- }
138
- }]);
139
- }(Component);
65
+ // Normalize the icon to an object if it's a string.
66
+ var iconProps = isIconShape(icon) ? icon : {
67
+ type: icon
68
+ };
69
+ var iconRef = iconProps.ref,
70
+ side = iconProps.side,
71
+ iconRest = _objectWithoutProperties(iconProps, _excluded);
72
+ return ___EmotionJSX(EuiFormControlLayoutCustomIcon, _extends({
73
+ size: "m",
74
+ disabled: isDisabled,
75
+ iconRef: iconRef
76
+ }, iconRest));
77
+ };
78
+ var DropdownIcon = function DropdownIcon(_ref3) {
79
+ var isDropdown = _ref3.isDropdown,
80
+ isDisabled = _ref3.isDisabled;
81
+ if (!isDropdown) {
82
+ return null;
83
+ }
84
+ return ___EmotionJSX(EuiFormControlLayoutCustomIcon, {
85
+ size: "m",
86
+ disabled: isDisabled,
87
+ type: "chevronSingleDown"
88
+ });
89
+ };
90
+ var LoadingSpinner = function LoadingSpinner(_ref4) {
91
+ var isLoading = _ref4.isLoading;
92
+ if (!isLoading) {
93
+ return null;
94
+ }
95
+ return ___EmotionJSX(EuiLoadingSpinner, {
96
+ size: "m"
97
+ });
98
+ };
99
+ var ClearButton = function ClearButton(_ref5) {
100
+ var clear = _ref5.clear,
101
+ isDisabled = _ref5.isDisabled;
102
+ if (!clear) {
103
+ return null;
104
+ }
105
+ return ___EmotionJSX(EuiFormControlLayoutClearButton, _extends({
106
+ size: "m",
107
+ disabled: isDisabled
108
+ }, clear));
109
+ };
110
+ var InvalidIcon = function InvalidIcon(_ref6) {
111
+ var isInvalid = _ref6.isInvalid;
112
+ if (!isInvalid) {
113
+ return null;
114
+ }
115
+ return ___EmotionJSX(EuiIcon, {
116
+ size: "m",
117
+ color: "danger",
118
+ type: "warning"
119
+ });
120
+ };
@@ -0,0 +1,33 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["title", "titleId"];
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
+ // THIS IS A GENERATED FILE. DO NOT MODIFY MANUALLY. @see scripts/compile-icons.js
13
+
14
+ import * as React from 'react';
15
+ import { jsx as ___EmotionJSX } from "@emotion/react";
16
+ var EuiIconInfoFill = function EuiIconInfoFill(_ref) {
17
+ var title = _ref.title,
18
+ titleId = _ref.titleId,
19
+ props = _objectWithoutProperties(_ref, _excluded);
20
+ return ___EmotionJSX("svg", _extends({
21
+ xmlns: "http://www.w3.org/2000/svg",
22
+ width: 16,
23
+ height: 16,
24
+ fill: "none",
25
+ viewBox: "0 0 16 16",
26
+ "aria-labelledby": titleId
27
+ }, props), title ? ___EmotionJSX("title", {
28
+ id: titleId
29
+ }, title) : null, ___EmotionJSX("path", {
30
+ d: "M8 1a7 7 0 1 1 0 14A7 7 0 0 1 8 1ZM6.5 7v1h1v3H6v1h4v-1H8.5V7h-2ZM8 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z"
31
+ }));
32
+ };
33
+ export var icon = EuiIconInfoFill;
@@ -0,0 +1,39 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["title", "titleId"];
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
+ // THIS IS A GENERATED FILE. DO NOT MODIFY MANUALLY. @see scripts/compile-icons.js
13
+
14
+ import * as React from 'react';
15
+ import { jsx as ___EmotionJSX } from "@emotion/react";
16
+ var EuiIconWarningStatic = function EuiIconWarningStatic(_ref) {
17
+ var title = _ref.title,
18
+ titleId = _ref.titleId,
19
+ props = _objectWithoutProperties(_ref, _excluded);
20
+ return ___EmotionJSX("svg", _extends({
21
+ xmlns: "http://www.w3.org/2000/svg",
22
+ width: 16,
23
+ height: 16,
24
+ fill: "none",
25
+ viewBox: "0 0 16 16",
26
+ "aria-labelledby": titleId
27
+ }, props), title ? ___EmotionJSX("title", {
28
+ id: titleId
29
+ }, title) : null, ___EmotionJSX("path", {
30
+ fill: "#FACB3D",
31
+ fillRule: "evenodd",
32
+ d: "M8 1a1 1 0 0 1 .863.496l7 12A1 1 0 0 1 15 15H1a1 1 0 0 1-.864-1.504l7-12A1 1 0 0 1 8 1Z",
33
+ clipRule: "evenodd"
34
+ }), ___EmotionJSX("path", {
35
+ fill: "#825803",
36
+ d: "M7 12a1 1 0 1 1 2 0 1 1 0 0 1-2 0ZM7.5 10V5h1v5h-1Z"
37
+ }));
38
+ };
39
+ export var icon = EuiIconWarningStatic;
@@ -0,0 +1,77 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["className", "type", "size", "css"];
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 classNames from 'classnames';
14
+ import { useEuiMemoizedStyles } from '../../services';
15
+ import { EuiIcon } from '../icon/icon';
16
+ import { icon as EuiIconErrorFill } from '../icon/assets/error_fill';
17
+ import { icon as EuiIconCheckCircleFill } from '../icon/assets/check_circle_fill';
18
+ import { icon as EuiIconInfoFill } from './assets/info_fill';
19
+ import { icon as EuiIconWarningStatic } from './assets/warning_static';
20
+ import { euiNotificationIconStyles } from './notification_icon.styles';
21
+ import { jsx as ___EmotionJSX } from "@emotion/react";
22
+ var TYPES = ['info', 'success', 'warning', 'error'];
23
+ export var NOTIFICATION_ICONS_MAP = {
24
+ info: {
25
+ name: 'infoFill',
26
+ icon: EuiIconInfoFill
27
+ },
28
+ success: {
29
+ name: 'checkCircleFill',
30
+ icon: EuiIconCheckCircleFill
31
+ },
32
+ warning: {
33
+ name: 'warningStatic',
34
+ icon: EuiIconWarningStatic
35
+ },
36
+ error: {
37
+ name: 'errorFill',
38
+ icon: EuiIconErrorFill
39
+ }
40
+ };
41
+ var ICON_TYPES_MAP = {
42
+ info: {
43
+ icon: NOTIFICATION_ICONS_MAP.info.icon,
44
+ color: 'primary'
45
+ },
46
+ success: {
47
+ icon: NOTIFICATION_ICONS_MAP.success.icon,
48
+ color: 'success'
49
+ },
50
+ warning: {
51
+ icon: NOTIFICATION_ICONS_MAP.warning.icon
52
+ },
53
+ error: {
54
+ icon: NOTIFICATION_ICONS_MAP.error.icon,
55
+ color: 'danger'
56
+ }
57
+ };
58
+ export var EuiNotificationIcon = function EuiNotificationIcon(_ref) {
59
+ var className = _ref.className,
60
+ type = _ref.type,
61
+ _ref$size = _ref.size,
62
+ size = _ref$size === void 0 ? 'm' : _ref$size,
63
+ css = _ref.css,
64
+ rest = _objectWithoutProperties(_ref, _excluded);
65
+ var Icon = ICON_TYPES_MAP[type];
66
+ var classes = classNames('euiNotificationIcon', className);
67
+ var styles = useEuiMemoizedStyles(euiNotificationIconStyles);
68
+ var cssStyles = [styles.euiNotificationIcon, size === 'l' && styles.size[size], css];
69
+ return ___EmotionJSX(EuiIcon, _extends({}, rest, {
70
+ className: classes,
71
+ css: cssStyles,
72
+ type: Icon.icon,
73
+ color: Icon.color,
74
+ "aria-hidden": "true",
75
+ size: size
76
+ }));
77
+ };
@@ -0,0 +1,22 @@
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
+
9
+ import { css } from '@emotion/react';
10
+ import { mathWithUnits } from '@elastic/eui-theme-common';
11
+ export var euiNotificationIconStyles = function euiNotificationIconStyles(_ref) {
12
+ var euiTheme = _ref.euiTheme;
13
+ var sizeL = mathWithUnits(euiTheme.size.base, function (x) {
14
+ return x * 1.25;
15
+ });
16
+ return {
17
+ euiNotificationIcon: /*#__PURE__*/css(";label:euiNotificationIcon;"),
18
+ size: {
19
+ l: /*#__PURE__*/css("block-size:", sizeL, ";inline-size:", sizeL, ";;label:l;")
20
+ }
21
+ };
22
+ };
@@ -1,14 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
- import _createClass from "@babel/runtime/helpers/createClass";
5
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
- import _inherits from "@babel/runtime/helpers/inherits";
8
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
4
  var _excluded = ["className", "anchorPosition", "items"];
10
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
11
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
12
5
  /*
13
6
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
14
7
  * or more contributor license agreements. Licensed under the Elastic License
@@ -17,7 +10,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
17
10
  * Side Public License, v 1.
18
11
  */
19
12
 
20
- import React, { Component } from 'react';
13
+ import React, { useState } from 'react';
21
14
  import classNames from 'classnames';
22
15
  import { EuiButtonEmpty } from '../../button/button_empty';
23
16
  import { EuiPopover } from '../../popover';
@@ -25,77 +18,61 @@ import { EuiContextMenuPanel } from '../../context_menu';
25
18
  import { EuiI18n } from '../../i18n';
26
19
  import { EuiTableSortMobileItem } from './table_sort_mobile_item';
27
20
  import { jsx as ___EmotionJSX } from "@emotion/react";
28
- export var EuiTableSortMobile = /*#__PURE__*/function (_Component) {
29
- function EuiTableSortMobile() {
30
- var _this;
31
- _classCallCheck(this, EuiTableSortMobile);
32
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
33
- args[_key] = arguments[_key];
34
- }
35
- _this = _callSuper(this, EuiTableSortMobile, [].concat(args));
36
- _defineProperty(_this, "state", {
37
- isPopoverOpen: false
21
+ // Aligns the button to the right even when it's the only element present
22
+ var euiTableSortMobileStyles = {
23
+ marginInlineStart: 'auto',
24
+ label: 'euiTableSortMobile'
25
+ };
26
+ export var EuiTableSortMobile = function EuiTableSortMobile(_ref) {
27
+ var className = _ref.className,
28
+ anchorPosition = _ref.anchorPosition,
29
+ items = _ref.items,
30
+ rest = _objectWithoutProperties(_ref, _excluded);
31
+ var _useState = useState(false),
32
+ _useState2 = _slicedToArray(_useState, 2),
33
+ isPopoverOpen = _useState2[0],
34
+ setIsPopoverOpen = _useState2[1];
35
+ var classes = classNames('euiTableSortMobile', className);
36
+ var onButtonClick = function onButtonClick() {
37
+ setIsPopoverOpen(function (isOpen) {
38
+ return !isOpen;
38
39
  });
39
- _defineProperty(_this, "onButtonClick", function () {
40
- _this.setState({
41
- isPopoverOpen: !_this.state.isPopoverOpen
42
- });
43
- });
44
- _defineProperty(_this, "closePopover", function () {
45
- _this.setState({
46
- isPopoverOpen: false
47
- });
48
- });
49
- // Aligns the button to the right even when it's the only element present
50
- _defineProperty(_this, "euiTableSortMobileStyles", {
51
- marginInlineStart: 'auto',
52
- label: 'euiTableSortMobile'
53
- });
54
- return _this;
55
- }
56
- _inherits(EuiTableSortMobile, _Component);
57
- return _createClass(EuiTableSortMobile, [{
58
- key: "render",
59
- value: function render() {
60
- var _this$props = this.props,
61
- className = _this$props.className,
62
- anchorPosition = _this$props.anchorPosition,
63
- items = _this$props.items,
64
- rest = _objectWithoutProperties(_this$props, _excluded);
65
- var classes = classNames('euiTableSortMobile', className);
66
- var mobileSortButton = ___EmotionJSX(EuiButtonEmpty, {
67
- iconType: "chevronSingleDown",
68
- iconSide: "right",
69
- onClick: this.onButtonClick.bind(this),
70
- flush: "right",
71
- size: "xs"
72
- }, ___EmotionJSX(EuiI18n, {
73
- token: "euiTableSortMobile.sorting",
74
- default: "Sorting"
75
- }));
76
- var mobileSortPopover = ___EmotionJSX(EuiPopover, _extends({
77
- button: mobileSortButton,
78
- isOpen: this.state.isPopoverOpen,
79
- closePopover: this.closePopover,
80
- anchorPosition: anchorPosition || 'downRight',
81
- panelPaddingSize: "none"
82
- }, rest), ___EmotionJSX(EuiContextMenuPanel, {
83
- style: {
84
- minWidth: 200
85
- },
86
- items: items && items.length ? items.map(function (item) {
87
- return ___EmotionJSX(EuiTableSortMobileItem, {
88
- key: item.key,
89
- onSort: item.onSort,
90
- isSorted: item.isSorted,
91
- isSortAscending: item.isSortAscending
92
- }, item.name);
93
- }) : undefined
94
- }));
95
- return ___EmotionJSX("div", {
96
- className: classes,
97
- css: this.euiTableSortMobileStyles
98
- }, mobileSortPopover);
99
- }
100
- }]);
101
- }(Component);
40
+ };
41
+ var closePopover = function closePopover() {
42
+ setIsPopoverOpen(false);
43
+ };
44
+ var mobileSortButton = ___EmotionJSX(EuiButtonEmpty, {
45
+ iconType: "chevronSingleDown",
46
+ iconSide: "right",
47
+ onClick: onButtonClick,
48
+ flush: "right",
49
+ size: "xs"
50
+ }, ___EmotionJSX(EuiI18n, {
51
+ token: "euiTableSortMobile.sorting",
52
+ default: "Sorting"
53
+ }));
54
+ var mobileSortPopover = ___EmotionJSX(EuiPopover, _extends({
55
+ button: mobileSortButton,
56
+ isOpen: isPopoverOpen,
57
+ closePopover: closePopover,
58
+ anchorPosition: anchorPosition || 'downRight',
59
+ panelPaddingSize: "none"
60
+ }, rest), ___EmotionJSX(EuiContextMenuPanel, {
61
+ style: {
62
+ minWidth: 200
63
+ },
64
+ items: items !== null && items !== void 0 && items.length ? items.map(function (item) {
65
+ return ___EmotionJSX(EuiTableSortMobileItem, {
66
+ key: item.key,
67
+ onSort: item.onSort,
68
+ isSorted: item.isSorted,
69
+ isSortAscending: item.isSortAscending
70
+ }, item.name);
71
+ }) : undefined
72
+ }));
73
+ return ___EmotionJSX("div", {
74
+ className: classes,
75
+ css: euiTableSortMobileStyles
76
+ }, mobileSortPopover);
77
+ };
78
+ EuiTableSortMobile.displayName = 'EuiTableSortMobile';
@@ -3,7 +3,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
4
4
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
5
5
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
6
- var _excluded = ["className", "toasts", "dismissToast", "toastLifeTimeMs", "onClearAllToasts", "side", "showClearAllButtonAt"],
6
+ var _excluded = ["className", "toasts", "dismissToast", "toastLifeTimeMs", "onClearAllToasts", "side", "showClearAllButtonAt", "showNotificationBadge"],
7
7
  _excluded2 = ["text", "toastLifeTimeMs"];
8
8
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
9
9
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -25,6 +25,7 @@ import { EuiToast } from './toast';
25
25
  import { euiGlobalToastListStyles } from './global_toast_list.styles';
26
26
  import { EuiButton } from '../button';
27
27
  import { EuiI18n } from '../i18n';
28
+ import { EuiNotificationBadge } from '../badge';
28
29
  import { jsx as ___EmotionJSX } from "@emotion/react";
29
30
  var sideToClassNameMap = {
30
31
  left: 'euiGlobalToastList--left',
@@ -44,6 +45,8 @@ export var EuiGlobalToastList = function EuiGlobalToastList(_ref) {
44
45
  side = _ref$side === void 0 ? 'right' : _ref$side,
45
46
  _ref$showClearAllButt = _ref.showClearAllButtonAt,
46
47
  showClearAllButtonAt = _ref$showClearAllButt === void 0 ? CLEAR_ALL_TOASTS_THRESHOLD_DEFAULT : _ref$showClearAllButt,
48
+ _ref$showNotification = _ref.showNotificationBadge,
49
+ showNotificationBadge = _ref$showNotification === void 0 ? false : _ref$showNotification,
47
50
  rest = _objectWithoutProperties(_ref, _excluded);
48
51
  var _useState = useState({}),
49
52
  _useState2 = _slicedToArray(_useState, 2),
@@ -218,8 +221,9 @@ export var EuiGlobalToastList = function EuiGlobalToastList(_ref) {
218
221
  var renderedToasts = useMemo(function () {
219
222
  return toasts.map(function (toast) {
220
223
  var text = toast.text,
221
- toastLifeTimeMs = toast.toastLifeTimeMs,
224
+ perToastLifeTimeMs = toast.toastLifeTimeMs,
222
225
  rest = _objectWithoutProperties(toast, _excluded2);
226
+ var effectiveLifeTimeMs = perToastLifeTimeMs !== null && perToastLifeTimeMs !== void 0 ? perToastLifeTimeMs : toastLifeTimeMs;
223
227
  var onClose = function onClose() {
224
228
  return dismissToast(toast);
225
229
  };
@@ -230,9 +234,12 @@ export var EuiGlobalToastList = function EuiGlobalToastList(_ref) {
230
234
  onClose: onClose,
231
235
  onFocus: onMouseEnter,
232
236
  onBlur: onMouseLeave
233
- }, rest), text));
237
+ }, rest, {
238
+ animationMs: effectiveLifeTimeMs,
239
+ text: text
240
+ })));
234
241
  });
235
- }, [toasts, toastIdToDismissedMap, dismissToast, onMouseEnter, onMouseLeave]);
242
+ }, [toasts, toastIdToDismissedMap, dismissToast, onMouseEnter, onMouseLeave, toastLifeTimeMs]);
236
243
  var clearAllButton = useMemo(function () {
237
244
  if (toasts.length && showClearAllButtonAt && toasts.length >= showClearAllButtonAt) {
238
245
  return ___EmotionJSX(EuiI18n, {
@@ -246,7 +253,8 @@ export var EuiGlobalToastList = function EuiGlobalToastList(_ref) {
246
253
  return ___EmotionJSX(EuiGlobalToastListItem, {
247
254
  isDismissed: false
248
255
  }, ___EmotionJSX(EuiButton, {
249
- fill: true,
256
+ fullWidth: true,
257
+ size: "s",
250
258
  color: "text",
251
259
  onClick: function onClick() {
252
260
  toasts.forEach(function (toast) {
@@ -262,11 +270,28 @@ export var EuiGlobalToastList = function EuiGlobalToastList(_ref) {
262
270
  }
263
271
  }, [showClearAllButtonAt, onClearAllToasts, toasts, dismissToastProp, styles]);
264
272
  var classes = classNames('euiGlobalToastList', className);
273
+ var hasContent = renderedToasts.length > 0 || clearAllButton != null;
274
+ var notificationBadge = useMemo(function () {
275
+ var _toastIdToDismissedMa, _toasts$;
276
+ var toastWasDismissed = (_toastIdToDismissedMa = toastIdToDismissedMap[(_toasts$ = toasts[0]) === null || _toasts$ === void 0 ? void 0 : _toasts$.id]) !== null && _toastIdToDismissedMa !== void 0 ? _toastIdToDismissedMa : false;
277
+ var isListEmpty = toasts.every(function (t) {
278
+ return toastIdToDismissedMap[t.id];
279
+ });
280
+ return showNotificationBadge && toasts.length > 0 && ___EmotionJSX(EuiNotificationBadge, {
281
+ className: "euiGlobalToastList__countBadge",
282
+ css: [styles.notificationBadge.notificationBadge, toastWasDismissed && styles.notificationBadge.hasFadeOut, isListEmpty && styles.notificationBadge.hasFadeOut, ";label:notificationBadge;"],
283
+ size: "m",
284
+ color: "subdued",
285
+ "data-test-subj": "euiGlobalToastListNotificationBadge"
286
+ }, toasts.length);
287
+ }, [showNotificationBadge, toasts, toastIdToDismissedMap, styles]);
265
288
  return ___EmotionJSX("div", _extends({
266
289
  "aria-live": "polite",
267
290
  role: "log",
268
291
  ref: listElement,
269
292
  css: cssStyles,
270
293
  className: classes
271
- }, rest), renderedToasts, clearAllButton);
294
+ }, rest), hasContent && ___EmotionJSX("div", {
295
+ css: styles.content
296
+ }, notificationBadge, renderedToasts, clearAllButton));
272
297
  };