@elastic/eui 69.0.0 → 70.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 (306) hide show
  1. package/dist/eui_theme_dark.css +0 -554
  2. package/dist/eui_theme_dark.json +0 -27
  3. package/dist/eui_theme_dark.json.d.ts +0 -27
  4. package/dist/eui_theme_dark.min.css +1 -1
  5. package/dist/eui_theme_light.css +0 -554
  6. package/dist/eui_theme_light.json +0 -27
  7. package/dist/eui_theme_light.json.d.ts +0 -27
  8. package/dist/eui_theme_light.min.css +1 -1
  9. package/es/components/badge/beta_badge/beta_badge.js +6 -6
  10. package/es/components/basic_table/in_memory_table.js +16 -2
  11. package/es/components/button/button_display/_button_display.js +7 -6
  12. package/es/components/button/button_display/_button_display.styles.js +4 -4
  13. package/es/components/button/button_display/_button_display_content.js +6 -9
  14. package/es/components/button/button_display/_button_display_content.styles.js +3 -41
  15. package/es/components/code/code.js +7 -3
  16. package/es/components/code/code.styles.js +32 -0
  17. package/es/components/code/code_block.js +72 -315
  18. package/es/components/code/code_block.styles.js +153 -0
  19. package/es/components/code/code_block_controls.js +29 -0
  20. package/es/components/code/code_block_controls.styles.js +43 -0
  21. package/es/components/code/code_block_copy.js +65 -0
  22. package/es/components/code/code_block_full_screen.js +90 -0
  23. package/es/components/code/code_block_line.styles.js +49 -0
  24. package/es/components/code/code_block_overflow.js +78 -0
  25. package/es/components/code/code_block_virtualized.js +59 -0
  26. package/es/components/code/code_syntax.styles.js +43 -0
  27. package/es/components/code/utils.js +43 -37
  28. package/es/components/collapsible_nav/collapsible_nav.js +0 -5
  29. package/es/components/datagrid/controls/column_selector.js +1 -1
  30. package/es/components/datagrid/controls/column_sorting.js +1 -1
  31. package/es/components/header/header_links/header_links.js +6 -0
  32. package/es/components/loading/loading_spinner.js +14 -3
  33. package/es/components/loading/loading_spinner.styles.js +11 -7
  34. package/es/components/modal/modal.js +17 -2
  35. package/es/components/overlay_mask/overlay_mask.js +8 -14
  36. package/es/components/overlay_mask/overlay_mask.styles.js +4 -14
  37. package/es/components/overlay_mask/overlay_mask_body.styles.js +18 -0
  38. package/es/components/page_template/page_template.js +6 -9
  39. package/es/components/popover/popover.js +13 -3
  40. package/es/components/popover/popover_arrow/_popover_arrow.js +1 -0
  41. package/es/components/popover/popover_panel/_popover_panel.js +8 -2
  42. package/es/components/popover/popover_panel/_popover_panel.styles.js +15 -1
  43. package/es/components/provider/provider.js +1 -5
  44. package/es/components/resizable_container/helpers.js +2 -2
  45. package/es/components/resizable_container/resizable_container.js +6 -9
  46. package/es/components/resizable_container/resizable_container.styles.js +28 -0
  47. package/es/components/resizable_container/resizable_panel.js +25 -48
  48. package/es/components/resizable_container/resizable_panel.styles.js +69 -0
  49. package/es/components/search_bar/query/ast.js +14 -3
  50. package/es/components/search_bar/search_bar.js +39 -5
  51. package/es/components/search_bar/search_box.js +37 -4
  52. package/es/components/tabs/tab.js +33 -13
  53. package/es/components/tabs/tab.styles.js +50 -0
  54. package/es/components/tabs/tabbed_content/tabbed_content.js +16 -0
  55. package/es/components/tabs/tabs.js +20 -14
  56. package/es/components/tabs/tabs.styles.js +23 -0
  57. package/es/components/tool_tip/tool_tip.js +3 -2
  58. package/es/components/tool_tip/tool_tip.styles.js +17 -22
  59. package/es/components/tool_tip/tool_tip_arrow.js +17 -3
  60. package/es/components/tool_tip/tool_tip_popover.js +7 -7
  61. package/es/components/tour/tour.styles.js +4 -3
  62. package/es/components/tour/tour_step.js +13 -5
  63. package/es/global_styling/functions/logicals.js +5 -3
  64. package/es/global_styling/functions/math.js +37 -19
  65. package/es/global_styling/mixins/_padding.js +13 -9
  66. package/eui.d.ts +401 -84
  67. package/i18ntokens.json +26 -26
  68. package/lib/components/badge/beta_badge/beta_badge.js +6 -10
  69. package/lib/components/basic_table/in_memory_table.js +16 -2
  70. package/lib/components/button/button_display/_button_display.js +7 -6
  71. package/lib/components/button/button_display/_button_display.styles.js +4 -4
  72. package/lib/components/button/button_display/_button_display_content.js +6 -9
  73. package/lib/components/button/button_display/_button_display_content.styles.js +10 -40
  74. package/lib/components/code/code.js +9 -3
  75. package/lib/components/code/code.styles.js +35 -0
  76. package/lib/components/code/code_block.js +72 -320
  77. package/lib/components/code/code_block.styles.js +154 -0
  78. package/lib/components/code/code_block_controls.js +48 -0
  79. package/lib/components/code/code_block_controls.styles.js +39 -0
  80. package/lib/components/code/code_block_copy.js +78 -0
  81. package/lib/components/code/code_block_full_screen.js +108 -0
  82. package/lib/components/code/code_block_line.styles.js +45 -0
  83. package/lib/components/code/code_block_overflow.js +82 -0
  84. package/lib/components/code/code_block_virtualized.js +72 -0
  85. package/lib/components/code/code_syntax.styles.js +57 -0
  86. package/lib/components/code/utils.js +40 -39
  87. package/lib/components/collapsible_nav/collapsible_nav.js +0 -5
  88. package/lib/components/datagrid/controls/column_selector.js +1 -1
  89. package/lib/components/datagrid/controls/column_sorting.js +1 -1
  90. package/lib/components/header/header_links/header_links.js +6 -0
  91. package/lib/components/loading/loading_spinner.js +13 -2
  92. package/lib/components/loading/loading_spinner.styles.js +14 -6
  93. package/lib/components/modal/modal.js +23 -2
  94. package/lib/components/overlay_mask/overlay_mask.js +9 -14
  95. package/lib/components/overlay_mask/overlay_mask.styles.js +13 -17
  96. package/lib/components/overlay_mask/overlay_mask_body.styles.js +20 -0
  97. package/lib/components/page_template/page_template.js +6 -9
  98. package/lib/components/popover/popover.js +13 -3
  99. package/lib/components/popover/popover_arrow/_popover_arrow.js +1 -0
  100. package/lib/components/popover/popover_panel/_popover_panel.js +8 -2
  101. package/lib/components/popover/popover_panel/_popover_panel.styles.js +16 -1
  102. package/lib/components/provider/provider.js +7 -12
  103. package/lib/components/resizable_container/helpers.js +2 -2
  104. package/lib/components/resizable_container/resizable_container.js +7 -9
  105. package/lib/components/resizable_container/resizable_container.styles.js +31 -0
  106. package/lib/components/resizable_container/resizable_panel.js +28 -49
  107. package/lib/components/resizable_container/resizable_panel.styles.js +74 -0
  108. package/lib/components/search_bar/query/ast.js +14 -3
  109. package/lib/components/search_bar/search_bar.js +40 -5
  110. package/lib/components/search_bar/search_box.js +38 -4
  111. package/lib/components/tabs/tab.js +33 -12
  112. package/lib/components/tabs/tab.styles.js +56 -0
  113. package/lib/components/tabs/tabbed_content/tabbed_content.js +16 -0
  114. package/lib/components/tabs/tabs.js +24 -14
  115. package/lib/components/tabs/tabs.styles.js +34 -0
  116. package/lib/components/tool_tip/tool_tip.js +3 -2
  117. package/lib/components/tool_tip/tool_tip.styles.js +18 -26
  118. package/lib/components/tool_tip/tool_tip_arrow.js +19 -4
  119. package/lib/components/tool_tip/tool_tip_popover.js +6 -6
  120. package/lib/components/tour/tour.styles.js +3 -2
  121. package/lib/components/tour/tour_step.js +7 -5
  122. package/lib/global_styling/functions/logicals.js +5 -3
  123. package/lib/global_styling/functions/math.js +37 -19
  124. package/lib/global_styling/mixins/_padding.js +17 -10
  125. package/optimize/es/components/badge/beta_badge/beta_badge.js +6 -6
  126. package/optimize/es/components/basic_table/in_memory_table.js +1 -1
  127. package/optimize/es/components/button/button_display/_button_display.js +6 -5
  128. package/optimize/es/components/button/button_display/_button_display.styles.js +4 -4
  129. package/optimize/es/components/button/button_display/_button_display_content.js +6 -9
  130. package/optimize/es/components/button/button_display/_button_display_content.styles.js +3 -41
  131. package/optimize/es/components/code/code.js +7 -3
  132. package/optimize/es/components/code/code.styles.js +32 -0
  133. package/optimize/es/components/code/code_block.js +70 -299
  134. package/optimize/es/components/code/code_block.styles.js +153 -0
  135. package/optimize/es/components/code/code_block_controls.js +29 -0
  136. package/optimize/es/components/code/code_block_controls.styles.js +43 -0
  137. package/optimize/es/components/code/code_block_copy.js +55 -0
  138. package/optimize/es/components/code/code_block_full_screen.js +80 -0
  139. package/optimize/es/components/code/code_block_line.styles.js +49 -0
  140. package/optimize/es/components/code/code_block_overflow.js +67 -0
  141. package/optimize/es/components/code/code_block_virtualized.js +59 -0
  142. package/optimize/es/components/code/code_syntax.styles.js +43 -0
  143. package/optimize/es/components/code/utils.js +43 -37
  144. package/optimize/es/components/datagrid/controls/column_selector.js +1 -1
  145. package/optimize/es/components/datagrid/controls/column_sorting.js +1 -1
  146. package/optimize/es/components/loading/loading_spinner.js +13 -3
  147. package/optimize/es/components/loading/loading_spinner.styles.js +11 -7
  148. package/optimize/es/components/modal/modal.js +17 -2
  149. package/optimize/es/components/overlay_mask/overlay_mask.js +8 -9
  150. package/optimize/es/components/overlay_mask/overlay_mask.styles.js +4 -14
  151. package/optimize/es/components/overlay_mask/overlay_mask_body.styles.js +18 -0
  152. package/optimize/es/components/page_template/page_template.js +6 -9
  153. package/optimize/es/components/popover/popover.js +7 -3
  154. package/optimize/es/components/popover/popover_arrow/_popover_arrow.js +1 -0
  155. package/optimize/es/components/popover/popover_panel/_popover_panel.js +6 -1
  156. package/optimize/es/components/popover/popover_panel/_popover_panel.styles.js +15 -1
  157. package/optimize/es/components/provider/provider.js +1 -5
  158. package/optimize/es/components/resizable_container/helpers.js +2 -2
  159. package/optimize/es/components/resizable_container/resizable_container.js +6 -9
  160. package/optimize/es/components/resizable_container/resizable_container.styles.js +28 -0
  161. package/optimize/es/components/resizable_container/resizable_panel.js +25 -48
  162. package/optimize/es/components/resizable_container/resizable_panel.styles.js +69 -0
  163. package/optimize/es/components/search_bar/query/ast.js +14 -3
  164. package/optimize/es/components/search_bar/search_bar.js +31 -5
  165. package/optimize/es/components/search_bar/search_box.js +29 -3
  166. package/optimize/es/components/tabs/tab.js +21 -13
  167. package/optimize/es/components/tabs/tab.styles.js +50 -0
  168. package/optimize/es/components/tabs/tabs.js +20 -14
  169. package/optimize/es/components/tabs/tabs.styles.js +23 -0
  170. package/optimize/es/components/tool_tip/tool_tip.js +3 -2
  171. package/optimize/es/components/tool_tip/tool_tip.styles.js +17 -22
  172. package/optimize/es/components/tool_tip/tool_tip_arrow.js +9 -3
  173. package/optimize/es/components/tool_tip/tool_tip_popover.js +7 -7
  174. package/optimize/es/components/tour/tour.styles.js +4 -3
  175. package/optimize/es/components/tour/tour_step.js +7 -5
  176. package/optimize/es/global_styling/functions/logicals.js +5 -3
  177. package/optimize/es/global_styling/functions/math.js +35 -17
  178. package/optimize/es/global_styling/mixins/_padding.js +13 -9
  179. package/optimize/lib/components/badge/beta_badge/beta_badge.js +6 -13
  180. package/optimize/lib/components/basic_table/in_memory_table.js +1 -1
  181. package/optimize/lib/components/button/button_display/_button_display.js +7 -6
  182. package/optimize/lib/components/button/button_display/_button_display.styles.js +4 -4
  183. package/optimize/lib/components/button/button_display/_button_display_content.js +6 -9
  184. package/optimize/lib/components/button/button_display/_button_display_content.styles.js +10 -40
  185. package/optimize/lib/components/code/code.js +9 -3
  186. package/optimize/lib/components/code/code.styles.js +35 -0
  187. package/optimize/lib/components/code/code_block.js +71 -306
  188. package/optimize/lib/components/code/code_block.styles.js +156 -0
  189. package/optimize/lib/components/code/code_block_controls.js +48 -0
  190. package/optimize/lib/components/code/code_block_controls.styles.js +39 -0
  191. package/optimize/lib/components/code/code_block_copy.js +78 -0
  192. package/optimize/lib/components/code/code_block_full_screen.js +108 -0
  193. package/optimize/lib/components/code/code_block_line.styles.js +45 -0
  194. package/optimize/lib/components/code/code_block_overflow.js +82 -0
  195. package/optimize/lib/components/code/code_block_virtualized.js +81 -0
  196. package/optimize/lib/components/code/code_syntax.styles.js +57 -0
  197. package/optimize/lib/components/code/utils.js +40 -37
  198. package/optimize/lib/components/datagrid/controls/column_selector.js +1 -1
  199. package/optimize/lib/components/datagrid/controls/column_sorting.js +1 -1
  200. package/optimize/lib/components/loading/loading_spinner.js +14 -2
  201. package/optimize/lib/components/loading/loading_spinner.styles.js +14 -6
  202. package/optimize/lib/components/modal/modal.js +22 -2
  203. package/optimize/lib/components/overlay_mask/overlay_mask.js +9 -9
  204. package/optimize/lib/components/overlay_mask/overlay_mask.styles.js +13 -17
  205. package/optimize/lib/components/overlay_mask/overlay_mask_body.styles.js +20 -0
  206. package/optimize/lib/components/page_template/page_template.js +6 -9
  207. package/optimize/lib/components/popover/popover.js +7 -3
  208. package/optimize/lib/components/popover/popover_arrow/_popover_arrow.js +1 -0
  209. package/optimize/lib/components/popover/popover_panel/_popover_panel.js +6 -1
  210. package/optimize/lib/components/popover/popover_panel/_popover_panel.styles.js +16 -1
  211. package/optimize/lib/components/provider/provider.js +7 -12
  212. package/optimize/lib/components/resizable_container/helpers.js +2 -2
  213. package/optimize/lib/components/resizable_container/resizable_container.js +7 -9
  214. package/optimize/lib/components/resizable_container/resizable_container.styles.js +31 -0
  215. package/optimize/lib/components/resizable_container/resizable_panel.js +28 -49
  216. package/optimize/lib/components/resizable_container/resizable_panel.styles.js +76 -0
  217. package/optimize/lib/components/search_bar/query/ast.js +14 -3
  218. package/optimize/lib/components/search_bar/search_bar.js +31 -5
  219. package/optimize/lib/components/search_bar/search_box.js +30 -3
  220. package/optimize/lib/components/tabs/tab.js +21 -12
  221. package/optimize/lib/components/tabs/tab.styles.js +56 -0
  222. package/optimize/lib/components/tabs/tabs.js +24 -14
  223. package/optimize/lib/components/tabs/tabs.styles.js +34 -0
  224. package/optimize/lib/components/tool_tip/tool_tip.js +3 -2
  225. package/optimize/lib/components/tool_tip/tool_tip.styles.js +18 -26
  226. package/optimize/lib/components/tool_tip/tool_tip_arrow.js +10 -10
  227. package/optimize/lib/components/tool_tip/tool_tip_popover.js +6 -6
  228. package/optimize/lib/components/tour/tour.styles.js +3 -2
  229. package/optimize/lib/components/tour/tour_step.js +7 -5
  230. package/optimize/lib/global_styling/functions/logicals.js +4 -10
  231. package/optimize/lib/global_styling/functions/math.js +37 -19
  232. package/optimize/lib/global_styling/mixins/_padding.js +17 -10
  233. package/package.json +10 -9
  234. package/src/components/datagrid/controls/_data_grid_toolbar.scss +0 -8
  235. package/src/components/index.scss +0 -2
  236. package/src/components/resizable_container/_index.scss +0 -2
  237. package/src/global_styling/mixins/_header.scss +1 -1
  238. package/src/global_styling/variables/_index.scss +0 -1
  239. package/src/themes/amsterdam/overrides/_index.scss +0 -2
  240. package/test-env/components/badge/beta_badge/beta_badge.js +6 -13
  241. package/test-env/components/basic_table/in_memory_table.js +16 -2
  242. package/test-env/components/button/button_display/_button_display.js +7 -6
  243. package/test-env/components/button/button_display/_button_display.styles.js +4 -4
  244. package/test-env/components/button/button_display/_button_display_content.js +6 -9
  245. package/test-env/components/button/button_display/_button_display_content.styles.js +10 -40
  246. package/test-env/components/code/code.styles.js +35 -0
  247. package/test-env/components/code/code_block.styles.js +156 -0
  248. package/test-env/components/code/code_block_controls.js +48 -0
  249. package/test-env/components/code/code_block_controls.styles.js +39 -0
  250. package/test-env/components/code/code_block_copy.js +78 -0
  251. package/test-env/components/code/code_block_full_screen.js +108 -0
  252. package/test-env/components/code/code_block_line.styles.js +45 -0
  253. package/test-env/components/code/code_block_overflow.js +82 -0
  254. package/test-env/components/code/code_block_virtualized.js +81 -0
  255. package/test-env/components/code/code_syntax.styles.js +57 -0
  256. package/test-env/components/code/utils.js +40 -37
  257. package/test-env/components/collapsible_nav/collapsible_nav.js +0 -5
  258. package/test-env/components/datagrid/controls/column_selector.js +1 -1
  259. package/test-env/components/datagrid/controls/column_sorting.js +1 -1
  260. package/test-env/components/header/header_links/header_links.js +6 -0
  261. package/test-env/components/loading/loading_spinner.js +14 -2
  262. package/test-env/components/loading/loading_spinner.styles.js +14 -6
  263. package/test-env/components/modal/modal.js +22 -2
  264. package/test-env/components/overlay_mask/overlay_mask.js +9 -14
  265. package/test-env/components/overlay_mask/overlay_mask.styles.js +13 -17
  266. package/test-env/components/overlay_mask/overlay_mask_body.styles.js +20 -0
  267. package/test-env/components/page_template/page_template.js +6 -9
  268. package/test-env/components/popover/popover.js +13 -3
  269. package/test-env/components/popover/popover_arrow/_popover_arrow.js +1 -0
  270. package/test-env/components/popover/popover_panel/_popover_panel.js +8 -2
  271. package/test-env/components/popover/popover_panel/_popover_panel.styles.js +16 -1
  272. package/test-env/components/provider/provider.js +7 -12
  273. package/test-env/components/resizable_container/helpers.js +2 -2
  274. package/test-env/components/resizable_container/resizable_container.js +7 -9
  275. package/test-env/components/resizable_container/resizable_container.styles.js +31 -0
  276. package/test-env/components/resizable_container/resizable_panel.js +28 -49
  277. package/test-env/components/resizable_container/resizable_panel.styles.js +76 -0
  278. package/test-env/components/search_bar/query/ast.js +14 -3
  279. package/test-env/components/search_bar/search_bar.js +39 -5
  280. package/test-env/components/search_bar/search_box.js +38 -4
  281. package/test-env/components/tabs/tab.js +33 -12
  282. package/test-env/components/tabs/tab.styles.js +56 -0
  283. package/test-env/components/tabs/tabbed_content/tabbed_content.js +16 -0
  284. package/test-env/components/tabs/tabs.js +24 -14
  285. package/test-env/components/tabs/tabs.styles.js +34 -0
  286. package/test-env/components/tool_tip/tool_tip.js +3 -2
  287. package/test-env/components/tool_tip/tool_tip.styles.js +18 -26
  288. package/test-env/components/tool_tip/tool_tip_arrow.js +16 -11
  289. package/test-env/components/tool_tip/tool_tip_popover.js +6 -6
  290. package/test-env/components/tour/tour.styles.js +3 -2
  291. package/test-env/components/tour/tour_step.js +7 -5
  292. package/test-env/global_styling/functions/logicals.js +4 -10
  293. package/test-env/global_styling/functions/math.js +37 -19
  294. package/test-env/global_styling/mixins/_padding.js +17 -10
  295. package/src/components/code/_code.scss +0 -15
  296. package/src/components/code/_code_block.scss +0 -177
  297. package/src/components/code/_index.scss +0 -4
  298. package/src/components/code/_mixins.scss +0 -127
  299. package/src/components/code/_variables.scss +0 -5
  300. package/src/components/resizable_container/_resizable_container.scss +0 -8
  301. package/src/components/resizable_container/_resizable_panel.scss +0 -51
  302. package/src/components/tabs/_index.scss +0 -1
  303. package/src/components/tabs/_tabs.scss +0 -110
  304. package/src/global_styling/variables/_colors_code.scss +0 -23
  305. package/src/themes/amsterdam/overrides/_code.scss +0 -9
  306. package/src/themes/amsterdam/overrides/_tabs.scss +0 -80
