@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
@@ -21,8 +21,9 @@ var _toast = require("./toast");
21
21
  var _global_toast_list = require("./global_toast_list.styles");
22
22
  var _button = require("../button");
23
23
  var _i18n = require("../i18n");
24
+ var _badge = require("../badge");
24
25
  var _react2 = require("@emotion/react");
25
- var _excluded = ["className", "toasts", "dismissToast", "toastLifeTimeMs", "onClearAllToasts", "side", "showClearAllButtonAt"],
26
+ var _excluded = ["className", "toasts", "dismissToast", "toastLifeTimeMs", "onClearAllToasts", "side", "showClearAllButtonAt", "showNotificationBadge"],
26
27
  _excluded2 = ["text", "toastLifeTimeMs"];
27
28
  /*
28
29
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
@@ -53,6 +54,8 @@ var EuiGlobalToastList = exports.EuiGlobalToastList = function EuiGlobalToastLis
53
54
  side = _ref$side === void 0 ? 'right' : _ref$side,
54
55
  _ref$showClearAllButt = _ref.showClearAllButtonAt,
55
56
  showClearAllButtonAt = _ref$showClearAllButt === void 0 ? CLEAR_ALL_TOASTS_THRESHOLD_DEFAULT : _ref$showClearAllButt,
57
+ _ref$showNotification = _ref.showNotificationBadge,
58
+ showNotificationBadge = _ref$showNotification === void 0 ? false : _ref$showNotification,
56
59
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
57
60
  var _useState = (0, _react.useState)({}),
58
61
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -227,8 +230,9 @@ var EuiGlobalToastList = exports.EuiGlobalToastList = function EuiGlobalToastLis
227
230
  var renderedToasts = (0, _react.useMemo)(function () {
228
231
  return toasts.map(function (toast) {
229
232
  var text = toast.text,
230
- toastLifeTimeMs = toast.toastLifeTimeMs,
233
+ perToastLifeTimeMs = toast.toastLifeTimeMs,
231
234
  rest = (0, _objectWithoutProperties2.default)(toast, _excluded2);
235
+ var effectiveLifeTimeMs = perToastLifeTimeMs !== null && perToastLifeTimeMs !== void 0 ? perToastLifeTimeMs : toastLifeTimeMs;
232
236
  var onClose = function onClose() {
233
237
  return dismissToast(toast);
234
238
  };
@@ -239,9 +243,12 @@ var EuiGlobalToastList = exports.EuiGlobalToastList = function EuiGlobalToastLis
239
243
  onClose: onClose,
240
244
  onFocus: onMouseEnter,
241
245
  onBlur: onMouseLeave
242
- }, rest), text));
246
+ }, rest, {
247
+ animationMs: effectiveLifeTimeMs,
248
+ text: text
249
+ })));
243
250
  });
244
- }, [toasts, toastIdToDismissedMap, dismissToast, onMouseEnter, onMouseLeave]);
251
+ }, [toasts, toastIdToDismissedMap, dismissToast, onMouseEnter, onMouseLeave, toastLifeTimeMs]);
245
252
  var clearAllButton = (0, _react.useMemo)(function () {
246
253
  if (toasts.length && showClearAllButtonAt && toasts.length >= showClearAllButtonAt) {
247
254
  return (0, _react2.jsx)(_i18n.EuiI18n, {
@@ -255,7 +262,8 @@ var EuiGlobalToastList = exports.EuiGlobalToastList = function EuiGlobalToastLis
255
262
  return (0, _react2.jsx)(_global_toast_list_item.EuiGlobalToastListItem, {
256
263
  isDismissed: false
257
264
  }, (0, _react2.jsx)(_button.EuiButton, {
258
- fill: true,
265
+ fullWidth: true,
266
+ size: "s",
259
267
  color: "text",
260
268
  onClick: function onClick() {
261
269
  toasts.forEach(function (toast) {
@@ -271,11 +279,28 @@ var EuiGlobalToastList = exports.EuiGlobalToastList = function EuiGlobalToastLis
271
279
  }
272
280
  }, [showClearAllButtonAt, onClearAllToasts, toasts, dismissToastProp, styles]);
273
281
  var classes = (0, _classnames.default)('euiGlobalToastList', className);
282
+ var hasContent = renderedToasts.length > 0 || clearAllButton != null;
283
+ var notificationBadge = (0, _react.useMemo)(function () {
284
+ var _toastIdToDismissedMa, _toasts$;
285
+ var toastWasDismissed = (_toastIdToDismissedMa = toastIdToDismissedMap[(_toasts$ = toasts[0]) === null || _toasts$ === void 0 ? void 0 : _toasts$.id]) !== null && _toastIdToDismissedMa !== void 0 ? _toastIdToDismissedMa : false;
286
+ var isListEmpty = toasts.every(function (t) {
287
+ return toastIdToDismissedMap[t.id];
288
+ });
289
+ return showNotificationBadge && toasts.length > 0 && (0, _react2.jsx)(_badge.EuiNotificationBadge, {
290
+ className: "euiGlobalToastList__countBadge",
291
+ css: [styles.notificationBadge.notificationBadge, toastWasDismissed && styles.notificationBadge.hasFadeOut, isListEmpty && styles.notificationBadge.hasFadeOut, ";label:notificationBadge;"],
292
+ size: "m",
293
+ color: "subdued",
294
+ "data-test-subj": "euiGlobalToastListNotificationBadge"
295
+ }, toasts.length);
296
+ }, [showNotificationBadge, toasts, toastIdToDismissedMap, styles]);
274
297
  return (0, _react2.jsx)("div", (0, _extends2.default)({
275
298
  "aria-live": "polite",
276
299
  role: "log",
277
300
  ref: listElement,
278
301
  css: cssStyles,
279
302
  className: classes
280
- }, rest), renderedToasts, clearAllButton);
303
+ }, rest), hasContent && (0, _react2.jsx)("div", {
304
+ css: styles.content
305
+ }, notificationBadge, renderedToasts, clearAllButton));
281
306
  };
@@ -8,33 +8,56 @@ exports.euiGlobalToastListStyles = exports.euiGlobalToastListItemStyles = void 0
8
8
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
9
9
  var _react = require("@emotion/react");
10
10
  var _global_styling = require("../../global_styling");
11
- var _templateObject;
12
- /*
11
+ var _templateObject, _templateObject2;
12
+ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /*
13
13
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
14
14
  * or more contributor license agreements. Licensed under the Elastic License
15
15
  * 2.0 and the Server Side Public License, v 1; you may not use this file except
16
16
  * in compliance with, at your election, the Elastic License 2.0 or the Server
17
17
  * Side Public License, v 1.
18
18
  */
