@elastic/eui 62.0.3 → 62.2.1

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 (306) hide show
  1. package/dist/eui_theme_dark.css +1 -783
  2. package/dist/eui_theme_dark.json +0 -57
  3. package/dist/eui_theme_dark.json.d.ts +0 -57
  4. package/dist/eui_theme_dark.min.css +1 -1
  5. package/dist/eui_theme_light.css +1 -783
  6. package/dist/eui_theme_light.json +0 -57
  7. package/dist/eui_theme_light.json.d.ts +0 -57
  8. package/dist/eui_theme_light.min.css +1 -1
  9. package/es/components/breadcrumbs/breadcrumb.js +199 -0
  10. package/es/components/breadcrumbs/breadcrumb.styles.js +61 -0
  11. package/es/components/breadcrumbs/breadcrumbs.js +115 -187
  12. package/es/components/breadcrumbs/breadcrumbs.styles.js +30 -0
  13. package/es/components/code/code_block.js +119 -107
  14. package/es/components/collapsible_nav/collapsible_nav.js +2 -2
  15. package/es/components/control_bar/control_bar.js +13 -0
  16. package/es/components/datagrid/body/data_grid_body.js +12 -2
  17. package/es/components/datagrid/body/data_grid_cell.js +31 -3
  18. package/es/components/datagrid/body/header/data_grid_header_row.js +1 -1
  19. package/es/components/datagrid/controls/column_sorting_draggable.js +1 -1
  20. package/es/components/datagrid/data_grid.js +10 -2
  21. package/es/components/datagrid/utils/row_heights.js +33 -4
  22. package/es/components/date_picker/super_date_picker/super_date_picker.js +2 -2
  23. package/es/components/date_picker/super_date_picker/super_update_button.js +1 -1
  24. package/es/components/description_list/description_list.js +22 -26
  25. package/es/components/description_list/description_list.styles.js +25 -0
  26. package/es/components/description_list/description_list_context.js +14 -0
  27. package/es/components/description_list/description_list_description.js +43 -2
  28. package/es/components/description_list/description_list_description.styles.js +47 -0
  29. package/es/components/description_list/description_list_title.js +43 -2
  30. package/es/components/description_list/description_list_title.styles.js +37 -0
  31. package/es/components/description_list/description_list_types.js +10 -0
  32. package/es/components/header/header.js +1 -27
  33. package/es/components/header/header_breadcrumbs/header_breadcrumbs.js +22 -2
  34. package/es/components/header/header_breadcrumbs/header_breadcrumbs.styles.js +15 -0
  35. package/es/components/header/header_links/header_links.js +9 -9
  36. package/es/components/icon/assets/tokenStruct.js +1 -1
  37. package/es/components/page/page_header/page_header.js +1 -0
  38. package/es/components/page/page_header/page_header_content.js +2 -1
  39. package/es/components/page/page_template.js +1 -0
  40. package/es/components/pagination/pagination.js +1 -1
  41. package/es/components/panel/split_panel/split_panel.js +2 -2
  42. package/es/components/provider/provider.js +2 -2
  43. package/es/components/responsive/hide_for.js +6 -38
  44. package/es/components/responsive/show_for.js +6 -38
  45. package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +17 -36
  46. package/es/components/side_nav/side_nav.js +1 -1
  47. package/es/components/table/table_row_cell.js +1 -2
  48. package/es/components/toast/global_toast_list.js +208 -241
  49. package/es/components/toast/global_toast_list.styles.js +38 -0
  50. package/es/components/toast/global_toast_list_item.js +12 -7
  51. package/es/components/toast/toast.js +25 -25
  52. package/es/components/toast/toast.styles.js +55 -0
  53. package/es/components/token/index.js +2 -1
  54. package/es/components/token/token.js +48 -112
  55. package/es/components/token/token.styles.js +93 -0
  56. package/es/components/token/token_map.js +6 -9
  57. package/es/components/token/token_types.js +11 -0
  58. package/es/global_styling/reset/global_styles.js +1 -1
  59. package/es/services/{breakpoint.js → breakpoint/breakpoint.js} +4 -9
  60. package/es/services/{hooks/useIsWithinBreakpoints.js → breakpoint/current_breakpoint.js} +26 -28
  61. package/es/services/breakpoint/current_breakpoint_hook.js +20 -0
  62. package/es/services/breakpoint/index.js +11 -0
  63. package/es/services/breakpoint/useIsWithinBreakpoints.js +24 -0
  64. package/es/services/hooks/index.js +0 -1
  65. package/es/services/index.js +1 -1
  66. package/es/test/rtl/component_helpers.js +60 -1
  67. package/eui.d.ts +1704 -1475
  68. package/i18ntokens.json +36 -36
  69. package/lib/components/breadcrumbs/breadcrumb.js +225 -0
  70. package/lib/components/breadcrumbs/breadcrumb.styles.js +68 -0
  71. package/lib/components/breadcrumbs/breadcrumbs.js +125 -188
  72. package/lib/components/breadcrumbs/breadcrumbs.styles.js +33 -0
  73. package/lib/components/code/code_block.js +118 -106
  74. package/lib/components/collapsible_nav/collapsible_nav.js +2 -2
  75. package/lib/components/control_bar/control_bar.js +13 -0
  76. package/lib/components/datagrid/body/data_grid_body.js +12 -2
  77. package/lib/components/datagrid/body/data_grid_cell.js +31 -3
  78. package/lib/components/datagrid/body/header/data_grid_header_row.js +1 -1
  79. package/lib/components/datagrid/controls/column_sorting_draggable.js +1 -1
  80. package/lib/components/datagrid/data_grid.js +10 -2
  81. package/lib/components/datagrid/utils/row_heights.js +33 -4
  82. package/lib/components/date_picker/super_date_picker/super_date_picker.js +2 -2
  83. package/lib/components/date_picker/super_date_picker/super_update_button.js +1 -1
  84. package/lib/components/description_list/description_list.js +25 -31
  85. package/lib/components/description_list/description_list.styles.js +36 -0
  86. package/lib/components/description_list/description_list_context.js +24 -0
  87. package/lib/components/description_list/description_list_description.js +52 -2
  88. package/lib/components/description_list/description_list_description.styles.js +51 -0
  89. package/lib/components/description_list/description_list_title.js +52 -2
  90. package/lib/components/description_list/description_list_title.styles.js +50 -0
  91. package/lib/components/description_list/description_list_types.js +20 -0
  92. package/lib/components/header/header.js +1 -27
  93. package/lib/components/header/header_breadcrumbs/header_breadcrumbs.js +24 -2
  94. package/lib/components/header/header_breadcrumbs/header_breadcrumbs.styles.js +26 -0
  95. package/lib/components/header/header_links/header_links.js +8 -8
  96. package/lib/components/icon/assets/tokenStruct.js +1 -1
  97. package/lib/components/icon/svgs/tokens/tokenStruct.svg +1 -1
  98. package/lib/components/page/page_header/page_header.js +1 -0
  99. package/lib/components/page/page_header/page_header_content.js +3 -2
  100. package/lib/components/page/page_template.js +1 -0
  101. package/lib/components/pagination/pagination.js +1 -1
  102. package/lib/components/panel/split_panel/split_panel.js +3 -3
  103. package/lib/components/provider/provider.js +1 -1
  104. package/lib/components/responsive/hide_for.js +12 -44
  105. package/lib/components/responsive/show_for.js +12 -44
  106. package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +15 -35
  107. package/lib/components/side_nav/side_nav.js +1 -1
  108. package/lib/components/table/table_row_cell.js +1 -3
  109. package/lib/components/toast/global_toast_list.js +209 -238
  110. package/lib/components/toast/global_toast_list.styles.js +45 -0
  111. package/lib/components/toast/global_toast_list_item.js +14 -7
  112. package/lib/components/toast/toast.js +27 -25
  113. package/lib/components/toast/toast.styles.js +66 -0
  114. package/lib/components/token/index.js +5 -3
  115. package/lib/components/token/token.js +50 -120
  116. package/lib/components/token/token.styles.js +101 -0
  117. package/lib/components/token/token_map.js +6 -9
  118. package/lib/components/token/token_types.js +22 -0
  119. package/lib/global_styling/reset/global_styles.js +1 -1
  120. package/{test-env/services → lib/services/breakpoint}/breakpoint.js +5 -9
  121. package/lib/services/breakpoint/current_breakpoint.js +69 -0
  122. package/lib/services/breakpoint/current_breakpoint_hook.js +31 -0
  123. package/lib/services/breakpoint/index.js +57 -0
  124. package/lib/services/breakpoint/useIsWithinBreakpoints.js +34 -0
  125. package/lib/services/hooks/index.js +0 -13
  126. package/lib/services/index.js +28 -0
  127. package/lib/test/rtl/component_helpers.js +69 -3
  128. package/optimize/es/components/breadcrumbs/breadcrumb.js +136 -0
  129. package/optimize/es/components/breadcrumbs/breadcrumb.styles.js +61 -0
  130. package/optimize/es/components/breadcrumbs/breadcrumbs.js +92 -165
  131. package/optimize/es/components/breadcrumbs/breadcrumbs.styles.js +30 -0
  132. package/optimize/es/components/code/code_block.js +106 -107
  133. package/optimize/es/components/datagrid/body/data_grid_body.js +2 -0
  134. package/optimize/es/components/datagrid/body/data_grid_cell.js +13 -1
  135. package/optimize/es/components/datagrid/utils/row_heights.js +33 -4
  136. package/optimize/es/components/description_list/description_list.js +20 -24
  137. package/optimize/es/components/description_list/description_list.styles.js +25 -0
  138. package/optimize/es/components/description_list/description_list_context.js +14 -0
  139. package/optimize/es/components/description_list/description_list_description.js +32 -2
  140. package/optimize/es/components/description_list/description_list_description.styles.js +47 -0
  141. package/optimize/es/components/description_list/description_list_title.js +32 -2
  142. package/optimize/es/components/description_list/description_list_title.styles.js +37 -0
  143. package/optimize/es/components/description_list/description_list_types.js +10 -0
  144. package/optimize/es/components/header/header_breadcrumbs/header_breadcrumbs.js +8 -1
  145. package/optimize/es/components/header/header_breadcrumbs/header_breadcrumbs.styles.js +15 -0
  146. package/optimize/es/components/header/header_links/header_links.js +8 -8
  147. package/optimize/es/components/icon/assets/tokenStruct.js +1 -1
  148. package/optimize/es/components/page/page_header/page_header_content.js +1 -1
  149. package/optimize/es/components/panel/split_panel/split_panel.js +1 -1
  150. package/optimize/es/components/provider/provider.js +2 -2
  151. package/optimize/es/components/responsive/hide_for.js +5 -27
  152. package/optimize/es/components/responsive/show_for.js +5 -27
  153. package/optimize/es/components/selectable/selectable_templates/selectable_template_sitewide.js +16 -35
  154. package/optimize/es/components/table/table_row_cell.js +1 -2
  155. package/optimize/es/components/toast/global_toast_list.js +199 -230
  156. package/optimize/es/components/toast/global_toast_list.styles.js +38 -0
  157. package/optimize/es/components/toast/global_toast_list_item.js +11 -6
  158. package/optimize/es/components/toast/toast.js +24 -24
  159. package/optimize/es/components/toast/toast.styles.js +55 -0
  160. package/optimize/es/components/token/index.js +2 -1
  161. package/optimize/es/components/token/token.js +46 -69
  162. package/optimize/es/components/token/token.styles.js +83 -0
  163. package/optimize/es/components/token/token_map.js +6 -9
  164. package/optimize/es/components/token/token_types.js +11 -0
  165. package/optimize/es/global_styling/reset/global_styles.js +1 -1
  166. package/optimize/es/services/{breakpoint.js → breakpoint/breakpoint.js} +4 -9
  167. package/optimize/es/services/breakpoint/current_breakpoint.js +44 -0
  168. package/optimize/es/services/breakpoint/current_breakpoint_hook.js +20 -0
  169. package/optimize/es/services/breakpoint/index.js +11 -0
  170. package/optimize/es/services/breakpoint/useIsWithinBreakpoints.js +24 -0
  171. package/optimize/es/services/hooks/index.js +0 -1
  172. package/optimize/es/services/index.js +1 -1
  173. package/optimize/es/test/rtl/component_helpers.js +60 -1
  174. package/optimize/lib/components/breadcrumbs/breadcrumb.js +162 -0
  175. package/optimize/lib/components/breadcrumbs/breadcrumb.styles.js +68 -0
  176. package/optimize/lib/components/breadcrumbs/breadcrumbs.js +99 -164
  177. package/optimize/lib/components/breadcrumbs/breadcrumbs.styles.js +33 -0
  178. package/optimize/lib/components/code/code_block.js +105 -106
  179. package/optimize/lib/components/datagrid/body/data_grid_body.js +2 -0
  180. package/optimize/lib/components/datagrid/body/data_grid_cell.js +13 -1
  181. package/optimize/lib/components/datagrid/utils/row_heights.js +33 -4
  182. package/optimize/lib/components/description_list/description_list.js +23 -28
  183. package/optimize/lib/components/description_list/description_list.styles.js +36 -0
  184. package/optimize/lib/components/description_list/description_list_context.js +24 -0
  185. package/optimize/lib/components/description_list/description_list_description.js +43 -2
  186. package/optimize/lib/components/description_list/description_list_description.styles.js +51 -0
  187. package/optimize/lib/components/description_list/description_list_title.js +43 -2
  188. package/optimize/lib/components/description_list/description_list_title.styles.js +50 -0
  189. package/optimize/lib/components/description_list/description_list_types.js +20 -0
  190. package/optimize/lib/components/header/header_breadcrumbs/header_breadcrumbs.js +10 -1
  191. package/optimize/lib/components/header/header_breadcrumbs/header_breadcrumbs.styles.js +26 -0
  192. package/optimize/lib/components/header/header_links/header_links.js +7 -7
  193. package/optimize/lib/components/icon/assets/tokenStruct.js +1 -1
  194. package/optimize/lib/components/icon/svgs/tokens/tokenStruct.svg +1 -1
  195. package/optimize/lib/components/page/page_header/page_header_content.js +2 -2
  196. package/optimize/lib/components/panel/split_panel/split_panel.js +2 -2
  197. package/optimize/lib/components/provider/provider.js +1 -1
  198. package/optimize/lib/components/responsive/hide_for.js +4 -33
  199. package/optimize/lib/components/responsive/show_for.js +4 -33
  200. package/optimize/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +14 -34
  201. package/optimize/lib/components/table/table_row_cell.js +1 -3
  202. package/optimize/lib/components/toast/global_toast_list.js +206 -220
  203. package/optimize/lib/components/toast/global_toast_list.styles.js +47 -0
  204. package/optimize/lib/components/toast/global_toast_list_item.js +14 -7
  205. package/optimize/lib/components/toast/toast.js +26 -24
  206. package/optimize/lib/components/toast/toast.styles.js +66 -0
  207. package/optimize/lib/components/token/index.js +5 -3
  208. package/optimize/lib/components/token/token.js +50 -76
  209. package/optimize/lib/components/token/token.styles.js +91 -0
  210. package/optimize/lib/components/token/token_map.js +6 -9
  211. package/optimize/lib/components/token/token_types.js +22 -0
  212. package/optimize/lib/global_styling/reset/global_styles.js +1 -1
  213. package/optimize/lib/services/{breakpoint.js → breakpoint/breakpoint.js} +5 -9
  214. package/optimize/lib/services/breakpoint/current_breakpoint.js +68 -0
  215. package/optimize/lib/services/breakpoint/current_breakpoint_hook.js +31 -0
  216. package/optimize/lib/services/breakpoint/index.js +57 -0
  217. package/optimize/lib/services/breakpoint/useIsWithinBreakpoints.js +34 -0
  218. package/optimize/lib/services/hooks/index.js +0 -13
  219. package/optimize/lib/services/index.js +28 -0
  220. package/optimize/lib/test/rtl/component_helpers.js +69 -3
  221. package/package.json +2 -2
  222. package/src/components/control_bar/_control_bar.scss +1 -1
  223. package/src/components/header/_index.scss +0 -1
  224. package/src/components/index.scss +0 -5
  225. package/src/themes/amsterdam/overrides/_breadcrumbs.scss +0 -12
  226. package/src/themes/amsterdam/overrides/_index.scss +0 -4
  227. package/test-env/components/breadcrumbs/breadcrumb.js +211 -0
  228. package/test-env/components/breadcrumbs/breadcrumb.styles.js +68 -0
  229. package/test-env/components/breadcrumbs/breadcrumbs.js +122 -174
  230. package/test-env/components/breadcrumbs/breadcrumbs.styles.js +33 -0
  231. package/test-env/components/collapsible_nav/collapsible_nav.js +2 -2
  232. package/test-env/components/control_bar/control_bar.js +13 -0
  233. package/test-env/components/datagrid/body/data_grid_body.js +12 -2
  234. package/test-env/components/datagrid/body/data_grid_cell.js +31 -3
  235. package/test-env/components/datagrid/body/header/data_grid_header_row.js +1 -1
  236. package/test-env/components/datagrid/controls/column_sorting_draggable.js +1 -1
  237. package/test-env/components/datagrid/data_grid.js +10 -2
  238. package/test-env/components/datagrid/utils/row_heights.js +33 -4
  239. package/test-env/components/date_picker/super_date_picker/super_date_picker.js +2 -2
  240. package/test-env/components/date_picker/super_date_picker/super_update_button.js +1 -1
  241. package/test-env/components/description_list/description_list.js +25 -30
  242. package/test-env/components/description_list/description_list.styles.js +36 -0
  243. package/test-env/components/description_list/description_list_context.js +24 -0
  244. package/test-env/components/description_list/description_list_description.js +43 -2
  245. package/test-env/components/description_list/description_list_description.styles.js +51 -0
  246. package/test-env/components/description_list/description_list_title.js +43 -2
  247. package/test-env/components/description_list/description_list_title.styles.js +50 -0
  248. package/test-env/components/description_list/description_list_types.js +20 -0
  249. package/test-env/components/header/header.js +1 -27
  250. package/test-env/components/header/header_breadcrumbs/header_breadcrumbs.js +24 -2
  251. package/test-env/components/header/header_breadcrumbs/header_breadcrumbs.styles.js +26 -0
  252. package/test-env/components/header/header_links/header_links.js +8 -8
  253. package/test-env/components/icon/assets/tokenStruct.js +1 -1
  254. package/test-env/components/observer/resize_observer/resize_observer.js +43 -126
  255. package/test-env/components/page/page_header/page_header.js +1 -0
  256. package/test-env/components/page/page_header/page_header_content.js +3 -2
  257. package/test-env/components/page/page_template.js +1 -0
  258. package/test-env/components/pagination/pagination.js +1 -1
  259. package/test-env/components/panel/split_panel/split_panel.js +3 -3
  260. package/test-env/components/provider/provider.js +1 -1
  261. package/test-env/components/responsive/hide_for.js +5 -34
  262. package/test-env/components/responsive/show_for.js +5 -34
  263. package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +15 -35
  264. package/test-env/components/side_nav/side_nav.js +1 -1
  265. package/test-env/components/table/table_row_cell.js +1 -3
  266. package/test-env/components/toast/global_toast_list.js +206 -220
  267. package/test-env/components/toast/global_toast_list.styles.js +47 -0
  268. package/test-env/components/toast/global_toast_list_item.js +14 -7
  269. package/test-env/components/toast/toast.js +27 -25
  270. package/test-env/components/toast/toast.styles.js +66 -0
  271. package/test-env/components/token/index.js +5 -3
  272. package/test-env/components/token/token.js +51 -120
  273. package/test-env/components/token/token.styles.js +91 -0
  274. package/test-env/components/token/token_map.js +6 -9
  275. package/test-env/components/token/token_types.js +22 -0
  276. package/test-env/global_styling/reset/global_styles.js +1 -1
  277. package/{lib/services → test-env/services/breakpoint}/breakpoint.js +5 -9
  278. package/test-env/services/breakpoint/current_breakpoint.js +68 -0
  279. package/test-env/services/breakpoint/current_breakpoint_hook.js +33 -0
  280. package/test-env/services/breakpoint/index.js +57 -0
  281. package/test-env/services/breakpoint/useIsWithinBreakpoints.js +34 -0
  282. package/test-env/services/hooks/index.js +0 -13
  283. package/test-env/services/index.js +28 -0
  284. package/test-env/test/rtl/component_helpers.js +69 -3
  285. package/lib/services/hooks/useIsWithinBreakpoints.js +0 -57
  286. package/optimize/es/services/hooks/useIsWithinBreakpoints.js +0 -46
  287. package/optimize/lib/services/hooks/useIsWithinBreakpoints.js +0 -57
  288. package/src/components/breadcrumbs/_breadcrumbs.scss +0 -79
  289. package/src/components/breadcrumbs/_index.scss +0 -2
  290. package/src/components/breadcrumbs/_variables.scss +0 -2
  291. package/src/components/description_list/_description_list.scss +0 -211
  292. package/src/components/description_list/_index.scss +0 -1
  293. package/src/components/header/header_breadcrumbs/_header_breadcrumbs.scss +0 -8
  294. package/src/components/header/header_breadcrumbs/_index.scss +0 -1
  295. package/src/components/portal/_index.scss +0 -1
  296. package/src/components/portal/_portal.scss +0 -6
  297. package/src/components/toast/_global_toast_list.scss +0 -90
  298. package/src/components/toast/_index.scss +0 -4
  299. package/src/components/toast/_toast.scss +0 -103
  300. package/src/components/token/_index.scss +0 -2
  301. package/src/components/token/_token.scss +0 -85
  302. package/src/components/token/_variables.scss +0 -13
  303. package/src/themes/amsterdam/overrides/_header_breadcrumbs.scss +0 -71
  304. package/src/themes/amsterdam/overrides/_toast.scss +0 -21
  305. package/src/themes/amsterdam/overrides/_token.scss +0 -4
  306. package/test-env/services/hooks/useIsWithinBreakpoints.js +0 -57
