Skip to content

Commit 051f0f8

Browse files
authored
WB-1889: Rework action.disabled tokens (#2485)
## Summary: - Modified the `semanticColor` structure to include `disabled` tokens on every `action` variant (`primary` and `secondary`). - Updated the codebase to to make use of the new `disabled` tokens. Issue: WB-1889 ## Test plan: Verify that the disabled state of the components is consistent with the design system. Author: jandrade Reviewers: beaesguerra, jandrade Required Reviewers: Approved By: beaesguerra Checks: ✅ 12 checks were successful, ⏭️ 2 checks have been skipped Pull Request URL: #2485
1 parent e1b78db commit 051f0f8

File tree

20 files changed

+95
-51
lines changed

20 files changed

+95
-51
lines changed

.changeset/rare-balloons-beam.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@khanacademy/wonder-blocks-tokens": major
3+
---
4+
5+
Remove `action.disabled` object in favor of `action.primary.disabled` and `action.secondary.disabled`

.changeset/small-dryers-judge.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
"@khanacademy/wonder-blocks-search-field": patch
3+
"@khanacademy/wonder-blocks-icon-button": patch
4+
"@khanacademy/wonder-blocks-clickable": patch
5+
"@khanacademy/wonder-blocks-dropdown": patch
6+
"@khanacademy/wonder-blocks-button": patch
7+
"@khanacademy/wonder-blocks-switch": patch
8+
"@khanacademy/wonder-blocks-tokens": patch
9+
"@khanacademy/wonder-blocks-form": patch
10+
---
11+
12+
Rework action.disabled tokens to include properties per kind (border, background, foreground).

__docs__/foundations-color.mdx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,15 @@ Communicates strong emphasis and primary actions.
107107
/>
108108
</View>
109109

110+
#### Disabled
111+
112+
<ColorGroup
113+
colors={semanticColor.action.primary.disabled}
114+
group="action.primary.disabled"
115+
variant="compact"
116+
style={styles.gridCompact}
117+
/>
118+
110119
#### Secondary
111120

112121
Communicates secondary actions and less emphasis.
@@ -132,8 +141,8 @@ Communicates secondary actions and less emphasis.
132141
#### Disabled
133142

134143
<ColorGroup
135-
colors={semanticColor.action.disabled}
136-
group="action.disabled"
144+
colors={semanticColor.action.secondary.disabled}
145+
group="action.secondary.disabled"
137146
variant="compact"
138147
style={styles.gridCompact}
139148
/>

packages/wonder-blocks-button/src/themes/default.ts

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ const theme = {
2626
...semanticColor.action.primary.progressive,
2727
focus: focusOutline,
2828
disabled: {
29-
background: semanticColor.action.disabled.default,
30-
foreground: semanticColor.action.disabled.secondary,
29+
background:
30+
semanticColor.action.primary.disabled.background,
31+
foreground:
32+
semanticColor.action.primary.disabled.foreground,
3133
},
3234
},
3335

@@ -60,8 +62,10 @@ const theme = {
6062
...semanticColor.action.primary.destructive,
6163
focus: focusOutline,
6264
disabled: {
63-
background: semanticColor.action.disabled.default,
64-
foreground: semanticColor.action.disabled.secondary,
65+
background:
66+
semanticColor.action.primary.disabled.background,
67+
foreground:
68+
semanticColor.action.primary.disabled.foreground,
6569
},
6670
},
6771
// kind=primary / color=destructive / light=true
@@ -112,11 +116,11 @@ const theme = {
112116
icon: "transparent",
113117
},
114118
disabled: {
115-
border: semanticColor.action.disabled.default,
116-
background:
117-
semanticColor.action.secondary.progressive.press
118-
.background,
119-
foreground: semanticColor.text.disabled,
119+
// NOTE: This is a special case for the secondary button
120+
// TODO(WB-1895): Revisit disabled styles.
121+
border: semanticColor.action.primary.disabled.border,
122+
foreground:
123+
semanticColor.action.secondary.disabled.foreground,
120124
},
121125
},
122126
// kind=secondary / color=default / light=true
@@ -165,11 +169,11 @@ const theme = {
165169
icon: "transparent",
166170
},
167171
disabled: {
168-
border: semanticColor.action.disabled.default,
169-
background:
170-
semanticColor.action.secondary.destructive.press
171-
.background,
172-
foreground: semanticColor.text.disabled,
172+
// NOTE: This is a special case for the secondary button
173+
// TODO(WB-1895): Revisit disabled styles.
174+
border: semanticColor.action.primary.disabled.border,
175+
foreground:
176+
semanticColor.action.secondary.disabled.foreground,
173177
},
174178
},
175179
// kind=secondary / color=destructive / light=true
@@ -231,7 +235,8 @@ const theme = {
231235
.foreground,
232236
},
233237
disabled: {
234-
foreground: semanticColor.text.disabled,
238+
foreground:
239+
semanticColor.action.secondary.disabled.foreground,
235240
},
236241
},
237242
// kind=tertiary / color=default / light=true
@@ -276,7 +281,8 @@ const theme = {
276281
.foreground,
277282
},
278283
disabled: {
279-
foreground: semanticColor.text.disabled,
284+
foreground:
285+
semanticColor.action.secondary.disabled.foreground,
280286
},
281287
},
282288
// kind=tertiary / color=destructive / light=true

