@elastic/eui 62.0.3 → 62.2.1

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 (306) hide show
  1. package/dist/eui_theme_dark.css +1 -783
  2. package/dist/eui_theme_dark.json +0 -57
  3. package/dist/eui_theme_dark.json.d.ts +0 -57
  4. package/dist/eui_theme_dark.min.css +1 -1
  5. package/dist/eui_theme_light.css +1 -783
  6. package/dist/eui_theme_light.json +0 -57
  7. package/dist/eui_theme_light.json.d.ts +0 -57
  8. package/dist/eui_theme_light.min.css +1 -1
  9. package/es/components/breadcrumbs/breadcrumb.js +199 -0
  10. package/es/components/breadcrumbs/breadcrumb.styles.js +61 -0
  11. package/es/components/breadcrumbs/breadcrumbs.js +115 -187
  12. package/es/components/breadcrumbs/breadcrumbs.styles.js +30 -0
  13. package/es/components/code/code_block.js +119 -107
  14. package/es/components/collapsible_nav/collapsible_nav.js +2 -2
  15. package/es/components/control_bar/control_bar.js +13 -0
  16. package/es/components/datagrid/body/data_grid_body.js +12 -2
  17. package/es/components/datagrid/body/data_grid_cell.js +31 -3
  18. package/es/components/datagrid/body/header/data_grid_header_row.js +1 -1
  19. package/es/components/datagrid/controls/column_sorting_draggable.js +1 -1
  20. package/es/components/datagrid/data_grid.js +10 -2
  21. package/es/components/datagrid/utils/row_heights.js +33 -4
  22. package/es/components/date_picker/super_date_picker/super_date_picker.js +2 -2
  23. package/es/components/date_picker/super_date_picker/super_update_button.js +1 -1
  24. package/es/components/description_list/description_list.js +22 -26
  25. package/es/components/description_list/description_list.styles.js +25 -0
  26. package/es/components/description_list/description_list_context.js +14 -0
  27. package/es/components/description_list/description_list_description.js +43 -2
  28. package/es/components/description_list/description_list_description.styles.js +47 -0
  29. package/es/components/description_list/description_list_title.js +43 -2
  30. package/es/components/description_list/description_list_title.styles.js +37 -0
  31. package/es/components/description_list/description_list_types.js +10 -0
  32. package/es/components/header/header.js +1 -27
  33. package/es/components/header/header_breadcrumbs/header_breadcrumbs.js +22 -2
  34. package/es/components/header/header_breadcrumbs/header_breadcrumbs.styles.js +15 -0
  35. package/es/components/header/header_links/header_links.js +9 -9
  36. package/es/components/icon/assets/tokenStruct.js +1 -1
  37. package/es/components/page/page_header/page_header.js +1 -0
  38. package/es/components/page/page_header/page_header_content.js +2 -1
  39. package/es/components/page/page_template.js +1 -0
  40. package/es/components/pagination/pagination.js +1 -1
  41. package/es/components/panel/split_panel/split_panel.js +2 -2
  42. package/es/components/provider/provider.js +2 -2
  43. package/es/components/responsive/hide_for.js +6 -38
  44. package/es/components/responsive/show_for.js +6 -38
  45. package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +17 -36
  46. package/es/components/side_nav/side_nav.js +1 -1
  47. package/es/components/table/table_row_cell.js +1 -2
  48. package/es/components/toast/global_toast_list.js +208 -241
  49. package/es/components/toast/global_toast_list.styles.js +38 -0
  50. package/es/components/toast/global_toast_list_item.js +12 -7
  51. package/es/components/toast/toast.js +25 -25
  52. package/es/components/toast/toast.styles.js +55 -0
  53. package/es/components/token/index.js +2 -1
  54. package/es/components/token/token.js +48 -112
  55. package/es/components/token/token.styles.js +93 -0
  56. package/es/components/token/token_map.js +6 -9
  57. package/es/components/token/token_types.js +11 -0
  58. package/es/global_styling/reset/global_styles.js +1 -1
  59. package/es/services/{breakpoint.js → breakpoint/breakpoint.js} +4 -9
  60. package/es/services/{hooks/useIsWithinBreakpoints.js → breakpoint/current_breakpoint.js} +26 -28
  61. package/es/services/breakpoint/current_breakpoint_hook.js +20 -0
  62. package/es/services/breakpoint/index.js +11 -0
  63. package/es/services/breakpoint/useIsWithinBreakpoints.js +24 -0
  64. package/es/services/hooks/index.js +0 -1
  65. package/es/services/index.js +1 -1
  66. package/es/test/rtl/component_helpers.js +60 -1
  67. package/eui.d.ts +1704 -1475
  68. package/i18ntokens.json +36 -36
  69. package/lib/components/breadcrumbs/breadcrumb.js +225 -0
  70. package/lib/components/breadcrumbs/breadcrumb.styles.js +68 -0
  71. package/lib/components/breadcrumbs/breadcrumbs.js +125 -188
  72. package/lib/components/breadcrumbs/breadcrumbs.styles.js +33 -0
  73. package/lib/components/code/code_block.js +118 -106
  74. package/lib/components/collapsible_nav/collapsible_nav.js +2 -2
  75. package/lib/components/control_bar/control_bar.js +13 -0
  76. package/lib/components/datagrid/body/data_grid_body.js +12 -2
  77. package/lib/components/datagrid/body/data_grid_cell.js +31 -3
  78. package/lib/components/datagrid/body/header/data_grid_header_row.js +1 -1
  79. package/lib/components/datagrid/controls/column_sorting_draggable.js +1 -1
  80. package/lib/components/datagrid/data_grid.js +10 -2
  81. package/lib/components/datagrid/utils/row_heights.js +33 -4
  82. package/lib/components/date_picker/super_date_picker/super_date_picker.js +2 -2
  83. package/lib/components/date_picker/super_date_picker/super_update_button.js +1 -1
  84. package/lib/components/description_list/description_list.js +25 -31
  85. package/lib/components/description_list/description_list.styles.js +36 -0
  86. package/lib/components/description_list/description_list_context.js +24 -0
  87. package/lib/components/description_list/description_list_description.js +52 -2
  88. package/lib/components/description_list/description_list_description.styles.js +51 -0
  89. package/lib/components/description_list/description_list_title.js +52 -2
  90. package/lib/components/description_list/description_list_title.styles.js +50 -0
  91. package/lib/components/description_list/description_list_types.js +20 -0
  92. package/lib/components/header/header.js +1 -27
  93. package/lib/components/header/header_breadcrumbs/header_breadcrumbs.js +24 -2
  94. package/lib/components/header/header_breadcrumbs/header_breadcrumbs.styles.js +26 -0
  95. package/lib/components/header/header_links/header_links.js +8 -8
  96. package/lib/components/icon/assets/tokenStruct.js +1 -1
  97. package/lib/components/icon/svgs/tokens/tokenStruct.svg +1 -1
  98. package/lib/components/page/page_header/page_header.js +1 -0
  99. package/lib/components/page/page_header/page_header_content.js +3 -2
  100. package/lib/components/page/page_template.js +1 -0
  101. package/lib/components/pagination/pagination.js +1 -1
  102. package/lib/components/panel/split_panel/split_panel.js +3 -3
  103. package/lib/components/provider/provider.js +1 -1
  104. package/lib/components/responsive/hide_for.js +12 -44
  105. package/lib/components/responsive/show_for.js +12 -44
  106. package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +15 -35
  107. package/lib/components/side_nav/side_nav.js +1 -1
  108. package/lib/components/table/table_row_cell.js +1 -3
  109. package/lib/components/toast/global_toast_list.js +209 -238
  110. package/lib/components/toast/global_toast_list.styles.js +45 -0
  111. package/lib/components/toast/global_toast_list_item.js +14 -7
  112. package/lib/components/toast/toast.js +27 -25
  113. package/lib/components/toast/toast.styles.js +66 -0
  114. package/lib/components/token/index.js +5 -3
  115. package/lib/components/token/token.js +50 -120
  116. package/lib/components/token/token.styles.js +101 -0
  117. package/lib/components/token/token_map.js +6 -9
  118. package/lib/components/token/token_types.js +22 -0
  119. package/lib/global_styling/reset/global_styles.js +1 -1
  120. package/{test-env/services → lib/services/breakpoint}/breakpoint.js +5 -9
  121. package/lib/services/breakpoint/current_breakpoint.js +69 -0
  122. package/lib/services/breakpoint/current_breakpoint_hook.js +31 -0
  123. package/lib/services/breakpoint/index.js +57 -0
  124. package/lib/services/breakpoint/useIsWithinBreakpoints.js +34 -0
  125. package/lib/services/hooks/index.js +0 -13
  126. package/lib/services/index.js +28 -0
  127. package/lib/test/rtl/component_helpers.js +69 -3
  128. package/optimize/es/components/breadcrumbs/breadcrumb.js +136 -0
  129. package/optimize/es/components/breadcrumbs/breadcrumb.styles.js +61 -0
  130. package/optimize/es/components/breadcrumbs/breadcrumbs.js +92 -165
  131. package/optimize/es/components/breadcrumbs/breadcrumbs.styles.js +30 -0
  132. package/optimize/es/components/code/code_block.js +106 -107
  133. package/optimize/es/components/datagrid/body/data_grid_body.js +2 -0
  134. package/optimize/es/components/datagrid/body/data_grid_cell.js +13 -1
  135. package/optimize/es/components/datagrid/utils/row_heights.js +33 -4
  136. package/optimize/es/components/description_list/description_list.js +20 -24
  137. package/optimize/es/components/description_list/description_list.styles.js +25 -0
  138. package/optimize/es/components/description_list/description_list_context.js +14 -0
  139. package/optimize/es/components/description_list/description_list_description.js +32 -2
  140. package/optimize/es/components/description_list/description_list_description.styles.js +47 -0
  141. package/optimize/es/components/description_list/description_list_title.js +32 -2
  142. package/optimize/es/components/description_list/description_list_title.styles.js +37 -0
  143. package/optimize/es/components/description_list/description_list_types.js +10 -0
  144. package/optimize/es/components/header/header_breadcrumbs/header_breadcrumbs.js +8 -1
  145. package/optimize/es/components/header/header_breadcrumbs/header_breadcrumbs.styles.js +15 -0
  146. package/optimize/es/components/header/header_links/header_links.js +8 -8
  147. package/optimize/es/components/icon/assets/tokenStruct.js +1 -1
  148. package/optimize/es/components/page/page_header/page_header_content.js +1 -1
  149. package/optimize/es/components/panel/split_panel/split_panel.js +1 -1
  150. package/optimize/es/components/provider/provider.js +2 -2
  151. package/optimize/es/components/responsive/hide_for.js +5 -27
  152. package/optimize/es/components/responsive/show_for.js +5 -27
  153. package/optimize/es/components/selectable/selectable_templates/selectable_template_sitewide.js +16 -35
  154. package/optimize/es/components/table/table_row_cell.js +1 -2
  155. package/optimize/es/components/toast/global_toast_list.js +199 -230
  156. package/optimize/es/components/toast/global_toast_list.styles.js +38 -0
  157. package/optimize/es/components/toast/global_toast_list_item.js +11 -6
  158. package/optimize/es/components/toast/toast.js +24 -24
  159. package/optimize/es/components/toast/toast.styles.js +55 -0
  160. package/optimize/es/components/token/index.js +2 -1
  161. package/optimize/es/components/token/token.js +46 -69
  162. package/optimize/es/components/token/token.styles.js +83 -0
  163. package/optimize/es/components/token/token_map.js +6 -9
  164. package/optimize/es/components/token/token_types.js +11 -0
  165. package/optimize/es/global_styling/reset/global_styles.js +1 -1
  166. package/optimize/es/services/{breakpoint.js → breakpoint/breakpoint.js} +4 -9
  167. package/optimize/es/services/breakpoint/current_breakpoint.js +44 -0
  168. package/optimize/es/services/breakpoint/current_breakpoint_hook.js +20 -0
  169. package/optimize/es/services/breakpoint/index.js +11 -0
  170. package/optimize/es/services/breakpoint/useIsWithinBreakpoints.js +24 -0
  171. package/optimize/es/services/hooks/index.js +0 -1
  172. package/optimize/es/services/index.js +1 -1
  173. package/optimize/es/test/rtl/component_helpers.js +60 -1
  174. package/optimize/lib/components/breadcrumbs/breadcrumb.js +162 -0
  175. package/optimize/lib/components/breadcrumbs/breadcrumb.styles.js +68 -0
  176. package/optimize/lib/components/breadcrumbs/breadcrumbs.js +99 -164
  177. package/optimize/lib/components/breadcrumbs/breadcrumbs.styles.js +33 -0
  178. package/optimize/lib/components/code/code_block.js +105 -106
  179. package/optimize/lib/components/datagrid/body/data_grid_body.js +2 -0
  180. package/optimize/lib/components/datagrid/body/data_grid_cell.js +13 -1
  181. package/optimize/lib/components/datagrid/utils/row_heights.js +33 -4
  182. package/optimize/lib/components/description_list/description_list.js +23 -28
  183. package/optimize/lib/components/description_list/description_list.styles.js +36 -0
  184. package/optimize/lib/components/description_list/description_list_context.js +24 -0
  185. package/optimize/lib/components/description_list/description_list_description.js +43 -2
  186. package/optimize/lib/components/description_list/description_list_description.styles.js +51 -0
  187. package/optimize/lib/components/description_list/description_list_title.js +43 -2
  188. package/optimize/lib/components/description_list/description_list_title.styles.js +50 -0
  189. package/optimize/lib/components/description_list/description_list_types.js +20 -0
  190. package/optimize/lib/components/header/header_breadcrumbs/header_breadcrumbs.js +10 -1
  191. package/optimize/lib/components/header/header_breadcrumbs/header_breadcrumbs.styles.js +26 -0
  192. package/optimize/lib/components/header/header_links/header_links.js +7 -7
  193. package/optimize/lib/components/icon/assets/tokenStruct.js +1 -1
  194. package/optimize/lib/components/icon/svgs/tokens/tokenStruct.svg +1 -1
  195. package/optimize/lib/components/page/page_header/page_header_content.js +2 -2
  196. package/optimize/lib/components/panel/split_panel/split_panel.js +2 -2
  197. package/optimize/lib/components/provider/provider.js +1 -1
  198. package/optimize/lib/components/responsive/hide_for.js +4 -33
  199. package/optimize/lib/components/responsive/show_for.js +4 -33
  200. package/optimize/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +14 -34
  201. package/optimize/lib/components/table/table_row_cell.js +1 -3
  202. package/optimize/lib/components/toast/global_toast_list.js +206 -220
  203. package/optimize/lib/components/toast/global_toast_list.styles.js +47 -0
  204. package/optimize/lib/components/toast/global_toast_list_item.js +14 -7
  205. package/optimize/lib/components/toast/toast.js +26 -24
  206. package/optimize/lib/components/toast/toast.styles.js +66 -0
  207. package/optimize/lib/components/token/index.js +5 -3
  208. package/optimize/lib/components/token/token.js +50 -76
  209. package/optimize/lib/components/token/token.styles.js +91 -0
  210. package/optimize/lib/components/token/token_map.js +6 -9
  211. package/optimize/lib/components/token/token_types.js +22 -0
  212. package/optimize/lib/global_styling/reset/global_styles.js +1 -1
  213. package/optimize/lib/services/{breakpoint.js → breakpoint/breakpoint.js} +5 -9
  214. package/optimize/lib/services/breakpoint/current_breakpoint.js +68 -0
  215. package/optimize/lib/services/breakpoint/current_breakpoint_hook.js +31 -0
  216. package/optimize/lib/services/breakpoint/index.js +57 -0
  217. package/optimize/lib/services/breakpoint/useIsWithinBreakpoints.js +34 -0
  218. package/optimize/lib/services/hooks/index.js +0 -13
  219. package/optimize/lib/services/index.js +28 -0
  220. package/optimize/lib/test/rtl/component_helpers.js +69 -3
  221. package/package.json +2 -2
  222. package/src/components/control_bar/_control_bar.scss +1 -1
  223. package/src/components/header/_index.scss +0 -1
  224. package/src/components/index.scss +0 -5
  225. package/src/themes/amsterdam/overrides/_breadcrumbs.scss +0 -12
  226. package/src/themes/amsterdam/overrides/_index.scss +0 -4
  227. package/test-env/components/breadcrumbs/breadcrumb.js +211 -0
  228. package/test-env/components/breadcrumbs/breadcrumb.styles.js +68 -0
  229. package/test-env/components/breadcrumbs/breadcrumbs.js +122 -174
  230. package/test-env/components/breadcrumbs/breadcrumbs.styles.js +33 -0
  231. package/test-env/components/collapsible_nav/collapsible_nav.js +2 -2
  232. package/test-env/components/control_bar/control_bar.js +13 -0
  233. package/test-env/components/datagrid/body/data_grid_body.js +12 -2
  234. package/test-env/components/datagrid/body/data_grid_cell.js +31 -3
  235. package/test-env/components/datagrid/body/header/data_grid_header_row.js +1 -1
  236. package/test-env/components/datagrid/controls/column_sorting_draggable.js +1 -1
  237. package/test-env/components/datagrid/data_grid.js +10 -2
  238. package/test-env/components/datagrid/utils/row_heights.js +33 -4
  239. package/test-env/components/date_picker/super_date_picker/super_date_picker.js +2 -2
  240. package/test-env/components/date_picker/super_date_picker/super_update_button.js +1 -1
  241. package/test-env/components/description_list/description_list.js +25 -30
  242. package/test-env/components/description_list/description_list.styles.js +36 -0
  243. package/test-env/components/description_list/description_list_context.js +24 -0
  244. package/test-env/components/description_list/description_list_description.js +43 -2
  245. package/test-env/components/description_list/description_list_description.styles.js +51 -0
  246. package/test-env/components/description_list/description_list_title.js +43 -2
  247. package/test-env/components/description_list/description_list_title.styles.js +50 -0
  248. package/test-env/components/description_list/description_list_types.js +20 -0
  249. package/test-env/components/header/header.js +1 -27
  250. package/test-env/components/header/header_breadcrumbs/header_breadcrumbs.js +24 -2
  251. package/test-env/components/header/header_breadcrumbs/header_breadcrumbs.styles.js +26 -0
  252. package/test-env/components/header/header_links/header_links.js +8 -8
  253. package/test-env/components/icon/assets/tokenStruct.js +1 -1
  254. package/test-env/components/observer/resize_observer/resize_observer.js +43 -126
  255. package/test-env/components/page/page_header/page_header.js +1 -0
  256. package/test-env/components/page/page_header/page_header_content.js +3 -2
  257. package/test-env/components/page/page_template.js +1 -0
  258. package/test-env/components/pagination/pagination.js +1 -1
  259. package/test-env/components/panel/split_panel/split_panel.js +3 -3
  260. package/test-env/components/provider/provider.js +1 -1
  261. package/test-env/components/responsive/hide_for.js +5 -34
  262. package/test-env/components/responsive/show_for.js +5 -34
  263. package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +15 -35
  264. package/test-env/components/side_nav/side_nav.js +1 -1
  265. package/test-env/components/table/table_row_cell.js +1 -3
  266. package/test-env/components/toast/global_toast_list.js +206 -220
  267. package/test-env/components/toast/global_toast_list.styles.js +47 -0
  268. package/test-env/components/toast/global_toast_list_item.js +14 -7
  269. package/test-env/components/toast/toast.js +27 -25
  270. package/test-env/components/toast/toast.styles.js +66 -0
  271. package/test-env/components/token/index.js +5 -3
  272. package/test-env/components/token/token.js +51 -120
  273. package/test-env/components/token/token.styles.js +91 -0
  274. package/test-env/components/token/token_map.js +6 -9
  275. package/test-env/components/token/token_types.js +22 -0
  276. package/test-env/global_styling/reset/global_styles.js +1 -1
  277. package/{lib/services → test-env/services/breakpoint}/breakpoint.js +5 -9
  278. package/test-env/services/breakpoint/current_breakpoint.js +68 -0
  279. package/test-env/services/breakpoint/current_breakpoint_hook.js +33 -0
  280. package/test-env/services/breakpoint/index.js +57 -0
  281. package/test-env/services/breakpoint/useIsWithinBreakpoints.js +34 -0
  282. package/test-env/services/hooks/index.js +0 -13
  283. package/test-env/services/index.js +28 -0
  284. package/test-env/test/rtl/component_helpers.js +69 -3
  285. package/lib/services/hooks/useIsWithinBreakpoints.js +0 -57
  286. package/optimize/es/services/hooks/useIsWithinBreakpoints.js +0 -46
  287. package/optimize/lib/services/hooks/useIsWithinBreakpoints.js +0 -57
  288. package/src/components/breadcrumbs/_breadcrumbs.scss +0 -79
  289. package/src/components/breadcrumbs/_index.scss +0 -2
  290. package/src/components/breadcrumbs/_variables.scss +0 -2
  291. package/src/components/description_list/_description_list.scss +0 -211
  292. package/src/components/description_list/_index.scss +0 -1
  293. package/src/components/header/header_breadcrumbs/_header_breadcrumbs.scss +0 -8
  294. package/src/components/header/header_breadcrumbs/_index.scss +0 -1
  295. package/src/components/portal/_index.scss +0 -1
  296. package/src/components/portal/_portal.scss +0 -6
  297. package/src/components/toast/_global_toast_list.scss +0 -90
  298. package/src/components/toast/_index.scss +0 -4
  299. package/src/components/toast/_toast.scss +0 -103
  300. package/src/components/token/_index.scss +0 -2
  301. package/src/components/token/_token.scss +0 -85
  302. package/src/components/token/_variables.scss +0 -13
  303. package/src/themes/amsterdam/overrides/_header_breadcrumbs.scss +0 -71
  304. package/src/themes/amsterdam/overrides/_toast.scss +0 -21
  305. package/src/themes/amsterdam/overrides/_token.scss +0 -4
  306. package/test-env/services/hooks/useIsWithinBreakpoints.js +0 -57