@@ -0,0 +1,43 @@
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
+
11
+ /*
12
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
13
+ * or more contributor license agreements. Licensed under the Elastic License
14
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
15
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
16
+ * Side Public License, v 1.
17
+ */
18
+ import { css } from '@emotion/react';
19
+ import { euiPaddingSize } from '../../global_styling';
20
+ import { euiCodeSyntaxColors } from './code_syntax.styles';
21
+
22
+ var _ref = process.env.NODE_ENV === "production" ? {
23
+ name: "to86kv-none",
24
+ styles: "inset-block-start:0;inset-inline-end:0;label:none;"
25
+ } : {
26
+ name: "to86kv-none",
27
+ styles: "inset-block-start:0;inset-inline-end:0;label:none;",
28
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
29
+ };
30
+
31
+ export var euiCodeBlockControlsStyles = function euiCodeBlockControlsStyles(euiThemeContext) {
32
+ var euiTheme = euiThemeContext.euiTheme;
33
+ var euiCodeSyntax = euiCodeSyntaxColors(euiThemeContext);
34
+ return {
35
+ euiCodeBlock__controls: /*#__PURE__*/css("position:absolute;display:flex;flex-direction:column;gap:", euiTheme.size.xs, ";background:", euiCodeSyntax.backgroundColor, ";;label:euiCodeBlock__controls;"),
36
+ offset: {
37
+ none: _ref,
38
+ s: /*#__PURE__*/css("inset-block-start:", euiPaddingSize(euiThemeContext, 's'), ";inset-inline-end:", euiPaddingSize(euiThemeContext, 's'), ";;label:s;"),
39
+ m: /*#__PURE__*/css("inset-block-start:", euiPaddingSize(euiThemeContext, 'm'), ";inset-inline-end:", euiPaddingSize(euiThemeContext, 'm'), ";;label:m;"),
40
+ l: /*#__PURE__*/css("inset-block-start:", euiPaddingSize(euiThemeContext, 'l'), ";inset-inline-end:", euiPaddingSize(euiThemeContext, 'l'), ";;label:l;")
41
+ }
42
+ };
43
+ };
@@ -0,0 +1,65 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+
3
+ 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."); }
4
+
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
+
7
+ function _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; }
8
+
9
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
+
11
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+
13
+ /*
14
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
15
+ * or more contributor license agreements. Licensed under the Elastic License
16
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
17
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
18
+ * Side Public License, v 1.
19
+ */
20
+ import React, { useMemo } from 'react';
21
+ import { useInnerText } from '../inner_text';
22
+ import { EuiCopy } from '../copy';
23
+ import { useEuiI18n } from '../i18n';
24
+ import { EuiButtonIcon } from '../button';
25
+ /**
26
+ * Hook that returns copy-related state/logic/utils
27
+ */
28
+
29
+ import { jsx as ___EmotionJSX } from "@emotion/react";
30
+ export var useCopy = function useCopy(_ref) {
31
+ var isCopyable = _ref.isCopyable,
32
+ isVirtualized = _ref.isVirtualized,
33
+ children = _ref.children;
34
+
35
+ var _useInnerText = useInnerText(''),
36
+ _useInnerText2 = _slicedToArray(_useInnerText, 2),
37
+ innerTextRef = _useInnerText2[0],
38
+ _innerText = _useInnerText2[1];
39
+
40
+ var innerText = useMemo(function () {
41
+ return (_innerText === null || _innerText === void 0 ? void 0 : _innerText.replace(/[\r\n?]{2}|\n\n/g, '\n')) || '';
42
+ }, [_innerText]);
43
+ var textToCopy = isVirtualized ? "".concat(children) : innerText; // Virtualized code blocks do not have inner text
44
+
45
+ var showCopyButton = isCopyable && textToCopy;
46
+ var copyAriaLabel = useEuiI18n('euiCodeBlockCopy.copy', 'Copy');
47
+ var copyButton = useMemo(function () {
48
+ return showCopyButton ? ___EmotionJSX("div", {
49
+ className: "euiCodeBlock__copyButton"
50
+ }, ___EmotionJSX(EuiCopy, {
51
+ textToCopy: textToCopy
52
+ }, function (copy) {
53
+ return ___EmotionJSX(EuiButtonIcon, {
54
+ onClick: copy,
55
+ iconType: "copyClipboard",
56
+ color: "text",
57
+ "aria-label": copyAriaLabel
58
+ });
59
+ })) : null;
60
+ }, [showCopyButton, textToCopy, copyAriaLabel]);
61
+ return {
62
+ innerTextRef: innerTextRef,
63
+ copyButton: copyButton
64
+ };
65
+ };
@@ -0,0 +1,90 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+
3
+ 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."); }
4
+
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
+
7
+ function _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; }
8
+
9
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
+
11
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+
13
+ /*
14
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
15
+ * or more contributor license agreements. Licensed under the Elastic License
16
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
17
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
18
+ * Side Public License, v 1.
19
+ */
20
+ import React, { useState, useCallback, useMemo } from 'react';
21
+ import { keys, useEuiTheme } from '../../services';
22
+ import { useEuiI18n } from '../i18n';
23
+ import { EuiButtonIcon } from '../button';
24
+ import { EuiFocusTrap } from '../focus_trap';
25
+ import { EuiOverlayMask } from '../overlay_mask';
26
+ import { euiCodeBlockStyles } from './code_block.styles';
27
+ /**
28
+ * Hook that returns fullscreen-related state/logic/utils
29
+ */
30
+
31
+ import { jsx as ___EmotionJSX } from "@emotion/react";
32
+ export var useFullScreen = function useFullScreen(_ref) {
33
+ var overflowHeight = _ref.overflowHeight;
34
+ var showFullScreenButton = !!overflowHeight;
35
+
36
+ var _useState = useState(false),
37
+ _useState2 = _slicedToArray(_useState, 2),
38
+ isFullScreen = _useState2[0],
39
+ setIsFullScreen = _useState2[1];
40
+
41
+ var toggleFullScreen = useCallback(function () {
42
+ setIsFullScreen(function (isFullScreen) {
43
+ return !isFullScreen;
44
+ });
45
+ }, []);
46
+ var onKeyDown = useCallback(function (event) {
47
+ if (event.key === keys.ESCAPE) {
48
+ event.preventDefault();
49
+ event.stopPropagation();
50
+ setIsFullScreen(false);
51
+ }
52
+ }, []);
53
+
54
+ var _useEuiI18n = useEuiI18n(['euiCodeBlockFullScreen.fullscreenCollapse', 'euiCodeBlockFullScreen.fullscreenExpand'], ['Collapse', 'Expand']),
55
+ _useEuiI18n2 = _slicedToArray(_useEuiI18n, 2),
56
+ fullscreenCollapse = _useEuiI18n2[0],
57
+ fullscreenExpand = _useEuiI18n2[1];
58
+
59
+ var fullScreenButton = useMemo(function () {
60
+ return showFullScreenButton ? ___EmotionJSX(EuiButtonIcon, {
61
+ className: "euiCodeBlock__fullScreenButton",
62
+ onClick: toggleFullScreen,
63
+ iconType: isFullScreen ? 'fullScreenExit' : 'fullScreen',
64
+ color: "text",
65
+ "aria-label": isFullScreen ? fullscreenCollapse : fullscreenExpand
66
+ }) : null;
67
+ }, [showFullScreenButton, toggleFullScreen, isFullScreen, fullscreenCollapse, fullscreenExpand]);
68
+ return {
69
+ fullScreenButton: fullScreenButton,
70
+ isFullScreen: isFullScreen,
71
+ onKeyDown: onKeyDown
72
+ };
73
+ };
74
+ /**
75
+ * Portalled full screen wrapper
76
+ */
77
+
78
+ export var EuiCodeBlockFullScreenWrapper = function EuiCodeBlockFullScreenWrapper(_ref2) {
79
+ var children = _ref2.children;
80
+ var euiThemeContext = useEuiTheme();
81
+ var styles = euiCodeBlockStyles(euiThemeContext);
82
+ var cssStyles = [styles.euiCodeBlock, styles.l, // Force fullscreen to use large font
83
+ styles.isFullScreen];
84
+ return ___EmotionJSX(EuiOverlayMask, null, ___EmotionJSX(EuiFocusTrap, {
85
+ clickOutsideDisables: true
86
+ }, ___EmotionJSX("div", {
87
+ className: "euiCodeBlockFullScreen",
88
+ css: cssStyles
89
+ }, children)));
90
+ };
@@ -0,0 +1,49 @@
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
+
11
+ /*
12
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
13
+ * or more contributor license agreements. Licensed under the Elastic License
14
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
15
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
16
+ * Side Public License, v 1.
17
+ */
18
+ import { css } from '@emotion/css';
19
+ import { euiBackgroundColor } from '../../global_styling';
20
+ // Note: These styles must be in a separate file due to using `css` from `@emotion/css`
21
+ // (i.e., applying styles in vanilla JS / directly to DOM nodes instead of React)
22
+ export var euiCodeBlockLineStyles = function euiCodeBlockLineStyles(euiThemeContext) {
23
+ var euiTheme = euiThemeContext.euiTheme;
24
+ return {
25
+ euiCodeBlock__line: /*#__PURE__*/css(process.env.NODE_ENV === "production" ? {
26
+ name: "yn676d-euiCodeBlock__line",
27
+ styles: "display:block;label:euiCodeBlock__line;"
28
+ } : {
29
+ name: "yn676d-euiCodeBlock__line",
30
+ styles: "display:block;label:euiCodeBlock__line;",
31
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
32
+ }),
33
+ hasLineNumbers: /*#__PURE__*/css(process.env.NODE_ENV === "production" ? {
34
+ name: "156gjef-hasLineNumbers",
35
+ styles: "display:flex;user-select:none;label:hasLineNumbers;"
36
+ } : {
37
+ name: "156gjef-hasLineNumbers",
38
+ styles: "display:flex;user-select:none;label:hasLineNumbers;",
39
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
40
+ }),
41
+ lineText: {
42
+ euiCodeBlock__lineText: /*#__PURE__*/css("flex-grow:1;display:inline-block;padding-inline-start:", euiTheme.size.s, ";border-inline-start:", euiTheme.border.thin, ";user-select:text;;label:euiCodeBlock__lineText;"),
43
+ isHighlighted: /*#__PURE__*/css("background:", euiBackgroundColor(euiThemeContext, 'primary'), ";border-inline-start:", euiTheme.border.width.thick, " solid ", euiTheme.colors.primary, ";;label:isHighlighted;")
44
+ },
45
+ lineNumber: {
46
+ euiCodeBlock__lineNumber: /*#__PURE__*/css("flex-grow:0;flex-shrink:0;user-select:none;padding-inline-end:", euiTheme.size.s, ";box-sizing:content-box;&:before{content:attr(data-line-number);color:", euiTheme.colors.subduedText, ";text-align:end;display:block;};label:euiCodeBlock__lineNumber;")
47
+ }
48
+ };
49
+ };
@@ -0,0 +1,78 @@
1
+ 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; }
2
+
3
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
+
5
+ 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."); }
6
+
7
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
+
9
+ 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; }
10
+
11
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
12
+
13
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
+
15
+ /*
16
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
17
+ * or more contributor license agreements. Licensed under the Elastic License
18
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
19
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
20
+ * Side Public License, v 1.
21
+ */
22
+ import { useEffect, useState, useMemo } from 'react';
23
+ import { useMutationObserver } from '../observer/mutation_observer';
24
+ import { useResizeObserver } from '../observer/resize_observer';
25
+ /**
26
+ * Overflow logic - returns overflow-related state/logic/utils
27
+ *
28
+ * Detects whether the code block overflows and returns a tabIndex of 0 if so,
29
+ * which allows keyboard users to use the up/down arrow keys to scroll through
30
+ * the container.
31
+ */
32
+
33
+ export var useOverflow = function useOverflow(_ref) {
34
+ var overflowHeight = _ref.overflowHeight;
35
+
36
+ var _useState = useState(null),
37
+ _useState2 = _slicedToArray(_useState, 2),
38
+ wrapperRef = _useState2[0],
39
+ setWrapperRef = _useState2[1];
40
+
41
+ var _useState3 = useState(-1),
42
+ _useState4 = _slicedToArray(_useState3, 2),
43
+ tabIndex = _useState4[0],
44
+ setTabIndex = _useState4[1];
45
+
46
+ var _useResizeObserver = useResizeObserver(wrapperRef),
47
+ width = _useResizeObserver.width,
48
+ height = _useResizeObserver.height;
49
+
50
+ var doesOverflow = function doesOverflow() {
51
+ if (!wrapperRef) return;
52
+ var clientWidth = wrapperRef.clientWidth,
53
+ clientHeight = wrapperRef.clientHeight,
54
+ scrollWidth = wrapperRef.scrollWidth,
55
+ scrollHeight = wrapperRef.scrollHeight;
56
+ var doesOverflow = scrollHeight > clientHeight || scrollWidth > clientWidth;
57
+ setTabIndex(doesOverflow ? 0 : -1);
58
+ };
59
+
60
+ useMutationObserver(wrapperRef, doesOverflow, {
61
+ subtree: true,
62
+ childList: true
63
+ });
64
+ useEffect(doesOverflow, [width, height, wrapperRef]);
65
+ var overflowHeightStyles = useMemo(function () {
66
+ if (overflowHeight) {
67
+ var property = typeof overflowHeight === 'string' ? 'blockSize' : 'maxBlockSize';
68
+ return _defineProperty({}, property, overflowHeight);
69
+ }
70
+
71
+ return {};
72
+ }, [overflowHeight]);
73
+ return {
74
+ setWrapperRef: setWrapperRef,
75
+ tabIndex: tabIndex,
76
+ overflowHeightStyles: overflowHeightStyles
77
+ };
78
+ };
@@ -0,0 +1,59 @@
1
+ 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); }
2
+
3
+ /*
4
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
5
+ * or more contributor license agreements. Licensed under the Elastic License
6
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
7
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
8
+ * Side Public License, v 1.
9
+ */
10
+ import React, { forwardRef, useMemo } from 'react';
11
+ import { FixedSizeList } from 'react-window';
12
+ import { EuiAutoSizer } from '../auto_sizer';
13
+ import { nodeToHtml } from './utils';
14
+ import { jsx as ___EmotionJSX } from "@emotion/react";
15
+ export var EuiCodeBlockVirtualized = function EuiCodeBlockVirtualized(_ref) {
16
+ var data = _ref.data,
17
+ rowHeight = _ref.rowHeight,
18
+ overflowHeight = _ref.overflowHeight,
19
+ preProps = _ref.preProps,
20
+ codeProps = _ref.codeProps;
21
+ var VirtualizedOuterElement = useMemo(function () {
22
+ return /*#__PURE__*/forwardRef(function (props, ref) {
23
+ return ___EmotionJSX("pre", _extends({}, props, {
24
+ ref: ref
25
+ }, preProps));
26
+ });
27
+ }, [preProps]);
28
+ var VirtualizedInnerElement = useMemo(function () {
29
+ return /*#__PURE__*/forwardRef(function (props, ref) {
30
+ return ___EmotionJSX("code", _extends({}, props, {
31
+ ref: ref
32
+ }, codeProps));
33
+ });
34
+ }, [codeProps]);
35
+ return ___EmotionJSX(EuiAutoSizer, {
36
+ disableHeight: typeof overflowHeight === 'number'
37
+ }, function (_ref2) {
38
+ var height = _ref2.height,
39
+ width = _ref2.width;
40
+ return ___EmotionJSX(FixedSizeList, {
41
+ height: height !== null && height !== void 0 ? height : overflowHeight,
42
+ width: width,
43
+ itemData: data,
44
+ itemSize: rowHeight,
45
+ itemCount: data.length,
46
+ outerElementType: VirtualizedOuterElement,
47
+ innerElementType: VirtualizedInnerElement
48
+ }, ListRow);
49
+ });
50
+ };
51
+
52
+ var ListRow = function ListRow(_ref3) {
53
+ var data = _ref3.data,
54
+ index = _ref3.index,
55
+ style = _ref3.style;
56
+ var row = data[index];
57
+ row.properties.style = style;
58
+ return nodeToHtml(row, index, data, 0);
59
+ };
@@ -0,0 +1,43 @@
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 { makeHighContrastColor, euiPaletteColorBlind } from '../../services';
9
+ var visColors = euiPaletteColorBlind();
10
+ export var euiCodeSyntaxColors = function euiCodeSyntaxColors(euiThemeContext) {
11
+ var euiTheme = euiThemeContext.euiTheme;
12
+ var backgroundColor = euiTheme.colors.lightestShade;
13
+ return {
14
+ backgroundColor: backgroundColor,
15
+ color: makeHighContrastColor(euiTheme.colors.text)(backgroundColor),
16
+ inlineCodeColor: makeHighContrastColor(visColors[3])(backgroundColor),
17
+ selectedBackgroundColor: 'inherit',
18
+ commentColor: makeHighContrastColor(euiTheme.colors.subduedText)(backgroundColor),
19
+ selectorTagColor: 'inherit',
20
+ stringColor: makeHighContrastColor(visColors[2])(backgroundColor),
21
+ tagColor: makeHighContrastColor(visColors[1])(backgroundColor),
22
+ nameColor: makeHighContrastColor(visColors[1])(backgroundColor),
23
+ numberColor: makeHighContrastColor(visColors[0])(backgroundColor),
24
+ keywordColor: makeHighContrastColor(visColors[3])(backgroundColor),
25
+ functionTitleColor: 'inherit',
26
+ typeColor: makeHighContrastColor(visColors[1])(backgroundColor),
27
+ attributeColor: 'inherit',
28
+ symbolColor: makeHighContrastColor(visColors[9])(backgroundColor),
29
+ paramsColor: 'inherit',
30
+ metaColor: makeHighContrastColor(euiTheme.colors.subduedText)(backgroundColor),
31
+ titleColor: makeHighContrastColor(visColors[7])(backgroundColor),
32
+ sectionColor: makeHighContrastColor(visColors[9])(backgroundColor),
33
+ additionColor: makeHighContrastColor(visColors[0])(backgroundColor),
34
+ deletionColor: makeHighContrastColor(euiTheme.colors.danger)(backgroundColor),
35
+ selectorClassColor: 'inherit',
36
+ selectorIdColor: 'inherit'
37
+ };
38
+ };
39
+ export var euiCodeSyntaxTokens = function euiCodeSyntaxTokens(euiThemeContext) {
40
+ var euiTheme = euiThemeContext.euiTheme;
41
+ var euiCodeBlock = euiCodeSyntaxColors(euiThemeContext);
42
+ return "\n .token.punctuation:not(.interpolation-punctuation):not([class*='attr-']) {\n opacity: .7;\n }\n \n .token.comment,\n .token.prolog,\n .token.doctype,\n .token.cdata,\n .token.coord,\n .token.blockquote {\n color: ".concat(euiCodeBlock.commentColor, ";\n font-style: italic;\n }\n \n .token.selector {\n color: ").concat(euiCodeBlock.selectorTagColor, ";\n }\n \n .token.string,\n .token.interpolation,\n .token.interpolation-punctuation,\n .token.doc-comment .token.keyword,\n .token.attr-value,\n .token.url .token.content {\n color: ").concat(euiCodeBlock.stringColor, ";\n }\n \n .token.number,\n .token.boolean,\n .token.keyword.nil,\n .token.regex,\n .token.variable,\n .token.unit,\n .token.hexcode,\n .token.attr-name,\n .token.attr-equals {\n color: ").concat(euiCodeBlock.numberColor, ";\n }\n \n .token.atrule .token.rule,\n .token.keyword {\n color: ").concat(euiCodeBlock.keywordColor, ";\n }\n \n .token.function {\n color: ").concat(euiCodeBlock.functionTitleColor, ";\n }\n \n .token.tag {\n color: ").concat(euiCodeBlock.tagColor, ";\n }\n \n .token.class-name {\n color: ").concat(euiCodeBlock.typeColor, ";\n }\n \n .token.property {\n color: ").concat(euiCodeBlock.attributeColor, ";\n }\n \n .token.console,\n .token.list-punctuation,\n .token.url-reference,\n .token.url .token.url {\n color: ").concat(euiCodeBlock.symbolColor, ";\n }\n \n .token.paramater {\n color: ").concat(euiCodeBlock.paramsColor, ";\n }\n \n .token.meta,\n .token.important {\n color: ").concat(euiCodeBlock.metaColor, ";\n }\n \n .token.title {\n color: ").concat(euiCodeBlock.titleColor, ";\n }\n \n .token.section {\n color: ").concat(euiCodeBlock.sectionColor, ";\n }\n \n .token.prefix.inserted,\n .token.prefix.deleted {\n padding-inline-start: -").concat(euiTheme.size.xs, ";\n margin-inline-start: -").concat(euiTheme.size.xs, ";\n }\n \n .token.prefix.inserted {\n box-shadow: -").concat(euiTheme.size.xs, " 0 ").concat(euiCodeBlock.additionColor, ";\n color: ").concat(euiCodeBlock.additionColor, ";\n }\n \n .token.prefix.deleted {\n box-shadow: -").concat(euiTheme.size.xs, " 0 ").concat(euiCodeBlock.deletionColor, ";\n color: ").concat(euiCodeBlock.deletionColor, ";\n }\n \n .token.selector .token.class {\n color: ").concat(euiCodeBlock.selectorClassColor, ";\n }\n \n .token.selector .token.id {\n color: ").concat(euiCodeBlock.selectorIdColor, ";\n }\n \n .token.italic {\n font-style: italic;\n }\n \n .token.important,\n .token.bold {\n font-weight: $euiCodeFontWeightBold;\n }\n \n .token.url-reference,\n .token.url .token.url {\n text-decoration: underline;\n }\n \n .token.entity {\n cursor: help;\n }\n ");
43
+ };
@@ -13,7 +13,12 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
13
13
  */
