@elastic/eui 74.1.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 (149) 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/collapsible_nav/collapsible_nav.js +10 -11
  12. package/es/components/flyout/flyout.js +88 -24
  13. package/es/components/form/range/range_track.js +1 -1
  14. package/es/components/header/header.js +3 -1
  15. package/es/components/icon/assets/app_agent.js +2 -10
  16. package/es/components/icon/assets/app_fleet.js +10 -2
  17. package/es/components/search_bar/filters/field_value_selection_filter.js +6 -10
  18. package/es/components/selectable/selectable_list/selectable_list.js +19 -5
  19. package/es/components/steps/step.js +19 -12
  20. package/es/components/steps/step.styles.js +73 -0
  21. package/es/components/steps/step_horizontal.js +55 -42
  22. package/es/components/steps/step_horizontal.styles.js +55 -0
  23. package/es/components/steps/step_number.js +82 -73
  24. package/es/components/steps/step_number.styles.js +76 -0
  25. package/es/components/steps/steps_horizontal.js +11 -7
  26. package/es/components/steps/steps_horizontal.styles.js +35 -0
  27. package/es/components/steps/sub_steps.js +7 -1
  28. package/es/components/steps/sub_steps.styles.js +14 -0
  29. package/es/components/tour/tour_step_indicator.js +0 -3
  30. package/es/global_styling/utility/animations.js +4 -3
  31. package/eui.d.ts +130 -16
  32. package/i18ntokens.json +76 -12
  33. package/lib/components/code/code_block.js +5 -3
  34. package/lib/components/code/code_block_annotations.js +113 -0
  35. package/lib/components/code/code_block_annotations.style.js +29 -0
  36. package/lib/components/code/code_block_full_screen.js +9 -3
  37. package/lib/components/code/code_block_line.styles.js +3 -2
  38. package/lib/components/code/utils.js +54 -13
  39. package/lib/components/collapsible_nav/collapsible_nav.js +10 -11
  40. package/lib/components/flyout/flyout.js +85 -22
  41. package/lib/components/form/range/range_track.js +1 -1
  42. package/lib/components/header/header.js +3 -1
  43. package/lib/components/icon/assets/app_agent.js +2 -10
  44. package/lib/components/icon/assets/app_fleet.js +10 -2
  45. package/lib/components/icon/svgs/app_agent.svg +2 -4
  46. package/lib/components/icon/svgs/app_fleet.svg +4 -2
  47. package/lib/components/search_bar/filters/field_value_selection_filter.js +6 -10
  48. package/lib/components/selectable/selectable_list/selectable_list.js +19 -5
  49. package/lib/components/steps/step.js +21 -12
  50. package/lib/components/steps/step.styles.js +93 -0
  51. package/lib/components/steps/step_horizontal.js +56 -41
  52. package/lib/components/steps/step_horizontal.styles.js +66 -0
  53. package/lib/components/steps/step_number.js +86 -75
  54. package/lib/components/steps/step_number.styles.js +84 -0
  55. package/lib/components/steps/steps_horizontal.js +12 -7
  56. package/lib/components/steps/steps_horizontal.styles.js +38 -0
  57. package/lib/components/steps/sub_steps.js +9 -1
  58. package/lib/components/steps/sub_steps.styles.js +24 -0
  59. package/lib/components/tour/tour_step_indicator.js +0 -3
  60. package/lib/global_styling/utility/animations.js +6 -4
  61. package/optimize/es/components/code/code_block_annotations.js +79 -0
  62. package/optimize/es/components/code/code_block_annotations.style.js +18 -0
  63. package/optimize/es/components/code/code_block_full_screen.js +9 -3
  64. package/optimize/es/components/code/code_block_line.styles.js +3 -2
  65. package/optimize/es/components/code/utils.js +53 -13
  66. package/optimize/es/components/collapsible_nav/collapsible_nav.js +1 -4
  67. package/optimize/es/components/flyout/flyout.js +81 -24
  68. package/optimize/es/components/form/range/range_track.js +1 -1
  69. package/optimize/es/components/header/header.js +3 -1
  70. package/optimize/es/components/icon/assets/app_agent.js +2 -10
  71. package/optimize/es/components/icon/assets/app_fleet.js +10 -2
  72. package/optimize/es/components/search_bar/filters/field_value_selection_filter.js +6 -10
  73. package/optimize/es/components/selectable/selectable_list/selectable_list.js +19 -5
  74. package/optimize/es/components/steps/step.js +19 -12
  75. package/optimize/es/components/steps/step.styles.js +73 -0
  76. package/optimize/es/components/steps/step_horizontal.js +54 -41
  77. package/optimize/es/components/steps/step_horizontal.styles.js +55 -0
  78. package/optimize/es/components/steps/step_number.js +82 -73
  79. package/optimize/es/components/steps/step_number.styles.js +76 -0
  80. package/optimize/es/components/steps/steps_horizontal.js +11 -7
  81. package/optimize/es/components/steps/steps_horizontal.styles.js +35 -0
  82. package/optimize/es/components/steps/sub_steps.js +7 -1
  83. package/optimize/es/components/steps/sub_steps.styles.js +14 -0
  84. package/optimize/es/components/tour/tour_step_indicator.js +0 -3
  85. package/optimize/es/global_styling/utility/animations.js +4 -3
  86. package/optimize/lib/components/code/code_block_annotations.js +105 -0
  87. package/optimize/lib/components/code/code_block_annotations.style.js +29 -0
  88. package/optimize/lib/components/code/code_block_full_screen.js +9 -3
  89. package/optimize/lib/components/code/code_block_line.styles.js +3 -2
  90. package/optimize/lib/components/code/utils.js +54 -13
  91. package/optimize/lib/components/collapsible_nav/collapsible_nav.js +1 -4
  92. package/optimize/lib/components/flyout/flyout.js +80 -22
  93. package/optimize/lib/components/form/range/range_track.js +1 -1
  94. package/optimize/lib/components/header/header.js +3 -1
  95. package/optimize/lib/components/icon/assets/app_agent.js +2 -10
  96. package/optimize/lib/components/icon/assets/app_fleet.js +10 -2
  97. package/optimize/lib/components/icon/svgs/app_agent.svg +2 -4
  98. package/optimize/lib/components/icon/svgs/app_fleet.svg +4 -2
  99. package/optimize/lib/components/search_bar/filters/field_value_selection_filter.js +6 -10
  100. package/optimize/lib/components/selectable/selectable_list/selectable_list.js +16 -5
  101. package/optimize/lib/components/steps/step.js +21 -12
  102. package/optimize/lib/components/steps/step.styles.js +93 -0
  103. package/optimize/lib/components/steps/step_horizontal.js +55 -40
  104. package/optimize/lib/components/steps/step_horizontal.styles.js +66 -0
  105. package/optimize/lib/components/steps/step_number.js +86 -75
  106. package/optimize/lib/components/steps/step_number.styles.js +84 -0
  107. package/optimize/lib/components/steps/steps_horizontal.js +12 -7
  108. package/optimize/lib/components/steps/steps_horizontal.styles.js +38 -0
  109. package/optimize/lib/components/steps/sub_steps.js +9 -1
  110. package/optimize/lib/components/steps/sub_steps.styles.js +24 -0
  111. package/optimize/lib/components/tour/tour_step_indicator.js +0 -3
  112. package/optimize/lib/global_styling/utility/animations.js +6 -4
  113. package/package.json +3 -3
  114. package/src/components/index.scss +0 -1
  115. package/src/themes/amsterdam/global_styling/variables/_index.scss +0 -1
  116. package/src/themes/amsterdam/overrides/_index.scss +0 -1
  117. package/test-env/components/code/code_block_annotations.js +110 -0
  118. package/test-env/components/code/code_block_annotations.style.js +29 -0
  119. package/test-env/components/code/code_block_full_screen.js +9 -3
  120. package/test-env/components/code/code_block_line.styles.js +3 -2
  121. package/test-env/components/code/utils.js +54 -13
  122. package/test-env/components/collapsible_nav/collapsible_nav.js +10 -11
  123. package/test-env/components/form/range/range_track.js +1 -1
  124. package/test-env/components/header/header.js +3 -1
  125. package/test-env/components/icon/assets/app_agent.js +2 -10
  126. package/test-env/components/icon/assets/app_fleet.js +10 -2
  127. package/test-env/components/search_bar/filters/field_value_selection_filter.js +6 -10
  128. package/test-env/components/selectable/selectable_list/selectable_list.js +16 -5
  129. package/test-env/components/steps/step.js +21 -12
  130. package/test-env/components/steps/step.styles.js +93 -0
  131. package/test-env/components/steps/step_horizontal.js +56 -41
  132. package/test-env/components/steps/step_horizontal.styles.js +66 -0
  133. package/test-env/components/steps/step_number.js +86 -75
  134. package/test-env/components/steps/step_number.styles.js +84 -0
  135. package/test-env/components/steps/steps_horizontal.js +12 -7
  136. package/test-env/components/steps/steps_horizontal.styles.js +38 -0
  137. package/test-env/components/steps/sub_steps.js +9 -1
  138. package/test-env/components/steps/sub_steps.styles.js +24 -0
  139. package/test-env/components/tour/tour_step_indicator.js +0 -3
  140. package/test-env/global_styling/utility/animations.js +6 -4
  141. package/src/components/steps/_index.scss +0 -7
  142. package/src/components/steps/_mixins.scss +0 -12
  143. package/src/components/steps/_step_number.scss +0 -52
  144. package/src/components/steps/_steps.scss +0 -57
  145. package/src/components/steps/_steps_horizontal.scss +0 -135
  146. package/src/components/steps/_sub_steps.scss +0 -15
  147. package/src/components/steps/_variables.scss +0 -11
  148. package/src/themes/amsterdam/global_styling/variables/_steps.scss +0 -8
  149. package/src/themes/amsterdam/overrides/_steps.scss +0 -101
