Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EuiSteps] Add support for unordered steps #7813

Merged
merged 36 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
c3f5b96
feat(EuiSteps): enable support for xxs size
mgadewoll Jun 5, 2024
59e1c4b
feat(EuiStepsHorizontal): enable support for xxs size
mgadewoll Jun 5, 2024
2086b2a
docs(storybook): add unordered steps stories
mgadewoll Jun 5, 2024
ebbbc9f
test(VRT): add reference images for added stories
mgadewoll Jun 5, 2024
114537a
test: add unit test for EuiStepNumber xxs size
mgadewoll Jun 5, 2024
0535cd7
chore: cleanup leftover changes
mgadewoll Jun 5, 2024
2c87175
docs: update EUI docs
mgadewoll Jun 5, 2024
b93594c
chore: add changelog
mgadewoll Jun 5, 2024
2bac60c
refactor: rename xxs size to xs size for EuiStepsHorizontal
mgadewoll Jun 6, 2024
612cbfb
docs(storybook): update xxs size to xs
mgadewoll Jun 6, 2024
55f9cb8
remove manual top offset in favor of align-items
mgadewoll Jun 6, 2024
4fb886e
test(VRT): update reference images
mgadewoll Jun 6, 2024
df4bf4f
test: update snapshots
mgadewoll Jun 6, 2024
1fe3b73
chore: update changelog copy
mgadewoll Jun 6, 2024
6b1fc44
refactor: update unnumbered variant fontSize
mgadewoll Jun 6, 2024
ac2fc1c
test(VRT): update reference images
mgadewoll Jun 6, 2024
1225414
docs(storybook): make steps xxs size stories VRT only
mgadewoll Jun 7, 2024
712476c
refactor: rename titleSize xxs to none
mgadewoll Jun 7, 2024
0de2968
refactor: move map to global scope
mgadewoll Jun 7, 2024
5369959
docs(storybook): add options for not resolved titleSize
mgadewoll Jun 7, 2024
ef75535
docs: enhance custom title docs and add xxs size to controls
mgadewoll Jun 7, 2024
791216e
chore: update changelog
mgadewoll Jun 7, 2024
7c212dd
refactor: apply title centering only for xxs size
mgadewoll Jun 7, 2024
50372d9
test(VRT): update reference images
mgadewoll Jun 7, 2024
5b5a82d
shore: revert steps type changes
mgadewoll Jun 10, 2024
f1886a5
refactor: revert back to manual top offset to align number and title
mgadewoll Jun 10, 2024
5f7860b
docs(storybook): add VRT only stories for multiline titles
mgadewoll Jun 10, 2024
718adb7
test(VRT): add reference iamges
mgadewoll Jun 10, 2024
6bfe5c1
test: update snapshots
mgadewoll Jun 10, 2024
26fa851
docs: update docs examples
mgadewoll Jun 10, 2024
7c18aac
chore: update changelog
mgadewoll Jun 10, 2024
24fb024
refactor: remove manual offset in favor of alignment via line-height
mgadewoll Jun 11, 2024
5afbb98
chore: update titleSize type jsdoc
mgadewoll Jun 11, 2024
cf4f312
test(VRT): update reference images
mgadewoll Jun 11, 2024
1a0e945
test: update snapshots
mgadewoll Jun 11, 2024
b55740d
refactor: use step sizes over theme sizes
mgadewoll Jun 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
mgadewoll marked this conversation as resolved.
Show resolved Hide resolved
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/eui/changelogs/upcoming/7813.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Updated `EuiSteps` to support a new `titleSize="xxs"` style, which outputs the same title font size but smaller unnumbered step indicators
- Updated `EuiStepsHorizontal` to support a new `size="xs"` style, which outputs smaller unnumbered step indicators
- Updated `EuiStepNumber` to support new `titleSize="none"` which omits rendering step numbers, and will only render icons
23 changes: 15 additions & 8 deletions packages/eui/src-docs/src/views/steps/steps_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,14 +225,21 @@ export const StepsExample = {
},
],
text: (
<p>
You can set a different title size using <EuiCode>titleSize</EuiCode>.
If <EuiCode>titleSize</EuiCode> is set in both{' '}
<strong>EuiSteps</strong> and <strong>EuiStep</strong>, the latter
value will override the former. Additionally, the title size{' '}
<EuiCode>xs</EuiCode> will automatically generate smaller steps
circles.
</p>
<>
<p>
You can set a different title size using{' '}
<EuiCode>titleSize</EuiCode>. If <EuiCode>titleSize</EuiCode> is set
in both <strong>EuiSteps</strong> and <strong>EuiStep</strong>, the
latter value will override the former. Additionally, the title size{' '}
<EuiCode>xs</EuiCode> will automatically generate smaller steps
circles.
</p>
<p>
The title size <EuiCode>xxs</EuiCode> affects only the size of the
accompanying <strong>unnumbered</strong> step indicator, but not the
title itself.
</p>
</>
),
demo: <StepsTitleSizes />,
snippet: stepsTitleSizesSnippet,
Expand Down
4 changes: 4 additions & 0 deletions packages/eui/src-docs/src/views/steps/steps_horizontal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ export default () => {
];

