@elastic/eui 108.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/basic_table/collapsed_item_actions.js +3 -1
- package/es/components/basic_table/default_item_action.js +7 -4
- 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 +16 -5
- 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/column_actions.js +5 -21
- package/es/components/datagrid/body/header/data_grid_header_cell.js +29 -10
- package/es/components/datagrid/body/header/data_grid_header_cell.styles.js +8 -2
- package/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +5 -2
- 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/file_picker/file_picker.styles.js +3 -3
- 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/paper_clip.js +1 -1
- package/es/components/icon/assets/streams_wired.js +3 -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/services/theme/high_contrast_overrides.js +5 -1
- 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 +604 -183
- package/i18ntokens.json +1357 -1231
- package/lib/components/accessibility/skip_link/skip_link.js +10 -1
- package/lib/components/basic_table/collapsed_item_actions.js +3 -1
- package/lib/components/basic_table/default_item_action.js +7 -4
- 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 +16 -5
- 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/column_actions.js +5 -21
- package/lib/components/datagrid/body/header/data_grid_header_cell.js +29 -10
- package/lib/components/datagrid/body/header/data_grid_header_cell.styles.js +8 -1
- package/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +5 -2
- 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/file_picker/file_picker.styles.js +3 -3
- 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/paper_clip.js +1 -1
- package/lib/components/icon/assets/streams_wired.js +3 -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/paper_clip.svg +3 -3
- 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/services/theme/high_contrast_overrides.js +5 -1
- 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/basic_table/collapsed_item_actions.js +3 -1
- package/optimize/es/components/basic_table/default_item_action.js +7 -4
- 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 +2 -3
- 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/body/header/column_actions.js +5 -21
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell.js +6 -4
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell.styles.js +8 -2
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +4 -2
- 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/form/file_picker/file_picker.styles.js +3 -3
- 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/paper_clip.js +1 -1
- package/optimize/es/components/icon/assets/streams_wired.js +3 -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/services/theme/high_contrast_overrides.js +5 -1
- 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/basic_table/collapsed_item_actions.js +3 -1
- package/optimize/lib/components/basic_table/default_item_action.js +7 -4
- 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 +2 -3
- 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/body/header/column_actions.js +5 -21
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.js +6 -4
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.styles.js +8 -1
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +4 -2
- 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/form/file_picker/file_picker.styles.js +3 -3
- 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/paper_clip.js +1 -1
- package/optimize/lib/components/icon/assets/streams_wired.js +3 -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/paper_clip.svg +3 -3
- 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/services/theme/high_contrast_overrides.js +5 -1
- 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 +6 -5
- package/test-env/components/accessibility/skip_link/skip_link.js +10 -1
- package/test-env/components/basic_table/collapsed_item_actions.js +3 -1
- package/test-env/components/basic_table/default_item_action.js +7 -4
- 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 +16 -5
- 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/column_actions.js +5 -21
- package/test-env/components/datagrid/body/header/data_grid_header_cell.js +29 -10
- package/test-env/components/datagrid/body/header/data_grid_header_cell.styles.js +8 -1
- package/test-env/components/datagrid/body/header/data_grid_header_cell_wrapper.js +5 -2
- 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/file_picker/file_picker.styles.js +3 -3
- 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/paper_clip.js +1 -1
- package/test-env/components/icon/assets/streams_wired.js +3 -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/services/theme/high_contrast_overrides.js +5 -1
- 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,98 @@
|
|
|
1
|
+
var _excluded = ["timeZone", "customRender", "date"];
|
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
4
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
|
|
5
|
+
/*
|
|
6
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
7
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
8
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
9
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
10
|
+
* Side Public License, v 1.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import { euiTimeZoneDisplayStyles } from './timezone_display.styles';
|
|
15
|
+
import { useEuiMemoizedStyles } from '../../../../services';
|
|
16
|
+
import { EuiFlexGroup } from '../../../flex';
|
|
17
|
+
import { EuiIcon } from '../../../icon';
|
|
18
|
+
import { EuiText } from '../../../text';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Available elements to render passed to the
|
|
22
|
+
* `customRender` render function.
|
|
23
|
+
*/
|
|
24
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
25
|
+
/**
|
|
26
|
+
* Display time zone information.
|
|
27
|
+
*/
|
|
28
|
+
export var EuiTimeZoneDisplay = function EuiTimeZoneDisplay(_ref) {
|
|
29
|
+
var timeZone = _ref.timeZone,
|
|
30
|
+
customRender = _ref.customRender,
|
|
31
|
+
date = _ref.date,
|
|
32
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
33
|
+
var color = 'subdued';
|
|
34
|
+
var styles = useEuiMemoizedStyles(euiTimeZoneDisplayStyles);
|
|
35
|
+
var referenceDate = date ? date.toDate() : undefined;
|
|
36
|
+
var _useEuiUTCOffsetDispl = useEuiUTCOffsetDisplay(timeZone !== null && timeZone !== void 0 ? timeZone : 'Browser', referenceDate),
|
|
37
|
+
utc = _useEuiUTCOffsetDispl.utc,
|
|
38
|
+
name = _useEuiUTCOffsetDispl.name,
|
|
39
|
+
isInvalid = _useEuiUTCOffsetDispl.isInvalid;
|
|
40
|
+
if (!timeZone || isInvalid) return null;
|
|
41
|
+
var label = !name ? utc : "".concat(utc, " (").concat(name, ")");
|
|
42
|
+
var nameDisplay = ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiIcon, {
|
|
43
|
+
type: "globe",
|
|
44
|
+
color: color
|
|
45
|
+
}), ___EmotionJSX(EuiText, {
|
|
46
|
+
component: "span",
|
|
47
|
+
color: color,
|
|
48
|
+
size: "s"
|
|
49
|
+
}, label));
|
|
50
|
+
return ___EmotionJSX(EuiFlexGroup, _extends({
|
|
51
|
+
css: styles.euiTimeZoneDisplay,
|
|
52
|
+
alignItems: "center",
|
|
53
|
+
gutterSize: "xs",
|
|
54
|
+
"data-test-subj": "euiTimeZoneDisplay",
|
|
55
|
+
"aria-label": label
|
|
56
|
+
}, rest), typeof customRender === 'function' ? customRender({
|
|
57
|
+
nameDisplay: nameDisplay
|
|
58
|
+
}) : nameDisplay);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Get the UTC offset display in hours e.g. "UTC+2" from time zone name.
|
|
63
|
+
*
|
|
64
|
+
* @param timeZoneName IANA time zone name
|
|
65
|
+
* @param [date] Reference date to get offset with Intl.DateTimeFormat
|
|
66
|
+
*/
|
|
67
|
+
export function useEuiUTCOffsetDisplay(timeZoneName, date) {
|
|
68
|
+
try {
|
|
69
|
+
var _formattedParts$find;
|
|
70
|
+
if (timeZoneName === 'UTC') {
|
|
71
|
+
return {
|
|
72
|
+
utc: 'UTC',
|
|
73
|
+
name: '',
|
|
74
|
+
isInvalid: false
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
var ianaName = timeZoneName === 'Browser' ? new Intl.DateTimeFormat().resolvedOptions().timeZone : timeZoneName;
|
|
78
|
+
var formatter = new Intl.DateTimeFormat(undefined, {
|
|
79
|
+
timeZone: ianaName,
|
|
80
|
+
timeZoneName: 'shortOffset'
|
|
81
|
+
});
|
|
82
|
+
var formattedParts = formatter.formatToParts(date !== null && date !== void 0 ? date : new Date());
|
|
83
|
+
var timeZoneNamePart = ((_formattedParts$find = formattedParts.find(function (part) {
|
|
84
|
+
return part.type === 'timeZoneName';
|
|
85
|
+
})) === null || _formattedParts$find === void 0 ? void 0 : _formattedParts$find.value) || '';
|
|
86
|
+
return {
|
|
87
|
+
utc: timeZoneNamePart.replace('GMT', 'UTC'),
|
|
88
|
+
name: ianaName,
|
|
89
|
+
isInvalid: false
|
|
90
|
+
};
|
|
91
|
+
} catch (err) {
|
|
92
|
+
return {
|
|
93
|
+
utc: '',
|
|
94
|
+
name: timeZoneName,
|
|
95
|
+
isInvalid: true
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { css } from '@emotion/react';
|
|
10
|
+
import { logicalCSS } from '../../../../global_styling';
|
|
11
|
+
export var euiTimeZoneDisplayStyles = function euiTimeZoneDisplayStyles(euiThemeContext) {
|
|
12
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
13
|
+
|
|
14
|
+
// This padding should probably not be part of this component to make it really reusable
|
|
15
|
+
|
|
16
|
+
return {
|
|
17
|
+
euiTimeZoneDisplay: /*#__PURE__*/css(logicalCSS('padding-horizontal', euiTheme.size.s), " ", logicalCSS('padding-bottom', euiTheme.size.s), ";;label:euiTimeZoneDisplay;")
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -11,7 +11,7 @@ import dateMath from '@elastic/datemath';
|
|
|
11
11
|
import moment from 'moment'; // eslint-disable-line import/named
|
|
12
12
|
import { useEuiI18n } from '../../i18n';
|
|
13
13
|
import { getDateMode, DATE_MODES } from './date_modes';
|
|
14
|
-
import { parseRelativeParts } from './relative_utils';
|
|
14
|
+
import { parseRelativeParts, isRelativeToNow } from './relative_utils';
|
|
15
15
|
import { useI18nTimeOptions } from './time_options';
|
|
16
16
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
17
17
|
/**
|
|
@@ -272,13 +272,6 @@ var hasRangeMatch = function hasRangeMatch(timeFrom, timeTo, ranges) {
|
|
|
272
272
|
return timeFrom === start && timeTo === end;
|
|
273
273
|
});
|
|
274
274
|
};
|
|
275
|
-
var isRelativeToNow = function isRelativeToNow(timeFrom, timeTo) {
|
|
276
|
-
var fromDateMode = getDateMode(timeFrom);
|
|
277
|
-
var toDateMode = getDateMode(timeTo);
|
|
278
|
-
var isLast = fromDateMode === DATE_MODES.RELATIVE && toDateMode === DATE_MODES.NOW;
|
|
279
|
-
var isNext = fromDateMode === DATE_MODES.NOW && toDateMode === DATE_MODES.RELATIVE;
|
|
280
|
-
return isLast || isNext;
|
|
281
|
-
};
|
|
282
275
|
export var showPrettyDuration = function showPrettyDuration(timeFrom, timeTo, quickRanges) {
|
|
283
276
|
if (hasRangeMatch(timeFrom, timeTo, quickRanges)) {
|
|
284
277
|
return true;
|
|
@@ -16,6 +16,7 @@ import dateMath from '@elastic/datemath';
|
|
|
16
16
|
import moment from 'moment';
|
|
17
17
|
import { get } from '../../../services/objects';
|
|
18
18
|
import { isString } from '../../../services/predicate';
|
|
19
|
+
import { getDateMode, DATE_MODES } from './date_modes';
|
|
19
20
|
var ROUND_DELIMETER = '/';
|
|
20
21
|
export var relativeUnitsFromLargestToSmallest = ['y', 'M', 'w', 'd', 'h', 'm', 's'];
|
|
21
22
|
export function parseRelativeParts(value) {
|
|
@@ -65,4 +66,11 @@ export var toRelativeStringFromParts = function toRelativeStringFromParts(relati
|
|
|
65
66
|
var operator = matches && matches[2] ? matches[2] : '-';
|
|
66
67
|
var round = isRounded ? "".concat(ROUND_DELIMETER).concat(unit) : '';
|
|
67
68
|
return "now".concat(operator).concat(count).concat(unit).concat(round);
|
|
69
|
+
};
|
|
70
|
+
export var isRelativeToNow = function isRelativeToNow(timeFrom, timeTo) {
|
|
71
|
+
var fromDateMode = getDateMode(timeFrom);
|
|
72
|
+
var toDateMode = getDateMode(timeTo);
|
|
73
|
+
var isLast = fromDateMode === DATE_MODES.RELATIVE && toDateMode === DATE_MODES.NOW;
|
|
74
|
+
var isNext = fromDateMode === DATE_MODES.NOW && toDateMode === DATE_MODES.RELATIVE;
|
|
75
|
+
return isLast || isNext;
|
|
68
76
|
};
|
|
@@ -38,6 +38,7 @@ import { EuiDatePickerRange } from '../date_picker_range';
|
|
|
38
38
|
import { EuiFormControlButton, EuiFormControlLayout } from '../../form';
|
|
39
39
|
import { RenderI18nTimeOptions } from './time_options';
|
|
40
40
|
import { PrettyDuration, showPrettyDuration } from './pretty_duration';
|
|
41
|
+
import { EuiTimeWindowButtons } from './time_window_buttons';
|
|
41
42
|
import { AsyncInterval } from './async_interval';
|
|
42
43
|
import { EuiSuperUpdateButton } from './super_update_button';
|
|
43
44
|
import { EuiQuickSelectPopover } from './quick_select_popover/quick_select_popover';
|
|
@@ -276,7 +277,9 @@ export var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
276
277
|
maxDate = _this$props3.maxDate,
|
|
277
278
|
compressed = _this$props3.compressed,
|
|
278
279
|
onFocus = _this$props3.onFocus,
|
|
279
|
-
styles = _this$props3.memoizedStyles
|
|
280
|
+
styles = _this$props3.memoizedStyles,
|
|
281
|
+
_this$props3$timeZone = _this$props3.timeZoneDisplayProps,
|
|
282
|
+
timeZoneDisplayProps = _this$props3$timeZone === void 0 ? {} : _this$props3$timeZone;
|
|
280
283
|
var autoRefreshAppend = !isPaused ? ___EmotionJSX(EuiAutoRefreshButton, {
|
|
281
284
|
refreshInterval: refreshInterval,
|
|
282
285
|
minInterval: refreshMinInterval,
|
|
@@ -353,7 +356,8 @@ export var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
353
356
|
timeOptions: timeOptions,
|
|
354
357
|
buttonProps: {
|
|
355
358
|
onFocus: onFocus
|
|
356
|
-
}
|
|
359
|
+
},
|
|
360
|
+
timeZoneDisplayProps: timeZoneDisplayProps
|
|
357
361
|
}),
|
|
358
362
|
endDateControl: isQuickSelectOnly ? undefined : ___EmotionJSX(EuiDatePopoverButton, {
|
|
359
363
|
css: styles.euiSuperDatePicker__rangeInput,
|
|
@@ -378,7 +382,8 @@ export var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
378
382
|
timeOptions: timeOptions,
|
|
379
383
|
buttonProps: {
|
|
380
384
|
onFocus: onFocus
|
|
381
|
-
}
|
|
385
|
+
},
|
|
386
|
+
timeZoneDisplayProps: timeZoneDisplayProps
|
|
382
387
|
})
|
|
383
388
|
}));
|
|
384
389
|
});
|
|
@@ -398,13 +403,32 @@ export var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
398
403
|
_this.applyTime();
|
|
399
404
|
}
|
|
400
405
|
});
|
|
401
|
-
_defineProperty(_this, "
|
|
406
|
+
_defineProperty(_this, "renderTimeWindowButtons", function () {
|
|
407
|
+
if (!_this.props.showTimeWindowButtons || _this.props.isAutoRefreshOnly) {
|
|
408
|
+
return null;
|
|
409
|
+
}
|
|
402
410
|
var _this$props5 = _this.props,
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
411
|
+
start = _this$props5.start,
|
|
412
|
+
end = _this$props5.end,
|
|
413
|
+
showTimeWindowButtons = _this$props5.showTimeWindowButtons,
|
|
414
|
+
compressed = _this$props5.compressed,
|
|
415
|
+
isDisabled = _this$props5.isDisabled;
|
|
416
|
+
var config = typeof showTimeWindowButtons === 'boolean' ? {} : showTimeWindowButtons;
|
|
417
|
+
return ___EmotionJSX(EuiTimeWindowButtons, _extends({
|
|
418
|
+
applyTime: _this.applyQuickTime,
|
|
419
|
+
start: start,
|
|
420
|
+
end: end,
|
|
421
|
+
compressed: compressed,
|
|
422
|
+
isDisabled: !!isDisabled || _this.state.isInvalid
|
|
423
|
+
}, config));
|
|
424
|
+
});
|
|
425
|
+
_defineProperty(_this, "renderUpdateButton", function () {
|
|
426
|
+
var _this$props6 = _this.props,
|
|
427
|
+
isLoading = _this$props6.isLoading,
|
|
428
|
+
isDisabled = _this$props6.isDisabled,
|
|
429
|
+
updateButtonProps = _this$props6.updateButtonProps,
|
|
430
|
+
showUpdateButton = _this$props6.showUpdateButton,
|
|
431
|
+
compressed = _this$props6.compressed;
|
|
408
432
|
if (!showUpdateButton) return null;
|
|
409
433
|
return ___EmotionJSX(EuiSuperUpdateButton, _extends({
|
|
410
434
|
needsUpdate: _this.state.hasChanged,
|
|
@@ -423,21 +447,21 @@ export var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
423
447
|
return _createClass(EuiSuperDatePickerInternal, [{
|
|
424
448
|
key: "render",
|
|
425
449
|
value: function render() {
|
|
426
|
-
var _this$
|
|
427
|
-
isAutoRefreshOnly = _this$
|
|
428
|
-
isDisabled = _this$
|
|
429
|
-
isPaused = _this$
|
|
430
|
-
onRefreshChange = _this$
|
|
431
|
-
refreshInterval = _this$
|
|
432
|
-
refreshMinInterval = _this$
|
|
433
|
-
refreshIntervalUnits = _this$
|
|
434
|
-
showUpdateButton = _this$
|
|
435
|
-
dataTestSubj = _this$
|
|
436
|
-
_width = _this$
|
|
437
|
-
isQuickSelectOnly = _this$
|
|
438
|
-
compressed = _this$
|
|
439
|
-
className = _this$
|
|
440
|
-
styles = _this$
|
|
450
|
+
var _this$props7 = this.props,
|
|
451
|
+
isAutoRefreshOnly = _this$props7.isAutoRefreshOnly,
|
|
452
|
+
isDisabled = _this$props7.isDisabled,
|
|
453
|
+
isPaused = _this$props7.isPaused,
|
|
454
|
+
onRefreshChange = _this$props7.onRefreshChange,
|
|
455
|
+
refreshInterval = _this$props7.refreshInterval,
|
|
456
|
+
refreshMinInterval = _this$props7.refreshMinInterval,
|
|
457
|
+
refreshIntervalUnits = _this$props7.refreshIntervalUnits,
|
|
458
|
+
showUpdateButton = _this$props7.showUpdateButton,
|
|
459
|
+
dataTestSubj = _this$props7['data-test-subj'],
|
|
460
|
+
_width = _this$props7.width,
|
|
461
|
+
isQuickSelectOnly = _this$props7.isQuickSelectOnly,
|
|
462
|
+
compressed = _this$props7.compressed,
|
|
463
|
+
className = _this$props7.className,
|
|
464
|
+
styles = _this$props7.memoizedStyles;
|
|
441
465
|
var _this$state2 = this.state,
|
|
442
466
|
hasChanged = _this$state2.hasChanged,
|
|
443
467
|
isInvalid = _this$state2.isInvalid;
|
|
@@ -462,7 +486,7 @@ export var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
462
486
|
compressed: compressed,
|
|
463
487
|
isDisabled: !!isDisabled,
|
|
464
488
|
className: className
|
|
465
|
-
}) : ___EmotionJSX(React.Fragment, null, this.renderDatePickerRange(), this.renderUpdateButton()));
|
|
489
|
+
}) : ___EmotionJSX(React.Fragment, null, this.renderDatePickerRange(), this.renderTimeWindowButtons(), this.renderUpdateButton()));
|
|
466
490
|
}
|
|
467
491
|
}], [{
|
|
468
492
|
key: "getDerivedStateFromProps",
|
|
@@ -627,6 +651,28 @@ EuiSuperDatePickerInternal.propTypes = {
|
|
|
627
651
|
* @default true
|
|
628
652
|
*/
|
|
629
653
|
showUpdateButton: PropTypes.oneOfType([PropTypes.bool.isRequired, PropTypes.oneOf(["iconOnly"])]),
|
|
654
|
+
/**
|
|
655
|
+
* Set to true to display buttons for time shifting and zooming out,
|
|
656
|
+
* next to the top-level control.
|
|
657
|
+
*/
|
|
658
|
+
showTimeWindowButtons: PropTypes.oneOfType([PropTypes.bool.isRequired, PropTypes.shape({
|
|
659
|
+
/**
|
|
660
|
+
* Show button for zooming out
|
|
661
|
+
* @default true
|
|
662
|
+
*/
|
|
663
|
+
showZoomOut: PropTypes.bool,
|
|
664
|
+
/**
|
|
665
|
+
* Show buttons for shifting the time window forward and backward
|
|
666
|
+
* @default true
|
|
667
|
+
*/
|
|
668
|
+
showShiftArrows: PropTypes.bool,
|
|
669
|
+
/**
|
|
670
|
+
* How much the time window is increased when zooming.
|
|
671
|
+
* A number between 0 and 1 e.g. 0.25, or a string representing a percentage e.g. 25%
|
|
672
|
+
* @default 0.5
|
|
673
|
+
* */
|
|
674
|
+
zoomFactor: PropTypes.oneOfType([PropTypes.number.isRequired, PropTypes.string.isRequired])
|
|
675
|
+
}).isRequired]),
|
|
630
676
|
/**
|
|
631
677
|
* Hides the actual input reducing to just the quick select button.
|
|
632
678
|
*/
|
|
@@ -673,6 +719,31 @@ EuiSuperDatePickerInternal.propTypes = {
|
|
|
673
719
|
* input by the user, set this flag to `false`.
|
|
674
720
|
*/
|
|
675
721
|
canRoundRelativeUnits: PropTypes.bool,
|
|
722
|
+
/**
|
|
723
|
+
* Props passed to the time zone display in the popovers {@link EuiTimeZoneDisplayProps}
|
|
724
|
+
*
|
|
725
|
+
* Setting `timeZoneDisplayProps.timeZone` with a valid time zone name will make
|
|
726
|
+
* the time zone information be visible below the start and end input fields.
|
|
727
|
+
* This is informational only, it will not affect how date/times are handled.
|
|
728
|
+
*/
|
|
729
|
+
timeZoneDisplayProps: PropTypes.shape({
|
|
730
|
+
/**
|
|
731
|
+
* A valid time zone name, from the IANA database, e.g. "America/Los_Angeles".
|
|
732
|
+
*
|
|
733
|
+
* @link https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
|
734
|
+
*/
|
|
735
|
+
timeZone: PropTypes.string,
|
|
736
|
+
/**
|
|
737
|
+
* Render prop function to add additional content to the time zone display.
|
|
738
|
+
* Useful for e.g. adding links to documentation or setting pages.
|
|
739
|
+
*/
|
|
740
|
+
customRender: PropTypes.func,
|
|
741
|
+
/**
|
|
742
|
+
* Reference date to be used while resolving the UTC offset.
|
|
743
|
+
* Only useful for edge cases involving daylight saving time.
|
|
744
|
+
*/
|
|
745
|
+
date: PropTypes.any
|
|
746
|
+
}),
|
|
676
747
|
memoizedStyles: PropTypes.any.isRequired,
|
|
677
748
|
timeOptions: PropTypes.shape({
|
|
678
749
|
timeTenseOptions: PropTypes.arrayOf(PropTypes.any.isRequired).isRequired,
|
|
@@ -822,6 +893,15 @@ EuiSuperDatePicker.propTypes = {
|
|
|
822
893
|
* @default true
|
|
823
894
|
*/
|
|
824
895
|
showUpdateButton: PropTypes.oneOfType([PropTypes.bool.isRequired, PropTypes.oneOf(["iconOnly"])]),
|
|
896
|
+
/**
|
|
897
|
+
* Set to true to display buttons for time shifting and zooming out,
|
|
898
|
+
* next to the top-level control.
|
|
899
|
+
*/
|
|
900
|
+
showTimeWindowButtons: PropTypes.oneOfType([PropTypes.bool.isRequired, PropTypes.shape({
|
|
901
|
+
showZoomOut: PropTypes.bool,
|
|
902
|
+
showShiftArrows: PropTypes.bool,
|
|
903
|
+
zoomFactor: PropTypes.oneOfType([PropTypes.number.isRequired, PropTypes.string.isRequired])
|
|
904
|
+
}).isRequired]),
|
|
825
905
|
/**
|
|
826
906
|
* Hides the actual input reducing to just the quick select button.
|
|
827
907
|
*/
|
|
@@ -847,5 +927,17 @@ EuiSuperDatePicker.propTypes = {
|
|
|
847
927
|
* If you do not want this behavior and instead wish to keep the exact units
|
|
848
928
|
* input by the user, set this flag to `false`.
|
|
849
929
|
*/
|
|
850
|
-
canRoundRelativeUnits: PropTypes.bool
|
|
930
|
+
canRoundRelativeUnits: PropTypes.bool,
|
|
931
|
+
/**
|
|
932
|
+
* Props passed to the time zone display in the popovers {@link EuiTimeZoneDisplayProps}
|
|
933
|
+
*
|
|
934
|
+
* Setting `timeZoneDisplayProps.timeZone` with a valid time zone name will make
|
|
935
|
+
* the time zone information be visible below the start and end input fields.
|
|
936
|
+
* This is informational only, it will not affect how date/times are handled.
|
|
937
|
+
*/
|
|
938
|
+
timeZoneDisplayProps: PropTypes.shape({
|
|
939
|
+
timeZone: PropTypes.string,
|
|
940
|
+
customRender: PropTypes.func,
|
|
941
|
+
date: PropTypes.any
|
|
942
|
+
})
|
|
851
943
|
};
|
|
@@ -0,0 +1,185 @@
|
|
|
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 React from 'react';
|
|
10
|
+
import dateMath from '@elastic/datemath';
|
|
11
|
+
import moment from 'moment';
|
|
12
|
+
import { usePrettyInterval } from './pretty_interval';
|
|
13
|
+
import { isRelativeToNow } from './relative_utils';
|
|
14
|
+
import { EuiButtonGroupButton } from '../../button/button_group/button_group_button';
|
|
15
|
+
import { euiButtonGroupButtonsStyles } from '../../button/button_group/button_group.styles';
|
|
16
|
+
import { useEuiMemoizedStyles, useGeneratedHtmlId } from '../../../services';
|
|
17
|
+
import { useEuiI18n } from '../../i18n';
|
|
18
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
19
|
+
export var ZOOM_FACTOR_DEFAULT = 0.5;
|
|
20
|
+
/**
|
|
21
|
+
* Button group with time window controls for shifting the time window
|
|
22
|
+
* forwards and backwards, and zooming out.
|
|
23
|
+
*/
|
|
24
|
+
export var EuiTimeWindowButtons = function EuiTimeWindowButtons(_ref) {
|
|
25
|
+
var applyTime = _ref.applyTime,
|
|
26
|
+
start = _ref.start,
|
|
27
|
+
end = _ref.end,
|
|
28
|
+
compressed = _ref.compressed,
|
|
29
|
+
isDisabled = _ref.isDisabled,
|
|
30
|
+
_ref$showZoomOut = _ref.showZoomOut,
|
|
31
|
+
showZoomOut = _ref$showZoomOut === void 0 ? true : _ref$showZoomOut,
|
|
32
|
+
_ref$showShiftArrows = _ref.showShiftArrows,
|
|
33
|
+
showShiftArrows = _ref$showShiftArrows === void 0 ? true : _ref$showShiftArrows,
|
|
34
|
+
_ref$zoomFactor = _ref.zoomFactor,
|
|
35
|
+
zoomFactor = _ref$zoomFactor === void 0 ? ZOOM_FACTOR_DEFAULT : _ref$zoomFactor;
|
|
36
|
+
var buttonColor = 'text';
|
|
37
|
+
var buttonSize = compressed ? 's' : 'm';
|
|
38
|
+
var iconSize = compressed ? 's' : 'm';
|
|
39
|
+
var styles = useEuiMemoizedStyles(euiButtonGroupButtonsStyles);
|
|
40
|
+
var _useEuiTimeWindow = useEuiTimeWindow(start, end, applyTime, {
|
|
41
|
+
zoomFactor: zoomFactor
|
|
42
|
+
}),
|
|
43
|
+
displayInterval = _useEuiTimeWindow.displayInterval,
|
|
44
|
+
isInvalid = _useEuiTimeWindow.isInvalid,
|
|
45
|
+
stepForward = _useEuiTimeWindow.stepForward,
|
|
46
|
+
stepBackward = _useEuiTimeWindow.stepBackward,
|
|
47
|
+
expandWindow = _useEuiTimeWindow.expandWindow;
|
|
48
|
+
var invalidShiftDescription = useEuiI18n('euiTimeWindowButtons.invalidShiftLabel', 'Cannot shift invalid time window');
|
|
49
|
+
var invalidZoomOutDescription = useEuiI18n('euiTimeWindowButtons.invalidZoomOutLabel', 'Cannot zoom out invalid time window');
|
|
50
|
+
var previousId = useGeneratedHtmlId({
|
|
51
|
+
prefix: 'previous'
|
|
52
|
+
});
|
|
53
|
+
var previousLabel = useEuiI18n('euiTimeWindowButtons.previousLabel', 'Previous');
|
|
54
|
+
var previousTooltipContent = useEuiI18n('euiTimeWindowButtons.previousDescription', 'Previous {displayInterval}', {
|
|
55
|
+
displayInterval: displayInterval
|
|
56
|
+
});
|
|
57
|
+
var zoomOutId = useGeneratedHtmlId({
|
|
58
|
+
prefix: 'zoom_out'
|
|
59
|
+
});
|
|
60
|
+
var zoomOutLabel = useEuiI18n('euiTimeWindowButtons.zoomOutLabel', 'Zoom out');
|
|
61
|
+
var zoomOutTooltipContent = isInvalid ? invalidZoomOutDescription : zoomOutLabel;
|
|
62
|
+
var nextId = useGeneratedHtmlId({
|
|
63
|
+
prefix: 'next'
|
|
64
|
+
});
|
|
65
|
+
var nextLabel = useEuiI18n('euiTimeWindowButtons.nextLabel', 'Next');
|
|
66
|
+
var nextTooltipContent = useEuiI18n('euiTimeWindowButtons.nextDescription', 'Next {displayInterval}', {
|
|
67
|
+
displayInterval: displayInterval
|
|
68
|
+
});
|
|
69
|
+
if (!showZoomOut && !showShiftArrows) return null;
|
|
70
|
+
return ___EmotionJSX("div", {
|
|
71
|
+
className: "euiSuperDatePicker__timeWindowButtons",
|
|
72
|
+
css: [styles.euiButtonGroup__buttons, styles[buttonSize], ";label:EuiTimeWindowButtons;"],
|
|
73
|
+
"data-test-subj": "timeWindowButtons"
|
|
74
|
+
}, showShiftArrows && ___EmotionJSX(EuiButtonGroupButton, {
|
|
75
|
+
id: previousId,
|
|
76
|
+
"data-test-subj": "timeWindowButtonsPrevious",
|
|
77
|
+
label: previousLabel,
|
|
78
|
+
title: "",
|
|
79
|
+
toolTipContent: !isDisabled && (isInvalid ? invalidShiftDescription : previousTooltipContent),
|
|
80
|
+
color: buttonColor,
|
|
81
|
+
size: buttonSize,
|
|
82
|
+
iconType: "arrowLeft",
|
|
83
|
+
iconSize: iconSize,
|
|
84
|
+
isIconOnly: true,
|
|
85
|
+
isSelected: false,
|
|
86
|
+
isDisabled: isDisabled,
|
|
87
|
+
onClick: stepBackward
|
|
88
|
+
}), showZoomOut && ___EmotionJSX(EuiButtonGroupButton, {
|
|
89
|
+
id: zoomOutId,
|
|
90
|
+
"data-test-subj": "timeWindowButtonsZoomOut",
|
|
91
|
+
label: zoomOutLabel,
|
|
92
|
+
title: "",
|
|
93
|
+
toolTipContent: !isDisabled && zoomOutTooltipContent,
|
|
94
|
+
toolTipProps: {
|
|
95
|
+
disableScreenReaderOutput: zoomOutLabel === zoomOutTooltipContent
|
|
96
|
+
},
|
|
97
|
+
color: buttonColor,
|
|
98
|
+
size: buttonSize,
|
|
99
|
+
iconType: "magnifyWithMinus",
|
|
100
|
+
iconSize: iconSize,
|
|
101
|
+
isIconOnly: true,
|
|
102
|
+
isSelected: false,
|
|
103
|
+
isDisabled: isDisabled,
|
|
104
|
+
onClick: expandWindow
|
|
105
|
+
}), showShiftArrows && ___EmotionJSX(EuiButtonGroupButton, {
|
|
106
|
+
id: nextId,
|
|
107
|
+
"data-test-subj": "timeWindowButtonsNext",
|
|
108
|
+
label: nextLabel,
|
|
109
|
+
title: "",
|
|
110
|
+
toolTipContent: !isDisabled && (isInvalid ? invalidShiftDescription : nextTooltipContent),
|
|
111
|
+
color: buttonColor,
|
|
112
|
+
size: buttonSize,
|
|
113
|
+
iconType: "arrowRight",
|
|
114
|
+
iconSize: iconSize,
|
|
115
|
+
isIconOnly: true,
|
|
116
|
+
isSelected: false,
|
|
117
|
+
isDisabled: isDisabled,
|
|
118
|
+
onClick: stepForward
|
|
119
|
+
}));
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Partly adapted from date_picker/super_date_picker/quick_select_popover/quick_select.tsx
|
|
124
|
+
*/
|
|
125
|
+
export function useEuiTimeWindow(start, end, apply, options) {
|
|
126
|
+
var _options$zoomFactor;
|
|
127
|
+
var min = dateMath.parse(start);
|
|
128
|
+
var max = dateMath.parse(end, {
|
|
129
|
+
roundUp: true
|
|
130
|
+
});
|
|
131
|
+
var isInvalid = !min || !min.isValid() || !max || !max.isValid();
|
|
132
|
+
var windowDuration = isInvalid ? 1 : max.diff(min);
|
|
133
|
+
var zoomFactor = getPercentageMultiplier((_options$zoomFactor = options === null || options === void 0 ? void 0 : options.zoomFactor) !== null && _options$zoomFactor !== void 0 ? _options$zoomFactor : ZOOM_FACTOR_DEFAULT);
|
|
134
|
+
var zoomAddition = windowDuration * (zoomFactor / 2); // Gets added to each end, that's why it's split in half
|
|
135
|
+
var prettyInterval = usePrettyInterval(false, windowDuration);
|
|
136
|
+
var displayInterval = isInvalid ? '' : prettyInterval;
|
|
137
|
+
if (!isInvalid && !isRelativeToNow(start, end) && !isExactMinuteRange(windowDuration)) {
|
|
138
|
+
displayInterval = "~".concat(displayInterval);
|
|
139
|
+
}
|
|
140
|
+
return {
|
|
141
|
+
displayInterval: displayInterval,
|
|
142
|
+
isInvalid: isInvalid,
|
|
143
|
+
stepForward: stepForward,
|
|
144
|
+
stepBackward: stepBackward,
|
|
145
|
+
expandWindow: expandWindow
|
|
146
|
+
};
|
|
147
|
+
function stepForward() {
|
|
148
|
+
if (isInvalid) return;
|
|
149
|
+
apply({
|
|
150
|
+
start: moment(max).toISOString(),
|
|
151
|
+
end: moment(max).add(windowDuration, 'ms').toISOString()
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
function stepBackward() {
|
|
155
|
+
if (isInvalid) return;
|
|
156
|
+
apply({
|
|
157
|
+
start: moment(min).subtract(windowDuration, 'ms').toISOString(),
|
|
158
|
+
end: moment(min).toISOString()
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
function expandWindow() {
|
|
162
|
+
if (isInvalid) return;
|
|
163
|
+
apply({
|
|
164
|
+
start: moment(min).subtract(zoomAddition, 'ms').toISOString(),
|
|
165
|
+
end: moment(max).add(zoomAddition, 'ms').toISOString()
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Get a number out of either 0.2 or "20%"
|
|
172
|
+
*/
|
|
173
|
+
function getPercentageMultiplier(value) {
|
|
174
|
+
var result = typeof value === 'number' ? value : parseFloat(String(value).replace('%', '').trim());
|
|
175
|
+
if (isNaN(result)) throw new TypeError('Please provide a valid number or percentage string e.g. "25%"');
|
|
176
|
+
return result > 1 ? result / 100 : result;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Useful to determine whether to show the tilde in the display
|
|
181
|
+
*/
|
|
182
|
+
function isExactMinuteRange(diffMs) {
|
|
183
|
+
// 60 * 1000 = ms per minute
|
|
184
|
+
return diffMs % (60 * 1000) === 0;
|
|
185
|
+
}
|
|
@@ -108,6 +108,9 @@ EuiFacetButton.propTypes = {
|
|
|
108
108
|
* Any node, but preferably a `EuiIcon` or `EuiAvatar`
|
|
109
109
|
*/
|
|
110
110
|
icon: PropTypes.node,
|
|
111
|
+
/**
|
|
112
|
+
* Controls the disabled behavior via the native `disabled` attribute.
|
|
113
|
+
*/
|
|
111
114
|
isDisabled: PropTypes.bool,
|
|
112
115
|
/**
|
|
113
116
|
* Force disables the button and changes the icon to a loading spinner
|
|
@@ -150,27 +153,14 @@ EuiFacetButton.propTypes = {
|
|
|
150
153
|
style: PropTypes.any,
|
|
151
154
|
type: PropTypes.any,
|
|
152
155
|
/**
|
|
153
|
-
*
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
* Can only be one side `left` or `right`
|
|
158
|
-
*/
|
|
159
|
-
iconSide: PropTypes.oneOfType([PropTypes.any.isRequired, PropTypes.oneOf([undefined])]),
|
|
160
|
-
/**
|
|
161
|
-
* Object of props passed to the `<span>` wrapping the content's text/children only (not icon)
|
|
156
|
+
* NOTE: Beta feature, may be changed or removed in the future
|
|
157
|
+
*
|
|
158
|
+
* Changes the native `disabled` attribute to `aria-disabled` to preserve focusability.
|
|
159
|
+
* This results in a semantically disabled button without the default browser handling of the disabled state.
|
|
162
160
|
*
|
|
163
|
-
*
|
|
161
|
+
* Use e.g. when a disabled button should have a tooltip.
|
|
164
162
|
*/
|
|
165
|
-
|
|
166
|
-
className: PropTypes.string,
|
|
167
|
-
"aria-label": PropTypes.string,
|
|
168
|
-
"data-test-subj": PropTypes.string,
|
|
169
|
-
css: PropTypes.any,
|
|
170
|
-
ref: PropTypes.any,
|
|
171
|
-
"data-text": PropTypes.string
|
|
172
|
-
}).isRequired, PropTypes.oneOf([false])]),
|
|
173
|
-
iconSize: PropTypes.any,
|
|
163
|
+
hasAriaDisabled: PropTypes.bool,
|
|
174
164
|
className: PropTypes.string,
|
|
175
165
|
"aria-label": PropTypes.string,
|
|
176
166
|
"data-test-subj": PropTypes.string,
|
|
@@ -228,5 +228,18 @@ EuiFilterButton.propTypes = {
|
|
|
228
228
|
* - accent
|
|
229
229
|
* - warning
|
|
230
230
|
*/
|
|
231
|
-
color: PropTypes.any
|
|
231
|
+
color: PropTypes.any,
|
|
232
|
+
/**
|
|
233
|
+
* Controls the disabled behavior via the native `disabled` attribute.
|
|
234
|
+
*/
|
|
235
|
+
isDisabled: PropTypes.bool,
|
|
236
|
+
/**
|
|
237
|
+
* NOTE: Beta feature, may be changed or removed in the future
|
|
238
|
+
*
|
|
239
|
+
* Changes the native `disabled` attribute to `aria-disabled` to preserve focusability.
|
|
240
|
+
* This results in a semantically disabled button without the default browser handling of the disabled state.
|
|
241
|
+
*
|
|
242
|
+
* Use e.g. when a disabled button should have a tooltip.
|
|
243
|
+
*/
|
|
244
|
+
hasAriaDisabled: PropTypes.bool
|
|
232
245
|
};
|