@elastic/eui 91.0.0 → 91.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eui_theme_dark.css +191 -124
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +191 -124
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/accordion/accordion.a11y.js +1 -3
- package/es/components/basic_table/action_types.js +5 -0
- package/es/components/basic_table/basic_table.a11y.js +1 -2
- package/es/components/basic_table/basic_table.js +8 -8
- package/es/components/basic_table/collapsed_item_actions.js +120 -249
- package/es/components/basic_table/custom_item_action.js +9 -95
- package/es/components/basic_table/default_item_action.js +23 -14
- package/es/components/basic_table/in_memory_table.a11y.js +13 -11
- package/es/components/basic_table/in_memory_table.js +8 -8
- package/es/components/breadcrumbs/breadcrumb.js +11 -7
- package/es/components/breadcrumbs/breadcrumb.styles.js +5 -0
- package/es/components/button/button_display/_button_display.js +5 -3
- package/es/components/button/button_display/_button_display_content.js +8 -4
- package/es/components/button/button_empty/button_empty.js +9 -7
- package/es/components/button/button_group/button_group.js +5 -3
- package/es/components/button/button_group/button_group_button.js +5 -3
- package/es/components/card/card.a11y.js +5 -18
- package/es/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +2 -2
- package/es/components/collapsible_nav_beta/collapsible_nav_body_footer.js +4 -1
- package/es/components/collapsible_nav_beta/collapsible_nav_body_footer.styles.js +12 -9
- package/es/components/collapsible_nav_beta/collapsible_nav_group/collapsible_nav_group.js +1 -101
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +20 -58
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_item.js +89 -37
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_popover.js +67 -81
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_popover.styles.js +1 -19
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.js +7 -102
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.styles.js +4 -4
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_group.js +7 -90
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +150 -130
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_link.js +0 -10
- package/es/components/combo_box/combo_box.js +1 -1
- package/es/components/context_menu/context_menu_item.js +16 -8
- package/es/components/context_menu/context_menu_item.styles.js +1 -1
- package/es/components/datagrid/body/data_grid_body.js +16 -6
- package/es/components/datagrid/body/data_grid_body_custom.js +16 -6
- package/es/components/datagrid/body/data_grid_body_virtualized.js +16 -6
- package/es/components/datagrid/body/data_grid_cell.js +67 -44
- package/es/components/datagrid/body/data_grid_cell_actions.js +12 -12
- package/es/components/datagrid/body/data_grid_cell_popover.js +43 -10
- package/es/components/datagrid/body/header/data_grid_header_cell.js +65 -34
- package/es/components/datagrid/body/header/data_grid_header_row.js +16 -6
- package/es/components/datagrid/controls/column_selector.js +19 -39
- package/es/components/datagrid/controls/column_sorting.js +18 -29
- package/es/components/datagrid/controls/data_grid_toolbar_control.js +154 -0
- package/es/components/datagrid/controls/display_selector.js +0 -1
- package/es/components/datagrid/controls/fullscreen_selector.js +2 -6
- package/es/components/datagrid/controls/index.js +2 -1
- package/es/components/datagrid/index.js +1 -1
- package/es/components/datagrid/utils/in_memory.js +16 -6
- package/es/components/datagrid/utils/row_heights.js +1 -1
- package/es/components/date_picker/auto_refresh/auto_refresh.js +6 -4
- package/es/components/date_picker/super_date_picker/super_update_button.js +1 -1
- package/es/components/error_boundary/error_boundary.a11y.js +1 -1
- package/es/components/expression/expression.a11y.js +2 -4
- package/es/components/facet/facet_button.js +5 -3
- package/es/components/filter_group/filter_button.js +2 -2
- package/es/components/focus_trap/focus_trap.a11y.js +3 -3
- package/es/components/form/range/range.a11y.js +5 -10
- package/es/components/form/super_select/super_select.js +3 -2
- package/es/components/form/super_select/super_select_control.js +13 -20
- package/es/components/header/header.a11y.js +1 -1
- package/es/components/header/header_links/header_link.js +7 -5
- package/es/components/header/header_section/header_section_item_button.js +7 -5
- package/es/components/image/image.a11y.js +1 -2
- package/es/components/key_pad_menu/key_pad_menu.a11y.js +5 -5
- package/es/components/link/external_link_icon.js +51 -0
- package/es/components/link/link.js +6 -20
- package/es/components/link/link.styles.js +2 -5
- package/es/components/list_group/list_group.js +6 -1
- package/es/components/list_group/list_group_item.js +14 -4
- package/es/components/list_group/list_group_item.styles.js +2 -1
- package/es/components/list_group/pinnable_list_group/pinnable_list_group.js +12 -2
- package/es/components/notification/notification_event.a11y.js +1 -2
- package/es/components/notification/notification_event.js +7 -5
- package/es/components/pagination/pagination_button.js +7 -5
- package/es/components/popover/popover.js +4 -1
- package/es/components/resizable_container/resizable_container.a11y.js +4 -8
- package/es/components/search_bar/search_bar.a11y.js +3 -6
- package/es/components/selectable/selectable.js +16 -1
- package/es/components/selectable/selectable_list/selectable_list.js +227 -78
- package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +16 -1
- package/es/components/text/text.styles.js +2 -2
- package/es/components/text_truncate/text_truncate.js +33 -10
- package/eui.d.ts +466 -136
- package/i18ntokens.json +224 -260
- package/lib/components/accordion/accordion.a11y.js +1 -3
- package/lib/components/basic_table/action_types.js +8 -2
- package/lib/components/basic_table/basic_table.a11y.js +1 -2
- package/lib/components/basic_table/basic_table.js +8 -8
- package/lib/components/basic_table/collapsed_item_actions.js +128 -257
- package/lib/components/basic_table/custom_item_action.js +18 -104
- package/lib/components/basic_table/default_item_action.js +23 -14
- package/lib/components/basic_table/in_memory_table.a11y.js +13 -11
- package/lib/components/basic_table/in_memory_table.js +8 -8
- package/lib/components/breadcrumbs/breadcrumb.js +11 -7
- package/lib/components/breadcrumbs/breadcrumb.styles.js +5 -0
- package/lib/components/button/button_display/_button_display.js +5 -3
- package/lib/components/button/button_display/_button_display_content.js +8 -4
- package/lib/components/button/button_empty/button_empty.js +9 -7
- package/lib/components/button/button_group/button_group.js +5 -3
- package/lib/components/button/button_group/button_group_button.js +5 -3
- package/lib/components/card/card.a11y.js +5 -18
- package/lib/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +1 -1
- package/lib/components/collapsible_nav_beta/collapsible_nav_body_footer.js +4 -1
- package/lib/components/collapsible_nav_beta/collapsible_nav_body_footer.styles.js +12 -9
- package/lib/components/collapsible_nav_beta/collapsible_nav_group/collapsible_nav_group.js +1 -101
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +20 -58
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_item.js +89 -37
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_popover.js +66 -80
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_popover.styles.js +11 -28
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.js +7 -104
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.styles.js +4 -4
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_group.js +7 -90
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +150 -130
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_link.js +0 -10
- package/lib/components/combo_box/combo_box.js +1 -1
- package/lib/components/context_menu/context_menu_item.js +16 -8
- package/lib/components/context_menu/context_menu_item.styles.js +1 -1
- package/lib/components/datagrid/body/data_grid_body.js +16 -6
- package/lib/components/datagrid/body/data_grid_body_custom.js +16 -6
- package/lib/components/datagrid/body/data_grid_body_virtualized.js +16 -6
- package/lib/components/datagrid/body/data_grid_cell.js +67 -44
- package/lib/components/datagrid/body/data_grid_cell_actions.js +12 -13
- package/lib/components/datagrid/body/data_grid_cell_popover.js +43 -10
- package/lib/components/datagrid/body/header/data_grid_header_cell.js +65 -34
- package/lib/components/datagrid/body/header/data_grid_header_row.js +16 -6
- package/lib/components/datagrid/controls/column_selector.js +19 -39
- package/lib/components/datagrid/controls/column_sorting.js +18 -30
- package/lib/components/datagrid/controls/data_grid_toolbar_control.js +159 -0
- package/lib/components/datagrid/controls/display_selector.js +0 -1
- package/lib/components/datagrid/controls/fullscreen_selector.js +2 -7
- package/lib/components/datagrid/controls/index.js +8 -1
- package/lib/components/datagrid/index.js +8 -1
- package/lib/components/datagrid/utils/in_memory.js +16 -6
- package/lib/components/datagrid/utils/row_heights.js +1 -1
- package/lib/components/date_picker/auto_refresh/auto_refresh.js +6 -4
- package/lib/components/date_picker/super_date_picker/super_update_button.js +1 -1
- package/lib/components/error_boundary/error_boundary.a11y.js +1 -1
- package/lib/components/expression/expression.a11y.js +2 -4
- package/lib/components/facet/facet_button.js +5 -3
- package/lib/components/filter_group/filter_button.js +2 -2
- package/lib/components/focus_trap/focus_trap.a11y.js +3 -3
- package/lib/components/form/range/range.a11y.js +5 -10
- package/lib/components/form/super_select/super_select.js +3 -2
- package/lib/components/form/super_select/super_select_control.js +12 -19
- package/lib/components/header/header.a11y.js +1 -1
- package/lib/components/header/header_links/header_link.js +7 -5
- package/lib/components/header/header_section/header_section_item_button.js +7 -5
- package/lib/components/image/image.a11y.js +1 -2
- package/lib/components/key_pad_menu/key_pad_menu.a11y.js +5 -5
- package/lib/components/link/external_link_icon.js +57 -0
- package/lib/components/link/link.js +6 -20
- package/lib/components/link/link.styles.js +1 -4
- package/lib/components/list_group/list_group.js +6 -1
- package/lib/components/list_group/list_group_item.js +14 -4
- package/lib/components/list_group/list_group_item.styles.js +2 -1
- package/lib/components/list_group/pinnable_list_group/pinnable_list_group.js +12 -2
- package/lib/components/notification/notification_event.a11y.js +1 -2
- package/lib/components/notification/notification_event.js +7 -5
- package/lib/components/popover/popover.js +4 -1
- package/lib/components/resizable_container/resizable_container.a11y.js +4 -8
- package/lib/components/search_bar/search_bar.a11y.js +3 -6
- package/lib/components/selectable/selectable.js +16 -1
- package/lib/components/selectable/selectable_list/selectable_list.js +227 -78
- package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +16 -1
- package/lib/components/text/text.styles.js +2 -2
- package/lib/components/text_truncate/text_truncate.js +32 -9
- package/optimize/es/components/accordion/accordion.a11y.js +1 -3
- package/optimize/es/components/basic_table/action_types.js +5 -0
- package/optimize/es/components/basic_table/basic_table.a11y.js +1 -2
- package/optimize/es/components/basic_table/collapsed_item_actions.js +116 -169
- package/optimize/es/components/basic_table/custom_item_action.js +10 -83
- package/optimize/es/components/basic_table/default_item_action.js +23 -14
- package/optimize/es/components/basic_table/in_memory_table.a11y.js +13 -11
- package/optimize/es/components/breadcrumbs/breadcrumb.js +11 -7
- package/optimize/es/components/breadcrumbs/breadcrumb.styles.js +5 -0
- package/optimize/es/components/button/button_display/_button_display_content.js +3 -1
- package/optimize/es/components/button/button_empty/button_empty.js +2 -2
- package/optimize/es/components/card/card.a11y.js +5 -18
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +2 -2
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_body_footer.js +4 -1
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_body_footer.styles.js +12 -9
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +1 -3
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_item.js +10 -5
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_popover.js +8 -36
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_popover.styles.js +1 -19
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.js +6 -23
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.styles.js +4 -4
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_group.js +6 -10
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +9 -5
- package/optimize/es/components/context_menu/context_menu_item.js +9 -6
- package/optimize/es/components/context_menu/context_menu_item.styles.js +1 -1
- package/optimize/es/components/datagrid/body/data_grid_cell.js +38 -30
- package/optimize/es/components/datagrid/body/data_grid_cell_actions.js +12 -12
- package/optimize/es/components/datagrid/body/data_grid_cell_popover.js +43 -10
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell.js +49 -28
- package/optimize/es/components/datagrid/controls/column_selector.js +19 -39
- package/optimize/es/components/datagrid/controls/column_sorting.js +18 -29
- package/optimize/es/components/datagrid/controls/data_grid_toolbar_control.js +70 -0
- package/optimize/es/components/datagrid/controls/display_selector.js +0 -1
- package/optimize/es/components/datagrid/controls/fullscreen_selector.js +2 -6
- package/optimize/es/components/datagrid/controls/index.js +2 -1
- package/optimize/es/components/datagrid/index.js +1 -1
- package/optimize/es/components/datagrid/utils/row_heights.js +1 -1
- package/optimize/es/components/date_picker/super_date_picker/super_update_button.js +1 -1
- package/optimize/es/components/error_boundary/error_boundary.a11y.js +1 -1
- package/optimize/es/components/expression/expression.a11y.js +2 -4
- package/optimize/es/components/filter_group/filter_button.js +2 -2
- package/optimize/es/components/focus_trap/focus_trap.a11y.js +3 -3
- package/optimize/es/components/form/range/range.a11y.js +5 -10
- package/optimize/es/components/form/super_select/super_select.js +3 -2
- package/optimize/es/components/form/super_select/super_select_control.js +13 -20
- package/optimize/es/components/header/header.a11y.js +1 -1
- package/optimize/es/components/image/image.a11y.js +1 -2
- package/optimize/es/components/key_pad_menu/key_pad_menu.a11y.js +5 -5
- package/optimize/es/components/link/external_link_icon.js +41 -0
- package/optimize/es/components/link/link.js +6 -20
- package/optimize/es/components/link/link.styles.js +2 -5
- package/optimize/es/components/list_group/list_group_item.js +8 -3
- package/optimize/es/components/list_group/list_group_item.styles.js +2 -1
- package/optimize/es/components/notification/notification_event.a11y.js +1 -2
- package/optimize/es/components/popover/popover.js +4 -1
- package/optimize/es/components/resizable_container/resizable_container.a11y.js +4 -8
- package/optimize/es/components/search_bar/search_bar.a11y.js +3 -6
- package/optimize/es/components/selectable/selectable_list/selectable_list.js +199 -76
- package/optimize/es/components/text/text.styles.js +2 -2
- package/optimize/es/components/text_truncate/text_truncate.js +26 -9
- package/optimize/lib/components/accordion/accordion.a11y.js +1 -3
- package/optimize/lib/components/basic_table/action_types.js +8 -2
- package/optimize/lib/components/basic_table/basic_table.a11y.js +1 -2
- package/optimize/lib/components/basic_table/collapsed_item_actions.js +123 -174
- package/optimize/lib/components/basic_table/custom_item_action.js +17 -91
- package/optimize/lib/components/basic_table/default_item_action.js +23 -14
- package/optimize/lib/components/basic_table/in_memory_table.a11y.js +13 -11
- package/optimize/lib/components/breadcrumbs/breadcrumb.js +11 -7
- package/optimize/lib/components/breadcrumbs/breadcrumb.styles.js +5 -0
- package/optimize/lib/components/button/button_display/_button_display_content.js +3 -1
- package/optimize/lib/components/button/button_empty/button_empty.js +2 -2
- package/optimize/lib/components/card/card.a11y.js +5 -18
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +1 -1
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_body_footer.js +4 -1
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_body_footer.styles.js +12 -9
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +1 -3
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_item.js +10 -5
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_popover.js +8 -36
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_popover.styles.js +11 -28
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.js +6 -26
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.styles.js +4 -4
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_group.js +6 -10
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +9 -5
- package/optimize/lib/components/context_menu/context_menu_item.js +9 -6
- package/optimize/lib/components/context_menu/context_menu_item.styles.js +1 -1
- package/optimize/lib/components/datagrid/body/data_grid_cell.js +38 -30
- package/optimize/lib/components/datagrid/body/data_grid_cell_actions.js +12 -12
- package/optimize/lib/components/datagrid/body/data_grid_cell_popover.js +43 -10
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.js +55 -36
- package/optimize/lib/components/datagrid/controls/column_selector.js +19 -39
- package/optimize/lib/components/datagrid/controls/column_sorting.js +18 -29
- package/optimize/lib/components/datagrid/controls/data_grid_toolbar_control.js +75 -0
- package/optimize/lib/components/datagrid/controls/display_selector.js +0 -1
- package/optimize/lib/components/datagrid/controls/fullscreen_selector.js +2 -6
- package/optimize/lib/components/datagrid/controls/index.js +8 -1
- package/optimize/lib/components/datagrid/index.js +8 -1
- package/optimize/lib/components/datagrid/utils/row_heights.js +1 -1
- package/optimize/lib/components/date_picker/super_date_picker/super_update_button.js +1 -1
- package/optimize/lib/components/error_boundary/error_boundary.a11y.js +1 -1
- package/optimize/lib/components/expression/expression.a11y.js +2 -4
- package/optimize/lib/components/filter_group/filter_button.js +2 -2
- package/optimize/lib/components/focus_trap/focus_trap.a11y.js +3 -3
- package/optimize/lib/components/form/range/range.a11y.js +5 -10
- package/optimize/lib/components/form/super_select/super_select.js +3 -2
- package/optimize/lib/components/form/super_select/super_select_control.js +12 -19
- package/optimize/lib/components/header/header.a11y.js +1 -1
- package/optimize/lib/components/image/image.a11y.js +1 -2
- package/optimize/lib/components/key_pad_menu/key_pad_menu.a11y.js +5 -5
- package/optimize/lib/components/link/external_link_icon.js +47 -0
- package/optimize/lib/components/link/link.js +6 -20
- package/optimize/lib/components/link/link.styles.js +1 -4
- package/optimize/lib/components/list_group/list_group_item.js +8 -3
- package/optimize/lib/components/list_group/list_group_item.styles.js +2 -1
- package/optimize/lib/components/notification/notification_event.a11y.js +1 -2
- package/optimize/lib/components/popover/popover.js +4 -1
- package/optimize/lib/components/resizable_container/resizable_container.a11y.js +4 -8
- package/optimize/lib/components/search_bar/search_bar.a11y.js +3 -6
- package/optimize/lib/components/selectable/selectable_list/selectable_list.js +199 -76
- package/optimize/lib/components/text/text.styles.js +2 -2
- package/optimize/lib/components/text_truncate/text_truncate.js +25 -8
- package/package.json +4 -4
- package/src/components/datagrid/_data_grid_data_row.scss +139 -100
- package/src/components/datagrid/_mixins.scss +2 -2
- package/src/components/datagrid/body/header/_data_grid_header_row.scss +36 -28
- package/src/components/datagrid/controls/_data_grid_toolbar.scss +0 -5
- package/src/components/form/form_row/_form_row.scss +1 -1
- package/src/components/table/_responsive.scss +19 -0
- package/src/components/table/_table.scss +4 -9
- package/test-env/components/accordion/accordion.a11y.js +1 -3
- package/test-env/components/auto_sizer/auto_sizer.js +10 -3
- package/test-env/components/basic_table/action_types.js +8 -2
- package/test-env/components/basic_table/basic_table.a11y.js +1 -2
- package/test-env/components/basic_table/basic_table.js +8 -8
- package/test-env/components/basic_table/collapsed_item_actions.js +124 -251
- package/test-env/components/basic_table/custom_item_action.js +18 -100
- package/test-env/components/basic_table/default_item_action.js +23 -14
- package/test-env/components/basic_table/in_memory_table.a11y.js +13 -11
- package/test-env/components/basic_table/in_memory_table.js +8 -8
- package/test-env/components/breadcrumbs/breadcrumb.js +11 -7
- package/test-env/components/breadcrumbs/breadcrumb.styles.js +5 -0
- package/test-env/components/button/button_display/_button_display.js +5 -3
- package/test-env/components/button/button_display/_button_display_content.js +8 -4
- package/test-env/components/button/button_empty/button_empty.js +9 -7
- package/test-env/components/button/button_group/button_group.js +5 -3
- package/test-env/components/button/button_group/button_group_button.js +5 -3
- package/test-env/components/card/card.a11y.js +5 -18
- package/test-env/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +1 -1
- package/test-env/components/collapsible_nav_beta/collapsible_nav_body_footer.js +4 -1
- package/test-env/components/collapsible_nav_beta/collapsible_nav_body_footer.styles.js +12 -9
- package/test-env/components/collapsible_nav_beta/collapsible_nav_group/collapsible_nav_group.js +1 -101
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +20 -58
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_item.js +89 -37
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_popover.js +66 -80
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_popover.styles.js +11 -28
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.js +7 -105
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.styles.js +4 -4
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_group.js +7 -90
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +150 -130
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_link.js +0 -10
- package/test-env/components/combo_box/combo_box.js +1 -1
- package/test-env/components/context_menu/context_menu_item.js +16 -8
- package/test-env/components/context_menu/context_menu_item.styles.js +1 -1
- package/test-env/components/datagrid/body/data_grid_body.js +16 -6
- package/test-env/components/datagrid/body/data_grid_body_custom.js +16 -6
- package/test-env/components/datagrid/body/data_grid_body_virtualized.js +16 -6
- package/test-env/components/datagrid/body/data_grid_cell.js +67 -44
- package/test-env/components/datagrid/body/data_grid_cell_actions.js +12 -12
- package/test-env/components/datagrid/body/data_grid_cell_popover.js +43 -10
- package/test-env/components/datagrid/body/header/data_grid_header_cell.js +71 -42
- package/test-env/components/datagrid/body/header/data_grid_header_row.js +16 -6
- package/test-env/components/datagrid/controls/column_selector.js +19 -39
- package/test-env/components/datagrid/controls/column_sorting.js +18 -29
- package/test-env/components/datagrid/controls/data_grid_toolbar_control.js +158 -0
- package/test-env/components/datagrid/controls/display_selector.js +0 -1
- package/test-env/components/datagrid/controls/fullscreen_selector.js +2 -6
- package/test-env/components/datagrid/controls/index.js +8 -1
- package/test-env/components/datagrid/index.js +8 -1
- package/test-env/components/datagrid/utils/in_memory.js +16 -6
- package/test-env/components/datagrid/utils/row_heights.js +1 -1
- package/test-env/components/date_picker/auto_refresh/auto_refresh.js +6 -4
- package/test-env/components/date_picker/super_date_picker/super_update_button.js +1 -1
- package/test-env/components/error_boundary/error_boundary.a11y.js +1 -1
- package/test-env/components/expression/expression.a11y.js +2 -4
- package/test-env/components/facet/facet_button.js +5 -3
- package/test-env/components/filter_group/filter_button.js +2 -2
- package/test-env/components/focus_trap/focus_trap.a11y.js +3 -3
- package/test-env/components/form/range/range.a11y.js +5 -10
- package/test-env/components/form/super_select/super_select.js +3 -2
- package/test-env/components/form/super_select/super_select_control.js +12 -19
- package/test-env/components/header/header.a11y.js +1 -1
- package/test-env/components/header/header_links/header_link.js +7 -5
- package/test-env/components/header/header_section/header_section_item_button.js +7 -5
- package/test-env/components/image/image.a11y.js +1 -2
- package/test-env/components/key_pad_menu/key_pad_menu.a11y.js +5 -5
- package/test-env/components/link/external_link_icon.js +56 -0
- package/test-env/components/link/link.js +6 -20
- package/test-env/components/link/link.styles.js +1 -4
- package/test-env/components/list_group/list_group.js +6 -1
- package/test-env/components/list_group/list_group_item.js +14 -4
- package/test-env/components/list_group/list_group_item.styles.js +2 -1
- package/test-env/components/list_group/pinnable_list_group/pinnable_list_group.js +12 -2
- package/test-env/components/notification/notification_event.a11y.js +1 -2
- package/test-env/components/notification/notification_event.js +7 -5
- package/test-env/components/popover/popover.js +4 -1
- package/test-env/components/resizable_container/resizable_container.a11y.js +4 -8
- package/test-env/components/search_bar/search_bar.a11y.js +3 -6
- package/test-env/components/selectable/selectable.js +16 -1
- package/test-env/components/selectable/selectable_list/selectable_list.js +227 -78
- package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +16 -1
- package/test-env/components/text/text.styles.js +2 -2
- package/test-env/components/text_truncate/text_truncate.js +32 -9
|
@@ -10,11 +10,13 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
10
10
|
var _reactWindow = require("react-window");
|
|
11
11
|
var _auto_sizer = require("../../auto_sizer");
|
|
12
12
|
var _highlight = require("../../highlight");
|
|
13
|
+
var _mark = require("../../mark");
|
|
14
|
+
var _text_truncate = require("../../text_truncate");
|
|
13
15
|
var _selectable_list_item = require("./selectable_list_item");
|
|
14
16
|
var _react2 = require("@emotion/react");
|
|
15
17
|
var _excluded = ["data"],
|
|
16
|
-
_excluded2 = ["label", "isGroupLabel", "checked", "disabled", "prepend", "append", "ref", "key", "searchableLabel", "data"],
|
|
17
|
-
_excluded3 = ["className", "options", "searchValue", "onOptionClick", "renderOption", "height", "windowProps", "rowHeight", "activeOptionIndex", "makeOptionId", "showIcons", "singleSelection", "visibleOptions", "allowExclusions", "bordered", "paddingSize", "searchable", "onFocusBadge", "listId", "setActiveOptionIndex", "aria-label", "aria-labelledby", "aria-describedby", "role", "isVirtualized", "textWrap"];
|
|
18
|
+
_excluded2 = ["label", "isGroupLabel", "checked", "disabled", "prepend", "append", "ref", "key", "searchableLabel", "data", "truncationProps"],
|
|
19
|
+
_excluded3 = ["className", "options", "searchValue", "onOptionClick", "renderOption", "height", "windowProps", "rowHeight", "activeOptionIndex", "makeOptionId", "showIcons", "singleSelection", "visibleOptions", "allowExclusions", "bordered", "paddingSize", "searchable", "onFocusBadge", "listId", "setActiveOptionIndex", "aria-label", "aria-labelledby", "aria-describedby", "role", "isVirtualized", "textWrap", "truncationProps"];
|
|
18
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
21
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
22
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -93,20 +95,23 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
93
95
|
}
|
|
94
96
|
}
|
|
95
97
|
});
|
|
96
|
-
|
|
97
|
-
_defineProperty(_assertThisInitialized(_this), "ariaPosInSetMap", {});
|
|
98
|
+
// This utility is necessary to exclude group labels from the aria set count
|
|
98
99
|
_defineProperty(_assertThisInitialized(_this), "calculateAriaSetAttrs", function (optionArray) {
|
|
99
|
-
|
|
100
|
+
var ariaPosInSetMap = {};
|
|
100
101
|
var latestAriaPosIndex = 0;
|
|
101
102
|
optionArray.forEach(function (option, index) {
|
|
102
103
|
if (!option.isGroupLabel) {
|
|
103
104
|
latestAriaPosIndex++;
|
|
104
|
-
|
|
105
|
+
ariaPosInSetMap[index] = latestAriaPosIndex;
|
|
105
106
|
}
|
|
106
107
|
});
|
|
107
|
-
|
|
108
|
+
return {
|
|
109
|
+
ariaPosInSetMap: ariaPosInSetMap,
|
|
110
|
+
ariaSetSize: latestAriaPosIndex
|
|
111
|
+
};
|
|
108
112
|
});
|
|
109
113
|
_defineProperty(_assertThisInitialized(_this), "ListRow", /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
114
|
+
var _option$textWrap;
|
|
110
115
|
var data = _ref.data,
|
|
111
116
|
index = _ref.index,
|
|
112
117
|
style = _ref.style;
|
|
@@ -123,19 +128,20 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
123
128
|
key = option.key,
|
|
124
129
|
searchableLabel = option.searchableLabel,
|
|
125
130
|
_data = option.data,
|
|
131
|
+
_truncationProps = option.truncationProps,
|
|
126
132
|
optionRest = _objectWithoutProperties(option, _excluded2);
|
|
127
133
|
var _this$props2 = _this.props,
|
|
128
134
|
activeOptionIndex = _this$props2.activeOptionIndex,
|
|
129
135
|
allowExclusions = _this$props2.allowExclusions,
|
|
130
136
|
onFocusBadge = _this$props2.onFocusBadge,
|
|
131
137
|
paddingSize = _this$props2.paddingSize,
|
|
132
|
-
searchValue = _this$props2.searchValue,
|
|
133
138
|
showIcons = _this$props2.showIcons,
|
|
134
139
|
makeOptionId = _this$props2.makeOptionId,
|
|
135
140
|
renderOption = _this$props2.renderOption,
|
|
136
141
|
setActiveOptionIndex = _this$props2.setActiveOptionIndex,
|
|
137
142
|
searchable = _this$props2.searchable,
|
|
138
|
-
|
|
143
|
+
searchValue = _this$props2.searchValue,
|
|
144
|
+
isVirtualized = _this$props2.isVirtualized;
|
|
139
145
|
if (isGroupLabel) {
|
|
140
146
|
return (0, _react2.jsx)("li", _extends({
|
|
141
147
|
role: "presentation",
|
|
@@ -145,6 +151,15 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
145
151
|
}, optionRest), prepend, label, append);
|
|
146
152
|
}
|
|
147
153
|
var id = makeOptionId(index);
|
|
154
|
+
var isFocused = activeOptionIndex === index;
|
|
155
|
+
|
|
156
|
+
// Text wrapping
|
|
157
|
+
var canWrap = !isVirtualized;
|
|
158
|
+
var _textWrap = (_option$textWrap = option.textWrap) !== null && _option$textWrap !== void 0 ? _option$textWrap : _this.props.textWrap;
|
|
159
|
+
var textWrap = canWrap ? _textWrap : 'truncate';
|
|
160
|
+
|
|
161
|
+
// Truncation config (if any). If none, CSS truncation is used
|
|
162
|
+
var truncationProps = textWrap === 'truncate' ? _this.getTruncationProps(option, isFocused) : undefined;
|
|
148
163
|
return (0, _react2.jsx)(_selectable_list_item.EuiSelectableListItem, _extends({
|
|
149
164
|
key: id,
|
|
150
165
|
id: id,
|
|
@@ -157,14 +172,14 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
157
172
|
_this.onAddOrRemoveOption(option, event);
|
|
158
173
|
},
|
|
159
174
|
ref: ref ? ref.bind(null, index) : undefined,
|
|
160
|
-
isFocused:
|
|
175
|
+
isFocused: isFocused,
|
|
161
176
|
title: searchableLabel || label,
|
|
162
177
|
checked: checked,
|
|
163
178
|
disabled: disabled,
|
|
164
179
|
prepend: prepend,
|
|
165
180
|
append: append,
|
|
166
|
-
"aria-posinset": _this.ariaPosInSetMap[index],
|
|
167
|
-
"aria-setsize": _this.ariaSetSize,
|
|
181
|
+
"aria-posinset": _this.state.ariaPosInSetMap[index],
|
|
182
|
+
"aria-setsize": _this.state.ariaSetSize,
|
|
168
183
|
onFocusBadge: onFocusBadge,
|
|
169
184
|
allowExclusions: allowExclusions,
|
|
170
185
|
showIcons: showIcons,
|
|
@@ -172,16 +187,18 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
172
187
|
searchable: searchable,
|
|
173
188
|
textWrap: textWrap
|
|
174
189
|
}, optionRest), renderOption ? renderOption( // @ts-ignore complex
|
|
175
|
-
_objectSpread(_objectSpread({}, _option), optionData),
|
|
176
|
-
search: searchValue
|
|
177
|
-
}, label));
|
|
190
|
+
_objectSpread(_objectSpread({}, _option), optionData), searchValue) : searchValue ? _this.renderSearchedText(label, truncationProps) : truncationProps ? _this.renderTruncatedText(label, truncationProps) : label);
|
|
178
191
|
}, _reactWindow.areEqual));
|
|
179
|
-
_defineProperty(_assertThisInitialized(_this), "renderVirtualizedList", function (
|
|
192
|
+
_defineProperty(_assertThisInitialized(_this), "renderVirtualizedList", function () {
|
|
180
193
|
if (!_this.props.isVirtualized) return null;
|
|
194
|
+
var _this$state = _this.state,
|
|
195
|
+
optionArray = _this$state.optionArray,
|
|
196
|
+
itemData = _this$state.itemData;
|
|
181
197
|
var _this$props3 = _this.props,
|
|
182
198
|
windowProps = _this$props3.windowProps,
|
|
183
199
|
forcedHeight = _this$props3.height,
|
|
184
200
|
rowHeight = _this$props3.rowHeight;
|
|
201
|
+
var heightIsFull = forcedHeight === 'full';
|
|
185
202
|
var virtualizationProps = _objectSpread({
|
|
186
203
|
className: 'euiSelectableList__list',
|
|
187
204
|
ref: _this.setListRef,
|
|
@@ -189,7 +206,7 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
189
206
|
innerRef: _this.setListBoxRef,
|
|
190
207
|
innerElementType: 'ul',
|
|
191
208
|
itemCount: optionArray.length,
|
|
192
|
-
itemData:
|
|
209
|
+
itemData: itemData,
|
|
193
210
|
itemSize: rowHeight,
|
|
194
211
|
'data-skip-axe': 'scrollable-region-focusable'
|
|
195
212
|
}, windowProps);
|
|
@@ -209,7 +226,9 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
209
226
|
calculatedHeight = numVisibleOptions * rowHeight;
|
|
210
227
|
}
|
|
211
228
|
}
|
|
212
|
-
return heightIsFull ? (0, _react2.jsx)(_auto_sizer.EuiAutoSizer,
|
|
229
|
+
return heightIsFull ? (0, _react2.jsx)(_auto_sizer.EuiAutoSizer, {
|
|
230
|
+
onResize: _this.calculateDefaultOptionWidth
|
|
231
|
+
}, function (_ref2) {
|
|
213
232
|
var width = _ref2.width,
|
|
214
233
|
height = _ref2.height;
|
|
215
234
|
return (0, _react2.jsx)(_reactWindow.FixedSizeList, _extends({
|
|
@@ -217,7 +236,8 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
217
236
|
height: height
|
|
218
237
|
}, virtualizationProps), _this.ListRow);
|
|
219
238
|
}) : (0, _react2.jsx)(_auto_sizer.EuiAutoSizer, {
|
|
220
|
-
disableHeight: true
|
|
239
|
+
disableHeight: true,
|
|
240
|
+
onResize: _this.calculateDefaultOptionWidth
|
|
221
241
|
}, function (_ref3) {
|
|
222
242
|
var width = _ref3.width;
|
|
223
243
|
return (0, _react2.jsx)(_reactWindow.FixedSizeList, _extends({
|
|
@@ -226,17 +246,106 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
226
246
|
}, virtualizationProps), _this.ListRow);
|
|
227
247
|
});
|
|
228
248
|
});
|
|
249
|
+
_defineProperty(_assertThisInitialized(_this), "forceVirtualizedListRowRerender", function () {
|
|
250
|
+
_this.setState({
|
|
251
|
+
itemData: _objectSpread({}, _this.state.optionArray)
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
// EuiTextTruncate is expensive perf-wise - we use several utilities here to
|
|
255
|
+
// offset its performance cost
|
|
256
|
+
// and creates a resize observer for
|
|
257
|
+
// each individual item. This logic tries to offset this performance hit by
|
|
258
|
+
// guesstimating a default width for each option
|
|
259
|
+
_defineProperty(_assertThisInitialized(_this), "focusBadgeOffset", 0);
|
|
260
|
+
_defineProperty(_assertThisInitialized(_this), "calculateDefaultOptionWidth", function (_ref4) {
|
|
261
|
+
var containerWidth = _ref4.width;
|
|
262
|
+
var _this$props4 = _this.props,
|
|
263
|
+
truncationProps = _this$props4.truncationProps,
|
|
264
|
+
searchable = _this$props4.searchable,
|
|
265
|
+
searchValue = _this$props4.searchValue;
|
|
266
|
+
|
|
267
|
+
// If it's not likely we'll need to use EuiTextTruncate, don't set state/rerender on every panel resize
|
|
268
|
+
var mayTruncate = searchable || truncationProps;
|
|
269
|
+
if (!mayTruncate) return;
|
|
270
|
+
var paddingOffset = _this.props.paddingSize === 'none' ? 0 : 24; // Defaults to 's'
|
|
271
|
+
var checkedIconOffset = _this.props.showIcons === false ? 0 : 28; // Defaults to true
|
|
272
|
+
_this.focusBadgeOffset = _this.props.onFocusBadge === false ? 0 : 46;
|
|
273
|
+
_this.setState({
|
|
274
|
+
defaultOptionWidth: containerWidth - paddingOffset - checkedIconOffset
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
// Potentially force list rows to rerender on dynamic resize as well,
|
|
278
|
+
// but try to do it as lightly as possible
|
|
279
|
+
if (truncationProps || searchable && searchValue) {
|
|
280
|
+
_this.forceVirtualizedListRowRerender();
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
_defineProperty(_assertThisInitialized(_this), "getTruncationProps", function (option, isFocused) {
|
|
284
|
+
// Individual truncation settings should override component-wide settings
|
|
285
|
+
var truncationProps = _objectSpread(_objectSpread({}, _this.props.truncationProps), option.truncationProps);
|
|
286
|
+
|
|
287
|
+
// If we're not actually using EuiTextTruncate, no need to continue
|
|
288
|
+
var hasComplexTruncation = _this.props.searchValue || Object.keys(truncationProps).length > 0;
|
|
289
|
+
if (!hasComplexTruncation) return undefined;
|
|
290
|
+
|
|
291
|
+
// Determine whether we can use the optimized default option width
|
|
292
|
+
var defaultOptionWidth = _this.state.defaultOptionWidth;
|
|
293
|
+
var useDefaultWidth = !option.append && !option.prepend;
|
|
294
|
+
var defaultWidth = useDefaultWidth && defaultOptionWidth ? isFocused ? defaultOptionWidth - _this.focusBadgeOffset : defaultOptionWidth : undefined;
|
|
295
|
+
return _objectSpread({
|
|
296
|
+
width: defaultWidth
|
|
297
|
+
}, truncationProps);
|
|
298
|
+
});
|
|
299
|
+
_defineProperty(_assertThisInitialized(_this), "renderSearchedText", function (text, truncationProps) {
|
|
300
|
+
var searchValue = _this.props.searchValue;
|
|
301
|
+
|
|
302
|
+
// If truncationProps is undefined, we're using non-virtualized text wrapping
|
|
303
|
+
if (!truncationProps) {
|
|
304
|
+
return (0, _react2.jsx)(_highlight.EuiHighlight, {
|
|
305
|
+
search: searchValue
|
|
306
|
+
}, text);
|
|
307
|
+
}
|
|
308
|
+
var searchPositionStart = text.toLowerCase().indexOf(searchValue.toLowerCase());
|
|
309
|
+
var searchPositionCenter = searchPositionStart + Math.floor(searchValue.length / 2);
|
|
310
|
+
return (0, _react2.jsx)(_text_truncate.EuiTextTruncate, _extends({}, truncationProps, {
|
|
311
|
+
// When searching, don't allow overriding the truncation settings
|
|
312
|
+
truncation: "startEnd",
|
|
313
|
+
truncationPosition: searchPositionCenter,
|
|
314
|
+
text: text
|
|
315
|
+
}), function (text) {
|
|
316
|
+
return (0, _react2.jsx)(_react.default.Fragment, null, text.length >= searchValue.length ? (0, _react2.jsx)(_highlight.EuiHighlight, {
|
|
317
|
+
search: searchValue
|
|
318
|
+
}, text) :
|
|
319
|
+
// If the available truncated text is shorter than the full search string,
|
|
320
|
+
// just highlight the entire truncated text
|
|
321
|
+
(0, _react2.jsx)(_mark.EuiMark, null, text));
|
|
322
|
+
});
|
|
323
|
+
});
|
|
324
|
+
_defineProperty(_assertThisInitialized(_this), "renderTruncatedText", function (text, truncationProps) {
|
|
325
|
+
return (
|
|
326
|
+
// For some bizarre reason, truncation in EuiSelectable is off on initial mount
|
|
327
|
+
// (but not on rerender) for Safari and _some_ truncation types in Firefox :|
|
|
328
|
+
// Waiting a tick before calculating truncation seems to smooth over the issue
|
|
329
|
+
(0, _react2.jsx)(_text_truncate.EuiTextTruncate, _extends({
|
|
330
|
+
calculationDelayMs: 2
|
|
331
|
+
}, truncationProps, {
|
|
332
|
+
text: text
|
|
333
|
+
}), function (text) {
|
|
334
|
+
return text;
|
|
335
|
+
})
|
|
336
|
+
);
|
|
337
|
+
});
|
|
229
338
|
_defineProperty(_assertThisInitialized(_this), "onAddOrRemoveOption", function (option, event) {
|
|
230
339
|
if (option.disabled) {
|
|
231
340
|
return;
|
|
232
341
|
}
|
|
233
|
-
var _this$
|
|
234
|
-
allowExclusions = _this$
|
|
235
|
-
options = _this$
|
|
236
|
-
_this$
|
|
237
|
-
visibleOptions = _this$
|
|
238
|
-
_this.props.setActiveOptionIndex(visibleOptions.findIndex(function (
|
|
239
|
-
var label =
|
|
342
|
+
var _this$props5 = _this.props,
|
|
343
|
+
allowExclusions = _this$props5.allowExclusions,
|
|
344
|
+
options = _this$props5.options,
|
|
345
|
+
_this$props5$visibleO = _this$props5.visibleOptions,
|
|
346
|
+
visibleOptions = _this$props5$visibleO === void 0 ? options : _this$props5$visibleO;
|
|
347
|
+
_this.props.setActiveOptionIndex(visibleOptions.findIndex(function (_ref5) {
|
|
348
|
+
var label = _ref5.label;
|
|
240
349
|
return label === option.label;
|
|
241
350
|
}), function () {
|
|
242
351
|
if (option.checked === 'on' && allowExclusions) {
|
|
@@ -249,10 +358,10 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
249
358
|
});
|
|
250
359
|
});
|
|
251
360
|
_defineProperty(_assertThisInitialized(_this), "onAddOption", function (addedOption, event) {
|
|
252
|
-
var _this$
|
|
253
|
-
onOptionClick = _this$
|
|
254
|
-
options = _this$
|
|
255
|
-
singleSelection = _this$
|
|
361
|
+
var _this$props6 = _this.props,
|
|
362
|
+
onOptionClick = _this$props6.onOptionClick,
|
|
363
|
+
options = _this$props6.options,
|
|
364
|
+
singleSelection = _this$props6.singleSelection;
|
|
256
365
|
var changedOption = _objectSpread({}, addedOption);
|
|
257
366
|
var updatedOptions = options.map(function (option) {
|
|
258
367
|
// if singleSelection is enabled, uncheck any selected option(s)
|
|
@@ -271,10 +380,10 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
271
380
|
onOptionClick(updatedOptions, event, changedOption);
|
|
272
381
|
});
|
|
273
382
|
_defineProperty(_assertThisInitialized(_this), "onRemoveOption", function (removedOption, event) {
|
|
274
|
-
var _this$
|
|
275
|
-
onOptionClick = _this$
|
|
276
|
-
singleSelection = _this$
|
|
277
|
-
options = _this$
|
|
383
|
+
var _this$props7 = _this.props,
|
|
384
|
+
onOptionClick = _this$props7.onOptionClick,
|
|
385
|
+
singleSelection = _this$props7.singleSelection,
|
|
386
|
+
options = _this$props7.options;
|
|
278
387
|
var changedOption = _objectSpread({}, removedOption);
|
|
279
388
|
var updatedOptions = options.map(function (option) {
|
|
280
389
|
var updatedOption = _objectSpread({}, option);
|
|
@@ -287,9 +396,9 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
287
396
|
onOptionClick(updatedOptions, event, changedOption);
|
|
288
397
|
});
|
|
289
398
|
_defineProperty(_assertThisInitialized(_this), "onExcludeOption", function (excludedOption, event) {
|
|
290
|
-
var _this$
|
|
291
|
-
onOptionClick = _this$
|
|
292
|
-
options = _this$
|
|
399
|
+
var _this$props8 = _this.props,
|
|
400
|
+
onOptionClick = _this$props8.onOptionClick,
|
|
401
|
+
options = _this$props8.options;
|
|
293
402
|
var changedOption = _objectSpread({}, excludedOption);
|
|
294
403
|
var updatedOptions = options.map(function (option) {
|
|
295
404
|
var updatedOption = _objectSpread({}, option);
|
|
@@ -301,69 +410,83 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
301
410
|
});
|
|
302
411
|
onOptionClick(updatedOptions, event, changedOption);
|
|
303
412
|
});
|
|
413
|
+
var _optionArray = props.visibleOptions || props.options;
|
|
414
|
+
_this.state = _objectSpread({
|
|
415
|
+
defaultOptionWidth: 0,
|
|
416
|
+
optionArray: _optionArray,
|
|
417
|
+
itemData: _objectSpread({}, _optionArray)
|
|
418
|
+
}, _this.calculateAriaSetAttrs(_optionArray));
|
|
304
419
|
return _this;
|
|
305
420
|
}
|
|
306
421
|
_createClass(EuiSelectableList, [{
|
|
307
422
|
key: "componentDidUpdate",
|
|
308
|
-
value: function componentDidUpdate() {
|
|
309
|
-
var
|
|
423
|
+
value: function componentDidUpdate(prevProps) {
|
|
424
|
+
var _this$props9 = this.props,
|
|
425
|
+
activeOptionIndex = _this$props9.activeOptionIndex,
|
|
426
|
+
visibleOptions = _this$props9.visibleOptions,
|
|
427
|
+
options = _this$props9.options;
|
|
310
428
|
if (this.listBoxRef && this.props.searchable !== true) {
|
|
311
429
|
this.listBoxRef.setAttribute('aria-activedescendant', "".concat(this.props.makeOptionId(activeOptionIndex)));
|
|
312
430
|
}
|
|
313
|
-
if (this.listRef && typeof
|
|
314
|
-
this.listRef.scrollToItem(
|
|
431
|
+
if (this.listRef && typeof activeOptionIndex !== 'undefined') {
|
|
432
|
+
this.listRef.scrollToItem(activeOptionIndex, 'auto');
|
|
433
|
+
}
|
|
434
|
+
if (prevProps.visibleOptions !== visibleOptions || prevProps.options !== options) {
|
|
435
|
+
var optionArray = visibleOptions || options;
|
|
436
|
+
this.setState(_objectSpread({
|
|
437
|
+
optionArray: optionArray,
|
|
438
|
+
itemData: _objectSpread({}, optionArray)
|
|
439
|
+
}, this.calculateAriaSetAttrs(optionArray)));
|
|
315
440
|
}
|
|
316
441
|
}
|
|
317
442
|
}, {
|
|
318
443
|
key: "render",
|
|
319
444
|
value: function render() {
|
|
320
445
|
var _this2 = this;
|
|
321
|
-
var _this$
|
|
322
|
-
className = _this$
|
|
323
|
-
options = _this$
|
|
324
|
-
searchValue = _this$
|
|
325
|
-
onOptionClick = _this$
|
|
326
|
-
renderOption = _this$
|
|
327
|
-
forcedHeight = _this$
|
|
328
|
-
windowProps = _this$
|
|
329
|
-
rowHeight = _this$
|
|
330
|
-
activeOptionIndex = _this$
|
|
331
|
-
makeOptionId = _this$
|
|
332
|
-
showIcons = _this$
|
|
333
|
-
singleSelection = _this$
|
|
334
|
-
visibleOptions = _this$
|
|
335
|
-
allowExclusions = _this$
|
|
336
|
-
bordered = _this$
|
|
337
|
-
paddingSize = _this$
|
|
338
|
-
searchable = _this$
|
|
339
|
-
onFocusBadge = _this$
|
|
340
|
-
listId = _this$
|
|
341
|
-
setActiveOptionIndex = _this$
|
|
342
|
-
ariaLabel = _this$
|
|
343
|
-
ariaLabelledby = _this$
|
|
344
|
-
ariaDescribedby = _this$
|
|
345
|
-
role = _this$
|
|
346
|
-
isVirtualized = _this$
|
|
347
|
-
textWrap = _this$
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
this.calculateAriaSetAttrs(optionArray);
|
|
351
|
-
var heightIsFull = forcedHeight === 'full';
|
|
446
|
+
var _this$props10 = this.props,
|
|
447
|
+
className = _this$props10.className,
|
|
448
|
+
options = _this$props10.options,
|
|
449
|
+
searchValue = _this$props10.searchValue,
|
|
450
|
+
onOptionClick = _this$props10.onOptionClick,
|
|
451
|
+
renderOption = _this$props10.renderOption,
|
|
452
|
+
forcedHeight = _this$props10.height,
|
|
453
|
+
windowProps = _this$props10.windowProps,
|
|
454
|
+
rowHeight = _this$props10.rowHeight,
|
|
455
|
+
activeOptionIndex = _this$props10.activeOptionIndex,
|
|
456
|
+
makeOptionId = _this$props10.makeOptionId,
|
|
457
|
+
showIcons = _this$props10.showIcons,
|
|
458
|
+
singleSelection = _this$props10.singleSelection,
|
|
459
|
+
visibleOptions = _this$props10.visibleOptions,
|
|
460
|
+
allowExclusions = _this$props10.allowExclusions,
|
|
461
|
+
bordered = _this$props10.bordered,
|
|
462
|
+
paddingSize = _this$props10.paddingSize,
|
|
463
|
+
searchable = _this$props10.searchable,
|
|
464
|
+
onFocusBadge = _this$props10.onFocusBadge,
|
|
465
|
+
listId = _this$props10.listId,
|
|
466
|
+
setActiveOptionIndex = _this$props10.setActiveOptionIndex,
|
|
467
|
+
ariaLabel = _this$props10['aria-label'],
|
|
468
|
+
ariaLabelledby = _this$props10['aria-labelledby'],
|
|
469
|
+
ariaDescribedby = _this$props10['aria-describedby'],
|
|
470
|
+
role = _this$props10.role,
|
|
471
|
+
isVirtualized = _this$props10.isVirtualized,
|
|
472
|
+
textWrap = _this$props10.textWrap,
|
|
473
|
+
truncationProps = _this$props10.truncationProps,
|
|
474
|
+
rest = _objectWithoutProperties(_this$props10, _excluded3);
|
|
352
475
|
var classes = (0, _classnames.default)('euiSelectableList', {
|
|
353
|
-
'euiSelectableList-fullHeight':
|
|
476
|
+
'euiSelectableList-fullHeight': forcedHeight === 'full',
|
|
354
477
|
'euiSelectableList-bordered': bordered
|
|
355
478
|
}, className);
|
|
356
479
|
return (0, _react2.jsx)("div", _extends({
|
|
357
480
|
className: classes
|
|
358
|
-
}, rest), isVirtualized ? this.renderVirtualizedList(
|
|
481
|
+
}, rest), isVirtualized ? this.renderVirtualizedList() : (0, _react2.jsx)("div", {
|
|
359
482
|
className: "euiSelectableList__list",
|
|
360
483
|
ref: this.removeScrollableTabStop
|
|
361
484
|
}, (0, _react2.jsx)("ul", {
|
|
362
485
|
ref: this.setListBoxRef
|
|
363
|
-
}, optionArray.map(function (_, index) {
|
|
486
|
+
}, this.state.optionArray.map(function (_, index) {
|
|
364
487
|
return /*#__PURE__*/_react.default.createElement(_this2.ListRow, {
|
|
365
488
|
key: index,
|
|
366
|
-
data: optionArray,
|
|
489
|
+
data: _this2.state.optionArray,
|
|
367
490
|
index: index
|
|
368
491
|
}, null);
|
|
369
492
|
}))));
|
|
@@ -461,6 +584,15 @@ EuiSelectableList.propTypes = {
|
|
|
461
584
|
* Wrapping only works if virtualization is off.
|
|
462
585
|
*/
|
|
463
586
|
textWrap: _propTypes.default.oneOf(["truncate", "wrap"]),
|
|
587
|
+
/**
|
|
588
|
+
* If textWrap is set to `truncate`, you can pass a custom truncation configuration
|
|
589
|
+
* that accepts any [EuiTextTruncate](/#/utilities/text-truncation) prop except for
|
|
590
|
+
* `text` and `children`.
|
|
591
|
+
*
|
|
592
|
+
* Note: when searching, custom truncation props are ignored. The highlighted search
|
|
593
|
+
* text will always take precedence.
|
|
594
|
+
*/
|
|
595
|
+
truncationProps: _propTypes.default.any,
|
|
464
596
|
/**
|
|
465
597
|
* Use virtualized rendering for list items with `react-window`.
|
|
466
598
|
* Sets each row's height to the value of `rowHeight`.
|
|
@@ -519,7 +651,22 @@ EuiSelectableList.propTypes = {
|
|
|
519
651
|
* Option data to pass through to the `renderOptions` element.
|
|
520
652
|
* Bypass `EuiSelectableItem` and avoid DOM attribute warnings.
|
|
521
653
|
*/
|
|
522
|
-
data: _propTypes.default.shape({})
|
|
654
|
+
data: _propTypes.default.shape({}),
|
|
655
|
+
/**
|
|
656
|
+
* How to handle long text within the item.
|
|
657
|
+
* Wrapping only works if `isVirtualization` is false.
|
|
658
|
+
* @default 'truncate'
|
|
659
|
+
*/
|
|
660
|
+
textWrap: _propTypes.default.oneOf(["truncate", "wrap"]),
|
|
661
|
+
/**
|
|
662
|
+
* If textWrap is set to `truncate`, you can pass a custom truncation configuration
|
|
663
|
+
* that accepts any [EuiTextTruncate](/#/utilities/text-truncation) prop except for
|
|
664
|
+
* `text` and `children`.
|
|
665
|
+
*
|
|
666
|
+
* Note: when searching, custom truncation props are ignored. The highlighted search
|
|
667
|
+
* text will always take precedence.
|
|
668
|
+
*/
|
|
669
|
+
truncationProps: _propTypes.default.any
|
|
523
670
|
}).isRequired).isRequired,
|
|
524
671
|
/**
|
|
525
672
|
* Filtered options list (if applicable)
|
|
@@ -538,7 +685,9 @@ EuiSelectableList.propTypes = {
|
|
|
538
685
|
prepend: _propTypes.default.node,
|
|
539
686
|
append: _propTypes.default.node,
|
|
540
687
|
ref: _propTypes.default.func,
|
|
541
|
-
data: _propTypes.default.shape({})
|
|
688
|
+
data: _propTypes.default.shape({}),
|
|
689
|
+
textWrap: _propTypes.default.oneOf(["truncate", "wrap"]),
|
|
690
|
+
truncationProps: _propTypes.default.any
|
|
542
691
|
}).isRequired),
|
|
543
692
|
/**
|
|
544
693
|
* Search value to highlight on the option render
|
|
@@ -399,7 +399,22 @@ EuiSelectableTemplateSitewide.propTypes = {
|
|
|
399
399
|
* Option data to pass through to the `renderOptions` element.
|
|
400
400
|
* Bypass `EuiSelectableItem` and avoid DOM attribute warnings.
|
|
401
401
|
*/
|
|
402
|
-
data: _propTypes.default.shape({})
|
|
402
|
+
data: _propTypes.default.shape({}),
|
|
403
|
+
/**
|
|
404
|
+
* How to handle long text within the item.
|
|
405
|
+
* Wrapping only works if `isVirtualization` is false.
|
|
406
|
+
* @default 'truncate'
|
|
407
|
+
*/
|
|
408
|
+
textWrap: _propTypes.default.oneOf(["truncate", "wrap"]),
|
|
409
|
+
/**
|
|
410
|
+
* If textWrap is set to `truncate`, you can pass a custom truncation configuration
|
|
411
|
+
* that accepts any [EuiTextTruncate](/#/utilities/text-truncation) prop except for
|
|
412
|
+
* `text` and `children`.
|
|
413
|
+
*
|
|
414
|
+
* Note: when searching, custom truncation props are ignored. The highlighted search
|
|
415
|
+
* text will always take precedence.
|
|
416
|
+
*/
|
|
417
|
+
truncationProps: _propTypes.default.any
|
|
403
418
|
}).isRequired).isRequired,
|
|
404
419
|
/**
|
|
405
420
|
* Override some of the EuiPopover props housing the list.
|
|
@@ -61,7 +61,7 @@ var euiScaleText = function euiScaleText(euiThemeContext, options) {
|
|
|
61
61
|
var blockQuoteBorderWidth = (0, _global_styling.mathWithUnits)(fontSize, function (x) {
|
|
62
62
|
return x / 4;
|
|
63
63
|
});
|
|
64
|
-
return "\n font-size: ".concat(fontSize, ";\n line-height: ").concat(lineHeight, ";\n\n h1 {\n font-size: ").concat(headings.h1.fontSize, ";\n line-height: ").concat(headings.h1.lineHeight, ";\n }\n h1:not(:last-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-bottom', headingMarginBottom), "\n }\n\n h2 {\n font-size: ").concat(headings.h2.fontSize, ";\n line-height: ").concat(headings.h2.lineHeight, ";\n\n &:not(:first-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-bottom', headingMarginBottom), "\n }\n }\n\n h3 {\n font-size: ").concat(headings.h3.fontSize, ";\n line-height: ").concat(headings.h3.lineHeight, ";\n\n &:not(:first-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-bottom', headingMarginBottom), "\n }\n }\n\n h4 {\n font-size: ").concat(headings.h4.fontSize, ";\n line-height: ").concat(headings.h4.lineHeight, ";\n\n &:not(:first-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-bottom', headingMarginBottom), "\n }\n }\n\n h5 {\n font-size: ").concat(headings.h5.fontSize, ";\n line-height: ").concat(headings.h5.lineHeight, ";\n\n &:not(:first-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-bottom', headingMarginBottom), "\n }\n }\n\n h6 {\n font-size: ").concat(headings.h6.fontSize, ";\n line-height: ").concat(headings.h6.lineHeight, ";\n\n &:not(:first-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-bottom', headingMarginBottom), "\n }\n }\n\n p,\n dl,\n blockquote,\n
|
|
64
|
+
return "\n font-size: ".concat(fontSize, ";\n line-height: ").concat(lineHeight, ";\n\n h1 {\n font-size: ").concat(headings.h1.fontSize, ";\n line-height: ").concat(headings.h1.lineHeight, ";\n }\n h1:not(:last-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-bottom', headingMarginBottom), "\n }\n\n h2 {\n font-size: ").concat(headings.h2.fontSize, ";\n line-height: ").concat(headings.h2.lineHeight, ";\n\n &:not(:first-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-bottom', headingMarginBottom), "\n }\n }\n\n h3 {\n font-size: ").concat(headings.h3.fontSize, ";\n line-height: ").concat(headings.h3.lineHeight, ";\n\n &:not(:first-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-bottom', headingMarginBottom), "\n }\n }\n\n h4 {\n font-size: ").concat(headings.h4.fontSize, ";\n line-height: ").concat(headings.h4.lineHeight, ";\n\n &:not(:first-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-bottom', headingMarginBottom), "\n }\n }\n\n h5 {\n font-size: ").concat(headings.h5.fontSize, ";\n line-height: ").concat(headings.h5.lineHeight, ";\n\n &:not(:first-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-bottom', headingMarginBottom), "\n }\n }\n\n h6 {\n font-size: ").concat(headings.h6.fontSize, ";\n line-height: ").concat(headings.h6.lineHeight, ";\n\n &:not(:first-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat((0, _global_styling.logicalCSS)('margin-bottom', headingMarginBottom), "\n }\n }\n\n p,\n dl,\n blockquote,\n pre,\n > ul,\n > ol {\n ").concat((0, _global_styling.logicalCSS)('margin-bottom', lineHeightSize), "\n }\n\n ul,\n ol {\n ").concat((0, _global_styling.logicalCSS)('margin-left', lineHeightSize), "\n }\n\n /* The styles of the nested ordered lists follow the style of GitHub\n which is commonly used in Markdown or MDX formatting. */\n ol ol,\n ul ol {\n list-style-type: lower-roman;\n }\n\n ul ul ol,\n ul ol ol,\n ol ul ol,\n ol ol ol {\n list-style-type: lower-alpha;\n }\n \n blockquote {\n font-size: ").concat(fontSize, ";\n ").concat((0, _global_styling.logicalShorthandCSS)('padding', "0 ".concat(fontSize)), "\n ").concat((0, _global_styling.logicalCSS)('border-left-width', blockQuoteBorderWidth), "\n ").concat((0, _global_styling.logicalCSS)('margin-bottom', fontSize), "\n }\n\n dd + dt {\n ").concat((0, _global_styling.logicalCSS)('margin-top', fontSize), "\n }\n\n dt,\n .eui-definitionListReverse dd {\n font-size: ").concat(fontSize, ";\n line-height: ").concat(lineHeight, ";\n }\n\n .eui-definitionListReverse dt {\n font-size: ").concat((0, _global_styling.euiFontSize)(euiThemeContext, 'xs', options).fontSize, ";\n color: ").concat(euiTheme.colors.text, ";\n }\n\n small {\n font-size: ").concat((0, _global_styling.euiFontSize)(euiThemeContext, 's', options).fontSize, ";\n }\n\n pre:not(.euiCodeBlock__pre) {\n padding: ").concat(lineHeightSize, ";\n }\n\n code:not(.euiCode):not(.euiCodeBlock__code) {\n font-size: .9em; /* 90% of parent font size */\n }\n ").concat(
|
|
65
65
|
// when textSize is 'm', the 'kbd' element gets a line between the text and the border-bottom
|
|
66
66
|
_customScale === 'm' ? "\n kbd {\n ".concat((0, _global_styling.logicalCSS)('padding-bottom', euiTheme.size.xs), "\n /* Ensures the shape still looks like a square when only one character */\n ").concat((0, _global_styling.logicalCSS)('min-width', euiTheme.size.l), "\n ").concat((0, _global_styling.logicalTextAlignCSS)('center'), "\n }\n \n kbd::after {\n content: '';\n ").concat((0, _global_styling.logicalCSS)('border-bottom', "".concat(euiTheme.border.width.thin, " solid ").concat(euiTheme.colors.text)), "\n position: absolute;\n ").concat((0, _global_styling.logicalCSS)('bottom', euiTheme.size.xxs), "\n ").concat((0, _global_styling.logicalCSS)('left', 0), "\n ").concat((0, _global_styling.logicalCSS)('width', '100%'), "\n }") : '', "\n ");
|
|
67
67
|
};
|
|
@@ -72,7 +72,7 @@ var euiScaleText = function euiScaleText(euiThemeContext, options) {
|
|
|
72
72
|
var euiTextStyles = function euiTextStyles(euiThemeContext) {
|
|
73
73
|
var euiTheme = euiThemeContext.euiTheme;
|
|
74
74
|
return {
|
|
75
|
-
euiText: /*#__PURE__*/(0, _react.css)(euiText(euiTheme, true), "clear:both;a:not([class]){", (0, _link.euiLinkCSS)(euiThemeContext), ";}
|
|
75
|
+
euiText: /*#__PURE__*/(0, _react.css)(euiText(euiTheme, true), "clear:both;a:not([class]){", (0, _link.euiLinkCSS)(euiThemeContext), ";}ul{list-style:disc;}ol{list-style:decimal;}blockquote{border-inline-start-color:", euiTheme.border.color, ";border-inline-start-style:solid;}blockquote:not(.euiMarkdownFormat__blockquote){color:", euiTheme.colors.subduedText, ";}h1{", (0, _title.euiTitle)(euiThemeContext, 'l'), ";}h2{", (0, _title.euiTitle)(euiThemeContext, 'm'), ";}h3{", (0, _title.euiTitle)(euiThemeContext, 's'), ";}h4,dt{", (0, _title.euiTitle)(euiThemeContext, 'xs'), ";}h5{", (0, _title.euiTitle)(euiThemeContext, 'xxs'), ";}h6{", (0, _title.euiTitle)(euiThemeContext, 'xxxs'), " text-transform:uppercase;}h1,h2,h3,h4,h5,h6,dt{color:inherit;}pre:not(.euiCodeBlock__pre){white-space:pre-wrap;background:", (0, _global_styling.euiBackgroundColor)(euiThemeContext, 'subdued'), ";color:", euiTheme.colors.text, ";}pre:not(.euiCodeBlock__pre),pre:not(.euiCodeBlock__pre) code{display:block;}>:last-child{", (0, _global_styling.logicalCSS)('margin-bottom', '0 !important'), ";}kbd{position:relative;display:inline-block;", (0, _global_styling.logicalCSS)('padding-vertical', euiTheme.size.xxs), " ", (0, _global_styling.logicalCSS)('padding-horizontal', euiTheme.size.xs), " line-height:1;border:", euiTheme.border.width.thin, " solid ", euiTheme.colors.text, ";border-radius:", (0, _global_styling.mathWithUnits)(euiTheme.border.radius.small, function (x) {
|
|
76
76
|
return x / 2;
|
|
77
77
|
}), ";};label:euiText;"),
|
|
78
78
|
constrainedWidth: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('max-width', euiTextConstrainedMaxWidth), ";;label:constrainedWidth;"),
|
|
@@ -14,7 +14,7 @@ var _utils = require("./utils");
|
|
|
14
14
|
var _text_truncate = require("./text_truncate.styles");
|
|
15
15
|
var _react2 = require("@emotion/react");
|
|
16
16
|
var _excluded = ["width", "onResize"],
|
|
17
|
-
_excluded2 = ["width", "children", "text", "truncation", "truncationOffset", "truncationPosition", "ellipsis", "containerRef", "className"],
|
|
17
|
+
_excluded2 = ["width", "children", "text", "truncation", "truncationOffset", "truncationPosition", "ellipsis", "calculationDelayMs", "containerRef", "className"],
|
|
18
18
|
_excluded3 = ["onResize"];
|
|
19
19
|
/*
|
|
20
20
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
@@ -108,7 +108,13 @@ EuiTextTruncate.propTypes = {
|
|
|
108
108
|
* allows for more flexible text rendering, e.g. adding custom markup
|
|
109
109
|
* or highlighting
|
|
110
110
|
*/
|
|
111
|
-
children: _propTypes.default.func
|
|
111
|
+
children: _propTypes.default.func,
|
|
112
|
+
/**
|
|
113
|
+
* For some edge case scenarios, EuiTextTruncate's calculations may be off until
|
|
114
|
+
* fonts are done loading or layout is done shifting or settling. Adding a delay
|
|
115
|
+
* may help resolve any rendering issues.
|
|
116
|
+
*/
|
|
117
|
+
calculationDelayMs: _propTypes.default.number
|
|
112
118
|
};
|
|
113
119
|
var EuiTextTruncateWithWidth = function EuiTextTruncateWithWidth(_ref2) {
|
|
114
120
|
var width = _ref2.width,
|
|
@@ -121,6 +127,7 @@ var EuiTextTruncateWithWidth = function EuiTextTruncateWithWidth(_ref2) {
|
|
|
121
127
|
truncationPosition = _ref2.truncationPosition,
|
|
122
128
|
_ref2$ellipsis = _ref2.ellipsis,
|
|
123
129
|
ellipsis = _ref2$ellipsis === void 0 ? '…' : _ref2$ellipsis,
|
|
130
|
+
calculationDelayMs = _ref2.calculationDelayMs,
|
|
124
131
|
containerRef = _ref2.containerRef,
|
|
125
132
|
className = _ref2.className,
|
|
126
133
|
rest = _objectWithoutProperties(_ref2, _excluded2);
|
|
@@ -131,6 +138,19 @@ var EuiTextTruncateWithWidth = function EuiTextTruncateWithWidth(_ref2) {
|
|
|
131
138
|
setContainerEl = _useState2[1];
|
|
132
139
|
var refs = (0, _services.useCombinedRefs)([setContainerEl, containerRef]);
|
|
133
140
|
|
|
141
|
+
// If necessary, wait a tick on mount before truncating
|
|
142
|
+
var _useState3 = (0, _react.useState)(!calculationDelayMs),
|
|
143
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
144
|
+
ready = _useState4[0],
|
|
145
|
+
setReady = _useState4[1];
|
|
146
|
+
(0, _react.useEffect)(function () {
|
|
147
|
+
if (calculationDelayMs) {
|
|
148
|
+
setTimeout(function () {
|
|
149
|
+
return setReady(true);
|
|
150
|
+
}, calculationDelayMs);
|
|
151
|
+
}
|
|
152
|
+
}, [calculationDelayMs]);
|
|
153
|
+
|
|
134
154
|
// Handle exceptions where we need to override the passed props
|
|
135
155
|
var _useMemo = (0, _react.useMemo)(function () {
|
|
136
156
|
var truncation = _truncation;
|
|
@@ -155,7 +175,8 @@ var EuiTextTruncateWithWidth = function EuiTextTruncateWithWidth(_ref2) {
|
|
|
155
175
|
truncationOffset = _useMemo.truncationOffset;
|
|
156
176
|
var truncatedText = (0, _react.useMemo)(function () {
|
|
157
177
|
var truncatedText = '';
|
|
158
|
-
if (!
|
|
178
|
+
if (!ready || !containerEl) return text;
|
|
179
|
+
if (!width) return truncatedText;
|
|
159
180
|
var utils = new _utils.TruncationUtils({
|
|
160
181
|
fullText: text,
|
|
161
182
|
ellipsis: ellipsis,
|
|
@@ -187,7 +208,7 @@ var EuiTextTruncateWithWidth = function EuiTextTruncateWithWidth(_ref2) {
|
|
|
187
208
|
}
|
|
188
209
|
}
|
|
189
210
|
return truncatedText;
|
|
190
|
-
}, [width, text, truncation, truncationOffset, truncationPosition, ellipsis, containerEl]);
|
|
211
|
+
}, [ready, width, text, truncation, truncationOffset, truncationPosition, ellipsis, containerEl]);
|
|
191
212
|
var isTruncating = truncatedText !== text;
|
|
192
213
|
return (0, _react2.jsx)("div", _extends({
|
|
193
214
|
className: (0, _classnames.default)('euiTextTruncate', className),
|
|
@@ -215,10 +236,10 @@ EuiTextTruncateWithWidth.propTypes = {
|
|
|
215
236
|
var EuiTextTruncateWithResizeObserver = function EuiTextTruncateWithResizeObserver(_ref3) {
|
|
216
237
|
var _onResize = _ref3.onResize,
|
|
217
238
|
props = _objectWithoutProperties(_ref3, _excluded3);
|
|
218
|
-
var
|
|
219
|
-
|
|
220
|
-
width =
|
|
221
|
-
setWidth =
|
|
239
|
+
var _useState5 = (0, _react.useState)(0),
|
|
240
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
241
|
+
width = _useState6[0],
|
|
242
|
+
setWidth = _useState6[1];
|
|
222
243
|
var onResize = (0, _react.useCallback)(function (_ref4) {
|
|
223
244
|
var width = _ref4.width;
|
|
224
245
|
setWidth(width);
|
|
@@ -230,6 +251,8 @@ var EuiTextTruncateWithResizeObserver = function EuiTextTruncateWithResizeObserv
|
|
|
230
251
|
return (0, _react2.jsx)(EuiTextTruncateWithWidth, _extends({
|
|
231
252
|
width: width,
|
|
232
253
|
containerRef: ref
|
|
233
|
-
}, props
|
|
254
|
+
}, props, {
|
|
255
|
+
"data-resize-observer": "true"
|
|
256
|
+
}));
|
|
234
257
|
});
|
|
235
258
|
};
|