19
+ var _ref = process.env.NODE_ENV === "production" ? {
20
+ name: "ox3d1t-hasFadeOut",
21
+ styles: "opacity:0;label:hasFadeOut;"
22
+ } : {
23
+ name: "ox3d1t-hasFadeOut",
24
+ styles: "opacity:0;label:hasFadeOut;",
25
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
26
+ };
27
+ var _ref2 = process.env.NODE_ENV === "production" ? {
28
+ name: "19mjubd-content",
29
+ styles: "position:relative;label:content;"
30
+ } : {
31
+ name: "19mjubd-content",
32
+ styles: "position:relative;label:content;",
33
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
34
+ };
19
35
  var euiGlobalToastListStyles = exports.euiGlobalToastListStyles = function euiGlobalToastListStyles(euiThemeContext) {
20
36
  var euiTheme = euiThemeContext.euiTheme;
21
- var euiToastWidth = euiTheme.base * 25;
37
+ var euiToastWidth = euiTheme.base * 27.5; // 440px -> results in 360px toast width
38
+
39
+ var showNotificationBadge = (0, _react.keyframes)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n from { opacity: 0; }\n to { opacity: 1; }\n "])));
22
40
  return {
23
41
  /**
24
42
  * 1. Allow list to expand as items are added, but cap it at the screen height.
25
43
  * 2. Allow some padding for shadow
26
44
  */
27
45
  // Base
28
- euiGlobalToastList: /*#__PURE__*/(0, _react.css)((0, _global_styling.euiScrollBarStyles)(euiThemeContext), " display:flex;flex-direction:column;align-items:stretch;position:fixed;z-index:", euiTheme.levels.toast, ";", (0, _global_styling.logicalCSS)('bottom', 0), " ", (0, _global_styling.logicalCSS)('width', "".concat(euiToastWidth, "px")), (0, _global_styling.logicalCSS)('max-height', '100vh'), (0, _global_styling.logicalCSSWithFallback)('overflow-y', 'auto'), "scrollbar-width:none;&::-webkit-scrollbar{", (0, _global_styling.logicalSizeCSS)(0, 0), ";}&:not(:empty){", (0, _global_styling.logicalCSS)('padding-left', euiTheme.size.base), " ", (0, _global_styling.logicalCSS)('padding-right', euiTheme.size.base), " ", (0, _global_styling.logicalCSS)('padding-vertical', euiTheme.size.base), ";}", (0, _global_styling.euiMaxBreakpoint)(euiThemeContext, 'm'), "{&:not(:empty){", (0, _global_styling.logicalCSS)('left', 0), " ", (0, _global_styling.logicalCSS)('width', '100%'), ";}};label:euiGlobalToastList;"),
46
+ euiGlobalToastList: /*#__PURE__*/(0, _react.css)((0, _global_styling.euiScrollBarStyles)(euiThemeContext), " display:flex;flex-direction:column;align-items:stretch;position:fixed;z-index:", euiTheme.levels.toast, ";", (0, _global_styling.logicalCSS)('bottom', 0), " ", (0, _global_styling.logicalCSS)('width', "".concat(euiToastWidth, "px")), (0, _global_styling.logicalCSS)('max-height', '100vh'), (0, _global_styling.logicalCSSWithFallback)('overflow-y', 'auto'), "scrollbar-width:none;&::-webkit-scrollbar{", (0, _global_styling.logicalSizeCSS)(0, 0), ";}&:hover .euiToastDecor::before,&:focus-within .euiToastDecor::before{animation-play-state:paused;}&:not(:empty){", (0, _global_styling.logicalCSS)('padding-left', euiTheme.size.base), " ", (0, _global_styling.logicalCSS)('padding-right', euiTheme.size.base), " ", (0, _global_styling.logicalCSS)('padding-vertical', euiTheme.size.base), ";}", (0, _global_styling.euiMaxBreakpoint)(euiThemeContext, 'm'), "{&:not(:empty){", (0, _global_styling.logicalCSS)('left', 0), " ", (0, _global_styling.logicalCSS)('width', '100%'), ";}};label:euiGlobalToastList;"),
47
+ content: _ref2,
48
+ notificationBadge: {
49
+ notificationBadge: /*#__PURE__*/(0, _react.css)("position:absolute;inset-block-start:-", euiTheme.size.s, ";inset-inline-start:-", euiTheme.size.s, ";z-index:", Number(euiTheme.levels.content) + 1, ";", _global_styling.euiCanAnimate, "{animation:", euiTheme.animation.normal, " ", showNotificationBadge, " ", euiTheme.animation.resistance, ";transition:opacity ", euiTheme.animation.fast, ";};label:notificationBadge;"),
50
+ hasFadeOut: _ref
51
+ },
29
52
  // Variants
30
53
  right: /*#__PURE__*/(0, _react.css)("&:not(:empty){", (0, _global_styling.logicalCSS)('right', 0), ";", (0, _global_styling.euiMinBreakpoint)(euiThemeContext, 'm'), "{", (0, _global_styling.logicalCSS)('padding-left', "".concat(euiTheme.base * 4, "px")), ";}};label:right;"),
31
54
  left: /*#__PURE__*/(0, _react.css)("&:not(:empty){", (0, _global_styling.logicalCSS)('left', 0), ";", (0, _global_styling.euiMinBreakpoint)(euiThemeContext, 'm'), "{", (0, _global_styling.logicalCSS)('padding-right', "".concat(euiTheme.base * 4, "px")), ";}};label:left;"),
32
55
  euiGlobalToastListDismissButton: /*#__PURE__*/(0, _react.css)("position:sticky;", (0, _global_styling.logicalCSS)('bottom', '0%'), ";;label:euiGlobalToastListDismissButton;")
33
56
  };
34
57
  };
