@elastic/eui 67.0.0 → 67.1.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 (283) hide show
  1. package/dist/eui_theme_dark.css +0 -390
  2. package/dist/eui_theme_dark.json +0 -24
  3. package/dist/eui_theme_dark.json.d.ts +0 -24
  4. package/dist/eui_theme_dark.min.css +1 -1
  5. package/dist/eui_theme_light.css +0 -390
  6. package/dist/eui_theme_light.json +0 -24
  7. package/dist/eui_theme_light.json.d.ts +0 -24
  8. package/dist/eui_theme_light.min.css +1 -1
  9. package/es/components/accordion/accordion.js +5 -4
  10. package/es/components/accordion/accordion.styles.js +1 -1
  11. package/es/components/badge/badge.js +84 -78
  12. package/es/components/badge/badge.styles.js +62 -0
  13. package/es/components/basic_table/in_memory_table.js +8 -0
  14. package/es/components/breadcrumbs/breadcrumb.styles.js +4 -2
  15. package/es/components/button/button.js +0 -1
  16. package/es/components/button/button_display/_button_display.js +10 -5
  17. package/es/components/button/button_display/_button_display.styles.js +2 -2
  18. package/es/components/button/button_display/_button_display_content.js +5 -3
  19. package/es/components/button/button_display/_button_display_content.styles.js +4 -1
  20. package/es/components/button/button_icon/button_icon.js +11 -7
  21. package/es/components/card/card.js +2 -2
  22. package/es/components/card/card.styles.js +5 -2
  23. package/es/components/collapsible_nav/collapsible_nav.js +8 -0
  24. package/es/components/expression/expression.styles.js +4 -2
  25. package/es/components/flyout/flyout.js +27 -48
  26. package/es/components/flyout/flyout.styles.js +111 -0
  27. package/es/components/flyout/flyout_body.js +14 -6
  28. package/es/components/flyout/flyout_body.styles.js +21 -0
  29. package/es/components/flyout/flyout_footer.js +8 -1
  30. package/es/components/flyout/flyout_footer.styles.js +14 -0
  31. package/es/components/flyout/flyout_header.js +9 -4
  32. package/es/components/flyout/flyout_header.styles.js +28 -0
  33. package/es/components/image/image_wrapper.js +3 -3
  34. package/es/components/markdown_editor/markdown_format.styles.js +11 -6
  35. package/es/components/notification/notification_event.js +1 -1
  36. package/es/components/notification/notification_event_meta.js +1 -1
  37. package/es/components/page/page_header/page_header_content.js +1 -1
  38. package/es/components/page/page_section/page_section.js +3 -4
  39. package/es/components/pagination/pagination_button.styles.js +5 -3
  40. package/es/components/popover/popover_title.js +2 -2
  41. package/es/components/popover/popover_title.styles.js +18 -6
  42. package/es/components/progress/progress.js +2 -2
  43. package/es/components/search_bar/filters/custom_component_filter.js +16 -0
  44. package/es/components/search_bar/filters/filters.js +6 -0
  45. package/es/components/search_bar/query/ast.js +12 -0
  46. package/es/components/search_bar/query/ast_to_es_query_dsl.js +15 -10
  47. package/es/components/search_bar/query/query.js +17 -0
  48. package/es/components/search_bar/search_bar.js +4 -0
  49. package/es/components/search_bar/search_filters.js +4 -0
  50. package/es/components/selectable/selectable_list/selectable_list.js +2 -2
  51. package/es/components/selectable/selectable_list/selectable_list_item.js +2 -2
  52. package/es/components/text/text.styles.js +6 -3
  53. package/es/components/tool_tip/tool_tip.styles.js +7 -6
  54. package/es/components/tour/tour.styles.js +11 -6
  55. package/es/global_styling/functions/index.js +1 -0
  56. package/es/global_styling/functions/math.js +46 -0
  57. package/es/global_styling/mixins/_helpers.js +5 -2
  58. package/es/services/color/contrast.js +2 -0
  59. package/es/services/index.js +1 -1
  60. package/es/services/theme/context.js +2 -1
  61. package/es/services/theme/hooks.js +27 -1
  62. package/es/services/theme/index.js +1 -1
  63. package/es/services/theme/provider.js +15 -1
  64. package/eui.d.ts +199 -35
  65. package/i18ntokens.json +2 -2
  66. package/lib/components/accordion/accordion.js +5 -4
  67. package/lib/components/accordion/accordion.styles.js +1 -1
  68. package/lib/components/badge/badge.js +92 -80
  69. package/lib/components/badge/badge.styles.js +67 -0
  70. package/lib/components/basic_table/in_memory_table.js +8 -0
  71. package/lib/components/breadcrumbs/breadcrumb.styles.js +3 -1
  72. package/lib/components/button/button.js +0 -1
  73. package/lib/components/button/button_display/_button_display.js +10 -5
  74. package/lib/components/button/button_display/_button_display.styles.js +2 -2
  75. package/lib/components/button/button_display/_button_display_content.js +9 -4
  76. package/lib/components/button/button_display/_button_display_content.styles.js +4 -1
  77. package/lib/components/button/button_icon/button_icon.js +11 -7
  78. package/lib/components/card/card.js +2 -2
  79. package/lib/components/card/card.styles.js +5 -2
  80. package/lib/components/collapsible_nav/collapsible_nav.js +8 -0
  81. package/lib/components/expression/expression.styles.js +3 -1
  82. package/lib/components/flyout/flyout.js +27 -47
  83. package/lib/components/flyout/flyout.styles.js +122 -0
  84. package/lib/components/flyout/flyout_body.js +16 -6
  85. package/lib/components/flyout/flyout_body.styles.js +32 -0
  86. package/lib/components/flyout/flyout_footer.js +10 -1
  87. package/lib/components/flyout/flyout_footer.styles.js +24 -0
  88. package/lib/components/flyout/flyout_header.js +11 -4
  89. package/lib/components/flyout/flyout_header.styles.js +31 -0
  90. package/lib/components/image/image_wrapper.js +3 -3
  91. package/lib/components/markdown_editor/markdown_format.styles.js +10 -5
  92. package/lib/components/notification/notification_event.js +1 -1
  93. package/lib/components/notification/notification_event_meta.js +1 -1
  94. package/lib/components/page/page_header/page_header_content.js +1 -1
  95. package/lib/components/page/page_section/page_section.js +3 -4
  96. package/lib/components/pagination/pagination_button.styles.js +4 -2
  97. package/lib/components/popover/popover_title.js +2 -2
  98. package/lib/components/popover/popover_title.styles.js +19 -7
  99. package/lib/components/progress/progress.js +2 -2
  100. package/lib/components/search_bar/filters/custom_component_filter.js +29 -0
  101. package/lib/components/search_bar/filters/filters.js +7 -0
  102. package/lib/components/search_bar/query/ast.js +12 -0
  103. package/lib/components/search_bar/query/ast_to_es_query_dsl.js +16 -11
  104. package/lib/components/search_bar/query/query.js +17 -0
  105. package/lib/components/search_bar/search_bar.js +4 -0
  106. package/lib/components/search_bar/search_filters.js +4 -0
  107. package/lib/components/selectable/selectable_list/selectable_list.js +2 -2
  108. package/lib/components/selectable/selectable_list/selectable_list_item.js +2 -2
  109. package/lib/components/text/text.styles.js +5 -2
  110. package/lib/components/tool_tip/tool_tip.styles.js +6 -5
  111. package/lib/components/tour/tour.styles.js +10 -5
  112. package/lib/global_styling/functions/index.js +13 -0
  113. package/lib/global_styling/functions/math.js +55 -0
  114. package/lib/global_styling/mixins/_helpers.js +5 -2
  115. package/lib/services/color/contrast.js +6 -1
  116. package/lib/services/index.js +7 -0
  117. package/lib/services/theme/context.js +4 -2
  118. package/lib/services/theme/hooks.js +28 -0
  119. package/lib/services/theme/index.js +12 -0
  120. package/lib/services/theme/provider.js +23 -2
  121. package/optimize/es/components/accordion/accordion.js +5 -4
  122. package/optimize/es/components/accordion/accordion.styles.js +1 -1
  123. package/optimize/es/components/badge/badge.js +82 -76
  124. package/optimize/es/components/badge/badge.styles.js +62 -0
  125. package/optimize/es/components/basic_table/in_memory_table.js +4 -0
  126. package/optimize/es/components/breadcrumbs/breadcrumb.styles.js +4 -2
  127. package/optimize/es/components/button/button.js +0 -1
  128. package/optimize/es/components/button/button_display/_button_display.js +8 -3
  129. package/optimize/es/components/button/button_display/_button_display.styles.js +2 -2
  130. package/optimize/es/components/button/button_display/_button_display_content.js +3 -1
  131. package/optimize/es/components/button/button_display/_button_display_content.styles.js +4 -1
  132. package/optimize/es/components/button/button_icon/button_icon.js +11 -7
  133. package/optimize/es/components/card/card.js +2 -2
  134. package/optimize/es/components/card/card.styles.js +5 -2
  135. package/optimize/es/components/expression/expression.styles.js +4 -2
  136. package/optimize/es/components/flyout/flyout.js +27 -48
  137. package/optimize/es/components/flyout/flyout.styles.js +111 -0
  138. package/optimize/es/components/flyout/flyout_body.js +14 -6
  139. package/optimize/es/components/flyout/flyout_body.styles.js +21 -0
  140. package/optimize/es/components/flyout/flyout_footer.js +8 -1
  141. package/optimize/es/components/flyout/flyout_footer.styles.js +14 -0
  142. package/optimize/es/components/flyout/flyout_header.js +9 -4
  143. package/optimize/es/components/flyout/flyout_header.styles.js +28 -0
  144. package/optimize/es/components/image/image_wrapper.js +3 -3
  145. package/optimize/es/components/markdown_editor/markdown_format.styles.js +11 -6
  146. package/optimize/es/components/page/page_header/page_header_content.js +1 -1
  147. package/optimize/es/components/page/page_section/page_section.js +3 -4
  148. package/optimize/es/components/pagination/pagination_button.styles.js +5 -3
  149. package/optimize/es/components/popover/popover_title.js +2 -2
  150. package/optimize/es/components/popover/popover_title.styles.js +18 -6
  151. package/optimize/es/components/progress/progress.js +2 -2
  152. package/optimize/es/components/search_bar/filters/custom_component_filter.js +16 -0
  153. package/optimize/es/components/search_bar/filters/filters.js +6 -0
  154. package/optimize/es/components/search_bar/query/ast.js +12 -0
  155. package/optimize/es/components/search_bar/query/ast_to_es_query_dsl.js +14 -9
  156. package/optimize/es/components/search_bar/query/query.js +17 -0
  157. package/optimize/es/components/text/text.styles.js +6 -3
  158. package/optimize/es/components/tool_tip/tool_tip.styles.js +7 -6
  159. package/optimize/es/components/tour/tour.styles.js +11 -6
  160. package/optimize/es/global_styling/functions/index.js +1 -0
  161. package/optimize/es/global_styling/functions/math.js +44 -0
  162. package/optimize/es/global_styling/mixins/_helpers.js +5 -2
  163. package/optimize/es/services/color/contrast.js +2 -0
  164. package/optimize/es/services/index.js +1 -1
  165. package/optimize/es/services/theme/context.js +2 -1
  166. package/optimize/es/services/theme/hooks.js +27 -1
  167. package/optimize/es/services/theme/index.js +1 -1
  168. package/optimize/es/services/theme/provider.js +14 -1
  169. package/optimize/lib/components/accordion/accordion.js +5 -4
  170. package/optimize/lib/components/accordion/accordion.styles.js +1 -1
  171. package/optimize/lib/components/badge/badge.js +90 -78
  172. package/optimize/lib/components/badge/badge.styles.js +67 -0
  173. package/optimize/lib/components/basic_table/in_memory_table.js +4 -0
  174. package/optimize/lib/components/breadcrumbs/breadcrumb.styles.js +3 -1
  175. package/optimize/lib/components/button/button.js +0 -1
  176. package/optimize/lib/components/button/button_display/_button_display.js +8 -3
  177. package/optimize/lib/components/button/button_display/_button_display.styles.js +2 -2
  178. package/optimize/lib/components/button/button_display/_button_display_content.js +6 -2
  179. package/optimize/lib/components/button/button_display/_button_display_content.styles.js +4 -1
  180. package/optimize/lib/components/button/button_icon/button_icon.js +11 -7
  181. package/optimize/lib/components/card/card.js +2 -2
  182. package/optimize/lib/components/card/card.styles.js +5 -2
  183. package/optimize/lib/components/expression/expression.styles.js +3 -1
  184. package/optimize/lib/components/flyout/flyout.js +27 -47
  185. package/optimize/lib/components/flyout/flyout.styles.js +124 -0
  186. package/optimize/lib/components/flyout/flyout_body.js +16 -6
  187. package/optimize/lib/components/flyout/flyout_body.styles.js +32 -0
  188. package/optimize/lib/components/flyout/flyout_footer.js +10 -1
  189. package/optimize/lib/components/flyout/flyout_footer.styles.js +24 -0
  190. package/optimize/lib/components/flyout/flyout_header.js +11 -4
  191. package/optimize/lib/components/flyout/flyout_header.styles.js +31 -0
  192. package/optimize/lib/components/image/image_wrapper.js +3 -3
  193. package/optimize/lib/components/markdown_editor/markdown_format.styles.js +10 -5
  194. package/optimize/lib/components/page/page_header/page_header_content.js +1 -1
  195. package/optimize/lib/components/page/page_section/page_section.js +3 -4
  196. package/optimize/lib/components/pagination/pagination_button.styles.js +4 -2
  197. package/optimize/lib/components/popover/popover_title.js +2 -2
  198. package/optimize/lib/components/popover/popover_title.styles.js +19 -7
  199. package/optimize/lib/components/progress/progress.js +2 -2
  200. package/optimize/lib/components/search_bar/filters/custom_component_filter.js +29 -0
  201. package/optimize/lib/components/search_bar/filters/filters.js +7 -0
  202. package/optimize/lib/components/search_bar/query/ast.js +12 -0
  203. package/optimize/lib/components/search_bar/query/ast_to_es_query_dsl.js +16 -11
  204. package/optimize/lib/components/search_bar/query/query.js +17 -0
  205. package/optimize/lib/components/text/text.styles.js +5 -2
  206. package/optimize/lib/components/tool_tip/tool_tip.styles.js +6 -5
  207. package/optimize/lib/components/tour/tour.styles.js +10 -5
  208. package/optimize/lib/global_styling/functions/index.js +13 -0
  209. package/optimize/lib/global_styling/functions/math.js +57 -0
  210. package/optimize/lib/global_styling/mixins/_helpers.js +5 -2
  211. package/optimize/lib/services/color/contrast.js +5 -1
  212. package/optimize/lib/services/index.js +7 -0
  213. package/optimize/lib/services/theme/context.js +4 -2
  214. package/optimize/lib/services/theme/hooks.js +28 -0
  215. package/optimize/lib/services/theme/index.js +12 -0
  216. package/optimize/lib/services/theme/provider.js +23 -9
  217. package/package.json +5 -5
  218. package/src/components/badge/_index.scss +0 -1
  219. package/src/components/index.scss +0 -1
  220. package/src/themes/amsterdam/global_styling/variables/_index.scss +0 -1
  221. package/test-env/components/accordion/accordion.js +5 -4
  222. package/test-env/components/accordion/accordion.styles.js +1 -1
  223. package/test-env/components/badge/badge.js +92 -80
  224. package/test-env/components/badge/badge.styles.js +67 -0
  225. package/test-env/components/basic_table/in_memory_table.js +8 -0
  226. package/test-env/components/breadcrumbs/breadcrumb.styles.js +3 -1
  227. package/test-env/components/button/button.js +0 -1
  228. package/test-env/components/button/button_display/_button_display.js +10 -5
  229. package/test-env/components/button/button_display/_button_display.styles.js +2 -2
  230. package/test-env/components/button/button_display/_button_display_content.js +8 -4
  231. package/test-env/components/button/button_display/_button_display_content.styles.js +4 -1
  232. package/test-env/components/button/button_icon/button_icon.js +11 -7
  233. package/test-env/components/card/card.js +2 -2
  234. package/test-env/components/card/card.styles.js +5 -2
  235. package/test-env/components/collapsible_nav/collapsible_nav.js +8 -0
  236. package/test-env/components/expression/expression.styles.js +3 -1
  237. package/test-env/components/flyout/flyout.styles.js +124 -0
  238. package/test-env/components/flyout/flyout_body.js +16 -6
  239. package/test-env/components/flyout/flyout_body.styles.js +32 -0
  240. package/test-env/components/flyout/flyout_footer.js +10 -1
  241. package/test-env/components/flyout/flyout_footer.styles.js +24 -0
  242. package/test-env/components/flyout/flyout_header.js +11 -4
  243. package/test-env/components/flyout/flyout_header.styles.js +31 -0
  244. package/test-env/components/image/image_wrapper.js +3 -3
  245. package/test-env/components/markdown_editor/markdown_format.styles.js +10 -5
  246. package/test-env/components/notification/notification_event.js +1 -1
  247. package/test-env/components/notification/notification_event_meta.js +1 -1
  248. package/test-env/components/page/page_header/page_header_content.js +1 -1
  249. package/test-env/components/page/page_section/page_section.js +3 -4
  250. package/test-env/components/pagination/pagination_button.styles.js +4 -2
  251. package/test-env/components/popover/popover_title.js +2 -2
  252. package/test-env/components/popover/popover_title.styles.js +19 -7
  253. package/test-env/components/progress/progress.js +2 -2
  254. package/test-env/components/search_bar/filters/custom_component_filter.js +29 -0
  255. package/test-env/components/search_bar/filters/filters.js +7 -0
  256. package/test-env/components/search_bar/query/ast.js +12 -0
  257. package/test-env/components/search_bar/query/ast_to_es_query_dsl.js +16 -11
  258. package/test-env/components/search_bar/query/query.js +17 -0
  259. package/test-env/components/search_bar/search_bar.js +4 -0
  260. package/test-env/components/search_bar/search_filters.js +4 -0
  261. package/test-env/components/selectable/selectable_list/selectable_list.js +2 -2
  262. package/test-env/components/selectable/selectable_list/selectable_list_item.js +2 -2
  263. package/test-env/components/text/text.styles.js +5 -2
  264. package/test-env/components/tool_tip/tool_tip.styles.js +6 -5
  265. package/test-env/components/tour/tour.styles.js +10 -5
  266. package/test-env/global_styling/functions/index.js +13 -0
  267. package/test-env/global_styling/functions/math.js +57 -0
  268. package/test-env/global_styling/mixins/_helpers.js +5 -2
  269. package/test-env/services/color/contrast.js +5 -1
  270. package/test-env/services/index.js +7 -0
  271. package/test-env/services/theme/context.js +4 -2
  272. package/test-env/services/theme/hooks.js +28 -0
  273. package/test-env/services/theme/index.js +12 -0
  274. package/test-env/services/theme/provider.js +23 -9
  275. package/src/components/badge/_badge.scss +0 -133
  276. package/src/components/flyout/_flyout.scss +0 -196
  277. package/src/components/flyout/_flyout_body.scss +0 -18
  278. package/src/components/flyout/_flyout_footer.scss +0 -4
  279. package/src/components/flyout/_flyout_header.scss +0 -7
  280. package/src/components/flyout/_index.scss +0 -7
  281. package/src/components/flyout/_mixins.scss +0 -18
  282. package/src/components/flyout/_variables.scss +0 -8
  283. package/src/themes/amsterdam/global_styling/variables/_flyout.scss +0 -1
