@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.
- package/README.md +7 -0
- package/dist/eui_theme_dark.css +0 -493
- package/dist/eui_theme_dark.json +7 -44
- package/dist/eui_theme_dark.json.d.ts +7 -44
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +0 -493
- package/dist/eui_theme_light.json +7 -44
- package/dist/eui_theme_light.json.d.ts +7 -44
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/accessibility/screen_reader_live/screen_reader_live.js +30 -7
- package/es/components/accessibility/screen_reader_only/screen_reader_only.js +14 -19
- package/es/components/accessibility/screen_reader_only/screen_reader_only.styles.js +11 -1
- package/es/components/accessibility/skip_link/skip_link.js +20 -4
- package/es/components/avatar/avatar.js +2 -2
- package/es/components/badge/badge.js +1 -1
- package/es/components/button/button_icon/button_icon.js +1 -1
- package/es/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +2 -2
- package/es/components/combo_box/matching_options.js +3 -2
- package/es/components/datagrid/body/data_grid_body.js +6 -6
- package/es/components/datagrid/body/data_grid_cell.js +12 -12
- package/es/components/datagrid/body/header/data_grid_header_cell.js +6 -6
- package/es/components/datagrid/body/header/data_grid_header_row.js +6 -6
- package/es/components/datagrid/data_grid.js +6 -6
- package/es/components/datagrid/utils/in_memory.js +6 -6
- package/es/components/date_picker/date_picker.js +1 -1
- package/es/components/empty_prompt/empty_prompt.js +1 -1
- package/es/components/form/field_text/field_text.js +1 -1
- package/es/components/form/form_control_layout/form_control_layout.js +1 -1
- package/es/components/form/form_control_layout/form_control_layout_icons.js +1 -1
- package/es/components/health/health.js +1 -1
- package/es/components/icon/icon.js +43 -495
- package/es/components/icon/icon.styles.js +75 -0
- package/es/components/icon/icon_map.js +455 -0
- package/es/components/icon/named_colors.js +2 -13
- package/es/components/list_group/list_group.js +1 -1
- package/es/components/list_group/list_group_item.js +1 -1
- package/es/components/list_group/pinnable_list_group/pinnable_list_group.js +2 -2
- package/es/components/notification/notification_event.js +2 -2
- package/es/components/notification/notification_event_meta.js +1 -1
- package/es/components/notification/notification_event_read_button.js +1 -1
- package/es/components/progress/progress.js +34 -87
- package/es/components/progress/progress.styles.js +155 -0
- package/es/components/provider/cache/cache_provider.js +17 -0
- package/es/components/provider/cache/index.js +8 -0
- package/es/components/provider/provider.js +35 -5
- package/es/components/selectable/selectable.js +39 -22
- package/es/components/selectable/selectable_list/selectable_list.js +1 -1
- package/es/components/selectable/selectable_list/selectable_list_item.js +1 -1
- package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +2 -2
- package/es/components/stat/stat.js +28 -35
- package/es/components/stat/stat.styles.js +38 -0
- package/es/components/timeline/timeline.js +15 -8
- package/es/components/timeline/timeline.styles.js +29 -0
- package/es/components/timeline/timeline_item.js +4 -16
- package/es/components/timeline/timeline_item.styles.js +18 -3
- package/es/components/timeline/timeline_item_icon.styles.js +14 -4
- package/es/components/tool_tip/icon_tip.js +1 -1
- package/es/global_styling/functions/logicals.js +2 -2
- package/es/global_styling/utility/utility.js +17 -0
- package/es/services/theme/hooks.js +4 -2
- package/es/services/theme/provider.js +1 -5
- package/es/test/emotion-prefix.js +29 -0
- package/es/test/index.d.ts +5 -0
- package/es/test/index.js +2 -1
- package/eui.d.ts +450 -454
- package/i18ntokens.json +18 -18
- package/lib/components/accessibility/screen_reader_live/screen_reader_live.js +29 -6
- package/lib/components/accessibility/screen_reader_only/screen_reader_only.js +22 -19
- package/lib/components/accessibility/screen_reader_only/screen_reader_only.styles.js +16 -2
- package/lib/components/accessibility/skip_link/skip_link.js +21 -4
- package/lib/components/avatar/avatar.js +2 -2
- package/lib/components/badge/badge.js +1 -1
- package/lib/components/button/button_icon/button_icon.js +1 -1
- package/lib/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +2 -2
- package/lib/components/combo_box/matching_options.js +3 -2
- package/lib/components/datagrid/body/data_grid_body.js +6 -6
- package/lib/components/datagrid/body/data_grid_cell.js +12 -12
- package/lib/components/datagrid/body/header/data_grid_header_cell.js +6 -6
- package/lib/components/datagrid/body/header/data_grid_header_row.js +6 -6
- package/lib/components/datagrid/data_grid.js +6 -6
- package/lib/components/datagrid/utils/in_memory.js +6 -6
- package/lib/components/date_picker/date_picker.js +1 -1
- package/lib/components/empty_prompt/empty_prompt.js +1 -1
- package/lib/components/form/field_text/field_text.js +1 -1
- package/lib/components/form/form_control_layout/form_control_layout.js +1 -1
- package/lib/components/form/form_control_layout/form_control_layout_icons.js +1 -1
- package/lib/components/health/health.js +1 -1
- package/lib/components/icon/icon.js +54 -499
- package/lib/components/icon/icon.styles.js +79 -0
- package/lib/components/icon/icon_map.js +463 -0
- package/lib/components/icon/named_colors.js +4 -15
- package/lib/components/list_group/list_group.js +1 -1
- package/lib/components/list_group/list_group_item.js +1 -1
- package/lib/components/list_group/pinnable_list_group/pinnable_list_group.js +2 -2
- package/lib/components/notification/notification_event.js +2 -2
- package/lib/components/notification/notification_event_meta.js +1 -1
- package/lib/components/notification/notification_event_read_button.js +1 -1
- package/lib/components/progress/progress.js +36 -88
- package/lib/components/progress/progress.styles.js +166 -0
- package/lib/components/provider/cache/cache_provider.js +29 -0
- package/lib/components/provider/cache/index.js +18 -0
- package/lib/components/provider/provider.js +36 -5
- package/lib/components/selectable/selectable.js +39 -22
- package/lib/components/selectable/selectable_list/selectable_list.js +1 -1
- package/lib/components/selectable/selectable_list/selectable_list_item.js +1 -1
- package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +3 -3
- package/lib/components/stat/stat.js +30 -40
- package/lib/components/stat/stat.styles.js +45 -0
- package/lib/components/timeline/timeline.js +20 -9
- package/lib/components/timeline/timeline.styles.js +39 -0
- package/lib/components/timeline/timeline_item.js +4 -17
- package/lib/components/timeline/timeline_item.styles.js +17 -10
- package/lib/components/timeline/timeline_item_icon.styles.js +15 -4
- package/lib/components/tool_tip/icon_tip.js +1 -1
- package/lib/global_styling/functions/logicals.js +2 -2
- package/lib/global_styling/utility/utility.js +31 -0
- package/lib/services/theme/hooks.js +4 -2
- package/lib/services/theme/provider.js +3 -6
- package/lib/test/emotion-prefix.js +38 -0
- package/lib/test/index.d.ts +5 -0
- package/lib/test/index.js +23 -1
- package/optimize/es/components/accessibility/screen_reader_live/screen_reader_live.js +21 -6
- package/optimize/es/components/accessibility/screen_reader_only/screen_reader_only.js +11 -17
- package/optimize/es/components/accessibility/screen_reader_only/screen_reader_only.styles.js +11 -1
- package/optimize/es/components/accessibility/skip_link/skip_link.js +20 -4
- package/optimize/es/components/combo_box/matching_options.js +3 -2
- package/optimize/es/components/icon/icon.js +40 -492
- package/optimize/es/components/icon/icon.styles.js +75 -0
- package/optimize/es/components/icon/icon_map.js +455 -0
- package/optimize/es/components/icon/named_colors.js +2 -13
- package/optimize/es/components/progress/progress.js +31 -84
- package/optimize/es/components/progress/progress.styles.js +155 -0
- package/optimize/es/components/provider/cache/cache_provider.js +17 -0
- package/optimize/es/components/provider/cache/index.js +8 -0
- package/optimize/es/components/provider/provider.js +35 -5
- package/optimize/es/components/selectable/selectable.js +33 -22
- package/optimize/es/components/stat/stat.js +25 -33
- package/optimize/es/components/stat/stat.styles.js +38 -0
- package/optimize/es/components/timeline/timeline.js +10 -1
- package/optimize/es/components/timeline/timeline.styles.js +29 -0
- package/optimize/es/components/timeline/timeline_item.js +4 -9
- package/optimize/es/components/timeline/timeline_item.styles.js +18 -3
- package/optimize/es/components/timeline/timeline_item_icon.styles.js +14 -4
- package/optimize/es/global_styling/functions/logicals.js +2 -2
- package/optimize/es/global_styling/utility/utility.js +17 -0
- package/optimize/es/services/theme/hooks.js +4 -2
- package/optimize/es/services/theme/provider.js +1 -5
- package/optimize/es/test/emotion-prefix.js +27 -0
- package/optimize/es/test/index.d.ts +5 -0
- package/optimize/es/test/index.js +2 -1
- package/optimize/lib/components/accessibility/screen_reader_live/screen_reader_live.js +20 -5
- package/optimize/lib/components/accessibility/screen_reader_only/screen_reader_only.js +18 -16
- package/optimize/lib/components/accessibility/screen_reader_only/screen_reader_only.styles.js +16 -2
- package/optimize/lib/components/accessibility/skip_link/skip_link.js +21 -4
- package/optimize/lib/components/combo_box/matching_options.js +3 -2
- package/optimize/lib/components/icon/icon.js +49 -494
- package/optimize/lib/components/icon/icon.styles.js +81 -0
- package/optimize/lib/components/icon/icon_map.js +463 -0
- package/optimize/lib/components/icon/named_colors.js +4 -15
- package/optimize/lib/components/progress/progress.js +33 -85
- package/optimize/lib/components/progress/progress.styles.js +168 -0
- package/optimize/lib/components/provider/cache/cache_provider.js +29 -0
- package/optimize/lib/components/provider/cache/index.js +18 -0
- package/optimize/lib/components/provider/provider.js +36 -5
- package/optimize/lib/components/selectable/selectable.js +33 -22
- package/optimize/lib/components/stat/stat.js +27 -37
- package/optimize/lib/components/stat/stat.styles.js +47 -0
- package/optimize/lib/components/timeline/timeline.js +14 -2
- package/optimize/lib/components/timeline/timeline.styles.js +39 -0
- package/optimize/lib/components/timeline/timeline_item.js +4 -10
- package/optimize/lib/components/timeline/timeline_item.styles.js +17 -10
- package/optimize/lib/components/timeline/timeline_item_icon.styles.js +15 -4
- package/optimize/lib/global_styling/functions/logicals.js +2 -2
- package/optimize/lib/global_styling/utility/utility.js +31 -0
- package/optimize/lib/services/theme/hooks.js +4 -2
- package/optimize/lib/services/theme/provider.js +3 -6
- package/optimize/lib/test/emotion-prefix.js +40 -0
- package/optimize/lib/test/index.d.ts +5 -0
- package/optimize/lib/test/index.js +23 -1
- package/package.json +2 -2
- package/src/components/form/form_control_layout/_form_control_layout.scss +2 -4
- package/src/components/index.scss +0 -4
- package/src/global_styling/variables/_form.scss +9 -0
- package/src/themes/amsterdam/overrides/_index.scss +0 -1
- package/test-env/components/accessibility/screen_reader_live/screen_reader_live.js +29 -6
- package/test-env/components/accessibility/screen_reader_only/screen_reader_only.js +21 -18
- package/test-env/components/accessibility/screen_reader_only/screen_reader_only.styles.js +16 -2
- package/test-env/components/accessibility/skip_link/skip_link.js +21 -4
- package/test-env/components/avatar/avatar.js +2 -2
- package/test-env/components/badge/badge.js +1 -1
- package/test-env/components/button/button_icon/button_icon.js +1 -1
- package/test-env/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +2 -2
- package/test-env/components/combo_box/matching_options.js +3 -2
- package/test-env/components/datagrid/body/data_grid_body.js +6 -6
- package/test-env/components/datagrid/body/data_grid_cell.js +12 -12
- package/test-env/components/datagrid/body/header/data_grid_header_cell.js +6 -6
- package/test-env/components/datagrid/body/header/data_grid_header_row.js +6 -6
- package/test-env/components/datagrid/data_grid.js +6 -6
- package/test-env/components/datagrid/utils/in_memory.js +6 -6
- package/test-env/components/date_picker/date_picker.js +1 -1
- package/test-env/components/empty_prompt/empty_prompt.js +1 -1
- package/test-env/components/form/field_text/field_text.js +1 -1
- package/test-env/components/form/form_control_layout/form_control_layout.js +1 -1
- package/test-env/components/form/form_control_layout/form_control_layout_icons.js +1 -1
- package/test-env/components/health/health.js +1 -1
- package/test-env/components/icon/icon.styles.js +81 -0
- package/test-env/components/icon/icon_map.js +463 -0
- package/test-env/components/icon/named_colors.js +4 -15
- package/test-env/components/list_group/list_group.js +1 -1
- package/test-env/components/list_group/list_group_item.js +1 -1
- package/test-env/components/list_group/pinnable_list_group/pinnable_list_group.js +2 -2
- package/test-env/components/notification/notification_event.js +2 -2
- package/test-env/components/notification/notification_event_meta.js +1 -1
- package/test-env/components/notification/notification_event_read_button.js +1 -1
- package/test-env/components/progress/progress.js +36 -88
- package/test-env/components/progress/progress.styles.js +168 -0
- package/test-env/components/provider/cache/cache_provider.js +29 -0
- package/test-env/components/provider/cache/index.js +18 -0
- package/test-env/components/provider/provider.js +36 -5
- package/test-env/components/selectable/selectable.js +39 -22
- package/test-env/components/selectable/selectable_list/selectable_list.js +1 -1
- package/test-env/components/selectable/selectable_list/selectable_list_item.js +1 -1
- package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +3 -3
- package/test-env/components/stat/stat.js +29 -39
- package/test-env/components/stat/stat.styles.js +47 -0
- package/test-env/components/timeline/timeline.js +19 -9
- package/test-env/components/timeline/timeline.styles.js +39 -0
- package/test-env/components/timeline/timeline_item.js +4 -17
- package/test-env/components/timeline/timeline_item.styles.js +17 -10
- package/test-env/components/timeline/timeline_item_icon.styles.js +15 -4
- package/test-env/components/tool_tip/icon_tip.js +1 -1
- package/test-env/global_styling/functions/logicals.js +2 -2
- package/test-env/global_styling/utility/utility.js +31 -0
- package/test-env/services/theme/hooks.js +4 -2
- package/test-env/services/theme/provider.js +3 -6
- package/test-env/test/emotion-prefix.js +40 -0
- package/test-env/test/index.js +23 -1
- package/src/components/accessibility/_index.scss +0 -1
- package/src/components/accessibility/screen_reader_only/_screen_reader_only.scss +0 -5
- package/src/components/icon/_icon.scss +0 -87
- package/src/components/icon/_index.scss +0 -2
- package/src/components/icon/_variables.scss +0 -22
- package/src/components/progress/_index.scss +0 -2
- package/src/components/progress/_progress.scss +0 -166
- package/src/components/progress/_variables.scss +0 -21
- package/src/components/stat/_index.scss +0 -1
- package/src/components/stat/_stat.scss +0 -50
- 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-
|
|
49
|
+
right: 'inset-inline-end',
|
|
50
50
|
bottom: 'inset-block-end',
|
|
51
|
-
left: 'inset-inline-
|
|
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 || '
|
|
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 =
|
|
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
|
-
},
|
|
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",
|
|
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
|
-
|
|
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-
|
|
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
|
-
|
|
12
|
+
var _clone_element = require("../../../services/theme/clone_element");
|
|
17
13
|
|
|
18
|
-
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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;
|
package/optimize/lib/components/accessibility/screen_reader_only/screen_reader_only.styles.js
CHANGED
|
@@ -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.
|
|
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
|
-
|
|
68
|
-
|
|
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
|
|
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
|
|
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.
|
|
87
|
+
matchingOptions = matchingOptions.concat(matchingOptionsForGroup);
|
|
87
88
|
}
|
|
88
89
|
} else {
|
|
89
90
|
collectMatchingOption(matchingOptions, option, selectedOptions, normalizedSearchValue, isPreFiltered, showPrevSelected);
|