@elastic/eui 66.0.0 → 67.1.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 (325) hide show
  1. package/dist/eui_theme_dark.css +0 -345
  2. package/dist/eui_theme_dark.json +0 -6
  3. package/dist/eui_theme_dark.json.d.ts +0 -6
  4. package/dist/eui_theme_dark.min.css +1 -1
  5. package/dist/eui_theme_light.css +0 -345
  6. package/dist/eui_theme_light.json +0 -6
  7. package/dist/eui_theme_light.json.d.ts +0 -6
  8. package/dist/eui_theme_light.min.css +1 -1
  9. package/es/components/badge/badge.js +84 -78
  10. package/es/components/badge/badge.styles.js +56 -0
  11. package/es/components/basic_table/in_memory_table.js +8 -0
  12. package/es/components/button/button.js +0 -1
  13. package/es/components/button/button_display/_button_display.js +20 -6
  14. package/es/components/button/button_display/_button_display.styles.js +2 -2
  15. package/es/components/button/button_display/_button_display_content.js +5 -3
  16. package/es/components/button/button_display/_button_display_content.styles.js +4 -1
  17. package/es/components/button/button_empty/button_empty.js +10 -1
  18. package/es/components/card/card.js +2 -2
  19. package/es/components/card/card.styles.js +5 -2
  20. package/es/components/collapsible_nav/collapsible_nav.js +0 -5
  21. package/es/components/date_picker/auto_refresh/auto_refresh.js +6 -1
  22. package/es/components/date_picker/super_date_picker/date_popover/date_popover_button.js +6 -2
  23. package/es/components/expression/expression.js +12 -2
  24. package/es/components/header/header_links/header_link.js +10 -1
  25. package/es/components/image/image.js +6 -1
  26. package/es/components/image/image_fullscreen_wrapper.js +2 -3
  27. package/es/components/notification/notification_event.js +25 -6
  28. package/es/components/notification/notification_event_meta.js +1 -1
  29. package/es/components/overlay_mask/overlay_mask.js +27 -65
  30. package/es/components/overlay_mask/overlay_mask.styles.js +28 -0
  31. package/es/components/page/page_content/page_content.js +1 -2
  32. package/es/components/page/page_content/page_content_body.js +1 -2
  33. package/es/components/page/page_content/page_content_header.js +1 -2
  34. package/es/components/page/page_content/page_content_header_section.js +1 -2
  35. package/es/components/page/page_section/page_section.js +15 -3
  36. package/es/components/page/page_side_bar/page_side_bar.js +1 -2
  37. package/es/components/page/page_template.js +3 -1
  38. package/es/components/page_template/empty_prompt/page_empty_prompt.js +11 -1
  39. package/es/components/page_template/page_template.js +18 -2
  40. package/es/components/pagination/pagination.js +17 -4
  41. package/es/components/pagination/pagination.styles.js +31 -0
  42. package/es/components/pagination/pagination_button.js +17 -5
  43. package/es/components/pagination/pagination_button.styles.js +30 -0
  44. package/es/components/pagination/pagination_button_arrow.js +5 -0
  45. package/es/components/popover/popover_title.js +2 -2
  46. package/es/components/popover/popover_title.styles.js +18 -6
  47. package/es/components/progress/progress.js +6 -1
  48. package/es/components/provider/cache/cache_provider.js +3 -9
  49. package/es/components/provider/provider.js +25 -2
  50. package/es/components/resizable_container/resizable_panel.js +6 -1
  51. package/es/components/search_bar/filters/custom_component_filter.js +16 -0
  52. package/es/components/search_bar/filters/filters.js +6 -0
  53. package/es/components/search_bar/query/ast.js +12 -0
  54. package/es/components/search_bar/query/ast_to_es_query_dsl.js +15 -10
  55. package/es/components/search_bar/query/query.js +17 -0
  56. package/es/components/search_bar/search_bar.js +4 -0
  57. package/es/components/search_bar/search_filters.js +4 -0
  58. package/es/components/selectable/selectable_list/selectable_list.js +2 -2
  59. package/es/components/selectable/selectable_list/selectable_list_item.js +2 -2
  60. package/es/components/side_nav/side_nav.js +5 -0
  61. package/es/components/suggest/suggest.js +10 -1
  62. package/es/components/tool_tip/tool_tip.js +42 -66
  63. package/es/components/tool_tip/tool_tip.styles.js +107 -0
  64. package/es/components/tool_tip/tool_tip_anchor.js +73 -0
  65. package/es/components/tool_tip/tool_tip_arrow.js +20 -0
  66. package/es/components/tool_tip/tool_tip_popover.js +48 -101
  67. package/es/global_styling/index.js +2 -1
  68. package/es/global_styling/utility/animations.js +13 -0
  69. package/es/services/color/contrast.js +2 -0
  70. package/es/services/index.js +1 -1
  71. package/es/services/theme/context.js +2 -1
  72. package/es/services/theme/hooks.js +27 -1
  73. package/es/services/theme/index.js +1 -1
  74. package/es/services/theme/provider.js +15 -1
  75. package/eui.d.ts +232 -79
  76. package/i18ntokens.json +54 -54
  77. package/lib/components/badge/badge.js +92 -80
  78. package/lib/components/badge/badge.styles.js +61 -0
  79. package/lib/components/basic_table/in_memory_table.js +8 -0
  80. package/lib/components/button/button.js +0 -1
  81. package/lib/components/button/button_display/_button_display.js +20 -6
  82. package/lib/components/button/button_display/_button_display.styles.js +2 -2
  83. package/lib/components/button/button_display/_button_display_content.js +9 -4
  84. package/lib/components/button/button_display/_button_display_content.styles.js +4 -1
  85. package/lib/components/button/button_empty/button_empty.js +10 -1
  86. package/lib/components/card/card.js +2 -2
  87. package/lib/components/card/card.styles.js +5 -2
  88. package/lib/components/collapsible_nav/collapsible_nav.js +0 -5
  89. package/lib/components/date_picker/auto_refresh/auto_refresh.js +6 -1
  90. package/lib/components/date_picker/super_date_picker/date_popover/date_popover_button.js +6 -1
  91. package/lib/components/expression/expression.js +12 -2
  92. package/lib/components/header/header_links/header_link.js +10 -1
  93. package/lib/components/image/image.js +6 -1
  94. package/lib/components/image/image_fullscreen_wrapper.js +2 -3
  95. package/lib/components/notification/notification_event.js +28 -9
  96. package/lib/components/notification/notification_event_meta.js +1 -1
  97. package/lib/components/overlay_mask/overlay_mask.js +27 -65
  98. package/lib/components/overlay_mask/overlay_mask.styles.js +34 -0
  99. package/lib/components/page/page_content/page_content.js +1 -2
  100. package/lib/components/page/page_content/page_content_body.js +1 -2
  101. package/lib/components/page/page_content/page_content_header.js +1 -2
  102. package/lib/components/page/page_content/page_content_header_section.js +1 -2
  103. package/lib/components/page/page_section/page_section.js +15 -3
  104. package/lib/components/page/page_side_bar/page_side_bar.js +1 -2
  105. package/lib/components/page/page_template.js +3 -1
  106. package/lib/components/page_template/empty_prompt/page_empty_prompt.js +11 -1
  107. package/lib/components/page_template/page_template.js +18 -2
  108. package/lib/components/pagination/pagination.js +18 -3
  109. package/lib/components/pagination/pagination.styles.js +34 -0
  110. package/lib/components/pagination/pagination_button.js +9 -4
  111. package/lib/components/pagination/pagination_button.styles.js +45 -0
  112. package/lib/components/pagination/pagination_button_arrow.js +7 -0
  113. package/lib/components/popover/popover_title.js +2 -2
  114. package/lib/components/popover/popover_title.styles.js +19 -7
  115. package/lib/components/progress/progress.js +6 -1
  116. package/lib/components/provider/cache/cache_provider.js +3 -11
  117. package/lib/components/provider/provider.js +31 -6
  118. package/lib/components/resizable_container/resizable_panel.js +6 -1
  119. package/lib/components/search_bar/filters/custom_component_filter.js +29 -0
  120. package/lib/components/search_bar/filters/filters.js +7 -0
  121. package/lib/components/search_bar/query/ast.js +12 -0
  122. package/lib/components/search_bar/query/ast_to_es_query_dsl.js +16 -11
  123. package/lib/components/search_bar/query/query.js +17 -0
  124. package/lib/components/search_bar/search_bar.js +4 -0
  125. package/lib/components/search_bar/search_filters.js +4 -0
  126. package/lib/components/selectable/selectable_list/selectable_list.js +2 -2
  127. package/lib/components/selectable/selectable_list/selectable_list_item.js +2 -2
  128. package/lib/components/side_nav/side_nav.js +5 -0
  129. package/lib/components/suggest/suggest.js +10 -1
  130. package/lib/components/tool_tip/tool_tip.js +43 -64
  131. package/lib/components/tool_tip/tool_tip.styles.js +123 -0
  132. package/lib/components/tool_tip/tool_tip_anchor.js +87 -0
  133. package/lib/components/tool_tip/tool_tip_arrow.js +28 -0
  134. package/lib/components/tool_tip/tool_tip_popover.js +49 -98
  135. package/lib/global_styling/index.js +13 -0
  136. package/lib/global_styling/utility/animations.js +15 -0
  137. package/lib/services/color/contrast.js +6 -1
  138. package/lib/services/index.js +7 -0
  139. package/lib/services/theme/context.js +4 -2
  140. package/lib/services/theme/hooks.js +28 -0
  141. package/lib/services/theme/index.js +12 -0
  142. package/lib/services/theme/provider.js +23 -2
  143. package/optimize/es/components/badge/badge.js +82 -76
  144. package/optimize/es/components/badge/badge.styles.js +56 -0
  145. package/optimize/es/components/basic_table/in_memory_table.js +4 -0
  146. package/optimize/es/components/button/button.js +0 -1
  147. package/optimize/es/components/button/button_display/_button_display.js +8 -3
  148. package/optimize/es/components/button/button_display/_button_display.styles.js +2 -2
  149. package/optimize/es/components/button/button_display/_button_display_content.js +3 -1
  150. package/optimize/es/components/button/button_display/_button_display_content.styles.js +4 -1
  151. package/optimize/es/components/card/card.js +2 -2
  152. package/optimize/es/components/card/card.styles.js +5 -2
  153. package/optimize/es/components/date_picker/super_date_picker/date_popover/date_popover_button.js +0 -1
  154. package/optimize/es/components/image/image_fullscreen_wrapper.js +2 -3
  155. package/optimize/es/components/notification/notification_event.js +10 -4
  156. package/optimize/es/components/overlay_mask/overlay_mask.js +27 -60
  157. package/optimize/es/components/overlay_mask/overlay_mask.styles.js +28 -0
  158. package/optimize/es/components/page/page_content/page_content.js +1 -2
  159. package/optimize/es/components/page/page_content/page_content_body.js +1 -2
  160. package/optimize/es/components/page/page_content/page_content_header.js +1 -2
  161. package/optimize/es/components/page/page_content/page_content_header_section.js +1 -2
  162. package/optimize/es/components/page/page_section/page_section.js +4 -2
  163. package/optimize/es/components/page/page_side_bar/page_side_bar.js +1 -2
  164. package/optimize/es/components/page/page_template.js +3 -1
  165. package/optimize/es/components/pagination/pagination.js +17 -4
  166. package/optimize/es/components/pagination/pagination.styles.js +31 -0
  167. package/optimize/es/components/pagination/pagination_button.js +7 -4
  168. package/optimize/es/components/pagination/pagination_button.styles.js +30 -0
  169. package/optimize/es/components/pagination/pagination_button_arrow.js +5 -0
  170. package/optimize/es/components/popover/popover_title.js +2 -2
  171. package/optimize/es/components/popover/popover_title.styles.js +18 -6
  172. package/optimize/es/components/provider/cache/cache_provider.js +3 -9
  173. package/optimize/es/components/provider/provider.js +25 -2
  174. package/optimize/es/components/search_bar/filters/custom_component_filter.js +16 -0
  175. package/optimize/es/components/search_bar/filters/filters.js +6 -0
  176. package/optimize/es/components/search_bar/query/ast.js +12 -0
  177. package/optimize/es/components/search_bar/query/ast_to_es_query_dsl.js +14 -9
  178. package/optimize/es/components/search_bar/query/query.js +17 -0
  179. package/optimize/es/components/suggest/suggest.js +4 -1
  180. package/optimize/es/components/tool_tip/tool_tip.js +42 -66
  181. package/optimize/es/components/tool_tip/tool_tip.styles.js +107 -0
  182. package/optimize/es/components/tool_tip/tool_tip_anchor.js +60 -0
  183. package/optimize/es/components/tool_tip/tool_tip_arrow.js +20 -0
  184. package/optimize/es/components/tool_tip/tool_tip_popover.js +46 -87
  185. package/optimize/es/global_styling/index.js +2 -1
  186. package/optimize/es/global_styling/utility/animations.js +13 -0
  187. package/optimize/es/services/color/contrast.js +2 -0
  188. package/optimize/es/services/index.js +1 -1
  189. package/optimize/es/services/theme/context.js +2 -1
  190. package/optimize/es/services/theme/hooks.js +27 -1
  191. package/optimize/es/services/theme/index.js +1 -1
  192. package/optimize/es/services/theme/provider.js +14 -1
  193. package/optimize/lib/components/badge/badge.js +90 -78
  194. package/optimize/lib/components/badge/badge.styles.js +61 -0
  195. package/optimize/lib/components/basic_table/in_memory_table.js +4 -0
  196. package/optimize/lib/components/button/button.js +0 -1
  197. package/optimize/lib/components/button/button_display/_button_display.js +8 -3
  198. package/optimize/lib/components/button/button_display/_button_display.styles.js +2 -2
  199. package/optimize/lib/components/button/button_display/_button_display_content.js +6 -2
  200. package/optimize/lib/components/button/button_display/_button_display_content.styles.js +4 -1
  201. package/optimize/lib/components/card/card.js +2 -2
  202. package/optimize/lib/components/card/card.styles.js +5 -2
  203. package/optimize/lib/components/image/image_fullscreen_wrapper.js +2 -3
  204. package/optimize/lib/components/notification/notification_event.js +11 -11
  205. package/optimize/lib/components/overlay_mask/overlay_mask.js +27 -59
  206. package/optimize/lib/components/overlay_mask/overlay_mask.styles.js +34 -0
  207. package/optimize/lib/components/page/page_content/page_content.js +1 -2
  208. package/optimize/lib/components/page/page_content/page_content_body.js +1 -2
  209. package/optimize/lib/components/page/page_content/page_content_header.js +1 -2
  210. package/optimize/lib/components/page/page_content/page_content_header_section.js +1 -2
  211. package/optimize/lib/components/page/page_section/page_section.js +4 -2
  212. package/optimize/lib/components/page/page_side_bar/page_side_bar.js +1 -2
  213. package/optimize/lib/components/page/page_template.js +3 -1
  214. package/optimize/lib/components/pagination/pagination.js +18 -3
  215. package/optimize/lib/components/pagination/pagination.styles.js +34 -0
  216. package/optimize/lib/components/pagination/pagination_button.js +9 -4
  217. package/optimize/lib/components/pagination/pagination_button.styles.js +45 -0
  218. package/optimize/lib/components/pagination/pagination_button_arrow.js +7 -0
  219. package/optimize/lib/components/popover/popover_title.js +2 -2
  220. package/optimize/lib/components/popover/popover_title.styles.js +19 -7
  221. package/optimize/lib/components/provider/cache/cache_provider.js +3 -11
  222. package/optimize/lib/components/provider/provider.js +31 -6
  223. package/optimize/lib/components/search_bar/filters/custom_component_filter.js +29 -0
  224. package/optimize/lib/components/search_bar/filters/filters.js +7 -0
  225. package/optimize/lib/components/search_bar/query/ast.js +12 -0
  226. package/optimize/lib/components/search_bar/query/ast_to_es_query_dsl.js +16 -11
  227. package/optimize/lib/components/search_bar/query/query.js +17 -0
  228. package/optimize/lib/components/suggest/suggest.js +4 -1
  229. package/optimize/lib/components/tool_tip/tool_tip.js +42 -64
  230. package/optimize/lib/components/tool_tip/tool_tip.styles.js +125 -0
  231. package/optimize/lib/components/tool_tip/tool_tip_anchor.js +75 -0
  232. package/optimize/lib/components/tool_tip/tool_tip_arrow.js +35 -0
  233. package/optimize/lib/components/tool_tip/tool_tip_popover.js +47 -88
  234. package/optimize/lib/global_styling/index.js +13 -0
  235. package/optimize/lib/global_styling/utility/animations.js +17 -0
  236. package/optimize/lib/services/color/contrast.js +5 -1
  237. package/optimize/lib/services/index.js +7 -0
  238. package/optimize/lib/services/theme/context.js +4 -2
  239. package/optimize/lib/services/theme/hooks.js +28 -0
  240. package/optimize/lib/services/theme/index.js +12 -0
  241. package/optimize/lib/services/theme/provider.js +23 -9
  242. package/package.json +5 -5
  243. package/src/components/badge/_index.scss +0 -1
  244. package/src/components/index.scss +0 -4
  245. package/src/global_styling/mixins/_tool_tip.scss +3 -6
  246. package/src/themes/amsterdam/overrides/_index.scss +0 -2
  247. package/test-env/components/badge/badge.js +92 -80
  248. package/test-env/components/badge/badge.styles.js +61 -0
  249. package/test-env/components/basic_table/in_memory_table.js +8 -0
  250. package/test-env/components/button/button.js +0 -1
  251. package/test-env/components/button/button_display/_button_display.js +20 -6
  252. package/test-env/components/button/button_display/_button_display.styles.js +2 -2
  253. package/test-env/components/button/button_display/_button_display_content.js +8 -4
  254. package/test-env/components/button/button_display/_button_display_content.styles.js +4 -1
  255. package/test-env/components/button/button_empty/button_empty.js +10 -1
  256. package/test-env/components/card/card.js +2 -2
  257. package/test-env/components/card/card.styles.js +5 -2
  258. package/test-env/components/collapsible_nav/collapsible_nav.js +0 -5
  259. package/test-env/components/date_picker/auto_refresh/auto_refresh.js +6 -1
  260. package/test-env/components/date_picker/super_date_picker/date_popover/date_popover_button.js +6 -1
  261. package/test-env/components/expression/expression.js +12 -2
  262. package/test-env/components/header/header_links/header_link.js +10 -1
  263. package/test-env/components/image/image.js +6 -1
  264. package/test-env/components/image/image_fullscreen_wrapper.js +2 -3
  265. package/test-env/components/notification/notification_event.js +25 -16
  266. package/test-env/components/notification/notification_event_meta.js +1 -1
  267. package/test-env/components/overlay_mask/overlay_mask.js +27 -64
  268. package/test-env/components/overlay_mask/overlay_mask.styles.js +34 -0
  269. package/test-env/components/page/page_content/page_content.js +1 -2
  270. package/test-env/components/page/page_content/page_content_body.js +1 -2
  271. package/test-env/components/page/page_content/page_content_header.js +1 -2
  272. package/test-env/components/page/page_content/page_content_header_section.js +1 -2
  273. package/test-env/components/page/page_section/page_section.js +15 -3
  274. package/test-env/components/page/page_side_bar/page_side_bar.js +1 -2
  275. package/test-env/components/page/page_template.js +3 -1
  276. package/test-env/components/page_template/empty_prompt/page_empty_prompt.js +11 -1
  277. package/test-env/components/page_template/page_template.js +18 -2
  278. package/test-env/components/pagination/pagination.js +18 -3
  279. package/test-env/components/pagination/pagination.styles.js +34 -0
  280. package/test-env/components/pagination/pagination_button.js +9 -4
  281. package/test-env/components/pagination/pagination_button.styles.js +45 -0
  282. package/test-env/components/pagination/pagination_button_arrow.js +7 -0
  283. package/test-env/components/popover/popover_title.js +2 -2
  284. package/test-env/components/popover/popover_title.styles.js +19 -7
  285. package/test-env/components/progress/progress.js +6 -1
  286. package/test-env/components/provider/cache/cache_provider.js +3 -11
  287. package/test-env/components/provider/provider.js +31 -6
  288. package/test-env/components/resizable_container/resizable_panel.js +6 -1
  289. package/test-env/components/search_bar/filters/custom_component_filter.js +29 -0
  290. package/test-env/components/search_bar/filters/filters.js +7 -0
  291. package/test-env/components/search_bar/query/ast.js +12 -0
  292. package/test-env/components/search_bar/query/ast_to_es_query_dsl.js +16 -11
  293. package/test-env/components/search_bar/query/query.js +17 -0
  294. package/test-env/components/search_bar/search_bar.js +4 -0
  295. package/test-env/components/search_bar/search_filters.js +4 -0
  296. package/test-env/components/selectable/selectable_list/selectable_list.js +2 -2
  297. package/test-env/components/selectable/selectable_list/selectable_list_item.js +2 -2
  298. package/test-env/components/side_nav/side_nav.js +5 -0
  299. package/test-env/components/suggest/suggest.js +10 -1
  300. package/test-env/components/tool_tip/tool_tip.js +42 -64
  301. package/test-env/components/tool_tip/tool_tip.styles.js +125 -0
  302. package/test-env/components/tool_tip/tool_tip_anchor.js +84 -0
  303. package/test-env/components/tool_tip/tool_tip_arrow.js +35 -0
  304. package/test-env/components/tool_tip/tool_tip_popover.js +49 -89
  305. package/test-env/global_styling/index.js +13 -0
  306. package/test-env/global_styling/utility/animations.js +17 -0
  307. package/test-env/services/color/contrast.js +5 -1
  308. package/test-env/services/index.js +7 -0
  309. package/test-env/services/theme/context.js +4 -2
  310. package/test-env/services/theme/hooks.js +28 -0
  311. package/test-env/services/theme/index.js +12 -0
  312. package/test-env/services/theme/provider.js +23 -9
  313. package/src/components/badge/_badge.scss +0 -133
  314. package/src/components/call_out/_index.scss +0 -3
  315. package/src/components/call_out/_mixins.scss +0 -23
  316. package/src/components/call_out/_variables.scss +0 -7
  317. package/src/components/overlay_mask/_index.scss +0 -1
  318. package/src/components/overlay_mask/_overlay_mask.scss +0 -33
  319. package/src/components/pagination/_index.scss +0 -2
  320. package/src/components/pagination/_pagination.scss +0 -30
  321. package/src/components/pagination/_pagination_button.scss +0 -37
  322. package/src/components/tool_tip/_index.scss +0 -1
  323. package/src/components/tool_tip/_tool_tip.scss +0 -121
  324. package/src/themes/amsterdam/overrides/_overlay_mask.scss +0 -3
  325. package/src/themes/amsterdam/overrides/_tooltip.scss +0 -7