@@ -117,6 +117,22 @@ export var EuiSelectableList = /*#__PURE__*/function (_Component) {
117
117
  }
118
118
  });
119
119
 
120
+ _defineProperty(_assertThisInitialized(_this), "ariaSetSize", 0);
121
+
122
+ _defineProperty(_assertThisInitialized(_this), "ariaPosInSetMap", {});
123
+
124
+ _defineProperty(_assertThisInitialized(_this), "calculateAriaSetAttrs", function (optionArray) {
125
+ _this.ariaPosInSetMap = {};
126
+ var latestAriaPosIndex = 0;
127
+ optionArray.forEach(function (option, index) {
128
+ if (!option.isGroupLabel) {
129
+ latestAriaPosIndex++;
130
+ _this.ariaPosInSetMap[index] = latestAriaPosIndex;
131
+ }
132
+ });
133
+ _this.ariaSetSize = latestAriaPosIndex;
134
+ });
135
+
120
136
  _defineProperty(_assertThisInitialized(_this), "ListRow", /*#__PURE__*/memo(function (_ref) {
121
137
  var data = _ref.data,
122
138
  index = _ref.index,
@@ -160,9 +176,6 @@ export var EuiSelectableList = /*#__PURE__*/function (_Component) {
160
176
  }, optionRest), prepend, label, append);
161
177
  }
