@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
|
@@ -205,6 +205,36 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
205
205
|
_this.asyncInterval = new _async_interval.AsyncInterval(handler, refreshInterval);
|
|
206
206
|
}
|
|
207
207
|
});
|
|
208
|
+
_defineProperty(_assertThisInitialized(_this), "renderQuickSelect", function () {
|
|
209
|
+
var _this$props2 = _this.props,
|
|
210
|
+
start = _this$props2.start,
|
|
211
|
+
end = _this$props2.end,
|
|
212
|
+
customQuickSelectPanels = _this$props2.customQuickSelectPanels,
|
|
213
|
+
customQuickSelectRender = _this$props2.customQuickSelectRender,
|
|
214
|
+
commonlyUsedRanges = _this$props2.commonlyUsedRanges,
|
|
215
|
+
timeOptions = _this$props2.timeOptions,
|
|
216
|
+
dateFormat = _this$props2.dateFormat,
|
|
217
|
+
onRefreshChange = _this$props2.onRefreshChange,
|
|
218
|
+
recentlyUsedRanges = _this$props2.recentlyUsedRanges,
|
|
219
|
+
refreshInterval = _this$props2.refreshInterval,
|
|
220
|
+
isPaused = _this$props2.isPaused,
|
|
221
|
+
isDisabled = _this$props2.isDisabled;
|
|
222
|
+
return (0, _react2.jsx)(_quick_select_popover.EuiQuickSelectPopover, {
|
|
223
|
+
applyRefreshInterval: onRefreshChange ? _this.onRefreshChange : undefined,
|
|
224
|
+
applyTime: _this.applyQuickTime,
|
|
225
|
+
commonlyUsedRanges: commonlyUsedRanges,
|
|
226
|
+
customQuickSelectPanels: customQuickSelectPanels,
|
|
227
|
+
customQuickSelectRender: customQuickSelectRender,
|
|
228
|
+
dateFormat: dateFormat,
|
|
229
|
+
end: end,
|
|
230
|
+
isDisabled: isDisabled,
|
|
231
|
+
isPaused: isPaused,
|
|
232
|
+
recentlyUsedRanges: recentlyUsedRanges,
|
|
233
|
+
refreshInterval: refreshInterval,
|
|
234
|
+
start: start,
|
|
235
|
+
timeOptions: timeOptions
|
|
236
|
+
});
|
|
237
|
+
});
|
|
208
238
|
_defineProperty(_assertThisInitialized(_this), "renderDatePickerRange", function () {
|
|
209
239
|
var _this$state = _this.state,
|
|
210
240
|
end = _this$state.end,
|
|
@@ -214,24 +244,47 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
214
244
|
isStartDatePopoverOpen = _this$state.isStartDatePopoverOpen,
|
|
215
245
|
showPrettyDuration = _this$state.showPrettyDuration,
|
|
216
246
|
start = _this$state.start;
|
|
217
|
-
var _this$
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
247
|
+
var _this$props3 = _this.props,
|
|
248
|
+
isQuickSelectOnly = _this$props3.isQuickSelectOnly,
|
|
249
|
+
showUpdateButton = _this$props3.showUpdateButton,
|
|
250
|
+
commonlyUsedRanges = _this$props3.commonlyUsedRanges,
|
|
251
|
+
timeOptions = _this$props3.timeOptions,
|
|
252
|
+
dateFormat = _this$props3.dateFormat,
|
|
253
|
+
refreshInterval = _this$props3.refreshInterval,
|
|
254
|
+
isPaused = _this$props3.isPaused,
|
|
255
|
+
isDisabled = _this$props3.isDisabled,
|
|
256
|
+
isLoading = _this$props3.isLoading,
|
|
257
|
+
locale = _this$props3.locale,
|
|
258
|
+
timeFormat = _this$props3.timeFormat,
|
|
259
|
+
utcOffset = _this$props3.utcOffset,
|
|
260
|
+
compressed = _this$props3.compressed,
|
|
261
|
+
onFocus = _this$props3.onFocus,
|
|
262
|
+
className = _this$props3.className,
|
|
263
|
+
dataTestSubj = _this$props3['data-test-subj'];
|
|
264
|
+
var autoRefreshAppend = !isPaused ? (0, _react2.jsx)(_auto_refresh.EuiAutoRefreshButton, {
|
|
265
|
+
refreshInterval: refreshInterval,
|
|
266
|
+
isDisabled: isDisabled,
|
|
267
|
+
isPaused: isPaused,
|
|
268
|
+
onRefreshChange: _this.onRefreshChange,
|
|
269
|
+
shortHand: true
|
|
270
|
+
}) : undefined;
|
|
271
|
+
var formControlLayoutProps = {
|
|
272
|
+
className: (0, _classnames.default)('euiSuperDatePicker', className),
|
|
273
|
+
compressed: compressed,
|
|
274
|
+
isInvalid: isInvalid,
|
|
275
|
+
isLoading: isLoading && !showUpdateButton,
|
|
276
|
+
disabled: isDisabled,
|
|
277
|
+
prepend: _this.renderQuickSelect(),
|
|
278
|
+
append: autoRefreshAppend,
|
|
279
|
+
'data-test-subj': dataTestSubj
|
|
280
|
+
};
|
|
281
|
+
if (isQuickSelectOnly) {
|
|
282
|
+
return (0, _react2.jsx)(_form.EuiFormControlLayout, _extends({
|
|
283
|
+
iconsPosition: "static"
|
|
284
|
+
}, formControlLayoutProps));
|
|
285
|
+
}
|
|
227
286
|
if (showPrettyDuration && !isStartDatePopoverOpen && !isEndDatePopoverOpen) {
|
|
228
|
-
return (0, _react2.jsx)(
|
|
229
|
-
className: "euiDatePickerRange--inGroup",
|
|
230
|
-
iconType: false,
|
|
231
|
-
isCustom: true,
|
|
232
|
-
startDateControl: (0, _react2.jsx)("div", null),
|
|
233
|
-
endDateControl: (0, _react2.jsx)("div", null)
|
|
234
|
-
}, (0, _react2.jsx)("button", {
|
|
287
|
+
return (0, _react2.jsx)(_form.EuiFormControlLayout, formControlLayoutProps, (0, _react2.jsx)("button", {
|
|
235
288
|
className: (0, _classnames.default)('euiSuperDatePicker__prettyFormat', {
|
|
236
289
|
'euiSuperDatePicker__prettyFormat--disabled': isDisabled
|
|
237
290
|
}),
|
|
@@ -248,12 +301,12 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
248
301
|
}
|
|
249
302
|
return (0, _react2.jsx)(_context.EuiI18nConsumer, null, function (_ref4) {
|
|
250
303
|
var contextLocale = _ref4.locale;
|
|
251
|
-
return (0, _react2.jsx)(_date_picker_range.EuiDatePickerRange, {
|
|
252
|
-
className:
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
disabled: isDisabled,
|
|
304
|
+
return (0, _react2.jsx)(_date_picker_range.EuiDatePickerRange, _extends({}, formControlLayoutProps, {
|
|
305
|
+
className: (0, _classnames.default)(formControlLayoutProps.className, {
|
|
306
|
+
'euiSuperDatePicker--needsUpdating': hasChanged && !isDisabled && !isInvalid
|
|
307
|
+
}),
|
|
256
308
|
isCustom: true,
|
|
309
|
+
iconType: false,
|
|
257
310
|
startDateControl: (0, _react2.jsx)(_date_popover_button.EuiDatePopoverButton, {
|
|
258
311
|
className: "euiSuperDatePicker__startPopoverButton",
|
|
259
312
|
compressed: compressed,
|
|
@@ -296,15 +349,15 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
296
349
|
onFocus: onFocus
|
|
297
350
|
}
|
|
298
351
|
})
|
|
299
|
-
});
|
|
352
|
+
}));
|
|
300
353
|
});
|
|
301
354
|
});
|
|
302
355
|
_defineProperty(_assertThisInitialized(_this), "handleClickUpdateButton", function () {
|
|
303
356
|
if (!_this.state.hasChanged && _this.props.onRefresh) {
|
|
304
|
-
var _this$
|
|
305
|
-
start = _this$
|
|
306
|
-
end = _this$
|
|
307
|
-
refreshInterval = _this$
|
|
357
|
+
var _this$props4 = _this.props,
|
|
358
|
+
start = _this$props4.start,
|
|
359
|
+
end = _this$props4.end,
|
|
360
|
+
refreshInterval = _this$props4.refreshInterval;
|
|
308
361
|
_this.props.onRefresh({
|
|
309
362
|
start: start,
|
|
310
363
|
end: end,
|
|
@@ -315,12 +368,12 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
315
368
|
}
|
|
316
369
|
});
|
|
317
370
|
_defineProperty(_assertThisInitialized(_this), "renderUpdateButton", function () {
|
|
318
|
-
var _this$
|
|
319
|
-
isLoading = _this$
|
|
320
|
-
isDisabled = _this$
|
|
321
|
-
updateButtonProps = _this$
|
|
322
|
-
showUpdateButton = _this$
|
|
323
|
-
compressed = _this$
|
|
371
|
+
var _this$props5 = _this.props,
|
|
372
|
+
isLoading = _this$props5.isLoading,
|
|
373
|
+
isDisabled = _this$props5.isDisabled,
|
|
374
|
+
updateButtonProps = _this$props5.updateButtonProps,
|
|
375
|
+
showUpdateButton = _this$props5.showUpdateButton,
|
|
376
|
+
compressed = _this$props5.compressed;
|
|
324
377
|
if (!showUpdateButton) return null;
|
|
325
378
|
return (0, _react2.jsx)(_flex.EuiFlexItem, {
|
|
326
379
|
grow: false
|
|
@@ -340,52 +393,21 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
340
393
|
_createClass(EuiSuperDatePickerInternal, [{
|
|
341
394
|
key: "render",
|
|
342
395
|
value: function render() {
|
|
343
|
-
var _this$
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
refreshInterval = _this$props5.refreshInterval,
|
|
356
|
-
showUpdateButton = _this$props5.showUpdateButton,
|
|
357
|
-
start = _this$props5.start,
|
|
358
|
-
dataTestSubj = _this$props5['data-test-subj'],
|
|
359
|
-
_width = _this$props5.width,
|
|
360
|
-
isQuickSelectOnly = _this$props5.isQuickSelectOnly,
|
|
361
|
-
compressed = _this$props5.compressed,
|
|
362
|
-
className = _this$props5.className;
|
|
396
|
+
var _this$props6 = this.props,
|
|
397
|
+
isAutoRefreshOnly = _this$props6.isAutoRefreshOnly,
|
|
398
|
+
isDisabled = _this$props6.isDisabled,
|
|
399
|
+
isPaused = _this$props6.isPaused,
|
|
400
|
+
onRefreshChange = _this$props6.onRefreshChange,
|
|
401
|
+
refreshInterval = _this$props6.refreshInterval,
|
|
402
|
+
showUpdateButton = _this$props6.showUpdateButton,
|
|
403
|
+
dataTestSubj = _this$props6['data-test-subj'],
|
|
404
|
+
_width = _this$props6.width,
|
|
405
|
+
isQuickSelectOnly = _this$props6.isQuickSelectOnly,
|
|
406
|
+
compressed = _this$props6.compressed,
|
|
407
|
+
className = _this$props6.className;
|
|
363
408
|
|
|
364
409
|
// Force reduction in width if showing quick select only
|
|
365
410
|
var width = isQuickSelectOnly ? 'auto' : _width;
|
|
366
|
-
var autoRefreshAppend = !isPaused ? (0, _react2.jsx)(_auto_refresh.EuiAutoRefreshButton, {
|
|
367
|
-
className: "euiFormControlLayout__append",
|
|
368
|
-
refreshInterval: refreshInterval,
|
|
369
|
-
isDisabled: isDisabled,
|
|
370
|
-
isPaused: isPaused,
|
|
371
|
-
onRefreshChange: this.onRefreshChange,
|
|
372
|
-
shortHand: true
|
|
373
|
-
}) : undefined;
|
|
374
|
-
var quickSelect = (0, _react2.jsx)(_quick_select_popover.EuiQuickSelectPopover, {
|
|
375
|
-
applyRefreshInterval: onRefreshChange ? this.onRefreshChange : undefined,
|
|
376
|
-
applyTime: this.applyQuickTime,
|
|
377
|
-
commonlyUsedRanges: commonlyUsedRanges,
|
|
378
|
-
customQuickSelectPanels: customQuickSelectPanels,
|
|
379
|
-
customQuickSelectRender: customQuickSelectRender,
|
|
380
|
-
dateFormat: dateFormat,
|
|
381
|
-
end: end,
|
|
382
|
-
isDisabled: isDisabled,
|
|
383
|
-
isPaused: isPaused,
|
|
384
|
-
recentlyUsedRanges: recentlyUsedRanges,
|
|
385
|
-
refreshInterval: refreshInterval,
|
|
386
|
-
start: start,
|
|
387
|
-
timeOptions: timeOptions
|
|
388
|
-
});
|
|
389
411
|
var flexWrapperClasses = (0, _classnames.default)('euiSuperDatePicker__flexWrapper', {
|
|
390
412
|
'euiSuperDatePicker__flexWrapper--noUpdateButton': !showUpdateButton,
|
|
391
413
|
'euiSuperDatePicker__flexWrapper--isAutoRefreshOnly': isAutoRefreshOnly,
|
|
@@ -406,14 +428,7 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
406
428
|
isDisabled: isDisabled,
|
|
407
429
|
"data-test-subj": dataTestSubj,
|
|
408
430
|
className: className
|
|
409
|
-
})) : (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(_flex.EuiFlexItem, null, (
|
|
410
|
-
className: (0, _classnames.default)('euiSuperDatePicker', className),
|
|
411
|
-
compressed: compressed,
|
|
412
|
-
isDisabled: isDisabled,
|
|
413
|
-
prepend: quickSelect,
|
|
414
|
-
append: autoRefreshAppend,
|
|
415
|
-
"data-test-subj": dataTestSubj
|
|
416
|
-
}, !isQuickSelectOnly && this.renderDatePickerRange())), this.renderUpdateButton()));
|
|
431
|
+
})) : (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(_flex.EuiFlexItem, null, this.renderDatePickerRange()), this.renderUpdateButton()));
|
|
417
432
|
}
|
|
418
433
|
}], [{
|
|
419
434
|
key: "getDerivedStateFromProps",
|
|
@@ -1,20 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.EuiFieldNumber = void 0;
|
|
7
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
-
var
|
|
11
|
+
var _services = require("../../../services");
|
|
11
12
|
var _validatable_control = require("../validatable_control");
|
|
12
|
-
var
|
|
13
|
+
var _form_control_layout = require("../form_control_layout");
|
|
13
14
|
var _num_icons = require("../form_control_layout/_num_icons");
|
|
15
|
+
var _eui_form_context = require("../eui_form_context");
|
|
14
16
|
var _react2 = require("@emotion/react");
|
|
15
|
-
var _excluded = ["className", "icon", "id", "placeholder", "name", "min", "max", "value", "isInvalid", "fullWidth", "isLoading", "compressed", "prepend", "append", "inputRef", "readOnly", "controlOnly"];
|
|
17
|
+
var _excluded = ["className", "icon", "id", "placeholder", "name", "min", "max", "value", "isInvalid", "fullWidth", "isLoading", "compressed", "prepend", "append", "inputRef", "readOnly", "controlOnly", "onKeyDown"];
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
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); }
|
|
20
|
+
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; }
|
|
17
21
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
22
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
23
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
24
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
25
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
26
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
27
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
28
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
19
29
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
20
30
|
var EuiFieldNumber = function EuiFieldNumber(props) {
|
|
@@ -40,9 +50,31 @@ var EuiFieldNumber = function EuiFieldNumber(props) {
|
|
|
40
50
|
inputRef = props.inputRef,
|
|
41
51
|
readOnly = props.readOnly,
|
|
42
52
|
controlOnly = props.controlOnly,
|
|
53
|
+
_onKeyDown = props.onKeyDown,
|
|
43
54
|
rest = _objectWithoutProperties(props, _excluded);
|
|
44
|
-
|
|
45
|
-
|
|
55
|
+
|
|
56
|
+
// Attempt to determine additional invalid state. The native number input
|
|
57
|
+
// will set :invalid state automatically, but we need to also set
|
|
58
|
+
// `aria-invalid` as well as display an icon. We also want to *not* set this on
|
|
59
|
+
// EuiValidatableControl, in order to not override custom validity messages
|
|
60
|
+
var _useState = (0, _react.useState)(false),
|
|
61
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
62
|
+
isNativelyInvalid = _useState2[0],
|
|
63
|
+
setIsNativelyInvalid = _useState2[1];
|
|
64
|
+
var validityRef = (0, _react.useRef)(null);
|
|
65
|
+
var setRefs = (0, _services.useCombinedRefs)([validityRef, inputRef]);
|
|
66
|
+
|
|
67
|
+
// Note that we can't use hook into `onChange` because browsers don't emit change events
|
|
68
|
+
// for invalid values - see https://github.com/facebook/react/issues/16554
|
|
69
|
+
var onKeyDown = (0, _react.useCallback)(function (e) {
|
|
70
|
+
_onKeyDown === null || _onKeyDown === void 0 ? void 0 : _onKeyDown(e);
|
|
71
|
+
// Wait a beat before checking validity - we can't use `e.target` as it's stale
|
|
72
|
+
requestAnimationFrame(function () {
|
|
73
|
+
setIsNativelyInvalid(!validityRef.current.validity.valid);
|
|
74
|
+
});
|
|
75
|
+
}, [_onKeyDown]);
|
|
76
|
+
var numIconsClass = controlOnly ? false : (0, _num_icons.getFormControlClassNameForIconCount)({
|
|
77
|
+
isInvalid: isInvalid || isNativelyInvalid,
|
|
46
78
|
isLoading: isLoading
|
|
47
79
|
});
|
|
48
80
|
var classes = (0, _classnames.default)('euiFieldNumber', className, numIconsClass, {
|
|
@@ -64,7 +96,9 @@ var EuiFieldNumber = function EuiFieldNumber(props) {
|
|
|
64
96
|
placeholder: placeholder,
|
|
65
97
|
readOnly: readOnly,
|
|
66
98
|
className: classes,
|
|
67
|
-
ref:
|
|
99
|
+
ref: setRefs,
|
|
100
|
+
onKeyDown: onKeyDown,
|
|
101
|
+
"aria-invalid": isInvalid || isNativelyInvalid
|
|
68
102
|
}, rest)));
|
|
69
103
|
if (controlOnly) {
|
|
70
104
|
return control;
|
|
@@ -73,7 +107,7 @@ var EuiFieldNumber = function EuiFieldNumber(props) {
|
|
|
73
107
|
icon: icon,
|
|
74
108
|
fullWidth: fullWidth,
|
|
75
109
|
isLoading: isLoading,
|
|
76
|
-
isInvalid: isInvalid,
|
|
110
|
+
isInvalid: isInvalid || isNativelyInvalid,
|
|
77
111
|
compressed: compressed,
|
|
78
112
|
readOnly: readOnly,
|
|
79
113
|
prepend: prepend,
|
|
@@ -37,7 +37,7 @@ var EuiFieldText = function EuiFieldText(props) {
|
|
|
37
37
|
readOnly = props.readOnly,
|
|
38
38
|
controlOnly = props.controlOnly,
|
|
39
39
|
rest = _objectWithoutProperties(props, _excluded);
|
|
40
|
-
var numIconsClass = (0, _num_icons.getFormControlClassNameForIconCount)({
|
|
40
|
+
var numIconsClass = controlOnly ? false : (0, _num_icons.getFormControlClassNameForIconCount)({
|
|
41
41
|
isInvalid: isInvalid,
|
|
42
42
|
isLoading: isLoading
|
|
43
43
|
});
|
|
@@ -4,12 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.EuiFormControlLayout = void 0;
|
|
7
|
-
Object.defineProperty(exports, "ICON_SIDES", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function get() {
|
|
10
|
-
return _form_control_layout_icons.ICON_SIDES;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
14
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
@@ -17,7 +11,7 @@ var _form_control_layout_icons = require("./form_control_layout_icons");
|
|
|
17
11
|
var _form_label = require("../form_label");
|
|
18
12
|
var _eui_form_context = require("../eui_form_context");
|
|
19
13
|
var _react2 = require("@emotion/react");
|
|
20
|
-
var _excluded = ["children", "icon", "clear", "fullWidth", "isLoading", "isDisabled", "compressed", "className", "prepend", "append", "readOnly", "isInvalid", "isDropdown", "inputId"];
|
|
14
|
+
var _excluded = ["children", "icon", "iconsPosition", "clear", "fullWidth", "isLoading", "isDisabled", "compressed", "className", "prepend", "append", "readOnly", "isInvalid", "isDropdown", "inputId"];
|
|
21
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
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); }
|
|
23
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; }
|
|
@@ -42,31 +36,75 @@ var EuiFormControlLayout = /*#__PURE__*/function (_Component) {
|
|
|
42
36
|
_inherits(EuiFormControlLayout, _Component);
|
|
43
37
|
var _super = _createSuper(EuiFormControlLayout);
|
|
44
38
|
function EuiFormControlLayout() {
|
|
39
|
+
var _this;
|
|
45
40
|
_classCallCheck(this, EuiFormControlLayout);
|
|
46
|
-
|
|
41
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
42
|
+
args[_key] = arguments[_key];
|
|
43
|
+
}
|
|
44
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
45
|
+
_defineProperty(_assertThisInitialized(_this), "renderLeftIcons", function () {
|
|
46
|
+
var _this$props = _this.props,
|
|
47
|
+
icon = _this$props.icon,
|
|
48
|
+
iconsPosition = _this$props.iconsPosition,
|
|
49
|
+
compressed = _this$props.compressed;
|
|
50
|
+
var leftCustomIcon = icon && (icon === null || icon === void 0 ? void 0 : icon.side) !== 'right' ? icon : undefined;
|
|
51
|
+
return leftCustomIcon ? (0, _react2.jsx)(_form_control_layout_icons.EuiFormControlLayoutIcons, {
|
|
52
|
+
side: "left",
|
|
53
|
+
icon: leftCustomIcon,
|
|
54
|
+
iconsPosition: iconsPosition,
|
|
55
|
+
compressed: compressed
|
|
56
|
+
}) : null;
|
|
57
|
+
});
|
|
58
|
+
_defineProperty(_assertThisInitialized(_this), "renderRightIcons", function () {
|
|
59
|
+
var _this$props2 = _this.props,
|
|
60
|
+
icon = _this$props2.icon,
|
|
61
|
+
iconsPosition = _this$props2.iconsPosition,
|
|
62
|
+
clear = _this$props2.clear,
|
|
63
|
+
compressed = _this$props2.compressed,
|
|
64
|
+
isLoading = _this$props2.isLoading,
|
|
65
|
+
isInvalid = _this$props2.isInvalid,
|
|
66
|
+
isDisabled = _this$props2.isDisabled,
|
|
67
|
+
readOnly = _this$props2.readOnly,
|
|
68
|
+
isDropdown = _this$props2.isDropdown;
|
|
69
|
+
var hasDropdownIcon = !readOnly && !isDisabled && isDropdown;
|
|
70
|
+
var rightCustomIcon = icon && (icon === null || icon === void 0 ? void 0 : icon.side) === 'right' ? icon : undefined;
|
|
71
|
+
var hasRightIcons = rightCustomIcon || clear || isLoading || isInvalid || hasDropdownIcon;
|
|
72
|
+
return hasRightIcons ? (0, _react2.jsx)(_form_control_layout_icons.EuiFormControlLayoutIcons, {
|
|
73
|
+
side: "right",
|
|
74
|
+
icon: rightCustomIcon,
|
|
75
|
+
iconsPosition: iconsPosition,
|
|
76
|
+
compressed: compressed,
|
|
77
|
+
clear: clear,
|
|
78
|
+
isLoading: isLoading,
|
|
79
|
+
isInvalid: isInvalid,
|
|
80
|
+
isDropdown: hasDropdownIcon
|
|
81
|
+
}) : null;
|
|
82
|
+
});
|
|
83
|
+
return _this;
|
|
47
84
|
}
|
|
48
85
|
_createClass(EuiFormControlLayout, [{
|
|
49
86
|
key: "render",
|
|
50
87
|
value: function render() {
|
|
51
88
|
var _ref = this.context,
|
|
52
89
|
defaultFullWidth = _ref.defaultFullWidth;
|
|
53
|
-
var _this$
|
|
54
|
-
children = _this$
|
|
55
|
-
icon = _this$
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
90
|
+
var _this$props3 = this.props,
|
|
91
|
+
children = _this$props3.children,
|
|
92
|
+
icon = _this$props3.icon,
|
|
93
|
+
iconsPosition = _this$props3.iconsPosition,
|
|
94
|
+
clear = _this$props3.clear,
|
|
95
|
+
_this$props3$fullWidt = _this$props3.fullWidth,
|
|
96
|
+
fullWidth = _this$props3$fullWidt === void 0 ? defaultFullWidth : _this$props3$fullWidt,
|
|
97
|
+
isLoading = _this$props3.isLoading,
|
|
98
|
+
isDisabled = _this$props3.isDisabled,
|
|
99
|
+
compressed = _this$props3.compressed,
|
|
100
|
+
className = _this$props3.className,
|
|
101
|
+
prepend = _this$props3.prepend,
|
|
102
|
+
append = _this$props3.append,
|
|
103
|
+
readOnly = _this$props3.readOnly,
|
|
104
|
+
isInvalid = _this$props3.isInvalid,
|
|
105
|
+
isDropdown = _this$props3.isDropdown,
|
|
106
|
+
inputId = _this$props3.inputId,
|
|
107
|
+
rest = _objectWithoutProperties(_this$props3, _excluded);
|
|
70
108
|
var classes = (0, _classnames.default)('euiFormControlLayout', {
|
|
71
109
|
'euiFormControlLayout--fullWidth': fullWidth,
|
|
72
110
|
'euiFormControlLayout--compressed': compressed,
|
|
@@ -80,19 +118,12 @@ var EuiFormControlLayout = /*#__PURE__*/function (_Component) {
|
|
|
80
118
|
className: classes
|
|
81
119
|
}, rest), prependNodes, (0, _react2.jsx)("div", {
|
|
82
120
|
className: "euiFormControlLayout__childrenWrapper"
|
|
83
|
-
},
|
|
84
|
-
icon: icon,
|
|
85
|
-
clear: clear,
|
|
86
|
-
compressed: compressed,
|
|
87
|
-
isLoading: isLoading,
|
|
88
|
-
isInvalid: invalid,
|
|
89
|
-
isDropdown: !readOnly && !isDisabled && isDropdown
|
|
90
|
-
})), appendNodes);
|
|
121
|
+
}, this.renderLeftIcons(), children, this.renderRightIcons()), appendNodes);
|
|
91
122
|
}
|
|
92
123
|
}, {
|
|
93
124
|
key: "renderSideNode",
|
|
94
125
|
value: function renderSideNode(side, nodes, inputId) {
|
|
95
|
-
var
|
|
126
|
+
var _this2 = this;
|
|
96
127
|
if (!nodes) {
|
|
97
128
|
return;
|
|
98
129
|
}
|
|
@@ -100,7 +131,7 @@ var EuiFormControlLayout = /*#__PURE__*/function (_Component) {
|
|
|
100
131
|
return this.createFormLabel(side, nodes, inputId);
|
|
101
132
|
}
|
|
102
133
|
var appendNodes = _react.default.Children.map(nodes, function (item, index) {
|
|
103
|
-
return typeof item === 'string' ?
|
|
134
|
+
return typeof item === 'string' ? _this2.createFormLabel(side, item, inputId) : _this2.createSideNode(side, item, index);
|
|
104
135
|
});
|
|
105
136
|
return appendNodes;
|
|
106
137
|
}
|
|
@@ -147,6 +178,7 @@ EuiFormControlLayout.propTypes = {
|
|
|
147
178
|
color: _propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.any.isRequired]),
|
|
148
179
|
ref: _propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.func.isRequired])
|
|
149
180
|
}).isRequired]),
|
|
181
|
+
iconsPosition: _propTypes.default.oneOf(["absolute", "static"]),
|
|
150
182
|
clear: _propTypes.default.shape({
|
|
151
183
|
className: _propTypes.default.string,
|
|
152
184
|
"aria-label": _propTypes.default.string,
|
|
@@ -8,6 +8,8 @@ exports.EuiFormControlLayoutDelimited = void 0;
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
+
var _i18n = require("../../i18n");
|
|
12
|
+
var _icon = require("../../icon");
|
|
11
13
|
var _text = require("../../text");
|
|
12
14
|
var _form_control_layout = require("./form_control_layout");
|
|
13
15
|
var _react2 = require("@emotion/react");
|
|
@@ -21,18 +23,23 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
21
23
|
var EuiFormControlLayoutDelimited = function EuiFormControlLayoutDelimited(_ref) {
|
|
22
24
|
var startControl = _ref.startControl,
|
|
23
25
|
endControl = _ref.endControl,
|
|
24
|
-
|
|
25
|
-
delimiter = _ref$delimiter === void 0 ? '→' : _ref$delimiter,
|
|
26
|
+
delimiter = _ref.delimiter,
|
|
26
27
|
className = _ref.className,
|
|
27
28
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
28
|
-
var
|
|
29
|
+
var isInvalid = rest.isInvalid,
|
|
30
|
+
isDisabled = rest.isDisabled,
|
|
31
|
+
readOnly = rest.readOnly;
|
|
32
|
+
var showInvalidState = isInvalid && !isDisabled && !readOnly;
|
|
33
|
+
var classes = (0, _classnames.default)('euiFormControlLayoutDelimited', className, {
|
|
34
|
+
'euiFormControlLayoutDelimited--isInvalid': showInvalidState
|
|
35
|
+
});
|
|
29
36
|
return (0, _react2.jsx)(_form_control_layout.EuiFormControlLayout, _extends({
|
|
30
|
-
className: classes
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
37
|
+
className: classes,
|
|
38
|
+
iconsPosition: "static"
|
|
39
|
+
}, rest), addClassesToControl(startControl), (0, _react2.jsx)(EuiFormControlDelimiter, {
|
|
40
|
+
delimiter: delimiter,
|
|
41
|
+
isInvalid: showInvalidState
|
|
42
|
+
}), addClassesToControl(endControl));
|
|
36
43
|
};
|
|
37
44
|
exports.EuiFormControlLayoutDelimited = EuiFormControlLayoutDelimited;
|
|
38
45
|
EuiFormControlLayoutDelimited.propTypes = {
|
|
@@ -51,8 +58,21 @@ EuiFormControlLayoutDelimited.propTypes = {
|
|
|
51
58
|
delimiter: _propTypes.default.node,
|
|
52
59
|
className: _propTypes.default.string
|
|
53
60
|
};
|
|
54
|
-
function addClassesToControl(control) {
|
|
61
|
+
var addClassesToControl = function addClassesToControl(control) {
|
|
55
62
|
return /*#__PURE__*/(0, _react.cloneElement)(control, {
|
|
56
63
|
className: (0, _classnames.default)(control.props.className, 'euiFormControlLayoutDelimited__input')
|
|
57
64
|
});
|
|
58
|
-
}
|
|
65
|
+
};
|
|
66
|
+
var EuiFormControlDelimiter = function EuiFormControlDelimiter(_ref2) {
|
|
67
|
+
var delimiter = _ref2.delimiter,
|
|
68
|
+
isInvalid = _ref2.isInvalid;
|
|
69
|
+
var defaultAriaLabel = (0, _i18n.useEuiI18n)('euiFormControlLayoutDelimited.delimiterLabel', 'to');
|
|
70
|
+
return (0, _react2.jsx)(_text.EuiText, {
|
|
71
|
+
className: "euiFormControlLayoutDelimited__delimiter",
|
|
72
|
+
size: "s",
|
|
73
|
+
color: isInvalid ? 'danger' : 'subdued'
|
|
74
|
+
}, delimiter !== null && delimiter !== void 0 ? delimiter : (0, _react2.jsx)(_icon.EuiIcon, {
|
|
75
|
+
type: "sortRight",
|
|
76
|
+
"aria-label": defaultAriaLabel
|
|
77
|
+
}));
|
|
78
|
+
};
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.ICON_SIDES = exports.EuiFormControlLayoutIcons = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
11
|
var _loading = require("../../loading");
|
|
11
12
|
var _form_control_layout_clear_button = require("./form_control_layout_clear_button");
|
|
12
13
|
var _form_control_layout_custom_icon = require("./form_control_layout_custom_icon");
|
|
@@ -47,30 +48,19 @@ var EuiFormControlLayoutIcons = /*#__PURE__*/function (_Component) {
|
|
|
47
48
|
key: "render",
|
|
48
49
|
value: function render() {
|
|
49
50
|
var _this$props = this.props,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
_this$props$side = _this$props.side,
|
|
52
|
+
side = _this$props$side === void 0 ? 'left' : _this$props$side,
|
|
53
|
+
_this$props$iconsPosi = _this$props.iconsPosition,
|
|
54
|
+
iconsPosition = _this$props$iconsPosi === void 0 ? 'absolute' : _this$props$iconsPosi;
|
|
54
55
|
var customIcon = this.renderCustomIcon();
|
|
55
56
|
var loadingSpinner = this.renderLoadingSpinner();
|
|
56
57
|
var clearButton = this.renderClearButton();
|
|
57
58
|
var invalidIcon = this.renderInvalidIcon();
|
|
58
59
|
var dropdownIcon = this.renderDropdownIcon();
|
|
59
|
-
var
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}, customIcon);
|
|
64
|
-
}
|
|
65
|
-
var rightIcons;
|
|
66
|
-
|
|
67
|
-
// If the icon is on the right, it should be placed after the clear button in the DOM.
|
|
68
|
-
if (clearButton || loadingSpinner || isInvalid || isDropdown || customIcon && iconSide === 'right') {
|
|
69
|
-
rightIcons = (0, _react2.jsx)("div", {
|
|
70
|
-
className: "euiFormControlLayoutIcons euiFormControlLayoutIcons--right"
|
|
71
|
-
}, clearButton, loadingSpinner, invalidIcon, iconSide === 'right' ? customIcon : undefined, dropdownIcon);
|
|
72
|
-
}
|
|
73
|
-
return (0, _react2.jsx)(_react.Fragment, null, leftIcons, rightIcons);
|
|
60
|
+
var classes = (0, _classnames.default)('euiFormControlLayoutIcons', "euiFormControlLayoutIcons--".concat(side), "euiFormControlLayoutIcons--".concat(iconsPosition));
|
|
61
|
+
return (0, _react2.jsx)("div", {
|
|
62
|
+
className: classes
|
|
63
|
+
}, clearButton, loadingSpinner, invalidIcon, customIcon, dropdownIcon);
|
|
74
64
|
}
|
|
75
65
|
}, {
|
|
76
66
|
key: "renderCustomIcon",
|
|
@@ -160,6 +150,8 @@ EuiFormControlLayoutIcons.propTypes = {
|
|
|
160
150
|
color: _propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.any.isRequired]),
|
|
161
151
|
ref: _propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.func.isRequired])
|
|
162
152
|
}).isRequired]),
|
|
153
|
+
side: _propTypes.default.any,
|
|
154
|
+
iconsPosition: _propTypes.default.oneOf(["absolute", "static"]),
|
|
163
155
|
clear: _propTypes.default.shape({
|
|
164
156
|
className: _propTypes.default.string,
|
|
165
157
|
"aria-label": _propTypes.default.string,
|