@elastic/eui 75.0.0 → 75.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 (125) hide show
  1. package/dist/eui_theme_dark.css +0 -323
  2. package/dist/eui_theme_dark.min.css +1 -1
  3. package/dist/eui_theme_light.css +0 -323
  4. package/dist/eui_theme_light.min.css +1 -1
  5. package/es/components/code/code_block.js +5 -3
  6. package/es/components/code/code_block_annotations.js +94 -0
  7. package/es/components/code/code_block_annotations.style.js +18 -0
  8. package/es/components/code/code_block_full_screen.js +9 -3
  9. package/es/components/code/code_block_line.styles.js +3 -2
  10. package/es/components/code/utils.js +53 -13
  11. package/es/components/form/range/range_track.js +1 -1
  12. package/es/components/icon/assets/app_agent.js +2 -10
  13. package/es/components/icon/assets/app_fleet.js +10 -2
  14. package/es/components/steps/step.js +19 -12
  15. package/es/components/steps/step.styles.js +73 -0
  16. package/es/components/steps/step_horizontal.js +55 -42
  17. package/es/components/steps/step_horizontal.styles.js +55 -0
  18. package/es/components/steps/step_number.js +82 -73
  19. package/es/components/steps/step_number.styles.js +76 -0
  20. package/es/components/steps/steps_horizontal.js +11 -7
  21. package/es/components/steps/steps_horizontal.styles.js +35 -0
  22. package/es/components/steps/sub_steps.js +7 -1
  23. package/es/components/steps/sub_steps.styles.js +14 -0
  24. package/es/components/tour/tour_step_indicator.js +0 -3
  25. package/es/global_styling/utility/animations.js +4 -3
  26. package/eui.d.ts +115 -4
  27. package/i18ntokens.json +26 -10
  28. package/lib/components/code/code_block.js +5 -3
  29. package/lib/components/code/code_block_annotations.js +113 -0
  30. package/lib/components/code/code_block_annotations.style.js +29 -0
  31. package/lib/components/code/code_block_full_screen.js +9 -3
  32. package/lib/components/code/code_block_line.styles.js +3 -2
  33. package/lib/components/code/utils.js +54 -13
  34. package/lib/components/form/range/range_track.js +1 -1
  35. package/lib/components/icon/assets/app_agent.js +2 -10
  36. package/lib/components/icon/assets/app_fleet.js +10 -2
  37. package/lib/components/icon/svgs/app_agent.svg +2 -4
  38. package/lib/components/icon/svgs/app_fleet.svg +4 -2
  39. package/lib/components/steps/step.js +21 -12
  40. package/lib/components/steps/step.styles.js +93 -0
  41. package/lib/components/steps/step_horizontal.js +56 -41
  42. package/lib/components/steps/step_horizontal.styles.js +66 -0
  43. package/lib/components/steps/step_number.js +86 -75
  44. package/lib/components/steps/step_number.styles.js +84 -0
  45. package/lib/components/steps/steps_horizontal.js +12 -7
  46. package/lib/components/steps/steps_horizontal.styles.js +38 -0
  47. package/lib/components/steps/sub_steps.js +9 -1
  48. package/lib/components/steps/sub_steps.styles.js +24 -0
  49. package/lib/components/tour/tour_step_indicator.js +0 -3
  50. package/lib/global_styling/utility/animations.js +6 -4
  51. package/optimize/es/components/code/code_block_annotations.js +79 -0
  52. package/optimize/es/components/code/code_block_annotations.style.js +18 -0
  53. package/optimize/es/components/code/code_block_full_screen.js +9 -3
  54. package/optimize/es/components/code/code_block_line.styles.js +3 -2
  55. package/optimize/es/components/code/utils.js +53 -13
  56. package/optimize/es/components/form/range/range_track.js +1 -1
  57. package/optimize/es/components/icon/assets/app_agent.js +2 -10
  58. package/optimize/es/components/icon/assets/app_fleet.js +10 -2
  59. package/optimize/es/components/steps/step.js +19 -12
  60. package/optimize/es/components/steps/step.styles.js +73 -0
  61. package/optimize/es/components/steps/step_horizontal.js +54 -41
  62. package/optimize/es/components/steps/step_horizontal.styles.js +55 -0
  63. package/optimize/es/components/steps/step_number.js +82 -73
  64. package/optimize/es/components/steps/step_number.styles.js +76 -0
  65. package/optimize/es/components/steps/steps_horizontal.js +11 -7
  66. package/optimize/es/components/steps/steps_horizontal.styles.js +35 -0
  67. package/optimize/es/components/steps/sub_steps.js +7 -1
  68. package/optimize/es/components/steps/sub_steps.styles.js +14 -0
  69. package/optimize/es/components/tour/tour_step_indicator.js +0 -3
  70. package/optimize/es/global_styling/utility/animations.js +4 -3
  71. package/optimize/lib/components/code/code_block_annotations.js +105 -0
  72. package/optimize/lib/components/code/code_block_annotations.style.js +29 -0
  73. package/optimize/lib/components/code/code_block_full_screen.js +9 -3
  74. package/optimize/lib/components/code/code_block_line.styles.js +3 -2
  75. package/optimize/lib/components/code/utils.js +54 -13
  76. package/optimize/lib/components/form/range/range_track.js +1 -1
  77. package/optimize/lib/components/icon/assets/app_agent.js +2 -10
  78. package/optimize/lib/components/icon/assets/app_fleet.js +10 -2
  79. package/optimize/lib/components/icon/svgs/app_agent.svg +2 -4
  80. package/optimize/lib/components/icon/svgs/app_fleet.svg +4 -2
  81. package/optimize/lib/components/steps/step.js +21 -12
  82. package/optimize/lib/components/steps/step.styles.js +93 -0
  83. package/optimize/lib/components/steps/step_horizontal.js +55 -40
  84. package/optimize/lib/components/steps/step_horizontal.styles.js +66 -0
  85. package/optimize/lib/components/steps/step_number.js +86 -75
  86. package/optimize/lib/components/steps/step_number.styles.js +84 -0
  87. package/optimize/lib/components/steps/steps_horizontal.js +12 -7
  88. package/optimize/lib/components/steps/steps_horizontal.styles.js +38 -0
  89. package/optimize/lib/components/steps/sub_steps.js +9 -1
  90. package/optimize/lib/components/steps/sub_steps.styles.js +24 -0
  91. package/optimize/lib/components/tour/tour_step_indicator.js +0 -3
  92. package/optimize/lib/global_styling/utility/animations.js +6 -4
  93. package/package.json +2 -2
  94. package/src/components/index.scss +0 -1
  95. package/src/themes/amsterdam/global_styling/variables/_index.scss +0 -1
  96. package/src/themes/amsterdam/overrides/_index.scss +0 -1
  97. package/test-env/components/code/code_block_annotations.js +110 -0
  98. package/test-env/components/code/code_block_annotations.style.js +29 -0
  99. package/test-env/components/code/code_block_full_screen.js +9 -3
  100. package/test-env/components/code/code_block_line.styles.js +3 -2
  101. package/test-env/components/code/utils.js +54 -13
  102. package/test-env/components/form/range/range_track.js +1 -1
  103. package/test-env/components/icon/assets/app_agent.js +2 -10
  104. package/test-env/components/icon/assets/app_fleet.js +10 -2
  105. package/test-env/components/steps/step.js +21 -12
  106. package/test-env/components/steps/step.styles.js +93 -0
  107. package/test-env/components/steps/step_horizontal.js +56 -41
  108. package/test-env/components/steps/step_horizontal.styles.js +66 -0
  109. package/test-env/components/steps/step_number.js +86 -75
  110. package/test-env/components/steps/step_number.styles.js +84 -0
  111. package/test-env/components/steps/steps_horizontal.js +12 -7
  112. package/test-env/components/steps/steps_horizontal.styles.js +38 -0
  113. package/test-env/components/steps/sub_steps.js +9 -1
  114. package/test-env/components/steps/sub_steps.styles.js +24 -0
  115. package/test-env/components/tour/tour_step_indicator.js +0 -3
  116. package/test-env/global_styling/utility/animations.js +6 -4
  117. package/src/components/steps/_index.scss +0 -7
  118. package/src/components/steps/_mixins.scss +0 -12
  119. package/src/components/steps/_step_number.scss +0 -52
  120. package/src/components/steps/_steps.scss +0 -57
  121. package/src/components/steps/_steps_horizontal.scss +0 -135
  122. package/src/components/steps/_sub_steps.scss +0 -15
  123. package/src/components/steps/_variables.scss +0 -11
  124. package/src/themes/amsterdam/global_styling/variables/_steps.scss +0 -8
  125. package/src/themes/amsterdam/overrides/_steps.scss +0 -101
