@elastic/eui 60.0.0 → 60.1.2

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 (180) hide show
  1. package/README.md +7 -0
  2. package/dist/eui_charts_theme.js +330 -330
  3. package/dist/eui_charts_theme.js.map +1 -1
  4. package/dist/eui_theme_dark.css +0 -445
  5. package/dist/eui_theme_dark.json +7 -44
  6. package/dist/eui_theme_dark.json.d.ts +7 -44
  7. package/dist/eui_theme_dark.min.css +1 -1
  8. package/dist/eui_theme_light.css +0 -445
  9. package/dist/eui_theme_light.json +7 -44
  10. package/dist/eui_theme_light.json.d.ts +7 -44
  11. package/dist/eui_theme_light.min.css +1 -1
  12. package/es/components/accessibility/screen_reader_live/screen_reader_live.js +30 -7
  13. package/es/components/accessibility/screen_reader_only/screen_reader_only.js +14 -19
  14. package/es/components/accessibility/screen_reader_only/screen_reader_only.styles.js +11 -1
  15. package/es/components/accessibility/skip_link/skip_link.js +20 -4
  16. package/es/components/avatar/avatar.js +2 -2
  17. package/es/components/badge/badge.js +1 -1
  18. package/es/components/button/button_icon/button_icon.js +1 -1
  19. package/es/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +2 -2
  20. package/es/components/datagrid/body/data_grid_body.js +6 -6
  21. package/es/components/datagrid/body/data_grid_cell.js +12 -12
  22. package/es/components/datagrid/body/header/data_grid_header_cell.js +6 -6
  23. package/es/components/datagrid/body/header/data_grid_header_row.js +6 -6
  24. package/es/components/datagrid/data_grid.js +6 -6
  25. package/es/components/datagrid/utils/in_memory.js +6 -6
  26. package/es/components/date_picker/date_picker.js +1 -1
  27. package/es/components/empty_prompt/empty_prompt.js +1 -1
  28. package/es/components/form/field_text/field_text.js +1 -1
  29. package/es/components/form/form_control_layout/form_control_layout.js +1 -1
  30. package/es/components/form/form_control_layout/form_control_layout_icons.js +1 -1
  31. package/es/components/health/health.js +1 -1
  32. package/es/components/icon/icon.js +43 -495
  33. package/es/components/icon/icon.styles.js +75 -0
  34. package/es/components/icon/icon_map.js +455 -0
  35. package/es/components/icon/named_colors.js +2 -13
  36. package/es/components/list_group/list_group.js +1 -1
  37. package/es/components/list_group/list_group_item.js +1 -1
  38. package/es/components/list_group/pinnable_list_group/pinnable_list_group.js +2 -2
  39. package/es/components/notification/notification_event.js +2 -2
  40. package/es/components/notification/notification_event_meta.js +1 -1
  41. package/es/components/notification/notification_event_read_button.js +1 -1
  42. package/es/components/panel/panel.js +2 -1
  43. package/es/components/progress/progress.js +34 -87
  44. package/es/components/progress/progress.styles.js +155 -0
  45. package/es/components/selectable/selectable_list/selectable_list.js +3 -1
  46. package/es/components/selectable/selectable_list/selectable_list_item.js +1 -1
  47. package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +2 -2
  48. package/es/components/text/text.js +2 -0
  49. package/es/components/tool_tip/icon_tip.js +1 -1
  50. package/es/global_styling/utility/utility.js +3 -1
  51. package/es/services/theme/hooks.js +2 -0
  52. package/eui.d.ts +393 -453
  53. package/i18ntokens.json +2 -2
  54. package/lib/components/accessibility/screen_reader_live/screen_reader_live.js +29 -6
  55. package/lib/components/accessibility/screen_reader_only/screen_reader_only.js +22 -19
  56. package/lib/components/accessibility/screen_reader_only/screen_reader_only.styles.js +16 -2
  57. package/lib/components/accessibility/skip_link/skip_link.js +21 -4
  58. package/lib/components/avatar/avatar.js +2 -2
  59. package/lib/components/badge/badge.js +1 -1
  60. package/lib/components/button/button_icon/button_icon.js +1 -1
  61. package/lib/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +2 -2
  62. package/lib/components/datagrid/body/data_grid_body.js +6 -6
  63. package/lib/components/datagrid/body/data_grid_cell.js +12 -12
  64. package/lib/components/datagrid/body/header/data_grid_header_cell.js +6 -6
  65. package/lib/components/datagrid/body/header/data_grid_header_row.js +6 -6
  66. package/lib/components/datagrid/data_grid.js +6 -6
  67. package/lib/components/datagrid/utils/focus.js +1 -0
  68. package/lib/components/datagrid/utils/in_memory.js +6 -6
  69. package/lib/components/date_picker/date_picker.js +1 -1
  70. package/lib/components/empty_prompt/empty_prompt.js +1 -1
  71. package/lib/components/form/field_text/field_text.js +1 -1
  72. package/lib/components/form/form_control_layout/form_control_layout.js +1 -1
  73. package/lib/components/form/form_control_layout/form_control_layout_icons.js +1 -1
  74. package/lib/components/health/health.js +1 -1
  75. package/lib/components/icon/icon.js +54 -499
  76. package/lib/components/icon/icon.styles.js +79 -0
  77. package/lib/components/icon/icon_map.js +463 -0
  78. package/lib/components/icon/named_colors.js +4 -15
  79. package/lib/components/list_group/list_group.js +1 -1
  80. package/lib/components/list_group/list_group_item.js +1 -1
  81. package/lib/components/list_group/pinnable_list_group/pinnable_list_group.js +2 -2
  82. package/lib/components/notification/notification_event.js +2 -2
  83. package/lib/components/notification/notification_event_meta.js +1 -1
  84. package/lib/components/notification/notification_event_read_button.js +1 -1
  85. package/lib/components/panel/panel.js +2 -1
  86. package/lib/components/progress/progress.js +36 -88
  87. package/lib/components/progress/progress.styles.js +166 -0
  88. package/lib/components/selectable/selectable_list/selectable_list.js +3 -1
  89. package/lib/components/selectable/selectable_list/selectable_list_item.js +1 -1
  90. package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +3 -3
  91. package/lib/components/text/text.js +2 -0
  92. package/lib/components/tool_tip/icon_tip.js +1 -1
  93. package/lib/global_styling/utility/utility.js +5 -1
  94. package/lib/services/theme/hooks.js +2 -0
  95. package/optimize/es/components/accessibility/screen_reader_live/screen_reader_live.js +21 -6
  96. package/optimize/es/components/accessibility/screen_reader_only/screen_reader_only.js +11 -17
  97. package/optimize/es/components/accessibility/screen_reader_only/screen_reader_only.styles.js +11 -1
  98. package/optimize/es/components/accessibility/skip_link/skip_link.js +20 -4
  99. package/optimize/es/components/datagrid/utils/focus.js +1 -0
  100. package/optimize/es/components/icon/icon.js +40 -492
  101. package/optimize/es/components/icon/icon.styles.js +75 -0
  102. package/optimize/es/components/icon/icon_map.js +455 -0
  103. package/optimize/es/components/icon/named_colors.js +2 -13
  104. package/optimize/es/components/panel/panel.js +2 -1
  105. package/optimize/es/components/progress/progress.js +31 -84
  106. package/optimize/es/components/progress/progress.styles.js +155 -0
  107. package/optimize/es/components/selectable/selectable_list/selectable_list.js +2 -0
  108. package/optimize/es/components/text/text.js +2 -0
  109. package/optimize/es/global_styling/utility/utility.js +3 -1
  110. package/optimize/es/services/theme/hooks.js +2 -0
  111. package/optimize/lib/components/accessibility/screen_reader_live/screen_reader_live.js +20 -5
  112. package/optimize/lib/components/accessibility/screen_reader_only/screen_reader_only.js +18 -16
  113. package/optimize/lib/components/accessibility/screen_reader_only/screen_reader_only.styles.js +16 -2
  114. package/optimize/lib/components/accessibility/skip_link/skip_link.js +21 -4
  115. package/optimize/lib/components/datagrid/utils/focus.js +1 -0
  116. package/optimize/lib/components/icon/icon.js +49 -494
  117. package/optimize/lib/components/icon/icon.styles.js +81 -0
  118. package/optimize/lib/components/icon/icon_map.js +463 -0
  119. package/optimize/lib/components/icon/named_colors.js +4 -15
  120. package/optimize/lib/components/panel/panel.js +2 -1
  121. package/optimize/lib/components/progress/progress.js +33 -85
  122. package/optimize/lib/components/progress/progress.styles.js +168 -0
  123. package/optimize/lib/components/selectable/selectable_list/selectable_list.js +2 -0
  124. package/optimize/lib/components/text/text.js +2 -0
  125. package/optimize/lib/global_styling/utility/utility.js +5 -1
  126. package/optimize/lib/services/theme/hooks.js +2 -0
  127. package/package.json +2 -2
  128. package/src/components/form/form_control_layout/_form_control_layout.scss +2 -4
  129. package/src/components/index.scss +0 -3
  130. package/src/global_styling/variables/_form.scss +9 -0
  131. package/src/themes/amsterdam/overrides/_index.scss +0 -1
  132. package/test-env/components/accessibility/screen_reader_live/screen_reader_live.js +29 -6
  133. package/test-env/components/accessibility/screen_reader_only/screen_reader_only.js +21 -18
  134. package/test-env/components/accessibility/screen_reader_only/screen_reader_only.styles.js +16 -2
  135. package/test-env/components/accessibility/skip_link/skip_link.js +21 -4
  136. package/test-env/components/avatar/avatar.js +2 -2
  137. package/test-env/components/badge/badge.js +1 -1
  138. package/test-env/components/button/button_icon/button_icon.js +1 -1
  139. package/test-env/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +2 -2
  140. package/test-env/components/datagrid/body/data_grid_body.js +6 -6
  141. package/test-env/components/datagrid/body/data_grid_cell.js +12 -12
  142. package/test-env/components/datagrid/body/header/data_grid_header_cell.js +6 -6
  143. package/test-env/components/datagrid/body/header/data_grid_header_row.js +6 -6
  144. package/test-env/components/datagrid/data_grid.js +6 -6
  145. package/test-env/components/datagrid/utils/focus.js +1 -0
  146. package/test-env/components/datagrid/utils/in_memory.js +6 -6
  147. package/test-env/components/date_picker/date_picker.js +1 -1
  148. package/test-env/components/empty_prompt/empty_prompt.js +1 -1
  149. package/test-env/components/form/field_text/field_text.js +1 -1
  150. package/test-env/components/form/form_control_layout/form_control_layout.js +1 -1
  151. package/test-env/components/form/form_control_layout/form_control_layout_icons.js +1 -1
  152. package/test-env/components/health/health.js +1 -1
  153. package/test-env/components/icon/icon.styles.js +81 -0
  154. package/test-env/components/icon/icon_map.js +463 -0
  155. package/test-env/components/icon/named_colors.js +4 -15
  156. package/test-env/components/list_group/list_group.js +1 -1
  157. package/test-env/components/list_group/list_group_item.js +1 -1
  158. package/test-env/components/list_group/pinnable_list_group/pinnable_list_group.js +2 -2
  159. package/test-env/components/notification/notification_event.js +2 -2
  160. package/test-env/components/notification/notification_event_meta.js +1 -1
  161. package/test-env/components/notification/notification_event_read_button.js +1 -1
  162. package/test-env/components/panel/panel.js +2 -1
  163. package/test-env/components/progress/progress.js +36 -88
  164. package/test-env/components/progress/progress.styles.js +168 -0
  165. package/test-env/components/selectable/selectable_list/selectable_list.js +3 -1
  166. package/test-env/components/selectable/selectable_list/selectable_list_item.js +1 -1
  167. package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +3 -3
  168. package/test-env/components/text/text.js +2 -0
  169. package/test-env/components/tool_tip/icon_tip.js +1 -1
  170. package/test-env/global_styling/utility/utility.js +5 -1
  171. package/test-env/services/theme/hooks.js +2 -0
  172. package/src/components/accessibility/_index.scss +0 -1
  173. package/src/components/accessibility/screen_reader_only/_screen_reader_only.scss +0 -5
  174. package/src/components/icon/_icon.scss +0 -87
  175. package/src/components/icon/_index.scss +0 -2
  176. package/src/components/icon/_variables.scss +0 -22
  177. package/src/components/progress/_index.scss +0 -2
  178. package/src/components/progress/_progress.scss +0 -166
  179. package/src/components/progress/_variables.scss +0 -21
  180. package/src/themes/amsterdam/overrides/_progress.scss +0 -3
