@elastic/eui 95.2.0 → 95.3.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 (129) hide show
  1. package/dist/eui_theme_dark.css +8 -364
  2. package/dist/eui_theme_dark.min.css +1 -1
  3. package/dist/eui_theme_light.css +8 -364
  4. package/dist/eui_theme_light.min.css +1 -1
  5. package/es/components/color_picker/color_palette_display/color_palette_display.js +9 -9
  6. package/es/components/color_picker/color_palette_display/color_palette_display.styles.js +24 -0
  7. package/es/components/color_picker/color_palette_display/color_palette_display_fixed.js +2 -0
  8. package/es/components/color_picker/color_palette_display/color_palette_display_fixed.styles.js +14 -0
  9. package/es/components/color_picker/color_palette_picker/color_palette_picker.js +34 -26
  10. package/es/components/color_picker/color_picker.js +26 -39
  11. package/es/components/color_picker/color_picker.styles.js +15 -5
  12. package/es/components/color_picker/color_picker_swatch.js +5 -1
  13. package/es/components/color_picker/color_picker_swatch.styles.js +19 -0
  14. package/es/components/color_picker/hue.js +11 -6
  15. package/es/components/color_picker/hue.styles.js +29 -0
  16. package/es/components/color_picker/saturation.js +29 -16
  17. package/es/components/color_picker/saturation.styles.js +23 -0
  18. package/es/components/form/file_picker/file_picker.js +5 -5
  19. package/es/components/form/range/range.styles.js +1 -1
  20. package/es/components/modal/modal.styles.js +1 -1
  21. package/es/components/popover/popover.js +5 -3
  22. package/es/components/provider/provider.js +2 -2
  23. package/es/global_styling/mixins/_helpers.js +10 -2
  24. package/es/services/breakpoint/current_breakpoint.js +5 -3
  25. package/es/services/theme/provider.js +10 -2
  26. package/eui.d.ts +6747 -6681
  27. package/i18ntokens.json +53 -53
  28. package/lib/components/color_picker/color_palette_display/color_palette_display.js +9 -9
  29. package/lib/components/color_picker/color_palette_display/color_palette_display.styles.js +30 -0
  30. package/lib/components/color_picker/color_palette_display/color_palette_display_fixed.js +2 -0
  31. package/lib/components/color_picker/color_palette_display/color_palette_display_fixed.styles.js +19 -0
  32. package/lib/components/color_picker/color_palette_picker/color_palette_picker.js +37 -27
  33. package/lib/components/color_picker/color_picker.js +26 -39
  34. package/lib/components/color_picker/color_picker.styles.js +15 -5
  35. package/lib/components/color_picker/color_picker_swatch.js +5 -1
  36. package/lib/components/color_picker/color_picker_swatch.styles.js +25 -0
  37. package/lib/components/color_picker/hue.js +11 -6
  38. package/lib/components/color_picker/hue.styles.js +35 -0
  39. package/lib/components/color_picker/saturation.js +27 -14
  40. package/lib/components/color_picker/saturation.styles.js +29 -0
  41. package/lib/components/form/file_picker/file_picker.js +5 -5
  42. package/lib/components/form/range/range.styles.js +1 -1
  43. package/lib/components/modal/modal.styles.js +1 -1
  44. package/lib/components/popover/popover.js +5 -3
  45. package/lib/components/provider/provider.js +1 -1
  46. package/lib/global_styling/mixins/_helpers.js +10 -2
  47. package/lib/services/breakpoint/current_breakpoint.js +6 -4
  48. package/lib/services/theme/provider.js +9 -1
  49. package/optimize/es/components/color_picker/color_palette_display/color_palette_display.js +8 -8
  50. package/optimize/es/components/color_picker/color_palette_display/color_palette_display.styles.js +24 -0
  51. package/optimize/es/components/color_picker/color_palette_display/color_palette_display_fixed.js +2 -0
  52. package/optimize/es/components/color_picker/color_palette_display/color_palette_display_fixed.styles.js +14 -0
  53. package/optimize/es/components/color_picker/color_palette_picker/color_palette_picker.js +34 -26
  54. package/optimize/es/components/color_picker/color_picker.js +26 -39
  55. package/optimize/es/components/color_picker/color_picker.styles.js +15 -5
  56. package/optimize/es/components/color_picker/color_picker_swatch.js +5 -1
  57. package/optimize/es/components/color_picker/color_picker_swatch.styles.js +19 -0
  58. package/optimize/es/components/color_picker/hue.js +11 -6
  59. package/optimize/es/components/color_picker/hue.styles.js +29 -0
  60. package/optimize/es/components/color_picker/saturation.js +29 -16
  61. package/optimize/es/components/color_picker/saturation.styles.js +23 -0
  62. package/optimize/es/components/form/file_picker/file_picker.js +5 -5
  63. package/optimize/es/components/form/range/range.styles.js +1 -1
  64. package/optimize/es/components/modal/modal.styles.js +1 -1
  65. package/optimize/es/components/popover/popover.js +5 -3
  66. package/optimize/es/components/provider/provider.js +2 -2
  67. package/optimize/es/global_styling/mixins/_helpers.js +10 -2
  68. package/optimize/es/services/breakpoint/current_breakpoint.js +5 -3
  69. package/optimize/es/services/theme/provider.js +10 -2
  70. package/optimize/lib/components/color_picker/color_palette_display/color_palette_display.js +8 -8
  71. package/optimize/lib/components/color_picker/color_palette_display/color_palette_display.styles.js +30 -0
  72. package/optimize/lib/components/color_picker/color_palette_display/color_palette_display_fixed.js +2 -0
  73. package/optimize/lib/components/color_picker/color_palette_display/color_palette_display_fixed.styles.js +19 -0
  74. package/optimize/lib/components/color_picker/color_palette_picker/color_palette_picker.js +38 -27
  75. package/optimize/lib/components/color_picker/color_picker.js +26 -39
  76. package/optimize/lib/components/color_picker/color_picker.styles.js +15 -5
  77. package/optimize/lib/components/color_picker/color_picker_swatch.js +5 -1
  78. package/optimize/lib/components/color_picker/color_picker_swatch.styles.js +25 -0
  79. package/optimize/lib/components/color_picker/hue.js +11 -6
  80. package/optimize/lib/components/color_picker/hue.styles.js +35 -0
  81. package/optimize/lib/components/color_picker/saturation.js +27 -14
  82. package/optimize/lib/components/color_picker/saturation.styles.js +29 -0
  83. package/optimize/lib/components/form/file_picker/file_picker.js +5 -5
  84. package/optimize/lib/components/form/range/range.styles.js +1 -1
  85. package/optimize/lib/components/modal/modal.styles.js +1 -1
  86. package/optimize/lib/components/popover/popover.js +5 -3
  87. package/optimize/lib/components/provider/provider.js +1 -1
  88. package/optimize/lib/global_styling/mixins/_helpers.js +10 -2
  89. package/optimize/lib/services/breakpoint/current_breakpoint.js +6 -4
  90. package/optimize/lib/services/theme/provider.js +9 -1
  91. package/package.json +10 -7
  92. package/src/components/index.scss +0 -1
  93. package/src/global_styling/mixins/_shadow.scss +5 -0
  94. package/src/themes/amsterdam/overrides/_index.scss +0 -1
  95. package/test-env/components/color_picker/color_palette_display/color_palette_display.js +9 -9
  96. package/test-env/components/color_picker/color_palette_display/color_palette_display.styles.js +30 -0
  97. package/test-env/components/color_picker/color_palette_display/color_palette_display_fixed.js +2 -0
  98. package/test-env/components/color_picker/color_palette_display/color_palette_display_fixed.styles.js +19 -0
  99. package/test-env/components/color_picker/color_palette_picker/color_palette_picker.js +38 -27
  100. package/test-env/components/color_picker/color_picker.js +26 -39
  101. package/test-env/components/color_picker/color_picker.styles.js +15 -5
  102. package/test-env/components/color_picker/color_picker_swatch.js +5 -1
  103. package/test-env/components/color_picker/color_picker_swatch.styles.js +25 -0
  104. package/test-env/components/color_picker/hue.js +11 -6
  105. package/test-env/components/color_picker/hue.styles.js +35 -0
  106. package/test-env/components/color_picker/saturation.js +27 -14
  107. package/test-env/components/color_picker/saturation.styles.js +29 -0
  108. package/test-env/components/form/file_picker/file_picker.js +5 -5
  109. package/test-env/components/form/range/range.styles.js +1 -1
  110. package/test-env/components/modal/modal.styles.js +1 -1
  111. package/test-env/components/popover/popover.js +5 -3
  112. package/test-env/components/provider/provider.js +1 -1
  113. package/test-env/global_styling/mixins/_helpers.js +10 -2
  114. package/test-env/services/breakpoint/current_breakpoint.js +6 -4
  115. package/test-env/services/theme/provider.js +9 -1
  116. package/src/components/color_picker/_color_picker.scss +0 -37
  117. package/src/components/color_picker/_color_picker_swatch.scss +0 -18
  118. package/src/components/color_picker/_hue.scss +0 -88
  119. package/src/components/color_picker/_index.scss +0 -7
  120. package/src/components/color_picker/_saturation.scss +0 -57
  121. package/src/components/color_picker/_variables.scss +0 -6
  122. package/src/components/color_picker/color_palette_display/_color_palette_display.scss +0 -18
  123. package/src/components/color_picker/color_palette_display/_color_palette_display_fixed.scss +0 -12
  124. package/src/components/color_picker/color_palette_display/_index.scss +0 -4
  125. package/src/components/color_picker/color_palette_display/_mixins.scss +0 -22
  126. package/src/components/color_picker/color_palette_display/_variables.scss +0 -6
  127. package/src/components/color_picker/color_palette_picker/_color_palette_picker.scss +0 -9
  128. package/src/components/color_picker/color_palette_picker/_index.scss +0 -1
  129. package/src/themes/amsterdam/overrides/_hue.scss +0 -44
