@elastic/eui 111.0.0 → 111.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/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 +36 -55
- package/es/components/basic_table/in_memory_table.js +6 -6
- package/es/components/beacon/beacon.styles.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/button/index.js +2 -1
- package/es/components/button/split_button/index.js +10 -0
- package/es/components/button/split_button/split_button.js +120 -0
- package/es/components/button/split_button/split_button.styles.js +51 -0
- package/es/components/button/split_button/split_button_actions.js +115 -0
- package/es/components/button/split_button/split_button_context.js +14 -0
- package/es/components/call_out/call_out.js +1 -1
- package/es/components/card/card.js +1 -1
- package/es/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +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/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/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/controls/fullscreen_selector.styles.js +1 -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 +2 -2
- package/es/components/flex/flex_group.js +1 -1
- package/es/components/flyout/flyout.styles.js +1 -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_button/form_control_button.js +1 -1
- 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/horizontal_rule/horizontal_rule.js +1 -1
- package/es/components/icon/assets/agentBuilderRobot.js +37 -0
- package/es/components/icon/assets/cross_project_search.js +35 -0
- package/es/components/icon/assets/dashed_circle.js +35 -0
- package/es/components/icon/assets/product_robot.js +37 -0
- package/es/components/icon/icon.js +1 -1
- package/es/components/icon/icon_map.js +3 -0
- package/es/components/key_pad_menu/key_pad_menu_item.js +1 -1
- package/es/components/link/external_link_icon.js +6 -3
- 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 +2 -2
- package/es/components/pagination/pagination_button.js +1 -1
- package/es/components/search_bar/search_bar.js +1 -1
- 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/spacer/spacer.js +1 -1
- package/es/components/table/table_header_cell.js +1 -1
- 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/components/tour/tour_step_indicator.js +8 -3
- package/es/global_styling/mixins/_button.js +28 -9
- package/es/global_styling/mixins/_container_query.js +106 -0
- package/es/global_styling/mixins/index.js +1 -0
- package/es/services/container_query/container_query_hook.js +64 -0
- package/es/services/container_query/index.js +9 -0
- package/es/services/container_query/match_container.js +242 -0
- package/eui.d.ts +414 -61
- package/i18ntokens.json +1053 -1053
- 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 +36 -55
- package/lib/components/basic_table/in_memory_table.js +6 -6
- package/lib/components/beacon/beacon.styles.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/button/index.js +8 -1
- package/lib/components/button/split_button/index.js +25 -0
- package/lib/components/button/split_button/split_button.js +129 -0
- package/lib/components/button/split_button/split_button.styles.js +55 -0
- package/lib/components/button/split_button/split_button_actions.js +123 -0
- package/lib/components/button/split_button/split_button_context.js +20 -0
- package/lib/components/call_out/call_out.js +1 -1
- package/lib/components/card/card.js +1 -1
- package/lib/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +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/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/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/controls/fullscreen_selector.styles.js +1 -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 +2 -2
- package/lib/components/flex/flex_group.js +1 -1
- package/lib/components/flyout/flyout.styles.js +2 -1
- 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_button/form_control_button.js +1 -1
- 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/horizontal_rule/horizontal_rule.js +1 -1
- package/lib/components/icon/assets/agentBuilderRobot.js +44 -0
- package/lib/components/icon/assets/cross_project_search.js +42 -0
- package/lib/components/icon/assets/dashed_circle.js +42 -0
- package/lib/components/icon/assets/product_robot.js +44 -0
- package/lib/components/icon/icon.js +1 -1
- package/lib/components/icon/icon_map.js +3 -0
- package/lib/components/icon/svgs/cross_project_search.svg +3 -0
- package/lib/components/icon/svgs/dashed_circle.svg +5 -0
- package/lib/components/icon/svgs/product_robot.svg +4 -0
- package/lib/components/key_pad_menu/key_pad_menu_item.js +1 -1
- package/lib/components/link/external_link_icon.js +6 -3
- 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 +2 -2
- package/lib/components/pagination/pagination_button.js +1 -1
- package/lib/components/search_bar/search_bar.js +1 -1
- 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/spacer/spacer.js +1 -1
- package/lib/components/table/table_header_cell.js +1 -1
- 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/components/tour/tour_step_indicator.js +8 -3
- package/lib/global_styling/mixins/_button.js +29 -10
- package/lib/global_styling/mixins/_container_query.js +112 -0
- package/lib/global_styling/mixins/index.js +11 -0
- package/lib/services/container_query/container_query_hook.js +67 -0
- package/lib/services/container_query/index.js +16 -0
- package/lib/services/container_query/match_container.js +243 -0
- package/optimize/es/components/basic_table/basic_table.js +30 -49
- package/optimize/es/components/beacon/beacon.styles.js +1 -1
- package/optimize/es/components/button/index.js +2 -1
- package/optimize/es/components/button/split_button/index.js +10 -0
- package/optimize/es/components/button/split_button/split_button.js +98 -0
- package/optimize/es/components/button/split_button/split_button.styles.js +51 -0
- package/optimize/es/components/button/split_button/split_button_actions.js +89 -0
- package/optimize/es/components/button/split_button/split_button_context.js +14 -0
- package/optimize/es/components/datagrid/controls/fullscreen_selector.styles.js +1 -1
- package/optimize/es/components/empty_prompt/empty_prompt.js +1 -1
- package/optimize/es/components/flex/flex_group.js +1 -1
- package/optimize/es/components/flyout/flyout.styles.js +1 -0
- package/optimize/es/components/horizontal_rule/horizontal_rule.js +1 -1
- package/optimize/es/components/icon/assets/agentBuilderRobot.js +36 -0
- package/optimize/es/components/icon/assets/cross_project_search.js +34 -0
- package/optimize/es/components/icon/assets/dashed_circle.js +34 -0
- package/optimize/es/components/icon/assets/product_robot.js +36 -0
- package/optimize/es/components/icon/icon_map.js +3 -0
- package/optimize/es/components/link/external_link_icon.js +6 -3
- package/optimize/es/components/page/page_header/page_header_content.js +1 -1
- package/optimize/es/components/search_bar/search_bar.js +1 -1
- package/optimize/es/components/spacer/spacer.js +1 -1
- package/optimize/es/components/tour/tour_step_indicator.js +8 -3
- package/optimize/es/global_styling/mixins/_button.js +28 -9
- package/optimize/es/global_styling/mixins/_container_query.js +106 -0
- package/optimize/es/global_styling/mixins/index.js +1 -0
- package/optimize/es/services/container_query/container_query_hook.js +59 -0
- package/optimize/es/services/container_query/index.js +9 -0
- package/optimize/es/services/container_query/match_container.js +229 -0
- package/optimize/lib/components/basic_table/basic_table.js +30 -49
- package/optimize/lib/components/beacon/beacon.styles.js +1 -1
- package/optimize/lib/components/button/index.js +8 -1
- package/optimize/lib/components/button/split_button/index.js +25 -0
- package/optimize/lib/components/button/split_button/split_button.js +107 -0
- package/optimize/lib/components/button/split_button/split_button.styles.js +55 -0
- package/optimize/lib/components/button/split_button/split_button_actions.js +98 -0
- package/optimize/lib/components/button/split_button/split_button_context.js +20 -0
- package/optimize/lib/components/datagrid/controls/fullscreen_selector.styles.js +1 -1
- package/optimize/lib/components/empty_prompt/empty_prompt.js +1 -1
- package/optimize/lib/components/flex/flex_group.js +1 -1
- package/optimize/lib/components/flyout/flyout.styles.js +2 -1
- package/optimize/lib/components/horizontal_rule/horizontal_rule.js +1 -1
- package/optimize/lib/components/icon/assets/agentBuilderRobot.js +44 -0
- package/optimize/lib/components/icon/assets/cross_project_search.js +42 -0
- package/optimize/lib/components/icon/assets/dashed_circle.js +42 -0
- package/optimize/lib/components/icon/assets/product_robot.js +44 -0
- package/optimize/lib/components/icon/icon_map.js +3 -0
- package/optimize/lib/components/icon/svgs/cross_project_search.svg +3 -0
- package/optimize/lib/components/icon/svgs/dashed_circle.svg +5 -0
- package/optimize/lib/components/icon/svgs/product_robot.svg +4 -0
- package/optimize/lib/components/link/external_link_icon.js +6 -3
- package/optimize/lib/components/page/page_header/page_header_content.js +1 -1
- package/optimize/lib/components/search_bar/search_bar.js +1 -1
- package/optimize/lib/components/spacer/spacer.js +1 -1
- package/optimize/lib/components/tour/tour_step_indicator.js +8 -3
- package/optimize/lib/global_styling/mixins/_button.js +29 -10
- package/optimize/lib/global_styling/mixins/_container_query.js +112 -0
- package/optimize/lib/global_styling/mixins/index.js +11 -0
- package/optimize/lib/services/container_query/container_query_hook.js +65 -0
- package/optimize/lib/services/container_query/index.js +16 -0
- package/optimize/lib/services/container_query/match_container.js +231 -0
- 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 +36 -55
- package/test-env/components/basic_table/in_memory_table.js +6 -6
- package/test-env/components/beacon/beacon.styles.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/button/index.js +8 -1
- package/test-env/components/button/split_button/index.js +25 -0
- package/test-env/components/button/split_button/split_button.js +123 -0
- package/test-env/components/button/split_button/split_button.styles.js +55 -0
- package/test-env/components/button/split_button/split_button_actions.js +120 -0
- package/test-env/components/button/split_button/split_button_context.js +20 -0
- package/test-env/components/call_out/call_out.js +1 -1
- package/test-env/components/card/card.js +1 -1
- package/test-env/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +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/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/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/controls/fullscreen_selector.styles.js +1 -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 +2 -2
- package/test-env/components/flex/flex_group.js +1 -1
- package/test-env/components/flyout/flyout.styles.js +2 -1
- 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_button/form_control_button.js +1 -1
- 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/horizontal_rule/horizontal_rule.js +1 -1
- package/test-env/components/icon/assets/agentBuilderRobot.js +44 -0
- package/test-env/components/icon/assets/cross_project_search.js +42 -0
- package/test-env/components/icon/assets/dashed_circle.js +42 -0
- package/test-env/components/icon/assets/product_robot.js +44 -0
- package/test-env/components/icon/icon_map.js +3 -0
- package/test-env/components/key_pad_menu/key_pad_menu_item.js +1 -1
- package/test-env/components/link/external_link_icon.js +6 -3
- 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 +2 -2
- package/test-env/components/pagination/pagination_button.js +1 -1
- package/test-env/components/search_bar/search_bar.js +1 -1
- 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/spacer/spacer.js +1 -1
- package/test-env/components/table/table_header_cell.js +1 -1
- 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/components/tour/tour_step_indicator.js +8 -3
- package/test-env/global_styling/mixins/_button.js +29 -10
- package/test-env/global_styling/mixins/_container_query.js +112 -0
- package/test-env/global_styling/mixins/index.js +11 -0
- package/test-env/services/container_query/container_query_hook.js +65 -0
- package/test-env/services/container_query/index.js +16 -0
- package/test-env/services/container_query/match_container.js +231 -0
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.ContainerQueryListChangeEvent = exports.ContainerQueryList = void 0;
|
|
8
|
+
exports.matchContainer = matchContainer;
|
|
9
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
+
var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
|
|
16
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
|
+
var _uuid = require("uuid");
|
|
18
|
+
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
|
|
19
|
+
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
|
|
20
|
+
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
|
21
|
+
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
|
22
|
+
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
|
23
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
24
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /*
|
|
25
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
26
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
27
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
28
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
29
|
+
* Side Public License, v 1.
|
|
30
|
+
*/ /**
|
|
31
|
+
* @license MIT License
|
|
32
|
+
*
|
|
33
|
+
* Copyright (c) 2025 Martin Winkler
|
|
34
|
+
*
|
|
35
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
36
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
37
|
+
* in the Software without restriction, including without limitation the rights
|
|
38
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
39
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
40
|
+
* furnished to do so, subject to the following conditions:
|
|
41
|
+
*
|
|
42
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
43
|
+
* copies or substantial portions of the Software.
|
|
44
|
+
*
|
|
45
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
46
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
47
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
48
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
49
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
50
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
51
|
+
* SOFTWARE.
|
|
52
|
+
*
|
|
53
|
+
* @see {@link https://github.com/teetotum/match-container/blob/main/matchContainer.js}
|
|
54
|
+
*/
|
|
55
|
+
/**
|
|
56
|
+
* Listen for changes on a container query.
|
|
57
|
+
* Just like `window.matchMedia`.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```js
|
|
61
|
+
* const cql = matchContainer(element, '(width > 42rem)');
|
|
62
|
+
* cql.addEventListener('change', ({ matches }) {
|
|
63
|
+
* // ..
|
|
64
|
+
* })
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* @param element
|
|
68
|
+
* @param containerQueryString e.g. (width > 42rem)
|
|
69
|
+
* @returns ContainerQueryList
|
|
70
|
+
*/
|
|
71
|
+
function matchContainer(element, containerQueryString) {
|
|
72
|
+
return new ContainerQueryList(element, containerQueryString);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* `change` event dispatched by instances of {@link ContainerQueryList}
|
|
77
|
+
* whenever the value of `matches` changes
|
|
78
|
+
*/
|
|
79
|
+
var ContainerQueryListChangeEvent = exports.ContainerQueryListChangeEvent = /*#__PURE__*/function (_Event) {
|
|
80
|
+
function ContainerQueryListChangeEvent(matches, container) {
|
|
81
|
+
var _this;
|
|
82
|
+
(0, _classCallCheck2.default)(this, ContainerQueryListChangeEvent);
|
|
83
|
+
_this = _callSuper(this, ContainerQueryListChangeEvent, ['change']);
|
|
84
|
+
/** Whether the container query matches */
|
|
85
|
+
(0, _defineProperty2.default)(_this, "matches", void 0);
|
|
86
|
+
/** A string representation of the container query list e.g. "(width > 1000px)" */
|
|
87
|
+
(0, _defineProperty2.default)(_this, "container", void 0);
|
|
88
|
+
_this.matches = matches;
|
|
89
|
+
_this.container = container;
|
|
90
|
+
return _this;
|
|
91
|
+
}
|
|
92
|
+
(0, _inherits2.default)(ContainerQueryListChangeEvent, _Event);
|
|
93
|
+
return (0, _createClass2.default)(ContainerQueryListChangeEvent);
|
|
94
|
+
}( /*#__PURE__*/(0, _wrapNativeSuper2.default)(Event));
|
|
95
|
+
/**
|
|
96
|
+
* A hacky implementation of a possible native `ContainerQueryList`
|
|
97
|
+
* based on the teetotum/match-container polyfill:
|
|
98
|
+
* - based on a API proposal in W3C CSS WG {@link https://github.com/w3c/csswg-drafts/issues/6205})
|
|
99
|
+
* - mimicking MediaQueryList {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList}
|
|
100
|
+
*
|
|
101
|
+
* Not meant to be used directly, but rather call `matchContainer`.
|
|
102
|
+
*
|
|
103
|
+
* It works by listening on a `transitionrun` event on the element,
|
|
104
|
+
* that gets triggered by a container query changing a custom property.
|
|
105
|
+
* Setting `transition-behavior: allow-discrete` is what makes it possible
|
|
106
|
+
* to have a CSS `transition` for a custom property.
|
|
107
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/transition-behavior}
|
|
108
|
+
*/
|
|
109
|
+
var _matches = /*#__PURE__*/new WeakMap();
|
|
110
|
+
var ContainerQueryList = exports.ContainerQueryList = /*#__PURE__*/function (_EventTarget) {
|
|
111
|
+
function ContainerQueryList(element, containerQueryString) {
|
|
112
|
+
var _this2;
|
|
113
|
+
(0, _classCallCheck2.default)(this, ContainerQueryList);
|
|
114
|
+
_this2 = _callSuper(this, ContainerQueryList);
|
|
115
|
+
(0, _defineProperty2.default)(_this2, "element", null);
|
|
116
|
+
(0, _defineProperty2.default)(_this2, "styleSheet", null);
|
|
117
|
+
(0, _defineProperty2.default)(_this2, "markerAttributeName", '');
|
|
118
|
+
(0, _defineProperty2.default)(_this2, "sentinelPropertyName", '');
|
|
119
|
+
(0, _defineProperty2.default)(_this2, "computedStyle", null);
|
|
120
|
+
(0, _defineProperty2.default)(_this2, "transitionRunListener", null);
|
|
121
|
+
_classPrivateFieldInitSpec(_this2, _matches, false);
|
|
122
|
+
/**
|
|
123
|
+
* A string representation of the container query list e.g. "(width > 1000px)"
|
|
124
|
+
* (the name is weird but it is so for consistency with mediaQueryList.media)
|
|
125
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList/media}
|
|
126
|
+
* */
|
|
127
|
+
(0, _defineProperty2.default)(_this2, "container", void 0);
|
|
128
|
+
_this2.container = containerQueryString;
|
|
129
|
+
_this2.element = element;
|
|
130
|
+
// we call this only once to try to avoid any impact on performance
|
|
131
|
+
_this2.computedStyle = getComputedStyle(_this2.element);
|
|
132
|
+
var uniqueName = "container-query-observer-".concat((0, _uuid.v1)());
|
|
133
|
+
_this2.markerAttributeName = "data-".concat(uniqueName);
|
|
134
|
+
_this2.sentinelPropertyName = "--".concat(uniqueName);
|
|
135
|
+
|
|
136
|
+
// order is important (as in life)
|
|
137
|
+
_this2.applyMarkerAttribute();
|
|
138
|
+
_this2.createStyleSheet();
|
|
139
|
+
_classPrivateFieldSet(_matches, _this2, _this2.computedStyle.getPropertyValue(_this2.sentinelPropertyName) === '--true');
|
|
140
|
+
_this2.setupTransitionListener();
|
|
141
|
+
return _this2;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* The marker attribute is `data-container-query-observer-{UUID}`,
|
|
146
|
+
* it will be used as a selector in the container query,
|
|
147
|
+
* in the global CSS that's being added below.
|
|
148
|
+
*/
|
|
149
|
+
(0, _inherits2.default)(ContainerQueryList, _EventTarget);
|
|
150
|
+
return (0, _createClass2.default)(ContainerQueryList, [{
|
|
151
|
+
key: "matches",
|
|
152
|
+
get: /** Whether the container query matches */
|
|
153
|
+
function get() {
|
|
154
|
+
return _classPrivateFieldGet(_matches, this);
|
|
155
|
+
}
|
|
156
|
+
}, {
|
|
157
|
+
key: "applyMarkerAttribute",
|
|
158
|
+
value: function applyMarkerAttribute() {
|
|
159
|
+
this.element.setAttribute(this.markerAttributeName, '');
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Create a CSS custom property with values either `--true` or `--false`,
|
|
164
|
+
* and add container query targetting the element.
|
|
165
|
+
* Whenever the container query matches, the custom property will be `--true`.
|
|
166
|
+
* This styles are added globaly via `document.adoptedStyleSheets`.
|
|
167
|
+
*/
|
|
168
|
+
}, {
|
|
169
|
+
key: "createStyleSheet",
|
|
170
|
+
value: function createStyleSheet() {
|
|
171
|
+
var css = "\n @property ".concat(this.sentinelPropertyName, " {\n syntax: '<custom-ident>';\n inherits: false;\n initial-value: --false;\n }\n @container ").concat(this.container, " {\n [").concat(this.markerAttributeName, "] {\n ").concat(this.sentinelPropertyName, ": --true;\n }\n }\n ");
|
|
172
|
+
var styleSheet = new CSSStyleSheet();
|
|
173
|
+
styleSheet.replaceSync(css);
|
|
174
|
+
document.adoptedStyleSheets = [].concat((0, _toConsumableArray2.default)(document.adoptedStyleSheets), [styleSheet]);
|
|
175
|
+
this.styleSheet = styleSheet;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* This is the key to the hack:
|
|
180
|
+
* - a `transition` style is added for the custom property
|
|
181
|
+
* - the `transitionrun` event will fire whenever the custom property value changes
|
|
182
|
+
* because of the container query
|
|
183
|
+
* - we get the value from computed styles
|
|
184
|
+
* - the `matches` value is updated and
|
|
185
|
+
* - a ContainerQueryListChangeEvent event is dispatched
|
|
186
|
+
*/
|
|
187
|
+
}, {
|
|
188
|
+
key: "setupTransitionListener",
|
|
189
|
+
value: function setupTransitionListener() {
|
|
190
|
+
var _this3 = this;
|
|
191
|
+
var element = this.element,
|
|
192
|
+
computedStyle = this.computedStyle,
|
|
193
|
+
sentinelPropertyName = this.sentinelPropertyName;
|
|
194
|
+
if (!element) return;
|
|
195
|
+
var currentValue = computedStyle.getPropertyValue(sentinelPropertyName);
|
|
196
|
+
element.style.setProperty('transition', "".concat(sentinelPropertyName, " 0.001ms step-start"));
|
|
197
|
+
element.style.setProperty('transition-behavior', 'allow-discrete');
|
|
198
|
+
this.transitionRunListener = function (event) {
|
|
199
|
+
if (event.target !== element) return;
|
|
200
|
+
var nextValue = computedStyle.getPropertyValue(sentinelPropertyName);
|
|
201
|
+
if (nextValue === currentValue) return;
|
|
202
|
+
currentValue = nextValue;
|
|
203
|
+
_classPrivateFieldSet(_matches, _this3, nextValue === '--true');
|
|
204
|
+
_this3.dispatchEvent(new ContainerQueryListChangeEvent(_classPrivateFieldGet(_matches, _this3), _this3.container));
|
|
205
|
+
};
|
|
206
|
+
element.addEventListener('transitionrun', this.transitionRunListener);
|
|
207
|
+
}
|
|
208
|
+
}, {
|
|
209
|
+
key: "dispose",
|
|
210
|
+
value: function dispose() {
|
|
211
|
+
var _this4 = this;
|
|
212
|
+
// remove the stylesheet from adoptedStyleSheets
|
|
213
|
+
if (this.styleSheet) {
|
|
214
|
+
document.adoptedStyleSheets = document.adoptedStyleSheets.filter(function (sheet) {
|
|
215
|
+
return sheet !== _this4.styleSheet;
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
if (!this.element) return;
|
|
219
|
+
if (this.transitionRunListener) {
|
|
220
|
+
this.element.removeEventListener('transitionrun', this.transitionRunListener);
|
|
221
|
+
}
|
|
222
|
+
this.element.removeAttribute(this.markerAttributeName);
|
|
223
|
+
this.element.style.removeProperty('transition');
|
|
224
|
+
this.element.style.removeProperty('transition-behavior');
|
|
225
|
+
this.element = null;
|
|
226
|
+
this.styleSheet = null;
|
|
227
|
+
this.computedStyle = null;
|
|
228
|
+
this.transitionRunListener = null;
|
|
229
|
+
}
|
|
230
|
+
}]);
|
|
231
|
+
}( /*#__PURE__*/(0, _wrapNativeSuper2.default)(EventTarget));
|