@elastic/eui 59.1.0 → 60.1.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 (248) hide show
  1. package/README.md +7 -0
  2. package/dist/eui_theme_dark.css +0 -493
  3. package/dist/eui_theme_dark.json +7 -44
  4. package/dist/eui_theme_dark.json.d.ts +7 -44
  5. package/dist/eui_theme_dark.min.css +1 -1
  6. package/dist/eui_theme_light.css +0 -493
  7. package/dist/eui_theme_light.json +7 -44
  8. package/dist/eui_theme_light.json.d.ts +7 -44
  9. package/dist/eui_theme_light.min.css +1 -1
  10. package/es/components/accessibility/screen_reader_live/screen_reader_live.js +30 -7
  11. package/es/components/accessibility/screen_reader_only/screen_reader_only.js +14 -19
  12. package/es/components/accessibility/screen_reader_only/screen_reader_only.styles.js +11 -1
  13. package/es/components/accessibility/skip_link/skip_link.js +20 -4
  14. package/es/components/avatar/avatar.js +2 -2
  15. package/es/components/badge/badge.js +1 -1
  16. package/es/components/button/button_icon/button_icon.js +1 -1
  17. package/es/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +2 -2
  18. package/es/components/combo_box/matching_options.js +3 -2
  19. package/es/components/datagrid/body/data_grid_body.js +6 -6
  20. package/es/components/datagrid/body/data_grid_cell.js +12 -12
  21. package/es/components/datagrid/body/header/data_grid_header_cell.js +6 -6
  22. package/es/components/datagrid/body/header/data_grid_header_row.js +6 -6
  23. package/es/components/datagrid/data_grid.js +6 -6
  24. package/es/components/datagrid/utils/in_memory.js +6 -6
  25. package/es/components/date_picker/date_picker.js +1 -1
  26. package/es/components/empty_prompt/empty_prompt.js +1 -1
  27. package/es/components/form/field_text/field_text.js +1 -1
  28. package/es/components/form/form_control_layout/form_control_layout.js +1 -1
  29. package/es/components/form/form_control_layout/form_control_layout_icons.js +1 -1
  30. package/es/components/health/health.js +1 -1
  31. package/es/components/icon/icon.js +43 -495
  32. package/es/components/icon/icon.styles.js +75 -0
  33. package/es/components/icon/icon_map.js +455 -0
  34. package/es/components/icon/named_colors.js +2 -13
  35. package/es/components/list_group/list_group.js +1 -1
  36. package/es/components/list_group/list_group_item.js +1 -1
  37. package/es/components/list_group/pinnable_list_group/pinnable_list_group.js +2 -2
  38. package/es/components/notification/notification_event.js +2 -2
  39. package/es/components/notification/notification_event_meta.js +1 -1
  40. package/es/components/notification/notification_event_read_button.js +1 -1
  41. package/es/components/progress/progress.js +34 -87
  42. package/es/components/progress/progress.styles.js +155 -0
  43. package/es/components/provider/cache/cache_provider.js +17 -0
  44. package/es/components/provider/cache/index.js +8 -0
  45. package/es/components/provider/provider.js +35 -5
  46. package/es/components/selectable/selectable.js +39 -22
  47. package/es/components/selectable/selectable_list/selectable_list.js +1 -1
  48. package/es/components/selectable/selectable_list/selectable_list_item.js +1 -1
  49. package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +2 -2
  50. package/es/components/stat/stat.js +28 -35
  51. package/es/components/stat/stat.styles.js +38 -0
  52. package/es/components/timeline/timeline.js +15 -8
  53. package/es/components/timeline/timeline.styles.js +29 -0
  54. package/es/components/timeline/timeline_item.js +4 -16
  55. package/es/components/timeline/timeline_item.styles.js +18 -3
  56. package/es/components/timeline/timeline_item_icon.styles.js +14 -4
  57. package/es/components/tool_tip/icon_tip.js +1 -1
  58. package/es/global_styling/functions/logicals.js +2 -2
  59. package/es/global_styling/utility/utility.js +17 -0
  60. package/es/services/theme/hooks.js +4 -2
  61. package/es/services/theme/provider.js +1 -5
  62. package/es/test/emotion-prefix.js +29 -0
  63. package/es/test/index.d.ts +5 -0
  64. package/es/test/index.js +2 -1
  65. package/eui.d.ts +450 -454
  66. package/i18ntokens.json +18 -18
  67. package/lib/components/accessibility/screen_reader_live/screen_reader_live.js +29 -6
  68. package/lib/components/accessibility/screen_reader_only/screen_reader_only.js +22 -19
  69. package/lib/components/accessibility/screen_reader_only/screen_reader_only.styles.js +16 -2
  70. package/lib/components/accessibility/skip_link/skip_link.js +21 -4
  71. package/lib/components/avatar/avatar.js +2 -2
  72. package/lib/components/badge/badge.js +1 -1
  73. package/lib/components/button/button_icon/button_icon.js +1 -1
  74. package/lib/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +2 -2
  75. package/lib/components/combo_box/matching_options.js +3 -2
  76. package/lib/components/datagrid/body/data_grid_body.js +6 -6
  77. package/lib/components/datagrid/body/data_grid_cell.js +12 -12
  78. package/lib/components/datagrid/body/header/data_grid_header_cell.js +6 -6
  79. package/lib/components/datagrid/body/header/data_grid_header_row.js +6 -6
  80. package/lib/components/datagrid/data_grid.js +6 -6
  81. package/lib/components/datagrid/utils/in_memory.js +6 -6
  82. package/lib/components/date_picker/date_picker.js +1 -1
  83. package/lib/components/empty_prompt/empty_prompt.js +1 -1
  84. package/lib/components/form/field_text/field_text.js +1 -1
  85. package/lib/components/form/form_control_layout/form_control_layout.js +1 -1
  86. package/lib/components/form/form_control_layout/form_control_layout_icons.js +1 -1
  87. package/lib/components/health/health.js +1 -1
  88. package/lib/components/icon/icon.js +54 -499
  89. package/lib/components/icon/icon.styles.js +79 -0
  90. package/lib/components/icon/icon_map.js +463 -0
  91. package/lib/components/icon/named_colors.js +4 -15
  92. package/lib/components/list_group/list_group.js +1 -1
  93. package/lib/components/list_group/list_group_item.js +1 -1
  94. package/lib/components/list_group/pinnable_list_group/pinnable_list_group.js +2 -2
  95. package/lib/components/notification/notification_event.js +2 -2
  96. package/lib/components/notification/notification_event_meta.js +1 -1
  97. package/lib/components/notification/notification_event_read_button.js +1 -1
  98. package/lib/components/progress/progress.js +36 -88
  99. package/lib/components/progress/progress.styles.js +166 -0
  100. package/lib/components/provider/cache/cache_provider.js +29 -0
  101. package/lib/components/provider/cache/index.js +18 -0
  102. package/lib/components/provider/provider.js +36 -5
  103. package/lib/components/selectable/selectable.js +39 -22
  104. package/lib/components/selectable/selectable_list/selectable_list.js +1 -1
  105. package/lib/components/selectable/selectable_list/selectable_list_item.js +1 -1
  106. package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +3 -3
  107. package/lib/components/stat/stat.js +30 -40
  108. package/lib/components/stat/stat.styles.js +45 -0
  109. package/lib/components/timeline/timeline.js +20 -9
  110. package/lib/components/timeline/timeline.styles.js +39 -0
  111. package/lib/components/timeline/timeline_item.js +4 -17
  112. package/lib/components/timeline/timeline_item.styles.js +17 -10
  113. package/lib/components/timeline/timeline_item_icon.styles.js +15 -4
  114. package/lib/components/tool_tip/icon_tip.js +1 -1
  115. package/lib/global_styling/functions/logicals.js +2 -2
  116. package/lib/global_styling/utility/utility.js +31 -0
  117. package/lib/services/theme/hooks.js +4 -2
  118. package/lib/services/theme/provider.js +3 -6
  119. package/lib/test/emotion-prefix.js +38 -0
  120. package/lib/test/index.d.ts +5 -0
  121. package/lib/test/index.js +23 -1
  122. package/optimize/es/components/accessibility/screen_reader_live/screen_reader_live.js +21 -6
  123. package/optimize/es/components/accessibility/screen_reader_only/screen_reader_only.js +11 -17
  124. package/optimize/es/components/accessibility/screen_reader_only/screen_reader_only.styles.js +11 -1
  125. package/optimize/es/components/accessibility/skip_link/skip_link.js +20 -4
  126. package/optimize/es/components/combo_box/matching_options.js +3 -2
  127. package/optimize/es/components/icon/icon.js +40 -492
  128. package/optimize/es/components/icon/icon.styles.js +75 -0
  129. package/optimize/es/components/icon/icon_map.js +455 -0
  130. package/optimize/es/components/icon/named_colors.js +2 -13
  131. package/optimize/es/components/progress/progress.js +31 -84
  132. package/optimize/es/components/progress/progress.styles.js +155 -0
  133. package/optimize/es/components/provider/cache/cache_provider.js +17 -0
  134. package/optimize/es/components/provider/cache/index.js +8 -0
  135. package/optimize/es/components/provider/provider.js +35 -5
  136. package/optimize/es/components/selectable/selectable.js +33 -22
  137. package/optimize/es/components/stat/stat.js +25 -33
  138. package/optimize/es/components/stat/stat.styles.js +38 -0
  139. package/optimize/es/components/timeline/timeline.js +10 -1
  140. package/optimize/es/components/timeline/timeline.styles.js +29 -0
  141. package/optimize/es/components/timeline/timeline_item.js +4 -9
  142. package/optimize/es/components/timeline/timeline_item.styles.js +18 -3
  143. package/optimize/es/components/timeline/timeline_item_icon.styles.js +14 -4
  144. package/optimize/es/global_styling/functions/logicals.js +2 -2
  145. package/optimize/es/global_styling/utility/utility.js +17 -0
  146. package/optimize/es/services/theme/hooks.js +4 -2
  147. package/optimize/es/services/theme/provider.js +1 -5
  148. package/optimize/es/test/emotion-prefix.js +27 -0
  149. package/optimize/es/test/index.d.ts +5 -0
  150. package/optimize/es/test/index.js +2 -1
  151. package/optimize/lib/components/accessibility/screen_reader_live/screen_reader_live.js +20 -5
  152. package/optimize/lib/components/accessibility/screen_reader_only/screen_reader_only.js +18 -16
  153. package/optimize/lib/components/accessibility/screen_reader_only/screen_reader_only.styles.js +16 -2
  154. package/optimize/lib/components/accessibility/skip_link/skip_link.js +21 -4
  155. package/optimize/lib/components/combo_box/matching_options.js +3 -2
  156. package/optimize/lib/components/icon/icon.js +49 -494
  157. package/optimize/lib/components/icon/icon.styles.js +81 -0
  158. package/optimize/lib/components/icon/icon_map.js +463 -0
  159. package/optimize/lib/components/icon/named_colors.js +4 -15
  160. package/optimize/lib/components/progress/progress.js +33 -85
  161. package/optimize/lib/components/progress/progress.styles.js +168 -0
  162. package/optimize/lib/components/provider/cache/cache_provider.js +29 -0
  163. package/optimize/lib/components/provider/cache/index.js +18 -0
  164. package/optimize/lib/components/provider/provider.js +36 -5
  165. package/optimize/lib/components/selectable/selectable.js +33 -22
  166. package/optimize/lib/components/stat/stat.js +27 -37
  167. package/optimize/lib/components/stat/stat.styles.js +47 -0
  168. package/optimize/lib/components/timeline/timeline.js +14 -2
  169. package/optimize/lib/components/timeline/timeline.styles.js +39 -0
  170. package/optimize/lib/components/timeline/timeline_item.js +4 -10
  171. package/optimize/lib/components/timeline/timeline_item.styles.js +17 -10
  172. package/optimize/lib/components/timeline/timeline_item_icon.styles.js +15 -4
  173. package/optimize/lib/global_styling/functions/logicals.js +2 -2
  174. package/optimize/lib/global_styling/utility/utility.js +31 -0
  175. package/optimize/lib/services/theme/hooks.js +4 -2
  176. package/optimize/lib/services/theme/provider.js +3 -6
  177. package/optimize/lib/test/emotion-prefix.js +40 -0
  178. package/optimize/lib/test/index.d.ts +5 -0
  179. package/optimize/lib/test/index.js +23 -1
  180. package/package.json +2 -2
  181. package/src/components/form/form_control_layout/_form_control_layout.scss +2 -4
  182. package/src/components/index.scss +0 -4
  183. package/src/global_styling/variables/_form.scss +9 -0
  184. package/src/themes/amsterdam/overrides/_index.scss +0 -1
  185. package/test-env/components/accessibility/screen_reader_live/screen_reader_live.js +29 -6
  186. package/test-env/components/accessibility/screen_reader_only/screen_reader_only.js +21 -18
  187. package/test-env/components/accessibility/screen_reader_only/screen_reader_only.styles.js +16 -2
  188. package/test-env/components/accessibility/skip_link/skip_link.js +21 -4
  189. package/test-env/components/avatar/avatar.js +2 -2
  190. package/test-env/components/badge/badge.js +1 -1
  191. package/test-env/components/button/button_icon/button_icon.js +1 -1
  192. package/test-env/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +2 -2
  193. package/test-env/components/combo_box/matching_options.js +3 -2
  194. package/test-env/components/datagrid/body/data_grid_body.js +6 -6
  195. package/test-env/components/datagrid/body/data_grid_cell.js +12 -12
  196. package/test-env/components/datagrid/body/header/data_grid_header_cell.js +6 -6
  197. package/test-env/components/datagrid/body/header/data_grid_header_row.js +6 -6
  198. package/test-env/components/datagrid/data_grid.js +6 -6
  199. package/test-env/components/datagrid/utils/in_memory.js +6 -6
  200. package/test-env/components/date_picker/date_picker.js +1 -1
  201. package/test-env/components/empty_prompt/empty_prompt.js +1 -1
  202. package/test-env/components/form/field_text/field_text.js +1 -1
  203. package/test-env/components/form/form_control_layout/form_control_layout.js +1 -1
  204. package/test-env/components/form/form_control_layout/form_control_layout_icons.js +1 -1
  205. package/test-env/components/health/health.js +1 -1
  206. package/test-env/components/icon/icon.styles.js +81 -0
  207. package/test-env/components/icon/icon_map.js +463 -0
  208. package/test-env/components/icon/named_colors.js +4 -15
  209. package/test-env/components/list_group/list_group.js +1 -1
  210. package/test-env/components/list_group/list_group_item.js +1 -1
  211. package/test-env/components/list_group/pinnable_list_group/pinnable_list_group.js +2 -2
  212. package/test-env/components/notification/notification_event.js +2 -2
  213. package/test-env/components/notification/notification_event_meta.js +1 -1
  214. package/test-env/components/notification/notification_event_read_button.js +1 -1
  215. package/test-env/components/progress/progress.js +36 -88
  216. package/test-env/components/progress/progress.styles.js +168 -0
  217. package/test-env/components/provider/cache/cache_provider.js +29 -0
  218. package/test-env/components/provider/cache/index.js +18 -0
  219. package/test-env/components/provider/provider.js +36 -5
  220. package/test-env/components/selectable/selectable.js +39 -22
  221. package/test-env/components/selectable/selectable_list/selectable_list.js +1 -1
  222. package/test-env/components/selectable/selectable_list/selectable_list_item.js +1 -1
  223. package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +3 -3
  224. package/test-env/components/stat/stat.js +29 -39
  225. package/test-env/components/stat/stat.styles.js +47 -0
  226. package/test-env/components/timeline/timeline.js +19 -9
  227. package/test-env/components/timeline/timeline.styles.js +39 -0
  228. package/test-env/components/timeline/timeline_item.js +4 -17
  229. package/test-env/components/timeline/timeline_item.styles.js +17 -10
  230. package/test-env/components/timeline/timeline_item_icon.styles.js +15 -4
  231. package/test-env/components/tool_tip/icon_tip.js +1 -1
  232. package/test-env/global_styling/functions/logicals.js +2 -2
  233. package/test-env/global_styling/utility/utility.js +31 -0
  234. package/test-env/services/theme/hooks.js +4 -2
  235. package/test-env/services/theme/provider.js +3 -6
  236. package/test-env/test/emotion-prefix.js +40 -0
  237. package/test-env/test/index.js +23 -1
  238. package/src/components/accessibility/_index.scss +0 -1
  239. package/src/components/accessibility/screen_reader_only/_screen_reader_only.scss +0 -5
  240. package/src/components/icon/_icon.scss +0 -87
  241. package/src/components/icon/_index.scss +0 -2
  242. package/src/components/icon/_variables.scss +0 -22
  243. package/src/components/progress/_index.scss +0 -2
  244. package/src/components/progress/_progress.scss +0 -166
  245. package/src/components/progress/_variables.scss +0 -21
  246. package/src/components/stat/_index.scss +0 -1
  247. package/src/components/stat/_stat.scss +0 -50
  248. package/src/themes/amsterdam/overrides/_progress.scss +0 -3