35
- var euiGlobalToastListItemStyles = exports.euiGlobalToastListItemStyles = function euiGlobalToastListItemStyles(_ref) {
36
- var euiTheme = _ref.euiTheme;
37
- var euiShowToast = (0, _react.keyframes)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n from {\n transform: translateY(", ") scale(.9);\n opacity: 0;\n }\n\n to {\n transform: translateY(0) scale(1);\n opacity: 1;\n }\n"])), euiTheme.size.l);
58
+ var euiGlobalToastListItemStyles = exports.euiGlobalToastListItemStyles = function euiGlobalToastListItemStyles(_ref3) {
59
+ var euiTheme = _ref3.euiTheme;
60
+ var euiShowToast = (0, _react.keyframes)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n from {\n transform: translateY(", ") scale(.9);\n opacity: 0;\n }\n\n to {\n transform: translateY(0) scale(1);\n opacity: 1;\n }\n"])), euiTheme.size.l);
38
61
  return {
39
62
  // Base
40
63
  euiGlobalToastListItem: /*#__PURE__*/(0, _react.css)("flex-shrink:0;", (0, _global_styling.logicalCSS)('margin-bottom', euiTheme.size.base), " animation:", euiTheme.animation.normal, " ", euiShowToast, " ", euiTheme.animation.resistance, ";opacity:1;&:first-child{", (0, _global_styling.logicalCSS)('margin-top', 'auto'), ";}&:last-child{", (0, _global_styling.logicalCSS)('margin-bottom', 0), ";};label:euiGlobalToastListItem;"),
@@ -1,14 +1,17 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
- exports.EuiToast = exports.COLORS = void 0;
8
+ exports.EuiToast = exports.COLOR_TO_NOTIFICATION_ICON_MAP = void 0;
8
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
11
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
- var _react = _interopRequireDefault(require("react"));
12
+ var _react = _interopRequireWildcard(require("react"));
11
13
  var _classnames = _interopRequireDefault(require("classnames"));
14
+ var _euiThemeCommon = require("@elastic/eui-theme-common");
12
15
  var _services = require("../../services");
13
16
  var _accessibility = require("../accessibility");
14
17
  var _button = require("../button");
@@ -16,8 +19,12 @@ var _i18n = require("../i18n");
16
19
  var _icon = require("../icon");
17
20
  var _text = require("../text");
18
21
  var _toast = require("./toast.styles");
22
+ var _notification_icon = require("../notification_icon/notification_icon");
23
+ var _notification_icon2 = require("../notification_icon/notification_icon.styles");
24
+ var _toast_action = require("./toast_action");
25
+ var _title = require("../title");
19
26
  var _react2 = require("@emotion/react");
20
- var _excluded = ["title", "color", "iconType", "onClose", "children", "className"];
27
+ var _excluded = ["title", "text", "color", "iconType", "children", "className", "actionProps", "style", "onClose", "animationMs"];
21
28
  /*
22
29
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
23
30
  * or more contributor license agreements. Licensed under the Elastic License
@@ -25,58 +32,150 @@ var _excluded = ["title", "color", "iconType", "onClose", "children", "className
25
32
  * in compliance with, at your election, the Elastic License 2.0 or the Server
26
33
  * Side Public License, v 1.
27
34
  */
28
- var COLORS = exports.COLORS = ['primary', 'success', 'warning', 'danger'];
35
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
36
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
37
+ 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; }
38
+ 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) { (0, _defineProperty2.default)(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; }
39
+ var COLOR_TO_NOTIFICATION_ICON_MAP = exports.COLOR_TO_NOTIFICATION_ICON_MAP = {
40
+ primary: 'info',
41
+ success: 'success',
42
+ warning: 'warning',
43
+ danger: 'error'
44
+ };
29
45
  var EuiToast = exports.EuiToast = function EuiToast(_ref) {
30
46
  var title = _ref.title,
31
- color = _ref.color,
47
+ text = _ref.text,
48
+ _ref$color = _ref.color,
49
+ color = _ref$color === void 0 ? 'primary' : _ref$color,
32
50
  iconType = _ref.iconType,
33
- onClose = _ref.onClose,
34
51
  children = _ref.children,
35
52
  className = _ref.className,
53
+ actionProps = _ref.actionProps,
54
+ style = _ref.style,
55
+ onClose = _ref.onClose,
56
+ animationMs = _ref.animationMs,
36
57
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
37
- var baseStyles = (0, _services.useEuiMemoizedStyles)(_toast.euiToastStyles);
38
- var baseCss = [baseStyles.euiToast, color && baseStyles.colors[color]];
58
+ var _useEuiTheme = (0, _services.useEuiTheme)(),
59
+ euiTheme = _useEuiTheme.euiTheme;
60
+ var styles = (0, _services.useEuiMemoizedStyles)(_toast.euiToastStyles);
61
+ var iconStyles = (0, _services.useEuiMemoizedStyles)(_notification_icon2.euiNotificationIconStyles);
39
62
  var headerStyles = (0, _services.useEuiMemoizedStyles)(_toast.euiToastHeaderStyles);
40
- var headerCss = [headerStyles.euiToastHeader, children && headerStyles.withBody];
41
- var classes = (0, _classnames.default)('euiToast', className);
63
+ var cssStyles = [styles.euiToast];
64
+ var decorCssStyles = [styles.decor, animationMs && styles.hasAnimation];
65
+ var classes = (0, _classnames.default)('euiToast', className, (0, _defineProperty2.default)({}, "euiToast--".concat(color), color));
66
+ var highlightColorToken = (0, _euiThemeCommon.getTokenName)('borderStrong', color);
67
+ var typeColor = euiTheme.colors[highlightColorToken];
68
+ var backgroundLightToken = (0, _euiThemeCommon.getTokenName)('backgroundLight', color);
69
+ var backgroundLightColor = euiTheme.colors[backgroundLightToken];
70
+ var cssVariables = (0, _react.useMemo)(function () {
71
+ return _objectSpread({
72
+ '--euiToastTypeColor': typeColor,
73
+ '--euiToastTypeBackgroundColor': backgroundLightColor
74
+ }, animationMs && {
75
+ '--euiToastAnimationMs': "".concat(animationMs, "ms")
76
+ });
77
+ }, [typeColor, backgroundLightColor, animationMs]);
78
+ var dismissButton = (0, _react.useMemo)(function () {
79
+ if (!onClose) return;
80
+ return (0, _react2.jsx)(_i18n.EuiI18n, {
81
+ token: "euiToast.dismissToast",
82
+ default: "Dismiss toast"
83
+ }, function (dismissToast) {
84
+ return (0, _react2.jsx)(_button.EuiButtonIcon, {
85
+ css: styles.dismissButton,
86
+ iconType: "cross",
87
+ color: "text",
88
+ size: "xs",
89
+ "aria-label": dismissToast,
90
+ onClick: onClose,
91
+ "data-test-subj": "toastCloseButton"
92
+ });
93
+ });
94
+ }, [onClose, styles]);
95
+ var header = (0, _react.useMemo)(function () {
96
+ if (!title) return;
97
+ var headerCssStyles = [headerStyles.euiToastHeader, onClose && headerStyles.hasDismissButton];
98
+ return (0, _react2.jsx)(_title.EuiTitle, {
99
+ size: "xs",
100
+ css: headerCssStyles,
101
+ "data-test-subj": "euiToastHeader__title"
102
+ }, (0, _react2.jsx)("p", null, title));
103
+ }, [title, headerStyles, onClose]);
104
+ var icon = (0, _react.useMemo)(function () {
105
+ if (!iconType) {
106
+ var _COLOR_TO_NOTIFICATIO;
107
+ var defaultIconType = (_COLOR_TO_NOTIFICATIO = COLOR_TO_NOTIFICATION_ICON_MAP[color]) !== null && _COLOR_TO_NOTIFICATIO !== void 0 ? _COLOR_TO_NOTIFICATIO : 'info';
108
+ return (0, _react2.jsx)(_notification_icon.EuiNotificationIcon, {
109
+ css: styles.icon,
110
+ type: defaultIconType,
111
+ size: "l"
112
+ });
113
+ }
114
+ return (0, _react2.jsx)(_icon.EuiIcon, {
115
+ css: [styles.icon, iconStyles.size.l, ";label:icon;"],
116
+ type: iconType,
117
+ size: "l",
118
+ "aria-hidden": "true",
119
+ color: typeColor
120
+ });
121
+ }, [iconType, color, typeColor, styles, iconStyles]);
122
+ var optionalChildren = (0, _react.useMemo)(function () {
123
+ if (!text && !children) return null;
124
+ return (0, _react2.jsx)("div", {
125
+ css: styles.text,
126
+ "data-test-subj": "euiToastBody"
127
+ }, text && (0, _react2.jsx)(_text.EuiText, {
128
+ size: "s",
129
+ color: "default",
130
+ className: "euiToast__text",
131
+ "data-test-subj": "euiToastText"
132
+ }, text), children && (0, _react2.jsx)(_text.EuiText, {
133
+ className: "euiToast__additionalContent",
134
+ size: "s",
135
+ color: "default",
136
+ "data-test-subj": "euiToastAdditionalContent"
137
+ }, children));
138
+ }, [text, children, styles]);
139
+ var actionControls = (0, _react.useMemo)(function () {
140
+ var actionPrimaryProps = _objectSpread(_objectSpread({}, actionProps === null || actionProps === void 0 ? void 0 : actionProps.primary), {}, {
141
+ color: color
142
+ });
143
+ var actionSecondaryProps = _objectSpread(_objectSpread({}, actionProps === null || actionProps === void 0 ? void 0 : actionProps.secondary), {}, {
144
+ color: color
145
+ });
146
+ var hasActionPrimary = Boolean(actionProps === null || actionProps === void 0 ? void 0 : actionProps.primary);
147
+ var hasActionSecondary = Boolean(actionProps === null || actionProps === void 0 ? void 0 : actionProps.secondary);
148
+ if (!hasActionPrimary && !hasActionSecondary) return null;
149
+ var actionPrimary = hasActionPrimary && (0, _react2.jsx)(_toast_action.EuiToastAction, (0, _extends2.default)({
150
+ actionType: "primary"
151
+ }, actionPrimaryProps));
152
+ var actionSecondary = hasActionSecondary && (0, _react2.jsx)(_toast_action.EuiToastAction, (0, _extends2.default)({
153
+ actionType: "secondary"
154
+ }, actionSecondaryProps));
155
+ return (0, _react2.jsx)("div", {
156
+ css: styles.actions
157
+ }, actionPrimary, actionSecondary);
158
+ }, [actionProps, color, styles]);
42
159
  return (0, _react2.jsx)("div", (0, _extends2.default)({
43
- css: baseCss,
44
- className: classes
45
- }, rest), (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("p", null, (0, _react2.jsx)(_i18n.EuiI18n, {
160
+ css: cssStyles,
161
+ className: classes,
162
+ style: _objectSpread(_objectSpread({}, cssVariables), style)
163
+ }, rest), (0, _react2.jsx)("div", {
164
+ className: "euiToastDecor",
165
+ css: decorCssStyles,
166
+ role: "presentation"
167
+ }), (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("p", null, (0, _react2.jsx)(_i18n.EuiI18n, {
46
168
  token: "euiToast.newNotification",
47
169
  default: "A new notification appears"
48
- }))), (0, _react2.jsx)(_i18n.EuiI18n, {
49
- token: "euiToast.notification",
50
- default: "Notification"
51
- }, function (notification) {
52
- return (0, _react2.jsx)("div", {
53
- css: headerCss,
54
- "aria-label": notification,
55
- "data-test-subj": "euiToastHeader"
56
- }, iconType && (0, _react2.jsx)(_icon.EuiIcon, {
57
- css: headerStyles.euiToastHeader__icon,
58
- type: iconType,
59
- size: "m",
60
- "aria-hidden": "true"
61
- }), (0, _react2.jsx)("span", {
62
- css: headerStyles.euiToastHeader__title,
63
- "data-test-subj": "euiToastHeader__title"
64
- }, title));
65
- }), onClose && (0, _react2.jsx)(_i18n.EuiI18n, {
66
- token: "euiToast.dismissToast",
67
- default: "Dismiss toast"
68
- }, function (dismissToast) {
69
- return (0, _react2.jsx)(_button.EuiButtonIcon, {
70
- css: baseStyles.euiToast__closeButton,
71
- iconType: "cross",
72
- color: "text",
73
- size: "xs",
74
- "aria-label": dismissToast,
75
- onClick: onClose,
76
- "data-test-subj": "toastCloseButton"
77
- });
78
- }), children && (0, _react2.jsx)(_text.EuiText, {
79
- size: "s",
80
- "data-test-subj": "euiToastBody"
81
- }, children));
170
+ }))), (0, _react2.jsx)("div", {
171
+ css: styles.wrapper
172
+ }, (0, _react2.jsx)("div", {
173
+ css: styles.body
174
+ }, icon, (0, _react2.jsx)("div", {
175
+ css: styles.content
176
+ },
177
+ // Note: the DOM position of the dismiss button matters to screen reader users.
178
+ // We generally want them to have some context of _what_ they're dismissing,
179
+ // instead of navigating to the dismiss button first before the content
180
+ header && optionalChildren ? (0, _react2.jsx)(_react.default.Fragment, null, header, dismissButton, optionalChildren) : (0, _react2.jsx)(_react.default.Fragment, null, header || optionalChildren, dismissButton))), actionControls));
82
181
  };