@@ -17,10 +17,12 @@ var _i18n = require("../i18n");
17
17
 
18
18
  var _inner_text = require("../inner_text");
19
19
 
20
- var _common = require("../common");
21
-
22
20
  var _predicate = require("../../services/predicate");
23
21
 
22
+ var _services = require("../../services");
23
+
24
+ var _progress = require("./progress.styles");
25
+
24
26
  var _react2 = require("@emotion/react");
25
27
 
26
28
  var _excluded = ["className", "color", "size", "position", "max", "valueText", "label", "value", "labelProps"];
@@ -37,63 +39,11 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
37
39
 
38
40
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
39
41
 
40
- var sizeToClassNameMap = {
41
- xs: 'euiProgress--xs',
42
- s: 'euiProgress--s',
43
- m: 'euiProgress--m',
44
- l: 'euiProgress--l'
45
- };
46
- var SIZES = (0, _common.keysOf)(sizeToClassNameMap);
42
+ var SIZES = ['xs', 's', 'm', 'l'];
47
43
  exports.SIZES = SIZES;
48
- var colorToClassNameMap = {
49
- primary: 'euiProgress--primary',
50
- success: 'euiProgress--success',
51
- warning: 'euiProgress--warning',
52
- danger: 'euiProgress--danger',
53
- subdued: 'euiProgress--subdued',
54
- accent: 'euiProgress--accent',
55
- vis0: 'euiProgress--vis0',
56
- vis1: 'euiProgress--vis1',
57
- vis2: 'euiProgress--vis2',
58
- vis3: 'euiProgress--vis3',
59
- vis4: 'euiProgress--vis4',
60
- vis5: 'euiProgress--vis5',
61
- vis6: 'euiProgress--vis6',
62
- vis7: 'euiProgress--vis7',
63
- vis8: 'euiProgress--vis8',
64
- vis9: 'euiProgress--vis9'
65
- };
66
- var COLORS = (0, _common.keysOf)(colorToClassNameMap);
44
+ var COLORS = ['primary', 'success', 'warning', 'danger', 'subdued', 'accent', 'vis0', 'vis1', 'vis2', 'vis3', 'vis4', 'vis5', 'vis6', 'vis7', 'vis8', 'vis9'];
67
45
  exports.COLORS = COLORS;
