@elastic/eui 88.1.0 → 88.3.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 (456) hide show
  1. package/dist/eui_charts_theme.js.map +1 -1
  2. package/dist/eui_theme_dark.css +9 -61
  3. package/dist/eui_theme_dark.min.css +1 -1
  4. package/dist/eui_theme_light.css +9 -61
  5. package/dist/eui_theme_light.min.css +1 -1
  6. package/es/components/accordion/accordion.js +50 -198
  7. package/es/components/accordion/accordion.styles.js +11 -83
  8. package/es/components/accordion/accordion_children/accordion_children.js +101 -0
  9. package/es/components/accordion/accordion_children/accordion_children.styles.js +39 -0
  10. package/es/components/accordion/accordion_children/accordion_children_loading.js +31 -0
  11. package/es/components/accordion/accordion_children/index.js +9 -0
  12. package/es/components/accordion/accordion_trigger/accordion_arrow.js +41 -0
  13. package/es/components/accordion/accordion_trigger/accordion_arrow.styles.js +46 -0
  14. package/es/components/accordion/accordion_trigger/accordion_button.js +51 -0
  15. package/es/components/accordion/accordion_trigger/accordion_button.styles.js +26 -0
  16. package/es/components/accordion/accordion_trigger/accordion_trigger.js +87 -0
  17. package/es/components/accordion/accordion_trigger/index.js +9 -0
  18. package/es/components/avatar/avatar.js +1 -1
  19. package/es/components/badge/badge.js +1 -1
  20. package/es/components/badge/beta_badge/beta_badge.js +1 -1
  21. package/es/components/basic_table/basic_table.js +1 -1
  22. package/es/components/basic_table/collapsed_item_actions.js +1 -1
  23. package/es/components/basic_table/in_memory_table.js +1 -1
  24. package/es/components/button/button_display/_button_display.js +1 -1
  25. package/es/components/button/button_display/_button_display_content.js +1 -1
  26. package/es/components/button/button_empty/button_empty.js +1 -1
  27. package/es/components/button/button_group/button_group.js +1 -1
  28. package/es/components/button/button_group/button_group_button.js +1 -1
  29. package/es/components/button/button_icon/button_icon.js +1 -1
  30. package/es/components/call_out/call_out.js +1 -1
  31. package/es/components/card/card.js +1 -1
  32. package/es/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +11 -3
  33. package/es/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.styles.js +1 -1
  34. package/es/components/collapsible_nav_beta/collapsible_nav_beta.js +2 -25
  35. package/es/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
  36. package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +2 -2
  37. package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_item.js +2 -2
  38. package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_popover.js +3 -3
  39. package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.js +2 -2
  40. package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.styles.js +1 -1
  41. package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +3 -3
  42. package/es/components/comment_list/comment.js +2 -2
  43. package/es/components/comment_list/comment_event.js +1 -1
  44. package/es/components/comment_list/comment_list.js +2 -2
  45. package/es/components/comment_list/comment_timeline.js +1 -1
  46. package/es/components/datagrid/body/data_grid_body.js +13 -13
  47. package/es/components/datagrid/body/data_grid_body_custom.js +13 -13
  48. package/es/components/datagrid/body/data_grid_body_virtualized.js +13 -13
  49. package/es/components/datagrid/body/data_grid_cell.js +24 -24
  50. package/es/components/datagrid/body/header/data_grid_header_cell.js +12 -12
  51. package/es/components/datagrid/body/header/data_grid_header_row.js +13 -13
  52. package/es/components/datagrid/controls/column_sorting_draggable.js +1 -1
  53. package/es/components/datagrid/data_grid.js +13 -13
  54. package/es/components/datagrid/utils/in_memory.js +12 -12
  55. package/es/components/date_picker/date_picker.js +2 -2
  56. package/es/components/date_picker/date_picker_range.js +1 -1
  57. package/es/components/empty_prompt/empty_prompt.js +1 -1
  58. package/es/components/facet/facet_button.js +1 -1
  59. package/es/components/flyout/flyout.styles.js +1 -1
  60. package/es/components/form/field_number/field_number.js +1 -1
  61. package/es/components/form/field_text/field_text.js +2 -2
  62. package/es/components/form/form_control_layout/form_control_layout.js +2 -2
  63. package/es/components/form/form_control_layout/form_control_layout_custom_icon.js +1 -1
  64. package/es/components/form/form_control_layout/form_control_layout_icons.js +2 -2
  65. package/es/components/header/header.js +120 -25
  66. package/es/components/header/header.styles.js +1 -1
  67. package/es/components/header/header_links/header_link.js +1 -1
  68. package/es/components/header/header_links/header_links.js +1 -1
  69. package/es/components/header/header_logo/header_logo.js +1 -1
  70. package/es/components/header/header_section/header_section_item_button.js +1 -1
  71. package/es/components/icon/assets/grabOmnidirectional.js +33 -0
  72. package/es/components/icon/assets/transitionLeftIn.js +36 -0
  73. package/es/components/icon/assets/transitionLeftOut.js +36 -0
  74. package/es/components/icon/assets/transitionTopIn.js +36 -0
  75. package/es/components/icon/assets/transitionTopOut.js +36 -0
  76. package/es/components/icon/icon.js +1 -1
  77. package/es/components/icon/icon_map.js +5 -0
  78. package/es/components/index.js +1 -0
  79. package/es/components/inline_edit/inline_edit_form.js +49 -13
  80. package/es/components/inline_edit/inline_edit_text.js +22 -23
  81. package/es/components/inline_edit/inline_edit_title.js +22 -23
  82. package/es/components/key_pad_menu/key_pad_menu_item.js +1 -1
  83. package/es/components/list_group/list_group.js +2 -2
  84. package/es/components/list_group/list_group_item.js +3 -3
  85. package/es/components/list_group/list_group_item_extra_action.js +1 -1
  86. package/es/components/list_group/pinnable_list_group/pinnable_list_group.js +4 -4
  87. package/es/components/loading/loading_logo.js +1 -1
  88. package/es/components/markdown_editor/markdown_editor.js +1 -1
  89. package/es/components/markdown_editor/markdown_editor_drop_zone.js +1 -1
  90. package/es/components/markdown_editor/markdown_editor_footer.js +1 -1
  91. package/es/components/markdown_editor/markdown_editor_toolbar.js +1 -1
  92. package/es/components/notification/notification_event.js +2 -2
  93. package/es/components/notification/notification_event_meta.js +1 -1
  94. package/es/components/overlay_mask/overlay_mask.styles.js +1 -1
  95. package/es/components/page/page_header/page_header_content.js +1 -1
  96. package/es/components/page/page_sidebar/page_sidebar.js +2 -4
  97. package/es/components/page_template/page_template.js +4 -31
  98. package/es/components/pagination/pagination_button.js +1 -1
  99. package/es/components/panel/split_panel/split_panel.js +9 -7
  100. package/es/components/panel/split_panel/split_panel.styles.js +40 -0
  101. package/es/components/selectable/selectable_list/selectable_list.js +1 -1
  102. package/es/components/selectable/selectable_list/selectable_list_item.js +1 -1
  103. package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +1 -1
  104. package/es/components/suggest/suggest.js +1 -1
  105. package/es/components/suggest/suggest_item.js +1 -1
  106. package/es/components/table/table_header_button.js +1 -1
  107. package/es/components/text_truncate/index.js +10 -0
  108. package/es/components/text_truncate/text_truncate.js +232 -0
  109. package/es/components/text_truncate/text_truncate.styles.js +49 -0
  110. package/es/components/text_truncate/utils.js +348 -0
  111. package/es/components/timeline/timeline_item_icon.js +1 -1
  112. package/es/components/toast/global_toast_list.js +51 -3
  113. package/es/components/toast/global_toast_list.styles.js +3 -2
  114. package/es/components/toast/toast.js +1 -1
  115. package/es/components/tool_tip/icon_tip.js +1 -1
  116. package/es/services/theme/context.js +3 -1
  117. package/es/services/theme/hooks.js +19 -1
  118. package/es/services/theme/index.js +1 -1
  119. package/es/services/theme/provider.js +37 -8
  120. package/eui.d.ts +432 -53
  121. package/i18ntokens.json +64 -28
  122. package/lib/components/accordion/accordion.js +49 -197
  123. package/lib/components/accordion/accordion.styles.js +20 -96
  124. package/lib/components/accordion/accordion_children/accordion_children.js +111 -0
  125. package/lib/components/accordion/accordion_children/accordion_children.styles.js +45 -0
  126. package/lib/components/accordion/accordion_children/accordion_children_loading.js +38 -0
  127. package/lib/components/accordion/accordion_children/index.js +12 -0
  128. package/lib/components/accordion/accordion_trigger/accordion_arrow.js +48 -0
  129. package/lib/components/accordion/accordion_trigger/accordion_arrow.styles.js +51 -0
  130. package/lib/components/accordion/accordion_trigger/accordion_button.js +58 -0
  131. package/lib/components/accordion/accordion_trigger/accordion_button.styles.js +33 -0
  132. package/lib/components/accordion/accordion_trigger/accordion_trigger.js +93 -0
  133. package/lib/components/accordion/accordion_trigger/index.js +12 -0
  134. package/lib/components/avatar/avatar.js +1 -1
  135. package/lib/components/badge/badge.js +1 -1
  136. package/lib/components/badge/beta_badge/beta_badge.js +1 -1
  137. package/lib/components/basic_table/basic_table.js +1 -1
  138. package/lib/components/basic_table/collapsed_item_actions.js +1 -1
  139. package/lib/components/basic_table/in_memory_table.js +1 -1
  140. package/lib/components/button/button_display/_button_display.js +1 -1
  141. package/lib/components/button/button_display/_button_display_content.js +1 -1
  142. package/lib/components/button/button_empty/button_empty.js +1 -1
  143. package/lib/components/button/button_group/button_group.js +1 -1
  144. package/lib/components/button/button_group/button_group_button.js +1 -1
  145. package/lib/components/button/button_icon/button_icon.js +1 -1
  146. package/lib/components/call_out/call_out.js +1 -1
  147. package/lib/components/card/card.js +1 -1
  148. package/lib/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +11 -3
  149. package/lib/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.styles.js +1 -1
  150. package/lib/components/collapsible_nav_beta/collapsible_nav_beta.js +2 -25
  151. package/lib/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
  152. package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +2 -2
  153. package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_item.js +2 -2
  154. package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_popover.js +3 -3
  155. package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.js +2 -2
  156. package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.styles.js +1 -1
  157. package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +3 -3
  158. package/lib/components/comment_list/comment.js +2 -2
  159. package/lib/components/comment_list/comment_event.js +1 -1
  160. package/lib/components/comment_list/comment_list.js +2 -2
  161. package/lib/components/comment_list/comment_timeline.js +1 -1
  162. package/lib/components/datagrid/body/data_grid_body.js +13 -13
  163. package/lib/components/datagrid/body/data_grid_body_custom.js +13 -13
  164. package/lib/components/datagrid/body/data_grid_body_virtualized.js +13 -13
  165. package/lib/components/datagrid/body/data_grid_cell.js +24 -24
  166. package/lib/components/datagrid/body/header/data_grid_header_cell.js +12 -12
  167. package/lib/components/datagrid/body/header/data_grid_header_row.js +13 -13
  168. package/lib/components/datagrid/controls/column_sorting_draggable.js +1 -1
  169. package/lib/components/datagrid/data_grid.js +13 -13
  170. package/lib/components/datagrid/utils/in_memory.js +12 -12
  171. package/lib/components/date_picker/date_picker.js +2 -2
  172. package/lib/components/date_picker/date_picker_range.js +1 -1
  173. package/lib/components/empty_prompt/empty_prompt.js +1 -1
  174. package/lib/components/facet/facet_button.js +1 -1
  175. package/lib/components/flyout/flyout.styles.js +1 -1
  176. package/lib/components/form/field_number/field_number.js +1 -1
  177. package/lib/components/form/field_text/field_text.js +2 -2
  178. package/lib/components/form/form_control_layout/form_control_layout.js +2 -2
  179. package/lib/components/form/form_control_layout/form_control_layout_custom_icon.js +1 -1
  180. package/lib/components/form/form_control_layout/form_control_layout_icons.js +2 -2
  181. package/lib/components/header/header.js +120 -23
  182. package/lib/components/header/header.styles.js +1 -1
  183. package/lib/components/header/header_links/header_link.js +1 -1
  184. package/lib/components/header/header_links/header_links.js +1 -1
  185. package/lib/components/header/header_logo/header_logo.js +1 -1
  186. package/lib/components/header/header_section/header_section_item_button.js +1 -1
  187. package/lib/components/icon/assets/grabOmnidirectional.js +41 -0
  188. package/lib/components/icon/assets/transitionLeftIn.js +44 -0
  189. package/lib/components/icon/assets/transitionLeftOut.js +44 -0
  190. package/lib/components/icon/assets/transitionTopIn.js +44 -0
  191. package/lib/components/icon/assets/transitionTopOut.js +44 -0
  192. package/lib/components/icon/icon.js +1 -1
  193. package/lib/components/icon/icon_map.js +5 -0
  194. package/lib/components/icon/svgs/grabOmnidirectional.svg +3 -0
  195. package/lib/components/icon/svgs/transitionLeftIn.svg +4 -0
  196. package/lib/components/icon/svgs/transitionLeftOut.svg +4 -0
  197. package/lib/components/icon/svgs/transitionTopIn.svg +4 -0
  198. package/lib/components/icon/svgs/transitionTopOut.svg +4 -0
  199. package/lib/components/index.js +11 -0
  200. package/lib/components/inline_edit/inline_edit_form.js +58 -20
  201. package/lib/components/inline_edit/inline_edit_text.js +22 -23
  202. package/lib/components/inline_edit/inline_edit_title.js +22 -23
  203. package/lib/components/key_pad_menu/key_pad_menu_item.js +1 -1
  204. package/lib/components/list_group/list_group.js +2 -2
  205. package/lib/components/list_group/list_group_item.js +3 -3
  206. package/lib/components/list_group/list_group_item_extra_action.js +1 -1
  207. package/lib/components/list_group/pinnable_list_group/pinnable_list_group.js +4 -4
  208. package/lib/components/loading/loading_logo.js +1 -1
  209. package/lib/components/markdown_editor/markdown_editor.js +1 -1
  210. package/lib/components/markdown_editor/markdown_editor_drop_zone.js +1 -1
  211. package/lib/components/markdown_editor/markdown_editor_footer.js +1 -1
  212. package/lib/components/markdown_editor/markdown_editor_toolbar.js +1 -1
  213. package/lib/components/notification/notification_event.js +2 -2
  214. package/lib/components/notification/notification_event_meta.js +1 -1
  215. package/lib/components/overlay_mask/overlay_mask.styles.js +1 -1
  216. package/lib/components/page/page_header/page_header_content.js +1 -1
  217. package/lib/components/page/page_sidebar/page_sidebar.js +2 -4
  218. package/lib/components/page_template/page_template.js +2 -29
  219. package/lib/components/panel/split_panel/split_panel.js +9 -7
  220. package/lib/components/panel/split_panel/split_panel.styles.js +46 -0
  221. package/lib/components/selectable/selectable_list/selectable_list.js +1 -1
  222. package/lib/components/selectable/selectable_list/selectable_list_item.js +1 -1
  223. package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +1 -1
  224. package/lib/components/suggest/suggest.js +1 -1
  225. package/lib/components/suggest/suggest_item.js +1 -1
  226. package/lib/components/table/table_header_button.js +1 -1
  227. package/lib/components/text_truncate/index.js +25 -0
  228. package/lib/components/text_truncate/text_truncate.js +242 -0
  229. package/lib/components/text_truncate/text_truncate.styles.js +54 -0
  230. package/lib/components/text_truncate/utils.js +352 -0
  231. package/lib/components/timeline/timeline_item_icon.js +1 -1
  232. package/lib/components/toast/global_toast_list.js +53 -4
  233. package/lib/components/toast/global_toast_list.styles.js +3 -2
  234. package/lib/components/toast/toast.js +1 -1
  235. package/lib/components/tool_tip/icon_tip.js +1 -1
  236. package/lib/services/theme/context.js +3 -1
  237. package/lib/services/theme/hooks.js +21 -2
  238. package/lib/services/theme/index.js +6 -0
  239. package/lib/services/theme/provider.js +62 -35
  240. package/optimize/es/components/accordion/accordion.js +40 -196
  241. package/optimize/es/components/accordion/accordion.styles.js +11 -83
  242. package/optimize/es/components/accordion/accordion_children/accordion_children.js +91 -0
  243. package/optimize/es/components/accordion/accordion_children/accordion_children.styles.js +39 -0
  244. package/optimize/es/components/accordion/accordion_children/accordion_children_loading.js +31 -0
  245. package/optimize/es/components/accordion/accordion_children/index.js +9 -0
  246. package/optimize/es/components/accordion/accordion_trigger/accordion_arrow.js +36 -0
  247. package/optimize/es/components/accordion/accordion_trigger/accordion_arrow.styles.js +46 -0
  248. package/optimize/es/components/accordion/accordion_trigger/accordion_button.js +45 -0
  249. package/optimize/es/components/accordion/accordion_trigger/accordion_button.styles.js +26 -0
  250. package/optimize/es/components/accordion/accordion_trigger/accordion_trigger.js +80 -0
  251. package/optimize/es/components/accordion/accordion_trigger/index.js +9 -0
  252. package/optimize/es/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.styles.js +1 -1
  253. package/optimize/es/components/collapsible_nav_beta/collapsible_nav_beta.js +2 -25
  254. package/optimize/es/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
  255. package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.styles.js +1 -1
  256. package/optimize/es/components/flyout/flyout.styles.js +1 -1
  257. package/optimize/es/components/header/header.js +75 -25
  258. package/optimize/es/components/header/header.styles.js +1 -1
  259. package/optimize/es/components/icon/assets/grabOmnidirectional.js +32 -0
  260. package/optimize/es/components/icon/assets/transitionLeftIn.js +35 -0
  261. package/optimize/es/components/icon/assets/transitionLeftOut.js +35 -0
  262. package/optimize/es/components/icon/assets/transitionTopIn.js +35 -0
  263. package/optimize/es/components/icon/assets/transitionTopOut.js +35 -0
  264. package/optimize/es/components/icon/icon_map.js +5 -0
  265. package/optimize/es/components/index.js +1 -0
  266. package/optimize/es/components/inline_edit/inline_edit_form.js +32 -12
  267. package/optimize/es/components/inline_edit/inline_edit_text.js +6 -22
  268. package/optimize/es/components/inline_edit/inline_edit_title.js +6 -22
  269. package/optimize/es/components/list_group/list_group_item.js +1 -1
  270. package/optimize/es/components/overlay_mask/overlay_mask.styles.js +1 -1
  271. package/optimize/es/components/page/page_sidebar/page_sidebar.js +2 -4
  272. package/optimize/es/components/page_template/page_template.js +4 -26
  273. package/optimize/es/components/panel/split_panel/split_panel.js +9 -7
  274. package/optimize/es/components/panel/split_panel/split_panel.styles.js +40 -0
  275. package/optimize/es/components/text_truncate/index.js +10 -0
  276. package/optimize/es/components/text_truncate/text_truncate.js +148 -0
  277. package/optimize/es/components/text_truncate/text_truncate.styles.js +49 -0
  278. package/optimize/es/components/text_truncate/utils.js +337 -0
  279. package/optimize/es/components/toast/global_toast_list.js +39 -2
  280. package/optimize/es/components/toast/global_toast_list.styles.js +3 -2
  281. package/optimize/es/services/theme/context.js +3 -1
  282. package/optimize/es/services/theme/hooks.js +19 -1
  283. package/optimize/es/services/theme/index.js +1 -1
  284. package/optimize/es/services/theme/provider.js +37 -8
  285. package/optimize/lib/components/accordion/accordion.js +39 -195
  286. package/optimize/lib/components/accordion/accordion.styles.js +20 -96
  287. package/optimize/lib/components/accordion/accordion_children/accordion_children.js +101 -0
  288. package/optimize/lib/components/accordion/accordion_children/accordion_children.styles.js +45 -0
  289. package/optimize/lib/components/accordion/accordion_children/accordion_children_loading.js +38 -0
  290. package/optimize/lib/components/accordion/accordion_children/index.js +12 -0
  291. package/optimize/lib/components/accordion/accordion_trigger/accordion_arrow.js +43 -0
  292. package/optimize/lib/components/accordion/accordion_trigger/accordion_arrow.styles.js +51 -0
  293. package/optimize/lib/components/accordion/accordion_trigger/accordion_button.js +52 -0
  294. package/optimize/lib/components/accordion/accordion_trigger/accordion_button.styles.js +33 -0
  295. package/optimize/lib/components/accordion/accordion_trigger/accordion_trigger.js +86 -0
  296. package/optimize/lib/components/accordion/accordion_trigger/index.js +12 -0
  297. package/optimize/lib/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.styles.js +1 -1
  298. package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_beta.js +2 -25
  299. package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
  300. package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.styles.js +1 -1
  301. package/optimize/lib/components/flyout/flyout.styles.js +1 -1
  302. package/optimize/lib/components/header/header.js +77 -24
  303. package/optimize/lib/components/header/header.styles.js +1 -1
  304. package/optimize/lib/components/icon/assets/grabOmnidirectional.js +41 -0
  305. package/optimize/lib/components/icon/assets/transitionLeftIn.js +44 -0
  306. package/optimize/lib/components/icon/assets/transitionLeftOut.js +44 -0
  307. package/optimize/lib/components/icon/assets/transitionTopIn.js +44 -0
  308. package/optimize/lib/components/icon/assets/transitionTopOut.js +44 -0
  309. package/optimize/lib/components/icon/icon_map.js +5 -0
  310. package/optimize/lib/components/icon/svgs/grabOmnidirectional.svg +3 -0
  311. package/optimize/lib/components/icon/svgs/transitionLeftIn.svg +4 -0
  312. package/optimize/lib/components/icon/svgs/transitionLeftOut.svg +4 -0
  313. package/optimize/lib/components/icon/svgs/transitionTopIn.svg +4 -0
  314. package/optimize/lib/components/icon/svgs/transitionTopOut.svg +4 -0
  315. package/optimize/lib/components/index.js +11 -0
  316. package/optimize/lib/components/inline_edit/inline_edit_form.js +33 -16
  317. package/optimize/lib/components/inline_edit/inline_edit_text.js +6 -22
  318. package/optimize/lib/components/inline_edit/inline_edit_title.js +6 -22
  319. package/optimize/lib/components/list_group/list_group_item.js +1 -1
  320. package/optimize/lib/components/overlay_mask/overlay_mask.styles.js +1 -1
  321. package/optimize/lib/components/page/page_sidebar/page_sidebar.js +2 -4
  322. package/optimize/lib/components/page_template/page_template.js +2 -24
  323. package/optimize/lib/components/panel/split_panel/split_panel.js +9 -7
  324. package/optimize/lib/components/panel/split_panel/split_panel.styles.js +46 -0
  325. package/optimize/lib/components/text_truncate/index.js +25 -0
  326. package/optimize/lib/components/text_truncate/text_truncate.js +158 -0
  327. package/optimize/lib/components/text_truncate/text_truncate.styles.js +54 -0
  328. package/optimize/lib/components/text_truncate/utils.js +342 -0
  329. package/optimize/lib/components/toast/global_toast_list.js +41 -3
  330. package/optimize/lib/components/toast/global_toast_list.styles.js +3 -2
  331. package/optimize/lib/services/theme/context.js +3 -1
  332. package/optimize/lib/services/theme/hooks.js +21 -2
  333. package/optimize/lib/services/theme/index.js +6 -0
  334. package/optimize/lib/services/theme/provider.js +62 -35
  335. package/package.json +3 -3
  336. package/src/components/datagrid/_data_grid.scss +13 -2
  337. package/src/components/index.scss +0 -2
  338. package/src/global_styling/mixins/_header.scss +2 -0
  339. package/test-env/components/accordion/accordion.js +49 -197
  340. package/test-env/components/accordion/accordion.styles.js +20 -96
  341. package/test-env/components/accordion/accordion_children/accordion_children.js +105 -0
  342. package/test-env/components/accordion/accordion_children/accordion_children.styles.js +45 -0
  343. package/test-env/components/accordion/accordion_children/accordion_children_loading.js +38 -0
  344. package/test-env/components/accordion/accordion_children/index.js +12 -0
  345. package/test-env/components/accordion/accordion_trigger/accordion_arrow.js +47 -0
  346. package/test-env/components/accordion/accordion_trigger/accordion_arrow.styles.js +51 -0
  347. package/test-env/components/accordion/accordion_trigger/accordion_button.js +52 -0
  348. package/test-env/components/accordion/accordion_trigger/accordion_button.styles.js +33 -0
  349. package/test-env/components/accordion/accordion_trigger/accordion_trigger.js +93 -0
  350. package/test-env/components/accordion/accordion_trigger/index.js +12 -0
  351. package/test-env/components/avatar/avatar.js +1 -1
  352. package/test-env/components/badge/badge.js +1 -1
  353. package/test-env/components/badge/beta_badge/beta_badge.js +1 -1
  354. package/test-env/components/basic_table/basic_table.js +1 -1
  355. package/test-env/components/basic_table/collapsed_item_actions.js +1 -1
  356. package/test-env/components/basic_table/in_memory_table.js +1 -1
  357. package/test-env/components/button/button_display/_button_display.js +1 -1
  358. package/test-env/components/button/button_display/_button_display_content.js +1 -1
  359. package/test-env/components/button/button_empty/button_empty.js +1 -1
  360. package/test-env/components/button/button_group/button_group.js +1 -1
  361. package/test-env/components/button/button_group/button_group_button.js +1 -1
  362. package/test-env/components/button/button_icon/button_icon.js +1 -1
  363. package/test-env/components/call_out/call_out.js +1 -1
  364. package/test-env/components/card/card.js +1 -1
  365. package/test-env/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +11 -3
  366. package/test-env/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.styles.js +1 -1
  367. package/test-env/components/collapsible_nav_beta/collapsible_nav_beta.js +2 -25
  368. package/test-env/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
  369. package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +2 -2
  370. package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_item.js +2 -2
  371. package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_popover.js +3 -3
  372. package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.js +2 -2
  373. package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.styles.js +1 -1
  374. package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +3 -3
  375. package/test-env/components/comment_list/comment.js +2 -2
  376. package/test-env/components/comment_list/comment_event.js +1 -1
  377. package/test-env/components/comment_list/comment_list.js +2 -2
  378. package/test-env/components/comment_list/comment_timeline.js +1 -1
  379. package/test-env/components/datagrid/body/data_grid_body.js +13 -13
  380. package/test-env/components/datagrid/body/data_grid_body_custom.js +13 -13
  381. package/test-env/components/datagrid/body/data_grid_body_virtualized.js +13 -13
  382. package/test-env/components/datagrid/body/data_grid_cell.js +24 -24
  383. package/test-env/components/datagrid/body/header/data_grid_header_cell.js +12 -12
  384. package/test-env/components/datagrid/body/header/data_grid_header_row.js +13 -13
  385. package/test-env/components/datagrid/controls/column_sorting_draggable.js +1 -1
  386. package/test-env/components/datagrid/data_grid.js +13 -13
  387. package/test-env/components/datagrid/utils/in_memory.js +12 -12
  388. package/test-env/components/date_picker/date_picker.js +2 -2
  389. package/test-env/components/date_picker/date_picker_range.js +1 -1
  390. package/test-env/components/empty_prompt/empty_prompt.js +1 -1
  391. package/test-env/components/facet/facet_button.js +1 -1
  392. package/test-env/components/flyout/flyout.styles.js +1 -1
  393. package/test-env/components/form/field_number/field_number.js +1 -1
  394. package/test-env/components/form/field_text/field_text.js +2 -2
  395. package/test-env/components/form/form_control_layout/form_control_layout.js +2 -2
  396. package/test-env/components/form/form_control_layout/form_control_layout_custom_icon.js +1 -1
  397. package/test-env/components/form/form_control_layout/form_control_layout_icons.js +2 -2
  398. package/test-env/components/header/header.js +113 -23
  399. package/test-env/components/header/header.styles.js +1 -1
  400. package/test-env/components/header/header_links/header_link.js +1 -1
  401. package/test-env/components/header/header_links/header_links.js +1 -1
  402. package/test-env/components/header/header_logo/header_logo.js +1 -1
  403. package/test-env/components/header/header_section/header_section_item_button.js +1 -1
  404. package/test-env/components/icon/assets/grabOmnidirectional.js +41 -0
  405. package/test-env/components/icon/assets/transitionLeftIn.js +44 -0
  406. package/test-env/components/icon/assets/transitionLeftOut.js +44 -0
  407. package/test-env/components/icon/assets/transitionTopIn.js +44 -0
  408. package/test-env/components/icon/assets/transitionTopOut.js +44 -0
  409. package/test-env/components/icon/icon_map.js +5 -0
  410. package/test-env/components/index.js +11 -0
  411. package/test-env/components/inline_edit/inline_edit_form.js +49 -17
  412. package/test-env/components/inline_edit/inline_edit_text.js +22 -23
  413. package/test-env/components/inline_edit/inline_edit_title.js +22 -23
  414. package/test-env/components/key_pad_menu/key_pad_menu_item.js +1 -1
  415. package/test-env/components/list_group/list_group.js +2 -2
  416. package/test-env/components/list_group/list_group_item.js +3 -3
  417. package/test-env/components/list_group/list_group_item_extra_action.js +1 -1
  418. package/test-env/components/list_group/pinnable_list_group/pinnable_list_group.js +4 -4
  419. package/test-env/components/loading/loading_logo.js +1 -1
  420. package/test-env/components/markdown_editor/markdown_editor.js +1 -1
  421. package/test-env/components/markdown_editor/markdown_editor_drop_zone.js +1 -1
  422. package/test-env/components/markdown_editor/markdown_editor_footer.js +1 -1
  423. package/test-env/components/markdown_editor/markdown_editor_toolbar.js +1 -1
  424. package/test-env/components/notification/notification_event.js +2 -2
  425. package/test-env/components/notification/notification_event_meta.js +1 -1
  426. package/test-env/components/overlay_mask/overlay_mask.styles.js +1 -1
  427. package/test-env/components/page/page_header/page_header_content.js +1 -1
  428. package/test-env/components/page/page_sidebar/page_sidebar.js +2 -4
  429. package/test-env/components/page_template/page_template.js +2 -24
  430. package/test-env/components/panel/split_panel/split_panel.js +9 -7
  431. package/test-env/components/panel/split_panel/split_panel.styles.js +46 -0
  432. package/test-env/components/selectable/selectable_list/selectable_list.js +1 -1
  433. package/test-env/components/selectable/selectable_list/selectable_list_item.js +1 -1
  434. package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +1 -1
  435. package/test-env/components/suggest/suggest.js +1 -1
  436. package/test-env/components/suggest/suggest_item.js +1 -1
  437. package/test-env/components/table/table_header_button.js +1 -1
  438. package/test-env/components/text_truncate/index.js +25 -0
  439. package/test-env/components/text_truncate/text_truncate.js +236 -0
  440. package/test-env/components/text_truncate/text_truncate.styles.js +54 -0
  441. package/test-env/components/text_truncate/utils.js +342 -0
  442. package/test-env/components/timeline/timeline_item_icon.js +1 -1
  443. package/test-env/components/toast/global_toast_list.js +53 -4
  444. package/test-env/components/toast/global_toast_list.styles.js +3 -2
  445. package/test-env/components/toast/toast.js +1 -1
  446. package/test-env/components/tool_tip/icon_tip.js +1 -1
  447. package/test-env/services/theme/context.js +3 -1
  448. package/test-env/services/theme/hooks.js +21 -2
  449. package/test-env/services/theme/index.js +6 -0
  450. package/test-env/services/theme/provider.js +62 -35
  451. package/src/components/accordion/_accordion_form.scss +0 -40
  452. package/src/components/accordion/_index.scss +0 -1
  453. package/src/components/panel/_index.scss +0 -1
  454. package/src/components/panel/_panel.scss +0 -9
  455. package/src/components/panel/split_panel/_index.scss +0 -1
  456. package/src/components/panel/split_panel/_split_panel.scss +0 -21
