@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,43 @@
|
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
4
|
+
* or more contributor license agreements. Licensed under the "Elastic License
|
|
5
|
+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
|
6
|
+
* Public License v 1"; you may not use this file except in compliance with, at
|
|
7
|
+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
|
8
|
+
* License v3.0 only", or the "Server Side Public License, v 1".
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/* eslint-env jest */
|
|
12
|
+
|
|
13
|
+
export var euiEnzymeMatchers = {
|
|
14
|
+
/**
|
|
15
|
+
* Checks if an Enzyme wrapper has an EUI disabled state.
|
|
16
|
+
* It looks for `disabled`, `isDisabled` and `aria-disabled` props
|
|
17
|
+
*/
|
|
18
|
+
toHaveEuiDisabledProp: function toHaveEuiDisabledProp(props) {
|
|
19
|
+
if (!props || _typeof(props) !== 'object') {
|
|
20
|
+
throw new Error('toHaveEuiDisabledProp() must be called with the props value from ReactWrapper.props()');
|
|
21
|
+
}
|
|
22
|
+
var isDisabled = hasEuiDisabledProp(props);
|
|
23
|
+
return {
|
|
24
|
+
message: function message() {
|
|
25
|
+
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"`)';
|
|
26
|
+
},
|
|
27
|
+
pass: isDisabled
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
export var setupEuiEnzymeMatchers = function setupEuiEnzymeMatchers() {
|
|
32
|
+
expect.extend(euiEnzymeMatchers);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/* Utilities */
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Checks if a ReactWrapper has one of the following disabled props enabled:
|
|
39
|
+
* `disabled`, `isDisabled` or attribute or `aria-disabled="true"`.
|
|
40
|
+
*/
|
|
41
|
+
export var hasEuiDisabledProp = function hasEuiDisabledProp(props) {
|
|
42
|
+
return props.disabled === true || props.isDisabled === true || props['aria-disabled'] === true || props['aria-disabled'] === 'true';
|
|
43
|
+
};
|
|
@@ -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,10 @@
|
|
|
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 { euiEnzymeMatchers, setupEuiEnzymeMatchers, hasEuiDisabledProp } from './enzyme_matchers';
|
|
@@ -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';
|
|
@@ -9,4 +9,5 @@
|
|
|
9
9
|
export * from './component_helpers';
|
|
10
10
|
export { queryByTestSubject, queryAllByTestSubject, getByTestSubject, getAllByTestSubject, findAllByTestSubject, findByTestSubject } from './data_test_subj_queries';
|
|
11
11
|
export { render, screen, within } from './custom_render';
|
|
12
|
-
export * from './render_hook';
|
|
12
|
+
export * from './render_hook';
|
|
13
|
+
export { euiMatchers, setupEuiMatchers, isEuiDisabled } from './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,82 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { elementCanBeDisabled } from '../../utils';
|
|
10
|
+
var NATIVE_DISABLED_ATTR = 'disabled';
|
|
11
|
+
var CUSTOM_DISABLED_ATTR = 'aria-disabled';
|
|
12
|
+
var toBeEuiDisabled = function toBeEuiDisabled(element) {
|
|
13
|
+
var _getEuiDisabledState = getEuiDisabledState(element),
|
|
14
|
+
isDisabled = _getEuiDisabledState.isDisabled,
|
|
15
|
+
canBeDisabled = _getEuiDisabledState.canBeDisabled,
|
|
16
|
+
isNativelyDisabled = _getEuiDisabledState.isNativelyDisabled;
|
|
17
|
+
return {
|
|
18
|
+
message: function message() {
|
|
19
|
+
if (isDisabled) {
|
|
20
|
+
var method = isNativelyDisabled ? "`".concat(NATIVE_DISABLED_ATTR, "`") : "`".concat(CUSTOM_DISABLED_ATTR, "=\"true\"`");
|
|
21
|
+
if (!canBeDisabled) {
|
|
22
|
+
return "Element cannot be disabled (based on its role), but it was disabled via ".concat(method);
|
|
23
|
+
} else {
|
|
24
|
+
return "Expected element NOT to be disabled, but it was disabled via ".concat(method);
|
|
25
|
+
}
|
|
26
|
+
} else {
|
|
27
|
+
return "Expected element to be disabled via either `".concat(NATIVE_DISABLED_ATTR, "` or `").concat(CUSTOM_DISABLED_ATTR, "=\"true\"` attribute, but found neither");
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
pass: isDisabled
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
var toBeEuiEnabled = function toBeEuiEnabled(element) {
|
|
34
|
+
var _getEuiDisabledState2 = getEuiDisabledState(element),
|
|
35
|
+
isDisabled = _getEuiDisabledState2.isDisabled,
|
|
36
|
+
isNativelyDisabled = _getEuiDisabledState2.isNativelyDisabled,
|
|
37
|
+
isAriaDisabled = _getEuiDisabledState2.isAriaDisabled;
|
|
38
|
+
return {
|
|
39
|
+
message: function message() {
|
|
40
|
+
var attributes = [isNativelyDisabled ? "`".concat(NATIVE_DISABLED_ATTR, "`") : undefined, isAriaDisabled ? "`".concat(CUSTOM_DISABLED_ATTR, "=\"true\"`") : undefined].filter(function (item) {
|
|
41
|
+
return item !== undefined;
|
|
42
|
+
}).join(' and ');
|
|
43
|
+
return "Expected element NOT to have attributes: ".concat(attributes, ".");
|
|
44
|
+
},
|
|
45
|
+
pass: !isDisabled
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export var euiMatchers = {
|
|
49
|
+
toBeEuiDisabled: toBeEuiDisabled,
|
|
50
|
+
toBeEuiEnabled: toBeEuiEnabled
|
|
51
|
+
};
|
|
52
|
+
export var setupEuiMatchers = function setupEuiMatchers() {
|
|
53
|
+
expect.extend(euiMatchers);
|
|
54
|
+
};
|
|
55
|
+
export default euiMatchers;
|
|
56
|
+
|
|
57
|
+
/* Utilities */
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Retrieve an element's disabled state details.
|
|
61
|
+
* Checks wheather the element has an `disabled` attribute or `aria-disabled="true"` attribute
|
|
62
|
+
* @returns { isDisabled: boolean; canBeDisabled: boolean; isNativelyDisabled: boolean; isAriaDisabled: boolean }
|
|
63
|
+
*/
|
|
64
|
+
export var getEuiDisabledState = function getEuiDisabledState(element) {
|
|
65
|
+
var canBeDisabled = elementCanBeDisabled(element);
|
|
66
|
+
var isNativelyDisabled = element.hasAttribute('disabled');
|
|
67
|
+
var isAriaDisabled = element.getAttribute('aria-disabled') === 'true';
|
|
68
|
+
var isDisabled = canBeDisabled && (isNativelyDisabled || isAriaDisabled);
|
|
69
|
+
return {
|
|
70
|
+
isDisabled: isDisabled,
|
|
71
|
+
canBeDisabled: canBeDisabled,
|
|
72
|
+
isNativelyDisabled: isNativelyDisabled,
|
|
73
|
+
isAriaDisabled: isAriaDisabled
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Checks if an element is disabled via `disabled` attribute or `aria-disabled="true"`.
|
|
79
|
+
*/
|
|
80
|
+
export var isEuiDisabled = function isEuiDisabled(element) {
|
|
81
|
+
return getEuiDisabledState(element).isDisabled;
|
|
82
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
var SUPPORTED_ELEMENTS = ['fieldset', 'input', 'select', 'optgroup', 'option', 'button', 'textarea'];
|
|
10
|
+
export var elementCanBeDisabled = function elementCanBeDisabled(htmlElement) {
|
|
11
|
+
var _htmlElement$getAttri;
|
|
12
|
+
if (!htmlElement) return false;
|
|
13
|
+
var tagName = htmlElement.tagName && htmlElement.tagName.toLowerCase();
|
|
14
|
+
var roleName = (_htmlElement$getAttri = htmlElement.getAttribute('role')) !== null && _htmlElement$getAttri !== void 0 ? _htmlElement$getAttri : '';
|
|
15
|
+
return SUPPORTED_ELEMENTS.includes(roleName) || SUPPORTED_ELEMENTS.includes(tagName);
|
|
16
|
+
};
|
|
@@ -56,6 +56,8 @@ var _EuiBottomBar = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
56
56
|
style = _ref.style,
|
|
57
57
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
58
58
|
var styles = (0, _services.useEuiMemoizedStyles)(_bottom_bar.euiBottomBarStyles);
|
|
59
|
+
var _useEuiThemeCSSVariab = (0, _services.useEuiThemeCSSVariables)(),
|
|
60
|
+
setGlobalCSSVariables = _useEuiThemeCSSVariab.setGlobalCSSVariables;
|
|
59
61
|
|
|
60
62
|
// Force some props if `fixed` position, but not if the user has supplied these
|
|
61
63
|
affordForDisplacement = position !== 'fixed' ? false : affordForDisplacement;
|
|
@@ -70,6 +72,11 @@ var _EuiBottomBar = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
70
72
|
(0, _react.useEffect)(function () {
|
|
71
73
|
if (affordForDisplacement && usePortal) {
|
|
72
74
|
document.body.style.paddingBottom = "".concat(dimensions.height, "px");
|
|
75
|
+
|
|
76
|
+
// EUI doesn't use this css variable, but it is useful for consumers
|
|
77
|
+
setGlobalCSSVariables({
|
|
78
|
+
'--euiBottomBarOffset': "".concat(dimensions.height, "px")
|
|
79
|
+
});
|
|
73
80
|
}
|
|
74
81
|
if (bodyClassName) {
|
|
75
82
|
document.body.classList.add(bodyClassName);
|
|
@@ -77,12 +84,15 @@ var _EuiBottomBar = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
77
84
|
return function () {
|
|
78
85
|
if (affordForDisplacement && usePortal) {
|
|
79
86
|
document.body.style.paddingBottom = '';
|
|
87
|
+
setGlobalCSSVariables({
|
|
88
|
+
'--euiBottomBarOffset': null
|
|
89
|
+
});
|
|
80
90
|
}
|
|
81
91
|
if (bodyClassName) {
|
|
82
92
|
document.body.classList.remove(bodyClassName);
|
|
83
93
|
}
|
|
84
94
|
};
|
|
85
|
-
}, [affordForDisplacement, usePortal, dimensions, bodyClassName]);
|
|
95
|
+
}, [affordForDisplacement, usePortal, dimensions, bodyClassName, setGlobalCSSVariables]);
|
|
86
96
|
var classes = (0, _classnames.default)('euiBottomBar', "euiBottomBar--".concat(position), className);
|
|
87
97
|
var cssStyles = [styles.euiBottomBar, styles[position], styles[paddingSize]];
|
|
88
98
|
var newStyle = _objectSpread({
|
|
@@ -13,10 +13,12 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
13
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
14
14
|
var _react2 = require("@emotion/react");
|
|
15
15
|
var _services = require("../../../services");
|
|
16
|
+
var _href_validator = require("../../../services/security/href_validator");
|
|
17
|
+
var _useEuiDisabledElement = require("../../../services/hooks/useEuiDisabledElement");
|
|
16
18
|
var _button_display = require("./_button_display.styles");
|
|
17
19
|
var _button_display_content = require("./_button_display_content");
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
+
var _excluded = ["element", "type", "children", "iconType", "iconSide", "iconSize", "size", "isDisabled", "disabled", "hasAriaDisabled", "isLoading", "isSelected", "fullWidth", "minWidth", "contentProps", "textProps", "href", "target", "rel", "style"],
|
|
21
|
+
_excluded2 = ["ref"];
|
|
20
22
|
/*
|
|
21
23
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
22
24
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -62,6 +64,8 @@ var EuiButtonDisplay = exports.EuiButtonDisplay = /*#__PURE__*/(0, _react.forwar
|
|
|
62
64
|
size = _ref2$size === void 0 ? 'm' : _ref2$size,
|
|
63
65
|
isDisabled = _ref2.isDisabled,
|
|
64
66
|
disabled = _ref2.disabled,
|
|
67
|
+
_ref2$hasAriaDisabled = _ref2.hasAriaDisabled,
|
|
68
|
+
hasAriaDisabled = _ref2$hasAriaDisabled === void 0 ? false : _ref2$hasAriaDisabled,
|
|
65
69
|
isLoading = _ref2.isLoading,
|
|
66
70
|
isSelected = _ref2.isSelected,
|
|
67
71
|
fullWidth = _ref2.fullWidth,
|
|
@@ -78,6 +82,14 @@ var EuiButtonDisplay = exports.EuiButtonDisplay = /*#__PURE__*/(0, _react.forwar
|
|
|
78
82
|
isDisabled: isDisabled || disabled,
|
|
79
83
|
isLoading: isLoading
|
|
80
84
|
});
|
|
85
|
+
var _useEuiDisabledElemen = (0, _useEuiDisabledElement.useEuiDisabledElement)({
|
|
86
|
+
isDisabled: buttonIsDisabled,
|
|
87
|
+
hasAriaDisabled: hasAriaDisabled,
|
|
88
|
+
onKeyDown: rest.onKeyDown
|
|
89
|
+
}),
|
|
90
|
+
disabledRef = _useEuiDisabledElemen.ref,
|
|
91
|
+
disabledButtonProps = (0, _objectWithoutProperties2.default)(_useEuiDisabledElemen, _excluded2);
|
|
92
|
+
var setCombinedRef = (0, _services.useCombinedRefs)([disabledRef, ref]);
|
|
81
93
|
var styles = (0, _services.useEuiMemoizedStyles)(_button_display.euiButtonDisplayStyles);
|
|
82
94
|
var cssStyles = [styles.euiButtonDisplay, styles[size], fullWidth && styles.fullWidth, minWidth == null && [styles.defaultMinWidth.defaultMinWidth, styles.defaultMinWidth[size]], buttonIsDisabled && styles.isDisabled];
|
|
83
95
|
var innerNode = (0, _react2.jsx)(_button_display_content.EuiButtonDisplayContent, (0, _extends2.default)({
|
|
@@ -89,13 +101,14 @@ var EuiButtonDisplay = exports.EuiButtonDisplay = /*#__PURE__*/(0, _react.forwar
|
|
|
89
101
|
textProps: textProps
|
|
90
102
|
}, contentProps), children);
|
|
91
103
|
var element = buttonIsDisabled ? 'button' : href ? 'a' : _element;
|
|
92
|
-
var elementProps = {
|
|
93
|
-
|
|
104
|
+
var elementProps = {
|
|
105
|
+
ref: setCombinedRef
|
|
106
|
+
};
|
|
107
|
+
var buttonProps = {};
|
|
94
108
|
if (element === 'button') {
|
|
95
|
-
|
|
96
|
-
disabled: buttonIsDisabled,
|
|
109
|
+
buttonProps = _objectSpread({
|
|
97
110
|
'aria-pressed': isSelected
|
|
98
|
-
});
|
|
111
|
+
}, disabledButtonProps);
|
|
99
112
|
}
|
|
100
113
|
var relObj = {};
|
|
101
114
|
if (href && !buttonIsDisabled) {
|
|
@@ -109,12 +122,11 @@ var EuiButtonDisplay = exports.EuiButtonDisplay = /*#__PURE__*/(0, _react.forwar
|
|
|
109
122
|
} else {
|
|
110
123
|
relObj.type = type;
|
|
111
124
|
}
|
|
112
|
-
return (0, _react2.createElement)(element, _objectSpread(_objectSpread(_objectSpread({
|
|
125
|
+
return (0, _react2.createElement)(element, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
113
126
|
css: cssStyles,
|
|
114
127
|
style: minWidth ? _objectSpread(_objectSpread({}, style), {}, {
|
|
115
128
|
minInlineSize: minWidth
|
|
116
|
-
}) : style
|
|
117
|
-
|
|
118
|
-
}, elementProps), relObj), rest), innerNode);
|
|
129
|
+
}) : style
|
|
130
|
+
}, elementProps), relObj), rest), buttonProps), innerNode);
|
|
119
131
|
});
|
|
120
132
|
EuiButtonDisplay.displayName = 'EuiButtonDisplay';
|
|
@@ -20,11 +20,11 @@ var euiButtonBaseCSS = exports.euiButtonBaseCSS = function euiButtonBaseCSS() {
|
|
|
20
20
|
return "\n display: inline-block;\n appearance: none;\n cursor: pointer;\n ".concat((0, _global_styling.logicalTextAlignCSS)('center'), ";\n white-space: nowrap;\n ").concat((0, _global_styling.logicalCSS)('max-width', '100%'), ";\n vertical-align: middle;\n ");
|
|
21
21
|
};
|
|
22
22
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
23
|
-
name: "
|
|
24
|
-
styles: "cursor:not-allowed;label:isDisabled;"
|
|
23
|
+
name: "col2gx-isDisabled",
|
|
24
|
+
styles: "cursor:not-allowed;&[aria-disabled='true']{pointer-events:none;>*{pointer-events:none;}};label:isDisabled;"
|
|
25
25
|
} : {
|
|
26
|
-
name: "
|
|
27
|
-
styles: "cursor:not-allowed;label:isDisabled;",
|
|
26
|
+
name: "col2gx-isDisabled",
|
|
27
|
+
styles: "cursor:not-allowed;&[aria-disabled='true']{pointer-events:none;>*{pointer-events:none;}};label:isDisabled;",
|
|
28
28
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
29
29
|
};
|
|
30
30
|
var euiButtonDisplayStyles = exports.euiButtonDisplayStyles = function euiButtonDisplayStyles(euiThemeContext) {
|
|
@@ -11,12 +11,14 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
11
11
|
var _react = _interopRequireDefault(require("react"));
|
|
12
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
13
|
var _services = require("../../../services");
|
|
14
|
-
var
|
|
14
|
+
var _useEuiDisabledElement = require("../../../services/hooks/useEuiDisabledElement");
|
|
15
15
|
var _button = require("../../../global_styling/mixins/_button");
|
|
16
|
+
var _button_display_content = require("../button_display/_button_display_content");
|
|
16
17
|
var _button_display = require("../button_display/_button_display");
|
|
17
18
|
var _button_empty = require("./button_empty.styles");
|
|
18
19
|
var _react2 = require("@emotion/react");
|
|
19
|
-
var _excluded = ["children", "className", "iconType", "iconSide", "iconSize", "color", "size", "flush", "isDisabled", "disabled", "isLoading", "href", "target", "rel", "type", "buttonRef", "contentProps", "textProps", "isSelected"]
|
|
20
|
+
var _excluded = ["children", "className", "iconType", "iconSide", "iconSize", "color", "size", "flush", "isDisabled", "disabled", "hasAriaDisabled", "isLoading", "href", "target", "rel", "type", "buttonRef", "contentProps", "textProps", "isSelected"],
|
|
21
|
+
_excluded2 = ["ref"];
|
|
20
22
|
/*
|
|
21
23
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
22
24
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -49,6 +51,8 @@ var EuiButtonEmpty = exports.EuiButtonEmpty = function EuiButtonEmpty(_ref) {
|
|
|
49
51
|
flush = _ref.flush,
|
|
50
52
|
_isDisabled = _ref.isDisabled,
|
|
51
53
|
disabled = _ref.disabled,
|
|
54
|
+
_ref$hasAriaDisabled = _ref.hasAriaDisabled,
|
|
55
|
+
hasAriaDisabled = _ref$hasAriaDisabled === void 0 ? false : _ref$hasAriaDisabled,
|
|
52
56
|
isLoading = _ref.isLoading,
|
|
53
57
|
href = _ref.href,
|
|
54
58
|
target = _ref.target,
|
|
@@ -65,6 +69,14 @@ var EuiButtonEmpty = exports.EuiButtonEmpty = function EuiButtonEmpty(_ref) {
|
|
|
65
69
|
href: href,
|
|
66
70
|
isLoading: isLoading
|
|
67
71
|
});
|
|
72
|
+
var _useEuiDisabledElemen = (0, _useEuiDisabledElement.useEuiDisabledElement)({
|
|
73
|
+
isDisabled: isDisabled,
|
|
74
|
+
hasAriaDisabled: hasAriaDisabled,
|
|
75
|
+
onKeyDown: rest.onKeyDown
|
|
76
|
+
}),
|
|
77
|
+
disabledRef = _useEuiDisabledElemen.ref,
|
|
78
|
+
disabledButtonProps = (0, _objectWithoutProperties2.default)(_useEuiDisabledElemen, _excluded2);
|
|
79
|
+
var setCombinedRef = (0, _services.useCombinedRefs)([disabledRef, buttonRef]);
|
|
68
80
|
var buttonColorStyles = (0, _button.useEuiButtonColorCSS)({
|
|
69
81
|
display: 'empty'
|
|
70
82
|
});
|
|
@@ -100,7 +112,7 @@ var EuiButtonEmpty = exports.EuiButtonEmpty = function EuiButtonEmpty(_ref) {
|
|
|
100
112
|
href: href,
|
|
101
113
|
target: target,
|
|
102
114
|
rel: secureRel,
|
|
103
|
-
ref:
|
|
115
|
+
ref: setCombinedRef
|
|
104
116
|
}, rest), innerNode);
|
|
105
117
|
}
|
|
106
118
|
return (0, _react2.jsx)("button", (0, _extends2.default)({
|
|
@@ -108,7 +120,7 @@ var EuiButtonEmpty = exports.EuiButtonEmpty = function EuiButtonEmpty(_ref) {
|
|
|
108
120
|
className: classes,
|
|
109
121
|
css: cssStyles,
|
|
110
122
|
type: type,
|
|
111
|
-
ref:
|
|
123
|
+
ref: setCombinedRef,
|
|
112
124
|
"aria-pressed": isSelected
|
|
113
|
-
}, rest), innerNode);
|
|
125
|
+
}, rest, disabledButtonProps), innerNode);
|
|
114
126
|
};
|
|
@@ -14,7 +14,7 @@ var _accessibility = require("../../accessibility");
|
|
|
14
14
|
var _button_group_button = require("./button_group_button");
|
|
15
15
|
var _button_group = require("./button_group.styles");
|
|
16
16
|
var _react2 = require("@emotion/react");
|
|
17
|
-
var _excluded = ["className", "buttonSize", "color", "idSelected", "idToSelectedMap", "isDisabled", "isFullWidth", "isIconOnly", "legend", "name", "onChange", "options", "type"];
|
|
17
|
+
var _excluded = ["className", "buttonSize", "color", "idSelected", "idToSelectedMap", "isDisabled", "hasAriaDisabled", "isFullWidth", "isIconOnly", "legend", "name", "onChange", "options", "type"];
|
|
18
18
|
/*
|
|
19
19
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
20
20
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -34,6 +34,8 @@ var EuiButtonGroup = exports.EuiButtonGroup = function EuiButtonGroup(_ref) {
|
|
|
34
34
|
idToSelectedMap = _ref$idToSelectedMap === void 0 ? {} : _ref$idToSelectedMap,
|
|
35
35
|
_ref$isDisabled = _ref.isDisabled,
|
|
36
36
|
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
37
|
+
_ref$hasAriaDisabled = _ref.hasAriaDisabled,
|
|
38
|
+
hasAriaDisabled = _ref$hasAriaDisabled === void 0 ? false : _ref$hasAriaDisabled,
|
|
37
39
|
_ref$isFullWidth = _ref.isFullWidth,
|
|
38
40
|
isFullWidth = _ref$isFullWidth === void 0 ? false : _ref$isFullWidth,
|
|
39
41
|
_ref$isIconOnly = _ref.isIconOnly,
|
|
@@ -53,18 +55,21 @@ var EuiButtonGroup = exports.EuiButtonGroup = function EuiButtonGroup(_ref) {
|
|
|
53
55
|
'euiButtonGroup-isDisabled': isDisabled
|
|
54
56
|
}, className);
|
|
55
57
|
var typeIsSingle = type === 'single';
|
|
58
|
+
var groupDisabledProps = {
|
|
59
|
+
disabled: hasAriaDisabled ? undefined : isDisabled,
|
|
60
|
+
'aria-disabled': hasAriaDisabled ? isDisabled : undefined
|
|
61
|
+
};
|
|
56
62
|
return (0, _react2.jsx)("fieldset", (0, _extends2.default)({
|
|
57
63
|
css: wrapperCssStyles,
|
|
58
64
|
className: classes
|
|
59
|
-
}, rest, {
|
|
60
|
-
disabled: isDisabled
|
|
61
|
-
}), (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("legend", null, legend)), (0, _react2.jsx)("div", {
|
|
65
|
+
}, rest, groupDisabledProps), (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("legend", null, legend)), (0, _react2.jsx)("div", {
|
|
62
66
|
css: cssStyles,
|
|
63
67
|
className: "euiButtonGroup__buttons"
|
|
64
68
|
}, options.map(function (option) {
|
|
65
69
|
return (0, _react2.jsx)(_button_group_button.EuiButtonGroupButton, (0, _extends2.default)({
|
|
66
70
|
key: option.id,
|
|
67
|
-
isDisabled: isDisabled
|
|
71
|
+
isDisabled: isDisabled,
|
|
72
|
+
hasAriaDisabled: hasAriaDisabled
|
|
68
73
|
}, option, {
|
|
69
74
|
onClick: typeIsSingle ? function () {
|
|
70
75
|
return onChange(option.id, option.value);
|
|
@@ -53,7 +53,7 @@ var EuiButtonGroupButton = exports.EuiButtonGroupButton = function EuiButtonGrou
|
|
|
53
53
|
var buttonColorStyles = (0, _button.useEuiButtonColorCSS)({
|
|
54
54
|
display: display
|
|
55
55
|
})[color];
|
|
56
|
-
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];
|
|
56
|
+
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];
|
|
57
57
|
var tooltipWrapperStyles = [styles.tooltipWrapper, !isCompressed && styles.uncompressed[size]];
|
|
58
58
|
var contentStyles = [styles.content.euiButtonGroupButton__content, isCompressed && styles.content.compressed];
|
|
59
59
|
var textStyles = [isIconOnly ? styles.text.euiButtonGroupButton__iconOnly : styles.text.euiButtonGroupButton__text];
|
|
@@ -11,7 +11,6 @@ var _react = require("@emotion/react");
|
|
|
11
11
|
var _global_styling = require("../../../global_styling");
|
|
12
12
|
var _button = require("../../../global_styling/mixins/_button");
|
|
13
13
|
var _accessibility = require("../../accessibility");
|
|
14
|
-
var _form = require("../../form/form.styles");
|
|
15
14
|
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; }
|
|
16
15
|
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) { (0, _defineProperty2.default)(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; }
|
|
17
16
|
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /*
|
|
@@ -40,9 +39,8 @@ var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
|
40
39
|
var euiButtonGroupButtonStyles = exports.euiButtonGroupButtonStyles = function euiButtonGroupButtonStyles(euiThemeContext) {
|
|
41
40
|
var euiTheme = euiThemeContext.euiTheme,
|
|
42
41
|
highContrastMode = euiThemeContext.highContrastMode;
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
var compressedButtonHeight = (0, _global_styling.mathWithUnits)([controlCompressedHeight, euiTheme.border.width.thin], function (x, y) {
|
|
42
|
+
var buttonSizes = (0, _button.euiButtonSizeMap)(euiThemeContext);
|
|
43
|
+
var compressedButtonHeight = (0, _global_styling.mathWithUnits)([buttonSizes.s.height, euiTheme.border.width.thin], function (x, y) {
|
|
46
44
|
return x - y * 6;
|
|
47
45
|
});
|
|
48
46
|
var selectedSelectors = '.euiButtonGroupButton-isSelected, .euiButtonGroup__tooltipWrapper-isSelected';
|
|
@@ -54,10 +52,16 @@ var euiButtonGroupButtonStyles = exports.euiButtonGroupButtonStyles = function e
|
|
|
54
52
|
euiButtonGroupButton: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('min-width', 0), " flex-shrink:1;flex-grow:0;z-index:0;&:focus-visible{z-index:2;}", _global_styling.euiCanAnimate, "{transition:background-color ", euiTheme.animation.normal, " ease-in-out,color ", euiTheme.animation.normal, " ease-in-out;}&:is(", selectedSelectors, "){", (0, _global_styling.highContrastModeStyles)(euiThemeContext, {
|
|
55
53
|
forced: "\n --highContrastHoverIndicatorColor: ".concat(euiTheme.colors.textInverse, ";\n border: none;\n\n /* styles the content manually instead of the button itself to preserve the system\n focus style, as otherwise preventForcedColors() would require manual styling */\n > [class*=\"euiButtonDisplayContent\"] {\n ").concat((0, _global_styling.preventForcedColors)(euiThemeContext), "\n color: ").concat(euiTheme.colors.emptyShade, ";\n border: none;\n }\n ")
|
|
56
54
|
}), ";};label:euiButtonGroupButton;"),
|
|
57
|
-
iconOnly:
|
|
55
|
+
iconOnly: {
|
|
56
|
+
// used only as classname, sizes are added separately
|
|
57
|
+
iconOnly: /*#__PURE__*/(0, _react.css)(";label:iconOnly;"),
|
|
58
|
+
s: "\n ".concat((0, _global_styling.logicalCSS)('width', buttonSizes.s.height), "\n "),
|
|
59
|
+
m: "\n ".concat((0, _global_styling.logicalCSS)('width', buttonSizes.m.height), "\n "),
|
|
60
|
+
compressed: "\n ".concat((0, _global_styling.logicalCSS)('width', compressedButtonHeight), "\n ")
|
|
61
|
+
},
|
|
58
62
|
// Sizes
|
|
59
63
|
uncompressed: {
|
|
60
|
-
uncompressed: /*#__PURE__*/(0, _react.css)("&:focus-visible{", (0, _global_styling.euiOutline)(euiThemeContext, 'inset', euiTheme.components.buttonGroupFocusColor), ";}&:is(", selectedSelectors, "):not(
|
|
64
|
+
uncompressed: /*#__PURE__*/(0, _react.css)("&:focus-visible{", (0, _global_styling.euiOutline)(euiThemeContext, 'inset', euiTheme.components.buttonGroupFocusColor), ";}&:is(", selectedSelectors, "):not(", _global_styling.euiDisabledSelector, "){z-index:1;border:", euiTheme.border.width.thin, " solid transparent;", (0, _global_styling.highContrastModeStyles)(euiThemeContext, {
|
|
61
65
|
forced: "\n /* use inset focus outline to ensure visibility, same as custom hover.\n NOTE: temp solution - this will be revisited once we handle global focus styles */\n &:focus-visible {\n outline-color: ".concat(euiTheme.colors.textInverse, ";\n /* has to be inset due to overflow: hidden */\n outline-offset: -").concat((0, _global_styling.mathWithUnits)(euiTheme.border.width.thin, function (x) {
|
|
62
66
|
return x * 4;
|
|
63
67
|
}), ";\n }\n ")
|
|
@@ -10,13 +10,15 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
12
|
var _services = require("../../../services");
|
|
13
|
+
var _useEuiDisabledElement = require("../../../services/hooks/useEuiDisabledElement");
|
|
13
14
|
var _icon = require("../../icon");
|
|
14
15
|
var _loading = require("../../loading");
|
|
15
16
|
var _button = require("../../../global_styling/mixins/_button");
|
|
16
17
|
var _button_display = require("../button_display/_button_display");
|
|
17
18
|
var _button_icon = require("./button_icon.styles");
|
|
18
19
|
var _react2 = require("@emotion/react");
|
|
19
|
-
var _excluded = ["className", "iconType", "iconSize", "color", "isDisabled", "disabled", "href", "type", "display", "target", "rel", "size", "buttonRef", "isSelected", "isLoading"]
|
|
20
|
+
var _excluded = ["className", "iconType", "iconSize", "color", "isDisabled", "disabled", "hasAriaDisabled", "href", "type", "display", "target", "rel", "size", "buttonRef", "isSelected", "isLoading"],
|
|
21
|
+
_excluded2 = ["ref"];
|
|
20
22
|
/*
|
|
21
23
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
22
24
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -35,6 +37,8 @@ var EuiButtonIcon = exports.EuiButtonIcon = function EuiButtonIcon(_ref) {
|
|
|
35
37
|
color = _ref$color === void 0 ? 'primary' : _ref$color,
|
|
36
38
|
_isDisabled = _ref.isDisabled,
|
|
37
39
|
disabled = _ref.disabled,
|
|
40
|
+
_ref$hasAriaDisabled = _ref.hasAriaDisabled,
|
|
41
|
+
hasAriaDisabled = _ref$hasAriaDisabled === void 0 ? false : _ref$hasAriaDisabled,
|
|
38
42
|
href = _ref.href,
|
|
39
43
|
_ref$type = _ref.type,
|
|
40
44
|
type = _ref$type === void 0 ? 'button' : _ref$type,
|
|
@@ -53,6 +57,14 @@ var EuiButtonIcon = exports.EuiButtonIcon = function EuiButtonIcon(_ref) {
|
|
|
53
57
|
href: href,
|
|
54
58
|
isLoading: isLoading
|
|
55
59
|
});
|
|
60
|
+
var _useEuiDisabledElemen = (0, _useEuiDisabledElement.useEuiDisabledElement)({
|
|
61
|
+
isDisabled: isDisabled,
|
|
62
|
+
hasAriaDisabled: hasAriaDisabled,
|
|
63
|
+
onKeyDown: rest.onKeyDown
|
|
64
|
+
}),
|
|
65
|
+
disabledRef = _useEuiDisabledElemen.ref,
|
|
66
|
+
disabledButtonProps = (0, _objectWithoutProperties2.default)(_useEuiDisabledElemen, _excluded2);
|
|
67
|
+
var setCombinedRef = (0, _services.useCombinedRefs)([disabledRef, buttonRef]);
|
|
56
68
|
var ariaHidden = rest['aria-hidden'];
|
|
57
69
|
var isAriaHidden = ariaHidden === 'true' || ariaHidden === true;
|
|
58
70
|
if (!rest['aria-label'] && !rest['aria-labelledby'] && !isAriaHidden) {
|
|
@@ -112,7 +124,7 @@ var EuiButtonIcon = exports.EuiButtonIcon = function EuiButtonIcon(_ref) {
|
|
|
112
124
|
href: href,
|
|
113
125
|
target: target,
|
|
114
126
|
rel: secureRel,
|
|
115
|
-
ref:
|
|
127
|
+
ref: setCombinedRef
|
|
116
128
|
}, rest), buttonIcon);
|
|
117
129
|
}
|
|
118
130
|
var buttonType;
|
|
@@ -123,6 +135,6 @@ var EuiButtonIcon = exports.EuiButtonIcon = function EuiButtonIcon(_ref) {
|
|
|
123
135
|
className: classes,
|
|
124
136
|
"aria-pressed": isSelected,
|
|
125
137
|
type: type,
|
|
126
|
-
ref:
|
|
127
|
-
}, rest), buttonIcon);
|
|
138
|
+
ref: setCombinedRef
|
|
139
|
+
}, rest, disabledButtonProps), buttonIcon);
|
|
128
140
|
};
|