Skip to content

Commit 118b520

Browse files
authored
feat(progress-indicator): add new vertical variant with new class for green success (#3068)
* feat(progress-indicator): add new class annotations for slds-progress__marker_icon-success
1 parent 3b6f741 commit 118b520

21 files changed

+786
-17
lines changed

shared/styles/doc.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
.docs-codeblock-example {
1515
overflow: auto;
16+
transform: translate3d(0, 0, 0);
1617
}
1718

1819
.docs-codeblock-source {

ui/components/_index.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@
173173
// Progress Indicator
174174
'progress-bar/base/index',
175175
'progress-indicator/base/index',
176+
'progress-indicator/vertical/index',
176177
'progress-ring/base/index',
177178

178179
// Rich Text Editor

ui/components/progress-bar/base/_index.scss

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,31 @@
109109
.slds-progress-bar__value_success {
110110
background: $progress-bar-color-background-fill-success;
111111
}
112+
113+
/**
114+
* @summary Create a vertical progress bar
115+
*
116+
* @selector .slds-progress-bar_vertical
117+
* @restrict .slds-progress-bar
118+
* @modifier
119+
*/
120+
.slds-progress-bar_vertical {
121+
height: 100%;
122+
width: ($progress-bar-height * 4);
123+
124+
&.slds-progress-bar_x-small {
125+
width: $progress-bar-height;
126+
}
127+
128+
&.slds-progress-bar_small {
129+
width: ($progress-bar-height * 2);
130+
}
131+
132+
&.slds-progress-bar_medium {
133+
width: ($progress-bar-height * 4);
134+
}
135+
136+
&.slds-progress-bar_large {
137+
width: ($progress-bar-height * 6);
138+
}
139+
}

ui/components/progress-bar/base/example.jsx

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,31 @@ import _ from '../../../shared/helpers';
99
// Partial(s)
1010
/// ///////////////////////////////////////////
1111

12-
export const ProgressBar = props => (
13-
<div
14-
className={classNames('slds-progress-bar', props.className)}
15-
aria-valuemin="0"
16-
aria-valuemax="100"
17-
aria-valuenow={props.value}
18-
aria-labelledby={props['aria-labelledby']}
19-
role="progressbar"
20-
>
21-
<span
22-
className="slds-progress-bar__value"
23-
style={{ width: `${props.value}%` }}
12+
export const ProgressBar = props => {
13+
let progressBarStyle = props.isVertical
14+
? { height: `${props.value}%` }
15+
: { width: `${props.value}%` };
16+
return (
17+
<div
18+
className={classNames(
19+
'slds-progress-bar',
20+
{ 'slds-progress-bar_vertical': props.isVertical },
21+
props.className
22+
)}
23+
aria-valuemin="0"
24+
aria-valuemax="100"
25+
aria-valuenow={props.value}
26+
aria-labelledby={props['aria-labelledby']}
27+
role="progressbar"
2428
>
25-
<span className="slds-assistive-text">Progress: {`${props.value}%`}</span>
26-
</span>
27-
</div>
28-
);
29+
<span className="slds-progress-bar__value" style={progressBarStyle}>
30+
<span className="slds-assistive-text">
31+
Progress: {`${props.value}%`}
32+
</span>
33+
</span>
34+
</div>
35+
);
36+
};
2937

3038
export const ProgressBarDescriptive = props => {
3139
const labelUniqueId = _.uniqueId('progress-bar-label-id-');

ui/components/progress-indicator/__tests__/__snapshots__/Base_Progress_Indicator_renders_a_base_progress_indicator.json

Lines changed: 18 additions & 0 deletions
Large diffs are not rendered by default.

ui/components/progress-indicator/__tests__/__snapshots__/Base_Progress_Indicator_renders_a_base_step.json

Lines changed: 10 additions & 0 deletions
Large diffs are not rendered by default.

ui/components/progress-indicator/__tests__/__snapshots__/Base_Progress_Indicator_renders_a_done_base_step.json

Lines changed: 12 additions & 0 deletions
Large diffs are not rendered by default.

ui/components/progress-indicator/__tests__/__snapshots__/Base_Progress_Indicator_renders_an_active_base_step.json

Lines changed: 10 additions & 0 deletions
Large diffs are not rendered by default.

ui/components/progress-indicator/__tests__/__snapshots__/Base_Progress_Indicator_renders_an_active_base_step_with_aria_describedby.json

Lines changed: 10 additions & 0 deletions
Large diffs are not rendered by default.

ui/components/progress-indicator/__tests__/__snapshots__/Base_Progress_Indicator_renders_an_error_base_step.json

Lines changed: 12 additions & 0 deletions
Large diffs are not rendered by default.

ui/components/progress-indicator/__tests__/__snapshots__/Vertical_Progress_Indicator_renders_a_done_vertical_step.json

Lines changed: 13 additions & 0 deletions
Large diffs are not rendered by default.

ui/components/progress-indicator/__tests__/__snapshots__/Vertical_Progress_Indicator_renders_a_vertical_progress_indicator.json

Lines changed: 21 additions & 0 deletions
Large diffs are not rendered by default.

ui/components/progress-indicator/__tests__/__snapshots__/Vertical_Progress_Indicator_renders_a_vertical_step.json

Lines changed: 11 additions & 0 deletions
Large diffs are not rendered by default.

ui/components/progress-indicator/__tests__/__snapshots__/Vertical_Progress_Indicator_renders_a_vertical_step_with_green_success_check.json

Lines changed: 13 additions & 0 deletions
Large diffs are not rendered by default.

ui/components/progress-indicator/__tests__/__snapshots__/Vertical_Progress_Indicator_renders_an_active_vertical_step.json

Lines changed: 11 additions & 0 deletions
Large diffs are not rendered by default.

ui/components/progress-indicator/__tests__/__snapshots__/Vertical_Progress_Indicator_renders_an_error_vertical_step.json

Lines changed: 13 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
// Copyright (c) 2015-present, salesforce.com, inc. All rights reserved
2+
// Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license
3+
/* eslint-env jest */
4+
5+
import React from 'react';
6+
import createHelpers from '../../../../jest.setup';
7+
import { Progress as BaseProgress, Step as BaseStep } from '../base/example';
8+
import {
9+
Progress as VerticalProgress,
10+
Step as VerticalStep
11+
} from '../vertical/example';
12+
13+
const { matchesMarkupAndStyle } = createHelpers(__dirname);
14+
15+
describe('Base Progress Indicator', () => {
16+
it('renders a base step', () =>
17+
matchesMarkupAndStyle(<BaseStep>Step 1</BaseStep>));
18+
19+
it('renders an active base step', () =>
20+
matchesMarkupAndStyle(<BaseStep active>Step 1</BaseStep>));
21+
22+
it('renders a done base step', () =>
23+
matchesMarkupAndStyle(<BaseStep done>Step 1</BaseStep>));
24+
25+
it('renders an error base step', () =>
26+
matchesMarkupAndStyle(<BaseStep error>Step 1</BaseStep>));
27+
28+
it('renders an active base step with aria-describedby', () =>
29+
matchesMarkupAndStyle(
30+
<BaseStep active aria-describedby="step-1-tooltip">
31+
Step 1
32+
</BaseStep>
33+
));
34+
35+
it('renders a base progress indicator', () =>
36+
matchesMarkupAndStyle(
37+
<BaseProgress>
38+
<BaseStep active>Step 1</BaseStep>
39+
<BaseStep>Step 2</BaseStep>
40+
</BaseProgress>
41+
));
42+
});
43+
44+
describe('Vertical Progress Indicator', () => {
45+
it('renders a vertical step', () =>
46+
matchesMarkupAndStyle(<VerticalStep>Step 1</VerticalStep>));
47+
48+
it('renders an active vertical step', () =>
49+
matchesMarkupAndStyle(<VerticalStep active>Step 1</VerticalStep>));
50+
51+
it('renders a done vertical step', () =>
52+
matchesMarkupAndStyle(<VerticalStep done>Step 1</VerticalStep>));
53+
54+
it('renders an error vertical step', () =>
55+
matchesMarkupAndStyle(<VerticalStep error>Step 1</VerticalStep>));
56+
57+
it('renders a vertical progress indicator', () =>
58+
matchesMarkupAndStyle(
59+
<VerticalProgress>
60+
<VerticalStep active>Step 1</VerticalStep>
61+
<VerticalStep>Step 2</VerticalStep>
62+
</VerticalProgress>
63+
));
64+
65+
it('renders a vertical step with green success check', () =>
66+
matchesMarkupAndStyle(
67+
<VerticalStep done is Success>
68+
Step 1
69+
</VerticalStep>
70+
));
71+
});

ui/components/progress-indicator/base/_index.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@
167167
* Dot indicator for each step
168168
*
169169
* @selector .slds-progress__marker
170-
* @restrict .slds-progress ol li button
170+
* @restrict .slds-progress ol li button, .slds-progress ol li div, .slds-progress ol li span
171171
* @required
172172
*/
173173
.slds-progress__marker {

0 commit comments

Comments
 (0)