@elastic/eui 72.0.0 → 72.2.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 (149) hide show
  1. package/dist/eui_charts_theme.js +13 -1
  2. package/dist/eui_charts_theme.js.map +1 -1
  3. package/dist/eui_theme_dark.css +0 -151
  4. package/dist/eui_theme_dark.min.css +1 -1
  5. package/dist/eui_theme_light.css +0 -151
  6. package/dist/eui_theme_light.min.css +1 -1
  7. package/es/components/accordion/accordion.js +1 -1
  8. package/es/components/basic_table/basic_table.js +2 -2
  9. package/es/components/basic_table/in_memory_table.js +3 -6
  10. package/es/components/basic_table/table.a11y.js +128 -0
  11. package/es/components/color_picker/color_picker.styles.js +16 -0
  12. package/es/components/color_picker/color_stops/color_stop_thumb.js +19 -7
  13. package/es/components/color_picker/color_stops/color_stop_thumb.styles.js +59 -0
  14. package/es/components/color_picker/color_stops/color_stops.js +25 -15
  15. package/es/components/color_picker/color_stops/color_stops.styles.js +65 -0
  16. package/es/components/date_picker/super_date_picker/super_date_picker.js +9 -0
  17. package/es/components/date_picker/super_date_picker/super_update_button.js +8 -0
  18. package/es/components/form/range/range_highlight.styles.js +1 -1
  19. package/es/components/form/range/range_levels.styles.js +1 -1
  20. package/es/components/form/range/range_track.js +5 -2
  21. package/es/components/image/image.a11y.js +55 -0
  22. package/es/components/image/image.js +9 -2
  23. package/es/components/image/image_fullscreen_wrapper.js +3 -1
  24. package/es/components/image/image_wrapper.js +3 -1
  25. package/es/components/key_pad_menu/key_pad_menu.a11y.js +158 -0
  26. package/es/components/markdown_editor/markdown_format.styles.js +2 -5
  27. package/es/components/popover/popover.js +2 -2
  28. package/es/components/table/table_footer_cell.js +1 -1
  29. package/es/components/table/table_header_cell.js +1 -1
  30. package/es/components/table/table_row_cell.js +2 -2
  31. package/es/components/text/text.styles.js +6 -3
  32. package/es/components/tool_tip/icon_tip.js +8 -0
  33. package/es/components/tool_tip/tool_tip.js +24 -1
  34. package/es/components/tour/tour.styles.js +1 -1
  35. package/es/services/color/manipulation.js +9 -0
  36. package/es/services/index.js +11 -11
  37. package/eui.d.ts +166 -107
  38. package/i18ntokens.json +16 -16
  39. package/lib/components/accordion/accordion.js +1 -1
  40. package/lib/components/basic_table/basic_table.js +2 -2
  41. package/lib/components/basic_table/in_memory_table.js +3 -6
  42. package/lib/components/basic_table/table.a11y.js +139 -0
  43. package/lib/components/color_picker/color_picker.styles.js +26 -0
  44. package/lib/components/color_picker/color_stops/color_stop_thumb.js +19 -6
  45. package/lib/components/color_picker/color_stops/color_stop_thumb.styles.js +69 -0
  46. package/lib/components/color_picker/color_stops/color_stops.js +25 -14
  47. package/lib/components/color_picker/color_stops/color_stops.styles.js +73 -0
  48. package/lib/components/date_picker/super_date_picker/super_date_picker.js +9 -0
  49. package/lib/components/date_picker/super_date_picker/super_update_button.js +8 -0
  50. package/lib/components/form/range/range_highlight.styles.js +1 -1
  51. package/lib/components/form/range/range_levels.styles.js +1 -1
  52. package/lib/components/form/range/range_track.js +6 -2
  53. package/lib/components/image/image.a11y.js +61 -0
  54. package/lib/components/image/image.js +9 -2
  55. package/lib/components/image/image_fullscreen_wrapper.js +3 -1
  56. package/lib/components/image/image_wrapper.js +3 -1
  57. package/lib/components/key_pad_menu/key_pad_menu.a11y.js +163 -0
  58. package/lib/components/markdown_editor/markdown_format.styles.js +1 -4
  59. package/lib/components/popover/popover.js +2 -2
  60. package/lib/components/table/table_footer_cell.js +1 -1
  61. package/lib/components/table/table_header_cell.js +1 -1
  62. package/lib/components/table/table_row_cell.js +2 -2
  63. package/lib/components/text/text.styles.js +5 -2
  64. package/lib/components/tool_tip/icon_tip.js +8 -0
  65. package/lib/components/tool_tip/tool_tip.js +24 -1
  66. package/lib/components/tour/tour.styles.js +1 -1
  67. package/lib/services/color/manipulation.js +14 -2
  68. package/lib/services/index.js +65 -58
  69. package/optimize/es/components/accordion/accordion.js +1 -1
  70. package/optimize/es/components/basic_table/table.a11y.js +128 -0
  71. package/optimize/es/components/color_picker/color_picker.styles.js +16 -0
  72. package/optimize/es/components/color_picker/color_stops/color_stop_thumb.js +19 -7
  73. package/optimize/es/components/color_picker/color_stops/color_stop_thumb.styles.js +59 -0
  74. package/optimize/es/components/color_picker/color_stops/color_stops.js +25 -15
  75. package/optimize/es/components/color_picker/color_stops/color_stops.styles.js +65 -0
  76. package/optimize/es/components/form/range/range_highlight.styles.js +1 -1
  77. package/optimize/es/components/form/range/range_levels.styles.js +1 -1
  78. package/optimize/es/components/form/range/range_track.js +5 -2
  79. package/optimize/es/components/image/image.a11y.js +55 -0
  80. package/optimize/es/components/image/image.js +4 -2
  81. package/optimize/es/components/image/image_fullscreen_wrapper.js +3 -1
  82. package/optimize/es/components/image/image_wrapper.js +3 -1
  83. package/optimize/es/components/key_pad_menu/key_pad_menu.a11y.js +148 -0
  84. package/optimize/es/components/markdown_editor/markdown_format.styles.js +2 -5
  85. package/optimize/es/components/popover/popover.js +2 -2
  86. package/optimize/es/components/text/text.styles.js +6 -3
  87. package/optimize/es/components/tool_tip/tool_tip.js +16 -1
  88. package/optimize/es/components/tour/tour.styles.js +1 -1
  89. package/optimize/es/services/color/manipulation.js +9 -0
  90. package/optimize/es/services/index.js +11 -11
  91. package/optimize/lib/components/accordion/accordion.js +1 -1
  92. package/optimize/lib/components/basic_table/table.a11y.js +139 -0
  93. package/optimize/lib/components/color_picker/color_picker.styles.js +26 -0
  94. package/optimize/lib/components/color_picker/color_stops/color_stop_thumb.js +19 -6
  95. package/optimize/lib/components/color_picker/color_stops/color_stop_thumb.styles.js +69 -0
  96. package/optimize/lib/components/color_picker/color_stops/color_stops.js +25 -14
  97. package/optimize/lib/components/color_picker/color_stops/color_stops.styles.js +73 -0
  98. package/optimize/lib/components/form/range/range_highlight.styles.js +1 -1
  99. package/optimize/lib/components/form/range/range_levels.styles.js +1 -1
  100. package/optimize/lib/components/form/range/range_track.js +6 -2
  101. package/optimize/lib/components/image/image.a11y.js +61 -0
  102. package/optimize/lib/components/image/image.js +4 -2
  103. package/optimize/lib/components/image/image_fullscreen_wrapper.js +3 -1
  104. package/optimize/lib/components/image/image_wrapper.js +3 -1
  105. package/optimize/lib/components/key_pad_menu/key_pad_menu.a11y.js +163 -0
  106. package/optimize/lib/components/markdown_editor/markdown_format.styles.js +1 -4
  107. package/optimize/lib/components/popover/popover.js +2 -2
  108. package/optimize/lib/components/text/text.styles.js +5 -2
  109. package/optimize/lib/components/tool_tip/tool_tip.js +16 -1
  110. package/optimize/lib/components/tour/tour.styles.js +1 -1
  111. package/optimize/lib/services/color/manipulation.js +14 -2
  112. package/optimize/lib/services/index.js +65 -58
  113. package/package.json +2 -2
  114. package/src/components/color_picker/_index.scss +0 -1
  115. package/src/components/markdown_editor/_markdown_format.scss +0 -4
  116. package/src/themes/amsterdam/overrides/_index.scss +0 -1
  117. package/test-env/components/accordion/accordion.js +1 -1
  118. package/test-env/components/basic_table/basic_table.js +2 -2
  119. package/test-env/components/basic_table/in_memory_table.js +3 -6
  120. package/test-env/components/basic_table/table.a11y.js +139 -0
  121. package/test-env/components/color_picker/color_picker.styles.js +26 -0
  122. package/test-env/components/color_picker/color_stops/color_stop_thumb.js +19 -6
  123. package/test-env/components/color_picker/color_stops/color_stop_thumb.styles.js +69 -0
  124. package/test-env/components/color_picker/color_stops/color_stops.js +25 -14
  125. package/test-env/components/color_picker/color_stops/color_stops.styles.js +73 -0
  126. package/test-env/components/date_picker/super_date_picker/super_date_picker.js +9 -0
  127. package/test-env/components/date_picker/super_date_picker/super_update_button.js +8 -0
  128. package/test-env/components/form/range/range_highlight.styles.js +1 -1
  129. package/test-env/components/form/range/range_levels.styles.js +1 -1
  130. package/test-env/components/form/range/range_track.js +6 -2
  131. package/test-env/components/image/image.a11y.js +61 -0
  132. package/test-env/components/image/image.js +9 -2
  133. package/test-env/components/image/image_fullscreen_wrapper.js +3 -1
  134. package/test-env/components/image/image_wrapper.js +3 -1
  135. package/test-env/components/key_pad_menu/key_pad_menu.a11y.js +163 -0
  136. package/test-env/components/markdown_editor/markdown_format.styles.js +1 -4
  137. package/test-env/components/popover/popover.js +2 -2
  138. package/test-env/components/table/table_footer_cell.js +1 -1
  139. package/test-env/components/table/table_header_cell.js +1 -1
  140. package/test-env/components/table/table_row_cell.js +2 -2
  141. package/test-env/components/text/text.styles.js +5 -2
  142. package/test-env/components/tool_tip/icon_tip.js +8 -0
  143. package/test-env/components/tool_tip/tool_tip.js +24 -1
  144. package/test-env/components/tour/tour.styles.js +1 -1
  145. package/test-env/services/color/manipulation.js +14 -2
  146. package/test-env/services/index.js +65 -58
  147. package/src/components/color_picker/color_stops/_color_stops.scss +0 -101
  148. package/src/components/color_picker/color_stops/_index.scss +0 -1
  149. package/src/themes/amsterdam/overrides/_color_stops.scss +0 -58