68
-
69
- function isNamedColor(name) {
70
- return colorToClassNameMap.hasOwnProperty(name);
71
- }
72
-
73
- var dataColorToClassNameMap = {
74
- primary: 'euiProgress__data--primary',
75
- success: 'euiProgress__data--success',
76
- warning: 'euiProgress__data--warning',
77
- danger: 'euiProgress__data--danger',
78
- subdued: 'euiProgress__data--subdued',
79
- accent: 'euiProgress__data--accent',
80
- vis0: 'euiProgress__data--vis0',
81
- vis1: 'euiProgress__data--vis1',
82
- vis2: 'euiProgress__data--vis2',
83
- vis3: 'euiProgress__data--vis3',
84
- vis4: 'euiProgress__data--vis4',
85
- vis5: 'euiProgress__data--vis5',
86
- vis6: 'euiProgress__data--vis6',
87
- vis7: 'euiProgress__data--vis7',
88
- vis8: 'euiProgress__data--vis8',
89
- vis9: 'euiProgress__data--vis9'
90
- };
91
- var positionsToClassNameMap = {
92
- fixed: 'euiProgress--fixed',
93
- absolute: 'euiProgress--absolute',
94
- static: ''
95
- };
96
- var POSITIONS = (0, _common.keysOf)(positionsToClassNameMap);
46
+ var POSITIONS = ['fixed', 'absolute', 'static'];
97
47
  exports.POSITIONS = POSITIONS;
98
48
 
