@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
@@ -17,6 +17,8 @@ var _refractor = require("refractor");
17
17
 
18
18
  var _css = require("@emotion/css");
19
19
 
20
+ var _code_block_annotations = require("./code_block_annotations");
21
+
20
22
  var _code_block_line = require("./code_block_line.styles");
21
23
 
22
24
  var _react2 = require("@emotion/react");
@@ -68,7 +70,15 @@ var nodeToHtml = function nodeToHtml(node, idx, nodes) {
68
70
  key: key,
69
71
  className: (0, _css.cx)(properties.className)
70
72
  }), children && children.map(function (el, i) {
71
- return nodeToHtml(el, i, nodes, depth + 1);
73
+ return (// @ts-ignore - using a custom type here to handle JSX annotations
74
+ el.type === 'annotation' ? // @ts-ignore - custom keys are passed by annotationElement below
75
+ (0, _react2.jsx)(_code_block_annotations.EuiCodeBlockAnnotation, {
76
+ lineNumber: el.lineNumber,
77
+ children: el.annotation,
78
+ key: i
79
+ }) // prettier-ignore
80
+ : nodeToHtml(el, i, nodes, depth + 1)
81
+ );
72
82
  }));
73
83
  }
74
84
 
@@ -176,31 +186,61 @@ function wrapLines(nodes, options, euiTheme) {
176
186
  var lineStyles = (0, _css.cx)([styles.euiCodeBlock__line, options.showLineNumbers && styles.hasLineNumbers]);
177
187
 
178
188
  if (options.showLineNumbers) {
179
- var _properties;
189
+ var _properties, _options$annotations;
180
190
 
181
191
  var lineNumber = i + 1;
182
192
  var digits = grouped.length.toString().length;
183
- var width = digits * CHAR_SIZE;
193
+ var width = digits * CHAR_SIZE; // Line text element and highlights
194
+
184
195
  var highlights = options.highlight ? parseLineRanges(options.highlight) : [];
185
196
  var lineTextStyles = (0, _css.cx)([styles.lineText.euiCodeBlock__lineText, highlights.includes(lineNumber) && styles.lineText.isHighlighted]);
186
- var lineNumberStyles = (0, _css.cx)(styles.lineNumber.euiCodeBlock__lineNumber);
187
- children = [{
197
+ var lineTextElement = {
198
+ type: 'element',
199
+ tagName: 'span',
200
+ properties: {
201
+ className: ['euiCodeBlock__lineText', lineTextStyles]
202
+ },
203
+ children: node
204
+ }; // Line number column/wrapper
205
+
206
+ var lineNumberWrapperStyles = (0, _css.cx)(styles.lineNumber.euiCodeBlock__lineNumberWrapper);
207
+ var lineNumberWrapperElement = {
188
208
  type: 'element',
189
209
  tagName: 'span',
190
210
  properties: (_properties = {
191
211
  style: {
192
212
  inlineSize: width
193
213
  }
194
- }, (0, _defineProperty2.default)(_properties, 'data-line-number', lineNumber), (0, _defineProperty2.default)(_properties, 'aria-hidden', true), (0, _defineProperty2.default)(_properties, "className", ['euiCodeBlock__lineNumber', lineNumberStyles]), _properties),
214
+ }, (0, _defineProperty2.default)(_properties, 'data-line-number', lineNumber), (0, _defineProperty2.default)(_properties, "className", ['euiCodeBlock__lineNumber', lineNumberWrapperStyles]), _properties),
195
215
  children: []
196
- }, {
216
+ }; // Line number element
217
+
218
+ var lineNumberStyles = (0, _css.cx)(styles.lineNumber.euiCodeBlock__lineNumber);
219
+ var lineNumberElement = {
197
220
  type: 'element',
198
221
  tagName: 'span',
199
- properties: {
200
- className: ['euiCodeBlock__lineText', lineTextStyles]
201
- },
202
- children: node
203
- }];
222
+ properties: (0, _defineProperty2.default)({
223
+ className: [lineNumberStyles]
224
+ }, 'aria-hidden', true),
225
+ children: [{
226
+ type: 'text',
227
+ value: String(lineNumber)
228
+ }]
229
+ };
230
+ lineNumberWrapperElement.children.push(lineNumberElement); // Annotation element
231
+
232
+ var hasAnnotation = (_options$annotations = options.annotations) === null || _options$annotations === void 0 ? void 0 : _options$annotations.hasOwnProperty(lineNumber);
233
+
234
+ if (hasAnnotation) {
235
+ var annotationElement = {
236
+ type: 'annotation',
237
+ annotation: options.annotations[lineNumber],
238
+ lineNumber: lineNumber
239
+ };
240
+ lineNumberWrapperElement.children.push(annotationElement);
241
+ }
242
+
243
+ children = [lineNumberWrapperElement, lineTextElement];
204
244
  }
