@elastic/eui 93.2.0 → 93.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (418) hide show
  1. package/dist/eui_charts_theme.d.ts +9 -0
  2. package/dist/eui_charts_theme.js +56 -14
  3. package/dist/eui_charts_theme.js.map +1 -1
  4. package/dist/eui_theme_dark.css +3 -0
  5. package/dist/eui_theme_dark.min.css +1 -1
  6. package/dist/eui_theme_light.css +3 -0
  7. package/dist/eui_theme_light.min.css +1 -1
  8. package/es/components/breadcrumbs/_breadcrumb_content.js +362 -0
  9. package/es/components/breadcrumbs/_breadcrumb_content.styles.js +48 -0
  10. package/es/components/breadcrumbs/breadcrumb.js +10 -324
  11. package/es/components/breadcrumbs/breadcrumb.styles.js +5 -27
  12. package/es/components/breadcrumbs/breadcrumbs.js +8 -6
  13. package/es/components/breadcrumbs/types.js +1 -0
  14. package/es/components/button/button_display/_button_display.js +2 -3
  15. package/es/components/button/button_empty/button_empty.js +2 -3
  16. package/es/components/button/button_group/button_group.js +19 -7
  17. package/es/components/button/button_group/button_group.styles.js +11 -14
  18. package/es/components/button/button_group/button_group_button.js +59 -5
  19. package/es/components/button/button_group/button_group_button.styles.js +39 -3
  20. package/es/components/button/button_icon/button_icon.js +4 -5
  21. package/es/components/button/button_icon/button_icon.styles.js +11 -3
  22. package/es/components/datagrid/body/cell/data_grid_cell.js +102 -59
  23. package/es/components/datagrid/body/cell/data_grid_cell_actions.js +24 -18
  24. package/es/components/datagrid/body/cell/data_grid_cell_popover.js +64 -56
  25. package/es/components/datagrid/body/cell/data_grid_cell_wrapper.js +34 -31
  26. package/es/components/datagrid/body/cell/index.js +1 -1
  27. package/es/components/datagrid/body/data_grid_body.js +14 -0
  28. package/es/components/datagrid/body/data_grid_body_custom.js +54 -35
  29. package/es/components/datagrid/body/data_grid_body_virtualized.js +87 -56
  30. package/es/components/datagrid/body/data_grid_row_manager.js +7 -5
  31. package/es/components/datagrid/body/footer/use_data_grid_footer.js +1 -2
  32. package/es/components/datagrid/body/header/data_grid_control_header_cell.js +5 -4
  33. package/es/components/datagrid/body/header/data_grid_header_cell.js +73 -53
  34. package/es/components/datagrid/body/header/data_grid_header_row.js +15 -551
  35. package/es/components/datagrid/body/header/use_data_grid_header.js +7 -6
  36. package/es/components/datagrid/controls/column_selector.js +126 -123
  37. package/es/components/datagrid/controls/column_sorting.js +605 -103
  38. package/es/components/datagrid/controls/column_sorting_draggable.js +24 -22
  39. package/es/components/datagrid/controls/display_selector.js +109 -107
  40. package/es/components/datagrid/data_grid.a11y.js +13 -12
  41. package/es/components/datagrid/data_grid.js +47 -22
  42. package/es/components/datagrid/utils/col_widths.js +12 -8
  43. package/es/components/datagrid/utils/focus.js +10 -8
  44. package/es/components/datagrid/utils/grid_height_width.js +31 -30
  45. package/es/components/datagrid/utils/ref.js +1 -1
  46. package/es/components/datagrid/utils/row_heights.js +2 -2
  47. package/es/components/datagrid/utils/sorting.js +29 -27
  48. package/es/components/date_picker/super_date_picker/super_date_picker.js +9 -0
  49. package/es/components/date_picker/super_date_picker/super_update_button.js +57 -29
  50. package/es/components/facet/facet_button.styles.js +1 -2
  51. package/es/components/flex/flex_grid.js +22 -8
  52. package/es/components/flex/flex_grid.styles.js +13 -6
  53. package/es/components/flex/flex_group.js +10 -11
  54. package/es/components/flex/flex_item.js +9 -11
  55. package/es/components/flex/flex_item.styles.js +107 -122
  56. package/es/components/flyout/flyout.js +16 -18
  57. package/es/components/header/header_breadcrumbs/header_breadcrumbs.js +7 -7
  58. package/es/components/icon/icon.js +13 -16
  59. package/es/components/icon/icon.styles.js +6 -9
  60. package/es/components/link/external_link_icon.js +11 -8
  61. package/es/components/link/link.js +2 -3
  62. package/es/components/link/link.styles.js +4 -10
  63. package/es/components/modal/confirm_modal.js +2 -1
  64. package/es/components/modal/modal.js +12 -3
  65. package/es/components/observer/resize_observer/resize_observer.js +15 -24
  66. package/es/components/page/page_header/page_header_content.js +4 -2
  67. package/es/components/progress/progress.styles.js +2 -2
  68. package/es/components/skeleton/skeleton_circle.js +2 -3
  69. package/es/components/skeleton/skeleton_rectangle.js +2 -3
  70. package/es/components/skeleton/skeleton_text.js +16 -12
  71. package/es/components/skeleton/skeleton_title.js +2 -3
  72. package/es/components/spacer/spacer.js +2 -3
  73. package/es/components/text/text.js +2 -3
  74. package/es/components/text/text_align.js +1 -2
  75. package/es/components/text/text_align.styles.js +5 -7
  76. package/es/components/text/text_color.js +2 -3
  77. package/es/components/title/title.js +2 -3
  78. package/es/components/title/title.styles.js +0 -7
  79. package/es/components/toast/global_toast_list.js +70 -73
  80. package/es/components/toast/toast.js +27 -42
  81. package/es/components/toast/toast.styles.js +2 -17
  82. package/es/global_styling/mixins/_typography.js +17 -6
  83. package/es/services/color/eui_palettes.js +21 -13
  84. package/es/services/color/index.js +1 -1
  85. package/es/services/hooks/index.js +1 -0
  86. package/es/services/hooks/useDeepEqual.js +23 -0
  87. package/es/services/index.js +1 -1
  88. package/es/services/theme/index.js +1 -1
  89. package/es/services/theme/style_memoization.js +47 -14
  90. package/es/themes/amsterdam/global_styling/mixins/button.js +47 -24
  91. package/eui.d.ts +2862 -2748
  92. package/i18ntokens.json +267 -267
  93. package/lib/components/breadcrumbs/_breadcrumb_content.js +372 -0
  94. package/lib/components/breadcrumbs/_breadcrumb_content.styles.js +55 -0
  95. package/lib/components/breadcrumbs/breadcrumb.js +11 -328
  96. package/lib/components/breadcrumbs/breadcrumb.styles.js +5 -29
  97. package/lib/components/breadcrumbs/breadcrumbs.js +7 -5
  98. package/lib/components/breadcrumbs/types.js +5 -0
  99. package/lib/components/button/button_display/_button_display.js +1 -2
  100. package/lib/components/button/button_empty/button_empty.js +1 -2
  101. package/lib/components/button/button_group/button_group.js +18 -6
  102. package/lib/components/button/button_group/button_group.styles.js +11 -14
  103. package/lib/components/button/button_group/button_group_button.js +59 -5
  104. package/lib/components/button/button_group/button_group_button.styles.js +45 -11
  105. package/lib/components/button/button_icon/button_icon.js +3 -4
  106. package/lib/components/button/button_icon/button_icon.styles.js +10 -2
  107. package/lib/components/datagrid/body/cell/data_grid_cell.js +100 -58
  108. package/lib/components/datagrid/body/cell/data_grid_cell_actions.js +24 -18
  109. package/lib/components/datagrid/body/cell/data_grid_cell_popover.js +63 -55
  110. package/lib/components/datagrid/body/cell/data_grid_cell_wrapper.js +34 -31
  111. package/lib/components/datagrid/body/cell/index.js +2 -2
  112. package/lib/components/datagrid/body/data_grid_body.js +14 -0
  113. package/lib/components/datagrid/body/data_grid_body_custom.js +53 -34
  114. package/lib/components/datagrid/body/data_grid_body_virtualized.js +86 -55
  115. package/lib/components/datagrid/body/data_grid_row_manager.js +6 -4
  116. package/lib/components/datagrid/body/footer/use_data_grid_footer.js +1 -2
  117. package/lib/components/datagrid/body/header/data_grid_control_header_cell.js +8 -4
  118. package/lib/components/datagrid/body/header/data_grid_header_cell.js +72 -52
  119. package/lib/components/datagrid/body/header/data_grid_header_row.js +14 -550
  120. package/lib/components/datagrid/body/header/use_data_grid_header.js +7 -6
  121. package/lib/components/datagrid/controls/column_selector.js +126 -123
  122. package/lib/components/datagrid/controls/column_sorting.js +615 -110
  123. package/lib/components/datagrid/controls/column_sorting_draggable.js +27 -22
  124. package/lib/components/datagrid/controls/display_selector.js +109 -107
  125. package/lib/components/datagrid/data_grid.a11y.js +13 -12
  126. package/lib/components/datagrid/data_grid.js +45 -20
  127. package/lib/components/datagrid/utils/col_widths.js +12 -8
  128. package/lib/components/datagrid/utils/focus.js +10 -8
  129. package/lib/components/datagrid/utils/grid_height_width.js +29 -28
  130. package/lib/components/datagrid/utils/ref.js +1 -1
  131. package/lib/components/datagrid/utils/row_heights.js +1 -1
  132. package/lib/components/datagrid/utils/sorting.js +31 -29
  133. package/lib/components/date_picker/super_date_picker/super_date_picker.js +9 -0
  134. package/lib/components/date_picker/super_date_picker/super_update_button.js +57 -29
  135. package/lib/components/facet/facet_button.styles.js +1 -2
  136. package/lib/components/flex/flex_grid.js +23 -7
  137. package/lib/components/flex/flex_grid.styles.js +13 -6
  138. package/lib/components/flex/flex_group.js +10 -10
  139. package/lib/components/flex/flex_item.js +13 -13
  140. package/lib/components/flex/flex_item.styles.js +107 -122
  141. package/lib/components/flyout/flyout.js +16 -18
  142. package/lib/components/header/header_breadcrumbs/header_breadcrumbs.js +7 -7
  143. package/lib/components/icon/icon.js +12 -15
  144. package/lib/components/icon/icon.styles.js +5 -8
  145. package/lib/components/link/external_link_icon.js +10 -7
  146. package/lib/components/link/link.js +1 -2
  147. package/lib/components/link/link.styles.js +6 -14
  148. package/lib/components/modal/confirm_modal.js +2 -1
  149. package/lib/components/modal/modal.js +12 -3
  150. package/lib/components/observer/resize_observer/resize_observer.js +15 -24
  151. package/lib/components/page/page_header/page_header_content.js +4 -2
  152. package/lib/components/progress/progress.styles.js +1 -1
  153. package/lib/components/skeleton/skeleton_circle.js +1 -2
  154. package/lib/components/skeleton/skeleton_rectangle.js +1 -2
  155. package/lib/components/skeleton/skeleton_text.js +18 -11
  156. package/lib/components/skeleton/skeleton_title.js +1 -2
  157. package/lib/components/spacer/spacer.js +1 -2
  158. package/lib/components/text/text.js +1 -2
  159. package/lib/components/text/text_align.js +1 -2
  160. package/lib/components/text/text_align.styles.js +5 -7
  161. package/lib/components/text/text_color.js +1 -2
  162. package/lib/components/title/title.js +1 -2
  163. package/lib/components/title/title.styles.js +2 -10
  164. package/lib/components/toast/global_toast_list.js +68 -71
  165. package/lib/components/toast/toast.js +25 -40
  166. package/lib/components/toast/toast.styles.js +11 -25
  167. package/lib/global_styling/mixins/_typography.js +27 -19
  168. package/lib/services/color/eui_palettes.js +24 -14
  169. package/lib/services/color/index.js +14 -0
  170. package/lib/services/hooks/index.js +11 -0
  171. package/lib/services/hooks/useDeepEqual.js +30 -0
  172. package/lib/services/index.js +15 -1
  173. package/lib/services/theme/index.js +6 -0
  174. package/lib/services/theme/style_memoization.js +49 -16
  175. package/lib/themes/amsterdam/global_styling/mixins/button.js +49 -25
  176. package/optimize/es/components/breadcrumbs/_breadcrumb_content.js +153 -0
  177. package/optimize/es/components/breadcrumbs/_breadcrumb_content.styles.js +48 -0
  178. package/optimize/es/components/breadcrumbs/breadcrumb.js +10 -109
  179. package/optimize/es/components/breadcrumbs/breadcrumb.styles.js +5 -27
  180. package/optimize/es/components/breadcrumbs/breadcrumbs.js +4 -4
  181. package/optimize/es/components/breadcrumbs/types.js +1 -0
  182. package/optimize/es/components/button/button_display/_button_display.js +2 -3
  183. package/optimize/es/components/button/button_empty/button_empty.js +2 -3
  184. package/optimize/es/components/button/button_group/button_group.js +5 -7
  185. package/optimize/es/components/button/button_group/button_group.styles.js +11 -14
  186. package/optimize/es/components/button/button_group/button_group_button.js +36 -4
  187. package/optimize/es/components/button/button_group/button_group_button.styles.js +39 -3
  188. package/optimize/es/components/button/button_icon/button_icon.js +4 -5
  189. package/optimize/es/components/button/button_icon/button_icon.styles.js +8 -3
  190. package/optimize/es/components/datagrid/body/cell/data_grid_cell.js +83 -56
  191. package/optimize/es/components/datagrid/body/cell/data_grid_cell_actions.js +24 -18
  192. package/optimize/es/components/datagrid/body/cell/data_grid_cell_popover.js +64 -56
  193. package/optimize/es/components/datagrid/body/cell/data_grid_cell_wrapper.js +34 -31
  194. package/optimize/es/components/datagrid/body/cell/index.js +1 -1
  195. package/optimize/es/components/datagrid/body/data_grid_body_custom.js +40 -35
  196. package/optimize/es/components/datagrid/body/data_grid_body_virtualized.js +71 -49
  197. package/optimize/es/components/datagrid/body/data_grid_row_manager.js +7 -5
  198. package/optimize/es/components/datagrid/body/footer/use_data_grid_footer.js +1 -2
  199. package/optimize/es/components/datagrid/body/header/data_grid_control_header_cell.js +4 -3
  200. package/optimize/es/components/datagrid/body/header/data_grid_header_cell.js +65 -49
  201. package/optimize/es/components/datagrid/body/header/data_grid_header_row.js +15 -13
  202. package/optimize/es/components/datagrid/body/header/use_data_grid_header.js +7 -6
  203. package/optimize/es/components/datagrid/controls/column_selector.js +126 -123
  204. package/optimize/es/components/datagrid/controls/column_sorting.js +121 -103
  205. package/optimize/es/components/datagrid/controls/column_sorting_draggable.js +24 -22
  206. package/optimize/es/components/datagrid/controls/display_selector.js +109 -107
  207. package/optimize/es/components/datagrid/data_grid.a11y.js +13 -12
  208. package/optimize/es/components/datagrid/data_grid.js +47 -22
  209. package/optimize/es/components/datagrid/utils/col_widths.js +9 -5
  210. package/optimize/es/components/datagrid/utils/focus.js +10 -8
  211. package/optimize/es/components/datagrid/utils/grid_height_width.js +31 -30
  212. package/optimize/es/components/datagrid/utils/ref.js +1 -1
  213. package/optimize/es/components/datagrid/utils/row_heights.js +2 -2
  214. package/optimize/es/components/datagrid/utils/sorting.js +29 -27
  215. package/optimize/es/components/date_picker/super_date_picker/super_update_button.js +49 -29
  216. package/optimize/es/components/facet/facet_button.styles.js +1 -2
  217. package/optimize/es/components/flex/flex_grid.js +19 -8
  218. package/optimize/es/components/flex/flex_grid.styles.js +13 -6
  219. package/optimize/es/components/flex/flex_group.js +9 -10
  220. package/optimize/es/components/flex/flex_item.js +9 -11
  221. package/optimize/es/components/flex/flex_item.styles.js +107 -122
  222. package/optimize/es/components/flyout/flyout.js +16 -18
  223. package/optimize/es/components/header/header_breadcrumbs/header_breadcrumbs.js +3 -5
  224. package/optimize/es/components/icon/icon.js +13 -16
  225. package/optimize/es/components/icon/icon.styles.js +6 -9
  226. package/optimize/es/components/link/external_link_icon.js +11 -8
  227. package/optimize/es/components/link/link.js +2 -3
  228. package/optimize/es/components/link/link.styles.js +4 -10
  229. package/optimize/es/components/modal/confirm_modal.js +2 -1
  230. package/optimize/es/components/modal/modal.js +6 -2
  231. package/optimize/es/components/observer/resize_observer/resize_observer.js +15 -24
  232. package/optimize/es/components/progress/progress.styles.js +2 -2
  233. package/optimize/es/components/skeleton/skeleton_circle.js +2 -3
  234. package/optimize/es/components/skeleton/skeleton_rectangle.js +2 -3
  235. package/optimize/es/components/skeleton/skeleton_text.js +16 -12
  236. package/optimize/es/components/skeleton/skeleton_title.js +2 -3
  237. package/optimize/es/components/spacer/spacer.js +2 -3
  238. package/optimize/es/components/text/text.js +2 -3
  239. package/optimize/es/components/text/text_align.js +1 -2
  240. package/optimize/es/components/text/text_align.styles.js +5 -7
  241. package/optimize/es/components/text/text_color.js +2 -3
  242. package/optimize/es/components/title/title.js +2 -3
  243. package/optimize/es/components/title/title.styles.js +0 -7
  244. package/optimize/es/components/toast/global_toast_list.js +70 -73
  245. package/optimize/es/components/toast/toast.js +27 -42
  246. package/optimize/es/components/toast/toast.styles.js +2 -17
  247. package/optimize/es/global_styling/mixins/_typography.js +14 -6
  248. package/optimize/es/services/color/eui_palettes.js +21 -13
  249. package/optimize/es/services/color/index.js +1 -1
  250. package/optimize/es/services/hooks/index.js +1 -0
  251. package/optimize/es/services/hooks/useDeepEqual.js +23 -0
  252. package/optimize/es/services/index.js +1 -1
  253. package/optimize/es/services/theme/index.js +1 -1
  254. package/optimize/es/services/theme/style_memoization.js +47 -14
  255. package/optimize/es/themes/amsterdam/global_styling/mixins/button.js +47 -24
  256. package/optimize/lib/components/breadcrumbs/_breadcrumb_content.js +163 -0
  257. package/optimize/lib/components/breadcrumbs/_breadcrumb_content.styles.js +55 -0
  258. package/optimize/lib/components/breadcrumbs/breadcrumb.js +10 -112
  259. package/optimize/lib/components/breadcrumbs/breadcrumb.styles.js +5 -29
  260. package/optimize/lib/components/breadcrumbs/breadcrumbs.js +3 -3
  261. package/optimize/lib/components/breadcrumbs/types.js +5 -0
  262. package/optimize/lib/components/button/button_display/_button_display.js +1 -2
  263. package/optimize/lib/components/button/button_empty/button_empty.js +1 -2
  264. package/optimize/lib/components/button/button_group/button_group.js +4 -6
  265. package/optimize/lib/components/button/button_group/button_group.styles.js +11 -14
  266. package/optimize/lib/components/button/button_group/button_group_button.js +37 -5
  267. package/optimize/lib/components/button/button_group/button_group_button.styles.js +45 -11
  268. package/optimize/lib/components/button/button_icon/button_icon.js +3 -4
  269. package/optimize/lib/components/button/button_icon/button_icon.styles.js +8 -2
  270. package/optimize/lib/components/datagrid/body/cell/data_grid_cell.js +81 -55
  271. package/optimize/lib/components/datagrid/body/cell/data_grid_cell_actions.js +24 -18
  272. package/optimize/lib/components/datagrid/body/cell/data_grid_cell_popover.js +63 -55
  273. package/optimize/lib/components/datagrid/body/cell/data_grid_cell_wrapper.js +34 -31
  274. package/optimize/lib/components/datagrid/body/cell/index.js +2 -2
  275. package/optimize/lib/components/datagrid/body/data_grid_body_custom.js +39 -34
  276. package/optimize/lib/components/datagrid/body/data_grid_body_virtualized.js +72 -50
  277. package/optimize/lib/components/datagrid/body/data_grid_row_manager.js +6 -4
  278. package/optimize/lib/components/datagrid/body/footer/use_data_grid_footer.js +1 -2
  279. package/optimize/lib/components/datagrid/body/header/data_grid_control_header_cell.js +8 -4
  280. package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.js +65 -49
  281. package/optimize/lib/components/datagrid/body/header/data_grid_header_row.js +14 -12
  282. package/optimize/lib/components/datagrid/body/header/use_data_grid_header.js +7 -6
  283. package/optimize/lib/components/datagrid/controls/column_selector.js +126 -123
  284. package/optimize/lib/components/datagrid/controls/column_sorting.js +125 -107
  285. package/optimize/lib/components/datagrid/controls/column_sorting_draggable.js +27 -22
  286. package/optimize/lib/components/datagrid/controls/display_selector.js +109 -107
  287. package/optimize/lib/components/datagrid/data_grid.a11y.js +13 -12
  288. package/optimize/lib/components/datagrid/data_grid.js +45 -20
  289. package/optimize/lib/components/datagrid/utils/col_widths.js +9 -5
  290. package/optimize/lib/components/datagrid/utils/focus.js +10 -8
  291. package/optimize/lib/components/datagrid/utils/grid_height_width.js +29 -28
  292. package/optimize/lib/components/datagrid/utils/ref.js +1 -1
  293. package/optimize/lib/components/datagrid/utils/row_heights.js +1 -1
  294. package/optimize/lib/components/datagrid/utils/sorting.js +31 -29
  295. package/optimize/lib/components/date_picker/super_date_picker/super_update_button.js +49 -29
  296. package/optimize/lib/components/facet/facet_button.styles.js +1 -2
  297. package/optimize/lib/components/flex/flex_grid.js +21 -7
  298. package/optimize/lib/components/flex/flex_grid.styles.js +13 -6
  299. package/optimize/lib/components/flex/flex_group.js +9 -9
  300. package/optimize/lib/components/flex/flex_item.js +13 -13
  301. package/optimize/lib/components/flex/flex_item.styles.js +107 -122
  302. package/optimize/lib/components/flyout/flyout.js +16 -18
  303. package/optimize/lib/components/header/header_breadcrumbs/header_breadcrumbs.js +3 -5
  304. package/optimize/lib/components/icon/icon.js +12 -15
  305. package/optimize/lib/components/icon/icon.styles.js +5 -8
  306. package/optimize/lib/components/link/external_link_icon.js +10 -7
  307. package/optimize/lib/components/link/link.js +1 -2
  308. package/optimize/lib/components/link/link.styles.js +6 -14
  309. package/optimize/lib/components/modal/confirm_modal.js +2 -1
  310. package/optimize/lib/components/modal/modal.js +6 -2
  311. package/optimize/lib/components/observer/resize_observer/resize_observer.js +15 -24
  312. package/optimize/lib/components/progress/progress.styles.js +1 -1
  313. package/optimize/lib/components/skeleton/skeleton_circle.js +1 -2
  314. package/optimize/lib/components/skeleton/skeleton_rectangle.js +1 -2
  315. package/optimize/lib/components/skeleton/skeleton_text.js +18 -11
  316. package/optimize/lib/components/skeleton/skeleton_title.js +1 -2
  317. package/optimize/lib/components/spacer/spacer.js +1 -2
  318. package/optimize/lib/components/text/text.js +1 -2
  319. package/optimize/lib/components/text/text_align.js +1 -2
  320. package/optimize/lib/components/text/text_align.styles.js +5 -7
  321. package/optimize/lib/components/text/text_color.js +1 -2
  322. package/optimize/lib/components/title/title.js +1 -2
  323. package/optimize/lib/components/title/title.styles.js +2 -10
  324. package/optimize/lib/components/toast/global_toast_list.js +68 -71
  325. package/optimize/lib/components/toast/toast.js +25 -40
  326. package/optimize/lib/components/toast/toast.styles.js +11 -25
  327. package/optimize/lib/global_styling/mixins/_typography.js +25 -19
  328. package/optimize/lib/services/color/eui_palettes.js +24 -14
  329. package/optimize/lib/services/color/index.js +14 -0
  330. package/optimize/lib/services/hooks/index.js +11 -0
  331. package/optimize/lib/services/hooks/useDeepEqual.js +30 -0
  332. package/optimize/lib/services/index.js +15 -1
  333. package/optimize/lib/services/theme/index.js +6 -0
  334. package/optimize/lib/services/theme/style_memoization.js +49 -16
  335. package/optimize/lib/themes/amsterdam/global_styling/mixins/button.js +49 -26
  336. package/package.json +3 -3
  337. package/src/components/datagrid/_data_grid_data_row.scss +4 -0
  338. package/test-env/components/breadcrumbs/_breadcrumb_content.js +363 -0
  339. package/test-env/components/breadcrumbs/_breadcrumb_content.styles.js +55 -0
  340. package/test-env/components/breadcrumbs/breadcrumb.js +11 -323
  341. package/test-env/components/breadcrumbs/breadcrumb.styles.js +5 -29
  342. package/test-env/components/breadcrumbs/breadcrumbs.js +7 -5
  343. package/test-env/components/breadcrumbs/types.js +5 -0
  344. package/test-env/components/button/button_display/_button_display.js +1 -2
  345. package/test-env/components/button/button_empty/button_empty.js +1 -2
  346. package/test-env/components/button/button_group/button_group.js +18 -6
  347. package/test-env/components/button/button_group/button_group.styles.js +11 -14
  348. package/test-env/components/button/button_group/button_group_button.js +56 -5
  349. package/test-env/components/button/button_group/button_group_button.styles.js +45 -11
  350. package/test-env/components/button/button_icon/button_icon.js +3 -4
  351. package/test-env/components/button/button_icon/button_icon.styles.js +8 -2
  352. package/test-env/components/datagrid/body/cell/data_grid_cell.js +100 -58
  353. package/test-env/components/datagrid/body/cell/data_grid_cell_actions.js +24 -18
  354. package/test-env/components/datagrid/body/cell/data_grid_cell_popover.js +63 -55
  355. package/test-env/components/datagrid/body/cell/data_grid_cell_wrapper.js +34 -31
  356. package/test-env/components/datagrid/body/cell/index.js +2 -2
  357. package/test-env/components/datagrid/body/data_grid_body.js +14 -0
  358. package/test-env/components/datagrid/body/data_grid_body_custom.js +53 -34
  359. package/test-env/components/datagrid/body/data_grid_body_virtualized.js +86 -55
  360. package/test-env/components/datagrid/body/data_grid_row_manager.js +6 -4
  361. package/test-env/components/datagrid/body/footer/use_data_grid_footer.js +1 -2
  362. package/test-env/components/datagrid/body/header/data_grid_control_header_cell.js +8 -4
  363. package/test-env/components/datagrid/body/header/data_grid_header_cell.js +72 -52
  364. package/test-env/components/datagrid/body/header/data_grid_header_row.js +14 -550
  365. package/test-env/components/datagrid/body/header/use_data_grid_header.js +7 -6
  366. package/test-env/components/datagrid/controls/column_selector.js +126 -123
  367. package/test-env/components/datagrid/controls/column_sorting.js +607 -106
  368. package/test-env/components/datagrid/controls/column_sorting_draggable.js +27 -22
  369. package/test-env/components/datagrid/controls/display_selector.js +109 -107
  370. package/test-env/components/datagrid/data_grid.a11y.js +13 -12
  371. package/test-env/components/datagrid/data_grid.js +45 -20
  372. package/test-env/components/datagrid/utils/col_widths.js +9 -5
  373. package/test-env/components/datagrid/utils/focus.js +10 -8
  374. package/test-env/components/datagrid/utils/grid_height_width.js +29 -28
  375. package/test-env/components/datagrid/utils/ref.js +1 -1
  376. package/test-env/components/datagrid/utils/row_heights.js +1 -1
  377. package/test-env/components/datagrid/utils/sorting.js +31 -29
  378. package/test-env/components/date_picker/super_date_picker/super_date_picker.js +9 -0
  379. package/test-env/components/date_picker/super_date_picker/super_update_button.js +57 -29
  380. package/test-env/components/facet/facet_button.styles.js +1 -2
  381. package/test-env/components/flex/flex_grid.js +21 -7
  382. package/test-env/components/flex/flex_grid.styles.js +13 -6
  383. package/test-env/components/flex/flex_group.js +10 -10
  384. package/test-env/components/flex/flex_item.js +13 -13
  385. package/test-env/components/flex/flex_item.styles.js +107 -122
  386. package/test-env/components/header/header_breadcrumbs/header_breadcrumbs.js +7 -7
  387. package/test-env/components/icon/icon.styles.js +5 -8
  388. package/test-env/components/link/external_link_icon.js +10 -7
  389. package/test-env/components/link/link.js +1 -2
  390. package/test-env/components/link/link.styles.js +6 -14
  391. package/test-env/components/modal/confirm_modal.js +2 -1
  392. package/test-env/components/modal/modal.js +12 -3
  393. package/test-env/components/page/page_header/page_header_content.js +4 -2
  394. package/test-env/components/progress/progress.styles.js +1 -1
  395. package/test-env/components/skeleton/skeleton_circle.js +1 -2
  396. package/test-env/components/skeleton/skeleton_rectangle.js +1 -2
  397. package/test-env/components/skeleton/skeleton_text.js +18 -11
  398. package/test-env/components/skeleton/skeleton_title.js +1 -2
  399. package/test-env/components/spacer/spacer.js +1 -2
  400. package/test-env/components/text/text.js +1 -2
  401. package/test-env/components/text/text_align.js +1 -2
  402. package/test-env/components/text/text_align.styles.js +5 -7
  403. package/test-env/components/text/text_color.js +1 -2
  404. package/test-env/components/title/title.js +1 -2
  405. package/test-env/components/title/title.styles.js +2 -10
  406. package/test-env/components/toast/global_toast_list.js +68 -71
  407. package/test-env/components/toast/toast.js +25 -40
  408. package/test-env/components/toast/toast.styles.js +11 -25
  409. package/test-env/global_styling/mixins/_typography.js +25 -19
  410. package/test-env/services/color/eui_palettes.js +24 -14
  411. package/test-env/services/color/index.js +14 -0
  412. package/test-env/services/hooks/index.js +11 -0
  413. package/test-env/services/hooks/useDeepEqual.js +30 -0
  414. package/test-env/services/index.js +15 -1
  415. package/test-env/services/theme/index.js +6 -0
  416. package/test-env/services/theme/style_memoization.js +49 -16
  417. package/test-env/themes/amsterdam/global_styling/mixins/button.js +49 -26
  418. package/src/themes/charts/theme.scss +0 -5