@@ -219,12 +219,14 @@ EuiCodeBlock.propTypes = {
219
219
 
220
220
  /**
221
221
  * Displays line numbers.
222
- * Optionally accepts a configuration object for setting the starting number and visual highlighting ranges:
223
- * `{ start: 100, highlight: '1, 5-10, 20-30, 40' }`
222
+ * Optionally accepts a configuration object for setting the starting number,
223
+ * visually highlighting ranges, or annotating specific lines:
224
+ * `{ start: 100, highlight: '1, 5-10, 20-30, 40', annotations: { 6: 'A special note about this line' } }`
224
225
  */
225
226
  lineNumbers: PropTypes.oneOfType([PropTypes.bool.isRequired, PropTypes.shape({
226
227
  start: PropTypes.number,
227
- highlight: PropTypes.string
228
+ highlight: PropTypes.string,
229
+ annotations: PropTypes.any
228
230
  }).isRequired]),
229
231
 
230
232
  /**
@@ -0,0 +1,94 @@
1
+ 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); }
2
+
3
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
+
5
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6
+
7
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
+
9
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
10
+
11
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
12
+
13
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
+
15
+ /*
16
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
17
+ * or more contributor license agreements. Licensed under the Elastic License
18
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
19
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
20
+ * Side Public License, v 1.
21
+ */
22
+ import React, { useState } from 'react';
23
+ import PropTypes from "prop-types";
24
+ import { useEuiTheme } from '../../services';
25
+ import { useEuiI18n } from '../i18n';
26
+ import { EuiPopover } from '../popover';
27
+ import { EuiIcon } from '../icon';
28
+ import { useEuiButtonFocusCSS } from '../../themes/amsterdam/global_styling/mixins/button';
29
+ import { euiCodeBlockAnnotationsStyles } from './code_block_annotations.style';
30
+ import { jsx as ___EmotionJSX } from "@emotion/react";
31
+ export var EuiCodeBlockAnnotation = function EuiCodeBlockAnnotation(_ref) {
32
+ var lineNumber = _ref.lineNumber,
33
+ children = _ref.children;
34
+
35
+ var _useState = useState(false),
36
+ _useState2 = _slicedToArray(_useState, 2),
37
+ isOpen = _useState2[0],
38
+ setIsOpen = _useState2[1];
39
+
40
+ var ariaLabel = useEuiI18n('euiCodeBlockAnnotations.ariaLabel', 'Click to view a code annotation for line {lineNumber}', {
41
+ lineNumber: lineNumber
42
+ });
43
+
44
+ var _useEuiTheme = useEuiTheme(),
45
+ euiTheme = _useEuiTheme.euiTheme,
46
+ colorMode = _useEuiTheme.colorMode;
47
+
48
+ var styles = euiCodeBlockAnnotationsStyles(euiTheme);
49
+ var buttonIconFocusStyle = useEuiButtonFocusCSS();
50
+ var cssButtonIconStyles = [styles.euiCodeBlockAnnotation__buttonIcon, buttonIconFocusStyle];
51
+ var isDarkMode = colorMode === 'DARK';
52
+ return ___EmotionJSX(EuiPopover, {
53
+ isOpen: isOpen,
54
+ closePopover: function closePopover() {
55
+ return setIsOpen(false);
56
+ },
57
+ button: ___EmotionJSX("button", {
58
+ onClick: function onClick() {
59
+ return setIsOpen(!isOpen);
60
+ },
61
+ "aria-label": ariaLabel,
62
+ css: cssButtonIconStyles,
63
+ "data-test-subj": "euiCodeBlockAnnotationIcon"
64
+ }, ___EmotionJSX(EuiIcon, {
65
+ type: AnnotationInfoIcon,
66
+ size: "s",
67
+ color: isDarkMode ? euiTheme.colors.ink : 'ghost'
68
+ })),
69
+ css: styles.euiCodeBlockAnnotation,
70
+ zIndex: Number(euiTheme.levels.mask) + 1 // Ensure fullscreen annotation popovers sit above the mask
71
+ ,
72
+ anchorPosition: "leftCenter",
73
+ panelProps: {
74
+ 'data-test-subj': 'euiCodeBlockAnnotationPopover'
75
+ }
76
+ }, children);
77
+ };
78
+ EuiCodeBlockAnnotation.propTypes = {
79
+ lineNumber: PropTypes.number.isRequired
80
+ };
81
+
82
+ var AnnotationInfoIcon = function AnnotationInfoIcon(props) {
83
+ return ___EmotionJSX("svg", _extends({
84
+ width: 11,
85
+ height: 11,
86
+ viewBox: "0 0 16 16",
87
+ fill: "none",
88
+ xmlns: "http://www.w3.org/2000/svg"
89
+ }, props), ___EmotionJSX("path", {
90
+ fillRule: "evenodd",
91
+ clipRule: "evenodd",
92
+ d: "M7.139 14l-.052-6.007H5V6.28h4.111l.052 6.007h1.915V14h-3.94zM6.712 3.38c0-.396.118-.725.354-.987S7.639 2 8.077 2c.438 0 .777.131 1.016.393.24.262.359.591.359.987 0 .39-.12.714-.359.972s-.578.388-1.016.388c-.438 0-.775-.13-1.011-.388-.236-.258-.354-.582-.354-.972z"
93
+ }));
94
+ };
@@ -0,0 +1,18 @@
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 { css } from '@emotion/react';
9
+ import { logicalCSS, logicalSizeCSS, mathWithUnits } from '../../global_styling';
10
+ export var euiCodeBlockAnnotationsStyles = function euiCodeBlockAnnotationsStyles(euiTheme) {
11
+ var buttonIconSize = mathWithUnits(euiTheme.size.base, function (x) {
12
+ return x - 1.5;
13
+ });
14
+ return {
15
+ euiCodeBlockAnnotation: /*#__PURE__*/css("position:absolute;", logicalCSS('right', 0), " ", logicalCSS('top', '50%'), " transform:translate(50%, -50%);line-height:1;;label:euiCodeBlockAnnotation;"),
16
+ euiCodeBlockAnnotation__buttonIcon: /*#__PURE__*/css(logicalSizeCSS(buttonIconSize), " display:flex;align-items:center;justify-content:center;background-color:", euiTheme.colors.primary, ";border-radius:50%;;label:euiCodeBlockAnnotation__buttonIcon;")
17
+ };
18
+ };
@@ -45,9 +45,15 @@ export var useFullScreen = function useFullScreen(_ref) {
45
45
  }, []);
