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