@elastic/eui 116.3.0 → 116.3.1-snapshot.1782148316870

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 (199) hide show
  1. package/es/components/avatar/avatar.js +4 -0
  2. package/es/components/avatar/avatar.styles.js +16 -16
  3. package/es/components/banner/banner.js +1 -2
  4. package/es/components/banner/banner.styles.js +1 -1
  5. package/es/components/basic_table/basic_table.js +35 -5
  6. package/es/components/basic_table/basic_table.styles.js +19 -1
  7. package/es/components/basic_table/in_memory_table.js +17 -0
  8. package/es/components/basic_table/index.js +2 -1
  9. package/es/components/basic_table/pagination_bar.js +19 -4
  10. package/es/components/basic_table/pagination_bar.styles.js +21 -0
  11. package/es/components/basic_table/panel.styles.js +14 -0
  12. package/es/components/basic_table/use_panel_props.js +28 -0
  13. package/es/components/date_picker/auto_refresh/refresh_interval.js +176 -229
  14. package/es/components/date_picker/date_picker.js +1 -1
  15. package/es/components/flyout/flyout.component.js +10 -6
  16. package/es/components/flyout/flyout_menu.js +122 -19
  17. package/es/components/flyout/flyout_menu.styles.js +2 -1
  18. package/es/components/flyout/manager/actions.js +20 -0
  19. package/es/components/flyout/manager/flyout_child.js +23 -1
  20. package/es/components/flyout/manager/flyout_managed.js +65 -19
  21. package/es/components/flyout/manager/hooks.js +1 -1
  22. package/es/components/flyout/manager/index.js +2 -2
  23. package/es/components/flyout/manager/reducer.js +32 -8
  24. package/es/components/flyout/manager/selectors.js +8 -2
  25. package/es/components/flyout/manager/store.js +35 -2
  26. package/es/components/flyout/use_flyout_menu.js +2 -2
  27. package/es/components/form/field_password/field_password.styles.js +1 -1
  28. package/es/components/form/field_search/field_search.styles.js +1 -1
  29. package/es/components/form/form.styles.js +1 -1
  30. package/es/components/form/form_control_layout/form_control_layout_icons.js +95 -143
  31. package/es/components/form/select/select.styles.js +1 -1
  32. package/es/components/form/text_area/text_area.styles.js +1 -1
  33. package/es/components/form/validatable_control/validatable_control.js +8 -55
  34. package/es/components/table/mobile/table_sort_mobile.js +64 -103
  35. package/es/components/table/store/use_unique_column_id.js +25 -0
  36. package/es/components/table/table_header_cell.js +7 -8
  37. package/es/components/table/table_header_cell_checkbox.js +5 -6
  38. package/es/components/tool_tip/tool_tip.js +61 -30
  39. package/es/components/tool_tip/tool_tip_anchor.js +5 -5
  40. package/es/components/tool_tip/tool_tip_manager.js +27 -2
  41. package/eui.d.ts +679 -530
  42. package/i18ntokens.json +810 -738
  43. package/lib/components/avatar/avatar.js +4 -0
  44. package/lib/components/avatar/avatar.styles.js +16 -16
  45. package/lib/components/banner/banner.js +1 -2
  46. package/lib/components/banner/banner.styles.js +1 -1
  47. package/lib/components/basic_table/basic_table.js +34 -4
  48. package/lib/components/basic_table/basic_table.styles.js +19 -1
  49. package/lib/components/basic_table/in_memory_table.js +17 -0
  50. package/lib/components/basic_table/index.js +8 -1
  51. package/lib/components/basic_table/pagination_bar.js +19 -4
  52. package/lib/components/basic_table/pagination_bar.styles.js +26 -0
  53. package/lib/components/basic_table/panel.styles.js +20 -0
  54. package/lib/components/basic_table/use_panel_props.js +33 -0
  55. package/lib/components/date_picker/auto_refresh/refresh_interval.js +175 -229
  56. package/lib/components/date_picker/date_picker.js +1 -1
  57. package/lib/components/flyout/flyout.component.js +10 -6
  58. package/lib/components/flyout/flyout_menu.js +120 -19
  59. package/lib/components/flyout/flyout_menu.styles.js +2 -1
  60. package/lib/components/flyout/manager/actions.js +21 -1
  61. package/lib/components/flyout/manager/flyout_child.js +23 -1
  62. package/lib/components/flyout/manager/flyout_managed.js +41 -17
  63. package/lib/components/flyout/manager/hooks.js +6 -0
  64. package/lib/components/flyout/manager/index.js +12 -0
  65. package/lib/components/flyout/manager/reducer.js +31 -7
  66. package/lib/components/flyout/manager/selectors.js +9 -3
  67. package/lib/components/flyout/manager/store.js +34 -1
  68. package/lib/components/flyout/use_flyout_menu.js +2 -2
  69. package/lib/components/form/field_password/field_password.styles.js +1 -1
  70. package/lib/components/form/field_search/field_search.styles.js +1 -1
  71. package/lib/components/form/form.styles.js +1 -1
  72. package/lib/components/form/form_control_layout/form_control_layout_icons.js +95 -145
  73. package/lib/components/form/select/select.styles.js +1 -1
  74. package/lib/components/form/text_area/text_area.styles.js +1 -1
  75. package/lib/components/form/validatable_control/validatable_control.js +7 -52
  76. package/lib/components/table/mobile/table_sort_mobile.js +71 -108
  77. package/lib/components/table/store/use_unique_column_id.js +34 -0
  78. package/lib/components/table/table_header_cell.js +7 -8
  79. package/lib/components/table/table_header_cell_checkbox.js +5 -6
  80. package/lib/components/tool_tip/tool_tip.js +59 -29
  81. package/lib/components/tool_tip/tool_tip_anchor.js +5 -5
  82. package/lib/components/tool_tip/tool_tip_manager.js +27 -2
  83. package/optimize/es/components/avatar/avatar.js +4 -0
  84. package/optimize/es/components/avatar/avatar.styles.js +16 -16
  85. package/optimize/es/components/banner/banner.js +1 -2
  86. package/optimize/es/components/banner/banner.styles.js +1 -1
  87. package/optimize/es/components/basic_table/basic_table.js +18 -5
  88. package/optimize/es/components/basic_table/basic_table.styles.js +19 -1
  89. package/optimize/es/components/basic_table/index.js +2 -1
  90. package/optimize/es/components/basic_table/pagination_bar.js +19 -4
  91. package/optimize/es/components/basic_table/pagination_bar.styles.js +21 -0
  92. package/optimize/es/components/basic_table/panel.styles.js +14 -0
  93. package/optimize/es/components/basic_table/use_panel_props.js +28 -0
  94. package/optimize/es/components/date_picker/auto_refresh/refresh_interval.js +172 -196
  95. package/optimize/es/components/date_picker/date_picker.js +1 -1
  96. package/optimize/es/components/flyout/flyout.component.js +10 -6
  97. package/optimize/es/components/flyout/flyout_menu.js +99 -18
  98. package/optimize/es/components/flyout/flyout_menu.styles.js +2 -1
  99. package/optimize/es/components/flyout/manager/actions.js +20 -0
  100. package/optimize/es/components/flyout/manager/flyout_managed.js +42 -18
  101. package/optimize/es/components/flyout/manager/hooks.js +1 -1
  102. package/optimize/es/components/flyout/manager/index.js +2 -2
  103. package/optimize/es/components/flyout/manager/reducer.js +32 -8
  104. package/optimize/es/components/flyout/manager/selectors.js +8 -2
  105. package/optimize/es/components/flyout/manager/store.js +35 -2
  106. package/optimize/es/components/flyout/use_flyout_menu.js +2 -2
  107. package/optimize/es/components/form/field_password/field_password.styles.js +1 -1
  108. package/optimize/es/components/form/field_search/field_search.styles.js +1 -1
  109. package/optimize/es/components/form/form.styles.js +1 -1
  110. package/optimize/es/components/form/form_control_layout/form_control_layout_icons.js +96 -115
  111. package/optimize/es/components/form/select/select.styles.js +1 -1
  112. package/optimize/es/components/form/text_area/text_area.styles.js +1 -1
  113. package/optimize/es/components/form/validatable_control/validatable_control.js +7 -48
  114. package/optimize/es/components/table/mobile/table_sort_mobile.js +59 -82
  115. package/optimize/es/components/table/store/use_unique_column_id.js +25 -0
  116. package/optimize/es/components/table/table_header_cell.js +7 -8
  117. package/optimize/es/components/table/table_header_cell_checkbox.js +5 -6
  118. package/optimize/es/components/tool_tip/tool_tip.js +58 -30
  119. package/optimize/es/components/tool_tip/tool_tip_anchor.js +5 -5
  120. package/optimize/es/components/tool_tip/tool_tip_manager.js +27 -2
  121. package/optimize/lib/components/avatar/avatar.js +4 -0
  122. package/optimize/lib/components/avatar/avatar.styles.js +16 -16
  123. package/optimize/lib/components/banner/banner.js +1 -2
  124. package/optimize/lib/components/banner/banner.styles.js +1 -1
  125. package/optimize/lib/components/basic_table/basic_table.js +17 -4
  126. package/optimize/lib/components/basic_table/basic_table.styles.js +19 -1
  127. package/optimize/lib/components/basic_table/index.js +8 -1
  128. package/optimize/lib/components/basic_table/pagination_bar.js +19 -4
  129. package/optimize/lib/components/basic_table/pagination_bar.styles.js +26 -0
  130. package/optimize/lib/components/basic_table/panel.styles.js +20 -0
  131. package/optimize/lib/components/basic_table/use_panel_props.js +33 -0
  132. package/optimize/lib/components/date_picker/auto_refresh/refresh_interval.js +170 -194
  133. package/optimize/lib/components/date_picker/date_picker.js +1 -1
  134. package/optimize/lib/components/flyout/flyout.component.js +10 -6
  135. package/optimize/lib/components/flyout/flyout_menu.js +98 -18
  136. package/optimize/lib/components/flyout/flyout_menu.styles.js +2 -1
  137. package/optimize/lib/components/flyout/manager/actions.js +21 -1
  138. package/optimize/lib/components/flyout/manager/flyout_managed.js +41 -17
  139. package/optimize/lib/components/flyout/manager/hooks.js +6 -0
  140. package/optimize/lib/components/flyout/manager/index.js +12 -0
  141. package/optimize/lib/components/flyout/manager/reducer.js +31 -7
  142. package/optimize/lib/components/flyout/manager/selectors.js +9 -3
  143. package/optimize/lib/components/flyout/manager/store.js +34 -1
  144. package/optimize/lib/components/flyout/use_flyout_menu.js +2 -2
  145. package/optimize/lib/components/form/field_password/field_password.styles.js +1 -1
  146. package/optimize/lib/components/form/field_search/field_search.styles.js +1 -1
  147. package/optimize/lib/components/form/form.styles.js +1 -1
  148. package/optimize/lib/components/form/form_control_layout/form_control_layout_icons.js +96 -117
  149. package/optimize/lib/components/form/select/select.styles.js +1 -1
  150. package/optimize/lib/components/form/text_area/text_area.styles.js +1 -1
  151. package/optimize/lib/components/form/validatable_control/validatable_control.js +6 -49
  152. package/optimize/lib/components/table/mobile/table_sort_mobile.js +61 -83
  153. package/optimize/lib/components/table/store/use_unique_column_id.js +34 -0
  154. package/optimize/lib/components/table/table_header_cell.js +7 -8
  155. package/optimize/lib/components/table/table_header_cell_checkbox.js +5 -6
  156. package/optimize/lib/components/tool_tip/tool_tip.js +57 -29
  157. package/optimize/lib/components/tool_tip/tool_tip_anchor.js +5 -5
  158. package/optimize/lib/components/tool_tip/tool_tip_manager.js +27 -2
  159. package/package.json +8 -5
  160. package/test-env/components/avatar/avatar.js +4 -0
  161. package/test-env/components/avatar/avatar.styles.js +16 -16
  162. package/test-env/components/banner/banner.js +1 -2
  163. package/test-env/components/banner/banner.styles.js +1 -1
  164. package/test-env/components/basic_table/basic_table.js +34 -4
  165. package/test-env/components/basic_table/basic_table.styles.js +19 -1
  166. package/test-env/components/basic_table/in_memory_table.js +17 -0
  167. package/test-env/components/basic_table/index.js +8 -1
  168. package/test-env/components/basic_table/pagination_bar.js +19 -4
  169. package/test-env/components/basic_table/pagination_bar.styles.js +26 -0
  170. package/test-env/components/basic_table/panel.styles.js +20 -0
  171. package/test-env/components/basic_table/use_panel_props.js +33 -0
  172. package/test-env/components/date_picker/auto_refresh/refresh_interval.js +170 -220
  173. package/test-env/components/date_picker/date_picker.js +1 -1
  174. package/test-env/components/flyout/flyout.component.js +10 -6
  175. package/test-env/components/flyout/flyout_menu.js +121 -19
  176. package/test-env/components/flyout/flyout_menu.styles.js +2 -1
  177. package/test-env/components/flyout/manager/actions.js +21 -1
  178. package/test-env/components/flyout/manager/flyout_child.js +23 -1
  179. package/test-env/components/flyout/manager/flyout_managed.js +41 -17
  180. package/test-env/components/flyout/manager/hooks.js +6 -0
  181. package/test-env/components/flyout/manager/index.js +12 -0
  182. package/test-env/components/flyout/manager/reducer.js +31 -7
  183. package/test-env/components/flyout/manager/selectors.js +9 -3
  184. package/test-env/components/flyout/manager/store.js +34 -1
  185. package/test-env/components/flyout/use_flyout_menu.js +2 -2
  186. package/test-env/components/form/field_password/field_password.styles.js +1 -1
  187. package/test-env/components/form/field_search/field_search.styles.js +1 -1
  188. package/test-env/components/form/form.styles.js +1 -1
  189. package/test-env/components/form/form_control_layout/form_control_layout_icons.js +95 -139
  190. package/test-env/components/form/select/select.styles.js +1 -1
  191. package/test-env/components/form/text_area/text_area.styles.js +1 -1
  192. package/test-env/components/form/validatable_control/validatable_control.js +6 -48
  193. package/test-env/components/table/mobile/table_sort_mobile.js +61 -98
  194. package/test-env/components/table/store/use_unique_column_id.js +34 -0
  195. package/test-env/components/table/table_header_cell.js +7 -8
  196. package/test-env/components/table/table_header_cell_checkbox.js +5 -6
  197. package/test-env/components/tool_tip/tool_tip.js +57 -29
  198. package/test-env/components/tool_tip/tool_tip_anchor.js +5 -5
  199. package/test-env/components/tool_tip/tool_tip_manager.js +27 -2
