@elastic/eui 88.4.0 → 88.5.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 (336) hide show
  1. package/dist/eui_theme_dark.css +9 -2
  2. package/dist/eui_theme_dark.min.css +1 -1
  3. package/dist/eui_theme_light.css +9 -2
  4. package/dist/eui_theme_light.min.css +1 -1
  5. package/es/components/avatar/avatar.js +1 -1
  6. package/es/components/badge/badge.js +1 -1
  7. package/es/components/badge/beta_badge/beta_badge.js +1 -1
  8. package/es/components/basic_table/basic_table.a11y.js +4 -4
  9. package/es/components/basic_table/basic_table.js +1 -1
  10. package/es/components/basic_table/collapsed_item_actions.js +1 -1
  11. package/es/components/basic_table/in_memory_table.a11y.js +4 -4
  12. package/es/components/basic_table/in_memory_table.js +1 -1
  13. package/es/components/breadcrumbs/breadcrumb.js +12 -0
  14. package/es/components/breadcrumbs/breadcrumbs.js +12 -0
  15. package/es/components/button/button_display/_button_display.js +1 -1
  16. package/es/components/button/button_display/_button_display_content.js +1 -1
  17. package/es/components/button/button_empty/button_empty.js +1 -1
  18. package/es/components/button/button_group/button_group.js +1 -1
  19. package/es/components/button/button_group/button_group_button.js +1 -1
  20. package/es/components/button/button_icon/button_icon.js +1 -1
  21. package/es/components/call_out/call_out.js +54 -34
  22. package/es/components/call_out/call_out.styles.js +36 -7
  23. package/es/components/card/card.js +1 -1
  24. package/es/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +1 -1
  25. package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +2 -2
  26. package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_item.js +2 -2
  27. package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_popover.js +3 -3
  28. package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.js +2 -2
  29. package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +3 -3
  30. package/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +11 -6
  31. package/es/components/comment_list/comment.js +2 -2
  32. package/es/components/comment_list/comment_event.js +1 -1
  33. package/es/components/comment_list/comment_list.js +2 -2
  34. package/es/components/comment_list/comment_timeline.js +1 -1
  35. package/es/components/control_bar/control_bar.js +12 -0
  36. package/es/components/datagrid/body/data_grid_body.js +13 -13
  37. package/es/components/datagrid/body/data_grid_body_custom.js +13 -13
  38. package/es/components/datagrid/body/data_grid_body_virtualized.js +13 -13
  39. package/es/components/datagrid/body/data_grid_cell.js +24 -24
  40. package/es/components/datagrid/body/header/data_grid_header_cell.js +12 -12
  41. package/es/components/datagrid/body/header/data_grid_header_row.js +13 -13
  42. package/es/components/datagrid/controls/column_sorting_draggable.js +1 -1
  43. package/es/components/datagrid/controls/data_grid_toolbar.js +21 -5
  44. package/es/components/datagrid/controls/display_selector.js +16 -15
  45. package/es/components/datagrid/data_grid.a11y.js +2 -2
  46. package/es/components/datagrid/data_grid.js +35 -16
  47. package/es/components/datagrid/data_grid_types.js +3 -0
  48. package/es/components/datagrid/utils/in_memory.js +12 -12
  49. package/es/components/date_picker/date_picker.js +15 -8
  50. package/es/components/date_picker/date_picker_range.js +1 -1
  51. package/es/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +2 -2
  52. package/es/components/empty_prompt/empty_prompt.js +1 -1
  53. package/es/components/facet/facet_button.js +1 -1
  54. package/es/components/form/field_number/field_number.js +1 -1
  55. package/es/components/form/field_text/field_text.js +2 -2
  56. package/es/components/form/form_control_layout/form_control_layout.js +2 -2
  57. package/es/components/form/form_control_layout/form_control_layout_custom_icon.js +1 -1
  58. package/es/components/form/form_control_layout/form_control_layout_icons.js +2 -2
  59. package/es/components/header/header_breadcrumbs/header_breadcrumbs.js +12 -0
  60. package/es/components/header/header_links/header_link.js +1 -1
  61. package/es/components/header/header_links/header_links.js +13 -1
  62. package/es/components/header/header_logo/header_logo.js +1 -1
  63. package/es/components/header/header_section/header_section_item_button.js +1 -1
  64. package/es/components/icon/assets/gradient.js +34 -0
  65. package/es/components/icon/assets/palette.js +35 -0
  66. package/es/components/icon/icon.js +1 -1
  67. package/es/components/icon/icon_map.js +2 -0
  68. package/es/components/key_pad_menu/key_pad_menu_item.js +1 -1
  69. package/es/components/list_group/list_group.js +2 -2
  70. package/es/components/list_group/list_group_item.js +2 -2
  71. package/es/components/list_group/list_group_item_extra_action.js +1 -1
  72. package/es/components/list_group/pinnable_list_group/pinnable_list_group.js +4 -4
  73. package/es/components/loading/loading_logo.js +1 -1
  74. package/es/components/markdown_editor/markdown_editor.js +1 -1
  75. package/es/components/markdown_editor/markdown_editor_drop_zone.js +1 -1
  76. package/es/components/markdown_editor/markdown_editor_footer.js +1 -1
  77. package/es/components/markdown_editor/markdown_editor_toolbar.js +1 -1
  78. package/es/components/notification/notification_event.js +2 -2
  79. package/es/components/notification/notification_event_meta.js +1 -1
  80. package/es/components/page/page_header/page_header_content.js +13 -1
  81. package/es/components/pagination/pagination_button.js +1 -1
  82. package/es/components/popover/input_popover.js +1 -0
  83. package/es/components/popover/popover.js +20 -3
  84. package/es/components/popover/popover_panel/_popover_panel.js +15 -21
  85. package/es/components/popover/popover_panel/_popover_panel.styles.js +47 -27
  86. package/es/components/selectable/selectable_list/selectable_list.js +1 -1
  87. package/es/components/selectable/selectable_list/selectable_list_item.js +1 -1
  88. package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +1 -1
  89. package/es/components/suggest/suggest.js +1 -1
  90. package/es/components/suggest/suggest_item.js +1 -1
  91. package/es/components/table/table_header_button.js +1 -1
  92. package/es/components/text_truncate/index.js +1 -1
  93. package/es/components/text_truncate/text_truncate.js +16 -26
  94. package/es/components/text_truncate/text_truncate.styles.js +10 -10
  95. package/es/components/text_truncate/utils.js +251 -282
  96. package/es/components/timeline/timeline_item_icon.js +1 -1
  97. package/es/components/toast/global_toast_list.js +1 -1
  98. package/es/components/toast/toast.js +1 -1
  99. package/es/components/tool_tip/icon_tip.js +1 -1
  100. package/es/components/tour/tour_step.js +12 -0
  101. package/eui.d.ts +191 -112
  102. package/i18ntokens.json +106 -88
  103. package/lib/components/avatar/avatar.js +1 -1
  104. package/lib/components/badge/badge.js +1 -1
  105. package/lib/components/badge/beta_badge/beta_badge.js +1 -1
  106. package/lib/components/basic_table/basic_table.a11y.js +4 -4
  107. package/lib/components/basic_table/basic_table.js +1 -1
  108. package/lib/components/basic_table/collapsed_item_actions.js +1 -1
  109. package/lib/components/basic_table/in_memory_table.a11y.js +4 -4
  110. package/lib/components/basic_table/in_memory_table.js +1 -1
  111. package/lib/components/breadcrumbs/breadcrumb.js +12 -0
  112. package/lib/components/button/button_display/_button_display.js +1 -1
  113. package/lib/components/button/button_display/_button_display_content.js +1 -1
  114. package/lib/components/button/button_empty/button_empty.js +1 -1
  115. package/lib/components/button/button_group/button_group.js +1 -1
  116. package/lib/components/button/button_group/button_group_button.js +1 -1
  117. package/lib/components/button/button_icon/button_icon.js +1 -1
  118. package/lib/components/call_out/call_out.js +54 -34
  119. package/lib/components/call_out/call_out.styles.js +42 -15
  120. package/lib/components/card/card.js +1 -1
  121. package/lib/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +1 -1
  122. package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +2 -2
  123. package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_item.js +2 -2
  124. package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_popover.js +3 -3
  125. package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.js +2 -2
  126. package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +3 -3
  127. package/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +11 -6
  128. package/lib/components/comment_list/comment.js +2 -2
  129. package/lib/components/comment_list/comment_event.js +1 -1
  130. package/lib/components/comment_list/comment_list.js +2 -2
  131. package/lib/components/comment_list/comment_timeline.js +1 -1
  132. package/lib/components/datagrid/body/data_grid_body.js +13 -13
  133. package/lib/components/datagrid/body/data_grid_body_custom.js +13 -13
  134. package/lib/components/datagrid/body/data_grid_body_virtualized.js +13 -13
  135. package/lib/components/datagrid/body/data_grid_cell.js +24 -24
  136. package/lib/components/datagrid/body/header/data_grid_header_cell.js +12 -12
  137. package/lib/components/datagrid/body/header/data_grid_header_row.js +13 -13
  138. package/lib/components/datagrid/controls/column_sorting_draggable.js +1 -1
  139. package/lib/components/datagrid/controls/data_grid_toolbar.js +21 -5
  140. package/lib/components/datagrid/controls/display_selector.js +16 -15
  141. package/lib/components/datagrid/data_grid.a11y.js +2 -2
  142. package/lib/components/datagrid/data_grid.js +35 -16
  143. package/lib/components/datagrid/data_grid_types.js +4 -0
  144. package/lib/components/datagrid/utils/in_memory.js +12 -12
  145. package/lib/components/date_picker/date_picker.js +15 -8
  146. package/lib/components/date_picker/date_picker_range.js +1 -1
  147. package/lib/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +2 -2
  148. package/lib/components/empty_prompt/empty_prompt.js +1 -1
  149. package/lib/components/facet/facet_button.js +1 -1
  150. package/lib/components/form/field_number/field_number.js +1 -1
  151. package/lib/components/form/field_text/field_text.js +2 -2
  152. package/lib/components/form/form_control_layout/form_control_layout.js +2 -2
  153. package/lib/components/form/form_control_layout/form_control_layout_custom_icon.js +1 -1
  154. package/lib/components/form/form_control_layout/form_control_layout_icons.js +2 -2
  155. package/lib/components/header/header_links/header_link.js +1 -1
  156. package/lib/components/header/header_links/header_links.js +1 -1
  157. package/lib/components/header/header_logo/header_logo.js +1 -1
  158. package/lib/components/header/header_section/header_section_item_button.js +1 -1
  159. package/lib/components/icon/assets/gradient.js +42 -0
  160. package/lib/components/icon/assets/palette.js +43 -0
  161. package/lib/components/icon/icon.js +1 -1
  162. package/lib/components/icon/icon_map.js +2 -0
  163. package/lib/components/icon/svgs/gradient.svg +3 -0
  164. package/lib/components/icon/svgs/palette.svg +4 -0
  165. package/lib/components/key_pad_menu/key_pad_menu_item.js +1 -1
  166. package/lib/components/list_group/list_group.js +2 -2
  167. package/lib/components/list_group/list_group_item.js +2 -2
  168. package/lib/components/list_group/list_group_item_extra_action.js +1 -1
  169. package/lib/components/list_group/pinnable_list_group/pinnable_list_group.js +4 -4
  170. package/lib/components/loading/loading_logo.js +1 -1
  171. package/lib/components/markdown_editor/markdown_editor.js +1 -1
  172. package/lib/components/markdown_editor/markdown_editor_drop_zone.js +1 -1
  173. package/lib/components/markdown_editor/markdown_editor_footer.js +1 -1
  174. package/lib/components/markdown_editor/markdown_editor_toolbar.js +1 -1
  175. package/lib/components/notification/notification_event.js +2 -2
  176. package/lib/components/notification/notification_event_meta.js +1 -1
  177. package/lib/components/page/page_header/page_header_content.js +1 -1
  178. package/lib/components/popover/input_popover.js +1 -0
  179. package/lib/components/popover/popover.js +20 -3
  180. package/lib/components/popover/popover_panel/_popover_panel.js +14 -20
  181. package/lib/components/popover/popover_panel/_popover_panel.styles.js +53 -35
  182. package/lib/components/selectable/selectable_list/selectable_list.js +1 -1
  183. package/lib/components/selectable/selectable_list/selectable_list_item.js +1 -1
  184. package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +1 -1
  185. package/lib/components/suggest/suggest.js +1 -1
  186. package/lib/components/suggest/suggest_item.js +1 -1
  187. package/lib/components/table/table_header_button.js +1 -1
  188. package/lib/components/text_truncate/index.js +6 -6
  189. package/lib/components/text_truncate/text_truncate.js +13 -23
  190. package/lib/components/text_truncate/text_truncate.styles.js +10 -10
  191. package/lib/components/text_truncate/utils.js +253 -284
  192. package/lib/components/timeline/timeline_item_icon.js +1 -1
  193. package/lib/components/toast/global_toast_list.js +1 -1
  194. package/lib/components/toast/toast.js +1 -1
  195. package/lib/components/tool_tip/icon_tip.js +1 -1
  196. package/optimize/es/components/basic_table/basic_table.a11y.js +4 -4
  197. package/optimize/es/components/basic_table/in_memory_table.a11y.js +4 -4
  198. package/optimize/es/components/call_out/call_out.js +44 -32
  199. package/optimize/es/components/call_out/call_out.styles.js +36 -7
  200. package/optimize/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +11 -6
  201. package/optimize/es/components/datagrid/controls/data_grid_toolbar.js +21 -5
  202. package/optimize/es/components/datagrid/controls/display_selector.js +16 -15
  203. package/optimize/es/components/datagrid/data_grid.a11y.js +2 -2
  204. package/optimize/es/components/datagrid/data_grid.js +4 -2
  205. package/optimize/es/components/datagrid/data_grid_types.js +3 -0
  206. package/optimize/es/components/date_picker/date_picker.js +8 -5
  207. package/optimize/es/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +2 -2
  208. package/optimize/es/components/icon/assets/gradient.js +33 -0
  209. package/optimize/es/components/icon/assets/palette.js +34 -0
  210. package/optimize/es/components/icon/icon_map.js +2 -0
  211. package/optimize/es/components/popover/input_popover.js +1 -0
  212. package/optimize/es/components/popover/popover.js +8 -3
  213. package/optimize/es/components/popover/popover_panel/_popover_panel.js +15 -16
  214. package/optimize/es/components/popover/popover_panel/_popover_panel.styles.js +47 -27
  215. package/optimize/es/components/text_truncate/index.js +1 -1
  216. package/optimize/es/components/text_truncate/text_truncate.js +16 -16
  217. package/optimize/es/components/text_truncate/text_truncate.styles.js +10 -10
  218. package/optimize/es/components/text_truncate/utils.js +245 -277
  219. package/optimize/lib/components/basic_table/basic_table.a11y.js +4 -4
  220. package/optimize/lib/components/basic_table/in_memory_table.a11y.js +4 -4
  221. package/optimize/lib/components/call_out/call_out.js +44 -32
  222. package/optimize/lib/components/call_out/call_out.styles.js +42 -15
  223. package/optimize/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +11 -6
  224. package/optimize/lib/components/datagrid/controls/data_grid_toolbar.js +21 -5
  225. package/optimize/lib/components/datagrid/controls/display_selector.js +16 -15
  226. package/optimize/lib/components/datagrid/data_grid.a11y.js +2 -2
  227. package/optimize/lib/components/datagrid/data_grid.js +4 -2
  228. package/optimize/lib/components/datagrid/data_grid_types.js +4 -0
  229. package/optimize/lib/components/date_picker/date_picker.js +8 -5
  230. package/optimize/lib/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +2 -2
  231. package/optimize/lib/components/icon/assets/gradient.js +42 -0
  232. package/optimize/lib/components/icon/assets/palette.js +43 -0
  233. package/optimize/lib/components/icon/icon_map.js +2 -0
  234. package/optimize/lib/components/icon/svgs/gradient.svg +3 -0
  235. package/optimize/lib/components/icon/svgs/palette.svg +4 -0
  236. package/optimize/lib/components/popover/input_popover.js +1 -0
  237. package/optimize/lib/components/popover/popover.js +8 -3
  238. package/optimize/lib/components/popover/popover_panel/_popover_panel.js +14 -15
  239. package/optimize/lib/components/popover/popover_panel/_popover_panel.styles.js +53 -35
  240. package/optimize/lib/components/text_truncate/index.js +6 -6
  241. package/optimize/lib/components/text_truncate/text_truncate.js +13 -13
  242. package/optimize/lib/components/text_truncate/text_truncate.styles.js +10 -10
  243. package/optimize/lib/components/text_truncate/utils.js +247 -279
  244. package/package.json +1 -2
  245. package/src/components/combo_box/combo_box_options_list/_combo_box_options_list.scss +8 -0
  246. package/src/components/date_picker/super_date_picker/quick_select_popover/_quick_select_popover.scss +2 -4
  247. package/test-env/components/avatar/avatar.js +1 -1
  248. package/test-env/components/badge/badge.js +1 -1
  249. package/test-env/components/badge/beta_badge/beta_badge.js +1 -1
  250. package/test-env/components/basic_table/basic_table.a11y.js +4 -4
  251. package/test-env/components/basic_table/basic_table.js +1 -1
  252. package/test-env/components/basic_table/collapsed_item_actions.js +1 -1
  253. package/test-env/components/basic_table/in_memory_table.a11y.js +4 -4
  254. package/test-env/components/basic_table/in_memory_table.js +1 -1
  255. package/test-env/components/breadcrumbs/breadcrumb.js +12 -0
  256. package/test-env/components/button/button_display/_button_display.js +1 -1
  257. package/test-env/components/button/button_display/_button_display_content.js +1 -1
  258. package/test-env/components/button/button_empty/button_empty.js +1 -1
  259. package/test-env/components/button/button_group/button_group.js +1 -1
  260. package/test-env/components/button/button_group/button_group_button.js +1 -1
  261. package/test-env/components/button/button_icon/button_icon.js +1 -1
  262. package/test-env/components/call_out/call_out.js +54 -34
  263. package/test-env/components/call_out/call_out.styles.js +42 -15
  264. package/test-env/components/card/card.js +1 -1
  265. package/test-env/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +1 -1
  266. package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +2 -2
  267. package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_item.js +2 -2
  268. package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_popover.js +3 -3
  269. package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.js +2 -2
  270. package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +3 -3
  271. package/test-env/components/combo_box/combo_box_options_list/combo_box_options_list.js +11 -6
  272. package/test-env/components/comment_list/comment.js +2 -2
  273. package/test-env/components/comment_list/comment_event.js +1 -1
  274. package/test-env/components/comment_list/comment_list.js +2 -2
  275. package/test-env/components/comment_list/comment_timeline.js +1 -1
  276. package/test-env/components/datagrid/body/data_grid_body.js +13 -13
  277. package/test-env/components/datagrid/body/data_grid_body_custom.js +13 -13
  278. package/test-env/components/datagrid/body/data_grid_body_virtualized.js +13 -13
  279. package/test-env/components/datagrid/body/data_grid_cell.js +24 -24
  280. package/test-env/components/datagrid/body/header/data_grid_header_cell.js +12 -12
  281. package/test-env/components/datagrid/body/header/data_grid_header_row.js +13 -13
  282. package/test-env/components/datagrid/controls/column_sorting_draggable.js +1 -1
  283. package/test-env/components/datagrid/controls/data_grid_toolbar.js +21 -5
  284. package/test-env/components/datagrid/controls/display_selector.js +16 -15
  285. package/test-env/components/datagrid/data_grid.a11y.js +2 -2
  286. package/test-env/components/datagrid/data_grid.js +35 -16
  287. package/test-env/components/datagrid/data_grid_types.js +4 -0
  288. package/test-env/components/datagrid/utils/in_memory.js +12 -12
  289. package/test-env/components/date_picker/date_picker.js +15 -8
  290. package/test-env/components/date_picker/date_picker_range.js +1 -1
  291. package/test-env/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +2 -2
  292. package/test-env/components/empty_prompt/empty_prompt.js +1 -1
  293. package/test-env/components/facet/facet_button.js +1 -1
  294. package/test-env/components/form/field_number/field_number.js +1 -1
  295. package/test-env/components/form/field_text/field_text.js +2 -2
  296. package/test-env/components/form/form_control_layout/form_control_layout.js +2 -2
  297. package/test-env/components/form/form_control_layout/form_control_layout_custom_icon.js +1 -1
  298. package/test-env/components/form/form_control_layout/form_control_layout_icons.js +2 -2
  299. package/test-env/components/header/header_links/header_link.js +1 -1
  300. package/test-env/components/header/header_links/header_links.js +1 -1
  301. package/test-env/components/header/header_logo/header_logo.js +1 -1
  302. package/test-env/components/header/header_section/header_section_item_button.js +1 -1
  303. package/test-env/components/icon/assets/gradient.js +42 -0
  304. package/test-env/components/icon/assets/palette.js +43 -0
  305. package/test-env/components/icon/icon_map.js +2 -0
  306. package/test-env/components/key_pad_menu/key_pad_menu_item.js +1 -1
  307. package/test-env/components/list_group/list_group.js +2 -2
  308. package/test-env/components/list_group/list_group_item.js +2 -2
  309. package/test-env/components/list_group/list_group_item_extra_action.js +1 -1
  310. package/test-env/components/list_group/pinnable_list_group/pinnable_list_group.js +4 -4
  311. package/test-env/components/loading/loading_logo.js +1 -1
  312. package/test-env/components/markdown_editor/markdown_editor.js +1 -1
  313. package/test-env/components/markdown_editor/markdown_editor_drop_zone.js +1 -1
  314. package/test-env/components/markdown_editor/markdown_editor_footer.js +1 -1
  315. package/test-env/components/markdown_editor/markdown_editor_toolbar.js +1 -1
  316. package/test-env/components/notification/notification_event.js +2 -2
  317. package/test-env/components/notification/notification_event_meta.js +1 -1
  318. package/test-env/components/page/page_header/page_header_content.js +1 -1
  319. package/test-env/components/popover/input_popover.js +1 -0
  320. package/test-env/components/popover/popover.js +20 -3
  321. package/test-env/components/popover/popover_panel/_popover_panel.js +14 -15
  322. package/test-env/components/popover/popover_panel/_popover_panel.styles.js +53 -35
  323. package/test-env/components/selectable/selectable_list/selectable_list.js +1 -1
  324. package/test-env/components/selectable/selectable_list/selectable_list_item.js +1 -1
  325. package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +1 -1
  326. package/test-env/components/suggest/suggest.js +1 -1
  327. package/test-env/components/suggest/suggest_item.js +1 -1
  328. package/test-env/components/table/table_header_button.js +1 -1
  329. package/test-env/components/text_truncate/index.js +6 -6
  330. package/test-env/components/text_truncate/text_truncate.js +13 -23
  331. package/test-env/components/text_truncate/text_truncate.styles.js +10 -10
  332. package/test-env/components/text_truncate/utils.js +247 -279
  333. package/test-env/components/timeline/timeline_item_icon.js +1 -1
  334. package/test-env/components/toast/global_toast_list.js +1 -1
  335. package/test-env/components/toast/toast.js +1 -1
  336. package/test-env/components/tool_tip/icon_tip.js +1 -1
