@elastic/eui 109.0.0 → 109.1.0-snapshot.1763390960850
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/accessibility/skip_link/skip_link.js +10 -1
- package/es/components/bottom_bar/bottom_bar.js +12 -2
- package/es/components/button/button.js +20 -25
- package/es/components/button/button_display/_button_display.js +32 -30
- package/es/components/button/button_display/_button_display.styles.js +4 -4
- package/es/components/button/button_empty/button_empty.js +32 -14
- package/es/components/button/button_group/button_group.js +49 -31
- package/es/components/button/button_group/button_group_button.js +14 -2
- package/es/components/button/button_group/button_group_button.styles.js +12 -8
- package/es/components/button/button_icon/button_icon.js +30 -6
- package/es/components/card/card.js +20 -25
- package/es/components/card/card_select/card_select.js +20 -25
- package/es/components/code/code_block_virtualized.js +9 -7
- package/es/components/collapsible_nav_beta/_kibana_solution/collapsible_nav_kibana_solution.js +13 -1
- package/es/components/datagrid/body/cell/data_grid_cell.js +35 -12
- package/es/components/datagrid/body/data_grid_body.js +23 -6
- package/es/components/datagrid/body/data_grid_body_custom.js +23 -6
- package/es/components/datagrid/body/data_grid_body_virtualized.js +23 -6
- package/es/components/datagrid/body/header/data_grid_header_cell.js +23 -6
- package/es/components/datagrid/controls/column_selector.js +36 -19
- package/es/components/datagrid/controls/column_sorting.js +23 -6
- package/es/components/datagrid/controls/data_grid_toolbar_control.js +13 -7
- package/es/components/datagrid/data_grid.js +5 -1
- package/es/components/datagrid/utils/in_memory.js +25 -7
- package/es/components/date_picker/auto_refresh/auto_refresh.js +11 -2
- package/es/components/date_picker/super_date_picker/date_popover/absolute_tab.js +31 -5
- package/es/components/date_picker/super_date_picker/date_popover/date_popover_button.js +24 -3
- package/es/components/date_picker/super_date_picker/date_popover/date_popover_content.js +26 -4
- package/es/components/date_picker/super_date_picker/date_popover/relative_tab.js +29 -3
- package/es/components/date_picker/super_date_picker/date_popover/timezone_display.js +98 -0
- package/es/components/date_picker/super_date_picker/date_popover/timezone_display.styles.js +19 -0
- package/es/components/date_picker/super_date_picker/pretty_duration.js +1 -8
- package/es/components/date_picker/super_date_picker/relative_utils.js +8 -0
- package/es/components/date_picker/super_date_picker/super_date_picker.js +118 -26
- package/es/components/date_picker/super_date_picker/time_window_buttons.js +185 -0
- package/es/components/facet/facet_button.js +9 -19
- package/es/components/filter_group/filter_button.js +14 -1
- package/es/components/flyout/flyout.js +27 -10
- package/es/components/form/form_control_button/form_control_button.js +13 -7
- package/es/components/header/header_links/header_link.js +13 -7
- package/es/components/header/header_section/header_section_item_button.js +13 -7
- package/es/components/icon/assets/boxes_vertical.js +1 -1
- package/es/components/icon/assets/checkInCircleFilled.js +1 -2
- package/es/components/icon/assets/errorFilled.js +1 -2
- package/es/components/icon/assets/warningFilled.js +1 -2
- package/es/components/icon/icon_map.js +3 -6
- package/es/components/list_group/list_group.js +13 -1
- package/es/components/list_group/list_group_item.js +13 -1
- package/es/components/list_group/list_group_item_extra_action.js +13 -1
- package/es/components/list_group/pinnable_list_group/pinnable_list_group.js +15 -2
- package/es/components/overlay_mask/overlay_mask.styles.js +1 -1
- package/es/components/pagination/pagination_button.js +13 -7
- package/es/components/popover/popover.js +22 -16
- package/es/components/provider/component_defaults/component_defaults.js +22 -2
- package/es/components/table/table_row.styles.js +1 -1
- package/es/components/tool_tip/tool_tip.js +24 -24
- package/es/global_styling/index.js +2 -1
- package/es/global_styling/mixins/_button.js +1 -1
- package/es/global_styling/utility/selectors.js +9 -0
- package/es/services/focus_trap/focus_trap_pub_sub.js +74 -0
- package/es/services/focus_trap/index.js +9 -0
- package/es/services/hooks/index.js +2 -1
- package/es/services/hooks/useEuiDisabledElement.js +195 -0
- package/es/services/index.js +1 -0
- package/es/services/popover/reposition_on_scroll.js +61 -0
- package/es/test/cypress/index.d.ts +12 -0
- package/es/test/cypress/index.js +9 -0
- package/es/test/cypress/matchers.d.ts +20 -0
- package/es/test/cypress/matchers.js +54 -0
- package/es/test/cypress/test_reposition_on_scroll.js +66 -0
- package/es/test/enzyme/enzyme_matchers.d.ts +36 -0
- package/es/test/enzyme/enzyme_matchers.js +43 -0
- package/es/test/enzyme/index.d.ts +14 -0
- package/es/test/enzyme/index.js +10 -0
- package/es/test/rtl/index.d.ts +9 -1
- package/es/test/rtl/index.js +2 -1
- package/es/test/rtl/matchers.d.ts +36 -0
- package/es/test/rtl/matchers.js +82 -0
- package/es/utils/element_can_be_disabled.js +16 -0
- package/es/utils/index.js +2 -1
- package/eui.d.ts +588 -180
- package/i18ntokens.json +1357 -1231
- package/lib/components/accessibility/skip_link/skip_link.js +10 -1
- package/lib/components/bottom_bar/bottom_bar.js +11 -1
- package/lib/components/button/button.js +21 -26
- package/lib/components/button/button_display/_button_display.js +31 -29
- package/lib/components/button/button_display/_button_display.styles.js +4 -4
- package/lib/components/button/button_empty/button_empty.js +31 -13
- package/lib/components/button/button_group/button_group.js +49 -31
- package/lib/components/button/button_group/button_group_button.js +14 -2
- package/lib/components/button/button_group/button_group_button.styles.js +10 -6
- package/lib/components/button/button_icon/button_icon.js +29 -5
- package/lib/components/card/card.js +21 -26
- package/lib/components/card/card_select/card_select.js +21 -26
- package/lib/components/code/code_block_virtualized.js +9 -7
- package/lib/components/collapsible_nav_beta/_kibana_solution/collapsible_nav_kibana_solution.js +13 -1
- package/lib/components/datagrid/body/cell/data_grid_cell.js +35 -12
- package/lib/components/datagrid/body/data_grid_body.js +23 -6
- package/lib/components/datagrid/body/data_grid_body_custom.js +23 -6
- package/lib/components/datagrid/body/data_grid_body_virtualized.js +23 -6
- package/lib/components/datagrid/body/header/data_grid_header_cell.js +23 -6
- package/lib/components/datagrid/controls/column_selector.js +36 -19
- package/lib/components/datagrid/controls/column_sorting.js +23 -6
- package/lib/components/datagrid/controls/data_grid_toolbar_control.js +13 -7
- package/lib/components/datagrid/data_grid.js +5 -1
- package/lib/components/datagrid/utils/in_memory.js +25 -7
- package/lib/components/date_picker/auto_refresh/auto_refresh.js +12 -3
- package/lib/components/date_picker/super_date_picker/date_popover/absolute_tab.js +30 -4
- package/lib/components/date_picker/super_date_picker/date_popover/date_popover_button.js +24 -3
- package/lib/components/date_picker/super_date_picker/date_popover/date_popover_content.js +26 -4
- package/lib/components/date_picker/super_date_picker/date_popover/relative_tab.js +29 -3
- package/lib/components/date_picker/super_date_picker/date_popover/timezone_display.js +104 -0
- package/lib/components/date_picker/super_date_picker/date_popover/timezone_display.styles.js +25 -0
- package/lib/components/date_picker/super_date_picker/pretty_duration.js +2 -9
- package/lib/components/date_picker/super_date_picker/relative_utils.js +9 -0
- package/lib/components/date_picker/super_date_picker/super_date_picker.js +118 -26
- package/lib/components/date_picker/super_date_picker/time_window_buttons.js +193 -0
- package/lib/components/facet/facet_button.js +9 -19
- package/lib/components/filter_group/filter_button.js +14 -1
- package/lib/components/flyout/flyout.js +26 -9
- package/lib/components/form/form_control_button/form_control_button.js +13 -7
- package/lib/components/header/header_links/header_link.js +13 -7
- package/lib/components/header/header_section/header_section_item_button.js +13 -7
- package/lib/components/icon/assets/boxes_vertical.js +1 -1
- package/lib/components/icon/assets/checkInCircleFilled.js +1 -2
- package/lib/components/icon/assets/errorFilled.js +1 -2
- package/lib/components/icon/assets/warningFilled.js +1 -2
- package/lib/components/icon/icon_map.js +3 -6
- package/lib/components/icon/svgs/boxes_vertical.svg +1 -1
- package/lib/components/icon/svgs/checkInCircleFilled.svg +1 -1
- package/lib/components/icon/svgs/errorFilled.svg +1 -1
- package/lib/components/icon/svgs/warningFilled.svg +1 -1
- package/lib/components/list_group/list_group.js +13 -1
- package/lib/components/list_group/list_group_item.js +13 -1
- package/lib/components/list_group/list_group_item_extra_action.js +13 -1
- package/lib/components/list_group/pinnable_list_group/pinnable_list_group.js +15 -2
- package/lib/components/overlay_mask/overlay_mask.styles.js +1 -1
- package/lib/components/pagination/pagination_button.js +13 -7
- package/lib/components/popover/popover.js +21 -15
- package/lib/components/provider/component_defaults/component_defaults.js +22 -2
- package/lib/components/table/table_row.styles.js +1 -1
- package/lib/components/tool_tip/tool_tip.js +24 -24
- package/lib/global_styling/index.js +16 -1
- package/lib/global_styling/mixins/_button.js +1 -1
- package/lib/global_styling/utility/selectors.js +15 -0
- package/lib/services/focus_trap/focus_trap_pub_sub.js +80 -0
- package/lib/services/focus_trap/index.js +12 -0
- package/lib/services/hooks/index.js +18 -1
- package/lib/services/hooks/useEuiDisabledElement.js +199 -0
- package/lib/services/index.js +8 -0
- package/lib/services/popover/reposition_on_scroll.js +67 -0
- package/lib/test/cypress/index.d.ts +12 -0
- package/lib/test/cypress/index.js +18 -0
- package/lib/test/cypress/matchers.d.ts +20 -0
- package/lib/test/cypress/matchers.js +61 -0
- package/lib/test/cypress/test_reposition_on_scroll.js +69 -0
- package/lib/test/enzyme/enzyme_matchers.d.ts +36 -0
- package/lib/test/enzyme/enzyme_matchers.js +49 -0
- package/lib/test/enzyme/index.d.ts +14 -0
- package/lib/test/enzyme/index.js +24 -0
- package/lib/test/rtl/index.d.ts +9 -1
- package/lib/test/rtl/index.js +24 -2
- package/lib/test/rtl/matchers.d.ts +36 -0
- package/lib/test/rtl/matchers.js +86 -0
- package/lib/utils/element_can_be_disabled.js +22 -0
- package/lib/utils/index.js +14 -1
- package/optimize/es/components/bottom_bar/bottom_bar.js +12 -2
- package/optimize/es/components/button/button_display/_button_display.js +24 -12
- package/optimize/es/components/button/button_display/_button_display.styles.js +4 -4
- package/optimize/es/components/button/button_empty/button_empty.js +18 -6
- package/optimize/es/components/button/button_group/button_group.js +10 -5
- package/optimize/es/components/button/button_group/button_group_button.js +1 -1
- package/optimize/es/components/button/button_group/button_group_button.styles.js +12 -8
- package/optimize/es/components/button/button_icon/button_icon.js +17 -5
- package/optimize/es/components/code/code_block_virtualized.js +9 -7
- package/optimize/es/components/datagrid/controls/column_selector.js +36 -19
- package/optimize/es/components/datagrid/data_grid.js +5 -1
- package/optimize/es/components/datagrid/utils/in_memory.js +2 -1
- package/optimize/es/components/date_picker/super_date_picker/date_popover/absolute_tab.js +12 -4
- package/optimize/es/components/date_picker/super_date_picker/date_popover/date_popover_button.js +5 -2
- package/optimize/es/components/date_picker/super_date_picker/date_popover/date_popover_content.js +7 -3
- package/optimize/es/components/date_picker/super_date_picker/date_popover/relative_tab.js +10 -2
- package/optimize/es/components/date_picker/super_date_picker/date_popover/timezone_display.js +97 -0
- package/optimize/es/components/date_picker/super_date_picker/date_popover/timezone_display.styles.js +19 -0
- package/optimize/es/components/date_picker/super_date_picker/pretty_duration.js +1 -8
- package/optimize/es/components/date_picker/super_date_picker/relative_utils.js +8 -0
- package/optimize/es/components/date_picker/super_date_picker/super_date_picker.js +49 -25
- package/optimize/es/components/date_picker/super_date_picker/time_window_buttons.js +185 -0
- package/optimize/es/components/flyout/flyout.js +27 -10
- package/optimize/es/components/icon/assets/boxes_vertical.js +1 -1
- package/optimize/es/components/icon/assets/checkInCircleFilled.js +1 -2
- package/optimize/es/components/icon/assets/errorFilled.js +1 -2
- package/optimize/es/components/icon/assets/warningFilled.js +1 -2
- package/optimize/es/components/icon/icon_map.js +3 -6
- package/optimize/es/components/overlay_mask/overlay_mask.styles.js +1 -1
- package/optimize/es/components/popover/popover.js +22 -16
- package/optimize/es/components/table/table_row.styles.js +1 -1
- package/optimize/es/components/tool_tip/tool_tip.js +24 -24
- package/optimize/es/global_styling/index.js +2 -1
- package/optimize/es/global_styling/mixins/_button.js +1 -1
- package/optimize/es/global_styling/utility/selectors.js +9 -0
- package/optimize/es/services/focus_trap/focus_trap_pub_sub.js +74 -0
- package/optimize/es/services/focus_trap/index.js +9 -0
- package/optimize/es/services/hooks/index.js +2 -1
- package/optimize/es/services/hooks/useEuiDisabledElement.js +192 -0
- package/optimize/es/services/index.js +1 -0
- package/optimize/es/services/popover/reposition_on_scroll.js +61 -0
- package/optimize/es/test/cypress/index.d.ts +12 -0
- package/optimize/es/test/cypress/index.js +9 -0
- package/optimize/es/test/cypress/matchers.d.ts +20 -0
- package/optimize/es/test/cypress/matchers.js +54 -0
- package/optimize/es/test/cypress/test_reposition_on_scroll.js +63 -0
- package/optimize/es/test/enzyme/enzyme_matchers.d.ts +36 -0
- package/optimize/es/test/enzyme/enzyme_matchers.js +43 -0
- package/optimize/es/test/enzyme/index.d.ts +14 -0
- package/optimize/es/test/enzyme/index.js +10 -0
- package/optimize/es/test/rtl/index.d.ts +9 -1
- package/optimize/es/test/rtl/index.js +2 -1
- package/optimize/es/test/rtl/matchers.d.ts +36 -0
- package/optimize/es/test/rtl/matchers.js +82 -0
- package/optimize/es/utils/element_can_be_disabled.js +16 -0
- package/optimize/es/utils/index.js +2 -1
- package/optimize/lib/components/bottom_bar/bottom_bar.js +11 -1
- package/optimize/lib/components/button/button_display/_button_display.js +23 -11
- package/optimize/lib/components/button/button_display/_button_display.styles.js +4 -4
- package/optimize/lib/components/button/button_empty/button_empty.js +17 -5
- package/optimize/lib/components/button/button_group/button_group.js +10 -5
- package/optimize/lib/components/button/button_group/button_group_button.js +1 -1
- package/optimize/lib/components/button/button_group/button_group_button.styles.js +10 -6
- package/optimize/lib/components/button/button_icon/button_icon.js +16 -4
- package/optimize/lib/components/code/code_block_virtualized.js +9 -7
- package/optimize/lib/components/datagrid/controls/column_selector.js +36 -19
- package/optimize/lib/components/datagrid/data_grid.js +5 -1
- package/optimize/lib/components/datagrid/utils/in_memory.js +2 -1
- package/optimize/lib/components/date_picker/super_date_picker/date_popover/absolute_tab.js +11 -3
- package/optimize/lib/components/date_picker/super_date_picker/date_popover/date_popover_button.js +5 -2
- package/optimize/lib/components/date_picker/super_date_picker/date_popover/date_popover_content.js +7 -3
- package/optimize/lib/components/date_picker/super_date_picker/date_popover/relative_tab.js +10 -2
- package/optimize/lib/components/date_picker/super_date_picker/date_popover/timezone_display.js +103 -0
- package/optimize/lib/components/date_picker/super_date_picker/date_popover/timezone_display.styles.js +25 -0
- package/optimize/lib/components/date_picker/super_date_picker/pretty_duration.js +2 -9
- package/optimize/lib/components/date_picker/super_date_picker/relative_utils.js +9 -0
- package/optimize/lib/components/date_picker/super_date_picker/super_date_picker.js +49 -25
- package/optimize/lib/components/date_picker/super_date_picker/time_window_buttons.js +193 -0
- package/optimize/lib/components/flyout/flyout.js +26 -9
- package/optimize/lib/components/icon/assets/boxes_vertical.js +1 -1
- package/optimize/lib/components/icon/assets/checkInCircleFilled.js +1 -2
- package/optimize/lib/components/icon/assets/errorFilled.js +1 -2
- package/optimize/lib/components/icon/assets/warningFilled.js +1 -2
- package/optimize/lib/components/icon/icon_map.js +3 -6
- package/optimize/lib/components/icon/svgs/boxes_vertical.svg +1 -1
- package/optimize/lib/components/icon/svgs/checkInCircleFilled.svg +1 -1
- package/optimize/lib/components/icon/svgs/errorFilled.svg +1 -1
- package/optimize/lib/components/icon/svgs/warningFilled.svg +1 -1
- package/optimize/lib/components/overlay_mask/overlay_mask.styles.js +1 -1
- package/optimize/lib/components/popover/popover.js +21 -15
- package/optimize/lib/components/table/table_row.styles.js +1 -1
- package/optimize/lib/components/tool_tip/tool_tip.js +24 -24
- package/optimize/lib/global_styling/index.js +16 -1
- package/optimize/lib/global_styling/mixins/_button.js +1 -1
- package/optimize/lib/global_styling/utility/selectors.js +15 -0
- package/optimize/lib/services/focus_trap/focus_trap_pub_sub.js +80 -0
- package/optimize/lib/services/focus_trap/index.js +12 -0
- package/optimize/lib/services/hooks/index.js +18 -1
- package/optimize/lib/services/hooks/useEuiDisabledElement.js +197 -0
- package/optimize/lib/services/index.js +8 -0
- package/optimize/lib/services/popover/reposition_on_scroll.js +67 -0
- package/optimize/lib/test/cypress/index.d.ts +12 -0
- package/optimize/lib/test/cypress/index.js +18 -0
- package/optimize/lib/test/cypress/matchers.d.ts +20 -0
- package/optimize/lib/test/cypress/matchers.js +61 -0
- package/optimize/lib/test/cypress/test_reposition_on_scroll.js +70 -0
- package/optimize/lib/test/enzyme/enzyme_matchers.d.ts +36 -0
- package/optimize/lib/test/enzyme/enzyme_matchers.js +50 -0
- package/optimize/lib/test/enzyme/index.d.ts +14 -0
- package/optimize/lib/test/enzyme/index.js +24 -0
- package/optimize/lib/test/rtl/index.d.ts +9 -1
- package/optimize/lib/test/rtl/index.js +24 -2
- package/optimize/lib/test/rtl/matchers.d.ts +36 -0
- package/optimize/lib/test/rtl/matchers.js +86 -0
- package/optimize/lib/utils/element_can_be_disabled.js +22 -0
- package/optimize/lib/utils/index.js +14 -1
- package/package.json +3 -2
- package/test-env/components/accessibility/skip_link/skip_link.js +10 -1
- package/test-env/components/bottom_bar/bottom_bar.js +11 -1
- package/test-env/components/button/button.js +21 -26
- package/test-env/components/button/button_display/_button_display.js +31 -29
- package/test-env/components/button/button_display/_button_display.styles.js +4 -4
- package/test-env/components/button/button_empty/button_empty.js +31 -13
- package/test-env/components/button/button_group/button_group.js +49 -31
- package/test-env/components/button/button_group/button_group_button.js +14 -2
- package/test-env/components/button/button_group/button_group_button.styles.js +10 -6
- package/test-env/components/button/button_icon/button_icon.js +29 -5
- package/test-env/components/card/card.js +21 -26
- package/test-env/components/card/card_select/card_select.js +21 -26
- package/test-env/components/code/code_block_virtualized.js +9 -7
- package/test-env/components/collapsible_nav_beta/_kibana_solution/collapsible_nav_kibana_solution.js +13 -1
- package/test-env/components/datagrid/body/cell/data_grid_cell.js +35 -12
- package/test-env/components/datagrid/body/data_grid_body.js +23 -6
- package/test-env/components/datagrid/body/data_grid_body_custom.js +23 -6
- package/test-env/components/datagrid/body/data_grid_body_virtualized.js +23 -6
- package/test-env/components/datagrid/body/header/data_grid_header_cell.js +23 -6
- package/test-env/components/datagrid/controls/column_selector.js +36 -19
- package/test-env/components/datagrid/controls/column_sorting.js +23 -6
- package/test-env/components/datagrid/controls/data_grid_toolbar_control.js +13 -7
- package/test-env/components/datagrid/data_grid.js +5 -1
- package/test-env/components/datagrid/utils/in_memory.js +25 -7
- package/test-env/components/date_picker/auto_refresh/auto_refresh.js +12 -3
- package/test-env/components/date_picker/super_date_picker/date_popover/absolute_tab.js +30 -4
- package/test-env/components/date_picker/super_date_picker/date_popover/date_popover_button.js +24 -3
- package/test-env/components/date_picker/super_date_picker/date_popover/date_popover_content.js +26 -4
- package/test-env/components/date_picker/super_date_picker/date_popover/relative_tab.js +29 -3
- package/test-env/components/date_picker/super_date_picker/date_popover/timezone_display.js +103 -0
- package/test-env/components/date_picker/super_date_picker/date_popover/timezone_display.styles.js +25 -0
- package/test-env/components/date_picker/super_date_picker/pretty_duration.js +2 -9
- package/test-env/components/date_picker/super_date_picker/relative_utils.js +9 -0
- package/test-env/components/date_picker/super_date_picker/super_date_picker.js +118 -26
- package/test-env/components/date_picker/super_date_picker/time_window_buttons.js +193 -0
- package/test-env/components/facet/facet_button.js +9 -19
- package/test-env/components/filter_group/filter_button.js +14 -1
- package/test-env/components/form/form_control_button/form_control_button.js +13 -7
- package/test-env/components/header/header_links/header_link.js +13 -7
- package/test-env/components/header/header_section/header_section_item_button.js +13 -7
- package/test-env/components/icon/assets/boxes_vertical.js +1 -1
- package/test-env/components/icon/assets/checkInCircleFilled.js +1 -2
- package/test-env/components/icon/assets/errorFilled.js +1 -2
- package/test-env/components/icon/assets/warningFilled.js +1 -2
- package/test-env/components/icon/icon_map.js +3 -6
- package/test-env/components/list_group/list_group.js +13 -1
- package/test-env/components/list_group/list_group_item.js +13 -1
- package/test-env/components/list_group/list_group_item_extra_action.js +13 -1
- package/test-env/components/list_group/pinnable_list_group/pinnable_list_group.js +15 -2
- package/test-env/components/overlay_mask/overlay_mask.styles.js +1 -1
- package/test-env/components/pagination/pagination_button.js +13 -7
- package/test-env/components/popover/popover.js +21 -15
- package/test-env/components/provider/component_defaults/component_defaults.js +22 -2
- package/test-env/components/table/table_row.styles.js +1 -1
- package/test-env/components/tool_tip/tool_tip.js +24 -24
- package/test-env/global_styling/index.js +16 -1
- package/test-env/global_styling/mixins/_button.js +1 -1
- package/test-env/global_styling/utility/selectors.js +15 -0
- package/test-env/services/focus_trap/focus_trap_pub_sub.js +80 -0
- package/test-env/services/focus_trap/index.js +12 -0
- package/test-env/services/hooks/index.js +18 -1
- package/test-env/services/hooks/useEuiDisabledElement.js +197 -0
- package/test-env/services/index.js +8 -0
- package/test-env/services/popover/reposition_on_scroll.js +67 -0
- package/test-env/test/cypress/index.js +18 -0
- package/test-env/test/cypress/matchers.js +61 -0
- package/test-env/test/cypress/test_reposition_on_scroll.js +70 -0
- package/test-env/test/enzyme/enzyme_matchers.js +50 -0
- package/test-env/test/enzyme/index.js +24 -0
- package/test-env/test/rtl/index.js +24 -2
- package/test-env/test/rtl/matchers.js +86 -0
- package/test-env/utils/element_can_be_disabled.js +22 -0
- package/test-env/utils/index.js +14 -1
|
@@ -0,0 +1,36 @@
|
|
|
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", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
|
5
|
+
* Public License v 1"; you may not use this file except in compliance with, at
|
|
6
|
+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
|
7
|
+
* License v3.0 only", or the "Server Side Public License, v 1".
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { ReactWrapper } from 'enzyme';
|
|
11
|
+
|
|
12
|
+
declare global {
|
|
13
|
+
namespace jest {
|
|
14
|
+
interface Matchers<R> {
|
|
15
|
+
/**
|
|
16
|
+
* Checks if an Enzyme wrapper has EUI disabled state (it checks `disabled`, `isDisabled` and `aria-disabled` props)
|
|
17
|
+
*/
|
|
18
|
+
toHaveEuiDisabledProp(): R;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export declare const toHaveEuiDisabledProp: (wrapper: ReactWrapper<any>) => {
|
|
24
|
+
message: () => string;
|
|
25
|
+
pass: boolean;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export declare const hasEuiDisabledProp: (
|
|
29
|
+
props: Record<string, any>
|
|
30
|
+
) => boolean;
|
|
31
|
+
|
|
32
|
+
export declare const euiEnzymeMatchers: {
|
|
33
|
+
toHaveEuiDisabledProp: typeof toHaveEuiDisabledProp;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export declare const setupEuiEnzymeMatchers: () => void;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.setupEuiEnzymeMatchers = exports.hasEuiDisabledProp = exports.euiEnzymeMatchers = void 0;
|
|
7
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
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", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
|
12
|
+
* Public License v 1"; you may not use this file except in compliance with, at
|
|
13
|
+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
|
14
|
+
* License v3.0 only", or the "Server Side Public License, v 1".
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/* eslint-env jest */
|
|
18
|
+
|
|
19
|
+
var euiEnzymeMatchers = exports.euiEnzymeMatchers = {
|
|
20
|
+
/**
|
|
21
|
+
* Checks if an Enzyme wrapper has an EUI disabled state.
|
|
22
|
+
* It looks for `disabled`, `isDisabled` and `aria-disabled` props
|
|
23
|
+
*/
|
|
24
|
+
toHaveEuiDisabledProp: function toHaveEuiDisabledProp(props) {
|
|
25
|
+
if (!props || _typeof(props) !== 'object') {
|
|
26
|
+
throw new Error('toHaveEuiDisabledProp() must be called with the props value from ReactWrapper.props()');
|
|
27
|
+
}
|
|
28
|
+
var isDisabled = hasEuiDisabledProp(props);
|
|
29
|
+
return {
|
|
30
|
+
message: function message() {
|
|
31
|
+
return isDisabled ? 'Expected component NOT to have EUI disabled prop, but it was disabled' : 'Expected component to have EUI disabled prop (`disabled`, `isDisabled` or `aria-disabled="true"`)';
|
|
32
|
+
},
|
|
33
|
+
pass: isDisabled
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var setupEuiEnzymeMatchers = exports.setupEuiEnzymeMatchers = function setupEuiEnzymeMatchers() {
|
|
38
|
+
expect.extend(euiEnzymeMatchers);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/* Utilities */
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Checks if a ReactWrapper has one of the following disabled props enabled:
|
|
45
|
+
* `disabled`, `isDisabled` or attribute or `aria-disabled="true"`.
|
|
46
|
+
*/
|
|
47
|
+
var hasEuiDisabledProp = exports.hasEuiDisabledProp = function hasEuiDisabledProp(props) {
|
|
48
|
+
return props.disabled === true || props.isDisabled === true || props['aria-disabled'] === true || props['aria-disabled'] === 'true';
|
|
49
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
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", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
|
5
|
+
* Public License v 1"; you may not use this file except in compliance with, at
|
|
6
|
+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
|
7
|
+
* License v3.0 only", or the "Server Side Public License, v 1".
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
euiEnzymeMatchers,
|
|
12
|
+
setupEuiEnzymeMatchers,
|
|
13
|
+
hasEuiDisabledProp,
|
|
14
|
+
} from './enzyme_matchers';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "euiEnzymeMatchers", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _enzyme_matchers.euiEnzymeMatchers;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "hasEuiDisabledProp", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _enzyme_matchers.hasEuiDisabledProp;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "setupEuiEnzymeMatchers", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _enzyme_matchers.setupEuiEnzymeMatchers;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
var _enzyme_matchers = require("./enzyme_matchers");
|
package/lib/test/rtl/index.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
export * from './component_helpers';
|
|
2
|
-
export {
|
|
2
|
+
export {
|
|
3
|
+
queryByTestSubject,
|
|
4
|
+
queryAllByTestSubject,
|
|
5
|
+
getByTestSubject,
|
|
6
|
+
getAllByTestSubject,
|
|
7
|
+
findAllByTestSubject,
|
|
8
|
+
findByTestSubject,
|
|
9
|
+
} from './data_test_subj_queries';
|
|
3
10
|
export { render, screen, within } from './custom_render';
|
|
11
|
+
export { euiMatchers, setupEuiMatchers, isEuiDisabled } from './matchers';
|
package/lib/test/rtl/index.js
CHANGED
|
@@ -12,8 +12,17 @@ var _exportNames = {
|
|
|
12
12
|
findByTestSubject: true,
|
|
13
13
|
render: true,
|
|
14
14
|
screen: true,
|
|
15
|
-
within: true
|
|
15
|
+
within: true,
|
|
16
|
+
euiMatchers: true,
|
|
17
|
+
setupEuiMatchers: true,
|
|
18
|
+
isEuiDisabled: true
|
|
16
19
|
};
|
|
20
|
+
Object.defineProperty(exports, "euiMatchers", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function get() {
|
|
23
|
+
return _matchers.euiMatchers;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
17
26
|
Object.defineProperty(exports, "findAllByTestSubject", {
|
|
18
27
|
enumerable: true,
|
|
19
28
|
get: function get() {
|
|
@@ -38,6 +47,12 @@ Object.defineProperty(exports, "getByTestSubject", {
|
|
|
38
47
|
return _data_test_subj_queries.getByTestSubject;
|
|
39
48
|
}
|
|
40
49
|
});
|
|
50
|
+
Object.defineProperty(exports, "isEuiDisabled", {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
get: function get() {
|
|
53
|
+
return _matchers.isEuiDisabled;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
41
56
|
Object.defineProperty(exports, "queryAllByTestSubject", {
|
|
42
57
|
enumerable: true,
|
|
43
58
|
get: function get() {
|
|
@@ -62,6 +77,12 @@ Object.defineProperty(exports, "screen", {
|
|
|
62
77
|
return _custom_render.screen;
|
|
63
78
|
}
|
|
64
79
|
});
|
|
80
|
+
Object.defineProperty(exports, "setupEuiMatchers", {
|
|
81
|
+
enumerable: true,
|
|
82
|
+
get: function get() {
|
|
83
|
+
return _matchers.setupEuiMatchers;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
65
86
|
Object.defineProperty(exports, "within", {
|
|
66
87
|
enumerable: true,
|
|
67
88
|
get: function get() {
|
|
@@ -93,4 +114,5 @@ Object.keys(_render_hook).forEach(function (key) {
|
|
|
93
114
|
return _render_hook[key];
|
|
94
115
|
}
|
|
95
116
|
});
|
|
96
|
-
});
|
|
117
|
+
});
|
|
118
|
+
var _matchers = require("./matchers");
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
/* eslint-disable-next-line @typescript-eslint/no-namespace,no-redeclare */
|
|
3
|
+
namespace jest {
|
|
4
|
+
interface Matchers<R> {
|
|
5
|
+
/**
|
|
6
|
+
* Custom matcher to check the disabled state of a DOM element.
|
|
7
|
+
* Ensures that both `disabled` and `aria-disabled` attributes are checked.
|
|
8
|
+
*/
|
|
9
|
+
toBeEuiDisabled(): R;
|
|
10
|
+
/**
|
|
11
|
+
* Custom matcher to check a DOM element is enabled (= not disabled).
|
|
12
|
+
* Ensures that both `disabled` and `aria-disabled` attributes are checked.
|
|
13
|
+
*/
|
|
14
|
+
toBeEuiEnabled(): R;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export declare const toBeEuiDisabled: (element: HTMLElement) => {
|
|
20
|
+
message: () => string;
|
|
21
|
+
pass: boolean;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export declare const toBeEuiEnabled: (element: HTMLElement) => {
|
|
25
|
+
message: () => string;
|
|
26
|
+
pass: boolean;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export declare const isEuiDisabled: (element: HTMLElement) => boolean;
|
|
30
|
+
|
|
31
|
+
export declare const euiMatchers: {
|
|
32
|
+
toBeEuiDisabled: typeof toBeEuiDisabled;
|
|
33
|
+
toBeEuiEnabled: typeof toBeEuiEnabled;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export declare const setupEuiMatchers: () => void;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.setupEuiMatchers = exports.isEuiDisabled = exports.getEuiDisabledState = exports.euiMatchers = exports.default = void 0;
|
|
7
|
+
var _utils = require("../../utils");
|
|
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
|
+
var NATIVE_DISABLED_ATTR = 'disabled';
|
|
17
|
+
var CUSTOM_DISABLED_ATTR = 'aria-disabled';
|
|
18
|
+
var toBeEuiDisabled = function toBeEuiDisabled(element) {
|
|
19
|
+
var _getEuiDisabledState = getEuiDisabledState(element),
|
|
20
|
+
isDisabled = _getEuiDisabledState.isDisabled,
|
|
21
|
+
canBeDisabled = _getEuiDisabledState.canBeDisabled,
|
|
22
|
+
isNativelyDisabled = _getEuiDisabledState.isNativelyDisabled;
|
|
23
|
+
return {
|
|
24
|
+
message: function message() {
|
|
25
|
+
if (isDisabled) {
|
|
26
|
+
var method = isNativelyDisabled ? "`".concat(NATIVE_DISABLED_ATTR, "`") : "`".concat(CUSTOM_DISABLED_ATTR, "=\"true\"`");
|
|
27
|
+
if (!canBeDisabled) {
|
|
28
|
+
return "Element cannot be disabled (based on its role), but it was disabled via ".concat(method);
|
|
29
|
+
} else {
|
|
30
|
+
return "Expected element NOT to be disabled, but it was disabled via ".concat(method);
|
|
31
|
+
}
|
|
32
|
+
} else {
|
|
33
|
+
return "Expected element to be disabled via either `".concat(NATIVE_DISABLED_ATTR, "` or `").concat(CUSTOM_DISABLED_ATTR, "=\"true\"` attribute, but found neither");
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
pass: isDisabled
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
var toBeEuiEnabled = function toBeEuiEnabled(element) {
|
|
40
|
+
var _getEuiDisabledState2 = getEuiDisabledState(element),
|
|
41
|
+
isDisabled = _getEuiDisabledState2.isDisabled,
|
|
42
|
+
isNativelyDisabled = _getEuiDisabledState2.isNativelyDisabled,
|
|
43
|
+
isAriaDisabled = _getEuiDisabledState2.isAriaDisabled;
|
|
44
|
+
return {
|
|
45
|
+
message: function message() {
|
|
46
|
+
var attributes = [isNativelyDisabled ? "`".concat(NATIVE_DISABLED_ATTR, "`") : undefined, isAriaDisabled ? "`".concat(CUSTOM_DISABLED_ATTR, "=\"true\"`") : undefined].filter(function (item) {
|
|
47
|
+
return item !== undefined;
|
|
48
|
+
}).join(' and ');
|
|
49
|
+
return "Expected element NOT to have attributes: ".concat(attributes, ".");
|
|
50
|
+
},
|
|
51
|
+
pass: !isDisabled
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
var euiMatchers = exports.euiMatchers = {
|
|
55
|
+
toBeEuiDisabled: toBeEuiDisabled,
|
|
56
|
+
toBeEuiEnabled: toBeEuiEnabled
|
|
57
|
+
};
|
|
58
|
+
var setupEuiMatchers = exports.setupEuiMatchers = function setupEuiMatchers() {
|
|
59
|
+
expect.extend(euiMatchers);
|
|
60
|
+
};
|
|
61
|
+
var _default = exports.default = euiMatchers;
|
|
62
|
+
/* Utilities */
|
|
63
|
+
/**
|
|
64
|
+
* Retrieve an element's disabled state details.
|
|
65
|
+
* Checks wheather the element has an `disabled` attribute or `aria-disabled="true"` attribute
|
|
66
|
+
* @returns { isDisabled: boolean; canBeDisabled: boolean; isNativelyDisabled: boolean; isAriaDisabled: boolean }
|
|
67
|
+
*/
|
|
68
|
+
var getEuiDisabledState = exports.getEuiDisabledState = function getEuiDisabledState(element) {
|
|
69
|
+
var canBeDisabled = (0, _utils.elementCanBeDisabled)(element);
|
|
70
|
+
var isNativelyDisabled = element.hasAttribute('disabled');
|
|
71
|
+
var isAriaDisabled = element.getAttribute('aria-disabled') === 'true';
|
|
72
|
+
var isDisabled = canBeDisabled && (isNativelyDisabled || isAriaDisabled);
|
|
73
|
+
return {
|
|
74
|
+
isDisabled: isDisabled,
|
|
75
|
+
canBeDisabled: canBeDisabled,
|
|
76
|
+
isNativelyDisabled: isNativelyDisabled,
|
|
77
|
+
isAriaDisabled: isAriaDisabled
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Checks if an element is disabled via `disabled` attribute or `aria-disabled="true"`.
|
|
83
|
+
*/
|
|
84
|
+
var isEuiDisabled = exports.isEuiDisabled = function isEuiDisabled(element) {
|
|
85
|
+
return getEuiDisabledState(element).isDisabled;
|
|
86
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.elementCanBeDisabled = void 0;
|
|
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
|
+
var SUPPORTED_ELEMENTS = ['fieldset', 'input', 'select', 'optgroup', 'option', 'button', 'textarea'];
|
|
16
|
+
var elementCanBeDisabled = exports.elementCanBeDisabled = function elementCanBeDisabled(htmlElement) {
|
|
17
|
+
var _htmlElement$getAttri;
|
|
18
|
+
if (!htmlElement) return false;
|
|
19
|
+
var tagName = htmlElement.tagName && htmlElement.tagName.toLowerCase();
|
|
20
|
+
var roleName = (_htmlElement$getAttri = htmlElement.getAttribute('role')) !== null && _htmlElement$getAttri !== void 0 ? _htmlElement$getAttri : '';
|
|
21
|
+
return SUPPORTED_ELEMENTS.includes(roleName) || SUPPORTED_ELEMENTS.includes(tagName);
|
|
22
|
+
};
|
package/lib/utils/index.js
CHANGED
|
@@ -3,9 +3,19 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
elementCanBeDisabled: true
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "elementCanBeDisabled", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function get() {
|
|
12
|
+
return _element_can_be_disabled.elementCanBeDisabled;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
6
15
|
var _prop_types = require("./prop_types");
|
|
7
16
|
Object.keys(_prop_types).forEach(function (key) {
|
|
8
17
|
if (key === "default" || key === "__esModule") return;
|
|
18
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
9
19
|
if (key in exports && exports[key] === _prop_types[key]) return;
|
|
10
20
|
Object.defineProperty(exports, key, {
|
|
11
21
|
enumerable: true,
|
|
@@ -17,6 +27,7 @@ Object.keys(_prop_types).forEach(function (key) {
|
|
|
17
27
|
var _is_jest = require("./is_jest");
|
|
18
28
|
Object.keys(_is_jest).forEach(function (key) {
|
|
19
29
|
if (key === "default" || key === "__esModule") return;
|
|
30
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
20
31
|
if (key in exports && exports[key] === _is_jest[key]) return;
|
|
21
32
|
Object.defineProperty(exports, key, {
|
|
22
33
|
enumerable: true,
|
|
@@ -28,6 +39,7 @@ Object.keys(_is_jest).forEach(function (key) {
|
|
|
28
39
|
var _type_guards = require("./type_guards");
|
|
29
40
|
Object.keys(_type_guards).forEach(function (key) {
|
|
30
41
|
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
31
43
|
if (key in exports && exports[key] === _type_guards[key]) return;
|
|
32
44
|
Object.defineProperty(exports, key, {
|
|
33
45
|
enumerable: true,
|
|
@@ -35,4 +47,5 @@ Object.keys(_type_guards).forEach(function (key) {
|
|
|
35
47
|
return _type_guards[key];
|
|
36
48
|
}
|
|
37
49
|
});
|
|
38
|
-
});
|
|
50
|
+
});
|
|
51
|
+
var _element_can_be_disabled = require("./element_can_be_disabled");
|
|
@@ -15,7 +15,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
15
15
|
|
|
16
16
|
import classNames from 'classnames';
|
|
17
17
|
import React, { forwardRef, useEffect, useState } from 'react';
|
|
18
|
-
import { useCombinedRefs, useEuiMemoizedStyles, EuiThemeProvider } from '../../services';
|
|
18
|
+
import { useCombinedRefs, useEuiMemoizedStyles, useEuiThemeCSSVariables, EuiThemeProvider } from '../../services';
|
|
19
19
|
import { EuiScreenReaderOnly } from '../accessibility';
|
|
20
20
|
import { EuiI18n } from '../i18n';
|
|
21
21
|
import { useResizeObserver } from '../observer/resize_observer';
|
|
@@ -47,6 +47,8 @@ var _EuiBottomBar = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
47
47
|
style = _ref.style,
|
|
48
48
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
49
49
|
var styles = useEuiMemoizedStyles(euiBottomBarStyles);
|
|
50
|
+
var _useEuiThemeCSSVariab = useEuiThemeCSSVariables(),
|
|
51
|
+
setGlobalCSSVariables = _useEuiThemeCSSVariab.setGlobalCSSVariables;
|
|
50
52
|
|
|
51
53
|
// Force some props if `fixed` position, but not if the user has supplied these
|
|
52
54
|
affordForDisplacement = position !== 'fixed' ? false : affordForDisplacement;
|
|
@@ -61,6 +63,11 @@ var _EuiBottomBar = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
61
63
|
useEffect(function () {
|
|
62
64
|
if (affordForDisplacement && usePortal) {
|
|
63
65
|
document.body.style.paddingBottom = "".concat(dimensions.height, "px");
|
|
66
|
+
|
|
67
|
+
// EUI doesn't use this css variable, but it is useful for consumers
|
|
68
|
+
setGlobalCSSVariables({
|
|
69
|
+
'--euiBottomBarOffset': "".concat(dimensions.height, "px")
|
|
70
|
+
});
|
|
64
71
|
}
|
|
65
72
|
if (bodyClassName) {
|
|
66
73
|
document.body.classList.add(bodyClassName);
|
|
@@ -68,12 +75,15 @@ var _EuiBottomBar = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
68
75
|
return function () {
|
|
69
76
|
if (affordForDisplacement && usePortal) {
|
|
70
77
|
document.body.style.paddingBottom = '';
|
|
78
|
+
setGlobalCSSVariables({
|
|
79
|
+
'--euiBottomBarOffset': null
|
|
80
|
+
});
|
|
71
81
|
}
|
|
72
82
|
if (bodyClassName) {
|
|
73
83
|
document.body.classList.remove(bodyClassName);
|
|
74
84
|
}
|
|
75
85
|
};
|
|
76
|
-
}, [affordForDisplacement, usePortal, dimensions, bodyClassName]);
|
|
86
|
+
}, [affordForDisplacement, usePortal, dimensions, bodyClassName, setGlobalCSSVariables]);
|
|
77
87
|
var classes = classNames('euiBottomBar', "euiBottomBar--".concat(position), className);
|
|
78
88
|
var cssStyles = [styles.euiBottomBar, styles[position], styles[paddingSize]];
|
|
79
89
|
var newStyle = _objectSpread({
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["element", "type", "children", "iconType", "iconSide", "iconSize", "size", "isDisabled", "disabled", "isLoading", "isSelected", "fullWidth", "minWidth", "contentProps", "textProps", "href", "target", "rel", "style"]
|
|
4
|
+
var _excluded = ["element", "type", "children", "iconType", "iconSide", "iconSize", "size", "isDisabled", "disabled", "hasAriaDisabled", "isLoading", "isSelected", "fullWidth", "minWidth", "contentProps", "textProps", "href", "target", "rel", "style"],
|
|
5
|
+
_excluded2 = ["ref"];
|
|
5
6
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
7
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
8
|
/*
|
|
@@ -16,10 +17,11 @@ import React, { forwardRef } from 'react';
|
|
|
16
17
|
|
|
17
18
|
// @ts-ignore module doesn't export `createElement`
|
|
18
19
|
import { createElement } from '@emotion/react';
|
|
19
|
-
import { getSecureRelForTarget, useEuiMemoizedStyles } from '../../../services';
|
|
20
|
+
import { getSecureRelForTarget, useCombinedRefs, useEuiMemoizedStyles } from '../../../services';
|
|
21
|
+
import { validateHref } from '../../../services/security/href_validator';
|
|
22
|
+
import { useEuiDisabledElement } from '../../../services/hooks/useEuiDisabledElement';
|
|
20
23
|
import { euiButtonDisplayStyles } from './_button_display.styles';
|
|
21
24
|
import { EuiButtonDisplayContent } from './_button_display_content';
|
|
22
|
-
import { validateHref } from '../../../services/security/href_validator';
|
|
23
25
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
24
26
|
var SIZES = ['xs', 's', 'm'];
|
|
25
27
|
|
|
@@ -54,6 +56,8 @@ export var EuiButtonDisplay = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
54
56
|
size = _ref2$size === void 0 ? 'm' : _ref2$size,
|
|
55
57
|
isDisabled = _ref2.isDisabled,
|
|
56
58
|
disabled = _ref2.disabled,
|
|
59
|
+
_ref2$hasAriaDisabled = _ref2.hasAriaDisabled,
|
|
60
|
+
hasAriaDisabled = _ref2$hasAriaDisabled === void 0 ? false : _ref2$hasAriaDisabled,
|
|
57
61
|
isLoading = _ref2.isLoading,
|
|
58
62
|
isSelected = _ref2.isSelected,
|
|
59
63
|
fullWidth = _ref2.fullWidth,
|
|
@@ -70,6 +74,14 @@ export var EuiButtonDisplay = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
70
74
|
isDisabled: isDisabled || disabled,
|
|
71
75
|
isLoading: isLoading
|
|
72
76
|
});
|
|
77
|
+
var _useEuiDisabledElemen = useEuiDisabledElement({
|
|
78
|
+
isDisabled: buttonIsDisabled,
|
|
79
|
+
hasAriaDisabled: hasAriaDisabled,
|
|
80
|
+
onKeyDown: rest.onKeyDown
|
|
81
|
+
}),
|
|
82
|
+
disabledRef = _useEuiDisabledElemen.ref,
|
|
83
|
+
disabledButtonProps = _objectWithoutProperties(_useEuiDisabledElemen, _excluded2);
|
|
84
|
+
var setCombinedRef = useCombinedRefs([disabledRef, ref]);
|
|
73
85
|
var styles = useEuiMemoizedStyles(euiButtonDisplayStyles);
|
|
74
86
|
var cssStyles = [styles.euiButtonDisplay, styles[size], fullWidth && styles.fullWidth, minWidth == null && [styles.defaultMinWidth.defaultMinWidth, styles.defaultMinWidth[size]], buttonIsDisabled && styles.isDisabled];
|
|
75
87
|
var innerNode = ___EmotionJSX(EuiButtonDisplayContent, _extends({
|
|
@@ -81,13 +93,14 @@ export var EuiButtonDisplay = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
81
93
|
textProps: textProps
|
|
82
94
|
}, contentProps), children);
|
|
83
95
|
var element = buttonIsDisabled ? 'button' : href ? 'a' : _element;
|
|
84
|
-
var elementProps = {
|
|
85
|
-
|
|
96
|
+
var elementProps = {
|
|
97
|
+
ref: setCombinedRef
|
|
98
|
+
};
|
|
99
|
+
var buttonProps = {};
|
|
86
100
|
if (element === 'button') {
|
|
87
|
-
|
|
88
|
-
disabled: buttonIsDisabled,
|
|
101
|
+
buttonProps = _objectSpread({
|
|
89
102
|
'aria-pressed': isSelected
|
|
90
|
-
});
|
|
103
|
+
}, disabledButtonProps);
|
|
91
104
|
}
|
|
92
105
|
var relObj = {};
|
|
93
106
|
if (href && !buttonIsDisabled) {
|
|
@@ -101,12 +114,11 @@ export var EuiButtonDisplay = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
101
114
|
} else {
|
|
102
115
|
relObj.type = type;
|
|
103
116
|
}
|
|
104
|
-
return createElement(element, _objectSpread(_objectSpread(_objectSpread({
|
|
117
|
+
return createElement(element, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
105
118
|
css: cssStyles,
|
|
106
119
|
style: minWidth ? _objectSpread(_objectSpread({}, style), {}, {
|
|
107
120
|
minInlineSize: minWidth
|
|
108
|
-
}) : style
|
|
109
|
-
|
|
110
|
-
}, elementProps), relObj), rest), innerNode);
|
|
121
|
+
}) : style
|
|
122
|
+
}, elementProps), relObj), rest), buttonProps), innerNode);
|
|
111
123
|
});
|
|
112
124
|
EuiButtonDisplay.displayName = 'EuiButtonDisplay';
|
|
@@ -15,11 +15,11 @@ export var euiButtonBaseCSS = function euiButtonBaseCSS() {
|
|
|
15
15
|
return "\n display: inline-block;\n appearance: none;\n cursor: pointer;\n ".concat(logicalTextAlignCSS('center'), ";\n white-space: nowrap;\n ").concat(logicalCSS('max-width', '100%'), ";\n vertical-align: middle;\n ");
|
|
16
16
|
};
|
|
17
17
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
18
|
-
name: "
|
|
19
|
-
styles: "cursor:not-allowed;label:isDisabled;"
|
|
18
|
+
name: "col2gx-isDisabled",
|
|
19
|
+
styles: "cursor:not-allowed;&[aria-disabled='true']{pointer-events:none;>*{pointer-events:none;}};label:isDisabled;"
|
|
20
20
|
} : {
|
|
21
|
-
name: "
|
|
22
|
-
styles: "cursor:not-allowed;label:isDisabled;",
|
|
21
|
+
name: "col2gx-isDisabled",
|
|
22
|
+
styles: "cursor:not-allowed;&[aria-disabled='true']{pointer-events:none;>*{pointer-events:none;}};label:isDisabled;",
|
|
23
23
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
24
24
|
};
|
|
25
25
|
export var euiButtonDisplayStyles = function euiButtonDisplayStyles(euiThemeContext) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["children", "className", "iconType", "iconSide", "iconSize", "color", "size", "flush", "isDisabled", "disabled", "isLoading", "href", "target", "rel", "type", "buttonRef", "contentProps", "textProps", "isSelected"]
|
|
4
|
+
var _excluded = ["children", "className", "iconType", "iconSide", "iconSize", "color", "size", "flush", "isDisabled", "disabled", "hasAriaDisabled", "isLoading", "href", "target", "rel", "type", "buttonRef", "contentProps", "textProps", "isSelected"],
|
|
5
|
+
_excluded2 = ["ref"];
|
|
5
6
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
7
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
8
|
/*
|
|
@@ -14,9 +15,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
14
15
|
|
|
15
16
|
import React from 'react';
|
|
16
17
|
import classNames from 'classnames';
|
|
17
|
-
import { useEuiMemoizedStyles, getSecureRelForTarget } from '../../../services';
|
|
18
|
-
import {
|
|
18
|
+
import { useEuiMemoizedStyles, getSecureRelForTarget, useCombinedRefs } from '../../../services';
|
|
19
|
+
import { useEuiDisabledElement } from '../../../services/hooks/useEuiDisabledElement';
|
|
19
20
|
import { useEuiButtonColorCSS } from '../../../global_styling/mixins/_button';
|
|
21
|
+
import { EuiButtonDisplayContent } from '../button_display/_button_display_content';
|
|
20
22
|
import { isButtonDisabled } from '../button_display/_button_display';
|
|
21
23
|
import { euiButtonEmptyStyles } from './button_empty.styles';
|
|
22
24
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
@@ -43,6 +45,8 @@ export var EuiButtonEmpty = function EuiButtonEmpty(_ref) {
|
|
|
43
45
|
flush = _ref.flush,
|
|
44
46
|
_isDisabled = _ref.isDisabled,
|
|
45
47
|
disabled = _ref.disabled,
|
|
48
|
+
_ref$hasAriaDisabled = _ref.hasAriaDisabled,
|
|
49
|
+
hasAriaDisabled = _ref$hasAriaDisabled === void 0 ? false : _ref$hasAriaDisabled,
|
|
46
50
|
isLoading = _ref.isLoading,
|
|
47
51
|
href = _ref.href,
|
|
48
52
|
target = _ref.target,
|
|
@@ -59,6 +63,14 @@ export var EuiButtonEmpty = function EuiButtonEmpty(_ref) {
|
|
|
59
63
|
href: href,
|
|
60
64
|
isLoading: isLoading
|
|
61
65
|
});
|
|
66
|
+
var _useEuiDisabledElemen = useEuiDisabledElement({
|
|
67
|
+
isDisabled: isDisabled,
|
|
68
|
+
hasAriaDisabled: hasAriaDisabled,
|
|
69
|
+
onKeyDown: rest.onKeyDown
|
|
70
|
+
}),
|
|
71
|
+
disabledRef = _useEuiDisabledElemen.ref,
|
|
72
|
+
disabledButtonProps = _objectWithoutProperties(_useEuiDisabledElemen, _excluded2);
|
|
73
|
+
var setCombinedRef = useCombinedRefs([disabledRef, buttonRef]);
|
|
62
74
|
var buttonColorStyles = useEuiButtonColorCSS({
|
|
63
75
|
display: 'empty'
|
|
64
76
|
});
|
|
@@ -94,7 +106,7 @@ export var EuiButtonEmpty = function EuiButtonEmpty(_ref) {
|
|
|
94
106
|
href: href,
|
|
95
107
|
target: target,
|
|
96
108
|
rel: secureRel,
|
|
97
|
-
ref:
|
|
109
|
+
ref: setCombinedRef
|
|
98
110
|
}, rest), innerNode);
|
|
99
111
|
}
|
|
100
112
|
return ___EmotionJSX("button", _extends({
|
|
@@ -102,7 +114,7 @@ export var EuiButtonEmpty = function EuiButtonEmpty(_ref) {
|
|
|
102
114
|
className: classes,
|
|
103
115
|
css: cssStyles,
|
|
104
116
|
type: type,
|
|
105
|
-
ref:
|
|
117
|
+
ref: setCombinedRef,
|
|
106
118
|
"aria-pressed": isSelected
|
|
107
|
-
}, rest), innerNode);
|
|
119
|
+
}, rest, disabledButtonProps), innerNode);
|
|
108
120
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["className", "buttonSize", "color", "idSelected", "idToSelectedMap", "isDisabled", "isFullWidth", "isIconOnly", "legend", "name", "onChange", "options", "type"];
|
|
3
|
+
var _excluded = ["className", "buttonSize", "color", "idSelected", "idToSelectedMap", "isDisabled", "hasAriaDisabled", "isFullWidth", "isIconOnly", "legend", "name", "onChange", "options", "type"];
|
|
4
4
|
/*
|
|
5
5
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
6
6
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -28,6 +28,8 @@ export var EuiButtonGroup = function EuiButtonGroup(_ref) {
|
|
|
28
28
|
idToSelectedMap = _ref$idToSelectedMap === void 0 ? {} : _ref$idToSelectedMap,
|
|
29
29
|
_ref$isDisabled = _ref.isDisabled,
|
|
30
30
|
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
31
|
+
_ref$hasAriaDisabled = _ref.hasAriaDisabled,
|
|
32
|
+
hasAriaDisabled = _ref$hasAriaDisabled === void 0 ? false : _ref$hasAriaDisabled,
|
|
31
33
|
_ref$isFullWidth = _ref.isFullWidth,
|
|
32
34
|
isFullWidth = _ref$isFullWidth === void 0 ? false : _ref$isFullWidth,
|
|
33
35
|
_ref$isIconOnly = _ref.isIconOnly,
|
|
@@ -47,18 +49,21 @@ export var EuiButtonGroup = function EuiButtonGroup(_ref) {
|
|
|
47
49
|
'euiButtonGroup-isDisabled': isDisabled
|
|
48
50
|
}, className);
|
|
49
51
|
var typeIsSingle = type === 'single';
|
|
52
|
+
var groupDisabledProps = {
|
|
53
|
+
disabled: hasAriaDisabled ? undefined : isDisabled,
|
|
54
|
+
'aria-disabled': hasAriaDisabled ? isDisabled : undefined
|
|
55
|
+
};
|
|
50
56
|
return ___EmotionJSX("fieldset", _extends({
|
|
51
57
|
css: wrapperCssStyles,
|
|
52
58
|
className: classes
|
|
53
|
-
}, rest, {
|
|
54
|
-
disabled: isDisabled
|
|
55
|
-
}), ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("legend", null, legend)), ___EmotionJSX("div", {
|
|
59
|
+
}, rest, groupDisabledProps), ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("legend", null, legend)), ___EmotionJSX("div", {
|
|
56
60
|
css: cssStyles,
|
|
57
61
|
className: "euiButtonGroup__buttons"
|
|
58
62
|
}, options.map(function (option) {
|
|
59
63
|
return ___EmotionJSX(EuiButtonGroupButton, _extends({
|
|
60
64
|
key: option.id,
|
|
61
|
-
isDisabled: isDisabled
|
|
65
|
+
isDisabled: isDisabled,
|
|
66
|
+
hasAriaDisabled: hasAriaDisabled
|
|
62
67
|
}, option, {
|
|
63
68
|
onClick: typeIsSingle ? function () {
|
|
64
69
|
return onChange(option.id, option.value);
|
|
@@ -47,7 +47,7 @@ export var EuiButtonGroupButton = function EuiButtonGroupButton(_ref) {
|
|
|
47
47
|
var buttonColorStyles = useEuiButtonColorCSS({
|
|
48
48
|
display: display
|
|
49
49
|
})[color];
|
|
50
|
-
var cssStyles = [styles.euiButtonGroupButton, isIconOnly && styles.iconOnly, !isCompressed && (hasToolTip ? styles.uncompressed.hasToolTip : styles.uncompressed[size]), isCompressed ? styles.compressed : styles.uncompressed.uncompressed, isDisabled && isSelected ? styles.disabledAndSelected : buttonColorStyles, !isDisabled && isCompressed && focusColorStyles[color], hasBorder && styles.hasBorder];
|
|
50
|
+
var cssStyles = [styles.euiButtonGroupButton, isIconOnly && styles.iconOnly.iconOnly, isIconOnly && styles.iconOnly[size], !isCompressed && (hasToolTip ? styles.uncompressed.hasToolTip : styles.uncompressed[size]), isCompressed ? styles.compressed : styles.uncompressed.uncompressed, isDisabled && isSelected ? styles.disabledAndSelected : buttonColorStyles, !isDisabled && isCompressed && focusColorStyles[color], hasBorder && styles.hasBorder];
|
|
51
51
|
var tooltipWrapperStyles = [styles.tooltipWrapper, !isCompressed && styles.uncompressed[size]];
|
|
52
52
|
var contentStyles = [styles.content.euiButtonGroupButton__content, isCompressed && styles.content.compressed];
|
|
53
53
|
var textStyles = [isIconOnly ? styles.text.euiButtonGroupButton__iconOnly : styles.text.euiButtonGroupButton__text];
|