@elastic/eui 91.3.0 → 92.0.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_charts_theme.js.map +1 -1
- package/dist/eui_theme_dark.css +0 -513
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +0 -513
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/basic_table/basic_table.js +25 -22
- package/es/components/basic_table/collapsed_item_actions.js +14 -15
- package/es/components/basic_table/expanded_item_actions.js +4 -4
- package/es/components/datagrid/body/header/data_grid_header_cell.js +3 -3
- package/es/components/drag_and_drop/drag_and_drop.a11y.js +1 -1
- package/es/components/filter_group/filter_button.js +20 -13
- package/es/components/filter_group/filter_button.styles.js +11 -20
- package/es/components/flyout/flyout.js +4 -4
- package/es/components/flyout/flyout_resizable.js +127 -0
- package/es/components/flyout/flyout_resizable.styles.js +27 -0
- package/es/components/flyout/index.js +2 -1
- package/es/components/form/range/dual_range.js +15 -66
- package/es/components/form/range/range.js +6 -5
- package/es/components/form/range/range_slider.js +28 -22
- package/es/components/form/text_area/text_area.js +39 -3
- package/es/components/index.js +0 -2
- package/es/components/markdown_editor/markdown_editor.js +12 -13
- package/es/components/page_template/bottom_bar/page_bottom_bar.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 +5 -0
- package/es/components/tree_view/tree_view.js +23 -25
- package/es/utils/prop_types/is.js +2 -2
- package/eui.d.ts +830 -1145
- package/i18ntokens.json +121 -373
- package/lib/components/basic_table/basic_table.js +25 -22
- package/lib/components/basic_table/collapsed_item_actions.js +14 -15
- package/lib/components/basic_table/expanded_item_actions.js +4 -4
- package/lib/components/datagrid/body/header/data_grid_header_cell.js +3 -3
- package/lib/components/drag_and_drop/drag_and_drop.a11y.js +1 -1
- package/lib/components/filter_group/filter_button.js +20 -13
- package/lib/components/filter_group/filter_button.styles.js +11 -20
- package/lib/components/flyout/flyout.js +4 -4
- package/lib/components/flyout/flyout_resizable.js +136 -0
- package/lib/components/flyout/flyout_resizable.styles.js +32 -0
- package/lib/components/flyout/index.js +8 -1
- package/lib/components/form/range/dual_range.js +15 -66
- package/lib/components/form/range/range.js +6 -5
- package/lib/components/form/range/range_slider.js +27 -21
- package/lib/components/form/text_area/text_area.js +42 -3
- package/lib/components/index.js +0 -22
- package/lib/components/markdown_editor/markdown_editor.js +12 -13
- package/lib/components/page_template/bottom_bar/page_bottom_bar.js +1 -1
- package/lib/components/pagination/pagination_button.js +79 -2
- package/lib/components/selectable/selectable_list/selectable_list_item.js +1 -1
- package/lib/components/tree_view/tree_view.js +23 -25
- package/lib/utils/prop_types/is.js +2 -2
- package/optimize/es/components/basic_table/basic_table.js +25 -22
- package/optimize/es/components/basic_table/collapsed_item_actions.js +14 -15
- package/optimize/es/components/basic_table/expanded_item_actions.js +4 -4
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell.js +3 -3
- package/optimize/es/components/drag_and_drop/drag_and_drop.a11y.js +1 -1
- package/optimize/es/components/filter_group/filter_button.js +20 -13
- package/optimize/es/components/filter_group/filter_button.styles.js +11 -20
- package/optimize/es/components/flyout/flyout.js +4 -4
- package/optimize/es/components/flyout/flyout_resizable.js +121 -0
- package/optimize/es/components/flyout/flyout_resizable.styles.js +27 -0
- package/optimize/es/components/flyout/index.js +2 -1
- package/optimize/es/components/form/range/dual_range.js +15 -66
- package/optimize/es/components/form/range/range.js +6 -5
- package/optimize/es/components/form/range/range_slider.js +26 -21
- package/optimize/es/components/form/text_area/text_area.js +29 -3
- package/optimize/es/components/index.js +0 -2
- package/optimize/es/components/markdown_editor/markdown_editor.js +12 -13
- package/optimize/es/components/page_template/bottom_bar/page_bottom_bar.js +1 -1
- package/optimize/es/components/selectable/selectable_list/selectable_list_item.js +1 -1
- package/optimize/es/components/tree_view/tree_view.js +23 -25
- package/optimize/es/utils/prop_types/is.js +2 -2
- package/optimize/lib/components/basic_table/basic_table.js +25 -22
- package/optimize/lib/components/basic_table/collapsed_item_actions.js +14 -15
- package/optimize/lib/components/basic_table/expanded_item_actions.js +4 -4
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.js +3 -3
- package/optimize/lib/components/drag_and_drop/drag_and_drop.a11y.js +1 -1
- package/optimize/lib/components/filter_group/filter_button.js +20 -13
- package/optimize/lib/components/filter_group/filter_button.styles.js +11 -20
- package/optimize/lib/components/flyout/flyout.js +4 -4
- package/optimize/lib/components/flyout/flyout_resizable.js +131 -0
- package/optimize/lib/components/flyout/flyout_resizable.styles.js +32 -0
- package/optimize/lib/components/flyout/index.js +8 -1
- package/optimize/lib/components/form/range/dual_range.js +15 -66
- package/optimize/lib/components/form/range/range.js +6 -5
- package/optimize/lib/components/form/range/range_slider.js +26 -21
- package/optimize/lib/components/form/text_area/text_area.js +32 -3
- package/optimize/lib/components/index.js +0 -22
- package/optimize/lib/components/markdown_editor/markdown_editor.js +12 -13
- package/optimize/lib/components/page_template/bottom_bar/page_bottom_bar.js +1 -1
- package/optimize/lib/components/selectable/selectable_list/selectable_list_item.js +1 -1
- package/optimize/lib/components/tree_view/tree_view.js +23 -25
- package/optimize/lib/utils/prop_types/is.js +2 -2
- package/package.json +3 -5
- package/src/components/index.scss +0 -2
- package/test-env/components/basic_table/basic_table.js +25 -22
- package/test-env/components/basic_table/collapsed_item_actions.js +14 -15
- package/test-env/components/basic_table/expanded_item_actions.js +4 -4
- package/test-env/components/datagrid/body/header/data_grid_header_cell.js +3 -3
- package/test-env/components/drag_and_drop/drag_and_drop.a11y.js +1 -1
- package/test-env/components/filter_group/filter_button.js +20 -13
- package/test-env/components/filter_group/filter_button.styles.js +11 -20
- package/test-env/components/flyout/flyout_resizable.js +131 -0
- package/test-env/components/flyout/flyout_resizable.styles.js +32 -0
- package/test-env/components/flyout/index.js +8 -1
- package/test-env/components/form/range/dual_range.js +15 -66
- package/test-env/components/form/range/range.js +6 -5
- package/test-env/components/form/range/range_slider.js +27 -21
- package/test-env/components/form/text_area/text_area.js +42 -3
- package/test-env/components/index.js +0 -22
- package/test-env/components/markdown_editor/markdown_editor.js +12 -13
- package/test-env/components/page_template/bottom_bar/page_bottom_bar.js +1 -1
- package/test-env/components/pagination/pagination_button.js +79 -2
- package/test-env/components/selectable/selectable_list/selectable_list_item.js +1 -1
- package/test-env/components/tree_view/tree_view.js +23 -25
- package/test-env/utils/prop_types/is.js +2 -2
- package/es/components/control_bar/control_bar.a11y.js +0 -133
- package/es/components/control_bar/control_bar.js +0 -609
- package/es/components/control_bar/index.js +0 -9
- package/es/components/notification/index.js +0 -9
- package/es/components/notification/notification_event.a11y.js +0 -104
- package/es/components/notification/notification_event.js +0 -288
- package/es/components/notification/notification_event_messages.js +0 -79
- package/es/components/notification/notification_event_meta.js +0 -148
- package/es/components/notification/notification_event_read_button.js +0 -86
- package/es/components/notification/notification_event_read_icon.js +0 -77
- package/lib/components/control_bar/control_bar.a11y.js +0 -134
- package/lib/components/control_bar/control_bar.js +0 -441
- package/lib/components/control_bar/index.js +0 -12
- package/lib/components/notification/index.js +0 -12
- package/lib/components/notification/notification_event.a11y.js +0 -105
- package/lib/components/notification/notification_event.js +0 -297
- package/lib/components/notification/notification_event_messages.js +0 -88
- package/lib/components/notification/notification_event_meta.js +0 -157
- package/lib/components/notification/notification_event_read_button.js +0 -93
- package/lib/components/notification/notification_event_read_icon.js +0 -64
- package/optimize/es/components/control_bar/control_bar.a11y.js +0 -128
- package/optimize/es/components/control_bar/control_bar.js +0 -308
- package/optimize/es/components/control_bar/index.js +0 -9
- package/optimize/es/components/notification/index.js +0 -9
- package/optimize/es/components/notification/notification_event.a11y.js +0 -99
- package/optimize/es/components/notification/notification_event.js +0 -114
- package/optimize/es/components/notification/notification_event_messages.js +0 -63
- package/optimize/es/components/notification/notification_event_meta.js +0 -106
- package/optimize/es/components/notification/notification_event_read_button.js +0 -44
- package/optimize/es/components/notification/notification_event_read_icon.js +0 -44
- package/optimize/lib/components/control_bar/control_bar.a11y.js +0 -134
- package/optimize/lib/components/control_bar/control_bar.js +0 -301
- package/optimize/lib/components/control_bar/index.js +0 -12
- package/optimize/lib/components/notification/index.js +0 -12
- package/optimize/lib/components/notification/notification_event.a11y.js +0 -105
- package/optimize/lib/components/notification/notification_event.js +0 -123
- package/optimize/lib/components/notification/notification_event_messages.js +0 -74
- package/optimize/lib/components/notification/notification_event_meta.js +0 -117
- package/optimize/lib/components/notification/notification_event_read_button.js +0 -51
- package/optimize/lib/components/notification/notification_event_read_icon.js +0 -51
- package/src/components/control_bar/_control_bar.scss +0 -232
- package/src/components/control_bar/_index.scss +0 -2
- package/src/components/control_bar/_variables.scss +0 -12
- package/src/components/notification/_index.scss +0 -5
- package/src/components/notification/_notification_event.scss +0 -40
- package/src/components/notification/_notification_event_messages.scss +0 -17
- package/src/components/notification/_notification_event_meta.scss +0 -44
- package/src/components/notification/_notification_event_read_button.scss +0 -5
- package/src/components/notification/_notification_event_read_icon.scss +0 -12
- package/test-env/components/control_bar/control_bar.a11y.js +0 -134
- package/test-env/components/control_bar/control_bar.js +0 -436
- package/test-env/components/control_bar/index.js +0 -12
- package/test-env/components/notification/index.js +0 -12
- package/test-env/components/notification/notification_event.a11y.js +0 -105
- package/test-env/components/notification/notification_event.js +0 -296
- package/test-env/components/notification/notification_event_messages.js +0 -85
- package/test-env/components/notification/notification_event_meta.js +0 -154
- package/test-env/components/notification/notification_event_read_button.js +0 -92
- package/test-env/components/notification/notification_event_read_icon.js +0 -63
|
@@ -433,7 +433,7 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
433
433
|
var sortDirection = _this2.resolveColumnSortDirection(column);
|
|
434
434
|
items.push({
|
|
435
435
|
name: column.name,
|
|
436
|
-
key: "_data_s_".concat(column.field, "_").concat(index),
|
|
436
|
+
key: "_data_s_".concat(String(column.field), "_").concat(index),
|
|
437
437
|
onSort: _this2.resolveColumnOnSort(column),
|
|
438
438
|
isSorted: !!sortDirection,
|
|
439
439
|
isSortAscending: sortDirection ? SortDirection.isAsc(sortDirection) : undefined
|
|
@@ -586,11 +586,11 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
586
586
|
}
|
|
587
587
|
}
|
|
588
588
|
headers.push(___EmotionJSX(EuiTableHeaderCell, _extends({
|
|
589
|
-
key: "_data_h_".concat(field, "_").concat(index),
|
|
589
|
+
key: "_data_h_".concat(String(field), "_").concat(index),
|
|
590
590
|
align: columnAlign,
|
|
591
591
|
width: width,
|
|
592
592
|
mobileOptions: mobileOptions,
|
|
593
|
-
"data-test-subj": "tableHeaderCell_".concat(field, "_").concat(index),
|
|
593
|
+
"data-test-subj": "tableHeaderCell_".concat(String(field), "_").concat(index),
|
|
594
594
|
description: description
|
|
595
595
|
}, sorting), name));
|
|
596
596
|
});
|
|
@@ -627,7 +627,7 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
627
627
|
|
|
628
628
|
if (footer) {
|
|
629
629
|
footers.push(___EmotionJSX(EuiTableFooterCell, {
|
|
630
|
-
key: "footer_".concat(field, "_").concat(footers.length - 1),
|
|
630
|
+
key: "footer_".concat(String(field), "_").concat(footers.length - 1),
|
|
631
631
|
align: align
|
|
632
632
|
}, footer));
|
|
633
633
|
hasDefinedFooter = true;
|
|
@@ -810,19 +810,22 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
810
810
|
}, {
|
|
811
811
|
key: "renderItemActionsCell",
|
|
812
812
|
value: function renderItemActionsCell(itemId, item, column, columnIndex) {
|
|
813
|
-
|
|
814
|
-
var
|
|
815
|
-
return _this7.state.selection.length === 0 && (!action.enabled || action.enabled(item));
|
|
816
|
-
};
|
|
813
|
+
// Disable all actions if any row(s) are selected
|
|
814
|
+
var allDisabled = this.state.selection.length > 0;
|
|
817
815
|
var actualActions = column.actions.filter(function (action) {
|
|
818
816
|
return !action.available || action.available(item);
|
|
819
817
|
});
|
|
820
818
|
if (actualActions.length > 2) {
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
}
|
|
825
|
-
|
|
819
|
+
if (allDisabled) {
|
|
820
|
+
// If all actions are disabled, do not show any actions but the popover toggle
|
|
821
|
+
actualActions = [];
|
|
822
|
+
} else {
|
|
823
|
+
// if any of the actions `isPrimary`, add them inline as well, but only the first 2
|
|
824
|
+
var primaryActions = actualActions.filter(function (o) {
|
|
825
|
+
return o.isPrimary;
|
|
826
|
+
});
|
|
827
|
+
actualActions = primaryActions.slice(0, 2);
|
|
828
|
+
}
|
|
826
829
|
|
|
827
830
|
// if we have more than 1 action, we don't show them all in the cell, instead we
|
|
828
831
|
// put them all in a popover tool. This effectively means we can only have a maximum
|
|
@@ -835,18 +838,18 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
835
838
|
render: function render(item) {
|
|
836
839
|
return ___EmotionJSX(CollapsedItemActions, {
|
|
837
840
|
actions: column.actions,
|
|
841
|
+
actionsDisabled: allDisabled,
|
|
838
842
|
itemId: itemId,
|
|
839
|
-
item: item
|
|
840
|
-
actionEnabled: actionEnabled
|
|
843
|
+
item: item
|
|
841
844
|
});
|
|
842
845
|
}
|
|
843
846
|
});
|
|
844
847
|
}
|
|
845
848
|
var tools = ___EmotionJSX(ExpandedItemActions, {
|
|
846
849
|
actions: actualActions,
|
|
850
|
+
actionsDisabled: allDisabled,
|
|
847
851
|
itemId: itemId,
|
|
848
|
-
item: item
|
|
849
|
-
actionEnabled: actionEnabled
|
|
852
|
+
item: item
|
|
850
853
|
});
|
|
851
854
|
var key = "record_actions_".concat(itemId, "_").concat(columnIndex);
|
|
852
855
|
return ___EmotionJSX(EuiTableRowCell, {
|
|
@@ -864,7 +867,7 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
864
867
|
var field = column.field,
|
|
865
868
|
render = column.render,
|
|
866
869
|
dataType = column.dataType;
|
|
867
|
-
var key = "_data_column_".concat(field, "_").concat(itemId, "_").concat(columnIndex);
|
|
870
|
+
var key = "_data_column_".concat(String(field), "_").concat(itemId, "_").concat(columnIndex);
|
|
868
871
|
var contentRenderer = render || this.getRendererForDataType(dataType);
|
|
869
872
|
var value = get(item, field);
|
|
870
873
|
var content = contentRenderer(value, item);
|
|
@@ -933,7 +936,7 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
933
936
|
}, {
|
|
934
937
|
key: "renderPaginationBar",
|
|
935
938
|
value: function renderPaginationBar() {
|
|
936
|
-
var
|
|
939
|
+
var _this7 = this;
|
|
937
940
|
var _this$props11 = this.props,
|
|
938
941
|
error = _this$props11.error,
|
|
939
942
|
pagination = _this$props11.pagination,
|
|
@@ -952,9 +955,9 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
952
955
|
}, function (tablePagination) {
|
|
953
956
|
return ___EmotionJSX(PaginationBar, {
|
|
954
957
|
pagination: pagination,
|
|
955
|
-
onPageSizeChange:
|
|
956
|
-
onPageChange:
|
|
957
|
-
"aria-controls":
|
|
958
|
+
onPageSizeChange: _this7.onPageSizeChange.bind(_this7),
|
|
959
|
+
onPageChange: _this7.onPageChange.bind(_this7),
|
|
960
|
+
"aria-controls": _this7.tableId,
|
|
958
961
|
"aria-label": tablePagination
|
|
959
962
|
});
|
|
960
963
|
});
|
|
@@ -25,16 +25,12 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
25
25
|
var actions = _ref.actions,
|
|
26
26
|
itemId = _ref.itemId,
|
|
27
27
|
item = _ref.item,
|
|
28
|
-
|
|
28
|
+
actionsDisabled = _ref.actionsDisabled,
|
|
29
29
|
className = _ref.className;
|
|
30
30
|
var _useState = useState(false),
|
|
31
31
|
_useState2 = _slicedToArray(_useState, 2),
|
|
32
32
|
popoverOpen = _useState2[0],
|
|
33
33
|
setPopoverOpen = _useState2[1];
|
|
34
|
-
var _useState3 = useState(true),
|
|
35
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
36
|
-
allDisabled = _useState4[0],
|
|
37
|
-
setAllDisabled = _useState4[1];
|
|
38
34
|
var onClickItem = useCallback(function (onClickAction) {
|
|
39
35
|
setPopoverOpen(false);
|
|
40
36
|
onClickAction === null || onClickAction === void 0 ? void 0 : onClickAction();
|
|
@@ -44,8 +40,7 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
44
40
|
var _action$available, _action$available2;
|
|
45
41
|
var available = (_action$available = (_action$available2 = action.available) === null || _action$available2 === void 0 ? void 0 : _action$available2.call(action, item)) !== null && _action$available !== void 0 ? _action$available : true;
|
|
46
42
|
if (!available) return controls;
|
|
47
|
-
var enabled =
|
|
48
|
-
if (enabled) setAllDisabled(false);
|
|
43
|
+
var enabled = action.enabled == null || action.enabled(item);
|
|
49
44
|
if (isCustomItemAction(action)) {
|
|
50
45
|
var customAction = action;
|
|
51
46
|
var actionControl = customAction.render(item, enabled);
|
|
@@ -76,7 +71,7 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
76
71
|
controls.push(___EmotionJSX(EuiContextMenuItem, {
|
|
77
72
|
key: index,
|
|
78
73
|
className: "euiBasicTable__collapsedAction",
|
|
79
|
-
disabled: !enabled,
|
|
74
|
+
disabled: !enabled && !actionsDisabled,
|
|
80
75
|
href: href,
|
|
81
76
|
target: target,
|
|
82
77
|
icon: icon,
|
|
@@ -94,17 +89,21 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
94
89
|
}
|
|
95
90
|
return controls;
|
|
96
91
|
}, []);
|
|
97
|
-
}, [actions,
|
|
92
|
+
}, [actions, actionsDisabled, item, onClickItem]);
|
|
98
93
|
var popoverButton = ___EmotionJSX(EuiI18n, {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}, function (
|
|
94
|
+
tokens: ['euiCollapsedItemActions.allActions', 'euiCollapsedItemActions.allActionsDisabled'],
|
|
95
|
+
defaults: ['All actions', 'Individual item actions are disabled when rows are being selected.']
|
|
96
|
+
}, function (_ref2) {
|
|
97
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
98
|
+
allActions = _ref3[0],
|
|
99
|
+
allActionsDisabled = _ref3[1];
|
|
102
100
|
return ___EmotionJSX(EuiButtonIcon, {
|
|
103
101
|
className: className,
|
|
104
|
-
"aria-label": allActions,
|
|
102
|
+
"aria-label": actionsDisabled ? allActionsDisabled : allActions,
|
|
103
|
+
title: actionsDisabled ? allActionsDisabled : undefined,
|
|
105
104
|
iconType: "boxesHorizontal",
|
|
106
105
|
color: "text",
|
|
107
|
-
isDisabled:
|
|
106
|
+
isDisabled: actionsDisabled,
|
|
108
107
|
onClick: function onClick() {
|
|
109
108
|
return setPopoverOpen(function (isOpen) {
|
|
110
109
|
return !isOpen;
|
|
@@ -113,7 +112,7 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
113
112
|
"data-test-subj": "euiCollapsedItemActionsButton"
|
|
114
113
|
});
|
|
115
114
|
});
|
|
116
|
-
var withTooltip = !
|
|
115
|
+
var withTooltip = !actionsDisabled && ___EmotionJSX(EuiI18n, {
|
|
117
116
|
token: "euiCollapsedItemActions.allActions",
|
|
118
117
|
default: "All actions"
|
|
119
118
|
}, function (allActions) {
|
|
@@ -16,7 +16,7 @@ export var ExpandedItemActions = function ExpandedItemActions(_ref) {
|
|
|
16
16
|
var actions = _ref.actions,
|
|
17
17
|
itemId = _ref.itemId,
|
|
18
18
|
item = _ref.item,
|
|
19
|
-
|
|
19
|
+
actionsDisabled = _ref.actionsDisabled,
|
|
20
20
|
className = _ref.className;
|
|
21
21
|
var moreThanThree = actions.length > 2;
|
|
22
22
|
return ___EmotionJSX(React.Fragment, null, actions.reduce(function (tools, action, index) {
|
|
@@ -24,7 +24,7 @@ export var ExpandedItemActions = function ExpandedItemActions(_ref) {
|
|
|
24
24
|
if (!available) {
|
|
25
25
|
return tools;
|
|
26
26
|
}
|
|
27
|
-
var enabled =
|
|
27
|
+
var enabled = action.enabled == null || action.enabled(item);
|
|
28
28
|
var key = "item_action_".concat(itemId, "_").concat(index);
|
|
29
29
|
var classes = classNames(className, {
|
|
30
30
|
expandedItemActions__completelyHide: moreThanThree && index < 2
|
|
@@ -36,7 +36,7 @@ export var ExpandedItemActions = function ExpandedItemActions(_ref) {
|
|
|
36
36
|
className: classes,
|
|
37
37
|
index: index,
|
|
38
38
|
action: action,
|
|
39
|
-
enabled: enabled,
|
|
39
|
+
enabled: enabled && !actionsDisabled,
|
|
40
40
|
item: item
|
|
41
41
|
}));
|
|
42
42
|
} else {
|
|
@@ -44,7 +44,7 @@ export var ExpandedItemActions = function ExpandedItemActions(_ref) {
|
|
|
44
44
|
key: key,
|
|
45
45
|
className: classes,
|
|
46
46
|
action: action,
|
|
47
|
-
enabled: enabled,
|
|
47
|
+
enabled: enabled && !actionsDisabled,
|
|
48
48
|
item: item
|
|
49
49
|
}));
|
|
50
50
|
}
|
|
@@ -126,7 +126,8 @@ export var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
|
|
|
126
126
|
});
|
|
127
127
|
},
|
|
128
128
|
"aria-describedby": "".concat(sortingAriaId, " ").concat(actionsAriaId),
|
|
129
|
-
ref: actionsButtonRef
|
|
129
|
+
ref: actionsButtonRef,
|
|
130
|
+
"data-test-subj": "dataGridHeaderCellActionButton-".concat(id)
|
|
130
131
|
}, cellContent, ___EmotionJSX(EuiPopover, _extends({
|
|
131
132
|
display: "block",
|
|
132
133
|
panelPaddingSize: "none",
|
|
@@ -148,8 +149,7 @@ export var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
|
|
|
148
149
|
}, ___EmotionJSX(EuiIcon, {
|
|
149
150
|
type: "boxesVertical",
|
|
150
151
|
size: "s",
|
|
151
|
-
color: "text"
|
|
152
|
-
"data-test-subj": "dataGridHeaderCellActionButton-".concat(id)
|
|
152
|
+
color: "text"
|
|
153
153
|
})),
|
|
154
154
|
isOpen: isPopoverOpen,
|
|
155
155
|
closePopover: function closePopover() {
|
|
@@ -76,7 +76,7 @@ var DragAndDrop = function DragAndDrop() {
|
|
|
76
76
|
beforeEach(function () {
|
|
77
77
|
cy.realMount(___EmotionJSX(DragAndDrop, null));
|
|
78
78
|
});
|
|
79
|
-
describe('
|
|
79
|
+
describe('EuiDragDrop', function () {
|
|
80
80
|
describe('Automated accessibility check', function () {
|
|
81
81
|
it('has zero violations on render', function () {
|
|
82
82
|
cy.checkAxe();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
2
|
var _excluded = ["children", "className", "iconType", "iconSide", "color", "badgeColor", "hasActiveFilters", "numFilters", "numActiveFilters", "isDisabled", "isSelected", "type", "grow", "withNext", "textProps", "contentProps"];
|
|
3
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
3
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
4
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
5
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
6
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
8
7
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
9
9
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
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."); }
|
|
11
11
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -69,6 +69,10 @@ export var EuiFilterButton = function EuiFilterButton(_ref) {
|
|
|
69
69
|
'euiFilterButton-hasActiveFilters': hasActiveFilters,
|
|
70
70
|
'euiFilterButton-hasNotification': numFiltersDefined
|
|
71
71
|
}, className);
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Badge
|
|
75
|
+
*/
|
|
72
76
|
var showBadge = numFiltersDefined || numActiveFiltersDefined;
|
|
73
77
|
var badgeCount = numActiveFilters || numFilters;
|
|
74
78
|
var activeBadgeLabel = useEuiI18n('euiFilterButton.filterBadgeActiveAriaLabel', '{count} active filters', {
|
|
@@ -77,9 +81,6 @@ export var EuiFilterButton = function EuiFilterButton(_ref) {
|
|
|
77
81
|
var availableBadgeLabel = useEuiI18n('euiFilterButton.filterBadgeAvailableAriaLabel', '{count} available filters', {
|
|
78
82
|
count: badgeCount
|
|
79
83
|
});
|
|
80
|
-
var buttonTextClassNames = classNames('euiFilterButton__text', {
|
|
81
|
-
'euiFilterButton__text-hasNotification': showBadge
|
|
82
|
-
}, textProps && textProps.className);
|
|
83
84
|
var badgeContent = showBadge && ___EmotionJSX(EuiNotificationBadge, {
|
|
84
85
|
className: "euiFilterButton__notification",
|
|
85
86
|
css: [notificationStyles.euiFilterButton__notification, isDisabled && notificationStyles.disabled, ";label:badgeContent;"],
|
|
@@ -87,18 +88,27 @@ export var EuiFilterButton = function EuiFilterButton(_ref) {
|
|
|
87
88
|
color: isDisabled || !hasActiveFilters ? 'subdued' : badgeColor,
|
|
88
89
|
role: "marquee" // https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/marquee_role
|
|
89
90
|
}, badgeCount);
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Text
|
|
94
|
+
*/
|
|
95
|
+
var buttonTextClassNames = classNames('euiFilterButton__text', {
|
|
96
|
+
'euiFilterButton__text-hasNotification': showBadge
|
|
97
|
+
}, textProps && textProps.className);
|
|
98
|
+
var textCssStyles = [textStyles.euiFilterButton__text, showBadge && textStyles.hasNotification, textProps && textProps.css];
|
|
90
99
|
var _useInnerText = useInnerText(),
|
|
91
100
|
_useInnerText2 = _slicedToArray(_useInnerText, 2),
|
|
92
101
|
ref = _useInnerText2[0],
|
|
93
102
|
innerText = _useInnerText2[1];
|
|
94
103
|
var dataText = children && typeof children === 'string' ? children : innerText;
|
|
95
|
-
var
|
|
104
|
+
var textContent = ___EmotionJSX("span", _extends({
|
|
96
105
|
ref: ref,
|
|
97
|
-
className: "euiFilterButton__textShift",
|
|
98
|
-
css: textStyles.euiFilterButton__textShift,
|
|
99
106
|
"data-text": dataText,
|
|
100
107
|
title: dataText
|
|
101
|
-
},
|
|
108
|
+
}, textProps, {
|
|
109
|
+
className: buttonTextClassNames,
|
|
110
|
+
css: textCssStyles
|
|
111
|
+
}), children);
|
|
102
112
|
return ___EmotionJSX(EuiButtonEmpty, _extends({
|
|
103
113
|
className: classes,
|
|
104
114
|
css: cssStyles,
|
|
@@ -107,14 +117,11 @@ export var EuiFilterButton = function EuiFilterButton(_ref) {
|
|
|
107
117
|
iconSide: iconSide,
|
|
108
118
|
iconType: iconType,
|
|
109
119
|
type: type,
|
|
110
|
-
textProps:
|
|
111
|
-
className: buttonTextClassNames,
|
|
112
|
-
css: [textStyles.euiFilterButton__text, showBadge && textStyles.hasNotification, textProps && textProps.css]
|
|
113
|
-
}),
|
|
120
|
+
textProps: false,
|
|
114
121
|
contentProps: _objectSpread(_objectSpread({}, contentProps), {}, {
|
|
115
122
|
css: [contentStyles.euiFilterButton__content, iconType && contentStyles.hasIcon, contentProps === null || contentProps === void 0 ? void 0 : contentProps.css]
|
|
116
123
|
})
|
|
117
|
-
}, rest),
|
|
124
|
+
}, rest), textContent, badgeContent);
|
|
118
125
|
};
|
|
119
126
|
EuiFilterButton.propTypes = {
|
|
120
127
|
/**
|
|
@@ -10,8 +10,8 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
|
|
|
10
10
|
import { css } from '@emotion/react';
|
|
11
11
|
import { logicalCSS, mathWithUnits, euiTextShift, euiTextTruncate } from '../../global_styling';
|
|
12
12
|
import { euiFormVariables } from '../form/form.styles';
|
|
13
|
-
export var euiFilterButtonDisplay = function euiFilterButtonDisplay(
|
|
14
|
-
var euiTheme =
|
|
13
|
+
export var euiFilterButtonDisplay = function euiFilterButtonDisplay(_ref4) {
|
|
14
|
+
var euiTheme = _ref4.euiTheme;
|
|
15
15
|
return {
|
|
16
16
|
flex: '1 1 auto',
|
|
17
17
|
minInlineSize: mathWithUnits(euiTheme.size.base, function (x) {
|
|
@@ -19,7 +19,7 @@ export var euiFilterButtonDisplay = function euiFilterButtonDisplay(_ref5) {
|
|
|
19
19
|
})
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
|
-
var
|
|
22
|
+
var _ref3 = process.env.NODE_ENV === "production" ? {
|
|
23
23
|
name: "jkp921-noGrow",
|
|
24
24
|
styles: "flex-grow:0;label:noGrow;"
|
|
25
25
|
} : {
|
|
@@ -38,9 +38,9 @@ export var euiFilterButtonStyles = function euiFilterButtonStyles(euiThemeContex
|
|
|
38
38
|
// Bottom borders are needed for responsive flex-wrap behavior
|
|
39
39
|
var bottomBoxShadow = "0 ".concat(euiTheme.border.width.thin, " 0 0 ").concat(borderColor);
|
|
40
40
|
return {
|
|
41
|
-
euiFilterButton: /*#__PURE__*/css(euiFilterButtonDisplay(euiThemeContext), " ", logicalCSS('height', controlHeight), " border-radius:0;box-shadow:", leftBoxShadow, ",", bottomBoxShadow, ";&:hover:not(:disabled),&:focus:not(:disabled){text-decoration:none;.
|
|
41
|
+
euiFilterButton: /*#__PURE__*/css(euiFilterButtonDisplay(euiThemeContext), " ", logicalCSS('height', controlHeight), " border-radius:0;box-shadow:", leftBoxShadow, ",", bottomBoxShadow, ";&:hover:not(:disabled),&:focus:not(:disabled){text-decoration:none;.euiFilterButton__text{text-decoration:underline;}}&:focus-visible{outline-offset:-", euiTheme.focus.width, ";};label:euiFilterButton;"),
|
|
42
42
|
withNext: /*#__PURE__*/css("&+.euiFilterButton{", logicalCSS('margin-left', "-".concat(euiTheme.size.xs)), "box-shadow:", bottomBoxShadow, ";};label:withNext;"),
|
|
43
|
-
noGrow:
|
|
43
|
+
noGrow: _ref3,
|
|
44
44
|
hasNotification: /*#__PURE__*/css(logicalCSS('min-width', mathWithUnits(euiTheme.size.base, function (x) {
|
|
45
45
|
return x * 6;
|
|
46
46
|
})), ";;label:hasNotification;"),
|
|
@@ -63,27 +63,18 @@ var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
|
63
63
|
styles: "cursor:inherit;label:euiFilterButton__notification;",
|
|
64
64
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
65
65
|
};
|
|
66
|
-
var
|
|
67
|
-
|
|
68
|
-
styles: "justify-content:space-between;label:hasIcon;"
|
|
69
|
-
} : {
|
|
70
|
-
name: "f0jxzj-hasIcon",
|
|
71
|
-
styles: "justify-content:space-between;label:hasIcon;",
|
|
72
|
-
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
73
|
-
};
|
|
74
|
-
export var euiFilterButtonChildStyles = function euiFilterButtonChildStyles(_ref6) {
|
|
75
|
-
var euiTheme = _ref6.euiTheme;
|
|
66
|
+
export var euiFilterButtonChildStyles = function euiFilterButtonChildStyles(_ref5) {
|
|
67
|
+
var euiTheme = _ref5.euiTheme;
|
|
76
68
|
return {
|
|
77
69
|
content: {
|
|
78
70
|
euiFilterButton__content: /*#__PURE__*/css(";label:euiFilterButton__content;"),
|
|
79
|
-
hasIcon:
|
|
71
|
+
hasIcon: /*#__PURE__*/css("&>.euiIcon:last-child{", logicalCSS('margin-left', 'auto'), ";};label:hasIcon;")
|
|
80
72
|
},
|
|
81
73
|
text: {
|
|
82
|
-
euiFilterButton__text: /*#__PURE__*/css("
|
|
83
|
-
hasNotification: /*#__PURE__*/css(
|
|
84
|
-
euiFilterButton__textShift: /*#__PURE__*/css(euiTextShift('bold', 'data-text', euiTheme), " ", euiTextTruncate(), " ", logicalCSS('min-width', mathWithUnits(euiTheme.size.base, function (x) {
|
|
74
|
+
euiFilterButton__text: /*#__PURE__*/css(euiTextShift('bold', 'data-text', euiTheme), " ", euiTextTruncate(), ";;label:euiFilterButton__text;"),
|
|
75
|
+
hasNotification: /*#__PURE__*/css(logicalCSS('min-width', mathWithUnits(euiTheme.size.base, function (x) {
|
|
85
76
|
return x * 3;
|
|
86
|
-
})), ";;label:
|
|
77
|
+
})), ";;label:hasNotification;")
|
|
87
78
|
},
|
|
88
79
|
notification: {
|
|
89
80
|
euiFilterButton__notification: _ref2,
|
|
@@ -110,18 +110,18 @@ export var EuiFlyout = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
110
110
|
*/
|
|
111
111
|
if (isPushed) {
|
|
112
112
|
if (side === 'right') {
|
|
113
|
-
document.body.style.
|
|
113
|
+
document.body.style.paddingInlineEnd = "".concat(dimensions.width, "px");
|
|
114
114
|
} else if (side === 'left') {
|
|
115
|
-
document.body.style.
|
|
115
|
+
document.body.style.paddingInlineStart = "".concat(dimensions.width, "px");
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
return function () {
|
|
119
119
|
document.body.classList.remove('euiBody--hasFlyout');
|
|
120
120
|
if (isPushed) {
|
|
121
121
|
if (side === 'right') {
|
|
122
|
-
document.body.style.
|
|
122
|
+
document.body.style.paddingInlineEnd = '';
|
|
123
123
|
} else if (side === 'left') {
|
|
124
|
-
document.body.style.
|
|
124
|
+
document.body.style.paddingInlineStart = '';
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
var _excluded = ["size", "maxWidth", "minWidth", "side", "children"];
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
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
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
7
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
8
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
10
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
11
|
+
/*
|
|
12
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
13
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
14
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
15
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
16
|
+
* Side Public License, v 1.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import React, { forwardRef, useState, useEffect, useRef, useMemo, useCallback } from 'react';
|
|
20
|
+
import { keys, useCombinedRefs, useEuiTheme } from '../../services';
|
|
21
|
+
import { EuiResizableButton } from '../resizable_container';
|
|
22
|
+
import { EuiFlyout } from './flyout';
|
|
23
|
+
import { euiFlyoutResizableButtonStyles } from './flyout_resizable.styles';
|
|
24
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
25
|
+
export var EuiFlyoutResizable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
26
|
+
var size = _ref.size,
|
|
27
|
+
maxWidth = _ref.maxWidth,
|
|
28
|
+
_ref$minWidth = _ref.minWidth,
|
|
29
|
+
minWidth = _ref$minWidth === void 0 ? 200 : _ref$minWidth,
|
|
30
|
+
_ref$side = _ref.side,
|
|
31
|
+
side = _ref$side === void 0 ? 'right' : _ref$side,
|
|
32
|
+
children = _ref.children,
|
|
33
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
34
|
+
var euiTheme = useEuiTheme();
|
|
35
|
+
var styles = euiFlyoutResizableButtonStyles(euiTheme);
|
|
36
|
+
var cssStyles = [styles.euiFlyoutResizableButton, styles[side]];
|
|
37
|
+
var getFlyoutMinMaxWidth = useCallback(function (width) {
|
|
38
|
+
return Math.min(Math.max(width, minWidth), maxWidth || Infinity, window.innerWidth - 20 // Leave some offset
|
|
39
|
+
);
|
|
40
|
+
}, [minWidth, maxWidth]);
|
|
41
|
+
var _useState = useState(0),
|
|
42
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
43
|
+
flyoutWidth = _useState2[0],
|
|
44
|
+
setFlyoutWidth = _useState2[1];
|
|
45
|
+
|
|
46
|
+
// Must use state for the flyout ref in order for the useEffect to be correctly called after render
|
|
47
|
+
var _useState3 = useState(null),
|
|
48
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
49
|
+
flyoutRef = _useState4[0],
|
|
50
|
+
setFlyoutRef = _useState4[1];
|
|
51
|
+
var setRefs = useCombinedRefs([setFlyoutRef, ref]);
|
|
52
|
+
useEffect(function () {
|
|
53
|
+
setFlyoutWidth(flyoutRef ? getFlyoutMinMaxWidth(flyoutRef.offsetWidth) : 0);
|
|
54
|
+
}, [flyoutRef, getFlyoutMinMaxWidth, size]);
|
|
55
|
+
|
|
56
|
+
// Initial numbers to calculate from, on resize drag start
|
|
57
|
+
var initialWidth = useRef(0);
|
|
58
|
+
var initialMouseX = useRef(0);
|
|
59
|
+
|
|
60
|
+
// Account for flyout side and logical property direction
|
|
61
|
+
var direction = useMemo(function () {
|
|
62
|
+
var modifier = side === 'right' ? -1 : 1;
|
|
63
|
+
if (flyoutRef) {
|
|
64
|
+
var languageDirection = window.getComputedStyle(flyoutRef).direction;
|
|
65
|
+
if (languageDirection === 'rtl') modifier *= -1;
|
|
66
|
+
}
|
|
67
|
+
return modifier;
|
|
68
|
+
}, [side, flyoutRef]);
|
|
69
|
+
var onMouseMove = useCallback(function (e) {
|
|
70
|
+
var mouseOffset = getMouseOrTouchX(e) - initialMouseX.current;
|
|
71
|
+
var changedFlyoutWidth = initialWidth.current + mouseOffset * direction;
|
|
72
|
+
setFlyoutWidth(getFlyoutMinMaxWidth(changedFlyoutWidth));
|
|
73
|
+
}, [getFlyoutMinMaxWidth, direction]);
|
|
74
|
+
var onMouseUp = useCallback(function () {
|
|
75
|
+
initialMouseX.current = 0;
|
|
76
|
+
window.removeEventListener('mousemove', onMouseMove);
|
|
77
|
+
window.removeEventListener('mouseup', onMouseUp);
|
|
78
|
+
window.removeEventListener('touchmove', onMouseMove);
|
|
79
|
+
window.removeEventListener('touchend', onMouseUp);
|
|
80
|
+
}, [onMouseMove]);
|
|
81
|
+
var onMouseDown = useCallback(function (e) {
|
|
82
|
+
var _flyoutRef$offsetWidt;
|
|
83
|
+
initialMouseX.current = getMouseOrTouchX(e);
|
|
84
|
+
initialWidth.current = (_flyoutRef$offsetWidt = flyoutRef === null || flyoutRef === void 0 ? void 0 : flyoutRef.offsetWidth) !== null && _flyoutRef$offsetWidt !== void 0 ? _flyoutRef$offsetWidt : 0;
|
|
85
|
+
|
|
86
|
+
// Window event listeners instead of React events are used
|
|
87
|
+
// in case the user's mouse leaves the component
|
|
88
|
+
window.addEventListener('mousemove', onMouseMove);
|
|
89
|
+
window.addEventListener('mouseup', onMouseUp);
|
|
90
|
+
window.addEventListener('touchmove', onMouseMove);
|
|
91
|
+
window.addEventListener('touchend', onMouseUp);
|
|
92
|
+
}, [flyoutRef, onMouseMove, onMouseUp]);
|
|
93
|
+
var onKeyDown = useCallback(function (e) {
|
|
94
|
+
var KEYBOARD_OFFSET = 10;
|
|
95
|
+
switch (e.key) {
|
|
96
|
+
case keys.ARROW_RIGHT:
|
|
97
|
+
e.preventDefault(); // Safari+VO will screen reader navigate off the button otherwise
|
|
98
|
+
setFlyoutWidth(function (flyoutWidth) {
|
|
99
|
+
return getFlyoutMinMaxWidth(flyoutWidth + KEYBOARD_OFFSET * direction);
|
|
100
|
+
});
|
|
101
|
+
break;
|
|
102
|
+
case keys.ARROW_LEFT:
|
|
103
|
+
e.preventDefault(); // Safari+VO will screen reader navigate off the button otherwise
|
|
104
|
+
setFlyoutWidth(function (flyoutWidth) {
|
|
105
|
+
return getFlyoutMinMaxWidth(flyoutWidth - KEYBOARD_OFFSET * direction);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}, [getFlyoutMinMaxWidth, direction]);
|
|
109
|
+
return ___EmotionJSX(EuiFlyout, _extends({}, rest, {
|
|
110
|
+
size: flyoutWidth || size,
|
|
111
|
+
maxWidth: maxWidth,
|
|
112
|
+
side: side,
|
|
113
|
+
ref: setRefs
|
|
114
|
+
}), ___EmotionJSX(EuiResizableButton, {
|
|
115
|
+
isHorizontal: true,
|
|
116
|
+
css: cssStyles,
|
|
117
|
+
onMouseDown: onMouseDown,
|
|
118
|
+
onTouchStart: onMouseDown,
|
|
119
|
+
onKeyDown: onKeyDown
|
|
120
|
+
}), children);
|
|
121
|
+
});
|
|
122
|
+
EuiFlyoutResizable.displayName = 'EuiFlyoutResizable';
|
|
123
|
+
var getMouseOrTouchX = function getMouseOrTouchX(e) {
|
|
124
|
+
// Some Typescript fooling is needed here
|
|
125
|
+
var x = e.targetTouches ? e.targetTouches[0].pageX : e.pageX;
|
|
126
|
+
return x;
|
|
127
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
/*
|
|
3
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
4
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
5
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
6
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
7
|
+
* Side Public License, v 1.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { css } from '@emotion/react';
|
|
11
|
+
import { logicalCSS } from '../../global_styling';
|
|
12
|
+
var _ref = process.env.NODE_ENV === "production" ? {
|
|
13
|
+
name: "6syi0e-euiFlyoutResizableButton",
|
|
14
|
+
styles: "position:absolute;&::before,&::after{background-color:transparent;};label:euiFlyoutResizableButton;"
|
|
15
|
+
} : {
|
|
16
|
+
name: "6syi0e-euiFlyoutResizableButton",
|
|
17
|
+
styles: "position:absolute;&::before,&::after{background-color:transparent;};label:euiFlyoutResizableButton;",
|
|
18
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
19
|
+
};
|
|
20
|
+
export var euiFlyoutResizableButtonStyles = function euiFlyoutResizableButtonStyles(_ref2) {
|
|
21
|
+
var euiTheme = _ref2.euiTheme;
|
|
22
|
+
return {
|
|
23
|
+
euiFlyoutResizableButton: _ref,
|
|
24
|
+
left: /*#__PURE__*/css(logicalCSS('right', "-".concat(euiTheme.border.width.thin)), ";;label:left;"),
|
|
25
|
+
right: /*#__PURE__*/css(logicalCSS('left', "-".concat(euiTheme.border.width.thin)), ";;label:right;")
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -10,4 +10,5 @@ export { EuiFlyout } from './flyout';
|
|
|
10
10
|
export { EuiFlyoutBody } from './flyout_body';
|
|
11
11
|
export { EuiFlyoutFooter } from './flyout_footer';
|
|
12
12
|
export { EuiFlyoutHeader } from './flyout_header';
|
|
13
|
-
export { euiFlyoutSlideInRight, euiFlyoutSlideInLeft } from './flyout.styles';
|
|
13
|
+
export { euiFlyoutSlideInRight, euiFlyoutSlideInLeft } from './flyout.styles';
|
|
14
|
+
export { EuiFlyoutResizable } from './flyout_resizable';
|