forked from aramvisser/bulma-steps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bulma-steps.sass
371 lines (305 loc) · 11.3 KB
/
bulma-steps.sass
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
@use "sass:math"
$steps-default-color: $grey-lighter !default
$steps-completed-color: $primary !default
$steps-active-color: $primary !default
$steps-horizontal-min-width: 10em !default
$steps-vertical-min-height: 4em !default
$steps-marker-size: 2 !default
$steps-divider-size: .4em !default
$steps-gap-size: .3rem !default
$steps-hollow-border-size: .3em !default
$steps-thin-divider-size: 1px !default
$steps-thin-marker-size: .8em !default
=steps-horizontal
+tablet
&:not(.is-vertical)
@content
&.is-horizontal
@content
=steps-vertical
+mobile
&:not(.is-horizontal)
@content
&.is-vertical
@content
=steps-all-segments
&.steps .steps-segment
@content
=steps-active-segment
&.steps .steps-segment.is-active
@content
=steps-inactive-segments
&.steps .steps-segment.is-active ~ .steps-segment
@content
.steps
+block
.steps-segment
position: relative
&:not(:last-child):after
// This will contain the horizontal or vertical divider
content: " "
display: block
position: absolute
+steps-vertical
.steps-segment
display: block
&:not(:last-child)
min-height: $steps-vertical-min-height
+steps-horizontal
display: flex
.steps-segment:not(:last-child)
flex-basis: 1rem
flex-grow: 1
flex-shrink: 1
&.is-narrow
.steps-segment
flex-grow: 0
&:not(:last-child)
min-width: $steps-horizontal-min-width
&.is-narrow.is-centered
justify-content: center
&.is-narrow.is-right
justify-content: flex-end
&.has-content-centered
text-align: center
&.is-balanced, &.has-content-centered
.steps-segment:last-child
flex-basis: 1rem
flex-grow: 1
flex-shrink: 1
&.is-narrow.has-content-centered
.steps-segment:last-child
flex-grow: 0
min-width: $steps-horizontal-min-width
.steps-content.is-divider-content
text-align: center
// Marker style
.steps-marker
align-items: center
display: flex
border-radius: 50%
font-weight: $weight-bold
justify-content: center
// Position & z-index are needed to put it above the divider
position: relative
z-index: 10
// Use a mixin to define all ratios in the same spot
=steps-size($size)
font-size: $size
.steps-marker
height: $size * $steps-marker-size
width: $size * $steps-marker-size
+steps-vertical
// Draw a vertical divider
.steps-segment:not(:last-child):after
// top and bottom position is almost touching the inner side of a hollow border marker
bottom: -$steps-gap-size * 0.8
// left: calc(#{$size * ($steps-marker-size / 2)} - (#{$steps-divider-size / 2}))
left: calc(#{$size * math.div($steps-marker-size,2)} - (#{math.div($steps-marker-size,2)}))
top: ($size * $steps-marker-size) - ($steps-gap-size * 0.8)
width: $steps-divider-size
// Align the content with the marker
.steps-content
// margin-left: calc(#{$size * $steps-marker-size / 2} + .5em)
margin-left: calc(#{$size * math.div($steps-marker-size,2)} + .5em)
margin-top: -$size * $steps-marker-size
padding-left: 1em
padding-bottom: 1em
.steps-content.is-divider-content
margin-top: 0
padding-bottom: 0
&.has-content-centered
.steps-content
//padding-top: calc(#{$size * $steps-marker-size / 2} - .5em)
padding-top: calc(#{$size * math.div($steps-marker-size,2)} - .5em)
&:not(.is-thin)
&.has-gaps .steps-segment, .steps-segment.has-gaps
&:not(:last-child):after
top: ($size * $steps-marker-size) + $steps-gap-size
bottom: $steps-gap-size
+steps-horizontal
// Draw a horizontal divider
.steps-segment:not(:last-child):after
height: $steps-divider-size
// top and bottom position is almost touching the inner side of a hollow border marker
left: ($size * $steps-marker-size) - ($steps-gap-size * 0.8)
right: -$steps-gap-size * 0.8
//top: calc(#{$size * ($steps-marker-size / 2)} - (#{$steps-divider-size / 2}))
top: calc(#{$size * (math.div($steps-marker-size,2))} - (#{ math.div($steps-divider-size,2)}))
// Align the content with the marker
.steps-content
//margin-left: $size * $steps-marker-size / 2
margin-left: $size * math.div($steps-marker-size,2)
&:not(:last-child)
//margin-right: -$size * $steps-marker-size / 2
margin-right: - math.div($steps-marker-size,2)
&.is-divider-content
// margin-right: -$size * $steps-marker-size / 2
margin-right: - math.div($steps-marker-size,2)
padding-left: 2em
padding-right: 2em
&.has-content-centered
.steps-segment:not(:last-child):after
left: 50%
right: -50%
.steps-marker
position: absolute
//left: calc(50% - #{$size * $steps-marker-size / 2})
left: calc(50% - #{$size * math.div($steps-marker-size,2)})
.steps-content
margin-top: $size * $steps-marker-size
margin-left: .5em
margin-right: .5em
padding-top: .2em
&:not(.is-thin)
&.has-gaps .steps-segment, .steps-segment.has-gaps
&:not(:last-child):after
left: ($size * $steps-marker-size) + $steps-gap-size
right: $steps-gap-size
&.has-content-centered
&.has-gaps .steps-segment, .steps-segment.has-gaps
&:not(:last-child):after
//left: calc(50% + #{($size * $steps-marker-size / 2) + $steps-gap-size})
//right: calc(-50% + #{($size * $steps-marker-size / 2) + $steps-gap-size})
left: calc(50% + #{($size * math.div($steps-marker-size,2)) + $steps-gap-size})
right: calc(-50% + #{($size * math.div($steps-marker-size,2)) + $steps-gap-size})
.steps
+steps-size($size-normal)
.steps.is-small
+steps-size($size-small)
.steps.is-medium
+steps-size($size-medium)
.steps.is-large
+steps-size($size-large)
// Divider Default Colors
.steps-segment
&:after
background-color: $steps-completed-color
&.is-active
&:after
background-color: $steps-default-color
&.is-active ~ .steps-segment
&:after
background-color: $steps-default-color
// Marker Default Colors
.steps:not(.is-hollow)
.steps-marker:not(.is-hollow)
background-color: $steps-completed-color
color: findColorInvert($steps-completed-color)
.steps-segment.is-active
.steps-marker:not(.is-hollow)
background-color: $steps-active-color
color: findColorInvert($steps-active-color)
.steps-segment.is-active
& ~ .steps-segment .steps-marker:not(.is-hollow)
background-color: $steps-default-color
color: findColorInvert($steps-default-color)
// Hollow style
.steps.is-hollow .steps-marker,
.steps-marker.is-hollow
border: $steps-hollow-border-size solid $steps-completed-color
.steps.is-hollow .is-active .steps-marker,
.steps .is-active .steps-marker.is-hollow
border-color: $steps-active-color
.steps.is-hollow .steps-segment.is-active ~ .steps-segment .steps-marker,
.steps-segment.is-active ~ .steps-segment .steps-marker.is-hollow
border-color: $steps-default-color
// Override marker color per step
@each $name, $pair in $colors
$color: nth($pair, 1)
$color-invert: nth($pair, 2)
.steps:not(.is-hollow) .steps-marker:not(.is-hollow)
&.is-#{$name}
background-color: $color !important
color: $color-invert !important
.steps.is-hollow .steps-marker,
.steps .steps-marker.is-hollow
&.is-#{$name}
border-color: $color !important
// Divider dashed style
=steps-divider-background($angle, $color, $size)
background: repeating-linear-gradient($angle, $color, $color $size, transparent $size, transparent #{$size * 2})
.steps
+steps-vertical
&.is-dashed .steps-segment, .steps-segment.is-dashed
&:after
+steps-divider-background(0deg, $steps-completed-color, 5px)
&.is-dashed .steps-segment.is-active,
&.is-dashed .steps-segment.is-active ~ .steps-segment,
.steps-segment.is-active.is-dashed,
.steps-segment.is-active ~ .steps-segment.is-dashed
&:after
+steps-divider-background(0deg, $steps-default-color, 5px)
+steps-horizontal
&.is-dashed .steps-segment,
.steps-segment.is-dashed
&:after
+steps-divider-background(90deg, $steps-completed-color, 10px)
// the active segment and any subsequent segment get the default colot
&.is-dashed .steps-segment.is-active,
&.is-dashed .steps-segment.is-active ~ .steps-segment,
.steps-segment.is-active.is-dashed,
.steps-segment.is-active ~ .steps-segment.is-dashed
&:after
+steps-divider-background(90deg, $steps-default-color, 10px)
// Thin modifier
.steps.is-thin
.steps-marker
width: $steps-thin-marker-size
height: $steps-thin-marker-size
&.is-hollow .steps-marker,
.steps-marker.is-hollow
border-width: $steps-thin-divider-size
height: calc(#{$steps-thin-marker-size} + #{$steps-thin-divider-size})
width: calc(#{$steps-thin-marker-size} + #{$steps-thin-divider-size})
+steps-vertical
.steps-segment
&:not(:last-child):after
bottom: 0
//left: calc(#{$steps-thin-marker-size / 2} - #{$steps-thin-divider-size / 2})
left: calc(#{ math.div($steps-divider-size,2)} - #{ math.div($steps-divider-size,2)})
top: $steps-thin-marker-size
width: $steps-thin-divider-size
.steps-content
margin-top: -$steps-thin-marker-size * 1.5
margin-left: $steps-thin-marker-size
&.has-gaps .steps-segment, .steps-segment.has-gaps
&:not(:last-child):after
//bottom: $steps-thin-marker-size / 2
bottom: math.div($steps-divider-size,2)
top: $steps-thin-marker-size * 1.5
&.has-content-centered
.steps-content
padding-top: $steps-thin-marker-size * 2
+steps-horizontal
.steps-segment
&:not(:last-child):after
left: $steps-thin-marker-size
right: 0
//top: calc(#{$steps-thin-marker-size / 2} - #{$steps-thin-divider-size / 2})
top: calc(#{math.div($steps-divider-size,2)} - #{math.div($steps-divider-size,2)})
height: $steps-thin-divider-size
.steps-content
margin-top: $steps-thin-marker-size
&.has-content-centered
.steps-segment
&:not(:last-child):after
//left: calc(50% + #{$steps-thin-marker-size / 2})
//right: calc(-50% + #{$steps-thin-marker-size / 2})
left: calc(50% + #{math.div($steps-divider-size,2)})
right: calc(-50% + #{math.div($steps-divider-size,2)})
.steps-marker
position: absolute
//left: calc(50% - #{$steps-thin-marker-size / 2})
left: calc(50% - #{math.div($steps-divider-size,2) })
&.has-gaps .steps-segment, .steps-segment.has-gaps
&:not(:last-child):after
left: $steps-thin-marker-size * 1.5
//right: $steps-thin-marker-size / 2
right: math.div($steps-divider-size,2)
&.has-content-centered.has-gaps .steps-segment, &.has-content-centered .steps-segment.has-gaps
&:not(:last-child):after
//left: calc(50% + #{($steps-thin-marker-size / 2) + ($steps-thin-marker-size / 2)})
//right: calc(-50% + #{($steps-thin-marker-size / 2) + ($steps-thin-marker-size / 2)})
left: calc(50% + #{(math.div($steps-divider-size,2)) + math.div($steps-divider-size,2)})
right: calc(-50% + #{(math.div($steps-divider-size,2)) + math.div($steps-divider-size,2)})