@@ -0,0 +1,232 @@
1
+ var _excluded = ["width"],
2
+ _excluded2 = ["width", "children", "text", "truncation", "truncationOffset", "truncationPosition", "ellipsis", "containerRef", "measurementRenderAPI"],
3
+ _excluded3 = ["onResize"];
4
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
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
+ 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); }
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
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
9
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
10
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
11
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
12
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
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
+
21
+ import React, { useState, useMemo, useCallback } from 'react';
22
+ import PropTypes from "prop-types";
23
+ import { useCombinedRefs } from '../../services';
24
+ import { EuiResizeObserver } from '../observer/resize_observer';
25
+ import { TruncationUtilsWithDOM, TruncationUtilsWithCanvas } from './utils';
26
+ import { euiTextTruncateStyles } from './text_truncate.styles';
27
+ import { jsx as ___EmotionJSX } from "@emotion/react";
28
+ var TRUNCATION_TYPES = ['end', 'start', 'startEnd', 'middle'];
29
+ export var EuiTextTruncate = function EuiTextTruncate(_ref) {
30
+ var width = _ref.width,
31
+ props = _objectWithoutProperties(_ref, _excluded);
32
+ return width != null ? ___EmotionJSX(EuiTextTruncateWithWidth, _extends({
33
+ width: width
34
+ }, props)) : ___EmotionJSX(EuiTextTruncateWithResizeObserver, props);
35
+ };
36
+ EuiTextTruncate.propTypes = {
37
+ className: PropTypes.string,
38
+ "aria-label": PropTypes.string,
39
+ "data-test-subj": PropTypes.string,
40
+ css: PropTypes.any,
41
+ /**
42
+ * The full text string to truncate
43
+ */
44
+ text: PropTypes.string.isRequired,
45
+ /**
46
+ * The truncation type desired. Determines where the ellipses are placed.
47
+ */
48
+ truncation: PropTypes.any,
49
+ /**
50
+ * This prop **only** applies to the `start` and `end` truncation types.
51
+ * It allows preserving a certain number of characters of either the
52
+ * starting or ending text.
53
+ *
54
+ * If the passed offset is greater than the total text length,
55
+ * the offset will be ignored.
56
+ */
57
+ truncationOffset: PropTypes.number,
58
+ /**
59
+ * This prop **only** applies to the `startEnd` truncation type.
60
+ * It allows customizing the anchor position of the displayed text,
61
+ * which otherwise defaults to the middle of the text string.
62
+ *
63
+ * The primary use case for this prop for is search highlighting - e.g., if
64
+ * a user searches for a specific word in the text, pass the index of that
65
+ * found word to ensure it is always visible.
66
+ *
67
+ * This behavior will intelligently detect when positions are close to the start
68
+ * or end of the text, and omit leading or trailing ellipses when necessary.
69
+ * If the passed position is greater than the total text length,
70
+ * the truncation will simply default to `start` instead.
71
+ */
72
+ truncationPosition: PropTypes.number,
73
+ /**
74
+ * Defaults to the horizontal ellipsis character.
75
+ * Can be optionally configured to use other punctuation,
76
+ * e.g. spaces, brackets, hyphens, asterisks, etc.
77
+ */
78
+ ellipsis: PropTypes.string,
79
+ /**
80
+ * By default, EuiTextTruncate will render a resize observer to detect the
81
+ * available width it has. For performance reasons (e.g. multiple truncated
82
+ * text items within the same container), you may opt to pass in your own
83
+ * container width, which will skip initializing a resize observer.
84
+ */
85
+ width: PropTypes.number,
86
+ /**
87
+ * Optional callback that fires when the default resizer observer both mounts and
88
+ * registers a size change. This callback will **not** fire if `width` is passed.
89
+ */
90
+ onResize: PropTypes.func,
91
+ /**
92
+ * By default, EuiTextTruncate will calculate its truncation via DOM manipulation
93
+ * and measurement, which has the benefit of automatically inheriting font styles.
94
+ * However, if this approach proves to have a significant performance impact for your
95
+ * usage, consider using the `canvas` API instead, which is more performant.
96
+ *
97
+ * Please note that there are minute pixel to subpixel differences between the
98
+ * two options due to different rendering engines.
99
+ */
100
+ measurementRenderAPI: PropTypes.oneOf(["dom", "canvas"]),
101
+ /**
102
+ * By default, EuiTextTruncate will render the truncated string directly.
103
+ * You can optionally pass a render prop function to the component, which
104
+ * allows for more flexible text rendering, e.g. adding custom markup
105
+ * or highlighting
106
+ */
107
+ children: PropTypes.func
108
+ };
109
+ var EuiTextTruncateWithWidth = function EuiTextTruncateWithWidth(_ref2) {
110
+ var width = _ref2.width,
111
+ children = _ref2.children,
112
+ text = _ref2.text,
113
+ _ref2$truncation = _ref2.truncation,
114
+ _truncation = _ref2$truncation === void 0 ? 'end' : _ref2$truncation,
115
+ _ref2$truncationOffse = _ref2.truncationOffset,
116
+ _truncationOffset = _ref2$truncationOffse === void 0 ? 0 : _ref2$truncationOffse,
117
+ truncationPosition = _ref2.truncationPosition,
118
+ _ref2$ellipsis = _ref2.ellipsis,
119
+ ellipsis = _ref2$ellipsis === void 0 ? '…' : _ref2$ellipsis,
120
+ containerRef = _ref2.containerRef,
121
+ _ref2$measurementRend = _ref2.measurementRenderAPI,
122
+ measurementRenderAPI = _ref2$measurementRend === void 0 ? 'dom' : _ref2$measurementRend,
123
+ rest = _objectWithoutProperties(_ref2, _excluded2);
124
+ // Note: This needs to be a state and not a ref to trigger a rerender on mount
125
+ var _useState = useState(null),
126
+ _useState2 = _slicedToArray(_useState, 2),
127
+ containerEl = _useState2[0],
128
+ setContainerEl = _useState2[1];
129
+ var refs = useCombinedRefs([setContainerEl, containerRef]);
130
+
131
+ // Handle exceptions where we need to override the passed props
132
+ var _useMemo = useMemo(function () {
133
+ var truncation = _truncation;
134
+ var truncationOffset = 0;
135
+ if (_truncation === 'end' || _truncation === 'start') {
136
+ if (0 < _truncationOffset && _truncationOffset < text.length) {
137
+ truncationOffset = _truncationOffset;
138
+ }
139
+ } else if (_truncation === 'startEnd' && truncationPosition != null) {
140
+ if (truncationPosition <= 0) {
141
+ truncation = 'end';
142
+ } else if (truncationPosition >= text.length) {
143
+ truncation = 'start';
144
+ }
145
+ }
146
+ return {
147
+ truncation: truncation,
148
+ truncationOffset: truncationOffset
149
+ };
150
+ }, [_truncation, _truncationOffset, truncationPosition, text.length]),
151
+ truncation = _useMemo.truncation,
152
+ truncationOffset = _useMemo.truncationOffset;
153
+ var truncatedText = useMemo(function () {
154
+ var truncatedText = '';
155
+ if (!containerEl || !width) return truncatedText;
156
+ var params = {
157
+ fullText: text,
158
+ ellipsis: ellipsis,
159
+ container: containerEl,
160
+ availableWidth: width
161
+ };
162
+ var utils = measurementRenderAPI === 'canvas' ? new TruncationUtilsWithCanvas(params) : new TruncationUtilsWithDOM(params);
163
+ if (utils.checkIfTruncationIsNeeded() === false) {
164
+ truncatedText = text;
165
+ } else if (utils.checkSufficientEllipsisWidth(truncation) === false) {
166
+ truncatedText = '';
167
+ } else {
168
+ switch (truncation) {
169
+ case 'end':
170
+ truncatedText = utils.truncateEnd(truncationOffset);
171
+ break;
172
+ case 'start':
173
+ truncatedText = utils.truncateStart(truncationOffset);
174
+ break;
175
+ case 'startEnd':
176
+ if (truncationPosition == null) {
177
+ truncatedText = utils.truncateStartEndAtMiddle();
178
+ } else {
179
+ truncatedText = utils.truncateStartEndAtPosition(truncationPosition);
180
+ }
181
+ break;
182
+ case 'middle':
183
+ truncatedText = utils.truncateMiddle();
184
+ break;
185
+ }
186
+ }
187
+ if (measurementRenderAPI === 'dom') {
188
+ utils.cleanup();
189
+ }
190
+ return truncatedText;
191
+ }, [width, text, truncation, truncationOffset, truncationPosition, ellipsis, containerEl, measurementRenderAPI]);
192
+ var isTruncating = truncatedText !== text;
193
+ return ___EmotionJSX("div", _extends({
194
+ css: euiTextTruncateStyles.euiTextTruncate,
195
+ ref: refs,
196
+ title: isTruncating ? text : undefined
197
+ }, rest), isTruncating ? ___EmotionJSX(React.Fragment, null, ___EmotionJSX("span", {
198
+ css: euiTextTruncateStyles.truncatedText,
199
+ "aria-hidden": true,
200
+ "data-test-subj": "truncatedText"
201
+ }, children ? children(truncatedText) : truncatedText), ___EmotionJSX("span", {
202
+ css: euiTextTruncateStyles.fullText,
203
+ "data-test-subj": "fullText"
204
+ }, text)) : ___EmotionJSX("span", {
205
+ "data-test-subj": "fullText"
206
+ }, text));
207
+ };
208
+ EuiTextTruncateWithWidth.propTypes = {
209
+ width: PropTypes.number.isRequired,
210
+ containerRef: PropTypes.any
211
+ };
212
+ var EuiTextTruncateWithResizeObserver = function EuiTextTruncateWithResizeObserver(_ref3) {
213
+ var _onResize = _ref3.onResize,
214
+ props = _objectWithoutProperties(_ref3, _excluded3);
215
+ var _useState3 = useState(0),
216
+ _useState4 = _slicedToArray(_useState3, 2),
217
+ width = _useState4[0],
218
+ setWidth = _useState4[1];
219
+ var onResize = useCallback(function (_ref4) {
220
+ var width = _ref4.width;
221
+ setWidth(width);
222
+ _onResize === null || _onResize === void 0 ? void 0 : _onResize(width);
223
+ }, [_onResize]);
224
+ return ___EmotionJSX(EuiResizeObserver, {
225
+ onResize: onResize
226
+ }, function (ref) {
227
+ return ___EmotionJSX(EuiTextTruncateWithWidth, _extends({
228
+ width: width,
229
+ containerRef: ref
230
+ }, props));
231
+ });
232
+ };
@@ -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
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
4
+ * or more contributor license agreements. Licensed under the Elastic License
5
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
6
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
7
+ * Side Public License, v 1.
8
+ */
9
+
10
+ import { css } from '@emotion/react';
11
+ export var euiTextTruncateStyles = {
12
+ euiTextTruncate: process.env.NODE_ENV === "production" ? {
13
+ name: "7o5qnz-euiTextTruncate",
14
+ styles: "position:relative;overflow:hidden;white-space:nowrap;label:euiTextTruncate;"
15
+ } : {
16
+ name: "7o5qnz-euiTextTruncate",
17
+ styles: "position:relative;overflow:hidden;white-space:nowrap;label:euiTextTruncate;",
18
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
19
+ },
20
+ /**
21
+ * The below CSS is a hack to get double clicking and selecting the *full* text
22
+ * instead of the truncated text (useful for copying/pasting, and mimics how
23
+ * `text-overflow: ellipsis` works).
24
+ *
25
+ * Real talk: I'm lowkey amazed it works and it wouldn't surprise me if we ran into
26
+ * cross-browser issues with this at some point. Hopefully CSS natively implements
27
+ * custom text truncation some day (https://github.com/w3c/csswg-drafts/issues/3937)
28
+ * and there'll be no need for the entire component at that point 🙏
29
+ */
30
+ // Makes the truncated text unselectable/un-clickable
31
+ truncatedText: process.env.NODE_ENV === "production" ? {
32
+ name: "1dore6v-truncatedText",
33
+ styles: "user-select:none;pointer-events:none;label:truncatedText;"
34
+ } : {
35
+ name: "1dore6v-truncatedText",
36
+ styles: "user-select:none;pointer-events:none;label:truncatedText;",
37
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
38
+ },
39
+ // Positions the full text on top of the truncated text (so that clicking targets it)
40
+ // and gives it a color opacity of 0 so that it's not actually visible
41
+ fullText: process.env.NODE_ENV === "production" ? {
42
+ name: "1kxt4rj-fullText",
43
+ styles: "position:absolute;inset:0;overflow:hidden;color:rgba(0, 0, 0, 0);@supports (-webkit-hyphens: none){text-overflow:ellipsis;};label:fullText;"
44
+ } : {
45
+ name: "1kxt4rj-fullText",
46
+ styles: "position:absolute;inset:0;overflow:hidden;color:rgba(0, 0, 0, 0);@supports (-webkit-hyphens: none){text-overflow:ellipsis;};label:fullText;",
47
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
48
+ }
49
+ };
@@ -0,0 +1,348 @@
1
+ var _excluded = ["container"],
2
+ _excluded2 = ["font", "container"];
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
5
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
6
+ 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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
7
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
8
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
9
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
10
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
11
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
13
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
14
+ 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."); }
15
+ 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); }
16
+ 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; }
17
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
18
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
19
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
20
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
21
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
22
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
23
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
24
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
25
+ /*
26
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
27
+ * or more contributor license agreements. Licensed under the Elastic License
28
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
29
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
30
+ * Side Public License, v 1.
31
+ */
32
+ /**
33
+ * This internal shared/base class contains the actual logic for truncating text
34
+ * (as well as a few handy utilities for checking whether truncation is possible
35
+ * or even necessary).
36
+ *
37
+ * How the underlying mechanism works: the full text is rendered, and then
38
+ * characters are removed one by one until the width of the text fits within
39
+ * the specified available width.
40
+ *
41
+ * Side note: The exception to this is the `truncateStartEndAtPosition` method,
42
+ * which works by building up from an empty string / by adding characters
43
+ * instead of removing them.
44
+ */
45
+ var _TruncationUtils = /*#__PURE__*/_createClass(function _TruncationUtils(_ref) {
46
+ var _this = this;
47
+ var fullText = _ref.fullText,
48
+ ellipsis = _ref.ellipsis,
49
+ availableWidth = _ref.availableWidth;
50
+ _classCallCheck(this, _TruncationUtils);
51
+ _defineProperty(this, "fullText", void 0);
52
+ _defineProperty(this, "ellipsis", void 0);
53
+ _defineProperty(this, "availableWidth", void 0);
54
+ /**
55
+ * Early return checks
56
+ */
57
+ _defineProperty(this, "checkIfTruncationIsNeeded", function () {
58
+ _this.setTextToCheck(_this.fullText);
59
+ if (_this.availableWidth >= _this.textWidth) {
60
+ return false;
61
+ }
62
+ });
63
+ _defineProperty(this, "checkSufficientEllipsisWidth", function (truncation) {
64
+ var textToCheck = truncation === 'startEnd' ? "".concat(_this.ellipsis, " ").concat(_this.ellipsis) // startEnd needs a little more space
65
+ : _this.ellipsis;
66
+ _this.setTextToCheck(textToCheck);
67
+ if (_this.textWidth >= _this.availableWidth * 0.9) {
68
+ console.error('The truncation ellipsis is larger than the available width. No text can be rendered.');
69
+ return false;
70
+ }
71
+ });
72
+ _defineProperty(this, "checkTruncationOffsetWidth", function (text) {
73
+ _this.setTextToCheck(text);
74
+ if (_this.textWidth > _this.availableWidth) {
75
+ console.error("The passed truncationOffset is too large for the available width. Truncating the offset instead.");
76
+ return false;
77
+ }
78
+ });
79
+ /**
80
+ * Truncation types logic. This is where the magic happens
81
+ */
82
+ _defineProperty(this, "truncateStart", function (truncationOffset) {
83
+ var truncatedText = _this.fullText;
84
+ var leadingText = '';
85
+ var combinedText = function combinedText() {
86
+ return "".concat(leadingText).concat(truncatedText);
87
+ };
88
+ if (truncationOffset) {
89
+ var _splitText$at = splitText(_this.fullText).at(truncationOffset);
90
+ var _splitText$at2 = _slicedToArray(_splitText$at, 2);
91
+ leadingText = _splitText$at2[0];
92
+ truncatedText = _splitText$at2[1];
93
+ var widthCheck = "".concat(leadingText).concat(_this.ellipsis);
94
+ if (_this.checkTruncationOffsetWidth(widthCheck) === false) {
95
+ truncatedText = leadingText;
96
+ leadingText = '';
97
+ }
98
+ }
99
+ leadingText += _this.ellipsis;
100
+ _this.setTextToCheck(combinedText());
101
+ while (_this.textWidth > _this.availableWidth) {
102
+ truncatedText = removeFirstCharacter(truncatedText);
103
+ _this.setTextToCheck(combinedText());
104
+ }
105
+ return combinedText();
106
+ });
107
+ _defineProperty(this, "truncateEnd", function (truncationOffset) {
108
+ var truncatedText = _this.fullText;
109
+ var trailingText = '';
110
+ var combinedText = function combinedText() {
111
+ return "".concat(truncatedText).concat(trailingText);
112
+ };
113
+ if (truncationOffset) {
114
+ var index = _this.fullText.length - truncationOffset;
115
+ var _splitText$at3 = splitText(_this.fullText).at(index);
116
+ var _splitText$at4 = _slicedToArray(_splitText$at3, 2);
117
+ truncatedText = _splitText$at4[0];
118
+ trailingText = _splitText$at4[1];
119
+ var widthCheck = "".concat(_this.ellipsis).concat(trailingText);
120
+ if (_this.checkTruncationOffsetWidth(widthCheck) === false) {
121
+ truncatedText = trailingText;
122
+ trailingText = '';
123
+ }
124
+ }
125
+ trailingText = _this.ellipsis + trailingText;
126
+ _this.setTextToCheck(combinedText());
127
+ while (_this.textWidth > _this.availableWidth) {
128
+ truncatedText = removeLastCharacter(truncatedText);
129
+ _this.setTextToCheck(combinedText());
130
+ }
131
+ return combinedText();
132
+ });
133
+ _defineProperty(this, "truncateStartEndAtPosition", function (truncationPosition) {
134
+ // If using a non-centered startEnd anchor position, we need to *build*
135
+ // the string from scratch instead of *removing* from the full text string,
136
+ // to make sure we don't go past the beginning or end of the text
137
+ var truncatedText = '';
138
+ _this.setTextToCheck(truncatedText);
139
+
140
+ // Ellipses are conditional - if the anchor is towards the beginning or end,
141
+ // it's possible they shouldn't render
142
+ var startingEllipsis = _this.ellipsis;
143
+ var endingEllipsis = _this.ellipsis;
144
+
145
+ // Split the text into two at the anchor position
146
+ var _splitText$at5 = splitText(_this.fullText).at(truncationPosition),
147
+ _splitText$at6 = _slicedToArray(_splitText$at5, 2),
148
+ firstPart = _splitText$at6[0],
149
+ secondPart = _splitText$at6[1];
150
+ var combinedText = function combinedText() {
151
+ return "".concat(startingEllipsis).concat(truncatedText).concat(endingEllipsis);
152
+ };
153
+ while (_this.textWidth <= _this.availableWidth) {
154
+ if (firstPart.length > 0) {
155
+ truncatedText = "".concat(getLastCharacter(firstPart)).concat(truncatedText);
156
+ firstPart = removeLastCharacter(firstPart);
157
+ } else {
158
+ startingEllipsis = '';
159
+ }
160
+ if (secondPart.length > 0) {
161
+ truncatedText = "".concat(truncatedText).concat(getFirstCharacter(secondPart));
162
+ secondPart = removeFirstCharacter(secondPart);
163
+ } else {
164
+ endingEllipsis = '';
165
+ }
166
+ _this.setTextToCheck(combinedText());
167
+ }
168
+
169
+ // Because this logic builds text outwards vs. removing inwards, the final
170
+ // text width ends up a little larger than the container, and we need to
171
+ // remove the last added character(s)
172
+ if (!startingEllipsis) {
173
+ truncatedText = removeLastCharacter(truncatedText);
174
+ } else if (!endingEllipsis) {
175
+ truncatedText = removeFirstCharacter(truncatedText);
176
+ } else {
177
+ truncatedText = removeFirstAndLastCharacters(truncatedText);
178
+ }
179
+ return combinedText();
180
+ });
181
+ _defineProperty(this, "truncateStartEndAtMiddle", function () {
182
+ var truncatedText = _this.fullText;
183
+ _this.setTextToCheck(truncatedText);
184
+ var combinedText = function combinedText() {
185
+ return "".concat(_this.ellipsis).concat(truncatedText).concat(_this.ellipsis);
186
+ };
187
+ while (_this.textWidth > _this.availableWidth) {
188
+ truncatedText = removeFirstAndLastCharacters(truncatedText);
189
+ _this.setTextToCheck(combinedText());
190
+ }
191
+ return combinedText();
192
+ });
193
+ _defineProperty(this, "truncateMiddle", function () {
194
+ var middlePosition = Math.floor(_this.fullText.length / 2);
195
+ var _splitText$at7 = splitText(_this.fullText).at(middlePosition),
196
+ _splitText$at8 = _slicedToArray(_splitText$at7, 2),
197
+ firstHalf = _splitText$at8[0],
198
+ secondHalf = _splitText$at8[1];
199
+ var trimfirstHalf;
200
+ var combinedText = function combinedText() {
201
+ return "".concat(firstHalf).concat(_this.ellipsis).concat(secondHalf);
202
+ };
203
+ _this.setTextToCheck(combinedText());
204
+ while (_this.textWidth > _this.availableWidth) {
205
+ trimfirstHalf = !trimfirstHalf;
206
+ if (trimfirstHalf) {
207
+ firstHalf = removeLastCharacter(firstHalf);
208
+ } else {
209
+ secondHalf = removeFirstCharacter(secondHalf);
210
+ }
211
+ _this.setTextToCheck(combinedText());
212
+ }
213
+ return combinedText();
214
+ });
215
+ this.fullText = fullText;
216
+ this.ellipsis = ellipsis;
217
+ this.availableWidth = availableWidth;
218
+ }
219
+
220
+ /**
221
+ * Internal measurement utils which will be overridden depending on the
222
+ * rendering approach used (e.g. DOM vs Canvas).
223
+ */);
224
+ /**
225
+ * Creates a temporary vanilla JS DOM element for manipulating text and
226
+ * determining text width.
227
+ *
228
+ * Requires passing in a container element to which the temporary element
229
+ * will be appended. Any CSS/font styles that need to be accounted for should
230
+ * be automatically inherited from the container.
231
+ *
232
+ * NOTE: The consumer is responsible for calling the `cleanup()` method manually
233
+ * to remove the temporary DOM node once their usage of this utility is complete.
234
+ */
235
+
236
+ export var TruncationUtilsWithDOM = /*#__PURE__*/function (_TruncationUtils2) {
237
+ _inherits(TruncationUtilsWithDOM, _TruncationUtils2);
238
+ var _super = _createSuper(TruncationUtilsWithDOM);
239
+ function TruncationUtilsWithDOM(_ref2) {
240
+ var _this2;
241
+ var container = _ref2.container,
242
+ rest = _objectWithoutProperties(_ref2, _excluded);
243
+ _classCallCheck(this, TruncationUtilsWithDOM);
244
+ _this2 = _super.call(this, rest);
245
+ _defineProperty(_assertThisInitialized(_this2), "container", void 0);
246
+ _defineProperty(_assertThisInitialized(_this2), "span", void 0);
247
+ _defineProperty(_assertThisInitialized(_this2), "setTextToCheck", function (text) {
248
+ _this2.span.textContent = text;
249
+ });
250
+ _defineProperty(_assertThisInitialized(_this2), "cleanup", function () {
251
+ _this2.container.removeChild(_this2.span);
252
+ });
253
+ _this2.container = container;
254
+ _this2.span = document.createElement('span');
255
+ _this2.span.style.position = 'absolute'; // Prevent page reflow/repaint for performance
256
+ _this2.span.style.whiteSpace = 'nowrap'; // EuiTextTruncate already sets this on the parent, but we'll set it here as well for consumers who use this util standalone
257
+ _this2.container.appendChild(_this2.span);
258
+ return _this2;
259
+ }
260
+ _createClass(TruncationUtilsWithDOM, [{
261
+ key: "textWidth",
262
+ get: function get() {
263
+ return this.span.offsetWidth;
264
+ }
265
+ }]);
266
+ return TruncationUtilsWithDOM;
267
+ }(_TruncationUtils);
268
+
269
+ /**
270
+ * Creates a temporary Canvas element for manipulating text & determining
271
+ * text width. This method is compatible with charts or other canvas-rendered
272
+ * frameworks, and requires no cleanup method.
273
+ *
274
+ * To accurately measure text, canvas rendering requires either a container to
275
+ * compute/derive font styles from, or a static font string (useful for usage
276
+ * outside the DOM). Particular care should be applied when fallback fonts are
277
+ * used, as more fallback fonts can lead to less precision.
278
+ *
279
+ * Please note that while canvas is more performant than DOM measurement, there
280
+ * are subpixel to single digit pixel differences between DOM and canvas
281
+ * measurement due to the different rendering engines used.
282
+ */
283
+ export var TruncationUtilsWithCanvas = /*#__PURE__*/function (_TruncationUtils3) {
284
+ _inherits(TruncationUtilsWithCanvas, _TruncationUtils3);
285
+ var _super2 = _createSuper(TruncationUtilsWithCanvas);
286
+ function TruncationUtilsWithCanvas(_ref3) {
287
+ var _this3;
288
+ var font = _ref3.font,
289
+ container = _ref3.container,
290
+ rest = _objectWithoutProperties(_ref3, _excluded2);
291
+ _classCallCheck(this, TruncationUtilsWithCanvas);
292
+ _this3 = _super2.call(this, rest);
293
+ _defineProperty(_assertThisInitialized(_this3), "context", void 0);
294
+ _defineProperty(_assertThisInitialized(_this3), "currentText", '');
295
+ _defineProperty(_assertThisInitialized(_this3), "computeFontFromElement", function (element) {
296
+ var computedStyles = window.getComputedStyle(element);
297
+ return ['font-style', 'font-variant', 'font-weight', 'font-size', 'font-family'].map(function (prop) {
298
+ return computedStyles.getPropertyValue(prop);
299
+ }).join(' ').trim();
300
+ });
301
+ _defineProperty(_assertThisInitialized(_this3), "setTextToCheck", function (text) {
302
+ _this3.currentText = text;
303
+ });
304
+ _this3.context = document.createElement('canvas').getContext('2d');
305
+
306
+ // Set the canvas font to ensure text width calculations are correct
307
+ if (font) {
308
+ _this3.context.font = font;
309
+ } else if (container) {
310
+ _this3.context.font = _this3.computeFontFromElement(container);
311
+ }
312
+ return _this3;
313
+ }
314
+ _createClass(TruncationUtilsWithCanvas, [{
315
+ key: "textWidth",
316
+ get: function get() {
317
+ return this.context.measureText(this.currentText).width;
318
+ }
319
+ }]);
320
+ return TruncationUtilsWithCanvas;
321
+ }(_TruncationUtils);
322
+
323
+ /**
324
+ * DRY character/substring utils
325
+ */
326
+
327
+ var removeLastCharacter = function removeLastCharacter(text) {
328
+ return text.substring(0, text.length - 1);
329
+ };
330
+ var getLastCharacter = function getLastCharacter(text) {
331
+ return text.substring(text.length - 1);
332
+ };
333
+ var removeFirstCharacter = function removeFirstCharacter(text) {
334
+ return text.substring(1);
335
+ };
336
+ var getFirstCharacter = function getFirstCharacter(text) {
337
+ return text.substring(0, 1);
338
+ };
339
+ var removeFirstAndLastCharacters = function removeFirstAndLastCharacters(text) {
340
+ return text.substring(1, text.length - 1);
341
+ };
342
+ var splitText = function splitText(text) {
343
+ return {
344
+ at: function at(index) {
345
+ return [text.substring(0, index), text.substring(index)];
346
+ }
347
+ };
348
+ };