@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
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+
3
+ var _react = _interopRequireDefault(require("react"));
4
+
5
+ var _in_memory_table = require("./in_memory_table");
6
+
7
+ var _health = require("../health");
8
+
9
+ var _link = require("../link");
10
+
11
+ var _services = require("../../services");
12
+
13
+ var _data_store = require("../../../src-docs/src/views/tables/data_store");
14
+
15
+ var _react2 = require("@emotion/react");
16
+
17
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
+
19
+ /*
20
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
21
+ * or more contributor license agreements. Licensed under the Elastic License
22
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
23
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
24
+ * Side Public License, v 1.
25
+ */
26
+ /// <reference types="../../../cypress/support"/>
27
+ var store = (0, _data_store.createDataStore)();
28
+
29
+ var InMemoryTable = function InMemoryTable() {
30
+ var columns = [{
31
+ field: 'firstName',
32
+ name: 'First Name',
33
+ sortable: true,
34
+ truncateText: true
35
+ }, {
36
+ field: 'lastName',
37
+ name: 'Last Name',
38
+ truncateText: true
39
+ }, {
40
+ field: 'github',
41
+ name: 'Github',
42
+ render: function render(username) {
43
+ return (0, _react2.jsx)(_link.EuiLink, {
44
+ href: "https://github.com/".concat(username),
45
+ target: "_blank"
46
+ }, username);
47
+ }
48
+ }, {
49
+ field: 'dateOfBirth',
50
+ name: 'Date of Birth',
51
+ dataType: 'date',
52
+ render: function render(date) {
53
+ return (0, _services.formatDate)(date, 'dobLong');
54
+ },
55
+ sortable: true
56
+ }, {
57
+ field: 'nationality',
58
+ name: 'Nationality',
59
+ render: function render(countryCode) {
60
+ var country = store.getCountry(countryCode);
61
+ return "".concat(country.flag, " ").concat(country.name);
62
+ }
63
+ }, {
64
+ field: 'online',
65
+ name: 'Online',
66
+ dataType: 'boolean',
67
+ render: function render(online) {
68
+ var color = online ? 'success' : 'danger';
69
+ var label = online ? 'Online' : 'Offline';
70
+ return (0, _react2.jsx)(_health.EuiHealth, {
71
+ color: color
72
+ }, label);
73
+ },
74
+ sortable: true
75
+ }];
76
+ var sorting = {
77
+ sort: {
78
+ field: 'dateOfBirth',
79
+ direction: 'desc'
80
+ }
81
+ };
82
+ return (0, _react2.jsx)(_in_memory_table.EuiInMemoryTable, {
83
+ "data-test-subj": "cy-in-memory-table",
84
+ tableCaption: "Demo of EuiInMemoryTable",
85
+ items: store.users,
86
+ columns: columns,
87
+ pagination: true,
88
+ sorting: sorting
89
+ });
90
+ };
91
+
92
+ beforeEach(function () {
93
+ cy.viewport(1024, 768); // medium breakpoint
94
+
95
+ cy.realMount((0, _react2.jsx)(InMemoryTable, null));
96
+ cy.get('div[data-test-subj="cy-in-memory-table"]').should('exist');
97
+ });
98
+ describe('EuiInMemoryTable', function () {
99
+ describe('Automated accessibility check', function () {
100
+ it('has zero violations on first render', function () {
101
+ cy.checkAxe();
102
+ });
103
+ it('has zero violations on pagination click', function () {
104
+ cy.get('a[data-test-subj="pagination-button-1"]').realClick();
105
+ cy.get('button[data-test-subj="pagination-button-1"]').should('be.disabled');
106
+ cy.checkAxe();
107
+ });
108
+ it('has zero violations after number of rows is increased', function () {
109
+ cy.get('button[data-test-subj="tablePaginationPopoverButton"]').realClick();
110
+ cy.get('div[data-popover-open="true"]').should('exist');
111
+ cy.get('button[data-test-subj="tablePagination-25-rows"]').realClick();
112
+ cy.get('table.euiTable').find('tr.euiTableRow').should('have.length', 20);
113
+ cy.checkAxe();
114
+ });
115
+ it('has zero violations after sorting on a column', function () {
116
+ cy.realPress('Tab');
117
+ cy.get('button[data-test-subj="tableHeaderSortButton"]').first().should('have.focus');
118
+ cy.realPress('Enter');
119
+ cy.get('tbody tr.euiTableRow span.euiTableCellContent__text').first().contains('Another very long first name which will wrap or be truncated');
120
+ });
121
+ it('has zero violations when number of rows is increased by keyboard', function () {
122
+ cy.repeatRealPress('Tab', 14);
123
+ cy.get('button[data-test-subj="tablePaginationPopoverButton"]').should('have.focus').realPress('Space');
124
+ cy.get('div[data-popover-open="true"]').should('exist');
125
+ cy.get('div[data-popover-open="true"]').should('have.focus');
126
+ cy.repeatRealPress('Tab'); // Switched to Tab from ArrowDown because of flaky test runs
127
+
128
+ cy.get('button[data-test-subj="tablePagination-25-rows"]').realPress('Space');
129
+ cy.get('table.euiTable').find('tr.euiTableRow').should('have.length', 20);
130
+ cy.checkAxe();
131
+ });
132
+ it('has zero violations when pagination is pressed', function () {
133
+ cy.repeatRealPress('Tab', 15);
134
+ cy.get('a[data-test-subj="pagination-button-1"]').should('have.focus').realPress('Enter');
135
+ cy.get('button[data-test-subj="pagination-button-1"]').should('be.disabled');
136
+ cy.checkAxe();
137
+ });
138
+ });
139
+ });
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.euiColorPickerVariables = void 0;
7
+
8
+ var _global_styling = require("../../global_styling");
9
+
10
+ /*
11
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
12
+ * or more contributor license agreements. Licensed under the Elastic License
13
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
14
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
15
+ * Side Public License, v 1.
16
+ */
17
+ var euiColorPickerVariables = function euiColorPickerVariables(euiThemeContext) {
18
+ var euiTheme = euiThemeContext.euiTheme;
19
+ return {
20
+ width: (0, _global_styling.mathWithUnits)([euiTheme.size.l, euiTheme.size.s], function (x, y) {
21
+ return x * 5 + y * 4;
22
+ })
23
+ };
24
+ };
25
+
26
+ exports.euiColorPickerVariables = euiColorPickerVariables;
@@ -37,6 +37,8 @@ var _spacer = require("../../spacer");
37
37
 
