Skip to content

Commit 43c60a8

Browse files
authored
refactor: Support semantic structure (#371)
* chore: bump react * chore: init * chore: classNames * chore: item semantic part * chore: render icon * chore: next status * chore: line shify * chore: style ellipsis * chore: bump version * chore: fix click logic * chore: bump version to 0.0.0-alpha.1 * chore: more layout * chore: bump version to 0.0.0-alpha.2 * chore: add itemWrapperRender * chore: bump version to 0.0.0-alpha.3 * chore: update render logic * chore: bump version to 0.0.0-alpha.4 * chore: link with semantic content * chore: bump version to 0.0.0-alpha.5 * test: add test case * test: add test case * chore: fix def
1 parent 01834d6 commit 43c60a8

16 files changed

+1093
-1785
lines changed

assets/index.less

Lines changed: 103 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -17,46 +17,34 @@
1717
display: inline-block;
1818
vertical-align: top;
1919
flex: 1;
20-
overflow: hidden;
21-
22-
&-container[role='button'] {
23-
cursor: pointer;
24-
transition: opacity .3s;
25-
26-
&:hover {
27-
opacity: 0.7;
28-
}
29-
}
20+
// overflow: hidden;
3021

3122
&:last-child {
3223
flex: none;
3324
}
3425

35-
&:last-child &-tail,
3626
&:last-child &-title:after {
3727
display: none;
3828
}
3929

40-
&-container {
41-
display: inline-block;
42-
}
43-
4430
&-icon,
45-
&-content {
31+
&-section {
4632
display: inline-block;
4733
vertical-align: top;
4834
}
4935

5036
&-icon {
37+
flex: none;
5138
border: 1px solid @wait-icon-color;
5239
width: 26px;
5340
height: 26px;
5441
line-height: 26px;
5542
text-align: center;
5643
border-radius: 26px;
5744
font-size: 14px;
58-
margin-right: 8px;
59-
transition: background-color .3s, border-color .3s;
45+
transition:
46+
background-color 0.3s,
47+
border-color 0.3s;
6048

6149
> .@{stepsPrefixClass}-icon {
6250
line-height: 1;
@@ -72,49 +60,20 @@
7260
}
7361
}
7462

75-
&-tail {
76-
position: absolute;
77-
left: 0;
78-
width: 100%;
79-
top: 12px;
80-
padding: 0 10px;
81-
&:after {
82-
content: '';
83-
display: inline-block;
84-
background: @wait-tail-color;
85-
height: 1px;
86-
border-radius: 1px;
87-
width: 100%;
88-
transition: background .3s;
89-
}
90-
}
91-
&-content {
63+
&-section {
9264
margin-top: 3px;
9365
}
9466
&-title {
9567
font-size: 14px;
96-
margin-bottom: 4px;
9768
color: #666;
9869
font-weight: bold;
9970
display: inline-block;
100-
padding-right: 10px;
10171
position: relative;
102-
&:after {
103-
content: '';
104-
height: 1px;
105-
width: 1000px;
106-
background: @wait-tail-color;
107-
display: block;
108-
position: absolute;
109-
top: 0.55em;
110-
left: 100%;
111-
}
11272
}
11373
&-subtitle {
11474
font-size: 12px;
11575
display: inline-block;
11676
color: #999;
117-
margin-left: 8px;
11877
}
11978
&-description {
12079
font-size: 12px;
@@ -138,24 +97,17 @@
13897

13998
.@{stepsPrefixClass}-horizontal:not(.@{stepsPrefixClass}-label-vertical) {
14099
.@{stepsPrefixClass}-item {
141-
margin-right: 10px;
142-
&:last-child {
143-
margin-right: 0;
144-
}
145-
&-tail {
146-
display: none;
147-
}
148100
&-description {
149101
max-width: @stepDescriptionMaxWidth;
150102
}
151103
}
152104
}
153105

154106
.step-item-status(@status) {
155-
@icon-color: "@{status}-icon-color";
156-
@title-color: "@{status}-title-color";
157-
@description-color: "@{status}-description-color";
158-
@tail-color: "@{status}-tail-color";
107+
@icon-color: '@{status}-icon-color';
108+
@title-color: '@{status}-title-color';
109+
@description-color: '@{status}-description-color';
110+
@tail-color: '@{status}-tail-color';
159111
&-@{status} &-icon {
160112
border-color: @@icon-color;
161113
background-color: #fff;
@@ -168,22 +120,102 @@
168120
}
169121
&-@{status} &-title {
170122
color: @@title-color;
171-
&:after {
172-
background-color: @@tail-color;
173-
}
174123
}
175124
&-@{status} &-description {
176125
color: @@description-color;
177126
}
178-
&-@{status} &-tail:after {
179-
background-color: @@tail-color;
127+
}
128+
129+
// @import 'custom-icon';
130+
// @import 'small';
131+
// @import 'vertical';
132+
// @import 'label-placement';
133+
// @import 'progress-dot';
134+
// @import 'nav';
135+
// @import 'inline';
136+
137+
// ======================= Horizontal =======================
138+
.verticalFlex() {
139+
display: flex;
140+
flex-direction: column;
141+
align-items: center;
142+
}
143+
144+
.@{stepsPrefixClass} {
145+
.@{stepsPrefixClass}-item {
146+
&-section {
147+
min-width: 0;
148+
}
149+
150+
&-header {
151+
display: flex;
152+
gap: 8px;
153+
align-items: center;
154+
}
155+
156+
// Ellipsis
157+
&-title,
158+
&-subtitle,
159+
&-description {
160+
overflow: hidden;
161+
text-overflow: ellipsis;
162+
white-space: nowrap;
163+
}
180164
}
181165
}
182166

183-
@import 'custom-icon';
184-
@import 'small';
185-
@import 'vertical';
186-
@import 'label-placement';
187-
@import 'progress-dot';
188-
@import 'nav';
189-
@import 'inline';
167+
.@{stepsPrefixClass}-horizontal {
168+
.@{stepsPrefixClass}-item {
169+
flex: 1;
170+
position: relative;
171+
min-width: 0;
172+
173+
&-rail {
174+
height: 1px;
175+
background: @process-tail-color;
176+
}
177+
}
178+
179+
// Label Vertical
180+
&.@{stepsPrefixClass}-label-vertical {
181+
.@{stepsPrefixClass}-item {
182+
.verticalFlex();
183+
padding-inline: 8px;
184+
185+
&-section {
186+
.verticalFlex();
187+
}
188+
189+
&-rail {
190+
position: absolute;
191+
top: 13px;
192+
left: calc(50% + 13px);
193+
width: 100%;
194+
}
195+
}
196+
}
197+
198+
// Label Horizontal
199+
&.@{stepsPrefixClass}-label-horizontal {
200+
.@{stepsPrefixClass}-item {
201+
display: flex;
202+
203+
&:last-child {
204+
flex: none;
205+
}
206+
207+
&-section {
208+
flex: 1;
209+
}
210+
211+
&-rail {
212+
flex: 1;
213+
min-width: 0;
214+
}
215+
}
216+
}
217+
}
218+
219+
// ======================== Vertical ========================
220+
.@{stepsPrefixClass}-vertical {
221+
}

assets/inline.less

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,6 @@
77
.@{stepsPrefixClass}-item {
88
flex: none;
99

10-
&-container {
11-
padding: 9px 4px 0;
12-
margin: 0 2px;
13-
border-radius: 4px;
14-
cursor: pointer;
15-
&:hover {
16-
background: rgba(0, 0, 0, 0.04);
17-
}
18-
&[role='button']:hover {
19-
opacity: 1;
20-
}
21-
}
2210

2311
&-icon {
2412
width: 6px;
@@ -32,7 +20,7 @@
3220
}
3321
}
3422

35-
&-content {
23+
&-section {
3624
width: auto;
3725
margin-top: 7px;
3826
}
@@ -47,26 +35,7 @@
4735
display: none;
4836
}
4937

50-
&-tail {
51-
margin-left: 0;
52-
top: 11px;
53-
&:after {
54-
height: 1px;
55-
}
56-
}
57-
&:first-child .@{stepsPrefixClass}-item-tail{
58-
width: 50%;
59-
margin-left: 50%;
60-
}
61-
&:last-child .@{stepsPrefixClass}-item-tail{
62-
display: block;
63-
width: 50%;
64-
}
65-
6638
&-finish {
67-
.@{stepsPrefixClass}-item-tail:after {
68-
background-color: @process-tail-color;
69-
}
7039
.@{stepsPrefixClass}-item-icon .@{stepsPrefixClass}-icon .@{stepsPrefixClass}-icon-dot {
7140
background-color: @process-tail-color;
7241
}

assets/label-placement.less

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33
.@{stepsPrefixClass}-label-vertical {
44
.@{stepsPrefixClass}-item {
55
overflow: visible;
6-
&-tail {
7-
padding: 0px 24px;
8-
margin-left: 48px;
9-
}
10-
&-content {
6+
&-section {
117
display: block;
128
text-align: center;
139
margin-top: 8px;

assets/nav.less

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@
1313
text-align: center;
1414
overflow: visible;
1515

16-
&-container {
17-
text-align: left;
18-
padding-bottom: 8px;
19-
outline: none;
20-
}
2116

2217
&-title {
2318
max-width: @stepNavContentMaxWidth;
@@ -53,11 +48,5 @@
5348
margin-left: -8px;
5449
}
5550

56-
&-active {
57-
.@{stepsPrefixClass}-item-container {
58-
padding-bottom: 5px;
59-
border-bottom: 3px solid @primary-color;
60-
}
61-
}
6251
}
6352
}

assets/progress-dot.less

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,6 @@
22

33
.@{stepsPrefixClass}-dot {
44
.@{stepsPrefixClass}-item {
5-
&-tail {
6-
width: 100%;
7-
top: 1px;
8-
margin: 0 0 0 @stepDescriptionMaxWidth / 2;
9-
padding: 0;
10-
11-
&:after {
12-
height: 3px;
13-
}
14-
}
155
&-icon {
166
padding-right: 0;
177
width: 5px;

assets/small.less

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
top: -1px;
1717
}
1818
}
19-
.@{stepsPrefixClass}-item-content {
19+
.@{stepsPrefixClass}-item-section {
2020
margin-top: 0;
2121
}
2222
.@{stepsPrefixClass}-item-title {
@@ -29,15 +29,6 @@
2929
font-size: 12px;
3030
color: #999;
3131
}
32-
.@{stepsPrefixClass}-item-tail {
33-
top: 8px;
34-
padding: 0 8px;
35-
&:after {
36-
height: 1px;
37-
border-radius: 1px;
38-
width: 100%;
39-
}
40-
}
4132

4233
.@{stepsPrefixClass}-item-custom .@{stepsPrefixClass}-item-icon {
4334
width: inherit;

0 commit comments

Comments
 (0)