@@ -12,83 +12,84 @@ var _exportNames = {
12
12
  comboBoxKeys: true,
13
13
  htmlIdGenerator: true,
14
14
  useGeneratedHtmlId: true,
15
+ CENTER_ALIGNMENT: true,
15
16
  LEFT_ALIGNMENT: true,
16
17
  RIGHT_ALIGNMENT: true,
17
- CENTER_ALIGNMENT: true,
18
- useIsWithinBreakpoints: true,
19
- useIsWithinMaxBreakpoint: true,
20
- useIsWithinMinBreakpoint: true,
21
18
  CurrentEuiBreakpointContext: true,
22
19
  CurrentEuiBreakpointProvider: true,
23
20
  useCurrentEuiBreakpoint: true,
24
- isColorDark: true,
25
- isValidHex: true,
21
+ useIsWithinBreakpoints: true,
22
+ useIsWithinMaxBreakpoint: true,
23
+ useIsWithinMinBreakpoint: true,
24
+ brighten: true,
26
25
  calculateContrast: true,
27
26
  calculateLuminance: true,
28
- hexToHsv: true,
29
- hexToRgb: true,
30
- hsvToHex: true,
31
- hsvToRgb: true,
32
- rgbToHex: true,
33
- rgbToHsv: true,
34
- VISUALIZATION_COLORS: true,
35
- DEFAULT_VISUALIZATION_COLOR: true,
36
27
  colorPalette: true,
37
- euiPaletteForLightBackground: true,
38
- euiPaletteForDarkBackground: true,
28
+ darken: true,
29
+ DEFAULT_VISUALIZATION_COLOR: true,
30
+ desaturate: true,
39
31
  euiPaletteColorBlind: true,
40
32
  euiPaletteColorBlindBehindText: true,
33
+ euiPaletteComplimentary: true,
34
+ euiPaletteCool: true,
35
+ euiPaletteForDarkBackground: true,
36
+ euiPaletteForLightBackground: true,
41
37
  euiPaletteForStatus: true,
42
38
  euiPaletteForTemperature: true,
43
- euiPaletteComplimentary: true,
39
+ euiPaletteGray: true,
44
40
  euiPaletteNegative: true,
45
41
  euiPalettePositive: true,
46
- euiPaletteCool: true,
47
42
  euiPaletteWarm: true,
48
- euiPaletteGray: true,
49
43
  getSteppedGradient: true,
50
- transparentize: true,
51
- tint: true,
52
- shade: true,
53
- tintOrShade: true,
54
- shadeOrTint: true,
55
- saturate: true,
56
- desaturate: true,
44
+ hexToHsv: true,
45
+ hexToRgb: true,
46
+ hsvToHex: true,
47
+ hsvToRgb: true,
48
+ isColorDark: true,
49
+ isValidHex: true,
57
50
  lightness: true,
58
- darken: true,
59
- makeHighContrastColor: true,
60
51
  makeDisabledContrastColor: true,
52
+ makeHighContrastColor: true,
53
+ rgbToHex: true,
54
+ rgbToHsv: true,
55
+ saturate: true,
56
+ shade: true,
57
+ shadeOrTint: true,
58
+ tint: true,
59
+ tintOrShade: true,
60
+ transparentize: true,
61
+ VISUALIZATION_COLORS: true,
61
62
  wcagContrastMin: true,
62
63
  useColorPickerState: true,
63
64
  useColorStopsState: true,
64
65
  copyToClipboard: true,
66
+ dateFormatAliases: true,
65
67
  formatAuto: true,
66
68
  formatBoolean: true,
67
69
  formatDate: true,
68
70
  formatNumber: true,
69
71
  formatText: true,
70
- dateFormatAliases: true,
71
72
  isEvenlyDivisibleBy: true,
72
73
  isWithinRange: true,
73
74
  Pager: true,
75
+ calculatePopoverPosition: true,
76
+ findPopoverPosition: true,
74
77
  Random: true,
75
78
  getSecureRelForTarget: true,
76
- toSentenceCase: true,
77
- toInitials: true,
78
- slugify: true,
79
+ Comparators: true,
79
80
  PropertySortType: true,
80
- SortDirectionType: true,
81
- SortDirection: true,
82
81
  SortableProperties: true,
83
- Comparators: true,
84
- calculatePopoverPosition: true,
85
- findPopoverPosition: true,
82
+ SortDirection: true,
83
+ SortDirectionType: true,
84
+ slugify: true,
85
+ toInitials: true,
86
+ toSentenceCase: true,
87
+ throttle: true,
86
88
  getDurationAndPerformOnFrame: true,
87
89
  getTransitionTimings: true,
88
90
  getWaitDuration: true,
89
91
  performOnFrame: true,
90
- EuiWindowEvent: true,
91
- throttle: true
92
+ EuiWindowEvent: true
92
93
  };