@@ -46,9 +46,9 @@ var logicalPaddings = {
46
46
  };
47
47
  var logicalPosition = {
48
48
  top: 'inset-block-start',
49
- right: 'inset-inline-start',
49
+ right: 'inset-inline-end',
50
50
  bottom: 'inset-block-end',
51
- left: 'inset-inline-end',
51
+ left: 'inset-inline-start',
52
52
  horizontal: 'inset-block',
53
53
  vertical: 'inset-inline',
54
54
  inset: 'inset'
@@ -0,0 +1,17 @@
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
+ import React from 'react';
9
+ import { Global, css } from '@emotion/react';
10
+ import { euiScreenReaderOnly } from '../../components/accessibility/screen_reader_only/screen_reader_only.styles';
11
+ import { jsx as ___EmotionJSX } from "@emotion/react";
12
+ var globalStyles = /*#__PURE__*/css(".euiScreenReaderOnly{", euiScreenReaderOnly(), ";};label:globalStyles;");
13
+ export var EuiUtilityClasses = function EuiUtilityClasses() {
14
+ return ___EmotionJSX(Global, {
15
+ styles: globalStyles
16
+ });
17
+ };
@@ -20,8 +20,10 @@ export var useEuiTheme = function useEuiTheme() {
20
20
  modifications: modifications
21
21
  };
22
22
  };
