+
+
+ Step 1 is loading
+
+
5
@@ -295,6 +340,7 @@ exports[`EuiStep props titleSize 1`] = `
1
diff --git a/src/components/steps/__snapshots__/step_horizontal.test.tsx.snap b/src/components/steps/__snapshots__/step_horizontal.test.tsx.snap
index 8b5a687edcc..31961ee55a0 100644
--- a/src/components/steps/__snapshots__/step_horizontal.test.tsx.snap
+++ b/src/components/steps/__snapshots__/step_horizontal.test.tsx.snap
@@ -17,6 +17,7 @@ exports[`EuiStepHorizontal is rendered 1`] = `
1
@@ -62,6 +63,7 @@ exports[`EuiStepHorizontal props isSelected 1`] = `
1
@@ -127,6 +129,7 @@ exports[`EuiStepHorizontal props status disabled is rendered 1`] = `
1
@@ -152,6 +155,7 @@ exports[`EuiStepHorizontal props status incomplete is rendered 1`] = `
1
@@ -162,6 +166,29 @@ exports[`EuiStepHorizontal props status incomplete is rendered 1`] = `
`;
+exports[`EuiStepHorizontal props status loading is rendered 1`] = `
+
+
+
+ Step 1 is loading
+
+
+
+
+
+`;
+
exports[`EuiStepHorizontal props status warning is rendered 1`] = `
5
@@ -222,6 +250,7 @@ exports[`EuiStepHorizontal props title 1`] = `
1
diff --git a/src/components/steps/__snapshots__/step_number.test.tsx.snap b/src/components/steps/__snapshots__/step_number.test.tsx.snap
index a6f8a1e74d8..e64f34b57bb 100644
--- a/src/components/steps/__snapshots__/step_number.test.tsx.snap
+++ b/src/components/steps/__snapshots__/step_number.test.tsx.snap
@@ -13,6 +13,7 @@ exports[`EuiStepNumber is rendered 1`] = `
`;
@@ -28,6 +29,7 @@ exports[`EuiStepNumber props has titleSize is rendered 1`] = `
1
@@ -43,6 +45,12 @@ exports[`EuiStepNumber props isHollow is rendered 1`] = `
>
Step 1
+
+ 1
+
`;
@@ -81,6 +89,7 @@ exports[`EuiStepNumber props status disabled is rendered 1`] = `
1
@@ -98,12 +107,28 @@ exports[`EuiStepNumber props status incomplete is rendered 1`] = `
1
`;
+exports[`EuiStepNumber props status loading is rendered 1`] = `
+
+
+ Step 1 is loading
+
+
+
+`;
+
exports[`EuiStepNumber props status warning is rendered 1`] = `
1
@@ -56,6 +57,7 @@ exports[`EuiSteps renders step title inside "headingElement" element 1`] = `
2
@@ -88,6 +90,12 @@ exports[`EuiSteps renders step title inside "headingElement" element 1`] = `
>
Step 3 is incomplete
+
+ 3
+
1
@@ -162,6 +171,7 @@ exports[`EuiSteps renders steps 1`] = `
2
@@ -194,6 +204,12 @@ exports[`EuiSteps renders steps 1`] = `
>
Step 3 is incomplete
+
+ 3
+
10
@@ -268,6 +285,7 @@ exports[`EuiSteps renders steps with firstStepNumber 1`] = `
11
@@ -300,6 +318,12 @@ exports[`EuiSteps renders steps with firstStepNumber 1`] = `
>
Step 12 is incomplete
+
+ 12
+
1
@@ -374,6 +399,7 @@ exports[`EuiSteps renders steps with titleSize 1`] = `
2
@@ -406,6 +432,12 @@ exports[`EuiSteps renders steps with titleSize 1`] = `
>
Step 3 is incomplete
+
+ 3
+
2
@@ -75,6 +76,7 @@ exports[`EuiStepsHorizontal is rendered 1`] = `
3
@@ -104,6 +106,7 @@ exports[`EuiStepsHorizontal is rendered 1`] = `
4
diff --git a/src/components/steps/_step_number.scss b/src/components/steps/_step_number.scss
index 01fd152b5ad..0b641b96db8 100644
--- a/src/components/steps/_step_number.scss
+++ b/src/components/steps/_step_number.scss
@@ -2,6 +2,7 @@
@include createStepsNumber;
.euiStepNumber__icon {
+ vertical-align: middle;
position: relative;
top: -2px;
}
@@ -15,16 +16,32 @@
}
&--complete {
- // Thicken the checkmark but adding a slight stroke.
+ // Thicken the checkmark by adding a slight stroke.
.euiStepNumber__icon {
stroke: currentColor;
stroke-width: .5px;
}
}
+ @include euiCanAnimate {
+ &--complete,
+ &--warning,
+ &--danger {
+ animation: euiGrow $euiAnimSpeedFast $euiAnimSlightBounce;
+ }
+ }
+
+ &--loading {
+ background: transparent;
+ }
+
&.euiStepNumber-isHollow {
background-color: transparent;
border: 2px solid $euiColorPrimary;
+
+ .euiStepNumber__number {
+ display: none;
+ }
}
// Create modifiers based upon the map
@@ -39,10 +56,6 @@
color: $textColor;
background-color: $backgroundColor;
-
- &.euiStepNumber-isHollow {
- border-color: $color;
- }
}
}
}
diff --git a/src/components/steps/_steps.scss b/src/components/steps/_steps.scss
index 3fb656527a7..fe5816363c5 100644
--- a/src/components/steps/_steps.scss
+++ b/src/components/steps/_steps.scss
@@ -42,17 +42,6 @@
flex-shrink: 0;
margin-right: $euiStepNumberMargin;
vertical-align: top; /* 1 */
-
- &[class*='complete'],
- &[class*='warning'],
- &[class*='danger'] {
- animation: euiGrow $euiAnimSpeedFast $euiAnimSlightBounce;
- }
-
- &[class*='incomplete'] {
- border-color: $euiColorPrimary;
- animation: none;
- }
}
.euiStep__title {
diff --git a/src/components/steps/_steps_horizontal.scss b/src/components/steps/_steps_horizontal.scss
index 88e15494a84..32d2326003b 100644
--- a/src/components/steps/_steps_horizontal.scss
+++ b/src/components/steps/_steps_horizontal.scss
@@ -41,19 +41,19 @@
// focus & hover state
&:focus:not(.euiStepHorizontal-isDisabled),
&:hover:not(.euiStepHorizontal-isDisabled) {
- .euiStepHorizontal__number {
- @include euiFocusRing(large);
-
- // sass-lint:disable-block indentation
- transition: background-color $euiAnimSpeedNormal $euiAnimSlightResistance,
- color $euiAnimSpeedNormal $euiAnimSlightResistance;
- }
-
.euiStepHorizontal__title {
text-decoration: underline;
}
}
+ &:focus:not(.euiStepHorizontal-isDisabled) {
+ outline: none;
+
+ .euiStepHorizontal__number {
+ @include euiFocusRing(large);
+ }
+ }
+
// disabled state
&.euiStepHorizontal-isDisabled {
cursor: not-allowed;
@@ -64,7 +64,7 @@
&::after {
content: '';
position: absolute;
- width: 50%;
+ width: calc(50% - #{$euiStepNumberSize / 2});
height: 1px;
top: $euiSizeL + ($euiStepNumberSize / 2);
background-color: $euiColorLightShade;
@@ -107,7 +107,7 @@
// Selected state
.euiStepHorizontal-isSelected {
- .euiStepHorizontal__number:not([class*='danger']):not([class*='warning']) {
+ .euiStepHorizontal__number:not([class*='danger']):not([class*='warning']):not([class*='loading']) {
@include euiSlightShadow(desaturate($euiColorPrimary, 20%));
}
diff --git a/src/components/steps/index.ts b/src/components/steps/index.ts
index ced5b7c87a3..8c5b2d76fc9 100644
--- a/src/components/steps/index.ts
+++ b/src/components/steps/index.ts
@@ -23,6 +23,8 @@ export { EuiSteps, EuiStepsProps } from './steps';
export { EuiSubSteps, EuiSubStepsProps } from './sub_steps';
+export { EuiStepHorizontal } from './step_horizontal';
+
export {
EuiStepsHorizontal,
EuiStepsHorizontalProps,
diff --git a/src/components/steps/step.tsx b/src/components/steps/step.tsx
index 69bc68913bc..c42591c285f 100644
--- a/src/components/steps/step.tsx
+++ b/src/components/steps/step.tsx
@@ -70,6 +70,7 @@ export const EuiStep: FunctionComponent = ({
'euiStep',
{
'euiStep--small': titleSize === 'xs',
+ 'euiStep-isDisabled': status === 'disabled',
},
className
);
diff --git a/src/components/steps/step_horizontal.tsx b/src/components/steps/step_horizontal.tsx
index cfbd820c435..64770589d34 100644
--- a/src/components/steps/step_horizontal.tsx
+++ b/src/components/steps/step_horizontal.tsx
@@ -38,14 +38,19 @@ export interface EuiStepHorizontalProps
extends Omit, 'onClick'>,
CommonProps {
/**
- * Is the current step
+ * **DEPRECATED IN AMSTERDAM**
+ * Adds to the line before the indicator for showing current progress
*/
isSelected?: boolean;
/**
- * Is a previous step that has been completed
+ * **DEPRECATED IN AMSTERDAM**
+ * Adds to the line after the indicator for showing current progress
*/
isComplete?: boolean;
onClick: MouseEventHandler;
+ /**
+ * Makes the whole step button disabled.
+ */
disabled?: boolean;
/**
* The number of the step in the list of steps
@@ -53,6 +58,7 @@ export interface EuiStepHorizontalProps
step?: number;
title?: string;
/**
+ * Visual representation of the step number indicator.
* May replace the number provided in props.step with alternate styling.
* The `isSelected`, `isComplete`, and `disabled` props will override these.
*/
diff --git a/src/components/steps/step_number.tsx b/src/components/steps/step_number.tsx
index 10b393ffbca..203b68348da 100644
--- a/src/components/steps/step_number.tsx
+++ b/src/components/steps/step_number.tsx
@@ -30,24 +30,21 @@ import {
useI18nIncompleteStep,
useI18nStep,
useI18nWarningStep,
+ useI18nLoadingStep,
} from './step_strings';
+import { EuiLoadingSpinner } from '../loading';
const statusToClassNameMap = {
- complete: 'euiStepNumber--complete',
incomplete: 'euiStepNumber--incomplete',
+ disabled: 'euiStepNumber--disabled',
+ loading: 'euiStepNumber--loading',
warning: 'euiStepNumber--warning',
danger: 'euiStepNumber--danger',
- disabled: 'euiStepNumber--disabled',
+ complete: 'euiStepNumber--complete',
};
export const STATUS = keysOf(statusToClassNameMap);
-
-export type EuiStepStatus =
- | 'complete'
- | 'incomplete'
- | 'warning'
- | 'danger'
- | 'disabled';
+export type EuiStepStatus = typeof STATUS[number];
export interface EuiStepNumberProps
extends CommonProps,
@@ -58,7 +55,8 @@ export interface EuiStepNumberProps
status?: EuiStepStatus;
number?: number;
/**
- * Uses a border and removes the step number
+ * **DEPRECATED IN AMSTERDAM**
+ * Uses a border and removes the step number.
*/
isHollow?: boolean;
/**
@@ -81,6 +79,7 @@ export const EuiStepNumber: FunctionComponent = ({
const errorsAriaLabel = useI18nErrorsStep({ number });
const incompleteAriaLabel = useI18nIncompleteStep({ number });
const disabledAriaLabel = useI18nDisabledStep({ number });
+ const loadingAriaLabel = useI18nLoadingStep({ number });
const classes = classNames(
'euiStepNumber',
@@ -93,13 +92,16 @@ export const EuiStepNumber: FunctionComponent = ({
let screenReaderText = stepAriaLabel;
if (status === 'incomplete') screenReaderText = incompleteAriaLabel;
else if (status === 'disabled') screenReaderText = disabledAriaLabel;
+ else if (status === 'loading') screenReaderText = loadingAriaLabel;
let numberOrIcon = (
<>
{screenReaderText}
- {!isHollow && {number} }
+
+ {number}
+
>
);
@@ -130,6 +132,18 @@ export const EuiStepNumber: FunctionComponent = ({
aria-label={errorsAriaLabel}
/>
);
+ } else if (status === 'loading') {
+ numberOrIcon = (
+ <>
+
+ {screenReaderText}
+
+
+ >
+ );
}
return (
diff --git a/src/components/steps/step_strings.tsx b/src/components/steps/step_strings.tsx
index 3eff1b41581..933dd60e7db 100644
--- a/src/components/steps/step_strings.tsx
+++ b/src/components/steps/step_strings.tsx
@@ -130,3 +130,22 @@ export const useI18nDisabledStep = ({ number, title }: Props): string => {
return title ? string : simpleString;
};
+
+export const useI18nLoadingStep = ({ number, title }: Props): string => {
+ const string = useEuiI18n(
+ 'euiStepStrings.loading',
+ 'Step {number}: {title} is loading',
+ {
+ number,
+ title,
+ }
+ );
+
+ const simpleString = useEuiI18n(
+ 'euiStepStrings.simpleLoading',
+ 'Step {number} is loading',
+ { number }
+ );
+
+ return title ? string : simpleString;
+};
diff --git a/src/global_styling/mixins/_button.scss b/src/global_styling/mixins/_button.scss
index 70dd6b5c869..8937d2cf581 100644
--- a/src/global_styling/mixins/_button.scss
+++ b/src/global_styling/mixins/_button.scss
@@ -14,7 +14,7 @@
// Adds the focus (and hover) animation for translating up 1px
@mixin euiButtonFocus {
- @media screen and (prefers-reduced-motion: no-preference) {
+ @include euiCanAnimate {
transition: transform $euiAnimSpeedNormal ease-in-out, background $euiAnimSpeedNormal ease-in-out;
&:hover:not([class*='isDisabled']) {
diff --git a/src/global_styling/mixins/_helpers.scss b/src/global_styling/mixins/_helpers.scss
index 196e75a9c76..2c48f90291f 100644
--- a/src/global_styling/mixins/_helpers.scss
+++ b/src/global_styling/mixins/_helpers.scss
@@ -88,3 +88,10 @@
@content;
}
}
+
+// Doesn't have reduced motion turned on
+@mixin euiCanAnimate {
+ @media screen and (prefers-reduced-motion: no-preference) {
+ @content;
+ }
+}
diff --git a/src/themes/eui-amsterdam/global_styling/variables/_index.scss b/src/themes/eui-amsterdam/global_styling/variables/_index.scss
index 3f521b05200..b3d6b1d5f8c 100644
--- a/src/themes/eui-amsterdam/global_styling/variables/_index.scss
+++ b/src/themes/eui-amsterdam/global_styling/variables/_index.scss
@@ -8,5 +8,6 @@
@import 'form';
@import 'header';
@import 'panel';
+@import 'steps';
@import 'typography';
@import 'shadows';
diff --git a/src/themes/eui-amsterdam/global_styling/variables/_steps.scss b/src/themes/eui-amsterdam/global_styling/variables/_steps.scss
new file mode 100644
index 00000000000..c0535491a32
--- /dev/null
+++ b/src/themes/eui-amsterdam/global_styling/variables/_steps.scss
@@ -0,0 +1,8 @@
+// Modifier naming and colors for step status'
+// Disabled/Loading/Incomplete are handled manually
+$euiStepStatusColors: (
+ default: $euiColorPrimary,
+ complete: $euiColorSuccess,
+ warning: $euiColorWarning,
+ danger: $euiColorDanger,
+);
diff --git a/src/themes/eui-amsterdam/overrides/_index.scss b/src/themes/eui-amsterdam/overrides/_index.scss
index abd38972f57..e28ef41e7a8 100644
--- a/src/themes/eui-amsterdam/overrides/_index.scss
+++ b/src/themes/eui-amsterdam/overrides/_index.scss
@@ -21,6 +21,7 @@
@import 'popover';
@import 'progress';
@import 'range';
+@import 'steps';
@import 'text';
@import 'toast';
@import 'tooltip';
diff --git a/src/themes/eui-amsterdam/overrides/_steps.scss b/src/themes/eui-amsterdam/overrides/_steps.scss
new file mode 100644
index 00000000000..c74ac2fce3e
--- /dev/null
+++ b/src/themes/eui-amsterdam/overrides/_steps.scss
@@ -0,0 +1,102 @@
+// Make the disabled step title the same disabled text color
+.euiStepHorizontal-isDisabled .euiStepHorizontal__title,
+.euiStep-isDisabled .euiStep__title {
+ color: $euiColorDisabledText;
+}
+
+// STEP NUMBER CHANGES
+
+.euiStepNumber {
+ outline-color: $euiColorPrimary;
+
+ .euiStepNumber__icon {
+ position: relative;
+ top: -1px;
+ }
+
+ &--small {
+ .euiStepNumber__icon {
+ top: -1px;
+ }
+ }
+
+ &--complete,
+ &--danger {
+ // Thicken the checkmark by adding a slight stroke.
+ .euiStepNumber__icon {
+ stroke: currentColor;
+ stroke-width: .5px;
+ }
+ }
+
+ // Create modifiers based upon the map
+ @each $name, $color in $euiStepStatusColors {
+ &--#{$name} {
+ background-color: $color;
+ color: chooseLightOrDarkText($color, $euiColorGhost, $euiColorInk);
+ outline-color: chooseLightOrDarkText($color, $color, $euiColorInk) !important; // sass-lint:disable-line no-important
+ }
+ }
+
+ &.euiStepNumber--incomplete {
+ background-color: transparent;
+ color: $euiTextColor;
+ border: $euiBorderThick;
+
+ // Don't hide the step number when "hollow"
+ .euiStepNumber__number {
+ display: unset;
+ position: relative;
+ top: -2px;
+ }
+ }
+}
+
+.euiStepNumber--disabled {
+ $backgroundColorSimulated: mix($euiPageBackgroundColor, $euiButtonColorDisabled, 90%);
+ background-color: transparentize($euiButtonColorDisabled, .9);
+ color: makeDisabledContrastColor($euiButtonColorDisabled, $backgroundColorSimulated);
+}
+
+.euiStepHorizontal__title {
+ font-weight: $euiFontWeightBold;
+}
+
+.euiStepHorizontal {
+ // create the connecting lines
+ &::before,
+ &::after {
+ @include makeLineProgress;
+ background-color: $euiBorderColor;
+ }
+}
+
+// Make the line connect to the numbers
+
+.euiStep {
+ &:not(:last-of-type) {
+ background-position: left $euiSizeXL;
+ }
+
+ &--small {
+ &:not(:last-of-type) {
+ background-position: -#{$euiSizeXS} $euiSizeL;
+ }
+ }
+}
+
+.euiStep__content {
+ padding-bottom: ($euiSizeXL + $euiSizeS);
+ margin-bottom: 0;
+}
+
+// Remove forced background from horizontal steps
+.euiStepsHorizontal {
+ background: none;
+}
+
+// Fix outline in Chrome for horizontal steps
+.euiStepHorizontal:focus:not(.euiStepHorizontal-isDisabled) .euiStepHorizontal__number:not(:focus-visible) {
+ outline: $euiFocusRingSize solid $euiColorPrimary;
+}
+