@@ -8,13 +8,25 @@
8
8
  import { css } from '@emotion/react';
9
9
  import { euiPaddingSize, logicalCSS } from '../../global_styling';
10
10
  import { euiTitle } from '../title/title.styles';
11
- export var euiPopoverTitleStyles = function euiPopoverTitleStyles(euiThemeContext, panelPadding) {
12
- var euiTheme = euiThemeContext.euiTheme; // If the popover's containing panel has padding applied,
13
- // ensure the title expands to cover that padding and
14
-
15
- var panelPaddingSize = euiPaddingSize(euiThemeContext, panelPadding);
11
+ export var euiPopoverTitleStyles = function euiPopoverTitleStyles(euiThemeContext) {
12
+ var euiTheme = euiThemeContext.euiTheme;
16
13
  return {
17
14
  // Base
18
- euiPopoverTitle: /*#__PURE__*/css(euiTitle(euiThemeContext, 'xxs'), ";", logicalCSS('border-bottom', euiTheme.border.thin), ";margin:-", panelPaddingSize, " -", panelPaddingSize, " ", panelPaddingSize, ";;label:euiPopoverTitle;")
15
+ euiPopoverTitle: /*#__PURE__*/css(euiTitle(euiThemeContext, 'xxs'), ";", logicalCSS('border-bottom', euiTheme.border.thin), ";;label:euiPopoverTitle;"),
16
+ // If the popover's containing panel has padding applied,
17
+ // ensure the title expands to cover that padding via negative margins
18
+ panelPaddingSizes: {
19
+ none: /*#__PURE__*/css(";label:none;"),
20
+ xs: /*#__PURE__*/css(getPaddingOffset(euiThemeContext, 'xs'), ";;label:xs;"),
21
+ s: /*#__PURE__*/css(getPaddingOffset(euiThemeContext, 's'), ";;label:s;"),
22
+ m: /*#__PURE__*/css(getPaddingOffset(euiThemeContext, 'm'), ";;label:m;"),
23
+ l: /*#__PURE__*/css(getPaddingOffset(euiThemeContext, 'l'), ";;label:l;"),
24
+ xl: /*#__PURE__*/css(getPaddingOffset(euiThemeContext, 'xl'), ";;label:xl;")
25
+ }
19
26
  };
27
+ };
28
+
29
+ var getPaddingOffset = function getPaddingOffset(euiThemeContext, size) {
30
+ var panelPaddingSize = euiPaddingSize(euiThemeContext, size);
31
+ return "margin: -".concat(panelPaddingSize, " -").concat(panelPaddingSize, " ").concat(panelPaddingSize, ";");
20
32
  };
@@ -84,9 +84,9 @@ export var EuiProgress = function EuiProgress(_ref) {
84
84
  }, label && ___EmotionJSX(EuiInnerText, null, function (ref, innerText) {
85
85
  return ___EmotionJSX("span", _extends({
86
86
  title: innerText,
87
- ref: ref
87
+ ref: ref,
88
+ css: labelCssStyles
88
89
  }, labelProps, {
89
- css: labelCssStyles,
90
90
  className: labelClasses
91
91
  }), label);
92
92
  }), valueRender && ___EmotionJSX(EuiInnerText, null, function (ref, innerText) {
@@ -0,0 +1,16 @@
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 React from 'react';
9
+ import { jsx as ___EmotionJSX } from "@emotion/react";
10
+ export var CustomComponentFilter = function CustomComponentFilter(props) {
11
+ var CustomComponent = props.config.component;
12
+ return ___EmotionJSX(CustomComponent, {
13
+ query: props.query,
14
+ onChange: props.onChange
15
+ });
16
+ };
@@ -12,6 +12,7 @@ import { IsFilter } from './is_filter';
12
12
  import { FieldValueSelectionFilter } from './field_value_selection_filter';
13
13
  import { FieldValueToggleFilter } from './field_value_toggle_filter';
14
14
  import { FieldValueToggleGroupFilter } from './field_value_toggle_group_filter';
15
+ import { CustomComponentFilter } from './custom_component_filter';
15
16
  import { jsx as ___EmotionJSX } from "@emotion/react";
16
17
  export var createFilter = function createFilter(index, config, query, onChange) {
17
18
  var props = {
@@ -45,6 +46,11 @@ export var createFilter = function createFilter(index, config, query, onChange)
45
46
  config: config
46
47
  }));
47
48
 
49
+ case 'custom_component':
50
+ return ___EmotionJSX(CustomComponentFilter, _extends({}, props, {
51
+ config: config
52
+ }));
53
+
48
54
  default:
49
55
  // @ts-ignore TS knows that we've checked `config.type` exhaustively
50
56
  throw new Error("Unknown search filter type [".concat(config.type, "]"));
@@ -543,6 +543,18 @@ export var _AST = /*#__PURE__*/function () {
543
543
  return !Is.isInstance(clause) || clause.flag !== flag;
544
544
  }));