@@ -4,18 +4,18 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.TruncationUtilsWithDOM = exports.TruncationUtilsWithCanvas = void 0;
7
+ exports.TruncationUtils = exports.CanvasTextUtils = void 0;
8
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
8
9
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
10
  var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
11
+ var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
10
12
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
11
13
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
12
14
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
13
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
14
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
15
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
16
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
16
17
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
17
- var _excluded = ["container"],
18
- _excluded2 = ["font", "container"];
18
+ var _excluded = ["fullText", "ellipsis", "availableWidth"];
19
19
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
20
20
  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; } }
21
21
  /*
@@ -26,313 +26,281 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
26
26
  * Side Public License, v 1.
27
27
  */
28
28
  /**
29
- * This internal shared/base class contains the actual logic for truncating text
30
- * (as well as a few handy utilities for checking whether truncation is possible
31
- * or even necessary).
32
- *
33
- * How the underlying mechanism works: the full text is rendered, and then
34
- * characters are removed one by one until the width of the text fits within
35
- * the specified available width.
36
- *
37
- * Side note: The exception to this is the `truncateStartEndAtPosition` method,
38
- * which works by building up from an empty string / by adding characters
39
- * instead of removing them.
40
- */
41
- var _TruncationUtils = /*#__PURE__*/(0, _createClass2.default)(function _TruncationUtils(_ref) {
42
- var _this = this;
43
- var fullText = _ref.fullText,
44
- ellipsis = _ref.ellipsis,
45
- availableWidth = _ref.availableWidth;
46
- (0, _classCallCheck2.default)(this, _TruncationUtils);
47
- (0, _defineProperty2.default)(this, "fullText", void 0);
48
- (0, _defineProperty2.default)(this, "ellipsis", void 0);
49
- (0, _defineProperty2.default)(this, "availableWidth", void 0);
50
- /**
51
- * Early return checks
52
- */
53
- (0, _defineProperty2.default)(this, "checkIfTruncationIsNeeded", function () {
54
- _this.setTextToCheck(_this.fullText);
55
- if (_this.availableWidth >= _this.textWidth) {
56
- return false;
57
- }
58
- });
59
- (0, _defineProperty2.default)(this, "checkSufficientEllipsisWidth", function (truncation) {
60
- var textToCheck = truncation === 'startEnd' ? "".concat(_this.ellipsis, " ").concat(_this.ellipsis) // startEnd needs a little more space
61
- : _this.ellipsis;
62
- _this.setTextToCheck(textToCheck);
63
- if (_this.textWidth >= _this.availableWidth * 0.9) {
64
- console.error('The truncation ellipsis is larger than the available width. No text can be rendered.');
65
- return false;
66
- }
67
- });
68
- (0, _defineProperty2.default)(this, "checkTruncationOffsetWidth", function (text) {
69
- _this.setTextToCheck(text);
70
- if (_this.textWidth > _this.availableWidth) {
71
- console.error("The passed truncationOffset is too large for the available width. Truncating the offset instead.");
72
- return false;
73
- }
74
- });
75
- /**
76
- * Truncation types logic. This is where the magic happens
77
- */
78
- (0, _defineProperty2.default)(this, "truncateStart", function (truncationOffset) {
79
- var truncatedText = _this.fullText;
80
- var leadingText = '';
81
- var combinedText = function combinedText() {
82
- return "".concat(leadingText).concat(truncatedText);
83
- };
84
- if (truncationOffset) {
85
- var _splitText$at = splitText(_this.fullText).at(truncationOffset);
86
- var _splitText$at2 = (0, _slicedToArray2.default)(_splitText$at, 2);
87
- leadingText = _splitText$at2[0];
88
- truncatedText = _splitText$at2[1];
89
- var widthCheck = "".concat(leadingText).concat(_this.ellipsis);
90
- if (_this.checkTruncationOffsetWidth(widthCheck) === false) {
91
- truncatedText = leadingText;
92
- leadingText = '';
93
- }
94
- }
95
- leadingText += _this.ellipsis;
96
- _this.setTextToCheck(combinedText());
97
- while (_this.textWidth > _this.availableWidth) {
98
- truncatedText = removeFirstCharacter(truncatedText);
99
- _this.setTextToCheck(combinedText());
100
- }
101
- return combinedText();
102
- });
103
- (0, _defineProperty2.default)(this, "truncateEnd", function (truncationOffset) {
104
- var truncatedText = _this.fullText;
105
- var trailingText = '';
106
- var combinedText = function combinedText() {
107
- return "".concat(truncatedText).concat(trailingText);
108
- };
109
- if (truncationOffset) {
110
- var index = _this.fullText.length - truncationOffset;
111
- var _splitText$at3 = splitText(_this.fullText).at(index);
112
- var _splitText$at4 = (0, _slicedToArray2.default)(_splitText$at3, 2);
113
- truncatedText = _splitText$at4[0];
114
- trailingText = _splitText$at4[1];
115
- var widthCheck = "".concat(_this.ellipsis).concat(trailingText);
116
- if (_this.checkTruncationOffsetWidth(widthCheck) === false) {
117
- truncatedText = trailingText;
118
- trailingText = '';
119
- }
120
- }
121
- trailingText = _this.ellipsis + trailingText;
122
- _this.setTextToCheck(combinedText());
123
- while (_this.textWidth > _this.availableWidth) {
124
- truncatedText = removeLastCharacter(truncatedText);
125
- _this.setTextToCheck(combinedText());
126
- }
127
- return combinedText();
128
- });
129
- (0, _defineProperty2.default)(this, "truncateStartEndAtPosition", function (truncationPosition) {
130
- // If using a non-centered startEnd anchor position, we need to *build*
131
- // the string from scratch instead of *removing* from the full text string,
132
- // to make sure we don't go past the beginning or end of the text
133
- var truncatedText = '';
134
- _this.setTextToCheck(truncatedText);
135
-
136
- // Ellipses are conditional - if the anchor is towards the beginning or end,
137
- // it's possible they shouldn't render
138
- var startingEllipsis = _this.ellipsis;
139
- var endingEllipsis = _this.ellipsis;
140
-
141
- // Split the text into two at the anchor position
142
- var _splitText$at5 = splitText(_this.fullText).at(truncationPosition),
143
- _splitText$at6 = (0, _slicedToArray2.default)(_splitText$at5, 2),
144
- firstPart = _splitText$at6[0],
145
- secondPart = _splitText$at6[1];
146
- var combinedText = function combinedText() {
147
- return "".concat(startingEllipsis).concat(truncatedText).concat(endingEllipsis);
148
- };
149
- while (_this.textWidth <= _this.availableWidth) {
150
- if (firstPart.length > 0) {
151
- truncatedText = "".concat(getLastCharacter(firstPart)).concat(truncatedText);
152
- firstPart = removeLastCharacter(firstPart);
153
- } else {
154
- startingEllipsis = '';
155
- }
156
- if (secondPart.length > 0) {
157
- truncatedText = "".concat(truncatedText).concat(getFirstCharacter(secondPart));
158
- secondPart = removeFirstCharacter(secondPart);
159
- } else {
160
- endingEllipsis = '';
161
- }
162
- _this.setTextToCheck(combinedText());
163
- }
164
-
165
- // Because this logic builds text outwards vs. removing inwards, the final
166
- // text width ends up a little larger than the container, and we need to
167
- // remove the last added character(s)
168
- if (!startingEllipsis) {
169
- truncatedText = removeLastCharacter(truncatedText);
170
- } else if (!endingEllipsis) {
171
- truncatedText = removeFirstCharacter(truncatedText);
172
- } else {
173
- truncatedText = removeFirstAndLastCharacters(truncatedText);
174
- }
175
- return combinedText();
176
- });
177
- (0, _defineProperty2.default)(this, "truncateStartEndAtMiddle", function () {
178
- var truncatedText = _this.fullText;
179
- _this.setTextToCheck(truncatedText);
180
- var combinedText = function combinedText() {
181
- return "".concat(_this.ellipsis).concat(truncatedText).concat(_this.ellipsis);
182
- };
183
- while (_this.textWidth > _this.availableWidth) {
184
- truncatedText = removeFirstAndLastCharacters(truncatedText);
185
- _this.setTextToCheck(combinedText());
186
- }
187
- return combinedText();
188
- });
189
- (0, _defineProperty2.default)(this, "truncateMiddle", function () {
190
- var middlePosition = Math.floor(_this.fullText.length / 2);
191
- var _splitText$at7 = splitText(_this.fullText).at(middlePosition),
192
- _splitText$at8 = (0, _slicedToArray2.default)(_splitText$at7, 2),
193
- firstHalf = _splitText$at8[0],
194
- secondHalf = _splitText$at8[1];
195
- var trimfirstHalf;
196
- var combinedText = function combinedText() {
197
- return "".concat(firstHalf).concat(_this.ellipsis).concat(secondHalf);
198
- };
199
- _this.setTextToCheck(combinedText());
200
- while (_this.textWidth > _this.availableWidth) {
201
- trimfirstHalf = !trimfirstHalf;
202
- if (trimfirstHalf) {
203
- firstHalf = removeLastCharacter(firstHalf);
204
- } else {
205
- secondHalf = removeFirstCharacter(secondHalf);
206
- }
207
- _this.setTextToCheck(combinedText());
208
- }
209
- return combinedText();
210
- });
211
- this.fullText = fullText;
212
- this.ellipsis = ellipsis;
213
- this.availableWidth = availableWidth;
214
- }
215
-
216
- /**
217
- * Internal measurement utils which will be overridden depending on the
218
- * rendering approach used (e.g. DOM vs Canvas).
219
- */);
220
- /**
221
- * Creates a temporary vanilla JS DOM element for manipulating text and
222
- * determining text width.
223
- *
224
- * Requires passing in a container element to which the temporary element
225
- * will be appended. Any CSS/font styles that need to be accounted for should
226
- * be automatically inherited from the container.
227
- *
228
- * NOTE: The consumer is responsible for calling the `cleanup()` method manually
229
- * to remove the temporary DOM node once their usage of this utility is complete.
230
- */
231
- var TruncationUtilsWithDOM = /*#__PURE__*/function (_TruncationUtils2) {
232
- (0, _inherits2.default)(TruncationUtilsWithDOM, _TruncationUtils2);
233
- var _super = _createSuper(TruncationUtilsWithDOM);
234
- function TruncationUtilsWithDOM(_ref2) {
235
- var _this2;
236
- var container = _ref2.container,
237
- rest = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
238
- (0, _classCallCheck2.default)(this, TruncationUtilsWithDOM);
239
- _this2 = _super.call(this, rest);
240
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "container", void 0);
241
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "span", void 0);
242
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "setTextToCheck", function (text) {
243
- _this2.span.textContent = text;
244
- });
245
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "cleanup", function () {
246
- _this2.container.removeChild(_this2.span);
247
- });
248
- _this2.container = container;
249
- _this2.span = document.createElement('span');
250
- _this2.span.style.position = 'absolute'; // Prevent page reflow/repaint for performance
251
- _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
252
- _this2.container.appendChild(_this2.span);
253
- return _this2;
254
- }
255
- (0, _createClass2.default)(TruncationUtilsWithDOM, [{
256
- key: "textWidth",
257
- get: function get() {
258
- return this.span.offsetWidth;
259
- }
260
- }]);
261
- return TruncationUtilsWithDOM;
262
- }(_TruncationUtils);
263
- /**
264
- * Creates a temporary Canvas element for manipulating text & determining
265
- * text width. This method is compatible with charts or other canvas-rendered
266
- * frameworks, and requires no cleanup method.
29
+ * Under the hood, a temporary Canvas element is created for manipulating text
30
+ * & determining text width.
267
31
  *
268
32
  * To accurately measure text, canvas rendering requires either a container to
269
33
  * compute/derive font styles from, or a static font string (useful for usage
270
34
  * outside the DOM). Particular care should be applied when fallback fonts are
271
35
  * used, as more fallback fonts can lead to less precision.
272
36
  *
273
- * Please note that while canvas is more performant than DOM measurement, there
274
- * are subpixel to single digit pixel differences between DOM and canvas
275
- * measurement due to the different rendering engines used.
37
+ * Please note that while canvas is more significantly more performant than DOM
38
+ * measurement, there are subpixel to single digit pixel differences between
39
+ * DOM and canvas measurement due to the different rendering engines used.
276
40
  */