205
245
 
206
246
  wrapped.push({
@@ -220,7 +260,8 @@ var highlightByLine = function highlightByLine(children, language, data, euiThem
220
260
  lineNumber: data.start
221
261
  }), {
222
262
  showLineNumbers: data.show,
223
- highlight: data.highlight
263
+ highlight: data.highlight,
264
+ annotations: data.annotations
224
265
  }, euiTheme);
225
266
  };
226
267
 
@@ -103,7 +103,7 @@ var EuiRangeTrack = function EuiRangeTrack(_ref) {
103
103
  }, [showTicks, ticks, min, max, tickInterval, step]);
104
104
  var euiTheme = (0, _services.useEuiTheme)();
105
105
  var styles = (0, _range_track.euiRangeTrackStyles)(euiTheme);
106
- var cssStyles = [styles.euiRangeTrack, disabled && styles.disabled, levels && !!levels.length && styles.hasLevels, (tickSequence || ticks) && styles.hasTicks];
106
+ var cssStyles = [styles.euiRangeTrack, disabled && styles.disabled, levels && !!levels.length && styles.hasLevels, showTicks && (tickSequence || ticks) && styles.hasTicks];
107
107
 
108
108
  var _useState = (0, _react.useState)(0),
109
109
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -36,18 +36,10 @@ var EuiIconAppAgent = function EuiIconAppAgent(_ref) {
36
36
  }, props), title ? (0, _react2.jsx)("title", {
37
37
  id: titleId
38
38
  }, title) : null, (0, _react2.jsx)("path", {
39
- className: "euiIcon__fillSecondary",
40
- d: "M21 2.82L16 .038 11 2.82v2.289l5-2.782 5 2.782v-2.29z"
41
- }), (0, _react2.jsx)("path", {
42
- className: "euiIcon__fillSecondary",
43
- d: "M21 7.282L16 4.5l-5 2.782V9.57l5-2.781 5 2.781V7.282z"
44
- }), (0, _react2.jsx)("path", {
45
- 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"
39
+ 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"
46
40
  }), (0, _react2.jsx)("path", {
47
41
  className: "euiIcon__fillSecondary",
48
- fillRule: "evenodd",
49
- clipRule: "evenodd",
50
- 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"
42
+ 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"
51
43
  }));
52
44
  };
53
45
 
@@ -36,10 +36,18 @@ var EuiIconAppFleet = function EuiIconAppFleet(_ref) {
36
36
  }, props), title ? (0, _react2.jsx)("title", {
37
37
  id: titleId
38
38
  }, title) : null, (0, _react2.jsx)("path", {
39
- 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"
39
+ className: "euiIcon__fillSecondary",
40
+ d: "M21 2.82L16 .038 11 2.82v2.289l5-2.782 5 2.782v-2.29z"
41
+ }), (0, _react2.jsx)("path", {
42
+ className: "euiIcon__fillSecondary",
43
+ d: "M21 7.282L16 4.5l-5 2.782V9.57l5-2.781 5 2.781V7.282z"
44
+ }), (0, _react2.jsx)("path", {
45
+ 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"
40
46
  }), (0, _react2.jsx)("path", {
41
47
  className: "euiIcon__fillSecondary",
42
- 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"
48
+ fillRule: "evenodd",
49
+ clipRule: "evenodd",
50
+ 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"
43
51
  }));
44
52
  };
45
53
 
@@ -1,6 +1,4 @@
1
1
  <svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