99
49
  var EuiProgress = function EuiProgress(_ref) {
@@ -113,30 +63,23 @@ var EuiProgress = function EuiProgress(_ref) {
113
63
  rest = _objectWithoutProperties(_ref, _excluded);
114
64
 
115
65
  var determinate = !(0, _predicate.isNil)(max);
116
- var colorClass = null;
117
- var dataColorClass = null;
118
- var optionalCustomStyles = null;
119
-
120
- if (color) {
121
- if (isNamedColor(color)) {
122
- colorClass = colorToClassNameMap[color];
123
- dataColorClass = dataColorToClassNameMap[color];
124
- } else {
125
- optionalCustomStyles = {
126
- color: color
127
- };
128
- colorClass = 'euiProgress--customColor';
129
- }
130
- }
131
-
132
- var classes = (0, _classnames.default)('euiProgress', {
133
- 'euiProgress--indeterminate': !determinate,
134
- 'euiProgress--native': determinate
135
- }, sizeToClassNameMap[size], colorClass, positionsToClassNameMap[position], className);
136
- var dataClasses = (0, _classnames.default)('euiProgress__data', {
137
- 'euiProgress__data--l': size === 'l'
138
- }, dataColorClass);
139
- var labelClasses = (0, _classnames.default)('euiProgress__label', labelProps && labelProps.className);
66
+ var isNamedColor = COLORS.includes(color);
67
+ var euiTheme = (0, _services.useEuiTheme)();
68
+ var customColorStyles = !isNamedColor ? {
69
+ color: color
70
+ } : {};
71
+ var customTextColorStyles = !isNamedColor ? {
72
+ color: (0, _services.makeHighContrastColor)(color)(euiTheme.euiTheme)
73
+ } : {};
74
+ var styles = (0, _progress.euiProgressStyles)(euiTheme, determinate);
75
+ var cssStyles = [styles.euiProgress, determinate && styles.native, !determinate && styles.indeterminate, styles[size], styles[position], isNamedColor ? styles[color] : styles.customColor];
76
+ var dataStyles = (0, _progress.euiProgressDataStyles)(euiTheme);
77
+ var dataCssStyles = [dataStyles.euiProgress__data, size === 'l' && dataStyles[size]];
78
+ var labelCssStyles = [_progress.euiProgressLabelStyles.euiProgress__label];
79
+ var valueTextStyles = (0, _progress.euiProgressValueTextStyles)(euiTheme);
80
+ var valueTextCssStyles = [valueTextStyles.euiProgress__valueText, isNamedColor ? valueTextStyles[color] : styles.customColor];
81
+ var classes = (0, _classnames.default)('euiProgress', className);
82
+ var labelClasses = (0, _classnames.default)('euiProgress__label', labelProps === null || labelProps === void 0 ? void 0 : labelProps.className);
140
83
  var valueRender;
141
84
 
142
85
  if (valueText === true) {
@@ -157,31 +100,36 @@ var EuiProgress = function EuiProgress(_ref) {
157
100
 
158
101
  if (determinate) {
159
102
  return (0, _react2.jsx)(_react.Fragment, null, label || valueText ? (0, _react2.jsx)("div", {
160
- className: dataClasses
103
+ css: dataCssStyles,
104
+ className: "euiProgress__data"
161
105
  }, label && (0, _react2.jsx)(_inner_text.EuiInnerText, null, function (ref, innerText) {
162
106
  return (0, _react2.jsx)("span", _extends({
163
107
  title: innerText,
164
108
  ref: ref
165
109
  }, labelProps, {
110
+ css: labelCssStyles,
166
111
  className: labelClasses
167
112
  }), label);
168
113
  }), valueRender && (0, _react2.jsx)(_inner_text.EuiInnerText, null, function (ref, innerText) {
169
114
  return (0, _react2.jsx)("span", {
170
115
  title: innerText,
171
116
  ref: ref,
172
- style: optionalCustomStyles,
117
+ style: customTextColorStyles,
118
+ css: valueTextCssStyles,
173
119
  className: "euiProgress__valueText"
174
120
  }, valueRender);
175
121
  })) : undefined, (0, _react2.jsx)("progress", _extends({
122
+ css: cssStyles,
176
123
  className: classes,
177
- style: optionalCustomStyles,
124
+ style: customColorStyles,
178
125
  max: max,
179
126
  value: value,
180
127
  "aria-hidden": label && valueText ? true : false
181
128
  }, rest)));
182
129
  } else {
183
130
  return (0, _react2.jsx)("div", _extends({
184
- style: optionalCustomStyles,
131
+ css: cssStyles,
132
+ style: customColorStyles,
185
133
  className: classes
186
134
  }, rest));
187
135
  }
@@ -192,7 +140,7 @@ EuiProgress.propTypes = {
192
140
  className: _propTypes.default.string,
193
141
  "aria-label": _propTypes.default.string,
194
142
  "data-test-subj": _propTypes.default.string,
195
- size: _propTypes.default.oneOf(["xs", "s", "m", "l"]),
143
+ size: _propTypes.default.any,
196
144
 
197
145
  /**
198
146
  * One of EUI's color palette, vis colors or a valid CSS color value https://developer.mozilla.org/en-US/docs/Web/CSS/color_value
@@ -201,8 +149,8 @@ EuiProgress.propTypes = {
201
149
  /**
202
150
  * One of EUI's color palette, vis colors or a valid CSS color value https://developer.mozilla.org/en-US/docs/Web/CSS/color_value
203
151
  */
204
- color: _propTypes.default.oneOfType([_propTypes.default.oneOf(["primary", "success", "warning", "danger", "subdued", "accent", "vis0", "vis1", "vis2", "vis3", "vis4", "vis5", "vis6", "vis7", "vis8", "vis9"]).isRequired, _propTypes.default.any.isRequired]),
205
- position: _propTypes.default.oneOf(["fixed", "absolute", "static"]),
152
+ color: _propTypes.default.oneOfType([_propTypes.default.any.isRequired, _propTypes.default.any.isRequired]),
153
+ position: _propTypes.default.any,
206
154
  max: _propTypes.default.number,
207
155
 
208
156
  /*
@@ -0,0 +1,166 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.euiProgressValueTextStyles = exports.euiProgressStyles = exports.euiProgressLabelStyles = exports.euiProgressDataStyles = void 0;
7
+
8
+ var _react = require("@emotion/react");
9
+
10
+ var _global_styling = require("../../global_styling");
11
+
12
+ var _services = require("../../services");
13
+
14
+ var _text = require("../text/text.styles");
15
+
16
+ var _templateObject;
17
+
18
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
19
+
20
+ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
21
+
22
+ /**
23
+ * DRY utilities for native/determinate progress components vs non-native indeterminate
24
+ */
25
+ var crossBrowserProgressValue = function crossBrowserProgressValue(cssProperties) {
26
+ return "\n &::-webkit-progress-value {\n ".concat(cssProperties, "\n }\n &::-moz-progress-bar {\n ").concat(cssProperties, "\n }\n");
27
+ };
28
+
29
+ var indeterminateProgressValue = function indeterminateProgressValue(cssProperties) {
30
+ return "\n &:before {\n ".concat(cssProperties, "\n }\n");
31
+ };
32
+ /**
33
+ * Color utilities
34
+ */
35
+
36
+
37
+ var visColors = (0, _services.euiPaletteColorBlind)();
38
+
39
+ var nativeVsIndeterminateColor = function nativeVsIndeterminateColor(color, isNative) {
40
+ var selectors = isNative ? crossBrowserProgressValue : indeterminateProgressValue;
41
+ return selectors("background-color: ".concat(color, ";"));
42
+ };
43
+ /**
44
+ * DRY utils for non-static positions
45
+ */
46
+
47
+
48
+ var nonStaticPositioning = function nonStaticPositioning(isNative) {
49
+ return "\n top: 0;\n left: 0;\n right: 0;\n background-color: transparent;\n ".concat(isNative ? "\n &::-webkit-progress-bar {\n background-color: transparent;\n }" : '', "\n");
50
+ };
51
+ /**
52
+ * Animations
53
+ */
54
+
55
+
56
+ var euiIndeterminateAnimation = (0, _react.keyframes)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 0% {\n transform: scaleX(1) translateX(-100%);\n }\n 100% {\n transform: scaleX(1) translateX(100%);\n }\n"])));
57
+ /**
58
+ * Emotion styles
59
+ */
60
+
61
+ var _ref2 = process.env.NODE_ENV === "production" ? {
62
+ name: "187h6sp-static",
63
+ styles: "position:relative;label:static;"
64
+ } : {
65
+ name: "187h6sp-static",
66
+ styles: "position:relative;label:static;",
67
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
68
+ };
69
+
70
+ var euiProgressStyles = function euiProgressStyles(_ref3, isNative) {
71
+ var euiTheme = _ref3.euiTheme;
72
+ return {
73
+ euiProgress: /*#__PURE__*/(0, _react.css)("overflow:hidden;background-color:", euiTheme.colors.lightShade, ";;label:euiProgress;"),
74
+ // https://css-tricks.com/html5-progress-element/
75
+ // Good resource if you need to work in here. There's some gotchas with
76
+ // dealing with cross-browser progress bars.
77
+ native: /*#__PURE__*/(0, _react.css)("display:block;", (0, _global_styling.logicalCSS)('width', '100%'), " appearance:none;border:none;border-radius:", euiTheme.size.s, ";&::-webkit-progress-bar{background-color:", euiTheme.colors.lightShade, ";}", crossBrowserProgressValue("transition: width ".concat(euiTheme.animation.normal, " linear;")), ";;label:native;"),
78
+ // An indeterminate bar has an unreliable end time. Because of a Firefox animation issue,
79
+ // we apply this style to a <div> instead of a <progress> element.
80
+ // See https://css-tricks.com/html5-progress-element/ for more info.
81
+ indeterminate: /*#__PURE__*/(0, _react.css)("&:before{position:absolute;content:'';", (0, _global_styling.logicalCSS)('width', '100%'), " top:0;bottom:0;left:0;transform:scaleX(0) translateX(0%);animation:", euiIndeterminateAnimation, " 1s ", euiTheme.animation.resistance, " infinite;", _global_styling.euiCantAnimate, "{animation-duration:2s;animation-timing-function:linear;}};label:indeterminate;"),
82
+ // Sizes
83
+ xs: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('height', euiTheme.size.xxs), ";;label:xs;"),
84
+ s: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('height', euiTheme.size.xs), ";;label:s;"),
85
+ m: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('height', euiTheme.size.s), ";;label:m;"),
86
+ l: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('height', euiTheme.size.m), ";;label:l;"),
87
+ // Positioning
88
+ fixed: /*#__PURE__*/(0, _react.css)("position:fixed;z-index:", Number(euiTheme.levels.header) + 1, ";", nonStaticPositioning(isNative), ";;label:fixed;"),
89
+ absolute: /*#__PURE__*/(0, _react.css)("position:absolute;", nonStaticPositioning(isNative), ";;label:absolute;"),
90
+ static: _ref2,
91
+ // Colors
92
+ primary: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor(euiTheme.colors.primary, isNative), ";;label:primary;"),
93
+ success: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor(euiTheme.colors.success, isNative), ";;label:success;"),
94
+ warning: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor(euiTheme.colors.warning, isNative), ";;label:warning;"),
95
+ danger: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor(euiTheme.colors.danger, isNative), ";;label:danger;"),
96
+ subdued: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor(euiTheme.colors.subduedText, isNative), ";;label:subdued;"),
97
+ accent: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor(euiTheme.colors.accent, isNative), ";;label:accent;"),
98
+ vis0: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor(visColors[0], isNative), ";;label:vis0;"),
99
+ vis1: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor(visColors[1], isNative), ";;label:vis1;"),
100
+ vis2: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor(visColors[2], isNative), ";;label:vis2;"),
101
+ vis3: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor(visColors[3], isNative), ";;label:vis3;"),
102
+ vis4: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor(visColors[4], isNative), ";;label:vis4;"),
103
+ vis5: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor(visColors[5], isNative), ";;label:vis5;"),
104
+ vis6: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor(visColors[6], isNative), ";;label:vis6;"),
105
+ vis7: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor(visColors[7], isNative), ";;label:vis7;"),
106
+ vis8: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor(visColors[8], isNative), ";;label:vis8;"),
107
+ vis9: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor(visColors[9], isNative), ";;label:vis9;"),
108
+ customColor: /*#__PURE__*/(0, _react.css)(nativeVsIndeterminateColor('currentColor', isNative), ";;label:customColor;")
109
+ };
110
+ };
111
+ /**
112
+ * Data styles
113
+ */
114
+
115
+
116
+ exports.euiProgressStyles = euiProgressStyles;
117
+
118
+ var euiProgressDataStyles = function euiProgressDataStyles(euiThemeContext) {
119
+ return {
120
+ euiProgress__data: /*#__PURE__*/(0, _react.css)("display:flex;justify-content:space-between;gap:", euiThemeContext.euiTheme.size.xs, ";", (0, _text.euiText)(euiThemeContext.euiTheme), " ", (0, _global_styling.euiFontSize)(euiThemeContext, 'xs'), ";;label:euiProgress__data;"),
121
+ // Sizes
122
+ l: /*#__PURE__*/(0, _react.css)((0, _global_styling.euiFontSize)(euiThemeContext, 's'), ";;label:l;")
123
+ };
124
+ };
125
+
126
+ exports.euiProgressDataStyles = euiProgressDataStyles;
127
+ var euiProgressLabelStyles = {
128
+ euiProgress__label: /*#__PURE__*/(0, _react.css)("flex-grow:1;", (0, _global_styling.euiTextTruncate)(), ";;label:euiProgress__label;")
129
+ };
130
+ exports.euiProgressLabelStyles = euiProgressLabelStyles;
131
+
132
+ var _ref = process.env.NODE_ENV === "production" ? {
133
+ name: "15ioh86-customColor",
134
+ styles: "color:currentColor;label:customColor;"
135
+ } : {
136
+ name: "15ioh86-customColor",
137
+ styles: "color:currentColor;label:customColor;",
138
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
139
+ };
140
+
141
+ var euiProgressValueTextStyles = function euiProgressValueTextStyles(_ref4) {
142
+ var euiTheme = _ref4.euiTheme;
143
+ return {
144
+ euiProgress__valueText: /*#__PURE__*/(0, _react.css)("flex-grow:1;flex-shrink:0;font-feature-settings:'tnum' 1;", (0, _global_styling.logicalTextAlignCSS)('right'), " ", (0, _global_styling.euiTextTruncate)(), ";;label:euiProgress__valueText;"),
145
+ // Colors
146
+ primary: /*#__PURE__*/(0, _react.css)("color:", euiTheme.colors.primaryText, ";;label:primary;"),
147
+ success: /*#__PURE__*/(0, _react.css)("color:", euiTheme.colors.successText, ";;label:success;"),
148
+ warning: /*#__PURE__*/(0, _react.css)("color:", euiTheme.colors.warningText, ";;label:warning;"),
149
+ danger: /*#__PURE__*/(0, _react.css)("color:", euiTheme.colors.dangerText, ";;label:danger;"),
150
+ subdued: /*#__PURE__*/(0, _react.css)("color:", euiTheme.colors.subduedText, ";;label:subdued;"),
151
+ accent: /*#__PURE__*/(0, _react.css)("color:", euiTheme.colors.accentText, ";;label:accent;"),
152
+ vis0: /*#__PURE__*/(0, _react.css)("color:", (0, _services.makeHighContrastColor)(visColors[0])(euiTheme), ";;label:vis0;"),
153
+ vis1: /*#__PURE__*/(0, _react.css)("color:", (0, _services.makeHighContrastColor)(visColors[1])(euiTheme), ";;label:vis1;"),
154
+ vis2: /*#__PURE__*/(0, _react.css)("color:", (0, _services.makeHighContrastColor)(visColors[2])(euiTheme), ";;label:vis2;"),
155
+ vis3: /*#__PURE__*/(0, _react.css)("color:", (0, _services.makeHighContrastColor)(visColors[3])(euiTheme), ";;label:vis3;"),
156
+ vis4: /*#__PURE__*/(0, _react.css)("color:", (0, _services.makeHighContrastColor)(visColors[4])(euiTheme), ";;label:vis4;"),
157
+ vis5: /*#__PURE__*/(0, _react.css)("color:", (0, _services.makeHighContrastColor)(visColors[5])(euiTheme), ";;label:vis5;"),
158
+ vis6: /*#__PURE__*/(0, _react.css)("color:", (0, _services.makeHighContrastColor)(visColors[6])(euiTheme), ";;label:vis6;"),
159
+ vis7: /*#__PURE__*/(0, _react.css)("color:", (0, _services.makeHighContrastColor)(visColors[7])(euiTheme), ";;label:vis7;"),
160
+ vis8: /*#__PURE__*/(0, _react.css)("color:", (0, _services.makeHighContrastColor)(visColors[8])(euiTheme), ";;label:vis8;"),
161
+ vis9: /*#__PURE__*/(0, _react.css)("color:", (0, _services.makeHighContrastColor)(visColors[9])(euiTheme), ";;label:vis9;"),
162
+ customColor: _ref
163
+ };
164
+ };
165
+
166
+ exports.euiProgressValueTextStyles = euiProgressValueTextStyles;
@@ -186,6 +186,8 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
186
186
  setActiveOptionIndex(index);
