@elastic/eui 109.0.0 → 109.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/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 +1 -1
- 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
|
@@ -16,6 +16,7 @@ var _date_picker_range = require("../date_picker_range");
|
|
|
16
16
|
var _form = require("../../form");
|
|
17
17
|
var _time_options = require("./time_options");
|
|
18
18
|
var _pretty_duration = require("./pretty_duration");
|
|
19
|
+
var _time_window_buttons = require("./time_window_buttons");
|
|
19
20
|
var _async_interval = require("./async_interval");
|
|
20
21
|
var _super_update_button = require("./super_update_button");
|
|
21
22
|
var _quick_select_popover = require("./quick_select_popover/quick_select_popover");
|
|
@@ -283,7 +284,9 @@ var EuiSuperDatePickerInternal = exports.EuiSuperDatePickerInternal = /*#__PURE_
|
|
|
283
284
|
maxDate = _this$props3.maxDate,
|
|
284
285
|
compressed = _this$props3.compressed,
|
|
285
286
|
onFocus = _this$props3.onFocus,
|
|
286
|
-
styles = _this$props3.memoizedStyles
|
|
287
|
+
styles = _this$props3.memoizedStyles,
|
|
288
|
+
_this$props3$timeZone = _this$props3.timeZoneDisplayProps,
|
|
289
|
+
timeZoneDisplayProps = _this$props3$timeZone === void 0 ? {} : _this$props3$timeZone;
|
|
287
290
|
var autoRefreshAppend = !isPaused ? (0, _react2.jsx)(_auto_refresh.EuiAutoRefreshButton, {
|
|
288
291
|
refreshInterval: refreshInterval,
|
|
289
292
|
minInterval: refreshMinInterval,
|
|
@@ -360,7 +363,8 @@ var EuiSuperDatePickerInternal = exports.EuiSuperDatePickerInternal = /*#__PURE_
|
|
|
360
363
|
timeOptions: timeOptions,
|
|
361
364
|
buttonProps: {
|
|
362
365
|
onFocus: onFocus
|
|
363
|
-
}
|
|
366
|
+
},
|
|
367
|
+
timeZoneDisplayProps: timeZoneDisplayProps
|
|
364
368
|
}),
|
|
365
369
|
endDateControl: isQuickSelectOnly ? undefined : (0, _react2.jsx)(_date_popover_button.EuiDatePopoverButton, {
|
|
366
370
|
css: styles.euiSuperDatePicker__rangeInput,
|
|
@@ -385,7 +389,8 @@ var EuiSuperDatePickerInternal = exports.EuiSuperDatePickerInternal = /*#__PURE_
|
|
|
385
389
|
timeOptions: timeOptions,
|
|
386
390
|
buttonProps: {
|
|
387
391
|
onFocus: onFocus
|
|
388
|
-
}
|
|
392
|
+
},
|
|
393
|
+
timeZoneDisplayProps: timeZoneDisplayProps
|
|
389
394
|
})
|
|
390
395
|
}));
|
|
391
396
|
});
|
|
@@ -405,13 +410,32 @@ var EuiSuperDatePickerInternal = exports.EuiSuperDatePickerInternal = /*#__PURE_
|
|
|
405
410
|
_this.applyTime();
|
|
406
411
|
}
|
|
407
412
|
});
|
|
408
|
-
_defineProperty(_this, "
|
|
413
|
+
_defineProperty(_this, "renderTimeWindowButtons", function () {
|
|
414
|
+
if (!_this.props.showTimeWindowButtons || _this.props.isAutoRefreshOnly) {
|
|
415
|
+
return null;
|
|
416
|
+
}
|
|
409
417
|
var _this$props5 = _this.props,
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
418
|
+
start = _this$props5.start,
|
|
419
|
+
end = _this$props5.end,
|
|
420
|
+
showTimeWindowButtons = _this$props5.showTimeWindowButtons,
|
|
421
|
+
compressed = _this$props5.compressed,
|
|
422
|
+
isDisabled = _this$props5.isDisabled;
|
|
423
|
+
var config = typeof showTimeWindowButtons === 'boolean' ? {} : showTimeWindowButtons;
|
|
424
|
+
return (0, _react2.jsx)(_time_window_buttons.EuiTimeWindowButtons, _extends({
|
|
425
|
+
applyTime: _this.applyQuickTime,
|
|
426
|
+
start: start,
|
|
427
|
+
end: end,
|
|
428
|
+
compressed: compressed,
|
|
429
|
+
isDisabled: !!isDisabled || _this.state.isInvalid
|
|
430
|
+
}, config));
|
|
431
|
+
});
|
|
432
|
+
_defineProperty(_this, "renderUpdateButton", function () {
|
|
433
|
+
var _this$props6 = _this.props,
|
|
434
|
+
isLoading = _this$props6.isLoading,
|
|
435
|
+
isDisabled = _this$props6.isDisabled,
|
|
436
|
+
updateButtonProps = _this$props6.updateButtonProps,
|
|
437
|
+
showUpdateButton = _this$props6.showUpdateButton,
|
|
438
|
+
compressed = _this$props6.compressed;
|
|
415
439
|
if (!showUpdateButton) return null;
|
|
416
440
|
return (0, _react2.jsx)(_super_update_button.EuiSuperUpdateButton, _extends({
|
|
417
441
|
needsUpdate: _this.state.hasChanged,
|
|
@@ -430,21 +454,21 @@ var EuiSuperDatePickerInternal = exports.EuiSuperDatePickerInternal = /*#__PURE_
|
|
|
430
454
|
return _createClass(EuiSuperDatePickerInternal, [{
|
|
431
455
|
key: "render",
|
|
432
456
|
value: function render() {
|
|
433
|
-
var _this$
|
|
434
|
-
isAutoRefreshOnly = _this$
|
|
435
|
-
isDisabled = _this$
|
|
436
|
-
isPaused = _this$
|
|
437
|
-
onRefreshChange = _this$
|
|
438
|
-
refreshInterval = _this$
|
|
439
|
-
refreshMinInterval = _this$
|
|
440
|
-
refreshIntervalUnits = _this$
|
|
441
|
-
showUpdateButton = _this$
|
|
442
|
-
dataTestSubj = _this$
|
|
443
|
-
_width = _this$
|
|
444
|
-
isQuickSelectOnly = _this$
|
|
445
|
-
compressed = _this$
|
|
446
|
-
className = _this$
|
|
447
|
-
styles = _this$
|
|
457
|
+
var _this$props7 = this.props,
|
|
458
|
+
isAutoRefreshOnly = _this$props7.isAutoRefreshOnly,
|
|
459
|
+
isDisabled = _this$props7.isDisabled,
|
|
460
|
+
isPaused = _this$props7.isPaused,
|
|
461
|
+
onRefreshChange = _this$props7.onRefreshChange,
|
|
462
|
+
refreshInterval = _this$props7.refreshInterval,
|
|
463
|
+
refreshMinInterval = _this$props7.refreshMinInterval,
|
|
464
|
+
refreshIntervalUnits = _this$props7.refreshIntervalUnits,
|
|
465
|
+
showUpdateButton = _this$props7.showUpdateButton,
|
|
466
|
+
dataTestSubj = _this$props7['data-test-subj'],
|
|
467
|
+
_width = _this$props7.width,
|
|
468
|
+
isQuickSelectOnly = _this$props7.isQuickSelectOnly,
|
|
469
|
+
compressed = _this$props7.compressed,
|
|
470
|
+
className = _this$props7.className,
|
|
471
|
+
styles = _this$props7.memoizedStyles;
|
|
448
472
|
var _this$state2 = this.state,
|
|
449
473
|
hasChanged = _this$state2.hasChanged,
|
|
450
474
|
isInvalid = _this$state2.isInvalid;
|
|
@@ -469,7 +493,7 @@ var EuiSuperDatePickerInternal = exports.EuiSuperDatePickerInternal = /*#__PURE_
|
|
|
469
493
|
compressed: compressed,
|
|
470
494
|
isDisabled: !!isDisabled,
|
|
471
495
|
className: className
|
|
472
|
-
}) : (0, _react2.jsx)(_react.default.Fragment, null, this.renderDatePickerRange(), this.renderUpdateButton()));
|
|
496
|
+
}) : (0, _react2.jsx)(_react.default.Fragment, null, this.renderDatePickerRange(), this.renderTimeWindowButtons(), this.renderUpdateButton()));
|
|
473
497
|
}
|
|
474
498
|
}], [{
|
|
475
499
|
key: "getDerivedStateFromProps",
|
|
@@ -632,6 +656,28 @@ EuiSuperDatePickerInternal.propTypes = {
|
|
|
632
656
|
* @default true
|
|
633
657
|
*/
|
|
634
658
|
showUpdateButton: _propTypes.default.oneOfType([_propTypes.default.bool.isRequired, _propTypes.default.oneOf(["iconOnly"])]),
|
|
659
|
+
/**
|
|
660
|
+
* Set to true to display buttons for time shifting and zooming out,
|
|
661
|
+
* next to the top-level control.
|
|
662
|
+
*/
|
|
663
|
+
showTimeWindowButtons: _propTypes.default.oneOfType([_propTypes.default.bool.isRequired, _propTypes.default.shape({
|
|
664
|
+
/**
|
|
665
|
+
* Show button for zooming out
|
|
666
|
+
* @default true
|
|
667
|
+
*/
|
|
668
|
+
showZoomOut: _propTypes.default.bool,
|
|
669
|
+
/**
|
|
670
|
+
* Show buttons for shifting the time window forward and backward
|
|
671
|
+
* @default true
|
|
672
|
+
*/
|
|
673
|
+
showShiftArrows: _propTypes.default.bool,
|
|
674
|
+
/**
|
|
675
|
+
* How much the time window is increased when zooming.
|
|
676
|
+
* A number between 0 and 1 e.g. 0.25, or a string representing a percentage e.g. 25%
|
|
677
|
+
* @default 0.5
|
|
678
|
+
* */
|
|
679
|
+
zoomFactor: _propTypes.default.oneOfType([_propTypes.default.number.isRequired, _propTypes.default.string.isRequired])
|
|
680
|
+
}).isRequired]),
|
|
635
681
|
/**
|
|
636
682
|
* Hides the actual input reducing to just the quick select button.
|
|
637
683
|
*/
|
|
@@ -678,6 +724,31 @@ EuiSuperDatePickerInternal.propTypes = {
|
|
|
678
724
|
* input by the user, set this flag to `false`.
|
|
679
725
|
*/
|
|
680
726
|
canRoundRelativeUnits: _propTypes.default.bool,
|
|
727
|
+
/**
|
|
728
|
+
* Props passed to the time zone display in the popovers {@link EuiTimeZoneDisplayProps}
|
|
729
|
+
*
|
|
730
|
+
* Setting `timeZoneDisplayProps.timeZone` with a valid time zone name will make
|
|
731
|
+
* the time zone information be visible below the start and end input fields.
|
|
732
|
+
* This is informational only, it will not affect how date/times are handled.
|
|
733
|
+
*/
|
|
734
|
+
timeZoneDisplayProps: _propTypes.default.shape({
|
|
735
|
+
/**
|
|
736
|
+
* A valid time zone name, from the IANA database, e.g. "America/Los_Angeles".
|
|
737
|
+
*
|
|
738
|
+
* @link https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
|
739
|
+
*/
|
|
740
|
+
timeZone: _propTypes.default.string,
|
|
741
|
+
/**
|
|
742
|
+
* Render prop function to add additional content to the time zone display.
|
|
743
|
+
* Useful for e.g. adding links to documentation or setting pages.
|
|
744
|
+
*/
|
|
745
|
+
customRender: _propTypes.default.func,
|
|
746
|
+
/**
|
|
747
|
+
* Reference date to be used while resolving the UTC offset.
|
|
748
|
+
* Only useful for edge cases involving daylight saving time.
|
|
749
|
+
*/
|
|
750
|
+
date: _propTypes.default.any
|
|
751
|
+
}),
|
|
681
752
|
memoizedStyles: _propTypes.default.any.isRequired,
|
|
682
753
|
timeOptions: _propTypes.default.shape({
|
|
683
754
|
timeTenseOptions: _propTypes.default.arrayOf(_propTypes.default.any.isRequired).isRequired,
|
|
@@ -827,6 +898,15 @@ EuiSuperDatePicker.propTypes = {
|
|
|
827
898
|
* @default true
|
|
828
899
|
*/
|
|
829
900
|
showUpdateButton: _propTypes.default.oneOfType([_propTypes.default.bool.isRequired, _propTypes.default.oneOf(["iconOnly"])]),
|
|
901
|
+
/**
|
|
902
|
+
* Set to true to display buttons for time shifting and zooming out,
|
|
903
|
+
* next to the top-level control.
|
|
904
|
+
*/
|
|
905
|
+
showTimeWindowButtons: _propTypes.default.oneOfType([_propTypes.default.bool.isRequired, _propTypes.default.shape({
|
|
906
|
+
showZoomOut: _propTypes.default.bool,
|
|
907
|
+
showShiftArrows: _propTypes.default.bool,
|
|
908
|
+
zoomFactor: _propTypes.default.oneOfType([_propTypes.default.number.isRequired, _propTypes.default.string.isRequired])
|
|
909
|
+
}).isRequired]),
|
|
830
910
|
/**
|
|
831
911
|
* Hides the actual input reducing to just the quick select button.
|
|
832
912
|
*/
|
|
@@ -852,5 +932,17 @@ EuiSuperDatePicker.propTypes = {
|
|
|
852
932
|
* If you do not want this behavior and instead wish to keep the exact units
|
|
853
933
|
* input by the user, set this flag to `false`.
|
|
854
934
|
*/
|
|
855
|
-
canRoundRelativeUnits: _propTypes.default.bool
|
|
935
|
+
canRoundRelativeUnits: _propTypes.default.bool,
|
|
936
|
+
/**
|
|
937
|
+
* Props passed to the time zone display in the popovers {@link EuiTimeZoneDisplayProps}
|
|
938
|
+
*
|
|
939
|
+
* Setting `timeZoneDisplayProps.timeZone` with a valid time zone name will make
|
|
940
|
+
* the time zone information be visible below the start and end input fields.
|
|
941
|
+
* This is informational only, it will not affect how date/times are handled.
|
|
942
|
+
*/
|
|
943
|
+
timeZoneDisplayProps: _propTypes.default.shape({
|
|
944
|
+
timeZone: _propTypes.default.string,
|
|
945
|
+
customRender: _propTypes.default.func,
|
|
946
|
+
date: _propTypes.default.any
|
|
947
|
+
})
|
|
856
948
|
};
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ZOOM_FACTOR_DEFAULT = exports.EuiTimeWindowButtons = void 0;
|
|
7
|
+
exports.useEuiTimeWindow = useEuiTimeWindow;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _datemath = _interopRequireDefault(require("@elastic/datemath"));
|
|
10
|
+
var _moment = _interopRequireDefault(require("moment"));
|
|
11
|
+
var _pretty_interval = require("./pretty_interval");
|
|
12
|
+
var _relative_utils = require("./relative_utils");
|
|
13
|
+
var _button_group_button = require("../../button/button_group/button_group_button");
|
|
14
|
+
var _button_group = require("../../button/button_group/button_group.styles");
|
|
15
|
+
var _services = require("../../../services");
|
|
16
|
+
var _i18n = require("../../i18n");
|
|
17
|
+
var _react2 = require("@emotion/react");
|
|
18
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
|
+
/*
|
|
20
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
21
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
22
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
23
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
24
|
+
* Side Public License, v 1.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
var ZOOM_FACTOR_DEFAULT = exports.ZOOM_FACTOR_DEFAULT = 0.5;
|
|
28
|
+
/**
|
|
29
|
+
* Button group with time window controls for shifting the time window
|
|
30
|
+
* forwards and backwards, and zooming out.
|
|
31
|
+
*/
|
|
32
|
+
var EuiTimeWindowButtons = exports.EuiTimeWindowButtons = function EuiTimeWindowButtons(_ref) {
|
|
33
|
+
var applyTime = _ref.applyTime,
|
|
34
|
+
start = _ref.start,
|
|
35
|
+
end = _ref.end,
|
|
36
|
+
compressed = _ref.compressed,
|
|
37
|
+
isDisabled = _ref.isDisabled,
|
|
38
|
+
_ref$showZoomOut = _ref.showZoomOut,
|
|
39
|
+
showZoomOut = _ref$showZoomOut === void 0 ? true : _ref$showZoomOut,
|
|
40
|
+
_ref$showShiftArrows = _ref.showShiftArrows,
|
|
41
|
+
showShiftArrows = _ref$showShiftArrows === void 0 ? true : _ref$showShiftArrows,
|
|
42
|
+
_ref$zoomFactor = _ref.zoomFactor,
|
|
43
|
+
zoomFactor = _ref$zoomFactor === void 0 ? ZOOM_FACTOR_DEFAULT : _ref$zoomFactor;
|
|
44
|
+
var buttonColor = 'text';
|
|
45
|
+
var buttonSize = compressed ? 's' : 'm';
|
|
46
|
+
var iconSize = compressed ? 's' : 'm';
|
|
47
|
+
var styles = (0, _services.useEuiMemoizedStyles)(_button_group.euiButtonGroupButtonsStyles);
|
|
48
|
+
var _useEuiTimeWindow = useEuiTimeWindow(start, end, applyTime, {
|
|
49
|
+
zoomFactor: zoomFactor
|
|
50
|
+
}),
|
|
51
|
+
displayInterval = _useEuiTimeWindow.displayInterval,
|
|
52
|
+
isInvalid = _useEuiTimeWindow.isInvalid,
|
|
53
|
+
stepForward = _useEuiTimeWindow.stepForward,
|
|
54
|
+
stepBackward = _useEuiTimeWindow.stepBackward,
|
|
55
|
+
expandWindow = _useEuiTimeWindow.expandWindow;
|
|
56
|
+
var invalidShiftDescription = (0, _i18n.useEuiI18n)('euiTimeWindowButtons.invalidShiftLabel', 'Cannot shift invalid time window');
|
|
57
|
+
var invalidZoomOutDescription = (0, _i18n.useEuiI18n)('euiTimeWindowButtons.invalidZoomOutLabel', 'Cannot zoom out invalid time window');
|
|
58
|
+
var previousId = (0, _services.useGeneratedHtmlId)({
|
|
59
|
+
prefix: 'previous'
|
|
60
|
+
});
|
|
61
|
+
var previousLabel = (0, _i18n.useEuiI18n)('euiTimeWindowButtons.previousLabel', 'Previous');
|
|
62
|
+
var previousTooltipContent = (0, _i18n.useEuiI18n)('euiTimeWindowButtons.previousDescription', 'Previous {displayInterval}', {
|
|
63
|
+
displayInterval: displayInterval
|
|
64
|
+
});
|
|
65
|
+
var zoomOutId = (0, _services.useGeneratedHtmlId)({
|
|
66
|
+
prefix: 'zoom_out'
|
|
67
|
+
});
|
|
68
|
+
var zoomOutLabel = (0, _i18n.useEuiI18n)('euiTimeWindowButtons.zoomOutLabel', 'Zoom out');
|
|
69
|
+
var zoomOutTooltipContent = isInvalid ? invalidZoomOutDescription : zoomOutLabel;
|
|
70
|
+
var nextId = (0, _services.useGeneratedHtmlId)({
|
|
71
|
+
prefix: 'next'
|
|
72
|
+
});
|
|
73
|
+
var nextLabel = (0, _i18n.useEuiI18n)('euiTimeWindowButtons.nextLabel', 'Next');
|
|
74
|
+
var nextTooltipContent = (0, _i18n.useEuiI18n)('euiTimeWindowButtons.nextDescription', 'Next {displayInterval}', {
|
|
75
|
+
displayInterval: displayInterval
|
|
76
|
+
});
|
|
77
|
+
if (!showZoomOut && !showShiftArrows) return null;
|
|
78
|
+
return (0, _react2.jsx)("div", {
|
|
79
|
+
className: "euiSuperDatePicker__timeWindowButtons",
|
|
80
|
+
css: [styles.euiButtonGroup__buttons, styles[buttonSize], ";label:EuiTimeWindowButtons;"],
|
|
81
|
+
"data-test-subj": "timeWindowButtons"
|
|
82
|
+
}, showShiftArrows && (0, _react2.jsx)(_button_group_button.EuiButtonGroupButton, {
|
|
83
|
+
id: previousId,
|
|
84
|
+
"data-test-subj": "timeWindowButtonsPrevious",
|
|
85
|
+
label: previousLabel,
|
|
86
|
+
title: "",
|
|
87
|
+
toolTipContent: !isDisabled && (isInvalid ? invalidShiftDescription : previousTooltipContent),
|
|
88
|
+
color: buttonColor,
|
|
89
|
+
size: buttonSize,
|
|
90
|
+
iconType: "arrowLeft",
|
|
91
|
+
iconSize: iconSize,
|
|
92
|
+
isIconOnly: true,
|
|
93
|
+
isSelected: false,
|
|
94
|
+
isDisabled: isDisabled,
|
|
95
|
+
onClick: stepBackward
|
|
96
|
+
}), showZoomOut && (0, _react2.jsx)(_button_group_button.EuiButtonGroupButton, {
|
|
97
|
+
id: zoomOutId,
|
|
98
|
+
"data-test-subj": "timeWindowButtonsZoomOut",
|
|
99
|
+
label: zoomOutLabel,
|
|
100
|
+
title: "",
|
|
101
|
+
toolTipContent: !isDisabled && zoomOutTooltipContent,
|
|
102
|
+
toolTipProps: {
|
|
103
|
+
disableScreenReaderOutput: zoomOutLabel === zoomOutTooltipContent
|
|
104
|
+
},
|
|
105
|
+
color: buttonColor,
|
|
106
|
+
size: buttonSize,
|
|
107
|
+
iconType: "magnifyWithMinus",
|
|
108
|
+
iconSize: iconSize,
|
|
109
|
+
isIconOnly: true,
|
|
110
|
+
isSelected: false,
|
|
111
|
+
isDisabled: isDisabled,
|
|
112
|
+
onClick: expandWindow
|
|
113
|
+
}), showShiftArrows && (0, _react2.jsx)(_button_group_button.EuiButtonGroupButton, {
|
|
114
|
+
id: nextId,
|
|
115
|
+
"data-test-subj": "timeWindowButtonsNext",
|
|
116
|
+
label: nextLabel,
|
|
117
|
+
title: "",
|
|
118
|
+
toolTipContent: !isDisabled && (isInvalid ? invalidShiftDescription : nextTooltipContent),
|
|
119
|
+
color: buttonColor,
|
|
120
|
+
size: buttonSize,
|
|
121
|
+
iconType: "arrowRight",
|
|
122
|
+
iconSize: iconSize,
|
|
123
|
+
isIconOnly: true,
|
|
124
|
+
isSelected: false,
|
|
125
|
+
isDisabled: isDisabled,
|
|
126
|
+
onClick: stepForward
|
|
127
|
+
}));
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Partly adapted from date_picker/super_date_picker/quick_select_popover/quick_select.tsx
|
|
132
|
+
*/
|
|
133
|
+
function useEuiTimeWindow(start, end, apply, options) {
|
|
134
|
+
var _options$zoomFactor;
|
|
135
|
+
var min = _datemath.default.parse(start);
|
|
136
|
+
var max = _datemath.default.parse(end, {
|
|
137
|
+
roundUp: true
|
|
138
|
+
});
|
|
139
|
+
var isInvalid = !min || !min.isValid() || !max || !max.isValid();
|
|
140
|
+
var windowDuration = isInvalid ? 1 : max.diff(min);
|
|
141
|
+
var zoomFactor = getPercentageMultiplier((_options$zoomFactor = options === null || options === void 0 ? void 0 : options.zoomFactor) !== null && _options$zoomFactor !== void 0 ? _options$zoomFactor : ZOOM_FACTOR_DEFAULT);
|
|
142
|
+
var zoomAddition = windowDuration * (zoomFactor / 2); // Gets added to each end, that's why it's split in half
|
|
143
|
+
var prettyInterval = (0, _pretty_interval.usePrettyInterval)(false, windowDuration);
|
|
144
|
+
var displayInterval = isInvalid ? '' : prettyInterval;
|
|
145
|
+
if (!isInvalid && !(0, _relative_utils.isRelativeToNow)(start, end) && !isExactMinuteRange(windowDuration)) {
|
|
146
|
+
displayInterval = "~".concat(displayInterval);
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
displayInterval: displayInterval,
|
|
150
|
+
isInvalid: isInvalid,
|
|
151
|
+
stepForward: stepForward,
|
|
152
|
+
stepBackward: stepBackward,
|
|
153
|
+
expandWindow: expandWindow
|
|
154
|
+
};
|
|
155
|
+
function stepForward() {
|
|
156
|
+
if (isInvalid) return;
|
|
157
|
+
apply({
|
|
158
|
+
start: (0, _moment.default)(max).toISOString(),
|
|
159
|
+
end: (0, _moment.default)(max).add(windowDuration, 'ms').toISOString()
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
function stepBackward() {
|
|
163
|
+
if (isInvalid) return;
|
|
164
|
+
apply({
|
|
165
|
+
start: (0, _moment.default)(min).subtract(windowDuration, 'ms').toISOString(),
|
|
166
|
+
end: (0, _moment.default)(min).toISOString()
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
function expandWindow() {
|
|
170
|
+
if (isInvalid) return;
|
|
171
|
+
apply({
|
|
172
|
+
start: (0, _moment.default)(min).subtract(zoomAddition, 'ms').toISOString(),
|
|
173
|
+
end: (0, _moment.default)(max).add(zoomAddition, 'ms').toISOString()
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Get a number out of either 0.2 or "20%"
|
|
180
|
+
*/
|
|
181
|
+
function getPercentageMultiplier(value) {
|
|
182
|
+
var result = typeof value === 'number' ? value : parseFloat(String(value).replace('%', '').trim());
|
|
183
|
+
if (isNaN(result)) throw new TypeError('Please provide a valid number or percentage string e.g. "25%"');
|
|
184
|
+
return result > 1 ? result / 100 : result;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Useful to determine whether to show the tilde in the display
|
|
189
|
+
*/
|
|
190
|
+
function isExactMinuteRange(diffMs) {
|
|
191
|
+
// 60 * 1000 = ms per minute
|
|
192
|
+
return diffMs % (60 * 1000) === 0;
|
|
193
|
+
}
|
|
@@ -116,6 +116,9 @@ EuiFacetButton.propTypes = {
|
|
|
116
116
|
* Any node, but preferably a `EuiIcon` or `EuiAvatar`
|
|
117
117
|
*/
|
|
118
118
|
icon: _propTypes.default.node,
|
|
119
|
+
/**
|
|
120
|
+
* Controls the disabled behavior via the native `disabled` attribute.
|
|
121
|
+
*/
|
|
119
122
|
isDisabled: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.bool]),
|
|
120
123
|
/**
|
|
121
124
|
* Force disables the button and changes the icon to a loading spinner
|
|
@@ -158,27 +161,14 @@ EuiFacetButton.propTypes = {
|
|
|
158
161
|
style: _propTypes.default.any,
|
|
159
162
|
type: _propTypes.default.any,
|
|
160
163
|
/**
|
|
161
|
-
*
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
* Can only be one side `left` or `right`
|
|
166
|
-
*/
|
|
167
|
-
iconSide: _propTypes.default.oneOfType([_propTypes.default.any.isRequired, _propTypes.default.oneOf([undefined])]),
|
|
168
|
-
/**
|
|
169
|
-
* Object of props passed to the `<span>` wrapping the content's text/children only (not icon)
|
|
164
|
+
* NOTE: Beta feature, may be changed or removed in the future
|
|
165
|
+
*
|
|
166
|
+
* Changes the native `disabled` attribute to `aria-disabled` to preserve focusability.
|
|
167
|
+
* This results in a semantically disabled button without the default browser handling of the disabled state.
|
|
170
168
|
*
|
|
171
|
-
*
|
|
169
|
+
* Use e.g. when a disabled button should have a tooltip.
|
|
172
170
|
*/
|
|
173
|
-
|
|
174
|
-
className: _propTypes.default.string,
|
|
175
|
-
"aria-label": _propTypes.default.string,
|
|
176
|
-
"data-test-subj": _propTypes.default.string,
|
|
177
|
-
css: _propTypes.default.any,
|
|
178
|
-
ref: _propTypes.default.any,
|
|
179
|
-
"data-text": _propTypes.default.string
|
|
180
|
-
}).isRequired, _propTypes.default.oneOf([false])]),
|
|
181
|
-
iconSize: _propTypes.default.any,
|
|
171
|
+
hasAriaDisabled: _propTypes.default.bool,
|
|
182
172
|
className: _propTypes.default.string,
|
|
183
173
|
"aria-label": _propTypes.default.string,
|
|
184
174
|
"data-test-subj": _propTypes.default.string,
|
|
@@ -234,5 +234,18 @@ EuiFilterButton.propTypes = {
|
|
|
234
234
|
* - accent
|
|
235
235
|
* - warning
|
|
236
236
|
*/
|
|
237
|
-
color: _propTypes.default.any
|
|
237
|
+
color: _propTypes.default.any,
|
|
238
|
+
/**
|
|
239
|
+
* Controls the disabled behavior via the native `disabled` attribute.
|
|
240
|
+
*/
|
|
241
|
+
isDisabled: _propTypes.default.bool,
|
|
242
|
+
/**
|
|
243
|
+
* NOTE: Beta feature, may be changed or removed in the future
|
|
244
|
+
*
|
|
245
|
+
* Changes the native `disabled` attribute to `aria-disabled` to preserve focusability.
|
|
246
|
+
* This results in a semantically disabled button without the default browser handling of the disabled state.
|
|
247
|
+
*
|
|
248
|
+
* Use e.g. when a disabled button should have a tooltip.
|
|
249
|
+
*/
|
|
250
|
+
hasAriaDisabled: _propTypes.default.bool
|
|
238
251
|
};
|
|
@@ -231,20 +231,28 @@ var EuiFlyout = exports.EuiFlyout = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
231
231
|
}
|
|
232
232
|
return selectors;
|
|
233
233
|
}, [includeSelectorInFocusTrap, includeFixedHeadersInFocusTrap]);
|
|
234
|
-
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Finds the shards to include in the focus trap by querying by `focusTrapSelectors`.
|
|
237
|
+
*
|
|
238
|
+
* @param shouldAutoFocus Whether to auto-focus the flyout wrapper when the focus trap is activated.
|
|
239
|
+
* This is necessary because when a flyout is toggled from within a shard, the focus trap's `autoFocus`
|
|
240
|
+
* feature doesn't work. This logic manually focuses the flyout as a workaround.
|
|
241
|
+
*/
|
|
242
|
+
var findShards = (0, _react.useCallback)(function () {
|
|
243
|
+
var shouldAutoFocus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
235
244
|
if (focusTrapSelectors.length > 0) {
|
|
236
245
|
var shardsEls = focusTrapSelectors.flatMap(function (selector) {
|
|
237
246
|
return Array.from(document.querySelectorAll(selector));
|
|
238
247
|
});
|
|
239
248
|
setFocusTrapShards(Array.from(shardsEls));
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
});
|
|
249
|
+
if (shouldAutoFocus) {
|
|
250
|
+
shardsEls.forEach(function (shard) {
|
|
251
|
+
if (shard.contains(flyoutToggle.current)) {
|
|
252
|
+
resizeRef === null || resizeRef === void 0 || resizeRef.focus();
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
}
|
|
248
256
|
} else {
|
|
249
257
|
// Clear existing shards if necessary, e.g. switching to `false`
|
|
250
258
|
setFocusTrapShards(function (shards) {
|
|
@@ -252,6 +260,15 @@ var EuiFlyout = exports.EuiFlyout = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
252
260
|
});
|
|
253
261
|
}
|
|
254
262
|
}, [focusTrapSelectors, resizeRef]);
|
|
263
|
+
(0, _react.useEffect)(function () {
|
|
264
|
+
// Auto-focus should only happen on initial flyout mount (or when the dependencies change)
|
|
265
|
+
// because it snaps focus to the flyout wrapper, which steals it from subsequently focused elements.
|
|
266
|
+
findShards(true);
|
|
267
|
+
var unsubscribe = _services.focusTrapPubSub.subscribe(function () {
|
|
268
|
+
return findShards();
|
|
269
|
+
});
|
|
270
|
+
return unsubscribe;
|
|
271
|
+
}, [findShards]);
|
|
255
272
|
var focusTrapProps = (0, _react.useMemo)(function () {
|
|
256
273
|
return _objectSpread(_objectSpread({}, _focusTrapProps), {}, {
|
|
257
274
|
shards: [].concat(_toConsumableArray(focusTrapShards), _toConsumableArray((_focusTrapProps === null || _focusTrapProps === void 0 ? void 0 : _focusTrapProps.shards) || []))
|
|
@@ -108,13 +108,6 @@ EuiFormControlButton.propTypes = {
|
|
|
108
108
|
fullWidth: _propTypes.default.bool,
|
|
109
109
|
href: _propTypes.default.string,
|
|
110
110
|
onClick: _propTypes.default.func,
|
|
111
|
-
/**
|
|
112
|
-
* `disabled` is also allowed
|
|
113
|
-
*/
|
|
114
|
-
/**
|
|
115
|
-
* `disabled` is also allowed
|
|
116
|
-
*/
|
|
117
|
-
isDisabled: _propTypes.default.bool,
|
|
118
111
|
target: _propTypes.default.string,
|
|
119
112
|
rel: _propTypes.default.string,
|
|
120
113
|
type: _propTypes.default.any,
|
|
@@ -153,10 +146,23 @@ EuiFormControlButton.propTypes = {
|
|
|
153
146
|
"data-text": _propTypes.default.string
|
|
154
147
|
}).isRequired, _propTypes.default.oneOf([false])]),
|
|
155
148
|
iconSize: _propTypes.default.any,
|
|
149
|
+
/**
|
|
150
|
+
* Controls the disabled behavior via the native `disabled` attribute.
|
|
151
|
+
*/
|
|
152
|
+
isDisabled: _propTypes.default.bool,
|
|
156
153
|
className: _propTypes.default.string,
|
|
157
154
|
"aria-label": _propTypes.default.string,
|
|
158
155
|
"data-test-subj": _propTypes.default.string,
|
|
159
156
|
css: _propTypes.default.any,
|
|
157
|
+
/**
|
|
158
|
+
* NOTE: Beta feature, may be changed or removed in the future
|
|
159
|
+
*
|
|
160
|
+
* Changes the native `disabled` attribute to `aria-disabled` to preserve focusability.
|
|
161
|
+
* This results in a semantically disabled button without the default browser handling of the disabled state.
|
|
162
|
+
*
|
|
163
|
+
* Use e.g. when a disabled button should have a tooltip.
|
|
164
|
+
*/
|
|
165
|
+
hasAriaDisabled: _propTypes.default.bool,
|
|
160
166
|
/**
|
|
161
167
|
* Defines the button label when used like an input in combination with `placeholder`
|
|
162
168
|
*/
|
|
@@ -39,13 +39,6 @@ var EuiHeaderLink = exports.EuiHeaderLink = function EuiHeaderLink(_ref) {
|
|
|
39
39
|
EuiHeaderLink.propTypes = {
|
|
40
40
|
href: _propTypes.default.string,
|
|
41
41
|
onClick: _propTypes.default.func,
|
|
42
|
-
/**
|
|
43
|
-
* `disabled` is also allowed
|
|
44
|
-
*/
|
|
45
|
-
/**
|
|
46
|
-
* `disabled` is also allowed
|
|
47
|
-
*/
|
|
48
|
-
isDisabled: _propTypes.default.bool,
|
|
49
42
|
target: _propTypes.default.string,
|
|
50
43
|
rel: _propTypes.default.string,
|
|
51
44
|
type: _propTypes.default.any,
|
|
@@ -84,10 +77,23 @@ EuiHeaderLink.propTypes = {
|
|
|
84
77
|
"data-text": _propTypes.default.string
|
|
85
78
|
}).isRequired, _propTypes.default.oneOf([false])]),
|
|
86
79
|
iconSize: _propTypes.default.any,
|
|
80
|
+
/**
|
|
81
|
+
* Controls the disabled behavior via the native `disabled` attribute.
|
|
82
|
+
*/
|
|
83
|
+
isDisabled: _propTypes.default.bool,
|
|
87
84
|
className: _propTypes.default.string,
|
|
88
85
|
"aria-label": _propTypes.default.string,
|
|
89
86
|
"data-test-subj": _propTypes.default.string,
|
|
90
87
|
css: _propTypes.default.any,
|
|
88
|
+
/**
|
|
89
|
+
* NOTE: Beta feature, may be changed or removed in the future
|
|
90
|
+
*
|
|
91
|
+
* Changes the native `disabled` attribute to `aria-disabled` to preserve focusability.
|
|
92
|
+
* This results in a semantically disabled button without the default browser handling of the disabled state.
|
|
93
|
+
*
|
|
94
|
+
* Use e.g. when a disabled button should have a tooltip.
|
|
95
|
+
*/
|
|
96
|
+
hasAriaDisabled: _propTypes.default.bool,
|
|
91
97
|
/**
|
|
92
98
|
* Simple prop to update color based on active state.
|
|
93
99
|
* Can be overridden with `color`
|