@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,248 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
7
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
8
+
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
+
11
+ var _react = _interopRequireWildcard(require("react"));
12
+
13
+ var _index = require("./index");
14
+
15
+ var _faker = require("@faker-js/faker");
16
+
17
+ var _react2 = require("@emotion/react");
18
+
19
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
20
+
21
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
22
+
23
+ /*
24
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
25
+ * or more contributor license agreements. Licensed under the Elastic License
26
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
27
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
28
+ * Side Public License, v 1.
29
+ */
30
+ /// <reference types="../../../cypress/support"/>
31
+ var columns = [{
32
+ id: 'Name'
33
+ }, {
34
+ id: 'Email',
35
+ cellActions: [function (_ref) {
36
+ var rowIndex = _ref.rowIndex,
37
+ columnId = _ref.columnId,
38
+ Component = _ref.Component;
39
+ var row = ++rowIndex;
40
+ return (0, _react2.jsx)(Component, {
41
+ onClick: function onClick() {},
42
+ iconType: "heart",
43
+ "aria-label": "Send love to ".concat(row, ", column \"").concat(columnId, "\" ")
44
+ }, "Send love");
45
+ }]
46
+ }, {
47
+ id: 'User ID',
48
+ schema: 'string'
49
+ }, {
50
+ id: 'Account balance'
51
+ }, {
52
+ id: 'Last purchase',
53
+ schema: 'datetime'
54
+ }, {
55
+ id: 'Favorite distro',
56
+ schema: 'favoriteDistro'
57
+ }];
58
+ var storeData = [];
59
+
60
+ for (var i = 1; i < 11; i++) {
61
+ storeData.push({
62
+ Name: "".concat(_faker.faker.name.lastName(), ", ").concat(_faker.faker.name.firstName(), " ").concat(_faker.faker.name.suffix()),
63
+ Email: "".concat(_faker.faker.internet.email()),
64
+ 'User ID': "".concat(_faker.faker.datatype.number({
65
+ min: 1000000,
66
+ max: 9999999
67
+ })),
68
+ 'Account balance': _faker.faker.finance.amount(),
69
+ 'Last purchase': "".concat(_faker.faker.date.past()),
70
+ 'Favorite distro': i % 2 === 0 ? 'Alma' : 'Debian'
71
+ });
72
+ }
73
+
74
+ var commaSeparateNumbers = function commaSeparateNumbers(numberString) {
75
+ // extract the groups-of-three digits that are right-aligned
76
+ return numberString.replace(/((\d{3})+)$/, function (match) {
77
+ return (// then replace each group of xyz digits with ,xyz
78
+ match.replace(/(\d{3})/g, ',$1')
79
+ );
80
+ });
81
+ };
82
+
83
+ var DataGrid = function DataGrid() {
84
+ var _useState = (0, _react.useState)(columns.map(function (_ref2) {
85
+ var id = _ref2.id;
86
+ return id;
87
+ })),
88
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
89
+ visibleColumns = _useState2[0],
90
+ setVisibleColumns = _useState2[1];
91
+
92
+ var _useState3 = (0, _react.useState)(storeData),
93
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
94
+ data = _useState4[0],
95
+ setData = _useState4[1];
96
+
97
+ var _useState5 = (0, _react.useState)([{
98
+ id: 'custom',
99
+ direction: 'asc'
100
+ }]),
101
+ _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
102
+ sortingColumns = _useState6[0],
103
+ setSortingColumns = _useState6[1];
104
+
105
+ var setSorting = function setSorting(sortingColumns) {
106
+ var sortedData = (0, _toConsumableArray2.default)(data).sort(function (a, b) {
107
+ for (var _i = 0; _i < sortingColumns.length; _i++) {
108
+ var column = sortingColumns[_i];
109
+ var aValue = a[column.id];
110
+ var bValue = b[column.id];
111
+ if (aValue < bValue) return column.direction === 'asc' ? -1 : 1;
112
+ if (aValue > bValue) return column.direction === 'asc' ? 1 : -1;
113
+ }
114
+
115
+ return 0;
116
+ });
117
+ setData(sortedData);
118
+ setSortingColumns(sortingColumns);
119
+ };
120
+
121
+ return (0, _react2.jsx)(_index.EuiDataGrid, {
122
+ "aria-label": "Data grid schema example",
123
+ columns: columns,
124
+ columnVisibility: {
125
+ visibleColumns: visibleColumns,
126
+ setVisibleColumns: setVisibleColumns
127
+ },
128
+ rowCount: data.length,
129
+ inMemory: {
130
+ level: 'sorting'
131
+ },
132
+ renderCellValue: function renderCellValue(_ref3) {
133
+ var rowIndex = _ref3.rowIndex,
134
+ columnId = _ref3.columnId,
135
+ schema = _ref3.schema;
136
+ var value = data[rowIndex][columnId];
137
+
138
+ if (schema === 'numeric') {
139
+ value = commaSeparateNumbers(value);
140
+ }
141
+
142
+ return value;
143
+ },
144
+ sorting: {
145
+ columns: sortingColumns,
146
+ onSort: setSorting
147
+ },
148
+ schemaDetectors: [{
149
+ type: 'favoriteDistro',
150
+ textTransform: 'capitalize',
151
+ detector: function detector(value) {
152
+ return value.toLowerCase() === 'alma' || value.toLowerCase() === 'debian' ? 1 : 0;
153
+ },
154
+ comparator: function comparator(a, b, direction) {
155
+ var aValue = a.toLowerCase() === 'alma';
156
+ var bValue = b.toLowerCase() === 'alma';
157
+ if (aValue < bValue) return direction === 'asc' ? 1 : -1;
158
+ if (aValue > bValue) return direction === 'asc' ? -1 : 1;
159
+ return 0;
160
+ },
161
+ sortTextAsc: 'Alma to Debian',
162
+ sortTextDesc: 'Debian to Alma',
163
+ icon: 'starFilled',
164
+ color: '#800080'
165
+ }]
166
+ });
167
+ };
168
+
169
+ beforeEach(function () {
170
+ cy.viewport(1280, 800); // large breakpoint
171
+
172
+ cy.mount((0, _react2.jsx)("div", {
173
+ style: {
174
+ width: '80%',
175
+ margin: '0 auto'
176
+ }
177
+ }, (0, _react2.jsx)(DataGrid, null)));
178
+ });
179
+ describe('EuiDataGrid', function () {
180
+ describe('Automated accessibility check', function () {
181
+ it('has zero violations on first render', function () {
182
+ cy.checkAxe();
183
+ });
184
+ it('has zero violations when the columns reorder menu is open', function () {
185
+ cy.get('button[data-test-subj="dataGridColumnSelectorButton"]').realClick();
186
+ cy.checkAxe();
187
+ });
188
+ it('has zero violations when the hide all columns button is clicked', function () {
189
+ cy.get('button[data-test-subj="dataGridColumnSelectorButton"]').realClick();
190
+ cy.get('button[data-test-subj="dataGridColumnSelectorHideAllButton"]').realClick(); // TODO: Log this issue and remove the skipFailures boolean when fixed
191
+
192
+ cy.checkAxe({
193
+ skipFailures: true
194
+ });
195
+ });
196
+ it('has zero violations when the columns reorder searchbox returns multiple results', function () {
197
+ cy.get('button[data-test-subj="dataGridColumnSelectorButton"]').realClick();
198
+ cy.get('input[data-test-subj="dataGridColumnSelectorSearch"]').type('a');
199
+ cy.get('div.euiSwitch--compressed').should(function ($s) {
200
+ expect($s).to.have.length(5);
201
+ });
202
+ cy.checkAxe();
203
+ });
204
+ it('has zero violations when the columns reorder searchbox returns 1 result', function () {
205
+ cy.get('button[data-test-subj="dataGridColumnSelectorButton"]').realClick();
206
+ cy.get('input[data-test-subj="dataGridColumnSelectorSearch"]').type('favorite');
207
+ cy.get('div.euiSwitch--compressed').should(function ($s) {
208
+ expect($s).to.have.length(1);
209
+ });
210
+ cy.checkAxe();
211
+ });
212
+ it('has zero violations when the columns reorder searchbox returns 0 results', function () {
213
+ cy.get('button[data-test-subj="dataGridColumnSelectorButton"]').realClick();
214
+ cy.get('input[data-test-subj="dataGridColumnSelectorSearch"]').type('x');
215
+ cy.get('div.euiSwitch--compressed').should(function ($s) {
216
+ expect($s).to.have.length(0);
217
+ });
218
+ cy.checkAxe();
219
+ });
220
+ it('has zero violations when the keyboard shortcut menu is open', function () {
221
+ cy.get('button[data-test-subj="dataGridKeyboardShortcutsButton"]').realClick();
222
+ cy.checkAxe();
223
+ });
224
+ it('has zero violations when the grid display menu is open', function () {
225
+ cy.get('button[data-test-subj="dataGridDisplaySelectorButton"]').realClick();
226
+ cy.checkAxe();
227
+ });
228
+ it('has zero violations when the column actions menu is open', function () {
229
+ cy.get('button.euiDataGridHeaderCell__button').first().realClick();
230
+ cy.checkAxe();
231
+ });
232
+ it('has zero violations when a cell expansion popover is open', function () {
233
+ cy.get('div[data-gridcell-visible-row-index="0"][data-gridcell-column-index="1"]').realClick();
234
+ cy.get('div[data-gridcell-visible-row-index="0"][data-gridcell-column-index="1"]').find('button.euiButtonIcon').last().realClick();
235
+ cy.checkAxe();
236
+ });
237
+ it('has zero violations when the Favorite Distro column has been sorted', function () {
238
+ cy.get('button.euiDataGridHeaderCell__button').last().realClick();
239
+ cy.get('button.euiListGroupItem__button').contains('Sort Alma to Debian').should('exist').realClick();
240
+ cy.checkAxe();
241
+ });
242
+ it('has zero violations when fullscreen is open', function () {
243
+ cy.get('button[data-test-subj="dataGridFullScreenButton"]').realClick();
244
+ cy.get('div.euiDataGrid--fullScreen').should('exist');
245
+ cy.checkAxe();
246
+ });
247
+ });
248
+ });
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
7
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
8
+
9
+ var _react = _interopRequireWildcard(require("react"));
10
+
11
+ var _moment = _interopRequireDefault(require("moment"));
12
+
13
+ var _date_picker = require("./date_picker");
14
+
15
+ var _form = require("../form");
16
+
17
+ var _react2 = require("@emotion/react");
18
+
19
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
20
+
21
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
22
+
23
+ /*
24
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
25
+ * or more contributor license agreements. Licensed under the Elastic License
26
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
27
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
28
+ * Side Public License, v 1.
29
+ */
30
+ /// <reference types="../../../cypress/support"/>
31
+ var DatePicker = function DatePicker() {
32
+ var _useState = (0, _react.useState)((0, _moment.default)()),
33
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
34
+ startDate = _useState2[0],
35
+ setStartDate = _useState2[1];
36
+
37
+ var handleChange = function handleChange(date) {
38
+ setStartDate(date);
39
+ };
40
+
41
+ return (0, _react2.jsx)(_form.EuiFormRow, {
42
+ label: "Select a date"
43
+ }, (0, _react2.jsx)(_date_picker.EuiDatePicker, {
44
+ selected: startDate,
45
+ onChange: handleChange
46
+ }));
47
+ };
48
+
49
+ beforeEach(function () {
50
+ cy.realMount((0, _react2.jsx)(DatePicker, null));
51
+ cy.get('input.euiDatePicker').should('exist');
52
+ });
53
+ describe('EuiDatePicker', function () {
54
+ describe('Automated accessibility check', function () {
55
+ it('has zero violations on first render', function () {
56
+ cy.checkAxe();
57
+ });
58
+ it('has zero violations when the calendar widget is expanded', function () {
59
+ cy.get('input.euiDatePicker').realClick();
60
+ cy.get('div.react-datepicker').should('exist');
61
+ cy.checkAxe();
62
+ });
63
+ it('has zero violations after picking a date with arrow keys', function () {
64
+ cy.realPress('Tab');
65
+ cy.get('div.react-datepicker').should('exist');
66
+ cy.repeatRealPress('ArrowDown');
67
+ cy.realPress('ArrowRight');
68
+ cy.realPress('Enter');
69
+ cy.get('div.react-datepicker').should('not.exist');
70
+ cy.checkAxe();
71
+ });
72
+ it('has zero violations after picking a date with dropdown menus', function () {
73
+ cy.realPress('Tab');
74
+ cy.get('div.react-datepicker').should('exist');
75
+ cy.repeatRealPress('Tab', 4);
76
+ cy.get('div.react-datepicker__month-read-view').should('have.focus');
77
+ cy.realPress('Space');
78
+ cy.repeatRealPress('ArrowDown');
79
+ cy.realPress('Enter');
80
+ cy.realPress('Tab');
81
+ cy.realPress('Space');
82
+ cy.repeatRealPress('ArrowDown');
83
+ cy.realPress('Enter');
84
+ cy.checkAxe();
85
+ });
86
+ });
87
+ });
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
7
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
8
+
9
+ var _react = _interopRequireWildcard(require("react"));
10
+
11
+ var _delay_hide = require("./delay_hide");
12
+
13
+ var _form = require("../form");
14
+
15
+ var _flex = require("../flex");
16
+
17
+ var _loading = require("../loading");
18
+
19
+ var _react2 = require("@emotion/react");
20
+
21
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
22
+
23
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
24
+
25
+ /*
26
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
27
+ * or more contributor license agreements. Licensed under the Elastic License
28
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
29
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
30
+ * Side Public License, v 1.
31
+ */
32
+ /// <reference types="../../../cypress/support"/>
33
+ var DelayHide = function DelayHide() {
34
+ var _useState = (0, _react.useState)(1000),
35
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
36
+ minimumDuration = _useState2[0],
37
+ setDuration = _useState2[1];
38
+
39
+ var _useState3 = (0, _react.useState)(false),
40
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
41
+ hide = _useState4[0],
42
+ setHide = _useState4[1];
43
+
44
+ var onChangeMinimumDuration = function onChangeMinimumDuration(event) {
45
+ setDuration(parseInt(event.target.value, 10));
46
+ };
47
+
48
+ var onChangeHide = function onChangeHide(event) {
49
+ setHide(event.target.checked);
50
+ };
51
+
52
+ return (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(_flex.EuiFlexItem, null, (0, _react2.jsx)(_form.EuiFormRow, null, (0, _react2.jsx)(_form.EuiCheckbox, {
53
+ id: "dummy-id",
54
+ checked: hide,
55
+ onChange: onChangeHide,
56
+ label: "Hide child"
57
+ })), (0, _react2.jsx)(_form.EuiFormRow, {
58
+ label: "Minimum duration"
59
+ }, (0, _react2.jsx)(_form.EuiFieldNumber, {
60
+ value: minimumDuration,
61
+ onChange: onChangeMinimumDuration
62
+ })), (0, _react2.jsx)(_form.EuiFormRow, {
63
+ label: "Child to render"
64
+ }, (0, _react2.jsx)(_delay_hide.EuiDelayHide, {
65
+ hide: hide,
66
+ minimumDuration: minimumDuration,
67
+ render: function render() {
68
+ return (0, _react2.jsx)(_loading.EuiLoadingSpinner, {
69
+ size: "m"
70
+ });
71
+ }
72
+ }))));
73
+ };
74
+
75
+ beforeEach(function () {
76
+ cy.realMount((0, _react2.jsx)(DelayHide, null));
77
+ });
78
+ describe('EuiHideRender', function () {
79
+ describe('Automated accessibility check', function () {
80
+ it('has zero violations on first render', function () {
81
+ cy.checkAxe();
82
+ });
83
+ it('has zero violations when the hide child input is checked', function () {
84
+ cy.get('input.euiCheckbox__input').realClick();
85
+ cy.get('div.euiFormRow__fieldWrapper').last().find('span[role="progressbar"]', {
86
+ timeout: 5000
87
+ }).should('not.exist');
88
+ cy.checkAxe();
89
+ });
90
+ it('has zero violations when the hide child input is pressed', function () {
91
+ cy.realPress('Tab');
92
+ cy.get('input.euiCheckbox__input').should('have.focus');
93
+ cy.realPress('Space');
94
+ cy.get('div.euiFormRow__fieldWrapper').last().find('span[role="progressbar"]', {
95
+ timeout: 5000
96
+ }).should('not.exist');
97
+ cy.checkAxe();
98
+ });
99
+ it('has zero violations when the hide child input is toggled', function () {
100
+ cy.realPress('Tab');
101
+ cy.get('input.euiCheckbox__input').should('have.focus');
102
+ cy.realPress('Space');
103
+ cy.get('div.euiFormRow__fieldWrapper').last().find('span[role="progressbar"]').should('not.exist');
104
+ cy.realPress('Space');
105
+ cy.get('div.euiFormRow__fieldWrapper').last().find('span[role="progressbar"]', {
106
+ timeout: 5000
107
+ }).should('exist');
108
+ cy.checkAxe();
109
+ });
110
+ });
111
+ });
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
7
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
8
+
9
+ var _react = _interopRequireWildcard(require("react"));
10
+
11
+ var _delay_render = require("./delay_render");
12
+
13
+ var _form = require("../form");
14
+
15
+ var _flex = require("../flex");
16
+
17
+ var _loading = require("../loading");
18
+
19
+ var _react2 = require("@emotion/react");
20
+
21
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
22
+
23
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
24
+
25
+ /*
26
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
27
+ * or more contributor license agreements. Licensed under the Elastic License
28
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
29
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
30
+ * Side Public License, v 1.
31
+ */
32
+ /// <reference types="../../../cypress/support"/>
33
+ var DelayRender = function DelayRender() {
34
+ var _useState = (0, _react.useState)(1000),
35
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
36
+ minimumDelay = _useState2[0],
37
+ setDelay = _useState2[1];
38
+
39
+ var _useState3 = (0, _react.useState)(false),
40
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
41
+ render = _useState4[0],
42
+ setRender = _useState4[1];
43
+
44
+ var onChangeMinimumDelay = function onChangeMinimumDelay(event) {
45
+ setDelay(parseInt(event.target.value, 10));
46
+ };
47
+
48
+ var onChangeHide = function onChangeHide(event) {
49
+ setRender(event.target.checked);
50
+ };
51
+
52
+ var status = render ? 'showing' : 'hidden';
53
+ var label = "Child (".concat(status, ")");
54
+ return (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(_flex.EuiFlexItem, null, (0, _react2.jsx)(_form.EuiFormRow, null, (0, _react2.jsx)(_form.EuiCheckbox, {
55
+ id: "dummy-id",
56
+ checked: render,
57
+ onChange: onChangeHide,
58
+ label: "Show child"
59
+ })), (0, _react2.jsx)(_form.EuiFormRow, {
60
+ label: "Minimum delay"
61
+ }, (0, _react2.jsx)(_form.EuiFieldNumber, {
62
+ value: minimumDelay,
63
+ onChange: onChangeMinimumDelay
64
+ })), (0, _react2.jsx)(_form.EuiFormRow, {
65
+ label: label
66
+ }, render ? (0, _react2.jsx)(_delay_render.EuiDelayRender, {
67
+ delay: minimumDelay
68
+ }, (0, _react2.jsx)(_loading.EuiLoadingSpinner, {
69
+ size: "m"
70
+ })) : (0, _react2.jsx)(_react.default.Fragment, null))));
71
+ };
72
+
73
+ beforeEach(function () {
74
+ cy.realMount((0, _react2.jsx)(DelayRender, null));
75
+ });
76
+ describe('EuiDelayRender', function () {
77
+ describe('Automated accessibility check', function () {
78
+ it('has zero violations on first render', function () {
79
+ cy.checkAxe();
80
+ });
81
+ it('has zero violations when the show child input is checked', function () {
82
+ cy.get('input.euiCheckbox__input').realClick();
83
+ cy.get('div.euiFormRow__fieldWrapper').last().find('span[role="progressbar"]', {
84
+ timeout: 5000
85
+ }).should('exist');
86
+ cy.checkAxe();
87
+ });
88
+ it('has zero violations when the show child input is pressed', function () {
89
+ cy.realPress('Tab');
90
+ cy.get('input.euiCheckbox__input').should('have.focus');
91
+ cy.realPress('Space');
92
+ cy.get('div.euiFormRow__fieldWrapper').last().find('span[role="progressbar"]', {
93
+ timeout: 5000
94
+ }).should('exist');
95
+ cy.checkAxe();
96
+ });
97
+ it('has zero violations when the show child input is toggled', function () {
98
+ cy.realPress('Tab');
99
+ cy.get('input.euiCheckbox__input').should('have.focus');
100
+ cy.realPress('Space');
101
+ cy.get('div.euiFormRow__fieldWrapper').last().find('span[role="progressbar"]', {
102
+ timeout: 5000
103
+ });
104
+ cy.realPress('Space');
105
+ cy.get('div.euiFormRow__fieldWrapper').last().find('span[role="progressbar"]', {
106
+ timeout: 5000
107
+ }).should('not.exist');
108
+ cy.checkAxe();
109
+ });
110
+ });
111
+ });
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _react = _interopRequireDefault(require("react"));
6
+
7
+ var _button = require("../button");
8
+
9
+ var _empty_prompt = require("./empty_prompt");
10
+
11
+ var _link = require("../link");
12
+
13
+ var _title = require("../title");
14
+
15
+ var _react2 = require("@emotion/react");
16
+
17
+ /*
18
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
19
+ * or more contributor license agreements. Licensed under the Elastic License
20
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
21
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
22
+ * Side Public License, v 1.
23
+ */
24
+ /// <reference types="../../../cypress/support"/>
25
+ var EmptyPrompt = function EmptyPrompt(_ref) {
26
+ var addCaseSpy = _ref.addCaseSpy,
27
+ addLinkSpy = _ref.addLinkSpy;
28
+ return (0, _react2.jsx)(_empty_prompt.EuiEmptyPrompt, {
29
+ iconType: "logoSecurity",
30
+ title: (0, _react2.jsx)("h2", null, "Start adding cases"),
31
+ body: (0, _react2.jsx)("p", null, "Add a new case or change your filter settings."),
32
+ actions: (0, _react2.jsx)(_button.EuiButton, {
33
+ color: "primary",
34
+ onClick: addCaseSpy,
35
+ fill: true
36
+ }, "Add a case"),
37
+ footer: (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(_title.EuiTitle, {
38
+ size: "xxs"
39
+ }, (0, _react2.jsx)("h3", null, "Want to learn more?")), (0, _react2.jsx)(_link.EuiLink, {
40
+ href: "#",
41
+ onClick: addLinkSpy
42
+ }, "Read the docs"))
43
+ });
44
+ };
45
+
46
+ beforeEach(function () {
47
+ var addCaseSpy = cy.spy().as('addCaseSpy');
48
+ var addLinkSpy = cy.spy().as('addLinkSpy');
49
+ cy.viewport(1024, 768); // medium breakpoint
50
+
51
+ cy.realMount((0, _react2.jsx)(EmptyPrompt, {
52
+ addCaseSpy: addCaseSpy,
53
+ addLinkSpy: addLinkSpy
54
+ }));
55
+ });
56
+ describe('EuiEmptyPrompt', function () {
57
+ describe('Automated accessibility check', function () {
58
+ it('has zero violations on first render', function () {
59
+ cy.checkAxe();
60
+ });
61
+ it('has zero violations after clicking Add a case button', function () {
62
+ cy.get('button.euiButton').contains('Add a case').realClick();
63
+ cy.get('@addCaseSpy').should('have.been.called');
64
+ cy.checkAxe();
65
+ });
66
+ it('has zero violations after clicking Read the docs link', function () {
67
+ cy.get('a.euiLink').contains('Read the docs').realClick();
68
+ cy.get('@addLinkSpy').should('have.been.called');
69
+ cy.checkAxe();
70
+ });
71
+ });
72
+ });