@@ -1,14 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
4
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
5
- import _createClass from "@babel/runtime/helpers/createClass";
6
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
- import _inherits from "@babel/runtime/helpers/inherits";
9
4
  var _excluded = ["ref", "side"];
10
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
11
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
12
5
  /*
13
6
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
14
7
  * or more contributor license agreements. Licensed under the Elastic License
@@ -17,8 +10,8 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
17
10
  * Side Public License, v 1.
18
11
  */
19
12
 
20
- import React, { Component } from 'react';
21
- import { RenderWithEuiStylesMemoizer } from '../../../services';
13
+ import React from 'react';
14
+ import { useEuiTheme } from '../../../services';
22
15
  import { EuiIcon } from '../../icon';
23
16
  import { EuiLoadingSpinner } from '../../loading';
24
17
  import { EuiFormControlLayoutClearButton } from './form_control_layout_clear_button';
@@ -29,111 +22,99 @@ export var ICON_SIDES = ['left', 'right'];
29
22
  export var isIconShape = function isIconShape(icon) {
30
23
  return !!icon && icon.hasOwnProperty('type');
31
24
  };
32
- export var EuiFormControlLayoutIcons = /*#__PURE__*/function (_Component) {
33
- function EuiFormControlLayoutIcons() {
34
- _classCallCheck(this, EuiFormControlLayoutIcons);
35
- return _callSuper(this, EuiFormControlLayoutIcons, arguments);
25
+ export var EuiFormControlLayoutIcons = function EuiFormControlLayoutIcons(_ref) {
26
+ var _ref$side = _ref.side,
27
+ side = _ref$side === void 0 ? 'left' : _ref$side,
28
+ _ref$iconsPosition = _ref.iconsPosition,
29
+ iconsPosition = _ref$iconsPosition === void 0 ? 'absolute' : _ref$iconsPosition,
30
+ compressed = _ref.compressed,
31
+ isDisabled = _ref.isDisabled,
32
+ icon = _ref.icon,
33
+ clear = _ref.clear,
34
+ isLoading = _ref.isLoading,
35
+ isInvalid = _ref.isInvalid,
36
+ isDropdown = _ref.isDropdown;
37
+ var euiThemeContext = useEuiTheme();
38
+ var styles = euiFormControlLayoutIconsStyles(euiThemeContext);
39
+ var cssStyles = [styles.euiFormControlLayoutIcons, compressed ? styles.compressed : styles.uncompressed].concat(_toConsumableArray(iconsPosition === 'absolute' ? [styles.position.absolute.absolute, compressed ? styles.position.absolute.compressed[side] : styles.position.absolute.uncompressed[side]] : [styles.position.static.static, compressed ? styles.position.static.compressed : styles.position.static.uncompressed]), [isDisabled && styles.disabled]);
40
+ return ___EmotionJSX("div", {
41
+ css: cssStyles,
42
+ className: "euiFormControlLayoutIcons"
43
+ }, ___EmotionJSX(ClearButton, {
44
+ clear: clear,
45
+ isDisabled: isDisabled
46
+ }), ___EmotionJSX(LoadingSpinner, {
47
+ isLoading: isLoading
48
+ }), ___EmotionJSX(InvalidIcon, {
49
+ isInvalid: isInvalid
50
+ }), ___EmotionJSX(CustomIcon, {
51
+ icon: icon,
52
+ isDisabled: isDisabled
53
+ }), ___EmotionJSX(DropdownIcon, {
54
+ isDropdown: isDropdown,
55
+ isDisabled: isDisabled
56
+ }));
57
+ };
58
+ var CustomIcon = function CustomIcon(_ref2) {
59
+ var icon = _ref2.icon,
60
+ isDisabled = _ref2.isDisabled;
61
+ if (!icon) {
62
+ return null;
36
63
  }
37
- _inherits(EuiFormControlLayoutIcons, _Component);
38
- return _createClass(EuiFormControlLayoutIcons, [{
39
- key: "render",
40
- value: function render() {
41
- var _this$props = this.props,
42
- _this$props$side = _this$props.side,
43
- side = _this$props$side === void 0 ? 'left' : _this$props$side,
44
- _this$props$iconsPosi = _this$props.iconsPosition,
45
- iconsPosition = _this$props$iconsPosi === void 0 ? 'absolute' : _this$props$iconsPosi,
46
- compressed = _this$props.compressed,
47
- isDisabled = _this$props.isDisabled;
48
- var customIcon = this.renderCustomIcon();
49
- var loadingSpinner = this.renderLoadingSpinner();
50
- var clearButton = this.renderClearButton();
51
- var invalidIcon = this.renderInvalidIcon();
52
- var dropdownIcon = this.renderDropdownIcon();
53
- return ___EmotionJSX(RenderWithEuiStylesMemoizer, null, function (stylesMemoizer) {
54
- var styles = stylesMemoizer(euiFormControlLayoutIconsStyles);
55
- var cssStyles = [styles.euiFormControlLayoutIcons, compressed ? styles.compressed : styles.uncompressed].concat(_toConsumableArray(iconsPosition === 'absolute' ? [styles.position.absolute.absolute, compressed ? styles.position.absolute.compressed[side] : styles.position.absolute.uncompressed[side]] : [styles.position.static.static, compressed ? styles.position.static.compressed : styles.position.static.uncompressed]), [isDisabled && styles.disabled]);
56
- return ___EmotionJSX("div", {
57
- css: cssStyles,
58
- className: "euiFormControlLayoutIcons"
59
- }, clearButton, loadingSpinner, invalidIcon, customIcon, dropdownIcon);
60
- });
61
- }
62
- }, {
63
- key: "renderCustomIcon",
64
- value: function renderCustomIcon() {
65
- var _this$props2 = this.props,
66
- icon = _this$props2.icon,
67
- isDisabled = _this$props2.isDisabled;
68
- if (!icon) {
69
- return null;
70
- }
71
64
 
72
- // Normalize the icon to an object if it's a string.
73
- var iconProps = isIconShape(icon) ? icon : {
74
- type: icon
75
- };
76
- var iconRef = iconProps.ref,
77
- side = iconProps.side,
78
- iconRest = _objectWithoutProperties(iconProps, _excluded);
79
- return ___EmotionJSX(EuiFormControlLayoutCustomIcon, _extends({
80
- size: "m",
81
- disabled: isDisabled,
82
- iconRef: iconRef
83
- }, iconRest));
84
- }
85
- }, {
86
- key: "renderDropdownIcon",
87
- value: function renderDropdownIcon() {
88
- var _this$props3 = this.props,
89
- isDropdown = _this$props3.isDropdown,
90
- isDisabled = _this$props3.isDisabled;
91
- if (!isDropdown) {
92
- return null;
93
- }
94
- return ___EmotionJSX(EuiFormControlLayoutCustomIcon, {
95
- size: "m",
96
- disabled: isDisabled,
97
- type: "chevronSingleDown"
98
- });
99
- }
100
- }, {
101
- key: "renderLoadingSpinner",
102
- value: function renderLoadingSpinner() {
103
- var isLoading = this.props.isLoading;
104
- if (!isLoading) {
105
- return null;
106
- }
107
- return ___EmotionJSX(EuiLoadingSpinner, {
108
- size: "m"
109
- });
110
- }
111
- }, {
112
- key: "renderClearButton",
113
- value: function renderClearButton() {
114
- var _this$props4 = this.props,
115
- clear = _this$props4.clear,
116
- isDisabled = _this$props4.isDisabled;
117
- if (!clear) {
118
- return null;
119
- }
120
- return ___EmotionJSX(EuiFormControlLayoutClearButton, _extends({
121
- size: "m",
122
- disabled: isDisabled
123
- }, clear));
124
- }
125
- }, {
126
- key: "renderInvalidIcon",
127
- value: function renderInvalidIcon() {
128
- var isInvalid = this.props.isInvalid;
129
- if (!isInvalid) {
130
- return null;
131
- }
132
- return ___EmotionJSX(EuiIcon, {
133
- size: "m",
134
- color: "danger",
135
- type: "warning"
136
- });
137
- }
138
- }]);
139
- }(Component);
65
+ // Normalize the icon to an object if it's a string.
66
+ var iconProps = isIconShape(icon) ? icon : {
67
+ type: icon
68
+ };
69
+ var iconRef = iconProps.ref,
70
+ side = iconProps.side,
71
+ iconRest = _objectWithoutProperties(iconProps, _excluded);
72
+ return ___EmotionJSX(EuiFormControlLayoutCustomIcon, _extends({
73
+ size: "m",
74
+ disabled: isDisabled,
75
+ iconRef: iconRef
76
+ }, iconRest));
77
+ };
78
+ var DropdownIcon = function DropdownIcon(_ref3) {
79
+ var isDropdown = _ref3.isDropdown,
80
+ isDisabled = _ref3.isDisabled;
81
+ if (!isDropdown) {
82
+ return null;
83
+ }
84
+ return ___EmotionJSX(EuiFormControlLayoutCustomIcon, {
85
+ size: "m",
86
+ disabled: isDisabled,
87
+ type: "chevronSingleDown"
88
+ });
89
+ };
90
+ var LoadingSpinner = function LoadingSpinner(_ref4) {
91
+ var isLoading = _ref4.isLoading;
92
+ if (!isLoading) {
93
+ return null;
94
+ }
95
+ return ___EmotionJSX(EuiLoadingSpinner, {
96
+ size: "m"
97
+ });
98
+ };
99
+ var ClearButton = function ClearButton(_ref5) {
100
+ var clear = _ref5.clear,
101
+ isDisabled = _ref5.isDisabled;
102
+ if (!clear) {
103
+ return null;
104
+ }
105
+ return ___EmotionJSX(EuiFormControlLayoutClearButton, _extends({
106
+ size: "m",
107
+ disabled: isDisabled
108
+ }, clear));
109
+ };
110
+ var InvalidIcon = function InvalidIcon(_ref6) {
111
+ var isInvalid = _ref6.isInvalid;
112
+ if (!isInvalid) {
113
+ return null;
114
+ }
115
+ return ___EmotionJSX(EuiIcon, {
116
+ size: "m",
117
+ color: "danger",
118
+ type: "warning"
119
+ });
120
+ };
@@ -12,7 +12,7 @@ export var euiSelectStyles = function euiSelectStyles(euiThemeContext) {
12
12
  var formStyles = euiFormControlStyles(euiThemeContext);
13
13
  var formVariables = euiFormVariables(euiThemeContext);
14
14
  return {
15
- euiSelect: /*#__PURE__*/css("appearance:none;", formStyles.shared, " &:invalid{", formStyles.invalid, ";}&:focus{", formStyles.focus, ";}&:disabled{", formStyles.disabled, ";}&[readOnly]{", formStyles.readOnly, ";}&:autofill{", formStyles.autoFill, ";};label:euiSelect;"),
15
+ euiSelect: /*#__PURE__*/css("appearance:none;", formStyles.shared, " &:is(:invalid, [aria-invalid='true']){", formStyles.invalid, ";}&:focus{", formStyles.focus, ";}&:disabled{", formStyles.disabled, ";}&[readOnly]{", formStyles.readOnly, ";}&:autofill{", formStyles.autoFill, ";};label:euiSelect;"),
16
16
  // Skip the css() on the default height to avoid generating a className
17
17
  uncompressed: formStyles.uncompressed,
18
18
  compressed: /*#__PURE__*/css(formStyles.compressed, ";label:compressed;"),
@@ -47,7 +47,7 @@ export var euiTextAreaStyles = function euiTextAreaStyles(euiThemeContext) {
47
47
  var formStyles = euiFormControlStyles(euiThemeContext);
48
48
  var formVars = euiFormVariables(euiThemeContext);
49
49
  return {
50
- euiTextArea: /*#__PURE__*/css(formStyles.shared, "line-height:", euiTheme.font.lineHeightMultiplier, ";/* <textarea>s default to 'inline-block', which causes an extra 2-3px of\n * unnecessary height within its parent 'block' form control wrapper.\n * @see https://stackoverflow.com/a/27536461/4294462 */display:block;&:invalid{", formStyles.invalid, ";}&:focus{", formStyles.focus, ";}&:disabled{", formStyles.disabled, ";}&[readOnly]{", formStyles.readOnly, ";}&:autofill{", formStyles.autoFill, ";};label:euiTextArea;"),
50
+ euiTextArea: /*#__PURE__*/css(formStyles.shared, "line-height:", euiTheme.font.lineHeightMultiplier, ";/* <textarea>s default to 'inline-block', which causes an extra 2-3px of\n * unnecessary height within its parent 'block' form control wrapper.\n * @see https://stackoverflow.com/a/27536461/4294462 */display:block;&:is(:invalid, [aria-invalid='true']){", formStyles.invalid, ";}&:focus{", formStyles.focus, ";}&:disabled{", formStyles.disabled, ";}&[readOnly]{", formStyles.readOnly, ";}&:autofill{", formStyles.autoFill, ";};label:euiTextArea;"),
51
51
  resize: {
52
52
  vertical: _ref4,
53
53
  horizontal: _ref3,
@@ -1,4 +1,3 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
1
  /*
3
2
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
4
3
  * or more contributor license agreements. Licensed under the Elastic License
@@ -7,42 +6,24 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
7
6
  * Side Public License, v 1.
8
7
  */
9
8
 
10
- import { Children, cloneElement, useState, useEffect, useCallback } from 'react';
11
- function isMutableRef(ref) {
12
- return ref != null && ref.hasOwnProperty('current');
13
- }
9
+ import { Children, cloneElement, useEffect } from 'react';
14
10
 
15
11
  /**
16
12
  * The `EuiValidatableControl` component should be used in scenarios where
17
13
  * we can render the validated `<input>` as its direct child.
14
+ *
15
+ * It flags the underlying control as invalid via `aria-invalid`, which EUI form
16
+ * controls use to render their invalid styling. Note that it intentionally does
17
+ * *not* hook into the native constraint validation API (`setCustomValidity`) -
18
+ * `isInvalid` is a presentational prop, and tying it to native validity would
19
+ * block native form submission and surface a non-localized native error tooltip.
18
20
  */
19
21
 
20
22
  export var EuiValidatableControl = function EuiValidatableControl(_ref) {
21
23
  var isInvalid = _ref.isInvalid,
22
24
  children = _ref.children;
23
- // Note that this must be state and not a ref to cause a rerender/set invalid state on initial mount
24
- var _useState = useState(null),
25
- _useState2 = _slicedToArray(_useState, 2),
26
- control = _useState2[0],
27
- setControl = _useState2[1];
28
25
  var child = Children.only(children);
29
- var childRef = child.ref;
30
- var replacedRef = useCallback(function (element) {
31
- setControl(element);
32
-
33
- // Call the original ref, if any
34
- if (typeof childRef === 'function') {
35
- childRef(element);
36
- } else if (isMutableRef(childRef)) {
37
- childRef.current = element;
38
- }
39
- }, [childRef]);
40
- useSetControlValidity({
41
- controlEl: control,
42
- isInvalid: isInvalid
43
- });
44
26
  return /*#__PURE__*/cloneElement(child, {
45
- ref: replacedRef,
46
27
  'aria-invalid': isInvalid || child.props['aria-invalid']
47
28
  });
48
29
  };
@@ -56,10 +37,6 @@ export var EuiValidatableControl = function EuiValidatableControl(_ref) {
56
37
  export var useEuiValidatableControl = function useEuiValidatableControl(_ref2) {
57
38
  var isInvalid = _ref2.isInvalid,
58
39
  controlEl = _ref2.controlEl;
59
- useSetControlValidity({
60
- controlEl: controlEl,
61
- isInvalid: isInvalid
62
- });
63
40
  useEffect(function () {
64
41
  if (!controlEl) return;
65
42
  if (typeof isInvalid === 'boolean') {
@@ -68,22 +45,4 @@ export var useEuiValidatableControl = function useEuiValidatableControl(_ref2) {
68
45
  controlEl.removeAttribute('aria-invalid');
69
46
  }
70
47
  }, [isInvalid, controlEl]);
71
- };
72
-
73
- /**
74
- * Internal `setCustomValidity` helper
75
- */
76
- var useSetControlValidity = function useSetControlValidity(_ref3) {
77
- var controlEl = _ref3.controlEl,
78
- isInvalid = _ref3.isInvalid;
79
- useEffect(function () {
80
- if (controlEl == null || typeof controlEl.setCustomValidity !== 'function') {
81
- return;
82
- }
83
- if (isInvalid) {
84
- controlEl.setCustomValidity('Invalid');
85
- } else {
86
- controlEl.setCustomValidity('');
87
- }
88
- }, [isInvalid, controlEl]);
89
48
  };
@@ -1,14 +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
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
- import _createClass from "@babel/runtime/helpers/createClass";
5
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
- import _inherits from "@babel/runtime/helpers/inherits";
8
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
4
  var _excluded = ["className", "anchorPosition", "items"];
10
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
11
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
12
5
  /*
13
6
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
14
7
  * or more contributor license agreements. Licensed under the Elastic License
@@ -17,7 +10,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
17
10
  * Side Public License, v 1.
18
11
  */
19
12
 
20
- import React, { Component } from 'react';
13
+ import React, { useState } from 'react';
21
14
  import classNames from 'classnames';
22
15
  import { EuiButtonEmpty } from '../../button/button_empty';
23
16
  import { EuiPopover } from '../../popover';
@@ -25,77 +18,61 @@ import { EuiContextMenuPanel } from '../../context_menu';
25
18
  import { EuiI18n } from '../../i18n';
26
19
  import { EuiTableSortMobileItem } from './table_sort_mobile_item';
27
20
  import { jsx as ___EmotionJSX } from "@emotion/react";
28
- export var EuiTableSortMobile = /*#__PURE__*/function (_Component) {
29
- function EuiTableSortMobile() {
30
- var _this;
31
- _classCallCheck(this, EuiTableSortMobile);
32
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
33
- args[_key] = arguments[_key];
34
- }
35
- _this = _callSuper(this, EuiTableSortMobile, [].concat(args));
36
- _defineProperty(_this, "state", {
37
- isPopoverOpen: false
21
+ // Aligns the button to the right even when it's the only element present
22
+ var euiTableSortMobileStyles = {
23
+ marginInlineStart: 'auto',
24
+ label: 'euiTableSortMobile'
25
+ };
26
+ export var EuiTableSortMobile = function EuiTableSortMobile(_ref) {
27
+ var className = _ref.className,
28
+ anchorPosition = _ref.anchorPosition,
29
+ items = _ref.items,
30
+ rest = _objectWithoutProperties(_ref, _excluded);
31
+ var _useState = useState(false),
32
+ _useState2 = _slicedToArray(_useState, 2),
33
+ isPopoverOpen = _useState2[0],
34
+ setIsPopoverOpen = _useState2[1];
35
+ var classes = classNames('euiTableSortMobile', className);
36
+ var onButtonClick = function onButtonClick() {
37
+ setIsPopoverOpen(function (isOpen) {
38
+ return !isOpen;
38
39
  });
39
- _defineProperty(_this, "onButtonClick", function () {
40
- _this.setState({
41
- isPopoverOpen: !_this.state.isPopoverOpen
42
- });
43
- });
44
- _defineProperty(_this, "closePopover", function () {
45
- _this.setState({
46
- isPopoverOpen: false
47
- });
48
- });
49
- // Aligns the button to the right even when it's the only element present
50
- _defineProperty(_this, "euiTableSortMobileStyles", {
51
- marginInlineStart: 'auto',
52
- label: 'euiTableSortMobile'
53
- });
54
- return _this;
55
- }
56
- _inherits(EuiTableSortMobile, _Component);
57
- return _createClass(EuiTableSortMobile, [{
58
- key: "render",
59
- value: function render() {
60
- var _this$props = this.props,
61
- className = _this$props.className,
62
- anchorPosition = _this$props.anchorPosition,
63
- items = _this$props.items,
64
- rest = _objectWithoutProperties(_this$props, _excluded);
65
- var classes = classNames('euiTableSortMobile', className);
66
- var mobileSortButton = ___EmotionJSX(EuiButtonEmpty, {
67
- iconType: "chevronSingleDown",
68
- iconSide: "right",
69
- onClick: this.onButtonClick.bind(this),
70
- flush: "right",
71
- size: "xs"
72
- }, ___EmotionJSX(EuiI18n, {
73
- token: "euiTableSortMobile.sorting",
74
- default: "Sorting"
75
- }));
76
- var mobileSortPopover = ___EmotionJSX(EuiPopover, _extends({
77
- button: mobileSortButton,
78
- isOpen: this.state.isPopoverOpen,
79
- closePopover: this.closePopover,
80
- anchorPosition: anchorPosition || 'downRight',
81
- panelPaddingSize: "none"
82
- }, rest), ___EmotionJSX(EuiContextMenuPanel, {
83
- style: {
84
- minWidth: 200
85
- },
86
- items: items && items.length ? items.map(function (item) {
87
- return ___EmotionJSX(EuiTableSortMobileItem, {
88
- key: item.key,
89
- onSort: item.onSort,
90
- isSorted: item.isSorted,
91
- isSortAscending: item.isSortAscending
92
- }, item.name);
93
- }) : undefined
94
- }));
95
- return ___EmotionJSX("div", {
96
- className: classes,
97
- css: this.euiTableSortMobileStyles
98
- }, mobileSortPopover);
99
- }
100
- }]);
101
- }(Component);
40
+ };
41
+ var closePopover = function closePopover() {
42
+ setIsPopoverOpen(false);
43
+ };
44
+ var mobileSortButton = ___EmotionJSX(EuiButtonEmpty, {
45
+ iconType: "chevronSingleDown",
46
+ iconSide: "right",
47
+ onClick: onButtonClick,
48
+ flush: "right",
49
+ size: "xs"
50
+ }, ___EmotionJSX(EuiI18n, {
51
+ token: "euiTableSortMobile.sorting",
52
+ default: "Sorting"
53
+ }));
54
+ var mobileSortPopover = ___EmotionJSX(EuiPopover, _extends({
55
+ button: mobileSortButton,
56
+ isOpen: isPopoverOpen,
57
+ closePopover: closePopover,
58
+ anchorPosition: anchorPosition || 'downRight',
59
+ panelPaddingSize: "none"
60
+ }, rest), ___EmotionJSX(EuiContextMenuPanel, {
61
+ style: {
62
+ minWidth: 200
63
+ },
64
+ items: items !== null && items !== void 0 && items.length ? items.map(function (item) {
65
+ return ___EmotionJSX(EuiTableSortMobileItem, {
66
+ key: item.key,
67
+ onSort: item.onSort,
68
+ isSorted: item.isSorted,
69
+ isSortAscending: item.isSortAscending
70
+ }, item.name);
71
+ }) : undefined
72
+ }));
73
+ return ___EmotionJSX("div", {
74
+ className: classes,
75
+ css: euiTableSortMobileStyles
76
+ }, mobileSortPopover);
77
+ };
78
+ EuiTableSortMobile.displayName = 'EuiTableSortMobile';
@@ -0,0 +1,25 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
5
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
6
+ * Side Public License, v 1.
7
+ */
8
+
9
+ import React, { useId, useRef } from 'react';
10
+ import { v4 as uuidv4 } from 'uuid';
11
+ var useEuiTableStoreUniqueColumnIdFallback = function useEuiTableStoreUniqueColumnIdFallback() {
12
+ var ref = useRef(uuidv4());
13
+ return ref.current;
14
+ };
15
+
16
+ /**
17
+ * Returns a stable unique column ID to be used when registering columns.
18
+ * It uses `React.useId()` when available and falls back to UUID v4 on React 17.
19
+ *
20
+ * This is needed so that static `uuid` mocks don't break column registration
21
+ * (at least in React 18+; in older versions this function would need
22
+ * to be mocked to return something unique, but stable).
23
+ * @internal
24
+ */
25
+ export var useEuiTableStoreUniqueColumnId = 'useId' in React ? useId : useEuiTableStoreUniqueColumnIdFallback;
@@ -15,7 +15,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
15
15
  import React, { useEffect, useCallback, useRef } from 'react';
16
16
  import classNames from 'classnames';
17
17
  import { useEuiMemoizedStyles, LEFT_ALIGNMENT } from '../../services';
18
- import { useGeneratedHtmlId } from '../../services/accessibility/html_id_generator';
19
18
  import { EuiI18n } from '../i18n';
20
19
  import { EuiScreenReaderOnly } from '../accessibility';
21
20
  import { EuiIcon } from '../icon';
@@ -27,6 +26,7 @@ import { EuiTableCellContent } from './_table_cell_content';
27
26
  import { euiTableHeaderFooterCellStyles, _useEuiTableStickyCellStyles } from './table_cells_shared.styles';
28
27
  import { useEuiTableColumnDataStore } from './store/provider';
29
28
  import { useEuiTableWithinStickyHeader } from './sticky_header';
29
+ import { useEuiTableStoreUniqueColumnId } from './store/use_unique_column_id';
30
30
  import { jsx as ___EmotionJSX } from "@emotion/react";
31
31
  var CellContents = function CellContents(_ref) {
32
32
  var className = _ref.className,
@@ -104,7 +104,7 @@ export var EuiTableHeaderCell = function EuiTableHeaderCell(_ref2) {
104
104
  sticky = _ref2.sticky,
105
105
  rest = _objectWithoutProperties(_ref2, _excluded);
106
106
  var selfRef = useRef(null);
107
- var internalCellId = useGeneratedHtmlId();
107
+ var storeCellId = useEuiTableStoreUniqueColumnId();
108
108
  var store = useEuiTableColumnDataStore();
109
109
  var isWithinStickyHeader = useEuiTableWithinStickyHeader();
110
110
  var styles = useEuiMemoizedStyles(euiTableHeaderFooterCellStyles);
@@ -169,15 +169,15 @@ export var EuiTableHeaderCell = function EuiTableHeaderCell(_ref2) {
169
169
  if (!entry) {
170
170
  return;
171
171
  }
172
- store.updateColumnWidth(internalCellId, entry.contentRect.width);
173
- }, [store, internalCellId]);
172
+ store.updateColumnWidth(storeCellId, entry.contentRect.width);
173
+ }, [store, storeCellId]);
174
174
  useEffect(function () {
175
175
  // Don't register the column inside the sticky header as the original
176
176
  // column is already registered. This would cause an infinite loop.
177
177
  if (isWithinStickyHeader || !selfRef.current || !renderHeaderCellRef.current) {
178
178
  return;
179
179
  }
180
- var unregisterColumn = store.registerColumn(internalCellId, {
180
+ var unregisterColumn = store.registerColumn(storeCellId, {
181
181
  renderHeaderCellRef: renderHeaderCellRef,
182
182
  // getBoundingClientRect is not the cheapest, but we call it only once
183
183
  currentWidth: selfRef.current.getBoundingClientRect().width
@@ -199,8 +199,7 @@ export var EuiTableHeaderCell = function EuiTableHeaderCell(_ref2) {
199
199
  unregisterColumn();
200
200
  (_resizeObserver = resizeObserver) === null || _resizeObserver === void 0 || _resizeObserver.disconnect();
201
201
  };
202
- // eslint-disable-next-line react-hooks/exhaustive-deps
203
- }, [store, internalCellId, isWithinStickyHeader]);
202
+ }, [store, isWithinStickyHeader, handleResize, storeCellId]);
204
203
 
205
204
  // Notify the store on every render so the sticky header stays in sync.
206
205
  // React's reconciliation will efficiently handle any duplicate renders.
@@ -215,7 +214,7 @@ export var EuiTableHeaderCell = function EuiTableHeaderCell(_ref2) {
215
214
  if (!selfRef.current) {
216
215
  return;
217
216
  }
218
- store.updateColumn(internalCellId, {
217
+ store.updateColumn(storeCellId, {
219
218
  renderHeaderCellRef: renderHeaderCellRef
220
219
  });
221
220
  });
@@ -12,11 +12,11 @@ var _excluded = ["children", "className", "scope", "style", "width", "minWidth",
12
12
  import React, { useEffect, useRef } from 'react';
13
13
  import classNames from 'classnames';
14
14
  import { useEuiMemoizedStyles } from '../../services';
15
- import { useGeneratedHtmlId } from '../../services/accessibility/html_id_generator';
16
15
  import { resolveWidthPropsAsStyle } from './utils';
17
16
  import { euiTableCellCheckboxStyles } from './table_cells_shared.styles';
18
17
  import { useEuiTableColumnDataStore } from './store/provider';
19
18
  import { useEuiTableWithinStickyHeader } from './sticky_header';
19
+ import { useEuiTableStoreUniqueColumnId } from './store/use_unique_column_id';
20
20
  import { jsx as ___EmotionJSX } from "@emotion/react";
21
21
  export var EuiTableHeaderCellCheckbox = function EuiTableHeaderCellCheckbox(props) {
22
22
  var children = props.children,
@@ -29,7 +29,7 @@ export var EuiTableHeaderCellCheckbox = function EuiTableHeaderCellCheckbox(prop
29
29
  maxWidth = props.maxWidth,
30
30
  append = props.append,
31
31
  rest = _objectWithoutProperties(props, _excluded);
32
- var internalCellId = useGeneratedHtmlId();
32
+ var storeCellId = useEuiTableStoreUniqueColumnId();
33
33
  var store = useEuiTableColumnDataStore();
34
34
  var isWithinStickyHeader = useEuiTableWithinStickyHeader();
35
35
  var styles = useEuiMemoizedStyles(euiTableCellCheckboxStyles);
@@ -56,21 +56,20 @@ export var EuiTableHeaderCellCheckbox = function EuiTableHeaderCellCheckbox(prop
56
56
  if (isWithinStickyHeader) {
57
57
  return;
58
58
  }
59
- var unregisterColumn = store.registerColumn(internalCellId, {
59
+ var unregisterColumn = store.registerColumn(storeCellId, {
60
60
  renderHeaderCellRef: renderHeaderCellRef
61
61
  });
62
62
  return function () {
63
63
  unregisterColumn();
64
64
  };
65
- // eslint-disable-next-line react-hooks/exhaustive-deps
66
- }, [store, internalCellId, isWithinStickyHeader]);
65
+ }, [store, isWithinStickyHeader, storeCellId]);
67
66
  useEffect(function () {
68
67
  // Notify the store on every render so the sticky header stays in sync.
69
68
  // React's reconciliation will efficiently handle any duplicate renders.
70
69
  if (isWithinStickyHeader) {
71
70
  return;
72
71
  }
73
- store.updateColumn(internalCellId, {
72
+ store.updateColumn(storeCellId, {
74
73
  renderHeaderCellRef: renderHeaderCellRef
75
74
  });
76
75
  });