@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.
Files changed (138) hide show
  1. package/README.md +30 -29
  2. package/dist/eui_theme_dark.css +70 -158
  3. package/dist/eui_theme_dark.min.css +1 -1
  4. package/dist/eui_theme_light.css +70 -158
  5. package/dist/eui_theme_light.min.css +1 -1
  6. package/es/components/basic_table/basic_table.a11y.js +202 -0
  7. package/es/components/basic_table/{table.a11y.js → in_memory_table.a11y.js} +1 -1
  8. package/es/components/date_picker/date_picker.js +23 -15
  9. package/es/components/date_picker/date_picker_range.js +36 -42
  10. package/es/components/date_picker/super_date_picker/super_date_picker.js +99 -84
  11. package/es/components/form/field_number/field_number.js +39 -8
  12. package/es/components/form/field_text/field_text.js +1 -1
  13. package/es/components/form/form_control_layout/form_control_layout.js +67 -30
  14. package/es/components/form/form_control_layout/form_control_layout_delimited.js +31 -11
  15. package/es/components/form/form_control_layout/form_control_layout_icons.js +12 -20
  16. package/es/components/form/range/dual_range.js +2 -4
  17. package/es/components/form/range/range.js +0 -2
  18. package/es/components/form/range/range_input.js +54 -13
  19. package/es/components/form/validatable_control/validatable_control.js +15 -5
  20. package/es/components/index.js +0 -1
  21. package/es/components/search_bar/query/ast_to_es_query_dsl.js +6 -1
  22. package/es/components/search_bar/query/ast_to_es_query_string.js +3 -0
  23. package/es/components/suggest/suggest.a11y.js +70 -0
  24. package/es/components/table/table.a11y.js +75 -0
  25. package/eui.d.ts +55 -173
  26. package/i18ntokens.json +26 -44
  27. package/lib/components/basic_table/basic_table.a11y.js +194 -0
  28. package/lib/components/basic_table/{table.a11y.js → in_memory_table.a11y.js} +2 -2
  29. package/lib/components/date_picker/date_picker.js +23 -15
  30. package/lib/components/date_picker/date_picker_range.js +35 -41
  31. package/lib/components/date_picker/super_date_picker/super_date_picker.js +99 -84
  32. package/lib/components/form/field_number/field_number.js +42 -8
  33. package/lib/components/form/field_text/field_text.js +1 -1
  34. package/lib/components/form/form_control_layout/form_control_layout.js +67 -35
  35. package/lib/components/form/form_control_layout/form_control_layout_delimited.js +31 -11
  36. package/lib/components/form/form_control_layout/form_control_layout_icons.js +11 -19
  37. package/lib/components/form/range/dual_range.js +2 -4
  38. package/lib/components/form/range/range.js +0 -2
  39. package/lib/components/form/range/range_input.js +52 -11
  40. package/lib/components/form/validatable_control/validatable_control.js +14 -12
  41. package/lib/components/index.js +0 -11
  42. package/lib/components/search_bar/query/ast_to_es_query_dsl.js +6 -1
  43. package/lib/components/search_bar/query/ast_to_es_query_string.js +3 -0
  44. package/lib/components/suggest/suggest.a11y.js +73 -0
  45. package/lib/components/table/table.a11y.js +78 -0
  46. package/optimize/es/components/basic_table/basic_table.a11y.js +194 -0
  47. package/optimize/es/components/basic_table/{table.a11y.js → in_memory_table.a11y.js} +1 -1
  48. package/optimize/es/components/date_picker/date_picker.js +17 -14
  49. package/optimize/es/components/date_picker/date_picker_range.js +20 -14
  50. package/optimize/es/components/date_picker/super_date_picker/super_date_picker.js +99 -84
  51. package/optimize/es/components/form/field_number/field_number.js +34 -8
  52. package/optimize/es/components/form/field_text/field_text.js +1 -1
  53. package/optimize/es/components/form/form_control_layout/form_control_layout.js +67 -30
  54. package/optimize/es/components/form/form_control_layout/form_control_layout_delimited.js +31 -11
  55. package/optimize/es/components/form/form_control_layout/form_control_layout_icons.js +10 -20
  56. package/optimize/es/components/form/range/dual_range.js +2 -4
  57. package/optimize/es/components/form/range/range.js +0 -2
  58. package/optimize/es/components/form/range/range_input.js +49 -12
  59. package/optimize/es/components/form/validatable_control/validatable_control.js +10 -5
  60. package/optimize/es/components/index.js +0 -1
  61. package/optimize/es/components/search_bar/query/ast_to_es_query_dsl.js +6 -1
  62. package/optimize/es/components/search_bar/query/ast_to_es_query_string.js +3 -0
  63. package/optimize/es/components/suggest/suggest.a11y.js +70 -0
  64. package/optimize/es/components/table/table.a11y.js +75 -0
  65. package/optimize/lib/components/basic_table/basic_table.a11y.js +188 -0
  66. package/{test-env/components/basic_table/table.a11y.js → optimize/lib/components/basic_table/in_memory_table.a11y.js} +2 -2
  67. package/optimize/lib/components/date_picker/date_picker.js +17 -14
  68. package/optimize/lib/components/date_picker/date_picker_range.js +19 -13
  69. package/optimize/lib/components/date_picker/super_date_picker/super_date_picker.js +99 -84
  70. package/optimize/lib/components/form/field_number/field_number.js +37 -8
  71. package/optimize/lib/components/form/field_text/field_text.js +1 -1
  72. package/optimize/lib/components/form/form_control_layout/form_control_layout.js +67 -35
  73. package/optimize/lib/components/form/form_control_layout/form_control_layout_delimited.js +31 -11
  74. package/optimize/lib/components/form/form_control_layout/form_control_layout_icons.js +9 -19
  75. package/optimize/lib/components/form/range/dual_range.js +2 -4
  76. package/optimize/lib/components/form/range/range.js +0 -2
  77. package/optimize/lib/components/form/range/range_input.js +47 -10
  78. package/optimize/lib/components/form/validatable_control/validatable_control.js +10 -4
  79. package/optimize/lib/components/index.js +0 -11
  80. package/optimize/lib/components/search_bar/query/ast_to_es_query_dsl.js +6 -1
  81. package/optimize/lib/components/search_bar/query/ast_to_es_query_string.js +3 -0
  82. package/optimize/lib/components/suggest/suggest.a11y.js +73 -0
  83. package/optimize/lib/components/table/table.a11y.js +78 -0
  84. package/package.json +1 -1
  85. package/src/components/date_picker/_date_picker_range.scss +0 -60
  86. package/src/components/date_picker/super_date_picker/_super_date_picker.scss +23 -11
  87. package/src/components/date_picker/super_date_picker/_variables.scss +3 -0
  88. package/src/components/date_picker/super_date_picker/date_popover/_date_popover_button.scss +5 -7
  89. package/src/components/form/form_control_layout/_form_control_layout.scss +2 -2
  90. package/src/components/form/form_control_layout/_form_control_layout_delimited.scss +12 -36
  91. package/src/components/form/form_control_layout/_form_control_layout_icons.scss +27 -6
  92. package/src/themes/amsterdam/overrides/_date_picker.scss +0 -14
  93. package/src/themes/amsterdam/overrides/_index.scss +0 -1
  94. package/test-env/components/basic_table/basic_table.a11y.js +188 -0
  95. package/{optimize/lib/components/basic_table/table.a11y.js → test-env/components/basic_table/in_memory_table.a11y.js} +2 -2
  96. package/test-env/components/date_picker/date_picker.js +23 -15
  97. package/test-env/components/date_picker/date_picker_range.js +35 -41
  98. package/test-env/components/date_picker/super_date_picker/super_date_picker.js +99 -84
  99. package/test-env/components/form/field_number/field_number.js +37 -8
  100. package/test-env/components/form/field_text/field_text.js +1 -1
  101. package/test-env/components/form/form_control_layout/form_control_layout.js +68 -35
  102. package/test-env/components/form/form_control_layout/form_control_layout_delimited.js +31 -11
  103. package/test-env/components/form/form_control_layout/form_control_layout_icons.js +11 -19
  104. package/test-env/components/form/range/dual_range.js +2 -4
  105. package/test-env/components/form/range/range.js +0 -2
  106. package/test-env/components/form/range/range_input.js +47 -11
  107. package/test-env/components/form/validatable_control/validatable_control.js +9 -4
  108. package/test-env/components/index.js +0 -11
  109. package/test-env/components/search_bar/query/ast_to_es_query_dsl.js +6 -1
  110. package/test-env/components/search_bar/query/ast_to_es_query_string.js +3 -0
  111. package/test-env/components/suggest/suggest.a11y.js +73 -0
  112. package/test-env/components/table/table.a11y.js +78 -0
  113. package/es/components/inline_edit/index.js +0 -10
  114. package/es/components/inline_edit/inline_edit.styles.js +0 -15
  115. package/es/components/inline_edit/inline_edit_form.js +0 -190
  116. package/es/components/inline_edit/inline_edit_text.js +0 -97
  117. package/es/components/inline_edit/inline_edit_title.js +0 -105
  118. package/lib/components/inline_edit/index.js +0 -19
  119. package/lib/components/inline_edit/inline_edit.styles.js +0 -22
  120. package/lib/components/inline_edit/inline_edit_form.js +0 -193
  121. package/lib/components/inline_edit/inline_edit_text.js +0 -97
  122. package/lib/components/inline_edit/inline_edit_title.js +0 -106
  123. package/optimize/es/components/inline_edit/index.js +0 -10
  124. package/optimize/es/components/inline_edit/inline_edit.styles.js +0 -15
  125. package/optimize/es/components/inline_edit/inline_edit_form.js +0 -133
  126. package/optimize/es/components/inline_edit/inline_edit_text.js +0 -52
  127. package/optimize/es/components/inline_edit/inline_edit_title.js +0 -56
  128. package/optimize/lib/components/inline_edit/index.js +0 -19
  129. package/optimize/lib/components/inline_edit/inline_edit.styles.js +0 -22
  130. package/optimize/lib/components/inline_edit/inline_edit_form.js +0 -144
  131. package/optimize/lib/components/inline_edit/inline_edit_text.js +0 -52
  132. package/optimize/lib/components/inline_edit/inline_edit_title.js +0 -57
  133. package/src/themes/amsterdam/overrides/_date_popover_button.scss +0 -14
  134. package/test-env/components/inline_edit/index.js +0 -19
  135. package/test-env/components/inline_edit/inline_edit.styles.js +0 -22
  136. package/test-env/components/inline_edit/inline_edit_form.js +0 -196
  137. package/test-env/components/inline_edit/inline_edit_text.js +0 -96
  138. package/test-env/components/inline_edit/inline_edit_title.js +0 -105
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["adjustDateOnChange", "calendarClassName", "className", "customInput", "dateFormat", "dayClassName", "disabled", "excludeDates", "filterDate", "fullWidth", "iconType", "injectTimes", "inline", "inputRef", "isInvalid", "isLoading", "locale", "maxDate", "maxTime", "minDate", "minTime", "onChange", "onClear", "openToDate", "placeholder", "popperClassName", "popoverPlacement", "selected", "shadow", "shouldCloseOnSelect", "showIcon", "showTimeSelect", "showTimeSelectOnly", "timeFormat", "utcOffset"];
4
+ var _excluded = ["adjustDateOnChange", "calendarClassName", "className", "controlOnly", "customInput", "dateFormat", "dayClassName", "disabled", "excludeDates", "filterDate", "fullWidth", "iconType", "injectTimes", "inline", "inputRef", "isInvalid", "isLoading", "locale", "maxDate", "maxTime", "minDate", "minTime", "onChange", "onClear", "openToDate", "placeholder", "popperClassName", "popoverPlacement", "selected", "shadow", "shouldCloseOnSelect", "showIcon", "showTimeSelect", "showTimeSelectOnly", "timeFormat", "utcOffset"];
5
5
  /*
6
6
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
7
7
  * or more contributor license agreements. Licensed under the Elastic License
@@ -54,6 +54,7 @@ export var EuiDatePicker = function EuiDatePicker(_ref) {
54
54
  adjustDateOnChange = _ref$adjustDateOnChan === void 0 ? true : _ref$adjustDateOnChan,
55
55
  calendarClassName = _ref.calendarClassName,
56
56
  className = _ref.className,
57
+ controlOnly = _ref.controlOnly,
57
58
  customInput = _ref.customInput,
58
59
  _ref$dateFormat = _ref.dateFormat,
59
60
  dateFormat = _ref$dateFormat === void 0 ? euiDatePickerDefaultDateFormat : _ref$dateFormat,
@@ -99,7 +100,7 @@ export var EuiDatePicker = function EuiDatePicker(_ref) {
99
100
  'euiDatePicker--shadow': shadow,
100
101
  'euiDatePicker--inline': inline
101
102
  });
102
- var numIconsClass = getFormControlClassNameForIconCount({
103
+ var numIconsClass = controlOnly ? false : getFormControlClassNameForIconCount({
103
104
  isInvalid: isInvalid,
104
105
  isLoading: isLoading
105
106
  });
@@ -140,17 +141,7 @@ export var EuiDatePicker = function EuiDatePicker(_ref) {
140
141
  controlEl: inputValidityRef
141
142
  });
142
143
  var inputRefs = useCombinedRefs([inputRef, setInputValidityRef]);
143
- return ___EmotionJSX("span", {
144
- className: classes
145
- }, ___EmotionJSX(EuiFormControlLayout, {
146
- icon: optionalIcon,
147
- fullWidth: fullWidth,
148
- clear: selected && onClear ? {
149
- onClick: onClear
150
- } : undefined,
151
- isLoading: isLoading,
152
- isInvalid: isInvalid
153
- }, ___EmotionJSX(EuiI18nConsumer, null, function (_ref2) {
144
+ var control = ___EmotionJSX(EuiI18nConsumer, null, function (_ref2) {
154
145
  var contextLocale = _ref2.locale;
155
146
  return ___EmotionJSX(ReactDatePicker, _extends({
156
147
  adjustDateOnChange: adjustDateOnChange,
@@ -186,5 +177,17 @@ export var EuiDatePicker = function EuiDatePicker(_ref) {
186
177
  accessibleMode: true,
187
178
  popperPlacement: popoverPlacement
188
179
  }, rest));
189
- })));
180
+ });
181
+ if (controlOnly) return control;
182
+ return ___EmotionJSX("span", {
183
+ className: classes
184
+ }, ___EmotionJSX(EuiFormControlLayout, {
185
+ icon: optionalIcon,
186
+ fullWidth: fullWidth,
187
+ clear: selected && onClear ? {
188
+ onClick: onClear
189
+ } : undefined,
190
+ isLoading: isLoading,
191
+ isInvalid: isInvalid
192
+ }, control));
190
193
  };
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["children", "className", "startDateControl", "endDateControl", "iconType", "fullWidth", "isCustom", "readOnly", "isInvalid", "disabled", "onFocus", "onBlur"];
3
+ var _excluded = ["children", "className", "startDateControl", "endDateControl", "iconType", "fullWidth", "isCustom", "readOnly", "isInvalid", "disabled", "onFocus", "onBlur", "append", "prepend"];
4
4
  /*
5
5
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
6
6
  * or more contributor license agreements. Licensed under the Elastic License
@@ -9,9 +9,9 @@ var _excluded = ["children", "className", "startDateControl", "endDateControl",
9
9
  * Side Public License, v 1.
10
10
  */
