@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
|
@@ -21,11 +21,13 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
21
21
|
var _reactWindow = require("react-window");
|
|
22
22
|
var _auto_sizer = require("../../auto_sizer");
|
|
23
23
|
var _highlight = require("../../highlight");
|
|
24
|
+
var _mark = require("../../mark");
|
|
25
|
+
var _text_truncate = require("../../text_truncate");
|
|
24
26
|
var _selectable_list_item = require("./selectable_list_item");
|
|
25
27
|
var _react2 = require("@emotion/react");
|
|
26
28
|
var _excluded = ["data"],
|
|
27
|
-
_excluded2 = ["label", "isGroupLabel", "checked", "disabled", "prepend", "append", "ref", "key", "searchableLabel", "data"],
|
|
28
|
-
_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"];
|
|
29
|
+
_excluded2 = ["label", "isGroupLabel", "checked", "disabled", "prepend", "append", "ref", "key", "searchableLabel", "data", "truncationProps"],
|
|
30
|
+
_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"];
|
|
29
31
|
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); }
|
|
30
32
|
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; }
|
|
31
33
|
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; }
|
|
@@ -88,20 +90,23 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
88
90
|
}
|
|
89
91
|
}
|
|
90
92
|
});
|
|
91
|
-
|
|
92
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "ariaPosInSetMap", {});
|
|
93
|
+
// This utility is necessary to exclude group labels from the aria set count
|
|
93
94
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "calculateAriaSetAttrs", function (optionArray) {
|
|
94
|
-
|
|
95
|
+
var ariaPosInSetMap = {};
|
|
95
96
|
var latestAriaPosIndex = 0;
|
|
96
97
|
optionArray.forEach(function (option, index) {
|
|
97
98
|
if (!option.isGroupLabel) {
|
|
98
99
|
latestAriaPosIndex++;
|
|
99
|
-
|
|
100
|
+
ariaPosInSetMap[index] = latestAriaPosIndex;
|
|
100
101
|
}
|
|
101
102
|
});
|
|
102
|
-
|
|
103
|
+
return {
|
|
104
|
+
ariaPosInSetMap: ariaPosInSetMap,
|
|
105
|
+
ariaSetSize: latestAriaPosIndex
|
|
106
|
+
};
|
|
103
107
|
});
|
|
104
108
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "ListRow", /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
109
|
+
var _option$textWrap;
|
|
105
110
|
var data = _ref.data,
|
|
106
111
|
index = _ref.index,
|
|
107
112
|
style = _ref.style;
|
|
@@ -118,19 +123,20 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
118
123
|
key = option.key,
|
|
119
124
|
searchableLabel = option.searchableLabel,
|
|
120
125
|
_data = option.data,
|
|
126
|
+
_truncationProps = option.truncationProps,
|
|
121
127
|
optionRest = (0, _objectWithoutProperties2.default)(option, _excluded2);
|
|
122
128
|
var _this$props2 = _this.props,
|
|
123
129
|
activeOptionIndex = _this$props2.activeOptionIndex,
|
|
124
130
|
allowExclusions = _this$props2.allowExclusions,
|
|
125
131
|
onFocusBadge = _this$props2.onFocusBadge,
|
|
126
132
|
paddingSize = _this$props2.paddingSize,
|
|
127
|
-
searchValue = _this$props2.searchValue,
|
|
128
133
|
showIcons = _this$props2.showIcons,
|
|
129
134
|
makeOptionId = _this$props2.makeOptionId,
|
|
130
135
|
renderOption = _this$props2.renderOption,
|
|
131
136
|
setActiveOptionIndex = _this$props2.setActiveOptionIndex,
|
|
132
137
|
searchable = _this$props2.searchable,
|
|
133
|
-
|
|
138
|
+
searchValue = _this$props2.searchValue,
|
|
139
|
+
isVirtualized = _this$props2.isVirtualized;
|
|
134
140
|
if (isGroupLabel) {
|
|
135
141
|
return (0, _react2.jsx)("li", (0, _extends2.default)({
|
|
136
142
|
role: "presentation",
|
|
@@ -140,6 +146,15 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
140
146
|
}, optionRest), prepend, label, append);
|
|
141
147
|
}
|
|
142
148
|
var id = makeOptionId(index);
|
|
149
|
+
var isFocused = activeOptionIndex === index;
|
|
150
|
+
|
|
151
|
+
// Text wrapping
|
|
152
|
+
var canWrap = !isVirtualized;
|
|
153
|
+
var _textWrap = (_option$textWrap = option.textWrap) !== null && _option$textWrap !== void 0 ? _option$textWrap : _this.props.textWrap;
|
|
154
|
+
var textWrap = canWrap ? _textWrap : 'truncate';
|
|
155
|
+
|
|
156
|
+
// Truncation config (if any). If none, CSS truncation is used
|
|
157
|
+
var truncationProps = textWrap === 'truncate' ? _this.getTruncationProps(option, isFocused) : undefined;
|
|
143
158
|
return (0, _react2.jsx)(_selectable_list_item.EuiSelectableListItem, (0, _extends2.default)({
|
|
144
159
|
key: id,
|
|
145
160
|
id: id,
|
|
@@ -152,14 +167,14 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
152
167
|
_this.onAddOrRemoveOption(option, event);
|
|
153
168
|
},
|
|
154
169
|
ref: ref ? ref.bind(null, index) : undefined,
|
|
155
|
-
isFocused:
|
|
170
|
+
isFocused: isFocused,
|
|
156
171
|
title: searchableLabel || label,
|
|
157
172
|
checked: checked,
|
|
158
173
|
disabled: disabled,
|
|
159
174
|
prepend: prepend,
|
|
160
175
|
append: append,
|
|
161
|
-
"aria-posinset": _this.ariaPosInSetMap[index],
|
|
162
|
-
"aria-setsize": _this.ariaSetSize,
|
|
176
|
+
"aria-posinset": _this.state.ariaPosInSetMap[index],
|
|
177
|
+
"aria-setsize": _this.state.ariaSetSize,
|
|
163
178
|
onFocusBadge: onFocusBadge,
|
|
164
179
|
allowExclusions: allowExclusions,
|
|
165
180
|
showIcons: showIcons,
|
|
@@ -167,16 +182,18 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
167
182
|
searchable: searchable,
|
|
168
183
|
textWrap: textWrap
|
|
169
184
|
}, optionRest), renderOption ? renderOption( // @ts-ignore complex
|
|
170
|
-
_objectSpread(_objectSpread({}, _option), optionData),
|
|
171
|
-
search: searchValue
|
|
172
|
-
}, label));
|
|
185
|
+
_objectSpread(_objectSpread({}, _option), optionData), searchValue) : searchValue ? _this.renderSearchedText(label, truncationProps) : truncationProps ? _this.renderTruncatedText(label, truncationProps) : label);
|
|
173
186
|
}, _reactWindow.areEqual));
|
|
174
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderVirtualizedList", function (
|
|
187
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderVirtualizedList", function () {
|
|
175
188
|
if (!_this.props.isVirtualized) return null;
|
|
189
|
+
var _this$state = _this.state,
|
|
190
|
+
optionArray = _this$state.optionArray,
|
|
191
|
+
itemData = _this$state.itemData;
|
|
176
192
|
var _this$props3 = _this.props,
|
|
177
193
|
windowProps = _this$props3.windowProps,
|
|
178
194
|
forcedHeight = _this$props3.height,
|
|
179
195
|
rowHeight = _this$props3.rowHeight;
|
|
196
|
+
var heightIsFull = forcedHeight === 'full';
|
|
180
197
|
var virtualizationProps = _objectSpread({
|
|
181
198
|
className: 'euiSelectableList__list',
|
|
182
199
|
ref: _this.setListRef,
|
|
@@ -184,7 +201,7 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
184
201
|
innerRef: _this.setListBoxRef,
|
|
185
202
|
innerElementType: 'ul',
|
|
186
203
|
itemCount: optionArray.length,
|
|
187
|
-
itemData:
|
|
204
|
+
itemData: itemData,
|
|
188
205
|
itemSize: rowHeight,
|
|
189
206
|
'data-skip-axe': 'scrollable-region-focusable'
|
|
190
207
|
}, windowProps);
|
|
@@ -204,7 +221,9 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
204
221
|
calculatedHeight = numVisibleOptions * rowHeight;
|
|
205
222
|
}
|
|
206
223
|
}
|
|
207
|
-
return heightIsFull ? (0, _react2.jsx)(_auto_sizer.EuiAutoSizer,
|
|
224
|
+
return heightIsFull ? (0, _react2.jsx)(_auto_sizer.EuiAutoSizer, {
|
|
225
|
+
onResize: _this.calculateDefaultOptionWidth
|
|
226
|
+
}, function (_ref2) {
|
|
208
227
|
var width = _ref2.width,
|
|
209
228
|
height = _ref2.height;
|
|
210
229
|
return (0, _react2.jsx)(_reactWindow.FixedSizeList, (0, _extends2.default)({
|
|
@@ -212,7 +231,8 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
212
231
|
height: height
|
|
213
232
|
}, virtualizationProps), _this.ListRow);
|
|
214
233
|
}) : (0, _react2.jsx)(_auto_sizer.EuiAutoSizer, {
|
|
215
|
-
disableHeight: true
|
|
234
|
+
disableHeight: true,
|
|
235
|
+
onResize: _this.calculateDefaultOptionWidth
|
|
216
236
|
}, function (_ref3) {
|
|
217
237
|
var width = _ref3.width;
|
|
218
238
|
return (0, _react2.jsx)(_reactWindow.FixedSizeList, (0, _extends2.default)({
|
|
@@ -221,17 +241,106 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
221
241
|
}, virtualizationProps), _this.ListRow);
|
|
222
242
|
});
|
|
223
243
|
});
|
|
244
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "forceVirtualizedListRowRerender", function () {
|
|
245
|
+
_this.setState({
|
|
246
|
+
itemData: _objectSpread({}, _this.state.optionArray)
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
// EuiTextTruncate is expensive perf-wise - we use several utilities here to
|
|
250
|
+
// offset its performance cost
|
|
251
|
+
// and creates a resize observer for
|
|
252
|
+
// each individual item. This logic tries to offset this performance hit by
|
|
253
|
+
// guesstimating a default width for each option
|
|
254
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "focusBadgeOffset", 0);
|
|
255
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "calculateDefaultOptionWidth", function (_ref4) {
|
|
256
|
+
var containerWidth = _ref4.width;
|
|
257
|
+
var _this$props4 = _this.props,
|
|
258
|
+
truncationProps = _this$props4.truncationProps,
|
|
259
|
+
searchable = _this$props4.searchable,
|
|
260
|
+
searchValue = _this$props4.searchValue;
|
|
261
|
+
|
|
262
|
+
// If it's not likely we'll need to use EuiTextTruncate, don't set state/rerender on every panel resize
|
|
263
|
+
var mayTruncate = searchable || truncationProps;
|
|
264
|
+
if (!mayTruncate) return;
|
|
265
|
+
var paddingOffset = _this.props.paddingSize === 'none' ? 0 : 24; // Defaults to 's'
|
|
266
|
+
var checkedIconOffset = _this.props.showIcons === false ? 0 : 28; // Defaults to true
|
|
267
|
+
_this.focusBadgeOffset = _this.props.onFocusBadge === false ? 0 : 46;
|
|
268
|
+
_this.setState({
|
|
269
|
+
defaultOptionWidth: containerWidth - paddingOffset - checkedIconOffset
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
// Potentially force list rows to rerender on dynamic resize as well,
|
|
273
|
+
// but try to do it as lightly as possible
|
|
274
|
+
if (truncationProps || searchable && searchValue) {
|
|
275
|
+
_this.forceVirtualizedListRowRerender();
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getTruncationProps", function (option, isFocused) {
|
|
279
|
+
// Individual truncation settings should override component-wide settings
|
|
280
|
+
var truncationProps = _objectSpread(_objectSpread({}, _this.props.truncationProps), option.truncationProps);
|
|
281
|
+
|
|
282
|
+
// If we're not actually using EuiTextTruncate, no need to continue
|
|
283
|
+
var hasComplexTruncation = _this.props.searchValue || Object.keys(truncationProps).length > 0;
|
|
284
|
+
if (!hasComplexTruncation) return undefined;
|
|
285
|
+
|
|
286
|
+
// Determine whether we can use the optimized default option width
|
|
287
|
+
var defaultOptionWidth = _this.state.defaultOptionWidth;
|
|
288
|
+
var useDefaultWidth = !option.append && !option.prepend;
|
|
289
|
+
var defaultWidth = useDefaultWidth && defaultOptionWidth ? isFocused ? defaultOptionWidth - _this.focusBadgeOffset : defaultOptionWidth : undefined;
|
|
290
|
+
return _objectSpread({
|
|
291
|
+
width: defaultWidth
|
|
292
|
+
}, truncationProps);
|
|
293
|
+
});
|
|
294
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderSearchedText", function (text, truncationProps) {
|
|
295
|
+
var searchValue = _this.props.searchValue;
|
|
296
|
+
|
|
297
|
+
// If truncationProps is undefined, we're using non-virtualized text wrapping
|
|
298
|
+
if (!truncationProps) {
|
|
299
|
+
return (0, _react2.jsx)(_highlight.EuiHighlight, {
|
|
300
|
+
search: searchValue
|
|
301
|
+
}, text);
|
|
302
|
+
}
|
|
303
|
+
var searchPositionStart = text.toLowerCase().indexOf(searchValue.toLowerCase());
|
|
304
|
+
var searchPositionCenter = searchPositionStart + Math.floor(searchValue.length / 2);
|
|
305
|
+
return (0, _react2.jsx)(_text_truncate.EuiTextTruncate, (0, _extends2.default)({}, truncationProps, {
|
|
306
|
+
// When searching, don't allow overriding the truncation settings
|
|
307
|
+
truncation: "startEnd",
|
|
308
|
+
truncationPosition: searchPositionCenter,
|
|
309
|
+
text: text
|
|
310
|
+
}), function (text) {
|
|
311
|
+
return (0, _react2.jsx)(_react.default.Fragment, null, text.length >= searchValue.length ? (0, _react2.jsx)(_highlight.EuiHighlight, {
|
|
312
|
+
search: searchValue
|
|
313
|
+
}, text) :
|
|
314
|
+
// If the available truncated text is shorter than the full search string,
|
|
315
|
+
// just highlight the entire truncated text
|
|
316
|
+
(0, _react2.jsx)(_mark.EuiMark, null, text));
|
|
317
|
+
});
|
|
318
|
+
});
|
|
319
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderTruncatedText", function (text, truncationProps) {
|
|
320
|
+
return (
|
|
321
|
+
// For some bizarre reason, truncation in EuiSelectable is off on initial mount
|
|
322
|
+
// (but not on rerender) for Safari and _some_ truncation types in Firefox :|
|
|
323
|
+
// Waiting a tick before calculating truncation seems to smooth over the issue
|
|
324
|
+
(0, _react2.jsx)(_text_truncate.EuiTextTruncate, (0, _extends2.default)({
|
|
325
|
+
calculationDelayMs: 2
|
|
326
|
+
}, truncationProps, {
|
|
327
|
+
text: text
|
|
328
|
+
}), function (text) {
|
|
329
|
+
return text;
|
|
330
|
+
})
|
|
331
|
+
);
|
|
332
|
+
});
|
|
224
333
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onAddOrRemoveOption", function (option, event) {
|
|
225
334
|
if (option.disabled) {
|
|
226
335
|
return;
|
|
227
336
|
}
|
|
228
|
-
var _this$
|
|
229
|
-
allowExclusions = _this$
|
|
230
|
-
options = _this$
|
|
231
|
-
_this$
|
|
232
|
-
visibleOptions = _this$
|
|
233
|
-
_this.props.setActiveOptionIndex(visibleOptions.findIndex(function (
|
|
234
|
-
var label =
|
|
337
|
+
var _this$props5 = _this.props,
|
|
338
|
+
allowExclusions = _this$props5.allowExclusions,
|
|
339
|
+
options = _this$props5.options,
|
|
340
|
+
_this$props5$visibleO = _this$props5.visibleOptions,
|
|
341
|
+
visibleOptions = _this$props5$visibleO === void 0 ? options : _this$props5$visibleO;
|
|
342
|
+
_this.props.setActiveOptionIndex(visibleOptions.findIndex(function (_ref5) {
|
|
343
|
+
var label = _ref5.label;
|
|
235
344
|
return label === option.label;
|
|
236
345
|
}), function () {
|
|
237
346
|
if (option.checked === 'on' && allowExclusions) {
|
|
@@ -244,10 +353,10 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
244
353
|
});
|
|
245
354
|
});
|
|
246
355
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onAddOption", function (addedOption, event) {
|
|
247
|
-
var _this$
|
|
248
|
-
onOptionClick = _this$
|
|
249
|
-
options = _this$
|
|
250
|
-
singleSelection = _this$
|
|
356
|
+
var _this$props6 = _this.props,
|
|
357
|
+
onOptionClick = _this$props6.onOptionClick,
|
|
358
|
+
options = _this$props6.options,
|
|
359
|
+
singleSelection = _this$props6.singleSelection;
|
|
251
360
|
var changedOption = _objectSpread({}, addedOption);
|
|
252
361
|
var updatedOptions = options.map(function (option) {
|
|
253
362
|
// if singleSelection is enabled, uncheck any selected option(s)
|
|
@@ -266,10 +375,10 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
266
375
|
onOptionClick(updatedOptions, event, changedOption);
|
|
267
376
|
});
|
|
268
377
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onRemoveOption", function (removedOption, event) {
|
|
269
|
-
var _this$
|
|
270
|
-
onOptionClick = _this$
|
|
271
|
-
singleSelection = _this$
|
|
272
|
-
options = _this$
|
|
378
|
+
var _this$props7 = _this.props,
|
|
379
|
+
onOptionClick = _this$props7.onOptionClick,
|
|
380
|
+
singleSelection = _this$props7.singleSelection,
|
|
381
|
+
options = _this$props7.options;
|
|
273
382
|
var changedOption = _objectSpread({}, removedOption);
|
|
274
383
|
var updatedOptions = options.map(function (option) {
|
|
275
384
|
var updatedOption = _objectSpread({}, option);
|
|
@@ -282,9 +391,9 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
282
391
|
onOptionClick(updatedOptions, event, changedOption);
|
|
283
392
|
});
|
|
284
393
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onExcludeOption", function (excludedOption, event) {
|
|
285
|
-
var _this$
|
|
286
|
-
onOptionClick = _this$
|
|
287
|
-
options = _this$
|
|
394
|
+
var _this$props8 = _this.props,
|
|
395
|
+
onOptionClick = _this$props8.onOptionClick,
|
|
396
|
+
options = _this$props8.options;
|
|
288
397
|
var changedOption = _objectSpread({}, excludedOption);
|
|
289
398
|
var updatedOptions = options.map(function (option) {
|
|
290
399
|
var updatedOption = _objectSpread({}, option);
|
|
@@ -296,69 +405,83 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
296
405
|
});
|
|
297
406
|
onOptionClick(updatedOptions, event, changedOption);
|
|
298
407
|
});
|
|
408
|
+
var _optionArray = props.visibleOptions || props.options;
|
|
409
|
+
_this.state = _objectSpread({
|
|
410
|
+
defaultOptionWidth: 0,
|
|
411
|
+
optionArray: _optionArray,
|
|
412
|
+
itemData: _objectSpread({}, _optionArray)
|
|
413
|
+
}, _this.calculateAriaSetAttrs(_optionArray));
|
|
299
414
|
return _this;
|
|
300
415
|
}
|
|
301
416
|
(0, _createClass2.default)(EuiSelectableList, [{
|
|
302
417
|
key: "componentDidUpdate",
|
|
303
|
-
value: function componentDidUpdate() {
|
|
304
|
-
var
|
|
418
|
+
value: function componentDidUpdate(prevProps) {
|
|
419
|
+
var _this$props9 = this.props,
|
|
420
|
+
activeOptionIndex = _this$props9.activeOptionIndex,
|
|
421
|
+
visibleOptions = _this$props9.visibleOptions,
|
|
422
|
+
options = _this$props9.options;
|
|
305
423
|
if (this.listBoxRef && this.props.searchable !== true) {
|
|
306
424
|
this.listBoxRef.setAttribute('aria-activedescendant', "".concat(this.props.makeOptionId(activeOptionIndex)));
|
|
307
425
|
}
|
|
308
|
-
if (this.listRef && typeof
|
|
309
|
-
this.listRef.scrollToItem(
|
|
426
|
+
if (this.listRef && typeof activeOptionIndex !== 'undefined') {
|
|
427
|
+
this.listRef.scrollToItem(activeOptionIndex, 'auto');
|
|
428
|
+
}
|
|
429
|
+
if (prevProps.visibleOptions !== visibleOptions || prevProps.options !== options) {
|
|
430
|
+
var optionArray = visibleOptions || options;
|
|
431
|
+
this.setState(_objectSpread({
|
|
432
|
+
optionArray: optionArray,
|
|
433
|
+
itemData: _objectSpread({}, optionArray)
|
|
434
|
+
}, this.calculateAriaSetAttrs(optionArray)));
|
|
310
435
|
}
|
|
311
436
|
}
|
|
312
437
|
}, {
|
|
313
438
|
key: "render",
|
|
314
439
|
value: function render() {
|
|
315
440
|
var _this2 = this;
|
|
316
|
-
var _this$
|
|
317
|
-
className = _this$
|
|
318
|
-
options = _this$
|
|
319
|
-
searchValue = _this$
|
|
320
|
-
onOptionClick = _this$
|
|
321
|
-
renderOption = _this$
|
|
322
|
-
forcedHeight = _this$
|
|
323
|
-
windowProps = _this$
|
|
324
|
-
rowHeight = _this$
|
|
325
|
-
activeOptionIndex = _this$
|
|
326
|
-
makeOptionId = _this$
|
|
327
|
-
showIcons = _this$
|
|
328
|
-
singleSelection = _this$
|
|
329
|
-
visibleOptions = _this$
|
|
330
|
-
allowExclusions = _this$
|
|
331
|
-
bordered = _this$
|
|
332
|
-
paddingSize = _this$
|
|
333
|
-
searchable = _this$
|
|
334
|
-
onFocusBadge = _this$
|
|
335
|
-
listId = _this$
|
|
336
|
-
setActiveOptionIndex = _this$
|
|
337
|
-
ariaLabel = _this$
|
|
338
|
-
ariaLabelledby = _this$
|
|
339
|
-
ariaDescribedby = _this$
|
|
340
|
-
role = _this$
|
|
341
|
-
isVirtualized = _this$
|
|
342
|
-
textWrap = _this$
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
this.calculateAriaSetAttrs(optionArray);
|
|
346
|
-
var heightIsFull = forcedHeight === 'full';
|
|
441
|
+
var _this$props10 = this.props,
|
|
442
|
+
className = _this$props10.className,
|
|
443
|
+
options = _this$props10.options,
|
|
444
|
+
searchValue = _this$props10.searchValue,
|
|
445
|
+
onOptionClick = _this$props10.onOptionClick,
|
|
446
|
+
renderOption = _this$props10.renderOption,
|
|
447
|
+
forcedHeight = _this$props10.height,
|
|
448
|
+
windowProps = _this$props10.windowProps,
|
|
449
|
+
rowHeight = _this$props10.rowHeight,
|
|
450
|
+
activeOptionIndex = _this$props10.activeOptionIndex,
|
|
451
|
+
makeOptionId = _this$props10.makeOptionId,
|
|
452
|
+
showIcons = _this$props10.showIcons,
|
|
453
|
+
singleSelection = _this$props10.singleSelection,
|
|
454
|
+
visibleOptions = _this$props10.visibleOptions,
|
|
455
|
+
allowExclusions = _this$props10.allowExclusions,
|
|
456
|
+
bordered = _this$props10.bordered,
|
|
457
|
+
paddingSize = _this$props10.paddingSize,
|
|
458
|
+
searchable = _this$props10.searchable,
|
|
459
|
+
onFocusBadge = _this$props10.onFocusBadge,
|
|
460
|
+
listId = _this$props10.listId,
|
|
461
|
+
setActiveOptionIndex = _this$props10.setActiveOptionIndex,
|
|
462
|
+
ariaLabel = _this$props10['aria-label'],
|
|
463
|
+
ariaLabelledby = _this$props10['aria-labelledby'],
|
|
464
|
+
ariaDescribedby = _this$props10['aria-describedby'],
|
|
465
|
+
role = _this$props10.role,
|
|
466
|
+
isVirtualized = _this$props10.isVirtualized,
|
|
467
|
+
textWrap = _this$props10.textWrap,
|
|
468
|
+
truncationProps = _this$props10.truncationProps,
|
|
469
|
+
rest = (0, _objectWithoutProperties2.default)(_this$props10, _excluded3);
|
|
347
470
|
var classes = (0, _classnames.default)('euiSelectableList', {
|
|
348
|
-
'euiSelectableList-fullHeight':
|
|
471
|
+
'euiSelectableList-fullHeight': forcedHeight === 'full',
|
|
349
472
|
'euiSelectableList-bordered': bordered
|
|
350
473
|
}, className);
|
|
351
474
|
return (0, _react2.jsx)("div", (0, _extends2.default)({
|
|
352
475
|
className: classes
|
|
353
|
-
}, rest), isVirtualized ? this.renderVirtualizedList(
|
|
476
|
+
}, rest), isVirtualized ? this.renderVirtualizedList() : (0, _react2.jsx)("div", {
|
|
354
477
|
className: "euiSelectableList__list",
|
|
355
478
|
ref: this.removeScrollableTabStop
|
|
356
479
|
}, (0, _react2.jsx)("ul", {
|
|
357
480
|
ref: this.setListBoxRef
|
|
358
|
-
}, optionArray.map(function (_, index) {
|
|
481
|
+
}, this.state.optionArray.map(function (_, index) {
|
|
359
482
|
return /*#__PURE__*/_react.default.createElement(_this2.ListRow, {
|
|
360
483
|
key: index,
|
|
361
|
-
data: optionArray,
|
|
484
|
+
data: _this2.state.optionArray,
|
|
362
485
|
index: index
|
|
363
486
|
}, null);
|
|
364
487
|
}))));
|
|
@@ -456,6 +579,15 @@ EuiSelectableList.propTypes = {
|
|
|
456
579
|
* Wrapping only works if virtualization is off.
|
|
457
580
|
*/
|
|
458
581
|
textWrap: _propTypes.default.oneOf(["truncate", "wrap"]),
|
|
582
|
+
/**
|
|
583
|
+
* If textWrap is set to `truncate`, you can pass a custom truncation configuration
|
|
584
|
+
* that accepts any [EuiTextTruncate](/#/utilities/text-truncation) prop except for
|
|
585
|
+
* `text` and `children`.
|
|
586
|
+
*
|
|
587
|
+
* Note: when searching, custom truncation props are ignored. The highlighted search
|
|
588
|
+
* text will always take precedence.
|
|
589
|
+
*/
|
|
590
|
+
truncationProps: _propTypes.default.any,
|
|
459
591
|
/**
|
|
460
592
|
* Use virtualized rendering for list items with `react-window`.
|
|
461
593
|
* Sets each row's height to the value of `rowHeight`.
|
|
@@ -514,7 +646,22 @@ EuiSelectableList.propTypes = {
|
|
|
514
646
|
* Option data to pass through to the `renderOptions` element.
|
|
515
647
|
* Bypass `EuiSelectableItem` and avoid DOM attribute warnings.
|
|
516
648
|
*/
|
|
517
|
-
data: _propTypes.default.shape({})
|
|
649
|
+
data: _propTypes.default.shape({}),
|
|
650
|
+
/**
|
|
651
|
+
* How to handle long text within the item.
|
|
652
|
+
* Wrapping only works if `isVirtualization` is false.
|
|
653
|
+
* @default 'truncate'
|
|
654
|
+
*/
|
|
655
|
+
textWrap: _propTypes.default.oneOf(["truncate", "wrap"]),
|
|
656
|
+
/**
|
|
657
|
+
* If textWrap is set to `truncate`, you can pass a custom truncation configuration
|
|
658
|
+
* that accepts any [EuiTextTruncate](/#/utilities/text-truncation) prop except for
|
|
659
|
+
* `text` and `children`.
|
|
660
|
+
*
|
|
661
|
+
* Note: when searching, custom truncation props are ignored. The highlighted search
|
|
662
|
+
* text will always take precedence.
|
|
663
|
+
*/
|
|
664
|
+
truncationProps: _propTypes.default.any
|
|
518
665
|
}).isRequired).isRequired,
|
|
519
666
|
/**
|
|
520
667
|
* Filtered options list (if applicable)
|
|
@@ -533,7 +680,9 @@ EuiSelectableList.propTypes = {
|
|
|
533
680
|
prepend: _propTypes.default.node,
|
|
534
681
|
append: _propTypes.default.node,
|
|
535
682
|
ref: _propTypes.default.func,
|
|
536
|
-
data: _propTypes.default.shape({})
|
|
683
|
+
data: _propTypes.default.shape({}),
|
|
684
|
+
textWrap: _propTypes.default.oneOf(["truncate", "wrap"]),
|
|
685
|
+
truncationProps: _propTypes.default.any
|
|
537
686
|
}).isRequired),
|
|
538
687
|
/**
|
|
539
688
|
* Search value to highlight on the option render
|
|
@@ -391,7 +391,22 @@ EuiSelectableTemplateSitewide.propTypes = {
|
|
|
391
391
|
* Option data to pass through to the `renderOptions` element.
|
|
392
392
|
* Bypass `EuiSelectableItem` and avoid DOM attribute warnings.
|
|
393
393
|
*/
|
|
394
|
-
data: _propTypes.default.shape({})
|
|
394
|
+
data: _propTypes.default.shape({}),
|
|
395
|
+
/**
|
|
396
|
+
* How to handle long text within the item.
|
|
397
|
+
* Wrapping only works if `isVirtualization` is false.
|
|
398
|
+
* @default 'truncate'
|
|
399
|
+
*/
|
|
400
|
+
textWrap: _propTypes.default.oneOf(["truncate", "wrap"]),
|
|
401
|
+
/**
|
|
402
|
+
* If textWrap is set to `truncate`, you can pass a custom truncation configuration
|
|
403
|
+
* that accepts any [EuiTextTruncate](/#/utilities/text-truncation) prop except for
|
|
404
|
+
* `text` and `children`.
|
|
405
|
+
*
|
|
406
|
+
* Note: when searching, custom truncation props are ignored. The highlighted search
|
|
407
|
+
* text will always take precedence.
|
|
408
|
+
*/
|
|
409
|
+
truncationProps: _propTypes.default.any
|
|
395
410
|
}).isRequired).isRequired,
|
|
396
411
|
/**
|
|
397
412
|
* 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;"),
|
|
@@ -18,7 +18,7 @@ var _utils = require("./utils");
|
|
|
18
18
|
var _text_truncate = require("./text_truncate.styles");
|
|
19
19
|
var _react2 = require("@emotion/react");
|
|
20
20
|
var _excluded = ["width", "onResize"],
|
|
21
|
-
_excluded2 = ["width", "children", "text", "truncation", "truncationOffset", "truncationPosition", "ellipsis", "containerRef", "className"],
|
|
21
|
+
_excluded2 = ["width", "children", "text", "truncation", "truncationOffset", "truncationPosition", "ellipsis", "calculationDelayMs", "containerRef", "className"],
|
|
22
22
|
_excluded3 = ["onResize"];
|
|
23
23
|
/*
|
|
24
24
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
@@ -102,7 +102,13 @@ EuiTextTruncate.propTypes = {
|
|
|
102
102
|
* allows for more flexible text rendering, e.g. adding custom markup
|
|
103
103
|
* or highlighting
|
|
104
104
|
*/
|
|
105
|
-
children: _propTypes.default.func
|
|
105
|
+
children: _propTypes.default.func,
|
|
106
|
+
/**
|
|
107
|
+
* For some edge case scenarios, EuiTextTruncate's calculations may be off until
|
|
108
|
+
* fonts are done loading or layout is done shifting or settling. Adding a delay
|
|
109
|
+
* may help resolve any rendering issues.
|
|
110
|
+
*/
|
|
111
|
+
calculationDelayMs: _propTypes.default.number
|
|
106
112
|
};
|
|
107
113
|
var EuiTextTruncateWithWidth = function EuiTextTruncateWithWidth(_ref2) {
|
|
108
114
|
var width = _ref2.width,
|
|
@@ -115,6 +121,7 @@ var EuiTextTruncateWithWidth = function EuiTextTruncateWithWidth(_ref2) {
|
|
|
115
121
|
truncationPosition = _ref2.truncationPosition,
|
|
116
122
|
_ref2$ellipsis = _ref2.ellipsis,
|
|
117
123
|
ellipsis = _ref2$ellipsis === void 0 ? '…' : _ref2$ellipsis,
|
|
124
|
+
calculationDelayMs = _ref2.calculationDelayMs,
|
|
118
125
|
containerRef = _ref2.containerRef,
|
|
119
126
|
className = _ref2.className,
|
|
120
127
|
rest = (0, _objectWithoutProperties2.default)(_ref2, _excluded2);
|
|
@@ -125,6 +132,19 @@ var EuiTextTruncateWithWidth = function EuiTextTruncateWithWidth(_ref2) {
|
|
|
125
132
|
setContainerEl = _useState2[1];
|
|
126
133
|
var refs = (0, _services.useCombinedRefs)([setContainerEl, containerRef]);
|
|
127
134
|
|
|
135
|
+
// If necessary, wait a tick on mount before truncating
|
|
136
|
+
var _useState3 = (0, _react.useState)(!calculationDelayMs),
|
|
137
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
138
|
+
ready = _useState4[0],
|
|
139
|
+
setReady = _useState4[1];
|
|
140
|
+
(0, _react.useEffect)(function () {
|
|
141
|
+
if (calculationDelayMs) {
|
|
142
|
+
setTimeout(function () {
|
|
143
|
+
return setReady(true);
|
|
144
|
+
}, calculationDelayMs);
|
|
145
|
+
}
|
|
146
|
+
}, [calculationDelayMs]);
|
|
147
|
+
|
|
128
148
|
// Handle exceptions where we need to override the passed props
|
|
129
149
|
var _useMemo = (0, _react.useMemo)(function () {
|
|
130
150
|
var truncation = _truncation;
|
|
@@ -149,7 +169,8 @@ var EuiTextTruncateWithWidth = function EuiTextTruncateWithWidth(_ref2) {
|
|
|
149
169
|
truncationOffset = _useMemo.truncationOffset;
|
|
150
170
|
var truncatedText = (0, _react.useMemo)(function () {
|
|
151
171
|
var truncatedText = '';
|
|
152
|
-
if (!
|
|
172
|
+
if (!ready || !containerEl) return text;
|
|
173
|
+
if (!width) return truncatedText;
|
|
153
174
|
var utils = new _utils.TruncationUtils({
|
|
154
175
|
fullText: text,
|
|
155
176
|
ellipsis: ellipsis,
|
|
@@ -181,7 +202,7 @@ var EuiTextTruncateWithWidth = function EuiTextTruncateWithWidth(_ref2) {
|
|
|
181
202
|
}
|
|
182
203
|
}
|
|
183
204
|
return truncatedText;
|
|
184
|
-
}, [width, text, truncation, truncationOffset, truncationPosition, ellipsis, containerEl]);
|
|
205
|
+
}, [ready, width, text, truncation, truncationOffset, truncationPosition, ellipsis, containerEl]);
|
|
185
206
|
var isTruncating = truncatedText !== text;
|
|
186
207
|
return (0, _react2.jsx)("div", (0, _extends2.default)({
|
|
187
208
|
className: (0, _classnames.default)('euiTextTruncate', className),
|
|
@@ -209,10 +230,10 @@ EuiTextTruncateWithWidth.propTypes = {
|
|
|
209
230
|
var EuiTextTruncateWithResizeObserver = function EuiTextTruncateWithResizeObserver(_ref3) {
|
|
210
231
|
var _onResize = _ref3.onResize,
|
|
211
232
|
props = (0, _objectWithoutProperties2.default)(_ref3, _excluded3);
|
|
212
|
-
var
|
|
213
|
-
|
|
214
|
-
width =
|
|
215
|
-
setWidth =
|
|
233
|
+
var _useState5 = (0, _react.useState)(0),
|
|
234
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
235
|
+
width = _useState6[0],
|
|
236
|
+
setWidth = _useState6[1];
|
|
216
237
|
var onResize = (0, _react.useCallback)(function (_ref4) {
|
|
217
238
|
var width = _ref4.width;
|
|
218
239
|
setWidth(width);
|
|
@@ -224,6 +245,8 @@ var EuiTextTruncateWithResizeObserver = function EuiTextTruncateWithResizeObserv
|
|
|
224
245
|
return (0, _react2.jsx)(EuiTextTruncateWithWidth, (0, _extends2.default)({
|
|
225
246
|
width: width,
|
|
226
247
|
containerRef: ref
|
|
227
|
-
}, props
|
|
248
|
+
}, props, {
|
|
249
|
+
"data-resize-observer": "true"
|
|
250
|
+
}));
|
|
228
251
|
});
|
|
229
252
|
};
|