@@ -1,15 +1,18 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.euiToastStyles = exports.euiToastHeaderStyles = void 0;
8
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
7
9
  var _react = require("@emotion/react");
8
10
  var _euiThemeCommon = require("@elastic/eui-theme-common");
9
11
  var _global_styling = require("../../global_styling");
10
12
  var _high_contrast = require("../../global_styling/functions/high_contrast");
11
13
  var _title = require("../title/title.styles");
12
14
  var _panel = require("../panel/panel.styles");
15
+ var _templateObject;
13
16
  /*
14
17
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
15
18
  * or more contributor license agreements. Licensed under the Elastic License
@@ -17,60 +20,45 @@ var _panel = require("../panel/panel.styles");
17
20
  * in compliance with, at your election, the Elastic License 2.0 or the Server
18
21
  * Side Public License, v 1.
19
22
  */
20
-
23
+ var TEXT_MAX_WIDTH = 1200;
24
+ var CONTAINER_NAME = 'euiToast';
25
+ var CQC_BREAKPOINT_NARROWEST = '(max-width: 320px)';
26
+ var euiToastAnimation = (0, _react.keyframes)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n from {\n transform: scaleX(1);\n }\n to {\n transform: scaleX(0);\n }\n"])));
21
27
  var euiToastStyles = exports.euiToastStyles = function euiToastStyles(euiThemeContext) {
22
- var euiTheme = euiThemeContext.euiTheme,
23
- highContrastMode = euiThemeContext.highContrastMode;
24
- var highlightStyles = function highlightStyles(color, width) {
25
- return "\n &:before {\n content: '';\n position: absolute;\n /* ensure highlight border is on top of panel border */\n z-index: 1;\n inset: 0;\n border-radius: inherit;\n ".concat((0, _global_styling.logicalCSS)('border-top', "".concat(width, " solid ").concat(color)), "\n pointer-events: none;\n }\n ");
26
- };
28
+ var euiTheme = euiThemeContext.euiTheme;
29
+ var highlightSize = (0, _euiThemeCommon.mathWithUnits)([euiTheme.border.width.thin, euiTheme.border.width.thick], function (x, y) {
30
+ return x + y;
31
+ });
32
+ var paddingTop = (0, _euiThemeCommon.mathWithUnits)([euiTheme.size.base, highlightSize], function (x, y) {
33
+ return x + y;
34
+ });
35
+ var offsetTop = (0, _euiThemeCommon.mathWithUnits)([euiTheme.size.s, highlightSize], function (x, y) {
36
+ return x + y;
37
+ });
27
38
  return {
28
39
  // Base
29
- euiToast: /*#__PURE__*/(0, _react.css)("border-radius:", euiTheme.border.radius.medium, ";", (0, _euiThemeCommon.euiShadowLarge)(euiThemeContext, {
40
+ euiToast: /*#__PURE__*/(0, _react.css)("container-type:inline-size;container-name:", CONTAINER_NAME, ";position:relative;overflow:hidden;border-radius:", euiTheme.border.radius.medium, ";", (0, _euiThemeCommon.euiShadowLarge)(euiThemeContext, {
30
41
  borderAllInHighContrastMode: true
31
- }), " position:relative;", (0, _global_styling.logicalCSS)('padding-horizontal', euiTheme.size.base), " ", (0, _global_styling.logicalCSS)('padding-vertical', euiTheme.size.base), " background-color:", euiTheme.colors.emptyShade, ";", (0, _global_styling.logicalCSS)('width', '100%'), " ", (0, _global_styling.euiTextBreakWord)(), (0, _panel.euiPanelBorderStyles)(euiThemeContext), " &:hover,&:focus{[class*='euiToast__closeButton']{opacity:1;}};label:euiToast;"),
32
- // Elements
33
- euiToast__closeButton: /*#__PURE__*/(0, _react.css)("position:absolute;", (0, _global_styling.logicalCSS)('top', euiTheme.size.base), " ", (0, _global_styling.logicalCSS)('right', euiTheme.size.base), ";;label:euiToast__closeButton;"),
34
- // Variants
35
- colors: {
36
- _getStyles: function _getStyles(color) {
37
- // Increase color/border thickness for all high contrast modes
38
- var borderWidth = highContrastMode ? (0, _euiThemeCommon.mathWithUnits)(euiTheme.border.width.thick, function (x) {
39
- return x * 2;
40
- }) : euiTheme.border.width.thick;
41
- return (0, _high_contrast.highContrastModeStyles)(euiThemeContext, {
42
- none: highlightStyles(color, borderWidth),
43
- preferred: "\n ".concat(highlightStyles(color, borderWidth), "\n \n &::before {\n ").concat((0, _global_styling.logicalCSS)('width', "calc(100% + ".concat((0, _euiThemeCommon.mathWithUnits)(euiTheme.border.width.thin, function (x) {
44
- return x * 2;
45
- }), ")")), "\n ").concat((0, _global_styling.logicalCSS)('margin-top', "-".concat(euiTheme.border.width.thin)), "\n ").concat((0, _global_styling.logicalCSS)('margin-left', "-".concat(euiTheme.border.width.thin)), "\n }\n "),
46
- // Windows high contrast mode ignores/overrides border colors, which have semantic meaning here. To get around this, we'll use a pseudo element that ignores forced colors
47
- forced: "\n overflow: hidden;\n\n &::before {\n content: '';\n position: absolute;\n ".concat((0, _global_styling.logicalCSS)('top', 0), "\n ").concat((0, _global_styling.logicalCSS)('horizontal', 0), "\n ").concat((0, _global_styling.logicalCSS)('height', borderWidth), "\n background-color: ").concat(color, ";\n ").concat((0, _high_contrast.preventForcedColors)(euiThemeContext), "\n pointer-events: none;\n }\n ")
48
- });
49
- },
50
- get primary() {
51
- return /*#__PURE__*/(0, _react.css)(this._getStyles(euiTheme.colors.primary), ";label:primary;");
52
- },
53
- get success() {
54
- return /*#__PURE__*/(0, _react.css)(this._getStyles(euiTheme.colors.success), ";label:success;");
55
- },
56
- get warning() {
57
- return /*#__PURE__*/(0, _react.css)(this._getStyles(euiTheme.colors.warning), ";label:warning;");
58
- },
59
- get danger() {
60
- return /*#__PURE__*/(0, _react.css)(this._getStyles(euiTheme.colors.danger), ";label:danger;");
61
- }
62
- }
42
+ }), " ", (0, _global_styling.logicalCSS)('padding-top', paddingTop), " ", (0, _global_styling.logicalCSS)('padding-bottom', euiTheme.size.base), " ", (0, _global_styling.logicalCSS)('padding-horizontal', euiTheme.size.base), " background-color:", euiTheme.colors.backgroundBasePlain, ";", (0, _global_styling.logicalCSS)('width', '100%'), " ", (0, _global_styling.euiTextBreakWord)(), (0, _panel.euiPanelBorderStyles)(euiThemeContext), ";;label:euiToast;"),
43
+ decor: /*#__PURE__*/(0, _react.css)("position:absolute;inset-block-start:0;inset-inline:0;", (0, _global_styling.logicalCSS)('height', highlightSize), " background-color:var(--euiToastTypeBackgroundColor);", (0, _high_contrast.preventForcedColors)(euiThemeContext), " &::before{content:'';position:absolute;z-index:", euiTheme.levels.content, ";inset-block-start:0;inset-inline:0;", (0, _global_styling.logicalCSS)('height', '100%'), " background-color:var(--euiToastTypeColor);pointer-events:none;", (0, _high_contrast.preventForcedColors)(euiThemeContext), " transform-origin:left center;[dir='rtl'] &{transform-origin:right center;}};label:decor;"),
44
+ // handles content + actions layout
45
+ wrapper: /*#__PURE__*/(0, _react.css)("display:flex;flex-direction:column;gap:", euiTheme.size.m, ";inline-size:100%;;label:wrapper;"),
46
+ // handles icon + text layout
47
+ body: /*#__PURE__*/(0, _react.css)("display:flex;flex-direction:row;align-self:center;gap:", euiTheme.size.m, ";inline-size:100%;;label:body;"),
48
+ // handles text layout
49
+ content: /*#__PURE__*/(0, _react.css)("display:flex;flex-direction:column;gap:", euiTheme.size.xs, ";align-self:center;inline-size:100%;max-inline-size:", TEXT_MAX_WIDTH, "px;.euiToast__text+.euiToast__additionalContent{", (0, _global_styling.logicalCSS)('margin-top', euiTheme.size.s), ";};label:content;"),
50
+ text: /*#__PURE__*/(0, _react.css)("display:flex;flex-direction:column;gap:", euiTheme.size.xs, ";;label:text;"),
51
+ icon: /*#__PURE__*/(0, _react.css)("grid-area:icon;position:relative;", (0, _global_styling.logicalCSS)('margin-vertical', euiTheme.size.xxs), ";;label:icon;"),
52
+ actions: /*#__PURE__*/(0, _react.css)("grid-area:actions;display:flex;gap:", euiTheme.size.s, ";", (0, _global_styling.logicalCSS)('margin-left', euiTheme.size.xl), "@container ", CONTAINER_NAME, " ", CQC_BREAKPOINT_NARROWEST, "{flex-wrap:wrap;>*{inline-size:100%;}};label:actions;"),
53
+ dismissButton: /*#__PURE__*/(0, _react.css)("position:absolute;", (0, _global_styling.logicalCSS)('top', offsetTop), ";", (0, _global_styling.logicalCSS)('right', euiTheme.size.s), ";;label:dismissButton;"),
54
+ hasAnimation: /*#__PURE__*/(0, _react.css)("&::before{", _euiThemeCommon.euiCanAnimate, "{animation:", euiToastAnimation, " var(--euiToastAnimationMs) linear forwards;}};label:hasAnimation;")
63
55
  };
64
56
  };