@@ -11,21 +11,11 @@ exports.TOAST_FADE_OUT_MS = exports.SIDES = exports.EuiGlobalToastList = void 0;
11
11
 
12
12
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
13
 
14
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
15
-
16
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
17
-
18
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
19
-
20
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
21
-
22
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
23
-
24
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
14
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
25
15
 
26
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
16
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
27
17
 
28
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
18
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
29
19
 
30
20
  var _react = _interopRequireWildcard(require("react"));
31
21
 
@@ -33,12 +23,16 @@ var _classnames = _interopRequireDefault(require("classnames"));
33
23
 
34
24
  var _common = require("../common");
35
25
 
26
+ var _services = require("../../services");
27
+
36
28
  var _time = require("../../services/time");
37
29
 
38
30
  var _global_toast_list_item = require("./global_toast_list_item");
39
31
 
40
32
  var _toast = require("./toast");
41
33
 
34
+ var _global_toast_list = require("./global_toast_list.styles");
35
+
42
36
  var _react2 = require("@emotion/react");
43
37
 
44
38
  var _excluded = ["className", "toasts", "dismissToast", "toastLifeTimeMs", "side"],
@@ -52,10 +46,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
52
46
 
53
47
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
54
48
 
55
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
56
-
57
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
58
-
59
49
  var sideToClassNameMap = {
60
50
  left: 'euiGlobalToastList--left',
61
51
  right: 'euiGlobalToastList--right'
@@ -65,234 +55,230 @@ exports.SIDES = SIDES;
65
55
  var TOAST_FADE_OUT_MS = 250;
66
56
  exports.TOAST_FADE_OUT_MS = TOAST_FADE_OUT_MS;
67
57
 
68
- var EuiGlobalToastList = /*#__PURE__*/function (_Component) {
69
- (0, _inherits2.default)(EuiGlobalToastList, _Component);
70
-
71
- var _super = _createSuper(EuiGlobalToastList);
72
-
73
- function EuiGlobalToastList() {
74
- var _this;
75
-
76
- (0, _classCallCheck2.default)(this, EuiGlobalToastList);
77
-
78
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
79
- args[_key] = arguments[_key];
80
- }
81
-
82
- _this = _super.call.apply(_super, [this].concat(args));
83
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
84
- toastIdToDismissedMap: {}
85
- });
86
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "dismissTimeoutIds", []);
87
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "toastIdToTimerMap", {});
88
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isScrollingToBottom", false);
89
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isScrolledToBottom", true);
90
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isUserInteracting", false);
91
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isScrollingAnimationFrame", 0);
92
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "startScrollingAnimationFrame", 0);
93
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "listElement", null);
94
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onMouseEnter", function () {
95
- // Stop scrolling to bottom if we're in mid-scroll, because the user wants to interact with
96
- // the list.
97
- _this.isScrollingToBottom = false;
98
- _this.isUserInteracting = true; // Don't let toasts dismiss themselves while the user is interacting with them.
99
-
100
- for (var _toastId in _this.toastIdToTimerMap) {
101
- if (_this.toastIdToTimerMap.hasOwnProperty(_toastId)) {
102
- var timer = _this.toastIdToTimerMap[_toastId];
103
- timer.pause();
104
- }
105
- }
106
- });
107
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onMouseLeave", function () {
108
- _this.isUserInteracting = false;
109
-
110
- for (var _toastId2 in _this.toastIdToTimerMap) {
111
- if (_this.toastIdToTimerMap.hasOwnProperty(_toastId2)) {
112
- var timer = _this.toastIdToTimerMap[_toastId2];
113
- timer.resume();
114
- }
58
+ var EuiGlobalToastList = function EuiGlobalToastList(_ref) {
59
+ var className = _ref.className,
60
+ _ref$toasts = _ref.toasts,
61
+ toasts = _ref$toasts === void 0 ? [] : _ref$toasts,
62
+ dismissToastProp = _ref.dismissToast,
63
+ toastLifeTimeMs = _ref.toastLifeTimeMs,
64
+ _ref$side = _ref.side,
65
+ side = _ref$side === void 0 ? 'right' : _ref$side,
66
+ rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
67
+
68
+ var _useState = (0, _react.useState)({}),
69
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
70
+ toastIdToDismissedMap = _useState2[0],
71
+ setToastIdToDismissedMap = _useState2[1];
72
+
73
+ var _useState3 = (0, _react.useState)(),
74
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
75
+ toastToDismiss = _useState4[0],
76
+ setToastToDismiss = _useState4[1];
77
+
78
+ var prevToasts = (0, _react.useRef)([]);
79
+ var dismissTimeoutIds = (0, _react.useRef)([]);
80
+ var toastIdToTimerMap = (0, _react.useRef)({});
81
+ var isScrollingToBottom = (0, _react.useRef)(false);
82
+ var isScrolledToBottom = (0, _react.useRef)(true);
83
+ var isUserInteracting = (0, _react.useRef)(false); // See [Return Value](https://developer.mozilla.org/en-US/docs/Web/API/Window/requestAnimationFrame#Return_value)
84
+ // for information on initial value of 0
85
+
86
+ var isScrollingAnimationFrame = (0, _react.useRef)(0);
87
+ var startScrollingAnimationFrame = (0, _react.useRef)(0);
88
+ var listElement = (0, _react.useRef)(null);
89
+ var euiTheme = (0, _services.useEuiTheme)();
90
+ var styles = (0, _global_toast_list.euiGlobalToastListStyles)(euiTheme);
91
+ var cssStyles = [styles.euiGlobalToastList, styles[side]];
92
+
93
+ var startScrollingToBottom = function startScrollingToBottom() {
94
+ isScrollingToBottom.current = true;
95
+
96
+ var scrollToBottom = function scrollToBottom() {
97
+ // Although we cancel the requestAnimationFrame in componentWillUnmount,
98
+ // it's possible for this.listElement to become null in the meantime
99
+ if (!listElement.current) {
100
+ return;
115
101
  }
116
- });
117
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onScroll", function () {
118
- if (_this.listElement) {
119
- _this.isScrolledToBottom = _this.listElement.scrollHeight - _this.listElement.scrollTop === _this.listElement.clientHeight;
120
- }
121
- });
122
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "scheduleAllToastsForDismissal", function () {
123
- _this.props.toasts.forEach(function (toast) {
124
- if (!_this.toastIdToTimerMap[toast.id]) {
125
- _this.scheduleToastForDismissal(toast);
126
- }
127
- });
128
- });
129
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "scheduleToastForDismissal", function (toast) {
130
- // Start fading the toast out once its lifetime elapses.
131
- _this.toastIdToTimerMap[toast.id] = new _time.Timer(_this.dismissToast.bind((0, _assertThisInitialized2.default)(_this), toast), toast.toastLifeTimeMs != null ? toast.toastLifeTimeMs : _this.props.toastLifeTimeMs);
132
- });
133
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "dismissToast", function (toast) {
134
- // Remove the toast after it's done fading out.
135
- _this.dismissTimeoutIds.push(window.setTimeout(function () {
136
- // Because this is wrapped in a setTimeout, and because React does not guarantee when
137
- // state updates happen, it is possible to double-dismiss a toast
138
- // including by double-clicking the "x" button on the toast
139
- // so, first check to make sure we haven't already dismissed this toast
140
- if (_this.toastIdToTimerMap.hasOwnProperty(toast.id)) {
141
- _this.props.dismissToast.apply((0, _assertThisInitialized2.default)(_this), [toast]);
142
-
143
- _this.toastIdToTimerMap[toast.id].clear();
144
-
145
- delete _this.toastIdToTimerMap[toast.id];
146
-
147
- _this.setState(function (prevState) {
148
- var toastIdToDismissedMap = _objectSpread({}, prevState.toastIdToDismissedMap);
149
-
150
- delete toastIdToDismissedMap[toast.id];
151
- return {
152
- toastIdToDismissedMap: toastIdToDismissedMap
153
- };
154
- });
155
- }
156
- }, TOAST_FADE_OUT_MS));
157
102
 
158
- _this.setState(function (prevState) {
159
- var toastIdToDismissedMap = _objectSpread(_objectSpread({}, prevState.toastIdToDismissedMap), {}, (0, _defineProperty2.default)({}, toast.id, true));
103
+ var position = listElement.current.scrollTop;
104
+ var destination = listElement.current.scrollHeight - listElement.current.clientHeight;
105
+ var distanceToDestination = destination - position;
160
106
 
161
- return {
162
- toastIdToDismissedMap: toastIdToDismissedMap
163
- };
164
- });
165
- });
166
- return _this;
167
- }
107
+ if (distanceToDestination < 5) {
108
+ listElement.current.scrollTop = destination;
109
+ isScrollingToBottom.current = false;
110
+ isScrolledToBottom.current = true;
111
+ return;
112
+ }
168
113
 