187
187
  },
188
188
  onClick: function onClick(event) {
189
+ event.persist(); // NOTE: This is needed for React v16 backwards compatibility
190
+
189
191
  _this.onAddOrRemoveOption(option, event);
190
192
  },
191
193
  ref: ref ? ref.bind(null, index) : undefined,
@@ -456,7 +458,7 @@ EuiSelectableList.propTypes = {
456
458
  /**
457
459
  * Accepts either our palette colors (primary, success ..etc) or a hex value `#FFFFFF`, `#000`.
458
460
  */
459
- color: _propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.oneOf(["default", "primary", "success", "accent", "warning", "danger", "text", "subdued", "ghost", "inherit"]).isRequired]),
461
+ color: _propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.any.isRequired]),
460
462
 
461
463
  /**
462
464
  * Will override any color passed through the `color` prop.
@@ -293,7 +293,7 @@ EuiSelectableListItem.propTypes = {
293
293
  /**
294
294
  * Accepts either our palette colors (primary, success ..etc) or a hex value `#FFFFFF`, `#000`.
295
295
  */
296
- color: _propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.oneOf(["default", "primary", "success", "accent", "warning", "danger", "text", "subdued", "ghost", "inherit"]).isRequired]),
296
+ color: _propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.any.isRequired]),
297
297
 