93
94
  Object.defineProperty(exports, "CENTER_ALIGNMENT", {
94
95
  enumerable: true,
@@ -186,6 +187,12 @@ Object.defineProperty(exports, "accessibleClickKeys", {
186
187
  return _accessibility.accessibleClickKeys;
187
188
  }
188
189
  });
190
+ Object.defineProperty(exports, "brighten", {
191
+ enumerable: true,
192
+ get: function get() {
193
+ return _color.brighten;
194
+ }
195
+ });
189
196
  Object.defineProperty(exports, "calculateContrast", {
190
197
  enumerable: true,
191
198
  get: function get() {
@@ -630,24 +637,6 @@ Object.keys(_findElement).forEach(function (key) {
630
637
 
631
638
  var _format = require("./format");
632
639
 
633
- var _number = require("./number");
634
-
635
- var _paging = require("./paging");
636
-
637
- var _random = require("./random");
638
-
639
- var _security = require("./security");
640
-
641
- var _string = require("./string");
642
-
643
- var _sort = require("./sort");
644
-
645
- var _popover = require("./popover");
646
-
647
- var _transition = require("./transition");
648
-
649
- var _window_event = require("./window_event");
650
-
651
640
  var _hooks = require("./hooks");
652
641
 
653
642
  Object.keys(_hooks).forEach(function (key) {
@@ -662,7 +651,19 @@ Object.keys(_hooks).forEach(function (key) {
662
651
  });
663
652
  });
664
653
 
665
- var _throttle = require("./throttle");
654
+ var _number = require("./number");
655
+
656
+ var _paging = require("./paging");
657
+
658
+ var _popover = require("./popover");
659
+
660
+ var _random = require("./random");
661
+
662
+ var _security = require("./security");
663
+
664
+ var _sort = require("./sort");
665
+
666
+ var _string = require("./string");
666
667
 
667
668
  var _theme = require("./theme");
668
669
 
@@ -678,6 +679,12 @@ Object.keys(_theme).forEach(function (key) {
678
679
  });
679
680
  });
680
681
 
682
+ var _throttle = require("./throttle");
683
+
684
+ var _transition = require("./transition");
685
+
686
+ var _window_event = require("./window_event");
687
+
681
688
  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); }
682
689
 
683
690
  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; }
@@ -221,7 +221,7 @@ export var EuiAccordionClass = /*#__PURE__*/function (_Component) {
221
221
  css: cssSpinnerStyles
222
222
  }), ___EmotionJSX(EuiText, {
223
223
  size: "s"
224
- }, ___EmotionJSX("p", null, isLoadingMessage && isLoadingMessage !== true ? isLoadingMessage : ___EmotionJSX(EuiI18n, {
224
+ }, ___EmotionJSX("p", null, isLoadingMessage !== true ? isLoadingMessage : ___EmotionJSX(EuiI18n, {
225
225
  token: "euiAccordion.isLoading",
226
226
  default: "Loading"
227
227
  }))));
@@ -0,0 +1,128 @@
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 { EuiInMemoryTable } from './in_memory_table';
11
+ import { EuiHealth } from '../health';
12
+ import { EuiLink } from '../link';
13
+ import { formatDate } from '../../services';
14
+ import { createDataStore } from '../../../src-docs/src/views/tables/data_store';
15
+ import { jsx as ___EmotionJSX } from "@emotion/react";
16
+ var store = createDataStore();
17
+
18
+ var InMemoryTable = function InMemoryTable() {
19
+ var columns = [{
20
+ field: 'firstName',
21
+ name: 'First Name',
22
+ sortable: true,
23
+ truncateText: true
24
+ }, {
25
+ field: 'lastName',
26
+ name: 'Last Name',
27
+ truncateText: true
28
+ }, {
29
+ field: 'github',
30
+ name: 'Github',
31
+ render: function render(username) {
32
+ return ___EmotionJSX(EuiLink, {
33
+ href: "https://github.com/".concat(username),
34
+ target: "_blank"
35
+ }, username);
36
+ }
37
+ }, {
38
+ field: 'dateOfBirth',
39
+ name: 'Date of Birth',
40
+ dataType: 'date',
41
+ render: function render(date) {
42
+ return formatDate(date, 'dobLong');
43
+ },
44
+ sortable: true
45
+ }, {
46
+ field: 'nationality',
47
+ name: 'Nationality',
48
+ render: function render(countryCode) {
49
+ var country = store.getCountry(countryCode);
50
+ return "".concat(country.flag, " ").concat(country.name);
51
+ }
52
+ }, {
53
+ field: 'online',
54
+ name: 'Online',
55
+ dataType: 'boolean',
56
+ render: function render(online) {
57
+ var color = online ? 'success' : 'danger';
58
+ var label = online ? 'Online' : 'Offline';
59
+ return ___EmotionJSX(EuiHealth, {
60
+ color: color
61
+ }, label);
62
+ },
63
+ sortable: true
64
+ }];
65
+ var sorting = {
66
+ sort: {
67
+ field: 'dateOfBirth',
68
+ direction: 'desc'
69
+ }
70
+ };
71
+ return ___EmotionJSX(EuiInMemoryTable, {
72
+ "data-test-subj": "cy-in-memory-table",
73
+ tableCaption: "Demo of EuiInMemoryTable",
74
+ items: store.users,
75
+ columns: columns,
76
+ pagination: true,
77
+ sorting: sorting
78
+ });
79
+ };
80
+
81
+ beforeEach(function () {
82
+ cy.viewport(1024, 768); // medium breakpoint
83
+
84
+ cy.realMount(___EmotionJSX(InMemoryTable, null));
85
+ cy.get('div[data-test-subj="cy-in-memory-table"]').should('exist');
86
+ });
87
+ describe('EuiInMemoryTable', function () {
88
+ describe('Automated accessibility check', function () {
89
+ it('has zero violations on first render', function () {
90
+ cy.checkAxe();
91
+ });
92
+ it('has zero violations on pagination click', function () {
93
+ cy.get('a[data-test-subj="pagination-button-1"]').realClick();
94
+ cy.get('button[data-test-subj="pagination-button-1"]').should('be.disabled');
95
+ cy.checkAxe();
96
+ });
97
+ it('has zero violations after number of rows is increased', function () {
98
+ cy.get('button[data-test-subj="tablePaginationPopoverButton"]').realClick();
99
+ cy.get('div[data-popover-open="true"]').should('exist');
100
+ cy.get('button[data-test-subj="tablePagination-25-rows"]').realClick();
101
+ cy.get('table.euiTable').find('tr.euiTableRow').should('have.length', 20);
102
+ cy.checkAxe();
103
+ });
104
+ it('has zero violations after sorting on a column', function () {
105
+ cy.realPress('Tab');
106
+ cy.get('button[data-test-subj="tableHeaderSortButton"]').first().should('have.focus');
107
+ cy.realPress('Enter');
108
+ cy.get('tbody tr.euiTableRow span.euiTableCellContent__text').first().contains('Another very long first name which will wrap or be truncated');
109
+ });
110
+ it('has zero violations when number of rows is increased by keyboard', function () {
111
+ cy.repeatRealPress('Tab', 14);
112
+ cy.get('button[data-test-subj="tablePaginationPopoverButton"]').should('have.focus').realPress('Space');
113
+ cy.get('div[data-popover-open="true"]').should('exist');
114
+ cy.get('div[data-popover-open="true"]').should('have.focus');
115
+ cy.repeatRealPress('Tab'); // Switched to Tab from ArrowDown because of flaky test runs
116
+
117
+ cy.get('button[data-test-subj="tablePagination-25-rows"]').realPress('Space');
118
+ cy.get('table.euiTable').find('tr.euiTableRow').should('have.length', 20);
119
+ cy.checkAxe();
120
+ });
121
+ it('has zero violations when pagination is pressed', function () {
122
+ cy.repeatRealPress('Tab', 15);
123
+ cy.get('a[data-test-subj="pagination-button-1"]').should('have.focus').realPress('Enter');
124
+ cy.get('button[data-test-subj="pagination-button-1"]').should('be.disabled');
125
+ cy.checkAxe();
126
+ });
127
+ });
128
+ });
@@ -0,0 +1,16 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
5
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
6
+ * Side Public License, v 1.
7
+ */
8
+ import { mathWithUnits } from '../../global_styling';
9
+ export var euiColorPickerVariables = function euiColorPickerVariables(euiThemeContext) {
10
+ var euiTheme = euiThemeContext.euiTheme;
11
+ return {
12
+ width: mathWithUnits([euiTheme.size.l, euiTheme.size.s], function (x, y) {
13
+ return x * 5 + y * 4;
14
+ })
15
+ };
16
+ };
@@ -19,7 +19,7 @@ import React, { useEffect, useMemo, useRef, useState } from 'react';
19
19
  import classNames from 'classnames';
20
20
  import { getPositionFromStop, getStopFromMouseLocation, isColorInvalid, isStopInvalid } from './utils';
21
21
  import { getChromaColor } from '../utils';
22
- import { keys, useMouseMove } from '../../../services';
22
+ import { keys, useMouseMove, useEuiTheme } from '../../../services';
23
23
  import { EuiButtonIcon } from '../../button';
24
24
  import { EuiColorPicker } from '../color_picker';
25
25
  import { EuiFlexGroup, EuiFlexItem } from '../../flex';
@@ -29,6 +29,7 @@ import { EuiPopover } from '../../popover';
29
29
  import { EuiScreenReaderOnly } from '../../accessibility';
30
30
  import { EuiSpacer } from '../../spacer';
31
31
  import { EuiRangeThumb } from '../../form/range/range_thumb';
32
+ import { euiColorStopThumbStyles, euiColorStopThumbPopoverStyles, euiColorStopStyles } from './color_stop_thumb.styles';
32
33
  import { jsx as ___EmotionJSX } from "@emotion/react";
33
34
  export var EuiColorStopThumb = function EuiColorStopThumb(_ref) {
34
35
  var className = _ref.className,
@@ -236,13 +237,20 @@ export var EuiColorStopThumb = function EuiColorStopThumb(_ref) {
236
237
  }
237
238
  };
238
239
 
239
- var classes = classNames('euiColorStopPopover', {
240
- 'euiColorStopPopover-hasFocus': hasFocus || isPopoverOpen
241
- }, className);
242
- return ___EmotionJSX(EuiPopover, _extends({}, rest, {
240
+ var euiTheme = useEuiTheme();
241
+ var popoverStyles = euiColorStopThumbPopoverStyles(euiTheme);
242
+ var cssPopoverStyles = [popoverStyles.euiColorStopThumbPopover, (hasFocus || isPopoverOpen) && popoverStyles.hasFocus];
243
+ var thumbStyles = euiColorStopThumbStyles(euiTheme);
244
+ var cssThumbStyles = [thumbStyles.euiColorStopThumb, isPopoverOpen && thumbStyles.isPopoverOpen];
245
+ var colorStopStyles = euiColorStopStyles(euiTheme);
246
+ var cssColorStopStyles = colorStopStyles.euiColorStop;
247
+ var classes = classNames('euiColorStopPopover', className);
248
+ return ___EmotionJSX(EuiPopover, _extends({
249
+ css: cssPopoverStyles
250
+ }, rest, {
243
251
  ref: popoverRef,
244
252
  className: classes,
245
- anchorClassName: "euiColorStopPopover__anchor",
253
+ anchorClassName: "euiColorStopThumbPopover__anchor",
246
254
  panelPaddingSize: "s",
247
255
  isOpen: isPopoverOpen,
248
256
  closePopover: closePopover,
@@ -250,7 +258,9 @@ export var EuiColorStopThumb = function EuiColorStopThumb(_ref) {
250
258
  focusTrapProps: {
251
259
  clickOutsideDisables: false
252
260
  },
253
- panelClassName: numberInputRef ? undefined : 'euiColorStopPopover-isLoadingPanel',
261
+ panelProps: {
262
+ css: numberInputRef ? undefined : popoverStyles.isLoadingPanel
263
+ },
254
264
  style: _objectSpread(_objectSpread({}, style), {}, {
255
265
  left: "".concat(getPositionFromStopFn(stop), "%")
256
266
  }),
@@ -282,6 +292,7 @@ export var EuiColorStopThumb = function EuiColorStopThumb(_ref) {
282
292
  "aria-label": ariaLabel,
283
293
  title: title,
284
294
  className: "euiColorStopThumb",
295
+ css: cssThumbStyles,
285
296
  tabIndex: -1,
286
297
  style: {
287
298
  background: background
@@ -291,6 +302,7 @@ export var EuiColorStopThumb = function EuiColorStopThumb(_ref) {
291
302
  })
292
303
  }), ___EmotionJSX("div", {
293
304
  className: "euiColorStop",
305
+ css: cssColorStopStyles,
294
306
  "data-test-subj": "euiColorStopPopover"
295
307
  }, ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("p", {
296
308
  "aria-live": "polite"
@@ -0,0 +1,59 @@
1
+ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
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
+ import { css } from '@emotion/react';
11
+ import { mathWithUnits } from '../../../global_styling';
12
+ import { euiRangeVariables, euiRangeThumbFocus } from '../../form/range/range.styles';
13
+ import { euiColorPickerVariables } from '../color_picker.styles';
14
+
15
+ var _ref2 = process.env.NODE_ENV === "production" ? {
16
+ name: "zrzkfg-euiColorStopThumb",
17
+ styles: "&:not(:disabled){inset-block-start:0;margin-block-start:0;pointer-events:auto;cursor:grab;&:active{cursor:grabbing;}};label:euiColorStopThumb;"
18
+ } : {
19
+ name: "zrzkfg-euiColorStopThumb",
20
+ styles: "&:not(:disabled){inset-block-start:0;margin-block-start:0;pointer-events:auto;cursor:grab;&:active{cursor:grabbing;}};label:euiColorStopThumb;",
21
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
22
+ };
23
+
24
+ export var euiColorStopThumbStyles = function euiColorStopThumbStyles(euiThemeContext) {
25
+ return {
26
+ // Base
27
+ euiColorStopThumb: _ref2,
28
+ isPopoverOpen: /*#__PURE__*/css(euiRangeThumbFocus(euiThemeContext), ";;label:isPopoverOpen;")
29
+ };
30
+ };
31
+
32
+ var _ref = process.env.NODE_ENV === "production" ? {
33
+ name: "1wndm4s-isLoadingPanel",
34
+ styles: "visibility:hidden!important;label:isLoadingPanel;"
35
+ } : {
36
+ name: "1wndm4s-isLoadingPanel",
37
+ styles: "visibility:hidden!important;label:isLoadingPanel;",
38
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
39
+ };
40
+
41
+ export var euiColorStopThumbPopoverStyles = function euiColorStopThumbPopoverStyles(euiThemeContext) {
42
+ var range = euiRangeVariables(euiThemeContext);
43
+ var euiTheme = euiThemeContext.euiTheme;
44
+ return {
45
+ // Base
46
+ euiColorStopThumbPopover: /*#__PURE__*/css("position:absolute;inset-block-start:50%;inline-size:", range.thumbWidth, ";block-size:", range.thumbHeight, ";margin-block-start:", mathWithUnits(range.thumbHeight, function (x) {
47
+ return x * -0.5;
48
+ }), ";.euiColorStopThumbPopover__anchor{position:absolute;inline-size:100%;block-size:100%;&::before{content:'';display:block;position:absolute;inset-inline-start:0;inset-block-start:0;block-size:", range.thumbHeight, ";inline-size:", range.thumbWidth, ";border-radius:", range.thumbHeight, ";background:", euiTheme.colors.emptyShade, ";}};label:euiColorStopThumbPopover;"),
49
+ isLoadingPanel: _ref,
50
+ hasFocus: /*#__PURE__*/css("z-index:", range.thumbZIndex, ";;label:hasFocus;")
51
+ };
52
+ };
53
+ export var euiColorStopStyles = function euiColorStopStyles(euiThemeContext) {
54
+ var colorPicker = euiColorPickerVariables(euiThemeContext);
55
+ return {
56
+ // Base
57
+ euiColorStop: /*#__PURE__*/css("inline-size:", colorPicker.width, ";;label:euiColorStop;")
58
+ };
59
+ };
@@ -18,7 +18,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
18
18
  */
19
19
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
20
20
  import classNames from 'classnames';
21
- import { keys, DEFAULT_VISUALIZATION_COLOR, getSteppedGradient } from '../../../services';
21
+ import { keys, DEFAULT_VISUALIZATION_COLOR, getSteppedGradient, useEuiTheme } from '../../../services';
22
22
  import { EuiColorStopThumb } from './color_stop_thumb';
23
23
  import { addStop, addDefinedStop, getPositionFromStop, getStopFromMouseLocation, isInvalid, removeStop } from './utils';
24
24
  import { getChromaColor } from '../utils';
@@ -27,6 +27,7 @@ import { EuiScreenReaderOnly } from '../../accessibility';
27
27
  import { EuiRangeHighlight } from '../../form/range/range_highlight';
28
28
  import { EuiRangeTrack } from '../../form/range/range_track';
29
29
  import { EuiRangeWrapper } from '../../form/range/range_wrapper';
30
+ import { euiColorStopsStyles, euiColorStopsAddContainerStyles } from './color_stops.styles';
30
31
  import { jsx as ___EmotionJSX } from "@emotion/react";
31
32
  // Because of how the thumbs are rendered in the popover, using ref results in an infinite loop.
32
33
  // We'll instead use old fashioned namespaced DOM selectors to get references
@@ -165,11 +166,16 @@ export var EuiColorStops = function EuiColorStops(_ref) {
165
166
  setFocusStopOnUpdate = _useState14[1];
166
167
 
167
168
  var isNotInteractive = disabled || readOnly;
168
- var classes = classNames('euiColorStops', {
169
- 'euiColorStops-isDragging': isHoverDisabled,
170
- 'euiColorStops-isDisabled': disabled,
171
- 'euiColorStops-isReadOnly': readOnly
172
- }, className);
169
+ var isDragging = isHoverDisabled && !isNotInteractive;
170
+ var addContainerIsDisabled = isHoverDisabled || isNotInteractive;
171
+ var classes = classNames('euiColorStops', className);
172
+ var euiTheme = useEuiTheme();
173
+ var styles = euiColorStopsStyles(euiTheme);
174
+ var cssPopoverStyles = [styles.euiColorStops, !disabled ? styles.isEnabled : styles.isDisabled, readOnly && styles.isReadOnly, isDragging && styles.isDragging];
175
+ var cssTrackStyles = [styles.euiColorStops__track];
176
+ var cssAddTargetStyles = [styles.euiColorStops__addTarget];
177
+ var addContainerStyles = euiColorStopsAddContainerStyles(euiTheme);
178
+ var cssAddContainerStyles = [addContainerStyles.euiColorStopsAddContainer, !addContainerIsDisabled ? addContainerStyles.isEnabled : addContainerStyles.isDisabled];
173
179
 
174
180
  var getStopFromMouseLocationFn = function getStopFromMouseLocationFn(location) {
175
181
  // Guard against `null` ref in usage
@@ -370,7 +376,7 @@ export var EuiColorStops = function EuiColorStops(_ref) {
370
376
  disabled: disabled,
371
377
  readOnly: readOnly,
372
378
  "aria-valuetext": "Stop: ".concat(colorStop.stop, ", Color: ").concat(colorStop.color, " (").concat(index + 1, " of ").concat(colorStops.length, ")"),
373
- isPopoverOpen: colorStop.id === openedStopId,
379
+ isPopoverOpen: !isDragging && colorStop.id === openedStopId,
374
380
  openPopover: function openPopover() {
375
381
  setOpenedStopId(colorStop.id);
376
382
  },
@@ -380,7 +386,7 @@ export var EuiColorStops = function EuiColorStops(_ref) {
380
386
  valueInputProps: valueInputProps
381
387
  });
382
388
  });
383
- }, [colorStops, disabled, handleOnChange, max, min, mode, onRemove, openedStopId, rangeMax, rangeMin, readOnly, showAlpha, sortedStops, swatches, wrapperRef, valueInputProps]);
389
+ }, [colorStops, disabled, handleOnChange, isDragging, max, min, mode, onRemove, openedStopId, rangeMax, rangeMin, readOnly, showAlpha, sortedStops, swatches, wrapperRef, valueInputProps]);
384
390
  var positions = wrapperRef ? sortedStops.map(function (_ref3) {
385
391
  var stop = _ref3.stop;
386
392
  return getPositionFromStopFn(stop);
@@ -388,10 +394,10 @@ export var EuiColorStops = function EuiColorStops(_ref) {
388
394
 
389
395
  var gradientStop = function gradientStop(colorStop, index) {
390
396
  var color = getChromaColor(colorStop.color, showAlpha);
391
- var rgba = color ? color.css() : 'currentColor';
397
+ var rgba = color ? color.css() : 'transparent';
392
398
 
393
399
  if (index === 0) {
394
- return "currentColor, currentColor ".concat(positions[index], "%, ").concat(rgba, " ").concat(positions[index], "%");
400
+ return "transparent, transparent ".concat(positions[index], "%, ").concat(rgba, " ").concat(positions[index], "%");
395
401
  }
396
402
 
397
403
  return "".concat(rgba, " ").concat(positions[index], "%");
@@ -419,13 +425,15 @@ export var EuiColorStops = function EuiColorStops(_ref) {
419
425
  percentageSteps = percentageSteps + percentage;
420
426
  });
421
427
  steppedGradient = steppedGradient.substring(0, steppedGradient.length - 2);
422
- gradient = "linear-gradient(to right, currentColor ".concat(trailingPercentage, "%, ").concat(steppedGradient, ")");
428
+ gradient = "linear-gradient(to right, transparent ".concat(trailingPercentage, "%, ").concat(steppedGradient, ")");
423
429
  } else {
424
430
  var linearGradient = sortedStops.map(stopType === 'gradient' ? gradientStop : fixedStop);
425
431
  gradient = "linear-gradient(to right,".concat(linearGradient, ")");
426
432
  }
427
433
 
428
- return ___EmotionJSX(EuiRangeWrapper, _extends({}, rest, {
434
+ return ___EmotionJSX(EuiRangeWrapper, _extends({
435
+ css: cssPopoverStyles
436
+ }, rest, {
429
437
  "data-test-subj": classNames('euiColorStops', rest['data-test-subj']),
430
438
  ref: setWrapperRef,
431
439
  className: classes,
@@ -448,6 +456,8 @@ export var EuiColorStops = function EuiColorStops(_ref) {
448
456
  token: "euiColorStops.screenReaderAnnouncement",
449
457
  default: "{label}: {readOnly} {disabled} Color stop picker. Each stop consists of a number and corresponding color value. Use the Down and Up arrow keys to select individual stops. Press the Enter key to create a new stop."
450
458
  }))), ___EmotionJSX(EuiRangeTrack, {
459
+ className: "euiColorStops__track",
460
+ css: cssTrackStyles,
451
461
  min: min || rangeMin,
452
462
  max: max || rangeMax,
453
463
  compressed: compressed,
@@ -464,13 +474,13 @@ export var EuiColorStops = function EuiColorStops(_ref) {
464
474
  trackWidth: trackWidth
465
475
  }), ___EmotionJSX("div", {
466
476
  "data-test-subj": "euiColorStopsAdd",
467
- className: classNames('euiColorStops__addContainer', {
468
- 'euiColorStops__addContainer-isDisabled': isHoverDisabled || disabled || readOnly
469
- }),
477
+ className: "euiColorStops__addContainer",
478
+ css: cssAddContainerStyles,
470
479
  onClick: handleAddClick,
471
480
  onMouseMove: handleAddHover
472
481
  }, ___EmotionJSX("div", {
473
482
  className: "euiColorStops__addTarget",
483
+ css: cssAddTargetStyles,
474
484
  style: {
475
485
  left: "".concat(addTargetPosition, "%")
476
486
  }
@@ -0,0 +1,65 @@
1
+ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
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
+ import { css } from '@emotion/react';
11
+ import { darken, brighten, hexToRgb } from '../../../services';
12
+ import { mathWithUnits, euiCanAnimate } from '../../../global_styling';
13
+ import { euiCustomControl } from '../../form/form.styles';
14
+ import { euiRangeThumbStyle, euiRangeVariables } from '../../form/range/range.styles';
15
+
16
+ var _ref2 = process.env.NODE_ENV === "production" ? {
17
+ name: "uu65b3-isDragging",
18
+ styles: "cursor:grabbing;label:isDragging;"
19
+ } : {
20
+ name: "uu65b3-isDragging",
21
+ styles: "cursor:grabbing;label:isDragging;",
22
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
23
+ };
24
+
25
+ export var euiColorStopsStyles = function euiColorStopsStyles(euiThemeContext) {
26
+ var range = euiRangeVariables(euiThemeContext);
27
+ var euiTheme = euiThemeContext.euiTheme,
28
+ colorMode = euiThemeContext.colorMode;
29
+ var isDarkMode = colorMode === 'DARK';
30
+ var stripeColor = isDarkMode ? brighten(range.trackColor, 0.5) : darken(range.trackColor, 0.5);
31
+ var stripesBackground = "repeating-linear-gradient(\n -45deg,\n ".concat(range.trackColor, ",\n ").concat(range.trackColor, " 25%,\n ").concat(stripeColor, " 25%,\n ").concat(stripeColor, " 50%,\n ").concat(range.trackColor, " 50%\n )");
32
+ return {
33
+ // Base
34
+ euiColorStops: /*#__PURE__*/css(";label:euiColorStops;"),
35
+ isEnabled: /*#__PURE__*/css("&:focus{outline:none;}&:focus-visible{.euiColorStops__track::after{box-shadow:0 0 0 1px rgba(", hexToRgb(euiTheme.colors.emptyShade).join(', '), ", 0.8),0 0 0 3px ", range.focusColor, ";}};label:isEnabled;"),
36
+ isDisabled: /*#__PURE__*/css(";label:isDisabled;"),
37
+ isHoverDisabled: /*#__PURE__*/css(";label:isHoverDisabled;"),
38
+ isReadOnly: /*#__PURE__*/css(";label:isReadOnly;"),
39
+ isDragging: _ref2,
40
+ euiColorStops__track: /*#__PURE__*/css("&::after{background:", stripesBackground, ";background-size:", euiTheme.size.xs, " ", euiTheme.size.xs, ";};label:euiColorStops__track;"),
41
+ euiColorStops__addTarget: /*#__PURE__*/css(euiCustomControl(euiThemeContext, {
42
+ type: 'round'
43
+ }), ";", euiRangeThumbStyle(euiThemeContext), ";position:absolute;inset-block-start:0;block-size:", range.thumbHeight, ";inline-size:", range.thumbHeight, ";background-color:", euiTheme.colors.lightestShade, ";pointer-events:none;opacity:0;border:", euiTheme.border.width.thin, " solid ", euiTheme.colors.darkShade, ";box-shadow:none;z-index:", range.thumbZIndex, ";", euiCanAnimate, "{transition:opacity ", euiTheme.animation.fast, " ease-in;};label:euiColorStops__addTarget;")
44
+ };
45
+ };
46
+
47
+ var _ref = process.env.NODE_ENV === "production" ? {
48
+ name: "1173em8-isEnabled",
49
+ styles: "&:hover{cursor:pointer;.euiColorStops__addTarget{opacity:0.7;}};label:isEnabled;"
50
+ } : {
51
+ name: "1173em8-isEnabled",
52
+ styles: "&:hover{cursor:pointer;.euiColorStops__addTarget{opacity:0.7;}};label:isEnabled;",
53
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
54
+ };
55
+
56
+ export var euiColorStopsAddContainerStyles = function euiColorStopsAddContainerStyles(euiThemeContext) {
57
+ var range = euiRangeVariables(euiThemeContext);
58
+ return {
59
+ euiColorStopsAddContainer: /*#__PURE__*/css("display:block;position:absolute;inset-inline-start:0;inset-inline-end:0;inset-block-start:50%;block-size:", range.thumbHeight, ";margin-block-start:", mathWithUnits(range.thumbHeight, function (x) {
60
+ return x * -0.5;
61
+ }), ";z-index:", range.thumbZIndex, ";;label:euiColorStopsAddContainer;"),
62
+ isEnabled: _ref,
63
+ isDisabled: /*#__PURE__*/css(";label:isDisabled;")
64
+ };
65
+ };