@@ -307,12 +307,14 @@ EuiPageHeaderContent.propTypes = {
307
307
  */
308
308
  "aria-current": _propTypes.default.any,
309
309
  /**
310
- * Creates a breadcrumb that toggles a popover dialog
310
+ * Creates a breadcrumb that toggles a popover dialog. Takes any rendered node(s),
311
+ * or a render function that will pass callback allowing you to close the
312
+ * breadcrumb popover from within your popover content.
311
313
  *
312
314
  * If passed, both `href` and `onClick` will be ignored - the breadcrumb's
313
315
  * click behavior should only trigger a popover.
314
316
  */
315
- popoverContent: _propTypes.default.node,
317
+ popoverContent: _propTypes.default.oneOfType([_propTypes.default.node.isRequired, _propTypes.default.func.isRequired]),
316
318
  /**
317
319
  * Allows customizing the popover if necessary. Accepts any props that
318
320
  * [EuiPopover](/#/layout/popover) accepts, except for props that control state.
@@ -66,7 +66,7 @@ var euiProgressStyles = function euiProgressStyles(_ref3, isNative) {
66
66
  // https://css-tricks.com/html5-progress-element/
67
67
  // Good resource if you need to work in here. There's some gotchas with
68
68
  // dealing with cross-browser progress bars.
69
- native: /*#__PURE__*/(0, _react.css)("display:block;", (0, _global_styling.logicalCSS)('width', '100%'), " appearance:none;border:none;border-radius:", euiTheme.size.s, ";&::-webkit-progress-bar{background-color:", euiTheme.colors.lightShade, ";}", crossBrowserProgressValue('transition: width ${euiTheme.animation.normal} linear;'), ";;label:native;"),
69
+ native: /*#__PURE__*/(0, _react.css)("display:block;", (0, _global_styling.logicalCSS)('width', '100%'), " appearance:none;border:none;border-radius:", euiTheme.size.s, ";&::-webkit-progress-bar{background-color:", euiTheme.colors.lightShade, ";}", _global_styling.euiCanAnimate, "{/* Note: FF/Mozilla doesn't actually support animating the native progress bar\n @see https://bugzilla.mozilla.org/show_bug.cgi?id=662351 */", crossBrowserProgressValue("transition: width ".concat(euiTheme.animation.normal, " linear")), ";};label:native;"),
70
70
  // An indeterminate bar has an unreliable end time. Because of a Firefox animation issue,
71
71
  // we apply this style to a <div> instead of a <progress> element.
72
72
  // See https://css-tricks.com/html5-progress-element/ for more info.
@@ -38,8 +38,7 @@ var EuiSkeletonCircle = function EuiSkeletonCircle(_ref) {
38
38
  ariaWrapperProps = _ref.ariaWrapperProps,
39
39
  children = _ref.children,
40
40
  rest = _objectWithoutProperties(_ref, _excluded);
41
- var euiTheme = (0, _services.useEuiTheme)();
42
- var styles = (0, _skeleton_circle.euiSkeletonCircleStyles)(euiTheme);
41
+ var styles = (0, _services.useEuiMemoizedStyles)(_skeleton_circle.euiSkeletonCircleStyles);
43
42
  var cssStyles = [styles.euiSkeletonCircle, styles[size]];
44
43
  return (0, _react2.jsx)(_skeleton_loading.EuiSkeletonLoading, _extends({
45
44
  isLoading: isLoading,
@@ -50,8 +50,7 @@ var EuiSkeletonRectangle = function EuiSkeletonRectangle(_ref) {
50
50
  ariaWrapperProps = _ref.ariaWrapperProps,
51
51
  children = _ref.children,
52
52
  rest = _objectWithoutProperties(_ref, _excluded);
53
- var euiTheme = (0, _services.useEuiTheme)();
54
- var styles = (0, _skeleton_rectangle.euiSkeletonRectangleStyles)(euiTheme);
53
+ var styles = (0, _services.useEuiMemoizedStyles)(_skeleton_rectangle.euiSkeletonRectangleStyles);
55
54
  var cssStyles = [styles.euiSkeletonRectangle, styles[borderRadius]];
56
55
  return (0, _react2.jsx)(_skeleton_loading.EuiSkeletonLoading, _extends({
57
56
  isLoading: isLoading,
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.LINES = exports.EuiSkeletonText = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
+ var _react = _interopRequireWildcard(require("react"));
8
9
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
10
  var _classnames = _interopRequireDefault(require("classnames"));
10
11
  var _services = require("../../services");
@@ -20,6 +21,8 @@ var _excluded = ["isLoading", "lines", "size", "className", "contentAriaLabel",
20
21
  * Side Public License, v 1.
21
22
  */
22
23
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
26
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
24
27
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
25
28
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
@@ -40,16 +43,20 @@ var EuiSkeletonText = function EuiSkeletonText(_ref) {
40
43
  ariaWrapperProps = _ref.ariaWrapperProps,
41
44
  children = _ref.children,
42
45
  rest = _objectWithoutProperties(_ref, _excluded);
43
- var euiTheme = (0, _services.useEuiTheme)();
44
- var styles = (0, _skeleton_text.euiSkeletonTextStyles)(euiTheme);
45
- var lineCssStyles = [styles.euiSkeletonText, styles[size]];
46
- var lineElements = [];
47
- for (var i = 0; i < lines; i++) {
48
- lineElements.push((0, _react2.jsx)("span", {
49
- key: i,
50
- css: lineCssStyles
51
- }));
52
- }
46
+ var styles = (0, _services.useEuiMemoizedStyles)(_skeleton_text.euiSkeletonTextStyles);
47
+ var cssStyles = (0, _react.useMemo)(function () {
48
+ return [styles.euiSkeletonText, styles[size]];
49
+ }, [styles, size]);
50
+ var lineElements = (0, _react.useMemo)(function () {
51
+ var lineElements = [];
52
+ for (var i = 0; i < lines; i++) {
53
+ lineElements.push((0, _react2.jsx)("span", {
54
+ key: i,
55
+ css: cssStyles
56
+ }));
57
+ }
58
+ return lineElements;
59
+ }, [lines, cssStyles]);
53
60
  return (0, _react2.jsx)(_skeleton_loading.EuiSkeletonLoading, _extends({
54
61
  isLoading: isLoading,
55
62
  loadingContent: (0, _react2.jsx)("span", _extends({
@@ -36,8 +36,7 @@ var EuiSkeletonTitle = function EuiSkeletonTitle(_ref) {
36
36
  ariaWrapperProps = _ref.ariaWrapperProps,
37
37
  children = _ref.children,
38
38
  rest = _objectWithoutProperties(_ref, _excluded);
39
- var euiTheme = (0, _services.useEuiTheme)();
40
- var styles = (0, _skeleton_title.euiSkeletonTitleStyles)(euiTheme);
39
+ var styles = (0, _services.useEuiMemoizedStyles)(_skeleton_title.euiSkeletonTitleStyles);
41
40
  var cssStyles = [styles.euiSkeletonTitle, styles[size]];
42
41
  return (0, _react2.jsx)(_skeleton_loading.EuiSkeletonLoading, _extends({
43
42
  isLoading: isLoading,
@@ -33,8 +33,7 @@ var EuiSpacer = function EuiSpacer(_ref) {
33
33
  _ref$size = _ref.size,
34
34
  size = _ref$size === void 0 ? 'l' : _ref$size,
35
35
  rest = _objectWithoutProperties(_ref, _excluded);
36
- var euiTheme = (0, _services.useEuiTheme)();
37
- var styles = (0, _spacer.euiSpacerStyles)(euiTheme);
36
+ var styles = (0, _services.useEuiMemoizedStyles)(_spacer.euiSpacerStyles);
38
37
  var classes = (0, _classnames.default)('euiSpacer', _defineProperty({}, "euiSpacer--".concat(size), size), className);
39
38
  var cssStyles = [styles.euiSpacer, styles[size]];
40
39
  return (0, _react2.jsx)("div", _extends({
@@ -36,8 +36,7 @@ var EuiText = function EuiText(_ref) {
36
36
  children = _ref.children,
37
37
  className = _ref.className,
38
38
  rest = _objectWithoutProperties(_ref, _excluded);
39
- var euiTheme = (0, _services.useEuiTheme)();
40
- var styles = (0, _text.euiTextStyles)(euiTheme);
39
+ var styles = (0, _services.useEuiMemoizedStyles)(_text.euiTextStyles);
41
40
  var cssStyles = [styles.euiText, !grow ? styles.constrainedWidth : undefined, styles[size]];
42
41
  var classes = (0, _classnames.default)('euiText', className);
43
42
  var text = (0, _react2.jsx)("div", _extends({
@@ -37,8 +37,7 @@ var EuiTextAlign = function EuiTextAlign(_ref) {
37
37
  _ref$cloneElement = _ref.cloneElement,
38
38
  cloneElement = _ref$cloneElement === void 0 ? false : _ref$cloneElement,
39
39
  rest = _objectWithoutProperties(_ref, _excluded);
40
- var styles = (0, _text_align.euiTextAlignStyles)();
41
- var cssStyles = [styles.euiTextAlign, styles[textAlign]];
40
+ var cssStyles = [_text_align.euiTextAlignStyles.euiTextAlign, _text_align.euiTextAlignStyles[textAlign]];
42
41
  var props = _objectSpread({
43
42
  css: cssStyles
44
43
  }, rest);
@@ -14,12 +14,10 @@ var _global_styling = require("../../global_styling");
14
14
  * Side Public License, v 1.
15
15
  */
16
16
 
17
- var euiTextAlignStyles = function euiTextAlignStyles() {
18
- return {
19
- euiTextAlign: /*#__PURE__*/(0, _react.css)(";label:euiTextAlign;"),
20
- left: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalTextAlignCSS)('left'), ";;label:left;"),
21
- right: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalTextAlignCSS)('right'), ";;label:right;"),
22
- center: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalTextAlignCSS)('center'), ";;label:center;")
23
- };
17
+ var euiTextAlignStyles = {
18
+ euiTextAlign: /*#__PURE__*/(0, _react.css)(";label:euiTextAlign;"),
19
+ left: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalTextAlignCSS)('left'), ";;label:left;"),
20
+ right: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalTextAlignCSS)('right'), ";;label:right;"),
21
+ center: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalTextAlignCSS)('center'), ";;label:center;")
24
22
  };
25
23
  exports.euiTextAlignStyles = euiTextAlignStyles;
@@ -41,8 +41,7 @@ var EuiTextColor = function EuiTextColor(_ref) {
41
41
  style = _ref.style,
42
42
  rest = _objectWithoutProperties(_ref, _excluded);
43
43
  var isNamedColor = COLORS.includes(color);
44
- var euiTheme = (0, _services.useEuiTheme)();
45
- var styles = (0, _text_color.euiTextColorStyles)(euiTheme);
44
+ var styles = (0, _services.useEuiMemoizedStyles)(_text_color.euiTextColorStyles);
46
45
  var cssStyles = [styles.euiTextColor, isNamedColor ? styles[color] : styles.customColor];
47
46
 
48
47
  // We're checking if is a custom color.
@@ -36,8 +36,7 @@ var EuiTitle = function EuiTitle(_ref) {
36
36
  className = _ref.className,
37
37
  textTransform = _ref.textTransform,
38
38
  rest = _objectWithoutProperties(_ref, _excluded);
39
- var euiTheme = (0, _services.useEuiTheme)();
40
- var styles = (0, _title.euiTitleStyles)(euiTheme);
39
+ var styles = (0, _services.useEuiMemoizedStyles)(_title.euiTitleStyles);
41
40
  var cssStyles = [styles.euiTitle, textTransform ? styles[textTransform] : undefined, styles[size]];
42
41
  var classes = (0, _classnames.default)('euiTitle', className, children.props.className);
43
42
  var props = _objectSpread({
@@ -4,9 +4,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.useEuiTitle = exports.euiTitleStyles = exports.euiTitle = void 0;
7
+ exports.euiTitleStyles = exports.euiTitle = void 0;
8
8
  var _react = require("@emotion/react");
9
- var _services = require("../../services");
10
9
  var _global_styling = require("../../global_styling");
11
10
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
12
11
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -42,17 +41,10 @@ var euiTitle = function euiTitle(euiThemeContext) {
42
41
  });
43
42
  };
44
43
 
45
- // Hook version
46
- exports.euiTitle = euiTitle;
47
- var useEuiTitle = function useEuiTitle(scale, options) {
48
- var euiTheme = (0, _services.useEuiTheme)();
49
- return euiTitle(euiTheme, scale, options);
50
- };
51
-
52
44
  /**
53
45
  * Styles
54
46
  */
55
- exports.useEuiTitle = useEuiTitle;
47
+ exports.euiTitle = euiTitle;
56
48
  var _ref = process.env.NODE_ENV === "production" ? {
57
49
  name: "1x2qsb1-uppercase",
58
50
  styles: "text-transform:uppercase;label:uppercase;"
@@ -85,10 +85,9 @@ var EuiGlobalToastList = function EuiGlobalToastList(_ref) {
85
85
  var isScrollingAnimationFrame = (0, _react.useRef)(0);
86
86
  var startScrollingAnimationFrame = (0, _react.useRef)(0);
87
87
  var listElement = (0, _react.useRef)(null);
88
- var euiTheme = (0, _services.useEuiTheme)();
89
- var styles = (0, _global_toast_list.euiGlobalToastListStyles)(euiTheme);
88
+ var styles = (0, _services.useEuiMemoizedStyles)(_global_toast_list.euiGlobalToastListStyles);
90
89
  var cssStyles = [styles.euiGlobalToastList, styles[side]];
91
- var startScrollingToBottom = function startScrollingToBottom() {
90
+ var startScrollingToBottom = (0, _react.useCallback)(function () {
92
91
  isScrollingToBottom.current = true;
93
92
  var scrollToBottom = function scrollToBottom() {
94
93
  // Although we cancel the requestAnimationFrame in componentWillUnmount,
@@ -111,8 +110,8 @@ var EuiGlobalToastList = function EuiGlobalToastList(_ref) {
111
110
  }
112
111
  };
113
112
  startScrollingAnimationFrame.current = window.requestAnimationFrame(scrollToBottom);
114
- };
115
- var onMouseEnter = function onMouseEnter() {
113
+ }, []);
114
+ var onMouseEnter = (0, _react.useCallback)(function () {
116
115
  // Stop scrolling to bottom if we're in mid-scroll, because the user wants to interact with
117
116
  // the list.
118
117
  isScrollingToBottom.current = false;
@@ -125,8 +124,8 @@ var EuiGlobalToastList = function EuiGlobalToastList(_ref) {
125
124
  timer.pause();
126
125
  }
127
126
  }
128
- };
129
- var onMouseLeave = function onMouseLeave() {
127
+ }, []);
128
+ var onMouseLeave = (0, _react.useCallback)(function () {
130
129
  isUserInteracting.current = false;
131
130
  for (var _toastId2 in toastIdToTimerMap.current) {
132
131
  if (toastIdToTimerMap.current.hasOwnProperty(_toastId2)) {
@@ -134,8 +133,8 @@ var EuiGlobalToastList = function EuiGlobalToastList(_ref) {
134
133
  timer.resume();
135
134
  }
136
135
  }
137
- };
138
- var onScroll = function onScroll() {
136
+ }, []);
137
+ var onScroll = (0, _react.useCallback)(function () {
139
138
  // Given that this method also gets invoked by the synthetic scroll that happens when a new toast gets added,
140
139
  // we want to evaluate if the scroll bottom has been reached only when the user is interacting with the toast,
141
140
  // this way we always retain the scroll position the user has set despite adding in new toasts.
@@ -143,7 +142,7 @@ var EuiGlobalToastList = function EuiGlobalToastList(_ref) {
143
142
  if (listElement.current && isUserInteracting.current) {
144
143
  isScrolledToBottom.current = listElement.current.scrollHeight - listElement.current.scrollTop === listElement.current.clientHeight;
145
144
  }
146
- };
145
+ }, []);
147
146
  var dismissToast = (0, _react.useCallback)(function (toast) {
148
147
  // Remove the toast after it's done fading out.
149
148
  dismissTimeoutIds.current.push(window.setTimeout(function () {
@@ -166,34 +165,29 @@ var EuiGlobalToastList = function EuiGlobalToastList(_ref) {
166
165
  }
167
166
  });
168
167
  }, [scheduleToastForDismissal, toasts]);
169
- var addListeners = function addListeners() {
170
- if (listElement.current) {
171
- listElement.current.addEventListener('scroll', onScroll);
172
- listElement.current.addEventListener('mouseenter', onMouseEnter);
173
- listElement.current.addEventListener('mouseleave', onMouseLeave);
174
- }
175
- };
176
- var removeListeners = function removeListeners() {
177
- if (listElement.current) {
178
- listElement.current.removeEventListener('scroll', onScroll);
179
- listElement.current.removeEventListener('mouseenter', onMouseEnter);
180
- listElement.current.removeEventListener('mouseleave', onMouseLeave);
181
- }
182
- };
183
168
 
184
169
  // componentDidMount
185
170
  (0, _react.useEffect)(function () {
186
- addListeners();
171
+ var listenerEl = listElement.current;
172
+ if (listenerEl) {
173
+ listenerEl.addEventListener('scroll', onScroll);
174
+ listenerEl.addEventListener('mouseenter', onMouseEnter);
175
+ listenerEl.addEventListener('mouseleave', onMouseLeave);
176
+ }
187
177
 
188
178
  // componentWillUnmount
189
179
  return function () {
180
+ if (listenerEl) {
181
+ listenerEl.removeEventListener('scroll', onScroll);
182
+ listenerEl.removeEventListener('mouseenter', onMouseEnter);
183
+ listenerEl.removeEventListener('mouseleave', onMouseLeave);
184
+ }
190
185
  if (isScrollingAnimationFrame.current !== 0) {
191
186
  window.cancelAnimationFrame(isScrollingAnimationFrame.current);
192
187
  }
193
188
  if (startScrollingAnimationFrame.current !== 0) {
194
189
  window.cancelAnimationFrame(startScrollingAnimationFrame.current);
195
190
  }
196
- removeListeners();
197
191
  dismissTimeoutIds.current.forEach(clearTimeout); // eslint-disable-line react-hooks/exhaustive-deps
198
192
  for (var _toastId3 in toastIdToTimerMap.current) {
199
193
  if (toastIdToTimerMap.current.hasOwnProperty(_toastId3)) {
@@ -202,7 +196,7 @@ var EuiGlobalToastList = function EuiGlobalToastList(_ref) {
202
196
  }
203
197
  }
204
198
  };
205
- }, []); // eslint-disable-line react-hooks/exhaustive-deps
199
+ }, [onMouseEnter, onMouseLeave, onScroll]);
206
200
 
207
201
  // componentDidUpdate
208
202
  (0, _react.useEffect)(function () {
@@ -217,7 +211,7 @@ var EuiGlobalToastList = function EuiGlobalToastList(_ref) {
217
211
  }
218
212
  }
219
213
  prevToasts.current = toasts;
220
- }, [toasts, scheduleAllToastsForDismissal]);
214
+ }, [toasts, scheduleAllToastsForDismissal, startScrollingToBottom]);
221
215
 
222
216
  // Toast dismissal side effect
223
217
  // Ensure the callback has correct state by not enclosing it in `setTimeout`
@@ -238,49 +232,52 @@ var EuiGlobalToastList = function EuiGlobalToastList(_ref) {
238
232
  });
239
233
  }
240
234
  }, [toastToDismiss, dismissToastProp]);
241
- var renderedToasts = toasts.map(function (toast) {
242
- var text = toast.text,
243
- toastLifeTimeMs = toast.toastLifeTimeMs,
244
- rest = _objectWithoutProperties(toast, _excluded2);
245
- var onClose = function onClose() {
246
- return dismissToast(toast);
247
- };
248
- return (0, _react2.jsx)(_global_toast_list_item.EuiGlobalToastListItem, {
249
- key: toast.id,
250
- isDismissed: toastIdToDismissedMap[toast.id]
251
- }, (0, _react2.jsx)(_toast.EuiToast, _extends({
252
- onClose: onClose,
253
- onFocus: onMouseEnter,
254
- onBlur: onMouseLeave
255
- }, rest), text));
256
- });
257
- if (showClearAllButtonAt && toasts.length >= showClearAllButtonAt) {
258
- var dismissAllToasts = function dismissAllToasts() {
259
- toasts.forEach(function (toast) {
260
- return dismissToastProp(toast);
261
- });
262
- onClearAllToasts === null || onClearAllToasts === void 0 ? void 0 : onClearAllToasts();
263
- };
264
- renderedToasts.push((0, _react2.jsx)(_i18n.EuiI18n, {
265
- key: "euiClearAllToasts",
266
- tokens: ['euiGlobalToastList.clearAllToastsButtonAriaLabel', 'euiGlobalToastList.clearAllToastsButtonDisplayText'],
267
- defaults: ['Clear all toast notifications', 'Clear all']
268
- }, function (_ref2) {
269
- var _ref3 = _slicedToArray(_ref2, 2),
270
- clearAllToastsButtonAriaLabel = _ref3[0],
271
- clearAllToastsButtonDisplayText = _ref3[1];
235
+ var renderedToasts = (0, _react.useMemo)(function () {
236
+ return toasts.map(function (toast) {
237
+ var text = toast.text,
238
+ toastLifeTimeMs = toast.toastLifeTimeMs,
239
+ rest = _objectWithoutProperties(toast, _excluded2);
240
+ var onClose = function onClose() {
241
+ return dismissToast(toast);
242
+ };
272
243
  return (0, _react2.jsx)(_global_toast_list_item.EuiGlobalToastListItem, {
273
- isDismissed: false
274
- }, (0, _react2.jsx)(_button.EuiButton, {
275
- fill: true,
276
- color: "text",
277
- onClick: dismissAllToasts,
278
- css: [styles.euiGlobalToastListDismissButton, ";label:EuiGlobalToastList;"],
279
- "aria-label": clearAllToastsButtonAriaLabel,
280
- "data-test-subj": "euiClearAllToastsButton"
281
- }, clearAllToastsButtonDisplayText));
282
- }));
283
- }
244
+ key: toast.id,
245
+ isDismissed: toastIdToDismissedMap[toast.id]
246
+ }, (0, _react2.jsx)(_toast.EuiToast, _extends({
247
+ onClose: onClose,
248
+ onFocus: onMouseEnter,
249
+ onBlur: onMouseLeave
250
+ }, rest), text));
251
+ });
252
+ }, [toasts, toastIdToDismissedMap, dismissToast, onMouseEnter, onMouseLeave]);
253
+ var clearAllButton = (0, _react.useMemo)(function () {
254
+ if (toasts.length && showClearAllButtonAt && toasts.length >= showClearAllButtonAt) {
255
+ return (0, _react2.jsx)(_i18n.EuiI18n, {
256
+ key: "euiClearAllToasts",
257
+ tokens: ['euiGlobalToastList.clearAllToastsButtonAriaLabel', 'euiGlobalToastList.clearAllToastsButtonDisplayText'],
258
+ defaults: ['Clear all toast notifications', 'Clear all']
259
+ }, function (_ref2) {
260
+ var _ref3 = _slicedToArray(_ref2, 2),
261
+ clearAllToastsButtonAriaLabel = _ref3[0],
262
+ clearAllToastsButtonDisplayText = _ref3[1];
263
+ return (0, _react2.jsx)(_global_toast_list_item.EuiGlobalToastListItem, {
264
+ isDismissed: false
265
+ }, (0, _react2.jsx)(_button.EuiButton, {
266
+ fill: true,
267
+ color: "text",
268
+ onClick: function onClick() {
269
+ toasts.forEach(function (toast) {
270
+ return dismissToastProp(toast);
271
+ });
272
+ onClearAllToasts === null || onClearAllToasts === void 0 ? void 0 : onClearAllToasts();
273
+ },
274
+ css: styles.euiGlobalToastListDismissButton,
275
+ "aria-label": clearAllToastsButtonAriaLabel,
276
+ "data-test-subj": "euiClearAllToastsButton"
277
+ }, clearAllToastsButtonDisplayText));
278
+ });
279
+ }
280
+ }, [showClearAllButtonAt, onClearAllToasts, toasts, dismissToastProp, styles]);
284
281
  var classes = (0, _classnames.default)('euiGlobalToastList', className);
285
282
  return (0, _react2.jsx)("div", _extends({
286
283
  "aria-live": "polite",
@@ -288,7 +285,7 @@ var EuiGlobalToastList = function EuiGlobalToastList(_ref) {
288
285
  ref: listElement,
289
286
  css: cssStyles,
290
287
  className: classes
291
- }, rest), renderedToasts);
288
+ }, rest), renderedToasts, clearAllButton);
292
289
  };
293
290
  exports.EuiGlobalToastList = EuiGlobalToastList;
294
291
  EuiGlobalToastList.propTypes = {
@@ -37,47 +37,11 @@ var EuiToast = function EuiToast(_ref) {
37
37
  children = _ref.children,
38
38
  className = _ref.className,
39
39
  rest = _objectWithoutProperties(_ref, _excluded);
40
- var euiTheme = (0, _services.useEuiTheme)();
41
- var baseStyles = (0, _toast.euiToastStyles)(euiTheme);
40
+ var baseStyles = (0, _services.useEuiMemoizedStyles)(_toast.euiToastStyles);
42
41
  var baseCss = [baseStyles.euiToast, color && baseStyles[color]];
43
- var bodyStyles = (0, _toast.euiToastBodyStyles)();
44
- var headerStyles = (0, _toast.euiToastHeaderStyles)(euiTheme);
42
+ var headerStyles = (0, _services.useEuiMemoizedStyles)(_toast.euiToastHeaderStyles);
45
43
  var headerCss = [headerStyles.euiToastHeader, children && headerStyles.withBody];
46
44
  var classes = (0, _classnames.default)('euiToast', className);
47
- var headerIcon;
48
- if (iconType) {
49
- headerIcon = (0, _react2.jsx)(_icon.EuiIcon, {
50
- css: headerStyles.euiToastHeader__icon,
51
- type: iconType,
52
- size: "m",
53
- "aria-hidden": "true"
54
- });
55
- }
56
- var closeButton;
57
- if (onClose) {
58
- closeButton = (0, _react2.jsx)(_i18n.EuiI18n, {
59
- token: "euiToast.dismissToast",
60
- default: "Dismiss toast"
61
- }, function (dismissToast) {
62
- return (0, _react2.jsx)(_button.EuiButtonIcon, {
63
- css: baseStyles.euiToast__closeButton,
64
- iconType: "cross",
65
- color: "text",
66
- size: "xs",
67
- "aria-label": dismissToast,
68
- onClick: onClose,
69
- "data-test-subj": "toastCloseButton"
70
- });
71
- });
72
- }
73
- var optionalBody;
74
- if (children) {
75
- optionalBody = (0, _react2.jsx)(_text.EuiText, {
76
- css: bodyStyles.euiToastBody,
77
- size: "s",
78
- "data-test-subj": "euiToastBody"
79
- }, children);
80
- }
81
45
  return (0, _react2.jsx)("div", _extends({
82
46
  css: baseCss,
83
47
  className: classes
@@ -92,11 +56,32 @@ var EuiToast = function EuiToast(_ref) {
92
56
  css: headerCss,
93
57
  "aria-label": notification,
94
58
  "data-test-subj": "euiToastHeader"
95
- }, headerIcon, (0, _react2.jsx)("span", {
59
+ }, iconType && (0, _react2.jsx)(_icon.EuiIcon, {
60
+ css: headerStyles.euiToastHeader__icon,
61
+ type: iconType,
62
+ size: "m",
63
+ "aria-hidden": "true"
64
+ }), (0, _react2.jsx)("span", {
96
65
  css: headerStyles.euiToastHeader__title,
97
66
  "data-test-subj": "euiToastHeader__title"
98
67
  }, title));
99
- }), closeButton, optionalBody);
68
+ }), onClose && (0, _react2.jsx)(_i18n.EuiI18n, {
69
+ token: "euiToast.dismissToast",
70
+ default: "Dismiss toast"
71
+ }, function (dismissToast) {
72
+ return (0, _react2.jsx)(_button.EuiButtonIcon, {
73
+ css: baseStyles.euiToast__closeButton,
74
+ iconType: "cross",
75
+ color: "text",
76
+ size: "xs",
77
+ "aria-label": dismissToast,
78
+ onClick: onClose,
79
+ "data-test-subj": "toastCloseButton"
80
+ });
81
+ }), children && (0, _react2.jsx)(_text.EuiText, {
82
+ size: "s",
83
+ "data-test-subj": "euiToastBody"
84
+ }, children));
100
85
  };
101
86
  exports.EuiToast = EuiToast;
102
87
  EuiToast.propTypes = {
@@ -3,23 +3,24 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.euiToastStyles = exports.euiToastHeaderStyles = exports.euiToastBodyStyles = void 0;
6
+ exports.euiToastStyles = exports.euiToastHeaderStyles = void 0;
7
7
  var _react = require("@emotion/react");
8
8
  var _global_styling = require("../../global_styling");
9
9
  var _amsterdam = require("../../themes/amsterdam");
10
10
  var _title = require("../title/title.styles");
11
- function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /*
12
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
13
- * or more contributor license agreements. Licensed under the Elastic License
14
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
15
- * in compliance with, at your election, the Elastic License 2.0 or the Server
16
- * Side Public License, v 1.
17
- */
11
+ /*
12
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
13
+ * or more contributor license agreements. Licensed under the Elastic License
14
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
15
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
16
+ * Side Public License, v 1.
17
+ */
18
+
18
19
  var euiToastStyles = function euiToastStyles(euiThemeContext) {
19
20
  var euiTheme = euiThemeContext.euiTheme;
20
21
  return {
21
22
  // Base
22
- euiToast: /*#__PURE__*/(0, _react.css)("border-radius:", euiTheme.border.radius.medium, ";", (0, _amsterdam.euiShadowLarge)(euiThemeContext), " position:relative;", (0, _global_styling.logicalCSS)('padding-horizontal', euiTheme.size.base), " ", (0, _global_styling.logicalCSS)('padding-vertical', euiTheme.size.base), " background-color:", euiTheme.colors.emptyShade, ";", (0, _global_styling.logicalCSS)('width', '100%'), " &:hover,&:focus{[class*='euiToast__closeButton']{opacity:1;}};label:euiToast;"),
23
+ euiToast: /*#__PURE__*/(0, _react.css)("border-radius:", euiTheme.border.radius.medium, ";", (0, _amsterdam.euiShadowLarge)(euiThemeContext), " position:relative;", (0, _global_styling.logicalCSS)('padding-horizontal', euiTheme.size.base), " ", (0, _global_styling.logicalCSS)('padding-vertical', euiTheme.size.base), " background-color:", euiTheme.colors.emptyShade, ";", (0, _global_styling.logicalCSS)('width', '100%'), " ", (0, _global_styling.euiTextBreakWord)(), "&:hover,&:focus{[class*='euiToast__closeButton']{opacity:1;}};label:euiToast;"),
23
24
  // Elements
24
25
  euiToast__closeButton: /*#__PURE__*/(0, _react.css)("position:absolute;", (0, _global_styling.logicalCSS)('top', euiTheme.size.base), " ", (0, _global_styling.logicalCSS)('right', euiTheme.size.base), ";;label:euiToast__closeButton;"),
25
26
  // Variants
@@ -42,19 +43,4 @@ var euiToastHeaderStyles = function euiToastHeaderStyles(euiThemeContext) {
42
43
  withBody: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('margin-bottom', euiTheme.size.s), ";;label:withBody;")
43
44
  };
44
45
  };
45
- exports.euiToastHeaderStyles = euiToastHeaderStyles;
46
- var _ref = process.env.NODE_ENV === "production" ? {
47
- name: "1xv63y1-euiToastBody",
48
- styles: "word-wrap:break-word;label:euiToastBody;"
49
- } : {
50
- name: "1xv63y1-euiToastBody",
51
- styles: "word-wrap:break-word;label:euiToastBody;",
52
- toString: _EMOTION_STRINGIFIED_CSS_ERROR__
53
- };
54
- var euiToastBodyStyles = function euiToastBodyStyles() {
55
- return {
56
- // Base
57
- euiToastBody: _ref
58
- };
59
- };
60
- exports.euiToastBodyStyles = euiToastBodyStyles;
46
+ exports.euiToastHeaderStyles = euiToastHeaderStyles;