Skip to content

Commit 896342a

Browse files
authored
Add WHCM styles for RAC TagGroup docs (#4680)
1 parent 33aafec commit 896342a

File tree

1 file changed

+42
-9
lines changed

1 file changed

+42
-9
lines changed

packages/react-aria-components/docs/TagGroup.mdx

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@ import {TagGroup, TagList, Tag, Label} from 'react-aria-components';
5858

5959
```css
6060
.react-aria-TagGroup {
61+
--border-color: var(--spectrum-gray-600);
62+
--border-color-hovered: var(--spectrum-gray-900);
63+
--background-selected: var(--spectrum-gray-900);
64+
--text-color: var(--spectrum-gray-800);
65+
--text-color-selected: var(--spectrum-gray-50);
66+
--remove-button-color: var(--spectrum-gray-700);
67+
--remove-button-color-hovered: var(--spectrum-gray-900);
68+
--focus-ring-color: slateblue;
69+
--invalid-color: var(--spectrum-global-color-red-600);
70+
6171
display: flex;
6272
flex-direction: column;
6373
gap: 2px;
@@ -69,7 +79,7 @@ import {TagGroup, TagList, Tag, Label} from 'react-aria-components';
6979

7080
[slot=errorMessage] {
7181
font-size: 12px;
72-
color: var(--spectrum-global-color-red-600);
82+
color: var(--invalid-color);
7383
}
7484
}
7585

@@ -79,7 +89,8 @@ import {TagGroup, TagList, Tag, Label} from 'react-aria-components';
7989
gap: 4px;
8090

8191
.react-aria-Tag {
82-
border: 1px solid var(--spectrum-gray-600);;
92+
color: var(--text-color);
93+
border: 1px solid var(--border-color);
8394
border-radius: 4px;
8495
padding: 2px 8px;
8596
font-size: 0.929rem;
@@ -90,18 +101,18 @@ import {TagGroup, TagList, Tag, Label} from 'react-aria-components';
90101
transition: border-color 200ms;
91102

92103
&[data-hovered] {
93-
border-color: var(--spectrum-gray-900);
104+
border-color: var(--border-color-hovered);
94105
}
95106

96107
&[data-focus-visible] {
97-
outline: 2px solid slateblue;
108+
outline: 2px solid var(--focus-ring-color);
98109
outline-offset: 2px;
99110
}
100111

101112
&[aria-selected=true] {
102-
border-color: var(--spectrum-gray-900);
103-
background: var(--spectrum-gray-900);
104-
color: var(--spectrum-gray-50);
113+
border-color: var(--background-selected);
114+
background: var(--background-selected);
115+
color: var(--text-color-selected);
105116
}
106117

107118
&[aria-disabled] {
@@ -113,17 +124,39 @@ import {TagGroup, TagList, Tag, Label} from 'react-aria-components';
113124
border: none;
114125
padding: 0;
115126
margin-left: 8px;
116-
color: var(--spectrum-gray-700);
127+
color: var(--remove-button-color);
117128
transition: color 200ms;
118129
outline: none;
119130
font-size: 0.95em;
120131

121132
&[data-hovered] {
122-
color: var(--spectrum-gray-900);
133+
color: var(--remove-button-color-hovered);
123134
}
124135
}
125136
}
126137
}
138+
139+
@media (forced-colors: active) {
140+
.react-aria-TagGroup {
141+
forced-color-adjust: none;
142+
--border-color: ButtonBorder;
143+
--border-color-hovered: ButtonBorder;
144+
--background-selected: Highlight;
145+
--text-color: ButtonText;
146+
--text-color-selected: HighlightText;
147+
--remove-button-color: ButtonText;
148+
--remove-button-color-hovered: Highlight;
149+
--focus-ring-color: Highlight;
150+
--invalid-color: LinkText;
151+
152+
.react-aria-Tag[aria-disabled] {
153+
opacity: 1;
154+
--border-color: GrayText;
155+
--border-color-hovered: GrayText;
156+
--text-color: GrayText;
157+
}
158+
}
159+
}
127160
```
128161

129162
</details>

0 commit comments

Comments
 (0)