46
46
  var onKeyDown = useCallback(function (event) {
47
47
  if (event.key === keys.ESCAPE) {
48
- event.preventDefault();
49
- event.stopPropagation();
50
- setIsFullScreen(false);
48
+ // We need to make sure annotation Escape keypresses don't also cause fullscreen mode to close
49
+ var focus = document.activeElement;
50
+ var isAnnotationPopover = !!(focus !== null && focus !== void 0 && focus.dataset.popoverOpen) || !!(focus !== null && focus !== void 0 && focus.closest('[data-popover-open]'));
51
+
52
+ if (!isAnnotationPopover) {
53
+ event.preventDefault();
54
+ event.stopPropagation();
55
+ setIsFullScreen(false);
56
+ }
51
57
  }
52
58
  }, []);
53
59
 
@@ -39,11 +39,12 @@ export var euiCodeBlockLineStyles = function euiCodeBlockLineStyles(euiThemeCont
39
39
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
40
40
  }),
41
41
  lineText: {
42
- euiCodeBlock__lineText: /*#__PURE__*/css("flex-grow:1;display:inline-block;padding-inline-start:", euiTheme.size.s, ";border-inline-start:", euiTheme.border.thin, ";user-select:text;;label:euiCodeBlock__lineText;"),
42
+ euiCodeBlock__lineText: /*#__PURE__*/css("flex-grow:1;display:inline-block;padding-inline-start:", euiTheme.size.m, ";border-inline-start:", euiTheme.border.thin, ";user-select:text;;label:euiCodeBlock__lineText;"),
43
43
  isHighlighted: /*#__PURE__*/css("background:", euiBackgroundColor(euiThemeContext, 'primary'), ";border-inline-start:", euiTheme.border.width.thick, " solid ", euiTheme.colors.primary, ";;label:isHighlighted;")
44
44
  },