14
14
  import React, { createElement } from 'react';
15
15
  import { listLanguages, highlight } from 'refractor';
16
- import classNames from 'classnames';
16
+ import { cx } from '@emotion/css';
17
+ import { euiCodeBlockLineStyles } from './code_block_line.styles';
18
+ /**
19
+ * Utils shared between EuiCode and EuiCodeBlock
20
+ */
21
+
17
22
  import { jsx as ___EmotionJSX } from "@emotion/react";
18
23
  export var SUPPORTED_LANGUAGES = listLanguages();
19
24
  export var DEFAULT_LANGUAGE = 'text';
@@ -40,7 +45,7 @@ export var nodeToHtml = function nodeToHtml(node, idx, nodes) {
40
45
  children = node.children;
41
46
  return /*#__PURE__*/createElement(tagName, _objectSpread(_objectSpread({}, properties), {}, {
42
47
  key: key,
43
- className: classNames(properties.className)
48
+ className: cx(properties.className)
44
49
  }), children && children.map(function (el, i) {
45
50
  return nodeToHtml(el, i, nodes, depth + 1);
46
51
  }));
@@ -55,8 +60,7 @@ export var nodeToHtml = function nodeToHtml(node, idx, nodes) {
55
60
  */
56
61
 
57
62
  // Approximate width of a single digit/character
58
- var CHAR_SIZE = 8;
59
- var $euiSizeS = 8; // Creates an array of numbers from comma-separeated
63
+ var CHAR_SIZE = 8; // Creates an array of numbers from comma-separeated
60
64
  // string of numbers or number ranges using `-`
61
65
  // (e.g., "1, 3-10, 15")
62
66
 
@@ -129,8 +133,7 @@ var addLineData = function addLineData(nodes, data) {
129
133
  }, []);
130
134
  };