162
178
 
163
- var labelCount = data.filter(function (option) {
164
- return option.isGroupLabel;
165
- }).length;
166
179
  var id = makeOptionId(index);
167
180
  return ___EmotionJSX(EuiSelectableListItem, _extends({
168
181
  key: id,
@@ -183,8 +196,8 @@ export var EuiSelectableList = /*#__PURE__*/function (_Component) {
183
196
  disabled: disabled,
184
197
  prepend: prepend,
185
198
  append: append,
186
- "aria-posinset": index + 1 - labelCount,
187
- "aria-setsize": data.length - labelCount,
199
+ "aria-posinset": _this.ariaPosInSetMap[index],
200
+ "aria-setsize": _this.ariaSetSize,
188
201
  onFocusBadge: onFocusBadge,
189
202
  allowExclusions: allowExclusions,
190
203
  showIcons: showIcons,
@@ -341,6 +354,7 @@ export var EuiSelectableList = /*#__PURE__*/function (_Component) {
341
354
  rest = _objectWithoutProperties(_this$props7, _excluded3);
342
355
 
343
356
  var optionArray = visibleOptions || options;
357
+ this.calculateAriaSetAttrs(optionArray);
344
358
  var heightIsFull = forcedHeight === 'full';
345
359
  var calculatedHeight = heightIsFull ? false : forcedHeight; // If calculatedHeight is still undefined, then calculate it
346
360
 
@@ -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
+ };
@@ -17,94 +17,103 @@ import classNames from 'classnames';
17
17
  import PropTypes from "prop-types";
18
18
  import React from 'react';
19
19
  import { EuiScreenReaderOnly } from '../accessibility';
20
- import { keysOf } from '../common';
21
20
  import { EuiIcon } from '../icon';
22
21
  import { useI18nCompleteStep, useI18nDisabledStep, useI18nErrorsStep, useI18nIncompleteStep, useI18nStep, useI18nWarningStep, useI18nLoadingStep, useI18nCurrentStep } from './step_strings';
23
22
  import { EuiLoadingSpinner } from '../loading';
23
+ import { useEuiTheme } from '../../services';
24
+ import { euiStepNumberStyles, euiStepNumberContentStyles } from './step_number.styles';
24
25
  import { jsx as ___EmotionJSX } from "@emotion/react";
25
- var statusToClassNameMap = {
26
- incomplete: 'euiStepNumber--incomplete',
27
- disabled: 'euiStepNumber--disabled',
28
- loading: 'euiStepNumber--loading',
29
- warning: 'euiStepNumber--warning',
30
- danger: 'euiStepNumber--danger',
31
- complete: 'euiStepNumber--complete',
32
- current: null // Current displays the same as the default (undefined)
33
-
34
- };
35
- export var STATUS = keysOf(statusToClassNameMap);
26
+ export var STATUS = ['incomplete', 'disabled', 'loading', 'warning', 'danger', 'complete', 'current'];
36
27
  export var EuiStepNumber = function EuiStepNumber(_ref) {
37
28
  var className = _ref.className,
38
29
  status = _ref.status,
39
30
  number = _ref.number,
40
- titleSize = _ref.titleSize,
31
+ _ref$titleSize = _ref.titleSize,
32
+ titleSize = _ref$titleSize === void 0 ? 's' : _ref$titleSize,
41
33
  rest = _objectWithoutProperties(_ref, _excluded);
42
34
 
43
- var stepAriaLabel = useI18nStep({
44
- number: number
45
- });
46
- var completeAriaLabel = useI18nCompleteStep({
47
- number: number
48
- });
49
- var warningAriaLabel = useI18nWarningStep({
50
- number: number
51
- });
52
- var errorsAriaLabel = useI18nErrorsStep({
53
- number: number
54
- });
55
- var incompleteAriaLabel = useI18nIncompleteStep({
56
- number: number
57
- });
58
- var disabledAriaLabel = useI18nDisabledStep({
59
- number: number
60
- });
61
- var loadingAriaLabel = useI18nLoadingStep({
62
- number: number
63
- });
64
- var currentAriaLabel = useI18nCurrentStep({
65
- number: number
66
- });
67
- var classes = classNames('euiStepNumber', status ? statusToClassNameMap[status] : undefined, className);
68
- var iconSize = titleSize === 'xs' ? 's' : 'm';
69
- var screenReaderText = stepAriaLabel;
70
- if (status === 'incomplete') screenReaderText = incompleteAriaLabel;else if (status === 'disabled') screenReaderText = disabledAriaLabel;else if (status === 'loading') screenReaderText = loadingAriaLabel;else if (status === 'current') screenReaderText = currentAriaLabel;
35
+ var ariaLabelsMap = {
36
+ step: useI18nStep({
37
+ number: number
38
+ }),
39
+ current: useI18nCurrentStep({
40
+ number: number
41
+ }),
42
+ incomplete: useI18nIncompleteStep({
43
+ number: number
44
+ }),
45
+ complete: useI18nCompleteStep({
46
+ number: number
47
+ }),
48
+ disabled: useI18nDisabledStep({
49
+ number: number
50
+ }),
51
+ warning: useI18nWarningStep({
52
+ number: number
53
+ }),
54
+ danger: useI18nErrorsStep({
55
+ number: number
56
+ }),
57
+ loading: useI18nLoadingStep({
58
+ number: number
59
+ })
60
+ };
61
+ var classes = classNames('euiStepNumber', className);
62
+ var euiTheme = useEuiTheme();
63
+ var styles = euiStepNumberStyles(euiTheme);
64
+ var cssStyles = [styles.euiStepNumber, styles[titleSize], status && styles[status]];
65
+ var contentStyles = euiStepNumberContentStyles(euiTheme);
66
+ var content;
67
+ var screenReaderText;
68
+
69
+ switch (status) {
70
+ // Loading spinner
71
+ case 'loading':
72
+ screenReaderText = ariaLabelsMap.loading;
73
+ content = ___EmotionJSX(EuiLoadingSpinner, {
74
+ className: "euiStepNumber__loader",
75
+ size: titleSize === 'xs' ? 'l' : 'xl'
76
+ });
77
+ break;
78
+ // Statuses with icons
71
79
 
72
- var numberOrIcon = ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("span", null, screenReaderText)), ___EmotionJSX("span", {
73
- className: "euiStepNumber__number",
74
- "aria-hidden": "true"
75
- }, number));
80
+ case 'danger':
81
+ case 'warning':
82
+ case 'complete':
83
+ var cssIconStyles = [contentStyles.euiStepNumber__icon, contentStyles[status]];
84
+ var iconTypeMap = {
85
+ danger: 'cross',
86
+ warning: 'alert',
87
+ complete: 'check'
88
+ };
89
+ content = ___EmotionJSX(EuiIcon, {
90
+ type: iconTypeMap[status],
91
+ "aria-label": ariaLabelsMap[status],
92
+ size: titleSize === 'xs' ? 's' : 'm',
93
+ className: "euiStepNumber__icon",
94
+ css: cssIconStyles
95
+ });
96
+ break;
97
+ // Statuses with numbers
76
98
 
77
- if (status === 'complete') {
78
- numberOrIcon = ___EmotionJSX(EuiIcon, {
79
- type: "check",
80
- className: "euiStepNumber__icon",
81
- size: iconSize,
82
- "aria-label": completeAriaLabel
83
- });
84
- } else if (status === 'warning') {
85
- numberOrIcon = ___EmotionJSX(EuiIcon, {
86
- type: "alert",
87
- className: "euiStepNumber__icon",
88
- size: iconSize,
89
- "aria-label": warningAriaLabel
90
- });
91
- } else if (status === 'danger') {
92
- numberOrIcon = ___EmotionJSX(EuiIcon, {
93
- type: "cross",
94
- className: "euiStepNumber__icon",
95
- size: iconSize,
96
- "aria-label": errorsAriaLabel
97
- });
98
- } else if (status === 'loading') {
99
- numberOrIcon = ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("span", null, screenReaderText)), ___EmotionJSX(EuiLoadingSpinner, {
100
- className: "euiStepNumber__loader",
101
- size: iconSize === 's' ? 'l' : 'xl'
102
- }));
99
+ case 'incomplete':
100
+ case 'current':
101
+ case 'disabled':
102
+ default:
103
+ var cssNumberStyles = [contentStyles.euiStepNumber__number, status && contentStyles[status]];
104
+ screenReaderText = ariaLabelsMap[status || 'step'];
105
+ content = ___EmotionJSX("span", {
106
+ "aria-hidden": "true",
107
+ className: "euiStepNumber__number",
108
+ css: cssNumberStyles
109
+ }, number);
110
+ break;
103
111
  }
104
112
 
105
113
  return ___EmotionJSX("span", _extends({
106
- className: classes
107
- }, rest), numberOrIcon);
114
+ className: classes,
115
+ css: cssStyles
116
+ }, rest), screenReaderText && ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("span", null, screenReaderText)), content);
108
117
  };
