@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
@@ -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
 
@@ -35,12 +25,16 @@ var _classnames = _interopRequireDefault(require("classnames"));
35
25
 
36
26
  var _common = require("../common");
37
27
 
28
+ var _services = require("../../services");
29
+
38
30
  var _time = require("../../services/time");
39
31
 
40
32
  var _global_toast_list_item = require("./global_toast_list_item");
41
33
 
42
34
  var _toast = require("./toast");
43
35
 
36
+ var _global_toast_list = require("./global_toast_list.styles");
37
+
44
38
  var _react2 = require("@emotion/react");
45
39
 
46
40
  var _excluded = ["className", "toasts", "dismissToast", "toastLifeTimeMs", "side"],
@@ -54,10 +48,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
54
48
 
55
49
  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; }
56
50
 
57
- 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); }; }
58
-
59
- 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; } }
60
-
61
51
  var sideToClassNameMap = {
62
52
  left: 'euiGlobalToastList--left',
63
53
  right: 'euiGlobalToastList--right'
@@ -67,250 +57,246 @@ exports.SIDES = SIDES;
67
57
  var TOAST_FADE_OUT_MS = 250;
68
58
  exports.TOAST_FADE_OUT_MS = TOAST_FADE_OUT_MS;
69
59
 
70
- var EuiGlobalToastList = /*#__PURE__*/function (_Component) {
71
- (0, _inherits2.default)(EuiGlobalToastList, _Component);
72
-
73
- var _super = _createSuper(EuiGlobalToastList);
74
-
75
- function EuiGlobalToastList() {
76
- var _this;
77
-
78
- (0, _classCallCheck2.default)(this, EuiGlobalToastList);
79
-
80
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
81
- args[_key] = arguments[_key];
82
- }
83
-
84
- _this = _super.call.apply(_super, [this].concat(args));
85
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
86
- toastIdToDismissedMap: {}
87
- });
88
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "dismissTimeoutIds", []);
89
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "toastIdToTimerMap", {});
90
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isScrollingToBottom", false);
91
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isScrolledToBottom", true);
92
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isUserInteracting", false);
93
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isScrollingAnimationFrame", 0);
94
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "startScrollingAnimationFrame", 0);
95
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "listElement", null);
96
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onMouseEnter", function () {
97
- // Stop scrolling to bottom if we're in mid-scroll, because the user wants to interact with
98
- // the list.
99
- _this.isScrollingToBottom = false;
100
- _this.isUserInteracting = true; // Don't let toasts dismiss themselves while the user is interacting with them.
101
-
102
- for (var _toastId in _this.toastIdToTimerMap) {
103
- if (_this.toastIdToTimerMap.hasOwnProperty(_toastId)) {
104
- var timer = _this.toastIdToTimerMap[_toastId];
105
- timer.pause();
106
- }
107
- }
108
- });
109
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onMouseLeave", function () {
110
- _this.isUserInteracting = false;
111
-
112
- for (var _toastId2 in _this.toastIdToTimerMap) {
113
- if (_this.toastIdToTimerMap.hasOwnProperty(_toastId2)) {
114
- var timer = _this.toastIdToTimerMap[_toastId2];
115
- timer.resume();
116
- }
60
+ var EuiGlobalToastList = function EuiGlobalToastList(_ref) {
61
+ var className = _ref.className,
62
+ _ref$toasts = _ref.toasts,
63
+ toasts = _ref$toasts === void 0 ? [] : _ref$toasts,
64
+ dismissToastProp = _ref.dismissToast,
65
+ toastLifeTimeMs = _ref.toastLifeTimeMs,
66
+ _ref$side = _ref.side,
67
+ side = _ref$side === void 0 ? 'right' : _ref$side,
68
+ rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
69
+
70
+ var _useState = (0, _react.useState)({}),
71
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
72
+ toastIdToDismissedMap = _useState2[0],
73
+ setToastIdToDismissedMap = _useState2[1];
74
+
75
+ var _useState3 = (0, _react.useState)(),
76
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
77
+ toastToDismiss = _useState4[0],
78
+ setToastToDismiss = _useState4[1];
79
+
80
+ var prevToasts = (0, _react.useRef)([]);
81
+ var dismissTimeoutIds = (0, _react.useRef)([]);
82
+ var toastIdToTimerMap = (0, _react.useRef)({});
83
+ var isScrollingToBottom = (0, _react.useRef)(false);
84
+ var isScrolledToBottom = (0, _react.useRef)(true);
85
+ var isUserInteracting = (0, _react.useRef)(false); // See [Return Value](https://developer.mozilla.org/en-US/docs/Web/API/Window/requestAnimationFrame#Return_value)
86
+ // for information on initial value of 0
87
+
88
+ var isScrollingAnimationFrame = (0, _react.useRef)(0);
89
+ var startScrollingAnimationFrame = (0, _react.useRef)(0);
90
+ var listElement = (0, _react.useRef)(null);
91
+ var euiTheme = (0, _services.useEuiTheme)();
92
+ var styles = (0, _global_toast_list.euiGlobalToastListStyles)(euiTheme);
93
+ var cssStyles = [styles.euiGlobalToastList, styles[side]];
94
+
95
+ var startScrollingToBottom = function startScrollingToBottom() {
96
+ isScrollingToBottom.current = true;
97
+
98
+ var scrollToBottom = function scrollToBottom() {
99
+ // Although we cancel the requestAnimationFrame in componentWillUnmount,
100
+ // it's possible for this.listElement to become null in the meantime
101
+ if (!listElement.current) {
102
+ return;
117
103
  }
118
- });
119
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onScroll", function () {
120
- if (_this.listElement) {
121
- _this.isScrolledToBottom = _this.listElement.scrollHeight - _this.listElement.scrollTop === _this.listElement.clientHeight;
122
- }
123
- });
124
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "scheduleAllToastsForDismissal", function () {
125
- _this.props.toasts.forEach(function (toast) {
126
- if (!_this.toastIdToTimerMap[toast.id]) {
127
- _this.scheduleToastForDismissal(toast);
128
- }
129
- });
130
- });
131
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "scheduleToastForDismissal", function (toast) {
132
- // Start fading the toast out once its lifetime elapses.
133
- _this.toastIdToTimerMap[toast.id] = new _time.Timer(_this.dismissToast.bind((0, _assertThisInitialized2.default)(_this), toast), toast.toastLifeTimeMs != null ? toast.toastLifeTimeMs : _this.props.toastLifeTimeMs);
134
- });
135
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "dismissToast", function (toast) {
136
- // Remove the toast after it's done fading out.
137
- _this.dismissTimeoutIds.push(window.setTimeout(function () {
138
- // Because this is wrapped in a setTimeout, and because React does not guarantee when
139
- // state updates happen, it is possible to double-dismiss a toast
140
- // including by double-clicking the "x" button on the toast
141
- // so, first check to make sure we haven't already dismissed this toast
142
- if (_this.toastIdToTimerMap.hasOwnProperty(toast.id)) {
143
- _this.props.dismissToast.apply((0, _assertThisInitialized2.default)(_this), [toast]);
144
-
145
- _this.toastIdToTimerMap[toast.id].clear();
146
-
147
- delete _this.toastIdToTimerMap[toast.id];
148
-
149
- _this.setState(function (prevState) {
150
- var toastIdToDismissedMap = _objectSpread({}, prevState.toastIdToDismissedMap);
151
-
152
- delete toastIdToDismissedMap[toast.id];
153
- return {
154
- toastIdToDismissedMap: toastIdToDismissedMap
155
- };
156
- });
157
- }
158
- }, TOAST_FADE_OUT_MS));
159
104
 
160
- _this.setState(function (prevState) {
161
- var toastIdToDismissedMap = _objectSpread(_objectSpread({}, prevState.toastIdToDismissedMap), {}, (0, _defineProperty2.default)({}, toast.id, true));
105
+ var position = listElement.current.scrollTop;
106
+ var destination = listElement.current.scrollHeight - listElement.current.clientHeight;
107
+ var distanceToDestination = destination - position;
162
108
 
163
- return {
164
- toastIdToDismissedMap: toastIdToDismissedMap
165
- };
166
- });
167
- });
168
- return _this;
169
- }
109
+ if (distanceToDestination < 5) {
110
+ listElement.current.scrollTop = destination;
111
+ isScrollingToBottom.current = false;
112
+ isScrolledToBottom.current = true;
113
+ return;
114
+ }
170
115
 
