@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,19 +11,15 @@ var _excluded = ["title", "color", "iconType", "onClose", "children", "className
11
11
  */
12
12
  import React from 'react';
13
13
  import classNames from 'classnames';
14
- import { keysOf } from '../common';
14
+ import { useEuiTheme } from '../../services';
15
15
  import { EuiScreenReaderOnly } from '../accessibility';
16
+ import { EuiButtonIcon } from '../button';
16
17
  import { EuiI18n } from '../i18n';
17
18
  import { EuiIcon } from '../icon';
18
19
  import { EuiText } from '../text';
20
+ import { euiToastStyles, euiToastBodyStyles, euiToastHeaderStyles } from './toast.styles';
19
21
  import { jsx as ___EmotionJSX } from "@emotion/react";
20
- var colorToClassNameMap = {
21
- primary: 'euiToast--primary',
22
- success: 'euiToast--success',
23
- warning: 'euiToast--warning',
24
- danger: 'euiToast--danger'
25
- };
26
- export var COLORS = keysOf(colorToClassNameMap);
22
+ export var COLORS = ['primary', 'success', 'warning', 'danger'];
27
23
  export var EuiToast = function EuiToast(_ref) {
28
24
  var title = _ref.title,
29
25
  color = _ref.color,
@@ -33,15 +29,18 @@ export var EuiToast = function EuiToast(_ref) {
33
29
  className = _ref.className,
34
30
  rest = _objectWithoutProperties(_ref, _excluded);
35
31
 
36
- var classes = classNames('euiToast', color ? colorToClassNameMap[color] : null, className);
37
- var headerClasses = classNames('euiToastHeader', {
38
- 'euiToastHeader--withBody': children
39
- });
32
+ var euiTheme = useEuiTheme();
33
+ var baseStyles = euiToastStyles(euiTheme);
34
+ var baseCss = [baseStyles.euiToast, color && baseStyles[color]];
35
+ var bodyStyles = euiToastBodyStyles();
36
+ var headerStyles = euiToastHeaderStyles(euiTheme);
37
+ var headerCss = [headerStyles.euiToastHeader, children && headerStyles.withBody];
38
+ var classes = classNames('euiToast', className);
40
39
  var headerIcon;
41
40
 
42
41
  if (iconType) {
43
42
  headerIcon = ___EmotionJSX(EuiIcon, {
44
- className: "euiToastHeader__icon",
43
+ css: headerStyles.euiToastHeader__icon,
45
44
  type: iconType,
46
45
  size: "m",
47
46
  "aria-hidden": "true"
@@ -55,17 +54,15 @@ export var EuiToast = function EuiToast(_ref) {
55
54
  token: "euiToast.dismissToast",
56
55
  default: "Dismiss toast"
57
56
  }, function (dismissToast) {
58
- return ___EmotionJSX("button", {
59
- type: "button",
60
- className: "euiToast__closeButton",
57
+ return ___EmotionJSX(EuiButtonIcon, {
58
+ css: baseStyles.euiToast__closeButton,
59
+ iconType: "cross",
60
+ color: "text",
61
+ size: "xs",
61
62
  "aria-label": dismissToast,
62
63
  onClick: onClose,
63
64
  "data-test-subj": "toastCloseButton"
64
- }, ___EmotionJSX(EuiIcon, {
65
- type: "cross",
66
- size: "m",
67
- "aria-hidden": "true"
68
- }));
65
+ });
69
66
  });
70
67
  }
71
68
 
@@ -73,12 +70,14 @@ export var EuiToast = function EuiToast(_ref) {
73
70
 
74
71
  if (children) {
75
72
  optionalBody = ___EmotionJSX(EuiText, {
73
+ css: bodyStyles.euiToastBody,
76
74
  size: "s",
77
- className: "euiToastBody"
75
+ "data-test-subj": "euiToastBody"
78
76
  }, children);
79
77
  }
80
78
 
81
79
  return ___EmotionJSX("div", _extends({
80
+ css: baseCss,
82
81
  className: classes
83
82
  }, rest), ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("p", null, ___EmotionJSX(EuiI18n, {
84
83
  token: "euiToast.newNotification",
@@ -88,11 +87,12 @@ export var EuiToast = function EuiToast(_ref) {
88
87
  default: "Notification"
89
88
  }, function (notification) {
90
89
  return ___EmotionJSX("div", {
91
- className: headerClasses,
90
+ css: headerCss,
92
91
  "aria-label": notification,
93
92
  "data-test-subj": "euiToastHeader"
94
93
  }, headerIcon, ___EmotionJSX("span", {
95
- className: "euiToastHeader__title"
94
+ css: headerStyles.euiToastHeader__title,
95
+ "data-test-subj": "euiToastHeader__title"
96
96
  }, title));
97
97
  }), closeButton, optionalBody);
98
98
  };
@@ -0,0 +1,55 @@
1
+ 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)."; }
2
+
3
+ /*
4
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
5
+ * or more contributor license agreements. Licensed under the Elastic License
6
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
7
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
8
+ * Side Public License, v 1.
9
+ */
10
+ import { css } from '@emotion/react';
11
+ import { logicalCSS } from '../../global_styling';
12
+ import { euiShadowLarge } from '../../themes/amsterdam';
13
+ import { euiTitle } from '../title/title.styles';
14
+ export var euiToastStyles = function euiToastStyles(euiThemeContext) {
15
+ var euiTheme = euiThemeContext.euiTheme;
16
+ return {
17
+ // Base
18
+ euiToast: /*#__PURE__*/css("border-radius:", euiTheme.border.radius.medium, ";", euiShadowLarge(euiThemeContext), ";position:relative;", logicalCSS('padding-horizontal', euiTheme.size.base), ";", logicalCSS('padding-vertical', euiTheme.size.base), ";background-color:", euiTheme.colors.emptyShade, ";", logicalCSS('width', '100%'), ";&:hover,&:focus{[class*='euiToast__closeButton']{opacity:1;}};label:euiToast;"),
19
+ // Elements
20
+ euiToast__closeButton: /*#__PURE__*/css("position:absolute;", logicalCSS('top', euiTheme.size.base), ";", logicalCSS('right', euiTheme.size.base), ";;label:euiToast__closeButton;"),
21
+ // Variants
22
+ primary: /*#__PURE__*/css("border-top:2px solid ", euiTheme.colors.primary, ";;label:primary;"),
23
+ success: /*#__PURE__*/css("border-top:2px solid ", euiTheme.colors.success, ";;label:success;"),
24
+ warning: /*#__PURE__*/css("border-top:2px solid ", euiTheme.colors.warning, ";;label:warning;"),
25
+ danger: /*#__PURE__*/css("border-top:2px solid ", euiTheme.colors.danger, ";;label:danger;")
26
+ };
27
+ };
28
+ export var euiToastHeaderStyles = function euiToastHeaderStyles(euiThemeContext) {
29
+ var euiTheme = euiThemeContext.euiTheme;
30
+ return {
31
+ // Base
32
+ euiToastHeader: /*#__PURE__*/css(logicalCSS('padding-right', euiTheme.size.l), ";display:flex;align-items:baseline;>*+*{", logicalCSS('margin-left', euiTheme.size.s), ";};label:euiToastHeader;"),
33
+ // Elements
34
+ euiToastHeader__icon: /*#__PURE__*/css("flex:0 0 auto;fill:", euiTheme.colors.title, ";transform:translateY(2px);;label:euiToastHeader__icon;"),
35
+ euiToastHeader__title: /*#__PURE__*/css(euiTitle(euiThemeContext, 'xs'), ";font-weight:", euiTheme.font.weight.bold, ";;label:euiToastHeader__title;"),
36
+ // Variants
37
+ withBody: /*#__PURE__*/css(logicalCSS('margin-bottom', euiTheme.size.s), ";;label:withBody;")
38
+ };
39
+ };
40
+
41
+ var _ref = process.env.NODE_ENV === "production" ? {
42
+ name: "1xv63y1-euiToastBody",
43
+ styles: "word-wrap:break-word;label:euiToastBody;"
44
+ } : {
45
+ name: "1xv63y1-euiToastBody",
46
+ styles: "word-wrap:break-word;label:euiToastBody;",
47
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
48
+ };
49
+
50
+ export var euiToastBodyStyles = function euiToastBodyStyles() {
51
+ return {
52
+ // Base
53
+ euiToastBody: _ref
54
+ };
55
+ };
@@ -5,4 +5,5 @@
5
5
  * in compliance with, at your election, the Elastic License 2.0 or the Server
6
6
  * Side Public License, v 1.
7
7
  */
8
- export { EuiToken, SIZES as TOKEN_SIZES, SHAPES as TOKEN_SHAPES, COLORS as TOKEN_COLORS } from './token';
8
+ export { SIZES as TOKEN_SIZES, SHAPES as TOKEN_SHAPES, COLORS as TOKEN_COLORS } from './token_types';
9
+ export { EuiToken } from './token';
@@ -1,8 +1,13 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
3
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
4
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
5
  var _excluded = ["iconType", "color", "fill", "shape", "size", "style", "className", "title", "aria-label", "aria-labelledby", "aria-describedby"];
5
6
 
7
+ 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; }
8
+
9
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
10
+
6
11
  /*
7
12
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
8
13
  * or more contributor license agreements. Licensed under the Elastic License
@@ -11,46 +16,18 @@ var _excluded = ["iconType", "color", "fill", "shape", "size", "style", "classNa
11
16
  * Side Public License, v 1.
12
17
  */
13
18
  import React from 'react';
14
- import defaults from 'lodash/defaults';
15
19
  import classNames from 'classnames';
16
- import { keysOf } from '../common';
17
- import { isColorDark, hexToRgb } from '../../services';
20
+ import { useEuiTheme, isColorDark, hexToRgb } from '../../services';
18
21
  import { EuiIcon } from '../icon';
19
22
  import { TOKEN_MAP } from './token_map';
23
+ import { COLORS } from './token_types';
24
+ import { euiTokenStyles } from './token.styles';
20
25
  import { jsx as ___EmotionJSX } from "@emotion/react";
21
- var sizeToClassMap = {
22
- xs: 'euiToken--xsmall',
23
- s: 'euiToken--small',
24
- m: 'euiToken--medium',
25
- l: 'euiToken--large'
26
- };
27
- export var SIZES = keysOf(sizeToClassMap);
28
- var shapeToClassMap = {
29
- circle: 'euiToken--circle',
30
- square: 'euiToken--square',
31
- rectangle: 'euiToken--rectangle'
32
- };
33
- export var SHAPES = keysOf(shapeToClassMap);
34
- var fillToClassMap = {
35
- none: null,
36
- light: 'euiToken--light',
37
- dark: 'euiToken--dark'
38
- };
39
- export var FILLS = keysOf(fillToClassMap);
40
- var colorToClassMap = {
41
- euiColorVis0: 'euiToken--euiColorVis0',
42
- euiColorVis1: 'euiToken--euiColorVis1',
43
- euiColorVis2: 'euiToken--euiColorVis2',
44
- euiColorVis3: 'euiToken--euiColorVis3',
45
- euiColorVis4: 'euiToken--euiColorVis4',
46
- euiColorVis5: 'euiToken--euiColorVis5',
47
- euiColorVis6: 'euiToken--euiColorVis6',
48
- euiColorVis7: 'euiToken--euiColorVis7',
49
- euiColorVis8: 'euiToken--euiColorVis8',
50
- euiColorVis9: 'euiToken--euiColorVis9',
51
- gray: 'euiToken--gray'
26
+
27
+ var isTokenColor = function isTokenColor(color) {
28
+ return COLORS.includes(color);
52
29
  };
53
- export var COLORS = keysOf(colorToClassMap);
30
+
54
31
  export var EuiToken = function EuiToken(_ref) {
55
32
  var iconType = _ref.iconType,
56
33
  color = _ref.color,
@@ -74,48 +51,48 @@ export var EuiToken = function EuiToken(_ref) {
74
51
 
75
52
  if (typeof iconType === 'string' && iconType.indexOf('token') === 0 && size === 's') {
76
53
  finalSize = 'm';
77
- }
78
-
79
- var currentDisplay = {
80
- color: color,
81
- fill: fill,
82
- shape: shape
83
- };
84
- var finalDisplay; // If the iconType passed is one of the prefab token types,
54
+ } // If the iconType passed is one of the prefab token types,
85
55
  // grab its properties
86
56
 
87
- if (typeof iconType === 'string' && iconType in TOKEN_MAP) {
88
- var tokenDisplay = TOKEN_MAP[iconType];
89
- finalDisplay = defaults(currentDisplay, tokenDisplay);
90
- } else {
91
- finalDisplay = currentDisplay;
92
- }
93
-
94
- var finalColor = finalDisplay.color || 'gray';
95
- var finalShape = finalDisplay.shape || 'circle';
96
- var finalFill = finalDisplay.fill || 'light'; // Color can be a named space via euiColorVis
97
57
 
98
- var colorClass;
58
+ var tokenDefaults = typeof iconType === 'string' && iconType in TOKEN_MAP ? TOKEN_MAP[iconType] : {};
59
+ var finalColor = color || tokenDefaults.color || 'gray';
60
+ var finalShape = shape || tokenDefaults.shape || 'circle';
61
+ var finalFill = fill || 'light';
62
+ var euiTheme = useEuiTheme();
63
+ var styles = euiTokenStyles(euiTheme, finalFill);
64
+ var cssStyles = [styles.euiToken, styles[finalShape], styles[finalFill], styles[size]];
65
+ var finalStyle = style;
99
66
 
100
- if (finalColor in colorToClassMap) {
101
- colorClass = colorToClassMap[finalColor];
102
- } // Or it can be a string which adds inline styles for the
103
- else {
104
- // text color if fill='none' or
105
- if (finalFill === 'none') {
106
- style.color = finalColor;
107
- } // full background color if fill='dark' and overrides fill='light' with dark
108
- else {
109
- finalFill = 'dark';
110
- style.backgroundColor = finalColor;
111
- style.color = isColorDark.apply(void 0, _toConsumableArray(hexToRgb(finalColor))) ? '#FFFFFF' : '#000000';
112
- }
67
+ if (isTokenColor(finalColor)) {
68
+ cssStyles = [].concat(_toConsumableArray(cssStyles), [styles[finalColor]]);
69
+ } else if (finalFill === 'none') {
70
+ // When a custom HEX color is passed and the token doesn't have any fill (no background),
71
+ // the icon gets that passed color
72
+ cssStyles = [].concat(_toConsumableArray(cssStyles), [styles.customColor]);
73
+ finalStyle = _objectSpread({
74
+ color: finalColor
75
+ }, style);
76
+ } else {
77
+ // When a custom HEX color is passed and the token has a fill (light or dark),
78
+ // the background gets the custom color and the icon gets white or black based on the passed color
79
+ // The fill='light' (lightened background) will always be overridden by fill='dark' (opaque background)
80
+ // to better handle custom colors
81
+ var isFinalColorDark = isColorDark.apply(void 0, _toConsumableArray(hexToRgb(finalColor)));
82
+ var lightOrDarkColor = isFinalColorDark ? '#FFFFFF' : '#000000';
83
+ cssStyles = [].concat(_toConsumableArray(cssStyles), [styles.customColor]);
84
+ finalFill = 'dark';
85
+ finalStyle = _objectSpread({
86
+ color: lightOrDarkColor,
87
+ backgroundColor: finalColor
88
+ }, style);
113
89
  }
114
90
 
115
- var classes = classNames('euiToken', colorClass, shapeToClassMap[finalShape], fillToClassMap[finalFill], sizeToClassMap[size], className);
91
+ var classes = classNames('euiToken', className);
116
92
  return ___EmotionJSX("span", _extends({
117
93
  className: classes,
118
- style: style
94
+ css: cssStyles,
95
+ style: finalStyle
119
96
  }, rest), ___EmotionJSX(EuiIcon, {
120
97
  type: iconType,
121
98
  size: finalSize,
@@ -0,0 +1,83 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+
3
+ 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)."; }
4
+
5
+ /*
6
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
7
+ * or more contributor license agreements. Licensed under the Elastic License
8
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
9
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
10
+ * Side Public License, v 1.
11
+ */
12
+ import { css } from '@emotion/react';
13
+ import chroma from 'chroma-js';
14
+ import { logicalCSS, logicalSizeCSS } from '../../global_styling';
15
+ import { euiPaletteColorBlind, euiPaletteColorBlindBehindText, makeHighContrastColor, isColorDark, tint, shade } from '../../services';
16
+ var visColors = euiPaletteColorBlind();
17
+ var visColorsBehindText = euiPaletteColorBlindBehindText();
18
+
19
+ var getTokenColor = function getTokenColor(euiTheme, colorMode, fill, color) {
20
+ var isVizColor = typeof color === 'number';
21
+ var iconColor = isVizColor ? visColors[color] : euiTheme.colors.darkShade;
22
+ var isDarkMode = colorMode === 'DARK';
23
+ var backgroundDarkColor = isVizColor ? visColorsBehindText[color] : euiTheme.colors.darkShade;
24
+ var backgroundLightColor = isDarkMode ? shade(iconColor, 0.7) : tint(iconColor, 0.9);
25
+ var lightColor = makeHighContrastColor(iconColor)(backgroundLightColor);
26
+ var boxShadowColor = isDarkMode ? shade(iconColor, 0.6) : tint(iconColor, 0.7);
27
+ var darkColor = isColorDark.apply(void 0, _toConsumableArray(chroma(backgroundDarkColor).rgb())) ? euiTheme.colors.ghost : euiTheme.colors.ink;
28
+
29
+ switch (fill) {
30
+ case 'none':
31
+ return "\n // Without a background, the fill color should be the graphic color\n color: ".concat(iconColor, ";\n ");
32
+
33
+ case 'light':
34
+ return "\n color: ".concat(lightColor, ";\n background-color: ").concat(backgroundLightColor, ";\n box-shadow: inset 0 0 0 1px ").concat(boxShadowColor, ";\n ");
35
+
36
+ case 'dark':
37
+ return "\n color: ".concat(darkColor, ";\n background-color: ").concat(backgroundDarkColor, ";\n ");
38
+ }
39
+ };
40
+
41
+ var _ref = process.env.NODE_ENV === "production" ? {
42
+ name: "1ab5xb2-circle",
43
+ styles: "border-radius:50%;label:circle;"
44
+ } : {
45
+ name: "1ab5xb2-circle",
46
+ styles: "border-radius:50%;label:circle;",
47
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
48
+ };
49
+
50
+ export var euiTokenStyles = function euiTokenStyles(_ref2, fill) {
51
+ var euiTheme = _ref2.euiTheme,
52
+ colorMode = _ref2.colorMode;
53
+ return {
54
+ // Base
55
+ euiToken: /*#__PURE__*/css("display:inline-flex;align-items:center;justify-content:center;svg{", logicalCSS('height', '100%'), " margin:auto;};label:euiToken;"),
56
+ // Shapes
57
+ circle: _ref,
58
+ square: /*#__PURE__*/css("border-radius:", euiTheme.border.radius.small, ";;label:square;"),
59
+ rectangle: /*#__PURE__*/css("box-sizing:content-box;border-radius:", euiTheme.border.radius.small, ";;label:rectangle;"),
60
+ // Sizes
61
+ xs: /*#__PURE__*/css(logicalSizeCSS(euiTheme.size.s, euiTheme.size.s), ";&[class*='-square']{border-radius:calc(", euiTheme.border.radius.small, " / 2);}&[class*='-rectangle']{", logicalCSS('padding-vertical', '1px'), ";", logicalCSS('padding-horizontal', euiTheme.size.xs), ";border-radius:calc(", euiTheme.border.radius.small, " / 2);};label:xs;"),
62
+ s: /*#__PURE__*/css(logicalSizeCSS(euiTheme.size.base, euiTheme.size.base), ";&[class*='-rectangle']{", logicalCSS('padding-horizontal', euiTheme.size.xs), ";};label:s;"),
63
+ m: /*#__PURE__*/css(logicalSizeCSS(euiTheme.size.l, euiTheme.size.l), ";&[class*='-rectangle']{", logicalCSS('padding-horizontal', euiTheme.size.s), ";};label:m;"),
64
+ l: /*#__PURE__*/css(logicalSizeCSS(euiTheme.size.xl, euiTheme.size.xl), ";&[class*='-rectangle']{", logicalCSS('padding-horizontal', euiTheme.size.s), ";};label:l;"),
65
+ // Colors
66
+ euiColorVis0: /*#__PURE__*/css(getTokenColor(euiTheme, colorMode, fill, 0), ";label:euiColorVis0;"),
67
+ euiColorVis1: /*#__PURE__*/css(getTokenColor(euiTheme, colorMode, fill, 1), ";label:euiColorVis1;"),
68
+ euiColorVis2: /*#__PURE__*/css(getTokenColor(euiTheme, colorMode, fill, 2), ";label:euiColorVis2;"),
69
+ euiColorVis3: /*#__PURE__*/css(getTokenColor(euiTheme, colorMode, fill, 3), ";label:euiColorVis3;"),
70
+ euiColorVis4: /*#__PURE__*/css(getTokenColor(euiTheme, colorMode, fill, 4), ";label:euiColorVis4;"),
71
+ euiColorVis5: /*#__PURE__*/css(getTokenColor(euiTheme, colorMode, fill, 5), ";label:euiColorVis5;"),
72
+ euiColorVis6: /*#__PURE__*/css(getTokenColor(euiTheme, colorMode, fill, 6), ";label:euiColorVis6;"),
73
+ euiColorVis7: /*#__PURE__*/css(getTokenColor(euiTheme, colorMode, fill, 7), ";label:euiColorVis7;"),
74
+ euiColorVis8: /*#__PURE__*/css(getTokenColor(euiTheme, colorMode, fill, 8), ";label:euiColorVis8;"),
75
+ euiColorVis9: /*#__PURE__*/css(getTokenColor(euiTheme, colorMode, fill, 9), ";label:euiColorVis9;"),
76
+ gray: /*#__PURE__*/css(getTokenColor(euiTheme, colorMode, fill, 'gray'), ";label:gray;"),
77
+ customColor: /*#__PURE__*/css(";label:customColor;"),
78
+ // Fills
79
+ light: /*#__PURE__*/css(";label:light;"),
80
+ dark: /*#__PURE__*/css(";label:dark;"),
81
+ none: /*#__PURE__*/css(";label:none;")
82
+ };
83
+ };
@@ -77,9 +77,8 @@ export var TOKEN_MAP = {
77
77
  color: 'euiColorVis0'
78
78
  },
79
79
  tokenFile: {
80
- shape: 'rectangle',
81
- color: 'gray',
82
- fill: 'dark'
80
+ shape: 'square',
81
+ color: 'euiColorVis2'
83
82
  },
84
83
  tokenFlattened: {
85
84
  shape: 'square',
@@ -186,9 +185,8 @@ export var TOKEN_MAP = {
186
185
  color: 'euiColorVis3'
187
186
  },
188
187
  tokenRepo: {
189
- shape: 'rectangle',
190
- color: 'euiColorVis1',
191
- fill: 'dark'
188
+ shape: 'square',
189
+ color: 'euiColorVis1'
192
190
  },
193
191
  tokenSearchType: {
194
192
  shape: 'square',
@@ -207,9 +205,8 @@ export var TOKEN_MAP = {
207
205
  color: 'euiColorVis0'
208
206
  },
209
207
  tokenSymbol: {
210
- shape: 'rectangle',
211
- color: 'euiColorVis0',
212
- fill: 'dark'
208
+ shape: 'square',
209
+ color: 'euiColorVis0'
213
210
  },
214
211
  tokenTag: {
215
212
  shape: 'square',
@@ -0,0 +1,11 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
5
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
6
+ * Side Public License, v 1.
7
+ */
8
+ export var SIZES = ['xs', 's', 'm', 'l'];
9
+ export var SHAPES = ['circle', 'square', 'rectangle'];
10
+ export var FILLS = ['light', 'dark', 'none'];
11
+ export var COLORS = ['euiColorVis0', 'euiColorVis1', 'euiColorVis2', 'euiColorVis3', 'euiColorVis4', 'euiColorVis5', 'euiColorVis6', 'euiColorVis7', 'euiColorVis8', 'euiColorVis9', 'gray'];
@@ -42,7 +42,7 @@ export var EuiGlobalStyles = function EuiGlobalStyles(_ref) {
42
42
  * Final styles
43
43
  */
44
44
 
45
- var styles = /*#__PURE__*/css(reset, " html{", scrollbarStyles, " ", fontReset, " text-size-adjust:100%;font-kerning:normal;height:100%;background-color:", colors.body, ";color:", colors.text, ";}code,pre,kbd,samp{font-family:", font.familyCode, ";}input,textarea,select{", fontReset, ";}button{font-family:", font.family, ";}em{font-style:italic;}strong{font-weight:", font.weight.bold, ";}*:focus{", euiFocusRing(euiTheme), ";}::selection{background:", transparentize(colors.primary, colorMode === 'LIGHT' ? 0.1 : 0.2), ";}a{color:", colors.primaryText, ";&,&:hover,&:focus{text-decoration:none;}};label:styles;");
45
+ var styles = /*#__PURE__*/css(reset, " html{", scrollbarStyles, " ", fontReset, " text-size-adjust:100%;font-kerning:normal;height:100%;background-color:", colors.body, ";color:", colors.text, ";}code,pre,kbd,samp{font-family:", font.familyCode, ";}input,textarea,select{", fontReset, ";}button{font-family:", font.family, ";}em{font-style:italic;}strong{font-weight:", font.weight.bold, ";}*:focus{", euiFocusRing(euiTheme), ";}::selection{background:", transparentize(colors.primary, colorMode === 'LIGHT' ? 0.1 : 0.2), ";}a{color:", colors.primaryText, ";&,&:hover,&:focus{text-decoration:none;}}.euiBody-hasPortalContent{position:relative;};label:styles;");
46
46
  return ___EmotionJSX(Global, {
47
47
  styles: styles
48
48
  });
@@ -5,14 +5,9 @@
5
5
  * in compliance with, at your election, the Elastic License 2.0 or the Server
6
6
  * Side Public License, v 1.
7
7
  */
8
- import { keysOf } from '../components/common';
9
- export var BREAKPOINTS = {
10
- xl: 1200,
11
- l: 992,
12
- m: 768,
13
- s: 575,
14
- xs: 0
15
- };
8
+ import { keysOf } from '../../components/common';
9
+ import { breakpoint } from '../../themes/amsterdam/global_styling/variables/_breakpoint';
10
+ export var BREAKPOINTS = breakpoint;
16
11
  export var BREAKPOINT_KEYS = keysOf(BREAKPOINTS);
17
12
  /**
18
13
  * Given the current `width` and an object of `EuiBreakpoints`,
@@ -27,7 +22,7 @@ export var BREAKPOINT_KEYS = keysOf(BREAKPOINTS);
27
22
  export function getBreakpoint(width) {
28
23
  var breakpoints = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : BREAKPOINTS;
29
24
  // Find the breakpoint (key) whose value is <= windowWidth starting with largest first
30
- return keysOf(BREAKPOINTS).find(function (key) {
25
+ return BREAKPOINT_KEYS.find(function (key) {
31
26
  return breakpoints[key] <= width;
32
27
  });
33
28
  }
@@ -0,0 +1,53 @@
1
+ import _typeof from "@babel/runtime/helpers/typeof";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+
4
+ /*
5
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
6
+ * or more contributor license agreements. Licensed under the Elastic License
7
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
8
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
9
+ * Side Public License, v 1.
10
+ */
11
+ import React, { createContext, useContext, useState, useEffect } from 'react';
12
+ import { useEuiTheme } from '../theme';
13
+ import { throttle } from '../throttle';
14
+ import { getBreakpoint } from './breakpoint';
15
+ import { jsx as ___EmotionJSX } from "@emotion/react";
16
+ export var CurrentEuiBreakpointContext = /*#__PURE__*/createContext(undefined);
17
+ /**
18
+ * Top level provider (nested within EuiProvider) which provides a single
19
+ * resize listener that returns the current breakpoint based on window width
20
+ */
21
+
22
+ export var CurrentEuiBreakpointProvider = function CurrentEuiBreakpointProvider(_ref) {
23
+ var children = _ref.children;
24
+
25
+ var _useEuiTheme = useEuiTheme(),
26
+ breakpoints = _useEuiTheme.euiTheme.breakpoint;
27
+
28
+ var _useState = useState((typeof window === "undefined" ? "undefined" : _typeof(window)) !== undefined ? getBreakpoint(window.innerWidth, breakpoints) : undefined),
29
+ _useState2 = _slicedToArray(_useState, 2),
30
+ currentBreakpoint = _useState2[0],
31
+ setCurrentBreakpoint = _useState2[1];
32
+
33
+ useEffect(function () {
34
+ var onWindowResize = throttle(function () {
35
+ setCurrentBreakpoint(getBreakpoint(window.innerWidth, breakpoints));
36
+ }, 50);
37
+ window.addEventListener('resize', onWindowResize);
38
+ return function () {
39
+ return window.removeEventListener('resize', onWindowResize);
40
+ };
41
+ }, [breakpoints]);
42
+ return ___EmotionJSX(CurrentEuiBreakpointContext.Provider, {
43
+ value: currentBreakpoint
44
+ }, children);
45
+ };
46
+ /**
47
+ * Hook util / syntactical sugar
48
+ */
49
+
50
+ export var useCurrentEuiBreakpoint = function useCurrentEuiBreakpoint() {
51
+ var currentBreakpoint = useContext(CurrentEuiBreakpointContext);
52
+ return currentBreakpoint;
53
+ };
@@ -0,0 +1,10 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
5
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
6
+ * Side Public License, v 1.
7
+ */
8
+ export * from './breakpoint';
9
+ export * from './currentEuiBreakpoint';
10
+ export * from './useIsWithinBreakpoints';
@@ -0,0 +1,24 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
5
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
6
+ * Side Public License, v 1.
7
+ */
8
+ import { useCurrentEuiBreakpoint } from './currentEuiBreakpoint';
9
+ /**
10
+ * Given the current window.innerWidth and an array of breakpoint keys,
11
+ * this hook stores state and returns true or false if the window.innerWidth
12
+ * falls within any of the named breakpoints.
13
+ *
14
+ * @param {_EuiThemeBreakpoint[]} sizes An array of named EUI breakpoints
15
+ * @param {boolean} isResponsive Some components have the option to turn off responsive behavior.
16
+ * Since hooks can't be called conditionally, it's easier to pass the condition into the hook
17
+ * @returns {boolean} Returns `true` if current breakpoint name is included in `sizes`
18
+ */
19
+
20
+ export var useIsWithinBreakpoints = function useIsWithinBreakpoints(sizes) {
21
+ var isResponsive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
22
+ var currentBreakpoint = useCurrentEuiBreakpoint();
23
+ return currentBreakpoint && isResponsive ? sizes.includes(currentBreakpoint) : false;
24
+ };
@@ -8,7 +8,6 @@
8
8
  export * from './useDependentState';
9
9
  export * from './useCombinedRefs';
10
10
  export * from './useForceRender';
11
- export * from './useIsWithinBreakpoints';
12
11
  export * from './useLatest';
13
12
  export * from './useMouseMove';
14
13
  export * from './useUpdateEffect';
@@ -10,7 +10,7 @@ import * as keys from './keys';
10
10
  export { keys };
11
11
  export { accessibleClickKeys, cascadingMenuKeys, comboBoxKeys, htmlIdGenerator, useGeneratedHtmlId } from './accessibility';
12
12
  export { LEFT_ALIGNMENT, RIGHT_ALIGNMENT, CENTER_ALIGNMENT } from './alignment';
13
- export { BREAKPOINTS, BREAKPOINT_KEYS, getBreakpoint, isWithinBreakpoints, isWithinMaxBreakpoint, isWithinMinBreakpoint } from './breakpoint';
13
+ export { BREAKPOINTS, BREAKPOINT_KEYS, getBreakpoint, isWithinBreakpoints, useIsWithinBreakpoints, isWithinMaxBreakpoint, isWithinMinBreakpoint, CurrentEuiBreakpointContext, CurrentEuiBreakpointProvider, useCurrentEuiBreakpoint } from './breakpoint';
14
14
  export { isColorDark, isValidHex, calculateContrast, calculateLuminance, hexToHsv, hexToRgb, hsvToHex, hsvToRgb, rgbToHex, rgbToHsv, VISUALIZATION_COLORS, DEFAULT_VISUALIZATION_COLOR, colorPalette, euiPaletteForLightBackground, euiPaletteForDarkBackground, euiPaletteColorBlind, euiPaletteColorBlindBehindText, euiPaletteForStatus, euiPaletteForTemperature, euiPaletteComplimentary, euiPaletteNegative, euiPalettePositive, euiPaletteCool, euiPaletteWarm, euiPaletteGray, getSteppedGradient, transparentize, tint, shade, tintOrShade, shadeOrTint, saturate, desaturate, lightness, makeHighContrastColor, makeDisabledContrastColor } from './color';
15
15
  export { useColorPickerState, useColorStopsState } from './color_picker';
16
16
  export * from './console';