277
- exports.TruncationUtilsWithDOM = TruncationUtilsWithDOM;
278
- var TruncationUtilsWithCanvas = /*#__PURE__*/function (_TruncationUtils3) {
279
- (0, _inherits2.default)(TruncationUtilsWithCanvas, _TruncationUtils3);
280
- var _super2 = _createSuper(TruncationUtilsWithCanvas);
281
- function TruncationUtilsWithCanvas(_ref3) {
282
- var _this3;
283
- var font = _ref3.font,
284
- container = _ref3.container,
285
- rest = (0, _objectWithoutProperties2.default)(_ref3, _excluded2);
286
- (0, _classCallCheck2.default)(this, TruncationUtilsWithCanvas);
287
- _this3 = _super2.call(this, rest);
288
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this3), "context", void 0);
289
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this3), "currentText", '');
290
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this3), "computeFontFromElement", function (element) {
41
+ var CanvasTextUtils = /*#__PURE__*/function () {
42
+ function CanvasTextUtils(_ref) {
43
+ var _this = this;
44
+ var font = _ref.font,
45
+ container = _ref.container;
46
+ (0, _classCallCheck2.default)(this, CanvasTextUtils);
47
+ (0, _defineProperty2.default)(this, "context", void 0);
48
+ (0, _defineProperty2.default)(this, "currentText", '');
49
+ (0, _defineProperty2.default)(this, "computeFontFromElement", function (element) {
291
50
  var computedStyles = window.getComputedStyle(element);
51
+ // TODO: font-stretch is not included even though it potentially should be
52
+ // @see https://developer.mozilla.org/en-US/docs/Web/CSS/font#constituent_properties
53
+ // It appears to be unsupported and/or breaks font computation in canvas
292
54
  return ['font-style', 'font-variant', 'font-weight', 'font-size', 'font-family'].map(function (prop) {
293
55
  return computedStyles.getPropertyValue(prop);
294
56
  }).join(' ').trim();
295
57
  });
296
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this3), "setTextToCheck", function (text) {
297
- _this3.currentText = text;
58
+ (0, _defineProperty2.default)(this, "setTextToCheck", function (text) {
59
+ _this.currentText = text;
298
60
  });
299
- _this3.context = document.createElement('canvas').getContext('2d');
61
+ this.context = document.createElement('canvas').getContext('2d');
300
62
 
301
63
  // Set the canvas font to ensure text width calculations are correct
302
64
  if (font) {
303
- _this3.context.font = font;
65
+ this.context.font = font;
304
66
  } else if (container) {
305
- _this3.context.font = _this3.computeFontFromElement(container);
67
+ this.context.font = this.computeFontFromElement(container);
306
68
  }
307
- return _this3;
308
69
  }
309
- (0, _createClass2.default)(TruncationUtilsWithCanvas, [{
70
+ (0, _createClass2.default)(CanvasTextUtils, [{
310
71
  key: "textWidth",
311
72
  get: function get() {
312
73
  return this.context.measureText(this.currentText).width;
313
74
  }
314
75
  }]);
315
- return TruncationUtilsWithCanvas;
316
- }(_TruncationUtils);
76
+ return CanvasTextUtils;
77
+ }();
78
+ /**
79
+ * Utilities for truncating types at various positions, as well as
80
+ * determining whether truncation is possible or even necessary.
81
+ */
82
+ exports.CanvasTextUtils = CanvasTextUtils;
83
+ var TruncationUtils = /*#__PURE__*/function (_CanvasTextUtils) {
84
+ (0, _inherits2.default)(TruncationUtils, _CanvasTextUtils);
85
+ var _super = _createSuper(TruncationUtils);
86
+ function TruncationUtils(_ref2) {
87
+ var _this2;
88
+ var fullText = _ref2.fullText,
89
+ ellipsis = _ref2.ellipsis,
90
+ _availableWidth = _ref2.availableWidth,
91
+ rest = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
92
+ (0, _classCallCheck2.default)(this, TruncationUtils);
93
+ _this2 = _super.call(this, rest);
94
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "fullText", void 0);
95
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "ellipsis", void 0);
96
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "availableWidth", void 0);
97
+ /**
98
+ * Performance utilities
99
+ */
100
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "debugPerformance", false);
101
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "debugCounter", 0);
102
+ /**
103
+ * Internal utils for calculating a ratio based on the passed available width
104
+ * vs the full text width.
105
+ * This ratio is used to get an initial _approximate_ text string that should
106
+ * be slightly over the available width, which we can then remove from
107
+ * character-by-character until the text just fits within the available width.
108
+ */
109
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "widthRatio", 0);
110
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "setTextWidthRatio", function () {
111
+ var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this2.fullText;
112
+ var textToOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
113
+ // Account for reduced available width due to (e.g.) truncation offset
114
+ var availableWidth = _this2.availableWidth;
115
+ if (textToOffset) {
116
+ _this2.setTextToCheck(textToOffset);
117
+ availableWidth = availableWidth - _this2.textWidth;
118
+ }
119
+ _this2.setTextToCheck(text);
120
+ _this2.widthRatio = availableWidth / _this2.textWidth;
121
+ });
122
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "getTextFromRatio", function (text, type) {
123
+ var characterRatio = Math.ceil(text.length * _this2.widthRatio);
124
+ var index = type === 'start' ? text.length - characterRatio : characterRatio;
125
+ var _splitText$at = splitText(text).at(index),
126
+ _splitText$at2 = (0, _slicedToArray2.default)(_splitText$at, 2),
127
+ end = _splitText$at2[0],
128
+ start = _splitText$at2[1];
129
+ return type === 'start' ? start : end;
130
+ });
131
+ /**
132
+ * Early return checks
133
+ */
134
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "checkIfTruncationIsNeeded", function () {
135
+ _this2.setTextToCheck(_this2.fullText);
136
+ if (_this2.availableWidth >= _this2.textWidth) {
137
+ return false;
138
+ }
139
+ });
140
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "checkSufficientEllipsisWidth", function (truncation) {
141
+ var textToCheck = truncation === 'startEnd' ? "".concat(_this2.ellipsis, " ").concat(_this2.ellipsis) // startEnd needs a little more space
142
+ : _this2.ellipsis;
143
+ _this2.setTextToCheck(textToCheck);
144
+ if (_this2.textWidth >= _this2.availableWidth * 0.9) {
145
+ console.error('The truncation ellipsis is larger than the available width. No text can be rendered.');
146
+ return false;
147
+ }
148
+ });
149
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "checkTruncationOffsetWidth", function (text) {
150
+ _this2.setTextToCheck(text);
151
+ if (_this2.textWidth > _this2.availableWidth) {
152
+ console.error('The passed truncationOffset is too large for the available width. Truncating the offset instead.');
153
+ return false;
154
+ }
155
+ });
156
+ /**
157
+ * Truncation types logic. This is where the magic happens
158
+ */
159
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "truncateStart", function (truncationOffset) {
160
+ var truncatedText = _this2.fullText;
161
+ var leadingText = '';
162
+ var combinedText = function combinedText() {
163
+ return leadingText + truncatedText;
164
+ };
165
+ if (truncationOffset) {
166
+ var _splitText$at3 = splitText(_this2.fullText).at(truncationOffset);
167
+ var _splitText$at4 = (0, _slicedToArray2.default)(_splitText$at3, 2);
168
+ leadingText = _splitText$at4[0];
169
+ truncatedText = _splitText$at4[1];
170
+ var widthCheck = leadingText + _this2.ellipsis;
171
+ if (_this2.checkTruncationOffsetWidth(widthCheck) === false) {
172
+ truncatedText = leadingText;
173
+ leadingText = '';
174
+ }
175
+ }
176
+
177
+ // Get text width ratio width accounting for any truncation offset text,
178
+ // and guesstimate an initial truncated string
179
+ _this2.setTextWidthRatio(truncatedText, leadingText);
180
+ truncatedText = _this2.getTextFromRatio(truncatedText, 'start');
181
+ leadingText += _this2.ellipsis;
182
+ _this2.setTextToCheck(combinedText());
183
+ while (_this2.textWidth > _this2.availableWidth) {
184
+ truncatedText = removeFirstCharacter(truncatedText);
185
+ _this2.setTextToCheck(combinedText());
186
+ }
187
+ return combinedText();
188
+ });
189
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "truncateEnd", function (truncationOffset) {
190
+ var truncatedText = _this2.fullText;
191
+ var trailingText = '';
192
+ var combinedText = function combinedText() {
193
+ return truncatedText + trailingText;
194
+ };
195
+ if (truncationOffset) {
196
+ var index = _this2.fullText.length - truncationOffset;
197
+ var _splitText$at5 = splitText(_this2.fullText).at(index);
198
+ var _splitText$at6 = (0, _slicedToArray2.default)(_splitText$at5, 2);
199
+ truncatedText = _splitText$at6[0];
200
+ trailingText = _splitText$at6[1];
201
+ var widthCheck = _this2.ellipsis + trailingText;
202
+ if (_this2.checkTruncationOffsetWidth(widthCheck) === false) {
203
+ truncatedText = trailingText;
204
+ trailingText = '';
205
+ }
206
+ }
207
+
208
+ // Get text width ratio width accounting for any truncation offset text,
209
+ // and guesstimate an initial truncated string
210
+ _this2.setTextWidthRatio(truncatedText, trailingText);
211
+ truncatedText = _this2.getTextFromRatio(truncatedText, 'end');
212
+ trailingText = _this2.ellipsis + trailingText;
213
+ _this2.setTextToCheck(combinedText());
214
+ while (_this2.textWidth > _this2.availableWidth) {
215
+ truncatedText = removeLastCharacter(truncatedText);
216
+ _this2.setTextToCheck(combinedText());
217
+ }
218
+ return combinedText();
219
+ });
220
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "truncateStartEndAtPosition", function (truncationPosition) {
221
+ // Split the text from the anchor position, using the width ratio
222
+ // to get the starting and ending indices from the position
223
+ _this2.setTextWidthRatio();
224
+ var characterRatio = Math.floor(_this2.fullText.length * _this2.widthRatio / 2);
225
+ var truncateStart = truncationPosition - characterRatio;
226
+ var truncateEnd = truncationPosition + characterRatio;
227
+
228
+ // If either of the approximate start/end truncation indices go beyond the
229
+ // bounds of the actual text, we can simply use end or start truncation instead
230
+ if (truncateStart < 0) {
231
+ return _this2.truncateEnd();
232
+ }
233
+ if (truncateEnd >= _this2.fullText.length) {
234
+ return _this2.truncateStart();
235
+ }
236
+ var truncatedText = _this2.fullText.substring(truncateStart, truncateEnd);
237
+ var combinedText = function combinedText() {
238
+ return _this2.ellipsis + truncatedText + _this2.ellipsis;
239
+ };
240
+ _this2.setTextToCheck(combinedText());
241
+ var alternating;
242
+ while (_this2.textWidth > _this2.availableWidth) {
243
+ truncatedText = alternating ? removeLastCharacter(truncatedText) : removeFirstCharacter(truncatedText);
244
+ alternating = !alternating;
245
+ _this2.setTextToCheck(combinedText());
246
+ }
247
+ return combinedText();
248
+ });
249
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "truncateStartEndAtMiddle", function () {
250
+ var middlePosition = Math.floor(_this2.fullText.length / 2);
251
+ return _this2.truncateStartEndAtPosition(middlePosition);
252
+ });
253
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "truncateMiddle", function () {
254
+ var middlePosition = Math.floor(_this2.fullText.length / 2);
255
+ var _splitText$at7 = splitText(_this2.fullText).at(middlePosition),
256
+ _splitText$at8 = (0, _slicedToArray2.default)(_splitText$at7, 2),
257
+ firstHalf = _splitText$at8[0],
258
+ secondHalf = _splitText$at8[1];
259
+ _this2.setTextWidthRatio();
260
+ firstHalf = _this2.getTextFromRatio(firstHalf, 'end');
261
+ secondHalf = _this2.getTextFromRatio(secondHalf, 'start');
262
+ var combinedText = function combinedText() {
263
+ return firstHalf + _this2.ellipsis + secondHalf;
264
+ };
265
+ _this2.setTextToCheck(combinedText());
266
+ var alternating;
267
+ while (_this2.textWidth > _this2.availableWidth) {
268
+ alternating = !alternating;
269
+ if (alternating) {
270
+ firstHalf = removeLastCharacter(firstHalf);
271
+ } else {
272
+ secondHalf = removeFirstCharacter(secondHalf);
273
+ }
274
+ _this2.setTextToCheck(combinedText());
275
+ }
276
+ return combinedText();
277
+ });
278
+ _this2.fullText = fullText;
279
+ _this2.ellipsis = ellipsis;
280
+ _this2.availableWidth = _availableWidth;
281
+ return _this2;
282
+ }
283
+ (0, _createClass2.default)(TruncationUtils, [{
284
+ key: "textWidth",
285
+ get: function get() {
286
+ if (this.debugPerformance) {
287
+ this.debugCounter++;
288
+ }
289
+ return (0, _get2.default)((0, _getPrototypeOf2.default)(TruncationUtils.prototype), "textWidth", this);
290
+ }
291
+ }]);
292
+ return TruncationUtils;
293
+ }(CanvasTextUtils);
317
294
  /**
318
295
  * DRY character/substring utils
319
296
  */
