@elastic/eui 71.0.0 → 72.0.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 +0 -7
- package/dist/eui_theme_dark.css +7747 -5854
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +7737 -5844
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/datagrid/data_grid.a11y.js +251 -0
- package/es/components/date_picker/auto_refresh/refresh_interval.js +3 -1
- package/es/components/date_picker/date_picker.a11y.js +83 -0
- package/es/components/date_picker/super_date_picker/quick_select_popover/commonly_used_time_ranges.js +5 -2
- package/es/components/date_picker/super_date_picker/quick_select_popover/quick_select.js +3 -1
- package/es/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +160 -173
- package/es/components/date_picker/super_date_picker/quick_select_popover/recently_used.js +5 -2
- package/es/components/date_picker/super_date_picker/super_date_picker.js +16 -0
- package/es/components/delay_hide/delay_hide.a11y.js +106 -0
- package/es/components/delay_render/delay_render.a11y.js +106 -0
- package/es/components/empty_prompt/empty_prompt.a11y.js +63 -0
- package/es/components/error_boundary/error_boundary.a11y.js +67 -0
- package/es/components/error_boundary/error_boundary.js +45 -27
- package/es/components/expression/expression.a11y.js +254 -0
- package/es/components/filter_group/filter_group.a11y.js +281 -0
- package/es/components/focus_trap/focus_trap.a11y.js +131 -0
- package/es/components/form/file_picker/file_picker.js +1 -0
- package/es/components/header/header.a11y.js +374 -0
- package/es/components/icon/icon_ML.a11y.js +33 -0
- package/es/components/icon/icon_apps.a11y.js +33 -0
- package/es/components/icon/icon_editor.a11y.js +33 -0
- package/es/components/icon/icon_elastic.a11y.js +33 -0
- package/es/components/icon/icon_glyphs.a11y.js +33 -0
- package/es/components/icon/icon_tokens.a11y.js +33 -0
- package/es/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +1 -1
- package/es/components/page/page_side_bar/page_side_bar.js +3 -0
- package/es/components/page/page_template.js +1 -15
- package/es/components/selectable/selectable.js +4 -3
- package/es/components/selectable/selectable_list/selectable_list.js +17 -5
- package/es/components/tabs/tab.js +7 -17
- package/es/components/tabs/tabbed_content/tabbed_content.js +0 -16
- package/es/components/tabs/tabs.js +7 -11
- package/es/components/tabs/tabs_context.js +13 -0
- package/eui.d.ts +60 -43
- package/i18ntokens.json +34 -18
- package/lib/components/datagrid/data_grid.a11y.js +255 -0
- package/lib/components/date_picker/auto_refresh/refresh_interval.js +3 -1
- package/lib/components/date_picker/date_picker.a11y.js +89 -0
- package/lib/components/date_picker/super_date_picker/quick_select_popover/commonly_used_time_ranges.js +5 -2
- package/lib/components/date_picker/super_date_picker/quick_select_popover/quick_select.js +3 -1
- package/lib/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +155 -168
- package/lib/components/date_picker/super_date_picker/quick_select_popover/recently_used.js +5 -2
- package/lib/components/date_picker/super_date_picker/super_date_picker.js +16 -0
- package/lib/components/delay_hide/delay_hide.a11y.js +111 -0
- package/lib/components/delay_render/delay_render.a11y.js +111 -0
- package/lib/components/empty_prompt/empty_prompt.a11y.js +72 -0
- package/lib/components/error_boundary/error_boundary.a11y.js +75 -0
- package/lib/components/error_boundary/error_boundary.js +49 -29
- package/lib/components/expression/expression.a11y.js +262 -0
- package/lib/components/filter_group/filter_group.a11y.js +287 -0
- package/lib/components/focus_trap/focus_trap.a11y.js +140 -0
- package/lib/components/form/file_picker/file_picker.js +1 -0
- package/lib/components/header/header.a11y.js +385 -0
- package/lib/components/icon/icon_ML.a11y.js +40 -0
- package/lib/components/icon/icon_apps.a11y.js +40 -0
- package/lib/components/icon/icon_editor.a11y.js +40 -0
- package/lib/components/icon/icon_elastic.a11y.js +40 -0
- package/lib/components/icon/icon_glyphs.a11y.js +40 -0
- package/lib/components/icon/icon_tokens.a11y.js +40 -0
- package/lib/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -2
- package/lib/components/page/page_side_bar/page_side_bar.js +4 -0
- package/lib/components/page/page_template.js +1 -15
- package/lib/components/selectable/selectable.js +4 -3
- package/lib/components/selectable/selectable_list/selectable_list.js +17 -5
- package/lib/components/tabs/tab.js +14 -17
- package/lib/components/tabs/tabbed_content/tabbed_content.js +0 -16
- package/lib/components/tabs/tabs.js +8 -14
- package/lib/components/tabs/tabs_context.js +23 -0
- package/optimize/es/components/datagrid/data_grid.a11y.js +234 -0
- package/optimize/es/components/date_picker/auto_refresh/refresh_interval.js +3 -1
- package/optimize/es/components/date_picker/date_picker.a11y.js +73 -0
- package/optimize/es/components/date_picker/super_date_picker/quick_select_popover/commonly_used_time_ranges.js +5 -2
- package/optimize/es/components/date_picker/super_date_picker/quick_select_popover/quick_select.js +3 -1
- package/optimize/es/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +145 -169
- package/optimize/es/components/date_picker/super_date_picker/quick_select_popover/recently_used.js +5 -2
- package/optimize/es/components/date_picker/super_date_picker/super_date_picker.js +2 -0
- package/optimize/es/components/delay_hide/delay_hide.a11y.js +96 -0
- package/optimize/es/components/delay_render/delay_render.a11y.js +96 -0
- package/optimize/es/components/empty_prompt/empty_prompt.a11y.js +63 -0
- package/optimize/es/components/error_boundary/error_boundary.a11y.js +67 -0
- package/optimize/es/components/error_boundary/error_boundary.js +37 -26
- package/optimize/es/components/expression/expression.a11y.js +243 -0
- package/optimize/es/components/filter_group/filter_group.a11y.js +271 -0
- package/optimize/es/components/focus_trap/focus_trap.a11y.js +120 -0
- package/optimize/es/components/form/file_picker/file_picker.js +1 -0
- package/optimize/es/components/header/header.a11y.js +364 -0
- package/optimize/es/components/icon/icon_ML.a11y.js +33 -0
- package/optimize/es/components/icon/icon_apps.a11y.js +33 -0
- package/optimize/es/components/icon/icon_editor.a11y.js +33 -0
- package/optimize/es/components/icon/icon_elastic.a11y.js +33 -0
- package/optimize/es/components/icon/icon_glyphs.a11y.js +33 -0
- package/optimize/es/components/icon/icon_tokens.a11y.js +33 -0
- package/optimize/es/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +1 -1
- package/optimize/es/components/page/page_side_bar/page_side_bar.js +3 -0
- package/optimize/es/components/selectable/selectable.js +2 -2
- package/optimize/es/components/selectable/selectable_list/selectable_list.js +15 -4
- package/optimize/es/components/tabs/tab.js +7 -5
- package/optimize/es/components/tabs/tabs.js +7 -11
- package/optimize/es/components/tabs/tabs_context.js +13 -0
- package/optimize/lib/components/datagrid/data_grid.a11y.js +248 -0
- package/optimize/lib/components/date_picker/auto_refresh/refresh_interval.js +3 -1
- package/optimize/lib/components/date_picker/date_picker.a11y.js +87 -0
- package/optimize/lib/components/date_picker/super_date_picker/quick_select_popover/commonly_used_time_ranges.js +5 -2
- package/optimize/lib/components/date_picker/super_date_picker/quick_select_popover/quick_select.js +3 -1
- package/optimize/lib/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +146 -167
- package/optimize/lib/components/date_picker/super_date_picker/quick_select_popover/recently_used.js +5 -2
- package/optimize/lib/components/date_picker/super_date_picker/super_date_picker.js +2 -0
- package/optimize/lib/components/delay_hide/delay_hide.a11y.js +111 -0
- package/optimize/lib/components/delay_render/delay_render.a11y.js +111 -0
- package/optimize/lib/components/empty_prompt/empty_prompt.a11y.js +72 -0
- package/optimize/lib/components/error_boundary/error_boundary.a11y.js +75 -0
- package/optimize/lib/components/error_boundary/error_boundary.js +41 -28
- package/optimize/lib/components/expression/expression.a11y.js +254 -0
- package/optimize/lib/components/filter_group/filter_group.a11y.js +287 -0
- package/optimize/lib/components/focus_trap/focus_trap.a11y.js +140 -0
- package/optimize/lib/components/form/file_picker/file_picker.js +1 -0
- package/optimize/lib/components/header/header.a11y.js +385 -0
- package/optimize/lib/components/icon/icon_ML.a11y.js +40 -0
- package/optimize/lib/components/icon/icon_apps.a11y.js +40 -0
- package/optimize/lib/components/icon/icon_editor.a11y.js +40 -0
- package/optimize/lib/components/icon/icon_elastic.a11y.js +40 -0
- package/optimize/lib/components/icon/icon_glyphs.a11y.js +40 -0
- package/optimize/lib/components/icon/icon_tokens.a11y.js +40 -0
- package/optimize/lib/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -2
- package/optimize/lib/components/page/page_side_bar/page_side_bar.js +4 -0
- package/optimize/lib/components/selectable/selectable.js +2 -2
- package/optimize/lib/components/selectable/selectable_list/selectable_list.js +15 -4
- package/optimize/lib/components/tabs/tab.js +15 -5
- package/optimize/lib/components/tabs/tabs.js +8 -14
- package/optimize/lib/components/tabs/tabs_context.js +23 -0
- package/package.json +14 -19
- package/src/components/basic_table/_basic_table.scss +1 -4
- package/src/components/button/button_empty/_button_empty.scss +2 -4
- package/src/components/button/button_group/_button_group.scss +1 -1
- package/src/components/button/button_group/_button_group_button.scss +3 -4
- package/src/components/button/button_icon/_button_icon.scss +0 -3
- package/src/components/collapsible_nav/_collapsible_nav.scss +1 -1
- package/src/components/collapsible_nav/collapsible_nav_group/_collapsible_nav_group.scss +1 -1
- package/src/components/color_picker/_color_picker.scss +3 -2
- package/src/components/color_picker/_hue.scss +7 -7
- package/src/components/color_picker/_saturation.scss +1 -1
- package/src/components/color_picker/color_palette_display/_mixins.scss +1 -1
- package/src/components/color_picker/color_stops/_color_stops.scss +2 -3
- package/src/components/combo_box/_combo_box.scss +7 -6
- package/src/components/combo_box/combo_box_input/_combo_box_input.scss +2 -1
- package/src/components/combo_box/combo_box_input/_combo_box_placeholder.scss +1 -1
- package/src/components/combo_box/combo_box_options_list/_combo_box_options_list.scss +2 -3
- package/src/components/control_bar/_variables.scss +0 -1
- package/src/components/datagrid/_data_grid_data_row.scss +4 -5
- package/src/components/datagrid/_mixins.scss +1 -1
- package/src/components/datagrid/body/_data_grid_footer_row.scss +2 -1
- package/src/components/datagrid/body/header/_data_grid_column_resizer.scss +3 -4
- package/src/components/datagrid/body/header/_data_grid_header_row.scss +1 -1
- package/src/components/datagrid/controls/_data_grid_column_sorting.scss +1 -2
- package/src/components/date_picker/_date_picker_range.scss +1 -1
- package/src/components/date_picker/super_date_picker/_super_date_picker.scss +1 -4
- package/src/components/date_picker/super_date_picker/quick_select_popover/_quick_select_popover.scss +15 -1
- package/src/components/drag_and_drop/_draggable.scss +3 -5
- package/src/components/drag_and_drop/_droppable.scss +1 -1
- package/src/components/empty_prompt/_empty_prompt.scss +1 -1
- package/src/components/filter_group/_filter_group.scss +2 -2
- package/src/components/filter_group/_filter_select_item.scss +0 -1
- package/src/components/form/checkbox/_checkbox.scss +5 -3
- package/src/components/form/described_form_group/_described_form_group.scss +0 -1
- package/src/components/form/field_password/_field_password.scss +1 -1
- package/src/components/form/field_search/_field_search.scss +1 -1
- package/src/components/form/file_picker/_file_picker.scss +15 -16
- package/src/components/form/form_control_layout/_form_control_layout.scss +6 -7
- package/src/components/form/form_control_layout/_form_control_layout_delimited.scss +4 -6
- package/src/components/form/form_row/_form_row.scss +3 -0
- package/src/components/form/radio/_radio.scss +5 -3
- package/src/components/form/select/_select.scss +1 -1
- package/src/components/form/switch/_switch.scss +3 -1
- package/src/components/header/_mixins.scss +1 -1
- package/src/components/header/header_section/_header_section_item.scss +4 -4
- package/src/components/header/header_section/_header_section_item_button.scss +0 -1
- package/src/components/key_pad_menu/_key_pad_menu_item.scss +2 -7
- package/src/components/markdown_editor/_markdown_editor_drop_zone.scss +4 -4
- package/src/components/markdown_editor/_markdown_editor_footer.scss +1 -1
- package/src/components/markdown_editor/_markdown_editor_text_area.scss +2 -3
- package/src/components/markdown_editor/_markdown_format.scss +4 -2
- package/src/components/notification/_notification_event.scss +2 -2
- package/src/components/page/page_content/_page_content_body.scss +0 -1
- package/src/components/page/page_content/_page_content_header_section.scss +0 -1
- package/src/components/page/page_side_bar/_page_side_bar.scss +0 -1
- package/src/components/panel/split_panel/_split_panel.scss +2 -2
- package/src/components/resizable_container/_resizable_button.scss +31 -31
- package/src/components/resizable_container/_resizable_collapse_button.scss +9 -9
- package/src/components/selectable/selectable_templates/_selectable_template_sitewide_option.scss +1 -1
- package/src/components/side_nav/_mixins.scss +1 -1
- package/src/components/side_nav/_side_nav.scss +2 -1
- package/src/components/side_nav/_side_nav_item.scss +2 -3
- package/src/components/steps/_steps.scss +2 -1
- package/src/components/suggest/_suggest_input.scss +1 -1
- package/src/components/suggest/_suggest_item.scss +4 -3
- package/src/components/table/_responsive.scss +5 -3
- package/src/components/table/_table.scss +2 -4
- package/src/components/table/mobile/_mobile.scss +0 -2
- package/src/components/tree_view/tree_view.scss +2 -2
- package/src/global_styling/mixins/_form.scss +7 -18
- package/src/global_styling/mixins/_header.scss +2 -2
- package/src/global_styling/mixins/_helpers.scss +1 -2
- package/src/global_styling/mixins/_icons.scss +1 -1
- package/src/global_styling/mixins/_range.scss +4 -8
- package/src/global_styling/mixins/_responsive.scss +3 -8
- package/src/global_styling/mixins/_shadow.scss +5 -9
- package/src/global_styling/mixins/_states.scss +2 -2
- package/src/global_styling/mixins/_typography.scss +16 -19
- package/src/global_styling/variables/_colors_vis.scss +1 -1
- package/src/global_styling/variables/_typography.scss +1 -3
- package/src/themes/amsterdam/_colors_dark.scss +2 -1
- package/src/themes/amsterdam/_colors_light.scss +2 -0
- package/src/themes/amsterdam/global_styling/mixins/_link.scss +1 -1
- package/src/themes/amsterdam/global_styling/mixins/_states.scss +0 -1
- package/src/themes/amsterdam/global_styling/mixins/_typography.scss +1 -2
- package/src/themes/amsterdam/global_styling/react_date_picker/_date_picker_days.scss +0 -1
- package/src/themes/amsterdam/global_styling/react_date_picker/_date_picker_month_year.scss +0 -1
- package/src/themes/amsterdam/global_styling/react_date_picker/_date_picker_times.scss +3 -4
- package/src/themes/amsterdam/global_styling/react_date_picker/_mixins.scss +0 -1
- package/src/themes/amsterdam/global_styling/variables/_typography.scss +1 -2
- package/src/themes/amsterdam/overrides/_color_stops.scss +4 -5
- package/src/themes/amsterdam/overrides/_combo_box.scss +3 -0
- package/src/themes/amsterdam/overrides/_form_control_layout.scss +3 -0
- package/src/themes/amsterdam/overrides/_form_control_layout_delimited.scss +5 -4
- package/src/themes/amsterdam/overrides/_header.scss +2 -2
- package/src/themes/amsterdam/overrides/_hue.scss +6 -6
- package/src/themes/amsterdam/overrides/_key_pad_menu.scss +2 -2
- package/src/themes/amsterdam/overrides/_steps.scss +1 -2
- package/src/themes/legacy/_colors_dark.scss +2 -1
- package/src/themes/legacy/_colors_light.scss +2 -0
- package/src/themes/legacy/reset/_reset.scss +8 -7
- package/test-env/components/datagrid/data_grid.a11y.js +248 -0
- package/test-env/components/date_picker/auto_refresh/refresh_interval.js +3 -1
- package/test-env/components/date_picker/date_picker.a11y.js +87 -0
- package/test-env/components/date_picker/super_date_picker/quick_select_popover/commonly_used_time_ranges.js +5 -2
- package/test-env/components/date_picker/super_date_picker/quick_select_popover/quick_select.js +3 -1
- package/test-env/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +153 -166
- package/test-env/components/date_picker/super_date_picker/quick_select_popover/recently_used.js +5 -2
- package/test-env/components/date_picker/super_date_picker/super_date_picker.js +16 -0
- package/test-env/components/delay_hide/delay_hide.a11y.js +111 -0
- package/test-env/components/delay_render/delay_render.a11y.js +111 -0
- package/test-env/components/empty_prompt/empty_prompt.a11y.js +72 -0
- package/test-env/components/error_boundary/error_boundary.a11y.js +75 -0
- package/test-env/components/error_boundary/error_boundary.js +48 -28
- package/test-env/components/expression/expression.a11y.js +254 -0
- package/test-env/components/filter_group/filter_group.a11y.js +287 -0
- package/test-env/components/focus_trap/focus_trap.a11y.js +140 -0
- package/test-env/components/form/file_picker/file_picker.js +1 -0
- package/test-env/components/header/header.a11y.js +385 -0
- package/test-env/components/icon/icon_ML.a11y.js +40 -0
- package/test-env/components/icon/icon_apps.a11y.js +40 -0
- package/test-env/components/icon/icon_editor.a11y.js +40 -0
- package/test-env/components/icon/icon_elastic.a11y.js +40 -0
- package/test-env/components/icon/icon_glyphs.a11y.js +40 -0
- package/test-env/components/icon/icon_tokens.a11y.js +40 -0
- package/test-env/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -2
- package/test-env/components/page/page_side_bar/page_side_bar.js +4 -0
- package/test-env/components/page/page_template.js +1 -15
- package/test-env/components/selectable/selectable.js +4 -3
- package/test-env/components/selectable/selectable_list/selectable_list.js +17 -5
- package/test-env/components/tabs/tab.js +15 -17
- package/test-env/components/tabs/tabbed_content/tabbed_content.js +0 -16
- package/test-env/components/tabs/tabs.js +8 -14
- package/test-env/components/tabs/tabs_context.js +23 -0
- package/scripts/postinstall.js +0 -9
|
@@ -0,0 +1,67 @@
|
|
|
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
|
+
/// <reference types="../../../cypress/support"/>
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { EuiButton } from '../button';
|
|
11
|
+
import { EuiErrorBoundary } from './error_boundary';
|
|
12
|
+
import { EuiSpacer } from '../spacer';
|
|
13
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
14
|
+
|
|
15
|
+
var handleFocus = function handleFocus() {
|
|
16
|
+
var target = document.querySelector('pre.euiCodeBlock__pre');
|
|
17
|
+
target.focus();
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
describe('EuiErrorBoundary', function () {
|
|
21
|
+
describe('Automated accessibility check when an error is thrown', function () {
|
|
22
|
+
var BadComponent = function BadComponent() {
|
|
23
|
+
throw new Error('Throw the error.');
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
beforeEach(function () {
|
|
27
|
+
cy.on('uncaught:exception', function (err) {
|
|
28
|
+
if (err.message.includes('Throw the error')) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
cy.viewport(1024, 768); // medium breakpoint
|
|
33
|
+
|
|
34
|
+
cy.realMount(___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiButton, {
|
|
35
|
+
color: "primary",
|
|
36
|
+
onClick: handleFocus,
|
|
37
|
+
"data-test-subj": "cy-error-boundary-button"
|
|
38
|
+
}, "Press to focus"), ___EmotionJSX(EuiSpacer, null), ___EmotionJSX(EuiErrorBoundary, null, ___EmotionJSX(BadComponent, null))));
|
|
39
|
+
});
|
|
40
|
+
it('has zero violations on first render', function () {
|
|
41
|
+
cy.checkAxe();
|
|
42
|
+
});
|
|
43
|
+
it('has zero violations and accepts focus when the button is pressed', function () {
|
|
44
|
+
cy.realPress('Tab');
|
|
45
|
+
cy.realPress('Enter');
|
|
46
|
+
cy.get('pre.euiCodeBlock__pre').should('have.focus');
|
|
47
|
+
cy.checkAxe();
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
describe('Automated accessibility check when no error is thrown', function () {
|
|
51
|
+
var GoodComponent = function GoodComponent() {
|
|
52
|
+
return ___EmotionJSX("div", {
|
|
53
|
+
"data-test-subj": "cy-good-component"
|
|
54
|
+
}, "This is a properly rendered component.");
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
beforeEach(function () {
|
|
58
|
+
cy.viewport(1024, 768); // medium breakpoint
|
|
59
|
+
|
|
60
|
+
cy.realMount(___EmotionJSX(EuiErrorBoundary, null, ___EmotionJSX(GoodComponent, null)));
|
|
61
|
+
});
|
|
62
|
+
it('has zero violations when no violations are thrown', function () {
|
|
63
|
+
cy.get('div[data-test-subj="cy-good-component"]').should('exist');
|
|
64
|
+
cy.checkAxe();
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
});
|
|
@@ -5,7 +5,8 @@ import _createClass from "@babel/runtime/helpers/createClass";
|
|
|
5
5
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
6
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
7
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
|
-
var _excluded = ["
|
|
8
|
+
var _excluded = ["children"],
|
|
9
|
+
_excluded2 = ["errorMessage", "className", "data-test-subj"];
|
|
9
10
|
|
|
10
11
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
11
12
|
|
|
@@ -23,18 +24,18 @@ import classNames from 'classnames';
|
|
|
23
24
|
import { EuiTitle } from '../title';
|
|
24
25
|
import { EuiCodeBlock } from '../code';
|
|
25
26
|
import { EuiI18n } from '../i18n';
|
|
26
|
-
import {
|
|
27
|
+
import { useEuiTheme } from '../../services';
|
|
27
28
|
import { euiErrorBoundaryStyles } from './error_boundary.styles';
|
|
28
29
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
29
|
-
export var
|
|
30
|
-
_inherits(
|
|
30
|
+
export var EuiErrorBoundary = /*#__PURE__*/function (_Component) {
|
|
31
|
+
_inherits(EuiErrorBoundary, _Component);
|
|
31
32
|
|
|
32
|
-
var _super = _createSuper(
|
|
33
|
+
var _super = _createSuper(EuiErrorBoundary);
|
|
33
34
|
|
|
34
|
-
function
|
|
35
|
+
function EuiErrorBoundary(props) {
|
|
35
36
|
var _this;
|
|
36
37
|
|
|
37
|
-
_classCallCheck(this,
|
|
38
|
+
_classCallCheck(this, EuiErrorBoundary);
|
|
38
39
|
|
|
39
40
|
_this = _super.call(this, props);
|
|
40
41
|
var errorState = {
|
|
@@ -45,7 +46,7 @@ export var _EuiErrorBoundary = /*#__PURE__*/function (_Component) {
|
|
|
45
46
|
return _this;
|
|
46
47
|
}
|
|
47
48
|
|
|
48
|
-
_createClass(
|
|
49
|
+
_createClass(EuiErrorBoundary, [{
|
|
49
50
|
key: "componentDidCatch",
|
|
50
51
|
value: function componentDidCatch(_ref) {
|
|
51
52
|
var message = _ref.message,
|
|
@@ -65,33 +66,43 @@ export var _EuiErrorBoundary = /*#__PURE__*/function (_Component) {
|
|
|
65
66
|
key: "render",
|
|
66
67
|
value: function render() {
|
|
67
68
|
var _this$props = this.props,
|
|
68
|
-
className = _this$props.className,
|
|
69
69
|
children = _this$props.children,
|
|
70
|
-
_dataTestSubj = _this$props['data-test-subj'],
|
|
71
|
-
theme = _this$props.theme,
|
|
72
70
|
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
73
71
|
|
|
74
|
-
var dataTestSubj = classNames('euiErrorBoundary', _dataTestSubj);
|
|
75
|
-
var styles = euiErrorBoundaryStyles(theme);
|
|
76
|
-
|
|
77
72
|
if (this.state.hasError) {
|
|
78
73
|
// You can render any custom fallback UI
|
|
79
|
-
return ___EmotionJSX(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
"data-test-subj": dataTestSubj
|
|
83
|
-
}, rest), ___EmotionJSX(EuiCodeBlock, null, ___EmotionJSX(EuiTitle, {
|
|
84
|
-
size: "xs"
|
|
85
|
-
}, ___EmotionJSX("p", null, ___EmotionJSX(EuiI18n, {
|
|
86
|
-
token: "euiErrorBoundary.error",
|
|
87
|
-
default: "Error"
|
|
88
|
-
}))), this.state.error));
|
|
74
|
+
return ___EmotionJSX(EuiErrorMessage, _extends({}, rest, {
|
|
75
|
+
errorMessage: this.state.error
|
|
76
|
+
}));
|
|
89
77
|
}
|
|
90
78
|
|
|
91
79
|
return children;
|
|
92
80
|
}
|
|
93
81
|
}]);
|
|
94
82
|
|
|
95
|
-
return
|
|
83
|
+
return EuiErrorBoundary;
|
|
96
84
|
}(Component);
|
|
97
|
-
|
|
85
|
+
/**
|
|
86
|
+
* Split out into a separate styling-only component for easier use of hooks,
|
|
87
|
+
* and also for internal re-use by EUI's docs/playgrounds
|
|
88
|
+
*/
|
|
89
|
+
|
|
90
|
+
export var EuiErrorMessage = function EuiErrorMessage(_ref2) {
|
|
91
|
+
var errorMessage = _ref2.errorMessage,
|
|
92
|
+
className = _ref2.className,
|
|
93
|
+
dataTestSubj = _ref2['data-test-subj'],
|
|
94
|
+
rest = _objectWithoutProperties(_ref2, _excluded2);
|
|
95
|
+
|
|
96
|
+
var euiTheme = useEuiTheme();
|
|
97
|
+
var styles = euiErrorBoundaryStyles(euiTheme);
|
|
98
|
+
return ___EmotionJSX("div", _extends({
|
|
99
|
+
css: styles.euiErrorBoundary,
|
|
100
|
+
className: classNames('euiErrorBoundary', className),
|
|
101
|
+
"data-test-subj": classNames('euiErrorBoundary', dataTestSubj)
|
|
102
|
+
}, rest), ___EmotionJSX(EuiCodeBlock, null, ___EmotionJSX(EuiTitle, {
|
|
103
|
+
size: "xs"
|
|
104
|
+
}, ___EmotionJSX("p", null, ___EmotionJSX(EuiI18n, {
|
|
105
|
+
token: "euiErrorBoundary.error",
|
|
106
|
+
default: "Error"
|
|
107
|
+
}))), errorMessage));
|
|
108
|
+
};
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
|
|
4
|
+
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; }
|
|
5
|
+
|
|
6
|
+
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; }
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
10
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
11
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
12
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
13
|
+
* Side Public License, v 1.
|
|
14
|
+
*/
|
|
15
|
+
/// <reference types="../../../cypress/support"/>
|
|
16
|
+
import React, { useState } from 'react';
|
|
17
|
+
import { EuiExpression } from './expression';
|
|
18
|
+
import { EuiFieldNumber, EuiSelect } from '../form';
|
|
19
|
+
import { EuiFlexGroup, EuiFlexItem } from '../flex';
|
|
20
|
+
import { EuiPanel } from '../panel';
|
|
21
|
+
import { EuiPopover, EuiPopoverTitle } from '../popover';
|
|
22
|
+
import { useGeneratedHtmlId } from '../../services';
|
|
23
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
24
|
+
describe('EuiExpression', function () {
|
|
25
|
+
var BaseExpression = function BaseExpression() {
|
|
26
|
+
var _useState = useState({
|
|
27
|
+
isOpen: false,
|
|
28
|
+
value: 'count()'
|
|
29
|
+
}),
|
|
30
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
31
|
+
example1 = _useState2[0],
|
|
32
|
+
setExample1 = _useState2[1];
|
|
33
|
+
|
|
34
|
+
var _useState3 = useState({
|
|
35
|
+
value: 100,
|
|
36
|
+
description: 'Is above'
|
|
37
|
+
}),
|
|
38
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
39
|
+
example2 = _useState4[0],
|
|
40
|
+
setExample2 = _useState4[1];
|
|
41
|
+
|
|
42
|
+
var expressionPopoverId__1 = useGeneratedHtmlId({
|
|
43
|
+
prefix: 'expressionPopover',
|
|
44
|
+
suffix: 'first'
|
|
45
|
+
});
|
|
46
|
+
var expressionPopoverId__2 = useGeneratedHtmlId({
|
|
47
|
+
prefix: 'expressionPopover',
|
|
48
|
+
suffix: 'second'
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
var openExample1 = function openExample1() {
|
|
52
|
+
setExample1(_objectSpread(_objectSpread({}, example1), {}, {
|
|
53
|
+
isOpen: true
|
|
54
|
+
}));
|
|
55
|
+
setExample2(_objectSpread(_objectSpread({}, example2), {}, {
|
|
56
|
+
isOpen: false
|
|
57
|
+
}));
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
var closeExample1 = function closeExample1() {
|
|
61
|
+
setExample1(_objectSpread(_objectSpread({}, example1), {}, {
|
|
62
|
+
isOpen: false
|
|
63
|
+
}));
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
var openExample2 = function openExample2() {
|
|
67
|
+
setExample1(_objectSpread(_objectSpread({}, example1), {}, {
|
|
68
|
+
isOpen: false
|
|
69
|
+
}));
|
|
70
|
+
setExample2(_objectSpread(_objectSpread({}, example2), {}, {
|
|
71
|
+
isOpen: true
|
|
72
|
+
}));
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
var closeExample2 = function closeExample2() {
|
|
76
|
+
setExample2(_objectSpread(_objectSpread({}, example2), {}, {
|
|
77
|
+
isOpen: false
|
|
78
|
+
}));
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
var changeExample1 = function changeExample1(event) {
|
|
82
|
+
setExample1(_objectSpread(_objectSpread({}, example1), {}, {
|
|
83
|
+
value: event.target.value
|
|
84
|
+
}));
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
var changeExample2Value = function changeExample2Value(e) {
|
|
88
|
+
var sanitizedValue = parseInt(e.target.value, 10);
|
|
89
|
+
setExample2(_objectSpread(_objectSpread({}, example2), {}, {
|
|
90
|
+
value: isNaN(sanitizedValue) ? '' : sanitizedValue
|
|
91
|
+
}));
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
var changeExample2Description = function changeExample2Description(event) {
|
|
95
|
+
setExample2(_objectSpread(_objectSpread({}, example2), {}, {
|
|
96
|
+
description: event.target.value
|
|
97
|
+
}));
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
var renderPopover1 = function renderPopover1() {
|
|
101
|
+
return ___EmotionJSX("div", {
|
|
102
|
+
"data-test-subj": "cy-expression-popover-1"
|
|
103
|
+
}, ___EmotionJSX(EuiPopoverTitle, null, "When"), ___EmotionJSX(EuiSelect, {
|
|
104
|
+
compressed: true,
|
|
105
|
+
value: example1.value,
|
|
106
|
+
onChange: changeExample1,
|
|
107
|
+
options: [{
|
|
108
|
+
value: 'count()',
|
|
109
|
+
text: 'count()'
|
|
110
|
+
}, {
|
|
111
|
+
value: 'average()',
|
|
112
|
+
text: 'average()'
|
|
113
|
+
}, {
|
|
114
|
+
value: 'sum()',
|
|
115
|
+
text: 'sum()'
|
|
116
|
+
}, {
|
|
117
|
+
value: 'median()',
|
|
118
|
+
text: 'median()'
|
|
119
|
+
}, {
|
|
120
|
+
value: 'min()',
|
|
121
|
+
text: 'min()'
|
|
122
|
+
}, {
|
|
123
|
+
value: 'max()',
|
|
124
|
+
text: 'max()'
|
|
125
|
+
}]
|
|
126
|
+
}));
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
var renderPopover2 = function renderPopover2() {
|
|
130
|
+
return ___EmotionJSX("div", {
|
|
131
|
+
"data-test-subj": "cy-expression-popover-2"
|
|
132
|
+
}, ___EmotionJSX(EuiFlexGroup, {
|
|
133
|
+
gutterSize: "s"
|
|
134
|
+
}, ___EmotionJSX(EuiFlexItem, {
|
|
135
|
+
grow: false,
|
|
136
|
+
style: {
|
|
137
|
+
width: 150
|
|
138
|
+
}
|
|
139
|
+
}, ___EmotionJSX(EuiSelect, {
|
|
140
|
+
compressed: true,
|
|
141
|
+
value: example2.description,
|
|
142
|
+
onChange: changeExample2Description,
|
|
143
|
+
options: [{
|
|
144
|
+
value: 'Is above',
|
|
145
|
+
text: 'Is above'
|
|
146
|
+
}, {
|
|
147
|
+
value: 'Is below',
|
|
148
|
+
text: 'Is below'
|
|
149
|
+
}, {
|
|
150
|
+
value: 'Is exactly',
|
|
151
|
+
text: 'Is exactly'
|
|
152
|
+
}]
|
|
153
|
+
})), ___EmotionJSX(EuiFlexItem, {
|
|
154
|
+
grow: false,
|
|
155
|
+
style: {
|
|
156
|
+
width: 100
|
|
157
|
+
}
|
|
158
|
+
}, ___EmotionJSX(EuiFieldNumber, {
|
|
159
|
+
compressed: true,
|
|
160
|
+
value: example2.value,
|
|
161
|
+
onChange: changeExample2Value
|
|
162
|
+
}))));
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
return ___EmotionJSX(EuiPanel, null, ___EmotionJSX(EuiFlexGroup, {
|
|
166
|
+
gutterSize: "s"
|
|
167
|
+
}, ___EmotionJSX(EuiFlexItem, {
|
|
168
|
+
grow: false
|
|
169
|
+
}, ___EmotionJSX(EuiPopover, {
|
|
170
|
+
id: expressionPopoverId__1,
|
|
171
|
+
button: ___EmotionJSX(EuiExpression, {
|
|
172
|
+
description: "when",
|
|
173
|
+
value: example1.value,
|
|
174
|
+
isActive: example1.isOpen,
|
|
175
|
+
onClick: openExample1
|
|
176
|
+
}),
|
|
177
|
+
isOpen: example1.isOpen,
|
|
178
|
+
closePopover: closeExample1,
|
|
179
|
+
panelPaddingSize: "s",
|
|
180
|
+
anchorPosition: "downLeft"
|
|
181
|
+
}, renderPopover1())), ___EmotionJSX(EuiFlexItem, {
|
|
182
|
+
grow: false
|
|
183
|
+
}, ___EmotionJSX(EuiPopover, {
|
|
184
|
+
id: expressionPopoverId__2,
|
|
185
|
+
panelPaddingSize: "s",
|
|
186
|
+
button: ___EmotionJSX(EuiExpression, {
|
|
187
|
+
description: example2.description,
|
|
188
|
+
value: example2.value,
|
|
189
|
+
isActive: example2.isOpen,
|
|
190
|
+
onClick: openExample2
|
|
191
|
+
}),
|
|
192
|
+
isOpen: example2.isOpen,
|
|
193
|
+
closePopover: closeExample2,
|
|
194
|
+
anchorPosition: "downLeft"
|
|
195
|
+
}, renderPopover2()))));
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
beforeEach(function () {
|
|
199
|
+
cy.viewport(1024, 768); // medium breakpoint
|
|
200
|
+
|
|
201
|
+
cy.realMount(___EmotionJSX(BaseExpression, null));
|
|
202
|
+
});
|
|
203
|
+
describe('Automated accessibility check', function () {
|
|
204
|
+
it('has zero violations on first render', function () {
|
|
205
|
+
cy.checkAxe();
|
|
206
|
+
});
|
|
207
|
+
it('has zero violations when count popover is open', function () {
|
|
208
|
+
cy.get('button').contains(/When count\(\)/i).realClick();
|
|
209
|
+
cy.get('div[data-test-subj="cy-expression-popover-1"]').should('exist');
|
|
210
|
+
cy.checkAxe();
|
|
211
|
+
});
|
|
212
|
+
it('has zero violations when is above popover is open', function () {
|
|
213
|
+
cy.get('button').contains(/Is above 100/i).realClick();
|
|
214
|
+
cy.get('div[data-test-subj="cy-expression-popover-2"]').should('exist');
|
|
215
|
+
cy.checkAxe();
|
|
216
|
+
});
|
|
217
|
+
it('has zero violations when first popover is interacted with by keyboard', function () {
|
|
218
|
+
cy.realPress('Tab');
|
|
219
|
+
cy.get('button').contains(/When count\(\)/i).should('have.focus');
|
|
220
|
+
cy.realPress('Enter');
|
|
221
|
+
cy.get('div[data-test-subj="cy-expression-popover-1"]').should('exist');
|
|
222
|
+
cy.realPress('Tab');
|
|
223
|
+
cy.realPress(['a', 'v', 'g']);
|
|
224
|
+
cy.realPress('Escape');
|
|
225
|
+
cy.get('button').contains(/When average\(\)/i).should('have.focus');
|
|
226
|
+
cy.checkAxe();
|
|
227
|
+
});
|
|
228
|
+
it('has zero violations when second popover is interacted with by keyboard', function () {
|
|
229
|
+
cy.repeatRealPress('Tab');
|
|
230
|
+
cy.get('button').contains(/Is above 100/i).should('have.focus');
|
|
231
|
+
cy.realPress('Enter');
|
|
232
|
+
cy.get('div[data-test-subj="cy-expression-popover-2"]').should('exist');
|
|
233
|
+
cy.realPress('Tab');
|
|
234
|
+
cy.realPress(['I', 's', ' ', 'e']);
|
|
235
|
+
cy.realPress('Tab');
|
|
236
|
+
cy.repeatRealPress('Delete', 3);
|
|
237
|
+
cy.realPress(['5', '0', '0']);
|
|
238
|
+
cy.realPress('Escape');
|
|
239
|
+
cy.get('button').contains(/Is exactly 500/i).should('have.focus');
|
|
240
|
+
cy.checkAxe();
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
});
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
5
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
6
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
7
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
8
|
+
* Side Public License, v 1.
|
|
9
|
+
*/
|
|
10
|
+
/// <reference types="../../../cypress/support"/>
|
|
11
|
+
import React, { useState } from 'react';
|
|
12
|
+
import { EuiFilterButton } from './filter_button';
|
|
13
|
+
import { EuiFilterGroup } from './filter_group';
|
|
14
|
+
import { EuiPopover, EuiPopoverTitle } from '../popover';
|
|
15
|
+
import { EuiSelectable } from '../selectable';
|
|
16
|
+
import { useGeneratedHtmlId } from '../../services';
|
|
17
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
18
|
+
describe('EuiFilterGroup single filter example', function () {
|
|
19
|
+
var SingleFilter = function SingleFilter() {
|
|
20
|
+
var _useState = useState(false),
|
|
21
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
22
|
+
isFilterOn = _useState2[0],
|
|
23
|
+
setIsFilterOn = _useState2[1];
|
|
24
|
+
|
|
25
|
+
var toggleFilter = function toggleFilter() {
|
|
26
|
+
setIsFilterOn(!isFilterOn);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
return ___EmotionJSX(EuiFilterGroup, null, ___EmotionJSX(EuiFilterButton, {
|
|
30
|
+
hasActiveFilters: isFilterOn,
|
|
31
|
+
onClick: toggleFilter
|
|
32
|
+
}, "Single filter"));
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
beforeEach(function () {
|
|
36
|
+
cy.realMount(___EmotionJSX(SingleFilter, null));
|
|
37
|
+
});
|
|
38
|
+
describe('Automated accessibility check', function () {
|
|
39
|
+
it('has zero violations on first render', function () {
|
|
40
|
+
cy.checkAxe();
|
|
41
|
+
});
|
|
42
|
+
it('has zero violations when toggled on', function () {
|
|
43
|
+
cy.get('button.euiButtonEmpty').first().realClick();
|
|
44
|
+
cy.get('button.euiButtonEmpty').first().should('have.class', 'euiFilterButton-hasActiveFilters');
|
|
45
|
+
cy.checkAxe();
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
describe('EuiFilterGroup filter with long name example', function () {
|
|
50
|
+
var LongNameFilter = function LongNameFilter() {
|
|
51
|
+
var _useState3 = useState(false),
|
|
52
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
53
|
+
isFilterOn = _useState4[0],
|
|
54
|
+
setIsFilterOn = _useState4[1];
|
|
55
|
+
|
|
56
|
+
var toggleFilter = function toggleFilter() {
|
|
57
|
+
setIsFilterOn(!isFilterOn);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
return ___EmotionJSX(EuiFilterGroup, null, ___EmotionJSX(EuiFilterButton, {
|
|
61
|
+
hasActiveFilters: isFilterOn,
|
|
62
|
+
numFilters: 12,
|
|
63
|
+
onClick: toggleFilter
|
|
64
|
+
}, "Filter with a very long name"));
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
beforeEach(function () {
|
|
68
|
+
cy.realMount(___EmotionJSX(LongNameFilter, null));
|
|
69
|
+
});
|
|
70
|
+
describe('Automated accessibility check', function () {
|
|
71
|
+
it('has zero violations on first render', function () {
|
|
72
|
+
cy.checkAxe();
|
|
73
|
+
});
|
|
74
|
+
it('has zero violations when toggled on', function () {
|
|
75
|
+
cy.get('button.euiButtonEmpty').first().realClick();
|
|
76
|
+
cy.get('button.euiButtonEmpty').first().should('have.class', 'euiFilterButton-hasActiveFilters');
|
|
77
|
+
cy.checkAxe();
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
describe('EuiFilterGroup two filter example', function () {
|
|
82
|
+
var ThreeOptionFilter = function ThreeOptionFilter() {
|
|
83
|
+
var _useState5 = useState(false),
|
|
84
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
85
|
+
isOnFilterOn = _useState6[0],
|
|
86
|
+
setIsOnFilterOn = _useState6[1];
|
|
87
|
+
|
|
88
|
+
var _useState7 = useState(false),
|
|
89
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
90
|
+
isOffFilterOn = _useState8[0],
|
|
91
|
+
setIsOffFilterOn = _useState8[1];
|
|
92
|
+
|
|
93
|
+
var toggleOnFilter = function toggleOnFilter() {
|
|
94
|
+
setIsOnFilterOn(!isOnFilterOn);
|
|
95
|
+
setIsOffFilterOn(isOffFilterOn && !isOnFilterOn ? false : isOffFilterOn);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
var toggleOffFilter = function toggleOffFilter() {
|
|
99
|
+
setIsOffFilterOn(!isOffFilterOn);
|
|
100
|
+
setIsOnFilterOn(isOnFilterOn && !isOffFilterOn ? false : isOnFilterOn);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
return ___EmotionJSX(EuiFilterGroup, null, ___EmotionJSX(EuiFilterButton, {
|
|
104
|
+
withNext: true,
|
|
105
|
+
hasActiveFilters: isOnFilterOn,
|
|
106
|
+
onClick: toggleOnFilter
|
|
107
|
+
}, "Yes"), ___EmotionJSX(EuiFilterButton, {
|
|
108
|
+
withNext: true,
|
|
109
|
+
hasActiveFilters: isOffFilterOn,
|
|
110
|
+
onClick: toggleOffFilter
|
|
111
|
+
}, "No"));
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
beforeEach(function () {
|
|
115
|
+
cy.realMount(___EmotionJSX(ThreeOptionFilter, null));
|
|
116
|
+
});
|
|
117
|
+
describe('Automated accessibility check', function () {
|
|
118
|
+
it('has zero violations on first render', function () {
|
|
119
|
+
cy.checkAxe();
|
|
120
|
+
});
|
|
121
|
+
it('has zero violations when toggled on', function () {
|
|
122
|
+
cy.get('button.euiButtonEmpty').first().realClick();
|
|
123
|
+
cy.get('button.euiButtonEmpty').first().should('have.class', 'euiFilterButton-hasActiveFilters');
|
|
124
|
+
cy.checkAxe();
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
describe('EuiFilterGroup multiselect example', function () {
|
|
129
|
+
var MultiSelectFilter = function MultiSelectFilter() {
|
|
130
|
+
var _useState9 = useState(false),
|
|
131
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
132
|
+
isPopoverOpen = _useState10[0],
|
|
133
|
+
setIsPopoverOpen = _useState10[1];
|
|
134
|
+
|
|
135
|
+
var _useState11 = useState(false),
|
|
136
|
+
_useState12 = _slicedToArray(_useState11, 1),
|
|
137
|
+
withLoading = _useState12[0];
|
|
138
|
+
|
|
139
|
+
var _useState13 = useState(false),
|
|
140
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
141
|
+
isLoading = _useState14[0],
|
|
142
|
+
setIsLoading = _useState14[1];
|
|
143
|
+
|
|
144
|
+
var onButtonClick = function onButtonClick() {
|
|
145
|
+
if (withLoading && !isPopoverOpen) {
|
|
146
|
+
setIsLoading(true);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
setIsPopoverOpen(!isPopoverOpen);
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
var closePopover = function closePopover() {
|
|
153
|
+
setIsPopoverOpen(false);
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
var filterGroupPopoverId = useGeneratedHtmlId({
|
|
157
|
+
prefix: 'filterGroupPopover'
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
var _useState15 = useState([{
|
|
161
|
+
label: 'Johann Sebastian Bach',
|
|
162
|
+
checked: 'on'
|
|
163
|
+
}, {
|
|
164
|
+
label: 'Wolfgang Amadeus Mozart',
|
|
165
|
+
checked: 'on'
|
|
166
|
+
}, {
|
|
167
|
+
label: 'Antonín Dvořák',
|
|
168
|
+
checked: 'off'
|
|
169
|
+
}, {
|
|
170
|
+
label: 'Dmitri Shostakovich'
|
|
171
|
+
}, {
|
|
172
|
+
label: 'Felix Mendelssohn-Bartholdy'
|
|
173
|
+
}, {
|
|
174
|
+
label: 'Franz Liszt'
|
|
175
|
+
}, {
|
|
176
|
+
label: 'Franz Schubert'
|
|
177
|
+
}, {
|
|
178
|
+
label: 'Frédéric Chopin'
|
|
179
|
+
}, {
|
|
180
|
+
label: 'Georg Friedrich Händel'
|
|
181
|
+
}, {
|
|
182
|
+
label: 'Giuseppe Verdi'
|
|
183
|
+
}]),
|
|
184
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
185
|
+
items = _useState16[0],
|
|
186
|
+
setItems = _useState16[1];
|
|
187
|
+
|
|
188
|
+
var button = ___EmotionJSX(EuiFilterButton, {
|
|
189
|
+
iconType: "arrowDown",
|
|
190
|
+
onClick: onButtonClick,
|
|
191
|
+
isSelected: isPopoverOpen,
|
|
192
|
+
numFilters: items.filter(function (item) {
|
|
193
|
+
return item.checked !== 'off';
|
|
194
|
+
}).length,
|
|
195
|
+
hasActiveFilters: !!items.find(function (item) {
|
|
196
|
+
return item.checked === 'on';
|
|
197
|
+
}),
|
|
198
|
+
numActiveFilters: items.filter(function (item) {
|
|
199
|
+
return item.checked === 'on';
|
|
200
|
+
}).length
|
|
201
|
+
}, "Composers");
|
|
202
|
+
|
|
203
|
+
return ___EmotionJSX(EuiFilterGroup, null, ___EmotionJSX(EuiPopover, {
|
|
204
|
+
id: filterGroupPopoverId,
|
|
205
|
+
button: button,
|
|
206
|
+
isOpen: isPopoverOpen,
|
|
207
|
+
closePopover: closePopover,
|
|
208
|
+
panelPaddingSize: "none"
|
|
209
|
+
}, ___EmotionJSX(EuiSelectable, {
|
|
210
|
+
allowExclusions: true,
|
|
211
|
+
searchable: true,
|
|
212
|
+
searchProps: {
|
|
213
|
+
placeholder: 'Filter list',
|
|
214
|
+
compressed: true
|
|
215
|
+
},
|
|
216
|
+
"aria-label": "Composers",
|
|
217
|
+
options: items,
|
|
218
|
+
onChange: function onChange(newOptions) {
|
|
219
|
+
return setItems(newOptions);
|
|
220
|
+
},
|
|
221
|
+
isLoading: isLoading,
|
|
222
|
+
loadingMessage: "Loading filters",
|
|
223
|
+
emptyMessage: "No filters available",
|
|
224
|
+
noMatchesMessage: "No filters found"
|
|
225
|
+
}, function (list, search) {
|
|
226
|
+
return ___EmotionJSX("div", {
|
|
227
|
+
style: {
|
|
228
|
+
width: 300
|
|
229
|
+
}
|
|
230
|
+
}, ___EmotionJSX(EuiPopoverTitle, {
|
|
231
|
+
paddingSize: "s"
|
|
232
|
+
}, search), list);
|
|
233
|
+
})));
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
beforeEach(function () {
|
|
237
|
+
cy.realMount(___EmotionJSX(MultiSelectFilter, null));
|
|
238
|
+
});
|
|
239
|
+
describe('Automated accessibility check', function () {
|
|
240
|
+
it('has zero violations on first render', function () {
|
|
241
|
+
cy.checkAxe();
|
|
242
|
+
});
|
|
243
|
+
it('has zero violations when toggled on', function () {
|
|
244
|
+
cy.get('button.euiButtonEmpty').first().realClick();
|
|
245
|
+
cy.get('div[data-test-subj="euiSelectableList"]').should('exist');
|
|
246
|
+
cy.checkAxe();
|
|
247
|
+
});
|
|
248
|
+
it('has zero violations when filtering by keyboard interaction', function () {
|
|
249
|
+
cy.realPress('Tab');
|
|
250
|
+
cy.realPress('Enter');
|
|
251
|
+
cy.get('div[data-test-subj="euiSelectableList"]').should('exist');
|
|
252
|
+
cy.realPress('Tab');
|
|
253
|
+
cy.repeatRealPress('ArrowDown', 3);
|
|
254
|
+
cy.realPress('Enter');
|
|
255
|
+
cy.get('li[aria-selected="true"]').find('span.euiSelectableListItem__text').should('have.text', 'Dmitri Shostakovich - Selected option. To exclude this option, press enter.');
|
|
256
|
+
cy.realPress('ArrowDown');
|
|
257
|
+
cy.repeatRealPress('Enter');
|
|
258
|
+
cy.get('li[aria-selected="true"]').find('span.euiSelectableListItem__text').should('have.text', 'Felix Mendelssohn-Bartholdy - Excluded option. To uncheck this option, press enter.');
|
|
259
|
+
cy.checkAxe();
|
|
260
|
+
});
|
|
261
|
+
it('has zero violations when filtering by searchbox', function () {
|
|
262
|
+
cy.realPress('Tab');
|
|
263
|
+
cy.realPress('Enter');
|
|
264
|
+
cy.get('div[data-test-subj="euiSelectableList"]').should('exist');
|
|
265
|
+
cy.realPress('Tab');
|
|
266
|
+
cy.realPress(['m', 'a', 'r', 'k']);
|
|
267
|
+
cy.get('div[data-test-subj="euiSelectableMessage"]').find('p').contains('No filters found').should('exist');
|
|
268
|
+
cy.checkAxe();
|
|
269
|
+
});
|
|
270
|
+
});
|
|
271
|
+
});
|