const sizeButtons = [
{
id: 'xs',
label: 'XSmall',
},
{
id: 's',
label: 'Small',
Expand Down
67 changes: 59 additions & 8 deletions packages/eui/src-docs/src/views/steps/steps_title_sizes.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,77 @@
import React from 'react';
import React, { useState } from 'react';

import { EuiCode, EuiSteps } from '../../../../src/components';
import {
EuiButtonGroup,
EuiCode,
EuiSpacer,
EuiSteps,
EuiTitle,
} from '../../../../src/components';
import { EuiStepInterface } from '../../../../src/components/steps/step';

const firstSetOfSteps = [
const firstSetOfSteps: EuiStepInterface[] = [
{
title: 'Step 1',
children: (
<p>
mgadewoll marked this conversation as resolved.
Show resolved Hide resolved
Steps with <EuiCode>titleSize</EuiCode> set to <EuiCode>xs</EuiCode>{' '}
like this one, get a smaller step circle
Both step title and circle indicators will adjust in size based on the{' '}
<EuiCode>titleSize</EuiCode> prop
</p>
),
},
{
title: 'Step 2',
children: (
<p>
Steps with <EuiCode>titleSize</EuiCode> set to <EuiCode>xs</EuiCode>{' '}
like this one, get a smaller step circle
Both step title and circle indicators will adjust in size based on the{' '}
<EuiCode>titleSize</EuiCode> prop
</p>
),
},
];

export default () => <EuiSteps titleSize="xs" steps={firstSetOfSteps} />;
const sizeButtons = [
{
id: 'xxs',
label: 'XXSmall',
},
{
id: 'xs',
label: 'XSmall',
},
{
id: 's',
label: 'Small',
},
{
id: 'm',
label: 'Medium',
},
];

type StepSizes = NonNullable<EuiStepInterface['titleSize']>;

export default () => {
const [titleSize, setTitleSize] = useState<StepSizes>('m');

const sizeOnChange = (optionId: StepSizes) => {
setTitleSize(optionId);
};

return (
<>
<EuiTitle size="xxs">
<h3>Step Size</h3>
</EuiTitle>
<EuiSpacer size="s" />
<EuiButtonGroup
legend="Horizontal step size toggle"
options={sizeButtons}
idSelected={titleSize}
onChange={(id) => sizeOnChange(id as StepSizes)}
/>
<EuiSpacer size="m" />
<EuiSteps titleSize={titleSize} steps={firstSetOfSteps} />
</>
);
};
22 changes: 11 additions & 11 deletions packages/eui/src/components/steps/__snapshots__/step.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ exports[`EuiStep is rendered 1`] = `
class="euiStep__titleWrapper emotion-euiStep__titleWrapper"
>
<span
class="euiStepNumber emotion-euiStepNumber-s"
class="euiStepNumber emotion-euiStepNumber-s-EuiStep"
mgadewoll marked this conversation as resolved.
Show resolved Hide resolved
>
<span
class="emotion-euiScreenReaderOnly"
Expand Down Expand Up @@ -48,7 +48,7 @@ exports[`EuiStep props headingElement 1`] = `
class="euiStep__titleWrapper emotion-euiStep__titleWrapper"
>
<span
class="euiStepNumber emotion-euiStepNumber-s"
class="euiStepNumber emotion-euiStepNumber-s-EuiStep"
>
<span
class="emotion-euiScreenReaderOnly"
Expand Down Expand Up @@ -86,7 +86,7 @@ exports[`EuiStep props status complete is rendered 1`] = `
class="euiStep__titleWrapper emotion-euiStep__titleWrapper"
>
<span
class="euiStepNumber emotion-euiStepNumber-s-complete"
class="euiStepNumber emotion-euiStepNumber-s-complete-EuiStep"
>
<span
class="euiStepNumber__icon emotion-euiStepNumber__icon-complete"
Expand Down Expand Up @@ -119,7 +119,7 @@ exports[`EuiStep props status current is rendered 1`] = `
class="euiStep__titleWrapper emotion-euiStep__titleWrapper"
>
<span
class="euiStepNumber emotion-euiStepNumber-s-current"
class="euiStepNumber emotion-euiStepNumber-s-current-EuiStep"
>
<span
class="emotion-euiScreenReaderOnly"
Expand Down Expand Up @@ -157,7 +157,7 @@ exports[`EuiStep props status danger is rendered 1`] = `
class="euiStep__titleWrapper emotion-euiStep__titleWrapper"
>
<span
class="euiStepNumber emotion-euiStepNumber-s-danger"
class="euiStepNumber emotion-euiStepNumber-s-danger-EuiStep"
>
<span
class="euiStepNumber__icon emotion-euiStepNumber__icon-danger"
Expand Down Expand Up @@ -190,7 +190,7 @@ exports[`EuiStep props status disabled is rendered 1`] = `
class="euiStep__titleWrapper emotion-euiStep__titleWrapper"
>
<span
class="euiStepNumber emotion-euiStepNumber-s-disabled"
class="euiStepNumber emotion-euiStepNumber-s-disabled-EuiStep"
>
<span
class="emotion-euiScreenReaderOnly"
Expand Down Expand Up @@ -228,7 +228,7 @@ exports[`EuiStep props status incomplete is rendered 1`] = `
class="euiStep__titleWrapper emotion-euiStep__titleWrapper"
>
<span
class="euiStepNumber emotion-euiStepNumber-s-incomplete"
class="euiStepNumber emotion-euiStepNumber-s-incomplete-EuiStep"
>
<span
class="emotion-euiScreenReaderOnly"
Expand Down Expand Up @@ -266,7 +266,7 @@ exports[`EuiStep props status loading is rendered 1`] = `
class="euiStep__titleWrapper emotion-euiStep__titleWrapper"
>
<span
class="euiStepNumber emotion-euiStepNumber-s-loading"
class="euiStepNumber emotion-euiStepNumber-s-loading-EuiStep"
>
<span
class="emotion-euiScreenReaderOnly"
Expand Down Expand Up @@ -303,7 +303,7 @@ exports[`EuiStep props status warning is rendered 1`] = `
class="euiStep__titleWrapper emotion-euiStep__titleWrapper"
>
<span
class="euiStepNumber emotion-euiStepNumber-s-warning"
class="euiStepNumber emotion-euiStepNumber-s-warning-EuiStep"
>
<span
class="euiStepNumber__icon emotion-euiStepNumber__icon-warning"
Expand Down Expand Up @@ -336,7 +336,7 @@ exports[`EuiStep props step 1`] = `
class="euiStep__titleWrapper emotion-euiStep__titleWrapper"
>
<span
class="euiStepNumber emotion-euiStepNumber-s"
class="euiStepNumber emotion-euiStepNumber-s-EuiStep"
>
<span
class="emotion-euiScreenReaderOnly"
Expand Down Expand Up @@ -374,7 +374,7 @@ exports[`EuiStep props titleSize 1`] = `
class="euiStep__titleWrapper emotion-euiStep__titleWrapper"
>
<span
class="euiStepNumber emotion-euiStepNumber-xs"
class="euiStepNumber emotion-euiStepNumber-xs-EuiStep"
>
<span
class="emotion-euiScreenReaderOnly"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,27 @@ exports[`EuiStepHorizontal props size s is rendered 1`] = `
</button>
`;

exports[`EuiStepHorizontal props size xs is rendered 1`] = `
<button
class="euiStepHorizontal emotion-euiStepHorizontal-enabled"
data-step-status="incomplete"
title="Step 1 is incomplete"
>
<span
class="euiStepNumber euiStepHorizontal__number emotion-euiStepNumber-none-incomplete-euiStepHorizontal__number"
>
<span
class="emotion-euiScreenReaderOnly"
>
Step 1 is incomplete
</span>
</span>
<span
class="euiStepHorizontal__title emotion-euiStepHorizontal__title"
/>
</button>
`;

exports[`EuiStepHorizontal props status complete is rendered 1`] = `
<button
class="euiStepHorizontal emotion-euiStepHorizontal-enabled"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,6 @@ exports[`EuiStepNumber is rendered 1`] = `
</span>
`;

exports[`EuiStepNumber props has titleSize is rendered 1`] = `
<span
class="euiStepNumber emotion-euiStepNumber-xs"
>
<span
class="emotion-euiScreenReaderOnly"
>
Step 1
</span>
<span
aria-hidden="true"
class="euiStepNumber__number emotion-euiStepNumber__number"
>
1
</span>
</span>
`;

exports[`EuiStepNumber props status complete is rendered 1`] = `
<span
class="euiStepNumber emotion-euiStepNumber-s-complete"
Expand Down Expand Up @@ -145,3 +127,21 @@ exports[`EuiStepNumber props status warning is rendered 1`] = `
</span>
</span>
`;

exports[`EuiStepNumber props titleSize is rendered 1`] = `
<span
class="euiStepNumber emotion-euiStepNumber-xs"
>
<span
class="emotion-euiScreenReaderOnly"
>
Step 1
</span>
<span
aria-hidden="true"
class="euiStepNumber__number emotion-euiStepNumber__number"
>
1
</span>
</span>
`;
Loading
Loading