2
- <path class="euiIcon__fillSecondary" d="M21 2.81994L16 0.0383301L11 2.81991V5.10857L16 2.32699L21 5.1086V2.81994Z" />
3
- <path class="euiIcon__fillSecondary" d="M21 7.28161L16 4.5L11 7.28158V9.57024L16 6.78866L21 9.57027V7.28161Z" />
4
- <path d="M7 5.04535L2 7.82695V23.4039L16 31.1923L30 23.4039V7.82695L25 5.04536V7.33402L28 9.00297V22.2278L16 28.9037L4 22.2279V9.00297L7 7.33401V5.04535Z" />
5
- <path class="euiIcon__fillSecondary" fill-rule="evenodd" clip-rule="evenodd" d="M22 12.5L16 9L10 12.5V19.5L16 23L22 19.5V12.5ZM12.026 13.7053L16 11.3871L19.974 13.7053V18.2947L16 20.6129L12.026 18.2947V13.7053Z" />
2
+ <path d="M2.99581 18.6363L0 20.4337V26.5661L6 30.1661L11 27.1661L16 30.1661L21 27.1661L26 30.1661L32 26.5661V20.4337L27 17.4337V12.4337L22 9.43374V4.43374L16 0.83374L10 4.43374V7.26581L12 7.29946V5.56612L16 3.16612L20 5.56612V9.43374L18.0041 10.6313L19.0042 12.3636L21 11.1661L25 13.5661V17.4337L21 19.8337L18.7433 18.4797L17.772 20.2293L20 21.5661V25.4337L16 27.8337L12 25.4337V23.7342L10 23.7006V25.4337L6 27.8337L2 25.4337L2 21.5661L3.99595 20.3686L2.99581 18.6363ZM22 25.4337V21.5661L26 19.1661L30 21.5661V25.4337L26 27.8337L22 25.4337Z" />
3
+ <path class="euiIcon__fillSecondary" d="M11 22.1662L5 18.5662L5 12.4338L11 8.83382L17 12.4338L17 18.5662L11 22.1662ZM15 17.4338L15 13.5662L11 11.1662L7 13.5662L7 17.4338L11 19.8338L15 17.4338Z" />
6
4
  </svg>
@@ -1,4 +1,6 @@
1
1
  <svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M2.99581 18.6363L0 20.4337V26.5661L6 30.1661L11 27.1661L16 30.1661L21 27.1661L26 30.1661L32 26.5661V20.4337L27 17.4337V12.4337L22 9.43374V4.43374L16 0.83374L10 4.43374V7.26581L12 7.29946V5.56612L16 3.16612L20 5.56612V9.43374L18.0041 10.6313L19.0042 12.3636L21 11.1661L25 13.5661V17.4337L21 19.8337L18.7433 18.4797L17.772 20.2293L20 21.5661V25.4337L16 27.8337L12 25.4337V23.7342L10 23.7006V25.4337L6 27.8337L2 25.4337L2 21.5661L3.99595 20.3686L2.99581 18.6363ZM22 25.4337V21.5661L26 19.1661L30 21.5661V25.4337L26 27.8337L22 25.4337Z" />
3
- <path class="euiIcon__fillSecondary" d="M11 22.1662L5 18.5662L5 12.4338L11 8.83382L17 12.4338L17 18.5662L11 22.1662ZM15 17.4338L15 13.5662L11 11.1662L7 13.5662L7 17.4338L11 19.8338L15 17.4338Z" />
2
+ <path class="euiIcon__fillSecondary" d="M21 2.81994L16 0.0383301L11 2.81991V5.10857L16 2.32699L21 5.1086V2.81994Z" />
3
+ <path class="euiIcon__fillSecondary" d="M21 7.28161L16 4.5L11 7.28158V9.57024L16 6.78866L21 9.57027V7.28161Z" />
4
+ <path d="M7 5.04535L2 7.82695V23.4039L16 31.1923L30 23.4039V7.82695L25 5.04536V7.33402L28 9.00297V22.2278L16 28.9037L4 22.2279V9.00297L7 7.33401V5.04535Z" />
5
+ <path class="euiIcon__fillSecondary" fill-rule="evenodd" clip-rule="evenodd" d="M22 12.5L16 9L10 12.5V19.5L16 23L22 19.5V12.5ZM12.026 13.7053L16 11.3871L19.974 13.7053V18.2947L16 20.6129L12.026 18.2947V13.7053Z" />
4
6
  </svg>
@@ -21,6 +21,10 @@ var _title = require("../title");
21
21
 
22
22
  var _step_number = require("./step_number");
23
23
 
24
+ var _services = require("../../services");
25
+
26
+ var _step = require("./step.styles");
27
+
24
28
  var _react2 = require("@emotion/react");
25
29
 