38
38
  var _range_thumb = require("../../form/range/range_thumb");
39
39
 
40
+ var _color_stop_thumb = require("./color_stop_thumb.styles");
41
+
40
42
  var _react2 = require("@emotion/react");
41
43
 
42
44
  var _excluded = ["className", "stop", "color", "onChange", "onFocus", "onRemove", "globalMin", "globalMax", "localMin", "localMax", "min", "max", "isRangeMin", "isRangeMax", "parentRef", "colorPickerMode", "colorPickerShowAlpha", "colorPickerSwatches", "disabled", "readOnly", "isPopoverOpen", "openPopover", "closePopover", "data-index", "aria-valuetext", "style", "valueInputProps"];
@@ -277,13 +279,20 @@ var EuiColorStopThumb = function EuiColorStopThumb(_ref) {
277
279
  }
278
280
  };
279
281
 
280
- var classes = (0, _classnames.default)('euiColorStopPopover', {
281
- 'euiColorStopPopover-hasFocus': hasFocus || isPopoverOpen
282
- }, className);
283
- return (0, _react2.jsx)(_popover.EuiPopover, _extends({}, rest, {
282
+ var euiTheme = (0, _services.useEuiTheme)();
283
+ var popoverStyles = (0, _color_stop_thumb.euiColorStopThumbPopoverStyles)(euiTheme);
284
+ var cssPopoverStyles = [popoverStyles.euiColorStopThumbPopover, (hasFocus || isPopoverOpen) && popoverStyles.hasFocus];
285
+ var thumbStyles = (0, _color_stop_thumb.euiColorStopThumbStyles)(euiTheme);
286
+ var cssThumbStyles = [thumbStyles.euiColorStopThumb, isPopoverOpen && thumbStyles.isPopoverOpen];
287
+ var colorStopStyles = (0, _color_stop_thumb.euiColorStopStyles)(euiTheme);
288
+ var cssColorStopStyles = colorStopStyles.euiColorStop;
289
+ var classes = (0, _classnames.default)('euiColorStopPopover', className);
290
+ return (0, _react2.jsx)(_popover.EuiPopover, _extends({
291
+ css: cssPopoverStyles
292
+ }, rest, {
284
293
  ref: popoverRef,
285
294
  className: classes,
286
- anchorClassName: "euiColorStopPopover__anchor",
295
+ anchorClassName: "euiColorStopThumbPopover__anchor",
287
296
  panelPaddingSize: "s",
288
297
  isOpen: isPopoverOpen,
289
298
  closePopover: closePopover,
@@ -291,7 +300,9 @@ var EuiColorStopThumb = function EuiColorStopThumb(_ref) {
291
300
  focusTrapProps: {
292
301
  clickOutsideDisables: false
293
302
  },
294
- panelClassName: numberInputRef ? undefined : 'euiColorStopPopover-isLoadingPanel',
303
+ panelProps: {
304
+ css: numberInputRef ? undefined : popoverStyles.isLoadingPanel
305
+ },
295
306
  style: _objectSpread(_objectSpread({}, style), {}, {
296
307
  left: "".concat(getPositionFromStopFn(stop), "%")
297
308
  }),
@@ -323,6 +334,7 @@ var EuiColorStopThumb = function EuiColorStopThumb(_ref) {
323
334
  "aria-label": ariaLabel,
324
335
  title: title,
325
336
  className: "euiColorStopThumb",
337
+ css: cssThumbStyles,
326
338
  tabIndex: -1,
327
339
  style: {
328
340
  background: background
@@ -332,6 +344,7 @@ var EuiColorStopThumb = function EuiColorStopThumb(_ref) {
332
344
  })
333
345
  }), (0, _react2.jsx)("div", {
334
346
  className: "euiColorStop",
347
+ css: cssColorStopStyles,
335
348
  "data-test-subj": "euiColorStopPopover"
336
349
  }, (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("p", {
337
350
  "aria-live": "polite"
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.euiColorStopThumbStyles = exports.euiColorStopThumbPopoverStyles = exports.euiColorStopStyles = void 0;
7
+
8
+ var _react = require("@emotion/react");
9
+
10
+ var _global_styling = require("../../../global_styling");
11
+
12
+ var _range = require("../../form/range/range.styles");
13
+
14
+ var _color_picker = require("../color_picker.styles");
15
+
16
+ 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)."; }
17
+
18
+ var _ref2 = process.env.NODE_ENV === "production" ? {
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
+ } : {
22
+ name: "zrzkfg-euiColorStopThumb",
23
+ styles: "&:not(:disabled){inset-block-start:0;margin-block-start:0;pointer-events:auto;cursor:grab;&:active{cursor:grabbing;}};label:euiColorStopThumb;",
24
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
25
+ };
26
+
27
+ var euiColorStopThumbStyles = function euiColorStopThumbStyles(euiThemeContext) {
28
+ return {
29
+ // Base
30
+ euiColorStopThumb: _ref2,
31
+ isPopoverOpen: /*#__PURE__*/(0, _react.css)((0, _range.euiRangeThumbFocus)(euiThemeContext), ";;label:isPopoverOpen;")
32
+ };
33
+ };
34
+
35
+ exports.euiColorStopThumbStyles = euiColorStopThumbStyles;
36
+
37
+ var _ref = process.env.NODE_ENV === "production" ? {
38
+ name: "1wndm4s-isLoadingPanel",
39
+ styles: "visibility:hidden!important;label:isLoadingPanel;"
40
+ } : {
41
+ name: "1wndm4s-isLoadingPanel",
42
+ styles: "visibility:hidden!important;label:isLoadingPanel;",
43
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
44
+ };
45
+
46
+ var euiColorStopThumbPopoverStyles = function euiColorStopThumbPopoverStyles(euiThemeContext) {
47
+ var range = (0, _range.euiRangeVariables)(euiThemeContext);
48
+ var euiTheme = euiThemeContext.euiTheme;
49
+ return {
50
+ // Base
51
+ euiColorStopThumbPopover: /*#__PURE__*/(0, _react.css)("position:absolute;inset-block-start:50%;inline-size:", range.thumbWidth, ";block-size:", range.thumbHeight, ";margin-block-start:", (0, _global_styling.mathWithUnits)(range.thumbHeight, function (x) {
52
+ return x * -0.5;
53
+ }), ";.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;"),
54
+ isLoadingPanel: _ref,
55
+ hasFocus: /*#__PURE__*/(0, _react.css)("z-index:", range.thumbZIndex, ";;label:hasFocus;")
56
+ };
57
+ };
58
+
59
+ exports.euiColorStopThumbPopoverStyles = euiColorStopThumbPopoverStyles;
60
+
61
+ var euiColorStopStyles = function euiColorStopStyles(euiThemeContext) {
62
+ var colorPicker = (0, _color_picker.euiColorPickerVariables)(euiThemeContext);
63
+ return {
64
+ // Base
65
+ euiColorStop: /*#__PURE__*/(0, _react.css)("inline-size:", colorPicker.width, ";;label:euiColorStop;")
66
+ };
67
+ };
68
+
69
+ exports.euiColorStopStyles = euiColorStopStyles;
@@ -31,6 +31,8 @@ var _range_track = require("../../form/range/range_track");
31
31
 
32
32
  var _range_wrapper = require("../../form/range/range_wrapper");
33
33
 
34
+ var _color_stops = require("./color_stops.styles");
35
+
34
36
  var _react2 = require("@emotion/react");
35
37
 
36
38
  var _excluded = ["addColor", "max", "min", "mode", "colorStops", "onChange", "disabled", "readOnly", "compressed", "fullWidth", "className", "label", "stopType", "stepNumber", "swatches", "showAlpha", "valueInputProps"];
@@ -210,11 +212,16 @@ var EuiColorStops = function EuiColorStops(_ref) {
210
212
  setFocusStopOnUpdate = _useState14[1];
211
213
 
212
214
  var isNotInteractive = disabled || readOnly;
213
- var classes = (0, _classnames.default)('euiColorStops', {
214
- 'euiColorStops-isDragging': isHoverDisabled,
215
- 'euiColorStops-isDisabled': disabled,
216
- 'euiColorStops-isReadOnly': readOnly
217
- }, className);
215
+ var isDragging = isHoverDisabled && !isNotInteractive;
216
+ var addContainerIsDisabled = isHoverDisabled || isNotInteractive;
217
+ var classes = (0, _classnames.default)('euiColorStops', className);
218
+ var euiTheme = (0, _services.useEuiTheme)();
219
+ var styles = (0, _color_stops.euiColorStopsStyles)(euiTheme);
220
+ var cssPopoverStyles = [styles.euiColorStops, !disabled ? styles.isEnabled : styles.isDisabled, readOnly && styles.isReadOnly, isDragging && styles.isDragging];
221
+ var cssTrackStyles = [styles.euiColorStops__track];
222
+ var cssAddTargetStyles = [styles.euiColorStops__addTarget];
223
+ var addContainerStyles = (0, _color_stops.euiColorStopsAddContainerStyles)(euiTheme);
224
+ var cssAddContainerStyles = [addContainerStyles.euiColorStopsAddContainer, !addContainerIsDisabled ? addContainerStyles.isEnabled : addContainerStyles.isDisabled];
218
225
 
219
226
  var getStopFromMouseLocationFn = function getStopFromMouseLocationFn(location) {
220
227
  // Guard against `null` ref in usage
@@ -415,7 +422,7 @@ var EuiColorStops = function EuiColorStops(_ref) {
415
422
  disabled: disabled,
416
423
  readOnly: readOnly,
417
424
  "aria-valuetext": "Stop: ".concat(colorStop.stop, ", Color: ").concat(colorStop.color, " (").concat(index + 1, " of ").concat(colorStops.length, ")"),
418
- isPopoverOpen: colorStop.id === openedStopId,
425
+ isPopoverOpen: !isDragging && colorStop.id === openedStopId,
419
426
  openPopover: function openPopover() {
420
427
  setOpenedStopId(colorStop.id);
421
428
  },
@@ -425,7 +432,7 @@ var EuiColorStops = function EuiColorStops(_ref) {
425
432
  valueInputProps: valueInputProps
426
433
  });
427
434
  });
428
- }, [colorStops, disabled, handleOnChange, max, min, mode, onRemove, openedStopId, rangeMax, rangeMin, readOnly, showAlpha, sortedStops, swatches, wrapperRef, valueInputProps]);
435
+ }, [colorStops, disabled, handleOnChange, isDragging, max, min, mode, onRemove, openedStopId, rangeMax, rangeMin, readOnly, showAlpha, sortedStops, swatches, wrapperRef, valueInputProps]);
429
436
  var positions = wrapperRef ? sortedStops.map(function (_ref3) {
430
437
  var stop = _ref3.stop;
431
438
  return getPositionFromStopFn(stop);
@@ -433,10 +440,10 @@ var EuiColorStops = function EuiColorStops(_ref) {
433
440
 
434
441
  var gradientStop = function gradientStop(colorStop, index) {
435
442
  var color = (0, _utils2.getChromaColor)(colorStop.color, showAlpha);
436
- var rgba = color ? color.css() : 'currentColor';
443
+ var rgba = color ? color.css() : 'transparent';
437
444
 
438
445
  if (index === 0) {
439
- return "currentColor, currentColor ".concat(positions[index], "%, ").concat(rgba, " ").concat(positions[index], "%");
446
+ return "transparent, transparent ".concat(positions[index], "%, ").concat(rgba, " ").concat(positions[index], "%");
440
447
  }
441
448
 
442
449
  return "".concat(rgba, " ").concat(positions[index], "%");
@@ -464,13 +471,15 @@ var EuiColorStops = function EuiColorStops(_ref) {
464
471
  percentageSteps = percentageSteps + percentage;
465
472
  });
466
473
  steppedGradient = steppedGradient.substring(0, steppedGradient.length - 2);
467
- gradient = "linear-gradient(to right, currentColor ".concat(trailingPercentage, "%, ").concat(steppedGradient, ")");
474
+ gradient = "linear-gradient(to right, transparent ".concat(trailingPercentage, "%, ").concat(steppedGradient, ")");
468
475
  } else {
469
476
  var linearGradient = sortedStops.map(stopType === 'gradient' ? gradientStop : fixedStop);
470
477
  gradient = "linear-gradient(to right,".concat(linearGradient, ")");
471
478
  }
472
479
 
473
- return (0, _react2.jsx)(_range_wrapper.EuiRangeWrapper, _extends({}, rest, {
480
+ return (0, _react2.jsx)(_range_wrapper.EuiRangeWrapper, _extends({
481
+ css: cssPopoverStyles
482
+ }, rest, {
474
483
  "data-test-subj": (0, _classnames.default)('euiColorStops', rest['data-test-subj']),
475
484
  ref: setWrapperRef,
476
485
  className: classes,
@@ -493,6 +502,8 @@ var EuiColorStops = function EuiColorStops(_ref) {
493
502
  token: "euiColorStops.screenReaderAnnouncement",
494
503
  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."
495
504
  }))), (0, _react2.jsx)(_range_track.EuiRangeTrack, {
505
+ className: "euiColorStops__track",
506
+ css: cssTrackStyles,
496
507
  min: min || rangeMin,
497
508
  max: max || rangeMax,
498
509
  compressed: compressed,
@@ -509,13 +520,13 @@ var EuiColorStops = function EuiColorStops(_ref) {
509
520
  trackWidth: trackWidth
510
521
  }), (0, _react2.jsx)("div", {
511
522
  "data-test-subj": "euiColorStopsAdd",
512
- className: (0, _classnames.default)('euiColorStops__addContainer', {
513
- 'euiColorStops__addContainer-isDisabled': isHoverDisabled || disabled || readOnly
514
- }),
523
+ className: "euiColorStops__addContainer",
524
+ css: cssAddContainerStyles,
515
525
  onClick: handleAddClick,
516
526
  onMouseMove: handleAddHover
517
527
  }, (0, _react2.jsx)("div", {
518
528
  className: "euiColorStops__addTarget",
529
+ css: cssAddTargetStyles,
519
530
  style: {
520
531
  left: "".concat(addTargetPosition, "%")
521
532
  }
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.euiColorStopsStyles = exports.euiColorStopsAddContainerStyles = void 0;
7
+
8
+ var _react = require("@emotion/react");
9
+
10
+ var _services = require("../../../services");
11
+
12
+ var _global_styling = require("../../../global_styling");
13
+
14
+ var _form = require("../../form/form.styles");
15
+
16
+ var _range = require("../../form/range/range.styles");
17
+
18
+ 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)."; }
19
+
20
+ var _ref2 = process.env.NODE_ENV === "production" ? {
21
+ name: "uu65b3-isDragging",
22
+ styles: "cursor:grabbing;label:isDragging;"
23
+ } : {
24
+ name: "uu65b3-isDragging",
25
+ styles: "cursor:grabbing;label:isDragging;",
26
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
27
+ };
28
+
29
+ var euiColorStopsStyles = function euiColorStopsStyles(euiThemeContext) {
30
+ var range = (0, _range.euiRangeVariables)(euiThemeContext);
31
+ var euiTheme = euiThemeContext.euiTheme,
32
+ colorMode = euiThemeContext.colorMode;
33
+ var isDarkMode = colorMode === 'DARK';
34
+ var stripeColor = isDarkMode ? (0, _services.brighten)(range.trackColor, 0.5) : (0, _services.darken)(range.trackColor, 0.5);
35
+ 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 )");
36
+ return {
37
+ // Base
38
+ euiColorStops: /*#__PURE__*/(0, _react.css)(";label:euiColorStops;"),
39
+ isEnabled: /*#__PURE__*/(0, _react.css)("&:focus{outline:none;}&:focus-visible{.euiColorStops__track::after{box-shadow:0 0 0 1px rgba(", (0, _services.hexToRgb)(euiTheme.colors.emptyShade).join(', '), ", 0.8),0 0 0 3px ", range.focusColor, ";}};label:isEnabled;"),
40
+ isDisabled: /*#__PURE__*/(0, _react.css)(";label:isDisabled;"),
41
+ isHoverDisabled: /*#__PURE__*/(0, _react.css)(";label:isHoverDisabled;"),
42
+ isReadOnly: /*#__PURE__*/(0, _react.css)(";label:isReadOnly;"),
43
+ isDragging: _ref2,
44
+ euiColorStops__track: /*#__PURE__*/(0, _react.css)("&::after{background:", stripesBackground, ";background-size:", euiTheme.size.xs, " ", euiTheme.size.xs, ";};label:euiColorStops__track;"),
45
+ euiColorStops__addTarget: /*#__PURE__*/(0, _react.css)((0, _form.euiCustomControl)(euiThemeContext, {
46
+ type: 'round'
47
+ }), ";", (0, _range.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, ";", _global_styling.euiCanAnimate, "{transition:opacity ", euiTheme.animation.fast, " ease-in;};label:euiColorStops__addTarget;")
48
+ };
49
+ };
50
+
51
+ exports.euiColorStopsStyles = euiColorStopsStyles;
52
+
53
+ var _ref = process.env.NODE_ENV === "production" ? {
54
+ name: "1173em8-isEnabled",
55
+ styles: "&:hover{cursor:pointer;.euiColorStops__addTarget{opacity:0.7;}};label:isEnabled;"
56
+ } : {
57
+ name: "1173em8-isEnabled",
58
+ styles: "&:hover{cursor:pointer;.euiColorStops__addTarget{opacity:0.7;}};label:isEnabled;",
59
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
60
+ };
61
+
62
+ var euiColorStopsAddContainerStyles = function euiColorStopsAddContainerStyles(euiThemeContext) {
63
+ var range = (0, _range.euiRangeVariables)(euiThemeContext);
64
+ return {
65
+ euiColorStopsAddContainer: /*#__PURE__*/(0, _react.css)("display:block;position:absolute;inset-inline-start:0;inset-inline-end:0;inset-block-start:50%;block-size:", range.thumbHeight, ";margin-block-start:", (0, _global_styling.mathWithUnits)(range.thumbHeight, function (x) {
66
+ return x * -0.5;
67
+ }), ";z-index:", range.thumbZIndex, ";;label:euiColorStopsAddContainer;"),
68
+ isEnabled: _ref,
69
+ isDisabled: /*#__PURE__*/(0, _react.css)(";label:isDisabled;")
70
+ };
71
+ };
72
+
73
+ exports.euiColorStopsAddContainerStyles = euiColorStopsAddContainerStyles;
@@ -717,6 +717,14 @@ EuiSuperDatePickerInternal.propTypes = {
717
717
  */
718
718
  position: _propTypes.default.oneOf(["top", "right", "bottom", "left"]).isRequired,
719
719
 
720
+ /**
721
+ * When `true`, the tooltip's position is re-calculated when the user
722
+ * scrolls. This supports having fixed-position tooltip anchors.
723
+ *
724
+ * When nesting an `EuiTooltip` in a scrollable container, `repositionOnScroll` should be `true`
725
+ */
726
+ repositionOnScroll: _propTypes.default.bool,
727
+
720
728
  /**
721
729
  * If supplied, called when mouse movement causes the tool tip to be
722
730
  * hidden.
@@ -888,6 +896,7 @@ EuiSuperDatePicker.propTypes = {
888
896
  title: _propTypes.default.node,
889
897
  id: _propTypes.default.string,
890
898
  position: _propTypes.default.oneOf(["top", "right", "bottom", "left"]).isRequired,
899
+ repositionOnScroll: _propTypes.default.bool,
891
900
  onMouseOut: _propTypes.default.func
892
901
  }),
893
902
  iconOnly: _propTypes.default.bool,
@@ -296,6 +296,14 @@ EuiSuperUpdateButton.propTypes = {
296
296
  */
297
297
  position: _propTypes.default.oneOf(["top", "right", "bottom", "left"]).isRequired,
298
298
 
299
+ /**
300
+ * When `true`, the tooltip's position is re-calculated when the user
301
+ * scrolls. This supports having fixed-position tooltip anchors.
302
+ *
303
+ * When nesting an `EuiTooltip` in a scrollable container, `repositionOnScroll` should be `true`
304
+ */
305
+ repositionOnScroll: _propTypes.default.bool,
306
+
299
307
  /**
300
308
  * If supplied, called when mouse movement causes the tool tip to be
301
309
  * hidden.
@@ -29,7 +29,7 @@ exports.euiRangeHighlightStyles = euiRangeHighlightStyles;
29
29
  var euiRangeHighlightProgressStyles = function euiRangeHighlightProgressStyles(euiThemeContext) {
30
30
  var range = (0, _range.euiRangeVariables)(euiThemeContext);
31
31
  return {
32
- euiRangeHighlight__progress: /*#__PURE__*/(0, _react.css)("block-size:", range.highlightHeight, ";border-radius:", range.trackBorderRadius, ";background-color:", range.highlightColor, ";border-color:", range.highlightColor, ";.euiRangeSlider:focus-visible~.euiRangeHighlight &,.euiRangeThumb:focus-visible~.euiRangeHighlight &,.euiRangeDraggable:focus~.euiRangeHighlight &{background-color:", range.focusColor, ";};label:euiRangeHighlight__progress;")
32
+ euiRangeHighlight__progress: /*#__PURE__*/(0, _react.css)("block-size:", range.highlightHeight, ";border-radius:", range.trackBorderRadius, ";background-color:", range.highlightColor, ";.euiRangeSlider:focus-visible~.euiRangeHighlight &,.euiRangeThumb:focus-visible~.euiRangeHighlight &,.euiRangeDraggable:focus~.euiRangeHighlight &{background-color:", range.focusColor, ";};label:euiRangeHighlight__progress;")
33
33
  };
34
34
  };
35
35
 
@@ -29,7 +29,7 @@ var euiRangeLevelsStyles = function euiRangeLevelsStyles(euiThemeContext) {
29
29
  var stripesBackground = "repeating-linear-gradient(\n -45deg,\n ".concat((0, _services.transparentize)(stripeColor, 0.5), ",\n ").concat((0, _services.transparentize)(stripeColor, 0.5), " 25%,\n ").concat((0, _services.transparentize)(stripeColor, 0.7), " 25%,\n ").concat((0, _services.transparentize)(stripeColor, 0.7), " 50%,\n ").concat((0, _services.transparentize)(stripeColor, 0.5), " 50%\n )");
30
30
  return {
31
31
  euiRangeLevels: /*#__PURE__*/(0, _react.css)("display:flex;justify-content:stretch;position:absolute;inset-inline:0;inset-block-start:", range.trackTopPositionWithoutTicks, ";z-index:", range.levelsZIndex, ";;label:euiRangeLevels;"),
32
- hasRange: /*#__PURE__*/(0, _react.css)("&::after{content:'';position:absolute;block-size:", range.trackHeight, ";inline-size:100%;background-image:", stripesBackground, ";background-size:", euiTheme.size.s, " ", euiTheme.size.s, ";border-radius:", range.trackBorderRadius, ";};label:hasRange;"),
32
+ hasRange: /*#__PURE__*/(0, _react.css)("&::after{content:'';position:absolute;block-size:", range.trackHeight, ";inline-size:100%;background-image:", stripesBackground, ";background-size:", euiTheme.size.xs, " ", euiTheme.size.xs, ";border-radius:", range.trackBorderRadius, ";};label:hasRange;"),
33
33
  hasTicks: /*#__PURE__*/(0, _react.css)("inset-block-start:", range.trackTopPositionWithTicks, ";;label:hasTicks;")
34
34
  };
35
35
  };
@@ -11,6 +11,8 @@ var _react = _interopRequireWildcard(require("react"));
11
11
 
12
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
13
 
14
+ var _classnames = _interopRequireDefault(require("classnames"));
15
+
14
16
  var _range = _interopRequireDefault(require("lodash/range"));
15
17
 
16
18
  var _services = require("../../../services");
@@ -23,7 +25,7 @@ var _range_track = require("./range_track.styles");
23
25
 
24
26
  var _react2 = require("@emotion/react");
25
27
 
26
- var _excluded = ["children", "disabled", "max", "min", "step", "showTicks", "tickInterval", "ticks", "levels", "onChange", "value", "compressed", "showRange"];
28
+ var _excluded = ["children", "disabled", "max", "min", "step", "showTicks", "tickInterval", "ticks", "levels", "onChange", "value", "compressed", "showRange", "className"];
27
29
 
28
30
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
31
 
@@ -63,6 +65,7 @@ var EuiRangeTrack = function EuiRangeTrack(_ref) {
63
65
  value = _ref.value,
64
66
  compressed = _ref.compressed,
65
67
  showRange = _ref.showRange,
68
+ className = _ref.className,
66
69
  rest = _objectWithoutProperties(_ref, _excluded);
67
70
 
68
71
  (0, _react.useEffect)(function () {
@@ -122,8 +125,9 @@ var EuiRangeTrack = function EuiRangeTrack(_ref) {
122
125
  trackWidth = _useState2[0],
123
126
  setTrackWidth = _useState2[1];
124
127
 
128
+ var classes = (0, _classnames.default)('euiRangeTrack', className);
125
129
  return (0, _react2.jsx)("div", _extends({
126
- className: "euiRangeTrack",
130
+ className: classes,
127
131
  css: cssStyles
128
132
  }, rest, {
129
133
  ref: function ref(node) {
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+
3
+ var _react = _interopRequireDefault(require("react"));
4
+
5
+ var _image = require("./image");
6
+
7
+ var _react2 = require("@emotion/react");
8
+
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+
11
+ /*
12
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
13
+ * or more contributor license agreements. Licensed under the Elastic License
14
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
15
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
16
+ * Side Public License, v 1.
17
+ */
18
+ /// <reference types="../../../cypress/support"/>
19
+ var Image = function Image() {
20
+ return (0, _react2.jsx)(_image.EuiImage, {
21
+ size: "m",
22
+ hasShadow: true,
23
+ allowFullScreen: true,
24
+ caption: "Albert Einstein, theoretical physicist",
25
+ alt: "" // Because this image is sufficiently described by its caption, there is no need to repeat it via alt text
26
+ ,
27
+ src: "https://upload.wikimedia.org/wikipedia/commons/d/d3/Albert_Einstein_Head.jpg"
28
+ });
29
+ };
30
+
31
+ beforeEach(function () {
32
+ cy.viewport(1024, 768); // medium breakpoint
33
+
34
+ cy.realMount((0, _react2.jsx)(Image, null));
35
+ cy.get('figure[aria-label="Albert Einstein, theoretical physicist"]').should('exist');
36
+ });
37
+ describe('EuiImage', function () {
38
+ describe('Automated accessibility check', function () {
39
+ it('has zero violations on first render', function () {
40
+ cy.checkAxe();
41
+ });
42
+ it('has zero violations on fullscreen render', function () {
43
+ cy.get('button[data-test-subj="activateFullScreenButton"]').realClick();
44
+ cy.get('button[data-test-subj="deactivateFullScreenButton"]').should('exist');
45
+ cy.checkAxe();
46
+ cy.get('div[data-test-subj="fullScreenOverlayMask"]').realClick();
47
+ cy.checkAxe();
48
+ });
49
+ it('has zero violations on keyboard interaction', function () {
50
+ cy.realPress('Tab');
51
+ cy.get('button[data-test-subj="activateFullScreenButton"]').should('have.focus');
52
+ cy.realPress('Enter');
53
+ cy.get('button[data-test-subj="deactivateFullScreenButton"]').should('exist');
54
+ cy.get('button[data-test-subj="deactivateFullScreenButton"]').should('have.focus');
55
+ cy.checkAxe();
56
+ cy.realPress('Escape');
57
+ cy.get('button[data-test-subj="activateFullScreenButton"]').should('have.focus');
58
+ cy.checkAxe();
59
+ });
60
+ });
61
+ });