65
57
  var euiToastHeaderStyles = exports.euiToastHeaderStyles = function euiToastHeaderStyles(euiThemeContext) {
66
58
  var euiTheme = euiThemeContext.euiTheme;
67
59
  return {
68
60
  // Base
69
- euiToastHeader: /*#__PURE__*/(0, _react.css)("display:flex;align-items:baseline;", (0, _global_styling.logicalCSS)('padding-right', euiTheme.size.l), ">*+*{", (0, _global_styling.logicalCSS)('margin-left', euiTheme.size.s), ";};label:euiToastHeader;"),
70
- // Elements
71
- euiToastHeader__icon: /*#__PURE__*/(0, _react.css)("flex:0 0 auto;fill:", euiTheme.colors.textHeading, ";transform:translateY(2px);;label:euiToastHeader__icon;"),
72
- euiToastHeader__title: /*#__PURE__*/(0, _react.css)((0, _title.euiTitle)(euiThemeContext, 'xs'), " font-weight:", euiTheme.font.weight.bold, ";;label:euiToastHeader__title;"),
73
- // Variants
74
- withBody: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('margin-bottom', euiTheme.size.s), ";;label:withBody;")
61
+ euiToastHeader: /*#__PURE__*/(0, _react.css)("display:flex;align-items:baseline;", (0, _title.euiTitle)(euiThemeContext, 'xs'), " font-weight:", euiTheme.font.weight.bold, ";;label:euiToastHeader;"),
62
+ hasDismissButton: /*#__PURE__*/(0, _react.css)("padding-inline-end:", euiTheme.size.l, ";;label:hasDismissButton;")
75
63
  };
