@elastic/eui 104.1.0 → 105.0.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/es/components/avatar/avatar.js +1 -1
- package/es/components/badge/badge.js +1 -1
- package/es/components/badge/beta_badge/beta_badge.js +1 -1
- package/es/components/basic_table/basic_table.js +4 -4
- package/es/components/basic_table/in_memory_table.js +4 -4
- package/es/components/button/button.js +1 -1
- package/es/components/button/button_display/_button_display.js +1 -1
- package/es/components/button/button_display/_button_display_content.js +1 -1
- package/es/components/button/button_empty/button_empty.js +1 -1
- package/es/components/button/button_group/button_group.js +1 -1
- package/es/components/button/button_group/button_group_button.js +1 -1
- package/es/components/button/button_icon/button_icon.js +1 -1
- package/es/components/call_out/call_out.js +1 -1
- package/es/components/card/card.js +2 -2
- package/es/components/card/card_select/card_select.js +1 -1
- package/es/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +1 -1
- package/es/components/collapsible_nav_beta/_kibana_solution/collapsible_nav_kibana_solution.js +1 -1
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +1 -1
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_item.js +2 -2
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_popover.js +2 -2
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +4 -4
- package/es/components/combo_box/combo_box.a11y.js +53 -2
- package/es/components/combo_box/combo_box.js +26 -8
- package/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +9 -3
- package/es/components/comment_list/comment.js +2 -2
- package/es/components/comment_list/comment_event.js +1 -1
- package/es/components/comment_list/comment_list.js +2 -2
- package/es/components/comment_list/comment_timeline.js +1 -1
- package/es/components/context_menu/context_menu_item.js +1 -1
- package/es/components/datagrid/body/cell/data_grid_cell.js +12 -12
- package/es/components/datagrid/body/cell/data_grid_cell.styles.js +9 -4
- package/es/components/datagrid/body/data_grid_body.js +7 -7
- package/es/components/datagrid/body/data_grid_body_custom.js +7 -7
- package/es/components/datagrid/body/data_grid_body_virtualized.js +7 -7
- package/es/components/datagrid/body/header/data_grid_header_cell.js +6 -6
- package/es/components/datagrid/controls/column_sorting.js +7 -7
- package/es/components/datagrid/controls/column_sorting_draggable.js +1 -1
- package/es/components/datagrid/controls/data_grid_toolbar_control.js +1 -1
- package/es/components/datagrid/data_grid.styles.js +4 -1
- package/es/components/datagrid/utils/in_memory.js +6 -6
- package/es/components/date_picker/date_picker.js +2 -2
- package/es/components/date_picker/date_picker_range.js +1 -1
- package/es/components/empty_prompt/empty_prompt.js +1 -1
- package/es/components/facet/facet_button.js +1 -1
- package/es/components/filter_group/filter_select_item.js +21 -17
- package/es/components/flyout/flyout.js +88 -21
- package/es/components/flyout/flyout.styles.js +9 -5
- package/es/components/flyout/flyout_child.js +209 -0
- package/es/components/flyout/flyout_child.styles.js +31 -0
- package/es/components/flyout/flyout_child_manager.js +112 -0
- package/es/components/flyout/flyout_context.js +16 -0
- package/es/components/flyout/index.js +3 -1
- package/es/components/flyout/sessions/flyout_provider.js +109 -0
- package/es/components/flyout/sessions/flyout_reducer.js +217 -0
- package/es/components/flyout/sessions/index.js +10 -0
- package/es/components/flyout/sessions/types.js +1 -0
- package/es/components/flyout/sessions/use_eui_flyout.js +94 -0
- package/es/components/form/field_number/field_number.js +2 -2
- package/es/components/form/field_text/field_text.js +2 -2
- package/es/components/form/form_control_layout/form_control_layout.js +2 -2
- package/es/components/form/form_control_layout/form_control_layout_custom_icon.js +1 -1
- package/es/components/form/form_control_layout/form_control_layout_icons.js +2 -2
- package/es/components/form/text_area/text_area.js +2 -2
- package/es/components/header/header_links/header_link.js +1 -1
- package/es/components/header/header_links/header_links.js +1 -1
- package/es/components/header/header_logo/header_logo.js +1 -1
- package/es/components/header/header_section/header_section_item_button.js +1 -1
- package/es/components/icon/icon.js +1 -1
- package/es/components/icon/icon_map.js +1 -4
- package/es/components/key_pad_menu/key_pad_menu_item.js +1 -1
- package/es/components/list_group/list_group.js +2 -2
- package/es/components/list_group/list_group_item.js +2 -2
- package/es/components/list_group/list_group_item_extra_action.js +1 -1
- package/es/components/list_group/pinnable_list_group/pinnable_list_group.js +4 -4
- package/es/components/loading/loading_logo.js +1 -1
- package/es/components/markdown_editor/markdown_editor.js +1 -1
- package/es/components/markdown_editor/markdown_editor_drop_zone.js +1 -1
- package/es/components/markdown_editor/markdown_editor_footer.js +1 -1
- package/es/components/markdown_editor/markdown_editor_toolbar.js +1 -1
- package/es/components/page/page_header/page_header_content.js +1 -1
- package/es/components/pagination/pagination_button.js +1 -1
- package/es/components/progress/progress.js +51 -11
- package/es/components/selectable/selectable_list/selectable_list.js +1 -1
- package/es/components/selectable/selectable_list/selectable_list_item.js +1 -1
- package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +1 -1
- package/es/components/table/table_header_cell.js +1 -1
- package/es/components/table/table_row.styles.js +11 -6
- package/es/components/timeline/timeline_item_icon.js +1 -1
- package/es/components/toast/global_toast_list.js +1 -1
- package/es/components/toast/toast.js +1 -1
- package/es/components/tool_tip/icon_tip.js +1 -1
- package/es/themes/amsterdam/global_styling/variables/_components.js +305 -270
- package/eui.d.ts +400 -77
- package/lib/components/avatar/avatar.js +1 -1
- package/lib/components/badge/badge.js +1 -1
- package/lib/components/badge/beta_badge/beta_badge.js +1 -1
- package/lib/components/basic_table/basic_table.js +4 -4
- package/lib/components/basic_table/in_memory_table.js +4 -4
- package/lib/components/button/button.js +1 -1
- package/lib/components/button/button_display/_button_display.js +1 -1
- package/lib/components/button/button_display/_button_display_content.js +1 -1
- package/lib/components/button/button_empty/button_empty.js +1 -1
- package/lib/components/button/button_group/button_group.js +1 -1
- package/lib/components/button/button_group/button_group_button.js +1 -1
- package/lib/components/button/button_icon/button_icon.js +1 -1
- package/lib/components/call_out/call_out.js +1 -1
- package/lib/components/card/card.js +2 -2
- package/lib/components/card/card_select/card_select.js +1 -1
- package/lib/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +1 -1
- package/lib/components/collapsible_nav_beta/_kibana_solution/collapsible_nav_kibana_solution.js +1 -1
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +1 -1
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_item.js +2 -2
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_popover.js +2 -2
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +4 -4
- package/lib/components/combo_box/combo_box.a11y.js +53 -2
- package/lib/components/combo_box/combo_box.js +26 -8
- package/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +9 -3
- package/lib/components/comment_list/comment.js +2 -2
- package/lib/components/comment_list/comment_event.js +1 -1
- package/lib/components/comment_list/comment_list.js +2 -2
- package/lib/components/comment_list/comment_timeline.js +1 -1
- package/lib/components/context_menu/context_menu_item.js +1 -1
- package/lib/components/datagrid/body/cell/data_grid_cell.js +12 -12
- package/lib/components/datagrid/body/cell/data_grid_cell.styles.js +9 -4
- package/lib/components/datagrid/body/data_grid_body.js +7 -7
- package/lib/components/datagrid/body/data_grid_body_custom.js +7 -7
- package/lib/components/datagrid/body/data_grid_body_virtualized.js +7 -7
- package/lib/components/datagrid/body/header/data_grid_header_cell.js +6 -6
- package/lib/components/datagrid/controls/column_sorting.js +7 -7
- package/lib/components/datagrid/controls/column_sorting_draggable.js +1 -1
- package/lib/components/datagrid/controls/data_grid_toolbar_control.js +1 -1
- package/lib/components/datagrid/data_grid.styles.js +4 -1
- package/lib/components/datagrid/utils/in_memory.js +6 -6
- package/lib/components/date_picker/date_picker.js +2 -2
- package/lib/components/date_picker/date_picker_range.js +1 -1
- package/lib/components/empty_prompt/empty_prompt.js +1 -1
- package/lib/components/facet/facet_button.js +1 -1
- package/lib/components/filter_group/filter_select_item.js +21 -17
- package/lib/components/flyout/flyout.js +88 -21
- package/lib/components/flyout/flyout.styles.js +10 -6
- package/lib/components/flyout/flyout_child.js +217 -0
- package/lib/components/flyout/flyout_child.styles.js +37 -0
- package/lib/components/flyout/flyout_child_manager.js +120 -0
- package/lib/components/flyout/flyout_context.js +21 -0
- package/lib/components/flyout/index.js +21 -1
- package/lib/components/flyout/sessions/flyout_provider.js +116 -0
- package/lib/components/flyout/sessions/flyout_reducer.js +224 -0
- package/lib/components/flyout/sessions/index.js +25 -0
- package/lib/components/flyout/sessions/types.js +5 -0
- package/lib/components/flyout/sessions/use_eui_flyout.js +99 -0
- package/lib/components/form/field_number/field_number.js +2 -2
- package/lib/components/form/field_text/field_text.js +2 -2
- package/lib/components/form/form_control_layout/form_control_layout.js +2 -2
- package/lib/components/form/form_control_layout/form_control_layout_custom_icon.js +1 -1
- package/lib/components/form/form_control_layout/form_control_layout_icons.js +2 -2
- package/lib/components/form/text_area/text_area.js +2 -2
- package/lib/components/header/header_links/header_link.js +1 -1
- package/lib/components/header/header_links/header_links.js +1 -1
- package/lib/components/header/header_logo/header_logo.js +1 -1
- package/lib/components/header/header_section/header_section_item_button.js +1 -1
- package/lib/components/icon/icon.js +1 -1
- package/lib/components/icon/icon_map.js +1 -4
- package/lib/components/key_pad_menu/key_pad_menu_item.js +1 -1
- package/lib/components/list_group/list_group.js +2 -2
- package/lib/components/list_group/list_group_item.js +2 -2
- package/lib/components/list_group/list_group_item_extra_action.js +1 -1
- package/lib/components/list_group/pinnable_list_group/pinnable_list_group.js +4 -4
- package/lib/components/loading/loading_logo.js +1 -1
- package/lib/components/markdown_editor/markdown_editor.js +1 -1
- package/lib/components/markdown_editor/markdown_editor_drop_zone.js +1 -1
- package/lib/components/markdown_editor/markdown_editor_footer.js +1 -1
- package/lib/components/markdown_editor/markdown_editor_toolbar.js +1 -1
- package/lib/components/page/page_header/page_header_content.js +1 -1
- package/lib/components/pagination/pagination_button.js +1 -1
- package/lib/components/progress/progress.js +54 -11
- package/lib/components/selectable/selectable_list/selectable_list.js +1 -1
- package/lib/components/selectable/selectable_list/selectable_list_item.js +1 -1
- package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +1 -1
- package/lib/components/table/table_header_cell.js +1 -1
- package/lib/components/table/table_row.styles.js +11 -6
- package/lib/components/timeline/timeline_item_icon.js +1 -1
- package/lib/components/toast/global_toast_list.js +1 -1
- package/lib/components/toast/toast.js +1 -1
- package/lib/components/tool_tip/icon_tip.js +1 -1
- package/lib/themes/amsterdam/global_styling/variables/_components.js +305 -270
- package/optimize/es/components/combo_box/combo_box.a11y.js +53 -2
- package/optimize/es/components/combo_box/combo_box.js +26 -8
- package/optimize/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +8 -3
- package/optimize/es/components/datagrid/body/cell/data_grid_cell.styles.js +9 -4
- package/optimize/es/components/datagrid/data_grid.styles.js +4 -1
- package/optimize/es/components/filter_group/filter_select_item.js +20 -17
- package/optimize/es/components/flyout/flyout.js +88 -21
- package/optimize/es/components/flyout/flyout.styles.js +9 -5
- package/optimize/es/components/flyout/flyout_child.js +168 -0
- package/optimize/es/components/flyout/flyout_child.styles.js +31 -0
- package/optimize/es/components/flyout/flyout_child_manager.js +98 -0
- package/optimize/es/components/flyout/flyout_context.js +16 -0
- package/optimize/es/components/flyout/index.js +3 -1
- package/optimize/es/components/flyout/sessions/flyout_provider.js +104 -0
- package/optimize/es/components/flyout/sessions/flyout_reducer.js +209 -0
- package/optimize/es/components/flyout/sessions/index.js +10 -0
- package/optimize/es/components/flyout/sessions/types.js +1 -0
- package/optimize/es/components/flyout/sessions/use_eui_flyout.js +94 -0
- package/optimize/es/components/icon/icon_map.js +1 -4
- package/optimize/es/components/progress/progress.js +38 -9
- package/optimize/es/components/table/table_row.styles.js +11 -6
- package/optimize/es/themes/amsterdam/global_styling/variables/_components.js +305 -270
- package/optimize/lib/components/combo_box/combo_box.a11y.js +53 -2
- package/optimize/lib/components/combo_box/combo_box.js +26 -8
- package/optimize/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +8 -3
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell.styles.js +9 -4
- package/optimize/lib/components/datagrid/data_grid.styles.js +4 -1
- package/optimize/lib/components/filter_group/filter_select_item.js +20 -17
- package/optimize/lib/components/flyout/flyout.js +88 -21
- package/optimize/lib/components/flyout/flyout.styles.js +10 -6
- package/optimize/lib/components/flyout/flyout_child.js +176 -0
- package/optimize/lib/components/flyout/flyout_child.styles.js +37 -0
- package/optimize/lib/components/flyout/flyout_child_manager.js +108 -0
- package/optimize/lib/components/flyout/flyout_context.js +21 -0
- package/optimize/lib/components/flyout/index.js +21 -1
- package/optimize/lib/components/flyout/sessions/flyout_provider.js +114 -0
- package/optimize/lib/components/flyout/sessions/flyout_reducer.js +217 -0
- package/optimize/lib/components/flyout/sessions/index.js +25 -0
- package/optimize/lib/components/flyout/sessions/types.js +5 -0
- package/optimize/lib/components/flyout/sessions/use_eui_flyout.js +99 -0
- package/optimize/lib/components/icon/icon_map.js +1 -4
- package/optimize/lib/components/progress/progress.js +41 -9
- package/optimize/lib/components/table/table_row.styles.js +11 -6
- package/optimize/lib/themes/amsterdam/global_styling/variables/_components.js +305 -270
- package/package.json +4 -4
- package/test-env/components/avatar/avatar.js +1 -1
- package/test-env/components/badge/badge.js +1 -1
- package/test-env/components/badge/beta_badge/beta_badge.js +1 -1
- package/test-env/components/basic_table/basic_table.js +4 -4
- package/test-env/components/basic_table/in_memory_table.js +4 -4
- package/test-env/components/button/button.js +1 -1
- package/test-env/components/button/button_display/_button_display.js +1 -1
- package/test-env/components/button/button_display/_button_display_content.js +1 -1
- package/test-env/components/button/button_empty/button_empty.js +1 -1
- package/test-env/components/button/button_group/button_group.js +1 -1
- package/test-env/components/button/button_group/button_group_button.js +1 -1
- package/test-env/components/button/button_icon/button_icon.js +1 -1
- package/test-env/components/call_out/call_out.js +1 -1
- package/test-env/components/card/card.js +2 -2
- package/test-env/components/card/card_select/card_select.js +1 -1
- package/test-env/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +1 -1
- package/test-env/components/collapsible_nav_beta/_kibana_solution/collapsible_nav_kibana_solution.js +1 -1
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +1 -1
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_item.js +2 -2
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_popover.js +2 -2
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +4 -4
- package/test-env/components/combo_box/combo_box.a11y.js +53 -2
- package/test-env/components/combo_box/combo_box.js +26 -8
- package/test-env/components/combo_box/combo_box_options_list/combo_box_options_list.js +9 -3
- package/test-env/components/comment_list/comment.js +2 -2
- package/test-env/components/comment_list/comment_event.js +1 -1
- package/test-env/components/comment_list/comment_list.js +2 -2
- package/test-env/components/comment_list/comment_timeline.js +1 -1
- package/test-env/components/context_menu/context_menu_item.js +1 -1
- package/test-env/components/datagrid/body/cell/data_grid_cell.js +12 -12
- package/test-env/components/datagrid/body/cell/data_grid_cell.styles.js +9 -4
- package/test-env/components/datagrid/body/data_grid_body.js +7 -7
- package/test-env/components/datagrid/body/data_grid_body_custom.js +7 -7
- package/test-env/components/datagrid/body/data_grid_body_virtualized.js +7 -7
- package/test-env/components/datagrid/body/header/data_grid_header_cell.js +6 -6
- package/test-env/components/datagrid/controls/column_sorting.js +7 -7
- package/test-env/components/datagrid/controls/column_sorting_draggable.js +1 -1
- package/test-env/components/datagrid/controls/data_grid_toolbar_control.js +1 -1
- package/test-env/components/datagrid/data_grid.styles.js +4 -1
- package/test-env/components/datagrid/utils/in_memory.js +6 -6
- package/test-env/components/date_picker/date_picker.js +2 -2
- package/test-env/components/date_picker/date_picker_range.js +1 -1
- package/test-env/components/empty_prompt/empty_prompt.js +1 -1
- package/test-env/components/facet/facet_button.js +1 -1
- package/test-env/components/filter_group/filter_select_item.js +21 -17
- package/test-env/components/flyout/flyout.styles.js +10 -6
- package/test-env/components/flyout/flyout_child.js +216 -0
- package/test-env/components/flyout/flyout_child.styles.js +37 -0
- package/test-env/components/flyout/flyout_child_manager.js +117 -0
- package/test-env/components/flyout/flyout_context.js +21 -0
- package/test-env/components/flyout/index.js +21 -1
- package/test-env/components/flyout/sessions/flyout_provider.js +114 -0
- package/test-env/components/flyout/sessions/flyout_reducer.js +217 -0
- package/test-env/components/flyout/sessions/index.js +25 -0
- package/test-env/components/flyout/sessions/types.js +5 -0
- package/test-env/components/flyout/sessions/use_eui_flyout.js +99 -0
- package/test-env/components/form/field_number/field_number.js +2 -2
- package/test-env/components/form/field_text/field_text.js +2 -2
- package/test-env/components/form/form_control_layout/form_control_layout.js +2 -2
- package/test-env/components/form/form_control_layout/form_control_layout_custom_icon.js +1 -1
- package/test-env/components/form/form_control_layout/form_control_layout_icons.js +2 -2
- package/test-env/components/form/text_area/text_area.js +2 -2
- package/test-env/components/header/header_links/header_link.js +1 -1
- package/test-env/components/header/header_links/header_links.js +1 -1
- package/test-env/components/header/header_logo/header_logo.js +1 -1
- package/test-env/components/header/header_section/header_section_item_button.js +1 -1
- package/test-env/components/icon/icon_map.js +1 -4
- package/test-env/components/key_pad_menu/key_pad_menu_item.js +1 -1
- package/test-env/components/list_group/list_group.js +2 -2
- package/test-env/components/list_group/list_group_item.js +2 -2
- package/test-env/components/list_group/list_group_item_extra_action.js +1 -1
- package/test-env/components/list_group/pinnable_list_group/pinnable_list_group.js +4 -4
- package/test-env/components/loading/loading_logo.js +1 -1
- package/test-env/components/markdown_editor/markdown_editor.js +1 -1
- package/test-env/components/markdown_editor/markdown_editor_drop_zone.js +1 -1
- package/test-env/components/markdown_editor/markdown_editor_footer.js +1 -1
- package/test-env/components/markdown_editor/markdown_editor_toolbar.js +1 -1
- package/test-env/components/page/page_header/page_header_content.js +1 -1
- package/test-env/components/pagination/pagination_button.js +1 -1
- package/test-env/components/progress/progress.js +49 -11
- package/test-env/components/selectable/selectable_list/selectable_list.js +1 -1
- package/test-env/components/selectable/selectable_list/selectable_list_item.js +1 -1
- package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +1 -1
- package/test-env/components/table/table_header_cell.js +1 -1
- package/test-env/components/table/table_row.styles.js +11 -6
- package/test-env/components/timeline/timeline_item_icon.js +1 -1
- package/test-env/components/toast/global_toast_list.js +1 -1
- package/test-env/components/toast/toast.js +1 -1
- package/test-env/components/tool_tip/icon_tip.js +1 -1
- package/test-env/themes/amsterdam/global_styling/variables/_components.js +305 -270
|
@@ -28,14 +28,15 @@ export var euiFlyoutStyles = function euiFlyoutStyles(euiThemeContext) {
|
|
|
28
28
|
var euiTheme = euiThemeContext.euiTheme,
|
|
29
29
|
colorMode = euiThemeContext.colorMode;
|
|
30
30
|
return {
|
|
31
|
-
euiFlyout: /*#__PURE__*/css("position:fixed;", logicalCSS('bottom', 0), " ", logicalCSS('top', 'var(--euiFixedHeadersOffset, 0)'), " ", logicalCSS('height', 'inherit'), " z-index:", euiTheme.levels.flyout, ";background:", euiTheme.colors.emptyShade, ";display:flex;flex-direction:column;align-items:stretch;&:focus{outline:none;}",
|
|
31
|
+
euiFlyout: /*#__PURE__*/css("position:fixed;", logicalCSS('bottom', 0), " ", logicalCSS('top', 'var(--euiFixedHeadersOffset, 0)'), " ", logicalCSS('height', 'inherit'), " z-index:", euiTheme.levels.flyout, ";background:", euiTheme.colors.emptyShade, ";display:flex;flex-direction:column;align-items:stretch;&:focus{outline:none;}", maxedFlyoutWidth(euiThemeContext), ";;label:euiFlyout;"),
|
|
32
32
|
// Flyout sizes
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
// When a child flyout is stacked on top of the parent, the parent flyout size will match the child flyout size
|
|
34
|
+
s: /*#__PURE__*/css(composeFlyoutSizing(euiThemeContext, 's'), " &.euiFlyout--hasChild--stacked.euiFlyout--hasChild--m{", composeFlyoutSizing(euiThemeContext, 'm'), ";};label:s;"),
|
|
35
|
+
m: /*#__PURE__*/css(composeFlyoutSizing(euiThemeContext, 'm'), " &.euiFlyout--hasChild--stacked.euiFlyout--hasChild--s{", composeFlyoutSizing(euiThemeContext, 's'), ";};label:m;"),
|
|
35
36
|
l: /*#__PURE__*/css(composeFlyoutSizing(euiThemeContext, 'l'), ";;label:l;"),
|
|
36
37
|
noMaxWidth: /*#__PURE__*/css(logicalCSS('max-width', 'none'), ";;label:noMaxWidth;"),
|
|
37
38
|
// Side
|
|
38
|
-
right: /*#__PURE__*/css("clip-path:polygon(-50% 0, 100% 0, 100% 100%, -50% 100%);", logicalCSS('right', 0), " ", euiCanAnimate, "{animation:", euiFlyoutSlideInRight, " ", euiTheme.animation.normal, " ", euiTheme.animation.resistance, ";};label:right;"),
|
|
39
|
+
right: /*#__PURE__*/css("clip-path:polygon(-50% 0, 100% 0, 100% 100%, -50% 100%);", logicalCSS('right', 0), " ", euiCanAnimate, "{animation:", euiFlyoutSlideInRight, " ", euiTheme.animation.normal, " ", euiTheme.animation.resistance, ";}&.euiFlyout--hasChild{clip-path:none;};label:right;"),
|
|
39
40
|
// Left-side flyouts should only be used for navigation
|
|
40
41
|
left: /*#__PURE__*/css(logicalCSS('left', 0), " clip-path:polygon(0 0, 150% 0, 150% 100%, 0 100%);", euiCanAnimate, "{animation:", euiFlyoutSlideInLeft, " ", euiTheme.animation.normal, " ", euiTheme.animation.resistance, ";};label:left;"),
|
|
41
42
|
// Type
|
|
@@ -61,7 +62,10 @@ export var euiFlyoutStyles = function euiFlyoutStyles(euiThemeContext) {
|
|
|
61
62
|
}
|
|
62
63
|
};
|
|
63
64
|
};
|
|
64
|
-
var
|
|
65
|
+
export var maxedFlyoutWidth = function maxedFlyoutWidth(euiThemeContext) {
|
|
66
|
+
return "\n ".concat(euiMaxBreakpoint(euiThemeContext, FLYOUT_BREAKPOINT), " {\n ").concat(logicalCSS('max-width', '90vw !important'), "\n }\n");
|
|
67
|
+
};
|
|
68
|
+
export var composeFlyoutSizing = function composeFlyoutSizing(euiThemeContext, size) {
|
|
65
69
|
var euiTheme = euiThemeContext.euiTheme;
|
|
66
70
|
var formMaxWidth = euiFormMaxWidth(euiThemeContext);
|
|
67
71
|
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
var _excluded = ["children", "className", "banner", "hideCloseButton", "onClose", "scrollableTabIndex", "size"];
|
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
4
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
|
|
5
|
+
/*
|
|
6
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
7
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
8
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
9
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
10
|
+
* Side Public License, v 1.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import React, { useContext, Children, useEffect, useMemo, useRef } from 'react';
|
|
14
|
+
import PropTypes from "prop-types";
|
|
15
|
+
import classNames from 'classnames';
|
|
16
|
+
import { useEuiMemoizedStyles, useGeneratedHtmlId } from '../../services';
|
|
17
|
+
import { euiFlyoutChildStyles } from './flyout_child.styles';
|
|
18
|
+
import { EuiFlyoutCloseButton } from './_flyout_close_button';
|
|
19
|
+
import { EuiFlyoutContext } from './flyout_context';
|
|
20
|
+
import { EuiFlyoutBody } from './flyout_body';
|
|
21
|
+
import { EuiFocusTrap } from '../focus_trap';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Props used to render and configure the child flyout panel
|
|
25
|
+
*/
|
|
26
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
27
|
+
/**
|
|
28
|
+
* The child flyout is a panel that appears to the left of the parent flyout.
|
|
29
|
+
* It is only visible when the parent flyout is open.
|
|
30
|
+
*/
|
|
31
|
+
export var EuiFlyoutChild = function EuiFlyoutChild(_ref) {
|
|
32
|
+
var children = _ref.children,
|
|
33
|
+
className = _ref.className,
|
|
34
|
+
banner = _ref.banner,
|
|
35
|
+
_ref$hideCloseButton = _ref.hideCloseButton,
|
|
36
|
+
hideCloseButton = _ref$hideCloseButton === void 0 ? false : _ref$hideCloseButton,
|
|
37
|
+
onClose = _ref.onClose,
|
|
38
|
+
_ref$scrollableTabInd = _ref.scrollableTabIndex,
|
|
39
|
+
scrollableTabIndex = _ref$scrollableTabInd === void 0 ? 0 : _ref$scrollableTabInd,
|
|
40
|
+
_ref$size = _ref.size,
|
|
41
|
+
size = _ref$size === void 0 ? 's' : _ref$size,
|
|
42
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
43
|
+
var flyoutContext = useContext(EuiFlyoutContext);
|
|
44
|
+
if (!flyoutContext) {
|
|
45
|
+
throw new Error('EuiFlyoutChild must be used as a child of EuiFlyout.');
|
|
46
|
+
}
|
|
47
|
+
var setIsChildFlyoutOpen = flyoutContext.setIsChildFlyoutOpen,
|
|
48
|
+
parentSize = flyoutContext.parentSize;
|
|
49
|
+
useEffect(function () {
|
|
50
|
+
setIsChildFlyoutOpen === null || setIsChildFlyoutOpen === void 0 || setIsChildFlyoutOpen(true);
|
|
51
|
+
return function () {
|
|
52
|
+
setIsChildFlyoutOpen === null || setIsChildFlyoutOpen === void 0 || setIsChildFlyoutOpen(false);
|
|
53
|
+
};
|
|
54
|
+
}, [setIsChildFlyoutOpen]);
|
|
55
|
+
if (React.Children.count(children) === 0) {
|
|
56
|
+
console.warn('EuiFlyoutChild was rendered with no children!');
|
|
57
|
+
}
|
|
58
|
+
if (parentSize === 'm' && size === 'm') {
|
|
59
|
+
throw new Error('When the parent EuiFlyout size is "m", the EuiFlyoutChild size cannot be "m". Please use size "s" for the EuiFlyoutChild.');
|
|
60
|
+
}
|
|
61
|
+
var handleClose = function handleClose(event) {
|
|
62
|
+
setIsChildFlyoutOpen === null || setIsChildFlyoutOpen === void 0 || setIsChildFlyoutOpen(false);
|
|
63
|
+
onClose(event);
|
|
64
|
+
};
|
|
65
|
+
var flyoutTitleText;
|
|
66
|
+
var hasDescribedByBody = false;
|
|
67
|
+
Children.forEach(children, function (child) {
|
|
68
|
+
if ( /*#__PURE__*/React.isValidElement(child)) {
|
|
69
|
+
var _child$type;
|
|
70
|
+
if (((_child$type = child.type) === null || _child$type === void 0 ? void 0 : _child$type.displayName) === 'EuiFlyoutHeader') {
|
|
71
|
+
// Attempt to extract string content from header for ARIA
|
|
72
|
+
var headerChildren = child.props.children;
|
|
73
|
+
if (typeof headerChildren === 'string') {
|
|
74
|
+
flyoutTitleText = headerChildren;
|
|
75
|
+
} else if ( /*#__PURE__*/React.isValidElement(headerChildren) &&
|
|
76
|
+
// Check if props exist and children is a string
|
|
77
|
+
typeof headerChildren.props.children === 'string') {
|
|
78
|
+
flyoutTitleText = headerChildren.props.children;
|
|
79
|
+
} else if (Array.isArray(headerChildren)) {
|
|
80
|
+
// Find the first string child if headerChildren is an array
|
|
81
|
+
flyoutTitleText = headerChildren.find(function (cNode) {
|
|
82
|
+
return typeof cNode === 'string';
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (child.type === EuiFlyoutBody) {
|
|
87
|
+
hasDescribedByBody = true;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
var titleIdGenerated = useGeneratedHtmlId({
|
|
92
|
+
prefix: 'euiFlyoutChildTitle'
|
|
93
|
+
});
|
|
94
|
+
var bodyIdGenerated = useGeneratedHtmlId({
|
|
95
|
+
prefix: 'euiFlyoutChildBody'
|
|
96
|
+
});
|
|
97
|
+
var ariaLabelledBy = flyoutTitleText ? titleIdGenerated : undefined;
|
|
98
|
+
var ariaDescribedBy = hasDescribedByBody ? bodyIdGenerated : undefined;
|
|
99
|
+
// Use existing aria-label if provided, otherwise fallback if no labelledby can be derived
|
|
100
|
+
var ariaLabel = rest['aria-label'] || (!ariaLabelledBy && !flyoutTitleText ? 'Flyout panel' : undefined);
|
|
101
|
+
var processedChildren = useMemo(function () {
|
|
102
|
+
return Children.map(children, function (child) {
|
|
103
|
+
if ( /*#__PURE__*/React.isValidElement(child)) {
|
|
104
|
+
var _child$type2, _child$type3;
|
|
105
|
+
if ((child.type === EuiFlyoutBody || ((_child$type2 = child.type) === null || _child$type2 === void 0 ? void 0 : _child$type2.displayName) === 'EuiFlyoutBody') && hasDescribedByBody) {
|
|
106
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
107
|
+
id: bodyIdGenerated
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
// If EuiFlyoutHeader is found and we derived flyoutTitleText, set its ID
|
|
111
|
+
if (((_child$type3 = child.type) === null || _child$type3 === void 0 ? void 0 : _child$type3.displayName) === 'EuiFlyoutHeader' && flyoutTitleText && ariaLabelledBy) {
|
|
112
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
113
|
+
id: titleIdGenerated
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return child;
|
|
118
|
+
});
|
|
119
|
+
}, [children, bodyIdGenerated, titleIdGenerated, hasDescribedByBody, flyoutTitleText, ariaLabelledBy]);
|
|
120
|
+
var flyoutWrapperRef = useRef(null);
|
|
121
|
+
var classes = classNames('euiFlyoutChild', className);
|
|
122
|
+
var styles = useEuiMemoizedStyles(euiFlyoutChildStyles);
|
|
123
|
+
var childLayoutMode = flyoutContext.childLayoutMode,
|
|
124
|
+
parentFlyoutRef = flyoutContext.parentFlyoutRef;
|
|
125
|
+
var flyoutChildCss = [styles.euiFlyoutChild, size === 's' ? styles.s : styles.m, childLayoutMode === 'side-by-side' ? styles.sidePosition : styles.stackedPosition];
|
|
126
|
+
return ___EmotionJSX(EuiFocusTrap, {
|
|
127
|
+
returnFocus: function returnFocus() {
|
|
128
|
+
if (parentFlyoutRef !== null && parentFlyoutRef !== void 0 && parentFlyoutRef.current) {
|
|
129
|
+
parentFlyoutRef.current.focus();
|
|
130
|
+
return false; // We've handled focus
|
|
131
|
+
}
|
|
132
|
+
return true;
|
|
133
|
+
},
|
|
134
|
+
shards: [],
|
|
135
|
+
disabled: false
|
|
136
|
+
}, ___EmotionJSX("div", _extends({
|
|
137
|
+
ref: flyoutWrapperRef,
|
|
138
|
+
className: classes,
|
|
139
|
+
css: flyoutChildCss,
|
|
140
|
+
"data-test-subj": "euiFlyoutChild",
|
|
141
|
+
role: "dialog",
|
|
142
|
+
"aria-modal": "true",
|
|
143
|
+
"aria-label": ariaLabel,
|
|
144
|
+
"aria-labelledby": ariaLabelledBy,
|
|
145
|
+
"aria-describedby": ariaDescribedBy,
|
|
146
|
+
tabIndex: -1
|
|
147
|
+
}, rest), flyoutTitleText && !ariaLabelledBy && ___EmotionJSX("h2", {
|
|
148
|
+
id: titleIdGenerated,
|
|
149
|
+
className: "euiScreenReaderOnly"
|
|
150
|
+
}, flyoutTitleText), !hideCloseButton && ___EmotionJSX(EuiFlyoutCloseButton, {
|
|
151
|
+
className: "euiFlyoutChild__closeButton",
|
|
152
|
+
css: styles.closeButton,
|
|
153
|
+
onClose: handleClose,
|
|
154
|
+
side: "right",
|
|
155
|
+
closeButtonPosition: "inside",
|
|
156
|
+
"data-test-subj": "euiFlyoutChildCloseButton"
|
|
157
|
+
}), ___EmotionJSX("div", {
|
|
158
|
+
tabIndex: scrollableTabIndex,
|
|
159
|
+
className: "euiFlyoutChild__overflow",
|
|
160
|
+
css: styles.overflow.overflow
|
|
161
|
+
}, banner && ___EmotionJSX("div", {
|
|
162
|
+
className: "euiFlyoutChild__banner",
|
|
163
|
+
css: styles.banner,
|
|
164
|
+
"data-test-subj": "euiFlyoutChildBanner"
|
|
165
|
+
}, banner), ___EmotionJSX("div", {
|
|
166
|
+
className: "euiFlyoutChild__overflowContent",
|
|
167
|
+
css: styles.overflow.wrapper
|
|
168
|
+
}, processedChildren))));
|
|
169
|
+
};
|
|
170
|
+
EuiFlyoutChild.propTypes = {
|
|
171
|
+
/**
|
|
172
|
+
* Called when the child panel's close button is clicked
|
|
173
|
+
*/
|
|
174
|
+
onClose: PropTypes.func.isRequired,
|
|
175
|
+
/**
|
|
176
|
+
* Use to display a banner at the top of the child. It is suggested to use `EuiCallOut` for it.
|
|
177
|
+
*/
|
|
178
|
+
banner: PropTypes.node,
|
|
179
|
+
/**
|
|
180
|
+
* Hides the default close button. You must provide another close button somewhere within the child flyout.
|
|
181
|
+
* @default false
|
|
182
|
+
*/
|
|
183
|
+
hideCloseButton: PropTypes.bool,
|
|
184
|
+
/**
|
|
185
|
+
* [Scrollable regions (or their children) should be focusable](https://dequeuniversity.com/rules/axe/4.0/scrollable-region-focusable)
|
|
186
|
+
* to allow keyboard users to scroll the region via arrow keys.
|
|
187
|
+
*
|
|
188
|
+
* By default, EuiFlyoutChild's scroll overflow wrapper sets a `tabIndex` of `0`.
|
|
189
|
+
* If you know your flyout child content already contains focusable children
|
|
190
|
+
* that satisfy keyboard accessibility requirements, you can use this prop
|
|
191
|
+
* to override this default.
|
|
192
|
+
*/
|
|
193
|
+
scrollableTabIndex: PropTypes.number,
|
|
194
|
+
/**
|
|
195
|
+
* Size of the child flyout panel.
|
|
196
|
+
* When the parent flyout is 'm', child is limited to 's'.
|
|
197
|
+
* @default 's'
|
|
198
|
+
*/
|
|
199
|
+
size: PropTypes.oneOf(["s", "m"]),
|
|
200
|
+
/**
|
|
201
|
+
* Children are implicitly part of FunctionComponent, but good to have if props type is standalone.
|
|
202
|
+
*/
|
|
203
|
+
children: PropTypes.node,
|
|
204
|
+
className: PropTypes.string,
|
|
205
|
+
"aria-label": PropTypes.string,
|
|
206
|
+
"data-test-subj": PropTypes.string,
|
|
207
|
+
css: PropTypes.any
|
|
208
|
+
};
|
|
209
|
+
EuiFlyoutChild.displayName = 'EuiFlyoutChild';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { css } from '@emotion/react';
|
|
10
|
+
import { logicalCSS, logicalCSSWithFallback, highContrastModeStyles, euiYScroll } from '../../global_styling';
|
|
11
|
+
import { composeFlyoutSizing, maxedFlyoutWidth } from './flyout.styles';
|
|
12
|
+
export var euiFlyoutChildStyles = function euiFlyoutChildStyles(euiThemeContext) {
|
|
13
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
14
|
+
return {
|
|
15
|
+
// Base styles for the child flyout
|
|
16
|
+
euiFlyoutChild: /*#__PURE__*/css("position:absolute;inset-block-start:0;inset-inline-start:0;block-size:100%;background:", euiTheme.colors.backgroundBaseSubdued, ";display:flex;flex-direction:column;", logicalCSSWithFallback('overflow-y', 'hidden'), " ", logicalCSS('height', '100%'), " z-index:", Number(euiTheme.levels.flyout) + 1, ";border-inline-start:", euiTheme.border.thin, ";", maxedFlyoutWidth(euiThemeContext), ";;label:euiFlyoutChild;"),
|
|
17
|
+
// Position variants based on screen size
|
|
18
|
+
sidePosition: /*#__PURE__*/css("transform:translateX(-100%);border-inline-end:", euiTheme.border.thin, ";;label:sidePosition;"),
|
|
19
|
+
stackedPosition: /*#__PURE__*/css("inset-inline-end:0;inline-size:100%;border-block-end:", euiTheme.border.thin, ";;label:stackedPosition;"),
|
|
20
|
+
s: /*#__PURE__*/css(composeFlyoutSizing(euiThemeContext, 's'), ";;label:s;"),
|
|
21
|
+
m: /*#__PURE__*/css(composeFlyoutSizing(euiThemeContext, 'm'), ";;label:m;"),
|
|
22
|
+
closeButton: /*#__PURE__*/css("position:absolute;inset-block-start:", euiTheme.size.s, ";inset-inline-end:", euiTheme.size.s, ";z-index:1;;label:closeButton;"),
|
|
23
|
+
overflow: {
|
|
24
|
+
overflow: /*#__PURE__*/css("flex-grow:1;display:flex;flex-direction:column;", euiYScroll(euiThemeContext), ";;label:overflow;"),
|
|
25
|
+
wrapper: /*#__PURE__*/css("display:flex;flex-direction:column;flex-grow:1;", logicalCSS('overflow-x', 'auto'), ";;label:wrapper;")
|
|
26
|
+
},
|
|
27
|
+
banner: /*#__PURE__*/css(logicalCSSWithFallback('overflow-x', 'hidden'), " ", highContrastModeStyles(euiThemeContext, {
|
|
28
|
+
preferred: logicalCSS('border-bottom', euiTheme.border.thin)
|
|
29
|
+
}), ";;label:banner;")
|
|
30
|
+
};
|
|
31
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
4
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
7
|
+
/*
|
|
8
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
9
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
10
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
11
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
12
|
+
* Side Public License, v 1.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
16
|
+
import PropTypes from "prop-types";
|
|
17
|
+
import { useEuiTheme } from '../../services';
|
|
18
|
+
import { EuiFlyoutContext } from './flyout_context';
|
|
19
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
20
|
+
/**
|
|
21
|
+
* An intermediate component between EuiFlyout and EuiFlyoutChild.
|
|
22
|
+
* It is responsible for managing the state of the child flyout, and passing it to EuiFlyoutContext.
|
|
23
|
+
* It removes the responsibility of managing child flyout state from EuiFlyout, which is especially important there might not be a child flyout.
|
|
24
|
+
*/
|
|
25
|
+
export var EuiFlyoutChildProvider = function EuiFlyoutChildProvider(_ref) {
|
|
26
|
+
var parentSize = _ref.parentSize,
|
|
27
|
+
parentFlyoutRef = _ref.parentFlyoutRef,
|
|
28
|
+
childElement = _ref.childElement,
|
|
29
|
+
childrenToRender = _ref.childrenToRender,
|
|
30
|
+
reportIsChildOpen = _ref.reportIsChildOpen,
|
|
31
|
+
reportChildLayoutMode = _ref.reportChildLayoutMode;
|
|
32
|
+
var _useEuiTheme = useEuiTheme(),
|
|
33
|
+
euiTheme = _useEuiTheme.euiTheme;
|
|
34
|
+
var _useState = useState(false),
|
|
35
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
36
|
+
isChildFlyoutOpen = _useState2[0],
|
|
37
|
+
setIsChildFlyoutOpen = _useState2[1];
|
|
38
|
+
var _useState3 = useState(typeof window !== 'undefined' ? window.innerWidth : Infinity),
|
|
39
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
40
|
+
windowWidth = _useState4[0],
|
|
41
|
+
setWindowWidth = _useState4[1];
|
|
42
|
+
var _useState5 = useState('side-by-side'),
|
|
43
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
44
|
+
childLayoutMode = _useState6[0],
|
|
45
|
+
setChildLayoutMode = _useState6[1];
|
|
46
|
+
|
|
47
|
+
// update windowWidth on resize
|
|
48
|
+
useEffect(function () {
|
|
49
|
+
if (typeof window === 'undefined') return;
|
|
50
|
+
var handleResize = function handleResize() {
|
|
51
|
+
setWindowWidth(window.innerWidth);
|
|
52
|
+
};
|
|
53
|
+
window.addEventListener('resize', handleResize);
|
|
54
|
+
handleResize();
|
|
55
|
+
return function () {
|
|
56
|
+
return window.removeEventListener('resize', handleResize);
|
|
57
|
+
};
|
|
58
|
+
}, []);
|
|
59
|
+
|
|
60
|
+
// Calculate stacking breakpoint value for child flyout.
|
|
61
|
+
// Stacking breakpoint value is a sum of parent breakpoint value and child breakpoint value.
|
|
62
|
+
var stackingBreakpointValue = useMemo(function () {
|
|
63
|
+
var parentSizeName = parentSize;
|
|
64
|
+
var childSizeName = childElement.props.size || 's';
|
|
65
|
+
var parentNumericValue = 0;
|
|
66
|
+
if (parentSizeName === 's') parentNumericValue = euiTheme.breakpoint.s;else if (parentSizeName === 'm') parentNumericValue = euiTheme.breakpoint.m;
|
|
67
|
+
// Parent 'l' size is not allowed when child is present, so no need to check here
|
|
68
|
+
|
|
69
|
+
var childNumericValue = 0;
|
|
70
|
+
if (childSizeName === 's') childNumericValue = euiTheme.breakpoint.s;else if (childSizeName === 'm') childNumericValue = euiTheme.breakpoint.m;
|
|
71
|
+
return parentNumericValue + childNumericValue;
|
|
72
|
+
}, [parentSize, childElement.props.size, euiTheme.breakpoint]);
|
|
73
|
+
|
|
74
|
+
// update childLayoutMode based on windowWidth and the calculated stackingBreakpoint
|
|
75
|
+
useEffect(function () {
|
|
76
|
+
if (windowWidth >= stackingBreakpointValue) {
|
|
77
|
+
setChildLayoutMode('side-by-side');
|
|
78
|
+
} else {
|
|
79
|
+
setChildLayoutMode('stacked');
|
|
80
|
+
}
|
|
81
|
+
}, [windowWidth, stackingBreakpointValue]);
|
|
82
|
+
|
|
83
|
+
// report isChildFlyoutOpen changes to the parent EuiFlyout
|
|
84
|
+
useEffect(function () {
|
|
85
|
+
reportIsChildOpen(isChildFlyoutOpen);
|
|
86
|
+
}, [isChildFlyoutOpen, reportIsChildOpen]);
|
|
87
|
+
|
|
88
|
+
// report childLayoutMode changes to the parent EuiFlyout
|
|
89
|
+
useEffect(function () {
|
|
90
|
+
reportChildLayoutMode(childLayoutMode);
|
|
91
|
+
}, [childLayoutMode, reportChildLayoutMode]);
|
|
92
|
+
var contextValue = useMemo(function () {
|
|
93
|
+
return {
|
|
94
|
+
parentSize: parentSize,
|
|
95
|
+
parentFlyoutRef: parentFlyoutRef,
|
|
96
|
+
isChildFlyoutOpen: isChildFlyoutOpen,
|
|
97
|
+
setIsChildFlyoutOpen: setIsChildFlyoutOpen,
|
|
98
|
+
childLayoutMode: childLayoutMode
|
|
99
|
+
};
|
|
100
|
+
}, [parentSize, parentFlyoutRef, isChildFlyoutOpen, setIsChildFlyoutOpen, childLayoutMode]);
|
|
101
|
+
return ___EmotionJSX(EuiFlyoutContext.Provider, {
|
|
102
|
+
value: contextValue
|
|
103
|
+
}, childrenToRender);
|
|
104
|
+
};
|
|
105
|
+
EuiFlyoutChildProvider.propTypes = {
|
|
106
|
+
parentSize: PropTypes.oneOf(["s", "m"]).isRequired,
|
|
107
|
+
parentFlyoutRef: PropTypes.any.isRequired,
|
|
108
|
+
childElement: PropTypes.element.isRequired,
|
|
109
|
+
childrenToRender: PropTypes.node.isRequired,
|
|
110
|
+
reportIsChildOpen: PropTypes.func.isRequired,
|
|
111
|
+
reportChildLayoutMode: PropTypes.func.isRequired
|
|
112
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { createContext } from 'react';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Context shared between the main and child flyouts
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
export var EuiFlyoutContext = /*#__PURE__*/createContext(null);
|
|
@@ -11,4 +11,6 @@ export { EuiFlyoutBody } from './flyout_body';
|
|
|
11
11
|
export { EuiFlyoutFooter } from './flyout_footer';
|
|
12
12
|
export { EuiFlyoutHeader } from './flyout_header';
|
|
13
13
|
export { euiFlyoutSlideInRight, euiFlyoutSlideInLeft } from './flyout.styles';
|
|
14
|
-
export { EuiFlyoutResizable } from './flyout_resizable';
|
|
14
|
+
export { EuiFlyoutResizable } from './flyout_resizable';
|
|
15
|
+
export { EuiFlyoutChild } from './flyout_child';
|
|
16
|
+
export { EuiFlyoutSessionProvider, useEuiFlyoutSession } from './sessions';
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
5
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
6
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
7
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
8
|
+
/*
|
|
9
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
10
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
11
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
12
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
13
|
+
* Side Public License, v 1.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import React, { createContext, useContext, useReducer } from 'react';
|
|
17
|
+
import { EuiFlyout, EuiFlyoutChild } from '../index';
|
|
18
|
+
import { initialFlyoutState, flyoutReducer } from './flyout_reducer';
|
|
19
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
20
|
+
var EuiFlyoutSessionContext = /*#__PURE__*/createContext(null);
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Accesses the state data and dispatch function from the context of EuiFlyoutSessionProvider
|
|
24
|
+
* Use this if you need to debug the state or need direct access to the dispatch function, otherwise use useEuiFlyoutSession hook.
|
|
25
|
+
*/
|
|
26
|
+
export var useEuiFlyoutSessionContext = function useEuiFlyoutSessionContext() {
|
|
27
|
+
var context = useContext(EuiFlyoutSessionContext);
|
|
28
|
+
if (!context) {
|
|
29
|
+
throw new Error('useEuiFlyoutSessionContext must be used within a EuiFlyoutSessionProvider');
|
|
30
|
+
}
|
|
31
|
+
return context;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* FlyoutProvider is a component that provides a context for Flyout components.
|
|
36
|
+
* It is used to manage the state of the Flyout and its child.
|
|
37
|
+
* It also renders the Flyout and FlyoutChild components.
|
|
38
|
+
*
|
|
39
|
+
* @param children - The children of the FlyoutProvider component.
|
|
40
|
+
* @param renderMainFlyoutContent - A function that renders the content of the main Flyout.
|
|
41
|
+
* @param renderChildFlyoutContent - A function that renders the content of the child Flyout.
|
|
42
|
+
* @returns The FlyoutProvider component.
|
|
43
|
+
*/
|
|
44
|
+
export var EuiFlyoutSessionProvider = function EuiFlyoutSessionProvider(_ref) {
|
|
45
|
+
var children = _ref.children,
|
|
46
|
+
renderMainFlyoutContent = _ref.renderMainFlyoutContent,
|
|
47
|
+
renderChildFlyoutContent = _ref.renderChildFlyoutContent;
|
|
48
|
+
var _useReducer = useReducer(flyoutReducer, initialFlyoutState),
|
|
49
|
+
_useReducer2 = _slicedToArray(_useReducer, 2),
|
|
50
|
+
state = _useReducer2[0],
|
|
51
|
+
dispatch = _useReducer2[1];
|
|
52
|
+
var activeFlyoutGroup = state.activeFlyoutGroup;
|
|
53
|
+
var handleClose = function handleClose() {
|
|
54
|
+
dispatch({
|
|
55
|
+
type: 'CLEAR_HISTORY'
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
var handleCloseChild = function handleCloseChild() {
|
|
59
|
+
dispatch({
|
|
60
|
+
type: 'CLOSE_CHILD_FLYOUT'
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
var mainFlyoutContentNode = null;
|
|
64
|
+
var childFlyoutContentNode = null;
|
|
65
|
+
if (activeFlyoutGroup) {
|
|
66
|
+
var mainRenderContext = {
|
|
67
|
+
flyoutProps: activeFlyoutGroup.config.mainFlyoutProps || {},
|
|
68
|
+
flyoutSize: activeFlyoutGroup.config.mainSize,
|
|
69
|
+
flyoutType: 'main',
|
|
70
|
+
dispatch: dispatch,
|
|
71
|
+
activeFlyoutGroup: activeFlyoutGroup,
|
|
72
|
+
onCloseFlyout: handleClose,
|
|
73
|
+
onCloseChildFlyout: handleCloseChild,
|
|
74
|
+
meta: activeFlyoutGroup.meta
|
|
75
|
+
};
|
|
76
|
+
mainFlyoutContentNode = renderMainFlyoutContent(mainRenderContext);
|
|
77
|
+
if (activeFlyoutGroup.isChildOpen && renderChildFlyoutContent) {
|
|
78
|
+
var childRenderContext = {
|
|
79
|
+
flyoutProps: activeFlyoutGroup.config.childFlyoutProps || {},
|
|
80
|
+
flyoutSize: activeFlyoutGroup.config.childSize,
|
|
81
|
+
flyoutType: 'child',
|
|
82
|
+
dispatch: dispatch,
|
|
83
|
+
activeFlyoutGroup: activeFlyoutGroup,
|
|
84
|
+
onCloseFlyout: handleClose,
|
|
85
|
+
onCloseChildFlyout: handleCloseChild,
|
|
86
|
+
meta: activeFlyoutGroup.meta
|
|
87
|
+
};
|
|
88
|
+
childFlyoutContentNode = renderChildFlyoutContent(childRenderContext);
|
|
89
|
+
} else if (activeFlyoutGroup.isChildOpen && !renderChildFlyoutContent) {
|
|
90
|
+
console.warn('EuiFlyoutSessionProvider: A child flyout is open, but renderChildFlyoutContent was not provided.');
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
var config = activeFlyoutGroup === null || activeFlyoutGroup === void 0 ? void 0 : activeFlyoutGroup.config;
|
|
94
|
+
var flyoutPropsMain = (config === null || config === void 0 ? void 0 : config.mainFlyoutProps) || {};
|
|
95
|
+
var flyoutPropsChild = (config === null || config === void 0 ? void 0 : config.childFlyoutProps) || {};
|
|
96
|
+
return ___EmotionJSX(EuiFlyoutSessionContext.Provider, {
|
|
97
|
+
value: {
|
|
98
|
+
state: state,
|
|
99
|
+
dispatch: dispatch
|
|
100
|
+
}
|
|
101
|
+
}, children, (activeFlyoutGroup === null || activeFlyoutGroup === void 0 ? void 0 : activeFlyoutGroup.isMainOpen) && ___EmotionJSX(EuiFlyout, _extends({
|
|
102
|
+
onClose: handleClose,
|
|
103
|
+
size: activeFlyoutGroup.config.mainSize,
|
|
104
|
+
ownFocus: !activeFlyoutGroup.isChildOpen
|
|
105
|
+
}, flyoutPropsMain), mainFlyoutContentNode, activeFlyoutGroup.isChildOpen && childFlyoutContentNode && ___EmotionJSX(EuiFlyoutChild, _extends({
|
|
106
|
+
onClose: handleCloseChild,
|
|
107
|
+
size: activeFlyoutGroup.config.childSize
|
|
108
|
+
}, flyoutPropsChild), childFlyoutContentNode)));
|
|
109
|
+
};
|