26
30
  var _excluded = ["className", "children", "headingElement", "step", "title", "titleSize", "status"];
@@ -41,27 +45,32 @@ var EuiStep = function EuiStep(_ref) {
41
45
  titleSize = _ref$titleSize === void 0 ? 's' : _ref$titleSize,
42
46
  status = _ref.status,
43
47
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
44
- var classes = (0, _classnames.default)('euiStep', {
45
- 'euiStep--small': titleSize === 'xs',
46
- 'euiStep-isDisabled': status === 'disabled'
47
- }, className);
48
- var numberClasses = (0, _classnames.default)('euiStep__circle', {
49
- 'euiStepNumber--small': titleSize === 'xs'
50
- });
48
+ var classes = (0, _classnames.default)('euiStep', className);
49
+ var euiTheme = (0, _services.useEuiTheme)();
50
+ var styles = (0, _step.euiStepStyles)(euiTheme);
51
+ var cssStyles = [styles.euiStep, styles[titleSize]];
52
+ var contentStyles = (0, _step.euiStepContentStyles)(euiTheme);
53
+ var cssContentStyles = [contentStyles.euiStep__content, contentStyles[titleSize]];
54
+ var titleStyles = (0, _step.euiStepTitleStyles)(euiTheme);
55
+ var cssStepTitleStyles = [titleStyles.euiStep__title, status === 'disabled' && titleStyles.isDisabled, titleStyles[titleSize]];
56
+ var cssTitleWrapperStyles = titleStyles.euiStep__titleWrapper;
51
57
  return (0, _react2.jsx)("div", (0, _extends2.default)({
52
- className: classes
58
+ className: classes,
59
+ css: cssStyles
53
60
  }, rest), (0, _react2.jsx)("div", {
54
- className: "euiStep__titleWrapper"
61
+ className: "euiStep__titleWrapper",
62
+ css: cssTitleWrapperStyles
55
63
  }, (0, _react2.jsx)(_step_number.EuiStepNumber, {
56
- className: numberClasses,
57
64
  number: step,
58
65
  status: status,
59
66
  titleSize: titleSize
60
67
  }), (0, _react2.jsx)(_title.EuiTitle, {
61
68
  size: titleSize,
62
- className: "euiStep__title"
69
+ className: "euiStep__title",
70
+ css: cssStepTitleStyles
63
71
  }, /*#__PURE__*/(0, _react.createElement)(headingElement, null, title))), (0, _react2.jsx)("div", {
64
- className: "euiStep__content"
72
+ className: "euiStep__content",
73
+ css: cssContentStyles
65
74
  }, children));
66
75
  };