131
135
 
132
- function wrapLines(nodes, options) {
133
- var highlights = options.highlight ? parseLineRanges(options.highlight) : [];
136
+ function wrapLines(nodes, options, euiTheme) {
134
137
  var grouped = [];
135
138
  nodes.forEach(function (node) {
136
139
  var lineStart = node.lineStart - 1;
@@ -142,41 +145,44 @@ function wrapLines(nodes, options) {
142
145
  }
143
146
  });
144
147
  var wrapped = [];
145
- var digits = grouped.length.toString().length;
146
- var width = digits * CHAR_SIZE;
147
148
  grouped.forEach(function (node, i) {
148
- var _properties;
149
-
150
- var lineNumber = i + 1;
151
- var classes = classNames('euiCodeBlock__line', {
152
- 'euiCodeBlock__line--isHighlighted': highlights.includes(lineNumber)
153
- });
154
- var children = options.showLineNumbers ? [{
155
- type: 'element',
156
- tagName: 'span',
157
- properties: (_properties = {
158
- style: {
159
- width: width
160
- }
161
- }, _defineProperty(_properties, 'data-line-number', lineNumber), _defineProperty(_properties, 'aria-hidden', true), _defineProperty(_properties, "className", ['euiCodeBlock__lineNumber']), _properties),
162
- children: []
163
- }, {
164
- type: 'element',
165
- tagName: 'span',
166
- properties: {
167
- style: {
168
- marginLeft: width + $euiSizeS,
169
- width: "calc(100% - ".concat(width, "px)")
149
+ var children = node;
150
+ var styles = euiCodeBlockLineStyles(euiTheme);
151
+ var lineStyles = cx([styles.euiCodeBlock__line, options.showLineNumbers && styles.hasLineNumbers]);
152
+
153
+ if (options.showLineNumbers) {
154
+ var _properties;
155
+
156
+ var lineNumber = i + 1;
157
+ var digits = grouped.length.toString().length;
158
+ var width = digits * CHAR_SIZE;
159
+ var highlights = options.highlight ? parseLineRanges(options.highlight) : [];
160
+ var lineTextStyles = cx([styles.lineText.euiCodeBlock__lineText, highlights.includes(lineNumber) && styles.lineText.isHighlighted]);
161
+ var lineNumberStyles = cx(styles.lineNumber.euiCodeBlock__lineNumber);
162
+ children = [{
163
+ type: 'element',
164
+ tagName: 'span',
165
+ properties: (_properties = {
166
+ style: {
167
+ inlineSize: width
168
+ }
169
+ }, _defineProperty(_properties, 'data-line-number', lineNumber), _defineProperty(_properties, 'aria-hidden', true), _defineProperty(_properties, "className", ['euiCodeBlock__lineNumber', lineNumberStyles]), _properties),
170
+ children: []
171
+ }, {
172
+ type: 'element',
173
+ tagName: 'span',
174
+ properties: {
175
+ className: ['euiCodeBlock__lineText', lineTextStyles]
170
176
  },
171
- className: ['euiCodeBlock__lineText']
172
- },
173
- children: node
174
- }] : node;
177
+ children: node
178
+ }];
179
+ }
180
+
175
181
  wrapped.push({
176
182
  type: 'element',
177
183
  tagName: 'span',
178
184
  properties: {
179
- className: [classes]
185
+ className: ['euiCodeBlock__line', lineStyles]
180
186
  },
181
187
  children: children
182
188
  });
@@ -184,11 +190,11 @@ function wrapLines(nodes, options) {
184
190
  return wrapped;
185
191
  }
186
192
 
187
- export var highlightByLine = function highlightByLine(children, language, data) {
193
+ export var highlightByLine = function highlightByLine(children, language, data, euiTheme) {
188
194
  return wrapLines(addLineData(highlight(children, language), {
189
195
  lineNumber: data.start
190
196
  }), {
191
197
  showLineNumbers: data.show,
192
198
  highlight: data.highlight
193
- });
199
+ }, euiTheme);
194
200
  };
@@ -187,11 +187,6 @@ EuiCollapsibleNav.propTypes = {
187
187
  * Adjustments to the EuiOverlayMask that is added when `ownFocus = true`
188
188
  */
189
189
  maskProps: PropTypes.shape({
190
- className: PropTypes.string,
191
- "aria-label": PropTypes.string,
192
- "data-test-subj": PropTypes.string,
193
- css: PropTypes.any,
194
-
195
190
  /**
196
191
  * ReactNode to render as this component's content
197
192
  */
@@ -127,7 +127,7 @@ export var useDataGridColumnSelector = function useDataGridColumnSelector(availa
127
127
  },
128
128
  anchorPosition: "downLeft",
129
129
  panelPaddingSize: "s",
130
- panelClassName: "euiDataGrid__controlPopoverWithDragDrop",
130
+ hasDragDrop: true,
131
131
  button: ___EmotionJSX(EuiButtonEmpty, {
132
132
  size: "xs",
133
133
  iconType: allowColumnHiding ? 'listAdd' : 'list',
@@ -140,7 +140,7 @@ export var useDataGridColumnSorting = function useDataGridColumnSorting(columns,
140
140
  },
141
141
  anchorPosition: "downLeft",
142
142
  panelPaddingSize: "s",
143
- panelClassName: "euiDataGrid__controlPopoverWithDragDrop",
143
+ hasDragDrop: true,
144
144
  button: ___EmotionJSX(EuiButtonEmpty, {
145
145
  size: "xs",
146
146
  iconType: "sortable",
@@ -252,6 +252,12 @@ EuiHeaderLinks.propTypes = {
252
252
  */
253
253
  repositionOnScroll: PropTypes.bool,
254
254
 
255
+ /**
256
+ * Must be set to true if using `EuiDragDropContext` within a popover,
257
+ * otherwise your nested drag & drop will have incorrect positioning
258
+ */
259
+ hasDragDrop: PropTypes.bool,
260
+
255
261
  /**
256
262
  * By default, popover content inherits the z-index of the anchor
257
263
  * component; pass `zIndex` to override