45
45
  lineNumber: {
46
- euiCodeBlock__lineNumber: /*#__PURE__*/css("flex-grow:0;flex-shrink:0;user-select:none;padding-inline-end:", euiTheme.size.s, ";box-sizing:content-box;&:before{content:attr(data-line-number);color:", euiTheme.colors.subduedText, ";text-align:end;display:block;};label:euiCodeBlock__lineNumber;")
46
+ euiCodeBlock__lineNumberWrapper: /*#__PURE__*/css("position:relative;flex-grow:0;flex-shrink:0;user-select:none;padding-inline-end:", euiTheme.size.m, ";box-sizing:content-box;;label:euiCodeBlock__lineNumberWrapper;"),
47
+ euiCodeBlock__lineNumber: /*#__PURE__*/css("color:", euiTheme.colors.subduedText, ";text-align:end;display:block;;label:euiCodeBlock__lineNumber;")
47
48
  }
48
49
  };
49
50
  };
@@ -14,6 +14,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
14
14
  import React, { createElement } from 'react';
15
15
  import { listLanguages, highlight } from 'refractor';
16
16
  import { cx } from '@emotion/css';
17
+ import { EuiCodeBlockAnnotation } from './code_block_annotations';
17
18
  import { euiCodeBlockLineStyles } from './code_block_line.styles';