76
64
  };
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.EuiToastAction = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
+ var _react = _interopRequireDefault(require("react"));
11
+ var _button = require("../button");
12
+ var _react2 = require("@emotion/react");
13
+ var _excluded = ["children", "actionType", "color"];
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
+ var EuiToastAction = exports.EuiToastAction = function EuiToastAction(_ref) {
22
+ var children = _ref.children,
23
+ _ref$actionType = _ref.actionType,
24
+ actionType = _ref$actionType === void 0 ? 'primary' : _ref$actionType,
25
+ _ref$color = _ref.color,
26
+ color = _ref$color === void 0 ? 'primary' : _ref$color,
27
+ rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
28
+ if (actionType === 'primary') {
29
+ return (0, _react2.jsx)(_button.EuiButton, (0, _extends2.default)({
30
+ size: "s",
31
+ color: color
32
+ }, rest), children);
33
+ } else {
34
+ return (0, _react2.jsx)(_button.EuiButtonEmpty, (0, _extends2.default)({
35
+ size: "s",
36
+ color: color
37
+ }, rest), children);
38
+ }
39
+ };
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.COLORS = void 0;
7
+ /*
8
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
9
+ * or more contributor license agreements. Licensed under the Elastic License
10
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
11
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
12
+ * Side Public License, v 1.
13
+ */
14
+
15
+ var COLORS = exports.COLORS = ['primary', 'success', 'warning', 'danger'];
@@ -98,8 +98,8 @@ var EuiToolTip = exports.EuiToolTip = /*#__PURE__*/(0, _react.forwardRef)(functi
98
98
  _useState10 = (0, _slicedToArray2.default)(_useState9, 2),
99
99
  arrowStyles = _useState10[0],
100
100
  setArrowStyles = _useState10[1];
101
- var generatedId = (0, _react.useRef)((0, _services.htmlIdGenerator)()());
102
- var id = idProp !== null && idProp !== void 0 ? idProp : generatedId.current;
101
+ var generatedId = (0, _services.useGeneratedHtmlId)();
102
+ var id = idProp !== null && idProp !== void 0 ? idProp : generatedId;
103
103
  var anchorRef = (0, _react.useRef)(null);
104
104
  var popoverRef = (0, _react.useRef)(null);
105
105
  var positionToolTip = (0, _react.useCallback)(function () {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@elastic/eui",
3
3
  "description": "Elastic UI Component Library",
4
- "version": "116.3.1",
4
+ "version": "116.4.0",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "lib",
7
7
  "module": "es",
@@ -22,7 +22,7 @@
22
22
  "build": "yarn build:clean && yarn build:i18ntokens && node ./scripts/compile-eui.js",
23
23
  "build-pack": "yarn build && yarn pack",
24
24
  "watch": "node ../../scripts/watch-eui.js --package @elastic/eui",
25
- "compile-icons": "node ./scripts/compile-icons.js && prettier --write --loglevel=warn \"./src/components/icon/assets/**/*.tsx\"",
25
+ "compile-icons": "node ./scripts/compile-icons.js && prettier --write --loglevel=warn \"./src/components/icon/assets/**/*.tsx\" \"./src/components/notification_icon/assets/**/*.tsx\"",
26
26
  "lint": "yarn tsc --noEmit && yarn lint-es && yarn lint-css-in-js && yarn lint-sass",
27
27
  "lint-fix": "yarn lint-es --fix && yarn lint-css-in-js --fix",
28
28
  "lint-es": "NODE_OPTIONS=--max-old-space-size=4096 eslint --cache \"src/**/*.{ts,tsx,js}\"",
@@ -44,6 +44,7 @@
44
44
  "release-rc": "node ./scripts/release.js --type=prerelease",
45
45
  "storybook": "storybook dev -p 6006",
46
46
  "build-storybook": "storybook build",
47
+ "test-storybook": "test-storybook",
47
48
  "pre-push": "yarn test-staged",
48
49
  "prerelease": "node ./scripts/prerelease.mjs"
49
50
  },
@@ -117,8 +118,7 @@
117
118
  "@emotion/jest": "^11.11.0",
118
119
  "@emotion/react": "^11.11.0",
119
120
  "@faker-js/faker": "^8.0.2",
120
- "@loki/create-async-callback": "^0.35.0",
121
- "@loki/is-loki-running": "^0.35.0",
121
+ "@playwright/test": "^1.44.0",
122
122
  "@storybook/addon-essentials": "^8.4.5",
123
123
  "@storybook/addon-interactions": "^8.4.5",
124
124
  "@storybook/addon-links": "^8.4.5",
@@ -130,6 +130,7 @@
130
130
  "@storybook/react": "^8.4.5",
131
131
  "@storybook/react-webpack5": "^8.4.5",
132
132
  "@storybook/test": "^8.4.5",
133
+ "@storybook/test-runner": "^0.19.1",
133
134
  "@svgr/core": "8.0.0",
134
135
  "@svgr/plugin-jsx": "^8.0.1",
135
136
  "@svgr/plugin-svgo": "^8.0.1",
@@ -143,6 +144,7 @@
143
144
  "@types/classnames": "^2.3.1",
144
145
  "@types/enzyme": "^3.10.5",
145
146
  "@types/jest": "^29.5.12",
147
+ "@types/jest-image-snapshot": "^5.1.0",
146
148
  "@types/prettier": "2.7.3",
147
149
  "@types/react": "^18.2.14",
148
150
  "@types/react-dom": "^18.2.6",
@@ -206,7 +208,7 @@
206
208
  "jest": "^29.7.0",
207
209
  "jest-cli": "^29.7.0",
208
210
  "jest-environment-jsdom": "^29.7.0",
209
- "loki": "^0.35.0",
211
+ "jest-image-snapshot": "^6.4.0",
210
212
  "moment": "^2.27.0",
211
213
  "moment-timezone": "^0.5.31",
212
214
  "path": "^0.12.7",