11
11
 
12
- import React, { Fragment, cloneElement } from 'react';
12
+ import React, { cloneElement } from 'react';
13
13
  import classNames from 'classnames';
14
- import { EuiIcon } from '../icon';
14
+ import { EuiFormControlLayoutDelimited } from '../form';
15
15
  import { jsx as ___EmotionJSX } from "@emotion/react";
16
16
  export var EuiDatePickerRange = function EuiDatePickerRange(_ref) {
17
17
  var children = _ref.children,
@@ -27,6 +27,8 @@ export var EuiDatePickerRange = function EuiDatePickerRange(_ref) {
27
27
  disabled = _ref.disabled,
28
28
  _onFocus = _ref.onFocus,
29
29
  _onBlur = _ref.onBlur,
30
+ append = _ref.append,
31
+ prepend = _ref.prepend,
30
32
  rest = _objectWithoutProperties(_ref, _excluded);
31
33
  var classes = classNames('euiDatePickerRange', {
32
34
  'euiDatePickerRange--fullWidth': fullWidth,
@@ -38,8 +40,8 @@ export var EuiDatePickerRange = function EuiDatePickerRange(_ref) {
38
40
  var endControl = endDateControl;
39
41
  if (!isCustom) {
40
42
  startControl = /*#__PURE__*/cloneElement(startDateControl, {
41
- iconType: typeof iconType === 'boolean' ? undefined : iconType,
42
- showIcon: !!iconType,
43
+ controlOnly: true,
44
+ showIcon: false,
43
45
  fullWidth: fullWidth,
44
46
  readOnly: readOnly,
45
47
  disabled: disabled || startDateControl.props.disabled,
@@ -57,6 +59,7 @@ export var EuiDatePickerRange = function EuiDatePickerRange(_ref) {
57
59
  }
58
60
  });
59
61
  endControl = /*#__PURE__*/cloneElement(endDateControl, {
62
+ controlOnly: true,
60
63
  showIcon: false,
61
64
  fullWidth: fullWidth,
62
65
  readOnly: readOnly,
@@ -76,13 +79,16 @@ export var EuiDatePickerRange = function EuiDatePickerRange(_ref) {
76
79
  }
77
80
  });
78
81
  }
79
- var delimiter = ___EmotionJSX("span", {
80
- className: "euiDatePickerRange__delimeter"
81
- }, ___EmotionJSX(EuiIcon, {
82
- color: isInvalid ? 'danger' : 'subdued',
83
- type: "sortRight"
84
- }));
85
- return ___EmotionJSX("div", _extends({
86
- className: classes
87
- }, rest), children ? children : ___EmotionJSX(Fragment, null, startControl, delimiter, endControl));
82
+ return ___EmotionJSX(EuiFormControlLayoutDelimited, _extends({
83
+ icon: iconType === true ? 'calendar' : iconType || undefined,
84
+ className: classes,
85
+ startControl: startControl,
86
+ endControl: endControl,
87
+ fullWidth: fullWidth,
88
+ readOnly: readOnly,
89
+ isDisabled: disabled,
90
+ isInvalid: isInvalid,
91
+ append: append,
92
+ prepend: prepend
93
+ }, rest));
88
94
  };
@@ -198,6 +198,36 @@ export var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
198
198
  _this.asyncInterval = new AsyncInterval(handler, refreshInterval);
199
199
  }
200
200
  });
201
+ _defineProperty(_assertThisInitialized(_this), "renderQuickSelect", function () {
202
+ var _this$props2 = _this.props,
203
+ start = _this$props2.start,
204
+ end = _this$props2.end,
205
+ customQuickSelectPanels = _this$props2.customQuickSelectPanels,
206
+ customQuickSelectRender = _this$props2.customQuickSelectRender,
207
+ commonlyUsedRanges = _this$props2.commonlyUsedRanges,
208
+ timeOptions = _this$props2.timeOptions,
209
+ dateFormat = _this$props2.dateFormat,
210
+ onRefreshChange = _this$props2.onRefreshChange,
211
+ recentlyUsedRanges = _this$props2.recentlyUsedRanges,
212
+ refreshInterval = _this$props2.refreshInterval,
213
+ isPaused = _this$props2.isPaused,
214
+ isDisabled = _this$props2.isDisabled;
215
+ return ___EmotionJSX(EuiQuickSelectPopover, {
216
+ applyRefreshInterval: onRefreshChange ? _this.onRefreshChange : undefined,
217
+ applyTime: _this.applyQuickTime,
218
+ commonlyUsedRanges: commonlyUsedRanges,
219
+ customQuickSelectPanels: customQuickSelectPanels,
220
+ customQuickSelectRender: customQuickSelectRender,
221
+ dateFormat: dateFormat,
222
+ end: end,
223
+ isDisabled: isDisabled,
224
+ isPaused: isPaused,
225
+ recentlyUsedRanges: recentlyUsedRanges,
226
+ refreshInterval: refreshInterval,
227
+ start: start,
228
+ timeOptions: timeOptions
229
+ });
230
+ });
201
231
  _defineProperty(_assertThisInitialized(_this), "renderDatePickerRange", function () {
202
232
  var _this$state = _this.state,
203
233
  end = _this$state.end,
@@ -207,24 +237,47 @@ export var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
207
237
  isStartDatePopoverOpen = _this$state.isStartDatePopoverOpen,
208
238
  showPrettyDuration = _this$state.showPrettyDuration,
209
239
  start = _this$state.start;
210
- var _this$props2 = _this.props,
211
- commonlyUsedRanges = _this$props2.commonlyUsedRanges,
212
- timeOptions = _this$props2.timeOptions,
213
- dateFormat = _this$props2.dateFormat,
214
- isDisabled = _this$props2.isDisabled,
215
- locale = _this$props2.locale,
216
- timeFormat = _this$props2.timeFormat,
217
- utcOffset = _this$props2.utcOffset,
218
- compressed = _this$props2.compressed,
219
- onFocus = _this$props2.onFocus;
240
+ var _this$props3 = _this.props,
241
+ isQuickSelectOnly = _this$props3.isQuickSelectOnly,
242
+ showUpdateButton = _this$props3.showUpdateButton,
243
+ commonlyUsedRanges = _this$props3.commonlyUsedRanges,
244
+ timeOptions = _this$props3.timeOptions,
245
+ dateFormat = _this$props3.dateFormat,
246
+ refreshInterval = _this$props3.refreshInterval,
247
+ isPaused = _this$props3.isPaused,
248
+ isDisabled = _this$props3.isDisabled,
249
+ isLoading = _this$props3.isLoading,
250
+ locale = _this$props3.locale,
251
+ timeFormat = _this$props3.timeFormat,
252
+ utcOffset = _this$props3.utcOffset,
253
+ compressed = _this$props3.compressed,
254
+ onFocus = _this$props3.onFocus,
255
+ className = _this$props3.className,
256
+ dataTestSubj = _this$props3['data-test-subj'];
257
+ var autoRefreshAppend = !isPaused ? ___EmotionJSX(EuiAutoRefreshButton, {
258
+ refreshInterval: refreshInterval,
259
+ isDisabled: isDisabled,
260
+ isPaused: isPaused,
261
+ onRefreshChange: _this.onRefreshChange,
262
+ shortHand: true
263
+ }) : undefined;
264
+ var formControlLayoutProps = {
265
+ className: classNames('euiSuperDatePicker', className),
266
+ compressed: compressed,
267
+ isInvalid: isInvalid,
268
+ isLoading: isLoading && !showUpdateButton,
269
+ disabled: isDisabled,
270
+ prepend: _this.renderQuickSelect(),
271
+ append: autoRefreshAppend,
272
+ 'data-test-subj': dataTestSubj
273
+ };
274
+ if (isQuickSelectOnly) {
275
+ return ___EmotionJSX(EuiFormControlLayout, _extends({
276
+ iconsPosition: "static"
277
+ }, formControlLayoutProps));
278
+ }
220
279
  if (showPrettyDuration && !isStartDatePopoverOpen && !isEndDatePopoverOpen) {
221
- return ___EmotionJSX(EuiDatePickerRange, {
222
- className: "euiDatePickerRange--inGroup",
223
- iconType: false,
224
- isCustom: true,
225
- startDateControl: ___EmotionJSX("div", null),
226
- endDateControl: ___EmotionJSX("div", null)
227
- }, ___EmotionJSX("button", {
280
+ return ___EmotionJSX(EuiFormControlLayout, formControlLayoutProps, ___EmotionJSX("button", {
228
281
  className: classNames('euiSuperDatePicker__prettyFormat', {
229
282
  'euiSuperDatePicker__prettyFormat--disabled': isDisabled
230
283
  }),
@@ -241,12 +294,12 @@ export var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
241
294
  }
242
295
  return ___EmotionJSX(EuiI18nConsumer, null, function (_ref4) {
243
296
  var contextLocale = _ref4.locale;
244
- return ___EmotionJSX(EuiDatePickerRange, {
245
- className: "euiDatePickerRange--inGroup",
246
- iconType: false,
247
- isInvalid: isInvalid,
248
- disabled: isDisabled,
297
+ return ___EmotionJSX(EuiDatePickerRange, _extends({}, formControlLayoutProps, {
298
+ className: classNames(formControlLayoutProps.className, {
299
+ 'euiSuperDatePicker--needsUpdating': hasChanged && !isDisabled && !isInvalid
300
+ }),
249
301
  isCustom: true,
302
+ iconType: false,
250
303
  startDateControl: ___EmotionJSX(EuiDatePopoverButton, {
251
304
  className: "euiSuperDatePicker__startPopoverButton",
252
305
  compressed: compressed,
@@ -289,15 +342,15 @@ export var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
289
342
  onFocus: onFocus
290
343
  }
291
344
  })
292
- });
345
+ }));
293
346
  });
294
347
  });
295
348
  _defineProperty(_assertThisInitialized(_this), "handleClickUpdateButton", function () {
296
349
  if (!_this.state.hasChanged && _this.props.onRefresh) {
297
- var _this$props3 = _this.props,
298
- start = _this$props3.start,
299
- end = _this$props3.end,
300
- refreshInterval = _this$props3.refreshInterval;
350
+ var _this$props4 = _this.props,
351
+ start = _this$props4.start,
352
+ end = _this$props4.end,
353
+ refreshInterval = _this$props4.refreshInterval;
301
354
  _this.props.onRefresh({
302
355
  start: start,
303
356
  end: end,
@@ -308,12 +361,12 @@ export var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
308
361
  }
309
362
  });
310
363
  _defineProperty(_assertThisInitialized(_this), "renderUpdateButton", function () {
311
- var _this$props4 = _this.props,
312
- isLoading = _this$props4.isLoading,
313
- isDisabled = _this$props4.isDisabled,
314
- updateButtonProps = _this$props4.updateButtonProps,
315
- showUpdateButton = _this$props4.showUpdateButton,
316
- compressed = _this$props4.compressed;
364
+ var _this$props5 = _this.props,
365
+ isLoading = _this$props5.isLoading,
366
+ isDisabled = _this$props5.isDisabled,
367
+ updateButtonProps = _this$props5.updateButtonProps,
368
+ showUpdateButton = _this$props5.showUpdateButton,
369
+ compressed = _this$props5.compressed;
317
370
  if (!showUpdateButton) return null;
318
371
  return ___EmotionJSX(EuiFlexItem, {
319
372
  grow: false
@@ -333,52 +386,21 @@ export var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
333
386
  _createClass(EuiSuperDatePickerInternal, [{
334
387
  key: "render",
335
388
  value: function render() {
336
- var _this$props5 = this.props,
337
- commonlyUsedRanges = _this$props5.commonlyUsedRanges,
338
- timeOptions = _this$props5.timeOptions,
339
- customQuickSelectPanels = _this$props5.customQuickSelectPanels,
340
- customQuickSelectRender = _this$props5.customQuickSelectRender,
341
- dateFormat = _this$props5.dateFormat,
342
- end = _this$props5.end,
343
- isAutoRefreshOnly = _this$props5.isAutoRefreshOnly,
344
- isDisabled = _this$props5.isDisabled,
345
- isPaused = _this$props5.isPaused,
346
- onRefreshChange = _this$props5.onRefreshChange,
347
- recentlyUsedRanges = _this$props5.recentlyUsedRanges,
348
- refreshInterval = _this$props5.refreshInterval,
349
- showUpdateButton = _this$props5.showUpdateButton,
350
- start = _this$props5.start,
351
- dataTestSubj = _this$props5['data-test-subj'],
352
- _width = _this$props5.width,
353
- isQuickSelectOnly = _this$props5.isQuickSelectOnly,
354
- compressed = _this$props5.compressed,
355
- className = _this$props5.className;
389
+ var _this$props6 = this.props,
390
+ isAutoRefreshOnly = _this$props6.isAutoRefreshOnly,
391
+ isDisabled = _this$props6.isDisabled,
392
+ isPaused = _this$props6.isPaused,
393
+ onRefreshChange = _this$props6.onRefreshChange,
394
+ refreshInterval = _this$props6.refreshInterval,
395
+ showUpdateButton = _this$props6.showUpdateButton,
396
+ dataTestSubj = _this$props6['data-test-subj'],
397
+ _width = _this$props6.width,
398
+ isQuickSelectOnly = _this$props6.isQuickSelectOnly,
399
+ compressed = _this$props6.compressed,
400
+ className = _this$props6.className;
356
401
 
357
402
  // Force reduction in width if showing quick select only
358
403
  var width = isQuickSelectOnly ? 'auto' : _width;
359
- var autoRefreshAppend = !isPaused ? ___EmotionJSX(EuiAutoRefreshButton, {
360
- className: "euiFormControlLayout__append",
361
- refreshInterval: refreshInterval,
362
- isDisabled: isDisabled,
363
- isPaused: isPaused,
364
- onRefreshChange: this.onRefreshChange,
365
- shortHand: true
366
- }) : undefined;
367
- var quickSelect = ___EmotionJSX(EuiQuickSelectPopover, {
368
- applyRefreshInterval: onRefreshChange ? this.onRefreshChange : undefined,
369
- applyTime: this.applyQuickTime,
370
- commonlyUsedRanges: commonlyUsedRanges,
371
- customQuickSelectPanels: customQuickSelectPanels,
372
- customQuickSelectRender: customQuickSelectRender,
373
- dateFormat: dateFormat,
374
- end: end,
375
- isDisabled: isDisabled,
376
- isPaused: isPaused,
377
- recentlyUsedRanges: recentlyUsedRanges,
378
- refreshInterval: refreshInterval,
379
- start: start,
380
- timeOptions: timeOptions
381
- });
382
404
  var flexWrapperClasses = classNames('euiSuperDatePicker__flexWrapper', {
383
405
  'euiSuperDatePicker__flexWrapper--noUpdateButton': !showUpdateButton,
384
406
  'euiSuperDatePicker__flexWrapper--isAutoRefreshOnly': isAutoRefreshOnly,
@@ -399,14 +421,7 @@ export var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
399
421
  isDisabled: isDisabled,
400
422
  "data-test-subj": dataTestSubj,
401
423
  className: className
402
- })) : ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiFlexItem, null, ___EmotionJSX(EuiFormControlLayout, {
403
- className: classNames('euiSuperDatePicker', className),
404
- compressed: compressed,
405
- isDisabled: isDisabled,
406
- prepend: quickSelect,
407
- append: autoRefreshAppend,
408
- "data-test-subj": dataTestSubj
409
- }, !isQuickSelectOnly && this.renderDatePickerRange())), this.renderUpdateButton()));
424
+ })) : ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiFlexItem, null, this.renderDatePickerRange()), this.renderUpdateButton()));
410
425
  }
411
426
  }], [{
412
427
  key: "getDerivedStateFromProps",
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["className", "icon", "id", "placeholder", "name", "min", "max", "value", "isInvalid", "fullWidth", "isLoading", "compressed", "prepend", "append", "inputRef", "readOnly", "controlOnly"];
4
+ var _excluded = ["className", "icon", "id", "placeholder", "name", "min", "max", "value", "isInvalid", "fullWidth", "isLoading", "compressed", "prepend", "append", "inputRef", "readOnly", "controlOnly", "onKeyDown"];
4
5
  /*
5
6
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
6
7
  * or more contributor license agreements. Licensed under the Elastic License
@@ -9,12 +10,13 @@ var _excluded = ["className", "icon", "id", "placeholder", "name", "min", "max",
9
10
  * Side Public License, v 1.
10
11
  */
11
12
 
12
- import React from 'react';
13
+ import React, { useState, useRef, useCallback } from 'react';
13
14
  import classNames from 'classnames';
14
- import { EuiFormControlLayout } from '../form_control_layout';
15
+ import { useCombinedRefs } from '../../../services';
15
16
  import { EuiValidatableControl } from '../validatable_control';
16
- import { useFormContext } from '../eui_form_context';
17
+ import { EuiFormControlLayout } from '../form_control_layout';
17
18
  import { getFormControlClassNameForIconCount } from '../form_control_layout/_num_icons';
19
+ import { useFormContext } from '../eui_form_context';
18
20
  import { jsx as ___EmotionJSX } from "@emotion/react";
19
21
  export var EuiFieldNumber = function EuiFieldNumber(props) {
20
22
  var _useFormContext = useFormContext(),
@@ -39,9 +41,31 @@ export var EuiFieldNumber = function EuiFieldNumber(props) {
39
41
  inputRef = props.inputRef,
40
42
  readOnly = props.readOnly,
41
43
  controlOnly = props.controlOnly,
44
+ _onKeyDown = props.onKeyDown,
42
45
  rest = _objectWithoutProperties(props, _excluded);
43
- var numIconsClass = getFormControlClassNameForIconCount({
44
- isInvalid: isInvalid,
46
+
47
+ // Attempt to determine additional invalid state. The native number input
48
+ // will set :invalid state automatically, but we need to also set
49
+ // `aria-invalid` as well as display an icon. We also want to *not* set this on
50
+ // EuiValidatableControl, in order to not override custom validity messages
51
+ var _useState = useState(false),
52
+ _useState2 = _slicedToArray(_useState, 2),
53
+ isNativelyInvalid = _useState2[0],
54
+ setIsNativelyInvalid = _useState2[1];
55
+ var validityRef = useRef(null);
56
+ var setRefs = useCombinedRefs([validityRef, inputRef]);
57
+
58
+ // Note that we can't use hook into `onChange` because browsers don't emit change events
59
+ // for invalid values - see https://github.com/facebook/react/issues/16554
60
+ var onKeyDown = useCallback(function (e) {
61
+ _onKeyDown === null || _onKeyDown === void 0 ? void 0 : _onKeyDown(e);
62
+ // Wait a beat before checking validity - we can't use `e.target` as it's stale
63
+ requestAnimationFrame(function () {
64
+ setIsNativelyInvalid(!validityRef.current.validity.valid);
65
+ });
66
+ }, [_onKeyDown]);
67
+ var numIconsClass = controlOnly ? false : getFormControlClassNameForIconCount({
68
+ isInvalid: isInvalid || isNativelyInvalid,
45
69
  isLoading: isLoading
46
70
  });
47
71
  var classes = classNames('euiFieldNumber', className, numIconsClass, {
@@ -63,7 +87,9 @@ export var EuiFieldNumber = function EuiFieldNumber(props) {
63
87
  placeholder: placeholder,
64
88
  readOnly: readOnly,
65
89
  className: classes,
66
- ref: inputRef
90
+ ref: setRefs,
91
+ onKeyDown: onKeyDown,
92
+ "aria-invalid": isInvalid || isNativelyInvalid
67
93
  }, rest)));
68
94
  if (controlOnly) {
69
95
  return control;
@@ -72,7 +98,7 @@ export var EuiFieldNumber = function EuiFieldNumber(props) {
72
98
  icon: icon,
73
99
  fullWidth: fullWidth,
74
100
  isLoading: isLoading,
75
- isInvalid: isInvalid,
101
+ isInvalid: isInvalid || isNativelyInvalid,
76
102
  compressed: compressed,
77
103
  readOnly: readOnly,
78
104
  prepend: prepend,
@@ -36,7 +36,7 @@ export var EuiFieldText = function EuiFieldText(props) {
36
36
  readOnly = props.readOnly,
37
37
  controlOnly = props.controlOnly,
38
38
  rest = _objectWithoutProperties(props, _excluded);
39
- var numIconsClass = getFormControlClassNameForIconCount({
39
+ var numIconsClass = controlOnly ? false : getFormControlClassNameForIconCount({
40
40
  isInvalid: isInvalid,
41
41
  isLoading: isLoading
42
42
  });
@@ -2,11 +2,12 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
4
  import _createClass from "@babel/runtime/helpers/createClass";
5
+ import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
5
6
  import _inherits from "@babel/runtime/helpers/inherits";
6
7
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
8
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
9
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
- var _excluded = ["children", "icon", "clear", "fullWidth", "isLoading", "isDisabled", "compressed", "className", "prepend", "append", "readOnly", "isInvalid", "isDropdown", "inputId"];
10
+ var _excluded = ["children", "icon", "iconsPosition", "clear", "fullWidth", "isLoading", "isDisabled", "compressed", "className", "prepend", "append", "readOnly", "isInvalid", "isDropdown", "inputId"];
10
11
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
12
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12
13
  /*
@@ -23,36 +24,79 @@ import { EuiFormControlLayoutIcons } from './form_control_layout_icons';
23
24
  import { EuiFormLabel } from '../form_label';
24
25
  import { FormContext } from '../eui_form_context';
25
26
  import { jsx as ___EmotionJSX } from "@emotion/react";
26
- export { ICON_SIDES } from './form_control_layout_icons';
27
27
  export var EuiFormControlLayout = /*#__PURE__*/function (_Component) {
28
28
  _inherits(EuiFormControlLayout, _Component);
29
29
  var _super = _createSuper(EuiFormControlLayout);
30
30
  function EuiFormControlLayout() {
31
+ var _this;
31
32
  _classCallCheck(this, EuiFormControlLayout);
32
- return _super.apply(this, arguments);
33
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
34
+ args[_key] = arguments[_key];
35
+ }
36
+ _this = _super.call.apply(_super, [this].concat(args));
37
+ _defineProperty(_assertThisInitialized(_this), "renderLeftIcons", function () {
38
+ var _this$props = _this.props,
39
+ icon = _this$props.icon,
40
+ iconsPosition = _this$props.iconsPosition,
41
+ compressed = _this$props.compressed;
42
+ var leftCustomIcon = icon && (icon === null || icon === void 0 ? void 0 : icon.side) !== 'right' ? icon : undefined;
43
+ return leftCustomIcon ? ___EmotionJSX(EuiFormControlLayoutIcons, {
44
+ side: "left",
45
+ icon: leftCustomIcon,
46
+ iconsPosition: iconsPosition,
47
+ compressed: compressed
48
+ }) : null;
49
+ });
50
+ _defineProperty(_assertThisInitialized(_this), "renderRightIcons", function () {
51
+ var _this$props2 = _this.props,
52
+ icon = _this$props2.icon,
53
+ iconsPosition = _this$props2.iconsPosition,
54
+ clear = _this$props2.clear,
55
+ compressed = _this$props2.compressed,
56
+ isLoading = _this$props2.isLoading,
57
+ isInvalid = _this$props2.isInvalid,
58
+ isDisabled = _this$props2.isDisabled,
59
+ readOnly = _this$props2.readOnly,
60
+ isDropdown = _this$props2.isDropdown;
61
+ var hasDropdownIcon = !readOnly && !isDisabled && isDropdown;
62
+ var rightCustomIcon = icon && (icon === null || icon === void 0 ? void 0 : icon.side) === 'right' ? icon : undefined;
63
+ var hasRightIcons = rightCustomIcon || clear || isLoading || isInvalid || hasDropdownIcon;
64
+ return hasRightIcons ? ___EmotionJSX(EuiFormControlLayoutIcons, {
65
+ side: "right",
66
+ icon: rightCustomIcon,
67
+ iconsPosition: iconsPosition,
68
+ compressed: compressed,
69
+ clear: clear,
70
+ isLoading: isLoading,
71
+ isInvalid: isInvalid,
72
+ isDropdown: hasDropdownIcon
73
+ }) : null;
74
+ });
75
+ return _this;
33
76
  }
34
77
  _createClass(EuiFormControlLayout, [{
35
78
  key: "render",
36
79
  value: function render() {
37
80
  var _ref = this.context,
38
81
  defaultFullWidth = _ref.defaultFullWidth;
39
- var _this$props = this.props,
40
- children = _this$props.children,
41
- icon = _this$props.icon,
42
- clear = _this$props.clear,
43
- _this$props$fullWidth = _this$props.fullWidth,
44
- fullWidth = _this$props$fullWidth === void 0 ? defaultFullWidth : _this$props$fullWidth,
45
- isLoading = _this$props.isLoading,
46
- isDisabled = _this$props.isDisabled,
47
- compressed = _this$props.compressed,
48
- className = _this$props.className,
49
- prepend = _this$props.prepend,
50
- append = _this$props.append,
51
- readOnly = _this$props.readOnly,
52
- invalid = _this$props.isInvalid,
53
- isDropdown = _this$props.isDropdown,
54
- inputId = _this$props.inputId,
55
- rest = _objectWithoutProperties(_this$props, _excluded);
82
+ var _this$props3 = this.props,
83
+ children = _this$props3.children,
84
+ icon = _this$props3.icon,
85
+ iconsPosition = _this$props3.iconsPosition,
86
+ clear = _this$props3.clear,
87
+ _this$props3$fullWidt = _this$props3.fullWidth,
88
+ fullWidth = _this$props3$fullWidt === void 0 ? defaultFullWidth : _this$props3$fullWidt,
89
+ isLoading = _this$props3.isLoading,
90
+ isDisabled = _this$props3.isDisabled,
91
+ compressed = _this$props3.compressed,
92
+ className = _this$props3.className,
93
+ prepend = _this$props3.prepend,
94
+ append = _this$props3.append,
95
+ readOnly = _this$props3.readOnly,
96
+ isInvalid = _this$props3.isInvalid,
97
+ isDropdown = _this$props3.isDropdown,
98
+ inputId = _this$props3.inputId,
99
+ rest = _objectWithoutProperties(_this$props3, _excluded);
56
100
  var classes = classNames('euiFormControlLayout', {
57
101
  'euiFormControlLayout--fullWidth': fullWidth,
58
102
  'euiFormControlLayout--compressed': compressed,
@@ -66,19 +110,12 @@ export var EuiFormControlLayout = /*#__PURE__*/function (_Component) {
66
110
  className: classes
67
111
  }, rest), prependNodes, ___EmotionJSX("div", {
68
112
  className: "euiFormControlLayout__childrenWrapper"
69
- }, children, ___EmotionJSX(EuiFormControlLayoutIcons, {
70
- icon: icon,
71
- clear: clear,
72
- compressed: compressed,
73
- isLoading: isLoading,
74
- isInvalid: invalid,
75
- isDropdown: !readOnly && !isDisabled && isDropdown
76
- })), appendNodes);
113
+ }, this.renderLeftIcons(), children, this.renderRightIcons()), appendNodes);
77
114
  }
78
115
  }, {
79
116
  key: "renderSideNode",
80
117
  value: function renderSideNode(side, nodes, inputId) {
81
- var _this = this;
118
+ var _this2 = this;
82
119
  if (!nodes) {
83
120
  return;
84
121
  }
@@ -86,7 +123,7 @@ export var EuiFormControlLayout = /*#__PURE__*/function (_Component) {
86
123
  return this.createFormLabel(side, nodes, inputId);
87
124
  }
88
125
  var appendNodes = React.Children.map(nodes, function (item, index) {
89
- return typeof item === 'string' ? _this.createFormLabel(side, item, inputId) : _this.createSideNode(side, item, index);
126
+ return typeof item === 'string' ? _this2.createFormLabel(side, item, inputId) : _this2.createSideNode(side, item, index);
90
127
  });
91
128
  return appendNodes;
92
129
  }