Skip to content

Commit b47220f

Browse files
iamwillpowellsnowystingerLFDanLu
authored
Static progress followup (#5125)
* Fix HCM barloader style * Fix High Contrast Mode for circle loader * Update packages/@adobe/spectrum-css-temp/components/barloader/skin.css * Fix edge case where variant is overbackground and static color is black * barloader fix and reoder circloader vars * Deprecate `variant` prop for overBackground * story tweaks * Add border color to isPending button mode for WHCM Forced Colors * Update Accessibility docs for progress * Update packages/@react-spectrum/progress/docs/ProgressBar.mdx --------- Co-authored-by: Robert Snow <rsnow@adobe.com> Co-authored-by: Daniel Lu <dl1644@gmail.com>
1 parent 04d19c9 commit b47220f

File tree

7 files changed

+43
-47
lines changed

7 files changed

+43
-47
lines changed

packages/@adobe/spectrum-css-temp/components/barloader/skin.css

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ governing permissions and limitations under the License.
1212

1313
.spectrum-BarLoader {
1414
--spectrum-barloader-large-track-fill-color: var(--spectrum-accent-color-900);
15+
--spectrum-barloader-static-black-track-color: rgba(0, 0, 0, 0.25);
16+
--spectrum-barloader-static-black-fill-color: var(--spectrum-global-color-static-black);
1517

1618
.spectrum-BarLoader-fill {
1719
background: var(--spectrum-barloader-large-track-fill-color);
@@ -39,16 +41,16 @@ governing permissions and limitations under the License.
3941
/* TODO: use semantic tokens or spectrum variables when available */
4042
&.spectrum-BarLoader--staticBlack {
4143
.spectrum-BarLoader-track {
42-
background-color: rgba(0, 0, 0, 0.25);
44+
background-color: var(--spectrum-barloader-static-black-track-color);
4345
}
4446

4547
.spectrum-BarLoader-label,
4648
.spectrum-BarLoader-percentage {
47-
color: var(--spectrum-global-color-static-black);
49+
color: var(--spectrum-barloader-static-black-fill-color);
4850
}
4951

5052
.spectrum-BarLoader-fill {
51-
background: var(--spectrum-global-color-static-black);
53+
background: var(--spectrum-barloader-static-black-fill-color);
5254
}
5355
}
5456
&.is-positive {
@@ -84,6 +86,9 @@ governing permissions and limitations under the License.
8486
forced-color-adjust: none;
8587
--spectrum-barloader-large-track-fill-color: ButtonText;
8688
--spectrum-barloader-large-over-background-track-fill-color: ButtonText;
89+
--spectrum-barloader-large-over-background-track-color: ButtonFace;
90+
--spectrum-barloader-static-black-track-color: ButtonFace;
91+
--spectrum-barloader-static-black-fill-color: ButtonText;
8792
--spectrum-meter-large-track-color-positive: ButtonText;
8893
--spectrum-meter-large-track-color-warning: ButtonText;
8994
--spectrum-meter-large-track-color-critical: ButtonText;

packages/@adobe/spectrum-css-temp/components/button/skin.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,13 @@ governing permissions and limitations under the License.
420420
}
421421
}
422422

423+
@media (forced-colors: active) {
424+
.spectrum-Button--pending.is-disabled {
425+
/* Force the border for WHCM */
426+
border-color: var(--spectrum-high-contrast-gray-text);
427+
}
428+
}
429+
423430
.spectrum-ActionButton {
424431
background-color: xvar(--spectrum-high-contrast-button-face, var(--spectrum-actionbutton-background-color));
425432
border-color: xvar(--spectrum-high-contrast-button-text, var(--spectrum-actionbutton-border-color));

packages/@adobe/spectrum-css-temp/components/circleloader/skin.css

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ governing permissions and limitations under the License.
1111
*/
1212

1313
.spectrum-CircleLoader {
14+
/* TODO: Update to use semantic tokens when available */
1415
--spectrum-loader-circle-medium-track-fill-color: var(--spectrum-accent-color-900);
16+
--spectrum-loader-circle-static-black-track-color: rgba(0, 0, 0, 0.25);
17+
--spectrum-loader-circle-static-black-fill-color: var(--spectrum-global-color-static-black);
1518
}
1619

1720
.spectrum-CircleLoader-track {
@@ -32,29 +35,22 @@ governing permissions and limitations under the License.
3235
}
3336
}
3437

35-
/* TODO: use semantic tokens or spectrum variables when available */
3638
.spectrum-CircleLoader--staticBlack {
3739
.spectrum-CircleLoader-track {
38-
border-color: rgba(0, 0, 0, 0.25);
40+
border-color: var(--spectrum-loader-circle-static-black-track-color);
3941
}
4042
.spectrum-CircleLoader-fill {
41-
border-color: var(--spectrum-global-color-static-black);
42-
}
43-
}
44-
45-
.spectrum-CircleLoader--indeterminate.spectrum-CircleLoader--overBackground {
46-
.spectrum-CircleLoader-track {
47-
border-color: var(--spectrum-loader-circle-medium-over-background-track-color);
48-
}
49-
.spectrum-CircleLoader-fill {
50-
border-color: var(--spectrum-loader-circle-medium-over-background-track-fill-color);
43+
border-color: var(--spectrum-loader-circle-static-black-fill-color);
5144
}
5245
}
5346

5447
@media (forced-colors: active) {
5548
.spectrum-CircleLoader {
5649
--spectrum-loader-circle-medium-track-fill-color: Highlight;
5750
--spectrum-loader-circle-medium-over-background-track-fill-color: Highlight;
58-
--spectrum-loader-circle-medium-track-color: CanvasText;
51+
--spectrum-loader-circle-static-black-fill-color: Highlight;
52+
--spectrum-loader-circle-medium-track-color: Background;
53+
--spectrum-loader-circle-medium-over-background-track-color: Background;
54+
--spectrum-loader-circle-static-black-track-color: Background;
5955
}
6056
}

packages/@react-spectrum/button/stories/Button.stories.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ export default {
6060
},
6161
style: {
6262
control: 'select',
63-
options: ['fill', 'outline']
63+
options: [undefined, 'fill', 'outline']
6464
},
6565
staticColor: {
6666
control: 'select',
67-
options: ['white', 'black']
67+
options: [undefined, 'white', 'black']
6868
},
6969
isPending: {
7070
control: 'boolean',
@@ -279,6 +279,10 @@ function Pending(props) {
279279
<Text>with onClick</Text>
280280
</PendingButtonOnClickComponent>
281281
</PendingButtonContainerComponent>
282+
283+
<PendingButtonContainerComponent {...props}>
284+
<PendingButtonComponent isDisabled {...props}>disabled</PendingButtonComponent>
285+
</PendingButtonContainerComponent>
282286
</Flex>
283287

284288
<View flexBasis={'100%'} paddingTop={16}>Controlled:</View>

packages/@react-spectrum/progress/docs/ProgressBar.mdx

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ By default, the value label is formatted as a percentage. This can be customized
112112

113113
Depending on the visualization being used (i.e. depending on the `showValueLabel` prop), a `label`, `aria-label`, or `aria-labelledby` prop is required.
114114

115-
If using the over background variant, ensure the background offers enough contrast for the ProgressBar to be legible and meets color contrast guidelines.
115+
If using the `staticColor` prop, ensure the background offers enough contrast for the ProgressBar to be legible and meets color contrast guidelines.
116116

117117
### Internationalization
118118

@@ -128,20 +128,9 @@ ProgressBar automatically uses the current locale to format the value label.
128128

129129
## Visual options
130130

131-
### Over background
132-
[View guidelines](https://spectrum.adobe.com/page/progress-bar/#Over-background-variant)
133-
134-
When a ProgressBar needs to be placed on top of a colored background, use the `overBackground` variant.
135-
136-
```tsx example
137-
<View backgroundColor="positive" padding="size-300">
138-
<ProgressBar label="Loading…" variant="overBackground" value={5} />
139-
</View>
140-
```
141-
142131
### Static color
143132

144-
When a ProgressBar needs to be placed on top of a dark background, use `staticColor='white'`. When it is over a light background, use `staticColor='black'`
133+
When a ProgressBar needs to be placed on top of a dark background, use `staticColor='white'`. When it is placed over a light background, use `staticColor='black'`.
145134

146135
```tsx example
147136
<View backgroundColor="static-blue-700" padding="size-300">

packages/@react-spectrum/progress/docs/ProgressCircle.mdx

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Use an indeterminate ProgressCircle when progress is happening but the time or e
7676

7777
An `aria-label` must be provided for accessibility. If the ProgressCircle is labeled by a separate element, an `aria-labelledby` prop must be provided using the id of the labeling element instead.
7878

79-
If using the `overBackground` variant, ensure the background offers enough contrast for the ProgressCircle to be legible and meets color contrast guidelines.
79+
If using the `staticColor` prop, ensure the background offers enough contrast for the ProgressCircle to be legible and meets color contrast guidelines.
8080

8181
### Internationalization
8282

@@ -90,21 +90,9 @@ For languages that are read right-to-left (e.g. Hebrew and Arabic), the fill of
9090

9191
## Visual options
9292

93-
### Over background
94-
[View guidelines](https://spectrum.adobe.com/page/progress-circle/#Over-background-variant)
95-
96-
When a ProgressCircle needs to be placed on top of a colored background, use the `overBackground` variant.
97-
98-
```tsx example
99-
<View backgroundColor="positive" padding="size-300">
100-
<ProgressCircle aria-label="Loading…" isIndeterminate variant="overBackground" />
101-
</View>
102-
```
103-
104-
10593
### Static color
10694

107-
When a ProgressCircle needs to be placed on top of a dark background, use `staticColor='white'`. When it is over a light background, use `staticColor='black'`
95+
When a ProgressCircle needs to be placed on top of a dark background, use `staticColor='white'`. When it is placed over a light background, use `staticColor='black'`.
10896

10997
```tsx example
11098
<View backgroundColor="static-blue-700" padding="size-300">

packages/@react-types/progress/src/index.d.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@ export interface SpectrumProgressCircleProps extends AriaProgressCircleProps, St
7070
size?: 'S' | 'M' | 'L',
7171
/** The static color style to apply. Useful when the button appears over a color background. */
7272
staticColor?: 'white' | 'black',
73-
/** The [visual style](https://spectrum.adobe.com/page/progress-circle/#Over-background-variant) of the ProgressCircle. */
73+
/**
74+
* The [visual style](https://spectrum.adobe.com/page/progress-circle/#Over-background-variant) of the ProgressCircle.
75+
*
76+
* @deprecated - use staticColor instead.
77+
*/
7478
variant?: 'overBackground'
7579
}
7680

@@ -92,6 +96,9 @@ export interface SpectrumProgressBarBaseProps extends AriaProgressBarBaseProps,
9296
export interface SpectrumProgressBarProps extends SpectrumProgressBarBaseProps, ProgressBarProps {
9397
/** The static color style to apply. Useful when the button appears over a color background. */
9498
staticColor?: 'white' | 'black',
95-
/** The [visual style](https://spectrum.adobe.com/page/progress-bar/#Over-background-variant) of the ProgressBar. */
99+
/**
100+
* The [visual style](https://spectrum.adobe.com/page/progress-bar/#Over-background-variant) of the ProgressBar.
101+
* @deprecated - use staticColor instead.
102+
*/
96103
variant?: 'overBackground'
97104
}

0 commit comments

Comments
 (0)