@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,22 +11,27 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
11
11
  * in compliance with, at your election, the Elastic License 2.0 or the Server
12
12
  * Side Public License, v 1.
13
13
  */
14
- import { cloneElement } from 'react';
15
- import PropTypes from "prop-types";
16
14
  import classNames from 'classnames';
15
+ import PropTypes from "prop-types";
16
+ import { useEuiTheme } from '../../services';
17
+ import { cloneElementWithCss } from '../../services/theme/clone_element';
18
+ import { euiGlobalToastListItemStyles } from './global_toast_list.styles';
17
19
  export var EuiGlobalToastListItem = function EuiGlobalToastListItem(_ref) {
18
20
  var children = _ref.children,
21
+ className = _ref.className,
19
22
  isDismissed = _ref.isDismissed;
23
+ var euiTheme = useEuiTheme();
20
24
 
21
25
  if (!children) {
22
26
  return null;
23
27
  }
24
28
 
25
- var classes = classNames('euiGlobalToastListItem', children.props.className, {
26
- 'euiGlobalToastListItem-isDismissed': isDismissed
27
- });
28
- return /*#__PURE__*/cloneElement(children, _objectSpread(_objectSpread({}, children.props), {
29
- className: classes
29
+ var styles = euiGlobalToastListItemStyles(euiTheme);
30
+ var cssStyles = [styles.euiGlobalToastListItem, isDismissed && styles.dismissed];
31
+ var classes = classNames('euiGlobalToastListItem', children.props.className, className);
32
+ return cloneElementWithCss(children, _objectSpread(_objectSpread({}, children.props), {
33
+ className: classes,
34
+ css: cssStyles
30
35
  }));
31
36
  };
32
37
  EuiGlobalToastListItem.propTypes = {
@@ -16,19 +16,15 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
16
16
  import React from 'react';
17
17
  import PropTypes from "prop-types";
18
18
  import classNames from 'classnames';
19
- import { keysOf } from '../common';
19
+ import { useEuiTheme } from '../../services';
20
20
  import { EuiScreenReaderOnly } from '../accessibility';
21
+ import { EuiButtonIcon } from '../button';
21
22
  import { EuiI18n } from '../i18n';
22
23
  import { EuiIcon } from '../icon';
23
24
  import { EuiText } from '../text';
25
+ import { euiToastStyles, euiToastBodyStyles, euiToastHeaderStyles } from './toast.styles';
24
26
  import { jsx as ___EmotionJSX } from "@emotion/react";
25
- var colorToClassNameMap = {
26
- primary: 'euiToast--primary',
27
- success: 'euiToast--success',
28
- warning: 'euiToast--warning',
29
- danger: 'euiToast--danger'
30
- };
31
- export var COLORS = keysOf(colorToClassNameMap);
27
+ export var COLORS = ['primary', 'success', 'warning', 'danger'];
32
28
  export var EuiToast = function EuiToast(_ref) {
33
29
  var title = _ref.title,
34
30
  color = _ref.color,
@@ -38,15 +34,18 @@ export var EuiToast = function EuiToast(_ref) {
38
34
  className = _ref.className,
39
35
  rest = _objectWithoutProperties(_ref, _excluded);
40
36
 
41
- var classes = classNames('euiToast', color ? colorToClassNameMap[color] : null, className);
42
- var headerClasses = classNames('euiToastHeader', {
43
- 'euiToastHeader--withBody': children
44
- });
37
+ var euiTheme = useEuiTheme();
38
+ var baseStyles = euiToastStyles(euiTheme);
39
+ var baseCss = [baseStyles.euiToast, color && baseStyles[color]];
40
+ var bodyStyles = euiToastBodyStyles();
41
+ var headerStyles = euiToastHeaderStyles(euiTheme);
42
+ var headerCss = [headerStyles.euiToastHeader, children && headerStyles.withBody];
43
+ var classes = classNames('euiToast', className);
45
44
  var headerIcon;
46
45
 
47
46
  if (iconType) {
48
47
  headerIcon = ___EmotionJSX(EuiIcon, {
49
- className: "euiToastHeader__icon",
48
+ css: headerStyles.euiToastHeader__icon,
50
49
  type: iconType,
51
50
  size: "m",
52
51
  "aria-hidden": "true"
@@ -60,17 +59,15 @@ export var EuiToast = function EuiToast(_ref) {
60
59
  token: "euiToast.dismissToast",
61
60
  default: "Dismiss toast"
62
61
  }, function (dismissToast) {
63
- return ___EmotionJSX("button", {
64
- type: "button",
65
- className: "euiToast__closeButton",
62
+ return ___EmotionJSX(EuiButtonIcon, {
63
+ css: baseStyles.euiToast__closeButton,
64
+ iconType: "cross",
65
+ color: "text",
66
+ size: "xs",
66
67
  "aria-label": dismissToast,
67
68
  onClick: onClose,
68
69
  "data-test-subj": "toastCloseButton"
69
- }, ___EmotionJSX(EuiIcon, {
70
- type: "cross",
71
- size: "m",
72
- "aria-hidden": "true"
73
- }));
70
+ });
74
71
  });
75
72
  }
76
73
 
@@ -78,12 +75,14 @@ export var EuiToast = function EuiToast(_ref) {
78
75
 
79
76
  if (children) {
80
77
  optionalBody = ___EmotionJSX(EuiText, {
78
+ css: bodyStyles.euiToastBody,
81
79
  size: "s",
82
- className: "euiToastBody"
80
+ "data-test-subj": "euiToastBody"
83
81
  }, children);
84
82
  }
85
83
 
86
84
  return ___EmotionJSX("div", _extends({
85
+ css: baseCss,
87
86
  className: classes
88
87
  }, rest), ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("p", null, ___EmotionJSX(EuiI18n, {
89
88
  token: "euiToast.newNotification",
@@ -93,17 +92,18 @@ export var EuiToast = function EuiToast(_ref) {
93
92
  default: "Notification"
94
93
  }, function (notification) {
95
94
  return ___EmotionJSX("div", {
96
- className: headerClasses,
95
+ css: headerCss,
97
96
  "aria-label": notification,
98
97
  "data-test-subj": "euiToastHeader"
99
98
  }, headerIcon, ___EmotionJSX("span", {
100
- className: "euiToastHeader__title"
99
+ css: headerStyles.euiToastHeader__title,
100
+ "data-test-subj": "euiToastHeader__title"
101
101
  }, title));
102
102
  }), closeButton, optionalBody);
103
103
  };
104
104
  EuiToast.propTypes = {
105
105
  title: PropTypes.node,
106
- color: PropTypes.oneOf(["primary", "success", "warning", "danger"]),
106
+ color: PropTypes.any,
107
107
  iconType: PropTypes.oneOfType([PropTypes.oneOf(["accessibility", "addDataApp", "advancedSettingsApp", "agentApp", "aggregate", "alert", "analyzeEvent", "annotation", "apmApp", "apmTrace", "appSearchApp", "apps", "arrowDown", "arrowLeft", "arrowRight", "arrowUp", "arrowStart", "arrowEnd", "asterisk", "auditbeatApp", "beaker", "bell", "bellSlash", "bolt", "boxesHorizontal", "boxesVertical", "branch", "branchUser", "broom", "brush", "bug", "bullseye", "calendar", "canvasApp", "casesApp", "check", "checkInCircleFilled", "cheer", "classificationJob", "clock", "cloudDrizzle", "cloudStormy", "cloudSunny", "cluster", "codeApp", "color", "compute", "console", "consoleApp", "container", "continuityAbove", "continuityAboveBelow", "continuityBelow", "continuityWithin", "controlsHorizontal", "controlsVertical", "copy", "copyClipboard", "createAdvancedJob", "createMultiMetricJob", "createPopulationJob", "createSingleMetricJob", "cross", "crossClusterReplicationApp", "crossInACircleFilled", "crosshairs", "currency", "cut", "dashboardApp", "dataVisualizer", "database", "desktop", "devToolsApp", "discoverApp", "document", "documentEdit", "documentation", "documents", "dot", "doubleArrowLeft", "doubleArrowRight", "download", "editorAlignCenter", "editorAlignLeft", "editorAlignRight", "editorBold", "editorChecklist", "editorCodeBlock", "editorComment", "editorDistributeHorizontal", "editorDistributeVertical", "editorHeading", "editorItalic", "editorItemAlignBottom", "editorItemAlignCenter", "editorItemAlignLeft", "editorItemAlignMiddle", "editorItemAlignRight", "editorItemAlignTop", "editorLink", "editorOrderedList", "editorPositionBottomLeft", "editorPositionBottomRight", "editorPositionTopLeft", "editorPositionTopRight", "editorRedo", "editorStrike", "editorTable", "editorUnderline", "editorUndo", "editorUnorderedList", "email", "empty", "emsApp", "eql", "eraser", "exit", "expand", "expandMini", "exportAction", "eye", "eyeClosed", "faceHappy", "faceNeutral", "faceSad", "filebeatApp", "filter", "flag", "fleetApp", "fold", "folderCheck", "folderClosed", "folderExclamation", "folderOpen", "frameNext", "framePrevious", "fullScreen", "fullScreenExit", "function", "gear", "gisApp", "glasses", "globe", "grab", "grabHorizontal", "graphApp", "grid", "grokApp", "heart", "heartbeatApp", "heatmap", "help", "home", "iInCircle", "image", "importAction", "indexClose", "indexEdit", "indexFlush", "indexManagementApp", "indexMapping", "indexOpen", "indexPatternApp", "indexRollupApp", "indexRuntime", "indexSettings", "inputOutput", "inspect", "invert", "ip", "keyboard", "kqlField", "kqlFunction", "kqlOperand", "kqlSelector", "kqlValue", "kubernetesNode", "kubernetesPod", "layers", "lensApp", "lettering", "lineDashed", "lineDotted", "lineSolid", "link", "list", "listAdd", "lock", "lockOpen", "logoAWS", "logoAWSMono", "logoAerospike", "logoApache", "logoAppSearch", "logoAzure", "logoAzureMono", "logoBeats", "logoBusinessAnalytics", "logoCeph", "logoCloud", "logoCloudEnterprise", "logoCode", "logoCodesandbox", "logoCouchbase", "logoDocker", "logoDropwizard", "logoElastic", "logoElasticStack", "logoElasticsearch", "logoEnterpriseSearch", "logoEtcd", "logoGCP", "logoGCPMono", "logoGithub", "logoGmail", "logoGolang", "logoGoogleG", "logoHAproxy", "logoIBM", "logoIBMMono", "logoKafka", "logoKibana", "logoKubernetes", "logoLogging", "logoLogstash", "logoMaps", "logoMemcached", "logoMetrics", "logoMongodb", "logoMySQL", "logoNginx", "logoObservability", "logoOsquery", "logoPhp", "logoPostgres", "logoPrometheus", "logoRabbitmq", "logoRedis", "logoSecurity", "logoSiteSearch", "logoSketch", "logoSlack", "logoUptime", "logoWebhook", "logoWindows", "logoWorkplaceSearch", "logsApp", "logstashFilter", "logstashIf", "logstashInput", "logstashOutput", "logstashQueue", "machineLearningApp", "magnet", "magnifyWithExclamation", "magnifyWithMinus", "magnifyWithPlus", "managementApp", "mapMarker", "memory", "menu", "menuDown", "menuLeft", "menuRight", "menuUp", "merge", "metricbeatApp", "metricsApp", "minimize", "minus", "minusInCircle", "minusInCircleFilled", "mobile", "monitoringApp", "moon", "namespace", "nested", "node", "notebookApp", "number", "offline", "online", "outlierDetectionJob", "package", "packetbeatApp", "pageSelect", "pagesSelect", "paperClip", "partial", "pause", "payment", "pencil", "percent", "pin", "pinFilled", "pipelineApp", "play", "playFilled", "plus", "plusInCircle", "plusInCircleFilled", "popout", "push", "questionInCircle", "quote", "recentlyViewedApp", "refresh", "regressionJob", "reporter", "reportingApp", "returnKey", "save", "savedObjectsApp", "scale", "search", "searchProfilerApp", "securityAnalyticsApp", "securityApp", "securitySignal", "securitySignalDetected", "securitySignalResolved", "sessionViewer", "shard", "share", "snowflake", "sortDown", "sortLeft", "sortRight", "sortUp", "sortable", "spacesApp", "sqlApp", "starEmpty", "starEmptySpace", "starFilled", "starFilledSpace", "starMinusEmpty", "starMinusFilled", "starPlusEmpty", "starPlusFilled", "stats", "stop", "stopFilled", "stopSlash", "storage", "string", "submodule", "sun", "swatchInput", "symlink", "tableDensityCompact", "tableDensityExpanded", "tableDensityNormal", "tableOfContents", "tag", "tear", "temperature", "timeline", "timelionApp", "timeRefresh", "timeslider", "training", "trash", "unfold", "unlink", "upgradeAssistantApp", "uptimeApp", "user", "userAvatar", "users", "usersRolesApp", "vector", "videoPlayer", "visArea", "visAreaStacked", "visBarHorizontal", "visBarHorizontalStacked", "visBarVertical", "visBarVerticalStacked", "visGauge", "visGoal", "visLine", "visMapCoordinate", "visMapRegion", "visMetric", "visPie", "visTable", "visTagCloud", "visText", "visTimelion", "visVega", "visVisualBuilder", "visualizeApp", "watchesApp", "wordWrap", "wordWrapDisabled", "workplaceSearchApp", "wrench", "tokenAlias", "tokenAnnotation", "tokenArray", "tokenBinary", "tokenBoolean", "tokenClass", "tokenCompletionSuggester", "tokenConstant", "tokenDate", "tokenDenseVector", "tokenElement", "tokenEnum", "tokenEnumMember", "tokenEvent", "tokenException", "tokenField", "tokenFile", "tokenFlattened", "tokenFunction", "tokenGeo", "tokenHistogram", "tokenInterface", "tokenIP", "tokenJoin", "tokenKey", "tokenKeyword", "tokenMethod", "tokenMetricCounter", "tokenMetricGauge", "tokenModule", "tokenNamespace", "tokenNested", "tokenNull", "tokenNumber", "tokenObject", "tokenOperator", "tokenPackage", "tokenParameter", "tokenPercolator", "tokenProperty", "tokenRange", "tokenRankFeature", "tokenRankFeatures", "tokenRepo", "tokenSearchType", "tokenShape", "tokenString", "tokenStruct", "tokenSymbol", "tokenTag", "tokenText", "tokenTokenCount", "tokenVariable"]).isRequired, PropTypes.string.isRequired, PropTypes.elementType.isRequired]),
108
108
  onClose: PropTypes.func,
109
109
  className: PropTypes.string,
@@ -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';
@@ -2,6 +2,12 @@ var _excluded = ["iconType", "color", "fill", "shape", "size", "style", "classNa
2
2
 
3
3
  function _extends() { _extends = Object.assign || 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); }
4
4
 
5
+ 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; }
6
+
7
+ 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; }
8
+
9
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
10
+
5
11
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
6
12
 
7
13
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -26,47 +32,18 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
26
32
  * Side Public License, v 1.
27
33
  */
28
34
  import React from 'react';
29
- import PropTypes from "prop-types";
30
- import defaults from 'lodash/defaults';
31
35
  import classNames from 'classnames';
32
- import { keysOf } from '../common';
33
- import { isColorDark, hexToRgb } from '../../services';
36
+ import { useEuiTheme, isColorDark, hexToRgb } from '../../services';
34
37
  import { EuiIcon } from '../icon';
35
38
  import { TOKEN_MAP } from './token_map';
39
+ import { COLORS } from './token_types';
40
+ import { euiTokenStyles } from './token.styles';
36
41
  import { jsx as ___EmotionJSX } from "@emotion/react";
37
- var sizeToClassMap = {
38
- xs: 'euiToken--xsmall',
39
- s: 'euiToken--small',
40
- m: 'euiToken--medium',
41
- l: 'euiToken--large'
42
- };
43
- export var SIZES = keysOf(sizeToClassMap);
44
- var shapeToClassMap = {
45
- circle: 'euiToken--circle',
46
- square: 'euiToken--square',
47
- rectangle: 'euiToken--rectangle'
48
- };
49
- export var SHAPES = keysOf(shapeToClassMap);
50
- var fillToClassMap = {
51
- none: null,
52
- light: 'euiToken--light',
53
- dark: 'euiToken--dark'
54
- };
55
- export var FILLS = keysOf(fillToClassMap);
56
- var colorToClassMap = {
57
- euiColorVis0: 'euiToken--euiColorVis0',
58
- euiColorVis1: 'euiToken--euiColorVis1',
59
- euiColorVis2: 'euiToken--euiColorVis2',
60
- euiColorVis3: 'euiToken--euiColorVis3',
61
- euiColorVis4: 'euiToken--euiColorVis4',
62
- euiColorVis5: 'euiToken--euiColorVis5',
63
- euiColorVis6: 'euiToken--euiColorVis6',
64
- euiColorVis7: 'euiToken--euiColorVis7',
65
- euiColorVis8: 'euiToken--euiColorVis8',
66
- euiColorVis9: 'euiToken--euiColorVis9',
67
- gray: 'euiToken--gray'
42
+
43
+ var isTokenColor = function isTokenColor(color) {
44
+ return COLORS.includes(color);
68
45
  };
69
- export var COLORS = keysOf(colorToClassMap);
46
+
70
47
  export var EuiToken = function EuiToken(_ref) {
71
48
  var iconType = _ref.iconType,
72
49
  color = _ref.color,
@@ -90,48 +67,48 @@ export var EuiToken = function EuiToken(_ref) {
90
67
 
91
68
  if (typeof iconType === 'string' && iconType.indexOf('token') === 0 && size === 's') {
92
69
  finalSize = 'm';
93
- }
94
-
95
- var currentDisplay = {
96
- color: color,
97
- fill: fill,
98
- shape: shape
99
- };
100
- var finalDisplay; // If the iconType passed is one of the prefab token types,
70
+ } // If the iconType passed is one of the prefab token types,
101
71
  // grab its properties
102
72
 
103
- if (typeof iconType === 'string' && iconType in TOKEN_MAP) {
104
- var tokenDisplay = TOKEN_MAP[iconType];
105
- finalDisplay = defaults(currentDisplay, tokenDisplay);
106
- } else {
107
- finalDisplay = currentDisplay;
108
- }
109
73
 
110
- var finalColor = finalDisplay.color || 'gray';
111
- var finalShape = finalDisplay.shape || 'circle';
112
- var finalFill = finalDisplay.fill || 'light'; // Color can be a named space via euiColorVis
113
-
114
- var colorClass;
115
-
116
- if (finalColor in colorToClassMap) {
117
- colorClass = colorToClassMap[finalColor];
118
- } // Or it can be a string which adds inline styles for the
119
- else {
120
- // text color if fill='none' or
121
- if (finalFill === 'none') {
122
- style.color = finalColor;
123
- } // full background color if fill='dark' and overrides fill='light' with dark
124
- else {
125
- finalFill = 'dark';
126
- style.backgroundColor = finalColor;
127
- style.color = isColorDark.apply(void 0, _toConsumableArray(hexToRgb(finalColor))) ? '#FFFFFF' : '#000000';
128
- }
74
+ var tokenDefaults = typeof iconType === 'string' && iconType in TOKEN_MAP ? TOKEN_MAP[iconType] : {};
75
+ var finalColor = color || tokenDefaults.color || 'gray';
76
+ var finalShape = shape || tokenDefaults.shape || 'circle';
77
+ var finalFill = fill || 'light';
78
+ var euiTheme = useEuiTheme();
79
+ var styles = euiTokenStyles(euiTheme, finalFill);
80
+ var cssStyles = [styles.euiToken, styles[finalShape], styles[finalFill], styles[size]];
81
+ var finalStyle = style;
82
+
83
+ if (isTokenColor(finalColor)) {
84
+ cssStyles = [].concat(_toConsumableArray(cssStyles), [styles[finalColor]]);
85
+ } else if (finalFill === 'none') {
86
+ // When a custom HEX color is passed and the token doesn't have any fill (no background),
87
+ // the icon gets that passed color
88
+ cssStyles = [].concat(_toConsumableArray(cssStyles), [styles.customColor]);
89
+ finalStyle = _objectSpread({
90
+ color: finalColor
91
+ }, style);
92
+ } else {
93
+ // When a custom HEX color is passed and the token has a fill (light or dark),
94
+ // the background gets the custom color and the icon gets white or black based on the passed color
95
+ // The fill='light' (lightened background) will always be overridden by fill='dark' (opaque background)
96
+ // to better handle custom colors
97
+ var isFinalColorDark = isColorDark.apply(void 0, _toConsumableArray(hexToRgb(finalColor)));
98
+ var lightOrDarkColor = isFinalColorDark ? '#FFFFFF' : '#000000';
99
+ cssStyles = [].concat(_toConsumableArray(cssStyles), [styles.customColor]);
100
+ finalFill = 'dark';
101
+ finalStyle = _objectSpread({
102
+ color: lightOrDarkColor,
103
+ backgroundColor: finalColor
104
+ }, style);
129
105
  }
130
106
 
131
- var classes = classNames('euiToken', colorClass, shapeToClassMap[finalShape], fillToClassMap[finalFill], sizeToClassMap[size], className);
107
+ var classes = classNames('euiToken', className);
132
108
  return ___EmotionJSX("span", _extends({
133
109
  className: classes,
134
- style: style
110
+ css: cssStyles,
111
+ style: finalStyle
135
112
  }, rest), ___EmotionJSX(EuiIcon, {
136
113
  type: iconType,
137
114
  size: finalSize,
@@ -140,45 +117,4 @@ export var EuiToken = function EuiToken(_ref) {
140
117
  "aria-labelledby": ariaLabelledby,
141
118
  "aria-describedby": ariaDescribedby
142
119
  }));
143
- };
144
- EuiToken.propTypes = {
145
- className: PropTypes.string,
146
- "aria-label": PropTypes.string,
147
- "data-test-subj": PropTypes.string,
148
-
149
- /**
150
- * An EUI icon type
151
- */
152
- iconType: PropTypes.oneOfType([PropTypes.oneOf(["accessibility", "addDataApp", "advancedSettingsApp", "agentApp", "aggregate", "alert", "analyzeEvent", "annotation", "apmApp", "apmTrace", "appSearchApp", "apps", "arrowDown", "arrowLeft", "arrowRight", "arrowUp", "arrowStart", "arrowEnd", "asterisk", "auditbeatApp", "beaker", "bell", "bellSlash", "bolt", "boxesHorizontal", "boxesVertical", "branch", "branchUser", "broom", "brush", "bug", "bullseye", "calendar", "canvasApp", "casesApp", "check", "checkInCircleFilled", "cheer", "classificationJob", "clock", "cloudDrizzle", "cloudStormy", "cloudSunny", "cluster", "codeApp", "color", "compute", "console", "consoleApp", "container", "continuityAbove", "continuityAboveBelow", "continuityBelow", "continuityWithin", "controlsHorizontal", "controlsVertical", "copy", "copyClipboard", "createAdvancedJob", "createMultiMetricJob", "createPopulationJob", "createSingleMetricJob", "cross", "crossClusterReplicationApp", "crossInACircleFilled", "crosshairs", "currency", "cut", "dashboardApp", "dataVisualizer", "database", "desktop", "devToolsApp", "discoverApp", "document", "documentEdit", "documentation", "documents", "dot", "doubleArrowLeft", "doubleArrowRight", "download", "editorAlignCenter", "editorAlignLeft", "editorAlignRight", "editorBold", "editorChecklist", "editorCodeBlock", "editorComment", "editorDistributeHorizontal", "editorDistributeVertical", "editorHeading", "editorItalic", "editorItemAlignBottom", "editorItemAlignCenter", "editorItemAlignLeft", "editorItemAlignMiddle", "editorItemAlignRight", "editorItemAlignTop", "editorLink", "editorOrderedList", "editorPositionBottomLeft", "editorPositionBottomRight", "editorPositionTopLeft", "editorPositionTopRight", "editorRedo", "editorStrike", "editorTable", "editorUnderline", "editorUndo", "editorUnorderedList", "email", "empty", "emsApp", "eql", "eraser", "exit", "expand", "expandMini", "exportAction", "eye", "eyeClosed", "faceHappy", "faceNeutral", "faceSad", "filebeatApp", "filter", "flag", "fleetApp", "fold", "folderCheck", "folderClosed", "folderExclamation", "folderOpen", "frameNext", "framePrevious", "fullScreen", "fullScreenExit", "function", "gear", "gisApp", "glasses", "globe", "grab", "grabHorizontal", "graphApp", "grid", "grokApp", "heart", "heartbeatApp", "heatmap", "help", "home", "iInCircle", "image", "importAction", "indexClose", "indexEdit", "indexFlush", "indexManagementApp", "indexMapping", "indexOpen", "indexPatternApp", "indexRollupApp", "indexRuntime", "indexSettings", "inputOutput", "inspect", "invert", "ip", "keyboard", "kqlField", "kqlFunction", "kqlOperand", "kqlSelector", "kqlValue", "kubernetesNode", "kubernetesPod", "layers", "lensApp", "lettering", "lineDashed", "lineDotted", "lineSolid", "link", "list", "listAdd", "lock", "lockOpen", "logoAWS", "logoAWSMono", "logoAerospike", "logoApache", "logoAppSearch", "logoAzure", "logoAzureMono", "logoBeats", "logoBusinessAnalytics", "logoCeph", "logoCloud", "logoCloudEnterprise", "logoCode", "logoCodesandbox", "logoCouchbase", "logoDocker", "logoDropwizard", "logoElastic", "logoElasticStack", "logoElasticsearch", "logoEnterpriseSearch", "logoEtcd", "logoGCP", "logoGCPMono", "logoGithub", "logoGmail", "logoGolang", "logoGoogleG", "logoHAproxy", "logoIBM", "logoIBMMono", "logoKafka", "logoKibana", "logoKubernetes", "logoLogging", "logoLogstash", "logoMaps", "logoMemcached", "logoMetrics", "logoMongodb", "logoMySQL", "logoNginx", "logoObservability", "logoOsquery", "logoPhp", "logoPostgres", "logoPrometheus", "logoRabbitmq", "logoRedis", "logoSecurity", "logoSiteSearch", "logoSketch", "logoSlack", "logoUptime", "logoWebhook", "logoWindows", "logoWorkplaceSearch", "logsApp", "logstashFilter", "logstashIf", "logstashInput", "logstashOutput", "logstashQueue", "machineLearningApp", "magnet", "magnifyWithExclamation", "magnifyWithMinus", "magnifyWithPlus", "managementApp", "mapMarker", "memory", "menu", "menuDown", "menuLeft", "menuRight", "menuUp", "merge", "metricbeatApp", "metricsApp", "minimize", "minus", "minusInCircle", "minusInCircleFilled", "mobile", "monitoringApp", "moon", "namespace", "nested", "node", "notebookApp", "number", "offline", "online", "outlierDetectionJob", "package", "packetbeatApp", "pageSelect", "pagesSelect", "paperClip", "partial", "pause", "payment", "pencil", "percent", "pin", "pinFilled", "pipelineApp", "play", "playFilled", "plus", "plusInCircle", "plusInCircleFilled", "popout", "push", "questionInCircle", "quote", "recentlyViewedApp", "refresh", "regressionJob", "reporter", "reportingApp", "returnKey", "save", "savedObjectsApp", "scale", "search", "searchProfilerApp", "securityAnalyticsApp", "securityApp", "securitySignal", "securitySignalDetected", "securitySignalResolved", "sessionViewer", "shard", "share", "snowflake", "sortDown", "sortLeft", "sortRight", "sortUp", "sortable", "spacesApp", "sqlApp", "starEmpty", "starEmptySpace", "starFilled", "starFilledSpace", "starMinusEmpty", "starMinusFilled", "starPlusEmpty", "starPlusFilled", "stats", "stop", "stopFilled", "stopSlash", "storage", "string", "submodule", "sun", "swatchInput", "symlink", "tableDensityCompact", "tableDensityExpanded", "tableDensityNormal", "tableOfContents", "tag", "tear", "temperature", "timeline", "timelionApp", "timeRefresh", "timeslider", "training", "trash", "unfold", "unlink", "upgradeAssistantApp", "uptimeApp", "user", "userAvatar", "users", "usersRolesApp", "vector", "videoPlayer", "visArea", "visAreaStacked", "visBarHorizontal", "visBarHorizontalStacked", "visBarVertical", "visBarVerticalStacked", "visGauge", "visGoal", "visLine", "visMapCoordinate", "visMapRegion", "visMetric", "visPie", "visTable", "visTagCloud", "visText", "visTimelion", "visVega", "visVisualBuilder", "visualizeApp", "watchesApp", "wordWrap", "wordWrapDisabled", "workplaceSearchApp", "wrench", "tokenAlias", "tokenAnnotation", "tokenArray", "tokenBinary", "tokenBoolean", "tokenClass", "tokenCompletionSuggester", "tokenConstant", "tokenDate", "tokenDenseVector", "tokenElement", "tokenEnum", "tokenEnumMember", "tokenEvent", "tokenException", "tokenField", "tokenFile", "tokenFlattened", "tokenFunction", "tokenGeo", "tokenHistogram", "tokenInterface", "tokenIP", "tokenJoin", "tokenKey", "tokenKeyword", "tokenMethod", "tokenMetricCounter", "tokenMetricGauge", "tokenModule", "tokenNamespace", "tokenNested", "tokenNull", "tokenNumber", "tokenObject", "tokenOperator", "tokenPackage", "tokenParameter", "tokenPercolator", "tokenProperty", "tokenRange", "tokenRankFeature", "tokenRankFeatures", "tokenRepo", "tokenSearchType", "tokenShape", "tokenString", "tokenStruct", "tokenSymbol", "tokenTag", "tokenText", "tokenTokenCount", "tokenVariable"]).isRequired, PropTypes.string.isRequired, PropTypes.elementType.isRequired]).isRequired,
153
-
154
- /**
155
- * For best results use one of the vis color names (or 'gray').
156
- * Or supply your own color (can be used with dark or no fill only).
157
- * Default: `gray`
158
- */
159
- color: PropTypes.oneOfType([PropTypes.oneOf(["euiColorVis0", "euiColorVis1", "euiColorVis2", "euiColorVis3", "euiColorVis4", "euiColorVis5", "euiColorVis6", "euiColorVis7", "euiColorVis8", "euiColorVis9", "gray"]).isRequired, PropTypes.string.isRequired]),
160
-
161
- /**
162
- * Outer shape surrounding the icon
163
- * Default: `circle`
164
- */
165
- shape: PropTypes.oneOf(["circle", "square", "rectangle"]),
166
-
167
- /**
168
- * `light` for lightened color with border, `dark` for solid, or `none`
169
- * Default: `light`
170
- */
171
- fill: PropTypes.oneOf(["dark", "light", "none"]),
172
-
173
- /**
174
- * Size of the token
175
- */
176
- size: PropTypes.oneOf(["xs", "s", "m", "l"]),
177
-
178
- /**
179
- * The icon's title. Required for accessibility
180
- */
181
- title: PropTypes.string,
182
- "aria-labelledby": PropTypes.string,
183
- "aria-describedby": PropTypes.string
184
120
  };
@@ -0,0 +1,93 @@
1
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
+
3
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
+
7
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
8
+
9
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
10
+
11
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
12
+
13
+ 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)."; }
14
+
15
+ /*
16
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
17
+ * or more contributor license agreements. Licensed under the Elastic License
18
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
19
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
20
+ * Side Public License, v 1.
21
+ */
22
+ import { css } from '@emotion/react';
23
+ import chroma from 'chroma-js';
24
+ import { logicalCSS, logicalSizeCSS } from '../../global_styling';
25
+ import { euiPaletteColorBlind, euiPaletteColorBlindBehindText, makeHighContrastColor, isColorDark, tint, shade } from '../../services';
26
+ var visColors = euiPaletteColorBlind();
27
+ var visColorsBehindText = euiPaletteColorBlindBehindText();
28
+
29
+ var getTokenColor = function getTokenColor(euiTheme, colorMode, fill, color) {
30
+ var isVizColor = typeof color === 'number';
31
+ var iconColor = isVizColor ? visColors[color] : euiTheme.colors.darkShade;
32
+ var isDarkMode = colorMode === 'DARK';
33
+ var backgroundDarkColor = isVizColor ? visColorsBehindText[color] : euiTheme.colors.darkShade;
34
+ var backgroundLightColor = isDarkMode ? shade(iconColor, 0.7) : tint(iconColor, 0.9);
35
+ var lightColor = makeHighContrastColor(iconColor)(backgroundLightColor);
36
+ var boxShadowColor = isDarkMode ? shade(iconColor, 0.6) : tint(iconColor, 0.7);
37
+ var darkColor = isColorDark.apply(void 0, _toConsumableArray(chroma(backgroundDarkColor).rgb())) ? euiTheme.colors.ghost : euiTheme.colors.ink;
38
+
39
+ switch (fill) {
40
+ case 'none':
41
+ return "\n // Without a background, the fill color should be the graphic color\n color: ".concat(iconColor, ";\n ");
42
+
43
+ case 'light':
44
+ return "\n color: ".concat(lightColor, ";\n background-color: ").concat(backgroundLightColor, ";\n box-shadow: inset 0 0 0 1px ").concat(boxShadowColor, ";\n ");
45
+
46
+ case 'dark':
47
+ return "\n color: ".concat(darkColor, ";\n background-color: ").concat(backgroundDarkColor, ";\n ");
48
+ }
49
+ };
50
+
51
+ var _ref = process.env.NODE_ENV === "production" ? {
52
+ name: "1ab5xb2-circle",
53
+ styles: "border-radius:50%;label:circle;"
54
+ } : {
55
+ name: "1ab5xb2-circle",
56
+ styles: "border-radius:50%;label:circle;",
57
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
58
+ };
59
+
60
+ export var euiTokenStyles = function euiTokenStyles(_ref2, fill) {
61
+ var euiTheme = _ref2.euiTheme,
62
+ colorMode = _ref2.colorMode;
63
+ return {
64
+ // Base
65
+ euiToken: /*#__PURE__*/css("display:inline-flex;align-items:center;justify-content:center;svg{", logicalCSS('height', '100%'), " margin:auto;};label:euiToken;"),
66
+ // Shapes
67
+ circle: _ref,
68
+ square: /*#__PURE__*/css("border-radius:", euiTheme.border.radius.small, ";;label:square;"),
69
+ rectangle: /*#__PURE__*/css("box-sizing:content-box;border-radius:", euiTheme.border.radius.small, ";;label:rectangle;"),
70
+ // Sizes
71
+ 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;"),
72
+ s: /*#__PURE__*/css(logicalSizeCSS(euiTheme.size.base, euiTheme.size.base), ";&[class*='-rectangle']{", logicalCSS('padding-horizontal', euiTheme.size.xs), ";};label:s;"),
73
+ m: /*#__PURE__*/css(logicalSizeCSS(euiTheme.size.l, euiTheme.size.l), ";&[class*='-rectangle']{", logicalCSS('padding-horizontal', euiTheme.size.s), ";};label:m;"),
74
+ l: /*#__PURE__*/css(logicalSizeCSS(euiTheme.size.xl, euiTheme.size.xl), ";&[class*='-rectangle']{", logicalCSS('padding-horizontal', euiTheme.size.s), ";};label:l;"),
75
+ // Colors
76
+ euiColorVis0: /*#__PURE__*/css(getTokenColor(euiTheme, colorMode, fill, 0), ";label:euiColorVis0;"),
77
+ euiColorVis1: /*#__PURE__*/css(getTokenColor(euiTheme, colorMode, fill, 1), ";label:euiColorVis1;"),
78
+ euiColorVis2: /*#__PURE__*/css(getTokenColor(euiTheme, colorMode, fill, 2), ";label:euiColorVis2;"),
79
+ euiColorVis3: /*#__PURE__*/css(getTokenColor(euiTheme, colorMode, fill, 3), ";label:euiColorVis3;"),
80
+ euiColorVis4: /*#__PURE__*/css(getTokenColor(euiTheme, colorMode, fill, 4), ";label:euiColorVis4;"),
81
+ euiColorVis5: /*#__PURE__*/css(getTokenColor(euiTheme, colorMode, fill, 5), ";label:euiColorVis5;"),
82
+ euiColorVis6: /*#__PURE__*/css(getTokenColor(euiTheme, colorMode, fill, 6), ";label:euiColorVis6;"),
83
+ euiColorVis7: /*#__PURE__*/css(getTokenColor(euiTheme, colorMode, fill, 7), ";label:euiColorVis7;"),
84
+ euiColorVis8: /*#__PURE__*/css(getTokenColor(euiTheme, colorMode, fill, 8), ";label:euiColorVis8;"),
85
+ euiColorVis9: /*#__PURE__*/css(getTokenColor(euiTheme, colorMode, fill, 9), ";label:euiColorVis9;"),
86
+ gray: /*#__PURE__*/css(getTokenColor(euiTheme, colorMode, fill, 'gray'), ";label:gray;"),
87
+ customColor: /*#__PURE__*/css(";label:customColor;"),
88
+ // Fills
89
+ light: /*#__PURE__*/css(";label:light;"),
90
+ dark: /*#__PURE__*/css(";label:dark;"),
91
+ none: /*#__PURE__*/css(";label:none;")
92
+ };
93
+ };
@@ -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
  }