171
- (0, _createClass2.default)(EuiGlobalToastList, [{
172
- key: "startScrollingToBottom",
173
- value: function startScrollingToBottom() {
174
- var _this2 = this;
116
+ listElement.current.scrollTop = position + distanceToDestination * 0.25;
175
117
 
176
- this.isScrollingToBottom = true;
118
+ if (isScrollingToBottom) {
119
+ isScrollingAnimationFrame.current = window.requestAnimationFrame(scrollToBottom);
120
+ }
121
+ };
177
122
 
178
- var scrollToBottom = function scrollToBottom() {
179
- // Although we cancel the requestAnimationFrame in componentWillUnmount,
180
- // it's possible for this.listElement to become null in the meantime
181
- if (!_this2.listElement) {
182
- return;
183
- }
123
+ startScrollingAnimationFrame.current = window.requestAnimationFrame(scrollToBottom);
124
+ };
184
125
 
185
- var position = _this2.listElement.scrollTop;
186
- var destination = _this2.listElement.scrollHeight - _this2.listElement.clientHeight;
187
- var distanceToDestination = destination - position;
126
+ var onMouseEnter = function onMouseEnter() {
127
+ // Stop scrolling to bottom if we're in mid-scroll, because the user wants to interact with
128
+ // the list.
129
+ isScrollingToBottom.current = false;
130
+ isUserInteracting.current = true; // Don't let toasts dismiss themselves while the user is interacting with them.
188
131
 
189
- if (distanceToDestination < 5) {
190
- _this2.listElement.scrollTop = destination;
191
- _this2.isScrollingToBottom = false;
192
- _this2.isScrolledToBottom = true;
193
- return;
194
- }
132
+ for (var _toastId in toastIdToTimerMap.current) {
133
+ if (toastIdToTimerMap.current.hasOwnProperty(_toastId)) {
134
+ var timer = toastIdToTimerMap.current[_toastId];
135
+ timer.pause();
136
+ }
137
+ }
138
+ };
195
139
 
196
- _this2.listElement.scrollTop = position + distanceToDestination * 0.25;
140
+ var onMouseLeave = function onMouseLeave() {
141
+ isUserInteracting.current = false;
197
142
 
198
- if (_this2.isScrollingToBottom) {
199
- _this2.isScrollingAnimationFrame = window.requestAnimationFrame(scrollToBottom);
200
- }
201
- };
143
+ for (var _toastId2 in toastIdToTimerMap.current) {
144
+ if (toastIdToTimerMap.current.hasOwnProperty(_toastId2)) {
145
+ var timer = toastIdToTimerMap.current[_toastId2];
146
+ timer.resume();
147
+ }
148
+ }
149
+ };
202
150
 
203
- this.startScrollingAnimationFrame = window.requestAnimationFrame(scrollToBottom);
151
+ var onScroll = function onScroll() {
152
+ if (listElement.current) {
153
+ isScrolledToBottom.current = listElement.current.scrollHeight - listElement.current.scrollTop === listElement.current.clientHeight;
204
154
  }
205
- }, {
206
- key: "componentDidMount",
207
- value: function componentDidMount() {
208
- if (this.listElement) {
209
- this.listElement.addEventListener('scroll', this.onScroll);
210
- this.listElement.addEventListener('mouseenter', this.onMouseEnter);
211
- this.listElement.addEventListener('mouseleave', this.onMouseLeave);
155
+ };
156
+
157
+ var dismissToast = (0, _react.useCallback)(function (toast) {
158
+ // Remove the toast after it's done fading out.
159
+ dismissTimeoutIds.current.push(window.setTimeout(function () {
160
+ setToastToDismiss(toast);
161
+ }, TOAST_FADE_OUT_MS));
162
+ setToastIdToDismissedMap(function (prev) {
163
+ return _objectSpread(_objectSpread({}, prev), {}, (0, _defineProperty2.default)({}, toast.id, true));
164
+ });
165
+ }, []);
166
+ var scheduleToastForDismissal = (0, _react.useCallback)(function (toast) {
167
+ // Start fading the toast out once its lifetime elapses.
168
+ toastIdToTimerMap.current[toast.id] = new _time.Timer(function () {
169
+ return dismissToast(toast);
170
+ }, toast.toastLifeTimeMs != null ? toast.toastLifeTimeMs : toastLifeTimeMs);
171
+ }, [dismissToast, toastLifeTimeMs]);
172
+ var scheduleAllToastsForDismissal = (0, _react.useCallback)(function () {
173
+ toasts.forEach(function (toast) {
174
+ if (!toastIdToTimerMap.current[toast.id]) {
175
+ scheduleToastForDismissal(toast);
212
176
  }
177
+ });
178
+ }, [scheduleToastForDismissal, toasts]);
213
179
 
214
- this.scheduleAllToastsForDismissal();
180
+ var addListeners = function addListeners() {
181
+ if (listElement.current) {
182
+ listElement.current.addEventListener('scroll', onScroll);
183
+ listElement.current.addEventListener('mouseenter', onMouseEnter);
184
+ listElement.current.addEventListener('mouseleave', onMouseLeave);
215
185
  }
216
- }, {
217
- key: "componentDidUpdate",
218
- value: function componentDidUpdate(prevProps) {
219
- this.scheduleAllToastsForDismissal();
220
-
221
- if (!this.isUserInteracting) {
222
- // If the user has scrolled up the toast list then we don't want to annoy them by scrolling
223
- // all the way back to the bottom.
224
- if (this.isScrolledToBottom) {
225
- if (prevProps.toasts.length < this.props.toasts.length) {
226
- this.startScrollingToBottom();
227
- }
228
- }
229
- }
186
+ };
187
+
188
+ var removeListeners = function removeListeners() {
189
+ if (listElement.current) {
190
+ listElement.current.removeEventListener('scroll', onScroll);
191
+ listElement.current.removeEventListener('mouseenter', onMouseEnter);
192
+ listElement.current.removeEventListener('mouseleave', onMouseLeave);
230
193
  }
231
- }, {
232
- key: "componentWillUnmount",
233
- value: function componentWillUnmount() {
234
- if (this.isScrollingAnimationFrame !== 0) {
235
- window.cancelAnimationFrame(this.isScrollingAnimationFrame);
236
- }
194
+ }; // componentDidMount
195
+
237
196
 
238
- if (this.startScrollingAnimationFrame !== 0) {
239
- window.cancelAnimationFrame(this.startScrollingAnimationFrame);
197
+ (0, _react.useEffect)(function () {
198
+ addListeners(); // componentWillUnmount
199
+
200
+ return function () {
201
+ if (isScrollingAnimationFrame.current !== 0) {
202
+ window.cancelAnimationFrame(isScrollingAnimationFrame.current);
240
203
  }
241
204
 
242
- if (this.listElement) {
243
- this.listElement.removeEventListener('scroll', this.onScroll);
244
- this.listElement.removeEventListener('mouseenter', this.onMouseEnter);
245
- this.listElement.removeEventListener('mouseleave', this.onMouseLeave);
205
+ if (startScrollingAnimationFrame.current !== 0) {
206
+ window.cancelAnimationFrame(startScrollingAnimationFrame.current);
246
207
  }
247
208
 
248
- this.dismissTimeoutIds.forEach(clearTimeout);
209
+ removeListeners();
210
+ dismissTimeoutIds.current.forEach(clearTimeout); // eslint-disable-line react-hooks/exhaustive-deps
211
+
212
+ for (var _toastId3 in toastIdToTimerMap.current) {
213
+ if (toastIdToTimerMap.current.hasOwnProperty(_toastId3)) {
214
+ var timer = toastIdToTimerMap.current[_toastId3]; // eslint-disable-line react-hooks/exhaustive-deps
249
215
 
250
- for (var _toastId3 in this.toastIdToTimerMap) {
251
- if (this.toastIdToTimerMap.hasOwnProperty(_toastId3)) {
252
- var timer = this.toastIdToTimerMap[_toastId3];
253
216
  timer.clear();
254
217
  }
255
218
  }
219
+ };
220
+ }, []); // eslint-disable-line react-hooks/exhaustive-deps
221
+ // componentDidUpdate
222
+
223
+ (0, _react.useEffect)(function () {
224
+ scheduleAllToastsForDismissal();
225
+
226
+ if (!isUserInteracting.current) {
227
+ // If the user has scrolled up the toast list then we don't want to annoy them by scrolling
228
+ // all the way back to the bottom.
229
+ if (isScrolledToBottom.current) {
230
+ if (prevToasts.current.length < toasts.length) {
231
+ startScrollingToBottom();
232
+ }
233
+ }
256
234
  }
257
- }, {
258
- key: "render",
259
- value: function render() {
260
- var _this3 = this;
261
-
262
- var _this$props = this.props,
263
- className = _this$props.className,
264
- toasts = _this$props.toasts,
265
- dismissToast = _this$props.dismissToast,
266
- toastLifeTimeMs = _this$props.toastLifeTimeMs,
267
- side = _this$props.side,
268
- rest = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
269
- var renderedToasts = toasts.map(function (toast) {
270
- var text = toast.text,
271
- toastLifeTimeMs = toast.toastLifeTimeMs,
272
- rest = (0, _objectWithoutProperties2.default)(toast, _excluded2);
273
- return (0, _react2.jsx)(_global_toast_list_item.EuiGlobalToastListItem, {
274
- key: toast.id,
275
- isDismissed: _this3.state.toastIdToDismissedMap[toast.id]
276
- }, (0, _react2.jsx)(_toast.EuiToast, (0, _extends2.default)({
277
- onClose: _this3.dismissToast.bind(_this3, toast),
278
- onFocus: _this3.onMouseEnter,
279
- onBlur: _this3.onMouseLeave
280
- }, rest), text));
235
+
236
+ prevToasts.current = toasts;
237
+ }, [toasts, scheduleAllToastsForDismissal]); // Toast dismissal side effect
238
+ // Ensure the callback has correct state by not enclosing it in `setTimeout`
239
+
240
+ (0, _react.useEffect)(function () {
241
+ var toast = toastToDismiss; // Because this is triggered by a setTimeout, and because React does not guarantee when
242
+ // state updates happen, it is possible to double-dismiss a toast
243
+ // including by double-clicking the "x" button on the toast
244
+ // so, first check to make sure we haven't already dismissed this toast
245
+
246
+ if (toast && toastIdToTimerMap.current.hasOwnProperty(toast.id)) {
247
+ dismissToastProp(toast);
248
+ toastIdToTimerMap.current[toast.id].clear();
249
+ delete toastIdToTimerMap.current[toast.id];
250
+ setToastIdToDismissedMap(function (prev) {
251
+ var toastIdToDismissedMap = _objectSpread({}, prev);
252
+
253
+ delete toastIdToDismissedMap[toast.id];
254
+ return toastIdToDismissedMap;
281
255
  });
282
- var classes = (0, _classnames.default)('euiGlobalToastList', side ? sideToClassNameMap[side] : null, className);
283
- return (0, _react2.jsx)("div", (0, _extends2.default)({
284
- "aria-live": "polite",
285
- role: "region",
286
- ref: function ref(element) {
287
- _this3.listElement = element;
288
- },
289
- className: classes
290
- }, rest), renderedToasts);
291
256
  }
292
- }]);
293
- return EuiGlobalToastList;
294
- }(_react.Component);
257
+ }, [toastToDismiss, dismissToastProp]);
258
+ var renderedToasts = toasts.map(function (toast) {
259
+ var text = toast.text,
260
+ toastLifeTimeMs = toast.toastLifeTimeMs,
261
+ rest = (0, _objectWithoutProperties2.default)(toast, _excluded2);
262
+
263
+ var onClose = function onClose() {
264
+ return dismissToast(toast);
265
+ };
266
+
267
+ return (0, _react2.jsx)(_global_toast_list_item.EuiGlobalToastListItem, {
268
+ key: toast.id,
269
+ isDismissed: toastIdToDismissedMap[toast.id]
270
+ }, (0, _react2.jsx)(_toast.EuiToast, (0, _extends2.default)({
271
+ onClose: onClose,
272
+ onFocus: onMouseEnter,
273
+ onBlur: onMouseLeave
274
+ }, rest), text));
275
+ });
276
+ var classes = (0, _classnames.default)('euiGlobalToastList', className);
277
+ return (0, _react2.jsx)("div", (0, _extends2.default)({
278
+ "aria-live": "polite",
279
+ role: "region",
280
+ ref: listElement,
281
+ css: cssStyles,
282
+ className: classes
283
+ }, rest), renderedToasts);
284
+ };
295
285
 
296
286
  exports.EuiGlobalToastList = EuiGlobalToastList;
297
- (0, _defineProperty2.default)(EuiGlobalToastList, "defaultProps", {
298
- toasts: [],
299
- side: 'right'
300
- });
301
287
  EuiGlobalToastList.propTypes = {
302
288
  toasts: _propTypes.default.arrayOf(_propTypes.default.shape({
303
289
  id: _propTypes.default.string.isRequired,
304
290
  text: _propTypes.default.node,
305
291
  toastLifeTimeMs: _propTypes.default.number,
306
292
  title: _propTypes.default.node,
307
- color: _propTypes.default.oneOf(["primary", "success", "warning", "danger"]),
293
+ color: _propTypes.default.any,
308
294
  iconType: _propTypes.default.oneOfType([_propTypes.default.oneOf(["accessibility", "addDataApp", "advancedSettingsApp", "agentApp", "aggregate", "alert", "analyzeEvent", "annotation", "apmApp", "apmTrace", "appSearchApp", "apps", "arrowDown", "arrowLeft", "arrowRight", "arrowUp", "arrowStart", "arrowEnd", "asterisk", "auditbeatApp", "beaker", "bell", "bellSlash", "bolt", "boxesHorizontal", "boxesVertical", "branch", "branchUser", "broom", "brush", "bug", "bullseye", "calendar", "canvasApp", "casesApp", "check", "checkInCircleFilled", "cheer", "classificationJob", "clock", "cloudDrizzle", "cloudStormy", "cloudSunny", "cluster", "codeApp", "color", "compute", "console", "consoleApp", "container", "continuityAbove", "continuityAboveBelow", "continuityBelow", "continuityWithin", "controlsHorizontal", "controlsVertical", "copy", "copyClipboard", "createAdvancedJob", "createMultiMetricJob", "createPopulationJob", "createSingleMetricJob", "cross", "crossClusterReplicationApp", "crossInACircleFilled", "crosshairs", "currency", "cut", "dashboardApp", "dataVisualizer", "database", "desktop", "devToolsApp", "discoverApp", "document", "documentEdit", "documentation", "documents", "dot", "doubleArrowLeft", "doubleArrowRight", "download", "editorAlignCenter", "editorAlignLeft", "editorAlignRight", "editorBold", "editorChecklist", "editorCodeBlock", "editorComment", "editorDistributeHorizontal", "editorDistributeVertical", "editorHeading", "editorItalic", "editorItemAlignBottom", "editorItemAlignCenter", "editorItemAlignLeft", "editorItemAlignMiddle", "editorItemAlignRight", "editorItemAlignTop", "editorLink", "editorOrderedList", "editorPositionBottomLeft", "editorPositionBottomRight", "editorPositionTopLeft", "editorPositionTopRight", "editorRedo", "editorStrike", "editorTable", "editorUnderline", "editorUndo", "editorUnorderedList", "email", "empty", "emsApp", "eql", "eraser", "exit", "expand", "expandMini", "exportAction", "eye", "eyeClosed", "faceHappy", "faceNeutral", "faceSad", "filebeatApp", "filter", "flag", "fleetApp", "fold", "folderCheck", "folderClosed", "folderExclamation", "folderOpen", "frameNext", "framePrevious", "fullScreen", "fullScreenExit", "function", "gear", "gisApp", "glasses", "globe", "grab", "grabHorizontal", "graphApp", "grid", "grokApp", "heart", "heartbeatApp", "heatmap", "help", "home", "iInCircle", "image", "importAction", "indexClose", "indexEdit", "indexFlush", "indexManagementApp", "indexMapping", "indexOpen", "indexPatternApp", "indexRollupApp", "indexRuntime", "indexSettings", "inputOutput", "inspect", "invert", "ip", "keyboard", "kqlField", "kqlFunction", "kqlOperand", "kqlSelector", "kqlValue", "kubernetesNode", "kubernetesPod", "layers", "lensApp", "lettering", "lineDashed", "lineDotted", "lineSolid", "link", "list", "listAdd", "lock", "lockOpen", "logoAWS", "logoAWSMono", "logoAerospike", "logoApache", "logoAppSearch", "logoAzure", "logoAzureMono", "logoBeats", "logoBusinessAnalytics", "logoCeph", "logoCloud", "logoCloudEnterprise", "logoCode", "logoCodesandbox", "logoCouchbase", "logoDocker", "logoDropwizard", "logoElastic", "logoElasticStack", "logoElasticsearch", "logoEnterpriseSearch", "logoEtcd", "logoGCP", "logoGCPMono", "logoGithub", "logoGmail", "logoGolang", "logoGoogleG", "logoHAproxy", "logoIBM", "logoIBMMono", "logoKafka", "logoKibana", "logoKubernetes", "logoLogging", "logoLogstash", "logoMaps", "logoMemcached", "logoMetrics", "logoMongodb", "logoMySQL", "logoNginx", "logoObservability", "logoOsquery", "logoPhp", "logoPostgres", "logoPrometheus", "logoRabbitmq", "logoRedis", "logoSecurity", "logoSiteSearch", "logoSketch", "logoSlack", "logoUptime", "logoWebhook", "logoWindows", "logoWorkplaceSearch", "logsApp", "logstashFilter", "logstashIf", "logstashInput", "logstashOutput", "logstashQueue", "machineLearningApp", "magnet", "magnifyWithExclamation", "magnifyWithMinus", "magnifyWithPlus", "managementApp", "mapMarker", "memory", "menu", "menuDown", "menuLeft", "menuRight", "menuUp", "merge", "metricbeatApp", "metricsApp", "minimize", "minus", "minusInCircle", "minusInCircleFilled", "mobile", "monitoringApp", "moon", "namespace", "nested", "node", "notebookApp", "number", "offline", "online", "outlierDetectionJob", "package", "packetbeatApp", "pageSelect", "pagesSelect", "paperClip", "partial", "pause", "payment", "pencil", "percent", "pin", "pinFilled", "pipelineApp", "play", "playFilled", "plus", "plusInCircle", "plusInCircleFilled", "popout", "push", "questionInCircle", "quote", "recentlyViewedApp", "refresh", "regressionJob", "reporter", "reportingApp", "returnKey", "save", "savedObjectsApp", "scale", "search", "searchProfilerApp", "securityAnalyticsApp", "securityApp", "securitySignal", "securitySignalDetected", "securitySignalResolved", "sessionViewer", "shard", "share", "snowflake", "sortDown", "sortLeft", "sortRight", "sortUp", "sortable", "spacesApp", "sqlApp", "starEmpty", "starEmptySpace", "starFilled", "starFilledSpace", "starMinusEmpty", "starMinusFilled", "starPlusEmpty", "starPlusFilled", "stats", "stop", "stopFilled", "stopSlash", "storage", "string", "submodule", "sun", "swatchInput", "symlink", "tableDensityCompact", "tableDensityExpanded", "tableDensityNormal", "tableOfContents", "tag", "tear", "temperature", "timeline", "timelionApp", "timeRefresh", "timeslider", "training", "trash", "unfold", "unlink", "upgradeAssistantApp", "uptimeApp", "user", "userAvatar", "users", "usersRolesApp", "vector", "videoPlayer", "visArea", "visAreaStacked", "visBarHorizontal", "visBarHorizontalStacked", "visBarVertical", "visBarVerticalStacked", "visGauge", "visGoal", "visLine", "visMapCoordinate", "visMapRegion", "visMetric", "visPie", "visTable", "visTagCloud", "visText", "visTimelion", "visVega", "visVisualBuilder", "visualizeApp", "watchesApp", "wordWrap", "wordWrapDisabled", "workplaceSearchApp", "wrench", "tokenAlias", "tokenAnnotation", "tokenArray", "tokenBinary", "tokenBoolean", "tokenClass", "tokenCompletionSuggester", "tokenConstant", "tokenDate", "tokenDenseVector", "tokenElement", "tokenEnum", "tokenEnumMember", "tokenEvent", "tokenException", "tokenField", "tokenFile", "tokenFlattened", "tokenFunction", "tokenGeo", "tokenHistogram", "tokenInterface", "tokenIP", "tokenJoin", "tokenKey", "tokenKeyword", "tokenMethod", "tokenMetricCounter", "tokenMetricGauge", "tokenModule", "tokenNamespace", "tokenNested", "tokenNull", "tokenNumber", "tokenObject", "tokenOperator", "tokenPackage", "tokenParameter", "tokenPercolator", "tokenProperty", "tokenRange", "tokenRankFeature", "tokenRankFeatures", "tokenRepo", "tokenSearchType", "tokenShape", "tokenString", "tokenStruct", "tokenSymbol", "tokenTag", "tokenText", "tokenTokenCount", "tokenVariable"]).isRequired, _propTypes.default.string.isRequired, _propTypes.default.elementType.isRequired]),
309
295
  onClose: _propTypes.default.func,
310
296
  className: _propTypes.default.string,
311
297
  "aria-label": _propTypes.default.string,
312
298
  "data-test-subj": _propTypes.default.string
313
- }).isRequired).isRequired,
299
+ }).isRequired),
314
300
  dismissToast: _propTypes.default.func.isRequired,
315
301
  toastLifeTimeMs: _propTypes.default.number.isRequired,
316
302
 
@@ -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,11 +9,15 @@ exports.EuiGlobalToastListItem = void 0;
9
9
 
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
 
12
- var _react = require("react");
12
+ var _classnames = _interopRequireDefault(require("classnames"));
13
13
 
14
14
  var _propTypes = _interopRequireDefault(require("prop-types"));
15
15
 
16
- var _classnames = _interopRequireDefault(require("classnames"));
16
+ var _services = require("../../services");
17
+
18
+ var _clone_element = require("../../services/theme/clone_element");
19
+
20
+ var _global_toast_list = require("./global_toast_list.styles");
17
21
 
18
22
  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; }
19
23
 
@@ -21,17 +25,20 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
21
25
 
22
26
  var EuiGlobalToastListItem = function EuiGlobalToastListItem(_ref) {
23
27
  var children = _ref.children,
28
+ className = _ref.className,
24
29
  isDismissed = _ref.isDismissed;
30
+ var euiTheme = (0, _services.useEuiTheme)();
25
31
 
26
32
  if (!children) {
27
33
  return null;
28
34
  }
29
35
 
30
- var classes = (0, _classnames.default)('euiGlobalToastListItem', children.props.className, {
31
- 'euiGlobalToastListItem-isDismissed': isDismissed
32
- });
33
- return /*#__PURE__*/(0, _react.cloneElement)(children, _objectSpread(_objectSpread({}, children.props), {
34
- className: classes
36
+ var styles = (0, _global_toast_list.euiGlobalToastListItemStyles)(euiTheme);
37
+ var cssStyles = [styles.euiGlobalToastListItem, isDismissed && styles.dismissed];
38
+ var classes = (0, _classnames.default)('euiGlobalToastListItem', children.props.className, className);
39
+ return (0, _clone_element.cloneElementWithCss)(children, _objectSpread(_objectSpread({}, children.props), {
40
+ className: classes,
41
+ css: cssStyles
35
42
  }));
36
43
  };
37
44