@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
|
@@ -201,6 +201,36 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
201
201
|
_this.asyncInterval = new _async_interval.AsyncInterval(handler, refreshInterval);
|
|
202
202
|
}
|
|
203
203
|
});
|
|
204
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderQuickSelect", function () {
|
|
205
|
+
var _this$props2 = _this.props,
|
|
206
|
+
start = _this$props2.start,
|
|
207
|
+
end = _this$props2.end,
|
|
208
|
+
customQuickSelectPanels = _this$props2.customQuickSelectPanels,
|
|
209
|
+
customQuickSelectRender = _this$props2.customQuickSelectRender,
|
|
210
|
+
commonlyUsedRanges = _this$props2.commonlyUsedRanges,
|
|
211
|
+
timeOptions = _this$props2.timeOptions,
|
|
212
|
+
dateFormat = _this$props2.dateFormat,
|
|
213
|
+
onRefreshChange = _this$props2.onRefreshChange,
|
|
214
|
+
recentlyUsedRanges = _this$props2.recentlyUsedRanges,
|
|
215
|
+
refreshInterval = _this$props2.refreshInterval,
|
|
216
|
+
isPaused = _this$props2.isPaused,
|
|
217
|
+
isDisabled = _this$props2.isDisabled;
|
|
218
|
+
return (0, _react2.jsx)(_quick_select_popover.EuiQuickSelectPopover, {
|
|
219
|
+
applyRefreshInterval: onRefreshChange ? _this.onRefreshChange : undefined,
|
|
220
|
+
applyTime: _this.applyQuickTime,
|
|
221
|
+
commonlyUsedRanges: commonlyUsedRanges,
|
|
222
|
+
customQuickSelectPanels: customQuickSelectPanels,
|
|
223
|
+
customQuickSelectRender: customQuickSelectRender,
|
|
224
|
+
dateFormat: dateFormat,
|
|
225
|
+
end: end,
|
|
226
|
+
isDisabled: isDisabled,
|
|
227
|
+
isPaused: isPaused,
|
|
228
|
+
recentlyUsedRanges: recentlyUsedRanges,
|
|
229
|
+
refreshInterval: refreshInterval,
|
|
230
|
+
start: start,
|
|
231
|
+
timeOptions: timeOptions
|
|
232
|
+
});
|
|
233
|
+
});
|
|
204
234
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderDatePickerRange", function () {
|
|
205
235
|
var _this$state = _this.state,
|
|
206
236
|
end = _this$state.end,
|
|
@@ -210,24 +240,47 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
210
240
|
isStartDatePopoverOpen = _this$state.isStartDatePopoverOpen,
|
|
211
241
|
showPrettyDuration = _this$state.showPrettyDuration,
|
|
212
242
|
start = _this$state.start;
|
|
213
|
-
var _this$
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
243
|
+
var _this$props3 = _this.props,
|
|
244
|
+
isQuickSelectOnly = _this$props3.isQuickSelectOnly,
|
|
245
|
+
showUpdateButton = _this$props3.showUpdateButton,
|
|
246
|
+
commonlyUsedRanges = _this$props3.commonlyUsedRanges,
|
|
247
|
+
timeOptions = _this$props3.timeOptions,
|
|
248
|
+
dateFormat = _this$props3.dateFormat,
|
|
249
|
+
refreshInterval = _this$props3.refreshInterval,
|
|
250
|
+
isPaused = _this$props3.isPaused,
|
|
251
|
+
isDisabled = _this$props3.isDisabled,
|
|
252
|
+
isLoading = _this$props3.isLoading,
|
|
253
|
+
locale = _this$props3.locale,
|
|
254
|
+
timeFormat = _this$props3.timeFormat,
|
|
255
|
+
utcOffset = _this$props3.utcOffset,
|
|
256
|
+
compressed = _this$props3.compressed,
|
|
257
|
+
onFocus = _this$props3.onFocus,
|
|
258
|
+
className = _this$props3.className,
|
|
259
|
+
dataTestSubj = _this$props3['data-test-subj'];
|
|
260
|
+
var autoRefreshAppend = !isPaused ? (0, _react2.jsx)(_auto_refresh.EuiAutoRefreshButton, {
|
|
261
|
+
refreshInterval: refreshInterval,
|
|
262
|
+
isDisabled: isDisabled,
|
|
263
|
+
isPaused: isPaused,
|
|
264
|
+
onRefreshChange: _this.onRefreshChange,
|
|
265
|
+
shortHand: true
|
|
266
|
+
}) : undefined;
|
|
267
|
+
var formControlLayoutProps = {
|
|
268
|
+
className: (0, _classnames.default)('euiSuperDatePicker', className),
|
|
269
|
+
compressed: compressed,
|
|
270
|
+
isInvalid: isInvalid,
|
|
271
|
+
isLoading: isLoading && !showUpdateButton,
|
|
272
|
+
disabled: isDisabled,
|
|
273
|
+
prepend: _this.renderQuickSelect(),
|
|
274
|
+
append: autoRefreshAppend,
|
|
275
|
+
'data-test-subj': dataTestSubj
|
|
276
|
+
};
|
|
277
|
+
if (isQuickSelectOnly) {
|
|
278
|
+
return (0, _react2.jsx)(_form.EuiFormControlLayout, (0, _extends2.default)({
|
|
279
|
+
iconsPosition: "static"
|
|
280
|
+
}, formControlLayoutProps));
|
|
281
|
+
}
|
|
223
282
|
if (showPrettyDuration && !isStartDatePopoverOpen && !isEndDatePopoverOpen) {
|
|
224
|
-
return (0, _react2.jsx)(
|
|
225
|
-
className: "euiDatePickerRange--inGroup",
|
|
226
|
-
iconType: false,
|
|
227
|
-
isCustom: true,
|
|
228
|
-
startDateControl: (0, _react2.jsx)("div", null),
|
|
229
|
-
endDateControl: (0, _react2.jsx)("div", null)
|
|
230
|
-
}, (0, _react2.jsx)("button", {
|
|
283
|
+
return (0, _react2.jsx)(_form.EuiFormControlLayout, formControlLayoutProps, (0, _react2.jsx)("button", {
|
|
231
284
|
className: (0, _classnames.default)('euiSuperDatePicker__prettyFormat', {
|
|
232
285
|
'euiSuperDatePicker__prettyFormat--disabled': isDisabled
|
|
233
286
|
}),
|
|
@@ -244,12 +297,12 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
244
297
|
}
|
|
245
298
|
return (0, _react2.jsx)(_context.EuiI18nConsumer, null, function (_ref4) {
|
|
246
299
|
var contextLocale = _ref4.locale;
|
|
247
|
-
return (0, _react2.jsx)(_date_picker_range.EuiDatePickerRange, {
|
|
248
|
-
className:
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
disabled: isDisabled,
|
|
300
|
+
return (0, _react2.jsx)(_date_picker_range.EuiDatePickerRange, (0, _extends2.default)({}, formControlLayoutProps, {
|
|
301
|
+
className: (0, _classnames.default)(formControlLayoutProps.className, {
|
|
302
|
+
'euiSuperDatePicker--needsUpdating': hasChanged && !isDisabled && !isInvalid
|
|
303
|
+
}),
|
|
252
304
|
isCustom: true,
|
|
305
|
+
iconType: false,
|
|
253
306
|
startDateControl: (0, _react2.jsx)(_date_popover_button.EuiDatePopoverButton, {
|
|
254
307
|
className: "euiSuperDatePicker__startPopoverButton",
|
|
255
308
|
compressed: compressed,
|
|
@@ -292,15 +345,15 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
292
345
|
onFocus: onFocus
|
|
293
346
|
}
|
|
294
347
|
})
|
|
295
|
-
});
|
|
348
|
+
}));
|
|
296
349
|
});
|
|
297
350
|
});
|
|
298
351
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleClickUpdateButton", function () {
|
|
299
352
|
if (!_this.state.hasChanged && _this.props.onRefresh) {
|
|
300
|
-
var _this$
|
|
301
|
-
start = _this$
|
|
302
|
-
end = _this$
|
|
303
|
-
refreshInterval = _this$
|
|
353
|
+
var _this$props4 = _this.props,
|
|
354
|
+
start = _this$props4.start,
|
|
355
|
+
end = _this$props4.end,
|
|
356
|
+
refreshInterval = _this$props4.refreshInterval;
|
|
304
357
|
_this.props.onRefresh({
|
|
305
358
|
start: start,
|
|
306
359
|
end: end,
|
|
@@ -311,12 +364,12 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
311
364
|
}
|
|
312
365
|
});
|
|
313
366
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderUpdateButton", function () {
|
|
314
|
-
var _this$
|
|
315
|
-
isLoading = _this$
|
|
316
|
-
isDisabled = _this$
|
|
317
|
-
updateButtonProps = _this$
|
|
318
|
-
showUpdateButton = _this$
|
|
319
|
-
compressed = _this$
|
|
367
|
+
var _this$props5 = _this.props,
|
|
368
|
+
isLoading = _this$props5.isLoading,
|
|
369
|
+
isDisabled = _this$props5.isDisabled,
|
|
370
|
+
updateButtonProps = _this$props5.updateButtonProps,
|
|
371
|
+
showUpdateButton = _this$props5.showUpdateButton,
|
|
372
|
+
compressed = _this$props5.compressed;
|
|
320
373
|
if (!showUpdateButton) return null;
|
|
321
374
|
return (0, _react2.jsx)(_flex.EuiFlexItem, {
|
|
322
375
|
grow: false
|
|
@@ -336,52 +389,21 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
336
389
|
(0, _createClass2.default)(EuiSuperDatePickerInternal, [{
|
|
337
390
|
key: "render",
|
|
338
391
|
value: function render() {
|
|
339
|
-
var _this$
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
refreshInterval = _this$props5.refreshInterval,
|
|
352
|
-
showUpdateButton = _this$props5.showUpdateButton,
|
|
353
|
-
start = _this$props5.start,
|
|
354
|
-
dataTestSubj = _this$props5['data-test-subj'],
|
|
355
|
-
_width = _this$props5.width,
|
|
356
|
-
isQuickSelectOnly = _this$props5.isQuickSelectOnly,
|
|
357
|
-
compressed = _this$props5.compressed,
|
|
358
|
-
className = _this$props5.className;
|
|
392
|
+
var _this$props6 = this.props,
|
|
393
|
+
isAutoRefreshOnly = _this$props6.isAutoRefreshOnly,
|
|
394
|
+
isDisabled = _this$props6.isDisabled,
|
|
395
|
+
isPaused = _this$props6.isPaused,
|
|
396
|
+
onRefreshChange = _this$props6.onRefreshChange,
|
|
397
|
+
refreshInterval = _this$props6.refreshInterval,
|
|
398
|
+
showUpdateButton = _this$props6.showUpdateButton,
|
|
399
|
+
dataTestSubj = _this$props6['data-test-subj'],
|
|
400
|
+
_width = _this$props6.width,
|
|
401
|
+
isQuickSelectOnly = _this$props6.isQuickSelectOnly,
|
|
402
|
+
compressed = _this$props6.compressed,
|
|
403
|
+
className = _this$props6.className;
|
|
359
404
|
|
|
360
405
|
// Force reduction in width if showing quick select only
|
|
361
406
|
var width = isQuickSelectOnly ? 'auto' : _width;
|
|
362
|
-
var autoRefreshAppend = !isPaused ? (0, _react2.jsx)(_auto_refresh.EuiAutoRefreshButton, {
|
|
363
|
-
className: "euiFormControlLayout__append",
|
|
364
|
-
refreshInterval: refreshInterval,
|
|
365
|
-
isDisabled: isDisabled,
|
|
366
|
-
isPaused: isPaused,
|
|
367
|
-
onRefreshChange: this.onRefreshChange,
|
|
368
|
-
shortHand: true
|
|
369
|
-
}) : undefined;
|
|
370
|
-
var quickSelect = (0, _react2.jsx)(_quick_select_popover.EuiQuickSelectPopover, {
|
|
371
|
-
applyRefreshInterval: onRefreshChange ? this.onRefreshChange : undefined,
|
|
372
|
-
applyTime: this.applyQuickTime,
|
|
373
|
-
commonlyUsedRanges: commonlyUsedRanges,
|
|
374
|
-
customQuickSelectPanels: customQuickSelectPanels,
|
|
375
|
-
customQuickSelectRender: customQuickSelectRender,
|
|
376
|
-
dateFormat: dateFormat,
|
|
377
|
-
end: end,
|
|
378
|
-
isDisabled: isDisabled,
|
|
379
|
-
isPaused: isPaused,
|
|
380
|
-
recentlyUsedRanges: recentlyUsedRanges,
|
|
381
|
-
refreshInterval: refreshInterval,
|
|
382
|
-
start: start,
|
|
383
|
-
timeOptions: timeOptions
|
|
384
|
-
});
|
|
385
407
|
var flexWrapperClasses = (0, _classnames.default)('euiSuperDatePicker__flexWrapper', {
|
|
386
408
|
'euiSuperDatePicker__flexWrapper--noUpdateButton': !showUpdateButton,
|
|
387
409
|
'euiSuperDatePicker__flexWrapper--isAutoRefreshOnly': isAutoRefreshOnly,
|
|
@@ -402,14 +424,7 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
402
424
|
isDisabled: isDisabled,
|
|
403
425
|
"data-test-subj": dataTestSubj,
|
|
404
426
|
className: className
|
|
405
|
-
})) : (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(_flex.EuiFlexItem, null, (
|
|
406
|
-
className: (0, _classnames.default)('euiSuperDatePicker', className),
|
|
407
|
-
compressed: compressed,
|
|
408
|
-
isDisabled: isDisabled,
|
|
409
|
-
prepend: quickSelect,
|
|
410
|
-
append: autoRefreshAppend,
|
|
411
|
-
"data-test-subj": dataTestSubj
|
|
412
|
-
}, !isQuickSelectOnly && this.renderDatePickerRange())), this.renderUpdateButton()));
|
|
427
|
+
})) : (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(_flex.EuiFlexItem, null, this.renderDatePickerRange()), this.renderUpdateButton()));
|
|
413
428
|
}
|
|
414
429
|
}], [{
|
|
415
430
|
key: "getDerivedStateFromProps",
|
|
@@ -1,21 +1,26 @@
|
|
|
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 _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
-
var
|
|
15
|
+
var _services = require("../../../services");
|
|
14
16
|
var _validatable_control = require("../validatable_control");
|
|
15
|
-
var
|
|
17
|
+
var _form_control_layout = require("../form_control_layout");
|
|
16
18
|
var _num_icons = require("../form_control_layout/_num_icons");
|
|
19
|
+
var _eui_form_context = require("../eui_form_context");
|
|
17
20
|
var _react2 = require("@emotion/react");
|
|
18
|
-
var _excluded = ["className", "icon", "id", "placeholder", "name", "min", "max", "value", "isInvalid", "fullWidth", "isLoading", "compressed", "prepend", "append", "inputRef", "readOnly", "controlOnly"];
|
|
21
|
+
var _excluded = ["className", "icon", "id", "placeholder", "name", "min", "max", "value", "isInvalid", "fullWidth", "isLoading", "compressed", "prepend", "append", "inputRef", "readOnly", "controlOnly", "onKeyDown"];
|
|
22
|
+
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); }
|
|
23
|
+
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; }
|
|
19
24
|
var EuiFieldNumber = function EuiFieldNumber(props) {
|
|
20
25
|
var _useFormContext = (0, _eui_form_context.useFormContext)(),
|
|
21
26
|
defaultFullWidth = _useFormContext.defaultFullWidth;
|
|
@@ -39,9 +44,31 @@ var EuiFieldNumber = function EuiFieldNumber(props) {
|
|
|
39
44
|
inputRef = props.inputRef,
|
|
40
45
|
readOnly = props.readOnly,
|
|
41
46
|
controlOnly = props.controlOnly,
|
|
47
|
+
_onKeyDown = props.onKeyDown,
|
|
42
48
|
rest = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
43
|
-
|
|
44
|
-
|
|
49
|
+
|
|
50
|
+
// Attempt to determine additional invalid state. The native number input
|
|
51
|
+
// will set :invalid state automatically, but we need to also set
|
|
52
|
+
// `aria-invalid` as well as display an icon. We also want to *not* set this on
|
|
53
|
+
// EuiValidatableControl, in order to not override custom validity messages
|
|
54
|
+
var _useState = (0, _react.useState)(false),
|
|
55
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
56
|
+
isNativelyInvalid = _useState2[0],
|
|
57
|
+
setIsNativelyInvalid = _useState2[1];
|
|
58
|
+
var validityRef = (0, _react.useRef)(null);
|
|
59
|
+
var setRefs = (0, _services.useCombinedRefs)([validityRef, inputRef]);
|
|
60
|
+
|
|
61
|
+
// Note that we can't use hook into `onChange` because browsers don't emit change events
|
|
62
|
+
// for invalid values - see https://github.com/facebook/react/issues/16554
|
|
63
|
+
var onKeyDown = (0, _react.useCallback)(function (e) {
|
|
64
|
+
_onKeyDown === null || _onKeyDown === void 0 ? void 0 : _onKeyDown(e);
|
|
65
|
+
// Wait a beat before checking validity - we can't use `e.target` as it's stale
|
|
66
|
+
requestAnimationFrame(function () {
|
|
67
|
+
setIsNativelyInvalid(!validityRef.current.validity.valid);
|
|
68
|
+
});
|
|
69
|
+
}, [_onKeyDown]);
|
|
70
|
+
var numIconsClass = controlOnly ? false : (0, _num_icons.getFormControlClassNameForIconCount)({
|
|
71
|
+
isInvalid: isInvalid || isNativelyInvalid,
|
|
45
72
|
isLoading: isLoading
|
|
46
73
|
});
|
|
47
74
|
var classes = (0, _classnames.default)('euiFieldNumber', className, numIconsClass, {
|
|
@@ -63,7 +90,9 @@ var EuiFieldNumber = function EuiFieldNumber(props) {
|
|
|
63
90
|
placeholder: placeholder,
|
|
64
91
|
readOnly: readOnly,
|
|
65
92
|
className: classes,
|
|
66
|
-
ref:
|
|
93
|
+
ref: setRefs,
|
|
94
|
+
onKeyDown: onKeyDown,
|
|
95
|
+
"aria-invalid": isInvalid || isNativelyInvalid
|
|
67
96
|
}, rest)));
|
|
68
97
|
if (controlOnly) {
|
|
69
98
|
return control;
|
|
@@ -72,7 +101,7 @@ var EuiFieldNumber = function EuiFieldNumber(props) {
|
|
|
72
101
|
icon: icon,
|
|
73
102
|
fullWidth: fullWidth,
|
|
74
103
|
isLoading: isLoading,
|
|
75
|
-
isInvalid: isInvalid,
|
|
104
|
+
isInvalid: isInvalid || isNativelyInvalid,
|
|
76
105
|
compressed: compressed,
|
|
77
106
|
readOnly: readOnly,
|
|
78
107
|
prepend: prepend,
|
|
@@ -36,7 +36,7 @@ var EuiFieldText = function EuiFieldText(props) {
|
|
|
36
36
|
readOnly = props.readOnly,
|
|
37
37
|
controlOnly = props.controlOnly,
|
|
38
38
|
rest = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
39
|
-
var numIconsClass = (0, _num_icons.getFormControlClassNameForIconCount)({
|
|
39
|
+
var numIconsClass = controlOnly ? false : (0, _num_icons.getFormControlClassNameForIconCount)({
|
|
40
40
|
isInvalid: isInvalid,
|
|
41
41
|
isLoading: isLoading
|
|
42
42
|
});
|
|
@@ -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"));
|
|
@@ -27,7 +22,7 @@ var _form_control_layout_icons = require("./form_control_layout_icons");
|
|
|
27
22
|
var _form_label = require("../form_label");
|
|
28
23
|
var _eui_form_context = require("../eui_form_context");
|
|
29
24
|
var _react2 = require("@emotion/react");
|
|
30
|
-
var _excluded = ["children", "icon", "clear", "fullWidth", "isLoading", "isDisabled", "compressed", "className", "prepend", "append", "readOnly", "isInvalid", "isDropdown", "inputId"];
|
|
25
|
+
var _excluded = ["children", "icon", "iconsPosition", "clear", "fullWidth", "isLoading", "isDisabled", "compressed", "className", "prepend", "append", "readOnly", "isInvalid", "isDropdown", "inputId"];
|
|
31
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); }
|
|
32
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; }
|
|
33
28
|
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); }; }
|
|
@@ -36,31 +31,75 @@ var EuiFormControlLayout = /*#__PURE__*/function (_Component) {
|
|
|
36
31
|
(0, _inherits2.default)(EuiFormControlLayout, _Component);
|
|
37
32
|
var _super = _createSuper(EuiFormControlLayout);
|
|
38
33
|
function EuiFormControlLayout() {
|
|
34
|
+
var _this;
|
|
39
35
|
(0, _classCallCheck2.default)(this, EuiFormControlLayout);
|
|
40
|
-
|
|
36
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
37
|
+
args[_key] = arguments[_key];
|
|
38
|
+
}
|
|
39
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
40
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderLeftIcons", function () {
|
|
41
|
+
var _this$props = _this.props,
|
|
42
|
+
icon = _this$props.icon,
|
|
43
|
+
iconsPosition = _this$props.iconsPosition,
|
|
44
|
+
compressed = _this$props.compressed;
|
|
45
|
+
var leftCustomIcon = icon && (icon === null || icon === void 0 ? void 0 : icon.side) !== 'right' ? icon : undefined;
|
|
46
|
+
return leftCustomIcon ? (0, _react2.jsx)(_form_control_layout_icons.EuiFormControlLayoutIcons, {
|
|
47
|
+
side: "left",
|
|
48
|
+
icon: leftCustomIcon,
|
|
49
|
+
iconsPosition: iconsPosition,
|
|
50
|
+
compressed: compressed
|
|
51
|
+
}) : null;
|
|
52
|
+
});
|
|
53
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderRightIcons", function () {
|
|
54
|
+
var _this$props2 = _this.props,
|
|
55
|
+
icon = _this$props2.icon,
|
|
56
|
+
iconsPosition = _this$props2.iconsPosition,
|
|
57
|
+
clear = _this$props2.clear,
|
|
58
|
+
compressed = _this$props2.compressed,
|
|
59
|
+
isLoading = _this$props2.isLoading,
|
|
60
|
+
isInvalid = _this$props2.isInvalid,
|
|
61
|
+
isDisabled = _this$props2.isDisabled,
|
|
62
|
+
readOnly = _this$props2.readOnly,
|
|
63
|
+
isDropdown = _this$props2.isDropdown;
|
|
64
|
+
var hasDropdownIcon = !readOnly && !isDisabled && isDropdown;
|
|
65
|
+
var rightCustomIcon = icon && (icon === null || icon === void 0 ? void 0 : icon.side) === 'right' ? icon : undefined;
|
|
66
|
+
var hasRightIcons = rightCustomIcon || clear || isLoading || isInvalid || hasDropdownIcon;
|
|
67
|
+
return hasRightIcons ? (0, _react2.jsx)(_form_control_layout_icons.EuiFormControlLayoutIcons, {
|
|
68
|
+
side: "right",
|
|
69
|
+
icon: rightCustomIcon,
|
|
70
|
+
iconsPosition: iconsPosition,
|
|
71
|
+
compressed: compressed,
|
|
72
|
+
clear: clear,
|
|
73
|
+
isLoading: isLoading,
|
|
74
|
+
isInvalid: isInvalid,
|
|
75
|
+
isDropdown: hasDropdownIcon
|
|
76
|
+
}) : null;
|
|
77
|
+
});
|
|
78
|
+
return _this;
|
|
41
79
|
}
|
|
42
80
|
(0, _createClass2.default)(EuiFormControlLayout, [{
|
|
43
81
|
key: "render",
|
|
44
82
|
value: function render() {
|
|
45
83
|
var _ref = this.context,
|
|
46
84
|
defaultFullWidth = _ref.defaultFullWidth;
|
|
47
|
-
var _this$
|
|
48
|
-
children = _this$
|
|
49
|
-
icon = _this$
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
85
|
+
var _this$props3 = this.props,
|
|
86
|
+
children = _this$props3.children,
|
|
87
|
+
icon = _this$props3.icon,
|
|
88
|
+
iconsPosition = _this$props3.iconsPosition,
|
|
89
|
+
clear = _this$props3.clear,
|
|
90
|
+
_this$props3$fullWidt = _this$props3.fullWidth,
|
|
91
|
+
fullWidth = _this$props3$fullWidt === void 0 ? defaultFullWidth : _this$props3$fullWidt,
|
|
92
|
+
isLoading = _this$props3.isLoading,
|
|
93
|
+
isDisabled = _this$props3.isDisabled,
|
|
94
|
+
compressed = _this$props3.compressed,
|
|
95
|
+
className = _this$props3.className,
|
|
96
|
+
prepend = _this$props3.prepend,
|
|
97
|
+
append = _this$props3.append,
|
|
98
|
+
readOnly = _this$props3.readOnly,
|
|
99
|
+
isInvalid = _this$props3.isInvalid,
|
|
100
|
+
isDropdown = _this$props3.isDropdown,
|
|
101
|
+
inputId = _this$props3.inputId,
|
|
102
|
+
rest = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
|
|
64
103
|
var classes = (0, _classnames.default)('euiFormControlLayout', {
|
|
65
104
|
'euiFormControlLayout--fullWidth': fullWidth,
|
|
66
105
|
'euiFormControlLayout--compressed': compressed,
|
|
@@ -74,19 +113,12 @@ var EuiFormControlLayout = /*#__PURE__*/function (_Component) {
|
|
|
74
113
|
className: classes
|
|
75
114
|
}, rest), prependNodes, (0, _react2.jsx)("div", {
|
|
76
115
|
className: "euiFormControlLayout__childrenWrapper"
|
|
77
|
-
},
|
|
78
|
-
icon: icon,
|
|
79
|
-
clear: clear,
|
|
80
|
-
compressed: compressed,
|
|
81
|
-
isLoading: isLoading,
|
|
82
|
-
isInvalid: invalid,
|
|
83
|
-
isDropdown: !readOnly && !isDisabled && isDropdown
|
|
84
|
-
})), appendNodes);
|
|
116
|
+
}, this.renderLeftIcons(), children, this.renderRightIcons()), appendNodes);
|
|
85
117
|
}
|
|
86
118
|
}, {
|
|
87
119
|
key: "renderSideNode",
|
|
88
120
|
value: function renderSideNode(side, nodes, inputId) {
|
|
89
|
-
var
|
|
121
|
+
var _this2 = this;
|
|
90
122
|
if (!nodes) {
|
|
91
123
|
return;
|
|
92
124
|
}
|
|
@@ -94,7 +126,7 @@ var EuiFormControlLayout = /*#__PURE__*/function (_Component) {
|
|
|
94
126
|
return this.createFormLabel(side, nodes, inputId);
|
|
95
127
|
}
|
|
96
128
|
var appendNodes = _react.default.Children.map(nodes, function (item, index) {
|
|
97
|
-
return typeof item === 'string' ?
|
|
129
|
+
return typeof item === 'string' ? _this2.createFormLabel(side, item, inputId) : _this2.createSideNode(side, item, index);
|
|
98
130
|
});
|
|
99
131
|
return appendNodes;
|
|
100
132
|
}
|
|
@@ -141,6 +173,7 @@ EuiFormControlLayout.propTypes = {
|
|
|
141
173
|
color: _propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.any.isRequired]),
|
|
142
174
|
ref: _propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.func.isRequired])
|
|
143
175
|
}).isRequired]),
|
|
176
|
+
iconsPosition: _propTypes.default.oneOf(["absolute", "static"]),
|
|
144
177
|
clear: _propTypes.default.shape({
|
|
145
178
|
className: _propTypes.default.string,
|
|
146
179
|
"aria-label": _propTypes.default.string,
|
|
@@ -11,6 +11,8 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
13
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
14
|
+
var _i18n = require("../../i18n");
|
|
15
|
+
var _icon = require("../../icon");
|
|
14
16
|
var _text = require("../../text");
|
|
15
17
|
var _form_control_layout = require("./form_control_layout");
|
|
16
18
|
var _react2 = require("@emotion/react");
|
|
@@ -20,18 +22,23 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
20
22
|
var EuiFormControlLayoutDelimited = function EuiFormControlLayoutDelimited(_ref) {
|
|
21
23
|
var startControl = _ref.startControl,
|
|
22
24
|
endControl = _ref.endControl,
|
|
23
|
-
|
|
24
|
-
delimiter = _ref$delimiter === void 0 ? '→' : _ref$delimiter,
|
|
25
|
+
delimiter = _ref.delimiter,
|
|
25
26
|
className = _ref.className,
|
|
26
27
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
27
|
-
var
|
|
28
|
+
var isInvalid = rest.isInvalid,
|
|
29
|
+
isDisabled = rest.isDisabled,
|
|
30
|
+
readOnly = rest.readOnly;
|
|
31
|
+
var showInvalidState = isInvalid && !isDisabled && !readOnly;
|
|
32
|
+
var classes = (0, _classnames.default)('euiFormControlLayoutDelimited', className, {
|
|
33
|
+
'euiFormControlLayoutDelimited--isInvalid': showInvalidState
|
|
34
|
+
});
|
|
28
35
|
return (0, _react2.jsx)(_form_control_layout.EuiFormControlLayout, (0, _extends2.default)({
|
|
29
|
-
className: classes
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
36
|
+
className: classes,
|
|
37
|
+
iconsPosition: "static"
|
|
38
|
+
}, rest), addClassesToControl(startControl), (0, _react2.jsx)(EuiFormControlDelimiter, {
|
|
39
|
+
delimiter: delimiter,
|
|
40
|
+
isInvalid: showInvalidState
|
|
41
|
+
}), addClassesToControl(endControl));
|
|
35
42
|
};
|
|
36
43
|
exports.EuiFormControlLayoutDelimited = EuiFormControlLayoutDelimited;
|
|
37
44
|
EuiFormControlLayoutDelimited.propTypes = {
|
|
@@ -50,8 +57,21 @@ EuiFormControlLayoutDelimited.propTypes = {
|
|
|
50
57
|
delimiter: _propTypes.default.node,
|
|
51
58
|
className: _propTypes.default.string
|
|
52
59
|
};
|
|
53
|
-
function addClassesToControl(control) {
|
|
60
|
+
var addClassesToControl = function addClassesToControl(control) {
|
|
54
61
|
return /*#__PURE__*/(0, _react.cloneElement)(control, {
|
|
55
62
|
className: (0, _classnames.default)(control.props.className, 'euiFormControlLayoutDelimited__input')
|
|
56
63
|
});
|
|
57
|
-
}
|
|
64
|
+
};
|
|
65
|
+
var EuiFormControlDelimiter = function EuiFormControlDelimiter(_ref2) {
|
|
66
|
+
var delimiter = _ref2.delimiter,
|
|
67
|
+
isInvalid = _ref2.isInvalid;
|
|
68
|
+
var defaultAriaLabel = (0, _i18n.useEuiI18n)('euiFormControlLayoutDelimited.delimiterLabel', 'to');
|
|
69
|
+
return (0, _react2.jsx)(_text.EuiText, {
|
|
70
|
+
className: "euiFormControlLayoutDelimited__delimiter",
|
|
71
|
+
size: "s",
|
|
72
|
+
color: isInvalid ? 'danger' : 'subdued'
|
|
73
|
+
}, delimiter !== null && delimiter !== void 0 ? delimiter : (0, _react2.jsx)(_icon.EuiIcon, {
|
|
74
|
+
type: "sortRight",
|
|
75
|
+
"aria-label": defaultAriaLabel
|
|
76
|
+
}));
|
|
77
|
+
};
|
|
@@ -15,6 +15,7 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
15
15
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
16
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
17
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
18
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
18
19
|
var _loading = require("../../loading");
|
|
19
20
|
var _form_control_layout_clear_button = require("./form_control_layout_clear_button");
|
|
20
21
|
var _form_control_layout_custom_icon = require("./form_control_layout_custom_icon");
|
|
@@ -41,30 +42,19 @@ var EuiFormControlLayoutIcons = /*#__PURE__*/function (_Component) {
|
|
|
41
42
|
key: "render",
|
|
42
43
|
value: function render() {
|
|
43
44
|
var _this$props = this.props,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
_this$props$side = _this$props.side,
|
|
46
|
+
side = _this$props$side === void 0 ? 'left' : _this$props$side,
|
|
47
|
+
_this$props$iconsPosi = _this$props.iconsPosition,
|
|
48
|
+
iconsPosition = _this$props$iconsPosi === void 0 ? 'absolute' : _this$props$iconsPosi;
|
|
48
49
|
var customIcon = this.renderCustomIcon();
|
|
49
50
|
var loadingSpinner = this.renderLoadingSpinner();
|
|
50
51
|
var clearButton = this.renderClearButton();
|
|
51
52
|
var invalidIcon = this.renderInvalidIcon();
|
|
52
53
|
var dropdownIcon = this.renderDropdownIcon();
|
|
53
|
-
var
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}, customIcon);
|
|
58
|
-
}
|
|
59
|
-
var rightIcons;
|
|
60
|
-
|
|
61
|
-
// If the icon is on the right, it should be placed after the clear button in the DOM.
|
|
62
|
-
if (clearButton || loadingSpinner || isInvalid || isDropdown || customIcon && iconSide === 'right') {
|
|
63
|
-
rightIcons = (0, _react2.jsx)("div", {
|
|
64
|
-
className: "euiFormControlLayoutIcons euiFormControlLayoutIcons--right"
|
|
65
|
-
}, clearButton, loadingSpinner, invalidIcon, iconSide === 'right' ? customIcon : undefined, dropdownIcon);
|
|
66
|
-
}
|
|
67
|
-
return (0, _react2.jsx)(_react.Fragment, null, leftIcons, rightIcons);
|
|
54
|
+
var classes = (0, _classnames.default)('euiFormControlLayoutIcons', "euiFormControlLayoutIcons--".concat(side), "euiFormControlLayoutIcons--".concat(iconsPosition));
|
|
55
|
+
return (0, _react2.jsx)("div", {
|
|
56
|
+
className: classes
|
|
57
|
+
}, clearButton, loadingSpinner, invalidIcon, customIcon, dropdownIcon);
|
|
68
58
|
}
|
|
69
59
|
}, {
|
|
70
60
|
key: "renderCustomIcon",
|
|
@@ -154,6 +144,8 @@ EuiFormControlLayoutIcons.propTypes = {
|
|
|
154
144
|
color: _propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.any.isRequired]),
|
|
155
145
|
ref: _propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.func.isRequired])
|
|
156
146
|
}).isRequired]),
|
|
147
|
+
side: _propTypes.default.any,
|
|
148
|
+
iconsPosition: _propTypes.default.oneOf(["absolute", "static"]),
|
|
157
149
|
clear: _propTypes.default.shape({
|
|
158
150
|
className: _propTypes.default.string,
|
|
159
151
|
"aria-label": _propTypes.default.string,
|