@@ -31,39 +31,23 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
31
31
  * in compliance with, at your election, the Elastic License 2.0 or the Server
32
32
  * Side Public License, v 1.
33
33
  */
34
- import React from 'react';
34
+ import React, { useMemo } from 'react';
35
35
  import PropTypes from "prop-types";
36
36
  import classNames from 'classnames';
37
37
  import chroma from 'chroma-js';
38
- import { keysOf } from '../common';
39
- import { euiPaletteColorBlindBehindText, getSecureRelForTarget, isColorDark } from '../../services';
38
+ import { useEuiTheme, euiPaletteColorBlindBehindText, getSecureRelForTarget, isColorDark, wcagContrastMin } from '../../services';
40
39
  import { EuiInnerText } from '../inner_text';
41
40
  import { EuiIcon } from '../icon';
42
41
  import { chromaValid, parseColor } from '../color_picker/utils';
43
42
  import { validateHref } from '../../services/security/href_validator';
43
+ import { euiBadgeStyles } from './badge.styles';
44
44
  import { jsx as ___EmotionJSX } from "@emotion/react";
45
- // TODO - replace with variables once https://github.com/elastic/eui/issues/2731 is closed
46
- var colorInk = '#000';
47
- var colorGhost = '#fff'; // The color blind palette has some stricter accessibility needs with regards to
45
+ export var ICON_SIDES = ['left', 'right'];
46
+ export var COLORS = ['default', 'hollow', 'primary', 'success', 'accent', 'warning', 'danger'];
47
+ // The color blind palette has some stricter accessibility needs with regards to
48
48
  // charts and contrast. We use the euiPaletteColorBlindBehindText variant here since our