298
298
  /**
299
299
  * Will override any color passed through the `color` prop.
@@ -310,7 +310,7 @@ EuiSelectableTemplateSitewide.propTypes = {
310
310
  * One of EUI's color palette or a valid CSS color value https://developer.mozilla.org/en-US/docs/Web/CSS/color_value.
311
311
  * Note that coloring only works if your SVG is removed of fill attributes.
312
312
  */
313
- color: _propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.oneOf(["default", "primary", "success", "accent", "warning", "danger", "text", "subdued", "ghost", "inherit"]).isRequired]),
313
+ color: _propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.any.isRequired]),
314
314
 
315
315
  /**
316
316
  * Descriptive title for naming the icon based on its use
@@ -367,12 +367,12 @@ EuiSelectableTemplateSitewide.propTypes = {
367
367
  /**
368
368
  * Manually change icon size
369
369
  */
370
- iconSize: _propTypes.default.oneOf(["original", "s", "m", "l", "xl", "xxl"]),
370
+ iconSize: _propTypes.default.any,
371
371
 
372
372
  /**
373
373
  * Manually change icon color
374
374
  */
375
- iconColor: _propTypes.default.oneOfType([_propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.oneOf(["default", "primary", "success", "accent", "warning", "danger", "text", "subdued", "ghost", "inherit"]).isRequired]).isRequired, _propTypes.default.oneOf([null])]),
375
+ iconColor: _propTypes.default.oneOfType([_propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.any.isRequired]).isRequired, _propTypes.default.oneOf([null])]),
376
376
 