109
118
  EuiStepNumber.propTypes = {
110
119
  /**
@@ -0,0 +1,76 @@
1
+ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
2
+
3
+ /*
4
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
5
+ * or more contributor license agreements. Licensed under the Elastic License
6
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
7
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
8
+ * Side Public License, v 1.
9
+ */
10
+ import { css } from '@emotion/react';
11
+ import { mathWithUnits, logicalCSS, euiFontSizeFromScale, euiCanAnimate, euiAnimScale } from '../../global_styling';
12
+ import { euiStepVariables } from './step.styles';
13
+ import { euiButtonFillColor } from '../../themes/amsterdam/global_styling/mixins';
14
+
15
+ var _ref = process.env.NODE_ENV === "production" ? {
16
+ name: "76s2de-loading",
17
+ styles: "background:transparent;label:loading;"
18
+ } : {
19
+ name: "76s2de-loading",
20
+ styles: "background:transparent;label:loading;",
21
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
22
+ };
23
+
24
+ var _ref2 = process.env.NODE_ENV === "production" ? {
25
+ name: "1ru1jeq-euiStepNumber",
26
+ styles: "flex-shrink:0;label:euiStepNumber;"
27
+ } : {
28
+ name: "1ru1jeq-euiStepNumber",
29
+ styles: "flex-shrink:0;label:euiStepNumber;",
30
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
31
+ };
32
+
33
+ export var euiStepNumberStyles = function euiStepNumberStyles(euiThemeContext) {
34
+ var euiTheme = euiThemeContext.euiTheme;
35
+ var euiStep = euiStepVariables(euiTheme);
36
+
37
+ var createStepsNumber = function createStepsNumber(size, fontSize) {
38
+ return "\n display: inline-block;\n line-height: ".concat(size, ";\n border-radius: ").concat(size, ";\n ").concat(logicalCSS('width', size), ";\n ").concat(logicalCSS('height', size), ";\n text-align: center;\n color: ").concat(euiTheme.colors.emptyShade, ";\n background-color: ").concat(euiTheme.colors.primary, ";\n font-size: ").concat(fontSize, ";\n font-weight: ").concat(euiTheme.font.weight.medium, ";\n ");
39
+ };
40
+
41
+ return {
42
+ euiStepNumber: _ref2,
43
+ // sizes
44
+ m: /*#__PURE__*/css(createStepsNumber(euiStep.numberSize, euiFontSizeFromScale('s', euiTheme)), ";;label:m;"),
45
+ s: /*#__PURE__*/css(createStepsNumber(euiStep.numberSize, euiFontSizeFromScale('s', euiTheme)), ";;label:s;"),
46
+ xs: /*#__PURE__*/css(createStepsNumber(euiStep.numberXSSize, euiFontSizeFromScale('xs', euiTheme)), ";;label:xs;"),
47
+ // status
48
+ incomplete: /*#__PURE__*/css("background-color:transparent;color:", euiTheme.colors.text, ";border:", euiTheme.border.thick, ";;label:incomplete;"),
49
+ disabled: /*#__PURE__*/css("color:", euiButtonFillColor(euiThemeContext, 'disabled').color, ";background-color:", euiButtonFillColor(euiThemeContext, 'disabled').backgroundColor, ";;label:disabled;"),
50
+ loading: _ref,
51
+ warning: /*#__PURE__*/css("color:", euiButtonFillColor(euiThemeContext, 'warning').color, ";background-color:", euiButtonFillColor(euiThemeContext, 'warning').backgroundColor, ";", euiCanAnimate, "{animation:", euiAnimScale, " ", euiTheme.animation.fast, " ", euiTheme.animation.bounce, ";};label:warning;"),
52
+ danger: /*#__PURE__*/css("color:", euiButtonFillColor(euiThemeContext, 'danger').color, ";background-color:", euiButtonFillColor(euiThemeContext, 'danger').backgroundColor, ";", euiCanAnimate, "{animation:", euiAnimScale, " ", euiTheme.animation.fast, " ", euiTheme.animation.bounce, ";};label:danger;"),
53
+ complete: /*#__PURE__*/css("color:", euiButtonFillColor(euiThemeContext, 'success').color, ";background-color:", euiButtonFillColor(euiThemeContext, 'success').backgroundColor, ";", euiCanAnimate, "{animation:", euiAnimScale, " ", euiTheme.animation.fast, " ", euiTheme.animation.bounce, ";};label:complete;"),
54
+ current: /*#__PURE__*/css(";label:current;")
55
+ };
56
+ };
57
+ export var euiStepNumberContentStyles = function euiStepNumberContentStyles(_ref3) {
58
+ var euiTheme = _ref3.euiTheme;
59
+ return {
60
+ // Statuses with icon content
61
+ euiStepNumber__icon: /*#__PURE__*/css("vertical-align:middle;position:relative;inset-block-start:-", euiTheme.border.width.thin, ";;label:euiStepNumber__icon;"),
62
+ complete: /*#__PURE__*/css("stroke:currentColor;stroke-width:", mathWithUnits(euiTheme.border.width.thin, function (x) {
63
+ return x / 2;
64
+ }), ";;label:complete;"),
65
+ danger: /*#__PURE__*/css("stroke:currentColor;stroke-width:", mathWithUnits(euiTheme.border.width.thin, function (x) {
66
+ return x / 2;
67
+ }), ";;label:danger;"),
68
+ warning: /*#__PURE__*/css("inset-block-start:-", euiTheme.border.width.thick, ";;label:warning;"),
69
+ // Statuses with number content
70
+ euiStepNumber__number: /*#__PURE__*/css(";label:euiStepNumber__number;"),
71
+ incomplete: /*#__PURE__*/css("display:unset;position:relative;inset-block-start:-", euiTheme.border.width.thick, ";;label:incomplete;"),
72
+ loading: /*#__PURE__*/css(";label:loading;"),
73
+ disabled: /*#__PURE__*/css(";label:disabled;"),
74
+ current: /*#__PURE__*/css(";label:current;")
75
+ };
76
+ };
@@ -17,6 +17,7 @@ import classNames from 'classnames';
17
17
  import PropTypes from "prop-types";
18
18
  import React from 'react';
19
19
  import { EuiStepHorizontal } from './step_horizontal';
20
+ import { euiStepsHorizontalStyles } from './steps_horizontal.styles';
20
21
  import { jsx as ___EmotionJSX } from "@emotion/react";
21
22
  export var EuiStepsHorizontal = function EuiStepsHorizontal(_ref) {
22
23
  var className = _ref.className,
@@ -24,16 +25,19 @@ export var EuiStepsHorizontal = function EuiStepsHorizontal(_ref) {
24
25
  rest = _objectWithoutProperties(_ref, _excluded);
25
26
 
26
27
  var classes = classNames('euiStepsHorizontal', className);
28
+ var styles = euiStepsHorizontalStyles();
29
+ var cssStyles = styles.euiStepsHorizontal;
30
+ var cssItemStyles = styles.euiStepsHorizontal__item;
27
31
  return ___EmotionJSX("ol", _extends({
28
- className: classes
32
+ className: classes,
33
+ css: cssStyles
29
34
  }, rest), steps.map(function (stepProps, index) {
30
- var isCurrent = stepProps.status === 'current' ? {
31
- 'aria-current': 'step'
32
- } : {};
33
- return ___EmotionJSX("li", _extends({
35
+ return ___EmotionJSX("li", {
34
36
  key: index,
35
- className: "euiStepHorizontal__item"
36
- }, isCurrent), ___EmotionJSX(EuiStepHorizontal, _extends({
37
+ className: "euiStepsHorizontal__item",
38
+ css: cssItemStyles,
39
+ "aria-current": stepProps.status === 'current' ? 'step' : undefined
40
+ }, ___EmotionJSX(EuiStepHorizontal, _extends({
37
41
  step: index + 1
38
42
  }, stepProps)));
39
43
  }));