@elastic/eui 72.0.0 → 72.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) 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 -148
  4. package/dist/eui_theme_dark.min.css +1 -1
  5. package/dist/eui_theme_light.css +0 -148
  6. package/dist/eui_theme_light.min.css +1 -1
  7. package/es/components/basic_table/basic_table.js +2 -2
  8. package/es/components/basic_table/in_memory_table.js +3 -6
  9. package/es/components/basic_table/table.a11y.js +128 -0
  10. package/es/components/color_picker/color_picker.styles.js +16 -0
  11. package/es/components/color_picker/color_stops/color_stop_thumb.js +19 -7
  12. package/es/components/color_picker/color_stops/color_stop_thumb.styles.js +59 -0
  13. package/es/components/color_picker/color_stops/color_stops.js +25 -15
  14. package/es/components/color_picker/color_stops/color_stops.styles.js +65 -0
  15. package/es/components/form/range/range_highlight.styles.js +1 -1
  16. package/es/components/form/range/range_levels.styles.js +1 -1
  17. package/es/components/form/range/range_track.js +5 -2
  18. package/es/components/image/image.a11y.js +55 -0
  19. package/es/components/key_pad_menu/key_pad_menu.a11y.js +158 -0
  20. package/es/components/popover/popover.js +2 -2
  21. package/es/components/table/table_footer_cell.js +1 -1
  22. package/es/components/table/table_header_cell.js +1 -1
  23. package/es/components/table/table_row_cell.js +2 -2
  24. package/es/services/color/manipulation.js +9 -0
  25. package/es/services/index.js +11 -11
  26. package/eui.d.ts +154 -106
  27. package/i18ntokens.json +16 -16
  28. package/lib/components/basic_table/basic_table.js +2 -2
  29. package/lib/components/basic_table/in_memory_table.js +3 -6
  30. package/lib/components/basic_table/table.a11y.js +139 -0
  31. package/lib/components/color_picker/color_picker.styles.js +26 -0
  32. package/lib/components/color_picker/color_stops/color_stop_thumb.js +19 -6
  33. package/lib/components/color_picker/color_stops/color_stop_thumb.styles.js +69 -0
  34. package/lib/components/color_picker/color_stops/color_stops.js +25 -14
  35. package/lib/components/color_picker/color_stops/color_stops.styles.js +73 -0
  36. package/lib/components/form/range/range_highlight.styles.js +1 -1
  37. package/lib/components/form/range/range_levels.styles.js +1 -1
  38. package/lib/components/form/range/range_track.js +6 -2
  39. package/lib/components/image/image.a11y.js +61 -0
  40. package/lib/components/key_pad_menu/key_pad_menu.a11y.js +163 -0
  41. package/lib/components/popover/popover.js +2 -2
  42. package/lib/components/table/table_footer_cell.js +1 -1
  43. package/lib/components/table/table_header_cell.js +1 -1
  44. package/lib/components/table/table_row_cell.js +2 -2
  45. package/lib/services/color/manipulation.js +14 -2
  46. package/lib/services/index.js +65 -58
  47. package/optimize/es/components/basic_table/table.a11y.js +128 -0
  48. package/optimize/es/components/color_picker/color_picker.styles.js +16 -0
  49. package/optimize/es/components/color_picker/color_stops/color_stop_thumb.js +19 -7
  50. package/optimize/es/components/color_picker/color_stops/color_stop_thumb.styles.js +59 -0
  51. package/optimize/es/components/color_picker/color_stops/color_stops.js +25 -15
  52. package/optimize/es/components/color_picker/color_stops/color_stops.styles.js +65 -0
  53. package/optimize/es/components/form/range/range_highlight.styles.js +1 -1
  54. package/optimize/es/components/form/range/range_levels.styles.js +1 -1
  55. package/optimize/es/components/form/range/range_track.js +5 -2
  56. package/optimize/es/components/image/image.a11y.js +55 -0
  57. package/optimize/es/components/key_pad_menu/key_pad_menu.a11y.js +148 -0
  58. package/optimize/es/components/popover/popover.js +2 -2
  59. package/optimize/es/services/color/manipulation.js +9 -0
  60. package/optimize/es/services/index.js +11 -11
  61. package/optimize/lib/components/basic_table/table.a11y.js +139 -0
  62. package/optimize/lib/components/color_picker/color_picker.styles.js +26 -0
  63. package/optimize/lib/components/color_picker/color_stops/color_stop_thumb.js +19 -6
  64. package/optimize/lib/components/color_picker/color_stops/color_stop_thumb.styles.js +69 -0
  65. package/optimize/lib/components/color_picker/color_stops/color_stops.js +25 -14
  66. package/optimize/lib/components/color_picker/color_stops/color_stops.styles.js +73 -0
  67. package/optimize/lib/components/form/range/range_highlight.styles.js +1 -1
  68. package/optimize/lib/components/form/range/range_levels.styles.js +1 -1
  69. package/optimize/lib/components/form/range/range_track.js +6 -2
  70. package/optimize/lib/components/image/image.a11y.js +61 -0
  71. package/optimize/lib/components/key_pad_menu/key_pad_menu.a11y.js +163 -0
  72. package/optimize/lib/components/popover/popover.js +2 -2
  73. package/optimize/lib/services/color/manipulation.js +14 -2
  74. package/optimize/lib/services/index.js +65 -58
  75. package/package.json +1 -1
  76. package/src/components/color_picker/_index.scss +0 -1
  77. package/src/themes/amsterdam/overrides/_index.scss +0 -1
  78. package/test-env/components/basic_table/basic_table.js +2 -2
  79. package/test-env/components/basic_table/in_memory_table.js +3 -6
  80. package/test-env/components/basic_table/table.a11y.js +139 -0
  81. package/test-env/components/color_picker/color_picker.styles.js +26 -0
  82. package/test-env/components/color_picker/color_stops/color_stop_thumb.js +19 -6
  83. package/test-env/components/color_picker/color_stops/color_stop_thumb.styles.js +69 -0
  84. package/test-env/components/color_picker/color_stops/color_stops.js +25 -14
  85. package/test-env/components/color_picker/color_stops/color_stops.styles.js +73 -0
  86. package/test-env/components/form/range/range_highlight.styles.js +1 -1
  87. package/test-env/components/form/range/range_levels.styles.js +1 -1
  88. package/test-env/components/form/range/range_track.js +6 -2
  89. package/test-env/components/image/image.a11y.js +61 -0
  90. package/test-env/components/key_pad_menu/key_pad_menu.a11y.js +163 -0
  91. package/test-env/components/popover/popover.js +2 -2
  92. package/test-env/components/table/table_footer_cell.js +1 -1
  93. package/test-env/components/table/table_header_cell.js +1 -1
  94. package/test-env/components/table/table_row_cell.js +2 -2
  95. package/test-env/services/color/manipulation.js +14 -2
  96. package/test-env/services/index.js +65 -58
  97. package/src/components/color_picker/color_stops/_color_stops.scss +0 -101
  98. package/src/components/color_picker/color_stops/_index.scss +0 -1
  99. package/src/themes/amsterdam/overrides/_color_stops.scss +0 -58
