@elastic/eui 71.0.0 → 71.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/README.md +0 -7
  2. package/dist/eui_theme_dark.css +7694 -5793
  3. package/dist/eui_theme_dark.min.css +1 -1
  4. package/dist/eui_theme_light.css +7736 -5835
  5. package/dist/eui_theme_light.min.css +1 -1
  6. package/es/components/datagrid/data_grid.a11y.js +251 -0
  7. package/es/components/date_picker/date_picker.a11y.js +83 -0
  8. package/es/components/delay_hide/delay_hide.a11y.js +106 -0
  9. package/es/components/delay_render/delay_render.a11y.js +106 -0
  10. package/es/components/empty_prompt/empty_prompt.a11y.js +63 -0
  11. package/es/components/error_boundary/error_boundary.js +45 -27
  12. package/es/components/page/page_side_bar/page_side_bar.js +3 -0
  13. package/es/components/page/page_template.js +1 -15
  14. package/eui.d.ts +19 -11
  15. package/i18ntokens.json +4 -4
  16. package/lib/components/datagrid/data_grid.a11y.js +255 -0
  17. package/lib/components/date_picker/date_picker.a11y.js +89 -0
  18. package/lib/components/delay_hide/delay_hide.a11y.js +111 -0
  19. package/lib/components/delay_render/delay_render.a11y.js +111 -0
  20. package/lib/components/empty_prompt/empty_prompt.a11y.js +72 -0
  21. package/lib/components/error_boundary/error_boundary.js +49 -29
  22. package/lib/components/page/page_side_bar/page_side_bar.js +4 -0
  23. package/lib/components/page/page_template.js +1 -15
  24. package/optimize/es/components/datagrid/data_grid.a11y.js +234 -0
  25. package/optimize/es/components/date_picker/date_picker.a11y.js +73 -0
  26. package/optimize/es/components/delay_hide/delay_hide.a11y.js +96 -0
  27. package/optimize/es/components/delay_render/delay_render.a11y.js +96 -0
  28. package/optimize/es/components/empty_prompt/empty_prompt.a11y.js +63 -0
  29. package/optimize/es/components/error_boundary/error_boundary.js +37 -26
  30. package/optimize/es/components/page/page_side_bar/page_side_bar.js +3 -0
  31. package/optimize/lib/components/datagrid/data_grid.a11y.js +248 -0
  32. package/optimize/lib/components/date_picker/date_picker.a11y.js +87 -0
  33. package/optimize/lib/components/delay_hide/delay_hide.a11y.js +111 -0
  34. package/optimize/lib/components/delay_render/delay_render.a11y.js +111 -0
  35. package/optimize/lib/components/empty_prompt/empty_prompt.a11y.js +72 -0
  36. package/optimize/lib/components/error_boundary/error_boundary.js +41 -28
  37. package/optimize/lib/components/page/page_side_bar/page_side_bar.js +4 -0
  38. package/package.json +11 -14
  39. package/src/components/basic_table/_basic_table.scss +1 -4
  40. package/src/components/button/button_empty/_button_empty.scss +2 -4
  41. package/src/components/button/button_group/_button_group.scss +1 -1
  42. package/src/components/button/button_group/_button_group_button.scss +3 -4
  43. package/src/components/button/button_icon/_button_icon.scss +0 -3
  44. package/src/components/collapsible_nav/_collapsible_nav.scss +1 -1
  45. package/src/components/collapsible_nav/collapsible_nav_group/_collapsible_nav_group.scss +1 -1
  46. package/src/components/color_picker/_color_picker.scss +3 -2
  47. package/src/components/color_picker/_hue.scss +7 -7
  48. package/src/components/color_picker/_saturation.scss +1 -1
  49. package/src/components/color_picker/color_palette_display/_mixins.scss +1 -1
  50. package/src/components/color_picker/color_stops/_color_stops.scss +2 -3
  51. package/src/components/combo_box/_combo_box.scss +7 -6
  52. package/src/components/combo_box/combo_box_input/_combo_box_input.scss +2 -1
  53. package/src/components/combo_box/combo_box_input/_combo_box_placeholder.scss +1 -1
  54. package/src/components/combo_box/combo_box_options_list/_combo_box_options_list.scss +2 -3
  55. package/src/components/control_bar/_variables.scss +0 -1
  56. package/src/components/datagrid/_data_grid_data_row.scss +4 -5
  57. package/src/components/datagrid/_mixins.scss +1 -1
  58. package/src/components/datagrid/body/_data_grid_footer_row.scss +2 -1
  59. package/src/components/datagrid/body/header/_data_grid_column_resizer.scss +3 -4
  60. package/src/components/datagrid/body/header/_data_grid_header_row.scss +1 -1
  61. package/src/components/datagrid/controls/_data_grid_column_sorting.scss +1 -2
  62. package/src/components/date_picker/_date_picker_range.scss +1 -1
  63. package/src/components/date_picker/super_date_picker/_super_date_picker.scss +1 -4
  64. package/src/components/date_picker/super_date_picker/quick_select_popover/_quick_select_popover.scss +1 -1
  65. package/src/components/drag_and_drop/_draggable.scss +3 -5
  66. package/src/components/drag_and_drop/_droppable.scss +1 -1
  67. package/src/components/empty_prompt/_empty_prompt.scss +1 -1
  68. package/src/components/filter_group/_filter_group.scss +2 -2
  69. package/src/components/filter_group/_filter_select_item.scss +0 -1
  70. package/src/components/form/checkbox/_checkbox.scss +5 -3
  71. package/src/components/form/described_form_group/_described_form_group.scss +0 -1
  72. package/src/components/form/field_password/_field_password.scss +1 -1
  73. package/src/components/form/field_search/_field_search.scss +1 -1
  74. package/src/components/form/file_picker/_file_picker.scss +1 -2
  75. package/src/components/form/form_control_layout/_form_control_layout.scss +6 -7
  76. package/src/components/form/form_control_layout/_form_control_layout_delimited.scss +4 -6
  77. package/src/components/form/form_row/_form_row.scss +3 -0
  78. package/src/components/form/radio/_radio.scss +5 -3
  79. package/src/components/form/select/_select.scss +1 -1
  80. package/src/components/form/switch/_switch.scss +3 -1
  81. package/src/components/header/_mixins.scss +1 -1
  82. package/src/components/header/header_section/_header_section_item.scss +4 -4
  83. package/src/components/header/header_section/_header_section_item_button.scss +0 -1
  84. package/src/components/key_pad_menu/_key_pad_menu_item.scss +2 -7
  85. package/src/components/markdown_editor/_markdown_editor_drop_zone.scss +4 -4
  86. package/src/components/markdown_editor/_markdown_editor_footer.scss +1 -1
  87. package/src/components/markdown_editor/_markdown_editor_text_area.scss +2 -3
  88. package/src/components/markdown_editor/_markdown_format.scss +4 -2
  89. package/src/components/notification/_notification_event.scss +2 -2
  90. package/src/components/page/page_content/_page_content_body.scss +0 -1
  91. package/src/components/page/page_content/_page_content_header_section.scss +0 -1
  92. package/src/components/page/page_side_bar/_page_side_bar.scss +0 -1
  93. package/src/components/panel/split_panel/_split_panel.scss +2 -2
  94. package/src/components/resizable_container/_resizable_button.scss +31 -31
  95. package/src/components/resizable_container/_resizable_collapse_button.scss +9 -9
  96. package/src/components/selectable/selectable_templates/_selectable_template_sitewide_option.scss +1 -1
  97. package/src/components/side_nav/_mixins.scss +1 -1
  98. package/src/components/side_nav/_side_nav.scss +2 -1
  99. package/src/components/side_nav/_side_nav_item.scss +2 -3
  100. package/src/components/steps/_steps.scss +2 -1
  101. package/src/components/suggest/_suggest_input.scss +1 -1
  102. package/src/components/suggest/_suggest_item.scss +4 -3
  103. package/src/components/table/_responsive.scss +5 -3
  104. package/src/components/table/_table.scss +2 -4
  105. package/src/components/table/mobile/_mobile.scss +0 -2
  106. package/src/components/tree_view/tree_view.scss +2 -2
  107. package/src/global_styling/mixins/_form.scss +7 -18
  108. package/src/global_styling/mixins/_header.scss +2 -2
  109. package/src/global_styling/mixins/_helpers.scss +1 -2
  110. package/src/global_styling/mixins/_icons.scss +1 -1
  111. package/src/global_styling/mixins/_range.scss +4 -8
  112. package/src/global_styling/mixins/_responsive.scss +3 -8
  113. package/src/global_styling/mixins/_shadow.scss +5 -9
  114. package/src/global_styling/mixins/_states.scss +2 -2
  115. package/src/global_styling/mixins/_typography.scss +16 -19
  116. package/src/global_styling/variables/_colors_vis.scss +1 -1
  117. package/src/global_styling/variables/_typography.scss +1 -3
  118. package/src/themes/amsterdam/_colors_dark.scss +2 -1
  119. package/src/themes/amsterdam/_colors_light.scss +2 -0
  120. package/src/themes/amsterdam/global_styling/mixins/_link.scss +1 -1
  121. package/src/themes/amsterdam/global_styling/mixins/_states.scss +0 -1
  122. package/src/themes/amsterdam/global_styling/mixins/_typography.scss +1 -2
  123. package/src/themes/amsterdam/global_styling/react_date_picker/_date_picker_days.scss +0 -1
  124. package/src/themes/amsterdam/global_styling/react_date_picker/_date_picker_month_year.scss +0 -1
  125. package/src/themes/amsterdam/global_styling/react_date_picker/_date_picker_times.scss +3 -4
  126. package/src/themes/amsterdam/global_styling/react_date_picker/_mixins.scss +0 -1
  127. package/src/themes/amsterdam/global_styling/variables/_typography.scss +1 -2
  128. package/src/themes/amsterdam/overrides/_color_stops.scss +4 -5
  129. package/src/themes/amsterdam/overrides/_combo_box.scss +3 -0
  130. package/src/themes/amsterdam/overrides/_form_control_layout.scss +3 -0
  131. package/src/themes/amsterdam/overrides/_form_control_layout_delimited.scss +5 -4
  132. package/src/themes/amsterdam/overrides/_header.scss +2 -2
  133. package/src/themes/amsterdam/overrides/_hue.scss +6 -6
  134. package/src/themes/amsterdam/overrides/_key_pad_menu.scss +2 -2
  135. package/src/themes/amsterdam/overrides/_steps.scss +1 -2
  136. package/src/themes/legacy/_colors_dark.scss +2 -1
  137. package/src/themes/legacy/_colors_light.scss +2 -0
  138. package/src/themes/legacy/reset/_reset.scss +8 -7
  139. package/test-env/components/datagrid/data_grid.a11y.js +248 -0
  140. package/test-env/components/date_picker/date_picker.a11y.js +87 -0
  141. package/test-env/components/delay_hide/delay_hide.a11y.js +111 -0
  142. package/test-env/components/delay_render/delay_render.a11y.js +111 -0
  143. package/test-env/components/empty_prompt/empty_prompt.a11y.js +72 -0
  144. package/test-env/components/error_boundary/error_boundary.js +48 -28
  145. package/test-env/components/page/page_side_bar/page_side_bar.js +4 -0
  146. package/test-env/components/page/page_template.js +1 -15
  147. package/scripts/postinstall.js +0 -9
