@elastic/eui 77.1.0 → 77.2.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/README.md +30 -29
- package/dist/eui_theme_dark.css +70 -158
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +70 -158
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/basic_table/basic_table.a11y.js +202 -0
- package/es/components/basic_table/{table.a11y.js → in_memory_table.a11y.js} +1 -1
- package/es/components/date_picker/date_picker.js +23 -15
- package/es/components/date_picker/date_picker_range.js +36 -42
- package/es/components/date_picker/super_date_picker/super_date_picker.js +99 -84
- package/es/components/form/field_number/field_number.js +39 -8
- package/es/components/form/field_text/field_text.js +1 -1
- package/es/components/form/form_control_layout/form_control_layout.js +67 -30
- package/es/components/form/form_control_layout/form_control_layout_delimited.js +31 -11
- package/es/components/form/form_control_layout/form_control_layout_icons.js +12 -20
- package/es/components/form/range/dual_range.js +2 -4
- package/es/components/form/range/range.js +0 -2
- package/es/components/form/range/range_input.js +54 -13
- package/es/components/form/validatable_control/validatable_control.js +15 -5
- package/es/components/index.js +0 -1
- package/es/components/search_bar/query/ast_to_es_query_dsl.js +6 -1
- package/es/components/search_bar/query/ast_to_es_query_string.js +3 -0
- package/es/components/suggest/suggest.a11y.js +70 -0
- package/es/components/table/table.a11y.js +75 -0
- package/eui.d.ts +55 -173
- package/i18ntokens.json +26 -44
- package/lib/components/basic_table/basic_table.a11y.js +194 -0
- package/lib/components/basic_table/{table.a11y.js → in_memory_table.a11y.js} +2 -2
- package/lib/components/date_picker/date_picker.js +23 -15
- package/lib/components/date_picker/date_picker_range.js +35 -41
- package/lib/components/date_picker/super_date_picker/super_date_picker.js +99 -84
- package/lib/components/form/field_number/field_number.js +42 -8
- package/lib/components/form/field_text/field_text.js +1 -1
- package/lib/components/form/form_control_layout/form_control_layout.js +67 -35
- package/lib/components/form/form_control_layout/form_control_layout_delimited.js +31 -11
- package/lib/components/form/form_control_layout/form_control_layout_icons.js +11 -19
- package/lib/components/form/range/dual_range.js +2 -4
- package/lib/components/form/range/range.js +0 -2
- package/lib/components/form/range/range_input.js +52 -11
- package/lib/components/form/validatable_control/validatable_control.js +14 -12
- package/lib/components/index.js +0 -11
- package/lib/components/search_bar/query/ast_to_es_query_dsl.js +6 -1
- package/lib/components/search_bar/query/ast_to_es_query_string.js +3 -0
- package/lib/components/suggest/suggest.a11y.js +73 -0
- package/lib/components/table/table.a11y.js +78 -0
- package/optimize/es/components/basic_table/basic_table.a11y.js +194 -0
- package/optimize/es/components/basic_table/{table.a11y.js → in_memory_table.a11y.js} +1 -1
- package/optimize/es/components/date_picker/date_picker.js +17 -14
- package/optimize/es/components/date_picker/date_picker_range.js +20 -14
- package/optimize/es/components/date_picker/super_date_picker/super_date_picker.js +99 -84
- package/optimize/es/components/form/field_number/field_number.js +34 -8
- package/optimize/es/components/form/field_text/field_text.js +1 -1
- package/optimize/es/components/form/form_control_layout/form_control_layout.js +67 -30
- package/optimize/es/components/form/form_control_layout/form_control_layout_delimited.js +31 -11
- package/optimize/es/components/form/form_control_layout/form_control_layout_icons.js +10 -20
- package/optimize/es/components/form/range/dual_range.js +2 -4
- package/optimize/es/components/form/range/range.js +0 -2
- package/optimize/es/components/form/range/range_input.js +49 -12
- package/optimize/es/components/form/validatable_control/validatable_control.js +10 -5
- package/optimize/es/components/index.js +0 -1
- package/optimize/es/components/search_bar/query/ast_to_es_query_dsl.js +6 -1
- package/optimize/es/components/search_bar/query/ast_to_es_query_string.js +3 -0
- package/optimize/es/components/suggest/suggest.a11y.js +70 -0
- package/optimize/es/components/table/table.a11y.js +75 -0
- package/optimize/lib/components/basic_table/basic_table.a11y.js +188 -0
- package/{test-env/components/basic_table/table.a11y.js → optimize/lib/components/basic_table/in_memory_table.a11y.js} +2 -2
- package/optimize/lib/components/date_picker/date_picker.js +17 -14
- package/optimize/lib/components/date_picker/date_picker_range.js +19 -13
- package/optimize/lib/components/date_picker/super_date_picker/super_date_picker.js +99 -84
- package/optimize/lib/components/form/field_number/field_number.js +37 -8
- package/optimize/lib/components/form/field_text/field_text.js +1 -1
- package/optimize/lib/components/form/form_control_layout/form_control_layout.js +67 -35
- package/optimize/lib/components/form/form_control_layout/form_control_layout_delimited.js +31 -11
- package/optimize/lib/components/form/form_control_layout/form_control_layout_icons.js +9 -19
- package/optimize/lib/components/form/range/dual_range.js +2 -4
- package/optimize/lib/components/form/range/range.js +0 -2
- package/optimize/lib/components/form/range/range_input.js +47 -10
- package/optimize/lib/components/form/validatable_control/validatable_control.js +10 -4
- package/optimize/lib/components/index.js +0 -11
- package/optimize/lib/components/search_bar/query/ast_to_es_query_dsl.js +6 -1
- package/optimize/lib/components/search_bar/query/ast_to_es_query_string.js +3 -0
- package/optimize/lib/components/suggest/suggest.a11y.js +73 -0
- package/optimize/lib/components/table/table.a11y.js +78 -0
- package/package.json +1 -1
- package/src/components/date_picker/_date_picker_range.scss +0 -60
- package/src/components/date_picker/super_date_picker/_super_date_picker.scss +23 -11
- package/src/components/date_picker/super_date_picker/_variables.scss +3 -0
- package/src/components/date_picker/super_date_picker/date_popover/_date_popover_button.scss +5 -7
- package/src/components/form/form_control_layout/_form_control_layout.scss +2 -2
- package/src/components/form/form_control_layout/_form_control_layout_delimited.scss +12 -36
- package/src/components/form/form_control_layout/_form_control_layout_icons.scss +27 -6
- package/src/themes/amsterdam/overrides/_date_picker.scss +0 -14
- package/src/themes/amsterdam/overrides/_index.scss +0 -1
- package/test-env/components/basic_table/basic_table.a11y.js +188 -0
- package/{optimize/lib/components/basic_table/table.a11y.js → test-env/components/basic_table/in_memory_table.a11y.js} +2 -2
- package/test-env/components/date_picker/date_picker.js +23 -15
- package/test-env/components/date_picker/date_picker_range.js +35 -41
- package/test-env/components/date_picker/super_date_picker/super_date_picker.js +99 -84
- package/test-env/components/form/field_number/field_number.js +37 -8
- package/test-env/components/form/field_text/field_text.js +1 -1
- package/test-env/components/form/form_control_layout/form_control_layout.js +68 -35
- package/test-env/components/form/form_control_layout/form_control_layout_delimited.js +31 -11
- package/test-env/components/form/form_control_layout/form_control_layout_icons.js +11 -19
- package/test-env/components/form/range/dual_range.js +2 -4
- package/test-env/components/form/range/range.js +0 -2
- package/test-env/components/form/range/range_input.js +47 -11
- package/test-env/components/form/validatable_control/validatable_control.js +9 -4
- package/test-env/components/index.js +0 -11
- package/test-env/components/search_bar/query/ast_to_es_query_dsl.js +6 -1
- package/test-env/components/search_bar/query/ast_to_es_query_string.js +3 -0
- package/test-env/components/suggest/suggest.a11y.js +73 -0
- package/test-env/components/table/table.a11y.js +78 -0
- package/es/components/inline_edit/index.js +0 -10
- package/es/components/inline_edit/inline_edit.styles.js +0 -15
- package/es/components/inline_edit/inline_edit_form.js +0 -190
- package/es/components/inline_edit/inline_edit_text.js +0 -97
- package/es/components/inline_edit/inline_edit_title.js +0 -105
- package/lib/components/inline_edit/index.js +0 -19
- package/lib/components/inline_edit/inline_edit.styles.js +0 -22
- package/lib/components/inline_edit/inline_edit_form.js +0 -193
- package/lib/components/inline_edit/inline_edit_text.js +0 -97
- package/lib/components/inline_edit/inline_edit_title.js +0 -106
- package/optimize/es/components/inline_edit/index.js +0 -10
- package/optimize/es/components/inline_edit/inline_edit.styles.js +0 -15
- package/optimize/es/components/inline_edit/inline_edit_form.js +0 -133
- package/optimize/es/components/inline_edit/inline_edit_text.js +0 -52
- package/optimize/es/components/inline_edit/inline_edit_title.js +0 -56
- package/optimize/lib/components/inline_edit/index.js +0 -19
- package/optimize/lib/components/inline_edit/inline_edit.styles.js +0 -22
- package/optimize/lib/components/inline_edit/inline_edit_form.js +0 -144
- package/optimize/lib/components/inline_edit/inline_edit_text.js +0 -52
- package/optimize/lib/components/inline_edit/inline_edit_title.js +0 -57
- package/src/themes/amsterdam/overrides/_date_popover_button.scss +0 -14
- package/test-env/components/inline_edit/index.js +0 -19
- package/test-env/components/inline_edit/inline_edit.styles.js +0 -22
- package/test-env/components/inline_edit/inline_edit_form.js +0 -196
- package/test-env/components/inline_edit/inline_edit_text.js +0 -96
- package/test-env/components/inline_edit/inline_edit_title.js +0 -105
|
@@ -1,20 +1,25 @@
|
|
|
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.EuiFieldNumber = void 0;
|
|
8
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
-
var _react =
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
13
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
|
-
var
|
|
14
|
+
var _services = require("../../../services");
|
|
13
15
|
var _validatable_control = require("../validatable_control");
|
|
14
|
-
var
|
|
16
|
+
var _form_control_layout = require("../form_control_layout");
|
|
15
17
|
var _num_icons = require("../form_control_layout/_num_icons");
|
|
18
|
+
var _eui_form_context = require("../eui_form_context");
|
|
16
19
|
var _react2 = require("@emotion/react");
|
|
17
|
-
var _excluded = ["className", "icon", "id", "placeholder", "name", "min", "max", "value", "isInvalid", "fullWidth", "isLoading", "compressed", "prepend", "append", "inputRef", "readOnly", "controlOnly"];
|
|
20
|
+
var _excluded = ["className", "icon", "id", "placeholder", "name", "min", "max", "value", "isInvalid", "fullWidth", "isLoading", "compressed", "prepend", "append", "inputRef", "readOnly", "controlOnly", "onKeyDown"];
|
|
21
|
+
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); }
|
|
22
|
+
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; }
|
|
18
23
|
var EuiFieldNumber = function EuiFieldNumber(props) {
|
|
19
24
|
var _useFormContext = (0, _eui_form_context.useFormContext)(),
|
|
20
25
|
defaultFullWidth = _useFormContext.defaultFullWidth;
|
|
@@ -38,9 +43,31 @@ var EuiFieldNumber = function EuiFieldNumber(props) {
|
|
|
38
43
|
inputRef = props.inputRef,
|
|
39
44
|
readOnly = props.readOnly,
|
|
40
45
|
controlOnly = props.controlOnly,
|
|
46
|
+
_onKeyDown = props.onKeyDown,
|
|
41
47
|
rest = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
|
|
49
|
+
// Attempt to determine additional invalid state. The native number input
|
|
50
|
+
// will set :invalid state automatically, but we need to also set
|
|
51
|
+
// `aria-invalid` as well as display an icon. We also want to *not* set this on
|
|
52
|
+
// EuiValidatableControl, in order to not override custom validity messages
|
|
53
|
+
var _useState = (0, _react.useState)(false),
|
|
54
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
55
|
+
isNativelyInvalid = _useState2[0],
|
|
56
|
+
setIsNativelyInvalid = _useState2[1];
|
|
57
|
+
var validityRef = (0, _react.useRef)(null);
|
|
58
|
+
var setRefs = (0, _services.useCombinedRefs)([validityRef, inputRef]);
|
|
59
|
+
|
|
60
|
+
// Note that we can't use hook into `onChange` because browsers don't emit change events
|
|
61
|
+
// for invalid values - see https://github.com/facebook/react/issues/16554
|
|
62
|
+
var onKeyDown = (0, _react.useCallback)(function (e) {
|
|
63
|
+
_onKeyDown === null || _onKeyDown === void 0 ? void 0 : _onKeyDown(e);
|
|
64
|
+
// Wait a beat before checking validity - we can't use `e.target` as it's stale
|
|
65
|
+
requestAnimationFrame(function () {
|
|
66
|
+
setIsNativelyInvalid(!validityRef.current.validity.valid);
|
|
67
|
+
});
|
|
68
|
+
}, [_onKeyDown]);
|
|
69
|
+
var numIconsClass = controlOnly ? false : (0, _num_icons.getFormControlClassNameForIconCount)({
|
|
70
|
+
isInvalid: isInvalid || isNativelyInvalid,
|
|
44
71
|
isLoading: isLoading
|
|
45
72
|
});
|
|
46
73
|
var classes = (0, _classnames.default)('euiFieldNumber', className, numIconsClass, {
|
|
@@ -62,7 +89,9 @@ var EuiFieldNumber = function EuiFieldNumber(props) {
|
|
|
62
89
|
placeholder: placeholder,
|
|
63
90
|
readOnly: readOnly,
|
|
64
91
|
className: classes,
|
|
65
|
-
ref:
|
|
92
|
+
ref: setRefs,
|
|
93
|
+
onKeyDown: onKeyDown,
|
|
94
|
+
"aria-invalid": isInvalid || isNativelyInvalid
|
|
66
95
|
}, rest)));
|
|
67
96
|
if (controlOnly) {
|
|
68
97
|
return control;
|
|
@@ -71,7 +100,7 @@ var EuiFieldNumber = function EuiFieldNumber(props) {
|
|
|
71
100
|
icon: icon,
|
|
72
101
|
fullWidth: fullWidth,
|
|
73
102
|
isLoading: isLoading,
|
|
74
|
-
isInvalid: isInvalid,
|
|
103
|
+
isInvalid: isInvalid || isNativelyInvalid,
|
|
75
104
|
compressed: compressed,
|
|
76
105
|
readOnly: readOnly,
|
|
77
106
|
prepend: prepend,
|
|
@@ -35,7 +35,7 @@ var EuiFieldText = function EuiFieldText(props) {
|
|
|
35
35
|
readOnly = props.readOnly,
|
|
36
36
|
controlOnly = props.controlOnly,
|
|
37
37
|
rest = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
38
|
-
var numIconsClass = (0, _num_icons.getFormControlClassNameForIconCount)({
|
|
38
|
+
var numIconsClass = controlOnly ? false : (0, _num_icons.getFormControlClassNameForIconCount)({
|
|
39
39
|
isInvalid: isInvalid,
|
|
40
40
|
isLoading: isLoading
|
|
41
41
|
});
|
|
@@ -6,16 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.EuiFormControlLayout = void 0;
|
|
9
|
-
Object.defineProperty(exports, "ICON_SIDES", {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
get: function get() {
|
|
12
|
-
return _form_control_layout_icons.ICON_SIDES;
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
16
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
17
11
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
18
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
19
14
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
20
15
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
21
16
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
@@ -26,7 +21,7 @@ var _form_control_layout_icons = require("./form_control_layout_icons");
|
|
|
26
21
|
var _form_label = require("../form_label");
|
|
27
22
|
var _eui_form_context = require("../eui_form_context");
|
|
28
23
|
var _react2 = require("@emotion/react");
|
|
29
|
-
var _excluded = ["children", "icon", "clear", "fullWidth", "isLoading", "isDisabled", "compressed", "className", "prepend", "append", "readOnly", "isInvalid", "isDropdown", "inputId"];
|
|
24
|
+
var _excluded = ["children", "icon", "iconsPosition", "clear", "fullWidth", "isLoading", "isDisabled", "compressed", "className", "prepend", "append", "readOnly", "isInvalid", "isDropdown", "inputId"];
|
|
30
25
|
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); }
|
|
31
26
|
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; }
|
|
32
27
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
@@ -35,31 +30,75 @@ var EuiFormControlLayout = /*#__PURE__*/function (_Component) {
|
|
|
35
30
|
(0, _inherits2.default)(EuiFormControlLayout, _Component);
|
|
36
31
|
var _super = _createSuper(EuiFormControlLayout);
|
|
37
32
|
function EuiFormControlLayout() {
|
|
33
|
+
var _this;
|
|
38
34
|
(0, _classCallCheck2.default)(this, EuiFormControlLayout);
|
|
39
|
-
|
|
35
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
36
|
+
args[_key] = arguments[_key];
|
|
37
|
+
}
|
|
38
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
39
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderLeftIcons", function () {
|
|
40
|
+
var _this$props = _this.props,
|
|
41
|
+
icon = _this$props.icon,
|
|
42
|
+
iconsPosition = _this$props.iconsPosition,
|
|
43
|
+
compressed = _this$props.compressed;
|
|
44
|
+
var leftCustomIcon = icon && (icon === null || icon === void 0 ? void 0 : icon.side) !== 'right' ? icon : undefined;
|
|
45
|
+
return leftCustomIcon ? (0, _react2.jsx)(_form_control_layout_icons.EuiFormControlLayoutIcons, {
|
|
46
|
+
side: "left",
|
|
47
|
+
icon: leftCustomIcon,
|
|
48
|
+
iconsPosition: iconsPosition,
|
|
49
|
+
compressed: compressed
|
|
50
|
+
}) : null;
|
|
51
|
+
});
|
|
52
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderRightIcons", function () {
|
|
53
|
+
var _this$props2 = _this.props,
|
|
54
|
+
icon = _this$props2.icon,
|
|
55
|
+
iconsPosition = _this$props2.iconsPosition,
|
|
56
|
+
clear = _this$props2.clear,
|
|
57
|
+
compressed = _this$props2.compressed,
|
|
58
|
+
isLoading = _this$props2.isLoading,
|
|
59
|
+
isInvalid = _this$props2.isInvalid,
|
|
60
|
+
isDisabled = _this$props2.isDisabled,
|
|
61
|
+
readOnly = _this$props2.readOnly,
|
|
62
|
+
isDropdown = _this$props2.isDropdown;
|
|
63
|
+
var hasDropdownIcon = !readOnly && !isDisabled && isDropdown;
|
|
64
|
+
var rightCustomIcon = icon && (icon === null || icon === void 0 ? void 0 : icon.side) === 'right' ? icon : undefined;
|
|
65
|
+
var hasRightIcons = rightCustomIcon || clear || isLoading || isInvalid || hasDropdownIcon;
|
|
66
|
+
return hasRightIcons ? (0, _react2.jsx)(_form_control_layout_icons.EuiFormControlLayoutIcons, {
|
|
67
|
+
side: "right",
|
|
68
|
+
icon: rightCustomIcon,
|
|
69
|
+
iconsPosition: iconsPosition,
|
|
70
|
+
compressed: compressed,
|
|
71
|
+
clear: clear,
|
|
72
|
+
isLoading: isLoading,
|
|
73
|
+
isInvalid: isInvalid,
|
|
74
|
+
isDropdown: hasDropdownIcon
|
|
75
|
+
}) : null;
|
|
76
|
+
});
|
|
77
|
+
return _this;
|
|
40
78
|
}
|
|
41
79
|
(0, _createClass2.default)(EuiFormControlLayout, [{
|
|
42
80
|
key: "render",
|
|
43
81
|
value: function render() {
|
|
44
82
|
var _ref = this.context,
|
|
45
83
|
defaultFullWidth = _ref.defaultFullWidth;
|
|
46
|
-
var _this$
|
|
47
|
-
children = _this$
|
|
48
|
-
icon = _this$
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
84
|
+
var _this$props3 = this.props,
|
|
85
|
+
children = _this$props3.children,
|
|
86
|
+
icon = _this$props3.icon,
|
|
87
|
+
iconsPosition = _this$props3.iconsPosition,
|
|
88
|
+
clear = _this$props3.clear,
|
|
89
|
+
_this$props3$fullWidt = _this$props3.fullWidth,
|
|
90
|
+
fullWidth = _this$props3$fullWidt === void 0 ? defaultFullWidth : _this$props3$fullWidt,
|
|
91
|
+
isLoading = _this$props3.isLoading,
|
|
92
|
+
isDisabled = _this$props3.isDisabled,
|
|
93
|
+
compressed = _this$props3.compressed,
|
|
94
|
+
className = _this$props3.className,
|
|
95
|
+
prepend = _this$props3.prepend,
|
|
96
|
+
append = _this$props3.append,
|
|
97
|
+
readOnly = _this$props3.readOnly,
|
|
98
|
+
isInvalid = _this$props3.isInvalid,
|
|
99
|
+
isDropdown = _this$props3.isDropdown,
|
|
100
|
+
inputId = _this$props3.inputId,
|
|
101
|
+
rest = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
|
|
63
102
|
var classes = (0, _classnames.default)('euiFormControlLayout', {
|
|
64
103
|
'euiFormControlLayout--fullWidth': fullWidth,
|
|
65
104
|
'euiFormControlLayout--compressed': compressed,
|
|
@@ -73,19 +112,12 @@ var EuiFormControlLayout = /*#__PURE__*/function (_Component) {
|
|
|
73
112
|
className: classes
|
|
74
113
|
}, rest), prependNodes, (0, _react2.jsx)("div", {
|
|
75
114
|
className: "euiFormControlLayout__childrenWrapper"
|
|
76
|
-
},
|
|
77
|
-
icon: icon,
|
|
78
|
-
clear: clear,
|
|
79
|
-
compressed: compressed,
|
|
80
|
-
isLoading: isLoading,
|
|
81
|
-
isInvalid: invalid,
|
|
82
|
-
isDropdown: !readOnly && !isDisabled && isDropdown
|
|
83
|
-
})), appendNodes);
|
|
115
|
+
}, this.renderLeftIcons(), children, this.renderRightIcons()), appendNodes);
|
|
84
116
|
}
|
|
85
117
|
}, {
|
|
86
118
|
key: "renderSideNode",
|
|
87
119
|
value: function renderSideNode(side, nodes, inputId) {
|
|
88
|
-
var
|
|
120
|
+
var _this2 = this;
|
|
89
121
|
if (!nodes) {
|
|
90
122
|
return;
|
|
91
123
|
}
|
|
@@ -93,7 +125,7 @@ var EuiFormControlLayout = /*#__PURE__*/function (_Component) {
|
|
|
93
125
|
return this.createFormLabel(side, nodes, inputId);
|
|
94
126
|
}
|
|
95
127
|
var appendNodes = _react.default.Children.map(nodes, function (item, index) {
|
|
96
|
-
return typeof item === 'string' ?
|
|
128
|
+
return typeof item === 'string' ? _this2.createFormLabel(side, item, inputId) : _this2.createSideNode(side, item, index);
|
|
97
129
|
});
|
|
98
130
|
return appendNodes;
|
|
99
131
|
}
|
|
@@ -10,6 +10,8 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
var _i18n = require("../../i18n");
|
|
14
|
+
var _icon = require("../../icon");
|
|
13
15
|
var _text = require("../../text");
|
|
14
16
|
var _form_control_layout = require("./form_control_layout");
|
|
15
17
|
var _react2 = require("@emotion/react");
|
|
@@ -19,22 +21,40 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
19
21
|
var EuiFormControlLayoutDelimited = function EuiFormControlLayoutDelimited(_ref) {
|
|
20
22
|
var startControl = _ref.startControl,
|
|
21
23
|
endControl = _ref.endControl,
|
|
22
|
-
|
|
23
|
-
delimiter = _ref$delimiter === void 0 ? '→' : _ref$delimiter,
|
|
24
|
+
delimiter = _ref.delimiter,
|
|
24
25
|
className = _ref.className,
|
|
25
26
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
26
|
-
var
|
|
27
|
+
var isInvalid = rest.isInvalid,
|
|
28
|
+
isDisabled = rest.isDisabled,
|
|
29
|
+
readOnly = rest.readOnly;
|
|
30
|
+
var showInvalidState = isInvalid && !isDisabled && !readOnly;
|
|
31
|
+
var classes = (0, _classnames.default)('euiFormControlLayoutDelimited', className, {
|
|
32
|
+
'euiFormControlLayoutDelimited--isInvalid': showInvalidState
|
|
33
|
+
});
|
|
27
34
|
return (0, _react2.jsx)(_form_control_layout.EuiFormControlLayout, (0, _extends2.default)({
|
|
28
|
-
className: classes
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
35
|
+
className: classes,
|
|
36
|
+
iconsPosition: "static"
|
|
37
|
+
}, rest), addClassesToControl(startControl), (0, _react2.jsx)(EuiFormControlDelimiter, {
|
|
38
|
+
delimiter: delimiter,
|
|
39
|
+
isInvalid: showInvalidState
|
|
40
|
+
}), addClassesToControl(endControl));
|
|
34
41
|
};
|
|
35
42
|
exports.EuiFormControlLayoutDelimited = EuiFormControlLayoutDelimited;
|
|
36
|
-
function addClassesToControl(control) {
|
|
43
|
+
var addClassesToControl = function addClassesToControl(control) {
|
|
37
44
|
return /*#__PURE__*/(0, _react.cloneElement)(control, {
|
|
38
45
|
className: (0, _classnames.default)(control.props.className, 'euiFormControlLayoutDelimited__input')
|
|
39
46
|
});
|
|
40
|
-
}
|
|
47
|
+
};
|
|
48
|
+
var EuiFormControlDelimiter = function EuiFormControlDelimiter(_ref2) {
|
|
49
|
+
var delimiter = _ref2.delimiter,
|
|
50
|
+
isInvalid = _ref2.isInvalid;
|
|
51
|
+
var defaultAriaLabel = (0, _i18n.useEuiI18n)('euiFormControlLayoutDelimited.delimiterLabel', 'to');
|
|
52
|
+
return (0, _react2.jsx)(_text.EuiText, {
|
|
53
|
+
className: "euiFormControlLayoutDelimited__delimiter",
|
|
54
|
+
size: "s",
|
|
55
|
+
color: isInvalid ? 'danger' : 'subdued'
|
|
56
|
+
}, delimiter !== null && delimiter !== void 0 ? delimiter : (0, _react2.jsx)(_icon.EuiIcon, {
|
|
57
|
+
type: "sortRight",
|
|
58
|
+
"aria-label": defaultAriaLabel
|
|
59
|
+
}));
|
|
60
|
+
};
|
|
@@ -14,6 +14,7 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
|
|
|
14
14
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
15
15
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
16
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
18
|
var _loading = require("../../loading");
|
|
18
19
|
var _form_control_layout_clear_button = require("./form_control_layout_clear_button");
|
|
19
20
|
var _form_control_layout_custom_icon = require("./form_control_layout_custom_icon");
|
|
@@ -40,30 +41,19 @@ var EuiFormControlLayoutIcons = /*#__PURE__*/function (_Component) {
|
|
|
40
41
|
key: "render",
|
|
41
42
|
value: function render() {
|
|
42
43
|
var _this$props = this.props,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
_this$props$side = _this$props.side,
|
|
45
|
+
side = _this$props$side === void 0 ? 'left' : _this$props$side,
|
|
46
|
+
_this$props$iconsPosi = _this$props.iconsPosition,
|
|
47
|
+
iconsPosition = _this$props$iconsPosi === void 0 ? 'absolute' : _this$props$iconsPosi;
|
|
47
48
|
var customIcon = this.renderCustomIcon();
|
|
48
49
|
var loadingSpinner = this.renderLoadingSpinner();
|
|
49
50
|
var clearButton = this.renderClearButton();
|
|
50
51
|
var invalidIcon = this.renderInvalidIcon();
|
|
51
52
|
var dropdownIcon = this.renderDropdownIcon();
|
|
52
|
-
var
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}, customIcon);
|
|
57
|
-
}
|
|
58
|
-
var rightIcons;
|
|
59
|
-
|
|
60
|
-
// If the icon is on the right, it should be placed after the clear button in the DOM.
|
|
61
|
-
if (clearButton || loadingSpinner || isInvalid || isDropdown || customIcon && iconSide === 'right') {
|
|
62
|
-
rightIcons = (0, _react2.jsx)("div", {
|
|
63
|
-
className: "euiFormControlLayoutIcons euiFormControlLayoutIcons--right"
|
|
64
|
-
}, clearButton, loadingSpinner, invalidIcon, iconSide === 'right' ? customIcon : undefined, dropdownIcon);
|
|
65
|
-
}
|
|
66
|
-
return (0, _react2.jsx)(_react.Fragment, null, leftIcons, rightIcons);
|
|
53
|
+
var classes = (0, _classnames.default)('euiFormControlLayoutIcons', "euiFormControlLayoutIcons--".concat(side), "euiFormControlLayoutIcons--".concat(iconsPosition));
|
|
54
|
+
return (0, _react2.jsx)("div", {
|
|
55
|
+
className: classes
|
|
56
|
+
}, clearButton, loadingSpinner, invalidIcon, customIcon, dropdownIcon);
|
|
67
57
|
}
|
|
68
58
|
}, {
|
|
69
59
|
key: "renderCustomIcon",
|
|
@@ -392,7 +392,6 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
392
392
|
var min = minProps;
|
|
393
393
|
var max = maxProps;
|
|
394
394
|
var id = this.state.id;
|
|
395
|
-
var digitTolerance = Math.max(String(min).length, String(max).length);
|
|
396
395
|
var showInputOnly = showInput === 'inputWithPopover';
|
|
397
396
|
var canShowDropdown = showInputOnly && !readOnly && !disabled;
|
|
398
397
|
var rangeStyles = (0, _range.euiRangeStyles)(theme);
|
|
@@ -403,7 +402,6 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
403
402
|
"aria-label": this.props['aria-label']
|
|
404
403
|
}, minInputProps, {
|
|
405
404
|
// Non-overridable props
|
|
406
|
-
digitTolerance: digitTolerance,
|
|
407
405
|
side: "min",
|
|
408
406
|
min: min,
|
|
409
407
|
max: Number(this.upperValue),
|
|
@@ -432,7 +430,6 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
432
430
|
"aria-label": this.props['aria-label']
|
|
433
431
|
}, maxInputProps, {
|
|
434
432
|
// Non-overridable props
|
|
435
|
-
digitTolerance: digitTolerance,
|
|
436
433
|
side: "max",
|
|
437
434
|
min: Number(this.lowerValue),
|
|
438
435
|
max: max,
|
|
@@ -584,7 +581,8 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
584
581
|
readOnly: readOnly,
|
|
585
582
|
append: append,
|
|
586
583
|
prepend: prepend,
|
|
587
|
-
isLoading: isLoading
|
|
584
|
+
isLoading: isLoading,
|
|
585
|
+
isInvalid: isInvalid
|
|
588
586
|
}),
|
|
589
587
|
fullWidth: fullWidth,
|
|
590
588
|
isOpen: this.state.isPopoverOpen,
|
|
@@ -133,14 +133,12 @@ var EuiRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
133
133
|
theme = _this$props.theme,
|
|
134
134
|
rest = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
|
|
135
135
|
var id = this.state.id;
|
|
136
|
-
var digitTolerance = Math.max(String(min).length, String(max).length);
|
|
137
136
|
var showInputOnly = showInput === 'inputWithPopover';
|
|
138
137
|
var canShowDropdown = showInputOnly && !readOnly && !disabled;
|
|
139
138
|
var theInput = !!showInput ? (0, _react2.jsx)(_range_input.EuiRangeInput, (0, _extends2.default)({
|
|
140
139
|
id: id,
|
|
141
140
|
min: min,
|
|
142
141
|
max: max,
|
|
143
|
-
digitTolerance: digitTolerance,
|
|
144
142
|
step: step,
|
|
145
143
|
value: value,
|
|
146
144
|
readOnly: readOnly,
|
|
@@ -7,14 +7,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.EuiRangeInput = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
13
|
var _services = require("../../../services");
|
|
13
14
|
var _global_styling = require("../../../global_styling");
|
|
15
|
+
var _form = require("../form.styles");
|
|
14
16
|
var _field_number = require("../field_number");
|
|
15
17
|
var _range_input = require("./range_input.styles");
|
|
16
18
|
var _react2 = require("@emotion/react");
|
|
17
|
-
var _excluded = ["min", "max", "step", "value", "disabled", "compressed", "onChange", "name", "side", "
|
|
19
|
+
var _excluded = ["min", "max", "step", "value", "inputRef", "isInvalid", "disabled", "compressed", "onChange", "name", "side", "fullWidth", "autoSize"];
|
|
18
20
|
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); }
|
|
19
21
|
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; }
|
|
20
22
|
var EuiRangeInput = function EuiRangeInput(_ref) {
|
|
@@ -22,28 +24,61 @@ var EuiRangeInput = function EuiRangeInput(_ref) {
|
|
|
22
24
|
max = _ref.max,
|
|
23
25
|
step = _ref.step,
|
|
24
26
|
value = _ref.value,
|
|
27
|
+
inputRef = _ref.inputRef,
|
|
28
|
+
isInvalid = _ref.isInvalid,
|
|
25
29
|
disabled = _ref.disabled,
|
|
26
30
|
compressed = _ref.compressed,
|
|
27
31
|
onChange = _ref.onChange,
|
|
28
32
|
name = _ref.name,
|
|
29
33
|
_ref$side = _ref.side,
|
|
30
34
|
side = _ref$side === void 0 ? 'max' : _ref$side,
|
|
31
|
-
digitTolerance = _ref.digitTolerance,
|
|
32
35
|
fullWidth = _ref.fullWidth,
|
|
33
36
|
_ref$autoSize = _ref.autoSize,
|
|
34
37
|
autoSize = _ref$autoSize === void 0 ? true : _ref$autoSize,
|
|
35
38
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
36
|
-
// Chrome will properly size the input based on the max value, but FF does not.
|
|
37
|
-
// Calculate the width of the input based on highest number of characters.
|
|
38
|
-
// Add 2 to accommodate for input stepper
|
|
39
|
-
var widthStyle = (0, _react.useMemo)(function () {
|
|
40
|
-
return autoSize ? (0, _global_styling.logicalStyles)({
|
|
41
|
-
width: "".concat(digitTolerance / 1.25 + 2, "em")
|
|
42
|
-
}) : {};
|
|
43
|
-
}, [autoSize, digitTolerance]);
|
|
44
39
|
var euiTheme = (0, _services.useEuiTheme)();
|
|
45
40
|
var styles = (0, _range_input.euiRangeInputStyles)(euiTheme);
|
|
46
41
|
var cssStyles = [styles.euiRangeInput];
|
|
42
|
+
|
|
43
|
+
// Determine whether an invalid icon is showing, which can come from
|
|
44
|
+
// the underlying EuiFieldNumber's native :invalid state
|
|
45
|
+
var _useState = (0, _react.useState)(isInvalid),
|
|
46
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
47
|
+
hasInvalidIcon = _useState2[0],
|
|
48
|
+
setHasInvalidIcon = _useState2[1];
|
|
49
|
+
var validityRef = (0, _react.useRef)(null);
|
|
50
|
+
var setRefs = (0, _services.useCombinedRefs)([validityRef, inputRef]);
|
|
51
|
+
(0, _react.useEffect)(function () {
|
|
52
|
+
var _validityRef$current;
|
|
53
|
+
var isNativelyInvalid = !((_validityRef$current = validityRef.current) !== null && _validityRef$current !== void 0 && _validityRef$current.validity.valid);
|
|
54
|
+
setHasInvalidIcon(isNativelyInvalid || isInvalid);
|
|
55
|
+
}, [value, isInvalid]);
|
|
56
|
+
|
|
57
|
+
// Calculate the auto size width of the input
|
|
58
|
+
var widthStyle = (0, _react.useMemo)(function () {
|
|
59
|
+
if (!autoSize) return undefined;
|
|
60
|
+
|
|
61
|
+
// Calculate the number of characters to show (dynamic based on user input)
|
|
62
|
+
// Uses the min/max char length as a max, then add an extra UX buffer of 1
|
|
63
|
+
var maxChars = Math.max(String(min).length, String(max).length) + 1;
|
|
64
|
+
var inputCharWidth = Math.min(String(value).length, maxChars);
|
|
65
|
+
|
|
66
|
+
// Calculate the form padding based on `compressed` state
|
|
67
|
+
var _euiFormVariables = (0, _form.euiFormVariables)(euiTheme),
|
|
68
|
+
controlPadding = _euiFormVariables.controlPadding,
|
|
69
|
+
controlCompressedPadding = _euiFormVariables.controlCompressedPadding;
|
|
70
|
+
var inputPadding = compressed ? controlCompressedPadding : controlPadding;
|
|
71
|
+
|
|
72
|
+
// Calculate the invalid icon (if being displayed), also based on `compressed` state
|
|
73
|
+
var invalidIconWidth = hasInvalidIcon ? euiTheme.euiTheme.base * (compressed ? 1.125 : 1.375) // TODO: DRY this out once EuiFormControlLayoutIcons is converted to Emotion
|
|
74
|
+
: 0;
|
|
75
|
+
|
|
76
|
+
// Guesstimate a width for the stepper. Note that it's a little wider in FF than it is in Chrome
|
|
77
|
+
var stepperWidth = 2;
|
|
78
|
+
return (0, _global_styling.logicalStyles)({
|
|
79
|
+
width: "calc(".concat(inputPadding, " + ").concat(inputCharWidth, "ch + ").concat(stepperWidth, "em + ").concat(invalidIconWidth, "px)")
|
|
80
|
+
});
|
|
81
|
+
}, [autoSize, euiTheme, compressed, hasInvalidIcon, min, max, value]);
|
|
47
82
|
return (0, _react2.jsx)(_field_number.EuiFieldNumber, (0, _extends2.default)({
|
|
48
83
|
name: name,
|
|
49
84
|
className: "euiRangeInput euiRangeInput--".concat(side),
|
|
@@ -52,6 +87,8 @@ var EuiRangeInput = function EuiRangeInput(_ref) {
|
|
|
52
87
|
max: Number(max),
|
|
53
88
|
step: step,
|
|
54
89
|
value: value === '' ? '' : Number(value),
|
|
90
|
+
inputRef: setRefs,
|
|
91
|
+
isInvalid: isInvalid,
|
|
55
92
|
disabled: disabled,
|
|
56
93
|
compressed: compressed,
|
|
57
94
|
onChange: onChange,
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.useEuiValidatableControl = exports.EuiValidatableControl = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
7
9
|
var _react = require("react");
|
|
8
10
|
/*
|
|
9
11
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
@@ -25,11 +27,15 @@ function isMutableRef(ref) {
|
|
|
25
27
|
var EuiValidatableControl = function EuiValidatableControl(_ref) {
|
|
26
28
|
var isInvalid = _ref.isInvalid,
|
|
27
29
|
children = _ref.children;
|
|
28
|
-
|
|
30
|
+
// Note that this must be state and not a ref to cause a rerender/set invalid state on initial mount
|
|
31
|
+
var _useState = (0, _react.useState)(null),
|
|
32
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
33
|
+
control = _useState2[0],
|
|
34
|
+
setControl = _useState2[1];
|
|
29
35
|
var child = _react.Children.only(children);
|
|
30
36
|
var childRef = child.ref;
|
|
31
37
|
var replacedRef = (0, _react.useCallback)(function (element) {
|
|
32
|
-
|
|
38
|
+
setControl(element);
|
|
33
39
|
|
|
34
40
|
// Call the original ref, if any
|
|
35
41
|
if (typeof childRef === 'function') {
|
|
@@ -39,12 +45,12 @@ var EuiValidatableControl = function EuiValidatableControl(_ref) {
|
|
|
39
45
|
}
|
|
40
46
|
}, [childRef]);
|
|
41
47
|
useSetControlValidity({
|
|
42
|
-
controlEl: control
|
|
48
|
+
controlEl: control,
|
|
43
49
|
isInvalid: isInvalid
|
|
44
50
|
});
|
|
45
51
|
return /*#__PURE__*/(0, _react.cloneElement)(child, {
|
|
46
52
|
ref: replacedRef,
|
|
47
|
-
'aria-invalid': isInvalid
|
|
53
|
+
'aria-invalid': isInvalid || child.props['aria-invalid']
|
|
48
54
|
});
|
|
49
55
|
};
|
|
50
56
|
|
|
@@ -476,17 +476,6 @@ Object.keys(_inner_text).forEach(function (key) {
|
|
|
476
476
|
}
|
|
477
477
|
});
|
|
478
478
|
});
|
|
479
|
-
var _inline_edit = require("./inline_edit");
|
|
480
|
-
Object.keys(_inline_edit).forEach(function (key) {
|
|
481
|
-
if (key === "default" || key === "__esModule") return;
|
|
482
|
-
if (key in exports && exports[key] === _inline_edit[key]) return;
|
|
483
|
-
Object.defineProperty(exports, key, {
|
|
484
|
-
enumerable: true,
|
|
485
|
-
get: function get() {
|
|
486
|
-
return _inline_edit[key];
|
|
487
|
-
}
|
|
488
|
-
});
|
|
489
|
-
});
|
|
490
479
|
var _i18n = require("./i18n");
|
|
491
480
|
Object.keys(_i18n).forEach(function (key) {
|
|
492
481
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -59,7 +59,12 @@ var processDateOperation = function processDateOperation(value, operator) {
|
|
|
59
59
|
};
|
|
60
60
|
var _termValuesToQuery = function _termValuesToQuery(values, options) {
|
|
61
61
|
var body = {
|
|
62
|
-
query: values.
|
|
62
|
+
query: values.map(function (value) {
|
|
63
|
+
if ((0, _predicate.isString)(value) && value.match(/\s/)) {
|
|
64
|
+
return "\"".concat(value, "\"");
|
|
65
|
+
}
|
|
66
|
+
return value;
|
|
67
|
+
}).join(' ')
|
|
63
68
|
};
|
|
64
69
|
if (body.query === '') {
|
|
65
70
|
return;
|
|
@@ -140,6 +140,9 @@ var emitTermClause = function emitTermClause(clause, isGroupMember) {
|
|
|
140
140
|
match = undefined;
|
|
141
141
|
}
|
|
142
142
|
var matchOp = emitMatch(match);
|
|
143
|
+
if ((0, _predicate.isString)(value) && value.match(/\s/)) {
|
|
144
|
+
return "".concat(matchOp, "\"").concat(escapeValue(value), "\"");
|
|
145
|
+
}
|
|
143
146
|
return "".concat(matchOp).concat(escapeValue(value));
|
|
144
147
|
};
|
|
145
148
|
var emitIsClause = function emitIsClause(clause, isGroupMember) {
|