|
6 | 6 | @use '../internal/styles/tokens' as awsui; |
7 | 7 | @use '../internal/styles' as styles; |
8 | 8 | @use '../internal/generated/custom-css-properties/index.scss' as custom-props; |
| 9 | +@use '../internal/styles/style-api' as style-api; |
9 | 10 | @use './motion'; |
10 | 11 |
|
11 | | -$progress-height: var(#{custom-props.$progressBarHeight}, 0.4 * styles.$base-size); |
12 | | -$progress-border-radius: var(#{custom-props.$progressBarBorderRadius}, 10px); |
13 | | -$progress-background-color: var( |
14 | | - #{custom-props.$progressBarBackgroundColor}, |
15 | | - awsui.$color-background-progress-bar-default |
| 12 | +$progress-bar-tokens: style-api.resolve((track-color, value-color, bar-block-size, bar-border-radius), carrier); |
| 13 | +@include style-api.register($progress-bar-tokens); |
| 14 | +@include style-api.docs('root', $progress-bar-tokens); |
| 15 | +@include style-api.docs('percentage', $properties: (color, font-family, font-size, font-weight)); |
| 16 | + |
| 17 | +$progress-height: style-api.value( |
| 18 | + $progress-bar-tokens, |
| 19 | + bar-block-size, |
| 20 | + var(#{custom-props.$progressBarHeight}, 0.4 * styles.$base-size) |
| 21 | +); |
| 22 | +$progress-border-radius: style-api.value( |
| 23 | + $progress-bar-tokens, |
| 24 | + bar-border-radius, |
| 25 | + var(#{custom-props.$progressBarBorderRadius}, 10px) |
| 26 | +); |
| 27 | +$progress-background-color: style-api.value( |
| 28 | + $progress-bar-tokens, |
| 29 | + track-color, |
| 30 | + var(#{custom-props.$progressBarBackgroundColor}, awsui.$color-background-progress-bar-default) |
| 31 | +); |
| 32 | +$progress-value-background-color: style-api.value( |
| 33 | + $progress-bar-tokens, |
| 34 | + value-color, |
| 35 | + var(#{custom-props.$progressValueBackgroundColor}, awsui.$color-background-progress-bar-value-default) |
16 | 36 | ); |
17 | | -$progress-value-background-color: var( |
18 | | - #{custom-props.$progressValueBackgroundColor}, |
19 | | - awsui.$color-background-progress-bar-value-default |
| 37 | +$progress-flash-background-color: style-api.value( |
| 38 | + $progress-bar-tokens, |
| 39 | + track-color, |
| 40 | + var(#{custom-props.$progressBarBackgroundColor}, awsui.$color-background-progress-bar-flash) |
| 41 | +); |
| 42 | +$progress-flash-value-background-color: style-api.value( |
| 43 | + $progress-bar-tokens, |
| 44 | + value-color, |
| 45 | + var(#{custom-props.$progressValueBackgroundColor}, awsui.$color-background-progress-bar-value-flash) |
20 | 46 | ); |
21 | 47 |
|
22 | 48 | .root { |
| 49 | + @include style-api.carriers($progress-bar-tokens); |
23 | 50 | @include styles.styles-reset; |
24 | 51 | } |
25 | 52 |
|
@@ -79,7 +106,19 @@ $progress-value-background-color: var( |
79 | 106 | } |
80 | 107 |
|
81 | 108 | .percentage { |
82 | | - /* used in test-utils */ |
| 109 | + display: inline-block; |
| 110 | + font-family: awsui.$font-family-base; |
| 111 | + -webkit-font-smoothing: auto; |
| 112 | + -moz-osx-font-smoothing: auto; |
| 113 | + line-height: awsui.$line-height-body-s; |
| 114 | + letter-spacing: awsui.$letter-spacing-body-s; |
| 115 | + color: awsui.$color-text-small; |
| 116 | + font-size: awsui.$font-size-body-s; |
| 117 | + font-weight: styles.$font-weight-normal; |
| 118 | + |
| 119 | + &.percentage-flash { |
| 120 | + color: currentColor; |
| 121 | + } |
83 | 122 | } |
84 | 123 |
|
85 | 124 | @mixin general-progress-background-style { |
@@ -131,22 +170,16 @@ $progress-value-background-color: var( |
131 | 170 | } |
132 | 171 |
|
133 | 172 | &.progress-flash { |
134 | | - background-color: var(#{custom-props.$progressBarBackgroundColor}, awsui.$color-background-progress-bar-flash); |
| 173 | + background-color: $progress-flash-background-color; |
135 | 174 |
|
136 | 175 | &::-webkit-progress-bar { |
137 | | - background-color: var(#{custom-props.$progressBarBackgroundColor}, awsui.$color-background-progress-bar-flash); |
| 176 | + background-color: $progress-flash-background-color; |
138 | 177 | } |
139 | 178 | &::-webkit-progress-value { |
140 | | - background-color: var( |
141 | | - #{custom-props.$progressValueBackgroundColor}, |
142 | | - awsui.$color-background-progress-bar-value-flash |
143 | | - ); |
| 179 | + background-color: $progress-flash-value-background-color; |
144 | 180 | } |
145 | 181 | &::-moz-progress-bar { |
146 | | - background-color: var( |
147 | | - #{custom-props.$progressValueBackgroundColor}, |
148 | | - awsui.$color-background-progress-bar-value-flash |
149 | | - ); |
| 182 | + background-color: $progress-flash-value-background-color; |
150 | 183 | } |
151 | 184 | } |
152 | 185 | } |
|
0 commit comments