@@ -0,0 +1,234 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+
4
+ /*
5
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
6
+ * or more contributor license agreements. Licensed under the Elastic License
7
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
8
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
9
+ * Side Public License, v 1.
10
+ */
11
+ /// <reference types="../../../cypress/support"/>
12
+ import React, { useState } from 'react';
13
+ import { EuiDataGrid } from './index';
14
+ import { faker } from '@faker-js/faker';
15
+ import { jsx as ___EmotionJSX } from "@emotion/react";
16
+ var columns = [{
17
+ id: 'Name'
18
+ }, {
19
+ id: 'Email',
20
+ cellActions: [function (_ref) {
21
+ var rowIndex = _ref.rowIndex,
22
+ columnId = _ref.columnId,
23
+ Component = _ref.Component;
24
+ var row = ++rowIndex;
25
+ return ___EmotionJSX(Component, {
26
+ onClick: function onClick() {},
27
+ iconType: "heart",
28
+ "aria-label": "Send love to ".concat(row, ", column \"").concat(columnId, "\" ")
29
+ }, "Send love");
30
+ }]
31
+ }, {
32
+ id: 'User ID',
33
+ schema: 'string'
34
+ }, {
35
+ id: 'Account balance'
36
+ }, {
37
+ id: 'Last purchase',
38
+ schema: 'datetime'
39
+ }, {
40
+ id: 'Favorite distro',
41
+ schema: 'favoriteDistro'
42
+ }];
43
+ var storeData = [];
44
+
45
+ for (var i = 1; i < 11; i++) {
46
+ storeData.push({
47
+ Name: "".concat(faker.name.lastName(), ", ").concat(faker.name.firstName(), " ").concat(faker.name.suffix()),
48
+ Email: "".concat(faker.internet.email()),
49
+ 'User ID': "".concat(faker.datatype.number({
50
+ min: 1000000,
51
+ max: 9999999
52
+ })),
53
+ 'Account balance': faker.finance.amount(),
54
+ 'Last purchase': "".concat(faker.date.past()),
55
+ 'Favorite distro': i % 2 === 0 ? 'Alma' : 'Debian'
56
+ });
57
+ }
58
+
59
+ var commaSeparateNumbers = function commaSeparateNumbers(numberString) {
60
+ // extract the groups-of-three digits that are right-aligned
61
+ return numberString.replace(/((\d{3})+)$/, function (match) {
62
+ return (// then replace each group of xyz digits with ,xyz
63
+ match.replace(/(\d{3})/g, ',$1')
64
+ );
65
+ });
66
+ };
67
+
68
+ var DataGrid = function DataGrid() {
69
+ var _useState = useState(columns.map(function (_ref2) {
70
+ var id = _ref2.id;
71
+ return id;
72
+ })),
73
+ _useState2 = _slicedToArray(_useState, 2),
74
+ visibleColumns = _useState2[0],
75
+ setVisibleColumns = _useState2[1];
76
+
77
+ var _useState3 = useState(storeData),
78
+ _useState4 = _slicedToArray(_useState3, 2),
79
+ data = _useState4[0],
80
+ setData = _useState4[1];
81
+
82
+ var _useState5 = useState([{
83
+ id: 'custom',
84
+ direction: 'asc'
85
+ }]),
86
+ _useState6 = _slicedToArray(_useState5, 2),
87
+ sortingColumns = _useState6[0],
88
+ setSortingColumns = _useState6[1];
89
+
90
+ var setSorting = function setSorting(sortingColumns) {
91
+ var sortedData = _toConsumableArray(data).sort(function (a, b) {
92
+ for (var _i = 0; _i < sortingColumns.length; _i++) {
93
+ var column = sortingColumns[_i];
94
+ var aValue = a[column.id];
95
+ var bValue = b[column.id];
96
+ if (aValue < bValue) return column.direction === 'asc' ? -1 : 1;
97
+ if (aValue > bValue) return column.direction === 'asc' ? 1 : -1;
98
+ }
99
+
100
+ return 0;
101
+ });
102
+
103
+ setData(sortedData);
104
+ setSortingColumns(sortingColumns);
105
+ };
106
+
107
+ return ___EmotionJSX(EuiDataGrid, {
108
+ "aria-label": "Data grid schema example",
109
+ columns: columns,
110
+ columnVisibility: {
111
+ visibleColumns: visibleColumns,
112
+ setVisibleColumns: setVisibleColumns
113
+ },
114
+ rowCount: data.length,
115
+ inMemory: {
116
+ level: 'sorting'
117
+ },
118
+ renderCellValue: function renderCellValue(_ref3) {
119
+ var rowIndex = _ref3.rowIndex,
120
+ columnId = _ref3.columnId,
121
+ schema = _ref3.schema;
122
+ var value = data[rowIndex][columnId];
123
+
124
+ if (schema === 'numeric') {
125
+ value = commaSeparateNumbers(value);
126
+ }
127
+
128
+ return value;
129
+ },
130
+ sorting: {
131
+ columns: sortingColumns,
132
+ onSort: setSorting
133
+ },
134
+ schemaDetectors: [{
135
+ type: 'favoriteDistro',
136
+ textTransform: 'capitalize',
137
+ detector: function detector(value) {
138
+ return value.toLowerCase() === 'alma' || value.toLowerCase() === 'debian' ? 1 : 0;
139
+ },
140
+ comparator: function comparator(a, b, direction) {
141
+ var aValue = a.toLowerCase() === 'alma';
142
+ var bValue = b.toLowerCase() === 'alma';
143
+ if (aValue < bValue) return direction === 'asc' ? 1 : -1;
144
+ if (aValue > bValue) return direction === 'asc' ? -1 : 1;
145
+ return 0;
146
+ },
147
+ sortTextAsc: 'Alma to Debian',
148
+ sortTextDesc: 'Debian to Alma',
149
+ icon: 'starFilled',
150
+ color: '#800080'
151
+ }]
152
+ });
153
+ };
154
+
155
+ beforeEach(function () {
156
+ cy.viewport(1280, 800); // large breakpoint
157
+
158
+ cy.mount(___EmotionJSX("div", {
159
+ style: {
160
+ width: '80%',
161
+ margin: '0 auto'
162
+ }
163
+ }, ___EmotionJSX(DataGrid, null)));
164
+ });
165
+ describe('EuiDataGrid', function () {
166
+ describe('Automated accessibility check', function () {
167
+ it('has zero violations on first render', function () {
168
+ cy.checkAxe();
169
+ });
170
+ it('has zero violations when the columns reorder menu is open', function () {
171
+ cy.get('button[data-test-subj="dataGridColumnSelectorButton"]').realClick();
172
+ cy.checkAxe();
173
+ });
174
+ it('has zero violations when the hide all columns button is clicked', function () {
175
+ cy.get('button[data-test-subj="dataGridColumnSelectorButton"]').realClick();
176
+ cy.get('button[data-test-subj="dataGridColumnSelectorHideAllButton"]').realClick(); // TODO: Log this issue and remove the skipFailures boolean when fixed
177
+
178
+ cy.checkAxe({
179
+ skipFailures: true
180
+ });
181
+ });
182
+ it('has zero violations when the columns reorder searchbox returns multiple results', function () {
183
+ cy.get('button[data-test-subj="dataGridColumnSelectorButton"]').realClick();
184
+ cy.get('input[data-test-subj="dataGridColumnSelectorSearch"]').type('a');
185
+ cy.get('div.euiSwitch--compressed').should(function ($s) {
186
+ expect($s).to.have.length(5);
187
+ });
188
+ cy.checkAxe();
189
+ });
190
+ it('has zero violations when the columns reorder searchbox returns 1 result', function () {
191
+ cy.get('button[data-test-subj="dataGridColumnSelectorButton"]').realClick();
192
+ cy.get('input[data-test-subj="dataGridColumnSelectorSearch"]').type('favorite');
193
+ cy.get('div.euiSwitch--compressed').should(function ($s) {
194
+ expect($s).to.have.length(1);
195
+ });
196
+ cy.checkAxe();
197
+ });
198
+ it('has zero violations when the columns reorder searchbox returns 0 results', function () {
199
+ cy.get('button[data-test-subj="dataGridColumnSelectorButton"]').realClick();
200
+ cy.get('input[data-test-subj="dataGridColumnSelectorSearch"]').type('x');
201
+ cy.get('div.euiSwitch--compressed').should(function ($s) {
202
+ expect($s).to.have.length(0);
203
+ });
204
+ cy.checkAxe();
205
+ });
206
+ it('has zero violations when the keyboard shortcut menu is open', function () {
207
+ cy.get('button[data-test-subj="dataGridKeyboardShortcutsButton"]').realClick();
208
+ cy.checkAxe();
209
+ });
210
+ it('has zero violations when the grid display menu is open', function () {
211
+ cy.get('button[data-test-subj="dataGridDisplaySelectorButton"]').realClick();
212
+ cy.checkAxe();
213
+ });
214
+ it('has zero violations when the column actions menu is open', function () {
215
+ cy.get('button.euiDataGridHeaderCell__button').first().realClick();
216
+ cy.checkAxe();
217
+ });
218
+ it('has zero violations when a cell expansion popover is open', function () {
219
+ cy.get('div[data-gridcell-visible-row-index="0"][data-gridcell-column-index="1"]').realClick();
220
+ cy.get('div[data-gridcell-visible-row-index="0"][data-gridcell-column-index="1"]').find('button.euiButtonIcon').last().realClick();
221
+ cy.checkAxe();
222
+ });
223
+ it('has zero violations when the Favorite Distro column has been sorted', function () {
224
+ cy.get('button.euiDataGridHeaderCell__button').last().realClick();
225
+ cy.get('button.euiListGroupItem__button').contains('Sort Alma to Debian').should('exist').realClick();
226
+ cy.checkAxe();
227
+ });
228
+ it('has zero violations when fullscreen is open', function () {
229
+ cy.get('button[data-test-subj="dataGridFullScreenButton"]').realClick();
230
+ cy.get('div.euiDataGrid--fullScreen').should('exist');
231
+ cy.checkAxe();
232
+ });
233
+ });
234
+ });
@@ -0,0 +1,73 @@
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 moment from 'moment';
13
+ import { EuiDatePicker } from './date_picker';
14
+ import { EuiFormRow } from '../form';
15
+ import { jsx as ___EmotionJSX } from "@emotion/react";
16
+
17
+ var DatePicker = function DatePicker() {
18
+ var _useState = useState(moment()),
19
+ _useState2 = _slicedToArray(_useState, 2),
20
+ startDate = _useState2[0],
21
+ setStartDate = _useState2[1];
22
+
23
+ var handleChange = function handleChange(date) {
24
+ setStartDate(date);
25
+ };
26
+
27
+ return ___EmotionJSX(EuiFormRow, {
28
+ label: "Select a date"
29
+ }, ___EmotionJSX(EuiDatePicker, {
30
+ selected: startDate,
31
+ onChange: handleChange
32
+ }));
33
+ };
34
+
35
+ beforeEach(function () {
36
+ cy.realMount(___EmotionJSX(DatePicker, null));
37
+ cy.get('input.euiDatePicker').should('exist');
38
+ });
39
+ describe('EuiDatePicker', function () {
40
+ describe('Automated accessibility check', function () {
41
+ it('has zero violations on first render', function () {
42
+ cy.checkAxe();
43
+ });
44
+ it('has zero violations when the calendar widget is expanded', function () {
45
+ cy.get('input.euiDatePicker').realClick();
46
+ cy.get('div.react-datepicker').should('exist');
47
+ cy.checkAxe();
48
+ });
49
+ it('has zero violations after picking a date with arrow keys', function () {
50
+ cy.realPress('Tab');
51
+ cy.get('div.react-datepicker').should('exist');
52
+ cy.repeatRealPress('ArrowDown');
53
+ cy.realPress('ArrowRight');
54
+ cy.realPress('Enter');
55
+ cy.get('div.react-datepicker').should('not.exist');
56
+ cy.checkAxe();
57
+ });
58
+ it('has zero violations after picking a date with dropdown menus', function () {
59
+ cy.realPress('Tab');
60
+ cy.get('div.react-datepicker').should('exist');
61
+ cy.repeatRealPress('Tab', 4);
62
+ cy.get('div.react-datepicker__month-read-view').should('have.focus');
63
+ cy.realPress('Space');
64
+ cy.repeatRealPress('ArrowDown');
65
+ cy.realPress('Enter');
66
+ cy.realPress('Tab');
67
+ cy.realPress('Space');
68
+ cy.repeatRealPress('ArrowDown');
69
+ cy.realPress('Enter');
70
+ cy.checkAxe();
71
+ });
72
+ });
73
+ });
@@ -0,0 +1,96 @@
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 { EuiDelayHide } from './delay_hide';
13
+ import { EuiCheckbox, EuiFieldNumber, EuiFormRow } from '../form';
14
+ import { EuiFlexItem } from '../flex';
15
+ import { EuiLoadingSpinner } from '../loading';
16
+ import { jsx as ___EmotionJSX } from "@emotion/react";
17
+
18
+ var DelayHide = function DelayHide() {
19
+ var _useState = useState(1000),
20
+ _useState2 = _slicedToArray(_useState, 2),
21
+ minimumDuration = _useState2[0],
22
+ setDuration = _useState2[1];
23
+
24
+ var _useState3 = useState(false),
25
+ _useState4 = _slicedToArray(_useState3, 2),
26
+ hide = _useState4[0],
27
+ setHide = _useState4[1];
28
+
29
+ var onChangeMinimumDuration = function onChangeMinimumDuration(event) {
30
+ setDuration(parseInt(event.target.value, 10));
31
+ };
32
+
33
+ var onChangeHide = function onChangeHide(event) {
34
+ setHide(event.target.checked);
35
+ };
36
+
37
+ return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiFlexItem, null, ___EmotionJSX(EuiFormRow, null, ___EmotionJSX(EuiCheckbox, {
38
+ id: "dummy-id",
39
+ checked: hide,
40
+ onChange: onChangeHide,
41
+ label: "Hide child"
42
+ })), ___EmotionJSX(EuiFormRow, {
43
+ label: "Minimum duration"
44
+ }, ___EmotionJSX(EuiFieldNumber, {
45
+ value: minimumDuration,
46
+ onChange: onChangeMinimumDuration
47
+ })), ___EmotionJSX(EuiFormRow, {
48
+ label: "Child to render"
49
+ }, ___EmotionJSX(EuiDelayHide, {
50
+ hide: hide,
51
+ minimumDuration: minimumDuration,
52
+ render: function render() {
53
+ return ___EmotionJSX(EuiLoadingSpinner, {
54
+ size: "m"
55
+ });
56
+ }
57
+ }))));
58
+ };
59
+
60
+ beforeEach(function () {
61
+ cy.realMount(___EmotionJSX(DelayHide, null));
62
+ });
63
+ describe('EuiHideRender', function () {
64
+ describe('Automated accessibility check', function () {
65
+ it('has zero violations on first render', function () {
66
+ cy.checkAxe();
67
+ });
68
+ it('has zero violations when the hide child input is checked', function () {
69
+ cy.get('input.euiCheckbox__input').realClick();
70
+ cy.get('div.euiFormRow__fieldWrapper').last().find('span[role="progressbar"]', {
71
+ timeout: 5000
72
+ }).should('not.exist');
73
+ cy.checkAxe();
74
+ });
75
+ it('has zero violations when the hide child input is pressed', function () {
76
+ cy.realPress('Tab');
77
+ cy.get('input.euiCheckbox__input').should('have.focus');
78
+ cy.realPress('Space');
79
+ cy.get('div.euiFormRow__fieldWrapper').last().find('span[role="progressbar"]', {
80
+ timeout: 5000
81
+ }).should('not.exist');
82
+ cy.checkAxe();
83
+ });
84
+ it('has zero violations when the hide child input is toggled', function () {
85
+ cy.realPress('Tab');
86
+ cy.get('input.euiCheckbox__input').should('have.focus');
87
+ cy.realPress('Space');
88
+ cy.get('div.euiFormRow__fieldWrapper').last().find('span[role="progressbar"]').should('not.exist');
89
+ cy.realPress('Space');
90
+ cy.get('div.euiFormRow__fieldWrapper').last().find('span[role="progressbar"]', {
91
+ timeout: 5000
92
+ }).should('exist');
93
+ cy.checkAxe();
94
+ });
95
+ });
96
+ });
@@ -0,0 +1,96 @@
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 { EuiDelayRender } from './delay_render';
13
+ import { EuiCheckbox, EuiFieldNumber, EuiFormRow } from '../form';
14
+ import { EuiFlexItem } from '../flex';
15
+ import { EuiLoadingSpinner } from '../loading';
16
+ import { jsx as ___EmotionJSX } from "@emotion/react";
17
+
18
+ var DelayRender = function DelayRender() {
19
+ var _useState = useState(1000),
20
+ _useState2 = _slicedToArray(_useState, 2),
21
+ minimumDelay = _useState2[0],
22
+ setDelay = _useState2[1];
23
+
24
+ var _useState3 = useState(false),
25
+ _useState4 = _slicedToArray(_useState3, 2),
26
+ render = _useState4[0],
27
+ setRender = _useState4[1];
28
+
29
+ var onChangeMinimumDelay = function onChangeMinimumDelay(event) {
30
+ setDelay(parseInt(event.target.value, 10));
31
+ };
32
+
33
+ var onChangeHide = function onChangeHide(event) {
34
+ setRender(event.target.checked);
35
+ };
36
+
37
+ var status = render ? 'showing' : 'hidden';
38
+ var label = "Child (".concat(status, ")");
39
+ return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiFlexItem, null, ___EmotionJSX(EuiFormRow, null, ___EmotionJSX(EuiCheckbox, {
40
+ id: "dummy-id",
41
+ checked: render,
42
+ onChange: onChangeHide,
43
+ label: "Show child"
44
+ })), ___EmotionJSX(EuiFormRow, {
45
+ label: "Minimum delay"
46
+ }, ___EmotionJSX(EuiFieldNumber, {
47
+ value: minimumDelay,
48
+ onChange: onChangeMinimumDelay
49
+ })), ___EmotionJSX(EuiFormRow, {
50
+ label: label
51
+ }, render ? ___EmotionJSX(EuiDelayRender, {
52
+ delay: minimumDelay
53
+ }, ___EmotionJSX(EuiLoadingSpinner, {
54
+ size: "m"
55
+ })) : ___EmotionJSX(React.Fragment, null))));
56
+ };
57
+
58
+ beforeEach(function () {
59
+ cy.realMount(___EmotionJSX(DelayRender, null));
60
+ });
61
+ describe('EuiDelayRender', function () {
62
+ describe('Automated accessibility check', function () {
63
+ it('has zero violations on first render', function () {
64
+ cy.checkAxe();
65
+ });
66
+ it('has zero violations when the show child input is checked', function () {
67
+ cy.get('input.euiCheckbox__input').realClick();
68
+ cy.get('div.euiFormRow__fieldWrapper').last().find('span[role="progressbar"]', {
69
+ timeout: 5000
70
+ }).should('exist');
71
+ cy.checkAxe();
72
+ });
73
+ it('has zero violations when the show child input is pressed', function () {
74
+ cy.realPress('Tab');
75
+ cy.get('input.euiCheckbox__input').should('have.focus');
76
+ cy.realPress('Space');
77
+ cy.get('div.euiFormRow__fieldWrapper').last().find('span[role="progressbar"]', {
78
+ timeout: 5000
79
+ }).should('exist');
80
+ cy.checkAxe();
81
+ });
82
+ it('has zero violations when the show child input is toggled', function () {
83
+ cy.realPress('Tab');
84
+ cy.get('input.euiCheckbox__input').should('have.focus');
85
+ cy.realPress('Space');
86
+ cy.get('div.euiFormRow__fieldWrapper').last().find('span[role="progressbar"]', {
87
+ timeout: 5000
88
+ });
89
+ cy.realPress('Space');
90
+ cy.get('div.euiFormRow__fieldWrapper').last().find('span[role="progressbar"]', {
91
+ timeout: 5000
92
+ }).should('not.exist');
93
+ cy.checkAxe();
94
+ });
95
+ });
96
+ });
@@ -0,0 +1,63 @@
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 { EuiEmptyPrompt } from './empty_prompt';
12
+ import { EuiLink } from '../link';
13
+ import { EuiTitle } from '../title';
14
+ import { jsx as ___EmotionJSX } from "@emotion/react";
15
+
16
+ var EmptyPrompt = function EmptyPrompt(_ref) {
17
+ var addCaseSpy = _ref.addCaseSpy,
18
+ addLinkSpy = _ref.addLinkSpy;
19
+ return ___EmotionJSX(EuiEmptyPrompt, {
20
+ iconType: "logoSecurity",
21
+ title: ___EmotionJSX("h2", null, "Start adding cases"),
22
+ body: ___EmotionJSX("p", null, "Add a new case or change your filter settings."),
23
+ actions: ___EmotionJSX(EuiButton, {
24
+ color: "primary",
25
+ onClick: addCaseSpy,
26
+ fill: true
27
+ }, "Add a case"),
28
+ footer: ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiTitle, {
29
+ size: "xxs"
30
+ }, ___EmotionJSX("h3", null, "Want to learn more?")), ___EmotionJSX(EuiLink, {
31
+ href: "#",
32
+ onClick: addLinkSpy
33
+ }, "Read the docs"))
34
+ });
35
+ };
36
+
37
+ beforeEach(function () {
38
+ var addCaseSpy = cy.spy().as('addCaseSpy');
39
+ var addLinkSpy = cy.spy().as('addLinkSpy');
40
+ cy.viewport(1024, 768); // medium breakpoint
41
+
42
+ cy.realMount(___EmotionJSX(EmptyPrompt, {
43
+ addCaseSpy: addCaseSpy,
44
+ addLinkSpy: addLinkSpy
45
+ }));
46
+ });
47
+ describe('EuiEmptyPrompt', function () {
48
+ describe('Automated accessibility check', function () {
49
+ it('has zero violations on first render', function () {
50
+ cy.checkAxe();
51
+ });
52
+ it('has zero violations after clicking Add a case button', function () {
53
+ cy.get('button.euiButton').contains('Add a case').realClick();
54
+ cy.get('@addCaseSpy').should('have.been.called');
55
+ cy.checkAxe();
56
+ });
57
+ it('has zero violations after clicking Read the docs link', function () {
58
+ cy.get('a.euiLink').contains('Read the docs').realClick();
59
+ cy.get('@addLinkSpy').should('have.been.called');
60
+ cy.checkAxe();
61
+ });
62
+ });
63
+ });
@@ -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 = ["className", "children", "data-test-subj", "theme"];
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 { withEuiTheme } from '../../services';
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 _EuiErrorBoundary = /*#__PURE__*/function (_Component) {
30
- _inherits(_EuiErrorBoundary, _Component);
30
+ export var EuiErrorBoundary = /*#__PURE__*/function (_Component) {
31
+ _inherits(EuiErrorBoundary, _Component);
31
32
 
32
- var _super = _createSuper(_EuiErrorBoundary);
33
+ var _super = _createSuper(EuiErrorBoundary);
33
34
 
34
- function _EuiErrorBoundary(props) {
35
+ function EuiErrorBoundary(props) {
35
36
  var _this;
36
37
 
37
- _classCallCheck(this, _EuiErrorBoundary);
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(_EuiErrorBoundary, [{
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("div", _extends({
80
- css: styles.euiErrorBoundary,
81
- className: classNames('euiErrorBoundary', className),
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 _EuiErrorBoundary;
83
+ return EuiErrorBoundary;
96
84
  }(Component);
97
- export var EuiErrorBoundary = withEuiTheme(_EuiErrorBoundary);
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
+ };
@@ -20,6 +20,9 @@ var paddingSizeToClassNameMap = {
20
20
  l: 'euiPageSideBar--paddingLarge'
21
21
  };
22
22
  export var PADDING_SIZES = keysOf(paddingSizeToClassNameMap);
23
+ /**
24
+ * @deprecated Use the new EuiPageSidebarProps in page/page_sidebar instead
25
+ */
23
26
 
24
27
  /**
25
28
  * @deprecated Use the new EuiPageSidebar in page/page_sidebar instead