49
49
  // accessibility concerns pertain to foreground (text) and background contrast
50
-
51
50
  var visColors = euiPaletteColorBlindBehindText();
52
- var colorToHexMap = {
53
- // TODO - replace with variable once https://github.com/elastic/eui/issues/2731 is closed
54
- default: '#d3dae6',
55
- primary: visColors[1],
56
- success: visColors[0],
57
- accent: visColors[2],
58
- warning: visColors[5],
59
- danger: visColors[9]
60
- };
61
- export var COLORS = keysOf(colorToHexMap);
62
- var iconSideToClassNameMap = {
63
- left: 'euiBadge--iconLeft',
64
- right: 'euiBadge--iconRight'
65
- };
66
- export var ICON_SIDES = keysOf(iconSideToClassNameMap);
67
51
  export var EuiBadge = function EuiBadge(_ref) {
68
52
  var children = _ref.children,
69
53
  _ref$color = _ref.color,
@@ -84,53 +68,63 @@ export var EuiBadge = function EuiBadge(_ref) {
84
68
  style = _ref.style,
85
69
  rest = _objectWithoutProperties(_ref, _excluded);
86
70
 
71
+ var euiTheme = useEuiTheme();
87
72
  var isHrefValid = !href || validateHref(href);
88
73
  var isDisabled = _isDisabled || !isHrefValid;
89
- var optionalCustomStyles = style;
90
- var textColor = null; // TODO - replace with variable once https://github.com/elastic/eui/issues/2731 is closed
91
-
92
- var wcagContrastBase = 4.5; // WCAG AA contrast level
93
-
94
- var wcagContrast = null;
95
- var colorHex = null; // Check if a valid color name was provided
96
-
97
- try {
98
- if (COLORS.indexOf(color) > -1) {
99
- // Get the hex equivalent for the provided color name
100
- colorHex = colorToHexMap[color]; // Set dark or light text color based upon best contrast
101
-
102
- textColor = setTextColor(colorHex);
103
- optionalCustomStyles = _objectSpread({
104
- backgroundColor: colorHex,
105
- color: textColor
106
- }, optionalCustomStyles);
107
- } else if (color !== 'hollow') {
108
- // This is a custom color that is neither from the base palette nor hollow
109
- // Let's do our best to ensure that it provides sufficient contrast
110
- // Set dark or light text color based upon best contrast
111
- textColor = setTextColor(color); // Check the contrast
112
-
113
- wcagContrast = getColorContrast(textColor, color);
114
-
115
- if (wcagContrast < wcagContrastBase) {
116
- // It's low contrast, so lets show a warning in the console
117
- console.warn('Warning: ', color, ' badge has low contrast of ', wcagContrast.toFixed(2), '. Should be above ', wcagContrastBase, '.');
74
+ var optionalCustomStyles = useMemo(function () {
75
+ var colorToHexMap = {
76
+ default: euiTheme.euiTheme.colors.lightShade,
77
+ hollow: '',
78
+ primary: visColors[1],
79
+ success: visColors[0],
80
+ accent: visColors[2],
81
+ warning: visColors[5],
82
+ danger: visColors[9]
83
+ };
84
+ var textColor = null;
85
+ var contrastRatio = null;
86
+ var colorHex = null;
87
+
88
+ try {
89
+ // Check if a valid color name was provided
90
+ if (COLORS.includes(color)) {
91
+ if (color === 'hollow') return style; // hollow uses its own CSS class
92
+ // Get the hex equivalent for the provided color name
93
+
94
+ colorHex = colorToHexMap[color]; // Set dark or light text color based upon best contrast
95
+
96
+ textColor = setTextColor(euiTheme, colorHex);
97
+ return _objectSpread({
98
+ backgroundColor: colorHex,
99
+ color: textColor
100
+ }, style);
101
+ } else {
102
+ // This is a custom color- let's do our best to ensure that it provides sufficient contrast
103
+ // Set dark or light text color based upon best contrast
104
+ textColor = setTextColor(euiTheme, color); // Check the contrast
105
+
106
+ contrastRatio = getColorContrast(textColor, color);
107
+
108
+ if (contrastRatio < wcagContrastMin) {
109
+ // It's low contrast, so lets show a warning in the console
110
+ console.warn('Warning: ', color, ' badge has low contrast of ', contrastRatio.toFixed(2), '. Should be above ', wcagContrastMin, '.');
111
+ }
112
+
113
+ return _objectSpread({
114
+ backgroundColor: color,
115
+ color: textColor
116
+ }, style);
118
117
  }
119
-
120
- optionalCustomStyles = _objectSpread({
121
- backgroundColor: color,
122
- color: textColor
123
- }, optionalCustomStyles);
118
+ } catch (err) {
119
+ handleInvalidColor(color);
124
120
  }
125
- } catch (err) {
126
- handleInvalidColor(color);
127
- }
128
-
129
- var classes = classNames('euiBadge', {
130
- 'euiBadge-isClickable': (onClick || href) && !iconOnClick,
131
- 'euiBadge-isDisabled': isDisabled,
132
- 'euiBadge--hollow': color === 'hollow'
133
- }, iconSideToClassNameMap[iconSide], className);
121
+ }, [color, style, euiTheme]);
122
+ var styles = euiBadgeStyles(euiTheme);
123
+ var cssStyles = [styles.euiBadge, (onClick || href) && !iconOnClick && styles.clickable, isDisabled && styles.disabled, color === 'hollow' && styles.hollow];
124
+ var textCssStyles = [styles.text.euiBadge__text, (onClick || href) && !isDisabled && styles.text.clickable];
125
+ var iconCssStyles = [styles.icon.euiBadge__icon, styles.icon[iconSide]];
126
+ var iconButtonCssStyles = [styles.iconButton.euiBadge__iconButton, styles.iconButton[iconSide]];
127
+ var classes = classNames('euiBadge', className);
134
128
  var closeClassNames = classNames('euiBadge__icon', closeButtonProps && closeButtonProps.className);
135
129
  var Element = href && !isDisabled ? 'a' : 'button';
136
130
  var relObj = {};
@@ -160,6 +154,7 @@ export var EuiBadge = function EuiBadge(_ref) {
160
154
  optionalIcon = ___EmotionJSX("button", {
161
155
  type: "button",
162
156
  className: "euiBadge__iconButton",
157
+ css: iconButtonCssStyles,
163
158
  "aria-label": iconOnClickAriaLabel,
164
159
  disabled: isDisabled,
165
160
  title: iconOnClickAriaLabel,
@@ -168,7 +163,8 @@ export var EuiBadge = function EuiBadge(_ref) {
168
163
  type: iconType,
169
164
  size: "s",
170
165
  color: "inherit" // forces the icon to inherit its parent color
171
-
166
+ ,
167
+ css: iconCssStyles
172
168
  }, closeButtonProps, {
173
169
  className: closeClassNames
174
170
  })));
@@ -177,6 +173,7 @@ export var EuiBadge = function EuiBadge(_ref) {
177
173
  type: iconType,
178
174
  size: children ? 's' : 'm',
179
175
  className: "euiBadge__icon",
176
+ css: iconCssStyles,
180
177
  color: "inherit" // forces the icon to inherit its parent color
181
178
 
182
179
  });
@@ -188,28 +185,34 @@ export var EuiBadge = function EuiBadge(_ref) {
188
185
  }
189
186
 
190
187
  var content = ___EmotionJSX("span", {
191
- className: "euiBadge__content"
192
- }, children && ___EmotionJSX("span", {
193
- className: "euiBadge__text"
194
- }, children), optionalIcon);
188
+ className: "euiBadge__content",
189
+ css: styles.euiBadge__content
190
+ }, iconSide === 'left' && optionalIcon, children && ___EmotionJSX("span", {
191
+ className: "euiBadge__text",
192
+ css: textCssStyles
193
+ }, children), iconSide === 'right' && optionalIcon);
195
194
 
196
195
  if (iconOnClick) {
197
196
  return onClick || href ? ___EmotionJSX("span", {
198
197
  className: classes,
198
+ css: cssStyles,
199
199
  style: optionalCustomStyles
200
200
  }, ___EmotionJSX("span", {
201
- className: "euiBadge__content"
202
- }, ___EmotionJSX(EuiInnerText, null, function (ref, innerText) {
201
+ className: "euiBadge__content",
202
+ css: styles.euiBadge__content
203
+ }, iconSide === 'left' && optionalIcon, ___EmotionJSX(EuiInnerText, null, function (ref, innerText) {
203
204
  return ___EmotionJSX(Element, _extends({
204
205
  className: "euiBadge__childButton",
206
+ css: styles.euiBadge__childButton,
205
207
  disabled: isDisabled,
206
208
  "aria-label": onClickAriaLabel,
207
209
  ref: ref,
208
210
  title: innerText
209
211
  }, relObj, rest), children);
210
- }), optionalIcon)) : ___EmotionJSX(EuiInnerText, null, function (ref, innerText) {
212
+ }), iconSide === 'right' && optionalIcon)) : ___EmotionJSX(EuiInnerText, null, function (ref, innerText) {
211
213
  return ___EmotionJSX("span", _extends({
212
214
  className: classes,
215
+ css: cssStyles,
213
216
  style: optionalCustomStyles,
214
217
  ref: ref,
215
218
  title: innerText
@@ -221,6 +224,7 @@ export var EuiBadge = function EuiBadge(_ref) {
221
224
  disabled: isDisabled,
222
225
  "aria-label": onClickAriaLabel,
223
226
  className: classes,
227
+ css: cssStyles,
224
228
  style: optionalCustomStyles,
225
229
  ref: ref,
226
230
  title: innerText
@@ -230,6 +234,7 @@ export var EuiBadge = function EuiBadge(_ref) {
230
234
  return ___EmotionJSX(EuiInnerText, null, function (ref, innerText) {
231
235
  return ___EmotionJSX("span", _extends({
232
236
  className: classes,
237
+ css: cssStyles,
233
238
  style: optionalCustomStyles,
234
239
  ref: ref,
235
240
  title: innerText
@@ -246,12 +251,12 @@ EuiBadge.propTypes = {
246
251
  /**
247
252
  * The side of the badge the icon should sit
248
253
  */
249
- iconSide: PropTypes.oneOf(["left", "right"]),
254
+ iconSide: PropTypes.any,
250
255
 
251
256
  /**
252
257
  * Accepts either our palette colors (primary, success ..etc) or a hex value `#FFFFFF`, `#000`.
253
258
  */
254
- color: PropTypes.oneOfType([PropTypes.string.isRequired, PropTypes.any.isRequired]),
259
+ color: PropTypes.oneOfType([PropTypes.any.isRequired, PropTypes.string.isRequired]),
255
260
 
256
261
  /**
257
262
  * Will override any color passed through the `color` prop.
@@ -296,13 +301,14 @@ function getColorContrast(textColor, color) {
296
301
  return contrastValue;
297
302
  }
298
303
 
299
- function setTextColor(bgColor) {
300
- var textColor = isColorDark.apply(void 0, _toConsumableArray(chroma(bgColor).rgb())) ? colorGhost : colorInk;
304
+ function setTextColor(_ref2, bgColor) {
305
+ var euiTheme = _ref2.euiTheme;
306
+ var textColor = isColorDark.apply(void 0, _toConsumableArray(chroma(bgColor).rgb())) ? euiTheme.colors.ghost : euiTheme.colors.ink;
301
307
  return textColor;
302
308
  }
303
309
 
304
310
  function handleInvalidColor(color) {
305
- var isNamedColor = color && COLORS.includes(color) || color === 'hollow';
311
+ var isNamedColor = COLORS.includes(color);
306
312
  var isValidColorString = color && chromaValid(parseColor(color) || '');
307
313
 
308
314
  if (!isNamedColor && !isValidColorString) {
@@ -0,0 +1,56 @@
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 { euiFontSize, euiFocusRing, euiTextTruncate, logicalCSS, logicalTextAlignCSS } from '../../global_styling';
12
+ import { euiButtonColor } from '../../themes/amsterdam/global_styling/mixins';
13
+ import { tint, transparentize } from '../../services';
14
+
15
+ var _ref = process.env.NODE_ENV === "production" ? {
16
+ name: "1hw5vc4-clickable",
17
+ styles: "cursor:pointer;label:clickable;"
18
+ } : {
19
+ name: "1hw5vc4-clickable",
20
+ styles: "cursor:pointer;label:clickable;",
21
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
22
+ };
23
+
24
+ export var euiBadgeStyles = function euiBadgeStyles(euiThemeContext) {
25
+ var euiTheme = euiThemeContext.euiTheme,
26
+ colorMode = euiThemeContext.colorMode;
27
+ return {
28
+ euiBadge: /*#__PURE__*/css("display:inline-block;vertical-align:middle;padding:0 ", euiTheme.size.s, ";", logicalCSS('max-width', '100%'), " font-size:", euiFontSize(euiThemeContext, 'xs').fontSize, ";line-height:", euiTheme.base + 2, "px;font-weight:", euiTheme.font.weight.medium, ";white-space:nowrap;text-decoration:none;cursor:default;background-color:transparent;border:", euiTheme.border.width.thin, " solid transparent;border-radius:", parseFloat(String(euiTheme.border.radius.medium)) / 2, "px;", logicalTextAlignCSS('left'), " &:focus-within{", euiFocusRing(euiThemeContext), ";}&+.euiBadge{", logicalCSS('margin-left', euiTheme.size.xs), ";};label:euiBadge;"),
29
+ clickable: /*#__PURE__*/css("&:not(:disabled){&:hover,&:focus{text-decoration:underline;}}&:focus{", euiFocusRing(euiThemeContext), ";}&:disabled{cursor:not-allowed;};label:clickable;"),
30
+ disabled: /*#__PURE__*/css("color:", euiButtonColor(euiThemeContext, 'disabled').color, "!important;background-color:", euiButtonColor(euiThemeContext, 'disabled').backgroundColor, "!important;;label:disabled;"),
31
+ // Hollow has a border and is mostly used for autocompleters.
32
+ hollow: /*#__PURE__*/css("background-color:", euiTheme.colors.emptyShade, ";border-color:", colorMode === 'DARK' ? tint(euiTheme.border.color, 0.15) : euiTheme.border.color, ";color:", euiTheme.colors.text, ";;label:hollow;"),
33
+ // Content wrapper
34
+ euiBadge__content: /*#__PURE__*/css(logicalCSS( // Ensure proper height in case of just displaying an icon
35
+ 'min-height', "".concat(euiTheme.base + parseFloat(String(euiTheme.border.width.thin)) * 2, "px")), " display:flex;align-items:center;overflow:hidden;;label:euiBadge__content;"),
36
+ // Text
37
+ text: {
38
+ euiBadge__text: /*#__PURE__*/css(euiTextTruncate(), " cursor:inherit;;label:euiBadge__text;"),
39
+ clickable: _ref
40
+ },
41
+ // Icon
42
+ icon: {
43
+ euiBadge__icon: /*#__PURE__*/css(";label:euiBadge__icon;"),
44
+ right: /*#__PURE__*/css("&:not(:only-child){", logicalCSS('margin-left', euiTheme.size.xs), ";};label:right;"),
45
+ left: /*#__PURE__*/css("&:not(:only-child){", logicalCSS('margin-right', euiTheme.size.xs), ";};label:left;")
46
+ },
47
+ // Clickable icons (iconOnClick)
48
+ iconButton: {
49
+ euiBadge__iconButton: /*#__PURE__*/css("font-size:0;&:focus{background-color:", transparentize(euiTheme.colors.ghost, 0.8), ";color:", euiTheme.colors.ink, ";border-radius:", parseFloat(String(euiTheme.border.radius.small)) / 2, "px;}&:disabled{cursor:not-allowed;}.euiBadge__icon{margin:0!important;};label:euiBadge__iconButton;"),
50
+ right: /*#__PURE__*/css(logicalCSS('margin-left', euiTheme.size.xs), ";;label:right;"),
51
+ left: /*#__PURE__*/css(logicalCSS('margin-right', euiTheme.size.xs), ";;label:left;")
52
+ },
53
+ // Used in badges with both onClick & iconOnClick
54
+ euiBadge__childButton: /*#__PURE__*/css(euiTextTruncate(), " text-align:inherit;font-weight:inherit;line-height:inherit;color:inherit;&:disabled{cursor:not-allowed;}&:not(:disabled){&:hover,&:focus{text-decoration:underline;}};label:euiBadge__childButton;")
55
+ };
56
+ };
@@ -541,6 +541,10 @@ export var EuiInMemoryTable = /*#__PURE__*/function (_Component) {
541
541
 
542
542
  if (sortName !== prevState.prevProps.sortName || sortDirection !== prevState.prevProps.sortDirection) {
543
543
  updatedPrevState = _objectSpread(_objectSpread({}, updatedPrevState), {}, {
544
+ prevProps: _objectSpread(_objectSpread({}, updatedPrevState.prevProps), {}, {
545
+ sortName: sortName,
546
+ sortDirection: sortDirection
547
+ }),
544
548
  sortName: sortName,
545
549
  sortDirection: sortDirection
546
550
  });
@@ -1110,6 +1114,10 @@ EuiInMemoryTable.propTypes = {
1110
1114
  operator: PropTypes.oneOf(["eq", "exact", "gt", "gte", "lt", "lte"])
1111
1115
  }).isRequired).isRequired,
1112
1116
  available: PropTypes.func
1117
+ }).isRequired, PropTypes.shape({
1118
+ type: PropTypes.oneOf(["custom_component"]).isRequired,
1119
+ component: PropTypes.elementType.isRequired,
1120
+ available: PropTypes.func
1113
1121
  }).isRequired]).isRequired),
1114
1122
 
1115
1123
  /**
@@ -134,7 +134,6 @@ EuiButton.propTypes = {
134
134
  EuiButton.displayName = 'EuiButton'; // Use defaultProps for simple pass-through props
135
135
 
136
136
  EuiButton.defaultProps = {
137
- minWidth: 112,
138
137
  size: 'm',
139
138
  color: 'primary'
140
139
  };
@@ -1,4 +1,4 @@
1
- var _excluded = ["children", "iconType", "iconSide", "size", "isDisabled", "disabled", "isLoading", "isSelected", "fullWidth", "minWidth", "contentProps", "textProps", "href", "target", "rel", "type"];
1
+ var _excluded = ["children", "iconType", "iconSide", "iconSize", "size", "isDisabled", "disabled", "isLoading", "isSelected", "fullWidth", "minWidth", "contentProps", "textProps", "href", "target", "rel", "type", "style"];
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
 
@@ -46,6 +46,7 @@ export var EuiButtonDisplay = /*#__PURE__*/forwardRef(function (_ref2, ref) {
46
46
  var children = _ref2.children,
47
47
  iconType = _ref2.iconType,
48
48
  iconSide = _ref2.iconSide,
49
+ iconSize = _ref2.iconSize,
49
50
  _ref2$size = _ref2.size,
50
51
  size = _ref2$size === void 0 ? 'm' : _ref2$size,
51
52
  isDisabled = _ref2.isDisabled,
@@ -61,6 +62,7 @@ export var EuiButtonDisplay = /*#__PURE__*/forwardRef(function (_ref2, ref) {
61
62
  rel = _ref2.rel,
62
63
  _ref2$type = _ref2.type,
63
64
  type = _ref2$type === void 0 ? 'button' : _ref2$type,
65
+ style = _ref2.style,
64
66
  rest = _objectWithoutProperties(_ref2, _excluded);
65
67
 
66
68
  var buttonIsDisabled = isButtonDisabled({
@@ -68,9 +70,8 @@ export var EuiButtonDisplay = /*#__PURE__*/forwardRef(function (_ref2, ref) {
68
70
  isDisabled: isDisabled || disabled,
69
71
  isLoading: isLoading
70
72
  });
71
- var minWidthPx = typeof minWidth === 'number' ? "".concat(minWidth, "px") : minWidth;
72
73
  var theme = useEuiTheme();
73
- var styles = euiButtonDisplayStyles(theme, minWidthPx);
74
+ var styles = euiButtonDisplayStyles(theme);
74
75
  var buttonRadiusStyle = useEuiButtonRadiusCSS()[size];
75
76
  var cssStyles = [styles.euiButtonDisplay, styles[size], fullWidth && styles.fullWidth, buttonIsDisabled && styles.isDisabled, buttonRadiusStyle];
76
77
 
@@ -79,6 +80,7 @@ export var EuiButtonDisplay = /*#__PURE__*/forwardRef(function (_ref2, ref) {
79
80
  isDisabled: buttonIsDisabled,
80
81
  iconType: iconType,
81
82
  iconSide: iconSide,
83
+ iconSize: iconSize,
82
84
  textProps: _objectSpread({}, textProps)
83
85
  }, contentProps), children);
84
86
 
@@ -108,6 +110,9 @@ export var EuiButtonDisplay = /*#__PURE__*/forwardRef(function (_ref2, ref) {
108
110
 
109
111
  return createElement(element, _objectSpread(_objectSpread(_objectSpread({
110
112
  css: cssStyles,
113
+ style: minWidth ? _objectSpread(_objectSpread({}, style), {}, {
114
+ minWidth: minWidth
115
+ }) : style,
111
116
  ref: ref
112
117
  }, elementProps), relObj), rest), innerNode);
113
118
  });
@@ -158,7 +163,16 @@ EuiButtonDisplay.propTypes = {
158
163
  /**
159
164
  * Object of props passed to the <span/> wrapping the button's content
160
165
  */
161
- contentProps: PropTypes.any,
166
+
167
+ /**
168
+ * Object of props passed to the <span/> wrapping the button's content
169
+ */
170
+ contentProps: PropTypes.shape({
171
+ className: PropTypes.string,
172
+ "aria-label": PropTypes.string,
173
+ "data-test-subj": PropTypes.string,
174
+ css: PropTypes.any
175
+ }),
162
176
  style: PropTypes.any,
163
177
 
164
178
  /**
@@ -169,7 +183,7 @@ EuiButtonDisplay.propTypes = {
169
183
  /**
170
184
  * Can only be one side `left` or `right`
171
185
  */
172
- iconSide: PropTypes.oneOf(["left", "right", undefined]),
186
+ iconSide: PropTypes.oneOfType([PropTypes.any.isRequired, PropTypes.oneOf([undefined])]),
173
187
 
174
188
  /**
175
189
  * Object of props passed to the <span/> wrapping the content's text/children only (not icon)
@@ -182,7 +196,7 @@ EuiButtonDisplay.propTypes = {
182
196
  ref: PropTypes.any,
183
197
  "data-text": PropTypes.string
184
198
  }),
185
- iconSize: PropTypes.oneOf(["s", "m"]),
199
+ iconSize: PropTypes.any,
186
200
  isDisabled: PropTypes.bool,
187
201
  className: PropTypes.string,
188
202
  "aria-label": PropTypes.string,
@@ -28,11 +28,11 @@ var _ref = process.env.NODE_ENV === "production" ? {
28
28
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
29
29
  };
30
30
 
31
- export var euiButtonDisplayStyles = function euiButtonDisplayStyles(euiThemeContext, minWidth) {
31
+ export var euiButtonDisplayStyles = function euiButtonDisplayStyles(euiThemeContext) {
32
32
  var euiTheme = euiThemeContext.euiTheme;
33
33
  return {
34
34
  // Base
35
- euiButtonDisplay: /*#__PURE__*/css(euiButtonBaseCSS(), ";", minWidth && logicalCSS('min-width', minWidth), ";font-weight:", euiTheme.font.weight.medium, ";padding:0 ", euiTheme.size.m, ";&:hover:not(:disabled),&:focus{text-decoration:underline;};label:euiButtonDisplay;"),
35
+ euiButtonDisplay: /*#__PURE__*/css(euiButtonBaseCSS(), ";", logicalCSS('min-width', "".concat(euiTheme.base * 7, "px")), " font-weight:", euiTheme.font.weight.medium, ";padding:0 ", euiTheme.size.m, ";&:hover:not(:disabled),&:focus{text-decoration:underline;};label:euiButtonDisplay;"),
36
36
  // States
37
37
  isDisabled: _ref,
38
38
  fullWidth: /*#__PURE__*/css("display:block;", logicalCSS('width', '100%'), ";;label:fullWidth;"),
@@ -21,6 +21,8 @@ import { EuiIcon } from '../../icon';
21
21
  import { euiButtonDisplayContentStyles } from './_button_display_content.styles';
22
22
  import classNames from 'classnames';
23
23
  import { jsx as ___EmotionJSX } from "@emotion/react";
24
+ export var ICON_SIZES = ['s', 'm'];
25
+ export var ICON_SIDES = ['left', 'right'];
24
26
  export var EuiButtonDisplayContent = function EuiButtonDisplayContent(_ref) {
25
27
  var children = _ref.children,
26
28
  textProps = _ref.textProps,
@@ -38,7 +40,7 @@ export var EuiButtonDisplayContent = function EuiButtonDisplayContent(_ref) {
38
40
  var styles = euiButtonDisplayContentStyles(theme);
39
41
  var cssStyles = [styles.euiButtonDisplayContent, iconSide && styles[iconSide]];
40
42
  var cssSpinnerStyles = [styles.euiButtonDisplayContent__spinner];
41
- var cssIconStyles = [styles.euiButtonDisplayContent__icon]; // Add an icon to the button if one exists.
43
+ var cssIconStyles = [styles.euiButtonDisplayContent__icon, iconSize && styles[iconSize]]; // Add an icon to the button if one exists.
42
44
 
43
45
  var icon; // When the button is disabled the text gets gray
44
46
  // and in some buttons the background gets a light gray
@@ -82,7 +84,7 @@ EuiButtonDisplayContent.propTypes = {
82
84
  /**
83
85
  * Can only be one side `left` or `right`
84
86
  */
85
- iconSide: PropTypes.oneOf(["left", "right", undefined]),
87
+ iconSide: PropTypes.oneOfType([PropTypes.any.isRequired, PropTypes.oneOf([undefined])]),
86
88
  isLoading: PropTypes.bool,
87
89
 
88
90
  /**
@@ -96,7 +98,7 @@ EuiButtonDisplayContent.propTypes = {
96
98
  ref: PropTypes.any,
97
99
  "data-text": PropTypes.string
98
100
  }),
99
- iconSize: PropTypes.oneOf(["s", "m"]),
101
+ iconSize: PropTypes.any,
100
102
  isDisabled: PropTypes.bool,
101
103
  className: PropTypes.string,
102
104
  "aria-label": PropTypes.string,
@@ -46,6 +46,9 @@ export var euiButtonDisplayContentStyles = function euiButtonDisplayContentStyle
46
46
  left: /*#__PURE__*/css(";label:left;"),
47
47
  right: _ref3,
48
48
  euiButtonDisplayContent__spinner: _ref2,
49
- euiButtonDisplayContent__icon: _ref
49
+ euiButtonDisplayContent__icon: _ref,
50
+ // Icon size
51
+ s: /*#__PURE__*/css(";label:s;"),
52
+ m: /*#__PURE__*/css(";label:m;")
50
53
  };
51
54
  };
@@ -198,7 +198,16 @@ EuiButtonEmpty.propTypes = {
198
198
  /**
199
199
  * Object of props passed to the <span/> wrapping the button's content
200
200
  */
201
- contentProps: PropTypes.any,
201
+
202
+ /**
203
+ * Object of props passed to the <span/> wrapping the button's content
204
+ */
205
+ contentProps: PropTypes.shape({
206
+ className: PropTypes.string,
207
+ "aria-label": PropTypes.string,
208
+ "data-test-subj": PropTypes.string,
209
+ css: PropTypes.any
210
+ }),
202
211
 
203
212
  /**
204
213
  * Any `type` accepted by EuiIcon
@@ -82,7 +82,7 @@ export var EuiCard = function EuiCard(_ref) {
82
82
  var isDisabled = _isDisabled || !isHrefValid;
83
83
  var isClickable = !isDisabled && (onClick || href || selectable && !selectable.isDisabled);
84
84
  var euiThemeContext = useEuiTheme();
85
- var styles = euiCardStyles(euiThemeContext, paddingSize, display);
85
+ var styles = euiCardStyles(euiThemeContext, paddingSize);
86
86
  var cardStyles = [styles.card.euiCard, // Text alignment should always be left when horizontal
87
87
  styles.card.aligned[layout === 'horizontal' ? 'left' : textAlign], styles.card.layout[layout], isDisabled && styles.card.disabled];
88
88
  var contentStyles = [styles.content.euiCard__content, styles.content.layout[layout]];
@@ -128,7 +128,7 @@ export var EuiCard = function EuiCard(_ref) {
128
128
 
129
129
  if (image && layout === 'vertical') {
130
130
  if ( /*#__PURE__*/isValidElement(image) || typeof image === 'string') {
131
- var imageStyles = [styles.euiCard__image];
131
+ var imageStyles = [styles.image.euiCard__image, display === 'transparent' && styles.image.transparent];
132
132
  imageNode = ___EmotionJSX("div", {
133
133
  className: "euiCard__image",
134
134
  css: imageStyles
@@ -54,7 +54,7 @@ var _ref5 = process.env.NODE_ENV === "production" ? {
54
54
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
55
55
  };
56
56
 
57
- export var euiCardStyles = function euiCardStyles(euiThemeContext, paddingSize, color) {
57
+ export var euiCardStyles = function euiCardStyles(euiThemeContext, paddingSize) {
58
58
  var euiTheme = euiThemeContext.euiTheme;
59
59
  var paddingAmount = euiPaddingSize(euiThemeContext, paddingSize);
60
60
  var spacing = euiPaddingSize(euiThemeContext, paddingKey);
@@ -91,7 +91,10 @@ export var euiCardStyles = function euiCardStyles(euiThemeContext, paddingSize,
91
91
  },
92
92
  disabled: _ref2
93
93
  },
94
- euiCard__image: /*#__PURE__*/css("position:relative;overflow:hidden;", logicalCSS('width', "calc(100% + (".concat(paddingAmount, " * 2))")), ";", logicalCSS('left', "-".concat(paddingAmount)), ";", logicalCSS('top', "-".concat(paddingAmount)), ";", logicalCSS('margin-bottom', "-".concat(paddingAmount)), ";", logicalCSS('border-top-left-radius', "calc(".concat(euiTheme.border.radius.medium, " - ").concat(euiTheme.border.width.thin, ")")), " ", logicals['border-top-right-radius'], ":calc(", euiTheme.border.radius.medium, " - ", euiTheme.border.width.thin, ");", color === 'transparent' ? "border-radius: ".concat(euiTheme.border.radius.medium, ";") : undefined, " img{", logicalCSS('width', '100%'), ";};label:euiCard__image;"),
94
+ image: {
95
+ euiCard__image: /*#__PURE__*/css("position:relative;overflow:hidden;", logicalCSS('width', "calc(100% + (".concat(paddingAmount, " * 2))")), ";", logicalCSS('left', "-".concat(paddingAmount)), ";", logicalCSS('top', "-".concat(paddingAmount)), ";", logicalCSS('margin-bottom', "-".concat(paddingAmount)), ";", logicalCSS('border-top-left-radius', "calc(".concat(euiTheme.border.radius.medium, " - ").concat(euiTheme.border.width.thin, ")")), " ", logicals['border-top-right-radius'], ":calc(", euiTheme.border.radius.medium, " - ", euiTheme.border.width.thin, ");img{", logicalCSS('width', '100%'), ";};label:euiCard__image;"),
96
+ transparent: /*#__PURE__*/css("border-radius:", euiTheme.border.radius.medium, ";;label:transparent;")
97
+ },
95
98
  icon: {
96
99
  euiCard__icon: /*#__PURE__*/css(";label:euiCard__icon;"),
97
100
  withImage: /*#__PURE__*/css("position:absolute;", logicalCSS('top', '50%'), ";", logicalCSS('left', '50%'), ";transform:translate(-50%, calc(-50% + -", paddingAmount, "))!important;;label:withImage;"),
@@ -186,11 +186,6 @@ EuiCollapsibleNav.propTypes = {
186
186
  "data-test-subj": PropTypes.string,
187
187
  css: PropTypes.any,
188
188
 
189
- /**
190
- * Function that applies to clicking the mask itself and not the children
191
- */
192
- onClick: PropTypes.func,
193
-
194
189
  /**
195
190
  * ReactNode to render as this component's content
196
191
  */
@@ -203,7 +203,12 @@ EuiAutoRefreshButton.propTypes = {
203
203
  /**
204
204
  * Object of props passed to the <span/> wrapping the button's content
205
205
  */
206
- contentProps: PropTypes.any,
206
+ contentProps: PropTypes.shape({
207
+ className: PropTypes.string,
208
+ "aria-label": PropTypes.string,
209
+ "data-test-subj": PropTypes.string,
210
+ css: PropTypes.any
211
+ }),
207
212
 
208
213
  /**
209
214
  * Object of props passed to the <span/> wrapping the content's text (only if the children is a `string`)
@@ -16,7 +16,6 @@ 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
- // eslint-disable-line import/named
20
19
  import { useEuiI18n } from '../../../i18n';
21
20
  import { EuiPopover } from '../../../popover';
22
21
  import { useFormatTimeString } from '../pretty_duration';
@@ -93,7 +92,12 @@ export var EuiDatePopoverButton = function EuiDatePopoverButton(props) {
93
92
  };
94
93
  EuiDatePopoverButton.propTypes = {
95
94
  className: PropTypes.string,
96
- buttonProps: PropTypes.any,
95
+ buttonProps: PropTypes.shape({
96
+ className: PropTypes.string,
97
+ "aria-label": PropTypes.string,
98
+ "data-test-subj": PropTypes.string,
99
+ css: PropTypes.any
100
+ }),
97
101
  dateFormat: PropTypes.string.isRequired,
98
102
  isDisabled: PropTypes.bool,
99
103
  isInvalid: PropTypes.bool,
@@ -99,7 +99,12 @@ EuiExpression.propTypes = {
99
99
  * First part of the expression
100
100
  */
101
101
  description: PropTypes.node.isRequired,
102
- descriptionProps: PropTypes.any,
102
+ descriptionProps: PropTypes.shape({
103
+ className: PropTypes.string,
104
+ "aria-label": PropTypes.string,
105
+ "data-test-subj": PropTypes.string,
106
+ css: PropTypes.any
107
+ }),
103
108
 
104
109
  /**
105
110
  * Second part of the expression
@@ -109,7 +114,12 @@ EuiExpression.propTypes = {
109
114
  * Second part of the expression
110
115
  */
111
116
  value: PropTypes.node,
112
- valueProps: PropTypes.any,
117
+ valueProps: PropTypes.shape({
118
+ className: PropTypes.string,
119
+ "aria-label": PropTypes.string,
120
+ "data-test-subj": PropTypes.string,
121
+ css: PropTypes.any
122
+ }),
113
123
 
114
124
  /**
115
125
  * Color of the `description`