18
19
  /**
19
20
  * Utils shared between EuiCode and EuiCodeBlock
@@ -47,7 +48,15 @@ export var nodeToHtml = function nodeToHtml(node, idx, nodes) {
47
48
  key: key,
48
49
  className: cx(properties.className)
49
50
  }), children && children.map(function (el, i) {
50
- return nodeToHtml(el, i, nodes, depth + 1);
51
+ return (// @ts-ignore - using a custom type here to handle JSX annotations
52
+ el.type === 'annotation' ? // @ts-ignore - custom keys are passed by annotationElement below
53
+ ___EmotionJSX(EuiCodeBlockAnnotation, {
54
+ lineNumber: el.lineNumber,
55
+ children: el.annotation,
56
+ key: i
57
+ }) // prettier-ignore
58
+ : nodeToHtml(el, i, nodes, depth + 1)
59
+ );
51
60
  }));
52
61
  }
53
62
 
@@ -151,31 +160,61 @@ function wrapLines(nodes, options, euiTheme) {
151
160
  var lineStyles = cx([styles.euiCodeBlock__line, options.showLineNumbers && styles.hasLineNumbers]);
152
161
 
153
162
  if (options.showLineNumbers) {
154
- var _properties;
163
+ var _properties, _options$annotations;
155
164
 
156
165
  var lineNumber = i + 1;
157
166
  var digits = grouped.length.toString().length;
158
- var width = digits * CHAR_SIZE;
167
+ var width = digits * CHAR_SIZE; // Line text element and highlights
168
+
159
169
  var highlights = options.highlight ? parseLineRanges(options.highlight) : [];
160
170
  var lineTextStyles = cx([styles.lineText.euiCodeBlock__lineText, highlights.includes(lineNumber) && styles.lineText.isHighlighted]);
161
- var lineNumberStyles = cx(styles.lineNumber.euiCodeBlock__lineNumber);
162
- children = [{
171
+ var lineTextElement = {
172
+ type: 'element',
173
+ tagName: 'span',
174
+ properties: {
175
+ className: ['euiCodeBlock__lineText', lineTextStyles]
176
+ },
177
+ children: node
178
+ }; // Line number column/wrapper
179
+
180
+ var lineNumberWrapperStyles = cx(styles.lineNumber.euiCodeBlock__lineNumberWrapper);
181
+ var lineNumberWrapperElement = {
163
182
  type: 'element',
164
183
  tagName: 'span',
165
184
  properties: (_properties = {
166
185
  style: {
167
186
  inlineSize: width
168
187
  }
169
- }, _defineProperty(_properties, 'data-line-number', lineNumber), _defineProperty(_properties, 'aria-hidden', true), _defineProperty(_properties, "className", ['euiCodeBlock__lineNumber', lineNumberStyles]), _properties),
188
+ }, _defineProperty(_properties, 'data-line-number', lineNumber), _defineProperty(_properties, "className", ['euiCodeBlock__lineNumber', lineNumberWrapperStyles]), _properties),
170
189
  children: []
171
- }, {
190
+ }; // Line number element
191
+
192
+ var lineNumberStyles = cx(styles.lineNumber.euiCodeBlock__lineNumber);
193
+ var lineNumberElement = {
172
194
  type: 'element',
173
195
  tagName: 'span',
174
- properties: {
175
- className: ['euiCodeBlock__lineText', lineTextStyles]
176
- },
177
- children: node
178
- }];
196
+ properties: _defineProperty({
197
+ className: [lineNumberStyles]
198
+ }, 'aria-hidden', true),
199
+ children: [{
200
+ type: 'text',
201
+ value: String(lineNumber)
202
+ }]
203
+ };
204
+ lineNumberWrapperElement.children.push(lineNumberElement); // Annotation element
205
+
206
+ var hasAnnotation = (_options$annotations = options.annotations) === null || _options$annotations === void 0 ? void 0 : _options$annotations.hasOwnProperty(lineNumber);
207
+
208
+ if (hasAnnotation) {
209
+ var annotationElement = {
210
+ type: 'annotation',
211
+ annotation: options.annotations[lineNumber],
212
+ lineNumber: lineNumber
213
+ };
214
+ lineNumberWrapperElement.children.push(annotationElement);
215
+ }
216
+
217
+ children = [lineNumberWrapperElement, lineTextElement];
179
218
  }
180
219
 
181
220
  wrapped.push({
@@ -195,6 +234,7 @@ export var highlightByLine = function highlightByLine(children, language, data,
195
234
  lineNumber: data.start
196
235
  }), {
197
236
  showLineNumbers: data.show,
198
- highlight: data.highlight
237
+ highlight: data.highlight,
238
+ annotations: data.annotations
199
239
  }, euiTheme);
200
240
  };
@@ -101,7 +101,7 @@ export var EuiRangeTrack = function EuiRangeTrack(_ref) {
101
101
  }, [showTicks, ticks, min, max, tickInterval, step]);
102
102
  var euiTheme = useEuiTheme();
103
103
  var styles = euiRangeTrackStyles(euiTheme);
104
- var cssStyles = [styles.euiRangeTrack, disabled && styles.disabled, levels && !!levels.length && styles.hasLevels, (tickSequence || ticks) && styles.hasTicks];
104
+ var cssStyles = [styles.euiRangeTrack, disabled && styles.disabled, levels && !!levels.length && styles.hasLevels, showTicks && (tickSequence || ticks) && styles.hasTicks];
105
105
 
106
106
  var _useState = useState(0),
107
107
  _useState2 = _slicedToArray(_useState, 2),
@@ -31,18 +31,10 @@ var EuiIconAppAgent = function EuiIconAppAgent(_ref) {
31
31
  }, props), title ? ___EmotionJSX("title", {
32
32
  id: titleId
33
33
  }, title) : null, ___EmotionJSX("path", {
34
- className: "euiIcon__fillSecondary",
35
- d: "M21 2.82L16 .038 11 2.82v2.289l5-2.782 5 2.782v-2.29z"
36
- }), ___EmotionJSX("path", {
37
- className: "euiIcon__fillSecondary",
38
- d: "M21 7.282L16 4.5l-5 2.782V9.57l5-2.781 5 2.781V7.282z"
39
- }), ___EmotionJSX("path", {
40
- d: "M7 5.045L2 7.827v15.577l14 7.788 14-7.788V7.827l-5-2.782v2.289l3 1.669v13.225l-12 6.676-12-6.676V9.003l3-1.669V5.045z"
34
+ d: "M2.996 18.636L0 20.434v6.132l6 3.6 5-3 5 3 5-3 5 3 6-3.6v-6.132l-5-3v-5l-5-3v-5l-6-3.6-6 3.6v2.832l2 .033V5.566l4-2.4 4 2.4v3.868l-1.996 1.197 1 1.733L21 11.166l4 2.4v3.868l-4 2.4-2.257-1.354-.971 1.75L20 21.565v3.868l-4 2.4-4-2.4v-1.7l-2-.033v1.733l-4 2.4-4-2.4v-3.868l1.996-1.197-1-1.733zM22 25.434v-3.868l4-2.4 4 2.4v3.868l-4 2.4-4-2.4z"
41
35
  }), ___EmotionJSX("path", {
42
36
  className: "euiIcon__fillSecondary",
43
- fillRule: "evenodd",
44
- clipRule: "evenodd",
45
- d: "M22 12.5L16 9l-6 3.5v7l6 3.5 6-3.5v-7zm-9.974 1.205L16 11.387l3.974 2.318v4.59L16 20.613l-3.974-2.318v-4.59z"
37
+ d: "M11 22.166l-6-3.6v-6.132l6-3.6 6 3.6v6.132l-6 3.6zm4-4.732v-3.868l-4-2.4-4 2.4v3.868l4 2.4 4-2.4z"
46
38
  }));
47
39
  };
48
40
 
@@ -31,10 +31,18 @@ var EuiIconAppFleet = function EuiIconAppFleet(_ref) {
31
31
  }, props), title ? ___EmotionJSX("title", {
32
32
  id: titleId
33
33
  }, title) : null, ___EmotionJSX("path", {
34
- d: "M2.996 18.636L0 20.434v6.132l6 3.6 5-3 5 3 5-3 5 3 6-3.6v-6.132l-5-3v-5l-5-3v-5l-6-3.6-6 3.6v2.832l2 .033V5.566l4-2.4 4 2.4v3.868l-1.996 1.197 1 1.733L21 11.166l4 2.4v3.868l-4 2.4-2.257-1.354-.971 1.75L20 21.565v3.868l-4 2.4-4-2.4v-1.7l-2-.033v1.733l-4 2.4-4-2.4v-3.868l1.996-1.197-1-1.733zM22 25.434v-3.868l4-2.4 4 2.4v3.868l-4 2.4-4-2.4z"
34
+ className: "euiIcon__fillSecondary",
35
+ d: "M21 2.82L16 .038 11 2.82v2.289l5-2.782 5 2.782v-2.29z"
36
+ }), ___EmotionJSX("path", {
37
+ className: "euiIcon__fillSecondary",
38
+ d: "M21 7.282L16 4.5l-5 2.782V9.57l5-2.781 5 2.781V7.282z"
39
+ }), ___EmotionJSX("path", {
40
+ d: "M7 5.045L2 7.827v15.577l14 7.788 14-7.788V7.827l-5-2.782v2.289l3 1.669v13.225l-12 6.676-12-6.676V9.003l3-1.669V5.045z"
35
41
  }), ___EmotionJSX("path", {
36
42
  className: "euiIcon__fillSecondary",
37
- d: "M11 22.166l-6-3.6v-6.132l6-3.6 6 3.6v6.132l-6 3.6zm4-4.732v-3.868l-4-2.4-4 2.4v3.868l4 2.4 4-2.4z"
43
+ fillRule: "evenodd",
44
+ clipRule: "evenodd",
45
+ d: "M22 12.5L16 9l-6 3.5v7l6 3.5 6-3.5v-7zm-9.974 1.205L16 11.387l3.974 2.318v4.59L16 20.613l-3.974-2.318v-4.59z"
38
46
  }));
39
47
  };
40
48
 
@@ -18,6 +18,8 @@ import PropTypes from "prop-types";
18
18
  import React, { createElement } from 'react';
19
19
  import { EuiTitle } from '../title';
20
20
  import { EuiStepNumber } from './step_number';
21
+ import { useEuiTheme } from '../../services';
22
+ import { euiStepStyles, euiStepContentStyles, euiStepTitleStyles } from './step.styles';
21
23
  import { jsx as ___EmotionJSX } from "@emotion/react";
22
24
  export var EuiStep = function EuiStep(_ref) {
23
25
  var className = _ref.className,
@@ -32,27 +34,32 @@ export var EuiStep = function EuiStep(_ref) {
32
34
  status = _ref.status,
33
35
  rest = _objectWithoutProperties(_ref, _excluded);
34
36
 
35
- var classes = classNames('euiStep', {
36
- 'euiStep--small': titleSize === 'xs',
37
- 'euiStep-isDisabled': status === 'disabled'
38
- }, className);
39
- var numberClasses = classNames('euiStep__circle', {
40
- 'euiStepNumber--small': titleSize === 'xs'
41
- });
37
+ var classes = classNames('euiStep', className);
38
+ var euiTheme = useEuiTheme();
39
+ var styles = euiStepStyles(euiTheme);
40
+ var cssStyles = [styles.euiStep, styles[titleSize]];
41
+ var contentStyles = euiStepContentStyles(euiTheme);
42
+ var cssContentStyles = [contentStyles.euiStep__content, contentStyles[titleSize]];
43
+ var titleStyles = euiStepTitleStyles(euiTheme);
44
+ var cssStepTitleStyles = [titleStyles.euiStep__title, status === 'disabled' && titleStyles.isDisabled, titleStyles[titleSize]];
45
+ var cssTitleWrapperStyles = titleStyles.euiStep__titleWrapper;
42
46
  return ___EmotionJSX("div", _extends({
43
- className: classes
47
+ className: classes,
48
+ css: cssStyles
44
49
  }, rest), ___EmotionJSX("div", {
45
- className: "euiStep__titleWrapper"
50
+ className: "euiStep__titleWrapper",
51
+ css: cssTitleWrapperStyles
46
52
  }, ___EmotionJSX(EuiStepNumber, {
47
- className: numberClasses,
48
53
  number: step,
49
54
  status: status,
50
55
  titleSize: titleSize
51
56
  }), ___EmotionJSX(EuiTitle, {
52
57
  size: titleSize,
53
- className: "euiStep__title"
58
+ className: "euiStep__title",
59
+ css: cssStepTitleStyles
54
60
  }, /*#__PURE__*/createElement(headingElement, null, title))), ___EmotionJSX("div", {
55
- className: "euiStep__content"
61
+ className: "euiStep__content",
62
+ css: cssContentStyles
56
63
  }, children));