545
545
  }
546
+ }, {
547
+ key: "removeIsClauses",
548
+ value: function removeIsClauses() {
549
+ return new _AST(this._clauses.filter(function (clause) {
550
+ return !Is.isInstance(clause);
551
+ }));
552
+ }
553
+ }, {
554
+ key: "removeAllClauses",
555
+ value: function removeAllClauses() {
556
+ return new _AST();
557
+ }
546
558
  }, {
547
559
  key: "getGroupClauses",
548
560
  value: function getGroupClauses() {
@@ -1,5 +1,7 @@
1
1
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
2
2
 
3
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
+
3
5
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
4
6
 
5
7
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -12,8 +14,6 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
12
14
 
13
15
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
14
16
 
15
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
16
-
17
17
  /*
18
18
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
19
19
  * or more contributor license agreements. Licensed under the Elastic License
@@ -21,11 +21,11 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
21
21
  * in compliance with, at your election, the Elastic License 2.0 or the Server
22
22
  * Side Public License, v 1.
23
23
  */
24
- import { printIso8601 } from './date_format';
25
- import { isDateValue, dateValue } from './date_value';
26
- import { AST } from './ast';
27
24
  import { isArray, isDateLike, isString } from '../../../services/predicate';
28
25
  import { keysOf } from '../../common';
26
+ import { AST } from './ast';
27
+ import { printIso8601 } from './date_format';
28
+ import { dateValue, isDateValue } from './date_value';
29
29
 
30
30
  var processDateOperation = function processDateOperation(value, operator) {
31
31
  var granularity = value.granularity,
@@ -115,12 +115,17 @@ export var _fieldValuesToQuery = function _fieldValuesToQuery(field, operations,
115
115
  }
116
116
  });
117
117
 
118
- if (_terms.length > 0) {
118
+ if (_terms.length > 1) {
119
+ queries.push({
120
+ bool: _defineProperty({}, andOr === 'and' ? 'must' : 'should', _toConsumableArray(_terms.map(function (value) {
121
+ return {
122
+ match: _defineProperty({}, field, value)
123
+ };
124
+ })))
125
+ });
126
+ } else if (_terms.length === 1) {
119
127
  queries.push({
120
- match: _defineProperty({}, field, {
121
- query: _terms.join(' '),
122
- operator: andOr
123
- })
128
+ match: _defineProperty({}, field, _terms[0])
124
129
  });
125
130
  }
126
131
 
@@ -44,6 +44,11 @@ export var Query = /*#__PURE__*/function () {
44
44
  }
45
45
 
46
46
  _createClass(Query, [{
47
+ key: "hasClauses",
48
+ value: function hasClauses() {
49
+ return this.ast.clauses.length > 0;
50
+ }
51
+ }, {
47
52
  key: "hasSimpleFieldClause",
48
53
  value: function hasSimpleFieldClause(field, value) {
49
54
  return this.ast.hasSimpleFieldClause(field, value);
@@ -103,6 +108,12 @@ export var Query = /*#__PURE__*/function () {
103
108
  var ast = this.ast.removeOrFieldClauses(field);
104
109
  return new Query(ast, this.syntax);
105
110
  }
111
+ }, {
112
+ key: "removeAllClauses",
113
+ value: function removeAllClauses() {
114
+ var ast = this.ast.removeAllClauses();
115
+ return new Query(ast, this.syntax);
116
+ }
106
117
  }, {
107
118
  key: "hasIsClause",
108
119
  value: function hasIsClause(flag) {
@@ -131,6 +142,12 @@ export var Query = /*#__PURE__*/function () {
131
142
  var ast = this.ast.removeIsClause(flag);
132
143
  return new Query(ast, this.syntax);
133
144
  }
145
+ }, {
146
+ key: "removeIsClauses",
147
+ value: function removeIsClauses() {
148
+ var ast = this.ast.removeIsClauses();
149
+ return new Query(ast, this.syntax);
150
+ }
134
151
  /**
135
152
  * Executes this query over the given iterable item and returns
136
153
  * an new array of all items that matched this query. Options:
@@ -412,6 +412,10 @@ EuiSearchBar.propTypes = {
412
412
  operator: PropTypes.oneOf(["eq", "exact", "gt", "gte", "lt", "lte"])
413
413
  }).isRequired).isRequired,
414
414
  available: PropTypes.func
415
+ }).isRequired, PropTypes.shape({
416
+ type: PropTypes.oneOf(["custom_component"]).isRequired,
417
+ component: PropTypes.elementType.isRequired,
418
+ available: PropTypes.func
415
419
  }).isRequired]).isRequired),
416
420
 
417
421
  /**
@@ -156,5 +156,9 @@ EuiSearchFilters.propTypes = {
156
156
  operator: PropTypes.oneOf(["eq", "exact", "gt", "gte", "lt", "lte"])
157
157
  }).isRequired).isRequired,
158
158
  available: PropTypes.func
159
+ }).isRequired, PropTypes.shape({
160
+ type: PropTypes.oneOf(["custom_component"]).isRequired,
161
+ component: PropTypes.elementType.isRequired,
162
+ available: PropTypes.func
159
163
  }).isRequired]).isRequired).isRequired
160
164
  };
@@ -438,12 +438,12 @@ EuiSelectableList.propTypes = {
438
438
  /**
439
439
  * The side of the badge the icon should sit
440
440
  */
441
- iconSide: PropTypes.oneOf(["left", "right"]),
441
+ iconSide: PropTypes.any,
442
442
 
443
443
  /**
444
444
  * Accepts either our palette colors (primary, success ..etc) or a hex value `#FFFFFF`, `#000`.
445
445
  */
446
- color: PropTypes.oneOfType([PropTypes.string.isRequired, PropTypes.any.isRequired]),
446
+ color: PropTypes.oneOfType([PropTypes.any.isRequired, PropTypes.string.isRequired]),
447
447
 
448
448
  /**
449
449
  * Will override any color passed through the `color` prop.
@@ -272,12 +272,12 @@ EuiSelectableListItem.propTypes = {
272
272
  /**
273
273
  * The side of the badge the icon should sit
274
274
  */
275
- iconSide: PropTypes.oneOf(["left", "right"]),
275
+ iconSide: PropTypes.any,
276
276
 
277
277
  /**
278
278
  * Accepts either our palette colors (primary, success ..etc) or a hex value `#FFFFFF`, `#000`.
279
279
  */
280
- color: PropTypes.oneOfType([PropTypes.string.isRequired, PropTypes.any.isRequired]),
280
+ color: PropTypes.oneOfType([PropTypes.any.isRequired, PropTypes.string.isRequired]),
281
281
 
282
282
  /**
283
283
  * Will override any color passed through the `color` prop.
@@ -6,7 +6,7 @@
6
6
  * Side Public License, v 1.
7
7
  */
8
8
  import { css } from '@emotion/react';
9
- import { logicalCSS, logicalTextAlignCSS, euiFontSize, euiBackgroundColor } from '../../global_styling';
9
+ import { logicalCSS, logicalTextAlignCSS, euiFontSize, euiBackgroundColor, mathWithUnits } from '../../global_styling';
10
10
  import { euiLinkCSS } from '../link/link.styles';
11
11
  import { euiTitle } from '../title/title.styles';
12
12
  /**
@@ -45,8 +45,11 @@ var euiScaleText = function euiScaleText(euiThemeContext, options) {
45
45
  }; // Generate margins for headings based on customScale (not on heading level)
46
46
 
47
47
  var customScale = _customScale === 'xxxs' ? 'xxs' : _customScale || 'm';
48
- var headingMarginTop = "".concat(parseFloat(euiTheme.size[customScale]) * 2, "px");
49
- var headingMarginBottom = euiTheme.size[customScale];
48
+ var marginSize = euiTheme.size[customScale];
49
+ var headingMarginTop = mathWithUnits(marginSize, function (x) {
50
+ return x * 2;
51
+ });
52
+ var headingMarginBottom = marginSize;
50
53
  return "\n font-size: ".concat(fontSize, ";\n line-height: ").concat(lineHeight, ";\n\n h1 {\n font-size: ").concat(headings.h1.fontSize, ";\n line-height: ").concat(headings.h1.lineHeight, ";\n }\n h1:not(:last-child) {\n ").concat(logicalCSS('margin-bottom', headingMarginBottom), "\n }\n\n h2 {\n font-size: ").concat(headings.h2.fontSize, ";\n line-height: ").concat(headings.h2.lineHeight, ";\n\n &:not(:first-child) {\n ").concat(logicalCSS('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat(logicalCSS('margin-bottom', headingMarginBottom), "\n }\n }\n\n h3 {\n font-size: ").concat(headings.h3.fontSize, ";\n line-height: ").concat(headings.h3.lineHeight, ";\n\n &:not(:first-child) {\n ").concat(logicalCSS('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat(logicalCSS('margin-bottom', headingMarginBottom), "\n }\n }\n\n h4 {\n font-size: ").concat(headings.h4.fontSize, ";\n line-height: ").concat(headings.h4.lineHeight, ";\n\n &:not(:first-child) {\n ").concat(logicalCSS('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat(logicalCSS('margin-bottom', headingMarginBottom), "\n }\n }\n\n h5 {\n font-size: ").concat(headings.h5.fontSize, ";\n line-height: ").concat(headings.h5.lineHeight, ";\n\n &:not(:first-child) {\n ").concat(logicalCSS('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat(logicalCSS('margin-bottom', headingMarginBottom), "\n }\n }\n\n h6 {\n font-size: ").concat(headings.h6.fontSize, ";\n line-height: ").concat(headings.h6.lineHeight, ";\n\n &:not(:first-child) {\n ").concat(logicalCSS('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat(logicalCSS('margin-bottom', headingMarginBottom), "\n }\n }\n\n p,\n ul,\n ol,\n dl,\n blockquote,\n img,\n pre {\n ").concat(logicalCSS('margin-bottom', lineHeightSize), "\n }\n\n ul,\n ol {\n ").concat(logicalCSS('margin-left', lineHeightSize), "\n }\n \n blockquote {\n font-size: ").concat(fontSize, ";\n padding: ").concat(lineHeightSize, ";\n }\n\n dd + dt {\n ").concat(logicalCSS('margin-top', fontSize), "\n }\n\n dt,\n .eui-definitionListReverse dd {\n font-size: ").concat(fontSize, ";\n line-height: ").concat(lineHeight, ";\n }\n\n .eui-definitionListReverse dt {\n font-size: ").concat(euiFontSize(euiThemeContext, 'xs', options).fontSize, ";\n color: ").concat(euiTheme.colors.text, ";\n }\n\n small {\n font-size: ").concat(euiFontSize(euiThemeContext, 's', options).fontSize, ";\n }\n\n pre:not(.euiCodeBlock__pre) {\n padding: ").concat(lineHeightSize, ";\n }\n\n code:not(.euiCode):not(.euiCodeBlock__code) {\n font-size: .9em; // 90% of parent font size\n }\n ").concat( // when textSize is 'm', the 'kbd' element gets a line between the text and the border-bottom
51
54
  _customScale === 'm' ? "\n kbd {\n ".concat(logicalCSS('padding-bottom', euiTheme.size.xs), "\n // ensures when only one character the shape looks like a square\n ").concat(logicalCSS('min-width', euiTheme.size.l), "\n ").concat(logicalTextAlignCSS('center'), "\n }\n \n kbd::after {\n content: '';\n ").concat(logicalCSS('border-bottom', "".concat(euiTheme.border.width.thin, " solid ").concat(euiTheme.colors.text)), "\n position: absolute;\n ").concat(logicalCSS('bottom', euiTheme.size.xxs), "\n ").concat(logicalCSS('left', 0), "\n ").concat(logicalCSS('width', '100%'), "\n }") : '', "\n ");
52
55
  };
@@ -12,7 +12,7 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
12
12
  * Side Public License, v 1.
13
13
  */
14
14
  import { css, keyframes } from '@emotion/react';
15
- import { logicalCSS, logicalSizeCSS, euiFontSize } from '../../global_styling';
15
+ import { logicalCSS, logicalSizeCSS, euiFontSize, mathWithUnits } from '../../global_styling';
16
16
  import { COLOR_MODES_STANDARD, tint, shade } from '../../services';
17
17
  import { euiShadow } from '../../themes/amsterdam';
18
18
  export var euiToolTipBackgroundColor = function euiToolTipBackgroundColor(euiTheme, colorMode) {
@@ -39,12 +39,13 @@ export var euiToolTipStyles = function euiToolTipStyles(euiThemeContext) {
39
39
  */
40
40
 
41
41
  var arrowSize = euiTheme.size.m;
42
- var arrowSizeInt = parseInt(arrowSize, 10);
43
- var arrowPlusSize = "".concat((arrowSizeInt / 2 + 1) * -1, "px");
44
- /* 1 */
42
+ var arrowPlusSize = mathWithUnits(arrowSize, function (x) {
43
+ return (x / 2 + 1) * -1;
44
+ }); // 1.
45
45
 
46
- var arrowMinusSize = "".concat((arrowSizeInt / 2 - 1) * -1, "px");
47
- /* 1 */
46
+ var arrowMinusSize = mathWithUnits(arrowSize, function (x) {
47
+ return (x / 2 - 1) * -1;
48
+ }); // 1.
48
49
 
49
50
  return {
50
51
  // Base
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { css } from '@emotion/react';
9
9
  import { shade, tint, COLOR_MODES_STANDARD } from '../../services';
10
- import { logicalCSS } from '../../global_styling';
10
+ import { logicalCSS, mathWithUnits } from '../../global_styling';
11
11
  import { openAnimationTiming } from '../popover/popover_panel/_popover_panel.styles';
12
12
  import { popoverArrowSize } from '../popover/popover_arrow/_popover_arrow.styles';
13
13
 
@@ -26,15 +26,20 @@ export var euiTourStyles = function euiTourStyles(_ref) {
26
26
  export var euiTourBeaconStyles = function euiTourBeaconStyles(_ref2) {
27
27
  var euiTheme = _ref2.euiTheme;
28
28
  var arrowSize = euiTheme.size[popoverArrowSize];
29
- var arrowSizeInt = parseInt(arrowSize, 10);
29
+ var arrowHalfSize = mathWithUnits(arrowSize, function (x) {
30
+ return x / 2;
31
+ });
32
+ var arrowOffset = mathWithUnits(arrowSize, function (x) {
33
+ return x * -2;
34
+ });
30
35
  return {
31
36
  // Base
32
37
  euiTourBeacon: /*#__PURE__*/css("pointer-events:none;position:absolute;opacity:0;transition:opacity 0s ", euiTheme.animation[openAnimationTiming], ";;label:euiTourBeacon;"),
33
38
  // Positions
34
- right: /*#__PURE__*/css(logicalCSS('top', "".concat(arrowSizeInt / 2, "px")), ";", logicalCSS('left', "".concat(arrowSizeInt * -2, "px")), ";;label:right;"),
35
- left: /*#__PURE__*/css(logicalCSS('top', "".concat(arrowSizeInt / 2, "px")), ";", logicalCSS('left', arrowSize), ";;label:left;"),
36
- top: /*#__PURE__*/css(logicalCSS('top', arrowSize), ";", logicalCSS('left', "".concat(arrowSizeInt / 2, "px")), ";;label:top;"),
37
- bottom: /*#__PURE__*/css(logicalCSS('top', "".concat(arrowSizeInt * -2, "px")), ";", logicalCSS('left', "".concat(arrowSizeInt / 2, "px")), ";;label:bottom;")
39
+ right: /*#__PURE__*/css(logicalCSS('top', arrowHalfSize), ";", logicalCSS('left', arrowOffset), ";;label:right;"),
40
+ left: /*#__PURE__*/css(logicalCSS('top', arrowHalfSize), ";", logicalCSS('left', arrowSize), ";;label:left;"),
41
+ top: /*#__PURE__*/css(logicalCSS('top', arrowSize), ";", logicalCSS('left', arrowHalfSize), ";;label:top;"),
42
+ bottom: /*#__PURE__*/css(logicalCSS('top', arrowOffset), ";", logicalCSS('left', arrowHalfSize), ";;label:bottom;")
38
43
  };
39
44
  };
40
45
  export var euiTourHeaderStyles = function euiTourHeaderStyles(_ref3) {
@@ -6,5 +6,6 @@
6
6
  * Side Public License, v 1.
7
7
  */
8
8
  export * from './logicals';
9
+ export * from './math';
9
10
  export * from './size';
10
11
  export * from './typography';
@@ -0,0 +1,46 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2
+
3
+ function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(re, groups) { return new BabelRegExp(re, undefined, groups); }; var _super = RegExp.prototype; var _groups = new WeakMap(); function BabelRegExp(re, flags, groups) { var _this = new RegExp(re, flags); _groups.set(_this, groups || _groups.get(re)); return _setPrototypeOf(_this, BabelRegExp.prototype); } _inherits(BabelRegExp, RegExp); BabelRegExp.prototype.exec = function (str) { var result = _super.exec.call(this, str); if (result) result.groups = buildGroups(result, this); return result; }; BabelRegExp.prototype[Symbol.replace] = function (str, substitution) { if (typeof substitution === "string") { var groups = _groups.get(this); return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) { return "$" + groups[name]; })); } else if (typeof substitution === "function") { var _this = this; return _super[Symbol.replace].call(this, str, function () { var args = arguments; if (_typeof(args[args.length - 1]) !== "object") { args = [].slice.call(args); args.push(buildGroups(args, _this)); } return substitution.apply(this, args); }); } else { return _super[Symbol.replace].call(this, str, substitution); } }; function buildGroups(result, re) { var g = _groups.get(re); return Object.keys(g).reduce(function (groups, name) { groups[name] = result[g[name]]; return groups; }, Object.create(null)); } return _wrapRegExp.apply(this, arguments); }
4
+
5
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
6
+
7
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
8
+
9
+ /*
10
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
11
+ * or more contributor license agreements. Licensed under the Elastic License
12
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
13
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
14
+ * Side Public License, v 1.
15
+ */
16
+
17
+ /**
18
+ * Utility for performing math callbacks on a string with CSS units
19
+ * and returning a string with its unit preserved.
20
+ *
21
+ * Example usage:
22
+ * mathWithUnits('4px', (x) => x / 2) = '2px';
23
+ * mathWithUnits(euiTheme.size.xs, (x) => x + 2) = '6px';
24
+ */
25
+ export var mathWithUnits = function mathWithUnits(value, callback) {
26
+ var unit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
27
+
28
+ if (typeof value === 'string') {
29
+ var _matches$groups;
30
+
31
+ var regex = /*#__PURE__*/_wrapRegExp(/(\x2D?[\.0-9]+)(%|[A-Za-z]*)/, {
32
+ value: 1,
33
+ unit: 2
34
+ });
35
+
36
+ var matches = regex.exec(value);
37
+ if (!(matches !== null && matches !== void 0 && (_matches$groups = matches.groups) !== null && _matches$groups !== void 0 && _matches$groups.value)) return value;
38
+ var numericValue = Number(matches.groups.value);
39
+ var passedUnit = matches.groups.unit || unit;
40
+ return "".concat(callback(numericValue)).concat(passedUnit);
41
+ } else if (typeof value === 'number') {
42
+ return "".concat(callback(value)).concat(unit);
43
+ } else {
44
+ return value;
45
+ }
46
+ };
@@ -100,12 +100,15 @@ export var useEuiYScroll = function useEuiYScroll() {
100
100
  };
101
101
  export var euiYScrollWithShadows = function euiYScrollWithShadows(euiTheme) {
102
102
  var _ref7 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
103
- height = _ref7.height;
103
+ height = _ref7.height,
104
+ _ref7$side = _ref7.side,
105
+ side = _ref7$side === void 0 ? 'both' : _ref7$side;
104
106
 
105
107
  return "\n ".concat(euiYScroll(euiTheme, {
106
108
  height: height
107
109
  }), "\n ").concat(euiOverflowShadowStyles(euiTheme, {
108
- direction: 'y'
110
+ direction: 'y',
111
+ side: side
109
112
  }), "\n");
110
113
  };
111
114
  export var useEuiYScrollWithShadows = function useEuiYScrollWithShadows() {
@@ -10,6 +10,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
10
10
  import chroma from 'chroma-js';
11
11
  import { shade, tint, lightness as getLightness } from './manipulation';
12
12
  import { getOn } from '../theme/utils';
13
+ export var wcagContrastMin = 4.5; // WCAG AA minimum contrast ratio for normal (non-large) text
14
+
13
15
  /**
14
16
  * Creates a new color that meets or exceeds WCAG level AA
15
17
  * @param foreground - Color to manipulate
@@ -11,7 +11,7 @@ export { keys };
11
11
  export { accessibleClickKeys, cascadingMenuKeys, comboBoxKeys, htmlIdGenerator, useGeneratedHtmlId } from './accessibility';
12
12
  export { LEFT_ALIGNMENT, RIGHT_ALIGNMENT, CENTER_ALIGNMENT } from './alignment';
13
13
  export { useIsWithinBreakpoints, useIsWithinMaxBreakpoint, useIsWithinMinBreakpoint, CurrentEuiBreakpointContext, CurrentEuiBreakpointProvider, useCurrentEuiBreakpoint } from './breakpoint';
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';
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, wcagContrastMin } from './color';
15
15
  export { useColorPickerState, useColorStopsState } from './color_picker';
16
16
  export * from './console';
17
17
  export { copyToClipboard } from './copy_to_clipboard';
@@ -11,4 +11,5 @@ import { DEFAULT_COLOR_MODE, getComputed } from './utils';
11
11
  export var EuiSystemContext = /*#__PURE__*/createContext(EuiThemeAmsterdam);
12
12
  export var EuiModificationsContext = /*#__PURE__*/createContext({});
13
13
  export var EuiColorModeContext = /*#__PURE__*/createContext(DEFAULT_COLOR_MODE);
14
- export var EuiThemeContext = /*#__PURE__*/createContext(getComputed(EuiThemeAmsterdam, {}, DEFAULT_COLOR_MODE));
14
+ export var defaultComputedTheme = getComputed(EuiThemeAmsterdam, {}, DEFAULT_COLOR_MODE);
15
+ export var EuiThemeContext = /*#__PURE__*/createContext(defaultComputedTheme);
@@ -8,12 +8,38 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
8
8
  * Side Public License, v 1.
9
9
  */
10
10
  import React, { forwardRef, useContext, useMemo } from 'react';
11
- import { EuiThemeContext, EuiModificationsContext, EuiColorModeContext } from './context';
11
+ import { EuiThemeContext, EuiModificationsContext, EuiColorModeContext, defaultComputedTheme } from './context';
12
+ import { getEuiDevProviderWarning } from './provider';
12
13
  import { jsx as ___EmotionJSX } from "@emotion/react";
14
+ var providerMessage = "`EuiProvider` is missing which can result in negative effects.\nWrap your component in `EuiProvider`: https://ela.st/euiprovider.";
13
15
  export var useEuiTheme = function useEuiTheme() {
14
16
  var theme = useContext(EuiThemeContext);
15
17
  var colorMode = useContext(EuiColorModeContext);
16
18
  var modifications = useContext(EuiModificationsContext);
19
+
20
+ if (process.env.NODE_ENV !== 'production') {
21
+ var isFallback = theme === defaultComputedTheme;
22
+ var warningLevel = getEuiDevProviderWarning();
23
+
24
+ if (isFallback && typeof warningLevel !== 'undefined') {
25
+ switch (warningLevel) {
26
+ case 'log':
27
+ console.log(providerMessage);
28
+ break;
29
+
30
+ case 'warn':
31
+ console.warn(providerMessage);
32
+ break;
33
+
34
+ case 'error':
35
+ throw new Error(providerMessage);
36
+
37
+ default:
38
+ break;
39
+ }
40
+ }
41
+ }
42
+
17
43
  var assembledTheme = useMemo(function () {
18
44
  return {
19
45
  euiTheme: theme,
@@ -7,6 +7,6 @@
7
7
  */
8
8
  export { EuiSystemContext, EuiThemeContext, EuiModificationsContext, EuiColorModeContext } from './context';
9
9
  export { useEuiTheme, withEuiTheme } from './hooks';
10
- export { EuiThemeProvider } from './provider';
10
+ export { EuiThemeProvider, getEuiDevProviderWarning, setEuiDevProviderWarning } from './provider';
11
11
  export { buildTheme, computed, isInverseColorMode, getColorMode, getComputed, getOn, mergeDeep, setOn, Computed } from './utils';
12
12
  export { COLOR_MODES_STANDARD } from './types';
@@ -1,3 +1,9 @@
1
+ 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; }
2
+
3
+ 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; }
4
+
5
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+
1
7
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
8
 
3
9
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -22,6 +28,13 @@ import isEqual from 'lodash/isEqual';
22
28
  import { EuiSystemContext, EuiThemeContext, EuiModificationsContext, EuiColorModeContext } from './context';
23
29
  import { buildTheme, getColorMode, getComputed, mergeDeep } from './utils';
24
30
  import { jsx as ___EmotionJSX } from "@emotion/react";
31
+ var providerWarning = undefined;
32
+ export var setEuiDevProviderWarning = function setEuiDevProviderWarning(level) {
33
+ return providerWarning = level;
34
+ };
35
+ export var getEuiDevProviderWarning = function getEuiDevProviderWarning() {
36
+ return providerWarning;
37
+ };
25
38
  export var EuiThemeProvider = function EuiThemeProvider(_ref) {
26
39
  var _system = _ref.theme,
27
40
  _colorMode = _ref.colorMode,
@@ -54,7 +67,8 @@ export var EuiThemeProvider = function EuiThemeProvider(_ref) {
54
67
  var prevColorMode = useRef(colorMode);
55
68
  var isParentTheme = useRef(prevSystemKey.current === parentSystem.key && colorMode === parentColorMode && isEqual(parentModifications, modifications));
56
69
 
57
- var _useState7 = useState(isParentTheme.current && Object.keys(parentTheme).length ? parentTheme : getComputed(system, buildTheme(modifications, "_".concat(system.key)), colorMode)),
70
+ var _useState7 = useState(isParentTheme.current && Object.keys(parentTheme).length ? _objectSpread({}, parentTheme) // Intentionally create a new object to break referential equality
71
+ : getComputed(system, buildTheme(modifications, "_".concat(system.key)), colorMode)),
58
72
  _useState8 = _slicedToArray(_useState7, 2),
59
73
  theme = _useState8[0],
60
74
  setTheme = _useState8[1];