67
76
 
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.euiStepVariables = exports.euiStepTitleStyles = exports.euiStepStyles = exports.euiStepContentStyles = void 0;
7
+
8
+ var _react = require("@emotion/react");
9
+
10
+ var _global_styling = require("../../global_styling");
11
+
12
+ /*
13
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
14
+ * or more contributor license agreements. Licensed under the Elastic License
15
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
16
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
17
+ * Side Public License, v 1.
18
+ */
19
+ var euiStepVariables = function euiStepVariables(euiTheme) {
20
+ return {
21
+ numberSize: euiTheme.size.xl,
22
+ numberXSSize: euiTheme.size.l,
23
+ numberMargin: euiTheme.size.base
24
+ };
25
+ };
26
+
27
+ exports.euiStepVariables = euiStepVariables;
28
+
29
+ var euiStepStyles = function euiStepStyles(euiThemeContext) {
30
+ var euiTheme = euiThemeContext.euiTheme;
31
+ var euiStep = euiStepVariables(euiTheme); // the vertical line is centered on the number, so we need to offset the line
32
+ // by half of the number size & half of the line size to center it
33
+
34
+ var lineStartPosition = (0, _global_styling.mathWithUnits)([euiStep.numberSize, euiTheme.border.width.thick], function (x, y) {
35
+ return x / 2 - y / 2;
36
+ });
37
+ var lineEndPosition = (0, _global_styling.mathWithUnits)([euiStep.numberSize, euiTheme.border.width.thick], function (x, y) {
38
+ return x / 2 + y / 2;
39
+ });
40
+ 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%)");
41
+ return {
42
+ euiStep: /*#__PURE__*/(0, _react.css)("&:not(:last-of-type){background-image:", lineGradient, ";background-repeat:no-repeat;};label:euiStep;"),
43
+ // Sizes
44
+ m: /*#__PURE__*/(0, _react.css)("&:not(:last-of-type){background-position:left ", euiTheme.size.xl, ";};label:m;"),
45
+ s: /*#__PURE__*/(0, _react.css)("&:not(:last-of-type){background-position:left ", euiTheme.size.xl, ";};label:s;"),
46
+ xs: /*#__PURE__*/(0, _react.css)("&:not(:last-of-type){background-position:-", euiTheme.size.xs, " ", euiTheme.size.l, ";};label:xs;")
47
+ };
48
+ };
49
+
50
+ exports.euiStepStyles = euiStepStyles;
51
+
52
+ var euiStepContentStyles = function euiStepContentStyles(euiThemeContext) {
53
+ var euiTheme = euiThemeContext.euiTheme;
54
+ var euiStep = euiStepVariables(euiTheme);
55
+ var styles = {
56
+ euiStep__content: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('margin-top', euiTheme.size.s), " ", (0, _global_styling.logicalCSS)('padding-top', euiTheme.size.base), " ", (0, _global_styling.logicalCSS)('padding-bottom', (0, _global_styling.mathWithUnits)([euiTheme.size.xl, euiTheme.size.s], function (x, y) {
57
+ return x + y;
58
+ })), " ", (0, _global_styling.logicalCSS)('padding-right', euiTheme.size.base), ";;label:euiStep__content;"),
59
+ // Sizes
60
+ m: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('padding-left', (0, _global_styling.mathWithUnits)([euiStep.numberSize, euiStep.numberMargin], function (x, y) {
61
+ return x / 2 + y;
62
+ })), (0, _global_styling.logicalCSS)('margin-left', (0, _global_styling.mathWithUnits)(euiStep.numberSize, function (x) {
63
+ return x / 2;
64
+ })), ";;label:m;"),
65
+ s: /*#__PURE__*/(0, _react.css)(";label:s;"),
66
+ // s is the same as m, so we'll programmatically duplicate it below
67
+ xs: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('padding-left', (0, _global_styling.mathWithUnits)([euiStep.numberXSSize, euiStep.numberMargin], function (x, y) {
68
+ return x / 2 + y;
69
+ })), (0, _global_styling.logicalCSS)('margin-left', (0, _global_styling.mathWithUnits)(euiStep.numberXSSize, function (x) {
70
+ return x / 2;
71
+ })), ";;label:xs;")
72
+ };
73
+ styles.s = styles.m;
74
+ return styles;
75
+ };
76
+
77
+ exports.euiStepContentStyles = euiStepContentStyles;
78
+
79
+ var euiStepTitleStyles = function euiStepTitleStyles(euiThemeContext) {
80
+ var euiTheme = euiThemeContext.euiTheme;
81
+ var euiStep = euiStepVariables(euiTheme);
82
+ return {
83
+ euiStep__titleWrapper: /*#__PURE__*/(0, _react.css)("display:flex;gap:", euiStep.numberMargin, ";;label:euiStep__titleWrapper;"),
84
+ euiStep__title: /*#__PURE__*/(0, _react.css)(";label:euiStep__title;"),
85
+ isDisabled: /*#__PURE__*/(0, _react.css)("color:", euiTheme.colors.disabledText, ";;label:isDisabled;"),
86
+ // Sizes
87
+ m: /*#__PURE__*/(0, _react.css)(";label:m;"),
88
+ s: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('padding-top', euiTheme.size.xs), ";;label:s;"),
89
+ xs: /*#__PURE__*/(0, _react.css)(";label:xs;")
90
+ };
91
+ };
92
+
93
+ exports.euiStepTitleStyles = euiStepTitleStyles;
@@ -19,6 +19,10 @@ var _step_number = require("./step_number");
19
19
 
20
20
  var _step_strings = require("./step_strings");
21
21
 
22
+ var _services = require("../../services");
23
+
24
+ var _step_horizontal = require("./step_horizontal.styles");
25
+
22
26
  var _react2 = require("@emotion/react");
23
27
 
24
28
  var _excluded = ["className", "step", "title", "onClick", "disabled", "status"];