320
- exports.TruncationUtilsWithCanvas = TruncationUtilsWithCanvas;
297
+ exports.TruncationUtils = TruncationUtils;
321
298
  var removeLastCharacter = function removeLastCharacter(text) {
322
299
  return text.substring(0, text.length - 1);
323
300
  };
324
- var getLastCharacter = function getLastCharacter(text) {
325
- return text.substring(text.length - 1);
326
- };
327
301
  var removeFirstCharacter = function removeFirstCharacter(text) {
328
302
  return text.substring(1);
329
303
  };
330
- var getFirstCharacter = function getFirstCharacter(text) {
331
- return text.substring(0, 1);
332
- };
333
- var removeFirstAndLastCharacters = function removeFirstAndLastCharacters(text) {
334
- return text.substring(1, text.length - 1);
335
- };
336
304
  var splitText = function splitText(text) {
337
305
  return {
338
306
  at: function at(index) {
@@ -48,7 +48,7 @@ EuiTimelineItemIcon.propTypes = {
48
48
  /**
49
49
  * Any `ReactNode`, but preferably `EuiAvatar`, or a `string` as an `EuiIcon['type']`.
50
50
  */
51
- icon: _propTypes.default.oneOfType([_propTypes.default.node.isRequired, _propTypes.default.oneOfType([_propTypes.default.oneOf(["accessibility", "addDataApp", "advancedSettingsApp", "agentApp", "aggregate", "analyzeEvent", "annotation", "apmApp", "apmTrace", "appSearchApp", "apps", "arrowDown", "arrowLeft", "arrowRight", "arrowUp", "arrowStart", "arrowEnd", "article", "asterisk", "at", "auditbeatApp", "beaker", "bell", "bellSlash", "beta", "bolt", "boxesHorizontal", "boxesVertical", "branch", "branchUser", "broom", "brush", "bug", "bullseye", "calendar", "canvasApp", "casesApp", "check", "checkInCircleFilled", "cheer", "classificationJob", "clock", "cloudDrizzle", "cloudStormy", "cloudSunny", "cluster", "codeApp", "color", "compute", "console", "consoleApp", "container", "continuityAbove", "continuityAboveBelow", "continuityBelow", "continuityWithin", "controlsHorizontal", "controlsVertical", "copy", "copyClipboard", "createAdvancedJob", "createMultiMetricJob", "createPopulationJob", "createSingleMetricJob", "cross", "crossClusterReplicationApp", "crosshairs", "currency", "cut", "dashboardApp", "dataVisualizer", "database", "desktop", "devToolsApp", "discoverApp", "discuss", "document", "documentEdit", "documentation", "documents", "dot", "dotInCircle", "doubleArrowLeft", "doubleArrowRight", "download", "editorAlignCenter", "editorAlignLeft", "editorAlignRight", "editorBold", "editorChecklist", "editorCodeBlock", "editorComment", "editorDistributeHorizontal", "editorDistributeVertical", "editorHeading", "editorItalic", "editorItemAlignBottom", "editorItemAlignCenter", "editorItemAlignLeft", "editorItemAlignMiddle", "editorItemAlignRight", "editorItemAlignTop", "editorLink", "editorOrderedList", "editorPositionBottomLeft", "editorPositionBottomRight", "editorPositionTopLeft", "editorPositionTopRight", "editorRedo", "editorStrike", "editorTable", "editorUnderline", "editorUndo", "editorUnorderedList", "email", "empty", "emsApp", "eql", "eraser", "error", "exit", "expand", "expandMini", "exportAction", "eye", "eyeClosed", "faceHappy", "faceNeutral", "faceSad", "filebeatApp", "filter", "filterExclude", "filterIgnore", "filterInclude", "filterInCircle", "flag", "fleetApp", "fold", "folderCheck", "folderClosed", "folderExclamation", "folderOpen", "frameNext", "framePrevious", "fullScreen", "fullScreenExit", "function", "gear", "gisApp", "glasses", "globe", "grab", "grabHorizontal", "grabOmnidirectional", "graphApp", "grid", "grokApp", "heart", "heartbeatApp", "heatmap", "help", "home", "iInCircle", "image", "importAction", "indexClose", "indexEdit", "indexFlush", "indexManagementApp", "indexMapping", "indexOpen", "indexPatternApp", "indexRollupApp", "indexRuntime", "indexSettings", "indexTemporary", "infinity", "inputOutput", "inspect", "invert", "ip", "key", "keyboard", "kqlField", "kqlFunction", "kqlOperand", "kqlSelector", "kqlValue", "kubernetesNode", "kubernetesPod", "launch", "layers", "lensApp", "lettering", "lineDashed", "lineDotted", "lineSolid", "link", "list", "listAdd", "lock", "lockOpen", "logoAWS", "logoAWSMono", "logoAerospike", "logoApache", "logoAppSearch", "logoAzure", "logoAzureMono", "logoBeats", "logoBusinessAnalytics", "logoCeph", "logoCloud", "logoCloudEnterprise", "logoCode", "logoCodesandbox", "logoCouchbase", "logoDocker", "logoDropwizard", "logoElastic", "logoElasticStack", "logoElasticsearch", "logoEnterpriseSearch", "logoEtcd", "logoGCP", "logoGCPMono", "logoGithub", "logoGmail", "logoGolang", "logoGoogleG", "logoHAproxy", "logoIBM", "logoIBMMono", "logoKafka", "logoKibana", "logoKubernetes", "logoLogging", "logoLogstash", "logoMaps", "logoMemcached", "logoMetrics", "logoMongodb", "logoMySQL", "logoNginx", "logoObservability", "logoOsquery", "logoPhp", "logoPostgres", "logoPrometheus", "logoRabbitmq", "logoRedis", "logoSecurity", "logoSiteSearch", "logoSketch", "logoSlack", "logoUptime", "logoVulnerabilityManagement", "logoWebhook", "logoWindows", "logoWorkplaceSearch", "logsApp", "logstashFilter", "logstashIf", "logstashInput", "logstashOutput", "logstashQueue", "machineLearningApp", "magnet", "magnifyWithExclamation", "magnifyWithMinus", "magnifyWithPlus", "managementApp", "mapMarker", "memory", "menu", "menuDown", "menuLeft", "menuRight", "menuUp", "merge", "metricbeatApp", "metricsApp", "minimize", "minus", "minusInCircle", "minusInCircleFilled", "mobile", "monitoringApp", "moon", "namespace", "nested", "node", "notebookApp", "number", "offline", "online", "outlierDetectionJob", "package", "packetbeatApp", "pageSelect", "pagesSelect", "paperClip", "partial", "pause", "payment", "pencil", "percent", "pin", "pinFilled", "pipelineApp", "pivot", "play", "playFilled", "plus", "plusInCircle", "plusInCircleFilled", "popout", "push", "questionInCircle", "quote", "recentlyViewedApp", "refresh", "regressionJob", "reporter", "reportingApp", "returnKey", "save", "savedObjectsApp", "scale", "search", "searchProfilerApp", "securityAnalyticsApp", "securityApp", "securitySignal", "securitySignalDetected", "securitySignalResolved", "sessionViewer", "shard", "share", "snowflake", "sortAscending", "sortDescending", "sortDown", "sortLeft", "sortRight", "sortUp", "sortable", "spaces", "spacesApp", "sparkles", "sqlApp", "starEmpty", "starEmptySpace", "starFilled", "starFilledSpace", "starMinusEmpty", "starMinusFilled", "starPlusEmpty", "starPlusFilled", "stats", "stop", "stopFilled", "stopSlash", "storage", "string", "submodule", "sun", "swatchInput", "symlink", "tableDensityCompact", "tableDensityExpanded", "tableDensityNormal", "tableOfContents", "tag", "tear", "temperature", "timeline", "timelineWithArrow", "timelionApp", "timeRefresh", "timeslider", "training", "transitionLeftIn", "transitionLeftOut", "transitionTopIn", "transitionTopOut", "trash", "unfold", "unlink", "upgradeAssistantApp", "uptimeApp", "user", "userAvatar", "users", "usersRolesApp", "vector", "videoPlayer", "visArea", "visAreaStacked", "visBarHorizontal", "visBarHorizontalStacked", "visBarVertical", "visBarVerticalStacked", "visGauge", "visGoal", "visLine", "visMapCoordinate", "visMapRegion", "visMetric", "visPie", "visTable", "visTagCloud", "visText", "visTimelion", "visVega", "visVisualBuilder", "visualizeApp", "vulnerabilityManagementApp", "warning", "alert", "watchesApp", "wordWrap", "wordWrapDisabled", "workplaceSearchApp", "wrench", "tokenAlias", "tokenAnnotation", "tokenArray", "tokenBinary", "tokenBoolean", "tokenClass", "tokenCompletionSuggester", "tokenConstant", "tokenDate", "tokenDenseVector", "tokenElement", "tokenEnum", "tokenEnumMember", "tokenEvent", "tokenException", "tokenField", "tokenFile", "tokenFlattened", "tokenFunction", "tokenGeo", "tokenHistogram", "tokenInterface", "tokenIP", "tokenJoin", "tokenKey", "tokenKeyword", "tokenMethod", "tokenMetricCounter", "tokenMetricGauge", "tokenModule", "tokenNamespace", "tokenNested", "tokenNull", "tokenNumber", "tokenObject", "tokenOperator", "tokenPackage", "tokenParameter", "tokenPercolator", "tokenProperty", "tokenRange", "tokenRankFeature", "tokenRankFeatures", "tokenRepo", "tokenSearchType", "tokenShape", "tokenString", "tokenStruct", "tokenSymbol", "tokenTag", "tokenText", "tokenTokenCount", "tokenVariable"]).isRequired, _propTypes.default.string.isRequired, _propTypes.default.elementType.isRequired]).isRequired]).isRequired,
51
+ icon: _propTypes.default.oneOfType([_propTypes.default.node.isRequired, _propTypes.default.oneOfType([_propTypes.default.oneOf(["accessibility", "addDataApp", "advancedSettingsApp", "agentApp", "aggregate", "analyzeEvent", "annotation", "apmApp", "apmTrace", "appSearchApp", "apps", "arrowDown", "arrowLeft", "arrowRight", "arrowUp", "arrowStart", "arrowEnd", "article", "asterisk", "at", "auditbeatApp", "beaker", "bell", "bellSlash", "beta", "bolt", "boxesHorizontal", "boxesVertical", "branch", "branchUser", "broom", "brush", "bug", "bullseye", "calendar", "canvasApp", "casesApp", "check", "checkInCircleFilled", "cheer", "classificationJob", "clock", "cloudDrizzle", "cloudStormy", "cloudSunny", "cluster", "codeApp", "color", "compute", "console", "consoleApp", "container", "continuityAbove", "continuityAboveBelow", "continuityBelow", "continuityWithin", "controlsHorizontal", "controlsVertical", "copy", "copyClipboard", "createAdvancedJob", "createMultiMetricJob", "createPopulationJob", "createSingleMetricJob", "cross", "crossClusterReplicationApp", "crosshairs", "currency", "cut", "dashboardApp", "dataVisualizer", "database", "desktop", "devToolsApp", "discoverApp", "discuss", "document", "documentEdit", "documentation", "documents", "dot", "dotInCircle", "doubleArrowLeft", "doubleArrowRight", "download", "editorAlignCenter", "editorAlignLeft", "editorAlignRight", "editorBold", "editorChecklist", "editorCodeBlock", "editorComment", "editorDistributeHorizontal", "editorDistributeVertical", "editorHeading", "editorItalic", "editorItemAlignBottom", "editorItemAlignCenter", "editorItemAlignLeft", "editorItemAlignMiddle", "editorItemAlignRight", "editorItemAlignTop", "editorLink", "editorOrderedList", "editorPositionBottomLeft", "editorPositionBottomRight", "editorPositionTopLeft", "editorPositionTopRight", "editorRedo", "editorStrike", "editorTable", "editorUnderline", "editorUndo", "editorUnorderedList", "email", "empty", "emsApp", "eql", "eraser", "error", "exit", "expand", "expandMini", "exportAction", "eye", "eyeClosed", "faceHappy", "faceNeutral", "faceSad", "filebeatApp", "filter", "filterExclude", "filterIgnore", "filterInclude", "filterInCircle", "flag", "fleetApp", "fold", "folderCheck", "folderClosed", "folderExclamation", "folderOpen", "frameNext", "framePrevious", "fullScreen", "fullScreenExit", "function", "gear", "gisApp", "glasses", "globe", "grab", "grabHorizontal", "grabOmnidirectional", "gradient", "graphApp", "grid", "grokApp", "heart", "heartbeatApp", "heatmap", "help", "home", "iInCircle", "image", "importAction", "indexClose", "indexEdit", "indexFlush", "indexManagementApp", "indexMapping", "indexOpen", "indexPatternApp", "indexRollupApp", "indexRuntime", "indexSettings", "indexTemporary", "infinity", "inputOutput", "inspect", "invert", "ip", "key", "keyboard", "kqlField", "kqlFunction", "kqlOperand", "kqlSelector", "kqlValue", "kubernetesNode", "kubernetesPod", "launch", "layers", "lensApp", "lettering", "lineDashed", "lineDotted", "lineSolid", "link", "list", "listAdd", "lock", "lockOpen", "logoAWS", "logoAWSMono", "logoAerospike", "logoApache", "logoAppSearch", "logoAzure", "logoAzureMono", "logoBeats", "logoBusinessAnalytics", "logoCeph", "logoCloud", "logoCloudEnterprise", "logoCode", "logoCodesandbox", "logoCouchbase", "logoDocker", "logoDropwizard", "logoElastic", "logoElasticStack", "logoElasticsearch", "logoEnterpriseSearch", "logoEtcd", "logoGCP", "logoGCPMono", "logoGithub", "logoGmail", "logoGolang", "logoGoogleG", "logoHAproxy", "logoIBM", "logoIBMMono", "logoKafka", "logoKibana", "logoKubernetes", "logoLogging", "logoLogstash", "logoMaps", "logoMemcached", "logoMetrics", "logoMongodb", "logoMySQL", "logoNginx", "logoObservability", "logoOsquery", "logoPhp", "logoPostgres", "logoPrometheus", "logoRabbitmq", "logoRedis", "logoSecurity", "logoSiteSearch", "logoSketch", "logoSlack", "logoUptime", "logoVulnerabilityManagement", "logoWebhook", "logoWindows", "logoWorkplaceSearch", "logsApp", "logstashFilter", "logstashIf", "logstashInput", "logstashOutput", "logstashQueue", "machineLearningApp", "magnet", "magnifyWithExclamation", "magnifyWithMinus", "magnifyWithPlus", "managementApp", "mapMarker", "memory", "menu", "menuDown", "menuLeft", "menuRight", "menuUp", "merge", "metricbeatApp", "metricsApp", "minimize", "minus", "minusInCircle", "minusInCircleFilled", "mobile", "monitoringApp", "moon", "namespace", "nested", "node", "notebookApp", "number", "offline", "online", "outlierDetectionJob", "package", "packetbeatApp", "pageSelect", "pagesSelect", "palette", "paperClip", "partial", "pause", "payment", "pencil", "percent", "pin", "pinFilled", "pipelineApp", "pivot", "play", "playFilled", "plus", "plusInCircle", "plusInCircleFilled", "popout", "push", "questionInCircle", "quote", "recentlyViewedApp", "refresh", "regressionJob", "reporter", "reportingApp", "returnKey", "save", "savedObjectsApp", "scale", "search", "searchProfilerApp", "securityAnalyticsApp", "securityApp", "securitySignal", "securitySignalDetected", "securitySignalResolved", "sessionViewer", "shard", "share", "snowflake", "sortAscending", "sortDescending", "sortDown", "sortLeft", "sortRight", "sortUp", "sortable", "spaces", "spacesApp", "sparkles", "sqlApp", "starEmpty", "starEmptySpace", "starFilled", "starFilledSpace", "starMinusEmpty", "starMinusFilled", "starPlusEmpty", "starPlusFilled", "stats", "stop", "stopFilled", "stopSlash", "storage", "string", "submodule", "sun", "swatchInput", "symlink", "tableDensityCompact", "tableDensityExpanded", "tableDensityNormal", "tableOfContents", "tag", "tear", "temperature", "timeline", "timelineWithArrow", "timelionApp", "timeRefresh", "timeslider", "training", "transitionLeftIn", "transitionLeftOut", "transitionTopIn", "transitionTopOut", "trash", "unfold", "unlink", "upgradeAssistantApp", "uptimeApp", "user", "userAvatar", "users", "usersRolesApp", "vector", "videoPlayer", "visArea", "visAreaStacked", "visBarHorizontal", "visBarHorizontalStacked", "visBarVertical", "visBarVerticalStacked", "visGauge", "visGoal", "visLine", "visMapCoordinate", "visMapRegion", "visMetric", "visPie", "visTable", "visTagCloud", "visText", "visTimelion", "visVega", "visVisualBuilder", "visualizeApp", "vulnerabilityManagementApp", "warning", "alert", "watchesApp", "wordWrap", "wordWrapDisabled", "workplaceSearchApp", "wrench", "tokenAlias", "tokenAnnotation", "tokenArray", "tokenBinary", "tokenBoolean", "tokenClass", "tokenCompletionSuggester", "tokenConstant", "tokenDate", "tokenDenseVector", "tokenElement", "tokenEnum", "tokenEnumMember", "tokenEvent", "tokenException", "tokenField", "tokenFile", "tokenFlattened", "tokenFunction", "tokenGeo", "tokenHistogram", "tokenInterface", "tokenIP", "tokenJoin", "tokenKey", "tokenKeyword", "tokenMethod", "tokenMetricCounter", "tokenMetricGauge", "tokenModule", "tokenNamespace", "tokenNested", "tokenNull", "tokenNumber", "tokenObject", "tokenOperator", "tokenPackage", "tokenParameter", "tokenPercolator", "tokenProperty", "tokenRange", "tokenRankFeature", "tokenRankFeatures", "tokenRepo", "tokenSearchType", "tokenShape", "tokenString", "tokenStruct", "tokenSymbol", "tokenTag", "tokenText", "tokenTokenCount", "tokenVariable"]).isRequired, _propTypes.default.string.isRequired, _propTypes.default.elementType.isRequired]).isRequired]).isRequired,
52
52
  verticalAlign: _propTypes.default.any,
53
53
  /**
54
54
  * Specify an `aria-label` for the icon when passed as an `IconType`.