@elastic/eui 77.1.1 → 77.2.1
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 +37 -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/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 +54 -54
- package/i18ntokens.json +26 -8
- 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 +40 -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/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 +32 -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/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 +35 -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/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 +35 -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/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/src/themes/amsterdam/overrides/_date_popover_button.scss +0 -14
|
@@ -10,9 +10,9 @@ 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
|
|
13
|
+
var _form = require("../form");
|
|
14
14
|
var _react2 = require("@emotion/react");
|
|
15
|
-
var _excluded = ["children", "className", "startDateControl", "endDateControl", "iconType", "fullWidth", "isCustom", "readOnly", "isInvalid", "disabled", "onFocus", "onBlur"];
|
|
15
|
+
var _excluded = ["children", "className", "startDateControl", "endDateControl", "iconType", "fullWidth", "isCustom", "readOnly", "isInvalid", "disabled", "onFocus", "onBlur", "append", "prepend"];
|
|
16
16
|
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); }
|
|
17
17
|
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
18
|
var EuiDatePickerRange = function EuiDatePickerRange(_ref) {
|
|
@@ -29,6 +29,8 @@ var EuiDatePickerRange = function EuiDatePickerRange(_ref) {
|
|
|
29
29
|
disabled = _ref.disabled,
|
|
30
30
|
_onFocus = _ref.onFocus,
|
|
31
31
|
_onBlur = _ref.onBlur,
|
|
32
|
+
append = _ref.append,
|
|
33
|
+
prepend = _ref.prepend,
|
|
32
34
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
33
35
|
var classes = (0, _classnames.default)('euiDatePickerRange', {
|
|
34
36
|
'euiDatePickerRange--fullWidth': fullWidth,
|
|
@@ -40,8 +42,8 @@ var EuiDatePickerRange = function EuiDatePickerRange(_ref) {
|
|
|
40
42
|
var endControl = endDateControl;
|
|
41
43
|
if (!isCustom) {
|
|
42
44
|
startControl = /*#__PURE__*/(0, _react.cloneElement)(startDateControl, {
|
|
43
|
-
|
|
44
|
-
showIcon:
|
|
45
|
+
controlOnly: true,
|
|
46
|
+
showIcon: false,
|
|
45
47
|
fullWidth: fullWidth,
|
|
46
48
|
readOnly: readOnly,
|
|
47
49
|
disabled: disabled || startDateControl.props.disabled,
|
|
@@ -59,6 +61,7 @@ var EuiDatePickerRange = function EuiDatePickerRange(_ref) {
|
|
|
59
61
|
}
|
|
60
62
|
});
|
|
61
63
|
endControl = /*#__PURE__*/(0, _react.cloneElement)(endDateControl, {
|
|
64
|
+
controlOnly: true,
|
|
62
65
|
showIcon: false,
|
|
63
66
|
fullWidth: fullWidth,
|
|
64
67
|
readOnly: readOnly,
|
|
@@ -78,14 +81,17 @@ var EuiDatePickerRange = function EuiDatePickerRange(_ref) {
|
|
|
78
81
|
}
|
|
79
82
|
});
|
|
80
83
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
return (0, _react2.jsx)(_form.EuiFormControlLayoutDelimited, (0, _extends2.default)({
|
|
85
|
+
icon: iconType === true ? 'calendar' : iconType || undefined,
|
|
86
|
+
className: classes,
|
|
87
|
+
startControl: startControl,
|
|
88
|
+
endControl: endControl,
|
|
89
|
+
fullWidth: fullWidth,
|
|
90
|
+
readOnly: readOnly,
|
|
91
|
+
isDisabled: disabled,
|
|
92
|
+
isInvalid: isInvalid,
|
|
93
|
+
append: append,
|
|
94
|
+
prepend: prepend
|
|
95
|
+
}, rest));
|
|
90
96
|
};
|
|
91
97
|
exports.EuiDatePickerRange = EuiDatePickerRange;
|
|
@@ -200,6 +200,36 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
200
200
|
_this.asyncInterval = new _async_interval.AsyncInterval(handler, refreshInterval);
|
|
201
201
|
}
|
|
202
202
|
});
|
|
203
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderQuickSelect", function () {
|
|
204
|
+
var _this$props2 = _this.props,
|
|
205
|
+
start = _this$props2.start,
|
|
206
|
+
end = _this$props2.end,
|
|
207
|
+
customQuickSelectPanels = _this$props2.customQuickSelectPanels,
|
|
208
|
+
customQuickSelectRender = _this$props2.customQuickSelectRender,
|
|
209
|
+
commonlyUsedRanges = _this$props2.commonlyUsedRanges,
|
|
210
|
+
timeOptions = _this$props2.timeOptions,
|
|
211
|
+
dateFormat = _this$props2.dateFormat,
|
|
212
|
+
onRefreshChange = _this$props2.onRefreshChange,
|
|
213
|
+
recentlyUsedRanges = _this$props2.recentlyUsedRanges,
|
|
214
|
+
refreshInterval = _this$props2.refreshInterval,
|
|
215
|
+
isPaused = _this$props2.isPaused,
|
|
216
|
+
isDisabled = _this$props2.isDisabled;
|
|
217
|
+
return (0, _react2.jsx)(_quick_select_popover.EuiQuickSelectPopover, {
|
|
218
|
+
applyRefreshInterval: onRefreshChange ? _this.onRefreshChange : undefined,
|
|
219
|
+
applyTime: _this.applyQuickTime,
|
|
220
|
+
commonlyUsedRanges: commonlyUsedRanges,
|
|
221
|
+
customQuickSelectPanels: customQuickSelectPanels,
|
|
222
|
+
customQuickSelectRender: customQuickSelectRender,
|
|
223
|
+
dateFormat: dateFormat,
|
|
224
|
+
end: end,
|
|
225
|
+
isDisabled: isDisabled,
|
|
226
|
+
isPaused: isPaused,
|
|
227
|
+
recentlyUsedRanges: recentlyUsedRanges,
|
|
228
|
+
refreshInterval: refreshInterval,
|
|
229
|
+
start: start,
|
|
230
|
+
timeOptions: timeOptions
|
|
231
|
+
});
|
|
232
|
+
});
|
|
203
233
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderDatePickerRange", function () {
|
|
204
234
|
var _this$state = _this.state,
|
|
205
235
|
end = _this$state.end,
|
|
@@ -209,24 +239,47 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
209
239
|
isStartDatePopoverOpen = _this$state.isStartDatePopoverOpen,
|
|
210
240
|
showPrettyDuration = _this$state.showPrettyDuration,
|
|
211
241
|
start = _this$state.start;
|
|
212
|
-
var _this$
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
242
|
+
var _this$props3 = _this.props,
|
|
243
|
+
isQuickSelectOnly = _this$props3.isQuickSelectOnly,
|
|
244
|
+
showUpdateButton = _this$props3.showUpdateButton,
|
|
245
|
+
commonlyUsedRanges = _this$props3.commonlyUsedRanges,
|
|
246
|
+
timeOptions = _this$props3.timeOptions,
|
|
247
|
+
dateFormat = _this$props3.dateFormat,
|
|
248
|
+
refreshInterval = _this$props3.refreshInterval,
|
|
249
|
+
isPaused = _this$props3.isPaused,
|
|
250
|
+
isDisabled = _this$props3.isDisabled,
|
|
251
|
+
isLoading = _this$props3.isLoading,
|
|
252
|
+
locale = _this$props3.locale,
|
|
253
|
+
timeFormat = _this$props3.timeFormat,
|
|
254
|
+
utcOffset = _this$props3.utcOffset,
|
|
255
|
+
compressed = _this$props3.compressed,
|
|
256
|
+
onFocus = _this$props3.onFocus,
|
|
257
|
+
className = _this$props3.className,
|
|
258
|
+
dataTestSubj = _this$props3['data-test-subj'];
|
|
259
|
+
var autoRefreshAppend = !isPaused ? (0, _react2.jsx)(_auto_refresh.EuiAutoRefreshButton, {
|
|
260
|
+
refreshInterval: refreshInterval,
|
|
261
|
+
isDisabled: isDisabled,
|
|
262
|
+
isPaused: isPaused,
|
|
263
|
+
onRefreshChange: _this.onRefreshChange,
|
|
264
|
+
shortHand: true
|
|
265
|
+
}) : undefined;
|
|
266
|
+
var formControlLayoutProps = {
|
|
267
|
+
className: (0, _classnames.default)('euiSuperDatePicker', className),
|
|
268
|
+
compressed: compressed,
|
|
269
|
+
isInvalid: isInvalid,
|
|
270
|
+
isLoading: isLoading && !showUpdateButton,
|
|
271
|
+
disabled: isDisabled,
|
|
272
|
+
prepend: _this.renderQuickSelect(),
|
|
273
|
+
append: autoRefreshAppend,
|
|
274
|
+
'data-test-subj': dataTestSubj
|
|
275
|
+
};
|
|
276
|
+
if (isQuickSelectOnly) {
|
|
277
|
+
return (0, _react2.jsx)(_form.EuiFormControlLayout, (0, _extends2.default)({
|
|
278
|
+
iconsPosition: "static"
|
|
279
|
+
}, formControlLayoutProps));
|
|
280
|
+
}
|
|
222
281
|
if (showPrettyDuration && !isStartDatePopoverOpen && !isEndDatePopoverOpen) {
|
|
223
|
-
return (0, _react2.jsx)(
|
|
224
|
-
className: "euiDatePickerRange--inGroup",
|
|
225
|
-
iconType: false,
|
|
226
|
-
isCustom: true,
|
|
227
|
-
startDateControl: (0, _react2.jsx)("div", null),
|
|
228
|
-
endDateControl: (0, _react2.jsx)("div", null)
|
|
229
|
-
}, (0, _react2.jsx)("button", {
|
|
282
|
+
return (0, _react2.jsx)(_form.EuiFormControlLayout, formControlLayoutProps, (0, _react2.jsx)("button", {
|
|
230
283
|
className: (0, _classnames.default)('euiSuperDatePicker__prettyFormat', {
|
|
231
284
|
'euiSuperDatePicker__prettyFormat--disabled': isDisabled
|
|
232
285
|
}),
|
|
@@ -243,12 +296,12 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
243
296
|
}
|
|
244
297
|
return (0, _react2.jsx)(_context.EuiI18nConsumer, null, function (_ref4) {
|
|
245
298
|
var contextLocale = _ref4.locale;
|
|
246
|
-
return (0, _react2.jsx)(_date_picker_range.EuiDatePickerRange, {
|
|
247
|
-
className:
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
disabled: isDisabled,
|
|
299
|
+
return (0, _react2.jsx)(_date_picker_range.EuiDatePickerRange, (0, _extends2.default)({}, formControlLayoutProps, {
|
|
300
|
+
className: (0, _classnames.default)(formControlLayoutProps.className, {
|
|
301
|
+
'euiSuperDatePicker--needsUpdating': hasChanged && !isDisabled && !isInvalid
|
|
302
|
+
}),
|
|
251
303
|
isCustom: true,
|
|
304
|
+
iconType: false,
|
|
252
305
|
startDateControl: (0, _react2.jsx)(_date_popover_button.EuiDatePopoverButton, {
|
|
253
306
|
className: "euiSuperDatePicker__startPopoverButton",
|
|
254
307
|
compressed: compressed,
|
|
@@ -291,15 +344,15 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
291
344
|
onFocus: onFocus
|
|
292
345
|
}
|
|
293
346
|
})
|
|
294
|
-
});
|
|
347
|
+
}));
|
|
295
348
|
});
|
|
296
349
|
});
|
|
297
350
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleClickUpdateButton", function () {
|
|
298
351
|
if (!_this.state.hasChanged && _this.props.onRefresh) {
|
|
299
|
-
var _this$
|
|
300
|
-
start = _this$
|
|
301
|
-
end = _this$
|
|
302
|
-
refreshInterval = _this$
|
|
352
|
+
var _this$props4 = _this.props,
|
|
353
|
+
start = _this$props4.start,
|
|
354
|
+
end = _this$props4.end,
|
|
355
|
+
refreshInterval = _this$props4.refreshInterval;
|
|
303
356
|
_this.props.onRefresh({
|
|
304
357
|
start: start,
|
|
305
358
|
end: end,
|
|
@@ -310,12 +363,12 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
310
363
|
}
|
|
311
364
|
});
|
|
312
365
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderUpdateButton", function () {
|
|
313
|
-
var _this$
|
|
314
|
-
isLoading = _this$
|
|
315
|
-
isDisabled = _this$
|
|
316
|
-
updateButtonProps = _this$
|
|
317
|
-
showUpdateButton = _this$
|
|
318
|
-
compressed = _this$
|
|
366
|
+
var _this$props5 = _this.props,
|
|
367
|
+
isLoading = _this$props5.isLoading,
|
|
368
|
+
isDisabled = _this$props5.isDisabled,
|
|
369
|
+
updateButtonProps = _this$props5.updateButtonProps,
|
|
370
|
+
showUpdateButton = _this$props5.showUpdateButton,
|
|
371
|
+
compressed = _this$props5.compressed;
|
|
319
372
|
if (!showUpdateButton) return null;
|
|
320
373
|
return (0, _react2.jsx)(_flex.EuiFlexItem, {
|
|
321
374
|
grow: false
|
|
@@ -335,52 +388,21 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
335
388
|
(0, _createClass2.default)(EuiSuperDatePickerInternal, [{
|
|
336
389
|
key: "render",
|
|
337
390
|
value: function render() {
|
|
338
|
-
var _this$
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
refreshInterval = _this$props5.refreshInterval,
|
|
351
|
-
showUpdateButton = _this$props5.showUpdateButton,
|
|
352
|
-
start = _this$props5.start,
|
|
353
|
-
dataTestSubj = _this$props5['data-test-subj'],
|
|
354
|
-
_width = _this$props5.width,
|
|
355
|
-
isQuickSelectOnly = _this$props5.isQuickSelectOnly,
|
|
356
|
-
compressed = _this$props5.compressed,
|
|
357
|
-
className = _this$props5.className;
|
|
391
|
+
var _this$props6 = this.props,
|
|
392
|
+
isAutoRefreshOnly = _this$props6.isAutoRefreshOnly,
|
|
393
|
+
isDisabled = _this$props6.isDisabled,
|
|
394
|
+
isPaused = _this$props6.isPaused,
|
|
395
|
+
onRefreshChange = _this$props6.onRefreshChange,
|
|
396
|
+
refreshInterval = _this$props6.refreshInterval,
|
|
397
|
+
showUpdateButton = _this$props6.showUpdateButton,
|
|
398
|
+
dataTestSubj = _this$props6['data-test-subj'],
|
|
399
|
+
_width = _this$props6.width,
|
|
400
|
+
isQuickSelectOnly = _this$props6.isQuickSelectOnly,
|
|
401
|
+
compressed = _this$props6.compressed,
|
|
402
|
+
className = _this$props6.className;
|
|
358
403
|
|
|
359
404
|
// Force reduction in width if showing quick select only
|
|
360
405
|
var width = isQuickSelectOnly ? 'auto' : _width;
|
|
361
|
-
var autoRefreshAppend = !isPaused ? (0, _react2.jsx)(_auto_refresh.EuiAutoRefreshButton, {
|
|
362
|
-
className: "euiFormControlLayout__append",
|
|
363
|
-
refreshInterval: refreshInterval,
|
|
364
|
-
isDisabled: isDisabled,
|
|
365
|
-
isPaused: isPaused,
|
|
366
|
-
onRefreshChange: this.onRefreshChange,
|
|
367
|
-
shortHand: true
|
|
368
|
-
}) : undefined;
|
|
369
|
-
var quickSelect = (0, _react2.jsx)(_quick_select_popover.EuiQuickSelectPopover, {
|
|
370
|
-
applyRefreshInterval: onRefreshChange ? this.onRefreshChange : undefined,
|
|
371
|
-
applyTime: this.applyQuickTime,
|
|
372
|
-
commonlyUsedRanges: commonlyUsedRanges,
|
|
373
|
-
customQuickSelectPanels: customQuickSelectPanels,
|
|
374
|
-
customQuickSelectRender: customQuickSelectRender,
|
|
375
|
-
dateFormat: dateFormat,
|
|
376
|
-
end: end,
|
|
377
|
-
isDisabled: isDisabled,
|
|
378
|
-
isPaused: isPaused,
|
|
379
|
-
recentlyUsedRanges: recentlyUsedRanges,
|
|
380
|
-
refreshInterval: refreshInterval,
|
|
381
|
-
start: start,
|
|
382
|
-
timeOptions: timeOptions
|
|
383
|
-
});
|
|
384
406
|
var flexWrapperClasses = (0, _classnames.default)('euiSuperDatePicker__flexWrapper', {
|
|
385
407
|
'euiSuperDatePicker__flexWrapper--noUpdateButton': !showUpdateButton,
|
|
386
408
|
'euiSuperDatePicker__flexWrapper--isAutoRefreshOnly': isAutoRefreshOnly,
|
|
@@ -401,14 +423,7 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
401
423
|
isDisabled: isDisabled,
|
|
402
424
|
"data-test-subj": dataTestSubj,
|
|
403
425
|
className: className
|
|
404
|
-
})) : (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(_flex.EuiFlexItem, null, (
|
|
405
|
-
className: (0, _classnames.default)('euiSuperDatePicker', className),
|
|
406
|
-
compressed: compressed,
|
|
407
|
-
isDisabled: isDisabled,
|
|
408
|
-
prepend: quickSelect,
|
|
409
|
-
append: autoRefreshAppend,
|
|
410
|
-
"data-test-subj": dataTestSubj
|
|
411
|
-
}, !isQuickSelectOnly && this.renderDatePickerRange())), this.renderUpdateButton()));
|
|
426
|
+
})) : (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(_flex.EuiFlexItem, null, this.renderDatePickerRange()), this.renderUpdateButton()));
|
|
412
427
|
}
|
|
413
428
|
}], [{
|
|
414
429
|
key: "getDerivedStateFromProps",
|
|
@@ -1,20 +1,24 @@
|
|
|
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 _form_control_layout = require("../form_control_layout");
|
|
13
14
|
var _validatable_control = require("../validatable_control");
|
|
14
|
-
var
|
|
15
|
+
var _form_control_layout = require("../form_control_layout");
|
|
15
16
|
var _num_icons = require("../form_control_layout/_num_icons");
|
|
17
|
+
var _eui_form_context = require("../eui_form_context");
|
|
16
18
|
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"];
|
|
19
|
+
var _excluded = ["className", "icon", "id", "placeholder", "name", "min", "max", "value", "isInvalid", "fullWidth", "isLoading", "compressed", "prepend", "append", "inputRef", "readOnly", "controlOnly", "onKeyUp"];
|
|
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); }
|
|
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; }
|
|
18
22
|
var EuiFieldNumber = function EuiFieldNumber(props) {
|
|
19
23
|
var _useFormContext = (0, _eui_form_context.useFormContext)(),
|
|
20
24
|
defaultFullWidth = _useFormContext.defaultFullWidth;
|
|
@@ -38,9 +42,30 @@ var EuiFieldNumber = function EuiFieldNumber(props) {
|
|
|
38
42
|
inputRef = props.inputRef,
|
|
39
43
|
readOnly = props.readOnly,
|
|
40
44
|
controlOnly = props.controlOnly,
|
|
45
|
+
_onKeyUp = props.onKeyUp,
|
|
41
46
|
rest = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
|
|
48
|
+
// Attempt to determine additional invalid state. The native number input
|
|
49
|
+
// will set :invalid state automatically, but we need to also set
|
|
50
|
+
// `aria-invalid` as well as display an icon. We also want to *not* set this on
|
|
51
|
+
// EuiValidatableControl, in order to not override custom validity messages
|
|
52
|
+
var _useState = (0, _react.useState)(),
|
|
53
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
54
|
+
isNativelyInvalid = _useState2[0],
|
|
55
|
+
setIsNativelyInvalid = _useState2[1];
|
|
56
|
+
|
|
57
|
+
// Note that we can't use hook into `onChange` because browsers don't emit change events
|
|
58
|
+
// for invalid values - see https://github.com/facebook/react/issues/16554
|
|
59
|
+
var onKeyUp = (0, _react.useCallback)(function (e) {
|
|
60
|
+
_onKeyUp === null || _onKeyUp === void 0 ? void 0 : _onKeyUp(e);
|
|
61
|
+
var _ref = e.target,
|
|
62
|
+
validity = _ref.validity;
|
|
63
|
+
// Prefer `undefined` over `false` so that the `aria-invalid` prop unsets completely
|
|
64
|
+
var isInvalid = !validity.valid || undefined;
|
|
65
|
+
setIsNativelyInvalid(isInvalid);
|
|
66
|
+
}, [_onKeyUp]);
|
|
67
|
+
var numIconsClass = controlOnly ? false : (0, _num_icons.getFormControlClassNameForIconCount)({
|
|
68
|
+
isInvalid: isInvalid || isNativelyInvalid,
|
|
44
69
|
isLoading: isLoading
|
|
45
70
|
});
|
|
46
71
|
var classes = (0, _classnames.default)('euiFieldNumber', className, numIconsClass, {
|
|
@@ -62,7 +87,9 @@ var EuiFieldNumber = function EuiFieldNumber(props) {
|
|
|
62
87
|
placeholder: placeholder,
|
|
63
88
|
readOnly: readOnly,
|
|
64
89
|
className: classes,
|
|
65
|
-
ref: inputRef
|
|
90
|
+
ref: inputRef,
|
|
91
|
+
onKeyUp: onKeyUp,
|
|
92
|
+
"aria-invalid": isInvalid == null ? isNativelyInvalid : isInvalid
|
|
66
93
|
}, rest)));
|
|
67
94
|
if (controlOnly) {
|
|
68
95
|
return control;
|
|
@@ -71,7 +98,7 @@ var EuiFieldNumber = function EuiFieldNumber(props) {
|
|
|
71
98
|
icon: icon,
|
|
72
99
|
fullWidth: fullWidth,
|
|
73
100
|
isLoading: isLoading,
|
|
74
|
-
isInvalid: isInvalid,
|
|
101
|
+
isInvalid: isInvalid || isNativelyInvalid,
|
|
75
102
|
compressed: compressed,
|
|
76
103
|
readOnly: readOnly,
|
|
77
104
|
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
|
+
};
|