@@ -33,43 +37,50 @@ var EuiStepHorizontal = function EuiStepHorizontal(_ref) {
33
37
  _ref$status = _ref.status,
34
38
  status = _ref$status === void 0 ? 'incomplete' : _ref$status,
35
39
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
36
- var buttonTitle = (0, _step_strings.useI18nStep)({
37
- number: step,
38
- title: title
39
- });
40
- var completeTitle = (0, _step_strings.useI18nCompleteStep)({
41
- number: step,
42
- title: title
43
- });
44
- var disabledTitle = (0, _step_strings.useI18nDisabledStep)({
45
- number: step,
46
- title: title
47
- });
48
- var incompleteTitle = (0, _step_strings.useI18nIncompleteStep)({
49
- number: step,
50
- title: title
51
- });
52
- var warningTitle = (0, _step_strings.useI18nWarningStep)({
53
- number: step,
54
- title: title
55
- });
56
- var currentTitle = (0, _step_strings.useI18nCurrentStep)({
57
- number: step,
58
- title: title
59
- });
60
40
  if (disabled) status = 'disabled';
61
- var classes = (0, _classnames.default)('euiStepHorizontal', className, {
62
- 'euiStepHorizontal-isSelected': status === 'current',
63
- 'euiStepHorizontal-isComplete': status === 'complete',
64
- 'euiStepHorizontal-isIncomplete': status === 'incomplete',
65
- 'euiStepHorizontal-isDisabled': status === 'disabled'
66
- });
67
- var stepTitle = buttonTitle;
68
- if (status === 'disabled') stepTitle = disabledTitle;
69
- if (status === 'complete') stepTitle = completeTitle;
70
- if (status === 'incomplete') stepTitle = incompleteTitle;
71
- if (status === 'warning') stepTitle = warningTitle;
72
- if (status === 'current') stepTitle = currentTitle;
41
+ var classes = (0, _classnames.default)('euiStepHorizontal', className);
42
+ var euiTheme = (0, _services.useEuiTheme)();
43
+ var styles = (0, _step_horizontal.euiStepHorizontalStyles)(euiTheme);
44
+ var cssStyles = [styles.euiStepHorizontal, status === 'disabled' ? styles.disabled : styles.enabled];
45
+ var numberStyles = (0, _step_horizontal.euiStepHorizontalNumberStyles)(euiTheme);
46
+ var cssNumberStyles = [numberStyles.euiStepHorizontal__number];
47
+ var titleStyles = (0, _step_horizontal.euiStepHorizontalTitleStyles)(euiTheme);
48
+ var cssTitleStyles = [titleStyles.euiStepHorizontal__title, status === 'disabled' && titleStyles.disabled];
49
+ var titleAttrsMap = {
50
+ step: (0, _step_strings.useI18nStep)({
51
+ number: step,
52
+ title: title
53
+ }),
54
+ current: (0, _step_strings.useI18nCurrentStep)({
55
+ number: step,
56
+ title: title
57
+ }),
58
+ disabled: (0, _step_strings.useI18nDisabledStep)({
59
+ number: step,
60
+ title: title
61
+ }),
62
+ incomplete: (0, _step_strings.useI18nIncompleteStep)({
63
+ number: step,
64
+ title: title
65
+ }),
66
+ complete: (0, _step_strings.useI18nCompleteStep)({
67
+ number: step,
68
+ title: title
69
+ }),
70
+ warning: (0, _step_strings.useI18nWarningStep)({
71
+ number: step,
72
+ title: title
73
+ }),
74
+ danger: (0, _step_strings.useI18nErrorsStep)({
75
+ number: step,
76
+ title: title
77
+ }),
78
+ loading: (0, _step_strings.useI18nLoadingStep)({
79
+ number: step,
80
+ title: title
81
+ })
82
+ };
83
+ var titleAttr = titleAttrsMap[status || 'step'];
73
84
 
74
85
  var onStepClick = function onStepClick(event) {
75
86
  if (!disabled) onClick(event);
@@ -77,15 +88,19 @@ var EuiStepHorizontal = function EuiStepHorizontal(_ref) {
77
88
 
78
89
  return (0, _react2.jsx)("button", (0, _extends2.default)({
79
90
  className: classes,
80
- title: stepTitle,
91
+ title: titleAttr,
81
92
  onClick: onStepClick,
82
- disabled: disabled
93
+ disabled: disabled,
94
+ css: cssStyles,
95
+ "data-step-status": status
83
96
  }, rest), (0, _react2.jsx)(_step_number.EuiStepNumber, {
84
97
  className: "euiStepHorizontal__number",
85
98
  status: status,
86
- number: step
99
+ number: step,
100
+ css: cssNumberStyles
87
101
  }), (0, _react2.jsx)("span", {
88
- className: "euiStepHorizontal__title"
102
+ className: "euiStepHorizontal__title",
103
+ css: cssTitleStyles
89
104
  }, title));
90
105
  };
91
106
 
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.euiStepHorizontalTitleStyles = exports.euiStepHorizontalStyles = exports.euiStepHorizontalNumberStyles = void 0;
7
+
8
+ var _react = require("@emotion/react");
9
+
10
+ var _global_styling = require("../../global_styling/");
11
+
12
+ var _title = require("../title/title.styles");
13
+
14
+ var _step = require("./step.styles");
15
+
16
+ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
17
+
18
+ var _ref = process.env.NODE_ENV === "production" ? {
19
+ name: "b86pnw-disabled",
20
+ styles: "cursor:not-allowed;label:disabled;"
21
+ } : {
22
+ name: "b86pnw-disabled",
23
+ styles: "cursor:not-allowed;label:disabled;",
24
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
25
+ };
26
+
27
+ var euiStepHorizontalStyles = function euiStepHorizontalStyles(euiThemeContext) {
28
+ var euiTheme = euiThemeContext.euiTheme;
29
+ var euiStep = (0, _step.euiStepVariables)(euiTheme);
30
+ /**
31
+ * 1. Ensure the connecting lines stays behind the number
32
+ * 2. Make the content of each step align to the top, even if the steps are of varying heights,
33
+ * e.g. due to some of their titles wrapping to multiple lines
34
+ */
35
+
36
+ return {
37
+ euiStepHorizontal: /*#__PURE__*/(0, _react.css)((0, _global_styling.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:", (0, _global_styling.mathWithUnits)([euiTheme.size.l, euiStep.numberSize], function (x, y) {
38
+ return x + y / 2;
39
+ }), ";z-index:", euiTheme.levels.content, ";}&::before{inset-inline-start:0;}&::after{inset-inline-end:0;};label:euiStepHorizontal;"),
40
+ // Note: these selectors must be nested because focus/hover state
41
+ // is on the parent container, but affects specific children
42
+ enabled: /*#__PURE__*/(0, _react.css)("&:focus,&:hover{.euiStepHorizontal__title{text-decoration:underline;}}&:focus{outline:none;.euiStepHorizontal__number{", (0, _global_styling.euiFocusRing)(euiThemeContext), ";}.euiStepHorizontal__number:not(:focus-visible){outline:", euiTheme.focus.width, " solid ", euiTheme.colors.darkestShade, ";}};label:enabled;"),
43
+ disabled: _ref
44
+ };
45
+ };
46
+
47
+ exports.euiStepHorizontalStyles = euiStepHorizontalStyles;
48
+
49
+ var euiStepHorizontalNumberStyles = function euiStepHorizontalNumberStyles(euiThemeContext) {
50
+ var euiTheme = euiThemeContext.euiTheme;
51
+ return {
52
+ euiStepHorizontal__number: /*#__PURE__*/(0, _react.css)("position:relative;z-index:", Number(euiTheme.levels.content) + 1, ";", _global_styling.euiCanAnimate, "{transition:all ", euiTheme.animation.fast, " ease-in-out;};label:euiStepHorizontal__number;")
53
+ };
54
+ };
55
+
56
+ exports.euiStepHorizontalNumberStyles = euiStepHorizontalNumberStyles;
57
+
58
+ var euiStepHorizontalTitleStyles = function euiStepHorizontalTitleStyles(euiThemeContext) {
59
+ var euiTheme = euiThemeContext.euiTheme;
60
+ return {
61
+ euiStepHorizontal__title: /*#__PURE__*/(0, _react.css)((0, _title.euiTitle)(euiThemeContext, 'xs'), ";margin-block-start:", euiTheme.size.s, ";font-weight:", euiTheme.font.weight.bold, ";text-align:center;", (0, _global_styling.euiBreakpoint)(euiThemeContext, ['xs', 's']), "{display:none;};label:euiStepHorizontal__title;"),
62
+ disabled: /*#__PURE__*/(0, _react.css)("color:", euiTheme.colors.disabledText, ";;label:disabled;")
63
+ };
64
+ };
65
+
66
+ exports.euiStepHorizontalTitleStyles = euiStepHorizontalTitleStyles;