@elastic/eui 91.3.1 → 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 +5 -5
- 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 +825 -1141
- package/i18ntokens.json +68 -338
- package/lib/components/basic_table/basic_table.js +5 -5
- 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 +5 -5
- 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 +5 -5
- 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 +2 -2
- package/src/components/index.scss +0 -2
- package/test-env/components/basic_table/basic_table.js +5 -5
- 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
|
@@ -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");
|
|
@@ -63,38 +63,10 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
63
63
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
64
64
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
|
|
65
65
|
id: _this.props.id || (0, _services.htmlIdGenerator)()(),
|
|
66
|
-
rangeSliderRefAvailable: false,
|
|
67
66
|
isPopoverOpen: false,
|
|
68
|
-
rangeWidth: 0
|
|
69
|
-
isVisible: true // used to trigger a rerender if initial element width is 0
|
|
67
|
+
rangeWidth: 0
|
|
70
68
|
});
|
|
71
69
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "preventPopoverClose", false);
|
|
72
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "rangeSliderRef", null);
|
|
73
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleRangeSliderRefUpdate", function (ref) {
|
|
74
|
-
_this.rangeSliderRef = ref;
|
|
75
|
-
if (ref) {
|
|
76
|
-
if (_this.isInPopover) {
|
|
77
|
-
// Wait a tick for popover rendering to settle
|
|
78
|
-
requestAnimationFrame(function () {
|
|
79
|
-
_this.setState({
|
|
80
|
-
rangeSliderRefAvailable: true,
|
|
81
|
-
rangeWidth: ref.clientWidth
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
} else {
|
|
85
|
-
// If not in a popover, no need to wait
|
|
86
|
-
_this.setState({
|
|
87
|
-
rangeSliderRefAvailable: true,
|
|
88
|
-
rangeWidth: ref.clientWidth
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
} else {
|
|
92
|
-
_this.setState({
|
|
93
|
-
rangeSliderRefAvailable: false,
|
|
94
|
-
rangeWidth: 0
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
70
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "leftPosition", 0);
|
|
99
71
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "dragAcc", 0);
|
|
100
72
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "_determineInvalidThumbMovement", function (newVal, lower, upper, e) {
|
|
@@ -285,14 +257,11 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
285
257
|
isPopoverOpen: false
|
|
286
258
|
});
|
|
287
259
|
});
|
|
288
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "
|
|
289
|
-
var
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
(_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);
|
|
260
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setRangeWidth", function (_ref) {
|
|
261
|
+
var width = _ref.width;
|
|
262
|
+
_this.setState({
|
|
263
|
+
rangeWidth: width
|
|
264
|
+
});
|
|
296
265
|
});
|
|
297
266
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getNearestStep", function (value) {
|
|
298
267
|
var min = _this.props.min;
|
|
@@ -315,7 +284,7 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
315
284
|
var delta = _this.leftPosition - x;
|
|
316
285
|
_this.leftPosition = x;
|
|
317
286
|
_this.dragAcc = _this.dragAcc + delta;
|
|
318
|
-
var percentageOfArea = _this.dragAcc / _this.
|
|
287
|
+
var percentageOfArea = _this.dragAcc / _this.state.rangeWidth;
|
|
319
288
|
var percentageOfRange = percentageOfArea * (max - min);
|
|
320
289
|
var newLower = _this.getNearestStep(lowerValue - percentageOfRange);
|
|
321
290
|
var newUpper = _this.getNearestStep(upperValue - percentageOfRange);
|
|
@@ -359,32 +328,12 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
359
328
|
get: function get() {
|
|
360
329
|
return this.lowerValueIsValid && this.upperValueIsValid;
|
|
361
330
|
}
|
|
362
|
-
}, {
|
|
363
|
-
key: "componentDidMount",
|
|
364
|
-
value: function componentDidMount() {
|
|
365
|
-
var _this$rangeSliderRef;
|
|
366
|
-
if (((_this$rangeSliderRef = this.rangeSliderRef) === null || _this$rangeSliderRef === void 0 ? void 0 : _this$rangeSliderRef.clientWidth) === 0) {
|
|
367
|
-
this.setState({
|
|
368
|
-
isVisible: false
|
|
369
|
-
});
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
}, {
|
|
373
|
-
key: "componentDidUpdate",
|
|
374
|
-
value: function componentDidUpdate() {
|
|
375
|
-
var _this$rangeSliderRef2;
|
|
376
|
-
if ((_this$rangeSliderRef2 = this.rangeSliderRef) !== null && _this$rangeSliderRef2 !== void 0 && _this$rangeSliderRef2.clientWidth && !this.state.isVisible) {
|
|
377
|
-
this.setState({
|
|
378
|
-
isVisible: true
|
|
379
|
-
});
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
331
|
}, {
|
|
383
332
|
key: "render",
|
|
384
333
|
value: function render() {
|
|
385
334
|
var _this2 = this;
|
|
386
|
-
var
|
|
387
|
-
defaultFullWidth =
|
|
335
|
+
var _ref2 = this.context,
|
|
336
|
+
defaultFullWidth = _ref2.defaultFullWidth;
|
|
388
337
|
var _this$props = this.props,
|
|
389
338
|
className = _this$props.className,
|
|
390
339
|
customCss = _this$props.css,
|
|
@@ -540,10 +489,10 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
540
489
|
var classes = (0, _classnames.default)('euiDualRange', className);
|
|
541
490
|
var dualRangeStyles = (0, _dual_range.euiDualRangeStyles)();
|
|
542
491
|
var cssStyles = [dualRangeStyles.euiDualRange, customCss];
|
|
543
|
-
var leftThumbPosition = this.state.
|
|
492
|
+
var leftThumbPosition = this.state.rangeWidth ? this.calculateThumbPositionStyle(Number(this.lowerValue) || min, this.state.rangeWidth) : {
|
|
544
493
|
left: '0'
|
|
545
494
|
};
|
|
546
|
-
var rightThumbPosition = this.state.
|
|
495
|
+
var rightThumbPosition = this.state.rangeWidth ? this.calculateThumbPositionStyle(Number(this.upperValue) || max, this.state.rangeWidth) : {
|
|
547
496
|
left: '0'
|
|
548
497
|
};
|
|
549
498
|
var leftThumbColor = levels && (0, _range_levels_colors.getLevelColor)(levels, Number(this.lowerValue));
|
|
@@ -587,7 +536,6 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
587
536
|
}, (0, _react2.jsx)(_range_slider.EuiRangeSlider, (0, _extends2.default)({
|
|
588
537
|
className: "euiDualRange__slider",
|
|
589
538
|
css: dualRangeStyles.euiDualRange__slider,
|
|
590
|
-
ref: this.handleRangeSliderRefUpdate,
|
|
591
539
|
id: id,
|
|
592
540
|
name: name,
|
|
593
541
|
min: min,
|
|
@@ -601,7 +549,9 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
601
549
|
showRange: showRange,
|
|
602
550
|
onFocus: _onFocus,
|
|
603
551
|
onBlur: _onBlur
|
|
604
|
-
}, rest
|
|
552
|
+
}, rest, {
|
|
553
|
+
onResize: this.setRangeWidth
|
|
554
|
+
})), isDraggable && this.isValid && (0, _react2.jsx)(_range_draggable.EuiRangeDraggable, {
|
|
605
555
|
min: min,
|
|
606
556
|
max: max,
|
|
607
557
|
value: [this.lowerValue, this.upperValue],
|
|
@@ -641,7 +591,7 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
641
591
|
style: (0, _global_styling.logicalStyles)(rightThumbStyles),
|
|
642
592
|
"aria-describedby": showInputOnly ? undefined : this.props['aria-describedby'],
|
|
643
593
|
"aria-label": showInputOnly ? undefined : this.props['aria-label']
|
|
644
|
-
})
|
|
594
|
+
}), showRange && this.isValid && (0, _react2.jsx)(_range_highlight.EuiRangeHighlight, {
|
|
645
595
|
showTicks: showTicks,
|
|
646
596
|
min: Number(min),
|
|
647
597
|
max: Number(max),
|
|
@@ -673,7 +623,6 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
673
623
|
isOpen: this.state.isPopoverOpen,
|
|
674
624
|
closePopover: this.closePopover,
|
|
675
625
|
disableFocusTrap: true,
|
|
676
|
-
onPanelResize: this.onResize,
|
|
677
626
|
popoverScreenReaderText: dualSliderScreenReaderInstructions
|
|
678
627
|
}), theRange) : undefined;
|
|
679
628
|
return thePopover || theRange;
|
|
@@ -66,9 +66,10 @@ var EuiRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
66
66
|
_this.props.onChange(e, isValid);
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "
|
|
69
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setTrackWidth", function (_ref) {
|
|
70
|
+
var width = _ref.width;
|
|
70
71
|
_this.setState({
|
|
71
|
-
trackWidth:
|
|
72
|
+
trackWidth: width
|
|
72
73
|
});
|
|
73
74
|
});
|
|
74
75
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onInputFocus", function (e) {
|
|
@@ -112,8 +113,8 @@ var EuiRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
112
113
|
key: "render",
|
|
113
114
|
value: function render() {
|
|
114
115
|
var _this2 = this;
|
|
115
|
-
var
|
|
116
|
-
defaultFullWidth =
|
|
116
|
+
var _ref2 = this.context,
|
|
117
|
+
defaultFullWidth = _ref2.defaultFullWidth;
|
|
117
118
|
var _this$props = this.props,
|
|
118
119
|
className = _this$props.className,
|
|
119
120
|
compressed = _this$props.compressed,
|
|
@@ -219,7 +220,7 @@ var EuiRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
219
220
|
"aria-hidden": !!showInput,
|
|
220
221
|
thumbColor: thumbColor
|
|
221
222
|
}, rest, {
|
|
222
|
-
|
|
223
|
+
onResize: this.setTrackWidth
|
|
223
224
|
})), showRange && this.isValid && (0, _react2.jsx)(_range_highlight.EuiRangeHighlight, {
|
|
224
225
|
showTicks: showTicks,
|
|
225
226
|
min: Number(min),
|
|
@@ -14,10 +14,11 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
14
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
15
|
var _services = require("../../../services");
|
|
16
16
|
var _global_styling = require("../../../global_styling");
|
|
17
|
+
var _resize_observer = require("../../observer/resize_observer");
|
|
17
18
|
var _range_levels_colors = require("./range_levels_colors");
|
|
18
19
|
var _range_slider = require("./range_slider.styles");
|
|
19
20
|
var _react2 = require("@emotion/react");
|
|
20
|
-
var _excluded = ["className", "disabled", "id", "max", "min", "name", "step", "onChange", "tabIndex", "value", "style", "showTicks", "showRange", "thumbColor"];
|
|
21
|
+
var _excluded = ["className", "disabled", "id", "max", "min", "name", "step", "onChange", "tabIndex", "value", "style", "showTicks", "showRange", "thumbColor", "onResize"];
|
|
21
22
|
/*
|
|
22
23
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
23
24
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -29,7 +30,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
29
30
|
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; }
|
|
30
31
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
31
32
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
32
|
-
var EuiRangeSlider =
|
|
33
|
+
var EuiRangeSlider = function EuiRangeSlider(_ref) {
|
|
33
34
|
var className = _ref.className,
|
|
34
35
|
disabled = _ref.disabled,
|
|
35
36
|
id = _ref.id,
|
|
@@ -44,6 +45,7 @@ var EuiRangeSlider = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
44
45
|
showTicks = _ref.showTicks,
|
|
45
46
|
showRange = _ref.showRange,
|
|
46
47
|
thumbColor = _ref.thumbColor,
|
|
48
|
+
onResize = _ref.onResize,
|
|
47
49
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
48
50
|
var classes = (0, _classnames.default)('euiRangeSlider', className);
|
|
49
51
|
var euiTheme = (0, _services.useEuiTheme)();
|
|
@@ -55,30 +57,34 @@ var EuiRangeSlider = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
55
57
|
color: thumbColor && (0, _range_levels_colors.euiRangeLevelColor)(thumbColor, euiTheme.euiTheme)
|
|
56
58
|
}, style));
|
|
57
59
|
}, [thumbColor, euiTheme, style]);
|
|
58
|
-
return (0, _react2.jsx)(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
60
|
+
return (0, _react2.jsx)(_resize_observer.EuiResizeObserver, {
|
|
61
|
+
onResize: onResize
|
|
62
|
+
}, function (resizeRef) {
|
|
63
|
+
return (0, _react2.jsx)("input", (0, _extends2.default)({
|
|
64
|
+
ref: resizeRef,
|
|
65
|
+
type: "range",
|
|
66
|
+
id: id,
|
|
67
|
+
name: name,
|
|
68
|
+
className: classes,
|
|
69
|
+
css: cssStyles,
|
|
70
|
+
min: min,
|
|
71
|
+
max: max,
|
|
72
|
+
step: step,
|
|
73
|
+
value: value,
|
|
74
|
+
disabled: disabled,
|
|
75
|
+
onChange: onChange,
|
|
76
|
+
style: sliderStyle,
|
|
77
|
+
tabIndex: tabIndex
|
|
78
|
+
}, rest));
|
|
79
|
+
});
|
|
80
|
+
};
|
|
75
81
|
exports.EuiRangeSlider = EuiRangeSlider;
|
|
76
82
|
EuiRangeSlider.propTypes = {
|
|
77
83
|
onChange: _propTypes.default.any,
|
|
78
84
|
thumbColor: _propTypes.default.oneOfType([_propTypes.default.any.isRequired, _propTypes.default.any.isRequired]),
|
|
85
|
+
onResize: _propTypes.default.func.isRequired,
|
|
79
86
|
className: _propTypes.default.string,
|
|
80
87
|
"aria-label": _propTypes.default.string,
|
|
81
88
|
"data-test-subj": _propTypes.default.string,
|
|
82
89
|
css: _propTypes.default.any
|
|
83
|
-
};
|
|
84
|
-
EuiRangeSlider.displayName = 'EuiRangeSlider';
|
|
90
|
+
};
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.RESIZE = exports.EuiTextArea = void 0;
|
|
8
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
-
var _react =
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
13
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
14
|
+
var _services = require("../../../services");
|
|
13
15
|
var _form_control_layout = require("../form_control_layout");
|
|
14
16
|
var _validatable_control = require("../validatable_control");
|
|
15
17
|
var _eui_form_context = require("../eui_form_context");
|
|
16
18
|
var _react2 = require("@emotion/react");
|
|
17
|
-
var _excluded = ["children", "className", "compressed", "fullWidth", "id", "inputRef", "isLoading", "isInvalid", "name", "placeholder", "resize", "rows"];
|
|
19
|
+
var _excluded = ["children", "className", "compressed", "fullWidth", "id", "icon", "inputRef", "isLoading", "isInvalid", "isClearable", "name", "placeholder", "resize", "rows"];
|
|
18
20
|
/*
|
|
19
21
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
20
22
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -22,6 +24,8 @@ var _excluded = ["children", "className", "compressed", "fullWidth", "id", "inpu
|
|
|
22
24
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
23
25
|
* Side Public License, v 1.
|
|
24
26
|
*/
|
|
27
|
+
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); }
|
|
28
|
+
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; }
|
|
25
29
|
var resizeToClassNameMap = {
|
|
26
30
|
vertical: 'euiTextArea--resizeVertical',
|
|
27
31
|
horizontal: 'euiTextArea--resizeHorizontal',
|
|
@@ -39,9 +43,11 @@ var EuiTextArea = function EuiTextArea(props) {
|
|
|
39
43
|
_props$fullWidth = props.fullWidth,
|
|
40
44
|
fullWidth = _props$fullWidth === void 0 ? defaultFullWidth : _props$fullWidth,
|
|
41
45
|
id = props.id,
|
|
46
|
+
icon = props.icon,
|
|
42
47
|
inputRef = props.inputRef,
|
|
43
48
|
isLoading = props.isLoading,
|
|
44
49
|
isInvalid = props.isInvalid,
|
|
50
|
+
isClearable = props.isClearable,
|
|
45
51
|
name = props.name,
|
|
46
52
|
placeholder = props.placeholder,
|
|
47
53
|
_props$resize = props.resize,
|
|
@@ -60,10 +66,33 @@ var EuiTextArea = function EuiTextArea(props) {
|
|
|
60
66
|
} else {
|
|
61
67
|
definedRows = 6;
|
|
62
68
|
}
|
|
69
|
+
var ref = (0, _react.useRef)(null);
|
|
70
|
+
var refs = (0, _services.useCombinedRefs)([ref, inputRef]);
|
|
71
|
+
var clear = (0, _react.useMemo)(function () {
|
|
72
|
+
if (isClearable) {
|
|
73
|
+
return {
|
|
74
|
+
onClick: function onClick() {
|
|
75
|
+
if (ref.current) {
|
|
76
|
+
ref.current.value = '';
|
|
77
|
+
var event = new Event('input', {
|
|
78
|
+
bubbles: true,
|
|
79
|
+
cancelable: false
|
|
80
|
+
});
|
|
81
|
+
ref.current.dispatchEvent(event);
|
|
82
|
+
ref.current.focus(); // set focus back to the textarea
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
'data-test-subj': 'clearTextAreaButton'
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}, [isClearable]);
|
|
63
90
|
return (0, _react2.jsx)(_form_control_layout.EuiFormControlLayout, {
|
|
64
91
|
fullWidth: fullWidth,
|
|
65
92
|
isLoading: isLoading,
|
|
66
93
|
isInvalid: isInvalid,
|
|
94
|
+
clear: clear,
|
|
95
|
+
icon: icon,
|
|
67
96
|
className: "euiFormControlLayout--euiTextArea"
|
|
68
97
|
}, (0, _react2.jsx)(_validatable_control.EuiValidatableControl, {
|
|
69
98
|
isInvalid: isInvalid
|
|
@@ -73,7 +102,7 @@ var EuiTextArea = function EuiTextArea(props) {
|
|
|
73
102
|
rows: definedRows,
|
|
74
103
|
name: name,
|
|
75
104
|
id: id,
|
|
76
|
-
ref:
|
|
105
|
+
ref: refs,
|
|
77
106
|
placeholder: placeholder
|
|
78
107
|
}), children)));
|
|
79
108
|
};
|
|
@@ -83,8 +112,18 @@ EuiTextArea.propTypes = {
|
|
|
83
112
|
"aria-label": _propTypes.default.string,
|
|
84
113
|
"data-test-subj": _propTypes.default.string,
|
|
85
114
|
css: _propTypes.default.any,
|
|
115
|
+
icon: _propTypes.default.oneOfType([_propTypes.default.oneOfType([_propTypes.default.oneOf(["accessibility", "addDataApp", "advancedSettingsApp", "agentApp", "aggregate", "analyzeEvent", "annotation", "apmApp", "apmTrace", "appSearchApp", "apps", "arrowDown", "arrowLeft", "arrowRight", "arrowUp", "arrowStart", "arrowEnd", "article", "asterisk", "at", "auditbeatApp", "beaker", "bell", "bellSlash", "beta", "bolt", "boxesHorizontal", "boxesVertical", "branch", "branchUser", "broom", "brush", "bug", "bullseye", "calendar", "canvasApp", "casesApp", "check", "checkInCircleFilled", "cheer", "classificationJob", "clock", "cloudDrizzle", "cloudStormy", "cloudSunny", "cluster", "codeApp", "color", "compute", "console", "consoleApp", "container", "continuityAbove", "continuityAboveBelow", "continuityBelow", "continuityWithin", "controlsHorizontal", "controlsVertical", "copy", "copyClipboard", "createAdvancedJob", "createMultiMetricJob", "createPopulationJob", "createSingleMetricJob", "cross", "crossClusterReplicationApp", "crosshairs", "currency", "cut", "dashboardApp", "dataVisualizer", "database", "desktop", "devToolsApp", "discoverApp", "discuss", "document", "documentEdit", "documentation", "documents", "dot", "dotInCircle", "doubleArrowLeft", "doubleArrowRight", "download", "editorAlignCenter", "editorAlignLeft", "editorAlignRight", "editorBold", "editorChecklist", "editorCodeBlock", "editorComment", "editorDistributeHorizontal", "editorDistributeVertical", "editorHeading", "editorItalic", "editorItemAlignBottom", "editorItemAlignCenter", "editorItemAlignLeft", "editorItemAlignMiddle", "editorItemAlignRight", "editorItemAlignTop", "editorLink", "editorOrderedList", "editorPositionBottomLeft", "editorPositionBottomRight", "editorPositionTopLeft", "editorPositionTopRight", "editorRedo", "editorStrike", "editorTable", "editorUnderline", "editorUndo", "editorUnorderedList", "email", "empty", "emsApp", "endpoint", "eql", "eraser", "error", "esqlVis", "exit", "expand", "expandMini", "exportAction", "eye", "eyeClosed", "faceHappy", "faceNeutral", "faceSad", "filebeatApp", "filter", "filterExclude", "filterIgnore", "filterInclude", "filterInCircle", "flag", "fleetApp", "fold", "folderCheck", "folderClosed", "folderExclamation", "folderOpen", "frameNext", "framePrevious", "fullScreen", "fullScreenExit", "function", "gear", "gisApp", "glasses", "globe", "grab", "grabHorizontal", "grabOmnidirectional", "gradient", "graphApp", "grid", "grokApp", "heart", "heartbeatApp", "heatmap", "help", "home", "iInCircle", "image", "importAction", "indexClose", "indexEdit", "indexFlush", "indexManagementApp", "indexMapping", "indexOpen", "indexPatternApp", "indexRollupApp", "indexRuntime", "indexSettings", "indexTemporary", "infinity", "inputOutput", "inspect", "invert", "ip", "key", "keyboard", "kqlField", "kqlFunction", "kqlOperand", "kqlSelector", "kqlValue", "kubernetesNode", "kubernetesPod", "launch", "layers", "lensApp", "lettering", "lineDashed", "lineDotted", "lineSolid", "link", "list", "listAdd", "lock", "lockOpen", "logoAWS", "logoAWSMono", "logoAerospike", "logoApache", "logoAppSearch", "logoAzure", "logoAzureMono", "logoBeats", "logoBusinessAnalytics", "logoCeph", "logoCloud", "logoCloudEnterprise", "logoCode", "logoCodesandbox", "logoCouchbase", "logoDocker", "logoDropwizard", "logoElastic", "logoElasticStack", "logoElasticsearch", "logoEnterpriseSearch", "logoEtcd", "logoGCP", "logoGCPMono", "logoGithub", "logoGmail", "logoGolang", "logoGoogleG", "logoHAproxy", "logoIBM", "logoIBMMono", "logoKafka", "logoKibana", "logoKubernetes", "logoLogging", "logoLogstash", "logoMaps", "logoMemcached", "logoMetrics", "logoMongodb", "logoMySQL", "logoNginx", "logoObservability", "logoOsquery", "logoPhp", "logoPostgres", "logoPrometheus", "logoRabbitmq", "logoRedis", "logoSecurity", "logoSiteSearch", "logoSketch", "logoSlack", "logoUptime", "logoVulnerabilityManagement", "logoWebhook", "logoWindows", "logoWorkplaceSearch", "logsApp", "logstashFilter", "logstashIf", "logstashInput", "logstashOutput", "logstashQueue", "machineLearningApp", "magnet", "magnifyWithExclamation", "magnifyWithMinus", "magnifyWithPlus", "managementApp", "mapMarker", "memory", "menu", "menuDown", "menuLeft", "menuRight", "menuUp", "merge", "metricbeatApp", "metricsApp", "minimize", "minus", "minusInCircle", "minusInCircleFilled", "mobile", "monitoringApp", "moon", "namespace", "nested", "node", "notebookApp", "number", "offline", "online", "outlierDetectionJob", "package", "packetbeatApp", "pageSelect", "pagesSelect", "palette", "paperClip", "partial", "pause", "payment", "pencil", "percent", "pin", "pinFilled", "pipeBreaks", "pipelineApp", "pipeNoBreaks", "pivot", "play", "playFilled", "plus", "plusInCircle", "plusInCircleFilled", "popout", "push", "questionInCircle", "quote", "recentlyViewedApp", "refresh", "regressionJob", "reporter", "reportingApp", "returnKey", "save", "savedObjectsApp", "scale", "search", "searchProfilerApp", "securityAnalyticsApp", "securityApp", "securitySignal", "securitySignalDetected", "securitySignalResolved", "sessionViewer", "shard", "share", "snowflake", "sortAscending", "sortDescending", "sortDown", "sortLeft", "sortRight", "sortUp", "sortable", "spaces", "spacesApp", "sparkles", "sqlApp", "starEmpty", "starEmptySpace", "starFilled", "starFilledSpace", "starMinusEmpty", "starMinusFilled", "starPlusEmpty", "starPlusFilled", "stats", "stop", "stopFilled", "stopSlash", "storage", "string", "submodule", "sun", "swatchInput", "symlink", "tableDensityCompact", "tableDensityExpanded", "tableDensityNormal", "tableOfContents", "tag", "tear", "temperature", "timeline", "timelineWithArrow", "timelionApp", "timeRefresh", "timeslider", "training", "transitionLeftIn", "transitionLeftOut", "transitionTopIn", "transitionTopOut", "trash", "unfold", "unlink", "upgradeAssistantApp", "uptimeApp", "user", "userAvatar", "users", "usersRolesApp", "vector", "videoPlayer", "visArea", "visAreaStacked", "visBarHorizontal", "visBarHorizontalStacked", "visBarVertical", "visBarVerticalStacked", "visGauge", "visGoal", "visLine", "visMapCoordinate", "visMapRegion", "visMetric", "visPie", "visTable", "visTagCloud", "visText", "visTimelion", "visVega", "visVisualBuilder", "visualizeApp", "vulnerabilityManagementApp", "warning", "alert", "watchesApp", "wordWrap", "wordWrapDisabled", "workplaceSearchApp", "wrench", "tokenAlias", "tokenAnnotation", "tokenArray", "tokenBinary", "tokenBoolean", "tokenClass", "tokenCompletionSuggester", "tokenConstant", "tokenDate", "tokenElement", "tokenEnum", "tokenEnumMember", "tokenEvent", "tokenException", "tokenField", "tokenFile", "tokenFlattened", "tokenFunction", "tokenGeo", "tokenHistogram", "tokenInterface", "tokenIP", "tokenJoin", "tokenKey", "tokenKeyword", "tokenMethod", "tokenMetricCounter", "tokenMetricGauge", "tokenModule", "tokenNamespace", "tokenNested", "tokenNull", "tokenNumber", "tokenObject", "tokenOperator", "tokenPackage", "tokenParameter", "tokenPercolator", "tokenProperty", "tokenRange", "tokenRankFeature", "tokenRankFeatures", "tokenRepo", "tokenSearchType", "tokenShape", "tokenString", "tokenStruct", "tokenSymbol", "tokenTag", "tokenText", "tokenTokenCount", "tokenVariable", "tokenVectorDense", "tokenDenseVector", "tokenVectorSparse"]).isRequired, _propTypes.default.string.isRequired, _propTypes.default.elementType.isRequired]).isRequired, _propTypes.default.shape({
|
|
116
|
+
type: _propTypes.default.oneOfType([_propTypes.default.oneOf(["accessibility", "addDataApp", "advancedSettingsApp", "agentApp", "aggregate", "analyzeEvent", "annotation", "apmApp", "apmTrace", "appSearchApp", "apps", "arrowDown", "arrowLeft", "arrowRight", "arrowUp", "arrowStart", "arrowEnd", "article", "asterisk", "at", "auditbeatApp", "beaker", "bell", "bellSlash", "beta", "bolt", "boxesHorizontal", "boxesVertical", "branch", "branchUser", "broom", "brush", "bug", "bullseye", "calendar", "canvasApp", "casesApp", "check", "checkInCircleFilled", "cheer", "classificationJob", "clock", "cloudDrizzle", "cloudStormy", "cloudSunny", "cluster", "codeApp", "color", "compute", "console", "consoleApp", "container", "continuityAbove", "continuityAboveBelow", "continuityBelow", "continuityWithin", "controlsHorizontal", "controlsVertical", "copy", "copyClipboard", "createAdvancedJob", "createMultiMetricJob", "createPopulationJob", "createSingleMetricJob", "cross", "crossClusterReplicationApp", "crosshairs", "currency", "cut", "dashboardApp", "dataVisualizer", "database", "desktop", "devToolsApp", "discoverApp", "discuss", "document", "documentEdit", "documentation", "documents", "dot", "dotInCircle", "doubleArrowLeft", "doubleArrowRight", "download", "editorAlignCenter", "editorAlignLeft", "editorAlignRight", "editorBold", "editorChecklist", "editorCodeBlock", "editorComment", "editorDistributeHorizontal", "editorDistributeVertical", "editorHeading", "editorItalic", "editorItemAlignBottom", "editorItemAlignCenter", "editorItemAlignLeft", "editorItemAlignMiddle", "editorItemAlignRight", "editorItemAlignTop", "editorLink", "editorOrderedList", "editorPositionBottomLeft", "editorPositionBottomRight", "editorPositionTopLeft", "editorPositionTopRight", "editorRedo", "editorStrike", "editorTable", "editorUnderline", "editorUndo", "editorUnorderedList", "email", "empty", "emsApp", "endpoint", "eql", "eraser", "error", "esqlVis", "exit", "expand", "expandMini", "exportAction", "eye", "eyeClosed", "faceHappy", "faceNeutral", "faceSad", "filebeatApp", "filter", "filterExclude", "filterIgnore", "filterInclude", "filterInCircle", "flag", "fleetApp", "fold", "folderCheck", "folderClosed", "folderExclamation", "folderOpen", "frameNext", "framePrevious", "fullScreen", "fullScreenExit", "function", "gear", "gisApp", "glasses", "globe", "grab", "grabHorizontal", "grabOmnidirectional", "gradient", "graphApp", "grid", "grokApp", "heart", "heartbeatApp", "heatmap", "help", "home", "iInCircle", "image", "importAction", "indexClose", "indexEdit", "indexFlush", "indexManagementApp", "indexMapping", "indexOpen", "indexPatternApp", "indexRollupApp", "indexRuntime", "indexSettings", "indexTemporary", "infinity", "inputOutput", "inspect", "invert", "ip", "key", "keyboard", "kqlField", "kqlFunction", "kqlOperand", "kqlSelector", "kqlValue", "kubernetesNode", "kubernetesPod", "launch", "layers", "lensApp", "lettering", "lineDashed", "lineDotted", "lineSolid", "link", "list", "listAdd", "lock", "lockOpen", "logoAWS", "logoAWSMono", "logoAerospike", "logoApache", "logoAppSearch", "logoAzure", "logoAzureMono", "logoBeats", "logoBusinessAnalytics", "logoCeph", "logoCloud", "logoCloudEnterprise", "logoCode", "logoCodesandbox", "logoCouchbase", "logoDocker", "logoDropwizard", "logoElastic", "logoElasticStack", "logoElasticsearch", "logoEnterpriseSearch", "logoEtcd", "logoGCP", "logoGCPMono", "logoGithub", "logoGmail", "logoGolang", "logoGoogleG", "logoHAproxy", "logoIBM", "logoIBMMono", "logoKafka", "logoKibana", "logoKubernetes", "logoLogging", "logoLogstash", "logoMaps", "logoMemcached", "logoMetrics", "logoMongodb", "logoMySQL", "logoNginx", "logoObservability", "logoOsquery", "logoPhp", "logoPostgres", "logoPrometheus", "logoRabbitmq", "logoRedis", "logoSecurity", "logoSiteSearch", "logoSketch", "logoSlack", "logoUptime", "logoVulnerabilityManagement", "logoWebhook", "logoWindows", "logoWorkplaceSearch", "logsApp", "logstashFilter", "logstashIf", "logstashInput", "logstashOutput", "logstashQueue", "machineLearningApp", "magnet", "magnifyWithExclamation", "magnifyWithMinus", "magnifyWithPlus", "managementApp", "mapMarker", "memory", "menu", "menuDown", "menuLeft", "menuRight", "menuUp", "merge", "metricbeatApp", "metricsApp", "minimize", "minus", "minusInCircle", "minusInCircleFilled", "mobile", "monitoringApp", "moon", "namespace", "nested", "node", "notebookApp", "number", "offline", "online", "outlierDetectionJob", "package", "packetbeatApp", "pageSelect", "pagesSelect", "palette", "paperClip", "partial", "pause", "payment", "pencil", "percent", "pin", "pinFilled", "pipeBreaks", "pipelineApp", "pipeNoBreaks", "pivot", "play", "playFilled", "plus", "plusInCircle", "plusInCircleFilled", "popout", "push", "questionInCircle", "quote", "recentlyViewedApp", "refresh", "regressionJob", "reporter", "reportingApp", "returnKey", "save", "savedObjectsApp", "scale", "search", "searchProfilerApp", "securityAnalyticsApp", "securityApp", "securitySignal", "securitySignalDetected", "securitySignalResolved", "sessionViewer", "shard", "share", "snowflake", "sortAscending", "sortDescending", "sortDown", "sortLeft", "sortRight", "sortUp", "sortable", "spaces", "spacesApp", "sparkles", "sqlApp", "starEmpty", "starEmptySpace", "starFilled", "starFilledSpace", "starMinusEmpty", "starMinusFilled", "starPlusEmpty", "starPlusFilled", "stats", "stop", "stopFilled", "stopSlash", "storage", "string", "submodule", "sun", "swatchInput", "symlink", "tableDensityCompact", "tableDensityExpanded", "tableDensityNormal", "tableOfContents", "tag", "tear", "temperature", "timeline", "timelineWithArrow", "timelionApp", "timeRefresh", "timeslider", "training", "transitionLeftIn", "transitionLeftOut", "transitionTopIn", "transitionTopOut", "trash", "unfold", "unlink", "upgradeAssistantApp", "uptimeApp", "user", "userAvatar", "users", "usersRolesApp", "vector", "videoPlayer", "visArea", "visAreaStacked", "visBarHorizontal", "visBarHorizontalStacked", "visBarVertical", "visBarVerticalStacked", "visGauge", "visGoal", "visLine", "visMapCoordinate", "visMapRegion", "visMetric", "visPie", "visTable", "visTagCloud", "visText", "visTimelion", "visVega", "visVisualBuilder", "visualizeApp", "vulnerabilityManagementApp", "warning", "alert", "watchesApp", "wordWrap", "wordWrapDisabled", "workplaceSearchApp", "wrench", "tokenAlias", "tokenAnnotation", "tokenArray", "tokenBinary", "tokenBoolean", "tokenClass", "tokenCompletionSuggester", "tokenConstant", "tokenDate", "tokenElement", "tokenEnum", "tokenEnumMember", "tokenEvent", "tokenException", "tokenField", "tokenFile", "tokenFlattened", "tokenFunction", "tokenGeo", "tokenHistogram", "tokenInterface", "tokenIP", "tokenJoin", "tokenKey", "tokenKeyword", "tokenMethod", "tokenMetricCounter", "tokenMetricGauge", "tokenModule", "tokenNamespace", "tokenNested", "tokenNull", "tokenNumber", "tokenObject", "tokenOperator", "tokenPackage", "tokenParameter", "tokenPercolator", "tokenProperty", "tokenRange", "tokenRankFeature", "tokenRankFeatures", "tokenRepo", "tokenSearchType", "tokenShape", "tokenString", "tokenStruct", "tokenSymbol", "tokenTag", "tokenText", "tokenTokenCount", "tokenVariable", "tokenVectorDense", "tokenDenseVector", "tokenVectorSparse"]).isRequired, _propTypes.default.string.isRequired, _propTypes.default.elementType.isRequired]).isRequired,
|
|
117
|
+
side: _propTypes.default.any,
|
|
118
|
+
color: _propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.any.isRequired]),
|
|
119
|
+
ref: _propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.func.isRequired])
|
|
120
|
+
}).isRequired]),
|
|
86
121
|
isLoading: _propTypes.default.bool,
|
|
87
122
|
isInvalid: _propTypes.default.bool,
|
|
123
|
+
/**
|
|
124
|
+
* Shows a button that allows users to quickly clear the textarea
|
|
125
|
+
*/
|
|
126
|
+
isClearable: _propTypes.default.bool,
|
|
88
127
|
/**
|
|
89
128
|
* Expand to fill 100% of the parent.
|
|
90
129
|
* Defaults to `fullWidth` prop of `<EuiForm>`.
|