377
377
  /**
378
378
  * Full name of avatar for title attribute and calculating initial if not provided
@@ -57,6 +57,7 @@ var EuiText = function EuiText(_ref) {
57
57
  if (color) {
58
58
  text = (0, _react2.jsx)(_text_color.EuiTextColor, {
59
59
  color: color,
60
+ className: classes,
60
61
  cloneElement: true
61
62
  }, text);
62
63
  }
@@ -64,6 +65,7 @@ var EuiText = function EuiText(_ref) {
64
65
  if (textAlign) {
65
66
  text = (0, _react2.jsx)(_text_align.EuiTextAlign, {
66
67
  textAlign: textAlign,
68
+ className: classes,
67
69
  cloneElement: true
68
70
  }, text);
69
71
  }
@@ -102,7 +102,7 @@ EuiIconTip.propTypes = {
102
102
  /**
103
103
  * The icon size.
104
104
  */
105
- size: _propTypes.default.oneOf(["original", "s", "m", "l", "xl", "xxl"]),
105
+ size: _propTypes.default.any,
106
106
 
107
107
  /**
108
108
  * Explain what this icon means for screen readers.
@@ -9,6 +9,8 @@ var _react = _interopRequireDefault(require("react"));
9
9
 
10
10
  var _react2 = require("@emotion/react");
11
11
 
12
+ var _screen_reader_only = require("../../components/accessibility/screen_reader_only/screen_reader_only.styles");
13
+
12
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
15
 
14
16
  /*
@@ -18,9 +20,11 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
18
20
  * in compliance with, at your election, the Elastic License 2.0 or the Server
19
21
  * Side Public License, v 1.
20
22
  */
23
+ var globalStyles = /*#__PURE__*/(0, _react2.css)(".euiScreenReaderOnly{", (0, _screen_reader_only.euiScreenReaderOnly)(), ";};label:globalStyles;");
24
+
21
25
  var EuiUtilityClasses = function EuiUtilityClasses() {
22
26
  return (0, _react2.jsx)(_react2.Global, {
23
- styles: /*#__PURE__*/(0, _react2.css)(";label:EuiUtilityClasses;")
27
+ styles: globalStyles
24
28
  });
25
29
  };
26
30
 
