@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
|
@@ -61,34 +61,12 @@ var displayToClassNameMap = {
|
|
|
61
61
|
var EuiTreeView = /*#__PURE__*/function (_Component) {
|
|
62
62
|
_inherits(EuiTreeView, _Component);
|
|
63
63
|
var _super = _createSuper(EuiTreeView);
|
|
64
|
-
function EuiTreeView() {
|
|
64
|
+
function EuiTreeView(props, context) {
|
|
65
65
|
var _this;
|
|
66
66
|
_classCallCheck(this, EuiTreeView);
|
|
67
|
-
|
|
68
|
-
args[_key] = arguments[_key];
|
|
69
|
-
}
|
|
70
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
67
|
+
_this = _super.call(this, props, context);
|
|
71
68
|
_defineProperty(_assertThisInitialized(_this), "treeIdGenerator", (0, _services.htmlIdGenerator)('euiTreeView'));
|
|
72
|
-
_defineProperty(_assertThisInitialized(_this), "isNested",
|
|
73
|
-
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
74
|
-
openItems: _this.props.expandByDefault ? _this.props.items.map(function (_ref) {
|
|
75
|
-
var id = _ref.id,
|
|
76
|
-
children = _ref.children;
|
|
77
|
-
return children ? id : null;
|
|
78
|
-
}).filter(function (x) {
|
|
79
|
-
return x != null;
|
|
80
|
-
}) : _this.props.items.map(function (_ref2) {
|
|
81
|
-
var id = _ref2.id,
|
|
82
|
-
children = _ref2.children,
|
|
83
|
-
isExpanded = _ref2.isExpanded;
|
|
84
|
-
return children && isExpanded ? id : null;
|
|
85
|
-
}).filter(function (x) {
|
|
86
|
-
return x != null;
|
|
87
|
-
}),
|
|
88
|
-
activeItem: '',
|
|
89
|
-
treeID: getTreeId(_this.props.id, _this.context, _this.treeIdGenerator),
|
|
90
|
-
expandChildNodes: _this.props.expandByDefault || false
|
|
91
|
-
});
|
|
69
|
+
_defineProperty(_assertThisInitialized(_this), "isNested", void 0);
|
|
92
70
|
_defineProperty(_assertThisInitialized(_this), "buttonRef", []);
|
|
93
71
|
_defineProperty(_assertThisInitialized(_this), "setButtonRef", function (ref, index) {
|
|
94
72
|
_this.buttonRef[index] = ref;
|
|
@@ -183,6 +161,26 @@ var EuiTreeView = /*#__PURE__*/function (_Component) {
|
|
|
183
161
|
_this.buttonRef[index].focus();
|
|
184
162
|
}
|
|
185
163
|
});
|
|
164
|
+
_this.isNested = !!_this.context;
|
|
165
|
+
_this.state = {
|
|
166
|
+
openItems: _this.props.expandByDefault ? _this.props.items.map(function (_ref) {
|
|
167
|
+
var id = _ref.id,
|
|
168
|
+
children = _ref.children;
|
|
169
|
+
return children ? id : null;
|
|
170
|
+
}).filter(function (x) {
|
|
171
|
+
return x != null;
|
|
172
|
+
}) : _this.props.items.map(function (_ref2) {
|
|
173
|
+
var id = _ref2.id,
|
|
174
|
+
children = _ref2.children,
|
|
175
|
+
isExpanded = _ref2.isExpanded;
|
|
176
|
+
return children && isExpanded ? id : null;
|
|
177
|
+
}).filter(function (x) {
|
|
178
|
+
return x != null;
|
|
179
|
+
}),
|
|
180
|
+
activeItem: '',
|
|
181
|
+
treeID: getTreeId(_this.props.id, context, _this.treeIdGenerator),
|
|
182
|
+
expandChildNodes: _this.props.expandByDefault || false
|
|
183
|
+
};
|
|
186
184
|
return _this;
|
|
187
185
|
}
|
|
188
186
|
_createClass(EuiTreeView, [{
|
|
@@ -18,7 +18,7 @@ var is = function is(expectedValue) {
|
|
|
18
18
|
var compName = componentName || 'ANONYMOUS';
|
|
19
19
|
var value = props[propName];
|
|
20
20
|
if (value !== expectedValue) {
|
|
21
|
-
return new Error("[".concat(propName, "] property in [").concat(compName, "] component is expected to equal [").concat(expectedValue, "] but\n [").concat(value, "] was provided instead."));
|
|
21
|
+
return new Error("[".concat(propName.toString(), "] property in [").concat(compName, "] component is expected to equal [").concat(expectedValue, "] but\n [").concat(value, "] was provided instead."));
|
|
22
22
|
}
|
|
23
23
|
return null;
|
|
24
24
|
};
|
|
@@ -26,7 +26,7 @@ var is = function is(expectedValue) {
|
|
|
26
26
|
var compName = componentName || 'ANONYMOUS';
|
|
27
27
|
var value = props[propName];
|
|
28
28
|
if ((0, _predicate.isNil)(value)) {
|
|
29
|
-
return new Error("[".concat(propName, "] property in [").concat(compName, "] component is required but seems to be missing"));
|
|
29
|
+
return new Error("[".concat(propName.toString(), "] property in [").concat(compName, "] component is required but seems to be missing"));
|
|
30
30
|
}
|
|
31
31
|
return validator(props, propName, componentName);
|
|
32
32
|
};
|
|
@@ -421,7 +421,7 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
421
421
|
var sortDirection = _this2.resolveColumnSortDirection(column);
|
|
422
422
|
items.push({
|
|
423
423
|
name: column.name,
|
|
424
|
-
key: "_data_s_".concat(column.field, "_").concat(index),
|
|
424
|
+
key: "_data_s_".concat(String(column.field), "_").concat(index),
|
|
425
425
|
onSort: _this2.resolveColumnOnSort(column),
|
|
426
426
|
isSorted: !!sortDirection,
|
|
427
427
|
isSortAscending: sortDirection ? SortDirection.isAsc(sortDirection) : undefined
|
|
@@ -574,11 +574,11 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
574
574
|
}
|
|
575
575
|
}
|
|
576
576
|
headers.push(___EmotionJSX(EuiTableHeaderCell, _extends({
|
|
577
|
-
key: "_data_h_".concat(field, "_").concat(index),
|
|
577
|
+
key: "_data_h_".concat(String(field), "_").concat(index),
|
|
578
578
|
align: columnAlign,
|
|
579
579
|
width: width,
|
|
580
580
|
mobileOptions: mobileOptions,
|
|
581
|
-
"data-test-subj": "tableHeaderCell_".concat(field, "_").concat(index),
|
|
581
|
+
"data-test-subj": "tableHeaderCell_".concat(String(field), "_").concat(index),
|
|
582
582
|
description: description
|
|
583
583
|
}, sorting), name));
|
|
584
584
|
});
|
|
@@ -615,7 +615,7 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
615
615
|
|
|
616
616
|
if (footer) {
|
|
617
617
|
footers.push(___EmotionJSX(EuiTableFooterCell, {
|
|
618
|
-
key: "footer_".concat(field, "_").concat(footers.length - 1),
|
|
618
|
+
key: "footer_".concat(String(field), "_").concat(footers.length - 1),
|
|
619
619
|
align: align
|
|
620
620
|
}, footer));
|
|
621
621
|
hasDefinedFooter = true;
|
|
@@ -798,19 +798,22 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
798
798
|
}, {
|
|
799
799
|
key: "renderItemActionsCell",
|
|
800
800
|
value: function renderItemActionsCell(itemId, item, column, columnIndex) {
|
|
801
|
-
|
|
802
|
-
var
|
|
803
|
-
return _this7.state.selection.length === 0 && (!action.enabled || action.enabled(item));
|
|
804
|
-
};
|
|
801
|
+
// Disable all actions if any row(s) are selected
|
|
802
|
+
var allDisabled = this.state.selection.length > 0;
|
|
805
803
|
var actualActions = column.actions.filter(function (action) {
|
|
806
804
|
return !action.available || action.available(item);
|
|
807
805
|
});
|
|
808
806
|
if (actualActions.length > 2) {
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
}
|
|
813
|
-
|
|
807
|
+
if (allDisabled) {
|
|
808
|
+
// If all actions are disabled, do not show any actions but the popover toggle
|
|
809
|
+
actualActions = [];
|
|
810
|
+
} else {
|
|
811
|
+
// if any of the actions `isPrimary`, add them inline as well, but only the first 2
|
|
812
|
+
var primaryActions = actualActions.filter(function (o) {
|
|
813
|
+
return o.isPrimary;
|
|
814
|
+
});
|
|
815
|
+
actualActions = primaryActions.slice(0, 2);
|
|
816
|
+
}
|
|
814
817
|
|
|
815
818
|
// if we have more than 1 action, we don't show them all in the cell, instead we
|
|
816
819
|
// put them all in a popover tool. This effectively means we can only have a maximum
|
|
@@ -823,18 +826,18 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
823
826
|
render: function render(item) {
|
|
824
827
|
return ___EmotionJSX(CollapsedItemActions, {
|
|
825
828
|
actions: column.actions,
|
|
829
|
+
actionsDisabled: allDisabled,
|
|
826
830
|
itemId: itemId,
|
|
827
|
-
item: item
|
|
828
|
-
actionEnabled: actionEnabled
|
|
831
|
+
item: item
|
|
829
832
|
});
|
|
830
833
|
}
|
|
831
834
|
});
|
|
832
835
|
}
|
|
833
836
|
var tools = ___EmotionJSX(ExpandedItemActions, {
|
|
834
837
|
actions: actualActions,
|
|
838
|
+
actionsDisabled: allDisabled,
|
|
835
839
|
itemId: itemId,
|
|
836
|
-
item: item
|
|
837
|
-
actionEnabled: actionEnabled
|
|
840
|
+
item: item
|
|
838
841
|
});
|
|
839
842
|
var key = "record_actions_".concat(itemId, "_").concat(columnIndex);
|
|
840
843
|
return ___EmotionJSX(EuiTableRowCell, {
|
|
@@ -852,7 +855,7 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
852
855
|
var field = column.field,
|
|
853
856
|
render = column.render,
|
|
854
857
|
dataType = column.dataType;
|
|
855
|
-
var key = "_data_column_".concat(field, "_").concat(itemId, "_").concat(columnIndex);
|
|
858
|
+
var key = "_data_column_".concat(String(field), "_").concat(itemId, "_").concat(columnIndex);
|
|
856
859
|
var contentRenderer = render || this.getRendererForDataType(dataType);
|
|
857
860
|
var value = get(item, field);
|
|
858
861
|
var content = contentRenderer(value, item);
|
|
@@ -921,7 +924,7 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
921
924
|
}, {
|
|
922
925
|
key: "renderPaginationBar",
|
|
923
926
|
value: function renderPaginationBar() {
|
|
924
|
-
var
|
|
927
|
+
var _this7 = this;
|
|
925
928
|
var _this$props11 = this.props,
|
|
926
929
|
error = _this$props11.error,
|
|
927
930
|
pagination = _this$props11.pagination,
|
|
@@ -940,9 +943,9 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
940
943
|
}, function (tablePagination) {
|
|
941
944
|
return ___EmotionJSX(PaginationBar, {
|
|
942
945
|
pagination: pagination,
|
|
943
|
-
onPageSizeChange:
|
|
944
|
-
onPageChange:
|
|
945
|
-
"aria-controls":
|
|
946
|
+
onPageSizeChange: _this7.onPageSizeChange.bind(_this7),
|
|
947
|
+
onPageChange: _this7.onPageChange.bind(_this7),
|
|
948
|
+
"aria-controls": _this7.tableId,
|
|
946
949
|
"aria-label": tablePagination
|
|
947
950
|
});
|
|
948
951
|
});
|
|
@@ -20,16 +20,12 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
20
20
|
var actions = _ref.actions,
|
|
21
21
|
itemId = _ref.itemId,
|
|
22
22
|
item = _ref.item,
|
|
23
|
-
|
|
23
|
+
actionsDisabled = _ref.actionsDisabled,
|
|
24
24
|
className = _ref.className;
|
|
25
25
|
var _useState = useState(false),
|
|
26
26
|
_useState2 = _slicedToArray(_useState, 2),
|
|
27
27
|
popoverOpen = _useState2[0],
|
|
28
28
|
setPopoverOpen = _useState2[1];
|
|
29
|
-
var _useState3 = useState(true),
|
|
30
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
31
|
-
allDisabled = _useState4[0],
|
|
32
|
-
setAllDisabled = _useState4[1];
|
|
33
29
|
var onClickItem = useCallback(function (onClickAction) {
|
|
34
30
|
setPopoverOpen(false);
|
|
35
31
|
onClickAction === null || onClickAction === void 0 ? void 0 : onClickAction();
|
|
@@ -39,8 +35,7 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
39
35
|
var _action$available, _action$available2;
|
|
40
36
|
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;
|
|
41
37
|
if (!available) return controls;
|
|
42
|
-
var enabled =
|
|
43
|
-
if (enabled) setAllDisabled(false);
|
|
38
|
+
var enabled = action.enabled == null || action.enabled(item);
|
|
44
39
|
if (isCustomItemAction(action)) {
|
|
45
40
|
var customAction = action;
|
|
46
41
|
var actionControl = customAction.render(item, enabled);
|
|
@@ -71,7 +66,7 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
71
66
|
controls.push(___EmotionJSX(EuiContextMenuItem, {
|
|
72
67
|
key: index,
|
|
73
68
|
className: "euiBasicTable__collapsedAction",
|
|
74
|
-
disabled: !enabled,
|
|
69
|
+
disabled: !enabled && !actionsDisabled,
|
|
75
70
|
href: href,
|
|
76
71
|
target: target,
|
|
77
72
|
icon: icon,
|
|
@@ -89,17 +84,21 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
89
84
|
}
|
|
90
85
|
return controls;
|
|
91
86
|
}, []);
|
|
92
|
-
}, [actions,
|
|
87
|
+
}, [actions, actionsDisabled, item, onClickItem]);
|
|
93
88
|
var popoverButton = ___EmotionJSX(EuiI18n, {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}, function (
|
|
89
|
+
tokens: ['euiCollapsedItemActions.allActions', 'euiCollapsedItemActions.allActionsDisabled'],
|
|
90
|
+
defaults: ['All actions', 'Individual item actions are disabled when rows are being selected.']
|
|
91
|
+
}, function (_ref2) {
|
|
92
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
93
|
+
allActions = _ref3[0],
|
|
94
|
+
allActionsDisabled = _ref3[1];
|
|
97
95
|
return ___EmotionJSX(EuiButtonIcon, {
|
|
98
96
|
className: className,
|
|
99
|
-
"aria-label": allActions,
|
|
97
|
+
"aria-label": actionsDisabled ? allActionsDisabled : allActions,
|
|
98
|
+
title: actionsDisabled ? allActionsDisabled : undefined,
|
|
100
99
|
iconType: "boxesHorizontal",
|
|
101
100
|
color: "text",
|
|
102
|
-
isDisabled:
|
|
101
|
+
isDisabled: actionsDisabled,
|
|
103
102
|
onClick: function onClick() {
|
|
104
103
|
return setPopoverOpen(function (isOpen) {
|
|
105
104
|
return !isOpen;
|
|
@@ -108,7 +107,7 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
108
107
|
"data-test-subj": "euiCollapsedItemActionsButton"
|
|
109
108
|
});
|
|
110
109
|
});
|
|
111
|
-
var withTooltip = !
|
|
110
|
+
var withTooltip = !actionsDisabled && ___EmotionJSX(EuiI18n, {
|
|
112
111
|
token: "euiCollapsedItemActions.allActions",
|
|
113
112
|
default: "All actions"
|
|
114
113
|
}, 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
|
}
|
|
@@ -117,7 +117,8 @@ export var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
|
|
|
117
117
|
});
|
|
118
118
|
},
|
|
119
119
|
"aria-describedby": "".concat(sortingAriaId, " ").concat(actionsAriaId),
|
|
120
|
-
ref: actionsButtonRef
|
|
120
|
+
ref: actionsButtonRef,
|
|
121
|
+
"data-test-subj": "dataGridHeaderCellActionButton-".concat(id)
|
|
121
122
|
}, cellContent, ___EmotionJSX(EuiPopover, _extends({
|
|
122
123
|
display: "block",
|
|
123
124
|
panelPaddingSize: "none",
|
|
@@ -139,8 +140,7 @@ export var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
|
|
|
139
140
|
}, ___EmotionJSX(EuiIcon, {
|
|
140
141
|
type: "boxesVertical",
|
|
141
142
|
size: "s",
|
|
142
|
-
color: "text"
|
|
143
|
-
"data-test-subj": "dataGridHeaderCellActionButton-".concat(id)
|
|
143
|
+
color: "text"
|
|
144
144
|
})),
|
|
145
145
|
isOpen: isPopoverOpen,
|
|
146
146
|
closePopover: function closePopover() {
|
|
@@ -71,7 +71,7 @@ var DragAndDrop = function DragAndDrop() {
|
|
|
71
71
|
beforeEach(function () {
|
|
72
72
|
cy.realMount(___EmotionJSX(DragAndDrop, null));
|
|
73
73
|
});
|
|
74
|
-
describe('
|
|
74
|
+
describe('EuiDragDrop', function () {
|
|
75
75
|
describe('Automated accessibility check', function () {
|
|
76
76
|
it('has zero violations on render', function () {
|
|
77
77
|
cy.checkAxe();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
5
|
var _excluded = ["children", "className", "iconType", "iconSide", "color", "badgeColor", "hasActiveFilters", "numFilters", "numActiveFilters", "isDisabled", "isSelected", "type", "grow", "withNext", "textProps", "contentProps"];
|
|
@@ -59,6 +59,10 @@ export var EuiFilterButton = function EuiFilterButton(_ref) {
|
|
|
59
59
|
'euiFilterButton-hasActiveFilters': hasActiveFilters,
|
|
60
60
|
'euiFilterButton-hasNotification': numFiltersDefined
|
|
61
61
|
}, className);
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Badge
|
|
65
|
+
*/
|
|
62
66
|
var showBadge = numFiltersDefined || numActiveFiltersDefined;
|
|
63
67
|
var badgeCount = numActiveFilters || numFilters;
|
|
64
68
|
var activeBadgeLabel = useEuiI18n('euiFilterButton.filterBadgeActiveAriaLabel', '{count} active filters', {
|
|
@@ -67,9 +71,6 @@ export var EuiFilterButton = function EuiFilterButton(_ref) {
|
|
|
67
71
|
var availableBadgeLabel = useEuiI18n('euiFilterButton.filterBadgeAvailableAriaLabel', '{count} available filters', {
|
|
68
72
|
count: badgeCount
|
|
69
73
|
});
|
|
70
|
-
var buttonTextClassNames = classNames('euiFilterButton__text', {
|
|
71
|
-
'euiFilterButton__text-hasNotification': showBadge
|
|
72
|
-
}, textProps && textProps.className);
|
|
73
74
|
var badgeContent = showBadge && ___EmotionJSX(EuiNotificationBadge, {
|
|
74
75
|
className: "euiFilterButton__notification",
|
|
75
76
|
css: [notificationStyles.euiFilterButton__notification, isDisabled && notificationStyles.disabled, ";label:badgeContent;"],
|
|
@@ -77,18 +78,27 @@ export var EuiFilterButton = function EuiFilterButton(_ref) {
|
|
|
77
78
|
color: isDisabled || !hasActiveFilters ? 'subdued' : badgeColor,
|
|
78
79
|
role: "marquee" // https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/marquee_role
|
|
79
80
|
}, badgeCount);
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Text
|
|
84
|
+
*/
|
|
85
|
+
var buttonTextClassNames = classNames('euiFilterButton__text', {
|
|
86
|
+
'euiFilterButton__text-hasNotification': showBadge
|
|
87
|
+
}, textProps && textProps.className);
|
|
88
|
+
var textCssStyles = [textStyles.euiFilterButton__text, showBadge && textStyles.hasNotification, textProps && textProps.css];
|
|
80
89
|
var _useInnerText = useInnerText(),
|
|
81
90
|
_useInnerText2 = _slicedToArray(_useInnerText, 2),
|
|
82
91
|
ref = _useInnerText2[0],
|
|
83
92
|
innerText = _useInnerText2[1];
|
|
84
93
|
var dataText = children && typeof children === 'string' ? children : innerText;
|
|
85
|
-
var
|
|
94
|
+
var textContent = ___EmotionJSX("span", _extends({
|
|
86
95
|
ref: ref,
|
|
87
|
-
className: "euiFilterButton__textShift",
|
|
88
|
-
css: textStyles.euiFilterButton__textShift,
|
|
89
96
|
"data-text": dataText,
|
|
90
97
|
title: dataText
|
|
91
|
-
},
|
|
98
|
+
}, textProps, {
|
|
99
|
+
className: buttonTextClassNames,
|
|
100
|
+
css: textCssStyles
|
|
101
|
+
}), children);
|
|
92
102
|
return ___EmotionJSX(EuiButtonEmpty, _extends({
|
|
93
103
|
className: classes,
|
|
94
104
|
css: cssStyles,
|
|
@@ -97,12 +107,9 @@ export var EuiFilterButton = function EuiFilterButton(_ref) {
|
|
|
97
107
|
iconSide: iconSide,
|
|
98
108
|
iconType: iconType,
|
|
99
109
|
type: type,
|
|
100
|
-
textProps:
|
|
101
|
-
className: buttonTextClassNames,
|
|
102
|
-
css: [textStyles.euiFilterButton__text, showBadge && textStyles.hasNotification, textProps && textProps.css]
|
|
103
|
-
}),
|
|
110
|
+
textProps: false,
|
|
104
111
|
contentProps: _objectSpread(_objectSpread({}, contentProps), {}, {
|
|
105
112
|
css: [contentStyles.euiFilterButton__content, iconType && contentStyles.hasIcon, contentProps === null || contentProps === void 0 ? void 0 : contentProps.css]
|
|
106
113
|
})
|
|
107
|
-
}, rest),
|
|
114
|
+
}, rest), textContent, badgeContent);
|
|
108
115
|
};
|
|
@@ -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,
|
|
@@ -98,18 +98,18 @@ export var EuiFlyout = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
98
98
|
*/
|
|
99
99
|
if (isPushed) {
|
|
100
100
|
if (side === 'right') {
|
|
101
|
-
document.body.style.
|
|
101
|
+
document.body.style.paddingInlineEnd = "".concat(dimensions.width, "px");
|
|
102
102
|
} else if (side === 'left') {
|
|
103
|
-
document.body.style.
|
|
103
|
+
document.body.style.paddingInlineStart = "".concat(dimensions.width, "px");
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
return function () {
|
|
107
107
|
document.body.classList.remove('euiBody--hasFlyout');
|
|
108
108
|
if (isPushed) {
|
|
109
109
|
if (side === 'right') {
|
|
110
|
-
document.body.style.
|
|
110
|
+
document.body.style.paddingInlineEnd = '';
|
|
111
111
|
} else if (side === 'left') {
|
|
112
|
-
document.body.style.
|
|
112
|
+
document.body.style.paddingInlineStart = '';
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["size", "maxWidth", "minWidth", "side", "children"];
|
|
5
|
+
/*
|
|
6
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
7
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
8
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
9
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
10
|
+
* Side Public License, v 1.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import React, { forwardRef, useState, useEffect, useRef, useMemo, useCallback } from 'react';
|
|
14
|
+
import { keys, useCombinedRefs, useEuiTheme } from '../../services';
|
|
15
|
+
import { EuiResizableButton } from '../resizable_container';
|
|
16
|
+
import { EuiFlyout } from './flyout';
|
|
17
|
+
import { euiFlyoutResizableButtonStyles } from './flyout_resizable.styles';
|
|
18
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
19
|
+
export var EuiFlyoutResizable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
20
|
+
var size = _ref.size,
|
|
21
|
+
maxWidth = _ref.maxWidth,
|
|
22
|
+
_ref$minWidth = _ref.minWidth,
|
|
23
|
+
minWidth = _ref$minWidth === void 0 ? 200 : _ref$minWidth,
|
|
24
|
+
_ref$side = _ref.side,
|
|
25
|
+
side = _ref$side === void 0 ? 'right' : _ref$side,
|
|
26
|
+
children = _ref.children,
|
|
27
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
28
|
+
var euiTheme = useEuiTheme();
|
|
29
|
+
var styles = euiFlyoutResizableButtonStyles(euiTheme);
|
|
30
|
+
var cssStyles = [styles.euiFlyoutResizableButton, styles[side]];
|
|
31
|
+
var getFlyoutMinMaxWidth = useCallback(function (width) {
|
|
32
|
+
return Math.min(Math.max(width, minWidth), maxWidth || Infinity, window.innerWidth - 20 // Leave some offset
|
|
33
|
+
);
|
|
34
|
+
}, [minWidth, maxWidth]);
|
|
35
|
+
var _useState = useState(0),
|
|
36
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
37
|
+
flyoutWidth = _useState2[0],
|
|
38
|
+
setFlyoutWidth = _useState2[1];
|
|
39
|
+
|
|
40
|
+
// Must use state for the flyout ref in order for the useEffect to be correctly called after render
|
|
41
|
+
var _useState3 = useState(null),
|
|
42
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
43
|
+
flyoutRef = _useState4[0],
|
|
44
|
+
setFlyoutRef = _useState4[1];
|
|
45
|
+
var setRefs = useCombinedRefs([setFlyoutRef, ref]);
|
|
46
|
+
useEffect(function () {
|
|
47
|
+
setFlyoutWidth(flyoutRef ? getFlyoutMinMaxWidth(flyoutRef.offsetWidth) : 0);
|
|
48
|
+
}, [flyoutRef, getFlyoutMinMaxWidth, size]);
|
|
49
|
+
|
|
50
|
+
// Initial numbers to calculate from, on resize drag start
|
|
51
|
+
var initialWidth = useRef(0);
|
|
52
|
+
var initialMouseX = useRef(0);
|
|
53
|
+
|
|
54
|
+
// Account for flyout side and logical property direction
|
|
55
|
+
var direction = useMemo(function () {
|
|
56
|
+
var modifier = side === 'right' ? -1 : 1;
|
|
57
|
+
if (flyoutRef) {
|
|
58
|
+
var languageDirection = window.getComputedStyle(flyoutRef).direction;
|
|
59
|
+
if (languageDirection === 'rtl') modifier *= -1;
|
|
60
|
+
}
|
|
61
|
+
return modifier;
|
|
62
|
+
}, [side, flyoutRef]);
|
|
63
|
+
var onMouseMove = useCallback(function (e) {
|
|
64
|
+
var mouseOffset = getMouseOrTouchX(e) - initialMouseX.current;
|
|
65
|
+
var changedFlyoutWidth = initialWidth.current + mouseOffset * direction;
|
|
66
|
+
setFlyoutWidth(getFlyoutMinMaxWidth(changedFlyoutWidth));
|
|
67
|
+
}, [getFlyoutMinMaxWidth, direction]);
|
|
68
|
+
var onMouseUp = useCallback(function () {
|
|
69
|
+
initialMouseX.current = 0;
|
|
70
|
+
window.removeEventListener('mousemove', onMouseMove);
|
|
71
|
+
window.removeEventListener('mouseup', onMouseUp);
|
|
72
|
+
window.removeEventListener('touchmove', onMouseMove);
|
|
73
|
+
window.removeEventListener('touchend', onMouseUp);
|
|
74
|
+
}, [onMouseMove]);
|
|
75
|
+
var onMouseDown = useCallback(function (e) {
|
|
76
|
+
var _flyoutRef$offsetWidt;
|
|
77
|
+
initialMouseX.current = getMouseOrTouchX(e);
|
|
78
|
+
initialWidth.current = (_flyoutRef$offsetWidt = flyoutRef === null || flyoutRef === void 0 ? void 0 : flyoutRef.offsetWidth) !== null && _flyoutRef$offsetWidt !== void 0 ? _flyoutRef$offsetWidt : 0;
|
|
79
|
+
|
|
80
|
+
// Window event listeners instead of React events are used
|
|
81
|
+
// in case the user's mouse leaves the component
|
|
82
|
+
window.addEventListener('mousemove', onMouseMove);
|
|
83
|
+
window.addEventListener('mouseup', onMouseUp);
|
|
84
|
+
window.addEventListener('touchmove', onMouseMove);
|
|
85
|
+
window.addEventListener('touchend', onMouseUp);
|
|
86
|
+
}, [flyoutRef, onMouseMove, onMouseUp]);
|
|
87
|
+
var onKeyDown = useCallback(function (e) {
|
|
88
|
+
var KEYBOARD_OFFSET = 10;
|
|
89
|
+
switch (e.key) {
|
|
90
|
+
case keys.ARROW_RIGHT:
|
|
91
|
+
e.preventDefault(); // Safari+VO will screen reader navigate off the button otherwise
|
|
92
|
+
setFlyoutWidth(function (flyoutWidth) {
|
|
93
|
+
return getFlyoutMinMaxWidth(flyoutWidth + KEYBOARD_OFFSET * direction);
|
|
94
|
+
});
|
|
95
|
+
break;
|
|
96
|
+
case keys.ARROW_LEFT:
|
|
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
|
+
}
|
|
102
|
+
}, [getFlyoutMinMaxWidth, direction]);
|
|
103
|
+
return ___EmotionJSX(EuiFlyout, _extends({}, rest, {
|
|
104
|
+
size: flyoutWidth || size,
|
|
105
|
+
maxWidth: maxWidth,
|
|
106
|
+
side: side,
|
|
107
|
+
ref: setRefs
|
|
108
|
+
}), ___EmotionJSX(EuiResizableButton, {
|
|
109
|
+
isHorizontal: true,
|
|
110
|
+
css: cssStyles,
|
|
111
|
+
onMouseDown: onMouseDown,
|
|
112
|
+
onTouchStart: onMouseDown,
|
|
113
|
+
onKeyDown: onKeyDown
|
|
114
|
+
}), children);
|
|
115
|
+
});
|
|
116
|
+
EuiFlyoutResizable.displayName = 'EuiFlyoutResizable';
|
|
117
|
+
var getMouseOrTouchX = function getMouseOrTouchX(e) {
|
|
118
|
+
// Some Typescript fooling is needed here
|
|
119
|
+
var x = e.targetTouches ? e.targetTouches[0].pageX : e.pageX;
|
|
120
|
+
return x;
|
|
121
|
+
};
|
|
@@ -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
|
+
};
|