@@ -17,9 +17,12 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
17
17
  * Side Public License, v 1.
18
18
  */
19
19
 
20
- import React from 'react';
20
+ import React, { useCallback, useMemo } from 'react';
21
21
  import PropTypes from "prop-types";
22
- import { EuiSuperSelect } from '../../form';
22
+ import { EuiSpacer } from '../../spacer';
23
+ import { EuiText } from '../../text';
24
+ import { EuiSuperSelect } from '../../form/super_select'; // Note: needs to be pointed at this specific subdir for Storybook to inherit types correctly??
25
+
23
26
  import { EuiColorPaletteDisplay } from '../color_palette_display';
24
27
  import { jsx as ___EmotionJSX } from "@emotion/react";
25
28
  export var EuiColorPalettePicker = function EuiColorPalettePicker(_ref) {
@@ -41,7 +44,7 @@ export var EuiColorPalettePicker = function EuiColorPalettePicker(_ref) {
41
44
  _ref$selectionDisplay = _ref.selectionDisplay,
42
45
  selectionDisplay = _ref$selectionDisplay === void 0 ? 'palette' : _ref$selectionDisplay,
43
46
  rest = _objectWithoutProperties(_ref, _excluded);
44
- var getPalette = function getPalette(_ref2) {
47
+ var getPalette = useCallback(function (_ref2) {
45
48
  var type = _ref2.type,
46
49
  palette = _ref2.palette,
47
50
  title = _ref2.title;
@@ -50,29 +53,34 @@ export var EuiColorPalettePicker = function EuiColorPalettePicker(_ref) {
50
53
  palette: palette,
51
54
  title: title
52
55
  });
53
- };
54
- var paletteOptions = palettes.map(function (item) {
55
- var type = item.type,
56
- value = item.value,
57
- title = item.title,
58
- palette = item.palette,
59
- rest = _objectWithoutProperties(item, _excluded2);
60
- var paletteForDisplay = item.type !== 'text' ? getPalette(item) : null;
61
- return _objectSpread({
62
- value: String(value),
63
- inputDisplay: selectionDisplay === 'title' || type === 'text' ? title : paletteForDisplay,
64
- dropdownDisplay: ___EmotionJSX("div", {
65
- className: "euiColorPalettePicker__item"
66
- }, title && type !== 'text' &&
67
- // Accessible labels are managed by color_palette_display_fixed and
68
- // color_palette_display_gradient. Adding the aria-hidden attribute
69
- // here to ensure screen readers don't speak the listbox options twice.
70
- ___EmotionJSX("div", {
71
- "aria-hidden": "true",
72
- className: "euiColorPalettePicker__itemTitle"
73
- }, title), type === 'text' ? title : paletteForDisplay)
74
- }, rest);
75
- });
56
+ }, []);
57
+ var paletteOptions = useMemo(function () {
58
+ return palettes.map(function (item) {
59
+ var type = item.type,
60
+ value = item.value,
61
+ title = item.title,
62
+ palette = item.palette,
63
+ rest = _objectWithoutProperties(item, _excluded2);
64
+ var paletteForDisplay = item.type !== 'text' ? getPalette(item) : null;
65
+ return _objectSpread({
66
+ value: String(value),
67
+ inputDisplay: selectionDisplay === 'title' || type === 'text' ? title : paletteForDisplay,
68
+ dropdownDisplay: ___EmotionJSX("div", {
69
+ className: "euiColorPalettePicker__item"
70
+ }, title && type !== 'text' &&
71
+ // Accessible labels are managed by color_palette_display_fixed and
72
+ // color_palette_display_gradient. Adding the aria-hidden attribute
73
+ // here to ensure screen readers don't speak the listbox options twice.
74
+ ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiText, {
75
+ "aria-hidden": "true",
76
+ className: "euiColorPalettePicker__itemTitle",
77
+ size: "xs"
78
+ }, title), ___EmotionJSX(EuiSpacer, {
79
+ size: "xs"
80
+ })), type === 'text' ? title : paletteForDisplay)
81
+ }, rest);
82
+ });
83
+ }, [getPalette, palettes, selectionDisplay]);
76
84
  return ___EmotionJSX(EuiSuperSelect, _extends({
77
85
  className: className,
78
86
  options: paletteOptions,
@@ -21,16 +21,15 @@ import PropTypes from "prop-types";
21
21
  import React, { cloneElement, useEffect, useMemo, useRef, useState } from 'react';
22
22
  import classNames from 'classnames';
23
23
  import chroma from 'chroma-js';
24
+ import { useEuiMemoizedStyles, VISUALIZATION_COLORS, keys } from '../../services';
24
25
  import { EuiFieldText, EuiFormControlLayout, EuiFormRow, EuiRange } from '../form';
25
- import { getFormControlClassNameForIconCount } from '../form/form_control_layout/_num_icons';
26
26
  import { useEuiI18n } from '../i18n';
27
27
  import { EuiPopover } from '../popover';
28
- import { EuiSpacer } from '../spacer';
29
- import { VISUALIZATION_COLORS, keys } from '../../services';
30
28
  import { EuiColorPickerSwatch } from './color_picker_swatch';
31
29
  import { EuiHue } from './hue';
32
30
  import { EuiSaturation } from './saturation';
33
31
  import { getChromaColor, parseColor, HEX_FALLBACK, HSV_FALLBACK, RGB_FALLBACK, RGB_JOIN } from './utils';
32
+ import { euiColorPickerStyles } from './color_picker.styles';
34
33
  import { jsx as ___EmotionJSX } from "@emotion/react";
35
34
  function isKeyboardEvent(event) {
36
35
  return _typeof(event) === 'object' && 'key' in event;
@@ -161,18 +160,7 @@ export var EuiColorPicker = function EuiColorPicker(_ref) {
161
160
  setColorAsHsv(getHsv([h, s, v], usableHsv[0]));
162
161
  };
163
162
  var classes = classNames('euiColorPicker', className);
164
- var popoverClass = 'euiColorPicker__popoverAnchor';
165
- var panelClasses = classNames('euiColorPicker__popoverPanel', {
166
- 'euiColorPicker__popoverPanel--pickerOnly': mode === 'picker' && secondaryInputDisplay !== 'bottom',
167
- 'euiColorPicker__popoverPanel--customButton': button
168
- });
169
- var swatchClass = 'euiColorPicker__swatchSelect';
170
- var numIconsClass = getFormControlClassNameForIconCount({
171
- isDropdown: true,
172
- clear: isClearable,
173
- isInvalid: isInvalid
174
- });
175
- var inputClasses = classNames('euiColorPicker__input', numIconsClass);
163
+ var styles = useEuiMemoizedStyles(euiColorPickerStyles);
176
164
  var handleOnChange = function handleOnChange(text) {
177
165
  var output = getOutput(text, showAlpha);
178
166
  if (output.isValid) {
@@ -322,7 +310,8 @@ export var EuiColorPicker = function EuiColorPicker(_ref) {
322
310
  });
323
311
  }
324
312
  };
325
- var inlineInput = secondaryInputDisplay !== 'none' && ___EmotionJSX(EuiFormRow, {
313
+ var showSecondaryInput = mode === 'secondaryInput' || secondaryInputDisplay !== 'none';
314
+ var inlineInput = showSecondaryInput && ___EmotionJSX(EuiFormRow, {
326
315
  display: "rowCompressed",
327
316
  isInvalid: isInvalid,
328
317
  error: isInvalid ? colorErrorMessage : null
@@ -331,9 +320,12 @@ export var EuiColorPicker = function EuiColorPicker(_ref) {
331
320
  onClick: handleClearInput
332
321
  } : undefined,
333
322
  readOnly: readOnly,
334
- compressed: compressed
323
+ isDisabled: disabled,
324
+ isInvalid: isInvalid,
325
+ compressed: display === 'inline' ? compressed : true
335
326
  }, ___EmotionJSX(EuiFieldText, {
336
- compressed: true,
327
+ controlOnly: true,
328
+ compressed: display === 'inline' ? compressed : true,
337
329
  value: color ? color.toUpperCase() : HEX_FALLBACK,
338
330
  placeholder: !color ? placeholder || transparent : undefined,
339
331
  onChange: handleColorInput,
@@ -347,40 +339,34 @@ export var EuiColorPicker = function EuiColorPicker(_ref) {
347
339
  var showSecondaryInputOnly = mode === 'secondaryInput';
348
340
  var showPicker = mode !== 'swatch' && !showSecondaryInputOnly;
349
341
  var showSwatches = mode !== 'picker' && !showSecondaryInputOnly;
350
- var composite = ___EmotionJSX(React.Fragment, null, secondaryInputDisplay === 'top' && ___EmotionJSX(React.Fragment, null, inlineInput, ___EmotionJSX(EuiSpacer, {
351
- size: "s"
352
- })), showPicker && ___EmotionJSX("div", {
353
- onKeyDown: handleOnKeyDown
354
- }, ___EmotionJSX(EuiSaturation, {
342
+ var composite = ___EmotionJSX(React.Fragment, null, secondaryInputDisplay === 'top' && inlineInput, showPicker && ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiSaturation, {
355
343
  id: id,
356
344
  color: usableHsv,
357
345
  hex: chromaColor ? chromaColor.hex() : undefined,
358
346
  onChange: handleColorSelection,
359
- ref: saturationRef
347
+ ref: saturationRef,
348
+ onKeyDown: handleOnKeyDown
360
349
  }), ___EmotionJSX(EuiHue, {
361
350
  id: id,
362
351
  hue: usableHsv[0],
363
352
  hex: chromaColor ? chromaColor.hex() : undefined,
364
- onChange: handleHueSelection
353
+ onChange: handleHueSelection,
354
+ onKeyDown: handleOnKeyDown
365
355
  })), showSwatches && ___EmotionJSX("ul", {
356
+ css: styles.euiColorPicker__swatches,
366
357
  className: "euiColorPicker__swatches"
367
358
  }, swatches.map(function (swatch, index) {
368
359
  return ___EmotionJSX("li", {
369
- className: "euiColorPicker__swatch-item",
370
360
  key: swatch
371
361
  }, ___EmotionJSX(EuiColorPickerSwatch, {
372
- className: swatchClass,
373
362
  color: swatch,
374
363
  onClick: function onClick() {
375
364
  return handleSwatchSelection(swatch);
376
365
  },
377
366
  ref: index === 0 ? swatchRef : undefined
378
367
  }));
379
- })), secondaryInputDisplay === 'bottom' && ___EmotionJSX(React.Fragment, null, mode !== 'picker' && ___EmotionJSX(EuiSpacer, {
380
- size: "s"
381
- }), inlineInput), showAlpha && ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiSpacer, {
382
- size: "s"
383
- }), ___EmotionJSX(EuiRange, {
368
+ })), secondaryInputDisplay === 'bottom' && inlineInput, showAlpha && ___EmotionJSX(EuiRange, {
369
+ css: styles.euiColorPicker__alphaRange,
384
370
  className: "euiColorPicker__alphaRange",
385
371
  "data-test-subj": "euiColorPickerAlpha",
386
372
  compressed: true,
@@ -391,7 +377,7 @@ export var EuiColorPicker = function EuiColorPicker(_ref) {
391
377
  append: "%",
392
378
  onChange: handleAlphaSelection,
393
379
  "aria-label": alphaLabel
394
- })));
380
+ }));
395
381
  var buttonOrInput;
396
382
  if (button) {
397
383
  buttonOrInput = /*#__PURE__*/cloneElement(button, {
@@ -406,7 +392,8 @@ export var EuiColorPicker = function EuiColorPicker(_ref) {
406
392
  icon: chromaColor ? {
407
393
  type: 'swatchInput',
408
394
  side: 'left',
409
- color: colorStyle
395
+ color: colorStyle,
396
+ css: styles.euiColorPicker__swatchInputIcon
410
397
  } : {
411
398
  type: 'stopSlash',
412
399
  side: 'left',
@@ -425,15 +412,13 @@ export var EuiColorPicker = function EuiColorPicker(_ref) {
425
412
  isDisabled: disabled,
426
413
  isDropdown: true
427
414
  }, ___EmotionJSX(EuiFieldText, {
428
- className: inputClasses,
415
+ className: "euiColorPicker__input",
429
416
  onClick: handleInputActivity,
430
417
  onKeyDown: handleInputActivity,
431
418
  onBlur: handleOnBlur,
432
419
  value: color ? color.toUpperCase() : HEX_FALLBACK,
433
420
  placeholder: !color ? placeholder || transparent : undefined,
434
421
  id: id,
435
- icon: "empty" // Required to make space (left padding) for the color swatch icon
436
- ,
437
422
  onChange: handleColorInput,
438
423
  inputRef: setInputRef,
439
424
  isInvalid: isInvalid,
@@ -448,6 +433,7 @@ export var EuiColorPicker = function EuiColorPicker(_ref) {
448
433
  }));
449
434
  }
450
435
  return display === 'inline' ? ___EmotionJSX("div", {
436
+ css: styles.euiColorPicker,
451
437
  className: classes
452
438
  }, composite) : ___EmotionJSX(EuiPopover, {
453
439
  initialFocus: inputRef !== null && inputRef !== void 0 ? inputRef : undefined,
@@ -455,8 +441,8 @@ export var EuiColorPicker = function EuiColorPicker(_ref) {
455
441
  isOpen: isColorSelectorShown,
456
442
  closePopover: handleFinalSelection,
457
443
  zIndex: popoverZIndex,
458
- className: popoverClass,
459
- panelClassName: panelClasses,
444
+ className: "euiColorPicker__popoverAnchor",
445
+ panelClassName: "euiColorPicker__popoverPanel",
460
446
  display: button ? 'inline-block' : 'block',
461
447
  attachToAnchor: button ? false : true,
462
448
  anchorPosition: "downLeft",
@@ -467,6 +453,7 @@ export var EuiColorPicker = function EuiColorPicker(_ref) {
467
453
  shards: [inputRef]
468
454
  } : undefined
469
455
  }, ___EmotionJSX("div", {
456
+ css: styles.euiColorPicker,
470
457
  className: classes,
471
458
  "data-test-subj": "euiColorPickerPopover"
472
459
  }, composite));
@@ -6,12 +6,22 @@
6
6
  * Side Public License, v 1.
7
7
  */
8
8
 
9
- import { mathWithUnits } from '../../global_styling';
10
- export var euiColorPickerVariables = function euiColorPickerVariables(euiThemeContext) {
9
+ import { css } from '@emotion/react';
10
+ import { transparentize } from '../../services';
11
+ import { logicalCSS, mathWithUnits } from '../../global_styling';
12
+ export var euiColorPickerStyles = function euiColorPickerStyles(euiThemeContext) {
11
13
  var euiTheme = euiThemeContext.euiTheme;
14
+
15
+ // 5 columns of swatches + margins + border
16
+ var colorPickerWidth = mathWithUnits([euiTheme.size.l, euiTheme.size.s], function (x, y) {
17
+ return x * 5 + y * 4;
18
+ });
12
19
  return {
13
- width: mathWithUnits([euiTheme.size.l, euiTheme.size.s], function (x, y) {
14
- return x * 5 + y * 4;
15
- })
20
+ euiColorPicker: /*#__PURE__*/css("position:relative;", logicalCSS('width', colorPickerWidth), "display:flex;flex-direction:column;gap:", euiTheme.size.s, ";;label:euiColorPicker;"),
21
+ euiColorPicker__swatches: /*#__PURE__*/css("display:flex;flex-wrap:wrap;gap:", euiTheme.size.s, ";;label:euiColorPicker__swatches;"),
22
+ euiColorPicker__alphaRange: /*#__PURE__*/css(".euiRangeInput{", logicalCSS('min-width', 0), ";};label:euiColorPicker__alphaRange;"),
23
+ // Adds a stroke color for the swatchInput icon. Unlike most EuiIcons it has a stroke in the SVG
24
+ // Targets a custom className applied directly to the <svg> icon
25
+ euiColorPicker__swatchInputIcon: /*#__PURE__*/css(".euiSwatchInput__stroke{fill:none;stroke:", transparentize(euiTheme.colors.fullShade, 0.2), ";};label:euiColorPicker__swatchInputIcon;")
16
26
  };
17
27
  };
@@ -19,8 +19,10 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
19
19
  import React, { forwardRef, useMemo } from 'react';
20
20
  import PropTypes from "prop-types";
21
21
  import classNames from 'classnames';
22
- import { getChromaColor } from './utils';
22
+ import { useEuiMemoizedStyles } from '../../services';
23
23
  import { useEuiI18n } from '../i18n';
24
+ import { getChromaColor } from './utils';
25
+ import { euiColorPickerSwatchStyles } from './color_picker_swatch.styles';
24
26
  import { jsx as ___EmotionJSX } from "@emotion/react";
25
27
  export var EuiColorPickerSwatch = /*#__PURE__*/forwardRef(function (_ref, ref) {
26
28
  var className = _ref.className,
@@ -28,6 +30,7 @@ export var EuiColorPickerSwatch = /*#__PURE__*/forwardRef(function (_ref, ref) {
28
30
  style = _ref.style,
29
31
  rest = _objectWithoutProperties(_ref, _excluded);
30
32
  var classes = classNames('euiColorPickerSwatch', className);
33
+ var styles = useEuiMemoizedStyles(euiColorPickerSwatchStyles);
31
34
  var chromaColor = useMemo(function () {
32
35
  return getChromaColor(color, true);
33
36
  }, [color]);
@@ -39,6 +42,7 @@ export var EuiColorPickerSwatch = /*#__PURE__*/forwardRef(function (_ref, ref) {
39
42
  });
40
43
  return ___EmotionJSX("button", _extends({
41
44
  type: "button",
45
+ css: styles.euiColorPickerSwatch,
42
46
  className: classes,
43
47
  "aria-label": ariaLabel,
44
48
  ref: ref,
@@ -0,0 +1,19 @@
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
+
9
+ import { css } from '@emotion/react';
10
+ import { transparentize } from '../../services';
11
+ import { logicalSizeCSS, mathWithUnits, euiOutline } from '../../global_styling';
12
+ export var euiColorPickerSwatchStyles = function euiColorPickerSwatchStyles(euiThemeContext) {
13
+ var euiTheme = euiThemeContext.euiTheme;
14
+ return {
15
+ euiColorPickerSwatch: /*#__PURE__*/css("display:inline-block;", logicalSizeCSS(euiTheme.size.l), " border-radius:", mathWithUnits(euiTheme.border.radius.medium, function (x) {
16
+ return x / 2;
17
+ }), ";border:", euiTheme.border.width.thin, " solid ", transparentize(euiTheme.colors.fullShade, 0.1), ";box-shadow:inset 0 0 0 ", euiTheme.border.width.thin, " ", transparentize(euiTheme.colors.emptyShade, 0.05), ";cursor:pointer;&:disabled{cursor:default;}&:focus{", euiOutline(euiThemeContext, 'center'), ";};label:euiColorPickerSwatch;")
18
+ };
19
+ };
@@ -13,8 +13,10 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
13
13
  import React from 'react';
14
14
  import PropTypes from "prop-types";
15
15
  import classNames from 'classnames';
16
+ import { useEuiMemoizedStyles } from '../../services';
16
17
  import { EuiScreenReaderOnly } from '../accessibility';
17
18
  import { EuiI18n } from '../i18n';
19
+ import { euiHueStyles } from './hue.styles';
18
20
  import { jsx as ___EmotionJSX } from "@emotion/react";
19
21
  var HUE_RANGE = 359;
20
22
  export var EuiHue = function EuiHue(_ref) {
@@ -25,29 +27,32 @@ export var EuiHue = function EuiHue(_ref) {
25
27
  id = _ref.id,
26
28
  onChange = _ref.onChange,
27
29
  rest = _objectWithoutProperties(_ref, _excluded);
30
+ var classes = classNames('euiHue', className);
31
+ var styles = useEuiMemoizedStyles(euiHueStyles);
28
32
  var handleChange = function handleChange(e) {
29
33
  onChange(Number(e.target.value));
30
34
  };
31
- var classes = classNames('euiHue', className);
32
- return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("label", {
35
+ return ___EmotionJSX("div", {
36
+ css: styles.euiHue,
37
+ className: classes
38
+ }, ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("label", {
33
39
  htmlFor: "".concat(id, "-hue")
34
40
  }, ___EmotionJSX(EuiI18n, {
35
41
  token: "euiHue.label",
36
42
  default: "Select the HSV color mode 'hue' value"
37
43
  }))), ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("p", {
38
44
  "aria-live": "polite"
39
- }, hex)), ___EmotionJSX("div", {
40
- className: classes
41
- }, ___EmotionJSX("input", _extends({
45
+ }, hex)), ___EmotionJSX("input", _extends({
42
46
  id: "".concat(id, "-hue"),
43
47
  min: 0,
44
48
  max: HUE_RANGE,
45
49
  step: 1,
46
50
  type: "range",
51
+ css: styles.euiHue__range,
47
52
  className: "euiHue__range",
48
53
  value: hue,
49
54
  onChange: handleChange
50
- }, rest))));
55
+ }, rest)));
51
56
  };
52
57
  EuiHue.propTypes = {
53
58
  className: PropTypes.string,
@@ -0,0 +1,29 @@
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
+
9
+ import { css } from '@emotion/react';
10
+ import { transparentize } from '../../services';
11
+ import { logicalCSS, mathWithUnits } from '../../global_styling';
12
+ import { euiRangeThumbPerBrowser, euiRangeThumbStyle, euiRangeThumbFocusBoxShadow } from '../form/range/range.styles';
13
+ export var euiHueStyles = function euiHueStyles(euiThemeContext) {
14
+ var euiTheme = euiThemeContext.euiTheme;
15
+ var height = euiTheme.size.m;
16
+ var thumbSize = euiTheme.size.l;
17
+ var thumbBorder = mathWithUnits(euiTheme.border.width.thick, function (x) {
18
+ return x * 1.5;
19
+ });
20
+ var thumbBoxShadow = "\n 0 2px 2px -1px ".concat(transparentize(euiTheme.colors.shadow, 0.2), ",\n 0 1px 5px -2px ").concat(transparentize(euiTheme.colors.shadow, 0.2));
21
+ return {
22
+ // This wraps the range and sets a rainbow gradient,
23
+ // which allows the range thumb to be larger than the visible track
24
+ euiHue: /*#__PURE__*/css(logicalCSS('height', height), " border-radius:", height, ";background:linear-gradient(\n to right,\n #ff3232 0%,\n #fff130 20%,\n #45ff30 35%,\n #28fff0 52%,\n #282cff 71%,\n #ff28fb 88%,\n #ff0094 100%\n );;label:euiHue;"),
25
+ euiHue__range: /*#__PURE__*/css(logicalCSS('height', thumbSize), logicalCSS('width', "calc(100% + 2px)"), logicalCSS('margin-horizontal', '-1px'), " ", logicalCSS('margin-top', mathWithUnits(height, function (x) {
26
+ return x / -2;
27
+ })), "appearance:none;background:transparent;&::-webkit-slider-thumb{-webkit-appearance:none;}", euiRangeThumbPerBrowser([euiRangeThumbStyle(euiThemeContext), 'background-color: inherit', "border-width: ".concat(thumbBorder), 'border-radius: 100%', "box-shadow: ".concat(thumbBoxShadow)].join(';\n')), "&:focus{outline:none;}&:focus-visible{", euiRangeThumbPerBrowser(euiRangeThumbFocusBoxShadow(euiThemeContext)), ";};label:euiHue__range;")
28
+ };
29
+ };
@@ -1,5 +1,5 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["className", "color", "data-test-subj", "hex", "id", "onChange"];
2
+ var _excluded = ["className", "color", "data-test-subj", "hex", "id", "onChange", "onKeyDown"];
3
3
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
4
4
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
5
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -22,13 +22,15 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
22
22
  * Side Public License, v 1.
23
23
  */
24
24
 
25
- import React, { forwardRef, useEffect, useRef, useState } from 'react';
25
+ import React, { forwardRef, useEffect, useRef, useState, useCallback } from 'react';
26
26
  import PropTypes from "prop-types";
27
27
  import classNames from 'classnames';
28
- import { keys, useMouseMove } from '../../services';
28
+ import { keys, useMouseMove, useEuiMemoizedStyles, useGeneratedHtmlId } from '../../services';
29
29
  import { isNil } from '../../services/predicate';
30
+ import { logicalStyles } from '../../global_styling';
30
31
  import { useEuiI18n } from '../i18n';
31
32
  import { getEventPosition } from './utils';
33
+ import { euiSaturationStyles } from './saturation.styles';
32
34
  import { jsx as ___EmotionJSX } from "@emotion/react";
33
35
  var colorDefaultValue = [1, 0, 0];
34
36
  export var EuiSaturation = /*#__PURE__*/forwardRef(function (_ref, ref) {
@@ -38,9 +40,17 @@ export var EuiSaturation = /*#__PURE__*/forwardRef(function (_ref, ref) {
38
40
  _ref$dataTestSubj = _ref['data-test-subj'],
39
41
  dataTestSubj = _ref$dataTestSubj === void 0 ? 'euiSaturation' : _ref$dataTestSubj,
40
42
  hex = _ref.hex,
41
- id = _ref.id,
43
+ _id = _ref.id,
42
44
  onChange = _ref.onChange,
45
+ onKeyDown = _ref.onKeyDown,
43
46
  rest = _objectWithoutProperties(_ref, _excluded);
47
+ var classes = classNames('euiSaturation', className);
48
+ var styles = useEuiMemoizedStyles(euiSaturationStyles);
49
+ var id = useGeneratedHtmlId({
50
+ conditionalId: _id
51
+ });
52
+ var instructionsId = "".concat(id, "-instructions");
53
+ var indicatorId = "".concat(id, "-saturationIndicator");
44
54
  var _useEuiI18n = useEuiI18n(['euiSaturation.ariaLabel', 'euiSaturation.screenReaderInstructions'], ['HSV color mode saturation and value 2-axis slider', "Arrow keys to navigate the square color gradient. Coordinates will be used to calculate HSV color mode 'saturation' and 'value' numbers, in the range of 0 to 1. Left and right to change the saturation. Up and down change the value."]),
45
55
  _useEuiI18n2 = _slicedToArray(_useEuiI18n, 2),
46
56
  roleDescString = _useEuiI18n2[0],
@@ -72,7 +82,7 @@ export var EuiSaturation = /*#__PURE__*/forwardRef(function (_ref, ref) {
72
82
  });
73
83
  }
74
84
  }, [color, lastColor]);
75
- var calculateColor = function calculateColor(_ref2) {
85
+ var calculateColor = useCallback(function (_ref2) {
76
86
  var top = _ref2.top,
77
87
  height = _ref2.height,
78
88
  left = _ref2.left,
@@ -82,8 +92,8 @@ export var EuiSaturation = /*#__PURE__*/forwardRef(function (_ref, ref) {
82
92
  var s = left / width;
83
93
  var v = 1 - top / height;
84
94
  return [h, s, v];
85
- };
86
- var handleUpdate = function handleUpdate(box) {
95
+ }, [color]);
96
+ var handleUpdate = useCallback(function (box) {
87
97
  var left = box.left,
88
98
  top = box.top;
89
99
  setIndicator({
@@ -93,17 +103,18 @@ export var EuiSaturation = /*#__PURE__*/forwardRef(function (_ref, ref) {
93
103
  var newColor = calculateColor(box);
94
104
  setLastColor(newColor);
95
105
  onChange(newColor);
96
- };
97
- var handleChange = function handleChange(location) {
106
+ }, [calculateColor, onChange]);
107
+ var handleChange = useCallback(function (location) {
98
108
  if (isNil(boxRef === null || boxRef === void 0 ? void 0 : boxRef.current)) return;
99
109
  var box = getEventPosition(location, boxRef.current);
100
110
  handleUpdate(box);
101
- };
111
+ }, [handleUpdate]);
102
112
  var _useMouseMove = useMouseMove(handleChange, boxRef.current),
103
113
  _useMouseMove2 = _slicedToArray(_useMouseMove, 2),
104
114
  handleMouseDown = _useMouseMove2[0],
105
115
  handleInteraction = _useMouseMove2[1];
106
- var handleKeyDown = function handleKeyDown(event) {
116
+ var handleKeyDown = useCallback(function (event) {
117
+ onKeyDown === null || onKeyDown === void 0 || onKeyDown(event);
107
118
  if (isNil(boxRef === null || boxRef === void 0 ? void 0 : boxRef.current)) return;
108
119
  var _boxRef$current$getBo2 = boxRef.current.getBoundingClientRect(),
109
120
  height = _boxRef$current$getBo2.height,
@@ -144,15 +155,14 @@ export var EuiSaturation = /*#__PURE__*/forwardRef(function (_ref, ref) {
144
155
  height: height
145
156
  }, newPosition));
146
157
  onChange(newColor);
147
- };
148
- var classes = classNames('euiSaturation', className);
149
- var instructionsId = "".concat(id, "-instructions");
158
+ }, [calculateColor, indicator, onChange, onKeyDown]);
150
159
  return ___EmotionJSX("div", _extends({
151
160
  onMouseDown: handleMouseDown,
152
161
  onTouchStart: handleInteraction,
153
162
  onTouchMove: handleInteraction,
154
163
  onKeyDown: handleKeyDown,
155
164
  ref: ref,
165
+ css: styles.euiSaturation,
156
166
  className: classes,
157
167
  "data-test-subj": dataTestSubj,
158
168
  style: {
@@ -160,14 +170,17 @@ export var EuiSaturation = /*#__PURE__*/forwardRef(function (_ref, ref) {
160
170
  },
161
171
  tabIndex: -1
162
172
  }, rest), ___EmotionJSX("div", {
173
+ css: styles.euiSaturation__lightness,
163
174
  className: "euiSaturation__lightness",
164
175
  ref: boxRef
165
176
  }, ___EmotionJSX("div", {
177
+ css: styles.euiSaturation__saturation,
166
178
  className: "euiSaturation__saturation"
167
179
  })), ___EmotionJSX("button", {
168
- id: "".concat(id, "-saturationIndicator"),
180
+ id: indicatorId,
181
+ css: styles.euiSaturation__indicator,
169
182
  className: "euiSaturation__indicator",
170
- style: _objectSpread({}, indicator),
183
+ style: logicalStyles(indicator),
171
184
  "aria-roledescription": roleDescString,
172
185
  "aria-label": hex,
173
186
  "aria-describedby": instructionsId
@@ -0,0 +1,23 @@
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
+
9
+ import { css } from '@emotion/react';
10
+ import { logicalCSS, logicalSizeCSS, mathWithUnits } from '../../global_styling';
11
+ export var euiSaturationStyles = function euiSaturationStyles(euiThemeContext) {
12
+ var euiTheme = euiThemeContext.euiTheme;
13
+ var indicatorSize = euiTheme.size.m;
14
+ var borderRadius = mathWithUnits(euiTheme.border.radius.medium, function (x) {
15
+ return x / 2;
16
+ });
17
+ return {
18
+ euiSaturation: /*#__PURE__*/css("z-index:3;position:relative;", logicalCSS('width', '100%'), " ", logicalCSS('padding-bottom', '100%'), " border-radius:", borderRadius, ";touch-action:none;&:focus,&:focus-within{outline:none;.euiSaturation__indicator{outline:none;box-shadow:0 0 0 ", euiTheme.focus.width, " ", euiTheme.colors.primary, ";border-color:", euiTheme.colors.primary, ";}};label:euiSaturation;"),
19
+ euiSaturation__lightness: /*#__PURE__*/css("position:absolute;inset:0;", logicalCSS('top', '-1px'), "border-radius:", borderRadius, ";background:linear-gradient(\n to right,\n rgba(255, 255, 255, 1),\n rgba(255, 255, 255, 0)\n );;label:euiSaturation__lightness;"),
20
+ euiSaturation__saturation: /*#__PURE__*/css("position:absolute;inset:0;", logicalCSS('top', '-1px'), "border-radius:", borderRadius, ";background:linear-gradient(to top, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0));;label:euiSaturation__saturation;"),
21
+ euiSaturation__indicator: /*#__PURE__*/css("position:absolute;", logicalSizeCSS(indicatorSize), " transform:translateX(-50%) translateY(-50%);border:", euiTheme.border.width.thin, " solid ", euiTheme.colors.darkestShade, ";border-radius:100%;&::before{content:'';position:absolute;inset:0;border-radius:100%;border:", euiTheme.border.width.thin, " solid ", euiTheme.colors.lightestShade, ";};label:euiSaturation__indicator;")
22
+ };
23
+ };
@@ -115,9 +115,9 @@ export var EuiFilePickerClass = /*#__PURE__*/function (_Component) {
115
115
  var _ref = this.context,
116
116
  defaultFullWidth = _ref.defaultFullWidth;
117
117
  return ___EmotionJSX(EuiI18n, {
118
- token: "euiFilePicker.clearSelectedFiles",
119
- default: "Clear selected files"
120
- }, function (clearSelectedFiles) {
118
+ token: "euiFilePicker.removeSelectedAriaLabel",
119
+ default: "Remove selected files"
120
+ }, function (removeSelectedAriaLabel) {
121
121
  var _this2$props = _this2.props,
122
122
  stylesMemoizer = _this2$props.stylesMemoizer,
123
123
  id = _this2$props.id,
@@ -159,7 +159,7 @@ export var EuiFilePickerClass = /*#__PURE__*/function (_Component) {
159
159
  } else if (isOverridingInitialPrompt && !disabled) {
160
160
  if (normalFormControl) {
161
161
  clearButton = ___EmotionJSX(EuiFormControlLayoutClearButton, {
162
- "aria-label": clearSelectedFiles,
162
+ "aria-label": removeSelectedAriaLabel,
163
163
  css: [styles.euiFilePicker__clearButton, rightIconStyles, ";label:clearButton;"],
164
164
  className: "euiFilePicker__clearButton",
165
165
  onClick: _this2.removeFiles,
@@ -167,7 +167,7 @@ export var EuiFilePickerClass = /*#__PURE__*/function (_Component) {
167
167
  });
168
168
  } else {
169
169
  clearButton = ___EmotionJSX(EuiButtonEmpty, {
170
- "aria-label": clearSelectedFiles,
170
+ "aria-label": removeSelectedAriaLabel,
171
171
  css: styles.euiFilePicker__clearButton,
172
172
  className: "euiFilePicker__clearButton",
173
173
  size: "xs",
@@ -82,7 +82,7 @@ export var euiRangeThumbStyle = function euiRangeThumbStyle(euiThemeContext) {
82
82
  return "\n ".concat(euiRangeThumbBoxShadow(euiThemeContext), ";\n ").concat(euiRangeThumbBorder(euiThemeContext), ";\n cursor: pointer;\n background-color: ").concat(range.thumbBackgroundColor, ";\n padding: 0;\n block-size: ").concat(range.thumbHeight, ";\n inline-size: ").concat(range.thumbWidth, ";\n box-sizing: border-box; // required for firefox or the border makes the width and height to increase\n ");
83
83
  };
84
84
  export var euiRangeThumbPerBrowser = function euiRangeThumbPerBrowser(content) {
85
- return "\n &::-webkit-slider-thumb { ".concat(content, "; }\n &::-moz-range-thumb { ").concat(content, "; }\n &::-ms-thumb {").concat(content, "; }\n ");
85
+ return "\n &::-webkit-slider-thumb { ".concat(content, "; }\n &::-moz-range-thumb { ").concat(content, "; }\n &::-ms-thumb {").concat(content, "; }\n ");
86
86
  };
87
87
  export var euiRangeThumbFocus = function euiRangeThumbFocus(euiThemeContext, color) {
88
88
  var range = euiRangeVariables(euiThemeContext);
@@ -13,7 +13,7 @@ import { euiFormVariables } from '../form/form.styles';
13
13
  export var euiModalStyles = function euiModalStyles(euiThemeContext) {
14
14
  var euiTheme = euiThemeContext.euiTheme;
15
15
  return {
16
- euiModal: /*#__PURE__*/css(euiShadowXLarge(euiThemeContext), " display:flex;flex-direction:column;max-block-size:75vh;position:relative;background-color:", euiTheme.colors.emptyShade, ";border-radius:", euiTheme.border.radius.medium, ";z-index:", euiTheme.levels.modal, ";min-inline-size:", euiFormVariables(euiThemeContext).maxWidth, ";max-inline-size:calc(100vw - ", euiTheme.size.base, ");", euiCanAnimate, "{animation:", euiAnimSlideInUp(euiTheme.size.xxl), " ", euiTheme.animation.slow, " ", euiTheme.animation.bounce, ";}", euiMaxBreakpoint(euiThemeContext, 'm'), "{position:fixed;inset:0;border-radius:0;inline-size:100vw!important;min-inline-size:0!important;max-inline-size:none!important;max-block-size:100vh!important;}&:focus{outline:none;};label:euiModal;"),
16
+ euiModal: /*#__PURE__*/css(euiShadowXLarge(euiThemeContext), " display:flex;flex-direction:column;max-block-size:75vh;position:relative;background-color:", euiTheme.colors.emptyShade, ";border-radius:", euiTheme.border.radius.medium, ";z-index:", euiTheme.levels.modal, ";min-inline-size:", euiFormVariables(euiThemeContext).maxWidth, ";max-inline-size:calc(100vw - ", euiTheme.size.base, ");overflow:hidden;", euiCanAnimate, "{animation:", euiAnimSlideInUp(euiTheme.size.xxl), " ", euiTheme.animation.slow, " ", euiTheme.animation.bounce, ";}", euiMaxBreakpoint(euiThemeContext, 'm'), "{position:fixed;inset:0;border-radius:0;inline-size:100vw!important;min-inline-size:0!important;max-inline-size:none!important;max-block-size:100vh!important;}&:focus{outline:none;};label:euiModal;"),
17
17
  // Variants
18
18
  defaultMaxWidth: /*#__PURE__*/css("max-inline-size:min(\n ", euiTheme.breakpoint.m, "px,\n calc(100vw - ", euiTheme.size.base, ")\n );;label:defaultMaxWidth;"),
19
19
  confirmation: /*#__PURE__*/css("min-inline-size:", euiFormVariables(euiThemeContext).maxWidth, ";", euiMaxBreakpoint(euiThemeContext, 'm'), "{", euiShadowXLarge(euiThemeContext, {
@@ -125,9 +125,11 @@ export var EuiPopover = /*#__PURE__*/function (_Component) {
125
125
  });
126
126
  _defineProperty(_this, "handleStrandedFocus", function () {
127
127
  _this.strandedFocusTimeout = window.setTimeout(function () {
128
- // If `returnFocus` failed and focus was stranded on the body,
129
- // attempt to manually restore focus to the toggle button
130
- if (document.activeElement === document.body) {
128
+ // If `returnFocus` failed and focus was stranded,
129
+ // attempt to manually restore focus to the toggle button.
130
+ // The stranded focus is either in most cases on body but
131
+ // it will be on the panel instead on mount when isOpen=true
132
+ if (document.activeElement === document.body || document.activeElement === _this.panel) {
131
133
  if (!_this.button) return;
132
134
  var focusableItems = focusable(_this.button);
133
135
  if (!focusableItems.length) return;