57
64
  };
58
65
  EuiStep.propTypes = {
@@ -0,0 +1,73 @@
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 { css } from '@emotion/react';
9
+ import { mathWithUnits, logicalCSS } from '../../global_styling';
10
+ export var euiStepVariables = function euiStepVariables(euiTheme) {
11
+ return {
12
+ numberSize: euiTheme.size.xl,
13
+ numberXSSize: euiTheme.size.l,
14
+ numberMargin: euiTheme.size.base
15
+ };
16
+ };
17
+ export var euiStepStyles = function euiStepStyles(euiThemeContext) {
18
+ var euiTheme = euiThemeContext.euiTheme;
19
+ var euiStep = euiStepVariables(euiTheme); // the vertical line is centered on the number, so we need to offset the line
20
+ // by half of the number size & half of the line size to center it
21
+
22
+ var lineStartPosition = mathWithUnits([euiStep.numberSize, euiTheme.border.width.thick], function (x, y) {
23
+ return x / 2 - y / 2;
24
+ });
25
+ var lineEndPosition = mathWithUnits([euiStep.numberSize, euiTheme.border.width.thick], function (x, y) {
26
+ return x / 2 + y / 2;
27
+ });
28
+ var lineGradient = "linear-gradient(to right,\n transparent 0,\n transparent ".concat(lineStartPosition, ",\n ").concat(euiTheme.border.color, " ").concat(lineStartPosition, ",\n ").concat(euiTheme.border.color, " ").concat(lineEndPosition, ",\n transparent ").concat(lineEndPosition, ",\n transparent 100%)");
29
+ return {
30
+ euiStep: /*#__PURE__*/css("&:not(:last-of-type){background-image:", lineGradient, ";background-repeat:no-repeat;};label:euiStep;"),
31
+ // Sizes
32
+ m: /*#__PURE__*/css("&:not(:last-of-type){background-position:left ", euiTheme.size.xl, ";};label:m;"),
33
+ s: /*#__PURE__*/css("&:not(:last-of-type){background-position:left ", euiTheme.size.xl, ";};label:s;"),
34
+ xs: /*#__PURE__*/css("&:not(:last-of-type){background-position:-", euiTheme.size.xs, " ", euiTheme.size.l, ";};label:xs;")
35
+ };
36
+ };
37
+ export var euiStepContentStyles = function euiStepContentStyles(euiThemeContext) {
38
+ var euiTheme = euiThemeContext.euiTheme;
39
+ var euiStep = euiStepVariables(euiTheme);
40
+ var styles = {
41
+ euiStep__content: /*#__PURE__*/css(logicalCSS('margin-top', euiTheme.size.s), " ", logicalCSS('padding-top', euiTheme.size.base), " ", logicalCSS('padding-bottom', mathWithUnits([euiTheme.size.xl, euiTheme.size.s], function (x, y) {
42
+ return x + y;
43
+ })), " ", logicalCSS('padding-right', euiTheme.size.base), ";;label:euiStep__content;"),
44
+ // Sizes
45
+ m: /*#__PURE__*/css(logicalCSS('padding-left', mathWithUnits([euiStep.numberSize, euiStep.numberMargin], function (x, y) {
46
+ return x / 2 + y;
47
+ })), logicalCSS('margin-left', mathWithUnits(euiStep.numberSize, function (x) {
48
+ return x / 2;
49
+ })), ";;label:m;"),
50
+ s: /*#__PURE__*/css(";label:s;"),
51
+ // s is the same as m, so we'll programmatically duplicate it below
52
+ xs: /*#__PURE__*/css(logicalCSS('padding-left', mathWithUnits([euiStep.numberXSSize, euiStep.numberMargin], function (x, y) {
53
+ return x / 2 + y;
54
+ })), logicalCSS('margin-left', mathWithUnits(euiStep.numberXSSize, function (x) {
55
+ return x / 2;
56
+ })), ";;label:xs;")
57
+ };
58
+ styles.s = styles.m;
59
+ return styles;
60
+ };
61
+ export var euiStepTitleStyles = function euiStepTitleStyles(euiThemeContext) {
62
+ var euiTheme = euiThemeContext.euiTheme;
63
+ var euiStep = euiStepVariables(euiTheme);
64
+ return {
65
+ euiStep__titleWrapper: /*#__PURE__*/css("display:flex;gap:", euiStep.numberMargin, ";;label:euiStep__titleWrapper;"),
66
+ euiStep__title: /*#__PURE__*/css(";label:euiStep__title;"),
67
+ isDisabled: /*#__PURE__*/css("color:", euiTheme.colors.disabledText, ";;label:isDisabled;"),
68
+ // Sizes
69
+ m: /*#__PURE__*/css(";label:m;"),
70
+ s: /*#__PURE__*/css(logicalCSS('padding-top', euiTheme.size.xs), ";;label:s;"),
71
+ xs: /*#__PURE__*/css(";label:xs;")
72
+ };
73
+ };
@@ -17,7 +17,9 @@ import classNames from 'classnames';
17
17
  import PropTypes from "prop-types";
18
18
  import React from 'react';
19
19
  import { EuiStepNumber } from './step_number';
20
- import { useI18nCompleteStep, useI18nCurrentStep, useI18nDisabledStep, useI18nIncompleteStep, useI18nStep, useI18nWarningStep } from './step_strings';
20
+ import { useI18nCompleteStep, useI18nCurrentStep, useI18nDisabledStep, useI18nIncompleteStep, useI18nStep, useI18nWarningStep, useI18nErrorsStep, useI18nLoadingStep } from './step_strings';
21
+ import { useEuiTheme } from '../../services';
22
+ import { euiStepHorizontalStyles, euiStepHorizontalNumberStyles, euiStepHorizontalTitleStyles } from './step_horizontal.styles';
21
23
  import { jsx as ___EmotionJSX } from "@emotion/react";
22
24
  export var EuiStepHorizontal = function EuiStepHorizontal(_ref) {
23
25
  var className = _ref.className,
@@ -30,43 +32,50 @@ export var EuiStepHorizontal = function EuiStepHorizontal(_ref) {
30
32
  status = _ref$status === void 0 ? 'incomplete' : _ref$status,
31
33
  rest = _objectWithoutProperties(_ref, _excluded);
32
34
 
33
- var buttonTitle = useI18nStep({
34
- number: step,
35
- title: title
36
- });
37
- var completeTitle = useI18nCompleteStep({
38
- number: step,
39
- title: title
40
- });
41
- var disabledTitle = useI18nDisabledStep({
42
- number: step,
43
- title: title
44
- });
45
- var incompleteTitle = useI18nIncompleteStep({
46
- number: step,
47
- title: title
48
- });
49
- var warningTitle = useI18nWarningStep({
50
- number: step,
51
- title: title
52
- });
53
- var currentTitle = useI18nCurrentStep({
54
- number: step,
55
- title: title
56
- });
57
35
  if (disabled) status = 'disabled';
58
- var classes = classNames('euiStepHorizontal', className, {
59
- 'euiStepHorizontal-isSelected': status === 'current',
60
- 'euiStepHorizontal-isComplete': status === 'complete',
61
- 'euiStepHorizontal-isIncomplete': status === 'incomplete',
62
- 'euiStepHorizontal-isDisabled': status === 'disabled'
63
- });
64
- var stepTitle = buttonTitle;
65
- if (status === 'disabled') stepTitle = disabledTitle;
66
- if (status === 'complete') stepTitle = completeTitle;
67
- if (status === 'incomplete') stepTitle = incompleteTitle;
68
- if (status === 'warning') stepTitle = warningTitle;
69
- if (status === 'current') stepTitle = currentTitle;
36
+ var classes = classNames('euiStepHorizontal', className);
37
+ var euiTheme = useEuiTheme();
38
+ var styles = euiStepHorizontalStyles(euiTheme);
39
+ var cssStyles = [styles.euiStepHorizontal, status === 'disabled' ? styles.disabled : styles.enabled];
40
+ var numberStyles = euiStepHorizontalNumberStyles(euiTheme);
41
+ var cssNumberStyles = [numberStyles.euiStepHorizontal__number];
42
+ var titleStyles = euiStepHorizontalTitleStyles(euiTheme);
43
+ var cssTitleStyles = [titleStyles.euiStepHorizontal__title, status === 'disabled' && titleStyles.disabled];
44
+ var titleAttrsMap = {
45
+ step: useI18nStep({
46
+ number: step,
47
+ title: title
48
+ }),
49
+ current: useI18nCurrentStep({
50
+ number: step,
51
+ title: title
52
+ }),
53
+ disabled: useI18nDisabledStep({
54
+ number: step,
55
+ title: title
56
+ }),
57
+ incomplete: useI18nIncompleteStep({
58
+ number: step,
59
+ title: title
60
+ }),
61
+ complete: useI18nCompleteStep({
62
+ number: step,
63
+ title: title
64
+ }),
65
+ warning: useI18nWarningStep({
66
+ number: step,
67
+ title: title
68
+ }),
69
+ danger: useI18nErrorsStep({
70
+ number: step,
71
+ title: title
72
+ }),
73
+ loading: useI18nLoadingStep({
74
+ number: step,
75
+ title: title
76
+ })
77
+ };
78
+ var titleAttr = titleAttrsMap[status || 'step'];
70
79
 
71
80
  var onStepClick = function onStepClick(event) {
72
81
  if (!disabled) onClick(event);
@@ -74,15 +83,19 @@ export var EuiStepHorizontal = function EuiStepHorizontal(_ref) {
74
83
 
75
84
  return ___EmotionJSX("button", _extends({
76
85
  className: classes,
77
- title: stepTitle,
86
+ title: titleAttr,
78
87
  onClick: onStepClick,
79
- disabled: disabled
88
+ disabled: disabled,
89
+ css: cssStyles,
90
+ "data-step-status": status
80
91
  }, rest), ___EmotionJSX(EuiStepNumber, {
81
92
  className: "euiStepHorizontal__number",
82
93
  status: status,
83
- number: step
94
+ number: step,
95
+ css: cssNumberStyles
84
96
  }), ___EmotionJSX("span", {
85
- className: "euiStepHorizontal__title"
97
+ className: "euiStepHorizontal__title",
98
+ css: cssTitleStyles
86
99
  }, title));
87
100
  };
88
101
  EuiStepHorizontal.propTypes = {
@@ -102,7 +115,7 @@ EuiStepHorizontal.propTypes = {
102
115
  /**
103
116
  * Visual representation of the step number indicator.
104
117
  * May replace the number provided in props.step with alternate styling.
105
- * The `isSelected`, `isComplete`, and `disabled` props will override these.
118
+ * The `disabled` prop will override this.
106
119
  */
107
120
  status: PropTypes.any,
108
121
  className: PropTypes.string,
@@ -0,0 +1,55 @@
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 { euiBreakpoint, logicalShorthandCSS, euiFocusRing, euiCanAnimate, mathWithUnits } from '../../global_styling/';
12
+ import { euiTitle } from '../title/title.styles';
13
+ import { euiStepVariables } from './step.styles';
14
+
15
+ var _ref = process.env.NODE_ENV === "production" ? {
16
+ name: "b86pnw-disabled",
17
+ styles: "cursor:not-allowed;label:disabled;"
18
+ } : {
19
+ name: "b86pnw-disabled",
20
+ styles: "cursor:not-allowed;label:disabled;",
21
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
22
+ };
23
+
24
+ export var euiStepHorizontalStyles = function euiStepHorizontalStyles(euiThemeContext) {
25
+ var euiTheme = euiThemeContext.euiTheme;
26
+ var euiStep = euiStepVariables(euiTheme);
27
+ /**
28
+ * 1. Ensure the connecting lines stays behind the number
29
+ * 2. Make the content of each step align to the top, even if the steps are of varying heights,
30
+ * e.g. due to some of their titles wrapping to multiple lines
31
+ */
32
+
33
+ return {
34
+ euiStepHorizontal: /*#__PURE__*/css(logicalShorthandCSS('padding', "".concat(euiTheme.size.l, " ").concat(euiTheme.size.base, " ").concat(euiTheme.size.base)), " display:flex;flex-direction:column;align-items:center;justify-content:flex-start;cursor:pointer;position:relative;inline-size:100%;&::before,&::after{content:'';position:absolute;background-color:", euiTheme.border.color, ";block-size:", euiTheme.border.width.thick, ";inline-size:calc(50% - (", euiStep.numberSize, " / 2));inset-block-start:", mathWithUnits([euiTheme.size.l, euiStep.numberSize], function (x, y) {
35
+ return x + y / 2;
36
+ }), ";z-index:", euiTheme.levels.content, ";}&::before{inset-inline-start:0;}&::after{inset-inline-end:0;};label:euiStepHorizontal;"),
37
+ // Note: these selectors must be nested because focus/hover state
38
+ // is on the parent container, but affects specific children
39
+ enabled: /*#__PURE__*/css("&:focus,&:hover{.euiStepHorizontal__title{text-decoration:underline;}}&:focus{outline:none;.euiStepHorizontal__number{", euiFocusRing(euiThemeContext), ";}.euiStepHorizontal__number:not(:focus-visible){outline:", euiTheme.focus.width, " solid ", euiTheme.colors.darkestShade, ";}};label:enabled;"),
40
+ disabled: _ref
41
+ };
42
+ };
43
+ export var euiStepHorizontalNumberStyles = function euiStepHorizontalNumberStyles(euiThemeContext) {
44
+ var euiTheme = euiThemeContext.euiTheme;
45
+ return {
46
+ euiStepHorizontal__number: /*#__PURE__*/css("position:relative;z-index:", Number(euiTheme.levels.content) + 1, ";", euiCanAnimate, "{transition:all ", euiTheme.animation.fast, " ease-in-out;};label:euiStepHorizontal__number;")
47
+ };
48
+ };
49
+ export var euiStepHorizontalTitleStyles = function euiStepHorizontalTitleStyles(euiThemeContext) {
50
+ var euiTheme = euiThemeContext.euiTheme;
51
+ return {
52
+ euiStepHorizontal__title: /*#__PURE__*/css(euiTitle(euiThemeContext, 'xs'), ";margin-block-start:", euiTheme.size.s, ";font-weight:", euiTheme.font.weight.bold, ";text-align:center;", euiBreakpoint(euiThemeContext, ['xs', 's']), "{display:none;};label:euiStepHorizontal__title;"),
53
+ disabled: /*#__PURE__*/css("color:", euiTheme.colors.disabledText, ";;label:disabled;")
54
+ };
55
+ };