packages/wonder-blocks-clickable/src/components/clickable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ const styles = StyleSheet.create({
418418
outline: `solid ${border.width.thin}px ${semanticColor.border.inverse}`,
419419
},
420420
disabled: {
421-
color: semanticColor.text.disabled,
421+
color: semanticColor.action.secondary.disabled.foreground,
422422
cursor: "not-allowed",
423423
":focus": {
424424
outline: "none",

packages/wonder-blocks-dropdown/src/components/action-menu-opener-core.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,7 @@ const theme = {
113113
.foreground,
114114
},
115115
disabled: {
116-
// TODO(WB-1889): Use the new disabled color tokens.
117-
foreground: semanticColor.action.disabled.default,
116+
foreground: semanticColor.action.secondary.disabled.foreground,
118117
},
119118
press: {
120119
foreground:

packages/wonder-blocks-dropdown/src/components/checkbox.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,8 @@ const theme = {
7070
border: semanticColor.border.strong,
7171
},
7272
disabled: {
73-
// TODO(WB-1889): Use the new disabled color tokens.
74-
border: semanticColor.border.primary,
75-
background: semanticColor.action.disabled.secondary,
73+
border: semanticColor.action.secondary.disabled.border,
74+
background: semanticColor.action.secondary.disabled.background,
7675
},
7776
},
7877
},

packages/wonder-blocks-dropdown/src/components/combobox.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -700,10 +700,9 @@ const theme = {
700700
background: semanticColor.surface.primary,
701701
},
702702
disabled: {
703-
// TODO(WB-1889): Use the new disabled color tokens.
704-
border: semanticColor.border.primary,
705-
background: semanticColor.action.disabled.secondary,
706-
foreground: semanticColor.text.secondary,
703+
border: semanticColor.action.secondary.disabled.border,
704+
background: semanticColor.action.secondary.disabled.background,
705+
foreground: semanticColor.action.secondary.disabled.foreground,
707706
},
708707
error: {
709708
border: semanticColor.status.critical.foreground,

packages/wonder-blocks-dropdown/src/components/listbox.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ const theme = {
213213
listbox: {
214214
color: {
215215
disabled: {
216-
foreground: semanticColor.text.disabled,
216+
foreground: semanticColor.action.secondary.disabled.foreground,
217217
},
218218
},
219219
},

packages/wonder-blocks-dropdown/src/components/option-item.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ const theme = {
329329
},
330330
disabled: {
331331
background: "transparent",
332-
foreground: semanticColor.text.disabled,
332+
foreground: semanticColor.action.secondary.disabled.foreground,
333333
},
334334
},
335335
},

0 commit comments

Comments
 (0)