@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
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
1
2
|
var _excluded = ["className", "buttonSize", "color", "idSelected", "idToSelectedMap", "isDisabled", "hasAriaDisabled", "isFullWidth", "isIconOnly", "legend", "name", "onChange", "options", "type"],
|
|
2
|
-
_excluded2 = ["className", "children", "legend", "buttonSize", "variant", "gutterSize", "isDisabled", "hasAriaDisabled", "isFullWidth", "onChange"];
|
|
3
|
+
_excluded2 = ["className", "children", "legend", "buttonSize", "variant", "gutterSize", "isDisabled", "hasAriaDisabled", "isFullWidth", "showDividers", "wrap", "layout", "onChange"];
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
8
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
3
9
|
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); }
|
|
4
10
|
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; }
|
|
5
11
|
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; }
|
|
@@ -19,7 +25,24 @@ import { EuiScreenReaderOnly } from '../../accessibility';
|
|
|
19
25
|
import { EuiButtonGroupButton } from './button_group_button';
|
|
20
26
|
import { EuiButtonContext } from '../button_context';
|
|
21
27
|
import { euiButtonGroupStyles, euiButtonGroupButtonsStyles } from './button_group.styles';
|
|
28
|
+
|
|
29
|
+
// removes outer fragment wrappers only; no nested traversal of children
|
|
30
|
+
// uses forEach over .toArray() to avoid mutating keys; only unwraps one Fragment level
|
|
22
31
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
32
|
+
function flattenButtonGroupChildren(children) {
|
|
33
|
+
var result = [];
|
|
34
|
+
React.Children.forEach(children, function (child) {
|
|
35
|
+
if (! /*#__PURE__*/React.isValidElement(child)) return;
|
|
36
|
+
if (child.type === React.Fragment) {
|
|
37
|
+
React.Children.forEach(child.props.children, function (fragmentChild) {
|
|
38
|
+
if ( /*#__PURE__*/React.isValidElement(fragmentChild)) result.push(fragmentChild);
|
|
39
|
+
});
|
|
40
|
+
} else {
|
|
41
|
+
result.push(child);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
23
46
|
var EuiButtonGroupOptions = function EuiButtonGroupOptions(_ref) {
|
|
24
47
|
var className = _ref.className,
|
|
25
48
|
_ref$buttonSize = _ref.buttonSize,
|
|
@@ -200,9 +223,9 @@ EuiButtonGroupOptions.propTypes = {
|
|
|
200
223
|
idToSelectedMap: PropTypes.shape({})
|
|
201
224
|
};
|
|
202
225
|
export var BUTTON_GROUP_GUTTER_SIZES = ['none', 'xs', 's', 'm', 'l', 'xl'];
|
|
203
|
-
var EuiButtonGroupChildren = function EuiButtonGroupChildren(_ref2) {
|
|
226
|
+
export var EuiButtonGroupChildren = function EuiButtonGroupChildren(_ref2) {
|
|
204
227
|
var className = _ref2.className,
|
|
205
|
-
|
|
228
|
+
_children = _ref2.children,
|
|
206
229
|
legend = _ref2.legend,
|
|
207
230
|
_ref2$buttonSize = _ref2.buttonSize,
|
|
208
231
|
buttonSize = _ref2$buttonSize === void 0 ? 's' : _ref2$buttonSize,
|
|
@@ -216,36 +239,63 @@ var EuiButtonGroupChildren = function EuiButtonGroupChildren(_ref2) {
|
|
|
216
239
|
hasAriaDisabled = _ref2$hasAriaDisabled === void 0 ? false : _ref2$hasAriaDisabled,
|
|
217
240
|
_ref2$isFullWidth = _ref2.isFullWidth,
|
|
218
241
|
isFullWidth = _ref2$isFullWidth === void 0 ? false : _ref2$isFullWidth,
|
|
242
|
+
_ref2$showDividers = _ref2.showDividers,
|
|
243
|
+
showDividers = _ref2$showDividers === void 0 ? false : _ref2$showDividers,
|
|
244
|
+
_ref2$wrap = _ref2.wrap,
|
|
245
|
+
wrap = _ref2$wrap === void 0 ? true : _ref2$wrap,
|
|
246
|
+
_ref2$layout = _ref2.layout,
|
|
247
|
+
layout = _ref2$layout === void 0 ? 'horizontal' : _ref2$layout,
|
|
219
248
|
_onChange = _ref2.onChange,
|
|
220
249
|
rest = _objectWithoutProperties(_ref2, _excluded2);
|
|
250
|
+
var isSegmented = variant === 'segmented';
|
|
251
|
+
var hasGutterSize = variant === 'default' && gutterSize !== 'none';
|
|
221
252
|
var wrapperCssStyles = [euiButtonGroupStyles.euiButtonGroup, isFullWidth && euiButtonGroupStyles.fullWidth];
|
|
222
253
|
var styles = useEuiMemoizedStyles(euiButtonGroupButtonsStyles);
|
|
223
|
-
var cssStyles = [styles.euiButtonGroup__buttons,
|
|
254
|
+
var cssStyles = [styles.euiButtonGroup__buttons, hasGutterSize && styles.gutterSize[gutterSize], isSegmented && !wrap && styles.noWrap];
|
|
255
|
+
var containerCssStyles = [styles.euiButtonGroup__container, isFullWidth && layout !== 'vertical' && styles.fullWidth];
|
|
224
256
|
var classes = classNames('euiButtonGroup', {
|
|
225
257
|
'euiButtonGroup-isDisabled': isDisabled
|
|
226
258
|
}, className);
|
|
227
259
|
var contextValue = useMemo(function () {
|
|
228
|
-
return {
|
|
260
|
+
return _objectSpread({
|
|
229
261
|
size: buttonSize,
|
|
230
262
|
isDisabled: isDisabled || undefined,
|
|
231
263
|
hasAriaDisabled: hasAriaDisabled || undefined,
|
|
232
264
|
fullWidth: isFullWidth
|
|
233
|
-
}
|
|
234
|
-
|
|
265
|
+
}, isSegmented && {
|
|
266
|
+
display: 'base',
|
|
267
|
+
color: 'text',
|
|
268
|
+
fill: false
|
|
269
|
+
});
|
|
270
|
+
}, [buttonSize, isDisabled, hasAriaDisabled, isFullWidth, isSegmented]);
|
|
271
|
+
|
|
272
|
+
// wrap children in a wrapper to be able to apply required styles
|
|
273
|
+
var children = isSegmented ? flattenButtonGroupChildren(_children).map(function (child, index) {
|
|
274
|
+
var _child$key;
|
|
275
|
+
return ___EmotionJSX("div", {
|
|
276
|
+
key: (_child$key = child.key) !== null && _child$key !== void 0 ? _child$key : "euiButtonGroupItem-".concat(index),
|
|
277
|
+
className: "euiButtonGroup__item"
|
|
278
|
+
}, child);
|
|
279
|
+
}) : _children;
|
|
235
280
|
return ___EmotionJSX("div", _extends({
|
|
236
281
|
css: wrapperCssStyles,
|
|
237
282
|
className: classes,
|
|
238
283
|
role: "group",
|
|
239
284
|
"data-variant": variant,
|
|
240
285
|
"data-size": buttonSize,
|
|
286
|
+
"data-layout": isSegmented ? layout : undefined,
|
|
287
|
+
"data-dividers": isSegmented && showDividers || undefined,
|
|
241
288
|
"aria-label": legend,
|
|
242
289
|
"aria-disabled": isDisabled || undefined
|
|
243
290
|
}, rest), ___EmotionJSX("div", {
|
|
291
|
+
css: containerCssStyles,
|
|
292
|
+
className: "euiButtonGroup__container"
|
|
293
|
+
}, ___EmotionJSX("div", {
|
|
244
294
|
css: cssStyles,
|
|
245
295
|
className: "euiButtonGroup__buttons"
|
|
246
296
|
}, ___EmotionJSX(EuiButtonContext.Provider, {
|
|
247
297
|
value: contextValue
|
|
248
|
-
}, children)));
|
|
298
|
+
}, children))));
|
|
249
299
|
};
|
|
250
300
|
|
|
251
301
|
/* Overloaded call signatures let one `EuiButtonGroup` component support both
|
|
@@ -267,27 +317,55 @@ EuiButtonGroupChildren.propTypes = {
|
|
|
267
317
|
/**
|
|
268
318
|
* Pass button components (`EuiButton`, `EuiButtonEmpty`, `EuiButtonIcon`) as children,
|
|
269
319
|
* some specific wrappers, like `EuiToolTip` and `EuiPopover` are allowed.
|
|
320
|
+
*
|
|
321
|
+
* Do not pass children as combined custom component. Each child needs to be a standalone component.
|
|
270
322
|
*/
|
|
271
323
|
children: PropTypes.node.isRequired,
|
|
272
324
|
/**
|
|
273
325
|
* Typical sizing is `s`. Medium `m` size should be reserved for major features.
|
|
326
|
+
* @default 's'
|
|
274
327
|
*/
|
|
275
328
|
buttonSize: PropTypes.oneOf(["s", "m"]),
|
|
276
329
|
/**
|
|
277
330
|
* Defines the type of a button group, which renders visually and functionally different:
|
|
278
331
|
* - default: arranges buttons in a horizontal row with optional gutter via `gutterSize`
|
|
332
|
+
* - segmented: arranges buttons in a horizontal or vertical row with no gutter.
|
|
333
|
+
* The buttons are placed inset and dividers can optionally be shown between them.
|
|
334
|
+
* @default 'default'
|
|
279
335
|
*/
|
|
280
|
-
variant: PropTypes.oneOf(["default"]),
|
|
336
|
+
variant: PropTypes.oneOf(["default", "segmented"]),
|
|
281
337
|
/**
|
|
282
338
|
* Defines the gutter size between children buttons.
|
|
283
339
|
* Applies only when `variant="default"`.
|
|
340
|
+
* @default 's'
|
|
284
341
|
*/
|
|
285
342
|
gutterSize: PropTypes.any,
|
|
286
343
|
/**
|
|
287
344
|
* Expands the whole group to the full width of the container.
|
|
288
345
|
* `EuiButton` children will stretch to fill the available space via their `fullWidth` prop.
|
|
346
|
+
* Does not apply when `layout="vertical"`.
|
|
347
|
+
* @default false
|
|
289
348
|
*/
|
|
290
349
|
isFullWidth: PropTypes.bool,
|
|
350
|
+
/**
|
|
351
|
+
* Shows dividers between buttons.
|
|
352
|
+
* Applies only when `variant="segmented"`.
|
|
353
|
+
* @default false
|
|
354
|
+
*/
|
|
355
|
+
showDividers: PropTypes.bool,
|
|
356
|
+
/**
|
|
357
|
+
* Defines the layout direction of the button group.
|
|
358
|
+
* `layout="vertical"` should only be used with EuiButtonIcon children.
|
|
359
|
+
* Applies only when `variant="segmented"`.
|
|
360
|
+
* @default 'horizontal'
|
|
361
|
+
*/
|
|
362
|
+
layout: PropTypes.oneOf(["horizontal", "vertical"]),
|
|
363
|
+
/**
|
|
364
|
+
* Defines if buttons wrap or shrink.
|
|
365
|
+
* Applies only when `variant="segmented"`.
|
|
366
|
+
* @default true
|
|
367
|
+
*/
|
|
368
|
+
wrap: PropTypes.bool,
|
|
291
369
|
/**
|
|
292
370
|
* Callback fired when a child button is selected.
|
|
293
371
|
* Returns the `id` of the clicked option.
|
|
@@ -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: {
|
|
@@ -38,7 +38,7 @@ export var EuiButtonIcon = function EuiButtonIcon(_ref) {
|
|
|
38
38
|
_ref$type = _ref.type,
|
|
39
39
|
type = _ref$type === void 0 ? 'button' : _ref$type,
|
|
40
40
|
_ref$display = _ref.display,
|
|
41
|
-
|
|
41
|
+
_display = _ref$display === void 0 ? 'empty' : _ref$display,
|
|
42
42
|
target = _ref.target,
|
|
43
43
|
rel = _ref.rel,
|
|
44
44
|
_ref$size = _ref.size,
|
|
@@ -52,6 +52,7 @@ export var EuiButtonIcon = function EuiButtonIcon(_ref) {
|
|
|
52
52
|
color: _color,
|
|
53
53
|
isDisabled: _isDisabled,
|
|
54
54
|
hasAriaDisabled: _hasAriaDisabled,
|
|
55
|
+
display: _display,
|
|
55
56
|
href: href,
|
|
56
57
|
disabled: disabled,
|
|
57
58
|
isLoading: isLoading
|
|
@@ -60,7 +61,8 @@ export var EuiButtonIcon = function EuiButtonIcon(_ref) {
|
|
|
60
61
|
color = _useEuiButtonCommonPr.color,
|
|
61
62
|
isDisabled = _useEuiButtonCommonPr.isDisabled,
|
|
62
63
|
_useEuiButtonCommonPr2 = _useEuiButtonCommonPr.hasAriaDisabled,
|
|
63
|
-
hasAriaDisabled = _useEuiButtonCommonPr2 === void 0 ? false : _useEuiButtonCommonPr2
|
|
64
|
+
hasAriaDisabled = _useEuiButtonCommonPr2 === void 0 ? false : _useEuiButtonCommonPr2,
|
|
65
|
+
display = _useEuiButtonCommonPr.display;
|
|
64
66
|
var _useEuiDisabledElemen = useEuiDisabledElement({
|
|
65
67
|
isDisabled: isDisabled,
|
|
66
68
|
hasAriaDisabled: hasAriaDisabled,
|
|
@@ -146,7 +148,7 @@ EuiButtonIcon.propTypes = {
|
|
|
146
148
|
type: PropTypes.any,
|
|
147
149
|
href: PropTypes.string,
|
|
148
150
|
onClick: PropTypes.func,
|
|
149
|
-
iconType: PropTypes.oneOfType([PropTypes.oneOf(["accessibility", "addDataApp", "addToChat", "addToDashboard", "advancedSettingsApp", "agentApp", "aggregate", "alignBottom", "alignBottomLeft", "alignBottomRight", "alignCenterHorizontal", "alignCenterVertical", "alignLeft", "alignRight", "alignTop", "alignTopLeft", "alignTopRight", "analyzeEvent", "annotation", "chartAnomaly", "anomalySwimLane", "apmApp", "chartWaterfall", "appSearchApp", "apps", "chevronSingleDown", "chevronSingleLeft", "chevronSingleRight", "chevronSingleUp", "chevronLimitLeft", "chevronLimitRight", "article", "asterisk", "at", "archive", "axisX", "axisYLeft", "axisYRight", "auditbeatApp", "backgroundTask", "bell", "bellSlash", "beta", "bolt", "boxesVertical", "branch", "briefcase", "branchUser", "broom", "brush", "bug", "bulb", "bullseye", "calendar", "canvasApp", "casesApp", "chartChangePoint", "chartArea", "visArea", "chartAreaStack", "chartBarHorizontal", "chartBarHorizontalStack", "chartBarVertical", "visBarVertical", "chartBarVerticalStack", "chartGauge", "visGauge", "chartHeatmap", "chartLine", "visLine", "chartPie", "visPie", "chartTagCloud", "chartThreshold", "check", "checkCircle", "checkCircleFill", "popper", "classificationJob", "clickLeft", "clickRight", "clock", "clockCounter", "clockControl", "cloud", "cloudDrizzle", "cloudStormy", "cloudSunny", "cluster", "code", "codeApp", "paintBucket", "commandLine", "comment", "editorComment", "compare", "processor", "compute", "consoleApp", "container", "continuityAbove", "continuityAboveBelow", "continuityBelow", "continuityWithin", "contrast", "contrastFill", "controls", "copy", "crossProjectSearch", "createAdvancedJob", "createGenericJob", "createGeoJob", "createMultiMetricJob", "createPopulationJob", "createSingleMetricJob", "cross", "crossClusterReplicationApp", "crossCircle", "crosshair", "money", "scissors", "dashboardApp", "dashedCircle", "dataVisualizer", "database", "display", "devToolsApp", "discoverApp", "distributeHorizontal", "distributeVertical", "download", "drag", "dragHorizontal", "dragVertical", "document", "documentation", "documents", "dot", "dotInCircle", "chevronDoubleLeft", "chevronDoubleRight", "ellipsis", "textAlignCenter", "textAlignLeft", "textAlignRight", "textBold", "listCheck", "textHeading", "textItalic", "listNumber", "redo", "textStrike", "table", "visTable", "textUnderline", "undo", "listBullet", "list", "mail", "empty", "emsApp", "endpoint", "query", "eraser", "error", "errorFill", "esqlVis", "logOut", "maximize", "export", "upload", "external", "eye", "eyeSlash", "faceHappy", "faceNeutral", "faceSad", "tableInfo", "filebeatApp", "filter", "filterExclude", "filterIgnore", "filterInclude", "flask", "flag", "fleetApp", "fold", "folder", "folderClosed", "folderClose", "folderCheck", "folderExclamation", "folderOpen", "folderOpened", "frameNext", "framePrevious", "fullScreen", "fullScreenExit", "function", "gear", "gisApp", "globe", "gradient", "graphApp", "grid", "grokApp", "heart", "heartbeatApp", "help", "home", "hourglass", "if", "info", "image", "index", "indexClose", "tableCross", "indexEdit", "tablePencil", "indexManagementApp", "mapping", "indexOpen", "tablePlus", "indexPatternApp", "indexRollupApp", "indexRuntime", "tablePlay", "indexSettings", "tableGear", "tableTime", "infinity", "inputOutput", "inspect", "ip", "key", "keyboard", "queryField", "kqlFunction", "queryOperand", "querySelector", "queryValue", "kubernetesNode", "kubernetesPod", "cube", "rocket", "layers", "lensApp", "text", "lineBreak", "lineBreakSlash", "lineDash", "lineDot", "lineSolid", "link", "linkSlash", "lock", "lockOpen", "pattern", "logRateAnalysis", "logoAWS", "logoAWSMono", "logoAerospike", "logoApache", "logoAppSearch", "logoAzure", "logoAzureMono", "logoBeats", "logoBusinessAnalytics", "logoCeph", "logoCloud", "logoCloudEnterprise", "logoCode", "logoCodesandbox", "logoCouchbase", "logoDocker", "logoDropwizard", "logoElastic", "logoElasticStack", "logoElasticsearch", "logoEnterpriseSearch", "logoEtcd", "logoGCP", "logoGCPMono", "logoGithub", "logoGmail", "logoGolang", "logoGoogleG", "logoHAproxy", "logoIBM", "logoIBMMono", "logoKafka", "logoKibana", "logoKubernetes", "logoLogging", "logoLogstash", "logoMaps", "logoMemcached", "logoMetrics", "logoMongodb", "logoMySQL", "logoNginx", "logoObservability", "logoOsquery", "logoPhp", "logoPostgres", "logoPrometheus", "logoRabbitmq", "logoRedis", "logoSecurity", "logoSiteSearch", "logoSketch", "logoSlack", "logoUptime", "logoVectorDB", "logoVulnerabilityManagement", "logoWebhook", "logoWindows", "logoWorkplaceSearch", "logsApp", "logstashFilter", "logstashInput", "logstashOutput", "queue", "machineLearningApp", "magnet", "magnify", "search", "magnifyExclamation", "magnifyMinus", "magnifyPlus", "managementApp", "map", "mapMarker", "waypoint", "megaphone", "memory", "menu", "menuDown", "menuLeft", "menuRight", "menuUp", "merge", "metricbeatApp", "metricsApp", "minimize", "minus", "minusCircle", "minusSquare", "mobile", "monitoringApp", "moon", "move", "namespace", "nested", "vectorTriangle", "notebookApp", "number", "wifiSlash", "wifi", "outlierDetectionJob", "package", "packetbeatApp", "pageSelect", "pagesSelect", "documentsCheck", "palette", "paperClip", "partial", "pause", "payment", "pencil", "percent", "pin", "pinFill", "pinFilled", "pipelineApp", "pivot", "play", "plugs", "plus", "plusCircle", "plusSquare", "presentation", "productAgent", "productCloudInfra", "productDashboard", "productDiscover", "productML", "productStreamsClassic", "productStreamsWired", "send", "question", "quote", "radar", "readOnly", "recentlyViewedApp", "refresh", "regressionJob", "reporter", "reportingApp", "return", "save", "savedObjectsApp", "scale", "searchProfilerApp", "section", "securityAnalyticsApp", "securityApp", "securitySignalDetected", "securitySignalResolved", "server", "sessionViewer", "shard", "share", "significantEvents", "singleMetricViewer", "snowflake", "sortAscending", "sortDescending", "sortDown", "sortLeft", "sortRight", "sortUp", "sortable", "spaces", "spacesApp", "sparkles", "sqlApp", "star", "starEmpty", "starEmptySpace", "starFill", "starFilled", "starFillSpace", "starMinusEmpty", "starMinusFill", "starPlusEmpty", "starPlusFill", "stats", "stop", "stopFill", "stopSlash", "storage", "string", "sun", "swatchInput", "symlink", "tableDensityHigh", "tableDensityLow", "tableOfContents", "tag", "tear", "thermometer", "temperature", "thumbDown", "thumbUp", "timeline", "timelineWithArrow", "timelinePointer", "timelionApp", "refreshTime", "transitionBottomIn", "transitionBottomOut", "transitionLeftIn", "transitionLeftOut", "transitionTopIn", "transitionTopOut", "translate", "trash", "unfold", "upgradeAssistantApp", "uptimeApp", "user", "users", "usersRolesApp", "unarchive", "vectorSquare", "videoPlayer", "visGoal", "chartMetric", "visTimelion", "visVisualBuilder", "visualizeApp", "vulnerabilityManagementApp", "warning", "alert", "warningFill", "watchesApp", "web", "wordWrap", "wordWrapDisabled", "workflowsApp", "workflow", "workplaceSearchApp", "wrench", "tokenAlias", "tokenAnnotation", "tokenArray", "tokenBinary", "tokenBoolean", "tokenClass", "tokenCompletionSuggester", "tokenConstant", "tokenDate", "tokenDimension", "tokenElement", "tokenEnum", "tokenEnumMember", "tokenEvent", "tokenException", "tokenField", "tokenFile", "tokenFlattened", "tokenFunction", "tokenGeo", "tokenHistogram", "tokenInterface", "tokenIP", "tokenJoin", "tokenKey", "tokenKeyword", "tokenMethod", "tokenMetricCounter", "tokenMetricGauge", "tokenModule", "tokenNamespace", "tokenNested", "tokenNull", "tokenNumber", "tokenObject", "tokenOperator", "tokenPackage", "tokenParameter", "tokenPercolator", "tokenProperty", "tokenRange", "tokenRankFeature", "tokenRankFeatures", "tokenRepo", "tokenSearchType", "tokenSemanticText", "tokenShape", "tokenString", "tokenStruct", "tokenSymbol", "tokenTag", "tokenText", "tokenTokenCount", "tokenVariable", "tokenVectorDense", "tokenVectorSparse"]).isRequired, PropTypes.string.isRequired, PropTypes.elementType.isRequired]).isRequired,
|
|
151
|
+
iconType: PropTypes.oneOfType([PropTypes.oneOf(["accessibility", "addDataApp", "addToChat", "addToDashboard", "advancedSettingsApp", "agentApp", "aggregate", "alignBottom", "alignBottomLeft", "alignBottomRight", "alignCenterHorizontal", "alignCenterVertical", "alignLeft", "alignRight", "alignTop", "alignTopLeft", "alignTopRight", "analyzeEvent", "annotation", "chartAnomaly", "anomalySwimLane", "apmApp", "chartWaterfall", "appSearchApp", "apps", "chevronSingleDown", "chevronSingleLeft", "chevronSingleRight", "chevronSingleUp", "chevronLimitLeft", "chevronLimitRight", "article", "asterisk", "at", "archive", "axisX", "axisYLeft", "axisYRight", "auditbeatApp", "backgroundTask", "bell", "bellSlash", "beta", "bolt", "boxesVertical", "branch", "briefcase", "branchUser", "broom", "brush", "bug", "bulb", "bullseye", "calendar", "canvasApp", "casesApp", "chartChangePoint", "chartArea", "visArea", "chartAreaStack", "chartBarHorizontal", "chartBarHorizontalStack", "chartBarVertical", "visBarVertical", "chartBarVerticalStack", "chartGauge", "visGauge", "chartHeatmap", "chartLine", "visLine", "chartPie", "visPie", "chartTagCloud", "chartThreshold", "check", "checkCircle", "checkCircleFill", "popper", "classificationJob", "clickLeft", "clickRight", "clock", "clockCounter", "clockControl", "cloud", "cloudDrizzle", "cloudStormy", "cloudSunny", "cluster", "code", "codeApp", "paintBucket", "commandLine", "comment", "editorComment", "compare", "processor", "compute", "consoleApp", "container", "continuityAbove", "continuityAboveBelow", "continuityBelow", "continuityWithin", "contrast", "contrastFill", "controls", "copy", "crossProjectSearch", "createAdvancedJob", "createGenericJob", "createGeoJob", "createMultiMetricJob", "createPopulationJob", "createSingleMetricJob", "cross", "crossClusterReplicationApp", "crossCircle", "crosshair", "cursorDefault", "money", "scissors", "dashboardApp", "dashedCircle", "dataVisualizer", "database", "display", "devToolsApp", "discoverApp", "distributeHorizontal", "distributeVertical", "download", "drag", "dragHorizontal", "dragVertical", "document", "documentation", "documents", "dot", "dotInCircle", "chevronDoubleLeft", "chevronDoubleRight", "ellipsis", "textAlignCenter", "textAlignLeft", "textAlignRight", "textBold", "listCheck", "textHeading", "textItalic", "listNumber", "redo", "textStrike", "table", "visTable", "textUnderline", "undo", "listBullet", "list", "mail", "empty", "emsApp", "endpoint", "query", "eraser", "error", "errorFill", "esqlVis", "logIn", "logOut", "maximize", "export", "upload", "external", "eye", "eyeSlash", "faceHappy", "faceNeutral", "faceSad", "tableInfo", "filebeatApp", "filter", "filterExclude", "filterIgnore", "filterInclude", "flask", "flag", "fleetApp", "fold", "folder", "folderClosed", "folderClose", "folderCheck", "folderExclamation", "folderOpen", "folderOpened", "frameNext", "framePrevious", "fullScreen", "fullScreenExit", "function", "gear", "gisApp", "globe", "gradient", "graphApp", "grid", "grokApp", "heart", "heartbeatApp", "help", "home", "hourglass", "if", "info", "image", "index", "indexClose", "tableCross", "indexEdit", "tablePencil", "indexManagementApp", "mapping", "indexOpen", "tablePlus", "indexPatternApp", "indexRollupApp", "indexRuntime", "tablePlay", "indexSettings", "tableGear", "tableTime", "infinity", "inputOutput", "inspect", "ip", "key", "keyboard", "queryField", "kqlFunction", "queryOperand", "querySelector", "queryValue", "kubernetesNode", "kubernetesPod", "cube", "rocket", "layers", "lensApp", "text", "lineBreak", "lineBreakSlash", "lineDash", "lineDot", "lineSolid", "link", "linkSlash", "lock", "lockOpen", "pattern", "logRateAnalysis", "logoAWS", "logoAWSMono", "logoAerospike", "logoApache", "logoAppSearch", "logoAzure", "logoAzureMono", "logoBeats", "logoBusinessAnalytics", "logoCeph", "logoCloud", "logoCloudEnterprise", "logoCode", "logoCodesandbox", "logoCouchbase", "logoDocker", "logoDropwizard", "logoElastic", "logoElasticStack", "logoElasticsearch", "logoEnterpriseSearch", "logoEtcd", "logoGCP", "logoGCPMono", "logoGithub", "logoGmail", "logoGolang", "logoGoogleG", "logoHAproxy", "logoIBM", "logoIBMMono", "logoKafka", "logoKibana", "logoKubernetes", "logoLogging", "logoLogstash", "logoMaps", "logoMemcached", "logoMetrics", "logoMongodb", "logoMySQL", "logoNginx", "logoObservability", "logoOsquery", "logoPhp", "logoPostgres", "logoPrometheus", "logoRabbitmq", "logoRedis", "logoSecurity", "logoSiteSearch", "logoSketch", "logoSlack", "logoUptime", "logoVectorDB", "logoVulnerabilityManagement", "logoWebhook", "logoWindows", "logoWorkplaceSearch", "logsApp", "logstashFilter", "logstashInput", "logstashOutput", "queue", "machineLearningApp", "magnet", "magnify", "search", "magnifyExclamation", "magnifyMinus", "magnifyPlus", "managementApp", "map", "mapMarker", "waypoint", "megaphone", "memory", "menu", "menuDown", "menuLeft", "menuRight", "menuUp", "merge", "metricbeatApp", "metricsApp", "minimize", "minus", "minusCircle", "minusSquare", "mobile", "monitoringApp", "moon", "move", "namespace", "nested", "vectorTriangle", "notebookApp", "number", "wifiSlash", "wifi", "outlierDetectionJob", "package", "packetbeatApp", "pageSelect", "pagesSelect", "documentsCheck", "palette", "paperClip", "partial", "pause", "payment", "pencil", "percent", "pin", "pinFill", "pinFilled", "pipelineApp", "pivot", "play", "plugs", "plus", "plusCircle", "plusSquare", "presentation", "productAgent", "productCloudInfra", "productDashboard", "productDiscover", "productML", "productStreamsClassic", "productStreamsWired", "send", "question", "quote", "radar", "readOnly", "recentlyViewedApp", "refresh", "regressionJob", "reporter", "reportingApp", "return", "routeSplit", "save", "savedObjectsApp", "scale", "searchProfilerApp", "section", "securityAnalyticsApp", "securityApp", "securitySignalDetected", "securitySignalResolved", "server", "sessionViewer", "shard", "share", "significantEvents", "singleMetricViewer", "snowflake", "sortAscending", "sortDescending", "sortDown", "sortLeft", "sortRight", "sortUp", "sortable", "spaces", "spacesApp", "sparkles", "sqlApp", "star", "starEmpty", "starEmptySpace", "starFill", "starFilled", "starFillSpace", "starMinusEmpty", "starMinusFill", "starPlusEmpty", "starPlusFill", "stats", "stop", "stopFill", "stopSlash", "storage", "string", "sun", "swatchInput", "symlink", "tableDensityHigh", "tableDensityLow", "tableOfContents", "tag", "tear", "thermometer", "temperature", "thumbDown", "thumbUp", "timeline", "timelineWithArrow", "timelinePointer", "timelionApp", "refreshTime", "transitionBottomIn", "transitionBottomOut", "transitionLeftIn", "transitionLeftOut", "transitionTopIn", "transitionTopOut", "translate", "trash", "unfold", "upgradeAssistantApp", "uptimeApp", "user", "users", "usersRolesApp", "unarchive", "vectorSquare", "videoPlayer", "visGoal", "chartMetric", "visTimelion", "visVisualBuilder", "visualizeApp", "vulnerabilityManagementApp", "warning", "alert", "warningFill", "watchesApp", "web", "wordWrap", "wordWrapDisabled", "workflowsApp", "workflow", "workplaceSearchApp", "wrench", "tokenAlias", "tokenAnnotation", "tokenArray", "tokenBinary", "tokenBoolean", "tokenClass", "tokenCompletionSuggester", "tokenConstant", "tokenDate", "tokenDimension", "tokenElement", "tokenEnum", "tokenEnumMember", "tokenEvent", "tokenException", "tokenField", "tokenFile", "tokenFlattened", "tokenFunction", "tokenGeo", "tokenHistogram", "tokenInterface", "tokenIP", "tokenJoin", "tokenKey", "tokenKeyword", "tokenMethod", "tokenMetricCounter", "tokenMetricGauge", "tokenModule", "tokenNamespace", "tokenNested", "tokenNull", "tokenNumber", "tokenObject", "tokenOperator", "tokenPackage", "tokenParameter", "tokenPercolator", "tokenProperty", "tokenRange", "tokenRankFeature", "tokenRankFeatures", "tokenRepo", "tokenSearchType", "tokenSemanticText", "tokenShape", "tokenString", "tokenStruct", "tokenSymbol", "tokenTag", "tokenText", "tokenTokenCount", "tokenVariable", "tokenVectorDense", "tokenVectorSparse"]).isRequired, PropTypes.string.isRequired, PropTypes.elementType.isRequired]).isRequired,
|
|
150
152
|
/**
|
|
151
153
|
* Any of the named color palette options.
|
|
152
154
|
*
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
1
2
|
var _excluded = ["className", "children", "size", "color", "fill", "isDisabled", "hasAriaDisabled", "isLoading"];
|
|
2
3
|
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); }
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
8
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
3
9
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
4
10
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
5
11
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
@@ -19,7 +25,8 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
|
|
|
19
25
|
import classNames from 'classnames';
|
|
20
26
|
import PropTypes from "prop-types";
|
|
21
27
|
import React, { Children, Fragment, isValidElement, useMemo } from 'react';
|
|
22
|
-
import {
|
|
28
|
+
import { getTokenName } from '@elastic/eui-theme-common';
|
|
29
|
+
import { useEuiTheme, useGeneratedHtmlId } from '../../../services';
|
|
23
30
|
import { getEuiButtonColorValues, getEuiFilledButtonColorValues } from '../../../global_styling';
|
|
24
31
|
import { EuiSplitButtonContext } from './split_button_context';
|
|
25
32
|
import { EuiSplitButtonActionPrimary, EuiSplitButtonActionSecondary } from './split_button_actions';
|
|
@@ -39,29 +46,41 @@ export var _EuiSplitButton = function _EuiSplitButton(_ref) {
|
|
|
39
46
|
isLoading = _ref.isLoading,
|
|
40
47
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
41
48
|
var euiThemeContext = useEuiTheme();
|
|
42
|
-
var
|
|
49
|
+
var euiTheme = euiThemeContext.euiTheme,
|
|
50
|
+
highContrastMode = euiThemeContext.highContrastMode;
|
|
43
51
|
var _children = _slicedToArray(children, 2),
|
|
44
52
|
primaryAction = _children[0],
|
|
45
53
|
secondaryAction = _children[1];
|
|
46
54
|
var key = useGeneratedHtmlId({
|
|
47
55
|
suffix: 'EuiSplitButton'
|
|
48
56
|
});
|
|
49
|
-
var commonProps = {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
var commonProps = useMemo(function () {
|
|
58
|
+
return {
|
|
59
|
+
size: size,
|
|
60
|
+
color: color,
|
|
61
|
+
fill: fill,
|
|
62
|
+
isDisabled: isDisabled,
|
|
63
|
+
hasAriaDisabled: hasAriaDisabled,
|
|
64
|
+
isLoading: isLoading
|
|
65
|
+
};
|
|
66
|
+
}, [size, color, fill, isDisabled, hasAriaDisabled, isLoading]);
|
|
57
67
|
var buttonFilledColors = getEuiFilledButtonColorValues(euiThemeContext, isDisabled ? 'disabled' : color);
|
|
58
68
|
var buttonColors = getEuiButtonColorValues(euiThemeContext, isDisabled ? 'disabled' : color);
|
|
69
|
+
var borderToken = color === 'text' ? 'borderBasePlain' : getTokenName('borderBase', color);
|
|
59
70
|
var classes = classNames('euiSplitButton', className);
|
|
60
|
-
var styles =
|
|
61
|
-
|
|
71
|
+
var styles = useMemo(function () {
|
|
72
|
+
return euiSplitButtonStyles(euiThemeContext, fill ? buttonFilledColors.backgroundColor : buttonColors.backgroundColor);
|
|
73
|
+
}, [euiThemeContext, fill, buttonFilledColors.backgroundColor, buttonColors.backgroundColor]);
|
|
74
|
+
var cssStyles = [styles.euiSplitButton, (color === 'text' || highContrastMode) && styles.hasBorder];
|
|
75
|
+
var dividerColor = color === 'warning' && fill ? buttonFilledColors.color : euiTheme.colors[borderToken];
|
|
62
76
|
var dividerStyles = useMemo(function () {
|
|
63
|
-
return euiSplitButtonDividerStyles(euiThemeContext,
|
|
64
|
-
}, [euiThemeContext, highContrastMode, fill, buttonFilledColors.
|
|
77
|
+
return euiSplitButtonDividerStyles(euiThemeContext, highContrastMode && fill ? buttonFilledColors.color : dividerColor);
|
|
78
|
+
}, [euiThemeContext, highContrastMode, fill, buttonFilledColors.color, dividerColor]);
|
|
79
|
+
var cssVariables = useMemo(function () {
|
|
80
|
+
return {
|
|
81
|
+
'--euiSplitButtonBorderColor': dividerColor
|
|
82
|
+
};
|
|
83
|
+
}, [dividerColor]);
|
|
65
84
|
|
|
66
85
|
// NOTE: dev-mode-only runtime check to evaluate if correct child components are passed
|
|
67
86
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -79,8 +98,12 @@ export var _EuiSplitButton = function _EuiSplitButton(_ref) {
|
|
|
79
98
|
return ___EmotionJSX("div", _extends({
|
|
80
99
|
role: "group",
|
|
81
100
|
className: classes,
|
|
82
|
-
css: cssStyles
|
|
83
|
-
|
|
101
|
+
css: cssStyles,
|
|
102
|
+
"data-size": size,
|
|
103
|
+
"data-fill": fill || undefined
|
|
104
|
+
}, rest, {
|
|
105
|
+
style: _objectSpread({}, cssVariables)
|
|
106
|
+
}), ___EmotionJSX(EuiSplitButtonContext.Provider, {
|
|
84
107
|
value: commonProps
|
|
85
108
|
}, ___EmotionJSX(Fragment, {
|
|
86
109
|
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
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
2
|
var _excluded = ["className", "isIconOnly", "tooltipProps"],
|
|
3
|
-
_excluded2 = ["fill", "isDisabled", "isLoading"],
|
|
3
|
+
_excluded2 = ["fill", "isDisabled", "isLoading", "size"],
|
|
4
4
|
_excluded3 = ["className", "popoverProps", "tooltipProps"],
|
|
5
|
-
_excluded4 = ["fill", "isDisabled", "isLoading"];
|
|
5
|
+
_excluded4 = ["fill", "isDisabled", "isLoading", "size"];
|
|
6
6
|
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); }
|
|
7
7
|
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; }
|
|
8
8
|
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; }
|
|
@@ -19,9 +19,10 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
|
|
|
19
19
|
* Side Public License, v 1.
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
import React, { useContext } from 'react';
|
|
22
|
+
import React, { useContext, useMemo } from 'react';
|
|
23
23
|
import PropTypes from "prop-types";
|
|
24
24
|
import classNames from 'classnames';
|
|
25
|
+
import { useEuiTheme } from '../../../services';
|
|
25
26
|
import { EuiPopover } from '../../popover';
|
|
26
27
|
import { EuiToolTip } from '../../tool_tip';
|
|
27
28
|
import { EuiButton } from '../button';
|
|
@@ -35,17 +36,22 @@ export var EuiSplitButtonActionPrimary = function EuiSplitButtonActionPrimary(_r
|
|
|
35
36
|
isIconOnly = _ref.isIconOnly,
|
|
36
37
|
tooltipProps = _ref.tooltipProps,
|
|
37
38
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
39
|
+
var euiThemeContext = useEuiTheme();
|
|
38
40
|
var _useContext = useContext(EuiSplitButtonContext),
|
|
39
41
|
fill = _useContext.fill,
|
|
40
42
|
isDisabled = _useContext.isDisabled,
|
|
41
43
|
isLoading = _useContext.isLoading,
|
|
44
|
+
size = _useContext.size,
|
|
42
45
|
sharedRest = _objectWithoutProperties(_useContext, _excluded2);
|
|
43
46
|
var _isDisabled = !!isDisabled || isButtonDisabled(rest);
|
|
44
47
|
var _isLoading = !!isLoading || !!rest.isLoading;
|
|
45
48
|
var display = fill ? 'fill' : 'base';
|
|
46
49
|
var classes = classNames('euiSplitButtonActionPrimary', className);
|
|
47
|
-
var styles =
|
|
50
|
+
var styles = useMemo(function () {
|
|
51
|
+
return euiSplitButtonActionStyles(euiThemeContext, size);
|
|
52
|
+
}, [euiThemeContext, size]);
|
|
48
53
|
var actionProps = _objectSpread(_objectSpread(_objectSpread({}, rest), sharedRest), {}, {
|
|
54
|
+
size: size,
|
|
49
55
|
isDisabled: _isDisabled,
|
|
50
56
|
isLoading: _isLoading,
|
|
51
57
|
css: [styles.euiSplitButtonActionPrimary],
|
|
@@ -88,17 +94,22 @@ export var EuiSplitButtonActionSecondary = function EuiSplitButtonActionSecondar
|
|
|
88
94
|
popoverProps = _ref2.popoverProps,
|
|
89
95
|
tooltipProps = _ref2.tooltipProps,
|
|
90
96
|
rest = _objectWithoutProperties(_ref2, _excluded3);
|
|
97
|
+
var euiThemeContext = useEuiTheme();
|
|
91
98
|
var _useContext2 = useContext(EuiSplitButtonContext),
|
|
92
99
|
fill = _useContext2.fill,
|
|
93
100
|
isDisabled = _useContext2.isDisabled,
|
|
94
101
|
isLoading = _useContext2.isLoading,
|
|
102
|
+
size = _useContext2.size,
|
|
95
103
|
sharedRest = _objectWithoutProperties(_useContext2, _excluded4);
|
|
96
104
|
var _isDisabled = !!isDisabled || isButtonDisabled(rest);
|
|
97
105
|
var _isLoading = !!isLoading || !!rest.isLoading;
|
|
98
106
|
var display = fill ? 'fill' : 'base';
|
|
99
107
|
var classes = classNames('euiSplitButtonActionSecondary', className);
|
|
100
|
-
var styles =
|
|
108
|
+
var styles = useMemo(function () {
|
|
109
|
+
return euiSplitButtonActionStyles(euiThemeContext, size);
|
|
110
|
+
}, [euiThemeContext, size]);
|
|
101
111
|
var actionProps = _objectSpread(_objectSpread(_objectSpread({}, rest), sharedRest), {}, {
|
|
112
|
+
size: size,
|
|
102
113
|
display: display,
|
|
103
114
|
// enforce chevronSingleDown icon when a popover is rendered
|
|
104
115
|
iconType: popoverProps != null ? 'chevronSingleDown' : rest.iconType,
|