@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.
- package/dist/eui_charts_theme.js.map +1 -1
- package/dist/eui_theme_dark.css +9 -61
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +9 -61
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/accordion/accordion.js +50 -198
- package/es/components/accordion/accordion.styles.js +11 -83
- package/es/components/accordion/accordion_children/accordion_children.js +101 -0
- package/es/components/accordion/accordion_children/accordion_children.styles.js +39 -0
- package/es/components/accordion/accordion_children/accordion_children_loading.js +31 -0
- package/es/components/accordion/accordion_children/index.js +9 -0
- package/es/components/accordion/accordion_trigger/accordion_arrow.js +41 -0
- package/es/components/accordion/accordion_trigger/accordion_arrow.styles.js +46 -0
- package/es/components/accordion/accordion_trigger/accordion_button.js +51 -0
- package/es/components/accordion/accordion_trigger/accordion_button.styles.js +26 -0
- package/es/components/accordion/accordion_trigger/accordion_trigger.js +87 -0
- package/es/components/accordion/accordion_trigger/index.js +9 -0
- package/es/components/avatar/avatar.js +1 -1
- package/es/components/badge/badge.js +1 -1
- package/es/components/badge/beta_badge/beta_badge.js +1 -1
- package/es/components/basic_table/basic_table.js +1 -1
- package/es/components/basic_table/collapsed_item_actions.js +1 -1
- package/es/components/basic_table/in_memory_table.js +1 -1
- package/es/components/button/button_display/_button_display.js +1 -1
- package/es/components/button/button_display/_button_display_content.js +1 -1
- package/es/components/button/button_empty/button_empty.js +1 -1
- package/es/components/button/button_group/button_group.js +1 -1
- package/es/components/button/button_group/button_group_button.js +1 -1
- package/es/components/button/button_icon/button_icon.js +1 -1
- package/es/components/call_out/call_out.js +1 -1
- package/es/components/card/card.js +1 -1
- package/es/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +11 -3
- package/es/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.styles.js +1 -1
- package/es/components/collapsible_nav_beta/collapsible_nav_beta.js +2 -25
- package/es/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +2 -2
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_item.js +2 -2
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_popover.js +3 -3
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.js +2 -2
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.styles.js +1 -1
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +3 -3
- package/es/components/comment_list/comment.js +2 -2
- package/es/components/comment_list/comment_event.js +1 -1
- package/es/components/comment_list/comment_list.js +2 -2
- package/es/components/comment_list/comment_timeline.js +1 -1
- package/es/components/datagrid/body/data_grid_body.js +13 -13
- package/es/components/datagrid/body/data_grid_body_custom.js +13 -13
- package/es/components/datagrid/body/data_grid_body_virtualized.js +13 -13
- package/es/components/datagrid/body/data_grid_cell.js +24 -24
- package/es/components/datagrid/body/header/data_grid_header_cell.js +12 -12
- package/es/components/datagrid/body/header/data_grid_header_row.js +13 -13
- package/es/components/datagrid/controls/column_sorting_draggable.js +1 -1
- package/es/components/datagrid/data_grid.js +13 -13
- package/es/components/datagrid/utils/in_memory.js +12 -12
- package/es/components/date_picker/date_picker.js +2 -2
- package/es/components/date_picker/date_picker_range.js +1 -1
- package/es/components/empty_prompt/empty_prompt.js +1 -1
- package/es/components/facet/facet_button.js +1 -1
- package/es/components/flyout/flyout.styles.js +1 -1
- package/es/components/form/field_number/field_number.js +1 -1
- package/es/components/form/field_text/field_text.js +2 -2
- package/es/components/form/form_control_layout/form_control_layout.js +2 -2
- package/es/components/form/form_control_layout/form_control_layout_custom_icon.js +1 -1
- package/es/components/form/form_control_layout/form_control_layout_icons.js +2 -2
- package/es/components/header/header.js +120 -25
- package/es/components/header/header.styles.js +1 -1
- package/es/components/header/header_links/header_link.js +1 -1
- package/es/components/header/header_links/header_links.js +1 -1
- package/es/components/header/header_logo/header_logo.js +1 -1
- package/es/components/header/header_section/header_section_item_button.js +1 -1
- package/es/components/icon/assets/grabOmnidirectional.js +33 -0
- package/es/components/icon/assets/transitionLeftIn.js +36 -0
- package/es/components/icon/assets/transitionLeftOut.js +36 -0
- package/es/components/icon/assets/transitionTopIn.js +36 -0
- package/es/components/icon/assets/transitionTopOut.js +36 -0
- package/es/components/icon/icon.js +1 -1
- package/es/components/icon/icon_map.js +5 -0
- package/es/components/index.js +1 -0
- package/es/components/inline_edit/inline_edit_form.js +49 -13
- package/es/components/inline_edit/inline_edit_text.js +22 -23
- package/es/components/inline_edit/inline_edit_title.js +22 -23
- package/es/components/key_pad_menu/key_pad_menu_item.js +1 -1
- package/es/components/list_group/list_group.js +2 -2
- package/es/components/list_group/list_group_item.js +3 -3
- package/es/components/list_group/list_group_item_extra_action.js +1 -1
- package/es/components/list_group/pinnable_list_group/pinnable_list_group.js +4 -4
- package/es/components/loading/loading_logo.js +1 -1
- package/es/components/markdown_editor/markdown_editor.js +1 -1
- package/es/components/markdown_editor/markdown_editor_drop_zone.js +1 -1
- package/es/components/markdown_editor/markdown_editor_footer.js +1 -1
- package/es/components/markdown_editor/markdown_editor_toolbar.js +1 -1
- package/es/components/notification/notification_event.js +2 -2
- package/es/components/notification/notification_event_meta.js +1 -1
- package/es/components/overlay_mask/overlay_mask.styles.js +1 -1
- package/es/components/page/page_header/page_header_content.js +1 -1
- package/es/components/page/page_sidebar/page_sidebar.js +2 -4
- package/es/components/page_template/page_template.js +4 -31
- package/es/components/pagination/pagination_button.js +1 -1
- package/es/components/panel/split_panel/split_panel.js +9 -7
- package/es/components/panel/split_panel/split_panel.styles.js +40 -0
- package/es/components/selectable/selectable_list/selectable_list.js +1 -1
- package/es/components/selectable/selectable_list/selectable_list_item.js +1 -1
- package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +1 -1
- package/es/components/suggest/suggest.js +1 -1
- package/es/components/suggest/suggest_item.js +1 -1
- package/es/components/table/table_header_button.js +1 -1
- package/es/components/text_truncate/index.js +10 -0
- package/es/components/text_truncate/text_truncate.js +232 -0
- package/es/components/text_truncate/text_truncate.styles.js +49 -0
- package/es/components/text_truncate/utils.js +348 -0
- package/es/components/timeline/timeline_item_icon.js +1 -1
- package/es/components/toast/global_toast_list.js +51 -3
- package/es/components/toast/global_toast_list.styles.js +3 -2
- package/es/components/toast/toast.js +1 -1
- package/es/components/tool_tip/icon_tip.js +1 -1
- package/es/services/theme/context.js +3 -1
- package/es/services/theme/hooks.js +19 -1
- package/es/services/theme/index.js +1 -1
- package/es/services/theme/provider.js +37 -8
- package/eui.d.ts +432 -53
- package/i18ntokens.json +64 -28
- package/lib/components/accordion/accordion.js +49 -197
- package/lib/components/accordion/accordion.styles.js +20 -96
- package/lib/components/accordion/accordion_children/accordion_children.js +111 -0
- package/lib/components/accordion/accordion_children/accordion_children.styles.js +45 -0
- package/lib/components/accordion/accordion_children/accordion_children_loading.js +38 -0
- package/lib/components/accordion/accordion_children/index.js +12 -0
- package/lib/components/accordion/accordion_trigger/accordion_arrow.js +48 -0
- package/lib/components/accordion/accordion_trigger/accordion_arrow.styles.js +51 -0
- package/lib/components/accordion/accordion_trigger/accordion_button.js +58 -0
- package/lib/components/accordion/accordion_trigger/accordion_button.styles.js +33 -0
- package/lib/components/accordion/accordion_trigger/accordion_trigger.js +93 -0
- package/lib/components/accordion/accordion_trigger/index.js +12 -0
- package/lib/components/avatar/avatar.js +1 -1
- package/lib/components/badge/badge.js +1 -1
- package/lib/components/badge/beta_badge/beta_badge.js +1 -1
- package/lib/components/basic_table/basic_table.js +1 -1
- package/lib/components/basic_table/collapsed_item_actions.js +1 -1
- package/lib/components/basic_table/in_memory_table.js +1 -1
- package/lib/components/button/button_display/_button_display.js +1 -1
- package/lib/components/button/button_display/_button_display_content.js +1 -1
- package/lib/components/button/button_empty/button_empty.js +1 -1
- package/lib/components/button/button_group/button_group.js +1 -1
- package/lib/components/button/button_group/button_group_button.js +1 -1
- package/lib/components/button/button_icon/button_icon.js +1 -1
- package/lib/components/call_out/call_out.js +1 -1
- package/lib/components/card/card.js +1 -1
- package/lib/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +11 -3
- package/lib/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.styles.js +1 -1
- package/lib/components/collapsible_nav_beta/collapsible_nav_beta.js +2 -25
- package/lib/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +2 -2
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_item.js +2 -2
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_popover.js +3 -3
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.js +2 -2
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.styles.js +1 -1
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +3 -3
- package/lib/components/comment_list/comment.js +2 -2
- package/lib/components/comment_list/comment_event.js +1 -1
- package/lib/components/comment_list/comment_list.js +2 -2
- package/lib/components/comment_list/comment_timeline.js +1 -1
- package/lib/components/datagrid/body/data_grid_body.js +13 -13
- package/lib/components/datagrid/body/data_grid_body_custom.js +13 -13
- package/lib/components/datagrid/body/data_grid_body_virtualized.js +13 -13
- package/lib/components/datagrid/body/data_grid_cell.js +24 -24
- package/lib/components/datagrid/body/header/data_grid_header_cell.js +12 -12
- package/lib/components/datagrid/body/header/data_grid_header_row.js +13 -13
- package/lib/components/datagrid/controls/column_sorting_draggable.js +1 -1
- package/lib/components/datagrid/data_grid.js +13 -13
- package/lib/components/datagrid/utils/in_memory.js +12 -12
- package/lib/components/date_picker/date_picker.js +2 -2
- package/lib/components/date_picker/date_picker_range.js +1 -1
- package/lib/components/empty_prompt/empty_prompt.js +1 -1
- package/lib/components/facet/facet_button.js +1 -1
- package/lib/components/flyout/flyout.styles.js +1 -1
- package/lib/components/form/field_number/field_number.js +1 -1
- package/lib/components/form/field_text/field_text.js +2 -2
- package/lib/components/form/form_control_layout/form_control_layout.js +2 -2
- package/lib/components/form/form_control_layout/form_control_layout_custom_icon.js +1 -1
- package/lib/components/form/form_control_layout/form_control_layout_icons.js +2 -2
- package/lib/components/header/header.js +120 -23
- package/lib/components/header/header.styles.js +1 -1
- package/lib/components/header/header_links/header_link.js +1 -1
- package/lib/components/header/header_links/header_links.js +1 -1
- package/lib/components/header/header_logo/header_logo.js +1 -1
- package/lib/components/header/header_section/header_section_item_button.js +1 -1
- package/lib/components/icon/assets/grabOmnidirectional.js +41 -0
- package/lib/components/icon/assets/transitionLeftIn.js +44 -0
- package/lib/components/icon/assets/transitionLeftOut.js +44 -0
- package/lib/components/icon/assets/transitionTopIn.js +44 -0
- package/lib/components/icon/assets/transitionTopOut.js +44 -0
- package/lib/components/icon/icon.js +1 -1
- package/lib/components/icon/icon_map.js +5 -0
- package/lib/components/icon/svgs/grabOmnidirectional.svg +3 -0
- package/lib/components/icon/svgs/transitionLeftIn.svg +4 -0
- package/lib/components/icon/svgs/transitionLeftOut.svg +4 -0
- package/lib/components/icon/svgs/transitionTopIn.svg +4 -0
- package/lib/components/icon/svgs/transitionTopOut.svg +4 -0
- package/lib/components/index.js +11 -0
- package/lib/components/inline_edit/inline_edit_form.js +58 -20
- package/lib/components/inline_edit/inline_edit_text.js +22 -23
- package/lib/components/inline_edit/inline_edit_title.js +22 -23
- package/lib/components/key_pad_menu/key_pad_menu_item.js +1 -1
- package/lib/components/list_group/list_group.js +2 -2
- package/lib/components/list_group/list_group_item.js +3 -3
- package/lib/components/list_group/list_group_item_extra_action.js +1 -1
- package/lib/components/list_group/pinnable_list_group/pinnable_list_group.js +4 -4
- package/lib/components/loading/loading_logo.js +1 -1
- package/lib/components/markdown_editor/markdown_editor.js +1 -1
- package/lib/components/markdown_editor/markdown_editor_drop_zone.js +1 -1
- package/lib/components/markdown_editor/markdown_editor_footer.js +1 -1
- package/lib/components/markdown_editor/markdown_editor_toolbar.js +1 -1
- package/lib/components/notification/notification_event.js +2 -2
- package/lib/components/notification/notification_event_meta.js +1 -1
- package/lib/components/overlay_mask/overlay_mask.styles.js +1 -1
- package/lib/components/page/page_header/page_header_content.js +1 -1
- package/lib/components/page/page_sidebar/page_sidebar.js +2 -4
- package/lib/components/page_template/page_template.js +2 -29
- package/lib/components/panel/split_panel/split_panel.js +9 -7
- package/lib/components/panel/split_panel/split_panel.styles.js +46 -0
- package/lib/components/selectable/selectable_list/selectable_list.js +1 -1
- package/lib/components/selectable/selectable_list/selectable_list_item.js +1 -1
- package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +1 -1
- package/lib/components/suggest/suggest.js +1 -1
- package/lib/components/suggest/suggest_item.js +1 -1
- package/lib/components/table/table_header_button.js +1 -1
- package/lib/components/text_truncate/index.js +25 -0
- package/lib/components/text_truncate/text_truncate.js +242 -0
- package/lib/components/text_truncate/text_truncate.styles.js +54 -0
- package/lib/components/text_truncate/utils.js +352 -0
- package/lib/components/timeline/timeline_item_icon.js +1 -1
- package/lib/components/toast/global_toast_list.js +53 -4
- package/lib/components/toast/global_toast_list.styles.js +3 -2
- package/lib/components/toast/toast.js +1 -1
- package/lib/components/tool_tip/icon_tip.js +1 -1
- package/lib/services/theme/context.js +3 -1
- package/lib/services/theme/hooks.js +21 -2
- package/lib/services/theme/index.js +6 -0
- package/lib/services/theme/provider.js +62 -35
- package/optimize/es/components/accordion/accordion.js +40 -196
- package/optimize/es/components/accordion/accordion.styles.js +11 -83
- package/optimize/es/components/accordion/accordion_children/accordion_children.js +91 -0
- package/optimize/es/components/accordion/accordion_children/accordion_children.styles.js +39 -0
- package/optimize/es/components/accordion/accordion_children/accordion_children_loading.js +31 -0
- package/optimize/es/components/accordion/accordion_children/index.js +9 -0
- package/optimize/es/components/accordion/accordion_trigger/accordion_arrow.js +36 -0
- package/optimize/es/components/accordion/accordion_trigger/accordion_arrow.styles.js +46 -0
- package/optimize/es/components/accordion/accordion_trigger/accordion_button.js +45 -0
- package/optimize/es/components/accordion/accordion_trigger/accordion_button.styles.js +26 -0
- package/optimize/es/components/accordion/accordion_trigger/accordion_trigger.js +80 -0
- package/optimize/es/components/accordion/accordion_trigger/index.js +9 -0
- package/optimize/es/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.styles.js +1 -1
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_beta.js +2 -25
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.styles.js +1 -1
- package/optimize/es/components/flyout/flyout.styles.js +1 -1
- package/optimize/es/components/header/header.js +75 -25
- package/optimize/es/components/header/header.styles.js +1 -1
- package/optimize/es/components/icon/assets/grabOmnidirectional.js +32 -0
- package/optimize/es/components/icon/assets/transitionLeftIn.js +35 -0
- package/optimize/es/components/icon/assets/transitionLeftOut.js +35 -0
- package/optimize/es/components/icon/assets/transitionTopIn.js +35 -0
- package/optimize/es/components/icon/assets/transitionTopOut.js +35 -0
- package/optimize/es/components/icon/icon_map.js +5 -0
- package/optimize/es/components/index.js +1 -0
- package/optimize/es/components/inline_edit/inline_edit_form.js +32 -12
- package/optimize/es/components/inline_edit/inline_edit_text.js +6 -22
- package/optimize/es/components/inline_edit/inline_edit_title.js +6 -22
- package/optimize/es/components/list_group/list_group_item.js +1 -1
- package/optimize/es/components/overlay_mask/overlay_mask.styles.js +1 -1
- package/optimize/es/components/page/page_sidebar/page_sidebar.js +2 -4
- package/optimize/es/components/page_template/page_template.js +4 -26
- package/optimize/es/components/panel/split_panel/split_panel.js +9 -7
- package/optimize/es/components/panel/split_panel/split_panel.styles.js +40 -0
- package/optimize/es/components/text_truncate/index.js +10 -0
- package/optimize/es/components/text_truncate/text_truncate.js +148 -0
- package/optimize/es/components/text_truncate/text_truncate.styles.js +49 -0
- package/optimize/es/components/text_truncate/utils.js +337 -0
- package/optimize/es/components/toast/global_toast_list.js +39 -2
- package/optimize/es/components/toast/global_toast_list.styles.js +3 -2
- package/optimize/es/services/theme/context.js +3 -1
- package/optimize/es/services/theme/hooks.js +19 -1
- package/optimize/es/services/theme/index.js +1 -1
- package/optimize/es/services/theme/provider.js +37 -8
- package/optimize/lib/components/accordion/accordion.js +39 -195
- package/optimize/lib/components/accordion/accordion.styles.js +20 -96
- package/optimize/lib/components/accordion/accordion_children/accordion_children.js +101 -0
- package/optimize/lib/components/accordion/accordion_children/accordion_children.styles.js +45 -0
- package/optimize/lib/components/accordion/accordion_children/accordion_children_loading.js +38 -0
- package/optimize/lib/components/accordion/accordion_children/index.js +12 -0
- package/optimize/lib/components/accordion/accordion_trigger/accordion_arrow.js +43 -0
- package/optimize/lib/components/accordion/accordion_trigger/accordion_arrow.styles.js +51 -0
- package/optimize/lib/components/accordion/accordion_trigger/accordion_button.js +52 -0
- package/optimize/lib/components/accordion/accordion_trigger/accordion_button.styles.js +33 -0
- package/optimize/lib/components/accordion/accordion_trigger/accordion_trigger.js +86 -0
- package/optimize/lib/components/accordion/accordion_trigger/index.js +12 -0
- package/optimize/lib/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.styles.js +1 -1
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_beta.js +2 -25
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.styles.js +1 -1
- package/optimize/lib/components/flyout/flyout.styles.js +1 -1
- package/optimize/lib/components/header/header.js +77 -24
- package/optimize/lib/components/header/header.styles.js +1 -1
- package/optimize/lib/components/icon/assets/grabOmnidirectional.js +41 -0
- package/optimize/lib/components/icon/assets/transitionLeftIn.js +44 -0
- package/optimize/lib/components/icon/assets/transitionLeftOut.js +44 -0
- package/optimize/lib/components/icon/assets/transitionTopIn.js +44 -0
- package/optimize/lib/components/icon/assets/transitionTopOut.js +44 -0
- package/optimize/lib/components/icon/icon_map.js +5 -0
- package/optimize/lib/components/icon/svgs/grabOmnidirectional.svg +3 -0
- package/optimize/lib/components/icon/svgs/transitionLeftIn.svg +4 -0
- package/optimize/lib/components/icon/svgs/transitionLeftOut.svg +4 -0
- package/optimize/lib/components/icon/svgs/transitionTopIn.svg +4 -0
- package/optimize/lib/components/icon/svgs/transitionTopOut.svg +4 -0
- package/optimize/lib/components/index.js +11 -0
- package/optimize/lib/components/inline_edit/inline_edit_form.js +33 -16
- package/optimize/lib/components/inline_edit/inline_edit_text.js +6 -22
- package/optimize/lib/components/inline_edit/inline_edit_title.js +6 -22
- package/optimize/lib/components/list_group/list_group_item.js +1 -1
- package/optimize/lib/components/overlay_mask/overlay_mask.styles.js +1 -1
- package/optimize/lib/components/page/page_sidebar/page_sidebar.js +2 -4
- package/optimize/lib/components/page_template/page_template.js +2 -24
- package/optimize/lib/components/panel/split_panel/split_panel.js +9 -7
- package/optimize/lib/components/panel/split_panel/split_panel.styles.js +46 -0
- package/optimize/lib/components/text_truncate/index.js +25 -0
- package/optimize/lib/components/text_truncate/text_truncate.js +158 -0
- package/optimize/lib/components/text_truncate/text_truncate.styles.js +54 -0
- package/optimize/lib/components/text_truncate/utils.js +342 -0
- package/optimize/lib/components/toast/global_toast_list.js +41 -3
- package/optimize/lib/components/toast/global_toast_list.styles.js +3 -2
- package/optimize/lib/services/theme/context.js +3 -1
- package/optimize/lib/services/theme/hooks.js +21 -2
- package/optimize/lib/services/theme/index.js +6 -0
- package/optimize/lib/services/theme/provider.js +62 -35
- package/package.json +3 -3
- package/src/components/datagrid/_data_grid.scss +13 -2
- package/src/components/index.scss +0 -2
- package/src/global_styling/mixins/_header.scss +2 -0
- package/test-env/components/accordion/accordion.js +49 -197
- package/test-env/components/accordion/accordion.styles.js +20 -96
- package/test-env/components/accordion/accordion_children/accordion_children.js +105 -0
- package/test-env/components/accordion/accordion_children/accordion_children.styles.js +45 -0
- package/test-env/components/accordion/accordion_children/accordion_children_loading.js +38 -0
- package/test-env/components/accordion/accordion_children/index.js +12 -0
- package/test-env/components/accordion/accordion_trigger/accordion_arrow.js +47 -0
- package/test-env/components/accordion/accordion_trigger/accordion_arrow.styles.js +51 -0
- package/test-env/components/accordion/accordion_trigger/accordion_button.js +52 -0
- package/test-env/components/accordion/accordion_trigger/accordion_button.styles.js +33 -0
- package/test-env/components/accordion/accordion_trigger/accordion_trigger.js +93 -0
- package/test-env/components/accordion/accordion_trigger/index.js +12 -0
- package/test-env/components/avatar/avatar.js +1 -1
- package/test-env/components/badge/badge.js +1 -1
- package/test-env/components/badge/beta_badge/beta_badge.js +1 -1
- package/test-env/components/basic_table/basic_table.js +1 -1
- package/test-env/components/basic_table/collapsed_item_actions.js +1 -1
- package/test-env/components/basic_table/in_memory_table.js +1 -1
- package/test-env/components/button/button_display/_button_display.js +1 -1
- package/test-env/components/button/button_display/_button_display_content.js +1 -1
- package/test-env/components/button/button_empty/button_empty.js +1 -1
- package/test-env/components/button/button_group/button_group.js +1 -1
- package/test-env/components/button/button_group/button_group_button.js +1 -1
- package/test-env/components/button/button_icon/button_icon.js +1 -1
- package/test-env/components/call_out/call_out.js +1 -1
- package/test-env/components/card/card.js +1 -1
- package/test-env/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +11 -3
- package/test-env/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.styles.js +1 -1
- package/test-env/components/collapsible_nav_beta/collapsible_nav_beta.js +2 -25
- package/test-env/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +2 -2
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_item.js +2 -2
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_popover.js +3 -3
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.js +2 -2
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.styles.js +1 -1
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +3 -3
- package/test-env/components/comment_list/comment.js +2 -2
- package/test-env/components/comment_list/comment_event.js +1 -1
- package/test-env/components/comment_list/comment_list.js +2 -2
- package/test-env/components/comment_list/comment_timeline.js +1 -1
- package/test-env/components/datagrid/body/data_grid_body.js +13 -13
- package/test-env/components/datagrid/body/data_grid_body_custom.js +13 -13
- package/test-env/components/datagrid/body/data_grid_body_virtualized.js +13 -13
- package/test-env/components/datagrid/body/data_grid_cell.js +24 -24
- package/test-env/components/datagrid/body/header/data_grid_header_cell.js +12 -12
- package/test-env/components/datagrid/body/header/data_grid_header_row.js +13 -13
- package/test-env/components/datagrid/controls/column_sorting_draggable.js +1 -1
- package/test-env/components/datagrid/data_grid.js +13 -13
- package/test-env/components/datagrid/utils/in_memory.js +12 -12
- package/test-env/components/date_picker/date_picker.js +2 -2
- package/test-env/components/date_picker/date_picker_range.js +1 -1
- package/test-env/components/empty_prompt/empty_prompt.js +1 -1
- package/test-env/components/facet/facet_button.js +1 -1
- package/test-env/components/flyout/flyout.styles.js +1 -1
- package/test-env/components/form/field_number/field_number.js +1 -1
- package/test-env/components/form/field_text/field_text.js +2 -2
- package/test-env/components/form/form_control_layout/form_control_layout.js +2 -2
- package/test-env/components/form/form_control_layout/form_control_layout_custom_icon.js +1 -1
- package/test-env/components/form/form_control_layout/form_control_layout_icons.js +2 -2
- package/test-env/components/header/header.js +113 -23
- package/test-env/components/header/header.styles.js +1 -1
- package/test-env/components/header/header_links/header_link.js +1 -1
- package/test-env/components/header/header_links/header_links.js +1 -1
- package/test-env/components/header/header_logo/header_logo.js +1 -1
- package/test-env/components/header/header_section/header_section_item_button.js +1 -1
- package/test-env/components/icon/assets/grabOmnidirectional.js +41 -0
- package/test-env/components/icon/assets/transitionLeftIn.js +44 -0
- package/test-env/components/icon/assets/transitionLeftOut.js +44 -0
- package/test-env/components/icon/assets/transitionTopIn.js +44 -0
- package/test-env/components/icon/assets/transitionTopOut.js +44 -0
- package/test-env/components/icon/icon_map.js +5 -0
- package/test-env/components/index.js +11 -0
- package/test-env/components/inline_edit/inline_edit_form.js +49 -17
- package/test-env/components/inline_edit/inline_edit_text.js +22 -23
- package/test-env/components/inline_edit/inline_edit_title.js +22 -23
- package/test-env/components/key_pad_menu/key_pad_menu_item.js +1 -1
- package/test-env/components/list_group/list_group.js +2 -2
- package/test-env/components/list_group/list_group_item.js +3 -3
- package/test-env/components/list_group/list_group_item_extra_action.js +1 -1
- package/test-env/components/list_group/pinnable_list_group/pinnable_list_group.js +4 -4
- package/test-env/components/loading/loading_logo.js +1 -1
- package/test-env/components/markdown_editor/markdown_editor.js +1 -1
- package/test-env/components/markdown_editor/markdown_editor_drop_zone.js +1 -1
- package/test-env/components/markdown_editor/markdown_editor_footer.js +1 -1
- package/test-env/components/markdown_editor/markdown_editor_toolbar.js +1 -1
- package/test-env/components/notification/notification_event.js +2 -2
- package/test-env/components/notification/notification_event_meta.js +1 -1
- package/test-env/components/overlay_mask/overlay_mask.styles.js +1 -1
- package/test-env/components/page/page_header/page_header_content.js +1 -1
- package/test-env/components/page/page_sidebar/page_sidebar.js +2 -4
- package/test-env/components/page_template/page_template.js +2 -24
- package/test-env/components/panel/split_panel/split_panel.js +9 -7
- package/test-env/components/panel/split_panel/split_panel.styles.js +46 -0
- package/test-env/components/selectable/selectable_list/selectable_list.js +1 -1
- package/test-env/components/selectable/selectable_list/selectable_list_item.js +1 -1
- package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +1 -1
- package/test-env/components/suggest/suggest.js +1 -1
- package/test-env/components/suggest/suggest_item.js +1 -1
- package/test-env/components/table/table_header_button.js +1 -1
- package/test-env/components/text_truncate/index.js +25 -0
- package/test-env/components/text_truncate/text_truncate.js +236 -0
- package/test-env/components/text_truncate/text_truncate.styles.js +54 -0
- package/test-env/components/text_truncate/utils.js +342 -0
- package/test-env/components/timeline/timeline_item_icon.js +1 -1
- package/test-env/components/toast/global_toast_list.js +53 -4
- package/test-env/components/toast/global_toast_list.styles.js +3 -2
- package/test-env/components/toast/toast.js +1 -1
- package/test-env/components/tool_tip/icon_tip.js +1 -1
- package/test-env/services/theme/context.js +3 -1
- package/test-env/services/theme/hooks.js +21 -2
- package/test-env/services/theme/index.js +6 -0
- package/test-env/services/theme/provider.js +62 -35
- package/src/components/accordion/_accordion_form.scss +0 -40
- package/src/components/accordion/_index.scss +0 -1
- package/src/components/panel/_index.scss +0 -1
- package/src/components/panel/_panel.scss +0 -9
- package/src/components/panel/split_panel/_index.scss +0 -1
- package/src/components/panel/split_panel/_split_panel.scss +0 -21
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["width"],
|
|
5
|
+
_excluded2 = ["width", "children", "text", "truncation", "truncationOffset", "truncationPosition", "ellipsis", "containerRef", "measurementRenderAPI"],
|
|
6
|
+
_excluded3 = ["onResize"];
|
|
7
|
+
/*
|
|
8
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
9
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
10
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
11
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
12
|
+
* Side Public License, v 1.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import React, { useState, useMemo, useCallback } from 'react';
|
|
16
|
+
import { useCombinedRefs } from '../../services';
|
|
17
|
+
import { EuiResizeObserver } from '../observer/resize_observer';
|
|
18
|
+
import { TruncationUtilsWithDOM, TruncationUtilsWithCanvas } from './utils';
|
|
19
|
+
import { euiTextTruncateStyles } from './text_truncate.styles';
|
|
20
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
21
|
+
var TRUNCATION_TYPES = ['end', 'start', 'startEnd', 'middle'];
|
|
22
|
+
export var EuiTextTruncate = function EuiTextTruncate(_ref) {
|
|
23
|
+
var width = _ref.width,
|
|
24
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
25
|
+
return width != null ? ___EmotionJSX(EuiTextTruncateWithWidth, _extends({
|
|
26
|
+
width: width
|
|
27
|
+
}, props)) : ___EmotionJSX(EuiTextTruncateWithResizeObserver, props);
|
|
28
|
+
};
|
|
29
|
+
var EuiTextTruncateWithWidth = function EuiTextTruncateWithWidth(_ref2) {
|
|
30
|
+
var width = _ref2.width,
|
|
31
|
+
children = _ref2.children,
|
|
32
|
+
text = _ref2.text,
|
|
33
|
+
_ref2$truncation = _ref2.truncation,
|
|
34
|
+
_truncation = _ref2$truncation === void 0 ? 'end' : _ref2$truncation,
|
|
35
|
+
_ref2$truncationOffse = _ref2.truncationOffset,
|
|
36
|
+
_truncationOffset = _ref2$truncationOffse === void 0 ? 0 : _ref2$truncationOffse,
|
|
37
|
+
truncationPosition = _ref2.truncationPosition,
|
|
38
|
+
_ref2$ellipsis = _ref2.ellipsis,
|
|
39
|
+
ellipsis = _ref2$ellipsis === void 0 ? '…' : _ref2$ellipsis,
|
|
40
|
+
containerRef = _ref2.containerRef,
|
|
41
|
+
_ref2$measurementRend = _ref2.measurementRenderAPI,
|
|
42
|
+
measurementRenderAPI = _ref2$measurementRend === void 0 ? 'dom' : _ref2$measurementRend,
|
|
43
|
+
rest = _objectWithoutProperties(_ref2, _excluded2);
|
|
44
|
+
// Note: This needs to be a state and not a ref to trigger a rerender on mount
|
|
45
|
+
var _useState = useState(null),
|
|
46
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
47
|
+
containerEl = _useState2[0],
|
|
48
|
+
setContainerEl = _useState2[1];
|
|
49
|
+
var refs = useCombinedRefs([setContainerEl, containerRef]);
|
|
50
|
+
|
|
51
|
+
// Handle exceptions where we need to override the passed props
|
|
52
|
+
var _useMemo = useMemo(function () {
|
|
53
|
+
var truncation = _truncation;
|
|
54
|
+
var truncationOffset = 0;
|
|
55
|
+
if (_truncation === 'end' || _truncation === 'start') {
|
|
56
|
+
if (0 < _truncationOffset && _truncationOffset < text.length) {
|
|
57
|
+
truncationOffset = _truncationOffset;
|
|
58
|
+
}
|
|
59
|
+
} else if (_truncation === 'startEnd' && truncationPosition != null) {
|
|
60
|
+
if (truncationPosition <= 0) {
|
|
61
|
+
truncation = 'end';
|
|
62
|
+
} else if (truncationPosition >= text.length) {
|
|
63
|
+
truncation = 'start';
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
truncation: truncation,
|
|
68
|
+
truncationOffset: truncationOffset
|
|
69
|
+
};
|
|
70
|
+
}, [_truncation, _truncationOffset, truncationPosition, text.length]),
|
|
71
|
+
truncation = _useMemo.truncation,
|
|
72
|
+
truncationOffset = _useMemo.truncationOffset;
|
|
73
|
+
var truncatedText = useMemo(function () {
|
|
74
|
+
var truncatedText = '';
|
|
75
|
+
if (!containerEl || !width) return truncatedText;
|
|
76
|
+
var params = {
|
|
77
|
+
fullText: text,
|
|
78
|
+
ellipsis: ellipsis,
|
|
79
|
+
container: containerEl,
|
|
80
|
+
availableWidth: width
|
|
81
|
+
};
|
|
82
|
+
var utils = measurementRenderAPI === 'canvas' ? new TruncationUtilsWithCanvas(params) : new TruncationUtilsWithDOM(params);
|
|
83
|
+
if (utils.checkIfTruncationIsNeeded() === false) {
|
|
84
|
+
truncatedText = text;
|
|
85
|
+
} else if (utils.checkSufficientEllipsisWidth(truncation) === false) {
|
|
86
|
+
truncatedText = '';
|
|
87
|
+
} else {
|
|
88
|
+
switch (truncation) {
|
|
89
|
+
case 'end':
|
|
90
|
+
truncatedText = utils.truncateEnd(truncationOffset);
|
|
91
|
+
break;
|
|
92
|
+
case 'start':
|
|
93
|
+
truncatedText = utils.truncateStart(truncationOffset);
|
|
94
|
+
break;
|
|
95
|
+
case 'startEnd':
|
|
96
|
+
if (truncationPosition == null) {
|
|
97
|
+
truncatedText = utils.truncateStartEndAtMiddle();
|
|
98
|
+
} else {
|
|
99
|
+
truncatedText = utils.truncateStartEndAtPosition(truncationPosition);
|
|
100
|
+
}
|
|
101
|
+
break;
|
|
102
|
+
case 'middle':
|
|
103
|
+
truncatedText = utils.truncateMiddle();
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (measurementRenderAPI === 'dom') {
|
|
108
|
+
utils.cleanup();
|
|
109
|
+
}
|
|
110
|
+
return truncatedText;
|
|
111
|
+
}, [width, text, truncation, truncationOffset, truncationPosition, ellipsis, containerEl, measurementRenderAPI]);
|
|
112
|
+
var isTruncating = truncatedText !== text;
|
|
113
|
+
return ___EmotionJSX("div", _extends({
|
|
114
|
+
css: euiTextTruncateStyles.euiTextTruncate,
|
|
115
|
+
ref: refs,
|
|
116
|
+
title: isTruncating ? text : undefined
|
|
117
|
+
}, rest), isTruncating ? ___EmotionJSX(React.Fragment, null, ___EmotionJSX("span", {
|
|
118
|
+
css: euiTextTruncateStyles.truncatedText,
|
|
119
|
+
"aria-hidden": true,
|
|
120
|
+
"data-test-subj": "truncatedText"
|
|
121
|
+
}, children ? children(truncatedText) : truncatedText), ___EmotionJSX("span", {
|
|
122
|
+
css: euiTextTruncateStyles.fullText,
|
|
123
|
+
"data-test-subj": "fullText"
|
|
124
|
+
}, text)) : ___EmotionJSX("span", {
|
|
125
|
+
"data-test-subj": "fullText"
|
|
126
|
+
}, text));
|
|
127
|
+
};
|
|
128
|
+
var EuiTextTruncateWithResizeObserver = function EuiTextTruncateWithResizeObserver(_ref3) {
|
|
129
|
+
var _onResize = _ref3.onResize,
|
|
130
|
+
props = _objectWithoutProperties(_ref3, _excluded3);
|
|
131
|
+
var _useState3 = useState(0),
|
|
132
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
133
|
+
width = _useState4[0],
|
|
134
|
+
setWidth = _useState4[1];
|
|
135
|
+
var onResize = useCallback(function (_ref4) {
|
|
136
|
+
var width = _ref4.width;
|
|
137
|
+
setWidth(width);
|
|
138
|
+
_onResize === null || _onResize === void 0 ? void 0 : _onResize(width);
|
|
139
|
+
}, [_onResize]);
|
|
140
|
+
return ___EmotionJSX(EuiResizeObserver, {
|
|
141
|
+
onResize: onResize
|
|
142
|
+
}, function (ref) {
|
|
143
|
+
return ___EmotionJSX(EuiTextTruncateWithWidth, _extends({
|
|
144
|
+
width: width,
|
|
145
|
+
containerRef: ref
|
|
146
|
+
}, props));
|
|
147
|
+
});
|
|
148
|
+
};
|
|
@@ -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,337 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
7
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
8
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
9
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
10
|
+
var _excluded = ["container"],
|
|
11
|
+
_excluded2 = ["font", "container"];
|
|
12
|
+
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); }; }
|
|
13
|
+
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; } }
|
|
14
|
+
/*
|
|
15
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
16
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
17
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
18
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
19
|
+
* Side Public License, v 1.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* This internal shared/base class contains the actual logic for truncating text
|
|
23
|
+
* (as well as a few handy utilities for checking whether truncation is possible
|
|
24
|
+
* or even necessary).
|
|
25
|
+
*
|
|
26
|
+
* How the underlying mechanism works: the full text is rendered, and then
|
|
27
|
+
* characters are removed one by one until the width of the text fits within
|
|
28
|
+
* the specified available width.
|
|
29
|
+
*
|
|
30
|
+
* Side note: The exception to this is the `truncateStartEndAtPosition` method,
|
|
31
|
+
* which works by building up from an empty string / by adding characters
|
|
32
|
+
* instead of removing them.
|
|
33
|
+
*/
|
|
34
|
+
var _TruncationUtils = /*#__PURE__*/_createClass(function _TruncationUtils(_ref) {
|
|
35
|
+
var _this = this;
|
|
36
|
+
var fullText = _ref.fullText,
|
|
37
|
+
ellipsis = _ref.ellipsis,
|
|
38
|
+
availableWidth = _ref.availableWidth;
|
|
39
|
+
_classCallCheck(this, _TruncationUtils);
|
|
40
|
+
_defineProperty(this, "fullText", void 0);
|
|
41
|
+
_defineProperty(this, "ellipsis", void 0);
|
|
42
|
+
_defineProperty(this, "availableWidth", void 0);
|
|
43
|
+
/**
|
|
44
|
+
* Early return checks
|
|
45
|
+
*/
|
|
46
|
+
_defineProperty(this, "checkIfTruncationIsNeeded", function () {
|
|
47
|
+
_this.setTextToCheck(_this.fullText);
|
|
48
|
+
if (_this.availableWidth >= _this.textWidth) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
_defineProperty(this, "checkSufficientEllipsisWidth", function (truncation) {
|
|
53
|
+
var textToCheck = truncation === 'startEnd' ? "".concat(_this.ellipsis, " ").concat(_this.ellipsis) // startEnd needs a little more space
|
|
54
|
+
: _this.ellipsis;
|
|
55
|
+
_this.setTextToCheck(textToCheck);
|
|
56
|
+
if (_this.textWidth >= _this.availableWidth * 0.9) {
|
|
57
|
+
console.error('The truncation ellipsis is larger than the available width. No text can be rendered.');
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
_defineProperty(this, "checkTruncationOffsetWidth", function (text) {
|
|
62
|
+
_this.setTextToCheck(text);
|
|
63
|
+
if (_this.textWidth > _this.availableWidth) {
|
|
64
|
+
console.error("The passed truncationOffset is too large for the available width. Truncating the offset instead.");
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
/**
|
|
69
|
+
* Truncation types logic. This is where the magic happens
|
|
70
|
+
*/
|
|
71
|
+
_defineProperty(this, "truncateStart", function (truncationOffset) {
|
|
72
|
+
var truncatedText = _this.fullText;
|
|
73
|
+
var leadingText = '';
|
|
74
|
+
var combinedText = function combinedText() {
|
|
75
|
+
return "".concat(leadingText).concat(truncatedText);
|
|
76
|
+
};
|
|
77
|
+
if (truncationOffset) {
|
|
78
|
+
var _splitText$at = splitText(_this.fullText).at(truncationOffset);
|
|
79
|
+
var _splitText$at2 = _slicedToArray(_splitText$at, 2);
|
|
80
|
+
leadingText = _splitText$at2[0];
|
|
81
|
+
truncatedText = _splitText$at2[1];
|
|
82
|
+
var widthCheck = "".concat(leadingText).concat(_this.ellipsis);
|
|
83
|
+
if (_this.checkTruncationOffsetWidth(widthCheck) === false) {
|
|
84
|
+
truncatedText = leadingText;
|
|
85
|
+
leadingText = '';
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
leadingText += _this.ellipsis;
|
|
89
|
+
_this.setTextToCheck(combinedText());
|
|
90
|
+
while (_this.textWidth > _this.availableWidth) {
|
|
91
|
+
truncatedText = removeFirstCharacter(truncatedText);
|
|
92
|
+
_this.setTextToCheck(combinedText());
|
|
93
|
+
}
|
|
94
|
+
return combinedText();
|
|
95
|
+
});
|
|
96
|
+
_defineProperty(this, "truncateEnd", function (truncationOffset) {
|
|
97
|
+
var truncatedText = _this.fullText;
|
|
98
|
+
var trailingText = '';
|
|
99
|
+
var combinedText = function combinedText() {
|
|
100
|
+
return "".concat(truncatedText).concat(trailingText);
|
|
101
|
+
};
|
|
102
|
+
if (truncationOffset) {
|
|
103
|
+
var index = _this.fullText.length - truncationOffset;
|
|
104
|
+
var _splitText$at3 = splitText(_this.fullText).at(index);
|
|
105
|
+
var _splitText$at4 = _slicedToArray(_splitText$at3, 2);
|
|
106
|
+
truncatedText = _splitText$at4[0];
|
|
107
|
+
trailingText = _splitText$at4[1];
|
|
108
|
+
var widthCheck = "".concat(_this.ellipsis).concat(trailingText);
|
|
109
|
+
if (_this.checkTruncationOffsetWidth(widthCheck) === false) {
|
|
110
|
+
truncatedText = trailingText;
|
|
111
|
+
trailingText = '';
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
trailingText = _this.ellipsis + trailingText;
|
|
115
|
+
_this.setTextToCheck(combinedText());
|
|
116
|
+
while (_this.textWidth > _this.availableWidth) {
|
|
117
|
+
truncatedText = removeLastCharacter(truncatedText);
|
|
118
|
+
_this.setTextToCheck(combinedText());
|
|
119
|
+
}
|
|
120
|
+
return combinedText();
|
|
121
|
+
});
|
|
122
|
+
_defineProperty(this, "truncateStartEndAtPosition", function (truncationPosition) {
|
|
123
|
+
// If using a non-centered startEnd anchor position, we need to *build*
|
|
124
|
+
// the string from scratch instead of *removing* from the full text string,
|
|
125
|
+
// to make sure we don't go past the beginning or end of the text
|
|
126
|
+
var truncatedText = '';
|
|
127
|
+
_this.setTextToCheck(truncatedText);
|
|
128
|
+
|
|
129
|
+
// Ellipses are conditional - if the anchor is towards the beginning or end,
|
|
130
|
+
// it's possible they shouldn't render
|
|
131
|
+
var startingEllipsis = _this.ellipsis;
|
|
132
|
+
var endingEllipsis = _this.ellipsis;
|
|
133
|
+
|
|
134
|
+
// Split the text into two at the anchor position
|
|
135
|
+
var _splitText$at5 = splitText(_this.fullText).at(truncationPosition),
|
|
136
|
+
_splitText$at6 = _slicedToArray(_splitText$at5, 2),
|
|
137
|
+
firstPart = _splitText$at6[0],
|
|
138
|
+
secondPart = _splitText$at6[1];
|
|
139
|
+
var combinedText = function combinedText() {
|
|
140
|
+
return "".concat(startingEllipsis).concat(truncatedText).concat(endingEllipsis);
|
|
141
|
+
};
|
|
142
|
+
while (_this.textWidth <= _this.availableWidth) {
|
|
143
|
+
if (firstPart.length > 0) {
|
|
144
|
+
truncatedText = "".concat(getLastCharacter(firstPart)).concat(truncatedText);
|
|
145
|
+
firstPart = removeLastCharacter(firstPart);
|
|
146
|
+
} else {
|
|
147
|
+
startingEllipsis = '';
|
|
148
|
+
}
|
|
149
|
+
if (secondPart.length > 0) {
|
|
150
|
+
truncatedText = "".concat(truncatedText).concat(getFirstCharacter(secondPart));
|
|
151
|
+
secondPart = removeFirstCharacter(secondPart);
|
|
152
|
+
} else {
|
|
153
|
+
endingEllipsis = '';
|
|
154
|
+
}
|
|
155
|
+
_this.setTextToCheck(combinedText());
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Because this logic builds text outwards vs. removing inwards, the final
|
|
159
|
+
// text width ends up a little larger than the container, and we need to
|
|
160
|
+
// remove the last added character(s)
|
|
161
|
+
if (!startingEllipsis) {
|
|
162
|
+
truncatedText = removeLastCharacter(truncatedText);
|
|
163
|
+
} else if (!endingEllipsis) {
|
|
164
|
+
truncatedText = removeFirstCharacter(truncatedText);
|
|
165
|
+
} else {
|
|
166
|
+
truncatedText = removeFirstAndLastCharacters(truncatedText);
|
|
167
|
+
}
|
|
168
|
+
return combinedText();
|
|
169
|
+
});
|
|
170
|
+
_defineProperty(this, "truncateStartEndAtMiddle", function () {
|
|
171
|
+
var truncatedText = _this.fullText;
|
|
172
|
+
_this.setTextToCheck(truncatedText);
|
|
173
|
+
var combinedText = function combinedText() {
|
|
174
|
+
return "".concat(_this.ellipsis).concat(truncatedText).concat(_this.ellipsis);
|
|
175
|
+
};
|
|
176
|
+
while (_this.textWidth > _this.availableWidth) {
|
|
177
|
+
truncatedText = removeFirstAndLastCharacters(truncatedText);
|
|
178
|
+
_this.setTextToCheck(combinedText());
|
|
179
|
+
}
|
|
180
|
+
return combinedText();
|
|
181
|
+
});
|
|
182
|
+
_defineProperty(this, "truncateMiddle", function () {
|
|
183
|
+
var middlePosition = Math.floor(_this.fullText.length / 2);
|
|
184
|
+
var _splitText$at7 = splitText(_this.fullText).at(middlePosition),
|
|
185
|
+
_splitText$at8 = _slicedToArray(_splitText$at7, 2),
|
|
186
|
+
firstHalf = _splitText$at8[0],
|
|
187
|
+
secondHalf = _splitText$at8[1];
|
|
188
|
+
var trimfirstHalf;
|
|
189
|
+
var combinedText = function combinedText() {
|
|
190
|
+
return "".concat(firstHalf).concat(_this.ellipsis).concat(secondHalf);
|
|
191
|
+
};
|
|
192
|
+
_this.setTextToCheck(combinedText());
|
|
193
|
+
while (_this.textWidth > _this.availableWidth) {
|
|
194
|
+
trimfirstHalf = !trimfirstHalf;
|
|
195
|
+
if (trimfirstHalf) {
|
|
196
|
+
firstHalf = removeLastCharacter(firstHalf);
|
|
197
|
+
} else {
|
|
198
|
+
secondHalf = removeFirstCharacter(secondHalf);
|
|
199
|
+
}
|
|
200
|
+
_this.setTextToCheck(combinedText());
|
|
201
|
+
}
|
|
202
|
+
return combinedText();
|
|
203
|
+
});
|
|
204
|
+
this.fullText = fullText;
|
|
205
|
+
this.ellipsis = ellipsis;
|
|
206
|
+
this.availableWidth = availableWidth;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Internal measurement utils which will be overridden depending on the
|
|
211
|
+
* rendering approach used (e.g. DOM vs Canvas).
|
|
212
|
+
*/);
|
|
213
|
+
/**
|
|
214
|
+
* Creates a temporary vanilla JS DOM element for manipulating text and
|
|
215
|
+
* determining text width.
|
|
216
|
+
*
|
|
217
|
+
* Requires passing in a container element to which the temporary element
|
|
218
|
+
* will be appended. Any CSS/font styles that need to be accounted for should
|
|
219
|
+
* be automatically inherited from the container.
|
|
220
|
+
*
|
|
221
|
+
* NOTE: The consumer is responsible for calling the `cleanup()` method manually
|
|
222
|
+
* to remove the temporary DOM node once their usage of this utility is complete.
|
|
223
|
+
*/
|
|
224
|
+
|
|
225
|
+
export var TruncationUtilsWithDOM = /*#__PURE__*/function (_TruncationUtils2) {
|
|
226
|
+
_inherits(TruncationUtilsWithDOM, _TruncationUtils2);
|
|
227
|
+
var _super = _createSuper(TruncationUtilsWithDOM);
|
|
228
|
+
function TruncationUtilsWithDOM(_ref2) {
|
|
229
|
+
var _this2;
|
|
230
|
+
var container = _ref2.container,
|
|
231
|
+
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
232
|
+
_classCallCheck(this, TruncationUtilsWithDOM);
|
|
233
|
+
_this2 = _super.call(this, rest);
|
|
234
|
+
_defineProperty(_assertThisInitialized(_this2), "container", void 0);
|
|
235
|
+
_defineProperty(_assertThisInitialized(_this2), "span", void 0);
|
|
236
|
+
_defineProperty(_assertThisInitialized(_this2), "setTextToCheck", function (text) {
|
|
237
|
+
_this2.span.textContent = text;
|
|
238
|
+
});
|
|
239
|
+
_defineProperty(_assertThisInitialized(_this2), "cleanup", function () {
|
|
240
|
+
_this2.container.removeChild(_this2.span);
|
|
241
|
+
});
|
|
242
|
+
_this2.container = container;
|
|
243
|
+
_this2.span = document.createElement('span');
|
|
244
|
+
_this2.span.style.position = 'absolute'; // Prevent page reflow/repaint for performance
|
|
245
|
+
_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
|
|
246
|
+
_this2.container.appendChild(_this2.span);
|
|
247
|
+
return _this2;
|
|
248
|
+
}
|
|
249
|
+
_createClass(TruncationUtilsWithDOM, [{
|
|
250
|
+
key: "textWidth",
|
|
251
|
+
get: function get() {
|
|
252
|
+
return this.span.offsetWidth;
|
|
253
|
+
}
|
|
254
|
+
}]);
|
|
255
|
+
return TruncationUtilsWithDOM;
|
|
256
|
+
}(_TruncationUtils);
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Creates a temporary Canvas element for manipulating text & determining
|
|
260
|
+
* text width. This method is compatible with charts or other canvas-rendered
|
|
261
|
+
* frameworks, and requires no cleanup method.
|
|
262
|
+
*
|
|
263
|
+
* To accurately measure text, canvas rendering requires either a container to
|
|
264
|
+
* compute/derive font styles from, or a static font string (useful for usage
|
|
265
|
+
* outside the DOM). Particular care should be applied when fallback fonts are
|
|
266
|
+
* used, as more fallback fonts can lead to less precision.
|
|
267
|
+
*
|
|
268
|
+
* Please note that while canvas is more performant than DOM measurement, there
|
|
269
|
+
* are subpixel to single digit pixel differences between DOM and canvas
|
|
270
|
+
* measurement due to the different rendering engines used.
|
|
271
|
+
*/
|
|
272
|
+
export var TruncationUtilsWithCanvas = /*#__PURE__*/function (_TruncationUtils3) {
|
|
273
|
+
_inherits(TruncationUtilsWithCanvas, _TruncationUtils3);
|
|
274
|
+
var _super2 = _createSuper(TruncationUtilsWithCanvas);
|
|
275
|
+
function TruncationUtilsWithCanvas(_ref3) {
|
|
276
|
+
var _this3;
|
|
277
|
+
var font = _ref3.font,
|
|
278
|
+
container = _ref3.container,
|
|
279
|
+
rest = _objectWithoutProperties(_ref3, _excluded2);
|
|
280
|
+
_classCallCheck(this, TruncationUtilsWithCanvas);
|
|
281
|
+
_this3 = _super2.call(this, rest);
|
|
282
|
+
_defineProperty(_assertThisInitialized(_this3), "context", void 0);
|
|
283
|
+
_defineProperty(_assertThisInitialized(_this3), "currentText", '');
|
|
284
|
+
_defineProperty(_assertThisInitialized(_this3), "computeFontFromElement", function (element) {
|
|
285
|
+
var computedStyles = window.getComputedStyle(element);
|
|
286
|
+
return ['font-style', 'font-variant', 'font-weight', 'font-size', 'font-family'].map(function (prop) {
|
|
287
|
+
return computedStyles.getPropertyValue(prop);
|
|
288
|
+
}).join(' ').trim();
|
|
289
|
+
});
|
|
290
|
+
_defineProperty(_assertThisInitialized(_this3), "setTextToCheck", function (text) {
|
|
291
|
+
_this3.currentText = text;
|
|
292
|
+
});
|
|
293
|
+
_this3.context = document.createElement('canvas').getContext('2d');
|
|
294
|
+
|
|
295
|
+
// Set the canvas font to ensure text width calculations are correct
|
|
296
|
+
if (font) {
|
|
297
|
+
_this3.context.font = font;
|
|
298
|
+
} else if (container) {
|
|
299
|
+
_this3.context.font = _this3.computeFontFromElement(container);
|
|
300
|
+
}
|
|
301
|
+
return _this3;
|
|
302
|
+
}
|
|
303
|
+
_createClass(TruncationUtilsWithCanvas, [{
|
|
304
|
+
key: "textWidth",
|
|
305
|
+
get: function get() {
|
|
306
|
+
return this.context.measureText(this.currentText).width;
|
|
307
|
+
}
|
|
308
|
+
}]);
|
|
309
|
+
return TruncationUtilsWithCanvas;
|
|
310
|
+
}(_TruncationUtils);
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* DRY character/substring utils
|
|
314
|
+
*/
|
|
315
|
+
|
|
316
|
+
var removeLastCharacter = function removeLastCharacter(text) {
|
|
317
|
+
return text.substring(0, text.length - 1);
|
|
318
|
+
};
|
|
319
|
+
var getLastCharacter = function getLastCharacter(text) {
|
|
320
|
+
return text.substring(text.length - 1);
|
|
321
|
+
};
|
|
322
|
+
var removeFirstCharacter = function removeFirstCharacter(text) {
|
|
323
|
+
return text.substring(1);
|
|
324
|
+
};
|
|
325
|
+
var getFirstCharacter = function getFirstCharacter(text) {
|
|
326
|
+
return text.substring(0, 1);
|
|
327
|
+
};
|
|
328
|
+
var removeFirstAndLastCharacters = function removeFirstAndLastCharacters(text) {
|
|
329
|
+
return text.substring(1, text.length - 1);
|
|
330
|
+
};
|
|
331
|
+
var splitText = function splitText(text) {
|
|
332
|
+
return {
|
|
333
|
+
at: function at(index) {
|
|
334
|
+
return [text.substring(0, index), text.substring(index)];
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
};
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["className", "toasts", "dismissToast", "toastLifeTimeMs", "side"],
|
|
5
|
+
var _excluded = ["className", "toasts", "dismissToast", "toastLifeTimeMs", "onClearAllToasts", "side", "showClearAllButtonAt"],
|
|
6
6
|
_excluded2 = ["text", "toastLifeTimeMs"];
|
|
7
7
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
8
8
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -22,6 +22,8 @@ import { Timer } from '../../services/time';
|
|
|
22
22
|
import { EuiGlobalToastListItem } from './global_toast_list_item';
|
|
23
23
|
import { EuiToast } from './toast';
|
|
24
24
|
import { euiGlobalToastListStyles } from './global_toast_list.styles';
|
|
25
|
+
import { EuiButton } from '../button';
|
|
26
|
+
import { EuiI18n } from '../i18n';
|
|
25
27
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
26
28
|
var sideToClassNameMap = {
|
|
27
29
|
left: 'euiGlobalToastList--left',
|
|
@@ -29,14 +31,18 @@ var sideToClassNameMap = {
|
|
|
29
31
|
};
|
|
30
32
|
export var SIDES = keysOf(sideToClassNameMap);
|
|
31
33
|
export var TOAST_FADE_OUT_MS = 250;
|
|
34
|
+
export var CLEAR_ALL_TOASTS_THRESHOLD_DEFAULT = 3;
|
|
32
35
|
export var EuiGlobalToastList = function EuiGlobalToastList(_ref) {
|
|
33
36
|
var className = _ref.className,
|
|
34
37
|
_ref$toasts = _ref.toasts,
|
|
35
38
|
toasts = _ref$toasts === void 0 ? [] : _ref$toasts,
|
|
36
39
|
dismissToastProp = _ref.dismissToast,
|
|
37
40
|
toastLifeTimeMs = _ref.toastLifeTimeMs,
|
|
41
|
+
onClearAllToasts = _ref.onClearAllToasts,
|
|
38
42
|
_ref$side = _ref.side,
|
|
39
43
|
side = _ref$side === void 0 ? 'right' : _ref$side,
|
|
44
|
+
_ref$showClearAllButt = _ref.showClearAllButtonAt,
|
|
45
|
+
showClearAllButtonAt = _ref$showClearAllButt === void 0 ? CLEAR_ALL_TOASTS_THRESHOLD_DEFAULT : _ref$showClearAllButt,
|
|
40
46
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
41
47
|
var _useState = useState({}),
|
|
42
48
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -109,7 +115,11 @@ export var EuiGlobalToastList = function EuiGlobalToastList(_ref) {
|
|
|
109
115
|
}
|
|
110
116
|
};
|
|
111
117
|
var onScroll = function onScroll() {
|
|
112
|
-
|
|
118
|
+
// Given that this method also gets invoked by the synthetic scroll that happens when a new toast gets added,
|
|
119
|
+
// we want to evaluate if the scroll bottom has been reached only when the user is interacting with the toast,
|
|
120
|
+
// this way we always retain the scroll position the user has set despite adding in new toasts.
|
|
121
|
+
// User interaction is determined through the handler registered for mouseEnter and mouseLeave events.
|
|
122
|
+
if (listElement.current && isUserInteracting.current) {
|
|
113
123
|
isScrolledToBottom.current = listElement.current.scrollHeight - listElement.current.scrollTop === listElement.current.clientHeight;
|
|
114
124
|
}
|
|
115
125
|
};
|
|
@@ -223,6 +233,33 @@ export var EuiGlobalToastList = function EuiGlobalToastList(_ref) {
|
|
|
223
233
|
onBlur: onMouseLeave
|
|
224
234
|
}, rest), text));
|
|
225
235
|
});
|
|
236
|
+
if (showClearAllButtonAt && toasts.length >= showClearAllButtonAt) {
|
|
237
|
+
var dismissAllToasts = function dismissAllToasts() {
|
|
238
|
+
toasts.forEach(function (toast) {
|
|
239
|
+
return dismissToastProp(toast);
|
|
240
|
+
});
|
|
241
|
+
onClearAllToasts === null || onClearAllToasts === void 0 ? void 0 : onClearAllToasts();
|
|
242
|
+
};
|
|
243
|
+
renderedToasts.push(___EmotionJSX(EuiI18n, {
|
|
244
|
+
key: "euiClearAllToasts",
|
|
245
|
+
tokens: ['euiGlobalToastList.clearAllToastsButtonAriaLabel', 'euiGlobalToastList.clearAllToastsButtonDisplayText'],
|
|
246
|
+
defaults: ['Clear all toast notifications', 'Clear all']
|
|
247
|
+
}, function (_ref2) {
|
|
248
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
249
|
+
clearAllToastsButtonAriaLabel = _ref3[0],
|
|
250
|
+
clearAllToastsButtonDisplayText = _ref3[1];
|
|
251
|
+
return ___EmotionJSX(EuiGlobalToastListItem, {
|
|
252
|
+
isDismissed: false
|
|
253
|
+
}, ___EmotionJSX(EuiButton, {
|
|
254
|
+
fill: true,
|
|
255
|
+
color: "text",
|
|
256
|
+
onClick: dismissAllToasts,
|
|
257
|
+
css: [styles.euiGlobalToastListDismissButton, ";label:EuiGlobalToastList;"],
|
|
258
|
+
"aria-label": clearAllToastsButtonAriaLabel,
|
|
259
|
+
"data-test-subj": "euiClearAllToastsButton"
|
|
260
|
+
}, clearAllToastsButtonDisplayText));
|
|
261
|
+
}));
|
|
262
|
+
}
|
|
226
263
|
var classes = classNames('euiGlobalToastList', className);
|
|
227
264
|
return ___EmotionJSX("div", _extends({
|
|
228
265
|
"aria-live": "polite",
|
|
@@ -22,7 +22,8 @@ export var euiGlobalToastListStyles = function euiGlobalToastListStyles(euiTheme
|
|
|
22
22
|
euiGlobalToastList: /*#__PURE__*/css(euiScrollBarStyles(euiThemeContext), " display:flex;flex-direction:column;align-items:stretch;position:fixed;z-index:", euiTheme.levels.toast, ";", logicalCSS('bottom', 0), " ", logicalCSS('width', "".concat(euiToastWidth, "px")), logicalCSS('max-height', '100vh'), logicalCSSWithFallback('overflow-y', 'auto'), "scrollbar-width:none;&::-webkit-scrollbar{", logicalSizeCSS(0, 0), ";}&:not(:empty){", logicalCSS('padding-left', euiTheme.size.base), " ", logicalCSS('padding-right', euiTheme.size.base), " ", logicalCSS('padding-vertical', euiTheme.size.base), ";}", euiMaxBreakpoint(euiThemeContext, 'm'), "{&:not(:empty){", logicalCSS('left', 0), " ", logicalCSS('width', '100%'), ";}};label:euiGlobalToastList;"),
|
|
23
23
|
// Variants
|
|
24
24
|
right: /*#__PURE__*/css("&:not(:empty){", logicalCSS('right', 0), ";", euiMinBreakpoint(euiThemeContext, 'm'), "{", logicalCSS('padding-left', "".concat(euiTheme.base * 4, "px")), ";}};label:right;"),
|
|
25
|
-
left: /*#__PURE__*/css("&:not(:empty){", logicalCSS('left', 0), ";", euiMinBreakpoint(euiThemeContext, 'm'), "{", logicalCSS('padding-right', "".concat(euiTheme.base * 4, "px")), ";}};label:left;")
|
|
25
|
+
left: /*#__PURE__*/css("&:not(:empty){", logicalCSS('left', 0), ";", euiMinBreakpoint(euiThemeContext, 'm'), "{", logicalCSS('padding-right', "".concat(euiTheme.base * 4, "px")), ";}};label:left;"),
|
|
26
|
+
euiGlobalToastListDismissButton: /*#__PURE__*/css("position:sticky;", logicalCSS('bottom', '0%'), ";;label:euiGlobalToastListDismissButton;")
|
|
26
27
|
};
|
|
27
28
|
};
|
|
28
29
|
export var euiGlobalToastListItemStyles = function euiGlobalToastListItemStyles(_ref) {
|
|
@@ -30,7 +31,7 @@ export var euiGlobalToastListItemStyles = function euiGlobalToastListItemStyles(
|
|
|
30
31
|
var euiShowToast = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n from {\n transform: translateY(", ") scale(.9);\n opacity: 0;\n }\n\n to {\n transform: translateY(0) scale(1);\n opacity: 1;\n }\n"])), euiTheme.size.l);
|
|
31
32
|
return {
|
|
32
33
|
// Base
|
|
33
|
-
euiGlobalToastListItem: /*#__PURE__*/css(logicalCSS('margin-bottom', euiTheme.size.base), " animation:", euiTheme.animation.normal, " ", euiShowToast, " ", euiTheme.animation.resistance, ";opacity:1;&:first-child{", logicalCSS('margin-top', 'auto'), ";}&:last-child{", logicalCSS('margin-bottom', 0), ";};label:euiGlobalToastListItem;"),
|
|
34
|
+
euiGlobalToastListItem: /*#__PURE__*/css("flex-shrink:0;", logicalCSS('margin-bottom', euiTheme.size.base), " animation:", euiTheme.animation.normal, " ", euiShowToast, " ", euiTheme.animation.resistance, ";opacity:1;&:first-child{", logicalCSS('margin-top', 'auto'), ";}&:last-child{", logicalCSS('margin-bottom', 0), ";};label:euiGlobalToastListItem;"),
|
|
34
35
|
// States
|
|
35
36
|
dismissed: /*#__PURE__*/css("transition:opacity ", euiTheme.animation.normal, ";opacity:0;;label:dismissed;")
|
|
36
37
|
};
|
|
@@ -18,5 +18,7 @@ export var EuiNestedThemeContext = /*#__PURE__*/createContext({
|
|
|
18
18
|
isGlobalTheme: true,
|
|
19
19
|
hasDifferentColorFromGlobalTheme: false,
|
|
20
20
|
bodyColor: '',
|
|
21
|
-
colorClassName: ''
|
|
21
|
+
colorClassName: '',
|
|
22
|
+
setGlobalCSSVariables: function setGlobalCSSVariables() {},
|
|
23
|
+
setNearestThemeCSSVariables: function setNearestThemeCSSVariables() {}
|
|
22
24
|
});
|