@@ -11,20 +11,25 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
11
11
  * in compliance with, at your election, the Elastic License 2.0 or the Server
12
12
  * Side Public License, v 1.
13
13
  */
14
- import { cloneElement } from 'react';
15
14
  import classNames from 'classnames';
15
+ import { useEuiTheme } from '../../services';
16
+ import { cloneElementWithCss } from '../../services/theme/clone_element';
17
+ import { euiGlobalToastListItemStyles } from './global_toast_list.styles';
16
18
  export var EuiGlobalToastListItem = function EuiGlobalToastListItem(_ref) {
17
19
  var children = _ref.children,
20
+ className = _ref.className,
18
21
  isDismissed = _ref.isDismissed;
22
+ var euiTheme = useEuiTheme();
19
23
 
20
24
  if (!children) {
21
25
  return null;
22
26
  }
23
27
 
24
- var classes = classNames('euiGlobalToastListItem', children.props.className, {
25
- 'euiGlobalToastListItem-isDismissed': isDismissed
26
- });
27
- return /*#__PURE__*/cloneElement(children, _objectSpread(_objectSpread({}, children.props), {
28
- className: classes
28
+ var styles = euiGlobalToastListItemStyles(euiTheme);
29
+ var cssStyles = [styles.euiGlobalToastListItem, isDismissed && styles.dismissed];
30
+ var classes = classNames('euiGlobalToastListItem', children.props.className, className);
31
+ return cloneElementWithCss(children, _objectSpread(_objectSpread({}, children.props), {
32
+ className: classes,
33
+ css: cssStyles
29
34
  }));
30
35
  };
@@ -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,44 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
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 React, { createContext, useState, useEffect } from 'react';
11
+ import { useEuiTheme } from '../theme';
12
+ import { throttle } from '../throttle';
13
+ import { getBreakpoint } from './breakpoint';
14
+ import { jsx as ___EmotionJSX } from "@emotion/react";
15
+ export var CurrentEuiBreakpointContext = /*#__PURE__*/createContext(undefined);
16
+ /**
17
+ * Top level provider (nested within EuiProvider) which provides a single
18
+ * resize listener that returns the current breakpoint based on window width
19
+ */
20
+
21
+ export var CurrentEuiBreakpointProvider = function CurrentEuiBreakpointProvider(_ref) {
22
+ var children = _ref.children;
23
+
24
+ var _useEuiTheme = useEuiTheme(),
25
+ breakpoints = _useEuiTheme.euiTheme.breakpoint;
26
+
27
+ var _useState = useState(typeof window !== 'undefined' ? getBreakpoint(window.innerWidth, breakpoints) : undefined),
28
+ _useState2 = _slicedToArray(_useState, 2),
29
+ currentBreakpoint = _useState2[0],
30
+ setCurrentBreakpoint = _useState2[1];
31
+
32
+ useEffect(function () {
33
+ var onWindowResize = throttle(function () {
34
+ setCurrentBreakpoint(getBreakpoint(window.innerWidth, breakpoints));
35
+ }, 50);
36
+ window.addEventListener('resize', onWindowResize);
37
+ return function () {
38
+ return window.removeEventListener('resize', onWindowResize);
39
+ };
40
+ }, [breakpoints]);
41
+ return ___EmotionJSX(CurrentEuiBreakpointContext.Provider, {
42
+ value: currentBreakpoint
43
+ }, children);
44
+ };
@@ -0,0 +1,20 @@
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 { useContext } from 'react';
9
+ import { CurrentEuiBreakpointContext } from './current_breakpoint';
10
+ /**
11
+ * Hook util / syntactical sugar for useContext()
12
+ *
13
+ * This hook is in its own separate file to make mocking it
14
+ * as a testenv easy for Jest unit tests
15
+ */
16
+
17
+ export var useCurrentEuiBreakpoint = function useCurrentEuiBreakpoint() {
18
+ var currentBreakpoint = useContext(CurrentEuiBreakpointContext);
19
+ return currentBreakpoint;
20
+ };
@@ -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 * from './breakpoint';
9
+ export * from './current_breakpoint';
10
+ export * from './current_breakpoint_hook';
11
+ 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 './current_breakpoint_hook';
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';