@@ -32,6 +32,8 @@ var useEuiTheme = function useEuiTheme() {
32
32
 
33
33
  exports.useEuiTheme = useEuiTheme;
34
34
 
35
+ // Provide the component props interface as the generic to allow the docs props table to populate.
36
+ // e.g., `const EuiComponent = withEuiTheme<EuiComponentProps>(_EuiComponent)`
35
37
  var withEuiTheme = function withEuiTheme(Component) {
36
38
  var componentName = Component.displayName || Component.name || 'ComponentWithTheme';
37
39
 
@@ -7,7 +7,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
7
7
  * in compliance with, at your election, the Elastic License 2.0 or the Server
8
8
  * Side Public License, v 1.
9
9
  */
10
- import React, { useEffect, useState } from 'react';
10
+ import React, { useEffect, useRef, useState } from 'react';
11
11
  import { EuiScreenReaderOnly } from '../screen_reader_only';
12
12
  import { jsx as ___EmotionJSX } from "@emotion/react";
13
13
  export var EuiScreenReaderLive = function EuiScreenReaderLive(_ref) {
@@ -17,18 +17,26 @@ export var EuiScreenReaderLive = function EuiScreenReaderLive(_ref) {
17
17
  _ref$role = _ref.role,
18
18
  role = _ref$role === void 0 ? 'status' : _ref$role,
19
19
  _ref$ariaLive = _ref['aria-live'],
20
- ariaLive = _ref$ariaLive === void 0 ? 'polite' : _ref$ariaLive;
20
+ ariaLive = _ref$ariaLive === void 0 ? 'polite' : _ref$ariaLive,
21
+ _ref$focusRegionOnTex = _ref.focusRegionOnTextChange,
22
+ focusRegionOnTextChange = _ref$focusRegionOnTex === void 0 ? false : _ref$focusRegionOnTex;
21
23
 
22
24
  var _useState = useState(false),
23
25
  _useState2 = _slicedToArray(_useState, 2),
24
26
  toggle = _useState2[0],
25
27
  setToggle = _useState2[1];
26
28
 
29
+ var focusRef = useRef(null);
27
30
  useEffect(function () {
28
31
  setToggle(function (toggle) {
29
32
  return !toggle;
30
33
  });
31
34
  }, [children]);
35
+ useEffect(function () {
36
+ if (focusRef.current !== null && focusRegionOnTextChange) {
37
+ focusRef.current.focus();
38
+ }
39
+ }, [toggle, focusRegionOnTextChange]);
32
40
  return (
33
41
  /**
34
42
  * Intentionally uses two persistent live regions with oscillating content updates.
@@ -40,14 +48,21 @@ export var EuiScreenReaderLive = function EuiScreenReaderLive(_ref) {
40
48
  * See also https://github.com/AlmeroSteyn/react-aria-live and https://github.com/dequelabs/ngA11y
41
49
  * for more examples of the double region approach.
42
50
  */
43
- ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("div", null, ___EmotionJSX("div", {
51
+ ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("div", {
52
+ ref: focusRef,
53
+ tabIndex: focusRegionOnTextChange ? -1 : undefined
54
+ }, ___EmotionJSX("div", {
44
55
  role: role,
45
- "aria-atomic": "true",
46
- "aria-live": ariaLive
56
+ "aria-atomic": "true" // Setting `aria-hidden` and setting `aria-live` to "off" prevents
57
+ // double announcements from VO when `focusRegionOnTextChange` is true
58
+ ,
59
+ "aria-hidden": toggle ? undefined : 'true',
60
+ "aria-live": focusRegionOnTextChange ? 'off' : ariaLive
47
61
  }, isActive && toggle ? children : ''), ___EmotionJSX("div", {
48
62
  role: role,
49
63
  "aria-atomic": "true",
50
- "aria-live": ariaLive
64
+ "aria-hidden": !toggle ? undefined : 'true',
65
+ "aria-live": focusRegionOnTextChange ? 'off' : ariaLive
51
66
  }, isActive && !toggle ? children : '')))
52
67
  );
53
68
  };
@@ -1,9 +1,3 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
-
3
- 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; }
4
-
5
- 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) { _defineProperty(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; }
6
-
7
1
  /*
8
2
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
9
3
  * or more contributor license agreements. Licensed under the Elastic License
@@ -11,19 +5,19 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
11
5
  * in compliance with, at your election, the Elastic License 2.0 or the Server
12
6
  * Side Public License, v 1.
13
7
  */
14
- import { cloneElement } from 'react';
15
8
  import classNames from 'classnames';
9
+ import { cloneElementWithCss } from '../../../services/theme/clone_element';
10
+ import { euiScreenReaderOnlyStyles } from './screen_reader_only.styles';
16
11
  export var EuiScreenReaderOnly = function EuiScreenReaderOnly(_ref) {
17
12
  var children = _ref.children,
13
+ className = _ref.className,
18
14
  showOnFocus = _ref.showOnFocus;
19
- var classes = classNames({
20
- euiScreenReaderOnly: !showOnFocus,
21
- 'euiScreenReaderOnly--showOnFocus': showOnFocus
22
- }, children.props.className);
23
-
24
- var props = _objectSpread(_objectSpread({}, children.props), {}, {
25
- className: classes
26
- });
27
-
28
- return /*#__PURE__*/cloneElement(children, props);
15
+ var classes = classNames(className, children.props.className);
16
+ var styles = euiScreenReaderOnlyStyles(showOnFocus);
17
+ var cssStyles = [styles.euiScreenReaderOnly];
18
+ var props = {
19
+ className: classes.length ? classes : undefined,
20
+ css: cssStyles
21
+ };
22
+ return cloneElementWithCss(children, props);
29
23
  };
@@ -5,11 +5,21 @@
5
5
  * in compliance with, at your election, the Elastic License 2.0 or the Server
6
6
  * Side Public License, v 1.
7
7
  */
8
-
8
+ import { css } from '@emotion/react';
9
9
  /*
10
10
  * Mixin that hides elements offscreen to only be read by screen reader
11
11
  * See https://github.com/elastic/eui/pull/5130 and https://github.com/elastic/eui/pull/5152 for more info
12
12
  */
13
+
13
14
  export var euiScreenReaderOnly = function euiScreenReaderOnly() {
14
15
  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";
16
+ };
17
+ /*
18
+ * Styles
19
+ */
20
+
21
+ export var euiScreenReaderOnlyStyles = function euiScreenReaderOnlyStyles(showOnFocus) {
22
+ return {
23
+ euiScreenReaderOnly: showOnFocus ? /*#__PURE__*/css("&:not(:focus):not(:active){", euiScreenReaderOnly(), ";};label:euiScreenReaderOnly;") : /*#__PURE__*/css(euiScreenReaderOnly(), ";label:euiScreenReaderOnly;")
24
+ };
15
25
  };
@@ -16,6 +16,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
16
16
  */
17
17
  import React from 'react';
18
18
  import classNames from 'classnames';
19
+ import { isTabbable } from 'tabbable';
19
20
  import { useEuiTheme } from '../../../services';
20
21
  import { EuiButton } from '../../button/button';
21
22
  import { EuiScreenReaderOnly } from '../screen_reader_only';
@@ -50,13 +51,28 @@ export var EuiSkipLink = function EuiSkipLink(_ref) {
50
51
  onClick: function onClick(e) {
51
52
  e.preventDefault();
52
53
  var destinationEl = document.getElementById(destinationId);
53
- if (!destinationEl) return;
54
- destinationEl.scrollIntoView();
55
- destinationEl.tabIndex = -1; // Ensure the destination content is focusable
54
+ if (!destinationEl) return; // Scroll to the top of the destination content only if it's ~mostly out of view
55
+
56
+ var destinationY = destinationEl.getBoundingClientRect().top;
57
+ var halfOfViewportHeight = window.innerHeight / 2;
58
+
59
+ if (destinationY >= halfOfViewportHeight || window.scrollY >= destinationY + halfOfViewportHeight) {
60
+ destinationEl.scrollIntoView();
61
+ } // Ensure the destination content is focusable
62
+
63
+
64
+ if (!isTabbable(destinationEl)) {
65
+ destinationEl.tabIndex = -1;
66
+ destinationEl.addEventListener('blur', function () {
67
+ return destinationEl.removeAttribute('tabindex');
68
+ }, {
69
+ once: true
70
+ });
71
+ }
56
72
 
57
73
  destinationEl.focus({
58
74
  preventScroll: true
59
- }); // Scrolling is already handled above, and focus's autoscroll behaves oddly around fixed headers
75
+ }); // Scrolling is already handled above, and focus autoscroll behaves oddly on Chrome around fixed headers
60
76
  }
61
77
  });
62
78
  }
@@ -141,6 +141,7 @@ export var createKeyDownHandler = function createKeyDownHandler(_ref2) {
141
141
 
142
142
  var key = event.key,
143
143
  ctrlKey = event.ctrlKey;
144
+ console.log('???', event);
144
145
 
145
146
  if (key === keys.ARROW_DOWN) {
146
147
  event.preventDefault();