23
+ // Provide the component props interface as the generic to allow the docs props table to populate.
24
+ // e.g., `const EuiComponent = withEuiTheme<EuiComponentProps>(_EuiComponent)`
23
25
  export var withEuiTheme = function withEuiTheme(Component) {
24
- var componentName = Component.displayName || Component.name || 'Component';
26
+ var componentName = Component.displayName || Component.name || 'ComponentWithTheme';
25
27
 
26
28
  var Render = function Render(props, ref) {
27
29
  var _useEuiTheme = useEuiTheme(),
@@ -40,6 +42,6 @@ export var withEuiTheme = function withEuiTheme(Component) {
40
42
  };
41
43
 
42
44
  var WithEuiTheme = /*#__PURE__*/forwardRef(Render);
43
- WithEuiTheme.displayName = "WithEuiTheme(".concat(componentName, ")");
45
+ WithEuiTheme.displayName = componentName;
44
46
  return WithEuiTheme;
45
47
  };
@@ -8,7 +8,6 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
8
8
  * Side Public License, v 1.
9
9
  */
10
10
  import React, { useContext, useEffect, useRef, useState } from 'react';
11
- import { CacheProvider } from '@emotion/react';
12
11
  import isEqual from 'lodash/isEqual';
13
12
  import { EuiSystemContext, EuiThemeContext, EuiModificationsContext, EuiColorModeContext } from './context';
14
13
  import { buildTheme, getColorMode, getComputed, mergeDeep } from './utils';
@@ -17,7 +16,6 @@ export var EuiThemeProvider = function EuiThemeProvider(_ref) {
17
16
  var _system = _ref.theme,
18
17
  _colorMode = _ref.colorMode,
19
18
  _modifications = _ref.modify,
20
- cache = _ref.cache,
21
19
  children = _ref.children;
22
20
  var parentSystem = useContext(EuiSystemContext);
23
21
  var parentModifications = useContext(EuiModificationsContext);
@@ -91,7 +89,5 @@ export var EuiThemeProvider = function EuiThemeProvider(_ref) {
91
89
  value: modifications
92
90
  }, ___EmotionJSX(EuiThemeContext.Provider, {
93
91
  value: theme
94
- }, cache ? ___EmotionJSX(CacheProvider, {
95
- value: cache
96
- }, children) : children))));
92
+ }, children))));
97
93
  };