@@ -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
+ };
@@ -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,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["children", "disabled", "max", "min", "step", "showTicks", "tickInterval", "ticks", "levels", "onChange", "value", "compressed", "showRange"];
4
+ var _excluded = ["children", "disabled", "max", "min", "step", "showTicks", "tickInterval", "ticks", "levels", "onChange", "value", "compressed", "showRange", "className"];
5
5
 
6
6
  /*
7
7
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
@@ -11,6 +11,7 @@ var _excluded = ["children", "disabled", "max", "min", "step", "showTicks", "tic
11
11
  * Side Public License, v 1.
12
12
  */
13
13
  import React, { useState, useMemo, useEffect } from 'react';
14
+ import classNames from 'classnames';
14
15
  import range from 'lodash/range';
15
16
  import { useEuiTheme, isEvenlyDivisibleBy } from '../../../services';
16
17
  import { EuiRangeLevels } from './range_levels';
@@ -31,6 +32,7 @@ export var EuiRangeTrack = function EuiRangeTrack(_ref) {
31
32
  value = _ref.value,
32
33
  compressed = _ref.compressed,
33
34
  showRange = _ref.showRange,
35
+ className = _ref.className,
34
36
  rest = _objectWithoutProperties(_ref, _excluded);
35
37
 
36
38
  useEffect(function () {
@@ -90,8 +92,9 @@ export var EuiRangeTrack = function EuiRangeTrack(_ref) {
90
92
  trackWidth = _useState2[0],
91
93
  setTrackWidth = _useState2[1];
92
94
 
95
+ var classes = classNames('euiRangeTrack', className);
93
96
  return ___EmotionJSX("div", _extends({
94
- className: "euiRangeTrack",
97
+ className: classes,
95
98
  css: cssStyles
96
99
  }, rest, {
97
100
  ref: function ref(node) {
@@ -0,0 +1,55 @@
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 { EuiImage } from './image';
11
+ import { jsx as ___EmotionJSX } from "@emotion/react";
12
+
13
+ var Image = function Image() {
14
+ return ___EmotionJSX(EuiImage, {
15
+ size: "m",
16
+ hasShadow: true,
17
+ allowFullScreen: true,
18
+ caption: "Albert Einstein, theoretical physicist",
19
+ alt: "" // Because this image is sufficiently described by its caption, there is no need to repeat it via alt text
20
+ ,
21
+ src: "https://upload.wikimedia.org/wikipedia/commons/d/d3/Albert_Einstein_Head.jpg"
22
+ });
23
+ };
24
+
25
+ beforeEach(function () {
26
+ cy.viewport(1024, 768); // medium breakpoint
27
+
28
+ cy.realMount(___EmotionJSX(Image, null));
29
+ cy.get('figure[aria-label="Albert Einstein, theoretical physicist"]').should('exist');
30
+ });
31
+ describe('EuiImage', function () {
32
+ describe('Automated accessibility check', function () {
33
+ it('has zero violations on first render', function () {
34
+ cy.checkAxe();
35
+ });
36
+ it('has zero violations on fullscreen render', function () {
37
+ cy.get('button[data-test-subj="activateFullScreenButton"]').realClick();
38
+ cy.get('button[data-test-subj="deactivateFullScreenButton"]').should('exist');
39
+ cy.checkAxe();
40
+ cy.get('div[data-test-subj="fullScreenOverlayMask"]').realClick();
41
+ cy.checkAxe();
42
+ });
43
+ it('has zero violations on keyboard interaction', function () {
44
+ cy.realPress('Tab');
45
+ cy.get('button[data-test-subj="activateFullScreenButton"]').should('have.focus');
46
+ cy.realPress('Enter');
47
+ cy.get('button[data-test-subj="deactivateFullScreenButton"]').should('exist');
48
+ cy.get('button[data-test-subj="deactivateFullScreenButton"]').should('have.focus');
49
+ cy.checkAxe();
50
+ cy.realPress('Escape');
51
+ cy.get('button[data-test-subj="activateFullScreenButton"]').should('have.focus');
52
+ cy.checkAxe();
53
+ });
54
+ });
55
+ });
@@ -0,0 +1,148 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+
3
+ /*
4
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
5
+ * or more contributor license agreements. Licensed under the Elastic License
6
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
7
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
8
+ * Side Public License, v 1.
9
+ */
10
+ /// <reference types="../../../cypress/support"/>
11
+ import React, { useState } from 'react';
12
+ import { EuiKeyPadMenu } from './key_pad_menu';
13
+ import { EuiKeyPadMenuItem } from './key_pad_menu_item';
14
+ import { EuiIcon } from '../icon';
15
+ import { useGeneratedHtmlId } from '../../services';
16
+ import { jsx as ___EmotionJSX } from "@emotion/react";
17
+
18
+ var KeyPadMenu = function KeyPadMenu() {
19
+ var keypadButtonId__1 = useGeneratedHtmlId({
20
+ prefix: 'keypadButton',
21
+ suffix: 'first'
22
+ });
23
+ var keypadButtonId__2 = useGeneratedHtmlId({
24
+ prefix: 'keypadButton',
25
+ suffix: 'second'
26
+ });
27
+ var keypadButtonId__3 = useGeneratedHtmlId({
28
+ prefix: 'keypadButton',
29
+ suffix: 'third'
30
+ });
31
+ var keypadButtonId__4 = useGeneratedHtmlId({
32
+ prefix: 'keypadButton',
33
+ suffix: 'fourth'
34
+ });
35
+ var keypadButtonId__5 = useGeneratedHtmlId({
36
+ prefix: 'keypadButton',
37
+ suffix: 'fifth'
38
+ });
39
+ var keypadButtonId__6 = useGeneratedHtmlId({
40
+ prefix: 'keypadButton',
41
+ suffix: 'sixth'
42
+ });
43
+
44
+ var _useState = useState(keypadButtonId__6),
45
+ _useState2 = _slicedToArray(_useState, 2),
46
+ selectedID = _useState2[0],
47
+ setSelectedID = _useState2[1];
48
+
49
+ return ___EmotionJSX("div", {
50
+ "aria-label": "Menu keypad"
51
+ }, ___EmotionJSX(EuiKeyPadMenu, null, ___EmotionJSX(EuiKeyPadMenuItem, {
52
+ "data-test-subj": "cy-keypad-button-1",
53
+ id: keypadButtonId__1,
54
+ label: "Button 1",
55
+ isSelected: selectedID === keypadButtonId__1,
56
+ onClick: function onClick() {
57
+ return setSelectedID(keypadButtonId__1);
58
+ }
59
+ }, ___EmotionJSX(EuiIcon, {
60
+ type: "grid",
61
+ size: "l"
62
+ })), ___EmotionJSX(EuiKeyPadMenuItem, {
63
+ "data-test-subj": "cy-keypad-button-2",
64
+ id: keypadButtonId__2,
65
+ label: "Button 2",
66
+ isSelected: selectedID === keypadButtonId__2,
67
+ onClick: function onClick() {
68
+ return setSelectedID(keypadButtonId__2);
69
+ }
70
+ }, ___EmotionJSX(EuiIcon, {
71
+ type: "grid",
72
+ size: "l"
73
+ })), ___EmotionJSX(EuiKeyPadMenuItem, {
74
+ "data-test-subj": "cy-keypad-button-3",
75
+ id: keypadButtonId__3,
76
+ label: "Button 3",
77
+ isSelected: selectedID === keypadButtonId__3,
78
+ onClick: function onClick() {
79
+ return setSelectedID(keypadButtonId__3);
80
+ }
81
+ }, ___EmotionJSX(EuiIcon, {
82
+ type: "grid",
83
+ size: "l"
84
+ })), ___EmotionJSX(EuiKeyPadMenuItem, {
85
+ "data-test-subj": "cy-keypad-link-1",
86
+ id: keypadButtonId__4,
87
+ label: "Link 1",
88
+ href: "#/navigation/key-pad-menu",
89
+ isSelected: selectedID === keypadButtonId__4,
90
+ onClick: function onClick() {
91
+ return setSelectedID(keypadButtonId__4);
92
+ }
93
+ }, ___EmotionJSX(EuiIcon, {
94
+ type: "link",
95
+ size: "l"
96
+ })), ___EmotionJSX(EuiKeyPadMenuItem, {
97
+ "data-test-subj": "cy-keypad-link-2",
98
+ id: keypadButtonId__5,
99
+ label: "Link 2",
100
+ href: "#/navigation/key-pad-menu",
101
+ isSelected: selectedID === keypadButtonId__5,
102
+ onClick: function onClick() {
103
+ return setSelectedID(keypadButtonId__5);
104
+ }
105
+ }, ___EmotionJSX(EuiIcon, {
106
+ type: "link",
107
+ size: "l"
108
+ })), ___EmotionJSX(EuiKeyPadMenuItem, {
109
+ "data-test-subj": "cy-keypad-link-3",
110
+ id: keypadButtonId__6,
111
+ label: "Disabled Link 3",
112
+ isDisabled: true,
113
+ isSelected: selectedID === keypadButtonId__6
114
+ }, ___EmotionJSX(EuiIcon, {
115
+ type: "link",
116
+ size: "l"
117
+ }))));
118
+ };
119
+
120
+ beforeEach(function () {
121
+ cy.realMount(___EmotionJSX(KeyPadMenu, null));
122
+ cy.get('div[aria-label="Menu keypad"]').should('exist');
123
+ });
124
+ describe('EuiKeyPadMenu', function () {
125
+ describe('Automated accessibility check', function () {
126
+ it('has zero violations on first render', function () {
127
+ cy.checkAxe();
128
+ });
129
+ it('has zero violations on item click', function () {
130
+ cy.get('a[data-test-subj="cy-keypad-link-2"]').realClick();
131
+ cy.get('a[data-test-subj="cy-keypad-link-2"]').should('have.class', 'euiKeyPadMenuItem-isSelected');
132
+ cy.checkAxe();
133
+ });
134
+ it('has zero violations on item keypress', function () {
135
+ cy.repeatRealPress('Tab', 3);
136
+ cy.get('button[data-test-subj="cy-keypad-button-3"]').should('have.focus');
137
+ cy.realPress('Space');
138
+ cy.get('button[data-test-subj="cy-keypad-button-3"]').should('have.class', 'euiKeyPadMenuItem-isSelected');
139
+ cy.checkAxe();
140
+ cy.realPress(['Shift', 'Tab']);
141
+ cy.get('button[data-test-subj="cy-keypad-button-2"]').should('have.focus');
142
+ cy.realPress('Space');
143
+ cy.get('button[data-test-subj="cy-keypad-button-2"]').should('have.class', 'euiKeyPadMenuItem-isSelected');
144
+ cy.get('button[data-test-subj="cy-keypad-button-3"]').should('not.have.class', 'euiKeyPadMenuItem-isSelected');
145
+ cy.checkAxe();
146
+ });
147
+ });
148
+ });
@@ -471,13 +471,13 @@ export var EuiPopover = /*#__PURE__*/function (_Component) {
471
471
  panel = ___EmotionJSX(EuiPortal, {
472
472
  insert: insert
473
473
  }, ___EmotionJSX(EuiFocusTrap, _extends({
474
- clickOutsideDisables: true
474
+ clickOutsideDisables: true,
475
+ onClickOutside: this.onClickOutside
475
476
  }, focusTrapProps, {
476
477
  returnFocus: returnFocus // Ignore temporary state of indecisive focus
477
478
  ,
478
479
  initialFocus: initialFocus,
479
480
  onDeactivation: onTrapDeactivation,
480
- onClickOutside: this.onClickOutside,
481
481
  onEscapeKey: this.onEscapeKey,
482
482
  disabled: !ownFocus || !this.state.isOpenStable || this.state.isClosing
483
483
  }), ___EmotionJSX(EuiPopoverPanel, _extends({}, panelProps, {
@@ -97,4 +97,13 @@ export var lightness = function lightness(color) {
97
97
 
98
98
  export var darken = function darken(color, amount) {
99
99
  return chroma(color).darken(amount).hex();
100
+ };
101
+ /**
102
+ * Returns the brighten value of a color. 0-100
103
+ * @param color - Color to manipulate
104
+ * @param amount - Amount to change in absolute terms. 0-1.
105
+ */
106
+
107
+ export var brighten = function brighten(color, amount) {
108
+ return chroma(color).brighten(amount).hex();
100
109
  };