@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
|
@@ -30,16 +30,12 @@ var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
30
30
|
var actions = _ref.actions,
|
|
31
31
|
itemId = _ref.itemId,
|
|
32
32
|
item = _ref.item,
|
|
33
|
-
|
|
33
|
+
actionsDisabled = _ref.actionsDisabled,
|
|
34
34
|
className = _ref.className;
|
|
35
35
|
var _useState = (0, _react.useState)(false),
|
|
36
36
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
37
37
|
popoverOpen = _useState2[0],
|
|
38
38
|
setPopoverOpen = _useState2[1];
|
|
39
|
-
var _useState3 = (0, _react.useState)(true),
|
|
40
|
-
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
41
|
-
allDisabled = _useState4[0],
|
|
42
|
-
setAllDisabled = _useState4[1];
|
|
43
39
|
var onClickItem = (0, _react.useCallback)(function (onClickAction) {
|
|
44
40
|
setPopoverOpen(false);
|
|
45
41
|
onClickAction === null || onClickAction === void 0 ? void 0 : onClickAction();
|
|
@@ -49,8 +45,7 @@ var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
49
45
|
var _action$available, _action$available2;
|
|
50
46
|
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;
|
|
51
47
|
if (!available) return controls;
|
|
52
|
-
var enabled =
|
|
53
|
-
if (enabled) setAllDisabled(false);
|
|
48
|
+
var enabled = action.enabled == null || action.enabled(item);
|
|
54
49
|
if ((0, _action_types.isCustomItemAction)(action)) {
|
|
55
50
|
var customAction = action;
|
|
56
51
|
var actionControl = customAction.render(item, enabled);
|
|
@@ -81,7 +76,7 @@ var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
81
76
|
controls.push((0, _react2.jsx)(_context_menu.EuiContextMenuItem, {
|
|
82
77
|
key: index,
|
|
83
78
|
className: "euiBasicTable__collapsedAction",
|
|
84
|
-
disabled: !enabled,
|
|
79
|
+
disabled: !enabled && !actionsDisabled,
|
|
85
80
|
href: href,
|
|
86
81
|
target: target,
|
|
87
82
|
icon: icon,
|
|
@@ -99,17 +94,21 @@ var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
99
94
|
}
|
|
100
95
|
return controls;
|
|
101
96
|
}, []);
|
|
102
|
-
}, [actions,
|
|
97
|
+
}, [actions, actionsDisabled, item, onClickItem]);
|
|
103
98
|
var popoverButton = (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}, function (
|
|
99
|
+
tokens: ['euiCollapsedItemActions.allActions', 'euiCollapsedItemActions.allActionsDisabled'],
|
|
100
|
+
defaults: ['All actions', 'Individual item actions are disabled when rows are being selected.']
|
|
101
|
+
}, function (_ref2) {
|
|
102
|
+
var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
|
|
103
|
+
allActions = _ref3[0],
|
|
104
|
+
allActionsDisabled = _ref3[1];
|
|
107
105
|
return (0, _react2.jsx)(_button.EuiButtonIcon, {
|
|
108
106
|
className: className,
|
|
109
|
-
"aria-label": allActions,
|
|
107
|
+
"aria-label": actionsDisabled ? allActionsDisabled : allActions,
|
|
108
|
+
title: actionsDisabled ? allActionsDisabled : undefined,
|
|
110
109
|
iconType: "boxesHorizontal",
|
|
111
110
|
color: "text",
|
|
112
|
-
isDisabled:
|
|
111
|
+
isDisabled: actionsDisabled,
|
|
113
112
|
onClick: function onClick() {
|
|
114
113
|
return setPopoverOpen(function (isOpen) {
|
|
115
114
|
return !isOpen;
|
|
@@ -118,7 +117,7 @@ var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
118
117
|
"data-test-subj": "euiCollapsedItemActionsButton"
|
|
119
118
|
});
|
|
120
119
|
});
|
|
121
|
-
var withTooltip = !
|
|
120
|
+
var withTooltip = !actionsDisabled && (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
122
121
|
token: "euiCollapsedItemActions.allActions",
|
|
123
122
|
default: "All actions"
|
|
124
123
|
}, function (allActions) {
|
|
@@ -23,7 +23,7 @@ var ExpandedItemActions = function ExpandedItemActions(_ref) {
|
|
|
23
23
|
var actions = _ref.actions,
|
|
24
24
|
itemId = _ref.itemId,
|
|
25
25
|
item = _ref.item,
|
|
26
|
-
|
|
26
|
+
actionsDisabled = _ref.actionsDisabled,
|
|
27
27
|
className = _ref.className;
|
|
28
28
|
var moreThanThree = actions.length > 2;
|
|
29
29
|
return (0, _react2.jsx)(_react.default.Fragment, null, actions.reduce(function (tools, action, index) {
|
|
@@ -31,7 +31,7 @@ var ExpandedItemActions = function ExpandedItemActions(_ref) {
|
|
|
31
31
|
if (!available) {
|
|
32
32
|
return tools;
|
|
33
33
|
}
|
|
34
|
-
var enabled =
|
|
34
|
+
var enabled = action.enabled == null || action.enabled(item);
|
|
35
35
|
var key = "item_action_".concat(itemId, "_").concat(index);
|
|
36
36
|
var classes = (0, _classnames.default)(className, {
|
|
37
37
|
expandedItemActions__completelyHide: moreThanThree && index < 2
|
|
@@ -43,7 +43,7 @@ var ExpandedItemActions = function ExpandedItemActions(_ref) {
|
|
|
43
43
|
className: classes,
|
|
44
44
|
index: index,
|
|
45
45
|
action: action,
|
|
46
|
-
enabled: enabled,
|
|
46
|
+
enabled: enabled && !actionsDisabled,
|
|
47
47
|
item: item
|
|
48
48
|
}));
|
|
49
49
|
} else {
|
|
@@ -51,7 +51,7 @@ var ExpandedItemActions = function ExpandedItemActions(_ref) {
|
|
|
51
51
|
key: key,
|
|
52
52
|
className: classes,
|
|
53
53
|
action: action,
|
|
54
|
-
enabled: enabled,
|
|
54
|
+
enabled: enabled && !actionsDisabled,
|
|
55
55
|
item: item
|
|
56
56
|
}));
|
|
57
57
|
}
|
|
@@ -125,7 +125,8 @@ var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
|
|
|
125
125
|
});
|
|
126
126
|
},
|
|
127
127
|
"aria-describedby": "".concat(sortingAriaId, " ").concat(actionsAriaId),
|
|
128
|
-
ref: actionsButtonRef
|
|
128
|
+
ref: actionsButtonRef,
|
|
129
|
+
"data-test-subj": "dataGridHeaderCellActionButton-".concat(id)
|
|
129
130
|
}, cellContent, (0, _react2.jsx)(_popover.EuiPopover, (0, _extends2.default)({
|
|
130
131
|
display: "block",
|
|
131
132
|
panelPaddingSize: "none",
|
|
@@ -147,8 +148,7 @@ var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
|
|
|
147
148
|
}, (0, _react2.jsx)(_icon.EuiIcon, {
|
|
148
149
|
type: "boxesVertical",
|
|
149
150
|
size: "s",
|
|
150
|
-
color: "text"
|
|
151
|
-
"data-test-subj": "dataGridHeaderCellActionButton-".concat(id)
|
|
151
|
+
color: "text"
|
|
152
152
|
})),
|
|
153
153
|
isOpen: isPopoverOpen,
|
|
154
154
|
closePopover: function closePopover() {
|
|
@@ -77,7 +77,7 @@ var DragAndDrop = function DragAndDrop() {
|
|
|
77
77
|
beforeEach(function () {
|
|
78
78
|
cy.realMount((0, _react2.jsx)(DragAndDrop, null));
|
|
79
79
|
});
|
|
80
|
-
describe('
|
|
80
|
+
describe('EuiDragDrop', function () {
|
|
81
81
|
describe('Automated accessibility check', function () {
|
|
82
82
|
it('has zero violations on render', function () {
|
|
83
83
|
cy.checkAxe();
|
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.EuiFilterButton = void 0;
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
12
12
|
var _react = _interopRequireDefault(require("react"));
|
|
@@ -65,6 +65,10 @@ var EuiFilterButton = function EuiFilterButton(_ref) {
|
|
|
65
65
|
'euiFilterButton-hasActiveFilters': hasActiveFilters,
|
|
66
66
|
'euiFilterButton-hasNotification': numFiltersDefined
|
|
67
67
|
}, className);
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Badge
|
|
71
|
+
*/
|
|
68
72
|
var showBadge = numFiltersDefined || numActiveFiltersDefined;
|
|
69
73
|
var badgeCount = numActiveFilters || numFilters;
|
|
70
74
|
var activeBadgeLabel = (0, _i18n.useEuiI18n)('euiFilterButton.filterBadgeActiveAriaLabel', '{count} active filters', {
|
|
@@ -73,9 +77,6 @@ var EuiFilterButton = function EuiFilterButton(_ref) {
|
|
|
73
77
|
var availableBadgeLabel = (0, _i18n.useEuiI18n)('euiFilterButton.filterBadgeAvailableAriaLabel', '{count} available filters', {
|
|
74
78
|
count: badgeCount
|
|
75
79
|
});
|
|
76
|
-
var buttonTextClassNames = (0, _classnames.default)('euiFilterButton__text', {
|
|
77
|
-
'euiFilterButton__text-hasNotification': showBadge
|
|
78
|
-
}, textProps && textProps.className);
|
|
79
80
|
var badgeContent = showBadge && (0, _react2.jsx)(_badge.EuiNotificationBadge, {
|
|
80
81
|
className: "euiFilterButton__notification",
|
|
81
82
|
css: [notificationStyles.euiFilterButton__notification, isDisabled && notificationStyles.disabled, ";label:badgeContent;"],
|
|
@@ -83,18 +84,27 @@ var EuiFilterButton = function EuiFilterButton(_ref) {
|
|
|
83
84
|
color: isDisabled || !hasActiveFilters ? 'subdued' : badgeColor,
|
|
84
85
|
role: "marquee" // https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/marquee_role
|
|
85
86
|
}, badgeCount);
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Text
|
|
90
|
+
*/
|
|
91
|
+
var buttonTextClassNames = (0, _classnames.default)('euiFilterButton__text', {
|
|
92
|
+
'euiFilterButton__text-hasNotification': showBadge
|
|
93
|
+
}, textProps && textProps.className);
|
|
94
|
+
var textCssStyles = [textStyles.euiFilterButton__text, showBadge && textStyles.hasNotification, textProps && textProps.css];
|
|
86
95
|
var _useInnerText = (0, _inner_text.useInnerText)(),
|
|
87
96
|
_useInnerText2 = (0, _slicedToArray2.default)(_useInnerText, 2),
|
|
88
97
|
ref = _useInnerText2[0],
|
|
89
98
|
innerText = _useInnerText2[1];
|
|
90
99
|
var dataText = children && typeof children === 'string' ? children : innerText;
|
|
91
|
-
var
|
|
100
|
+
var textContent = (0, _react2.jsx)("span", (0, _extends2.default)({
|
|
92
101
|
ref: ref,
|
|
93
|
-
className: "euiFilterButton__textShift",
|
|
94
|
-
css: textStyles.euiFilterButton__textShift,
|
|
95
102
|
"data-text": dataText,
|
|
96
103
|
title: dataText
|
|
97
|
-
},
|
|
104
|
+
}, textProps, {
|
|
105
|
+
className: buttonTextClassNames,
|
|
106
|
+
css: textCssStyles
|
|
107
|
+
}), children);
|
|
98
108
|
return (0, _react2.jsx)(_button_empty.EuiButtonEmpty, (0, _extends2.default)({
|
|
99
109
|
className: classes,
|
|
100
110
|
css: cssStyles,
|
|
@@ -103,13 +113,10 @@ var EuiFilterButton = function EuiFilterButton(_ref) {
|
|
|
103
113
|
iconSide: iconSide,
|
|
104
114
|
iconType: iconType,
|
|
105
115
|
type: type,
|
|
106
|
-
textProps:
|
|
107
|
-
className: buttonTextClassNames,
|
|
108
|
-
css: [textStyles.euiFilterButton__text, showBadge && textStyles.hasNotification, textProps && textProps.css]
|
|
109
|
-
}),
|
|
116
|
+
textProps: false,
|
|
110
117
|
contentProps: _objectSpread(_objectSpread({}, contentProps), {}, {
|
|
111
118
|
css: [contentStyles.euiFilterButton__content, iconType && contentStyles.hasIcon, contentProps === null || contentProps === void 0 ? void 0 : contentProps.css]
|
|
112
119
|
})
|
|
113
|
-
}, rest),
|
|
120
|
+
}, rest), textContent, badgeContent);
|
|
114
121
|
};
|
|
115
122
|
exports.EuiFilterButton = EuiFilterButton;
|
|
@@ -14,8 +14,8 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
|
|
|
14
14
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
15
15
|
* Side Public License, v 1.
|
|
16
16
|
*/
|
|
17
|
-
var euiFilterButtonDisplay = function euiFilterButtonDisplay(
|
|
18
|
-
var euiTheme =
|
|
17
|
+
var euiFilterButtonDisplay = function euiFilterButtonDisplay(_ref4) {
|
|
18
|
+
var euiTheme = _ref4.euiTheme;
|
|
19
19
|
return {
|
|
20
20
|
flex: '1 1 auto',
|
|
21
21
|
minInlineSize: (0, _global_styling.mathWithUnits)(euiTheme.size.base, function (x) {
|
|
@@ -24,7 +24,7 @@ var euiFilterButtonDisplay = function euiFilterButtonDisplay(_ref5) {
|
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
26
|
exports.euiFilterButtonDisplay = euiFilterButtonDisplay;
|
|
27
|
-
var
|
|
27
|
+
var _ref3 = process.env.NODE_ENV === "production" ? {
|
|
28
28
|
name: "jkp921-noGrow",
|
|
29
29
|
styles: "flex-grow:0;label:noGrow;"
|
|
30
30
|
} : {
|
|
@@ -43,9 +43,9 @@ var euiFilterButtonStyles = function euiFilterButtonStyles(euiThemeContext) {
|
|
|
43
43
|
// Bottom borders are needed for responsive flex-wrap behavior
|
|
44
44
|
var bottomBoxShadow = "0 ".concat(euiTheme.border.width.thin, " 0 0 ").concat(borderColor);
|
|
45
45
|
return {
|
|
46
|
-
euiFilterButton: /*#__PURE__*/(0, _react.css)(euiFilterButtonDisplay(euiThemeContext), " ", (0, _global_styling.logicalCSS)('height', controlHeight), " border-radius:0;box-shadow:", leftBoxShadow, ",", bottomBoxShadow, ";&:hover:not(:disabled),&:focus:not(:disabled){text-decoration:none;.
|
|
46
|
+
euiFilterButton: /*#__PURE__*/(0, _react.css)(euiFilterButtonDisplay(euiThemeContext), " ", (0, _global_styling.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;"),
|
|
47
47
|
withNext: /*#__PURE__*/(0, _react.css)("&+.euiFilterButton{", (0, _global_styling.logicalCSS)('margin-left', "-".concat(euiTheme.size.xs)), "box-shadow:", bottomBoxShadow, ";};label:withNext;"),
|
|
48
|
-
noGrow:
|
|
48
|
+
noGrow: _ref3,
|
|
49
49
|
hasNotification: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('min-width', (0, _global_styling.mathWithUnits)(euiTheme.size.base, function (x) {
|
|
50
50
|
return x * 6;
|
|
51
51
|
})), ";;label:hasNotification;"),
|
|
@@ -69,27 +69,18 @@ var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
|
69
69
|
styles: "cursor:inherit;label:euiFilterButton__notification;",
|
|
70
70
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
71
71
|
};
|
|
72
|
-
var
|
|
73
|
-
|
|
74
|
-
styles: "justify-content:space-between;label:hasIcon;"
|
|
75
|
-
} : {
|
|
76
|
-
name: "f0jxzj-hasIcon",
|
|
77
|
-
styles: "justify-content:space-between;label:hasIcon;",
|
|
78
|
-
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
79
|
-
};
|
|
80
|
-
var euiFilterButtonChildStyles = function euiFilterButtonChildStyles(_ref6) {
|
|
81
|
-
var euiTheme = _ref6.euiTheme;
|
|
72
|
+
var euiFilterButtonChildStyles = function euiFilterButtonChildStyles(_ref5) {
|
|
73
|
+
var euiTheme = _ref5.euiTheme;
|
|
82
74
|
return {
|
|
83
75
|
content: {
|
|
84
76
|
euiFilterButton__content: /*#__PURE__*/(0, _react.css)(";label:euiFilterButton__content;"),
|
|
85
|
-
hasIcon:
|
|
77
|
+
hasIcon: /*#__PURE__*/(0, _react.css)("&>.euiIcon:last-child{", (0, _global_styling.logicalCSS)('margin-left', 'auto'), ";};label:hasIcon;")
|
|
86
78
|
},
|
|
87
79
|
text: {
|
|
88
|
-
euiFilterButton__text: /*#__PURE__*/(0, _react.css)("
|
|
89
|
-
hasNotification: /*#__PURE__*/(0, _react.css)(
|
|
90
|
-
euiFilterButton__textShift: /*#__PURE__*/(0, _react.css)((0, _global_styling.euiTextShift)('bold', 'data-text', euiTheme), " ", (0, _global_styling.euiTextTruncate)(), " ", (0, _global_styling.logicalCSS)('min-width', (0, _global_styling.mathWithUnits)(euiTheme.size.base, function (x) {
|
|
80
|
+
euiFilterButton__text: /*#__PURE__*/(0, _react.css)((0, _global_styling.euiTextShift)('bold', 'data-text', euiTheme), " ", (0, _global_styling.euiTextTruncate)(), ";;label:euiFilterButton__text;"),
|
|
81
|
+
hasNotification: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('min-width', (0, _global_styling.mathWithUnits)(euiTheme.size.base, function (x) {
|
|
91
82
|
return x * 3;
|
|
92
|
-
})), ";;label:
|
|
83
|
+
})), ";;label:hasNotification;")
|
|
93
84
|
},
|
|
94
85
|
notification: {
|
|
95
86
|
euiFilterButton__notification: _ref2,
|
|
@@ -111,18 +111,18 @@ var EuiFlyout = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
111
111
|
*/
|
|
112
112
|
if (isPushed) {
|
|
113
113
|
if (side === 'right') {
|
|
114
|
-
document.body.style.
|
|
114
|
+
document.body.style.paddingInlineEnd = "".concat(dimensions.width, "px");
|
|
115
115
|
} else if (side === 'left') {
|
|
116
|
-
document.body.style.
|
|
116
|
+
document.body.style.paddingInlineStart = "".concat(dimensions.width, "px");
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
return function () {
|
|
120
120
|
document.body.classList.remove('euiBody--hasFlyout');
|
|
121
121
|
if (isPushed) {
|
|
122
122
|
if (side === 'right') {
|
|
123
|
-
document.body.style.
|
|
123
|
+
document.body.style.paddingInlineEnd = '';
|
|
124
124
|
} else if (side === 'left') {
|
|
125
|
-
document.body.style.
|
|
125
|
+
document.body.style.paddingInlineStart = '';
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.EuiFlyoutResizable = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _services = require("../../services");
|
|
14
|
+
var _resizable_container = require("../resizable_container");
|
|
15
|
+
var _flyout = require("./flyout");
|
|
16
|
+
var _flyout_resizable = require("./flyout_resizable.styles");
|
|
17
|
+
var _react2 = require("@emotion/react");
|
|
18
|
+
var _excluded = ["size", "maxWidth", "minWidth", "side", "children"];
|
|
19
|
+
/*
|
|
20
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
21
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
22
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
23
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
24
|
+
* Side Public License, v 1.
|
|
25
|
+
*/
|
|
26
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
28
|
+
var EuiFlyoutResizable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
29
|
+
var size = _ref.size,
|
|
30
|
+
maxWidth = _ref.maxWidth,
|
|
31
|
+
_ref$minWidth = _ref.minWidth,
|
|
32
|
+
minWidth = _ref$minWidth === void 0 ? 200 : _ref$minWidth,
|
|
33
|
+
_ref$side = _ref.side,
|
|
34
|
+
side = _ref$side === void 0 ? 'right' : _ref$side,
|
|
35
|
+
children = _ref.children,
|
|
36
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
37
|
+
var euiTheme = (0, _services.useEuiTheme)();
|
|
38
|
+
var styles = (0, _flyout_resizable.euiFlyoutResizableButtonStyles)(euiTheme);
|
|
39
|
+
var cssStyles = [styles.euiFlyoutResizableButton, styles[side]];
|
|
40
|
+
var getFlyoutMinMaxWidth = (0, _react.useCallback)(function (width) {
|
|
41
|
+
return Math.min(Math.max(width, minWidth), maxWidth || Infinity, window.innerWidth - 20 // Leave some offset
|
|
42
|
+
);
|
|
43
|
+
}, [minWidth, maxWidth]);
|
|
44
|
+
var _useState = (0, _react.useState)(0),
|
|
45
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
46
|
+
flyoutWidth = _useState2[0],
|
|
47
|
+
setFlyoutWidth = _useState2[1];
|
|
48
|
+
|
|
49
|
+
// Must use state for the flyout ref in order for the useEffect to be correctly called after render
|
|
50
|
+
var _useState3 = (0, _react.useState)(null),
|
|
51
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
52
|
+
flyoutRef = _useState4[0],
|
|
53
|
+
setFlyoutRef = _useState4[1];
|
|
54
|
+
var setRefs = (0, _services.useCombinedRefs)([setFlyoutRef, ref]);
|
|
55
|
+
(0, _react.useEffect)(function () {
|
|
56
|
+
setFlyoutWidth(flyoutRef ? getFlyoutMinMaxWidth(flyoutRef.offsetWidth) : 0);
|
|
57
|
+
}, [flyoutRef, getFlyoutMinMaxWidth, size]);
|
|
58
|
+
|
|
59
|
+
// Initial numbers to calculate from, on resize drag start
|
|
60
|
+
var initialWidth = (0, _react.useRef)(0);
|
|
61
|
+
var initialMouseX = (0, _react.useRef)(0);
|
|
62
|
+
|
|
63
|
+
// Account for flyout side and logical property direction
|
|
64
|
+
var direction = (0, _react.useMemo)(function () {
|
|
65
|
+
var modifier = side === 'right' ? -1 : 1;
|
|
66
|
+
if (flyoutRef) {
|
|
67
|
+
var languageDirection = window.getComputedStyle(flyoutRef).direction;
|
|
68
|
+
if (languageDirection === 'rtl') modifier *= -1;
|
|
69
|
+
}
|
|
70
|
+
return modifier;
|
|
71
|
+
}, [side, flyoutRef]);
|
|
72
|
+
var onMouseMove = (0, _react.useCallback)(function (e) {
|
|
73
|
+
var mouseOffset = getMouseOrTouchX(e) - initialMouseX.current;
|
|
74
|
+
var changedFlyoutWidth = initialWidth.current + mouseOffset * direction;
|
|
75
|
+
setFlyoutWidth(getFlyoutMinMaxWidth(changedFlyoutWidth));
|
|
76
|
+
}, [getFlyoutMinMaxWidth, direction]);
|
|
77
|
+
var onMouseUp = (0, _react.useCallback)(function () {
|
|
78
|
+
initialMouseX.current = 0;
|
|
79
|
+
window.removeEventListener('mousemove', onMouseMove);
|
|
80
|
+
window.removeEventListener('mouseup', onMouseUp);
|
|
81
|
+
window.removeEventListener('touchmove', onMouseMove);
|
|
82
|
+
window.removeEventListener('touchend', onMouseUp);
|
|
83
|
+
}, [onMouseMove]);
|
|
84
|
+
var onMouseDown = (0, _react.useCallback)(function (e) {
|
|
85
|
+
var _flyoutRef$offsetWidt;
|
|
86
|
+
initialMouseX.current = getMouseOrTouchX(e);
|
|
87
|
+
initialWidth.current = (_flyoutRef$offsetWidt = flyoutRef === null || flyoutRef === void 0 ? void 0 : flyoutRef.offsetWidth) !== null && _flyoutRef$offsetWidt !== void 0 ? _flyoutRef$offsetWidt : 0;
|
|
88
|
+
|
|
89
|
+
// Window event listeners instead of React events are used
|
|
90
|
+
// in case the user's mouse leaves the component
|
|
91
|
+
window.addEventListener('mousemove', onMouseMove);
|
|
92
|
+
window.addEventListener('mouseup', onMouseUp);
|
|
93
|
+
window.addEventListener('touchmove', onMouseMove);
|
|
94
|
+
window.addEventListener('touchend', onMouseUp);
|
|
95
|
+
}, [flyoutRef, onMouseMove, onMouseUp]);
|
|
96
|
+
var onKeyDown = (0, _react.useCallback)(function (e) {
|
|
97
|
+
var KEYBOARD_OFFSET = 10;
|
|
98
|
+
switch (e.key) {
|
|
99
|
+
case _services.keys.ARROW_RIGHT:
|
|
100
|
+
e.preventDefault(); // Safari+VO will screen reader navigate off the button otherwise
|
|
101
|
+
setFlyoutWidth(function (flyoutWidth) {
|
|
102
|
+
return getFlyoutMinMaxWidth(flyoutWidth + KEYBOARD_OFFSET * direction);
|
|
103
|
+
});
|
|
104
|
+
break;
|
|
105
|
+
case _services.keys.ARROW_LEFT:
|
|
106
|
+
e.preventDefault(); // Safari+VO will screen reader navigate off the button otherwise
|
|
107
|
+
setFlyoutWidth(function (flyoutWidth) {
|
|
108
|
+
return getFlyoutMinMaxWidth(flyoutWidth - KEYBOARD_OFFSET * direction);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}, [getFlyoutMinMaxWidth, direction]);
|
|
112
|
+
return (0, _react2.jsx)(_flyout.EuiFlyout, (0, _extends2.default)({}, rest, {
|
|
113
|
+
size: flyoutWidth || size,
|
|
114
|
+
maxWidth: maxWidth,
|
|
115
|
+
side: side,
|
|
116
|
+
ref: setRefs
|
|
117
|
+
}), (0, _react2.jsx)(_resizable_container.EuiResizableButton, {
|
|
118
|
+
isHorizontal: true,
|
|
119
|
+
css: cssStyles,
|
|
120
|
+
onMouseDown: onMouseDown,
|
|
121
|
+
onTouchStart: onMouseDown,
|
|
122
|
+
onKeyDown: onKeyDown
|
|
123
|
+
}), children);
|
|
124
|
+
});
|
|
125
|
+
exports.EuiFlyoutResizable = EuiFlyoutResizable;
|
|
126
|
+
EuiFlyoutResizable.displayName = 'EuiFlyoutResizable';
|
|
127
|
+
var getMouseOrTouchX = function getMouseOrTouchX(e) {
|
|
128
|
+
// Some Typescript fooling is needed here
|
|
129
|
+
var x = e.targetTouches ? e.targetTouches[0].pageX : e.pageX;
|
|
130
|
+
return x;
|
|
131
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.euiFlyoutResizableButtonStyles = void 0;
|
|
7
|
+
var _react = require("@emotion/react");
|
|
8
|
+
var _global_styling = require("../../global_styling");
|
|
9
|
+
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)."; } /*
|
|
10
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
11
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
12
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
13
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
14
|
+
* Side Public License, v 1.
|
|
15
|
+
*/
|
|
16
|
+
var _ref = process.env.NODE_ENV === "production" ? {
|
|
17
|
+
name: "6syi0e-euiFlyoutResizableButton",
|
|
18
|
+
styles: "position:absolute;&::before,&::after{background-color:transparent;};label:euiFlyoutResizableButton;"
|
|
19
|
+
} : {
|
|
20
|
+
name: "6syi0e-euiFlyoutResizableButton",
|
|
21
|
+
styles: "position:absolute;&::before,&::after{background-color:transparent;};label:euiFlyoutResizableButton;",
|
|
22
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
23
|
+
};
|
|
24
|
+
var euiFlyoutResizableButtonStyles = function euiFlyoutResizableButtonStyles(_ref2) {
|
|
25
|
+
var euiTheme = _ref2.euiTheme;
|
|
26
|
+
return {
|
|
27
|
+
euiFlyoutResizableButton: _ref,
|
|
28
|
+
left: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('right', "-".concat(euiTheme.border.width.thin)), ";;label:left;"),
|
|
29
|
+
right: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('left', "-".concat(euiTheme.border.width.thin)), ";;label:right;")
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
exports.euiFlyoutResizableButtonStyles = euiFlyoutResizableButtonStyles;
|
|
@@ -27,6 +27,12 @@ Object.defineProperty(exports, "EuiFlyoutHeader", {
|
|
|
27
27
|
return _flyout_header.EuiFlyoutHeader;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
+
Object.defineProperty(exports, "EuiFlyoutResizable", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function get() {
|
|
33
|
+
return _flyout_resizable.EuiFlyoutResizable;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
30
36
|
Object.defineProperty(exports, "euiFlyoutSlideInLeft", {
|
|
31
37
|
enumerable: true,
|
|
32
38
|
get: function get() {
|
|
@@ -43,4 +49,5 @@ var _flyout = require("./flyout");
|
|
|
43
49
|
var _flyout_body = require("./flyout_body");
|
|
44
50
|
var _flyout_footer = require("./flyout_footer");
|
|
45
51
|
var _flyout_header = require("./flyout_header");
|
|
46
|
-
var _flyout2 = require("./flyout.styles");
|
|
52
|
+
var _flyout2 = require("./flyout.styles");
|
|
53
|
+
var _flyout_resizable = require("./flyout_resizable");
|
|
@@ -62,38 +62,10 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
62
62
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
63
63
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
|
|
64
64
|
id: _this.props.id || (0, _services.htmlIdGenerator)()(),
|
|
65
|
-
rangeSliderRefAvailable: false,
|
|
66
65
|
isPopoverOpen: false,
|
|
67
|
-
rangeWidth: 0
|
|
68
|
-
isVisible: true // used to trigger a rerender if initial element width is 0
|
|
66
|
+
rangeWidth: 0
|
|
69
67
|
});
|
|
70
68
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "preventPopoverClose", false);
|
|
71
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "rangeSliderRef", null);
|
|
72
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleRangeSliderRefUpdate", function (ref) {
|
|
73
|
-
_this.rangeSliderRef = ref;
|
|
74
|
-
if (ref) {
|
|
75
|
-
if (_this.isInPopover) {
|
|
76
|
-
// Wait a tick for popover rendering to settle
|
|
77
|
-
requestAnimationFrame(function () {
|
|
78
|
-
_this.setState({
|
|
79
|
-
rangeSliderRefAvailable: true,
|
|
80
|
-
rangeWidth: ref.clientWidth
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
} else {
|
|
84
|
-
// If not in a popover, no need to wait
|
|
85
|
-
_this.setState({
|
|
86
|
-
rangeSliderRefAvailable: true,
|
|
87
|
-
rangeWidth: ref.clientWidth
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
} else {
|
|
91
|
-
_this.setState({
|
|
92
|
-
rangeSliderRefAvailable: false,
|
|
93
|
-
rangeWidth: 0
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
69
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "leftPosition", 0);
|
|
98
70
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "dragAcc", 0);
|
|
99
71
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "_determineInvalidThumbMovement", function (newVal, lower, upper, e) {
|
|
@@ -284,14 +256,11 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
284
256
|
isPopoverOpen: false
|
|
285
257
|
});
|
|
286
258
|
});
|
|
287
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "
|
|
288
|
-
var
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
(_this$props$inputPopo = _this.props.inputPopoverProps) === null || _this$props$inputPopo === void 0 ? void 0 : (_this$props$inputPopo2 = _this$props$inputPopo.onPanelResize) === null || _this$props$inputPopo2 === void 0 ? void 0 : _this$props$inputPopo2.call(_this$props$inputPopo, width);
|
|
259
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setRangeWidth", function (_ref) {
|
|
260
|
+
var width = _ref.width;
|
|
261
|
+
_this.setState({
|
|
262
|
+
rangeWidth: width
|
|
263
|
+
});
|
|
295
264
|
});
|
|
296
265
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getNearestStep", function (value) {
|
|
297
266
|
var min = _this.props.min;
|
|
@@ -314,7 +283,7 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
314
283
|
var delta = _this.leftPosition - x;
|
|
315
284
|
_this.leftPosition = x;
|
|
316
285
|
_this.dragAcc = _this.dragAcc + delta;
|
|
317
|
-
var percentageOfArea = _this.dragAcc / _this.
|
|
286
|
+
var percentageOfArea = _this.dragAcc / _this.state.rangeWidth;
|
|
318
287
|
var percentageOfRange = percentageOfArea * (max - min);
|
|
319
288
|
var newLower = _this.getNearestStep(lowerValue - percentageOfRange);
|
|
320
289
|
var newUpper = _this.getNearestStep(upperValue - percentageOfRange);
|
|
@@ -358,32 +327,12 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
358
327
|
get: function get() {
|
|
359
328
|
return this.lowerValueIsValid && this.upperValueIsValid;
|
|
360
329
|
}
|
|
361
|
-
}, {
|
|
362
|
-
key: "componentDidMount",
|
|
363
|
-
value: function componentDidMount() {
|
|
364
|
-
var _this$rangeSliderRef;
|
|
365
|
-
if (((_this$rangeSliderRef = this.rangeSliderRef) === null || _this$rangeSliderRef === void 0 ? void 0 : _this$rangeSliderRef.clientWidth) === 0) {
|
|
366
|
-
this.setState({
|
|
367
|
-
isVisible: false
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
}, {
|
|
372
|
-
key: "componentDidUpdate",
|
|
373
|
-
value: function componentDidUpdate() {
|
|
374
|
-
var _this$rangeSliderRef2;
|
|
375
|
-
if ((_this$rangeSliderRef2 = this.rangeSliderRef) !== null && _this$rangeSliderRef2 !== void 0 && _this$rangeSliderRef2.clientWidth && !this.state.isVisible) {
|
|
376
|
-
this.setState({
|
|
377
|
-
isVisible: true
|
|
378
|
-
});
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
330
|
}, {
|
|
382
331
|
key: "render",
|
|
383
332
|
value: function render() {
|
|
384
333
|
var _this2 = this;
|
|
385
|
-
var
|
|
386
|
-
defaultFullWidth =
|
|
334
|
+
var _ref2 = this.context,
|
|
335
|
+
defaultFullWidth = _ref2.defaultFullWidth;
|
|
387
336
|
var _this$props = this.props,
|
|
388
337
|
className = _this$props.className,
|
|
389
338
|
customCss = _this$props.css,
|
|
@@ -539,10 +488,10 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
539
488
|
var classes = (0, _classnames.default)('euiDualRange', className);
|
|
540
489
|
var dualRangeStyles = (0, _dual_range.euiDualRangeStyles)();
|
|
541
490
|
var cssStyles = [dualRangeStyles.euiDualRange, customCss];
|
|
542
|
-
var leftThumbPosition = this.state.
|
|
491
|
+
var leftThumbPosition = this.state.rangeWidth ? this.calculateThumbPositionStyle(Number(this.lowerValue) || min, this.state.rangeWidth) : {
|
|
543
492
|
left: '0'
|
|
544
493
|
};
|
|
545
|
-
var rightThumbPosition = this.state.
|
|
494
|
+
var rightThumbPosition = this.state.rangeWidth ? this.calculateThumbPositionStyle(Number(this.upperValue) || max, this.state.rangeWidth) : {
|
|
546
495
|
left: '0'
|
|
547
496
|
};
|
|
548
497
|
var leftThumbColor = levels && (0, _range_levels_colors.getLevelColor)(levels, Number(this.lowerValue));
|
|
@@ -586,7 +535,6 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
586
535
|
}, (0, _react2.jsx)(_range_slider.EuiRangeSlider, (0, _extends2.default)({
|
|
587
536
|
className: "euiDualRange__slider",
|
|
588
537
|
css: dualRangeStyles.euiDualRange__slider,
|
|
589
|
-
ref: this.handleRangeSliderRefUpdate,
|
|
590
538
|
id: id,
|
|
591
539
|
name: name,
|
|
592
540
|
min: min,
|
|
@@ -600,7 +548,9 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
600
548
|
showRange: showRange,
|
|
601
549
|
onFocus: _onFocus,
|
|
602
550
|
onBlur: _onBlur
|
|
603
|
-
}, rest
|
|
551
|
+
}, rest, {
|
|
552
|
+
onResize: this.setRangeWidth
|
|
553
|
+
})), isDraggable && this.isValid && (0, _react2.jsx)(_range_draggable.EuiRangeDraggable, {
|
|
604
554
|
min: min,
|
|
605
555
|
max: max,
|
|
606
556
|
value: [this.lowerValue, this.upperValue],
|
|
@@ -640,7 +590,7 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
640
590
|
style: (0, _global_styling.logicalStyles)(rightThumbStyles),
|
|
641
591
|
"aria-describedby": showInputOnly ? undefined : this.props['aria-describedby'],
|
|
642
592
|
"aria-label": showInputOnly ? undefined : this.props['aria-label']
|
|
643
|
-
})
|
|
593
|
+
}), showRange && this.isValid && (0, _react2.jsx)(_range_highlight.EuiRangeHighlight, {
|
|
644
594
|
showTicks: showTicks,
|
|
645
595
|
min: Number(min),
|
|
646
596
|
max: Number(max),
|
|
@@ -672,7 +622,6 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
672
622
|
isOpen: this.state.isPopoverOpen,
|
|
673
623
|
closePopover: this.closePopover,
|
|
674
624
|
disableFocusTrap: true,
|
|
675
|
-
onPanelResize: this.onResize,
|
|
676
625
|
popoverScreenReaderText: dualSliderScreenReaderInstructions
|
|
677
626
|
}), theRange) : undefined;
|
|
678
627
|
return thePopover || theRange;
|