@@ -0,0 +1,27 @@
1
+ import _typeof from "@babel/runtime/helpers/typeof";
2
+ import _inherits from "@babel/runtime/helpers/inherits";
3
+ import _setPrototypeOf from "@babel/runtime/helpers/setPrototypeOf";
4
+
5
+ function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(re, groups) { return new BabelRegExp(re, undefined, groups); }; var _super = RegExp.prototype; var _groups = new WeakMap(); function BabelRegExp(re, flags, groups) { var _this = new RegExp(re, flags); _groups.set(_this, groups || _groups.get(re)); return _setPrototypeOf(_this, BabelRegExp.prototype); } _inherits(BabelRegExp, RegExp); BabelRegExp.prototype.exec = function (str) { var result = _super.exec.call(this, str); if (result) result.groups = buildGroups(result, this); return result; }; BabelRegExp.prototype[Symbol.replace] = function (str, substitution) { if (typeof substitution === "string") { var groups = _groups.get(this); return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) { return "$" + groups[name]; })); } else if (typeof substitution === "function") { var _this = this; return _super[Symbol.replace].call(this, str, function () { var args = arguments; if (_typeof(args[args.length - 1]) !== "object") { args = [].slice.call(args); args.push(buildGroups(args, _this)); } return substitution.apply(this, args); }); } else { return _super[Symbol.replace].call(this, str, substitution); } }; function buildGroups(result, re) { var g = _groups.get(re); return Object.keys(g).reduce(function (groups, name) { groups[name] = result[g[name]]; return groups; }, Object.create(null)); } return _wrapRegExp.apply(this, arguments); }
6
+
7
+ /*
8
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
9
+ * or more contributor license agreements. Licensed under the Elastic License
10
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
11
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
12
+ * Side Public License, v 1.
13
+ */
14
+ export var replaceEmotionPrefix = function replaceEmotionPrefix(selector) {
15
+ var _euiMatch$groups;
16
+
17
+ // Matches the Emotion className pattern + the EUI variant naming convention.
18
+ // Starts with `css-[hash]-`.
19
+ // Contains `eui[ComponentName] or `Eui[ComponentName]`.
20
+ // Capture the component name (from above) and all variant additions until the end of the string.
21
+ var euiMatch = selector.match( /*#__PURE__*/_wrapRegExp(/css\x2D[0-9A-Z_a-z]{6,}\x2D([Ee]ui[A-Z][\x2D0-9A-Z_a-z]*$)/, {
22
+ euiComponent: 1
23
+ })); // Use the captured group (`euiComponent`) if available and prepend with `emotion-`,
24
+ // otherwise use the full selector.
25
+
26
+ return euiMatch !== null && euiMatch !== void 0 && (_euiMatch$groups = euiMatch.groups) !== null && _euiMatch$groups !== void 0 && _euiMatch$groups.euiComponent ? "emotion-".concat(euiMatch.groups.euiComponent) : selector;
27
+ };
@@ -36,6 +36,10 @@ declare module '@elastic/eui/optimize/es/test/react_warnings' {
36
36
  declare module '@elastic/eui/optimize/es/test/sleep' {
37
37
  export function sleep(ms?: number): Promise<unknown>;
38
38
 
39
+ }
40
+ declare module '@elastic/eui/optimize/es/test/emotion-prefix' {
41
+ export const replaceEmotionPrefix: (selector: string) => string;
42
+
39
43
  }
40
44
  declare module '@elastic/eui/optimize/es/test' {
41
45
  export { requiredProps } from '@elastic/eui/optimize/es/test/required_props';
@@ -43,5 +47,6 @@ declare module '@elastic/eui/optimize/es/test' {
43
47
  export { findTestSubject } from '@elastic/eui/optimize/es/test/find_test_subject';
44
48
  export { startThrowingReactWarnings, stopThrowingReactWarnings, } from '@elastic/eui/optimize/es/test/react_warnings';
45
49
  export { sleep } from '@elastic/eui/optimize/es/test/sleep';
50
+ export * from '@elastic/eui/optimize/es/test/emotion-prefix';
46
51
 
47
52
  }
@@ -9,4 +9,5 @@ export { requiredProps } from './required_props';
9
9
  export { takeMountedSnapshot } from './take_mounted_snapshot';
10
10
  export { findTestSubject } from './find_test_subject';
11
11
  export { startThrowingReactWarnings, stopThrowingReactWarnings } from './react_warnings';
12
- export { sleep } from './sleep';
12
+ export { sleep } from './sleep';
13
+ export * from './emotion-prefix';
@@ -35,18 +35,26 @@ var EuiScreenReaderLive = function EuiScreenReaderLive(_ref) {
35
35
  _ref$role = _ref.role,
36
36
  role = _ref$role === void 0 ? 'status' : _ref$role,
37
37
  _ref$ariaLive = _ref['aria-live'],
38
- ariaLive = _ref$ariaLive === void 0 ? 'polite' : _ref$ariaLive;
38
+ ariaLive = _ref$ariaLive === void 0 ? 'polite' : _ref$ariaLive,
39
+ _ref$focusRegionOnTex = _ref.focusRegionOnTextChange,
40
+ focusRegionOnTextChange = _ref$focusRegionOnTex === void 0 ? false : _ref$focusRegionOnTex;
39
41
 
40
42
  var _useState = (0, _react.useState)(false),
41
43
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
42
44
  toggle = _useState2[0],
43
45
  setToggle = _useState2[1];
44
46
 
47
+ var focusRef = (0, _react.useRef)(null);
45
48
  (0, _react.useEffect)(function () {
46
49
  setToggle(function (toggle) {
47
50
  return !toggle;
48
51
  });
49
52
  }, [children]);
53
+ (0, _react.useEffect)(function () {
54
+ if (focusRef.current !== null && focusRegionOnTextChange) {
55
+ focusRef.current.focus();
56
+ }
57
+ }, [toggle, focusRegionOnTextChange]);
50
58
  return (
51
59
  /**
52
60
  * Intentionally uses two persistent live regions with oscillating content updates.
@@ -58,14 +66,21 @@ var EuiScreenReaderLive = function EuiScreenReaderLive(_ref) {
58
66
  * See also https://github.com/AlmeroSteyn/react-aria-live and https://github.com/dequelabs/ngA11y
59
67
  * for more examples of the double region approach.
60
68
  */
61
- (0, _react2.jsx)(_screen_reader_only.EuiScreenReaderOnly, null, (0, _react2.jsx)("div", null, (0, _react2.jsx)("div", {
69
+ (0, _react2.jsx)(_screen_reader_only.EuiScreenReaderOnly, null, (0, _react2.jsx)("div", {
70
+ ref: focusRef,
71
+ tabIndex: focusRegionOnTextChange ? -1 : undefined
72
+ }, (0, _react2.jsx)("div", {
62
73
  role: role,
63
- "aria-atomic": "true",
64
- "aria-live": ariaLive
74
+ "aria-atomic": "true" // Setting `aria-hidden` and setting `aria-live` to "off" prevents
75
+ // double announcements from VO when `focusRegionOnTextChange` is true
76
+ ,
77
+ "aria-hidden": toggle ? undefined : 'true',
78
+ "aria-live": focusRegionOnTextChange ? 'off' : ariaLive
65
79
  }, isActive && toggle ? children : ''), (0, _react2.jsx)("div", {
66
80
  role: role,
67
81
  "aria-atomic": "true",
68
- "aria-live": ariaLive
82
+ "aria-hidden": !toggle ? undefined : 'true',
83
+ "aria-live": focusRegionOnTextChange ? 'off' : ariaLive
69
84
  }, isActive && !toggle ? children : '')))
70
85
  );
71
86
  };
@@ -7,29 +7,31 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.EuiScreenReaderOnly = void 0;
9
9
 
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
- var _react = require("react");
13
-
14
10
  var _classnames = _interopRequireDefault(require("classnames"));
15
11
 
16
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
12
+ var _clone_element = require("../../../services/theme/clone_element");
17
13
 
18
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
14
+ var _screen_reader_only = require("./screen_reader_only.styles");
19
15
 
16
+ /*
17
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
18
+ * or more contributor license agreements. Licensed under the Elastic License
19
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
20
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
21
+ * Side Public License, v 1.
22
+ */
20
23
  var EuiScreenReaderOnly = function EuiScreenReaderOnly(_ref) {
21
24
  var children = _ref.children,
25
+ className = _ref.className,
22
26
  showOnFocus = _ref.showOnFocus;
23
- var classes = (0, _classnames.default)({
24
- euiScreenReaderOnly: !showOnFocus,
25
- 'euiScreenReaderOnly--showOnFocus': showOnFocus
26
- }, children.props.className);
27
-
28
- var props = _objectSpread(_objectSpread({}, children.props), {}, {
29
- className: classes
30
- });
31
-
32
- return /*#__PURE__*/(0, _react.cloneElement)(children, props);
27
+ var classes = (0, _classnames.default)(className, children.props.className);
28
+ var styles = (0, _screen_reader_only.euiScreenReaderOnlyStyles)(showOnFocus);
29
+ var cssStyles = [styles.euiScreenReaderOnly];
30
+ var props = {
31
+ className: classes.length ? classes : undefined,
32
+ css: cssStyles
33
+ };
34
+ return (0, _clone_element.cloneElementWithCss)(children, props);
33
35
  };
34
36
 
35
37
  exports.EuiScreenReaderOnly = EuiScreenReaderOnly;
@@ -3,7 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.euiScreenReaderOnly = void 0;
6
+ exports.euiScreenReaderOnlyStyles = exports.euiScreenReaderOnly = void 0;
7
+
8
+ var _react = require("@emotion/react");
7
9
 
8
10
  /*
9
11
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
@@ -20,5 +22,17 @@ exports.euiScreenReaderOnly = void 0;
20
22
  var euiScreenReaderOnly = function euiScreenReaderOnly() {
21
23
  return "\n // Take the element out of the layout\n position: absolute;\n // Keep it vertically inline\n top: auto;\n // Chrome requires a left value, and Selenium (used by Kibana's FTR) requires an off-screen position for its .getVisibleText() to not register SR-only text\n left: -10000px;\n // The element must have a size (for some screen readers)\n width: 1px;\n height: 1px;\n // But reduce the visible size to nothing\n clip: rect(0 0 0 0);\n clip-path: inset(50%);\n // And ensure no overflows occur\n overflow: hidden;\n // Chrome requires the negative margin to not cause overflows of parent containers\n margin: -1px;\n";
22
24
  };
25
+ /*
26
+ * Styles
27
+ */
28
+
29
+
30
+ exports.euiScreenReaderOnly = euiScreenReaderOnly;
31
+
32
+ var euiScreenReaderOnlyStyles = function euiScreenReaderOnlyStyles(showOnFocus) {
33
+ return {
34
+ euiScreenReaderOnly: showOnFocus ? /*#__PURE__*/(0, _react.css)("&:not(:focus):not(:active){", euiScreenReaderOnly(), ";};label:euiScreenReaderOnly;") : /*#__PURE__*/(0, _react.css)(euiScreenReaderOnly(), ";label:euiScreenReaderOnly;")
35
+ };
36
+ };
23
37
 
24
- exports.euiScreenReaderOnly = euiScreenReaderOnly;
38
+ exports.euiScreenReaderOnlyStyles = euiScreenReaderOnlyStyles;
@@ -17,6 +17,8 @@ var _react = _interopRequireDefault(require("react"));
17
17
 
18
18
  var _classnames = _interopRequireDefault(require("classnames"));
19
19
 
20
+ var _tabbable = require("tabbable");
21
+
20
22
  var _services = require("../../../services");
21
23
 
22
24
  var _button = require("../../button/button");
@@ -63,13 +65,28 @@ var EuiSkipLink = function EuiSkipLink(_ref) {
63
65
  onClick: function onClick(e) {
64
66
  e.preventDefault();
65
67
  var destinationEl = document.getElementById(destinationId);
66
- if (!destinationEl) return;
67
- destinationEl.scrollIntoView();
68
- destinationEl.tabIndex = -1; // Ensure the destination content is focusable
68
+ if (!destinationEl) return; // Scroll to the top of the destination content only if it's ~mostly out of view
69
+
70
+ var destinationY = destinationEl.getBoundingClientRect().top;
71
+ var halfOfViewportHeight = window.innerHeight / 2;
72
+
73
+ if (destinationY >= halfOfViewportHeight || window.scrollY >= destinationY + halfOfViewportHeight) {
74
+ destinationEl.scrollIntoView();
75
+ } // Ensure the destination content is focusable
76
+
77
+
78
+ if (!(0, _tabbable.isTabbable)(destinationEl)) {
79
+ destinationEl.tabIndex = -1;
80
+ destinationEl.addEventListener('blur', function () {
81
+ return destinationEl.removeAttribute('tabindex');
82
+ }, {
83
+ once: true
84
+ });
85
+ }
69
86
 
70
87
  destinationEl.focus({
71
88
  preventScroll: true
72
- }); // Scrolling is already handled above, and focus's autoscroll behaves oddly around fixed headers
89
+ }); // Scrolling is already handled above, and focus autoscroll behaves oddly on Chrome around fixed headers
73
90
  }
74
91
  });
75
92
  }
@@ -19,7 +19,7 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
19
19
  var flattenOptionGroups = function flattenOptionGroups(optionsOrGroups) {
20
20
  return optionsOrGroups.reduce(function (options, optionOrGroup) {
21
21
  if (optionOrGroup.options) {
22
- options.push.apply(options, (0, _toConsumableArray2.default)(optionOrGroup.options));
22
+ options = options.concat(optionOrGroup.options);
23
23
  } else {
24
24
  options.push(optionOrGroup);
25
25
  }
@@ -82,8 +82,9 @@ var getMatchingOptions = function getMatchingOptions(options, selectedOptions, s
82
82
  label: option.label,
83
83
  isGroupLabelOption: true
84
84
  }); // Add matching options for group
85
+ // use concat over spreading to support large arrays - https://mathiasbynens.be/demo/javascript-argument-count
85
86
 
86
- matchingOptions.push.apply(matchingOptions, matchingOptionsForGroup);
87
+ matchingOptions = matchingOptions.concat(matchingOptionsForGroup);
87
88
  }
88
89
  } else {
89
90
  collectMatchingOption(matchingOptions, option, selectedOptions, normalizedSearchValue, isPreFiltered, showPrevSelected);