169
- (0, _createClass2.default)(EuiGlobalToastList, [{
170
- key: "startScrollingToBottom",
171
- value: function startScrollingToBottom() {
172
- var _this2 = this;
114
+ listElement.current.scrollTop = position + distanceToDestination * 0.25;
173
115
 
174
- this.isScrollingToBottom = true;
116
+ if (isScrollingToBottom) {
117
+ isScrollingAnimationFrame.current = window.requestAnimationFrame(scrollToBottom);
118
+ }
119
+ };
175
120
 
176
- var scrollToBottom = function scrollToBottom() {
177
- // Although we cancel the requestAnimationFrame in componentWillUnmount,
178
- // it's possible for this.listElement to become null in the meantime
179
- if (!_this2.listElement) {
180
- return;
181
- }
121
+ startScrollingAnimationFrame.current = window.requestAnimationFrame(scrollToBottom);
122
+ };
182
123
 
183
- var position = _this2.listElement.scrollTop;
184
- var destination = _this2.listElement.scrollHeight - _this2.listElement.clientHeight;
185
- var distanceToDestination = destination - position;
124
+ var onMouseEnter = function onMouseEnter() {
125
+ // Stop scrolling to bottom if we're in mid-scroll, because the user wants to interact with
126
+ // the list.
127
+ isScrollingToBottom.current = false;
128
+ isUserInteracting.current = true; // Don't let toasts dismiss themselves while the user is interacting with them.
186
129
 
187
- if (distanceToDestination < 5) {
188
- _this2.listElement.scrollTop = destination;
189
- _this2.isScrollingToBottom = false;
190
- _this2.isScrolledToBottom = true;
191
- return;
192
- }
130
+ for (var _toastId in toastIdToTimerMap.current) {
131
+ if (toastIdToTimerMap.current.hasOwnProperty(_toastId)) {
132
+ var timer = toastIdToTimerMap.current[_toastId];
133
+ timer.pause();
134
+ }
135
+ }
136
+ };
193
137
 
194
- _this2.listElement.scrollTop = position + distanceToDestination * 0.25;
138
+ var onMouseLeave = function onMouseLeave() {
139
+ isUserInteracting.current = false;
195
140
 
196
- if (_this2.isScrollingToBottom) {
197
- _this2.isScrollingAnimationFrame = window.requestAnimationFrame(scrollToBottom);
198
- }
199
- };
141
+ for (var _toastId2 in toastIdToTimerMap.current) {
142
+ if (toastIdToTimerMap.current.hasOwnProperty(_toastId2)) {
143
+ var timer = toastIdToTimerMap.current[_toastId2];
144
+ timer.resume();
145
+ }
146
+ }
147
+ };
200
148
 
201
- this.startScrollingAnimationFrame = window.requestAnimationFrame(scrollToBottom);
149
+ var onScroll = function onScroll() {
150
+ if (listElement.current) {
151
+ isScrolledToBottom.current = listElement.current.scrollHeight - listElement.current.scrollTop === listElement.current.clientHeight;
202
152
  }
203
- }, {
204
- key: "componentDidMount",
205
- value: function componentDidMount() {
206
- if (this.listElement) {
207
- this.listElement.addEventListener('scroll', this.onScroll);
208
- this.listElement.addEventListener('mouseenter', this.onMouseEnter);
209
- this.listElement.addEventListener('mouseleave', this.onMouseLeave);
153
+ };
154
+
155
+ var dismissToast = (0, _react.useCallback)(function (toast) {
156
+ // Remove the toast after it's done fading out.
157
+ dismissTimeoutIds.current.push(window.setTimeout(function () {
158
+ setToastToDismiss(toast);
159
+ }, TOAST_FADE_OUT_MS));
160
+ setToastIdToDismissedMap(function (prev) {
161
+ return _objectSpread(_objectSpread({}, prev), {}, (0, _defineProperty2.default)({}, toast.id, true));
162
+ });
163
+ }, []);
164
+ var scheduleToastForDismissal = (0, _react.useCallback)(function (toast) {
165
+ // Start fading the toast out once its lifetime elapses.
166
+ toastIdToTimerMap.current[toast.id] = new _time.Timer(function () {
167
+ return dismissToast(toast);
168
+ }, toast.toastLifeTimeMs != null ? toast.toastLifeTimeMs : toastLifeTimeMs);
169
+ }, [dismissToast, toastLifeTimeMs]);
170
+ var scheduleAllToastsForDismissal = (0, _react.useCallback)(function () {
171
+ toasts.forEach(function (toast) {
172
+ if (!toastIdToTimerMap.current[toast.id]) {
173
+ scheduleToastForDismissal(toast);
210
174
  }
175
+ });
176
+ }, [scheduleToastForDismissal, toasts]);
211
177
 
212
- this.scheduleAllToastsForDismissal();
178
+ var addListeners = function addListeners() {
179
+ if (listElement.current) {
180
+ listElement.current.addEventListener('scroll', onScroll);
181
+ listElement.current.addEventListener('mouseenter', onMouseEnter);
182
+ listElement.current.addEventListener('mouseleave', onMouseLeave);
213
183
  }
214
- }, {
215
- key: "componentDidUpdate",
216
- value: function componentDidUpdate(prevProps) {
217
- this.scheduleAllToastsForDismissal();
218
-
219
- if (!this.isUserInteracting) {
220
- // If the user has scrolled up the toast list then we don't want to annoy them by scrolling
221
- // all the way back to the bottom.
222
- if (this.isScrolledToBottom) {
223
- if (prevProps.toasts.length < this.props.toasts.length) {
224
- this.startScrollingToBottom();
225
- }
226
- }
227
- }
184
+ };
185
+
186
+ var removeListeners = function removeListeners() {
187
+ if (listElement.current) {
188
+ listElement.current.removeEventListener('scroll', onScroll);
189
+ listElement.current.removeEventListener('mouseenter', onMouseEnter);
190
+ listElement.current.removeEventListener('mouseleave', onMouseLeave);
228
191
  }
229
- }, {
230
- key: "componentWillUnmount",
231
- value: function componentWillUnmount() {
232
- if (this.isScrollingAnimationFrame !== 0) {
233
- window.cancelAnimationFrame(this.isScrollingAnimationFrame);
234
- }
192
+ }; // componentDidMount
193
+
235
194
 
236
- if (this.startScrollingAnimationFrame !== 0) {
237
- window.cancelAnimationFrame(this.startScrollingAnimationFrame);
195
+ (0, _react.useEffect)(function () {
196
+ addListeners(); // componentWillUnmount
197
+
198
+ return function () {
199
+ if (isScrollingAnimationFrame.current !== 0) {
200
+ window.cancelAnimationFrame(isScrollingAnimationFrame.current);
238
201
  }
239
202
 
240
- if (this.listElement) {
241
- this.listElement.removeEventListener('scroll', this.onScroll);
242
- this.listElement.removeEventListener('mouseenter', this.onMouseEnter);
243
- this.listElement.removeEventListener('mouseleave', this.onMouseLeave);
203
+ if (startScrollingAnimationFrame.current !== 0) {
204
+ window.cancelAnimationFrame(startScrollingAnimationFrame.current);
244
205
  }
245
206
 
246
- this.dismissTimeoutIds.forEach(clearTimeout);
207
+ removeListeners();
208
+ dismissTimeoutIds.current.forEach(clearTimeout); // eslint-disable-line react-hooks/exhaustive-deps
209
+
210
+ for (var _toastId3 in toastIdToTimerMap.current) {
211
+ if (toastIdToTimerMap.current.hasOwnProperty(_toastId3)) {
212
+ var timer = toastIdToTimerMap.current[_toastId3]; // eslint-disable-line react-hooks/exhaustive-deps
247
213
 
248
- for (var _toastId3 in this.toastIdToTimerMap) {
249
- if (this.toastIdToTimerMap.hasOwnProperty(_toastId3)) {
250
- var timer = this.toastIdToTimerMap[_toastId3];
251
214
  timer.clear();
252
215
  }
253
216
  }
217
+ };
218
+ }, []); // eslint-disable-line react-hooks/exhaustive-deps
219
+ // componentDidUpdate
220
+
221
+ (0, _react.useEffect)(function () {
222
+ scheduleAllToastsForDismissal();
223
+
224
+ if (!isUserInteracting.current) {
225
+ // If the user has scrolled up the toast list then we don't want to annoy them by scrolling
226
+ // all the way back to the bottom.
227
+ if (isScrolledToBottom.current) {
228
+ if (prevToasts.current.length < toasts.length) {
229
+ startScrollingToBottom();
230
+ }
231
+ }
254
232
  }
255
- }, {
256
- key: "render",
257
- value: function render() {
258
- var _this3 = this;
259
-
260
- var _this$props = this.props,
261
- className = _this$props.className,
262
- toasts = _this$props.toasts,
263
- dismissToast = _this$props.dismissToast,
264
- toastLifeTimeMs = _this$props.toastLifeTimeMs,
265
- side = _this$props.side,
266
- rest = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
267
- var renderedToasts = toasts.map(function (toast) {
268
- var text = toast.text,
269
- toastLifeTimeMs = toast.toastLifeTimeMs,
270
- rest = (0, _objectWithoutProperties2.default)(toast, _excluded2);
271
- return (0, _react2.jsx)(_global_toast_list_item.EuiGlobalToastListItem, {
272
- key: toast.id,
273
- isDismissed: _this3.state.toastIdToDismissedMap[toast.id]
274
- }, (0, _react2.jsx)(_toast.EuiToast, (0, _extends2.default)({
275
- onClose: _this3.dismissToast.bind(_this3, toast),
276
- onFocus: _this3.onMouseEnter,
277
- onBlur: _this3.onMouseLeave
278
- }, rest), text));
233
+
234
+ prevToasts.current = toasts;
235
+ }, [toasts, scheduleAllToastsForDismissal]); // Toast dismissal side effect
236
+ // Ensure the callback has correct state by not enclosing it in `setTimeout`
237
+
238
+ (0, _react.useEffect)(function () {
239
+ var toast = toastToDismiss; // Because this is triggered by a setTimeout, and because React does not guarantee when
240
+ // state updates happen, it is possible to double-dismiss a toast
241
+ // including by double-clicking the "x" button on the toast
242
+ // so, first check to make sure we haven't already dismissed this toast
243
+
244
+ if (toast && toastIdToTimerMap.current.hasOwnProperty(toast.id)) {
245
+ dismissToastProp(toast);
246
+ toastIdToTimerMap.current[toast.id].clear();
247
+ delete toastIdToTimerMap.current[toast.id];
248
+ setToastIdToDismissedMap(function (prev) {
249
+ var toastIdToDismissedMap = _objectSpread({}, prev);
250
+
251
+ delete toastIdToDismissedMap[toast.id];
252
+ return toastIdToDismissedMap;
279
253
  });
280
- var classes = (0, _classnames.default)('euiGlobalToastList', side ? sideToClassNameMap[side] : null, className);
281
- return (0, _react2.jsx)("div", (0, _extends2.default)({
282
- "aria-live": "polite",
283
- role: "region",
284
- ref: function ref(element) {
285
- _this3.listElement = element;
286
- },
287
- className: classes
288
- }, rest), renderedToasts);
289
254
  }
290
- }]);
291
- return EuiGlobalToastList;
292
- }(_react.Component);
293
-
294
- exports.EuiGlobalToastList = EuiGlobalToastList;
295
- (0, _defineProperty2.default)(EuiGlobalToastList, "defaultProps", {
296
- toasts: [],
297
- side: 'right'
298
- });
255
+ }, [toastToDismiss, dismissToastProp]);
256
+ var renderedToasts = toasts.map(function (toast) {
257
+ var text = toast.text,
258
+ toastLifeTimeMs = toast.toastLifeTimeMs,
259
+ rest = (0, _objectWithoutProperties2.default)(toast, _excluded2);
260
+
261
+ var onClose = function onClose() {
262
+ return dismissToast(toast);
263
+ };
264
+
265
+ return (0, _react2.jsx)(_global_toast_list_item.EuiGlobalToastListItem, {
266
+ key: toast.id,
267
+ isDismissed: toastIdToDismissedMap[toast.id]
268
+ }, (0, _react2.jsx)(_toast.EuiToast, (0, _extends2.default)({
269
+ onClose: onClose,
270
+ onFocus: onMouseEnter,
271
+ onBlur: onMouseLeave
272
+ }, rest), text));
273
+ });
274
+ var classes = (0, _classnames.default)('euiGlobalToastList', className);
275
+ return (0, _react2.jsx)("div", (0, _extends2.default)({
276
+ "aria-live": "polite",
277
+ role: "region",
278
+ ref: listElement,
279
+ css: cssStyles,
280
+ className: classes
281
+ }, rest), renderedToasts);
282
+ };
283
+
284
+ exports.EuiGlobalToastList = EuiGlobalToastList;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.euiGlobalToastListStyles = exports.euiGlobalToastListItemStyles = void 0;
9
+
10
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
+
12
+ var _react = require("@emotion/react");
13
+
14
+ var _global_styling = require("../../global_styling");
15
+
16
+ var _templateObject;
17
+
18
+ var euiGlobalToastListStyles = function euiGlobalToastListStyles(euiThemeContext) {
19
+ var euiTheme = euiThemeContext.euiTheme;
20
+ var euiToastWidth = euiTheme.base * 20;
21
+ return {
22
+ /**
23
+ * 1. Allow list to expand as items are added, but cap it at the screen height.
24
+ * 2. Allow some padding for shadow
25
+ */
26
+ // Base
27
+ 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 + euiTheme.base * 5, "px")), ";", (0, _global_styling.logicalCSS)('max-height', '100vh'), ";overflow-y:auto;", (0, _global_styling.logicalCSS)('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.euiBreakpoint)(euiThemeContext, ['xs', 's']), "{&:not(:empty){", (0, _global_styling.logicalCSS)('left', 0), ";", (0, _global_styling.logicalCSS)('width', '100%'), ";}};label:euiGlobalToastList;"),
28
+ // Variants
29
+ right: /*#__PURE__*/(0, _react.css)("&:not(:empty){", (0, _global_styling.logicalCSS)('right', 0), ";", (0, _global_styling.logicalCSS)('padding-left', "".concat(euiTheme.base * 4, "px")), ";}", (0, _global_styling.euiBreakpoint)(euiThemeContext, ['xs', 's']), "{&:not(:empty){", (0, _global_styling.logicalCSS)('padding-left', euiTheme.size.base), ";}};label:right;"),
30
+ left: /*#__PURE__*/(0, _react.css)("&:not(:empty){", (0, _global_styling.logicalCSS)('left', 0), ";", (0, _global_styling.logicalCSS)('padding-right', "".concat(euiTheme.base * 4, "px")), ";}", (0, _global_styling.euiBreakpoint)(euiThemeContext, ['xs', 's']), "{&:not(:empty){", (0, _global_styling.logicalCSS)('padding-right', euiTheme.size.base), ";}};label:left;")
31
+ };
32
+ };
33
+
34
+ exports.euiGlobalToastListStyles = euiGlobalToastListStyles;
35
+
36
+ var euiGlobalToastListItemStyles = function euiGlobalToastListItemStyles(_ref) {
37
+ var euiTheme = _ref.euiTheme;
38
+ 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);
39
+ return {
40
+ // Base
41
+ euiGlobalToastListItem: /*#__PURE__*/(0, _react.css)((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;"),
42
+ // States
43
+ dismissed: /*#__PURE__*/(0, _react.css)("transition:opacity ", euiTheme.animation.normal, ";opacity:0;;label:dismissed;")
44
+ };
45
+ };
46
+
47
+ exports.euiGlobalToastListItemStyles = euiGlobalToastListItemStyles;
@@ -9,27 +9,34 @@ exports.EuiGlobalToastListItem = void 0;
9
9
 
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
 
12
- var _react = require("react");
13
-
14
12
  var _classnames = _interopRequireDefault(require("classnames"));
15
13
 
14
+ var _services = require("../../services");
15
+
16
+ var _clone_element = require("../../services/theme/clone_element");
17
+
18
+ var _global_toast_list = require("./global_toast_list.styles");
19
+
16
20
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
17
21
 
18
22
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
19
23
 
20
24
  var EuiGlobalToastListItem = function EuiGlobalToastListItem(_ref) {
21
25
  var children = _ref.children,
26
+ className = _ref.className,
22
27
  isDismissed = _ref.isDismissed;
28
+ var euiTheme = (0, _services.useEuiTheme)();
23
29
 
24
30
  if (!children) {
25
31
  return null;
26
32
  }
27
33
 
28
- var classes = (0, _classnames.default)('euiGlobalToastListItem', children.props.className, {
29
- 'euiGlobalToastListItem-isDismissed': isDismissed
30
- });
31
- return /*#__PURE__*/(0, _react.cloneElement)(children, _objectSpread(_objectSpread({}, children.props), {
32
- className: classes
34
+ var styles = (0, _global_toast_list.euiGlobalToastListItemStyles)(euiTheme);
35
+ var cssStyles = [styles.euiGlobalToastListItem, isDismissed && styles.dismissed];
36
+ var classes = (0, _classnames.default)('euiGlobalToastListItem', children.props.className, className);
37
+ return (0, _clone_element.cloneElementWithCss)(children, _objectSpread(_objectSpread({}, children.props), {
38
+ className: classes,
39
+ css: cssStyles
33
40
  }));
34
41
  };
35
42