@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
@@ -239,7 +239,7 @@ export var EuiAccordionClass = /*#__PURE__*/function (_Component) {
239
239
  css: cssSpinnerStyles
240
240
  }), ___EmotionJSX(EuiText, {
241
241
  size: "s"
242
- }, ___EmotionJSX("p", null, isLoadingMessage && isLoadingMessage !== true ? isLoadingMessage : ___EmotionJSX(EuiI18n, {
242
+ }, ___EmotionJSX("p", null, isLoadingMessage !== true ? isLoadingMessage : ___EmotionJSX(EuiI18n, {
243
243
  token: "euiAccordion.isLoading",
244
244
  default: "Loading"
245
245
  }))));
@@ -1236,7 +1236,7 @@ EuiBasicTable.propTypes = {
1236
1236
  /**
1237
1237
  * Defines the horizontal alignment of the column
1238
1238
  */
1239
- align: PropTypes.oneOf(["left", "right", "center"]),
1239
+ align: PropTypes.any,
1240
1240
 
1241
1241
  /**
1242
1242
  * Indicates whether this column should truncate its content when it doesn't fit
@@ -1295,7 +1295,7 @@ EuiBasicTable.propTypes = {
1295
1295
  */
1296
1296
  truncateText: PropTypes.bool,
1297
1297
  isExpander: PropTypes.bool,
1298
- align: PropTypes.oneOf(["left", "right", "center"]),
1298
+ align: PropTypes.any,
1299
1299
 
1300
1300
  /**
1301
1301
  * Disables the user's ability to change the sort but still shows the current direction
@@ -671,7 +671,7 @@ EuiInMemoryTable.propTypes = {
671
671
  /**
672
672
  * Defines the horizontal alignment of the column
673
673
  */
674
- align: PropTypes.oneOf(["left", "right", "center"]),
674
+ align: PropTypes.any,
675
675
 
676
676
  /**
677
677
  * Indicates whether this column should truncate its content when it doesn't fit
@@ -730,7 +730,7 @@ EuiInMemoryTable.propTypes = {
730
730
  */
731
731
  truncateText: PropTypes.bool,
732
732
  isExpander: PropTypes.bool,
733
- align: PropTypes.oneOf(["left", "right", "center"]),
733
+ align: PropTypes.any,
734
734
 
735
735
  /**
736
736
  * Disables the user's ability to change the sort but still shows the current direction
@@ -1185,10 +1185,7 @@ EuiInMemoryTable.propTypes = {
1185
1185
  "aria-label": PropTypes.string
1186
1186
  }).isRequired])]),
1187
1187
  sorting: PropTypes.oneOfType([PropTypes.bool.isRequired, PropTypes.shape({
1188
- sort: PropTypes.shape({
1189
- field: PropTypes.string.isRequired,
1190
- direction: PropTypes.oneOfType([PropTypes.any.isRequired, PropTypes.any.isRequired]).isRequired
1191
- }).isRequired
1188
+ sort: PropTypes.any.isRequired
1192
1189
  }).isRequired]),
1193
1190
 
1194
1191
  /**
@@ -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
+ };
@@ -36,7 +36,7 @@ import PropTypes from "prop-types";
36
36
  import classNames from 'classnames';
37
37
  import { getPositionFromStop, getStopFromMouseLocation, isColorInvalid, isStopInvalid } from './utils';
38
38
  import { getChromaColor } from '../utils';
39
- import { keys, useMouseMove } from '../../../services';
39
+ import { keys, useMouseMove, useEuiTheme } from '../../../services';
40
40
  import { EuiButtonIcon } from '../../button';
41
41
  import { EuiColorPicker } from '../color_picker';
42
42
  import { EuiFlexGroup, EuiFlexItem } from '../../flex';
@@ -46,6 +46,7 @@ import { EuiPopover } from '../../popover';
46
46
  import { EuiScreenReaderOnly } from '../../accessibility';
47
47
  import { EuiSpacer } from '../../spacer';
48
48
  import { EuiRangeThumb } from '../../form/range/range_thumb';
49
+ import { euiColorStopThumbStyles, euiColorStopThumbPopoverStyles, euiColorStopStyles } from './color_stop_thumb.styles';
49
50
  import { jsx as ___EmotionJSX } from "@emotion/react";
50
51
  export var EuiColorStopThumb = function EuiColorStopThumb(_ref) {
51
52
  var className = _ref.className,
@@ -253,13 +254,20 @@ export var EuiColorStopThumb = function EuiColorStopThumb(_ref) {
253
254
  }
254
255
  };
255
256
 
256
- var classes = classNames('euiColorStopPopover', {
257
- 'euiColorStopPopover-hasFocus': hasFocus || isPopoverOpen
258
- }, className);
259
- return ___EmotionJSX(EuiPopover, _extends({}, rest, {
257
+ var euiTheme = useEuiTheme();
258
+ var popoverStyles = euiColorStopThumbPopoverStyles(euiTheme);
259
+ var cssPopoverStyles = [popoverStyles.euiColorStopThumbPopover, (hasFocus || isPopoverOpen) && popoverStyles.hasFocus];
260
+ var thumbStyles = euiColorStopThumbStyles(euiTheme);
261
+ var cssThumbStyles = [thumbStyles.euiColorStopThumb, isPopoverOpen && thumbStyles.isPopoverOpen];
262
+ var colorStopStyles = euiColorStopStyles(euiTheme);
263
+ var cssColorStopStyles = colorStopStyles.euiColorStop;
264
+ var classes = classNames('euiColorStopPopover', className);
265
+ return ___EmotionJSX(EuiPopover, _extends({
266
+ css: cssPopoverStyles
267
+ }, rest, {
260
268
  ref: popoverRef,
261
269
  className: classes,
262
- anchorClassName: "euiColorStopPopover__anchor",
270
+ anchorClassName: "euiColorStopThumbPopover__anchor",
263
271
  panelPaddingSize: "s",
264
272
  isOpen: isPopoverOpen,
265
273
  closePopover: closePopover,
@@ -267,7 +275,9 @@ export var EuiColorStopThumb = function EuiColorStopThumb(_ref) {
267
275
  focusTrapProps: {
268
276
  clickOutsideDisables: false
269
277
  },
270
- panelClassName: numberInputRef ? undefined : 'euiColorStopPopover-isLoadingPanel',
278
+ panelProps: {
279
+ css: numberInputRef ? undefined : popoverStyles.isLoadingPanel
280
+ },
271
281
  style: _objectSpread(_objectSpread({}, style), {}, {
272
282
  left: "".concat(getPositionFromStopFn(stop), "%")
273
283
  }),
@@ -299,6 +309,7 @@ export var EuiColorStopThumb = function EuiColorStopThumb(_ref) {
299
309
  "aria-label": ariaLabel,
300
310
  title: title,
301
311
  className: "euiColorStopThumb",
312
+ css: cssThumbStyles,
302
313
  tabIndex: -1,
303
314
  style: {
304
315
  background: background
@@ -308,6 +319,7 @@ export var EuiColorStopThumb = function EuiColorStopThumb(_ref) {
308
319
  })
309
320
  }), ___EmotionJSX("div", {
310
321
  className: "euiColorStop",
322
+ css: cssColorStopStyles,
311
323
  "data-test-subj": "euiColorStopPopover"
312
324
  }, ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("p", {
313
325
  "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
+ };
@@ -43,7 +43,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
43
43
  */
44
44
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
45
45
  import classNames from 'classnames';
46
- import { keys, DEFAULT_VISUALIZATION_COLOR, getSteppedGradient } from '../../../services';
46
+ import { keys, DEFAULT_VISUALIZATION_COLOR, getSteppedGradient, useEuiTheme } from '../../../services';
47
47
  import { EuiColorStopThumb } from './color_stop_thumb';
48
48
  import { addStop, addDefinedStop, getPositionFromStop, getStopFromMouseLocation, isInvalid, removeStop } from './utils';
49
49
  import { getChromaColor } from '../utils';
@@ -52,6 +52,7 @@ import { EuiScreenReaderOnly } from '../../accessibility';
52
52
  import { EuiRangeHighlight } from '../../form/range/range_highlight';
53
53
  import { EuiRangeTrack } from '../../form/range/range_track';
54
54
  import { EuiRangeWrapper } from '../../form/range/range_wrapper';
55
+ import { euiColorStopsStyles, euiColorStopsAddContainerStyles } from './color_stops.styles';
55
56
  import { jsx as ___EmotionJSX } from "@emotion/react";
56
57
  // Because of how the thumbs are rendered in the popover, using ref results in an infinite loop.
57
58
  // We'll instead use old fashioned namespaced DOM selectors to get references
@@ -190,11 +191,16 @@ export var EuiColorStops = function EuiColorStops(_ref) {
190
191
  setFocusStopOnUpdate = _useState14[1];
191
192
 
192
193
  var isNotInteractive = disabled || readOnly;
193
- var classes = classNames('euiColorStops', {
194
- 'euiColorStops-isDragging': isHoverDisabled,
195
- 'euiColorStops-isDisabled': disabled,
196
- 'euiColorStops-isReadOnly': readOnly
197
- }, className);
194
+ var isDragging = isHoverDisabled && !isNotInteractive;
195
+ var addContainerIsDisabled = isHoverDisabled || isNotInteractive;
196
+ var classes = classNames('euiColorStops', className);
197
+ var euiTheme = useEuiTheme();
198
+ var styles = euiColorStopsStyles(euiTheme);
199
+ var cssPopoverStyles = [styles.euiColorStops, !disabled ? styles.isEnabled : styles.isDisabled, readOnly && styles.isReadOnly, isDragging && styles.isDragging];
200
+ var cssTrackStyles = [styles.euiColorStops__track];
201
+ var cssAddTargetStyles = [styles.euiColorStops__addTarget];
202
+ var addContainerStyles = euiColorStopsAddContainerStyles(euiTheme);
203
+ var cssAddContainerStyles = [addContainerStyles.euiColorStopsAddContainer, !addContainerIsDisabled ? addContainerStyles.isEnabled : addContainerStyles.isDisabled];
198
204
 
199
205
  var getStopFromMouseLocationFn = function getStopFromMouseLocationFn(location) {
200
206
  // Guard against `null` ref in usage
@@ -395,7 +401,7 @@ export var EuiColorStops = function EuiColorStops(_ref) {
395
401
  disabled: disabled,
396
402
  readOnly: readOnly,
397
403
  "aria-valuetext": "Stop: ".concat(colorStop.stop, ", Color: ").concat(colorStop.color, " (").concat(index + 1, " of ").concat(colorStops.length, ")"),
398
- isPopoverOpen: colorStop.id === openedStopId,
404
+ isPopoverOpen: !isDragging && colorStop.id === openedStopId,
399
405
  openPopover: function openPopover() {
400
406
  setOpenedStopId(colorStop.id);
401
407
  },
@@ -405,7 +411,7 @@ export var EuiColorStops = function EuiColorStops(_ref) {
405
411
  valueInputProps: valueInputProps
406
412
  });
407
413
  });
408
- }, [colorStops, disabled, handleOnChange, max, min, mode, onRemove, openedStopId, rangeMax, rangeMin, readOnly, showAlpha, sortedStops, swatches, wrapperRef, valueInputProps]);
414
+ }, [colorStops, disabled, handleOnChange, isDragging, max, min, mode, onRemove, openedStopId, rangeMax, rangeMin, readOnly, showAlpha, sortedStops, swatches, wrapperRef, valueInputProps]);
409
415
  var positions = wrapperRef ? sortedStops.map(function (_ref3) {
410
416
  var stop = _ref3.stop;
411
417
  return getPositionFromStopFn(stop);
@@ -413,10 +419,10 @@ export var EuiColorStops = function EuiColorStops(_ref) {
413
419
 
414
420
  var gradientStop = function gradientStop(colorStop, index) {
415
421
  var color = getChromaColor(colorStop.color, showAlpha);
416
- var rgba = color ? color.css() : 'currentColor';
422
+ var rgba = color ? color.css() : 'transparent';
417
423
 
418
424
  if (index === 0) {
419
- return "currentColor, currentColor ".concat(positions[index], "%, ").concat(rgba, " ").concat(positions[index], "%");
425
+ return "transparent, transparent ".concat(positions[index], "%, ").concat(rgba, " ").concat(positions[index], "%");
420
426
  }
421
427
 
422
428
  return "".concat(rgba, " ").concat(positions[index], "%");
@@ -444,13 +450,15 @@ export var EuiColorStops = function EuiColorStops(_ref) {
444
450
  percentageSteps = percentageSteps + percentage;
445
451
  });
446
452
  steppedGradient = steppedGradient.substring(0, steppedGradient.length - 2);
447
- gradient = "linear-gradient(to right, currentColor ".concat(trailingPercentage, "%, ").concat(steppedGradient, ")");
453
+ gradient = "linear-gradient(to right, transparent ".concat(trailingPercentage, "%, ").concat(steppedGradient, ")");
448
454
  } else {
449
455
  var linearGradient = sortedStops.map(stopType === 'gradient' ? gradientStop : fixedStop);
450
456
  gradient = "linear-gradient(to right,".concat(linearGradient, ")");
451
457
  }
452
458
 
453
- return ___EmotionJSX(EuiRangeWrapper, _extends({}, rest, {
459
+ return ___EmotionJSX(EuiRangeWrapper, _extends({
460
+ css: cssPopoverStyles
461
+ }, rest, {
454
462
  "data-test-subj": classNames('euiColorStops', rest['data-test-subj']),
455
463
  ref: setWrapperRef,
456
464
  className: classes,
@@ -473,6 +481,8 @@ export var EuiColorStops = function EuiColorStops(_ref) {
473
481
  token: "euiColorStops.screenReaderAnnouncement",
474
482
  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."
475
483
  }))), ___EmotionJSX(EuiRangeTrack, {
484
+ className: "euiColorStops__track",
485
+ css: cssTrackStyles,
476
486
  min: min || rangeMin,
477
487
  max: max || rangeMax,
478
488
  compressed: compressed,
@@ -489,13 +499,13 @@ export var EuiColorStops = function EuiColorStops(_ref) {
489
499
  trackWidth: trackWidth
490
500
  }), ___EmotionJSX("div", {
491
501
  "data-test-subj": "euiColorStopsAdd",
492
- className: classNames('euiColorStops__addContainer', {
493
- 'euiColorStops__addContainer-isDisabled': isHoverDisabled || disabled || readOnly
494
- }),
502
+ className: "euiColorStops__addContainer",
503
+ css: cssAddContainerStyles,
495
504
  onClick: handleAddClick,
496
505
  onMouseMove: handleAddHover
497
506
  }, ___EmotionJSX("div", {
498
507
  className: "euiColorStops__addTarget",
508
+ css: cssAddTargetStyles,
499
509
  style: {
500
510
  left: "".concat(addTargetPosition, "%")
501
511
  }
@@ -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
+ };
@@ -693,6 +693,14 @@ EuiSuperDatePickerInternal.propTypes = {
693
693
  */
694
694
  position: PropTypes.oneOf(["top", "right", "bottom", "left"]).isRequired,
695
695
 
696
+ /**
697
+ * When `true`, the tooltip's position is re-calculated when the user
698
+ * scrolls. This supports having fixed-position tooltip anchors.
699
+ *
700
+ * When nesting an `EuiTooltip` in a scrollable container, `repositionOnScroll` should be `true`
701
+ */
702
+ repositionOnScroll: PropTypes.bool,
703
+
696
704
  /**
697
705
  * If supplied, called when mouse movement causes the tool tip to be
698
706
  * hidden.
@@ -861,6 +869,7 @@ EuiSuperDatePicker.propTypes = {
861
869
  title: PropTypes.node,
862
870
  id: PropTypes.string,
863
871
  position: PropTypes.oneOf(["top", "right", "bottom", "left"]).isRequired,
872
+ repositionOnScroll: PropTypes.bool,
864
873
  onMouseOut: PropTypes.func
865
874
  }),
866
875
  iconOnly: PropTypes.bool,
@@ -281,6 +281,14 @@ EuiSuperUpdateButton.propTypes = {
281
281
  */
282
282
  position: PropTypes.oneOf(["top", "right", "bottom", "left"]).isRequired,
283
283
 
284
+ /**
285
+ * When `true`, the tooltip's position is re-calculated when the user
286
+ * scrolls. This supports having fixed-position tooltip anchors.
287
+ *
288
+ * When nesting an `EuiTooltip` in a scrollable container, `repositionOnScroll` should be `true`
289
+ */
290
+ repositionOnScroll: PropTypes.bool,
291
+
284
292
  /**
285
293
  * If supplied, called when mouse movement causes the tool tip to be
286
294
  * hidden.
@@ -17,7 +17,7 @@ export var euiRangeHighlightStyles = function euiRangeHighlightStyles(euiThemeCo
17
17
  export var euiRangeHighlightProgressStyles = function euiRangeHighlightProgressStyles(euiThemeContext) {
18
18
  var range = euiRangeVariables(euiThemeContext);
19
19
  return {
20
- euiRangeHighlight__progress: /*#__PURE__*/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;")
20
+ euiRangeHighlight__progress: /*#__PURE__*/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;")
21
21
  };
22
22
  };
23
23
  export var euiRangeHighlightLevelsWrapperStyles = function euiRangeHighlightLevelsWrapperStyles(euiThemeContext) {
@@ -18,7 +18,7 @@ export var euiRangeLevelsStyles = function euiRangeLevelsStyles(euiThemeContext)
18
18
  var stripesBackground = "repeating-linear-gradient(\n -45deg,\n ".concat(transparentize(stripeColor, 0.5), ",\n ").concat(transparentize(stripeColor, 0.5), " 25%,\n ").concat(transparentize(stripeColor, 0.7), " 25%,\n ").concat(transparentize(stripeColor, 0.7), " 50%,\n ").concat(transparentize(stripeColor, 0.5), " 50%\n )");
19
19
  return {
20
20
  euiRangeLevels: /*#__PURE__*/css("display:flex;justify-content:stretch;position:absolute;inset-inline:0;inset-block-start:", range.trackTopPositionWithoutTicks, ";z-index:", range.levelsZIndex, ";;label:euiRangeLevels;"),
21
- hasRange: /*#__PURE__*/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;"),
21
+ hasRange: /*#__PURE__*/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;"),
22
22
  hasTicks: /*#__PURE__*/css("inset-block-start:", range.trackTopPositionWithTicks, ";;label:hasTicks;")
23
23
  };
24
24
  };
@@ -1,4 +1,4 @@
1
- var _excluded = ["children", "disabled", "max", "min", "step", "showTicks", "tickInterval", "ticks", "levels", "onChange", "value", "compressed", "showRange"];
1
+ var _excluded = ["children", "disabled", "max", "min", "step", "showTicks", "tickInterval", "ticks", "levels", "onChange", "value", "compressed", "showRange", "className"];
2
2
 
3
3
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
4
 
@@ -27,6 +27,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
27
27
  */
28
28
  import React, { useState, useMemo, useEffect } from 'react';
29
29
  import PropTypes from "prop-types";
30
+ import classNames from 'classnames';
30
31
  import range from 'lodash/range';
31
32
  import { useEuiTheme, isEvenlyDivisibleBy } from '../../../services';
32
33
  import { EuiRangeLevels } from './range_levels';
@@ -47,6 +48,7 @@ export var EuiRangeTrack = function EuiRangeTrack(_ref) {
47
48
  value = _ref.value,
48
49
  compressed = _ref.compressed,
49
50
  showRange = _ref.showRange,
51
+ className = _ref.className,
50
52
  rest = _objectWithoutProperties(_ref, _excluded);
51
53
 
52
54
  useEffect(function () {
@@ -106,8 +108,9 @@ export var EuiRangeTrack = function EuiRangeTrack(_ref) {
106
108
  trackWidth = _useState2[0],
107
109
  setTrackWidth = _useState2[1];
108
110
 
111
+ var classes = classNames('euiRangeTrack', className);
109
112
  return ___EmotionJSX("div", _extends({
110
- className: "euiRangeTrack",
113
+ className: classes,
111
114
  css: cssStyles
112
115
  }, rest, {
113
116
  ref: function ref(node) {