@elastic/eui 119.0.0 → 119.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/dist/eui-icons.json +93 -90
- package/dist/svgs/cursor_default.svg +3 -0
- package/dist/svgs/log_in.svg +4 -0
- package/dist/svgs/route_split.svg +3 -0
- package/es/components/avatar/avatar.js +1 -1
- package/es/components/badge/badge.js +1 -1
- package/es/components/badge/beta_badge/beta_badge.js +1 -1
- package/es/components/basic_table/basic_table.js +4 -4
- package/es/components/basic_table/in_memory_table.js +4 -4
- package/es/components/button/button.js +4 -2
- package/es/components/button/button_display/_button_display_content.js +1 -1
- package/es/components/button/button_empty/button_empty.js +1 -1
- package/es/components/button/button_group/button_group.js +87 -9
- package/es/components/button/button_group/button_group.styles.js +48 -9
- package/es/components/button/button_icon/button_icon.js +5 -3
- package/es/components/button/split_button/split_button.js +39 -16
- package/es/components/button/split_button/split_button.styles.js +28 -32
- package/es/components/button/split_button/split_button_actions.js +16 -5
- package/es/components/button/use_button_common_props.js +6 -2
- package/es/components/call_out/call_out.js +2 -2
- package/es/components/card/card.js +1 -1
- package/es/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +1 -1
- package/es/components/comment_list/comment.js +2 -2
- package/es/components/comment_list/comment_event.js +1 -1
- package/es/components/comment_list/comment_list.js +2 -2
- package/es/components/comment_list/comment_timeline.js +1 -1
- package/es/components/context_menu/context_menu_item.js +1 -1
- package/es/components/datagrid/body/cell/data_grid_cell.js +24 -24
- package/es/components/datagrid/body/data_grid_body.js +13 -13
- package/es/components/datagrid/body/data_grid_body_custom.js +13 -13
- package/es/components/datagrid/body/data_grid_body_virtualized.js +13 -13
- package/es/components/datagrid/body/header/column_actions.js +3 -1
- package/es/components/datagrid/body/header/data_grid_header_cell.js +12 -12
- package/es/components/datagrid/controls/column_sorting.js +13 -13
- package/es/components/datagrid/controls/column_sorting_draggable.js +1 -1
- package/es/components/datagrid/controls/data_grid_toolbar_control.js +1 -1
- package/es/components/datagrid/utils/in_memory.js +12 -12
- package/es/components/date_picker/date_picker.js +2 -2
- package/es/components/date_picker/date_picker_range.js +1 -1
- package/es/components/empty_prompt/empty_prompt.js +1 -1
- package/es/components/flyout/flyout_menu/flyout_menu.js +39 -14
- package/es/components/form/field_number/field_number.js +2 -2
- package/es/components/form/field_text/field_text.js +2 -2
- package/es/components/form/file_picker/file_picker.js +187 -224
- package/es/components/form/file_picker/file_picker.styles.js +1 -1
- package/es/components/form/form_control_button/form_control_button.js +1 -1
- package/es/components/form/form_control_layout/append_prepend/form_append_prepend.js +2 -2
- package/es/components/form/form_control_layout/form_control_layout.js +2 -2
- package/es/components/form/form_control_layout/form_control_layout_custom_icon.js +1 -1
- package/es/components/form/text_area/text_area.js +2 -2
- package/es/components/header/header_links/header_link.js +1 -1
- package/es/components/header/header_links/header_links.js +1 -1
- package/es/components/header/header_logo/header_logo.js +1 -1
- package/es/components/header/header_section/header_section_item_button.js +1 -1
- package/es/components/icon/assets/cursor_default.js +35 -0
- package/es/components/icon/assets/log_in.js +35 -0
- package/es/components/icon/assets/route_split.js +33 -0
- package/es/components/icon/icon.js +1 -1
- package/es/components/icon/icon_map.js +15 -0
- package/es/components/icon/svgs/cursor_default.svg +3 -0
- package/es/components/icon/svgs/log_in.svg +4 -0
- package/es/components/icon/svgs/route_split.svg +3 -0
- package/es/components/key_pad_menu/key_pad_menu_item.js +1 -1
- package/es/components/list_group/list_group.js +2 -2
- package/es/components/list_group/list_group_item.js +2 -2
- package/es/components/list_group/list_group_item_extra_action.js +1 -1
- package/es/components/list_group/pinnable_list_group/pinnable_list_group.js +4 -4
- package/es/components/loading/loading_logo.js +1 -1
- package/es/components/markdown_editor/markdown_editor.js +1 -1
- package/es/components/markdown_editor/markdown_editor_drop_zone.js +1 -1
- package/es/components/markdown_editor/markdown_editor_footer.js +1 -1
- package/es/components/markdown_editor/markdown_editor_toolbar.js +1 -1
- package/es/components/page/page_header/page_header_content.js +1 -1
- package/es/components/pagination/pagination_button.js +1 -1
- package/es/components/selectable/selectable_list/selectable_list.js +1 -1
- package/es/components/selectable/selectable_list/selectable_list_item.js +1 -1
- package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +1 -1
- package/es/components/table/table_header_cell.js +1 -1
- package/es/components/timeline/timeline_item_icon.js +1 -1
- package/es/components/toast/global_toast_list.js +2 -2
- package/es/components/toast/toast.js +2 -2
- package/es/components/tool_tip/icon_tip.js +1 -1
- package/es/global_styling/mixins/_button.js +6 -0
- package/es/services/accessibility/html_id_generator.js +26 -1
- package/eui.d.ts +241 -329
- package/i18ntokens.json +2678 -2660
- package/lib/components/avatar/avatar.js +1 -1
- package/lib/components/badge/badge.js +1 -1
- package/lib/components/badge/beta_badge/beta_badge.js +1 -1
- package/lib/components/basic_table/basic_table.js +4 -4
- package/lib/components/basic_table/in_memory_table.js +4 -4
- package/lib/components/button/button.js +4 -2
- package/lib/components/button/button_display/_button_display_content.js +1 -1
- package/lib/components/button/button_empty/button_empty.js +1 -1
- package/lib/components/button/button_group/button_group.js +86 -10
- package/lib/components/button/button_group/button_group.styles.js +47 -8
- package/lib/components/button/button_icon/button_icon.js +5 -3
- package/lib/components/button/split_button/split_button.js +37 -15
- package/lib/components/button/split_button/split_button.styles.js +29 -31
- package/lib/components/button/split_button/split_button_actions.js +15 -4
- package/lib/components/button/use_button_common_props.js +6 -2
- package/lib/components/call_out/call_out.js +2 -2
- package/lib/components/card/card.js +1 -1
- package/lib/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +1 -1
- package/lib/components/comment_list/comment.js +2 -2
- package/lib/components/comment_list/comment_event.js +1 -1
- package/lib/components/comment_list/comment_list.js +2 -2
- package/lib/components/comment_list/comment_timeline.js +1 -1
- package/lib/components/context_menu/context_menu_item.js +1 -1
- package/lib/components/datagrid/body/cell/data_grid_cell.js +24 -24
- package/lib/components/datagrid/body/data_grid_body.js +13 -13
- package/lib/components/datagrid/body/data_grid_body_custom.js +13 -13
- package/lib/components/datagrid/body/data_grid_body_virtualized.js +13 -13
- package/lib/components/datagrid/body/header/column_actions.js +3 -1
- package/lib/components/datagrid/body/header/data_grid_header_cell.js +12 -12
- package/lib/components/datagrid/controls/column_sorting.js +13 -13
- package/lib/components/datagrid/controls/column_sorting_draggable.js +1 -1
- package/lib/components/datagrid/controls/data_grid_toolbar_control.js +1 -1
- package/lib/components/datagrid/utils/in_memory.js +12 -12
- package/lib/components/date_picker/date_picker.js +2 -2
- package/lib/components/date_picker/date_picker_range.js +1 -1
- package/lib/components/empty_prompt/empty_prompt.js +1 -1
- package/lib/components/flyout/flyout_menu/flyout_menu.js +39 -14
- package/lib/components/form/field_number/field_number.js +2 -2
- package/lib/components/form/field_text/field_text.js +2 -2
- package/lib/components/form/file_picker/file_picker.js +193 -227
- package/lib/components/form/file_picker/file_picker.styles.js +1 -1
- package/lib/components/form/form_control_button/form_control_button.js +1 -1
- package/lib/components/form/form_control_layout/append_prepend/form_append_prepend.js +2 -2
- package/lib/components/form/form_control_layout/form_control_layout.js +2 -2
- package/lib/components/form/form_control_layout/form_control_layout_custom_icon.js +1 -1
- package/lib/components/form/text_area/text_area.js +2 -2
- package/lib/components/header/header_links/header_link.js +1 -1
- package/lib/components/header/header_links/header_links.js +1 -1
- package/lib/components/header/header_logo/header_logo.js +1 -1
- package/lib/components/header/header_section/header_section_item_button.js +1 -1
- package/lib/components/icon/assets/cursor_default.js +42 -0
- package/lib/components/icon/assets/log_in.js +42 -0
- package/lib/components/icon/assets/route_split.js +40 -0
- package/lib/components/icon/icon.js +1 -1
- package/lib/components/icon/icon_map.js +21 -0
- package/lib/components/icon/svgs/cursor_default.svg +3 -0
- package/lib/components/icon/svgs/log_in.svg +4 -0
- package/lib/components/icon/svgs/route_split.svg +3 -0
- package/lib/components/key_pad_menu/key_pad_menu_item.js +1 -1
- package/lib/components/list_group/list_group.js +2 -2
- package/lib/components/list_group/list_group_item.js +2 -2
- package/lib/components/list_group/list_group_item_extra_action.js +1 -1
- package/lib/components/list_group/pinnable_list_group/pinnable_list_group.js +4 -4
- package/lib/components/loading/loading_logo.js +1 -1
- package/lib/components/markdown_editor/markdown_editor.js +1 -1
- package/lib/components/markdown_editor/markdown_editor_drop_zone.js +1 -1
- package/lib/components/markdown_editor/markdown_editor_footer.js +1 -1
- package/lib/components/markdown_editor/markdown_editor_toolbar.js +1 -1
- package/lib/components/page/page_header/page_header_content.js +1 -1
- package/lib/components/pagination/pagination_button.js +1 -1
- package/lib/components/selectable/selectable_list/selectable_list.js +1 -1
- package/lib/components/selectable/selectable_list/selectable_list_item.js +1 -1
- package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +1 -1
- package/lib/components/table/table_header_cell.js +1 -1
- package/lib/components/timeline/timeline_item_icon.js +1 -1
- package/lib/components/toast/global_toast_list.js +2 -2
- package/lib/components/toast/toast.js +2 -2
- package/lib/components/tool_tip/icon_tip.js +1 -1
- package/lib/global_styling/mixins/_button.js +6 -0
- package/lib/services/accessibility/html_id_generator.js +26 -1
- package/optimize/es/components/button/button.js +4 -2
- package/optimize/es/components/button/button_group/button_group.js +55 -8
- package/optimize/es/components/button/button_group/button_group.styles.js +48 -9
- package/optimize/es/components/button/button_icon/button_icon.js +4 -2
- package/optimize/es/components/button/split_button/split_button.js +36 -16
- package/optimize/es/components/button/split_button/split_button.styles.js +28 -32
- package/optimize/es/components/button/split_button/split_button_actions.js +16 -5
- package/optimize/es/components/button/use_button_common_props.js +6 -2
- package/optimize/es/components/datagrid/body/header/column_actions.js +3 -1
- package/optimize/es/components/flyout/flyout_menu/flyout_menu.js +32 -9
- package/optimize/es/components/form/file_picker/file_picker.js +182 -216
- package/optimize/es/components/form/file_picker/file_picker.styles.js +1 -1
- package/optimize/es/components/icon/assets/cursor_default.js +34 -0
- package/optimize/es/components/icon/assets/log_in.js +34 -0
- package/optimize/es/components/icon/assets/route_split.js +32 -0
- package/optimize/es/components/icon/icon_map.js +15 -0
- package/optimize/es/components/icon/svgs/cursor_default.svg +3 -0
- package/optimize/es/components/icon/svgs/log_in.svg +4 -0
- package/optimize/es/components/icon/svgs/route_split.svg +3 -0
- package/optimize/es/global_styling/mixins/_button.js +6 -0
- package/optimize/es/services/accessibility/html_id_generator.js +26 -1
- package/optimize/lib/components/button/button.js +4 -2
- package/optimize/lib/components/button/button_group/button_group.js +55 -9
- package/optimize/lib/components/button/button_group/button_group.styles.js +47 -8
- package/optimize/lib/components/button/button_icon/button_icon.js +4 -2
- package/optimize/lib/components/button/split_button/split_button.js +35 -15
- package/optimize/lib/components/button/split_button/split_button.styles.js +29 -31
- package/optimize/lib/components/button/split_button/split_button_actions.js +15 -4
- package/optimize/lib/components/button/use_button_common_props.js +6 -2
- package/optimize/lib/components/datagrid/body/header/column_actions.js +3 -1
- package/optimize/lib/components/flyout/flyout_menu/flyout_menu.js +32 -9
- package/optimize/lib/components/form/file_picker/file_picker.js +183 -215
- package/optimize/lib/components/form/file_picker/file_picker.styles.js +1 -1
- package/optimize/lib/components/icon/assets/cursor_default.js +42 -0
- package/optimize/lib/components/icon/assets/log_in.js +42 -0
- package/optimize/lib/components/icon/assets/route_split.js +40 -0
- package/optimize/lib/components/icon/icon_map.js +21 -0
- package/optimize/lib/components/icon/svgs/cursor_default.svg +3 -0
- package/optimize/lib/components/icon/svgs/log_in.svg +4 -0
- package/optimize/lib/components/icon/svgs/route_split.svg +3 -0
- package/optimize/lib/global_styling/mixins/_button.js +6 -0
- package/optimize/lib/services/accessibility/html_id_generator.js +26 -1
- package/package.json +11 -17
- package/test-env/components/avatar/avatar.js +1 -1
- package/test-env/components/badge/badge.js +1 -1
- package/test-env/components/badge/beta_badge/beta_badge.js +1 -1
- package/test-env/components/basic_table/basic_table.js +4 -4
- package/test-env/components/basic_table/in_memory_table.js +4 -4
- package/test-env/components/button/button.js +4 -2
- package/test-env/components/button/button_display/_button_display_content.js +1 -1
- package/test-env/components/button/button_empty/button_empty.js +1 -1
- package/test-env/components/button/button_group/button_group.js +84 -10
- package/test-env/components/button/button_group/button_group.styles.js +47 -8
- package/test-env/components/button/button_icon/button_icon.js +5 -3
- package/test-env/components/button/split_button/split_button.js +35 -15
- package/test-env/components/button/split_button/split_button.styles.js +29 -31
- package/test-env/components/button/split_button/split_button_actions.js +15 -4
- package/test-env/components/button/use_button_common_props.js +6 -2
- package/test-env/components/call_out/call_out.js +2 -2
- package/test-env/components/card/card.js +1 -1
- package/test-env/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +1 -1
- package/test-env/components/comment_list/comment.js +2 -2
- package/test-env/components/comment_list/comment_event.js +1 -1
- package/test-env/components/comment_list/comment_list.js +2 -2
- package/test-env/components/comment_list/comment_timeline.js +1 -1
- package/test-env/components/context_menu/context_menu_item.js +1 -1
- package/test-env/components/datagrid/body/cell/data_grid_cell.js +24 -24
- package/test-env/components/datagrid/body/data_grid_body.js +13 -13
- package/test-env/components/datagrid/body/data_grid_body_custom.js +13 -13
- package/test-env/components/datagrid/body/data_grid_body_virtualized.js +13 -13
- package/test-env/components/datagrid/body/header/column_actions.js +3 -1
- package/test-env/components/datagrid/body/header/data_grid_header_cell.js +12 -12
- package/test-env/components/datagrid/controls/column_sorting.js +13 -13
- package/test-env/components/datagrid/controls/column_sorting_draggable.js +1 -1
- package/test-env/components/datagrid/controls/data_grid_toolbar_control.js +1 -1
- package/test-env/components/datagrid/utils/in_memory.js +12 -12
- package/test-env/components/date_picker/date_picker.js +2 -2
- package/test-env/components/date_picker/date_picker_range.js +1 -1
- package/test-env/components/empty_prompt/empty_prompt.js +1 -1
- package/test-env/components/flyout/flyout_menu/flyout_menu.js +39 -14
- package/test-env/components/form/field_number/field_number.js +2 -2
- package/test-env/components/form/field_text/field_text.js +2 -2
- package/test-env/components/form/file_picker/file_picker.js +184 -216
- package/test-env/components/form/file_picker/file_picker.styles.js +1 -1
- package/test-env/components/form/form_control_button/form_control_button.js +1 -1
- package/test-env/components/form/form_control_layout/append_prepend/form_append_prepend.js +2 -2
- package/test-env/components/form/form_control_layout/form_control_layout.js +2 -2
- package/test-env/components/form/form_control_layout/form_control_layout_custom_icon.js +1 -1
- package/test-env/components/form/text_area/text_area.js +2 -2
- package/test-env/components/header/header_links/header_link.js +1 -1
- package/test-env/components/header/header_links/header_links.js +1 -1
- package/test-env/components/header/header_logo/header_logo.js +1 -1
- package/test-env/components/header/header_section/header_section_item_button.js +1 -1
- package/test-env/components/icon/assets/cursor_default.js +42 -0
- package/test-env/components/icon/assets/log_in.js +42 -0
- package/test-env/components/icon/assets/route_split.js +40 -0
- package/test-env/components/icon/icon_map.js +21 -0
- package/test-env/components/key_pad_menu/key_pad_menu_item.js +1 -1
- package/test-env/components/list_group/list_group.js +2 -2
- package/test-env/components/list_group/list_group_item.js +2 -2
- package/test-env/components/list_group/list_group_item_extra_action.js +1 -1
- package/test-env/components/list_group/pinnable_list_group/pinnable_list_group.js +4 -4
- package/test-env/components/loading/loading_logo.js +1 -1
- package/test-env/components/markdown_editor/markdown_editor.js +1 -1
- package/test-env/components/markdown_editor/markdown_editor_drop_zone.js +1 -1
- package/test-env/components/markdown_editor/markdown_editor_footer.js +1 -1
- package/test-env/components/markdown_editor/markdown_editor_toolbar.js +1 -1
- package/test-env/components/page/page_header/page_header_content.js +1 -1
- package/test-env/components/pagination/pagination_button.js +1 -1
- package/test-env/components/selectable/selectable_list/selectable_list.js +1 -1
- package/test-env/components/selectable/selectable_list/selectable_list_item.js +1 -1
- package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +1 -1
- package/test-env/components/table/table_header_cell.js +1 -1
- package/test-env/components/timeline/timeline_item_icon.js +1 -1
- package/test-env/components/toast/global_toast_list.js +2 -2
- package/test-env/components/toast/toast.js +2 -2
- package/test-env/components/tool_tip/icon_tip.js +1 -1
- package/test-env/global_styling/mixins/_button.js +6 -0
- package/test-env/services/accessibility/html_id_generator.js +11 -0
|
@@ -8,11 +8,15 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { css } from '@emotion/react';
|
|
11
|
-
import { euiDisabledSelector, logicalCSS } from '../../../global_styling';
|
|
11
|
+
import { euiButtonSizeMap, euiDisabledSelector, logicalCSS, mathWithUnits } from '../../../global_styling';
|
|
12
12
|
import { highContrastModeStyles, preventForcedColors } from '../../../global_styling/functions/high_contrast';
|
|
13
13
|
import { euiFormVariables } from '../../form/form.styles';
|
|
14
|
+
var hasButtonOnlySelector = ':not(:has(.euiButtonIcon))';
|
|
15
|
+
var hasButtonIconOnlySelector = ':not(:has(.euiButton, .euiButtonEmpty))';
|
|
16
|
+
var buttonItemSelector = '.euiButtonGroup__item, .euiToolTipAnchor, .euiPopover, .euiButton';
|
|
17
|
+
var buttonOnlyItemSelector = "*:is(".concat(buttonItemSelector, "):not(:has(.euiButtonIcon))");
|
|
14
18
|
export var euiButtonGroupStyles = {
|
|
15
|
-
euiButtonGroup: /*#__PURE__*/css("display:inline-block;", logicalCSS('max-width', '100%'), " position:relative
|
|
19
|
+
euiButtonGroup: /*#__PURE__*/css("display:inline-block;", logicalCSS('max-width', '100%'), " position:relative;&:where([data-variant='segmented']){&", hasButtonIconOnlySelector, "{display:flex;}};label:euiButtonGroup;"),
|
|
16
20
|
fullWidth: process.env.NODE_ENV === "production" ? {
|
|
17
21
|
name: "jl0hie-fullWidth",
|
|
18
22
|
styles: "display:block;label:fullWidth;"
|
|
@@ -24,23 +28,58 @@ export var euiButtonGroupStyles = {
|
|
|
24
28
|
};
|
|
25
29
|
export var euiButtonGroupButtonsStyles = function euiButtonGroupButtonsStyles(euiThemeContext) {
|
|
26
30
|
var euiTheme = euiThemeContext.euiTheme;
|
|
27
|
-
var
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
var buttonSizeMap = euiButtonSizeMap(euiThemeContext);
|
|
32
|
+
var containerPadding = euiTheme.size.xs;
|
|
33
|
+
var splitPadding = mathWithUnits(containerPadding, function (x) {
|
|
34
|
+
return x / 2;
|
|
35
|
+
});
|
|
36
|
+
var insetSize = function insetSize(height) {
|
|
37
|
+
return mathWithUnits([height, containerPadding], function (x, y) {
|
|
38
|
+
return x - y * 2;
|
|
39
|
+
});
|
|
30
40
|
};
|
|
41
|
+
var buttonGroupVariables = {
|
|
42
|
+
gap: {
|
|
43
|
+
regular: euiTheme.size.xs,
|
|
44
|
+
dividers: mathWithUnits([euiTheme.size.xs, euiTheme.border.width.thin], function (x, y) {
|
|
45
|
+
return x + y;
|
|
46
|
+
})
|
|
47
|
+
},
|
|
48
|
+
// TODO: use from buttonSizeMap once added via EuiSplitButton:
|
|
49
|
+
// https://github.com/elastic/eui/pull/9865
|
|
50
|
+
radius: {
|
|
51
|
+
outer: euiTheme.border.radius.medium,
|
|
52
|
+
inner: '2px' // should eventually be a token, but currently small and medium have the same value
|
|
53
|
+
},
|
|
54
|
+
size: {
|
|
55
|
+
s: insetSize(buttonSizeMap.s.height),
|
|
56
|
+
m: insetSize(buttonSizeMap.m.height)
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
var dividerOffset = mathWithUnits([buttonGroupVariables.gap.dividers, euiTheme.border.width.thin], function (x, y) {
|
|
60
|
+
return (x + y) / 2;
|
|
61
|
+
});
|
|
31
62
|
var _euiFormVariables = euiFormVariables(euiThemeContext),
|
|
32
63
|
controlCompressedHeight = _euiFormVariables.controlCompressedHeight,
|
|
33
64
|
controlCompressedBorderRadius = _euiFormVariables.controlCompressedBorderRadius,
|
|
34
65
|
backgroundColor = _euiFormVariables.backgroundColor,
|
|
35
66
|
borderColor = _euiFormVariables.borderColor;
|
|
67
|
+
var dividerStyles = "\n gap: ".concat(buttonGroupVariables.gap.dividers, ";\n\n .euiButtonGroup__item {\n position: relative;\n\n /* block border */\n &::before {\n content: '';\n position: absolute;\n inset-block-start: -").concat(dividerOffset, ";\n inset-inline-start: -").concat(mathWithUnits(containerPadding, function (x) {
|
|
68
|
+
return x / 2;
|
|
69
|
+
}), ";\n inline-size: calc(\n 100% + ").concat(mathWithUnits(containerPadding, function (x) {
|
|
70
|
+
return x * 2;
|
|
71
|
+
}), "\n );\n block-size: ").concat(euiTheme.border.width.thin, ";\n border-block-start: ").concat(euiTheme.border.width.thin, " solid\n ").concat(euiTheme.colors.borderBasePlain, ";\n pointer-events: none;\n }\n\n /* inline border */\n &::after {\n content: '';\n position: absolute;\n inset-inline-start: -").concat(dividerOffset, ";\n block-size: calc(\n var(--euiButtonGroupButtonInsetSize) - ").concat(euiTheme.size.s, "\n );\n inline-size: ").concat(euiTheme.border.width.thin, ";\n border-inline-start: ").concat(euiTheme.border.width.thin, " solid\n ").concat(euiTheme.colors.borderBasePlain, ";\n pointer-events: none;\n }\n }\n\n &:where([data-layout='horizontal'] &) {\n &:where(:is(").concat(hasButtonIconOnlySelector, ") &) {\n .euiButtonGroup__item::before {\n inset-inline-start: 0;\n inline-size: 100%;\n }\n }\n }\n\n &:where([data-layout='vertical'] &) {\n &:where(:is(").concat(hasButtonIconOnlySelector, ") &) {\n .euiButtonGroup__item::before {\n inset-inline-start: auto;\n inline-size: calc(\n var(--euiButtonGroupButtonInsetSize) - ").concat(euiTheme.size.s, "\n );\n }\n }\n }\n ");
|
|
72
|
+
var segmentedChildrenStyles = "\n /* Buttons are used inset and shouldn't have their own borders */\n .euiButton,\n .euiButtonIcon {\n border: none;\n pointer-events: auto; /* Ensure buttons are still clickable in jsdom */\n\n &::before {\n border-radius: inherit;\n }\n }\n\n /* Adjust children for inset behavior */\n ".concat(buttonItemSelector, ", \n .euiButtonIcon {\n display: inline-flex;\n align-items: center;\n block-size: var(--euiButtonGroupButtonInsetSize);\n border-radius: ").concat(buttonGroupVariables.radius.inner, ";\n }\n\n .euiButtonIcon {\n inline-size: var(--euiButtonGroupButtonInsetSize);\n }\n\n /* Only non-icon buttons auto-grow/shrink */\n .euiButton,\n ").concat(buttonOnlyItemSelector, " {\n flex: 1;\n min-inline-size: auto;\n }\n ");
|
|
36
73
|
return {
|
|
37
74
|
// Base
|
|
38
|
-
|
|
39
|
-
|
|
75
|
+
euiButtonGroup__container: /*#__PURE__*/css("&:where([data-variant='segmented'] &){position:relative;display:inline-flex;align-items:center;max-inline-size:100%;padding:", splitPadding, ";border-radius:", buttonGroupVariables.radius.outer, ";background-color:", euiTheme.colors.backgroundBasePlain, ";&:where([data-size='s'] &){--euiButtonGroupButtonInsetSize:", buttonGroupVariables.size.s, ";min-block-size:", buttonSizeMap.s.height, ";}&:where([data-size='m'] &){--euiButtonGroupButtonInsetSize:", buttonGroupVariables.size.m, ";min-block-size:", buttonSizeMap.m.height, ";}&::after{content:'';position:absolute;inset:0;border:", euiTheme.border.width.thin, " solid ", euiTheme.colors.borderBasePlain, ";border-radius:inherit;pointer-events:none;}};label:euiButtonGroup__container;"),
|
|
76
|
+
euiButtonGroup__buttons: /*#__PURE__*/css(logicalCSS('max-width', '100%'), " display:flex;align-items:center;&:where([data-variant='default'] &){flex-wrap:wrap;}&:where([data-variant='segmented'] &){position:relative;display:inline-flex;align-items:center;flex-wrap:wrap;gap:", buttonGroupVariables.gap.regular, ";max-inline-size:100%;padding:", splitPadding, ";overflow:hidden;*:where(.euiButton, .euiButtonIcon):is(", euiDisabledSelector, "){background-color:transparent;}&:where([data-dividers='true'] &){", dividerStyles, ";}", segmentedChildrenStyles, " &:where([data-layout='vertical'] &){flex-direction:column;.euiButtonGroup__item{justify-content:center;}}};label:euiButtonGroup__buttons;"),
|
|
77
|
+
noWrap: /*#__PURE__*/css("&:where([data-variant='segmented'] &){flex-wrap:nowrap;", buttonOnlyItemSelector, "{flex:0 1 auto;min-inline-size:0;.euiButton .eui-textTruncate{min-inline-size:0;}}&", hasButtonIconOnlySelector, "{overflow-inline:auto;}};label:noWrap;"),
|
|
78
|
+
fullWidth: /*#__PURE__*/css(logicalCSS('width', '100%'), " .euiButtonGroupButton,.euiButtonGroup__tooltipWrapper{flex:1;", logicalCSS('width', '100%'), ";}&:where([data-variant='default'] &){.euiButton{flex-grow:1;inline-size:auto;}.euiButtonEmpty{flex-shrink:0;}}&:where([data-variant='segmented'] &){&", hasButtonIconOnlySelector, "{inline-size:auto;}&", hasButtonOnlySelector, "{.euiButtonGroup__buttons{inline-size:100%;}", buttonOnlyItemSelector, "{flex-grow:1;}}};label:fullWidth;"),
|
|
40
79
|
// Sizes
|
|
41
80
|
size: {
|
|
42
|
-
m: /*#__PURE__*/css(
|
|
43
|
-
s: /*#__PURE__*/css(
|
|
81
|
+
m: /*#__PURE__*/css("border-radius:", euiTheme.border.radius.medium, ";", _highContrastStyles(euiThemeContext), ";;label:m;"),
|
|
82
|
+
s: /*#__PURE__*/css("border-radius:", euiTheme.border.radius.small, ";", _highContrastStyles(euiThemeContext), ";;label:s;"),
|
|
44
83
|
compressed: /*#__PURE__*/css(logicalCSS('height', controlCompressedHeight), " background-color:", backgroundColor, ";border:", euiTheme.border.width.thin, " solid ", borderColor, ";border-radius:", controlCompressedBorderRadius, ";", _highContrastStyles(euiThemeContext, true), ";;label:compressed;")
|
|
45
84
|
},
|
|
46
85
|
gutterSize: {
|
|
@@ -36,7 +36,7 @@ export var EuiButtonIcon = function EuiButtonIcon(_ref) {
|
|
|
36
36
|
_ref$type = _ref.type,
|
|
37
37
|
type = _ref$type === void 0 ? 'button' : _ref$type,
|
|
38
38
|
_ref$display = _ref.display,
|
|
39
|
-
|
|
39
|
+
_display = _ref$display === void 0 ? 'empty' : _ref$display,
|
|
40
40
|
target = _ref.target,
|
|
41
41
|
rel = _ref.rel,
|
|
42
42
|
_ref$size = _ref.size,
|
|
@@ -50,6 +50,7 @@ export var EuiButtonIcon = function EuiButtonIcon(_ref) {
|
|
|
50
50
|
color: _color,
|
|
51
51
|
isDisabled: _isDisabled,
|
|
52
52
|
hasAriaDisabled: _hasAriaDisabled,
|
|
53
|
+
display: _display,
|
|
53
54
|
href: href,
|
|
54
55
|
disabled: disabled,
|
|
55
56
|
isLoading: isLoading
|
|
@@ -58,7 +59,8 @@ export var EuiButtonIcon = function EuiButtonIcon(_ref) {
|
|
|
58
59
|
color = _useEuiButtonCommonPr.color,
|
|
59
60
|
isDisabled = _useEuiButtonCommonPr.isDisabled,
|
|
60
61
|
_useEuiButtonCommonPr2 = _useEuiButtonCommonPr.hasAriaDisabled,
|
|
61
|
-
hasAriaDisabled = _useEuiButtonCommonPr2 === void 0 ? false : _useEuiButtonCommonPr2
|
|
62
|
+
hasAriaDisabled = _useEuiButtonCommonPr2 === void 0 ? false : _useEuiButtonCommonPr2,
|
|
63
|
+
display = _useEuiButtonCommonPr.display;
|
|
62
64
|
var _useEuiDisabledElemen = useEuiDisabledElement({
|
|
63
65
|
isDisabled: isDisabled,
|
|
64
66
|
hasAriaDisabled: hasAriaDisabled,
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
5
|
var _excluded = ["className", "children", "size", "color", "fill", "isDisabled", "hasAriaDisabled", "isLoading"];
|
|
6
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
8
|
/*
|
|
6
9
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
7
10
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -12,7 +15,8 @@ var _excluded = ["className", "children", "size", "color", "fill", "isDisabled",
|
|
|
12
15
|
|
|
13
16
|
import classNames from 'classnames';
|
|
14
17
|
import React, { Children, Fragment, isValidElement, useMemo } from 'react';
|
|
15
|
-
import {
|
|
18
|
+
import { getTokenName } from '@elastic/eui-theme-common';
|
|
19
|
+
import { useEuiTheme, useGeneratedHtmlId } from '../../../services';
|
|
16
20
|
import { getEuiButtonColorValues, getEuiFilledButtonColorValues } from '../../../global_styling';
|
|
17
21
|
import { EuiSplitButtonContext } from './split_button_context';
|
|
18
22
|
import { EuiSplitButtonActionPrimary, EuiSplitButtonActionSecondary } from './split_button_actions';
|
|
@@ -32,29 +36,41 @@ export var _EuiSplitButton = function _EuiSplitButton(_ref) {
|
|
|
32
36
|
isLoading = _ref.isLoading,
|
|
33
37
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
34
38
|
var euiThemeContext = useEuiTheme();
|
|
35
|
-
var
|
|
39
|
+
var euiTheme = euiThemeContext.euiTheme,
|
|
40
|
+
highContrastMode = euiThemeContext.highContrastMode;
|
|
36
41
|
var _children = _slicedToArray(children, 2),
|
|
37
42
|
primaryAction = _children[0],
|
|
38
43
|
secondaryAction = _children[1];
|
|
39
44
|
var key = useGeneratedHtmlId({
|
|
40
45
|
suffix: 'EuiSplitButton'
|
|
41
46
|
});
|
|
42
|
-
var commonProps = {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
var commonProps = useMemo(function () {
|
|
48
|
+
return {
|
|
49
|
+
size: size,
|
|
50
|
+
color: color,
|
|
51
|
+
fill: fill,
|
|
52
|
+
isDisabled: isDisabled,
|
|
53
|
+
hasAriaDisabled: hasAriaDisabled,
|
|
54
|
+
isLoading: isLoading
|
|
55
|
+
};
|
|
56
|
+
}, [size, color, fill, isDisabled, hasAriaDisabled, isLoading]);
|
|
50
57
|
var buttonFilledColors = getEuiFilledButtonColorValues(euiThemeContext, isDisabled ? 'disabled' : color);
|
|
51
58
|
var buttonColors = getEuiButtonColorValues(euiThemeContext, isDisabled ? 'disabled' : color);
|
|
59
|
+
var borderToken = color === 'text' ? 'borderBasePlain' : getTokenName('borderBase', color);
|
|
52
60
|
var classes = classNames('euiSplitButton', className);
|
|
53
|
-
var styles =
|
|
54
|
-
|
|
61
|
+
var styles = useMemo(function () {
|
|
62
|
+
return euiSplitButtonStyles(euiThemeContext, fill ? buttonFilledColors.backgroundColor : buttonColors.backgroundColor);
|
|
63
|
+
}, [euiThemeContext, fill, buttonFilledColors.backgroundColor, buttonColors.backgroundColor]);
|
|
64
|
+
var cssStyles = [styles.euiSplitButton, (color === 'text' || highContrastMode) && styles.hasBorder];
|
|
65
|
+
var dividerColor = color === 'warning' && fill ? buttonFilledColors.color : euiTheme.colors[borderToken];
|
|
55
66
|
var dividerStyles = useMemo(function () {
|
|
56
|
-
return euiSplitButtonDividerStyles(euiThemeContext,
|
|
57
|
-
}, [euiThemeContext, highContrastMode, fill, buttonFilledColors.
|
|
67
|
+
return euiSplitButtonDividerStyles(euiThemeContext, highContrastMode && fill ? buttonFilledColors.color : dividerColor);
|
|
68
|
+
}, [euiThemeContext, highContrastMode, fill, buttonFilledColors.color, dividerColor]);
|
|
69
|
+
var cssVariables = useMemo(function () {
|
|
70
|
+
return {
|
|
71
|
+
'--euiSplitButtonBorderColor': dividerColor
|
|
72
|
+
};
|
|
73
|
+
}, [dividerColor]);
|
|
58
74
|
|
|
59
75
|
// NOTE: dev-mode-only runtime check to evaluate if correct child components are passed
|
|
60
76
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -72,8 +88,12 @@ export var _EuiSplitButton = function _EuiSplitButton(_ref) {
|
|
|
72
88
|
return ___EmotionJSX("div", _extends({
|
|
73
89
|
role: "group",
|
|
74
90
|
className: classes,
|
|
75
|
-
css: cssStyles
|
|
76
|
-
|
|
91
|
+
css: cssStyles,
|
|
92
|
+
"data-size": size,
|
|
93
|
+
"data-fill": fill || undefined
|
|
94
|
+
}, rest, {
|
|
95
|
+
style: _objectSpread({}, cssVariables)
|
|
96
|
+
}), ___EmotionJSX(EuiSplitButtonContext.Provider, {
|
|
77
97
|
value: commonProps
|
|
78
98
|
}, ___EmotionJSX(Fragment, {
|
|
79
99
|
key: "".concat(key, "-primaryAction")
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
2
1
|
/*
|
|
3
2
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
4
3
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -8,44 +7,41 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
|
|
|
8
7
|
*/
|
|
9
8
|
|
|
10
9
|
import { css } from '@emotion/react';
|
|
11
|
-
import { euiDisabledSelector, highContrastModeStyles } from '../../../global_styling';
|
|
12
|
-
|
|
10
|
+
import { euiButtonSizeMap, euiDisabledSelector, highContrastModeStyles, logicalCSS } from '../../../global_styling';
|
|
11
|
+
var primaryDisabledSelector = ".euiSplitButtonActionPrimary:is(".concat(euiDisabledSelector, ")");
|
|
12
|
+
var secondaryDisabledSelector = ".euiSplitButtonActionSecondary:is(".concat(euiDisabledSelector, ")");
|
|
13
|
+
export var euiSplitButtonStyles = function euiSplitButtonStyles(euiThemeContext, backgroundColor) {
|
|
13
14
|
var euiTheme = euiThemeContext.euiTheme;
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
|
|
15
|
+
var buttonSizeMap = euiButtonSizeMap(euiThemeContext);
|
|
16
|
+
var borderStyles = function borderStyles(color) {
|
|
17
|
+
return "\n &::after {\n content: '';\n position: absolute;\n inset: 0;\n border: ".concat(euiTheme.border.width.thin, " solid ").concat(color, ";\n border-radius: ").concat(euiTheme.border.radius.small, ";\n pointer-events: none;\n }\n ");
|
|
18
|
+
};
|
|
17
19
|
return {
|
|
18
|
-
euiSplitButton: /*#__PURE__*/css("display:inline-flex;flex-wrap:nowrap;&:
|
|
19
|
-
|
|
20
|
-
none: "\n
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}), "
|
|
24
|
-
// When both buttons are enabled set as visual gap
|
|
25
|
-
fill: /*#__PURE__*/css("&:not(:has(", primaryDisabledSelector, ")):not(\n :has(", secondaryDisabledSelector, ")\n ){", dividerSelector, "{border-color:transparent;}};label:fill;")
|
|
20
|
+
euiSplitButton: /*#__PURE__*/css("position:relative;display:inline-flex;align-items:center;flex-wrap:nowrap;max-inline-size:fit-content;padding:", euiTheme.size.xs, ";border-radius:", euiTheme.border.radius.small, ";background-color:", backgroundColor, ";&:where([data-size='s']){block-size:", buttonSizeMap.s.height, ";}&:where([data-size='m']){block-size:", buttonSizeMap.m.height, ";}&:has(", primaryDisabledSelector, ", ", secondaryDisabledSelector, "){background-color:", euiTheme.colors.backgroundBaseDisabled, ";};label:euiSplitButton;"),
|
|
21
|
+
hasBorder: /*#__PURE__*/css(highContrastModeStyles(euiThemeContext, {
|
|
22
|
+
none: "\n &:where(:not([data-fill])):not(:has(".concat(primaryDisabledSelector, ", ").concat(secondaryDisabledSelector, ")) {\n ").concat(borderStyles("var(--euiSplitButtonBorderColor)"), "\n }\n "),
|
|
23
|
+
preferred: "\n &:where(:not([data-fill])) {\n ".concat(borderStyles("var(--euiSplitButtonBorderColor)"), "\n\n &:has(").concat(primaryDisabledSelector, ", ").concat(secondaryDisabledSelector, ") {\n ").concat(borderStyles(euiTheme.colors.borderBaseDisabled), "\n }\n }\n\n &:where([data-fill]):has(").concat(primaryDisabledSelector, ", ").concat(secondaryDisabledSelector, ") {\n ").concat(borderStyles(euiTheme.colors.borderBaseDisabled), "\n }\n "),
|
|
24
|
+
forced: "\n ".concat(borderStyles("var(--euiSplitButtonBorderColor)"), "\n ")
|
|
25
|
+
}), ";;label:hasBorder;")
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
|
-
export var euiSplitButtonActionStyles = {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
name: "5uh4vx-euiSplitButtonActionSecondary",
|
|
42
|
-
styles: "border-inline-start:none;border-start-start-radius:0;border-end-start-radius:0;label:euiSplitButtonActionSecondary;",
|
|
43
|
-
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
44
|
-
}
|
|
28
|
+
export var euiSplitButtonActionStyles = function euiSplitButtonActionStyles(euiThemeContext, size) {
|
|
29
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
30
|
+
var buttonSizeMap = euiButtonSizeMap(euiThemeContext);
|
|
31
|
+
|
|
32
|
+
// uses smaller sizes due to the buttons being inset into the parent container
|
|
33
|
+
var buttonSize = size === 's' ? buttonSizeMap.xs.height : buttonSizeMap.s.height;
|
|
34
|
+
var buttonMinWidth = size === 's' ? buttonSizeMap.xs.minWidth : buttonSizeMap.s.minWidth;
|
|
35
|
+
var buttonRadius = size === 's' ? buttonSizeMap.xs.radiusInset : buttonSizeMap.s.radiusInset;
|
|
36
|
+
var commonStyles = "\n block-size: ".concat(buttonSize, ";\n border-radius: ").concat(buttonRadius, ";\n /* prevent issues in jsdom where pointer-events: none is inherited from the pseudo element */\n pointer-events: auto;\n\n /* zero-specificity ancestor :has() check */\n &:where(:not(:has(").concat(primaryDisabledSelector, ", ").concat(secondaryDisabledSelector, ")) &) {\n border: none;\n }\n \n &:where(:has(").concat(primaryDisabledSelector, ", ").concat(secondaryDisabledSelector, ") &) {\n &:is(").concat(euiDisabledSelector, ") {\n border: none;\n }\n }\n \n ");
|
|
37
|
+
return {
|
|
38
|
+
euiSplitButtonActionPrimary: /*#__PURE__*/css(commonStyles, " z-index:", euiTheme.levels.content, ";&:not(.euiButtonIcon){min-inline-size:", buttonMinWidth, "px;}&.euiButtonIcon{inline-size:", buttonSize, ";};label:euiSplitButtonActionPrimary;"),
|
|
39
|
+
euiSplitButtonActionSecondary: /*#__PURE__*/css(commonStyles, " inline-size:", buttonSize, ";;label:euiSplitButtonActionSecondary;")
|
|
40
|
+
};
|
|
45
41
|
};
|
|
46
42
|
export var euiSplitButtonDividerStyles = function euiSplitButtonDividerStyles(euiThemeContext, color) {
|
|
47
43
|
var euiTheme = euiThemeContext.euiTheme;
|
|
48
44
|
return {
|
|
49
|
-
divider: /*#__PURE__*/css("border-inline-start:", euiTheme.border.width.thin, " solid ", color, "
|
|
45
|
+
divider: /*#__PURE__*/css("block-size:calc(100% - ", euiTheme.size.s, ");border-inline-start:", euiTheme.border.width.thin, " solid ", color, ";", logicalCSS('margin-horizontal', euiTheme.size.xs), ";&:where(\n ", primaryDisabledSelector, " + &,\n :has(~ ", secondaryDisabledSelector, ")\n ){border-color:", euiTheme.colors.borderBaseDisabled, ";};label:divider;")
|
|
50
46
|
};
|
|
51
47
|
};
|
|
@@ -2,9 +2,9 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
4
|
var _excluded = ["className", "isIconOnly", "tooltipProps"],
|
|
5
|
-
_excluded2 = ["fill", "isDisabled", "isLoading"],
|
|
5
|
+
_excluded2 = ["fill", "isDisabled", "isLoading", "size"],
|
|
6
6
|
_excluded3 = ["className", "popoverProps", "tooltipProps"],
|
|
7
|
-
_excluded4 = ["fill", "isDisabled", "isLoading"];
|
|
7
|
+
_excluded4 = ["fill", "isDisabled", "isLoading", "size"];
|
|
8
8
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
9
9
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
10
10
|
/*
|
|
@@ -15,8 +15,9 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
15
15
|
* Side Public License, v 1.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
import React, { useContext } from 'react';
|
|
18
|
+
import React, { useContext, useMemo } from 'react';
|
|
19
19
|
import classNames from 'classnames';
|
|
20
|
+
import { useEuiTheme } from '../../../services';
|
|
20
21
|
import { EuiPopover } from '../../popover';
|
|
21
22
|
import { EuiToolTip } from '../../tool_tip';
|
|
22
23
|
import { EuiButton } from '../button';
|
|
@@ -30,17 +31,22 @@ export var EuiSplitButtonActionPrimary = function EuiSplitButtonActionPrimary(_r
|
|
|
30
31
|
isIconOnly = _ref.isIconOnly,
|
|
31
32
|
tooltipProps = _ref.tooltipProps,
|
|
32
33
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
34
|
+
var euiThemeContext = useEuiTheme();
|
|
33
35
|
var _useContext = useContext(EuiSplitButtonContext),
|
|
34
36
|
fill = _useContext.fill,
|
|
35
37
|
isDisabled = _useContext.isDisabled,
|
|
36
38
|
isLoading = _useContext.isLoading,
|
|
39
|
+
size = _useContext.size,
|
|
37
40
|
sharedRest = _objectWithoutProperties(_useContext, _excluded2);
|
|
38
41
|
var _isDisabled = !!isDisabled || isButtonDisabled(rest);
|
|
39
42
|
var _isLoading = !!isLoading || !!rest.isLoading;
|
|
40
43
|
var display = fill ? 'fill' : 'base';
|
|
41
44
|
var classes = classNames('euiSplitButtonActionPrimary', className);
|
|
42
|
-
var styles =
|
|
45
|
+
var styles = useMemo(function () {
|
|
46
|
+
return euiSplitButtonActionStyles(euiThemeContext, size);
|
|
47
|
+
}, [euiThemeContext, size]);
|
|
43
48
|
var actionProps = _objectSpread(_objectSpread(_objectSpread({}, rest), sharedRest), {}, {
|
|
49
|
+
size: size,
|
|
44
50
|
isDisabled: _isDisabled,
|
|
45
51
|
isLoading: _isLoading,
|
|
46
52
|
css: [styles.euiSplitButtonActionPrimary],
|
|
@@ -60,17 +66,22 @@ export var EuiSplitButtonActionSecondary = function EuiSplitButtonActionSecondar
|
|
|
60
66
|
popoverProps = _ref2.popoverProps,
|
|
61
67
|
tooltipProps = _ref2.tooltipProps,
|
|
62
68
|
rest = _objectWithoutProperties(_ref2, _excluded3);
|
|
69
|
+
var euiThemeContext = useEuiTheme();
|
|
63
70
|
var _useContext2 = useContext(EuiSplitButtonContext),
|
|
64
71
|
fill = _useContext2.fill,
|
|
65
72
|
isDisabled = _useContext2.isDisabled,
|
|
66
73
|
isLoading = _useContext2.isLoading,
|
|
74
|
+
size = _useContext2.size,
|
|
67
75
|
sharedRest = _objectWithoutProperties(_useContext2, _excluded4);
|
|
68
76
|
var _isDisabled = !!isDisabled || isButtonDisabled(rest);
|
|
69
77
|
var _isLoading = !!isLoading || !!rest.isLoading;
|
|
70
78
|
var display = fill ? 'fill' : 'base';
|
|
71
79
|
var classes = classNames('euiSplitButtonActionSecondary', className);
|
|
72
|
-
var styles =
|
|
80
|
+
var styles = useMemo(function () {
|
|
81
|
+
return euiSplitButtonActionStyles(euiThemeContext, size);
|
|
82
|
+
}, [euiThemeContext, size]);
|
|
73
83
|
var actionProps = _objectSpread(_objectSpread(_objectSpread({}, rest), sharedRest), {}, {
|
|
84
|
+
size: size,
|
|
74
85
|
display: display,
|
|
75
86
|
// enforce chevronSingleDown icon when a popover is rendered
|
|
76
87
|
iconType: popoverProps != null ? 'chevronSingleDown' : rest.iconType,
|
|
@@ -14,12 +14,14 @@ import { isButtonDisabled } from './button_display/_button_display';
|
|
|
14
14
|
* popover boundary isolation and isDisabled computation.
|
|
15
15
|
*/
|
|
16
16
|
export function useEuiButtonCommonProps(_ref) {
|
|
17
|
-
var _groupContext$isDisab, _groupContext$size, _groupContext$color, _groupContext$hasAria, _groupContext$fullWid;
|
|
17
|
+
var _groupContext$isDisab, _groupContext$size, _groupContext$color, _groupContext$hasAria, _groupContext$fullWid, _groupContext$display, _groupContext$fill;
|
|
18
18
|
var size = _ref.size,
|
|
19
19
|
color = _ref.color,
|
|
20
20
|
_isDisabled = _ref.isDisabled,
|
|
21
21
|
hasAriaDisabled = _ref.hasAriaDisabled,
|
|
22
22
|
fullWidth = _ref.fullWidth,
|
|
23
|
+
fill = _ref.fill,
|
|
24
|
+
display = _ref.display,
|
|
23
25
|
href = _ref.href,
|
|
24
26
|
disabled = _ref.disabled,
|
|
25
27
|
isLoading = _ref.isLoading;
|
|
@@ -35,6 +37,8 @@ export function useEuiButtonCommonProps(_ref) {
|
|
|
35
37
|
color: (_groupContext$color = groupContext.color) !== null && _groupContext$color !== void 0 ? _groupContext$color : color,
|
|
36
38
|
isDisabled: isDisabled,
|
|
37
39
|
hasAriaDisabled: (_groupContext$hasAria = groupContext.hasAriaDisabled) !== null && _groupContext$hasAria !== void 0 ? _groupContext$hasAria : hasAriaDisabled,
|
|
38
|
-
fullWidth: (_groupContext$fullWid = groupContext.fullWidth) !== null && _groupContext$fullWid !== void 0 ? _groupContext$fullWid : fullWidth
|
|
40
|
+
fullWidth: (_groupContext$fullWid = groupContext.fullWidth) !== null && _groupContext$fullWid !== void 0 ? _groupContext$fullWid : fullWidth,
|
|
41
|
+
display: (_groupContext$display = groupContext.display) !== null && _groupContext$display !== void 0 ? _groupContext$display : display,
|
|
42
|
+
fill: (_groupContext$fill = groupContext.fill) !== null && _groupContext$fill !== void 0 ? _groupContext$fill : fill
|
|
39
43
|
};
|
|
40
44
|
}
|
|
@@ -77,7 +77,9 @@ export var ColumnActions = /*#__PURE__*/memo(function (_ref) {
|
|
|
77
77
|
});
|
|
78
78
|
var actionsEnterKeyInstructions = useEuiI18n('euiDataGridHeaderCell.actionsEnterKeyInstructions', "Press the Enter key to view this column's actions");
|
|
79
79
|
var openActionsPopoverOnEnter = useCallback(function (e) {
|
|
80
|
-
|
|
80
|
+
// Only handle Enter when the cell div itself is focused,
|
|
81
|
+
// not when it bubbles up from the nested button
|
|
82
|
+
if (e.key === keys.ENTER && e.target === e.currentTarget) {
|
|
81
83
|
setIsPopoverOpen(true);
|
|
82
84
|
}
|
|
83
85
|
}, []);
|
|
@@ -15,6 +15,7 @@ import { useEuiMemoizedStyles } from '../../../services';
|
|
|
15
15
|
import { EuiFlexGroup, EuiFlexItem } from '../../flex';
|
|
16
16
|
import { useEuiI18n } from '../../i18n';
|
|
17
17
|
import { EuiTitle } from '../../title';
|
|
18
|
+
import { EuiToolTip } from '../../tool_tip';
|
|
18
19
|
import { EuiFlyoutCloseButton } from '../_flyout_close_button';
|
|
19
20
|
import { MIN_HISTORY_ITEMS } from '../const';
|
|
20
21
|
import { EuiFlyoutMenuContext } from '../flyout_menu_context';
|
|
@@ -36,7 +37,7 @@ import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
|
36
37
|
* @private
|
|
37
38
|
*/
|
|
38
39
|
export var EuiFlyoutMenu = function EuiFlyoutMenu(_ref) {
|
|
39
|
-
var _pagination$currentIn, _pagination$total;
|
|
40
|
+
var _historyItems$0$title, _historyItems$, _pagination$currentIn, _pagination$total;
|
|
40
41
|
var className = _ref.className,
|
|
41
42
|
title = _ref.title,
|
|
42
43
|
titleId = _ref.titleId,
|
|
@@ -72,6 +73,12 @@ export var EuiFlyoutMenu = function EuiFlyoutMenu(_ref) {
|
|
|
72
73
|
// Sub-components are presentational, so all `euiFlyoutMenu.*` tokens are
|
|
73
74
|
// resolved here, in the file that owns the namespace
|
|
74
75
|
var backButtonLabel = useEuiI18n('euiFlyoutMenu.back', 'Back');
|
|
76
|
+
// `historyItems` is ordered most-recent-first, so index 0 is the entry the
|
|
77
|
+
// back button navigates to
|
|
78
|
+
var previousPageTitle = (_historyItems$0$title = (_historyItems$ = historyItems[0]) === null || _historyItems$ === void 0 ? void 0 : _historyItems$.title) !== null && _historyItems$0$title !== void 0 ? _historyItems$0$title : '';
|
|
79
|
+
var backTooltipLabel = useEuiI18n('euiFlyoutMenu.back.tooltip', 'Back to {previousPage}', {
|
|
80
|
+
previousPage: previousPageTitle
|
|
81
|
+
});
|
|
75
82
|
var historyLabel = useEuiI18n('euiFlyoutMenu.history', 'History');
|
|
76
83
|
var recentlyVisitedLabel = useEuiI18n('euiFlyoutMenu.history.tooltip', 'Recently visited');
|
|
77
84
|
var paginationLabels = {
|
|
@@ -113,35 +120,51 @@ export var EuiFlyoutMenu = function EuiFlyoutMenu(_ref) {
|
|
|
113
120
|
labels: paginationLabels
|
|
114
121
|
}) : ___EmotionJSX(React.Fragment, null, hasBackButton && ___EmotionJSX(EuiFlexItem, {
|
|
115
122
|
grow: false
|
|
123
|
+
}, previousPageTitle ? ___EmotionJSX(EuiToolTip, {
|
|
124
|
+
content: backTooltipLabel
|
|
116
125
|
}, ___EmotionJSX(BackButton, _extends({
|
|
117
126
|
label: backButtonLabel
|
|
127
|
+
}, backButtonProps))) : ___EmotionJSX(BackButton, _extends({
|
|
128
|
+
label: backButtonLabel
|
|
118
129
|
}, backButtonProps))), showBackHistoryDivider && ___EmotionJSX(MenuDivider, null), hasHistory && ___EmotionJSX(EuiFlexItem, {
|
|
119
130
|
grow: false
|
|
120
131
|
}, ___EmotionJSX(HistoryPopover, {
|
|
121
132
|
items: historyItems,
|
|
122
133
|
historyLabel: historyLabel,
|
|
123
134
|
recentlyVisitedLabel: recentlyVisitedLabel
|
|
124
|
-
}))), showLeadingBoundaryDivider && ___EmotionJSX(MenuDivider, null), leadingActions.
|
|
135
|
+
}))), showLeadingBoundaryDivider && ___EmotionJSX(MenuDivider, null), leadingActions.length > 0 && ___EmotionJSX(EuiFlexItem, {
|
|
136
|
+
grow: false,
|
|
137
|
+
css: styles.euiFlyoutMenu__actions
|
|
138
|
+
}, ___EmotionJSX(EuiFlexGroup, {
|
|
139
|
+
gutterSize: "s",
|
|
140
|
+
alignItems: "center",
|
|
141
|
+
responsive: false
|
|
142
|
+
}, leadingActions.map(function (action, actionIndex) {
|
|
125
143
|
return ___EmotionJSX(EuiFlexItem, {
|
|
126
144
|
key: "leading-action-".concat(actionIndex),
|
|
127
|
-
grow: false
|
|
128
|
-
css: styles.euiFlyoutMenu__actions
|
|
145
|
+
grow: false
|
|
129
146
|
}, ___EmotionJSX(MenuActionButton, {
|
|
130
147
|
action: action
|
|
131
148
|
}));
|
|
132
|
-
}), titleNode && ___EmotionJSX(EuiFlexItem, {
|
|
149
|
+
}))), titleNode && ___EmotionJSX(EuiFlexItem, {
|
|
133
150
|
grow: false
|
|
134
151
|
}, titleNode), ___EmotionJSX(EuiFlexItem, {
|
|
135
152
|
grow: true
|
|
136
|
-
}), effectiveTrailingActions.
|
|
153
|
+
}), effectiveTrailingActions.length > 0 && ___EmotionJSX(EuiFlexItem, {
|
|
154
|
+
grow: false,
|
|
155
|
+
css: styles.euiFlyoutMenu__actions
|
|
156
|
+
}, ___EmotionJSX(EuiFlexGroup, {
|
|
157
|
+
gutterSize: "s",
|
|
158
|
+
alignItems: "center",
|
|
159
|
+
responsive: false
|
|
160
|
+
}, effectiveTrailingActions.map(function (action, actionIndex) {
|
|
137
161
|
return ___EmotionJSX(EuiFlexItem, {
|
|
138
162
|
key: "trailing-action-".concat(actionIndex),
|
|
139
|
-
grow: false
|
|
140
|
-
css: styles.euiFlyoutMenu__actions
|
|
163
|
+
grow: false
|
|
141
164
|
}, ___EmotionJSX(MenuActionButton, {
|
|
142
165
|
action: action
|
|
143
166
|
}));
|
|
144
|
-
}), !hideCloseButton && ___EmotionJSX(CloseButtonSpacer, {
|
|
167
|
+
}))), !hideCloseButton && ___EmotionJSX(CloseButtonSpacer, {
|
|
145
168
|
showDivider: showTrailingCloseDivider
|
|
146
169
|
})), !hideCloseButton && ___EmotionJSX(EuiFlyoutCloseButton, {
|
|
147
170
|
onClose: handleClose,
|