Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(radio): adding new colors, type, and size tokens, invalid state, WHCM #3555

Open
wants to merge 10 commits into
base: spectrum-two
Choose a base branch
from
32 changes: 32 additions & 0 deletions .changeset/angry-needles-behave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
"@spectrum-css/radio": major
"@spectrum-css/helptext": minor
---

# Radio S2 Migration

Updates:

- Now has an invalid/error state
- High contrast tokens have been modified
- Typography tokens modified
- Invalid state shows example with help text.

**Note:** Help text needed an update to the validation icon name. `Alert` was displaying a circle. The new icon name is `AlertTriangle` after the new icon set update. Another bug fix is the vertical alignment of the help text. `align-items: center` was simply added to fix it.

## New tokens

`--spectrum-radio-invalid-color-default`
`--spectrum-radio-invalid-color-hover`
`--spectrum-radio-invalid-color-down`
`--spectrum-radio-invalid-color-key-focus`
`--spectrum-radio-border-width`
`--spectrum-radio-text-font-weight`
`--spectrum-radio-text-font-style`

## Modified tokens

`--spectrum-radio-emphasized-accent-color`
`--spectrum-radio-emphasized-accent-color-hover`
`--spectrum-radio-emphasized-accent-color-down`
`--spectrum-radio-emphasized-accent-color-focus`
1 change: 1 addition & 0 deletions components/helptext/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@

color: var(--highcontrast-helptext-content-color-default, var(--mod-helptext-content-color-default, var(--spectrum-helptext-content-color-default)));
display: flex;
align-items: center;
font-size: var(--mod-helptext-font-size, var(--spectrum-helptext-font-size));
min-block-size: var(--mod-helptext-min-height, var(--spectrum-helptext-min-height));

Expand Down
2 changes: 1 addition & 1 deletion components/helptext/stories/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const Template = ({
${when(!hideIcon && variant == "negative", () =>
Icon(
{
iconName: "Alert",
iconName: "AlertTriangle",
setName: "workflow",
size,
customClasses: [`${rootClass}-validationIcon`],
Expand Down
45 changes: 33 additions & 12 deletions components/radio/dist/metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"sourceFile": "index.css",
"selectors": [
".is-invalid .spectrum-Radio-input + .spectrum-Radio-button:before",
".is-invalid .spectrum-Radio-input:checked + .spectrum-Radio-button:before",
".is-invalid:active .spectrum-Radio-input:checked + .spectrum-Radio-button:before",
".is-invalid:focus .spectrum-Radio-input:checked + .spectrum-Radio-button:before",
".is-invalid:hover .spectrum-Radio-input + .spectrum-Radio-button:before",
".is-invalid:hover .spectrum-Radio-input:checked + .spectrum-Radio-button:before",
".spectrum-Radio",
".spectrum-Radio .spectrum-Radio-button:after",
".spectrum-Radio .spectrum-Radio-input:checked:disabled + .spectrum-Radio-button:before",
Expand All @@ -26,9 +32,11 @@
".spectrum-Radio-label:lang(ko)",
".spectrum-Radio-label:lang(zh)",
".spectrum-Radio.is-readOnly .spectrum-Radio-input",
".spectrum-Radio.is-readOnly .spectrum-Radio-input + .spectrum-Radio-button:before",
".spectrum-Radio.is-readOnly .spectrum-Radio-input:checked:disabled ~ .spectrum-Radio-label",
".spectrum-Radio.is-readOnly .spectrum-Radio-input:disabled ~ .spectrum-Radio-label",
".spectrum-Radio.is-readOnly .spectrum-Radio-label",
".spectrum-Radio.is-readOnly:hover .spectrum-Radio-input + .spectrum-Radio-button:before",
".spectrum-Radio:active .spectrum-Radio-button:before",
".spectrum-Radio:active .spectrum-Radio-input:checked + .spectrum-Radio-button:before",
".spectrum-Radio:active .spectrum-Radio-label",
Expand All @@ -43,6 +51,7 @@
".spectrum-Radio:lang(ja)",
".spectrum-Radio:lang(ko)",
".spectrum-Radio:lang(zh)",
".spectrum-Radio:not(.is-readOnly):active .spectrum-Radio-input:not(:disabled) + .spectrum-Radio-button",
"[dir=\"rtl\"] .spectrum-Radio .spectrum-Radio-button:after"
],
"modifiers": [
Expand All @@ -69,6 +78,12 @@
"--mod-radio-focus-indicator-thickness",
"--mod-radio-font-size",
"--mod-radio-height",
"--mod-radio-invalid-border-color",
"--mod-radio-invalid-border-color-hover",
"--mod-radio-invalid-color-default",
"--mod-radio-invalid-color-down",
"--mod-radio-invalid-color-hover",
"--mod-radio-invalid-color-key-focus",
"--mod-radio-line-height",
"--mod-radio-line-height-cjk",
"--mod-radio-neutral-content-color",
Expand Down Expand Up @@ -111,6 +126,10 @@
"--spectrum-radio-focus-indicator-thickness",
"--spectrum-radio-font-size",
"--spectrum-radio-height",
"--spectrum-radio-invalid-color-default",
"--spectrum-radio-invalid-color-down",
"--spectrum-radio-invalid-color-hover",
"--spectrum-radio-invalid-color-key-focus",
"--spectrum-radio-label-bottom-to-text",
"--spectrum-radio-label-top-to-text",
"--spectrum-radio-line-height",
Expand All @@ -119,13 +138,17 @@
"--spectrum-radio-neutral-content-color-down",
"--spectrum-radio-neutral-content-color-focus",
"--spectrum-radio-neutral-content-color-hover",
"--spectrum-radio-text-font-style",
"--spectrum-radio-text-font-weight",
"--spectrum-radio-text-to-control"
],
"global": [
"--spectrum-accent-color-1000",
"--spectrum-accent-color-1100",
"--spectrum-accent-color-900",
"--spectrum-accent-content-color-default",
"--spectrum-accent-content-color-down",
"--spectrum-accent-content-color-hover",
"--spectrum-accent-content-color-key-focus",
"--spectrum-animation-duration-100",
"--spectrum-border-width-200",
"--spectrum-cjk-line-height-100",
"--spectrum-component-bottom-to-text-100",
"--spectrum-component-bottom-to-text-200",
Expand All @@ -135,10 +158,13 @@
"--spectrum-component-height-200",
"--spectrum-component-height-300",
"--spectrum-component-height-75",
"--spectrum-component-size-difference-down",
"--spectrum-component-size-minimum-perspective-down",
"--spectrum-component-top-to-text-100",
"--spectrum-component-top-to-text-200",
"--spectrum-component-top-to-text-300",
"--spectrum-component-top-to-text-75",
"--spectrum-default-font-style",
"--spectrum-disabled-content-color",
"--spectrum-focus-indicator-color",
"--spectrum-focus-indicator-gap",
Expand All @@ -147,27 +173,22 @@
"--spectrum-font-size-200",
"--spectrum-font-size-300",
"--spectrum-font-size-75",
"--spectrum-gray-50",
"--spectrum-gray-600",
"--spectrum-gray-700",
"--spectrum-gray-800",
"--spectrum-gray-25",
"--spectrum-line-height-100",
"--spectrum-neutral-background-color-selected-default",
"--spectrum-neutral-background-color-selected-down",
"--spectrum-neutral-background-color-selected-hover",
"--spectrum-neutral-background-color-selected-key-focus",
Comment on lines -155 to -158
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still see these on the token specs under "Radio button token changes", but it looks like that part of the Figma might be wrong, and they're actually neutral-content-color tokens now according to the other section of the Figma? The design team may need to update that.

"--spectrum-negative-color-1000",
"--spectrum-negative-color-900",
"--spectrum-neutral-content-color-default",
"--spectrum-neutral-content-color-down",
"--spectrum-neutral-content-color-hover",
"--spectrum-neutral-content-color-key-focus",
"--spectrum-regular-font-weight",
"--spectrum-text-to-control-100",
"--spectrum-text-to-control-200",
"--spectrum-text-to-control-300",
"--spectrum-text-to-control-75"
],
"passthroughs": [],
"high-contrast": [
"--highcontrast-radio-button-background-color",
"--highcontrast-radio-button-border-color-default",
"--highcontrast-radio-button-border-color-down",
"--highcontrast-radio-button-border-color-focus",
Expand Down
Loading
Loading